19 September 2016, 15:57 | #1 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
WinUAE forgets pressed keys on display mode change
On real hardware, when you have several custom screens open you can press and hold the left Amiga key, then tap M repeatedly to cycle the screen order.
On WinUAE there's a small problem when the display mode changes. It happens when the display changes from a native mode to RTG or vice versa. It also happens when VGA resolution autoswitch is enabled and the display changes from (for example) PAL to HIGHGFX:1024×768 (both native modes). When the display mode changes, WinUAE forgets which keys are pressed. So even though you continue to hold down the left Amiga key, WinUAE thinks it isn't pressed. You have to release and press lAmiga again to continue cycling between screens. |
19 September 2016, 16:17 | #2 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
It is by design. If WinUAE needs to close/open the window/screen, it can miss key releases.
It is far more annoying to get stuck keys than keys that are force-released before mode switch. |
21 September 2016, 20:48 | #3 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
While older versions of WinUAE did close and reopen the emulation window on mode change, the current version doesn't. And the key-forgetting also happens with native-to-native screen changes if resolution autoswitch or VGA mode resolution autoswitch is enabled. Log shows something like
window already open (829x353 1088x800) on mode change, then WinUAE seems to reallocate D3D-related things for the new mode. Could you use GetRawInputBuffer after a mode change to (hopefully) pick up any key events you might have missed? |
21 September 2016, 21:02 | #4 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
When it is safe to "release" all keys, it is too early to know if window needs to be reopened (in worst case it could be fullscreen mode change). Amiga key input handling is core emulation code that does not know (and must not know) anything about what happens in host specific code.
It is not trivial problem to solve. There is no guaranteed way to know current state of keyboard in rawinput. |
22 September 2016, 14:15 | #5 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Have you considered using an invisible window to receive raw input? That could stay open, so shouldn't lose any events. Googling for raw input invisible window showed Minimal Key Logger Using RAWINPUT though I guess that example won't tell you much you're not already familiar with.
|
22 September 2016, 15:36 | #6 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
I did some adjusting, perhaps it works but I'll blame you if stuck keys happen
(It may have been old-style non-rawinput mode that required more careful special handling) |
22 September 2016, 19:55 | #7 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Thanks, very quick testing of lAmiga held plus tapping (or holding) M didn't seem to lose key state with native->native mode switching. Key state is lost when switching between RTG and native, where native is windowed, RTG full-screen. But that was testing on Wine, need to check actual Windows yet.
|
22 September 2016, 20:57 | #8 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Testing on Windows 10...
With both native and RTG set to full-screen, keyboard state is lost on switching between native and RTG screenmodes. I see the desktop flash briefly when that happens, so maybe you're re-initialising more than is necessary then? The same happens with native and RTG both full-window. |
22 September 2016, 21:08 | #9 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Related to this issue, probably not worth its own thread...
The mouse becomes uncaptured on a full-screen to windowed change, e.g. when pressing lAmiga-M would change between RTG and native modes. That can be kind of annoying if you use the pause when mouse uncaptured option. |
22 September 2016, 21:09 | #10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Only windowed to windowed mode keeps keyboard state. Any other change will still lose keyboard state. (Fixing this would be really painful)
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Keyboard Issue, multi-keys pressed | h0ffman | Coders. Asm / Hardware | 30 | 02 February 2016 23:42 |
Slamtilt and keys kept pressed | cybermat | support.FS-UAE | 8 | 07 August 2015 15:23 |
Can't change color depth or screen mode | VoltureX | support.Apps | 4 | 19 September 2011 11:39 |
When you play games, sometimes left-right keys stay "pressed" | hexaae | support.WinUAE | 4 | 18 April 2009 13:22 |
WinUAE - Cannot change display resolution... | Jorlin | support.WinUAE | 0 | 14 June 2003 14:41 |
|
|