summaryrefslogtreecommitdiffstats
path: root/LockWindow.py
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-02-08 16:10:46 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-02-08 16:10:46 +0100
commita8e8bacdca1b7e2843c3d17bc6abdb2632d40c8e (patch)
treeedd939ba9b6050793bb5b8cbb85e2f9455397ce4 /LockWindow.py
parent541c5bedec87ebeba298c598f4108a5dc47bfc58 (diff)
downloadpylock-a8e8bacdca1b7e2843c3d17bc6abdb2632d40c8e.tar
pylock-a8e8bacdca1b7e2843c3d17bc6abdb2632d40c8e.zip
Grab devices
Diffstat (limited to 'LockWindow.py')
-rw-r--r--LockWindow.py17
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()