ButtonThrower and button events

How can I turn off sending of the time- events? .setSpecificFlag(False) turns off only the normal and raw events.

Why are mouse buttons not sending raw events? Or why are they not raw events?

I use emulator for my gamepad, where do I have to put the xinput1_3.dll file so panda can detect it?

Oof, that’s a good point: that complicates things like key-binding, which may want either keyboard buttons or mouse-buttons…

In fact, let me add that gamepad buttons don’t seem to produce raw events, either.

Gamepads and other input devices already only send “raw” events, because the operating system makes no attempt to try to map them to a “virtual” key.

I’m not sure why you would want raw mouse events. A click of the mouse button is a click of the mouse button. The only thing this might circumvent is the remapping of which is the primary/secondary button in the operating system, but I’m not sure that we can portably get this information.

Can you think of any scenario in which the above causes problems?

Put the xinput1_3.dll file anywhere on your PATH (eg. in the Panda3D bin folder, or in your system32 folder).

Why should mouse be special then? I just find it as inconsistent behavior because I expected that every device sends raw- event for every physical button.
Other than that it isnt much of a problem. I just used the .setSpecificFlag(False) to turn off the event spam I dont need, and found out that now I cant catch mouse buttons with setRawButtonDownEvent. So I will have to just add the buttons to circumvent the SpecificFlag. There might be other annoyances but didnt get that far. I guess to bind mod+mouse button I will need to add more code just because of that.

This doesn’t seem to correspond to the behaviour of ButtonThrower, however: If I use “ButtonThrower.getRawButtonDownEvent()”, I don’t see gamepad button-events; if I instead use “ButtonThrower.getButtonDownEvent()”, I do see gamepad button-events.

For me, it seems to complicate the implementation of a “press any key” feature. (As used when binding keys.)

If I use “base.buttonThrowers[0].node().setButtonDownEvent(<eventName>)”, I seem to get events from both keyboard and mouse. If I use “setRawButtonDownEvent” instead, then I only seem to get keyboard events.

But you know which buttonThrower corresponds to which device, so why don’t you just use setButtonDownEvent for the devices you attached yourself, and setRawButtonDownEvent for the default keyboard thrower?

I do agree this is awkward. Maybe for other devices, setRawButtonDownEvent should be an alias for setButtonDownEvent.

With regards to gamepads and suchlike, how do I know which devices will send raw events, and which will only send non-raw events?

And with regards to keyboard and mouse, as far as I’m aware there’s only one button-thrower that handles both. This (offhand) seems to mean that I’d have to set both events, and then filter out the keyboard events from the non-raw results.

That would work, I think: if there’s no effective difference for a given device, it would be convenient to unify them, I think.

What about the time- events? How can I disable them? It seems they are not generated by the button0 ButtonThrower since nothing affects them.

ShowBase creates a second ButtonThrower in base.timeButtonThrower and calls setTimeFlag(True) on it in order to generate those events. Just removing that from the data graph should work.

All devices, other than the one created by Panda by default, send non-raw events.

True, hmm.

Okay, that’s fair. Thank you. :slight_smile:

For what it’s worth, such filtering does seem to be possible: I’ve taken to checking for “mouse” or “wheel” in the reported key-name, and treating those as mouse-events. It’s a little inelegant, but at the least it does seem to work.

(Presuming that it’s not the source of a problem that I’m having–but I doubt it.)