Wayland: Set app_id for icon in kde (#718)

This commit is contained in:
Colin Kinloch 2023-03-29 15:28:17 +01:00 committed by GitHub
parent 715d2247a9
commit be1e77186e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 51 additions and 3 deletions

View file

@ -0,0 +1,24 @@
#include "gui/helpers/wxWayland.h"
#if BOOST_OS_LINUX && HAS_WAYLAND
#include <dlfcn.h>
bool wxWlIsWaylandWindow(wxWindow* window)
{
GtkWidget* gtkWindow = static_cast<GtkWidget*>(window->GetHandle());
GdkWindow* gdkWindow = gtk_widget_get_window(gtkWindow);
return GDK_IS_WAYLAND_WINDOW(gdkWindow);
}
void wxWlSetAppId(wxFrame* frame, const char* applicationId)
{
GtkWidget* gtkWindow = static_cast<GtkWidget*>(frame->GetHandle());
gtk_widget_realize(gtkWindow);
GdkWindow* gdkWindow = gtk_widget_get_window(gtkWindow);
static auto gdk_wl_set_app_id = reinterpret_cast<void (*) (GdkWindow*, const char*)>(dlsym(nullptr, "gdk_wayland_window_set_application_id"));
if (gdk_wl_set_app_id)
gdk_wl_set_app_id(gdkWindow, applicationId);
}
#endif // BOOST_OS_LINUX && HAS_WAYLAND

View file

@ -1,6 +1,6 @@
#pragma once
#if BOOST_OS_LINUX
#if BOOST_OS_LINUX && HAS_WAYLAND
#include <gdk/gdk.h>
#include <gdk/gdkwayland.h>
@ -27,7 +27,7 @@ class wxWlSubsurface
int32_t m_xPos = 0;
int32_t m_yPos = 0;
public:
public:
wxWlSubsurface(wxWindow* window)
{
GtkWidget* widget = static_cast<GtkWidget*>(window->GetHandle());
@ -72,4 +72,7 @@ class wxWlSubsurface
}
};
#endif // BOOST_OS_LINUX
bool wxWlIsWaylandWindow(wxWindow* window);
void wxWlSetAppId(wxFrame* frame, const char* application_id);
#endif // BOOST_OS_LINUX && HAS_WAYLAND