mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-12-26 01:31:53 +01:00
Wayland: Set app_id for icon in kde (#718)
This commit is contained in:
parent
715d2247a9
commit
be1e77186e
@ -69,6 +69,8 @@ add_library(CemuGui
|
||||
helpers/wxHelpers.cpp
|
||||
helpers/wxHelpers.h
|
||||
helpers/wxLogEvent.h
|
||||
helpers/wxWayland.cpp
|
||||
helpers/wxWayland.h
|
||||
input/InputAPIAddWindow.cpp
|
||||
input/InputAPIAddWindow.h
|
||||
input/InputSettings2.cpp
|
||||
|
@ -12,6 +12,10 @@
|
||||
#include "gui/helpers/wxHelpers.h"
|
||||
#include "Cemu/ncrypto/ncrypto.h"
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
#include "gui/helpers/wxWayland.h"
|
||||
#endif
|
||||
|
||||
#include <wx/image.h>
|
||||
#include <wx/filename.h>
|
||||
#include <wx/stdpaths.h>
|
||||
@ -176,6 +180,11 @@ bool CemuApp::OnInit()
|
||||
SetTopWindow(m_mainFrame);
|
||||
m_mainFrame->Show();
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
if (wxWlIsWaylandWindow(m_mainFrame))
|
||||
wxWlSetAppId(m_mainFrame, "info.cemu.Cemu");
|
||||
#endif
|
||||
|
||||
// show warning on macOS about state of builds
|
||||
#if BOOST_OS_MACOS
|
||||
if (!GetConfig().did_show_macos_disclaimer)
|
||||
|
@ -57,6 +57,10 @@
|
||||
#include "resource/embedded/resources.h"
|
||||
#endif
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
#include "gui/helpers/wxWayland.h"
|
||||
#endif
|
||||
|
||||
#include "Cafe/TitleList/TitleInfo.h"
|
||||
#include "Cafe/TitleList/TitleList.h"
|
||||
#include "wxHelper.h"
|
||||
@ -753,6 +757,12 @@ void MainWindow::TogglePadView()
|
||||
m_padView->Bind(wxEVT_CLOSE_WINDOW, &MainWindow::OnPadClose, this);
|
||||
|
||||
m_padView->Show(true);
|
||||
|
||||
#if BOOST_OS_LINUX && HAS_WAYLAND
|
||||
if (wxWlIsWaylandWindow(m_padView))
|
||||
wxWlSetAppId(m_padView, "info.cemu.Cemu");
|
||||
#endif
|
||||
|
||||
m_padView->Initialize();
|
||||
if (m_game_launched)
|
||||
m_padView->InitializeRenderCanvas();
|
||||
|
24
src/gui/helpers/wxWayland.cpp
Normal file
24
src/gui/helpers/wxWayland.cpp
Normal 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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user