# HG changeset patch # User Thinker K.F. Li # Date 1275747837 -28800 # Node ID 49f8f57f184ad06df0d71d14ee713932cbf6960a # Parent 16f4f8305c8f3c486247fc4ce80b1ad8fe8c8d90 Preparing for nodejs plugin diff -r 16f4f8305c8f -r 49f8f57f184a src/X_supp.c --- a/src/X_supp.c Fri Jun 04 22:29:26 2010 +0800 +++ b/src/X_supp.c Sat Jun 05 22:23:57 2010 +0800 @@ -48,6 +48,8 @@ monitor_t monitors[MAX_MONITORS]; int n_monitor; + void *nodejs_data; + #ifndef ONLY_MOUSE_MOVE_RAW /* States */ shape_t *last; @@ -595,7 +597,7 @@ return img_ldr; } -void X_add_event(void *rt, int type, int fd, mb_eventcb_t f,void *arg) +void X_MB_add_event(void *rt, int type, int fd, mb_eventcb_t f,void *arg) { X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; int i; @@ -625,7 +627,7 @@ xmb_rt->n_monitor=i; } -void X_remove_event(void *rt, int type, int fd) +void X_MB_remove_event(void *rt, int type, int fd) { X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; int i; @@ -638,8 +640,8 @@ } mb_backend_t backend = { X_MB_new, X_MB_free, - X_add_event, - X_remove_event, + X_MB_add_event, + X_MB_remove_event, X_MB_handle_connection, X_MB_kbevents, X_MB_rdman, @@ -647,4 +649,39 @@ X_MB_ob_factory, X_MB_img_ldr }; - +/*! \defgroup x_supp_nodejs_sup Export functions for supporting nodejs plugin. + * + * These functions are for internal using. + * @{ + */ +/*! \brief Exported for nodejs plugin to call handle_x_event. + */ +void _X_MB_handle_x_event_for_nodejs(X_MB_runtime_t *rt) { + handle_x_event(rt); +} + +/*! \brief Get X connect for nodejs plugin. + */ +int _X_MB_get_x_conn_for_nodejs(X_MB_runtime_t *rt) { + return XConnectionNumber(rt->display); +} + +/*! \brief Flush buffer for the X connection of a runtime object. + */ +int _X_MB_flush_x_conn_nodejs(X_MB_runtime_t *rt) { + return XFlush(rt->display); +} + +/*! \brief Keep data for nodejs plugin. + */ +void _X_MB_set_data_nodejs(X_MB_runtime_t *rt, void *data) { + rt->nodejs_data = data; +} + +/*! \brief Get data for nodejs plugin. + */ +void *_X_MB_get_data_nodejs(X_MB_runtime_t *rt) { + return rt->nodejs_data; +} + +/* @} */