[mutter] kms: Return a more specific change if there are no devices



commit 49501c28f27bd8864839cad91b7f9e89c0c48103
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sun Mar 21 22:30:06 2021 +0100

    kms: Return a more specific change if there are no devices
    
    In case we have no devices, after a KMS update (both because they've
    all have been removed or because there were none), we may need to behave
    differently compared to the case in which nothing changed, so add a more
    specific KMS update change type
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1964>

 src/backends/native/meta-kms-types.h | 1 +
 src/backends/native/meta-kms.c       | 3 +++
 2 files changed, 4 insertions(+)
---
diff --git a/src/backends/native/meta-kms-types.h b/src/backends/native/meta-kms-types.h
index 64045ef457..5e9a4b3e7e 100644
--- a/src/backends/native/meta-kms-types.h
+++ b/src/backends/native/meta-kms-types.h
@@ -68,6 +68,7 @@ typedef enum _MetaKmsUpdateChanges
 {
   META_KMS_UPDATE_CHANGE_NONE = 0,
   META_KMS_UPDATE_CHANGE_GAMMA = 1 << 0,
+  META_KMS_UPDATE_CHANGE_NO_DEVICES = 1 << 1,
   META_KMS_UPDATE_CHANGE_FULL = -1,
 } MetaKmsUpdateChanges;
 
diff --git a/src/backends/native/meta-kms.c b/src/backends/native/meta-kms.c
index 6676db3e75..e66966f84b 100644
--- a/src/backends/native/meta-kms.c
+++ b/src/backends/native/meta-kms.c
@@ -576,6 +576,9 @@ meta_kms_update_states_in_impl (MetaKms  *kms)
 
   meta_assert_in_kms_impl (kms);
 
+  if (!kms->devices)
+    return META_KMS_UPDATE_CHANGE_NO_DEVICES;
+
   for (l = kms->devices; l; l = l->next)
     {
       MetaKmsDevice *kms_device = META_KMS_DEVICE (l->data);


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