Mouse and keypress consume

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.
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.

Mouse and keypress consume

Postby hiflyer » Wed Sep 28, 2011 2:09 am

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.
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

Postby hiflyer » Mon Oct 10, 2011 12:14 pm

Any input on this?
hiflyer
regular
 
Posts: 78
Joined: Wed Jan 07, 2009 6:55 am

Re: Mouse and keypress consume

Postby gouessej » Mon Oct 10, 2011 2:24 pm

Hi

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

Postby renanse » Fri Oct 14, 2011 12:17 pm

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.
User avatar
renanse
Site Admin
 
Posts: 2958
Joined: Tue Oct 28, 2008 6:49 pm
Location: Austin, TX

Re: Mouse and keypress consume

Postby hiflyer » Fri Oct 14, 2011 4:29 pm

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

Postby hiflyer » Mon Oct 17, 2011 3:41 pm

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;
. That fixed the problem. Do you see any other bug with it?
hiflyer
regular
 
Posts: 78
Joined: Wed Jan 07, 2009 6:55 am

Re: Mouse and keypress consume

Postby renanse » Tue Oct 18, 2011 12:51 pm

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.
User avatar
renanse
Site Admin
 
Posts: 2958
Joined: Tue Oct 28, 2008 6:49 pm
Location: Austin, TX

Re: Mouse and keypress consume

Postby renanse » Wed Oct 19, 2011 5:11 pm

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.
User avatar
renanse
Site Admin
 
Posts: 2958
Joined: Tue Oct 28, 2008 6:49 pm
Location: Austin, TX

Re: Mouse and keypress consume

Postby hiflyer » Fri Oct 21, 2011 6:25 am

The fix works fine in spaced. Thanks for tracking it down.
hiflyer
regular
 
Posts: 78
Joined: Wed Jan 07, 2009 6:55 am


Return to Extensions Development Discussions

Who is online

Users browsing this forum: No registered users and 0 guests

cron