diff options
author | Jan-Marek Glogowski <jan-marek.glogowski@extern.cib.de> | 2019-11-25 14:08:44 +0000 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2019-11-26 23:20:58 +0100 |
commit | ec554ac30236fa7949e9866d01319d4e3e88c983 (patch) | |
tree | a1ee91587249bda3f83dbebba9f96a60658411ec | |
parent | 97ad402d58b52a1f2636905137c21298531c2935 (diff) |
tdf#126607 Qt5 activate window before setFocus
.., and prevent Qt5MainWindow to take any focus.
Our top level Qt5MainWindow shouldn't handle focus directly, as
it's always completely drawn by the child Qt5Widget, which also
handles input. So prevent any direct focus handling by setting
the Qt5Widget as the focus proxy of the Qt5MainWindow.
Also setting the focus of the child widget on its own seems to
do nothing at all. At least I didn't see any difference after
commenting the code block. But it at least has some effect, if
you call setFocus on the real window, but that breaks Impress
full screen mode, which somehow gets scroll bars?!
Not that I understand why this is needed. At least the original
X11 code just calls XSetInputFocus in this case.
Change-Id: I591c031a17a7ae0b5486760cd1802522d4088678
Reviewed-on: https://gerrit.libreoffice.org/83689
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r-- | vcl/qt5/Qt5Frame.cxx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vcl/qt5/Qt5Frame.cxx b/vcl/qt5/Qt5Frame.cxx index 47bfb357c2a5..2ca319ee515c 100644 --- a/vcl/qt5/Qt5Frame.cxx +++ b/vcl/qt5/Qt5Frame.cxx @@ -153,6 +153,7 @@ Qt5Frame::Qt5Frame(Qt5Frame* pParent, SalFrameStyleFlags nStyle, bool bUseCairo) m_pTopLevel = new Qt5MainWindow(*this, pParentWidget, aWinFlags); m_pQWidget = new Qt5Widget(*this, aWinFlags); m_pTopLevel->setCentralWidget(m_pQWidget); + m_pTopLevel->setFocusProxy(m_pQWidget); } else m_pQWidget = new Qt5Widget(*this, aWinFlags); @@ -684,7 +685,10 @@ void Qt5Frame::ToTop(SalFrameToTop nFlags) if ((nFlags & SalFrameToTop::RestoreWhenMin) || (nFlags & SalFrameToTop::ForegroundTask)) pWidget->activateWindow(); else if ((nFlags & SalFrameToTop::GrabFocus) || (nFlags & SalFrameToTop::GrabFocusOnly)) - m_pQWidget->setFocus(); + { + pWidget->activateWindow(); + pWidget->setFocus(); + } } void Qt5Frame::SetPointer(PointerStyle ePointerStyle) |