diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c index c006310b9..1f757c301 100644 --- a/src/bin/e_dnd.c +++ b/src/bin/e_dnd.c @@ -19,7 +19,7 @@ static void _e_drag_show(E_Drag *drag); static void _e_drag_hide(E_Drag *drag); static void _e_drag_move(E_Drag *drag, int x, int y); static void _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh); -static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win); +static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win, int xdnd); 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(Ecore_X_Window root, int x, int y); @@ -575,7 +575,7 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh) } static int -_e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win) +_e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win, int xdnd) { Ecore_X_Window hwin = 0; @@ -584,10 +584,12 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win) switch (h->obj->type) { case E_GADCON_TYPE: - hwin = e_gadcon_dnd_window_get((E_Gadcon *)(h->obj)); + if (xdnd) hwin = e_gadcon_xdnd_window_get((E_Gadcon *)(h->obj)); + else hwin = e_gadcon_dnd_window_get((E_Gadcon *)(h->obj)); break; case E_GADCON_CLIENT_TYPE: - hwin = e_gadcon_dnd_window_get(((E_Gadcon_Client *)(h->obj))->gadcon); + if (xdnd) hwin = e_gadcon_xdnd_window_get(((E_Gadcon_Client *)(h->obj))->gadcon); + else hwin = e_gadcon_dnd_window_get(((E_Gadcon_Client *)(h->obj))->gadcon); break; case E_WIN_TYPE: hwin = ((E_Win *)(h->obj))->evas_win; @@ -704,7 +706,7 @@ _e_drag_update(Ecore_X_Window root, int x, int y) move_ev.y = y - dy; leave_ev.x = x - dx; leave_ev.y = y - dy; - if (E_INSIDE(x, y, dx, dy, dw, dh) && _e_drag_win_matches(h, win)) + if (E_INSIDE(x, y, dx, dy, dw, dh) && _e_drag_win_matches(h, win, 0)) { if (!h->entered) { @@ -752,7 +754,7 @@ _e_drag_update(Ecore_X_Window root, int x, int y) move_ev.y = y - dy; leave_ev.x = x - dx; leave_ev.y = y - dy; - if (E_INSIDE(x, y, dx, dy, dw, dh) && _e_drag_win_matches(h, win)) + if (E_INSIDE(x, y, dx, dy, dw, dh) && _e_drag_win_matches(h, win, 1)) { if (!h->entered) { @@ -837,7 +839,7 @@ _e_drag_end(Ecore_X_Window root, int x, int y) _e_drag_coords_update(h, &dx, &dy, &dw, &dh); ev.x = x - dx; ev.y = y - dy; - if ((_e_drag_win_matches(h, win)) && + if ((_e_drag_win_matches(h, win, 0)) && ((h->cb.drop) && (E_INSIDE(x, y, dx, dy, dw, dh)))) { @@ -910,7 +912,7 @@ _e_drag_xdnd_end(Ecore_X_Window win, int x, int y) _e_drag_coords_update(h, &dx, &dy, &dw, &dh); ev.x = x - dx; ev.y = y - dy; - if (_e_drag_win_matches(h, win) && h->cb.drop + if (_e_drag_win_matches(h, win, 1) && h->cb.drop && E_INSIDE(x, y, dx, dy, dw, dh)) { h->cb.drop(h->cb.data, h->active_type, &ev); diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c index d87acb27a..733f9ec49 100644 --- a/src/bin/e_gadcon.c +++ b/src/bin/e_gadcon.c @@ -679,6 +679,22 @@ e_gadcon_dnd_window_get(E_Gadcon *gc) return gc->dnd_win; } +EAPI void +e_gadcon_xdnd_window_set(E_Gadcon *gc, Ecore_X_Window win) +{ + E_OBJECT_CHECK(gc); + E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE); + gc->xdnd_win = win; +} + +EAPI Ecore_X_Window +e_gadcon_xdnd_window_get(E_Gadcon *gc) +{ + E_OBJECT_CHECK_RETURN(gc, 0); + E_OBJECT_TYPE_CHECK_RETURN(gc, E_GADCON_TYPE, 0); + return gc->xdnd_win; +} + EAPI void e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf) { diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h index 18e5b05a7..79fe2203a 100644 --- a/src/bin/e_gadcon.h +++ b/src/bin/e_gadcon.h @@ -87,6 +87,7 @@ struct _E_Gadcon E_Config_Dialog *config_dialog; unsigned char editing : 1; Ecore_X_Window dnd_win; + Ecore_X_Window xdnd_win; E_Shelf *shelf; E_Toolbar *toolbar; @@ -207,6 +208,8 @@ EAPI int e_gadcon_canvas_zone_geometry_get(E_Gadcon *gc, int *x, in EAPI void e_gadcon_util_menu_attach_func_set(E_Gadcon *gc, void (*func) (void *data, E_Gadcon_Client *gcc, E_Menu *menu), void *data); EAPI void e_gadcon_dnd_window_set(E_Gadcon *gc, Ecore_X_Window win); EAPI Ecore_X_Window e_gadcon_dnd_window_get(E_Gadcon *gc); +EAPI void e_gadcon_xdnd_window_set(E_Gadcon *gc, Ecore_X_Window win); +EAPI Ecore_X_Window e_gadcon_xdnd_window_get(E_Gadcon *gc); EAPI void e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf); EAPI E_Shelf *e_gadcon_shelf_get(E_Gadcon *gc); EAPI void e_gadcon_toolbar_set(E_Gadcon *gc, E_Toolbar *toolbar); diff --git a/src/bin/e_shelf.c b/src/bin/e_shelf.c index a01bac1b5..d2b00ff5d 100644 --- a/src/bin/e_shelf.c +++ b/src/bin/e_shelf.c @@ -111,14 +111,11 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i e_popup_layer_set(es->popup, layer); es->ee = es->popup->ecore_evas; es->evas = es->popup->evas; - es->win = es->popup->evas_win; } else { es->ee = zone->container->bg_ecore_evas; es->evas = zone->container->bg_evas; - /* TODO: We should have a mouse out on the evas object if we are on the desktop */ - es->win = zone->container->bg_win; } es->fit_along = 1; es->layer = layer; @@ -129,6 +126,7 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i evas_object_resize(es->o_event, es->w, es->h); evas_object_event_callback_add(es->o_event, EVAS_CALLBACK_MOUSE_DOWN, _e_shelf_cb_mouse_down, es); + /* TODO: We should have a mouse out on the evas object if we are on the desktop */ es->handlers = evas_list_append(es->handlers, ecore_event_handler_add(E_EVENT_ZONE_EDGE_IN, _e_shelf_cb_mouse_in, es)); es->handlers = evas_list_append(es->handlers, @@ -175,10 +173,19 @@ e_shelf_zone_new(E_Zone *zone, const char *name, const char *style, int popup, i e_gadcon_zone_set(es->gadcon, zone); e_gadcon_ecore_evas_set(es->gadcon, es->ee); e_gadcon_shelf_set(es->gadcon, es); - e_drop_xdnd_register_set(es->win, 1); - e_gadcon_dnd_window_set(es->gadcon, es->win); if (popup) - winid_shelves = evas_hash_add(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); + { + winid_shelves = evas_hash_add(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); + e_drop_xdnd_register_set(es->popup->evas_win, 1); + e_gadcon_xdnd_window_set(es->gadcon, es->popup->evas_win); + e_gadcon_dnd_window_set(es->gadcon, es->popup->evas_win); + } + else + { + e_drop_xdnd_register_set(es->zone->container->bg_win, 1); + e_gadcon_xdnd_window_set(es->gadcon, es->zone->container->bg_win); + e_gadcon_dnd_window_set(es->gadcon, es->zone->container->event_win); + } e_gadcon_util_menu_attach_func_set(es->gadcon, _e_shelf_cb_menu_items_append, es); @@ -608,22 +615,24 @@ e_shelf_popup_set(E_Shelf *es, int popup) es->ee = es->popup->ecore_evas; es->evas = es->popup->evas; - es->win = es->popup->evas_win; evas_object_show(es->o_event); evas_object_show(es->o_base); e_popup_edje_bg_object_set(es->popup, es->o_base); _e_shelf_edge_event_register(es, 1); + + e_drop_xdnd_register_set(es->popup->evas_win, 1); + e_gadcon_xdnd_window_set(es->gadcon, es->popup->evas_win); + e_gadcon_dnd_window_set(es->gadcon, es->popup->evas_win); } else { - e_drop_xdnd_register_set(es->win, 0); + e_drop_xdnd_register_set(es->popup->evas_win, 0); e_object_del(E_OBJECT(es->popup)); es->popup = NULL; es->ee = es->zone->container->bg_ecore_evas; es->evas = es->zone->container->bg_evas; - es->win = es->zone->container->bg_win; evas_object_move(es->o_event, es->zone->x + es->x, es->zone->y + es->y); evas_object_move(es->o_base, es->zone->x + es->x, es->zone->y + es->y); @@ -631,9 +640,10 @@ e_shelf_popup_set(E_Shelf *es, int popup) evas_object_layer_set(es->o_base, es->cfg->layer); _e_shelf_edge_event_register(es, 0); + e_drop_xdnd_register_set(es->zone->container->bg_win, 1); + e_gadcon_xdnd_window_set(es->gadcon, es->zone->container->bg_win); + e_gadcon_dnd_window_set(es->gadcon, es->zone->container->event_win); } - e_drop_xdnd_register_set(es->win, 1); - e_gadcon_dnd_window_set(es->gadcon, es->win); } EAPI E_Shelf * @@ -714,7 +724,7 @@ _e_shelf_free(E_Shelf *es) if (es->popup) { _e_shelf_edge_event_register(es, 0); - e_drop_xdnd_register_set(es->win, 0); + e_drop_xdnd_register_set(es->popup->evas_win, 0); winid_shelves = evas_hash_del(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es); e_object_del(E_OBJECT(es->popup)); } @@ -1303,11 +1313,14 @@ _e_shelf_cb_mouse_in(void *data, int type, void *event) } else if (type == ECORE_X_EVENT_MOUSE_IN) { + Ecore_X_Window win; Ecore_X_Event_Mouse_In *ev; ev = event; /* If we are about to hide the shelf, interrupt on mouse in */ - if (ev->win == es->win) + if (es->popup) win = es->popup->evas_win; + else win = es->zone->container->event_win; + if (ev->win == win) { edje_object_signal_emit(es->o_base, "e,state,focused", "e"); if ((es->hide_animator) || (es->hide_timer) || (es->instant_timer)) @@ -1322,10 +1335,13 @@ _e_shelf_cb_mouse_out(void *data, int type, void *event) { Ecore_X_Event_Mouse_Out *ev; E_Shelf *es; + Ecore_X_Window win; ev = event; es = data; - if (ev->win != es->win) return 1; + if (es->popup) win = es->popup->evas_win; + else win = es->zone->container->event_win; + if (ev->win != win) return 1; e_shelf_toggle(es, 0); return 1; } diff --git a/src/bin/e_shelf.h b/src/bin/e_shelf.h index 6a5e2ecbd..1955a9179 100644 --- a/src/bin/e_shelf.h +++ b/src/bin/e_shelf.h @@ -23,7 +23,6 @@ struct _E_Shelf Evas_Object *o_event; Ecore_Evas *ee; Evas *evas; - Ecore_X_Window win; E_Gadcon *gadcon; const char *name; const char *style;