diff --git a/src/ShellClients/PanelWindow.vala b/src/ShellClients/PanelWindow.vala index de6aaae24..3153d5013 100644 --- a/src/ShellClients/PanelWindow.vala +++ b/src/ShellClients/PanelWindow.vala @@ -37,6 +37,7 @@ public class Gala.PanelWindow : ShellWindow, RootTarget { private int width = -1; private int height = -1; + private bool starting = true; public PanelWindow (WindowManager wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) { Object (wm: wm, window: window, anchor: anchor); @@ -68,7 +69,9 @@ public class Gala.PanelWindow : ShellWindow, RootTarget { hide_tracker.hide.connect (hide); hide_tracker.show.connect (show); - workspace_gesture_controller = new GestureController (CUSTOM, wm); + workspace_gesture_controller = new GestureController (CUSTOM, wm) { + progress = 1.0 + }; workspace_hide_tracker = new WorkspaceHideTracker (window.display, update_overlap); workspace_hide_tracker.switching_workspace_progress_updated.connect ((value) => workspace_gesture_controller.progress = value); @@ -119,6 +122,11 @@ public class Gala.PanelWindow : ShellWindow, RootTarget { actor.add_action (new DragDropAction (DESTINATION, "multitaskingview-window")); } + public void animate_start () { + starting = false; + workspace_hide_tracker.recalculate_all_workspaces (); + } + protected override double get_hidden_progress () { var user_workspace_hidden_progress = double.min ( user_gesture_controller.progress, @@ -146,6 +154,10 @@ public class Gala.PanelWindow : ShellWindow, RootTarget { } private bool update_overlap (Meta.Workspace workspace) { + if (starting) { + return true; + } + var overlap = false; var focus_overlap = false; var focus_maximized_overlap = false; diff --git a/src/ShellClients/ShellClientsManager.vala b/src/ShellClients/ShellClientsManager.vala index 7dad2ce53..988ba69dd 100644 --- a/src/ShellClients/ShellClientsManager.vala +++ b/src/ShellClients/ShellClientsManager.vala @@ -25,6 +25,8 @@ public class Gala.ShellClientsManager : Object, GestureTarget { private NotificationsClient notifications_client; private ManagedClient[] protocol_clients = {}; + private int starting_panels = 0; + private GLib.HashTable panel_windows = new GLib.HashTable (null, null); private GLib.HashTable positioned_windows = new GLib.HashTable (null, null); @@ -43,6 +45,8 @@ public class Gala.ShellClientsManager : Object, GestureTarget { parse_mutter_hints (window); }); } + + Timeout.add_seconds_once (5, on_failsafe_timeout); } private async void start_clients () { @@ -103,6 +107,19 @@ public class Gala.ShellClientsManager : Object, GestureTarget { warning ("Failed to load launch args for client %s: %s", group, e.message); } } + + starting_panels = protocol_clients.length; + } + + private void on_failsafe_timeout () { + if (starting_panels > 0) { + warning ("%d panels failed to start in time, showing the others", starting_panels); + + starting_panels = 0; + foreach (var window in panel_windows.get_values ()) { + window.animate_start (); + } + } } public void make_dock (Meta.Window window) { @@ -160,10 +177,28 @@ public class Gala.ShellClientsManager : Object, GestureTarget { panel_windows[window] = new PanelWindow (wm, window, anchor); + InternalUtils.wait_for_window_actor_visible (window, on_panel_ready); + // connect_after so we make sure the PanelWindow can destroy its barriers and struts window.unmanaging.connect_after ((_window) => panel_windows.remove (_window)); } + private void on_panel_ready (Meta.WindowActor actor) { + if (starting_panels == 0) { + panel_windows[actor.meta_window].animate_start (); + return; + } + + starting_panels--; + assert (starting_panels >= 0); + + if (starting_panels == 0) { + foreach (var window in panel_windows.get_values ()) { + window.animate_start (); + } + } + } + /** * The size given here is only used for the hide mode. I.e. struts * and collision detection with other windows use this size. By default diff --git a/src/ShellClients/ShellWindow.vala b/src/ShellClients/ShellWindow.vala index 369a211fb..5667cfd04 100644 --- a/src/ShellClients/ShellWindow.vala +++ b/src/ShellClients/ShellWindow.vala @@ -12,7 +12,14 @@ public abstract class Gala.ShellWindow : PositionedWindow, GestureTarget { * A gesture target that will receive a CUSTOM update every time a gesture * is propagated, with the progress gotten via {@link get_hidden_progress()} */ - public GestureTarget hide_target { get; construct set; } + private GestureTarget? _hide_target = null; + public GestureTarget? hide_target { + private get { return _hide_target; } + construct set { + _hide_target = value; + _hide_target?.propagate (UPDATE, CUSTOM, get_hidden_progress ()); + } + } private double multitasking_view_progress = 0; private int animations_ongoing = 0; @@ -29,7 +36,7 @@ public abstract class Gala.ShellWindow : PositionedWindow, GestureTarget { multitasking_view_progress = progress; } - hide_target.propagate (UPDATE, CUSTOM, get_hidden_progress ()); + hide_target?.propagate (UPDATE, CUSTOM, get_hidden_progress ()); break; case END: