forked from enlightenment/enlightenment
Let the user decide the object for a drag.
SVN revision: 14702
This commit is contained in:
parent
6fd2d5fe41
commit
aa1d7d26c3
|
@ -2490,12 +2490,15 @@ _e_border_cb_mouse_move(void *data, int type, void *event)
|
|||
if (a)
|
||||
{
|
||||
E_Drag *drag;
|
||||
Evas_Object *o;
|
||||
Evas_Coord w, h;
|
||||
|
||||
drag = e_drag_new(bd->zone->container,
|
||||
"enlightenment/border", bd,
|
||||
NULL,
|
||||
a->path, "icon");
|
||||
"enlightenment/border", bd, NULL);
|
||||
o = edje_object_add(drag->evas);
|
||||
edje_object_file_set(o, a->path, "icon");
|
||||
e_drag_object_set(drag, o);
|
||||
|
||||
edje_object_part_geometry_get(bd->bg_object, "icon",
|
||||
NULL, NULL, &w, &h);
|
||||
e_drag_resize(drag, w, h);
|
||||
|
|
|
@ -117,8 +117,7 @@ e_dnd_shutdown(void)
|
|||
E_Drag*
|
||||
e_drag_new(E_Container *container,
|
||||
const char *type, void *data,
|
||||
void (*finished_cb)(E_Drag *drag, int dropped),
|
||||
const char *icon_path, const char *icon)
|
||||
void (*finished_cb)(E_Drag *drag, int dropped))
|
||||
{
|
||||
E_Drag *drag;
|
||||
|
||||
|
@ -164,8 +163,8 @@ e_drag_new(E_Container *container,
|
|||
|
||||
ecore_evas_shaped_set(drag->ecore_evas, 1);
|
||||
|
||||
drag->object = edje_object_add(drag->evas);
|
||||
edje_object_file_set(drag->object, icon_path, icon);
|
||||
drag->object = evas_object_rectangle_add(drag->evas);
|
||||
evas_object_color_set(drag->object, 255, 0, 0, 255);
|
||||
evas_object_show(drag->object);
|
||||
|
||||
evas_object_move(drag->object, 0, 0);
|
||||
|
@ -179,6 +178,19 @@ e_drag_new(E_Container *container,
|
|||
return drag;
|
||||
}
|
||||
|
||||
Evas *
|
||||
e_drag_evas_get(E_Drag *drag)
|
||||
{
|
||||
return drag->evas;
|
||||
}
|
||||
|
||||
void
|
||||
e_drag_object_set(E_Drag *drag, Evas_Object *object)
|
||||
{
|
||||
if (drag->object) evas_object_del(drag->object);
|
||||
drag->object = object;
|
||||
}
|
||||
|
||||
void
|
||||
e_drag_show(E_Drag *drag)
|
||||
{
|
||||
|
@ -204,15 +216,15 @@ e_drag_move(E_Drag *drag, int x, int y)
|
|||
drag->x = x;
|
||||
drag->y = y;
|
||||
ecore_evas_move(drag->ecore_evas,
|
||||
drag->x,
|
||||
drag->y);
|
||||
drag->x - (drag->w / 2),
|
||||
drag->y - (drag->h / 2));
|
||||
e_container_shape_move(drag->shape,
|
||||
drag->x,
|
||||
drag->y);
|
||||
drag->x - (drag->w / 2),
|
||||
drag->y - (drag->h / 2));
|
||||
}
|
||||
|
||||
void
|
||||
e_drag_resize(E_Drag *drag, unsigned int w, unsigned int h)
|
||||
e_drag_resize(E_Drag *drag, int w, int h)
|
||||
{
|
||||
if ((drag->w == w) && (drag->h == h)) return;
|
||||
drag->h = h;
|
||||
|
@ -384,6 +396,15 @@ e_drop_handler_add(void *data,
|
|||
return handler;
|
||||
}
|
||||
|
||||
void
|
||||
e_drop_handler_geometry_set(E_Drop_Handler *handler, int x, int y, int w, int h)
|
||||
{
|
||||
handler->x = x;
|
||||
handler->y = y;
|
||||
handler->w = w;
|
||||
handler->h = h;
|
||||
}
|
||||
|
||||
void
|
||||
e_drop_handler_del(E_Drop_Handler *handler)
|
||||
{
|
||||
|
|
|
@ -33,15 +33,10 @@ struct _E_Drag
|
|||
E_Container_Shape *shape;
|
||||
Evas_Object *object;
|
||||
|
||||
int x, y;
|
||||
unsigned int w, h;
|
||||
int x, y, w, h;
|
||||
|
||||
unsigned int layer;
|
||||
unsigned char visible : 1;
|
||||
/*
|
||||
unsigned char shaped : 1;
|
||||
unsigned char need_shape_export : 1;
|
||||
*/
|
||||
};
|
||||
|
||||
struct _E_Drop_Handler
|
||||
|
@ -86,12 +81,13 @@ EAPI int e_dnd_shutdown(void);
|
|||
EAPI int e_dnd_active(void);
|
||||
|
||||
EAPI E_Drag* e_drag_new(E_Container *container, const char *type, void *data,
|
||||
void (*finished_cb)(E_Drag *drag, int dropped),
|
||||
const char *icon_path, const char *icon);
|
||||
void (*finished_cb)(E_Drag *drag, int dropped));
|
||||
EAPI Evas *e_drag_evas_get(E_Drag *drag);
|
||||
EAPI void e_drag_object_set(E_Drag *drag, Evas_Object *object);
|
||||
EAPI void e_drag_show(E_Drag *drag);
|
||||
EAPI void e_drag_hide(E_Drag *drag);
|
||||
EAPI void e_drag_move(E_Drag *drag, int x, int y);
|
||||
EAPI void e_drag_resize(E_Drag *drag, unsigned int w, unsigned int h);
|
||||
EAPI void e_drag_resize(E_Drag *drag, int w, int h);
|
||||
|
||||
EAPI void e_drag_start(E_Drag *drag);
|
||||
EAPI void e_drag_update(int x, int y);
|
||||
|
@ -103,6 +99,7 @@ EAPI E_Drop_Handler *e_drop_handler_add(void *data,
|
|||
void (*leave_cb)(void *data, const char *type, void *event),
|
||||
void (*drop_cb)(void *data, const char *type, void *event),
|
||||
const char *type, int x, int y, int w, int h);
|
||||
EAPI void e_drop_handler_geometry_set(E_Drop_Handler *handler, int x, int y, int w, int h);
|
||||
EAPI void e_drop_handler_del(E_Drop_Handler *handler);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1245,13 +1245,17 @@ _ibar_icon_cb_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info
|
|||
if (dist > 10)
|
||||
{
|
||||
E_Drag *d;
|
||||
Evas_Object *o;
|
||||
|
||||
drag = 1;
|
||||
drag_start = 0;
|
||||
|
||||
d = e_drag_new(ic->ibb->con,
|
||||
"enlightenment/eapp", ic->app, _ibar_bar_cb_finished,
|
||||
ic->app->path, "icon");
|
||||
"enlightenment/eapp", ic->app, _ibar_bar_cb_finished);
|
||||
o = edje_object_add(e_drag_evas_get(d));
|
||||
edje_object_file_set(o, ic->app->path, "icon");
|
||||
e_drag_object_set(d, o);
|
||||
|
||||
e_drag_resize(d, ic->ibb->ibar->conf->iconsize, ic->ibb->ibar->conf->iconsize);
|
||||
e_drag_start(d);
|
||||
evas_event_feed_mouse_up(ic->ibb->evas, 1, EVAS_BUTTON_NONE, NULL);
|
||||
|
@ -1433,6 +1437,9 @@ _ibar_bar_cb_move(void *data, const char *type, void *event)
|
|||
iw = h / (double) evas_list_count(ibb->icons);
|
||||
pos = round(y / iw);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
ic = evas_list_nth(ibb->icons, pos);
|
||||
|
||||
e_box_freeze(ibb->box_object);
|
||||
|
@ -1519,6 +1526,9 @@ _ibar_bar_cb_drop(void *data, const char *type, void *event)
|
|||
iw = h / (double) evas_list_count(ibb->icons);
|
||||
pos = round(y / iw);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
ic = evas_list_nth(ibb->icons, pos);
|
||||
if (ic)
|
||||
{
|
||||
|
@ -1562,10 +1572,10 @@ _ibar_bar_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change
|
|||
_ibar_bar_follower_reset(ibb);
|
||||
_ibar_bar_timer_handle(ibb);
|
||||
|
||||
ibb->drop_handler->x = ibb->x + ibb->inset.l;
|
||||
ibb->drop_handler->y = ibb->y + ibb->inset.t;
|
||||
ibb->drop_handler->w = ibb->w - (ibb->inset.l + ibb->inset.r);
|
||||
ibb->drop_handler->h = ibb->h - (ibb->inset.t + ibb->inset.b);
|
||||
e_drop_handler_geometry_set(ibb->drop_handler,
|
||||
ibb->x + ibb->inset.l, ibb->y + ibb->inset.t,
|
||||
ibb->w - (ibb->inset.l + ibb->inset.r),
|
||||
ibb->h - (ibb->inset.t + ibb->inset.b));
|
||||
break;
|
||||
case E_GADMAN_CHANGE_EDGE:
|
||||
_ibar_bar_edge_change(ibb, e_gadman_client_edge_get(ibb->gmc));
|
||||
|
|
|
@ -62,7 +62,7 @@ static void _pager_desk_cb_mouse_move(void *data, Evas *e, Evas_Object *o
|
|||
static void _pager_desk_cb_intercept_move(void *data, Evas_Object *o, Evas_Coord x, Evas_Coord y);
|
||||
static void _pager_desk_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_Coord h);
|
||||
|
||||
static void _pager_drop_cb(void *data, const char *type, void *drop);
|
||||
static void _pager_cb_drop(void *data, const char *type, void *drop);
|
||||
|
||||
static int _pager_count;
|
||||
|
||||
|
@ -342,7 +342,7 @@ _pager_face_new(E_Zone *zone)
|
|||
evas_object_show(o);
|
||||
|
||||
face->drop_handler = e_drop_handler_add(face,
|
||||
NULL, NULL, NULL, _pager_drop_cb,
|
||||
NULL, NULL, NULL, _pager_cb_drop,
|
||||
"enlightenment/border",
|
||||
face->fx, face->fy, face->fw, face->fh);
|
||||
|
||||
|
@ -717,10 +717,11 @@ _pager_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change chan
|
|||
|
||||
face = data;
|
||||
e_gadman_client_geometry_get(face->gmc, &x, &y, &w, &h);
|
||||
face->drop_handler->x = face->fx = x;
|
||||
face->drop_handler->y = face->fy = y;
|
||||
face->drop_handler->w = face->fw = w;
|
||||
face->drop_handler->h = face->fh = h;
|
||||
face->fx = x;
|
||||
face->fy = y;
|
||||
face->fw = w;
|
||||
face->fh = h;
|
||||
e_drop_handler_geometry_set(face->drop_handler, x, y, w, h);
|
||||
switch (change)
|
||||
{
|
||||
case E_GADMAN_CHANGE_MOVE_RESIZE:
|
||||
|
@ -1365,7 +1366,7 @@ _pager_desk_cb_intercept_resize(void *data, Evas_Object *o, Evas_Coord w, Evas_C
|
|||
}
|
||||
|
||||
static void
|
||||
_pager_drop_cb(void *data, const char *type, void *event_info)
|
||||
_pager_cb_drop(void *data, const char *type, void *event_info)
|
||||
{
|
||||
E_Event_Dnd_Drop *ev;
|
||||
Pager_Face *face;
|
||||
|
@ -1377,6 +1378,7 @@ _pager_drop_cb(void *data, const char *type, void *event_info)
|
|||
ev = event_info;
|
||||
face = data;
|
||||
|
||||
/* FIXME, check if the pager module has border */
|
||||
w = face->fw / (double) face->xnum;
|
||||
h = face->fh / (double) face->ynum;
|
||||
|
||||
|
|
Loading…
Reference in New Issue