wired-notify icon indicating copy to clipboard operation
wired-notify copied to clipboard

Bug: location calculation is wrong when working on multi-monitor setup with different resolutions

Open zjeffer opened this issue 1 year ago • 6 comments

My setup:

    +--------------------------+     +---------------------------+     +--------------------------+
    |      Monitor DP-2        |     |       Monitor eDP-1       |     |      Monitor HDMI-A-1    |
    |         (ID 1)           |     |          (ID 3)           |     |         (ID 2)           |
    |  Resolution: 1920x1080   |     |   Resolution: 2560x1600   |     |   Resolution: 1920x1080  |
    |  Position: 0x0           |     |   Position: 1920x0        |     |   Position: 4480x0       |
    +--------------------------+     +---------------------------+     +--------------------------+

My middle (laptop) monitor has a higher resolution (2560x1600) than the other 2 (1920x1080). My notification's offset is Vec2(x: -20, y: 60).

When I create a notification on the middle monitor, it will be created somewhere near the middle, as if the monitor has a resolution of 1920x1080:

image

This is how it looks like on other monitors:

image

zjeffer avatar Oct 25 '24 21:10 zjeffer

Hmm, this is unusual. There's not much logic that goes into getting the monitor position from my side, we pretty much just grab it straight from winit. I wonder if DPI scaling is causing trouble?

Can you try running with WINIT_X11_SCALE_FACTOR=1.0 and see if you observe the same behaviour? From what I can tell and from how we get positions/sizes, it should make no difference.

$ env WINIT_X11_SCALE_FACTOR=1.0 wired

Toqozz avatar Mar 30 '25 03:03 Toqozz

I stopped using wired a long time ago so I don't know if it still happens, but the issue happened with DPI scaling already set to 1 on all monitors.

I'll try reproducing it soon when I have some more time.

zjeffer avatar Mar 30 '25 17:03 zjeffer

Just tested it again on latest git, the problem still happens.

I used the default config with the following changes:

            hook: Hook(parent_anchor: TR, self_anchor: TR),
            offset: Vec2(x: 0.0, y: 60.0),

in the layout1 root object.

zjeffer avatar Apr 04 '25 20:04 zjeffer

The problem disappears if I disconnect my lower-resolution monitor: starting wired after that and sending a notification puts it on the expected location.

zjeffer avatar Apr 04 '25 20:04 zjeffer

I couldn't reproduce this. My monitor layout is pretty weird as well, so I'd expect to see the same issue:

DP-0 connected primary 3440x1440+1440+749 (normal left inverted right x axis y axis) 810mm x 350mm
   3440x1440     59.97 + 174.96*  143.97   119.99    99.98
   1024x768      60.00
   800x600       60.32
   640x480       59.94
DP-4 connected 1440x2560+0+0 left (normal left inverted right x axis y axis) 598mm x 336mm
   2560x1440     59.95*+ 165.00   144.00   120.00    99.95    84.98    23.97
   1024x768      60.00
   800x600       60.32
   640x480       59.94

Are you using X or wayland? Could you send me your config? Do all your monitors have the same DPI scaling factor? (And is the result the same with WINIT_X11_SCALE_FACTOR=1.0?)

Toqozz avatar Oct 05 '25 02:10 Toqozz

I'm using Hyprland, here's my full config: https://github.com/zjeffer/dotfiles

All my monitors have the same DPI factor, and the result is the same with WINIT_X11_SCALE_FACTOR=1.0

zjeffer avatar Oct 05 '25 09:10 zjeffer