From ec84855e6a585a8352267cb44b6f5496306ad3ea Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 5 Oct 2007 12:11:55 +0000 Subject: [PATCH] use the shadowed window tree from ecore SVN revision: 31977 --- src/bin/e_border.c | 26 ++++++++++++++++++ src/bin/e_desk.c | 4 +++ src/bin/e_dnd.c | 66 +++++++++++++++++++++++++++------------------- src/bin/e_dnd.h | 1 + 4 files changed, 70 insertions(+), 27 deletions(-) diff --git a/src/bin/e_border.c b/src/bin/e_border.c index 930963161..04d8cfc68 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -227,6 +227,7 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map, int internal) bd = E_OBJECT_ALLOC(E_Border, E_BORDER_TYPE, _e_border_free); if (!bd) return NULL; + ecore_x_window_shadow_tree_flush(); e_object_del_func_set(E_OBJECT(bd), E_OBJECT_CLEANUP_FUNC(_e_border_del)); bd->w = 1; @@ -522,6 +523,7 @@ e_border_res_change_geometry_restore(E_Border *bd) if (!bd->pre_res_change.valid) return; if (bd->new_client) return; + ecore_x_window_shadow_tree_flush(); memcpy(&pre_res_change, &bd->pre_res_change, sizeof(pre_res_change)); if (bd->fullscreen) @@ -641,6 +643,7 @@ e_border_desk_set(E_Border *bd, E_Desk *desk) E_OBJECT_CHECK(desk); E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE); if (bd->desk == desk) return; + ecore_x_window_shadow_tree_flush(); bd->desk = desk; e_border_zone_set(bd, desk->zone); @@ -683,6 +686,7 @@ e_border_show(E_Border *bd) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if (bd->visible) return; + ecore_x_window_shadow_tree_flush(); e_container_shape_show(bd->shape); if (!bd->need_reparent) ecore_x_window_show(bd->client.win); @@ -709,6 +713,7 @@ e_border_hide(E_Border *bd, int manage) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if (!bd->visible) return; + ecore_x_window_shadow_tree_flush(); if (bd->moving) _e_border_move_end(bd); if (bd->fullscreen) @@ -775,6 +780,7 @@ e_border_move(E_Border *bd, int x, int y) if ((bd->fullscreen) || (((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN) && (!e_config->allow_manip))) return; + ecore_x_window_shadow_tree_flush(); if (bd->new_client) { E_Border_Pending_Move_Resize *pnd; @@ -852,6 +858,7 @@ e_border_resize(E_Border *bd, int w, int h) if ((bd->shaded) || (bd->shading) || (bd->fullscreen) || (((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN) && (!e_config->allow_manip))) return; + ecore_x_window_shadow_tree_flush(); if (bd->new_client) { E_Border_Pending_Move_Resize *pnd; @@ -911,6 +918,7 @@ e_border_move_resize(E_Border *bd, int x, int y, int w, int h) if ((bd->fullscreen) || (((bd->maximized & E_MAXIMIZE_TYPE) == E_MAXIMIZE_FULLSCREEN) && (!e_config->allow_manip))) return; + ecore_x_window_shadow_tree_flush(); if (bd->new_client) { E_Border_Pending_Move_Resize *pnd; @@ -979,6 +987,8 @@ e_border_layer_set(E_Border *bd, int layer) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); + ecore_x_window_shadow_tree_flush(); + raise = e_config->transient.raise; bd->saved.layer = bd->layer; @@ -1015,6 +1025,8 @@ e_border_raise(E_Border *bd) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); + ecore_x_window_shadow_tree_flush(); + if (e_config->transient.raise) { for (l = evas_list_last(bd->transients); l; l = l->prev) @@ -1102,6 +1114,8 @@ e_border_lower(E_Border *bd) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); + ecore_x_window_shadow_tree_flush(); + if (e_config->transient.lower) { for (l = evas_list_last(bd->transients); l; l = l->prev) @@ -1190,6 +1204,8 @@ e_border_stack_above(E_Border *bd, E_Border *above) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); + ecore_x_window_shadow_tree_flush(); + if (e_config->transient.raise) { for (l = evas_list_last(bd->transients); l; l = l->prev) @@ -1246,6 +1262,8 @@ e_border_stack_below(E_Border *bd, E_Border *below) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); + ecore_x_window_shadow_tree_flush(); + if (e_config->transient.lower) { for (l = evas_list_last(bd->transients); l; l = l->prev) @@ -1496,6 +1514,7 @@ e_border_shade(E_Border *bd, E_Direction dir) (bd->shading)) return; if ((bd->client.border.name) && (!strcmp("borderless", bd->client.border.name))) return; + ecore_x_window_shadow_tree_flush(); if (!bd->shaded) { // printf("SHADE!\n"); @@ -1584,6 +1603,7 @@ e_border_unshade(E_Border *bd, E_Direction dir) E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if ((bd->fullscreen) || ((bd->maximized) && (!e_config->allow_manip)) || (bd->shading)) return; + ecore_x_window_shadow_tree_flush(); if (bd->shaded) { // printf("UNSHADE!\n"); @@ -1693,6 +1713,7 @@ e_border_maximize(E_Border *bd, E_Maximize max) if (!(max & E_MAXIMIZE_DIRECTION)) max |= E_MAXIMIZE_BOTH; if ((bd->shaded) || (bd->shading)) return; + ecore_x_window_shadow_tree_flush(); if (bd->fullscreen) e_border_unfullscreen(bd); /* Only allow changes in vertical/ horizontal maximization */ @@ -1855,6 +1876,7 @@ e_border_unmaximize(E_Border *bd, E_Maximize max) } if ((bd->shaded) || (bd->shading)) return; + ecore_x_window_shadow_tree_flush(); /* Remove directions not used */ max &= (bd->maximized & E_MAXIMIZE_DIRECTION); /* Can only remove existing maximization directions */ @@ -1984,6 +2006,7 @@ e_border_fullscreen(E_Border *bd, E_Fullscreen policy) E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if ((bd->shaded) || (bd->shading)) return; + ecore_x_window_shadow_tree_flush(); if (bd->maximized) e_border_unmaximize(bd, E_MAXIMIZE_BOTH); if (bd->new_client) @@ -2075,6 +2098,7 @@ e_border_unfullscreen(E_Border *bd) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if ((bd->shaded) || (bd->shading)) return; + ecore_x_window_shadow_tree_flush(); if (bd->fullscreen) { bd->pre_res_change.valid = 0; @@ -2112,6 +2136,7 @@ e_border_iconify(E_Border *bd) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if ((bd->fullscreen) || (bd->shading)) return; + ecore_x_window_shadow_tree_flush(); if (!bd->iconic) { bd->iconic = 1; @@ -2154,6 +2179,7 @@ e_border_uniconify(E_Border *bd) E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); if ((bd->fullscreen) || (bd->shading)) return; + ecore_x_window_shadow_tree_flush(); if (bd->iconic) { bd->iconic = 0; diff --git a/src/bin/e_desk.c b/src/bin/e_desk.c index 35f1ac910..6059c1128 100644 --- a/src/bin/e_desk.c +++ b/src/bin/e_desk.c @@ -208,6 +208,7 @@ e_desk_show(E_Desk *desk) E_OBJECT_TYPE_CHECK(desk, E_DESK_TYPE); if (desk->visible) return; + ecore_x_window_shadow_tree_flush(); for (x = 0; x < desk->zone->desk_x_count; x++) { for (y = 0; y < desk->zone->desk_y_count; y++) @@ -326,6 +327,7 @@ e_desk_deskshow(E_Zone *zone) desk = e_desk_current_get(zone); bl = e_container_border_list_first(zone->container); + ecore_x_window_shadow_tree_flush(); while ((bd = e_container_border_list_next(bl))) { if (bd->desk == desk) @@ -628,6 +630,7 @@ _e_desk_show_end(E_Desk *desk) } } e_container_border_list_free(bl); + ecore_x_window_shadow_tree_flush(); } static int @@ -769,6 +772,7 @@ _e_desk_hide_end(E_Desk *desk) } } e_container_border_list_free(bl); + ecore_x_window_shadow_tree_flush(); } static int diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index a759d282f..33bbc5ec8 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -22,9 +22,9 @@ static void _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win); static void _e_drag_win_show(E_Drop_Handler *h); static void _e_drag_win_hide(E_Drop_Handler *h); -static void _e_drag_update(int x, int y); -static void _e_drag_end(int x, int y); -static void _e_drag_xdnd_end(int x, int y); +static void _e_drag_update(Ecore_X_Window root, int x, int y); +static void _e_drag_end(Ecore_X_Window root, int x, int y); +static void _e_drag_xdnd_end(Ecore_X_Window root, int x, int y); static void _e_drag_free(E_Drag *drag); static int _e_dnd_cb_window_shape(void *data, int type, void *event); @@ -193,6 +193,8 @@ e_drag_new(E_Container *container, int x, int y, _drag_list = evas_list_append(_drag_list, drag); + ecore_x_window_shadow_tree_flush(); + return drag; } @@ -216,8 +218,7 @@ e_drag_move(E_Drag *drag, int x, int y) if ((drag->x == x) && (drag->y == y)) return; drag->x = x; drag->y = y; - ecore_evas_move(drag->ecore_evas, drag->x, drag->y); - e_container_shape_move(drag->shape, drag->x, drag->y); + drag->xy_update = 1; } EAPI void @@ -475,6 +476,12 @@ e_drag_idler_before(void) if (drag->visible) e_container_shape_show(drag->shape); } + if (drag->xy_update) + { + ecore_evas_move(drag->ecore_evas, drag->x, drag->y); + e_container_shape_move(drag->shape, drag->x, drag->y); + drag->xy_update = 0; + } } } @@ -512,12 +519,7 @@ _e_drag_move(E_Drag *drag, int x, int y) drag->x = x - drag->dx; drag->y = y - drag->dy; - ecore_evas_move(drag->ecore_evas, - drag->x, - drag->y); - e_container_shape_move(drag->shape, - drag->x, - drag->y); + drag->xy_update = 1; } static void @@ -642,7 +644,7 @@ _e_drag_win_hide(E_Drop_Handler *h) } static void -_e_drag_update(int x, int y) +_e_drag_update(Ecore_X_Window root, int x, int y) { Evas_List *l; E_Event_Dnd_Enter enter_ev; @@ -655,11 +657,18 @@ _e_drag_update(int x, int y) { ignore_win[0] = _drag_current->evas_win; ignore_win[1] = _drag_win; - /* this is nasty - but necessary to get the window stacking */ - win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); + /* FIXME: this is nasty. every x mouse event we go back to x and do + * a whole bunch of round-trips narrowing down the toplevel window + * which contains the mouse */ + win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, ignore_win, 2); +// win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); } else - win = ecore_x_window_at_xy_with_skip_get(x, y, NULL, 0); + /* FIXME: this is nasty. every x mouse event we go back to x and do + * a whole bunch of round-trips narrowing down the toplevel window + * which contains the mouse */ + win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, NULL, 0); +// win = ecore_x_window_at_xy_with_skip_get(x, y, NULL, 0); if (_drag_current) { @@ -756,7 +765,7 @@ _e_drag_update(int x, int y) } static void -_e_drag_end(int x, int y) +_e_drag_end(Ecore_X_Window root, int x, int y) { E_Zone *zone; Evas_List *l; @@ -768,7 +777,8 @@ _e_drag_end(int x, int y) ignore_win[0] = _drag_current->evas_win; ignore_win[1] = _drag_win; /* this is nasty - but necessary to get the window stacking */ - win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); + win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, ignore_win, 2); +// win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); zone = e_container_zone_at_point_get(_drag_current->container, x, y); /* Pass -1, -1, so that it is possible to drop at the edge. */ if (zone) e_zone_flip_coords_handle(zone, -1, -1); @@ -863,7 +873,7 @@ _e_drag_end(int x, int y) } static void -_e_drag_xdnd_end(int x, int y) +_e_drag_xdnd_end(Ecore_X_Window root, int x, int y) { Evas_List *l; E_Event_Dnd_Drop ev; @@ -875,11 +885,12 @@ _e_drag_xdnd_end(int x, int y) { ignore_win[0] = _drag_current->evas_win; ignore_win[1] = _drag_win; - /* this is nasty - but necessary to get the window stacking */ - win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); + win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, ignore_win, 2); +// win = ecore_x_window_at_xy_with_skip_get(x, y, ignore_win, 2); } else - win = ecore_x_window_at_xy_with_skip_get(x, y, NULL, 0); + win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, NULL, 0); +// win = ecore_x_window_at_xy_with_skip_get(x, y, NULL, 0); ev.data = _xdnd->data; @@ -951,6 +962,7 @@ _e_drag_free(E_Drag *drag) for (i = 0; i < drag->num_types; i++) free(drag->types[i]); free(drag->types); free(drag); + ecore_x_window_shadow_tree_flush(); } @@ -980,7 +992,7 @@ _e_dnd_cb_mouse_up(void *data, int type, void *event) ev = event; if (ev->win != _drag_win) return 1; - _e_drag_end(ev->x, ev->y); + _e_drag_end(ecore_x_window_root_get(ev->win), ev->x, ev->y); return 1; } @@ -993,7 +1005,7 @@ _e_dnd_cb_mouse_move(void *data, int type, void *event) ev = event; if (ev->win != _drag_win) return 1; - _e_drag_update(ev->x, ev->y); + _e_drag_update(ecore_x_window_root_get(ev->win), ev->x, ev->y); return 1; } @@ -1148,7 +1160,7 @@ _e_dnd_cb_event_dnd_position(void *data, int type, void *event) } else { - _e_drag_update(ev->position.x, ev->position.y); + _e_drag_update(ecore_x_window_root_get(ev->win), ev->position.x, ev->position.y); ecore_x_dnd_send_status(1, 0, rect, ECORE_X_DND_ACTION_PRIVATE); } return 1; @@ -1230,7 +1242,7 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event) for (i = 0; i < files->num_files; i++) l = evas_list_append(l, files->files[i]), printf("file: %s\n", files->files[i]); _xdnd->data = l; - _e_drag_xdnd_end(_xdnd->x, _xdnd->y); + _e_drag_xdnd_end(ecore_x_window_root_get(ev->win), _xdnd->x, _xdnd->y); evas_list_free(l); } else if (!strcmp("text/x-moz-url", _xdnd->type)) @@ -1269,12 +1281,12 @@ _e_dnd_cb_event_dnd_selection(void *data, int type, void *event) l = evas_list_append(l, file); _xdnd->data = l; - _e_drag_xdnd_end(_xdnd->x, _xdnd->y); + _e_drag_xdnd_end(ecore_x_window_root_get(ev->win), _xdnd->x, _xdnd->y); evas_list_free(l); } else { - _e_drag_xdnd_end(_xdnd->x, _xdnd->y); + _e_drag_xdnd_end(ecore_x_window_root_get(ev->win), _xdnd->x, _xdnd->y); } /* FIXME: When to execute this? It could be executed in ecore_x after getting * the drop property... */ diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h index c77b1ba33..365952388 100644 --- a/src/bin/e_dnd.h +++ b/src/bin/e_dnd.h @@ -56,6 +56,7 @@ struct _E_Drag unsigned int layer; unsigned char visible : 1; unsigned char need_shape_export : 1; + unsigned char xy_update : 1; }; struct _E_Drop_Handler