# HG changeset patch # User Thinker K.F. Li # Date 1290357750 -28800 # Node ID d5b8853767e702fa34d04ffb4f74165249a784af # Parent 914add76c2104e3ad415ff155b9071f8ef457c3c Add flush function to mb_backend_t diff -r 914add76c210 -r d5b8853767e7 include/mb_backend.h --- a/include/mb_backend.h Mon Nov 22 00:42:30 2010 +0800 +++ b/include/mb_backend.h Mon Nov 22 00:42:30 2010 +0800 @@ -46,6 +46,7 @@ mb_rt_t *(*new_with_win)(MB_DISPLAY display, MB_WINDOW win); void (*free)(mb_rt_t *rt); + void (*free_keep_win)(mb_rt_t *rt); /*! \brief Request the backend to start monitoring a file descriptor. * * This is used only when the backend is responsible for event loop. @@ -64,6 +65,9 @@ * mb_IO_factory_t) with the backend. */ void (*event_loop)(mb_rt_t *rt); + + /*! \brief Flush requests to screen server if existed */ + int (*flush)(mb_rt_t *rt); subject_t *(*kbevents)(mb_rt_t *rt); redraw_man_t *(*rdman)(mb_rt_t *rt); diff -r 914add76c210 -r d5b8853767e7 src/X_supp.c --- a/src/X_supp.c Mon Nov 22 00:42:30 2010 +0800 +++ b/src/X_supp.c Mon Nov 22 00:42:30 2010 +0800 @@ -1188,13 +1188,24 @@ io_man->unreg(io_man, hdl); } +static int +_x_mb_flush(mb_rt_t *rt) { + X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; + int r; + + r = XFlush(xmb_rt->display); + return r == 0? ERR: OK; +} + mb_backend_t backend = { X_MB_new, X_MB_new_with_win, X_MB_free, + X_MB_free_keep_win, X_MB_add_event, X_MB_remove_event, _x_mb_event_loop, + _x_mb_flush, X_MB_kbevents, X_MB_rdman,