swaywm / sway

i3-compatible Wayland compositor
https://swaywm.org
MIT License
14.69k stars 1.11k forks source link

clicks not registering in wine #4857

Closed alexarice closed 1 year ago

alexarice commented 4 years ago

A note that I can currently work around this for the first 2 by enabling desktop emulation in winecfg. Also both the first 2 work correctly on weston.

emersion commented 4 years ago

Your bug report is missing your config file and debug log. Please add a link to those.

alexarice commented 4 years ago

Your bug report is missing your config file and debug log. Please add a link to those.

Have updated the issue description, sorry about that

ammgws commented 4 years ago

@alexarice Did you get anywhere with this? I think I might be experiencing the same issue.

alexarice commented 4 years ago

I didn't get anywhere

ghost commented 4 years ago

Work around for me was:

1) enable desktop emulation 2) client: open->close->reopen, this also fixes the status bar crashing sway and the screen dead zone created before that (not 100% reproducible) crash 3) switch to another workspace and back

pavlus commented 4 years ago

Have similar issue with IntelliJ IDEA, 1.3 (rc1, rc2) sometimes does not register clicks on pop-up windows (Settings, dialgos, etc)

PSzczepanski1996 commented 4 years ago

Have similar issue, but I use two displays, and clicks are not working on only one.

Also disabling decoration etc. in winecfg causes winecfg jump like crazy (not sure if not XWayland bug). I tried that because I supposed that it will be maybe workaround.

aqxa1 commented 4 years ago

I've had this issue with Proton in Steam. Switching to a different workspace then back generally works, however, if I disable my secondary monitor, the workaround no longer works. If I instead set the secondary monitor to blank (with dpms off) it works again, so presumably something breaks in the switch from multi-monitor to (temporary) single monitor config.

biwhite commented 4 years ago

Similar issue for me. Wine app such as winecfg or wine steam game running under proton or running under wine manually, after it opens no input being received. Full screen wine app shows decorated mouse moving around but no clicks. No keyboard input working. winecfg window doesn't show any mouse or accept keyboard input. No workaround found for me yet. Running app with virtual desktop appending '/desktop 1024x768' to the command changes behaviour to no mouse tracking, decorated or otherwise!

aqxa1 commented 4 years ago

Okay, so in my case, the problem only occurs with some games, all of which seem to be using hardware cursors (but it doesn't affect all games with hardware cursors):

Broken:

Works:

I suspect my issue is different. From memory, I do remember the more severe issue occurring in the past (that can't be recovered from by switching workspaces). I'm currently using an all git Wayland stack, so the more severe issue may already be fixed.

EDIT: Okay so The Witcher 3 functions properly without the workspace trick, if I launch from a single monitor configuration. CLANNAD also initially works with this tactic, but if you try and close the game, a dialog window pops over the main game, which can't be clicked. Once this occurs, you can't regain cursor access (and the workspace trick seems to only work with multiple outputs active, even if the switch is between two workspaces of the same output). The cursor also briefly shifts back to the non-hardware cursor when ever you click something in CLANNAD (which doesn't occur with the workspace switch workaround). Strange bug.

Allyriadil commented 4 years ago

For me it happens when I run two applications in a WINE prefix. It works perfectly on Xorg but on wayland the second application doesn't accept any mouseclicks, the mouse also seems to go through the application.

fuzunspm commented 4 years ago

if i set capture mouse in winecfg it works but i also need to emulate virtual desktop otherwise most wine applications can't create a window on sway

fauu commented 4 years ago

I have a similar issue. One of the earlier comments here helped me discover that in my case it's somehow related to multiple displays. In sway config I have my laptop display LVDS-1 centered above my external display HDMI-A-1:

output LVDS-1 position 157,0 output HDMI-A-1 position 0,768

In this default state wine GUI applications work correctly. Now however, when I turn off the laptop display:

swaymsg "output LVDS-1 toggle"

and launch winecfg, the window displays correctly, but the cursor disappears as soon as it enters the window, and no mouse interaction is possible. Except for when I press my Mod key and start dragging the window — in that case the window moves correctly, and the dragging cursor is visible for as long as I'm moving the window.

If I toggle the output again to turn it on, and relaunch winecfg, then it works properly again.

I can sometimes get it to work properly even with LVDS-1 toggled off by relaunching winecfg after toggling LVDS-1 twice.

It also seems to work properly when the remaining output is the top one, meaning two scenarios: 1) when I toggle off HDMI-A-1 and launch winecfg on LVDS-1, and 2) when I swap the displays in terms of y position so that HDMI-A-1 is on top, and then proceed with the default scenario (toggle off LVDS-1 and launch winecfg).

aqxa1 commented 4 years ago

Tomb Raider: Legend (7000) is another game with click registering issues. In this case, setting virtual desktop mode worked around the problem.

spikecodes commented 4 years ago

Running Rocket League with Legendary gives this problem too :/ no mouse clicking works.

spikecodes commented 4 years ago

Not sure what is different but I have updated my system since then and Rocket League runs flawlessly on Sway now!

WhyNotHugo commented 4 years ago

Having this same issue on sway 1.5.1 on Arch. Using wine-staging 5.21.

Even winecfg picks up no mouse events nor keyboard events. My sway config is here.

When opening winecfg, sway logs this:

Nov 14 12:55:45 victory sway[608]: 00:04:48.431 [ERROR] [xwayland/xwm.c:1398] xcb error: op ChangeProperty (no minor), code Window (no extension), sequence 1885, value 10485763
GorrillaRibs commented 3 years ago

Also having this issue on sway 1.5.1 and wlroots 0.12 on arch, but only on one display - I have 2 screens (laptop built-in @ 1920x1080) and external HDMI @ 3440x1440) and wine works fine on the built in display (eDP-1) but not on the external, regardless of which display its launched on.

my display config is:

output eDP-1 subpixel none
output HDMI-A-1 subpixel none
output eDP-1 pos 0,0
output HDMI-A-1 pos 0,-1440

it also seems to work if I disable the internal screen and then start wine, so it seems related to having multiple displays? Is only one of them passed to xwayland? (so only coordinates on that display are valid?) Does anyone have any advice on how to begin debugging this?

EDIT:

Actually this seems to apply to all xwayland programs - xcalc for example only accepts mouse input on the internal display, but not the external, so at least on my system the issue isn't limited to wine.

Emantor commented 3 years ago

Also having this issue on sway 1.5.1 and wlroots 0.12 on arch, but only on one display - I have 2 screens (laptop built-in @ 1920x1080) and external HDMI @ 3440x1440) and wine works fine on the built in display (eDP-1) but not on the external, regardless of which display its launched on.

my display config is:

output eDP-1 subpixel none
output HDMI-A-1 subpixel none
output eDP-1 pos 0,0
output HDMI-A-1 pos 0,-1440

it also seems to work if I disable the internal screen and then start wine, so it seems related to having multiple displays? Is only one of them passed to xwayland? (so only coordinates on that display are valid?) Does anyone have any advice on how to begin debugging this?

EDIT:

Actually this seems to apply to all xwayland programs - xcalc for example only accepts mouse input on the internal display, but not the external, so at least on my system the issue isn't limited to wine.

Negative coordinates are not supported by Xwayland, see this issue on the xwayland bug tracker.

Edit: Looking at the issue again this could be fixed on Xwayland master, however the fix is not contained in the latest 1.20.10 release.

GorrillaRibs commented 3 years ago

ah, duh - that makes sense. The issue seems fixed for me when I fixed up my display config without negative coordinates, tested with xcalculator and winecfg.

Thanks!

sloonz commented 3 years ago

Same issue, easy to reproduce.

First, configuration. I have an external display configuration on my laptop :

set $left_output HDMI-A-1
set $right_output eDP-1

output $left_output position 0,0 mode 1366x768
output $right_output position 1366,0 mode 1920x1080

The issue can only reproduced if the external display (here HDMI-A-1) is not plugged-in when sway starts ; the issue disappears as soon as I plug in the external display. So to summarize : the issue appears when a display is configured but not present.

As for the issue itself…

wine notepad

This is just running wine notepad, standard wine build without fancy patches (not even staging, pacman -S wine on archlinux). Obviously someone here (Sway ? Xwayland ? Wine itself ?) seems pretty confused by the geometry of the display. In this image, I right-clicked on the black area and the dropdown menu appeared on the left part of the screen.

Lucaber commented 3 years ago

In some games with wine (proton), my mouse cursor only works on the monitor that is placed at (0,0). Placing my secondary monitor on the right side, fixes the problem on the primary one.

Thats probably why games in full-screen are registering clicks on the right side of the display, the used mouse position is the absolute position across all displays.

ErikReider commented 3 years ago

Sometimes the rockstar launcher also doesn't register clicks. I've only experienced this while installing GTA V in Steam (which launches the rockstar installer) but works as expected when running the launcher manually in the terminal

tinywrkb commented 3 years ago

I've seen this happens also with LTspice when trying to click on the menubar, though entering and exiting fullscreen mode fixed the problem.

This seems to be an XWayland specific bug, it doesn't happen when running a build of the Collabora Wayland branch.

itspngu commented 3 years ago

I've spent 2 hours having a very similar issue with "Mod Organizer 2" and Lutris. I was done organizing things, switched off screens and put everything on the TV to play from the couch, bonk, black screen. Tried a bunch of things (including trying to use one of my desk screens which aren't 4K because I thought it might be a resolution issue) before stumbling into this thread, turning all 4 screens on, and having it work right off the bat on any screen. Weird!

Hedius commented 3 years ago

I have the same issue.

I usually have a 3 display setup with my notebook. All 3 displays are usually configured and my laptop's display is placed at 3840 0.

However, this makes all wine windows unclickable if my two external monitors are disconnected. Disabling the config of those 2 monitors + setting the offset of my notebook to 0 0 made wine clickable again.

Zeioth commented 3 years ago

Same issue here. I cannot click on wine games, but gamepad support goes well. This is particulary bad on some games like 'Quake Champions' where you can't click the button to start the game. (But runs great apart from that)

WORKAROUND FOUND: I had this on my settings:

output DP-3 resolution 3840x2160 position 3840,0

By removing the position part, the issue is gone:

output DP-3 resolution 3840x2160

Still, this is going to be a problem when I add more monitors since I have no way to position them. I'll test more when I have time.

itspngu commented 2 years ago

Just had another instance of mouse + wine + xwayland = weird: The cursor would be stuck to the left side of the screen in a fullscreen DXVK app and could only be moved vertically when turning everything but my center screen off. I fixed it by amending a previous fix for clicks not registering at all (or in the wrong position): https://github.com/swaywm/sway/issues/6422#issuecomment-965366253

# https://github.com/swaywm/sway/issues/6422#issuecomment-965366253
xwayland force
# https://robbyzambito.me/posts/how-to-set-primary-x-display-on-sway/
#exec_always xrandr --output "$(xrandr --listactivemonitors | grep "1920+0" | head -n1 | cut -d' ' -f6)" --primary
exec_always xrandr --output "$(xrandr --listactivemonitors | grep "0+0" | head -n1 | cut -d' ' -f6)" --primary --pos 0x0

#output $scr_l mode 1920x1080@60.000Hz  position 0    0
output $scr_l mode 1920x1080@60.000Hz  position 0    0 disable
#output $scr_m mode 1920x1080@165.002Hz position 1920 0 max_render_time 1
output $scr_m mode 1920x1080@165.002Hz position 0 0 max_render_time 1
#output $scr_r mode 1920x1080@60.000Hz  position 3840 0
output $scr_r mode 1920x1080@60.000Hz  position 3840 0 disable
#output $tv    resolution 3840x2160     position 5760 0
output $tv    resolution 3840x2160     position 5760 0 disable

Basically, you'll want to ensure that the correct screen is configured as primary for X, and also set its position to 0x0 in both sway and X if you turn previously active monitors off to, say, play a game with only one screen connected if it's not at 0x0 in your multihead setup. You also still want to avoid negative coordinates for your outputs.

Edit: Forgot to tag @Zeioth - I feel like this might be helpful for you. I forgot to keep the logs, but essentially, xrandr would tell me that my screen size was 5760x1080 with the issue present, and that the primary (and only) screen was 1920x1080+1920+0. With the issue fixed, the screen size was reported as 1920x1080, and the primary screen was 1920x1080+0+0.

ghost commented 2 years ago

This issue does not seem to be present on wine-wayland.

flowHater commented 2 years ago

I think we can close this issue by : https://github.com/swaywm/sway/issues/6422#issuecomment-965366253

I fixed the issue, and as explained in the end, This is not an issue Sway can resolve in particular.

tinywrkb commented 2 years ago

@flowHater even if the workaround works, the issue shouldn't be closed without proper documentation, maybe in the wiki here.
Could you try running the game through gamescope instead of setting a default X11 display, and if it works, then this also should be documented.

ammgws commented 2 years ago

In my case I was trying to run a game I bought on Steam that tries to install Origin on startup. I tried gamescope as well but in the end the solution was to disable all monitors except the one I was using and set its position to 0,0 before clicks would register.

Spiffyk commented 2 years ago

I have written a python script that configures my monitors on Sway. It has a section at the bottom that takes care of automatically setting the primary XWayland monitor. Feel free to reuse it if you're interested. Unfortunately, it needs to be executed manually sometimes, since Sway IPC does not have an output event (yet).

ammgws commented 2 years ago

I've found that running steam itself through gamescope has seemed to have solved all issues for me: gamescope --nested-width 1920 --nested-height 1080 --steam --fullscreen -- steam-native -tenfoot

tinywrkb commented 2 years ago

@ammgws it should be pointed out that gamescope doesn't have clipboard sync working with the host compositor (same issue nested sway).

binarious commented 1 year ago

@Zeioth

I had this on my settings:

output DP-3 resolution 3840x2160 position 3840,0

By removing the position part, the issue is gone:

output DP-3 resolution 3840x2160

Thanks for that hint! With that I was able to change the problematic config

output eDP-1 pos 0 0 res 1920x1080
output HDMI-A-1 pos 1920 0 res 3840x2160

to a working one by moving the primary monitor to offset 0:

output eDP-1 pos -1920 0 res 1920x1080
output HDMI-A-1 pos 0 0 res 3840x2160

And by the way this also fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1282790 for me.

emersion commented 1 year ago

Closing as this is not a Sway bug.