xdg-bell: fix wrong resource cast
Some checks are pending
Build Hyprland / Build Hyprland (Arch) (push) Waiting to run
Build Hyprland / Build Hyprland with Meson (Arch) (push) Waiting to run
Build Hyprland / Build Hyprland without precompiled headers (Arch) (push) Waiting to run
Build Hyprland / Build Hyprland in pure Wayland (Arch) (push) Waiting to run
Build Hyprland / Code Style (Arch) (push) Waiting to run
Nix (CI) / update-inputs (push) Waiting to run
Nix (CI) / build (push) Waiting to run
Security Checks / Flawfinder Checks (push) Waiting to run

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 "XDGShell.hpp"
#include "core/Compositor.hpp"
#include "../desktop/Window.hpp"
#include "../managers/EventManager.hpp"
#include "../Compositor.hpp"
@ -11,8 +11,8 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
m_resource->setDestroy([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) {
if (!toplevel) {
m_resource->setRing([](CXdgSystemBellV1* r, wl_resource* surface) {
if (!surface) {
g_pEventManager->postEvent(SHyprIPCEvent{
.event = "bell",
.data = "",
@ -20,9 +20,9 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
return;
}
auto TOPLEVEL = CXDGToplevelResource::fromResource(toplevel);
const auto SURFACE = CWLSurfaceResource::fromResource(surface);
if (!TOPLEVEL) {
if (!SURFACE) {
g_pEventManager->postEvent(SHyprIPCEvent{
.event = "bell",
.data = "",
@ -31,10 +31,10 @@ CXDGSystemBellManagerResource::CXDGSystemBellManagerResource(UP<CXdgSystemBellV1
}
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;
if (w->m_xdgSurface == TOPLEVEL->owner) {
if (w->m_wlSurface->resource() == SURFACE) {
g_pEventManager->postEvent(SHyprIPCEvent{
.event = "bell",
.data = std::format("{:x}", (uintptr_t)w.get()),