redo drop handlers to take an E_Object and Evas_Object

temp change to fix crashing when closing fwins with ctrl+w
This commit is contained in:
Mike Blumenkrantz 2015-04-27 15:39:43 -04:00
parent 7c661b54a9
commit 5ae00e6525
15 changed files with 53 additions and 27 deletions

View File

@ -439,7 +439,7 @@ e_drop_xds_update(Eina_Bool enable, const char *value)
}
EAPI E_Drop_Handler *
e_drop_handler_add(E_Object *obj,
e_drop_handler_add(E_Object *obj, Evas_Object *win,
void *data,
void (*enter_cb)(void *data, const char *type, void *event),
void (*move_cb)(void *data, const char *type, void *event),
@ -467,6 +467,7 @@ e_drop_handler_add(E_Object *obj,
handler->h = h;
handler->obj = obj;
handler->win = win;
handler->entered = 0;
_drop_handlers = eina_list_append(_drop_handlers, handler);
@ -667,11 +668,11 @@ _e_drag_coords_update(const E_Drop_Handler *h, int *dx, int *dy)
*dx = 0;
*dy = 0;
if (e_obj_is_win(h->obj))
if (h->win)
{
E_Client *ec;
ec = e_win_client_get((void*)h->obj);
ec = e_win_client_get(h->win);
px = ec->x;
py = ec->y;
}
@ -725,8 +726,8 @@ _e_drag_win_get(const E_Drop_Handler *h, int xdnd)
{
Ecore_X_Window hwin = 0;
if (e_obj_is_win(h->obj))
return elm_win_window_id_get((Evas_Object*)h->obj);
if (h->win)
return elm_win_window_id_get(h->win);
if (h->obj)
{
E_Gadcon *gc = NULL;
@ -776,9 +777,9 @@ _e_drag_win_show(E_Drop_Handler *h)
{
E_Shelf *shelf;
if (h->win) return;
if (h->obj)
{
if (e_obj_is_win(h->obj)) return;
switch (h->obj->type)
{
case E_GADCON_TYPE:
@ -803,9 +804,9 @@ _e_drag_win_hide(E_Drop_Handler *h)
{
E_Shelf *shelf;
if (h->win) return;
if (h->obj)
{
if (e_obj_is_win(h->obj)) return;
switch (h->obj->type)
{
case E_GADCON_TYPE:
@ -833,8 +834,8 @@ _e_dnd_object_layer_get(E_Drop_Handler *h)
if (h->base) return evas_object_layer_get(h->base);
if (!obj) return 0;
if (e_obj_is_win(obj))
obj = (E_Object*)e_win_client_get((Evas_Object*)obj);
if (h->win)
obj = (E_Object*)e_win_client_get(h->win);
switch (obj->type)
{
case E_GADCON_CLIENT_TYPE:

View File

@ -66,6 +66,7 @@ struct _E_Drop_Handler
} cb;
E_Object *obj;
Evas_Object *win;
Evas_Object *base;
int x, y, w, h;
@ -132,7 +133,7 @@ EAPI int e_drag_xdnd_start(E_Drag *drag, int x, int y);
EAPI void e_drop_xds_update(Eina_Bool enable, const char *value);
EAPI void e_drop_handler_xds_set(E_Drop_Handler *handler, Eina_Bool (*cb)(void *data, const char *type));
EAPI E_Drop_Handler *e_drop_handler_add(E_Object *obj,
EAPI E_Drop_Handler *e_drop_handler_add(E_Object *obj, Evas_Object *win,
void *data,
void (*enter_cb)(void *data, const char *type, void *event),
void (*move_cb)(void *data, const char *type, void *event),

View File

@ -146,6 +146,7 @@ struct _E_Fm2_Smart_Data
int busy_count;
E_Object *eobj;
Evas_Object *win;
E_Drop_Handler *drop_handler;
E_Fm2_Icon *drop_icon;
Ecore_Animator *dnd_scroller;
@ -1624,8 +1625,30 @@ e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj)
EFM_SMART_CHECK();
sd->eobj = eobj;
sd->win = NULL;
if (sd->drop_handler) e_drop_handler_del(sd->drop_handler);
sd->drop_handler = e_drop_handler_add(sd->eobj,
sd->drop_handler = e_drop_handler_add(sd->eobj, NULL,
sd,
_e_fm2_cb_dnd_enter,
_e_fm2_cb_dnd_move,
_e_fm2_cb_dnd_leave,
_e_fm2_cb_dnd_selection_notify,
drop, 3,
sd->x, sd->y, sd->w, sd->h);
e_drop_handler_responsive_set(sd->drop_handler);
e_drop_handler_xds_set(sd->drop_handler, _e_fm2_cb_dnd_drop);
}
EAPI void
e_fm2_window_set(Evas_Object *obj, Evas_Object *win)
{
const char *drop[] = {"text/uri-list", "text/x-moz-url", "XdndDirectSave0"};
EFM_SMART_CHECK();
sd->win = win;
sd->eobj = NULL;
if (sd->drop_handler) e_drop_handler_del(sd->drop_handler);
sd->drop_handler = e_drop_handler_add(NULL, win,
sd,
_e_fm2_cb_dnd_enter,
_e_fm2_cb_dnd_move,
@ -7321,7 +7344,7 @@ _e_fm2_cb_icon_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
{
if (ev->button == 1)
{
if ((ic->sd->eobj))
if ((ic->sd->eobj || ic->sd->win))
{
ic->drag.x = ev->output.x - ic->x - ic->sd->x + ic->sd->pos.x;
ic->drag.y = ev->output.y - ic->y - ic->sd->y + ic->sd->pos.y;
@ -7554,7 +7577,7 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA
ic->drag.start = ic->drag.dnd = ic->drag.src = EINA_FALSE;
return;
}
if ((ic->drag.start) && (ic->sd->eobj))
if ((ic->drag.start) && (ic->sd->eobj || ic->sd->win))
{
int dx, dy;

View File

@ -181,6 +181,7 @@ EAPI void e_fm2_view_flags_set(Evas_Object *obj, E_Fm2_View_Flags fl
EAPI E_Fm2_View_Flags e_fm2_view_flags_get(Evas_Object *obj);
EAPI E_Object *e_fm2_window_object_get(Evas_Object *obj);
EAPI void e_fm2_window_object_set(Evas_Object *obj, E_Object *eobj);
EAPI void e_fm2_window_set(Evas_Object *obj, Evas_Object *win);
EAPI void e_fm2_icons_update(Evas_Object *obj);
EAPI void e_fm2_pan_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y);

View File

@ -427,7 +427,7 @@ e_gadcon_drop_handler_add(E_Gadcon *gc, E_Gadcon_DND_Cb enter, E_Gadcon_DND_Cb l
E_OBJECT_TYPE_CHECK(gc, E_GADCON_TYPE);
if (gc->drop_handler) return;
gc->drop_handler =
e_drop_handler_add(E_OBJECT(gc), gc,
e_drop_handler_add(E_OBJECT(gc), NULL, gc,
_e_gadcon_cb_dnd_enter, _e_gadcon_cb_dnd_move,
_e_gadcon_cb_dnd_leave, _e_gadcon_cb_dnd_drop,
drop_types, 1, x, y, w, h);

View File

@ -188,7 +188,7 @@ e_import_dialog_show(Evas_Object *parent EINA_UNUSED, const char *dev, const cha
*/
ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL, (void *)_fsel_cb_ok, id,
NULL, NULL, 1);
e_widget_fsel_window_object_set(ofm, E_OBJECT(dia->win));
e_widget_fsel_window_set(ofm, dia->win);
id->fsel_obj = ofm;
e_widget_size_min_get(ofm, &w, &h);
e_dialog_content_set(dia, ofm, w, h);

View File

@ -532,14 +532,14 @@ e_widget_fsel_selection_path_get(Evas_Object *obj)
}
EAPI void
e_widget_fsel_window_object_set(Evas_Object *obj, E_Object *eobj)
e_widget_fsel_window_set(Evas_Object *obj, Evas_Object *win)
{
E_Widget_Data *wd;
if (!obj) return;
if (!(wd = e_widget_data_get(obj))) return;
e_fm2_window_object_set(wd->o_favorites_fm, eobj);
e_fm2_window_object_set(wd->o_files_fm, eobj);
e_fm2_window_set(wd->o_favorites_fm, win);
e_fm2_window_set(wd->o_files_fm, win);
}
EAPI Eina_Bool

View File

@ -8,7 +8,7 @@ EAPI Evas_Object *e_widget_fsel_add(Evas *evas, const char *dev, const char *pat
void (*chg_func) (void *data, Evas_Object *obj), void *chg_data, int preview);
EAPI void e_widget_fsel_path_get(Evas_Object *obj, const char **dev, const char **path);
EAPI const char *e_widget_fsel_selection_path_get(Evas_Object *obj);
EAPI void e_widget_fsel_window_object_set(Evas_Object *obj, E_Object *eobj);
EAPI void e_widget_fsel_window_set(Evas_Object *obj, Evas_Object *win);
EAPI Eina_Bool e_widget_fsel_typebuf_visible_get(Evas_Object *obj);
#endif
#endif

View File

@ -1003,7 +1003,7 @@ _e_fwin_page_favorites_add(E_Fwin_Page *page)
"e/fileman/default/scrollframe");
evas_object_propagate_events_set(page->flist, 0);
e_widget_can_focus_set(o, EINA_FALSE);
e_fm2_window_object_set(page->flist, E_OBJECT(page->fwin->win));
e_fm2_window_set(page->flist, page->fwin->win);
e_widget_scrollframe_focus_object_set(o, page->flist);
page->flist_frame = o;
@ -1054,7 +1054,7 @@ _e_fwin_page_create(E_Fwin *fwin)
evas_object_smart_callback_add(o, "icon_mouse_in", (Evas_Smart_Cb)_e_fwin_icon_mouse_in, fwin);
evas_object_smart_callback_add(o, "icon_mouse_out", (Evas_Smart_Cb)_e_fwin_icon_mouse_out, fwin);
e_fm2_icon_menu_start_extend_callback_set(o, _e_fwin_cb_menu_extend_start, page);
e_fm2_window_object_set(o, E_OBJECT(fwin->win));
e_fm2_window_set(o, fwin->win);
evas_object_focus_set(o, 1);
_e_fwin_config_set(page);

View File

@ -376,7 +376,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
edje_object_message_signal_process(inst->o_base);
evas_object_geometry_get(inst->o_scroll, &x, &y, &w, &h);
inst->dnd_handler = e_drop_handler_add(E_OBJECT(inst->gcc),
inst->dnd_handler = e_drop_handler_add(E_OBJECT(inst->gcc), NULL,
inst,
_box_button_cb_dnd_enter,
_box_button_cb_dnd_move,

View File

@ -273,7 +273,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
evas_object_geometry_get(b->o_box, &x, &y, &w, &h);
inst->drop_handler =
e_drop_handler_add(E_OBJECT(inst->gcc), inst,
e_drop_handler_add(E_OBJECT(inst->gcc), NULL, inst,
_ibar_inst_cb_enter, _ibar_inst_cb_move,
_ibar_inst_cb_leave, _ibar_inst_cb_drop,
drop, 3, x, y, w, h);

View File

@ -199,7 +199,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
evas_object_geometry_get(o, &x, &y, &w, &h);
inst->drop_handler =
e_drop_handler_add(E_OBJECT(inst->gcc), inst,
e_drop_handler_add(E_OBJECT(inst->gcc), NULL, inst,
_ibox_inst_cb_enter, _ibox_inst_cb_move,
_ibox_inst_cb_leave, _ibox_inst_cb_drop,
drop, 1, x, y, w, h);

View File

@ -224,7 +224,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
evas_object_geometry_get(o, &x, &y, &w, &h);
p->drop_handler =
e_drop_handler_add(E_OBJECT(inst->gcc), p,
e_drop_handler_add(E_OBJECT(inst->gcc), NULL, p,
_pager_drop_cb_enter, _pager_drop_cb_move,
_pager_drop_cb_leave, _pager_drop_cb_drop,
drop, 3, x, y, w, h);

View File

@ -215,7 +215,7 @@ _gc_init(E_Gadcon *gc, const char *name, const char *id, const char *style)
evas_object_geometry_get(o, &x, &y, &w, &h);
p->drop_handler =
e_drop_handler_add(E_OBJECT(inst->gcc), p,
e_drop_handler_add(E_OBJECT(inst->gcc), NULL, p,
_pager_drop_cb_enter, _pager_drop_cb_move,
_pager_drop_cb_leave, _pager_drop_cb_drop,
drop, 3, x, y, w, h);

View File

@ -266,7 +266,7 @@ _win_save_cb(void *data EINA_UNUSED, void *data2 EINA_UNUSED)
NULL, NULL,
NULL, NULL, 1);
e_object_del_attach_func_set(E_OBJECT(dia), _file_select_del_cb);
e_widget_fsel_window_object_set(o, E_OBJECT(dia->win));
e_widget_fsel_window_set(o, dia->win);
o_fsel = o;
evas_object_show(o);
e_widget_size_min_get(o, &mw, &mh);