From abb0161c4c06be5e8606811cf51d89ac8950cf00 Mon Sep 17 00:00:00 2001 From: Ken Thomases Date: Mon, 18 Feb 2013 21:50:19 -0600 Subject: [PATCH] winemac: Always use proper z-order when putting a window on screen. --- dlls/winemac.drv/window.c | 103 ++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index c7513f03db9..e7ec6c5b4b6 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -150,35 +150,6 @@ static void get_mac_rect_offset(struct macdrv_win_data *data, DWORD style, RECT } -/*********************************************************************** - * show_window - */ -static void show_window(struct macdrv_win_data *data) -{ - TRACE("win %p/%p\n", data->hwnd, data->cocoa_window); - - data->on_screen = macdrv_order_cocoa_window(data->cocoa_window, NULL, NULL); - if (data->on_screen) - { - HWND hwndFocus = GetFocus(); - if (hwndFocus && (data->hwnd == hwndFocus || IsChild(data->hwnd, hwndFocus))) - macdrv_SetFocus(hwndFocus); - } -} - - -/*********************************************************************** - * hide_window - */ -static void hide_window(struct macdrv_win_data *data) -{ - TRACE("win %p/%p\n", data->hwnd, data->cocoa_window); - - macdrv_hide_cocoa_window(data->cocoa_window); - data->on_screen = FALSE; -} - - /*********************************************************************** * macdrv_window_to_mac_rect * @@ -604,6 +575,55 @@ static struct macdrv_win_data *macdrv_create_win_data(HWND hwnd, const RECT *win } +/*********************************************************************** + * show_window + */ +static void show_window(struct macdrv_win_data *data) +{ + HWND prev = NULL; + HWND next = NULL; + macdrv_window prev_window = NULL; + macdrv_window next_window = NULL; + + /* find window that this one must be after */ + prev = GetWindow(data->hwnd, GW_HWNDPREV); + while (prev && !((GetWindowLongW(prev, GWL_STYLE) & WS_VISIBLE) && + (prev_window = macdrv_get_cocoa_window(prev, TRUE)))) + prev = GetWindow(prev, GW_HWNDPREV); + if (!prev_window) + { + /* find window that this one must be before */ + next = GetWindow(data->hwnd, GW_HWNDNEXT); + while (next && !((GetWindowLongW(next, GWL_STYLE) & 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); + + data->on_screen = macdrv_order_cocoa_window(data->cocoa_window, prev_window, next_window); + if (data->on_screen) + { + HWND hwndFocus = GetFocus(); + if (hwndFocus && (data->hwnd == hwndFocus || IsChild(data->hwnd, hwndFocus))) + macdrv_SetFocus(hwndFocus); + } +} + + +/*********************************************************************** + * hide_window + */ +static void hide_window(struct macdrv_win_data *data) +{ + TRACE("win %p/%p\n", data->hwnd, data->cocoa_window); + + macdrv_hide_cocoa_window(data->cocoa_window); + data->on_screen = FALSE; +} + + /*********************************************************************** * get_region_data * @@ -692,30 +712,7 @@ static void sync_window_position(struct macdrv_win_data *data, UINT swp_flags) wine_dbgstr_rect(&data->whole_rect)); if (data->on_screen && (!(swp_flags & SWP_NOZORDER) || (swp_flags & SWP_SHOWWINDOW))) - { - HWND next = NULL; - macdrv_window prev_window = NULL; - macdrv_window next_window = NULL; - - /* find window that this one must be after */ - HWND prev = GetWindow(data->hwnd, GW_HWNDPREV); - while (prev && !((GetWindowLongW(prev, GWL_STYLE) & WS_VISIBLE) && - (prev_window = macdrv_get_cocoa_window(prev, TRUE)))) - prev = GetWindow(prev, GW_HWNDPREV); - if (!prev_window) - { - /* find window that this one must be before */ - next = GetWindow(data->hwnd, GW_HWNDNEXT); - while (next && !((GetWindowLongW(next, GWL_STYLE) & WS_VISIBLE) && - (next_window = macdrv_get_cocoa_window(next, TRUE)))) - next = GetWindow(next, GW_HWNDNEXT); - } - - data->on_screen = macdrv_order_cocoa_window(data->cocoa_window, prev_window, next_window); - - TRACE("win %p/%p below %p/%p above %p/%p\n", - data->hwnd, data->cocoa_window, prev, prev_window, next, next_window); - } + show_window(data); }