vcl/unx/gtk3/gtkinst.cxx |   64 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 57 insertions(+), 7 deletions(-)

New commits:
commit 949658028e722e5d2657b503eb20e16e41dbd8cf
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Jun 21 17:04:54 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jun 21 21:27:03 2021 +0200

    gtk4: some initial dnd effort
    
    Change-Id: I964afbf30c75b6d8e0c31ce7fcb536814acf05b8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117599
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 3b8e9dbce02c..40e23ae7d7ac 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -2677,15 +2677,23 @@ protected:
 
     void ensure_drag_begin_end()
     {
-#if !GTK_CHECK_VERSION(4, 0, 0)
         if (!m_nDragBeginSignalId)
         {
             // using "after" due to 
https://gitlab.gnome.org/GNOME/pygobject/issues/251
+#if GTK_CHECK_VERSION(4, 0, 0)
+            m_nDragBeginSignalId = 
g_signal_connect_after(get_drag_controller(), "drag-begin", 
G_CALLBACK(signalDragBegin), this);
+#else
             m_nDragBeginSignalId = g_signal_connect_after(m_pWidget, 
"drag-begin", G_CALLBACK(signalDragBegin), this);
+#endif
         }
         if (!m_nDragEndSignalId)
+        {
+#if GTK_CHECK_VERSION(4, 0, 0)
+            m_nDragEndSignalId = g_signal_connect(get_drag_controller(), 
"drag-end", G_CALLBACK(signalDragEnd), this);
+#else
             m_nDragEndSignalId = g_signal_connect(m_pWidget, "drag-end", 
G_CALLBACK(signalDragEnd), this);
 #endif
+        }
     }
 
 private:
@@ -2736,6 +2744,7 @@ private:
     GtkEventController* m_pFocusController;
     GtkEventController* m_pClickController;
     GtkEventController* m_pMotionController;
+    GtkEventController* m_pDragController;
 #endif
 
     rtl::Reference<GtkInstDropTarget> m_xDropTarget;
@@ -3053,11 +3062,13 @@ private:
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
         pThis->m_xDropTarget->signalDragDropReceived(pWidget, context, x, y, 
data, ttype, time);
     }
+#endif
 
     virtual void drag_ended()
     {
     }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
     static void signalDragLeave(GtkWidget *pWidget, GdkDragContext *context, 
guint time, gpointer widget)
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
@@ -3068,13 +3079,17 @@ private:
             pThis->drag_ended();
         }
     }
+#endif
 
+#if GTK_CHECK_VERSION(4, 0, 0)
+    static void signalDragBegin(GtkDragSource* context, GdkDrag*, gpointer 
widget)
+#else
     static void signalDragBegin(GtkWidget*, GdkDragContext* context, gpointer 
widget)
+#endif
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
         pThis->signal_drag_begin(context);
     }
-#endif
 
     void ensure_drag_source()
     {
@@ -3098,8 +3113,11 @@ private:
         return false;
     }
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 0, 0)
+    void signal_drag_begin(GtkDragSource* context)
+#else
     void signal_drag_begin(GdkDragContext* context)
+#endif
     {
         bool bUnsetDragIcon(false);
         if (do_signal_drag_begin(bUnsetDragIcon))
@@ -3122,21 +3140,26 @@ private:
             return;
         m_xDragSource->setActiveDragSource();
     }
-#endif
 
     virtual void do_signal_drag_end()
     {
     }
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
+#if GTK_CHECK_VERSION(4, 0, 0)
+    static void signalDragEnd(GtkGestureDrag* /*gesture*/, double 
/*offset_x*/, double /*offset_y*/, gpointer widget)
+#else
     static void signalDragEnd(GtkWidget* /*widget*/, GdkDragContext* context, 
gpointer widget)
+#endif
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
         pThis->do_signal_drag_end();
+#if !GTK_CHECK_VERSION(4, 0, 0)
         if (pThis->m_xDragSource.is())
             pThis->m_xDragSource->dragEnd(context);
+#endif
     }
 
+#if !GTK_CHECK_VERSION(4, 0, 0)
     static gboolean signalDragFailed(GtkWidget* /*widget*/, GdkDragContext* 
/*context*/, GtkDragResult /*result*/, gpointer widget)
     {
         GtkInstanceWidget* pThis = static_cast<GtkInstanceWidget*>(widget);
@@ -3239,6 +3262,7 @@ public:
         , m_pFocusController(nullptr)
         , m_pClickController(nullptr)
         , m_pMotionController(nullptr)
+        , m_pDragController(nullptr)
 #endif
     {
         if (!bTakeOwnership)
@@ -3769,6 +3793,18 @@ public:
         }
         return m_pMotionController;
     }
+
+    GtkEventController* get_drag_controller()
+    {
+        if (!m_pDragController)
+        {
+            GtkDragSource* pDrag = gtk_drag_source_new();
+            m_pDragController = GTK_EVENT_CONTROLLER(pDrag);
+            gtk_widget_add_controller(m_pWidget, m_pDragController);
+        }
+        return m_pDragController;
+    }
+
 #endif
 
 
@@ -3980,9 +4016,21 @@ public:
         if (m_nDragLeaveSignalId)
             g_signal_handler_disconnect(m_pWidget, m_nDragLeaveSignalId);
         if (m_nDragEndSignalId)
+        {
+#if GTK_CHECK_VERSION(4, 0, 0)
+            g_signal_handler_disconnect(get_drag_controller(), 
m_nDragEndSignalId);
+#else
             g_signal_handler_disconnect(m_pWidget, m_nDragEndSignalId);
+#endif
+        }
         if (m_nDragBeginSignalId)
+        {
+#if GTK_CHECK_VERSION(4, 0, 0)
+            g_signal_handler_disconnect(get_drag_controller(), 
m_nDragBeginSignalId);
+#else
             g_signal_handler_disconnect(m_pWidget, m_nDragBeginSignalId);
+#endif
+        }
         if (m_nDragFailedSignalId)
             g_signal_handler_disconnect(m_pWidget, m_nDragFailedSignalId);
         if (m_nDragDataDeleteignalId)
@@ -14971,7 +15019,6 @@ public:
         }
     }
 
-#if !GTK_CHECK_VERSION(4, 0, 0)
     virtual void drag_ended() override
     {
         m_bInDrag = false;
@@ -14989,7 +15036,6 @@ public:
         // unhighlight the row
         gtk_tree_view_set_drag_dest_row(m_pTreeView, nullptr, 
GTK_TREE_VIEW_DROP_BEFORE);
     }
-#endif
 
     virtual int vadjustment_get_value() const override
     {
commit fde49b6c80b1f16b626554ec39da79e7bc186c87
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Jun 21 16:25:56 2021 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Mon Jun 21 21:26:41 2021 +0200

    gtk4: reenable some more working dialogs
    
    Change-Id: I373b9260287b229f4f3092b4c27199c2a55ea23d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117597
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 059a51ee93df..3b8e9dbce02c 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -22324,6 +22324,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* 
pParent, const OUString&
         rUIFile != "cui/ui/macroselectordialog.ui" &&
         rUIFile != "cui/ui/menuassignpage.ui" &&
         rUIFile != "cui/ui/namedialog.ui" &&
+        rUIFile != "cui/ui/newlibdialog.ui" &&
         rUIFile != "cui/ui/numberingformatpage.ui" &&
         rUIFile != "cui/ui/numberingoptionspage.ui" &&
         rUIFile != "cui/ui/numberingpositionpage.ui" &&
@@ -22489,6 +22490,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* 
pParent, const OUString&
         rUIFile != "modules/swriter/ui/columndialog.ui" &&
         rUIFile != "modules/swriter/ui/columnpage.ui" &&
         rUIFile != "modules/swriter/ui/columnwidth.ui" &&
+        rUIFile != "modules/swriter/ui/comboboxfragment.ui" &&
         rUIFile != "modules/swriter/ui/converttexttable.ui" &&
         rUIFile != "modules/swriter/ui/dropcapspage.ui" &&
         rUIFile != "modules/swriter/ui/editcategories.ui" &&
@@ -22543,7 +22545,9 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* 
pParent, const OUString&
         rUIFile != "modules/swriter/ui/tablecolumnpage.ui" &&
         rUIFile != "modules/swriter/ui/tableproperties.ui" &&
         rUIFile != "modules/swriter/ui/tabletextflowpage.ui" &&
+        rUIFile != "modules/swriter/ui/templatedialog2.ui" &&
         rUIFile != "modules/swriter/ui/templatedialog8.ui" &&
+        rUIFile != "modules/swriter/ui/templatedialog16.ui" &&
         rUIFile != "modules/swriter/ui/textgridpage.ui" &&
         rUIFile != "modules/swriter/ui/titlepage.ui" &&
         rUIFile != "modules/swriter/ui/watermarkdialog.ui" &&
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to