Skip to content

Commit a34f871

Browse files
committed
Introduce a shell group
1 parent d06f875 commit a34f871

File tree

7 files changed

+95
-55
lines changed

7 files changed

+95
-55
lines changed

src/InternalUtils.vala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,5 +380,15 @@ namespace Gala {
380380
new_parent.add_child (actor);
381381
actor.unref ();
382382
}
383+
384+
public static void update_transients_visible (Meta.Window window, bool visible) {
385+
window.foreach_transient ((transient) => {
386+
var actor = (Meta.WindowActor) transient.get_compositor_private ();
387+
388+
actor.visible = visible;
389+
390+
return true;
391+
});
392+
}
383393
}
384394
}

src/ShellClients/HideTracker.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public class Gala.HideTracker : Object {
152152
});
153153
}
154154

155-
private void update_overlap () {
155+
public void update_overlap () {
156156
overlap = false;
157157
focus_overlap = false;
158158
focus_maximized_overlap = false;

src/ShellClients/PanelClone.vala

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class Gala.PanelClone : Object {
99
private const int ANIMATION_DURATION = 250;
1010

11-
public WindowManager wm { get; construct; }
11+
public WindowManagerGala wm { get; construct; }
1212
public unowned PanelWindow panel { get; construct; }
1313

1414
public Pantheon.Desktop.HideMode hide_mode {
@@ -38,14 +38,16 @@ public class Gala.PanelClone : Object {
3838

3939
private HideTracker? hide_tracker;
4040

41-
public PanelClone (WindowManager wm, PanelWindow panel) {
41+
public PanelClone (WindowManagerGala wm, PanelWindow panel) {
4242
Object (wm: wm, panel: panel);
4343
}
4444

4545
construct {
4646
default_gesture_tracker = new GestureTracker (ANIMATION_DURATION, ANIMATION_DURATION);
4747

4848
actor = (Meta.WindowActor) panel.window.get_compositor_private ();
49+
actor.get_parent ().remove_child (actor);
50+
wm.shell_group.add_child (actor);
4951

5052
notify["panel-hidden"].connect (() => {
5153
// When hidden changes schedule an update to make sure it's actually
@@ -55,6 +57,8 @@ public class Gala.PanelClone : Object {
5557
}
5658
});
5759

60+
wm.get_display ().in_fullscreen_changed.connect (check_hide);
61+
5862
Idle.add_once (() => {
5963
if (hide_mode == NEVER) {
6064
show ();
@@ -89,22 +93,38 @@ public class Gala.PanelClone : Object {
8993
return;
9094
}
9195

92-
new GesturePropertyTransition (actor, default_gesture_tracker, "translation-y", null, calculate_y (true)).start (false);
96+
InternalUtils.update_transients_visible (panel.window, false);
97+
98+
new GesturePropertyTransition (
99+
actor, default_gesture_tracker, "translation-y", null, calculate_y (true)
100+
).start (false, () => InternalUtils.update_transients_visible (panel.window, !panel_hidden));
93101

94102
default_gesture_tracker.add_success_callback (false, () => panel_hidden = true);
95103
}
96104

97105
private void show () {
98-
if (!panel_hidden || default_gesture_tracker.recognizing) {
106+
if (!panel_hidden || default_gesture_tracker.recognizing || wm.get_display ().get_monitor_in_fullscreen (panel.window.get_monitor ())) {
99107
return;
100108
}
101109

102110
if (!Meta.Util.is_wayland_compositor ()) {
103111
Utils.x11_unset_window_pass_through (panel.window);
104112
}
105113

106-
new GesturePropertyTransition (actor, default_gesture_tracker, "translation-y", null, calculate_y (false)).start (false);
114+
new GesturePropertyTransition (
115+
actor, default_gesture_tracker, "translation-y", null, calculate_y (false)
116+
).start (false, () => InternalUtils.update_transients_visible (panel.window, !panel_hidden));
107117

108118
default_gesture_tracker.add_success_callback (false, () => panel_hidden = false);
109119
}
120+
121+
private void check_hide () {
122+
if (wm.get_display ().get_monitor_in_fullscreen (panel.window.get_monitor ())) {
123+
hide ();
124+
} else if (hide_mode == NEVER) {
125+
show ();
126+
} else {
127+
hide_tracker.update_overlap ();
128+
}
129+
}
110130
}

src/ShellClients/PanelWindow.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class Gala.PanelWindow : Object {
99
private static HashTable<Meta.Window, Meta.Strut?> window_struts = new HashTable<Meta.Window, Meta.Strut?> (null, null);
1010

11-
public WindowManager wm { get; construct; }
11+
public WindowManagerGala wm { get; construct; }
1212
public Meta.Window window { get; construct; }
1313
public Pantheon.Desktop.Anchor anchor { get; construct set; }
1414

@@ -19,7 +19,7 @@ public class Gala.PanelWindow : Object {
1919
private int width = -1;
2020
private int height = -1;
2121

22-
public PanelWindow (WindowManager wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) {
22+
public PanelWindow (WindowManagerGala wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) {
2323
Object (wm: wm, window: window, anchor: anchor);
2424
}
2525

src/ShellClients/ShellClientsManager.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class Gala.ShellClientsManager : Object {
99
private static ShellClientsManager instance;
1010

11-
public static void init (WindowManager wm) {
11+
public static void init (WindowManagerGala wm) {
1212
if (instance != null) {
1313
return;
1414
}
@@ -20,15 +20,15 @@ public class Gala.ShellClientsManager : Object {
2020
return instance;
2121
}
2222

23-
public WindowManager wm { get; construct; }
23+
public WindowManagerGala wm { get; construct; }
2424

2525
private NotificationsClient notifications_client;
2626
private ManagedClient[] protocol_clients = {};
2727

2828
private GLib.HashTable<Meta.Window, PanelWindow> panel_windows = new GLib.HashTable<Meta.Window, PanelWindow> (null, null);
2929
private GLib.HashTable<Meta.Window, WindowPositioner> positioned_windows = new GLib.HashTable<Meta.Window, WindowPositioner> (null, null);
3030

31-
private ShellClientsManager (WindowManager wm) {
31+
private ShellClientsManager (WindowManagerGala wm) {
3232
Object (wm: wm);
3333
}
3434

src/Widgets/MultitaskingView.vala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Gala {
2828
private GestureTracker multitasking_gesture_tracker;
2929
private GestureTracker workspace_gesture_tracker;
3030

31-
public WindowManager wm { get; construct; }
31+
public WindowManagerGala wm { get; construct; }
3232

3333
private Meta.Display display;
3434
private ModalProxy modal_proxy;
@@ -53,7 +53,7 @@ namespace Gala {
5353
}
5454
}
5555

56-
public MultitaskingView (WindowManager wm) {
56+
public MultitaskingView (WindowManagerGala wm) {
5757
Object (wm: wm);
5858
}
5959

@@ -631,6 +631,7 @@ namespace Gala {
631631
wm.background_group.hide ();
632632
wm.window_group.hide ();
633633
wm.top_window_group.hide ();
634+
wm.shell_group.hide ();
634635
show ();
635636
grab_key_focus ();
636637

@@ -693,6 +694,7 @@ namespace Gala {
693694
wm.background_group.show ();
694695
wm.window_group.show ();
695696
wm.top_window_group.show ();
697+
wm.shell_group.show ();
696698

697699
dock_clones.destroy_all_children ();
698700

@@ -721,7 +723,7 @@ namespace Gala {
721723
foreach (unowned Meta.WindowActor actor in window_actors) {
722724
const int MAX_OFFSET = 200;
723725

724-
if (actor.is_destroyed () || !actor.visible) {
726+
if (actor.is_destroyed () || !actor.visible || actor.translation_y != 0) {
725727
continue;
726728
}
727729

src/WindowManager.vala

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ namespace Gala {
3737
*/
3838
public Clutter.Actor top_window_group { get; protected set; }
3939

40-
public Clutter.Actor notification_group { get; protected set; }
40+
/**
41+
* The group that contains all WindowActors that make shell elements, that is all windows reported as
42+
* ShellClientsManager.is_positioned_window and notifications, as well as manually added elements.
43+
* It will (eventually) never be hidden by other components and is always on top of everything. Therefore elements are
44+
* responsible themselves for hiding depending on the state we are currently in (e.g. normal desktop, open multitasking view, fullscreen, etc.).
45+
*/
46+
public Clutter.Actor shell_group { get; private set; }
4147

4248
/**
4349
* {@inheritDoc}
@@ -104,8 +110,6 @@ namespace Gala {
104110
private bool animating_switch_workspace = false;
105111
private bool switch_workspace_with_gesture = false;
106112

107-
private signal void window_created (Meta.Window window);
108-
109113
/**
110114
* Amount of pixels to move on the nudge animation.
111115
*/
@@ -253,14 +257,6 @@ namespace Gala {
253257
stage.remove_child (top_window_group);
254258
ui_group.add_child (top_window_group);
255259

256-
#if HAS_MUTTER44
257-
var feedback_group = display.get_compositor ().get_feedback_group ();
258-
#else
259-
var feedback_group = display.get_feedback_group ();
260-
#endif
261-
stage.remove_child (feedback_group);
262-
ui_group.add_child (feedback_group);
263-
264260
// Initialize plugins and add default components if no plugin overrides them
265261
unowned var plugin_manager = PluginManager.get_default ();
266262
plugin_manager.initialize (this);
@@ -293,8 +289,16 @@ namespace Gala {
293289
}
294290

295291
// Add the remaining components that should be on top
296-
notification_group = new Clutter.Actor ();
297-
ui_group.add_child (notification_group);
292+
shell_group = new Clutter.Actor ();
293+
ui_group.add_child (shell_group);
294+
295+
#if HAS_MUTTER44
296+
var feedback_group = display.get_compositor ().get_feedback_group ();
297+
#else
298+
var feedback_group = display.get_feedback_group ();
299+
#endif
300+
stage.remove_child (feedback_group);
301+
ui_group.add_child (feedback_group);
298302

299303
pointer_locator = new PointerLocator (display);
300304
ui_group.add_child (pointer_locator);
@@ -381,12 +385,14 @@ namespace Gala {
381385

382386
update_input_area ();
383387

384-
display.window_created.connect ((window) => window_created (window));
385-
386388
var scroll_action = new SuperScrollAction (display);
387389
scroll_action.triggered.connect (handle_super_scroll);
388390
stage.add_action_full ("wm-super-scroll-action", CAPTURE, scroll_action);
389391

392+
display.window_created.connect ((window) =>
393+
InternalUtils.wait_for_window_actor_visible (window, check_shell_window)
394+
);
395+
390396
stage.show ();
391397

392398
plugin_manager.load_waiting_plugins ();
@@ -1162,6 +1168,20 @@ namespace Gala {
11621168
show_window_menu (window, menu, rect.x, rect.y);
11631169
}
11641170

1171+
private void check_shell_window (Meta.WindowActor actor) {
1172+
unowned var window = actor.get_meta_window ();
1173+
if (ShellClientsManager.get_instance ().is_positioned_window (window)
1174+
|| NotificationStack.is_notification (window)
1175+
) {
1176+
actor.get_parent ().remove_child (actor);
1177+
shell_group.add_child (actor);
1178+
}
1179+
1180+
if (NotificationStack.is_notification (window)) {
1181+
notification_stack.show_notification (actor);
1182+
}
1183+
}
1184+
11651185
/*
11661186
* effects
11671187
*/
@@ -1436,12 +1456,8 @@ namespace Gala {
14361456
actor.remove_all_transitions ();
14371457
actor.show ();
14381458

1439-
// Notifications are a special case and have to be always be handled
1440-
// (also regardless of the animation setting)
1459+
// Notifications initial animation is handled by the notification stack
14411460
if (NotificationStack.is_notification (window)) {
1442-
InternalUtils.clutter_actor_reparent (actor, notification_group);
1443-
notification_stack.show_notification (actor);
1444-
14451461
map_completed (actor);
14461462
return;
14471463
}
@@ -1843,7 +1859,6 @@ namespace Gala {
18431859
private List<Clutter.Actor>? windows;
18441860
private List<Clutter.Actor>? parents;
18451861
private List<Clutter.Actor>? tmp_actors;
1846-
private ulong switch_workspace_window_created_id = 0;
18471862
private Clutter.Actor? out_group;
18481863
private Clutter.Actor? in_group;
18491864
private Clutter.Actor? wallpaper;
@@ -1932,7 +1947,10 @@ namespace Gala {
19321947
continue;
19331948
}
19341949

1935-
if (!window.showing_on_its_workspace () || move_primary_only && !window.is_on_primary_monitor ()) {
1950+
if (!window.showing_on_its_workspace () ||
1951+
move_primary_only && !window.is_on_primary_monitor () ||
1952+
actor.get_parent () == shell_group
1953+
) {
19361954
continue;
19371955
}
19381956

@@ -2045,17 +2063,6 @@ namespace Gala {
20452063

20462064
prepare_workspace_switch (from, to, direction);
20472065

2048-
// while a workspace is being switched mutter doesn't map windows
2049-
// TODO: currently only notifications are handled here, other windows should be too
2050-
switch_workspace_window_created_id = window_created.connect ((window) => {
2051-
if (NotificationStack.is_notification (window)) {
2052-
InternalUtils.wait_for_window_actor_visible (window, (actor) => {
2053-
InternalUtils.clutter_actor_reparent (actor, notification_group);
2054-
notification_stack.show_notification (actor);
2055-
});
2056-
}
2057-
});
2058-
20592066
var animation_mode = Clutter.AnimationMode.EASE_OUT_CUBIC;
20602067

20612068
var x2 = -in_group.x;
@@ -2127,11 +2134,8 @@ namespace Gala {
21272134
return;
21282135
}
21292136

2130-
if (switch_workspace_window_created_id > 0) {
2131-
disconnect (switch_workspace_window_created_id);
2132-
switch_workspace_window_created_id = 0;
2133-
}
21342137
end_switch_workspace ();
2138+
21352139
if (!is_nudge_animation) {
21362140
switch_workspace_completed ();
21372141
}
@@ -2156,9 +2160,9 @@ namespace Gala {
21562160
}
21572161
}
21582162

2159-
private void end_switch_workspace () {
2160-
if (windows == null || parents == null)
2161-
return;
2163+
private bool end_switch_workspace () {
2164+
if ((windows == null || parents == null) && tmp_actors == null)
2165+
return false;
21622166

21632167
unowned var display = get_display ();
21642168
unowned var active_workspace = display.get_workspace_manager ().get_active_workspace ();
@@ -2222,10 +2226,14 @@ namespace Gala {
22222226

22232227
switch_workspace_with_gesture = false;
22242228
animating_switch_workspace = false;
2229+
2230+
return true;
22252231
}
22262232

22272233
public override void kill_switch_workspace () {
2228-
end_switch_workspace ();
2234+
if (end_switch_workspace ()) {
2235+
switch_workspace_completed ();
2236+
}
22292237
}
22302238

22312239
public override void locate_pointer () {

0 commit comments

Comments
 (0)