mirror of
https://github.com/brl/mutter.git
synced 2025-08-04 15:45:54 +00:00
Add support for rudimentary fractional scaling
When the logical layout mode is used, allow configuring the scaling to be non-integer. Supported scales are so far hard coded to include at most 1, 1.5 and 2, and scales that doesn't result in non-fractional logical monitor sizes are discarded. Wayland outputs are set to have scale ceil(actual_scale) meaning well behaving Wayland clients will provide buffers with buffer scale 2, thus being scaled down to the fractional scale. https://bugzilla.gnome.org/show_bug.cgi?id=765011
This commit is contained in:
@@ -111,6 +111,15 @@ calculate_suitable_subpixel_order (MetaLogicalMonitor *logical_monitor)
|
||||
return cogl_subpixel_order_to_wl_output_subpixel (subpixel_order);
|
||||
}
|
||||
|
||||
static int
|
||||
calculate_wayland_output_scale (MetaLogicalMonitor *logical_monitor)
|
||||
{
|
||||
float scale;
|
||||
|
||||
scale = meta_logical_monitor_get_scale (logical_monitor);
|
||||
return ceilf (scale);
|
||||
}
|
||||
|
||||
static void
|
||||
send_output_events (struct wl_resource *resource,
|
||||
MetaWaylandOutput *wayland_output,
|
||||
@@ -205,7 +214,7 @@ send_output_events (struct wl_resource *resource,
|
||||
{
|
||||
int scale;
|
||||
|
||||
scale = (int) meta_logical_monitor_get_scale (logical_monitor);
|
||||
scale = calculate_wayland_output_scale (logical_monitor);
|
||||
if (need_all_events ||
|
||||
old_scale != scale)
|
||||
{
|
||||
@@ -273,7 +282,7 @@ meta_wayland_output_set_logical_monitor (MetaWaylandOutput *wayland_output,
|
||||
|
||||
if (current_mode == preferred_mode)
|
||||
wayland_output->mode_flags |= WL_OUTPUT_MODE_PREFERRED;
|
||||
wayland_output->scale = (int) meta_logical_monitor_get_scale (logical_monitor);
|
||||
wayland_output->scale = calculate_wayland_output_scale (logical_monitor);
|
||||
wayland_output->refresh_rate = meta_monitor_mode_get_refresh_rate (current_mode);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user