summaryrefslogtreecommitdiff
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)
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 0d53819..0ab5745 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)
323 if (sd->frozen <= 0) _e_box_smart_reconfigure(sd); 323 if (sd->frozen <= 0) _e_box_smart_reconfigure(sd);
324} 324}
325 325
326/*
327 * Returns the number of pixels that are hidden on the left/top side.
328 */
329EAPI void
330e_box_align_pixel_offset_get(Evas_Object *obj, int *x, int *y)
331{
332 E_Smart_Data *sd;
333
334 sd = evas_object_smart_data_get(obj);
335 if (!sd) return;
336 if (x) *x = (sd->min.w - sd->w) * (1.0 - sd->align.x);
337 if (y) *y = (sd->min.h - sd->h) * (1.0 - sd->align.y);
338}
339
326/* local subsystem functions */ 340/* local subsystem functions */
327static E_Box_Item * 341static E_Box_Item *
328_e_box_smart_adopt(E_Smart_Data *sd, Evas_Object *obj) 342_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 3e30534..03e6c95 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
26EAPI void e_box_max_size_get (Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh); 26EAPI void e_box_max_size_get (Evas_Object *obj, Evas_Coord *maxw, Evas_Coord *maxh);
27EAPI void e_box_align_get (Evas_Object *obj, double *ax, double *ay); 27EAPI void e_box_align_get (Evas_Object *obj, double *ax, double *ay);
28EAPI void e_box_align_set (Evas_Object *obj, double ax, double ay); 28EAPI void e_box_align_set (Evas_Object *obj, double ax, double ay);
29EAPI void e_box_align_pixel_offset_get (Evas_Object *obj, int *x, int *y);
29 30
30#endif 31#endif
31#endif 32#endif
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index ec00d46..3857097 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)
506 case E_GADCON_TYPE: 506 case E_GADCON_TYPE:
507 e_gadcon_canvas_zone_geometry_get((E_Gadcon *)(h->obj), &px, &py, NULL, NULL); 507 e_gadcon_canvas_zone_geometry_get((E_Gadcon *)(h->obj), &px, &py, NULL, NULL);
508 break; 508 break;
509 case E_GADCON_CLIENT_TYPE:
510 evas_object_geometry_get(((E_Gadcon_Client *)(h->obj))->o_box, dx, dy, dw, dh);
511 break;
509 case E_WIN_TYPE: 512 case E_WIN_TYPE:
510 px = ((E_Win *)(h->obj))->x; 513 px = ((E_Win *)(h->obj))->x;
511 py = ((E_Win *)(h->obj))->y; 514 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)
518 px = ((E_Popup *)(h->obj))->x; 521 px = ((E_Popup *)(h->obj))->x;
519 py = ((E_Popup *)(h->obj))->y; 522 py = ((E_Popup *)(h->obj))->y;
520 break; 523 break;
521 /* FIXME: add mroe types as needed */ 524 /* FIXME: add more types as needed */
522 default: 525 default:
523 break; 526 break;
524 } 527 }
@@ -539,6 +542,9 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
539 case E_GADCON_TYPE: 542 case E_GADCON_TYPE:
540 hwin = e_gadcon_dnd_window_get((E_Gadcon *)(h->obj)); 543 hwin = e_gadcon_dnd_window_get((E_Gadcon *)(h->obj));
541 break; 544 break;
545 case E_GADCON_CLIENT_TYPE:
546 hwin = e_gadcon_dnd_window_get(((E_Gadcon_Client *)(h->obj))->gadcon);
547 break;
542 case E_WIN_TYPE: 548 case E_WIN_TYPE:
543 hwin = ((E_Win *)(h->obj))->evas_win; 549 hwin = ((E_Win *)(h->obj))->evas_win;
544 break; 550 break;
@@ -548,7 +554,7 @@ _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win)
548 case E_POPUP_TYPE: 554 case E_POPUP_TYPE:
549 hwin = ((E_Popup *)(h->obj))->evas_win; 555 hwin = ((E_Popup *)(h->obj))->evas_win;
550 break; 556 break;
551 /* FIXME: add mroe types as needed */ 557 /* FIXME: add more types as needed */
552 default: 558 default:
553 break; 559 break;
554 } 560 }
diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c
index b7bbd26..af151e9 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)
1348 gcc->scroll_animator = NULL; 1348 gcc->scroll_animator = NULL;
1349 return 0; 1349 return 0;
1350 } 1350 }
1351
1351 return 1; 1352 return 1;
1352} 1353}
1353 1354
@@ -1356,17 +1357,26 @@ _e_gadcon_cb_client_frame_mouse_move(void *data, Evas *e, Evas_Object *obj, void
1356{ 1357{
1357 Evas_Event_Mouse_Move *ev; 1358 Evas_Event_Mouse_Move *ev;
1358 E_Gadcon_Client *gcc; 1359 E_Gadcon_Client *gcc;
1359 Evas_Coord x, y, w, h; 1360 Evas_Coord x, y;
1360 1361
1361 ev = event_info; 1362 ev = event_info;
1362 gcc = data; 1363 gcc = data;
1364 evas_object_geometry_get(gcc->o_box, &x, &y, NULL, NULL);
1365 e_gadcon_client_autoscroll_update(gcc, ev->cur.output.x - x, ev->cur.output.y - y);
1366}
1367
1368/*
1369 * NOTE: x & y are relative to the o_box of the gadcon.
1370 */
1371EAPI void
1372e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, Evas_Coord x, Evas_Coord y)
1373{
1363 if (gcc->autoscroll) 1374 if (gcc->autoscroll)
1364 { 1375 {
1376 Evas_Coord w, h;
1365 double d; 1377 double d;
1366 1378
1367 evas_object_geometry_get(gcc->o_box, &x, &y, &w, &h); 1379 evas_object_geometry_get(gcc->o_box, NULL, NULL, &w, &h);
1368 x = ev->cur.output.x - x;
1369 y = ev->cur.output.y - y;
1370 if (e_box_orientation_get(gcc->o_box)) 1380 if (e_box_orientation_get(gcc->o_box))
1371 { 1381 {
1372 if (w > 1) d = (double)x / (double)(w - 1); 1382 if (w > 1) d = (double)x / (double)(w - 1);
diff --git a/src/bin/e_gadcon.h b/src/bin/e_gadcon.h
index 2bfab0b..d3f073f 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
175EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h); 175EAPI void e_gadcon_client_min_size_set(E_Gadcon_Client *gcc, Evas_Coord w, Evas_Coord h);
176EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h); 176EAPI void e_gadcon_client_aspect_set(E_Gadcon_Client *gcc, int w, int h);
177EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll); 177EAPI void e_gadcon_client_autoscroll_set(E_Gadcon_Client *gcc, int autoscroll);
178EAPI void e_gadcon_client_autoscroll_update(E_Gadcon_Client *gcc, int mx, int my);
178EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable); 179EAPI void e_gadcon_client_resizable_set(E_Gadcon_Client *gcc, int resizable);
179 180
180EAPI void e_gadcon_client_util_menu_items_append(E_Gadcon_Client *gcc, E_Menu *menu, int flags); 181EAPI 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 51e835e..cdf983e 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)
146 146
147 evas_object_geometry_get(o, &x, &y, &w, &h); 147 evas_object_geometry_get(o, &x, &y, &w, &h);
148 inst->drop_handler = 148 inst->drop_handler =
149 e_drop_handler_add(E_OBJECT(inst->gcc->gadcon), inst, 149 e_drop_handler_add(E_OBJECT(inst->gcc), inst,
150 _ibar_inst_cb_enter, _ibar_inst_cb_move, 150 _ibar_inst_cb_enter, _ibar_inst_cb_move,
151 _ibar_inst_cb_leave, _ibar_inst_cb_drop, 151 _ibar_inst_cb_leave, _ibar_inst_cb_drop,
152 drop, 3, x, y, w, h); 152 drop, 3, x, y, w, h);
@@ -1067,6 +1067,7 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
1067 Evas_Object *o, *o2; 1067 Evas_Object *o, *o2;
1068 IBar_Icon *ic; 1068 IBar_Icon *ic;
1069 Evas_Coord xx, yy; 1069 Evas_Coord xx, yy;
1070 int x, y;
1070 1071
1071 ev = event_info; 1072 ev = event_info;
1072 inst = data; 1073 inst = data;
@@ -1084,7 +1085,8 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
1084 evas_object_show(o); 1085 evas_object_show(o);
1085 evas_object_show(o2); 1086 evas_object_show(o2);
1086 evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL); 1087 evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
1087 ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy); 1088 e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
1089 ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx + x, ev->y + yy + y);
1088 inst->ibar->ic_drop_before = ic; 1090 inst->ibar->ic_drop_before = ic;
1089 if (ic) 1091 if (ic)
1090 { 1092 {
@@ -1116,6 +1118,7 @@ _ibar_inst_cb_enter(void *data, const char *type, void *event_info)
1116 ); 1118 );
1117 _ibar_resize_handle(inst->ibar); 1119 _ibar_resize_handle(inst->ibar);
1118 _gc_orient(inst->gcc); 1120 _gc_orient(inst->gcc);
1121 e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
1119} 1122}
1120 1123
1121static void 1124static void
@@ -1125,12 +1128,14 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
1125 Instance *inst; 1128 Instance *inst;
1126 IBar_Icon *ic; 1129 IBar_Icon *ic;
1127 Evas_Coord xx, yy; 1130 Evas_Coord xx, yy;
1131 int x, y;
1128 1132
1129 ev = event_info; 1133 ev = event_info;
1130 inst = data; 1134 inst = data;
1131 e_box_unpack(inst->ibar->o_drop); 1135 e_box_unpack(inst->ibar->o_drop);
1132 evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL); 1136 evas_object_geometry_get(inst->ibar->o_box, &xx, &yy, NULL, NULL);
1133 ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx, ev->y + yy); 1137 e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
1138 ic = _ibar_icon_at_coord(inst->ibar, ev->x + xx + x, ev->y + yy + y);
1134 inst->ibar->ic_drop_before = ic; 1139 inst->ibar->ic_drop_before = ic;
1135 if (ic) 1140 if (ic)
1136 { 1141 {
@@ -1162,6 +1167,7 @@ _ibar_inst_cb_move(void *data, const char *type, void *event_info)
1162 ); 1167 );
1163 _ibar_resize_handle(inst->ibar); 1168 _ibar_resize_handle(inst->ibar);
1164 _gc_orient(inst->gcc); 1169 _gc_orient(inst->gcc);
1170 e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
1165} 1171}
1166 1172
1167static void 1173static void
diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c
index fc4f843..a656341 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)
156 156
157 evas_object_geometry_get(o, &x, &y, &w, &h); 157 evas_object_geometry_get(o, &x, &y, &w, &h);
158 inst->drop_handler = 158 inst->drop_handler =
159 e_drop_handler_add(E_OBJECT(inst->gcc->gadcon), inst, 159 e_drop_handler_add(E_OBJECT(inst->gcc), inst,
160 _ibox_inst_cb_enter, _ibox_inst_cb_move, 160 _ibox_inst_cb_enter, _ibox_inst_cb_move,
161 _ibox_inst_cb_leave, _ibox_inst_cb_drop, 161 _ibox_inst_cb_leave, _ibox_inst_cb_drop,
162 drop, 1, x, y, w, h); 162 drop, 1, x, y, w, h);
@@ -820,6 +820,7 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
820 Evas_Object *o, *o2; 820 Evas_Object *o, *o2;
821 IBox_Icon *ic; 821 IBox_Icon *ic;
822 Evas_Coord xx, yy; 822 Evas_Coord xx, yy;
823 int x, y;
823 824
824 ev = event_info; 825 ev = event_info;
825 inst = data; 826 inst = data;
@@ -837,7 +838,8 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
837 evas_object_show(o); 838 evas_object_show(o);
838 evas_object_show(o2); 839 evas_object_show(o2);
839 evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL); 840 evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
840 ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx, ev->y + yy); 841 e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
842 ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx + x, ev->y + yy + y);
841 inst->ibox->ic_drop_before = ic; 843 inst->ibox->ic_drop_before = ic;
842 if (ic) 844 if (ic)
843 { 845 {
@@ -869,6 +871,7 @@ _ibox_inst_cb_enter(void *data, const char *type, void *event_info)
869 ); 871 );
870 _ibox_resize_handle(inst->ibox); 872 _ibox_resize_handle(inst->ibox);
871 _gc_orient(inst->gcc); 873 _gc_orient(inst->gcc);
874 e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
872} 875}
873 876
874static void 877static void
@@ -878,12 +881,14 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info)
878 Instance *inst; 881 Instance *inst;
879 IBox_Icon *ic; 882 IBox_Icon *ic;
880 Evas_Coord xx, yy; 883 Evas_Coord xx, yy;
884 int x, y;
881 885
882 ev = event_info; 886 ev = event_info;
883 inst = data; 887 inst = data;
884 e_box_unpack(inst->ibox->o_drop); 888 e_box_unpack(inst->ibox->o_drop);
885 evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL); 889 evas_object_geometry_get(inst->ibox->o_box, &xx, &yy, NULL, NULL);
886 ic = _ibox_icon_at_coord(inst->ibox, ev->x, ev->y); 890 e_box_align_pixel_offset_get(inst->gcc->o_box, &x, &y);
891 ic = _ibox_icon_at_coord(inst->ibox, ev->x + xx + x, ev->y + yy + y);
887 inst->ibox->ic_drop_before = ic; 892 inst->ibox->ic_drop_before = ic;
888 if (ic) 893 if (ic)
889 { 894 {
@@ -915,6 +920,7 @@ _ibox_inst_cb_move(void *data, const char *type, void *event_info)
915 ); 920 );
916 _ibox_resize_handle(inst->ibox); 921 _ibox_resize_handle(inst->ibox);
917 _gc_orient(inst->gcc); 922 _gc_orient(inst->gcc);
923 e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
918} 924}
919 925
920static void 926static void