Skip to content

Commit

Permalink
FocusManager: don't use singleton (#521)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter authored Feb 14, 2024
1 parent 1823b22 commit 52aa9a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
9 changes: 6 additions & 3 deletions wingpanel-interface/DBusServer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
[DBus (name = "org.pantheon.gala.WingpanelInterface")]
public class WingpanelInterface.DBusServer : Object {
private BackgroundManager background_manager;
private FocusManager focus_manager;

public signal void state_changed (BackgroundState state, uint animation_duration);

Expand All @@ -28,17 +29,19 @@ public class WingpanelInterface.DBusServer : Object {
background_manager.state_changed.connect ((state, animation_duration) => {
state_changed (state, animation_duration);
});

focus_manager = new FocusManager ();
}

public bool begin_grab_focused_window (int x, int y, int button, uint time, uint state) throws GLib.Error {
return FocusManager.get_default ().begin_grab_focused_window (x, y, button, time, state);
return focus_manager.begin_grab_focused_window (x, y, button, time, state);
}

public void remember_focused_window () throws GLib.Error {
FocusManager.get_default ().remember_focused_window ();
focus_manager.remember_focused_window ();
}

public void restore_focused_window () throws GLib.Error {
FocusManager.get_default ().restore_focused_window ();
focus_manager.restore_focused_window ();
}
}
10 changes: 0 additions & 10 deletions wingpanel-interface/FocusManager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
*/

public class WingpanelInterface.FocusManager : Object {
private static FocusManager? instance = null;

private unowned Meta.Workspace? current_workspace = null;
private unowned Meta.Window? last_focused_window = null;
private unowned Meta.Window? last_focused_dialog_window = null;
Expand Down Expand Up @@ -140,12 +138,4 @@ public class WingpanelInterface.FocusManager : Object {

current_workspace = workspace;
}

public static FocusManager get_default () {
if (instance == null) {
instance = new FocusManager ();
}

return instance;
}
}

0 comments on commit 52aa9a7

Please sign in to comment.