From 471bbeeafc9081b642c3c707ef48977b7d39b713 Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Tue, 6 Oct 2009 18:00:34 +0200 Subject: x11vnc/screen.c: in -id or -sid mode, resize window to fit into rootwin. this can happen if the user changed the root window size with RandR, for example. Signed-off-by: Christian Beier --- x11vnc/screen.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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); } -- cgit v1.1