Commit b6498656 authored by runge's avatar runge

x11vnc: add gnome, kde, etc. FINDCREATEDISPLAY tags.

parent 570b8e90
2007-04-07 Karl Runge <runge@karlrunge.com>
* x11vnc: add gnome, kde, etc. FINDCREATEDISPLAY tags.
In check_ncache periodically check for changed desktop.
2007-03-24 Karl Runge <runge@karlrunge.com> 2007-03-24 Karl Runge <runge@karlrunge.com>
* x11vnc: reverse SSL connections. -sleepin option. * x11vnc: reverse SSL connections. -sleepin option.
......
x11vnc README file Date: Fri Apr 6 15:54:32 EDT 2007 x11vnc README file Date: Fri Apr 6 23:19:54 EDT 2007
The following information is taken from these URLs: The following information is taken from these URLs:
...@@ -11415,7 +11415,10 @@ Options: ...@@ -11415,7 +11415,10 @@ Options:
(or ge=). This only has an effect in FINDCREATEDISPLAY (or ge=). This only has an effect in FINDCREATEDISPLAY
mode when a virtual X server such as Xvfb is going to mode when a virtual X server such as Xvfb is going to
be created. It sets the width and height of the new be created. It sets the width and height of the new
display, and optionally the color depth as well. display, and optionally the color depth as well. You
can also supply "kde", "gnome", "fvwm", "twm",
or "failsafe" to have the created display use that
mode for the user session.
To disable the option setting set the environment To disable the option setting set the environment
variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc. variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.
......
...@@ -817,7 +817,10 @@ void print_help(int mode) { ...@@ -817,7 +817,10 @@ void print_help(int mode) {
" (or ge=). This only has an effect in FINDCREATEDISPLAY\n" " (or ge=). This only has an effect in FINDCREATEDISPLAY\n"
" mode when a virtual X server such as Xvfb is going to\n" " mode when a virtual X server such as Xvfb is going to\n"
" be created. It sets the width and height of the new\n" " be created. It sets the width and height of the new\n"
" display, and optionally the color depth as well.\n" " display, and optionally the color depth as well. You\n"
" can also supply \"kde\", \"gnome\", \"fvwm\", \"twm\",\n"
" or \"failsafe\" to have the created display use that\n"
" mode for the user session.\n"
"\n" "\n"
" To disable the option setting set the environment\n" " To disable the option setting set the environment\n"
" variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.\n" " variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.\n"
......
...@@ -954,6 +954,22 @@ char create_display[] = ...@@ -954,6 +954,22 @@ char create_display[] =
" echo \"$session\"\n" " echo \"$session\"\n"
" return\n" " return\n"
" fi\n" " fi\n"
" if [ \"X$have_gnome_session\" != \"X\" -a \"X$FD_SESS\" = \"Xgnome\" ]; then\n"
" echo \"$have_gnome_session\"\n"
" return\n"
" elif [ \"X$have_startkde\" != \"X\" -a \"X$FD_SESS\" = \"Xkde\" ]; then\n"
" echo \"$have_startkde\"\n"
" return\n"
" elif [ \"X$have_twm\" != \"X\" -a \"X$FD_SESS\" = \"Xtwm\" ]; then\n"
" echo \"$have_twm\"\n"
" return\n"
" elif [ \"X$have_fvwm2\" != \"X\" -a \"X$FD_SESS\" = \"Xfvwm\" ]; then\n"
" echo \"$have_fvwm2\"\n"
" return\n"
" elif [ \"X$have_xterm\" != \"X\" -a \"X$FD_SESS\" = \"Xfailsafe\" ]; then\n"
" echo \"$have_xterm\"\n"
" return\n"
" fi\n"
" home=`csh -f -c \"echo ~$USER\"`\n" " home=`csh -f -c \"echo ~$USER\"`\n"
" if [ \"X$home\" = \"X\" -o ! -d \"$home\" ]; then\n" " if [ \"X$home\" = \"X\" -o ! -d \"$home\" ]; then\n"
" if [ \"X$have_root\" != \"X\" -a \"X$USER\" != \"Xroot\" ]; then\n" " if [ \"X$have_root\" != \"X\" -a \"X$USER\" != \"Xroot\" ]; then\n"
...@@ -1173,7 +1189,7 @@ char create_display[] = ...@@ -1173,7 +1189,7 @@ char create_display[] =
" if [ \"X$result\" = \"X1\" -a \"X$have_xmodmap\" != \"X\" ]; then\n" " if [ \"X$result\" = \"X1\" -a \"X$have_xmodmap\" != \"X\" ]; then\n"
" if [ \"X$have_root\" = \"X\" ]; then\n" " if [ \"X$have_root\" = \"X\" ]; then\n"
" nohup sh -c \"(\n" " nohup sh -c \"(\n"
" sleep 6;\n" " sleep 10;\n"
" $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n" " $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n"
" -e 'add Shift = Shift_L Shift_R' \\\n" " -e 'add Shift = Shift_L Shift_R' \\\n"
" -e 'keycode any = Control_R' \\\n" " -e 'keycode any = Control_R' \\\n"
...@@ -1186,7 +1202,7 @@ char create_display[] = ...@@ -1186,7 +1202,7 @@ char create_display[] =
" )\" 1>&2 &\n" " )\" 1>&2 &\n"
" else\n" " else\n"
" (\n" " (\n"
" sleep 1;\n" " sleep 6;\n"
" $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n" " $have_xmodmap -display :$N -e 'keycode any = Shift_R' \\\n"
" -e 'add Shift = Shift_L Shift_R' \\\n" " -e 'add Shift = Shift_L Shift_R' \\\n"
" -e 'keycode any = Control_R' \\\n" " -e 'keycode any = Control_R' \\\n"
...@@ -1288,7 +1304,7 @@ char create_display[] = ...@@ -1288,7 +1304,7 @@ char create_display[] =
" p_ok=1\n" " p_ok=1\n"
"fi\n" "fi\n"
"\n" "\n"
"for prog in startx xinit xdm gdm kdm xterm Xdummy Xvfb xauth mcookie md5sum xmodmap startkde gnome-session blackbox fvwm mwm openbox twm windowmaker metacity X Xorg XFree86 Xsun Xsession netstat\n" "for prog in startx xinit xdm gdm kdm xterm Xdummy Xvfb xauth mcookie md5sum xmodmap startkde gnome-session blackbox fvwm2 mwm openbox twm windowmaker metacity X Xorg XFree86 Xsun Xsession netstat\n"
"do\n" "do\n"
" p2=`echo \"$prog\" | sed -e 's/-/_/g'`\n" " p2=`echo \"$prog\" | sed -e 's/-/_/g'`\n"
" eval \"have_$p2=''\"\n" " eval \"have_$p2=''\"\n"
......
...@@ -1505,7 +1505,7 @@ if (0) db = 1; ...@@ -1505,7 +1505,7 @@ if (0) db = 1;
if (strstr(cmd, "FINDCREATEDISPLAY") == cmd) { if (strstr(cmd, "FINDCREATEDISPLAY") == cmd) {
char *opts = strchr(cmd, '-'); char *opts = strchr(cmd, '-');
char st[] = ""; char st[] = "";
char geom[32]; char geom[32], xsess[32];
if (opts) { if (opts) {
opts++; opts++;
if (strstr(opts, "xdmcp")) { if (strstr(opts, "xdmcp")) {
...@@ -1515,6 +1515,7 @@ if (0) db = 1; ...@@ -1515,6 +1515,7 @@ if (0) db = 1;
opts = st; opts = st;
} }
sprintf(geom, "NONE"); sprintf(geom, "NONE");
xsess[0] = '\0';
#if 0 #if 0
if (!keep_unixpw_opts) { if (!keep_unixpw_opts) {
fprintf(stderr, "no keep_unixpw_opts\n"); fprintf(stderr, "no keep_unixpw_opts\n");
...@@ -1524,6 +1525,17 @@ if (!keep_unixpw_opts) { ...@@ -1524,6 +1525,17 @@ if (!keep_unixpw_opts) {
#endif #endif
if (unixpw && keep_unixpw_opts && keep_unixpw_opts[0] != '\0') { if (unixpw && keep_unixpw_opts && keep_unixpw_opts[0] != '\0') {
char *q, *p, *t = strdup(keep_unixpw_opts); char *q, *p, *t = strdup(keep_unixpw_opts);
if (strstr(t, "gnome")) {
sprintf(xsess, "gnome");
} else if (strstr(t, "kde")) {
sprintf(xsess, "kde");
} else if (strstr(t, "twm")) {
sprintf(xsess, "twm");
} else if (strstr(t, "fvwm")) {
sprintf(xsess, "fvwm");
} else if (strstr(t, "failsafe")) {
sprintf(xsess, "failsafe");
}
q = strstr(t, "ge="); q = strstr(t, "ge=");
if (! q) q = strstr(t, "geom="); if (! q) q = strstr(t, "geom=");
if (! q) q = strstr(t, "geometry="); if (! q) q = strstr(t, "geometry=");
...@@ -1555,15 +1567,18 @@ if (!keep_unixpw_opts) { ...@@ -1555,15 +1567,18 @@ if (!keep_unixpw_opts) {
free(t); free(t);
} }
set_env("FD_GEOM", geom); set_env("FD_GEOM", geom);
set_env("FD_SESS", xsess);
if (unixpw && keep_unixpw_user) { if (unixpw && keep_unixpw_user) {
create_cmd = (char *) malloc(strlen(tmp) create_cmd = (char *) malloc(strlen(tmp)
+ strlen("env USER='' /bin/sh ") + strlen("env USER='' ")
+ strlen("env FD_SESS='' ")
+ strlen("env FD_GEOM='' /bin/sh ") + strlen("env FD_GEOM='' /bin/sh ")
+ strlen(keep_unixpw_user) + 1 + strlen(keep_unixpw_user) + 1
+ strlen(geom) + 1 + strlen(geom) + 1
+ strlen(xsess) + 1
+ strlen(opts) + 1); + strlen(opts) + 1);
sprintf(create_cmd, "env USER='%s' FD_GEOM='%s' /bin/sh %s %s", sprintf(create_cmd, "env USER='%s' FD_GEOM='%s' FD_SESS='%s' /bin/sh %s %s",
keep_unixpw_user, geom, tmp, opts); keep_unixpw_user, geom, xsess, tmp, opts);
} else { } else {
create_cmd = (char *) malloc(strlen(tmp) create_cmd = (char *) malloc(strlen(tmp)
+ strlen("/bin/sh ") + 1 + strlen(opts) + 1); + strlen("/bin/sh ") + 1 + strlen(opts) + 1);
......
...@@ -8062,6 +8062,9 @@ void set_ncache_xrootpmap(void) { ...@@ -8062,6 +8062,9 @@ void set_ncache_xrootpmap(void) {
if (use_solid_bg) { if (use_solid_bg) {
image = solid_image(NULL); image = solid_image(NULL);
if (!quiet) {
rfbLog("set_ncache_xrootpmap: solid_image\n");
}
} else if (pmap != None) { } else if (pmap != None) {
Pixmap pixmap = None; Pixmap pixmap = None;
unsigned char *d_pmap; unsigned char *d_pmap;
...@@ -8079,8 +8082,9 @@ void set_ncache_xrootpmap(void) { ...@@ -8079,8 +8082,9 @@ void set_ncache_xrootpmap(void) {
rfbLog("set_ncache_xrootpmap: loading background pixmap: 0x%lx\n", pixmap); rfbLog("set_ncache_xrootpmap: loading background pixmap: 0x%lx\n", pixmap);
} }
} else { } else {
if (!quiet) {
rfbLog("set_ncache_xrootpmap: trying root background\n"); rfbLog("set_ncache_xrootpmap: trying root background\n");
}
} }
if (image == NULL) { if (image == NULL) {
image = solid_root((char *) 0x1); image = solid_root((char *) 0x1);
...@@ -8971,12 +8975,19 @@ if (hack_val == 2) { ...@@ -8971,12 +8975,19 @@ if (hack_val == 2) {
n = 0; n = 0;
ttot = 0; ttot = 0;
if (dt_guess == NULL || now > dt_last + 30) { if (dt_guess == NULL || now > dt_last + 60) {
if (dt_guess) { static char *dt_prev = NULL;
free(dt_guess); dt_prev = dt_guess;
}
dt_guess = strdup(guess_desktop()); dt_guess = strdup(guess_desktop());
if (ncache_xrootpmap && dt_prev && dt_guess) {
if (strcmp(dt_prev, dt_guess)) {
set_ncache_xrootpmap();
}
}
dt_last = now; dt_last = now;
if (dt_prev) {
free(dt_prev);
}
} }
if (dt_guess && !strcmp(dt_guess, "gnome")) { if (dt_guess && !strcmp(dt_guess, "gnome")) {
dt_gnome = 1; dt_gnome = 1;
......
...@@ -962,7 +962,10 @@ Another option is "geom=WxH" or "geom=WxHxD" ...@@ -962,7 +962,10 @@ Another option is "geom=WxH" or "geom=WxHxD"
(or ge=). This only has an effect in FINDCREATEDISPLAY (or ge=). This only has an effect in FINDCREATEDISPLAY
mode when a virtual X server such as Xvfb is going to mode when a virtual X server such as Xvfb is going to
be created. It sets the width and height of the new be created. It sets the width and height of the new
display, and optionally the color depth as well. display, and optionally the color depth as well. You
can also supply "kde", "gnome", "fvwm", "twm",
or "failsafe" to have the created display use that
mode for the user session.
.IP .IP
To disable the option setting set the environment To disable the option setting set the environment
variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc. variable X11VNC_NO_UNIXPW_OPTS=1 before starting x11vnc.
......
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