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:
@@ -37,8 +37,6 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenFileDialog() {}
|
||||
|
||||
void SetFilters(GtkFileDialog* pDialog, const std::vector<ui::FileDialogFilter>& filters)
|
||||
{
|
||||
if (filters.empty())
|
||||
|
||||
22
src/ModMan/Web/Platform/Linux/FaviconHandlerLinux.cpp
Normal file
22
src/ModMan/Web/Platform/Linux/FaviconHandlerLinux.cpp
Normal 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
|
||||
16
src/ModMan/Web/Platform/Linux/FaviconHandlerLinux.h
Normal file
16
src/ModMan/Web/Platform/Linux/FaviconHandlerLinux.h
Normal 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
|
||||
31
src/ModMan/Web/Platform/Linux/TitleHandlerLinux.cpp
Normal file
31
src/ModMan/Web/Platform/Linux/TitleHandlerLinux.cpp
Normal 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
|
||||
16
src/ModMan/Web/Platform/Linux/TitleHandlerLinux.h
Normal file
16
src/ModMan/Web/Platform/Linux/TitleHandlerLinux.h
Normal 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
|
||||
@@ -3,6 +3,8 @@
|
||||
#include "ModManArgs.h"
|
||||
#include "Web/Binds/Binds.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/TitleHandlerWindows.h"
|
||||
#include "Web/UiCommunication.h"
|
||||
|
||||
Reference in New Issue
Block a user