Title: [269505] trunk/Source/WebKit
Revision
269505
Author
[email protected]
Date
2020-11-06 01:09:31 -0800 (Fri, 06 Nov 2020)

Log Message

[GTK] Application cannot override drag&drop callbacks
https://bugs.webkit.org/show_bug.cgi?id=218562

Patch by Milan Crha <[email protected]> on 2020-11-06
Reviewed by Michael Catanzaro.

* UIProcess/API/gtk/DropTargetGtk3.cpp:
(WebKit::DropTarget::DropTarget): Use g_signal_connect_after(), thus
any descendants can override the callbacks.
(WebKit::DropTarget::didPerformAction): Always call gdk_drag_status(),
to have gtk+ notified about drag progress.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (269504 => 269505)


--- trunk/Source/WebKit/ChangeLog	2020-11-06 09:01:13 UTC (rev 269504)
+++ trunk/Source/WebKit/ChangeLog	2020-11-06 09:09:31 UTC (rev 269505)
@@ -1,3 +1,16 @@
+2020-11-06  Milan Crha  <[email protected]>
+
+        [GTK] Application cannot override drag&drop callbacks
+        https://bugs.webkit.org/show_bug.cgi?id=218562
+
+        Reviewed by Michael Catanzaro.
+
+        * UIProcess/API/gtk/DropTargetGtk3.cpp:
+        (WebKit::DropTarget::DropTarget): Use g_signal_connect_after(), thus
+        any descendants can override the callbacks.
+        (WebKit::DropTarget::didPerformAction): Always call gdk_drag_status(),
+        to have gtk+ notified about drag progress.
+
 2020-11-06  Michael Catanzaro  <[email protected]>
 
         [GTK] dlopen libWPEBackend-fdo-1.0.so.1 instead of libWPEBackend-fdo-1.0.so

Modified: trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp (269504 => 269505)


--- trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2020-11-06 09:01:13 UTC (rev 269504)
+++ trunk/Source/WebKit/UIProcess/API/gtk/DropTargetGtk3.cpp	2020-11-06 09:09:31 UTC (rev 269505)
@@ -56,9 +56,9 @@
         static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK));
     gtk_drag_dest_set_target_list(m_webView, list.get());
 
-    g_signal_connect(m_webView, "drag-motion", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, gint x, gint y, guint time, gpointer userData) -> gboolean {
+    g_signal_connect_after(m_webView, "drag-motion", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, gint x, gint y, guint time, gpointer userData) -> gboolean {
         auto& drop = *static_cast<DropTarget*>(userData);
-        if (!drop.m_drop) {
+        if (drop.m_drop != context) {
             drop.m_drop = context;
             drop.m_position = IntPoint(x, y);
             drop.accept(time);
@@ -67,7 +67,7 @@
         return TRUE;
     }), this);
 
-    g_signal_connect(m_webView, "drag-leave", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, guint time, gpointer userData) {
+    g_signal_connect_after(m_webView, "drag-leave", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, guint time, gpointer userData) {
         auto& drop = *static_cast<DropTarget*>(userData);
         if (drop.m_drop != context)
             return;
@@ -74,7 +74,7 @@
         drop.leave();
     }), this);
 
-    g_signal_connect(m_webView, "drag-drop", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, gint x, gint y, guint time, gpointer userData) -> gboolean {
+    g_signal_connect_after(m_webView, "drag-drop", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, gint x, gint y, guint time, gpointer userData) -> gboolean {
         auto& drop = *static_cast<DropTarget*>(userData);
         if (drop.m_drop != context) {
             gtk_drag_finish(context, FALSE, FALSE, time);
@@ -84,7 +84,7 @@
         return TRUE;
     }), this);
 
-    g_signal_connect(m_webView, "drag-data-received", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time, gpointer userData) {
+    g_signal_connect_after(m_webView, "drag-data-received", G_CALLBACK(+[](GtkWidget*, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint info, guint time, gpointer userData) {
         auto& drop = *static_cast<DropTarget*>(userData);
         if (drop.m_drop != context)
             return;
@@ -230,11 +230,8 @@
     auto* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_webView));
     ASSERT(page);
 
-    auto operation = page->currentDragOperation();
-    if (operation == m_operation)
-        return;
+    m_operation = page->currentDragOperation();
 
-    m_operation = operation;
     gdk_drag_status(m_drop.get(), dragOperationToSingleGdkDragAction(m_operation), GDK_CURRENT_TIME);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to