From f67230cc6c8478af33f8c839d4fddabee470ec03 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 16 Oct 2011 11:13:14 -0400 Subject: [PATCH] check RECT_INTERSECTS_RECT before using RECT_SET_INTERSECTION --- openbox/screen.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) 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); + } } } -- 2.34.1