diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-21 13:05:36 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2017-06-21 20:25:31 +0000 |
commit | eecf64f61dbf2a0dafc8dfc809d5e87fb398d0f6 (patch) | |
tree | 4dfdc62674e8b89a9cf6e7125274e75879a74715 /src/plugins/platforms/cocoa/qnswindow.mm | |
parent | 3d8a70c0459192d57088ee51d2b1f0cc52d2e5f8 (diff) |
macOS: Remove support for child NSWindows
The private feature was only used by QToolBar to solve QTBUG-33082, but
the solution doesn't work, and complicates the macOS platform plugin
quite a bit.
A better solution is likely to use Core Animation layers, which is a
direction we're going in anyways. To make it easier to modernize the
macOS platform plugin, including moving to using layers, we remove the
child NSWindows codepaths for now.
Change-Id: I4b19464be3980fd84dd7af8316d4d5e85ba813b1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnswindow.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnswindow.mm | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm index 13bc13b5bc..7deca133b1 100644 --- a/src/plugins/platforms/cocoa/qnswindow.mm +++ b/src/plugins/platforms/cocoa/qnswindow.mm @@ -118,22 +118,6 @@ static bool isMouseEvent(NSEvent *ev) - (void)handleWindowEvent:(NSEvent *)theEvent { - QCocoaWindow *pw = self.platformWindow; - if (pw && pw->m_forwardWindow) { - if (theEvent.type == NSLeftMouseUp || theEvent.type == NSLeftMouseDragged) { - QNSView *forwardView = qnsview_cast(pw->view()); - if (theEvent.type == NSLeftMouseUp) { - [forwardView mouseUp:theEvent]; - pw->m_forwardWindow.clear(); - } else { - [forwardView mouseDragged:theEvent]; - } - } - if (pw->window()->isTopLevel() && theEvent.type == NSLeftMouseDown) { - pw->m_forwardWindow.clear(); - } - } - if (theEvent.type == NSLeftMouseDown) { self.grabbingMouse = YES; } else if (theEvent.type == NSLeftMouseUp) { @@ -157,7 +141,8 @@ static bool isMouseEvent(NSEvent *ev) if (!self.platformWindow) return; // Platform window went away while processing event - if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { + QCocoaWindow *pw = self.platformWindow; + if (pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) { NSPoint loc = [theEvent locationInWindow]; NSRect windowFrame = [self.window convertRectFromScreen:[self.window frame]]; NSRect contentFrame = [[self.window contentView] frame]; @@ -217,10 +202,8 @@ static const bool kNoDefer = NO; - (BOOL)canBecomeKeyWindow { - // Prevent child NSWindows from becoming the key window in - // order keep the active apperance of the top-level window. QCocoaWindow *pw = self.helper.platformWindow; - if (!pw || !pw->window()->isTopLevel()) + if (!pw) return NO; if (pw->shouldRefuseKeyWindowAndFirstResponder()) @@ -239,7 +222,7 @@ static const bool kNoDefer = NO; // Windows with a transient parent (such as combobox popup windows) // cannot become the main window: QCocoaWindow *pw = self.helper.platformWindow; - if (!pw || !pw->window()->isTopLevel() || pw->window()->transientParent()) + if (!pw || pw->window()->transientParent()) canBecomeMain = NO; return canBecomeMain; |