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): def convertEventName(self, eventName):
if not eventName: if not eventName:
return '' return ''
print(eventName)
if eventName == 'KEY_LEFTCTRL': if eventName == 'KEY_LEFTCTRL':
eventName = 'KEY_CTRL' eventName = 'KEY_CTRL'

View File

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

View File

@ -52,8 +52,8 @@ class driver():
# 1 Keys # 1 Keys
# we try to filter out mices and other stuff here # we try to filter out mices and other stuff here
self.iDevices = map(evdev.InputDevice, (evdev.list_devices())) 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() 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()}
self.ledDevices = map(evdev.InputDevice, (evdev.list_devices())) 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()} 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()}