[Libreoffice-commits] core.git: vcl/source vcl/unx

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 14 11:08:41 UTC 2019


 vcl/source/app/salvtables.cxx |   18 +++++++++++++-----
 vcl/source/window/dialog.cxx  |   19 +++++++------------
 vcl/unx/gtk3/gtk3gtkinst.cxx  |   11 +++++++++--
 3 files changed, 29 insertions(+), 19 deletions(-)

New commits:
commit 7db198677d7907a1e146f0287ab742ee536f397f
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Jun 14 10:02:15 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Jun 14 13:07:43 2019 +0200

    broadcast up/down of welded native modal dialogs like vcl ones
    
    Change-Id: I61519f0ff92b912501f82e31d6cc3cae244208e6
    Reviewed-on: https://gerrit.libreoffice.org/74028
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 58d142217bd9..33aea3fe1419 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -1071,15 +1071,11 @@ public:
 
     virtual void set_modal(bool bModal) override
     {
-        if (::Dialog* pDialog = dynamic_cast<::Dialog*>(m_xWindow.get()))
-            return pDialog->SetModalInputMode(bModal);
-        return m_xWindow->ImplGetFrame()->SetModal(bModal);
+        m_xWindow->ImplGetFrame()->SetModal(bModal);
     }
 
     virtual bool get_modal() const override
     {
-        if (const ::Dialog* pDialog = dynamic_cast<const ::Dialog*>(m_xWindow.get()))
-            return pDialog->IsModalInputMode();
         return m_xWindow->ImplGetFrame()->GetModal();
     }
 
@@ -1331,6 +1327,18 @@ public:
         m_xDialog->add_button(xButton, nResponse, true);
     }
 
+    virtual void set_modal(bool bModal) override
+    {
+        if (get_modal() == bModal)
+            return;
+        m_xDialog->SetModalInputMode(bModal);
+    }
+
+    virtual bool get_modal() const override
+    {
+        return m_xDialog->IsModalInputMode();
+    }
+
     virtual weld::Button* get_widget_for_response(int nResponse) override;
 
     virtual void set_default_response(int nResponse) override
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index ce83520c997a..ec660bf630b4 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -964,12 +964,6 @@ bool Dialog::ImplStartExecute()
         if ( pSVData->maWinData.mpCaptureWin )
             pSVData->maWinData.mpCaptureWin->ReleaseMouse();
         EnableInput();
-
-        if ( GetParent() )
-        {
-            SalFrame* pFrame = GetParent()->ImplGetFrame();
-            pFrame->NotifyModalHierarchy(true);
-        }
     }
 
     mbInExecute = true;
@@ -1159,12 +1153,6 @@ void Dialog::EndDialog( long nResult )
         }
     }
 
-    if (bModal && GetParent())
-    {
-        SalFrame* pFrame = GetParent()->ImplGetFrame();
-        pFrame->NotifyModalHierarchy(false);
-    }
-
     mpDialogImpl->mnResult = nResult;
 
     if ( mpDialogImpl->mbStartedModal )
@@ -1222,6 +1210,13 @@ void Dialog::SetModalInputMode( bool bModal )
         return;
 
     ImplGetFrame()->SetModal(bModal);
+
+    if (GetParent())
+    {
+        SalFrame* pFrame = GetParent()->ImplGetFrame();
+        pFrame->NotifyModalHierarchy(bModal);
+    }
+
     ImplSetModalInputMode(bModal);
 }
 
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 42a66e69b460..d07207de5379 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -2938,6 +2938,7 @@ struct DialogRunner
         {
             m_xFrameWindow->IncModalCount();
             ++m_nModalDepth;
+            m_xFrameWindow->ImplGetFrame()->NotifyModalHierarchy(true);
         }
     }
 
@@ -2947,6 +2948,7 @@ struct DialogRunner
         {
             m_xFrameWindow->DecModalCount();
             --m_nModalDepth;
+            m_xFrameWindow->ImplGetFrame()->NotifyModalHierarchy(false);
         }
     }
 
@@ -2997,13 +2999,18 @@ struct DialogRunner
 
     ~DialogRunner()
     {
-        if (m_xFrameWindow)
+        if (m_xFrameWindow && m_nModalDepth)
         {
             // if, like the calc validation dialog does, the modality was
             // toggled off during execution ensure that on cleanup the parent
             // is left in the state it was found
-            while (m_nModalDepth++ < 0)
+            SalFrame* pFrame = m_xFrameWindow->ImplGetFrame();
+            do
+            {
                 m_xFrameWindow->IncModalCount();
+                pFrame->NotifyModalHierarchy(true);
+            }
+            while (++m_nModalDepth < 0);
         }
     }
 };


More information about the Libreoffice-commits mailing list