From 802fbbc6dea2d816f3a4cce819dc9266d9488d57 Mon Sep 17 00:00:00 2001 From: lenemter Date: Fri, 24 Jul 2026 19:02:55 +0200 Subject: [PATCH] Sync protocol with new gala --- compositor/PantheonShell.vala | 64 +++++++++---------- .../ShellClients/ShellClientsManager.vala | 20 +++--- .../protocol/pantheon-desktop-shell-v1.xml | 41 ++++++++---- .../protocol/pantheon-desktop-shell.vapi | 32 ++++++---- protocol/pantheon-desktop-shell-v1.xml | 41 ++++++++---- protocol/pantheon-desktop-shell.vapi | 16 ++--- src/MainWindow.vala | 2 +- 7 files changed, 128 insertions(+), 88 deletions(-) diff --git a/compositor/PantheonShell.vala b/compositor/PantheonShell.vala index 85c63a40..16f40127 100644 --- a/compositor/PantheonShell.vala +++ b/compositor/PantheonShell.vala @@ -17,8 +17,8 @@ namespace GreeterCompositor { private static Pantheon.Desktop.ShellInterface wayland_pantheon_shell_interface; private static Pantheon.Desktop.PanelInterface wayland_pantheon_panel_interface; private static Pantheon.Desktop.WidgetInterface wayland_pantheon_widget_interface; - private static Pantheon.Desktop.GreeterInterface wayland_pantheon_greeter_interface; private static Pantheon.Desktop.ExtendedBehaviorInterface wayland_pantheon_extended_behavior_interface; + private static Pantheon.Desktop.GreeterInterface wayland_pantheon_greeter_interface; private static Wl.Global shell_global; public void init_pantheon_shell (Meta.Context context) { @@ -50,11 +50,6 @@ namespace GreeterCompositor { destroy_widget_surface, }; - wayland_pantheon_greeter_interface = { - destroy_greeter_surface, - init_greeter, - }; - wayland_pantheon_extended_behavior_interface = { destroy_extended_behavior_surface, set_keep_above, @@ -62,10 +57,15 @@ namespace GreeterCompositor { focus_extended_behavior, }; + wayland_pantheon_greeter_interface = { + destroy_greeter_surface, + make_greeter, + }; + PanelSurface.quark = GLib.Quark.from_string ("-gala-wayland-panel-surface-data"); WidgetSurface.quark = GLib.Quark.from_string ("-gala-wayland-widget-surface-data"); - GreeterSurface.quark = GLib.Quark.from_string ("-gala-wayland-greeter-surface-data"); ExtendedBehaviorSurface.quark = GLib.Quark.from_string ("-gala-wayland-extended-behavior-surface-data"); + GreeterSurface.quark = GLib.Quark.from_string ("-gala-wayland-greeter-surface-data"); shell_global = Wl.Global.create (wl_disp, ref Pantheon.Desktop.ShellInterface.iface, 1, (client, version, id) => { unowned var resource = client.create_resource (ref Pantheon.Desktop.ShellInterface.iface, (int) version, id); @@ -111,15 +111,15 @@ namespace GreeterCompositor { } } - public class GreeterSurface : GLib.Object { + public class ExtendedBehaviorSurface : GLib.Object { public static GLib.Quark quark = 0; public unowned GLib.Object? wayland_surface; - public GreeterSurface (GLib.Object wayland_surface) { + public ExtendedBehaviorSurface (GLib.Object wayland_surface) { this.wayland_surface = wayland_surface; } - ~GreeterSurface () { + ~ExtendedBehaviorSurface () { if (wayland_surface != null) { wayland_surface.steal_qdata (quark); } @@ -130,15 +130,15 @@ namespace GreeterCompositor { } } - public class ExtendedBehaviorSurface : GLib.Object { + public class GreeterSurface : GLib.Object { public static GLib.Quark quark = 0; public unowned GLib.Object? wayland_surface; - public ExtendedBehaviorSurface (GLib.Object wayland_surface) { + public GreeterSurface (GLib.Object wayland_surface) { this.wayland_surface = wayland_surface; } - ~ExtendedBehaviorSurface () { + ~GreeterSurface () { if (wayland_surface != null) { wayland_surface.steal_qdata (quark); } @@ -353,23 +353,6 @@ namespace GreeterCompositor { BlurManager.get_instance ().remove_blur (window); } - internal static void init_greeter (Wl.Client client, Wl.Resource resource) { - unowned GreeterSurface? greeter_surface = resource.get_user_data (); - if (greeter_surface.wayland_surface == null) { - warning ("Window tried to init greeter but wayland surface is null."); - return; - } - - Meta.Window? window; - greeter_surface.wayland_surface.get ("window", out window, null); - if (window == null) { - warning ("Window tried to init greeter but wayland surface had no associated window."); - return; - } - - ShellClientsManager.get_instance ().init_greeter (window); - } - internal static void focus_extended_behavior (Wl.Client client, Wl.Resource resource) { unowned ExtendedBehaviorSurface? extended_behavior_surface = resource.get_user_data (); if (extended_behavior_surface.wayland_surface == null) { @@ -421,6 +404,23 @@ namespace GreeterCompositor { ShellClientsManager.get_instance ().make_centered (window); } + internal static void make_greeter (Wl.Client client, Wl.Resource resource) { + unowned GreeterSurface? greeter_surface = resource.get_user_data (); + if (greeter_surface.wayland_surface == null) { + warning ("Window tried to make greeter but wayland surface is null."); + return; + } + + Meta.Window? window; + greeter_surface.wayland_surface.get ("window", out window, null); + if (window == null) { + warning ("Window tried to make greeter but wayland surface had no associated window."); + return; + } + + ShellClientsManager.get_instance ().make_greeter (window); + } + internal static void destroy_panel_surface (Wl.Client client, Wl.Resource resource) { resource.destroy (); } @@ -429,11 +429,11 @@ namespace GreeterCompositor { resource.destroy (); } - internal static void destroy_greeter_surface (Wl.Client client, Wl.Resource resource) { + internal static void destroy_extended_behavior_surface (Wl.Client client, Wl.Resource resource) { resource.destroy (); } - internal static void destroy_extended_behavior_surface (Wl.Client client, Wl.Resource resource) { + internal static void destroy_greeter_surface (Wl.Client client, Wl.Resource resource) { resource.destroy (); } } diff --git a/compositor/ShellClients/ShellClientsManager.vala b/compositor/ShellClients/ShellClientsManager.vala index fe8ce2c3..b1223a25 100644 --- a/compositor/ShellClients/ShellClientsManager.vala +++ b/compositor/ShellClients/ShellClientsManager.vala @@ -173,17 +173,17 @@ public class GreeterCompositor.ShellClientsManager : Object { debug ("Hide mode is unsupported in greeter-compositor"); } - public void init_greeter (Meta.Window window) { - make_desktop (window); - - positioned_windows[window] = new ShellWindow (window, FULLSCREEN); + public void make_centered (Meta.Window window) requires (!is_itself_shell_window (window)) { + positioned_windows[window] = new ShellWindow (window, CENTER); // connect_after so we make sure that any queued move is unqueued window.unmanaging.connect_after ((_window) => positioned_windows.remove (_window)); } - public void make_centered (Meta.Window window) requires (!is_itself_shell_window (window)) { - positioned_windows[window] = new ShellWindow (window, CENTER); + public void make_greeter (Meta.Window window) { + make_desktop (window); + + positioned_windows[window] = new ShellWindow (window, FULLSCREEN); // connect_after so we make sure that any queued move is unqueued window.unmanaging.connect_after ((_window) => positioned_windows.remove (_window)); @@ -288,10 +288,6 @@ public class GreeterCompositor.ShellClientsManager : Object { } break; - case "greeter": - init_greeter (window); - break; - case "centered": make_centered (window); break; @@ -300,6 +296,10 @@ public class GreeterCompositor.ShellClientsManager : Object { set_restore_previous_x11_region (window); break; + case "greeter": + make_greeter (window); + break; + default: break; } diff --git a/compositor/protocol/pantheon-desktop-shell-v1.xml b/compositor/protocol/pantheon-desktop-shell-v1.xml index 5e8f9922..210d3a2f 100644 --- a/compositor/protocol/pantheon-desktop-shell-v1.xml +++ b/compositor/protocol/pantheon-desktop-shell-v1.xml @@ -1,8 +1,7 @@ - 2023 Corentin Noël + SPDX-FileCopyrightText: 2023 Corentin Noël SPDX-License-Identifier: LGPL-2.1-or-later ]]> @@ -137,16 +136,6 @@ - - - - - - Init Greeter - - - - @@ -170,5 +159,33 @@ by the compositor. + + + + This will block all user input outside the surface and most system shortcuts. + + + + + + + + Request to make the surface a monitor label for the given monitor. The surface will be placed + in the top left corner of the monitor and will be kept above other surfaces. + + + + + + + + + + + + Request to make the surface a Greeter window, which will be displayed bellow other windows + when running in greeter compositor mode. + + diff --git a/compositor/protocol/pantheon-desktop-shell.vapi b/compositor/protocol/pantheon-desktop-shell.vapi index ad4b03a7..ba95c891 100644 --- a/compositor/protocol/pantheon-desktop-shell.vapi +++ b/compositor/protocol/pantheon-desktop-shell.vapi @@ -1,5 +1,5 @@ /* - * Copyright 2023-2025 elementary, Inc. + * Copyright 2023-2026 elementary, Inc. * Copyright 2023 Corentin Noël * SPDX-License-Identifier: GPL-3.0-or-later */ @@ -53,14 +53,6 @@ namespace Pantheon.Desktop { public Destroy destroy; } - [CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "struct io_elementary_pantheon_greeter_v1_interface")] - public struct GreeterInterface { - [CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "io_elementary_pantheon_greeter_v1_interface")] - public static Wl.Interface iface; - public Destroy destroy; - public Init init; - } - [CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "struct io_elementary_pantheon_extended_behavior_v1_interface")] public struct ExtendedBehaviorInterface { [CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "io_elementary_pantheon_extended_behavior_v1_interface")] @@ -69,6 +61,16 @@ namespace Pantheon.Desktop { public SetKeepAbove set_keep_above; public MakeCentered make_centered; public Focus focus; + public MakeModal make_modal; + public MakeMonitorLabel make_monitor_label; + } + + [CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "struct io_elementary_pantheon_greeter_v1_interface")] + public struct GreeterInterface { + [CCode (cheader_filename = "pantheon-desktop-shell-server-protocol.h", cname = "io_elementary_pantheon_greeter_v1_interface")] + public static Wl.Interface iface; + public Destroy destroy; + public MakeGreeter make_greeter; } [CCode (has_target = false, has_typedef = false)] @@ -76,10 +78,10 @@ namespace Pantheon.Desktop { [CCode (has_target = false, has_typedef = false)] public delegate void GetWidget (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface); [CCode (has_target = false, has_typedef = false)] - public delegate void GetGreeter (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface); - [CCode (has_target = false, has_typedef = false)] public delegate void GetExtendedBehavior (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface); [CCode (has_target = false, has_typedef = false)] + public delegate void GetGreeter (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface); + [CCode (has_target = false, has_typedef = false)] public delegate void SetAnchor (Wl.Client client, Wl.Resource resource, [CCode (type = "uint32_t")] Anchor anchor); [CCode (has_target = false, has_typedef = false)] public delegate void Focus (Wl.Client client, Wl.Resource resource); @@ -94,11 +96,15 @@ namespace Pantheon.Desktop { [CCode (has_target = false, has_typedef = false)] public delegate void RemoveBlur (Wl.Client client, Wl.Resource resource); [CCode (has_target = false, has_typedef = false)] - public delegate void Init (Wl.Client client, Wl.Resource resource); - [CCode (has_target = false, has_typedef = false)] public delegate void SetKeepAbove (Wl.Client client, Wl.Resource resource); [CCode (has_target = false, has_typedef = false)] public delegate void MakeCentered (Wl.Client client, Wl.Resource resource); [CCode (has_target = false, has_typedef = false)] + public delegate void MakeModal (Wl.Client client, Wl.Resource resource, uint dim); + [CCode (has_target = false, has_typedef = false)] + public delegate void MakeMonitorLabel (Wl.Client client, Wl.Resource resource, int monitor_index); + [CCode (has_target = false, has_typedef = false)] + public delegate void MakeGreeter (Wl.Client client, Wl.Resource resource); + [CCode (has_target = false, has_typedef = false)] public delegate void Destroy (Wl.Client client, Wl.Resource resource); } diff --git a/protocol/pantheon-desktop-shell-v1.xml b/protocol/pantheon-desktop-shell-v1.xml index 5e8f9922..210d3a2f 100644 --- a/protocol/pantheon-desktop-shell-v1.xml +++ b/protocol/pantheon-desktop-shell-v1.xml @@ -1,8 +1,7 @@ - 2023 Corentin Noël + SPDX-FileCopyrightText: 2023 Corentin Noël SPDX-License-Identifier: LGPL-2.1-or-later ]]> @@ -137,16 +136,6 @@ - - - - - - Init Greeter - - - - @@ -170,5 +159,33 @@ by the compositor. + + + + This will block all user input outside the surface and most system shortcuts. + + + + + + + + Request to make the surface a monitor label for the given monitor. The surface will be placed + in the top left corner of the monitor and will be kept above other surfaces. + + + + + + + + + + + + Request to make the surface a Greeter window, which will be displayed bellow other windows + when running in greeter compositor mode. + + diff --git a/protocol/pantheon-desktop-shell.vapi b/protocol/pantheon-desktop-shell.vapi index b4b4ee5c..379f6ddc 100644 --- a/protocol/pantheon-desktop-shell.vapi +++ b/protocol/pantheon-desktop-shell.vapi @@ -60,23 +60,23 @@ namespace Pantheon.Desktop { public uint32 get_version (); } - [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_greeter_v1", cprefix = "io_elementary_pantheon_greeter_v1_", free_function = "io_elementary_pantheon_greeter_v1_destroy")] - public class Greeter : Wl.Proxy { - [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_greeter_v1_interface")] + [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_extended_behavior_v1", cprefix = "io_elementary_pantheon_extended_behavior_v1_", free_function = "io_elementary_pantheon_extended_behavior_v1_destroy")] + public class ExtendedBehavior : Wl.Proxy { + [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_extended_behavior_v1_interface")] public static Wl.Interface iface; public void set_user_data (void* user_data); public void* get_user_data (); public uint32 get_version (); - public void init (); + public void set_keep_above (); } - [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_extended_behavior_v1", cprefix = "io_elementary_pantheon_extended_behavior_v1_", free_function = "io_elementary_pantheon_extended_behavior_v1_destroy")] - public class ExtendedBehavior : Wl.Proxy { - [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_extended_behavior_v1_interface")] + [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_greeter_v1", cprefix = "io_elementary_pantheon_greeter_v1_", free_function = "io_elementary_pantheon_greeter_v1_destroy")] + public class Greeter : Wl.Proxy { + [CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_greeter_v1_interface")] public static Wl.Interface iface; public void set_user_data (void* user_data); public void* get_user_data (); public uint32 get_version (); - public void set_keep_above (); + public void make_greeter (); } } diff --git a/src/MainWindow.vala b/src/MainWindow.vala index a38cb050..783f0282 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -245,7 +245,7 @@ public class Greeter.MainWindow : Gtk.ApplicationWindow { if (window is Gdk.Wayland.Window) { unowned var wl_surface = ((Gdk.Wayland.Window) window).get_wl_surface (); desktop_greeter = desktop_shell.get_greeter (wl_surface); - desktop_greeter.init (); + desktop_greeter.make_greeter (); } } }