display: Hide unsupported resolutions again
Previously, low resolutions were hidden from the control center
because when such display modes are activated, GNOME is unusable;
many important UI elements do not fit on the screen at all.
https://bugzilla.gnome.org/show_bug.cgi?id=626822
This was removed in c0f686bb0f
without explanation; reinstate it here.
Also prevent the scaling from being selected or activated if the
effective scaled resolution would result in an equivalently low
resolution being used.
This commit is contained in:
parent
f95ded101c
commit
79dc78b819
1 changed files with 29 additions and 1 deletions
|
@ -36,6 +36,10 @@
|
|||
#include "cc-night-light-dialog.h"
|
||||
#include "cc-display-resources.h"
|
||||
|
||||
/* The minimum supported size for the panel */
|
||||
#define MINIMUM_WIDTH 740
|
||||
#define MINIMUM_HEIGHT 530
|
||||
|
||||
#define PANEL_PADDING 32
|
||||
#define SECTION_PADDING 32
|
||||
#define HEADING_PADDING 12
|
||||
|
@ -619,13 +623,30 @@ make_orientation_row (CcDisplayPanel *panel, CcDisplayMonitor *output)
|
|||
return row;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
display_mode_supported_at_scale (CcDisplayMode *mode, double scale)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
cc_display_mode_get_resolution (mode, &width, &height);
|
||||
|
||||
return width / scale >= MINIMUM_WIDTH && height / scale >= MINIMUM_HEIGHT;
|
||||
}
|
||||
|
||||
static void
|
||||
resolution_row_activated (CcDisplayPanel *panel,
|
||||
GtkListBoxRow *row)
|
||||
{
|
||||
CcDisplayMode *mode = g_object_get_data (G_OBJECT (row), "mode");
|
||||
double scale = cc_display_monitor_get_scale (panel->current_output);
|
||||
|
||||
cc_display_monitor_set_mode (panel->current_output, mode);
|
||||
|
||||
/* Restore 1.0 scaling if the previous scale is not supported at the
|
||||
* new resolution. */
|
||||
if (!display_mode_supported_at_scale (mode, scale))
|
||||
cc_display_monitor_set_scale (panel->current_output, 1.0);
|
||||
|
||||
update_apply_button (panel);
|
||||
}
|
||||
|
||||
|
@ -647,6 +668,10 @@ make_resolution_popover (CcDisplayPanel *panel)
|
|||
GtkWidget *row;
|
||||
GtkWidget *child;
|
||||
|
||||
/* Exclude unusable low resolutions */
|
||||
if (!display_mode_supported_at_scale (mode, 1.0))
|
||||
continue;
|
||||
|
||||
child = make_popover_label (get_resolution_string (mode));
|
||||
gtk_widget_show (child);
|
||||
|
||||
|
@ -797,7 +822,7 @@ n_supported_scales (CcDisplayMode *mode)
|
|||
const double *scales = cc_display_mode_get_supported_scales (mode);
|
||||
guint n = 0;
|
||||
|
||||
while (scales[n] != 0.0)
|
||||
while (scales[n] != 0.0 && display_mode_supported_at_scale (mode, scales[n]))
|
||||
n++;
|
||||
|
||||
return n;
|
||||
|
@ -890,6 +915,9 @@ setup_scale_buttons (GtkWidget *bbox,
|
|||
{
|
||||
GtkWidget *button, *label;
|
||||
|
||||
if (!display_mode_supported_at_scale (mode, *scale))
|
||||
continue;
|
||||
|
||||
button = gtk_radio_button_new_from_widget (group);
|
||||
gtk_widget_show (button);
|
||||
label = make_label_for_scale (*scale);
|
||||
|
|
Loading…
Add table
Reference in a new issue