Commit 225482f5 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Make show_window() and hide_window() tolerate being called when there's no Cocoa window.

Minor no-op refactoring that makes subsequent commits cleaner. Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent eef99122
...@@ -731,40 +731,43 @@ static struct macdrv_win_data *macdrv_create_win_data(HWND hwnd, const RECT *win ...@@ -731,40 +731,43 @@ static struct macdrv_win_data *macdrv_create_win_data(HWND hwnd, const RECT *win
*/ */
static void show_window(struct macdrv_win_data *data) static void show_window(struct macdrv_win_data *data)
{ {
HWND prev = NULL; if (data->cocoa_window)
HWND next = NULL; {
macdrv_window prev_window = NULL; HWND prev = NULL;
macdrv_window next_window = NULL; HWND next = NULL;
BOOL activate = FALSE; macdrv_window prev_window = NULL;
HWND hwndFocus; macdrv_window next_window = NULL;
BOOL activate = FALSE;
/* find window that this one must be after */ HWND hwndFocus;
prev = GetWindow(data->hwnd, GW_HWNDPREV);
while (prev && !((GetWindowLongW(prev, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE && /* find window that this one must be after */
(prev_window = macdrv_get_cocoa_window(prev, TRUE)))) prev = GetWindow(data->hwnd, GW_HWNDPREV);
prev = GetWindow(prev, GW_HWNDPREV); while (prev && !((GetWindowLongW(prev, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE &&
if (!prev_window) (prev_window = macdrv_get_cocoa_window(prev, TRUE))))
{ prev = GetWindow(prev, GW_HWNDPREV);
/* find window that this one must be before */ if (!prev_window)
next = GetWindow(data->hwnd, GW_HWNDNEXT); {
while (next && !((GetWindowLongW(next, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE && /* find window that this one must be before */
(next_window = macdrv_get_cocoa_window(next, TRUE)))) next = GetWindow(data->hwnd, GW_HWNDNEXT);
next = GetWindow(next, GW_HWNDNEXT); while (next && !((GetWindowLongW(next, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE &&
} (next_window = macdrv_get_cocoa_window(next, TRUE))))
next = GetWindow(next, GW_HWNDNEXT);
TRACE("win %p/%p below %p/%p above %p/%p\n", }
data->hwnd, data->cocoa_window, prev, prev_window, next, next_window);
TRACE("win %p/%p below %p/%p above %p/%p\n",
if (!prev_window) data->hwnd, data->cocoa_window, prev, prev_window, next, next_window);
activate = activate_on_focus_time && (GetTickCount() - activate_on_focus_time < 2000);
macdrv_order_cocoa_window(data->cocoa_window, prev_window, next_window, activate); if (!prev_window)
data->on_screen = TRUE; activate = activate_on_focus_time && (GetTickCount() - activate_on_focus_time < 2000);
macdrv_order_cocoa_window(data->cocoa_window, prev_window, next_window, activate);
hwndFocus = GetFocus(); data->on_screen = TRUE;
if (hwndFocus && (data->hwnd == hwndFocus || IsChild(data->hwnd, hwndFocus)))
macdrv_SetFocus(hwndFocus); hwndFocus = GetFocus();
if (activate) if (hwndFocus && (data->hwnd == hwndFocus || IsChild(data->hwnd, hwndFocus)))
activate_on_focus_time = 0; macdrv_SetFocus(hwndFocus);
if (activate)
activate_on_focus_time = 0;
}
} }
...@@ -775,7 +778,8 @@ static void hide_window(struct macdrv_win_data *data) ...@@ -775,7 +778,8 @@ static void hide_window(struct macdrv_win_data *data)
{ {
TRACE("win %p/%p\n", data->hwnd, data->cocoa_window); TRACE("win %p/%p\n", data->hwnd, data->cocoa_window);
macdrv_hide_cocoa_window(data->cocoa_window); if (data->cocoa_window)
macdrv_hide_cocoa_window(data->cocoa_window);
data->on_screen = FALSE; data->on_screen = FALSE;
} }
......
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