Index: kcontrol/randr/randr.cpp =================================================================== --- kcontrol/randr/randr.cpp (revision 622289) +++ kcontrol/randr/randr.cpp (working copy) @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "ktimerdialog.h" @@ -120,12 +122,55 @@ m_currentSize = m_proposedSize; m_currentRotation = m_proposedRotation; m_currentRefreshRate = m_proposedRefreshRate; + + // search wacom utility and set orientation for available wacom pointers + QString xsetwacom = KStandardDirs::findExe("xsetwacom"); + if (!xsetwacom.isEmpty()) { + m_wacomPointers.clear(); + KProcess *proc = new KProcess; + connect(proc, SIGNAL(receivedStdout(KProcess *, char *, int)), SLOT(gotAvailablePointers(KProcess *, char *, int))); + *proc << "xsetwacom" << "list"; + if (!proc->start(KProcess::Block,KProcess::Stdout)) + kdError("Could not ask xsetwacom for available pointers."); + else { + for ( QStringList::Iterator it = m_wacomPointers.begin(); it != m_wacomPointers.end(); ++it ) { + KProcess *set = new KProcess; + *set << "xsetwacom" << "set" << (*it) << "rotate"; + switch (m_currentRotation) { + case RR_Rotate_90: + *set << "2"; + break; + case RR_Rotate_180: + *set << "3"; + break; + case RR_Rotate_270: + *set << "1"; + break; + default: + *set << "0"; + } + if (!set->start()) + kdError("Could not set orientation for wacom pointers."); + } + } + } + return true; } return false; } +void RandRScreen::gotAvailablePointers(KProcess*, char *buffer, int len) +{ + QString myBuf = QString::fromLatin1(buffer, len); + QStringList lines = QStringList::split('\n', myBuf); + for ( QStringList::Iterator it = lines.begin(); it != lines.end(); it++) { + QStringList split = QStringList::split(' ', (*it)); + m_wacomPointers+=split.first(); + } +} + bool RandRScreen::applyProposedAndConfirm() { if (proposedChanged()) { Index: kcontrol/randr/randr.h =================================================================== --- kcontrol/randr/randr.h (revision 622289) +++ kcontrol/randr/randr.h (working copy) @@ -28,6 +28,7 @@ class KTimerDialog; class RandRScreenPrivate; +class KProcess; class RandRScreen : public QObject { @@ -170,11 +171,14 @@ int m_proposedSize; int m_proposedRefreshRate; + QStringList m_wacomPointers; + KTimerDialog* m_shownDialog; private slots: void desktopResized(); void shownDialogDestroyed(); + void gotAvailablePointers(KProcess*, char *buffer, int len); }; typedef QPtrList ScreenList;