[Rd] devX11.c -- questions about expose events and XBell

Thomas Vogels Thomas Vogels <tov@ece.cmu.edu>
13 Feb 2001 18:19:49 -0500


Hi,  sorry for lumping this together...  Both these issues are rather
small, and I'm not sure either qualifies as a bug...

1) After a window id created in X11_Open and mapped,  you "gobble the
   expose events".  Not true, you gobble any event that comes along!
   The code below fixes this by using *XCheckTypedEvent*.  Hmm, I'm
   not sure this right already, but better...

*** devX11.c~    Tue Feb 13 17:24:40 2001
--- devX11.c    Tue Feb 13 18:07:41 2001
***************
*** 1232,1242 ****
  
        /* Gobble expose events */
  
!       XNextEvent(display, &event);
!       if (event.xany.type == Expose) {
!           while (event.xexpose.count)
!               XNextEvent(display, &event);
!       }
      } else { /* PIXMAP */
        xd->windowWidth = iw = w;
        xd->windowHeight = ih = h;
--- 1232,1241 ----
  
        /* Gobble expose events */
  
!       if (XCheckTypedEvent(display, Expose, &event)) {
!           while (event.xexpose.count)
!               XNextEvent(display, &event);
!       }
      } else { /* PIXMAP */
        xd->windowWidth = iw = w;
        xd->windowHeight = ih = h;


2) There are beeps from X11_Locator for every successful mouse click.
   The code here assumes that stderr is connected to a terminal.
   This is not always true!  When I run R within an ESS session in
   emacs, I get ^G  but no sound.  When I redirect the output, I get
   nothing...  *Question* Why don't you use *XBell*?

*** devX11.c~    Tue Feb 13 17:24:40 2001
--- devX11.c    Tue Feb 13 18:07:41 2001
***************
*** 1880,1887 ****
                if (event.xbutton.button == Button1) {
                    *x = event.xbutton.x;
                    *y = event.xbutton.y;
!                   fprintf(stderr, "\07");
!                   fflush(stderr);
                    XSync(display, 0);
                    done = 1;
                }
--- 1879,1885 ----
                if (event.xbutton.button == Button1) {
                    *x = event.xbutton.x;
                    *y = event.xbutton.y;
!                   XBell (display, 0);
                    XSync(display, 0);
                    done = 1;
                }
   

Regards,
  -tom

-- 
mailto:tov@ece.cmu.edu (Tom Vogels)   Tel: (412) 268-6638   FAX: -3204

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._