summaryrefslogtreecommitdiff
path: root/mozilla-1532643-popup.patch
blob: 3b870a2727c410545eefc2568c4f73875d56b37a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
diff -up firefox-67.0/layout/xul/moz.build.mozilla-1532643-popup firefox-67.0/layout/xul/moz.build
--- firefox-67.0/layout/xul/moz.build.mozilla-1532643-popup	2019-05-14 01:08:24.000000000 +0200
+++ firefox-67.0/layout/xul/moz.build	2019-05-15 15:31:39.714299754 +0200
@@ -88,3 +88,6 @@ LOCAL_INCLUDES += [
 
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
+
+CFLAGS += CONFIG['TK_CFLAGS']
+CXXFLAGS += CONFIG['TK_CFLAGS']
diff -up firefox-67.0/layout/xul/nsMenuPopupFrame.cpp.mozilla-1532643-popup firefox-67.0/layout/xul/nsMenuPopupFrame.cpp
--- firefox-67.0/layout/xul/nsMenuPopupFrame.cpp.mozilla-1532643-popup	2019-05-14 01:08:24.000000000 +0200
+++ firefox-67.0/layout/xul/nsMenuPopupFrame.cpp	2019-05-15 15:37:01.121215863 +0200
@@ -55,6 +55,10 @@
 #include "mozilla/dom/KeyboardEvent.h"
 #include "mozilla/dom/KeyboardEventBinding.h"
 #include <algorithm>
+#ifdef MOZ_WAYLAND
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#endif /* MOZ_WAYLAND */
 
 using namespace mozilla;
 using mozilla::dom::Document;
@@ -301,11 +305,29 @@ nsresult nsMenuPopupFrame::CreateWidgetF
       !(mode == eTransparencyTransparent || tag == nsGkAtoms::menulist);
   widgetData.mPopupLevel = PopupLevel(widgetData.mNoAutoHide);
 
+  static bool waylandBackend =
+#ifdef MOZ_WAYLAND
+    !GDK_IS_X11_DISPLAY(gdk_display_get_default());
+#else
+    false;
+#endif
+
   // panels which have a parent level need a parent widget. This allows them to
   // always appear in front of the parent window but behind other windows that
   // should be in front of it.
   nsCOMPtr<nsIWidget> parentWidget;
-  if (widgetData.mPopupLevel != ePopupLevelTop) {
+  if (waylandBackend) {
+    // On Wayland we always need to connect menu to its parent menu widget
+    // otherwise it's not shown.
+    nsMenuFrame* menuFrame = do_QueryFrame(GetParent());
+    if (menuFrame) {
+      nsMenuParent* parentPopup = menuFrame->GetMenuParent();
+      if (parentPopup && parentPopup->IsMenu()) {
+        parentWidget =
+          static_cast<nsMenuPopupFrame*>(parentPopup)->GetWidget();
+      }
+    }
+  } else if (widgetData.mPopupLevel != ePopupLevelTop) {
     nsCOMPtr<nsIDocShellTreeItem> dsti = PresContext()->GetDocShell();
     if (!dsti) return NS_ERROR_FAILURE;
 
diff -up firefox-67.0/widget/gtk/nsWindow.cpp.mozilla-1532643-popup firefox-67.0/widget/gtk/nsWindow.cpp
--- firefox-67.0/widget/gtk/nsWindow.cpp.mozilla-1532643-popup	2019-05-15 15:31:39.712299764 +0200
+++ firefox-67.0/widget/gtk/nsWindow.cpp	2019-05-15 15:31:39.716299744 +0200
@@ -3527,11 +3527,7 @@ nsresult nsWindow::Create(nsIWidget *aPa
         } else {
           switch (aInitData->mPopupHint) {
             case ePopupTypeMenu:
-              // Use GDK_WINDOW_TYPE_HINT_UTILITY on Wayland which
-              // guides Gtk to create the popup as subsurface
-              // instead of xdg_shell popup (see Bug 1423598).
-              gtkTypeHint = mIsX11Display ? GDK_WINDOW_TYPE_HINT_POPUP_MENU
-                                          : GDK_WINDOW_TYPE_HINT_UTILITY;
+              gtkTypeHint = GDK_WINDOW_TYPE_HINT_POPUP_MENU;
               break;
             case ePopupTypeTooltip:
               gtkTypeHint = GDK_WINDOW_TYPE_HINT_TOOLTIP;
bgstack15