Button release event is not delivered after xdg_toplevel_move/xdg_toplevel_resize
Affected version
This is a Wayland-specific problem. It's reproducible in Ubuntu 22.04 (Mutter 42.5) and Fedora Rawhide (Mutter 43.1).
Bug summary
Suppose a Wayland client application performs xdg_toplevel_move
or xdg_toplevel_resize
call in response to a button press event on some surface's region. If a user proceeds with dragging the mouse after mouse press, the application receives pointer leave event, which is expected to clear the mouse buttons state, preserved by the application. So, even without button release event delivered to the application all works fine in this case.
But in case user just releases mouse button after pressing it, without performing a drag, the application receives neither leave nor release event. This is a problem because the application's internal notion about the state of mouse buttons becomes inconsistent, and it will treat mouse moves as mouse drags until the following leave or release event.
Steps to reproduce
- Unpack the attached archive with source files for a sample Wayland client application (sample.zip)
- Build and run the application:
gcc wayland-client.c xdg-shell.c -lwayland-client; ./a.out
- Click with mouse in the opened application's surface.
What happened
The sample application creates a top-level surface which can be resized by dragging from any point within the surface. It also logs all received enter, leave, press and release pointer events to console. When clicking on the surface, only press events get logged.
What did you expect to happen
I'd expect either button release events to be reported to the application in the described use case, or pointer leave events, so that the application can understand when the mouse button should be considered released.