summaryrefslogtreecommitdiff
path: root/waterfox/patch-bug1321069
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-04-14 08:21:22 -0400
committerB Stack <bgstack15@gmail.com>2020-04-14 08:21:22 -0400
commit55e113682281239a64472bc2a7888b51c5742f45 (patch)
treec3841f4464e830af9826ecc34f8213b889c3eae0 /waterfox/patch-bug1321069
parentchange comment syntax in d/c (diff)
downloadstackrpms-55e113682281239a64472bc2a7888b51c5742f45.tar.gz
stackrpms-55e113682281239a64472bc2a7888b51c5742f45.tar.bz2
stackrpms-55e113682281239a64472bc2a7888b51c5742f45.zip
wf 202.04 rpm rc1
Diffstat (limited to 'waterfox/patch-bug1321069')
-rw-r--r--waterfox/patch-bug1321069102
1 files changed, 102 insertions, 0 deletions
diff --git a/waterfox/patch-bug1321069 b/waterfox/patch-bug1321069
new file mode 100644
index 0000000..6663400
--- /dev/null
+++ b/waterfox/patch-bug1321069
@@ -0,0 +1,102 @@
+commit a09c25bcc3b4
+Author: Kartikaya Gupta <kgupta@mozilla.com>
+Date: Wed May 30 09:49:23 2018 -0400
+
+ Bug 1321069 - Redirect the end event of a long-tap sequence back to the content window. r=karlt, a=RyanVM
+
+ In the case of a long-tap touch sequence, a new popup window (the
+ contextmenu) is spawned while the sequence is ongoing. The touch-end of
+ the sequence ends up getting delivered to the popup window, instead of
+ the original content window, and that causes the touch-handling
+ machinery state in the content window to get out of sync with reality.
+ This patch detects this scenario and redirects the touch events on the
+ popup window back to the original content window.
+
+ MozReview-Commit-ID: L2vvKLlogRA
+
+ --HG--
+ extra : source : 27a160b7025ffaadd7cc1ce326ce8729c2b180a0
+---
+ widget/gtk/nsWindow.cpp | 36 +++++++++++++++++++++++++++++++++++-
+ widget/gtk/nsWindow.h | 3 +++
+ 2 files changed, 38 insertions(+), 1 deletion(-)
+
+diff --git widget/gtk/nsWindow.cpp widget/gtk/nsWindow.cpp
+index 54ec8615051f1..18d0ccac4dbd6 100644
+--- widget/gtk/nsWindow.cpp
++++ widget/gtk/nsWindow.cpp
+@@ -3455,11 +3455,41 @@ nsWindow::OnDragDataReceivedEvent(GtkWidget *aWidget,
+ aSelectionData, aInfo, aTime);
+ }
+
++nsWindow*
++nsWindow::GetTransientForWindowIfPopup()
++{
++ if (mWindowType != eWindowType_popup) {
++ return nullptr;
++ }
++ GtkWindow* toplevel = gtk_window_get_transient_for(GTK_WINDOW(mShell));
++ if (toplevel) {
++ return get_window_for_gtk_widget(GTK_WIDGET(toplevel));
++ }
++ return nullptr;
++}
++
++bool
++nsWindow::IsHandlingTouchSequence(GdkEventSequence* aSequence)
++{
++ return mHandleTouchEvent && mTouches.Contains(aSequence);
++}
++
+ #if GTK_CHECK_VERSION(3,4,0)
+ gboolean
+ nsWindow::OnTouchEvent(GdkEventTouch* aEvent)
+ {
+ if (!mHandleTouchEvent) {
++ // If a popup window was spawned (e.g. as the result of a long-press)
++ // and touch events got diverted to that window within a touch sequence,
++ // ensure the touch event gets sent to the original window instead. We
++ // keep the checks here very conservative so that we only redirect
++ // events in this specific scenario.
++ nsWindow* targetWindow = GetTransientForWindowIfPopup();
++ if (targetWindow &&
++ targetWindow->IsHandlingTouchSequence(aEvent->sequence)) {
++ return targetWindow->OnTouchEvent(aEvent);
++ }
++
+ return FALSE;
+ }
+
+@@ -4780,12 +4810,16 @@ nsWindow::GrabPointer(guint32 aTime)
+ return;
+
+ gint retval;
++ // Note that we need GDK_TOUCH_MASK below to work around a GDK/X11 bug that
++ // causes touch events that would normally be received by this client on
++ // other windows to be discarded during the grab.
+ retval = gdk_pointer_grab(mGdkWindow, TRUE,
+ (GdkEventMask)(GDK_BUTTON_PRESS_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_ENTER_NOTIFY_MASK |
+ GDK_LEAVE_NOTIFY_MASK |
+- GDK_POINTER_MOTION_MASK),
++ GDK_POINTER_MOTION_MASK |
++ GDK_TOUCH_MASK),
+ (GdkWindow *)nullptr, nullptr, aTime);
+
+ if (retval == GDK_GRAB_NOT_VIEWABLE) {
+diff --git widget/gtk/nsWindow.h widget/gtk/nsWindow.h
+index c28c1749c76dc..33e8c4db7c1c0 100644
+--- widget/gtk/nsWindow.h
++++ widget/gtk/nsWindow.h
+@@ -434,7 +434,10 @@ private:
+ nsIWidgetListener* GetListener();
+ bool IsComposited() const;
+
+ void UpdateClientOffsetForCSDWindow();
++
++ nsWindow* GetTransientForWindowIfPopup();
++ bool IsHandlingTouchSequence(GdkEventSequence* aSequence);
+
+ GtkWidget *mShell;
+ MozContainer *mContainer;
bgstack15