diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-18 11:07:51 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-18 11:07:51 +0200 |
commit | 0ca4fcbc36527ce02b604aa88e8bd0d37d40baf4 (patch) | |
tree | 6adf165fb783272d720416a49a51d9ad169d16de /src/plugins | |
parent | 9aeaa363e533e1486e6e9d7526bbab7c2472be5e (diff) | |
parent | 748aa6b06462804a9671997302df292ae9788d5c (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
src/plugins/platforms/xcb/qxcbintegration.cpp
Change-Id: I2d71d06a55f730df19ace0dd3304238584a0497f
Diffstat (limited to 'src/plugins')
16 files changed, 142 insertions, 69 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoainputcontext.mm b/src/plugins/platforms/cocoa/qcocoainputcontext.mm index 24dc8ab42a..04d6d6b806 100644 --- a/src/plugins/platforms/cocoa/qcocoainputcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoainputcontext.mm @@ -137,8 +137,8 @@ void QCocoaInputContext::updateLocale() m_locale = locale; emitLocaleChanged(); } - CFRelease(langRef); } + CFRelease(source); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenu.h b/src/plugins/platforms/cocoa/qcocoamenu.h index 6b80162e4d..b77071536b 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.h +++ b/src/plugins/platforms/cocoa/qcocoamenu.h @@ -71,7 +71,7 @@ public: void syncSeparatorsCollapsible(bool enable) Q_DECL_OVERRIDE; - void syncModalState(bool modal); + void propagateEnabledState(bool enabled); void setIcon(const QIcon &icon) Q_DECL_OVERRIDE { Q_UNUSED(icon) } @@ -104,9 +104,10 @@ private: NSMenu *m_nativeMenu; NSMenuItem *m_attachedItem; quintptr m_tag; - bool m_enabled; - bool m_visible; - bool m_isOpen; + bool m_enabled:1; + bool m_parentEnabled:1; + bool m_visible:1; + bool m_isOpen:1; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index 06ec2aa479..40d593cf0f 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -160,10 +160,10 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate); - (BOOL)validateMenuItem:(NSMenuItem*)menuItem { - if (![menuItem tag]) + QCocoaMenuItem *cocoaItem = reinterpret_cast<QCocoaMenuItem *>(menuItem.tag); + if (!cocoaItem) return YES; - QCocoaMenuItem* cocoaItem = reinterpret_cast<QCocoaMenuItem *>([menuItem tag]); return cocoaItem->isEnabled(); } @@ -261,6 +261,7 @@ QCocoaMenu::QCocoaMenu() : m_attachedItem(0), m_tag(0), m_enabled(true), + m_parentEnabled(true), m_visible(true), m_isOpen(false) { @@ -336,6 +337,8 @@ void QCocoaMenu::insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem) else if (isOpen() && item->nsItem()) // Someone's adding new items after aboutToShow() was emitted item->menu()->setAttachedItem(item->nsItem()); + item->setParentEnabled(isEnabled()); + if (item->isMerged()) return; @@ -380,6 +383,9 @@ void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem) if (cocoaItem->menuParent() == this) cocoaItem->setMenuParent(0); + // Ignore any parent enabled state + cocoaItem->setParentEnabled(true); + m_menuItems.removeOne(cocoaItem); if (!cocoaItem->isMerged()) { if (m_nativeMenu != [cocoaItem->nsItem() menu]) { @@ -470,13 +476,17 @@ void QCocoaMenu::syncSeparatorsCollapsible(bool enable) void QCocoaMenu::setEnabled(bool enabled) { + if (m_enabled == enabled) + return; m_enabled = enabled; - syncModalState(!m_enabled); + const bool wasParentEnabled = m_parentEnabled; + propagateEnabledState(m_enabled); + m_parentEnabled = wasParentEnabled; // Reset to the parent value } bool QCocoaMenu::isEnabled() const { - return m_attachedItem ? [m_attachedItem isEnabled] : m_enabled; + return m_attachedItem ? [m_attachedItem isEnabled] : m_enabled && m_parentEnabled; } void QCocoaMenu::setVisible(bool visible) @@ -610,20 +620,19 @@ QList<QCocoaMenuItem *> QCocoaMenu::merged() const return result; } -void QCocoaMenu::syncModalState(bool modal) +void QCocoaMenu::propagateEnabledState(bool enabled) { - QMacAutoReleasePool pool; + QMacAutoReleasePool pool; // FIXME Is this still needed for Creator? See 6a0bb4206a2928b83648 - if (!m_enabled) - modal = true; + m_parentEnabled = enabled; + if (!m_enabled && enabled) // Some ancestor was enabled, but this menu is not + return; foreach (QCocoaMenuItem *item, m_menuItems) { - if (item->menu()) { // recurse into submenus - item->menu()->syncModalState(modal); - continue; - } - - item->syncModalState(modal); + if (QCocoaMenu *menu = item->menu()) + menu->propagateEnabledState(enabled); + else + item->setParentEnabled(enabled); } } diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 96b40259b4..1c50c3b032 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -327,7 +327,7 @@ void QCocoaMenuBar::updateMenuBarImmediately() menu->setMenuParent(mb); // force a sync? mb->syncMenu(menu); - menu->syncModalState(disableForModal); + menu->propagateEnabledState(!disableForModal); } QCocoaMenuLoader *loader = getMenuLoader(); diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.h b/src/plugins/platforms/cocoa/qcocoamenuitem.h index aafc66e06f..d63f21f598 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.h +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.h @@ -103,10 +103,10 @@ public: NSMenuItem *sync(); void syncMerged(); - void syncModalState(bool modal); + void setParentEnabled(bool enabled); inline bool isMerged() const { return m_merged; } - inline bool isEnabled() const { return m_enabled; } + inline bool isEnabled() const { return m_enabled && m_parentEnabled; } inline bool isSeparator() const { return m_isSeparator; } QCocoaMenu *menu() const { return m_menu; } @@ -119,20 +119,21 @@ private: NSMenuItem *m_native; NSView *m_itemView; QString m_text; - bool m_textSynced; QIcon m_icon; QPointer<QCocoaMenu> m_menu; - bool m_isVisible; - bool m_enabled; - bool m_isSeparator; QFont m_font; MenuRole m_role; MenuRole m_detectedRole; QKeySequence m_shortcut; - bool m_checked; - bool m_merged; quintptr m_tag; int m_iconSize; + bool m_textSynced:1; + bool m_isVisible:1; + bool m_enabled:1; + bool m_parentEnabled:1; + bool m_isSeparator:1; + bool m_checked:1; + bool m_merged:1; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 64c460feb9..3979d7169a 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -96,16 +96,17 @@ NSUInteger keySequenceModifierMask(const QKeySequence &accel) QCocoaMenuItem::QCocoaMenuItem() : m_native(NULL), m_itemView(nil), - m_textSynced(false), m_menu(NULL), + m_role(NoRole), + m_tag(0), + m_iconSize(16), + m_textSynced(false), m_isVisible(true), m_enabled(true), + m_parentEnabled(true), m_isSeparator(false), - m_role(NoRole), m_checked(false), - m_merged(false), - m_tag(0), - m_iconSize(16) + m_merged(false) { } @@ -141,15 +142,23 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu) if (menu == m_menu) return; - if (m_menu) { - if (m_menu->menuParent() == this) - m_menu->setMenuParent(0); + if (m_menu && m_menu->menuParent() == this) { + m_menu->setMenuParent(0); + // Free the menu from its parent's influence + m_menu->propagateEnabledState(true); + if (m_native && m_menu->attachedItem() == m_native) + m_menu->setAttachedItem(nil); } QMacAutoReleasePool pool; m_menu = static_cast<QCocoaMenu *>(menu); if (m_menu) { + if (m_native) { + // Skip automatic menu item validation + m_native.action = nil; + } m_menu->setMenuParent(this); + m_menu->propagateEnabledState(isEnabled()); } else { // we previously had a menu, but no longer // clear out our item so the nexy sync() call builds a new one @@ -192,7 +201,11 @@ void QCocoaMenuItem::setChecked(bool isChecked) void QCocoaMenuItem::setEnabled(bool enabled) { - m_enabled = enabled; + if (m_enabled != enabled) { + m_enabled = enabled; + if (m_menu) + m_menu->propagateEnabledState(isEnabled()); + } } void QCocoaMenuItem::setNativeContents(WId item) @@ -400,12 +413,13 @@ void QCocoaMenuItem::syncMerged() [m_native setHidden: !m_isVisible]; } -void QCocoaMenuItem::syncModalState(bool modal) +void QCocoaMenuItem::setParentEnabled(bool enabled) { - if (modal) - [m_native setEnabled:NO]; - else - [m_native setEnabled:YES]; + if (m_parentEnabled != enabled) { + m_parentEnabled = enabled; + if (m_menu) + m_menu->propagateEnabledState(isEnabled()); + } } QPlatformMenuItem::MenuRole QCocoaMenuItem::effectiveRole() const diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 5408ff41e5..f6d911d646 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -362,8 +362,9 @@ void QWindowsFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QFontEn glyphIndices.size(), glyphMetrics.data()); if (SUCCEEDED(hr)) { + qreal stretch = fontDef.stretch / 100.0; for (int i = 0; i < glyphs->numGlyphs; ++i) - glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth); + glyphs->advances[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth * stretch); if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { for (int i = 0; i < glyphs->numGlyphs; ++i) glyphs->advances[i] = glyphs->advances[i].round(); @@ -520,7 +521,7 @@ bool QWindowsFontEngineDirectWrite::supportsSubPixelPositions() const QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, QFixed subPixelPosition, int margin, - const QTransform &xform) + const QTransform &originalTransform) { UINT16 glyphIndex = t; FLOAT glyphAdvance = 0; @@ -539,6 +540,10 @@ QImage QWindowsFontEngineDirectWrite::imageForGlyph(glyph_t t, glyphRun.bidiLevel = 0; glyphRun.glyphOffsets = &glyphOffset; + QTransform xform = originalTransform; + if (fontDef.stretch != 100) + xform.scale(fontDef.stretch / 100.0, 1.0); + DWRITE_MATRIX transform; transform.dx = subPixelPosition.toReal(); transform.dy = 0; @@ -795,10 +800,15 @@ QString QWindowsFontEngineDirectWrite::fontNameSubstitute(const QString &familyN glyph_metrics_t QWindowsFontEngineDirectWrite::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, - const QTransform &matrix, + const QTransform &originalTransform, GlyphFormat format) { Q_UNUSED(format); + + QTransform matrix = originalTransform; + if (fontDef.stretch != 100) + matrix.scale(fontDef.stretch / 100.0, 1.0); + glyph_metrics_t bbox = QFontEngine::boundingBox(glyph, matrix); // To get transformed advance UINT16 glyphIndex = glyph; diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 1fee56aeca..d8058fcd06 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -57,8 +57,9 @@ enum { debug = 0 }; static inline bool shellExecute(const QUrl &url) { #ifndef Q_OS_WINCE - const QString nativeFilePath = - url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.toString(QUrl::FullyEncoded); + const QString nativeFilePath = url.isLocalFile() && !url.hasFragment() && !url.hasQuery() + ? QDir::toNativeSeparators(url.toLocalFile()) + : url.toString(QUrl::FullyEncoded); const quintptr result = reinterpret_cast<quintptr>(ShellExecute(0, 0, reinterpret_cast<const wchar_t *>(nativeFilePath.utf16()), 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_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/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index fded4de76a..05107932f9 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); } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 891f0fbcb5..ebea8d5460 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -85,6 +85,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 5b7f45fb6c..f2824b6d65 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); @@ -748,8 +748,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) @@ -880,8 +880,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()); @@ -1114,9 +1114,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); } @@ -1178,8 +1179,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/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/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 54c93bea39..a39ff01afd 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2413,7 +2413,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); @@ -2421,17 +2421,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: |