improve application detection and speed up

This commit is contained in:
chrys 2016-10-03 00:01:52 +02:00
parent bc5bc3d1ef
commit f231f72cbe
4 changed files with 17 additions and 14 deletions

View File

@ -21,12 +21,12 @@ class screenManager():
def shutdown(self): def shutdown(self):
self.env['runtime']['settingsManager'].shutdownDriver('screenDriver') self.env['runtime']['settingsManager'].shutdownDriver('screenDriver')
def update(self, trigger = 'onUpdate'): def update(self, trigger='onUpdate'):
self.env['runtime']['screenDriver'].getCurrScreen() self.env['runtime']['screenDriver'].getCurrScreen()
if not self.isSuspendingScreen(): if not self.isSuspendingScreen():
if trigger == 'onUpdate' or self.isScreenChange():
self.env['runtime']['screenDriver'].getCurrApplication()
self.env['runtime']['screenDriver'].update(trigger) self.env['runtime']['screenDriver'].update(trigger)
if trigger == 'onUpdate' or self.isScreenChange() or len(self.env['screenData']['newDelta']) > 6:
self.env['runtime']['screenDriver'].getCurrApplication()
self.env['screenData']['lastScreenUpdate'] = time.time() self.env['screenData']['lastScreenUpdate'] = time.time()
def isSuspendingScreen(self): def isSuspendingScreen(self):

View File

@ -49,7 +49,7 @@ class fenrir():
if self.environment['input']['keyForeward'] > 0: if self.environment['input']['keyForeward'] > 0:
self.environment['input']['keyForeward'] -=1 self.environment['input']['keyForeward'] -=1
self.environment['runtime']['screenManager'].update('onInput') self.environment['runtime']['screenManager'].update('onInput')
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput') self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
else: else:
self.environment['runtime']['screenManager'].update('onUpdate') self.environment['runtime']['screenManager'].update('onUpdate')
if self.environment['runtime']['applicationManager'].isApplicationChange(): if self.environment['runtime']['applicationManager'].isApplicationChange():

View File

@ -33,14 +33,17 @@ class driver():
r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay')) r, w, x = select(self.iDevices, [], [], self.env['runtime']['settingsManager'].getSettingAsFloat('screen', 'screenUpdateDelay'))
if r != []: if r != []:
for fd in r: for fd in r:
event = self.iDevices[fd].read_one() while(True):
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event]) event = self.iDevices[fd].read_one()
if event.code != 0: if not event:
currMapEvent = self.env['runtime']['inputDriver'].mapEvent(event) return None
if not currMapEvent: self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
return currMapEvent if event.code != 0:
if currMapEvent['EventState'] in [0,1,2]: currMapEvent = self.env['runtime']['inputDriver'].mapEvent(event)
return currMapEvent if not currMapEvent:
return currMapEvent
if currMapEvent['EventState'] in [0,1,2]:
return currMapEvent
return None return None
def writeEventBuffer(self): def writeEventBuffer(self):

View File

@ -71,7 +71,7 @@ class driver():
return xlist return xlist
def update(self, trigger='updateScreen'): def update(self, trigger='onUpdate'):
newContentBytes = b'' newContentBytes = b''
try: try:
# read screen # read screen