Skip to content

Commit 902eabd

Browse files
committed
ShellClients: Reveal smoothly when starting
1 parent 00da2f0 commit 902eabd

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed

src/ShellClients/PanelWindow.vala

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
3737

3838
private int width = -1;
3939
private int height = -1;
40+
private bool starting = true;
4041

4142
public PanelWindow (WindowManager wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) {
4243
Object (wm: wm, window: window, anchor: anchor);
@@ -116,6 +117,10 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
116117
}
117118

118119
protected override double get_hidden_progress () {
120+
if (starting) {
121+
return user_gesture_controller.progress;
122+
}
123+
119124
var user_workspace_hidden_progress = double.min (
120125
user_gesture_controller.progress,
121126
workspace_gesture_controller.progress
@@ -131,13 +136,18 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
131136
public override void propagate (GestureTarget.UpdateType update_type, GestureAction action, double progress) {
132137
workspace_hide_tracker.update (update_type, action, progress);
133138
base.propagate (update_type, action, progress);
139+
140+
if (starting && update_type == END && action == CUSTOM) {
141+
// We were shown for the first time, so we can leave the special starting state
142+
starting = false;
143+
}
134144
}
135145

136146
private void hide () {
137147
user_gesture_controller.goto (1);
138148
}
139149

140-
private void show () {
150+
public void show () {
141151
user_gesture_controller.goto (0);
142152
}
143153

src/ShellClients/ShellClientsManager.vala

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
2525
private NotificationsClient notifications_client;
2626
private ManagedClient[] protocol_clients = {};
2727

28+
private int starting_panels = 2; // wingpanel and dock
29+
2830
private GLib.HashTable<Meta.Window, PanelWindow> panel_windows = new GLib.HashTable<Meta.Window, PanelWindow> (null, null);
2931
private GLib.HashTable<Meta.Window, ShellWindow> positioned_windows = new GLib.HashTable<Meta.Window, ShellWindow> (null, null);
3032

@@ -43,6 +45,8 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
4345
parse_mutter_hints (window);
4446
});
4547
}
48+
49+
Timeout.add_seconds_once (5, on_failsafe_timeout);
4650
}
4751

4852
private async void start_clients () {
@@ -105,6 +109,17 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
105109
}
106110
}
107111

112+
private void on_failsafe_timeout () {
113+
if (starting_panels > 0) {
114+
warning ("%d panels failed to start in time, showing the others", starting_panels);
115+
116+
starting_panels = 0;
117+
foreach (var window in panel_windows.get_values ()) {
118+
window.show ();
119+
}
120+
}
121+
}
122+
108123
public void make_dock (Meta.Window window) {
109124
#if HAS_MUTTER49
110125
window.set_type (Meta.WindowType.DOCK);
@@ -160,10 +175,28 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
160175

161176
panel_windows[window] = new PanelWindow (wm, window, anchor);
162177

178+
InternalUtils.wait_for_window_actor_visible (window, on_panel_ready);
179+
163180
// connect_after so we make sure the PanelWindow can destroy its barriers and struts
164181
window.unmanaging.connect_after ((_window) => panel_windows.remove (_window));
165182
}
166183

184+
private void on_panel_ready (Meta.WindowActor actor) {
185+
if (starting_panels == 0) {
186+
panel_windows[actor.meta_window].show ();
187+
return;
188+
}
189+
190+
starting_panels--;
191+
assert (starting_panels >= 0);
192+
193+
if (starting_panels == 0) {
194+
foreach (var window in panel_windows.get_values ()) {
195+
window.show ();
196+
}
197+
}
198+
}
199+
167200
/**
168201
* The size given here is only used for the hide mode. I.e. struts
169202
* and collision detection with other windows use this size. By default

src/ShellClients/ShellWindow.vala

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ public abstract class Gala.ShellWindow : PositionedWindow, GestureTarget {
1212
* A gesture target that will receive a CUSTOM update every time a gesture
1313
* is propagated, with the progress gotten via {@link get_hidden_progress()}
1414
*/
15-
public GestureTarget hide_target { get; construct set; }
15+
private GestureTarget? _hide_target = null;
16+
public GestureTarget hide_target {
17+
construct set {
18+
_hide_target = value;
19+
_hide_target.propagate (UPDATE, CUSTOM, get_hidden_progress ());
20+
}
21+
}
1622

1723
private double multitasking_view_progress = 0;
1824
private int animations_ongoing = 0;
@@ -29,7 +35,7 @@ public abstract class Gala.ShellWindow : PositionedWindow, GestureTarget {
2935
multitasking_view_progress = progress;
3036
}
3137

32-
hide_target.propagate (UPDATE, CUSTOM, get_hidden_progress ());
38+
_hide_target.propagate (UPDATE, CUSTOM, get_hidden_progress ());
3339
break;
3440

3541
case END:

0 commit comments

Comments
 (0)