hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.28k stars 896 forks source link

Switching from tablet back to mouse crashes some applications #6312

Closed JulianFP closed 3 months ago

JulianFP commented 4 months ago

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit 0ebb43c1a37e7321e5ed7223ea85ed555cc82735 (). Date: 2024-06-01 Tag: , commits: flags: (if any) System Information: System name: Linux Node name: JuliansFramework Release: 6.9.2 Version: #1-NixOS SMP PREEMPT_DYNAMIC Sat May 25 14:30:56 UTC 2024 GPU information: 06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT] [1002:73df] (rev c5) (prog-if 00 [VGA controller]) os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.11.20240529.ad57eef" DOCUMENTATION_URL="https://nixos.org/learn.html" HOME_URL="https://nixos.org/" ID=nixos IMAGE_ID="" IMAGE_VERSION="" LOGO="nix-snowflake"Hyprland, built from branch at commit 0ebb43c1a37e7321e5ed7223ea85ed555cc82735 (). Date: 2024-06-01 Tag: , commits: flags: (if any) System Information: System name: Linux Node name: JuliansFramework Release: 6.9.2 Version: #1-NixOS SMP PREEMPT_DYNAMIC Sat May 25 14:30:56 UTC 2024 GPU information: 06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT] [1002:73df] (rev c5) (prog-if 00 [VGA controller]) os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.11.20240529.ad57eef" 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.11 (Vicuña)" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.11 (Vicuña)" VERSION_CODENAME="vicuña" VERSION_ID="24.11" plugins: NAME=NixOS PRETTY_NAME="NixOS 24.11 (Vicuña)" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.11 (Vicuña)" VERSION_CODENAME="vicuña" VERSION_ID="24.11" plugins: ======Config-Start====== Config File: /home/julian/.config/hypr/hyprland.conf: Read Succeeded exec-once = /nix/store/bnipzdfv788l7yvgn7k7s7gp76sd1zpz-dbus-1.14.10/bin/dbus-update-activation-environment --systemd --all && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target $lock_bg=/home/julian/Pictures/ufp_ac.jpg $mainMod=SUPER $screenshotDir=/home/julian/Pictures/Screenshots animations { bezier=myBezier, 0.05, 0.9, 0.1, 1.05 animation=windows, 1, 5, myBezier animation=windowsOut, 1, 5, default, popin 80% animation=border, 1, 7, default animation=borderangle, 1, 5, default animation=fade, 1, 5, default animation=workspaces, 1, 5, default enabled=true } binds { allow_workspace_cycles=true } decoration { blur { enabled=true new_optimizations=true passes=1 size=3 } col.shadow=rgb(292828) drop_shadow=true rounding=5 shadow_range=4 shadow_render_power=3 } dwindle { force_split=2 preserve_split=true pseudotile=true } general { border_size=2 col.active_border=rgb(a9b665) rgb(7daea3) 45deg col.inactive_border=rgb(504945) col.nogroup_border=rgb(504945) col.nogroup_border_active=rgb(ea6962) rgb(d3869b) 45deg gaps_in=3 gaps_out=0 layout=dwindle } gestures { workspace_swipe=true } group { groupbar { col.active=rgb(a9b665) rgb(7daea3) 45deg col.inactive=rgb(504945) col.locked_active=rgb(89b482) rgb(d3869b) 45deg col.locked_inactive=rgb(504945) text_color=rgb(ddc7a1) } col.border_active=rgb(a9b665) rgb(7daea3) 45deg col.border_inactive=rgb(504945) col.border_locked_active=rgb(89b482) rgb(d3869b) 45deg col.border_locked_inactive=rgb(504945) } input { tablet { output=eDP-1 } touchpad { natural_scroll=true } follow_mouse=1 kb_layout=de sensitivity=0 } misc { background_color=rgb(292828) col.splash=rgb(ddc7a1) } xwayland { force_zero_scaling=true } bind=$mainMod, RETURN, exec, alacritty bind=$mainMod, A, exec, dolphin bind=$mainMod, D, exec, rofi -show drun bind=$mainMod, C, exec, cliphist list | rofi -dmenu | cliphist decode | wl-copy bind=$mainMod SHIFT, C, exec, cliphist wipe bind=$mainMod SHIFT, Q, killactive, bind=$mainMod SHIFT, E, exit, bind=$mainMod SHIFT, SPACE, togglefloating, bind=$mainMod, T, pseudo, # dwindle bind=$mainMod, V, togglesplit, # dwindle bind=$mainMod, F, fullscreen bind=$mainMod, left, movefocus, l bind=$mainMod, right, movefocus, r bind=$mainMod, up, movefocus, u bind=$mainMod, down, movefocus, d bind=$mainMod, H, movefocus, l bind=$mainMod, L, movefocus, r bind=$mainMod, K, movefocus, u bind=$mainMod, J, movefocus, d bind=ALT, TAB, workspace, previous bind=$mainMod, TAB, workspace, e+1 bind=$mainMod SHIFT, TAB, workspace, e-1Hyprland, built from branch at commit 0ebb43c1a37e7321e5ed7223ea85ed555cc82735 (). Date: 2024-06-01 Tag: , commits: flags: (if any) System Information: System name: Linux Node name: JuliansFramework Release: 6.9.2 Version: #1-NixOS SMP PREEMPT_DYNAMIC Sat May 25 14:30:56 UTC 2024 GPU information: 06:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 22 [Radeon RX 6700/6700 XT/6750 XT / 6800M/6850M XT] [1002:73df] (rev c5) (prog-if 00 [VGA controller]) os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.11.20240529.ad57eef" 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.11 (Vicuña)" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.11 (Vicuña)" VERSION_CODENAME="vicuña" VERSION_ID="24.11" plugins: bind=$mainMod, mouse_down, workspace, e+1 bind=$mainMod, mouse_up, workspace, e-1 bind=$mainMod SHIFT, left, movewindow, l bind=$mainMod SHIFT, right, movewindow, r bind=$mainMod SHIFT, up, movewindow, u bind=$mainMod SHIFT, down, movewindow, d bind=$mainMod SHIFT, H, movewindow, l bind=$mainMod SHIFT, L, movewindow, r bind=$mainMod SHIFT, K, movewindow, u bind=$mainMod SHIFT, J, movewindow, d bind=$mainMod ALT, left, movecurrentworkspacetomonitor, l bind=$mainMod ALT, right, movecurrentworkspacetomonitor, r bind=$mainMod ALT, H, movecurrentworkspacetomonitor, l bind=$mainMod ALT, L, movecurrentworkspacetomonitor, r bind=, Print, exec, grimblast --notify copy active bind=$mainMod, Print, exec, grimblast --notify copysave active "$screenshotDir/$(date +"%Y%m%d_%T")-Screenshot-active.png" bind=, Scroll_Lock, exec, grimblast --notify --freeze copy area bind=, XF86AudioMedia, exec, grimblast --notify --freeze copy area bind=$mainMod, Scroll_Lock, exec, grimblast --notify --freeze copysave area "$screenshotDir/$(date +"%Y%m%d_%T")-Screenshot-area.png" bind=$mainMod, XF86AudioMedia, exec, grimblast --notify --freeze copysave area "$screenshotDir/$(date +"%Y%m%d_%T")-Screenshot-area.png" bind=ALT, Print, exec, hyprpicker -a -r bind=$mainMod, X, exec, hyprctl kill bind=$mainMod, Y, exec, swaylock -f -c 000000 -i $lock_bg bind=SUPER, P, exec, rofi -show output -modes "output:~/.systemScripts/hyprland_output_options.py" bind=$mainMod, 1, workspace, 1 bind=$mainMod SHIFT, 1, movetoworkspacesilent, 1 bind=$mainMod, 2, workspace, 2 bind=$mainMod SHIFT, 2, movetoworkspacesilent, 2 bind=$mainMod, 3, workspace, 3 bind=$mainMod SHIFT, 3, movetoworkspacesilent, 3 bind=$mainMod, 4, workspace, 4 bind=$mainMod SHIFT, 4, movetoworkspacesilent, 4 bind=$mainMod, 5, workspace, 5 bind=$mainMod SHIFT, 5, movetoworkspacesilent, 5 bind=$mainMod, 6, workspace, 6 bind=$mainMod SHIFT, 6, movetoworkspacesilent, 6 bind=$mainMod, 7, workspace, 7 bind=$mainMod SHIFT, 7, movetoworkspacesilent, 7 bind=$mainMod, 8, workspace, 8 bind=$mainMod SHIFT, 8, movetoworkspacesilent, 8 bind=$mainMod, 9, workspace, 9 bind=$mainMod SHIFT, 9, movetoworkspacesilent, 9 bind=$mainMod, 0, workspace, 10 bind=$mainMod SHIFT, 0, movetoworkspacesilent, 10 bindl=, Pause, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle bindl=, XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle bindl=, XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle bindl=, switch:Lid Switch, exec, /home/julian/.systemScripts/clamshell_mode_hypr.sh $lock_bg bindl=, XF86AudioPlay, exec, playerctl play-pause bindl=, XF86AudioNext, exec, playerctl next bindl=, XF86AudioPrev, exec, playerctl previous bindl=, XF86PowerOff, exec, /home/julian/.systemScripts/lockAndSuspend.sh $lock_bg 1 bindle=, XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5% bindle=, XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5% bindle=, XF86MonBrightnessDown, exec, brightnessctl set 5%- bindle=, XF86MonBrightnessUp, exec, brightnessctl set 5%+ bindm=$mainMod, mouse:272, movewindow bindm=$mainMod, mouse:273, resizewindow env=XDG_CURRENT_DESKTOP,Hyprland env=XDG_SESSION_DESKTOP,Hyprland env=XDG_SESSION_TYPE,wayland env=QT_QPA_PLATFORM,wayland;xcb env=QT_AUTO_SCREEN_SCALE_FACTOR,1 env=QT_WAYLAND_DISABLE_WINDOWDECORATION,1 env=GDK_BACKEND,wayland,x11 env=CLUTTER_BACKEND,wayland env=_JAVA_AWT_WM_NONREPARENTING,1 env=NIXOS_OZONE_WL,1 exec-once=wl-paste --type text --watch cliphist store #clipboard manager: Stores only text data exec-once=wl-paste --type image --watch cliphist store #clipboard manager: Stores only image data exec-once=wl-paste -t text -w xclip -selection clipboard exec-once=/nix/store/g6pnikxf1jjax1f1j1lf4sfdd74dmjkv-polkit-kde-agent-1-5.27.11/libexec/polkit-kde-authentication-agent-1 exec-once=[workspace 1 silent] kwalletd6 exec-once=[workspace 10 silent] thunderbird exec-once=[workspace 1 silent] sleep 1 && keepassxc exec-once=[silent] sleep 2 && element-desktop --hidden exec-once=[silent] sleep 2 && slack -s -u exec-once=[silent] sleep 2 && env LANGUAGE='en-US:de-DE' signal-desktop --no-sandbox --start-in-tray exec-once=[silent] sleep 2 && nextcloud exec-once=[silent] sleep 2 && webcord -m exec-once=[silent] xwaylandvideobridge monitor=eDP-1, 2256x1504, 0x0, 1.566667 monitor=desc:Samsung Electric Company C27HG7x HTHK300334, 2560x1440@144, 1440x0, 1 monitor=HDMI-A-1, 1920x1080@60, 4000x0, 1 monitor=,preferred,auto,auto windowrulev2=opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$ windowrulev2=noanim,class:^(xwaylandvideobridge)$ windowrulev2=nofocus,class:^(xwaylandvideobridge)$ windowrulev2=noinitialfocus,class:^(xwaylandvideobridge)$ submap = inhibitSuspend bindl = , switch:Lid Switch, exec, /home/julian/.systemScripts/clamshell_mode_hypr.sh $lock_bg inhibitSuspend bindle = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5% bindle = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5% bindl = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle bindl = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle bindle = , XF86MonBrightnessDown, exec, brightnessctl set 5%- bindle = , XF86MonBrightnessUp, exec, brightnessctl set 5%+ bindl = , XF86AudioPlay, exec, playerctl play-pause bindl = , XF86AudioNext, exec, playerctl next bindl = , XF86AudioPrev, exec, playerctl previous bindl = , XF86PowerOff, exec, /home/julian/.systemScripts/lockAndSuspend.sh $lock_bg 1 inhibitSuspend bind = ,escape,submap,reset submap = reset ======Config-End======== ```

Also happens when I bind the tablet to a different monitor, like desc:Samsung Electric Company C27HG7x HTHK300334, so scaling is not the problem.

Bug or Regression?

Regression

Description

After using the tablet and then switching back to the mouse/trackpad (just moving the mouse is enough) will crash some applications, like Xournal++ or Firefox. My tablet is configured using hyprlands inputs:tablet

The only workaround that I have found is to move the cursor out of the application using your tablet (e.g. to a second monitor, above waybar or above another application like Alacritty) before switching back to the mouse. This is obviously very annoying and I always forget to do that. Just accidentally touching the mouse while using Xournal++ will result in an immediate crash which potentially leads to loosing some of my progress.

How to reproduce

  1. Open Xournal++ or Firefox
  2. Draw around with your tablet (moving the cursor is not enough, you need to actually draw something/click on something)
  3. Then move the cursor using your regular mouse or trackpad
  4. Application crashes immediately

Crash reports, logs, images, videos

I did a git bisect and nailed it down to (surprise!) the cursor/tablet rewrite: #5902. The commit e4e84064f2d07810e0c150bce1369a0a00503e9a doesn't have the issue yet, but 84e8d1810d57b65a0bc3b5ac2998bc023df880f4 has it. I also built the debug build of the current commit 0ebb43c1a37e7321e5ed7223ea85ed555cc82735 with debug:disable_logs = false to get the following log of the crash happening in Xournal++: hyprlandd.log

Also here is a video of the crash happening in Xournal++ and Firefox. The sudden cursor movement after using the tablet is me using my mouse, which immediately results in a crash:

https://github.com/hyprwm/Hyprland/assets/70963316/e42a16b0-4d90-4b6b-8dd5-a34a829658fd

EDIT: Xournal++ and Firefox are both Wayland applications, they do NOT use xwayland on my system

vaxerski commented 4 months ago

can you post WAYLAND_DEBUG=1 logs from a crashing app?

JulianFP commented 4 months ago

can you post WAYLAND_DEBUG=1 logs from a crashing app?

Of course, here you are:

For Xournal++: waylandDebug_xournalpp.log For Firefox: waylandDebug_firefox.log

Also here is the errorlog of Xournal++ just in case: errorlog.20240602-233629.log

vaxerski commented 4 months ago

hm, this is odd. Doesn't look like a hyprland bug to me that much? Can you get a debug stacktrace from xournalpp? (compile it manually in debug and get bt -full just like you would for hyprland)

you might need to compile libgdk3 in debug too.

If you don't want to do that, can you also get a WAYLAND_DEBUG=1 trace of doing the same on sway?

JulianFP commented 4 months ago

Can you get a debug stacktrace from xournalpp? (compile it manually in debug and get bt -full just like you would for hyprland)

you might need to compile libgdk3 in debug too.

I didn't really feel like building gtk manually, so I tried my best doing this with nix (this is a .txt because github). Idk if it worked however since the stacktrace has some variables optimized out which from what I know shouldn't happen if you build with cmake using the -DCMAKE_BUILD_TYPE=Debug flag. It definitely has more information than a stacktrace from a non-debug build though, so maybe it still helps: backtrace.txt. If this is not enough then just say so, I will then try to build it "normally" when I have some time.

can you also get a WAYLAND_DEBUG=1 trace of doing the same on sway?

I also did this, and as expected Xournal++ didn't crash (I just interrupted it with Ctrl+Z after making sure that it wouldn't crash). Here the output: waylandDebug.log

vaxerski commented 4 months ago

Honestly, no clue. Looks like the wl_proxy got nuked. does running hyprland with make asan reveal anything? https://wiki.hyprland.org/Crashes-and-Bugs/#building-the-wayland-stack-with-asan

JulianFP commented 4 months ago

does running hyprland with make asan reveal anything?

Yes, I got this: asan.log

vaxerski commented 4 months ago

hm, looks like that happened on exit of hyprland, though, so it's likely not very related...

0bCdian commented 4 months ago

I'm experiencing the exact same problem, I tested in gnome and sway and couldn't reproduce this bug so I don't know what could be at play here.

vaxerski commented 4 months ago

If hyprland doesn't commit any fault, can you try running an offending app with ASan?

JulianFP commented 4 months ago

hm, looks like that happened on exit of hyprland, though, so it's likely not very related...

I see now that I get the same asan log regardless of if I caused the bug or not, so yeah you are right, sorry

If hyprland doesn't commit any fault, can you try running an offending app with ASan?

I just built Xournal++ with asan, and I got this: xournalpp_asan.txt. However this is likely not related either since I get the same asan log regardless of if the application crashed or not (with the same amount of bytes leaked). I tried building gtk with asan as well but failed. Using the -Db_sanitize=address meson flag resulted in an error: ASan runtime does not come first in initial library list. I never used meson before (gtk only supports meson) and I probably did something wrong here.

TLDR: Nothing, no result

jfab20 commented 4 months ago

I'm experiencing the exact same problem, I tested in gnome and sway and couldn't reproduce this bug so I don't know what could be at play here.

@vaxerski I'm experiencing the same issue. It's also not only xournal++ or firefox, as rnote and inkscape all exhibit the same behavior. The crashes only happen when the tablet is connected.

Also the crash happens when you open another window aside rnote/xournal/firefox in the same workspace.

This didn't happen for hyprland 0.40 and i just got the same issue for hyprland 0.41. I can send error logs but I don't know which ones since this happens in many applications. Maybe I'll send a video first

https://github.com/hyprwm/Hyprland/assets/81712003/8cc0c760-8784-4404-a672-ef0bb1c7a8be

vaxerski commented 4 months ago

I realize but this is some weird interaction between gtk and hyprland I presume, as qt apps do not crash from what I understand?

I'd normally say to report this to gtk but knowing their attitude to "non-gnome software" I wouldn't expect much.

awerty-noob commented 4 months ago

Same problem here, but this can't reproduce on KDE, so Hyprland tablet impl bug?

jfab20 commented 4 months ago

I realize but this is some weird interaction between gtk and hyprland I presume, as qt apps do not crash from what I understand?

I'd normally say to report this to gtk but knowing their attitude to "non-gnome software" I wouldn't expect much.

But how can it be a gtk bug if everything is fine on hyprland 0.40? And if the behavior is not present on other WM/DE's? :(

vaxerski commented 4 months ago

That's not what I said:

some weird interaction between gtk and hyprland

awerty-noob commented 4 months ago

Little more digging: when opentabletdriver was turned to Absolute Mode, Xournal++ won't crash when switching from tablet back to mouse, but Artist Mode would.

Agent00Ming commented 4 months ago

might be a bug in the driver (I've had a poor experience with OTD, also look at their GitHub issues concerning Wayland)

fufexan commented 4 months ago

It's a bug with Artist mode specifically, as even with OTD disabled, the problem still exists.

Agent00Ming commented 4 months ago

nah, doesn't happen to me at all. Might've happened once or twice with OTD but otherwise I can't repro this bug

Agent00Ming commented 4 months ago

also, absolute mode and artist mode distinction only exists when using OTD because they use a virtual mouse/tablet to relay your inputs

fufexan commented 4 months ago

What rev are you running? I'm on f687105eff61aebff34669852e7153584286a357. If it matters, my tablet is a Wacom CTL-472.

Agent00Ming commented 4 months ago

2f278dc883f3e4e84fb1d18154132f8f4efe42cf and CTL-6100

awerty-noob commented 4 months ago

might be a bug in the driver (I've had a poor experience with OTD, also look at their GitHub issues concerning Wayland)

Can't be. With exact same environment except Hyprland downgrade to cba1ade848feac44b2eda677503900639581c3f4 (0.40.0), the bug doesn't show up.

@JulianFP from beginning Says:

I did a git bisect and nailed it down to (surprise!) the cursor/tablet rewrite

So I'm pretty sure bug is in cursor/tablet rewrite

Agent00Ming commented 4 months ago

Yeah, I am aware. We talked extensively about it on discord and concluded to opening this issue because I can't repro it with the same conditions with my tablet. I just want everyone to be on the same page and not add additional variables like OTD into the mix. So please provide your tablet model number so I can maybe think of why this happens on some tablets but not others.

awerty-noob commented 4 months ago

Ok. Tablet: Gaomon 1060Pro

Agent00Ming commented 4 months ago

and does it happen when you use the digimend drivers instead of OTD?

awerty-noob commented 4 months ago

Tried, still crash.

lVentus commented 4 months ago

might be a bug in the driver (I've had a poor experience with OTD, also look at their GitHub issues concerning Wayland)

Can't be. With exact same environment except Hyprland downgrade to cba1ade (0.40.0), the bug doesn't show up.

@JulianFP from beginning Says:

I did a git bisect and nailed it down to (surprise!) the cursor/tablet rewrite

So I'm pretty sure bug is in cursor/tablet rewrite

Me, too. Only difference is i am using a surface pro 8.

leon-erd commented 4 months ago

So please provide your tablet model number so I can maybe think of why this happens on some tablets but not others.

Happens to me as well on a Dell Inspiron 7506 2n1

mrWinston commented 4 months ago

I've been seeing the same issue with rnote and Hyprland when using https://github.com/Evidlo/remarkable_mouse to use my Remarkable 2 as a drawing tablet. Because that tool internally emulates a real wacom device, i've been able to reuse some of the code to create a somewhat minimal reproducable example that doesn't require a real tablet: https://gist.github.com/mrWinston/b013ce564465ac164a6a1ffc6c1536c2

Here's a screengrab of it happening: hyprland_tablet_rnote_kill.webm

okobenoko commented 4 months ago

I have tried all the GTK programs on my computer(like nautilus, otd-gui and pavucontrol), and it seems they are all experiencing the same issue. (I'm using arch with hyprland 0.41.1-2)

lVentus commented 4 months ago

I have tried all the GTK programs on my computer(like nautilus, otd-gui and pavucontrol), and it seems they are all experiencing the same issue. (I'm using arch with hyprland 0.41.1-2)

true. I never thought this will happened in nautilus and other gtk programs. I thought it is only hand drawing apps.

nine7nine commented 4 months ago

I'm affected by this too. as @okobenoko points out, it seems to be all GTK apps (and AGS crashes too for me) - I had to rollback to before the cursor/tablet rewrite to get a stable/usable Hyprland setup again.

I'm using a Microsoft Surface 7 pro. IPTS driver / libwacom-surface.

Agent00Ming commented 4 months ago

I've been seeing the same issue with rnote and Hyprland when using https://github.com/Evidlo/remarkable_mouse to use my Remarkable 2 as a drawing tablet. Because that tool internally emulates a real wacom device, i've been able to reuse some of the code to create a somewhat minimal reproducable example that doesn't require a real tablet: https://gist.github.com/mrWinston/b013ce564465ac164a6a1ffc6c1536c2

Here's a screengrab of it happening: hyprland_tablet_rnote_kill.webm

what's funny is that your python script to emulate a wacom tablet works at crashing rnote (but not xournal++ for me) but my real wacom tablet (libwacom driver) does not. And as long as my tablet is plugged in, your script does not crash rnote :rofl: nvm it does sometimes..?

Agent00Ming commented 4 months ago

I would like to ask all of you to send a WAYLAND_DEBUG=1 log of rnote, xournal++ and firefox (and indicate crashing/not crashing + which driver you are using). @nine7nine @lVentus @okobenoko @leon-erd @awerty-noob @jfab20 @0bCdian

leon-erd commented 4 months ago

How to find out which driver Im using?

nine7nine commented 4 months ago

Hey @Agent00Ming - That's not a problem, but it will need to wait until after work. So i'll do that tonight or tomorrow, at the latest.

Agent00Ming commented 4 months ago

How to find out which driver Im using?

lsmod | grep usbhid or something like that depending on how your tablet/EMF screen is connected

leon-erd commented 4 months ago

Here you go WaylandDebug_firefox.log WaylandDebug_xournalpp.log both crashed basically instantly when moving the mouse after using the pen

➜  ~ lsmod | grep usbhid
usbhid                 81920  0
hid                   180224  6 i2c_hid,usbhid,hid_multitouch,hid_sensor_hub,intel_ishtp_hid,hid_generic
okobenoko commented 4 months ago

WaylandDebug_xournalpp.log WaylandDebug_firefox.log Both crached after switching from tablet back to mouse. Driver: Opentabletdriver v0.7.0.0pre.r893.g3dfaddf3-1 (Aritst Mode)

~ lsmod | grep usbhid usbhid 90112 0

lVentus commented 4 months ago

I would like to ask all of you to send a WAYLAND_DEBUG=1 log of rnote, xournal++ and firefox (and indicate crashing/not crashing + which driver you are using). @nine7nine @lVentus @okobenoko @leon-erd @awerty-noob @jfab20 @0bCdian

of course! rnote.log xournalpp.log Driver: IPTSD using a 2 in 1(surface pro 8), so no results from lsmod | grep usbhid by the way, nautilus this kind of gtk app will also crash.

FedX-sudo commented 4 months ago

Hi, just got a StarLike MKV and came across this bug as well. Reading over the previous discussion, I have nothing new to add other then that I made the same observations of it appearing to only affect GTK applications.

This behavior may also be something to do with a device specific cursor, as backtracing an RNote crash, I saw that one of the last function calls was gdk_wayland_device_update_surface_cursor(), a function that appears to change the cursor when switching between devices such as a drawing tablet and touchscreen.

EDIT: I have also observed the bug when switching my pen from eraser mode back to pen mode. On my device, this is a single button I can hit without moving the pen away from the screen.

FedX-sudo commented 4 months ago

I noticed some errors coming from Hyprland, specifically "proximityIn on a tool and tablet without valid resource(s)?". I tracked down this error to the CTabletV2Protocol::proximityIn ( https://github.com/hyprwm/Hyprland/blob/main/src/protocols/Tablet.cpp#L549 ). I made the following changes to that function in order to attempt to solve the issue:

diff --git a/src/protocols/Tablet.cpp b/src/protocols/Tablet.cpp
index 393dfd38..3568e177 100644
--- a/src/protocols/Tablet.cpp
+++ b/src/protocols/Tablet.cpp
@@ -579,7 +579,7 @@ void CTabletV2Protocol::proximityIn(SP<CTabletTool> tool, SP<CTablet> tablet, SP
         }
     }

-    if (!tabletResource || !toolResource) {
+    if (!tabletResource->good() || !toolResource->good() ) {
         LOGM(ERR, "proximityIn on a tool and tablet without valid resource(s)??");
         return;
     }

This resulted in rather then the application crashing, Hyprland crashing. This may, however, be entirely unrelated behavior (I am really not that great at working with graphics). Has anyone else observed similar behavior?

FedX-sudo commented 4 months ago

Interesting... The error appears to go away when switching form Hyprland version 0.40.2 to version 0.39.0. Between those two versions, the Tablet.cpp as mentioned above did not change, therefore, I was very much wrong.

Agent00Ming commented 4 months ago

That's not quite the right lead. This specific error message is totally benign. Odds are that the tablet resource is being removed at the wrong time.

FedX-sudo commented 4 months ago

Seems that way. I suppose I am just bored and poking at random things until something works, lol.

mrWinston commented 3 months ago

As a quick and dirty workaround, it turns out that if you force rnote to run in xwayland, it doesn't crash:

env -u WAYLAND_DISPLAY flatpak run com.github.flxzt.rnote

For me however, that somewhat limits the usability of my graphics tablet, as pressure sensitivity and pen buttons don't seem to reach the app. But at least it doesn't crash anymore :)

Agent00Ming commented 3 months ago

Please have a look at #6761. It fixes this issue tested with @mrWinston's minimal repro python script and with my real tablet in #6608.

leon-erd commented 3 months ago

Actually seems to be fixed for me!!!