comparison src/X_supp.c @ 83:ea758bb3bbe2

example
author Thinker K.F. Li <thinker@branda.to>
date Fri, 22 Aug 2008 00:12:04 +0800
parents 4bb6451ef036
children 42698de1f653
comparison
equal deleted inserted replaced
82:4bb6451ef036 83:ea758bb3bbe2
68 subject_notify(factory, subject, (event_t *)&mouse_event); 68 subject_notify(factory, subject, (event_t *)&mouse_event);
69 } 69 }
70 70
71 /*! \brief Dispatch all X events in the queue. 71 /*! \brief Dispatch all X events in the queue.
72 */ 72 */
73 static void handle_x_event(Display *display, 73 static void handle_x_event(X_MB_runtime_t *rt) {
74 redraw_man_t *rdman, 74 Display *display = rt->display;
75 mb_tman_t *tman) { 75 redraw_man_t *rdman = rt->rdman;
76 XEvent evt; 76 XEvent evt;
77 XMotionEvent *mevt; 77 XMotionEvent *mevt;
78 XButtonEvent *bevt; 78 XButtonEvent *bevt;
79 XExposeEvent *eevt; 79 XExposeEvent *eevt;
80 co_aix x, y, w, h; 80 co_aix x, y, w, h;
162 * \param tman is a timer manager. 162 * \param tman is a timer manager.
163 * 163 *
164 * The display is managed by specified rdman and tman. rdman draws 164 * The display is managed by specified rdman and tman. rdman draws
165 * on the display, and tman trigger actions according timers. 165 * on the display, and tman trigger actions according timers.
166 */ 166 */
167 void X_MB_handle_connection(Display *display, 167 void X_MB_handle_connection(X_MB_runtime_t *rt) {
168 redraw_man_t *rdman, 168 Display *display = rt->display;
169 mb_tman_t *tman) { 169 redraw_man_t *rdman = rt->rdman;
170 mb_tman_t *tman = rt->tman;
170 int fd; 171 int fd;
171 mb_timeval_t now, tmo; 172 mb_timeval_t now, tmo;
172 struct timeval tv; 173 struct timeval tv;
173 fd_set rfds; 174 fd_set rfds;
174 int nfds; 175 int nfds;
202 get_now(&now); 203 get_now(&now);
203 mb_tman_handle_timeout(tman, &now); 204 mb_tman_handle_timeout(tman, &now);
204 rdman_redraw_changed(rdman); 205 rdman_redraw_changed(rdman);
205 XFlush(display); 206 XFlush(display);
206 } else if(FD_ISSET(fd, &rfds)){ 207 } else if(FD_ISSET(fd, &rfds)){
207 handle_x_event(display, rdman, tman); 208 handle_x_event(rt);
208 } 209 }
209 } 210 }
210 } 211 }
211 212
212 #define ERR -1 213 #define ERR -1
289 xmb_rt->rdman = (redraw_man_t *)malloc(sizeof(redraw_man_t)); 290 xmb_rt->rdman = (redraw_man_t *)malloc(sizeof(redraw_man_t));
290 redraw_man_init(xmb_rt->rdman, xmb_rt->cr, xmb_rt->backend_cr); 291 redraw_man_init(xmb_rt->rdman, xmb_rt->cr, xmb_rt->backend_cr);
291 292
292 xmb_rt->tman = mb_tman_new(); 293 xmb_rt->tman = mb_tman_new();
293 294
295 xmb_rt->last = NULL;
296
294 return OK; 297 return OK;
295 } 298 }
296 299
297 void X_MB_destroy(X_MB_runtime_t *xmb_rt) { 300 void X_MB_destroy(X_MB_runtime_t *xmb_rt) {
298 if(xmb_rt->rdman) { 301 if(xmb_rt->rdman) {