Attempt to fix the problem where when you switch back from an X session control seems to get stuck.
This commit is contained in:
parent
dda9d5e4e7
commit
619b67ea70
@ -356,6 +356,7 @@ class driver(inputDriver):
|
|||||||
del(self.gDevices[newDevice.fd])
|
del(self.gDevices[newDevice.fd])
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def grabDevice(self, fd):
|
def grabDevice(self, fd):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
return True
|
return True
|
||||||
@ -363,15 +364,23 @@ class driver(inputDriver):
|
|||||||
self.iDevices[fd].grab()
|
self.iDevices[fd].grab()
|
||||||
self.gDevices[fd] = True
|
self.gDevices[fd] = True
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grab device ('+ str(self.iDevices[fd].name) + ')',debug.debugLevel.INFO)
|
||||||
|
# Reset modifier keys on successful grab
|
||||||
|
if self.uDevices[fd]:
|
||||||
|
modifierKeys = [e.KEY_LEFTCTRL, e.KEY_RIGHTCTRL, e.KEY_LEFTALT, e.KEY_RIGHTALT, e.KEY_LEFTSHIFT, e.KEY_RIGHTSHIFT]
|
||||||
|
for key in modifierKeys:
|
||||||
|
try:
|
||||||
|
self.uDevices[fd].write(e.EV_KEY, key, 0) # 0 = key up
|
||||||
|
self.uDevices[fd].syn()
|
||||||
|
except Exception as e:
|
||||||
|
self.env['runtime']['debug'].writeDebugOut('Failed to reset modifier key: ' + str(e), debug.debugLevel.WARNING)
|
||||||
except IOError:
|
except IOError:
|
||||||
if not self.gDevices[fd]:
|
if not self.gDevices[fd]:
|
||||||
return False
|
return False
|
||||||
# self.gDevices[fd] = True
|
|
||||||
# #self.removeDevice(fd)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
self.env['runtime']['debug'].writeDebugOut('InputDriver evdev: grabing not possible: ' + str(e),debug.debugLevel.ERROR)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def ungrabDevice(self,fd):
|
def ungrabDevice(self,fd):
|
||||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user