From 944cdb890380d7076340ce52a22ac35fee5db205 Mon Sep 17 00:00:00 2001 From: Ketan Date: Fri, 31 Jul 2026 16:46:03 -0400 Subject: [PATCH] revert 0e78b6b9b3b892a69821a14119cf58897c1aca25 revert Update client.py --- client.py | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/client.py b/client.py index 0b3ef22..ac1c360 100644 --- a/client.py +++ b/client.py @@ -1,39 +1,25 @@ import socket -import time -from evdev import UInput, ecodes as e +from pynput.mouse import Controller -# Create a virtual mouse device -ui = UInput( - { - e.EV_REL: [e.REL_X, e.REL_Y], - e.EV_KEY: [e.BTN_LEFT, e.BTN_RIGHT] - }, - name='virtual-mouse' -) +mouse = Controller() -HOST = '0.0.0.0' +HOST = '0.0.0.0' PORT = 2025 sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.bind((HOST, PORT)) -print(f"Listening on {HOST}:{PORT}") +print(f"listening on {HOST}:{PORT}") try: while True: data, addr = sock.recvfrom(1024) x_str, y_str = data.decode().split(',') - dx = int(float(x_str)) - dy = int(float(y_str)) - - # Note: uinput typically handles relative motion (REL_X / REL_Y) - ui.write(e.EV_REL, e.REL_X, dx) - ui.write(e.EV_REL, e.REL_Y, dy) - ui.syn() - - print(f"Moved mouse relative: dX={dx}, dY={dy}") + x = float(x_str) + y = float(y_str) + mouse.position = (x, y) + print(f"Moved mouse to: X={x}, Y={y}") except KeyboardInterrupt: - print("\nUDP server shutting down.") + print("UDP server shutting down.") finally: - ui.close() sock.close() \ No newline at end of file