summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/e_border.c80
-rw-r--r--src/bin/e_border.h5
-rw-r--r--src/bin/e_dnd.c17
-rw-r--r--src/bin/e_dnd.h8
4 files changed, 71 insertions, 39 deletions
diff --git a/src/bin/e_border.c b/src/bin/e_border.c
index d9d8a93..9585527 100644
--- a/src/bin/e_border.c
+++ b/src/bin/e_border.c
@@ -106,8 +106,6 @@ static void _e_border_move_update(E_Border *bd);
106static void _e_border_reorder_after(E_Border *bd, E_Border *after); 106static void _e_border_reorder_after(E_Border *bd, E_Border *after);
107static void _e_border_reorder_before(E_Border *bd, E_Border *before); 107static void _e_border_reorder_before(E_Border *bd, E_Border *before);
108 108
109static void _e_border_drag_cb(void *data, void *event);
110
111/* local subsystem globals */ 109/* local subsystem globals */
112static Evas_List *handlers = NULL; 110static Evas_List *handlers = NULL;
113static Evas_List *borders = NULL; 111static Evas_List *borders = NULL;
@@ -1894,6 +1892,9 @@ _e_border_cb_signal_action(void *data, Evas_Object *obj, const char *emission, c
1894 E_Border *bd; 1892 E_Border *bd;
1895 1893
1896 bd = data; 1894 bd = data;
1895
1896 if (e_dnd_active()) return;
1897
1897 printf("action %s\n", source); 1898 printf("action %s\n", source);
1898 if (!strcmp(source, "close")) 1899 if (!strcmp(source, "close"))
1899 { 1900 {
@@ -1954,20 +1955,9 @@ _e_border_cb_signal_drag(void *data, Evas_Object *obj, const char *emission, con
1954 E_Border *bd; 1955 E_Border *bd;
1955 1956
1956 bd = data; 1957 bd = data;
1957 1958 bd->drag.start = 1;
1958 if ((bd->client.icccm.name) && (bd->client.icccm.class)) 1959 bd->drag.x = -1;
1959 { 1960 bd->drag.y = -1;
1960 E_App *a;
1961
1962 a = e_app_window_name_class_find(bd->client.icccm.name,
1963 bd->client.icccm.class);
1964 if (a)
1965 {
1966 e_drag_callback_set(bd, _e_border_drag_cb);
1967 e_drag_start(bd->zone, "enlightenment/border", bd,
1968 a->path, "icon");
1969 }
1970 }
1971} 1961}
1972 1962
1973static int 1963static int
@@ -2281,6 +2271,9 @@ _e_border_cb_mouse_up(void *data, int type, void *event)
2281 } 2271 }
2282 bd->mouse.current.mx = ev->root.x; 2272 bd->mouse.current.mx = ev->root.x;
2283 bd->mouse.current.my = ev->root.y; 2273 bd->mouse.current.my = ev->root.y;
2274
2275 bd->drag.start = 0;
2276
2284 evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL); 2277 evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL);
2285 evas_event_feed_mouse_up(bd->bg_evas, ev->button, EVAS_BUTTON_NONE, NULL); 2278 evas_event_feed_mouse_up(bd->bg_evas, ev->button, EVAS_BUTTON_NONE, NULL);
2286 return 1; 2279 return 1;
@@ -2339,6 +2332,42 @@ _e_border_cb_mouse_move(void *data, int type, void *event)
2339 } 2332 }
2340 else 2333 else
2341 { 2334 {
2335 if (bd->drag.start)
2336 {
2337 if ((bd->drag.x == -1) && (bd->drag.y == -1))
2338 {
2339 bd->drag.x = ev->x;
2340 bd->drag.y = ev->y;
2341 }
2342 else
2343 {
2344 int x, y;
2345 double dist;
2346
2347 x = bd->drag.x - ev->x;
2348 y = bd->drag.y - ev->y;
2349 dist = sqrt(pow(x, 2) + pow(y, 2));
2350 if (dist > 10)
2351 {
2352 /* start drag! */
2353 if ((bd->client.icccm.name) && (bd->client.icccm.class))
2354 {
2355 E_App *a;
2356
2357 a = e_app_window_name_class_find(bd->client.icccm.name,
2358 bd->client.icccm.class);
2359 if (a)
2360 {
2361 e_drag_start(bd->zone, "enlightenment/border", bd,
2362 a->path, "icon");
2363 evas_event_feed_mouse_up(bd->bg_evas, 1,
2364 EVAS_BUTTON_NONE, NULL);
2365 }
2366 }
2367 bd->drag.start = 0;
2368 }
2369 }
2370 }
2342 evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL); 2371 evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL);
2343 } 2372 }
2344 return 1; 2373 return 1;
@@ -2746,10 +2775,8 @@ _e_border_eval(E_Border *bd)
2746 _e_border_cb_signal_resize_stop, bd); 2775 _e_border_cb_signal_resize_stop, bd);
2747 edje_object_signal_callback_add(o, "action", "*", 2776 edje_object_signal_callback_add(o, "action", "*",
2748 _e_border_cb_signal_action, bd); 2777 _e_border_cb_signal_action, bd);
2749#if 0
2750 edje_object_signal_callback_add(o, "drag", "*", 2778 edje_object_signal_callback_add(o, "drag", "*",
2751 _e_border_cb_signal_drag, bd); 2779 _e_border_cb_signal_drag, bd);
2752#endif
2753 if (bd->focused) 2780 if (bd->focused)
2754 edje_object_signal_emit(bd->bg_object, "active", ""); 2781 edje_object_signal_emit(bd->bg_object, "active", "");
2755 evas_object_move(o, 0, 0); 2782 evas_object_move(o, 0, 0);
@@ -3994,20 +4021,3 @@ _e_border_reorder_before(E_Border *bd, E_Border *before)
3994 borders = evas_list_prepend(borders, bd); 4021 borders = evas_list_prepend(borders, bd);
3995 } 4022 }
3996} 4023}
3997
3998static void
3999_e_border_drag_cb(void *data, void *event)
4000{
4001 E_Drag_Event *ev;
4002 E_Border *bd;
4003
4004 ev = event;
4005 bd = data;
4006
4007 printf("_e_border_drag_cb\n");
4008
4009 if (ev->drag)
4010 evas_event_feed_mouse_move(bd->bg_evas, ev->x, ev->y, NULL);
4011 evas_event_feed_mouse_up(bd->bg_evas, 1, EVAS_BUTTON_NONE, NULL);
4012}
4013
diff --git a/src/bin/e_border.h b/src/bin/e_border.h
index 9ecb7fd..b8823aa 100644
--- a/src/bin/e_border.h
+++ b/src/bin/e_border.h
@@ -211,6 +211,11 @@ struct _E_Border
211 unsigned int shaded : 1; 211 unsigned int shaded : 1;
212 unsigned int shape : 1; 212 unsigned int shape : 1;
213 } changes; 213 } changes;
214
215 struct {
216 unsigned char start : 1;
217 int x, y;
218 } drag;
214}; 219};
215 220
216struct _E_Border_Pending_Move_Resize 221struct _E_Border_Pending_Move_Resize
diff --git a/src/bin/e_dnd.c b/src/bin/e_dnd.c
index e504ef8..249f932 100644
--- a/src/bin/e_dnd.c
+++ b/src/bin/e_dnd.c
@@ -13,9 +13,11 @@ static Evas_Object *drag_obj;
13static char *drag_type; 13static char *drag_type;
14static void *drag_data; 14static void *drag_data;
15 15
16#if 0
16static int drag; 17static int drag;
17static void (*drag_cb)(void *data, void *event); 18static void (*drag_cb)(void *data, void *event);
18static void *drag_cb_data; 19static void *drag_cb_data;
20#endif
19 21
20static int _e_dnd_cb_mouse_up(void *data, int type, void *event); 22static int _e_dnd_cb_mouse_up(void *data, int type, void *event);
21static int _e_dnd_cb_mouse_move(void *data, int type, void *event); 23static int _e_dnd_cb_mouse_move(void *data, int type, void *event);
@@ -78,6 +80,12 @@ e_dnd_shutdown(void)
78 return 1; 80 return 1;
79} 81}
80 82
83int
84e_dnd_active(void)
85{
86 return (drag_win != 0);
87}
88
81void 89void
82e_drag_start(E_Zone *zone, const char *type, void *data, 90e_drag_start(E_Zone *zone, const char *type, void *data,
83 const char *icon_path, const char *icon) 91 const char *icon_path, const char *icon)
@@ -91,8 +99,6 @@ e_drag_start(E_Zone *zone, const char *type, void *data,
91 ecore_x_pointer_confine_grab(drag_win); 99 ecore_x_pointer_confine_grab(drag_win);
92 ecore_x_keyboard_grab(drag_win); 100 ecore_x_keyboard_grab(drag_win);
93 101
94 drag = 0;
95
96 if (drag_ee) 102 if (drag_ee)
97 { 103 {
98 e_canvas_del(drag_ee); 104 e_canvas_del(drag_ee);
@@ -128,8 +134,6 @@ e_drag_update(int x, int y)
128 134
129 if (!drag_ee) return; 135 if (!drag_ee) return;
130 136
131 drag = 1;
132
133 evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h); 137 evas_object_geometry_get(drag_obj, NULL, NULL, &w, &h);
134 evas_object_show(drag_obj); 138 evas_object_show(drag_obj);
135 ecore_evas_show(drag_ee); 139 ecore_evas_show(drag_ee);
@@ -153,6 +157,7 @@ e_drag_end(int x, int y)
153 ecore_x_pointer_ungrab(); 157 ecore_x_pointer_ungrab();
154 ecore_x_keyboard_ungrab(); 158 ecore_x_keyboard_ungrab();
155 ecore_x_window_del(drag_win); 159 ecore_x_window_del(drag_win);
160 drag_win = 0;
156 161
157 ev = E_NEW(E_Drop_Event, 1); 162 ev = E_NEW(E_Drop_Event, 1);
158 if (!ev) goto end; 163 if (!ev) goto end;
@@ -180,12 +185,14 @@ end:
180 drag_data = NULL; 185 drag_data = NULL;
181} 186}
182 187
188#if 0
183void 189void
184e_drag_callback_set(void *data, void (*func)(void *data, void *event)) 190e_drag_callback_set(void *data, void (*func)(void *data, void *event))
185{ 191{
186 drag_cb = func; 192 drag_cb = func;
187 drag_cb_data = data; 193 drag_cb_data = data;
188} 194}
195#endif
189 196
190E_Drop_Handler * 197E_Drop_Handler *
191e_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) 198e_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)
225 232
226 e_drag_end(ev->x, ev->y); 233 e_drag_end(ev->x, ev->y);
227 234
235#if 0
228 if (drag_cb) 236 if (drag_cb)
229 { 237 {
230 E_Drag_Event *e; 238 E_Drag_Event *e;
@@ -240,6 +248,7 @@ _e_dnd_cb_mouse_up(void *data, int type, void *event)
240 free(e); 248 free(e);
241 } 249 }
242 } 250 }
251#endif
243 252
244 return 1; 253 return 1;
245} 254}
diff --git a/src/bin/e_dnd.h b/src/bin/e_dnd.h
index bda7d0b..dbc7234 100644
--- a/src/bin/e_dnd.h
+++ b/src/bin/e_dnd.h
@@ -6,7 +6,9 @@
6 6
7typedef struct _E_Drop_Handler E_Drop_Handler; 7typedef struct _E_Drop_Handler E_Drop_Handler;
8typedef struct _E_Drop_Event E_Drop_Event; 8typedef struct _E_Drop_Event E_Drop_Event;
9#if 0
9typedef struct _E_Drag_Event E_Drag_Event; 10typedef struct _E_Drag_Event E_Drag_Event;
11#endif
10 12
11#else 13#else
12#ifndef E_DND_H 14#ifndef E_DND_H
@@ -26,20 +28,26 @@ struct _E_Drop_Event
26 int x, y; 28 int x, y;
27}; 29};
28 30
31#if 0
29struct _E_Drag_Event 32struct _E_Drag_Event
30{ 33{
31 int drag; 34 int drag;
32 int x, y; 35 int x, y;
33}; 36};
37#endif
34 38
35EAPI int e_dnd_init(void); 39EAPI int e_dnd_init(void);
36EAPI int e_dnd_shutdown(void); 40EAPI int e_dnd_shutdown(void);
37 41
42EAPI int e_dnd_active(void);
43
38EAPI void e_drag_start(E_Zone *zone, const char *type, void *data, 44EAPI void e_drag_start(E_Zone *zone, const char *type, void *data,
39 const char *icon_path, const char *icon); 45 const char *icon_path, const char *icon);
40EAPI void e_drag_update(int x, int y); 46EAPI void e_drag_update(int x, int y);
41EAPI void e_drag_end(int x, int y); 47EAPI void e_drag_end(int x, int y);
48#if 0
42EAPI void e_drag_callback_set(void *data, void (*func)(void *data, void *event)); 49EAPI void e_drag_callback_set(void *data, void (*func)(void *data, void *event));
50#endif
43 51
44EAPI E_Drop_Handler *e_drop_handler_add(void *data, 52EAPI E_Drop_Handler *e_drop_handler_add(void *data,
45 void (*func)(void *data, const char *type, void *event_info), 53 void (*func)(void *data, const char *type, void *event_info),