Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/ShellClients/PanelWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
35 changes: 35 additions & 0 deletions src/ShellClients/ShellClientsManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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<Meta.Window, PanelWindow> panel_windows = new GLib.HashTable<Meta.Window, PanelWindow> (null, null);
private GLib.HashTable<Meta.Window, ShellWindow> positioned_windows = new GLib.HashTable<Meta.Window, ShellWindow> (null, null);

Expand All @@ -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 () {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions src/ShellClients/ShellWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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:
Expand Down