Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions src/InternalUtils.vala
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,15 @@ namespace Gala {
Clutter.get_default_backend ().get_default_seat ().bell_notify ();
#endif
}

public static void update_transients_visible (Meta.Window window, bool visible) {
window.foreach_transient ((transient) => {
var actor = (Meta.WindowActor) transient.get_compositor_private ();

actor.visible = visible;

return true;
});
}
}
}
2 changes: 1 addition & 1 deletion src/ShellClients/HideTracker.vala
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public class Gala.HideTracker : Object {
});
}

private void update_overlap () {
public void update_overlap () {
overlap = false;
focus_overlap = false;
focus_maximized_overlap = false;
Expand Down
30 changes: 25 additions & 5 deletions src/ShellClients/PanelClone.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class Gala.PanelClone : Object {
private const int ANIMATION_DURATION = 250;

public WindowManager wm { get; construct; }
public WindowManagerGala wm { get; construct; }
public unowned PanelWindow panel { get; construct; }

public Pantheon.Desktop.HideMode hide_mode {
Expand Down Expand Up @@ -38,14 +38,16 @@ public class Gala.PanelClone : Object {

private HideTracker? hide_tracker;

public PanelClone (WindowManager wm, PanelWindow panel) {
public PanelClone (WindowManagerGala wm, PanelWindow panel) {
Object (wm: wm, panel: panel);
}

construct {
default_gesture_tracker = new GestureTracker (ANIMATION_DURATION, ANIMATION_DURATION);

actor = (Meta.WindowActor) panel.window.get_compositor_private ();
actor.get_parent ().remove_child (actor);
wm.shell_group.add_child (actor);

notify["panel-hidden"].connect (() => {
// When hidden changes schedule an update to make sure it's actually
Expand All @@ -55,6 +57,8 @@ public class Gala.PanelClone : Object {
}
});

wm.get_display ().in_fullscreen_changed.connect (check_hide);

Idle.add_once (() => {
if (hide_mode == NEVER) {
show ();
Expand Down Expand Up @@ -89,22 +93,38 @@ public class Gala.PanelClone : Object {
return;
}

new GesturePropertyTransition (actor, default_gesture_tracker, "translation-y", null, calculate_translation_y (true)).start (false);
InternalUtils.update_transients_visible (panel.window, false);

new GesturePropertyTransition (
actor, default_gesture_tracker, "translation-y", null, calculate_translation_y (true)
).start (false, () => InternalUtils.update_transients_visible (panel.window, !panel_hidden));

default_gesture_tracker.add_success_callback (false, () => panel_hidden = true);
}

private void show () {
if (!panel_hidden || default_gesture_tracker.recognizing) {
if (!panel_hidden || default_gesture_tracker.recognizing || wm.get_display ().get_monitor_in_fullscreen (panel.window.get_monitor ())) {
return;
}

if (!Meta.Util.is_wayland_compositor ()) {
Utils.x11_unset_window_pass_through (panel.window);
}

new GesturePropertyTransition (actor, default_gesture_tracker, "translation-y", null, calculate_translation_y (false)).start (false);
new GesturePropertyTransition (
actor, default_gesture_tracker, "translation-y", null, calculate_translation_y (false)
).start (false, () => InternalUtils.update_transients_visible (panel.window, !panel_hidden));

default_gesture_tracker.add_success_callback (false, () => panel_hidden = false);
}

private void check_hide () {
if (wm.get_display ().get_monitor_in_fullscreen (panel.window.get_monitor ())) {
hide ();
} else if (hide_mode == NEVER) {
show ();
} else {
hide_tracker.update_overlap ();
}
}
}
4 changes: 2 additions & 2 deletions src/ShellClients/PanelWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class Gala.PanelWindow : Object {
private static HashTable<Meta.Window, Meta.Strut?> window_struts = new HashTable<Meta.Window, Meta.Strut?> (null, null);

public WindowManager wm { get; construct; }
public WindowManagerGala wm { get; construct; }
public Meta.Window window { get; construct; }
public Pantheon.Desktop.Anchor anchor { get; construct set; }

Expand All @@ -19,7 +19,7 @@ public class Gala.PanelWindow : Object {
private int width = -1;
private int height = -1;

public PanelWindow (WindowManager wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) {
public PanelWindow (WindowManagerGala wm, Meta.Window window, Pantheon.Desktop.Anchor anchor) {
Object (wm: wm, window: window, anchor: anchor);
}

Expand Down
6 changes: 3 additions & 3 deletions src/ShellClients/ShellClientsManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class Gala.ShellClientsManager : Object {
private static ShellClientsManager instance;

public static void init (WindowManager wm) {
public static void init (WindowManagerGala wm) {
if (instance != null) {
return;
}
Expand All @@ -20,15 +20,15 @@ public class Gala.ShellClientsManager : Object {
return instance;
}

public WindowManager wm { get; construct; }
public WindowManagerGala wm { get; construct; }

private NotificationsClient notifications_client;
private ManagedClient[] protocol_clients = {};

private GLib.HashTable<Meta.Window, PanelWindow> panel_windows = new GLib.HashTable<Meta.Window, PanelWindow> (null, null);
private GLib.HashTable<Meta.Window, WindowPositioner> positioned_windows = new GLib.HashTable<Meta.Window, WindowPositioner> (null, null);

private ShellClientsManager (WindowManager wm) {
private ShellClientsManager (WindowManagerGala wm) {
Object (wm: wm);
}

Expand Down
8 changes: 5 additions & 3 deletions src/Widgets/MultitaskingView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Gala {
private GestureTracker multitasking_gesture_tracker;
private GestureTracker workspace_gesture_tracker;

public WindowManager wm { get; construct; }
public WindowManagerGala wm { get; construct; }

private Meta.Display display;
private ModalProxy modal_proxy;
Expand All @@ -53,7 +53,7 @@ namespace Gala {
}
}

public MultitaskingView (WindowManager wm) {
public MultitaskingView (WindowManagerGala wm) {
Object (wm: wm);
}

Expand Down Expand Up @@ -631,6 +631,7 @@ namespace Gala {
wm.background_group.hide ();
wm.window_group.hide ();
wm.top_window_group.hide ();
wm.shell_group.hide ();
show ();
grab_key_focus ();

Expand Down Expand Up @@ -693,6 +694,7 @@ namespace Gala {
wm.background_group.show ();
wm.window_group.show ();
wm.top_window_group.show ();
wm.shell_group.show ();

dock_clones.destroy_all_children ();

Expand Down Expand Up @@ -721,7 +723,7 @@ namespace Gala {
foreach (unowned Meta.WindowActor actor in window_actors) {
const int MAX_OFFSET = 200;

if (actor.is_destroyed () || !actor.visible) {
if (actor.is_destroyed () || !actor.visible || actor.translation_y != 0) {
continue;
}

Expand Down
90 changes: 49 additions & 41 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ namespace Gala {
*/
public Clutter.Actor top_window_group { get; protected set; }

public Clutter.Actor notification_group { get; protected set; }
/**
* The group that contains all WindowActors that make shell elements, that is all windows reported as
* ShellClientsManager.is_positioned_window and notifications, as well as manually added elements.
* It will (eventually) never be hidden by other components and is always on top of everything. Therefore elements are
* responsible themselves for hiding depending on the state we are currently in (e.g. normal desktop, open multitasking view, fullscreen, etc.).
*/
public Clutter.Actor shell_group { get; private set; }

/**
* {@inheritDoc}
Expand Down Expand Up @@ -104,8 +110,6 @@ namespace Gala {
private bool animating_switch_workspace = false;
private bool switch_workspace_with_gesture = false;

private signal void window_created (Meta.Window window);

/**
* Amount of pixels to move on the nudge animation.
*/
Expand Down Expand Up @@ -253,14 +257,6 @@ namespace Gala {
stage.remove_child (top_window_group);
ui_group.add_child (top_window_group);

#if HAS_MUTTER44
var feedback_group = display.get_compositor ().get_feedback_group ();
#else
var feedback_group = display.get_feedback_group ();
#endif
stage.remove_child (feedback_group);
ui_group.add_child (feedback_group);

// Initialize plugins and add default components if no plugin overrides them
unowned var plugin_manager = PluginManager.get_default ();
plugin_manager.initialize (this);
Expand Down Expand Up @@ -293,8 +289,16 @@ namespace Gala {
}

// Add the remaining components that should be on top
notification_group = new Clutter.Actor ();
ui_group.add_child (notification_group);
shell_group = new Clutter.Actor ();
ui_group.add_child (shell_group);

#if HAS_MUTTER44
var feedback_group = display.get_compositor ().get_feedback_group ();
#else
var feedback_group = display.get_feedback_group ();
#endif
stage.remove_child (feedback_group);
ui_group.add_child (feedback_group);

pointer_locator = new PointerLocator (display);
ui_group.add_child (pointer_locator);
Expand Down Expand Up @@ -381,12 +385,14 @@ namespace Gala {

update_input_area ();

display.window_created.connect ((window) => window_created (window));

var scroll_action = new SuperScrollAction (display);
scroll_action.triggered.connect (handle_super_scroll);
stage.add_action_full ("wm-super-scroll-action", CAPTURE, scroll_action);

display.window_created.connect ((window) =>
InternalUtils.wait_for_window_actor_visible (window, check_shell_window)
);

stage.show ();

plugin_manager.load_waiting_plugins ();
Expand Down Expand Up @@ -1162,6 +1168,20 @@ namespace Gala {
show_window_menu (window, menu, rect.x, rect.y);
}

private void check_shell_window (Meta.WindowActor actor) {
unowned var window = actor.get_meta_window ();
if (ShellClientsManager.get_instance ().is_positioned_window (window)
|| NotificationStack.is_notification (window)
) {
actor.get_parent ().remove_child (actor);
shell_group.add_child (actor);
}

if (NotificationStack.is_notification (window)) {
notification_stack.show_notification (actor);
}
}

/*
* effects
*/
Expand Down Expand Up @@ -1436,12 +1456,8 @@ namespace Gala {
actor.remove_all_transitions ();
actor.show ();

// Notifications are a special case and have to be always be handled
// (also regardless of the animation setting)
// Notifications initial animation is handled by the notification stack
if (NotificationStack.is_notification (window)) {
InternalUtils.clutter_actor_reparent (actor, notification_group);
notification_stack.show_notification (actor);

map_completed (actor);
return;
}
Expand Down Expand Up @@ -1843,7 +1859,6 @@ namespace Gala {
private List<Clutter.Actor>? windows;
private List<Clutter.Actor>? parents;
private List<Clutter.Actor>? tmp_actors;
private ulong switch_workspace_window_created_id = 0;
private Clutter.Actor? out_group;
private Clutter.Actor? in_group;
private Clutter.Actor? wallpaper;
Expand Down Expand Up @@ -1932,7 +1947,10 @@ namespace Gala {
continue;
}

if (!window.showing_on_its_workspace () || move_primary_only && !window.is_on_primary_monitor ()) {
if (!window.showing_on_its_workspace () ||
move_primary_only && !window.is_on_primary_monitor () ||
actor.get_parent () == shell_group
) {
continue;
}

Expand Down Expand Up @@ -2045,17 +2063,6 @@ namespace Gala {

prepare_workspace_switch (from, to, direction);

// while a workspace is being switched mutter doesn't map windows
// TODO: currently only notifications are handled here, other windows should be too
switch_workspace_window_created_id = window_created.connect ((window) => {
if (NotificationStack.is_notification (window)) {
InternalUtils.wait_for_window_actor_visible (window, (actor) => {
InternalUtils.clutter_actor_reparent (actor, notification_group);
notification_stack.show_notification (actor);
});
}
});

var animation_mode = Clutter.AnimationMode.EASE_OUT_CUBIC;

var x2 = -in_group.x;
Expand Down Expand Up @@ -2127,11 +2134,8 @@ namespace Gala {
return;
}

if (switch_workspace_window_created_id > 0) {
disconnect (switch_workspace_window_created_id);
switch_workspace_window_created_id = 0;
}
end_switch_workspace ();

if (!is_nudge_animation) {
switch_workspace_completed ();
}
Expand All @@ -2156,9 +2160,9 @@ namespace Gala {
}
}

private void end_switch_workspace () {
if (windows == null || parents == null)
return;
private bool end_switch_workspace () {
if ((windows == null || parents == null) && tmp_actors == null)
return false;

unowned var display = get_display ();
unowned var active_workspace = display.get_workspace_manager ().get_active_workspace ();
Expand Down Expand Up @@ -2222,10 +2226,14 @@ namespace Gala {

switch_workspace_with_gesture = false;
animating_switch_workspace = false;

return true;
}

public override void kill_switch_workspace () {
end_switch_workspace ();
if (end_switch_workspace ()) {
switch_workspace_completed ();
}
}

public override void locate_pointer () {
Expand Down
Loading