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 );
|
RDW_ERASENOW | RDW_NOCHILDREN );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(winpos->flags & SWP_NOACTIVATE))
|
if (!(winpos->flags & SWP_NOACTIVATE)) SetActiveWindow( winpos->hwnd );
|
||||||
WINPOS_ChangeActiveWindow( winpos->hwnd, FALSE );
|
|
||||||
|
|
||||||
/* And last, send the WM_WINDOWPOSCHANGED message */
|
/* And last, send the WM_WINDOWPOSCHANGED message */
|
||||||
|
|
||||||
|
|
|
@ -955,8 +955,7 @@ BOOL X11DRV_SetWindowPos( WINDOWPOS *winpos )
|
||||||
ShowCaret(winpos->hwnd);
|
ShowCaret(winpos->hwnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(winpos->flags & SWP_NOACTIVATE))
|
if (!(winpos->flags & SWP_NOACTIVATE)) SetActiveWindow( winpos->hwnd );
|
||||||
WINPOS_ChangeActiveWindow( winpos->hwnd, FALSE );
|
|
||||||
|
|
||||||
/* And last, send the WM_WINDOWPOSCHANGED message */
|
/* And last, send the WM_WINDOWPOSCHANGED message */
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,11 @@ extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, POIN
|
||||||
POINT *maxTrack );
|
POINT *maxTrack );
|
||||||
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
|
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse,
|
||||||
BOOL fChangeFocus );
|
BOOL fChangeFocus );
|
||||||
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
|
|
||||||
extern LONG WINPOS_HandleWindowPosChanging16(HWND hwnd, struct tagWINDOWPOS16 *winpos);
|
extern LONG WINPOS_HandleWindowPosChanging16(HWND hwnd, struct tagWINDOWPOS16 *winpos);
|
||||||
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos);
|
extern LONG WINPOS_HandleWindowPosChanging(HWND hwnd, WINDOWPOS *winpos);
|
||||||
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest );
|
extern HWND WINPOS_WindowFromPoint( HWND hwndScope, POINT pt, INT *hittest );
|
||||||
extern void WINPOS_CheckInternalPos( HWND hwnd );
|
extern void WINPOS_CheckInternalPos( HWND hwnd );
|
||||||
extern BOOL WINPOS_ActivateOtherWindow( HWND hwnd );
|
extern void WINPOS_ActivateOtherWindow( HWND hwnd );
|
||||||
extern BOOL WINPOS_CreateInternalPosAtom(void);
|
extern BOOL WINPOS_CreateInternalPosAtom(void);
|
||||||
|
|
||||||
#endif /* __WINE_WINPOS_H */
|
#endif /* __WINE_WINPOS_H */
|
||||||
|
|
|
@ -517,6 +517,7 @@ static BOOL process_cooked_mouse_message( MSG *msg, ULONG_PTR extra_info, BOOL r
|
||||||
eatMsg = TRUE;
|
eatMsg = TRUE;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case MA_ACTIVATE:
|
case MA_ACTIVATE:
|
||||||
|
case 0:
|
||||||
if (hwndTop != GetForegroundWindow() )
|
if (hwndTop != GetForegroundWindow() )
|
||||||
{
|
{
|
||||||
if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE ))
|
if (!WINPOS_SetActiveWindow( hwndTop, TRUE , TRUE ))
|
||||||
|
|
|
@ -734,7 +734,7 @@ HWND WINAPI SetActiveWindow( HWND hwnd )
|
||||||
prev = PERQDATA_GetActiveWnd( pMsgQ->pQData );
|
prev = PERQDATA_GetActiveWnd( pMsgQ->pQData );
|
||||||
QUEUE_Unlock( pMsgQ );
|
QUEUE_Unlock( pMsgQ );
|
||||||
WIN_ReleaseWndPtr(wndPtr);
|
WIN_ReleaseWndPtr(wndPtr);
|
||||||
WINPOS_SetActiveWindow( hwnd, 0, 0 );
|
WINPOS_SetActiveWindow( hwnd, FALSE, TRUE );
|
||||||
return prev;
|
return prev;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
@ -768,7 +768,16 @@ HWND WINAPI GetForegroundWindow(void)
|
||||||
*/
|
*/
|
||||||
BOOL WINAPI SetForegroundWindow( HWND hwnd )
|
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.
|
* Activates window other than pWnd.
|
||||||
*/
|
*/
|
||||||
BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
|
void WINPOS_ActivateOtherWindow(HWND hwnd)
|
||||||
{
|
{
|
||||||
BOOL bRet = 0;
|
|
||||||
HWND hwndActive = 0;
|
HWND hwndActive = 0;
|
||||||
HWND hwndTo = 0;
|
HWND hwndTo = 0;
|
||||||
HWND owner;
|
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 )
|
if( hwnd == hwndPrevActive )
|
||||||
hwndPrevActive = 0;
|
hwndPrevActive = 0;
|
||||||
|
|
||||||
if( hwndActive != hwnd && (hwndActive || USER_IsExitingThread( GetCurrentThreadId() )))
|
if( hwndActive != hwnd && (hwndActive || USER_IsExitingThread( GetCurrentThreadId() )))
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) ||
|
if (!(GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) ||
|
||||||
!(owner = GetWindow( hwnd, GW_OWNER )) ||
|
!(owner = GetWindow( hwnd, GW_OWNER )) ||
|
||||||
|
@ -1463,49 +1471,8 @@ BOOL WINPOS_ActivateOtherWindow(HWND hwnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bRet = WINPOS_SetActiveWindow( hwndTo, FALSE, TRUE );
|
SetActiveWindow( hwndTo );
|
||||||
|
|
||||||
hwndPrevActive = 0;
|
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