From: Carsten Haitzler Date: Wed, 18 May 2011 23:55:21 +0000 (+0000) Subject: fix shape and shape input handling for dnd shadow tree. X-Git-Tag: submit/efl/20131015.063327~9511 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=480d967c55f9d9c097f75e6b6881001a2b94b4a7;p=platform%2Fupstream%2Fefl.git fix shape and shape input handling for dnd shadow tree. SVN revision: 59517 --- diff --git a/legacy/ecore/ChangeLog b/legacy/ecore/ChangeLog index e252db3e22..444271ce3e 100644 --- a/legacy/ecore/ChangeLog +++ b/legacy/ecore/ChangeLog @@ -186,3 +186,9 @@ 2011-05-17 Cedric Bail * Add ecore_timer_dump. + +2011-05-19 Carsten Haitzler (The Rasterman) + + * Fix Ecore_X shadow tree search handling to respect shape and + shape input of windows. + diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c index f13652bfbc..c5f3c35239 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window.c @@ -1003,6 +1003,28 @@ _ecore_x_window_shadow_tree_find(Window base) return NULL; } /* _ecore_x_window_shadow_tree_find */ +static int +_inside_rects(Shadow *s, int x, int y, int bx, int by, Ecore_X_Rectangle *rects, int num) +{ + int i, inside; + + if (!rects) return 0; + inside = 0; + for (i = 0; i < num; i++) + { + if ((x >= s->x + bx + rects[i].x) && + (y >= s->y + by + rects[i].y) && + (x < (int)(s->x + bx + rects[i].width)) && + (y < (int)(s->y + by + rects[i].height))) + { + inside = 1; + break; + } + } + free(rects); + return inside; +} + static Window _ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, @@ -1020,6 +1042,19 @@ _ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, wy = s->y + by; if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h)))) return 0; + + /* FIXME: get shape */ + { + int num; + Ecore_X_Rectangle *rects; + + num = 0; + rects = ecore_x_window_shape_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + num = 0; + rects = ecore_x_window_shape_input_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + } if (s->children) { diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c index b9dd944d39..51c2010acb 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c @@ -619,9 +619,23 @@ ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret) if (num_ret) *num_ret = num; return rects; #else + // have to return fake shape input rect of size of window + Window dw; + unsigned int di; + if (num_ret) *num_ret = 0; - return NULL; - win = 0; + rects = malloc(sizeof(Ecore_X_Rectangle)); + if (!rects) return NULL; + if (!XGetGeometry(_ecore_x_disp, win, &dw, + &(rects[i].x), &(rects[i].y), + &(rects[i].width), &(rects[i].height), + &di, &di)) + { + free(rects); + return NULL; + } + if (num_ret) *num_ret = 1; + return rects; #endif } /* ecore_x_window_shape_input_rectangles_get */