2 #include "ecore_fb_private.h"
4 static void _ecore_fb_size_get(int *w, int *h);
6 EAPI int ECORE_FB_EVENT_KEY_DOWN = 0;
7 EAPI int ECORE_FB_EVENT_KEY_UP = 0;
8 EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = 0;
9 EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_UP = 0;
10 EAPI int ECORE_FB_EVENT_MOUSE_MOVE = 0;
11 EAPI int ECORE_FB_EVENT_MOUSE_WHEEL = 0;
13 static int _ecore_fb_init_count = 0;
14 static int _ecore_fb_console_w = 0;
15 static int _ecore_fb_console_h = 0;
17 static double _ecore_fb_double_click_time = 0.25;
21 * @defgroup Ecore_FB_Library_Group Framebuffer Library Functions
23 * Functions used to set up and shut down the Ecore_Framebuffer functions.
27 * Sets up the Ecore_Fb library.
28 * @param name device target name
29 * @return @c 0 on failure. Otherwise, the number of times the library has
30 * been initialised without being shut down.
31 * @ingroup Ecore_FB_Library_Group
34 ecore_fb_init(const char *name __UNUSED__)
36 if(!_ecore_fb_init_count)
38 if(!ecore_fb_vt_init()) return 0;
39 ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new();
40 ECORE_FB_EVENT_KEY_UP = ecore_event_type_new();
41 ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
42 ECORE_FB_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
43 ECORE_FB_EVENT_MOUSE_MOVE = ecore_event_type_new();
44 ECORE_FB_EVENT_MOUSE_WHEEL = ecore_event_type_new();
45 _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
47 return ++_ecore_fb_init_count;
51 * Shuts down the Ecore_Fb library.
52 * @return @c The number of times the system has been initialised without
54 * @ingroup Ecore_FB_Library_Group
57 ecore_fb_shutdown(void)
59 _ecore_fb_init_count--;
60 if(!_ecore_fb_init_count)
62 ecore_fb_vt_shutdown();
65 return _ecore_fb_init_count;
70 * Retrieves the width and height of the current frame buffer in pixels.
71 * @param w Pointer to an integer in which to store the width.
72 * @param h Pointer to an interge in which to store the height.
75 ecore_fb_size_get(int *w, int *h)
77 if (w) *w = _ecore_fb_console_w;
78 if (h) *h = _ecore_fb_console_h;
82 _ecore_fb_size_get(int *w, int *h)
84 struct fb_var_screeninfo fb_var;
87 fb = open("/dev/fb0", O_RDWR);
94 if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1)
101 if (w) *w = fb_var.xres;
102 if (h) *h = fb_var.yres;