Skip to content

Commit e1c05b5

Browse files
committed
Add a shell group
1 parent 92793a9 commit e1c05b5

File tree

5 files changed

+65
-52
lines changed

5 files changed

+65
-52
lines changed

src/ShellClients/PanelClone.vala

+20-21
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 {
@@ -41,17 +41,20 @@ public class Gala.PanelClone : Object {
4141

4242
private HideTracker? hide_tracker;
4343

44-
public PanelClone (WindowManager wm, PanelWindow panel) {
44+
public PanelClone (WindowManagerGala wm, PanelWindow panel) {
4545
Object (wm: wm, panel: panel);
4646
}
4747

4848
construct {
4949
default_gesture_tracker = new GestureTracker (ANIMATION_DURATION, ANIMATION_DURATION);
5050

5151
clone = new SafeWindowClone (panel.window, true);
52-
wm.ui_group.add_child (clone);
52+
wm.shell_group.add_child (clone);
5353

5454
actor = (Meta.WindowActor) panel.window.get_compositor_private ();
55+
actor.get_parent ().remove_child (actor);
56+
wm.shell_group.add_child (actor);
57+
5558
// WindowActor position and Window position aren't necessarily the same.
5659
// The clone needs the actor position
5760
actor.notify["x"].connect (update_clone_position);
@@ -69,10 +72,6 @@ public class Gala.PanelClone : Object {
6972
}
7073
});
7174

72-
// Make sure the actor is visible once it's focused FIXME: better event not only focused
73-
// https://github.com/elementary/gala/issues/2080
74-
panel.window.focused.connect (update_visible);
75-
7675
update_visible ();
7776
update_clone_position ();
7877

@@ -87,12 +86,6 @@ public class Gala.PanelClone : Object {
8786

8887
private void update_visible () {
8988
actor.visible = !panel_hidden;
90-
91-
if (actor.visible && !wm.get_display ().get_monitor_in_fullscreen (panel.window.get_monitor ())) {
92-
// The actor has just been revealed, make sure it's at the top
93-
// https://github.com/elementary/gala/issues/2080
94-
actor.get_parent ().set_child_above_sibling (actor, null);
95-
}
9689
}
9790

9891
private void update_clone_position () {
@@ -144,7 +137,9 @@ public class Gala.PanelClone : Object {
144137
}
145138

146139
private void show (GestureTracker gesture_tracker, bool with_gesture) {
147-
if (!panel_hidden || force_hide || last_gesture_tracker != null && last_gesture_tracker.recognizing) {
140+
if (!panel_hidden || force_hide || last_gesture_tracker != null && last_gesture_tracker.recognizing
141+
|| (wm.get_display ().get_monitor_in_fullscreen (panel.window.get_monitor ()) && !panel.window.has_focus ())
142+
) {
148143
return;
149144
}
150145

@@ -162,15 +157,19 @@ public class Gala.PanelClone : Object {
162157
});
163158
}
164159

165-
public void set_force_hide (bool force_hide, GestureTracker gesture_tracker, bool with_gesture) {
166-
this.force_hide = force_hide;
167-
168-
if (force_hide) {
160+
private void check_hide (bool should_hide, GestureTracker gesture_tracker, bool with_gesture) {
161+
if (should_hide) {
169162
hide (gesture_tracker, with_gesture);
170-
} else if (hide_mode == NEVER) {
171-
show (gesture_tracker, with_gesture);
172-
} else {
163+
} else if (hide_tracker != null) {
173164
hide_tracker.update_overlap (gesture_tracker, with_gesture);
165+
} else {
166+
show (gesture_tracker, with_gesture);
174167
}
175168
}
169+
170+
public void set_force_hide (bool force_hide, GestureTracker gesture_tracker, bool with_gesture) {
171+
this.force_hide = force_hide;
172+
173+
check_hide (force_hide, gesture_tracker, with_gesture);
174+
}
176175
}

src/ShellClients/PanelWindow.vala

+2-2
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

+3-3
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

+27-18
Original file line numberDiff line numberDiff line change
@@ -676,29 +676,38 @@ namespace Gala {
676676
ShellClientsManager.get_instance ().set_force_hide_panels (false, multitasking_gesture_tracker, with_gesture);
677677
}
678678

679-
// The callback needs to run at the same frame as the others (e.g. PanelClone) so we can't do a simple Timeout here
680-
// The actual transition does nothing here, since the opacity just stays at 255
681-
new GesturePropertyTransition (this, multitasking_gesture_tracker, "opacity", null, 255u).start (with_gesture, (completions) => {
682-
if (!opening) {
683-
foreach (var container in window_containers_monitors) {
684-
container.visible = false;
685-
}
679+
GestureTracker.OnEnd on_animation_end = (percentage, completions) => {
680+
var animation_duration = completions == 0 ? 0 : ANIMATION_DURATION;
681+
Timeout.add (animation_duration, () => {
682+
if (!opening) {
683+
foreach (var container in window_containers_monitors) {
684+
container.visible = false;
685+
}
686686

687-
hide ();
687+
hide ();
688688

689-
wm.background_group.show ();
690-
wm.window_group.show ();
691-
wm.top_window_group.show ();
689+
wm.background_group.show ();
690+
wm.window_group.show ();
691+
wm.top_window_group.show ();
692692

693-
wm.pop_modal (modal_proxy);
694-
}
693+
wm.pop_modal (modal_proxy);
694+
}
695695

696-
animating = false;
696+
animating = false;
697697

698-
if (completions == 0) {
699-
toggle (false, true);
700-
}
701-
});
698+
if (completions == 0) {
699+
toggle (false, true);
700+
}
701+
702+
return Source.REMOVE;
703+
});
704+
};
705+
706+
if (!with_gesture) {
707+
on_animation_end (1, 1, 0);
708+
} else {
709+
multitasking_gesture_tracker.connect_handlers (null, null, (owned) on_animation_end);
710+
}
702711
}
703712

704713
private bool keybinding_filter (Meta.KeyBinding binding) {

src/WindowManager.vala

+13-8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ namespace Gala {
4949
*/
5050
public Gala.ActivatableComponent workspace_view { get; protected set; }
5151

52+
public Clutter.Actor shell_group { get; private set; }
53+
5254
public PointerLocator pointer_locator { get; private set; }
5355

5456
private SystemBackground system_background;
@@ -253,14 +255,6 @@ namespace Gala {
253255
stage.remove_child (top_window_group);
254256
ui_group.add_child (top_window_group);
255257

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-
264258
// Initialize plugins and add default components if no plugin overrides them
265259
unowned var plugin_manager = PluginManager.get_default ();
266260
plugin_manager.initialize (this);
@@ -293,9 +287,20 @@ namespace Gala {
293287
}
294288

295289
// Add the remaining components that should be on top
290+
shell_group = new Clutter.Actor ();
291+
ui_group.add_child (shell_group);
292+
296293
notification_group = new Clutter.Actor ();
297294
ui_group.add_child (notification_group);
298295

296+
#if HAS_MUTTER44
297+
var feedback_group = display.get_compositor ().get_feedback_group ();
298+
#else
299+
var feedback_group = display.get_feedback_group ();
300+
#endif
301+
stage.remove_child (feedback_group);
302+
ui_group.add_child (feedback_group);
303+
299304
pointer_locator = new PointerLocator (display);
300305
ui_group.add_child (pointer_locator);
301306
ui_group.add_child (new DwellClickTimer (display));

0 commit comments

Comments
 (0)