Displaying 20 results from an estimated 600 matches similar to: "Event handling in R"
2016 Jun 07
2
getGraphicsEvent on X11 and event queuing
Hi R-Devel,
I've been working on an oscilloscope project using an Arduino
microcontroller board. I found that it's quite easy to get realtime
updates, e.g. 30+ frames per second, if I read data from the board in
a little Rcpp library. I have to use dev.hold() and dev.flush() to
keep the plot from flickering, which restricts me to the "cairo" X11
device.
I'd like to be able
2016 Sep 21
1
Handlers in setGraphicsEventHandlers() can recursively call getGraphicsEvent(). Intended behavior?
doKeybd() gets called in CHelpKeyIn() and NHelpKeyIn() in
library/grDevices/src/devWindows.c, where the call is encapsulated in an
'if (dd->gettingEvent)' block. So the only times this code ever calls
doKeybd() is when gettingEvent is in fact set.
Further, it's called in two locations in X11_eventHelper(), in
modules/X11/devX11.c, where the state of gettingEvent seems to be moot
2016 Sep 17
2
Handlers in setGraphicsEventHandlers() can recursively call getGraphicsEvent(). Intended behavior?
Hey all.
As in general it's a bad idea to allow an event handler to generate an
event, and as comments in the code seem to suggest this isn't the
intention either, I was wondering about recursion in getGraphicsEvent().
In main/gevents.c, both doMouseEvent() and doKeybd() have the following
line;
dd->gettingEvent = FALSE; /* avoid recursive calls */
And they reset it to TRUE
2016 Jun 09
3
getGraphicsEvent on X11 and event queuing
Hi Frederik,
>>>>> <frederik at ofb.net>
>>>>> on Tue, 7 Jun 2016 15:20:05 -0700 writes:
> ... I just realized that setGraphicsEventHandlers or
> getGraphicsEvent could have an 'onIdle' callback, to be
> called somewhere in the polling loop of gevents.c:163 - I
> think this would solve my problem #2 in a minimally
2016 Sep 18
0
getGraphicsEvent() and setTimeLimit() bug and compatibility patch.
Hey all.
Setting a time limit with setTimeLimit(), and then using
getGraphicsEvent(), will cause graphics event handling for the current
device to break on timeout, until the device is destroyed and recreated.
The problem lies in do_getGraphicsEvent() checking the value of
dd->gettingEvent and concluding it's being called recursively
(ironically this same test fails to detect actual
2020 Aug 09
0
Interactive graphics
Dear R-Devel list members
I'm facing as problem already known and linked to the use of
getGraphicsEvent(prompt = "Waiting for input",
???????????????? onMouseDown = NULL, onMouseMove = NULL,
???????????????? onMouseUp = NULL, onKeybd = NULL,
???????????????? onIdle = NULL,
???????????????? consolePrompt = prompt)
setGraphicsEventHandlers(which = dev.cur(), ...)
2011 Apr 12
1
Signal handling / alarm timeouts
What are the ramifications of setting up user signal handling to allow
the use of e.g. alarm(2) to send a SIGALRM to the R process at some
number of seconds in the future to e.g. interrupt a routine that is
taking too long to complete.
I can't find any R language support for this (e.g. a timeout argument
to tryCatch() would be ideal), so am wondering what kinds of problems
are to be expected
2016 Sep 21
0
Handlers in setGraphicsEventHandlers() can recursively call getGraphicsEvent(). Intended behavior?
Hi
Is the correct patch to remove the setting of the gettingEvent flag or
would it be better to flip the TRUE/FALSE setting (set to TRUE before
handling then reset to FALSE after handling) ?
Also, for this patch and for the other two you sent, one difficulty will
be with testing the patches. I have no testing code for this, so would
need at least a test or two from you (ideally someone
2016 Oct 31
1
BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)
On Mon, 31 Oct 2016, Henrik Bengtsson wrote:
> Thank you for looking into this Luke.
>
> On Thu, Oct 27, 2016 at 9:26 AM, <luke-tierney at uiowa.edu> wrote:
>> On unix, unless event polling is enabled Sys.sleep just waits in a
>> select() call (with a SIGINT handler in place) so the elapsed time
>> isn't checked until after the select call is complete.
2016 Jun 07
0
getGraphicsEvent on X11 and event queuing
... I just realized that setGraphicsEventHandlers or getGraphicsEvent
could have an 'onIdle' callback, to be called somewhere in the polling
loop of gevents.c:163 - I think this would solve my problem #2 in a
minimally disruptive way.
On Mon, Jun 06, 2016 at 06:38:45PM -0700, frederik at ofb.net wrote:
> Hi R-Devel,
>
> I've been working on an oscilloscope project using an
2019 May 22
1
make running on.exit expr uninterruptible
Hi,
Is there currently any way to guarantee that on.exit does not fail to execute the recorded expression because of a user interrupt arriving during function exit? Consider:
f <- function() {
suspendInterrupts({
on.exit(suspendInterrupts(cntr_on.exit <<- cntr_on.exit + 1L))
cntr_f <<- cntr_f + 1L
})
TRUE
}
It is possible to interrupt this function such that cntr_f
2016 Oct 26
5
BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)
setTimeLimit(elapsed=1) causes a timeout error whenever a call takes
more than one second. For instance, this is how it works on Windows
(R 3.3.1):
> setTimeLimit(elapsed=1)
> Sys.sleep(10); message("done")
Error in Sys.sleep(10) : reached elapsed time limit
Also, the error propagates immediately and causes an interrupt after ~1 second;
> system.time({ Sys.sleep(10);
2016 Oct 27
2
BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)
On unix, unless event polling is enabled Sys.sleep just waits in a
select() call (with a SIGINT handler in place) so the elapsed time
isn't checked until after the select call is complete. Rstudio uses
event polling, and in particular sets R_wait_usec to 10000, which
means event and interrupt checks happen during a Sys.seep call. The R
GUI on macOS doesn't seem to do this (but my lldb
2008 Apr 13
1
getGraphicsEvent plotting two graph
Hi the list,
I need to use getGraphicsEvent to plot two graph. On the following toy
example:
- the function b is ploting two graph depending on a parameter
- the function a is calling b according to some user answers. It is
suppose to call b until the user press Return, but it does not.
b <- function(x){
dev.off(2);dev.off(3)
windows();windows(3,3,xpos=0)
dev.set(2);plot(1:x)
2013 May 16
1
setTimeLimit sometimes fails to terminate idle call in R
I would like to use setTimeLimit to abort operations that are stuck
waiting (idle) after n seconds. Below a toy example in which Sys.sleep
is a placeholder call that is idle:
testlimit <- function(){
setTimeLimit(elapsed=3, transient=TRUE);
Sys.sleep(10);
}
system.time(testlimit());
However this is giving inconsistent results. On windows and in
r-studio server (linux) the call is
2016 Oct 26
3
BUG?: On Linux setTimeLimit() fails to propagate timeout error when it occurs (works on Windows)
Thank you for the feedback and confirmations. Interesting to see that
it's also reproducible on macOS expect for Spencer; that might
indicate a difference in builds.
BTW, my original post suggested that timeout error was for sure
detected while running Sys.sleep(10). However, it could of course
also be that it is only detected after it finishes.
For troubleshooting, the
2016 Nov 14
2
getGraphicsEvent() alternative for cairo graphics device?
Great. Thanks!
Paul
On 14/11/16 13:41, frederik at ofb.net wrote:
> Hi Paul,
>
> Thank you, for some reason I didn't seem to get an email notification
> for your bugzilla comment!
>
> I will try to send you something shortly.
>
> Frederick
>
> On Mon, Nov 14, 2016 at 08:55:20AM +1300, Paul Murrell wrote:
>> Hi
>>
>> The current status is that
2016 Nov 14
2
getGraphicsEvent() alternative for cairo graphics device?
Thanks Frederick.
Mark, if you have any examples to share, they would also be gratefully
received.
Paul
On 14/11/16 14:53, frederik at ofb.net wrote:
> Hi Paul,
>
> OK I tried not to make the examples too fancy.
>
> Please let me know what you think. They should probably be amended to
> support the Windows platform, but I think that task would be much
> easier for someone
2016 Jul 25
2
getGraphicsEvent() alternative for cairo graphics device?
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
2016 Jul 25
2
getGraphicsEvent() alternative for cairo graphics device?
Hi
Taking a look at those patches is now on my todo list, so I may be in
touch with both of you at some point to request some testing.
Paul
On 26/07/16 07:17, frederik at ofb.net wrote:
> 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
>