summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h22
-rw-r--r--legacy/ecore/src/lib/ecore_evas/ecore_evas.c16
-rw-r--r--legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c116
-rw-r--r--legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h91
-rw-r--r--legacy/ecore/src/lib/ecore_fb/Makefile.am1
-rw-r--r--legacy/ecore/src/lib/ecore_fb/ecore_fb.c13
-rw-r--r--legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c327
-rw-r--r--legacy/ecore/src/lib/ecore_fb/ecore_fb_private.h6
-rw-r--r--legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c24
-rw-r--r--legacy/ecore/src/lib/ecore_fb/ecore_fb_vt.c4
10 files changed, 284 insertions, 336 deletions
diff --git a/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h b/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h
index b26b8d6815..bf3a52c45f 100644
--- a/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h
+++ b/legacy/ecore/src/lib/ecore_evas/Ecore_Evas.h
@@ -1366,6 +1366,28 @@ EAPI Eina_Bool ecore_evas_sticky_get(const Ecore_Evas *ee);
1366EAPI void ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render); 1366EAPI void ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render);
1367EAPI Eina_Bool ecore_evas_manual_render_get(const Ecore_Evas *ee); 1367EAPI Eina_Bool ecore_evas_manual_render_get(const Ecore_Evas *ee);
1368 1368
1369/**
1370 * @brief Registers an @c Ecore_Evas to receive events through ecore_input_evas.
1371 *
1372 * @param ee The @c Ecore_Evas handle.
1373 *
1374 * This function calls ecore_event_window_register() with the @p ee as its @c
1375 * id argument, @c window argument, and uses its @c Evas too. It is useful when
1376 * no @c window information is available on a given @c Ecore_Evas backend.
1377 *
1378 * @see ecore_evas_input_event_unregister()
1379 * @since 1.1
1380 */
1381EAPI void ecore_evas_input_event_register(Ecore_Evas *ee);
1382/**
1383 * @brief Unregisters an @c Ecore_Evas receiving events through ecore_input_evas.
1384 *
1385 * @param ee The @c Ecore_Evas handle.
1386 *
1387 * @see ecore_evas_input_event_register()
1388 * @since 1.1
1389 */
1390EAPI void ecore_evas_input_event_unregister(Ecore_Evas *ee);
1369 1391
1370/** 1392/**
1371 * @brief Force immediate rendering on a given @c Ecore_Evas window 1393 * @brief Force immediate rendering on a given @c Ecore_Evas window
diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas.c
index 2fc629ac7e..4bbcdf4ada 100644
--- a/legacy/ecore/src/lib/ecore_evas/ecore_evas.c
+++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas.c
@@ -2519,3 +2519,19 @@ ecore_evas_ecore_evas_list_get(void)
2519 2519
2520 return l; 2520 return l;
2521} 2521}
2522
2523EAPI void
2524ecore_evas_input_event_register(Ecore_Evas *ee)
2525{
2526 ecore_event_window_register((Ecore_Window)ee, ee, ee->evas,
2527 (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process,
2528 (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process,
2529 (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process,
2530 (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process);
2531}
2532
2533EAPI void
2534ecore_evas_input_event_unregister(Ecore_Evas *ee)
2535{
2536 ecore_event_window_unregister((Ecore_Window)ee);
2537}
diff --git a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c
index badc61e518..004d4d9879 100644
--- a/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c
+++ b/legacy/ecore/src/lib/ecore_evas/ecore_evas_fb.c
@@ -20,10 +20,10 @@ static int _ecore_evas_init_count = 0;
20 20
21static char *ecore_evas_default_display = "0"; 21static char *ecore_evas_default_display = "0";
22static Eina_List *ecore_evas_input_devices = NULL; 22static Eina_List *ecore_evas_input_devices = NULL;
23static Ecore_Event_Handler *ecore_evas_event_handlers[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; 23static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {NULL, NULL, NULL, NULL};
24 24
25static void 25static void
26_ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y, unsigned int timestamp) 26_ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y)
27{ 27{
28 int fbw, fbh; 28 int fbw, fbh;
29 29
@@ -50,14 +50,6 @@ _ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y, unsigned int tim
50 y - ee->prop.cursor.hot.x, 50 y - ee->prop.cursor.hot.x,
51 (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.y); 51 (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.y);
52 } 52 }
53 if (ee->rotation == 0)
54 evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL);
55 else if (ee->rotation == 90)
56 evas_event_feed_mouse_move(ee->evas, (fbh - ee->h) + ee->h - y - 1, x, timestamp, NULL);
57 else if (ee->rotation == 180)
58 evas_event_feed_mouse_move(ee->evas, (fbw - ee->w) + ee->w - x - 1, (fbh - ee->h) + ee->h - y - 1, timestamp, NULL);
59 else if (ee->rotation == 270)
60 evas_event_feed_mouse_move(ee->evas, y, (fbw - ee->w) + ee->w - x - 1, timestamp, NULL);
61} 53}
62 54
63static Ecore_Evas *fb_ee = NULL; 55static Ecore_Evas *fb_ee = NULL;
@@ -103,89 +95,55 @@ _ecore_evas_fb_gain(void *data __UNUSED__)
103} 95}
104 96
105static Eina_Bool 97static Eina_Bool
106_ecore_evas_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
107{
108 Ecore_Evas *ee;
109 Ecore_Fb_Event_Key_Down *e;
110
111 e = event;
112 ee = _ecore_evas_fb_match();
113 if (!ee) return EINA_TRUE; /* pass on event */
114 evas_event_feed_key_down(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
115 return EINA_FALSE; /* dont pass it on */
116}
117
118static Eina_Bool
119_ecore_evas_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
120{
121 Ecore_Evas *ee;
122 Ecore_Fb_Event_Key_Up *e;
123
124 e = event;
125 ee = _ecore_evas_fb_match();
126 if (!ee) return EINA_TRUE; /* pass on event */
127 evas_event_feed_key_up(ee->evas, e->keyname, e->keysymbol, e->key_compose, NULL, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
128 return EINA_FALSE; /* dont pass it on */
129}
130
131static Eina_Bool
132_ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) 98_ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event)
133{ 99{
134 Ecore_Evas *ee; 100 Ecore_Evas *ee;
135 Ecore_Fb_Event_Mouse_Button_Down *e; 101 Ecore_Event_Mouse_Button *e;
136 Evas_Button_Flags flags = EVAS_BUTTON_NONE;
137 102
138 e = event; 103 e = event;
139 ee = _ecore_evas_fb_match(); 104 ee = _ecore_evas_fb_match();
140 if (!ee) return EINA_TRUE; /* pass on event */ 105 if (!ee) return EINA_TRUE; /* pass on event */
141 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); 106 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
142 if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK; 107 return EINA_TRUE; /* dont pass it on */
143 if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK;
144 evas_event_feed_mouse_down(ee->evas, e->button, flags, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
145 return EINA_FALSE; /* dont pass it on */
146} 108}
147 109
148static Eina_Bool 110static Eina_Bool
149_ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) 111_ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event)
150{ 112{
151 Ecore_Evas *ee; 113 Ecore_Evas *ee;
152 Ecore_Fb_Event_Mouse_Button_Up *e; 114 Ecore_Event_Mouse_Button *e;
153 115
154 e = event; 116 e = event;
155 ee = _ecore_evas_fb_match(); 117 ee = _ecore_evas_fb_match();
156 if (!ee) return EINA_TRUE; /* pass on event */ 118 if (!ee) return EINA_TRUE; /* pass on event */
157 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); 119 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
158 evas_event_feed_mouse_up(ee->evas, e->button, EVAS_BUTTON_NONE, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 120 return EINA_TRUE; /* dont pass it on */
159 return EINA_FALSE; /* dont pass it on */
160} 121}
161 122
162static Eina_Bool 123static Eina_Bool
163_ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) 124_ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
164{ 125{
165 Ecore_Evas *ee; 126 Ecore_Evas *ee;
166 Ecore_Fb_Event_Mouse_Move *e; 127 Ecore_Event_Mouse_Move *e;
167 128
168 e = event; 129 e = event;
169 ee = _ecore_evas_fb_match(); 130 ee = _ecore_evas_fb_match();
170 if (!ee) return EINA_TRUE; /* pass on event */ 131 if (!ee) return EINA_TRUE; /* pass on event */
171 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); 132 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
172 return EINA_FALSE; /* dont pass it on */ 133 return EINA_TRUE; /* dont pass it on */
173} 134}
174 135
175static Eina_Bool 136static Eina_Bool
176_ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) 137_ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event)
177{ 138{
178 Ecore_Evas *ee; 139 Ecore_Evas *ee;
179 Ecore_Fb_Event_Mouse_Wheel *e; 140 Ecore_Event_Mouse_Wheel *e;
180 unsigned long long event_time;
181 141
182 e = event; 142 e = event;
183 ee = _ecore_evas_fb_match(); 143 ee = _ecore_evas_fb_match();
184 if (!ee) return EINA_TRUE; /* pass on event */ 144 if (!ee) return EINA_TRUE; /* pass on event */
185 event_time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); 145 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y);
186 _ecore_evas_mouse_move_process_fb(ee, e->x, e->y, event_time); 146 return EINA_TRUE; /* dont pass it on */
187 evas_event_feed_mouse_wheel(ee->evas, e->direction, e->wheel, event_time, NULL);
188 return EINA_FALSE; /* dont pass it on */
189} 147}
190 148
191static int 149static int
@@ -224,12 +182,11 @@ _ecore_evas_fb_render(Ecore_Evas *ee)
224} 182}
225 183
226static int 184static int
227_ecore_evas_fb_init(int w, int h) 185_ecore_evas_fb_init(Ecore_Evas *ee, int w, int h)
228{ 186{
229 Ecore_Fb_Input_Device *device; 187 Ecore_Fb_Input_Device *device;
230 Ecore_Fb_Input_Device_Cap caps; 188 Ecore_Fb_Input_Device_Cap caps;
231 int mouse_handled = 0; 189 int mouse_handled = 0;
232 int keyboard_handled = 0;
233 190
234 DIR *input_dir; 191 DIR *input_dir;
235 struct dirent *input_entry; 192 struct dirent *input_entry;
@@ -237,6 +194,8 @@ _ecore_evas_fb_init(int w, int h)
237 _ecore_evas_init_count++; 194 _ecore_evas_init_count++;
238 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; 195 if (_ecore_evas_init_count > 1) return _ecore_evas_init_count;
239 196
197 ecore_event_evas_init();
198
240 /* register all input devices */ 199 /* register all input devices */
241 input_dir = opendir("/dev/input/"); 200 input_dir = opendir("/dev/input/");
242 if (!input_dir) return _ecore_evas_init_count; 201 if (!input_dir) return _ecore_evas_init_count;
@@ -249,7 +208,7 @@ _ecore_evas_fb_init(int w, int h)
249 continue; 208 continue;
250 209
251 snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name); 210 snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name);
252 if (!(device = ecore_fb_input_device_open(device_path))) 211 if (!(device = ecore_fb_input_device_open(ee, device_path)))
253 continue; 212 continue;
254 213
255 caps = ecore_fb_input_device_cap_get(device); 214 caps = ecore_fb_input_device_cap_get(device);
@@ -266,10 +225,10 @@ _ecore_evas_fb_init(int w, int h)
266 ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); 225 ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
267 if (!mouse_handled) 226 if (!mouse_handled)
268 { 227 {
269 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); 228 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
270 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); 229 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
271 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); 230 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
272 ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL); 231 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL);
273 mouse_handled = 1; 232 mouse_handled = 1;
274 } 233 }
275 } 234 }
@@ -278,12 +237,6 @@ _ecore_evas_fb_init(int w, int h)
278 { 237 {
279 ecore_fb_input_device_listen(device,1); 238 ecore_fb_input_device_listen(device,1);
280 ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); 239 ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device);
281 if (!keyboard_handled)
282 {
283 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_FB_EVENT_KEY_DOWN, _ecore_evas_event_key_down, NULL);
284 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_FB_EVENT_KEY_UP, _ecore_evas_event_key_up, NULL);
285 keyboard_handled = 1;
286 }
287 } 240 }
288 } 241 }
289 closedir(input_dir); 242 closedir(input_dir);
@@ -292,9 +245,9 @@ _ecore_evas_fb_init(int w, int h)
292 { 245 {
293 if (ecore_fb_ts_init()) 246 if (ecore_fb_ts_init())
294 { 247 {
295 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); 248 ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL);
296 ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); 249 ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL);
297 ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); 250 ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL);
298 mouse_handled = 1; 251 mouse_handled = 1;
299 } 252 }
300 } 253 }
@@ -304,6 +257,7 @@ _ecore_evas_fb_init(int w, int h)
304static void 257static void
305_ecore_evas_fb_free(Ecore_Evas *ee) 258_ecore_evas_fb_free(Ecore_Evas *ee)
306{ 259{
260 ecore_evas_input_event_unregister(ee);
307 if (fb_ee == ee) fb_ee = NULL; 261 if (fb_ee == ee) fb_ee = NULL;
308 _ecore_evas_fb_shutdown(); 262 _ecore_evas_fb_shutdown();
309 ecore_fb_shutdown(); 263 ecore_fb_shutdown();
@@ -406,7 +360,7 @@ _ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize __UNUSED__)
406 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); 360 evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w);
407 else 361 else
408 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); 362 evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h);
409 _ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); 363 _ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y);
410 if (ee->func.fn_resize) ee->func.fn_resize(ee); 364 if (ee->func.fn_resize) ee->func.fn_resize(ee);
411} 365}
412 366
@@ -509,12 +463,13 @@ _ecore_evas_fb_shutdown(void)
509 { 463 {
510 int i; 464 int i;
511 465
512 for (i = 0; i < 6; i++) 466 for (i = 0; i < 4; i++)
513 { 467 {
514 if (ecore_evas_event_handlers[i]) 468 if (ecore_evas_event_handlers[i])
515 ecore_event_handler_del(ecore_evas_event_handlers[i]); 469 ecore_event_handler_del(ecore_evas_event_handlers[i]);
516 } 470 }
517 ecore_fb_ts_shutdown(); 471 ecore_fb_ts_shutdown();
472 ecore_event_evas_shutdown();
518 } 473 }
519 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; 474 if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0;
520 return _ecore_evas_init_count; 475 return _ecore_evas_init_count;
@@ -602,7 +557,7 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
602 557
603 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); 558 ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS);
604 559
605 _ecore_evas_fb_init(w, h); 560 _ecore_evas_fb_init(ee, w, h);
606 561
607 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func; 562 ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func;
608 563
@@ -663,15 +618,8 @@ ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h)
663 ecore_evas_free(ee); 618 ecore_evas_free(ee);
664 return NULL; 619 return NULL;
665 } 620 }
666 evas_key_modifier_add(ee->evas, "Shift"); 621
667 evas_key_modifier_add(ee->evas, "Control"); 622 ecore_evas_input_event_register(ee);
668 evas_key_modifier_add(ee->evas, "Alt");
669 evas_key_modifier_add(ee->evas, "Meta");
670 evas_key_modifier_add(ee->evas, "Hyper");
671 evas_key_modifier_add(ee->evas, "Super");
672 evas_key_lock_add(ee->evas, "Caps_Lock");
673 evas_key_lock_add(ee->evas, "Num_Lock");
674 evas_key_lock_add(ee->evas, "Scroll_Lock");
675 623
676 ee->engine.func->fn_render = _ecore_evas_fb_render; 624 ee->engine.func->fn_render = _ecore_evas_fb_render;
677 _ecore_evas_register(ee); 625 _ecore_evas_register(ee);
diff --git a/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h b/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h
index 416ab9d246..37b9e1e6cd 100644
--- a/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h
+++ b/legacy/ecore/src/lib/ecore_fb/Ecore_Fb.h
@@ -65,101 +65,12 @@ enum _Ecore_Fb_Input_Device_Cap
65 */ 65 */
66typedef enum _Ecore_Fb_Input_Device_Cap Ecore_Fb_Input_Device_Cap; 66typedef enum _Ecore_Fb_Input_Device_Cap Ecore_Fb_Input_Device_Cap;
67 67
68EAPI extern int ECORE_FB_EVENT_KEY_DOWN; /**< FB Key Down event */
69EAPI extern int ECORE_FB_EVENT_KEY_UP; /**< FB Key Up event */
70EAPI extern int ECORE_FB_EVENT_MOUSE_BUTTON_DOWN; /**< FB Mouse Down event */
71EAPI extern int ECORE_FB_EVENT_MOUSE_BUTTON_UP; /**< FB Mouse Up event */
72EAPI extern int ECORE_FB_EVENT_MOUSE_MOVE; /**< FB Mouse Move event */
73EAPI extern int ECORE_FB_EVENT_MOUSE_WHEEL; /**< FB Mouse Wheel event */
74
75typedef struct _Ecore_Fb_Event_Key_Down Ecore_Fb_Event_Key_Down; /**< FB Key Down event */
76typedef struct _Ecore_Fb_Event_Key_Up Ecore_Fb_Event_Key_Up; /**< FB Key Up event */
77typedef struct _Ecore_Fb_Event_Mouse_Button_Down Ecore_Fb_Event_Mouse_Button_Down; /**< FB Mouse Down event */
78typedef struct _Ecore_Fb_Event_Mouse_Button_Up Ecore_Fb_Event_Mouse_Button_Up; /**< FB Mouse Up event */
79typedef struct _Ecore_Fb_Event_Mouse_Move Ecore_Fb_Event_Mouse_Move; /**< FB Mouse Move event */
80typedef struct _Ecore_Fb_Event_Mouse_Wheel Ecore_Fb_Event_Mouse_Wheel; /**< FB Mouse Wheel event */
81
82/**
83 * @struct _Ecore_Fb_Event_Key_Down
84 * Framebuffer Key Down event.
85 */
86struct _Ecore_Fb_Event_Key_Down
87{
88 Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
89 char *keyname; /**< The name of the key that was pressed */
90 char *keysymbol; /**< The logical symbol of the key that was pressed */
91 char *key_compose; /**< The UTF-8 string conversion if any */
92};
93
94/**
95 * @struct _Ecore_Fb_Event_Key_Up
96 * Framebuffer Key Up event.
97 */
98struct _Ecore_Fb_Event_Key_Up
99{
100 Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
101 char *keyname; /**< The name of the key that was released */
102 char *keysymbol; /**< The logical symbol of the key that was pressed */
103 char *key_compose; /**< The UTF-8 string conversion if any */
104};
105
106/**
107 * @struct _Ecore_Fb_Event_Mouse_Button_Down
108 * Framebuffer Mouse Down event.
109 */
110struct _Ecore_Fb_Event_Mouse_Button_Down
111{
112 Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
113 int button; /**< Mouse button that was pressed (1 - 32) */
114 int x; /**< Mouse co-ordinates when mouse button was pressed */
115 int y; /**< Mouse co-ordinates when mouse button was pressed */
116 int double_click : 1; /**< Set if click was a double click */
117 int triple_click : 1; /**< Set if click was a triple click */
118};
119
120/**
121 * @struct _Ecore_Fb_Event_Mouse_Button_Up
122 * Framebuffer Mouse Up event.
123 */
124struct _Ecore_Fb_Event_Mouse_Button_Up
125{
126 Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
127 int button; /**< Mouse button that was released (1 - 32) */
128 int x; /**< Mouse co-ordinates when mouse button was raised */
129 int y; /**< Mouse co-ordinates when mouse button was raised */
130 int double_click : 1; /**< Set if click was a double click */
131 int triple_click : 1; /**< Set if click was a triple click */
132};
133
134/**
135 * @struct _Ecore_Fb_Event_Mouse_Move
136 * Framebuffer Mouse Move event.
137 */
138struct _Ecore_Fb_Event_Mouse_Move
139{
140 Ecore_Fb_Input_Device *dev; /**< The device associated with the event */
141 int x; /**< Mouse co-ordinates where the mouse cursor moved to */
142 int y; /**< Mouse co-ordinates where the mouse cursor moved to */
143};
144
145/**
146 * @struct _Ecore_Fb_Event_Mouse_Wheel
147 * Framebuffer Mouse Wheel event.
148 */
149struct _Ecore_Fb_Event_Mouse_Wheel
150{
151 Ecore_Fb_Input_Device *dev;
152 int x,y;
153 int direction; /* 0 = vertical, 1 = horizontal */
154 int wheel; /* value 1 (left/up), -1 (right/down) */
155};
156
157/* ecore_fb_vt.c */ 68/* ecore_fb_vt.c */
158EAPI void ecore_fb_callback_gain_set(void (*func) (void *data), void *data); 69EAPI void ecore_fb_callback_gain_set(void (*func) (void *data), void *data);
159EAPI void ecore_fb_callback_lose_set(void (*func) (void *data), void *data); 70EAPI void ecore_fb_callback_lose_set(void (*func) (void *data), void *data);
160 71
161/* ecore_fb_li.c */ 72/* ecore_fb_li.c */
162EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(const char *dev); 73EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(void *window, const char *dev);
163EAPI void ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev); 74EAPI void ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev);
164EAPI void ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen); 75EAPI void ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen);
165EAPI const char *ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev); 76EAPI const char *ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev);
diff --git a/legacy/ecore/src/lib/ecore_fb/Makefile.am b/legacy/ecore/src/lib/ecore_fb/Makefile.am
index a9af6c600f..c2f392239c 100644
--- a/legacy/ecore/src/lib/ecore_fb/Makefile.am
+++ b/legacy/ecore/src/lib/ecore_fb/Makefile.am
@@ -3,6 +3,7 @@ MAINTAINERCLEANFILES = Makefile.in
3AM_CPPFLAGS = \ 3AM_CPPFLAGS = \
4-I$(top_srcdir)/src/lib/ecore \ 4-I$(top_srcdir)/src/lib/ecore \
5-I$(top_builddir)/src/lib/ecore \ 5-I$(top_builddir)/src/lib/ecore \
6-I$(top_srcdir)/src/lib/ecore_input \
6@TSLIB_CFLAGS@ \ 7@TSLIB_CFLAGS@ \
7@EINA_CFLAGS@ 8@EINA_CFLAGS@
8 9
diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
index 77071e3e15..ca7d73d094 100644
--- a/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
+++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
@@ -7,13 +7,6 @@
7 7
8static void _ecore_fb_size_get(int *w, int *h); 8static void _ecore_fb_size_get(int *w, int *h);
9 9
10EAPI int ECORE_FB_EVENT_KEY_DOWN = 0;
11EAPI int ECORE_FB_EVENT_KEY_UP = 0;
12EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = 0;
13EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_UP = 0;
14EAPI int ECORE_FB_EVENT_MOUSE_MOVE = 0;
15EAPI int ECORE_FB_EVENT_MOUSE_WHEEL = 0;
16
17static int _ecore_fb_init_count = 0; 10static int _ecore_fb_init_count = 0;
18static int _ecore_fb_console_w = 0; 11static int _ecore_fb_console_w = 0;
19static int _ecore_fb_console_h = 0; 12static int _ecore_fb_console_h = 0;
@@ -46,12 +39,6 @@ ecore_fb_init(const char *name __UNUSED__)
46 if (!ecore_fb_vt_init()) 39 if (!ecore_fb_vt_init())
47 return --_ecore_fb_init_count; 40 return --_ecore_fb_init_count;
48 41
49 ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new();
50 ECORE_FB_EVENT_KEY_UP = ecore_event_type_new();
51 ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
52 ECORE_FB_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
53 ECORE_FB_EVENT_MOUSE_MOVE = ecore_event_type_new();
54 ECORE_FB_EVENT_MOUSE_WHEEL = ecore_event_type_new();
55 _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h); 42 _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
56 43
57 return _ecore_fb_init_count; 44 return _ecore_fb_init_count;
diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c
index 65e5f61513..570d004029 100644
--- a/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c
+++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb_li.c
@@ -36,30 +36,6 @@ test_bit(int bit, unsigned long *array)
36} 36}
37 37
38static void 38static void
39_ecore_fb_li_event_free_key_down(void *data __UNUSED__, void *ev)
40{
41 Ecore_Fb_Event_Key_Up *e;
42
43 e = ev;
44 free(e->keyname);
45 if (e->keysymbol) free(e->keysymbol);
46 if (e->key_compose) free(e->key_compose);
47 free(e);
48}
49
50static void
51_ecore_fb_li_event_free_key_up(void *data __UNUSED__, void *ev)
52{
53 Ecore_Fb_Event_Key_Up *e;
54
55 e = ev;
56 free(e->keyname);
57 if (e->keysymbol) free(e->keysymbol);
58 if (e->key_compose) free(e->key_compose);
59 free(e);
60}
61
62static void
63_ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *iev) 39_ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *iev)
64{ 40{
65 if (!dev->listen) return; 41 if (!dev->listen) return;
@@ -67,38 +43,28 @@ _ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *ie
67 /* check for basic keyboard keys */ 43 /* check for basic keyboard keys */
68 if ((iev->code >= KEY_ESC) && (iev->code <= KEY_COMPOSE)) 44 if ((iev->code >= KEY_ESC) && (iev->code <= KEY_COMPOSE))
69 { 45 {
46 int offset = 0;
47 char *keyname = strdup(_ecore_fb_li_kbd_syms[iev->code * 6]);
70 /* check the key table */ 48 /* check the key table */
71 if (iev->value) 49 if (iev->value)
72 { 50 {
73 int offset = 0;
74 Ecore_Fb_Event_Key_Down *ev;
75
76 ev = calloc(1, sizeof(Ecore_Fb_Event_Key_Down));
77 if (dev->keyboard.shift) offset = 1;
78 else if (dev->keyboard.lock) offset = 2;
79 ev->keyname = strdup(_ecore_fb_li_kbd_syms[iev->code * 6]);
80
81 ev->keysymbol = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + offset]);
82 ev->key_compose = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset]);
83 ev->dev = dev;
84 ecore_event_add(ECORE_FB_EVENT_KEY_DOWN, ev, _ecore_fb_li_event_free_key_down, NULL);
85 /* its a repeated key, dont increment */ 51 /* its a repeated key, dont increment */
86 if (iev->value == 2) 52 if (iev->value == 2)
87 return; 53 return;
88 if (!strcmp(ev->keyname, "Control_L")) 54 if (!strcmp(keyname, "Control_L"))
89 dev->keyboard.ctrl++; 55 dev->keyboard.ctrl++;
90 else if (!strcmp(ev->keyname, "Control_R")) 56 else if (!strcmp(keyname, "Control_R"))
91 dev->keyboard.ctrl++; 57 dev->keyboard.ctrl++;
92 else if (!strcmp(ev->keyname, "Alt_L")) 58 else if (!strcmp(keyname, "Alt_L"))
93 dev->keyboard.alt++; 59 dev->keyboard.alt++;
94 else if (!strcmp(ev->keyname, "Alt_R")) 60 else if (!strcmp(keyname, "Alt_R"))
95 dev->keyboard.alt++; 61 dev->keyboard.alt++;
96 else if (!strcmp(ev->keyname, "Shift_L")) 62 else if (!strcmp(keyname, "Shift_L"))
97 dev->keyboard.shift++; 63 dev->keyboard.shift++;
98 else if (!strcmp(ev->keyname, "Shift_R")) 64 else if (!strcmp(keyname, "Shift_R"))
99 dev->keyboard.shift++; 65 dev->keyboard.shift++;
100 else if (!strcmp(ev->keyname, "Caps_Lock")) 66 else if (!strcmp(keyname, "Caps_Lock"))
101 dev->keyboard.lock++; 67 dev->keyboard.lock = !dev->keyboard.lock;
102 if (dev->keyboard.ctrl > 2) dev->keyboard.ctrl = 2; 68 if (dev->keyboard.ctrl > 2) dev->keyboard.ctrl = 2;
103 if (dev->keyboard.alt > 2) dev->keyboard.alt = 2; 69 if (dev->keyboard.alt > 2) dev->keyboard.alt = 2;
104 if (dev->keyboard.shift > 2) dev->keyboard.shift = 2; 70 if (dev->keyboard.shift > 2) dev->keyboard.shift = 2;
@@ -106,85 +72,128 @@ _ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *ie
106 } 72 }
107 else 73 else
108 { 74 {
109 int offset = 0; 75 if (!strcmp(keyname, "Control_L"))
110 Ecore_Fb_Event_Key_Up *ev;
111
112 ev = calloc(1, sizeof(Ecore_Fb_Event_Key_Up));
113 if (dev->keyboard.shift) offset = 1;
114 else if (dev->keyboard.lock) offset = 2;
115 ev->keyname = strdup(_ecore_fb_li_kbd_syms[iev->code * 6]);
116
117 ev->keysymbol = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + offset]);
118 ev->key_compose = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset]);
119 ev->dev = dev;
120 ecore_event_add(ECORE_FB_EVENT_KEY_UP, ev, _ecore_fb_li_event_free_key_up, NULL);
121 if (!strcmp(ev->keyname, "Control_L"))
122 dev->keyboard.ctrl--; 76 dev->keyboard.ctrl--;
123 else if (!strcmp(ev->keyname, "Control_R")) 77 else if (!strcmp(keyname, "Control_R"))
124 dev->keyboard.ctrl--; 78 dev->keyboard.ctrl--;
125 else if (!strcmp(ev->keyname, "Alt_L")) 79 else if (!strcmp(keyname, "Alt_L"))
126 dev->keyboard.alt--; 80 dev->keyboard.alt--;
127 else if (!strcmp(ev->keyname, "Alt_R")) 81 else if (!strcmp(keyname, "Alt_R"))
128 dev->keyboard.alt--; 82 dev->keyboard.alt--;
129 else if (!strcmp(ev->keyname, "Shift_L")) 83 else if (!strcmp(keyname, "Shift_L"))
130 dev->keyboard.shift--; 84 dev->keyboard.shift--;
131 else if (!strcmp(ev->keyname, "Shift_R")) 85 else if (!strcmp(keyname, "Shift_R"))
132 dev->keyboard.shift--; 86 dev->keyboard.shift--;
133 else if (!strcmp(ev->keyname, "Caps_Lock"))
134 dev->keyboard.lock--;
135 if (dev->keyboard.ctrl < 0) dev->keyboard.ctrl = 0; 87 if (dev->keyboard.ctrl < 0) dev->keyboard.ctrl = 0;
136 if (dev->keyboard.alt < 0) dev->keyboard.alt = 0; 88 if (dev->keyboard.alt < 0) dev->keyboard.alt = 0;
137 if (dev->keyboard.shift < 0) dev->keyboard.shift = 0; 89 if (dev->keyboard.shift < 0) dev->keyboard.shift = 0;
138 if (dev->keyboard.lock < 0) dev->keyboard.lock = 0; 90 if (dev->keyboard.lock < 0) dev->keyboard.lock = 0;
139 } 91 }
92
93 /* sending ecore_input_evas events */
94 Ecore_Event_Key *e;
95
96 if (dev->keyboard.shift) offset = 1;
97 else if (dev->keyboard.lock) offset = 2;
98
99 char *key = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + offset]);
100 char *compose = strdup(_ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset]);
101
102 e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) +
103 strlen(keyname) + (compose ? strlen(compose) : 0) + 3);
104 e->keyname = (char *)(e + 1);
105 e->key = e->keyname + strlen(keyname) + 1;
106 e->compose = (compose) ? e->key + strlen(key) + 1 : NULL;
107 e->string = e->compose;
108
109 strcpy((char *)e->keyname, keyname);
110 strcpy((char *)e->key, key);
111 if (compose)
112 strcpy((char *)e->compose, compose);
113
114 e->modifiers = 0;
115 if (dev->keyboard.shift)
116 e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
117 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
118 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
119 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
120
121 e->timestamp = ecore_time_get();
122 e->window = (Ecore_Window)dev->window;
123 e->event_window = (Ecore_Window)dev->window;
124 e->root_window = (Ecore_Window)dev->window;
125 e->same_screen = 0;
126
127 if (iev->value)
128 ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
129 else
130 ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL);
140 } 131 }
141 /* check for mouse button events */ 132 /* check for mouse button events */
142 else if ((iev->code >= BTN_MOUSE) && (iev->code < BTN_JOYSTICK)) 133 else if ((iev->code >= BTN_MOUSE) && (iev->code < BTN_JOYSTICK))
143 { 134 {
144 int button; 135 int button;
136 Ecore_Event_Mouse_Button *e;
137 double current = ecore_time_get();
145 138
146 button = ((iev->code & 0x00F) + 1); 139 button = ((iev->code & 0x00F) + 1);
147 if (iev->value) 140 if (iev->value)
148 { 141 {
149 Ecore_Fb_Event_Mouse_Button_Down *ev; 142 dev->mouse.did_double = EINA_FALSE;
150 double current; 143 dev->mouse.did_triple = EINA_FALSE;
151 144
152 ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down)); 145 if (((current - dev->mouse.prev) <= dev->mouse.threshold) &&
153 ev->dev = dev; 146 (button == dev->mouse.prev_button))
154 ev->button = button;
155 ev->x = dev->mouse.x;
156 ev->y = dev->mouse.y;
157
158 current = ecore_time_get();
159 if ((current - dev->mouse.prev) <= dev->mouse.threshold)
160 ev->double_click = 1;
161 if ((current - dev->mouse.last) <= (2 * dev->mouse.threshold))
162 {
163 ev->triple_click = 1;
164 /* reset */
165 dev->mouse.prev = 0;
166 dev->mouse.last = 0;
167 current = 0;
168 }
169 else
170 { 147 {
171 /* update values */ 148 dev->mouse.did_double = EINA_TRUE;
172 dev->mouse.last = dev->mouse.prev; 149 if (((current - dev->mouse.last) <= (2 * dev->mouse.threshold)) &&
173 dev->mouse.prev = current; 150 (button == dev->mouse.last_button))
151 {
152 dev->mouse.did_triple = EINA_TRUE;
153 /* reset */
154 dev->mouse.prev = 0;
155 dev->mouse.last = 0;
156 current = 0;
157 }
174 } 158 }
175 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, ev, NULL ,NULL); 159 dev->mouse.last = dev->mouse.prev;
160 dev->mouse.prev = current;
161 dev->mouse.last_button = dev->mouse.prev_button;
162 dev->mouse.prev_button = button;
176 } 163 }
164
165 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
166 if (!e)
167 return;
168
169 e->timestamp = current;
170 e->window = (Ecore_Window)dev->window;
171 e->event_window = (Ecore_Window)dev->window;
172 e->root_window = (Ecore_Window)dev->window;
173 e->same_screen = 0;
174
175 e->modifiers = 0;
176 if (dev->keyboard.shift)
177 e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
178 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
179 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
180 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
181
182 e->x = dev->mouse.x;
183 e->y = dev->mouse.y;
184 e->root.x = e->x;
185 e->root.y = e->y;
186 e->buttons = button;
187
188 if (dev->mouse.did_double)
189 e->double_click = 1;
190 if (dev->mouse.did_triple)
191 e->triple_click = 1;
192
193 if (iev->value)
194 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
177 else 195 else
178 { 196 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
179 Ecore_Fb_Event_Mouse_Button_Up *ev;
180
181 ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Button_Up));
182 ev->dev = dev;
183 ev->button = button;
184 ev->x = dev->mouse.x;
185 ev->y = dev->mouse.y;
186 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, ev, NULL ,NULL);
187 }
188 } 197 }
189} 198}
190 199
@@ -198,7 +207,7 @@ _ecore_fb_li_device_event_rel(Ecore_Fb_Input_Device *dev, struct input_event *ie
198 case REL_X: 207 case REL_X:
199 case REL_Y: 208 case REL_Y:
200 { 209 {
201 Ecore_Fb_Event_Mouse_Move *ev; 210 Ecore_Event_Mouse_Move *e;
202 if(iev->code == REL_X) 211 if(iev->code == REL_X)
203 { 212 {
204 dev->mouse.x += iev->value; 213 dev->mouse.x += iev->value;
@@ -215,26 +224,64 @@ _ecore_fb_li_device_event_rel(Ecore_Fb_Input_Device *dev, struct input_event *ie
215 else if(dev->mouse.y < 0) 224 else if(dev->mouse.y < 0)
216 dev->mouse.y = 0; 225 dev->mouse.y = 0;
217 } 226 }
218 ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Move));
219 ev->x = dev->mouse.x;
220 ev->y = dev->mouse.y;
221 ev->dev = dev;
222 227
223 ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE,ev,NULL,NULL); 228 e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
229 if (!e)
230 return;
231
232 e->window = (Ecore_Window)dev->window;
233 e->event_window = (Ecore_Window)dev->window;
234 e->root_window = (Ecore_Window)dev->window;
235 e->same_screen = 0;
236
237 e->modifiers = 0;
238 if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
239 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
240 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
241 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
242
243 e->x = dev->mouse.x;
244 e->y = dev->mouse.y;
245 e->root.x = e->x;
246 e->root.y = e->y;
247
248 e->timestamp = ecore_time_get();
249
250 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
251
224 break; 252 break;
225 } 253 }
226 case REL_WHEEL: 254 case REL_WHEEL:
227 case REL_HWHEEL: 255 case REL_HWHEEL:
228 { 256 {
229 Ecore_Fb_Event_Mouse_Wheel *ev; 257 Ecore_Event_Mouse_Wheel *e;
230 ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Wheel)); 258
231 259 e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel));
232 ev->x = dev->mouse.x; 260 if (!e)
233 ev->y = dev->mouse.y; 261 return;
234 if (iev->code == REL_HWHEEL) ev->direction = 1; 262
235 ev->wheel = iev->value; 263 e->x = dev->mouse.x;
236 ev->dev = dev; 264 e->y = dev->mouse.y;
237 ecore_event_add(ECORE_FB_EVENT_MOUSE_WHEEL, ev, NULL, NULL); 265 if (iev->code == REL_HWHEEL) e->direction = 1;
266 e->z = iev->value;
267 e->root.x = dev->mouse.x;
268 e->root.y = dev->mouse.y;
269
270 e->window = (Ecore_Window)dev->window;
271 e->event_window = (Ecore_Window)dev->window;
272 e->root_window = (Ecore_Window)dev->window;
273 e->same_screen = 0;
274
275 e->modifiers = 0;
276 if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
277 if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
278 if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
279 if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS;
280
281 e->timestamp = ecore_time_get();
282
283 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL);
284
238 break; 285 break;
239 } 286 }
240 default: 287 default:
@@ -260,7 +307,7 @@ _ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *ie
260 if (tmp < 0) dev->mouse.x = 0; 307 if (tmp < 0) dev->mouse.x = 0;
261 else if (tmp > dev->mouse.w) dev->mouse.x = dev->mouse.w; 308 else if (tmp > dev->mouse.w) dev->mouse.x = dev->mouse.w;
262 else dev->mouse.x = tmp; 309 else dev->mouse.x = tmp;
263 dev->mouse.event = ECORE_FB_EVENT_MOUSE_MOVE; 310 dev->mouse.event = ECORE_EVENT_MOUSE_MOVE;
264 } 311 }
265 break; 312 break;
266 313
@@ -273,7 +320,7 @@ _ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *ie
273 if (tmp < 0) dev->mouse.y = 0; 320 if (tmp < 0) dev->mouse.y = 0;
274 else if (tmp > dev->mouse.h) dev->mouse.y = dev->mouse.h; 321 else if (tmp > dev->mouse.h) dev->mouse.y = dev->mouse.h;
275 else dev->mouse.y = tmp; 322 else dev->mouse.y = tmp;
276 dev->mouse.event = ECORE_FB_EVENT_MOUSE_MOVE; 323 dev->mouse.event = ECORE_EVENT_MOUSE_MOVE;
277 } 324 }
278 break; 325 break;
279 326
@@ -281,13 +328,13 @@ _ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *ie
281 pressure = iev->value; 328 pressure = iev->value;
282 if ((pressure) && (!prev_pressure)) 329 if ((pressure) && (!prev_pressure))
283 { 330 {
284 /* DOWN: mouse is down, but was not now */ 331 /* DOWN: mouse is down, but was not before */
285 dev->mouse.event = ECORE_FB_EVENT_MOUSE_BUTTON_DOWN; 332 dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_DOWN;
286 } 333 }
287 else if ((!pressure) && (prev_pressure)) 334 else if ((!pressure) && (prev_pressure))
288 { 335 {
289 /* UP: mouse was down, but is not now */ 336 /* UP: mouse was down, but is not now */
290 dev->mouse.event = ECORE_FB_EVENT_MOUSE_BUTTON_UP; 337 dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_UP;
291 } 338 }
292 prev_pressure = pressure; 339 prev_pressure = pressure;
293 break; 340 break;
@@ -299,32 +346,39 @@ _ecore_fb_li_device_event_syn(Ecore_Fb_Input_Device *dev, struct input_event *ie
299{ 346{
300 if (!dev->listen) return; 347 if (!dev->listen) return;
301 348
302 if (dev->mouse.event == ECORE_FB_EVENT_MOUSE_MOVE) 349 if (dev->mouse.event == ECORE_EVENT_MOUSE_MOVE)
303 { 350 {
304 Ecore_Fb_Event_Mouse_Move *ev; 351 Ecore_Event_Mouse_Move *ev;
305 ev = calloc(1,sizeof(Ecore_Fb_Event_Mouse_Move)); 352 ev = calloc(1,sizeof(Ecore_Event_Mouse_Move));
306 ev->x = dev->mouse.x; 353 ev->x = dev->mouse.x;
307 ev->y = dev->mouse.y; 354 ev->y = dev->mouse.y;
308 ev->dev = dev; 355 ev->root.x = ev->x;
309 ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, ev, NULL, NULL); 356 ev->root.y = ev->y;
357 ev->timestamp = ecore_time_get();
310 } 358 }
311 else if (dev->mouse.event == ECORE_FB_EVENT_MOUSE_BUTTON_DOWN) 359 else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_DOWN)
312 { 360 {
313 Ecore_Fb_Event_Mouse_Button_Down *ev; 361 Ecore_Event_Mouse_Button *ev;
314 ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down)); 362 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
315 ev->x = dev->mouse.x; 363 ev->x = dev->mouse.x;
316 ev->y = dev->mouse.y; 364 ev->y = dev->mouse.y;
317 ev->button = 1; 365 ev->root.x = ev->x;
318 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); 366 ev->root.y = ev->y;
367 ev->buttons = 1;
368 ev->timestamp = ecore_time_get();
369 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL);
319 } 370 }
320 else if (dev->mouse.event == ECORE_FB_EVENT_MOUSE_BUTTON_UP) 371 else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_UP)
321 { 372 {
322 Ecore_Fb_Event_Mouse_Button_Up *ev; 373 Ecore_Event_Mouse_Button *ev;
323 ev = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up)); 374 ev = calloc(1, sizeof(Ecore_Event_Mouse_Button));
324 ev->x = dev->mouse.x; 375 ev->x = dev->mouse.x;
325 ev->y = dev->mouse.y; 376 ev->y = dev->mouse.y;
326 ev->button = 1; 377 ev->root.x = ev->x;
327 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); 378 ev->root.y = ev->y;
379 ev->buttons = 1;
380 ev->timestamp = ecore_time_get();
381 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
328 } 382 }
329} 383}
330 384
@@ -339,7 +393,6 @@ _ecore_fb_li_device_fd_callback(void *data, Ecore_Fd_Handler *fdh __UNUSED__)
339 dev = (Ecore_Fb_Input_Device*)data; 393 dev = (Ecore_Fb_Input_Device*)data;
340 /* read up to 64 events at once */ 394 /* read up to 64 events at once */
341 len = read(dev->fd, &ev, sizeof(ev)); 395 len = read(dev->fd, &ev, sizeof(ev));
342 // printf("[ecore_fb_li_device:fd_callback] received %d data\n", len);
343 for(i = 0; i < (int)(len / sizeof(ev[0])); i++) 396 for(i = 0; i < (int)(len / sizeof(ev[0])); i++)
344 { 397 {
345 switch(ev[i].type) 398 switch(ev[i].type)
@@ -408,7 +461,7 @@ ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen)
408 * object for it, or returns @c NULL on failure. 461 * object for it, or returns @c NULL on failure.
409 */ 462 */
410EAPI Ecore_Fb_Input_Device * 463EAPI Ecore_Fb_Input_Device *
411ecore_fb_input_device_open(const char *dev) 464ecore_fb_input_device_open(void *ee, const char *dev)
412{ 465{
413 Ecore_Fb_Input_Device *device; 466 Ecore_Fb_Input_Device *device;
414 unsigned long event_type_bitmask[EV_CNT / 32 + 1]; 467 unsigned long event_type_bitmask[EV_CNT / 32 + 1];
@@ -471,6 +524,8 @@ ecore_fb_input_device_open(const char *dev)
471 break; 524 break;
472 } 525 }
473 } 526 }
527
528 device->window = ee;
474 _ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device); 529 _ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device);
475 return device; 530 return device;
476 531
diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb_private.h b/legacy/ecore/src/lib/ecore_fb/ecore_fb_private.h
index 0b51bc78ef..e9542897d0 100644
--- a/legacy/ecore/src/lib/ecore_fb/ecore_fb_private.h
+++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb_private.h
@@ -3,6 +3,7 @@
3 3
4#include "Ecore.h" 4#include "Ecore.h"
5#include "ecore_private.h" 5#include "ecore_private.h"
6#include "Ecore_Input.h"
6 7
7#include <stdio.h> 8#include <stdio.h>
8#include <string.h> 9#include <string.h>
@@ -49,10 +50,14 @@ struct _Ecore_Fb_Input_Device
49 double last; 50 double last;
50 double prev; 51 double prev;
51 double threshold; 52 double threshold;
53 Eina_Bool did_double;
54 Eina_Bool did_triple;
52 /* absolute axis */ 55 /* absolute axis */
53 int min_w, min_h; 56 int min_w, min_h;
54 double rel_w, rel_h; 57 double rel_w, rel_h;
55 int event; 58 int event;
59 int prev_button;
60 int last_button;
56 } mouse; 61 } mouse;
57 struct 62 struct
58 { 63 {
@@ -61,6 +66,7 @@ struct _Ecore_Fb_Input_Device
61 int alt; 66 int alt;
62 int lock; 67 int lock;
63 } keyboard; 68 } keyboard;
69 void *window;
64}; 70};
65 71
66/* ecore_fb_ts.c */ 72/* ecore_fb_ts.c */
diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c
index 33b2d8c70d..09c1cc45aa 100644
--- a/legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c
+++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb_ts.c
@@ -251,24 +251,26 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN
251 if ((pressure) || (prev_pressure)) 251 if ((pressure) || (prev_pressure))
252 { 252 {
253 /* MOVE: mouse is down and was */ 253 /* MOVE: mouse is down and was */
254 Ecore_Fb_Event_Mouse_Move *e; 254 Ecore_Event_Mouse_Move *e;
255 255
256 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Move)); 256 e = calloc(1, sizeof(Ecore_Event_Mouse_Move));
257 if (!e) goto retry; 257 if (!e) goto retry;
258 e->x = x; 258 e->x = x;
259 e->y = y; 259 e->y = y;
260 ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, e, NULL, NULL); 260 e->root.x = x;
261 e->root.y = y;
262 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
261 } 263 }
262 if ((pressure) && (!prev_pressure)) 264 if ((pressure) && (!prev_pressure))
263 { 265 {
264 /* DOWN: mouse is down, but was not now */ 266 /* DOWN: mouse is down, but was not now */
265 Ecore_Fb_Event_Mouse_Button_Down *e; 267 Ecore_Event_Mouse_Button *e;
266 268
267 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down)); 269 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
268 if (!e) goto retry; 270 if (!e) goto retry;
269 e->x = x; 271 e->x = x;
270 e->y = y; 272 e->y = y;
271 e->button = 1; 273 e->buttons = 1;
272 if ((t - last_time) <= _ecore_fb_double_click_time) 274 if ((t - last_time) <= _ecore_fb_double_click_time)
273 { 275 {
274 e->double_click = 1; 276 e->double_click = 1;
@@ -288,23 +290,23 @@ _ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UN
288 { 290 {
289 did_triple = 0; 291 did_triple = 0;
290 } 292 }
291 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); 293 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
292 } 294 }
293 else if ((!pressure) && (prev_pressure)) 295 else if ((!pressure) && (prev_pressure))
294 { 296 {
295 /* UP: mouse was down, but is not now */ 297 /* UP: mouse was down, but is not now */
296 Ecore_Fb_Event_Mouse_Button_Up *e; 298 Ecore_Event_Mouse_Button *e;
297 299
298 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up)); 300 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
299 if (!e) goto retry; 301 if (!e) goto retry;
300 e->x = prev_x; 302 e->x = prev_x;
301 e->y = prev_y; 303 e->y = prev_y;
302 e->button = 1; 304 e->buttons = 1;
303 if (did_double) 305 if (did_double)
304 e->double_click = 1; 306 e->double_click = 1;
305 if (did_triple) 307 if (did_triple)
306 e->triple_click = 1; 308 e->triple_click = 1;
307 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); 309 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
308 } 310 }
309 if (did_triple) 311 if (did_triple)
310 { 312 {
diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb_vt.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb_vt.c
index 20c3f18e5f..5fdb21c97b 100644
--- a/legacy/ecore/src/lib/ecore_fb/ecore_fb_vt.c
+++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb_vt.c
@@ -300,9 +300,9 @@ _ecore_fb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, v
300 300
301 filter_data = loop_data; 301 filter_data = loop_data;
302 if (!filter_data) return EINA_TRUE; 302 if (!filter_data) return EINA_TRUE;
303 if (type == ECORE_FB_EVENT_MOUSE_MOVE) 303 if (type == ECORE_EVENT_MOUSE_MOVE)
304 { 304 {
305 if ((filter_data->last_event_type) == ECORE_FB_EVENT_MOUSE_MOVE) 305 if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE)
306 { 306 {
307 filter_data->last_event_type = type; 307 filter_data->last_event_type = type;
308 return EINA_FALSE; 308 return EINA_FALSE;