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
19.71k stars 837 forks source link

Hyprland placing cursor on wrong screen after mouse ungrab #3028

Closed UltraBlackLinux closed 1 year ago

UltraBlackLinux commented 1 year ago

Hyprland Version

0.28.0.r65.37a211a2

Bug or Regression?

Bug

Description

I just got a new GPU, and by default, hyprland is no longer detecting my screen placement correctly. I have set it up via the config file, but now something weird is happening: Whenver a fullscreen game grabs the cursor and ungrabs it, the cursor is placed on my other screen.

This is what I use:

monitor=HDMI-A-1, preferred, 240x150, 1
monitor=DP-3, preferred, 1920x0, 1

How to reproduce

open a game which grabs and ungrabs the mouse, like minecraft

Crash reports, logs, images, videos

No response

simonm commented 1 year ago

I am seeing the same issue.

Releasing the right-mouse button from a full-screen game on monitor 1 causes the mouse cursor to jump to monitor 2.

This behavior started when I upgraded to 0.28. I think this is a regression in v0.28.0-70-gfff118fa.

EDIT - I've rolled back to v0.26.0-97-gb33d8273 and cannot replicate this behavior.

VeilSilence commented 1 year ago

91e28bbe9df85e2e94fbcc0137106362aea14ab5 commit caused this issue for me.

vaxerski commented 1 year ago

wasnt this fixed yesterday?

VeilSilence commented 1 year ago

Hyprland, built from branch main at commit 37128bfd43a3d86d270c09e34f18fe4df48c6b35 dirty (internal: Wayland Protocol impl improvements (2944)). Tag: v0.28.0-77-g37128bfd Just tested. Still happens for me. Also as i said in different bug report, some xwayland apps/games don't recognize correctly current resolution for some reason with dual monitors. Reverting back to 2b4537606f604f29b2d42d7be369182831269958 works fine for me.

vaxerski commented 1 year ago

it's just that I am sitting here playing minecraft for like 8h today and havent seen this happen once lol

VeilSilence commented 1 year ago

Not all xwayland apps/games affected by that. Baldur's gate 3 works fine, DeadByDaylight works also. World of Warcraft have this problem. Can test other games/apps if needed.

UltraBlackLinux commented 1 year ago

@vaxerski So yeah I wanted to say something about that.-- The issue went away!

I think this has something to do with hyprland not adjusting properly after messing with the screen configuration.

secretknowledge commented 1 year ago

I can confirm that this bug is still happening to me while playing Minecraft.

vaxerski commented 1 year ago

I can confirm that this bug is still happening to me while playing Minecraft.

any further setup info to repro? fullscreen? which monitor? scaling? version?

secretknowledge commented 1 year ago

I have a Nvidia card with not scaling on the latest version of hyprland-nvidia-git. I am using a 1440p 1444 hz monitor and a 1080p 75hz monitor. I hope this helps!

vaxerski commented 1 year ago

What minecraft version? Could be a specific lwjgl mechanic.

varris1 commented 1 year ago

I have seen that with Guild Wars 2. Moving the camera with the right mouse button will jump the cursor to my 2nd screen. Using negative coordinates (my 2nd screen is on the left)

monitor=DP-2, 2560x1440@144, -2560x0, 1
monitor=DP-1, 2560x1440@144, 0x0, 1

fixed it for me, so I didn't take it in mind that it could have been a bug

secretknowledge commented 1 year ago

I try that. I was using Minecraft 1.20 with fabulously optimized if that helps.

On Mon, Aug 21, 2023, 11:54 PM varris1 @.***> wrote:

I have seen that with Guild Wars 2. Moving the camera with the right mouse button will jump the cursor to my 2nd screen. Using negative coordinates

monitor=DP-2, @., -2560x0, 1 monitor=DP-1, @., 0x0, 1

fixed it for me, so I didn't take it in mind that it could have been a bug

— Reply to this email directly, view it on GitHub https://github.com/hyprwm/Hyprland/issues/3028#issuecomment-1687376569, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR4SALPOBLCOF2VV3VN7AKDXWQUPRANCNFSM6AAAAAA3WTKFQM . You are receiving this because you commented.Message ID: @.***>

secretknowledge commented 1 year ago

I'll try that. I was using Minecraft 1.20 with fabulously optimized if that helps.

VeilSilence commented 1 year ago

I have a Nvidia card with not scaling on the latest version of hyprland-nvidia-git. I am using a 1440p 1444 hz monitor and a 1080p 75hz monitor. I hope this helps!

Did you test different games? I have same bug as you, but there is other bug for me atleast. For example, i started game on 1440p resolution monitor. Game starts in 1080p resolution. Game graphic settings also offer maximum 1080p. If started/moved on 1080p monitor, i can see in game settings 1440p resolution. Tried setting negative coordinates and sadly didn't help for me. My hyprctl monitor output if this can help. I can record video if needed.

secretknowledge commented 1 year ago

I also have been having that same issue with games launching at the wrong resolution when running via proton. Maybe this and the mouse bug are related? Unfortunately, the negative resolution thing did not work.

UltraBlackLinux commented 1 year ago

The issue has returned for me. Very weird

Did notice something though. It's only happening on one monitor, as if it's always placing the cursor on the exact same monitor. If I ungrab the cursor on the left monitor it puts it on the right monitor. If I ungrab it on the right monitor, the cursor stays on the right monitor.

I guess I didn't notice this, because my right monitor is my main one. I only game on that

dev-null-undefined commented 1 year ago

Same issue for me with minecraft:

> hyprctl monitors
Monitor eDP-1 (ID 0):
    1920x1080@144.028000 at 1920x0
    description: AU Optronics 0x80ED (eDP-1)
    make: AU Optronics
    model: 0x80ED
    serial: 
    active workspace: 11 (11)
    special workspace: 0 ()
    reserved: 0 0 0 46
    scale: 1.00
    transform: 0
    focused: no
    dpmsStatus: 1
    vrr: 0

Monitor DP-3 (ID 1):
    1920x1080@144.000000 at 0x0
    description: AOC 27G2G4 GYGLCHA305056 (DP-3)
    make: AOC
    model: 27G2G4
    serial: GYGLCHA305056
    active workspace: 3 (3)
    special workspace: 0 ()
    reserved: 0 0 0 46
    scale: 1.00
    transform: 0
    focused: yes
    dpmsStatus: 1
    vrr: 0
> hyprctl version
Hyprland, built from branch  at commit 84c4a14dadf8d28f57068d39cfec2612c15becd1  ().

Playing minecraft on the DP-3 monitor then going to menu (inventory, escape menu) moves cursor to the eDP-1 and shifts it by the movement done in the game. But playing minecraft on the eDP-1 works just fine.

Tested full screen, floating, F11 all have the same behavior.

Seems to be issue with the monitor the game is on.

vaxerski commented 1 year ago

should be fixed with 28a90d6055f7b616c611c839967765f6536a7cd9, please check

dev-null-undefined commented 1 year ago

should be fixed with 28a90d6, please check

Nope doesn't fix it for me Hyprland, built from branch at commit 28a90d6055f7b616c611c839967765f6536a7cd9 ().

dev-null-undefined commented 1 year ago

Is there any other information that I could provide, to ease the debugging process?

dev-null-undefined commented 1 year ago

Interesting fact (probably not helpful tho) is that the game doesn't lose focus (I have input.follow_mouse set to 1) so it should lose focus since the cursor is moved to different window (workspace), but it will not until I move the mouse a little.

vaxerski commented 1 year ago

patch.txt try this

dev-null-undefined commented 1 year ago

patch.txt try this

Still same issue

dev-null-undefined commented 1 year ago

Here is quick video but I think the text speaks for it self https://cloud.dev-null.me/s/ydqsXMnR9X9bzab (deleted since issue resolved)

vaxerski commented 1 year ago

I don't seem to be able to repro this. Can you give me a hyprland log where this happens? preferably the part of the log when the bug happens

MightyPlaza commented 1 year ago

firefox seems to present same behaviour (as initial post on latest build) unsure if it's a firefox/website issue

go to any online game (ex: https://classic.minecraft.net/?join=1sK3AabYgtgpJg1D) on firefox wait for mouse to get grabbed press ESC mouse is out of window bounds

dev-null-undefined commented 1 year ago

Not really the same behavior, the firefox game is just not following the constraints at all no meter what monitor it's on.

dev-null-undefined commented 1 year ago

I don't seem to be able to repro this. Can you give me a hyprland log where this happens? preferably the part of the log when the bug happens

[LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1 - Singleplayer) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 - Singleplayer [LOG] New mouse constraint at 1bc2150 [LOG] Registered signal for owner 31d65d0: 1bc2258 -> 31d6660 (owner: Constraint) [LOG] Registered signal for owner 31d65d0: 1bc2248 -> 31d65f8 (owner: Constraint) [LOG] Registered signal for owner 1c3ed70: 31db1d0 -> 1c3edc8 (owner: Mouse constraint commit) [LOG] Constrained mouse to 1bc2150 [LOG] Callback 1c3edf0 -> 1c3ede8, Mouse constraint commit removed. [LOG] Unconstrained mouse from 1bc2150 [LOG] Callback 31d6688 -> 31d6680, Constraint removed. [LOG] Callback 31d6620 -> 31d6618, Constraint removed. [LOG] New mouse constraint at 1bcf660 [LOG] Registered signal for owner 31d65d0: 1bcf768 -> 31d6660 (owner: Constraint) [LOG] Registered signal for owner 31d65d0: 1bcf758 -> 31d65f8 (owner: Constraint) [LOG] Registered signal for owner 1c3ed70: 31db1d0 -> 1c3edc8 (owner: Mouse constraint commit) [LOG] Constrained mouse to 1bcf660 [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1 - Singleplayer) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 - Singleplayer [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1 - Singleplayer) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 - Singleplayer [LOG] Callback 1c3edf0 -> 1c3ede8, Mouse constraint commit removed. [LOG] Unconstrained mouse from 1bcf660 [LOG] Callback 31d6688 -> 31d6680, Constraint removed. [LOG] Callback 31d6620 -> 31d6618, Constraint removed. [LOG] Searching for matching rules for Minecraft 1.20.1 (title: Minecraft 1.20.1 - Singleplayer) [LOG] Window 31d9a30 set title to Minecraft 1.20.1 - Singleplayer [LOG] Set keyboard focus to surface 31cf710, with window name: ~ [LOG] Minimize request for 31d9a30 [LOG] Set keyboard focus to surface 31daf00, with window name: Minecraft 1.20.1 - Singleplayer [LOG] Keybind triggered, calling dispatcher (64, , 49)

Working on getting better logs right now

vaxerski commented 1 year ago

patch.txt

try this pach

dev-null-undefined commented 1 year ago

patch.txt

try this pach

Combined with the previous? or applied just to main branch?

dev-null-undefined commented 1 year ago

https://gist.github.com/dev-null-undefined/f4d6a755accb11c19da202305bc65b57 here is better log with both normal behavior and the weird one

dev-null-undefined commented 1 year ago

patch.txt

try this pach

This patch did fix the issue for me. Thanks <3

simonm commented 1 year ago

Just to confirm that the current hyprland from AUR works for me. Confirmed fixed.

❯ hyprctl version
Hyprland, built from branch main at commit b10cae3010f5b1d853eb13f8a591ee10d67fe51e dirty (decos: groupbar mouse interaction (3102)).
Tag: v0.29.0-7-gb10cae30

flags: (if any)

Many thanks @vaxerski !

I do get a weird issue that when the game first runs the window now seems to spawn "off screen". I get a black bar on the edge of one of the monitors, I have to select and then moveworkspacesilent to a workspace to see the application. But the right-click defocus mouse issue is gone.