diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-09 17:40:23 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-12-09 17:40:23 +0100 |
commit | 55a4dea311eabe5a4a7d1e97352d854898512ef2 (patch) | |
tree | 1633f65c8c8b3bb505fa1b67da117f3a838eda7c /contrib/very-important-source-code | |
parent | b256886a5cb9f2ae3ebda70a2045b19ed9f4233e (diff) |
contrib/npclient: allow mouse control when opentrack disabled
Diffstat (limited to 'contrib/very-important-source-code')
-rw-r--r-- | contrib/very-important-source-code/npclient.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/very-important-source-code/npclient.c b/contrib/very-important-source-code/npclient.c index 3878f809..d635069c 100644 --- a/contrib/very-important-source-code/npclient.c +++ b/contrib/very-important-source-code/npclient.c @@ -60,6 +60,11 @@ static FILE *debug_stream; #define dbg_report(...) #endif +typedef enum npclient_status_ { + NPCLIENT_STATUS_OK, + NPCLIENT_STATUS_DISABLED +} npclient_status; + static HANDLE hFTMemMap = 0; static FTMemMap *pMemData = 0; static HANDLE hFTMutex = 0; @@ -307,7 +312,10 @@ NP_EXPORT(int) NP_GetData(tir_data_t * data) } data->frame = frameno += 1; - data->status = 0; + bool running = y != 0 || p != 0 || r != 0 || + tx != 0 || ty != 0 || tz != 0; + + data->status = running ? NPCLIENT_STATUS_OK : NPCLIENT_STATUS_DISABLED; data->cksum = 0; data->roll = scale2AnalogLimits (r, -180.0, 180.0); @@ -332,7 +340,7 @@ NP_EXPORT(int) NP_GetData(tir_data_t * data) enhance((unsigned char*)data, sizeof(tir_data_t), table, sizeof(table)); } - return 0; + return running ? NPCLIENT_STATUS_OK : NPCLIENT_STATUS_DISABLED; } /****************************************************************** * NP_GetParameter (NPCLIENT.9) |