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_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_cb_signal_action(void *data, Evas_Object *obj, const char *emission, c
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_cb_signal_drag(void *data, Evas_Object *obj, const char *emission, con
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 @@ _e_border_cb_mouse_up(void *data, int type, void *event)
}
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 @@ _e_border_cb_mouse_move(void *data, int type, void *event)
}
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_eval(E_Border *bd)
_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 @@ _e_border_reorder_before(E_Border *bd, E_Border *before)
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 shape : 1;
} changes;
struct {
unsigned char start : 1;
int x, y;
} drag;
};
struct _E_Border_Pending_Move_Resize

View File

@ -13,9 +13,11 @@ static Evas_Object *drag_obj;
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 @@ e_dnd_shutdown(void)
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 @@ e_drag_start(E_Zone *zone, const char *type, void *data,
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 @@ e_drag_update(int x, int y)
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 @@ e_drag_end(int x, int y)
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 @@ end:
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_dnd_cb_mouse_up(void *data, int type, void *event)
e_drag_end(ev->x, ev->y);
#if 0
if (drag_cb)
{
E_Drag_Event *e;
@ -240,6 +248,7 @@ _e_dnd_cb_mouse_up(void *data, int type, void *event)
free(e);
}
}
#endif
return 1;
}

View File

@ -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 @@ struct _E_Drop_Event
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),