Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
afcdc4f4
Commit
afcdc4f4
authored
Jun 15, 2006
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add timing
parent
06a401f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
recorder.pl
VisualNaCro/recorder.pl
+23
-1
No files found.
VisualNaCro/recorder.pl
View file @
afcdc4f4
...
@@ -9,10 +9,12 @@ $output="my_script";
...
@@ -9,10 +9,12 @@ $output="my_script";
$server
=
"localhost"
;
$server
=
"localhost"
;
$port
=
5900
;
$port
=
5900
;
$listen_port
=
5923
;
$listen_port
=
5923
;
$timing
=
0
;
if
(
!
GetOptions
(
if
(
!
GetOptions
(
"script:s"
=>
\
$output
,
"script:s"
=>
\
$output
,
"listen:i"
=>
\
$listen_port
"listen:i"
=>
\
$listen_port
,
"timing"
=>
\
$timing
)
||
$#ARGV
!=
0
)
{
)
||
$#ARGV
!=
0
)
{
print
STDERR
"Usage: $ARGV0 [--script output_name] [--listen listen_port] server[:port]\n"
;
print
STDERR
"Usage: $ARGV0 [--script output_name] [--listen listen_port] server[:port]\n"
;
exit
2
;
exit
2
;
...
@@ -20,6 +22,11 @@ if(!GetOptions(
...
@@ -20,6 +22,11 @@ if(!GetOptions(
$output
=~
s/\.pl$//
;
$output
=~
s/\.pl$//
;
if
(
$timing
)
{
use
Time::
HiRes
qw(time)
;
$starttime
=-
1
;
}
$server
=
$ARGV
[
0
];
$server
=
$ARGV
[
0
];
if
(
$server
=~
/^(.*):(\d+)$/
)
{
if
(
$server
=~
/^(.*):(\d+)$/
)
{
...
@@ -55,6 +62,9 @@ open OUT, ">$output.pl";
...
@@ -55,6 +62,9 @@ open OUT, ">$output.pl";
print
OUT
"#!/usr/bin/perl\n"
;
print
OUT
"#!/usr/bin/perl\n"
;
print
OUT
"\n"
;
print
OUT
"\n"
;
print
OUT
"use nacro;\n"
;
print
OUT
"use nacro;\n"
;
if
(
$timing
)
{
print
OUT
"use Time::HiRes;"
}
print
OUT
"\n"
;
print
OUT
"\n"
;
print
OUT
"\$x_origin=0; \$y_origin=0;\n"
;
print
OUT
"\$x_origin=0; \$y_origin=0;\n"
;
print
OUT
"\$vnc=nacro::initvnc(\"$server\",$port,$listen_port);\n"
;
print
OUT
"\$vnc=nacro::initvnc(\"$server\",$port,$listen_port);\n"
;
...
@@ -64,6 +74,16 @@ $image_counter=1;
...
@@ -64,6 +74,16 @@ $image_counter=1;
$magickey
=
0
;
$magickey
=
0
;
$x_origin
=
0
;
$y_origin
=
0
;
$x_origin
=
0
;
$y_origin
=
0
;
sub
writetiming
()
{
if
(
$timing
)
{
$now
=
time
();
if
(
$starttime
>
0
)
{
print
OUT
"nacro::process(\$vnc,"
.
(
$now
-
$starttime
)
.
");\n"
;
}
$starttime
=
$now
;
}
}
while
(
1
)
{
while
(
1
)
{
$result
=
nacro::
waitforinput
(
$vnc
,
999999
);
$result
=
nacro::
waitforinput
(
$vnc
,
999999
);
if
(
$result
==
0
)
{
if
(
$result
==
0
)
{
...
@@ -77,6 +97,7 @@ while(1) {
...
@@ -77,6 +97,7 @@ while(1) {
$keysym
=
nacro::
getkeysym
(
$vnc
);
$keysym
=
nacro::
getkeysym
(
$vnc
);
$keydown
=
nacro::
getkeydown
(
$vnc
);
$keydown
=
nacro::
getkeydown
(
$vnc
);
if
(
nacro::
sendkey
(
$vnc
,
$keysym
,
$keydown
))
{
if
(
nacro::
sendkey
(
$vnc
,
$keysym
,
$keydown
))
{
writetiming
();
print
OUT
"nacro::sendkey(\$vnc,$keysym,$keydown);\n"
;
print
OUT
"nacro::sendkey(\$vnc,$keysym,$keydown);\n"
;
}
}
if
(
$keysym
==
0xffe3
||
$keysym
==
0xffe4
)
{
if
(
$keysym
==
0xffe3
||
$keysym
==
0xffe4
)
{
...
@@ -98,6 +119,7 @@ while(1) {
...
@@ -98,6 +119,7 @@ while(1) {
$buttons
=
nacro::
getbuttons
(
$vnc
);
$buttons
=
nacro::
getbuttons
(
$vnc
);
if
(
nacro::
sendmouse
(
$vnc
,
$x
,
$y
,
$buttons
))
{
if
(
nacro::
sendmouse
(
$vnc
,
$x
,
$y
,
$buttons
))
{
$x
-=
$x_origin
;
$y
-=
$y_origin
;
$x
-=
$x_origin
;
$y
-=
$y_origin
;
writetiming
();
print
OUT
"nacro::sendmouse(\$vnc,\$x_origin"
print
OUT
"nacro::sendmouse(\$vnc,\$x_origin"
.
(
$x
>=
0
?
"+"
:
""
)
.
"$x,\$y_origin"
.
(
$x
>=
0
?
"+"
:
""
)
.
"$x,\$y_origin"
.
(
$y
>=
0
?
"+"
:
""
)
.
"$y,$buttons);\n"
;
.
(
$y
>=
0
?
"+"
:
""
)
.
"$y,$buttons);\n"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment