From d01d4f07732c32d81d428d09c5cd6c052498ea28 Mon Sep 17 00:00:00 2001 From: Chrys Date: Mon, 21 Oct 2019 23:32:17 +0200 Subject: [PATCH] detect device only once --- src/fenrirscreenreader/core/inputManager.py | 5 ++++- src/fenrirscreenreader/core/settingsManager.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/core/inputManager.py b/src/fenrirscreenreader/core/inputManager.py index 0fcd75c7..eb379607 100644 --- a/src/fenrirscreenreader/core/inputManager.py +++ b/src/fenrirscreenreader/core/inputManager.py @@ -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) diff --git a/src/fenrirscreenreader/core/settingsManager.py b/src/fenrirscreenreader/core/settingsManager.py index 988503eb..48238ccc 100644 --- a/src/fenrirscreenreader/core/settingsManager.py +++ b/src/fenrirscreenreader/core/settingsManager.py @@ -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)