quartz: remove maximized state when the window position/size is changed

So a window can be maximized/zoomed again after being moved away from
its maximized position. This makes the zoom button on non-CSD windows
work as before.
This commit is contained in:
Christoph Reiter
2015-07-20 10:40:35 +02:00
committed by Christoph Reiter
parent eb37fd22e7
commit 7ed5816829
2 changed files with 30 additions and 0 deletions

View File

@ -178,6 +178,17 @@
GdkWindow *window = [[self contentView] gdkWindow]; GdkWindow *window = [[self contentView] gdkWindow];
GdkEvent *event; GdkEvent *event;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gboolean maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
/* In case the window is changed when maximized remove the maximized state */
if (maximized && !inMaximizeTransition && !NSEqualRects (lastMaximizedFrame, [self frame]))
{
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED,
0);
}
_gdk_quartz_window_update_position (window); _gdk_quartz_window_update_position (window);
/* Synthesize a configure event */ /* Synthesize a configure event */
@ -198,6 +209,16 @@
NSRect content_rect = [self contentRectForFrameRect:[self frame]]; NSRect content_rect = [self contentRectForFrameRect:[self frame]];
GdkWindow *window = [[self contentView] gdkWindow]; GdkWindow *window = [[self contentView] gdkWindow];
GdkEvent *event; GdkEvent *event;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gboolean maximized = gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED;
/* see same in windowDidMove */
if (maximized && !inMaximizeTransition && !NSEqualRects (lastMaximizedFrame, [self frame]))
{
gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED,
0);
}
window->width = content_rect.size.width; window->width = content_rect.size.width;
window->height = content_rect.size.height; window->height = content_rect.size.height;
@ -713,6 +734,7 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
if (maximized) if (maximized)
{ {
lastMaximizedFrame = newFrame;
gdk_synthesize_window_state (window, gdk_synthesize_window_state (window,
GDK_WINDOW_STATE_MAXIMIZED, GDK_WINDOW_STATE_MAXIMIZED,
0); 0);
@ -725,7 +747,13 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
GDK_WINDOW_STATE_MAXIMIZED); GDK_WINDOW_STATE_MAXIMIZED);
} }
inMaximizeTransition = YES;
return YES; return YES;
} }
-(void)windowDidEndLiveResize:(NSNotification *)aNotification
{
inMaximizeTransition = NO;
}
@end @end

View File

@ -34,6 +34,8 @@
NSRect initialResizeFrame; NSRect initialResizeFrame;
NSRect lastUnmaximizedFrame; NSRect lastUnmaximizedFrame;
NSRect lastMaximizedFrame;
BOOL inMaximizeTransition;
} }
-(BOOL)isInMove; -(BOOL)isInMove;