[gnome-flashback] monitor-manager-xrandr: disable CRTCs if there is no monitor



commit 439f3ebaaa0e685a169daa7312defa33d63cdeb4
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Aug 12 17:15:42 2022 +0300

    monitor-manager-xrandr: disable CRTCs if there is no monitor
    
    Based on mutter commit:
    https://gitlab.gnome.org/GNOME/mutter/-/commit/ed87937faf4a327bb2

 backends/gf-monitor-manager-xrandr.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/backends/gf-monitor-manager-xrandr.c b/backends/gf-monitor-manager-xrandr.c
index 846aa05..178d48b 100644
--- a/backends/gf-monitor-manager-xrandr.c
+++ b/backends/gf-monitor-manager-xrandr.c
@@ -376,6 +376,9 @@ apply_crtc_assignments (GfMonitorManager    *manager,
       gf_crtc_unset_config (crtc);
     }
 
+  if (n_crtcs == 0)
+    goto out;
+
   g_assert (width > 0 && height > 0);
   /* The 'physical size' of an X screen is meaningless if that screen
    * can consist of many monitors. So just pick a size that make the
@@ -477,6 +480,7 @@ apply_crtc_assignments (GfMonitorManager    *manager,
       gf_output_unassign_crtc (output);
     }
 
+out:
   XUngrabServer (xrandr->xdisplay);
   XFlush (xrandr->xdisplay);
 
@@ -721,6 +725,9 @@ gf_monitor_manager_xrandr_apply_monitors_config (GfMonitorManager        *manage
 
   if (!config)
     {
+      if (!manager->in_init)
+        apply_crtc_assignments (manager, TRUE, NULL, 0, NULL, 0);
+
       gf_monitor_manager_rebuild_derived (manager, NULL);
       return TRUE;
     }


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