vcl/unx/gtk3/gtk3gtkinst.cxx |   53 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 40 insertions(+), 13 deletions(-)

New commits:
commit e05c7017a04a1c2a2ee4dc22ee53ae8d66847c32
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sun Feb 16 20:45:06 2020 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Feb 17 12:05:37 2020 +0100

    Related: tdf#130414 implement queue_resize for ChildFrame
    
    so it can respond to changes to its childrens layout request state
    
    Change-Id: I32235c1df9f315954b9d91b500388abe663fa16d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88824
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index f6414f2f9d8c..bdaf11ffecf6 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -3461,20 +3461,47 @@ public:
     }
 };
 
-    class ChildFrame : public WorkWindow
+class ChildFrame : public WorkWindow
+{
+private:
+    Idle  maLayoutIdle;
+
+    DECL_LINK(ImplHandleLayoutTimerHdl, Timer*, void);
+public:
+    ChildFrame(vcl::Window* pParent, WinBits nStyle)
+        : WorkWindow(pParent, nStyle)
     {
-    public:
-        ChildFrame(vcl::Window* pParent, WinBits nStyle)
-            : WorkWindow(pParent, nStyle)
-        {
-        }
-        virtual void Resize() override
-        {
-            WorkWindow::Resize();
-            if (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild))
-                pChild->SetPosSizePixel(Point(0, 0), GetSizePixel());
-        }
-    };
+        maLayoutIdle.SetPriority(TaskPriority::RESIZE);
+        maLayoutIdle.SetInvokeHandler( LINK( this, ChildFrame, 
ImplHandleLayoutTimerHdl ) );
+        maLayoutIdle.SetDebugName( "ChildFrame maLayoutIdle" );
+    }
+
+    virtual void dispose() override
+    {
+        maLayoutIdle.Stop();
+        WorkWindow::dispose();
+    }
+
+    virtual void queue_resize(StateChangedType eReason = 
StateChangedType::Layout) override
+    {
+        WorkWindow::queue_resize(eReason);
+        if (maLayoutIdle.IsActive())
+            return;
+        maLayoutIdle.Start();
+    }
+
+    virtual void Resize() override
+    {
+        WorkWindow::Resize();
+        queue_resize();
+    }
+};
+
+IMPL_LINK_NOARG(ChildFrame, ImplHandleLayoutTimerHdl, Timer*, void)
+{
+    if (vcl::Window *pChild = GetWindow(GetWindowType::FirstChild))
+        pChild->SetPosSizePixel(Point(0, 0), GetSizePixel());
+}
 
 class GtkInstanceContainer : public GtkInstanceWidget, public virtual 
weld::Container
 {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to