Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hiding cursor hiding on wayland #2274

Merged
merged 1 commit into from
May 1, 2022
Merged

Fix hiding cursor hiding on wayland #2274

merged 1 commit into from
May 1, 2022

Conversation

TobTobXX
Copy link
Contributor

@TobTobXX TobTobXX commented May 1, 2022

Fixes #2273.

The underlying method for hiding the cursor (setting its texuture to
NULL) is wayland_client::protocol::wl_pointer::WlPointer::set_cursor().
This method expects a serial number of the last enter event.

Right now, latest_event is any latest pointer event. It gets used by
the call to set_cursor() and also to start_interactive_move(). While
set_cursor() expects the latest enter event, start_interactive_move()
expects the very latest serial from any event. Thus we need to track
both.

After this change, both serials are tracked and the appropriate is used
in the call into smithay-client-toolkit.

Tested on sway and gnome (on sway it already worked before the change).

See also #2273.

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users none: bugfix
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior none: bugfix
  • Created or updated an example program if it would help users understand this functionality none: bugfix
  • Updated feature matrix, if new features were added or implemented none: bugfix

@TobTobXX TobTobXX changed the title Fix hiding cursors on wayland Fix hiding cursor hiding on wayland May 1, 2022
@TobTobXX
Copy link
Contributor Author

TobTobXX commented May 1, 2022

Oh, and also there's this test program, mentioned in the issues: https://git.sr.ht/~tobtobxx/winit-wayland-mouse-demo. It demonstrates hiding the cursor (with C) and dragging the window (both require sending the Wayland compositor the "latest" serial. Both should work now on all Wayland implementations).

Copy link
Member

@kchibisov kchibisov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, should add a changelog entry that you've fixed issue on GNOME wrt cursor hiding.

Fixes #2273.

The underlying method for hiding the cursor (setting its texuture to
NULL) is wayland_client::protocol::wl_pointer::WlPointer::set_cursor().
This method expects a serial number of the last **enter** event.

Right now, `latest_event` is any latest pointer event. It gets used by
the call to set_cursor() and also to start_interactive_move(). While
set_cursor() expects the latest enter event, start_interactive_move()
expects the very latest serial from any event. Thus we need to track
both.

After this change, both serials are tracked and the appropriate is used
in the call into smithay-client-toolkit.

Tested on sway and gnome (on sway it already worked before the change).
@TobTobXX TobTobXX requested a review from kchibisov May 1, 2022 09:29
@kchibisov kchibisov merged commit 0728105 into rust-windowing:master May 1, 2022
@kchibisov
Copy link
Member

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Wayland: Window::set_mouse_visible doesn't work when window was clicked.
2 participants