grab/ungrab on noKeyPressed()

This commit is contained in:
chrys 2018-05-13 23:40:05 +02:00
parent 26fcd92f81
commit abc449bec2

View File

@ -12,6 +12,7 @@ class screenManager():
def __init__(self): def __init__(self):
self.currScreenIgnored = False self.currScreenIgnored = False
self.prevScreenIgnored = False self.prevScreenIgnored = False
self.toggleDeviceGrab = False
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
self.env['runtime']['settingsManager'].loadDriver(\ self.env['runtime']['settingsManager'].loadDriver(\
@ -40,15 +41,22 @@ class screenManager():
if not self.isSuspendingScreen(self.env['screen']['newTTY']): if not self.isSuspendingScreen(self.env['screen']['newTTY']):
self.update(eventData, 'onScreenChange') self.update(eventData, 'onScreenChange')
self.env['screen']['lastScreenUpdate'] = time.time() self.env['screen']['lastScreenUpdate'] = time.time()
def handleScreenUpdate(self, eventData): def handleDeviceGrab(self):
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
self.updateScreenIgnored()
if self.getCurrScreenIgnored() != self.getPrevScreenIgnored(): if self.getCurrScreenIgnored() != self.getPrevScreenIgnored():
self.toggleDeviceGrab = True
if self.toggleDeviceGrab:
if self.env['runtime']['inputManager'].noKeyPressed():
if self.getCurrScreenIgnored(): if self.getCurrScreenIgnored():
self.env['runtime']['inputManager'].ungrabAllDevices() self.env['runtime']['inputManager'].ungrabAllDevices()
self.env['runtime']['outputManager'].interruptOutput() self.env['runtime']['outputManager'].interruptOutput()
else: else:
self.env['runtime']['inputManager'].grabAllDevices() self.env['runtime']['inputManager'].grabAllDevices()
self.toggleDeviceGrab = True
def handleScreenUpdate(self, eventData):
self.env['screen']['oldApplication'] = self.env['screen']['newApplication']
self.updateScreenIgnored()
self.handleDeviceGrab()
if not self.getCurrScreenIgnored(): if not self.getCurrScreenIgnored():
self.update(eventData, 'onScreenUpdate') self.update(eventData, 'onScreenUpdate')
#if trigger == 'onUpdate' or self.isScreenChange() \ #if trigger == 'onUpdate' or self.isScreenChange() \