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
58551e93
Commit
58551e93
authored
Dec 15, 2002
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small fixes: in X11/Xlib.h Bool is int (Karl Runge); indexed colour support
parent
2d44cfd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
44 deletions
+70
-44
x11vnc.c
contrib/x11vnc.c
+70
-44
No files found.
contrib/x11vnc.c
View file @
58551e93
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
*
*
* This program is based heavily on the following programs:
* This program is based heavily on the following programs:
*
*
* x11vnc.c of the libvncserver project (Johannes E. Schindelin)
*
original
x11vnc.c of the libvncserver project (Johannes E. Schindelin)
* krfb, the KDE desktopsharing project (Tim Jansen)
* krfb, the KDE desktopsharing project (Tim Jansen)
* x0rfbserver, the original native X vnc server (Jens Wagner)
* x0rfbserver, the original native X vnc server (Jens Wagner)
*
*
...
@@ -62,9 +62,6 @@
...
@@ -62,9 +62,6 @@
* -lsocket -lnsl -L/usr/X/lib -R/usr/X/lib -lX11 -lXext -lXtst
* -lsocket -lnsl -L/usr/X/lib -R/usr/X/lib -lX11 -lXext -lXtst
*/
*/
#define KeySym RFBKeySym
#include "rfb.h"
#include <unistd.h>
#include <unistd.h>
#include <sys/ipc.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/shm.h>
...
@@ -74,7 +71,15 @@
...
@@ -74,7 +71,15 @@
#include <X11/extensions/XTest.h>
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>
#include <X11/keysym.h>
#ifdef Bool
#undef Bool
#endif
#define Bool RFBBool
#define KeySym RFBKeySym
#include "rfb.h"
Display
*
dpy
=
0
;
Display
*
dpy
=
0
;
int
scr
;
int
dpy_x
,
dpy_y
;
int
dpy_x
,
dpy_y
;
int
bpp
;
int
bpp
;
int
window
;
int
window
;
...
@@ -222,10 +227,12 @@ static void keyboard(Bool down, KeySym keysym, rfbClientPtr client) {
...
@@ -222,10 +227,12 @@ static void keyboard(Bool down, KeySym keysym, rfbClientPtr client) {
X_LOCK
X_LOCK
k
=
XKeysymToKeycode
(
dpy
,
keysym
);
/* KeySym is XID in <X11/X.h> */
k
=
XKeysymToKeycode
(
dpy
,
(
XID
)
keysym
);
if
(
k
!=
NoSymbol
)
{
if
(
k
!=
NoSymbol
)
{
XTestFakeKeyEvent
(
dpy
,
k
,
down
,
CurrentTime
);
/* Bool is int in <X11/Xlib.h> */
XTestFakeKeyEvent
(
dpy
,
k
,
(
int
)
down
,
CurrentTime
);
XFlush
(
dpy
);
XFlush
(
dpy
);
got_user_input
++
;
got_user_input
++
;
...
@@ -314,12 +321,31 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
...
@@ -314,12 +321,31 @@ void initialize_screen(int *argc, char **argv, XImage *fb) {
if
(
screen
->
rfbServerFormat
.
bitsPerPixel
==
8
)
{
if
(
screen
->
rfbServerFormat
.
bitsPerPixel
==
8
)
{
/* 8 bpp */
/* 8 bpp */
screen
->
rfbServerFormat
.
redShift
=
0
;
if
(
CellsOfScreen
(
ScreenOfDisplay
(
dpy
,
scr
)))
{
screen
->
rfbServerFormat
.
greenShift
=
2
;
/* indexed colour */
screen
->
rfbServerFormat
.
blueShift
=
5
;
XColor
color
[
256
];
screen
->
rfbServerFormat
.
redMax
=
3
;
int
i
;
screen
->
rfbServerFormat
.
greenMax
=
7
;
screen
->
colourMap
.
count
=
256
;
screen
->
rfbServerFormat
.
blueMax
=
3
;
screen
->
rfbServerFormat
.
trueColour
=
FALSE
;
screen
->
colourMap
.
is16
=
TRUE
;
for
(
i
=
0
;
i
<
256
;
i
++
)
color
[
i
].
pixel
=
i
;
XQueryColors
(
dpy
,
DefaultColormap
(
dpy
,
scr
),
color
,
256
);
screen
->
colourMap
.
data
.
shorts
=
(
unsigned
short
*
)
malloc
(
3
*
sizeof
(
short
)
*
screen
->
colourMap
.
count
);
for
(
i
=
0
;
i
<
screen
->
colourMap
.
count
;
i
++
)
{
screen
->
colourMap
.
data
.
shorts
[
i
*
3
+
0
]
=
color
[
i
].
red
;
screen
->
colourMap
.
data
.
shorts
[
i
*
3
+
1
]
=
color
[
i
].
green
;
screen
->
colourMap
.
data
.
shorts
[
i
*
3
+
2
]
=
color
[
i
].
blue
;
}
}
else
{
/* true colour */
screen
->
rfbServerFormat
.
redShift
=
0
;
screen
->
rfbServerFormat
.
greenShift
=
2
;
screen
->
rfbServerFormat
.
blueShift
=
5
;
screen
->
rfbServerFormat
.
redMax
=
3
;
screen
->
rfbServerFormat
.
greenMax
=
7
;
screen
->
rfbServerFormat
.
blueMax
=
3
;
}
}
else
{
}
else
{
/* general case ... */
/* general case ... */
screen
->
rfbServerFormat
.
redShift
=
0
;
screen
->
rfbServerFormat
.
redShift
=
0
;
...
@@ -676,7 +702,7 @@ void copy_tile(int tx, int ty) {
...
@@ -676,7 +702,7 @@ void copy_tile(int tx, int ty) {
}
}
X_UNLOCK
X_UNLOCK
src
=
(
unsigned
char
*
)
tile
->
data
;
src
=
tile
->
data
;
dst
=
screen
->
frameBuffer
+
y
*
bytes_per_line
+
x
*
pixelsize
;
dst
=
screen
->
frameBuffer
+
y
*
bytes_per_line
+
x
*
pixelsize
;
s_src
=
src
;
s_src
=
src
;
...
@@ -1034,7 +1060,7 @@ int scan_display(int ystart, int rescan) {
...
@@ -1034,7 +1060,7 @@ int scan_display(int ystart, int rescan) {
}
}
/* set ptrs to correspond to the x offset: */
/* set ptrs to correspond to the x offset: */
src
=
(
unsigned
char
*
)
scanline
->
data
+
x
*
pixelsize
;
src
=
scanline
->
data
+
x
*
pixelsize
;
dst
=
screen
->
frameBuffer
+
y
*
bytes_per_line
dst
=
screen
->
frameBuffer
+
y
*
bytes_per_line
+
x
*
pixelsize
;
+
x
*
pixelsize
;
...
@@ -1185,35 +1211,35 @@ void watch_loop(void) {
...
@@ -1185,35 +1211,35 @@ void watch_loop(void) {
}
}
void
print_help
()
{
void
print_help
()
{
char
help
[]
=
"
char
help
[]
=
x0vnc options:
"x0vnc options:
\n
"
"
\n
"
-defer time time in ms to wait for updates before sending to
"-defer time time in ms to wait for updates before sending to
\n
"
client [rfbDeferUpdateTime] (default %d)
" client [rfbDeferUpdateTime] (default %d)
\n
"
-wait time time in ms to pause between screen polls. used
"-wait time time in ms to pause between screen polls. used
\n
"
to cut down on load (default %d)
" to cut down on load (default %d)
\n
"
"
\n
"
-gaps n heuristic to fill in gaps in rows or cols of n or less
"-gaps n heuristic to fill in gaps in rows or cols of n or less
\n
"
tiles. used to improve text paging (default %d).
" tiles. used to improve text paging (default %d).
\n
"
-grow n heuristic to grow islands of changed tiles n or wider
"-grow n heuristic to grow islands of changed tiles n or wider
\n
"
by checking the tile near the boundary (default %d).
" by checking the tile near the boundary (default %d).
\n
"
-fs f if the fraction of changed tiles in a poll is greater
"-fs f if the fraction of changed tiles in a poll is greater
\n
"
than f, the whole screen is updated (default %.2f)
" than f, the whole screen is updated (default %.2f)
\n
"
-fuzz n tolerance in pixels to mark a tiles edges as changed.
"-fuzz n tolerance in pixels to mark a tiles edges as changed.
\n
"
(default %d).
" (default %d).
\n
"
-hints use krfb/x0rfbserver hints (glue changed adjacent
"-hints use krfb/x0rfbserver hints (glue changed adjacent
\n
"
horizontal tiles into one big rectangle) (default %s).
" horizontal tiles into one big rectangle) (default %s).
\n
"
-nohints do not use hints; send each tile separately.
"-nohints do not use hints; send each tile separately.
\n
"
"
\n
"
-threads use threaded algorithm [rfbRunEventLoop] if compiled
"-threads use threaded algorithm [rfbRunEventLoop] if compiled
\n
"
with threads (default %s).
" with threads (default %s).
\n
"
-nothreads do not use [rfbRunEventLoop].
"-nothreads do not use [rfbRunEventLoop].
\n
"
-viewonly clients can only watch (default %s).
"-viewonly clients can only watch (default %s).
\n
"
-shared VNC display is shared (default %s)
"-shared VNC display is shared (default %s)
\n
"
"
\n
"
These options are passed to libvncserver:
"These options are passed to libvncserver:
\n
"
"
\n
"
"
;
;
fprintf
(
stderr
,
help
,
defer_update
,
waitms
,
gaps_fill
,
grow_fill
,
fprintf
(
stderr
,
help
,
defer_update
,
waitms
,
gaps_fill
,
grow_fill
,
fs_frac
,
tile_fuzz
,
fs_frac
,
tile_fuzz
,
use_hints
?
"on"
:
"off"
,
use_threads
?
"on"
:
"off"
,
use_hints
?
"on"
:
"off"
,
use_threads
?
"on"
:
"off"
,
...
@@ -1225,7 +1251,7 @@ These options are passed to libvncserver:
...
@@ -1225,7 +1251,7 @@ These options are passed to libvncserver:
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
XImage
*
fb
;
XImage
*
fb
;
int
i
,
scr
,
ev
,
er
,
maj
,
min
;
int
i
,
ev
,
er
,
maj
,
min
;
char
*
use_dpy
=
NULL
;
char
*
use_dpy
=
NULL
;
...
...
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