path: root/src/plugins/platforms/cocoa/qnswindowdelegate.h
diff options
authorTor Arne Vestbø <>2016-10-13 14:49:01 +0200
committerTor Arne Vestbø <>2016-10-27 13:08:24 +0000
commit7f507c16202003e834863b8f26213c5e1c06fd0e (patch)
tree8702dbe9524ada5b6617714e4f297fe77e25a129 /src/plugins/platforms/cocoa/qnswindowdelegate.h
parentd04207342ea4d22e42257eb0adc1048fd2e068b4 (diff)
macOS: Decouple NSWindow notifications and delegate callbacks from QNSView
The logic for handling NSWindow events was split partly between QNSView observing notifications, and QNSWindowDelegate implementing direct delegate callbacks. The logic of how to handle the events was then split further by sometimes handling the event in the delegate callback or notification handler, and sometimes forwarding the event to QCocoaWindow. We now handle most events via notifications, and propagate these directly to QCocoaWindow, so that all the logic is in one place. This improves the situation for foreign windows, since we're not relying on having a QNSView, or being able to inject our QNSWindowDelegate. To keep code duplication to a minimum and risking missing a notification in the forwarding logic, the logic is based on QMetatType and QMetaMethod tags, so that the notifications are declared in the header file, along with the handler function. Change-Id: I2fb6372010048a8a1f6e4426b988a3f6f5abdbab Reviewed-by: Erik Verbruggen <> Reviewed-by: Morten Johan Sørvig <>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnswindowdelegate.h')
1 files changed, 1 insertions, 6 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h
index 46e8d40efb..667e08d0c1 100644
--- a/src/plugins/platforms/cocoa/qnswindowdelegate.h
+++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h
@@ -49,15 +49,10 @@
QCocoaWindow *m_cocoaWindow;
-- (id)initWithQCocoaWindow: (QCocoaWindow *) cocoaWindow;
+- (id)initWithQCocoaWindow:(QCocoaWindow *)cocoaWindow;
-- (void)windowDidBecomeKey:(NSNotification *)notification;
-- (void)windowDidResize:(NSNotification *)notification;
-- (void)windowDidMove:(NSNotification *)notification;
-- (void)windowWillMove:(NSNotification *)notification;
- (BOOL)windowShouldClose:(NSNotification *)notification;
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
-- (void)windowWillClose:(NSNotification *)notification;