Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FocusManager: don't use singleton #521

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
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;
}
}