diff options
author | runge <runge> | 2008-06-07 21:12:50 +0000 |
---|---|---|
committer | runge <runge> | 2008-06-07 21:12:50 +0000 |
commit | 975b6902344216c2e4b0e1a38320b822639640dc (patch) | |
tree | cb1881214c0c3031f1d0ae9ceb6a6e5a4e12ce37 /x11vnc/xinerama.c | |
parent | a824cf443df899c8d2178a1bd7581057bd7f60d6 (diff) | |
download | libtdevnc-975b6902344216c2e4b0e1a38320b822639640dc.tar.gz libtdevnc-975b6902344216c2e4b0e1a38320b822639640dc.zip |
x11vnc: -clip xineramaN option, -DIGNORE_GETSPNAM for HP-UX.
Print info on SSH_CONNECTION override.
Diffstat (limited to 'x11vnc/xinerama.c')
-rw-r--r-- | x11vnc/xinerama.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/x11vnc/xinerama.c b/x11vnc/xinerama.c index 9097771..c54e7c4 100644 --- a/x11vnc/xinerama.c +++ b/x11vnc/xinerama.c @@ -227,6 +227,76 @@ static void blackout_tiles(void) { } } +static int did_xinerama_clip = 0; + +void check_xinerama_clip(void) { +#if LIBVNCSERVER_HAVE_LIBXINERAMA + int n, k, i, ev, er, juse = -1; + int score[32], is = 0; + XineramaScreenInfo *x; + + if (!clip_str || !dpy) { + return; + } + if (sscanf(clip_str, "xinerama%d", &k) == 1) { + ; + } else if (sscanf(clip_str, "screen%d", &k) == 1) { + ; + } else { + return; + } + + free(clip_str); + clip_str = NULL; + + if (! XineramaQueryExtension(dpy, &ev, &er)) { + return; + } + if (! XineramaIsActive(dpy)) { + return; + } + x = XineramaQueryScreens(dpy, &n); + if (k < 0 || k >= n) { + XFree_wr(x); + return; + } + for (i=0; i < n; i++) { + score[is++] = nabs(x[i].x_org) + nabs(x[i].y_org); + if (is >= 32) { + break; + } + } + for (i=0; i <= k; i++) { + int j, jmon, mon = -1, mox = -1; + for (j=0; j < is; j++) { + if (mon < 0 || score[j] < mon) { + mon = score[j]; + jmon = j; + } + if (mox < 0 || score[j] > mox) { + mox = score[j]; + } + } + juse = jmon; + score[juse] = mox+1+i; + } + + if (juse >= 0 && juse < n) { + char str[64]; + sprintf(str, "%dx%d+%d+%d", x[juse].width, x[juse].height, + x[juse].x_org, x[juse].y_org); + clip_str = strdup(str); + did_xinerama_clip = 1; + } else { + clip_str = strdup(""); + } + XFree_wr(x); + if (!quiet) { + rfbLog("set -clip to '%s' for xinerama%d\n", clip_str, k); + } +#endif +} + static void initialize_xinerama (void) { #if !LIBVNCSERVER_HAVE_LIBXINERAMA rfbLog("Xinerama: Library libXinerama is not available to determine\n"); @@ -305,6 +375,7 @@ static void initialize_xinerama (void) { } XFree_wr(xineramas); + if (sraRgnEmpty(black_region)) { rfbLog("Xinerama: no blackouts needed (screen fills" " rectangle)\n"); @@ -312,6 +383,10 @@ static void initialize_xinerama (void) { sraRgnDestroy(black_region); return; } + if (did_xinerama_clip) { + rfbLog("Xinerama: no blackouts due to -clip xinerama.\n"); + return; + } /* max len is 10000x10000+10000+10000 (23 chars) per geometry */ rcnt = (int) sraRgnCountRects(black_region); |