xdg-bell: fix wrong resource cast

This commit is contained in:
Vaxry 2025-04-30 14:07:23 +01:00
parent 54c89104de
commit 5d005f11fa
No known key found for this signature in database
GPG Key ID: 665806380871D640

View File

@ -1,5 +1,5 @@
#include "XDGBell.hpp" #include "XDGBell.hpp"
#include "XDGShell.hpp" #include "core/Compositor.hpp"
#include "../desktop/Window.hpp" #include "../desktop/Window.hpp"
#include "../managers/EventManager.hpp" #include "../managers/EventManager.hpp"
#include "../Compositor.hpp" #include "../Compositor.hpp"
@ -11,8 +11,8 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
m_resource->setDestroy([this](CXdgSystemBellV1* r) { PROTO::xdgBell->destroyResource(this); }); m_resource->setDestroy([this](CXdgSystemBellV1* r) { PROTO::xdgBell->destroyResource(this); });
m_resource->setOnDestroy([this](CXdgSystemBellV1* r) { PROTO::xdgBell->destroyResource(this); }); m_resource->setOnDestroy([this](CXdgSystemBellV1* r) { PROTO::xdgBell->destroyResource(this); });
m_resource->setRing([](CXdgSystemBellV1* r, wl_resource* toplevel) { m_resource->setRing([](CXdgSystemBellV1* r, wl_resource* surface) {
if (!toplevel) { if (!surface) {
g_pEventManager->postEvent(SHyprIPCEvent{ g_pEventManager->postEvent(SHyprIPCEvent{
.event = "bell", .event = "bell",
.data = "", .data = "",
@ -20,9 +20,9 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
return; return;
} }
auto TOPLEVEL = CXDGToplevelResource::fromResource(toplevel); const auto SURFACE = CWLSurfaceResource::fromResource(surface);
if (!TOPLEVEL) { if (!SURFACE) {
g_pEventManager->postEvent(SHyprIPCEvent{ g_pEventManager->postEvent(SHyprIPCEvent{
.event = "bell", .event = "bell",
.data = "", .data = "",
@ -31,10 +31,10 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
} }
for (const auto& w : g_pCompositor->m_windows) { for (const auto& w : g_pCompositor->m_windows) {
if (!w->m_isMapped || w->m_isX11 || !w->m_xdgSurface) if (!w->m_isMapped || w->m_isX11 || !w->m_xdgSurface || !w->m_wlSurface)
continue; continue;
if (w->m_xdgSurface == TOPLEVEL->owner) { if (w->m_wlSurface->resource() == SURFACE) {
g_pEventManager->postEvent(SHyprIPCEvent{ g_pEventManager->postEvent(SHyprIPCEvent{
.event = "bell", .event = "bell",
.data = std::format("{:x}", (uintptr_t)w.get()), .data = std::format("{:x}", (uintptr_t)w.get()),