From 58b0b91db2a3ac7bb78894479e2da7238db814f6 Mon Sep 17 00:00:00 2001
|
From: Takuro Ashie <ashie@clear-code.com>
|
Date: Sun, 14 Jul 2019 14:26:44 +0900
|
Subject: [PATCH] Bug 1451816 - Workarround for grabbing focus on weston
|
|
See https://bugzilla.mozilla.org/show_bug.cgi?id=1451816 for more
|
detail.
|
|
Upstream-Status: Denied [Fixed by GTK-3.24's new feature]
|
|
Signed-off-by: Takuro Ashie <ashie@clear-code.com>
|
|
---
|
widget/gtk/nsWindow.cpp | 17 +++++++++++++++++
|
1 file changed, 17 insertions(+)
|
|
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
|
index b64fc87a94..8d661794db 100644
|
--- a/widget/gtk/nsWindow.cpp
|
+++ b/widget/gtk/nsWindow.cpp
|
@@ -145,6 +145,10 @@ using namespace mozilla::layers;
|
using mozilla::gl::GLContext;
|
using mozilla::gl::GLContextGLX;
|
|
+#ifdef MOZ_WAYLAND
|
+static bool gPointerGrabbed = false;
|
+#endif
|
+
|
// Don't put more than this many rects in the dirty region, just fluff
|
// out to the bounding-box if there are more
|
#define MAX_RECTS_IN_REGION 100
|
@@ -2919,6 +2923,11 @@ void nsWindow::OnContainerFocusInEvent(GdkEventFocus* aEvent) {
|
void nsWindow::OnContainerFocusOutEvent(GdkEventFocus* aEvent) {
|
LOGFOCUS(("OnContainerFocusOutEvent [%p]\n", (void*)this));
|
|
+#ifdef MOZ_WAYLAND
|
+ if (gtk_check_version(3, 24, 0) != nullptr && gPointerGrabbed)
|
+ return;
|
+#endif
|
+
|
if (mWindowType == eWindowType_toplevel ||
|
mWindowType == eWindowType_dialog) {
|
nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
|
@@ -4750,6 +4759,10 @@ void nsWindow::GrabPointer(guint32 aTime) {
|
if (!mIsX11Display) {
|
// Don't to the grab on Wayland as it causes a regression
|
// from Bug 1377084.
|
+#ifdef MOZ_WAYLAND
|
+ if (gtk_check_version(3, 24, 0) != nullptr)
|
+ gPointerGrabbed = true;
|
+#endif
|
return;
|
}
|
|
@@ -4789,6 +4802,10 @@ void nsWindow::ReleaseGrabs(void) {
|
if (!mIsX11Display) {
|
// Don't to the ungrab on Wayland as it causes a regression
|
// from Bug 1377084.
|
+#ifdef MOZ_WAYLAND
|
+ if (gtk_check_version(3, 24, 0) != nullptr)
|
+ gPointerGrabbed = false;
|
+#endif
|
return;
|
}
|
|