filter out unneeded events, improve interrupt commands

This commit is contained in:
chrys 2016-09-29 22:34:44 +02:00
parent 40b257f4e7
commit 8bedf94073
4 changed files with 12 additions and 5 deletions

View File

@ -16,6 +16,8 @@ class command():
def getDescription(self):
return 'interrupts the current presentation'
def run(self):
if len(self.env['input']['prevDeepestInput']) > len(self.env['input']['currInput']):
return
self.env['runtime']['outputManager'].interruptOutput()
def setCallback(self, callback):
pass

View File

@ -19,6 +19,8 @@ class command():
def run(self):
if self.env['runtime']['inputManager'].noKeyPressed():
return
if len(self.env['input']['prevDeepestInput']) > len(self.env['input']['currInput']):
return
if not self.env['runtime']['settingsManager'].getSettingAsBool('keyboard', 'interruptOnKeyPress'):
return
if self.env['screenData']['newTTY'] != self.env['screenData']['oldTTY']:

View File

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

View File

@ -32,7 +32,11 @@ class driver():
event = self.iDevices[fd].read_one()
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
if event.code != 0:
return self.env['runtime']['inputDriver'].mapEvent(event)
currMapEvent = self.env['runtime']['inputDriver'].mapEvent(event)
if not currMapEvent:
return currMapEvent
if currMapEvent['EventState'] in [0,1,2]:
return currMapEvent
return None
def writeEventBuffer(self):
@ -53,8 +57,8 @@ class driver():
# 1 Keys
# we try to filter out mices and other stuff here
self.iDevices = map(evdev.InputDevice, (evdev.list_devices()))
self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()}
#self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()}
#self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()}
self.iDevices = {dev.fd: dev for dev in self.iDevices if 1 in dev.capabilities()}
self.ledDevices = map(evdev.InputDevice, (evdev.list_devices()))
self.ledDevices = {dev.fd: dev for dev in self.ledDevices if 1 in dev.capabilities() and 17 in dev.capabilities() and not 3 in dev.capabilities() and not 2 in dev.capabilities()}