diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-14 10:02:15 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-14 13:07:43 +0200 |
commit | 7db198677d7907a1e146f0287ab742ee536f397f (patch) | |
tree | f6219e9e2c190d9c4be270e01ca5678d3d5c12a8 | |
parent | 252239ae30313142195b3da81aea45a89b2d6674 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/app/salvtables.cxx | 18 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 19 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 11 |
3 files changed, 29 insertions, 19 deletions
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); } } }; |