Skip to content

MonitorHandle::position and MonitorHandle::size metrics are unclear  #2645

@madsmtm

Description

@madsmtm

Window::outer_position, MonitorHandle::position and WindowEvent::Moved is fundamentally broken on macOS.

Desktop/window coordinates are internally closer to a LogicalPosition, but since the return type of these is PhysicalPosition, we convert the position using the monitor's scale factor, which is incorrect since it assumes that all monitors have that scale factor.

To illustrate the issue, imagine three monitors configured to be next to each other like this:

[                   ]    [                  ]    [                   ]
[         1         ]    [         2        ]    [         3         ]
[ logical=1920x1080 ]    [ logical=1280x800 ]    [ logical=2560x1440 ]
[  scale_factor=2   ]    [  scale_factor=1  ]    [  scale_factor=1   ]
[                   ]    [                  ]    [                   ]

The output of monitor.position().x (that is, the x desktop/window-coordinate) would then be:

Desired physical Desired logical macOS API Other platforms
Monitor 1 0 0 0 0
Monitor 2 1920 * 2 1920 1920 1920 * 2 maybe?
Monitor 3 1920 * 2 + 1280 1920 + 1280 1920 + 1280 1920 * 2 + 1280 maybe?

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedS - apiDesign and usability

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions