Replace some Q_WS_X11 by check for platform's name.
authorFriedemann Kleint <Friedemann.Kleint@nokia.com>
Mon, 16 Jul 2012 10:25:49 +0000 (12:25 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 16 Jul 2012 12:22:55 +0000 (14:22 +0200)
Change-Id: I33d7ce31e01c355e0d9e05c98d6a84ea4f6d5bbd
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
src/widgets/widgets/qabstractspinbox.cpp
src/widgets/widgets/qwidgetresizehandler.cpp
src/widgets/widgets/qwidgettextcontrol.cpp

index 4d55c9f..25e2fc0 100644 (file)
@@ -62,9 +62,6 @@
 # include <qaccessible.h>
 #endif
 
-#if defined(Q_WS_X11)
-#include <limits.h>
-#endif
 
 //#define QABSTRACTSPINBOX_QSBDEBUG
 #ifdef QABSTRACTSPINBOX_QSBDEBUG
@@ -1014,16 +1011,15 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
         return;
 #endif
 
-#ifdef Q_WS_X11 // only X11
     case Qt::Key_U:
-        if (event->modifiers() & Qt::ControlModifier) {
+        if (event->modifiers() & Qt::ControlModifier
+            && QGuiApplication::platformName() == QLatin1String("xcb")) { // only X11
             event->accept();
             if (!isReadOnly())
                 clear();
             return;
         }
         break;
-#endif
 
     case Qt::Key_End:
     case Qt::Key_Home:
index 0847263..b8af977 100644 (file)
@@ -253,14 +253,14 @@ void QWidgetResizeHandler::mouseMoveEvent(QMouseEvent *e)
     QPoint p = globalPos + invertedMoveOffset;
     QPoint pp = globalPos - moveOffset;
 
-#ifdef Q_WS_X11
     // Workaround for window managers which refuse to move a tool window partially offscreen.
-    QRect desktop = QApplication::desktop()->availableGeometry(widget);
-    pp.rx() = qMax(pp.x(), desktop.left());
-    pp.ry() = qMax(pp.y(), desktop.top());
-    p.rx() = qMin(p.x(), desktop.right());
-    p.ry() = qMin(p.y(), desktop.bottom());
-#endif
+    if (QGuiApplication::platformName() == QLatin1String("xcb")) {
+        const QRect desktop = QApplication::desktop()->availableGeometry(widget);
+        pp.rx() = qMax(pp.x(), desktop.left());
+        pp.ry() = qMax(pp.y(), desktop.top());
+        p.rx() = qMin(p.x(), desktop.right());
+        p.ry() = qMin(p.y(), desktop.bottom());
+    }
 
     QSize ms = qSmartMinSize(childWidget);
     int mw = ms.width();
index b21d7b8..d1ac8d3 100644 (file)
@@ -1271,10 +1271,9 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e)
     }
     else if (e == QKeySequence::Paste) {
         QClipboard::Mode mode = QClipboard::Clipboard;
-#ifdef Q_WS_X11
+        if (QGuiApplication::platformName() == QLatin1String("xcb"))
         if (e->modifiers() == (Qt::CTRL | Qt::SHIFT) && e->key() == Qt::Key_Insert)
             mode = QClipboard::Selection;
-#endif
         q->paste(mode);
     }
 #endif