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.


SVN revision: 14377
This commit is contained in:
sebastid 2005-04-26 09:36:18 +00:00 committed by sebastid
parent 321f9ae1e2
commit 106618ca0a
4 changed files with 71 additions and 39 deletions

View File

@ -106,8 +106,6 @@ static void _e_border_move_update(E_Border *bd);
static void _e_border_reorder_after(E_Border *bd, E_Border *after); 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_reorder_before(E_Border *bd, E_Border *before);
static void _e_border_drag_cb(void *data, void *event);
/* local subsystem globals */ /* local subsystem globals */
static Evas_List *handlers = NULL; static Evas_List *handlers = NULL;
static Evas_List *borders = NULL; static Evas_List *borders = NULL;
@ -1894,6 +1892,9 @@ _e_border_cb_signal_action(void *data, Evas_Object *obj, const char *emission, c
E_Border *bd; E_Border *bd;
bd = data; bd = data;
if (e_dnd_active()) return;
printf("action %s\n", source); printf("action %s\n", source);
if (!strcmp(source, "close")) if (!strcmp(source, "close"))
{ {
@ -1954,20 +1955,9 @@ _e_border_cb_signal_drag(void *data, Evas_Object *obj, const char *emission, con
E_Border *bd; E_Border *bd;
bd = data; bd = data;
bd->drag.start = 1;
if ((bd->client.icccm.name) && (bd->client.icccm.class)) bd->drag.x = -1;
{ bd->drag.y = -1;
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");
}
}
} }
static int static int
@ -2281,6 +2271,9 @@ _e_border_cb_mouse_up(void *data, int type, void *event)
} }
bd->mouse.current.mx = ev->root.x; bd->mouse.current.mx = ev->root.x;
bd->mouse.current.my = ev->root.y; 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_move(bd->bg_evas, ev->x, ev->y, NULL);
evas_event_feed_mouse_up(bd->bg_evas, ev->button, EVAS_BUTTON_NONE, NULL); evas_event_feed_mouse_up(bd->bg_evas, ev->button, EVAS_BUTTON_NONE, NULL);
return 1; return 1;
@ -2339,6 +2332,42 @@ _e_border_cb_mouse_move(void *data, int type, void *event)
} }
else 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); evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL);
} }
return 1; return 1;
@ -2746,10 +2775,8 @@ _e_border_eval(E_Border *bd)
_e_border_cb_signal_resize_stop, bd); _e_border_cb_signal_resize_stop, bd);
edje_object_signal_callback_add(o, "action", "*", edje_object_signal_callback_add(o, "action", "*",
_e_border_cb_signal_action, bd); _e_border_cb_signal_action, bd);
#if 0
edje_object_signal_callback_add(o, "drag", "*", edje_object_signal_callback_add(o, "drag", "*",
_e_border_cb_signal_drag, bd); _e_border_cb_signal_drag, bd);
#endif
if (bd->focused) if (bd->focused)
edje_object_signal_emit(bd->bg_object, "active", ""); edje_object_signal_emit(bd->bg_object, "active", "");
evas_object_move(o, 0, 0); evas_object_move(o, 0, 0);
@ -3994,20 +4021,3 @@ _e_border_reorder_before(E_Border *bd, E_Border *before)
borders = evas_list_prepend(borders, bd); 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);
}

View File

@ -211,6 +211,11 @@ struct _E_Border
unsigned int shaded : 1; unsigned int shaded : 1;
unsigned int shape : 1; unsigned int shape : 1;
} changes; } changes;
struct {
unsigned char start : 1;
int x, y;
} drag;
}; };
struct _E_Border_Pending_Move_Resize struct _E_Border_Pending_Move_Resize

View File

@ -13,9 +13,11 @@ static Evas_Object *drag_obj;
static char *drag_type; static char *drag_type;
static void *drag_data; static void *drag_data;
#if 0
static int drag; static int drag;
static void (*drag_cb)(void *data, void *event); static void (*drag_cb)(void *data, void *event);
static void *drag_cb_data; 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_up(void *data, int type, void *event);
static int _e_dnd_cb_mouse_move(void *data, int type, void *event); static int _e_dnd_cb_mouse_move(void *data, int type, void *event);
@ -78,6 +80,12 @@ e_dnd_shutdown(void)
return 1; return 1;
} }
int
e_dnd_active(void)
{
return (drag_win != 0);
}
void void
e_drag_start(E_Zone *zone, const char *type, void *data, e_drag_start(E_Zone *zone, const char *type, void *data,
const char *icon_path, const char *icon) const char *icon_path, const char *icon)
@ -91,8 +99,6 @@ e_drag_start(E_Zone *zone, const char *type, void *data,
ecore_x_pointer_confine_grab(drag_win); ecore_x_pointer_confine_grab(drag_win);
ecore_x_keyboard_grab(drag_win); ecore_x_keyboard_grab(drag_win);
drag = 0;
if (drag_ee) if (drag_ee)
{ {
e_canvas_del(drag_ee); e_canvas_del(drag_ee);
@ -128,8 +134,6 @@ e_drag_update(int x, int y)
if (!drag_ee) return; if (!drag_ee) return;
drag = 1;
evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h); evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h);
evas_object_show(drag_obj); evas_object_show(drag_obj);
ecore_evas_show(drag_ee); ecore_evas_show(drag_ee);
@ -153,6 +157,7 @@ e_drag_end(int x, int y)
ecore_x_pointer_ungrab(); ecore_x_pointer_ungrab();
ecore_x_keyboard_ungrab(); ecore_x_keyboard_ungrab();
ecore_x_window_del(drag_win); ecore_x_window_del(drag_win);
drag_win = 0;
ev = E_NEW(E_Drop_Event, 1); ev = E_NEW(E_Drop_Event, 1);
if (!ev) goto end; if (!ev) goto end;
@ -180,12 +185,14 @@ end:
drag_data = NULL; drag_data = NULL;
} }
#if 0
void void
e_drag_callback_set(void *data, void (*func)(void *data, void *event)) e_drag_callback_set(void *data, void (*func)(void *data, void *event))
{ {
drag_cb = func; drag_cb = func;
drag_cb_data = data; drag_cb_data = data;
} }
#endif
E_Drop_Handler * 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) 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_dnd_cb_mouse_up(void *data, int type, void *event)
e_drag_end(ev->x, ev->y); e_drag_end(ev->x, ev->y);
#if 0
if (drag_cb) if (drag_cb)
{ {
E_Drag_Event *e; E_Drag_Event *e;
@ -240,6 +248,7 @@ _e_dnd_cb_mouse_up(void *data, int type, void *event)
free(e); free(e);
} }
} }
#endif
return 1; return 1;
} }

View File

@ -6,7 +6,9 @@
typedef struct _E_Drop_Handler E_Drop_Handler; typedef struct _E_Drop_Handler E_Drop_Handler;
typedef struct _E_Drop_Event E_Drop_Event; typedef struct _E_Drop_Event E_Drop_Event;
#if 0
typedef struct _E_Drag_Event E_Drag_Event; typedef struct _E_Drag_Event E_Drag_Event;
#endif
#else #else
#ifndef E_DND_H #ifndef E_DND_H
@ -26,20 +28,26 @@ struct _E_Drop_Event
int x, y; int x, y;
}; };
#if 0
struct _E_Drag_Event struct _E_Drag_Event
{ {
int drag; int drag;
int x, y; int x, y;
}; };
#endif
EAPI int e_dnd_init(void); EAPI int e_dnd_init(void);
EAPI int e_dnd_shutdown(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, EAPI void e_drag_start(E_Zone *zone, const char *type, void *data,
const char *icon_path, const char *icon); const char *icon_path, const char *icon);
EAPI void e_drag_update(int x, int y); EAPI void e_drag_update(int x, int y);
EAPI void e_drag_end(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)); 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, EAPI E_Drop_Handler *e_drop_handler_add(void *data,
void (*func)(void *data, const char *type, void *event_info), void (*func)(void *data, const char *type, void *event_info),