[Libreoffice-commits] core.git: vcl/headless

Jan-Marek Glogowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 1 13:27:06 UTC 2021


 vcl/headless/svpframe.cxx |   31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

New commits:
commit d9648d1cf6c4ec7407ff30cf814be98d089345d1
Author:     Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Tue Jun 29 18:30:01 2021 +0200
Commit:     Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Thu Jul 1 15:26:31 2021 +0200

    svp: a bit more correct focus handling
    
    Took me a while to realize, that the focus handling after closing
    a dialog was somehow broken. This isn't a really good solution,
    because we can still focus invisble frames, but that is at least
    needed for CppunitTest_sd_tiledrendering and the reason that
    crashes for non-headless VCL plugins.
    
    Change-Id: I272837bd965439c5c0cd9c8bcbc9d51e3018fdf3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118130
    Tested-by: Jenkins
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/headless/svpframe.cxx b/vcl/headless/svpframe.cxx
index c7a1d8f50845..5f40377f5b86 100644
--- a/vcl/headless/svpframe.cxx
+++ b/vcl/headless/svpframe.cxx
@@ -118,8 +118,12 @@ SvpSalFrame::~SvpSalFrame()
 
 void SvpSalFrame::GetFocus()
 {
+    if (m_nStyle == SalFrameStyleFlags::NONE)
+        return;
     if( s_pFocusFrame == this )
         return;
+    // FIXME: return if !m_bVisible
+    // That's IMHO why CppunitTest_sd_tiledrendering crashes non-headless
 
     if( (m_nStyle & (SalFrameStyleFlags::OWNERDRAWDECORATION | SalFrameStyleFlags::FLOAT)) == SalFrameStyleFlags::NONE )
     {
@@ -210,7 +214,16 @@ void SvpSalFrame::SetExtendedFrameStyle( SalExtStyle )
 
 void SvpSalFrame::Show( bool bVisible, bool bNoActivate )
 {
-    if( bVisible && ! m_bVisible )
+    if (m_nStyle == SalFrameStyleFlags::NONE)
+        return;
+    if (bVisible == m_bVisible)
+    {
+        if (m_bVisible && !bNoActivate)
+            GetFocus();
+        return;
+    }
+
+    if (bVisible)
     {
         // SAL_DEBUG("SvpSalFrame::Show: showing: " << this);
         m_bVisible = true;
@@ -218,17 +231,12 @@ void SvpSalFrame::Show( bool bVisible, bool bNoActivate )
         if( ! bNoActivate )
             GetFocus();
     }
-    else if( ! bVisible && m_bVisible )
+    else
     {
         // SAL_DEBUG("SvpSalFrame::Show: hiding: " << this);
         m_bVisible = false;
-        m_pInstance->PostEvent( this, nullptr, SalEvent::Resize );
         LoseFocus();
     }
-    else
-    {
-        // SAL_DEBUG("SvpSalFrame::Show: nothing: " << this);
-    }
 }
 
 void SvpSalFrame::SetMinClientSize( tools::Long nWidth, tools::Long nHeight )
@@ -364,9 +372,14 @@ void SvpSalFrame::SetAlwaysOnTop( bool )
 {
 }
 
-void SvpSalFrame::ToTop( SalFrameToTop )
+void SvpSalFrame::ToTop(SalFrameToTop nFlags)
 {
-    GetFocus();
+    if (m_nStyle == SalFrameStyleFlags::NONE)
+        return;
+    if (nFlags & SalFrameToTop::RestoreWhenMin)
+        Show(true, false);
+    else
+        GetFocus();
 }
 
 void SvpSalFrame::SetPointer( PointerStyle )


More information about the Libreoffice-commits mailing list