[gnome-control-center/gnome-3-30] display: Hide unsupported resolutions again
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-30] display: Hide unsupported resolutions again
- Date: Thu, 18 Oct 2018 15:42:18 +0000 (UTC)
commit db122c58fb891be0108d183206ca61286e7e14ee
Author: Daniel Drake <drake endlessm com>
Date: Mon Oct 8 17:33:46 2018 +0800
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 c0f686bb0f357752f8ea112b866dadfe5ce0db03
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.
panels/display/cc-display-panel.c | 33 +++++++++++++++++++++++++++++++--
1 file changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index c96086756..543c4628f 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -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
@@ -601,13 +605,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);
}
@@ -628,6 +649,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));
row = g_object_new (CC_TYPE_LIST_BOX_ROW,
@@ -769,7 +794,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;
@@ -860,8 +885,12 @@ setup_scale_buttons (GtkWidget *bbox,
group = NULL;
for (scale = scales, i = 0; *scale != 0.0 && i < MAX_N_SCALES; scale++, i++)
{
- GtkWidget *button = gtk_radio_button_new_from_widget (group);
+ GtkWidget *button;
+
+ if (!display_mode_supported_at_scale (mode, *scale))
+ continue;
+ button = gtk_radio_button_new_from_widget (group);
gtk_button_set_image (GTK_BUTTON (button), make_label_for_scale (*scale));
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button), FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]