detect device only once

This commit is contained in:
Chrys 2019-10-21 23:32:17 +02:00
parent 7e4217254a
commit d01d4f0773
2 changed files with 9 additions and 1 deletions

View File

@ -51,10 +51,13 @@ class inputManager():
self.executeDeviceGrab = newExecuteDeviceGrab
def handleDeviceGrab(self):
if not self.executeDeviceGrab:
print('1')
return
if self.env['input']['eventBuffer'] != []:
print('2', self.env['input']['eventBuffer'])
return
if not self.noKeyPressed():
print('3')
return
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'grabDevices'):
self.executeDeviceGrab = False
@ -166,7 +169,7 @@ class inputManager():
return True
def handlePlugInputDevice(self, eventData):
for deviceEntry in eventData:
self.env['runtime']['inputManager'].updateInputDevices(deviceEntry['device'])
self.updateInputDevices(deviceEntry['device'])
def updateInputDevices(self, newDevice = None):
try:
self.env['runtime']['inputDriver'].updateInputDevices(newDevice)

View File

@ -417,6 +417,11 @@ class settingsManager():
environment['runtime']['vmenuManager'].initialize(environment)
environment['runtime']['quickMenuManager'] = quickMenuManager.quickMenuManager()
environment['runtime']['quickMenuManager'].initialize(environment)
# only possible after having input and screen managers with clean buffer
environment['runtime']['inputManager'].setExecuteDeviceGrab()
environment['runtime']['inputManager'].writeEventBuffer()
environment['runtime']['inputManager'].handleDeviceGrab()
environment['runtime']['debug'].writeDebugOut('\/-------environment-------\/',debug.debugLevel.INFO, onAnyLevel=True)
environment['runtime']['debug'].writeDebugOut(str(environment), debug.debugLevel.INFO, onAnyLevel=True)
environment['runtime']['debug'].writeDebugOut('\/-------settings.conf-------\/', debug.debugLevel.INFO, onAnyLevel=True)