changeset 1024:63f2f1daf5d3 refine_backend_if

X_main.c works with new backend definition
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 22 Nov 2010 15:38:11 +0800
parents dffecd62817c
children 32425882e351
files src/X_main.c src/animate.c
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/X_main.c	Mon Nov 22 15:27:40 2010 +0800
+++ b/src/X_main.c	Mon Nov 22 15:38:11 2010 +0800
@@ -70,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);
 
@@ -138,7 +141,6 @@
     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;
     mb_word_t *word;
@@ -211,8 +213,6 @@
 
     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);
 
@@ -406,7 +406,7 @@
 	MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec);
 	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_timer_man_free(&tman_timer_factory, timer_man);
--- a/src/animate.c	Mon Nov 22 15:27:40 2010 +0800
+++ b/src/animate.c	Mon Nov 22 15:38:11 2010 +0800
@@ -334,7 +334,7 @@
 
     timer = mb_timer_man_timeout(timer_man, &progm->words[0].abs_start,
 				 mb_progm_step, progm);
-    ASSERT(timer != NULL);
+    ASSERT(timer != -1);
 
     /* We need timer to abort it. */
     progm->cur_timer = timer;