From 53e0bf08bcbaabfaac73bf7e97a4d15883a4ae65 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 2 May 2016 18:33:36 -0400 Subject: [PATCH] further optimize window smart placement by reducing obstacle calcs previously the obstacle list would build from the bottom up, skipping fullscreen and maximized windows. this would lead to cases where windows would be moved to avoid windows which were fully obscured, and also cases where unnecessarily large amounts of looping would occur related to the existence of maximized windows --- src/bin/e_place.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/bin/e_place.c b/src/bin/e_place.c index f615f7402..adb3e5866 100644 --- a/src/bin/e_place.c +++ b/src/bin/e_place.c @@ -55,20 +55,27 @@ _e_place_cb_sort_cmp(const void *v1, const void *v2) return (*((int *)v1)) - (*((int *)v2)); } +static Eina_Bool +ignore_client_and_break(const E_Client *ec) +{ + if (ec->fullscreen) return EINA_TRUE; + if (ec->maximized) + { + E_Maximize max = ec->maximized & E_MAXIMIZE_DIRECTION; + + if (max == E_MAXIMIZE_FULLSCREEN) return EINA_TRUE; + if (max == E_MAXIMIZE_BOTH) return EINA_TRUE; + } + return EINA_FALSE; +} + static Eina_Bool ignore_client(const E_Client *ec, const Eina_List *skiplist) { if (eina_list_data_find(skiplist, ec)) return EINA_TRUE; if (e_client_util_ignored_get(ec)) return EINA_TRUE; if (!evas_object_visible_get(ec->frame)) return EINA_TRUE; - if (ec->fullscreen) return EINA_TRUE; - if (ec->maximized) - { - E_Maximize max = ec->maximized & E_MAXIMIZE_TYPE; - if (max == E_MAXIMIZE_FULLSCREEN) return EINA_TRUE; - if (max & (E_MAXIMIZE_HORIZONTAL | E_MAXIMIZE_VERTICAL)) return EINA_TRUE; - } return EINA_FALSE; } @@ -80,9 +87,10 @@ _e_place_coverage_client_add(Eina_List *skiplist, int ar, int x, int y, int w, i int iw, ih; int x0, x00, yy0, y00; - E_CLIENT_FOREACH(ec) + E_CLIENT_REVERSE_FOREACH(ec) { if (ignore_client(ec, skiplist)) continue; + if (ignore_client_and_break(ec)) break; x2 = ec->x; y2 = ec->y; w2 = ec->w; h2 = ec->h; if (E_INTERSECTS(x, y, w, h, x2, y2, w2, h2)) { @@ -277,11 +285,12 @@ e_place_desk_region_smart(E_Desk *desk, Eina_List *skiplist, int x, int y, int w } } - E_CLIENT_FOREACH(ec) + E_CLIENT_REVERSE_FOREACH(ec) { int bx, by, bw, bh; if (ignore_client(ec, skiplist)) continue; + if (ignore_client_and_break(ec)) break; bx = ec->x; by = ec->y;