Skip to content

Commit

Permalink
Gui: remove WinNativeGestureRecognizers because this was a workaround…
Browse files Browse the repository at this point in the history
… for Qt4 under Windows
  • Loading branch information
wwmayer committed Apr 2, 2021
1 parent e7c91d6 commit 72eceb9
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 403 deletions.
2 changes: 0 additions & 2 deletions src/Gui/CMakeLists.txt
Expand Up @@ -1263,7 +1263,6 @@ SET(FreeCADGui_CPP_SRCS
WaitCursor.cpp
ManualAlignment.cpp
TransactionObject.cpp
WinNativeGestureRecognizers.cpp
)
SET(FreeCADGui_SRCS
Application.h
Expand Down Expand Up @@ -1296,7 +1295,6 @@ SET(FreeCADGui_SRCS
WaitCursor.h
ManualAlignment.h
TransactionObject.h
WinNativeGestureRecognizers.h
${FreeCADGui_SDK_MOC_HDRS}
)

Expand Down
43 changes: 0 additions & 43 deletions src/Gui/View3DInventorViewer.cpp
Expand Up @@ -145,7 +145,6 @@
#include <QGesture>

#include "SoTouchEvents.h"
#include "WinNativeGestureRecognizers.h"
#include "Document.h"
#include "ViewParams.h"

Expand Down Expand Up @@ -237,35 +236,6 @@ class Gui::ViewerEventFilter : public QObject
~ViewerEventFilter() {}

bool eventFilter(QObject* obj, QEvent* event) {

#ifdef GESTURE_MESS
if (obj->isWidgetType()) {
View3DInventorViewer* v = dynamic_cast<View3DInventorViewer*>(obj);
if(v) {
/* Internally, Qt seems to set up the gestures upon showing the
* widget (but after this event is processed), thus invalidating
* our settings. This piece takes care to retune gestures on the
* next event after the show event.
*/
if(v->winGestureTuneState == View3DInventorViewer::ewgtsNeedTuning) {
try{
WinNativeGestureRecognizerPinch::TuneWindowsGestures(v);
v->winGestureTuneState = View3DInventorViewer::ewgtsTuned;
} catch (Base::Exception &e) {
Base::Console().Warning("Failed to TuneWindowsGestures. Error: %s\n",e.what());
v->winGestureTuneState = View3DInventorViewer::ewgtsDisabled;
} catch (...) {
Base::Console().Warning("Failed to TuneWindowsGestures. Unknown error.\n");
v->winGestureTuneState = View3DInventorViewer::ewgtsDisabled;
}
}
if (event->type() == QEvent::Show && v->winGestureTuneState == View3DInventorViewer::ewgtsTuned)
v->winGestureTuneState = View3DInventorViewer::ewgtsNeedTuning;

}
}
#endif

// Bug #0000607: Some mice also support horizontal scrolling which however might
// lead to some unwanted zooming when pressing the MMB for panning.
// Thus, we filter out horizontal scrolling.
Expand Down Expand Up @@ -574,20 +544,9 @@ void View3DInventorViewer::init()
getEventFilter()->registerInputDevice(new SpaceNavigatorDevice);
getEventFilter()->registerInputDevice(new GesturesDevice(this));

this->winGestureTuneState = View3DInventorViewer::ewgtsDisabled;
try{
this->grabGesture(Qt::PanGesture);
this->grabGesture(Qt::PinchGesture);
#ifdef GESTURE_MESS
{
static WinNativeGestureRecognizerPinch* recognizer;//static to avoid creating more than one recognizer, thus causing memory leak and gradual slowdown
if(recognizer == 0){
recognizer = new WinNativeGestureRecognizerPinch;
recognizer->registerRecognizer(recognizer); //From now on, Qt owns the pointer.
}
}
this->winGestureTuneState = View3DInventorViewer::ewgtsNeedTuning;
#endif
} catch (Base::Exception &e) {
Base::Console().Warning("Failed to set up gestures. Error: %s\n", e.what());
} catch (...) {
Expand Down Expand Up @@ -1504,8 +1463,6 @@ void View3DInventorViewer::setNavigationType(Base::Type t)
if (t.isBad())
return;

this->winGestureTuneState = View3DInventorViewer::ewgtsNeedTuning; //triggers enable/disable rotation gesture when preferences change

if (this->navigation && this->navigation->getTypeId() == t)
return; // nothing to do

Expand Down
7 changes: 0 additions & 7 deletions src/Gui/View3DInventorViewer.h
Expand Up @@ -401,13 +401,6 @@ class GuiExport View3DInventorViewer : public Quarter::SoQTQuarterAdaptor, publi
void printDimension();
void selectAll();

enum eWinGestureTuneState{
ewgtsDisabled, //suppress tuning/re-tuning after errors
ewgtsNeedTuning, //gestures are to be re-tuned upon next event
ewgtsTuned
};
eWinGestureTuneState winGestureTuneState;//See ViewerEventFilter::eventFilter function for explanation

private:
static void setViewportCB(void * userdata, SoAction * action);
static void clearBufferCB(void * userdata, SoAction * action);
Expand Down
287 changes: 0 additions & 287 deletions src/Gui/WinNativeGestureRecognizers.cpp

This file was deleted.

0 comments on commit 72eceb9

Please sign in to comment.