respect doubleTapDelay

This commit is contained in:
chrys 2016-10-13 00:05:05 +02:00
parent d7d3133b10
commit c80e93abab

View File

@ -42,6 +42,7 @@ class inputManager():
if len(self.env['input']['currInput']) == 0: if len(self.env['input']['currInput']) == 0:
self.env['input']['prevDeepestInput'] = [] self.env['input']['prevDeepestInput'] = []
self.env['input']['shortcutRepeat'] = 1 self.env['input']['shortcutRepeat'] = 1
self.env['input']['lastInputTime'] = time.time()
elif mEvent['EventState'] == 1: elif mEvent['EventState'] == 1:
if not mEvent['EventName'] in self.env['input']['currInput']: if not mEvent['EventName'] in self.env['input']['currInput']:
self.env['input']['currInput'].append(mEvent['EventName']) self.env['input']['currInput'].append(mEvent['EventName'])
@ -50,8 +51,11 @@ class inputManager():
if len(self.env['input']['prevDeepestInput']) < len(self.env['input']['currInput']): if len(self.env['input']['prevDeepestInput']) < len(self.env['input']['currInput']):
self.env['input']['prevDeepestInput'] = self.env['input']['currInput'].copy() self.env['input']['prevDeepestInput'] = self.env['input']['currInput'].copy()
elif self.env['input']['prevDeepestInput'] == self.env['input']['currInput']: elif self.env['input']['prevDeepestInput'] == self.env['input']['currInput']:
if time.time() - self.env['input']['lastInputTime'] <= self.env['runtime']['settingsManager'].getSettingAsFloat('keyboard','doubleTapDelay'):
self.env['input']['shortcutRepeat'] += 1 self.env['input']['shortcutRepeat'] += 1
else:
self.env['input']['shortcutRepeat'] = 1
self.env['input']['lastInputTime'] = time.time()
elif mEvent['EventState'] == 2: elif mEvent['EventState'] == 2:
pass pass
else: else:
@ -62,7 +66,7 @@ class inputManager():
self.env['input']['newCapsLock'] = self.env['runtime']['inputDriver'].getCapslock() self.env['input']['newCapsLock'] = self.env['runtime']['inputDriver'].getCapslock()
self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock'] self.env['input']['oldScrollLock'] = self.env['input']['newScrollLock']
self.env['input']['newScrollLock'] = self.env['runtime']['inputDriver'].getScrollLock() self.env['input']['newScrollLock'] = self.env['runtime']['inputDriver'].getScrollLock()
self.env['input']['lastInputTime'] = time.time()
return eventReceived return eventReceived
def grabDevices(self): def grabDevices(self):