fill numlock, scroll and capslock state information
This commit is contained in:
parent
58075e05d4
commit
b588957fb0
@ -13,6 +13,8 @@ input = {
|
||||
'lastInputTime':time.time(),
|
||||
'oldNumLock': True,
|
||||
'newNumLock':True,
|
||||
'oldScrollLock': True,
|
||||
'newScrollLock':True,
|
||||
'oldCapsLock':False,
|
||||
'newCapsLock':False
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ class inputManager():
|
||||
environment['runtime']['inputDriver'].shutdown(environment)
|
||||
|
||||
def proceedInputEvent(self, environment):
|
||||
|
||||
timeout = True
|
||||
event = environment['runtime']['inputDriver'].getInput(environment)
|
||||
mEvent = environment['runtime']['inputDriver'].mapEvent(environment, event)
|
||||
@ -41,7 +42,12 @@ class inputManager():
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
print(environment['input']['currInput'])
|
||||
environment['input']['oldNumLock'] = environment['input']['newNumLock']
|
||||
environment['input']['newNumLock'] = environment['runtime']['inputDriver'].getNumlock(environment)
|
||||
environment['input']['oldCapsLock'] = environment['input']['newCapsLock']
|
||||
environment['input']['newCapsLock'] = environment['runtime']['inputDriver'].getCapslock(environment)
|
||||
environment['input']['oldScrollLock'] = environment['input']['newScrollLock']
|
||||
environment['input']['newScrollLock'] = environment['runtime']['inputDriver'].getScrollLock(environment)
|
||||
environment['input']['lastInputTime'] = time.time()
|
||||
environment['input']['shortcutRepeat'] = 1
|
||||
return timeout
|
||||
|
@ -12,9 +12,10 @@ class driver():
|
||||
def __init__(self):
|
||||
self.iDevices = {}
|
||||
self.uDevices = {}
|
||||
self.getInputDevices()
|
||||
self.ledDevices = {}
|
||||
|
||||
def initialize(self, environment):
|
||||
pass
|
||||
self.getInputDevices()
|
||||
def shutdown(self, environment):
|
||||
pass
|
||||
def getInput(self, environment):
|
||||
@ -31,8 +32,15 @@ class driver():
|
||||
uDevice.syn()
|
||||
|
||||
def getInputDevices(self):
|
||||
# 3 pos absolute
|
||||
# 2 pos relative
|
||||
# 17 LEDs
|
||||
# 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()}
|
||||
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.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()}
|
||||
|
||||
def mapEvent(self,environment, event):
|
||||
if not event:
|
||||
@ -49,6 +57,33 @@ class driver():
|
||||
print(e)
|
||||
return None
|
||||
|
||||
def getNumlock(self,environment):
|
||||
if self.ledDevices == {}:
|
||||
return True
|
||||
if self.ledDevices == None:
|
||||
return True
|
||||
for fd, dev in self.ledDevices.items():
|
||||
return 0 in dev.leds()
|
||||
return True
|
||||
|
||||
def getCapslock(self,environment):
|
||||
if self.ledDevices == {}:
|
||||
return False
|
||||
if self.ledDevices == None:
|
||||
return False
|
||||
for fd, dev in self.ledDevices.items():
|
||||
return 1 in dev.leds()
|
||||
return False
|
||||
|
||||
def getScrollLock(self,environment):
|
||||
if self.ledDevices == {}:
|
||||
return False
|
||||
if self.ledDevices == None:
|
||||
return False
|
||||
for fd, dev in self.ledDevices.items():
|
||||
return 2 in dev.leds()
|
||||
return False
|
||||
|
||||
def grabDevices(self):
|
||||
for fd in self.iDevices:
|
||||
dev = self.iDevices[fd]
|
||||
|
Loading…
Reference in New Issue
Block a user