Skip to content

Commit 14eed69

Browse files
committed
ShellClients: Wait and reveal in sync on session start
1 parent 986a833 commit 14eed69

File tree

4 files changed

+32
-12
lines changed

4 files changed

+32
-12
lines changed

src/ShellClients/HideTracker.vala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,13 @@ public class Gala.HideTracker : Object {
147147
});
148148
}
149149

150-
private void update_overlap () {
150+
/**
151+
* Immediately updates the overlap. Usually {@link schedule_update} should be used instead which
152+
* internally calls this but throttles it since it's a somewhat expensive operation.
153+
* On very rare use cases however it is required to update immediately. In that case you can call
154+
* this directly.
155+
*/
156+
public void update_overlap () {
151157
overlap = false;
152158
focus_overlap = false;
153159
focus_maximized_overlap = false;

src/ShellClients/PanelClone.vala

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ public class Gala.PanelClone : Object {
7070
update_visible ();
7171
update_clone_position ();
7272

73-
Idle.add_once (() => {
74-
if (hide_mode == NEVER) {
75-
show ();
76-
} else {
77-
hide_tracker.schedule_update ();
78-
}
79-
});
73+
var manager = ShellClientsManager.get_instance ();
74+
75+
if (manager.is_waiting) {
76+
manager.notify["is-waiting"].connect (on_ready);
77+
} else {
78+
Idle.add_once (on_ready);
79+
}
8080
}
8181

8282
private void update_visible () {
@@ -142,7 +142,7 @@ public class Gala.PanelClone : Object {
142142
}
143143

144144
private void show () {
145-
if (!panel_hidden) {
145+
if (!panel_hidden || ShellClientsManager.get_instance ().is_waiting) {
146146
return;
147147
}
148148

@@ -160,4 +160,12 @@ public class Gala.PanelClone : Object {
160160
return Source.REMOVE;
161161
});
162162
}
163+
164+
private void on_ready () {
165+
if (hide_mode == NEVER) {
166+
show ();
167+
} else {
168+
hide_tracker.update_overlap ();
169+
}
170+
}
163171
}

src/ShellClients/ShellClientsManager.vala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class Gala.ShellClientsManager : Object {
2020
return instance;
2121
}
2222

23+
public bool is_waiting { get; private set; default = true; }
24+
2325
public WindowManager wm { get; construct; }
2426

2527
private NotificationsClient notifications_client;
@@ -105,6 +107,10 @@ public class Gala.ShellClientsManager : Object {
105107
}
106108
}
107109

110+
public void notify_ready () {
111+
Timeout.add_once (1500, () => is_waiting = false);
112+
}
113+
108114
public void make_dock (Meta.Window window) {
109115
if (Meta.Util.is_wayland_compositor ()) {
110116
make_dock_wayland (window);

src/WindowManager.vala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,13 +367,13 @@ namespace Gala {
367367

368368
stage.show ();
369369

370-
Idle.add (() => {
370+
Idle.add_once (() => {
371371
// let the session manager move to the next phase
372372
#if WITH_SYSTEMD
373373
Systemd.Daemon.notify (true, "READY=1");
374374
#endif
375-
display.get_context ().notify_ready ();
376-
return GLib.Source.REMOVE;
375+
get_display ().get_context ().notify_ready ();
376+
ShellClientsManager.get_instance ().notify_ready ();
377377
});
378378
}
379379

0 commit comments

Comments
 (0)