[mutter] virtual-monitor: Never reuse mode IDs



commit a97b6560d722b6553413be53086373b8e7864f19
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Dec 1 23:25:06 2021 +0100

    virtual-monitor: Never reuse mode IDs
    
    We'll change mode's on-demand so using IDs identical to the virtual
    monitor ID would mean IDs didn't change when changing mode, and that is
    rather unintuitive. IDs don't mean much anyhow, just make them grow
    within the realm of a 63 bit unsigned integer, as the 64th bit means its
    a virtual mode ID. Making sure the ID is in the virtual mode namespace
    is handled by meta_crtc_mode_virtual_new().
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2270>

 src/backends/native/meta-virtual-monitor-native.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/native/meta-virtual-monitor-native.c 
b/src/backends/native/meta-virtual-monitor-native.c
index 5f698c79a8..93d351237f 100644
--- a/src/backends/native/meta-virtual-monitor-native.c
+++ b/src/backends/native/meta-virtual-monitor-native.c
@@ -33,6 +33,8 @@ struct _MetaVirtualMonitorNative
   uint64_t id;
 };
 
+static uint64_t mode_id = 1;
+
 G_DEFINE_TYPE (MetaVirtualMonitorNative, meta_virtual_monitor_native,
                META_TYPE_VIRTUAL_MONITOR)
 
@@ -52,7 +54,7 @@ meta_virtual_monitor_native_new (uint64_t                      id,
   MetaOutputVirtual *output_virtual;
 
   crtc_virtual = meta_crtc_virtual_new (id);
-  crtc_mode_virtual = meta_crtc_mode_virtual_new (id, &info->mode_info);
+  crtc_mode_virtual = meta_crtc_mode_virtual_new (mode_id++, &info->mode_info);
   output_virtual = meta_output_virtual_new (id, info,
                                             crtc_virtual,
                                             crtc_mode_virtual);


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