summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-04 20:44:19 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2013-01-04 20:44:19 +0000
commit7abf31c88264c2a7692ce61c7985bc49e979163e (patch)
tree18a1ab5303d3656fa701fb15ce73670b99d7b295
parent06c3306d3c8ca75a591dcd5555b758263b220a74 (diff)
efl/ecore_fb: remove deprecated files.
SVN revision: 82240
-rw-r--r--src/lib/ecore_fb/ecore_fb_kbd.c326
-rw-r--r--src/lib/ecore_fb/ecore_fb_ps2.c224
2 files changed, 0 insertions, 550 deletions
diff --git a/src/lib/ecore_fb/ecore_fb_kbd.c b/src/lib/ecore_fb/ecore_fb_kbd.c
deleted file mode 100644
index fd111db..0000000
--- a/src/lib/ecore_fb/ecore_fb_kbd.c
+++ /dev/null
@@ -1,326 +0,0 @@
1static void _ecore_fb_event_free_key_down(void *data, void *ev);
2static void _ecore_fb_event_free_key_up(void *data, void *ev);
3
4static const char *_ecore_fb_kbd_syms[128 * 7] =
5{
6#include "ecore_fb_keytable.h"
7};
8
9static const char *_ecore_fb_btn_syms[128] =
10{
11 "0x00",
12 "Escape",
13 "F1",
14 "F2",
15 "F3",
16 "F4",
17 "Up",
18 "Right",
19 "Left",
20 "Down",
21 "Return",
22 "0x1b",
23 "0x1c",
24 "0x1d",
25 "0x1e",
26 "0x1f",
27 "0x20",
28 "0x21",
29 "0x22",
30 "0x23",
31 "0x24",
32 "0x25",
33 "0x26",
34 "0x27",
35 "0x28",
36 "0x29",
37 "0x2a",
38 "0x2b",
39 "0x2c",
40 "0x2d",
41 "0x2e",
42 "0x2f",
43 "0x30",
44 "0x31",
45 "0x32",
46 "0x33",
47 "0x34",
48 "0x35",
49 "0x36",
50 "0x37",
51 "0x38",
52 "0x39",
53 "0x3a",
54 "0x3b",
55 "0x3c",
56 "0x3d",
57 "0x3e",
58 "0x3f",
59 "0x40",
60 "0x41",
61 "0x42",
62 "0x43",
63 "0x44",
64 "0x45",
65 "0x46",
66 "0x47",
67 "0x48",
68 "0x49",
69 "0x4a",
70 "0x4b",
71 "0x4c",
72 "0x4d",
73 "0x4e",
74 "0x4f",
75 "0x50",
76 "0x51",
77 "0x52",
78 "0x53",
79 "0x54",
80 "0x55",
81 "0x56",
82 "0x57",
83 "0x58",
84 "0x59",
85 "0x5a",
86 "0x5b",
87 "0x5c",
88 "0x5d",
89 "0x5e",
90 "0x5f",
91 "0x60",
92 "0x61",
93 "0x62",
94 "0x63",
95 "0x64",
96 "0x65",
97 "0x66",
98 "0x67",
99 "0x68",
100 "0x69",
101 "0x6a",
102 "0x6b",
103 "0x6c",
104 "0x6d",
105 "0x6e",
106 "0x6f",
107 "0x70",
108 "0x71",
109 "0x72",
110 "0x73",
111 "0x74",
112 "0x75",
113 "0x76",
114 "0x77",
115 "0x78",
116 "0x79",
117 "0x7a",
118 "0x7b",
119 "0x7c",
120 "0x7d",
121 "0x7e",
122 "0x7f"
123};
124static int _ecore_fb_kbd_fd = -1;
125static int _ecore_fb_ctrl = 0;
126static int _ecore_fb_alt = 0;
127static int _ecore_fb_shift = 0;
128static int _ecore_fb_lock = 0;
129
130static Ecore_Fd_Handler *_ecore_fb_kbd_fd_handler_handle = NULL;
131static Eina_Bool _ecore_fb_kbd_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
132
133static void
134_ecore_fb_event_free_key_down(void *data EINA_UNUSED, void *ev)
135{
136 Ecore_Fb_Event_Key_Down *e;
137 e = ev;
138 free(e->keyname);
139 if (e->keysymbol) free(e->keysymbol);
140 if (e->key_compose) free(e->key_compose);
141 free(e);
142}
143
144static void
145_ecore_fb_event_free_key_up(void *data EINA_UNUSED, void *ev)
146{
147 Ecore_Fb_Event_Key_Up *e;
148
149 e = ev;
150 free(e->keyname);
151 if (e->keysymbol) free(e->keysymbol);
152 if (e->key_compose) free(e->key_compose);
153 free(e);
154}
155
156static Eina_Bool
157_ecore_fb_kbd_fd_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler EINA_UNUSED)
158{
159 int v = 0;
160
161 do
162 {
163 unsigned char buf;
164
165 v = read(_ecore_fb_kbd_fd, &buf, 1);
166 if (v < 0) return EINA_TRUE;
167 if (v < 1) return EINA_TRUE;
168 if (!(buf & 0x80))
169 {
170 /* DOWN */
171 int vt_switch = -1;
172 Ecore_Fb_Event_Key_Down *e;
173
174 e = calloc(1, sizeof(Ecore_Fb_Event_Key_Down));
175 if (!e) goto retry;
176 if (_ecore_fb_kbd_fd == _ecore_fb_tty_fd)
177 {
178 int add = 0;
179
180 if (_ecore_fb_shift) add = 1;
181 else if (_ecore_fb_lock) add = 2;
182 e->keyname = strdup(_ecore_fb_kbd_syms[(buf & 0x7f) * 7]);
183 e->keysymbol = strdup(_ecore_fb_kbd_syms[((buf & 0x7f) * 7) + add]);
184 e->key_compose = strdup(_ecore_fb_kbd_syms[((buf & 0x7f) * 7) + 3 + add]);
185 }
186 else
187 e->keyname = strdup(_ecore_fb_btn_syms[buf & 0x7f]);
188 if (!e->keyname)
189 {
190 free(e);
191 goto retry;
192 }
193 e->window = 1;
194 e->event_window = e->window;
195 e->root_window = e->window;
196 e->same_screen = 1;
197 e->timestamp = ecore_loop_time_get() * 1000.0;
198 if (!strcmp(e->keyname, "Control_L"))
199 _ecore_fb_ctrl++;
200 else if (!strcmp(e->keyname, "Control_R"))
201 _ecore_fb_ctrl++;
202 else if (!strcmp(e->keyname, "Alt_L"))
203 _ecore_fb_alt++;
204 else if (!strcmp(e->keyname, "Alt_R"))
205 _ecore_fb_alt++;
206 else if (!strcmp(e->keyname, "Shift_L"))
207 _ecore_fb_shift++;
208 else if (!strcmp(e->keyname, "Shift_R"))
209 _ecore_fb_shift++;
210 else if (!strcmp(e->keyname, "Caps_Lock"))
211 _ecore_fb_lock++;
212 else if (!strcmp(e->keyname, "F1")) vt_switch = 0;
213 else if (!strcmp(e->keyname, "F2")) vt_switch = 1;
214 else if (!strcmp(e->keyname, "F3")) vt_switch = 2;
215 else if (!strcmp(e->keyname, "F4")) vt_switch = 3;
216 else if (!strcmp(e->keyname, "F5")) vt_switch = 4;
217 else if (!strcmp(e->keyname, "F6")) vt_switch = 5;
218 else if (!strcmp(e->keyname, "F7")) vt_switch = 6;
219 else if (!strcmp(e->keyname, "F8")) vt_switch = 7;
220 else if (!strcmp(e->keyname, "F9")) vt_switch = 8;
221 else if (!strcmp(e->keyname, "F10")) vt_switch = 9;
222 else if (!strcmp(e->keyname, "F11")) vt_switch = 10;
223 else if (!strcmp(e->keyname, "F12")) vt_switch = 11;
224 if (_ecore_fb_ctrl > 2) _ecore_fb_ctrl = 2;
225 if (_ecore_fb_alt > 2) _ecore_fb_alt = 2;
226 if ((_ecore_fb_kbd_fd == _ecore_fb_tty_fd) &&
227 (_ecore_fb_ctrl))
228 {
229 const char *ts = _ecore_fb_kbd_syms[(buf & 0x7f) + 3 + 3];
230
231 if (ts)
232 {
233 if (e->key_compose) free(e->key_compose);
234 e->key_compose = strdup(ts);
235 }
236 }
237 if ((vt_switch >= 0) &&
238 (_ecore_fb_ctrl) &&
239 (_ecore_fb_alt))
240 _ecore_fb_vt_switch(vt_switch);
241 ecore_event_add(ECORE_FB_EVENT_KEY_DOWN, e, _ecore_fb_event_free_key_down, NULL);
242 }
243 else
244 {
245 /* UP */
246 Ecore_Fb_Event_Key_Up *e;
247
248 e = calloc(1, sizeof(Ecore_Fb_Event_Key_Up));
249 if (!e) goto retry;
250 if (_ecore_fb_kbd_fd == _ecore_fb_tty_fd)
251 {
252 int add = 0;
253
254 if (_ecore_fb_shift) add = 1;
255 else if (_ecore_fb_lock) add = 2;
256 e->keyname = strdup(_ecore_fb_kbd_syms[(buf & 0x7f) * 7]);
257 e->keysymbol = strdup(_ecore_fb_kbd_syms[((buf & 0x7f) * 7) + add]);
258 e->key_compose = strdup(_ecore_fb_kbd_syms[((buf & 0x7f) * 7) + 3 + add]);
259 }
260 else
261 e->keyname = strdup(_ecore_fb_btn_syms[buf & 0x7f]);
262 if (!e->keyname)
263 {
264 free(e);
265 goto retry;
266 }
267 e->window = 1;
268 e->event_window = e->window;
269 e->root_window = e->window;
270 e->same_screen = 1;
271 e->timestamp = ecore_loop_time_get() * 1000.0;
272 ecore_event_add(ECORE_FB_EVENT_KEY_UP, e, _ecore_fb_event_free_key_up, NULL);
273 if (!strcmp(e->keyname, "Control_L"))
274 _ecore_fb_ctrl--;
275 else if (!strcmp(e->keyname, "Control_R"))
276 _ecore_fb_ctrl--;
277 else if (!strcmp(e->keyname, "Alt_L"))
278 _ecore_fb_alt--;
279 else if (!strcmp(e->keyname, "Alt_R"))
280 _ecore_fb_alt--;
281 else if (!strcmp(e->keyname, "Shift_L"))
282 _ecore_fb_shift--;
283 else if (!strcmp(e->keyname, "Shift_R"))
284 _ecore_fb_shift--;
285 else if (!strcmp(e->keyname, "Caps_Lock"))
286 _ecore_fb_lock--;
287 if (_ecore_fb_ctrl < 0) _ecore_fb_ctrl = 0;
288 if (_ecore_fb_alt < 0) _ecore_fb_alt = 0;
289 if (_ecore_fb_shift < 0) _ecore_fb_shift = 0;
290 if (_ecore_fb_lock < 0) _ecore_fb_lock = 0;
291 }
292retry:
293 ;
294 }
295 while (v > 0);
296 return EINA_TRUE;
297}
298
299int
300ecore_fb_kbd_init(void)
301{
302 int prev_flags;
303
304 prev_flags = fcntl(_ecore_fb_kbd_fd, F_GETFL);
305 fcntl(_ecore_fb_kbd_fd, F_SETFL, prev_flags | O_NONBLOCK);
306 _ecore_fb_kbd_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_kbd_fd,
307 ECORE_FD_READ,
308 _ecore_fb_kbd_fd_handler, NULL,
309 NULL, NULL);
310 if(!_ecore_fb_kbd_fd_handler_handle) return 0;
311 return 1;
312}
313
314void
315ecore_fb_kbd_shutdown(void)
316{
317 if (_ecore_fb_kbd_fd_handler_handle)
318 ecore_main_fd_handler_del(_ecore_fb_kbd_fd_handler_handle);
319 if (_ecore_fb_kbd_fd >= 0) close(_ecore_fb_kbd_fd);
320 _ecore_fb_kbd_fd = -1;
321 _ecore_fb_kbd_fd_handler_handle = NULL;
322 _ecore_fb_ctrl = 0;
323 _ecore_fb_lock = 0;
324 _ecore_fb_shift = 0;
325 _ecore_fb_alt = 0;
326}
diff --git a/src/lib/ecore_fb/ecore_fb_ps2.c b/src/lib/ecore_fb/ecore_fb_ps2.c
deleted file mode 100644
index 7931ef7..0000000
--- a/src/lib/ecore_fb/ecore_fb_ps2.c
+++ /dev/null
@@ -1,224 +0,0 @@
1typedef struct _Ecore_Fb_Ps2_Event Ecore_Fb_Ps2_Event;
2struct _Ecore_Fb_Ps2_Event
3{
4 unsigned char button;
5 unsigned char x;
6 unsigned char y;
7 unsigned char z;
8};
9
10static int _ecore_fb_ps2_event_byte_count = 0;
11static Ecore_Fb_Ps2_Event _ecore_fb_ps2_event;
12static int _ecore_fb_ps2_fd = 0;
13static Eina_Bool _ecore_fb_ps2_fd_handler(void *data, Ecore_Fd_Handler *fd_handler);
14
15int
16ecore_fb_ps2_init(void)
17{
18 _ecore_fb_ps2_fd = open("/dev/psaux", O_RDWR);
19 if (_ecore_fb_ps2_fd >= 0)
20 {
21 prev_flags = fcntl(_ecore_fb_ps2_fd, F_GETFL);
22 fcntl(_ecore_fb_ps2_fd, F_SETFL, prev_flags | O_NONBLOCK);
23 _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ps2_fd,
24 ECORE_FD_READ,
25 _ecore_fb_ps2_fd_handler, NULL, NULL, NULL);
26 if (!_ecore_fb_ts_fd_handler_handle)
27 {
28 close(_ecore_fb_ps2_fd);
29 return 0;
30 }
31 return 1;
32 }
33 return 0;
34}
35
36void
37ecore_fb_ps2_shutdown(void)
38{
39 if (_ecore_fb_ps2_fd > 0) close(_ecore_fb_ps2_fd);
40 _ecore_fb_ps2_fd = 0;
41}
42
43static Eina_Bool
44_ecore_fb_ps2_fd_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fd_handler EINA_UNUSED)
45{
46 static int prev_x = 0, prev_y = 0, prev_button = 0;
47 static double last_time = 0;
48 static double last_last_time = 0;
49 int v = 0;
50
51 do
52 {
53 int x, y, button, i;
54 int num;
55 char *ptr;
56 double t;
57 static int did_double = 0;
58 static int did_triple = 0;
59
60 ptr = (char *)&(_ecore_fb_ps2_event);
61 ptr += _ecore_fb_ps2_event_byte_count;
62 num = sizeof(Ecore_Fb_Ps2_Event) - _ecore_fb_ps2_event_byte_count;
63 v = read(_ecore_fb_ps2_fd, ptr, num);
64 if (v < 0) return EINA_TRUE;
65 _ecore_fb_ps2_event_byte_count += v;
66 if (v < num) return EINA_TRUE;
67 t = ecore_loop_time_get();
68 _ecore_fb_ps2_event_byte_count = 0;
69 if (_ecore_fb_ps2_event.button & 0x10)
70 x = prev_x + (0xffffff00 | _ecore_fb_ps2_event.x);
71 else
72 x = prev_x + _ecore_fb_ps2_event.x;
73 if (_ecore_fb_ps2_event.button & 0x20)
74 y = prev_y - (0xffffff00 | _ecore_fb_ps2_event.y);
75 else
76 y = prev_y - _ecore_fb_ps2_event.y;
77 button = _ecore_fb_ps2_event.button & 0x7;
78 if (x < 0) x = 0;
79 if (y < 0) y = 0;
80 if (x >= _ecore_fb_console_w) x = _ecore_fb_console_w - 1;
81 if (y >= _ecore_fb_console_h) y = _ecore_fb_console_h - 1;
82 /* add event to queue */
83 /* always add a move event */
84 if (1)
85 {
86 /* MOVE: mouse is down and was */
87 Ecore_Event_Mouse_Move *e;
88
89 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Move));
90 if (!e) goto retry;
91 e->x = x;
92 e->y = y;
93 e->root.x = e->x;
94 e->root.y = e->y;
95 e->window = 1;
96 e->event_window = e->window;
97 e->root_window = e->window;
98 e->same_screen = 1;
99 e->timestamp = ecore_loop_time_get() * 1000.0;
100 ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL);
101 }
102 for (i = 1; i <= 3; i++)
103 {
104 int mask;
105
106 mask = 1 << (i - 1);
107 if (((button & mask)) && (!(prev_button & mask)))
108 {
109 /* DOWN: mouse is down, but was not now */
110 Ecore_Event_Mouse_Button *e;
111
112 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
113 if (!e) goto retry;
114 e->x = x;
115 e->y = y;
116 e->root.x = e->x;
117 e->root.y = e->y;
118 e->button = i;
119 e->window = 1;
120 e->event_window = e->window;
121 e->root_window = e->window;
122 e->same_screen = 1;
123 if ((t - last_time) <= _ecore_fb_double_click_time)
124 {
125 e->double_click = 1;
126 did_double = 1;
127 }
128 else
129 {
130 did_double = 0;
131 did_triple = 0;
132 }
133 if ((t - last_last_time) <= (2 * _ecore_fb_double_click_time))
134 {
135 did_triple = 1;
136 e->triple_click = 1;
137 }
138 else
139 {
140 did_triple = 0;
141 }
142 e->timestamp = ecore_loop_time_get() * 1000.0;
143 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
144 }
145 else if ((!(button & mask)) && ((prev_button & mask)))
146 {
147 /* UP: mouse was down, but is not now */
148 Ecore_Event_Mouse_Button *e;
149
150 e = calloc(1, sizeof(Ecore_Event_Mouse_Button));
151 if (!e) goto retry;
152 e->x = x;
153 e->y = y;
154 e->root.x = e->x;
155 e->root.y = e->y;
156 e->button = i;
157 e->window = 1;
158 e->event_window = e->window;
159 e->root_window = e->window;
160 e->same_screen = 1;
161 if (did_double)
162 e->double_click = 1;
163 if (did_triple)
164 e->triple_click = 1;
165 e->timestamp = ecore_loop_time_get() * 1000.0;
166 ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
167 }
168 }
169 if (did_triple)
170 {
171 last_time = 0;
172 last_last_time = 0;
173 }
174 else
175 {
176 last_last_time = last_time;
177 last_time = t;
178 }
179 retry:
180 prev_x = x;
181 prev_y = y;
182 prev_button = button;
183 }
184 while (v > 0);
185 return EINA_TRUE;
186}
187/**
188 * @defgroup Ecore_FB_Click_Group Framebuffer Double Click Functions
189 * @ingroup Ecore_FB_Group
190 *
191 * Functions that deal with the double click time of the framebuffer.
192 */
193
194/**
195 * Sets the timeout for a double and triple clicks to be flagged.
196 *
197 * This sets the time between clicks before the double_click flag is
198 * set in a button down event. If 3 clicks occur within double this
199 * time, the triple_click flag is also set.
200 *
201 * @param t The time in seconds
202 * @ingroup Ecore_FB_Click_Group
203 */
204EAPI void
205ecore_fb_double_click_time_set(double t)
206{
207 if (t < 0.0) t = 0.0;
208 _ecore_fb_double_click_time = t;
209}
210
211/**
212 * Retrieves the double and triple click flag timeout.
213 *
214 * See @ref ecore_x_double_click_time_set for more information.
215 *
216 * @return The timeout for double clicks in seconds.
217 * @ingroup Ecore_FB_Click_Group
218 */
219EAPI double
220ecore_fb_double_click_time_get(void)
221{
222 return _ecore_fb_double_click_time;
223}
224