forked from enlightenment/enlightenment
Fix dnd. Hopefully works in all situations now. Seems like we should
consider separating internal and external dnd code. SVN revision: 34901
This commit is contained in:
parent
3bc2777b2b
commit
ae855ee47e
|
@ -19,7 +19,7 @@ static void _e_drag_show(E_Drag *drag);
|
||||||
static void _e_drag_hide(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_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 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_show(E_Drop_Handler *h);
|
||||||
static void _e_drag_win_hide(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);
|
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
|
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;
|
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)
|
switch (h->obj->type)
|
||||||
{
|
{
|
||||||
case E_GADCON_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;
|
break;
|
||||||
case E_GADCON_CLIENT_TYPE:
|
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;
|
break;
|
||||||
case E_WIN_TYPE:
|
case E_WIN_TYPE:
|
||||||
hwin = ((E_Win *)(h->obj))->evas_win;
|
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;
|
move_ev.y = y - dy;
|
||||||
leave_ev.x = x - dx;
|
leave_ev.x = x - dx;
|
||||||
leave_ev.y = y - dy;
|
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)
|
if (!h->entered)
|
||||||
{
|
{
|
||||||
|
@ -752,7 +754,7 @@ _e_drag_update(Ecore_X_Window root, int x, int y)
|
||||||
move_ev.y = y - dy;
|
move_ev.y = y - dy;
|
||||||
leave_ev.x = x - dx;
|
leave_ev.x = x - dx;
|
||||||
leave_ev.y = y - dy;
|
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)
|
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);
|
_e_drag_coords_update(h, &dx, &dy, &dw, &dh);
|
||||||
ev.x = x - dx;
|
ev.x = x - dx;
|
||||||
ev.y = y - dy;
|
ev.y = y - dy;
|
||||||
if ((_e_drag_win_matches(h, win)) &&
|
if ((_e_drag_win_matches(h, win, 0)) &&
|
||||||
((h->cb.drop) &&
|
((h->cb.drop) &&
|
||||||
(E_INSIDE(x, y, dx, dy, dw, dh))))
|
(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);
|
_e_drag_coords_update(h, &dx, &dy, &dw, &dh);
|
||||||
ev.x = x - dx;
|
ev.x = x - dx;
|
||||||
ev.y = y - dy;
|
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))
|
&& E_INSIDE(x, y, dx, dy, dw, dh))
|
||||||
{
|
{
|
||||||
h->cb.drop(h->cb.data, h->active_type, &ev);
|
h->cb.drop(h->cb.data, h->active_type, &ev);
|
||||||
|
|
|
@ -679,6 +679,22 @@ e_gadcon_dnd_window_get(E_Gadcon *gc)
|
||||||
return gc->dnd_win;
|
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
|
EAPI void
|
||||||
e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf)
|
e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,7 @@ struct _E_Gadcon
|
||||||
E_Config_Dialog *config_dialog;
|
E_Config_Dialog *config_dialog;
|
||||||
unsigned char editing : 1;
|
unsigned char editing : 1;
|
||||||
Ecore_X_Window dnd_win;
|
Ecore_X_Window dnd_win;
|
||||||
|
Ecore_X_Window xdnd_win;
|
||||||
E_Shelf *shelf;
|
E_Shelf *shelf;
|
||||||
E_Toolbar *toolbar;
|
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_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 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 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 void e_gadcon_shelf_set(E_Gadcon *gc, E_Shelf *shelf);
|
||||||
EAPI E_Shelf *e_gadcon_shelf_get(E_Gadcon *gc);
|
EAPI E_Shelf *e_gadcon_shelf_get(E_Gadcon *gc);
|
||||||
EAPI void e_gadcon_toolbar_set(E_Gadcon *gc, E_Toolbar *toolbar);
|
EAPI void e_gadcon_toolbar_set(E_Gadcon *gc, E_Toolbar *toolbar);
|
||||||
|
|
|
@ -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);
|
e_popup_layer_set(es->popup, layer);
|
||||||
es->ee = es->popup->ecore_evas;
|
es->ee = es->popup->ecore_evas;
|
||||||
es->evas = es->popup->evas;
|
es->evas = es->popup->evas;
|
||||||
es->win = es->popup->evas_win;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
es->ee = zone->container->bg_ecore_evas;
|
es->ee = zone->container->bg_ecore_evas;
|
||||||
es->evas = zone->container->bg_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->fit_along = 1;
|
||||||
es->layer = layer;
|
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_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);
|
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,
|
es->handlers = evas_list_append(es->handlers,
|
||||||
ecore_event_handler_add(E_EVENT_ZONE_EDGE_IN, _e_shelf_cb_mouse_in, es));
|
ecore_event_handler_add(E_EVENT_ZONE_EDGE_IN, _e_shelf_cb_mouse_in, es));
|
||||||
es->handlers = evas_list_append(es->handlers,
|
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_zone_set(es->gadcon, zone);
|
||||||
e_gadcon_ecore_evas_set(es->gadcon, es->ee);
|
e_gadcon_ecore_evas_set(es->gadcon, es->ee);
|
||||||
e_gadcon_shelf_set(es->gadcon, es);
|
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)
|
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_gadcon_util_menu_attach_func_set(es->gadcon,
|
||||||
_e_shelf_cb_menu_items_append, es);
|
_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->ee = es->popup->ecore_evas;
|
||||||
es->evas = es->popup->evas;
|
es->evas = es->popup->evas;
|
||||||
es->win = es->popup->evas_win;
|
|
||||||
evas_object_show(es->o_event);
|
evas_object_show(es->o_event);
|
||||||
evas_object_show(es->o_base);
|
evas_object_show(es->o_base);
|
||||||
e_popup_edje_bg_object_set(es->popup, es->o_base);
|
e_popup_edje_bg_object_set(es->popup, es->o_base);
|
||||||
|
|
||||||
_e_shelf_edge_event_register(es, 1);
|
_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
|
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));
|
e_object_del(E_OBJECT(es->popup));
|
||||||
es->popup = NULL;
|
es->popup = NULL;
|
||||||
|
|
||||||
es->ee = es->zone->container->bg_ecore_evas;
|
es->ee = es->zone->container->bg_ecore_evas;
|
||||||
es->evas = es->zone->container->bg_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_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);
|
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);
|
evas_object_layer_set(es->o_base, es->cfg->layer);
|
||||||
|
|
||||||
_e_shelf_edge_event_register(es, 0);
|
_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 *
|
EAPI E_Shelf *
|
||||||
|
@ -714,7 +724,7 @@ _e_shelf_free(E_Shelf *es)
|
||||||
if (es->popup)
|
if (es->popup)
|
||||||
{
|
{
|
||||||
_e_shelf_edge_event_register(es, 0);
|
_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);
|
winid_shelves = evas_hash_del(winid_shelves, e_util_winid_str_get(es->popup->evas_win), es);
|
||||||
e_object_del(E_OBJECT(es->popup));
|
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)
|
else if (type == ECORE_X_EVENT_MOUSE_IN)
|
||||||
{
|
{
|
||||||
|
Ecore_X_Window win;
|
||||||
Ecore_X_Event_Mouse_In *ev;
|
Ecore_X_Event_Mouse_In *ev;
|
||||||
|
|
||||||
ev = event;
|
ev = event;
|
||||||
/* If we are about to hide the shelf, interrupt on mouse in */
|
/* 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");
|
edje_object_signal_emit(es->o_base, "e,state,focused", "e");
|
||||||
if ((es->hide_animator) || (es->hide_timer) || (es->instant_timer))
|
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;
|
Ecore_X_Event_Mouse_Out *ev;
|
||||||
E_Shelf *es;
|
E_Shelf *es;
|
||||||
|
Ecore_X_Window win;
|
||||||
|
|
||||||
ev = event;
|
ev = event;
|
||||||
es = data;
|
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);
|
e_shelf_toggle(es, 0);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@ struct _E_Shelf
|
||||||
Evas_Object *o_event;
|
Evas_Object *o_event;
|
||||||
Ecore_Evas *ee;
|
Ecore_Evas *ee;
|
||||||
Evas *evas;
|
Evas *evas;
|
||||||
Ecore_X_Window win;
|
|
||||||
E_Gadcon *gadcon;
|
E_Gadcon *gadcon;
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *style;
|
const char *style;
|
||||||
|
|
Loading…
Reference in New Issue