changeset 1021:4f4abce1b5df refine_backend_if

Move X_main.c to mb_timer_man_t
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 22 Nov 2010 14:02:01 +0800
parents f25b8ad338b4
children 84006acab6af
files src/X_main.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/X_main.c	Mon Nov 22 13:57:59 2010 +0800
+++ b/src/X_main.c	Mon Nov 22 14:02:01 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
@@ -136,6 +137,7 @@
     grad_stop_t fill3_stops[3];
     mbe_font_face_t *face;
     struct timeval tv;
+    mb_timer_man_t *timer_man;
     mb_tman_t *tman;
     mb_timeval_t mbtv, start, playing;
     mb_progm_t *progm;
@@ -207,8 +209,10 @@
 
     XFlush(display);
 
-    tman = mb_tman_new();
-    if(tman) {
+    timer_man = mb_timer_man_new(&tman_timer_factory);
+    if(timer_man) {
+	tman = mb_tman_new();
+	
 	/* 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);
 
 	mb_progm_free(progm);
-	mb_tman_free(tman);
+	mb_timer_man_free(&tman_timer_factory, timer_man);
     }
 
     rdman_paint_free(&rdman, fill1);