From 0296590f085fad3f7e8575189cacf311fcdd2563 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 11 May 2018 22:21:30 +0200 Subject: [PATCH] add ungrab method --- .../inputDriver/evdevDriver.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/fenrirscreenreader/inputDriver/evdevDriver.py b/src/fenrirscreenreader/inputDriver/evdevDriver.py index e4770715..feb9f97e 100644 --- a/src/fenrirscreenreader/inputDriver/evdevDriver.py +++ b/src/fenrirscreenreader/inputDriver/evdevDriver.py @@ -241,7 +241,11 @@ class driver(inputDriver): return for fd in self.iDevices: self.grabDevice(fd) - + def ungrabAllDevices(self): + if not self._initialized: + return + for fd in self.iDevices: + self.ungrabDevices(fd) def grabDevice(self, fd): if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): self.uDevices[fd] = None @@ -254,7 +258,6 @@ class driver(inputDriver): dev = self.iDevices[fd] cap = dev.capabilities() del cap[0] - print(e) self.uDevices[fd] = UInput( cap, dev.name, @@ -266,11 +269,17 @@ class driver(inputDriver): self.iDevices[fd].grab() except Exception as e: self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR) - + def ungrabDevices(self,fd): + if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'): + return + try: + self.iDevices[fd].ungrab() + except: + pass def removeDevice(self,fd): self.clearEventBuffer() try: - self.iDevices[fd].ungrab() + self.ungrabDevices(fd) except: pass try: