improve input handling
This commit is contained in:
parent
6bf4098074
commit
204e9423ff
@ -68,8 +68,10 @@ class inputManager():
|
||||
def convertEventName(self, eventName):
|
||||
if not eventName:
|
||||
return ''
|
||||
print(eventName)
|
||||
|
||||
if eventName == 'KEY_LEFTCTRL':
|
||||
eventName == 'KEY_CTRL'
|
||||
eventName = 'KEY_CTRL'
|
||||
elif eventName == 'KEY_RIGHTCTRL':
|
||||
eventName = 'KEY_CTRL'
|
||||
elif eventName == 'KEY_LEFTSHIFT':
|
||||
@ -80,6 +82,10 @@ class inputManager():
|
||||
eventName = 'KEY_ALT'
|
||||
elif eventName == 'KEY_RIGHTALT':
|
||||
eventName = 'KEY_ALT'
|
||||
elif eventName == 'KEY_LEFTMETA':
|
||||
eventName = 'KEY_META'
|
||||
elif eventName == 'KEY_RIGHTMETA':
|
||||
eventName = 'KEY_META'
|
||||
if self.isFenrirKey(eventName):
|
||||
eventName = 'KEY_FENRIR'
|
||||
return eventName
|
||||
@ -97,6 +103,8 @@ class inputManager():
|
||||
def writeEventBuffer(self):
|
||||
try:
|
||||
self.env['runtime']['inputDriver'].writeEventBuffer()
|
||||
time.sleep(0.005)
|
||||
self.clearEventBuffer()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self.env['runtime']['debug'].writeDebugOut("Error while writeUInput",debug.debugLevel.ERROR)
|
||||
|
@ -44,7 +44,7 @@ class fenrir():
|
||||
if not self.wasCommand:
|
||||
self.environment['runtime']['inputManager'].writeEventBuffer()
|
||||
if self.wasCommand:
|
||||
if not self.environment['runtime']['inputManager'].noKeyPressed():
|
||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||
self.wasCommand = False
|
||||
self.environment['runtime']['inputManager'].clearEventBuffer()
|
||||
if self.environment['runtime']['inputManager'].noKeyPressed():
|
||||
@ -70,9 +70,10 @@ class fenrir():
|
||||
if self.environment['input']['keyForeward']:
|
||||
return
|
||||
shortcut = self.environment['runtime']['inputManager'].getCurrShortcut()
|
||||
print(shortcut)
|
||||
command = self.environment['runtime']['inputManager'].getCommandForShortcut(shortcut)
|
||||
self.environment['runtime']['commandManager'].queueCommand(command)
|
||||
self.wasCommand = command != ''
|
||||
self.wasCommand = command != ''
|
||||
|
||||
def handleCommands(self):
|
||||
if time.time() - self.environment['commandInfo']['lastCommandExecutionTime'] < 0.2:
|
||||
|
@ -37,7 +37,6 @@ class driver():
|
||||
def writeEventBuffer(self):
|
||||
for iDevice, uDevice, event in self.env['input']['eventBuffer']:
|
||||
self.writeUInput(uDevice, event)
|
||||
self.clearEventBuffer()
|
||||
|
||||
def clearEventBuffer(self):
|
||||
del self.env['input']['eventBuffer'][:]
|
||||
@ -53,7 +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() 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()}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user