get rid of X11 function pointer checks leftovers

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2016-11-05 01:10:19 +00:00
parent ee3191f77d
commit 0362a4ff7d
4 changed files with 37 additions and 51 deletions

View 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
}

View 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 */
}

View 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) {

View 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
}