From 114c1c84b1b1dae2d74f7a719e8e682920cc1557 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Fri, 18 Oct 2024 12:45:55 +0200 Subject: [PATCH] xkb: move XkbConvertGetByNameComponents and make it static This function has only one caller in xkb.c, so no need to keep it exported, can be moved over into xkb.c and made static. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- include/xkbfile.h | 8 -------- xkb/xkb.c | 39 +++++++++++++++++++++++++++++++++++++++ xkb/xkbfmisc.c | 39 --------------------------------------- 3 files changed, 39 insertions(+), 47 deletions(-) diff --git a/include/xkbfile.h b/include/xkbfile.h index df2221313..706f94018 100644 --- a/include/xkbfile.h +++ b/include/xkbfile.h @@ -86,14 +86,6 @@ extern _X_EXPORT int XkbFindKeycodeByName(XkbDescPtr /* xkb */ , Bool /* use_aliases */ ); -/***====================================================================***/ - -extern _X_EXPORT unsigned XkbConvertGetByNameComponents(Bool /* toXkm */ , - unsigned /* orig */ - ); - -/***====================================================================***/ - extern _X_EXPORT Bool XkbWriteXKBKeycodes(FILE * /* file */ , XkbDescPtr /* result */ , Bool /* topLevel */ , diff --git a/xkb/xkb.c b/xkb/xkb.c index 9ede6f969..f553ef739 100644 --- a/xkb/xkb.c +++ b/xkb/xkb.c @@ -5906,6 +5906,45 @@ ProcXkbListComponents(ClientPtr client) return Success; } +static unsigned +XkbConvertGetByNameComponents(Bool toXkm, unsigned orig) +{ + unsigned rtrn; + + rtrn = 0; + if (toXkm) { + if (orig & XkbGBN_TypesMask) + rtrn |= XkmTypesMask; + if (orig & XkbGBN_CompatMapMask) + rtrn |= XkmCompatMapMask; + if (orig & XkbGBN_SymbolsMask) + rtrn |= XkmSymbolsMask; + if (orig & XkbGBN_IndicatorMapMask) + rtrn |= XkmIndicatorsMask; + if (orig & XkbGBN_KeyNamesMask) + rtrn |= XkmKeyNamesMask; + if (orig & XkbGBN_GeometryMask) + rtrn |= XkmGeometryMask; + } + else { + if (orig & XkmTypesMask) + rtrn |= XkbGBN_TypesMask; + if (orig & XkmCompatMapMask) + rtrn |= XkbGBN_CompatMapMask; + if (orig & XkmSymbolsMask) + rtrn |= XkbGBN_SymbolsMask; + if (orig & XkmIndicatorsMask) + rtrn |= XkbGBN_IndicatorMapMask; + if (orig & XkmKeyNamesMask) + rtrn |= XkbGBN_KeyNamesMask; + if (orig & XkmGeometryMask) + rtrn |= XkbGBN_GeometryMask; + if (orig != 0) + rtrn |= XkbGBN_OtherNamesMask; + } + return rtrn; +} + /***====================================================================***/ int ProcXkbGetKbdByName(ClientPtr client) diff --git a/xkb/xkbfmisc.c b/xkb/xkbfmisc.c index 146e36683..a2063e40f 100644 --- a/xkb/xkbfmisc.c +++ b/xkb/xkbfmisc.c @@ -390,42 +390,3 @@ XkbFindKeycodeByName(XkbDescPtr xkb, char *name, Bool use_aliases) } return 0; } - -unsigned -XkbConvertGetByNameComponents(Bool toXkm, unsigned orig) -{ - unsigned rtrn; - - rtrn = 0; - if (toXkm) { - if (orig & XkbGBN_TypesMask) - rtrn |= XkmTypesMask; - if (orig & XkbGBN_CompatMapMask) - rtrn |= XkmCompatMapMask; - if (orig & XkbGBN_SymbolsMask) - rtrn |= XkmSymbolsMask; - if (orig & XkbGBN_IndicatorMapMask) - rtrn |= XkmIndicatorsMask; - if (orig & XkbGBN_KeyNamesMask) - rtrn |= XkmKeyNamesMask; - if (orig & XkbGBN_GeometryMask) - rtrn |= XkmGeometryMask; - } - else { - if (orig & XkmTypesMask) - rtrn |= XkbGBN_TypesMask; - if (orig & XkmCompatMapMask) - rtrn |= XkbGBN_CompatMapMask; - if (orig & XkmSymbolsMask) - rtrn |= XkbGBN_SymbolsMask; - if (orig & XkmIndicatorsMask) - rtrn |= XkbGBN_IndicatorMapMask; - if (orig & XkmKeyNamesMask) - rtrn |= XkbGBN_KeyNamesMask; - if (orig & XkmGeometryMask) - rtrn |= XkbGBN_GeometryMask; - if (orig != 0) - rtrn |= XkbGBN_OtherNamesMask; - } - return rtrn; -}