Bug 452938 - pointer confinement regions misapplied to libdecor decorations
Summary: pointer confinement regions misapplied to libdecor decorations
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: wayland-generic (show other bugs)
Version: 5.24.4
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-24 08:24 UTC by David Gow
Modified: 2022-04-26 12:51 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Gow 2022-04-24 08:24:12 UTC
SUMMARY

If an application uses client side decorations as implemented by libdecor[1], when it sets a pointer confinement region using zwp_pointer_constraints_v1_confine_pointer() on the content surface, that region includes the titlebar, not just the content surface. (i.e., location (0,0) is the top-left of the parent surface, not the child surface).

This means that the pointer can escape into the titlebar (which was not intended), and the bottom, titlebar-sized area of the window is inaccessible.

Weston shows the expected behaviour.

Note that libdecor does not use client-side decorations when SSDs are available: the recently-added LIBDECOR_FORCE_CSD=1 environment variable should be used, and hence a recent git version of libdecor.


STEPS TO REPRODUCE
1. Get the latest git versions of SDL and libdecor, and build them (and their tests).
2. Set the following environment variables: SDL_VIDEODRIVER=wayland SDL_VIDEO_WAYLAND_PREFER_LIBDECOR=1 LIBDECOR_FORCE_CSD=1
3. Run a program which confines the mouse cursor. For example: ./test/testgl2 --confine-cursor 0,0,640,480

OBSERVED RESULT

The pointer is confined to a 640×480 region which includes the titlebar, but not the bottom of the content area.

EXPECTED RESULT

The pointer is confined to the 640×480-sized content area, but cannot escape into the titlebar. The bottom few pixels of the content area are accessible.
SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION

See also bug #449620, which seems related.

I've also seen this occur on the Tomb Raider (2013) game.

[1]: https://gitlab.gnome.org/jadahl/libdecor
[2]: https://github.com/libsdl-org/SDL
Comment 1 David Gow 2022-04-24 08:26:56 UTC
(Forgot to fill in my system info, whoops:)

Linux/KDE Plasma: openSUSE Tumbleweed 20220422
(available in About System)
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.2
Kernel version: 5.17.3-1-vanilla