forked from enlightenment/enlightenment
More fixes of the autoscroll/drag and drop behaviour for gadgets in
shelves. Added callback to allow the current drop position to be dynamically updated as the gadget scrolling is animated. SVN revision: 27114
This commit is contained in:
parent
2f31f34b37
commit
7f9999dbf8
|
@ -1349,6 +1349,9 @@ _e_gadcon_cb_client_scroll_animator(void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gcc->scroll_cb.func)
|
||||||
|
gcc->scroll_cb.func(gcc->scroll_cb.data);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1397,6 +1400,13 @@ e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, Evas_Coord x, Evas_Coord
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EAPI void
|
||||||
|
e_gadcon_client_autoscroll_cb_set(E_Gadcon_Client *gcc, void (*func)(void *data), void *data)
|
||||||
|
{
|
||||||
|
gcc->scroll_cb.func = func;
|
||||||
|
gcc->scroll_cb.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
_e_gadcon_cb_client_frame_moveresize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
{
|
{
|
||||||
|
|
|
@ -131,6 +131,11 @@ struct _E_Gadcon_Client
|
||||||
Ecore_Animator *scroll_animator;
|
Ecore_Animator *scroll_animator;
|
||||||
double scroll_pos;
|
double scroll_pos;
|
||||||
double scroll_wanted;
|
double scroll_wanted;
|
||||||
|
struct {
|
||||||
|
void *data;
|
||||||
|
void (*func) (void *data);
|
||||||
|
} scroll_cb;
|
||||||
|
|
||||||
E_Menu *menu;
|
E_Menu *menu;
|
||||||
const char *style;
|
const char *style;
|
||||||
unsigned char autoscroll : 1;
|
unsigned char autoscroll : 1;
|
||||||
|
@ -139,6 +144,7 @@ struct _E_Gadcon_Client
|
||||||
unsigned char moving : 1;
|
unsigned char moving : 1;
|
||||||
unsigned char resizing : 1;
|
unsigned char resizing : 1;
|
||||||
Evas_Coord dx, dy;
|
Evas_Coord dx, dy;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EAPI int e_gadcon_init(void);
|
EAPI int e_gadcon_init(void);
|
||||||
|
@ -176,6 +182,7 @@ EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Co
|
||||||
EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h);
|
EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h);
|
||||||
EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll);
|
EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll);
|
||||||
EAPI void e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, int mx, int my);
|
EAPI void e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, int mx, int my);
|
||||||
|
EAPI void e_gadcon_client_autoscroll_cb_set(E_Gadcon_Client *gcc, void (*func)(void *data), void *data);
|
||||||
EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable);
|
EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable);
|
||||||
|
|
||||||
EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags);
|
EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags);
|
||||||
|
|
|
@ -56,6 +56,7 @@ struct _IBar
|
||||||
Evas_List *icons;
|
Evas_List *icons;
|
||||||
int show_label;
|
int show_label;
|
||||||
int eap_label;
|
int eap_label;
|
||||||
|
Evas_Coord dnd_x, dnd_y;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _IBar_Icon
|
struct _IBar_Icon
|
||||||
|
@ -110,6 +111,8 @@ static void _ibar_inst_cb_enter(void *data, const char *type, void *event_info);
|
||||||
static void _ibar_inst_cb_move(void *data, const char *type, void *event_info);
|
static void _ibar_inst_cb_move(void *data, const char *type, void *event_info);
|
||||||
static void _ibar_inst_cb_leave(void *data, const char *type, void *event_info);
|
static void _ibar_inst_cb_leave(void *data, const char *type, void *event_info);
|
||||||
static void _ibar_inst_cb_drop(void *data, const char *type, void *event_info);
|
static void _ibar_inst_cb_drop(void *data, const char *type, void *event_info);
|
||||||
|
static void _ibar_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y);
|
||||||
|
static void _ibar_inst_cb_scroll(void *data);
|
||||||
|
|
||||||
static E_Config_DD *conf_edd = NULL;
|
static E_Config_DD *conf_edd = NULL;
|
||||||
static E_Config_DD *conf_item_edd = NULL;
|
static E_Config_DD *conf_item_edd = NULL;
|
||||||
|
@ -1060,82 +1063,31 @@ _ibar_cb_drop_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ibar_inst_cb_enter(void *data, const char *type, void *event_info)
|
_ibar_inst_cb_scroll(void *data)
|
||||||
{
|
{
|
||||||
E_Event_Dnd_Enter *ev;
|
|
||||||
Instance *inst;
|
Instance *inst;
|
||||||
Evas_Object *o, *o2;
|
|
||||||
IBar_Icon *ic;
|
|
||||||
Evas_Coord xx, yy;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
ev = event_info;
|
/* Update the position of the dnd to handle for autoscrolling
|
||||||
|
* gadgets. */
|
||||||
inst = data;
|
inst = data;
|
||||||
o = edje_object_add(evas_object_evas_get(inst->ibar->o_box));
|
_ibar_drop_position_update(inst, inst->ibar->dnd_x, inst->ibar->dnd_y);
|
||||||
inst->ibar->o_drop = o;
|
|
||||||
o2 = edje_object_add(evas_object_evas_get(inst->ibar->o_box));
|
|
||||||
inst->ibar->o_drop_over = o2;
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _ibar_cb_drop_move, inst->ibar);
|
|
||||||
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _ibar_cb_drop_resize, inst->ibar);
|
|
||||||
e_theme_edje_object_set(o, "base/theme/modules/ibar",
|
|
||||||
"e/modules/ibar/drop");
|
|
||||||
e_theme_edje_object_set(o2, "base/theme/modules/ibar",
|
|
||||||
"e/modules/ibar/drop_overlay");
|
|
||||||
evas_object_layer_set(o2, 19999);
|
|
||||||
evas_object_show(o);
|
|
||||||
evas_object_show(o2);
|
|
||||||
evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
|
|
||||||
e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
|
|
||||||
ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx + x, ev->y + yy + y);
|
|
||||||
inst->ibar->ic_drop_before = ic;
|
|
||||||
if (ic)
|
|
||||||
{
|
|
||||||
Evas_Coord ix, iy, iw, ih;
|
|
||||||
int before = 0;
|
|
||||||
|
|
||||||
evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih);
|
|
||||||
if (e_box_orientation_get(inst->ibar->o_box))
|
|
||||||
{
|
|
||||||
if ((ev->x + xx) < (ix + (iw / 2))) before = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((ev->y + yy) < (iy + (ih / 2))) before = 1;
|
|
||||||
}
|
|
||||||
if (before)
|
|
||||||
e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder);
|
|
||||||
else
|
|
||||||
e_box_pack_after(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder);
|
|
||||||
inst->ibar->drop_before = before;
|
|
||||||
}
|
|
||||||
else e_box_pack_end(inst->ibar->o_box, o);
|
|
||||||
e_box_pack_options_set(o,
|
|
||||||
1, 1, /* fill */
|
|
||||||
0, 0, /* expand */
|
|
||||||
0.5, 0.5, /* align */
|
|
||||||
1, 1, /* min */
|
|
||||||
-1, -1 /* max */
|
|
||||||
);
|
|
||||||
_ibar_resize_handle(inst->ibar);
|
|
||||||
_gc_orient(inst->gcc);
|
|
||||||
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ibar_inst_cb_move(void *data, const char *type, void *event_info)
|
_ibar_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y)
|
||||||
{
|
{
|
||||||
E_Event_Dnd_Move *ev;
|
|
||||||
Instance *inst;
|
|
||||||
IBar_Icon *ic;
|
|
||||||
Evas_Coord xx, yy;
|
Evas_Coord xx, yy;
|
||||||
int x, y;
|
int ox, oy;
|
||||||
|
IBar_Icon *ic;
|
||||||
|
|
||||||
ev = event_info;
|
inst->ibar->dnd_x = x;
|
||||||
inst = data;
|
inst->ibar->dnd_y = y;
|
||||||
|
|
||||||
|
if (inst->ibar->o_drop)
|
||||||
e_box_unpack(inst->ibar->o_drop);
|
e_box_unpack(inst->ibar->o_drop);
|
||||||
evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
|
evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
|
||||||
e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
|
e_box_align_pixel_offset_get(inst->gcc->o_box, &ox, &oy);
|
||||||
ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx + x, ev->y + yy + y);
|
ic = _ibar_icon_at_coord(inst->ibar, x + xx + ox, y + yy + oy);
|
||||||
inst->ibar->ic_drop_before = ic;
|
inst->ibar->ic_drop_before = ic;
|
||||||
if (ic)
|
if (ic)
|
||||||
{
|
{
|
||||||
|
@ -1145,11 +1097,11 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
|
||||||
evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih);
|
evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih);
|
||||||
if (e_box_orientation_get(inst->ibar->o_box))
|
if (e_box_orientation_get(inst->ibar->o_box))
|
||||||
{
|
{
|
||||||
if ((ev->x + xx) < (ix + (iw / 2))) before = 1;
|
if ((x + xx) < (ix + (iw / 2))) before = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ev->y + yy) < (iy + (ih / 2))) before = 1;
|
if ((y + yy) < (iy + (ih / 2))) before = 1;
|
||||||
}
|
}
|
||||||
if (before)
|
if (before)
|
||||||
e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder);
|
e_box_pack_before(inst->ibar->o_box, inst->ibar->o_drop, ic->o_holder);
|
||||||
|
@ -1167,6 +1119,50 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
|
||||||
);
|
);
|
||||||
_ibar_resize_handle(inst->ibar);
|
_ibar_resize_handle(inst->ibar);
|
||||||
_gc_orient(inst->gcc);
|
_gc_orient(inst->gcc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ibar_inst_cb_enter(void *data, const char *type, void *event_info)
|
||||||
|
{
|
||||||
|
E_Event_Dnd_Enter *ev;
|
||||||
|
Instance *inst;
|
||||||
|
Evas_Object *o, *o2;
|
||||||
|
|
||||||
|
ev = event_info;
|
||||||
|
inst = data;
|
||||||
|
o = edje_object_add(evas_object_evas_get(inst->ibar->o_box));
|
||||||
|
inst->ibar->o_drop = o;
|
||||||
|
o2 = edje_object_add(evas_object_evas_get(inst->ibar->o_box));
|
||||||
|
inst->ibar->o_drop_over = o2;
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_MOVE, _ibar_cb_drop_move, inst->ibar);
|
||||||
|
evas_object_event_callback_add(o, EVAS_CALLBACK_RESIZE, _ibar_cb_drop_resize, inst->ibar);
|
||||||
|
e_theme_edje_object_set(o, "base/theme/modules/ibar",
|
||||||
|
"e/modules/ibar/drop");
|
||||||
|
e_theme_edje_object_set(o2, "base/theme/modules/ibar",
|
||||||
|
"e/modules/ibar/drop_overlay");
|
||||||
|
evas_object_layer_set(o2, 19999);
|
||||||
|
evas_object_show(o);
|
||||||
|
evas_object_show(o2);
|
||||||
|
|
||||||
|
_ibar_drop_position_update(inst, ev->x, ev->y);
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, _ibar_inst_cb_scroll, inst);
|
||||||
|
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ibar_inst_cb_move(void *data, const char *type, void *event_info)
|
||||||
|
{
|
||||||
|
E_Event_Dnd_Move *ev;
|
||||||
|
Instance *inst;
|
||||||
|
IBar_Icon *ic;
|
||||||
|
Evas_Coord xx, yy;
|
||||||
|
int x, y;
|
||||||
|
int wx, wy;
|
||||||
|
|
||||||
|
ev = event_info;
|
||||||
|
inst = data;
|
||||||
|
|
||||||
|
_ibar_drop_position_update(inst, ev->x, ev->y);
|
||||||
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1184,6 +1180,7 @@ _ibar_inst_cb_leave(void *data, const char *type, void *event_info)
|
||||||
evas_object_del(inst->ibar->o_drop_over);
|
evas_object_del(inst->ibar->o_drop_over);
|
||||||
inst->ibar->o_drop_over = NULL;
|
inst->ibar->o_drop_over = NULL;
|
||||||
_ibar_resize_handle(inst->ibar);
|
_ibar_resize_handle(inst->ibar);
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, NULL, NULL);
|
||||||
_gc_orient(inst->gcc);
|
_gc_orient(inst->gcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,6 +1195,7 @@ _ibar_inst_cb_drop(void *data, const char *type, void *event_info)
|
||||||
|
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
inst = data;
|
inst = data;
|
||||||
|
|
||||||
if (!strcmp(type, "enlightenment/eapp"))
|
if (!strcmp(type, "enlightenment/eapp"))
|
||||||
{
|
{
|
||||||
app = ev->data;
|
app = ev->data;
|
||||||
|
@ -1282,9 +1280,11 @@ _ibar_inst_cb_drop(void *data, const char *type, void *event_info)
|
||||||
inst->ibar->o_drop = NULL;
|
inst->ibar->o_drop = NULL;
|
||||||
evas_object_del(inst->ibar->o_drop_over);
|
evas_object_del(inst->ibar->o_drop_over);
|
||||||
inst->ibar->o_drop_over = NULL;
|
inst->ibar->o_drop_over = NULL;
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, NULL, NULL);
|
||||||
_ibar_empty_handle(inst->ibar);
|
_ibar_empty_handle(inst->ibar);
|
||||||
_ibar_resize_handle(inst->ibar);
|
_ibar_resize_handle(inst->ibar);
|
||||||
_gc_orient(inst->gcc);
|
_gc_orient(inst->gcc);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
|
@ -57,6 +57,7 @@ struct _IBox
|
||||||
int show_desk;
|
int show_desk;
|
||||||
int icon_label;
|
int icon_label;
|
||||||
E_Zone *zone;
|
E_Zone *zone;
|
||||||
|
Evas_Coord dnd_x, dnd_y;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _IBox_Icon
|
struct _IBox_Icon
|
||||||
|
@ -108,6 +109,8 @@ static void _ibox_inst_cb_enter(void *data, const char *type, void *event_info);
|
||||||
static void _ibox_inst_cb_move(void *data, const char *type, void *event_info);
|
static void _ibox_inst_cb_move(void *data, const char *type, void *event_info);
|
||||||
static void _ibox_inst_cb_leave(void *data, const char *type, void *event_info);
|
static void _ibox_inst_cb_leave(void *data, const char *type, void *event_info);
|
||||||
static void _ibox_inst_cb_drop(void *data, const char *type, void *event_info);
|
static void _ibox_inst_cb_drop(void *data, const char *type, void *event_info);
|
||||||
|
static void _ibox_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y);
|
||||||
|
static void _ibox_inst_cb_scroll(void *data);
|
||||||
static int _ibox_cb_event_border_add(void *data, int type, void *event);
|
static int _ibox_cb_event_border_add(void *data, int type, void *event);
|
||||||
static int _ibox_cb_event_border_remove(void *data, int type, void *event);
|
static int _ibox_cb_event_border_remove(void *data, int type, void *event);
|
||||||
static int _ibox_cb_event_border_iconify(void *data, int type, void *event);
|
static int _ibox_cb_event_border_iconify(void *data, int type, void *event);
|
||||||
|
@ -812,6 +815,65 @@ _ibox_cb_drop_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||||
evas_object_resize(b->o_drop_over, w, h);
|
evas_object_resize(b->o_drop_over, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ibox_inst_cb_scroll(void *data)
|
||||||
|
{
|
||||||
|
Instance *inst;
|
||||||
|
|
||||||
|
/* Update the position of the dnd to handle for autoscrolling
|
||||||
|
* gadgets. */
|
||||||
|
inst = data;
|
||||||
|
_ibox_drop_position_update(inst, inst->ibox->dnd_x, inst->ibox->dnd_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ibox_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y)
|
||||||
|
{
|
||||||
|
Evas_Coord xx, yy;
|
||||||
|
int ox, oy;
|
||||||
|
IBox_Icon *ic;
|
||||||
|
|
||||||
|
inst->ibox->dnd_x = x;
|
||||||
|
inst->ibox->dnd_y = y;
|
||||||
|
|
||||||
|
if (inst->ibox->o_drop)
|
||||||
|
e_box_unpack(inst->ibox->o_drop);
|
||||||
|
evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
|
||||||
|
e_box_align_pixel_offset_get(inst->gcc->o_box, &ox, &oy);
|
||||||
|
ic = _ibox_icon_at_coord(inst->ibox, x + xx + ox, y + yy + oy);
|
||||||
|
inst->ibox->ic_drop_before = ic;
|
||||||
|
if (ic)
|
||||||
|
{
|
||||||
|
Evas_Coord ix, iy, iw, ih;
|
||||||
|
int before = 0;
|
||||||
|
|
||||||
|
evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih);
|
||||||
|
if (e_box_orientation_get(inst->ibox->o_box))
|
||||||
|
{
|
||||||
|
if ((x + xx) < (ix + (iw / 2))) before = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((y + yy) < (iy + (ih / 2))) before = 1;
|
||||||
|
}
|
||||||
|
if (before)
|
||||||
|
e_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder);
|
||||||
|
else
|
||||||
|
e_box_pack_after(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder);
|
||||||
|
inst->ibox->drop_before = before;
|
||||||
|
}
|
||||||
|
else e_box_pack_end(inst->ibox->o_box, inst->ibox->o_drop);
|
||||||
|
e_box_pack_options_set(inst->ibox->o_drop,
|
||||||
|
1, 1, /* fill */
|
||||||
|
0, 0, /* expand */
|
||||||
|
0.5, 0.5, /* align */
|
||||||
|
1, 1, /* min */
|
||||||
|
-1, -1 /* max */
|
||||||
|
);
|
||||||
|
_ibox_resize_handle(inst->ibox);
|
||||||
|
_gc_orient(inst->gcc);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_ibox_inst_cb_enter(void *data, const char *type, void *event_info)
|
_ibox_inst_cb_enter(void *data, const char *type, void *event_info)
|
||||||
{
|
{
|
||||||
|
@ -837,40 +899,8 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
|
||||||
evas_object_layer_set(o2, 19999);
|
evas_object_layer_set(o2, 19999);
|
||||||
evas_object_show(o);
|
evas_object_show(o);
|
||||||
evas_object_show(o2);
|
evas_object_show(o2);
|
||||||
evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
|
_ibox_drop_position_update(inst, ev->x, ev->y);
|
||||||
e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, _ibox_inst_cb_scroll, inst);
|
||||||
ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx + x, ev->y + yy + y);
|
|
||||||
inst->ibox->ic_drop_before = ic;
|
|
||||||
if (ic)
|
|
||||||
{
|
|
||||||
Evas_Coord ix, iy, iw, ih;
|
|
||||||
int before = 0;
|
|
||||||
|
|
||||||
evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih);
|
|
||||||
if (e_box_orientation_get(inst->ibox->o_box))
|
|
||||||
{
|
|
||||||
if ((ev->x + xx) < (ix + (iw / 2))) before = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((ev->y + yy) < (iy + (ih / 2))) before = 1;
|
|
||||||
}
|
|
||||||
if (before)
|
|
||||||
e_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder);
|
|
||||||
else
|
|
||||||
e_box_pack_after(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder);
|
|
||||||
inst->ibox->drop_before = before;
|
|
||||||
}
|
|
||||||
else e_box_pack_end(inst->ibox->o_box, o);
|
|
||||||
e_box_pack_options_set(o,
|
|
||||||
1, 1, /* fill */
|
|
||||||
0, 0, /* expand */
|
|
||||||
0.5, 0.5, /* align */
|
|
||||||
1, 1, /* min */
|
|
||||||
-1, -1 /* max */
|
|
||||||
);
|
|
||||||
_ibox_resize_handle(inst->ibox);
|
|
||||||
_gc_orient(inst->gcc);
|
|
||||||
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,41 +915,7 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info)
|
||||||
|
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
inst = data;
|
inst = data;
|
||||||
e_box_unpack(inst->ibox->o_drop);
|
_ibox_drop_position_update(inst, ev->x, ev->y);
|
||||||
evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
|
|
||||||
e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
|
|
||||||
ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx + x, ev->y + yy + y);
|
|
||||||
inst->ibox->ic_drop_before = ic;
|
|
||||||
if (ic)
|
|
||||||
{
|
|
||||||
Evas_Coord ix, iy, iw, ih;
|
|
||||||
int before = 0;
|
|
||||||
|
|
||||||
evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih);
|
|
||||||
if (e_box_orientation_get(inst->ibox->o_box))
|
|
||||||
{
|
|
||||||
if ((ev->x + xx) < (ix + (iw / 2))) before = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((ev->y + yy) < (iy + (ih / 2))) before = 1;
|
|
||||||
}
|
|
||||||
if (before)
|
|
||||||
e_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder);
|
|
||||||
else
|
|
||||||
e_box_pack_after(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder);
|
|
||||||
inst->ibox->drop_before = before;
|
|
||||||
}
|
|
||||||
else e_box_pack_end(inst->ibox->o_box, inst->ibox->o_drop);
|
|
||||||
e_box_pack_options_set(inst->ibox->o_drop,
|
|
||||||
1, 1, /* fill */
|
|
||||||
0, 0, /* expand */
|
|
||||||
0.5, 0.5, /* align */
|
|
||||||
1, 1, /* min */
|
|
||||||
-1, -1 /* max */
|
|
||||||
);
|
|
||||||
_ibox_resize_handle(inst->ibox);
|
|
||||||
_gc_orient(inst->gcc);
|
|
||||||
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -936,6 +932,7 @@ _ibox_inst_cb_leave(void *data, const char *type, void *event_info)
|
||||||
inst->ibox->o_drop = NULL;
|
inst->ibox->o_drop = NULL;
|
||||||
evas_object_del(inst->ibox->o_drop_over);
|
evas_object_del(inst->ibox->o_drop_over);
|
||||||
inst->ibox->o_drop_over = NULL;
|
inst->ibox->o_drop_over = NULL;
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, NULL, NULL);
|
||||||
_ibox_resize_handle(inst->ibox);
|
_ibox_resize_handle(inst->ibox);
|
||||||
_gc_orient(inst->gcc);
|
_gc_orient(inst->gcc);
|
||||||
}
|
}
|
||||||
|
@ -1002,6 +999,7 @@ _ibox_inst_cb_drop(void *data, const char *type, void *event_info)
|
||||||
evas_object_del(inst->ibox->o_drop_over);
|
evas_object_del(inst->ibox->o_drop_over);
|
||||||
inst->ibox->o_drop_over = NULL;
|
inst->ibox->o_drop_over = NULL;
|
||||||
_ibox_empty_handle(b);
|
_ibox_empty_handle(b);
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, NULL, NULL);
|
||||||
_ibox_resize_handle(inst->ibox);
|
_ibox_resize_handle(inst->ibox);
|
||||||
_gc_orient(inst->gcc);
|
_gc_orient(inst->gcc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct _Pager
|
||||||
E_Drag *drag;
|
E_Drag *drag;
|
||||||
unsigned char dragging : 1;
|
unsigned char dragging : 1;
|
||||||
unsigned char just_dragged : 1;
|
unsigned char just_dragged : 1;
|
||||||
|
Evas_Coord dnd_x, dnd_y;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _Pager_Desk
|
struct _Pager_Desk
|
||||||
|
@ -124,6 +125,8 @@ static void _pager_inst_cb_enter(void *data, const char *type, void *event_info)
|
||||||
static void _pager_inst_cb_move(void *data, const char *type, void *event_info);
|
static void _pager_inst_cb_move(void *data, const char *type, void *event_info);
|
||||||
static void _pager_inst_cb_leave(void *data, const char *type, void *event_info);
|
static void _pager_inst_cb_leave(void *data, const char *type, void *event_info);
|
||||||
static void _pager_inst_cb_drop(void *data, const char *type, void *event_info);
|
static void _pager_inst_cb_drop(void *data, const char *type, void *event_info);
|
||||||
|
static void _pager_inst_cb_scroll(void *data);
|
||||||
|
static void _pager_update_drop_position(Instance *inst, Evas_Coord x, Evas_Coord y);
|
||||||
static void _pager_desk_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _pager_desk_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _pager_desk_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _pager_desk_cb_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
static void _pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
static void _pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||||
|
@ -1503,30 +1506,27 @@ _pager_window_cb_drag_finished(E_Drag *drag, int dropped)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_pager_inst_cb_enter(void *data, const char *type, void *event_info)
|
_pager_inst_cb_scroll(void *data)
|
||||||
{
|
{
|
||||||
E_Event_Dnd_Enter *ev;
|
|
||||||
Instance * inst;
|
Instance * inst;
|
||||||
|
|
||||||
ev = event_info;
|
|
||||||
inst = data;
|
inst = data;
|
||||||
|
_pager_update_drop_position(inst, inst->pager->dnd_x, inst->pager->dnd_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_pager_inst_cb_move(void *data, const char *type, void *event_info)
|
_pager_update_drop_position(Instance *inst, Evas_Coord x, Evas_Coord y)
|
||||||
{
|
{
|
||||||
E_Event_Dnd_Move *ev;
|
|
||||||
Instance *inst;
|
|
||||||
Pager_Desk *pd, *pd2;
|
Pager_Desk *pd, *pd2;
|
||||||
Evas_List *l;
|
|
||||||
Evas_Coord xx, yy;
|
Evas_Coord xx, yy;
|
||||||
int x, y;
|
int ox, oy;
|
||||||
|
Evas_List *l;
|
||||||
|
|
||||||
ev = event_info;
|
inst->pager->dnd_x = x;
|
||||||
inst = data;
|
inst->pager->dnd_y = y;
|
||||||
evas_object_geometry_get(inst->pager->o_table, &xx, &yy, NULL, NULL);
|
evas_object_geometry_get(inst->pager->o_table, &xx, &yy, NULL, NULL);
|
||||||
e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
|
e_box_align_pixel_offset_get(inst->gcc->o_box, &ox, &oy);
|
||||||
pd = _pager_desk_at_coord(inst->pager, ev->x + xx + x, ev->y + yy + y);
|
pd = _pager_desk_at_coord(inst->pager, x + xx + ox, y + yy + oy);
|
||||||
/* FIXME: keep track which one its over so we only emit drag in/out
|
/* FIXME: keep track which one its over so we only emit drag in/out
|
||||||
* when it actually goes form one desk to another */
|
* when it actually goes form one desk to another */
|
||||||
for (l = inst->pager->desks; l; l = l->next)
|
for (l = inst->pager->desks; l; l = l->next)
|
||||||
|
@ -1537,6 +1537,30 @@ _pager_inst_cb_move(void *data, const char *type, void *event_info)
|
||||||
else
|
else
|
||||||
edje_object_signal_emit(pd2->o_desk, "e,action,drag,out", "e");
|
edje_object_signal_emit(pd2->o_desk, "e,action,drag,out", "e");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_pager_inst_cb_enter(void *data, const char *type, void *event_info)
|
||||||
|
{
|
||||||
|
E_Event_Dnd_Enter *ev;
|
||||||
|
Instance *inst;
|
||||||
|
|
||||||
|
ev = event_info;
|
||||||
|
inst = data;
|
||||||
|
_pager_update_drop_position(inst, ev->x, ev->y);
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, _pager_inst_cb_scroll, inst);
|
||||||
|
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_pager_inst_cb_move(void *data, const char *type, void *event_info)
|
||||||
|
{
|
||||||
|
E_Event_Dnd_Move *ev;
|
||||||
|
Instance *inst;
|
||||||
|
|
||||||
|
ev = event_info;
|
||||||
|
inst = data;
|
||||||
|
_pager_update_drop_position(inst, ev->x, ev->y);
|
||||||
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1558,6 +1582,8 @@ _pager_inst_cb_leave(void *data, const char *type, void *event_info)
|
||||||
pd = l->data;
|
pd = l->data;
|
||||||
edje_object_signal_emit(pd->o_desk, "e,action,drag,out", "e");
|
edje_object_signal_emit(pd->o_desk, "e,action,drag,out", "e");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1627,6 +1653,8 @@ _pager_inst_cb_drop(void *data, const char *type, void *event_info)
|
||||||
pd = l->data;
|
pd = l->data;
|
||||||
edje_object_signal_emit(pd->o_desk, "e,action,drag,out", "e");
|
edje_object_signal_emit(pd->o_desk, "e,action,drag,out", "e");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e_gadcon_client_autoscroll_cb_set(inst->gcc, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue