display: Fix the resolution going to be tested

Gnome-control-center checks the display modes by
cc_display_config_is_scaled_mode_valid()
  ...
  cc_display_config_dbus_is_scaled_mode_valid()
to exclude unusable low resolutions.

However, it is the current using resolution that going to be tested by
is_scaled_mode_allowed() in is_scale_allowed_by_active_monitors(), if it
is global scaled required or configured as cloning mode originally.
Therefor, it will check current using resolution again and again,
instead of the enumerated one. This leads gnome-control-center building
wrong resolution list on the panel.

This patch replaces the current mode with the enumerated mode to have
the correct resolution to be tested by is_scaled_mode_allowed().

Fixes #903
This commit is contained in:
Jian-Hong Pan 2020-03-10 16:39:35 +08:00
parent bb794a444b
commit 00081c434c

View file

@ -1227,6 +1227,7 @@ is_scaled_mode_allowed (CcDisplayConfigDBus *self,
static gboolean static gboolean
is_scale_allowed_by_active_monitors (CcDisplayConfigDBus *self, is_scale_allowed_by_active_monitors (CcDisplayConfigDBus *self,
CcDisplayMode *mode,
double scale) double scale)
{ {
GList *l; GList *l;
@ -1238,7 +1239,7 @@ is_scale_allowed_by_active_monitors (CcDisplayConfigDBus *self,
if (!cc_display_monitor_is_active (CC_DISPLAY_MONITOR (m))) if (!cc_display_monitor_is_active (CC_DISPLAY_MONITOR (m)))
continue; continue;
if (!is_scaled_mode_allowed (self, m->current_mode, scale)) if (!is_scaled_mode_allowed (self, mode, scale))
return FALSE; return FALSE;
} }
@ -1266,7 +1267,7 @@ cc_display_config_dbus_is_scaled_mode_valid (CcDisplayConfig *pself,
CcDisplayConfigDBus *self = CC_DISPLAY_CONFIG_DBUS (pself); CcDisplayConfigDBus *self = CC_DISPLAY_CONFIG_DBUS (pself);
if (self->global_scale_required || cc_display_config_is_cloning (pself)) if (self->global_scale_required || cc_display_config_is_cloning (pself))
return is_scale_allowed_by_active_monitors (self, scale); return is_scale_allowed_by_active_monitors (self, mode, scale);
return is_scaled_mode_allowed (self, mode, scale); return is_scaled_mode_allowed (self, mode, scale);
} }