rust-windowing / rust-windowing/winit

double MouseMotion events when cursor grab mode is Confined, while using X11

Open
#2,846 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

DS - x11
Dominant language
Rust
Stars
6.2k
Forks
1.3k
Avg merge
2d 19h
Merged PRs (30d)
9

Description

seems to be caused by set_cursor_mode in platform_impl/linux/x11/window.rs calling XGrabPointer with ffi::True as the 3rd (owner_events) argument.

to re-produce:
try the cursor_grab.rs example with CursorGrabMode::None, and then with CursorGrabMode::Confined.

echo focus the cursor_grab.rs example window now
gcc -o send_event send_event.c -lX11 -lXtst
sleep 1
./send_event
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>

int main(void) {
	Display *display = XOpenDisplay(NULL);
	XTestFakeRelativeMotionEvent(display, 255, 255, 0);
	XFlush(display);
	XCloseDisplay(display);
	return 0;
}

this is inconsistent with the wayland impl (and it leads to inconsistencies in camera sensitivity for example)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in platform_impl/linux/x11/window.rs at set_cursor_mode and reproduce the behavior with the cursor_grab.rs example using CursorGrabMode::None and CursorGrabMode::Confined. Compare the X11 pointer-grab behavior with the Wayland implementation, then verify that confined mode no longer produces duplicate mouse-motion events or inconsistent camera sensitivity.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, rust
Domain
desktop, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.