diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-06-14 09:18:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-06-14 13:06:54 +0200 |
commit | 252239ae30313142195b3da81aea45a89b2d6674 (patch) | |
tree | b77efb3d2405bba253e6cd6f3633dff51ad21783 /vcl | |
parent | 8303e7ed668fbcbd0ba75bd9dd259f03073ffd46 (diff) |
disable 'quit' menu entry when modal dialog waiting response
Traditionally when a modal dialog is active, the quit menu entry of all
LibreOffice toplevel frames, not just those which are themselves modal, is get
disabled.
This has come unstuck because its implemented by dialogs emitting
MouseNotifyEvent::[END]EXECUTEDIALOG on its parent, and SfxFrameWindow_Impl
listening for that event. But if the dialog parent is the toplevel parent of
SfxFrameWindow_Impl then it doesn't get seen by the SfxFrameWindow_Impl child.
Change-Id: I0c4a5472d16d9169e68f6b0c230d039f1119489a
Reviewed-on: https://gerrit.libreoffice.org/73975
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/salframe.hxx | 4 | ||||
-rw-r--r-- | vcl/source/window/dialog.cxx | 8 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index b77ceafa8079..86ad6da98b6e 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -117,6 +117,7 @@ private: // the VCL window corresponding to this frame VclPtr<vcl::Window> m_pWindow; SALFRAMEPROC m_pProc; + Link<bool, void> m_aModalHierarchyHdl; protected: mutable std::unique_ptr<weld::Window> m_xFrameWeld; public: @@ -287,6 +288,9 @@ public: // returns the instance set vcl::Window* GetWindow() const { return m_pWindow; } + void SetModalHierarchyHdl(const Link<bool, void>& rLink) { m_aModalHierarchyHdl = rLink; } + void NotifyModalHierarchy(bool bModal) { m_aModalHierarchyHdl.Call(bModal); } + // Call the callback set; this sometimes necessary for implementation classes // that should not know more than necessary about the SalFrame implementation // (e.g. input methods, printer update handlers). diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 03512eb76178..ce83520c997a 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -967,8 +967,8 @@ bool Dialog::ImplStartExecute() if ( GetParent() ) { - NotifyEvent aNEvt( MouseNotifyEvent::EXECUTEDIALOG, this ); - GetParent()->CompatNotify( aNEvt ); + SalFrame* pFrame = GetParent()->ImplGetFrame(); + pFrame->NotifyModalHierarchy(true); } } @@ -1161,8 +1161,8 @@ void Dialog::EndDialog( long nResult ) if (bModal && GetParent()) { - NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this ); - GetParent()->CompatNotify( aNEvt ); + SalFrame* pFrame = GetParent()->ImplGetFrame(); + pFrame->NotifyModalHierarchy(false); } mpDialogImpl->mnResult = nResult; diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c6dc06416c8f..27f027eb3224 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1745,6 +1745,11 @@ void Window::ImplNewInputContext() pFocusWin->ImplGetFrame()->SetInputContext( &aNewContext ); } +void Window::SetModalHierarchyHdl(const Link<bool, void>& rLink) +{ + ImplGetFrame()->SetModalHierarchyHdl(rLink); +} + void Window::SetParentToDefaultWindow() { Show(false); |