Skip to content

Commit

Permalink
WaylandBackend: Ignore events on unknown surfaces
Browse files Browse the repository at this point in the history
wl_pointer enter/leave events are being processed for what I think are libdecor surfaces, this
means the surface user_data is being miscast as CWaylandPlane
  • Loading branch information
ColinKinloch authored and misyltoad committed Nov 24, 2024
1 parent 37a348b commit d317492
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Backends/WaylandBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ using namespace std::literals;

static LogScope xdg_log( "xdg_backend" );

static const char *GAMESCOPE_plane_tag = "gamescope-plane";

template <typename Func, typename... Args>
auto CallWithAllButLast(Func pFunc, Args&&... args)
{
Expand Down Expand Up @@ -904,6 +906,7 @@ namespace gamescope
{
m_pParent = pParent;
m_pSurface = wl_compositor_create_surface( m_pBackend->GetCompositor() );
wl_proxy_set_tag( (wl_proxy *)m_pSurface, &GAMESCOPE_plane_tag );
wl_surface_set_user_data( m_pSurface, this );
wl_surface_add_listener( m_pSurface, &s_SurfaceListener, this );

Expand Down Expand Up @@ -2586,6 +2589,9 @@ namespace gamescope

void CWaylandInputThread::Wayland_Pointer_Enter( wl_pointer *pPointer, uint32_t uSerial, wl_surface *pSurface, wl_fixed_t fSurfaceX, wl_fixed_t fSurfaceY )
{
if ( !( wl_proxy_get_tag( (wl_proxy *)pSurface ) == &GAMESCOPE_plane_tag ) )
return;

CWaylandPlane *pPlane = (CWaylandPlane *)wl_surface_get_user_data( pSurface );
if ( !pPlane )
return;
Expand All @@ -2597,6 +2603,9 @@ namespace gamescope
}
void CWaylandInputThread::Wayland_Pointer_Leave( wl_pointer *pPointer, uint32_t uSerial, wl_surface *pSurface )
{
if ( !( wl_proxy_get_tag( (wl_proxy *)pSurface ) == &GAMESCOPE_plane_tag ) )
return;

CWaylandPlane *pPlane = (CWaylandPlane *)wl_surface_get_user_data( pSurface );
if ( !pPlane )
return;
Expand Down

0 comments on commit d317492

Please sign in to comment.