Skip to content

suggestion: allow xkb_state_update_mask() to accept negative groups to unlock group wrapping functionality #310

@bam80

Description

@bam80

libxkbcommon/src/state.c

Lines 792 to 798 in f60bdb1

xkb_state_update_mask(struct xkb_state *state,
xkb_mod_mask_t base_mods,
xkb_mod_mask_t latched_mods,
xkb_mod_mask_t locked_mods,
xkb_layout_index_t base_group,
xkb_layout_index_t latched_group,
xkb_layout_index_t locked_group)

xkb_layout_index_t is unsigned int which prevents us from passing a negative group to utilize internal group wrapping:

libxkbcommon/src/state.c

Lines 192 to 195 in f60bdb1

if (group < 0)
return ((int) num_groups + (group % (int) num_groups));
else
return group % num_groups;

This forces the client to re-implement that wrapping on it's side, which is unnecessary.

Could we just declare the *_group arguments as int32_t?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementIndicates new feature requestshelp wantedIndicates that a maintainer wants help on an issue or pull requeststateIndicates a need for improvements or additions to the xkb_state API

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions