File rotate-wacom-pointers.diff of Package kdebase4-workspace
--- kcontrol/randr/randrscreen.cpp.sav 2009-11-10 18:51:08.000000000 +0100
+++ kcontrol/randr/randrscreen.cpp 2009-11-10 19:01:46.000000000 +0100
@@ -490,6 +490,8 @@ bool RandRScreen::applyProposed(bool con
if (succeed && confirm)
succeed = RandR::confirm(r);
+ RandR::rotateWacom( m_unifiedRotation );
+
// if we succeeded applying and the user confirmed the changes,
// just return from here
if (succeed)
--- kcontrol/randr/randr.h.sav 2009-11-04 15:20:07.000000000 +0100
+++ kcontrol/randr/randr.h 2009-11-10 18:53:14.000000000 +0100
@@ -103,6 +103,7 @@ public:
static bool confirm(const QRect &rect = QRect());
static SizeList sortSizes(const SizeList &sizes);
+ static void rotateWacom( int rotation );
};
#endif
--- kcontrol/randr/legacyrandrscreen.cpp.sav 2009-11-10 18:51:08.000000000 +0100
+++ kcontrol/randr/legacyrandrscreen.cpp 2009-11-10 18:57:07.000000000 +0100
@@ -104,6 +104,7 @@ bool LegacyRandRScreen::applyProposed()
m_currentSize = m_proposedSize;
m_currentRotation = m_proposedRotation;
m_currentRefreshRate = m_proposedRefreshRate;
+ RandR::rotateWacom( m_currentRotation );
return true;
}
--- kcontrol/randr/randrcrtc.cpp.sav 2009-11-10 18:51:08.000000000 +0100
+++ kcontrol/randr/randrcrtc.cpp 2009-11-10 19:01:26.000000000 +0100
@@ -317,6 +317,7 @@ bool RandRCrtc::applyProposed()
m_currentRect = m_proposedRect;
m_currentRate = mode.refreshRate();
emit crtcChanged(m_id, RandR::ChangeMode);
+ RandR::rotateWacom( m_currentRotation );
ret = true;
}
else
--- kcontrol/randr/randr.cpp.sav 2009-11-04 15:20:07.000000000 +0100
+++ kcontrol/randr/randr.cpp 2009-11-10 19:00:15.000000000 +0100
@@ -19,6 +19,8 @@
#include "randr.h"
#include <KIconLoader>
+#include <kstandarddirs.h>
+#include <qprocess.h>
bool RandR::has_1_2 = false;
Time RandR::timestamp = 0;
@@ -176,5 +178,40 @@ SizeList RandR::sortSizes(const SizeList
return sorted;
}
+void RandR::rotateWacom( int rotation )
+{
+ // search wacom utility and set orientation for available wacom pointers
+ QString xsetwacom = KStandardDirs::findExe("xsetwacom");
+ if (!xsetwacom.isEmpty()) {
+ QProcess proc;
+ proc.start( "xsetwacom", QStringList() << "list" );
+ if (!proc.waitForStarted() || !proc.waitForFinished()) {
+ kError("Could not ask xsetwacom for available pointers.");
+ return;
+ } else {
+ while( !proc.atEnd()) {
+ QString line = QString::fromLocal8Bit( proc.readLine());
+ QString pointer = line.split( ' ' ).first();
+ QStringList args;
+ args << "set" << pointer << "Rotate";
+ switch (rotation) {
+ case RR_Rotate_90:
+ args << "CW";
+ break;
+ case RR_Rotate_180:
+ args << "HALF";
+ break;
+ case RR_Rotate_270:
+ args << "CCW";
+ break;
+ default:
+ args << "NONE";
+ }
+ if( QProcess::execute( "xsetwacom", args ) != 0 )
+ kError("Could not set orientation for wacom pointers.");
+ }
+ }
+ }
+}