diff options
author | Christian Beier <dontmind@freeshell.org> | 2009-10-06 18:00:34 +0200 |
---|---|---|
committer | Johannes Schindelin <johannes.schindelin@gmx.de> | 2009-10-06 23:50:02 +0200 |
commit | 471bbeeafc9081b642c3c707ef48977b7d39b713 (patch) | |
tree | 180f7b6007d24d6717469bb1d2b5628a3b0bca0d | |
parent | 21df602d183d37cc8d6e0a6fe43b8060ba821538 (diff) | |
download | libvncserver-beier.zip libvncserver-beier.tar.gz |
x11vnc/screen.c: in -id or -sid mode, resize window to fit into rootwin.beier
this can happen if the user changed the root window size with RandR,
for example.
Signed-off-by: Christian Beier <dontmind@freeshell.org>
-rw-r--r-- | x11vnc/screen.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/x11vnc/screen.c b/x11vnc/screen.c index cf29ae1..f6c175d 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -2366,7 +2366,7 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_ again: if (subwin) { - int shift = 0; + int shift = 0, fit = 0; int subwin_x, subwin_y; int disp_x = DisplayWidth(dpy, scr); int disp_y = DisplayHeight(dpy, scr); @@ -2377,6 +2377,15 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_ XTranslateCoordinates(dpy, window, rootwin, 0, 0, &subwin_x, &subwin_y, &twin); + if (wdpy_x > disp_x ) { + fit = 1; + dpy_x = wdpy_x = disp_x - 3; + } + if (wdpy_y > disp_y) { + fit = 1; + dpy_y = wdpy_y = disp_y - 3; + } + if (subwin_x + wdpy_x > disp_x) { shift = 1; subwin_x = off_x = disp_x - wdpy_x - 3; @@ -2394,6 +2403,9 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_ subwin_y = off_y = 1; } + if (fit) { + XResizeWindow(dpy, window, wdpy_x, wdpy_y); + } if (shift) { XMoveWindow(dpy, window, subwin_x, subwin_y); } |