Kaydet (Commit) 081267eb authored tarafından Markus Mohrhard's avatar Markus Mohrhard

try to avoid the annoying focus stealing on windows

Change-Id: Ic6d3492a4707f24b616a7dee34a111ba0af4f281
Reviewed-on: https://gerrit.libreoffice.org/32207Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 9a017238
...@@ -827,6 +827,17 @@ static void ImplSalFrameFullScreenPos( WinSalFrame* pFrame, bool bAlways = FALSE ...@@ -827,6 +827,17 @@ static void ImplSalFrameFullScreenPos( WinSalFrame* pFrame, bool bAlways = FALSE
} }
} }
namespace {
void SetForegroundWindow_Impl(HWND hwnd)
{
static bool bUseForegroundWindow = !std::getenv("VCL_HIDE_WINDOWS");
if (bUseForegroundWindow)
SetForegroundWindow(hwnd);
}
}
WinSalFrame::WinSalFrame() WinSalFrame::WinSalFrame()
{ {
SalData* pSalData = GetSalData(); SalData* pSalData = GetSalData();
...@@ -1179,8 +1190,8 @@ static void ImplSalShow( HWND hWnd, bool bVisible, bool bNoActivate ) ...@@ -1179,8 +1190,8 @@ static void ImplSalShow( HWND hWnd, bool bVisible, bool bNoActivate )
{ {
HWND hWndParent = ::GetParent( hWnd ); HWND hWndParent = ::GetParent( hWnd );
if ( hWndParent ) if ( hWndParent )
SetForegroundWindow( hWndParent ); SetForegroundWindow_Impl( hWndParent );
SetForegroundWindow( hWnd ); SetForegroundWindow_Impl( hWnd );
} }
pFrame->mbInShow = FALSE; pFrame->mbInShow = FALSE;
...@@ -1977,7 +1988,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags ) ...@@ -1977,7 +1988,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
DWORD myThreadID = GetCurrentThreadId(); DWORD myThreadID = GetCurrentThreadId();
DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr); DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr);
AttachThreadInput(myThreadID, currThreadID,TRUE); AttachThreadInput(myThreadID, currThreadID,TRUE);
SetForegroundWindow(hWnd); SetForegroundWindow_Impl(hWnd);
AttachThreadInput(myThreadID,currThreadID,FALSE); AttachThreadInput(myThreadID,currThreadID,FALSE);
} }
...@@ -2011,7 +2022,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags ) ...@@ -2011,7 +2022,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
// Windows sometimes incorrectly reports to have the focus; // Windows sometimes incorrectly reports to have the focus;
// thus make sure to really get the focus // thus make sure to really get the focus
if ( ::GetFocus() == hWnd ) if ( ::GetFocus() == hWnd )
SetForegroundWindow( hWnd ); SetForegroundWindow_Impl( hWnd );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment