summaryrefslogtreecommitdiffstats
path: root/x11vnc/util.c
diff options
context:
space:
mode:
authorrunge <runge>2006-06-13 02:35:28 +0000
committerrunge <runge>2006-06-13 02:35:28 +0000
commit06a401f8f81b1fcf94bce6c99e4823d6e697881c (patch)
treea975775f83fae8e7f5351ddc1f12384278f27660 /x11vnc/util.c
parent7a3e236390501c14b9d75d80ea88f8a3e69a337a (diff)
downloadlibtdevnc-06a401f8f81b1fcf94bce6c99e4823d6e697881c.tar.gz
libtdevnc-06a401f8f81b1fcf94bce6c99e4823d6e697881c.zip
x11vnc: -display WAIT:cmd=FINDDISPLAY, HTTPONCE, -http_ssl option, Java fixes.
Diffstat (limited to 'x11vnc/util.c')
-rw-r--r--x11vnc/util.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/x11vnc/util.c b/x11vnc/util.c
index caba756..1995164 100644
--- a/x11vnc/util.c
+++ b/x11vnc/util.c
@@ -47,6 +47,8 @@ void rfbCFD(long usec);
double rect_overlap(int x1, int y1, int x2, int y2, int X1, int Y1,
int X2, int Y2);
+char *choose_title(char *display);
+
/*
* routine to keep 0 <= i < n, should use in more places...
@@ -448,3 +450,32 @@ double rect_overlap(int x1, int y1, int x2, int y2, int X1, int Y1,
return o;
}
+/*
+ * choose a desktop name
+ */
+char *choose_title(char *display) {
+ static char title[(MAXN+10)];
+ strcpy(title, "x11vnc");
+
+ if (display == NULL) {
+ display = getenv("DISPLAY");
+ }
+ if (display == NULL) {
+ return title;
+ }
+ title[0] = '\0';
+ if (display[0] == ':') {
+ if (this_host() != NULL) {
+ strncpy(title, this_host(), MAXN - strlen(title));
+ }
+ }
+ strncat(title, display, MAXN - strlen(title));
+ if (subwin && valid_window(subwin, NULL, 0)) {
+ char *name;
+ if (dpy && XFetchName(dpy, subwin, &name)) {
+ strncat(title, " ", MAXN - strlen(title));
+ strncat(title, name, MAXN - strlen(title));
+ }
+ }
+ return title;
+}