Skip to content

Commit f6e9521

Browse files
authored
Merge branch 'main' into lenemter/per-user-session
2 parents 8aaaf37 + 2dd730c commit f6e9521

40 files changed

Lines changed: 1327 additions & 80 deletions

compositor/Background/Background.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ namespace GreeterCompositor {
9090
#endif
9191
if (color == null) {
9292
#if HAS_MUTTER47
93-
color = Cogl.Color.from_string ("black");
93+
color = Cogl.Color.from_string ("#000000");
9494
#else
9595
color = Clutter.Color.from_string ("black");
9696
#endif
@@ -109,7 +109,7 @@ namespace GreeterCompositor {
109109
#endif
110110
if (second_color == null) {
111111
#if HAS_MUTTER47
112-
second_color = Cogl.Color.from_string ("black");
112+
second_color = Cogl.Color.from_string ("#000000");
113113
#else
114114
second_color = Clutter.Color.from_string ("black");
115115
#endif

compositor/Background/BackgroundContainer.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace GreeterCompositor {
2929

3030
public void set_black_background (bool black) {
3131
#if HAS_MUTTER47
32-
set_background_color (black ? Cogl.Color.from_string ("Black") : null);
32+
set_background_color (black ? Cogl.Color.from_string ("#000000") : null);
3333
#else
3434
set_background_color (black ? Clutter.Color.from_string ("Black") : null);
3535
#endif

compositor/Background/BackgroundSource.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace GreeterCompositor {
3939
monitor_manager = display.get_context ().get_backend ().get_monitor_manager ();
4040
monitor_manager.monitors_changed.connect (monitors_changed);
4141

42-
gala_background_settings = new GLib.Settings ("io.elementary.desktop.background");
42+
gala_background_settings = new GLib.Settings ("io.elementary.greeter-compositor.background");
4343
gala_background_settings.changed["dim-wallpaper-in-dark-style"].connect (() => changed ());
4444

4545
gnome_background_settings = new GLib.Settings ("org.gnome.desktop.background");

compositor/BackgroundBlurEffect.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ public class GreeterCompositor.BackgroundBlurEffect : Clutter.Effect {
172172
Mtk.Rectangle stage_view_layout = {};
173173

174174
box_scale_factor = stage_view.get_scale ();
175+
#if HAS_MUTTER49
176+
stage_view.get_layout (stage_view_layout);
177+
#else
175178
stage_view.get_layout (ref stage_view_layout);
179+
#endif
176180

177181
origin_x -= stage_view_layout.x;
178182
origin_y -= stage_view_layout.y;

compositor/KeyboardManager.vala

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ public class GreeterCompositor.KeyboardManager : Object {
88
private static KeyboardManager? instance;
99
private static VariantType sources_variant_type;
1010
private static GLib.Settings settings;
11+
#if HAS_MUTTER49
12+
private GLib.Cancellable? cancellable = null;
13+
#endif
1114

1215
public unowned Meta.Display display { construct; private get; }
1316

@@ -74,6 +77,8 @@ public class GreeterCompositor.KeyboardManager : Object {
7477

7578
[CCode (instance_pos = -1)]
7679
private void set_keyboard_layout (GLib.Settings settings, string key) {
80+
unowned var backend = display.get_context ().get_backend ();
81+
7782
if (key == "sources" || key == "xkb-options") {
7883
string[] layouts = {}, variants = {};
7984

@@ -100,14 +105,50 @@ public class GreeterCompositor.KeyboardManager : Object {
100105
var variant = string.joinv (",", variants);
101106
var options = string.joinv (",", xkb_options);
102107

103-
#if HAS_MUTTER46
108+
#if HAS_MUTTER49
109+
if (cancellable != null) {
110+
cancellable.cancel ();
111+
cancellable = new GLib.Cancellable ();
112+
}
113+
114+
backend.set_keymap_async.begin (layout, variant, options, settings.get_string ("xkb-model"), cancellable, (obj, res) => {
115+
try {
116+
((Meta.Backend) obj).set_keymap_async.end (res);
117+
} catch (Error e) {
118+
if (e is GLib.IOError.CANCELLED) {
119+
// ignore
120+
} else {
121+
cancellable = null;
122+
}
123+
}
124+
});
125+
#elif HAS_MUTTER46
104126
//TODO: add model support
105-
display.get_context ().get_backend ().set_keymap (layout, variant, options, "");
127+
backend.set_keymap (layout, variant, options, "");
106128
#else
107-
display.get_context ().get_backend ().set_keymap (layout, variant, options);
129+
backend.set_keymap (layout, variant, options);
108130
#endif
109131
} else if (key == "current") {
110-
display.get_context ().get_backend ().lock_layout_group (settings.get_uint ("current"));
132+
#if HAS_MUTTER49
133+
if (cancellable != null) {
134+
cancellable.cancel ();
135+
cancellable = new GLib.Cancellable ();
136+
}
137+
138+
backend.set_keymap_layout_group_async.begin (settings.get_uint ("current"), cancellable, (obj, res) => {
139+
try {
140+
((Meta.Backend) obj).set_keymap_layout_group_async.end (res);
141+
} catch (Error e) {
142+
if (e is GLib.IOError.CANCELLED) {
143+
// ignore
144+
} else {
145+
cancellable = null;
146+
}
147+
}
148+
});
149+
#else
150+
backend.lock_layout_group (settings.get_uint ("current"));
151+
#endif
111152
}
112153
}
113154
}

compositor/ShellClients/ManagedClient.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,13 @@ public class GreeterCompositor.ManagedClient : Object {
5050
private async void start_wayland () {
5151
var subprocess_launcher = new GLib.SubprocessLauncher (INHERIT_FDS);
5252
try {
53+
#if HAS_MUTTER49
54+
wayland_client = new Meta.WaylandClient.subprocess (display.get_context (), subprocess_launcher, args);
55+
subprocess = wayland_client.get_subprocess ();
56+
#else
5357
wayland_client = new Meta.WaylandClient (display.get_context (), subprocess_launcher);
5458
subprocess = wayland_client.spawnv (display, args);
59+
#endif
5560

5661
yield subprocess.wait_async ();
5762

compositor/ShellClients/NotificationsClient.vala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public class GreeterCompositor.NotificationsClient : Object {
2727
window.set_data (NOTIFICATION_DATA_KEY, true);
2828
window.make_above ();
2929
window.stick ();
30-
#if HAS_MUTTER46
30+
#if HAS_MUTTER49
31+
window.set_type (Meta.WindowType.DOCK);
32+
#elif HAS_MUTTER46
3133
client.wayland_client.make_dock (window);
3234
#endif
3335
});

compositor/ShellClients/ShellClientsManager.vala

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,18 @@ public class GreeterCompositor.ShellClientsManager : Object {
5252
}
5353

5454
public void make_dock (Meta.Window window) {
55+
#if HAS_MUTTER49
56+
window.set_type (Meta.WindowType.DOCK);
57+
#else
5558
if (Meta.Util.is_wayland_compositor ()) {
5659
make_dock_wayland (window);
5760
} else {
5861
make_dock_x11 (window);
5962
}
63+
#endif
6064
}
6165

66+
#if !HAS_MUTTER49
6267
private void make_dock_wayland (Meta.Window window) requires (Meta.Util.is_wayland_compositor ()) {
6368
foreach (var client in protocol_clients) {
6469
if (client.wayland_client.owns_window (window)) {
@@ -88,16 +93,22 @@ public class GreeterCompositor.ShellClientsManager : Object {
8893
// 0 means replace
8994
xdisplay.change_property (x_window, atom, (X.Atom) 4, 32, 0, (uchar[]) dock_atom, 1);
9095
}
96+
#endif
9197

9298

9399
public void make_desktop (Meta.Window window) {
100+
#if HAS_MUTTER49
101+
window.set_type (Meta.WindowType.DESKTOP);
102+
#else
94103
if (Meta.Util.is_wayland_compositor ()) {
95104
make_desktop_wayland (window);
96105
} else {
97106
make_desktop_x11 (window);
98107
}
108+
#endif
99109
}
100110

111+
#if !HAS_MUTTER49
101112
private void make_desktop_wayland (Meta.Window window) requires (Meta.Util.is_wayland_compositor ()) {
102113
foreach (var client in protocol_clients) {
103114
if (client.wayland_client.owns_window (window)) {
@@ -125,6 +136,7 @@ public class GreeterCompositor.ShellClientsManager : Object {
125136
// 0 means replace
126137
xdisplay.change_property (x_window, atom, (X.Atom) 4, 32, 0, (uchar[]) dock_atom, 1);
127138
}
139+
#endif
128140

129141
public void set_anchor (Meta.Window window, Pantheon.Desktop.Anchor anchor) {
130142
if (window in panel_windows) {
@@ -170,21 +182,32 @@ public class GreeterCompositor.ShellClientsManager : Object {
170182
window.unmanaging.connect_after ((_window) => positioned_windows.remove (_window));
171183
}
172184

173-
public void make_centered (Meta.Window window) requires (!is_itself_positioned (window)) {
185+
public void make_centered (Meta.Window window) requires (!is_itself_shell_window (window)) {
174186
positioned_windows[window] = new ShellWindow (window, CENTER);
175187

176188
// connect_after so we make sure that any queued move is unqueued
177189
window.unmanaging.connect_after ((_window) => positioned_windows.remove (_window));
178190
}
179191

180-
public bool is_itself_positioned (Meta.Window window) {
181-
return (window in positioned_windows) || (window in panel_windows) || NotificationStack.is_notification (window);
192+
public bool is_itself_shell_window (Meta.Window window) {
193+
return (
194+
(window in panel_windows) ||
195+
NotificationStack.is_notification (window)
196+
);
182197
}
183198

184-
public bool is_positioned_window (Meta.Window window) {
185-
bool positioned = is_itself_positioned (window);
199+
/**
200+
* Whether the given window is a shell window. A shell window is a window that's
201+
* part of the desktop shell itself and should be completely ignored by other components.
202+
* It is entirely managed by Gala, always above everything else, and manages hiding
203+
* in e.g. multitasking view itself. This also applies to transient windows of shell windows.
204+
* Note that even if `false` is returned the window might still be in part managed by gala
205+
* e.g. for centered windows.
206+
*/
207+
public bool is_shell_window (Meta.Window window) {
208+
bool positioned = is_itself_shell_window (window);
186209
window.foreach_ancestor ((ancestor) => {
187-
if (is_itself_positioned (ancestor)) {
210+
if (is_itself_shell_window (ancestor)) {
188211
positioned = true;
189212
}
190213

compositor/WindowManager.vala

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace GreeterCompositor {
3131

3232
/**
3333
* The group that contains all WindowActors that make shell elements, that is all windows reported as
34-
* ShellClientsManager.is_positioned_window.
34+
* ShellClientsManager.is_shell_window.
3535
* It will (eventually) never be hidden by other components and is always on top of everything. Therefore elements are
3636
* responsible themselves for hiding depending on the state we are currently in (e.g. normal desktop, open multitasking view, fullscreen, etc.).
3737
*/
@@ -99,7 +99,7 @@ namespace GreeterCompositor {
9999
stage = display.get_stage () as Clutter.Stage;
100100
#endif
101101
#if HAS_MUTTER47
102-
stage.background_color = Cogl.Color.from_string ("black");
102+
stage.background_color = Cogl.Color.from_string ("#000000");
103103
#else
104104
stage.background_color = Clutter.Color.from_rgba (0, 0, 0, 255);
105105
#endif
@@ -120,7 +120,7 @@ namespace GreeterCompositor {
120120
width = width,
121121
height = height,
122122
#if HAS_MUTTER47
123-
background_color = Cogl.Color.from_string ("black")
123+
background_color = Cogl.Color.from_string ("#000000")
124124
#else
125125
background_color = Clutter.Color.from_rgba (0, 0, 0, 255),
126126
#endif
@@ -253,8 +253,15 @@ namespace GreeterCompositor {
253253
var subprocess_launcher = new GLib.SubprocessLauncher (GLib.SubprocessFlags.INHERIT_FDS);
254254
try {
255255
Meta.WaylandClient daemon_client;
256+
Subprocess? subprocess;
257+
258+
#if HAS_MUTTER49
259+
daemon_client = new Meta.WaylandClient.subprocess (display.get_context (), subprocess_launcher, command);
260+
subprocess = daemon_client.get_subprocess ();
261+
#else
256262
daemon_client = new Meta.WaylandClient (display.get_context (), subprocess_launcher);
257-
var subprocess = daemon_client.spawnv (display, command);
263+
subprocess = daemon_client.spawnv (display, command);
264+
#endif
258265

259266
yield subprocess.wait_async ();
260267

@@ -302,7 +309,7 @@ namespace GreeterCompositor {
302309

303310
private void check_shell_window (Meta.WindowActor actor) {
304311
unowned var window = actor.get_meta_window ();
305-
if (ShellClientsManager.get_instance ().is_positioned_window (window)) {
312+
if (ShellClientsManager.get_instance ().is_shell_window (window)) {
306313
Utils.clutter_actor_reparent (actor, shell_group);
307314
}
308315

compositor/WingpanelManager/FocusManager.vala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,10 @@ public class GreeterCompositor.FocusManager : GLib.Object {
9797
}
9898

9999
if (window != null) {
100-
#if HAS_MUTTER46
100+
#if HAS_MUTTER49
101+
Graphene.Point pos_hint = {x, y};
102+
window.begin_grab_op (Meta.GrabOp.MOVING, null, time, pos_hint);
103+
#elif HAS_MUTTER46
101104
Graphene.Point pos_hint = {x, y};
102105
window.begin_grab_op (Meta.GrabOp.MOVING, null, null, time, pos_hint);
103106
#else

0 commit comments

Comments
 (0)