Commit 2bc615f6 authored by runge's avatar runge

x11vnc -solid color, -opts; tightvnc unix viewer alpha patch

parent 914f7b71
2005-02-05 Karl Runge <runge@karlrunge.com>
* x11vnc: -solid color, -opts/-?
* tightvnc-1.3dev5-vncviewer-alpha-cursor.patch: create, name
says it all.
2005-01-23 Karl Runge <runge@karlrunge.com>
* x11vnc: -timeout, -noalphablend. make -R norepeat work.
* sync with new draw cursor mechanism.
......
--- vnc_unixsrc.orig/vncviewer/cursor.c 2003-01-15 04:46:52.000000000 -0500
+++ vnc_unixsrc/vncviewer/cursor.c 2005-02-05 12:28:10.000000000 -0500
@@ -472,6 +472,140 @@
int offset, bytesPerPixel;
char *pos;
+#define alphahack
+#ifdef alphahack
+ /* hack to have cursor transparency at 32bpp <runge@karlrunge.com> */
+ static int alphablend = -1;
+
+ if (alphablend < 0) {
+ /* you have to set NO_ALPHABLEND=1 in your environment to disable */
+ if (getenv("NO_ALPHABLEND")) {
+ alphablend = 0;
+ } else {
+ alphablend = 1;
+ }
+ }
+
+ bytesPerPixel = myFormat.bitsPerPixel / 8;
+
+ if (alphablend && bytesPerPixel == 4) {
+ unsigned long pixel, put, *upos, *upix;
+ int got_alpha = 0, rsX, rsY, rsW, rsH;
+ static XImage *image = NULL;
+ static int iwidth = 128;
+
+ if (! image) {
+ /* watch out for tiny fb (rare) */
+ if (iwidth > si.framebufferWidth) {
+ iwidth = si.framebufferWidth;
+ }
+ if (iwidth > si.framebufferHeight) {
+ iwidth = si.framebufferHeight;
+ }
+
+ /* initialize an XImage with a chunk of desktopWin */
+ image = XGetImage(dpy, desktopWin, 0, 0, iwidth, iwidth,
+ AllPlanes, ZPixmap);
+ }
+
+ /* first check if there is any non-zero alpha channel data at all: */
+ for (y = 0; y < rcHeight; y++) {
+ for (x = 0; x < rcWidth; x++) {
+ int alpha;
+
+ offset = y * rcWidth + x;
+ pos = (char *)&rcSource[offset * bytesPerPixel];
+
+ upos = (unsigned long *) pos;
+ alpha = (*upos & 0xff000000) >> 24;
+ if (alpha) {
+ got_alpha = 1;
+ break;
+ }
+ }
+ if (got_alpha) {
+ break;
+ }
+ }
+
+ if (!got_alpha) {
+ /* no alpha channel data, fallback to the old way */
+ goto oldway;
+ }
+
+ /* load the saved fb patch in to image (faster way?) */
+ XGetSubImage(dpy, rcSavedArea, 0, 0, rcWidth, rcHeight,
+ AllPlanes, ZPixmap, image, 0, 0);
+ upix = (unsigned long *)image->data;
+
+ /* if the richcursor is clipped, the fb patch will be smaller */
+ rsW = rcWidth;
+ rsX = 0; /* used to denote a shift from the left side */
+ x = rcCursorX - rcHotX;
+ if (x < 0) {
+ rsW += x;
+ rsX = -x;
+ } else if (x + rsW > si.framebufferWidth) {
+ rsW = si.framebufferWidth - x;
+ }
+ rsH = rcHeight;
+ rsY = 0; /* used to denote a shift from the top side */
+ y = rcCursorY - rcHotY;
+ if (y < 0) {
+ rsH += y;
+ rsY = -y;
+ } else if (y + rsH > si.framebufferHeight) {
+ rsH = si.framebufferHeight - y;
+ }
+
+ /*
+ * now loop over the cursor data, blend in the fb values,
+ * and then overwrite the fb (CopyDataToScreen())
+ */
+ for (y = 0; y < rcHeight; y++) {
+ y0 = rcCursorY - rcHotY + y;
+ if (y0 < 0 || y0 >= si.framebufferHeight) {
+ continue; /* clipped */
+ }
+ for (x = 0; x < rcWidth; x++) {
+ int alpha, color_curs, color_fb, i;
+
+ x0 = rcCursorX - rcHotX + x;
+ if (x0 < 0 || x0 >= si.framebufferWidth) {
+ continue; /* clipped */
+ }
+
+ offset = y * rcWidth + x;
+ pos = (char *)&rcSource[offset * bytesPerPixel];
+
+ /* extract secret alpha byte from rich cursor: */
+ upos = (unsigned long *) pos;
+ alpha = (*upos & 0xff000000) >> 24; /* XXX MSB? */
+
+ /* extract the pixel from the fb: */
+ pixel = *(upix + (y-rsY)*iwidth + (x-rsX));
+
+ put = 0;
+ /* for simplicity, blend all 4 bytes */
+ for (i = 0; i < 4; i++) {
+ int sh = i*8;
+ color_curs = ((0xff << sh) & *upos) >> sh;
+ color_fb = ((0xff << sh) & pixel) >> sh;
+
+ /* XXX assumes pre-multipled color_curs */
+ color_fb = color_curs
+ + ((0xff - alpha) * color_fb)/0xff;
+ put |= color_fb << sh;
+ }
+ /* place in the fb: */
+ CopyDataToScreen((char *)&put, x0, y0, 1, 1);
+ }
+ }
+ return;
+ }
+oldway:
+#endif
+
bytesPerPixel = myFormat.bitsPerPixel / 8;
/* FIXME: Speed optimization is possible. */
2005-02-05 Karl Runge <runge@karlrunge.com>
* -solid solid color background when clients are connected.
* -opts/-? to show option names only.
2005-01-23 Karl Runge <runge@karlrunge.com>
* sync with new draw cursor mechanism, keep old way in OLD_TREE.
* add -timeout option, change -alphablend to be default
......
This diff is collapsed.
......@@ -120,6 +120,9 @@ Screen
=DP blackout:
=D xinerama
--
solid
solid_color:
--
= xrandr
=-C:resize,newfbsize,exit xrandr_mode:
padgeom:
......@@ -127,9 +130,9 @@ Screen
Keyboard
norepeat
add_keysyms
skip_keycodes:
modtweak
xkb
skip_keycodes:
--
=FP remap:
--
......@@ -320,6 +323,10 @@ Shows a menu of currently connected VNC clients on the x11vnc server.
Allows you to find more information about them or disconnect them.
You will be prompted to confirm any disconnections.
"
set helptext(solid_color) "
Set the -solid color value.
"
set helptext(xrandr_mode) "
......@@ -390,7 +397,7 @@ will be \"(*none*)\" when there is no connection established.
4) Below the x11 and vnc displays text label is a text area there scrolling
information about actions being taken and commands being run is displayed.
To scroll use PageUp/PageDown or the arrow keys.
To scroll click in the area and use PageUp/PageDown or the arrow keys.
5) At the bottom is an entry area. When one selects a menu item that
requires supplying a string value, the label will be set to the
......@@ -2319,6 +2326,8 @@ proc get_start_x11vnc_cmd {{show_rc 0}} {
set nitem "sb"
} elseif {$nitem == "xrandr_mode"} {
set nitem "xrandr"
} elseif {$nitem == "solid_color"} {
set nitem "solid"
}
lappend cmd "-$nitem"
lappend cmd $menu_var($item)
......
......@@ -126,6 +126,9 @@
" =DP blackout:\n"
" =D xinerama\n"
" --\n"
" solid\n"
" solid_color:\n"
" --\n"
" = xrandr\n"
" =-C:resize,newfbsize,exit xrandr_mode:\n"
" padgeom:\n"
......@@ -133,9 +136,9 @@
"Keyboard\n"
" norepeat\n"
" add_keysyms\n"
" skip_keycodes:\n"
" modtweak\n"
" xkb\n"
" skip_keycodes:\n"
" --\n"
" =FP remap:\n"
" --\n"
......@@ -328,6 +331,10 @@
"You will be prompted to confirm any disconnections.\n"
"\"\n"
"\n"
" set helptext(solid_color) \"\n"
"Set the -solid color value.\n"
"\"\n"
"\n"
" set helptext(xrandr_mode) \"\n"
"Set the -xrandr mode value.\n"
"\"\n"
......@@ -396,7 +403,7 @@
"\n"
"4) Below the x11 and vnc displays text label is a text area there scrolling\n"
"information about actions being taken and commands being run is displayed.\n"
"To scroll use PageUp/PageDown or the arrow keys.\n"
"To scroll click in the area and use PageUp/PageDown or the arrow keys.\n"
"\n"
"5) At the bottom is an entry area. When one selects a menu item that\n"
"requires supplying a string value, the label will be set to the\n"
......@@ -2325,6 +2332,8 @@
" set nitem \"sb\"\n"
" } elseif {$nitem == \"xrandr_mode\"} {\n"
" set nitem \"xrandr\"\n"
" } elseif {$nitem == \"solid_color\"} {\n"
" set nitem \"solid\"\n"
" }\n"
" lappend cmd \"-$nitem\"\n"
" lappend cmd $menu_var($item)\n"
......
.\" This file was automatically generated from x11vnc -help output.
.TH X11VNC "1" "January 2005" "x11vnc " "User Commands"
.TH X11VNC "1" "February 2005" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
version: 0.7.1pre, lastmod: 2005-01-23
version: 0.7.1pre, lastmod: 2005-02-05
.SH SYNOPSIS
.B x11vnc
[OPTION]...
......@@ -351,6 +351,22 @@ Do not use the new copy_tiles() framebuffer mechanism,
just use 1 shm tile for polling. Limits shm segments
used to 3.
.PP
\fB-solid\fR \fI[color]\fR
.IP
To improve performance, when VNC clients are connected
try to change the desktop background to a solid color.
The [color] is optional: the default color is "cyan4".
For a different one specify the X color (rgb.txt name,
e.g. "darkblue" or numerical "#RRGGBB"). Currently
this option only works on GNOME, KDE, and classic X
(i.e. with the background image on the root window).
The "gconftool-2" and "dcop" external commands are
run for GNOME and KDE respectively. Other desktops
won't work, e.g. XFCE (send us the corresponding
commands if you find them). If x11vnc guesses your
desktop incorrectly, you can force it by prefixing
color with "gnome:", "kde:", or "root:".
.PP
\fB-blackout\fR \fIstring\fR
.IP
Black out rectangles on the screen. \fIstring\fR is a
......@@ -426,6 +442,7 @@ Do not process any .x11vncrc file for options.
\fB-h,\fR \fB-help\fR
.IP
Print this help text.
-?, \fB-opts\fR Only list the x11vnc options.
.PP
\fB-V,\fR \fB-version\fR
.IP
......@@ -764,11 +781,11 @@ pointer events). Also note that these modes are not
available in \fB-threads\fR mode which has its own pointer
event handling mechanism.
.IP
To try out the different pointer modes to see
which one gives the best response for your usage,
it is convenient to use the remote control function,
e.g. "x11vnc \fB-R\fR pointer_mode:4" or the tcl/tk gui
(Tuning -> pointer_mode -> n).
To try out the different pointer modes to see which
one gives the best response for your usage, it is
convenient to use the remote control function, for
example "x11vnc \fB-R\fR pm:4" or the tcl/tk gui (Tuning ->
pointer_mode -> n).
.PP
\fB-input_skip\fR \fIn\fR
.IP
......@@ -1065,6 +1082,12 @@ onetile enable \fB-onetile\fR mode. (you may need to
.IP
noonetile disable \fB-onetile\fR mode.
.IP
solid enable \fB-solid\fR mode
.IP
nosolid disable \fB-solid\fR mode.
.IP
solid_color:color set \fB-solid\fR color (and apply it).
.IP
blackout:str set \fB-blackout\fR "str" (empty to disable).
See \fB-blackout\fR for the form of "str"
(basically: WxH+X+Y,...)
......@@ -1130,8 +1153,6 @@ bell enable bell (if supported).
.IP
nobell disable bell.
.IP
bell enable bell (if supported).
.IP
nosel enable \fB-nosel\fR mode.
.IP
sel disable \fB-nosel\fR mode.
......@@ -1315,17 +1336,18 @@ refresh reset close disconnect id sid waitmapped
nowaitmapped flashcmap noflashcmap truecolor notruecolor
overlay nooverlay overlay_cursor overlay_yescursor
nooverlay_nocursor nooverlay_cursor nooverlay_yescursor
overlay_nocursor visual scale viewonly noviewonly shared
noshared forever noforever once timeout deny lock nodeny
unlock connect allowonce allow localhost nolocalhost
accept gone shm noshm flipbyteorder noflipbyteorder
onetile noonetile blackout xinerama noxinerama xrandr
noxrandr xrandr_mode padgeom quiet q noquiet modtweak
nomodtweak xkb noxkb skip_keycodes add_keysyms
noadd_keysyms clear_mods noclear_mods clear_keys
noclear_keys remap repeat norepeat fb nofb bell nobell
sel nosel primary noprimary cursorshape nocursorshape
cursorpos nocursorpos cursor show_cursor noshow_cursor
overlay_nocursor visual scale viewonly noviewonly
shared noshared forever noforever once timeout deny
lock nodeny unlock connect allowonce allow localhost
nolocalhost accept gone shm noshm flipbyteorder
noflipbyteorder onetile noonetile solid_color solid
nosolid blackout xinerama noxinerama xrandr noxrandr
xrandr_mode padgeom quiet q noquiet modtweak nomodtweak
xkb noxkb skip_keycodes add_keysyms noadd_keysyms
clear_mods noclear_mods clear_keys noclear_keys
remap repeat norepeat fb nofb bell nobell sel nosel
primary noprimary cursorshape nocursorshape cursorpos
nocursorpos cursor show_cursor noshow_cursor
nocursor xfixes noxfixes alphacut alphafrac
alpharemove noalpharemove alphablend noalphablend
xwarp xwarppointer noxwarp noxwarppointer buttonmap
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment