diff --git a/src/actions.c b/src/actions.c index 0519b32d..f6bb009d 100644 --- a/src/actions.c +++ b/src/actions.c @@ -497,8 +497,8 @@ void handleMaximize(WWindow *wwin, int directions) p.y = 0; if (p.x > 0) { - head = wGetHeadForPoint(wwin->screen_ptr, p); - if (head != wGetHeadForWindow(wwin)) { + head = wGetHeadForPointOrNegative(wwin->screen_ptr, p); + if (head != -1) { effective |= MAX_RIGHTHALF; effective |= MAX_VERTICAL; effective &= ~(MAX_HORIZONTAL | MAX_LEFTHALF); @@ -508,8 +508,8 @@ void handleMaximize(WWindow *wwin, int directions) } else if (requested & MAX_RIGHTHALF && current & MAX_RIGHTHALF) { p.x = wwin->frame_x + wwin->frame->core->width + 100; p.y = 0; - head = wGetHeadForPoint(wwin->screen_ptr, p); - if (head != wGetHeadForWindow(wwin)) { + head = wGetHeadForPointOrNegative(wwin->screen_ptr, p); + if (head != -1) { effective |= MAX_LEFTHALF; effective |= MAX_VERTICAL; effective &= ~(MAX_HORIZONTAL | MAX_RIGHTHALF); diff --git a/src/xinerama.c b/src/xinerama.c index 3d261396..4acbc3e4 100644 --- a/src/xinerama.c +++ b/src/xinerama.c @@ -236,7 +236,7 @@ int wGetHeadForWindow(WWindow * wwin) return wGetHeadForRect(wwin->screen_ptr, rect); } -int wGetHeadForPoint(WScreen * scr, WMPoint point) +int wGetHeadForPointOrNegative(WScreen * scr, WMPoint point) { int i; @@ -247,7 +247,17 @@ int wGetHeadForPoint(WScreen * scr, WMPoint point) (unsigned)(point.y - rect->pos.y) < rect->size.height) return i; } - return scr->xine_info.primary_head; + return -1; +} + +int wGetHeadForPoint(WScreen * scr, WMPoint point) +{ + int head = wGetHeadForPointOrNegative(scr, point); + + if (head < 0) + return scr->xine_info.primary_head; + + return head; } int wGetHeadForPointerLocation(WScreen * scr) diff --git a/src/xinerama.h b/src/xinerama.h index fd1d4692..88a35808 100644 --- a/src/xinerama.h +++ b/src/xinerama.h @@ -41,6 +41,8 @@ int wGetHeadForRect(WScreen *scr, WMRect rect); int wGetHeadForWindow(WWindow *wwin); +int wGetHeadForPointOrNegative(WScreen * scr, WMPoint point); + int wGetHeadForPoint(WScreen *scr, WMPoint point); int wGetHeadForPointerLocation(WScreen *scr);