Window activation cleanups.
This commit is contained in:
parent
d7c4e4dd58
commit
03e07b56e3
|
@ -630,8 +630,7 @@ BOOL TTYDRV_SetWindowPos( WINDOWPOS *winpos )
|
|||
RDW_ERASENOW | RDW_NOCHILDREN );
|
||||
}
|
||||
|
||||
if (!(winpos->flags & SWP_NOACTIVATE))
|
||||
WINPOS_ChangeActiveWindow( winpos->hwnd, FALSE );
|
||||
if (!(winpos->flags & SWP_NOACTIVATE)) SetActiveWindow( winpos->hwnd );
|
||||
|
||||
/* And last, send the WM_WINDOWPOSCHANGED message */
|
||||
|
||||
|
|
|
@ -955,8 +955,7 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos )
|
|||
ShowCaret(winpos->hwnd);
|
||||
}
|
||||
|
||||
if (!(winpos->flags & SWP_NOACTIVATE))
|
||||
WINPOS_ChangeActiveWindow( winpos->hwnd, FALSE );
|
||||
if (!(winpos->flags & SWP_NOACTIVATE)) SetActiveWindow( winpos->hwnd );
|
||||
|
||||
/* And last, send the WM_WINDOWPOSCHANGED message */
|
||||
|
||||
|
|
|
@ -27,12 +27,11 @@ extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POIN
|
|||
POINT *maxTrack );
|
||||
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
|
||||
BOOL fChangeFocus );
|
||||
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
|
||||
extern LONG WINPOS_HandleWindowPosChanging16(HWND hwnd, struct tagWINDOWPOS16 *winpos);
|
||||
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos);
|
||||
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest );
|
||||
extern void WINPOS_CheckInternalPos( HWND hwnd );
|
||||
extern BOOL WINPOS_ActivateOtherWindow( HWND hwnd );
|
||||
extern void WINPOS_ActivateOtherWindow( HWND hwnd );
|
||||
extern BOOL WINPOS_CreateInternalPosAtom(void);
|
||||
|
||||
#endif /* __WINE_WINPOS_H */
|
||||
|
|
|
@ -517,6 +517,7 @@ static BOOL process_cooked_mouse_message( MSG *msg, ULONG_PTR extra_info, BOOL r
|
|||
eatMsg = TRUE;
|
||||
/* fall through */
|
||||
case MA_ACTIVATE:
|
||||
case 0:
|
||||
if (hwndTop != GetForegroundWindow() )
|
||||
{
|
||||
if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE ))
|
||||
|
|
|
@ -734,7 +734,7 @@ HWND WINAPI SetActiveWindow( HWND hwnd )
|
|||
prev = PERQDATA_GetActiveWnd( pMsgQ->pQData );
|
||||
QUEUE_Unlock( pMsgQ );
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
WINPOS_SetActiveWindow( hwnd, 0, 0 );
|
||||
WINPOS_SetActiveWindow( hwnd, FALSE, TRUE );
|
||||
return prev;
|
||||
|
||||
error:
|
||||
|
@ -768,7 +768,16 @@ HWND WINAPI GetForegroundWindow(void)
|
|||
*/
|
||||
BOOL WINAPI SetForegroundWindow( HWND hwnd )
|
||||
{
|
||||
return WINPOS_ChangeActiveWindow( hwnd, FALSE );
|
||||
if (!hwnd) return WINPOS_SetActiveWindow( 0, FALSE, TRUE );
|
||||
|
||||
/* child windows get WM_CHILDACTIVATE message */
|
||||
if ((GetWindowLongW( hwnd, GWL_STYLE ) & (WS_CHILD | WS_POPUP)) == WS_CHILD)
|
||||
return SendMessageA( hwnd, WM_CHILDACTIVATE, 0, 0 );
|
||||
|
||||
hwnd = WIN_GetFullHandle( hwnd );
|
||||
if( hwnd == GetForegroundWindow() ) return FALSE;
|
||||
|
||||
return WINPOS_SetActiveWindow( hwnd, FALSE, TRUE );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1422,9 +1431,8 @@ CLEANUP_END:
|
|||
*
|
||||
* Activates window other than pWnd.
|
||||
*/
|
||||
BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
|
||||
void WINPOS_ActivateOtherWindow(HWND hwnd)
|
||||
{
|
||||
BOOL bRet = 0;
|
||||
HWND hwndActive = 0;
|
||||
HWND hwndTo = 0;
|
||||
HWND owner;
|
||||
|
@ -1440,13 +1448,13 @@ BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
|
|||
}
|
||||
}
|
||||
|
||||
if (!(hwnd = WIN_IsCurrentThread( hwnd ))) return 0;
|
||||
if (!(hwnd = WIN_IsCurrentThread( hwnd ))) return;
|
||||
|
||||
if( hwnd == hwndPrevActive )
|
||||
hwndPrevActive = 0;
|
||||
|
||||
if( hwndActive != hwnd && (hwndActive || USER_IsExitingThread( GetCurrentThreadId() )))
|
||||
return 0;
|
||||
return;
|
||||
|
||||
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) ||
|
||||
!(owner = GetWindow( hwnd, GW_OWNER )) ||
|
||||
|
@ -1463,49 +1471,8 @@ BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
|
|||
}
|
||||
}
|
||||
|
||||
bRet = WINPOS_SetActiveWindow( hwndTo, FALSE, TRUE );
|
||||
|
||||
SetActiveWindow( hwndTo );
|
||||
hwndPrevActive = 0;
|
||||
return bRet;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* WINPOS_ChangeActiveWindow
|
||||
*
|
||||
*/
|
||||
BOOL WINPOS_ChangeActiveWindow( HWND hWnd, BOOL mouseMsg )
|
||||
{
|
||||
WND *wndPtr;
|
||||
HWND hwndActive = 0;
|
||||
|
||||
/* Get current active window from the active queue */
|
||||
if ( hActiveQueue )
|
||||
{
|
||||
MESSAGEQUEUE *pActiveQueue = QUEUE_Lock( hActiveQueue );
|
||||
if ( pActiveQueue )
|
||||
{
|
||||
hwndActive = PERQDATA_GetActiveWnd( pActiveQueue->pQData );
|
||||
QUEUE_Unlock( pActiveQueue );
|
||||
}
|
||||
}
|
||||
|
||||
if (!hWnd)
|
||||
return WINPOS_SetActiveWindow( 0, mouseMsg, TRUE );
|
||||
|
||||
if (!(wndPtr = WIN_FindWndPtr(hWnd))) return FALSE;
|
||||
hWnd = wndPtr->hwndSelf;
|
||||
|
||||
/* child windows get WM_CHILDACTIVATE message */
|
||||
if( (wndPtr->dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD )
|
||||
{
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
return SendMessageA(hWnd, WM_CHILDACTIVATE, 0, 0L);
|
||||
}
|
||||
WIN_ReleaseWndPtr(wndPtr);
|
||||
|
||||
if( hWnd == hwndActive ) return FALSE;
|
||||
|
||||
return WINPOS_SetActiveWindow(hWnd ,mouseMsg ,TRUE);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue