Mouse and keypress consume
Forum rules
Developer discussions only. Newbie questions belong in the HELP! forum. This is a forum for discussing development work on Ardor3D add-ons and extensions. Basically, anything that is Ardor3D that is not in the ardor3d-core module.
Developer discussions only. Newbie questions belong in the HELP! forum. This is a forum for discussing development work on Ardor3D add-ons and extensions. Basically, anything that is Ardor3D that is not in the ardor3d-core module.
9 posts
• Page 1 of 1
Mouse and keypress consume
When I was trying to figure out why our game fails to get keyup in some cases where the mouse pointer is over UI components I realized that the offerInputToUI method in UIHud uses the same boolean flag for mouse and key events when determining whether to propagate the input states or not.
The effect of that is that when a key is released at the same time the mouse moves over a component that handles mouse events it will be considered consumed and our game will never see it.
I wrote a simple patch that seems to solve the problem but it's quite possible that you can solve it in some other way with a bigger redesign.
The effect of that is that when a key is released at the same time the mouse moves over a component that handles mouse events it will be considered consumed and our game will never see it.
I wrote a simple patch that seems to solve the problem but it's quite possible that you can solve it in some other way with a bigger redesign.
- Attachments
-
Split_keyboard_and_mouse_consume_in_two.txt- (5.89 KiB) Downloaded 122 times
- hiflyer
- regular
- Posts: 78
- Joined: Wed Jan 07, 2009 6:55 am
Re: Mouse and keypress consume
Any input on this?
- hiflyer
- regular
- Posts: 78
- Joined: Wed Jan 07, 2009 6:55 am
Re: Mouse and keypress consume
Hi
I find your fix quite fine. Why did you think about a deeper code redesign?
I find your fix quite fine. Why did you think about a deeper code redesign?
- gouessej
- regular
- Posts: 1206
- Joined: Fri May 01, 2009 3:26 am
- Location: France
Re: Mouse and keypress consume
It looks like a good idea, but seems to have some flaws... For example, try running SimpleUIExample after your patch and then drag the UI frame around.
Gratitude is a mark of a noble soul and a refined character.
-

renanse - Site Admin
- Posts: 2958
- Joined: Tue Oct 28, 2008 6:49 pm
- Location: Austin, TX
Re: Mouse and keypress consume
I see. That's clearly not working as intended. We don't have that particular problem with draggable frames in Spaced however so I'll have a look at what we are doing to prevent it.
- hiflyer
- regular
- Posts: 78
- Joined: Wed Jan 07, 2009 6:55 am
Re: Mouse and keypress consume
When there is a draglistener, the ui should consume mouse input (imo) so I changed line 625 in my patched version of UIHud to
- Code: Select all
return consumed || _dragListener != null;
- hiflyer
- regular
- Posts: 78
- Joined: Wed Jan 07, 2009 6:55 am
Re: Mouse and keypress consume
Unfortunately now the mouse look on the main scene does not respond properly (it drags out of control, spins the view when I'm not dragging, etc.) Do you see that on your end?
Gratitude is a mark of a noble soul and a refined character.
-

renanse - Site Admin
- Posts: 2958
- Joined: Tue Oct 28, 2008 6:49 pm
- Location: Austin, TX
Re: Mouse and keypress consume
Ok, I've got it nailed down. The issue was in fact object equality like you guessed, but we currently rely on that to determine if dx, dy and dwheel are valid for the current frame. The fix was to avoid additional object creation if we aren't actually consuming anything, which seems to work reasonably well. Please test in spaced when you can as well.
And thanks!
Gratitude is a mark of a noble soul and a refined character.
-

renanse - Site Admin
- Posts: 2958
- Joined: Tue Oct 28, 2008 6:49 pm
- Location: Austin, TX
Re: Mouse and keypress consume
The fix works fine in spaced. Thanks for tracking it down.
- hiflyer
- regular
- Posts: 78
- Joined: Wed Jan 07, 2009 6:55 am
9 posts
• Page 1 of 1
Return to Extensions Development Discussions
Who is online
Users browsing this forum: No registered users and 0 guests