Skip to content

Commit 79aeb66

Browse files
authored
Sync protocol with new gala (#893)
Required for elementary/gala#2863
1 parent 1b85892 commit 79aeb66

7 files changed

Lines changed: 128 additions & 88 deletions

File tree

compositor/PantheonShell.vala

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ namespace GreeterCompositor {
1717
private static Pantheon.Desktop.ShellInterface wayland_pantheon_shell_interface;
1818
private static Pantheon.Desktop.PanelInterface wayland_pantheon_panel_interface;
1919
private static Pantheon.Desktop.WidgetInterface wayland_pantheon_widget_interface;
20-
private static Pantheon.Desktop.GreeterInterface wayland_pantheon_greeter_interface;
2120
private static Pantheon.Desktop.ExtendedBehaviorInterface wayland_pantheon_extended_behavior_interface;
21+
private static Pantheon.Desktop.GreeterInterface wayland_pantheon_greeter_interface;
2222
private static Wl.Global shell_global;
2323

2424
public void init_pantheon_shell (Meta.Context context) {
@@ -50,22 +50,22 @@ namespace GreeterCompositor {
5050
destroy_widget_surface,
5151
};
5252

53-
wayland_pantheon_greeter_interface = {
54-
destroy_greeter_surface,
55-
init_greeter,
56-
};
57-
5853
wayland_pantheon_extended_behavior_interface = {
5954
destroy_extended_behavior_surface,
6055
set_keep_above,
6156
make_centered,
6257
focus_extended_behavior,
6358
};
6459

60+
wayland_pantheon_greeter_interface = {
61+
destroy_greeter_surface,
62+
make_greeter,
63+
};
64+
6565
PanelSurface.quark = GLib.Quark.from_string ("-gala-wayland-panel-surface-data");
6666
WidgetSurface.quark = GLib.Quark.from_string ("-gala-wayland-widget-surface-data");
67-
GreeterSurface.quark = GLib.Quark.from_string ("-gala-wayland-greeter-surface-data");
6867
ExtendedBehaviorSurface.quark = GLib.Quark.from_string ("-gala-wayland-extended-behavior-surface-data");
68+
GreeterSurface.quark = GLib.Quark.from_string ("-gala-wayland-greeter-surface-data");
6969

7070
shell_global = Wl.Global.create (wl_disp, ref Pantheon.Desktop.ShellInterface.iface, 1, (client, version, id) => {
7171
unowned var resource = client.create_resource (ref Pantheon.Desktop.ShellInterface.iface, (int) version, id);
@@ -111,15 +111,15 @@ namespace GreeterCompositor {
111111
}
112112
}
113113

114-
public class GreeterSurface : GLib.Object {
114+
public class ExtendedBehaviorSurface : GLib.Object {
115115
public static GLib.Quark quark = 0;
116116
public unowned GLib.Object? wayland_surface;
117117

118-
public GreeterSurface (GLib.Object wayland_surface) {
118+
public ExtendedBehaviorSurface (GLib.Object wayland_surface) {
119119
this.wayland_surface = wayland_surface;
120120
}
121121

122-
~GreeterSurface () {
122+
~ExtendedBehaviorSurface () {
123123
if (wayland_surface != null) {
124124
wayland_surface.steal_qdata<unowned GLib.Object> (quark);
125125
}
@@ -130,15 +130,15 @@ namespace GreeterCompositor {
130130
}
131131
}
132132

133-
public class ExtendedBehaviorSurface : GLib.Object {
133+
public class GreeterSurface : GLib.Object {
134134
public static GLib.Quark quark = 0;
135135
public unowned GLib.Object? wayland_surface;
136136

137-
public ExtendedBehaviorSurface (GLib.Object wayland_surface) {
137+
public GreeterSurface (GLib.Object wayland_surface) {
138138
this.wayland_surface = wayland_surface;
139139
}
140140

141-
~ExtendedBehaviorSurface () {
141+
~GreeterSurface () {
142142
if (wayland_surface != null) {
143143
wayland_surface.steal_qdata<unowned GLib.Object> (quark);
144144
}
@@ -353,23 +353,6 @@ namespace GreeterCompositor {
353353
BlurManager.get_instance ().remove_blur (window);
354354
}
355355

356-
internal static void init_greeter (Wl.Client client, Wl.Resource resource) {
357-
unowned GreeterSurface? greeter_surface = resource.get_user_data<GreeterSurface> ();
358-
if (greeter_surface.wayland_surface == null) {
359-
warning ("Window tried to init greeter but wayland surface is null.");
360-
return;
361-
}
362-
363-
Meta.Window? window;
364-
greeter_surface.wayland_surface.get ("window", out window, null);
365-
if (window == null) {
366-
warning ("Window tried to init greeter but wayland surface had no associated window.");
367-
return;
368-
}
369-
370-
ShellClientsManager.get_instance ().init_greeter (window);
371-
}
372-
373356
internal static void focus_extended_behavior (Wl.Client client, Wl.Resource resource) {
374357
unowned ExtendedBehaviorSurface? extended_behavior_surface = resource.get_user_data<ExtendedBehaviorSurface> ();
375358
if (extended_behavior_surface.wayland_surface == null) {
@@ -421,6 +404,23 @@ namespace GreeterCompositor {
421404
ShellClientsManager.get_instance ().make_centered (window);
422405
}
423406

407+
internal static void make_greeter (Wl.Client client, Wl.Resource resource) {
408+
unowned GreeterSurface? greeter_surface = resource.get_user_data<GreeterSurface> ();
409+
if (greeter_surface.wayland_surface == null) {
410+
warning ("Window tried to make greeter but wayland surface is null.");
411+
return;
412+
}
413+
414+
Meta.Window? window;
415+
greeter_surface.wayland_surface.get ("window", out window, null);
416+
if (window == null) {
417+
warning ("Window tried to make greeter but wayland surface had no associated window.");
418+
return;
419+
}
420+
421+
ShellClientsManager.get_instance ().make_greeter (window);
422+
}
423+
424424
internal static void destroy_panel_surface (Wl.Client client, Wl.Resource resource) {
425425
resource.destroy ();
426426
}
@@ -429,11 +429,11 @@ namespace GreeterCompositor {
429429
resource.destroy ();
430430
}
431431

432-
internal static void destroy_greeter_surface (Wl.Client client, Wl.Resource resource) {
432+
internal static void destroy_extended_behavior_surface (Wl.Client client, Wl.Resource resource) {
433433
resource.destroy ();
434434
}
435435

436-
internal static void destroy_extended_behavior_surface (Wl.Client client, Wl.Resource resource) {
436+
internal static void destroy_greeter_surface (Wl.Client client, Wl.Resource resource) {
437437
resource.destroy ();
438438
}
439439
}

compositor/ShellClients/ShellClientsManager.vala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,17 @@ public class GreeterCompositor.ShellClientsManager : Object {
173173
debug ("Hide mode is unsupported in greeter-compositor");
174174
}
175175

176-
public void init_greeter (Meta.Window window) {
177-
make_desktop (window);
178-
179-
positioned_windows[window] = new ShellWindow (window, FULLSCREEN);
176+
public void make_centered (Meta.Window window) requires (!is_itself_shell_window (window)) {
177+
positioned_windows[window] = new ShellWindow (window, CENTER);
180178

181179
// connect_after so we make sure that any queued move is unqueued
182180
window.unmanaging.connect_after ((_window) => positioned_windows.remove (_window));
183181
}
184182

185-
public void make_centered (Meta.Window window) requires (!is_itself_shell_window (window)) {
186-
positioned_windows[window] = new ShellWindow (window, CENTER);
183+
public void make_greeter (Meta.Window window) {
184+
make_desktop (window);
185+
186+
positioned_windows[window] = new ShellWindow (window, FULLSCREEN);
187187

188188
// connect_after so we make sure that any queued move is unqueued
189189
window.unmanaging.connect_after ((_window) => positioned_windows.remove (_window));
@@ -288,10 +288,6 @@ public class GreeterCompositor.ShellClientsManager : Object {
288288
}
289289
break;
290290

291-
case "greeter":
292-
init_greeter (window);
293-
break;
294-
295291
case "centered":
296292
make_centered (window);
297293
break;
@@ -300,6 +296,10 @@ public class GreeterCompositor.ShellClientsManager : Object {
300296
set_restore_previous_x11_region (window);
301297
break;
302298

299+
case "greeter":
300+
make_greeter (window);
301+
break;
302+
303303
default:
304304
break;
305305
}

compositor/protocol/pantheon-desktop-shell-v1.xml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<protocol name="pantheon_shell_v1">
33
<copyright><![CDATA[
4-
SPDX-FileCopyrightText: 2025 elementary, Inc. <https://elementary.io>
5-
2023 Corentin Noël <tintou@noel.tf>
4+
SPDX-FileCopyrightText: 2023 Corentin Noël <tintou@noel.tf>
65
76
SPDX-License-Identifier: LGPL-2.1-or-later
87
]]></copyright>
@@ -137,16 +136,6 @@
137136
<request name="destroy" type="destructor"/>
138137
</interface>
139138

140-
<interface name="io_elementary_pantheon_greeter_v1" version="1">
141-
<request name="destroy" type="destructor"/>
142-
143-
<request name="init">
144-
<description summary="init greeter">
145-
Init Greeter
146-
</description>
147-
</request>
148-
</interface>
149-
150139
<interface name="io_elementary_pantheon_extended_behavior_v1" version="1">
151140
<request name="destroy" type="destructor"/>
152141
<request name="set_keep_above">
@@ -170,5 +159,33 @@
170159
by the compositor.
171160
</description>
172161
</request>
162+
163+
<request name="make_modal">
164+
<description summary="requests to make a surface system modal">
165+
This will block all user input outside the surface and most system shortcuts.
166+
</description>
167+
168+
<arg name="dim" type="uint" summary="1 to dim, 0 to not dim"/>
169+
</request>
170+
171+
<request name="make_monitor_label">
172+
<description summary="makes the surface a monitor label for the given monitor">
173+
Request to make the surface a monitor label for the given monitor. The surface will be placed
174+
in the top left corner of the monitor and will be kept above other surfaces.
175+
</description>
176+
177+
<arg name="monitor_index" type="int" summary="the index of the monitor this surface should label"/>
178+
</request>
179+
</interface>
180+
181+
<interface name="io_elementary_pantheon_greeter_v1" version="1">
182+
<request name="destroy" type="destructor"/>
183+
184+
<request name="make_greeter">
185+
<description summary="make greeter">
186+
Request to make the surface a Greeter window, which will be displayed bellow other windows
187+
when running in greeter compositor mode.
188+
</description>
189+
</request>
173190
</interface>
174191
</protocol>

compositor/protocol/pantheon-desktop-shell.vapi

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2025 elementary, Inc. <https://elementary.io>
2+
* Copyright 2023-2026 elementary, Inc. <https://elementary.io>
33
* Copyright 2023 Corentin Noël <tintou@noel.tf>
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
@@ -53,14 +53,6 @@ namespace Pantheon.Desktop {
5353
public Destroy destroy;
5454
}
5555

56-
[CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "struct io_elementary_pantheon_greeter_v1_interface")]
57-
public struct GreeterInterface {
58-
[CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "io_elementary_pantheon_greeter_v1_interface")]
59-
public static Wl.Interface iface;
60-
public Destroy destroy;
61-
public Init init;
62-
}
63-
6456
[CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "struct io_elementary_pantheon_extended_behavior_v1_interface")]
6557
public struct ExtendedBehaviorInterface {
6658
[CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "io_elementary_pantheon_extended_behavior_v1_interface")]
@@ -69,17 +61,27 @@ namespace Pantheon.Desktop {
6961
public SetKeepAbove set_keep_above;
7062
public MakeCentered make_centered;
7163
public Focus focus;
64+
public MakeModal make_modal;
65+
public MakeMonitorLabel make_monitor_label;
66+
}
67+
68+
[CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "struct io_elementary_pantheon_greeter_v1_interface")]
69+
public struct GreeterInterface {
70+
[CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "io_elementary_pantheon_greeter_v1_interface")]
71+
public static Wl.Interface iface;
72+
public Destroy destroy;
73+
public MakeGreeter make_greeter;
7274
}
7375

7476
[CCode (has_target = false, has_typedef = false)]
7577
public delegate void GetPanel (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface);
7678
[CCode (has_target = false, has_typedef = false)]
7779
public delegate void GetWidget (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface);
7880
[CCode (has_target = false, has_typedef = false)]
79-
public delegate void GetGreeter (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface);
80-
[CCode (has_target = false, has_typedef = false)]
8181
public delegate void GetExtendedBehavior (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface);
8282
[CCode (has_target = false, has_typedef = false)]
83+
public delegate void GetGreeter (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface);
84+
[CCode (has_target = false, has_typedef = false)]
8385
public delegate void SetAnchor (Wl.Client client, Wl.Resource resource, [CCode (type = "uint32_t")] Anchor anchor);
8486
[CCode (has_target = false, has_typedef = false)]
8587
public delegate void Focus (Wl.Client client, Wl.Resource resource);
@@ -94,11 +96,15 @@ namespace Pantheon.Desktop {
9496
[CCode (has_target = false, has_typedef = false)]
9597
public delegate void RemoveBlur (Wl.Client client, Wl.Resource resource);
9698
[CCode (has_target = false, has_typedef = false)]
97-
public delegate void Init (Wl.Client client, Wl.Resource resource);
98-
[CCode (has_target = false, has_typedef = false)]
9999
public delegate void SetKeepAbove (Wl.Client client, Wl.Resource resource);
100100
[CCode (has_target = false, has_typedef = false)]
101101
public delegate void MakeCentered (Wl.Client client, Wl.Resource resource);
102102
[CCode (has_target = false, has_typedef = false)]
103+
public delegate void MakeModal (Wl.Client client, Wl.Resource resource, uint dim);
104+
[CCode (has_target = false, has_typedef = false)]
105+
public delegate void MakeMonitorLabel (Wl.Client client, Wl.Resource resource, int monitor_index);
106+
[CCode (has_target = false, has_typedef = false)]
107+
public delegate void MakeGreeter (Wl.Client client, Wl.Resource resource);
108+
[CCode (has_target = false, has_typedef = false)]
103109
public delegate void Destroy (Wl.Client client, Wl.Resource resource);
104110
}

protocol/pantheon-desktop-shell-v1.xml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<protocol name="pantheon_shell_v1">
33
<copyright><![CDATA[
4-
SPDX-FileCopyrightText: 2025 elementary, Inc. <https://elementary.io>
5-
2023 Corentin Noël <tintou@noel.tf>
4+
SPDX-FileCopyrightText: 2023 Corentin Noël <tintou@noel.tf>
65
76
SPDX-License-Identifier: LGPL-2.1-or-later
87
]]></copyright>
@@ -137,16 +136,6 @@
137136
<request name="destroy" type="destructor"/>
138137
</interface>
139138

140-
<interface name="io_elementary_pantheon_greeter_v1" version="1">
141-
<request name="destroy" type="destructor"/>
142-
143-
<request name="init">
144-
<description summary="init greeter">
145-
Init Greeter
146-
</description>
147-
</request>
148-
</interface>
149-
150139
<interface name="io_elementary_pantheon_extended_behavior_v1" version="1">
151140
<request name="destroy" type="destructor"/>
152141
<request name="set_keep_above">
@@ -170,5 +159,33 @@
170159
by the compositor.
171160
</description>
172161
</request>
162+
163+
<request name="make_modal">
164+
<description summary="requests to make a surface system modal">
165+
This will block all user input outside the surface and most system shortcuts.
166+
</description>
167+
168+
<arg name="dim" type="uint" summary="1 to dim, 0 to not dim"/>
169+
</request>
170+
171+
<request name="make_monitor_label">
172+
<description summary="makes the surface a monitor label for the given monitor">
173+
Request to make the surface a monitor label for the given monitor. The surface will be placed
174+
in the top left corner of the monitor and will be kept above other surfaces.
175+
</description>
176+
177+
<arg name="monitor_index" type="int" summary="the index of the monitor this surface should label"/>
178+
</request>
179+
</interface>
180+
181+
<interface name="io_elementary_pantheon_greeter_v1" version="1">
182+
<request name="destroy" type="destructor"/>
183+
184+
<request name="make_greeter">
185+
<description summary="make greeter">
186+
Request to make the surface a Greeter window, which will be displayed bellow other windows
187+
when running in greeter compositor mode.
188+
</description>
189+
</request>
173190
</interface>
174191
</protocol>

0 commit comments

Comments
 (0)