From ffe4adfec25951e4bb18388abb51c5b2bd396497 Mon Sep 17 00:00:00 2001 From: Andy Myers Date: Tue, 10 Sep 2024 16:53:12 -0400 Subject: [PATCH] Expose "keycodes_per_modifier" property getter The GetModifierMapping request returns a list of keycodes. Client code needs to iterate this list in chunks of keycodes_per_modifier to visit all keycodes for each of the 8 modifiers (Shift, Lock, Control, Mod1, Mod2, Mod3, Mod4, Mod5). The preexisting whitelist of properties/fields that should not be hidden has been extended to include this field. Fixes #271 --- build/cg/struct.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/cg/struct.rs b/build/cg/struct.rs index d649ceef99f..8c6d19c1e56 100644 --- a/build/cg/struct.rs +++ b/build/cg/struct.rs @@ -1683,8 +1683,13 @@ impl CodeGen { // not simply the length of a slice, and they must be exposed so that the // user can treat the slice as an image. The format field is important for // GetPropertyReply where the value getter would panic if formats mismatch. + // The keycodes_per_modifier field is needed for iterating the list of + // keycodes returned in GetModifierMappingReply. let visibility = if *is_fieldref - && !(name == "width" || name == "height" || name == "format") + && !(name == "width" + || name == "height" + || name == "format" + || name == "keycodes_per_modifier") { "" } else {