Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions compositor/PantheonShell.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -50,22 +50,22 @@ 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,
make_centered,
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);
Expand Down Expand Up @@ -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<unowned GLib.Object> (quark);
}
Expand All @@ -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<unowned GLib.Object> (quark);
}
Expand Down Expand Up @@ -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<GreeterSurface> ();
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<ExtendedBehaviorSurface> ();
if (extended_behavior_surface.wayland_surface == null) {
Expand Down Expand Up @@ -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<GreeterSurface> ();
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 ();
}
Expand All @@ -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 ();
}
}
20 changes: 10 additions & 10 deletions compositor/ShellClients/ShellClientsManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -288,10 +288,6 @@ public class GreeterCompositor.ShellClientsManager : Object {
}
break;

case "greeter":
init_greeter (window);
break;

case "centered":
make_centered (window);
break;
Expand All @@ -300,6 +296,10 @@ public class GreeterCompositor.ShellClientsManager : Object {
set_restore_previous_x11_region (window);
break;

case "greeter":
make_greeter (window);
break;

default:
break;
}
Expand Down
41 changes: 29 additions & 12 deletions compositor/protocol/pantheon-desktop-shell-v1.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="pantheon_shell_v1">
<copyright><![CDATA[
SPDX-FileCopyrightText: 2025 elementary, Inc. <https://elementary.io>
2023 Corentin Noël <tintou@noel.tf>
SPDX-FileCopyrightText: 2023 Corentin Noël <tintou@noel.tf>

SPDX-License-Identifier: LGPL-2.1-or-later
]]></copyright>
Expand Down Expand Up @@ -137,16 +136,6 @@
<request name="destroy" type="destructor"/>
</interface>

<interface name="io_elementary_pantheon_greeter_v1" version="1">
<request name="destroy" type="destructor"/>

<request name="init">
<description summary="init greeter">
Init Greeter
</description>
</request>
</interface>

<interface name="io_elementary_pantheon_extended_behavior_v1" version="1">
<request name="destroy" type="destructor"/>
<request name="set_keep_above">
Expand All @@ -170,5 +159,33 @@
by the compositor.
</description>
</request>

<request name="make_modal">
<description summary="requests to make a surface system modal">
This will block all user input outside the surface and most system shortcuts.
</description>

<arg name="dim" type="uint" summary="1 to dim, 0 to not dim"/>
</request>

<request name="make_monitor_label">
<description summary="makes the surface a monitor label for the given monitor">
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.
</description>

<arg name="monitor_index" type="int" summary="the index of the monitor this surface should label"/>
</request>
</interface>

<interface name="io_elementary_pantheon_greeter_v1" version="1">
<request name="destroy" type="destructor"/>

<request name="make_greeter">
<description summary="make greeter">
Request to make the surface a Greeter window, which will be displayed bellow other windows
when running in greeter compositor mode.
</description>
</request>
</interface>
</protocol>
32 changes: 19 additions & 13 deletions compositor/protocol/pantheon-desktop-shell.vapi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2025 elementary, Inc. <https://elementary.io>
* Copyright 2023-2026 elementary, Inc. <https://elementary.io>
* Copyright 2023 Corentin Noël <tintou@noel.tf>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
Expand Down Expand Up @@ -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")]
Expand All @@ -69,17 +61,27 @@ 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)]
public delegate void GetPanel (Wl.Client client, Wl.Resource resource, uint32 output, Wl.Resource surface);
[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);
Expand All @@ -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);
}
41 changes: 29 additions & 12 deletions protocol/pantheon-desktop-shell-v1.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="pantheon_shell_v1">
<copyright><![CDATA[
SPDX-FileCopyrightText: 2025 elementary, Inc. <https://elementary.io>
2023 Corentin Noël <tintou@noel.tf>
SPDX-FileCopyrightText: 2023 Corentin Noël <tintou@noel.tf>

SPDX-License-Identifier: LGPL-2.1-or-later
]]></copyright>
Expand Down Expand Up @@ -137,16 +136,6 @@
<request name="destroy" type="destructor"/>
</interface>

<interface name="io_elementary_pantheon_greeter_v1" version="1">
<request name="destroy" type="destructor"/>

<request name="init">
<description summary="init greeter">
Init Greeter
</description>
</request>
</interface>

<interface name="io_elementary_pantheon_extended_behavior_v1" version="1">
<request name="destroy" type="destructor"/>
<request name="set_keep_above">
Expand All @@ -170,5 +159,33 @@
by the compositor.
</description>
</request>

<request name="make_modal">
<description summary="requests to make a surface system modal">
This will block all user input outside the surface and most system shortcuts.
</description>

<arg name="dim" type="uint" summary="1 to dim, 0 to not dim"/>
</request>

<request name="make_monitor_label">
<description summary="makes the surface a monitor label for the given monitor">
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.
</description>

<arg name="monitor_index" type="int" summary="the index of the monitor this surface should label"/>
</request>
</interface>

<interface name="io_elementary_pantheon_greeter_v1" version="1">
<request name="destroy" type="destructor"/>

<request name="make_greeter">
<description summary="make greeter">
Request to make the surface a Greeter window, which will be displayed bellow other windows
when running in greeter compositor mode.
</description>
</request>
</interface>
</protocol>
Loading