add double tap detection

This commit is contained in:
chrys 2016-09-27 23:52:46 +02:00
parent f67ada9a05
commit d8c597c83f

View File

@ -40,14 +40,18 @@ class inputManager():
if len(self.env['input']['currInput']) > 1: if len(self.env['input']['currInput']) > 1:
self.env['input']['currInput'] = sorted(self.env['input']['currInput']) self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
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
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'])
if len(self.env['input']['currInput']) > 1: if len(self.env['input']['currInput']) > 1:
self.env['input']['currInput'] = sorted(self.env['input']['currInput']) self.env['input']['currInput'] = sorted(self.env['input']['currInput'])
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']:
self.env['input']['shortcutRepeat'] += 1
elif mEvent['EventState'] == 2: elif mEvent['EventState'] == 2:
pass pass
else: else:
@ -59,7 +63,6 @@ class inputManager():
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() self.env['input']['lastInputTime'] = time.time()
self.env['input']['shortcutRepeat'] = 1
return eventReceived return eventReceived
def grabDevices(self): def grabDevices(self):