From ripley at stats.ox.ac.uk  Sat May  5 16:22:30 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 5 May 2007 15:22:30 +0100 (BST)
Subject: [Rd] Qt device update
In-Reply-To: <17980.36606.321639.460692@stat.math.ethz.ch>
References: <eb555e660705031752p5a96153fifaabd0d5fdf0bdeb@mail.gmail.com>
	<7B29DCD1-E483-482B-8CCE-526305FE2E9F@r-project.org>
	<Pine.LNX.4.64.0705042200220.29064@gannet.stats.ox.ac.uk>
	<17980.36606.321639.460692@stat.math.ethz.ch>
Message-ID: <Pine.LNX.4.64.0705051521050.15149@gannet.stats.ox.ac.uk>

On Sat, 5 May 2007, Martin Maechler wrote:

>>>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk>
>>>>>>     on Fri, 4 May 2007 22:09:58 +0100 (BST) writes:
>
>    BDR> On Fri, 4 May 2007, Simon Urbanek wrote:
>    >>  On May 3, 2007, at 8:52 PM, Deepayan Sarkar wrote:
>    >>
>    >>> [...] I have a couple of related questions. First,
>    >>> dev.interactive (), used in example() and many demo()-s
>    >>> to decide if the current device is interactive, is
>    >>> currently implemented as:
>    >>>
>    >>>> dev.interactive
>    >>> function (orNone = FALSE) { iDevs <- c("X11", "GTK",
>    >>> "gnome", "quartz", "windows", "JavaGD") interactive() &&
>    >>> (.Device %in% iDevs || (orNone && .Device == "null
>    >>> device" && getOption("device") %in% iDevs)) }
>    >>>
>    >>> This makes it impossible for new devices to be treated
>    >>> as interactive.
>    >>
>    >>
>    >> I think we should finally pass this question to the
>    >> device itself.  For some devices like Cairo the answer
>    >> depends on the parameters with which the device was
>    >> created (e.g. type='x11' is interactive whereas
>    >> type='png' is not), so each instance of the device will
>    >> answer differently. We could simply add an another
>    >> capability flag - that is IMHO the only reliable
>    >> solution. Any other ideas?
>
>    BDR> Do we need a reliable solution?  The worst that happens
>    BDR> that if R thinks a device is interactive and it is not,
>    BDR> you get asked to go on to the next page a few times.
>
>    BDR> I've altered R-devel to look at the displaylist.  All
>    BDR> the devices I knew had that enabled by default iff they
>    BDR> are screen devices, but I've just looked at Cairo and
>    BDR> it seems that could be a bit less dumb about its
>    BDR> setting.
>
>    BDR> You can't in general ask the device, as there might be
>    BDR> no device open and you need to know what the device
>    BDR> that would automatically opened will do.  And you don't
>    BDR> want to open it, as it might not be needed.  Allowing
>    BDR> devices to say by name that they will be interactive is
>    BDR> the only way anyone has come up with on this so far.
>
> I agree (particularly about the very logical reason above).
> But I tend to agree with Deepayan, that
> we should give the useR / programmeR a way to just add a name to
> that list (well "readably", i.e. with a selfexplainable function
> call).

You meam as in

     o	dev.interactive() regards devices with the displaylist enabled
 	as interactive, and packages can register the names of their
 	devices as interactive via deviceIsInteractive().

?

> Even for Cairo, the useR can add "cairo" to that
> list when she knows that cairo will be called in X11-mode; or
> maybe the cairo "initialization/setup" code code do that
> automatically when it's loaded..
>
> Martin
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Qt device update
Prof Brian Ripley