[gnome-control-center/benzea/only-show-appliable-scales: 4/6] display: Use the new API to determine whether a scale is valid
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/benzea/only-show-appliable-scales: 4/6] display: Use the new API to determine whether a scale is valid
- Date: Fri, 22 Feb 2019 15:11:23 +0000 (UTC)
commit 07b09421c7f30f03ec6084c77c4ebb4f2705ba0a
Author: Benjamin Berg <bberg redhat com>
Date: Fri Feb 22 15:44:18 2019 +0100
display: Use the new API to determine whether a scale is valid
panels/display/cc-display-panel.c | 1 +
panels/display/cc-display-settings.c | 20 ++++----------------
2 files changed, 5 insertions(+), 16 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index bb574c5c9..f030dc44b 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -810,6 +810,7 @@ reset_current_config (CcDisplayPanel *panel)
panel->current_output = NULL;
current = cc_display_config_manager_get_current (panel->manager);
+ cc_display_config_set_minimum_size (current, MINIMUM_WIDTH, MINIMUM_HEIGHT);
panel->current_config = current;
g_list_store_remove_all (panel->primary_display_list);
diff --git a/panels/display/cc-display-settings.c b/panels/display/cc-display-settings.c
index d3ed4a956..f658eb06f 100644
--- a/panels/display/cc-display-settings.c
+++ b/panels/display/cc-display-settings.c
@@ -28,10 +28,6 @@
#include "cc-display-config.h"
#include "cc-value-object.h"
-/* The minimum supported size a monitor may have */
-#define MINIMUM_WIDTH 740
-#define MINIMUM_HEIGHT 530
-
#define MAX_SCALE_BUTTONS 5
struct _CcDisplaySettings
@@ -192,16 +188,6 @@ get_frequency_string (CcDisplayMode *mode)
return g_strdup_printf (_("%.2lf Hz"), cc_display_mode_get_freq_f (mode));
}
-static gboolean
-display_mode_supported_at_scale (CcDisplayMode *mode, double scale)
-{
- int width, height;
-
- cc_display_mode_get_resolution (mode, &width, &height);
-
- return round (width / scale) >= MINIMUM_WIDTH && round (height / scale) >= MINIMUM_HEIGHT;
-}
-
static double
round_scale_for_ui (double scale)
{
@@ -363,7 +349,7 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
CcDisplayMode *mode = CC_DISPLAY_MODE (item->data);
/* Exclude unusable low resolutions */
- if (!display_mode_supported_at_scale (mode, 1.0))
+ if (!cc_display_config_is_scaled_mode_valid (self->config, mode, 1.0))
continue;
cc_display_mode_get_resolution (mode, &w, &h);
@@ -408,7 +394,9 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
g_autofree gchar *scale_str = NULL;
GtkWidget *scale_btn;
- if (!display_mode_supported_at_scale (current_mode, *scale) &&
+ if (!cc_display_config_is_scaled_mode_valid (self->config,
+ cc_display_monitor_get_mode (self->selected_output),
+ *scale) &&
cc_display_monitor_get_scale (self->selected_output) != *scale)
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]