diff --git a/dlls/user/defwnd.c b/dlls/user/defwnd.c index c0a1f24662d..a2f282e8aea 100644 --- a/dlls/user/defwnd.c +++ b/dlls/user/defwnd.c @@ -580,11 +580,24 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa case WM_SHOWWINDOW: { LONG style = GetWindowLongW( hwnd, GWL_STYLE ); + WND *pWnd; if (!lParam) return 0; /* sent from ShowWindow */ - if (!(style & WS_POPUP)) return 0; if ((style & WS_VISIBLE) && wParam) return 0; if (!(style & WS_VISIBLE) && !wParam) return 0; if (!GetWindow( hwnd, GW_OWNER )) return 0; + if (!(pWnd = WIN_GetPtr( hwnd ))) return 0; + if (pWnd == WND_OTHER_PROCESS) return 0; + if (wParam) + { + if (!(pWnd->flags & WIN_NEEDS_SHOW_OWNEDPOPUP)) + { + WIN_ReleasePtr( pWnd ); + return 0; + } + pWnd->flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP; + } + else pWnd->flags |= WIN_NEEDS_SHOW_OWNEDPOPUP; + WIN_ReleasePtr( pWnd ); ShowWindow( hwnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE ); break; } diff --git a/dlls/user/win.c b/dlls/user/win.c index 050b72fcd1b..4e3f6c1a62e 100644 --- a/dlls/user/win.c +++ b/dlls/user/win.c @@ -2686,36 +2686,30 @@ BOOL WINAPI ShowOwnedPopups( HWND owner, BOOL fShow ) if (GetWindow( win_array[count], GW_OWNER ) != owner) continue; if (!(pWnd = WIN_GetPtr( win_array[count] ))) continue; if (pWnd == WND_OTHER_PROCESS) continue; - - if (pWnd->dwStyle & WS_POPUP) + if (fShow) { - if (fShow) + if (pWnd->flags & WIN_NEEDS_SHOW_OWNEDPOPUP) { - if (pWnd->flags & WIN_NEEDS_SHOW_OWNEDPOPUP) - { - pWnd->flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP; - WIN_ReleasePtr( pWnd ); - /* In Windows, ShowOwnedPopups(TRUE) generates - * WM_SHOWWINDOW messages with SW_PARENTOPENING, - * regardless of the state of the owner - */ - SendMessageW(win_array[count], WM_SHOWWINDOW, SW_SHOW, SW_PARENTOPENING); - continue; - } + WIN_ReleasePtr( pWnd ); + /* In Windows, ShowOwnedPopups(TRUE) generates + * WM_SHOWWINDOW messages with SW_PARENTOPENING, + * regardless of the state of the owner + */ + SendMessageW(win_array[count], WM_SHOWWINDOW, SW_SHOWNORMAL, SW_PARENTOPENING); + continue; } - else + } + else + { + if (pWnd->dwStyle & WS_VISIBLE) { - if (pWnd->dwStyle & WS_VISIBLE) - { - pWnd->flags |= WIN_NEEDS_SHOW_OWNEDPOPUP; - WIN_ReleasePtr( pWnd ); - /* In Windows, ShowOwnedPopups(FALSE) generates - * WM_SHOWWINDOW messages with SW_PARENTCLOSING, - * regardless of the state of the owner - */ - SendMessageW(win_array[count], WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING); - continue; - } + WIN_ReleasePtr( pWnd ); + /* In Windows, ShowOwnedPopups(FALSE) generates + * WM_SHOWWINDOW messages with SW_PARENTCLOSING, + * regardless of the state of the owner + */ + SendMessageW(win_array[count], WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING); + continue; } } WIN_ReleasePtr( pWnd );