Skip to content

Commit 619917b

Browse files
authored
Merge branch 'main' into lenemter/dont-rely-on-shellclientmanager
2 parents b941b0b + c16f9cb commit 619917b

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed

src/ShellClients/PanelWindow.vala

Lines changed: 13 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);
@@ -68,7 +69,9 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
6869
hide_tracker.hide.connect (hide);
6970
hide_tracker.show.connect (show);
7071

71-
workspace_gesture_controller = new GestureController (CUSTOM, wm);
72+
workspace_gesture_controller = new GestureController (CUSTOM, wm) {
73+
progress = 1.0
74+
};
7275

7376
workspace_hide_tracker = new WorkspaceHideTracker (window.display, update_overlap);
7477
workspace_hide_tracker.switching_workspace_progress_updated.connect ((value) => workspace_gesture_controller.progress = value);
@@ -119,6 +122,11 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
119122
actor.add_action (new DragDropAction (DESTINATION, "multitaskingview-window"));
120123
}
121124

125+
public void animate_start () {
126+
starting = false;
127+
workspace_hide_tracker.recalculate_all_workspaces ();
128+
}
129+
122130
protected override double get_hidden_progress () {
123131
var user_workspace_hidden_progress = double.min (
124132
user_gesture_controller.progress,
@@ -146,6 +154,10 @@ public class Gala.PanelWindow : ShellWindow, RootTarget {
146154
}
147155

148156
private bool update_overlap (Meta.Workspace workspace) {
157+
if (starting) {
158+
return true;
159+
}
160+
149161
var overlap = false;
150162
var focus_overlap = false;
151163
var focus_maximized_overlap = false;

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.animate_start ();
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].animate_start ();
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.animate_start ();
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)