aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--NEWS1
-rw-r--r--src/bin/e_comp.c17
-rw-r--r--src/bin/e_comp_cfdata.c6
-rw-r--r--src/bin/e_dnd.c483
-rw-r--r--src/bin/e_dnd.h30
-rw-r--r--src/bin/e_fm.c1
-rw-r--r--src/bin/e_gadcon.c21
-rw-r--r--src/bin/e_main.c1
-rw-r--r--src/modules/gadman/e_mod_gadman.c2
10 files changed, 248 insertions, 315 deletions
diff --git a/ChangeLog b/ChangeLog
index 66814c0c9..814468455 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@
* E_FN_DEL macro renamed to E_FREE_FUNC with param order swapped for consistency
* added e_gadcon_repopulate
* EFM toolbar now has its own gadcon location
+ * DND canvas merged to compositor
2013-02-20 Mike Blumenkrantz
diff --git a/NEWS b/NEWS
index 10ebf881b..64673a9ec 100644
--- a/NEWS
+++ b/NEWS
@@ -118,6 +118,7 @@ Improvements:
* e_util_size_debug_set now displays delete events
* compositor now allows user changing/remembering of object opacity
* EFM toolbar now has its own gadcon location
+ * DND canvas merged to compositor
Fixes:
* IBar menu didn't allow to configure different icon sources, show contents menu even on empty IBar.
diff --git a/src/bin/e_comp.c b/src/bin/e_comp.c
index 895f577c8..7cd2046c5 100644
--- a/src/bin/e_comp.c
+++ b/src/bin/e_comp.c
@@ -4843,6 +4843,9 @@ e_comp_get(void *o)
E_Container *con = NULL;
E_Manager *man = NULL;
E_Gadcon_Popup *gp;
+ E_Gadcon *gc;
+ E_Gadcon_Client *gcc;
+ E_Drag *drag;
if (!o) obj = (E_Object*)e_manager_current_get();
/* try to get to zone type first */
@@ -4868,6 +4871,20 @@ e_comp_get(void *o)
obj = (void*)gp->win->zone;
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
break;
+ case E_DRAG_TYPE:
+ drag = (E_Drag*)obj;
+ obj = (void*)drag->container;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+ break;
+ case E_GADCON_CLIENT_TYPE:
+ gcc = (E_Gadcon_Client*)obj;
+ obj = (void*)gcc->gadcon;
+ EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+ case E_GADCON_TYPE:
+ gc = (E_Gadcon*)obj;
+ obj = (void*)e_gadcon_zone_get(gc);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+ break;
default:
break;
}
diff --git a/src/bin/e_comp_cfdata.c b/src/bin/e_comp_cfdata.c
index a0b85e9f7..635bc0c04 100644
--- a/src/bin/e_comp_cfdata.c
+++ b/src/bin/e_comp_cfdata.c
@@ -126,6 +126,12 @@ e_comp_cfdata_config_new(void)
mat = E_NEW(E_Comp_Match, 1);
cfg->match.popups = eina_list_append(cfg->match.popups, mat);
+ mat->name = eina_stringshare_add("E Drag");
+ mat->shadow_style = eina_stringshare_add("still");
+ mat->no_shadow = 1;
+
+ mat = E_NEW(E_Comp_Match, 1);
+ cfg->match.popups = eina_list_append(cfg->match.popups, mat);
mat->shadow_style = eina_stringshare_add("popup");
cfg->match.borders = NULL;
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index 91844051c..3b37f0a0b 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -12,8 +12,6 @@
/* local subsystem functions */
-static void _e_drag_show(E_Drag *drag);
-static void _e_drag_hide(E_Drag *drag);
static void _e_drag_move(E_Drag *drag, int x, int y);
static void _e_drag_coords_update(const E_Drop_Handler *h, int *dx, int *dy);
static Ecore_X_Window _e_drag_win_get(const E_Drop_Handler *h, int xdnd);
@@ -21,12 +19,10 @@ static int _e_drag_win_matches(E_Drop_Handler *h, Ecore_X_Window win,
static void _e_drag_win_show(E_Drop_Handler *h);
static void _e_drag_win_hide(E_Drop_Handler *h);
static int _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action);
-static void _e_drag_end(Ecore_X_Window root, int x, int y);
+static void _e_drag_end(int x, int y);
static void _e_drag_xdnd_end(Ecore_X_Window root, int x, int y);
static void _e_drag_free(E_Drag *drag);
-static Eina_Bool _e_dnd_cb_window_shape(void *data, int type, void *event);
-
static Eina_Bool _e_dnd_cb_key_down(void *data, int type, void *event);
static Eina_Bool _e_dnd_cb_key_up(void *data, int type, void *event);
static Eina_Bool _e_dnd_cb_mouse_up(void *data, int type, void *event);
@@ -89,7 +85,6 @@ e_dnd_init(void)
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_BUTTON_UP, _e_dnd_cb_mouse_up, NULL);
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_EVENT_MOUSE_MOVE, _e_dnd_cb_mouse_move, NULL);
- E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_WINDOW_SHAPE, _e_dnd_cb_window_shape, NULL);
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_XDND_ENTER, _e_dnd_cb_event_dnd_enter, NULL);
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_XDND_LEAVE, _e_dnd_cb_event_dnd_leave, NULL);
E_LIST_HANDLER_APPEND(_event_handlers, ECORE_X_EVENT_XDND_POSITION, _e_dnd_cb_event_dnd_position, NULL);
@@ -153,38 +148,16 @@ e_drag_new(E_Container *container, int x, int y,
drag->layer = E_LAYER_DRAG;
drag->container = container;
e_object_ref(E_OBJECT(drag->container));
- drag->ecore_evas = e_canvas_new(drag->container->win,
- drag->x, drag->y, drag->w, drag->h, 1, 1,
- &(drag->evas_win));
- if (!e_config->use_shaped_win)
- ecore_evas_alpha_set(drag->ecore_evas, 1);
- else
- {
- /* avoid excess exposes when shaped - set damage avoid to 1 */
- ecore_evas_avoid_damage_set(drag->ecore_evas, 1);
- ecore_evas_shaped_set(drag->ecore_evas, 1);
- ecore_x_window_shape_events_select(drag->evas_win, 1);
- }
-
- e_canvas_add(drag->ecore_evas);
- drag->shape = e_container_shape_add(drag->container);
- e_container_shape_move(drag->shape, drag->x, drag->y);
- e_container_shape_resize(drag->shape, drag->w, drag->h);
- drag->evas = ecore_evas_get(drag->ecore_evas);
- e_container_window_raise(drag->container, drag->evas_win, drag->layer);
+ drag->evas = e_comp_get(drag)->evas;
+ drag->pop = e_popup_new(e_zone_current_get(container), x, y, drag->w, drag->h);
- ecore_evas_name_class_set(drag->ecore_evas, "E", "_e_drag_window");
- ecore_evas_title_set(drag->ecore_evas, "E Drag");
- ecore_evas_ignore_events_set(drag->ecore_evas, 1);
+ e_popup_name_set(drag->pop, "E Drag");
+ e_popup_layer_set(drag->pop, E_COMP_CANVAS_LAYER_POPUP, 0);
+ e_popup_ignore_events_set(drag->pop, 1);
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);
- evas_object_resize(drag->object, drag->w, drag->h);
- ecore_evas_resize(drag->ecore_evas, drag->w, drag->h);
drag->type = E_DRAG_NONE;
@@ -219,7 +192,9 @@ e_drag_object_set(E_Drag *drag, Evas_Object *object)
{
if (drag->object) evas_object_del(drag->object);
drag->object = object;
- evas_object_resize(drag->object, drag->w, drag->h);
+ drag->pop->content = NULL;
+ if (_drag_current == drag)
+ e_popup_content_set(drag->pop, object);
}
EAPI void
@@ -228,7 +203,8 @@ e_drag_move(E_Drag *drag, int x, int y)
if ((drag->x == x) && (drag->y == y)) return;
drag->x = x;
drag->y = y;
- drag->xy_update = 1;
+ if (_drag_current == drag)
+ e_popup_move(drag->pop, x, y);
}
EAPI void
@@ -237,9 +213,8 @@ e_drag_resize(E_Drag *drag, int w, int h)
if ((drag->w == w) && (drag->h == h)) return;
drag->h = h;
drag->w = w;
- evas_object_resize(drag->object, drag->w, drag->h);
- ecore_evas_resize(drag->ecore_evas, drag->w, drag->h);
- e_container_shape_resize(drag->shape, drag->w, drag->h);
+ if (_drag_current == drag)
+ e_popup_resize(drag->pop, w, h);
}
EAPI int
@@ -265,7 +240,9 @@ e_drag_start(E_Drag *drag, int x, int y)
ecore_x_window_free(_drag_win);
return 0;
}
-
+ e_popup_move_resize(drag->pop, drag->x, drag->y, drag->w, drag->h);
+ e_popup_content_set(drag->pop, drag->object);
+ drag->visible = 1;
drag->type = E_DRAG_INTERNAL;
drag->dx = x - drag->x;
@@ -320,7 +297,9 @@ e_drag_xdnd_start(E_Drag *drag, int x, int y)
ecore_x_window_free(_drag_win);
return 0;
}
-
+ e_popup_move_resize(drag->pop, drag->x, drag->y, drag->w, drag->h);
+ e_popup_content_set(drag->pop, drag->object);
+ drag->visible = 1;
drag->type = E_DRAG_XDND;
drag->dx = x - drag->x;
@@ -490,74 +469,6 @@ e_drop_xdnd_register_set(Ecore_X_Window win, int reg)
}
EAPI void
-e_drag_idler_before(void)
-{
- const Eina_List *l;
- E_Drag *drag;
-
- EINA_LIST_FOREACH(_drag_list, l, drag)
- {
- if (drag->need_shape_export)
- {
- Ecore_X_Rectangle *rects, *orects;
- int num;
-
- rects = ecore_x_window_shape_rectangles_get(drag->evas_win, &num);
- if (rects)
- {
- int changed;
-
- changed = 1;
- if ((num == drag->shape_rects_num) && (drag->shape_rects))
- {
- int i;
-
- orects = drag->shape_rects;
- for (i = 0; i < num; i++)
- {
- if ((orects[i].x != rects[i].x) ||
- (orects[i].y != rects[i].y) ||
- (orects[i].width != rects[i].width) ||
- (orects[i].height != rects[i].height))
- {
- changed = 1;
- break;
- }
- }
- // TODO: This is meaningless
- changed = 0;
- }
- if (changed)
- {
- E_FREE(drag->shape_rects);
- drag->shape_rects = rects;
- drag->shape_rects_num = num;
- e_container_shape_rects_set(drag->shape, rects, num);
- }
- else
- free(rects);
- }
- else
- {
- E_FREE(drag->shape_rects);
- drag->shape_rects = NULL;
- drag->shape_rects_num = 0;
- e_container_shape_rects_set(drag->shape, NULL, 0);
- }
- drag->need_shape_export = 0;
- if (drag->visible)
- e_container_shape_show(drag->shape);
- }
- if (drag->xy_update)
- {
- ecore_evas_move(drag->ecore_evas, drag->x, drag->y);
- e_container_shape_move(drag->shape, drag->x, drag->y);
- drag->xy_update = 0;
- }
- }
-}
-
-EAPI void
e_drop_handler_responsive_set(E_Drop_Handler *handler)
{
Ecore_X_Window hwin = _e_drag_win_get(handler, 1);
@@ -651,26 +562,6 @@ e_dnd_util_text_uri_list_convert(char *data, int size)
/* local subsystem functions */
static void
-_e_drag_show(E_Drag *drag)
-{
- if (drag->visible) return;
- drag->visible = 1;
- evas_object_show(drag->object);
- ecore_evas_show(drag->ecore_evas);
- e_container_shape_show(drag->shape);
-}
-
-static void
-_e_drag_hide(E_Drag *drag)
-{
- if (!drag->visible) return;
- drag->visible = 0;
- evas_object_hide(drag->object);
- ecore_evas_hide(drag->ecore_evas);
- e_container_shape_hide(drag->shape);
-}
-
-static void
_e_drag_move(E_Drag *drag, int x, int y)
{
E_Zone *zone;
@@ -682,7 +573,7 @@ _e_drag_move(E_Drag *drag, int x, int y)
drag->x = x - drag->dx;
drag->y = y - drag->dy;
- drag->xy_update = 1;
+ e_popup_move(drag->pop, drag->x, drag->y);
}
static void
@@ -700,10 +591,9 @@ _e_drag_coords_update(const E_Drop_Handler *h, int *dx, int *dy)
case E_GADCON_TYPE:
gc = (E_Gadcon *)h->obj;
- e_gadcon_canvas_zone_geometry_get(gc, &px, &py, NULL, NULL);
- if (!gc->toolbar) break;
- px += gc->toolbar->fwin->x;
- py += gc->toolbar->fwin->y;
+ if (!gc->toolbar) return;
+ px = gc->toolbar->fwin->x;
+ py = gc->toolbar->fwin->y;
break;
case E_GADCON_CLIENT_TYPE:
@@ -754,14 +644,28 @@ _e_drag_win_get(const E_Drop_Handler *h, int xdnd)
{
switch (h->obj->type)
{
+ E_Gadcon *gc;
+
case E_GADCON_TYPE:
- if (xdnd) hwin = e_gadcon_xdnd_window_get((E_Gadcon *)(h->obj));
- else hwin = e_gadcon_dnd_window_get((E_Gadcon *)(h->obj));
+ gc = (E_Gadcon *)h->obj;
+
+ if (gc->toolbar) hwin = gc->toolbar->fwin->border->win; //double check for xdnd...
+ else
+ {
+ if (xdnd) hwin = e_gadcon_xdnd_window_get(gc);
+ else hwin = e_gadcon_dnd_window_get(gc);
+ }
break;
case E_GADCON_CLIENT_TYPE:
- if (xdnd) hwin = e_gadcon_xdnd_window_get(((E_Gadcon_Client *)(h->obj))->gadcon);
- else hwin = e_gadcon_dnd_window_get(((E_Gadcon_Client *)(h->obj))->gadcon);
+ gc = ((E_Gadcon_Client *)(h->obj))->gadcon;
+
+ if (gc->toolbar) hwin = gc->toolbar->fwin->border->win; //double check for xdnd...
+ else
+ {
+ if (xdnd) hwin = e_gadcon_xdnd_window_get(gc);
+ else hwin = e_gadcon_dnd_window_get(gc);
+ }
break;
case E_WIN_TYPE:
@@ -847,13 +751,32 @@ _e_drag_win_hide(E_Drop_Handler *h)
}
}
+static unsigned int
+_e_dnd_object_layer_get(E_Object *obj)
+{
+ unsigned int adjust = 0;
+ if (!obj) return 0;
+ switch (obj->type)
+ {
+ case E_GADCON_CLIENT_TYPE:
+ /* add 1 to ensure we're above a potential receiving gadcon */
+ adjust = 1;
+ default:
+ adjust += e_comp_e_object_layer_get(obj);
+ }
+ return adjust;
+}
+
static int
_e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
{
const Eina_List *l;
+ Eina_List *entered = NULL;
E_Event_Dnd_Enter enter_ev;
E_Event_Dnd_Move move_ev;
E_Event_Dnd_Leave leave_ev;
+ E_Drop_Handler *h, *top = NULL;
+ unsigned int top_layer = 0;
int dx, dy;
Ecore_X_Window win;
int responsive = 0;
@@ -861,26 +784,64 @@ _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
// double t1 = ecore_time_get(); ////
if (_drag_current && !_xdnd)
{
- win = ecore_evas_window_get(_drag_current->ecore_evas);
- win = e_comp_top_window_at_xy_get(e_comp_get(e_manager_find_by_root(root)), x, y, &win, 1);
+ Ecore_X_Window ignore[1];
+ ignore[0] = _drag_win;
+ win = e_comp_top_window_at_xy_get(e_comp_get(_drag_current), x, y, ignore, 1);
}
else
win = root;
if (_drag_current)
{
- _e_drag_show(_drag_current);
+ if (_drag_current->visible) e_popup_show(_drag_current->pop);
+ else e_popup_hide(_drag_current->pop);
_e_drag_move(_drag_current, x, y);
}
+ EINA_LIST_FOREACH(_drop_handlers, l, h)
+ {
+ if (!h->active) continue;
+ _e_drag_coords_update(h, &dx, &dy);
+ enter_ev.x = x - dx;
+ enter_ev.y = y - dy;
+ enter_ev.data = NULL;
+ enter_ev.action = action;
+ move_ev.x = x - dx;
+ move_ev.y = y - dy;
+ move_ev.action = action;
+ leave_ev.x = x - dx;
+ leave_ev.y = y - dy;
+
+ if (E_INSIDE(enter_ev.x, enter_ev.y, h->x, h->y, h->w, h->h) &&
+ ((!_drag_current) || _e_drag_win_matches(h, win, 0)))
+ entered = eina_list_append(entered, h);
+ else
+ {
+ if (h->entered)
+ {
+ if (h->cb.leave)
+ h->cb.leave(h->cb.data, h->active_type, &leave_ev);
+ if (_drag_current)
+ _e_drag_win_hide(h);
+ h->entered = 0;
+ }
+ }
+ }
+ if (!entered) return 0;
- if (_drag_current)
+ EINA_LIST_FREE(entered, h)
{
- E_Drop_Handler *h;
+ unsigned int layer;
+ E_Drop_Handler *h2;
- EINA_LIST_FOREACH(_drop_handlers, l, h)
+ _e_drag_coords_update(h, &dx, &dy);
+ leave_ev.x = x - dx;
+ leave_ev.y = y - dy;
+
+ layer = _e_dnd_object_layer_get(h->obj);
+ if (!top)
{
- if (!h->active) continue;
- _e_drag_coords_update(h, &dx, &dy);
+ top = h;
+ top_layer = layer;
enter_ev.x = x - dx;
enter_ev.y = y - dy;
enter_ev.data = NULL;
@@ -888,93 +849,58 @@ _e_drag_update(Ecore_X_Window root, int x, int y, Ecore_X_Atom action)
move_ev.x = x - dx;
move_ev.y = y - dy;
move_ev.action = action;
- leave_ev.x = x - dx;
- leave_ev.y = y - dy;
-
- if (E_INSIDE(enter_ev.x, enter_ev.y, h->x, h->y, h->w, h->h) &&
- _e_drag_win_matches(h, win, 0))
- {
- if (e_drop_handler_responsive_get(h)) responsive = 1;
-
- if (!h->entered)
- {
- _e_drag_win_show(h);
- if (h->cb.enter)
- {
- if (_drag_current->cb.convert)
- {
- enter_ev.data = _drag_current->cb.convert(_drag_current,
- h->active_type);
- }
- else
- enter_ev.data = _drag_current->data;
- h->cb.enter(h->cb.data, h->active_type, &enter_ev);
- }
- h->entered = 1;
- }
- if (h->cb.move)
- h->cb.move(h->cb.data, h->active_type, &move_ev);
- }
- else
- {
- if (h->entered)
- {
- if (h->cb.leave)
- h->cb.leave(h->cb.data, h->active_type, &leave_ev);
- _e_drag_win_hide(h);
- h->entered = 0;
- }
- }
+ continue;
}
- }
- else if (_xdnd)
- {
- E_Drop_Handler *h;
-
- EINA_LIST_FOREACH(_drop_handlers, l, h)
+ if (layer > top_layer)
{
- if (!h->active) continue;
- _e_drag_coords_update(h, &dx, &dy);
+ h2 = top, top = h, h = h2;
enter_ev.x = x - dx;
enter_ev.y = y - dy;
+ enter_ev.data = NULL;
enter_ev.action = action;
move_ev.x = x - dx;
move_ev.y = y - dy;
move_ev.action = action;
- leave_ev.x = x - dx;
- leave_ev.y = y - dy;
- if (E_INSIDE(enter_ev.x, enter_ev.y, h->x, h->y, h->w, h->h) && _e_drag_win_matches(h, win, 1))
- {
- if (e_drop_handler_responsive_get(h)) responsive = 1;
-
- if (!h->entered)
- {
- if (h->cb.enter)
- h->cb.enter(h->cb.data, h->active_type, &enter_ev);
- h->entered = 1;
- }
- if (h->cb.move)
- h->cb.move(h->cb.data, h->active_type, &move_ev);
- }
- else
+ }
+ if (h == top) continue;
+ if (h->entered)
+ {
+ if (h->cb.leave)
+ h->cb.leave(h->cb.data, h->active_type, &leave_ev);
+ if (_drag_current)
+ _e_drag_win_hide(h);
+ h->entered = 0;
+ }
+ }
+ responsive = !!e_drop_handler_responsive_get(top);
+ if (!top->entered)
+ {
+ _e_drag_win_show(top);
+ if (top->cb.enter)
+ {
+ if (_drag_current)
{
- if (h->entered)
+ if (_drag_current->cb.convert)
{
- if (h->cb.leave)
- h->cb.leave(h->cb.data, h->active_type, &leave_ev);
- h->entered = 0;
+ enter_ev.data = _drag_current->cb.convert(_drag_current,
+ top->active_type);
}
+ else
+ enter_ev.data = _drag_current->data;
}
+ top->cb.enter(top->cb.data, top->active_type, &enter_ev);
}
+ top->entered = 1;
}
-
+ if (top->cb.move)
+ top->cb.move(top->cb.data, top->active_type, &move_ev);
return responsive;
// double t2 = ecore_time_get() - t1; ////
// printf("DND UPDATE %3.7f\n", t2); ////
}
static void
-_e_drag_end(Ecore_X_Window root, int x, int y)
+_e_drag_end(int x, int y)
{
E_Zone *zone;
const Eina_List *l;
@@ -982,21 +908,22 @@ _e_drag_end(Ecore_X_Window root, int x, int y)
int dx, dy;
Ecore_X_Window win;
E_Drag *tmp;
+ E_Drop_Handler *h;
+ int dropped;
+ Ecore_X_Window ignore[1];
if (!_drag_current) return;
- win = ecore_evas_window_get(_drag_current->ecore_evas);
- win = e_comp_top_window_at_xy_get(e_comp_get(e_manager_find_by_root(root)), x, y, &win, 1);
+ ignore[0] = _drag_win;
+ win = e_comp_top_window_at_xy_get(e_comp_get(_drag_current), x, y, ignore, 1);
zone = e_container_zone_at_point_get(_drag_current->container, x, y);
/* Pass -1, -1, so that it is possible to drop at the edge. */
if (zone) e_zone_flip_coords_handle(zone, -1, -1);
- _e_drag_hide(_drag_current);
+ e_popup_hide(_drag_current->pop);
e_grabinput_release(_drag_win, _drag_win);
while (_drag_current->type == E_DRAG_XDND)
{
- int dropped;
-
if (!(dropped = ecore_x_dnd_drop()))
{
if (win == e_comp_get(NULL)->ee_win) break;
@@ -1019,61 +946,12 @@ _e_drag_end(Ecore_X_Window root, int x, int y)
ecore_x_window_free(_drag_win);
_drag_win = 0;
+ dropped = 0;
- if (_drag_current->data)
- {
- E_Drop_Handler *h;
- int dropped = 0;
-
- EINA_LIST_FOREACH(_drop_handlers, l, h)
- {
- if (!h->active) continue;
- _e_drag_coords_update(h, &dx, &dy);
- ev.x = x - dx;
- ev.y = y - dy;
- if ((_e_drag_win_matches(h, win, 0)) &&
- ((h->cb.drop) && (E_INSIDE(ev.x, ev.y, h->x, h->y, h->w, h->h))))
- {
- Eina_Bool need_free = EINA_FALSE;
-
- if (_drag_current->cb.convert)
- {
- ev.data = _drag_current->cb.convert(_drag_current,
- h->active_type);
- }
- else
- {
- unsigned int i;
-
- for (i = 0; i < _drag_current->num_types; i++)
- if (_drag_current->types[i] == _type_text_uri_list)
- {
- ev.data = e_dnd_util_text_uri_list_convert(_drag_current->data, _drag_current->data_size);
- need_free = EINA_TRUE;
- break;
- }
- if (!need_free)
- ev.data = _drag_current->data;
- }
- h->cb.drop(h->cb.data, h->active_type, &ev);
- if (need_free) E_FREE_LIST(ev.data, free);
- dropped = 1;
- }
- h->entered = 0;
- if (dropped) break;
- }
- if (_drag_current->cb.finished)
- _drag_current->cb.finished(_drag_current, dropped);
-
- tmp = _drag_current;
- _drag_current = NULL;
- e_object_del(E_OBJECT(tmp));
- }
- else
+ if (!_drag_current->data)
{
/* Just leave */
E_Event_Dnd_Leave leave_ev;
- E_Drop_Handler *h;
/* FIXME: We don't need x and y in leave */
leave_ev.x = 0;
@@ -1091,6 +969,50 @@ _e_drag_end(Ecore_X_Window root, int x, int y)
}
}
}
+
+ EINA_LIST_FOREACH(_drop_handlers, l, h)
+ {
+ if (!h->active) continue;
+ _e_drag_coords_update(h, &dx, &dy);
+ ev.x = x - dx;
+ ev.y = y - dy;
+ if ((_e_drag_win_matches(h, win, 0)) &&
+ ((h->cb.drop) && (E_INSIDE(ev.x, ev.y, h->x, h->y, h->w, h->h))))
+ {
+ Eina_Bool need_free = EINA_FALSE;
+
+ if (_drag_current->cb.convert)
+ {
+ ev.data = _drag_current->cb.convert(_drag_current,
+ h->active_type);
+ }
+ else
+ {
+ unsigned int i;
+
+ for (i = 0; i < _drag_current->num_types; i++)
+ if (_drag_current->types[i] == _type_text_uri_list)
+ {
+ ev.data = e_dnd_util_text_uri_list_convert(_drag_current->data, _drag_current->data_size);
+ need_free = EINA_TRUE;
+ break;
+ }
+ if (!need_free)
+ ev.data = _drag_current->data;
+ }
+ h->cb.drop(h->cb.data, h->active_type, &ev);
+ if (need_free) E_FREE_LIST(ev.data, free);
+ dropped = 1;
+ }
+ h->entered = 0;
+ if (dropped) break;
+ }
+ if (_drag_current->cb.finished)
+ _drag_current->cb.finished(_drag_current, dropped);
+
+ tmp = _drag_current;
+ _drag_current = NULL;
+ e_object_del(E_OBJECT(tmp));
}
static void
@@ -1180,14 +1102,8 @@ _e_drag_free(E_Drag *drag)
_drag_list = eina_list_remove(_drag_list, drag);
- E_FREE(drag->shape_rects);
- drag->shape_rects_num = 0;
e_object_unref(E_OBJECT(drag->container));
- e_container_shape_hide(drag->shape);
- e_object_del(E_OBJECT(drag->shape));
- evas_object_del(drag->object);
- e_canvas_del(drag->ecore_evas);
- ecore_evas_free(drag->ecore_evas);
+ E_FREE_FUNC(drag->pop, e_object_del);
for (i = 0; i < drag->num_types; i++)
eina_stringshare_del(drag->types[i]);
free(drag);
@@ -1195,21 +1111,6 @@ _e_drag_free(E_Drag *drag)
}
static Eina_Bool
-_e_dnd_cb_window_shape(void *data __UNUSED__, int ev_type __UNUSED__, void *ev)
-{
- Ecore_X_Event_Window_Shape *e = ev;
- const Eina_List *l;
- E_Drag *drag;
-
- EINA_LIST_FOREACH(_drag_list, l, drag)
- {
- if (drag->evas_win == e->win)
- drag->need_shape_export = 1;
- }
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool
_e_dnd_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Event_Key *ev;
@@ -1249,7 +1150,7 @@ _e_dnd_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
ev = event;
if (ev->window != _drag_win) return ECORE_CALLBACK_PASS_ON;
- _e_drag_end(_drag_win_root, ev->x, ev->y);
+ _e_drag_end(ev->x, ev->y);
return ECORE_CALLBACK_PASS_ON;
}
diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h
index bebd2ce4a..57fd568c8 100644
--- a/src/bin/e_dnd.h
+++ b/src/bin/e_dnd.h
@@ -38,22 +38,15 @@ struct _E_Drag
} cb;
E_Container *container;
- Ecore_Evas *ecore_evas;
Evas *evas;
- Ecore_X_Window evas_win;
- E_Container_Shape *shape;
+ E_Popup *pop;
Evas_Object *object;
int x, y, w, h;
int dx, dy;
- int shape_rects_num;
- Ecore_X_Rectangle *shape_rects;
-
E_Layer layer;
unsigned char visible : 1;
- unsigned char need_shape_export : 1;
- unsigned char xy_update : 1;
unsigned int num_types;
const char *types[];
@@ -72,6 +65,7 @@ struct _E_Drop_Handler
} cb;
E_Object *obj;
+ Evas_Object *base;
int x, y, w, h;
unsigned char active : 1;
@@ -120,7 +114,6 @@ EAPI Evas *e_drag_evas_get(const E_Drag *drag);
EAPI void e_drag_object_set(E_Drag *drag, Evas_Object *object);
EAPI void e_drag_move(E_Drag *drag, int x, int y);
EAPI void e_drag_resize(E_Drag *drag, int w, int h);
-EAPI void e_drag_idler_before(void);
EAPI void e_drag_key_down_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_Event_Key *e));
EAPI void e_drag_key_up_cb_set(E_Drag *drag, void (*func)(E_Drag *drag, Ecore_Event_Key *e));
@@ -146,11 +139,20 @@ EAPI void e_drop_handler_responsive_set(E_Drop_Handler *handler);
EAPI int e_drop_handler_responsive_get(const E_Drop_Handler *handler);
EAPI void e_drop_handler_action_set(Ecore_X_Atom action);
EAPI Ecore_X_Atom e_drop_handler_action_get(void);
-
EAPI Eina_List *e_dnd_util_text_uri_list_convert(char *data, int size);
-#endif
-#endif
-#ifndef MIN
-# define MIN(x, y) (((x) > (y)) ? (y) : (x))
+
+static inline void
+e_drag_show(E_Drag *drag)
+{
+ drag->visible = 1;
+}
+
+static inline void
+e_drag_hide(E_Drag *drag)
+{
+ drag->visible = 0;
+}
+
+#endif
#endif
diff --git a/src/bin/e_fm.c b/src/bin/e_fm.c
index ae9bae4e0..06eb9545d 100644
--- a/src/bin/e_fm.c
+++ b/src/bin/e_fm.c
@@ -7583,6 +7583,7 @@ _e_fm2_cb_icon_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNU
edje_object_signal_emit(o, "e,state,selected", "e");
edje_object_signal_emit(o2, "e,state,selected", "e");
e_drag_object_set(d, o);
+ e_popup_object_add(d->pop, o2);
edje_object_signal_emit(o, "e,state,move", "e");
e_drag_resize(d, w, h);
evas_object_smart_callback_call(ic->sd->obj, "dnd_begin", &ic->info);
diff --git a/src/bin/e_gadcon.c b/src/bin/e_gadcon.c
index abb80496b..b751b3dbe 100644
--- a/src/bin/e_gadcon.c
+++ b/src/bin/e_gadcon.c
@@ -2309,6 +2309,7 @@ _e_gadcon_client_drag_begin(E_Gadcon_Client *gcc, int x, int y)
e_drag_object_set(drag, o);
e_drag_resize(drag, w, h);
e_drag_start(drag, x + w / 2, y + h / 2);
+ e_drag_hide(drag);
}
static void
@@ -2523,7 +2524,7 @@ _e_gadcon_client_move_start(E_Gadcon_Client *gcc)
evas_pointer_canvas_xy_get(gcc->gadcon->evas, &gcc->dx, &gcc->dy);
else
{
- ecore_x_pointer_xy_get(gcc->gadcon->zone->container->win, &gcc->dx, &gcc->dy);
+ ecore_x_pointer_xy_get(e_comp_get(gcc)->ee_win, &gcc->dx, &gcc->dy);
e_gadcon_canvas_zone_geometry_get(gcc->gadcon, &gcx, &gcy, NULL, NULL);
evas_object_geometry_get(gcc->gadcon->o_container, &gx, &gy, NULL, NULL);
gcc->dx -= (gcx + gx);
@@ -2595,7 +2596,8 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc)
if (e_gadcon_layout_orientation_get(gcc->gadcon->o_container))
{
- if (cy + e_config->drag_resist < 0 || cy - e_config->drag_resist >= gh)
+ if ((cy + e_config->drag_resist < 0 || cy - e_config->drag_resist >= gh) ||
+ (cx + e_config->drag_resist < 0 || cx - e_config->drag_resist > gw))
{
_e_gadcon_client_drag_begin(gcc, cx, cy);
return;
@@ -2610,7 +2612,7 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc)
changes = 1;
}
/* DRAG LEFT */
- else if (x < 0 && (gcc->drag.x - cx < gcc->config.pos))
+ else if (x < 0 && (cx + gcc->drag.x < gcc->config.pos))
{
if (gcc->state_info.state != E_LAYOUT_ITEM_STATE_POS_DEC)
gcc->state_info.resist = 0;
@@ -2632,12 +2634,14 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc)
}
else
{
- if (cx + e_config->drag_resist < 0 || cx - e_config->drag_resist > gw)
+ if ((cy + e_config->drag_resist < 0 || cy - e_config->drag_resist >= gh) ||
+ (cx + e_config->drag_resist < 0 || cx - e_config->drag_resist > gw))
{
_e_gadcon_client_drag_begin(gcc, cx, cy);
return;
}
+ /* DRAG DOWN */
if (y > 0 && (cy + gcc->drag.y > gcc->config.pos))
{
if (gcc->state_info.state != E_LAYOUT_ITEM_STATE_POS_INC)
@@ -2645,6 +2649,7 @@ _e_gadcon_client_move_go(E_Gadcon_Client *gcc)
gcc->state_info.state = E_LAYOUT_ITEM_STATE_POS_INC;
changes = 1;
}
+ /* DRAG UP */
else if (y < 0 && (cy + gcc->drag.y < gcc->config.pos))
{
if (gcc->state_info.state != E_LAYOUT_ITEM_STATE_POS_DEC)
@@ -2865,7 +2870,7 @@ _e_gadcon_cb_dnd_enter(void *data, const char *type __UNUSED__, void *event)
if ((!gcc->hidden) && (gcc->gadcon == gc))
{
if (gc->dnd_enter_cb) gc->dnd_enter_cb(gc, gc->drag_gcc);
- evas_object_hide(gc->drag_gcc->drag.drag->object);
+ e_drag_hide(gc->drag_gcc->drag.drag);
return;
}
if (gcc->gadcon != gc)
@@ -2873,7 +2878,7 @@ _e_gadcon_cb_dnd_enter(void *data, const char *type __UNUSED__, void *event)
else if (e_gadcon_site_is_desktop(gcc->gadcon->location->site))
{
e_gadcon_client_show(gc->drag_gcc);
- evas_object_hide(gc->drag_gcc->drag.drag->object);
+ e_drag_hide(gc->drag_gcc->drag.drag);
if (gc->dnd_enter_cb) gc->dnd_enter_cb(gc, gc->drag_gcc);
return;
}
@@ -2957,7 +2962,7 @@ _e_gadcon_cb_dnd_enter(void *data, const char *type __UNUSED__, void *event)
}
}
- evas_object_hide(gc->drag_gcc->drag.drag->object);
+ e_drag_hide(gc->drag_gcc->drag.drag);
e_gadcon_client_edit_begin(gc->new_gcc);
e_gadcon_client_autoscroll_set(gc->new_gcc, gcc->autoscroll);
/* e_gadcon_client_resizable_set(gc->new_gcc, gcc->resizable);*/
@@ -3040,7 +3045,7 @@ _e_gadcon_cb_dnd_leave(void *data, const char *type __UNUSED__, void *event __UN
//INF("DELETING new_gcc");
e_object_del(E_OBJECT(gc->new_gcc));
gc->new_gcc = NULL;
- evas_object_show(gc->drag_gcc->drag.drag->object);
+ e_drag_show(gc->drag_gcc->drag.drag);
if (gc->dnd_leave_cb) gc->dnd_leave_cb(gc, gc->drag_gcc);
}
diff --git a/src/bin/e_main.c b/src/bin/e_main.c
index 1adc61e6d..4cc6a510a 100644
--- a/src/bin/e_main.c
+++ b/src/bin/e_main.c
@@ -1900,7 +1900,6 @@ _e_main_cb_idle_before(void *data __UNUSED__)
e_menu_idler_before();
e_focus_idler_before();
e_border_idler_before();
- e_drag_idler_before();
e_pointer_idler_before();
EINA_LIST_FOREACH(_idle_before_list, l, eb)
{
diff --git a/src/modules/gadman/e_mod_gadman.c b/src/modules/gadman/e_mod_gadman.c
index 806165b67..acfb31366 100644
--- a/src/modules/gadman/e_mod_gadman.c
+++ b/src/modules/gadman/e_mod_gadman.c
@@ -1473,8 +1473,8 @@ on_move(void *data, Evas_Object *o __UNUSED__, const char *em __UNUSED__, const
e_drag_object_set(drag, o);
e_drag_resize(drag, ow, oh);
- evas_object_hide(o);
e_drag_start(drag, mx, my);
+ e_drag_hide(drag);
}
static void