changeset 545:49f8f57f184a Android_Skia

Preparing for nodejs plugin
author Thinker K.F. Li <thinker@branda.to>
date Sat, 05 Jun 2010 22:23:57 +0800
parents 16f4f8305c8f
children 249bcbf07eb0
files src/X_supp.c
diffstat 1 files changed, 42 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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;
+}
+
+/* @} */