Merge branch 'inputHandlingRework' of https://github.com/chrys87/fenrir into inputHandlingRework
This commit is contained in:
commit
d287bc294d
@ -33,19 +33,21 @@ class inputManager():
|
||||
mEvent = self.env['runtime']['inputDriver'].getInputEvent()
|
||||
if mEvent:
|
||||
mEvent['EventName'] = self.convertEventName(mEvent['EventName'])
|
||||
if mEvent['EventValue'] == 0:
|
||||
return False
|
||||
eventReceived = True
|
||||
if mEvent['EventState'] == 0:
|
||||
if mEvent['EventName'] in self.env['input']['currInput']:
|
||||
self.env['input']['currInput'].remove(mEvent['EventName'])
|
||||
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
||||
if len(self.env['input']['prevDeepestInput']) < len(self.env['input']['currInput']):
|
||||
self.env['input']['prevDeepestInput'] = self.env['input']['currInput'].copy()
|
||||
if len(self.env['input']['currInput']) > 1:
|
||||
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
||||
if len(self.env['input']['currInput']) == 0:
|
||||
self.env['input']['prevDeepestInput'] = []
|
||||
elif mEvent['EventState'] == 1:
|
||||
if not mEvent['EventName'] in self.env['input']['currInput']:
|
||||
self.env['input']['currInput'].append(mEvent['EventName'])
|
||||
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
||||
if len(self.env['input']['currInput']) > 1:
|
||||
self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
|
||||
if len(self.env['input']['prevDeepestInput']) < len(self.env['input']['currInput']):
|
||||
self.env['input']['prevDeepestInput'] = self.env['input']['currInput'].copy()
|
||||
elif mEvent['EventState'] == 2:
|
||||
pass
|
||||
else:
|
||||
|
@ -50,7 +50,6 @@ class fenrir():
|
||||
self.environment['runtime']['inputManager'].clearEventBuffer()
|
||||
if self.environment['input']['keyForeward'] > 0:
|
||||
self.environment['input']['keyForeward'] -=1
|
||||
self.environment['input']['prevDeepestInput'] = []
|
||||
else:
|
||||
self.environment['runtime']['screenManager'].update()
|
||||
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
|
||||
|
@ -31,19 +31,20 @@ class driver():
|
||||
for fd in r:
|
||||
event = self.iDevices[fd].read_one()
|
||||
self.env['input']['eventBuffer'].append( [self.iDevices[fd], self.uDevices[fd], event])
|
||||
return self.env['runtime']['inputDriver'].mapEvent(event)
|
||||
if event.code != 0:
|
||||
return self.env['runtime']['inputDriver'].mapEvent(event)
|
||||
return None
|
||||
|
||||
def writeEventBuffer(self):
|
||||
for iDevice, uDevice, event in self.env['input']['eventBuffer']:
|
||||
self.writeUInput(uDevice, event)
|
||||
uDevice.syn()
|
||||
|
||||
def clearEventBuffer(self):
|
||||
del self.env['input']['eventBuffer'][:]
|
||||
|
||||
def writeUInput(self, uDevice, event):
|
||||
uDevice.write_event(event)
|
||||
uDevice.syn()
|
||||
|
||||
def getInputDevices(self):
|
||||
# 3 pos absolute
|
||||
@ -62,7 +63,7 @@ class driver():
|
||||
return None
|
||||
mEvent = inputEvent.inputEvent
|
||||
try:
|
||||
mEvent['EventName'] = evdev.ecodes.keys[event.code].upper()
|
||||
mEvent['EventName'] = evdev.ecodes.keys[event.code]
|
||||
mEvent['EventValue'] = event.code
|
||||
mEvent['EventSec'] = event.sec
|
||||
mEvent['EventUsec'] = event.usec
|
||||
|
Loading…
Reference in New Issue
Block a user