WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
64459
[GTK] WebKitWebView should obey gtk-dnd-drag-threshold setting
https://bugs.webkit.org/show_bug.cgi?id=64459
Summary
[GTK] WebKitWebView should obey gtk-dnd-drag-threshold setting
arno.
Reported
2011-07-13 09:52:00 PDT
Hi, gtk defines a gtk-dnd-drag-threshold property, and many gtk widgets use it to prevent drag from starting when user moves mouse with a really small movement. This is really important for accessibility (think, ill or old people whose hands shake a lot). I would be nice if WebKitWebView would not start a drag if gtk_drag_check_threshold returns false. I've investigated a bit, and discovered Gtk Widget usually make that check in in motion_notify_event callback, and do not call gtk_drag_begin if it's false. But making this check in webkit_web_view_motion_event would prevent all mouse move events, not only drags. Then, I don't known how to handle that.
Attachments
patch
(4.13 KB, patch)
2011-07-13 15:13 PDT
,
arno.
mrobinson
: review-
Details
Formatted Diff
Diff
Patch rebased against current git
(3.75 KB, patch)
2012-08-17 03:43 PDT
,
Sven Schwedas
no flags
Details
Formatted Diff
Diff
Compilation errors fixed
(3.88 KB, patch)
2012-08-17 05:39 PDT
,
Sven Schwedas
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Martin Robinson
Comment 1
2011-07-13 10:21:39 PDT
(In reply to
comment #0
)
> Hi, > gtk defines a gtk-dnd-drag-threshold property, and many gtk widgets use it to prevent drag from starting when user moves mouse with a really small movement. This is really important for accessibility (think, ill or old people whose hands shake a lot). > I would be nice if WebKitWebView would not start a drag if gtk_drag_check_threshold returns false.
The drag hysteresis is controlled via constants in EventHandler.cpp. In GTK+ we could potentially make them depend on GTK+ settings. Another option would be to make drag-and-drop a runtime setting, versus simply compile time. Do you mind explaining your usecase?
arno.
Comment 2
2011-07-13 15:13:25 PDT
Created
attachment 100718
[details]
patch (In reply to
comment #1
)
> (In reply to
comment #0
) > > Hi, > > gtk defines a gtk-dnd-drag-threshold property, and many gtk widgets use it to prevent drag from starting when user moves mouse with a really small movement. This is really important for accessibility (think, ill or old people whose hands shake a lot). > > I would be nice if WebKitWebView would not start a drag if gtk_drag_check_threshold returns false. > > > The drag hysteresis is controlled via constants in EventHandler.cpp. In GTK+ we could potentially make them depend on GTK+ settings. Another option would be to make drag-and-drop a runtime setting, versus simply compile time. Do you mind explaining your usecase?
My current usecase is building a minimal browser. Right click and drag must be disabled. As far as I known, right click can be disabled on the system, but drag cannot. Using has also some advantages: it would be possible to put a high threshold, a make a browser more appropriated for people with some disabilities. Then it's more coherent with other gkt widgets. I attach a patch wich checks gtk-dnd-drag-threshold property, and makes uses it if it's bigger than *DragHysteresis constants. To get the GtkWidget, I used the logic from widgetFromFrame (PasteboardHelper.cpp). I wonder if there is some util file where that function could go.
Carlos Garcia Campos
Comment 3
2011-09-07 23:57:48 PDT
Comment on
attachment 100718
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=100718&action=review
> Source/WebCore/page/gtk/EventHandlerGtk.cpp:144 > + Page* page = m_frame->page(); > + if (page) { > + Chrome* chrome = page->chrome(); > + if (chrome) { > + GtkWidget* client = GTK_WIDGET(chrome->platformPageClient()); > + gint widgetDragHysteresis = 0; > + if (client) { > + g_object_get(gtk_widget_get_settings(client), > + "gtk-dnd-drag-threshold", &widgetDragHysteresis, > + 0); > + threshold = max(widgetDragHysteresis, threshold); > + } > + } > + }
Since WebKitGtk is not currently multi-head safe, I think all of this can be simplified as: g_object_get(gtk_settings_get_default(), "gtk-dnd-drag-threshold", >kDndThreshold, NULL); threshold = max(gtkDdnThreshold, threshold);
Martin Robinson
Comment 4
2011-09-08 08:38:01 PDT
(In reply to
comment #3
)
> g_object_get(gtk_settings_get_default(), "gtk-dnd-drag-threshold", >kDndThreshold, NULL); > threshold = max(gtkDdnThreshold, threshold);
From what I understand this change will also make this patch more compatible with WebKit2. I think it's a great idea.
Martin Robinson
Comment 5
2011-09-08 08:38:44 PDT
(In reply to
comment #3
)
> Since WebKitGtk is not currently multi-head safe, I think all of this can be simplified as:
Perhaps we should start working on making it so, though? Is it worth it? In any case, this code should be used as a fallback for the WebKit2 case.
Sven Schwedas
Comment 6
2011-10-04 05:33:25 PDT
Any status update on this? I'd really need this – tablets and touchscreens are more or less unusable thanks to constant accidental drags. @Arno could you please update the patch for 1.6.1, so I can at least patch my local webkit?
Sven Schwedas
Comment 7
2011-10-05 06:02:26 PDT
(In reply to
comment #3
)
> Since WebKitGtk is not currently multi-head safe, I think all of this can be simplified as: > > g_object_get(gtk_settings_get_default(), "gtk-dnd-drag-threshold", >kDndThreshold, NULL); > threshold = max(gtkDdnThreshold, threshold);
I just tried the patch with this change, and it seems to be working fine. Could we get this into master asap?
Sven Schwedas
Comment 8
2012-08-17 03:43:07 PDT
Created
attachment 159072
[details]
Patch rebased against current git Patch rebased against current git, including changes from #3. Original authors Arno Renevier <
arno@renevier.net
> / Carlos Garcia Campos <
cgarcia@igalia.com
>
Sven Schwedas
Comment 9
2012-08-17 05:39:42 PDT
Created
attachment 159103
[details]
Compilation errors fixed Patch now compiling and tested. Honours the gtk-dnd-drag-threshold settings in gtkrc/settings.ini.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug