summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2003-09-23 08:09:32 +0000
committerCarsten Haitzler <raster@rasterman.com>2003-09-23 08:09:32 +0000
commita5c2425084f670998654b7cf002d961dce963e82 (patch)
tree26bb48a4db414be854a6028c43364c23a02b4d3b /legacy/ecore/src/lib/ecore_fb/ecore_fb.c
parentcddaadb4477f3cc1b36d4f4fe68ba1f6abfa8a3d (diff)
damn you salizar! damn you!
errr. i mean. ecore moves to HEAD! SVN revision: 7475
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore_fb/ecore_fb.c1330
1 files changed, 1330 insertions, 0 deletions
diff --git a/legacy/ecore/src/lib/ecore_fb/ecore_fb.c b/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
new file mode 100644
index 0000000000..3ff841a017
--- /dev/null
+++ b/legacy/ecore/src/lib/ecore_fb/ecore_fb.c
@@ -0,0 +1,1330 @@
1
2#include "Ecore.h"
3#include "ecore_fb_private.h"
4#include "Ecore_Fb.h"
5#include "ecore_private.h"
6
7#include <fcntl.h>
8#include <unistd.h>
9#include <stdio.h>
10#include <stdlib.h>
11#include <termios.h>
12#include <sys/types.h>
13#include <sys/stat.h>
14#include <sys/ioctl.h>
15#include <linux/kd.h>
16#include <linux/vt.h>
17#include <linux/fb.h>
18#include <sys/ioctl.h>
19#include <signal.h>
20
21typedef struct _Ecore_Fb_Ts_Event Ecore_Fb_Ts_Event;
22typedef struct _Ecore_Fb_Ts_Calibrate Ecore_Fb_Ts_Calibrate;
23typedef struct _Ecore_Fb_Ts_Backlight Ecore_Fb_Ts_Backlight;
24typedef struct _Ecore_Fb_Ts_Contrast Ecore_Fb_Ts_Contrast;
25typedef struct _Ecore_Fb_Ts_Led Ecore_Fb_Ts_Led;
26typedef struct _Ecore_Fb_Ts_Flite Ecore_Fb_Ts_Flite;
27typedef struct _Ecore_Fb_Ps2_Event Ecore_Fb_Ps2_Event;
28
29struct _Ecore_Fb_Ts_Event
30{
31 unsigned short pressure;
32 unsigned short x;
33 unsigned short y;
34 unsigned short _unused;
35};
36
37struct _Ecore_Fb_Ts_Calibrate
38{
39 int xscale;
40 int xtrans;
41 int yscale;
42 int ytrans;
43 int xyswap;
44};
45
46struct _Ecore_Fb_Ts_Backlight
47{
48 int on;
49 unsigned char brightness;
50};
51
52struct _Ecore_Fb_Ts_Contrast
53{
54 unsigned char contrast;
55};
56
57struct _Ecore_Fb_Ts_Led
58{
59 unsigned char on;
60 unsigned char blink_time;
61 unsigned char on_time;
62 unsigned char off_time;
63};
64
65struct _Ecore_Fb_Ts_Flite
66{
67 unsigned char mode;
68 unsigned char pwr;
69 unsigned char brightness;
70};
71
72struct _Ecore_Fb_Ps2_Event
73{
74 unsigned char button;
75 unsigned char x;
76 unsigned char y;
77 unsigned char z;
78};
79
80static void _ecore_fb_size_get(int *w, int *h);
81static int _ecore_fb_ts_fd_handler(Ecore_Fd_Handler *fd_handler, void *data);
82static int _ecore_fb_kbd_fd_handler(Ecore_Fd_Handler *fd_handler, void *data);
83static int _ecore_fb_ps2_fd_handler(Ecore_Fd_Handler *fd_handler, void *data);
84static void _ecore_fb_event_free_key_down(void *data, void *ev);
85static void _ecore_fb_event_free_key_up(void *data, void *ev);
86static void _ecore_fb_event_free_generic(void *data, void *ev);
87static int _ecore_fb_signal_usr_handler(void *data, int type, void *ev);
88static void _ecore_fb_vt_switch(int vt);
89
90int ECORE_FB_EVENT_KEY_DOWN = 0;
91int ECORE_FB_EVENT_KEY_UP = 0;
92int ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = 0;
93int ECORE_FB_EVENT_MOUSE_BUTTON_UP = 0;
94int ECORE_FB_EVENT_MOUSE_MOVE = 0;
95
96static Ecore_Event_Handler *_ecore_fb_user_handler = NULL;
97static Ecore_Event_Filter *_ecore_fb_filter_handler = NULL;
98static Ecore_Fd_Handler *_ecore_fb_ts_fd_handler_handle = NULL;
99static Ecore_Fd_Handler *_ecore_fb_kbd_fd_handler_handle = NULL;
100static int _ecore_fb_init_count = 0;
101static int _ecore_fb_ts_fd = 0;
102static int _ecore_fb_ps2_fd = 0;
103static int _ecore_fb_kbd_fd = 0;
104static int _ecore_fb_tty_fd = 0;
105static int _ecore_fb_console_w = 0;
106static int _ecore_fb_console_h = 0;
107static int _ecore_fb_ts_event_byte_count = 0;
108static int _ecore_fb_ps2_event_byte_count = 0;
109static Ecore_Fb_Ts_Event _ecore_fb_ts_event;
110static Ecore_Fb_Ps2_Event _ecore_fb_ps2_event;
111static int _ecore_fb_tty_prev_mode = 0;
112static int _ecore_fb_tty_prev_kd_mode = 0;
113static struct termios _ecore_fb_tty_prev_tio_mode;
114static struct vt_mode _ecore_fb_vt_prev_mode;
115static int _ecore_fb_current_vt = 0;
116static int _ecore_fb_ctrl = 0;
117static int _ecore_fb_alt = 0;
118
119static void (*_ecore_fb_func_fb_lost) (void *data) = NULL;
120static void *_ecore_fb_func_fb_lost_data = NULL;
121static void (*_ecore_fb_func_fb_gain) (void *data) = NULL;
122static void *_ecore_fb_func_fb_gain_data = NULL;
123
124static void *_ecore_fb_event_filter_start(void *data);
125static int _ecore_fb_event_filter_filter(void *data, void *loop_data, int type, void *event);
126static void _ecore_fb_event_filter_end(void *data, void *loop_data);
127
128static double _ecore_fb_double_click_time = 0.25;
129
130static char *_ecore_fb_kbd_syms[128] =
131{
132 "0x00",
133 "Escape",
134 "1",
135 "2",
136 "3",
137 "4",
138 "5",
139 "6",
140 "7",
141 "8",
142 "9",
143 "0",
144 "-",
145 "=",
146 "BackSpace",
147 "Rab",
148 "q",
149 "w",
150 "e",
151 "r",
152 "t",
153 "y",
154 "u",
155 "i",
156 "o",
157 "p",
158 "bracketleft",
159 "bracketright",
160 "Return",
161 "Control_L",
162 "a",
163 "s",
164 "d",
165 "f",
166 "g",
167 "h",
168 "j",
169 "k",
170 "l",
171 "semicolon",
172 "apostrophe",
173 "0x29",
174 "Shift_L",
175 "backslash",
176 "z",
177 "x",
178 "c",
179 "v",
180 "b",
181 "n",
182 "m",
183 "comma",
184 "period",
185 "slash",
186 "Shift_R",
187 "KP_Multiply",
188 "Alt_L",
189 "space",
190 "Caps_Lock",
191 "F1",
192 "F2",
193 "F3",
194 "F4",
195 "F5",
196 "F6",
197 "F7",
198 "F8",
199 "F9",
200 "F10",
201 "Num_Lock",
202 "Scroll_Lock",
203 "KP_Home",
204 "KP_Up",
205 "KP_Prior",
206 "KP_Subtract",
207 "KP_Left",
208 "KP_Begin",
209 "KP_Right",
210 "KP_Add",
211 "KP_End",
212 "KP_Down",
213 "KP_Next",
214 "KP_Insert",
215 "KP_Delete",
216 "0x54",
217 "0x55",
218 "0x56",
219 "F11",
220 "F12",
221 "0x59",
222 "0x5a",
223 "0x5b",
224 "0x5c",
225 "0x5d",
226 "0x5e",
227 "0x5f",
228 "KP_Enter",
229 "Control_R",
230 "KP_Divide",
231 "Print",
232 "Alt_R",
233 "0x65",
234 "Home",
235 "Up",
236 "Prior",
237 "Left",
238 "right",
239 "End",
240 "Down",
241 "Next",
242 "Insert",
243 "Delete",
244 "0x70",
245 "0x71",
246 "0x72",
247 "0x73",
248 "0x74",
249 "0x75",
250 "0x76",
251 "Pause",
252 "0x78",
253 "0x79",
254 "0x7a",
255 "0x7b",
256 "0x7c",
257 "Super_L",
258 "Super_R",
259 "0x7f"
260};
261
262static char *_ecore_fb_btn_syms[128] =
263{
264 "0x00",
265 "Escape",
266 "F1",
267 "F2",
268 "F3",
269 "F4",
270 "Up",
271 "Right",
272 "Left",
273 "Down",
274 "Return",
275 "0x1b",
276 "0x1c",
277 "0x1d",
278 "0x1e",
279 "0x1f",
280 "0x20",
281 "0x21",
282 "0x22",
283 "0x23",
284 "0x24",
285 "0x25",
286 "0x26",
287 "0x27",
288 "0x28",
289 "0x29",
290 "0x2a",
291 "0x2b",
292 "0x2c",
293 "0x2d",
294 "0x2e",
295 "0x2f",
296 "0x30",
297 "0x31",
298 "0x32",
299 "0x33",
300 "0x34",
301 "0x35",
302 "0x36",
303 "0x37",
304 "0x38",
305 "0x39",
306 "0x3a",
307 "0x3b",
308 "0x3c",
309 "0x3d",
310 "0x3e",
311 "0x3f",
312 "0x40",
313 "0x41",
314 "0x42",
315 "0x43",
316 "0x44",
317 "0x45",
318 "0x46",
319 "0x47",
320 "0x48",
321 "0x49",
322 "0x4a",
323 "0x4b",
324 "0x4c",
325 "0x4d",
326 "0x4e",
327 "0x4f",
328 "0x50",
329 "0x51",
330 "0x52",
331 "0x53",
332 "0x54",
333 "0x55",
334 "0x56",
335 "0x57",
336 "0x58",
337 "0x59",
338 "0x5a",
339 "0x5b",
340 "0x5c",
341 "0x5d",
342 "0x5e",
343 "0x5f",
344 "0x60",
345 "0x61",
346 "0x62",
347 "0x63",
348 "0x64",
349 "0x65",
350 "0x66",
351 "0x67",
352 "0x68",
353 "0x69",
354 "0x6a",
355 "0x6b",
356 "0x6c",
357 "0x6d",
358 "0x6e",
359 "0x6f",
360 "0x70",
361 "0x71",
362 "0x72",
363 "0x73",
364 "0x74",
365 "0x75",
366 "0x76",
367 "0x77",
368 "0x78",
369 "0x79",
370 "0x7a",
371 "0x7b",
372 "0x7c",
373 "0x7d",
374 "0x7e",
375 "0x7f"
376};
377
378/**
379 * Set up the ecore fb system.
380 * @param name device target name
381 * @return 0 on failure, or greter than 0 on success.
382 *
383 * This starts up the ecore fb system
384 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
385 */
386int
387ecore_fb_init(const char *name)
388{
389 int prev_flags;
390
391 _ecore_fb_init_count++;
392 if (_ecore_fb_init_count > 1) return _ecore_fb_init_count;
393 _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY);
394 if (_ecore_fb_ts_fd >= 0)
395 {
396 prev_flags = fcntl(_ecore_fb_ts_fd, F_GETFL);
397 fcntl(_ecore_fb_ts_fd, F_SETFL, prev_flags | O_NONBLOCK);
398 _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ts_fd,
399 ECORE_FD_READ,
400 _ecore_fb_ts_fd_handler, NULL,
401 NULL, NULL);
402 if (!_ecore_fb_ts_fd_handler_handle)
403 {
404 close(_ecore_fb_ts_fd);
405 }
406 }
407 if (_ecore_fb_ts_fd < 0)
408 {
409 _ecore_fb_ps2_fd = open("/dev/psaux", O_RDWR);
410 if (_ecore_fb_ps2_fd >= 0)
411 {
412 prev_flags = fcntl(_ecore_fb_ps2_fd, F_GETFL);
413 fcntl(_ecore_fb_ps2_fd, F_SETFL, prev_flags | O_NONBLOCK);
414 _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ps2_fd,
415 ECORE_FD_READ,
416 _ecore_fb_ps2_fd_handler, NULL,
417 NULL, NULL);
418 if (!_ecore_fb_ts_fd_handler_handle)
419 {
420 close(_ecore_fb_ps2_fd);
421 }
422 }
423 }
424 _ecore_fb_kbd_fd = open("/dev/touchscreen/key", O_RDONLY);
425 _ecore_fb_tty_fd = open("/dev/tty0", O_RDONLY);
426 if (_ecore_fb_tty_fd >= 0)
427 {
428 struct termios tio;
429 struct vt_mode new_vtmode;
430 int vtno;
431
432 if ((ioctl(_ecore_fb_tty_fd, VT_OPENQRY, &vtno) != -1))
433 {
434 char buf[64];
435
436 _ecore_fb_current_vt = vtno;
437 ioctl(_ecore_fb_tty_fd, VT_ACTIVATE, _ecore_fb_current_vt);
438 close(_ecore_fb_tty_fd);
439 snprintf(buf, sizeof(buf), "/dev/tty%i", _ecore_fb_current_vt);
440/* FIXME: switch away works.. but switch to the allocated vt doesnt */
441/* printf("%s\n", buf); */
442 _ecore_fb_tty_fd = open(buf, O_RDWR);
443 if (_ecore_fb_current_vt == 1)
444 {
445 Ecore_Event_Signal_User *e;
446
447 e = _ecore_event_signal_user_new();
448 if (e)
449 {
450 e->number = 2;
451 _ecore_event_add(ECORE_EVENT_SIGNAL_USER, e,
452 _ecore_event_signal_user_free, NULL);
453 }
454 }
455 }
456 tcgetattr(_ecore_fb_tty_fd, &_ecore_fb_tty_prev_tio_mode);
457 ioctl(_ecore_fb_tty_fd, KDGETMODE, &_ecore_fb_tty_prev_kd_mode);
458 ioctl(_ecore_fb_tty_fd, KDGKBMODE, &_ecore_fb_tty_prev_mode);
459 ioctl(_ecore_fb_tty_fd, VT_GETMODE, &_ecore_fb_vt_prev_mode);
460 tio.c_iflag = tio.c_oflag = tio.c_cflag = tio.c_lflag = 0;
461 tio.c_cc[VTIME] = 0;
462 tio.c_cc[VMIN] = 1;
463 new_vtmode.mode = VT_PROCESS;
464 new_vtmode.waitv = 0;
465 new_vtmode.relsig = SIGUSR1;
466 new_vtmode.acqsig = SIGUSR2;
467 tcsetattr(_ecore_fb_tty_fd, TCSAFLUSH, &tio);
468 ioctl(_ecore_fb_tty_fd, KDSETMODE, KD_GRAPHICS);
469 ioctl(_ecore_fb_tty_fd, KDSKBMODE, K_MEDIUMRAW);
470 ioctl(_ecore_fb_tty_fd, VT_SETMODE, &new_vtmode);
471 }
472 if (_ecore_fb_kbd_fd <= 0) _ecore_fb_kbd_fd = _ecore_fb_tty_fd;
473 if (_ecore_fb_kbd_fd >= 0)
474 {
475 prev_flags = fcntl(_ecore_fb_kbd_fd, F_GETFL);
476 fcntl(_ecore_fb_kbd_fd, F_SETFL, prev_flags | O_NONBLOCK);
477 _ecore_fb_kbd_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_kbd_fd,
478 ECORE_FD_READ,
479 _ecore_fb_kbd_fd_handler, NULL,
480 NULL, NULL);
481 if (!_ecore_fb_kbd_fd_handler_handle)
482 {
483 tcsetattr(_ecore_fb_tty_fd, TCSAFLUSH, &_ecore_fb_tty_prev_tio_mode);
484 ioctl(_ecore_fb_tty_fd, KDSETMODE, _ecore_fb_tty_prev_kd_mode);
485 ioctl(_ecore_fb_tty_fd, KDSKBMODE, _ecore_fb_tty_prev_mode);
486 close(_ecore_fb_tty_fd);
487 close(_ecore_fb_ts_fd);
488 close(_ecore_fb_kbd_fd);
489 if (_ecore_fb_ps2_fd > 0) close(_ecore_fb_ps2_fd);
490 if (_ecore_fb_tty_fd != _ecore_fb_kbd_fd)
491 close(_ecore_fb_tty_fd);
492 ecore_main_fd_handler_del(_ecore_fb_ts_fd_handler_handle);
493 _ecore_fb_ts_fd_handler_handle = NULL;
494 _ecore_fb_init_count--;
495 return 0;
496 }
497 }
498 if (!ECORE_FB_EVENT_KEY_DOWN)
499 {
500 ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new();
501 ECORE_FB_EVENT_KEY_UP = ecore_event_type_new();
502 ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
503 ECORE_FB_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
504 ECORE_FB_EVENT_MOUSE_MOVE = ecore_event_type_new();
505
506 }
507 _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
508 _ecore_fb_user_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER,
509 _ecore_fb_signal_usr_handler,
510 NULL);
511 _ecore_fb_filter_handler = ecore_event_filter_add(_ecore_fb_event_filter_start, _ecore_fb_event_filter_filter, _ecore_fb_event_filter_end, NULL);
512 return _ecore_fb_init_count;
513}
514
515/**
516 * Shut down the ecore fb system.
517 * @return 0 if the system was shut down, or 1 if it still needs to be shut down
518 *
519 * This shuts down the ecore fb system.
520 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
521 */
522int
523ecore_fb_shutdown(void)
524{
525 _ecore_fb_init_count--;
526 if (_ecore_fb_init_count > 0) return _ecore_fb_init_count;
527 if (_ecore_fb_init_count < 0)
528 {
529 _ecore_fb_init_count = 0;
530 return 0;
531 }
532 if (_ecore_fb_tty_fd != 0)
533 {
534 tcsetattr(_ecore_fb_tty_fd, TCSAFLUSH, &_ecore_fb_tty_prev_tio_mode);
535 ioctl(_ecore_fb_tty_fd, KDSETMODE, _ecore_fb_tty_prev_kd_mode);
536 ioctl(_ecore_fb_tty_fd, KDSKBMODE, _ecore_fb_tty_prev_mode);
537 ioctl(_ecore_fb_tty_fd, VT_SETMODE, &_ecore_fb_vt_prev_mode);
538 close(_ecore_fb_tty_fd);
539 if (_ecore_fb_tty_fd == _ecore_fb_kbd_fd) _ecore_fb_kbd_fd = 0;
540 }
541 if (_ecore_fb_ps2_fd > 0) close(_ecore_fb_ps2_fd);
542 if (_ecore_fb_ts_fd >= 0) close(_ecore_fb_ts_fd);
543 if (_ecore_fb_kbd_fd >= 0) close(_ecore_fb_kbd_fd);
544 if (_ecore_fb_ts_fd_handler_handle)
545 ecore_main_fd_handler_del(_ecore_fb_ts_fd_handler_handle);
546 if (_ecore_fb_kbd_fd_handler_handle)
547 ecore_main_fd_handler_del(_ecore_fb_kbd_fd_handler_handle);
548 if (_ecore_fb_user_handler)
549 ecore_event_handler_del(_ecore_fb_user_handler);
550 ecore_event_filter_del(_ecore_fb_filter_handler);
551 _ecore_fb_ts_fd = 0;
552 _ecore_fb_kbd_fd = 0;
553 _ecore_fb_tty_fd = 0;
554 _ecore_fb_ps2_fd = 0;
555 _ecore_fb_ts_fd_handler_handle = NULL;
556 _ecore_fb_filter_handler = NULL;
557 _ecore_fb_kbd_fd_handler_handle = NULL;
558 _ecore_fb_user_handler = NULL;
559 _ecore_fb_ctrl = 0;
560 _ecore_fb_alt = 0;
561 return _ecore_fb_init_count;
562}
563
564/**
565 * Set the timeout for double/triple click to be flagged.
566 * @param t The time in seconds
567 *
568 * This sets the time between clicks before the double_click flag is set in a
569 * button down event. If 3 clicks occur within double this time then the
570 * triple_click flag is also set.
571 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
572 */
573void
574ecore_fb_double_click_time_set(double t)
575{
576 if (t < 0.0) t = 0.0;
577 _ecore_fb_double_click_time = t;
578}
579
580/**
581 * Get the double/triple click timeout.
582 * @return The timeout for double clicks in seconds
583 *
584 * This returns the tiemout that can be set by ecore_fb_double_click_time_set()
585 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
586 */
587double
588ecore_fb_double_click_time_get(void)
589{
590 return _ecore_fb_double_click_time;
591}
592
593/**
594 * Get the current fb width and height in pixels.
595 * @param w Width in pixels
596 * @param h Height in pixels
597 *
598 * Get the current fb width and height in pixels
599 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
600 */
601void
602ecore_fb_size_get(int *w, int *h)
603{
604 if (w) *w = _ecore_fb_console_w;
605 if (h) *h = _ecore_fb_console_h;
606}
607
608/**
609 * Calibrate the touschreen.
610 * @param xscale X scaling (256 = 1.0)
611 * @param xtrans X translation
612 * @param yscale Y scaling
613 * @param ytrans Y translation
614 * @param xyswap Swap X & Y flag
615 *
616 * Calibrate the touchscreen using the above params
617 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
618 */
619void
620ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int yscale, int ytrans, int xyswap)
621{
622 Ecore_Fb_Ts_Calibrate cal;
623
624 if (_ecore_fb_ts_fd < 0) return;
625 cal.xscale = xscale;
626 cal.xtrans = xtrans;
627 cal.yscale = yscale;
628 cal.ytrans = ytrans;
629 cal.xyswap = xyswap;
630 ioctl(_ecore_fb_ts_fd, TS_SET_CAL, (void *)&cal);
631}
632
633/**
634 * Get calibratio og the touschreen.
635 * @param xscale X scaling (256 = 1.0)
636 * @param xtrans X translation
637 * @param yscale Y scaling
638 * @param ytrans Y translation
639 * @param xyswap Swap X & Y flag
640 *
641 * Get calibration of the touchscreen
642 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
643 */
644void
645ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int *yscale, int *ytrans, int *xyswap)
646{
647 Ecore_Fb_Ts_Calibrate cal;
648
649 if (_ecore_fb_ts_fd < 0) return;
650 ioctl(_ecore_fb_ts_fd, TS_GET_CAL, (void *)&cal);
651 if (xscale) *xscale = cal.xscale;
652 if (xtrans) *xtrans = cal.xtrans;
653 if (yscale) *yscale = cal.yscale;
654 if (ytrans) *ytrans = cal.ytrans;
655 if (xyswap) *xyswap = cal.xyswap;
656}
657
658/**
659 * Set the backlight.
660 * @param on 1 or 0 corresponding to on or off
661 *
662 * Set the backlight to the @p on state
663 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
664 */
665void
666ecore_fb_backlight_set(int on)
667{
668 Ecore_Fb_Ts_Backlight bl;
669
670 if (_ecore_fb_ts_fd < 0) return;
671 ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
672 bl.on = on;
673 ioctl(_ecore_fb_ts_fd, TS_SET_BACKLIGHT, &bl);
674}
675
676/**
677 * Get the backlight state.
678 * @return The current backlight state
679 *
680 * Get the current backlight state
681 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
682 */
683int
684ecore_fb_backlight_get(void)
685{
686 Ecore_Fb_Ts_Backlight bl;
687
688 if (_ecore_fb_ts_fd < 0) return 1;
689 ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
690 return bl.on;
691}
692
693/**
694 * Set the backlight brightness.
695 * @param br Brightness 0.0 to 1.0
696 *
697 * Set the backglith brightness to @p br, where 0 is darkest and 1.0 is
698 * the brightest.
699 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
700 */
701void
702ecore_fb_backlight_brightness_set(double br)
703{
704 Ecore_Fb_Ts_Backlight bl;
705 int val;
706
707 if (br < 0) br = 0;
708 if (br > 1) br = 1;
709 val = (int)(255.0 * br);
710 ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
711 bl.brightness = val;
712 ioctl(_ecore_fb_ts_fd, TS_SET_BACKLIGHT, &bl);
713}
714
715/**
716 * Get the backlight brightness.
717 * @return The current backlight brigntess
718 *
719 * Get the current backlight brightness as per
720 * ecore_fb_backlight_brightness_set().
721 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
722 */
723double
724ecore_fb_backlight_brightness_get(void)
725{
726 Ecore_Fb_Ts_Backlight bl;
727
728 if (_ecore_fb_ts_fd < 0) return 1.0;
729 ioctl(_ecore_fb_ts_fd, TS_GET_BACKLIGHT, &bl);
730 return (double)bl.brightness / 255.0;
731}
732
733/**
734 * To be documented.
735 *
736 * FIXME: To be fixed.
737 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
738 */
739void
740ecore_fb_led_set(int on)
741{
742 Ecore_Fb_Ts_Led led;
743
744 if (_ecore_fb_ts_fd < 0) return;
745 if (on) led.on = 1;
746 else led.on = 0;
747 ioctl(_ecore_fb_ts_fd, LED_ON, &led);
748}
749
750/**
751 * To be documented.
752 *
753 * FIXME: To be fixed.
754 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
755 */
756void
757ecore_fb_led_blink_set(double speed)
758{
759 Ecore_Fb_Ts_Led led;
760
761 if (_ecore_fb_ts_fd < 0) return;
762 led.on = 1;
763 led.on_time = (unsigned char)(speed * 10);
764 led.off_time = (unsigned char)(speed * 10);
765 led.blink_time = 255;
766 ioctl(_ecore_fb_ts_fd, LED_ON, &led);
767}
768
769/**
770 * To be documented.
771 *
772 * FIXME: To be fixed.
773 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
774 */
775void
776ecore_fb_contrast_set(double cr)
777{
778 Ecore_Fb_Ts_Contrast ct;
779 int val;
780
781 if (cr < 0) cr = 0;
782 if (cr > 1) cr = 1;
783 val = (int)(255.0 * cr);
784 ct.contrast = val;
785 ioctl(_ecore_fb_ts_fd, TS_SET_CONTRAST, &ct);
786}
787
788/**
789 * To be documented.
790 *
791 * FIXME: To be fixed.
792 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
793 */
794double
795ecore_fb_contrast_get(void)
796{
797 Ecore_Fb_Ts_Contrast ct;
798
799 if (_ecore_fb_ts_fd < 0) return 1.0;
800 ioctl(_ecore_fb_ts_fd, TS_GET_CONTRAST, &ct);
801 return (double)ct.contrast / 255.0;
802}
803
804/**
805 * To be documented.
806 *
807 * FIXME: To be fixed.
808 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
809 */
810double
811ecore_fb_light_sensor_get(void)
812{
813 Ecore_Fb_Ts_Flite fl;
814
815 if (_ecore_fb_ts_fd < 0) return 0.0;
816 fl.mode = 3;
817 fl.brightness = 0;
818 ioctl(_ecore_fb_ts_fd, FLITE_ON, &fl);
819 return (double)fl.brightness / 255.0;
820}
821
822/**
823 * To be documented.
824 *
825 * FIXME: To be fixed.
826 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
827 */
828void
829ecore_fb_callback_gain_set(void (*func) (void *data), void *data)
830{
831 _ecore_fb_func_fb_gain = func;
832 _ecore_fb_func_fb_gain_data = data;
833}
834
835/**
836 * To be documented.
837 *
838 * FIXME: To be fixed.
839 * <hr><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
840 */
841void
842ecore_fb_callback_lose_set(void (*func) (void *data), void *data)
843{
844 _ecore_fb_func_fb_lost = func;
845 _ecore_fb_func_fb_lost_data = data;
846}
847
848static void
849_ecore_fb_size_get(int *w, int *h)
850{
851 struct fb_var_screeninfo fb_var;
852 int fb;
853
854 fb = open("/dev/fb0", O_RDWR);
855 if (fb < 0)
856 {
857 if (w) *w = 0;
858 if (h) *h = 0;
859 return;
860 }
861 if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1)
862 {
863 if (w) *w = 0;
864 if (h) *h = 0;
865 return;
866 }
867 close(fb);
868 if (w) *w = fb_var.xres;
869 if (h) *h = fb_var.yres;
870}
871
872static int
873_ecore_fb_ts_fd_handler(Ecore_Fd_Handler *fd_handler, void *data)
874{
875 static int prev_x = 0, prev_y = 0, prev_pressure = 0;
876 static double last_time = 0;
877 static double last_last_time = 0;
878 int v = 0;
879
880 do
881 {
882 int x, y, pressure;
883 int num;
884 char *ptr;
885 double t;
886 int did_triple = 0;
887
888 ptr = (char *)&(_ecore_fb_ts_event);
889 ptr += _ecore_fb_ts_event_byte_count;
890 num = sizeof(Ecore_Fb_Ts_Event) - _ecore_fb_ts_event_byte_count;
891 v = read(_ecore_fb_ts_fd, ptr, num);
892 if (v < 0) return 1;
893 _ecore_fb_ts_event_byte_count += v;
894 if (v < num) return 1;
895 t = ecore_time_get();
896 _ecore_fb_ts_event_byte_count = 0;
897 x = _ecore_fb_ts_event.x;
898 y = _ecore_fb_ts_event.y;
899 pressure = _ecore_fb_ts_event.pressure;
900 /* add event to queue */
901 /* always add a move event */
902 if ((pressure) || (prev_pressure))
903 {
904 /* MOVE: mouse is down and was */
905 Ecore_Fb_Event_Mouse_Move *e;
906
907 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Move));
908 if (!e) goto retry;
909 e->x = x;
910 e->y = y;
911 ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, e, _ecore_fb_event_free_generic, NULL);
912 }
913 if ((pressure) && (!prev_pressure))
914 {
915 /* DOWN: mouse is down, but was not now */
916 Ecore_Fb_Event_Mouse_Button_Down *e;
917
918 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down));
919 if (!e) goto retry;
920 e->x = x;
921 e->y = y;
922 e->button = 1;
923 if ((t - last_time) <= _ecore_fb_double_click_time)
924 e->double_click = 1;
925 if ((t - last_last_time) <= (2 * _ecore_fb_double_click_time))
926 {
927 did_triple = 1;
928 e->triple_click = 1;
929 }
930 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, e, _ecore_fb_event_free_generic, NULL);
931 }
932 else if ((!pressure) && (prev_pressure))
933 {
934 /* UP: mouse was down, but is not now */
935 Ecore_Fb_Event_Mouse_Button_Up *e;
936
937 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up));
938 if (!e) goto retry;
939 e->x = prev_x;
940 e->y = prev_y;
941 e->button = 1;
942 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, e, _ecore_fb_event_free_generic, NULL);
943 }
944 if (did_triple)
945 {
946 last_time = 0;
947 last_last_time = 0;
948 }
949 else
950 {
951 last_last_time = last_time;
952 last_time = t;
953 }
954 retry:
955 prev_x = x;
956 prev_y = y;
957 prev_pressure = pressure;
958 }
959 while (v > 0);
960 return 1;
961}
962
963static int
964_ecore_fb_kbd_fd_handler(Ecore_Fd_Handler *fd_handler, void *data)
965{
966 int v = 0;
967
968 do
969 {
970 unsigned char buf;
971
972 v = read(_ecore_fb_kbd_fd, &buf, 1);
973 if (v < 0) return 1;
974 if (v < 1) return 1;
975 if (buf & 0x80)
976 {
977 /* DOWN */
978 int vt_switch = -1;
979 Ecore_Fb_Event_Key_Down *e;
980
981 e = calloc(1, sizeof(Ecore_Fb_Event_Key_Down));
982 if (!e) goto retry;
983 if (_ecore_fb_kbd_fd == _ecore_fb_tty_fd)
984 e->keyname = strdup(_ecore_fb_kbd_syms[buf & 0x7f]);
985 else
986 e->keyname = strdup(_ecore_fb_btn_syms[buf & 0x7f]);
987 if (!e->keyname)
988 {
989 free(e);
990 goto retry;
991 }
992 ecore_event_add(ECORE_FB_EVENT_KEY_DOWN, e, _ecore_fb_event_free_key_down, NULL);
993 if (!strcmp(e->keyname, "Control_L"))
994 _ecore_fb_ctrl++;
995 if (!strcmp(e->keyname, "Control_R"))
996 _ecore_fb_ctrl++;
997 else if (!strcmp(e->keyname, "Alt_L"))
998 _ecore_fb_alt++;
999 else if (!strcmp(e->keyname, "Alt_R"))
1000 _ecore_fb_alt++;
1001 else if (!strcmp(e->keyname, "F1")) vt_switch = 0;
1002 else if (!strcmp(e->keyname, "F2")) vt_switch = 1;
1003 else if (!strcmp(e->keyname, "F3")) vt_switch = 2;
1004 else if (!strcmp(e->keyname, "F4")) vt_switch = 3;
1005 else if (!strcmp(e->keyname, "F5")) vt_switch = 4;
1006 else if (!strcmp(e->keyname, "F6")) vt_switch = 5;
1007 else if (!strcmp(e->keyname, "F7")) vt_switch = 6;
1008 else if (!strcmp(e->keyname, "F8")) vt_switch = 7;
1009 else if (!strcmp(e->keyname, "F9")) vt_switch = 8;
1010 else if (!strcmp(e->keyname, "F10")) vt_switch = 9;
1011 else if (!strcmp(e->keyname, "F11")) vt_switch = 10;
1012 else if (!strcmp(e->keyname, "F12")) vt_switch = 11;
1013 if (_ecore_fb_ctrl > 2) _ecore_fb_ctrl = 2;
1014 if (_ecore_fb_alt > 2) _ecore_fb_alt = 2;
1015 if ((vt_switch >= 0) &&
1016 (_ecore_fb_ctrl) &&
1017 (_ecore_fb_alt))
1018 _ecore_fb_vt_switch(vt_switch);
1019 }
1020 else
1021 {
1022 /* UP */
1023 Ecore_Fb_Event_Key_Up *e;
1024
1025 e = calloc(1, sizeof(Ecore_Fb_Event_Key_Up));
1026 if (!e) goto retry;
1027 if (_ecore_fb_kbd_fd == _ecore_fb_tty_fd)
1028 e->keyname = strdup(_ecore_fb_kbd_syms[buf & 0x7f]);
1029 else
1030 e->keyname = strdup(_ecore_fb_btn_syms[buf & 0x7f]);
1031 if (!e->keyname)
1032 {
1033 free(e);
1034 goto retry;
1035 }
1036 ecore_event_add(ECORE_FB_EVENT_KEY_UP, e, _ecore_fb_event_free_key_up, NULL);
1037 if (!strcmp(e->keyname, "Control_L"))
1038 _ecore_fb_ctrl--;
1039 if (!strcmp(e->keyname, "Control_R"))
1040 _ecore_fb_ctrl--;
1041 else if (!strcmp(e->keyname, "Alt_L"))
1042 _ecore_fb_alt--;
1043 else if (!strcmp(e->keyname, "Alt_R"))
1044 _ecore_fb_alt--;
1045 if (_ecore_fb_ctrl < 0) _ecore_fb_ctrl = 0;
1046 if (_ecore_fb_alt < 0) _ecore_fb_alt = 0;
1047 }
1048 retry:
1049 }
1050 while (v > 0);
1051 return 1;
1052}
1053
1054static int
1055_ecore_fb_ps2_fd_handler(Ecore_Fd_Handler *fd_handler, void *data)
1056{
1057 static int prev_x = 0, prev_y = 0, prev_button = 0;
1058 static double last_time = 0;
1059 static double last_last_time = 0;
1060 int v = 0;
1061
1062 do
1063 {
1064 int x, y, button, i;
1065 int num;
1066 char *ptr;
1067 double t;
1068 int did_triple = 0;
1069
1070 ptr = (char *)&(_ecore_fb_ps2_event);
1071 ptr += _ecore_fb_ps2_event_byte_count;
1072 num = sizeof(Ecore_Fb_Ps2_Event) - _ecore_fb_ps2_event_byte_count;
1073 v = read(_ecore_fb_ps2_fd, ptr, num);
1074 if (v < 0) return 1;
1075 _ecore_fb_ps2_event_byte_count += v;
1076 if (v < num) return 1;
1077 t = ecore_time_get();
1078 _ecore_fb_ps2_event_byte_count = 0;
1079 if (_ecore_fb_ps2_event.button & 0x10)
1080 x = prev_x + (0xffffff00 | _ecore_fb_ps2_event.x);
1081 else
1082 x = prev_x + _ecore_fb_ps2_event.x;
1083 if (_ecore_fb_ps2_event.button & 0x20)
1084 y = prev_y - (0xffffff00 | _ecore_fb_ps2_event.y);
1085 else
1086 y = prev_y - _ecore_fb_ps2_event.y;
1087 button = _ecore_fb_ps2_event.button & 0x7;
1088 if (x < 0) x = 0;
1089 if (y < 0) y = 0;
1090 if (x >= _ecore_fb_console_w) x = _ecore_fb_console_w - 1;
1091 if (y >= _ecore_fb_console_h) y = _ecore_fb_console_h - 1;
1092 /* add event to queue */
1093 /* always add a move event */
1094 if (1)
1095 {
1096 /* MOVE: mouse is down and was */
1097 Ecore_Fb_Event_Mouse_Move *e;
1098
1099 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Move));
1100 if (!e) goto retry;
1101 e->x = x;
1102 e->y = y;
1103 ecore_event_add(ECORE_FB_EVENT_MOUSE_MOVE, e, _ecore_fb_event_free_generic, NULL);
1104 }
1105 for (i = 1; i <= 3; i++)
1106 {
1107 int mask;
1108
1109 mask = 1 << (i - 1);
1110 if (((button & mask)) && (!(prev_button & mask)))
1111 {
1112 /* DOWN: mouse is down, but was not now */
1113 Ecore_Fb_Event_Mouse_Button_Down *e;
1114
1115 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Down));
1116 if (!e) goto retry;
1117 e->x = x;
1118 e->y = y;
1119 e->button = 1;
1120 if ((t - last_time) <= _ecore_fb_double_click_time)
1121 e->double_click = 1;
1122 if ((t - last_last_time) <= (2 * _ecore_fb_double_click_time))
1123 {
1124 did_triple = 1;
1125 e->triple_click = 1;
1126 }
1127 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, e, _ecore_fb_event_free_generic, NULL);
1128 }
1129 else if ((!(button & mask)) && ((prev_button & mask)))
1130 {
1131 /* UP: mouse was down, but is not now */
1132 Ecore_Fb_Event_Mouse_Button_Up *e;
1133
1134 e = calloc(1, sizeof(Ecore_Fb_Event_Mouse_Button_Up));
1135 if (!e) goto retry;
1136 e->x = x;
1137 e->y = y;
1138 e->button = 1;
1139 ecore_event_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, e, _ecore_fb_event_free_generic, NULL);
1140 }
1141 }
1142 if (did_triple)
1143 {
1144 last_time = 0;
1145 last_last_time = 0;
1146 }
1147 else
1148 {
1149 last_last_time = last_time;
1150 last_time = t;
1151 }
1152 retry:
1153 prev_x = x;
1154 prev_y = y;
1155 prev_button = button;
1156 }
1157 while (v > 0);
1158 return 1;
1159}
1160
1161static void
1162_ecore_fb_event_free_key_down(void *data, void *ev)
1163{
1164 Ecore_Fb_Event_Key_Up *e;
1165
1166 e = ev;
1167 free(e->keyname);
1168 free(e);
1169}
1170
1171static void
1172_ecore_fb_event_free_key_up(void *data, void *ev)
1173{
1174 Ecore_Fb_Event_Key_Up *e;
1175
1176 e = ev;
1177 free(e->keyname);
1178 free(e);
1179}
1180
1181static void
1182_ecore_fb_event_free_generic(void *data, void *ev)
1183{
1184 free(ev);
1185}
1186
1187static int
1188_ecore_fb_signal_usr_handler(void *data, int type, void *ev)
1189{
1190 Ecore_Event_Signal_User *e;
1191
1192 e = (Ecore_Event_Signal_User *)ev;
1193 if (e->number == 1)
1194 {
1195 /* release */
1196 if (_ecore_fb_func_fb_lost)
1197 _ecore_fb_func_fb_lost(_ecore_fb_func_fb_lost_data);
1198 if (_ecore_fb_ps2_fd > 0) close(_ecore_fb_ps2_fd);
1199 if (_ecore_fb_ts_fd >= 0) close(_ecore_fb_ts_fd);
1200 if (_ecore_fb_ts_fd_handler_handle)
1201 ecore_main_fd_handler_del(_ecore_fb_ts_fd_handler_handle);
1202 _ecore_fb_ps2_fd = 0;
1203 _ecore_fb_ts_fd = 0;
1204 _ecore_fb_ts_fd_handler_handle = NULL;
1205 ioctl(_ecore_fb_tty_fd, VT_RELDISP, 1);
1206 }
1207 else if (e->number == 2)
1208 {
1209 int prev_flags;
1210
1211 /* gain */
1212 if (_ecore_fb_func_fb_gain)
1213 _ecore_fb_func_fb_gain(_ecore_fb_func_fb_gain_data);
1214 if (!_ecore_fb_ts_fd)
1215 {
1216 _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY);
1217 if (_ecore_fb_ts_fd >= 0)
1218 {
1219 prev_flags = fcntl(_ecore_fb_ts_fd, F_GETFL);
1220 fcntl(_ecore_fb_ts_fd, F_SETFL, prev_flags | O_NONBLOCK);
1221 _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ts_fd,
1222 ECORE_FD_READ,
1223 _ecore_fb_ts_fd_handler, NULL,
1224 NULL, NULL);
1225 if (!_ecore_fb_ts_fd_handler_handle)
1226 {
1227 close(_ecore_fb_ts_fd);
1228 }
1229 }
1230 }
1231 if (_ecore_fb_ts_fd < 0)
1232 {
1233 if (!_ecore_fb_ps2_fd)
1234 {
1235 _ecore_fb_ps2_fd = open("/dev/psaux", O_RDWR);
1236 if (_ecore_fb_ps2_fd >= 0)
1237 {
1238 prev_flags = fcntl(_ecore_fb_ps2_fd, F_GETFL);
1239 fcntl(_ecore_fb_ps2_fd, F_SETFL, prev_flags | O_NONBLOCK);
1240 _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ps2_fd,
1241 ECORE_FD_READ,
1242 _ecore_fb_ps2_fd_handler, NULL,
1243 NULL, NULL);
1244 if (!_ecore_fb_ts_fd_handler_handle)
1245 {
1246 close(_ecore_fb_ps2_fd);
1247 }
1248 }
1249 }
1250 }
1251 if (_ecore_fb_tty_fd != 0)
1252 {
1253 struct termios tio;
1254 struct vt_mode new_vtmode;
1255
1256 tio.c_iflag = tio.c_oflag = tio.c_cflag = tio.c_lflag = 0;
1257 tio.c_cc[VTIME] = 0;
1258 tio.c_cc[VMIN] = 1;
1259 new_vtmode.mode = VT_PROCESS;
1260 new_vtmode.waitv = 0;
1261 new_vtmode.relsig = SIGUSR1;
1262 new_vtmode.acqsig = SIGUSR2;
1263 tcsetattr(_ecore_fb_tty_fd, TCSAFLUSH, &tio);
1264 ioctl(_ecore_fb_tty_fd, KDSETMODE, KD_GRAPHICS);
1265 ioctl(_ecore_fb_tty_fd, KDSKBMODE, K_MEDIUMRAW);
1266 ioctl(_ecore_fb_tty_fd, VT_SETMODE, &new_vtmode);
1267 }
1268 }
1269 return 1;
1270}
1271
1272static void
1273_ecore_fb_vt_switch(int vt)
1274{
1275 vt++;
1276 if (_ecore_fb_tty_fd != 0)
1277 {
1278 if (vt != _ecore_fb_current_vt)
1279 {
1280 tcsetattr(_ecore_fb_tty_fd, TCSAFLUSH, &_ecore_fb_tty_prev_tio_mode);
1281 ioctl(_ecore_fb_tty_fd, KDSETMODE, _ecore_fb_tty_prev_kd_mode);
1282 ioctl(_ecore_fb_tty_fd, KDSKBMODE, _ecore_fb_tty_prev_mode);
1283 }
1284 }
1285 ioctl(_ecore_fb_tty_fd, VT_ACTIVATE, vt);
1286}
1287
1288typedef struct _Ecore_Fb_Filter_Data Ecore_Fb_Filter_Data;
1289
1290struct _Ecore_Fb_Filter_Data
1291{
1292 int last_event_type;
1293};
1294
1295static void *
1296_ecore_fb_event_filter_start(void *data)
1297{
1298 Ecore_Fb_Filter_Data *filter_data;
1299
1300 filter_data = calloc(1, sizeof(Ecore_Fb_Filter_Data));
1301 return filter_data;
1302}
1303
1304static int
1305_ecore_fb_event_filter_filter(void *data, void *loop_data,int type, void *event)
1306{
1307 Ecore_Fb_Filter_Data *filter_data;
1308
1309 filter_data = loop_data;
1310 if (!filter_data) return 1;
1311 if (type == ECORE_FB_EVENT_MOUSE_MOVE)
1312 {
1313 if ((filter_data->last_event_type) == ECORE_FB_EVENT_MOUSE_MOVE)
1314 {
1315 filter_data->last_event_type = type;
1316 return 0;
1317 }
1318 }
1319 filter_data->last_event_type = type;
1320 return 1;
1321}
1322
1323static void
1324_ecore_fb_event_filter_end(void *data, void *loop_data)
1325{
1326 Ecore_Fb_Filter_Data *filter_data;
1327
1328 filter_data = loop_data;
1329 if (filter_data) free(filter_data);
1330}