summaryrefslogtreecommitdiffhomepage
path: root/opentrack
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-11-11 14:13:46 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-11-11 14:36:56 +0100
commit4c2529611677e204b7ecf40508723f355cfd423b (patch)
tree80d6c75f0e791816e57b1f54f777879f8f615b3b /opentrack
parentdce46278e8ccb63a1f6dd60733671fdcaad59873 (diff)
joy: refresh immediately once on startup
Diffstat (limited to 'opentrack')
-rw-r--r--opentrack/win32-joystick-shortcuts.hpp16
1 files changed, 10 insertions, 6 deletions
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);
}