diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-04 19:34:36 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-06-04 19:34:36 +0200 |
commit | 80604a0786628a0c57eac7cc856720537956cc7f (patch) | |
tree | e31b9b56584e77d6aefd4dfd072ce4e8e3648f3d /src/plugins | |
parent | 1c901913c0af79b2bbde1b9da71f5267cb4fc76a (diff) | |
parent | c11a7d16c7056da4086a87c9e85b89f8466be032 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/corelib/global/qglobal.h
src/plugins/platforms/cocoa/qnsview.mm
Change-Id: I6fe345df5c417cb7a55a3f91285d9b47a22c04fa
Diffstat (limited to 'src/plugins')
25 files changed, 232 insertions, 76 deletions
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index e78a597433..4efecc5464 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -81,6 +81,8 @@ QConnmanManagerInterface::QConnmanManagerInterface( QObject *parent) CONNMAN_MANAGER_INTERFACE, QDBusConnection::systemBus(), parent) { + qDBusRegisterMetaType<ConnmanMap>(); + qDBusRegisterMetaType<ConnmanMapList>(); } QConnmanManagerInterface::~QConnmanManagerInterface() diff --git a/src/plugins/platforms/cocoa/qcocoadrag.h b/src/plugins/platforms/cocoa/qcocoadrag.h index 6e29fd1a78..80259df600 100644 --- a/src/plugins/platforms/cocoa/qcocoadrag.h +++ b/src/plugins/platforms/cocoa/qcocoadrag.h @@ -45,7 +45,7 @@ #include <Cocoa/Cocoa.h> #include <QtGui> #include <qpa/qplatformdrag.h> -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qsimpledrag_p.h> #include <QtGui/private/qdnd_p.h> diff --git a/src/plugins/platforms/cocoa/qcocoamenu.mm b/src/plugins/platforms/cocoa/qcocoamenu.mm index df0ef390c9..08ae6c43bd 100644 --- a/src/plugins/platforms/cocoa/qcocoamenu.mm +++ b/src/plugins/platforms/cocoa/qcocoamenu.mm @@ -179,7 +179,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QCocoaMenuDelegate); } QKeyEvent accel_ev(QEvent::ShortcutOverride, (keyCode & (~Qt::KeyboardModifierMask)), - Qt::KeyboardModifiers(keyCode & Qt::KeyboardModifierMask)); + Qt::KeyboardModifiers(modifiers & Qt::KeyboardModifierMask)); accel_ev.ignore(); QCoreApplication::sendEvent(object, &accel_ev); if (accel_ev.isAccepted()) { diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index 5165a2095e..315f192ff8 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -136,6 +136,17 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu) QCocoaMenu *cocoaMenu = static_cast<QCocoaMenu *>(menu); Q_FOREACH (QCocoaMenuItem *item, cocoaMenu->items()) cocoaMenu->syncMenuItem(item); + + // If the NSMenu has no visble items, or only separators, we should hide it + // on the menubar. This can happen after syncing the menu items since they + // can be moved to other menus. + BOOL shouldHide = YES; + for (NSMenuItem *item in [cocoaMenu->nsMenu() itemArray]) + if (![item isSeparatorItem] && ![item isHidden]) { + shouldHide = NO; + break; + } + [cocoaMenu->nsMenuItem() setHidden:shouldHide]; } void QCocoaMenuBar::handleReparent(QWindow *newParentWindow) diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index 05f0baa60f..4fb79f6c93 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -241,7 +241,8 @@ NSMenuItem *QCocoaMenuItem::sync() mergeItem = [loader quitMenuItem]; break; default: - m_textSynced = true; + if (!m_text.isEmpty()) + m_textSynced = true; break; } break; @@ -264,7 +265,7 @@ NSMenuItem *QCocoaMenuItem::sync() m_native = nil; // create item below m_merged = false; } - } else { + } else if (!m_text.isEmpty()) { m_textSynced = true; // NoRole, and that was set explicitly. So, nothing to do anymore. } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 297bfb955d..bf7d722b36 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -118,6 +118,7 @@ public: bool setKeyboardGrabEnabled(bool grab); bool setMouseGrabEnabled(bool grab); QMargins frameMargins() const; + QSurfaceFormat format() const; void requestActivateWindow(); diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 47341e2262..b455dd6642 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -256,6 +256,11 @@ QCocoaWindow::~QCocoaWindow() [m_nsWindowDelegate release]; } +QSurfaceFormat QCocoaWindow::format() const +{ + return window()->requestedFormat(); +} + void QCocoaWindow::setGeometry(const QRect &rect) { if (geometry() == rect) @@ -821,6 +826,9 @@ NSWindow * QCocoaWindow::createNSWindow() if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) { // Make popup winows show on the same desktop as the parent full-screen window. [window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary]; + + if ((type & Qt::Popup) == Qt::Popup) + [window setAnimationBehavior:NSWindowAnimationBehaviorUtilityWindow]; } #endif window->m_cocoaPlatformWindow = this; @@ -1013,15 +1021,11 @@ void QCocoaWindow::obscureWindow() QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint) { QWindow *targetWindow = window(); - foreach (QObject *child, targetWindow->children()) { - if (QWindow *childWindow = qobject_cast<QWindow *>(child)) { - if (childWindow->geometry().contains(windowPoint)) { - QCocoaWindow* platformWindow = static_cast<QCocoaWindow*>(childWindow->handle()); - if (platformWindow->isExposed()) - targetWindow = platformWindow->childWindowAt(windowPoint - childWindow->position()); - } - } - } + foreach (QObject *child, targetWindow->children()) + if (QWindow *childWindow = qobject_cast<QWindow *>(child)) + if (QPlatformWindow *handle = childWindow->handle()) + if (handle->isExposed() && childWindow->geometry().contains(windowPoint)) + targetWindow = static_cast<QCocoaWindow*>(handle)->childWindowAt(windowPoint - childWindow->position()); return targetWindow; } diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 85f72a4dbb..c7c6c20473 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -113,6 +113,7 @@ QT_END_NAMESPACE - (void)handleKeyEvent:(NSEvent *)theEvent eventType:(int)eventType; - (void)keyDown:(NSEvent *)theEvent; - (void)keyUp:(NSEvent *)theEvent; +- (BOOL)performKeyEquivalent:(NSEvent *)theEvent; - (void)registerDragTypes; - (NSDragOperation)handleDrag:(id <NSDraggingInfo>)sender; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 42117a64a1..2ba655b8e3 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -113,6 +113,8 @@ static QTouchDevice *touchDevice = 0; name:NSViewGlobalFrameDidChangeNotification object:self]; } + delete currentCustomDragTypes; + [super dealloc]; } @@ -340,15 +342,20 @@ static QTouchDevice *touchDevice = 0; } const QRect &rect = region->boundingRect(); - QImage maskImage(rect.size(), QImage::Format_RGB888); - maskImage.fill(Qt::white); - QPainter p(&maskImage); - p.setRenderHint(QPainter::Antialiasing); + QImage tmp(rect.size(), QImage::Format_RGB32); + tmp.fill(Qt::white); + QPainter p(&tmp); p.setClipRegion(*region); - p.fillRect(rect, QBrush(Qt::black)); + p.fillRect(rect, Qt::black); p.end(); - - maskImage = maskImage.convertToFormat(QImage::Format_Indexed8); + QImage maskImage = QImage(rect.size(), QImage::Format_Indexed8); + for (int y=0; y<rect.height(); ++y) { + const uint *src = (const uint *) tmp.constScanLine(y); + uchar *dst = maskImage.scanLine(y); + for (int x=0; x<rect.width(); ++x) { + dst[x] = src[x] & 0xff; + } + } m_maskImage = qt_mac_toCGImage(maskImage, true, &m_maskData); } @@ -955,6 +962,23 @@ static QTouchDevice *touchDevice = 0; [self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)]; } +- (BOOL)performKeyEquivalent:(NSEvent *)nsevent +{ + NSString *chars = [nsevent charactersIgnoringModifiers]; + + if ([nsevent type] == NSKeyDown && [chars length] > 0) { + QChar ch = [chars characterAtIndex:0]; + Qt::Key qtKey = qt_mac_cocoaKey2QtKey(ch); + // check for Command + Key_Period + if ([nsevent modifierFlags] & NSCommandKeyMask + && qtKey == Qt::Key_Period) { + [self handleKeyEvent:nsevent eventType:int(QEvent::KeyPress)]; + return YES; + } + } + return [super performKeyEquivalent:nsevent]; +} + - (void)flagsChanged:(NSEvent *)nsevent { ulong timestamp = [nsevent timestamp] * 1000; diff --git a/src/plugins/platforms/cocoa/qt_mac_p.h b/src/plugins/platforms/cocoa/qt_mac_p.h index 0906431986..808ca9194b 100644 --- a/src/plugins/platforms/cocoa/qt_mac_p.h +++ b/src/plugins/platforms/cocoa/qt_mac_p.h @@ -111,21 +111,6 @@ public: } }; -// Class for chaining to gether a bunch of fades. It pretty much is only used for qmenu fading. -class QMacWindowFader -{ - QWidgetList m_windowsToFade; - float m_duration; - Q_DISABLE_COPY(QMacWindowFader) -public: - QMacWindowFader(); // PLEASE DON'T CALL THIS. - static QMacWindowFader *currentFader(); - void registerWindowToFade(QWidget *window); - void setFadeDuration(float durationInSecs) { m_duration = durationInSecs; } - float fadeDuration() const { return m_duration; } - void performFade(); -}; - class Q_WIDGETS_EXPORT QMacCocoaAutoReleasePool { private: diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index 9abb4ba851..537d63ae77 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -142,7 +142,7 @@ QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen) // aligned with UIScreen into whatever is the current orientation of QScreen. QRect geometry = screen->geometry(); return geometry.width() < geometry.height() ? rect - : QRect(rect.y(), geometry.width() - rect.width() - rect.x(), rect.height(), rect.width()); + : QRect(rect.y(), geometry.height() - rect.width() - rect.x(), rect.height(), rect.width()); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index c1613c1af4..106cf1a978 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -136,7 +136,7 @@ QIOSScreen::QIOSScreen(unsigned int screenIndex) int unscaledDpi = 163; // Regular iPhone DPI if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad - && deviceIdentifier != QStringLiteral("iPad2,5") /* iPad Mini */) { + && !deviceIdentifier.contains(QRegularExpression("^iPad2,[567]$")) /* excluding iPad Mini */) { unscaledDpi = 132; }; diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 02ac413b3b..0c3ae8e834 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -150,7 +150,8 @@ - (void)updateTouchList:(NSSet *)touches withState:(Qt::TouchPointState)state { - QRect applicationRect = fromCGRect(self.window.screen.applicationFrame); + QPlatformScreen *screen = QGuiApplication::primaryScreen()->handle(); + QRect applicationRect = fromPortraitToPrimary(fromCGRect(self.window.screen.applicationFrame), screen); foreach (UITouch *uiTouch, m_activeTouches.keys()) { QWindowSystemInterface::TouchPoint &touchPoint = m_activeTouches[uiTouch]; @@ -163,8 +164,10 @@ // Find the touch position relative to the window. Then calculate the screen // position by subtracting the position of the applicationRect (since UIWindow // does not take that into account when reporting its own frame): - QPoint touchPos = fromCGPoint([uiTouch locationInView:nil]); - touchPoint.area = QRectF(touchPos - applicationRect.topLeft(), QSize(0, 0)); + QRect touchInWindow = QRect(fromCGPoint([uiTouch locationInView:nil]), QSize(0, 0)); + QRect touchInScreen = fromPortraitToPrimary(touchInWindow, screen); + QPoint touchPos = touchInScreen.topLeft() - applicationRect.topLeft(); + touchPoint.area = QRectF(touchPos, QSize(0, 0)); touchPoint.normalPosition = QPointF(touchPos.x() / applicationRect.width(), touchPos.y() / applicationRect.height()); } } @@ -407,7 +410,7 @@ void QIOSWindow::requestActivateWindow() // Note that several windows can be active at the same time if they exist in the same // hierarchy (transient children). But only one window can be QGuiApplication::focusWindow(). // Dispite the name, 'requestActivateWindow' means raise and transfer focus to the window: - if (blockedByModal()) + if (!window()->isTopLevel() || blockedByModal()) return; raise(); diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index a933f7d571..fa9961ccce 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -93,7 +93,7 @@ #include <QtGui/QOpenGLContext> #endif -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qsimpledrag_p.h> #include <QtCore/QDebug> #include <QtCore/QHash> diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.cpp b/src/plugins/platforms/qnx/qqnxrootwindow.cpp index dddadb5ca8..5d58890c51 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrootwindow.cpp @@ -60,7 +60,8 @@ static const int MAGIC_ZORDER_FOR_NO_NAV = 10; QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) : m_screen(screen), m_window(0), - m_windowGroupName() + m_windowGroupName(), + m_translucent(false) { qRootWindowDebug() << Q_FUNC_INFO; // Create one top-level QNX window to act as a container for child windows @@ -122,7 +123,10 @@ QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) if (result != 0) qFatal("QQnxRootWindow: failed to set window size, errno=%d", errno); - // Fill the window with solid black + // Fill the window with solid black. Note that the LSB of the pixel value + // 0x00000000 just happens to be 0x00, so if and when this root window's + // alpha blending mode is changed from None to Source-Over, it will then + // be interpreted as transparent. errno = 0; val[0] = 0; result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_COLOR, val); @@ -152,13 +156,62 @@ QQnxRootWindow::QQnxRootWindow(const QQnxScreen *screen) qFatal("QQnxRootWindow: failed to set window source size, errno=%d", errno); errno = 0; - val[0] = 1; + val[0] = 0; val[1] = 0; result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SOURCE_POSITION, val); if (result != 0) qFatal("QQnxRootWindow: failed to set window source position, errno=%d", errno); createWindowGroup(); + + // Don't post yet. This will be lazily done from QQnxScreen upon first posting of + // a child window. Doing it now pre-emptively would create a flicker if one of + // the QWindow's about to be created sets its Qt::WA_TranslucentBackground flag + // and immediately triggers the buffer re-creation in makeTranslucent(). +} + +void QQnxRootWindow::makeTranslucent() +{ + if (m_translucent) + return; + + int result; + + errno = 0; + result = screen_destroy_window_buffers(m_window); + if (result != 0) { + qFatal("QQnxRootWindow: failed to destroy window buffer, errno=%d", errno); + } + + QRect geometry = m_screen->geometry(); + errno = 0; + int val[2]; + val[0] = geometry.width(); + val[1] = geometry.height(); + result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_BUFFER_SIZE, val); + if (result != 0) { + qFatal("QQnxRootWindow: failed to set window buffer size, errno=%d", errno); + } + + errno = 0; + result = screen_create_window_buffers(m_window, 1); + if (result != 0) { + qFatal("QQNX: failed to create window buffer, errno=%d", errno); + } + + // Install an alpha channel on the root window. + // + // This is necessary in order to avoid interfering with any particular + // toplevel widget's QQnxWindow window instance from showing transparent + // if it desires. + errno = 0; + val[0] = SCREEN_TRANSPARENCY_SOURCE_OVER; + result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val); + if (result != 0) { + qFatal("QQnxRootWindow: failed to set window transparency, errno=%d", errno); + } + + m_translucent = true; post(); } diff --git a/src/plugins/platforms/qnx/qqnxrootwindow.h b/src/plugins/platforms/qnx/qqnxrootwindow.h index aae1563c95..ea7c7faace 100644 --- a/src/plugins/platforms/qnx/qqnxrootwindow.h +++ b/src/plugins/platforms/qnx/qqnxrootwindow.h @@ -66,6 +66,8 @@ public: void resize(const QSize &size); + void makeTranslucent(); + QByteArray groupName() const { return m_windowGroupName; } private: @@ -74,6 +76,8 @@ private: const QQnxScreen *m_screen; screen_window_t m_window; QByteArray m_windowGroupName; + + bool m_translucent; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index f8203b2329..84721c9c2a 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -62,6 +62,14 @@ #error Please define QQNX_PHYSICAL_SCREEN_WIDTH and QQNX_PHYSICAL_SCREEN_HEIGHT to values greater than zero #endif +// The default z-order of a window (intended to be overlain) created by +// mmrender. +static const int MMRENDER_DEFAULT_ZORDER = -1; + +// The maximum z-order at which a foreign window will be considered +// an underlay. +static const int MAX_UNDERLAY_ZORDER = MMRENDER_DEFAULT_ZORDER - 1; + QT_BEGIN_NAMESPACE static QSize determineScreenSize(screen_display_t display, bool primaryScreen) { @@ -463,16 +471,32 @@ void QQnxScreen::updateHierarchy() qScreenDebug() << Q_FUNC_INFO; QList<QQnxWindow*>::const_iterator it; - int topZorder = 1; // root window is z-order 0, all "top" level windows are "above" it + int result; + int topZorder; + + errno = 0; + result = screen_get_window_property_iv(rootWindow()->nativeHandle(), SCREEN_PROPERTY_ZORDER, &topZorder); + if (result != 0) + qFatal("QQnxScreen: failed to query root window z-order, errno=%d", errno); + + topZorder++; // root window has the lowest z-order in the windowgroup + + // Underlays sit immediately above the root window in the z-ordering + Q_FOREACH (screen_window_t underlay, m_underlays) { + // Do nothing when this fails. This can happen if we have stale windows in m_underlays, + // which in turn can happen because a window was removed but we didn't get a notification + // yet. + screen_set_window_property_iv(underlay, SCREEN_PROPERTY_ZORDER, &topZorder); + topZorder++; + } + // Normal Qt windows come next above underlays in the z-ordering for (it = m_childWindows.constBegin(); it != m_childWindows.constEnd(); ++it) (*it)->updateZorder(topZorder); - topZorder++; + // Finally overlays sit above all else in the z-ordering Q_FOREACH (screen_window_t overlay, m_overlays) { - // Do nothing when this fails. This can happen if we have stale windows in mOverlays, - // which in turn can happen because a window was removed but we didn't get a notification - // yet. + // No error handling, see underlay logic above screen_set_window_property_iv(overlay, SCREEN_PROPERTY_ZORDER, &topZorder); topZorder++; } @@ -529,10 +553,16 @@ void QQnxScreen::addOverlayWindow(screen_window_t window) updateHierarchy(); } -void QQnxScreen::removeOverlayWindow(screen_window_t window) +void QQnxScreen::addUnderlayWindow(screen_window_t window) +{ + m_underlays.append(window); + updateHierarchy(); +} + +void QQnxScreen::removeOverlayOrUnderlayWindow(screen_window_t window) { - const int numOverlaysRemoved = m_overlays.removeAll(window); - if (numOverlaysRemoved > 0) + const int numRemoved = m_overlays.removeAll(window) + m_underlays.removeAll(window); + if (numRemoved > 0) updateHierarchy(); } @@ -546,13 +576,28 @@ void QQnxScreen::newWindowCreated(void *window) return; } + int zorder; + if (screen_get_window_property_iv(windowHandle, SCREEN_PROPERTY_ZORDER, &zorder) != 0) { + qWarning("QQnx: Failed to get z-order for window, errno=%d", errno); + zorder = 0; + } + if (display == nativeDisplay()) { // A window was created on this screen. If we don't know about this window yet, it means // it was not created by Qt, but by some foreign library like the multimedia renderer, which // creates an overlay window when playing a video. - // Treat all foreign windows as overlays here. - if (!findWindow(windowHandle)) - addOverlayWindow(windowHandle); + // + // Treat all foreign windows as overlays or underlays here. + // + // Assume that if a foreign window already has a Z-Order both negative and + // less than the default Z-Order installed by mmrender on windows it creates, + // the windows should be treated as an underlay. Otherwise, we treat it as an overlay. + if (!findWindow(windowHandle)) { + if (zorder <= MAX_UNDERLAY_ZORDER) + addUnderlayWindow(windowHandle); + else + addOverlayWindow(windowHandle); + } } } @@ -560,7 +605,7 @@ void QQnxScreen::windowClosed(void *window) { Q_ASSERT(thread() == QThread::currentThread()); const screen_window_t windowHandle = reinterpret_cast<screen_window_t>(window); - removeOverlayWindow(windowHandle); + removeOverlayOrUnderlayWindow(windowHandle); } void QQnxScreen::windowGroupStateChanged(const QByteArray &id, Qt::WindowState state) diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 98f2a90fbc..6e8c2c6a60 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -114,7 +114,8 @@ private: void resizeTopLevelWindow(QQnxWindow *w, const QRect &previousScreenGeometry) const; void resizeWindows(const QRect &previousScreenGeometry); void addOverlayWindow(screen_window_t window); - void removeOverlayWindow(screen_window_t window); + void addUnderlayWindow(screen_window_t window); + void removeOverlayOrUnderlayWindow(screen_window_t window); QWindow *topMostChildWindow() const; @@ -136,6 +137,7 @@ private: QList<QQnxWindow *> m_childWindows; QList<screen_window_t> m_overlays; + QList<screen_window_t> m_underlays; QPlatformCursor *m_cursor; }; diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index 6992d70fb1..f7fc5de8d7 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -117,9 +117,13 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) if (result != 0) qFatal("QQnxWindow: failed to set window alpha mode, errno=%d", errno); - // Make the window opaque + // Blend the window with Source Over Porter-Duff behavior onto whatever's + // behind it. + // + // If the desired use-case is opaque, the Widget painting framework will + // already fill in the alpha channel with full opacity. errno = 0; - val = SCREEN_TRANSPARENCY_NONE; + val = SCREEN_TRANSPARENCY_SOURCE_OVER; result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val); if (result != 0) qFatal("QQnxWindow: failed to set window transparency, errno=%d", errno); @@ -369,9 +373,16 @@ void QQnxWindow::setBufferSize(const QSize &size) errno = 0; result = screen_create_window_buffers(m_window, MAX_BUFFER_COUNT); - if (result != 0) + if (result != 0) { qWarning() << "QQnxWindow: Buffer size was" << size; qFatal("QQnxWindow: failed to create window buffers, errno=%d", errno); + } + + // If the child window has been configured for transparency, lazily create + // a full-screen buffer to back the root window. + if (window()->requestedFormat().hasAlpha()) { + m_screen->rootWindow()->makeTranslucent(); + } // check if there are any buffers available int bufferCount = 0; diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 73df3ec032..814892b43a 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -552,11 +552,15 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co break; case QPlatformIntegration::UseRtlExtensions: return QVariant(d->m_context.useRTLExtensions()); +#ifdef Q_OS_WINCE case QPlatformIntegration::SynthesizeMouseFromTouchEvents: // We do not want Qt to synthesize mouse events as Windows also does that. // Alternatively, Windows-generated touch mouse events can be identified and // ignored by checking GetMessageExtraInfo() for MI_WP_SIGNATURE (0xFF515700). return false; +#endif // Q_OS_WINCE + default: + break; } return QPlatformIntegration::styleHint(hint); } diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 924d604641..f6163ed8c7 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -793,7 +793,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms // A multi-character key or a Input method character // not found by our look-ahead if (msgType == WM_CHAR || msgType == WM_IME_CHAR) { - sendExtendedPressRelease(receiver, 0, Qt::KeyboardModifier(state), scancode, vk_key, nModifiers, messageKeyText(msg), false, 0); + sendExtendedPressRelease(receiver, 0, Qt::KeyboardModifier(state), scancode, vk_key, nModifiers, messageKeyText(msg), false); return true; } @@ -822,13 +822,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (dirStatus == VK_LSHIFT && ((msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL)) || (msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT)))) { - sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false); result = true; dirStatus = 0; } else if (dirStatus == VK_RSHIFT && ( (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL)) || (msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT)))) { - sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false, 0); + sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false); result = true; dirStatus = 0; } else { @@ -1020,9 +1020,9 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms if (rec) { if (code < Qt::Key_Shift || code > Qt::Key_ScrollLock) { QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true); QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true); result = true; } } @@ -1033,7 +1033,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms const char a = uch.row() ? 0 : uch.cell(); key_recorder.storeKey(msg.wParam, a, state, text); QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code, - Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, text, false, 0); + Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, text, false); result =true; bool store = true; #ifndef Q_OS_WINCE @@ -1077,7 +1077,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms code = Qt::Key_Backtab; QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code, Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, - (rec ? rec->text : QString()), false, 0); + (rec ? rec->text : QString()), false); result = true; #ifndef Q_OS_WINCE // don't pass Alt to Windows unless we are embedded in a non-Qt window diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index fd00a07d6c..5c096b7eca 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -157,9 +157,19 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result) { + enum { signatureMask = 0xffffff00, miWpSignature = 0xff515700 }; + if (et == QtWindows::MouseWheelEvent) return translateMouseWheelEvent(window, hwnd, msg, result); +#ifndef Q_OS_WINCE + // Check for events synthesized from touch. Lower byte is touch index, 0 means pen. + const LPARAM extraInfo = GetMessageExtraInfo(); + const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0xff); + if (fromTouch) + return false; +#endif // !Q_OS_WINCE + const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); if (et & QtWindows::NonClientEventFlag) { const QPoint globalPosition = winEventPosition; diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 73c78f0090..9d817c2043 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -503,11 +503,6 @@ QWindowsWindow::WindowData const QWindowCreationContextPtr context(new QWindowCreationContext(w, rect, data.customMargins, style, exStyle)); QWindowsContext::instance()->setWindowCreationContext(context); - if (context->frameX < 0) - context->frameX = 0; - if (context->frameY < 0) - context->frameY = 0; - if (QWindowsContext::verboseWindows) qDebug().nospace() << "CreateWindowEx: " << w << *this diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index db736cef4e..4961e0377c 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -57,8 +57,8 @@ #include <qpa/qwindowsysteminterface.h> -#include <QtPlatformSupport/private/qshapedpixmapdndwindow_p.h> -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qshapedpixmapdndwindow_p.h> +#include <private/qsimpledrag_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index 5678c2d303..5648f70d9e 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -43,7 +43,7 @@ #define QXCBDRAG_H #include <qpa/qplatformdrag.h> -#include <QtPlatformSupport/private/qsimpledrag_p.h> +#include <private/qsimpledrag_p.h> #include <qxcbobject.h> #include <xcb/xcb.h> #include <qlist.h> |