From 0f0360994f931e81eccc28720f4e7b5963d29e3f Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 19 Sep 2010 21:52:03 +0200 Subject: [PATCH] send mouse move and click using xdotool --- premotedroid-server.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/premotedroid-server.pl b/premotedroid-server.pl index 0d7c6b0..c0cbd2f 100755 --- a/premotedroid-server.pl +++ b/premotedroid-server.pl @@ -36,6 +36,9 @@ use constant SCREEN_CAPTURE_RESPONSE => 7; use constant FILE_EXPLORE_REQUEST => 8; use constant FILE_EXPLORE_RESPONSE => 9; +open(my $xdo, '|-', 'xdotool -') || die $!; +select($xdo); $|=1; + while ( my $client = $sock->accept() ) { warn "connect from ", dump $client->peeraddr, $client->peerport; @@ -47,10 +50,12 @@ while ( my $client = $sock->accept() ) { read $client, my $move, 4; my ( $x, $y ) = unpack 's>s>', $move; # big-endian 16 bit warn "MOVE $x $y\n"; + print $xdo "mousemove_relative -- $x $y\n"; } elsif ( $command == MOUSE_CLICK ) { read $client, my $b, 2; my ( $button, $state ) = unpack 'cc', $b; warn "MOUSE_CLICK $button $state\n"; + print $xdo 'mouse' . ( $state ? 'down' : 'up' ) . ' ' . $button . "\n"; } elsif ( $command == MOUSE_WHEEL ) { read $client, my $amount, 1; $amount = unpack 'c', $amount; -- 2.20.1