Mercurial > MadButterfly
comparison include/mb_backend.h @ 1011:02d52058d352 refine_backend_if
Make functions of X_supp.c static and fill fields of backend.
- Make most functions in X_supp.c static
- fill fields of backend variable.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 22 Nov 2010 00:42:30 +0800 |
parents | 595a06fc0157 |
children | d5b8853767e7 |
comparison
equal
deleted
inserted
replaced
1010:feea3784b7ff | 1011:02d52058d352 |
---|---|
22 typedef struct _mb_timer_factory mb_timer_factory_t; | 22 typedef struct _mb_timer_factory mb_timer_factory_t; |
23 typedef struct _mb_IO_man mb_IO_man_t; | 23 typedef struct _mb_IO_man mb_IO_man_t; |
24 typedef struct _mb_IO_factory mb_IO_factory_t; | 24 typedef struct _mb_IO_factory mb_IO_factory_t; |
25 typedef enum _MB_IO_TYPE MB_IO_TYPE; | 25 typedef enum _MB_IO_TYPE MB_IO_TYPE; |
26 | 26 |
27 /*! \brief Function signature of callback functions for IO requests. | |
28 */ | |
29 typedef void (*mb_IO_cb_t)(int hdl, int fd, MB_IO_TYPE type, void *data); | |
30 | |
27 /*! \brief The backend engine mb_backend_t is used to define the | 31 /*! \brief The backend engine mb_backend_t is used to define the |
28 * interface to realize the MB. | 32 * interface to realize the MB. |
29 * | 33 * |
30 * A backend is used to receive events from the system. The MB does | 34 * A backend is used to receive events from the system. The MB does |
31 * not define the backend by itself. Instead, it define an interface | 35 * not define the backend by itself. Instead, it define an interface |
37 * - image loader(?) | 41 * - image loader(?) |
38 * - render manager(?) | 42 * - render manager(?) |
39 */ | 43 */ |
40 typedef struct { | 44 typedef struct { |
41 mb_rt_t *(*new)(const char *display, int w,int h); | 45 mb_rt_t *(*new)(const char *display, int w,int h); |
42 mb_rt_t *(*new_with_win)(const char *display, MB_WINDOW win, int w,int h); | 46 mb_rt_t *(*new_with_win)(MB_DISPLAY display, MB_WINDOW win); |
43 | 47 |
44 void (*free)(mb_rt_t *rt); | 48 void (*free)(mb_rt_t *rt); |
45 /*! \brief Request the backend to start monitoring a file descriptor. | 49 /*! \brief Request the backend to start monitoring a file descriptor. |
46 * | 50 * |
47 * This is used only when the backend is responsible for event loop. | 51 * This is used only when the backend is responsible for event loop. |
48 */ | 52 */ |
49 int (*add_event)(mb_rt_t *rt, int fd, MB_IO_TYPE type, | 53 int (*add_event)(mb_rt_t *rt, int fd, MB_IO_TYPE type, |
50 mb_eventcb_t f,void *arg); | 54 mb_IO_cb_t f,void *arg); |
51 /*! \brief Request the backend to stop monitoring a file descriptor. | 55 /*! \brief Request the backend to stop monitoring a file descriptor. |
52 * | 56 * |
53 * This is used only when the backend is responsible for event loop. | 57 * This is used only when the backend is responsible for event loop. |
54 */ | 58 */ |
55 void (*remove_event)(mb_rt_t *rt, int hdl); | 59 void (*remove_event)(mb_rt_t *rt, int hdl); |
78 extern mb_backend_t backend; | 82 extern mb_backend_t backend; |
79 | 83 |
80 /*! \brief Type of IO that registered with an IO manager. | 84 /*! \brief Type of IO that registered with an IO manager. |
81 */ | 85 */ |
82 enum _MB_IO_TYPE {MB_IO_DUMMY, MB_IO_R, MB_IO_W, MB_IO_RW}; | 86 enum _MB_IO_TYPE {MB_IO_DUMMY, MB_IO_R, MB_IO_W, MB_IO_RW}; |
83 | |
84 /*! \brief Function signature of callback functions for IO requests. | |
85 */ | |
86 typedef void (*mb_IO_cb_t)(int hdl, int fd, MB_IO_TYPE type, void *data); | |
87 | 87 |
88 /*! \brief IO Manager | 88 /*! \brief IO Manager |
89 */ | 89 */ |
90 struct _mb_IO_man { | 90 struct _mb_IO_man { |
91 int (*reg)(struct _mb_IO_man *io_man, | 91 int (*reg)(struct _mb_IO_man *io_man, |