Skip to content

Commit cd8d673

Browse files
committed
DBusAccelerator: pass display instead of wm
1 parent 2537a38 commit cd8d673

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/DBus.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class Gala.DBus {
3333
Bus.own_name (BusType.SESSION, "org.gnome.Shell", BusNameOwnerFlags.NONE,
3434
(connection) => {
3535
try {
36-
connection.register_object ("/org/gnome/Shell", DBusAccelerator.init (wm));
36+
connection.register_object ("/org/gnome/Shell", DBusAccelerator.init (wm.get_display ()));
3737
connection.register_object ("/org/gnome/Shell/Screenshot", ScreenshotManager.init (wm));
3838
} catch (Error e) { warning (e.message); }
3939
},

src/DBusAccelerator.vala

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,22 +75,23 @@ namespace Gala {
7575
private static DBusAccelerator? instance;
7676

7777
[DBus (visible = false)]
78-
public static unowned DBusAccelerator init (WindowManager wm) {
79-
if (instance == null)
80-
instance = new DBusAccelerator (wm);
78+
public static unowned DBusAccelerator init (Meta.Display display) {
79+
if (instance == null) {
80+
instance = new DBusAccelerator (display);
81+
}
8182

8283
return instance;
8384
}
8485

8586
public signal void accelerator_activated (uint action, GLib.HashTable<string, Variant> parameters);
8687

87-
private WindowManager wm;
88+
private Meta.Display display;
8889
private GLib.HashTable<unowned string, GrabbedAccelerator> grabbed_accelerators;
8990

90-
private DBusAccelerator (WindowManager _wm) {
91-
wm = _wm;
91+
private DBusAccelerator (Meta.Display _display) {
92+
display = _display;
9293
grabbed_accelerators = new HashTable<unowned string, GrabbedAccelerator> (str_hash, str_equal);
93-
wm.get_display ().accelerator_activated.connect (on_accelerator_activated);
94+
display.accelerator_activated.connect (on_accelerator_activated);
9495
}
9596

9697
private void on_accelerator_activated (uint action, Clutter.InputDevice device, uint timestamp) {
@@ -115,7 +116,7 @@ namespace Gala {
115116
return found_accel.action;
116117
}
117118

118-
uint action = wm.get_display ().grab_accelerator (accelerator, grab_flags);
119+
uint action = display.grab_accelerator (accelerator, grab_flags);
119120
if (action != Meta.KeyBindingFlags.NONE) {
120121
var accel = new GrabbedAccelerator ();
121122
accel.action = action;
@@ -141,7 +142,7 @@ namespace Gala {
141142
public bool ungrab_accelerator (uint action) throws GLib.DBusError, GLib.IOError {
142143
foreach (unowned GrabbedAccelerator accel in grabbed_accelerators.get_values ()) {
143144
if (accel.action == action) {
144-
bool ret = wm.get_display ().ungrab_accelerator (action);
145+
bool ret = display.ungrab_accelerator (action);
145146
grabbed_accelerators.remove (accel.name);
146147
return ret;
147148
}

src/WindowManager.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace Gala {
157157
screensaver = new ScreenSaverManager (screen_shield);
158158

159159
DBus.init (this);
160-
DBusAccelerator.init (this);
160+
DBusAccelerator.init (display);
161161
MediaFeedback.init ();
162162

163163
WindowListener.init (display);

0 commit comments

Comments
 (0)