Skip to content

Commit

Permalink
winwidget.c: resize: Fix non-fulllscreen Xinerama issues on screens =…
Browse files Browse the repository at this point in the history
…! 1 (see #5)
  • Loading branch information
derf committed Aug 30, 2011
1 parent 3d9b852 commit 13bb867
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ git HEAD
<https://github.com/derf/feh/issues/60>
* The --collage option (aka collage mode) is now deprecated
* The --filelist option now supports /dev/stdin (or "-" as shortcut)
* Partial fix for too large windows with Xinerama (only works on screen 0)
* Several Xinerama fixes, only --fullscreen on screen != 0 is still broken
<https://github.com/derf/feh/issues/5>

Tue, 16 Aug 2011 22:48:06 +0200 Daniel Friesel <derf@finalrewind.org>
Expand Down
4 changes: 2 additions & 2 deletions man/feh.pre
Original file line number Diff line number Diff line change
Expand Up @@ -1308,9 +1308,9 @@ section.
.
.Sh BUGS
.
Xinerama support does not really work on Xinerama screens != 0. Set
In a Xinerama setup, fullscreen mode only works properly on screen 0. Set
.Ev XINERAMA_SCREEN
to the correct number as a workaround.
to the correct screen number or toggle fullscreen off, then on as a workaround.
.
.Pp
.
Expand Down
45 changes: 23 additions & 22 deletions src/winwidget.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,26 +778,45 @@ void winwidget_resize(winwidget winwid, int w, int h)
int scr_width = scr->width;
int scr_height = scr->height;

XGetWindowAttributes(disp, winwid->win, &attributes);

#ifdef HAVE_LIBXINERAMA
if (opt.xinerama && xinerama_screens) {
int i;
xinerama_screen = 0;
for (i = 0; i < num_xinerama_screens; i++) {
if (XY_IN_RECT(attributes.x, attributes.y,
xinerama_screens[i].x_org,
xinerama_screens[i].y_org,
xinerama_screens[i].width, xinerama_screens[i].height)) {
xinerama_screen = i;
break;
}

}
if (getenv("XINERAMA_SCREEN"))
xinerama_screen = atoi(getenv("XINERAMA_SCREEN"));

scr_width = xinerama_screens[xinerama_screen].width;
scr_height = xinerama_screens[xinerama_screen].height;
}
#endif


D((" x %d y %d w %d h %d\n", attributes.x, attributes.y, winwid->w,
winwid->h));

if (opt.geom_flags) {
winwid->had_resize = 1;
return;
}
if (winwid && ((winwid->w != w) || (winwid->h != h))) {
D(("Really doing a resize\n"));
/* winwidget_clear_background(winwid); */
if (opt.screen_clip) {
winwid->w = (w > scr_width) ? scr_width : w;
winwid->h = (h > scr_height) ? scr_height : h;
}
if (winwid->full_screen) {
XGetWindowAttributes(disp, winwid->win, &attributes);
XTranslateCoordinates(disp, winwid->win, attributes.root,
-attributes.border_width -
attributes.x,
Expand All @@ -811,26 +830,8 @@ void winwidget_resize(winwidget winwid, int w, int h)
winwid->had_resize = 1;
XFlush(disp);

#ifdef HAVE_LIBXINERAMA
/* TODO this section _might_ no longer be needed */
if (opt.xinerama && xinerama_screens) {
int i;

for (i = 0; i < num_xinerama_screens; i++) {
xinerama_screen = 0;
if (XY_IN_RECT(winwid->x, winwid->y,
xinerama_screens[i].x_org,
xinerama_screens[i].y_org,
xinerama_screens[i].width, xinerama_screens[i].height)) {
xinerama_screen = i;
break;
}

}
if (getenv("XINERAMA_SCREEN"))
xinerama_screen = atoi(getenv("XINERAMA_SCREEN"));
}
#endif /* HAVE_LIBXINERAMA */
D(("-> x %d y %d w %d h %d\n", winwid->x, winwid->y, winwid->w,
winwid->h));

} else {
D(("No resize actually needed\n"));
Expand Down

0 comments on commit 13bb867

Please sign in to comment.