From 0362a4ff7d5643d335dde8f552c776db941faa58 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sat, 5 Nov 2016 01:10:19 +0000 Subject: [PATCH] get rid of X11 function pointer checks leftovers Signed-off-by: Ivailo Monev --- src/gui/kernel/qapplication_x11.cpp | 34 ++++++++++++++------------------- src/gui/kernel/qcursor_x11.cpp | 36 +++++++++++++++++------------------ src/gui/kernel/qdesktopwidget_x11.cpp | 8 ++------ src/gui/kernel/qwidget_x11.cpp | 10 ++++------ 4 files changed, 37 insertions(+), 51 deletions(-) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 0b671f791..f7a92e63d 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -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 } diff --git a/src/gui/kernel/qcursor_x11.cpp b/src/gui/kernel/qcursor_x11.cpp index a5d3e60b5..6666c0295 100644 --- a/src/gui/kernel/qcursor_x11.cpp +++ b/src/gui/kernel/qcursor_x11.cpp @@ -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 */ } diff --git a/src/gui/kernel/qdesktopwidget_x11.cpp b/src/gui/kernel/qdesktopwidget_x11.cpp index cf1cbc7b6..e3ee36046 100644 --- a/src/gui/kernel/qdesktopwidget_x11.cpp +++ b/src/gui/kernel/qdesktopwidget_x11.cpp @@ -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) { diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index ec7a0a06a..064afd208 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -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(tablet.eventList), - tablet.eventCount); - } + for (int i = 0; i < tablet_list->size(); ++i) { + QTabletDeviceData tablet = tablet_list->at(i); + XSelectExtensionEvent(dpy, id, reinterpret_cast(tablet.eventList), + tablet.eventCount); } #endif } -- 2.11.0