Skip to content
  • Michael Weghorn's avatar
    atk: Align button role with AT-SPI one · c83ef490
    Michael Weghorn authored
    In line with
    
        commit 0c2ebfad
        Date:   Tue Aug 6 16:02:55 2024 -0500
    
            Rename ATSPI_ROLE_PUSH_BUTTON to ATSPI_ROLE_BUTTON
    
    , also rename `ATK_ROLE_PUSH_BUTTON` to `ATK_ROLE_BUTTON` and
    leave `ATK_ROLE_PUSH_BUTTON` as an enum value with the
    same name for compatibility reasons.
    
    This e.g. ensures that both, libatspi and libatk use the
    same name for the role, as that is generated based on
    the name of the enum values.
    
    This e.g. makes a sample program like
    
        #include <stdio.h>
        #include <atk/atk.h>
        #include <atspi/atspi.h>
        int main()
        {
            char* atspiRoleName = atspi_role_get_name(ATSPI_ROLE_BUTTON);
            printf("atspi name: %s\n", atspiRoleName);
            AtkRole atkRole = atk_role_for_name(atspiRoleName);
            printf("ATK role: %d, localized atk role: %s\n", atkRole, atk_role_get_localized_name(atkRole));
    
            atkRole = ATK_ROLE_PUSH_BUTTON;
            printf("ATK role: %d, localized atk role: %s\n", atkRole, atk_role_get_localized_name(atkRole));
            return 0;
        }
    
    output
    
        atspi name: button
        ATK role: 42, localized atk role: button
        ATK role: 42, localized atk role: button
    
    instead of
    
        atspi name: button
        ATK role: 0, localized atk role: invalid
        ATK role: 42, localized atk role: push button
    
    The original real-world scenario where this mismatch
    led to "invalid" being announced instead of a proper
    role name was Orca. While applications probably shouldn't
    mix role names from libatk and libatspi in the first place
    (see Orca MR [1]), it still seems useful to keep this in
    sync for the (push) button role.
    
    [1] orca!226
    c83ef490
Loading