2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-17 18:52:06 +00:00

feat: add modman title handler for linux

This commit is contained in:
Jan Laupetin
2025-10-31 22:49:38 +01:00
parent b1bd9b9ffc
commit d964929681
6 changed files with 87 additions and 2 deletions

View File

@@ -37,8 +37,6 @@ namespace
#endif #endif
} }
void OpenFileDialog() {}
void SetFilters(GtkFileDialog* pDialog, const std::vector<ui::FileDialogFilter>& filters) void SetFilters(GtkFileDialog* pDialog, const std::vector<ui::FileDialogFilter>& filters)
{ {
if (filters.empty()) if (filters.empty())

View File

@@ -0,0 +1,22 @@
#include "AssetHandlerLinux.h"
#if defined(WEBVIEW_PLATFORM_LINUX) && defined(WEBVIEW_GTK)
#include "Web/UiAssets.h"
#include <format>
#include <iostream>
#include <unordered_map>
using namespace PLATFORM_NAMESPACE_LINUX;
namespace
{
} // namespace
namespace PLATFORM_NAMESPACE_LINUX
{
void InstallFaviconHandler(webview::webview& wv) {}
} // namespace PLATFORM_NAMESPACE_LINUX
#endif

View File

@@ -0,0 +1,16 @@
#pragma once
#include "Web/Platform/Platform.h"
#include <webview/macros.h>
#if defined(WEBVIEW_PLATFORM_LINUX) && defined(WEBVIEW_GTK)
#include "Web/WebViewLib.h"
namespace PLATFORM_NAMESPACE_LINUX
{
void InstallFaviconHandler(webview::webview& wv);
} // namespace PLATFORM_NAMESPACE_LINUX
#endif

View File

@@ -0,0 +1,31 @@
#include "AssetHandlerLinux.h"
#if defined(WEBVIEW_PLATFORM_LINUX) && defined(WEBVIEW_GTK)
#include "Web/UiAssets.h"
#include <format>
#include <iostream>
#include <unordered_map>
using namespace PLATFORM_NAMESPACE_LINUX;
namespace PLATFORM_NAMESPACE_LINUX
{
void InstallTitleHandler(webview::webview& wv)
{
const auto webViewWidget = static_cast<GtkWidget*>(wv.browser_controller().value());
const auto webView = WEBKIT_WEB_VIEW(webViewWidget);
const auto windowWidget = static_cast<GtkWidget*>(wv.window().value());
const auto window = GTK_WINDOW(windowWidget);
auto on_title_changed = +[](GtkWidget* widget, GParamSpec paramSpec, GtkWindow* window)
{
gtk_window_set_title(window, webkit_web_view_get_title(WEBKIT_WEB_VIEW(widget)));
};
g_signal_connect(G_OBJECT(webView), "notify::title", G_CALLBACK(on_title_changed), (gpointer)window);
}
} // namespace PLATFORM_NAMESPACE_LINUX
#endif

View File

@@ -0,0 +1,16 @@
#pragma once
#include "Web/Platform/Platform.h"
#include <webview/macros.h>
#if defined(WEBVIEW_PLATFORM_LINUX) && defined(WEBVIEW_GTK)
#include "Web/WebViewLib.h"
namespace PLATFORM_NAMESPACE_LINUX
{
void InstallTitleHandler(webview::webview& wv);
} // namespace PLATFORM_NAMESPACE_LINUX
#endif

View File

@@ -3,6 +3,8 @@
#include "ModManArgs.h" #include "ModManArgs.h"
#include "Web/Binds/Binds.h" #include "Web/Binds/Binds.h"
#include "Web/Platform/AssetHandler.h" #include "Web/Platform/AssetHandler.h"
#include "Web/Platform/Linux/FaviconHandlerLinux.h"
#include "Web/Platform/Linux/TitleHandlerLinux.h"
#include "Web/Platform/Windows/FaviconHandlerWindows.h" #include "Web/Platform/Windows/FaviconHandlerWindows.h"
#include "Web/Platform/Windows/TitleHandlerWindows.h" #include "Web/Platform/Windows/TitleHandlerWindows.h"
#include "Web/UiCommunication.h" #include "Web/UiCommunication.h"