diff --git a/lib/WindowManager.vala b/lib/WindowManager.vala index 0d5e694d7..3c9544297 100644 --- a/lib/WindowManager.vala +++ b/lib/WindowManager.vala @@ -167,6 +167,14 @@ namespace Gala { */ public abstract void perform_action (ActionType type); + /** + * Tells the window manager to move the Notifications Stack down + * by the given number of points, to make room for menus. + * + * @param offset The number of points by which to move the notifications stack + */ + public abstract void offset_notifications (int32 offset); + /** * Moves the window to the given workspace. * diff --git a/src/DBus.vala b/src/DBus.vala index 51eb6d24f..0ee19f60f 100644 --- a/src/DBus.vala +++ b/src/DBus.vala @@ -86,6 +86,10 @@ namespace Gala { wm.perform_action (type); } + public void offset_notifications (int32 offset) throws DBusError, Error { + wm.offset_notifications (offset); + } + private const double SATURATION_WEIGHT = 1.5; private const double WEIGHT_THRESHOLD = 1.0; diff --git a/src/NotificationStack.vala b/src/NotificationStack.vala index 39ff45d20..c43045144 100644 --- a/src/NotificationStack.vala +++ b/src/NotificationStack.vala @@ -29,6 +29,7 @@ public class Gala.NotificationStack : Object { private const int WIDTH = 300; private int stack_y; + private int stack_y_offset; private int stack_width; public Meta.Display display { get; construct; } @@ -99,7 +100,7 @@ public class Gala.NotificationStack : Object { notification_x_pos = 0; } - move_window (notification, notification_x_pos, stack_y + TOP_OFFSET + InternalUtils.scale_to_int (ADDITIONAL_MARGIN, scale)); + move_window (notification, notification_x_pos, stack_y + TOP_OFFSET + InternalUtils.scale_to_int (stack_y_offset + ADDITIONAL_MARGIN, scale)); notifications.insert (0, notification); } @@ -114,7 +115,7 @@ public class Gala.NotificationStack : Object { } private void update_positions (bool animate, float scale, float add_y = 0.0f) { - var y = stack_y + TOP_OFFSET + add_y + InternalUtils.scale_to_int (ADDITIONAL_MARGIN, scale); + var y = stack_y + TOP_OFFSET + add_y + InternalUtils.scale_to_int (stack_y_offset + ADDITIONAL_MARGIN, scale); var i = notifications.size; var delay_step = i > 0 ? 150 / i : 0; var iterator = 0; @@ -156,6 +157,11 @@ public class Gala.NotificationStack : Object { } } + public void offset_notifications (int32 offset) { + stack_y_offset = offset; + update_positions (true); + } + public void destroy_notification (Meta.WindowActor notification, bool animate) { if (animate) { notification.save_easing_state (); diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 497201676..00bf7298e 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -1007,6 +1007,10 @@ namespace Gala { } } + public void offset_notifications (int32 offset) { + notification_stack.offset_notifications (offset); + } + public override void show_window_menu (Meta.Window window, Meta.WindowMenuType menu, int x, int y) { switch (menu) { case Meta.WindowMenuType.WM: