mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
monitor-manager: Filter out low screen resolutions
Avoid exporting through org.gnome.Mutter.DisplayConfig.GetCurrentState excessively-low screen resolutions setting both a minimum width and a minimum height. GetCurrentState is e.g. used by Gnome Control Center to build a list of selectable resolutions. Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=793223
This commit is contained in:
parent
48eaa36d41
commit
649c26e05a
@ -1302,9 +1302,13 @@ meta_monitor_manager_handle_get_current_state (MetaDBusDisplayConfig *skeleton,
|
|||||||
GVariantBuilder mode_properties_builder;
|
GVariantBuilder mode_properties_builder;
|
||||||
MetaCrtcModeFlag mode_flags;
|
MetaCrtcModeFlag mode_flags;
|
||||||
|
|
||||||
|
if (!meta_monitor_mode_should_be_advertised (monitor_mode))
|
||||||
|
continue;
|
||||||
|
|
||||||
mode_id = meta_monitor_mode_get_id (monitor_mode);
|
mode_id = meta_monitor_mode_get_id (monitor_mode);
|
||||||
meta_monitor_mode_get_resolution (monitor_mode,
|
meta_monitor_mode_get_resolution (monitor_mode,
|
||||||
&mode_width, &mode_height);
|
&mode_width, &mode_height);
|
||||||
|
|
||||||
refresh_rate = meta_monitor_mode_get_refresh_rate (monitor_mode);
|
refresh_rate = meta_monitor_mode_get_refresh_rate (monitor_mode);
|
||||||
|
|
||||||
preferred_scale =
|
preferred_scale =
|
||||||
|
@ -1553,6 +1553,22 @@ meta_monitor_calculate_mode_scale (MetaMonitor *monitor,
|
|||||||
return calculate_scale (monitor, monitor_mode);
|
return calculate_scale (monitor, monitor_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
is_logical_size_large_enough (gint width, gint height)
|
||||||
|
{
|
||||||
|
return width >= MINIMUM_LOGICAL_WIDTH &&
|
||||||
|
height >= MINIMUM_LOGICAL_HEIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (monitor_mode != NULL, FALSE);
|
||||||
|
|
||||||
|
return is_logical_size_large_enough (monitor_mode->spec.width,
|
||||||
|
monitor_mode->spec.height);
|
||||||
|
}
|
||||||
|
|
||||||
static float
|
static float
|
||||||
get_closest_scale_factor_for_resolution (float width,
|
get_closest_scale_factor_for_resolution (float width,
|
||||||
float height,
|
float height,
|
||||||
@ -1573,8 +1589,7 @@ get_closest_scale_factor_for_resolution (float width,
|
|||||||
|
|
||||||
if (scale < MINIMUM_SCALE_FACTOR ||
|
if (scale < MINIMUM_SCALE_FACTOR ||
|
||||||
scale > MAXIMUM_SCALE_FACTOR ||
|
scale > MAXIMUM_SCALE_FACTOR ||
|
||||||
floorf (scaled_w) < MINIMUM_LOGICAL_WIDTH ||
|
!is_logical_size_large_enough (floorf (scaled_w), floorf (scaled_h)))
|
||||||
floorf (scaled_h) < MINIMUM_LOGICAL_HEIGHT)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h)
|
if (floorf (scaled_w) == scaled_w && floorf (scaled_h) == scaled_h)
|
||||||
|
@ -219,6 +219,8 @@ gboolean meta_monitor_mode_foreach_output (MetaMonitor *monitor,
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
gboolean meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode);
|
||||||
|
|
||||||
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
||||||
|
|
||||||
gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
|
gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user