improve grabbing
This commit is contained in:
@ -166,7 +166,6 @@ class fenrirManager():
|
||||
#print('handleScreenUpdate:',time.time() - startTime)
|
||||
|
||||
def handlePlugInputDevice(self, event):
|
||||
self.environment['runtime']['inputManager'].updateInputDevices()
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onPlugInputDevice', force=True)
|
||||
|
||||
def handleHeartBeat(self, event):
|
||||
|
@ -14,7 +14,7 @@ class inputManager():
|
||||
def __init__(self):
|
||||
self.setLedState = True
|
||||
self.shortcutType = 'KEY'
|
||||
|
||||
self.toggleDeviceGrab = False
|
||||
def setShortcutType(self, shortcutType = 'KEY'):
|
||||
if shortcutType in ['KEY', 'BYTE']:
|
||||
self.shortcutType = shortcutType
|
||||
@ -39,6 +39,23 @@ class inputManager():
|
||||
self.env['runtime']['settingsManager'].shutdownDriver('inputDriver')
|
||||
def getInputEvent(self):
|
||||
return self.env['runtime']['inputDriver'].getInputEvent()
|
||||
def handleDeviceGrab(self, useCurrentScreen = False):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||
return
|
||||
if useCurrentScreen:
|
||||
self.toggleDeviceGrab = True
|
||||
else:
|
||||
if self.env['runtime']['screenManager'].getCurrScreenIgnored() != self.env['runtime']['screenManager'].getPrevScreenIgnored():
|
||||
self.toggleDeviceGrab = True
|
||||
|
||||
if self.toggleDeviceGrab:
|
||||
if self.noKeyPressed():
|
||||
if self.env['runtime']['screenManager'].getCurrScreenIgnored():
|
||||
self.ungrabAllDevices()
|
||||
self.env['runtime']['outputManager'].interruptOutput()
|
||||
else:
|
||||
self.grabAllDevices()
|
||||
self.toggleDeviceGrab = False
|
||||
def handleInputEvent(self, eventData):
|
||||
self.env['runtime']['debug'].writeDebugOut('DEBUG INPUT inputMan:' + str(eventData),debug.debugLevel.INFO)
|
||||
if not eventData:
|
||||
@ -118,14 +135,14 @@ class inputManager():
|
||||
try:
|
||||
self.env['runtime']['inputDriver'].ungrabAllDevices()
|
||||
except Exception as e:
|
||||
pass
|
||||
pass
|
||||
|
||||
def updateInputDevices(self):
|
||||
try:
|
||||
self.env['runtime']['inputDriver'].updateInputDevices()
|
||||
except:
|
||||
pass
|
||||
|
||||
self.handleDeviceGrab(True)
|
||||
def removeAllDevices(self):
|
||||
try:
|
||||
self.env['runtime']['inputDriver'].removeAllDevices()
|
||||
|
@ -12,7 +12,6 @@ class screenManager():
|
||||
def __init__(self):
|
||||
self.currScreenIgnored = False
|
||||
self.prevScreenIgnored = False
|
||||
self.toggleDeviceGrab = False
|
||||
def initialize(self, environment):
|
||||
self.env = environment
|
||||
self.env['runtime']['settingsManager'].loadDriver(\
|
||||
@ -40,25 +39,12 @@ class screenManager():
|
||||
self.changeBrailleScreen()
|
||||
if not self.isSuspendingScreen(self.env['screen']['newTTY']):
|
||||
self.update(eventData, 'onScreenChange')
|
||||
self.env['screen']['lastScreenUpdate'] = time.time()
|
||||
def handleDeviceGrab(self):
|
||||
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
|
||||
return
|
||||
if self.getCurrScreenIgnored() != self.getPrevScreenIgnored():
|
||||
self.toggleDeviceGrab = True
|
||||
if self.toggleDeviceGrab:
|
||||
if self.env['runtime']['inputManager'].noKeyPressed():
|
||||
if self.getCurrScreenIgnored():
|
||||
self.env['runtime']['inputManager'].ungrabAllDevices()
|
||||
self.env['runtime']['outputManager'].interruptOutput()
|
||||
else:
|
||||
self.env['runtime']['inputManager'].grabAllDevices()
|
||||
self.toggleDeviceGrab = False
|
||||
self.env['screen']['lastScreenUpdate'] = time.time()
|
||||
|
||||
def handleScreenUpdate(self, eventData):
|
||||
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
|
||||
self.updateScreenIgnored()
|
||||
self.handleDeviceGrab()
|
||||
self.env['runtime']['inputManager'].handleDeviceGrab()
|
||||
if not self.getCurrScreenIgnored():
|
||||
self.update(eventData, 'onScreenUpdate')
|
||||
#if trigger == 'onUpdate' or self.isScreenChange() \
|
||||
|
Reference in New Issue
Block a user