RESOLVED FIXED 65875
[Qt][WK2] MiniBrowser is firing twice the QDesktopWebView::mousePressEvent method
https://bugs.webkit.org/show_bug.cgi?id=65875
Summary [Qt][WK2] MiniBrowser is firing twice the QDesktopWebView::mousePressEvent me...
Igor Trindade Oliveira
Reported 2011-08-08 14:12:57 PDT
Using MiniBrowser i noticed it is firing twice the QDesktopWebView::mousePressEvent method when the moused is pressed anywhere on the screen.
Attachments
Patch. (2.03 KB, patch)
2011-08-08 14:19 PDT, Igor Trindade Oliveira
benjamin: review-
Test Case (473 bytes, text/html)
2011-08-09 12:32 PDT, Igor Trindade Oliveira
no flags
Patch (2.51 KB, patch)
2011-08-09 16:59 PDT, Igor Trindade Oliveira
igor.oliveira: review-
igor.oliveira: commit-queue-
Patch (2.51 KB, patch)
2011-08-09 17:01 PDT, Igor Trindade Oliveira
benjamin: review-
Patch (3.15 KB, patch)
2011-08-10 10:16 PDT, Igor Trindade Oliveira
no flags
Patch (3.74 KB, patch)
2011-08-10 11:32 PDT, Igor Trindade Oliveira
no flags
Patch (1.52 KB, patch)
2011-08-10 12:00 PDT, Benjamin Poulain
no flags
Patch (2.04 KB, patch)
2011-08-10 12:51 PDT, Benjamin Poulain
no flags
Igor Trindade Oliveira
Comment 1 2011-08-08 14:19:13 PDT
Created attachment 103291 [details] Patch. Proposed patch
Benjamin Poulain
Comment 2 2011-08-08 15:28:48 PDT
Comment on attachment 103291 [details] Patch. View in context: https://bugs.webkit.org/attachment.cgi?id=103291&action=review > Tools/MiniBrowser/qt/MiniBrowserApplication.cpp:107 > if (m_touchPoints.contains(touchPoint.id())) > touchPoint.setState(Qt::TouchPointMoved); > - else > - touchPoint.setState(Qt::TouchPointPressed); > + else { > + if (mouseEvent->modifiers().testFlag(Qt::ControlModifier)) > + touchPoint.setState(Qt::TouchPointPressed); > + } It seems to me that the problem might be that m_touchPoints.contains(touchPoint.id()) == false. If the touchpoint is still active because, it should be in m_touchPoints.
Igor Trindade Oliveira
Comment 3 2011-08-09 12:32:07 PDT
Created attachment 103384 [details] Test Case Adding Test case.
Igor Trindade Oliveira
Comment 4 2011-08-09 12:35:55 PDT
Probably we are talking about two different things. I added a test case where onmousedown event is firing two times the callback. It happens because QDesktopWebView::mousePressEvent is called twice. (In reply to comment #2) > (From update of attachment 103291 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=103291&action=review > > > Tools/MiniBrowser/qt/MiniBrowserApplication.cpp:107 > > if (m_touchPoints.contains(touchPoint.id())) > > touchPoint.setState(Qt::TouchPointMoved); > > - else > > - touchPoint.setState(Qt::TouchPointPressed); > > + else { > > + if (mouseEvent->modifiers().testFlag(Qt::ControlModifier)) > > + touchPoint.setState(Qt::TouchPointPressed); > > + } > > It seems to me that the problem might be that m_touchPoints.contains(touchPoint.id()) == false. > If the touchpoint is still active because, it should be in m_touchPoints.
Igor Trindade Oliveira
Comment 5 2011-08-09 16:59:41 PDT
Created attachment 103418 [details] Patch Updating proposed patch with a better ChangeLog explaining the modifications.
WebKit Review Bot
Comment 6 2011-08-09 17:01:07 PDT
Attachment 103418 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Tools/ChangeLog', u'Tools/MiniBrowser/qt/M..." exit_code: 1 Tools/MiniBrowser/qt/MiniBrowserApplication.cpp:104: Missing space before ( in if( [whitespace/parens] [5] Total errors found: 1 in 2 files If any of these errors are false positives, please file a bug against check-webkit-style.
Igor Trindade Oliveira
Comment 7 2011-08-09 17:01:27 PDT
Created attachment 103419 [details] Patch Proposed patch.
Benjamin Poulain
Comment 8 2011-08-10 06:20:50 PDT
Comment on attachment 103419 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=103419&action=review This has nothing to do with the ControlModifier. The problem is we still send the original mouse event after we send the touch events. QWidget also generate a fake mouse event for the touch event so we end up with 2 mouse events. The original event should be discarded when a touch event is generated. > Tools/ChangeLog:9 > + On some windowing systems, mouse events are also sent for the primary touch point. This > + means it is possible for your widget to receive both QTouchEvent and QMouseEvent for the > + same user interaction point. MiniBrowser when setting the Qt::TouchPointPressed for a touch Qt is supposed to always give you a mouse event for the primary touch point. > Tools/ChangeLog:12 > + to be called twice for a single mouse click. Now the Qt::TouchPointPressed is used just > + when Ctrl modifier is pressed. This is not at all the intended behavior of the code of touch mocking.
Igor Trindade Oliveira
Comment 9 2011-08-10 10:16:37 PDT
Created attachment 103500 [details] Patch Proposed patch.
Igor Trindade Oliveira
Comment 10 2011-08-10 11:32:43 PDT
Created attachment 103509 [details] Patch Updated patch.
Benjamin Poulain
Comment 11 2011-08-10 12:00:46 PDT
Benjamin Poulain
Comment 12 2011-08-10 12:02:18 PDT
Shouldn't this approach just work?
Benjamin Poulain
Comment 13 2011-08-10 12:16:25 PDT
Comment on attachment 103513 [details] Patch I cq-, let's not land that before Igor has a look.
Benjamin Poulain
Comment 14 2011-08-10 12:51:23 PDT
Kenneth Rohde Christiansen
Comment 15 2011-08-10 13:59:30 PDT
Comment on attachment 103520 [details] Patch Looks OK. If this solves it, r=me
Benjamin Poulain
Comment 16 2011-08-10 14:42:23 PDT
Comment on attachment 103520 [details] Patch Let's land that. Freaking QWidget hacks... :)
WebKit Review Bot
Comment 17 2011-08-10 14:52:05 PDT
Comment on attachment 103520 [details] Patch Clearing flags on attachment: 103520 Committed r92799: <http://trac.webkit.org/changeset/92799>
WebKit Review Bot
Comment 18 2011-08-10 14:52:11 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.