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
ff9c0be8
Commit
ff9c0be8
authored
Sep 12, 2006
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VisualNaCro: support clipboard and symbolic key names with X11::Keysyms
parent
87a4c9be
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
31 deletions
+84
-31
AUTHORS
AUTHORS
+1
-1
NEWS
VisualNaCro/NEWS
+4
-0
nacro.c
VisualNaCro/nacro.c
+29
-16
nacro.h
VisualNaCro/nacro.h
+13
-9
recorder.pl
VisualNaCro/recorder.pl
+37
-5
No files found.
AUTHORS
View file @
ff9c0be8
...
@@ -29,7 +29,7 @@ Oliver Mihatsch, Greg Sternberg, Werner Hofer, Giampiero Giancipoli,
...
@@ -29,7 +29,7 @@ Oliver Mihatsch, Greg Sternberg, Werner Hofer, Giampiero Giancipoli,
Glenn Mabutt, Paul Kreiner, Erik Kunze, Mike Frysinger, Martin Waitz,
Glenn Mabutt, Paul Kreiner, Erik Kunze, Mike Frysinger, Martin Waitz,
Mark McLoughlin, Paul Fox, Juan Jose Costello, Andre Leiadella,
Mark McLoughlin, Paul Fox, Juan Jose Costello, Andre Leiadella,
Alberto Lusiani, Malvina Mazin, Dave Stuart, Rohit Kumar, Donald Dugger,
Alberto Lusiani, Malvina Mazin, Dave Stuart, Rohit Kumar, Donald Dugger,
and Steven Car
r.
Steven Carr, and Uwe Völk
er.
Probably I forgot quite a few people sending a patch here and there, which
Probably I forgot quite a few people sending a patch here and there, which
really made a difference. Without those, some obscure bugs still would
really made a difference. Without those, some obscure bugs still would
...
...
VisualNaCro/NEWS
View file @
ff9c0be8
...
@@ -2,3 +2,7 @@ With --timing, you can actually record action scripts which are meaningful...
...
@@ -2,3 +2,7 @@ With --timing, you can actually record action scripts which are meaningful...
Earlier, the events just got garbled, because the GUI could not react as
Earlier, the events just got garbled, because the GUI could not react as
fast as the events were churned out.
fast as the events were churned out.
Clipboard is supported (thanks to Uwe).
Keys are recorded by their symbols with the --symbolic switch, provided you
have the X11::Keysyms module.
VisualNaCro/nacro.c
View file @
ff9c0be8
...
@@ -23,7 +23,8 @@ typedef struct private_resource_t {
...
@@ -23,7 +23,8 @@ typedef struct private_resource_t {
int
x
,
y
;
int
x
,
y
;
int
buttons
;
int
buttons
;
char
*
text
;
char
*
text_client
;
char
*
text_server
;
image_t
*
grep_image
;
image_t
*
grep_image
;
int
x_origin
,
y_origin
;
int
x_origin
,
y_origin
;
...
@@ -94,24 +95,20 @@ static void got_text(char* str,int len,rfbClientRec* cl)
...
@@ -94,24 +95,20 @@ static void got_text(char* str,int len,rfbClientRec* cl)
{
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
screen
->
screenData
;
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
screen
->
screenData
;
SendClientCutText
(
res
->
client
,
str
,
len
);
if
(
res
->
text_client
)
free
(
res
->
text_client
);
if
(
res
->
text
)
res
->
text_client
=
strdup
(
str
);
free
(
res
->
text
);
res
->
result
|=
RESULT_TEXT_CLIENT
;
res
->
text
=
strdup
(
str
);
res
->
result
|=
RESULT_TEXT
;
}
}
static
void
got_text_from_server
(
rfbClient
*
cl
,
const
char
*
str
,
int
textlen
)
static
void
got_text_from_server
(
rfbClient
*
cl
,
const
char
*
str
,
int
textlen
)
{
{
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
clientData
;
private_resource_t
*
res
=
(
private_resource_t
*
)
cl
->
clientData
;
rfbSendServerCutText
(
res
->
server
,
(
char
*
)
str
,
textlen
);
if
(
res
->
text_server
)
free
(
res
->
text_server
);
if
(
res
->
text
)
res
->
text_server
=
strdup
(
str
);
free
(
res
->
text
);
res
->
result
|=
RESULT_TEXT_SERVER
;
res
->
text
=
strdup
(
str
);
res
->
result
|=
RESULT_TEXT
;
}
}
static
rfbBool
malloc_frame_buffer
(
rfbClient
*
cl
)
static
rfbBool
malloc_frame_buffer
(
rfbClient
*
cl
)
...
@@ -203,7 +200,8 @@ resource_t initvnc(const char* server,int server_port,int listen_port)
...
@@ -203,7 +200,8 @@ resource_t initvnc(const char* server,int server_port,int listen_port)
/* remember for later */
/* remember for later */
res
->
listen_port
=
listen_port
;
res
->
listen_port
=
listen_port
;
res
->
text
=
NULL
;
res
->
text_client
=
NULL
;
res
->
text_server
=
NULL
;
res
->
client
=
rfbGetClient
(
8
,
3
,
4
);
res
->
client
=
rfbGetClient
(
8
,
3
,
4
);
res
->
client
->
clientData
=
(
void
*
)
res
;
res
->
client
->
clientData
=
(
void
*
)
res
;
...
@@ -571,10 +569,16 @@ buttons_t getbuttons(resource_t res)
...
@@ -571,10 +569,16 @@ buttons_t getbuttons(resource_t res)
return
r
->
buttons
;
return
r
->
buttons
;
}
}
const
char
*
gettext
(
resource_t
res
)
const
char
*
gettext_client
(
resource_t
res
)
{
private_resource_t
*
r
=
get_resource
(
res
);
return
r
->
text_client
;
}
const
char
*
gettext_server
(
resource_t
res
)
{
{
private_resource_t
*
r
=
get_resource
(
res
);
private_resource_t
*
r
=
get_resource
(
res
);
return
r
->
text
;
return
r
->
text
_server
;
}
}
/* send events to the server */
/* send events to the server */
...
@@ -603,6 +607,15 @@ bool_t sendtext(resource_t res, const char *string)
...
@@ -603,6 +607,15 @@ bool_t sendtext(resource_t res, const char *string)
return
SendClientCutText
(
r
->
client
,
(
char
*
)
string
,
(
int
)
strlen
(
string
));
return
SendClientCutText
(
r
->
client
,
(
char
*
)
string
,
(
int
)
strlen
(
string
));
}
}
bool_t
sendtext_to_server
(
resource_t
res
,
const
char
*
string
)
{
private_resource_t
*
r
=
get_resource
(
res
);
if
(
r
==
NULL
)
return
0
;
rfbSendServerCutText
(
r
->
server
,
(
char
*
)
string
,
(
int
)
strlen
(
string
));
return
1
;
}
/* for visual grepping */
/* for visual grepping */
coordinate_t
getxorigin
(
resource_t
res
)
coordinate_t
getxorigin
(
resource_t
res
)
...
...
VisualNaCro/nacro.h
View file @
ff9c0be8
...
@@ -32,10 +32,11 @@ typedef int result_t;
...
@@ -32,10 +32,11 @@ typedef int result_t;
%constant int RESULT_TIMEOUT=1;
%constant int RESULT_TIMEOUT=1;
%constant int RESULT_KEY=2;
%constant int RESULT_KEY=2;
%constant int RESULT_MOUSE=4;
%constant int RESULT_MOUSE=4;
%constant int RESULT_TEXT=8
%constant int RESULT_TEXT_CLIENT=8;
%constant int RESULT_SCREEN=16;
%constant int RESULT_TEXT_CLIENT=16;
%constant int RESULT_FOUNDIMAGE=32;
%constant int RESULT_SCREEN=32;
%constant int RESULT_SHUTDOWN=64;
%constant int RESULT_FOUNDIMAGE=64;
%constant int RESULT_SHUTDOWN=128;
*/
*/
%
}
%
}
...
@@ -52,10 +53,11 @@ typedef int result_t;
...
@@ -52,10 +53,11 @@ typedef int result_t;
#define RESULT_TIMEOUT 1
#define RESULT_TIMEOUT 1
#define RESULT_KEY 2
#define RESULT_KEY 2
#define RESULT_MOUSE 4
#define RESULT_MOUSE 4
#define RESULT_TEXT 8
#define RESULT_TEXT_CLIENT 8
#define RESULT_SCREEN 16
#define RESULT_TEXT_SERVER 16
#define RESULT_FOUNDIMAGE 32
#define RESULT_SCREEN 32
#define RESULT_SHUTDOWN 64
#define RESULT_FOUNDIMAGE 64
#define RESULT_SHUTDOWN 128
/* init/shutdown */
/* init/shutdown */
...
@@ -86,13 +88,15 @@ coordinate_t getx(resource_t res);
...
@@ -86,13 +88,15 @@ coordinate_t getx(resource_t res);
coordinate_t
gety
(
resource_t
res
);
coordinate_t
gety
(
resource_t
res
);
buttons_t
getbuttons
(
resource_t
res
);
buttons_t
getbuttons
(
resource_t
res
);
const
char
*
gettext
(
resource_t
res
);
const
char
*
gettext_client
(
resource_t
res
);
const
char
*
gettext_server
(
resource_t
res
);
/* send events to the server */
/* send events to the server */
bool_t
sendkey
(
resource_t
res
,
keysym_t
keysym
,
bool_t
keydown
);
bool_t
sendkey
(
resource_t
res
,
keysym_t
keysym
,
bool_t
keydown
);
bool_t
sendmouse
(
resource_t
res
,
coordinate_t
x
,
coordinate_t
y
,
buttons_t
buttons
);
bool_t
sendmouse
(
resource_t
res
,
coordinate_t
x
,
coordinate_t
y
,
buttons_t
buttons
);
bool_t
sendtext
(
resource_t
res
,
const
char
*
string
);
bool_t
sendtext
(
resource_t
res
,
const
char
*
string
);
bool_t
sendtext_to_server
(
resource_t
res
,
const
char
*
string
);
/* for visual grepping */
/* for visual grepping */
...
...
VisualNaCro/recorder.pl
View file @
ff9c0be8
...
@@ -10,23 +10,32 @@ $server="localhost";
...
@@ -10,23 +10,32 @@ $server="localhost";
$port
=
5900
;
$port
=
5900
;
$listen_port
=
5923
;
$listen_port
=
5923
;
$timing
=
0
;
$timing
=
0
;
$symbolic
=
0
;
if
(
!
GetOptions
(
if
(
!
GetOptions
(
"script:s"
=>
\
$output
,
"script:s"
=>
\
$output
,
"listen:i"
=>
\
$listen_port
,
"listen:i"
=>
\
$listen_port
,
"timing"
=>
\
$timing
"timing"
=>
\
$timing
,
"symbolic"
=>
\
$symbolic
,
)
||
$#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]
[--timing] [--symbolic]
server[:port]\n"
;
exit
2
;
exit
2
;
}
}
$output
=~
s/\.pl$//
;
$output
=~
s/\.pl$//
;
if
(
$timing
)
{
if
(
$timing
)
{
use
Time::
HiRes
qw(time)
;
eval
'use Time::HiRes'
;
$timing
=
0
if
$@
;
$starttime
=-
1
;
$starttime
=-
1
;
}
}
if
(
$symbolic
)
{
eval
'use X11::Keysyms qw(%Keysyms)'
;
$symbolic
=
0
if
$@
;
%
sym_name
=
reverse
%
Keysyms
;
}
$server
=
$ARGV
[
0
];
$server
=
$ARGV
[
0
];
if
(
$server
=~
/^(.*):(\d+)$/
)
{
if
(
$server
=~
/^(.*):(\d+)$/
)
{
...
@@ -59,6 +68,9 @@ if($vnc<0) {
...
@@ -59,6 +68,9 @@ if($vnc<0) {
open
OUT
,
">$output.pl"
;
open
OUT
,
">$output.pl"
;
print
OUT
"#!/usr/bin/perl\n"
;
print
OUT
"#!/usr/bin/perl\n"
;
print
OUT
"\n"
;
print
OUT
"\n"
;
if
(
$symbolic
)
{
print
OUT
"use X11::Keysyms qw(\%sym);\n"
;
}
print
OUT
"use nacro;\n"
;
print
OUT
"use nacro;\n"
;
print
OUT
"\n"
;
print
OUT
"\n"
;
print
OUT
"\$x_origin=0; \$y_origin=0;\n"
;
print
OUT
"\$x_origin=0; \$y_origin=0;\n"
;
...
@@ -71,7 +83,7 @@ $x_origin=0; $y_origin=0;
...
@@ -71,7 +83,7 @@ $x_origin=0; $y_origin=0;
sub
writetiming
()
{
sub
writetiming
()
{
if
(
$timing
)
{
if
(
$timing
)
{
$now
=
time
();
$now
=
Time::HiRes::
time
();
if
(
$starttime
>
0
)
{
if
(
$starttime
>
0
)
{
print
OUT
"nacro::process(\$vnc,"
.
(
$now
-
$starttime
)
.
");\n"
;
print
OUT
"nacro::process(\$vnc,"
.
(
$now
-
$starttime
)
.
");\n"
;
}
}
...
@@ -93,7 +105,11 @@ while(1) {
...
@@ -93,7 +105,11 @@ while(1) {
$keydown
=
nacro::
getkeydown
(
$vnc
);
$keydown
=
nacro::
getkeydown
(
$vnc
);
if
(
nacro::
sendkey
(
$vnc
,
$keysym
,
$keydown
))
{
if
(
nacro::
sendkey
(
$vnc
,
$keysym
,
$keydown
))
{
writetiming
();
writetiming
();
print
OUT
"nacro::sendkey(\$vnc,$keysym,$keydown);\n"
;
if
(
$symbolic
and
exists
$sym_name
{
$keysym
})
{
print
OUT
'nacro::sendkey($vnc,$sym{'
.
$sym_name
{
$keysym
}
.
"},$keydown);\n"
;
}
else
{
print
OUT
"nacro::sendkey(\$vnc,$keysym,$keydown);\n"
;
}
}
}
if
(
$keysym
==
0xffe3
||
$keysym
==
0xffe4
)
{
if
(
$keysym
==
0xffe3
||
$keysym
==
0xffe4
)
{
# Control pressed
# Control pressed
...
@@ -120,6 +136,22 @@ while(1) {
...
@@ -120,6 +136,22 @@ while(1) {
.
(
$y
>=
0
?
"+"
:
""
)
.
"$y,$buttons);\n"
;
.
(
$y
>=
0
?
"+"
:
""
)
.
"$y,$buttons);\n"
;
}
}
}
}
if
(
$result
&
$
nacro::
RESULT_TEXT_CLIENT
)
{
my
$text
=
nacro::
gettext_client
(
$vnc
);
if
(
nacro::
sendtext
(
$vnc
,
$text
))
{
writetiming
();
print
OUT
"nacro::sendtext(\$vnc, q(\Q$text\E));\n"
;
print
"got text from client: $text\n"
;
}
}
if
(
$result
&
$
nacro::
RESULT_TEXT_SERVER
)
{
my
$text
=
nacro::
gettext_server
(
$vnc
);
if
(
nacro::
sendtext_to_server
(
$vnc
,
$text
))
{
writetiming
();
print
OUT
"nacro::sendtext_to_server(\$vnc, q(\Q$text\E));\n"
;
print
"got text from server: $text\n"
;
}
}
}
else
{
}
else
{
if
(
$result
&
$
nacro::
RESULT_KEY
)
{
if
(
$result
&
$
nacro::
RESULT_KEY
)
{
$keysym
=
nacro::
getkeysym
(
$vnc
);
$keysym
=
nacro::
getkeysym
(
$vnc
);
...
...
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