fix input handling again

This commit is contained in:
chrys 2016-09-25 19:03:08 +02:00
parent 204e9423ff
commit 433d801284
3 changed files with 14 additions and 9 deletions

View File

@ -68,7 +68,6 @@ class inputManager():
def convertEventName(self, eventName):
if not eventName:
return ''
print(eventName)
if eventName == 'KEY_LEFTCTRL':
eventName = 'KEY_CTRL'

View File

@ -24,6 +24,7 @@ class fenrir():
signal.signal(signal.SIGINT, self.captureSignal)
signal.signal(signal.SIGTERM, self.captureSignal)
self.wasCommand = False
self.currShortcutLenght = 0
def proceed(self):
while(self.environment['generalInformation']['running']):
try:
@ -41,14 +42,18 @@ class fenrir():
#if not (self.environment['runtime']['inputManager'].isConsumeInput() or \
# self.environment['runtime']['inputManager'].isFenrirKeyPressed()) and \
# not self.environment['runtime']['commandManager'].isCommandQueued():
print('vor',self.wasCommand,self.currShortcutLenght)
if not self.wasCommand:
print('dri')
self.environment['runtime']['inputManager'].writeEventBuffer()
if self.wasCommand:
if self.environment['runtime']['inputManager'].noKeyPressed():
self.wasCommand = False
self.environment['runtime']['inputManager'].clearEventBuffer()
if self.environment['runtime']['inputManager'].noKeyPressed():
if self.wasCommand:
print('mache falsch')
self.wasCommand = False
self.environment['runtime']['inputManager'].clearEventBuffer()
self.currShortcutLenght = 0
self.environment['runtime']['screenManager'].update()
print('nach',self.wasCommand,self.currShortcutLenght)
self.environment['runtime']['commandManager'].executeDefaultTrigger('onInput')
else:
self.environment['runtime']['screenManager'].update()
@ -73,8 +78,9 @@ class fenrir():
print(shortcut)
command = self.environment['runtime']['inputManager'].getCommandForShortcut(shortcut)
self.environment['runtime']['commandManager'].queueCommand(command)
self.wasCommand = command != ''
if self.currShortcutLenght < len(self.environment['input']['currInput']):
self.wasCommand = command != ''
self.currShortcutLenght = len(self.environment['input']['currInput'])
def handleCommands(self):
if time.time() - self.environment['commandInfo']['lastCommandExecutionTime'] < 0.2:
return

View File

@ -52,8 +52,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()}