Cocoa: Update window state when maximizing from the title bar
There's no NSWindow notification we can listen to, but we can override behavior from its delegate. Change-Id: I61cebf4119f83c770fe4e7f45ff0d4e8bf9d0df9 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
This commit is contained in:
parent
7ee15bfbb8
commit
b8c007ede0
@ -82,6 +82,7 @@ QT_END_NAMESPACE
|
||||
- (void)drawRect:(NSRect)dirtyRect;
|
||||
- (void)updateGeometry;
|
||||
- (void)windowNotification : (NSNotification *) windowNotification;
|
||||
- (void)notifyWindowWillZoom:(BOOL)willZoom;
|
||||
- (void)viewDidHide;
|
||||
- (void)viewDidUnhide;
|
||||
|
||||
|
@ -306,6 +306,16 @@ static QTouchDevice *touchDevice = 0;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notifyWindowWillZoom:(BOOL)willZoom
|
||||
{
|
||||
Qt::WindowState newState = willZoom ? Qt::WindowMaximized : Qt::WindowNoState;
|
||||
QWindowSystemInterface::handleWindowStateChanged(m_window, newState);
|
||||
// We want to read the window state back from the window,
|
||||
// but the event we just sent may be asynchronous.
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
m_platformWindow->setSynchedWindowStateFromWindow();
|
||||
}
|
||||
|
||||
- (void)viewDidHide
|
||||
{
|
||||
m_platformWindow->obscureWindow();
|
||||
|
@ -57,6 +57,7 @@
|
||||
- (void)windowDidMove:(NSNotification *)notification;
|
||||
- (void)windowWillMove:(NSNotification *)notification;
|
||||
- (BOOL)windowShouldClose:(NSNotification *)notification;
|
||||
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -90,4 +90,12 @@
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame
|
||||
{
|
||||
Q_UNUSED(newFrame);
|
||||
if (m_cocoaWindow && m_cocoaWindow->m_qtView)
|
||||
[m_cocoaWindow->m_qtView notifyWindowWillZoom:![window isZoomed]];
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user