From b72d36d69d62856a49ee2b760abcf74fb3d6901b Mon Sep 17 00:00:00 2001 From: Jan Horak Date: Wed, 15 Jan 2020 18:12:50 +0100 Subject: Added fix for wrong cursor offset of popup windows and bumped required nss --- firefox.spec | 12 +++- mozilla-1607404-fix-remote-offset.patch | 109 ++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 3 deletions(-) create mode 100644 mozilla-1607404-fix-remote-offset.patch diff --git a/firefox.spec b/firefox.spec index f3d6ee4..0ed9d14 100644 --- a/firefox.spec +++ b/firefox.spec @@ -74,7 +74,7 @@ ExcludeArch: s390x %if %{?system_nss} %global nspr_version 4.21 %global nspr_build_version %{nspr_version} -%global nss_version 3.45 +%global nss_version 3.48.0 %global nss_build_version %{nss_version} %endif @@ -102,7 +102,7 @@ ExcludeArch: s390x Summary: Mozilla Firefox Web browser Name: firefox Version: 72.0.1 -Release: 1%{?dist} +Release: 2%{?dist} URL: https://www.mozilla.org/firefox/ License: MPLv1.1 or GPLv2+ or LGPLv2+ Source0: https://archive.mozilla.org/pub/firefox/releases/%{version}%{?pre_version}/source/firefox-%{version}%{?pre_version}.source.tar.xz @@ -165,6 +165,7 @@ Patch417: bug1375074-save-restore-x28.patch Patch419: mozilla-1568569.patch Patch422: mozilla-1580174-webrtc-popup.patch Patch426: mozilla-1603112-accept-lang.patch +Patch427: mozilla-1607404-fix-remote-offset.patch # Wayland specific upstream patches Patch574: firefox-pipewire.patch @@ -231,7 +232,7 @@ BuildRequires: python2-devel Requires: u2f-hidraw-policy %endif BuildRequires: nss-devel >= 3.29.1-2.1 -Requires: nss >= 3.29.1-2.1 +Requires: nss >= 3.48.0 BuildRequires: desktop-file-utils %if !0%{?flatpak} @@ -365,6 +366,7 @@ This package contains results of tests executed during build. # dropdown missing on multimonitor # fix for wrong intl.accept_lang when using non en-us langpack %patch426 -p1 -b .1603112-accept-lang +%patch427 -p1 -b .1607404-fix-remote-offset # Wayland specific upstream patches %patch574 -p1 -b .firefox-pipewire @@ -933,6 +935,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : #--------------------------------------------------------------------- %changelog +* Wed Jan 15 2020 Jan Horak - 72.0.1-2 +- Added fix for wrong cursor offset of popup windows and bumped required nss + version + * Wed Jan 08 2020 Jan Horak - 72.0.1-1 - Update to 72.0.1 build1 diff --git a/mozilla-1607404-fix-remote-offset.patch b/mozilla-1607404-fix-remote-offset.patch new file mode 100644 index 0000000..41a6fdc --- /dev/null +++ b/mozilla-1607404-fix-remote-offset.patch @@ -0,0 +1,109 @@ +diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h +--- a/widget/gtk/nsWindow.h ++++ b/widget/gtk/nsWindow.h +@@ -427,6 +427,8 @@ + #endif + bool IsRemoteContent() { return HasRemoteContent(); } + static void HideWaylandOpenedPopups(); ++ void NativeMoveResizeWaylandPopupCB(const GdkRectangle* aFinalSize, ++ bool aFlippedX, bool aFlippedY); + + protected: + virtual ~nsWindow(); +diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp +--- a/widget/gtk/nsWindow.cpp ++++ b/widget/gtk/nsWindow.cpp +@@ -1333,7 +1333,6 @@ + return GTK_WIDGET(parentGtkWindow); + } + +-#ifdef DEBUG + static void NativeMoveResizeWaylandPopupCallback( + GdkWindow* window, const GdkRectangle* flipped_rect, + const GdkRectangle* final_rect, gboolean flipped_x, gboolean flipped_y, +@@ -1341,12 +1340,60 @@ + LOG(("NativeMoveResizeWaylandPopupCallback [%p] flipped_x %d flipped_y %d\n", + aWindow, flipped_x, flipped_y)); + +- LOG((" flipped_rect x: %d y: %d width: %d height: %d\n", flipped_rect->x, ++ LOG((" flipped_rect x=%d y=%d width=%d height=%d\n", flipped_rect->x, + flipped_rect->y, flipped_rect->width, flipped_rect->height)); +- LOG((" final_rect x: %d y: %d width: %d height: %d\n", final_rect->x, ++ LOG((" final_rect x=%d y=%d width=%d height=%d\n", final_rect->x, + final_rect->y, final_rect->width, final_rect->height)); +-} +-#endif ++ nsWindow* wnd = get_window_for_gdk_window(window); ++ ++ wnd->NativeMoveResizeWaylandPopupCB(final_rect, flipped_x, flipped_y); ++} ++ ++void nsWindow::NativeMoveResizeWaylandPopupCB(const GdkRectangle* aFinalSize, ++ bool aFlippedX, bool aFlippedY) { ++ LOG((" orig mBounds x=%d y=%d width=%d height=%d\n", mBounds.x, mBounds.y, ++ mBounds.width, mBounds.height)); ++ ++ GtkWindow* parentGtkWindow = gtk_window_get_transient_for(GTK_WINDOW(mShell)); ++ if (!parentGtkWindow) { ++ NS_WARNING("Popup has no parent!"); ++ return; ++ } ++ ++ // The position of the menu in GTK is relative to it's parent window while ++ // in mBounds we have position relative to toplevel window. We need to check ++ // and update mBounds in the toplevel coordinates. ++ int x_parent, y_parent; ++ gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(parentGtkWindow)), ++ &x_parent, &y_parent); ++ ++ LayoutDeviceIntRect newBounds(aFinalSize->x + x_parent, ++ aFinalSize->y + y_parent, aFinalSize->width, ++ aFinalSize->height); ++ ++ newBounds.Scale(nsWindow::GdkScaleFactor()); ++ LOG((" new mBounds x=%d y=%d width=%d height=%d\n", newBounds.x, ++ newBounds.y, newBounds.width, newBounds.height)); ++ ++ bool needsPositionUpdate = ++ (newBounds.x != mBounds.x || newBounds.y != mBounds.y); ++ bool needsSizeUpdate = ++ (newBounds.width != mBounds.width || newBounds.height != mBounds.height); ++ ++ if (!needsPositionUpdate && !needsSizeUpdate) { ++ return; ++ } ++ ++ if (needsPositionUpdate && needsSizeUpdate) { ++ Resize(newBounds.x, newBounds.y, newBounds.width, newBounds.height, true); ++ NotifyWindowMoved(newBounds.x, newBounds.y); ++ } else if (needsPositionUpdate) { ++ Move(newBounds.x, newBounds.y); ++ NotifyWindowMoved(newBounds.x, newBounds.y); ++ } else { ++ Resize(newBounds.width, newBounds.height, true); ++ } ++} + + void nsWindow::NativeMoveResizeWaylandPopup(GdkPoint* aPosition, + GdkRectangle* aSize) { +@@ -1392,15 +1439,16 @@ + rect.width = aSize->width; + rect.height = aSize->height; + } +- +-#ifdef DEBUG ++ LOG((" x_parent %d y_parent %d\n", x_parent, y_parent)); ++ LOG((" aPosition x %d aPosition y %d\n", aPosition->x, aPosition->y)); ++ LOG((" rect.x %d rect.y %d\n", rect.x, rect.y)); ++ + if (!g_signal_handler_find( + gdkWindow, G_SIGNAL_MATCH_FUNC, 0, 0, nullptr, + FuncToGpointer(NativeMoveResizeWaylandPopupCallback), this)) { + g_signal_connect(gdkWindow, "moved-to-rect", + G_CALLBACK(NativeMoveResizeWaylandPopupCallback), this); + } +-#endif + + GdkGravity rectAnchor = GDK_GRAVITY_NORTH_WEST; + GdkGravity menuAnchor = GDK_GRAVITY_NORTH_WEST; + -- cgit