[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/krita-testing-kazakov] krita/ui/input/wintab: Revert "Added three workarounds for the brok
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2014-01-16 12:54:34
Message-ID: E1W3mSw-0002Cr-Up () scm ! kde ! org
[Download RAW message or body]

Git commit 5fbb2a3ec330aa1e1d6348b3f071da6be8fb9d71 by Dmitry Kazakov.
Committed on 16/01/2014 at 08:29.
Pushed by dkazakov into branch 'krita-testing-kazakov'.

Revert "Added three workarounds for the broken evdev driver"

This reverts commit 326297698dc06923ce771c7f1e8b6ccc973422c0.

This breaks usual Wacom tablets

M  +0    -8    krita/ui/input/wintab/kis_tablet_support.h
M  +0    -91   krita/ui/input/wintab/kis_tablet_support_x11.cpp

http://commits.kde.org/calligra/5fbb2a3ec330aa1e1d6348b3f071da6be8fb9d71

diff --git a/krita/ui/input/wintab/kis_tablet_support.h \
b/krita/ui/input/wintab/kis_tablet_support.h index 7a749a7..c850f88 100644
--- a/krita/ui/input/wintab/kis_tablet_support.h
+++ b/krita/ui/input/wintab/kis_tablet_support.h
@@ -75,14 +75,6 @@ struct QTabletDeviceData
 #ifdef Q_WS_WIN
     QMap<quint8, quint8> buttonsMap;
 #endif
-
-#ifdef Q_WS_X11
-    /**
-     * Workaround for the evdev driver, which reports zero pressure in
-     * some cases, e.g. when real pressure is near 1.0.
-     */
-    short lastMotionPressureWorkaround;
-#endif
 };
 
 static inline int sign(int x)
diff --git a/krita/ui/input/wintab/kis_tablet_support_x11.cpp \
b/krita/ui/input/wintab/kis_tablet_support_x11.cpp index a144543..8a6c975 100644
--- a/krita/ui/input/wintab/kis_tablet_support_x11.cpp
+++ b/krita/ui/input/wintab/kis_tablet_support_x11.cpp
@@ -28,8 +28,6 @@
 #include "kis_tablet_support.h"
 #include "wacomcfg.h"
 
-//#define DEBUG_TABLET_EVENTS
-
 /**
  * This is an analog of a Qt's variable qt_tabletChokeMouse.  It is
  * intended to block Mouse events after any accepted Tablet event. In
@@ -307,18 +305,6 @@ void kis_x11_init_tablet()
                         device_data.maxTanPressure = 0;
                         device_data.minZ = 0;
                         device_data.maxZ = 0;
-
-#ifdef DEBUG_TABLET_EVENTS
-                        qDebug() << "=== Getting tablet limits ===";
-                        qDebug() << ppVar(a[0].min_value) << ppVar(a[0].max_value);
-                        qDebug() << ppVar(a[1].min_value) << ppVar(a[1].max_value);
-                        qDebug() << ppVar(a[2].min_value) << ppVar(a[2].max_value) \
                << " <-- pressure";
-                        qDebug() << ppVar(a[3].min_value) << ppVar(a[3].max_value);
-                        qDebug() << ppVar(a[4].min_value) << ppVar(a[4].max_value);
-                        qDebug() << ppVar(a[5].min_value) << ppVar(a[5].max_value);
-                        qDebug() << "=============================";
-#endif /* DEBUG_TABLET_EVENTS */
-
 #endif
 
                         // got the max pressure no need to go further...
@@ -515,51 +501,6 @@ bool translateXinputEvent(const XEvent *ev, QTabletDeviceData \
                *tablet, QWidget *
         hiRes = tablet->scaleCoord(motion->axis_data[0], motion->axis_data[1],
                                     screenArea.x(), screenArea.width(),
                                     screenArea.y(), screenArea.height());
-
-        /**
-         * Workaround "pressure" bug of the evdev driver.
-         *
-         * The bug results in the pressure drop to zero when real
-         * pressure is 1.0 or higher.
-         */
-        if (!pressure &&
-            motion->state & (Button1Mask | Button2Mask | Button3Mask) &&
-            tablet->lastMotionPressureWorkaround > (tablet->minPressure + \
                tablet->maxPressure) / 2) {
-
-            qDebug() << "Workaround broken pressure:" << pressure << "->" << \
                tablet->lastMotionPressureWorkaround;
-            pressure = tablet->lastMotionPressureWorkaround;
-        }
-
-        /**
-         * Workaround "jumping" bug of the evdev driver
-         *
-         * Sometimes hiRes position accidentally jumps to the topleft
-         * corner of the image. The global position still sticks to
-         * the correct position.  Such jumps happen quite rarely and do
-         * not continue for more than 1-2 motion events, so we will
-         * just drop this event to avoid dizzy lines due to rounding
-         * by 'global' position.
-         */
-        if (hiRes.y() < 0.3 * global.y()) {
-
-            qDebug() << "Workaround broken HiRes coords: event eaten" << \
                ppVar(hiRes) << ppVar(global);
-            return true;
-        }
-
-        tablet->lastMotionPressureWorkaround = pressure;
-
-#ifdef DEBUG_TABLET_EVENTS
-        qDebug() << "*** MotionEvent ***";
-        qDebug() << ppVar(hiRes);
-        qDebug() << ppVar(global);
-        qDebug() << ppVar(pressure);
-        qDebug() << ppVar(rotation);
-        qDebug() << ppVar(xTilt) << ppVar(yTilt);
-        qDebug() << ppVar(motion->deviceid);
-        qDebug() << ppVar(tablet->minPressure) << ppVar(tablet->maxPressure);
-        qDebug() << "*******************";
-#endif /* DEBUG_TABLET_EVENTS */
-
     } else if (button) {
         xTilt = (short) button->axis_data[3];
         yTilt = (short) button->axis_data[4];
@@ -568,38 +509,6 @@ bool translateXinputEvent(const XEvent *ev, QTabletDeviceData \
                *tablet, QWidget *
         hiRes = tablet->scaleCoord(button->axis_data[0], button->axis_data[1],
                                     screenArea.x(), screenArea.width(),
                                     screenArea.y(), screenArea.height());
-
-        /**
-         * Workaround "tablet press" bug of the evdev driver
-         *
-         * Evdev driver returns null hi-res position for the Tablet Press event.
-         * That is weird, but we can do nothing better than just fill it with
-         * rounded 'global' position.
-         */
-        if (!button->axis_data[0] &&
-            !button->axis_data[1] &&
-            !global.isNull()) {
-
-            qDebug() << "Workaround null Tablet Press position!";
-            hiRes = global;
-        }
-
-        tablet->lastMotionPressureWorkaround = pressure;
-
-#ifdef DEBUG_TABLET_EVENTS
-        qDebug() << "*** ButtonEvent ***";
-        qDebug() << ppVar(pressure);
-        qDebug() << ppVar(rotation);
-        qDebug() << ppVar(xTilt) << ppVar(yTilt);
-        qDebug() << ppVar(button->deviceid);
-        qDebug() << ppVar(button->axis_data[0]) << ppVar(button->axis_data[1]);
-        qDebug() << ppVar(tablet->minPressure) << ppVar(tablet->maxPressure);
-        qDebug() << ppVar(global);
-        qDebug() << ppVar(curr);
-        qDebug() << ppVar(hiRes);
-        qDebug() << "*******************";
-#endif /* DEBUG_TABLET_EVENTS */
-
     }
     if (deviceType == QTabletEvent::Airbrush) {
         tangentialPressure = rotation;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic