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

Pointer and cursor improvements #28

Merged
merged 7 commits into from
Mar 10, 2020
Merged

Conversation

subdiff
Copy link

@subdiff subdiff commented Feb 25, 2020

The long-term goal is to make cursor painting independent of X11 protocol.

Larger objectives here:

  • Introduce MouseCursor class, better encapsulation.
  • No round trip through XWayland for getting cursor position, instead just get it from global variable.
  • Introduce support for relative pointer and pointer constraints protocol extensions. Fixes Mouse input in embedded doesn't work when grabbed #19.
  • Unify pointer movement code paths in drm and nested mode, simplifies logic.

Note: To get it to build I needed to add the protocol directory to wlroots top-level meson.build file. I.e.: wlr_inc = include_directories('.', 'include', 'protocol'). Otherwise the pointer-constraints-unstable-v1-protocol.h header file is not found. That probably comes from the static linkage.

romangg added 7 commits March 10, 2020 01:53
Many code editiors remove trailing whitespace automatically making patches
difficult since often unrelated lines get changed with the same commit.

So remove the whitespace in the steamcompmgr file all at once in this separate
commit.
Puts all cursor relevant code into a single class. Preparation for getting
cursor movement directly through libinput.
Instead of going through the X11 connection just set the pointer position
directly via global variable.
For now only available on drm backend. For nested there is currently a
different workaround active making it work.

Closes ValveSoftware#19
In nested mode we can use the same code path as in drm mode now.
With cursor position going through global variables we do not need to query the
global position anymore. Remove the MouseCursor function for that.

Furtheron the relative position getter is also not necessary, but let's remove
this one in a separate commit.

This commit also adds a debug line for debugging flaky focus changing.
It is enough to get the global cursor location when repainting it. So we do not
need to query the relative position. If later on we find this is not right we
should be still able to get the relative position from the surface position
instead of calling into XWayland.

Also it is not expected and apparently unnecessary to move the cursor in the
paint function. Therefore remove this call too.
@subdiff subdiff merged commit be1ff3d into ValveSoftware:master Mar 10, 2020
@subdiff subdiff deleted the cursor branch March 10, 2020 01:03
valentindavid added a commit to valentindavid/gamescope that referenced this pull request Sep 14, 2021
This is a rebase and simplication of @subdiff's merge request ValveSoftware#28 that
was reverted.

This fixes ValveSoftware#19 "Mouse input in embedded doesn't work when grabbed".

I have tested this commit for some weeks now. I can play FPS games
(like Goat Simulator) with a mouse&keyboard. I can still play games
without grab like Factorio, with mouse, but also with a controller (I
used the Steam Controller to test).

The original branch broke some mouse games with game controllers. See
valentindavid added a commit to valentindavid/gamescope that referenced this pull request Sep 29, 2021
This is a rebase and simplication of @subdiff's merge request ValveSoftware#28 that
was reverted.

This fixes ValveSoftware#19 "Mouse input in embedded doesn't work when grabbed".

I have tested this commit for some weeks now. I can play FPS games
(like Goat Simulator) with a mouse&keyboard. I can still play games
without grab like Factorio, with mouse, but also with a controller (I
used the Steam Controller to test).

The original branch broke some mouse games with game controllers. See
KyunLFA added a commit to KyunLFA/gamescope that referenced this pull request Apr 6, 2024
This adds back the pointer constraints support previously in Gamescope, though it may be prove to be useless for this useccase with further testing

Note that this is not my work, I just picked some code from @romangg (ValveSoftware#28) !! Full kudos him.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mouse input in embedded doesn't work when grabbed
2 participants