-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: Pause menu gamepad input suddenly stops working
Yes, it helps... a couple of questions.
Do your buttons have the property AcceptsReturn set to true (by a style or locally)?
After doing Alt+Tab, if you select a Button (either by using the GamePad or arrow keys), and click the Space key, does the button Click correctly?
Do your buttons have the property AcceptsReturn set to true (by a style or locally)?
After doing Alt+Tab, if you select a Button (either by using the GamePad or arrow keys), and click the Space key, does the button Click correctly?
- unvestigate
- Posts: 32
- Joined:
Re: Pause menu gamepad input suddenly stops working
It would seem that pressing the space key "clicks" a button before doing an Alt-Tab, but it stops working afterwards, just like the issue with the gamepad. Regarding the AcceptsReturn property, I am unsure how to check that. I am using NocturnalStyle.xaml which IIRC comes with Noesis and I am not knowingly setting the property myself. A quick googling suggested this is a property of the TextBox, not the Button, but I may be wrong.
-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: Pause menu gamepad input suddenly stops working
I think we got to the source of the problem. If Space key is not working either it means that Noesis view thinks Alt key is still pressed.
If you take a look at our Win32Display integration you will see that handling WM_ACTIVATE we raise Deactivated event which ends calling View->Deactivate(). This call resets all input state (pressed keys, focus, mouse buttons, etc.). And when Win32Display raises Activated event it ends calling View->Activate() which restores any previous focus. But Win32Display also syncs key state:
Is your integration calling view Deactivate/Activate when Alt+Tab between applications?
If you take a look at our Win32Display integration you will see that handling WM_ACTIVATE we raise Deactivated event which ends calling View->Deactivate(). This call resets all input state (pressed keys, focus, mouse buttons, etc.). And when Win32Display raises Activated event it ends calling View->Activate() which restores any previous focus. But Win32Display also syncs key state:
Code: Select all
// Sync key states (they are reset each time window is deactivated)
for (uint32_t i = 0; i < NS_COUNTOF(mKeyTable); i++)
{
if (mKeyTable[i] != 0 && GetAsyncKeyState(i))
{
mKeyDown(this, (Key)mKeyTable[i]);
}
}
-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: Pause menu gamepad input suddenly stops working
I just checked that it is ButtonBase code who overrides KeyboardNavigation::AcceptsReturn property to true. So the default behavior for buttons is accepting both Space and Enter keys for raising the Click event. Sorry for the confusion.Regarding the AcceptsReturn property, I am unsure how to check that. I am using NocturnalStyle.xaml which IIRC comes with Noesis and I am not knowingly setting the property myself. A quick googling suggested this is a property of the TextBox, not the Button, but I may be wrong.
- unvestigate
- Posts: 32
- Joined:
Re: Pause menu gamepad input suddenly stops working
You are right. That was the problem! Adding Activate()/Deactivate() calls fixed the problem. Thank you!
-
sfernandez
Site Admin
- Posts: 2983
- Joined:
Re: Pause menu gamepad input suddenly stops working
Anyway, regarding the source of the problem, the cause is we are considering Gamepad_Accept as if Space key was pressed in Button code. And [Alt+Space] key combination was reserved to show system menu in WPF, but gamepad should not follow that path.
We are going to fix it for the next release, here is the ticket #1834 to track it.
We are going to fix it for the next release, here is the ticket #1834 to track it.
Who is online
Users browsing this forum: Google [Bot] and 71 guests