diff options
author | 2023-02-24 19:31:12 +1100 | |
---|---|---|
committer | 2023-02-24 19:31:12 +1100 | |
commit | 65aeb63a2a1f4f65a6fa0dedabba1b852a189f96 (patch) | |
tree | 42a56bcf4d22b624dbb117946e376981e691a5f0 /src/osd/modules/input/input_win32.cpp | |
parent | 3b5dbeea3bad50ad04c966de4afffb864a9856d0 (diff) |
Update accumulating relative inputs exactly once per frame.
This fixes "amplification" effects that would happen if the frame rate
rose above 100 Hz (whether by unthrottling or otherwise).
Synchronise with wall clock any time inputs are read. Not doing this
has weird effects on relative inputs with frame skipping and contributes
to unresponsiveness of menus.
Reduce visual latency for mouse movement on menus when paused or
skipping frames. The rest of the code changes to menus won't provide
benefits until draw can happen after event handling.
Diffstat (limited to 'src/osd/modules/input/input_win32.cpp')
-rw-r--r-- | src/osd/modules/input/input_win32.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/osd/modules/input/input_win32.cpp b/src/osd/modules/input/input_win32.cpp index 5c584e33d93..6919c8d5c42 100644 --- a/src/osd/modules/input/input_win32.cpp +++ b/src/osd/modules/input/input_win32.cpp @@ -137,9 +137,12 @@ public: { } - virtual void poll() override + virtual void poll(bool relative_reset) override { - event_based_device::poll(); + event_based_device::poll(relative_reset); + + if (!relative_reset) + return; CURSORINFO cursor_info = {0}; cursor_info.cbSize = sizeof(CURSORINFO); @@ -202,10 +205,6 @@ protected: { // set the button state m_mouse.rgbButtons[args.button] = args.keydown ? 0x80 : 0x00; - - // Make sure we have a fresh mouse position on button down - if (args.keydown) - module().poll_if_necessary(); } private: @@ -322,9 +321,9 @@ public: { } - virtual void poll() override + virtual void poll(bool relative_reset) override { - event_based_device::poll(); + event_based_device::poll(relative_reset); int32_t xpos = 0, ypos = 0; |