summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PKGBUILD12
-rw-r--r--mozconfig.cfg1
-rw-r--r--unity-menubar.patch452
3 files changed, 287 insertions, 178 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 1056bd0a84c3..a1b4006fd9fe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -12,7 +12,7 @@
_pkgname=thunderbird
pkgname=thunderbird-appmenu
-pkgver=78.12.0
+pkgver=91.0
pkgrel=1
pkgdesc="Thunderbird from extra with appmenu patch"
arch=(x86_64)
@@ -42,14 +42,17 @@ source=(https://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/$pkgver/sou
vendor-prefs.js
distribution.ini
mozconfig.cfg
- unity-menubar.patch)
+ unity-menubar.patch
+ fix-wayland.patch)
md5sums=('SKIP'
'SKIP'
'10872ca39ebb8844ec753203c55bccc4'
'7c04ba88f1078b224c7c1483b5f0fa78'
'1ef0f094e533a68399b96dc8080c6a6e'
- '2f911c142fc7eb0b76a6af1fad0438d6'
- 'e9e1d302d2be62192e96944610f2e14a')
+ 'c6963498e5ceddedb13af44efa70d86f'
+ '0d7f0fe667c3e9e54f95fa51e9560eed'
+ 'eb9fd90a3b18bfeebbed7e0e6056079c')
+
validpgpkeys=(14F26682D0916CDD81E37B6D61B7B526D98F0353) # Mozilla Software Releases <release@mozilla.com>
@@ -90,6 +93,7 @@ build() {
if [[ -n "${SOURCE_DATE_EPOCH}" ]]; then
export MOZ_BUILD_DATE=$(date --date "@${SOURCE_DATE_EPOCH}" "+%Y%m%d%H%M%S")
fi
+ export MACH_USE_SYSTEM_PYTHON="1"
./mach configure
./mach build
# ./mach buildsymbols
diff --git a/mozconfig.cfg b/mozconfig.cfg
index 028ef78c5a9f..e19e3cf2be1a 100644
--- a/mozconfig.cfg
+++ b/mozconfig.cfg
@@ -38,7 +38,6 @@ ac_add_options --with-system-pixman
# Features
ac_add_options --enable-alsa
ac_add_options --enable-openpgp
-ac_add_options --enable-calendar
ac_add_options --disable-jack
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
diff --git a/unity-menubar.patch b/unity-menubar.patch
index ab36cf3e3a24..0c4103b66447 100644
--- a/unity-menubar.patch
+++ b/unity-menubar.patch
@@ -1,23 +1,26 @@
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
-@@ -5,7 +5,11 @@
-
- <menubar id="main-menubar"
- onpopupshowing="if (event.target.parentNode.parentNode == this &amp;&amp;
+@@ -7,7 +7,12 @@
+ # On macOS, we don't track whether activation of the native menubar happened
+ # with the keyboard.
+ #ifndef XP_MACOSX
+- onpopupshowing="if (event.target.parentNode.parentNode == this)
++ onpopupshowing="if (event.target.parentNode.parentNode == this &amp;&amp;
+#ifdef MOZ_WIDGET_GTK
+ document.documentElement.getAttribute('shellshowingmenubar') != 'true')
+#else
- !('@mozilla.org/widget/nativemenuservice;1' in Cc))
++ true)
+#endif
this.setAttribute('openedwithkey',
- event.target.parentNode.openedWithKey);">
- <menu id="file-menu" data-l10n-id="menu-file">
+ event.target.parentNode.openedWithKey);"
+ #endif
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
-@@ -6301,11 +6301,17 @@ function onViewToolbarsPopupShowing(aEve
-
+@@ -6251,11 +6251,18 @@ function onViewToolbarsPopupShowing(aEve
+ MozXULElement.insertFTLIfNeeded("browser/toolbarContextMenu.ftl");
+ let firstMenuItem = aInsertPoint || popup.firstElementChild;
let toolbarNodes = gNavToolbox.querySelectorAll("toolbar");
-
++
+ let shellShowingMenubar = document.documentElement.getAttribute("shellshowingmenubar") == "true";
+
for (let toolbar of toolbarNodes) {
@@ -29,9 +32,9 @@
+ continue;
+ }
+
- let menuItem = document.createXULElement("menuitem");
- let hidingAttribute =
- toolbar.getAttribute("type") == "menubar" ? "autohide" : "collapsed";
+ if (toolbar.id == "PersonalToolbar" && gBookmarksToolbar2h2020) {
+ let menu = BookmarkingUI.buildBookmarksToolbarSubmenu(toolbar);
+ popup.insertBefore(menu, firstMenuItem);
--- a/browser/components/places/content/places.xhtml
+++ b/browser/components/places/content/places.xhtml
@@ -169,7 +169,7 @@
@@ -45,7 +48,7 @@
id="organizeButton" label="&organize.label;"
--- a/dom/xul/XULPopupElement.cpp
+++ b/dom/xul/XULPopupElement.cpp
-@@ -158,6 +158,10 @@ void XULPopupElement::GetState(nsString&
+@@ -211,6 +211,10 @@ void XULPopupElement::GetState(nsString&
// set this here in case there's no frame for the popup
aState.AssignLiteral("closed");
@@ -53,10 +56,10 @@
+ nsAutoString nativeState;
+#endif
+
- nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetPrimaryFrame());
- if (menuPopupFrame) {
- switch (menuPopupFrame->PopupState()) {
-@@ -181,6 +185,11 @@ void XULPopupElement::GetState(nsString&
+ if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) {
+ switch (pm->GetPopupState(this)) {
+ case ePopupShown:
+@@ -233,6 +237,11 @@ void XULPopupElement::GetState(nsString&
break;
}
}
@@ -72,44 +75,44 @@
+++ b/dom/xul/moz.build
@@ -83,6 +83,11 @@ LOCAL_INCLUDES += [
- include('/ipc/chromium/chromium-config.mozbuild')
+ include("/ipc/chromium/chromium-config.mozbuild")
-+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
++if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ LOCAL_INCLUDES += [
-+ '/widget/gtk',
++ "/widget/gtk",
+ ]
+
- FINAL_LIBRARY = 'xul'
+ FINAL_LIBRARY = "xul"
- if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
+ if CONFIG["CC_TYPE"] in ("clang", "gcc"):
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
-@@ -68,6 +68,10 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'an
- '/dom/system',
- '/dom/system/android',
+@@ -68,6 +68,10 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "an
+ "/dom/system",
+ "/dom/system/android",
]
-+elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk':
++elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
+ LOCAL_INCLUDES += [
-+ '/widget/gtk',
++ "/widget/gtk",
+ ]
XPCOM_MANIFESTS += [
- 'components.conf',
+ "components.conf",
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
-@@ -313,6 +313,9 @@ pref("dom.mouseevent.click.hack.use_lega
+@@ -301,6 +301,9 @@ pref("dom.mouseevent.click.hack.use_lega
+ // Fastback caching - if this pref is negative, then we calculate the number
// of content viewers to cache based on the amount of available memory.
pref("browser.sessionhistory.max_total_viewers", -1);
-
+#ifdef MOZ_WIDGET_GTK
+pref("ui.use_unity_menubar", true);
+#endif
- pref("ui.click_hold_context_menus", false);
- // 0 = false, 1 = true, 2 = autodetect.
- pref("ui.android.mouse_as_touch", 1);
+
+ pref("browser.display.force_inline_alttext", false); // true = force ALT text for missing images to be layed out inline
+ // 0 = no external leading,
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
-@@ -200,6 +200,13 @@ toolbar[type="menubar"] {
+@@ -230,6 +230,13 @@ toolbar[type="menubar"] {
}
%endif
@@ -125,30 +128,46 @@
}
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
-@@ -55,6 +55,15 @@ UNIFIED_SOURCES += [
+@@ -33,6 +33,7 @@
+ EXPORTS.mozilla += ["WidgetUtilsGtk.h"]
- SOURCES += [
- 'MediaKeysEventSourceFactory.cpp',
-+ 'nsDbusmenu.cpp',
-+ 'nsMenu.cpp', # conflicts with X11 headers
-+ 'nsMenuBar.cpp',
-+ 'nsMenuContainer.cpp',
-+ 'nsMenuItem.cpp',
-+ 'nsMenuObject.cpp',
-+ 'nsMenuSeparator.cpp',
-+ 'nsNativeMenuDocListener.cpp',
-+ 'nsNativeMenuService.cpp',
- 'nsWindow.cpp', # conflicts with X11 headers
- 'WaylandVsyncSource.cpp', # conflicts with X11 headers
+ EXPORTS.mozilla.widget += [
++ "NativeMenuSupport.h",
+ "WindowSurface.h",
+ "WindowSurfaceProvider.h",
]
-@@ -134,6 +143,7 @@ FINAL_LIBRARY = 'xul'
- LOCAL_INCLUDES += [
- '/layout/base',
- '/layout/generic',
-+ '/layout/style',
- '/layout/xul',
- '/other-licenses/atk-1.0',
- '/widget',
+@@ -45,6 +46,7 @@
+ "MozContainer.cpp",
+ "MPRISServiceHandler.cpp",
+ "NativeKeyBindings.cpp",
++ "NativeMenuSupport.cpp",
+ "nsApplicationChooser.cpp",
+ "nsAppShell.cpp",
+ "nsBidiKeyboard.cpp",
+@@ -70,6 +72,15 @@
+
+ SOURCES += [
+ "MediaKeysEventSourceFactory.cpp",
++ "nsDbusmenu.cpp",
++ "nsMenu.cpp", # conflicts with X11 headers
++ "nsMenuBar.cpp",
++ "nsMenuContainer.cpp",
++ "nsMenuItem.cpp",
++ "nsMenuObject.cpp",
++ "nsMenuSeparator.cpp",
++ "nsNativeMenuDocListener.cpp",
++ "nsNativeMenuService.cpp",
+ "nsNativeThemeGTK.cpp", # conflicts with X11 headers
+ "nsWindow.cpp", # conflicts with X11 headers
+ "WaylandVsyncSource.cpp", # conflicts with X11 headers
+@@ -138,6 +149,7 @@
+ "/layout/base",
+ "/layout/forms",
+ "/layout/generic",
++ "/layout/style",
+ "/layout/xul",
+ "/other-licenses/atk-1.0",
+ "/third_party/cups/include",
--- /dev/null
+++ b/widget/gtk/nsDbusmenu.cpp
@@ -0,0 +1,61 @@
@@ -319,7 +338,7 @@
+#endif /* __nsDbusmenu_h__ */
--- /dev/null
+++ b/widget/gtk/nsMenu.cpp
-@@ -0,0 +1,796 @@
+@@ -0,0 +1,795 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -334,7 +353,6 @@
+#include "mozilla/Assertions.h"
+#include "mozilla/ComputedStyleInlines.h"
+#include "mozilla/EventDispatcher.h"
-+#include "mozilla/GuardObjects.h"
+#include "mozilla/MouseEvents.h"
+#include "mozilla/PresShell.h"
+#include "mozilla/PresShellInlines.h"
@@ -444,13 +462,13 @@
+ nsAutoString state;
+ switch (aState) {
+ case ePopupState_Showing:
-+ state.Assign(NS_LITERAL_STRING("showing"));
++ state.Assign(u"showing"_ns);
+ break;
+ case ePopupState_Open:
-+ state.Assign(NS_LITERAL_STRING("open"));
++ state.Assign(u"open"_ns);
+ break;
+ case ePopupState_Hiding:
-+ state.Assign(NS_LITERAL_STRING("hiding"));
++ state.Assign(u"hiding"_ns);
+ break;
+ default:
+ break;
@@ -488,12 +506,12 @@
+
+ nsAutoCString event(name);
+
-+ if (event.Equals(NS_LITERAL_CSTRING("closed"))) {
++ if (event.Equals("closed"_ns)) {
+ self->OnClose();
+ return;
+ }
+
-+ if (event.Equals(NS_LITERAL_CSTRING("opened"))) {
++ if (event.Equals("opened"_ns)) {
+ self->OnOpen();
+ return;
+ }
@@ -557,7 +575,7 @@
+ DispatchMouseEvent(mPopupContent, eXULPopupShowing);
+
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None, nsGkAtoms::open,
-+ NS_LITERAL_STRING("true"), true);
++ u"true"_ns, true);
+ }
+
+ if (!self) {
@@ -1361,9 +1379,9 @@
+ nsAutoString type;
+ aEvent->GetType(type);
+
-+ if (type.Equals(NS_LITERAL_STRING("focus"))) {
++ if (type.Equals(u"focus"_ns)) {
+ mOwner->Focus();
-+ } else if (type.Equals(NS_LITERAL_STRING("blur"))) {
++ } else if (type.Equals(u"blur"_ns)) {
+ mOwner->Blur();
+ }
+
@@ -1372,11 +1390,11 @@
+ return NS_OK;
+ }
+
-+ if (type.Equals(NS_LITERAL_STRING("keypress"))) {
++ if (type.Equals(u"keypress"_ns)) {
+ return mOwner->Keypress(keyEvent);
-+ } else if (type.Equals(NS_LITERAL_STRING("keydown"))) {
++ } else if (type.Equals(u"keydown"_ns)) {
+ return mOwner->KeyDown(keyEvent);
-+ } else if (type.Equals(NS_LITERAL_STRING("keyup"))) {
++ } else if (type.Equals(u"keyup"_ns)) {
+ return mOwner->KeyUp(keyEvent);
+ }
+
@@ -1417,7 +1435,7 @@
+ g_object_ref(mTopLevel);
+
+ nsAutoCString path;
-+ path.Append(NS_LITERAL_CSTRING("/com/canonical/menu/"));
++ path.Append("/com/canonical/menu/"_ns);
+ char xid[10];
+ sprintf(xid, "%X", static_cast<uint32_t>(
+ GDK_WINDOW_XID(gtk_widget_get_window(mTopLevel))));
@@ -1475,19 +1493,19 @@
+void
+nsMenuBar::DisconnectDocumentEventListeners()
+{
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("focus"),
++ mDocument->RemoveEventListener(u"focus"_ns,
+ mEventListener,
+ true);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("blur"),
++ mDocument->RemoveEventListener(u"blur"_ns,
+ mEventListener,
+ true);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("keypress"),
++ mDocument->RemoveEventListener(u"keypress"_ns,
+ mEventListener,
+ false);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("keydown"),
++ mDocument->RemoveEventListener(u"keydown"_ns,
+ mEventListener,
+ false);
-+ mDocument->RemoveEventListener(NS_LITERAL_STRING("keyup"),
++ mDocument->RemoveEventListener(u"keyup"_ns,
+ mEventListener,
+ false);
+}
@@ -1497,7 +1515,7 @@
+{
+ ContentNode()->OwnerDoc()->GetRootElement()->SetAttr(
+ kNameSpaceID_None, nsGkAtoms::shellshowingmenubar,
-+ aShowing ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"),
++ aShowing ? u"true"_ns : u"false"_ns,
+ true);
+}
+
@@ -1506,7 +1524,7 @@
+{
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::openedwithkey,
-+ NS_LITERAL_STRING("false"), true);
++ u"false"_ns, true);
+}
+
+void
@@ -1584,7 +1602,7 @@
+
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::openedwithkey,
-+ NS_LITERAL_STRING("true"), true);
++ u"true"_ns, true);
+ static_cast<nsMenu *>(found)->OpenMenu();
+
+ aEvent->StopPropagation();
@@ -1751,26 +1769,26 @@
+
+ mIsActive = true;
+
-+ mDocument->AddEventListener(NS_LITERAL_STRING("focus"),
++ mDocument->AddEventListener(u"focus"_ns,
+ mEventListener,
+ true);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("blur"),
++ mDocument->AddEventListener(u"blur"_ns,
+ mEventListener,
+ true);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("keypress"),
++ mDocument->AddEventListener(u"keypress"_ns,
+ mEventListener,
+ false);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("keydown"),
++ mDocument->AddEventListener(u"keydown"_ns,
+ mEventListener,
+ false);
-+ mDocument->AddEventListener(NS_LITERAL_STRING("keyup"),
++ mDocument->AddEventListener(u"keyup"_ns,
+ mEventListener,
+ false);
+
+ // Clear this. Not sure if we really need to though
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::openedwithkey,
-+ NS_LITERAL_STRING("false"), true);
++ u"false"_ns, true);
+
+ DocListener()->Start();
+ Build();
@@ -2502,22 +2520,22 @@
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::checked,
+ mIsChecked ?
-+ NS_LITERAL_STRING("false")
-+ : NS_LITERAL_STRING("true"),
++ u"false"_ns
++ : u"true"_ns,
+ true);
+ }
+
+ dom::Document *doc = ContentNode()->OwnerDoc();
+ ErrorResult rv;
+ RefPtr<dom::Event> event =
-+ doc->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
++ doc->CreateEvent(u"xulcommandevent"_ns,
+ dom::CallerType::System, rv);
+ if (!rv.Failed()) {
+ RefPtr<dom::XULCommandEvent> command = event->AsXULCommandEvent();
+ if (command) {
-+ command->InitCommandEvent(NS_LITERAL_STRING("command"), true, true,
++ command->InitCommandEvent(u"command"_ns, true, true,
+ nsGlobalWindowInner::Cast(doc->GetInnerWindow()),
-+ 0, false, false, false, false, nullptr, 0, rv);
++ 0, false, false, false, false, 0, nullptr, 0, rv);
+ if (!rv.Failed()) {
+ event->SetTrusted(true);
+ ContentNode()->DispatchEvent(*event, rv);
@@ -2791,7 +2809,7 @@
+ eCaseMatters)) {
+ ContentNode()->AsElement()->SetAttr(kNameSpaceID_None,
+ nsGkAtoms::disabled,
-+ NS_LITERAL_STRING("true"), true);
++ u"true"_ns, true);
+ } else {
+ ContentNode()->AsElement()->UnsetAttr(kNameSpaceID_None,
+ nsGkAtoms::disabled, true);
@@ -3204,7 +3222,7 @@
+ }
+
+ const nsStyleList *list = aComputedStyle->StyleList();
-+ imageRequest = list->GetListStyleImage();
++ imageRequest = list->mListStyleImage.GetImageRequest();
+ if (imageRequest) {
+ imageRequest->GetURI(getter_AddRefs(uri));
+ auto& rect = list->mImageRegion.AsRect();
@@ -3971,7 +3989,7 @@
+#endif /* __nsMenuSeparator_h__ */
--- /dev/null
+++ b/widget/gtk/nsNativeMenuDocListener.cpp
-@@ -0,0 +1,350 @@
+@@ -0,0 +1,347 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -4005,11 +4023,9 @@
+{
+public:
+ DispatchHelper(nsNativeMenuDocListener *aListener,
-+ nsIContent *aContent
-+ MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
++ nsIContent *aContent) :
+ mObserver(nullptr)
+ {
-+ MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+ if (aContent == aListener->mLastSource) {
+ mObserver = aListener->mLastTarget;
+ } else {
@@ -4029,7 +4045,6 @@
+
+private:
+ nsNativeMenuChangeObserver *mObserver;
-+ MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+};
+
+NS_IMPL_ISUPPORTS(nsNativeMenuDocListener, nsIMutationObserver)
@@ -4278,7 +4293,7 @@
+ MOZ_ASSERT(!mContentToObserverTable.Get(aContent, &old) || old == aObserver,
+ "Multiple observers for the same content node are not supported");
+
-+ mContentToObserverTable.Put(aContent, aObserver);
++ mContentToObserverTable.InsertOrUpdate(aContent, aObserver);
+}
+
+void
@@ -4324,7 +4339,7 @@
+}
--- /dev/null
+++ b/widget/gtk/nsNativeMenuDocListener.h
-@@ -0,0 +1,157 @@
+@@ -0,0 +1,152 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -4336,10 +4351,9 @@
+#define __nsNativeMenuDocListener_h__
+
+#include "mozilla/Attributes.h"
-+#include "mozilla/GuardObjects.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/UniquePtr.h"
-+#include "nsDataHashtable.h"
++#include "nsTHashMap.h"
+#include "nsStubMutationObserver.h"
+#include "nsTArray.h"
+
@@ -4391,9 +4405,8 @@
+ class MOZ_STACK_CLASS BlockUpdatesScope
+ {
+ public:
-+ BlockUpdatesScope(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM)
++ BlockUpdatesScope()
+ {
-+ MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+ nsNativeMenuDocListener::AddUpdateBlocker();
+ }
+
@@ -4401,9 +4414,6 @@
+ {
+ nsNativeMenuDocListener::RemoveUpdateBlocker();
+ }
-+
-+ private:
-+ MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+ };
+
+private:
@@ -4450,7 +4460,7 @@
+ nsIContent *mLastSource;
+ nsNativeMenuChangeObserver *mLastTarget;
+ nsTArray<mozilla::UniquePtr<MutationRecord> > mPendingMutations;
-+ nsDataHashtable<nsPtrHashKey<nsIContent>, nsNativeMenuChangeObserver *> mContentToObserverTable;
++ nsTHashMap<nsPtrHashKey<nsIContent>, nsNativeMenuChangeObserver *> mContentToObserverTable;
+
+ static uint32_t sUpdateBlockersCount;
+};
@@ -4484,7 +4494,7 @@
+#endif /* __nsNativeMenuDocListener_h__ */
--- /dev/null
+++ b/widget/gtk/nsNativeMenuService.cpp
-@@ -0,0 +1,503 @@
+@@ -0,0 +1,478 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -4492,6 +4502,7 @@
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
++#include "mozilla/dom/Element.h"
+#include "mozilla/Assertions.h"
+#include "mozilla/Preferences.h"
+#include "mozilla/UniquePtr.h"
@@ -4521,32 +4532,6 @@
+extern PangoLayout* gPangoLayout;
+extern nsNativeMenuDocListenerTArray* gPendingListeners;
+
-+#if not GLIB_CHECK_VERSION(2,26,0)
-+enum GBusType {
-+ G_BUS_TYPE_STARTER = -1,
-+ G_BUS_TYPE_NONE = 0,
-+ G_BUS_TYPE_SYSTEM = 1,
-+ G_BUS_TYPE_SESSION = 2
-+};
-+
-+enum GDBusProxyFlags {
-+ G_DBUS_PROXY_FLAGS_NONE = 0,
-+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES = 1 << 0,
-+ G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS = 1 << 1,
-+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START = 1 << 2,
-+ G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES = 1 << 3
-+};
-+
-+enum GDBusCallFlags {
-+ G_DBUS_CALL_FLAGS_NONE = 0,
-+ G_DBUS_CALL_FLAGS_NO_AUTO_START = 1 << 0
-+};
-+
-+typedef _GDBusInterfaceInfo GDBusInterfaceInfo;
-+typedef _GDBusProxy GDBusProxy;
-+typedef _GVariant GVariant;
-+#endif
-+
+#undef g_dbus_proxy_new_for_bus
+#undef g_dbus_proxy_new_for_bus_finish
+#undef g_dbus_proxy_call
@@ -4753,7 +4738,7 @@
+ }
+
+ GCancellable *cancellable = g_cancellable_new();
-+ mMenuBarRegistrationCancellables.Put(aMenuBar, cancellable);
++ mMenuBarRegistrationCancellables.InsertOrUpdate(aMenuBar, cancellable);
+
+ // We keep a weak ref because we can't assume that GDBus cancellation
+ // is reliable (see https://launchpad.net/bugs/953562)
@@ -4990,7 +4975,7 @@
+}
--- /dev/null
+++ b/widget/gtk/nsNativeMenuService.h
-@@ -0,0 +1,84 @@
+@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
@@ -5003,7 +4988,7 @@
+
+#include "mozilla/Attributes.h"
+#include "nsCOMPtr.h"
-+#include "nsDataHashtable.h"
++#include "nsTHashMap.h"
+#include "nsINativeMenuService.h"
+#include "nsTArray.h"
+
@@ -5014,8 +4999,9 @@
+class nsMenuBar;
+
+/*
-+ * The main native menu service singleton. nsWebShellWindow calls in to this when
-+ * a new top level window is created.
++ * The main native menu service singleton.
++ * NativeMenuSupport::CreateNativeMenuBar calls in to this when a new top level
++ * window is created.
+ *
+ * Menubars are owned by their nsWindow. This service holds a weak reference to
+ * each menubar for the purpose of re-registering them with the shell if it
@@ -5068,7 +5054,7 @@
+ GDBusProxy *mDbusProxy;
+ bool mOnline;
+ nsTArray<nsMenuBar *> mMenuBars;
-+ nsDataHashtable<nsPtrHashKey<nsMenuBar>, GCancellable*> mMenuBarRegistrationCancellables;
++ nsTHashMap<nsPtrHashKey<nsMenuBar>, GCancellable*> mMenuBarRegistrationCancellables;
+
+ static bool sShutdown;
+ static nsNativeMenuService *sService;
@@ -5077,7 +5063,7 @@
+#endif /* __nsNativeMenuService_h__ */
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
-@@ -6069,6 +6069,10 @@ void nsWindow::HideWindowChrome(bool aSh
+@@ -6436,6 +6436,10 @@ void nsWindow::HideWindowChrome(bool aSh
SetWindowDecoration(aShouldHide ? eBorderStyle_none : mBorderStyle);
}
@@ -5091,15 +5077,15 @@
--- a/widget/gtk/nsWindow.h
+++ b/widget/gtk/nsWindow.h
@@ -39,6 +39,8 @@
-
+ #include "nsRefPtrHashtable.h"
#include "IMContextWrapper.h"
+#include "nsMenuBar.h"
+
- #undef LOG
- #ifdef MOZ_LOGGING
-
-@@ -186,6 +188,8 @@ class nsWindow final : public nsBaseWidg
+ #ifdef ACCESSIBILITY
+ # include "mozilla/a11y/LocalAccessible.h"
+ #endif
+@@ -168,6 +170,8 @@ class nsWindow final : public nsBaseWidg
nsIScreen* aTargetScreen = nullptr) override;
virtual void HideWindowChrome(bool aShouldHide) override;
@@ -5108,30 +5094,15 @@
/**
* GetLastUserInputTime returns a timestamp for the most recent user input
* event. This is intended for pointer grab requests (including drags).
-@@ -721,6 +725,8 @@ class nsWindow final : public nsBaseWidg
+@@ -708,6 +712,8 @@ class nsWindow final : public nsBaseWidg
+ static GtkWindowDecoration sGtkWindowDecoration;
- mozilla::UniquePtr<mozilla::CurrentX11TimeGetter> mCurrentTimeGetter;
- static CSDSupportLevel sCSDSupportLevel;
+ static bool sTransparentMainWindow;
+
+ mozilla::UniquePtr<nsMenuBar> mMenuBar;
- };
- #endif /* __nsWindow_h__ */
---- a/widget/moz.build
-+++ b/widget/moz.build
-@@ -69,9 +69,9 @@ elif toolkit == 'cocoa':
- 'nsITouchBarInput.idl',
- 'nsITouchBarUpdater.idl',
- ]
-- EXPORTS += [
-- 'nsINativeMenuService.h',
-- ]
-+
-+if toolkit in ('cocoa', 'gtk'):
-+ EXPORTS += ['nsINativeMenuService.h']
-
- TEST_DIRS += [
- 'tests',
+ #ifdef ACCESSIBILITY
+ RefPtr<mozilla::a11y::LocalAccessible> mRootAccessible;
--- /dev/null
+++ b/xpcom/ds/NativeMenuAtoms.py
@@ -0,0 +1,9 @@
@@ -5154,15 +5125,15 @@
import sys
# Static atom definitions, used to generate nsGkAtomList.h.
-@@ -2553,7 +2554,7 @@ STATIC_ATOMS = [
+@@ -2506,7 +2507,7 @@ STATIC_ATOMS = [
InheritingAnonBoxAtom("AnonBox_mozSVGForeignContent", ":-moz-svg-foreign-content"),
InheritingAnonBoxAtom("AnonBox_mozSVGText", ":-moz-svg-text"),
# END ATOMS
-] + HTML_PARSER_ATOMS
+] + HTML_PARSER_ATOMS + NATIVE_MENU_ATOMS
+ # fmt: on
- def verify():
--- a/widget/gtk/components.conf
+++ b/widget/gtk/components.conf
@@ -82,6 +82,14 @@ Classes = [
@@ -5170,7 +5141,7 @@
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
},
+ {
-+ 'cid': '{0B3FE5AA-BC72-4303-85AE-76365DF1251D}',
++ 'cid': '{0b3fe5aa-bc72-4303-85ae-76365df1251d}',
+ 'contract_ids': ['@mozilla.org/widget/nativemenuservice;1'],
+ 'singleton': True,
+ 'type': 'nsNativeMenuService',
@@ -5182,12 +5153,147 @@
if defined('MOZ_X11'):
--- a/xpfe/appshell/AppWindow.cpp
+++ b/xpfe/appshell/AppWindow.cpp
-@@ -67,7 +67,7 @@
- # include "mozilla/XULStore.h"
- #endif
+@@ -80,7 +80,7 @@
+
+ #include "mozilla/dom/DocumentL10n.h"
-#ifdef XP_MACOSX
+#if defined(XP_MACOSX) || defined(MOZ_WIDGET_GTK)
- # include "nsINativeMenuService.h"
+ # include "mozilla/widget/NativeMenuSupport.h"
# define USE_NATIVE_MENUS
#endif
+--- /dev/null
++++ b/widget/gtk/NativeMenuSupport.cpp
+@@ -0,0 +1,25 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#include "mozilla/widget/NativeMenuSupport.h"
++
++#include "MainThreadUtils.h"
++#include "nsINativeMenuService.h"
++
++namespace mozilla::widget {
++
++void NativeMenuSupport::CreateNativeMenuBar(nsIWidget* aParent, dom::Element* aMenuBarElement) {
++ MOZ_RELEASE_ASSERT(NS_IsMainThread(), "Attempting to create native menu bar on wrong thread!");
++
++ nsCOMPtr<nsINativeMenuService> nms =
++ do_GetService("@mozilla.org/widget/nativemenuservice;1");
++ if (!nms) {
++ return;
++ }
++
++ nms->CreateNativeMenuBar(aParent, aMenuBarElement);
++}
++
++} // namespace mozilla::widget
+--- /dev/null
++++ b/widget/gtk/NativeMenuSupport.h
+@@ -0,0 +1,31 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef mozilla_widget_NativeMenuSupport_h
++#define mozilla_widget_NativeMenuSupport_h
++
++class nsIWidget;
++
++namespace mozilla {
++
++namespace dom {
++class Element;
++}
++
++namespace widget {
++
++class NativeMenuSupport final {
++public:
++ // Given a top-level window widget and a menu bar DOM node, sets up native
++ // menus. Once created, native menus are controlled via the DOM, including
++ // destruction.
++ static void CreateNativeMenuBar(nsIWidget* aParent,
++ dom::Element* aMenuBarElement);
++};
++
++} // namespace widget
++} // namespace mozilla
++
++#endif // mozilla_widget_NativeMenuSupport_h
+--- a/widget/moz.build
++++ b/widget/moz.build
+@@ -144,6 +144,11 @@ EXPORTS += [
+ "PuppetWidget.h",
+ ]
+
++if toolkit == "gtk":
++ EXPORTS += [
++ "nsINativeMenuService.h",
++ ]
++
+ EXPORTS.mozilla += [
+ "BasicEvents.h",
+ "CommandList.h",
+--- /dev/null
++++ b/widget/nsINativeMenuService.h
+@@ -0,0 +1,39 @@
++/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
++/* This Source Code Form is subject to the terms of the Mozilla Public
++ * License, v. 2.0. If a copy of the MPL was not distributed with this
++ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
++
++#ifndef nsINativeMenuService_h_
++#define nsINativeMenuService_h_
++
++#include "nsISupports.h"
++
++class nsIWidget;
++class nsIContent;
++namespace mozilla {
++namespace dom {
++class Element;
++}
++} // namespace mozilla
++
++// {90DF88F9-F084-4EF3-829A-49496E636DED}
++#define NS_INATIVEMENUSERVICE_IID \
++ { \
++ 0x90DF88F9, 0xF084, 0x4EF3, { \
++ 0x82, 0x9A, 0x49, 0x49, 0x6E, 0x63, 0x6D, 0xED \
++ } \
++ }
++
++class nsINativeMenuService : public nsISupports {
++ public:
++ NS_DECLARE_STATIC_IID_ACCESSOR(NS_INATIVEMENUSERVICE_IID)
++ // Given a top-level window widget and a menu bar DOM node, sets up native
++ // menus. Once created, native menus are controlled via the DOM, including
++ // destruction.
++ NS_IMETHOD CreateNativeMenuBar(nsIWidget* aParent,
++ mozilla::dom::Element* aMenuBarNode) = 0;
++};
++
++NS_DEFINE_STATIC_IID_ACCESSOR(nsINativeMenuService, NS_INATIVEMENUSERVICE_IID)
++
++#endif // nsINativeMenuService_h_
+--- a/widget/nsWidgetsCID.h
++++ b/widget/nsWidgetsCID.h
+@@ -66,6 +66,14 @@
+ // Menus
+ //-----------------------------------------------------------
+
++// {0B3FE5AA-BC72-4303-85AE-76365DF1251D}
++#define NS_NATIVEMENUSERVICE_CID \
++ { \
++ 0x0B3FE5AA, 0xBC72, 0x4303, { \
++ 0x85, 0xAE, 0x76, 0x36, 0x5D, 0xF1, 0x25, 0x1D \
++ } \
++ }
++
+ // {F6CD4F21-53AF-11d2-8DC4-00609703C14E}
+ #define NS_POPUPMENU_CID \
+ { \