summaryrefslogtreecommitdiffstats
path: root/VisualNaCro
diff options
context:
space:
mode:
Diffstat (limited to 'VisualNaCro')
-rw-r--r--VisualNaCro/ChangeLog8
-rw-r--r--VisualNaCro/recorder.pl41
2 files changed, 40 insertions, 9 deletions
diff --git a/VisualNaCro/ChangeLog b/VisualNaCro/ChangeLog
index 9f22e04..c0bd61e 100644
--- a/VisualNaCro/ChangeLog
+++ b/VisualNaCro/ChangeLog
@@ -1,3 +1,11 @@
+2006-10-10: Johannes Schindelin <Johannes.Schindelin@gmx.de>
+ * implement --compact and --compact-dragging to shut up the
+ script about mouse movements or drags.
+
+2006-09-12: Johannes Schindelin <Johannes.Schindelin@gmx.de>
+ * the reference rectangle is selected with a rubber band,
+ and can be shown with 'd'.
+
2006-06-15: Johannes Schindelin <Johannes.Schindelin@gmx.de>
* added timing: you can record the events with their timestamps now
diff --git a/VisualNaCro/recorder.pl b/VisualNaCro/recorder.pl
index f138392..d83551e 100644
--- a/VisualNaCro/recorder.pl
+++ b/VisualNaCro/recorder.pl
@@ -3,22 +3,24 @@
use Getopt::Long;
use nacro;
-# TODO: take options
-
$output="my_script";
$server="localhost";
$port=5900;
$listen_port=5923;
$timing=0;
$symbolic=0;
+$compact=0;
+$compact_dragging=0;
if(!GetOptions(
"script:s" => \$output,
"listen:i" => \$listen_port,
"timing" => \$timing,
"symbolic" => \$symbolic,
+ "compact" => \$compact,
+ "compact-dragging" => \$compact_dragging,
) || $#ARGV!=0) {
- print STDERR "Usage: $ARGV0 [--script output_name] [--listen listen_port] [--timing] [--symbolic] server[:port]\n";
+ print STDERR "Usage: $ARGV0 [--script output_name] [--listen listen_port] [--timing]\n\t[--symbolic] [--compact] [--compact-dragging] server[:port]\n";
exit 2;
}
@@ -91,6 +93,21 @@ sub writetiming () {
}
}
+$last_button = -1;
+
+sub handle_mouse {
+ my $x = shift;
+ my $y = shift;
+ my $buttons = shift;
+ if(nacro::sendmouse($vnc,$x,$y,$buttons)) {
+ $x-=$x_origin; $y-=$y_origin;
+ writetiming();
+ print OUT "nacro::sendmouse(\$vnc,\$x_origin"
+ . ($x>=0?"+":"")."$x,\$y_origin"
+ . ($y>=0?"+":"")."$y,$buttons);\n";
+ }
+}
+
while(1) {
$result=nacro::waitforinput($vnc,999999);
if($result==0) {
@@ -129,13 +146,18 @@ while(1) {
$x=nacro::getx($vnc);
$y=nacro::gety($vnc);
$buttons=nacro::getbuttons($vnc);
- if(nacro::sendmouse($vnc,$x,$y,$buttons)) {
- $x-=$x_origin; $y-=$y_origin;
- writetiming();
- print OUT "nacro::sendmouse(\$vnc,\$x_origin"
- . ($x>=0?"+":"")."$x,\$y_origin"
- . ($y>=0?"+":"")."$y,$buttons);\n";
+ if ($buttons != $last_buttons) {
+ if (!$buttons && $compact_dragging) {
+ handle_mouse($x, $y, $last_buttons);
+ }
+ $last_buttons = $buttons;
+ } else {
+ if (($buttons && $compact_dragging) ||
+ (!$buttons && $compact)) {
+ next;
+ }
}
+ handle_mouse($x, $y, $buttons);
}
if ($result & $nacro::RESULT_TEXT_CLIENT) {
my $text = nacro::gettext_client($vnc);
@@ -188,6 +210,7 @@ while(1) {
$x=nacro::getx($vnc);
$y=nacro::gety($vnc);
if($start_x==$x && $start_y==$y) {
+ # reset
print OUT "\$x_origin=0; \$y_origin=0;\n";
} else {
if($start_x>$x) {