mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 11:40:06 +02:00
librewolf: bump version
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
resource app_flags B_MULTIPLE_LAUNCH;
|
||||
|
||||
resource app_version {
|
||||
major = @MAJOR@,
|
||||
middle = @MIDDLE@,
|
||||
minor = @MINOR@,
|
||||
|
||||
variety = B_APPV_FINAL,
|
||||
internal = 0,
|
||||
|
||||
short_info = "LibreWolf Browser",
|
||||
long_info = "@LONG_INFO@"
|
||||
};
|
||||
|
||||
resource app_signature "application/x-vnd.librewolf-launcher";
|
||||
|
||||
resource file_types message {
|
||||
"types" = "text/html",
|
||||
"types" = "image/svg+xml",
|
||||
"types" = "application/xhtml+xml",
|
||||
"types" = "application/x-vnd.Be.URL.file",
|
||||
"types" = "application/x-vnd.Be.URL.ftp",
|
||||
"types" = "application/x-vnd.Be.URL.http",
|
||||
"types" = "application/x-vnd.Be.URL.https",
|
||||
"types" = "application/pdf",
|
||||
"types" = "application/x-pdf"
|
||||
};
|
||||
|
||||
resource vector_icon {
|
||||
$"6E63696604020006023C8EEA3EFC2CBFAD393D26A74B31994111B600FFFFFFFF"
|
||||
$"00AEFF0200140200FFFFFF0500040071040606FF07CC66BFB3CC66BFB3CC66C6"
|
||||
$"B6BFB3CC66C6B6CC66B8AFCC6620BFB320C6B620B8AFBFB320B8AF20C6B620CC"
|
||||
$"66BFB3CC66B8AFCC66BFB3BFB30230C22EC7F7C22EC7F7C344C7A0C501C67FC4"
|
||||
$"27C72AC576C624C693C4E9C63FC559C778C3BAC842C0CEC814C23EC858C01EC8"
|
||||
$"29BE05C84BBEA8C7D0BC57C5E1B9B5C710BAECC524B8F3C39BB804C478B873C2"
|
||||
$"4CB75CBFB3B718C12CB718BE23B717BB69B837BCC4B773BA2DB8E9B834BB6DB8"
|
||||
$"E7BA2FB7B0BC56B72ABE69B750BD6BB712BF0FB72AC0F8B711C059B75AC236B8"
|
||||
$"82C478B7D3C370B8E1C508B932C4D6B8DEC507B9C9C480BA43C3B5B9F1C456BA"
|
||||
$"A3C2F9BB66C1E3BB0AC255BBD1C15FBC16C0CBBBE0C147BC3142BC82BFFEBC61"
|
||||
$"C030BC95BFE0BCBCBFA4BCA9BFC2BCA3BF8BBC70BF59BC8ABF72BC0CBEF6BBA8"
|
||||
$"BE4DBBB8BE86BB98BE12BBF7BDC6BBABBDF2BC43BD9ABD47BD78BC7ABD8DBDAA"
|
||||
$"BD6EBE38BD4EBE16BD5BBE5ABD41BF19BCD4BEC0BD0AC01DBC36C0CEBC32C033"
|
||||
$"BC2EC152BC34C1A0BC05C152BC34C243BBA3C462B9EDC32EBAF1C49EB9BBC4E1"
|
||||
$"B996C4D7B994C50DB99FC569BAE4C55DBA63C570BB32C533BBF8C561BB7FC526"
|
||||
$"BC18C526BC3DC521BC38C533BC4BC561BBF4C561BC12C561BBCEC59CBBEAC57A"
|
||||
$"BBCAC5B5BC01C5FCBC08C5CABC08C632BC08C655BC29C640BC0DC679BC59C666"
|
||||
$"BD30C682BCDCC64BBD80C5B0BE00C5FABDDEC56EBE1FC4ABBF00C4E9BEA1C493"
|
||||
$"BF24C447BFA7C466BF6FC428BFDFC3D4C063C3F4C033C394C0C0C329C1F9C35E"
|
||||
$"C142C30AC266C306C373C307C282C305C496C2A7C537C2F6C4DDC24DC59DC1ED"
|
||||
$"C709C1F4C67CC1E8C762C1C7C7F9C1DAC7B945C816C22EC7F7C1CEC815C22EC7"
|
||||
$"F7C22EC7F7C22EC7F7C22EC7F7020FBE6AC9CABE6AC9CABCA2C990B972C7B9BA"
|
||||
$"EEC8DAB8F6C75AB7A8C5EBB80EC670B68CC478B5A0C116B5DBC2D3B588C058B5"
|
||||
$"A1BE4BB588BEFAB61EBAE5BB55B685B842B7FABCC3B5D8BFBBB58EBE12B58EC2"
|
||||
$"6BB58EC6BCB862C4CEB685C7ABB948C8D4BB3DC84BBA23C98DBCBAC9D8BFBCC9"
|
||||
$"D8BE06C9D8C1FDC7D7C5C7C931C3F4C771C652C623C793C6A8C726C4B5C8BEC1"
|
||||
$"15C9C6C2E3C989C075C9DBBE6AC9CABEFCC9DDBE6AC9CABE6AC9CABE6AC9CABE"
|
||||
$"6AC9CA0205C01BBD68C01BBD68C042BD36C091BCD2C06ABD04C0D0BCC9C14DBC"
|
||||
$"B7C10EBCC0C126BCEAC0D8BD4EC0FFBD1CC099BD57C01BBD68C05ABD5FC01BBD"
|
||||
$"68050A030100023F3F400000000000003C9AA046C0004AA0000A020100123F9F"
|
||||
$"A00000000000003F9FA043000043000001178500040A000100023F6F70000000"
|
||||
$"0000003F5F604480004480000A0102010202404853000000000000404863C43F"
|
||||
$"6DC4418F0A02010302404853000000000000404863C43F6DC4418F"
|
||||
};
|
||||
@@ -12,11 +12,15 @@ COPYRIGHT="1995-2025 Mozilla Developers and Contributors"
|
||||
LICENSE="MPL v2.0"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://gitlab.com/api/v4/projects/32320088/packages/generic/librewolf-source/${portVersion}-1/librewolf-${portVersion}-1.source.tar.gz"
|
||||
CHECKSUM_SHA256="9ff46d1294210d7f617c81d560e9ba507f9acf88195fabefc2cc5b6cd55bcbc1"
|
||||
CHECKSUM_SHA256="c174bf549444793ca3304f644a8a9e9161ad5249ba03f3763395542d9ab674e5"
|
||||
SOURCE_DIR="librewolf-${portVersion}-1"
|
||||
PATCHES="librewolf-$portVersion.patchset"
|
||||
PATCHES="
|
||||
librewolf-$portVersion.patchset
|
||||
librewolf_launcher-$portVersion.patchset
|
||||
"
|
||||
ADDITIONAL_FILES="
|
||||
librewolf.rdef.in
|
||||
librewolf_launcher.rdef.in
|
||||
mozconfig
|
||||
"
|
||||
|
||||
@@ -106,6 +110,9 @@ BUILD()
|
||||
./mach python build/gn_processor.py dom/media/webrtc/third_party_build/gn-configs/webrtc.json
|
||||
|
||||
./mach build
|
||||
|
||||
cd tools/haiku-launcher
|
||||
gcc -o "LibreWolf Browser" launcher.cpp -lbe
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
@@ -120,6 +127,7 @@ INSTALL()
|
||||
|
||||
mv /usr/local/lib/librewolf $appsDir/LibreWolf
|
||||
mv $appsDir/LibreWolf/librewolf $appsDir/LibreWolf/LibreWolf
|
||||
cp "tools/haiku-launcher/LibreWolf Browser" $appsDir/LibreWolf
|
||||
|
||||
mkdir -p $appsDir/LibreWolf/lib
|
||||
|
||||
@@ -139,7 +147,7 @@ INSTALL()
|
||||
local APP_SIGNATURE="application/x-vnd.librewolf"
|
||||
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
|
||||
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
|
||||
local MINOR="0"
|
||||
local MINOR="`echo "$portVersion" | cut -d. -f3`"
|
||||
local LONG_INFO="$SUMMARY"
|
||||
sed \
|
||||
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
|
||||
@@ -149,7 +157,15 @@ INSTALL()
|
||||
-e "s|@LONG_INFO@|$LONG_INFO|" \
|
||||
$portDir/additional-files/librewolf.rdef.in > librewolf.rdef
|
||||
|
||||
sed \
|
||||
-e "s|@MAJOR@|$MAJOR|" \
|
||||
-e "s|@MIDDLE@|$MIDDLE|" \
|
||||
-e "s|@MINOR@|$MINOR|" \
|
||||
-e "s|@LONG_INFO@|$LONG_INFO|" \
|
||||
$portDir/additional-files/librewolf_launcher.rdef.in > librewolf_launcher.rdef
|
||||
|
||||
addResourcesToBinaries librewolf.rdef $appsDir/LibreWolf/LibreWolf
|
||||
addResourcesToBinaries librewolf_launcher.rdef "$appsDir/LibreWolf/LibreWolf Browser"
|
||||
|
||||
addAppDeskbarSymlink $appsDir/LibreWolf/LibreWolf
|
||||
}
|
||||
@@ -4616,24 +4616,6 @@ index 4ba9f55..2355246 100644
|
||||
return "Mozilla"
|
||||
return ".mozilla"
|
||||
|
||||
diff --git a/toolkit/moz.configure.orig b/toolkit/moz.configure.orig
|
||||
index e5e5176..4ba9f55 100644
|
||||
--- a/toolkit/moz.configure.orig
|
||||
+++ b/toolkit/moz.configure.orig
|
||||
@@ -881,9 +881,10 @@ set_config("MOZ_SYSTEM_AV1", True, when="--with-system-av1")
|
||||
option("--disable-jxl", help="Disable jxl image support")
|
||||
|
||||
|
||||
-@depends("--disable-jxl", milestone.is_nightly)
|
||||
-def jxl(value, is_nightly):
|
||||
- if is_nightly and value:
|
||||
+@depends("--disable-jxl")
|
||||
+def jxl(value):
|
||||
+ enabled = bool(value)
|
||||
+ if enabled:
|
||||
return True
|
||||
|
||||
|
||||
diff --git a/toolkit/system/gnome/moz.build b/toolkit/system/gnome/moz.build
|
||||
index aa2df2b..a42f897 100644
|
||||
--- a/toolkit/system/gnome/moz.build
|
||||
@@ -5335,82 +5317,6 @@ index e495237..68a4269 100644
|
||||
if (!profile.IsEmpty()) {
|
||||
rv = AppendProfileString(aFile, profile.get());
|
||||
} else {
|
||||
diff --git a/toolkit/xre/nsXREDirProvider.cpp.orig b/toolkit/xre/nsXREDirProvider.cpp.orig
|
||||
index 3b4612e..e495237 100644
|
||||
--- a/toolkit/xre/nsXREDirProvider.cpp.orig
|
||||
+++ b/toolkit/xre/nsXREDirProvider.cpp.orig
|
||||
@@ -285,16 +285,16 @@ static nsresult GetSystemParentDirectory(nsIFile** aFile) {
|
||||
rv = GetOSXFolderType(kOnSystemDisk, kApplicationSupportFolderType,
|
||||
getter_AddRefs(localDir));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
- rv = localDir->AppendNative("Mozilla"_ns);
|
||||
+ rv = localDir->AppendNative("LibreWolf"_ns);
|
||||
}
|
||||
# else
|
||||
constexpr auto dirname =
|
||||
# ifdef HAVE_USR_LIB64_DIR
|
||||
- "/usr/lib64/mozilla"_ns
|
||||
+ "/usr/lib64/librewolf"_ns
|
||||
# elif defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
- "/usr/local/lib/mozilla"_ns
|
||||
+ "/usr/local/lib/librewolf"_ns
|
||||
# else
|
||||
- "/usr/lib/mozilla"_ns
|
||||
+ "/usr/lib/librewolf"_ns
|
||||
# endif
|
||||
;
|
||||
rv = NS_NewNativeLocalFile(dirname, getter_AddRefs(localDir));
|
||||
@@ -366,9 +366,9 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
||||
rv = GetUserDataDirectoryHome(getter_AddRefs(file), false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
# if defined(XP_MACOSX)
|
||||
- rv = file->AppendNative("Mozilla"_ns);
|
||||
+ rv = file->AppendNative("LibreWolf"_ns);
|
||||
# else // defined(XP_MACOSX)
|
||||
- rv = file->AppendNative(".mozilla"_ns);
|
||||
+ rv = file->AppendNative(".librewolf"_ns);
|
||||
# endif // defined(XP_MACOSX)
|
||||
}
|
||||
#endif // defined(XP_UNIX) || defined(XP_MACOSX)
|
||||
@@ -398,9 +398,9 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
|
||||
else if (!strcmp(aProperty, XRE_SYS_SHARE_EXTENSION_PARENT_DIR)) {
|
||||
# ifdef ENABLE_SYSTEM_EXTENSION_DIRS
|
||||
# if defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
- static const char* const sysLExtDir = "/usr/local/share/mozilla/extensions";
|
||||
+ static const char* const sysLExtDir = "/usr/local/share/librewolf/extensions";
|
||||
# else
|
||||
- static const char* const sysLExtDir = "/usr/share/mozilla/extensions";
|
||||
+ static const char* const sysLExtDir = "/usr/share/librewolf/extensions";
|
||||
# endif
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(sysLExtDir),
|
||||
getter_AddRefs(file));
|
||||
@@ -932,7 +932,7 @@ nsresult nsXREDirProvider::GetUpdateRootDir(nsIFile** aResult,
|
||||
nsDependentCString(hasVendor ? GetAppVendor() : GetAppName())))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
- } else if (NS_FAILED(localDir->AppendNative("Mozilla"_ns))) {
|
||||
+ } else if (NS_FAILED(localDir->AppendNative("LibreWolf"_ns))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1192,7 +1192,7 @@ nsresult nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile) {
|
||||
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN)
|
||||
|
||||
- static const char* const sXR = "Mozilla";
|
||||
+ static const char* const sXR = "LibreWolf";
|
||||
rv = aFile->AppendNative(nsDependentCString(sXR));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@@ -1202,7 +1202,7 @@ nsresult nsXREDirProvider::AppendSysUserExtensionPath(nsIFile* aFile) {
|
||||
|
||||
#elif defined(XP_UNIX)
|
||||
|
||||
- static const char* const sXR = ".mozilla";
|
||||
+ static const char* const sXR = ".librewolf";
|
||||
rv = aFile->AppendNative(nsDependentCString(sXR));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
diff --git a/tools/profiler/core/ProfilerUtils.cpp b/tools/profiler/core/ProfilerUtils.cpp
|
||||
index 4c53061..76d3561 100644
|
||||
--- a/tools/profiler/core/ProfilerUtils.cpp
|
||||
@@ -5601,3 +5507,339 @@ index dbd9993..1431340 100644
|
||||
--
|
||||
2.48.1
|
||||
|
||||
|
||||
From c50ab036bba159ac86a3b8322bb097f327544523 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sat, 5 Apr 2025 15:58:03 +1000
|
||||
Subject: Implement native remote server
|
||||
|
||||
|
||||
diff --git a/toolkit/components/remote/RemoteUtils.h b/toolkit/components/remote/RemoteUtils.h
|
||||
index c4c1bcd..2beb4ea 100644
|
||||
--- a/toolkit/components/remote/RemoteUtils.h
|
||||
+++ b/toolkit/components/remote/RemoteUtils.h
|
||||
@@ -13,7 +13,7 @@
|
||||
# include "WinUtils.h"
|
||||
#endif
|
||||
|
||||
-#if defined XP_WIN || defined XP_MACOSX
|
||||
+#if defined XP_WIN || defined XP_MACOSX || defined XP_HAIKU
|
||||
static void BuildClassName(const char* aProgram, const char* aProfile,
|
||||
nsString& aClassName) {
|
||||
// On Windows, the class name is used as the window class.
|
||||
@@ -30,6 +30,8 @@ static void BuildClassName(const char* aProgram, const char* aProfile,
|
||||
|
||||
# if defined XP_WIN
|
||||
constexpr size_t ClassNameMaxLength = 256;
|
||||
+# elif defined XP_HAIKU
|
||||
+ constexpr size_t ClassNameMaxLength = 32;
|
||||
# else
|
||||
constexpr size_t ClassNameMaxLength = 128;
|
||||
# endif
|
||||
diff --git a/toolkit/components/remote/moz.build b/toolkit/components/remote/moz.build
|
||||
index 4230dfe..f003ea3 100644
|
||||
--- a/toolkit/components/remote/moz.build
|
||||
+++ b/toolkit/components/remote/moz.build
|
||||
@@ -28,7 +28,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
"nsUnixRemoteServer.cpp",
|
||||
"RemoteUtils.cpp",
|
||||
]
|
||||
- if CONFIG["MOZ_ENABLE_DBUS"]:
|
||||
+ if CONFIG["MOZ_ENABLE_DBUS"] and CONFIG["OS_ARCH"] != "Haiku":
|
||||
SOURCES += [
|
||||
"nsDBusRemoteClient.cpp",
|
||||
"nsDBusRemoteServer.cpp",
|
||||
@@ -39,11 +39,22 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
|
||||
]
|
||||
CXXFLAGS += CONFIG["MOZ_DBUS_CFLAGS"]
|
||||
else:
|
||||
- SOURCES += [
|
||||
- "nsGTKRemoteServer.cpp",
|
||||
- "nsXRemoteClient.cpp",
|
||||
- "nsXRemoteServer.cpp",
|
||||
- ]
|
||||
+ if CONFIG["OS_ARCH"] == "Haiku":
|
||||
+ SOURCES += [
|
||||
+ "nsHaikuRemoteClient.cpp",
|
||||
+ "nsHaikuRemoteServer.cpp",
|
||||
+ ]
|
||||
+ EXPORTS += [
|
||||
+ "nsUnixRemoteServer.h",
|
||||
+ "RemoteUtils.h",
|
||||
+ ]
|
||||
+ CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
|
||||
+ else:
|
||||
+ SOURCES += [
|
||||
+ "nsGTKRemoteServer.cpp",
|
||||
+ "nsXRemoteClient.cpp",
|
||||
+ "nsXRemoteServer.cpp",
|
||||
+ ]
|
||||
CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"]
|
||||
|
||||
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
|
||||
diff --git a/toolkit/components/remote/nsHaikuRemoteClient.cpp b/toolkit/components/remote/nsHaikuRemoteClient.cpp
|
||||
new file mode 100644
|
||||
index 0000000..2bec3ce
|
||||
--- /dev/null
|
||||
+++ b/toolkit/components/remote/nsHaikuRemoteClient.cpp
|
||||
@@ -0,0 +1,35 @@
|
||||
+#include <vector>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include "nsHaikuRemoteClient.h"
|
||||
+
|
||||
+#include "RemoteUtils.h"
|
||||
+
|
||||
+nsresult nsHaikuRemoteClient::Init() {
|
||||
+ return NS_OK;
|
||||
+}
|
||||
+
|
||||
+nsresult nsHaikuRemoteClient::SendCommandLine(const char* aProgram,
|
||||
+ const char* aProfile,
|
||||
+ int32_t argc,
|
||||
+ const char** argv,
|
||||
+ bool aRaise) {
|
||||
+ nsString className;
|
||||
+ BuildClassName(aProgram, aProfile, className);
|
||||
+ BString portName;
|
||||
+ portName.SetTo(NS_ConvertUTF16toUTF8(className.get()).get());
|
||||
+
|
||||
+ port_id port = find_port(portName.String());
|
||||
+ if (port < 0) {
|
||||
+ return NS_ERROR_NOT_AVAILABLE;
|
||||
+ }
|
||||
+
|
||||
+ BString message;
|
||||
+ message << (aRaise ? "1" : "0");
|
||||
+ for (int i = 0; i < argc; i++) {
|
||||
+ message << "|" << argv[i];
|
||||
+ }
|
||||
+
|
||||
+ status_t result = write_port(port, 1, message.String(), message.Length() + 1);
|
||||
+ return (result == B_OK) ? NS_OK : NS_ERROR_FAILURE;
|
||||
+}
|
||||
diff --git a/toolkit/components/remote/nsHaikuRemoteClient.h b/toolkit/components/remote/nsHaikuRemoteClient.h
|
||||
new file mode 100644
|
||||
index 0000000..de9c0a2
|
||||
--- /dev/null
|
||||
+++ b/toolkit/components/remote/nsHaikuRemoteClient.h
|
||||
@@ -0,0 +1,22 @@
|
||||
+#ifndef HAIKU_REMOTE_CLIENT_H
|
||||
+#define HAIKU_REMOTE_CLIENT_H
|
||||
+
|
||||
+#pragma GCC visibility push(default)
|
||||
+#include <kernel/OS.h>
|
||||
+#include <app/Messenger.h>
|
||||
+#include <support/String.h>
|
||||
+#pragma GCC visibility pop
|
||||
+
|
||||
+#include "nsRemoteClient.h"
|
||||
+
|
||||
+class nsHaikuRemoteClient : public nsRemoteClient {
|
||||
+public:
|
||||
+ virtual ~nsHaikuRemoteClient() = default;
|
||||
+
|
||||
+ nsresult Init() override;
|
||||
+ nsresult SendCommandLine(const char* aProgram, const char* aProfile,
|
||||
+ int32_t argc, const char** argv,
|
||||
+ bool aRaise) override;
|
||||
+};
|
||||
+
|
||||
+#endif
|
||||
diff --git a/toolkit/components/remote/nsHaikuRemoteServer.cpp b/toolkit/components/remote/nsHaikuRemoteServer.cpp
|
||||
new file mode 100644
|
||||
index 0000000..aebefa1
|
||||
--- /dev/null
|
||||
+++ b/toolkit/components/remote/nsHaikuRemoteServer.cpp
|
||||
@@ -0,0 +1,107 @@
|
||||
+#include "nsHaikuRemoteServer.h"
|
||||
+#include "RemoteUtils.h"
|
||||
+
|
||||
+#include "nsCommandLine.h"
|
||||
+#include "nsICommandLineRunner.h"
|
||||
+#include "nsICommandLine.h"
|
||||
+#include "nsCOMPtr.h"
|
||||
+#include "nsThreadUtils.h"
|
||||
+
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+nsHaikuRemoteServer::nsHaikuRemoteServer()
|
||||
+ : fRunning(false), fPort(B_BAD_PORT_ID) {}
|
||||
+
|
||||
+nsHaikuRemoteServer::~nsHaikuRemoteServer() {
|
||||
+ Shutdown();
|
||||
+}
|
||||
+
|
||||
+nsresult nsHaikuRemoteServer::Startup(const char* aAppName, const char* aProfileName) {
|
||||
+ nsString className;
|
||||
+ BuildClassName(aAppName, aProfileName, className);
|
||||
+ BString portName;
|
||||
+ portName.SetTo(NS_ConvertUTF16toUTF8(className.get()).get());
|
||||
+
|
||||
+ fPort = create_port(10, portName.String());
|
||||
+ if (fPort < 0) {
|
||||
+ return NS_ERROR_FAILURE;
|
||||
+ }
|
||||
+
|
||||
+ fRunning = true;
|
||||
+ fListenerThread = std::thread([this]() { ListenLoop(); });
|
||||
+
|
||||
+ return NS_OK;
|
||||
+}
|
||||
+
|
||||
+void nsHaikuRemoteServer::Shutdown() {
|
||||
+ fRunning = false;
|
||||
+ if (fPort >= 0) {
|
||||
+ delete_port(fPort);
|
||||
+ fPort = B_BAD_PORT_ID;
|
||||
+ }
|
||||
+ if (fListenerThread.joinable()) {
|
||||
+ fListenerThread.join();
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void nsHaikuRemoteServer::ListenLoop() {
|
||||
+ while (fRunning) {
|
||||
+ char buffer[B_PATH_NAME_LENGTH * 2];
|
||||
+ int32 code;
|
||||
+ ssize_t len = read_port(fPort, &code, buffer, sizeof(buffer));
|
||||
+ if (len > 0) {
|
||||
+ buffer[len] = '\0';
|
||||
+ HandleMessage(buffer);
|
||||
+ } else {
|
||||
+ snooze(50000);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+nsresult nsHaikuRemoteServer::HandleMessage(const char* message) {
|
||||
+ return NS_DispatchToMainThread(
|
||||
+ NS_NewRunnableFunction("HandleMessageOnMainThread", [this, msg = std::string(message)]() {
|
||||
+ this->HandleMessageOnMainThread(msg.c_str());
|
||||
+ })
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+void nsHaikuRemoteServer::HandleMessageOnMainThread(const char* message) {
|
||||
+ BString messageString(message);
|
||||
+ BStringList argsList;
|
||||
+ messageString.Split("|", true, argsList);
|
||||
+
|
||||
+ if (argsList.IsEmpty())
|
||||
+ return;
|
||||
+
|
||||
+ bool activate = (argsList.First() == "1");
|
||||
+
|
||||
+ argsList.Remove(0);
|
||||
+
|
||||
+ int argc = argsList.CountStrings();
|
||||
+ const char** argv = new const char*[argc];
|
||||
+ for (int i = 0; i < argc; i++) {
|
||||
+ argv[i] = argsList.StringAt(i).String();
|
||||
+ }
|
||||
+
|
||||
+ nsCOMPtr<nsICommandLineRunner> cmdLine(new nsCommandLine());
|
||||
+ nsresult rv = cmdLine->Init(argc, argv, nullptr, nsICommandLine::STATE_REMOTE_AUTO);
|
||||
+ delete[] argv;
|
||||
+
|
||||
+ if (NS_SUCCEEDED(rv)) {
|
||||
+ cmdLine->Run();
|
||||
+ if (activate) {
|
||||
+ team_info teamInfo;
|
||||
+ if (get_team_info(B_CURRENT_TEAM, &teamInfo) == B_OK) {
|
||||
+ if (be_roster->ActivateApp(teamInfo.team) != B_OK && be_app != NULL) {
|
||||
+ // if the activation fails, activate all titled windows
|
||||
+ for (int32 i = 0; BWindow* window = be_app->WindowAt(i); i++) {
|
||||
+ if (window->Type() == B_TITLED_WINDOW) {
|
||||
+ window->Activate(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
diff --git a/toolkit/components/remote/nsHaikuRemoteServer.h b/toolkit/components/remote/nsHaikuRemoteServer.h
|
||||
new file mode 100644
|
||||
index 0000000..7c6d057
|
||||
--- /dev/null
|
||||
+++ b/toolkit/components/remote/nsHaikuRemoteServer.h
|
||||
@@ -0,0 +1,37 @@
|
||||
+#ifndef HAIKU_REMOTE_SERVER_H
|
||||
+#define HAIKU_REMOTE_SERVER_H
|
||||
+
|
||||
+#include "nsRemoteServer.h"
|
||||
+
|
||||
+#include <thread>
|
||||
+#include <atomic>
|
||||
+
|
||||
+#pragma GCC visibility push(default)
|
||||
+#include <kernel/OS.h>
|
||||
+#include <app/Application.h>
|
||||
+#include <app/Messenger.h>
|
||||
+#include <app/Roster.h>
|
||||
+#include <interface/Window.h>
|
||||
+#include <support/String.h>
|
||||
+#include <support/StringList.h>
|
||||
+#pragma GCC visibility pop
|
||||
+
|
||||
+class nsHaikuRemoteServer : public nsRemoteServer {
|
||||
+public:
|
||||
+ nsHaikuRemoteServer();
|
||||
+ ~nsHaikuRemoteServer() override;
|
||||
+
|
||||
+ nsresult Startup(const char* aAppName, const char* aProfileName) override;
|
||||
+ void Shutdown() override;
|
||||
+
|
||||
+private:
|
||||
+ void ListenLoop();
|
||||
+ nsresult HandleMessage(const char* message);
|
||||
+ void HandleMessageOnMainThread(const char* message);
|
||||
+
|
||||
+ std::atomic<bool> fRunning;
|
||||
+ std::thread fListenerThread;
|
||||
+ port_id fPort;
|
||||
+};
|
||||
+
|
||||
+#endif
|
||||
diff --git a/toolkit/components/remote/nsRemoteService.cpp b/toolkit/components/remote/nsRemoteService.cpp
|
||||
index 46860f6..b010d4d 100644
|
||||
--- a/toolkit/components/remote/nsRemoteService.cpp
|
||||
+++ b/toolkit/components/remote/nsRemoteService.cpp
|
||||
@@ -7,7 +7,10 @@
|
||||
|
||||
#include "nsRemoteClient.h"
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
-# ifdef MOZ_ENABLE_DBUS
|
||||
+# if defined(XP_HAIKU)
|
||||
+# include "nsHaikuRemoteServer.h"
|
||||
+# include "nsHaikuRemoteClient.h"
|
||||
+# elif defined(MOZ_ENABLE_DBUS)
|
||||
# include "nsDBusRemoteServer.h"
|
||||
# include "nsDBusRemoteClient.h"
|
||||
# else
|
||||
@@ -196,7 +199,9 @@ nsresult nsRemoteService::SendCommandLine(const nsACString& aProfile,
|
||||
|
||||
UniquePtr<nsRemoteClient> client;
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
-# if defined(MOZ_ENABLE_DBUS)
|
||||
+# if defined(XP_HAIKU)
|
||||
+ client = MakeUnique<nsHaikuRemoteClient>();
|
||||
+# elif defined(MOZ_ENABLE_DBUS)
|
||||
client = MakeUnique<nsDBusRemoteClient>(mStartupToken);
|
||||
# else
|
||||
client = MakeUnique<nsXRemoteClient>(mStartupToken);
|
||||
@@ -258,7 +263,9 @@ void nsRemoteService::StartupServer() {
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
-# if defined(MOZ_ENABLE_DBUS)
|
||||
+# if defined(XP_HAIKU)
|
||||
+ mRemoteServer = MakeUnique<nsHaikuRemoteServer>();
|
||||
+# elif defined(MOZ_ENABLE_DBUS)
|
||||
mRemoteServer = MakeUnique<nsDBusRemoteServer>();
|
||||
# else
|
||||
mRemoteServer = MakeUnique<nsGTKRemoteServer>();
|
||||
--
|
||||
2.48.1
|
||||
|
||||
126
www-client/librewolf/patches/librewolf_launcher-137.0.1.patchset
Normal file
126
www-client/librewolf/patches/librewolf_launcher-137.0.1.patchset
Normal file
@@ -0,0 +1,126 @@
|
||||
From 87d14d4ef2e06f7dfeeb66aa2fac74fef2e58cc6 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Sun, 6 Apr 2025 10:13:00 +1000
|
||||
Subject: Add simple launcher app
|
||||
|
||||
|
||||
diff --git a/tools/haiku-launcher/launcher.cpp b/tools/haiku-launcher/launcher.cpp
|
||||
new file mode 100644
|
||||
index 0000000..86a9f22
|
||||
--- /dev/null
|
||||
+++ b/tools/haiku-launcher/launcher.cpp
|
||||
@@ -0,0 +1,111 @@
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <errno.h>
|
||||
+#include <string.h>
|
||||
+
|
||||
+#include <Application.h>
|
||||
+#include <Alert.h>
|
||||
+#include <String.h>
|
||||
+#include <Resources.h>
|
||||
+#include <Roster.h>
|
||||
+#include <Mime.h>
|
||||
+#include <Path.h>
|
||||
+#include <AppFileInfo.h>
|
||||
+#include <kernel/image.h>
|
||||
+
|
||||
+class BrowserLauncherApp : public BApplication {
|
||||
+ public:
|
||||
+ BrowserLauncherApp(const char *signature, int argc, char **argv);
|
||||
+ ~BrowserLauncherApp() {};
|
||||
+
|
||||
+ virtual void RefsReceived(BMessage *pmsg);
|
||||
+ virtual void ArgvRecieved(int32 argc, char**argv);
|
||||
+ virtual void ReadyToRun();
|
||||
+ BString GetBinPath(void);
|
||||
+
|
||||
+ private:
|
||||
+ BString fCommandLine;
|
||||
+};
|
||||
+
|
||||
+BrowserLauncherApp::BrowserLauncherApp(const char *signature, int argc, char **argv)
|
||||
+ : BApplication(signature)
|
||||
+{
|
||||
+ ArgvRecieved(argc, argv);
|
||||
+}
|
||||
+
|
||||
+BString
|
||||
+BrowserLauncherApp::GetBinPath(void)
|
||||
+{
|
||||
+ BPath binPath;
|
||||
+
|
||||
+ image_info info;
|
||||
+ int32 cookie = 0;
|
||||
+
|
||||
+ while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
+ if (info.type == B_APP_IMAGE) {
|
||||
+ binPath.SetTo(info.name);
|
||||
+ binPath.GetParent(&binPath);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ binPath.Append("LibreWolf");
|
||||
+
|
||||
+ return binPath.Path();
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+BrowserLauncherApp::RefsReceived(BMessage *pmsg)
|
||||
+{
|
||||
+ fCommandLine = GetBinPath();
|
||||
+
|
||||
+ entry_ref ref;
|
||||
+ for (int32 i = 0; pmsg->FindRef("refs", i, &ref) == B_OK; i++) {
|
||||
+ BPath file = BPath(&ref);
|
||||
+ fCommandLine += " \"";
|
||||
+ fCommandLine += file.Path();
|
||||
+ fCommandLine += "\"";
|
||||
+ }
|
||||
+
|
||||
+ BString url;
|
||||
+ for (int32 i = 0; pmsg->FindString("url", i, &url) == B_OK; i++) {
|
||||
+ fCommandLine += " \"";
|
||||
+ fCommandLine += url;
|
||||
+ fCommandLine += "\"";
|
||||
+ }
|
||||
+
|
||||
+ fCommandLine += " &";
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+BrowserLauncherApp::ArgvRecieved(int32 argc, char**argv)
|
||||
+{
|
||||
+ BMessage message(B_REFS_RECEIVED);
|
||||
+ for (int i = 1; i < argc; i++) {
|
||||
+ const char* url = argv[i];
|
||||
+ BEntry entry(argv[i], true);
|
||||
+ BPath path;
|
||||
+ if (entry.Exists() && entry.GetPath(&path) == B_OK)
|
||||
+ url = path.Path();
|
||||
+ message.AddString("url", url);
|
||||
+ }
|
||||
+ RefsReceived(&message);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+BrowserLauncherApp::ReadyToRun()
|
||||
+{
|
||||
+ if (!fCommandLine.IsEmpty())
|
||||
+ system(fCommandLine.String());
|
||||
+
|
||||
+ Quit();
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char **argv)
|
||||
+{
|
||||
+ BrowserLauncherApp application("application/x-vnd.librewolf-launcher", argc, argv);
|
||||
+ application.Run();
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
--
|
||||
2.48.1
|
||||
|
||||
Reference in New Issue
Block a user