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

Certain xwayland applications cannot update cursor position from OpenTabletDriver #5152

Closed
qwertyuiopr opened this issue Mar 17, 2024 · 37 comments
Labels
bug Something isn't working

Comments

@qwertyuiopr
Copy link

qwertyuiopr commented Mar 17, 2024

Hyprland Version

System/Version info
Hyprland, built from branch HEAD at commit c5e28ebcfe00a510922779b2c568cfa52a317445  (props: bump ver 0.37.1).
Date: Sat Mar 16 14:51:49 2024
Tag: v0.37.1

flags: (if any)
legacyrenderer


System Information:
System name: Linux
Node name: gentoo
Release: 6.8.1-gentoo-GentUwU-nvidia
Version: #4 SMP PREEMPT_DYNAMIC Sun Mar 17 21:13:18 GMT 2024


GPU information: 
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU106 [GeForce RTX 2060 Rev. A] [10de:1f08] (rev a1) (prog-if 00 [VGA controller])
0b:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Raphael [1002:164e] (rev c3) (prog-if 00 [VGA controller])


os-release: NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.gentoo.org/"
SUPPORT_URL="https://www.gentoo.org/support/"
BUG_REPORT_URL="https://bugs.gentoo.org/"
VERSION_ID="2.14"


plugins:

Bug or Regression?

Regression

Description

When trying to use OpenTabletDriver on some xwayland applications, the cursor position does not get updated. Happens with and without legacy renderer enabled. Does not happen in 0.36.0-r2.
This seems to happen in games which use their own cursor rather than your system cursor, but I can't be 100% sure. This doesn't happen in gimp, which also runs in xwayland.
I've only tested different versions of the same game.
The games I tested were:
osu!stable
osu!lazer
Mcosu
All have the same issue where the cursor position stops being updated once I focus the window, while the tablet's inputs can still be detected.

How to reproduce

Install OpenTabletDriver-6.4.0:
https://wiki.hyprland.org/FAQ/#my-tablet-no-worky
Use Absolute or Artist mode (have not tested relative mode)
Open osu!stable, osu!lazer or Mcosu (only games I've confirmed had the issue.)
Try to move your cursor with your tablet. Cursor will not move, but inputs can still be detected.

Crash reports, logs, images, videos

hyprland.log

2024-03-17.21-51-44.mp4
@qwertyuiopr qwertyuiopr added the bug Something isn't working label Mar 17, 2024
@vaxerski
Copy link
Member

nice wallpaper doe

@vaxerski
Copy link
Member

can be connected with #3004 probably

@kotbaton
Copy link

@qwertyuiopr I tried the osu!laser downloaded from their webpage, and on both git version and version with fixes for #3004 and it works for me. I can normally move the mouse and click with tablet's pen. If game runs using gamescope everything works as intended I think. I ran the game with otd-daemon running. In otd-gui I have enabled Absolute Mode and my Pen Settings are as follows:

image

@qwertyuiopr
Copy link
Author

qwertyuiopr commented Mar 19, 2024

@qwertyuiopr I tried the osu!laser downloaded from their webpage, and on both git version and version with fixes for #3004 and it works for me. I can normally move the mouse and click with tablet's pen. If game runs using gamescope everything works as intended I think. I ran the game with otd-daemon running. In otd-gui I have enabled Absolute Mode and my Pen Settings are as follows:

image

osu!lazer has their own opentabletdriver implementation enabled by default which is likely why it worked fine for you. these ingame drivers don't have any smoothing settings though, which is why i'd prefer to use the normal opentabletdriver.

on the actual issue, osu!lazer and mcosu both work fine until i try to play a map, at which point the cursor stops responding. on osu!stable (through wine, might be important) the cursor just doesn't work at all. gamescope mileage varies. osu!stable's cursor still does not work, osu!lazer makes it work fine (unless i toggle the ingame tablet driver on then off for some reason) and mcosu's cursor stops working

@kotbaton
Copy link

I will try to tinker with it later, I will download osu!stable through wine, and let you know if I will able to reproduce the issue. I just wondering if you will have different experience if you will use proton directly or add executable to steam as a non-steam game and run it using proton via steam.

@qwertyuiopr
Copy link
Author

I will try to tinker with it later, I will download osu!stable through wine, and let you know if I will able to reproduce the issue. I just wondering if you will have different experience if you will use proton directly or add executable to steam as a non-steam game and run it using proton via steam.

should probably be noted i used a repo called 'osu-winello' to make the process much easier, not sure if i'm allowed to link the repo

@kotbaton
Copy link

should probably be noted i used a repo called 'osu-winello' to make the process much easier, not sure if i'm allowed to link the repo

I installed osu!stable with osu-winello script as you told and as far as I can see I can normally move cursor using tablet's pen in game menu and in the game (I tried to play tutorial and it worked). I used the same otd configuration as showed previously and I have no other tablet drivers enabled (no wacom module etc).

@qwertyuiopr
Copy link
Author

qwertyuiopr commented Mar 20, 2024

using latest git, cursor still does not work properly for me. are you playing with the window in fullscreen or tiled?
i did a bit of testing, and it seems that tiled works okay. however, because the game is now tiled rather than in fullscreen, it does not allow me to use frame tearing which is helpful for getting much lower end-to-end latency

here's the version compiled

System/Version info
Hyprland, built from branch main at commit bfc95e992d460cbefe2c69de04da52e6089f6258 dirty (swipe: fix nullptr in `onSwipeUpdate` (5191)).
Date: Wed Mar 20 18:13:31 2024
Tag: v0.37.1-32-gbfc95e99

flags: (if any)


System Information:
System name: Linux
Node name: gentoo
Release: 6.8.1-gentoo-GentUwU
Version: #14 SMP PREEMPT_DYNAMIC Tue Mar 19 18:05:15 GMT 2024


GPU information: 
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU106 [GeForce RTX 2060 Rev. A] [10de:1f08] (rev a1) (prog-if 00 [VGA controller])
0b:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Raphael [1002:164e] (rev c3) (prog-if 00 [VGA controller])


os-release: NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.gentoo.org/"
SUPPORT_URL="https://www.gentoo.org/support/"
BUG_REPORT_URL="https://bugs.gentoo.org/"
VERSION_ID="2.14"


plugins:

@kotbaton
Copy link

I tried in in the fullscreen, so not sure what can cause the issue for you. I can make more tests but not sure what I should look for if it works for me.

@qwertyuiopr
Copy link
Author

qwertyuiopr commented Mar 20, 2024

i'm not sure what could cause it either. i just tried with sway with --unsupported-gpu (nvidia proprietary drivers, sadge) and my tablet worked perfectly fine with artist mode + mouse bindings, along with the graphical issues that come with using sway on nvidia blob drivers.
p.s. what opentabletdriver version are you running?

@kotbaton
Copy link

$ otd-daemon --version
0.6.4.0

I am on intel graphics but I have no idea how it can influence tablet actually. However if I understand correctly, everything worked as intended under Hyprland 0.36.0-r2? I think it is possible to check the changes in later versions, so maybe if you can figure it out what commit/changes cause the problem it would be easier to fix it for developers.

@qwertyuiopr
Copy link
Author

qwertyuiopr commented Mar 21, 2024

i'm not 100% sure how useful this is going to be, but maybe it'll give some pointers

diff ~/gitclones/Hyprland-36/Hyprland-0.36.0/src/managers/input/Tablets.cpp ~/gitclones/Hyprland/src/managers/input/Tablets.cpp
36_diff.txt

i'm going to try installing v0.36.0 from source rather than from my repos.

edit: i've just tested it, installing 0.36.0 using the source code in releases makes the cursor work fine again.

@qwertyuiopr
Copy link
Author

still looking for solutions.

@kotbaton
Copy link

So I checked the differences you linked and it seems that those differences are from commit that fixes #3004 and they shouldn't break anything.

I saw however that after 0.36.0 hyprcursor was added and something was changed with configuration, so @qwertyuiopr I started to wonder maybe something in your configuration cause the problem? Can you check it with default config?

I also checked the changes between v0.36.0 and v0.37.0 and it seems that for Tablets.cpp the only changes is:

@@ -267,7 +267,7 @@ void CInputManager::focusTablet(STablet* pTab, wlr_tablet_tool* pTool, bool moti
         }
 
         if (motion) {
-            auto local = CURSORPOS - PWINDOW->m_vRealPosition.goalv();
+            auto local = CURSORPOS - PWINDOW->m_vRealPosition.goal();
 
             if (PWINDOW->m_bIsX11)
                 local = local * PWINDOW->m_fX11SurfaceScaledBy;

But I have no experience with wayland compositors or Hyprland developing so maybe @vaxerski or other maintainer will be able to help here.

@qwertyuiopr
Copy link
Author

i have tested with the default autogenerated config, the same issue still occurs unfortunately

@qwertyuiopr
Copy link
Author

qwertyuiopr commented Mar 22, 2024

did git bisect, first commit where tablet stopped working in osu
side note, frame tearing doesn't seem to work in this version where the tablet works fine

Hyprland, built from branch HEAD at commit 328ab431655f207a5ee59737291f8e8d85fab992 dirty (hyprpm: don't copy .so if file doesn't exist).
Date: Sat Mar 2 19:06:09 2024
Tag: v0.36.0-31-g328ab431

git-bisect.txt

@qwertyuiopr
Copy link
Author

update: using latest git commit, the problem seems to be going away a little. the pen works fine when i first focus into osu, but once i start tapping my pen there's a chance that the cursor will stop updating its position in osu.

:3 nishi@gentoo ~ $ hyprctl version
Hyprland, built from branch main at commit 0dfdb6678f5362fda449694639e8fee806ca1ae4 dirty ([gha] Nix: update inputs).
Date: Sat Mar 23 00:03:18 2024
Tag: v0.37.1-47-g0dfdb667

flags: (if any)
2024-03-23.10-54-09.mp4

@qwertyuiopr
Copy link
Author

are there any updates on this? sorry if i'm being too pushy -w-

@kotbaton
Copy link

are there any updates on this? sorry if i'm being too pushy -w-

Unfortunately I can't help much here cause I'm not hyprland or even C++ developer. And I have no ideas what can be wrong here because despite we are having very similar configuration (even the same tablet?) it works for me and don't work for you so :\

@M4rti21
Copy link

M4rti21 commented Mar 31, 2024

im having the same problem.
i got it working sometimes by spamming between fullscreen, changing resolutions, tiling and untiling the window, and at some point the cursor would work just fine...
dont know if that helps at all

@qwertyuiopr
Copy link
Author

which version of hyprland are you on?

@rrex971
Copy link

rrex971 commented Apr 14, 2024

i'm facing a similar issue as well, hyprland versions < 0.37.0 work fine with tablet input but the recent versions have been problematic

@vaxerski
Copy link
Member

git bisect then

@qwertyuiopr
Copy link
Author

i have already done a git bisect three weeks prior

latest git still does not work

Hyprland, built from branch HEAD at commit 328ab431655f207a5ee59737291f8e8d85fab992 dirty (hyprpm: don't copy .so if file doesn't exist).
Date: Sat Mar 2 19:06:09 2024
Tag: v0.36.0-31-g328ab431

git-bisect.txt

@vaxerski
Copy link
Member

yea but that bisect is clearly wrong

@rrex971
Copy link

rrex971 commented Apr 17, 2024

i had done a git bisect myself and i think i may have found the relevant commit that may have caused the issue
also just noticed that this is the same bisect result @qwertyuiopr had attached in their prior replies so this further affirms that the bisect is correct.

referencing this commit: d72ea5f

d72ea5f2a7fdb0d0a7bf914412327195b05199b0 is the first bad commit
commit d72ea5f2a7fdb0d0a7bf914412327195b05199b0
Author: Vaxry <[email protected]>
Date:   Sat Mar 2 21:04:55 2024 +0000

    input: Rewritten pointer constraints (#4889)
    
    * rewritten constraints
    
    * send pointer enter on activate if not pointer focus
    
    * minor cleanup
    
    * simulate movement on commit
    
    * don't ignore oneshot prop
    
    * various fixes
    
    * dont send motion on confined
    
    * update pos hint on region change

 src/Compositor.cpp                  |  43 ++------
 src/Compositor.hpp                  |   1 -
 src/desktop/Constraint.cpp          | 121 +++++++++++++++++++++
 src/desktop/Constraint.hpp          |  44 ++++++++
 src/desktop/WLSurface.cpp           |  22 ++++
 src/desktop/WLSurface.hpp           |  18 +++-
 src/events/Devices.cpp              |  40 +------
 src/events/Events.hpp               |   3 -
 src/events/Layers.cpp               |   7 +-
 src/events/Windows.cpp              |   7 +-
 src/helpers/WLClasses.cpp           |  76 -------------
 src/helpers/WLClasses.hpp           |  37 +------
 src/managers/input/InputManager.cpp | 208 ++++++------------------------------
 src/managers/input/InputManager.hpp |  45 ++++----
 14 files changed, 284 insertions(+), 388 deletions(-)
 create mode 100644 src/desktop/Constraint.cpp
 create mode 100644 src/desktop/Constraint.hpp

@rrex971
Copy link

rrex971 commented May 4, 2024

update: can confirm that the latest release 0.40.0 fixed this issue completely. i assume the other changes related to pointer constraints consequently fixed this issue as well. in any case the days of my tablet and osu woes are over, thank you vaxry!

@vaxerski
Copy link
Member

vaxerski commented May 4, 2024

@qwertyuiopr can this be closed then?

@qwertyuiopr
Copy link
Author

qwertyuiopr commented May 4, 2024

haven't tested yet, i shall get back to you in a little when i've got time to test
edit: i'm having issues with trying to build the source releases (likely user error -w-) and 0.40.0 isn't available in my repos yet so i'll have to delay it until it comes for me, sorry :c

@shoei1944
Copy link

shoei1944 commented May 6, 2024

Hyprland, built from branch main at commit 1ed1ce9506e65f76fe5236194516f23d662bba0b  (internal: new shared_ptr and weak_ptr implementation (5883)).
Date: Sun May 5 20:16:00 2024
Tag: v0.40.0-9-g1ed1ce95, commits: 4615

flags: (if any)

I have a problem with opentabletdriver cursor running in osu with xwayland.

@M4rti21
Copy link

M4rti21 commented May 6, 2024

quick update on this, ive been able to play just fine if the game is not in fullscreen... probably has more to do with Xwayland than with hyprland...

@Agent00Ming
Copy link
Contributor

Tablet support has changed drastically since #5902. Please report back if you have tested latest git.

@M4rti21
Copy link

M4rti21 commented May 12, 2024

just changed to latest git, same error with OpenTabletDriver,
im unable to use hyprlands tablet config, either im not understanding the configuration on the wiki or its not working as intended.
my config:

input {
    tablet {
        transform = 0
        output = DP-1
        region_position = 1080, 420 # <-- based on my screen position at: "monitor = DP-1,     1920x1080@390, 1080x420, 1"
        region_size = 1920, 1080
        active_area_size = 216, 121.5
        active_area_position = 108, 60.75
        relative_input = false
        left_handed = false
    }

}

the tablet just doesnt move the cursor nor registers clicks...

@Agent00Ming
Copy link
Contributor

What if you commented out the mapping related lines and map your tablet to the virtual display in OTD? That's an issue being tracked in #6023. Current Hyprland tablet behaviour is to auto-map to focused monitor with absolute coordinates but the output = DP-1 works for selecting a monitor instead of the focused one.

@vaxerski
Copy link
Member

region_position = 1080, 420 # <-- based on my screen position at: "monitor = DP-1, 1920x1080@390, 1080x420, 1"

image

it should be 0,0...

@qwertyuiopr
Copy link
Author

@vaxerski @Agent00Ming
tablet now works, thanks for your work
unsure if i should close this issue since there's still some discussion, but it seems a bit unrelated to the original report

Hyprland, built from branch  at commit cba1ade848feac44b2eda677503900639581c3f4  (props: bump version to 0.40.0).
Date: Sat May 4 15:42:32 2024
Tag: v0.40.0, commits: 4606

flags: (if any)
2024-05-15.19-26-58.mp4

@vaxerski
Copy link
Member

if it works I am closing this

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

No branches or pull requests

7 participants