XEvents and pfutil

New Message Reply Date view Thread view Subject view Author view

Steve Woolsey (woolsr++at++inel.gov)
Mon, 23 Nov 1998 16:47:14 -0700


Hi,

I have an app that I have programmed in Performer that uses the
spaceball SDK. I would like to also use the pfuGUI functionality.
However, I can't get it working. I have looked through the lists
archive about this and there has been some discussion about
pfuInputHandler not working with OpenGL, and such. What I would like to
know is how to get access to the X events while maintaining a pfuGUI.
It seems that when I activate the GUI handling, no X events are seen by
my spaceball dispatcher. And if I get the spaceball working, then the
GUI doesn't function.

Here is my spaceball dispatcher:

/* In Draw callback routine, pre-pfDraw() processing */
void
PreDraw(pfChannel *chan, void *data)
{
    Display *dsp; // XDisplay pointer
    XEvent event;
    SPW_InputEvent sbEvent; // Spaceball event
    SPW_InputDispatchStruct sbDispatch; // Spaceball dispatch
structure

    dsp = pfGetCurWSConnection();

    SPW_InputInitDispatchStruct(&sbDispatch);
    sbDispatch.display = dsp;
    sbDispatch.xevent = &event;
    sbDispatch.spwevent = &sbEvent;
    sbDispatch.handle_motion = MyProcessSpwMotion;
    sbDispatch.handle_bpress = MyProcessButtonPress;
    sbDispatch.handle_brelease = MyProcessButtonRelease;

    XPeekEvent(dsp, &event);
    if(SPW_InputIsSpaceballEvent(dsp, &event, &sbEvent) == SPW_TRUE)
    {
        SPW_InputDispatchEx(&sbDispatch);
    }

    Shared->left->setView(Shared->view.xyz, Shared->view.hpr);

    if (Shared->gui && pfuInGUI(Shared->mouse.xpos, Shared->mouse.ypos))

    {
        pfuRedrawGUI();
    }

    // Clear the frame buffer
    chan->clear();
}

With the above code, I get the GUI working, but the Spaceball functions
are never called. If I change XPeekEvent to XNextEvent, then the
Spaceball works, but the GUI isn't functional. I have also tried the
following:

XPeekEvent(dsp, &event);
if(SPW_InputIsSpaceballEvent(dsp, &event, &sbEvent) == SPW_TRUE)
}
    XNextEvent(dsp, &event);
    SPW_InputDispatchEx(&sbDispatch);
}

I have also tried:

XNextEvent(dsp, &event);
if(SPW_InputIsSpaceballEvent(dsp, &event, &sbEvent) == SPW_TRUE)
{
    SPW_InputDispatchEx(&sbDispatch);
}
else
    XPutbackEvent(dsp, &event);

Nothing works. Anyone know how to do this?

Thanks,

Steve
-------------------------------------------------------------------
Steven Woolsey Associate Engineer/Scientist
Lockheed Martin Idaho Technologies Visualization Engineer
Idaho National Engineering Lab. EMAIL: woolsr++at++inel.gov
P.O. Box 1625, M.S. 3605
Idaho Falls, ID 83415-3605
-------------------------------------------------------------------


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Nov 23 1998 - 15:39:48 PST

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.