aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormetrics <metrics>2006-11-12 11:32:44 +0000
committermetrics <metrics@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2006-11-12 11:32:44 +0000
commit5cc25e147ab9dc0e0a6d79d53ed6173066786ac1 (patch)
tree1b0bc47941dbe016afe950443cdf13fa37a9c82b
parent93e6517c22ad5033aff2764c0731d55d84637177 (diff)
downloadenlightenment-5cc25e147ab9dc0e0a6d79d53ed6173066786ac1.tar.gz
enlightenment-5cc25e147ab9dc0e0a6d79d53ed6173066786ac1.tar.xz
enlightenment-5cc25e147ab9dc0e0a6d79d53ed6173066786ac1.zip
Start of fix for drag and drop to autoscrolling ibar/ibox.
SVN revision: 27068
-rw-r--r--src/bin/e_box.c14
-rw-r--r--src/bin/e_box.h1
-rw-r--r--src/bin/e_dnd.c10
-rw-r--r--src/bin/e_gadcon.c18
-rw-r--r--src/bin/e_gadcon.h1
-rw-r--r--src/modules/ibar/e_mod_main.c12
-rw-r--r--src/modules/ibox/e_mod_main.c12
7 files changed, 56 insertions, 12 deletions
diff --git a/src/bin/e_box.c b/src/bin/e_box.c
index 0d538193d..0ab574571 100644
--- a/src/bin/e_box.c
+++ b/src/bin/e_box.c
@@ -323,6 +323,20 @@ e_box_align_set(Evas_Object *obj, double ax, double ay)
if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
}
+/*
+ * Returns the number of pixels that are hidden on the left/top side.
+ */
+EAPI void
+e_box_align_pixel_offset_get(Evas_Object *obj, int *x, int *y)
+{
+ E_Smart_Data *sd;
+
+ sd = evas_object_smart_data_get(obj);
+ if (!sd) return;
+ if (x) *x = (sd->min.w - sd->w) * (1.0 - sd->align.x);
+ if (y) *y = (sd->min.h - sd->h) * (1.0 - sd->align.y);
+}
+
/* local subsystem functions */
static E_Box_Item *
_e_box_smart_adopt(E_Smart_Data *sd, Evas_Object *obj)
diff --git a/src/bin/e_box.h b/src/bin/e_box.h
index 3e30534ca..03e6c95d9 100644
--- a/src/bin/e_box.h
+++ b/src/bin/e_box.h
@@ -26,6 +26,7 @@ EAPI void e_box_min_size_get (Evas_Object *obj, Evas_Coord *minw, E
EAPI void e_box_max_size_get (Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
EAPI void e_box_align_get (Evas_Object *obj, double *ax, double *ay);
EAPI void e_box_align_set (Evas_Object *obj, double ax, double ay);
+EAPI void e_box_align_pixel_offset_get (Evas_Object *obj, int *x, int *y);
#endif
#endif
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index ec00d46fb..385709781 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -506,6 +506,9 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
case E_GADCON_TYPE:
e_gadcon_canvas_zone_geometry_get((E_Gadcon *)(h->obj), &px, &py, NULL, NULL);
break;
+ case E_GADCON_CLIENT_TYPE:
+ evas_object_geometry_get(((E_Gadcon_Client *)(h->obj))->o_box, dx, dy, dw, dh);
+ break;
case E_WIN_TYPE:
px = ((E_Win *)(h->obj))->x;
py = ((E_Win *)(h->obj))->y;
@@ -518,7 +521,7 @@ _e_drag_coords_update(E_Drop_Handler *h, int *dx, int *dy, int *dw, int *dh)
px = ((E_Popup *)(h->obj))->x;
py = ((E_Popup *)(h->obj))->y;
break;
- /* FIXME: add mroe types as needed */
+ /* FIXME: add more types as needed */
default:
break;
}
@@ -539,6 +542,9 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
case E_GADCON_TYPE:
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);
+ break;
case E_WIN_TYPE:
hwin = ((E_Win *)(h->obj))->evas_win;
break;
@@ -548,7 +554,7 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
case E_POPUP_TYPE:
hwin = ((E_Popup *)(h->obj))->evas_win;
break;
- /* FIXME: add mroe types as needed */
+ /* FIXME: add more types as needed */
default:
break;
}
diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c
index b7bbd2618..af151e9a2 100644
--- a/src/bin/e_gadcon.c
+++ b/src/bin/e_gadcon.c
@@ -1348,6 +1348,7 @@ _e_gadcon_cb_client_scroll_animator(void *data)
gcc->scroll_animator = NULL;
return 0;
}
+
return 1;
}
@@ -1356,17 +1357,26 @@ _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void
{
Evas_Event_Mouse_Move *ev;
E_Gadcon_Client *gcc;
- Evas_Coord x, y, w, h;
+ Evas_Coord x, y;
ev = event_info;
gcc = data;
+ evas_object_geometry_get(gcc->o_box, &x, &y, NULL, NULL);
+ e_gadcon_client_autoscroll_update(gcc, ev->cur.output.x - x, ev->cur.output.y - y);
+}
+
+/*
+ * NOTE: x & y are relative to the o_box of the gadcon.
+ */
+EAPI void
+e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, Evas_Coord x, Evas_Coord y)
+{
if (gcc->autoscroll)
{
+ Evas_Coord w, h;
double d;
- evas_object_geometry_get(gcc->o_box, &x, &y, &w, &h);
- x = ev->cur.output.x - x;
- y = ev->cur.output.y - y;
+ evas_object_geometry_get(gcc->o_box, NULL, NULL, &w, &h);
if (e_box_orientation_get(gcc->o_box))
{
if (w > 1) d = (double)x / (double)(w - 1);
diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h
index 2bfab0bba..d3f073fe7 100644
--- a/src/bin/e_gadcon.h
+++ b/src/bin/e_gadcon.h
@@ -175,6 +175,7 @@ EAPI void e_gadcon_client_size_request(E_Gadcon_Client *gcc, Evas_Co
EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord 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_update(E_Gadcon_Client *gcc, int mx, int my);
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);
diff --git a/src/modules/ibar/e_mod_main.c b/src/modules/ibar/e_mod_main.c
index 51e835e2e..cdf983e06 100644
--- a/src/modules/ibar/e_mod_main.c
+++ b/src/modules/ibar/e_mod_main.c
@@ -146,7 +146,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->gadcon), inst,
+ e_drop_handler_add(E_OBJECT(inst->gcc), inst,
_ibar_inst_cb_enter, _ibar_inst_cb_move,
_ibar_inst_cb_leave, _ibar_inst_cb_drop,
drop, 3, x, y, w, h);
@@ -1067,6 +1067,7 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
Evas_Object *o, *o2;
IBar_Icon *ic;
Evas_Coord xx, yy;
+ int x, y;
ev = event_info;
inst = data;
@@ -1084,7 +1085,8 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
evas_object_show(o);
evas_object_show(o2);
evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
- ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy);
+ 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)
{
@@ -1116,6 +1118,7 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
);
_ibar_resize_handle(inst->ibar);
_gc_orient(inst->gcc);
+ e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
}
static void
@@ -1125,12 +1128,14 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
Instance *inst;
IBar_Icon *ic;
Evas_Coord xx, yy;
+ int x, y;
ev = event_info;
inst = data;
e_box_unpack(inst->ibar->o_drop);
evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
- ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy);
+ 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)
{
@@ -1162,6 +1167,7 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
);
_ibar_resize_handle(inst->ibar);
_gc_orient(inst->gcc);
+ e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
}
static void
diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c
index fc4f8433a..a656341a7 100644
--- a/src/modules/ibox/e_mod_main.c
+++ b/src/modules/ibox/e_mod_main.c
@@ -156,7 +156,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->gadcon), inst,
+ e_drop_handler_add(E_OBJECT(inst->gcc), inst,
_ibox_inst_cb_enter, _ibox_inst_cb_move,
_ibox_inst_cb_leave, _ibox_inst_cb_drop,
drop, 1, x, y, w, h);
@@ -820,6 +820,7 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
Evas_Object *o, *o2;
IBox_Icon *ic;
Evas_Coord xx, yy;
+ int x, y;
ev = event_info;
inst = data;
@@ -837,7 +838,8 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
evas_object_show(o);
evas_object_show(o2);
evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
- ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx, ev->y + yy);
+ 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)
{
@@ -869,6 +871,7 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
);
_ibox_resize_handle(inst->ibox);
_gc_orient(inst->gcc);
+ e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
}
static void
@@ -878,12 +881,14 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info)
Instance *inst;
IBox_Icon *ic;
Evas_Coord xx, yy;
+ int x, y;
ev = event_info;
inst = data;
e_box_unpack(inst->ibox->o_drop);
evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
- ic = _ibox_icon_at_coord(inst->ibox, ev->x, ev->y);
+ 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)
{
@@ -915,6 +920,7 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info)
);
_ibox_resize_handle(inst->ibox);
_gc_orient(inst->gcc);
+ e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
}
static void