Commit 471bbeea authored by Christian Beier's avatar Christian Beier Committed by Johannes Schindelin

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: 's avatarChristian Beier <dontmind@freeshell.org>
parent 21df602d
...@@ -2366,7 +2366,7 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_ ...@@ -2366,7 +2366,7 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_
again: again:
if (subwin) { if (subwin) {
int shift = 0; int shift = 0, fit = 0;
int subwin_x, subwin_y; int subwin_x, subwin_y;
int disp_x = DisplayWidth(dpy, scr); int disp_x = DisplayWidth(dpy, scr);
int disp_y = DisplayHeight(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_ ...@@ -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, XTranslateCoordinates(dpy, window, rootwin, 0, 0, &subwin_x,
&subwin_y, &twin); &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) { if (subwin_x + wdpy_x > disp_x) {
shift = 1; shift = 1;
subwin_x = off_x = disp_x - wdpy_x - 3; 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_ ...@@ -2394,6 +2403,9 @@ if (0) fprintf(stderr, "DefaultDepth: %d visial_id: %d\n", depth, (int) visual_
subwin_y = off_y = 1; subwin_y = off_y = 1;
} }
if (fit) {
XResizeWindow(dpy, window, wdpy_x, wdpy_y);
}
if (shift) { if (shift) {
XMoveWindow(dpy, window, subwin_x, subwin_y); XMoveWindow(dpy, window, subwin_x, subwin_y);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment