[Webkit-unassigned] [Bug 200297] New: Cannot disable drag-and-drop functionality inside a WebView
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jul 31 01:11:45 PDT 2019
https://bugs.webkit.org/show_bug.cgi?id=200297
Bug ID: 200297
Summary: Cannot disable drag-and-drop functionality inside a
WebView
Product: WebKit
Version: WebKit Local Build
Hardware: PC
OS: Linux
Status: NEW
Severity: Normal
Priority: P2
Component: WebKitGTK
Assignee: webkit-unassigned at lists.webkit.org
Reporter: jussi.hietanen at iki.fi
CC: bugs-noreply at webkitgtk.org
Hello,
I'm trying to disable drag-and-drop functionality in a gtkmm project where I'm using WebKitGTK to render HTML pages. After creating the webview and creating a gtkmm widget out of it, as shown here:
mWebView = WEBKIT_WEB_VIEW(webkit_web_view_new_with_context(mWebContext));
auto webWidget = Gtk::manage(Glib::wrap(GTK_WIDGET(mWebView)));
mBrowserContainer.pack_start(*webWidget, Gtk::PACK_EXPAND_WIDGET);
I try to disable the drag-and-drop functionality with the respective gtkmm widget class member functions:
webWidget->drag_source_unset();
webWidget->drag_dest_unset();
The "drag_dest_unset()" works as expected (https://developer.gnome.org/gtkmm/stable/classGtk_1_1Widget.html#a0940c95059601a152db59a2fc99a2ed3), but the "drag_source_unset()" doesn't seem to have any effect; I can still drag links and text out from the WebView.
I also tried to disable the dragging with a more "hacky" way, by calling drag_source_set()
webWidget->drag_source_set(std::vector<Gtk::TargetEntry>({ Gtk::TargetEntry("STRING", Gtk::TargetFlags::TARGET_SAME_WIDGET, 0) }));
This should create a custom Gtk::TargetEntry list which is allowed to copy data from the widget. However, after setting this drag_source_set(), the program aborts because an assert fails in the webkitWebViewBaseDragEnd(GtkWidget* widget, GdkDragContext* context) function inside WebKitWebViewBase.cpp (https://trac.webkit.org/browser/webkit/releases/WebKitGTK/webkit-2.25.1/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp#L1281). Seems like calling "drag_source_set()" on a WebView nullifies some internal structure (WebKitWebViewBasePrivate->dragAndDropHandler).
I also tried to connect the webWidget->signal_drag_begin() signal to a function where I would call gdk_drag_abort() for the Gdk::DragContext, but it does not seem to work on all systems.
What is the proper way to disable WebView's DnD functionality from the code, if I don't compile the whole WebKitGTK library from source without the "ENABLE(DRAG_SUPPORT)" macro?
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190731/2eb06c70/attachment.html>
More information about the webkit-unassigned
mailing list