From 73a8aeaa8cc3a15157fbe6399c57df036e21f8b0 Mon Sep 17 00:00:00 2001 From: Leonhard Kargl Date: Thu, 19 Dec 2024 19:58:29 +0100 Subject: [PATCH] Handle monitor change in screenshield and make it a local variable --- src/Widgets/ScreenShield.vala | 5 ++++- src/WindowManager.vala | 26 +++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/Widgets/ScreenShield.vala b/src/Widgets/ScreenShield.vala index 9ede93dad..edc94fb0b 100644 --- a/src/Widgets/ScreenShield.vala +++ b/src/Widgets/ScreenShield.vala @@ -141,6 +141,9 @@ namespace Gala { expand_to_screen_size (); + unowned var monitor_manager = wm.get_display ().get_context ().get_backend ().get_monitor_manager (); + monitor_manager.monitors_changed.connect (expand_to_screen_size); + init_dbus_interfaces.begin (); } @@ -196,7 +199,7 @@ namespace Gala { connected_to_buses = success; } - public void expand_to_screen_size () { + private void expand_to_screen_size () { int screen_width, screen_height; wm.get_display ().get_size (out screen_width, out screen_height); width = screen_width; diff --git a/src/WindowManager.vala b/src/WindowManager.vala index 867e22b5c..f25d8347c 100644 --- a/src/WindowManager.vala +++ b/src/WindowManager.vala @@ -47,9 +47,7 @@ namespace Gala { /** * {@inheritDoc} */ - public Gala.ActivatableComponent workspace_view { get; protected set; } - - public ScreenShield? screen_shield { get; private set; } + public Gala.ActivatableComponent workspace_view { get; protected set; } public PointerLocator pointer_locator { get; private set; } @@ -184,9 +182,6 @@ namespace Gala { private void show_stage () { unowned Meta.Display display = get_display (); - screen_shield = new ScreenShield (this); - screensaver = new ScreenSaverManager (screen_shield); - DBus.init (this); DBusAccelerator.init (display); MediaFeedback.init (); @@ -200,11 +195,6 @@ namespace Gala { notification_stack = new NotificationStack (display); - // Due to a bug which enables access to the stage when using multiple monitors - // in the screensaver, we have to listen for changes and make sure the input area - // is set to NONE when we are in locked mode - screensaver.active_changed.connect (update_input_area); - stage = display.get_stage () as Clutter.Stage; var background_settings = new GLib.Settings ("org.gnome.desktop.background"); var color = background_settings.get_string ("primary-color"); @@ -309,8 +299,15 @@ namespace Gala { ui_group.add_child (pointer_locator); ui_group.add_child (new DwellClickTimer (display)); + var screen_shield = new ScreenShield (this); ui_group.add_child (screen_shield); + screensaver = new ScreenSaverManager (screen_shield); + // Due to a bug which enables access to the stage when using multiple monitors + // in the screensaver, we have to listen for changes and make sure the input area + // is set to NONE when we are in locked mode + screensaver.active_changed.connect (update_input_area); + FilterManager.init (this); /*keybindings*/ @@ -373,7 +370,7 @@ namespace Gala { } unowned var monitor_manager = display.get_context ().get_backend ().get_monitor_manager (); - monitor_manager.monitors_changed.connect (on_monitors_changed); + monitor_manager.monitors_changed.connect (update_ui_group_size); hot_corner_manager = new HotCornerManager (this, behavior_settings, new_behavior_settings); hot_corner_manager.on_configured.connect (update_input_area); @@ -440,11 +437,6 @@ namespace Gala { } } - private void on_monitors_changed () { - update_ui_group_size (); - screen_shield.expand_to_screen_size (); - } - [CCode (instance_pos = -1)] private void handle_cycle_workspaces (Meta.Display display, Meta.Window? window, Clutter.KeyEvent event, Meta.KeyBinding binding) {