Enlightenment CVS committal
Author : sebastid
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_border.c e_border.h e_dnd.c e_dnd.h
Log Message:
Hurra! Try dragging the icon from a border to the pager! (With the default
theme). A big thank you to raster who helped me through all this. The first
person who complains will be cursed.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -3 -r1.155 -r1.156
--- e_border.c 25 Apr 2005 20:56:52 -0000 1.155
+++ e_border.c 26 Apr 2005 09:36:18 -0000 1.156
@@ -106,8 +106,6 @@
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_drag_cb(void *data, void *event);
-
/* local subsystem globals */
static Evas_List *handlers = NULL;
static Evas_List *borders = NULL;
@@ -1894,6 +1892,9 @@
E_Border *bd;
bd = data;
+
+ if (e_dnd_active()) return;
+
printf("action %s\n", source);
if (!strcmp(source, "close"))
{
@@ -1954,20 +1955,9 @@
E_Border *bd;
bd = data;
-
- if ((bd->client.icccm.name) && (bd->client.icccm.class))
- {
- E_App *a;
-
- a = e_app_window_name_class_find(bd->client.icccm.name,
- 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");
- }
- }
+ bd->drag.start = 1;
+ bd->drag.x = -1;
+ bd->drag.y = -1;
}
static int
@@ -2281,6 +2271,9 @@
}
bd->mouse.current.mx = ev->root.x;
bd->mouse.current.my = ev->root.y;
+
+ bd->drag.start = 0;
+
evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL);
evas_event_feed_mouse_up(bd->bg_evas, ev->button, EVAS_BUTTON_NONE, NULL);
return 1;
@@ -2339,6 +2332,42 @@
}
else
{
+ if (bd->drag.start)
+ {
+ if ((bd->drag.x == -1) && (bd->drag.y == -1))
+ {
+ bd->drag.x = ev->x;
+ bd->drag.y = ev->y;
+ }
+ else
+ {
+ int x, y;
+ double dist;
+
+ x = bd->drag.x - ev->x;
+ y = bd->drag.y - ev->y;
+ dist = sqrt(pow(x, 2) + pow(y, 2));
+ if (dist > 10)
+ {
+ /* start drag! */
+ if ((bd->client.icccm.name) && (bd->client.icccm.class))
+ {
+ E_App *a;
+
+ a =
e_app_window_name_class_find(bd->client.icccm.name,
+
bd->client.icccm.class);
+ if (a)
+ {
+ e_drag_start(bd->zone, "enlightenment/border",
bd,
+ a->path, "icon");
+ evas_event_feed_mouse_up(bd->bg_evas, 1,
+ EVAS_BUTTON_NONE,
NULL);
+ }
+ }
+ bd->drag.start = 0;
+ }
+ }
+ }
evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL);
}
return 1;
@@ -2746,10 +2775,8 @@
_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);
@@ -3994,20 +4021,3 @@
borders = evas_list_prepend(borders, bd);
}
}
-
-static void
-_e_border_drag_cb(void *data, void *event)
-{
- 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_border.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -3 -r1.33 -r1.34
--- e_border.h 13 Apr 2005 15:52:33 -0000 1.33
+++ e_border.h 26 Apr 2005 09:36:18 -0000 1.34
@@ -211,6 +211,11 @@
unsigned int shaded : 1;
unsigned int shape : 1;
} changes;
+
+ struct {
+ unsigned char start : 1;
+ int x, y;
+ } drag;
};
struct _E_Border_Pending_Move_Resize
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- e_dnd.c 25 Apr 2005 20:56:52 -0000 1.5
+++ e_dnd.c 26 Apr 2005 09:36:18 -0000 1.6
@@ -13,9 +13,11 @@
static char *drag_type;
static void *drag_data;
+#if 0
static int drag;
static void (*drag_cb)(void *data, void *event);
static void *drag_cb_data;
+#endif
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);
@@ -78,6 +80,12 @@
return 1;
}
+int
+e_dnd_active(void)
+{
+ return (drag_win != 0);
+}
+
void
e_drag_start(E_Zone *zone, const char *type, void *data,
const char *icon_path, const char *icon)
@@ -91,8 +99,6 @@
ecore_x_pointer_confine_grab(drag_win);
ecore_x_keyboard_grab(drag_win);
- drag = 0;
-
if (drag_ee)
{
e_canvas_del(drag_ee);
@@ -128,8 +134,6 @@
if (!drag_ee) return;
- drag = 1;
-
evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h);
evas_object_show(drag_obj);
ecore_evas_show(drag_ee);
@@ -153,6 +157,7 @@
ecore_x_pointer_ungrab();
ecore_x_keyboard_ungrab();
ecore_x_window_del(drag_win);
+ drag_win = 0;
ev = E_NEW(E_Drop_Event, 1);
if (!ev) goto end;
@@ -180,12 +185,14 @@
drag_data = NULL;
}
+#if 0
void
e_drag_callback_set(void *data, void (*func)(void *data, void *event))
{
drag_cb = func;
drag_cb_data = data;
}
+#endif
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)
@@ -225,6 +232,7 @@
e_drag_end(ev->x, ev->y);
+#if 0
if (drag_cb)
{
E_Drag_Event *e;
@@ -240,6 +248,7 @@
free(e);
}
}
+#endif
return 1;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_dnd.h 25 Apr 2005 20:56:52 -0000 1.4
+++ e_dnd.h 26 Apr 2005 09:36:18 -0000 1.5
@@ -6,7 +6,9 @@
typedef struct _E_Drop_Handler E_Drop_Handler;
typedef struct _E_Drop_Event E_Drop_Event;
+#if 0
typedef struct _E_Drag_Event E_Drag_Event;
+#endif
#else
#ifndef E_DND_H
@@ -26,20 +28,26 @@
int x, y;
};
+#if 0
struct _E_Drag_Event
{
int drag;
int x, y;
};
+#endif
EAPI int e_dnd_init(void);
EAPI int e_dnd_shutdown(void);
+EAPI int e_dnd_active(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_update(int x, int y);
EAPI void e_drag_end(int x, int y);
+#if 0
EAPI void e_drag_callback_set(void *data, void (*func)(void *data, void
*event));
+#endif
EAPI E_Drop_Handler *e_drop_handler_add(void *data,
void (*func)(void *data, const char
*type, void *event_info),
-------------------------------------------------------
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