summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlastair Poole <netstar@gmail.com>2020-07-12 09:55:37 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-07-12 09:58:06 +0100
commite278fb3cdae268ca45c997539f15511038af4401 (patch)
treef43c5ac0fab85ad479ad368793fe9b1b82cf375b /src
parente0227cf536b2fe96a442588749b3a42d61645584 (diff)
ibox: dnd behaviour.
Summary: * No dragging icons within an ibox (it can be perceived as a broken move visually). * Show preview when dragging a preview. * When dragging an object into the ibox, the drop icon should be at the position of the dnd. Else mouse pointer and the indicator are out of sync and it looks like a bug. Reviewers: devilhorns Subscribers: raster, cedric, zmike Tags: #enlightenment-git Differential Revision: https://phab.enlightenment.org/D12050
Diffstat (limited to 'src')
-rw-r--r--src/modules/ibox/e_mod_main.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/modules/ibox/e_mod_main.c b/src/modules/ibox/e_mod_main.c
index 7cfe79cad..f0eb99590 100644
--- a/src/modules/ibox/e_mod_main.c
+++ b/src/modules/ibox/e_mod_main.c
@@ -811,17 +811,21 @@ _ibox_cb_icon_mouse_move(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_
811 d = e_drag_new(x, y, drag_types, 1, 811 d = e_drag_new(x, y, drag_types, 1,
812 ic->client, -1, NULL, _ibox_cb_drag_finished); 812 ic->client, -1, NULL, _ibox_cb_drag_finished);
813 d->button_mask = evas_pointer_button_down_mask_get(e_comp->evas); 813 d->button_mask = evas_pointer_button_down_mask_get(e_comp->evas);
814 o = e_client_icon_add(ic->client, e_drag_evas_get(d));
815 e_drag_object_set(d, o);
816 814
815 if (!ic->ibox->inst->ci->show_preview)
816 o = e_client_icon_add(ic->client, e_drag_evas_get(d));
817 else
818 {
819 o = e_comp_object_util_mirror_add(ic->client->frame);
820 evas_object_size_hint_aspect_set(o, EVAS_ASPECT_CONTROL_BOTH, ic->client->w, ic->client->h);
821 evas_object_size_hint_max_set(o, w, h);
822 }
823 e_drag_object_set(d, o);
817 e_drag_resize(d, w, h); 824 e_drag_resize(d, w, h);
818 e_drag_start(d, ic->drag.x, ic->drag.y); 825 e_drag_start(d, ic->drag.x, ic->drag.y);
819 e_object_ref(E_OBJECT(ic->client)); 826 e_object_ref(E_OBJECT(ic->client));
820 ic->ibox->icons = eina_list_remove(ic->ibox->icons, ic);
821 _ibox_resize_handle(ic->ibox);
822 gcc = ic->ibox->inst->gcc; 827 gcc = ic->ibox->inst->gcc;
823 _gc_orient(gcc, -1); 828 _gc_orient(gcc, -1);
824 _ibox_icon_free(ic);
825 } 829 }
826 } 830 }
827} 831}
@@ -913,11 +917,11 @@ _ibox_drop_position_update(Instance *inst, Evas_Coord x, Evas_Coord y)
913 evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih); 917 evas_object_geometry_get(ic->o_holder, &ix, &iy, &iw, &ih);
914 if (elm_box_horizontal_get(inst->ibox->o_box)) 918 if (elm_box_horizontal_get(inst->ibox->o_box))
915 { 919 {
916 if (x < (ix + (iw / 2))) before = 1; 920 if (x < (ix + iw)) before = 1;
917 } 921 }
918 else 922 else
919 { 923 {
920 if (y < (iy + (ih / 2))) before = 1; 924 if (y < (iy + ih)) before = 1;
921 } 925 }
922 if (before) 926 if (before)
923 elm_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder); 927 elm_box_pack_before(inst->ibox->o_box, inst->ibox->o_drop, ic->o_holder);
@@ -936,10 +940,16 @@ _ibox_inst_cb_enter(void *data, const char *type EINA_UNUSED, void *event_info)
936{ 940{
937 E_Event_Dnd_Enter *ev; 941 E_Event_Dnd_Enter *ev;
938 Instance *inst; 942 Instance *inst;
943 E_Client *ec;
939 Evas_Object *o, *o2; 944 Evas_Object *o, *o2;
940 945
941 ev = event_info; 946 ev = event_info;
942 inst = data; 947 inst = data;
948
949 ec = ev->data;
950
951 if (_ibox_icon_find(inst->ibox, ec)) return;
952
943 o = edje_object_add(evas_object_evas_get(inst->ibox->o_box)); 953 o = edje_object_add(evas_object_evas_get(inst->ibox->o_box));
944 inst->ibox->o_drop = o; 954 inst->ibox->o_drop = o;
945 E_EXPAND(inst->ibox->o_drop); 955 E_EXPAND(inst->ibox->o_drop);
@@ -968,6 +978,7 @@ _ibox_inst_cb_move(void *data, const char *type EINA_UNUSED, void *event_info)
968 978
969 ev = event_info; 979 ev = event_info;
970 inst = data; 980 inst = data;
981
971 _ibox_drop_position_update(inst, ev->x, ev->y); 982 _ibox_drop_position_update(inst, ev->x, ev->y);
972 e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y); 983 e_gadcon_client_autoscroll_update(inst->gcc, ev->x, ev->y);
973} 984}