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
4e092b7f
Commit
4e092b7f
authored
Nov 27, 2001
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
few changes
parent
0c2c5073
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
32 deletions
+59
-32
TODO
TODO
+2
-2
x11vnc.c
x11vnc.c
+57
-30
No files found.
TODO
View file @
4e092b7f
immediate:
----------
x11vnc: clipboard, cursor, updates interruptible by input,
sometimes XTest fails (but doesn't with x0rfbserver)
x11vnc: clipboard, cursor, updates interruptible by input (doesn't work yet)
extra_bytes in rfbDrawCharWithClip.
tested mouse buttons make copy rect, but text is not marked as mod.
cursor drawing: set optional grain to mark bigger rectangles as drawn (else
...
...
@@ -29,6 +28,7 @@ internal HTTP tunnelling feature (needs a special GET target and a few
done:
-----
.x11vnc: sometimes XTest fails (but doesn't with x0rfbserver)
.DeferUpdateTime (timing problems!)
.empty cursor sending doesn't work.
.udp (need an rfbClientPtr udpClient in rfbScreen)
...
...
x11vnc.c
View file @
4e092b7f
...
...
@@ -13,7 +13,9 @@
#include "rfb.h"
Display
*
dpy
=
0
;
int
window
;
int
c
=
0
,
blockLength
=
32
;
int
tileX
=
0
,
tileY
=
0
,
tileWidth
=
32
,
tileHeight
=
32
,
dontTile
=
True
;
Bool
gotInput
=
FALSE
;
Bool
disconnectAfterFirstClient
=
TRUE
;
...
...
@@ -147,24 +149,25 @@ XShmSegmentInfo shminfo;
Bool
useSHM
=
FALSE
;
#endif
void
getImage
(
int
bpp
,
Display
*
dpy
,
int
xscreen
,
XImage
**
i
)
void
getImage
(
int
bpp
,
Display
*
dpy
,
int
xscreen
,
XImage
**
i
,
int
x
,
int
y
,
int
width
,
int
height
)
{
if
(
width
<=
0
)
width
=
DisplayWidth
(
dpy
,
xscreen
);
if
(
height
<=
0
)
height
=
DisplayHeight
(
dpy
,
xscreen
);
if
(
useSHM
&&
bpp
>
0
)
{
static
Bool
firstTime
=
TRUE
;
if
(
firstTime
)
{
firstTime
=
FALSE
;
*
i
=
XShmCreateImage
(
dpy
,
DefaultVisual
(
dpy
,
xscreen
),
bpp
,
ZPixmap
,
NULL
,
&
shminfo
,
DisplayWidth
(
dpy
,
xscreen
),
DisplayHeight
(
dpy
,
xscreen
));
*
i
=
XShmCreateImage
(
dpy
,
DefaultVisual
(
dpy
,
xscreen
),
bpp
,
ZPixmap
,
NULL
,
&
shminfo
,
width
,
height
);
if
(
*
i
==
0
)
{
useSHM
=
FALSE
;
getImage
(
bpp
,
dpy
,
xscreen
,
i
);
getImage
(
bpp
,
dpy
,
xscreen
,
i
,
x
,
y
,
width
,
height
);
return
;
}
...
...
@@ -176,36 +179,39 @@ void getImage(int bpp,Display *dpy,int xscreen,XImage **i)
XShmAttach
(
dpy
,
&
shminfo
);
}
XShmGetImage
(
dpy
,
RootWindow
(
dpy
,
xscreen
),
*
i
,
0
,
0
,
AllPlanes
);
if
(
x
==
0
&&
y
==
0
&&
width
==
DisplayWidth
(
dpy
,
xscreen
)
&&
height
==
DisplayHeight
(
dpy
,
xscreen
))
XShmGetImage
(
dpy
,
window
,
*
i
,
0
,
0
,
AllPlanes
);
else
XGetSubImage
(
dpy
,
window
,
x
,
y
,
width
,
height
,
AllPlanes
,
ZPixmap
,
*
i
,
0
,
0
);
}
else
{
*
i
=
XGetImage
(
dpy
,
RootWindow
(
dpy
,
xscreen
),
0
,
0
,
DisplayWidth
(
dpy
,
xscreen
),
DisplayHeight
(
dpy
,
xscreen
),
AllPlanes
,
ZPixmap
);
*
i
=
XGetImage
(
dpy
,
window
,
x
,
y
,
width
,
height
,
AllPlanes
,
ZPixmap
);
}
}
void
checkForImageUpdates
(
rfbScreenInfoPtr
s
,
char
*
b
)
void
checkForImageUpdates
(
rfbScreenInfoPtr
s
,
char
*
b
,
int
rowstride
,
int
x
,
int
y
,
int
width
,
int
height
)
{
Bool
changed
;
int
i
,
j
,
k
,
l
,
x1
,
y1
;
for
(
j
=
0
;
j
<
s
->
height
;
j
+=
blockLength
)
for
(
i
=
0
;
i
<
s
->
width
;
i
+=
blockLength
)
{
y1
=
j
+
blockLength
;
if
(
y1
>
s
->
height
)
y1
=
s
->
height
;
x1
=
i
+
blockLength
;
if
(
x1
>
s
->
width
)
x1
=
s
->
width
;
y1
*=
s
->
paddedWidthInBytes
;
int
i
,
j
,
k
,
l1
,
l2
,
x1
,
y1
;
for
(
j
=
0
;
j
<
height
;
j
+=
blockLength
)
for
(
i
=
0
;
i
<
width
;
i
+=
blockLength
)
{
y1
=
j
+
blockLength
;
if
(
y1
>
height
)
y1
=
height
;
x1
=
i
+
blockLength
;
if
(
x1
>
width
)
x1
=
width
;
y1
*=
rowstride
;
x1
*=
s
->
bitsPerPixel
/
8
;
changed
=
FALSE
;
for
(
l
=
j
*
s
->
paddedWidthInBytes
;
l
<
y1
;
l
+=
s
->
paddedWidthInBytes
)
for
(
l
1
=
j
*
rowstride
,
l2
=
j
*
s
->
paddedWidthInBytes
;
l1
<
y1
;
l1
+=
rowstride
,
l2
+=
s
->
paddedWidthInBytes
)
for
(
k
=
i
*
s
->
bitsPerPixel
/
8
;
k
<
x1
;
k
++
)
if
(
s
->
frameBuffer
[
l
+
k
]
!=
b
[
l
+
k
])
{
if
(
s
->
frameBuffer
[
l
2
+
k
]
!=
b
[
l1
+
k
])
{
// fprintf(stderr,"changed: %d, %d\n",k,l);
changed
=
TRUE
;
goto
changed_p
;
}
if
(
changed
)
{
changed_p:
for
(
l
+=
i
*
s
->
bitsPerPixel
/
8
;
l
<
y1
;
l
+=
s
->
paddedWidthInBytes
)
memcpy
(
/*b+l,*/
s
->
frameBuffer
+
l
,
b
+
l
,
x1
-
i
*
s
->
bitsPerPixel
/
8
);
rfbMarkRectAsModified
(
s
,
i
,
j
,
i
+
blockLength
,
j
+
blockLength
);
for
(
l
1
+=
i
*
s
->
bitsPerPixel
/
8
,
l2
+=
i
*
s
->
bitsPerPixel
/
8
;
l1
<
y1
;
l1
+=
rowstride
,
l2
+=
s
->
paddedWidthInBytes
)
memcpy
(
/*b+l,*/
s
->
frameBuffer
+
l2
,
b
+
l1
,
x1
-
i
*
s
->
bitsPerPixel
/
8
);
rfbMarkRectAsModified
(
s
,
x
+
i
,
y
+
j
,
x
+
i
+
blockLength
,
y
+
j
+
blockLength
);
}
}
}
...
...
@@ -248,13 +254,13 @@ int main(int argc,char** argv)
exit
(
2
);
}
XTestGrabControl
(
dpy
,
True
);
xscreen
=
DefaultScreen
(
dpy
);
window
=
RootWindow
(
dpy
,
xscreen
);
XTestGrabControl
(
dpy
,
True
);
init_keycodes
();
getImage
(
0
,
dpy
,
xscreen
,
&
framebufferImage
);
getImage
(
0
,
dpy
,
xscreen
,
&
framebufferImage
,
0
,
0
,
-
1
,
-
1
);
screen
=
rfbGetScreen
(
&
argc
,
argv
,
framebufferImage
->
width
,
framebufferImage
->
height
,
...
...
@@ -346,8 +352,29 @@ int main(int argc,char** argv)
//fprintf(stderr,"*");
if
(
!
useSHM
)
framebufferImage
->
f
.
destroy_image
(
framebufferImage
);
getImage
(
screen
->
rfbServerFormat
.
bitsPerPixel
,
dpy
,
xscreen
,
&
framebufferImage
);
checkForImageUpdates
(
screen
,
framebufferImage
->
data
);
if
(
dontTile
)
{
getImage
(
screen
->
rfbServerFormat
.
bitsPerPixel
,
dpy
,
xscreen
,
&
framebufferImage
,
0
,
0
,
screen
->
width
,
screen
->
height
);
checkForImageUpdates
(
screen
,
framebufferImage
->
data
,
framebufferImage
->
bytes_per_line
,
0
,
0
,
screen
->
width
,
screen
->
height
);
}
else
{
char
isRightEdge
=
tileX
+
tileWidth
>=
screen
->
width
;
char
isLowerEdge
=
tileY
+
tileHeight
>=
screen
->
height
;
getImage
(
screen
->
rfbServerFormat
.
bitsPerPixel
,
dpy
,
xscreen
,
&
framebufferImage
,
tileX
,
tileY
,
isRightEdge
?
screen
->
width
-
tileX
:
tileWidth
,
isLowerEdge
?
screen
->
height
-
tileY
:
tileHeight
);
checkForImageUpdates
(
screen
,
framebufferImage
->
data
,
framebufferImage
->
bytes_per_line
,
tileX
,
tileY
,
isRightEdge
?
screen
->
width
-
tileX
:
tileWidth
,
isLowerEdge
?
screen
->
height
-
tileY
:
tileHeight
);
if
(
isRightEdge
)
{
tileX
=
0
;
if
(
isLowerEdge
)
tileY
=
0
;
else
tileY
+=
tileHeight
;
}
else
tileX
+=
tileWidth
;
}
//fprintf(stderr,"+");
}
#ifdef WRITE_SNAPS
...
...
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