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.
This commit is contained in:
Ken Thomases 2013-10-08 02:21:24 -05:00 committed by Alexandre Julliard
parent 0e8e45cf99
commit dd59ab26fe
3 changed files with 22 additions and 16 deletions

View File

@ -685,23 +685,26 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
}
[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

View File

@ -362,6 +362,7 @@ extern int macdrv_register_hot_key(macdrv_event_queue q, unsigned int vkey, unsi
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,

View File

@ -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;
}