mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 12:28:59 +00:00
Avoid a few more uses of WIN_FindWndPtr.
This commit is contained in:
parent
611bcf8557
commit
e4e5566edb
|
@ -2788,7 +2788,8 @@ BOOL WINAPI ShowOwnedPopups( HWND owner, BOOL fShow )
|
|||
while (--count >= 0)
|
||||
{
|
||||
if (GetWindow( win_array[count], GW_OWNER ) != owner) continue;
|
||||
if (!(pWnd = WIN_FindWndPtr( win_array[count] ))) continue;
|
||||
if (!(pWnd = WIN_GetPtr( win_array[count] ))) continue;
|
||||
if (pWnd == WND_OTHER_PROCESS) continue;
|
||||
|
||||
if (pWnd->dwStyle & WS_POPUP)
|
||||
{
|
||||
|
@ -2796,28 +2797,32 @@ BOOL WINAPI ShowOwnedPopups( HWND owner, BOOL fShow )
|
|||
{
|
||||
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
|
||||
*/
|
||||
SendMessageA(pWnd->hwndSelf, WM_SHOWWINDOW, SW_SHOW, SW_PARENTOPENING);
|
||||
pWnd->flags &= ~WIN_NEEDS_SHOW_OWNEDPOPUP;
|
||||
SendMessageW(win_array[count], WM_SHOWWINDOW, SW_SHOW, SW_PARENTOPENING);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsWindowVisible(pWnd->hwndSelf))
|
||||
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
|
||||
*/
|
||||
SendMessageA(pWnd->hwndSelf, WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING);
|
||||
pWnd->flags |= WIN_NEEDS_SHOW_OWNEDPOPUP;
|
||||
SendMessageW(win_array[count], WM_SHOWWINDOW, SW_HIDE, SW_PARENTCLOSING);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
WIN_ReleaseWndPtr( pWnd );
|
||||
WIN_ReleasePtr( pWnd );
|
||||
}
|
||||
HeapFree( GetProcessHeap(), 0, win_array );
|
||||
return TRUE;
|
||||
|
@ -3053,16 +3058,16 @@ BOOL WINAPI AnyPopup(void)
|
|||
*/
|
||||
BOOL WINAPI FlashWindow( HWND hWnd, BOOL bInvert )
|
||||
{
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
WND *wndPtr;
|
||||
|
||||
TRACE("%p\n", hWnd);
|
||||
|
||||
if (!wndPtr) return FALSE;
|
||||
hWnd = wndPtr->hwndSelf; /* make it a full handle */
|
||||
|
||||
if (wndPtr->dwStyle & WS_MINIMIZE)
|
||||
if (IsIconic( hWnd ))
|
||||
{
|
||||
RedrawWindow( hWnd, 0, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_FRAME );
|
||||
|
||||
wndPtr = WIN_GetPtr(hWnd);
|
||||
if (!wndPtr || wndPtr == WND_OTHER_PROCESS) return FALSE;
|
||||
if (bInvert && !(wndPtr->flags & WIN_NCACTIVATED))
|
||||
{
|
||||
wndPtr->flags |= WIN_NCACTIVATED;
|
||||
|
@ -3071,16 +3076,21 @@ BOOL WINAPI FlashWindow( HWND hWnd, BOOL bInvert )
|
|||
{
|
||||
wndPtr->flags &= ~WIN_NCACTIVATED;
|
||||
}
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
WIN_ReleasePtr( wndPtr );
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
WPARAM16 wparam;
|
||||
WPARAM wparam;
|
||||
|
||||
wndPtr = WIN_GetPtr(hWnd);
|
||||
if (!wndPtr || wndPtr == WND_OTHER_PROCESS) return FALSE;
|
||||
hWnd = wndPtr->hwndSelf; /* make it a full handle */
|
||||
|
||||
if (bInvert) wparam = !(wndPtr->flags & WIN_NCACTIVATED);
|
||||
else wparam = (hWnd == GetForegroundWindow());
|
||||
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
WIN_ReleasePtr( wndPtr );
|
||||
SendMessageW( hWnd, WM_NCACTIVATE, wparam, (LPARAM)0 );
|
||||
return wparam;
|
||||
}
|
||||
|
|
114
windows/winpos.c
114
windows/winpos.c
|
@ -928,59 +928,71 @@ BOOL WINAPI GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
|
|||
*/
|
||||
static BOOL WINPOS_SetPlacement( HWND hwnd, const WINDOWPLACEMENT *wndpl, UINT flags )
|
||||
{
|
||||
WND *pWnd = WIN_FindWndPtr( hwnd );
|
||||
if( pWnd )
|
||||
LPINTERNALPOS lpPos;
|
||||
DWORD style;
|
||||
WND *pWnd = WIN_GetPtr( hwnd );
|
||||
|
||||
if (!pWnd || pWnd == WND_OTHER_PROCESS) return FALSE;
|
||||
lpPos = WINPOS_InitInternalPos( pWnd );
|
||||
|
||||
if( flags & PLACE_MIN )
|
||||
{
|
||||
LPINTERNALPOS lpPos = WINPOS_InitInternalPos( pWnd );
|
||||
|
||||
if( flags & PLACE_MIN )
|
||||
{
|
||||
lpPos->ptIconPos.x = wndpl->ptMinPosition.x;
|
||||
lpPos->ptIconPos.y = wndpl->ptMinPosition.y;
|
||||
}
|
||||
if( flags & PLACE_MAX )
|
||||
{
|
||||
lpPos->ptMaxPos.x = wndpl->ptMaxPosition.x;
|
||||
lpPos->ptMaxPos.y = wndpl->ptMaxPosition.y;
|
||||
}
|
||||
if( flags & PLACE_RECT)
|
||||
{
|
||||
lpPos->rectNormal.left = wndpl->rcNormalPosition.left;
|
||||
lpPos->rectNormal.top = wndpl->rcNormalPosition.top;
|
||||
lpPos->rectNormal.right = wndpl->rcNormalPosition.right;
|
||||
lpPos->rectNormal.bottom = wndpl->rcNormalPosition.bottom;
|
||||
}
|
||||
if( pWnd->dwStyle & WS_MINIMIZE )
|
||||
{
|
||||
WINPOS_ShowIconTitle( pWnd->hwndSelf, FALSE );
|
||||
if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
|
||||
SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
|
||||
0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
||||
}
|
||||
else if( pWnd->dwStyle & WS_MAXIMIZE )
|
||||
{
|
||||
if( !EMPTYPOINT(lpPos->ptMaxPos) )
|
||||
SetWindowPos( hwnd, 0, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
|
||||
0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
||||
}
|
||||
else if( flags & PLACE_RECT )
|
||||
SetWindowPos( hwnd, 0, lpPos->rectNormal.left, lpPos->rectNormal.top,
|
||||
lpPos->rectNormal.right - lpPos->rectNormal.left,
|
||||
lpPos->rectNormal.bottom - lpPos->rectNormal.top,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE );
|
||||
|
||||
ShowWindow( hwnd, wndpl->showCmd );
|
||||
if( IsWindow(hwnd) && pWnd->dwStyle & WS_MINIMIZE )
|
||||
{
|
||||
if( pWnd->dwStyle & WS_VISIBLE ) WINPOS_ShowIconTitle( pWnd->hwndSelf, TRUE );
|
||||
|
||||
/* SDK: ...valid only the next time... */
|
||||
if( wndpl->flags & WPF_RESTORETOMAXIMIZED ) pWnd->flags |= WIN_RESTORE_MAX;
|
||||
}
|
||||
WIN_ReleaseWndPtr(pWnd);
|
||||
return TRUE;
|
||||
lpPos->ptIconPos.x = wndpl->ptMinPosition.x;
|
||||
lpPos->ptIconPos.y = wndpl->ptMinPosition.y;
|
||||
}
|
||||
return FALSE;
|
||||
if( flags & PLACE_MAX )
|
||||
{
|
||||
lpPos->ptMaxPos.x = wndpl->ptMaxPosition.x;
|
||||
lpPos->ptMaxPos.y = wndpl->ptMaxPosition.y;
|
||||
}
|
||||
if( flags & PLACE_RECT)
|
||||
{
|
||||
lpPos->rectNormal.left = wndpl->rcNormalPosition.left;
|
||||
lpPos->rectNormal.top = wndpl->rcNormalPosition.top;
|
||||
lpPos->rectNormal.right = wndpl->rcNormalPosition.right;
|
||||
lpPos->rectNormal.bottom = wndpl->rcNormalPosition.bottom;
|
||||
}
|
||||
|
||||
style = pWnd->dwStyle;
|
||||
WIN_ReleasePtr( pWnd );
|
||||
|
||||
if( style & WS_MINIMIZE )
|
||||
{
|
||||
WINPOS_ShowIconTitle( hwnd, FALSE );
|
||||
if( wndpl->flags & WPF_SETMINPOSITION && !EMPTYPOINT(lpPos->ptIconPos))
|
||||
SetWindowPos( hwnd, 0, lpPos->ptIconPos.x, lpPos->ptIconPos.y,
|
||||
0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
||||
}
|
||||
else if( style & WS_MAXIMIZE )
|
||||
{
|
||||
if( !EMPTYPOINT(lpPos->ptMaxPos) )
|
||||
SetWindowPos( hwnd, 0, lpPos->ptMaxPos.x, lpPos->ptMaxPos.y,
|
||||
0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE );
|
||||
}
|
||||
else if( flags & PLACE_RECT )
|
||||
SetWindowPos( hwnd, 0, lpPos->rectNormal.left, lpPos->rectNormal.top,
|
||||
lpPos->rectNormal.right - lpPos->rectNormal.left,
|
||||
lpPos->rectNormal.bottom - lpPos->rectNormal.top,
|
||||
SWP_NOZORDER | SWP_NOACTIVATE );
|
||||
|
||||
ShowWindow( hwnd, wndpl->showCmd );
|
||||
|
||||
if (IsIconic( hwnd ))
|
||||
{
|
||||
if (GetWindowLongW( hwnd, GWL_STYLE ) & WS_VISIBLE) WINPOS_ShowIconTitle( hwnd, TRUE );
|
||||
|
||||
/* SDK: ...valid only the next time... */
|
||||
if( wndpl->flags & WPF_RESTORETOMAXIMIZED )
|
||||
{
|
||||
pWnd = WIN_GetPtr( hwnd );
|
||||
if (pWnd && pWnd != WND_OTHER_PROCESS)
|
||||
{
|
||||
pWnd->flags |= WIN_RESTORE_MAX;
|
||||
WIN_ReleasePtr( pWnd );
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue