Device taking over Esc key, handle button presses in code

Post questions, comments and feedback to our 3Dconnexion Windows Development Team.

Moderator: Moderators

Post Reply
heisters
Posts: 8
Joined: Fri Mar 04, 2016 12:30 pm

Device taking over Esc key, handle button presses in code

Post by heisters »

Hi,

I'm having a few issues integrating a SpaceNavigator with Cinder (https://libcinder.org/). First, using the driver seems to take over the application's update loop. I'm not super familiar with Windows application programming, so I can't say for sure what's causing it, but it happens once I call this: https://github.com/heisters/Cinder-3DCo ... n.cpp#L122

Additionally, initializing the mouse seems to prevent the application from receiving a keyboard event when the Escape key is pressed. Other keys work ok, but I haven't tested them all.

Lastly, I can't seem to find a way to disable the driver-implemented button behaviors so that I can handle button presses in the application. The event handling code never seems to get a button event https://github.com/heisters/Cinder-3DCo ... n.cpp#L150, and pressing the button causes a radial menu to open. I tried reassigning the buttons using

Code: Select all

SiSyncSetButtonAssignment( mHandle, bt, 0 /* the button event is to be passed straight thru */ );
, but that causes the 3DConnexion preferences panel to open instead.

I'm guessing a lot of these issues are related. I'd love to find a way to integrate the device in a manner that is consistent with other Cinder device integrations. Unfortunately, I'm having trouble finding documentation on doing this kind of thing.
heisters
Posts: 8
Joined: Fri Mar 04, 2016 12:30 pm

Re: Device taking over Esc key, handle button presses in cod

Post by heisters »

ouch, ok, I blindly copied the example's while loop, which was 90% of the problem. Embarrassing.

The only remaining issue I have is correctly getting the device's button events to be handled in the application code using SiSyncSetButtonAssignment.
heisters
Posts: 8
Joined: Fri Mar 04, 2016 12:30 pm

Re: Device taking over Esc key, handle button presses in cod

Post by heisters »

Sorry, just answering all my own questions. There doesn't appear to be a way to delete a topic.

For future reference, I created a hidden window that's a child of my main window so that the 3DConnexion device has a dedicated message queue. I grab the device so that the hidden window has exclusive access. Then I use PeekMessage to check the queue for messages during my main application loop. Seems to work pretty well: it gives me raw events for motion and buttons. Performance seems to have take a hit, so I may try to move the new message queue to a separate thread. Code here https://github.com/heisters/Cinder-3DCo ... nexion.cpp in case it's useful to someone else trying to integrate this into something like a game engine.
Post Reply