summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2020-12-17 11:15:25 -0400
committerHenry Castro <hcastro@collabora.com>2020-12-28 13:20:11 +0100
commit54b5e6b4e083ce7a71e16ef622753898f38dc8ab (patch)
tree6a02a4b79306f885282780783e0b7b59c77b7d9d /vcl
parentb0e573f18629d28fe3179c12d0d434653f92fc93 (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>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/jsdialog/jsdialogbuilder.hxx6
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx18
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 0b439f57e2f3..1b7d8428c880 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)