diff options
-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); } |