From 94365400be86a22b7aaaba86627c0aca7dc8f50a Mon Sep 17 00:00:00 2001 From: ohfp <1813007-ohfp@users.noreply.gitlab.com> Date: Fri, 8 Apr 2022 22:01:30 +0200 Subject: [PATCH] update unity-menubar.patch for 99.0, update mozilla-kde.patch (unfortunately it is for 98.0, hopefully still works?) --- patches/mozilla-kde.patch | 7 ++- patches/mozilla-kde_after_unity.patch | 73 ++++++++++++----------- patches/unity-menubar.patch | 85 ++++++++++++--------------- 3 files changed, 80 insertions(+), 85 deletions(-) diff --git a/patches/mozilla-kde.patch b/patches/mozilla-kde.patch index 75b090a..5671dcc 100644 --- a/patches/mozilla-kde.patch +++ b/patches/mozilla-kde.patch @@ -941,12 +941,13 @@ diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/ new file mode 100644 --- /dev/null +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp -@@ -0,0 +1,86 @@ +@@ -0,0 +1,89 @@ +/* -*- 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/StaticPrefs_browser.h" +#include "nsKDERegistry.h" +#include "prlink.h" +#include "prmem.h" @@ -1022,8 +1023,10 @@ new file mode 100644 + nsCString description = output[ 1 ]; + mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); + nsCString handlerAppName = output[ 2 ]; ++ mozilla::StaticPrefs::browser_download_improvements_to_download_panel() ++ ? mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk) ++ : mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); -+ mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); + return mimeInfo.forget(); + } + return nullptr; diff --git a/patches/mozilla-kde_after_unity.patch b/patches/mozilla-kde_after_unity.patch index 9148313..903a012 100644 --- a/patches/mozilla-kde_after_unity.patch +++ b/patches/mozilla-kde_after_unity.patch @@ -1,6 +1,6 @@ -From 6205411ef58130e0e9bb0aad75c7e126dc32b25b Mon Sep 17 00:00:00 2001 +From 4a2ac00d3054fb51979482ead83f292d9b9c5f3b Mon Sep 17 00:00:00 2001 From: ohfp <1813007-ohfp@users.noreply.gitlab.com> -Date: Thu, 10 Feb 2022 11:04:05 +0100 +Date: Fri, 8 Apr 2022 21:57:51 +0200 Subject: [PATCH] kde --- @@ -18,7 +18,7 @@ Subject: [PATCH] kde uriloader/exthandler/moz.build | 3 + .../exthandler/unix/nsCommonRegistry.cpp | 53 +++ uriloader/exthandler/unix/nsCommonRegistry.h | 28 ++ - uriloader/exthandler/unix/nsKDERegistry.cpp | 86 +++++ + uriloader/exthandler/unix/nsKDERegistry.cpp | 89 +++++ uriloader/exthandler/unix/nsKDERegistry.h | 34 ++ uriloader/exthandler/unix/nsMIMEInfoUnix.cpp | 30 +- .../exthandler/unix/nsOSHelperAppService.cpp | 10 +- @@ -28,7 +28,7 @@ Subject: [PATCH] kde xpcom/components/ManifestParser.cpp | 11 +- xpcom/components/moz.build | 1 + xpcom/io/nsLocalFileUnix.cpp | 28 +- - 24 files changed, 1010 insertions(+), 42 deletions(-) + 24 files changed, 1013 insertions(+), 42 deletions(-) create mode 100644 toolkit/xre/nsKDEUtils.cpp create mode 100644 toolkit/xre/nsKDEUtils.h create mode 100644 uriloader/exthandler/unix/nsCommonRegistry.cpp @@ -37,10 +37,10 @@ Subject: [PATCH] kde create mode 100644 uriloader/exthandler/unix/nsKDERegistry.h diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp -index f10d140..38669b2 100644 +index 40d6f89e56..79bfe40fb9 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp -@@ -90,6 +90,7 @@ +@@ -91,6 +91,7 @@ #ifdef MOZ_BACKGROUNDTASKS # include "mozilla/BackgroundTasks.h" #endif @@ -48,7 +48,7 @@ index f10d140..38669b2 100644 #ifdef DEBUG # include -@@ -4649,6 +4650,17 @@ nsresult Preferences::InitInitialObjects(bool aIsStartup) { +@@ -4671,6 +4672,17 @@ nsresult Preferences::InitInitialObjects(bool aIsStartup) { #endif }; @@ -66,7 +66,7 @@ index f10d140..38669b2 100644 rv = pref_LoadPrefsInDir(defaultPrefDir, specialFiles, ArrayLength(specialFiles)); if (NS_FAILED(rv)) { -@@ -4723,7 +4735,7 @@ nsresult Preferences::InitInitialObjects(bool aIsStartup) { +@@ -4745,7 +4757,7 @@ nsresult Preferences::InitInitialObjects(bool aIsStartup) { } // Do we care if a file provided by this process fails to load? @@ -76,10 +76,10 @@ index f10d140..38669b2 100644 } diff --git a/modules/libpref/moz.build b/modules/libpref/moz.build -index 5d2aca3..98a83e6 100644 +index f5028fa691..80c55c5689 100644 --- a/modules/libpref/moz.build +++ b/modules/libpref/moz.build -@@ -123,6 +123,10 @@ UNIFIED_SOURCES += [ +@@ -124,6 +124,10 @@ UNIFIED_SOURCES += [ "SharedPrefMap.cpp", ] @@ -91,7 +91,7 @@ index 5d2aca3..98a83e6 100644 GeneratedFile( diff --git a/python/mozbuild/mozpack/chrome/flags.py b/python/mozbuild/mozpack/chrome/flags.py -index 7d6d7e0..724c527 100644 +index 7d6d7e0c7f..724c527b4c 100644 --- a/python/mozbuild/mozpack/chrome/flags.py +++ b/python/mozbuild/mozpack/chrome/flags.py @@ -234,6 +234,7 @@ class Flags(OrderedDict): @@ -103,7 +103,7 @@ index 7d6d7e0..724c527 100644 RE = re.compile(r"([!<>=]+)") diff --git a/python/mozbuild/mozpack/chrome/manifest.py b/python/mozbuild/mozpack/chrome/manifest.py -index a733685..f64b17f 100644 +index a733685f95..f64b17fb7b 100644 --- a/python/mozbuild/mozpack/chrome/manifest.py +++ b/python/mozbuild/mozpack/chrome/manifest.py @@ -44,6 +44,7 @@ class ManifestEntry(object): @@ -115,7 +115,7 @@ index a733685..f64b17f 100644 def __init__(self, base, *flags): diff --git a/toolkit/components/downloads/moz.build b/toolkit/components/downloads/moz.build -index d4172e2..8bd0577 100644 +index d4172e2d73..8bd0577bc5 100644 --- a/toolkit/components/downloads/moz.build +++ b/toolkit/components/downloads/moz.build @@ -51,5 +51,9 @@ if CONFIG["MOZ_PLACES"]: @@ -129,7 +129,7 @@ index d4172e2..8bd0577 100644 with Files("**"): BUG_COMPONENT = ("Toolkit", "Downloads API") diff --git a/toolkit/mozapps/downloads/HelperAppDlg.jsm b/toolkit/mozapps/downloads/HelperAppDlg.jsm -index 64de8d0..2321f3a 100644 +index 64de8d0989..2321f3a8eb 100644 --- a/toolkit/mozapps/downloads/HelperAppDlg.jsm +++ b/toolkit/mozapps/downloads/HelperAppDlg.jsm @@ -1259,26 +1259,56 @@ nsUnknownContentTypeDialog.prototype = { @@ -210,7 +210,7 @@ index 64de8d0..2321f3a 100644 var nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker); diff --git a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp -index f8d0880..091ccf3 100644 +index f8d0880545..091ccf3d9e 100644 --- a/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp +++ b/toolkit/system/unixproxy/nsUnixSystemProxySettings.cpp @@ -18,6 +18,7 @@ @@ -274,7 +274,7 @@ index f8d0880..091ccf3 100644 auto result = MakeRefPtr(); result->Init(); diff --git a/toolkit/xre/moz.build b/toolkit/xre/moz.build -index b1e2b58..ea2f46c 100644 +index c19a11dd6e..6243723355 100644 --- a/toolkit/xre/moz.build +++ b/toolkit/xre/moz.build @@ -97,7 +97,9 @@ elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit": @@ -289,7 +289,7 @@ index b1e2b58..ea2f46c 100644 CXXFLAGS += CONFIG["MOZ_X11_SM_CFLAGS"] diff --git a/toolkit/xre/nsKDEUtils.cpp b/toolkit/xre/nsKDEUtils.cpp new file mode 100644 -index 0000000..7a6edf0 +index 0000000000..7a6edf0770 --- /dev/null +++ b/toolkit/xre/nsKDEUtils.cpp @@ -0,0 +1,321 @@ @@ -616,7 +616,7 @@ index 0000000..7a6edf0 + } diff --git a/toolkit/xre/nsKDEUtils.h b/toolkit/xre/nsKDEUtils.h new file mode 100644 -index 0000000..c9c1284 +index 0000000000..c9c1284e29 --- /dev/null +++ b/toolkit/xre/nsKDEUtils.h @@ -0,0 +1,48 @@ @@ -669,7 +669,7 @@ index 0000000..c9c1284 + +#endif // nsKDEUtils diff --git a/uriloader/exthandler/HandlerServiceParent.cpp b/uriloader/exthandler/HandlerServiceParent.cpp -index 0796c74..4f21c05 100644 +index 0796c7428b..4f21c058f8 100644 --- a/uriloader/exthandler/HandlerServiceParent.cpp +++ b/uriloader/exthandler/HandlerServiceParent.cpp @@ -12,7 +12,7 @@ @@ -700,7 +700,7 @@ index 0796c74..4f21c05 100644 *aHandlerExists = false; } diff --git a/uriloader/exthandler/moz.build b/uriloader/exthandler/moz.build -index 92647a9..fc5068c 100644 +index 92647a9b34..fc5068cd20 100644 --- a/uriloader/exthandler/moz.build +++ b/uriloader/exthandler/moz.build @@ -83,7 +83,9 @@ else: @@ -723,7 +723,7 @@ index 92647a9..fc5068c 100644 if CONFIG["MOZ_ENABLE_DBUS"]: diff --git a/uriloader/exthandler/unix/nsCommonRegistry.cpp b/uriloader/exthandler/unix/nsCommonRegistry.cpp new file mode 100644 -index 0000000..630ab61 +index 0000000000..630ab6147d --- /dev/null +++ b/uriloader/exthandler/unix/nsCommonRegistry.cpp @@ -0,0 +1,53 @@ @@ -782,7 +782,7 @@ index 0000000..630ab61 +} diff --git a/uriloader/exthandler/unix/nsCommonRegistry.h b/uriloader/exthandler/unix/nsCommonRegistry.h new file mode 100644 -index 0000000..85b3d9c +index 0000000000..85b3d9cee2 --- /dev/null +++ b/uriloader/exthandler/unix/nsCommonRegistry.h @@ -0,0 +1,28 @@ @@ -816,15 +816,16 @@ index 0000000..85b3d9c +#endif diff --git a/uriloader/exthandler/unix/nsKDERegistry.cpp b/uriloader/exthandler/unix/nsKDERegistry.cpp new file mode 100644 -index 0000000..95c13f3 +index 0000000000..f78e64c7e9 --- /dev/null +++ b/uriloader/exthandler/unix/nsKDERegistry.cpp -@@ -0,0 +1,86 @@ +@@ -0,0 +1,89 @@ +/* -*- 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/StaticPrefs_browser.h" +#include "nsKDERegistry.h" +#include "prlink.h" +#include "prmem.h" @@ -900,15 +901,17 @@ index 0000000..95c13f3 + nsCString description = output[ 1 ]; + mimeInfo->SetDescription(NS_ConvertUTF8toUTF16(description)); + nsCString handlerAppName = output[ 2 ]; ++ mozilla::StaticPrefs::browser_download_improvements_to_download_panel() ++ ? mimeInfo->SetPreferredAction(nsIMIMEInfo::saveToDisk) ++ : mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); + mimeInfo->SetDefaultDescription(NS_ConvertUTF8toUTF16(handlerAppName)); -+ mimeInfo->SetPreferredAction(nsIMIMEInfo::useSystemDefault); + return mimeInfo.forget(); + } + return nullptr; +} diff --git a/uriloader/exthandler/unix/nsKDERegistry.h b/uriloader/exthandler/unix/nsKDERegistry.h new file mode 100644 -index 0000000..5b07eeb +index 0000000000..5b07eebc6d --- /dev/null +++ b/uriloader/exthandler/unix/nsKDERegistry.h @@ -0,0 +1,34 @@ @@ -947,7 +950,7 @@ index 0000000..5b07eeb + +#endif //nsKDERegistry_h__ diff --git a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp -index 7cbefcc..8408334 100644 +index 7cbefcce3e..84083348c8 100644 --- a/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp +++ b/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp @@ -5,16 +5,19 @@ @@ -1016,7 +1019,7 @@ index 7cbefcc..8408334 100644 if (!giovfs) { return NS_ERROR_FAILURE; diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp -index b9e7aed..367ad9e 100644 +index b9e7aed3cb..367ad9ee24 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -10,7 +10,7 @@ @@ -1065,10 +1068,10 @@ index b9e7aed..367ad9e 100644 LOG( ("Got MIMEInfo from GNOME registry without extensions; setting them " diff --git a/widget/gtk/moz.build b/widget/gtk/moz.build -index 47be8f3..8f51607 100644 +index 87e96e6c69..4daae0f17d 100644 --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build -@@ -153,6 +153,7 @@ LOCAL_INCLUDES += [ +@@ -165,6 +165,7 @@ LOCAL_INCLUDES += [ "/layout/xul", "/other-licenses/atk-1.0", "/third_party/cups/include", @@ -1077,7 +1080,7 @@ index 47be8f3..8f51607 100644 "/widget/headless", ] diff --git a/widget/gtk/nsFilePicker.cpp b/widget/gtk/nsFilePicker.cpp -index 00a5caa..8e436f0 100644 +index 00a5caa288..8e436f0fc0 100644 --- a/widget/gtk/nsFilePicker.cpp +++ b/widget/gtk/nsFilePicker.cpp @@ -5,6 +5,7 @@ @@ -1374,7 +1377,7 @@ index 00a5caa..8e436f0 100644 void* nsFilePicker::GtkFileChooserNew(const gchar* title, GtkWindow* parent, GtkFileChooserAction action, diff --git a/widget/gtk/nsFilePicker.h b/widget/gtk/nsFilePicker.h -index 9b3110a..be9d559 100644 +index 9b3110aa00..be9d559c7b 100644 --- a/widget/gtk/nsFilePicker.h +++ b/widget/gtk/nsFilePicker.h @@ -72,6 +72,12 @@ class nsFilePicker : public nsBaseFilePicker { @@ -1391,7 +1394,7 @@ index 9b3110a..be9d559 100644 GtkFileChooserAction action, const gchar* accept_label); diff --git a/xpcom/components/ManifestParser.cpp b/xpcom/components/ManifestParser.cpp -index f3d0055..d13543a 100644 +index f3d0055f2c..d13543ab52 100644 --- a/xpcom/components/ManifestParser.cpp +++ b/xpcom/components/ManifestParser.cpp @@ -43,6 +43,7 @@ @@ -1470,7 +1473,7 @@ index f3d0055..d13543a 100644 stTablet == eBad || #endif diff --git a/xpcom/components/moz.build b/xpcom/components/moz.build -index 6cf78aa..dfcf9c7 100644 +index 6cf78aa9be..dfcf9c7697 100644 --- a/xpcom/components/moz.build +++ b/xpcom/components/moz.build @@ -71,6 +71,7 @@ LOCAL_INCLUDES += [ @@ -1482,7 +1485,7 @@ index 6cf78aa..dfcf9c7 100644 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp -index b609a0b..974b92f 100644 +index b609a0b890..974b92f2b4 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -59,6 +59,7 @@ diff --git a/patches/unity-menubar.patch b/patches/unity-menubar.patch index d3b2d87..9a7a276 100644 --- a/patches/unity-menubar.patch +++ b/patches/unity-menubar.patch @@ -16,7 +16,7 @@ #endif --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js -@@ -6451,11 +6451,18 @@ function onViewToolbarsPopupShowing(aEve +@@ -6466,11 +6466,18 @@ function onViewToolbarsPopupShowing(aEve MozXULElement.insertFTLIfNeeded("browser/toolbarContextMenu.ftl"); let firstMenuItem = aInsertPoint || popup.firstElementChild; let toolbarNodes = gNavToolbox.querySelectorAll("toolbar"); @@ -47,7 +47,7 @@ --- a/dom/xul/XULPopupElement.cpp +++ b/dom/xul/XULPopupElement.cpp -@@ -207,6 +207,10 @@ void XULPopupElement::GetState(nsString& +@@ -208,6 +208,10 @@ void XULPopupElement::GetState(nsString& // set this here in case there's no frame for the popup aState.AssignLiteral("closed"); @@ -58,7 +58,7 @@ if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) { switch (pm->GetPopupState(this)) { case ePopupShown: -@@ -229,6 +233,11 @@ void XULPopupElement::GetState(nsString& +@@ -230,6 +234,11 @@ void XULPopupElement::GetState(nsString& break; } } @@ -97,7 +97,7 @@ "components.conf", --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js -@@ -310,6 +310,9 @@ pref("dom.mouseevent.click.hack.use_lega +@@ -311,6 +311,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); @@ -109,35 +109,26 @@ // 0 = no external leading, --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css -@@ -230,6 +230,13 @@ toolbar[type="menubar"] { +@@ -229,6 +229,13 @@ toolbox { + } } - %endif -+%ifdef MOZ_WIDGET_GTK ++@media (-moz-platform: linux) { +*|*:root[shellshowingmenubar="true"] +toolbar[type="menubar"]:not([customizing="true"]) { + display: none !important; +} -+%endif ++} + toolbarspring { -moz-box-flex: 1000; } --- a/widget/gtk/moz.build +++ b/widget/gtk/moz.build -@@ -34,6 +34,7 @@ EXPORTS += [ - EXPORTS.mozilla += ["WidgetUtilsGtk.h"] - - EXPORTS.mozilla.widget += [ -+ "NativeMenuSupport.h", - "WindowSurface.h", - "WindowSurfaceProvider.h", - ] -@@ -71,6 +72,16 @@ UNIFIED_SOURCES += [ +@@ -77,6 +77,15 @@ UNIFIED_SOURCES += [ SOURCES += [ "MediaKeysEventSourceFactory.cpp", -+ "NativeMenuSupport.cpp", + "nsDbusmenu.cpp", + "nsMenu.cpp", # conflicts with X11 headers + "nsMenuBar.cpp", @@ -150,7 +141,7 @@ "nsNativeThemeGTK.cpp", # conflicts with X11 headers "nsWindow.cpp", # conflicts with X11 headers "WaylandVsyncSource.cpp", # conflicts with X11 headers -@@ -138,6 +149,7 @@ LOCAL_INCLUDES += [ +@@ -152,6 +161,7 @@ LOCAL_INCLUDES += [ "/layout/base", "/layout/forms", "/layout/generic", @@ -5053,7 +5044,7 @@ +#endif /* __nsNativeMenuService_h__ */ --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp -@@ -7122,6 +7122,10 @@ void nsWindow::HideWindowChrome(bool aSh +@@ -7060,6 +7060,10 @@ void nsWindow::HideWindowChrome(bool aSh SetWindowDecoration(aShouldHide ? eBorderStyle_none : mBorderStyle); } @@ -5075,7 +5066,7 @@ #ifdef ACCESSIBILITY # include "mozilla/a11y/LocalAccessible.h" #endif -@@ -171,6 +173,8 @@ class nsWindow final : public nsBaseWidg +@@ -172,6 +174,8 @@ class nsWindow final : public nsBaseWidg nsresult MakeFullScreen(bool aFullScreen) override; void HideWindowChrome(bool aShouldHide) override; @@ -5084,7 +5075,7 @@ /** * GetLastUserInputTime returns a timestamp for the most recent user input * event. This is intended for pointer grab requests (including drags). -@@ -828,6 +832,8 @@ class nsWindow final : public nsBaseWidg +@@ -824,6 +828,8 @@ class nsWindow final : public nsBaseWidg static bool sTransparentMainWindow; @@ -5115,7 +5106,7 @@ import sys # Static atom definitions, used to generate nsGkAtomList.h. -@@ -2527,7 +2528,7 @@ STATIC_ATOMS = [ +@@ -2529,7 +2530,7 @@ STATIC_ATOMS = [ InheritingAnonBoxAtom("AnonBox_mozSVGForeignContent", ":-moz-svg-foreign-content"), InheritingAnonBoxAtom("AnonBox_mozSVGText", ":-moz-svg-text"), # END ATOMS @@ -5152,35 +5143,33 @@ # include "mozilla/widget/NativeMenuSupport.h" # define USE_NATIVE_MENUS #endif ---- /dev/null +--- a/widget/gtk/NativeMenuSupport.cpp +++ b/widget/gtk/NativeMenuSupport.cpp -@@ -0,0 +1,26 @@ -+/* -*- 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" +@@ -7,6 +7,8 @@ + + #include "MainThreadUtils.h" + #include "NativeMenuGtk.h" +#include "nsINativeMenuService.h" +#include "nsServiceManagerUtils.h" + + namespace mozilla::widget { + +@@ -14,7 +16,14 @@ void NativeMenuSupport::CreateNativeMenu + dom::Element* aMenuBarElement) { + MOZ_RELEASE_ASSERT(NS_IsMainThread(), + "Attempting to create native menu bar on wrong thread!"); +- // TODO + -+namespace mozilla::widget { ++ nsCOMPtr nms = ++ do_GetService("@mozilla.org/widget/nativemenuservice;1"); ++ if (!nms) { ++ return; ++ } + -+void NativeMenuSupport::CreateNativeMenuBar(nsIWidget* aParent, dom::Element* aMenuBarElement) { -+ MOZ_RELEASE_ASSERT(NS_IsMainThread(), "Attempting to create native menu bar on wrong thread!"); -+ -+ nsCOMPtr nms = -+ do_GetService("@mozilla.org/widget/nativemenuservice;1"); -+ if (!nms) { -+ return; -+ } -+ -+ nms->CreateNativeMenuBar(aParent, aMenuBarElement); -+} -+ -+} // namespace mozilla::widget ++ nms->CreateNativeMenuBar(aParent, aMenuBarElement); + } + + already_AddRefed NativeMenuSupport::CreateNativeContextMenu( --- /dev/null +++ b/widget/gtk/NativeMenuSupport.h @@ -0,0 +1,31 @@ @@ -5217,7 +5206,7 @@ +#endif // mozilla_widget_NativeMenuSupport_h --- a/widget/moz.build +++ b/widget/moz.build -@@ -139,6 +139,11 @@ EXPORTS += [ +@@ -157,6 +157,11 @@ EXPORTS += [ "PuppetWidget.h", ]