From a2d4d3bb91dffb3a923831e6e9fd7fe4e83fe433 Mon Sep 17 00:00:00 2001 From: Torsten Sadowski Date: Sat, 3 Nov 2018 20:43:37 +0100 Subject: [PATCH] Use QSocketNotifier for the libspnav polling interface --- src/Gui/3Dconnexion/GuiNativeEventLinux.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp b/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp index 2c594f1f42..c136b5509d 100644 --- a/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp +++ b/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp @@ -8,7 +8,8 @@ Implementation by Torsten Sadowski 2018 #include #include #include -#include + +#include #include @@ -35,9 +36,8 @@ void Gui::GuiNativeEvent::initSpaceball(QMainWindow *window) Base::Console().Log("Couldn't connect to spacenav daemon\n"); } else { Base::Console().Log("Connected to spacenav daemon\n"); - QTimer* SpacenavPollTimer = new QTimer(this); - connect(SpacenavPollTimer, &QTimer::timeout, this, &GuiNativeEvent::pollSpacenav); - SpacenavPollTimer->start(20); + QSocketNotifier* SpacenavNotifier = new QSocketNotifier(spnav_fd(), QSocketNotifier::Read, this); + connect(SpacenavNotifier, &QSocketNotifier::activated, this, &GuiNativeEvent::pollSpacenav); mainApp->setSpaceballPresent(true); } }