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
a26dbfe3
Commit
a26dbfe3
authored
Sep 12, 2006
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement rubberband for rectangular selection
parent
9b93f295
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
6 deletions
+77
-6
nacro.c
VisualNaCro/nacro.c
+72
-0
recorder.pl
VisualNaCro/recorder.pl
+5
-6
No files found.
VisualNaCro/nacro.c
View file @
a26dbfe3
...
...
@@ -575,6 +575,78 @@ 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
);
char
*
fake_frame_buffer
;
char
*
backup
;
int
w
,
h
,
x
,
y
;
if
(
res
==
NULL
||
res
->
server
==
NULL
)
return
-
1
;
x
=
res
->
x
;
y
=
res
->
y
;
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
;
while
(
res
->
buttons
)
{
result_t
r
=
waitforinput
(
resource
,
1000000L
);
if
(
x
==
res
->
x
&&
y
==
res
->
y
)
continue
;
copy_line
(
res
->
server
,
backup
,
x0
,
y0
,
x
,
y0
,
0
);
copy_line
(
res
->
server
,
backup
,
x0
,
y0
,
x0
,
y
,
0
);
copy_line
(
res
->
server
,
backup
,
x
,
y0
,
x
,
y
,
0
);
copy_line
(
res
->
server
,
backup
,
x0
,
y
,
x
,
y
,
0
);
x
=
res
->
x
;
y
=
res
->
y
;
copy_line
(
res
->
server
,
backup
,
x0
,
y0
,
x
,
y0
,
0x80
);
copy_line
(
res
->
server
,
backup
,
x0
,
y0
,
x0
,
y
,
0x80
);
copy_line
(
res
->
server
,
backup
,
x
,
y0
,
x
,
y
,
0x80
);
copy_line
(
res
->
server
,
backup
,
x0
,
y
,
x
,
y
,
0x80
);
}
copy_line
(
res
->
server
,
backup
,
x0
,
y0
,
x
,
y0
,
0
);
copy_line
(
res
->
server
,
backup
,
x0
,
y0
,
x0
,
y
,
0
);
copy_line
(
res
->
server
,
backup
,
x
,
y0
,
x
,
y
,
0
);
copy_line
(
res
->
server
,
backup
,
x0
,
y
,
x
,
y
,
0
);
res
->
server
->
frameBuffer
=
backup
;
free
(
fake_frame_buffer
);
return
RESULT_MOUSE
;
}
const
char
*
gettext_server
(
resource_t
res
)
{
private_resource_t
*
r
=
get_resource
(
res
);
...
...
VisualNaCro/recorder.pl
View file @
a26dbfe3
...
...
@@ -117,7 +117,6 @@ while(1) {
if
(
$magickey
>
3
&&
!
$keydown
)
{
$magickey
=
0
;
$mode
=
"menu"
;
$dragging
=
0
;
nacro::
alert
(
$vnc
,
"VisualNaCro: press 'q' to quit\nor mark reference rectangle by dragging"
,
10
);
}
}
else
{
...
...
@@ -169,13 +168,13 @@ while(1) {
$x
=
nacro::
getx
(
$vnc
);
$y
=
nacro::
gety
(
$vnc
);
$buttons
=
nacro::
getbuttons
(
$vnc
);
if
(
!
$dragging
&&
((
$buttons
&
1
)
==
1
)
)
{
print
STDERR
"start draggin: $x $y\n"
;
if
(
(
$buttons
&
1
)
==
1
)
{
print
STDERR
"start draggin: $x $y\n"
;
$start_x
=
$x
;
$start_y
=
$y
;
$dragging
=
1
;
}
elsif
(
$dragging
&&
((
$buttons
&
1
)
==
0
))
{
print
STDERR
"stop draggin: $x $y\n"
;
nacro::
rubberband
(
$vnc
,
$x
,
$y
)
;
$x
=
nacro::
getx
(
$vnc
);
$y
=
nacro::
gety
(
$vnc
)
;
if
(
$start_x
==
$x
&&
$start_y
==
$y
)
{
print
OUT
"\$x_origin=0; \$y_origin=0;\n"
;
}
else
{
...
...
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