Skip to content

Commit 0752099

Browse files
committed
ShellClients: Reveal smoothly when starting
1 parent 7e97727 commit 0752099

File tree

3 files changed

+55
-3
lines changed

3 files changed

+55
-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);
@@ -119,6 +120,10 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
119120
}
120121

121122
protected override double get_hidden_progress () {
123+
if (starting) {
124+
return user_gesture_controller.progress;
125+
}
126+
122127
var user_workspace_hidden_progress = double.min (
123128
user_gesture_controller.progress,
124129
workspace_gesture_controller.progress
@@ -134,13 +139,18 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
134139
public override void propagate (GestureTarget.UpdateType update_type, GestureAction action, double progress) {
135140
workspace_hide_tracker.update (update_type, action, progress);
136141
base.propagate (update_type, action, progress);
142+
143+
if (starting && update_type == END && action == CUSTOM) {
144+
// We were shown for the first time, so we can leave the special starting state
145+
starting = false;
146+
}
137147
}
138148

139149
private void hide () {
140150
user_gesture_controller.goto (1);
141151
}
142152

143-
private void show () {
153+
public void show () {
144154
user_gesture_controller.goto (0);
145155
}
146156

src/ShellClients/ShellClientsManager.vala

Lines changed: 35 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 = 0;
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 () {
@@ -103,6 +107,19 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
103107
warning ("Failed to load launch args for client %s: %s", group, e.message);
104108
}
105109
}
110+
111+
starting_panels = protocol_clients.length;
112+
}
113+
114+
private void on_failsafe_timeout () {
115+
if (starting_panels > 0) {
116+
warning ("%d panels failed to start in time, showing the others", starting_panels);
117+
118+
starting_panels = 0;
119+
foreach (var window in panel_windows.get_values ()) {
120+
window.show ();
121+
}
122+
}
106123
}
107124

108125
public void make_dock (Meta.Window window) {
@@ -160,10 +177,28 @@ public class Gala.ShellClientsManager : Object, GestureTarget {
160177

161178
panel_windows[window] = new PanelWindow (wm, window, anchor);
162179

180+
InternalUtils.wait_for_window_actor_visible (window, on_panel_ready);
181+
163182
// connect_after so we make sure the PanelWindow can destroy its barriers and struts
164183
window.unmanaging.connect_after ((_window) => panel_windows.remove (_window));
165184
}
166185

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

src/ShellClients/ShellWindow.vala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@ 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+
private get { return _hide_target; }
18+
construct set {
19+
_hide_target = value;
20+
_hide_target?.propagate (UPDATE, CUSTOM, get_hidden_progress ());
21+
}
22+
}
1623

1724
private double multitasking_view_progress = 0;
1825
private int animations_ongoing = 0;
@@ -29,7 +36,7 @@ public abstract class Gala.ShellWindow : PositionedWindow, GestureTarget {
2936
multitasking_view_progress = progress;
3037
}
3138

32-
hide_target.propagate (UPDATE, CUSTOM, get_hidden_progress ());
39+
hide_target?.propagate (UPDATE, CUSTOM, get_hidden_progress ());
3340
break;
3441

3542
case END:

0 commit comments

Comments
 (0)