summaryrefslogtreecommitdiffhomepage
path: root/opentrack/win32-joystick.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-12-17 22:52:54 +0100
committerStanislaw Halik <sthalik@misaki.pl>2015-12-17 22:52:54 +0100
commit3e543b11f57aa6c010045fb9614eb2638ac6ae81 (patch)
tree2975fccb82dc638d303ae6a6208c3e20ac448a0b /opentrack/win32-joystick.hpp
parentf38541f1956133be9b093d5439128d3481b7e5fa (diff)
api/joy: refresh only manually on certain events
Refresh joylist when new listener arrives, and when the joy singleton just gets created. Enumerating joys all the time causes high CPU usage for some of the users. Issue: #279 Backtrace-by: @exulant Reported-by: @aka2k
Diffstat (limited to 'opentrack/win32-joystick.hpp')
-rw-r--r--opentrack/win32-joystick.hpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/opentrack/win32-joystick.hpp b/opentrack/win32-joystick.hpp
index 6d5e1074..9c888326 100644
--- a/opentrack/win32-joystick.hpp
+++ b/opentrack/win32-joystick.hpp
@@ -57,18 +57,14 @@ struct OPENTRACK_EXPORT win32_joy_ctx
win32_joy_ctx();
~win32_joy_ctx();
-
+ void refresh();
private:
- enum { joylist_refresh_ms = 100 };
-
QMutex mtx;
- Timer timer_joylist;
QMainWindow fake_main_window;
LPDIRECTINPUT8 di;
static QString guid_to_string(const GUID guid);
void release();
- void refresh(bool first);
struct joy
{
@@ -97,7 +93,7 @@ private:
static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE* pdidInstance, VOID* pContext);
static BOOL CALLBACK EnumObjectsCallback(const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* ctx);
public:
- enum_state(std::unordered_map<QString, std::shared_ptr<joy>>& joys, QMutex &mtx, QMainWindow& fake_main_window, LPDIRECTINPUT8 di);
+ enum_state(std::unordered_map<QString, std::shared_ptr<joy>>& joys, QMainWindow& fake_main_window, LPDIRECTINPUT8 di);
};
};