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
5c438e3f
Commit
5c438e3f
authored
Sep 24, 2001
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: cursor (works now without xcursor encoding)
parent
fa85c12a
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
126 additions
and
181 deletions
+126
-181
Makefile
Makefile
+2
-1
TODO
TODO
+4
-2
cursor.c
cursor.c
+1
-145
example.c
example.c
+7
-5
os.h
include/Xserver/os.h
+2
-2
main.c
main.c
+3
-0
miregion.c
miregion.c
+11
-4
pnmshow.c
pnmshow.c
+12
-5
rfb.h
rfb.h
+71
-7
rfbserver.c
rfbserver.c
+6
-5
sockets.c
sockets.c
+2
-0
xalloc.c
xalloc.c
+5
-5
No files found.
Makefile
View file @
5c438e3f
...
@@ -3,7 +3,8 @@ CFLAGS=-g -Wall
...
@@ -3,7 +3,8 @@ CFLAGS=-g -Wall
#CFLAGS=-O2 -Wall
#CFLAGS=-O2 -Wall
RANLIB
=
ranlib
RANLIB
=
ranlib
INCLUDES
=
-I
.
-Ilibvncauth
-Iinclude
-Iinclude
/X11
-Iinclude
/Xserver
INCLUDES
=
-I
.
-Ilibvncauth
-Iinclude
# -Iinclude/X11 -Iinclude/Xserver
VNCAUTHLIB
=
-Llibvncauth
-lvncauth
VNCAUTHLIB
=
-Llibvncauth
-lvncauth
VNCSERVERLIB
=
-L
.
-lvncserver
-lz
-ljpeg
VNCSERVERLIB
=
-L
.
-lvncserver
-lz
-ljpeg
...
...
TODO
View file @
5c438e3f
dont draw rich cursors as xcursors
fix bug with odd width
test drawing of cursors when not using xcursor or rich cursor encoding
adapt rdp2vnc (rdesktop)
adapt rdp2vnc (rdesktop)
dont draw rich cursors as xcursors
udp
udp
rfbCloseClient, rfbConnect, ConnectToTcpAddr
rfbCloseClient, rfbConnect, ConnectToTcpAddr
CORBA
CORBA
translate.c: warning about non 8-bit colourmaps
translate.c: warning about non 8-bit colourmaps
set colourmap
done:
done:
...
@@ -12,4 +13,5 @@ done:
...
@@ -12,4 +13,5 @@ done:
.cutpaste
.cutpaste
.httpd
.httpd
.other encodings
.other encodings
.test drawing of cursors when not using xcursor or rich cursor encoding
cursor.c
View file @
5c438e3f
...
@@ -69,14 +69,6 @@ static unsigned char _reverse_byte[0x100] = {
...
@@ -69,14 +69,6 @@ static unsigned char _reverse_byte[0x100] = {
};
};
static
int
EncodeRichCursorData8
(
rfbClientPtr
cl
,
char
*
buf
,
rfbPixelFormat
*
fmt
,
rfbCursorPtr
pCursor
);
static
int
EncodeRichCursorData16
(
rfbClientPtr
cl
,
char
*
buf
,
rfbPixelFormat
*
fmt
,
rfbCursorPtr
pCursor
);
static
int
EncodeRichCursorData32
(
rfbClientPtr
cl
,
char
*
buf
,
rfbPixelFormat
*
fmt
,
rfbCursorPtr
pCursor
);
/*
/*
* Send cursor shape either in X-style format or in client pixel format.
* Send cursor shape either in X-style format or in client pixel format.
*/
*/
...
@@ -209,24 +201,6 @@ rfbSendCursorShape(cl)
...
@@ -209,24 +201,6 @@ rfbSendCursorShape(cl)
pCursor
->
width
*
bpp1
,
pCursor
->
width
,
pCursor
->
height
);
pCursor
->
width
*
bpp1
,
pCursor
->
width
,
pCursor
->
height
);
cl
->
ublen
+=
pCursor
->
width
*
bpp2
*
pCursor
->
height
;
cl
->
ublen
+=
pCursor
->
width
*
bpp2
*
pCursor
->
height
;
/*
switch (cl->format.bitsPerPixel) {
case 8:
cl->ublen += EncodeRichCursorData8(cl, &cl->updateBuf[cl->ublen],
&cl->format, pCursor);
break;
case 16:
cl->ublen += EncodeRichCursorData16(cl, &cl->updateBuf[cl->ublen],
&cl->format, pCursor);
break;
case 32:
cl->ublen += EncodeRichCursorData32(cl, &cl->updateBuf[cl->ublen],
&cl->format, pCursor);
break;
default:
return FALSE;
}
*/
}
}
/* Prepare transparency mask. */
/* Prepare transparency mask. */
...
@@ -254,123 +228,7 @@ rfbSendCursorShape(cl)
...
@@ -254,123 +228,7 @@ rfbSendCursorShape(cl)
return
TRUE
;
return
TRUE
;
}
}
/* if you have a cursor in LSB order you have to convert it */
/*
* Code to convert cursor source bitmap to the desired pixel format.
*/
#define RGB48_TO_PIXEL(fmt,r,g,b) \
(((CARD32)(r) * ((fmt)->redMax + 1) >> 16) << (fmt)->redShift | \
((CARD32)(g) * ((fmt)->greenMax + 1) >> 16) << (fmt)->greenShift | \
((CARD32)(b) * ((fmt)->blueMax + 1) >> 16) << (fmt)->blueShift)
static
int
EncodeRichCursorData8
(
cl
,
buf
,
fmt
,
pCursor
)
rfbClientPtr
cl
;
char
*
buf
;
rfbPixelFormat
*
fmt
;
rfbCursorPtr
pCursor
;
{
int
widthPixels
,
widthBytes
;
int
x
,
y
,
b
;
CARD8
*
src
;
char
pix
[
2
];
CARD8
bitmapByte
;
pix
[
0
]
=
(
char
)
RGB48_TO_PIXEL
(
fmt
,
pCursor
->
backRed
,
pCursor
->
backGreen
,
pCursor
->
backBlue
);
pix
[
1
]
=
(
char
)
RGB48_TO_PIXEL
(
fmt
,
pCursor
->
foreRed
,
pCursor
->
foreGreen
,
pCursor
->
foreBlue
);
src
=
(
CARD8
*
)
pCursor
->
richSource
;
widthPixels
=
pCursor
->
width
;
widthBytes
=
widthPixels
;
for
(
y
=
0
;
y
<
pCursor
->
height
;
y
++
)
{
for
(
x
=
0
;
x
<
widthPixels
/
8
;
x
++
)
{
bitmapByte
=
src
[
y
*
widthBytes
+
x
];
/*if (screenInfo.bitmapBitOrder == LSBFirst) {
bitmapByte = _reverse_byte[bitmapByte];
}*/
for
(
b
=
7
;
b
>=
0
;
b
--
)
{
*
buf
++
=
pix
[
bitmapByte
>>
b
&
1
];
}
}
if
(
widthPixels
%
8
)
{
bitmapByte
=
src
[
y
*
widthBytes
+
x
];
/*if (screenInfo.bitmapBitOrder == LSBFirst) {
bitmapByte = _reverse_byte[bitmapByte];
}*/
for
(
b
=
7
;
b
>
7
-
widthPixels
%
8
;
b
--
)
{
*
buf
++
=
pix
[
bitmapByte
>>
b
&
1
];
}
}
}
return
(
widthPixels
*
pCursor
->
height
);
}
#define DEFINE_RICH_ENCODE(bpp) \
\
static int \
EncodeRichCursorData##bpp(cl, buf, fmt, pCursor) \
rfbClientPtr cl; \
char *buf; \
rfbPixelFormat *fmt; \
rfbCursorPtr pCursor; \
{ \
int widthPixels, widthBytes; \
int x, y, b; \
CARD8 *src; \
CARD##bpp pix[2]; \
CARD8 bitmapByte; \
\
pix[0] = (CARD##bpp)RGB48_TO_PIXEL(fmt, pCursor->backRed, \
pCursor->backGreen, \
pCursor->backBlue); \
pix[1] = (CARD##bpp)RGB48_TO_PIXEL(fmt, pCursor->foreRed, \
pCursor->foreGreen, \
pCursor->foreBlue); \
if (!cl->screen->rfbServerFormat.bigEndian != !fmt->bigEndian) { \
pix[0] = Swap##bpp(pix[0]); \
pix[1] = Swap##bpp(pix[1]); \
} \
\
src = (CARD8 *)pCursor->richSource; \
widthPixels = pCursor->width; \
widthBytes = (pCursor->width*bpp)/8; \
\
for (y = 0; y < pCursor->height; y++) { \
for (x = 0; x < widthPixels / 8; x++) { \
bitmapByte = src[y * widthBytes + x]; \
/*if (screenInfo.bitmapBitOrder == LSBFirst) { \
bitmapByte = _reverse_byte[bitmapByte]; \
}*/
\
for (b = 7; b >= 0; b--) { \
memcpy (buf, (char *)&pix[bitmapByte >> b & 1], \
sizeof(CARD##bpp)); \
buf += sizeof(CARD##bpp); \
} \
} \
if (widthPixels % 8) { \
bitmapByte = src[y * widthBytes + x]; \
/*if (cl->screen.bitmapBitOrder == LSBFirst) { \
bitmapByte = _reverse_byte[bitmapByte]; \
}*/
\
for (b = 7; b > 7 - widthPixels % 8; b--) { \
memcpy (buf, (char *)&pix[bitmapByte >> b & 1], \
sizeof(CARD##bpp)); \
buf += sizeof(CARD##bpp); \
} \
} \
} \
\
return (widthPixels * pCursor->height * (bpp / 8)); \
}
DEFINE_RICH_ENCODE
(
16
)
DEFINE_RICH_ENCODE
(
32
)
void
rfbConvertLSBCursorBitmapOrMask
(
int
width
,
int
height
,
unsigned
char
*
bitmap
)
void
rfbConvertLSBCursorBitmapOrMask
(
int
width
,
int
height
,
unsigned
char
*
bitmap
)
{
{
int
i
,
t
=
(
width
+
7
)
/
8
*
height
;
int
i
,
t
=
(
width
+
7
)
/
8
*
height
;
...
@@ -495,7 +353,6 @@ void rfbUndrawCursor(rfbClientPtr cl)
...
@@ -495,7 +353,6 @@ void rfbUndrawCursor(rfbClientPtr cl)
rfbCursorPtr
c
=
s
->
cursor
;
rfbCursorPtr
c
=
s
->
cursor
;
int
j
,
x1
,
x2
,
y1
,
y2
,
bpp
=
s
->
rfbServerFormat
.
bitsPerPixel
/
8
,
int
j
,
x1
,
x2
,
y1
,
y2
,
bpp
=
s
->
rfbServerFormat
.
bitsPerPixel
/
8
,
rowstride
=
s
->
paddedWidthInBytes
;
rowstride
=
s
->
paddedWidthInBytes
;
return
;
if
(
!
s
->
cursorIsDrawn
)
if
(
!
s
->
cursorIsDrawn
)
return
;
return
;
/* restore what is under the cursor */
/* restore what is under the cursor */
...
@@ -525,7 +382,6 @@ void rfbDrawCursor(rfbClientPtr cl)
...
@@ -525,7 +382,6 @@ void rfbDrawCursor(rfbClientPtr cl)
int
i
,
j
,
x1
,
x2
,
y1
,
y2
,
i1
,
j1
,
bpp
=
s
->
rfbServerFormat
.
bitsPerPixel
/
8
,
int
i
,
j
,
x1
,
x2
,
y1
,
y2
,
i1
,
j1
,
bpp
=
s
->
rfbServerFormat
.
bitsPerPixel
/
8
,
rowstride
=
s
->
paddedWidthInBytes
,
rowstride
=
s
->
paddedWidthInBytes
,
bufSize
=
c
->
width
*
c
->
height
*
bpp
,
w
=
(
c
->
width
+
7
)
/
8
;
bufSize
=
c
->
width
*
c
->
height
*
bpp
,
w
=
(
c
->
width
+
7
)
/
8
;
return
;
if
(
s
->
cursorIsDrawn
)
if
(
s
->
cursorIsDrawn
)
rfbUndrawCursor
(
cl
);
rfbUndrawCursor
(
cl
);
if
(
s
->
underCursorBufferLen
<
bufSize
)
{
if
(
s
->
underCursorBufferLen
<
bufSize
)
{
...
...
example.c
View file @
5c438e3f
...
@@ -28,9 +28,10 @@
...
@@ -28,9 +28,10 @@
#endif
#endif
#define XK_MISCELLANY
#define XK_MISCELLANY
#include "rfb.h"
#include "rfb.h"
#include "keysym
def
.h"
#include "keysym.h"
const
int
maxx
=
640
,
maxy
=
480
,
bpp
=
4
;
const
int
maxx
=
640
,
maxy
=
480
,
bpp
=
4
;
/* TODO: odd maxx doesn't work */
/* This initializes a nice (?) background */
/* This initializes a nice (?) background */
...
@@ -94,10 +95,10 @@ void drawline(unsigned char* buffer,int rowstride,int bpp,int x1,int y1,int x2,i
...
@@ -94,10 +95,10 @@ void drawline(unsigned char* buffer,int rowstride,int bpp,int x1,int y1,int x2,i
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
void
doptr
(
int
buttonMask
,
int
x
,
int
y
,
rfbClientPtr
cl
)
{
{
ClientData
*
cd
=
cl
->
clientData
;
ClientData
*
cd
=
cl
->
clientData
;
//
if(cl->screen->cursorIsDrawn)
if
(
cl
->
screen
->
cursorIsDrawn
)
//
rfbUndrawCursor(cl);
rfbUndrawCursor
(
cl
);
//
cl->screen->cursorX=x;
cl
->
screen
->
cursorX
=
x
;
//
cl->screen->cursorY=y;
cl
->
screen
->
cursorY
=
y
;
if
(
x
>=
0
&&
y
>=
0
&&
x
<
maxx
&&
y
<
maxy
)
{
if
(
x
>=
0
&&
y
>=
0
&&
x
<
maxx
&&
y
<
maxy
)
{
if
(
buttonMask
)
{
if
(
buttonMask
)
{
int
i
,
j
,
x1
,
x2
,
y1
,
y2
;
int
i
,
j
,
x1
,
x2
,
y1
,
y2
;
...
@@ -252,6 +253,7 @@ int main(int argc,char** argv)
...
@@ -252,6 +253,7 @@ int main(int argc,char** argv)
rfbCursorPtr
c
=
rfbScreen
->
cursor
;
rfbCursorPtr
c
=
rfbScreen
->
cursor
;
char
x
[
32
*
32
],
mask
[
32
*
32
/
8
];
char
x
[
32
*
32
],
mask
[
32
*
32
/
8
];
c
=
rfbScreen
->
cursor
=
rfbMakeXCursor
(
w
,
h
,
x
,
mask
);
c
=
rfbScreen
->
cursor
=
rfbMakeXCursor
(
w
,
h
,
x
,
mask
);
c
->
xhot
=
2
;
c
->
yhot
=
10
;
c
->
mask
[
0
]
=
0xff
;
c
->
mask
[
1
]
=
0x0
;
c
->
mask
[
0
]
=
0xff
;
c
->
mask
[
1
]
=
0x0
;
memset
(
c
->
mask
,
255
,
h
*
w
/
8
);
memset
(
c
->
mask
,
255
,
h
*
w
/
8
);
c
->
richSource
=
malloc
(
w
*
h
*
bpp
);
c
->
richSource
=
malloc
(
w
*
h
*
bpp
);
...
...
include/Xserver/os.h
View file @
5c438e3f
...
@@ -51,10 +51,10 @@ SOFTWARE.
...
@@ -51,10 +51,10 @@ SOFTWARE.
#ifndef OS_H
#ifndef OS_H
#define OS_H
#define OS_H
#include "misc.h"
#include "
Xserver/
misc.h"
#define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size))
#define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size))
#define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr))
#define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((pointer)(_ptr))
#include "Xalloca.h"
#include "X
11/X
alloca.h"
#define NullFID ((FID) 0)
#define NullFID ((FID) 0)
...
...
main.c
View file @
5c438e3f
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include <time.h>
#include <time.h>
#include "rfb.h"
#include "rfb.h"
#include "region.h"
#ifdef HAVE_PTHREADS
#ifdef HAVE_PTHREADS
pthread_mutex_t
logMutex
;
pthread_mutex_t
logMutex
;
...
@@ -408,6 +409,7 @@ rfbScreenInfoPtr rfbDefaultScreenInit(int argc,char** argv,int width,int height,
...
@@ -408,6 +409,7 @@ rfbScreenInfoPtr rfbDefaultScreenInit(int argc,char** argv,int width,int height,
X11 ScreenPtr, so we do this. Pretty ugly, but at least it lets us
X11 ScreenPtr, so we do this. Pretty ugly, but at least it lets us
avoid hacking up regionstr.h, or changing every call to REGION_*
avoid hacking up regionstr.h, or changing every call to REGION_*
(which actually I should probably do eventually). */
(which actually I should probably do eventually). */
/*
rfbScreen->screen.RegionCreate = miRegionCreate;
rfbScreen->screen.RegionCreate = miRegionCreate;
rfbScreen->screen.RegionInit = miRegionInit;
rfbScreen->screen.RegionInit = miRegionInit;
rfbScreen->screen.RegionCopy = miRegionCopy;
rfbScreen->screen.RegionCopy = miRegionCopy;
...
@@ -426,6 +428,7 @@ rfbScreenInfoPtr rfbDefaultScreenInit(int argc,char** argv,int width,int height,
...
@@ -426,6 +428,7 @@ rfbScreenInfoPtr rfbDefaultScreenInit(int argc,char** argv,int width,int height,
rfbScreen->screen.RegionExtents = miRegionExtents;
rfbScreen->screen.RegionExtents = miRegionExtents;
rfbScreen->screen.RegionAppend = miRegionAppend;
rfbScreen->screen.RegionAppend = miRegionAppend;
rfbScreen->screen.RegionValidate = miRegionValidate;
rfbScreen->screen.RegionValidate = miRegionValidate;
*/
rfbScreen
->
kbdAddEvent
=
defaultKbdAddEvent
;
rfbScreen
->
kbdAddEvent
=
defaultKbdAddEvent
;
rfbScreen
->
kbdReleaseAllKeys
=
doNothingWithClient
;
rfbScreen
->
kbdReleaseAllKeys
=
doNothingWithClient
;
...
...
miregion.c
View file @
5c438e3f
...
@@ -50,10 +50,10 @@ SOFTWARE.
...
@@ -50,10 +50,10 @@ SOFTWARE.
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "miscstruct.h"
#include "
Xserver/
miscstruct.h"
#include "regionstr.h"
#include "
Xserver/
regionstr.h"
#include "Xprotostr.h"
#include "X
11/X
protostr.h"
#include "gc.h"
#include "
Xserver/
gc.h"
#if defined (__GNUC__) && !defined (NO_INLINES)
#if defined (__GNUC__) && !defined (NO_INLINES)
#define INLINE __inline
#define INLINE __inline
...
@@ -61,6 +61,13 @@ SOFTWARE.
...
@@ -61,6 +61,13 @@ SOFTWARE.
#define INLINE
#define INLINE
#endif
#endif
#undef xalloc
#undef xrealloc
#undef xfree
#define xalloc malloc
#define xrealloc realloc
#define xfree free
/*
/*
* hack until callers of these functions can deal with out-of-memory
* hack until callers of these functions can deal with out-of-memory
*/
*/
...
...
pnmshow.c
View file @
5c438e3f
#include <stdio.h>
#include <stdio.h>
#include "rfb.h"
#include "rfb.h"
#define XK_MISCELLANY
#include "keysym.h"
#include "keysymdef.h"
void
HandleKey
(
Bool
down
,
KeySym
key
,
rfbClientPtr
cl
)
void
HandleKey
(
Bool
down
,
KeySym
key
,
rfbClientPtr
cl
)
{
{
...
@@ -52,12 +51,20 @@ int main(int argc,char** argv)
...
@@ -52,12 +51,20 @@ int main(int argc,char** argv)
/* allocate picture and read it */
/* allocate picture and read it */
rfbScreen
->
frameBuffer
=
(
char
*
)
malloc
(
width
*
height
*
4
);
rfbScreen
->
frameBuffer
=
(
char
*
)
malloc
(
width
*
height
*
4
);
fread
(
rfbScreen
->
frameBuffer
,
width
*
3
,
height
,
in
);
fread
(
rfbScreen
->
frameBuffer
,
width
*
3
,
height
,
in
);
fclose
(
in
);
/* correct the format to 4 bytes instead of 3 */
/* correct the format to 4 bytes instead of 3 */
for
(
i
=
width
*
height
-
1
;
i
>=
0
;
i
--
)
{
for
(
i
=
width
*
height
-
1
;
i
>=
0
;
i
--
)
{
rfbScreen
->
frameBuffer
[
i
*
4
+
3
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
2
];
rfbScreen
->
frameBuffer
[
i
*
4
+
2
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
0
];
rfbScreen
->
frameBuffer
[
i
*
4
+
2
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
1
];
rfbScreen
->
frameBuffer
[
i
*
4
+
1
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
1
];
rfbScreen
->
frameBuffer
[
i
*
4
+
1
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
0
];
rfbScreen
->
frameBuffer
[
i
*
4
+
0
]
=
rfbScreen
->
frameBuffer
[
i
*
3
+
2
];
}
for
(
i
=
0
;
i
<
200
;
i
++
)
{
rfbScreen
->
frameBuffer
[
i
*
4
+
i
*
width
*
4
]
=
0
;
rfbScreen
->
frameBuffer
[
i
*
4
+
i
*
width
*
4
+
1
]
=
0
;
rfbScreen
->
frameBuffer
[
i
*
4
+
i
*
width
*
4
+
2
]
=
0
;
rfbScreen
->
frameBuffer
[
i
*
4
+
i
*
width
*
4
+
3
]
=
0
;
}
}
/* run event loop */
/* run event loop */
...
...
rfb.h
View file @
5c438e3f
...
@@ -25,12 +25,69 @@
...
@@ -25,12 +25,69 @@
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include "scrnintstr.h"
//
#include "scrnintstr.h"
/* trying to replace the above with some more minimal set of includes */
/* trying to replace the above with some more minimal set of includes */
#include "misc.h"
//#include "misc.h"
#include "Xmd.h"
//#include "Xmd.h"
#include "regionstr.h"
/* TODO: this stuff has to go into autoconf */
typedef
unsigned
char
CARD8
;
typedef
unsigned
short
CARD16
;
typedef
unsigned
int
CARD32
;
typedef
CARD32
Pixel
;
typedef
CARD32
KeySym
;
typedef
signed
char
Bool
;
#define FALSE 0
#define TRUE -1
#include "keysym.h"
/* region stuff */
#define NullRegion ((RegionPtr)0)
#define NullBox ((BoxPtr)0)
typedef
struct
_Box
{
short
x1
,
y1
,
x2
,
y2
;
}
BoxRec
,
*
BoxPtr
;
typedef
struct
_RegData
{
long
size
;
long
numRects
;
/* BoxRec rects[size]; in memory but not explicitly declared */
}
RegDataRec
,
*
RegDataPtr
;
typedef
struct
_Region
{
BoxRec
extents
;
RegDataPtr
data
;
}
RegionRec
,
*
RegionPtr
;
#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
: &(reg)->extents)
#define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1))
#define REGION_BOX(reg,i) (®ION_BOXPTR(reg)[i])
#define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects)
#define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1)
#define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
#define REGION_INIT(s,pReg,rect,size) miRegionInit(pReg,rect,size)
#define REGION_EMPTY(s,pReg) miRegionEmpty(pReg)
#define REGION_UNINIT(s,pReg) miRegionUninit(pReg)
#define REGION_NOTEMPTY(s,pReg) miRegionNotEmpty(pReg)
#define REGION_INTERSECT(s,newReg,reg1,reg2) miIntersect(newReg,reg1,reg2)
#define REGION_SUBTRACT(s,newReg,reg1,reg2) miSubtract(newReg,reg1,reg2)
#define REGION_UNION(s,newReg,reg1,reg2) miUnion(newReg,reg1,reg2)
#define REGION_TRANSLATE(s,pReg,x,y) miTranslateRegion(pReg,x,y)
//#include "regionstr.h"
#define xalloc malloc
#define xrealloc realloc
#define xfree free
int
max
(
int
,
int
);
#include <zlib.h>
#include <zlib.h>
#include <rfbproto.h>
#include <rfbproto.h>
...
@@ -61,6 +118,7 @@
...
@@ -61,6 +118,7 @@
#define IF_PTHREADS(x)
#define IF_PTHREADS(x)
#endif
#endif
struct
rfbClientRec
;
struct
rfbClientRec
;
struct
rfbScreenInfo
;
struct
rfbScreenInfo
;
struct
rfbCursor
;
struct
rfbCursor
;
...
@@ -136,6 +194,7 @@ typedef struct
...
@@ -136,6 +194,7 @@ typedef struct
/* wrapped screen functions */
/* wrapped screen functions */
/*
CloseScreenProcPtr CloseScreen;
CloseScreenProcPtr CloseScreen;
CreateGCProcPtr CreateGC;
CreateGCProcPtr CreateGC;
PaintWindowBackgroundProcPtr PaintWindowBackground;
PaintWindowBackgroundProcPtr PaintWindowBackground;
...
@@ -143,10 +202,13 @@ typedef struct
...
@@ -143,10 +202,13 @@ typedef struct
CopyWindowProcPtr CopyWindow;
CopyWindowProcPtr CopyWindow;
ClearToBackgroundProcPtr ClearToBackground;
ClearToBackgroundProcPtr ClearToBackground;
RestoreAreasProcPtr RestoreAreas;
RestoreAreasProcPtr RestoreAreas;
*/
/* additions by libvncserver */
/* additions by libvncserver */
/*
ScreenRec screen;
ScreenRec screen;
*/
rfbPixelFormat
rfbServerFormat
;
rfbPixelFormat
rfbServerFormat
;
char
*
desktopName
;
char
*
desktopName
;
char
rfbThisHost
[
255
];
char
rfbThisHost
[
255
];
...
@@ -287,8 +349,10 @@ typedef struct rfbClientRec {
...
@@ -287,8 +349,10 @@ typedef struct rfbClientRec {
milliseconds so that several changes to the framebuffer can be combined
milliseconds so that several changes to the framebuffer can be combined
into a single update. */
into a single update. */
Bool
deferredUpdateScheduled
;
/* no deferred timer here; server has to do it alone */
OsTimerPtr
deferredUpdateTimer
;
/* Bool deferredUpdateScheduled;
OsTimerPtr deferredUpdateTimer; */
/* translateFn points to the translation function which is used to copy
/* translateFn points to the translation function which is used to copy
and translate a rectangle from the framebuffer to an output buffer. */
and translate a rectangle from the framebuffer to an output buffer. */
...
...
rfbserver.c
View file @
5c438e3f
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
#include <pthread.h>
#include <pthread.h>
#endif
#endif
#include "rfb.h"
#include "rfb.h"
#include "region.h"
rfbClientPtr
pointerClient
=
NULL
;
/* Mutex for pointer events */
rfbClientPtr
pointerClient
=
NULL
;
/* Mutex for pointer events */
...
@@ -845,8 +846,8 @@ rfbSendFramebufferUpdate(cl, updateRegion)
...
@@ -845,8 +846,8 @@ rfbSendFramebufferUpdate(cl, updateRegion)
sendCursorShape
=
TRUE
;
sendCursorShape
=
TRUE
;
}
else
{
}
else
{
if
(
!
cl
->
screen
->
cursorIsDrawn
)
if
(
!
cl
->
screen
->
cursorIsDrawn
)
//
rfbDrawCursor(cl);
rfbDrawCursor
(
cl
);
fprintf
(
stderr
,
"rfbSpriteRestoreCursor(pScreen); not yet!
\n
"
);
//
fprintf(stderr,"rfbSpriteRestoreCursor(pScreen); not yet!\n");
}
}
/*
/*
...
@@ -865,9 +866,9 @@ rfbSendFramebufferUpdate(cl, updateRegion)
...
@@ -865,9 +866,9 @@ rfbSendFramebufferUpdate(cl, updateRegion)
* no update is needed.
* no update is needed.
*/
*/
//
REGION_INIT(pScreen,&updateRegion,NullBox,0);
REGION_INIT
(
pScreen
,
&
updateRegion
,
NullBox
,
0
);
//
REGION_UNION(pScreen, &updateRegion, &cl->copyRegion,
REGION_UNION
(
pScreen
,
&
updateRegion
,
&
cl
->
copyRegion
,
//
&cl->modifiedRegion);
&
cl
->
modifiedRegion
);
REGION_INTERSECT
(
pScreen
,
&
updateRegion
,
&
cl
->
requestedRegion
,
REGION_INTERSECT
(
pScreen
,
&
updateRegion
,
&
cl
->
requestedRegion
,
&
updateRegion
);
&
updateRegion
);
...
...
sockets.c
View file @
5c438e3f
...
@@ -61,6 +61,8 @@ struct timeval
...
@@ -61,6 +61,8 @@ struct timeval
#include "rfb.h"
#include "rfb.h"
int
max
(
int
i
,
int
j
)
{
return
(
i
<
j
?
j
:
i
);
}
int
rfbMaxClientWait
=
20000
;
/* time (ms) after which we decide client has
int
rfbMaxClientWait
=
20000
;
/* time (ms) after which we decide client has
gone away - needed to stop us hanging */
gone away - needed to stop us hanging */
...
...
xalloc.c
View file @
5c438e3f
...
@@ -13,12 +13,12 @@
...
@@ -13,12 +13,12 @@
#ifdef WIN32
#ifdef WIN32
#include <X11/Xwinsock.h>
#include <X11/Xwinsock.h>
#endif
#endif
#include "Xos.h"
#include "X
11/X
os.h"
#include <stdio.h>
#include <stdio.h>
#include "misc.h"
#include "
Xserver/
misc.h"
#include "X.h"
#include "X
11/X
.h"
#include "input.h"
#include "
Xserver/
input.h"
#include "opaque.h"
#include "
Xserver/
opaque.h"
#ifdef X_POSIX_C_SOURCE
#ifdef X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
#define _POSIX_C_SOURCE X_POSIX_C_SOURCE
#include <signal.h>
#include <signal.h>
...
...
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