diff options
author | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-09-29 13:37:46 +0200 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dedietrich@digia.com> | 2014-09-29 13:38:11 +0200 |
commit | 8ab25620d3df25c43011ae982f4614639578afb3 (patch) | |
tree | e94d53c6b7d231ca18f0787a0c09bec07d163a67 /src/plugins | |
parent | dfe853bff90444edf92a993e391df853780c9e8d (diff) | |
parent | 5222abfdf5f034bad12bbe12312a4149550495b7 (diff) |
Merge remote-tracking branch 'origin/5.3' into 5.4
Conflicts:
src/network/socket/qnativesocketengine_unix.cpp
src/widgets/kernel/qwidget_qpa.cpp
Change-Id: I6f1aa320d5ca66cd92d601a95885aeaab0abb191
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoawindow.mm | 33 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbclipboard.cpp | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.cpp | 4 |
6 files changed, 46 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index f021446438..78465b896d 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -703,9 +703,8 @@ bool QCocoaFileDialogHelper::show(Qt::WindowFlags windowFlags, Qt::WindowModalit void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() { - if (mDelegate) - return; QCocoaAutoReleasePool pool; + const SharedPointerFileDialogOptions &opts = options(); const QList<QUrl> selectedFiles = opts->initiallySelectedFiles(); const QUrl directory = mDir.isEmpty() ? opts->initialDirectory() : mDir; @@ -717,6 +716,7 @@ void QCocoaFileDialogHelper::createNSOpenSavePanelDelegate() options:opts helper:this]; + [static_cast<QNSOpenSavePanelDelegate *>(mDelegate) release]; mDelegate = delegate; } diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 7e22351818..a0e02501de 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -82,6 +82,32 @@ static bool isMouseEvent(NSEvent *ev) } } +static void selectNextKeyWindow(NSWindow *currentKeyWindow) +{ + if (!currentKeyWindow) + return; + + const QCocoaAutoReleasePool pool; + + if ([[NSApplication sharedApplication] keyWindow] != currentKeyWindow) + return;//currentKeyWindow is not a key window actually. + + NSArray *const windows = [[NSApplication sharedApplication] windows]; + bool startLookup = false; + for (NSWindow *candidate in [windows reverseObjectEnumerator]) { + if (!startLookup) { + if (candidate == currentKeyWindow) + startLookup = true; + } else { + if ([candidate isVisible] && [candidate canBecomeKeyWindow]) { + [candidate makeKeyWindow]; + break; + } + } + } +} + + @interface NSWindow (CocoaWindowCategory) - (NSRect) legacyConvertRectFromScreen:(NSRect) rect; @end @@ -592,6 +618,9 @@ void QCocoaWindow::hide(bool becauseOfAncestor) foreach (QCocoaWindow *childWindow, m_childWindows) childWindow->hide(true); + if (window()->transientParent() && m_nsWindow == [[NSApplication sharedApplication] keyWindow]) + selectNextKeyWindow(m_nsWindow); // Otherwise, Cocoa can do it wrong. + [m_nsWindow orderOut:nil]; } @@ -1456,7 +1485,11 @@ void QCocoaWindow::setNSWindow(QCocoaNSWindow *window) { if (window.contentView != m_contentView) { [m_contentView setPostsFrameChangedNotifications: NO]; + [m_contentView retain]; + if (m_contentView.superview) // m_contentView comes from another NSWindow + [m_contentView removeFromSuperview]; [window setContentView:m_contentView]; + [m_contentView release]; [m_contentView setPostsFrameChangedNotifications: YES]; } } diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index d72664f0a0..73f8d276a8 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -594,6 +594,8 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; CGImageRelease(subMask); [self invalidateWindowShadowIfNeeded]; + + m_backingStore = 0; } - (BOOL) isFlipped diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index d1e3ae6a88..45856f3e6c 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -731,6 +731,9 @@ void QXcbClipboard::handleSelectionRequest(xcb_selection_request_event_t *req) void QXcbClipboard::handleXFixesSelectionRequest(xcb_xfixes_selection_notify_event_t *event) { QClipboard::Mode mode = modeForAtom(event->selection); + if (mode > QClipboard::Selection) + return; + // here we care only about the xfixes events that come from non Qt processes if (event->owner != XCB_NONE && event->owner != owner()) { if (!m_xClipboard[mode]) { diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 84e46a7339..90d323ed34 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -361,8 +361,10 @@ XInput2TouchDeviceData *QXcbConnection::touchDeviceForId(int id) QTouchDevice::Capabilities caps = 0; dev = new XInput2TouchDeviceData; dev->xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), id, &nrDevices); - if (nrDevices <= 0) + if (nrDevices <= 0) { + delete dev; return 0; + } int type = -1; int maxTouchPoints = 1; bool hasRelativeCoords = false; diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 90479f39eb..7e70e7258d 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -848,8 +848,10 @@ QList<int> QXcbKeyboard::possibleKeys(const QKeyEvent *event) const baseLayout, latchedLayout, lockedLayout); xkb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, event->nativeScanCode()); - if (sym == XKB_KEY_NoSymbol) + if (sym == XKB_KEY_NoSymbol) { + xkb_state_unref(kb_state); return QList<int>(); + } QList<int> result; int baseQtKey = keysymToQtKey(sym, modifiers, lookupString(kb_state, event->nativeScanCode())); |