[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra/calligra/2.8] krita: Fix tablet stylus rotation on Linux
From: Dmitry Kazakov <dimula73 () gmail ! com>
Date: 2014-08-23 14:53:59
Message-ID: E1XLChb-0003lJ-3V () scm ! kde ! org
[Download RAW message or body]
Git commit 543482d4677d68e91236fd0aeaf3d9020399202e by Dmitry Kazakov.
Committed on 12/05/2014 at 11:58.
Pushed by dkazakov into branch 'calligra/2.8'.
Fix tablet stylus rotation on Linux
The Windows part will be fixed during the upcoming sprint.
CCBUG:331358
M +1 -1 krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
M +3 -1 krita/ui/input/wintab/kis_tablet_support.h
M +9 -1 krita/ui/input/wintab/kis_tablet_support_win.cpp
M +6 -2 krita/ui/input/wintab/kis_tablet_support_x11.cpp
http://commits.kde.org/calligra/543482d4677d68e91236fd0aeaf3d9020399202e
diff --git a/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h \
b/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h index \
eee2c48..2ec7801 100644
--- a/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
+++ b/krita/plugins/paintops/libpaintop/sensors/kis_dynamic_sensors.h
@@ -43,7 +43,7 @@ public:
KisDynamicSensorRotation();
virtual ~KisDynamicSensorRotation() { }
virtual qreal value(const KisPaintInformation& info) {
- return info.rotation() / 28 + 0.5; // it appears that rotation is between \
-14 and +14 + return info.rotation() / 360.0;
}
};
diff --git a/krita/ui/input/wintab/kis_tablet_support.h \
b/krita/ui/input/wintab/kis_tablet_support.h index 285a20a..e12ce40 100644
--- a/krita/ui/input/wintab/kis_tablet_support.h
+++ b/krita/ui/input/wintab/kis_tablet_support.h
@@ -43,6 +43,8 @@ struct QTabletDeviceData
int minTanPressure;
int maxTanPressure;
int minX, maxX, minY, maxY, minZ, maxZ;
+ int minRotation;
+ int maxRotation;
inline QPointF scaleCoord(int coordX, int coordY, int outOriginX, int \
outExtentX, int outOriginY, int outExtentY) const;
#endif
@@ -142,7 +144,7 @@ struct QTabletDeviceData
}
inline int rotation() const {
- return m_axis_data[Rotation] / 64;
+ return m_axis_data[Rotation];
}
bool updateAxesData(int firstAxis, int axesCount, const int axes[NAxes]) {
diff --git a/krita/ui/input/wintab/kis_tablet_support_win.cpp \
b/krita/ui/input/wintab/kis_tablet_support_win.cpp index ffb25fb..d6f5423 100644
--- a/krita/ui/input/wintab/kis_tablet_support_win.cpp
+++ b/krita/ui/input/wintab/kis_tablet_support_win.cpp
@@ -235,6 +235,9 @@ static void tabletInit(const quint64 uniqueId, const UINT \
csr_type, HCTX hTab)
qt_tablet_tilt_support = tpOri[0].axResolution && tpOri[1].axResolution;
}
+ tdd.minRotation = 0;
+ tdd.maxRotation = int(tpOri[2].axResolution);
+
tdd.minX = int(lc.lcOutOrgX);
tdd.maxX = int(qAbs(lc.lcOutExtX)) + int(lc.lcOutOrgX);
@@ -462,7 +465,12 @@ bool translateTabletEvent(const MSG &msg, PACKET \
*localPacketBuf, double degY = atan(cos(radAzim) / tanAlt);
tiltX = int(degX * (180 / Q_PI));
tiltY = int(-degY * (180 / Q_PI));
- rotation = ort.orTwist;
+
+ // FIXME: rotation support is not finished yet!
+ rotation = qreal(ort.orTwist - currentTabletPointer.minRotation) /
+ (currentTabletPointer.maxRotation - \
currentTabletPointer.minRotation) * 360.0; +
+ //qDebug() << "Rotation" << ppVar(rotation) << ppVar(ort.orTwist) << \
ppVar(currentTabletPointer.minRotation) << ppVar(currentTabletPointer.maxRotation); \
}
KisTabletEvent e(t, localPos, globalPos, hiResGlobal, \
currentTabletPointer.currentDevice,
diff --git a/krita/ui/input/wintab/kis_tablet_support_x11.cpp \
b/krita/ui/input/wintab/kis_tablet_support_x11.cpp index e049481..1bcebd4 100644
--- a/krita/ui/input/wintab/kis_tablet_support_x11.cpp
+++ b/krita/ui/input/wintab/kis_tablet_support_x11.cpp
@@ -405,6 +405,8 @@ void kis_x11_init_tablet()
device_data.maxTanPressure = 0;
device_data.minZ = 0;
device_data.maxZ = 0;
+ device_data.minRotation = a[5].min_value;
+ device_data.maxRotation = a[5].max_value;
#endif
// got the max pressure no need to go further...
@@ -611,7 +613,8 @@ bool translateXinputEvent(const XEvent *ev, QTabletDeviceData \
*tablet, QWidget * pressure = tablet->savedAxesData.pressure();
xTilt = tablet->savedAxesData.xTilt();
yTilt = tablet->savedAxesData.yTilt();
- rotation = tablet->savedAxesData.rotation();
+ rotation = qreal(tablet->savedAxesData.rotation() - tablet->minRotation) /
+ (tablet->maxRotation - tablet->minRotation) * 360.0;
} else if (button) {
// see the comment in 'motion' branch
@@ -625,7 +628,8 @@ bool translateXinputEvent(const XEvent *ev, QTabletDeviceData \
*tablet, QWidget * pressure = tablet->savedAxesData.pressure();
xTilt = tablet->savedAxesData.xTilt();
yTilt = tablet->savedAxesData.yTilt();
- rotation = tablet->savedAxesData.rotation();
+ rotation = qreal(tablet->savedAxesData.rotation() - tablet->minRotation) /
+ (tablet->maxRotation - tablet->minRotation) * 360.0;
}
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