From: Enlightenment C. <no...@cv...> - 2006-07-30 23:14:24
|
Enlightenment CVS committal Author : turran Project : e17 Module : libs/ecore Dir : e17/libs/ecore/src/lib/ecore_evas Modified Files: ecore_evas_fb.c Log Message: Ecore_Fb changes: ================ + remove of old ps2, touchscreen and keyboard input handlers + old code is kept on sperated files for backup in case someone needs it, but wont compile + addition of new linux input (evdev) handlers. (touchscreen is handled as an absolute axis device, no need for old code). It supports multiple input devices, you can have several mice for example. + new vt code, now it support allocating a new tty if root, or use current tty if normal user, correct vt switching on both cases + some more cleanups Ecore_Evas_Fb changes: ===================== + use the new ecore_fb =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_evas/ecore_evas_fb.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- ecore_evas_fb.c 27 Jul 2006 16:14:33 -0000 1.18 +++ ecore_evas_fb.c 31 Jul 2006 04:13:51 -0000 1.19 @@ -13,8 +13,10 @@ static int _ecore_evas_fps_debug = 0; static Ecore_Evas *ecore_evases = NULL; -static Ecore_Event_Handler *ecore_evas_event_handlers[5]; +static Ecore_Event_Handler *ecore_evas_event_handlers[6]; static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; +static Ecore_Fb_Input_Device *stdkbd = NULL; +static Ecore_Fb_Input_Device *stdmouse = NULL; static void _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp) @@ -83,6 +85,8 @@ ee = (Ecore_Evas *)l; ee->visible = 0; } + ecore_fb_input_device_listen(stdmouse, 0); + ecore_fb_input_device_listen(stdkbd, 0); } static void @@ -98,6 +102,8 @@ ee->visible = 1; evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); } + ecore_fb_input_device_listen(stdmouse, 1); + ecore_fb_input_device_listen(stdkbd, 1); } static int @@ -109,6 +115,7 @@ e = event; ee = _ecore_evas_fb_match(); if (!ee) return 1; /* pass on event */ + if (e->dev != stdkbd) return 1; 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); return 0; /* dont pass it on */ } @@ -122,6 +129,7 @@ e = event; ee = _ecore_evas_fb_match(); if (!ee) return 1; /* pass on event */ + if (e->dev != stdkbd) return 1; 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); return 0; /* dont pass it on */ } @@ -136,6 +144,7 @@ e = event; ee = _ecore_evas_fb_match(); if (!ee) return 1; /* pass on event */ + if (e->dev != stdmouse) return 1; _ecore_evas_mouse_move_process(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK; if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK; @@ -152,6 +161,7 @@ e = event; ee = _ecore_evas_fb_match(); if (!ee) return 1; /* pass on event */ + if (e->dev != stdmouse) return 1; _ecore_evas_mouse_move_process(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); evas_event_feed_mouse_up(ee->evas, e->button, EVAS_BUTTON_NONE, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); return 0; /* dont pass it on */ @@ -166,6 +176,21 @@ e = event; ee = _ecore_evas_fb_match(); if (!ee) return 1; /* pass on event */ + if (e->dev != stdmouse) return 1; + _ecore_evas_mouse_move_process(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); + return 0; /* dont pass it on */ +} + +static int +_ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Fb_Event_Mouse_Wheel *e; + + e = event; + ee = _ecore_evas_fb_match(); + if (!ee) return 1; /* pass on event */ + if (e->dev != stdmouse) return 1; _ecore_evas_mouse_move_process(ee, e->x, e->y, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff)); return 0; /* dont pass it on */ } @@ -228,6 +253,7 @@ ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); + ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_FB_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL); if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); return _ecore_evas_init_count; } @@ -392,6 +418,8 @@ evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); } ee->prop.fullscreen = on; + /* rescale the input device area */ + ecore_fb_input_device_axis_size_set(stdmouse, ee->w, ee->h); if (resized) { if (ee->func.fn_resize) ee->func.fn_resize(ee); @@ -475,10 +503,29 @@ #ifdef BUILD_ECORE_EVAS_FB Evas_Engine_Info_FB *einfo; Ecore_Evas *ee; + Ecore_Fb_Input_Device *tmp_dev; + Ecore_Fb_Input_Device_Cap tmp_cap; int rmethod; rmethod = evas_render_method_lookup("fb"); if (!rmethod) return NULL; + /* register the default input devices (keyboard + mouse) */ + tmp_dev = ecore_fb_input_device_open("/dev/input/event0"); + if (!tmp_dev) return NULL; + tmp_cap = ecore_fb_input_device_cap_get(tmp_dev); + if ((tmp_cap & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) || (tmp_cap & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) stdmouse = tmp_dev; + else stdkbd = tmp_dev; + + ecore_fb_input_device_listen(tmp_dev, 1); + + tmp_dev = ecore_fb_input_device_open("/dev/input/event1"); + if (!stdmouse) stdmouse = tmp_dev; + else stdkbd = tmp_dev; + + if (!tmp_dev) return NULL; + ecore_fb_input_device_listen(tmp_dev, 1); + ecore_fb_input_device_axis_size_set(stdmouse, w, h); + if (!ecore_fb_init(disp_name)) return NULL; ecore_fb_callback_gain_set(_ecore_evas_fb_gain, NULL); ecore_fb_callback_lose_set(_ecore_evas_fb_lose, NULL); |