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