summaryrefslogtreecommitdiff
path: root/D53011-remote-content-disappear-fix.diff
diff options
context:
space:
mode:
authorJan Horak <jhorak@redhat.com>2019-11-21 15:55:32 +0100
committerJan Horak <jhorak@redhat.com>2019-11-21 15:55:32 +0100
commit1ed5beacbb6a9d98b9092d3653fb1902edbc0a35 (patch)
treeb4cbb9dbc17c15bad122919bd3c7c2f69cec7806 /D53011-remote-content-disappear-fix.diff
parentBuild against rust 1.38 (diff)
downloadlibrewolf-fedora-ff-1ed5beacbb6a9d98b9092d3653fb1902edbc0a35.tar.gz
librewolf-fedora-ff-1ed5beacbb6a9d98b9092d3653fb1902edbc0a35.tar.bz2
librewolf-fedora-ff-1ed5beacbb6a9d98b9092d3653fb1902edbc0a35.zip
Added fixes for missing overflow widget windows and <select> dropdown on multimonitor setup
Diffstat (limited to 'D53011-remote-content-disappear-fix.diff')
-rw-r--r--D53011-remote-content-disappear-fix.diff98
1 files changed, 98 insertions, 0 deletions
diff --git a/D53011-remote-content-disappear-fix.diff b/D53011-remote-content-disappear-fix.diff
new file mode 100644
index 0000000..f7c9f38
--- /dev/null
+++ b/D53011-remote-content-disappear-fix.diff
@@ -0,0 +1,98 @@
+diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h
+--- a/widget/gtk/nsWindow.h
++++ b/widget/gtk/nsWindow.h
+@@ -401,6 +401,8 @@
+ #ifdef MOZ_WAYLAND
+ virtual nsresult GetScreenRect(LayoutDeviceIntRect* aRect) override;
+ #endif
++ bool IsRemoteContent() { return HasRemoteContent(); }
++ static void HideWaylandOpenedPopups();
+
+ 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
+@@ -1165,6 +1165,14 @@
+ }
+ }
+
++void nsWindow::HideWaylandOpenedPopups() {
++ while (gVisibleWaylandPopupWindows) {
++ nsWindow* window =
++ static_cast<nsWindow*>(gVisibleWaylandPopupWindows->data);
++ window->HideWaylandWindow();
++ }
++}
++
+ // Hide popup nsWindows which are no longer in the nsXULPopupManager widget
+ // chain list.
+ void nsWindow::CleanupWaylandPopups() {
+@@ -1218,7 +1226,10 @@
+ // popup needs to have an unique parent.
+ GtkWidget* nsWindow::ConfigureWaylandPopupWindows() {
+ MOZ_ASSERT(this->mWindowType == eWindowType_popup);
+- LOG(("nsWindow::ConfigureWaylandPopupWindows [%p]\n", (void*)this));
++ LOG(
++ ("nsWindow::ConfigureWaylandPopupWindows [%p], frame %p hasRemoteContent "
++ "%d\n",
++ (void*)this, this->GetFrame(), this->HasRemoteContent()));
+ #if DEBUG
+ if (this->GetFrame() && this->GetFrame()->GetContent()->GetID()) {
+ nsCString nodeId;
+@@ -1245,14 +1256,14 @@
+ // gVisibleWaylandPopupWindows which were not yet been hidden.
+ CleanupWaylandPopups();
+ // Since the popups are shown by unknown order it can happen that child
+- // popup is shown before parent popup. The
++ // popup is shown before parent popup.
+ // We look for the current window parent in nsXULPopupManager since it
+ // always has correct popup hierarchy while gVisibleWaylandPopupWindows may
+ // not.
+ nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
+ AutoTArray<nsIWidget*, 5> widgetChain;
+ pm->GetSubmenuWidgetChain(&widgetChain);
+- for (unsigned long i = 0; i < widgetChain.Length(); i++) {
++ for (unsigned long i = 0; i < widgetChain.Length() - 1; i++) {
+ unsigned long parentIndex = i + 1;
+ if (widgetChain.Length() > parentIndex && widgetChain[i] == this) {
+ nsWindow* parentWindow =
+@@ -1264,6 +1275,29 @@
+ }
+ }
+ } else {
++ // Panels usually ends there
++ if (gVisibleWaylandPopupWindows && HasRemoteContent()) {
++ // If the new panel is remote content, we need to close all other popups
++ // before to keep the correct hierarchy because the remote content popup
++ // can replace the overflow-widget panel.
++ HideWaylandOpenedPopups();
++ } else if (gVisibleWaylandPopupWindows) {
++ // If there is any remote content panel currently opened, close all
++ // opened popups to keep the correct hierarchy.
++ GList* popupList = gVisibleWaylandPopupWindows;
++ while (popupList) {
++ nsWindow* waylandWnd = static_cast<nsWindow*>(popupList->data);
++ LOG((" Checking [%p] IsRemoteContent %d\n", popupList->data,
++ waylandWnd->IsRemoteContent()));
++ if (waylandWnd->IsRemoteContent()) {
++ // close all popups including remote content before showing our panel
++ // Most likely returning from addon panel to overflow-widget.
++ HideWaylandOpenedPopups();
++ break;
++ }
++ popupList = popupList->next;
++ }
++ }
+ // For popups in panels use the last opened popup window as parent,
+ // panels are not stored in nsXULPopupManager.
+ if (gVisibleWaylandPopupWindows) {
+@@ -4380,6 +4414,7 @@
+ void nsWindow::HideWaylandWindow() {
+ #ifdef MOZ_WAYLAND
+ if (mWindowType == eWindowType_popup) {
++ LOG(("nsWindow::HideWaylandWindow: popup [%p]\n", this));
+ GList* foundWindow = g_list_find(gVisibleWaylandPopupWindows, this);
+ if (foundWindow) {
+ gVisibleWaylandPopupWindows =
+
bgstack15