summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_fb
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
7 files changed, 214 insertions, 252 deletions
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;