diff options
-rw-r--r-- | LockWindow.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/LockWindow.py b/LockWindow.py index 25d7546..c0751f4 100644 --- a/LockWindow.py +++ b/LockWindow.py @@ -50,6 +50,11 @@ class LockWindow(Gtk.Window): self.reset(True) + self.display = Gdk.Display.get_default() + self.deviceManager = self.display.get_device_manager() + + self.unlockWindow.connect('map-event', self._grab_devices) + def _logout(self): self.promptEntry.set_sensitive(False) self.unlockButton.set_sensitive(False) @@ -99,6 +104,16 @@ class LockWindow(Gtk.Window): def setAuthMessage(self, message): self.messageLabel.set_label(message) + def _grab_devices(self, w, e): + for device in self.deviceManager.list_devices(Gdk.DeviceType.MASTER): + device.grab(self.unlockWindow.get_window(), Gdk.GrabOwnership.APPLICATION, False, Gdk.EventMask.ALL_EVENTS_MASK, None, Gdk.CURRENT_TIME) + + return False + + def _ungrab_devices(self): + for device in self.deviceManager.list_devices(Gdk.DeviceType.MASTER): + device.ungrab(Gdk.CURRENT_TIME) + def lock(self): self.show_all() self.unlockWindow.show_all() @@ -106,6 +121,8 @@ class LockWindow(Gtk.Window): self.promptEntry.grab_focus() def unlock(self): + self._ungrab_devices() + self.unlockWindow.hide() self.hide() |