Re: Mousebutton interrupts?

New Message Reply Date view Thread view Subject view Author view

Morten Eriksen (mortene++at++pvv.unit.no)
Tue, 23 Apr 1996 12:31:32 +0200 (MET DST)


On Mon, 22 Apr 1996, AnitaKishore wrote:

> On Apr 22, 6:50pm, Morten Eriksen wrote:
> > Subject: Mousebutton interrupts?
> > Hi,
> >
> > I just wanted to hear if anyone on the list have some code (or ideas)
> > on how to set up an interrupt catching mousebutton presses in a
> > Performer application?
> >
> > I need an interrupt routine because polling won't be fast enough if
> > the frame rate drops a bit (I've got a small handweapon connected to
> > one of the mousebuttons for detecting trigging of shots, and the
> > "button down" period of the gun is rather short).
> >
> > Regards,
> > Morten
> >-- End of excerpt from Morten Eriksen
>
>
>
> Attached below is a sample program in c++ for catching mouse events using
> performer utilities functions. Since this is based on X, I think it
> will be interrupt driven and not poll based. Hope this helps.
>
> -anita

Thanks for the source. There's two problems though; I'm using a GL
window instead of an X window, and I'm using Performer 1.2, not 2.0.

I guess I could change the input type from GL to X fairly easy, but I
wonder what the equivalent of the following code would be under 1.2:

[SNIP]
> #include <Performer/pfui.h>
[SNIP]
> pfuEventHandlerFuncType eventHandler(int, void *, pfuCustomEvent *);
[SNIP]
> pfuInitInput(pw, PFUINPUT_X);
> pfuInputHandler(eventHandler, ButtonPressMask);
[SNIP]
> pfuEventHandlerFuncType eventHandler(int dev, void *val,
> pfuCustomEvent *pfuevent)
> {
>
> XEvent *event = (XEvent *) val;
>
> if (event->type == ButtonPress)
> {
> printf("Hello, World!\n");
> if (event->xbutton.button == Button1)
> {
> printf("Button1 pressed\n");
> getSharedData();
> }
> else if (event->xbutton.button == Button2)
> printf("Button2 pressed\n");
> else if (event->xbutton.button == Button3)
> printf("Button3 pressed\n");
> }
> }
[SNIP]

..as some of the data types, some of the functions and the include
file does not exist in 1.2.

I did also try to simply use the GL 'qdevice' call with 'RIGHTMOUSE'
as parameter, and then to check for right mousebutton presses in
perfly's processKeybdInput(), but to no avail.

Any further help would be greatly appreciated. (And just to clearify
my first mail a bit: the purpose of doing this is to be able to catch
_all_ individual mousebutton presses with a high level of accuracy
(polling is not good enough) - even several mousebutton clicks during
the same frame, if possible).

Regards,
Morten Eriksen


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:45 PDT

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