Skip to content

Commit

Permalink
Handle monitor change in screenshield and make it a local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
leolost2605 committed Dec 19, 2024
1 parent 75cf2c8 commit 73a8aea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
5 changes: 4 additions & 1 deletion src/Widgets/ScreenShield.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 ();
}

Expand Down Expand Up @@ -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;
Expand Down
26 changes: 9 additions & 17 deletions src/WindowManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -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 ();
Expand All @@ -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");
Expand Down Expand Up @@ -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*/
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 73a8aea

Please sign in to comment.