Skip to content

Improve Workspace::outputAt()

Vlad Zahorodnii requested to merge work/zzag/improve-workspace-output-at into master

Workspace::outputAt() casts vectors to four rectangle corners and uses the shortest one to decide which output is the closest to the given point.

This works poorly on dual monitor setups where on the left side you have a monitor with landscape orientation and one with portrait orientation on the right hand side. In that case, outputAt() will prefer the left monitor even though the right monitor is the closest one if you cast a perpendicular from the given point to the right monitor.

In order to improve the handling of that case, this change makes Workspace::outputAt() compute the closest point to the output geometry rectangle and use the squared distance as the score.

Merge request reports