diff src/X_main.c @ 1044:5d4bc2a93c09

Merge from refine_backend_if branch
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 23 Nov 2010 11:58:04 +0800
parents 63f2f1daf5d3
children d09f603438d8
line wrap: on
line diff
--- a/src/X_main.c	Tue Nov 23 08:04:09 2010 +0800
+++ b/src/X_main.c	Tue Nov 23 11:58:04 2010 +0800
@@ -15,6 +15,7 @@
 #include "mb_paint.h"
 #include "mb_timer.h"
 #include "mb_animate.h"
+#include "mb_backend_utils.h"
 
 #define OK 0
 #define ERR -1
@@ -69,15 +70,18 @@
     XFlush(display);
 }
 
-void handle_connection(Display *display, mb_tman_t *tman,
+void handle_connection(Display *display, mb_timer_man_t *timer_man,
 		       redraw_man_t *rdman, int w, int h) {
     int xcon;
     fd_set rds;
     int nfds;
     struct timeval tmo;
     mb_timeval_t mb_tmo, next_mb_tmo;
+    mb_tman_t *tman;
     int r;
 
+    tman = tman_timer_man_get_tman(timer_man);
+
     XSelectInput(display, win, PointerMotionMask | ExposureMask);
     XFlush(display);
 
@@ -136,7 +140,7 @@
     grad_stop_t fill3_stops[3];
     mbe_font_face_t *face;
     struct timeval tv;
-    mb_tman_t *tman;
+    mb_timer_man_t *timer_man;
     mb_timeval_t mbtv, start, playing;
     mb_progm_t *progm;
     mb_word_t *word;
@@ -207,8 +211,8 @@
 
     XFlush(display);
 
-    tman = mb_tman_new();
-    if(tman) {
+    timer_man = mb_timer_man_new(&tman_timer_factory);
+    if(timer_man) {
 	/* Prepare an animation program. */
 	progm = mb_progm_new(30, &rdman);
 
@@ -400,12 +404,12 @@
 	/* Start playing the program. */
 	gettimeofday(&tv, NULL);
 	MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec);
-	mb_progm_start(progm, tman, &mbtv);
+	mb_progm_start(progm, timer_man, &mbtv);
 
-	handle_connection(display, tman, &rdman, w, h);
+	handle_connection(display, timer_man, &rdman, w, h);
 
 	mb_progm_free(progm);
-	mb_tman_free(tman);
+	mb_timer_man_free(&tman_timer_factory, timer_man);
     }
 
     rdman_paint_free(&rdman, fill1);