CNA-BUG-135: Mouse::SetCaptureEXT, GetGlobalPositionEXT and WarpGlobalEXT let PlatformNotSupportedException escape on Wayland and the terminal platform

CNA snapshot 009d40f5  ·  Known Issues › Current bugs  ·  source links pinned to 009d40f5

✓

Evidence basis: source-verified at the pinned commit; tests exist (not executed for this page). Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.

The Wayland and terminal mouse services throw PlatformNotSupportedException from SetCapture, TryGetGlobalPosition and SetGlobalPosition, and the Mouse wrappers do not catch it, although they document false (or (0, 0)) for an unsupported platform.

Identifier
CNA-BUG-135
Category
Bug
Subsystem
Input
Status
Open
Verified against
CNA 009d40f5 (009d40f5dd085c4e674d3479675fac84b12b3e0a)
Severity
Low (a triage suggestion, not a project priority)
Evidence basis
Source-verified: read at TARGET, not executed
Tests touching this area
Yes: see Current tests
Affected contract
Mouse::SetCaptureEXT(bool), Mouse::GetGlobalPositionEXT(int&, int&), Mouse::WarpGlobalEXT(int, int)

Expected behaviour

Mouse.hpp documents SetCaptureEXT and WarpGlobalEXT as returning false “if the platform does not support” the operation, and GetGlobalPositionEXT in Mouse.cpp zeroes its outputs first “so a platform with no desktop pointer answers (0, 0)”.

Actual behaviour at TARGET

The wrappers call the platform mouse directly. WaylandMouse (WaylandMouse.cpp) and TerminalMouse (TerminalMouse.cpp) throw PlatformNotSupportedException from all three methods, as IPlatformMouse.hpp allows (“@throws PlatformNotSupportedException If the platform reports no GlobalPointer capability”). The exception reaches the game.

Source locations

Evidence

Checked by reading at 009d40f5; not executed on Wayland or a terminal.

Focused reproduction

// Illustrative; not compiled or run. CNA_PLATFORM=WAYLAND.
int x = 0, y = 0;
Mouse::GetGlobalPositionEXT(x, y);  // expected (0, 0); actual: PlatformNotSupportedException

Current tests

TheRealPlatformIsSafeForAllThree in MouseGlobalTests.cpp asserts no throw on the test platform only; the throwing backends are not driven through the wrappers.

Regression test

The same test against a canned mouse whose three methods throw PlatformNotSupportedException; the fix is a GlobalPointer capability check (or a catch) in the three wrappers.

Blast radius

Games calling the three CNAEXT mouse functions on the native Wayland or terminal platforms. SDL3, X11, Win32 and headless answer normally.

Workaround

Catch PlatformNotSupportedException around the calls, or check the platform's GlobalPointer capability first.

The same subject is explained at several altitudes. These are the neighbouring pages at each one.

User guide
Input: mouse
Known issues
Bug index