Enlightenment CVS committal
Author : sebastid
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_border.c e_dnd.c e_dnd.h
Log Message:
Dragging icon from border to pager now works! But since the menu
doesn't work when dragging is enabled, dragging is disabled.
For those who want dragging just remove the #if
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.154
retrieving revision 1.155
diff -u -3 -r1.154 -r1.155
--- e_border.c 25 Apr 2005 19:38:15 -0000 1.154
+++ e_border.c 25 Apr 2005 20:56:52 -0000 1.155
@@ -3,14 +3,6 @@
*/
#include "e.h"
-typedef struct _E_Border_Fake_Mouse_Up_Info E_Border_Fake_Mouse_Up_Info;
-
-struct _E_Border_Fake_Mouse_Up_Info
-{
- E_Border *border;
- int button;
-};
-
//#define INOUTDEBUG 1
#define RESIZE_NONE 0
@@ -114,7 +106,7 @@
static void _e_border_reorder_after(E_Border *bd, E_Border *after);
static void _e_border_reorder_before(E_Border *bd, E_Border *before);
-static void _e_border_fake_mouse_up_cb(void *data);
+static void _e_border_drag_cb(void *data, void *event);
/* local subsystem globals */
static Evas_List *handlers = NULL;
@@ -1960,12 +1952,9 @@
_e_border_cb_signal_drag(void *data, Evas_Object *obj, const char *emission,
const char *source)
{
E_Border *bd;
- E_Border_Fake_Mouse_Up_Info *info;
bd = data;
-#if 0
- printf("drag_start %s %s\n", emission, source);
if ((bd->client.icccm.name) && (bd->client.icccm.class))
{
E_App *a;
@@ -1974,17 +1963,11 @@
bd->client.icccm.class);
if (a)
{
+ e_drag_callback_set(bd, _e_border_drag_cb);
e_drag_start(bd->zone, "enlightenment/border", bd,
a->path, "icon");
-
- info = E_NEW(E_Border_Fake_Mouse_Up_Info, 1);
- info->border = bd;
- info->button = 1;
- e_object_ref(E_OBJECT(info->border));
- ecore_job_add(_e_border_fake_mouse_up_cb, info);
}
}
-#endif
}
static int
@@ -2763,8 +2746,10 @@
_e_border_cb_signal_resize_stop, bd);
edje_object_signal_callback_add(o, "action", "*",
_e_border_cb_signal_action, bd);
+#if 0
edje_object_signal_callback_add(o, "drag", "*",
_e_border_cb_signal_drag, bd);
+#endif
if (bd->focused)
edje_object_signal_emit(bd->bg_object, "active", "");
evas_object_move(o, 0, 0);
@@ -3713,7 +3698,7 @@
desk = data;
bd = e_object_data_get(E_OBJECT(m));
- if ((bd) && (desk))
+ if ((bd) && (desk) && (bd->desk != desk))
{
e_border_desk_set(bd, desk);
e_border_hide(bd, 1);
@@ -4011,15 +3996,18 @@
}
static void
-_e_border_fake_mouse_up_cb(void *data)
+_e_border_drag_cb(void *data, void *event)
{
- E_Border_Fake_Mouse_Up_Info *info;
-
- info = data;
- if (info)
- {
- evas_event_feed_mouse_up(info->border->bg_evas, info->button,
EVAS_BUTTON_NONE, NULL);
- e_object_unref(E_OBJECT(info->border));
- free(info);
- }
+ E_Drag_Event *ev;
+ E_Border *bd;
+
+ ev = event;
+ bd = data;
+
+ printf("_e_border_drag_cb\n");
+
+ if (ev->drag)
+ evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL);
+ evas_event_feed_mouse_up(bd->bg_evas, 1, EVAS_BUTTON_NONE, NULL);
}
+
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_dnd.c 25 Apr 2005 18:02:25 -0000 1.4
+++ e_dnd.c 25 Apr 2005 20:56:52 -0000 1.5
@@ -13,6 +13,10 @@
static char *drag_type;
static void *drag_data;
+static int drag;
+static void (*drag_cb)(void *data, void *event);
+static void *drag_cb_data;
+
static int _e_dnd_cb_mouse_up(void *data, int type, void *event);
static int _e_dnd_cb_mouse_move(void *data, int type, void *event);
@@ -75,7 +79,8 @@
}
void
-e_drag_start(E_Zone *zone, const char *type, void *data, const char
*icon_path, const char *icon)
+e_drag_start(E_Zone *zone, const char *type, void *data,
+ const char *icon_path, const char *icon)
{
int w, h;
@@ -86,6 +91,8 @@
ecore_x_pointer_confine_grab(drag_win);
ecore_x_keyboard_grab(drag_win);
+ drag = 0;
+
if (drag_ee)
{
e_canvas_del(drag_ee);
@@ -120,6 +127,8 @@
int w, h;
if (!drag_ee) return;
+
+ drag = 1;
evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h);
evas_object_show(drag_obj);
@@ -132,9 +141,7 @@
e_drag_end(int x, int y)
{
Evas_List *l;
- E_Drop_Event *e;
-
- printf("drag_end\n");
+ E_Drop_Event *ev;
evas_object_del(drag_obj);
if (drag_ee)
@@ -147,10 +154,11 @@
ecore_x_keyboard_ungrab();
ecore_x_window_del(drag_win);
- e = E_NEW(E_Drop_Event, 1);
- e->data = drag_data;
- e->x = x;
- e->y = y;
+ ev = E_NEW(E_Drop_Event, 1);
+ if (!ev) goto end;
+ ev->data = drag_data;
+ ev->x = x;
+ ev->y = y;
for (l = drop_handlers; l; l = l->next)
{
@@ -161,16 +169,24 @@
if ((x >= h->x) && (x < h->x + h->w) && (y >= h->y) && (y < h->y + h->h)
&& (!strcmp(h->type, drag_type)))
{
- h->func(h->data, drag_type, e);
+ h->func(h->data, drag_type, ev);
}
}
- free(e);
+ free(ev);
+end:
free(drag_type);
drag_type = NULL;
drag_data = NULL;
}
+void
+e_drag_callback_set(void *data, void (*func)(void *data, void *event))
+{
+ drag_cb = func;
+ drag_cb_data = data;
+}
+
E_Drop_Handler *
e_drop_handler_add(void *data, void (*func)(void *data, const char *type, void
*drop), const char *type, int x, int y, int w, int h)
{
@@ -209,6 +225,22 @@
e_drag_end(ev->x, ev->y);
+ if (drag_cb)
+ {
+ E_Drag_Event *e;
+
+ e = E_NEW(E_Drag_Event, 1);
+ if (e)
+ {
+ e->drag = drag;
+ e->x = ev->x;
+ e->y = ev->y;
+ (*drag_cb)(drag_cb_data, e);
+ drag_cb = NULL;
+ free(e);
+ }
+ }
+
return 1;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_dnd.h 25 Apr 2005 18:02:25 -0000 1.3
+++ e_dnd.h 25 Apr 2005 20:56:52 -0000 1.4
@@ -6,6 +6,7 @@
typedef struct _E_Drop_Handler E_Drop_Handler;
typedef struct _E_Drop_Event E_Drop_Event;
+typedef struct _E_Drag_Event E_Drag_Event;
#else
#ifndef E_DND_H
@@ -25,14 +26,24 @@
int x, y;
};
+struct _E_Drag_Event
+{
+ int drag;
+ int x, y;
+};
+
EAPI int e_dnd_init(void);
EAPI int e_dnd_shutdown(void);
-EAPI void e_drag_start(E_Zone *zone, const char *type, void *data, const char
*icon_path, const char *icon);
+EAPI void e_drag_start(E_Zone *zone, const char *type, void *data,
+ const char *icon_path, const char *icon);
EAPI void e_drag_update(int x, int y);
EAPI void e_drag_end(int x, int y);
+EAPI void e_drag_callback_set(void *data, void (*func)(void *data, void
*event));
-EAPI E_Drop_Handler *e_drop_handler_add(void *data, void (*func)(void *data,
const char *type, void *event_info), const char *type, int x, int y, int w, int
h);
+EAPI E_Drop_Handler *e_drop_handler_add(void *data,
+ void (*func)(void *data, const char
*type, void *event_info),
+ const char *type, int x, int y, int w,
int h);
EAPI void e_drop_handler_del(E_Drop_Handler *handler);
#endif
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs