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
48eb9b22
Commit
48eb9b22
authored
Oct 04, 2001
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rfbDoCopyRect/Region and rfbScheduleCopyRect/Region.
parent
1ed7f54e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
13 deletions
+96
-13
CHANGES
CHANGES
+2
-0
Makefile
Makefile
+2
-2
TODO
TODO
+5
-2
main.c
main.c
+75
-5
rfb.h
rfb.h
+9
-2
rfbserver.c
rfbserver.c
+3
-2
No files found.
CHANGES
View file @
48eb9b22
0.2
flag backgroundLoop in rfbScreenInfo
rfbCopyRect & rfbCopyRegion (really copies rectangle in frameBuffer)
added flag to optionally not send XCursor updates.
fixed java viewer on server side:
SendCursorUpdate would send data even before the client pixel format
...
...
Makefile
View file @
48eb9b22
...
...
@@ -2,8 +2,8 @@ INCLUDES=-I.
VNCSERVERLIB
=
-L
.
-lvncserver
-L
/usr/local/lib
-lz
-ljpeg
# Uncomment these two lines to enable use of PThreads
PTHREADDEF
=
-DHAVE_PTHREADS
PTHREADLIB
=
-lpthread
#
PTHREADDEF = -DHAVE_PTHREADS
#
PTHREADLIB = -lpthread
# Comment the following line to disable the use of 3 Bytes/Pixel.
# The code for 3 Bytes/Pixel is not very efficient!
...
...
TODO
View file @
48eb9b22
immediate:
----------
copyRect and pthreads possible problem.
authentification schemes (secure vnc)
udp
documentation
perhaps the option (or just hint) not to mark very tiny regions as
modified, because that is inefficient for the encodings.
hint that to mark very tiny regions as
modified is possibly inefficient for the encodings.
(a trail of points could be better a small rectangle).
later:
------
...
...
main.c
View file @
48eb9b22
...
...
@@ -23,9 +23,6 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef HAVE_PTHREADS
#include <pthread.h>
#endif
#include <unistd.h>
#include <signal.h>
#include <time.h>
...
...
@@ -33,9 +30,7 @@
#include "rfb.h"
#include "sraRegion.h"
#ifdef HAVE_PTHREADS
MUTEX
(
logMutex
);
#endif
/*
* rfbLog prints a time-stamped message to the log file (stderr).
...
...
@@ -67,6 +62,77 @@ void rfbLogPerror(char *str)
rfbLog
(
"%s: %s
\n
"
,
str
,
strerror
(
errno
));
}
void
rfbScheduleCopyRegion
(
rfbScreenInfoPtr
rfbScreen
,
sraRegionPtr
copyRegion
,
int
dx
,
int
dy
)
{
rfbClientIteratorPtr
iterator
;
rfbClientPtr
cl
;
iterator
=
rfbGetClientIterator
(
rfbScreen
);
while
((
cl
=
rfbClientIteratorNext
(
iterator
)))
{
LOCK
(
cl
->
updateMutex
);
if
(
cl
->
useCopyRect
)
{
while
(
!
sraRgnEmpty
(
cl
->
copyRegion
)
&&
(
cl
->
copyDX
!=
dx
||
cl
->
copyDY
!=
dy
))
{
#ifdef HAVE_PTHREADS
if
(
cl
->
screen
->
backgroundLoop
)
{
SIGNAL
(
cl
->
updateCond
);
UNLOCK
(
cl
->
updateMutex
);
LOCK
(
cl
->
updateMutex
);
}
else
#endif
rfbSendFramebufferUpdate
(
cl
,
cl
->
copyRegion
);
}
sraRgnOr
(
cl
->
copyRegion
,
copyRegion
);
cl
->
copyDX
=
dx
;
cl
->
copyDY
=
dy
;
}
else
{
sraRgnOr
(
cl
->
modifiedRegion
,
copyRegion
);
}
SIGNAL
(
cl
->
updateCond
);
UNLOCK
(
cl
->
updateMutex
);
}
rfbReleaseClientIterator
(
iterator
);
}
void
rfbDoCopyRegion
(
rfbScreenInfoPtr
rfbScreen
,
sraRegionPtr
copyRegion
,
int
dx
,
int
dy
)
{
sraRectangleIterator
*
i
;
sraRect
rect
;
int
j
,
widthInBytes
,
bpp
=
rfbScreen
->
rfbServerFormat
.
bitsPerPixel
/
8
,
rowstride
=
rfbScreen
->
paddedWidthInBytes
;
char
*
in
,
*
out
;
/* copy it, really */
i
=
sraRgnGetReverseIterator
(
copyRegion
,
dx
<
0
,
dy
<
0
);
while
(
sraRgnIteratorNext
(
i
,
&
rect
))
{
widthInBytes
=
(
rect
.
x2
-
rect
.
x1
)
*
bpp
;
out
=
rfbScreen
->
frameBuffer
+
rect
.
x1
*
bpp
+
rect
.
y1
*
rowstride
;
in
=
rfbScreen
->
frameBuffer
+
(
rect
.
x1
-
dx
)
*
bpp
+
(
rect
.
y1
-
dy
)
*
rowstride
;
if
(
dy
<
0
)
for
(
j
=
rect
.
y1
;
j
<
rect
.
y2
;
j
++
,
out
+=
rowstride
,
in
+=
rowstride
)
memmove
(
out
,
in
,
widthInBytes
);
else
{
out
+=
rowstride
*
(
rect
.
y2
-
rect
.
y1
-
1
);
in
+=
rowstride
*
(
rect
.
y2
-
rect
.
y1
-
1
);
for
(
j
=
rect
.
y2
-
1
;
j
>=
rect
.
y1
;
j
--
,
out
-=
rowstride
,
in
-=
rowstride
)
memmove
(
out
,
in
,
widthInBytes
);
}
}
rfbScheduleCopyRegion
(
rfbScreen
,
copyRegion
,
dx
,
dy
);
}
void
rfbDoCopyRect
(
rfbScreenInfoPtr
rfbScreen
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
dx
,
int
dy
)
{
sraRegionPtr
region
=
sraRgnCreateRect
(
x1
,
y1
,
x2
,
y2
);
rfbDoCopyRegion
(
rfbScreen
,
region
,
dx
,
dy
);
}
void
rfbScheduleCopyRect
(
rfbScreenInfoPtr
rfbScreen
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
dx
,
int
dy
)
{
sraRegionPtr
region
=
sraRgnCreateRect
(
x1
,
y1
,
x2
,
y2
);
rfbScheduleCopyRegion
(
rfbScreen
,
region
,
dx
,
dy
);
}
void
rfbMarkRegionAsModified
(
rfbScreenInfoPtr
rfbScreen
,
sraRegionPtr
modRegion
)
{
...
...
@@ -395,6 +461,8 @@ rfbScreenInfoPtr rfbGetScreen(int argc,char** argv,
rfbScreen
->
cursor
=
&
myCursor
;
INIT_MUTEX
(
rfbScreen
->
cursorMutex
);
IF_PTHREADS
(
rfbScreen
->
backgroundLoop
=
FALSE
);
/* proc's and hook's */
rfbScreen
->
kbdAddEvent
=
defaultKbdAddEvent
;
...
...
@@ -456,6 +524,8 @@ void rfbRunEventLoop(rfbScreenInfoPtr rfbScreen, long usec, Bool runInBackground
#ifdef HAVE_PTHREADS
pthread_t
listener_thread
;
rfbScreen
->
backgroundLoop
=
TRUE
;
pthread_create
(
&
listener_thread
,
NULL
,
listenerRun
,
rfbScreen
);
return
;
#else
...
...
rfb.h
View file @
48eb9b22
...
...
@@ -118,7 +118,7 @@ int max(int,int);
#define MUTEX(mutex)
#define INIT_MUTEX(mutex)
#define TINI_MUTEX(mutex)
#define SIGNAL(cond)
this_is_unsupported
#define SIGNAL(cond)
#define WAIT(cond,mutex) this_is_unsupported
#define COND(cond)
#define INIT_COND(cond)
...
...
@@ -256,6 +256,8 @@ typedef struct
struct
rfbCursor
*
cursor
;
MUTEX
(
cursorMutex
);
IF_PTHREADS
(
Bool
backgroundLoop
);
/* the following members have to be supplied by the serving process */
char
*
frameBuffer
;
KbdAddEventProcPtr
kbdAddEvent
;
...
...
@@ -516,7 +518,12 @@ static const int rfbEndianTest = (_BYTE_ORDER == _LITTLE_ENDIAN);
extern
void
rfbLog
(
char
*
format
,
...);
extern
void
rfbLogPerror
(
char
*
str
);
extern
int
runVNCServer
(
int
argc
,
char
*
argv
[]);
void
rfbScheduleCopyRect
(
rfbScreenInfoPtr
rfbScreen
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
dx
,
int
dy
);
void
rfbScheduleCopyRegion
(
rfbScreenInfoPtr
rfbScreen
,
sraRegionPtr
copyRegion
,
int
dx
,
int
dy
);
void
rfbDoCopyRect
(
rfbScreenInfoPtr
rfbScreen
,
int
x1
,
int
y1
,
int
x2
,
int
y2
,
int
dx
,
int
dy
);
void
rfbDoCopyRegion
(
rfbScreenInfoPtr
rfbScreen
,
sraRegionPtr
copyRegion
,
int
dx
,
int
dy
);
/* sockets.c */
...
...
rfbserver.c
View file @
48eb9b22
...
...
@@ -225,7 +225,7 @@ rfbNewClient(rfbScreen,sock)
LOCK
(
rfbClientListMutex
);
cl
->
refCount
=
0
;
IF_PTHREADS
(
cl
->
refCount
=
0
)
;
cl
->
next
=
rfbScreen
->
rfbClientHead
;
cl
->
prev
=
NULL
;
if
(
rfbScreen
->
rfbClientHead
)
...
...
@@ -834,6 +834,7 @@ rfbProcessClientNormalMessage(cl)
/*
* rfbSendFramebufferUpdate - send the currently pending framebuffer update to
* the RFB client.
* givenUpdateRegion is not changed.
*/
Bool
...
...
@@ -1112,7 +1113,7 @@ rfbSendCopyRegion(cl, reg, dx, dy)
cr
.
srcX
=
Swap16IfLE
(
x
-
dx
);
cr
.
srcY
=
Swap16IfLE
(
y
-
dy
);
fprintf
(
stderr
,
"sent copyrect (%d,%d) (%d,%d) (%d,%d)
\n
"
,
x
,
y
,
w
,
h
,
x
-
dx
,
y
-
dy
);
memcpy
(
&
cl
->
updateBuf
[
cl
->
ublen
],
(
char
*
)
&
cr
,
sz_rfbCopyRect
);
cl
->
ublen
+=
sz_rfbCopyRect
;
...
...
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