vcl/qt5/Qt5Frame.cxx |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit ec554ac30236fa7949e9866d01319d4e3e88c983
Author:     Jan-Marek Glogowski <jan-marek.glogow...@extern.cib.de>
AuthorDate: Mon Nov 25 14:08:44 2019 +0000
Commit:     Jan-Marek Glogowski <glo...@fbihome.de>
CommitDate: Tue Nov 26 23:20:58 2019 +0100

    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 <glo...@fbihome.de>

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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to