Skip to content

window: Fall back to main window monitor for highest scale monitor

MetaWindow always tries to have a main monitor: If the frame rect is empty and the window has not been positioned, in meta_window_constructed() we fall back to asking the backend for the current monitor, and in meta_window_wayland_update_main_monitor() we fall back to meta_window_find_monitor_from_id(), which then falls back to the primary monitor.

In general this means that window->monitor is always set as long as there is a monitor around.

For getting the highest-scale-monitor the window is on, we currently rely completely on the frame rect. If the frame rect is empty, we set the highest-scale-monitor to NULL. Since we usually know though which monitor the window is, or will be on, and window->monitor is even set to that, we can just fall back to window->monitor for the highest-scale-monitor.

This makes sure ::highest-scale-monitor-changed is emitted right after the window is created, and it's set to the correct monitor that the window will be on. This in turn means that we can send a correct wp_fractional_scale fraction_scale event to clients right away.

#3262 (closed)

Merge request reports