Mercurial > MadButterfly
diff include/mb_redraw_man.h @ 462:af4b506ad56f
Add backend layer to seperate the backend with the MBAF. Currently, X is the only backend. If we have more than one backend, we need to modify the Makefile to sleect the backend or implement a backend selection mechanism in the runtime.
author | wycc@122-116-38-188.HINET-IP.hinet.net |
---|---|
date | Wed, 28 Oct 2009 02:39:02 +0800 |
parents | 16116d84bc5e |
children | 5d0b2761f89c |
line wrap: on
line diff
--- a/include/mb_redraw_man.h Wed Oct 28 02:35:08 2009 +0800 +++ b/include/mb_redraw_man.h Wed Oct 28 02:39:02 2009 +0800 @@ -6,6 +6,7 @@ #include "mb_types.h" #include "mb_observer.h" #include "mb_img_ldr.h" +#include "mb_timer.h" typedef struct _redraw_man redraw_man_t; @@ -225,4 +226,35 @@ extern paint_t *rdman_img_ldr_load_paint(redraw_man_t *rdman, const char *img_id); +typedef void (*mb_eventcb_t )(int fd,void *arg); +#define MONITOR_READ 1 +#define MONITOR_WRITE 2 + +/*! \brief The backend engine mb_backend_t is used to define the interface to realize the MB. + * + * A backend is used to receive events from the system. The MB does not define the backend by itself. + * Instead, it define an interface which allow the lower layer to implement the event system. Each + * backend need to provides the following events. + * + * - keyboard event + * - timer event + * - image loader(?) + * - render manager(?) + */ +typedef struct { + + void *(*init)(char *display,int w,int h); + void (*free)(void *be); + void (*add_event)(void *be,int type, int fd, mb_eventcb_t f,void *arg); + void (*remove_event)(void *be,int type, int fd); + void (*loop)(void *be); + subject_t *(*kbevents)(void *be); + redraw_man_t *(*rdman)(void *be); + mb_tman_t *(*tman)(void *be); + ob_factory_t *(*factory)(void *be); + mb_img_ldr_t *(*loader)(void *be); +} mb_backend_t; + +extern mb_backend_t backend; + #endif /* __REDRAW_MAN_H_ */