diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-07-06 17:40:40 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-07-08 10:50:33 +0000 |
commit | 573c81da9b031aaf16cda6c3fb69a9adac8d80c6 (patch) | |
tree | f91ad75b958484396e4337c6d9156a4f473496f5 /src/plugins/platforms | |
parent | 23e20e4030aee001ec24301cf5c7ff0a6cd2bc16 (diff) |
macOS: Merge the two QNSView initializers
We never call [QNSView init] directly, so there's no point in splitting
up the logic.
Change-Id: Ie40705a3a78c0d732a3f3378c6e8fa76dc6c68e7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 0db007ccd7..52ae3ae1ec 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -141,9 +141,10 @@ bool m_updateRequested; } -- (instancetype)init +- (instancetype)initWithCocoaWindow:(QCocoaWindow *)platformWindow { if ((self = [super initWithFrame:NSZeroRect])) { + m_platformWindow = platformWindow; m_buttons = Qt::NoButton; m_acceptedMouseDowns = Qt::NoButton; m_frameStrutButtons = Qt::NoButton; @@ -153,7 +154,6 @@ m_shouldSetGLContextinDrawRect = false; #endif currentCustomDragTypes = nullptr; - m_dontOverrideCtrlLMB = false; m_sendUpAsRightButton = false; m_inputSource = nil; m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self]; @@ -161,36 +161,14 @@ m_scrolling = false; m_updatingDrag = false; m_currentlyInterpretedKeyEvent = nil; - self.focusRingType = NSFocusRingTypeNone; - self.cursor = nil; m_updateRequested = false; - } - return self; -} - -- (void)dealloc -{ - if (m_trackingArea) { - [self removeTrackingArea:m_trackingArea]; - [m_trackingArea release]; - } - [m_inputSource release]; - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [m_mouseMoveHelper release]; - - delete currentCustomDragTypes; - - [super dealloc]; -} + m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, platformWindow->window(), + "_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB"); + m_trackingArea = nil; -- (instancetype)initWithCocoaWindow:(QCocoaWindow *)platformWindow -{ - if ((self = [self init])) { - m_platformWindow = platformWindow; + self.focusRingType = NSFocusRingTypeNone; + self.cursor = nil; self.wantsLayer = [self wantsLayerHelper]; - m_sendKeyEvent = false; - m_dontOverrideCtrlLMB = qt_mac_resolveOption(false, platformWindow->window(), "_q_platform_MacDontOverrideCtrlLMB", "QT_MAC_DONT_OVERRIDE_CTRL_LMB"); - m_trackingArea = nil; // Enable high-DPI OpenGL for retina displays. Enabling has the side // effect that Cocoa will start calling glViewport(0, 0, width, height), @@ -225,10 +203,24 @@ name:NSTextInputContextKeyboardSelectionDidChangeNotification object:nil]; } - return self; } +- (void)dealloc +{ + if (m_trackingArea) { + [self removeTrackingArea:m_trackingArea]; + [m_trackingArea release]; + } + [m_inputSource release]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [m_mouseMoveHelper release]; + + delete currentCustomDragTypes; + + [super dealloc]; +} + - (NSString *)description { NSMutableString *description = [NSMutableString stringWithString:[super description]]; |