From: Dana Jansens Date: Sun, 16 Oct 2011 15:13:14 +0000 (-0400) Subject: check RECT_INTERSECTS_RECT before using RECT_SET_INTERSECTION X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=f67230cc6c8478af33f8c839d4fddabee470ec03;p=dana%2Fopenbox.git check RECT_INTERSECTS_RECT before using RECT_SET_INTERSECTION --- diff --git a/openbox/screen.c b/openbox/screen.c index 51f41ab5..35366beb 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -1680,22 +1680,24 @@ guint screen_find_monitor(const Rect *search) monitor = screen_physical_area_monitor(config_primary_monitor_index); - RECT_SET_INTERSECTION(on_current_monitor, *monitor, *search); - area = RECT_AREA(on_current_monitor); + if (RECT_INTERSECTS_RECT(*monitor, *search)) { + RECT_SET_INTERSECTION(on_current_monitor, *monitor, *search); + area = RECT_AREA(on_current_monitor); - if (area > mostpx) { - mostpx = area; - most = config_primary_monitor_index; - } + if (area > mostpx) { + mostpx = area; + most = config_primary_monitor_index; + } - /* add the intersection rect on the current monitor to the - counted list. that's easy for the first one, we just mark it for - subtraction */ - { - RectArithmetic *ra = g_slice_new(RectArithmetic); - ra->r = on_current_monitor; - ra->subtract = TRUE; - counted = g_slist_prepend(counted, ra); + /* add the intersection rect on the current monitor to the + counted list. that's easy for the first one, we just mark it for + subtraction */ + { + RectArithmetic *ra = g_slice_new(RectArithmetic); + ra->r = on_current_monitor; + ra->subtract = TRUE; + counted = g_slist_prepend(counted, ra); + } } }