OSDN Git Service

QX11Info cleanup
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 22 Jun 2019 01:05:25 +0000 (01:05 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 22 Jun 2019 01:05:25 +0000 (01:05 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/kernel/qvariant.h
src/gui/kernel/qapplication_x11.cpp
src/gui/kernel/qwidget_x11.cpp
src/gui/kernel/qx11info_x11.h

index aeabe5b..f5a1d52 100644 (file)
@@ -412,7 +412,7 @@ inline void qVariantSetValue(QVariant &v, const T &t)
     //if possible we reuse the current QVariant private
     const int type = qMetaTypeId<T>(reinterpret_cast<T *>(0));
     QVariant::Private &d = v.data_ptr();
-    if (v.isDetached() && (type == d.type || (type <= int(QVariant::Char) && d.type <= int(QVariant::Char)))) {
+    if (v.isDetached() && (type == d.type || (type <= QVariant::Char && d.type <= QVariant::Char))) {
         d.type = type;
         d.is_null = false;
         T *old = reinterpret_cast<T*>(d.is_shared ? d.data.shared->ptr : &d.data.ptr);
index f35bb86..8d9ee37 100644 (file)
@@ -1156,7 +1156,7 @@ bool runningUnderDebugger()
 // ### it because "storage class specifiers invalid in friend function
 // ### declarations" :-) Ideas anyone?
 void qt_init(QApplicationPrivate *priv, int,
-            Display *display, Qt::HANDLE visual, Qt::HANDLE colormap)
+             Display *display, Qt::HANDLE visual, Qt::HANDLE colormap)
 {
     qt_x11Data = new QX11Data;
     qt_x11Data->display = display;
index a363576..499311b 100644 (file)
@@ -427,6 +427,30 @@ static QVector<Atom> getNetWmState(QWidget *w)
     return returnValue;
 }
 
+void qt_x11_getX11InfoForWindow(QX11Info *xinfo, const void *att)
+{
+    QX11InfoData* xd = xinfo->getX11Data(true);
+    const XWindowAttributes *a = static_cast<const XWindowAttributes*>(att);
+    // find which screen the window is on...
+    xd->screen = QX11Info::appScreen(); // by default, use the default :)
+    int i;
+    for (i = 0; i < ScreenCount(qt_x11Data->display); i++) {
+        if (RootWindow(qt_x11Data->display, i) == a->root) {
+            xd->screen = i;
+            break;
+        }
+    }
+
+    xd->depth = a->depth;
+    xd->cells = DisplayCells(qt_x11Data->display, xd->screen);
+    xd->visual = a->visual;
+    xd->defaultVisual = (XVisualIDFromVisual((Visual *) a->visual) ==
+    XVisualIDFromVisual((Visual *) QX11Info::appVisual(xinfo->screen())));
+    xd->colormap = a->colormap;
+    xd->defaultColormap = (a->colormap == QX11Info::appColormap(xinfo->screen()));
+    xinfo->setX11Data(xd);
+}
+
 void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow)
 {
     Q_Q(QWidget);
@@ -2946,30 +2970,6 @@ Picture QX11Data::getSolidFill(int screen, const QColor &c)
 }
 #endif
 
-void qt_x11_getX11InfoForWindow(QX11Info *xinfo, const void *att)
-{
-    QX11InfoData* xd = xinfo->getX11Data(true);
-    const XWindowAttributes *a = static_cast<const XWindowAttributes*>(att);
-    // find which screen the window is on...
-    xd->screen = QX11Info::appScreen(); // by default, use the default :)
-    int i;
-    for (i = 0; i < ScreenCount(qt_x11Data->display); i++) {
-        if (RootWindow(qt_x11Data->display, i) == a->root) {
-            xd->screen = i;
-            break;
-        }
-    }
-
-    xd->depth = a->depth;
-    xd->cells = DisplayCells(qt_x11Data->display, xd->screen);
-    xd->visual = a->visual;
-    xd->defaultVisual = (XVisualIDFromVisual((Visual *) a->visual) ==
-    XVisualIDFromVisual((Visual *) QX11Info::appVisual(xinfo->screen())));
-    xd->colormap = a->colormap;
-    xd->defaultColormap = (a->colormap == QX11Info::appColormap(xinfo->screen()));
-    xinfo->setX11Data(xd);
-}
-
 void QWidgetPrivate::updateX11AcceptFocus()
 {
     Q_Q(QWidget);
index 557f365..4d8d7e3 100644 (file)
@@ -42,7 +42,6 @@ QT_BEGIN_HEADER
 
 QT_BEGIN_NAMESPACE
 
-
 struct QX11InfoData;
 class QX11Info;
 class QPaintDevice;
@@ -85,7 +84,7 @@ public:
     static void setAppUserTime(unsigned long time);
     static bool isCompositingManagerRunning();
 
-protected:
+private:
     void copyX11Data(const QPaintDevice *);
     void cloneX11Data(const QPaintDevice *);
     void setX11Data(const QX11InfoData *);
@@ -93,14 +92,10 @@ protected:
 
     QX11InfoData *x11data;
 
-    friend class QX11PaintEngine;
     friend class QPixmap;
+    friend class QX11PaintEngine;
     friend class QX11PixmapData;
-    friend class QWidget;
     friend class QWidgetPrivate;
-    friend void qt_init(QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual,
-                        Qt::HANDLE colormap);
-    friend void qt_cleanup();
     friend void qt_x11_getX11InfoForWindow(QX11Info *xinfo, const void *att);
 };