2

I'm making a Rebol 3 extension that has GUI events. For now, I manage this using synchronous callbacks so each time an event happens like a mouse move, the C extension calls the Rebol callback function. But I'd like to manage this using REBEVT and RL->event.

Here is a code sample:

case SDL_MOUSEMOTION:

    Add_Event_XY(
        RootGob, 2, (event.motion.x + (event.motion.y << 16)), EVT_MOVE
    );

    /*
    cbi.obj = CBI_SDL_MOUSEMOTION.obj;
    cbi.word = CBI_SDL_MOUSEMOTION.word;
    RXI_COUNT(args) = 1;
    RXI_TYPE(args, 1) = RXT_PAIR;
    args[1].pair.x = event.motion.x;
    args[1].pair.y = event.motion.y;
    n = RL_CALLBACK(&cbi);
    if(n == 0) {RL_PRINT("%s\n", "callback error");}
    */
    break;

But then when I do a wait in Rebol, I get:

>> wait 1
** Script error: wake-up does not allow none! for its port argument
** Where: loop -apply- wait
** Near: loop 8 [
    unless event: take sport/state [break]
    port...

How to make the port not null?

GregP
  • 85
  • 6
  • Without knowing the answer, I can point you to Shixin as being a good person to ask: ["Avoiding recursion when reading/writing a port synchronously?"](http://stackoverflow.com/questions/19956665/). In any case, he's worked in this area. If you're not running the Atronix version of Rebol, you might [try it](http://atronixengineering.com/downloads.html) and see if it behaves differently. – HostileFork says dont trust SE Mar 24 '15 at 16:41
  • Hopefully Shixin will stop by! I tried "mainline" version and Saphirion version: it works. I tried Atronix version and it crashes: still have to investigate why. – GregP Mar 24 '15 at 17:36
  • If that's the case, and it's in Atronix build only, then it sounds like you should [file a bug report](https://github.com/zsx/r3/issues). He's more likely to see it there than here. – HostileFork says dont trust SE Mar 25 '15 at 00:54
  • Sure, I need to do further testing first but then I will file. – GregP Mar 25 '15 at 08:13

1 Answers1

1

After some searches in R3 code, I found that I had to initialize as below:

system/view/event-port: open event://

Now it works! (with R3 mainline)

GregP
  • 85
  • 6