kalev / rpms / firefox

Forked from rpms/firefox 5 years ago
Clone
83e8010
diff -up firefox-66.0/layout/xul/moz.build.mozilla-1532643-popup firefox-66.0/layout/xul/moz.build
83e8010
--- firefox-66.0/layout/xul/moz.build.mozilla-1532643-popup	2019-03-12 01:22:20.000000000 +0100
83e8010
+++ firefox-66.0/layout/xul/moz.build	2019-03-12 12:21:43.036982252 +0100
83e8010
@@ -88,3 +88,6 @@ LOCAL_INCLUDES += [
83e8010
 
83e8010
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
83e8010
     CXXFLAGS += ['-Wno-error=shadow']
83e8010
+
83e8010
+CFLAGS += CONFIG['TK_CFLAGS']
83e8010
+CXXFLAGS += CONFIG['TK_CFLAGS']
83e8010
diff -up firefox-66.0/layout/xul/nsMenuPopupFrame.cpp.mozilla-1532643-popup firefox-66.0/layout/xul/nsMenuPopupFrame.cpp
83e8010
--- firefox-66.0/layout/xul/nsMenuPopupFrame.cpp.mozilla-1532643-popup	2019-03-12 01:22:20.000000000 +0100
83e8010
+++ firefox-66.0/layout/xul/nsMenuPopupFrame.cpp	2019-03-12 12:23:11.860770255 +0100
83e8010
@@ -55,6 +55,10 @@
83e8010
 #include "mozilla/dom/KeyboardEvent.h"
83e8010
 #include "mozilla/dom/KeyboardEventBinding.h"
83e8010
 #include <algorithm>
83e8010
+#ifdef MOZ_WAYLAND
83e8010
+#include <gdk/gdk.h>
83e8010
+#include <gdk/gdkx.h>
83e8010
+#endif /* MOZ_WAYLAND */
83e8010
 
83e8010
 using namespace mozilla;
83e8010
 using mozilla::dom::Event;
83e8010
@@ -298,11 +302,29 @@ nsresult nsMenuPopupFrame::CreateWidgetF
83e8010
       !(mode == eTransparencyTransparent || tag == nsGkAtoms::menulist);
83e8010
   widgetData.mPopupLevel = PopupLevel(widgetData.mNoAutoHide);
83e8010
 
83e8010
+  static bool waylandBackend =
83e8010
+#ifdef MOZ_WAYLAND
83e8010
+    !GDK_IS_X11_DISPLAY(gdk_display_get_default());
83e8010
+#else
83e8010
+    false;
83e8010
+#endif
83e8010
+
83e8010
   // panels which have a parent level need a parent widget. This allows them to
83e8010
   // always appear in front of the parent window but behind other windows that
83e8010
   // should be in front of it.
83e8010
   nsCOMPtr<nsIWidget> parentWidget;
83e8010
-  if (widgetData.mPopupLevel != ePopupLevelTop) {
83e8010
+  if (waylandBackend) {
83e8010
+    // On Wayland we always need to connect menu to its parent menu widget
83e8010
+    // otherwise it's not shown.
83e8010
+    nsMenuFrame* menuFrame = do_QueryFrame(GetParent());
83e8010
+    if (menuFrame) {
83e8010
+      nsMenuParent* parentPopup = menuFrame->GetMenuParent();
83e8010
+      if (parentPopup && parentPopup->IsMenu()) {
83e8010
+        parentWidget =
83e8010
+          static_cast<nsMenuPopupFrame*>(parentPopup)->GetWidget();
83e8010
+      }
83e8010
+    }
83e8010
+  } else if (widgetData.mPopupLevel != ePopupLevelTop) {
83e8010
     nsCOMPtr<nsIDocShellTreeItem> dsti = PresContext()->GetDocShell();
83e8010
     if (!dsti) return NS_ERROR_FAILURE;
83e8010
 
83e8010
diff -up firefox-66.0/widget/gtk/nsWindow.cpp.mozilla-1532643-popup firefox-66.0/widget/gtk/nsWindow.cpp
83e8010
--- firefox-66.0/widget/gtk/nsWindow.cpp.mozilla-1532643-popup	2019-03-12 12:21:43.034982257 +0100
83e8010
+++ firefox-66.0/widget/gtk/nsWindow.cpp	2019-03-12 12:21:43.037982249 +0100
83e8010
@@ -3485,11 +3485,7 @@ nsresult nsWindow::Create(nsIWidget *aPa
83e8010
         } else {
83e8010
           switch (aInitData->mPopupHint) {
83e8010
             case ePopupTypeMenu:
83e8010
-              // Use GDK_WINDOW_TYPE_HINT_UTILITY on Wayland which
83e8010
-              // guides Gtk to create the popup as subsurface
83e8010
-              // instead of xdg_shell popup (see Bug 1423598).
83e8010
-              gtkTypeHint = mIsX11Display ? GDK_WINDOW_TYPE_HINT_POPUP_MENU
83e8010
-                                          : GDK_WINDOW_TYPE_HINT_UTILITY;
83e8010
+              gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
83e8010
               break;
83e8010
             case ePopupTypeTooltip:
83e8010
               gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;