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
84b3a4a7
Commit
84b3a4a7
authored
Sep 12, 2006
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VisualNaCro: add magic key 'd' to display the current reference image
parent
427e3de1
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
30 deletions
+100
-30
NEWS
VisualNaCro/NEWS
+2
-0
nacro.c
VisualNaCro/nacro.c
+77
-23
nacro.h
VisualNaCro/nacro.h
+2
-0
recorder.pl
VisualNaCro/recorder.pl
+19
-7
No files found.
VisualNaCro/NEWS
View file @
84b3a4a7
...
...
@@ -6,3 +6,5 @@ Clipboard is supported (thanks to Uwe).
Keys are recorded by their symbols with the --symbolic switch, provided you
have the X11::Keysyms module.
After pressing Control twice, you can show the last reference image with 'd'.
VisualNaCro/nacro.c
View file @
84b3a4a7
...
...
@@ -330,6 +330,83 @@ static void free_image(image_t* image)
free
(
image
);
}
static
void
copy_line
(
rfbScreenInfo
*
dest
,
char
*
backup
,
int
x0
,
int
y0
,
int
x1
,
int
y1
,
int
color_offset
)
{
uint8_t
*
d
=
(
uint8_t
*
)
dest
->
frameBuffer
,
*
s
=
(
uint8_t
*
)
backup
;
int
i
;
int
steps0
=
x1
>
x0
?
x1
-
x0
:
x0
-
x1
;
int
steps1
=
y1
>
y0
?
y1
-
y0
:
y0
-
y1
;
if
(
steps1
>
steps0
)
steps0
=
steps1
;
else
if
(
steps0
==
0
)
steps0
=
1
;
for
(
i
=
0
;
i
<=
steps0
;
i
++
)
{
int
j
,
index
=
4
*
(
x0
+
i
*
(
x1
-
x0
)
/
steps0
+
dest
->
width
*
(
y0
+
i
*
(
y1
-
y0
)
/
steps0
));
for
(
j
=
0
;
j
<
4
;
j
++
)
d
[
index
+
j
]
=
s
[
index
+
j
]
+
color_offset
;
}
rfbMarkRectAsModified
(
dest
,
x0
-
5
,
y0
-
5
,
x1
+
1
,
y1
+
2
);
}
result_t
displaypnm
(
resource_t
resource
,
const
char
*
filename
,
coordinate_t
x
,
coordinate_t
y
,
bool_t
border
,
timeout_t
timeout_in_seconds
)
{
private_resource_t
*
res
=
get_resource
(
resource
);
image_t
*
image
;
char
*
fake_frame_buffer
;
char
*
backup
;
int
w
,
h
,
i
,
j
,
w2
,
h2
;
result_t
result
;
if
(
res
==
NULL
||
res
->
server
==
NULL
||
(
image
=
loadpnm
(
filename
))
==
NULL
)
return
0
;
w
=
res
->
server
->
width
;
h
=
res
->
server
->
height
;
fake_frame_buffer
=
malloc
(
w
*
4
*
h
);
if
(
!
fake_frame_buffer
)
return
0
;
memcpy
(
fake_frame_buffer
,
res
->
server
->
frameBuffer
,
w
*
4
*
h
);
backup
=
res
->
server
->
frameBuffer
;
res
->
server
->
frameBuffer
=
fake_frame_buffer
;
w2
=
image
->
width
;
if
(
x
+
w2
>
w
)
w2
=
w
-
x
;
h2
=
image
->
height
;
if
(
y
+
h2
>
h
)
h2
=
h
-
y
;
for
(
j
=
0
;
j
<
h2
;
j
++
)
memcpy
(
fake_frame_buffer
+
4
*
(
x
+
(
y
+
j
)
*
w
),
image
->
buffer
+
j
*
4
*
image
->
width
,
4
*
w2
);
free
(
image
);
if
(
border
)
{
copy_line
(
res
->
server
,
backup
,
x
,
y
,
x
+
w2
,
y
,
0x80
);
copy_line
(
res
->
server
,
backup
,
x
,
y
,
x
,
y
+
h2
,
0x80
);
copy_line
(
res
->
server
,
backup
,
x
+
w2
,
y
,
x
+
w2
,
y
+
h2
,
0x80
);
copy_line
(
res
->
server
,
backup
,
x
,
y
+
h2
,
x
+
w2
,
y
+
h2
,
0x80
);
}
rfbMarkRectAsModified
(
res
->
server
,
x
-
1
,
y
-
1
,
x
+
w2
+
1
,
y
+
h2
+
1
);
result
=
waitforinput
(
resource
,
timeout_in_seconds
);
res
->
server
->
frameBuffer
=
backup
;
free
(
fake_frame_buffer
);
rfbMarkRectAsModified
(
res
->
server
,
x
-
1
,
y
-
1
,
x
+
w2
+
1
,
y
+
h2
+
1
);
return
result
;
}
/* process() and friends */
/* this function returns only if res->result in return_mask */
...
...
@@ -575,29 +652,6 @@ const char *gettext_client(resource_t res)
return
r
->
text_client
;
}
static
void
copy_line
(
rfbScreenInfo
*
dest
,
char
*
backup
,
int
x0
,
int
y0
,
int
x1
,
int
y1
,
int
color_offset
)
{
uint8_t
*
d
=
(
uint8_t
*
)
dest
->
frameBuffer
,
*
s
=
(
uint8_t
*
)
backup
;
int
i
;
int
steps0
=
x1
>
x0
?
x1
-
x0
:
x0
-
x1
;
int
steps1
=
y1
>
y0
?
y1
-
y0
:
y0
-
y1
;
if
(
steps1
>
steps0
)
steps0
=
steps1
;
else
if
(
steps0
==
0
)
steps0
=
1
;
for
(
i
=
0
;
i
<=
steps0
;
i
++
)
{
int
j
,
index
=
4
*
(
x0
+
i
*
(
x1
-
x0
)
/
steps0
+
dest
->
width
*
(
y0
+
i
*
(
y1
-
y0
)
/
steps0
));
for
(
j
=
0
;
j
<
4
;
j
++
)
d
[
index
+
j
]
=
s
[
index
+
j
]
+
color_offset
;
}
rfbMarkRectAsModified
(
dest
,
x0
-
5
,
y0
-
5
,
x1
+
1
,
y1
+
2
);
}
result_t
rubberband
(
resource_t
resource
,
coordinate_t
x0
,
coordinate_t
y0
)
{
private_resource_t
*
res
=
get_resource
(
resource
);
...
...
VisualNaCro/nacro.h
View file @
84b3a4a7
...
...
@@ -105,6 +105,8 @@ coordinate_t getyorigin(resource_t res);
bool_t
savepnm
(
resource_t
res
,
const
char
*
filename
,
coordinate_t
x1
,
coordinate_t
y1
,
coordinate_t
x2
,
coordinate_t
y2
);
result_t
displaypnm
(
resource_t
res
,
const
char
*
filename
,
coordinate_t
x
,
coordinate_t
y
,
bool_t
border
,
timeout_t
timeout
);
/* this displays an overlay which is shown for a certain time */
result_t
alert
(
resource_t
res
,
const
char
*
message
,
timeout_t
timeout
);
...
...
VisualNaCro/recorder.pl
View file @
84b3a4a7
...
...
@@ -112,12 +112,14 @@ while(1) {
}
}
if
(
$keysym
==
0xffe3
||
$keysym
==
0xffe4
)
{
if
(
!
$keydown
)
{
# Control pressed
$magickey
++
;
if
(
$magickey
>
3
&&
!
$keydown
)
{
$magickey
=
0
;
$mode
=
"menu"
;
nacro::
alert
(
$vnc
,
"VisualNaCro: press 'q' to quit\nor mark reference rectangle by dragging"
,
10
);
if
(
$magickey
>
1
)
{
$magickey
=
0
;
$mode
=
"menu"
;
nacro::
alert
(
$vnc
,
"VisualNaCro: press 'q' to quit,\n'd' to display current reference image,\nor mark reference rectangle by dragging"
,
10
);
}
}
}
else
{
$magickey
=
0
;
...
...
@@ -160,8 +162,18 @@ while(1) {
close
OUT
;
nacro::
closevnc
(
$vnc
);
exit
0
;
}
elsif
(
$keysym
==
ord
(
'd'
))
{
$pnm
=
$output
.
(
$image_counter
-
1
)
.
".pnm"
;
$res
=
nacro::
displaypnm
(
$vnc
,
$pnm
,
$x_origin
,
$y_origin
,
1
,
10
);
#0, 0, 1, 10);
if
(
$res
==
0
)
{
nacro::
alert
(
$vnc
,
"Error displaying "
.
$pnm
);
}
}
else
{
nacro::
alert
(
$vnc
,
"Unknown key"
,
10
);
}
$mode
=
"passthru"
;
}
if
(
$result
&
$
nacro::
RESULT_MOUSE
)
{
...
...
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