Bug 38853

Summary: [GTK] Double clicks cause three button press events
Product: WebKit Reporter: Martin Robinson <mrobinson>
Component: WebKitGTKAssignee: Martin Robinson <mrobinson>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, alex, eric, webkit.review.bot, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 39040, 39844    
Attachments:
Description Flags
Add leapForward support to the GTK+ DRT
mrobinson: commit-queue-
Patch with style fixes
none
Only initialize the EventSender when loading the top frame
none
Add leapForward support to the DRT
none
Small EventSender cleanups
none
Add leapForward support to the GTK+ DRT
none
Take into account the timeOffset when synthesizing events in the DRT
mrobinson: commit-queue-
Take into account the timeOffset when synthesizing events in the DRT
mrobinson: commit-queue-
Take into account the timeOffset when synthesizing events in the DRT
mrobinson: commit-queue-
Send the proper mouse events during clicking
mrobinson: commit-queue-
Send the proper mouse events during clicking
mrobinson: commit-queue-
Send the proper mouse events during clicking (update)
none
Combine two related patches
none
Rudimentary leapForward support
none
Rudimentary leapForward support (small fix) none

Martin Robinson
Reported 2010-05-10 09:40:01 PDT
I believe that triple clicks also cause 5. This, and the lack of leapForward support in the DRT, cause us to fail fast/events/click-count.html.
Attachments
Add leapForward support to the GTK+ DRT (20.62 KB, patch)
2010-05-10 11:17 PDT, Martin Robinson
mrobinson: commit-queue-
Patch with style fixes (20.62 KB, patch)
2010-05-10 11:31 PDT, Martin Robinson
no flags
Only initialize the EventSender when loading the top frame (5.27 KB, patch)
2010-05-10 15:10 PDT, Martin Robinson
no flags
Add leapForward support to the DRT (16.97 KB, patch)
2010-05-10 19:09 PDT, Martin Robinson
no flags
Small EventSender cleanups (7.08 KB, patch)
2010-05-10 19:32 PDT, Martin Robinson
no flags
Add leapForward support to the GTK+ DRT (20.62 KB, patch)
2010-05-10 20:50 PDT, Martin Robinson
no flags
Take into account the timeOffset when synthesizing events in the DRT (2.97 KB, patch)
2010-05-12 17:53 PDT, Martin Robinson
mrobinson: commit-queue-
Take into account the timeOffset when synthesizing events in the DRT (3.60 KB, patch)
2010-05-12 17:59 PDT, Martin Robinson
mrobinson: commit-queue-
Take into account the timeOffset when synthesizing events in the DRT (3.90 KB, patch)
2010-05-12 18:07 PDT, Martin Robinson
mrobinson: commit-queue-
Send the proper mouse events during clicking (3.90 KB, patch)
2010-05-12 18:22 PDT, Martin Robinson
mrobinson: commit-queue-
Send the proper mouse events during clicking (17.14 KB, patch)
2010-05-12 20:35 PDT, Martin Robinson
mrobinson: commit-queue-
Send the proper mouse events during clicking (update) (16.15 KB, patch)
2010-05-14 09:07 PDT, Martin Robinson
no flags
Combine two related patches (19.58 KB, patch)
2010-05-14 11:57 PDT, Martin Robinson
no flags
Rudimentary leapForward support (18.11 KB, patch)
2010-05-27 06:32 PDT, Martin Robinson
no flags
Rudimentary leapForward support (small fix) (18.00 KB, patch)
2010-05-28 04:50 PDT, Martin Robinson
no flags
Martin Robinson
Comment 1 2010-05-10 11:17:14 PDT
Created attachment 55577 [details] Add leapForward support to the GTK+ DRT Attached a patch to add leapForward support to the DRT. The behavior of leapForward is described here: http://trac.webkit.org/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree
WebKit Review Bot
Comment 2 2010-05-10 11:22:20 PDT
Attachment 55577 [details] did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style', '--no-squash']" exit_code: 1 WebKitTools/DumpRenderTree/gtk/EventSender.cpp:130: Missing space after , [whitespace/comma] [3] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Martin Robinson
Comment 3 2010-05-10 11:31:43 PDT
Created attachment 55579 [details] Patch with style fixes
Alejandro G. Castro
Comment 4 2010-05-10 12:46:20 PDT
Could the patch be divided like: - Refactoring, these changes look nice: prepareMouseButtonEvent, sendOrQueueEvent, - Fix click problems - leapForward support, why is this required? Could you just leave the main loop iterate as usual? + while (!doneLeapingForward) + gtk_main_iteration(); Does this change in the condition inside makeEventSender solves the clicks problem or a problem with the replaying queue? - if (!replayingSavedEvents) { - // This function can be called in the middle of a test, even - // while replaying saved events. Resetting these while doing that - // can break things. + if (isTopFrame) {
Martin Robinson
Comment 5 2010-05-10 15:10:35 PDT
Created attachment 55607 [details] Only initialize the EventSender when loading the top frame
Martin Robinson
Comment 6 2010-05-10 19:09:42 PDT
Created attachment 55642 [details] Add leapForward support to the DRT
Martin Robinson
Comment 7 2010-05-10 19:32:11 PDT
Created attachment 55648 [details] Small EventSender cleanups
Martin Robinson
Comment 8 2010-05-10 20:50:52 PDT
Created attachment 55653 [details] Add leapForward support to the GTK+ DRT
Martin Robinson
Comment 9 2010-05-10 20:52:37 PDT
(In reply to comment #4) > Could the patch be divided like: > - Refactoring, these changes look nice: prepareMouseButtonEvent, sendOrQueueEvent, > - Fix click problems Thanks for the review! I've split the patch into two: 1. One to add rudimentary leapForward support which includes the initialization fix. 2. Another which includes the style fixes and add prepareMouseButtonEvent. > - leapForward support, why is this required? Could you just leave the main loop iterate as usual? > > + while (!doneLeapingForward) > + gtk_main_iteration(); > I think you're right here. I've reworked the logic a bit. It's simpler now, because we don't need a lot of the drag-and-drop stuff yet (perhaps until we add dropping support to the DRT and perhaps never).
Martin Robinson
Comment 10 2010-05-12 17:53:55 PDT
Created attachment 55917 [details] Take into account the timeOffset when synthesizing events in the DRT Added an additional change which adjust event time relative to the timeOffset controlled via leapForward. This will ensure that clicks going into WebKit will not be mistaken for double, quadruple, quintuple, sextuple, etc clicks.
Martin Robinson
Comment 11 2010-05-12 17:59:27 PDT
Created attachment 55918 [details] Take into account the timeOffset when synthesizing events in the DRT Added a patch with a small addition to the previous one.
Martin Robinson
Comment 12 2010-05-12 18:07:31 PDT
Created attachment 55919 [details] Take into account the timeOffset when synthesizing events in the DRT My sincere apologies for the patch spam. This should be correct version. It's been a long day.
Martin Robinson
Comment 13 2010-05-12 18:22:19 PDT
Created attachment 55922 [details] Send the proper mouse events during clicking I've added a patch that fixes the test. Click counting is now very similar to that of Win32, which also does not support native click counts above 2.
Martin Robinson
Comment 14 2010-05-12 20:35:17 PDT
Created attachment 55933 [details] Send the proper mouse events during clicking
Martin Robinson
Comment 15 2010-05-14 09:07:51 PDT
Created attachment 56076 [details] Send the proper mouse events during clicking (update) I've attached an updated version of the previous patch.
Xan Lopez
Comment 16 2010-05-14 09:47:49 PDT
Comment on attachment 55648 [details] Small EventSender cleanups Great stuff.
Martin Robinson
Comment 17 2010-05-14 11:57:38 PDT
Created attachment 56092 [details] Combine two related patches I've combined the leapForward support patch and the timeOffset update. These changes are very closely related and should probably be in the same patch.
Adam Barth
Comment 18 2010-05-14 23:31:16 PDT
Attachment 55648 [details] was posted by a committer and has review+, assigning to Martin Robinson for commit.
Martin Robinson
Comment 19 2010-05-27 06:32:51 PDT
Created attachment 57235 [details] Rudimentary leapForward support
Martin Robinson
Comment 20 2010-05-27 06:37:03 PDT
Comment on attachment 56092 [details] Combine two related patches Xan and Alex expressed some concern that sending events with the time component as GDK_CURRENT_TIME + timeOffset may have unintended consequences. I've attached a new patch which confines it to only mouseUp and mouseDown event simulation. These events are sent directly to the widget and should not affect GDK or GTK+ internal state.
Alejandro G. Castro
Comment 21 2010-05-27 10:57:32 PDT
(In reply to comment #19) > Created an attachment (id=57235) [details] > Rudimentary leapForward support Patch looks good to me, it has the leapForward feature and a lot of really nice refactoring that makes sense to me (refactor events sending in functions, remove variables, fix makeSenderEvent function). Nitpicking, there is a blank line added in the first line of the method mouseDownCallback.
Martin Robinson
Comment 22 2010-05-28 04:50:03 PDT
Created attachment 57317 [details] Rudimentary leapForward support (small fix)
Martin Robinson
Comment 23 2010-05-28 04:51:25 PDT
Comment on attachment 57235 [details] Rudimentary leapForward support I've attached a new patch which doesn't remove the missing line and alos fixes the issue where the timeOffset was used during mouse motion events, but not mouse down events.
Alejandro G. Castro
Comment 24 2010-06-01 04:02:51 PDT
I've checked the second one, after checking with marting a couple of things they look good and both tests work.
Xan Lopez
Comment 25 2010-06-01 04:43:32 PDT
Comment on attachment 56076 [details] Send the proper mouse events during clicking (update) >+ static gint doubleClickDistance = 0; >+ static gint doubleClickTime = 0; >+ if (!doubleClickDistance) { >+ GtkSettings* settings = gtk_settings_get_for_screen(gdk_drawable_get_screen(widget->window)); >+ g_object_get(settings, "gtk-double-click-distance", &doubleClickDistance, NULL); >+ g_object_get(settings, "gtk-double-click-time", &doubleClickTime, NULL); >+ } You should connect to the notify signal in case the values are updated. You can do this in a follow-up. >+ >+ PlatformMouseEvent platformEvent(event); >+ >+ if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS) >+ || ((abs(event->x - previousPoint.x()) < doubleClickDistance) >+ && (abs(event->y - previousPoint.y()) < doubleClickDistance) >+ && (event->time - previousTime < static_cast<guint>(doubleClickTime)) >+ && (event->button == previousButton))) >+ currentClickCount++; >+ else >+ currentClickCount = 1; We should have a comment explaining why do we have to do the manual check for increased click count (since GTK+ only checks up to triple click). LGTM otherwise.
Xan Lopez
Comment 26 2010-06-01 04:54:57 PDT
Comment on attachment 57317 [details] Rudimentary leapForward support (small fix) r=me
Martin Robinson
Comment 27 2010-06-01 07:59:02 PDT
Martin Robinson
Comment 28 2010-06-01 08:47:41 PDT
Martin Robinson
Comment 29 2010-06-01 10:18:13 PDT
(In reply to comment #25) Thanks for the review! > You should connect to the notify signal in case the values are updated. You can do this in a follow-up. Xan and I decided that it's better in this case to simply not cache these values. If we run into performance disadvantages later, we can fix them then.
Martin Robinson
Comment 30 2010-06-01 10:30:52 PDT
All patches landed as of r60482
WebKit Review Bot
Comment 31 2010-06-01 10:54:19 PDT
Note You need to log in before you can comment on or make changes to this bug.