Mercurial > MadButterfly
comparison src/X_supp.c @ 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 | feea3784b7ff |
children | 914add76c210 |
comparison
equal
deleted
inserted
replaced
1010:feea3784b7ff | 1011:02d52058d352 |
---|---|
1073 | 1073 |
1074 xmb_rt->display = display; | 1074 xmb_rt->display = display; |
1075 xmb_rt->win = win; | 1075 xmb_rt->win = win; |
1076 } | 1076 } |
1077 | 1077 |
1078 void *X_MB_new(const char *display_name, int w, int h) { | 1078 static mb_rt_t * |
1079 X_MB_new(const char *display_name, int w, int h) { | |
1079 X_MB_runtime_t *rt; | 1080 X_MB_runtime_t *rt; |
1080 int r; | 1081 int r; |
1081 | 1082 |
1082 rt = O_ALLOC(X_MB_runtime_t); | 1083 rt = O_ALLOC(X_MB_runtime_t); |
1083 if(rt == NULL) | 1084 if(rt == NULL) |
1095 /*! \brief Create a new runtime for existed window for X. | 1096 /*! \brief Create a new runtime for existed window for X. |
1096 * | 1097 * |
1097 * The object returned by this function must be free with | 1098 * The object returned by this function must be free with |
1098 * X_MB_free_keep_win() to prevent the window from closed. | 1099 * X_MB_free_keep_win() to prevent the window from closed. |
1099 */ | 1100 */ |
1100 void *X_MB_new_with_win(Display *display, Window win) { | 1101 static mb_rt_t * |
1102 X_MB_new_with_win(MB_DISPLAY display, MB_WINDOW win) { | |
1101 X_MB_runtime_t *rt; | 1103 X_MB_runtime_t *rt; |
1102 int r; | 1104 int r; |
1103 | 1105 |
1104 rt = O_ALLOC(X_MB_runtime_t); | 1106 rt = O_ALLOC(X_MB_runtime_t); |
1105 if(rt == NULL) | 1107 if(rt == NULL) |
1112 } | 1114 } |
1113 | 1115 |
1114 return rt; | 1116 return rt; |
1115 } | 1117 } |
1116 | 1118 |
1117 void X_MB_free(void *rt) { | 1119 static void |
1120 X_MB_free(void *rt) { | |
1118 X_MB_destroy((X_MB_runtime_t *) rt); | 1121 X_MB_destroy((X_MB_runtime_t *) rt); |
1119 free(rt); | 1122 free(rt); |
1120 } | 1123 } |
1121 | 1124 |
1122 /*! \brief Free runtime created with X_MB_new_with_win(). | 1125 /*! \brief Free runtime created with X_MB_new_with_win(). |
1123 */ | 1126 */ |
1124 void | 1127 static void |
1125 X_MB_free_keep_win(void *rt) { | 1128 X_MB_free_keep_win(void *rt) { |
1126 X_MB_destroy_keep_win((X_MB_runtime_t *) rt); | 1129 X_MB_destroy_keep_win((X_MB_runtime_t *) rt); |
1127 free(rt); | 1130 free(rt); |
1128 } | 1131 } |
1129 | 1132 |
1130 subject_t *X_MB_kbevents(void *rt) { | 1133 static subject_t * |
1134 X_MB_kbevents(void *rt) { | |
1131 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 1135 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
1132 return xmb_rt->kbinfo.kbevents; | 1136 return xmb_rt->kbinfo.kbevents; |
1133 } | 1137 } |
1134 | 1138 |
1135 redraw_man_t *X_MB_rdman(void *rt) { | 1139 static redraw_man_t * |
1140 X_MB_rdman(void *rt) { | |
1136 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 1141 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
1137 return xmb_rt->rdman; | 1142 return xmb_rt->rdman; |
1138 } | 1143 } |
1139 | 1144 |
1140 mb_timer_man_t *X_MB_timer_man(void *rt) { | 1145 static mb_timer_man_t * |
1146 X_MB_timer_man(void *rt) { | |
1141 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 1147 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
1142 return xmb_rt->timer_man; | 1148 return xmb_rt->timer_man; |
1143 } | 1149 } |
1144 | 1150 |
1145 ob_factory_t *X_MB_ob_factory(void *rt) { | 1151 static ob_factory_t * |
1152 X_MB_ob_factory(void *rt) { | |
1146 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 1153 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
1147 ob_factory_t *factory; | 1154 ob_factory_t *factory; |
1148 | 1155 |
1149 factory = rdman_get_ob_factory(xmb_rt->rdman); | 1156 factory = rdman_get_ob_factory(xmb_rt->rdman); |
1150 return factory; | 1157 return factory; |
1151 } | 1158 } |
1152 | 1159 |
1153 mb_img_ldr_t *X_MB_img_ldr(void *rt) { | 1160 static mb_img_ldr_t * |
1161 X_MB_img_ldr(void *rt) { | |
1154 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 1162 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
1155 mb_img_ldr_t *img_ldr; | 1163 mb_img_ldr_t *img_ldr; |
1156 | 1164 |
1157 img_ldr = xmb_rt->img_ldr; | 1165 img_ldr = xmb_rt->img_ldr; |
1158 | 1166 |
1159 return img_ldr; | 1167 return img_ldr; |
1160 } | 1168 } |
1161 | 1169 |
1162 int X_MB_add_event(void *rt, int fd, MB_IO_TYPE type, | 1170 static int |
1163 mb_IO_cb_t cb, void *data) | 1171 X_MB_add_event(mb_rt_t *rt, int fd, MB_IO_TYPE type, |
1172 mb_IO_cb_t cb, void *data) | |
1164 { | 1173 { |
1165 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 1174 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
1166 mb_IO_man_t *io_man = xmb_rt->io_man; | 1175 mb_IO_man_t *io_man = xmb_rt->io_man; |
1167 int hdl; | 1176 int hdl; |
1168 | 1177 |
1169 hdl = io_man->reg(io_man, fd, type, cb, data); | 1178 hdl = io_man->reg(io_man, fd, type, cb, data); |
1170 return hdl; | 1179 return hdl; |
1171 } | 1180 } |
1172 | 1181 |
1173 void X_MB_remove_event(void *rt, int hdl) | 1182 static void |
1183 X_MB_remove_event(mb_rt_t *rt, int hdl) | |
1174 { | 1184 { |
1175 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; | 1185 X_MB_runtime_t *xmb_rt = (X_MB_runtime_t *) rt; |
1176 mb_IO_man_t *io_man = xmb_rt->io_man; | 1186 mb_IO_man_t *io_man = xmb_rt->io_man; |
1177 | 1187 |
1178 io_man->unreg(io_man, hdl); | 1188 io_man->unreg(io_man, hdl); |
1182 X_MB_new_with_win, | 1192 X_MB_new_with_win, |
1183 | 1193 |
1184 X_MB_free, | 1194 X_MB_free, |
1185 X_MB_add_event, | 1195 X_MB_add_event, |
1186 X_MB_remove_event, | 1196 X_MB_remove_event, |
1187 X_MB_handle_connection, | 1197 _x_mb_event_loop, |
1188 | 1198 |
1189 X_MB_kbevents, | 1199 X_MB_kbevents, |
1190 X_MB_rdman, | 1200 X_MB_rdman, |
1191 X_MB_tman, | 1201 X_MB_timer_man, |
1192 X_MB_ob_factory, | 1202 X_MB_ob_factory, |
1193 X_MB_img_ldr | 1203 X_MB_img_ldr |
1194 }; | 1204 }; |
1195 /*! \defgroup x_supp_nodejs_sup Export functions for supporting nodejs plugin. | 1205 /*! \defgroup x_supp_nodejs_sup Export functions for supporting nodejs plugin. |
1196 * | 1206 * |