improved flickering on move/resize with transparent background
authorsasha <sasha>
Tue, 18 Sep 2007 22:01:36 +0000 (22:01 +0000)
committersasha <sasha>
Tue, 18 Sep 2007 22:01:36 +0000 (22:01 +0000)
src/background.C
src/background.h
src/command.C
src/main.C
src/screen.C

index 81bae2f176b39c9164edfc1b9a695b9795e7ee40..26c808431ac87786b50b472f2827ab02939f3765 100644 (file)
@@ -1219,11 +1219,9 @@ bgPixmap_t::apply()
               XSetWindowBackground (target->dpy, target->scrollBar.win, target->pix_colors[Color_border]);
 # endif
         }
-
-      /* don't want Expose on the parent */
-      XClearArea (target->dpy, target->parent[0], 0, 0, 0, 0, False);
-      /* do want Expose on the vt, so we get refreshed properly */
-      XClearArea (target->dpy, target->vt, 0, 0, 0, 0, True);
+      /* don't want Expose on the parent or vt. It is better to use 
+         scr_touch or we get a great deal of flicker otherwise: */
+      XClearWindow (target->dpy, target->parent[0]);
 
 # if HAVE_SCROLLBARS
       if (target->scrollBar.win)
@@ -1232,6 +1230,9 @@ bgPixmap_t::apply()
           target->scrollbar_show (0);
         }
 # endif
+
+      target->want_refresh = 1;
+      flags |= hasChanged;
     }
 }
 
index 698bae664add4bd8b80a0d81957e759db4e63539..1e12606f4f6039e119e623cb47b8d3a08bc20d02 100644 (file)
@@ -30,8 +30,9 @@ struct  bgPixmap_t {
 
     isTransparent   = (1UL<<16),
     isInvalid       = (1UL<<17),
-    isVtOrigin      = (1UL<<18)  /* if set pixmap has origin at corner of
+    isVtOrigin      = (1UL<<18),  /* if set pixmap has origin at corner of
                                     vt window instead of parent[0]! */
+    hasChanged      = (1UL<<19)
   };
 
   unsigned long flags;
@@ -43,6 +44,8 @@ struct  bgPixmap_t {
     transpTransformations = (tintNeeded|blurNeeded)
   }; /* this flags are returned by make_transparency_pixmap if called */
 
+  bool check_clearChanged () { bool r = flags & hasChanged; flags &= ~hasChanged; return r; };
+  
 # ifdef  BG_IMAGE_FROM_FILE
 #  ifdef HAVE_AFTERIMAGE
   ASImage *original_asim;
index 22fb4c41ab82c62553bfdb15dbdf0be6393a30e5..326d02fd406739df9366d75263c875fc50acc095 100644 (file)
@@ -1036,6 +1036,14 @@ void
 rxvt_term::flush ()
 {
   flush_ev.stop ();
+  
+#ifdef HAVE_BG_PIXMAP  
+  if (bgPixmap.check_clearChanged ())
+    {
+      scr_clear (true);
+      scr_touch (false);
+    }
+#endif
 
   if (want_refresh)
     {
@@ -1468,9 +1476,9 @@ rxvt_term::x_cb (XEvent &ev)
         break;
 
       case ConfigureNotify:
-/*      fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
+      /* fprintf (stderr, "ConfigureNotify for %X, parent is %X, geom is %dx%d%+d%+d, old geom was %dx%d\n",
               ev.xconfigure.window, parent[0], ev.xconfigure.width, ev.xconfigure.height, ev.xconfigure.x, ev.xconfigure.y,
-              szHint.width, szHint.height);*/
+              szHint.width, szHint.height); */
         if (ev.xconfigure.window == parent[0])
           {
             while (XCheckTypedWindowEvent (dpy, ev.xconfigure.window, ConfigureNotify, &ev))
@@ -1534,16 +1542,19 @@ rxvt_term::x_cb (XEvent &ev)
         if (ev.xany.window == vt)
           {
             do
-              scr_expose (ev.xexpose.x, ev.xexpose.y,
-                          ev.xexpose.width, ev.xexpose.height, False);
+              {
+                scr_expose (ev.xexpose.x, ev.xexpose.y,
+                            ev.xexpose.width, ev.xexpose.height, False);
+              }
             while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev));
 
             ev.xany.type = ev.xany.type == Expose ? GraphicsExpose : Expose;
 
             while (XCheckTypedWindowEvent (dpy, vt, ev.xany.type, &ev))
-              scr_expose (ev.xexpose.x, ev.xexpose.y,
-                          ev.xexpose.width, ev.xexpose.height, False);
-
+              {
+                scr_expose (ev.xexpose.x, ev.xexpose.y,
+                            ev.xexpose.width, ev.xexpose.height, False);
+              }
             want_refresh = 1;
           }
         else
index 6b6d4257baa67760c3e152829c3144468549e01e..3956f1324df531f765e0b722680f1d9e5b78cf7f 100644 (file)
@@ -1735,11 +1735,11 @@ rxvt_term::get_pixmap_property (int prop_id)
 int
 rxvt_term::update_background ()
 {
-  bgPixmap.invalidate();
+  bgPixmap.invalidate ();
 
   /* no chance of real time refresh if we are blurring ! */
   if (bgPixmap.invalid_since + 0.5 < NOW && !(bgPixmap.flags & bgPixmap_t::blurNeeded))
-    bgPixmap.render();
+    bgPixmap.render ();
   else
     {
       update_background_ev.stop ();
index 24a1d9eea3acf956e1b5d2f60afd44a4d115d29f..c8e9dfa660087e7663f5a6af9d82d1be2aa1efa7 100644 (file)
@@ -2486,11 +2486,11 @@ rxvt_term::scr_recolour () NOTHROW
      scrollbar_show (0);
    }
 # endif
-#endif
-  
   scr_clear ();
   scr_touch (true);
   want_refresh = 1;
+#endif
+  
 }
 
 /* ------------------------------------------------------------------------- */