Skip to content

Commit c34d6f1

Browse files
authored
EndSessionDialog: use modal shell protocol (#141)
1 parent acb9889 commit c34d6f1

4 files changed

Lines changed: 44 additions & 15 deletions

File tree

data/quick-settings.metainfo.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@
3131
<update_contact>contact_at_elementary.io</update_contact>
3232

3333
<releases>
34+
<release version="1.4.0" date="2025-12-01" urgency="medium">
35+
<description>
36+
<p>Other Improvements:</p>
37+
<ul>
38+
<li>Updated translations</li>
39+
</ul>
40+
</description>
41+
<issues>
42+
<issue url="https://github.com/elementary/quick-settings/issues/45">End Session Dialog should pull visual focus</issue>
43+
</issues>
44+
</release>
45+
3446
<release version="1.3.0" date="2025-09-11" urgency="medium">
3547
<description>
3648
<p>Other Improvements:</p>

protocol/pantheon-desktop-shell-v1.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106

107107
<interface name="io_elementary_pantheon_extended_behavior_v1" version="1">
108108
<request name="destroy" type="destructor"/>
109+
109110
<request name="set_keep_above">
110111
<description summary="set keep above">
111112
Tell the shell to keep the surface above on all workspaces
@@ -118,5 +119,22 @@
118119
to not be granted automatically but having to be requested via focus.
119120
</description>
120121
</request>
122+
123+
<request name="focus">
124+
<description summary="request keyboard focus">
125+
Request keyboard focus, taking it away from any other window.
126+
Keyboard focus must always be manually be requested and is
127+
- in contrast to normal windows - never automatically granted
128+
by the compositor.
129+
</description>
130+
</request>
131+
132+
<request name="make_modal">
133+
<description summary="requests to make a surface system modal">
134+
This will block all user input outside the surface and most system shortcuts.
135+
</description>
136+
137+
<arg name="dim" type="uint" summary="1 to dim, 0 to not dim"/>
138+
</request>
121139
</interface>
122140
</protocol>

protocol/pantheon-desktop-shell.vapi

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
* SPDX-License-Identifier: GPL-3.0-or-later
55
*/
66

7-
namespace Pantheon.Desktop {
8-
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_shell_v1", cprefix = "io_elementary_pantheon_shell_v1_")]
7+
namespace PantheonDesktop {
8+
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_shell_v1", cprefix = "io_elementary_pantheon_shell_v1_", free_function = "io_elementary_pantheon_shell_v1_destroy")]
99
public class Shell : Wl.Proxy {
1010
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_shell_v1_interface")]
1111
public static Wl.Interface iface;
1212
public void set_user_data (void* user_data);
1313
public void* get_user_data ();
1414
public uint32 get_version ();
15-
public void destroy ();
16-
public Pantheon.Desktop.Panel get_panel (Wl.Surface surface);
17-
public Pantheon.Desktop.Widget get_widget (Wl.Surface surface);
18-
public Pantheon.Desktop.ExtendedBehavior get_extended_behavior (Wl.Surface surface);
15+
public PantheonDesktop.Panel get_panel (Wl.Surface surface);
16+
public PantheonDesktop.Widget get_widget (Wl.Surface surface);
17+
public PantheonDesktop.ExtendedBehavior get_extended_behavior (Wl.Surface surface);
1918

2019
}
2120
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "enum io_elementary_pantheon_panel_v1_anchor", cprefix="IO_ELEMENTARY_PANTHEON_PANEL_V1_ANCHOR_", has_type_id = false)]
@@ -35,39 +34,38 @@ namespace Pantheon.Desktop {
3534
ALWAYS
3635
}
3736

38-
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_panel_v1", cprefix = "io_elementary_pantheon_panel_v1_")]
37+
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_panel_v1", cprefix = "io_elementary_pantheon_panel_v1_", free_function = "io_elementary_pantheon_panel_v1_destroy")]
3938
public class Panel : Wl.Proxy {
4039
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_panel_v1_interface")]
4140
public static Wl.Interface iface;
4241
public void set_user_data (void* user_data);
4342
public void* get_user_data ();
4443
public uint32 get_version ();
45-
public void destroy ();
46-
public void set_anchor (Pantheon.Desktop.Anchor anchor);
44+
public void set_anchor (PantheonDesktop.Anchor anchor);
4745
public void focus ();
4846
public void set_size (int width, int height);
49-
public void set_hide_mode (Pantheon.Desktop.HideMode hide_mode);
47+
public void set_hide_mode (PantheonDesktop.HideMode hide_mode);
5048
}
5149

52-
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_widget_v1", cprefix = "io_elementary_pantheon_widget_v1_")]
50+
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_widget_v1", cprefix = "io_elementary_pantheon_widget_v1_", free_function = "io_elementary_pantheon_widget_v1_destroy")]
5351
public class Widget : Wl.Proxy {
5452
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_widget_v1_interface")]
5553
public static Wl.Interface iface;
5654
public void set_user_data (void* user_data);
5755
public void* get_user_data ();
5856
public uint32 get_version ();
59-
public void destroy ();
6057
}
6158

62-
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "struct io_elementary_pantheon_extended_behavior_v1", cprefix = "io_elementary_pantheon_extended_behavior_v1_")]
59+
[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")]
6360
public class ExtendedBehavior : Wl.Proxy {
6461
[CCode (cheader_filename = "pantheon-desktop-shell-client-protocol.h", cname = "io_elementary_pantheon_extended_behavior_v1_interface")]
6562
public static Wl.Interface iface;
6663
public void set_user_data (void* user_data);
6764
public void* get_user_data ();
6865
public uint32 get_version ();
69-
public void destroy ();
7066
public void set_keep_above ();
7167
public void make_centered ();
68+
public void focus ();
69+
public void make_modal (uint dim);
7270
}
7371
}

src/Widgets/EndSessionDialog.vala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,14 @@ public class QuickSettings.EndSessionDialog : Granite.MessageDialog {
155155

156156
public void registry_handle_global (Wl.Registry wl_registry, uint32 name, string @interface, uint32 version) {
157157
if (@interface == "io_elementary_pantheon_shell_v1") {
158-
var desktop_shell = wl_registry.bind<Pantheon.Desktop.Shell> (name, ref Pantheon.Desktop.Shell.iface, uint32.min (version, 1));
158+
var desktop_shell = wl_registry.bind<PantheonDesktop.Shell> (name, ref PantheonDesktop.Shell.iface, uint32.min (version, 1));
159159
unowned var window = get_window ();
160160
if (window is Gdk.Wayland.Window) {
161161
unowned var wl_surface = ((Gdk.Wayland.Window) window).get_wl_surface ();
162162
var extended_behavior = desktop_shell.get_extended_behavior (wl_surface);
163163
extended_behavior.set_keep_above ();
164164
extended_behavior.make_centered ();
165+
extended_behavior.make_modal (1);
165166
}
166167
}
167168
}

0 commit comments

Comments
 (0)