2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
10 #include "ecore_fb_private.h"
12 static void _ecore_fb_size_get(int *w, int *h);
14 EAPI int ECORE_FB_EVENT_KEY_DOWN = 0;
15 EAPI int ECORE_FB_EVENT_KEY_UP = 0;
16 EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = 0;
17 EAPI int ECORE_FB_EVENT_MOUSE_BUTTON_UP = 0;
18 EAPI int ECORE_FB_EVENT_MOUSE_MOVE = 0;
19 EAPI int ECORE_FB_EVENT_MOUSE_WHEEL = 0;
21 static int _ecore_fb_init_count = 0;
22 static int _ecore_fb_console_w = 0;
23 static int _ecore_fb_console_h = 0;
25 static double _ecore_fb_double_click_time = 0.25;
29 * @defgroup Ecore_FB_Library_Group Framebuffer Library Functions
31 * Functions used to set up and shut down the Ecore_Framebuffer functions.
35 * Sets up the Ecore_Fb library.
36 * @param name device target name
37 * @return @c 0 on failure. Otherwise, the number of times the library has
38 * been initialised without being shut down.
39 * @ingroup Ecore_FB_Library_Group
42 ecore_fb_init(const char *name __UNUSED__)
44 if (++_ecore_fb_init_count != 1)
45 return _ecore_fb_init_count;
47 if (!ecore_fb_vt_init())
48 return --_ecore_fb_init_count;
50 ECORE_FB_EVENT_KEY_DOWN = ecore_event_type_new();
51 ECORE_FB_EVENT_KEY_UP = ecore_event_type_new();
52 ECORE_FB_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
53 ECORE_FB_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
54 ECORE_FB_EVENT_MOUSE_MOVE = ecore_event_type_new();
55 ECORE_FB_EVENT_MOUSE_WHEEL = ecore_event_type_new();
56 _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
58 return _ecore_fb_init_count;
62 * Shuts down the Ecore_Fb library.
63 * @return @c The number of times the system has been initialised without
65 * @ingroup Ecore_FB_Library_Group
68 ecore_fb_shutdown(void)
70 if (--_ecore_fb_init_count != 0)
71 return _ecore_fb_init_count;
73 ecore_fb_vt_shutdown();
75 return _ecore_fb_init_count;
80 * Retrieves the width and height of the current frame buffer in pixels.
81 * @param w Pointer to an integer in which to store the width.
82 * @param h Pointer to an interge in which to store the height.
85 ecore_fb_size_get(int *w, int *h)
87 if (w) *w = _ecore_fb_console_w;
88 if (h) *h = _ecore_fb_console_h;
92 _ecore_fb_size_get(int *w, int *h)
94 struct fb_var_screeninfo fb_var;
97 fb = open("/dev/fb0", O_RDWR);
104 if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1)
111 if (w) *w = fb_var.xres;
112 if (h) *h = fb_var.yres;