From 4c2529611677e204b7ecf40508723f355cfd423b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 11 Nov 2015 14:13:46 +0100 Subject: joy: refresh immediately once on startup --- opentrack/win32-joystick-shortcuts.hpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'opentrack') diff --git a/opentrack/win32-joystick-shortcuts.hpp b/opentrack/win32-joystick-shortcuts.hpp index 23228835..5a2fc6c8 100644 --- a/opentrack/win32-joystick-shortcuts.hpp +++ b/opentrack/win32-joystick-shortcuts.hpp @@ -20,7 +20,7 @@ struct win32_joy_ctx void poll(fn f) { - refresh(); + refresh(false); for (int i = joys.size() - 1; i >= 0; i--) { if (!joys[i]->poll(f)) @@ -126,6 +126,8 @@ struct win32_joy_ctx nullptr))) goto fail; + refresh(true); + return; fail: qDebug() << "dinput8 failed for shortcuts" << hr; @@ -148,15 +150,17 @@ fail: } } - void refresh() + void refresh(bool first) { if (!dinput_handle) return; - if (timer_joylist.elapsed_ms() < joylist_refresh_ms) - return; - - timer_joylist.start(); + if (!first) + { + if (timer_joylist.elapsed_ms() < joylist_refresh_ms) + return; + timer_joylist.start(); + } enum_state st(dinput_handle, joys); } -- cgit v1.2.3