add right click
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import time
|
||||
import logging
|
||||
import struct
|
||||
from screeninfo import get_monitors
|
||||
@@ -135,6 +136,7 @@ def read_finger(args, remote_device):
|
||||
|
||||
last_x = 0
|
||||
last_y = 0
|
||||
|
||||
while True:
|
||||
_, _, e_type, e_code, e_value = struct.unpack('2IHHi', remote_device.read(16))
|
||||
|
||||
@@ -145,6 +147,8 @@ def read_finger(args, remote_device):
|
||||
log.debug(e_value)
|
||||
|
||||
if rel_orig_x == -1:
|
||||
print("test")
|
||||
t_mv_start = time.time();
|
||||
rel_orig_x = e_value
|
||||
|
||||
x = e_value
|
||||
@@ -163,8 +167,13 @@ def read_finger(args, remote_device):
|
||||
if e_code == evcode_finger_mv_id:
|
||||
if e_value == -1:
|
||||
if rel_orig_x == x and rel_orig_y == y:
|
||||
mouse.press(Button.left)
|
||||
mouse.release(Button.left)
|
||||
print(time.time() - t_mv_start)
|
||||
if (time.time() - t_mv_start) < 0.5:
|
||||
mouse.press(Button.left)
|
||||
mouse.release(Button.left)
|
||||
else:
|
||||
mouse.press(Button.right)
|
||||
mouse.release(Button.right)
|
||||
rel_orig_x = -1
|
||||
rel_orig_y = -1
|
||||
last_x = 0
|
||||
|
||||
Reference in New Issue
Block a user