summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrunge <runge>2007-12-16 18:37:22 +0000
committerrunge <runge>2007-12-16 18:37:22 +0000
commit649f5b2b4615ae67d97eff7f3fa246a1ac41edf9 (patch)
tree3e3d3524182cc844b76c239c9a2f3de89e0cfa38
parent899c920eb4708e525c6555e2a6f043c3f999bbcb (diff)
downloadlibtdevnc-649f5b2b.tar.gz
libtdevnc-649f5b2b.zip
x11vnc: setup remote-ctrl file by default on macosx. improve
tkx11vnc wrt attaching to existing server in icon/tray mode.
-rw-r--r--x11vnc/ChangeLog4
-rw-r--r--x11vnc/README6
-rw-r--r--x11vnc/cleanup.c2
-rw-r--r--x11vnc/gui.c10
-rw-r--r--x11vnc/macosxCG.c4
-rw-r--r--x11vnc/remote.c1
-rwxr-xr-xx11vnc/tkx11vnc25
-rw-r--r--x11vnc/tkx11vnc.h25
-rw-r--r--x11vnc/x11vnc.12
-rw-r--r--x11vnc/x11vnc.c42
-rw-r--r--x11vnc/x11vnc_defs.c2
11 files changed, 88 insertions, 35 deletions
diff --git a/x11vnc/ChangeLog b/x11vnc/ChangeLog
index a539267..4f91276 100644
--- a/x11vnc/ChangeLog
+++ b/x11vnc/ChangeLog
@@ -1,3 +1,7 @@
+2007-12-16 Karl Runge <runge@karlrunge.com>
+ * x11vnc: setup remote-ctrl file by default on macosx. improve
+ tkx11vnc wrt attaching to existing server in icon/tray mode.
+
2007-12-15 Karl Runge <runge@karlrunge.com>
* x11vnc: fix find_display and usleep() prototype on macosx.
-display console and check DISPLAY /tmp/...:0 on macosx.
diff --git a/x11vnc/README b/x11vnc/README
index f45476c..ecf8780 100644
--- a/x11vnc/README
+++ b/x11vnc/README
@@ -1,5 +1,5 @@
-x11vnc README file Date: Sat Dec 15 19:10:20 EST 2007
+x11vnc README file Date: Sun Dec 16 13:21:20 EST 2007
The following information is taken from these URLs:
@@ -11842,7 +11842,7 @@ x11vnc: a VNC server for real X displays
Here are all of x11vnc command line options:
% x11vnc -opts (see below for -help long descriptions)
-x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2007-12-15
+x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2007-12-16
x11vnc options:
-display disp -auth file -N
@@ -11961,7 +11961,7 @@ libvncserver-tight-extension options:
% x11vnc -help
-x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2007-12-15
+x11vnc: allow VNC connections to real X11 displays. 0.9.4 lastmod: 2007-12-16
(type "x11vnc -opts" to just list the options.)
diff --git a/x11vnc/cleanup.c b/x11vnc/cleanup.c
index 65e763b..3422d35 100644
--- a/x11vnc/cleanup.c
+++ b/x11vnc/cleanup.c
@@ -140,7 +140,7 @@ void clean_up_exit (int ret) {
#ifdef MACOSX
if (client_connect_file) {
- if (strstr(client_connect_file, "/tmp/x11vnc-macosx-channel.")
+ if (strstr(client_connect_file, "/tmp/x11vnc-macosx-remote")
== client_connect_file) {
unlink(client_connect_file);
}
diff --git a/x11vnc/gui.c b/x11vnc/gui.c
index d6c9fd6..56975f9 100644
--- a/x11vnc/gui.c
+++ b/x11vnc/gui.c
@@ -152,6 +152,16 @@ int tray_embed(Window iconwin, int remove) {
XChangeProperty(dpy, iconwin, xembed_info, xembed_info, 32,
PropModeReplace, (unsigned char *)&info, 2);
+#if 0
+{
+XSizeHints *xszh = XAllocSizeHints();
+xszh->flags = PMinSize;
+xszh->min_width = 24;
+xszh->min_height = 24;
+XSetWMNormalHints(dpy, iconwin, xszh);
+}
+#endif
+
/* kludge for KDE evidently needed... */
tatom = XInternAtom(dpy, "KWM_DOCKWINDOW", False);
XChangeProperty(dpy, iconwin, tatom, tatom, 32, PropModeReplace,
diff --git a/x11vnc/macosxCG.c b/x11vnc/macosxCG.c
index 8152aa3..bd11f6a 100644
--- a/x11vnc/macosxCG.c
+++ b/x11vnc/macosxCG.c
@@ -32,7 +32,7 @@ int macosxCG_get_cursor(void);
void macosxCG_init_key_table(void);
void macosxCG_key_inject(int down, unsigned int keysym);
-CGDirectDisplayID displayID = NULL;
+CGDirectDisplayID displayID = 0;
extern void macosx_log(char *);
extern int collect_non_X_xdamage(int x_in, int y_in, int w_in, int h_in, int call);
@@ -100,7 +100,7 @@ extern void macosxCGP_screensaver_timer_off(void);
extern void macosxCGP_screensaver_timer_on(void);
void macosxCG_init(void) {
- if (displayID == NULL) {
+ if (displayID == 0) {
macosx_log("macosxCG_init: initializing display.\n");
#if 0
dragum();
diff --git a/x11vnc/remote.c b/x11vnc/remote.c
index e01f08c..189eed9 100644
--- a/x11vnc/remote.c
+++ b/x11vnc/remote.c
@@ -52,6 +52,7 @@ int send_remote_cmd(char *cmd, int query, int wait) {
FILE *in = NULL;
if (client_connect_file) {
+ umask(077);
in = fopen(client_connect_file, "w");
if (in == NULL) {
fprintf(stderr, "send_remote_cmd: could not open "
diff --git a/x11vnc/tkx11vnc b/x11vnc/tkx11vnc
index 35984f7..3d4a49f 100755
--- a/x11vnc/tkx11vnc
+++ b/x11vnc/tkx11vnc
@@ -4860,7 +4860,7 @@ proc lmenu {menu} {
}
proc old_balloon {} {
- global client_str saved_client_str
+ global client_str saved_clients_str
set str ""
if {[info exists client_str]} {
if {$client_str != ""} {
@@ -4868,8 +4868,8 @@ proc old_balloon {} {
}
}
if {$str == ""} {
- if {[info exists saved_client_str]} {
- set str $saved_client_str
+ if {[info exists saved_clients_str]} {
+ set str $saved_clients_str
}
}
if {$str != ""} {
@@ -5029,6 +5029,7 @@ proc make_icon {} {
}
$menu add cascade -font $mfont -label "Window View:" -menu $wv
+ $menu add command -font $mfont -label "Dismiss" -command "$menu unpost"
$menu add command -font $mfont -label "Stop x11vnc" -command clean_icon_exit
set items [get_custom_menu_items]
@@ -5047,10 +5048,11 @@ proc make_icon {} {
bind $icon_win <Enter> {set client_balloon_id [after 500 show_client_balloon]}
bind $icon_win <Button> {kill_client_balloon}
bind $icon_win <Leave> {kill_client_balloon}
- bind $icon_win <ButtonPress-2> {kill_client_balloon; show_client_balloon}
+ bind $icon_win <Shift-ButtonRelease-1> {kill_client_balloon; show_client_balloon}
+ bind $icon_win <ButtonRelease-2> {kill_client_balloon; show_client_balloon}
# bind $menu <Leave> "lmenu $menu"
# bind $menu <Enter> "set left_iconwin_menu 0"
-## bind $menu <KeyPress-Escape> "$menu unpost"
+# bind $menu <KeyPress-Escape> "$menu unpost"
bind . <Control-KeyPress-c> {destroy .; exit 0}
@@ -5071,9 +5073,20 @@ proc make_icon {} {
wm iconname . "tkx11vnc"
wm title . "tkx11vnc"
update
- wm deiconify .
+ if {$tray_embed && $tray_running} {
+ wm deiconify .
+ #after 10000 {wm deiconify .; puts "reqheight [winfo reqheight .]"; puts "reqwidth [winfo reqwidth .]"; puts "height [winfo height .]"; puts "width [winfo width .]"}
+ } else {
+ wm deiconify .
+ }
update
+#puts "reqheight [winfo reqheight .]"
+#puts "reqwidth [winfo reqwidth .]"
+#puts "height [winfo height .]"
+#puts "width [winfo width .]"
+#puts "AAA"
+
old_balloon
}
diff --git a/x11vnc/tkx11vnc.h b/x11vnc/tkx11vnc.h
index 022a662..2c76c02 100644
--- a/x11vnc/tkx11vnc.h
+++ b/x11vnc/tkx11vnc.h
@@ -4871,7 +4871,7 @@ char gui_code[] = "";
"}\n"
"\n"
"proc old_balloon {} {\n"
-" global client_str saved_client_str\n"
+" global client_str saved_clients_str\n"
" set str \"\"\n"
" if {[info exists client_str]} {\n"
" if {$client_str != \"\"} {\n"
@@ -4879,8 +4879,8 @@ char gui_code[] = "";
" }\n"
" }\n"
" if {$str == \"\"} {\n"
-" if {[info exists saved_client_str]} {\n"
-" set str $saved_client_str\n"
+" if {[info exists saved_clients_str]} {\n"
+" set str $saved_clients_str\n"
" }\n"
" }\n"
" if {$str != \"\"} {\n"
@@ -5040,6 +5040,7 @@ char gui_code[] = "";
" }\n"
" $menu add cascade -font $mfont -label \"Window View:\" -menu $wv\n"
"\n"
+" $menu add command -font $mfont -label \"Dismiss\" -command \"$menu unpost\"\n"
" $menu add command -font $mfont -label \"Stop x11vnc\" -command clean_icon_exit\n"
"\n"
" set items [get_custom_menu_items]\n"
@@ -5058,10 +5059,11 @@ char gui_code[] = "";
" bind $icon_win <Enter> {set client_balloon_id [after 500 show_client_balloon]}\n"
" bind $icon_win <Button> {kill_client_balloon}\n"
" bind $icon_win <Leave> {kill_client_balloon}\n"
-" bind $icon_win <ButtonPress-2> {kill_client_balloon; show_client_balloon}\n"
+" bind $icon_win <Shift-ButtonRelease-1> {kill_client_balloon; show_client_balloon}\n"
+" bind $icon_win <ButtonRelease-2> {kill_client_balloon; show_client_balloon}\n"
"# bind $menu <Leave> \"lmenu $menu\"\n"
"# bind $menu <Enter> \"set left_iconwin_menu 0\"\n"
-"## bind $menu <KeyPress-Escape> \"$menu unpost\"\n"
+"# bind $menu <KeyPress-Escape> \"$menu unpost\"\n"
"\n"
" bind . <Control-KeyPress-c> {destroy .; exit 0}\n"
"\n"
@@ -5082,9 +5084,20 @@ char gui_code[] = "";
" wm iconname . \"tkx11vnc\"\n"
" wm title . \"tkx11vnc\"\n"
" update\n"
-" wm deiconify .\n"
+" if {$tray_embed && $tray_running} {\n"
+" wm deiconify .\n"
+" #after 10000 {wm deiconify .; puts \"reqheight [winfo reqheight .]\"; puts \"reqwidth [winfo reqwidth .]\"; puts \"height [winfo height .]\"; puts \"width [winfo width .]\"}\n"
+" } else {\n"
+" wm deiconify .\n"
+" }\n"
" update\n"
"\n"
+"#puts \"reqheight [winfo reqheight .]\"\n"
+"#puts \"reqwidth [winfo reqwidth .]\"\n"
+"#puts \"height [winfo height .]\"\n"
+"#puts \"width [winfo width .]\"\n"
+"#puts \"AAA\"\n"
+"\n"
" old_balloon\n"
"}\n"
"\n"
diff --git a/x11vnc/x11vnc.1 b/x11vnc/x11vnc.1
index c69c3fc..171e5a6 100644
--- a/x11vnc/x11vnc.1
+++ b/x11vnc/x11vnc.1
@@ -2,7 +2,7 @@
.TH X11VNC "1" "December 2007" "x11vnc " "User Commands"
.SH NAME
x11vnc - allow VNC connections to real X11 displays
- version: 0.9.4, lastmod: 2007-12-15
+ version: 0.9.4, lastmod: 2007-12-16
.SH SYNOPSIS
.B x11vnc
[OPTION]...
diff --git a/x11vnc/x11vnc.c b/x11vnc/x11vnc.c
index e738cfa..df2c11b 100644
--- a/x11vnc/x11vnc.c
+++ b/x11vnc/x11vnc.c
@@ -3489,26 +3489,38 @@ int main(int argc, char* argv[]) {
if (more_safe) {
launch_gui = 0;
}
- if (launch_gui) {
- int sleep = 0;
- if (SHOW_NO_PASSWORD_WARNING && !nopw) {
- sleep = 1;
- }
+
#ifdef MACOSX
- if (! use_dpy && getenv("DISPLAY") == NULL) {
- /* we need this for gui since no X properties */
- if (! client_connect_file && ! client_connect) {
- int fd;
- char tmp[] = "/tmp/x11vnc-macosx-channel.XXXXXX";
- fd = mkstemp(tmp);
- if (fd >= 0) {
- close(fd);
- client_connect_file = strdup(tmp);
- rfbLog("MacOS X: set -connect file to %s\n", client_connect_file);
+ if (! use_dpy) {
+ /* we need this for gui since no X properties */
+ if (!client_connect_file && !client_connect) {
+ char *user = get_user_name();
+ char *str = (char *) malloc(strlen(user) + strlen("/tmp/x11vnc-macosx-remote.") + 1);
+ struct stat sb;
+ sprintf(str, "/tmp/x11vnc-macosx-remote.%s", user);
+ if (!remote_cmd && !query_cmd) {
+ unlink(str);
+ if (stat(str, &sb) != 0) {
+ int fd = open(str, O_WRONLY|O_EXCL|O_CREAT, 0600);
+ if (fd >= 0) {
+ close(fd);
+ client_connect_file = str;
+ }
}
+ } else {
+ client_connect_file = str;
+ }
+ if (client_connect_file) {
+ rfbLog("MacOS X: set -connect file to %s\n", client_connect_file);
}
}
+ }
#endif
+ if (launch_gui) {
+ int sleep = 0;
+ if (SHOW_NO_PASSWORD_WARNING && !nopw) {
+ sleep = 1;
+ }
do_gui(gui_str, sleep);
}
if (logfile) {
diff --git a/x11vnc/x11vnc_defs.c b/x11vnc/x11vnc_defs.c
index 7090a0b..a3d53c0 100644
--- a/x11vnc/x11vnc_defs.c
+++ b/x11vnc/x11vnc_defs.c
@@ -15,7 +15,7 @@ int xtrap_base_event_type = 0;
int xdamage_base_event_type = 0;
/* date +'lastmod: %Y-%m-%d' */
-char lastmod[] = "0.9.4 lastmod: 2007-12-15";
+char lastmod[] = "0.9.4 lastmod: 2007-12-16";
/* X display info */