[gjs/ewlsh/gtk4-a11y: 2/2] overrides: Override Gtk.Accessible update_relation




commit 1ec92ff0441cd22a51835c230ed81457045ed793
Author: Evan Welsh <contact evanwelsh com>
Date:   Thu Aug 26 21:36:05 2021 -0700

    overrides: Override Gtk.Accessible update_relation
    
    Fixes #392

 modules/core/overrides/Gtk.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/modules/core/overrides/Gtk.js b/modules/core/overrides/Gtk.js
index 3dd2904c..6512b957 100644
--- a/modules/core/overrides/Gtk.js
+++ b/modules/core/overrides/Gtk.js
@@ -137,6 +137,26 @@ function _init() {
             }
             return Gi.build_object_list(values);
         };
+
+        const _update_relation = Gtk.Accessible.prototype.update_relation;
+
+        Gtk.Accessible.prototype.update_relation = function update_relation(relations, values) {
+            const mappedValues = values.map((value, i) => {
+                const relation = relations[i];
+                if (relation === Gtk.AccessibleRelation.LABELLED_BY) {
+                    if (value instanceof GObject.Value)
+                        return value;
+
+
+                    const list = Gtk.AccessibleRelationList(value);
+                    return list;
+                }
+
+                return value;
+            });
+
+            _update_relation.call(this, relations, mappedValues);
+        };
     }
 }
 


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