[mutter] monitor: Always advertise modes similar to the preferred mode



commit 05217066171992b0bc50882869aad6385285c878
Author: Jonas Ådahl <jadahl gmail com>
Date:   Mon Aug 12 10:54:18 2019 +0200

    monitor: Always advertise modes similar to the preferred mode
    
    Even if the preferred mode ends up being too small according to the area
    size filter, it should still be advertised as it's still preferred.
    
    Fixes: https://gitlab.gnome.org/GNOME/mutter/issues/725
    
    https://gitlab.gnome.org/GNOME/mutter/merge_requests/722

 src/backends/meta-monitor.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index a6a57c6d5..2b0aa5ac6 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -39,6 +39,7 @@
 
 typedef struct _MetaMonitorMode
 {
+  MetaMonitor *monitor;
   char *id;
   MetaMonitorModeSpec spec;
   MetaMonitorCrtcMode *crtc_modes;
@@ -609,6 +610,7 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
       gboolean replace;
 
       mode = g_new0 (MetaMonitorMode, 1);
+      mode->monitor = monitor;
       mode->spec = meta_monitor_create_spec (monitor,
                                              crtc_mode->width,
                                              crtc_mode->height,
@@ -948,7 +950,7 @@ create_tiled_monitor_mode (MetaMonitorTiled *monitor_tiled,
   mode = g_new0 (MetaMonitorModeTiled, 1);
   mode->is_tiled = TRUE;
   meta_monitor_tiled_calculate_tiled_size (monitor, &width, &height);
-
+  mode->parent.monitor = monitor;
   mode->parent.spec =
     meta_monitor_create_spec (monitor, width, height, reference_crtc_mode);
   mode->parent.id = generate_mode_id (&mode->parent.spec);
@@ -1058,8 +1060,8 @@ create_untiled_monitor_mode (MetaMonitorTiled *monitor_tiled,
     return NULL;
 
   mode = g_new0 (MetaMonitorModeTiled, 1);
-
   mode->is_tiled = FALSE;
+  mode->parent.monitor = monitor;
   mode->parent.spec = meta_monitor_create_spec (monitor,
                                                 crtc_mode->width,
                                                 crtc_mode->height,
@@ -1666,8 +1668,15 @@ is_logical_size_large_enough (int width,
 gboolean
 meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode)
 {
+  MetaMonitorMode *preferred_mode;
+
   g_return_val_if_fail (monitor_mode != NULL, FALSE);
 
+  preferred_mode = meta_monitor_get_preferred_mode (monitor_mode->monitor);
+  if (monitor_mode->spec.width == preferred_mode->spec.width &&
+      monitor_mode->spec.height == preferred_mode->spec.height)
+    return TRUE;
+
   return is_logical_size_large_enough (monitor_mode->spec.width,
                                        monitor_mode->spec.height);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]