Hi, I'm working on a frontend for R. I have R running in a separate thread in my application using Rf_initEmbeddedR, and I'm using R_tryEval to run commands in R (i.e. I don't run the mainloop). Everything works fine, except the x11-device: I can open x11-windows and paint to them alright from R. However, the x11-window does not respond to any events. E.g. clicking the close-button simply does not close the window and the contents in the window do not get refreshed when it was hidden by other windows. I figured that the reason for this might be, that R_ProcessEvents () and handleEvent () in devX11.c do not get called (of course I might be completely wrong?). So I tried calling R_ProcessEvents () manually, but I can't get that to link (unresolved symbol R_ProcessEvents). Any hints on how I can get this to work? Thanks Thomas
Hi again,> I figured that the reason for this might be, that R_ProcessEvents () and > handleEvent () in devX11.c do not get called (of course I might be > completely wrong?). So I tried calling R_ProcessEvents () manually, but I > can't get that to link (unresolved symbol R_ProcessEvents). > Any hints on how I can get this to work?ok, I figured it out. For the record, the following code (called periodically when there is nothing else to do) does the trick: #include "R_ext/eventloop.h" void processX11 () { extern InputHandler *R_InputHandlers; InputHandler *handler = R_InputHandlers; while (handler) { if (handler->activity == XActivity) { handler->handler ((void*) 0); } handler = handler->next; } } Thomas
I think you are barking up the wrong tree. If you want to use an event-driven sub-system you need to run an event loop. There is a lot of new information in 2.1.0 on building a front-end. Please read it. On Wed, 20 Apr 2005, Thomas Friedrichsmeier wrote:> I'm working on a frontend for R. I have R running in a separate thread in my > application using Rf_initEmbeddedR, and I'm using R_tryEval to run commands > in R (i.e. I don't run the mainloop). > Everything works fine, except the x11-device: I can open x11-windows and paint > to them alright from R. However, the x11-window does not respond to any > events. E.g. clicking the close-button simply does not close the window and > the contents in the window do not get refreshed when it was hidden by other > windows. > I figured that the reason for this might be, that R_ProcessEvents () and > handleEvent () in devX11.c do not get called (of course I might be completely > wrong?). So I tried calling R_ProcessEvents () manually, but I can't get that > to link (unresolved symbol R_ProcessEvents). > Any hints on how I can get this to work?-- Brian D. Ripley, ripley@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
> I think you are barking up the wrong tree. If you want to use an > event-driven sub-system you need to run an event loop.Well, but I only want part of R's event loop, namely handling of some specific X11-events. Of course, I do have a sort of event-loop, except that the main category of "events" is requests coming from the main application/thread. For this it's simply more practical to run my "own" event loop. The only problem was how to trigger processing of X11-events from there. Anyway, you will see in my follow-up, that I found a solution that does just what I want.> There is a lot of new information in 2.1.0 on building a front-end. > Please read it.Yes, I've seen that, and it's very helpful compared to the documentation available when I had last checked (pre 2.0.0). Regards Thomas Friedrichsmeier P.S.: In case you're interested, the project I'm working on is this: http://rkward.sourceforge.net
Seemingly Similar Threads
- [FORGED] src/modules/X11/devX11.c, can we remove "#if BUG" yet
- [FORGED] src/modules/X11/devX11.c, can we remove "#if BUG" yet
- X11 device doesn't handle destroy events correcly (PR#848)
- [FORGED] src/modules/X11/devX11.c, can we remove "#if BUG" yet
- [FORGED] src/modules/X11/devX11.c, can we remove "#if BUG" yet