summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h1
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro2
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp21
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h1
-rw-r--r--src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp14
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp27
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp32
-rw-r--r--src/plugins/platforms/xcb/qxcbintegration.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp3
-rw-r--r--src/plugins/platforms/xcb/qxcbsessionmanager.cpp4
-rw-r--r--src/plugins/platforms/xcb/qxcbsessionmanager.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp34
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.h2
-rw-r--r--src/plugins/platforms/xcb/xcb-plugin.pro2
-rw-r--r--src/plugins/platforms/xcb/xcb_qpa_lib.pro8
18 files changed, 142 insertions, 24 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
index 57c8f27d9c..a3813ef993 100644
--- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
+++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri
@@ -3,6 +3,8 @@ QT += core-private gui-private platformsupport-private xcb_qpa_lib-private
INCLUDEPATH += $$PWD
INCLUDEPATH += $$PWD/../
+load(qt_build_paths)
+
# needed by Xcursor ...
qtConfig(xcb-xlib) {
DEFINES += XCB_USE_XLIB
diff --git a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h
index 719d2ace90..926e5e22df 100644
--- a/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/qxcbglintegration.h
@@ -60,6 +60,7 @@ public:
virtual bool initialize(QXcbConnection *connection) = 0;
virtual bool supportsThreadedOpenGL() const { return false; }
+ virtual bool supportsSwitchableWidgetComposition() const { return true; }
virtual bool handleXcbEvent(xcb_generic_event_t *event, uint responseType);
virtual QXcbWindow *createWindow(QWindow *window) const = 0;
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
index 92e6c18fbe..6b3f9b171a 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_egl/xcb_egl.pro
@@ -6,6 +6,8 @@ CONFIG += egl
qtConfig(xcb-xlib): DEFINES += XCB_USE_XLIB
+DEFINES += QT_NO_FOREACH
+
HEADERS += \
qxcbeglcontext.h \
qxcbeglintegration.h \
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
index f97c01f390..77cbdd5fba 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.cpp
@@ -224,5 +224,26 @@ bool QXcbGlxIntegration::supportsThreadedOpenGL() const
return QGLXContext::supportsThreading();
}
+bool QXcbGlxIntegration::supportsSwitchableWidgetComposition() const
+{
+ static bool vendorChecked = false;
+ static bool isSwitchableWidgetCompositionAvailable = true;
+ if (!vendorChecked) {
+ vendorChecked = true;
+ Display *display = glXGetCurrentDisplay();
+#ifdef XCB_USE_XLIB
+ if (!display)
+ display = static_cast<Display *>(m_connection->xlib_display());
+#endif
+ const char *glxvendor = glXGetClientString(display, GLX_VENDOR);
+ if (glxvendor) {
+ if (!strcmp(glxvendor, "Parallels Inc"))
+ isSwitchableWidgetCompositionAvailable = false;
+ }
+ }
+
+ return isSwitchableWidgetCompositionAvailable;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
index 77d3bc55e1..8f04db31b2 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qxcbglxintegration.h
@@ -60,6 +60,7 @@ public:
QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const Q_DECL_OVERRIDE;
virtual bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE;
+ virtual bool supportsSwitchableWidgetComposition() const Q_DECL_OVERRIDE;
private:
QXcbConnection *m_connection;
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
index 88c4144fd9..d82a1f2d17 100644
--- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
+++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/xcb_glx.pro
@@ -4,6 +4,7 @@ include(../gl_integrations_plugin_base.pri)
#should be removed from the sources
DEFINES += XCB_USE_GLX XCB_USE_XLIB
+DEFINES += QT_NO_FOREACH
qtConfig(xcb-glx) {
DEFINES += XCB_HAS_XCB_GLX
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index 2d959688b3..d577d46b96 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -107,6 +107,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input")
Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices")
+Q_LOGGING_CATEGORY(lcQpaXInputEvents, "qt.qpa.input.events")
Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen")
// this event type was added in libxcb 1.10,
@@ -1119,7 +1120,8 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
// the rest we need to manage ourselves
m_buttons = (m_buttons & ~0x7) | translateMouseButtons(ev->state);
m_buttons |= translateMouseButton(ev->detail);
- qCDebug(lcQpaXInput, "legacy mouse press, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttons));
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "legacy mouse press, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttons));
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent);
}
case XCB_BUTTON_RELEASE: {
@@ -1127,15 +1129,17 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
m_keyboard->updateXKBStateFromCore(ev->state);
m_buttons = (m_buttons & ~0x7) | translateMouseButtons(ev->state);
m_buttons &= ~translateMouseButton(ev->detail);
- qCDebug(lcQpaXInput, "legacy mouse release, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttons));
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "legacy mouse release, button %d state %X", ev->detail, static_cast<unsigned int>(m_buttons));
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent);
}
case XCB_MOTION_NOTIFY: {
xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)event;
m_keyboard->updateXKBStateFromCore(ev->state);
m_buttons = (m_buttons & ~0x7) | translateMouseButtons(ev->state);
- qCDebug(lcQpaXInput, "legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y,
- ev->detail, static_cast<unsigned int>(m_buttons));
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "legacy mouse move %d,%d button %d state %X", ev->event_x, ev->event_y,
+ ev->detail, static_cast<unsigned int>(m_buttons));
HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent);
}
@@ -1719,11 +1723,13 @@ void QXcbConnection::processXcbEvents()
compressEvent(event, i, eventqueue))
continue;
+#ifndef QT_NO_CLIPBOARD
bool accepted = false;
if (clipboard()->processIncr())
clipboard()->incrTransactionPeeker(event, accepted);
if (accepted)
continue;
+#endif
auto isWaitingFor = [=](PeekFunc peekFunc) {
// These callbacks return true if the event is what they were
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 4d903ec8d3..dca32af9b1 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -86,6 +86,7 @@ QT_BEGIN_NAMESPACE
Q_DECLARE_LOGGING_CATEGORY(lcQpaXInput)
Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputDevices)
+Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputEvents)
Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen)
class QXcbVirtualDesktop;
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index bda167bce9..1147fc82b2 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -562,8 +562,8 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
case XI_TouchBegin:
case XI_TouchUpdate:
case XI_TouchEnd:
- if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
- qCDebug(lcQpaXInput, "XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x",
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f on window %x",
event->event_type, xiDeviceEvent->sequenceNumber, xiDeviceEvent->detail,
fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y),
fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y),xiDeviceEvent->event);
@@ -620,8 +620,8 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
double value;
if (!xi2GetValuatorValueIfSet(xiDeviceEvent, n, &value))
continue;
- if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
- qCDebug(lcQpaXInput, " valuator %20s value %lf from range %lf -> %lf",
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, " valuator %20s value %lf from range %lf -> %lf",
atomName(vci->label).constData(), value, vci->min, vci->max );
if (vci->label == atom(QXcbAtom::RelX)) {
nx = valuatorNormalized(value, vci);
@@ -751,8 +751,8 @@ void QXcbConnection::xi2ProcessTouch(void *xiDevEvent, QXcbWindow *platformWindo
touchPoint.area = QRectF(x - w/2, y - h/2, w, h);
touchPoint.normalPosition = QPointF(nx, ny);
- if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
- qCDebug(lcQpaXInput) << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition <<
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents) << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition <<
" area " << touchPoint.area << " pressure " << touchPoint.pressure;
QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiDeviceEvent->time, dev->qtTouchDevice, dev->touchPoints.values());
if (touchPoint.state == Qt::TouchPointReleased)
@@ -883,8 +883,8 @@ void QXcbConnection::updateScrollingDevice(ScrollingDevice &scrollingDevice, int
scrollingDevice.lastScrollPosition.setY(vci->value);
}
}
- if (lcQpaXInput().isDebugEnabled() && lastScrollPosition != scrollingDevice.lastScrollPosition)
- qCDebug(lcQpaXInput, "scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId,
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled() && lastScrollPosition != scrollingDevice.lastScrollPosition))
+ qCDebug(lcQpaXInputEvents, "scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId,
lastScrollPosition.x(), lastScrollPosition.y(),
scrollingDevice.lastScrollPosition.x(),
scrollingDevice.lastScrollPosition.y());
@@ -1117,9 +1117,10 @@ bool QXcbConnection::xi2HandleTabletEvent(const void *event, TabletData *tabletD
}
// TODO maybe have a hash of tabletData->deviceId to device data so we can
// look up the tablet name here, and distinguish multiple tablets
- qCDebug(lcQpaXInput, "XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d",
- tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID],
- ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool);
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d",
+ tabletData->deviceId, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID],
+ ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool);
}
XFree(data);
}
@@ -1181,8 +1182,8 @@ void QXcbConnection::xi2ReportTabletEvent(const void *event, TabletData *tabletD
}
}
- if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
- qCDebug(lcQpaXInput, "XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d "
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "XI2 event on tablet %d with tool %d type %d seq %d detail %d time %d "
"pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
tabletData->deviceId, tabletData->tool, ev->evtype, ev->sequenceNumber, ev->detail, ev->time,
fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y),
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index fb006ec0f1..fbf3acc54b 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -194,8 +194,10 @@ void QXcbDrag::startDrag()
init();
+#ifndef QT_NO_CLIPBOARD
xcb_set_selection_owner(xcb_connection(), connection()->clipboard()->owner(),
atom(QXcbAtom::XdndSelection), connection()->time());
+#endif
QStringList fmts = QXcbMime::formatsHelper(drag()->mimeData());
for (int i = 0; i < fmts.size(); ++i) {
@@ -205,10 +207,12 @@ void QXcbDrag::startDrag()
drag_types.append(atoms.at(j));
}
}
+#ifndef QT_NO_CLIPBOARD
if (drag_types.size() > 3)
xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, connection()->clipboard()->owner(),
atom(QXcbAtom::XdndTypelist),
XCB_ATOM_ATOM, 32, drag_types.size(), (const void *)drag_types.constData());
+#endif
setUseCompositing(current_virtual_desktop->compositingActive());
setScreen(current_virtual_desktop->screens().constFirst()->screen());
@@ -447,7 +451,11 @@ void QXcbDrag::move(const QPoint &globalPos)
enter.window = target;
enter.format = 32;
enter.type = atom(QXcbAtom::XdndEnter);
+#ifndef QT_NO_CLIPBOARD
enter.data.data32[0] = connection()->clipboard()->owner();
+#else
+ enter.data.data32[0] = 0;
+#endif
enter.data.data32[1] = flags;
enter.data.data32[2] = drag_types.size()>0 ? drag_types.at(0) : 0;
enter.data.data32[3] = drag_types.size()>1 ? drag_types.at(1) : 0;
@@ -476,7 +484,11 @@ void QXcbDrag::move(const QPoint &globalPos)
move.window = target;
move.format = 32;
move.type = atom(QXcbAtom::XdndPosition);
+#ifndef QT_NO_CLIPBOARD
move.data.data32[0] = connection()->clipboard()->owner();
+#else
+ move.data.data32[0] = 0;
+#endif
move.data.data32[1] = 0; // flags
move.data.data32[2] = (globalPos.x() << 16) + globalPos.y();
move.data.data32[3] = connection()->time();
@@ -505,7 +517,11 @@ void QXcbDrag::drop(const QPoint &globalPos)
drop.window = current_target;
drop.format = 32;
drop.type = atom(QXcbAtom::XdndDrop);
+#ifndef QT_NO_CLIPBOARD
drop.data.data32[0] = connection()->clipboard()->owner();
+#else
+ drop.data.data32[0] = 0;
+#endif
drop.data.data32[1] = 0; // flags
drop.data.data32[2] = connection()->time();
@@ -791,9 +807,11 @@ void QXcbDrag::handle_xdnd_position(QPlatformWindow *w, const xcb_client_message
// reset
target_time = XCB_CURRENT_TIME;
+#ifndef QT_NO_CLIPBOARD
if (xdnd_dragsource == connection()->clipboard()->owner())
handle_xdnd_status(&response);
else
+#endif
Q_XCB_CALL(xcb_send_event(xcb_connection(), false, current_proxy_target,
XCB_EVENT_MASK_NO_EVENT, (const char *)&response));
}
@@ -859,7 +877,11 @@ void QXcbDrag::handle_xdnd_status(const xcb_client_message_event_t *event)
void QXcbDrag::handleStatus(const xcb_client_message_event_t *event)
{
- if (event->window != connection()->clipboard()->owner() || !drag())
+ if (
+#ifndef QT_NO_CLIPBOARD
+ event->window != connection()->clipboard()->owner() ||
+#endif
+ !drag())
return;
xcb_client_message_event_t *lastEvent = const_cast<xcb_client_message_event_t *>(event);
@@ -914,7 +936,11 @@ void QXcbDrag::send_leave()
leave.window = current_target;
leave.format = 32;
leave.type = atom(QXcbAtom::XdndLeave);
+#ifndef QT_NO_CLIPBOARD
leave.data.data32[0] = connection()->clipboard()->owner();
+#else
+ leave.data.data32[0] = 0;
+#endif
leave.data.data32[1] = 0; // flags
leave.data.data32[2] = 0; // x, y
leave.data.data32[3] = 0; // w, h
@@ -1003,8 +1029,10 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e
void QXcbDrag::handleFinished(const xcb_client_message_event_t *event)
{
DEBUG("xdndHandleFinished");
+#ifndef QT_NO_CLIPBOARD
if (event->window != connection()->clipboard()->owner())
return;
+#endif
const unsigned long *l = (const unsigned long *)event->data.data32;
@@ -1284,11 +1312,13 @@ QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type r
if (a == XCB_NONE)
return result;
+#ifndef QT_NO_CLIPBOARD
if (c->clipboard()->getSelectionOwner(drag->atom(QXcbAtom::XdndSelection)) == XCB_NONE)
return result; // should never happen?
xcb_atom_t xdnd_selection = c->atom(QXcbAtom::XdndSelection);
result = c->clipboard()->getSelection(xdnd_selection, a, xdnd_selection, drag->targetTime());
+#endif
return mimeConvertToFormat(c, a, result, QLatin1String(format), requestedType, encoding);
}
diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp
index 5a89113a4f..802f7b85ce 100644
--- a/src/plugins/platforms/xcb/qxcbintegration.cpp
+++ b/src/plugins/platforms/xcb/qxcbintegration.cpp
@@ -267,9 +267,14 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const
case ForeignWindows:
case SyncState:
case RasterGLSurface:
- case SwitchableWidgetComposition:
return true;
+ case SwitchableWidgetComposition:
+ {
+ return m_connections.at(0)->glIntegration()
+ && m_connections.at(0)->glIntegration()->supportsSwitchableWidgetComposition();
+ }
+
default: return QPlatformIntegration::hasCapability(cap);
}
}
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index a8d401e15b..a3e8da7df8 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -364,6 +364,9 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio
if (function == QXcbWindowFunctions::setWmWindowTypeIdentifier())
return QFunctionPointer(QXcbWindowFunctions::SetWmWindowType(QXcbWindow::setWmWindowTypeStatic));
+ if (function == QXcbWindowFunctions::setWmWindowRoleIdentifier())
+ return QFunctionPointer(QXcbWindowFunctions::SetWmWindowRole(QXcbWindow::setWmWindowRoleStatic));
+
if (function == QXcbWindowFunctions::setWmWindowIconTextIdentifier())
return QFunctionPointer(QXcbWindowFunctions::SetWmWindowIconText(QXcbWindow::setWindowIconTextStatic));
diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp
index 802e4cfe08..8744fcba3e 100644
--- a/src/plugins/platforms/xcb/qxcbsessionmanager.cpp
+++ b/src/plugins/platforms/xcb/qxcbsessionmanager.cpp
@@ -40,6 +40,8 @@
#include "qxcbsessionmanager.h"
+#ifndef QT_NO_SESSIONMANAGER
+
#include <qguiapplication.h>
#include <qdatetime.h>
#include <qfileinfo.h>
@@ -491,3 +493,5 @@ void QXcbSessionManager::exitEventLoop()
}
#include "qxcbsessionmanager.moc"
+
+#endif
diff --git a/src/plugins/platforms/xcb/qxcbsessionmanager.h b/src/plugins/platforms/xcb/qxcbsessionmanager.h
index cba0ab91ad..a184282034 100644
--- a/src/plugins/platforms/xcb/qxcbsessionmanager.h
+++ b/src/plugins/platforms/xcb/qxcbsessionmanager.h
@@ -52,6 +52,8 @@
#include <qpa/qplatformsessionmanager.h>
+#ifndef QT_NO_SESSIONMANAGER
+
QT_BEGIN_NAMESPACE
class QEventLoop;
@@ -89,4 +91,6 @@ private:
QT_END_NAMESPACE
+#endif //QT_NO_SESSIONMANAGER
+
#endif //QXCBSESSIONMANAGER_H
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index 4084dbc1df..51390bfdae 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -258,6 +258,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
free_prop = true;
}
+#ifndef QT_NO_TEXTCODEC
static const QTextCodec* mapper = QTextCodec::codecForLocale();
int errCode = 0;
if (mapper) {
@@ -281,6 +282,7 @@ static inline XTextProperty* qstringToXTP(Display *dpy, const QString& s)
tp.nitems = qcs.length();
free_prop = false;
}
+#endif
return &tp;
}
#endif // XCB_USE_XLIB
@@ -306,6 +308,7 @@ static QWindow *childWindowAt(QWindow *win, const QPoint &p)
}
static const char *wm_window_type_property_id = "_q_xcb_wm_window_type";
+static const char *wm_window_role_property_id = "_q_xcb_wm_window_role";
QXcbWindow::QXcbWindow(QWindow *window)
: QPlatformWindow(window)
@@ -588,6 +591,11 @@ void QXcbWindow::create()
setOpacity(opacity);
if (window()->isTopLevel())
setWindowIcon(window()->icon());
+
+ if (window()->dynamicPropertyNames().contains(wm_window_role_property_id)) {
+ QByteArray wmWindowRole = window()->property(wm_window_role_property_id).toByteArray();
+ setWmWindowRole(wmWindowRole);
+ }
}
QXcbWindow::~QXcbWindow()
@@ -1722,6 +1730,14 @@ void QXcbWindow::setWindowIconTextStatic(QWindow *window, const QString &text)
static_cast<QXcbWindow *>(window->handle())->setWindowIconText(text);
}
+void QXcbWindow::setWmWindowRoleStatic(QWindow *window, const QByteArray &role)
+{
+ if (window->handle())
+ static_cast<QXcbWindow *>(window->handle())->setWmWindowRole(role);
+ else
+ window->setProperty(wm_window_role_property_id, role);
+}
+
uint QXcbWindow::visualIdStatic(QWindow *window)
{
if (window && window->handle())
@@ -1887,6 +1903,13 @@ void QXcbWindow::setWmWindowType(QXcbWindowFunctions::WmWindowTypes types, Qt::W
xcb_flush(xcb_connection());
}
+void QXcbWindow::setWmWindowRole(const QByteArray &role)
+{
+ Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window,
+ atom(QXcbAtom::WM_WINDOW_ROLE), XCB_ATOM_STRING, 8,
+ role.size(), role.constData()));
+}
+
void QXcbWindow::setParentRelativeBackPixmapStatic(QWindow *window)
{
if (window->handle())
@@ -2415,7 +2438,7 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
}
const char *sourceName = 0;
- if (lcQpaXInput().isDebugEnabled()) {
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled())) {
const QMetaObject *metaObject = qt_getEnumMetaObject(source);
const QMetaEnum me = metaObject->enumerator(metaObject->indexOfEnumerator(qt_getEnumName(source)));
sourceName = me.valueToKey(source);
@@ -2423,17 +2446,20 @@ void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource
switch (ev->evtype) {
case XI_ButtonPress:
- qCDebug(lcQpaXInput, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName);
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "XI2 mouse press, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButton(button, true);
handleButtonPressEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
break;
case XI_ButtonRelease:
- qCDebug(lcQpaXInput, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName);
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "XI2 mouse release, button %d, time %d, source %s", button, ev->time, sourceName);
conn->setButton(button, false);
handleButtonReleaseEvent(event_x, event_y, root_x, root_y, ev->detail, modifiers, ev->time, source);
break;
case XI_Motion:
- qCDebug(lcQpaXInput, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName);
+ if (Q_UNLIKELY(lcQpaXInputEvents().isDebugEnabled()))
+ qCDebug(lcQpaXInputEvents, "XI2 mouse motion %d,%d, time %d, source %s", event_x, event_y, ev->time, sourceName);
handleMotionNotifyEvent(event_x, event_y, root_x, root_y, modifiers, ev->time, source);
break;
default:
diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h
index e7190b1733..f62938ba8a 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.h
+++ b/src/plugins/platforms/xcb/qxcbwindow.h
@@ -151,10 +151,12 @@ public:
void updateNetWmUserTime(xcb_timestamp_t timestamp);
static void setWmWindowTypeStatic(QWindow *window, QXcbWindowFunctions::WmWindowTypes windowTypes);
+ static void setWmWindowRoleStatic(QWindow *window, const QByteArray &role);
static uint visualIdStatic(QWindow *window);
QXcbWindowFunctions::WmWindowTypes wmWindowTypes() const;
void setWmWindowType(QXcbWindowFunctions::WmWindowTypes types, Qt::WindowFlags flags);
+ void setWmWindowRole(const QByteArray &role);
static void setWindowIconTextStatic(QWindow *window, const QString &text);
diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro
index 75684a769b..d7f150f276 100644
--- a/src/plugins/platforms/xcb/xcb-plugin.pro
+++ b/src/plugins/platforms/xcb/xcb-plugin.pro
@@ -2,6 +2,8 @@ TARGET = qxcb
QT += core-private gui-private platformsupport-private xcb_qpa_lib-private
+DEFINES += QT_NO_FOREACH
+
SOURCES = \
qxcbmain.cpp
OTHER_FILES += xcb.json README
diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
index 942183877d..ec0fa68871 100644
--- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro
+++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro
@@ -39,6 +39,8 @@ HEADERS = \
qxcbxsettings.h \
qxcbsystemtraytracker.h
+load(qt_build_paths)
+
DEFINES += QT_BUILD_XCB_PLUGIN
# needed by Xcursor ...
qtConfig(xcb-xlib) {
@@ -86,7 +88,11 @@ qtConfig(dbus-linked): \
# libxkbcommon
!qtConfig(xkbcommon-system) {
- include(../../../3rdparty/xkbcommon-x11.pri)
+ qtConfig(xkb) {
+ include(../../../3rdparty/xkbcommon-x11.pri)
+ } else {
+ include(../../../3rdparty/xkbcommon.pri)
+ }
} else {
QMAKE_USE += xkbcommon
}