From frederik at ofb.net  Mon Jul 25 21:17:47 2016
From: frederik at ofb.net (frederik at ofb.net)
Date: Mon, 25 Jul 2016 12:17:47 -0700
Subject: [Rd] getGraphicsEvent() alternative for cairo graphics device?
In-Reply-To: <CAN_GHySs42vK5U1xZYP8h7ZPdFyOcHnEZK4Sn91e7htv=7E54A@mail.gmail.com>
References: <CAN_GHySs42vK5U1xZYP8h7ZPdFyOcHnEZK4Sn91e7htv=7E54A@mail.gmail.com>
Message-ID: <20160725191747.GB18530@ofb.net>

Dear Daniel Greenidge,

To enable getGraphicsEvent on Cairo, you have two patches to choose
from:

https://bugs.r-project.org/bugzilla/show_bug.cgi?id=14364
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16951

The second one is by me, and the first one is from five years ago by
Hugo Mildenberger.

Both patches are very simple, they move some lines enabling
getGrahpicsEvent outside of a if(!cairo) statement. My patch also adds
the ability to execute code (e.g. for animation) while the interface
is idle.

Top guy Duncan Murdoch has expressed that he doesn't have time to work
on applying these patches, and I haven't had any responses from the
rest of the R Core Team. I was thinking that perhaps your best bet is
to try to create a package called e.g. "X11-fixes" which people can
use to get a better X11 library (there is also a bug waiting to be
fixed from 2001:
https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16702).

I don't know if CRAN would accept such a package, or if you'd have to
distribute it via GitHub, but R has excellent tools to facilitate the
distribution of code via packages. Whether the R kernel exports enough
functions to allow a package to take over event handling, I'm not
sure. I was intending to look more into the details of this
possibility but haven't had time.

Best wishes,

Frederick

On Mon, Jul 25, 2016 at 02:15:59PM -0400, Daniel Greenidge wrote:
> Hi all,
> 
> I'm writing an interactive plotting function for viewing fMRI
> datasets. Currently, I get keypresses using
> grDevices::getGraphicsEvent().
> 
> Unfortunately getGraphicsEvent() only supports the X11(type="Xlib")
> graphics device on Unix systems. The Xlib device doesn't support
> buffering (i.e. dev.hold() and dev.flush()), so redrawing the plots
> causes lots of flickering.
> 
> Is there a way to get keypresses while using the cairo graphics
> device? Alternatively, is there a way to prevent flickering with the
> Xlib graphics device?
> 
> Best,
> Daniel Greenidge
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] getGraphicsEvent() alternative for cairo graphics device?
frederik at ofb.net