Bill Allombert on Mon, 15 Apr 2002 18:53:09 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: X plotting


On Fri, Apr 12, 2002 at 03:49:04PM -0400, Ilya Zakharevich wrote:
> Yesterday I used X plotting of GP/PARI (the first time after a long
> time) and found it wanting.
> 
> The default setup here, in MSRI, is some Win95-like X window manager
> (fwm95?).  It includes a stay-on-top status bar at bottom, and some
> kind of switch-the-desktop stay-on-top bar on the right.
> 
> Given that
> 
>   a) X plotting window would not redraw if part of it is obscured;

This is a bug. If I understand correctly the bug is only on X servers
that do not support backing-store.
You can check for backing-store support with

% xdpyinfo | grep backing-store
  options:    backing-store NO, save-unders NO

The following patch checks for becking-store support before using it.

Does it fix the problem for everybody ?

Cheers,

Bill.


Index: src/graph/plotX.c
===================================================================
RCS file: /home/megrez/cvsroot/pari/src/graph/plotX.c,v
retrieving revision 1.7
diff -u -r1.7 plotX.c
--- src/graph/plotX.c	2001/03/20 00:03:59	1.7
+++ src/graph/plotX.c	2002/04/15 16:53:15
@@ -136,6 +136,7 @@
   long *xtexts[MAX_COLORS],*ytexts[MAX_COLORS];
   long rcolcnt[MAX_COLORS][ROt_MAX];
   long col,i,j,x0,y0,a,b,oldwidth,oldheight,force;
+  long do_backing_store;
   long rcnt[ROt_MAX+1], hjust, vjust, hgap, vgap, hgapsize, vgapsize;
   char **texts[MAX_COLORS];
   PariRect *e;
@@ -221,6 +222,7 @@
   }
 
   screen = DefaultScreen(display);
+  do_backing_store = DoesBackingStore(ScreenOfDisplay(display,screen))==Always;
   win = XCreateSimpleWindow
     (display, RootWindow(display, screen), 0, 0, w_width, w_height,
      4, BlackPixel(display, screen), WhitePixel(display, screen));
@@ -248,6 +250,7 @@
   gc = XCreateGC(display, win, 0, NULL);
   XSetFont(display, gc, font_info->fid);
 
+  XClearWindow(display, win);
   XMapWindow(display, win);
   oldwidth  = w_width;
   oldheight = w_height; force = 1;
@@ -286,7 +289,7 @@
         /* recompute scale */
 	xs = ((double)width)/w_width; ys=((double)height)/w_height;
       }
-      case Expose: if (!force) break;
+      case Expose: if ( do_backing_store && !force) break;
         force = 0;
 	for(i=0; i<lw; i++)
 	{