Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Mouse/Stylus/Touch input is in wrong monitor when using multi-monitor on Linux

Open laurorual opened this issue 9 months ago • 18 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Is your issue described in the documentation?

  • [x] I have read the documentation

Is your issue present in the latest beta/pre-release?

This issue is present in the latest pre-release

Describe the Bug

When hosting on my Linux machine with multi-monitor, the main monitor on Sunshine is set as the HDMI one, even if my main monitor is set as the DP one on the OS. After changing the motidor to be displayed in the setting "Display number", i can see the correct display when streaming, but the input continues to be sent to the HDMI monitor when using any kind of touch input (multi touch or absolute touch), forcing me to use trackpad mode to be able to use the mouse on the correct monitor. This is fine when using an android phone/tablet as client or using a real mouse connected, but when using my LG TV as client, using the TV's remote as a mouse works kinda like absolute touch, making it impossible to use the mouse, since it's in the wrong monitor.

I've seen on another issue someone recommending a workaround, to disable the native pen/touch option on the Input tab, but it doesn't help.

Expected Behavior

Absolute/Multi Touch to be working on the monitor selected on the "Display number" setting in Sunshine.

Additional Context

I'm using KDE Plasma v6.3.1. Sunshine comes pre-installed on Bazzite builds.

Host Operating System

Linux

Operating System Version

Bazzite 41

Architecture

amd64/x86_64

Sunshine commit or version

2025.221.143652

Package

other (not listed)

GPU Type

NVIDIA

GPU Model

RTX 3060

GPU Driver/Mesa Version

570.86.16

Capture Method

None

Config


Apps


Relevant log output

[2025-03-01 17:39:31.132]: Info: Sunshine version: v2025.221.143652
[2025-03-01 17:39:31.132]: Info: Package Publisher: LizardByte
[2025-03-01 17:39:31.132]: Info: Publisher Website: https://app.lizardbyte.dev
[2025-03-01 17:39:31.132]: Info: Get support: https://app.lizardbyte.dev/support
[2025-03-01 17:39:31.214]: Info: System tray created
[2025-03-01 17:39:31.280]: Error: Failed to create session: 
[2025-03-01 17:39:31.280]: Info: Found display [wayland-0]
[2025-03-01 17:39:31.280]: Info: Found interface: zxdg_output_manager_v1(31) version 3
[2025-03-01 17:39:31.280]: Info: Found interface: wl_output(61) version 4
[2025-03-01 17:39:31.280]: Info: Found interface: wl_output(73) version 4
[2025-03-01 17:39:31.280]: Warning: Missing Wayland wire for wlr-export-dmabuf
[2025-03-01 17:39:31.280]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 17:39:31.281]: Info: Found display [wayland-0]
[2025-03-01 17:39:31.281]: Info: Found display [wayland-0]
[2025-03-01 17:39:31.281]: Info: Found interface: zxdg_output_manager_v1(31) version 3
[2025-03-01 17:39:31.281]: Info: Found interface: wl_output(61) version 4
[2025-03-01 17:39:31.281]: Info: Found interface: wl_output(73) version 4
[2025-03-01 17:39:31.281]: Info: Resolution: 1920x1080
[2025-03-01 17:39:31.281]: Info: Resolution: 1920x1080
[2025-03-01 17:39:31.281]: Info: Offset: 1920x0
[2025-03-01 17:39:31.281]: Info: Logical size: 1920x1080
[2025-03-01 17:39:31.281]: Info: Name: DP-1
[2025-03-01 17:39:31.281]: Info: Found monitor: HKM M238W1F2556/0000000000001
[2025-03-01 17:39:31.281]: Info: Offset: 0x0
[2025-03-01 17:39:31.281]: Info: Logical size: 1920x1080
[2025-03-01 17:39:31.281]: Info: Name: HDMI-A-1
[2025-03-01 17:39:31.281]: Info: Found monitor: Samsung Electric Company HDMI-A-1-T24C310
[2025-03-01 17:39:31.281]: Info: -------- Start of KMS monitor list --------
[2025-03-01 17:39:31.281]: Info: Monitor 1 is DP-1: HKM M238W1F2556/0000000000001
[2025-03-01 17:39:31.281]: Info: Monitor 0 is HDMI-A-1: Samsung Electric Company HDMI-A-1-T24C310
[2025-03-01 17:39:31.281]: Info: --------- End of KMS monitor list ---------
[2025-03-01 17:39:31.322]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2025-03-01 17:39:31.322]: Info: Trying encoder [nvenc]
[2025-03-01 17:39:31.322]: Info: Screencasting with KMS
[2025-03-01 17:39:31.322]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 17:39:31.322]: Info: Found monitor for DRM screencasting
[2025-03-01 17:39:31.322]: Info: Found connector ID [106]
[2025-03-01 17:39:31.323]: Info: Found cursor plane [66]
[2025-03-01 17:39:31.323]: Info: Creating encoder [h264_nvenc]
[2025-03-01 17:39:31.323]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 17:39:31.323]: Info: Color depth: 8-bit
[2025-03-01 17:39:31.323]: Info: Color range: JPEG
[2025-03-01 17:39:31.582]: Info: Streaming bitrate is 1000000
[2025-03-01 17:39:31.862]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 17:39:31.862]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 17:39:31.862]: Info: Color depth: 8-bit
[2025-03-01 17:39:31.862]: Info: Color range: JPEG
[2025-03-01 17:39:31.865]: Info: Streaming bitrate is 1000000
[2025-03-01 17:39:32.140]: Info: Creating encoder [av1_nvenc]
[2025-03-01 17:39:32.140]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 17:39:32.140]: Info: Color depth: 8-bit
[2025-03-01 17:39:32.140]: Info: Color range: JPEG
[2025-03-01 17:39:32.147]: Info: Streaming bitrate is 1000000
[2025-03-01 17:39:32.161]: Warning: [av1_nvenc @ 0x35507d00] Codec not supported
[2025-03-01 17:39:32.162]: Error: [av1_nvenc @ 0x35507d00] Provided device doesn't support required NVENC features
[2025-03-01 17:39:32.412]: Error: Could not open codec [av1_nvenc]: Função não implementada
[2025-03-01 17:39:32.413]: Info: Screencasting with KMS
[2025-03-01 17:39:32.413]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 17:39:32.413]: Info: Found monitor for DRM screencasting
[2025-03-01 17:39:32.413]: Info: Found connector ID [106]
[2025-03-01 17:39:32.414]: Info: Found cursor plane [66]
[2025-03-01 17:39:32.414]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 17:39:32.414]: Info: Color coding: SDR (Rec. 709)
[2025-03-01 17:39:32.414]: Info: Color depth: 10-bit
[2025-03-01 17:39:32.414]: Info: Color range: JPEG
[2025-03-01 17:39:32.417]: Info: Streaming bitrate is 1000000
[2025-03-01 17:39:32.691]: Info: 
[2025-03-01 17:39:32.691]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2025-03-01 17:39:32.691]: Info: 
[2025-03-01 17:39:32.691]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2025-03-01 17:39:32.691]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2025-03-01 17:39:32.693]: Info: Adding avahi service MiWiFi-RD18-srv
[2025-03-01 17:39:32.694]: Info: Configuration UI available at [https://localhost:47990]
[2025-03-01 17:39:33.627]: Info: Avahi service MiWiFi-RD18-srv successfully established.
[2025-03-01 17:48:25.125]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2025-03-01 17:48:25.125]: Info: Trying encoder [nvenc]
[2025-03-01 17:48:25.125]: Info: Screencasting with KMS
[2025-03-01 17:48:25.125]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 17:48:25.125]: Info: Found monitor for DRM screencasting
[2025-03-01 17:48:25.125]: Info: Found connector ID [106]
[2025-03-01 17:48:25.126]: Info: Found cursor plane [66]
[2025-03-01 17:48:25.126]: Info: Creating encoder [h264_nvenc]
[2025-03-01 17:48:25.126]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 17:48:25.126]: Info: Color depth: 8-bit
[2025-03-01 17:48:25.126]: Info: Color range: JPEG
[2025-03-01 17:48:25.198]: Info: Streaming bitrate is 1000000
[2025-03-01 17:48:25.473]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 17:48:25.473]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 17:48:25.473]: Info: Color depth: 8-bit
[2025-03-01 17:48:25.473]: Info: Color range: JPEG
[2025-03-01 17:48:25.477]: Info: Streaming bitrate is 1000000
[2025-03-01 17:48:25.745]: Info: Creating encoder [av1_nvenc]
[2025-03-01 17:48:25.745]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 17:48:25.745]: Info: Color depth: 8-bit
[2025-03-01 17:48:25.745]: Info: Color range: JPEG
[2025-03-01 17:48:25.750]: Info: Streaming bitrate is 1000000
[2025-03-01 17:48:25.758]: Warning: [av1_nvenc @ 0x7f867c3cf080] Codec not supported
[2025-03-01 17:48:25.758]: Error: [av1_nvenc @ 0x7f867c3cf080] Provided device doesn't support required NVENC features
[2025-03-01 17:48:26.009]: Error: Could not open codec [av1_nvenc]: Função não implementada
[2025-03-01 17:48:26.010]: Info: Screencasting with KMS
[2025-03-01 17:48:26.011]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 17:48:26.011]: Info: Found monitor for DRM screencasting
[2025-03-01 17:48:26.011]: Info: Found connector ID [106]
[2025-03-01 17:48:26.012]: Info: Found cursor plane [66]
[2025-03-01 17:48:26.012]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 17:48:26.012]: Info: Color coding: SDR (Rec. 709)
[2025-03-01 17:48:26.012]: Info: Color depth: 10-bit
[2025-03-01 17:48:26.012]: Info: Color range: JPEG
[2025-03-01 17:48:26.018]: Info: Streaming bitrate is 1000000
[2025-03-01 17:48:26.286]: Info: 
[2025-03-01 17:48:26.286]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2025-03-01 17:48:26.286]: Info: 
[2025-03-01 17:48:26.286]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2025-03-01 17:48:26.286]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2025-03-01 17:48:26.286]: Info: Executing [Desktop]
[2025-03-01 17:48:26.347]: Info: New streaming session started [active sessions: 1]
[2025-03-01 17:48:26.423]: Info: CLIENT CONNECTED
[2025-03-01 17:48:26.592]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 17:48:26.593]: Info: Found display [wayland-0]
[2025-03-01 17:48:26.593]: Info: Found interface: zxdg_output_manager_v1(31) version 3
[2025-03-01 17:48:26.593]: Info: Found interface: wl_output(61) version 4
[2025-03-01 17:48:26.593]: Info: Found interface: wl_output(73) version 4
[2025-03-01 17:48:26.595]: Info: Resolution: 1920x1080
[2025-03-01 17:48:26.595]: Info: Resolution: 1920x1080
[2025-03-01 17:48:26.595]: Info: Offset: 1920x0
[2025-03-01 17:48:26.595]: Info: Logical size: 1920x1080
[2025-03-01 17:48:26.595]: Info: Name: DP-1
[2025-03-01 17:48:26.595]: Info: Found monitor: HKM M238W1F2556/0000000000001
[2025-03-01 17:48:26.595]: Info: Offset: 0x0
[2025-03-01 17:48:26.595]: Info: Logical size: 1920x1080
[2025-03-01 17:48:26.595]: Info: Name: HDMI-A-1
[2025-03-01 17:48:26.595]: Info: Found monitor: Samsung Electric Company HDMI-A-1-T24C310
[2025-03-01 17:48:26.595]: Info: -------- Start of KMS monitor list --------
[2025-03-01 17:48:26.595]: Info: Monitor 1 is DP-1: HKM M238W1F2556/0000000000001
[2025-03-01 17:48:26.595]: Info: Monitor 0 is HDMI-A-1: Samsung Electric Company HDMI-A-1-T24C310
[2025-03-01 17:48:26.595]: Info: --------- End of KMS monitor list ---------
[2025-03-01 17:48:26.595]: Info: Screencasting with KMS
[2025-03-01 17:48:26.595]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 17:48:26.595]: Info: Found monitor for DRM screencasting
[2025-03-01 17:48:26.595]: Info: Found connector ID [106]
[2025-03-01 17:48:26.596]: Info: Found cursor plane [66]
[2025-03-01 17:48:26.596]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 17:48:26.596]: Info: Color coding: SDR (Rec. 709)
[2025-03-01 17:48:26.596]: Info: Color depth: 8-bit
[2025-03-01 17:48:26.596]: Info: Color range: MPEG
[2025-03-01 17:48:26.653]: Info: Streaming bitrate is 27788000
[2025-03-01 17:48:26.844]: Info: Setting default sink to: [sink-sunshine-stereo]
[2025-03-01 17:48:26.845]: Info: Found default monitor by name: sink-sunshine-stereo.monitor
[2025-03-01 17:48:26.928]: Info: Opus initialized: 48 kHz, 2 channels, 512 kbps (total), LOWDELAY
[2025-03-01 17:49:37.434]: Info: CLIENT DISCONNECTED
[2025-03-01 17:49:37.435]: Info: Setting default sink to: [alsa_output.pci-0000_00_1b.0.analog-stereo]
[2025-03-01 18:01:18.334]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2025-03-01 18:01:18.334]: Info: Trying encoder [nvenc]
[2025-03-01 18:01:18.334]: Info: Screencasting with KMS
[2025-03-01 18:01:18.335]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 18:01:18.335]: Info: Found monitor for DRM screencasting
[2025-03-01 18:01:18.336]: Info: Found connector ID [106]
[2025-03-01 18:01:18.336]: Info: Found cursor plane [66]
[2025-03-01 18:01:18.336]: Info: Creating encoder [h264_nvenc]
[2025-03-01 18:01:18.336]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 18:01:18.337]: Info: Color depth: 8-bit
[2025-03-01 18:01:18.337]: Info: Color range: JPEG
[2025-03-01 18:01:18.345]: Info: Streaming bitrate is 1000000
[2025-03-01 18:01:18.639]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 18:01:18.639]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 18:01:18.639]: Info: Color depth: 8-bit
[2025-03-01 18:01:18.639]: Info: Color range: JPEG
[2025-03-01 18:01:18.644]: Info: Streaming bitrate is 1000000
[2025-03-01 18:01:18.915]: Info: Creating encoder [av1_nvenc]
[2025-03-01 18:01:18.915]: Info: Color coding: SDR (Rec. 601)
[2025-03-01 18:01:18.915]: Info: Color depth: 8-bit
[2025-03-01 18:01:18.915]: Info: Color range: JPEG
[2025-03-01 18:01:18.921]: Info: Streaming bitrate is 1000000
[2025-03-01 18:01:18.931]: Warning: [av1_nvenc @ 0x7f867c3cf080] Codec not supported
[2025-03-01 18:01:18.931]: Error: [av1_nvenc @ 0x7f867c3cf080] Provided device doesn't support required NVENC features
[2025-03-01 18:01:19.182]: Error: Could not open codec [av1_nvenc]: Função não implementada
[2025-03-01 18:01:19.184]: Info: Screencasting with KMS
[2025-03-01 18:01:19.184]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 18:01:19.184]: Info: Found monitor for DRM screencasting
[2025-03-01 18:01:19.184]: Info: Found connector ID [106]
[2025-03-01 18:01:19.185]: Info: Found cursor plane [66]
[2025-03-01 18:01:19.185]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 18:01:19.185]: Info: Color coding: SDR (Rec. 709)
[2025-03-01 18:01:19.185]: Info: Color depth: 10-bit
[2025-03-01 18:01:19.185]: Info: Color range: JPEG
[2025-03-01 18:01:19.191]: Info: Streaming bitrate is 1000000
[2025-03-01 18:01:19.464]: Info: 
[2025-03-01 18:01:19.464]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2025-03-01 18:01:19.464]: Info: 
[2025-03-01 18:01:19.464]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2025-03-01 18:01:19.464]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2025-03-01 18:01:19.464]: Info: Executing [Desktop]
[2025-03-01 18:01:19.510]: Info: New streaming session started [active sessions: 1]
[2025-03-01 18:01:19.582]: Info: CLIENT CONNECTED
[2025-03-01 18:01:19.666]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 18:01:19.666]: Info: Found display [wayland-0]
[2025-03-01 18:01:19.668]: Info: Found interface: zxdg_output_manager_v1(31) version 3
[2025-03-01 18:01:19.668]: Info: Found interface: wl_output(61) version 4
[2025-03-01 18:01:19.668]: Info: Found interface: wl_output(73) version 4
[2025-03-01 18:01:19.668]: Info: Resolution: 1920x1080
[2025-03-01 18:01:19.668]: Info: Resolution: 1920x1080
[2025-03-01 18:01:19.668]: Info: Offset: 1920x0
[2025-03-01 18:01:19.668]: Info: Logical size: 1920x1080
[2025-03-01 18:01:19.668]: Info: Name: DP-1
[2025-03-01 18:01:19.668]: Info: Found monitor: HKM M238W1F2556/0000000000001
[2025-03-01 18:01:19.668]: Info: Offset: 0x0
[2025-03-01 18:01:19.668]: Info: Logical size: 1920x1080
[2025-03-01 18:01:19.668]: Info: Name: HDMI-A-1
[2025-03-01 18:01:19.668]: Info: Found monitor: Samsung Electric Company HDMI-A-1-T24C310
[2025-03-01 18:01:19.668]: Info: -------- Start of KMS monitor list --------
[2025-03-01 18:01:19.668]: Info: Monitor 1 is DP-1: HKM M238W1F2556/0000000000001
[2025-03-01 18:01:19.668]: Info: Monitor 0 is HDMI-A-1: Samsung Electric Company HDMI-A-1-T24C310
[2025-03-01 18:01:19.668]: Info: --------- End of KMS monitor list ---------
[2025-03-01 18:01:19.668]: Info: Screencasting with KMS
[2025-03-01 18:01:19.668]: Info: /dev/dri/card0 -> nvidia-drm
[2025-03-01 18:01:19.668]: Info: Found monitor for DRM screencasting
[2025-03-01 18:01:19.668]: Info: Found connector ID [106]
[2025-03-01 18:01:19.669]: Info: Found cursor plane [66]
[2025-03-01 18:01:19.669]: Info: Creating encoder [hevc_nvenc]
[2025-03-01 18:01:19.669]: Info: Color coding: SDR (Rec. 709)
[2025-03-01 18:01:19.669]: Info: Color depth: 8-bit
[2025-03-01 18:01:19.669]: Info: Color range: MPEG
[2025-03-01 18:01:19.740]: Info: Streaming bitrate is 27788000
[2025-03-01 18:01:20.014]: Info: Setting default sink to: [sink-sunshine-stereo]
[2025-03-01 18:01:20.015]: Info: Found default monitor by name: sink-sunshine-stereo.monitor
[2025-03-01 18:01:20.071]: Info: Opus initialized: 48 kHz, 2 channels, 512 kbps (total), LOWDELAY
[2025-03-01 18:01:55.776]: Info: CLIENT DISCONNECTED
[2025-03-01 18:01:55.777]: Info: Setting default sink to: [alsa_output.pci-0000_00_1b.0.analog-stereo]

laurorual avatar Mar 01 '25 21:03 laurorual

Exactly same issue for me. Nothing helped.

Dreyk007 avatar Apr 09 '25 05:04 Dreyk007

i have 3 monitors....

chopin1998 avatar Apr 26 '25 00:04 chopin1998

Just to spread the info: I opened an issue on Apollo fork, that led me got to this codepaths:


For the touch issue, could find that:

  • MacOS abs_mouse used the screen offsets to calculate the new mouse position
  • Windows abs_mouse also used touch_port.offset_{x,y} to calculate the final values;
  • but Linux move_abs ignores that. And more, Linux get_location always returns {0,0}, which is clearly a barebones fix.

However, I would need to dig more to understand if this changes anything on screen touches. Do you have some knowledge about that codepath for touch inputs, even within Windows? I mean, abs_mouse is used during touch event handling?


If you have some knowledge on what can/should be changed on the Linux handling, I am willing to create a patch PT here (and there on Apollo too)

alanjds avatar May 09 '25 20:05 alanjds

@alanjds a PR would be much appreciated if you come up with a solution.

This thread may be of interest: https://github.com/games-on-whales/inputtino/issues/6

ReenigneArcher avatar May 09 '25 21:05 ReenigneArcher

I had dug some options to get 1) the current mouse position 2) the current screen layout.

Seems that SDL is a nice way to get those.

Do any or you (@ReenigneArcher or @Hazer maybe?) know if SDL is already being included in Sunshine builds, at least for Linux? Asking because a search via Github showed some logs containing SDL but no code imports.

(and thanks @ReenigneArcher for the GOW link. Was very enlightening 👍)

alanjds avatar May 14 '25 19:05 alanjds

@alanjds We're not currently using SDL, only inputtino on Linux. I'm not against using SDL though.

ReenigneArcher avatar May 14 '25 19:05 ReenigneArcher

I am having the same issue on Linux. It isn't just touch, it is also stylus inputs that goes to the wrong monitor. I was wondering is this still an active open issue?

schillem avatar Jun 20 '25 21:06 schillem

I am having the same issue on Linux. It isn't just touch, it is also stylus inputs that goes to the wrong monitor. I was wondering is this still an active open issue?

It is. Right now the Linux input does not currently accounts for the multiple monitor offsets, always starting on (0,0) iiuc. So, it depends on you personal config to be "lucky" that your main monitor aligns with the input plane.

Yes, it is a bug in the sense of "never handled feature".

The easiest fix I found depends on SDL, yet I had no bandwidth to investigate how to add SDL to the Linux build deps.

alanjds avatar Jun 21 '25 00:06 alanjds

Same issues. I have a solution tho but I'm not happy with it. In display settings (not in sunshine) I can move the monitor that should get the touch input to the top and that should fix it (at least for me) but moving your windows between monitors is going to be a pain.

I hope there will be a better solution tho. Also I'm new to Linux and I'm using Steam OS so I'm not sure if this also works on Bazzite.

iam-best avatar Jul 15 '25 21:07 iam-best

I noticed this issue too when I temporarily added my Android tablet (with stylus) as second screen (using a dummy dongle) to my Linux laptop. The pen's input went to the primary display instead of the dummy/virtual. There seems to be some offset that is missing.

(This issue might be of interest to @ABeltramo.)

gschintgen avatar Jul 20 '25 20:07 gschintgen

I think there are two separate issues here: 1- The pen input goes to the "main monitor" and not the one currently streaming 2- We don't account for monitor offsets in Linux

I'm not sure these two are actually the same, what we currently do is practically plugging a new virtual pen device. Would a USB device know which monitors it should output no? Probably not, right? That should be the job of the Desktop Environment/Compositor, hence why

In display settings (not in sunshine) I can move the monitor that should get the touch input to the top and that should fix it (at least for me)

this works.

As for using the monitor offset, I guess the result of that would be to just "move" the pen to a monitor, right?
It feels a bit of a hack (and I wonder if it'll cause any issue) but if it's used both on OSX and Windows I guess that actually works?

SDL is kind of a beast of a library to pull just for that, it would be better to get the display configuration directly by implementing the required Xorg and Wayland protocols. I'm not too familiar with that code, but we probably already have what's required here and here

ABeltramo avatar Jul 21 '25 07:07 ABeltramo

Same problem on CachyOS v2025.628.4510-3, behavior is exactly like the video clip in #2166

Kaizo107 avatar Aug 19 '25 05:08 Kaizo107

On wayland mapping is up to the compositor, I don't think there is a single way to fix this outside of being compositor aware. for instance on cosmic comp it's set in $HOME/.config/cosmic/com.system76.CosmicComp/v1/input_devices

"Device": (
    state: Enabled,
    map_to_output: Some("DP-1"),
    acceleration: Some((
        profile: Some(Flat),
        speed: 1.0,
    )),
    )

Sway needs

input "DEVICE" {
    drag enable
    drag_lock enable
    map_to_output eDP-1
}

so on and so forth. Perhaps the docs could have a list of known configurations, but in the current state of wayland I don't think it's possible to solve this.

Quackdoc avatar Aug 26 '25 21:08 Quackdoc

i wonder if there is possible workaround for this on KDE plasma and Gnome as it is the most used DE for newcomers that may start to migrate from windows?

Fuwachiro avatar Oct 26 '25 05:10 Fuwachiro

@Fuwachiro if you don't mind compiling from source - you can patch out coordinate transformations done by sunshine and let compositor do it as it is supposed to be. I did this obviously dirty and non-portable patch https://gist.github.com/rkolbaskin/d9a2d5c024216b3012f506ade0d53030 some time back and it seems to be working fine on KDE.

Keep in mind that KDE currently has a bug that prevents you from changing what monitor the input is mapped to.

rkolbaskin avatar Oct 27 '25 05:10 rkolbaskin

@Fuwachiro if you don't mind compiling from source - you can patch out coordinate transformations done by sunshine and let compositor do it as it is supposed to be. I did this obviously dirty and non-portable patch https://gist.github.com/rkolbaskin/d9a2d5c024216b3012f506ade0d53030 some time back and it seems to be working fine on KDE.

Keep in mind that KDE currently has a bug that prevents you from changing what monitor the input is mapped to.

I just wanted to let you know, this fix worked perfectly for me. I just had to launch moonlight in desktop mode when connecting my steam deck to my pc since for some reason it wouldnt work in gaming mode.

2Epik4u avatar Nov 01 '25 17:11 2Epik4u

@Fuwachiro if you don't mind compiling from source - you can patch out coordinate transformations done by sunshine and let compositor do it as it is supposed to be. I did this obviously dirty and non-portable patch https://gist.github.com/rkolbaskin/d9a2d5c024216b3012f506ade0d53030 some time back and it seems to be working fine on KDE.

Keep in mind that KDE currently has a bug that prevents you from changing what monitor the input is mapped to.

uh.. it is my 1st time compiling from source, where should i put that .patch? sorry for this strangely obvious questions. kinda eager to let go Windows Shackles tbh so im fine doing dirty work.

Fuwachiro avatar Nov 09 '25 13:11 Fuwachiro

When you clone the repository, do git apply patchfile

2Epik4u avatar Nov 09 '25 16:11 2Epik4u