OSDN Git Service

get rid of X11 function pointer checks leftovers
authorIvailo Monev <xakepa10@laimg.moc>
Sat, 5 Nov 2016 01:10:19 +0000 (01:10 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sat, 5 Nov 2016 01:10:19 +0000 (01:10 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/kernel/qapplication_x11.cpp
src/gui/kernel/qcursor_x11.cpp
src/gui/kernel/qdesktopwidget_x11.cpp
src/gui/kernel/qwidget_x11.cpp

index 0b671f7..f7a92e6 100644 (file)
@@ -2109,11 +2109,10 @@ void qt_init(QApplicationPrivate *priv, int,
         // Use dbus if/when we can, but fall back to using windowManagerName() for now
 
 #ifndef QT_NO_XFIXES
-        if (XFixesSelectSelectionInput)
-            XFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(), ATOM(_NET_WM_CM_S0),
-                                       XFixesSetSelectionOwnerNotifyMask
-                                       | XFixesSelectionWindowDestroyNotifyMask
-                                       | XFixesSelectionClientCloseNotifyMask);
+        XFixesSelectSelectionInput(X11->display, QX11Info::appRootWindow(), ATOM(_NET_WM_CM_S0),
+                                   XFixesSetSelectionOwnerNotifyMask
+                                   | XFixesSelectionWindowDestroyNotifyMask
+                                   | XFixesSelectionClientCloseNotifyMask);
 #endif // QT_NO_XFIXES
         X11->compositingManagerRunning = XGetSelectionOwner(X11->display,
                                                             ATOM(_NET_WM_CM_S0));
@@ -2205,8 +2204,7 @@ void qt_init(QApplicationPrivate *priv, int,
             int ndev,
                 i,
                 j;
-            bool gotStylus,
-                gotEraser;
+            bool gotStylus, gotEraser;
             XDeviceInfo *devices = 0, *devs;
             XInputClassInfo *ip;
             XAnyClassPtr any;
@@ -2214,13 +2212,12 @@ void qt_init(QApplicationPrivate *priv, int,
             XAxisInfoPtr a;
             XDevice *dev = 0;
 
-            if (XListInputDevices) {
-                devices = XListInputDevices(X11->display, &ndev);
-                if (!devices)
-                    qWarning("QApplication: Failed to get list of tablet devices");
-            }
-            if (!devices)
+            devices = XListInputDevices(X11->display, &ndev);
+            if (!devices) {
+                qWarning("QApplication: Failed to get list of tablet devices");
                 ndev = -1;
+            }
+
             QTabletEvent::TabletDevice deviceType;
             for (devs = devices, i = 0; i < ndev && devs; i++, devs++) {
                 dev = 0;
@@ -2250,8 +2247,7 @@ void qt_init(QApplicationPrivate *priv, int,
                     continue;
 
                 if (gotStylus || gotEraser) {
-                    if (XOpenDevice)
-                        dev = XOpenDevice(X11->display, devs->id);
+                    dev = XOpenDevice(X11->display, devs->id);
 
                     if (!dev)
                         continue;
@@ -2371,8 +2367,7 @@ void qt_init(QApplicationPrivate *priv, int,
                     tablet_devices()->append(device_data);
                 } // if (gotStylus || gotEraser)
             }
-            if (XFreeDeviceList)
-                XFreeDeviceList(devices);
+            XFreeDeviceList(devices);
         }
 #endif // QT_NO_TABLET
 
@@ -2452,9 +2447,8 @@ void qt_cleanup()
 
 #if !defined (QT_NO_TABLET)
         QTabletDeviceDataList *devices = qt_tablet_devices();
-        if (XCloseDevice)
-            for (int i = 0; i < devices->size(); ++i)
-                XCloseDevice(X11->display, (XDevice*)devices->at(i).device);
+        for (int i = 0; i < devices->size(); ++i)
+            XCloseDevice(X11->display, (XDevice*)devices->at(i).device);
         devices->clear();
 #endif
     }
index a5d3e60..6666c02 100644 (file)
@@ -273,24 +273,22 @@ void QCursorData::update()
     };
 
 #ifndef QT_NO_XCURSOR
-    if (XcursorLibraryLoadCursor) {
-        // special case for non-standard dnd-* cursors
-        switch (cshape) {
-        case Qt::DragCopyCursor:
-            hcurs = XcursorLibraryLoadCursor(dpy, "dnd-copy");
-            break;
-        case Qt::DragMoveCursor:
-            hcurs = XcursorLibraryLoadCursor(dpy, "dnd-move");
-            break;
-        case Qt::DragLinkCursor:
-            hcurs = XcursorLibraryLoadCursor(dpy, "dnd-link");
-            break;
-        default:
-            break;
-        }
-        if (!hcurs)
-            hcurs = XcursorLibraryLoadCursor(dpy, cursorNames[cshape]);
+    // special case for non-standard dnd-* cursors
+    switch (cshape) {
+    case Qt::DragCopyCursor:
+        hcurs = XcursorLibraryLoadCursor(dpy, "dnd-copy");
+        break;
+    case Qt::DragMoveCursor:
+        hcurs = XcursorLibraryLoadCursor(dpy, "dnd-move");
+        break;
+    case Qt::DragLinkCursor:
+        hcurs = XcursorLibraryLoadCursor(dpy, "dnd-link");
+        break;
+    default:
+        break;
     }
+    if (!hcurs)
+        hcurs = XcursorLibraryLoadCursor(dpy, cursorNames[cshape]);
     if (hcurs)
         return;
 #endif // QT_NO_XCURSOR
@@ -545,7 +543,7 @@ void QCursorData::update()
     if (hcurs)
     {
 #ifndef QT_NO_XFIXES
-        if (X11->use_xfixes && XFixesSetCursorName)
+        if (X11->use_xfixes)
             XFixesSetCursorName(dpy, hcurs, cursorNames[cshape]);
 #endif /* ! QT_NO_XFIXES */
         return;
@@ -630,7 +628,7 @@ void QCursorData::update()
     hcurs = XCreateFontCursor(dpy, sh);
 
 #ifndef QT_NO_XFIXES
-    if (X11->use_xfixes && XFixesSetCursorName)
+    if (X11->use_xfixes)
         XFixesSetCursorName(dpy, hcurs, cursorNames[cshape]);
 #endif /* ! QT_NO_XFIXES */
 }
index cf1cbc7..e3ee360 100644 (file)
@@ -132,18 +132,14 @@ void QDesktopWidgetPrivate::init()
 
     // we ignore the Xinerama extension when using the display is
     // using traditional multi-screen (with multiple root windows)
-    if (newScreenCount == 1
-        && XineramaQueryExtension
-        && XineramaIsActive
-        && XineramaQueryScreens) {
+    if (newScreenCount == 1) {
         int unused;
         use_xinerama = (XineramaQueryExtension(X11->display, &unused, &unused)
                         && XineramaIsActive(X11->display));
     }
 
     if (use_xinerama) {
-        xinerama_screeninfo =
-            XineramaQueryScreens(X11->display, &newScreenCount);
+        xinerama_screeninfo = XineramaQueryScreens(X11->display, &newScreenCount);
     }
 
     if (xinerama_screeninfo) {
index ec7a0a0..064afd2 100644 (file)
@@ -854,12 +854,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
         XSelectInput(dpy, id, stdWidgetEventMask);
 #if !defined (QT_NO_TABLET)
         QTabletDeviceDataList *tablet_list = qt_tablet_devices();
-        if (XSelectExtensionEvent) {
-            for (int i = 0; i < tablet_list->size(); ++i) {
-                QTabletDeviceData tablet = tablet_list->at(i);
-                XSelectExtensionEvent(dpy, id, reinterpret_cast<XEventClass*>(tablet.eventList),
-                                              tablet.eventCount);
-            }
+        for (int i = 0; i < tablet_list->size(); ++i) {
+            QTabletDeviceData tablet = tablet_list->at(i);
+            XSelectExtensionEvent(dpy, id, reinterpret_cast<XEventClass*>(tablet.eventList),
+                                            tablet.eventCount);
         }
 #endif
     }