Commit dd59ab26 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Only update window minimized state when it has changed from what…

winemac: Only update window minimized state when it has changed from what processed events told us it was. This fixes a problem where windows could spontaneously re-minimize after being unminimized. Cocoa would see the window unminimize. It would queue a WINDOW_DID_UNMINIMIZE event. While that event was pending, Wine might do something which caused set_cocoa_window_properties() to be called and tell Cocoa to conform itself to the current Win32 state. The current Win32 state still had the window minimized, so Cocoa would re-minimize the window. It would even discard the WINDOW_DID_UNMINIMIZE event.
parent 0e8e45cf
......@@ -685,23 +685,26 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
}
[self setCollectionBehavior:behavior];
pendingMinimize = FALSE;
if (state->minimized && ![self isMiniaturized])
if (state->minimized_valid)
{
if ([self isVisible])
[super miniaturize:nil];
else
pendingMinimize = TRUE;
}
else if (!state->minimized && [self isMiniaturized])
{
ignore_windowDeminiaturize = TRUE;
[self deminiaturize:nil];
}
pendingMinimize = FALSE;
if (state->minimized && ![self isMiniaturized])
{
if ([self isVisible])
[super miniaturize:nil];
else
pendingMinimize = TRUE;
}
else if (!state->minimized && [self isMiniaturized])
{
ignore_windowDeminiaturize = TRUE;
[self deminiaturize:nil];
}
/* Whatever events regarding minimization might have been in the queue are now stale. */
[queue discardEventsMatchingMask:event_mask_for_type(WINDOW_DID_UNMINIMIZE)
forWindow:self];
/* Whatever events regarding minimization might have been in the queue are now stale. */
[queue discardEventsMatchingMask:event_mask_for_type(WINDOW_DID_UNMINIMIZE)
forWindow:self];
}
}
- (BOOL) addChildWineWindow:(WineWindow*)child assumeVisible:(BOOL)assumeVisible
......
......@@ -362,6 +362,7 @@ struct macdrv_window_state {
unsigned int excluded_by_expose:1;
unsigned int excluded_by_cycle:1;
unsigned int minimized:1;
unsigned int minimized_valid:1;
};
extern macdrv_window macdrv_create_cocoa_window(const struct macdrv_window_features* wf,
......
......@@ -115,6 +115,7 @@ static void get_cocoa_window_state(struct macdrv_win_data *data,
if (IsRectEmpty(&data->window_rect))
state->excluded_by_expose = TRUE;
state->minimized = (style & WS_MINIMIZE) != 0;
state->minimized_valid = state->minimized != data->minimized;
}
......@@ -312,7 +313,8 @@ static void set_cocoa_window_properties(struct macdrv_win_data *data)
get_cocoa_window_state(data, style, ex_style, &state);
macdrv_set_cocoa_window_state(data->cocoa_window, &state);
data->minimized = state.minimized;
if (state.minimized_valid)
data->minimized = state.minimized;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment