[Libreoffice-commits] core.git: vcl/win
Markus Mohrhard
markus.mohrhard at googlemail.com
Tue Dec 20 10:55:37 UTC 2016
vcl/win/window/salframe.cxx | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
New commits:
commit 081267ebaacb38c564b36bb3e2576bf22d52b3e5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Mon Dec 19 22:37:24 2016 +0100
try to avoid the annoying focus stealing on windows
Change-Id: Ic6d3492a4707f24b616a7dee34a111ba0af4f281
Reviewed-on: https://gerrit.libreoffice.org/32207
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx
index 424e588..689a69c 100644
--- a/vcl/win/window/salframe.cxx
+++ b/vcl/win/window/salframe.cxx
@@ -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()
{
SalData* pSalData = GetSalData();
@@ -1179,8 +1190,8 @@ static void ImplSalShow( HWND hWnd, bool bVisible, bool bNoActivate )
{
HWND hWndParent = ::GetParent( hWnd );
if ( hWndParent )
- SetForegroundWindow( hWndParent );
- SetForegroundWindow( hWnd );
+ SetForegroundWindow_Impl( hWndParent );
+ SetForegroundWindow_Impl( hWnd );
}
pFrame->mbInShow = FALSE;
@@ -1977,7 +1988,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
DWORD myThreadID = GetCurrentThreadId();
DWORD currThreadID = GetWindowThreadProcessId(hCurrWnd,nullptr);
AttachThreadInput(myThreadID, currThreadID,TRUE);
- SetForegroundWindow(hWnd);
+ SetForegroundWindow_Impl(hWnd);
AttachThreadInput(myThreadID,currThreadID,FALSE);
}
@@ -2011,7 +2022,7 @@ static void ImplSalToTop( HWND hWnd, SalFrameToTop nFlags )
// Windows sometimes incorrectly reports to have the focus;
// thus make sure to really get the focus
if ( ::GetFocus() == hWnd )
- SetForegroundWindow( hWnd );
+ SetForegroundWindow_Impl( hWnd );
}
}
More information about the Libreoffice-commits
mailing list