English Amiga Board Amiga Lore


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 19 September 2016, 15:57   #1
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,482
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.
mark_k is offline  
AdSense AdSense  
Old 19 September 2016, 16:17   #2
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,561
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.
Toni Wilen is offline  
Old 21 September 2016, 20:48   #3
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,482
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?
mark_k is offline  
Old 21 September 2016, 21:02   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,561
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.
Toni Wilen is offline  
Old 22 September 2016, 14:15   #5
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,482
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.
mark_k is offline  
Old 22 September 2016, 15:36   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,561
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)
Toni Wilen is offline  
Old 22 September 2016, 19:55   #7
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,482
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.
mark_k is offline  
Old 22 September 2016, 20:57   #8
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,482
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.
mark_k is offline  
Old 22 September 2016, 21:08   #9
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,482
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.
mark_k is offline  
Old 22 September 2016, 21:09   #10
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 42
Posts: 19,561
Only windowed to windowed mode keeps keyboard state. Any other change will still lose keyboard state. (Fixing this would be really painful)
Toni Wilen is offline  
AdSense AdSense  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 00:37.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.14111 seconds with 11 queries