summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt4
-rw-r--r--cmake/apple.cmake2
-rw-r--r--cmake/linux.cmake2
-rw-r--r--cmake/mingw-w64.cmake2
-rw-r--r--cmake/opentrack-boilerplate.cmake6
-rw-r--r--cmake/opentrack-hier.cmake114
-rw-r--r--cmake/opentrack-load-user-settings.cmake3
-rw-r--r--cmake/opentrack-pkg-config.cmake1
-rw-r--r--cmake/opentrack-platform.cmake130
-rw-r--r--cmake/opentrack-policy.cmake17
-rw-r--r--cmake/opentrack-qt.cmake14
-rw-r--r--compat/run-in-thread.hpp4
-rw-r--r--compat/timer.cpp2
-rw-r--r--gui/keyboard.cpp50
-rw-r--r--gui/keyboard.h10
-rw-r--r--logic/win32-shortcuts.cpp22
-rw-r--r--spline/spline-widget.cpp17
-rw-r--r--tracker-fusion/fusion.cpp2
-rw-r--r--tracker-hatire/CMakeLists.txt4
-rw-r--r--tracker-hatire/ftnoir_tracker_hat.h12
-rw-r--r--tracker-hatire/thread.cpp1
-rw-r--r--tracker-wii/wiiyourself/wiimote.h2
22 files changed, 216 insertions, 205 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a56974b..f5e1b730 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,10 @@ set(CMAKE_C_LINKER_PREFERENCE_PROPAGATES OFF)
set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
+
+include(CMakeDetermineCCompiler)
+include(CMakeDetermineCXXCompiler)
+include(CMakeParseArguments)
include(opentrack-mrproper)
project(opentrack)
diff --git a/cmake/apple.cmake b/cmake/apple.cmake
index 627ef3c1..f6b83382 100644
--- a/cmake/apple.cmake
+++ b/cmake/apple.cmake
@@ -3,7 +3,7 @@ set(CMAKE_BUILD_TYPE_INIT RELEASE)
set(CMAKE_CXX_FLAGS "-arch x86_64 -stdlib=libc++" CACHE STRING "" FORCE)
set(CMAKE_C_FLAGS "-arch x86_64" CACHE STRING "" FORCE)
-set(CMAKE_C_FLAGS_RELEASE "-ffast-math -O3 -flto -fvisibility=hidden -g" CACHE STRING "" FORCE)
+set(CMAKE_C_FLAGS_RELEASE "-ffast-math -O3 -flto -g" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE " ${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
set(cmake-link-common "-stdlib=libc++ -arch x86_64")
diff --git a/cmake/linux.cmake b/cmake/linux.cmake
index 326c4d4a..5513f511 100644
--- a/cmake/linux.cmake
+++ b/cmake/linux.cmake
@@ -7,7 +7,7 @@ set(CMAKE_AR "gcc-ar" CACHE STRING "" FORCE)
set(CMAKE_NM "gcc-nm" CACHE STRING "" FORCE)
set(CMAKE_RANLIB "gcc-ranlib" CACHE STRING "" FORCE)
-set(CMAKE_C_FLAGS_RELEASE "-ffast-math -O3 -flto -fuse-linker-plugin -fvisibility=hidden -fPIC" CACHE STRING "" FORCE)
+set(CMAKE_C_FLAGS_RELEASE "-ffast-math -O3 -flto -fuse-linker-plugin -fPIC" CACHE STRING "" FORCE)
set(CMAKE_CXX_FLAGS_RELEASE " ${CMAKE_C_FLAGS_RELEASE} " CACHE STRING "" FORCE)
set(cmake-link-common "")
diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake
index ec552103..b543bbdd 100644
--- a/cmake/mingw-w64.cmake
+++ b/cmake/mingw-w64.cmake
@@ -81,7 +81,7 @@ if(WARNINGS_ENABLE)
set(_CXX_WARNS "${_C_WARNS} ${usual-warns} ${noisy-warns} ${missing-override}")
endif()
-set(ccflags-common "-fvisibility=hidden -pipe -g3")
+set(ccflags-common "-pipe -g3")
set(_CXXFLAGS "${ccflags-common} ${_CXX_WARNS}")
set(_CFLAGS "${ccflags-common} -std=c11 ${_C_WARNS}")
set(_CFLAGS_RELEASE "${cpu} ${fpu} ${lto} ${sections} ${cc}")
diff --git a/cmake/opentrack-boilerplate.cmake b/cmake/opentrack-boilerplate.cmake
index 9d72c1af..40f65474 100644
--- a/cmake/opentrack-boilerplate.cmake
+++ b/cmake/opentrack-boilerplate.cmake
@@ -117,8 +117,6 @@ function(otr_install_pdb_current_project target)
endif()
endfunction()
-include(CMakeParseArguments)
-
function(otr_module n_)
message(STATUS "module ${n_}")
cmake_parse_arguments(arg
@@ -173,6 +171,10 @@ function(otr_module n_)
set_property(TARGET "${n}" PROPERTY PREFIX "")
endif()
+ if(NOT arg_NO-QT)
+ otr_qt2("${n}")
+ endif()
+
set(self "${n}" PARENT_SCOPE)
if(NOT arg_RELINK)
diff --git a/cmake/opentrack-hier.cmake b/cmake/opentrack-hier.cmake
index 2b3159b4..e3eeab11 100644
--- a/cmake/opentrack-hier.cmake
+++ b/cmake/opentrack-hier.cmake
@@ -1,56 +1,58 @@
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
-# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-include_guard(GLOBAL)
-
-set(opentrack-install-rpath "")
-if(APPLE)
- set(opentrack-hier-pfx ".")
- set(opentrack-hier-path "/") # MUST HAVE A TRAILING BACKSLASH
- set(opentrack-hier-doc "/") # MUST HAVE A TRAILING BACKSLASH
- set(opentrack-hier-str RUNTIME DESTINATION . LIBRARY DESTINATION .)
- set(opentrack-doc-pfx "./doc")
- set(opentrack-doc-src-pfx "./source-code")
- set(opentrack-i18n-pfx "./i18n")
- set(opentrack-i18n-path "./i18n")
-elseif(WIN32)
- set(opentrack-hier-pfx "./modules")
- set(opentrack-hier-path "/modules/") # MUST HAVE A TRAILING BACKSLASH
- set(opentrack-hier-doc "/doc/") # MUST HAVE A TRAILING BACKSLASH
- set(opentrack-doc-pfx "./doc")
- set(opentrack-doc-src-pfx "./source-code")
- set(opentrack-hier-str RUNTIME DESTINATION ./modules/ LIBRARY DESTINATION ./modules/)
- set(opentrack-i18n-pfx "./i18n")
- set(opentrack-i18n-path "./i18n")
- set(opentrack-hier-debug "./debug")
-else()
- set(opentrack-hier-pfx "libexec/opentrack")
- set(opentrack-hier-path "/../libexec/opentrack/") # MUST HAVE A TRAILING BACKSLASH
- set(opentrack-hier-doc "/share/doc/opentrack/") # MUST HAVE A TRAILING BACKSLASH
- set(opentrack-doc-pfx "./share/doc/opentrack")
- set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code")
- set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
- set(opentrack-hier-str ARCHIVE DESTINATION share/opentrack LIBRARY DESTINATION ${opentrack-hier-pfx} RUNTIME DESTINATION bin)
- set(opentrack-i18n-pfx "./share/opentrack/i18n")
- set(opentrack-i18n-path "../share/opentrack/i18n")
-endif()
-
-function(otr_escape_string var str)
- string(REGEX REPLACE "([\$\\\"#])" "\\\\\\1" tmp__ "${str}")
- set(${var} "${tmp__}" PARENT_SCOPE)
-endfunction()
-
-set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
-
-set(opentrack-binary-suffix "")
-if(APPLE)
- set(opentrack-binary-suffix ".bin")
-elseif(WIN32)
- set(opentrack-binary-suffix ".exe")
-endif()
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+
+include_guard(GLOBAL)
+
+set(opentrack-install-rpath "")
+if(APPLE)
+ set(opentrack-hier-pfx ".")
+ set(opentrack-hier-path "/") # MUST HAVE A TRAILING BACKSLASH
+ set(opentrack-hier-doc "/") # MUST HAVE A TRAILING BACKSLASH
+ set(opentrack-hier-str RUNTIME DESTINATION . LIBRARY DESTINATION .)
+ set(opentrack-doc-pfx "./doc")
+ set(opentrack-doc-src-pfx "./source-code")
+ set(opentrack-i18n-pfx "./i18n")
+ set(opentrack-i18n-path "./i18n")
+elseif(WIN32)
+ set(opentrack-hier-pfx "./modules")
+ set(opentrack-hier-path "/modules/") # MUST HAVE A TRAILING BACKSLASH
+ set(opentrack-hier-doc "/doc/") # MUST HAVE A TRAILING BACKSLASH
+ set(opentrack-doc-pfx "./doc")
+ set(opentrack-doc-src-pfx "./source-code")
+ set(opentrack-hier-str RUNTIME DESTINATION ./modules/ LIBRARY DESTINATION ./modules/)
+ set(opentrack-i18n-pfx "./i18n")
+ set(opentrack-i18n-path "./i18n")
+ set(opentrack-hier-debug "./debug")
+else()
+ set(opentrack-hier-pfx "libexec/opentrack")
+ set(opentrack-hier-path "/../libexec/opentrack/") # MUST HAVE A TRAILING BACKSLASH
+ set(opentrack-hier-doc "/share/doc/opentrack/") # MUST HAVE A TRAILING BACKSLASH
+ set(opentrack-doc-pfx "./share/doc/opentrack")
+ set(opentrack-doc-src-pfx "./share/doc/opentrack/source-code")
+ set(opentrack-install-rpath "${CMAKE_INSTALL_PREFIX}/${opentrack-hier-pfx}")
+ set(opentrack-hier-str ARCHIVE DESTINATION share/opentrack LIBRARY DESTINATION ${opentrack-hier-pfx} RUNTIME DESTINATION bin)
+ set(opentrack-i18n-pfx "./share/opentrack/i18n")
+ set(opentrack-i18n-path "../share/opentrack/i18n")
+endif()
+
+function(otr_escape_string var str)
+ string(REGEX REPLACE "([\$\\\"#])" "\\\\\\1" tmp__ "${str}")
+ set(${var} "${tmp__}" PARENT_SCOPE)
+endfunction()
+
+set(opentrack-contrib-pfx "${opentrack-doc-pfx}/contrib")
+
+set(opentrack-binary-suffix "")
+if(APPLE)
+ set(opentrack-binary-suffix ".bin")
+elseif(WIN32)
+ set(opentrack-binary-suffix ".exe")
+endif()
+
+set(CMAKE_INSTALL_RPATH "${opentrack-install-rpath}")
diff --git a/cmake/opentrack-load-user-settings.cmake b/cmake/opentrack-load-user-settings.cmake
index a0284943..0ce6e9b0 100644
--- a/cmake/opentrack-load-user-settings.cmake
+++ b/cmake/opentrack-load-user-settings.cmake
@@ -20,9 +20,6 @@ else()
endif()
endif()
-include(CMakeDetermineCCompiler)
-include(CMakeDetermineCXXCompiler)
-
if(NOT CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME)
set(__sdk_host_os "${CMAKE_HOST_SYSTEM_NAME}-cross-")
else()
diff --git a/cmake/opentrack-pkg-config.cmake b/cmake/opentrack-pkg-config.cmake
index b12b786c..7d70070e 100644
--- a/cmake/opentrack-pkg-config.cmake
+++ b/cmake/opentrack-pkg-config.cmake
@@ -14,7 +14,6 @@ function(otr_pkgconfig target)
set(includes ${includes} ${${k}_INCLUDE_DIRS} ${${k}_INCLUDEDIR})
set(ldflags "${ldflags} ${${k}_LDFLAGS} ")
set(libs ${libs} ${${k}_LIBRARIES})
- #message(STATUS "${target} | ${i} | ${cflags} | ${includes} | ${ldflags} | ${libs} | ")
else()
message(FATAL_ERROR "Can't find '${i}'. Please install development files for this package.")
endif()
diff --git a/cmake/opentrack-platform.cmake b/cmake/opentrack-platform.cmake
index 1df19b2b..32599896 100644
--- a/cmake/opentrack-platform.cmake
+++ b/cmake/opentrack-platform.cmake
@@ -23,6 +23,10 @@
include_guard(GLOBAL)
+if(MSVC AND MSVC_VERSION LESS "1915" AND NOT ".${CMAKE_CXX_COMPILER_ID}" STREQUAL ".Clang")
+ message(FATAL_ERROR "Visual Studio too old. Use Visual Studio 2017 or newer.")
+endif()
+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "" FORCE)
endif()
@@ -34,26 +38,28 @@ endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" __build_type)
set(CMAKE_BUILD_TYPE "${__build_type}" CACHE STRING "" FORCE)
-set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
+include_directories("${CMAKE_SOURCE_DIR}")
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*|i[0-9]86.*|x86.*")
- set(opentrack-intel TRUE)
-else()
- set(opentrack-intel FALSE)
-endif()
+set(opentrack_maintainer-mode FALSE CACHE INTERNAL "Select if developing core code (not modules)")
-if(CMAKE_SIZEOF_VOID_P GREATER_EQUAL 8)
- set(opentrack-64bit TRUE)
-else()
- set(opentrack-64bit FALSE)
-endif()
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_DEFAULT 17)
+set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+set(CMAKE_CXX_EXTENSIONS FALSE)
-if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
- set(CMAKE_OSX_ARCHITECTURES "x86_64")
-endif()
+set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+set(CMAKE_SKIP_INSTALL_RPATH FALSE)
+set(CMAKE_SKIP_RPATH FALSE)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC OFF)
+set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
-if(MSVC AND MSVC_VERSION LESS "1915" AND NOT ".${CMAKE_CXX_COMPILER_ID}" STREQUAL ".Clang")
- message(FATAL_ERROR "Visual Studio too old. Use Visual Studio 2017 or newer.")
+set(CMAKE_C_VISIBILITY_PRESET hidden)
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+
+if(NOT WIN32 AND NOT APPLE)
+ include(opentrack-pkg-config)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
@@ -66,12 +72,39 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_CLANG TRUE)
endif()
+if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES)
+ set(CMAKE_OSX_ARCHITECTURES "x86_64")
+ set(opentrack-intel TRUE)
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*|i[0-9]86.*|x86.*")
+ set(opentrack-intel TRUE)
+else()
+ set(opentrack-intel FALSE)
+endif()
+
+if(CMAKE_SIZEOF_VOID_P GREATER_EQUAL 8)
+ set(opentrack-64bit TRUE)
+else()
+ set(opentrack-64bit FALSE)
+endif()
+
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(LINUX TRUE)
endif()
+if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-cxa-atexit")
+ # assume binutils
+ foreach (i SHARED MODULE EXE)
+ set(CMAKE_${i}_LINKER_FLAGS "-Wl,-z,relro,-z,now,--exclude-libs,ALL ${CMAKE_${i}_LINKER_FLAGS}")
+ endforeach()
+endif()
+
if(WIN32)
- add_definitions(-D_USE_MATH_DEFINES=1)
+ add_definitions(-D_USE_MATH_DEFINES=1 -DSTRSAFE_NO_DEPRECATE)
+endif()
+
+if(MINGW)
+ add_definitions(-DMINGW_HAS_SECURE_API)
endif()
if(MSVC)
@@ -85,7 +118,7 @@ if(MSVC)
set(__stuff "-permissive- -diagnostics:caret")
set(CMAKE_CXX_FLAGS "${__stuff} ${CMAKE_CXX_FLAGS}")
- set(CMAKE_C_FLAGS "${__stuff} ${CMAKE_CXX_FLAGS}")
+ set(CMAKE_C_FLAGS "${__stuff} ${CMAKE_C_FLAGS}")
if(opentrack-64bit)
set(ent "-HIGHENTROPYVA")
@@ -99,67 +132,14 @@ if(MSVC)
endforeach()
endif()
-if(WIN32)
- if(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_RC_COMPILER_INIT i686-w64-mingw32-windres)
- set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> --use-temp-file -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
- endif()
- enable_language(RC)
-endif()
-
-if(opentrack-install-rpath)
- set(CMAKE_INSTALL_RPATH "${opentrack-install-rpath}")
-else()
- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}")
-endif()
-
-set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-set(CMAKE_SKIP_INSTALL_RPATH FALSE)
-set(CMAKE_SKIP_RPATH FALSE)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC OFF)
-set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-
-include_directories("${CMAKE_SOURCE_DIR}")
-
-if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE)
- set(_common "-fvisibility=hidden")
- set(CMAKE_C_FLAGS "${_common} ${CMAKE_C_FLAGS}")
- set(CMAKE_CXX_FLAGS "${_common} -fuse-cxa-atexit ${CMAKE_CXX_FLAGS}")
-endif()
-
if(APPLE)
set(CMAKE_MACOSX_RPATH OFF)
- set(apple-frameworks "-stdlib=libc++ -framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon")
- set(CMAKE_SHARED_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_SHARED_LINKER_FLAGS}")
- #set(CMAKE_STATIC_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_STATIC_LINKER_FLAGS}")
- set(CMAKE_EXE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_EXE_LINKER_FLAGS}")
- set(CMAKE_MODULE_LINKER_FLAGS " ${apple-frameworks} ${CMAKE_MODULE_LINKER_FLAGS}")
+ set(apple-frameworks "-framework Cocoa -framework CoreFoundation -lobjc -lz -framework Carbon")
+ foreach (k SHARED EXE MODULE)
+ set(CMAKE_${k}_LINKER_FLAGS "-stdlib=libc++ ${CMAKE_${k}_LINKER_FLAGS} ${apple-frameworks}")
+ endforeach()
set(CMAKE_CXX_FLAGS "-stdlib=libc++ ${CMAKE_CXX_FLAGS}")
endif()
-set(CMAKE_CXX_STANDARD 17)
-set(CMAKE_CXX_STANDARD_DEFAULT 17)
-set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
-set(CMAKE_CXX_EXTENSIONS FALSE)
-
-foreach(k _RELEASE _DEBUG _RELWITHDEBINFO _MINSIZEREL)
- set(CMAKE_C_FLAGS${k} "${CMAKE_C_FLAGS${k}} -UNDEBUG")
- set(CMAKE_CXX_FLAGS${k} "${CMAKE_CXX_FLAGS${k}} -UNDEBUG")
-endforeach()
-
-if(MINGW)
- add_definitions(-DMINGW_HAS_SECURE_API)
- add_definitions(-DSTRSAFE_NO_DEPRECATE)
-endif()
-# assume binutils
-if(UNIX AND NOT APPLE)
- foreach (i SHARED MODULE EXE)
- set(CMAKE_${i}_LINKER_FLAGS "-Wl,-z,relro,-z,now,--exclude-libs,ALL ${CMAKE_${i}_LINKER_FLAGS}")
- endforeach()
- include(opentrack-pkg-config)
-endif()
-set(opentrack_maintainer-mode FALSE CACHE BOOL "Select if developing core code (not modules)")
diff --git a/cmake/opentrack-policy.cmake b/cmake/opentrack-policy.cmake
index e14bcbf7..209ef529 100644
--- a/cmake/opentrack-policy.cmake
+++ b/cmake/opentrack-policy.cmake
@@ -1,5 +1,20 @@
include_guard(GLOBAL)
-foreach(k CMP0020 CMP0022 CMP0058 CMP0028 CMP0042 CMP0063 CMP0053 CMP0011 CMP0054 CMP0012 CMP0069)
+
+set(_policies
+ CMP0020
+ CMP0022
+ CMP0058
+ CMP0028
+ CMP0042
+ CMP0063
+ CMP0053
+ CMP0011
+ CMP0054
+ CMP0012
+ CMP0069
+ CMP0063
+)
+foreach(k ${_policies})
if(POLICY ${k})
cmake_policy(SET ${k} NEW)
endif()
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake
index e90e3250..0e6ca73d 100644
--- a/cmake/opentrack-qt.cmake
+++ b/cmake/opentrack-qt.cmake
@@ -59,8 +59,14 @@ function(otr_qt n)
list(APPEND ${n}-all ${${n}-${i}})
endforeach()
set(${n}-all "${${n}-all}" PARENT_SCOPE)
- include_directories(SYSTEM ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
- add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS})
- add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
- add_definitions(-DQT_DEPRECATED -DQT_DISABLE_DEPRECATED_BEFORE=-1)
+endfunction()
+
+function(otr_qt2 n)
+ target_include_directories("${n}" PRIVATE SYSTEM
+ ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}
+ )
+ target_compile_definitions("${n}" PRIVATE
+ ${Qt5Core_DEFINITIONS} ${Qt5Gui_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}
+ -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
+ )
endfunction()
diff --git a/compat/run-in-thread.hpp b/compat/run-in-thread.hpp
index afe279f2..6aadab45 100644
--- a/compat/run-in-thread.hpp
+++ b/compat/run-in-thread.hpp
@@ -108,8 +108,8 @@ template<typename F>
void run_in_thread_async(QObject* obj, F&& fun)
{
QObject src;
- QThread* t(obj->thread());
- assert(t);
+ QThread* t = obj->thread();
+ if (!t) abort();
src.moveToThread(t);
QObject::connect(&src, &QObject::destroyed, obj, std::move(fun), Qt::AutoConnection);
}
diff --git a/compat/timer.cpp b/compat/timer.cpp
index 15e9d8a4..b46ebe4a 100644
--- a/compat/timer.cpp
+++ b/compat/timer.cpp
@@ -6,6 +6,8 @@
* notice appear in all copies.
*/
+#undef NDEBUG
+
#include "timer.hpp"
#include <cassert>
#include <cmath>
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
index dbc3ab3a..90849bab 100644
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -1,39 +1,43 @@
+#undef NDEBUG
+#include <cassert>
+
#include "keyboard.h"
#include <QDebug>
#ifdef _WIN32
-auto keyboard_listener::make_token()
+
+void keyboard_listener::receive_key(const Key& k)
{
- return [this](const Key& k) {
- if(!k.guid.isEmpty())
- {
- int mods = 0;
- if (k.alt) mods |= Qt::AltModifier;
- if (k.shift) mods |= Qt::ShiftModifier;
- if (k.ctrl) mods |= Qt::ControlModifier;
- emit joystick_button_pressed(k.guid, k.keycode | mods, k.held);
- }
- else
- {
- Qt::KeyboardModifiers m;
- QKeySequence k_;
- if (win_key::to_qt(k, k_, m))
- emit key_pressed({ int(m) | int(k_) });
- }
- };
+ if(!k.guid.isEmpty())
+ {
+ int mods = 0;
+ if (k.alt) mods |= Qt::AltModifier;
+ if (k.shift) mods |= Qt::ShiftModifier;
+ if (k.ctrl) mods |= Qt::ControlModifier;
+
+ emit joystick_button_pressed(k.guid, k.keycode | mods, k.held);
+ }
+ else
+ {
+ Qt::KeyboardModifiers m;
+ QKeySequence k_;
+
+ if (win_key::to_qt(k, k_, m))
+ for (unsigned i = 0; i < (unsigned)k_.count(); i++)
+ emit key_pressed(QKeySequence(int(m) | k_[i]));
+ }
}
#endif
-keyboard_listener::keyboard_listener(QWidget* parent) :
- QDialog(parent)
-#ifdef _WIN32
- , token(make_token())
-#endif
+keyboard_listener::keyboard_listener(QWidget* parent) : QDialog(parent)
{
ui.setupUi(this);
setFocusPolicy(Qt::StrongFocus);
+#ifdef _WIN32
+ (void)token;
+#endif
}
#if !defined _WIN32
diff --git a/gui/keyboard.h b/gui/keyboard.h
index 0a06a3af..ea35d372 100644
--- a/gui/keyboard.h
+++ b/gui/keyboard.h
@@ -22,13 +22,17 @@
class OTR_GUI_EXPORT keyboard_listener : public QDialog
{
Q_OBJECT
- Ui_keyboard_listener ui;
+
#ifdef _WIN32
- auto make_token();
- KeybindingWorker::Token token;
+ void receive_key(const Key& k);
+
+ KeybindingWorker::Token token{[this](const Key& k) {receive_key(k);}};
#else
void keyPressEvent(QKeyEvent* event) override;
#endif
+
+ Ui_keyboard_listener ui;
+
public:
keyboard_listener(QWidget* parent = nullptr);
signals:
diff --git a/logic/win32-shortcuts.cpp b/logic/win32-shortcuts.cpp
index 324b1b04..c2920071 100644
--- a/logic/win32-shortcuts.cpp
+++ b/logic/win32-shortcuts.cpp
@@ -121,7 +121,7 @@ static const win_key windows_key_sequences[] {
{ DIK_PAUSE, Qt::Key_Pause},
{ DIK_NUMLOCK, Qt::Key_NumLock},
{ DIK_CAPSLOCK, Qt::Key_CapsLock},
-#define key_mod(x, y) Qt::Key(int(x) | int((y)))
+#define key_mod(x, y) Qt::Key(int((x)) | int((y)))
{ DIK_NUMPAD0, key_mod(Qt::Key_0, Qt::KeypadModifier)},
{ DIK_NUMPAD0, key_mod(Qt::Key_0, Qt::KeypadModifier)},
{ DIK_NUMPAD1, key_mod(Qt::Key_1, Qt::KeypadModifier)},
@@ -163,26 +163,22 @@ bool win_key::to_qt(const Key& k, QKeySequence& qt_, Qt::KeyboardModifiers &mods
bool win_key::from_qt(const QKeySequence& qt_, int& dik, Qt::KeyboardModifiers& mods)
{
// CAVEAT don't use QVariant::toUInt() or conversion fails
-#if 0
- const unsigned qt = QVariant(qt_).toInt(); // verbose
-#endif
- const unsigned qt = (unsigned)int(qt_); // deprecated
- const unsigned our_mods = qt & Qt::KeyboardModifierMask;
+ const unsigned qt = (unsigned)QVariant(qt_).toInt();
+ const unsigned our_mods = qt & (unsigned)Qt::KeyboardModifierMask;
if (qt == 0)
return false;
+ for (const win_key& wk : windows_key_sequences)
{
- for (const win_key& wk : windows_key_sequences)
+ if (unsigned(wk.qt) == qt)
{
- if (unsigned(wk.qt) == qt)
- {
- dik = wk.win;
- mods = Qt::NoModifier;
- return true;
- }
+ dik = wk.win;
+ mods = Qt::NoModifier;
+ return true;
}
}
+
{
const unsigned key = qt & ~Qt::KeyboardModifierMask;
for (const win_key& wk : windows_key_sequences)
diff --git a/spline/spline-widget.cpp b/spline/spline-widget.cpp
index 36d3e2bf..db65722e 100644
--- a/spline/spline-widget.cpp
+++ b/spline/spline-widget.cpp
@@ -107,7 +107,7 @@ void spline_widget::drawBackground()
const QPen pen(color__, 1, Qt::SolidLine, Qt::FlatCap);
- const int ystep = std::ceil(y_step_), xstep = std::ceil(x_step_);
+ const int ystep = (int)std::ceil(y_step_), xstep = (int)std::ceil(x_step_);
const double maxx = config->max_input();
const double maxy = config->max_output();
@@ -135,9 +135,9 @@ void spline_widget::drawBackground()
QPointF(x, pixel_bounds.y() + pixel_bounds.height()),
pen);
const QString text = QString::number(i);
- painter.drawText(QRectF(x - metrics.width(text)/2.,
+ painter.drawText(QRectF(x - metrics.horizontalAdvance(text)/2.,
pixel_bounds.height() + 10 + metrics.height(),
- metrics.width(text),
+ metrics.horizontalAdvance(text),
metrics.height()),
text);
}
@@ -505,7 +505,7 @@ void spline_widget::show_tooltip(const QPoint& pos, const QPointF& value_)
double x = value.x(), y = value.y();
if (preview_only)
- y = (double)config->get_value_no_save((float)x);
+ y = (double)config->get_value_no_save(x);
const int x_ = iround(x), y_ = iround(y);
@@ -514,16 +514,13 @@ void spline_widget::show_tooltip(const QPoint& pos, const QPointF& value_)
if (std::fabs(y_ - y) < 1e-3)
y = y_;
- // the style on OSX has different offsets
- constexpr bool is_fusion =
+ // the native OSX style doesn't look right otherwise
#if defined __APPLE__
- true;
+ constexpr int off_x = 0, off_y = 0;
#else
- false;
+ constexpr int off_x = 25, off_y = 15;
#endif
- const int off_x = (is_fusion ? 25 : 0), off_y = (is_fusion ? 15 : 0);
-
const QPoint pix(pos.x() + off_x, pos.y() + off_y);
QToolTip::showText(mapToGlobal(pix),
diff --git a/tracker-fusion/fusion.cpp b/tracker-fusion/fusion.cpp
index 5bf979ff..3e849caa 100644
--- a/tracker-fusion/fusion.cpp
+++ b/tracker-fusion/fusion.cpp
@@ -6,6 +6,8 @@
* notice appear in all copies.
*/
+#undef NDEBUG
+
#include "fusion.h"
#include "compat/library-path.hpp"
diff --git a/tracker-hatire/CMakeLists.txt b/tracker-hatire/CMakeLists.txt
index 39431724..a73a471c 100644
--- a/tracker-hatire/CMakeLists.txt
+++ b/tracker-hatire/CMakeLists.txt
@@ -1,5 +1,5 @@
if(Qt5SerialPort_FOUND)
otr_module(tracker-hatire)
- target_link_libraries(opentrack-tracker-hatire ${Qt5SerialPort_LIBRARIES})
- target_include_directories(opentrack-tracker-hatire SYSTEM PUBLIC ${Qt5SerialPort_INCLUDE_DIRS})
+ target_link_libraries(${self} ${Qt5SerialPort_LIBRARIES})
+ target_include_directories(${self} SYSTEM PUBLIC ${Qt5SerialPort_INCLUDE_DIRS})
endif()
diff --git a/tracker-hatire/ftnoir_tracker_hat.h b/tracker-hatire/ftnoir_tracker_hat.h
index 0f88c7f6..b2300556 100644
--- a/tracker-hatire/ftnoir_tracker_hat.h
+++ b/tracker-hatire/ftnoir_tracker_hat.h
@@ -20,14 +20,14 @@ class hatire : public QObject, public ITracker
public:
hatire();
- ~hatire();
+ ~hatire() override;
- module_status start_tracker(QFrame*);
- void data(double *data);
+ module_status start_tracker(QFrame*) override;
+ void data(double *data) override;
//void center();
//bool notifyZeroed();
void reset();
- void get_info( int *tps );
+ void get_info(int *tps);
void serial_info();
void send_serial_command(const QByteArray& x);
@@ -50,6 +50,6 @@ class hatire_metadata : public Metadata
{
Q_OBJECT
- QString name() { return tr("Hatire Arduino"); }
- QIcon icon() { return QIcon(":/images/hat.png"); }
+ QString name() override { return tr("Hatire Arduino"); }
+ QIcon icon() override { return QIcon(":/images/hat.png"); }
};
diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp
index 4c9574b9..4938e77f 100644
--- a/tracker-hatire/thread.cpp
+++ b/tracker-hatire/thread.cpp
@@ -169,7 +169,6 @@ serial_result hatire_thread::init_serial_port_impl()
&& com_port.setStopBits((QSerialPort::StopBits)s.pStopBits)
&& com_port.setFlowControl((QSerialPort::FlowControl)s.pFlowControl)
&& com_port.clear(QSerialPort::AllDirections)
- && com_port.setDataErrorPolicy(QSerialPort::IgnorePolicy)
)
{
Log(tr("Port Parameters set"));
diff --git a/tracker-wii/wiiyourself/wiimote.h b/tracker-wii/wiiyourself/wiimote.h
index 9b6d3ba3..73212e05 100644
--- a/tracker-wii/wiiyourself/wiimote.h
+++ b/tracker-wii/wiiyourself/wiimote.h
@@ -10,6 +10,8 @@
#pragma once
+#undef NDEBUG
+
#include "warns-begin.hpp"
#undef WIN32_LEAN_AND_MEAN