diff options
author | Henry Castro <hcastro@collabora.com> | 2020-12-17 11:15:25 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2021-04-09 11:55:57 +0200 |
commit | f3fbffd75d909a7c69e24107c5cf77adf5c2ba73 (patch) | |
tree | 76e97700b4c86e438091ac166143d73173dcb294 | |
parent | b86ed3d917a51c34de7048f863ec1359b660ded3 (diff) |
jsdialog: use the "WindowShow" event
If the idle notifier is disabled use the
"WindowShow" event to notify the dialog status.
This ensures the dialog is initialized with all
children and its properties.
There is a bug with the "WindowShow" event, it
looks like it receive 2 times.
Change-Id: I81947de8498aee99c3ea4ad504611c7afa62d7c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107915
Tested-by: Jenkins
Reviewed-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 6 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 556e34ffd346..1f5ad5563f9d 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -70,6 +70,7 @@ public: void notifyDialogState(bool bForce = false); void sendClose(); + void dumpStatus(); }; class JSDropTarget final @@ -218,6 +219,11 @@ public: class JSDialog : public JSWidget<SalInstanceDialog, ::Dialog> { + DECL_LINK(on_dump_status, void*, void); + DECL_LINK(on_window_event, VclWindowEvent&, void); + + bool m_bNotifyCreated; + public: JSDialog(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, ::Dialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership, diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 1bd064fc5c3e..7604d06b4c39 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -125,6 +125,8 @@ void JSDialogSender::notifyDialogState(bool bForce) void JSDialogSender::sendClose() { mpIdleNotify->sendClose(); } +void JSDialogSender::dumpStatus() { mpIdleNotify->Invoke(); } + namespace { vcl::Window* extract_sal_widget(weld::Widget* pParent) @@ -639,6 +641,11 @@ JSDialog::JSDialog(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aCon : JSWidget<SalInstanceDialog, ::Dialog>(aNotifierWindow, aContentWindow, pDialog, pBuilder, bTakeOwnership, sTypeOfJSON) { + if (aNotifierWindow && aNotifierWindow->IsDisableIdleNotify()) + { + pDialog->AddEventListener(LINK(this, JSDialog, on_window_event)); + m_bNotifyCreated = false; + } } void JSDialog::collapse(weld::Widget* pEdit, weld::Widget* pButton) @@ -659,6 +666,17 @@ void JSDialog::response(int response) SalInstanceDialog::response(response); } +IMPL_LINK_NOARG(JSDialog, on_dump_status, void*, void) { JSDialogSender::dumpStatus(); } + +IMPL_LINK(JSDialog, on_window_event, VclWindowEvent&, rEvent, void) +{ + if (rEvent.GetId() == VclEventId::WindowShow && !m_bNotifyCreated) + { + Application::PostUserEvent(LINK(this, JSDialog, on_dump_status)); + m_bNotifyCreated = true; + } +} + JSLabel::JSLabel(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow, FixedText* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::string sTypeOfJSON) |