diff --git a/src/common/x11info.h b/src/common/x11info.h --- a/src/common/x11info.h +++ b/src/common/x11info.h @@ -25,8 +25,6 @@ #include #include -#include - namespace Wacom { @@ -39,16 +37,6 @@ { public: - /** - * @return The default screen for the application. - */ - static int getDefaultScreen(); - - /** - * @return The default display for the application. - */ - static Display* getDisplay(); - /** * @return All screens united as one rectangle. */ diff --git a/src/common/x11info.cpp b/src/common/x11info.cpp --- a/src/common/x11info.cpp +++ b/src/common/x11info.cpp @@ -22,23 +22,8 @@ #include #include -#include - using namespace Wacom; - -int X11Info::getDefaultScreen() -{ - return QX11Info::appScreen(); -} - - -Display* X11Info::getDisplay() -{ - return QX11Info::display(); -} - - const QRect X11Info::getDisplayGeometry() { QList< QRect > screens = getScreenGeometries(); @@ -72,7 +57,7 @@ Q_FOREACH (QScreen *screen, screens) { QRect geometry = screen->geometry(); - screenGeometries.append(QRect(geometry.topLeft(), geometry.size() * screen->devicePixelRatio())); + screenGeometries.append(QRect(geometry.topLeft(), geometry.size() * screen->devicePixelRatio())); } } else { QRect geometry = primaryScreen->geometry(); @@ -84,28 +69,18 @@ const ScreenRotation X11Info::getScreenRotation() { - Rotation xrandrRotation; - ScreenRotation currentRotation = ScreenRotation::NONE; - - XRRRotations(getDisplay(), getDefaultScreen(), &xrandrRotation); - - switch (xrandrRotation) { - case RR_Rotate_0: - currentRotation = ScreenRotation::NONE; - break; - case RR_Rotate_90: - currentRotation = ScreenRotation::CCW; - break; - case RR_Rotate_180: - currentRotation = ScreenRotation::HALF; - break; - case RR_Rotate_270: - currentRotation = ScreenRotation::CW; - break; - default: - // defaults to NONE - break; + switch (QGuiApplication::primaryScreen()->orientation()) { + case Qt::PrimaryOrientation: + case Qt::LandscapeOrientation: + return ScreenRotation::NONE; + case Qt::PortraitOrientation: + return ScreenRotation::CW; + case Qt::InvertedLandscapeOrientation: + return ScreenRotation::HALF; + case Qt::InvertedPortraitOrientation: + return ScreenRotation::CCW; } - return currentRotation; + // this should never happen, but we probably should log an error here + return ScreenRotation::NONE; } diff --git a/src/kded/tabletdaemon.cpp b/src/kded/tabletdaemon.cpp --- a/src/kded/tabletdaemon.cpp +++ b/src/kded/tabletdaemon.cpp @@ -40,6 +40,7 @@ #include #include #include +#include using namespace Wacom; @@ -193,8 +194,9 @@ connect( &TabletFinder::instance(), &TabletFinder::tabletAdded, &(d->tabletHandler), &TabletHandler::onTabletAdded); connect( &TabletFinder::instance(), &TabletFinder::tabletRemoved, &(d->tabletHandler), &TabletHandler::onTabletRemoved); - X11EventNotifier::instance().start(); -} + if (QX11Info::isPlatformX11()) { + X11EventNotifier::instance().start(); + } void TabletDaemon::monitorAllScreensGeometry() { diff --git a/src/kded/tabletfinder.cpp b/src/kded/tabletfinder.cpp --- a/src/kded/tabletfinder.cpp +++ b/src/kded/tabletfinder.cpp @@ -78,6 +78,10 @@ { Q_D(TabletFinder); + if (!QX11Info::isPlatformX11()) { + return false; + } + X11TabletFinder x11tabletFinder; QMap buttonMap; diff --git a/src/kded/wacomtablet.desktop b/src/kded/wacomtablet.desktop --- a/src/kded/wacomtablet.desktop +++ b/src/kded/wacomtablet.desktop @@ -3,7 +3,7 @@ Icon=input-tablet X-KDE-ServiceTypes=KDEDModule -X-KDE-Library=wacomtablet +X-KDE-Library=kded_wacomtablet X-KDE-DBus-ModuleName=wacomtablet X-KDE-Kded-autoload=true X-KDE-Kded-load-on-demand=false