Enlightenment CVS committal Author : englebass Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_dnd.c e_gadcon.c e_gadcon.h e_shelf.c e_shelf.h Log Message: Fix dnd. Hopefully works in all situations now. Seems like we should consider separating internal and external dnd code. =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_dnd.c,v retrieving revision 1.77 retrieving revision 1.78 diff -u -3 -r1.77 -r1.78 --- e_dnd.c 15 Jun 2008 12:30:26 -0000 1.77 +++ e_dnd.c 24 Jun 2008 20:13:34 -0000 1.78 @@ -19,7 +19,7 @@ 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 @@ } 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 @@ 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 @@ 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 @@ 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_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_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); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.c,v retrieving revision 1.108 retrieving revision 1.109 diff -u -3 -r1.108 -r1.109 --- e_gadcon.c 19 May 2008 09:57:48 -0000 1.108 +++ e_gadcon.c 24 Jun 2008 20:13:35 -0000 1.109 @@ -680,6 +680,22 @@ } 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) { E_OBJECT_CHECK(gc); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_gadcon.h,v retrieving revision 1.47 retrieving revision 1.48 diff -u -3 -r1.47 -r1.48 --- e_gadcon.h 19 May 2008 04:37:34 -0000 1.47 +++ e_gadcon.h 24 Jun 2008 20:13:35 -0000 1.48 @@ -87,6 +87,7 @@ 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 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); =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_shelf.c,v retrieving revision 1.98 retrieving revision 1.99 diff -u -3 -r1.98 -r1.99 --- e_shelf.c 24 Jun 2008 15:56:15 -0000 1.98 +++ e_shelf.c 24 Jun 2008 20:13:35 -0000 1.99 @@ -111,14 +111,11 @@ 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 @@ 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_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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ { 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; } =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_shelf.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- e_shelf.h 19 Jan 2008 11:41:42 -0000 1.28 +++ e_shelf.h 24 Jun 2008 20:13:35 -0000 1.29 @@ -23,7 +23,6 @@ Evas_Object *o_event; Ecore_Evas *ee; Evas *evas; - Ecore_X_Window win; E_Gadcon *gadcon; const char *name; const char *style; ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs