background redrawing timing tuning
authorsasha <sasha>
Fri, 4 Jan 2008 21:25:57 +0000 (21:25 +0000)
committersasha <sasha>
Fri, 4 Jan 2008 21:25:57 +0000 (21:25 +0000)
src/background.C
src/background.h
src/main.C

index 3270fccb4e052bc1eb97ee868ecfa29419c85301..7a290545fa6293f795031b682188b828b30dee90 100644 (file)
@@ -98,6 +98,7 @@ bgPixmap_t::bgPixmap_t ()
 #endif
   flags = 0;
   pixmap = None;
+  valid_since = invalid_since = 0;
 }
 
 void
@@ -1240,6 +1241,9 @@ bgPixmap_t::render ()
 
   apply ();
 
+  XSync (target->dpy, False);
+  valid_since = ev::now ();
+
   TIMING_TEST_PRINT_RESULT (tp);
 
   return true;
index bd29f32782d1c366a539074dcba0d99ce4d76ae3..41015ca841bf29c7c3f65f92c73205f8ba27ee58 100644 (file)
@@ -98,7 +98,7 @@ struct bgPixmap_t
 
   unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */
 # endif
-  double invalid_since;
+  double invalid_since, valid_since;
 
   Pixmap pixmap;
   unsigned int pmap_width, pmap_height;
index c6d8775ea8943f06b9528d2a03ef6ae26770b867..376304ca6a1b3948b911f78a0c7dc4c1d1144bbf 100644 (file)
@@ -1718,17 +1718,12 @@ rxvt_term::update_background ()
 
   bgPixmap.invalidate ();
 
-  ev_tstamp refresh;
+  ev_tstamp to_wait = 0.5 - (ev::now () - bgPixmap.valid_since);
 
-  if (!bgPixmap.need_client_side_rendering ())
-    refresh = .05;
-  else if (bgPixmap.flags & bgPixmap_t::blurNeeded)
-    /* no chance of real time refresh if we are bluring! */
-    refresh = .50;
+  if ( to_wait <= 0. )
+    bgPixmap.render ();
   else
-    refresh = .07;
-
-  update_background_ev.start (refresh);
+    update_background_ev.start (to_wait);
 }
 
 void