[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sal/osl
Mike Kaganski
mike.kaganski at collabora.com
Sun Feb 4 21:13:10 UTC 2018
sal/osl/w32/pipe.cxx | 8 ++++++++
1 file changed, 8 insertions(+)
New commits:
commit d8cf7f14a50a25127d660ec6f9790feefc031025
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date: Mon Jan 29 16:24:24 2018 +0300
tdf#49134 tdf#114466 Transfer privilege to become foreground process
... to already open soffice process from newly spawned one on Windows.
When an application takes user input, a timeout is started during
which other processes cannot create foreground windows that might
steal focus, and thus interrupt user input. The timeout is defined
by SPI_SETFOREGROUNDLOCKTIMEOUT (see SystemParametersInfo) and
ForegroundLockTimeout registry setting (see
https://technet.microsoft.com/en-us/library/cc957208). If an
application that currently doesn't have right to become foreground
tries to show popups in this interval, the popup will stay on
background, and only flash in taskbar.
The application that has the right to steal focus (see the list in
https://msdn.microsoft.com/en-us/library/ms632668) may transfer its
right to another process using AllowSetForegroundWindow function.
So, the intended effect is this:
1. User interacts with some foreground process (e.g., Explorer);
a timeout is started to prevent non-privileged processes from
stealing focus;
2. As the result, the process launches a new soffice process, which
has privilege to create foreground windows (as it is started by
foreground process);
3. It communicates with already started soffice process, which is
currently in background, and so doesn't have privilege to create
foreground windows until timeout expires;
4. It transfers its right to the already started soffice process,
and then issues the required commands that might lead to need to
show popup windows.
Change-Id: I4208665c2ae4106fa06e72269f4c3804af40d582
Reviewed-on: https://gerrit.libreoffice.org/48839
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
(cherry picked from commit 8d1d82dd63eada8faa2f6eb43ef900764a5fda62)
Reviewed-on: https://gerrit.libreoffice.org/48853
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx
index febc4f19c562..dc03008cf595 100644
--- a/sal/osl/w32/pipe.cxx
+++ b/sal/osl/w32/pipe.cxx
@@ -229,6 +229,14 @@ oslPipe SAL_CALL osl_createPipe(rtl_uString *strPipeName, oslPipeOptions Options
rtl_uString_release(name);
rtl_uString_release(path);
+ // We should try to transfer our privilege to become foreground process
+ // to the other process, so that it may show popups (otherwise, they might
+ // be blocked by SPI_GETFOREGROUNDLOCKTIMEOUT setting -
+ // see SystemParametersInfo function at MSDN
+ ULONG ServerProcessId = 0;
+ if (GetNamedPipeServerProcessId(pPipe->m_File, &ServerProcessId))
+ AllowSetForegroundWindow(ServerProcessId);
+
return pPipe;
}
else
More information about the Libreoffice-commits
mailing list