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

Mouse click accuracy #6117

Closed
obivan opened this issue May 17, 2024 · 15 comments · Fixed by #6283
Closed

Mouse click accuracy #6117

obivan opened this issue May 17, 2024 · 15 comments · Fixed by #6283
Labels
bug Something isn't working

Comments

@obivan
Copy link
Contributor

obivan commented May 17, 2024

Hyprland Version

System/Version info
Hyprland, built from branch main at commit a66cfe0fbed7fb4dc69383e107c2bf3b1e7cd80a  ().
Date: 2024-05-16
Tag: , commits: 

flags: (if any)


System Information:
System name: Linux
Node name: nixos-pc
Release: 6.9.0
Version: #1-NixOS SMP PREEMPT_DYNAMIC Sun May 12 21:12:29 UTC 2024


GPU information: 
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD102 [GeForce RTX 4090] [10de:2684] (rev a1) (prog-if 00 [VGA controller])


os-release: ANSI_COLOR="1;34"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="24.05.20240515.33d1e75"
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 24.05 (Uakari)"
SUPPORT_URL="https://nixos.org/community.html"
VERSION="24.05 (Uakari)"
VERSION_CODENAME=uakari
VERSION_ID="24.05"


plugins:

Bug or Regression?

Bug

Description

When selecting text or clicking on links/buttons, the click is registered a few pixels to the right of the actual cursor position. Similar to old issue #4691, this only seems to happen when the cursor shape is changed.

There is also a strange jump to the right when changing the cursor shape (see video).

This happens starting from commit ed411f5

I'm using xcursor. Enabling or disabling hardware cursors using the WLR_NO_HARDWARE_CURSORS environment variable and/or the cursor:no_hardware_cursors option has no visible effect whatsoever.

How to reproduce

Move the cursor to the boundary of the link.

Crash reports, logs, images, videos

issue.mp4
normal.mp4
@obivan obivan added the bug Something isn't working label May 17, 2024
@vaxerski
Copy link
Member

doesn't happen to me so I'll need more info (does it happen if you disable scaling? if you use hyprcursor? if you change the cursor size?)

@obivan
Copy link
Contributor Author

obivan commented May 17, 2024

does it happen if you disable scaling?

Nope, with scaling 1 everything works fine. I normally use scaling 2.

if you use hyprcursor?

It takes me a while to figure out how to do it right. I guess I'll try converting the theme I'm using to hyprcursor format and set the corresponding environment variables.

if you change the cursor size?

I've tried two cursor themes (breeze_cursors from KDE and phinger-cursors-light) in two size options: 24 and 32. The issue persists.

Oh, one more thing - it looks like the issue is not reproducible inside XWayland apps.

@vaxerski
Copy link
Member

likely a math error with xcursor hotspots somewhere then

@obivan
Copy link
Contributor Author

obivan commented May 18, 2024

I have checked and can reproduce this with hyprcursor as well.

@obivan
Copy link
Contributor Author

obivan commented May 19, 2024

Well, when I change this code (in main)

CBox CPointerManager::getCursorBoxGlobal() {
    return CBox{pointerPos, currentCursorImage.size / currentCursorImage.scale}.translate(-currentCursorImage.hotspot / currentCursorImage.scale);
}

to this one

CBox CPointerManager::getCursorBoxGlobal() {
    return CBox{pointerPos, currentCursorImage.size / currentCursorImage.scale}.translate(-currentCursorImage.hotspot);
}

it fixes the issue.

I don't know any shit about how valid this is.
But it works

@vaxerski
Copy link
Member

does it happen if you disable hardware cursors...?

@obivan
Copy link
Contributor Author

obivan commented May 20, 2024

I see no change in behavior from enabling/disabling hardware cursors.

I mean, if I apply the nano-patch above, the issue disappears regardless of the kind of cursors used.

@vaxerski
Copy link
Member

ok then

@obivan
Copy link
Contributor Author

obivan commented May 26, 2024

Thank you! In the latest main (553232a3e4c112c8511c8511309e6b685cb614895e714) the issue is still reproducible, but only if hardware cursors are enabled. I don't know why, maybe because of 0d6eae0, which was not present at the time of initial testing.

@vaxerski vaxerski reopened this May 26, 2024
@vaxerski
Copy link
Member

bing chilling

@vaxerski
Copy link
Member

patch.txt
try

@obivan
Copy link
Contributor Author

obivan commented May 26, 2024

Nope, still doesn't work with hardware cursors enabled (and works with software cursors on)

@obivan
Copy link
Contributor Author

obivan commented May 30, 2024

This change fixes the hardware cursors for me (while not breaking the software cursors). Found it tinkering around your patch.
patch2.txt

@vaxerski
Copy link
Member

thanks, can you make a MR?

@obivan
Copy link
Contributor Author

obivan commented May 31, 2024

Sure. Please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants