fix shape and shape input handling for dnd shadow tree.

SVN revision: 59517
This commit is contained in:
Carsten Haitzler 2011-05-18 23:55:21 +00:00
parent 008e1a56ac
commit 480d967c55
3 changed files with 57 additions and 2 deletions

View File

@ -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.

View File

@ -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)
{

View File

@ -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 */