From b33b8d8ae86876b50df96881b96074b3fe177cce Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 28 Jul 2014 21:19:00 +0200 Subject: plink fontconfig libX11 libXext xserver xkeyboard-config mesa git update 28 July 2014 xserver commit 4afedf545b673282f2e214c0e2c759c9be9b9a2a xkeyboard-config commit 9010f6c0745f472b670c22340b5bbd36e33ce37e libX11 commit 0885cad1e4a9ed57266582be320be55259c881bf libXext commit efdcbb7634501e1117d422636a0a75d7ea84b16b fontconfig commit a9e7b0494e04b3925d1bccc140ff2500cfff9618 mesa commit cc1e1da24a6c535617d9fb38858d48d8c2999e68 plink revision 10211 --- fontconfig/configure.ac | 10 +- fontconfig/doc/Makefile.am | 1 + fontconfig/doc/fcweight.fncs | 47 + fontconfig/doc/fontconfig-user.sgml | 2 + fontconfig/fontconfig/fontconfig.h | 9 + fontconfig/src/Makefile.am | 1 + fontconfig/src/fccfg.c | 28 + fontconfig/src/fccompat.c | 4 + fontconfig/src/fcfreetype.c | 193 +- fontconfig/src/fcint.h | 6 - fontconfig/src/fcmatch.c | 45 +- fontconfig/src/fcname.c | 2 + fontconfig/src/fcrange.c | 4 + fontconfig/src/fcstat.c | 4 + fontconfig/src/fcstr.c | 52 - fontconfig/src/fcweight.c | 88 + fontconfig/src/fcwindows.h | 7 +- libX11/specs/XKB/acknowledgement.xml | 9 +- libX11/specs/XKB/ch01.xml | 111 +- libX11/specs/XKB/ch02.xml | 1046 +-- libX11/specs/XKB/ch03.xml | 126 +- libX11/specs/XKB/ch04.xml | 890 ++- libX11/specs/XKB/ch05.xml | 1191 ++-- libX11/specs/XKB/ch06.xml | 464 +- libX11/specs/XKB/ch07.xml | 533 +- libX11/specs/XKB/ch08.xml | 2920 ++++---- libX11/specs/XKB/ch09.xml | 1430 ++-- libX11/specs/XKB/ch10.xml | 7425 ++++++++++---------- libX11/specs/XKB/ch11.xml | 586 +- libX11/specs/XKB/ch12.xml | 1358 ++-- libX11/specs/XKB/ch13.xml | 6770 +++++++++--------- libX11/specs/XKB/ch14.xml | 2205 +++--- libX11/specs/XKB/ch15.xml | 4120 +++++------ libX11/specs/XKB/ch16.xml | 6441 ++++++++--------- libX11/specs/XKB/ch17.xml | 2350 ++++--- libX11/specs/XKB/ch18.xml | 1551 ++-- libX11/specs/XKB/ch19.xml | 351 +- libX11/specs/XKB/ch20.xml | 1212 ++-- libX11/specs/XKB/ch21.xml | 3076 ++++---- libX11/specs/XKB/ch22.xml | 323 +- libX11/specs/XKB/glossary.xml | 331 +- libX11/specs/XKB/xkblib.xml | 1 + libXext/configure.ac | 2 +- mesalib/configure.ac | 2 +- mesalib/docs/GL3.txt | 4 +- mesalib/docs/relnotes/10.3.html | 1 + mesalib/src/gallium/auxiliary/util/u_math.h | 17 + mesalib/src/glsl/ast_array_index.cpp | 3 +- mesalib/src/glsl/ast_to_hir.cpp | 2 +- mesalib/src/glsl/builtin_variables.cpp | 6 + mesalib/src/glsl/ir_validate.cpp | 1 - .../src/glsl/link_uniform_block_active_visitor.cpp | 50 +- mesalib/src/glsl/link_uniform_blocks.cpp | 6 +- mesalib/src/glsl/lower_ubo_reference.cpp | 56 +- mesalib/src/mapi/glapi/gen/ARB_clear_texture.xml | 34 + mesalib/src/mapi/glapi/gen/Makefile.am | 1 + mesalib/src/mapi/glapi/gen/gl_API.xml | 4 +- mesalib/src/mesa/drivers/common/driverfuncs.c | 1 + mesalib/src/mesa/drivers/common/meta.c | 197 + mesalib/src/mesa/drivers/common/meta.h | 11 + mesalib/src/mesa/main/config.h | 11 + mesalib/src/mesa/main/dd.h | 14 + mesalib/src/mesa/main/extensions.c | 1 + mesalib/src/mesa/main/get_hash_params.py | 7 + mesalib/src/mesa/main/imports.h | 6 +- mesalib/src/mesa/main/mtypes.h | 1 + mesalib/src/mesa/main/teximage.c | 321 +- mesalib/src/mesa/main/teximage.h | 10 + mesalib/src/mesa/main/texstore.c | 87 + mesalib/src/mesa/main/texstore.h | 7 + mesalib/src/mesa/main/uniform_query.cpp | 2 +- mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 12 +- tools/plink/ssh.c | 48 +- xorg-server/configure.ac | 29 +- xorg-server/glamor/glamor_sync.c | 2 +- xorg-server/hw/xfree86/i2c/Makefile.am | 36 +- xorg-server/hw/xfree86/i2c/bt829.c | 822 --- xorg-server/hw/xfree86/i2c/bt829.h | 103 - xorg-server/hw/xfree86/i2c/bt829_module.c | 20 - xorg-server/hw/xfree86/i2c/fi1236.c | 686 -- xorg-server/hw/xfree86/i2c/fi1236.h | 113 - xorg-server/hw/xfree86/i2c/fi1236_module.c | 24 - xorg-server/hw/xfree86/i2c/msp3430.c | 779 -- xorg-server/hw/xfree86/i2c/msp3430.h | 116 - xorg-server/hw/xfree86/i2c/msp3430_module.c | 24 - xorg-server/hw/xfree86/i2c/tda8425.c | 83 - xorg-server/hw/xfree86/i2c/tda8425.h | 44 - xorg-server/hw/xfree86/i2c/tda8425_module.c | 24 - xorg-server/hw/xfree86/i2c/tda9850.c | 136 - xorg-server/hw/xfree86/i2c/tda9850.h | 43 - xorg-server/hw/xfree86/i2c/tda9850_module.c | 24 - xorg-server/hw/xfree86/i2c/tda9885.c | 100 - xorg-server/hw/xfree86/i2c/tda9885.h | 63 - xorg-server/hw/xfree86/i2c/tda9885_module.c | 24 - xorg-server/hw/xfree86/i2c/uda1380.c | 196 - xorg-server/hw/xfree86/i2c/uda1380.h | 81 - xorg-server/hw/xfree86/i2c/uda1380_module.c | 24 - xorg-server/hw/xfree86/loader/loadmod.c | 1 - xorg-server/hw/xfree86/man/xorg.conf.man | 10 +- xorg-server/hw/xwayland/xwayland-input.c | 42 +- xorg-server/include/dix-config.h.in | 3 + xorg-server/include/servermd.h | 285 +- xorg-server/mi/mieq.c | 2 +- xorg-server/xkeyboard-config/symbols/es | 4 +- 104 files changed, 24945 insertions(+), 27246 deletions(-) create mode 100644 fontconfig/doc/fcweight.fncs create mode 100644 fontconfig/src/fcweight.c create mode 100644 mesalib/src/mapi/glapi/gen/ARB_clear_texture.xml delete mode 100644 xorg-server/hw/xfree86/i2c/bt829.c delete mode 100644 xorg-server/hw/xfree86/i2c/bt829.h delete mode 100644 xorg-server/hw/xfree86/i2c/bt829_module.c delete mode 100644 xorg-server/hw/xfree86/i2c/fi1236.c delete mode 100644 xorg-server/hw/xfree86/i2c/fi1236.h delete mode 100644 xorg-server/hw/xfree86/i2c/fi1236_module.c delete mode 100644 xorg-server/hw/xfree86/i2c/msp3430.c delete mode 100644 xorg-server/hw/xfree86/i2c/msp3430.h delete mode 100644 xorg-server/hw/xfree86/i2c/msp3430_module.c delete mode 100644 xorg-server/hw/xfree86/i2c/tda8425.c delete mode 100644 xorg-server/hw/xfree86/i2c/tda8425.h delete mode 100644 xorg-server/hw/xfree86/i2c/tda8425_module.c delete mode 100644 xorg-server/hw/xfree86/i2c/tda9850.c delete mode 100644 xorg-server/hw/xfree86/i2c/tda9850.h delete mode 100644 xorg-server/hw/xfree86/i2c/tda9850_module.c delete mode 100644 xorg-server/hw/xfree86/i2c/tda9885.c delete mode 100644 xorg-server/hw/xfree86/i2c/tda9885.h delete mode 100644 xorg-server/hw/xfree86/i2c/tda9885_module.c delete mode 100644 xorg-server/hw/xfree86/i2c/uda1380.c delete mode 100644 xorg-server/hw/xfree86/i2c/uda1380.h delete mode 100644 xorg-server/hw/xfree86/i2c/uda1380_module.c diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac index ce468b89e..a366853e2 100644 --- a/fontconfig/configure.ac +++ b/fontconfig/configure.ac @@ -138,7 +138,7 @@ dnl ========================================================================== # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h regex.h stdlib.h string.h unistd.h sys/statvfs.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h]) +AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h sys/statvfs.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h]) AX_CREATE_STDINT_H([src/fcstdint.h]) # Checks for typedefs, structures, and compiler characteristics. @@ -150,7 +150,7 @@ AC_TYPE_PID_T # Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_MMAP -AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink regcomp regerror regexec regfree fstatvfs fstatfs lstat]) +AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat]) dnl AC_CHECK_FUNCS doesn't check for header files. dnl posix_fadvise() may be not available in older libc. @@ -211,12 +211,6 @@ if test "x$ac_cv_func_fstatfs" = "xyes"; then fi AC_CHECK_MEMBERS([struct dirent.d_type],,, [#include ]) -# -# regex -# -if test "x$ac_cv_func_regcomp" = "xyes" -a "x$ac_cv_func_regerror" = "xyes" -a "x$ac_cv_func_regexec" = "xyes" -a "x$ac_cv_func_regfree"; then - AC_DEFINE(USE_REGEX,,[Use regex]) -fi # # Checks for iconv diff --git a/fontconfig/doc/Makefile.am b/fontconfig/doc/Makefile.am index 7503219b8..9141ab236 100644 --- a/fontconfig/doc/Makefile.am +++ b/fontconfig/doc/Makefile.am @@ -85,6 +85,7 @@ DOC_FUNCS_FNCS = \ fcstring.fncs \ fcstrset.fncs \ fcvalue.fncs \ + fcweight.fncs \ $(NULL) SGML_FILES = \ fontconfig-user.sgml \ diff --git a/fontconfig/doc/fcweight.fncs b/fontconfig/doc/fcweight.fncs new file mode 100644 index 000000000..2872dd66c --- /dev/null +++ b/fontconfig/doc/fcweight.fncs @@ -0,0 +1,47 @@ +/* + * fontconfig/doc/fcweight.fncs + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the author(s) not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The authors make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +@RET@ int +@FUNC@ FcWeightFromOpenType +@TYPE1@ int @ARG1@ ot_weight +@PURPOSE@ Convert from OpenType weight values to fontconfig ones +@DESC@ +FcWeightFromOpenType returns an integer value +to use with FC_WEIGHT, from an integer in the 1..1000 range, resembling +the numbers from OpenType specification's OS/2 usWeight numbers, which +are also similar to CSS font-weight numbers. If input is negative, +zero, or greater than 1000, returns -1. This function linearly interpolates +between various FC_WEIGHT_* constants. As such, the returned value does not +necessarily match any of the predefined constants. +@SINCE@ 2.11.91 +@@ + +@RET@ int +@FUNC@ FcWeightToOpenType +@TYPE1@ int @ARG1@ ot_weight +@PURPOSE@ Convert from fontconfig weight values to OpenType ones +@DESC@ +FcWeightToOpenType is the inverse of +FcWeightFromOpenType. If the input is less than +FC_WEIGHT_THIN or greater than FC_WEIGHT_EXTRABLACK, returns -1. Otherwise +returns a number in the range 1 to 1000. +@SINCE@ 2.11.91 +@@ diff --git a/fontconfig/doc/fontconfig-user.sgml b/fontconfig/doc/fontconfig-user.sgml index 775d1f725..482b45331 100644 --- a/fontconfig/doc/fontconfig-user.sgml +++ b/fontconfig/doc/fontconfig-user.sgml @@ -473,6 +473,8 @@ symbolic names for common font values: extralight weight 40 ultralight weight 40 light weight 50 + demilight weight 55 + semilight weight 55 book weight 75 regular weight 80 normal weight 80 diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h index 8575cc4d3..e5b09591b 100644 --- a/fontconfig/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig/fontconfig.h @@ -131,6 +131,8 @@ typedef int FcBool; #define FC_WEIGHT_EXTRALIGHT 40 #define FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT #define FC_WEIGHT_LIGHT 50 +#define FC_WEIGHT_DEMILIGHT 55 +#define FC_WEIGHT_SEMILIGHT FC_WEIGHT_DEMILIGHT #define FC_WEIGHT_BOOK 75 #define FC_WEIGHT_REGULAR 80 #define FC_WEIGHT_NORMAL FC_WEIGHT_REGULAR @@ -906,6 +908,13 @@ FcRangeDestroy (FcRange *range); FcPublic FcRange * FcRangeCopy (const FcRange *r); +/* fcweight.c */ + +FcPublic int +FcWeightFromOpenType (int ot_weight); + +FcPublic int +FcWeightToOpenType (int fc_weight); /* fcstr.c */ diff --git a/fontconfig/src/Makefile.am b/fontconfig/src/Makefile.am index c1991b284..3757cf8f3 100644 --- a/fontconfig/src/Makefile.am +++ b/fontconfig/src/Makefile.am @@ -154,6 +154,7 @@ libfontconfig_la_SOURCES = \ fcserialize.c \ fcstat.c \ fcstr.c \ + fcweight.c \ fcwindows.h \ fcxml.c \ ftglue.h \ diff --git a/fontconfig/src/fccfg.c b/fontconfig/src/fccfg.c index 6d3259513..f8ee8d20e 100644 --- a/fontconfig/src/fccfg.c +++ b/fontconfig/src/fccfg.c @@ -1546,10 +1546,38 @@ FcConfigSubstituteWithPat (FcConfig *config, FcStrSetDestroy (strs); while (l && (lang = FcStrListNext (l))) { + FcPatternElt *e = FcPatternObjectFindElt (p, FC_LANG_OBJECT); + + if (e) + { + FcValueListPtr ll; + + for (ll = FcPatternEltValues (e); ll; ll = FcValueListNext (ll)) + { + FcValue vv = FcValueCanonicalize (&ll->value); + + if (vv.type == FcTypeLangSet) + { + FcLangSet *ls = FcLangSetCreate (); + FcBool b; + + FcLangSetAdd (ls, lang); + b = FcLangSetContains (vv.u.l, ls); + FcLangSetDestroy (ls); + if (b) + goto bail_lang; + } + else + if (FcStrCmpIgnoreCase (vv.u.s, lang) == 0) + goto bail_lang; + } + } v.type = FcTypeString; v.u.s = lang; + FcPatternObjectAddWithBinding (p, FC_LANG_OBJECT, v, FcValueBindingWeak, FcTrue); } + bail_lang: FcStrListDone (l); } if (FcPatternObjectGet (p, FC_PRGNAME_OBJECT, 0, &v) == FcResultNoMatch) diff --git a/fontconfig/src/fccompat.c b/fontconfig/src/fccompat.c index f4f3f5fdc..31d80bef1 100644 --- a/fontconfig/src/fccompat.c +++ b/fontconfig/src/fccompat.c @@ -255,3 +255,7 @@ FcMakeDirectory (const FcChar8 *dir) FcStrFree (parent); return ret; } + +#define __fccompat__ +#include "fcaliastail.h" +#undef __fccompat__ diff --git a/fontconfig/src/fcfreetype.c b/fontconfig/src/fcfreetype.c index baf13e56d..aca2f70b2 100644 --- a/fontconfig/src/fcfreetype.c +++ b/fontconfig/src/fcfreetype.c @@ -558,6 +558,139 @@ FcFontCapabilities(FT_Face face); #define NUM_FC_MAC_ROMAN_FAKE (int) (sizeof (fcMacRomanFake) / sizeof (fcMacRomanFake[0])) + +/* From http://www.unicode.org/Public/MAPPINGS/VENDORS/APPLE/ROMAN.TXT */ +static const FcChar16 fcMacRomanNonASCIIToUnicode[128] = { + /*0x80*/ 0x00C4, /* LATIN CAPITAL LETTER A WITH DIAERESIS */ + /*0x81*/ 0x00C5, /* LATIN CAPITAL LETTER A WITH RING ABOVE */ + /*0x82*/ 0x00C7, /* LATIN CAPITAL LETTER C WITH CEDILLA */ + /*0x83*/ 0x00C9, /* LATIN CAPITAL LETTER E WITH ACUTE */ + /*0x84*/ 0x00D1, /* LATIN CAPITAL LETTER N WITH TILDE */ + /*0x85*/ 0x00D6, /* LATIN CAPITAL LETTER O WITH DIAERESIS */ + /*0x86*/ 0x00DC, /* LATIN CAPITAL LETTER U WITH DIAERESIS */ + /*0x87*/ 0x00E1, /* LATIN SMALL LETTER A WITH ACUTE */ + /*0x88*/ 0x00E0, /* LATIN SMALL LETTER A WITH GRAVE */ + /*0x89*/ 0x00E2, /* LATIN SMALL LETTER A WITH CIRCUMFLEX */ + /*0x8A*/ 0x00E4, /* LATIN SMALL LETTER A WITH DIAERESIS */ + /*0x8B*/ 0x00E3, /* LATIN SMALL LETTER A WITH TILDE */ + /*0x8C*/ 0x00E5, /* LATIN SMALL LETTER A WITH RING ABOVE */ + /*0x8D*/ 0x00E7, /* LATIN SMALL LETTER C WITH CEDILLA */ + /*0x8E*/ 0x00E9, /* LATIN SMALL LETTER E WITH ACUTE */ + /*0x8F*/ 0x00E8, /* LATIN SMALL LETTER E WITH GRAVE */ + /*0x90*/ 0x00EA, /* LATIN SMALL LETTER E WITH CIRCUMFLEX */ + /*0x91*/ 0x00EB, /* LATIN SMALL LETTER E WITH DIAERESIS */ + /*0x92*/ 0x00ED, /* LATIN SMALL LETTER I WITH ACUTE */ + /*0x93*/ 0x00EC, /* LATIN SMALL LETTER I WITH GRAVE */ + /*0x94*/ 0x00EE, /* LATIN SMALL LETTER I WITH CIRCUMFLEX */ + /*0x95*/ 0x00EF, /* LATIN SMALL LETTER I WITH DIAERESIS */ + /*0x96*/ 0x00F1, /* LATIN SMALL LETTER N WITH TILDE */ + /*0x97*/ 0x00F3, /* LATIN SMALL LETTER O WITH ACUTE */ + /*0x98*/ 0x00F2, /* LATIN SMALL LETTER O WITH GRAVE */ + /*0x99*/ 0x00F4, /* LATIN SMALL LETTER O WITH CIRCUMFLEX */ + /*0x9A*/ 0x00F6, /* LATIN SMALL LETTER O WITH DIAERESIS */ + /*0x9B*/ 0x00F5, /* LATIN SMALL LETTER O WITH TILDE */ + /*0x9C*/ 0x00FA, /* LATIN SMALL LETTER U WITH ACUTE */ + /*0x9D*/ 0x00F9, /* LATIN SMALL LETTER U WITH GRAVE */ + /*0x9E*/ 0x00FB, /* LATIN SMALL LETTER U WITH CIRCUMFLEX */ + /*0x9F*/ 0x00FC, /* LATIN SMALL LETTER U WITH DIAERESIS */ + /*0xA0*/ 0x2020, /* DAGGER */ + /*0xA1*/ 0x00B0, /* DEGREE SIGN */ + /*0xA2*/ 0x00A2, /* CENT SIGN */ + /*0xA3*/ 0x00A3, /* POUND SIGN */ + /*0xA4*/ 0x00A7, /* SECTION SIGN */ + /*0xA5*/ 0x2022, /* BULLET */ + /*0xA6*/ 0x00B6, /* PILCROW SIGN */ + /*0xA7*/ 0x00DF, /* LATIN SMALL LETTER SHARP S */ + /*0xA8*/ 0x00AE, /* REGISTERED SIGN */ + /*0xA9*/ 0x00A9, /* COPYRIGHT SIGN */ + /*0xAA*/ 0x2122, /* TRADE MARK SIGN */ + /*0xAB*/ 0x00B4, /* ACUTE ACCENT */ + /*0xAC*/ 0x00A8, /* DIAERESIS */ + /*0xAD*/ 0x2260, /* NOT EQUAL TO */ + /*0xAE*/ 0x00C6, /* LATIN CAPITAL LETTER AE */ + /*0xAF*/ 0x00D8, /* LATIN CAPITAL LETTER O WITH STROKE */ + /*0xB0*/ 0x221E, /* INFINITY */ + /*0xB1*/ 0x00B1, /* PLUS-MINUS SIGN */ + /*0xB2*/ 0x2264, /* LESS-THAN OR EQUAL TO */ + /*0xB3*/ 0x2265, /* GREATER-THAN OR EQUAL TO */ + /*0xB4*/ 0x00A5, /* YEN SIGN */ + /*0xB5*/ 0x00B5, /* MICRO SIGN */ + /*0xB6*/ 0x2202, /* PARTIAL DIFFERENTIAL */ + /*0xB7*/ 0x2211, /* N-ARY SUMMATION */ + /*0xB8*/ 0x220F, /* N-ARY PRODUCT */ + /*0xB9*/ 0x03C0, /* GREEK SMALL LETTER PI */ + /*0xBA*/ 0x222B, /* INTEGRAL */ + /*0xBB*/ 0x00AA, /* FEMININE ORDINAL INDICATOR */ + /*0xBC*/ 0x00BA, /* MASCULINE ORDINAL INDICATOR */ + /*0xBD*/ 0x03A9, /* GREEK CAPITAL LETTER OMEGA */ + /*0xBE*/ 0x00E6, /* LATIN SMALL LETTER AE */ + /*0xBF*/ 0x00F8, /* LATIN SMALL LETTER O WITH STROKE */ + /*0xC0*/ 0x00BF, /* INVERTED QUESTION MARK */ + /*0xC1*/ 0x00A1, /* INVERTED EXCLAMATION MARK */ + /*0xC2*/ 0x00AC, /* NOT SIGN */ + /*0xC3*/ 0x221A, /* SQUARE ROOT */ + /*0xC4*/ 0x0192, /* LATIN SMALL LETTER F WITH HOOK */ + /*0xC5*/ 0x2248, /* ALMOST EQUAL TO */ + /*0xC6*/ 0x2206, /* INCREMENT */ + /*0xC7*/ 0x00AB, /* LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */ + /*0xC8*/ 0x00BB, /* RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */ + /*0xC9*/ 0x2026, /* HORIZONTAL ELLIPSIS */ + /*0xCA*/ 0x00A0, /* NO-BREAK SPACE */ + /*0xCB*/ 0x00C0, /* LATIN CAPITAL LETTER A WITH GRAVE */ + /*0xCC*/ 0x00C3, /* LATIN CAPITAL LETTER A WITH TILDE */ + /*0xCD*/ 0x00D5, /* LATIN CAPITAL LETTER O WITH TILDE */ + /*0xCE*/ 0x0152, /* LATIN CAPITAL LIGATURE OE */ + /*0xCF*/ 0x0153, /* LATIN SMALL LIGATURE OE */ + /*0xD0*/ 0x2013, /* EN DASH */ + /*0xD1*/ 0x2014, /* EM DASH */ + /*0xD2*/ 0x201C, /* LEFT DOUBLE QUOTATION MARK */ + /*0xD3*/ 0x201D, /* RIGHT DOUBLE QUOTATION MARK */ + /*0xD4*/ 0x2018, /* LEFT SINGLE QUOTATION MARK */ + /*0xD5*/ 0x2019, /* RIGHT SINGLE QUOTATION MARK */ + /*0xD6*/ 0x00F7, /* DIVISION SIGN */ + /*0xD7*/ 0x25CA, /* LOZENGE */ + /*0xD8*/ 0x00FF, /* LATIN SMALL LETTER Y WITH DIAERESIS */ + /*0xD9*/ 0x0178, /* LATIN CAPITAL LETTER Y WITH DIAERESIS */ + /*0xDA*/ 0x2044, /* FRACTION SLASH */ + /*0xDB*/ 0x20AC, /* EURO SIGN */ + /*0xDC*/ 0x2039, /* SINGLE LEFT-POINTING ANGLE QUOTATION MARK */ + /*0xDD*/ 0x203A, /* SINGLE RIGHT-POINTING ANGLE QUOTATION MARK */ + /*0xDE*/ 0xFB01, /* LATIN SMALL LIGATURE FI */ + /*0xDF*/ 0xFB02, /* LATIN SMALL LIGATURE FL */ + /*0xE0*/ 0x2021, /* DOUBLE DAGGER */ + /*0xE1*/ 0x00B7, /* MIDDLE DOT */ + /*0xE2*/ 0x201A, /* SINGLE LOW-9 QUOTATION MARK */ + /*0xE3*/ 0x201E, /* DOUBLE LOW-9 QUOTATION MARK */ + /*0xE4*/ 0x2030, /* PER MILLE SIGN */ + /*0xE5*/ 0x00C2, /* LATIN CAPITAL LETTER A WITH CIRCUMFLEX */ + /*0xE6*/ 0x00CA, /* LATIN CAPITAL LETTER E WITH CIRCUMFLEX */ + /*0xE7*/ 0x00C1, /* LATIN CAPITAL LETTER A WITH ACUTE */ + /*0xE8*/ 0x00CB, /* LATIN CAPITAL LETTER E WITH DIAERESIS */ + /*0xE9*/ 0x00C8, /* LATIN CAPITAL LETTER E WITH GRAVE */ + /*0xEA*/ 0x00CD, /* LATIN CAPITAL LETTER I WITH ACUTE */ + /*0xEB*/ 0x00CE, /* LATIN CAPITAL LETTER I WITH CIRCUMFLEX */ + /*0xEC*/ 0x00CF, /* LATIN CAPITAL LETTER I WITH DIAERESIS */ + /*0xED*/ 0x00CC, /* LATIN CAPITAL LETTER I WITH GRAVE */ + /*0xEE*/ 0x00D3, /* LATIN CAPITAL LETTER O WITH ACUTE */ + /*0xEF*/ 0x00D4, /* LATIN CAPITAL LETTER O WITH CIRCUMFLEX */ + /*0xF0*/ 0xF8FF, /* Apple logo */ + /*0xF1*/ 0x00D2, /* LATIN CAPITAL LETTER O WITH GRAVE */ + /*0xF2*/ 0x00DA, /* LATIN CAPITAL LETTER U WITH ACUTE */ + /*0xF3*/ 0x00DB, /* LATIN CAPITAL LETTER U WITH CIRCUMFLEX */ + /*0xF4*/ 0x00D9, /* LATIN CAPITAL LETTER U WITH GRAVE */ + /*0xF5*/ 0x0131, /* LATIN SMALL LETTER DOTLESS I */ + /*0xF6*/ 0x02C6, /* MODIFIER LETTER CIRCUMFLEX ACCENT */ + /*0xF7*/ 0x02DC, /* SMALL TILDE */ + /*0xF8*/ 0x00AF, /* MACRON */ + /*0xF9*/ 0x02D8, /* BREVE */ + /*0xFA*/ 0x02D9, /* DOT ABOVE */ + /*0xFB*/ 0x02DA, /* RING ABOVE */ + /*0xFC*/ 0x00B8, /* CEDILLA */ + /*0xFD*/ 0x02DD, /* DOUBLE ACUTE ACCENT */ + /*0xFE*/ 0x02DB, /* OGONEK */ + /*0xFF*/ 0x02C7, /* CARON */ +}; + #if USE_ICONV #include #endif @@ -696,6 +829,35 @@ FcSfntNameTranscode (FT_SfntName *sname) *u8 = '\0'; goto done; } + if (!strcmp (fromcode, FC_ENCODING_MAC_ROMAN)) + { + FcChar8 *src = sname->string; + int src_len = sname->string_len; + int olen; + FcChar8 *u8; + FcChar32 ucs4; + + /* + * Convert Latin1 to Utf8. Freed below + */ + utf8 = malloc (src_len * 3 + 1); + if (!utf8) + return 0; + + u8 = utf8; + while (src_len > 0) + { + ucs4 = *src++; + if (ucs4 >= 128) + ucs4 = fcMacRomanNonASCIIToUnicode[ucs4 - 128]; + src_len--; + olen = FcUcs4ToUtf8 (ucs4, u8); + u8 += olen; + } + *u8 = '\0'; + goto done; + } + #if USE_ICONV cd = iconv_open ("UTF-8", fromcode); if (cd && cd != (iconv_t) (-1)) @@ -933,6 +1095,8 @@ static const FcStringConst weightConsts[] = { { (FC8) "thin", FC_WEIGHT_THIN }, { (FC8) "extralight", FC_WEIGHT_EXTRALIGHT }, { (FC8) "ultralight", FC_WEIGHT_ULTRALIGHT }, + { (FC8) "demilight", FC_WEIGHT_DEMILIGHT }, + { (FC8) "semilight", FC_WEIGHT_SEMILIGHT }, { (FC8) "light", FC_WEIGHT_LIGHT }, { (FC8) "book", FC_WEIGHT_BOOK }, { (FC8) "regular", FC_WEIGHT_REGULAR }, @@ -1107,6 +1271,8 @@ FcFreeTypeQueryFace (const FT_Face face, FcRange *r = NULL; double lower_size = 0.0L, upper_size = DBL_MAX; + FcInitDebug (); /* We might be called with no initizalization whatsoever. */ + pat = FcPatternCreate (); if (!pat) goto bail0; @@ -1282,10 +1448,10 @@ FcFreeTypeQueryFace (const FT_Face face, free (utf8); if (lang) { - /* pad lang list with 'xx' to line up with elt */ + /* pad lang list with 'und' to line up with elt */ while (*nlangp < *np) { - if (!FcPatternAddString (pat, eltlang, (FcChar8 *) "xx")) + if (!FcPatternAddString (pat, eltlang, (FcChar8 *) "und")) goto bail1; ++*nlangp; } @@ -1462,28 +1628,7 @@ FcFreeTypeQueryFace (const FT_Face face, if (os2 && os2->version != 0xffff) { - if (os2->usWeightClass == 0) - ; - else if (os2->usWeightClass < 150) - weight = FC_WEIGHT_THIN; - else if (os2->usWeightClass < 250) - weight = FC_WEIGHT_EXTRALIGHT; - else if (os2->usWeightClass < 350) - weight = FC_WEIGHT_LIGHT; - else if (os2->usWeightClass < 450) - weight = FC_WEIGHT_REGULAR; - else if (os2->usWeightClass < 550) - weight = FC_WEIGHT_MEDIUM; - else if (os2->usWeightClass < 650) - weight = FC_WEIGHT_SEMIBOLD; - else if (os2->usWeightClass < 750) - weight = FC_WEIGHT_BOLD; - else if (os2->usWeightClass < 850) - weight = FC_WEIGHT_EXTRABOLD; - else if (os2->usWeightClass < 925) - weight = FC_WEIGHT_BLACK; - else if (os2->usWeightClass < 1000) - weight = FC_WEIGHT_EXTRABLACK; + weight = FcWeightFromOpenType (os2->usWeightClass); if ((FcDebug() & FC_DBG_SCANV) && weight != -1) printf ("\tos2 weight class %d maps to weight %d\n", os2->usWeightClass, weight); diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h index d3079edcc..45dfc6e61 100644 --- a/fontconfig/src/fcint.h +++ b/fontconfig/src/fcint.h @@ -1152,12 +1152,6 @@ FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2); FcPrivate int FcStrCmpIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims); -FcPrivate FcBool -FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex); - -FcPrivate FcBool -FcStrRegexCmpIgnoreCase (const FcChar8 *s, const FcChar8 *regex); - FcPrivate const FcChar8 * FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2); diff --git a/fontconfig/src/fcmatch.c b/fontconfig/src/fcmatch.c index 78255186f..b0e695df3 100644 --- a/fontconfig/src/fcmatch.c +++ b/fontconfig/src/fcmatch.c @@ -483,7 +483,7 @@ FcFontRenderPrepare (FcConfig *config, { FcPattern *new; int i; - FcPatternElt *fe, *pe, *fel, *pel; + FcPatternElt *fe, *pe; FcValue v; FcResult result; @@ -508,36 +508,25 @@ FcFontRenderPrepare (FcConfig *config, fe->object == FC_STYLE_OBJECT || fe->object == FC_FULLNAME_OBJECT) { + FcPatternElt *fel, *pel; + FC_ASSERT_STATIC ((FC_FAMILY_OBJECT + 1) == FC_FAMILYLANG_OBJECT); FC_ASSERT_STATIC ((FC_STYLE_OBJECT + 1) == FC_STYLELANG_OBJECT); FC_ASSERT_STATIC ((FC_FULLNAME_OBJECT + 1) == FC_FULLNAMELANG_OBJECT); fel = FcPatternObjectFindElt (font, fe->object + 1); pel = FcPatternObjectFindElt (pat, fe->object + 1); - } - else - { - fel = NULL; - pel = NULL; - } - pe = FcPatternObjectFindElt (pat, fe->object); - if (pe) - { - const FcMatcher *match = FcObjectToMatcher (pe->object, FcFalse); - if (!FcCompareValueList (pe->object, match, - FcPatternEltValues(pe), - FcPatternEltValues(fe), &v, NULL, NULL, &result)) - { - FcPatternDestroy (new); - return NULL; - } if (fel && pel) { + /* The font has name languages, and pattern asks for specific language(s). + * Match on language and and prefer that result. + * Note: Currently the code only give priority to first matching language. + */ int n = 1, j; FcValueListPtr l1, l2, ln = NULL, ll = NULL; + const FcMatcher *match = FcObjectToMatcher (pel->object, FcTrue); - match = FcObjectToMatcher (pel->object, FcTrue); if (!FcCompareValueList (pel->object, match, FcPatternEltValues (pel), FcPatternEltValues (fel), NULL, NULL, &n, &result)) @@ -580,9 +569,10 @@ FcFontRenderPrepare (FcConfig *config, } else if (fel) { + /* Pattern doesn't ask for specific language. Copy all for name and + * lang. */ FcValueListPtr l1, l2; - copy_lang: l1 = FcValueListDuplicate (FcPatternEltValues (fe)); l2 = FcValueListDuplicate (FcPatternEltValues (fel)); FcPatternObjectListAdd (new, fe->object, l1, FcFalse); @@ -590,12 +580,23 @@ FcFontRenderPrepare (FcConfig *config, continue; } + } + + pe = FcPatternObjectFindElt (pat, fe->object); + if (pe) + { + const FcMatcher *match = FcObjectToMatcher (pe->object, FcFalse); + if (!FcCompareValueList (pe->object, match, + FcPatternEltValues(pe), + FcPatternEltValues(fe), &v, NULL, NULL, &result)) + { + FcPatternDestroy (new); + return NULL; + } FcPatternObjectAdd (new, fe->object, v, FcFalse); } else { - if (fel) - goto copy_lang; FcPatternObjectListAdd (new, fe->object, FcValueListDuplicate (FcPatternEltValues (fe)), FcTrue); diff --git a/fontconfig/src/fcname.c b/fontconfig/src/fcname.c index 466617872..1d8fe757c 100644 --- a/fontconfig/src/fcname.c +++ b/fontconfig/src/fcname.c @@ -136,6 +136,8 @@ static const FcConstant _FcBaseConstants[] = { { (FcChar8 *) "thin", "weight", FC_WEIGHT_THIN, }, { (FcChar8 *) "extralight", "weight", FC_WEIGHT_EXTRALIGHT, }, { (FcChar8 *) "ultralight", "weight", FC_WEIGHT_EXTRALIGHT, }, + { (FcChar8 *) "demilight", "weight", FC_WEIGHT_DEMILIGHT, }, + { (FcChar8 *) "semilight", "weight", FC_WEIGHT_DEMILIGHT, }, { (FcChar8 *) "light", "weight", FC_WEIGHT_LIGHT, }, { (FcChar8 *) "book", "weight", FC_WEIGHT_BOOK, }, { (FcChar8 *) "regular", "weight", FC_WEIGHT_REGULAR, }, diff --git a/fontconfig/src/fcrange.c b/fontconfig/src/fcrange.c index 7d0c1c0b1..39eafd82d 100644 --- a/fontconfig/src/fcrange.c +++ b/fontconfig/src/fcrange.c @@ -205,3 +205,7 @@ FcRangeSerialize (FcSerialize *serialize, const FcRange *r) return r_serialize; } + +#define __fcrange__ +#include "fcaliastail.h" +#undef __fcrange__ diff --git a/fontconfig/src/fcstat.c b/fontconfig/src/fcstat.c index 0a880975a..bbae10216 100644 --- a/fontconfig/src/fcstat.c +++ b/fontconfig/src/fcstat.c @@ -360,3 +360,7 @@ FcIsFsMtimeBroken (const FcChar8 *dir) return FcFalse; } + +#define __fcstat__ +#include "fcaliastail.h" +#undef __fcstat__ diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c index 024dae325..29a577d10 100644 --- a/fontconfig/src/fcstr.c +++ b/fontconfig/src/fcstr.c @@ -26,9 +26,6 @@ #include #include #include -#ifdef HAVE_REGEX_H -#include -#endif /* Objects MT-safe for readonly access. */ @@ -242,55 +239,6 @@ FcStrCmp (const FcChar8 *s1, const FcChar8 *s2) return (int) c1 - (int) c2; } -#ifdef USE_REGEX -static FcBool -_FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags) -{ - int ret = -1; - regex_t reg; - - if ((ret = regcomp (®, (const char *)regex, cflags)) != 0) - { - if (FcDebug () & FC_DBG_MATCHV) - { - char buf[512]; - - regerror (ret, ®, buf, 512); - printf("Regexp compile error: %s\n", buf); - } - return FcFalse; - } - ret = regexec (®, (const char *)s, 0, NULL, eflags); - if (ret != 0) - { - if (FcDebug () & FC_DBG_MATCHV) - { - char buf[512]; - - regerror (ret, ®, buf, 512); - printf("Regexp exec error: %s\n", buf); - } - } - regfree (®); - - return ret == 0 ? FcTrue : FcFalse; -} -#else -# define _FcStrRegexCmp(_s_, _regex_, _cflags_, _eflags_) (FcFalse) -#endif - -FcBool -FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex) -{ - return _FcStrRegexCmp (s, regex, REG_EXTENDED | REG_NOSUB, 0); -} - -FcBool -FcStrRegexCmpIgnoreCase (const FcChar8 *s, const FcChar8 *regex) -{ - return _FcStrRegexCmp (s, regex, REG_EXTENDED | REG_NOSUB | REG_ICASE, 0); -} - /* * Return a hash value for a string */ diff --git a/fontconfig/src/fcweight.c b/fontconfig/src/fcweight.c new file mode 100644 index 000000000..87bbe67ab --- /dev/null +++ b/fontconfig/src/fcweight.c @@ -0,0 +1,88 @@ +/* + * fontconfig/src/fcweight.c + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of the author(s) not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The authors make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "fcint.h" + +static const struct { + int ot; + int fc; +} map[] = { + { 0, FC_WEIGHT_THIN }, + { 100, FC_WEIGHT_THIN }, + { 200, FC_WEIGHT_EXTRALIGHT }, + { 350, FC_WEIGHT_DEMILIGHT }, + { 300, FC_WEIGHT_LIGHT }, + { 380, FC_WEIGHT_BOOK }, + { 400, FC_WEIGHT_REGULAR }, + { 500, FC_WEIGHT_MEDIUM }, + { 600, FC_WEIGHT_DEMIBOLD }, + { 700, FC_WEIGHT_BOLD }, + { 800, FC_WEIGHT_EXTRABOLD }, + { 900, FC_WEIGHT_BLACK }, + {1000, FC_WEIGHT_EXTRABLACK }, +}; + +static int lerp(int x, int x1, int x2, int y1, int y2) +{ + int dx = x2 - x1; + int dy = y2 - y1; + assert (dx > 0 && dy > 0 && x1 <= x && x <= x2); + return y1 + (dy*(x-x1) + dx/2) / dx; +} + +FcPublic int +FcWeightFromOpenType (int ot_weight) +{ + int i; + if (ot_weight <= 0 || ot_weight > 1000) + return -1; + + for (i = 1; ot_weight > map[i].ot; i++) + ; + + if (ot_weight == map[i].ot) + return map[i].fc; + + /* Interpolate between two items. */ + return lerp (ot_weight, map[i-1].ot, map[i].ot, map[i-1].fc, map[i].fc); +} + +FcPublic int +FcWeightToOpenType (int fc_weight) +{ + int i; + if (fc_weight < 0 || fc_weight > FC_WEIGHT_EXTRABLACK) + return -1; + + for (i = 1; fc_weight > map[i].fc; i++) + ; + + if (fc_weight == map[i].fc) + return map[i].ot; + + /* Interpolate between two items. */ + return lerp (fc_weight, map[i-1].fc, map[i].fc, map[i-1].ot, map[i].ot); +} + +#define __fcweight__ +#include "fcaliastail.h" +#undef __fcweight__ diff --git a/fontconfig/src/fcwindows.h b/fontconfig/src/fcwindows.h index 02489d9dc..a0eee675e 100644 --- a/fontconfig/src/fcwindows.h +++ b/fontconfig/src/fcwindows.h @@ -32,8 +32,13 @@ #endif #ifdef _WIN32 + /* Request Windows Vista for building. This is required to + * get MemoryBarrier on mingw32... */ +# if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 +# undef _WIN32_WINNT +# endif # ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0500 +# define _WIN32_WINNT 0x0600 # endif # define WIN32_LEAN_AND_MEAN # define WIN32_EXTRA_LEAN diff --git a/libX11/specs/XKB/acknowledgement.xml b/libX11/specs/XKB/acknowledgement.xml index 4ecb798c1..43be0946f 100644 --- a/libX11/specs/XKB/acknowledgement.xml +++ b/libX11/specs/XKB/acknowledgement.xml @@ -1,3 +1,6 @@ + + Acknowledgement @@ -36,8 +39,10 @@ X Consortium Inc. This document is made available to you in modern formats such as HTML and PDF thanks to the efforts of Matt Dew, who converted the original troff sources to DocBook/XML and edited them into shape; Fernando Carrijo, who converted the -images to SVG format; and Gaetan Nadon, who set up the formatting machinery in -the libX11 builds and performed further editing of the DocBook markup. +images to SVG format; Gaetan Nadon, who set up the formatting machinery in +the libX11 builds and performed further editing of the DocBook markup; and +Alan Coopersmith, who converted the DocBook tags to semantic markup and +cleaned up other formatting issues. diff --git a/libX11/specs/XKB/ch01.xml b/libX11/specs/XKB/ch01.xml index 15cc97dad..79aed476d 100644 --- a/libX11/specs/XKB/ch01.xml +++ b/libX11/specs/XKB/ch01.xml @@ -1,3 +1,6 @@ + + Overview @@ -11,12 +14,12 @@ cumbersome in the core X protocol. The core X protocol specifies the ways that the -Shift, -Control, and -Lock +Shift, +Control, and +Lock modifiers and the modifiers bound to the -Mode_switch or -Num_Lock +Mode_switch or +Num_Lock keysyms interact to generate keysyms and characters. The core protocol also allows users to specify that a key affects one or more modifiers. This behavior is simple and fairly flexible, but it has a number of limitations that make it @@ -43,7 +46,7 @@ Furthermore, this approach limits the number of keyboard groups to two. Poorly specified locking key behavior requires X servers to look for a few -"magic" keysyms to determine that keys should lock when pressed. This leads to +magic keysyms to determine that keys should lock when pressed. This leads to incompatibilities between X servers with no way for clients to detect implementation differences. @@ -60,7 +63,7 @@ incompatibilities between system wide and X library capitalization behavior. Limited interactions between modifiers specified by the core protocol make many common keyboard behaviors difficult or impossible to implement. For example, there is no reliable way to indicate whether or not the shift modifier should -"cancel" the lock modifier. +cancel the lock modifier. @@ -105,23 +108,28 @@ server and Xlib versions must be at least X11 R6. -Figure 1.1 shows the overall structure of the Xkb extension: +Figure 1.1 shows the overall structure of the Xkb extension: - - - - - Overall Xkb Structure - +
+ Overall Xkb Structure + + + + + +
- + The server portion of the Xkb extension encompasses a database of named keyboard components, in unspecified format, that may be used to configure a -keyboard. Internally, the server maintains a -keyboard description - that includes the keyboard state and configuration (mapping). By "keyboard" we +keyboard. Internally, the server maintains a +keyboard description + +keyboard description +that includes the keyboard state and configuration (mapping). By +keyboard we mean the logical keyboard device, which includes not only the physical keys, but also potentially a set of up to 32 indicators (usually LEDs) and bells. @@ -131,12 +139,12 @@ but also potentially a set of up to 32 indicators (usually LEDs) and bells. The keyboard description is a composite of several different data structures, each of which may be manipulated separately. When manipulating the server components, the design allows partial components to be transmitted between the -server and a client. The individual components are shown in Figure 1.1. +server and a client. The individual components are shown in Figure 1.1. - Client Map + Client Map The key mapping information needed to convert arbitrary keycodes to symbols. @@ -144,7 +152,7 @@ The key mapping information needed to convert arbitrary keycodes to symbols. - Server Map + Server Map The key mapping information categorizing keys by functionality (which keys are @@ -153,7 +161,7 @@ modifiers, how keys behave, and so on). - Controls + Controls Client configurable quantities effecting how the keyboard behaves, such as @@ -162,7 +170,7 @@ repeat behavior and modifications for people with movement impairments. - Indicators + Indicators The mapping of behavior to indicators. @@ -170,7 +178,7 @@ The mapping of behavior to indicators. - Geometry + Geometry A complete description of the physical keyboard layout, sufficient to draw a @@ -179,7 +187,7 @@ representation of the keyboard. - Names + Names A mapping of names to various aspects of the keyboard such as individual @@ -188,7 +196,7 @@ virtual modifiers, indicators, and bells. - Compatibility Map + Compatibility Map The definition of how to map core protocol keyboard state to Xkb keyboard state. @@ -219,7 +227,7 @@ and incremental reconfiguration are both supported. The graphic characters or control functions that may be accessed by one key are -logically arranged in groups and levels. See section 14.1for a complete +logically arranged in groups and levels. See section 14.1 for a complete description of groups and levels. @@ -229,14 +237,19 @@ description of groups and levels. Radio Groups -A radio group is a set of keys whose behavior simulates a set of radio buttons. + +radio group + +groupradio +A radio group +is a set of keys whose behavior simulates a set of radio buttons. Once a key in a radio group is pressed, it stays logically depressed until another key in the group is pressed, at which point the previously depressed key is logically released. Consequently, at most one key in a radio group can be logically depressed at one time. A radio group is defined by a radio group -index, an optional name, and by assigning each key in the radio group -XkbKB_RadioGroup - behavior and the radio group index. +index, an optional name, and by assigning each key in the radio group +XkbKB_RadioGroup +behavior and the radio group index. @@ -305,12 +318,11 @@ configuration. Additional Protocol Errors -The Xkb extension adds a single protocol error, -BadKeyboard -, to the core protocol error set. See section 2.6 for a discussion of the - -BadKeyboard - protocol error. +The Xkb extension adds a single protocol error, +BadKeyboard, +to the core protocol error set. See section 2.6 for a discussion of the +BadKeyboard +protocol error. @@ -322,7 +334,7 @@ BadKeyboard The X Keyboard Extension replaces the core protocol definition of a keyboard with a more comprehensive one. The X Keyboard Extension library interfaces are included in Xlib. -X11R6.1 is the first release by the X Consortium, Inc.,that includes the X +X11R6.1 is the first release by the X Consortium, Inc., that includes the X Keyboard Extension in Xlib. X11R6 included work in progress on this extension as nonstandard additions to the library. @@ -347,21 +359,23 @@ directly manipulate the new capabilities. Error Indications +errors Xkb functions that communicate with the X server check to be sure the Xkb extension has been properly initialized prior to doing any other operations. If the extension has not been properly initialized or the application, library, and server versions are incompatible, these functions return an error -indication as shown in Table 1.1. Because of this test, -BadAccess - and -BadMatch - (due to incompatible versions) protocol errors should normally not be +indication as shown in Table 1.1. +Because of this test, +BadAccess +and +BadMatch +(due to incompatible versions) protocol errors should normally not be generated. - +
Function Error Returns Due to Extension Problems @@ -377,15 +391,15 @@ generated. pointer to a structure - NULL + NULL Bool - False + False Status - BadAccess + BadAccess @@ -398,7 +412,8 @@ applications may never actually need to communicate with the server; they simply use the Xkb library capabilities. The functions that do not communicate with the server return either a pointer to a structure, a Bool, or a Status. These functions check that the application has queried the Xkb library version -and return the values shown in Table 1.1 if it has not. +and return the values shown in Table 1.1 +if it has not. diff --git a/libX11/specs/XKB/ch02.xml b/libX11/specs/XKB/ch02.xml index b626a4322..ca0616e6e 100644 --- a/libX11/specs/XKB/ch02.xml +++ b/libX11/specs/XKB/ch02.xml @@ -1,3 +1,6 @@ + + Initialization and General Programming Information @@ -8,40 +11,40 @@ The following include files are part of the Xkb standard: -<X11/XKBlib.h> +<X11/XKBlib.h> - XKBlib.h + XKBlib.h is the main header file for Xkb; it declares constants, types, and functions. -<X11/extensions/XKBstr.h> +<X11/extensions/XKBstr.h> -XKBstr.h declares types and +XKBstr.h declares types and constants for Xkb. It is included automatically from -<X11/XKBlib.h> -; you should never need to reference it directly in your application code. +<X11/XKBlib.h>; +you should never need to reference it directly in your application code. -<X11/extensions/XKB.h> +<X11/extensions/XKB.h> -XKB.h -defines constants for Xkb. It is included automatically from -<X11/XKBstr.h> -; you should never need to reference it directly in your application code. +XKB.h +defines constants for Xkb. It is included automatically from +<X11/XKBstr.h>; +you should never need to reference it directly in your application code. -<X11/extensions/XKBgeom.h> +<X11/extensions/XKBgeom.h> - XKBgeom.h + XKBgeom.h declares types, symbolic constants, and functions for manipulating keyboard geometry descriptions. @@ -50,24 +53,24 @@ keyboard geometry descriptions. Extension Name +XkbName -The name of the Xkb extension is given in -<X11/extensions/Xkb.h>: - +The name of the Xkb extension is given in +<X11/extensions/Xkb.h>: - - -#define XkbName "XKEYBOARD" + +#define XkbName "XKEYBOARD" + -Most extensions to the X protocol are initialized by calling -XInitExtension - and passing the extension name. However, as explained in section 2.4, Xkb +Most extensions to the X protocol are initialized by calling +XInitExtension +and passing the extension name. However, as explained in section 2.4, Xkb requires a more complex initialization sequence, and a client program should -not call -XInitExtension - directly. +not call +XInitExtension +directly. @@ -89,384 +92,409 @@ against one set of header files and link against a different, incompatible, version of the library, although this should not normally occur.) -To determine the compatibility of a library at runtime, call -XkbLibraryVersion. +To determine the compatibility of a library at runtime, call +XkbLibraryVersion. - - - - - - - -Bool -XkbLibraryVersion -( -lib_major_in_out -, -lib_minor_in_out -) - - - - -int * -lib_major_in_out; - /* specifies and returns the major Xkb library version. */ - - - - -int * -lib_minor_in_out; - /* specifies and returns the minor Xkb library version. */ - - - - - - - -Pass the symbolic value -XkbMajorVersion - in -lib_major_in_out - and -XkbMinorVersion - in -lib_minor_in_out -. These arguments represent the version of the library used at compile time. -The -XkbLibraryVersion +XkbLibraryVersion + + + Bool XkbLibraryVersion + + + int *lib_major_in_out + int *lib_minor_in_out + + + + + + lib_major_in_out + + + + specifies and returns the major Xkb library version. + + + + + + lib_minor_in_out + + + + specifies and returns the minor Xkb library version. + + + + + + +Pass the symbolic value +XkbMajorVersion +in +lib_major_in_out +and +XkbMinorVersion +in +lib_minor_in_out. +These arguments represent the version of the library used at compile time. +The +XkbLibraryVersion function backfills the major and minor version numbers of the library used at -run time in -lib_major_in_out - and -lib_minor_in_out -. If the versions of the compile time and run time libraries are compatible, - -XkbLibraryVersion -returns -True -, otherwise, it returns -False. +run time in +lib_major_in_out +and +lib_minor_in_out. +If the versions of the compile time and run time libraries are compatible, +XkbLibraryVersion +returns +True, +otherwise, it returns +False. In addition, in order to use the Xkb extension, you must ensure that the extension is present in the server and that the server supports the version of -the extension expected by the client. Use -XkbQueryExtension - to do this, as described in the next section. +the extension expected by the client. Use +XkbQueryExtension +to do this, as described in the next section. Initializing the Keyboard Extension -Call -XkbQueryExtension - to check for the presence and compatibility of the extension in the server and +Call +XkbQueryExtension +to check for the presence and compatibility of the extension in the server and to initialize the extension. Because of potential version mismatches, you -cannot use the generic extension mechanism functions ( -XQueryExtension -and - XInitExtension -) for checking for the presence of, and initializing the Xkb extension. +cannot use the generic extension mechanism functions +(XQueryExtension +and +XInitExtension) +for checking for the presence of, and initializing the Xkb extension. -You must call -XkbQueryExtension - or -XkbOpenDisplay - before using any other Xkb library interfaces, unless such usage is explicitly +You must call +XkbQueryExtension +or +XkbOpenDisplay +before using any other Xkb library interfaces, unless such usage is explicitly allowed in the interface description in this document. The exceptions are: - -XkbIgnoreExtension -, -XkbLibraryVersion -, and a handful of audible-bell functions. You should not use any other Xkb +XkbIgnoreExtension, +XkbLibraryVersion, +and a handful of audible-bell functions. You should not use any other Xkb functions if the extension is not present or is uninitialized. In general, calls to Xkb library functions made prior to initializing the Xkb extension -cause -BadAccess - protocol errors. +cause +BadAccess +protocol errors. +errors +BadAccess + +BadAccess - -XkbQueryExtension - both determines whether a compatible Xkb extension is present in the X server +XkbQueryExtension +both determines whether a compatible Xkb extension is present in the X server and initializes the extension when it is present. - - - - - - - -Bool -XkbQueryExtension -( -dpy, opcode_rtrn, event_rtrn, error_rtrn, major_in_out, minor_in_out -) - - - - -Display * -dpy; - /* connection to the X server */ - - - - -int * -opcode_rtrn -; /* backfilled with the major extension opcode */ - - - - -int * -event_rtrn -; /* backfilled with the extension base event code */ - - - - -int * -error_rtrn -; /* backfilled with the extension base error code */ - - - - -int * -major_in_out -; /* compile time lib major version in, server major version out */ - - - - -int * -minor_in_out; - /* compile time lib min version in, server minor version out */ - - - - - - - -The -XkbQueryExtension - function determines whether a compatible version of the X Keyboard Extension -is present in the server. If a compatible extension is present, -XkbQueryExtension - returns -True -; otherwise, it returns -False -. - - - -If a compatible version of Xkb is present, -XkbQueryExtension - initializes the extension. It backfills the major opcode for the keyboard -extension in -opcode_rtrn -, the base event code in -event_rtrn - -, the base error code - in -error_rtrn -, and the major and minor version numbers of the extension in -major_in_out - and -minor_in_out -. The major opcode is reported in the -req_major - fields of some Xkb events. For a discussion of the base event code, see -section 4.1. - - - -As a convenience, you can use the function -XkbOpenDisplay - to perform these three tasks at once: open a connection to an X server, check +XkbQueryExtension + + + Bool XkbQueryExtension + + + Display *dpy + int *opcode_rtrn + int *event_rtrn + int *error_rtrn + int *major_in_out + int *minor_in_out + + + + + + dpy + + + + connection to the X server + + + + + + opcode_rtrn + + + + backfilled with the major extension opcode + + + + + + event_rtrn + + + + backfilled with the extension base event code + + + + + + error_rtrn + + + + backfilled with the extension base error code + + + + + + major_in_out + + + + compile time lib major version in, server major version out + + + + + + minor_in_out + + + + compile time lib min version in, server minor version out + + + + + + +The +XkbQueryExtension +function determines whether a compatible version of the X Keyboard Extension +is present in the server. If a compatible extension is present, +XkbQueryExtension +returns +True; +otherwise, it returns +False. + + + +If a compatible version of Xkb is present, +XkbQueryExtension +initializes the extension. It backfills the major opcode for the keyboard +extension in +opcode_rtrn, +the base event code in +event_rtrn, +the base error code in +error_rtrn, +and the major and minor version numbers of the extension in +major_in_out +and +minor_in_out. +The major opcode is reported in the +req_major +fields of some Xkb events. For a discussion of the base event code, see +section 4.1. + + + +As a convenience, you can use the function +XkbOpenDisplay +to perform these three tasks at once: open a connection to an X server, check for a compatible version of the Xkb extension in both the library and the server, and initialize the extension for use. - - - - - - - -Display * -XkbOpenDisplay -( -display_name, event_rtrn, error_rtrn, major_in_out, minor_in_out, -reason_rtrn) - - - - -char * -display_name -; /* hardware display name, which determines the display and -communications domain to be used */ - - - - -int * -event_rtrn -; /* backfilled with the extension base event code */ - - - - -int * -error_rtrn -; /* backfilled with the extension base error code */ - - - - -int * -major_in_out -; /* compile time lib major version in, server major version out */ - - - - -int * -minor_in_out -; /* compile time lib minor version in, server minor version out */ - - - - -int * -reason_rtrn -; /* backfilled with a status code */ - - - - - +XkbOpenDisplay + + + Display *XkbOpenDisplay + + + char *display_name + int *event_rtrn + int *error_rtrn + int *major_in_out + int *minor_in_out + int *reason_rtrn + + + + + + display_name + + + + hardware display name, which determines the display and + communications domain to be used + + + + + + event_rtrn + + + + backfilled with the extension base event code + + + + + + error_rtrn + + + + backfilled with the extension base error code + + + + + + major_in_out + + + + compile time lib major version in, server major version out + + + + + + minor_in_out + + + + compile time lib minor version in, server minor version out + + + + + + reason_rtrn + + + + backfilled with a status code + + + + - -XkbOpenDisplay +XkbOpenDisplay is a convenience function that opens an X display connection and initializes -the X keyboard extension. In all cases, upon return -reason_rtrn - contains a status value indicating success or the type of failure. If - -major_in_out - and -minor_in_out - are not -NULL -, -XkbOpenDisplay - first calls -XkbLibraryVersion - to determine whether the client library is compatible, passing it the values -pointed to by -major_in_out - and -minor_in_out -. If the library is incompatible, -XkbOpenDisplay - backfills -major_in_out - and -minor_in_out - with the major and minor extension versions of the library being used and -returns -NULL -. If the library is compatible, - XkbOpenDisplay -next calls -XOpenDisplay - with the -display_name -. If this fails, the function returns -NULL -. If successful, -XkbOpenDisplay -calls -XkbQueryExtension - and - -backfills the major and minor Xkb server extension version numbers in -major_in_out - and -minor_in_out -. - +the X keyboard extension. In all cases, upon return +reason_rtrn +contains a status value indicating success or the type of failure. If +major_in_out +and +minor_in_out +are not +NULL, +XkbOpenDisplay +first calls +XkbLibraryVersion +to determine whether the client library is compatible, passing it the values +pointed to by +major_in_out +and +minor_in_out. +If the library is incompatible, +XkbOpenDisplay +backfills +major_in_out +and +minor_in_out +with the major and minor extension versions of the library being used and +returns +NULL. +If the library is compatible, +XkbOpenDisplay +next calls +XOpenDisplay +with the +display_name. +If this fails, the function returns +NULL. +If successful, +XkbOpenDisplay +calls +XkbQueryExtension +and +backfills the major and minor Xkb server extension version numbers in +major_in_out +and +minor_in_out. If the server extension version is not compatible with the library extension -version or if the server extension is not present, -XkbOpenDisplay -closes the display and returns -NULL -. When successful, the function returns the display connection -. +version or if the server extension is not present, +XkbOpenDisplay +closes the display and returns +NULL. +When successful, the function returns the display connection. -The possible values for -reason_rtrn are: +The possible values for +reason_rtrn are: - -XkbOD_BadLibraryVersion - indicates -XkbLibraryVersion -returned -False. +XkbOD_BadLibraryVersion +indicates +XkbLibraryVersion +returned +False. - -XkbOD_ConnectionRefused - indicates the display could not be opened. +XkbOD_ConnectionRefused +indicates the display could not be opened. - -XkbOD_BadServerVersion - indicates the library and the server have incompatible extension versions. +XkbOD_BadServerVersion +indicates the library and the server have incompatible extension versions. - -XkbOD_NonXkbServer - indicates the extension is not present in the X server. +XkbOD_NonXkbServer +indicates the extension is not present in the X server. - -XkbOD_Success - indicates that the function succeeded. +XkbOD_Success +indicates that the function succeeded. @@ -484,84 +512,82 @@ functionality. -Call -XkbIgnoreExtension - to prevent core X library keyboard functions from using the X Keyboard -Extension. You must call -XkbIgnoreExtension - before you open a server connection; Xkb does not provide a way to enable or +Call +XkbIgnoreExtension +to prevent core X library keyboard functions from using the X Keyboard +Extension. You must call +XkbIgnoreExtension +before you open a server connection; Xkb does not provide a way to enable or disable use of the extension once a connection is established. - - - - - - - -Bool - XkbIgnoreExtension -( -ignore -) - - - - -Bool -ignore -; /* -True - means ignore the extension */ - - - - - +XkbIgnoreExtension + + + Bool XkbIgnoreExtension + + + Bool ignore + + + + + + ignore + + + + True means ignore the extension + + + + - -XkbIgnoreExtension - tells the X library whether to use the X Keyboard Extension on any -subsequently opened X display connections. If ignore is -True -, the library does not initialize the Xkb extension when it opens a new +XkbIgnoreExtension +tells the X library whether to use the X Keyboard Extension on any +subsequently opened X display connections. If ignore is +True, +the library does not initialize the Xkb extension when it opens a new display. This forces the X server to use compatibility mode and communicate with the client using only core protocol requests and events. If ignore is - -False -, the library treats subsequent calls to -XOpenDisplay - normally and uses Xkb extension requests, events, and state. Do not explicitly -use Xkb on a connection for which it is disabled. - XkbIgnoreExtension - returns -False - if it was unable to apply the ignore request. +False, +the library treats subsequent calls to +XOpenDisplay +normally and uses Xkb extension requests, events, and state. Do not explicitly +use Xkb on a connection for which it is disabled. +XkbIgnoreExtension +returns +False +if it was unable to apply the ignore request. Protocol Errors + +errors + Many of the Xkb extension library functions described in this document can cause the X server to report an error, referred to in this document as a - -BadXxx - protocol error, where -Xxx - is some name. These errors are fielded in the normal manner, by the default +BadXxx +protocol error, where +Xxx +is some name. These errors are fielded in the normal manner, by the default Xlib error handler or one replacing it. Note that X protocol errors are not necessarily reported immediately because of the buffering of X protocol requests in Xlib and the server. -Table 2.1 lists the protocol errors that can be generated, and their causes. +Table 2.1 +lists the protocol errors that can be generated, and their causes. -
+
Xkb Protocol Errors @@ -575,7 +601,7 @@ Table 2.1 lists the protocol errors that can be generated, and their causes. - BadAccess + BadAccess The Xkb extension has not been properly initialized @@ -583,7 +609,7 @@ The Xkb extension has not been properly initialized - BadKeyboard + BadKeyboard The device specified was not a valid core or input extension device @@ -591,7 +617,7 @@ The device specified was not a valid core or input extension device - BadImplementation + BadImplementation Invalid reply from server @@ -599,7 +625,7 @@ Invalid reply from server - BadAlloc + BadAlloc Unable to allocate storage @@ -607,7 +633,7 @@ Unable to allocate storage - BadMatch + BadMatch A compatible version of Xkb was not available in the server or an argument has @@ -616,7 +642,7 @@ correct type and range, but is otherwise invalid - BadValue + BadValue An argument is out of range @@ -624,16 +650,16 @@ An argument is out of range - BadAtom + BadAtom -A name is neither a valid Atom or -None +A name is neither a valid Atom or +None - BadDevice + BadDevice Device, Feedback Class, or Feedback ID invalid @@ -644,29 +670,33 @@ Device, Feedback Class, or Feedback ID invalid
- -The Xkb extension adds a single protocol error, -BadKeyboard -, to the core protocol error set. This error code will be reported as the - -error_rtrn - when -XkbQueryExtension - is called. When a -BadKeyboard - error is reported in an -XErrorEvent -, additional information is reported in the -resource_id - field. The most significant byte of the -resource_id - is a further refinement of the error cause, as defined in Table 2.2. The least + +errors +BadKeyboard + +BadKeyboard +The Xkb extension adds a single protocol error, +BadKeyboard, +to the core protocol error set. This error code will be reported as the +error_rtrn +when +XkbQueryExtension +is called. When a +BadKeyboard +error is reported in an +XErrorEvent, +additional information is reported in the +resourceid +field. The most significant byte of the +resource_id +is a further refinement of the error cause, as defined in +Table 2.2. The least significant byte will contain the device, class, or feedback ID as indicated in the table. - -BadKeyboard Protocol Error resource_id Values +
+<errorname>BadKeyboard</errorname> Protocol Error resource_id Values @@ -683,7 +713,7 @@ the table. - XkbErr_BadDevice + XkbErr_BadDevice 0xff @@ -693,7 +723,7 @@ device not found device ID - XkbErr_BadClass + XkbErr_BadClass 0xfe @@ -703,7 +733,7 @@ device found, but it is of the wrong class class ID - XkbErr_BadId + XkbErr_BadId 0xfd @@ -722,90 +752,85 @@ indicated ID Display and Device Specifications in Function Calls Where a connection to the server is passed as an argument (Display*) and an - -XkbDescPtr - is also passed as an argument, the Display* argument must match the -dpy - field of the -XkbDescRec - pointed to by the -XkbDescPtr - argument, or else the -dpy - field of the -XkbDescRec - must be -NULL -. If they don’t match or the -dpy - field is not -NULL -, a -BadMatch - error is returned (either in the return value or a backfilled -Status - variable). Upon successful return, the -dpy - field of the -XkbDescRec - always contains the Display* value passed in. +XkbDescPtr +is also passed as an argument, the Display* argument must match the +dpy +field of the +XkbDescRec +pointed to by the +XkbDescPtr +argument, or else the +dpy +field of the +XkbDescRec +must be +NULL. +If they don’t match or the +dpy +field is not +NULL, +a +BadMatch +error is returned (either in the return value or a backfilled +Status +variable). Upon successful return, the +dpy +field of the +XkbDescRec +always contains the Display* value passed in. The Xkb extension can communicate with the X input extension if it is present. Consequently, there can potentially be more than one input device connected to the server. Most Xkb library calls that require communicating with the server -involve both a server connection (Display * -dpy -) and a device identifier (unsigned int -device_spec -). In some cases, the device identifier is implicit and is taken as the - -device_spec - field of an -XkbDescRec - structure passed as an argument. - - - -The device identifier can specify any X input extension device with a -KeyClass - component, or it can specify the constant, -XkbUseCoreKbd -. The use of -XkbUseCoreKbd - allows applications to indicate the core keyboard without having to determine +involve both a server connection (Display * +dpy) +and a device identifier (unsigned int +device_spec). +In some cases, the device identifier is implicit and is taken as the +device_spec +field of an +XkbDescRec +structure passed as an argument. + + + +XkbUseCoreKbd +The device identifier can specify any X input extension device with a +KeyClass +component, or it can specify the constant, +XkbUseCoreKbd. +The use of +XkbUseCoreKbd +allows applications to indicate the core keyboard without having to determine its device identifier. -Where an Xkb device identifier is passed as an argument and an -XkbDescPtr - is also passed as an argument, if either the argument or the -XkbDescRec - -device_spec - field is -XkbUseCoreKbd -, and if the function returns successfully, the -XkbDescPtr - -device_spec - field will have been converted from -XkbUseCoreKbd - to a real Xkb device ID. If the function does not complete successfully, the - -device_spec - field remains unchanged. Subsequently, the device id argument must match the - -device_spec - field of the -XkbDescPtr - argument. If they don’t match, a -BadMatch - error is returned (either in the return value or a backfilled -Status - variable). +Where an Xkb device identifier is passed as an argument and an +XkbDescPtr +is also passed as an argument, if either the argument or the +XkbDescRec +device_spec +field is +XkbUseCoreKbd, +and if the function returns successfully, the +XkbDescPtr +device_spec +field will have been converted from +XkbUseCoreKbd +to a real Xkb device ID. If the function does not complete successfully, the +device_spec +field remains unchanged. Subsequently, the device id argument must match the +device_spec +field of the +XkbDescPtr +argument. If they don’t match, a +BadMatch +error is returned (either in the return value or a backfilled +Status +variable). @@ -813,11 +838,10 @@ When the Xkb extension in the server hands an application a device identifier to use for the keyboard, that ID is the input extension identifier for the device if the server supports the X Input Extension. If the server does not support the input extension, the meaning of the identifier is undefined — the -only guarantee is that when you use -XkbUseCoreKbd -, -XkbUseCoreKbd - will work and the identifier returned by the server will refer to the core +only guarantee is that when you use +XkbUseCoreKbd, +XkbUseCoreKbd +will work and the identifier returned by the server will refer to the core keyboard device. diff --git a/libX11/specs/XKB/ch03.xml b/libX11/specs/XKB/ch03.xml index 06d6d93f0..3aeb81b47 100644 --- a/libX11/specs/XKB/ch03.xml +++ b/libX11/specs/XKB/ch03.xml @@ -1,3 +1,6 @@ + + Data Structures @@ -73,20 +76,20 @@ values are properly updated for those Xkb structures that have interdependencies. As a general rule, if there is a helper function or macro to edit the data structure, use it. For example, increasing the width of a type requires you to resize every key that uses that type. This is complicated and -ugly, which is why there’s an -XkbResizeKeyType - function. +ugly, which is why there’s an +XkbResizeKeyType +function. Many Xkb data structures have arrays whose size is reported by two fields. The -first field, whose name is usually prefixed by -sz_ -, represents the total number of elements that can be stored in the array. The -second field, whose name is usually prefixed by -num_ -, specifies the number of elements currently stored there. These arrays +first field, whose name is usually prefixed by +sz_, +represents the total number of elements that can be stored in the array. The +second field, whose name is usually prefixed by +num_, +specifies the number of elements currently stored there. These arrays typically represent data whose total size cannot always be determined when the array is created. In these instances, the usual way to allocate space and add data is as follows: @@ -100,9 +103,9 @@ Call the allocator function with some arbitrary size, as a hint. -For those arrays that have an -Xkb...Add... - function, call it each time you want to add new data to the array. The +For those arrays that have an +Xkb...Add... +function, call it each time you want to add new data to the array. The function expands the array if necessary. @@ -110,33 +113,31 @@ function expands the array if necessary. For example, call: - - + XkbAllocGeomShapes(geom,4) - - - -to say "I’ll need space for four new shapes in this geometry." This makes -sure that -sz_shapes - - -num_shapes - >= 4, and resizes the shapes array if it isn’t. If this function + + +to say I’ll need space for four new shapes in this geometry. +This makes sure that +sz_shapes +− +num_shapes +>= 4, and resizes the shapes array if it isn’t. If this function succeeds, you are guaranteed to have space for the number of shapes you need. When you call an editing function for a structure, you do not need to check for -space, because the function automatically checks the -sz_ - and -num_ - fields of the array, resizes the array if necessary, adds the entry to the -array, and then updates the -num_ - field. +space, because the function automatically checks the +sz_ +and +num_ +fields of the array, resizes the array if necessary, adds the entry to the +array, and then updates the +num_ +field. @@ -156,9 +157,11 @@ description or even an entire data structure for only minor changes. To help you keep track of the changes you make to a local copy of the keyboard -description, Xkb provides separate special -changes - data structures for each major Xkb data structure. These data structures do +description, Xkb provides separate special +changes + +changes data structures +data structures for each major Xkb data structure. These data structures do not contain the actual changed values: they only indicate the changes that have been made to the structures that actually describe the keyboard. @@ -203,21 +206,21 @@ the server. When your client application receives a report from the server indicating the keyboard description has changed, you can determine the set of changes by -passing the event to an Xkb function that "notes" event information in the -corresponding changes data structure. These "note changes" functions are -defined for all major Xkb components, and their names have the form -XkbNote{Component}Changes -, where -Component - is the name of a major Xkb component such as -Map - or -Names -. When you want to copy these changes from the server into a local copy of the -keyboard description, use the corresponding -XkbGet{Component}Changes - function -, +passing the event to an Xkb function that notes event +information in the corresponding changes data structure. These +note changes functions are +defined for all major Xkb components, and their names have the form +XkbNote{Component}Changes, +where +Component +is the name of a major Xkb component such as +Map +or +Names. +When you want to copy these changes from the server into a local copy of the +keyboard description, use the corresponding +XkbGet{Component}Changes +function, passing it the changes structure. The function then retrieves only the changed structures from the server and copies the modified pieces into the local keyboard description. @@ -228,20 +231,19 @@ keyboard description. Freeing Data Structures -For the same reasons you should not directly use -malloc - to allocate Xkb data structures, you should not free Xkb data structures or -components directly using -free - or -Xfree -. Xkb provides functions to free the various data structures and their +For the same reasons you should not directly use +malloc +to allocate Xkb data structures, you should not free Xkb data structures or +components directly using +free +or +Xfree. +Xkb provides functions to free the various data structures and their components. Always use the free functions supplied by Xkb. There is no -guarantee that any particular field can be safely freed by -free - or -Xfree -. +guarantee that any particular field can be safely freed by +free +or +Xfree. diff --git a/libX11/specs/XKB/ch04.xml b/libX11/specs/XKB/ch04.xml index 223b44497..dee00b32f 100644 --- a/libX11/specs/XKB/ch04.xml +++ b/libX11/specs/XKB/ch04.xml @@ -1,5 +1,9 @@ + + Xkb Events +events The primary way the X server communicates with clients is by sending X events @@ -17,25 +21,24 @@ Xkb keyboard status events are reported to all interested clients, regardless of which window currently has the keyboard focus and regardless of the grab state of the keyboard.The one exception to this rule is the XkbExtensionDeviceNotify event report that is sent when a client attempts to -use an unsupported feature of an X Input Extension device (see section 21.4). - +use an unsupported feature of an X Input Extension device (see section 21.4). + The X server reports the events defined by the Xkb extension to your client application only if you have requested them. You may request Xkb events by -calling either -XkbSelectEvents - or -XkbSelectEventDetails -. -XkbSelectEvents - requests Xkb events by their event type and causes them to be reported to your +calling either +XkbSelectEvents +or +XkbSelectEventDetails. +XkbSelectEvents +requests Xkb events by their event type and causes them to be reported to your client application under all circumstances. You can specify a finer granularity -for event reporting by using -XkbSelectEventDetails -; in this case events are reported only when the specific detail conditions you +for event reporting by using +XkbSelectEventDetails; +in this case events are reported only when the specific detail conditions you specify have been met. @@ -45,220 +48,109 @@ specify have been met. The Xkb Extension adds new event types to the X protocol definition. An Xkb event type is defined by two fields in the X event data structure. One is the - -type - field, containing the -base event code. - This base event code is a value the X server assigns to each X extension at -runtime and thatidentifies the extension that generated the event; thus, the -event code in the -type - field identifies the event as an Xkb extension event, rather than an event +type +field, containing the +base event code. +This base event code is a value the X server assigns to each X extension at +runtime and that identifies the extension that generated the event; thus, the +event code in the +type +field identifies the event as an Xkb extension event, rather than an event from another extension or a core X protocol event. You can obtain the base -event code via a call to -XkbQueryExtension - or -XkbOpenDisplay -. The second field is the Xkb event type, which contains a value uniquely +event code via a call to +XkbQueryExtension +or +XkbOpenDisplay. +The second field is the Xkb event type, which contains a value uniquely identifying each different Xkb event type. Possible values are defined by -constants declared in the header file <X11/extensions/Xkb.h>. +constants declared in the header file +<X11/extensions/Xkb.h>. -Table 4.1 lists the categories of events defined by Xkb and their associated -event types, as defined in -Xkb.h -. Each event is described in more detail in the section referenced for that +Table 4.1 +lists the categories of events defined by Xkb and their associated +event types, as defined in +Xkb.h. +Each event is described in more detail in the section referenced for that event. -
+
Xkb Event Types - + - Event Type Conditions Generating Event Section - Page - - XkbNewKeyboardNotify - - - Keyboard geometry; keycode range change - - - 19 - - - 187 - + XkbNewKeyboardNotify + Keyboard geometry; keycode range change + 19 - - - XkbMapNotify - - - - Keyboard mapping change - - - 14.4 - - - 122 - + XkbMapNotify + Keyboard mapping change + 14.4 - - XkbStateNotify - - - Keyboard state change - - - 5.4 - - - 25 - + XkbStateNotify + Keyboard state change + 5.4 - - XkbControlsNotify - - - Keyboard controls state change - - - 10.11 - - - 79 - + XkbControlsNotify + Keyboard controls state change + 10.11 - - XkbIndicatorStateNotify - - - Keyboard indicators state change - - - 8.5 - - - 45 - + XkbIndicatorStateNotify + Keyboard indicators state change + 8.5 - - XkbIndicatorMapNotify - - - Keyboard indicators map change - - - 8.5 - - - 45 - + XkbIndicatorMapNotify + Keyboard indicators map change + 8.5 - - XkbNamesNotify - - - Keyboard name change - - - 18.5 - - - 185 - + XkbNamesNotify + Keyboard name change + 18.5 - - XkbCompatMapNotify - - - Keyboard compatibility map change - - - 17.5 - - - 178 - + XkbCompatMapNotify + Keyboard compatibility map change + 17.5 - - XkbBellNotify - - - Keyboard bell generated - - - 9.4 - - - 52 - + XkbBellNotify + Keyboard bell generated + 9.4 - - XkbActionMessage - - - Keyboard action message - - - 16.1.11 - - - 155 - + XkbActionMessage + Keyboard action message + 16.1.11 - - XkbAccessXNotify - - - AccessX state change - - - 10.6.4 - - - 65 - + XkbAccessXNotify + AccessX state change + 10.6.4 - - XkbExtensionDeviceNotify - - - Extension device change - - - 21.6 - - - 207 - + XkbExtensionDeviceNotify + Extension device change + 21.6 @@ -268,63 +160,61 @@ event. Xkb Event Data Structures - + + +eventsXkbAnyEvent + +XkbAnyEvent Xkb reports each event it generates in a unique structure holding the data values needed to describe the conditions the event is reporting. However, all Xkb events have certain things in common. These common features are contained in the same fields at the beginning of all Xkb event structures and are -described in the -XkbAnyEvent - structure: - +described in the +XkbAnyEvent +structure: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event -generated */ - Time time; /* server time when event generated */ - int xkb_type; /* Xkb minor event code */ - unsigned int device; /* Xkb device ID, will not be - XkbUseCoreKbd */ -} XkbAnyEvent -; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* Xkb minor event code */ + unsigned int device; /* Xkb device ID, will not be XkbUseCoreKbd */ +} XkbAnyEvent; -For any Xkb event, the -type - field is set to the base event code for the Xkb extension, assigned by the -server to all Xkb extension events. The -serial -, -send_event -, and -display - fields are as described for all X11 events. The -time - field is set to the time when the event was generated and is expressed in -milliseconds. The -xkb_type - field contains the minor extension event code, which is the extension event -type, and is one of the values listed in Table 4.1. The -device - field contains the keyboard device identifier associated with the event. This -is never -XkbUseCoreKbd -, even if the request that generated the event specified a device of -XkbUseCoreKbd -. If the request that generated the event specified -XkbUseCoreKbd -, -device - contains a value assigned by the server to specify the core keyboard. If the +For any Xkb event, the +type +field is set to the base event code for the Xkb extension, assigned by the +server to all Xkb extension events. The +serial, +send_event, +and +display +fields are as described for all X11 events. The +time +field is set to the time when the event was generated and is expressed in +milliseconds. The +xkb_type +field contains the minor extension event code, which is the extension event +type, and is one of the values listed in +Table 4.1. The +device +field contains the keyboard device identifier associated with the event. This +is never +XkbUseCoreKbd, +even if the request that generated the event specified a device of +XkbUseCoreKbd. +If the request that generated the event specified +XkbUseCoreKbd, +device +contains a value assigned by the server to specify the core keyboard. If the request that generated the event specified an X input extension device, - -device - contains that same identifier. +device +contains that same identifier. @@ -337,6 +227,10 @@ chapters where the events are described. Selecting Xkb Events + +eventsmask + +maskevent Xkb events are selected using an event mask, much the same as normal core X @@ -363,18 +257,16 @@ same granularity. Xkb provides two functions to select and deselect delivery of Xkb events. - -XkbSelectEvents - allows you to select or deselect delivery of more than one Xkb event type at -once. Events selected using -XkbSelectEvents - are delivered to your program under all circumstances that generate the +XkbSelectEvents +allows you to select or deselect delivery of more than one Xkb event type at +once. Events selected using +XkbSelectEvents +are delivered to your program under all circumstances that generate the events. To restrict delivery of an event to a subset of the conditions under -which it occurs, use -XkbSelectEventDetails -. -XkbSelectEventDetails - only allows you to change the selection conditions for a single event at a +which it occurs, use +XkbSelectEventDetails. +XkbSelectEventDetails +only allows you to change the selection conditions for a single event at a time, but it provides a means of fine-tuning the conditions under which the event is delivered. @@ -382,259 +274,269 @@ event is delivered. To select and / or deselect for delivery of one or more Xkb events and have -them delivered under all conditions, use -XkbSelectEvents -. +them delivered under all conditions, use +XkbSelectEvents. - - - - - - - -Bool -XkbSelectEvents -( -display, device_spec, bits_to_change, values_for_bits -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned long int -bits_to_change; -/* determines events to be selected / deselected */ - - - - -unsigned long int -values_for_bits -; /* 1=>select, 0->deselect; for events in -bits_to_change - */ - - - - - +XkbSelectEvents + + + Bool XkbSelectEvents + + + Display *display + unsigned int device_spec + unsigned long int bits_to_change + unsigned long int values_for_bits + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + bits_to_change + + + + determines events to be selected / deselected + + + + + + values_for_bits + + + + 1⇒select, 0→deselect; for events in bits_to_change + + + + This request changes the Xkb event selection mask for the keyboard specified by - -device_spec -. +device_spec. -Each Xkb event that can be selected is represented by a bit in the -bits_to_change - and -values_for_bits - masks. Only the event selection bits specified by the -bits_to_change - parameter are affected; any unspecified bits are left unchanged. To turn on -event selection for an event, set the bit for the event in the -bits_to_change - parameter and set the corresponding bit in the -values_for_bits - parameter. To turn off event selection for an event, set the bit for the event -in the -bits_to_change - parameter and do not set the corresponding bit in the -values_for_bits - parameter. The valid values for both of these parameters are an inclusive -bitwise OR of the masks shown in Table 4.2. There is no interface to return +Each Xkb event that can be selected is represented by a bit in the +bits_to_change +and +values_for_bits +masks. Only the event selection bits specified by the +bits_to_change +parameter are affected; any unspecified bits are left unchanged. To turn on +event selection for an event, set the bit for the event in the +bits_to_change +parameter and set the corresponding bit in the +values_for_bits +parameter. To turn off event selection for an event, set the bit for the event +in the +bits_to_change +parameter and do not set the corresponding bit in the +values_for_bits +parameter. The valid values for both of these parameters are an inclusive +bitwise OR of the masks shown in Table 4.2. +There is no interface to return your client’s current event selection mask. Clients cannot set other clients’ event selection masks. -If a bit is not set in the -bits_to_change - parameter, but the corresponding bit is set in the -values_for_bits - parameter, a -BadMatch - protocol error results. If an undefined bit is set in either the -bits_to_change - or the -values_for_bits - parameter, a -BadValue - protocol error results. +If a bit is not set in the +bits_to_change +parameter, but the corresponding bit is set in the +values_for_bits +parameter, a +BadMatch +protocol error results. If an undefined bit is set in either the +bits_to_change +or the +values_for_bits +parameter, a +BadValue +protocol error results. All event selection bits are initially zero for clients using the Xkb extension. Once you set some bits, they remain set for your client until you -clear them via another call to -XkbSelectEvents -. +clear them via another call to +XkbSelectEvents. - -XkbSelectEvents - returns -False - if the Xkb extension has not been initilialized and -True - otherwise. +XkbSelectEvents +returns +False +if the Xkb extension has not been initialized and +True +otherwise. To select or deselect for a specific Xkb event and optionally place conditions -on when events of that type are reported to your client, use -XkbSelectEventDetails -. This allows you to exercise a finer granularity of control over delivery of -Xkb events with -XkbSelectEvents -. +on when events of that type are reported to your client, use +XkbSelectEventDetails. +This allows you to exercise a finer granularity of control over delivery of +Xkb events with +XkbSelectEvents. - - - - - - - -Bool -XkbSelectEventDetails -( -display, device_spec, event_type, bits_to_change -, -values_for_bits -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int -event_type -; /* Xkb event type of interest */ - - - - -unsigned long int -bits_to_change -; /* event selection details */ - - - - -unsigned long int -values_for_bits -; /* values for bits selected by -bits_to_change - */ - - - - - +XkbSelectEventDetails + + + Bool XkbSelectEventDetails + + + Display *display + unsigned int device_spec + unsigned int event_type + unsigned long int bits_to_change + unsigned long int values_for_bits + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + event_type + + + + Xkb event type of interest + + + + + + bits_to_change + + + + event selection details + + + + + + values_for_bits + + + + values for bits selected by bits_to_change + + + + -While -XkbSelectEvents - allows multiple events to be selected, -XkbSelectEventDetails - changes the selection criteria for a single type of Xkb event. The -interpretation of the -bits_to_change - and -values_for_bits - masks depends on the event type in question. +While +XkbSelectEvents +allows multiple events to be selected, +XkbSelectEventDetails +changes the selection criteria for a single type of Xkb event. The +interpretation of the +bits_to_change +and +values_for_bits +masks depends on the event type in question. - -XkbSelectEventDetails - changes the Xkb event selection mask for the keyboard specified by -device_spec - and the Xkb event specified by -event_type -. To turn on event selection for an event detail, set the bit for the detail in -the -bits_to_change - parameter and set the corresponding bit in the -values_for_bits - parameter. To turn off event detail selection for a detail, set the bit for -the detail in the -bits_to_change - parameter and do not set the corresponding bit in the -values_for_bits - parameter. +XkbSelectEventDetails +changes the Xkb event selection mask for the keyboard specified by +device_spec +and the Xkb event specified by +event_type. +To turn on event selection for an event detail, set the bit for the detail in +the +bits_to_change +parameter and set the corresponding bit in the +values_for_bits +parameter. To turn off event detail selection for a detail, set the bit for +the detail in the +bits_to_change +parameter and do not set the corresponding bit in the +values_for_bits +parameter. -If an invalid event type is specified, a -BadValue - protocol error results. If a bit is not set in the -bits_to_change - parameter, but the corresponding bit is set in the -values_for_bits - parameter, a -BadMatch - protocol error results. If an undefined bit is set in either the -bits_to_change - or the -values_for_bits - parameter, a -BadValue - protocol error results. +If an invalid event type is specified, a +BadValue +protocol error results. If a bit is not set in the +bits_to_change +parameter, but the corresponding bit is set in the +values_for_bits +parameter, a +BadMatch +protocol error results. If an undefined bit is set in either the +bits_to_change +or the +values_for_bits +parameter, a +BadValue +protocol error results. For each type of Xkb event, the legal event details that you can specify in the - -XkbSelectEventDetails - request are listed in the chapters that describe each event in detail. +XkbSelectEventDetails +request are listed in the chapters that describe each event in detail. @@ -643,23 +545,23 @@ XkbSelectEventDetails The X server reports the events defined by Xkb to your client application only -if you have requested them via a call to -XkbSelectEvents - or -XkbSelectEventDetails -. Specify the event types in which you are interested in a mask, as described -in section 4.3. +if you have requested them via a call to +XkbSelectEvents +or +XkbSelectEventDetails. +Specify the event types in which you are interested in a mask, as described +in section 4.3. -Table 4.2 lists the event mask constants that can be specified with the - -XkbSelectEvents - request and the circumstances in which the mask should be specified. +Table 4.2 +lists the event mask constants that can be specified with the +XkbSelectEvents +request and the circumstances in which the mask should be specified. -
+
XkbSelectEvents Mask Constants @@ -676,91 +578,91 @@ XkbSelectEvents -XkbNewKeyboardNotifyMask +XkbNewKeyboardNotifyMask (1L<<0) Keyboard geometry change - XkbMapNotifyMask + XkbMapNotifyMask (1L<<1) Keyboard mapping change -XkbStateNotifyMask +XkbStateNotifyMask (1L<<2) Keyboard state change -XkbControlsNotifyMask +XkbControlsNotifyMask (1L<<3) Keyboard control change -XkbIndicatorStateNotifyMask +XkbIndicatorStateNotifyMask (1L<<4) Keyboard indicator state change -XkbIndicatorMapNotifyMask +XkbIndicatorMapNotifyMask (1L<<5) Keyboard indicator map change -XkbNamesNotifyMask +XkbNamesNotifyMask (1L<<6) Keyboard name change -XkbCompatMapNotifyMask +XkbCompatMapNotifyMask (1L<<7) Keyboard compat map change -XkbBellNotifyMask +XkbBellNotifyMask (1L<<8) Bell -XkbActionMessageMask +XkbActionMessageMask (1L<<9) Action message -XkbAccessXNotifyMask +XkbAccessXNotifyMask (1L<<10) AccessX features -XkbExtensionDeviceNotifyMask +XkbExtensionDeviceNotifyMask (1L<<11) Extension device -XkbAllEventsMask +XkbAllEventsMask (0xFFF) All Xkb events @@ -773,23 +675,27 @@ XkbSelectEvents Unified Xkb Event Type + +eventsXkbEvent + +XkbEvent -The -XkbEvent - structure is a union of the individual structures declared for each Xkb event -type and for the core protocol -XEvent - type. Given an -XkbEvent - structure, you may use the -type - field to determine if the event is an Xkb event ( -type - equals the Xkb base event code; see section 2.4). If the event is an Xkb -event, you may then use the -any.xkb_type - field to determine the type of Xkb event and thereafter access the +The +XkbEvent +structure is a union of the individual structures declared for each Xkb event +type and for the core protocol +XEvent +type. Given an +XkbEvent +structure, you may use the +type +field to determine if the event is an Xkb event +(type +equals the Xkb base event code; see section 2.4). If the event is an Xkb +event, you may then use the +any.xkb_type +field to determine the type of Xkb event and thereafter access the event-dependent components using the union member corresponding to the particular Xkb event type. @@ -810,20 +716,20 @@ typedef union _XkbEvent { XkbExtensionDeviceNotifyEvent device; XkbNewKeyboardNotifyEvent new_kbd; XEvent core; -} XkbEvent; +} XkbEvent; -This unified Xkb event type includes a normal -XEvent - as used by the core protocol, so it is straightforward for applications that +This unified Xkb event type includes a normal +XEvent +as used by the core protocol, so it is straightforward for applications that use Xkb events to call the X library event functions without having to cast every reference. For example, to get the next event, you can simply declare a -variable of type -XkbEvent - and call: - +variable of type +XkbEvent +and call: -XNextEvent(dpy,&xkbev.core); +XNextEvent(dpy,&xkbev.core); + diff --git a/libX11/specs/XKB/ch05.xml b/libX11/specs/XKB/ch05.xml index 3a507aa3b..77d1995e0 100644 --- a/libX11/specs/XKB/ch05.xml +++ b/libX11/specs/XKB/ch05.xml @@ -1,16 +1,21 @@ + + Keyboard State -Keyboard state encompasses all of the transitory information necessary to map a physical key press or release to an appropriate event. The Xkb keyboard state consists of primitive components and additional derived components that are maintained for efficiency reasons. Figure 5.1 shows the components of Xkb keyboard state and their relationships. +Keyboard state encompasses all of the transitory information necessary to map a physical key press or release to an appropriate event. The Xkb keyboard state consists of primitive components and additional derived components that are maintained for efficiency reasons. Figure 5.1 shows the components of Xkb keyboard state and their relationships. - - - - - - +
+ Xkb State + + + + + +
@@ -47,29 +52,33 @@ The state of the core pointer buttons - -The -modifiers - are -Shift -, -Lock -, -Control -, and -Mod1 -- -Mod5 -, as defined by the core protocol. A modifier can be thought of as a toggle that is either set or unset. All modifiers are initially unset. When a modifier is locked, it is set and remains set for all future key events, until it is explicitly unset. A latched modifier is set, but automatically unsets after the next key event that does not change the keyboard state. Locked and latched modifier state can be changed by keyboard activity or via Xkb extension library functions. + +The +modifiers + +modifiers +are +Shift, +Lock, +Control, +and +Mod1 +– +Mod5, +as defined by the core protocol. A modifier can be thought of as a toggle that is either set or unset. All modifiers are initially unset. When a modifier is locked, it is set and remains set for all future key events, until it is explicitly unset. A latched modifier is set, but automatically unsets after the next key event that does not change the keyboard state. Locked and latched modifier state can be changed by keyboard activity or via Xkb extension library functions. - -The Xkb extension provides support for -keysym - -groups -, as defined by ISO9995: + +The Xkb extension provides support for +keysym groups, + +keysym groups + +groupkeysym + +groupISO9995 +as defined by ISO9995: @@ -99,22 +108,30 @@ Changing to a different group changes the keyboard state to produce characters f -The -pointer buttons - are -Button1 - - -Button5 -, as defined by the core protocol. +The +pointer buttons +are +Button1 +– +Button5, +as defined by the core protocol. - -The -base group - and -base modifiers - represent keys that are physically or logically down. These + +The +base group + +base group + +groupbase +and +base modifiers + +base modifiers + +modifiersbase +represent keys that are physically or logically down. These and the pointer buttons can be changed by keyboard activity and not by Xkb requests. It is possible for a key to be logically down, but not physically down, and neither latched nor locked. @@ -127,17 +144,25 @@ in the X server having filtered the key release, for esoteric reasons. - -The -effective modifiers - are the bitwise union of the locked, latched, and the base modifiers. + +The +effective modifiers + +effective modifiers + +modifierseffective +are the bitwise union of the locked, latched, and the base modifiers. - -The -effective group - is the arithmetic sum of the group indices of the latched group, locked group, and base group, which is then normalized by some function. The result is a meaningful group index. + +The +effective group + +effective group + +groupeffective +is the arithmetic sum of the group indices of the latched group, locked group, and base group, which is then normalized by some function. The result is a meaningful group index. @@ -165,19 +190,19 @@ There are two circumstances under which groups are normalized: -The global locked or effective group changes. In this case, the changed group is normalized into range according to the settings of the -groups_wrap - field of the -XkbControlsRec - structure for the keyboard (see section 10.7.1). +The global locked or effective group changes. In this case, the changed group is normalized into range according to the settings of the +groups_wrap +field of the +XkbControlsRec +structure for the keyboard (see section 10.7.1). -The Xkb library is interpreting an event with an effective group that is legal for the keyboard as a whole, but not for the key in question. In this case, the group to use for this event only is determined using the -group_info - field of the key symbol mapping ( -XkbSymMapRec -) for the event key. +The Xkb library is interpreting an event with an effective group that is legal for the keyboard as a whole, but not for the key in question. In this case, the group to use for this event only is determined using the +group_info +field of the key symbol mapping +(XkbSymMapRec) +for the event key. @@ -186,12 +211,17 @@ Each nonmodifier key on a keyboard has zero or more symbols, or keysyms, associa - -A client that does not explicitly call Xkb functions, but that otherwise makes use of an X library containing the Xkb extension, will have keyboard state represented in bits 0 - 14 of the state field of events that report modifier and button state. Such a client is said to be -Xkb-capable -. A client that does explicitly call Xkb functions is an -Xkb-aware - client. The Xkb keyboard state includes information derived from the effective state and from two server parameters that can be set through the keyboard extension. The following components of keyboard state pertain to Xkb-capable and Xkb-aware clients: + +A client that does not explicitly call Xkb functions, but that otherwise makes use of an X library containing the Xkb extension, will have keyboard state represented in bits 0 – 14 of the state field of events that report modifier and button state. Such a client is said to be +Xkb-capable. + +Xkb-capable client + +A client that does explicitly call Xkb functions is an +Xkb-aware + +Xkb-aware client +client. The Xkb keyboard state includes information derived from the effective state and from two server parameters that can be set through the keyboard extension. The following components of keyboard state pertain to Xkb-capable and Xkb-aware clients: @@ -207,29 +237,33 @@ grab state: grab group and grab modifiers - -The -lookup modifiers - and -lookup group - are represented in the state field of core X events. The modifier state and keycode of a key event are used to determine the symbols associated with the event. For -KeyPress - and -KeyRelease - events, the lookup modifiers are computed as: + +The +lookup modifiers + +lookup modifiers + +modifierslookup +and +lookup group + +lookup group + +grouplookup +are represented in the state field of core X events. The modifier state and keycode of a key event are used to determine the symbols associated with the event. For +KeyPress +and +KeyRelease +events, the lookup modifiers are computed as: + + ((base | latched | locked) & ~server_internal_modifiers) - - ((base | latched | locked) & ~ server_internal_modifiers) - - Otherwise the lookup modifiers are computed as: - - -(((base | latched | (locked & ~ ignore_locks)) & ~ server_internal_modifiers) - + (((base | latched | (locked & ~ignore_locks)) & ~server_internal_modifiers) + The lookup group is the same as the effective group. @@ -237,36 +271,50 @@ The lookup group is the same as the effective group. -When an Xkb-capable or Xkb-aware client wishes to map a keycode to a keysym, it should use the -lookup state - — the lookup group and the lookup modifiers. +When an Xkb-capable or Xkb-aware client wishes to map a keycode to a keysym, it should use the +lookup state + +lookup state + +statelookup +— the lookup group and the lookup modifiers. - -The -grab state - is the state used when matching events to passive grabs. If the event activates a grab, the -grab modifiers - and -grab group - are represented in the state field of core X events; otherwise, the lookup state is used. The grab modifiers are computed as: + +The +grab state + +grab state + +stategrab +is the state used when matching events to passive grabs. If the event activates a grab, the +grab modifiers + +grab modifiers + +modifiersgrab +and +grab group + +grab group + +groupgrab +are represented in the state field of core X events; otherwise, the lookup state is used. The grab modifiers are computed as: + + (((base | latched | (locked & ~ignore_locks)) & ~server_internal_modifiers) - -(((base | latched | (locked & ~ignore_locks)) & ~server_internal_modifiers) - - -If the server’s -IgnoreGroupLock - control (see section 10.7.3) is not set, the grab group is the same as the effective group. Otherwise, the grab group is computed from the base group and latched group, ignoring the locked group. +If the server’s +IgnoreGroupLock +control (see section 10.7.3) is not set, the grab group is the same as the effective group. Otherwise, the grab group is computed from the base group and latched group, ignoring the locked group. -The final three components of Xkb state are applicable to clients that are not linked with an Xlib containing the X keyboard extension library and therefore are not aware of the keyboard extension ( -Xkb-unaware +The final three components of Xkb state are applicable to clients that are not linked with an Xlib containing the X keyboard extension library and therefore are not aware of the keyboard extension +(Xkb-unaware clients): @@ -300,13 +348,20 @@ The X11 protocol interpretation of modifiers does not include direct support for Changing Modifiers + +real modifiers + +modifiersreal + +maskreal modifiers + -The functions in this section that change the use of modifiers use a mask in the parameter -affect -. It is a bitwise inclusive OR of the legal modifier masks: +The functions in this section that change the use of modifiers use a mask in the parameter +affect. +It is a bitwise inclusive OR of the legal modifier masks: -
Xkb State
+
Real Modifier Masks @@ -344,153 +399,165 @@ affect
-To lock and unlock any of the eight real keyboard modifiers, use -XkbLockModifiers: +To lock and unlock any of the eight real keyboard modifiers, use +XkbLockModifiers: - - - - - - - -Bool XkbLockModifiers -( -display, device_spec, affect, values -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int - affect -; /* mask of real modifiers whose lock state is to change */ - - - - -unsigned int -values -; /* 1 => lock, 0 => unlock; only for modifiers selected by -affect - */ - - - - - +XkbLockModifiers + + + Bool XkbLockModifiers + + + Display *display + unsigned int device_spec + unsigned int affect + unsigned int values + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + affect + + + + mask of real modifiers whose lock state is to change + + + + + + values + + + + 1 ⇒ lock, 0 ⇒ unlock; only for modifiers selected by affect + + + + - -XkbLockModifiers - sends a request to the server to lock the real modifiers selected by both -affect - and -values - and to unlock the real modifiers selected by -affect - but not selected by -values -. -XkbLockModifiers - does not wait for a reply from the server. It returns -True - if the request was sent, and -False - otherwise. +XkbLockModifiers +sends a request to the server to lock the real modifiers selected by both +affect +and +values +and to unlock the real modifiers selected by +affect +but not selected by +values. +XkbLockModifiers +does not wait for a reply from the server. It returns +True +if the request was sent, and +False +otherwise. -To latch and unlatch any of the eight real keyboard modifiers, use -XkbLatchModifiers: +To latch and unlatch any of the eight real keyboard modifiers, use +XkbLatchModifiers: - - - - - - - -Bool -XkbLatchModifiers -(d -isplay, device_spec, affect, values -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int - affect -; /* mask of modifiers whose latch state is to change */ - - - - -unsigned int values; -/* 1 => latch, 0 => unlatch; only for mods selected by -affect - */ - - - - - +XkbLatchModifiers + + + Bool XkbLatchModifiers + + + Display *display + unsigned int device_spec + unsigned int affect + unsigned int values + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + affect + + + + mask of modifiers whose latch state is to change + + + + + + values + + + + 1 ⇒ latch, 0 ⇒ unlatch; only for mods selected by affect + + + + - -XkbLatchModifiers - sends a request to the server to latch the real modifiers selected by both -affect - and -values - and to unlatch the real modifiers selected by -affect - but not selected by -values -. -XkbLatchModifiers - does not wait for a reply from the server. It returns -True - if the request was sent, and -False - otherwise. +XkbLatchModifiers +sends a request to the server to latch the real modifiers selected by both +affect +and +values +and to unlatch the real modifiers selected by +affect +but not selected by +values. +XkbLatchModifiers +does not wait for a reply from the server. It returns +True +if the request was sent, and +False +otherwise. @@ -498,11 +565,16 @@ False Changing Groups + +keysym groups + +groupkeysym + Reference the keysym group indices with these symbolic constants: - +
Symbolic Group Names @@ -514,19 +586,19 @@ Reference the keysym group indices with these symbolic constants: Value - XkbGroup1Index + XkbGroup1Index 0 - XkbGroup2Index + XkbGroup2Index 1 - XkbGroup3Index + XkbGroup3Index 2 - XkbGroup4Index + XkbGroup4Index 3 @@ -534,119 +606,127 @@ Reference the keysym group indices with these symbolic constants:
-To lock the keysym group, use -XkbLockGroup. +To lock the keysym group, use +XkbLockGroup. - - - - - - - -Bool -XkbLockGroup -( -display, device_spec, group -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int -group -; /* index of the keysym group to lock */ - - - - - +XkbLockGroup + + + Bool XkbLockGroup + + + Display *display + unsigned int device_spec + unsigned int group + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + group + + + + index of the keysym group to lock + + + + - -XkbLockGroup - sends a request to the server to lock the specified -group -and does not wait for a reply. It returns -True - if the request was sent and -False - otherwise. +XkbLockGroup +sends a request to the server to lock the specified +group +and does not wait for a reply. It returns +True +if the request was sent and +False +otherwise. -To latch the keysym group, use -XkbLatchGroup. +To latch the keysym group, use +XkbLatchGroup. - - - - - - - -Bool -XkbLatchGroup -( -display, device_spec, group -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int - device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int - group -; /* index of the keysym group to latch */ - - - - - +XkbLatchGroup + + + Bool XkbLatchGroup + + + Display *display + unsigned int device_spec + unsigned int group + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + group + + + + index of the keysym group to latch + + + + - -XkbLatchGroup - sends a request to the server to latch the specified group and does not wait for a reply. It returns -True - if the request was sent and -False - otherwise. +XkbLatchGroup +sends a request to the server to latch the specified group and does not wait for a reply. It returns +True +if the request was sent and +False +otherwise. @@ -655,89 +735,95 @@ False Determining Keyboard State + +XkbStateRec + -Xkb keyboard state may be represented in an -XkbStateRec - structure: - +Xkb keyboard state may be represented in an +XkbStateRec +structure: - + typedef struct { - unsigned char group; /* effective group index */ - unsigned char base_group; /* base group index */ - unsigned char latched_group; /* latched group index */ - unsigned char locked_group; /* locked group index */ - unsigned char mods; /* effective modifiers */ - unsigned char base_mods; /* base modifiers */ - unsigned char latched_mods; /* latched modifiers */ - unsigned char locked_mods; /* locked modifiers */ - unsigned char compat_state; /* effective group => modifiers */ - unsigned char grab_mods; /* modifiers used for grabs */ - unsigned char compat_grab_mods; /* mods used for compatibility mode grabs */ - unsigned char lookup_mods; /* modifiers used to lookup symbols */ - unsigned char compat_lookup_mods; /* mods used for compatibility lookup */ - unsigned short ptr_buttons; /* 1 bit => corresponding pointer btn is down */ -} -XkbStateRec -,*XkbStatePtr; + unsigned char group; /* effective group index */ + unsigned char base_group; /* base group index */ + unsigned char latched_group; /* latched group index */ + unsigned char locked_group; /* locked group index */ + unsigned char mods; /* effective modifiers */ + unsigned char base_mods; /* base modifiers */ + unsigned char latched_mods; /* latched modifiers */ + unsigned char locked_mods; /* locked modifiers */ + unsigned char compat_state; /* effective group ⇒ modifiers */ + unsigned char grab_mods; /* modifiers used for grabs */ + unsigned char compat_grab_mods; /* mods used for compatibility + mode grabs */ + unsigned char lookup_mods; /* mods used to lookup symbols */ + unsigned char compat_lookup_mods; /* mods used for compatibility + lookup */ + unsigned short ptr_buttons; /* 1 bit ⇒ corresponding + pointer btn is down */ +} XkbStateRec, *XkbStatePtr; -To obtain the keyboard state, use -XkbGetState. +To obtain the keyboard state, use +XkbGetState. - - - - - - - -Status -XkbGetState -( -display -, -device_spec -, -state_return -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -XkbStatePtr -state_return -; /* backfilled with Xkb state */ - - - - - +XkbGetState + + + Status XkbGetState + + + Display *display + unsigned int device_spec + XkbStatePtr state_return + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + state_return + + + + backfilled with Xkb state + + + + -The -XkbGetState -function queries the server for the current keyboard state, waits for a reply, and then backfills -state_return - with the results. +The +XkbGetState +function queries the server for the current keyboard state, waits for a reply, and then backfills +state_return +with the results. @@ -750,20 +836,27 @@ All group values are expressed as group indices in the range [0..3]. Modifiers a Tracking Keyboard State + +eventsXkbStateNotify + +XkbStateNotifyEvent + -The Xkb extension reports -XkbStateNotify -events to clients wanting notification whenever the Xkb state changes. The changes reported include changes to any aspect of the keyboard state: when a modifier is set or unset, when the current group changes, or when a pointer button is pressed or released. As with all Xkb events, -XkbStateNotify - events are reported to all interested clients without regard to the current keyboard input focus or grab state. +The Xkb extension reports +XkbStateNotify +events to clients wanting notification whenever the Xkb state changes. The changes reported include changes to any aspect of the keyboard state: when a modifier is set or unset, when the current group changes, or when a pointer button is pressed or released. As with all Xkb events, +XkbStateNotify +events are reported to all interested clients without regard to the current keyboard input focus or grab state. -There are many different types of Xkb state changes. Xkb defines an event detail mask corresponding to each type of change. The event detail masks are listed in Table 5.3. +There are many different types of Xkb state changes. Xkb defines an event +detail mask corresponding to each type of change. The event detail masks are +listed in Table 5.3. - +
XkbStateNotify Event Detail Masks @@ -777,63 +870,63 @@ There are many different types of Xkb state changes. Xkb defines an event detail - XkbModifierStateMask + XkbModifierStateMask (1L << 0) - XkbModifierBaseMask + XkbModifierBaseMask (1L << 1) - XkbModifierLatchMask + XkbModifierLatchMask (1L << 2) - XkbModifierLockMask + XkbModifierLockMask (1L << 3) - XkbGroupStateMask + XkbGroupStateMask (1L << 4) - XkbGroupBaseMask + XkbGroupBaseMask (1L << 5) - XkbGroupLatchMask + XkbGroupLatchMask (1L << 6) - XkbGroupLockMask + XkbGroupLockMask (1L << 7) - XkbCompatStateMask + XkbCompatStateMask (1L << 8) - XkbGrabModsMask + XkbGrabModsMask (1L << 9) - XkbCompatGrabModsMask + XkbCompatGrabModsMask (1L << 10) - XkbLookupModsMask + XkbLookupModsMask (1L << 11) - XkbCompatLookupModsMask + XkbCompatLookupModsMask (1L << 12) - XkbPointerButtonMask + XkbPointerButtonMask (1L << 13) - XkbAllStateComponentsMask + XkbAllStateComponentsMask (0x3fff) @@ -841,117 +934,117 @@ There are many different types of Xkb state changes. Xkb defines an event detail
-To track changes in the keyboard state for a particular device, select to receive -XkbStateNotify - events by calling either -XkbSelectEvents - or -XkbSelectEventDetails - (see section 4.3). +To track changes in the keyboard state for a particular device, select to receive +XkbStateNotify +events by calling either +XkbSelectEvents +or +XkbSelectEventDetails +(see section 4.3). -To receive -XkbStateNotify - events under all possible conditions, use -XkbSelectEvents - and pass -XkbStateNotifyMask - in both -bits_to_change - and -values_for_bits -. +To receive +XkbStateNotify +events under all possible conditions, use +XkbSelectEvents +and pass +XkbStateNotifyMask +in both +bits_to_change +and +values_for_bits. -To receive -XkbStateNotify - events only under certain conditions, use -XkbSelectEventDetails - using -XkbStateNotify - as the -event_type - and specifying the desired state changes in -bits_to_change - and -values_for_bits - using mask bits from Table 5.3. +To receive +XkbStateNotify +events only under certain conditions, use +XkbSelectEventDetails +using +XkbStateNotify +as the +event_type +and specifying the desired state changes in +bits_to_change +and +values_for_bits +using mask bits from Table 5.3. -The structure for -XkbStateNotify - events is: - +The structure for +XkbStateNotify +events is: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbStateNotify */ - int device; /* Xkb device ID, will not be XkbUseCoreKbd */ - unsigned int changed; /* bits indicating what has changed */ - int group; /* group index of effective group */ - int base_group; /* group index of base group */ - int latched_group; /* group index of latched group */ - int locked_group; /* group index of locked group */ - unsigned int mods; /* effective modifiers */ - unsigned int base_mods; /* base modifiers */ - unsigned int latched_mods; /* latched modifiers */ - unsigned int locked_mods; /* locked modifiers */ - int compat_state; /* computed compatibility state */ - unsigned char grab_mods; /* modifiers used for grabs */ - unsigned char compat_grab_mods; /* modifiers used for compatibility grabs */ - unsigned char lookup_mods; /* modifiers used to lookup symbols */ - unsigned char compat_lookup_mods; /* mods used for compatibility look up */ - int ptr_buttons; /* core pointer buttons */ - KeyCode keycode; /* keycode causing event, 0 if programmatic */ - char event_type; /* core event if req_major or - req_minor non zero */ - char req_major; /* major request code if program trigger, else 0 */ - char req_minor; /* minor request code if program trigger, else 0 */ -} XkbStateNotifyEvent -; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbStateNotify */ + int device; /* Xkb device ID, + will not be XkbUseCoreKbd */ + unsigned int changed; /* bits indicating what has changed */ + int group; /* group index of effective group */ + int base_group; /* group index of base group */ + int latched_group; /* group index of latched group */ + int locked_group; /* group index of locked group */ + unsigned int mods; /* effective modifiers */ + unsigned int base_mods; /* base modifiers */ + unsigned int latched_mods; /* latched modifiers */ + unsigned int locked_mods; /* locked modifiers */ + int compat_state; /* computed compatibility state */ + unsigned char grab_mods; /* modifiers used for grabs */ + unsigned char compat_grab_mods; /* modifiers used for compatibility grabs */ + unsigned char lookup_mods; /* modifiers used to lookup symbols */ + unsigned char compat_lookup_mods; /* mods used for compatibility look up */ + int ptr_buttons; /* core pointer buttons */ + KeyCode keycode; /* keycode causing event, + 0 if programmatic */ + char event_type; /* core event if req_major or req_minor + non zero */ + char req_major; /* major request code if program trigger, + else 0 */ + char req_minor; /* minor request code if program trigger, + else 0 */ +} XkbStateNotifyEvent; -When you receive an -XkbStateNotify - event, the -changed - field indicates which elements of keyboard state have changed. -This will be the bitwise inclusive OR of one or more of the -XkbStateNotify - event detail masks shown in Table 5.3. All fields reported in -the event are valid, but only those indicated in -changed - have changed values. +When you receive an +XkbStateNotify +event, the +changed +field indicates which elements of keyboard state have changed. +This will be the bitwise inclusive OR of one or more of the +XkbStateNotify +event detail masks shown in Table 5.3. +All fields reported in the event are valid, but only those indicated in +changed +have changed values. -The -group - field is the group index of the effective keysym group. The -base_group -, -latched_group -, and -locked_group - fields are set to a group index value representing the base group, +The +group +field is the group index of the effective keysym group. The +base_group, +latched_group, +and +locked_group +fields are set to a group index value representing the base group, the latched group, and the locked group, respectively. The X server can set the modifier and compatibility state fields to a union of the core modifier mask bits; this union represents the -corresponding modifier states. The ptr_button - field gives the state of the core pointer buttons as a +corresponding modifier states. The ptr_buttons +field gives the state of the core pointer buttons as a mask composed of an inclusive OR of zero or more of the core pointer button masks. @@ -960,28 +1053,28 @@ core pointer button masks. Xkb state changes can occur either in response to keyboard activity or under application control. If a key event -caused the state change, the -keycode - field gives the keycode of the key event, and the -event_type - field is set to either KeyPress - or -KeyRelease -. If a pointer button event caused the state change, the -keycode - field is zero, and the event_type - field is set to either ButtonPress - or ButtonRelease -. Otherwise, the major and minor codes of the request that caused the -state change are given in the -req_major - and -req_minor - fields, and the -keycode - field is zero. The -req_major - value is the same as the major extension opcode. +caused the state change, the +keycode +field gives the keycode of the key event, and the +event_type +field is set to either KeyPress +or +KeyRelease. +If a pointer button event caused the state change, the +keycode +field is zero, and the event_type +field is set to either ButtonPress +or ButtonRelease. +Otherwise, the major and minor codes of the request that caused the +state change are given in the +req_major +and +req_minor +fields, and the +keycode +field is zero. The +req_major +value is the same as the major extension opcode.
diff --git a/libX11/specs/XKB/ch06.xml b/libX11/specs/XKB/ch06.xml index 422e6d23b..b3b58da28 100644 --- a/libX11/specs/XKB/ch06.xml +++ b/libX11/specs/XKB/ch06.xml @@ -1,3 +1,6 @@ + + Complete Keyboard Description @@ -11,73 +14,64 @@ document that discuss the major Xkb components in detail. The XkbDescRec Structure + +XkbDescRec + -The complete description of an Xkb keyboard is given by an -XkbDescRec -. The component structures in the -XkbDescRec - represent the major Xkb components outlined in Figure 1.1. +The complete description of an Xkb keyboard is given by an +XkbDescRec. +The component structures in the +XkbDescRec +represent the major Xkb components outlined in Figure 1.1. typedef struct { - struct _XDisplay * display; /* connection to -X server */ - unsigned short flags; /* private to Xkb, do -not modify */ - unsigned short device_spec; /* device of -interest */ - KeyCode min_key_code; /* minimum keycode for -device */ - KeyCode max_key_code; /* maximum keycode for -device */ - XkbControlsPtr ctrls; /* controls */ - XkbServerMapPtr server; /* server keymap */ - XkbClientMapPtr map; /* client keymap */ - XkbIndicatorPtr indicators; /* indicator map -*/ - XkbNamesPtr names; /* names for all -components */ - XkbCompatMapPtr compat; /* compatibility map -*/ - XkbGeometryPtr geom; /* physical geometry of -keyboard */ -} -XkbDescRec -, *XkbDescPtr; + struct _XDisplay * display; /* connection to X server */ + unsigned short flags; /* private to Xkb, do not modify */ + unsigned short device_spec; /* device of interest */ + KeyCode min_key_code; /* minimum keycode for device */ + KeyCode max_key_code; /* maximum keycode for device */ + XkbControlsPtr ctrls; /* controls */ + XkbServerMapPtr server; /* server keymap */ + XkbClientMapPtr map; /* client keymap */ + XkbIndicatorPtr indicators; /* indicator map */ + XkbNamesPtr names; /* names for all components */ + XkbCompatMapPtr compat; /* compatibility map */ + XkbGeometryPtr geom; /* physical geometry of keyboard */ +} XkbDescRec, *XkbDescPtr; -The -display - field points to an X display structure. The -flags - field is private to the library: modifying -flags - may yield unpredictable results. The -device_spec - field specifies the device identifier of the keyboard input device, or - -XkbUseCoreKeyboard -, which specifies the core keyboard device. The -min_key_code - and -max_key_code - fields specify the least and greatest keycode that can be returned by the +The +display +field points to an X display structure. The +flags +field is private to the library: modifying +flags +may yield unpredictable results. The +device_spec +field specifies the device identifier of the keyboard input device, or +XkbUseCoreKbd, +which specifies the core keyboard device. The +min_key_code +and +max_key_code +fields specify the least and greatest keycode that can be returned by the keyboard. The other fields specify structure components of the keyboard description and -are described in detail in other sections of this document. Table 6.1 +are described in detail in other sections of this document. +Table 6.1 identifies the subsequent sections of this document that discuss the individual -components of the -XkbDescRec -. +components of the +XkbDescRec. - +
XkbDescRec Component References @@ -92,31 +86,31 @@ XkbDescRec ctrls - Chapter 10 + server - Chapter 16 + map - Chapter 15 + indicators - Chapter 8 + names - Chapter 18 + compat - Chapter 17 + geom - Chapter 13 + @@ -126,12 +120,12 @@ XkbDescRec Each structure component has a corresponding mask bit that is used in function calls to indicate that the structure should be manipulated in some manner, such as allocating it or freeing it. These masks and their relationships to the -fields in the -XkbDescRec - are shown in Table 6.2. +fields in the +XkbDescRec +are shown in Table 6.2. -
+
Mask Bits for XkbDescRec @@ -147,12 +141,12 @@ XkbDescRec - XkbControlsMask + XkbControlsMask ctrls (1L<<0) - XkbServerMapMask + XkbServerMapMask server (1L<<1) @@ -162,27 +156,27 @@ XkbDescRec(1L<<2) - XkbIndicatorMapMask + XkbIndicatorMapMask indicators (1L<<3) - XkbNamesMask + XkbNamesMask names (1L<<4) - XkbCompatMapMask + XkbCompatMapMask compat (1L<<5) - XkbGeometryMask + XkbGeometryMask geom (1L<<6) - XkbAllComponentsMask + XkbAllComponentsMask All Fields (0x7f) @@ -196,86 +190,88 @@ XkbDescRec To retrieve one or more components of a keyboard device description, use - -XkbGetKeyboard - (see also -XkbGetKeyboardbyName -). +XkbGetKeyboard +(see also +XkbGetKeyboardByName). + - - - - - - - -XkbDescPtr -XkbGetKeyboard -( -display, which, device_spec -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -which -; /* mask indicating components to return */ - - - - -unsigned int - device_spec -; /* device for which to fetch description, or -XkbUseCoreKbd - */ - - - - - +XkbGetKeyboard + + + XkbDescPtr XkbGetKeyboard + + + Display *display + unsigned int which + unsigned int device_spec + + + + + + display + + + + connection to X server + + + + + + which + + + + mask indicating components to return + + + + + + device_spec + + + + device for which to fetch description, or +XkbUseCoreKbd + + + + - -XkbGetKeyboard +XkbGetKeyboard allocates and returns a pointer to a keyboard description. It queries the -server for those components specified in the -which - parameter for device -device_spec - and copies the results to the -XkbDescRec - it allocated. The remaining fields in the keyboard description are set to - -NULL -. The valid masks for -which - are those listed in Table 6.2. +server for those components specified in the +which +parameter for device +device_spec +and copies the results to the +XkbDescRec +it allocated. The remaining fields in the keyboard description are set to +NULL. +The valid masks for +which +are those listed in Table 6.2. - -XkbGetKeyboard - can generate -BadAlloc - protocol errors. +XkbGetKeyboard +can generate +BadAlloc +protocol errors. -To free the returned keyboard description, use -XkbFreeKeyboard - (see section 6.4). +To free the returned keyboard description, use +XkbFreeKeyboard +(see section 6.4). @@ -285,7 +281,7 @@ XkbFreeKeyboard The server can generate events whenever its copy of the keyboard description -for a device changes. Refer to section 14.4 for detailed information on +for a device changes. Refer to section 14.4 for detailed information on tracking changes to the keyboard description. @@ -296,122 +292,114 @@ tracking changes to the keyboard description. Applications seldom need to directly allocate a keyboard description; calling - -XkbGetKeyboard - usually suffices. In the event you need to create a keyboard description from -scratch, however, use -XkbAllocKeyboard - rather than directly calling -malloc -or -Xmalloc -. +XkbGetKeyboard +usually suffices. In the event you need to create a keyboard description from +scratch, however, use +XkbAllocKeyboard +rather than directly calling +malloc +or +Xmalloc. - - - - - - - -XkbDescRec * -XkbAllocKeyboard -(void) - - - - - +XkbAllocKeyboard + + + XkbDescRec *XkbAllocKeyboard + + + + -If -XkbAllocKeyboard - fails to allocate the keyboard description, it returns -NULL -. Otherwise, it returns a pointer to an empty keyboard description structure. -The -device_spec - field will have been initialized to -XkbUseCoreKbd -. You may then either fill in the structure components or use Xkb functions to +If +XkbAllocKeyboard +fails to allocate the keyboard description, it returns +NULL. +Otherwise, it returns a pointer to an empty keyboard description structure. +The +device_spec +field will have been initialized to +XkbUseCoreKbd. +You may then either fill in the structure components or use Xkb functions to obtain values for the structure components from a keyboard device. -To destroy either an entire an -XkbDescRec - or just some of its members, use -XkbFreeKeyboard. +To destroy either an entire an +XkbDescRec +or just some of its members, use +XkbFreeKeyboard. - - - - - - - -void -XkbFreeKeyboard - -(xkb, which, free_all -) - - - - -XkbDescPtr - xkb -; /* keyboard description with components to free */ - - - - -unsigned int - which -; /* mask selecting components to free */ - - - - -Bool - free_all -; /* -True - => free all components and -xkb - */ - - - - - +XkbFreeKeyboard + + + void XkbFreeKeyboard + + + XkbDescPtr xkb + unsigned int which + Bool free_all + + + + + + xkb + + + + keyboard description with components to free + + + + + + which + + + + mask selecting components to free + + + + + + free_all + + + + True ⇒ free all components and xkb + + + + - -XkbFreeKeyboard - frees the components of -xkb - specified by -which - and sets the corresponding values to -NULL -. If -free_all - is -True -, -XkbFreeKeyboard - frees every non- -NULL - component of -xkb - and then frees the -xkb - structure itself. +XkbFreeKeyboard +frees the components of +xkb +specified by +which +and sets the corresponding values to +NULL. +If +free_all +is +True, +XkbFreeKeyboard +frees every non- +NULL +component of +xkb +and then frees the +xkb +structure itself. diff --git a/libX11/specs/XKB/ch07.xml b/libX11/specs/XKB/ch07.xml index 35b45901f..cbb549ce8 100644 --- a/libX11/specs/XKB/ch07.xml +++ b/libX11/specs/XKB/ch07.xml @@ -1,23 +1,26 @@ + + Virtual Modifiers The core protocol specifies that certain keysyms, when bound to modifiers, affect the rules of keycode to keysym interpretation for all keys; for example, -when the -Num_Lock - keysym is bound to some modifier, that modifier is used to select between +when the +Num_Lock +keysym is bound to some modifier, that modifier is used to select between shifted and unshifted state for the numeric keypad keys. The core protocol does not provide a convenient way to determine the mapping of modifier bits (in -particular -Mod1 - through -Mod5 -) to keysyms such as -Num_Lock - and -Mode_switch -. Using the core protocol only, a client application must retrieve and search +particular +Mod1 +through +Mod5) +to keysyms such as +Num_Lock +and +Mode_switch. +Using the core protocol only, a client application must retrieve and search the modifier map to determine the keycodes bound to each modifier, and then retrieve and search the keyboard mapping to determine the keysyms bound to the keycodes. It must repeat this process for all modifiers whenever any part of @@ -27,35 +30,41 @@ the modifier mapping is changed. Xkb alleviates these problems by defining virtual modifiers. In addition to the -eight core modifiers, referred to as the -real modifiers -, Xkb provides a set of sixteen named -virtual modifiers -. Each virtual modifier can be bound to any set of the real modifiers -( -Shift -, -Lock -, -Control, - and -Mod1 -- -Mod5 -). +eight core modifiers, referred to as the +real modifiers, + +real modifiers + +modifiersreal +Xkb provides a set of sixteen named +virtual modifiers. + +virtual modifiers + +modifiersvirtual +Each virtual modifier can be bound to any set of the real modifiers +( +Shift, +Lock, +Control, +and +Mod1 +– +Mod5). + The separation of function from physical modifier bindings makes it easier to specify more clearly the intent of a binding. X servers do not all assign -modifiers the same way — for example, -Num_Lock - might be bound to -Mod2 - for one vendor and to -Mod4 - for another. This makes it cumbersome to automatically remap the keyboard to a +modifiers the same way — for example, +Num_Lock +might be bound to +Mod2 +for one vendor and to +Mod4 +for another. This makes it cumbersome to automatically remap the keyboard to a desired configuration without some kind of prior knowledge about the keyboard layout and bindings. With XKB, applications can use virtual modifiers to specify the desired behavior, without regard for the actual physical bindings @@ -66,19 +75,19 @@ in effect. Virtual Modifier Names and Masks -Virtual modifiers are named by converting their string name to an X -Atom - and storing the Atom in the -names.vmods - array in an -XkbDescRec - structure (see section 6.1). The position of a name Atom in the -names.vmods - array defines the bit position used to represent the virtual modifier and also +Virtual modifiers are named by converting their string name to an X +Atom +and storing the Atom in the +names.vmods +array in an +XkbDescRec +structure (see section 6.1). The position of a name Atom in the +names.vmods +array defines the bit position used to represent the virtual modifier and also the index used when accessing virtual modifier information in arrays: the name -in the i-th (0 relative) entry of -names.vmods - is the i-th virtual modifier, represented by the mask (1<<i). Throughout +in the i-th (0 relative) entry of +names.vmods +is the i-th virtual modifier, represented by the mask (1<<i). Throughout Xkb, various functions have a parameter that is a mask representing virtual modifier choices. In each case, the i-th bit (0 relative) of the mask represents the i-th virtual modifier. @@ -86,17 +95,17 @@ represents the i-th virtual modifier. -To set the name of a virtual modifier, use -XkbSetNames -, using -XkbVirtualModNamesMask - in -which - and the name in the -xkb - argument; to retrieve indicator names, use -XkbGetNames -. These functions are discussed in Chapter 18. +To set the name of a virtual modifier, use +XkbSetNames, +using +XkbVirtualModNamesMask +in +which +and the name in the +xkb +argument; to retrieve indicator names, use +XkbGetNames. +These functions are discussed in . @@ -104,52 +113,53 @@ XkbGetNames Modifier Definitions + +XkbModsRec + -An Xkb - modifier definition - enumerates a collection of real and virtual modifiers but does not in itself +An Xkb +modifier definition + +modifier definition +enumerates a collection of real and virtual modifiers but does not in itself bind those modifiers to any particular key or to each other. Modifier definitions are included in a number of structures in the keyboard description to define the collection of modifiers that affect or are affected by some other entity. A modifier definition is relevant only in the context of some other -entity such as an indicator map, a control, or a key type. (See sections 8.2.2, -10.8, and 15.2.) +entity such as an indicator map, a control, or a key type. (See +section 8.2.2, +section 10.8, and +section 15.2.) typedef struct _XkbMods { - unsigned char mask; /* real_mods | vmods mapped to -real modifiers */ - unsigned char real_mods; /* real modifier bits */ - unsigned short vmods; /* virtual modifier bits */ -} -XkbModsRec -,*XkbModsPtr; + unsigned char mask; /* real_mods | vmods mapped to real modifiers */ + unsigned char real_mods; /* real modifier bits */ + unsigned short vmods; /* virtual modifier bits */ +} XkbModsRec, *XkbModsPtr; An Xkb modifier definition consists of a set of bit masks corresponding to the -eight real modifiers ( -real_mods -); a similar set of bitmasks corresponding to the 16 named virtual modifiers -( -vmods -); and an effective mask ( -mask -). The effective mask represents the set of all real modifiers that can +eight real modifiers +(real_mods); +a similar set of bitmasks corresponding to the 16 named virtual modifiers +(vmods); +and an effective mask +(mask). +The effective mask represents the set of all real modifiers that can logically be set either by setting any of the real modifiers or by setting any -of the virtual modifiers in the definition. -mask - is derived from the real and virtual modifiers and should never be explicitly +of the virtual modifiers in the definition. +mask +is derived from the real and virtual modifiers and should never be explicitly changed — it contains all of the real modifiers specified in the definition -( -real_mods -) - plus - any real modifiers that are bound to the virtual modifiers specified in the -definition ( -vmods -). The binding of the virtual modifiers to real modifiers is exterior to the +(real_mods) +plus +any real modifiers that are bound to the virtual modifiers specified in the +definition +(vmods). +The binding of the virtual modifiers to real modifiers is exterior to the modifier definition. Xkb automatically recomputes the mask field of modifier definitions as necessary. Whenever you access a modifier definition that has been retrieved using an Xkb library function, the mask field will be correct @@ -162,14 +172,14 @@ for the keyboard mapping of interest. Binding Virtual Modifiers to Real Modifiers -The binding of virtual modifiers to real modifiers is defined by the -server.vmods - array in an -XkbDescRec - structure. Each entry contains the real modifier bits that are bound to the +The binding of virtual modifiers to real modifiers is defined by the +server.vmods +array in an +XkbDescRec +structure. Each entry contains the real modifier bits that are bound to the virtual modifier corresponding to the entry. The overall relationship of fields dealing with virtual modifiers in the server keyboard description are shown in -Figure 16.2. +Figure 16.2. @@ -178,151 +188,153 @@ Figure 16.2. Virtual Modifier Key Mapping -Xkb maintains a -virtual modifier mapping -, which lists the virtual modifiers associated with, or bound to, each key. The +Xkb maintains a +virtual modifier mapping, + +virtual modifier mapping + +modifiersvirtual mapping +which lists the virtual modifiers associated with, or bound to, each key. The real modifiers bound to a virtual modifier always include all of the modifiers bound to any of the keys that specify that virtual modifier in their virtual -modifier mapping. The -server.vmodmap - array indicates which virtual modifiers are bound to each key; each entry is a -bitmask for the virtual modifier bits. The -server.vmodmap - array is indexed by keycode. +modifier mapping. The +server.vmodmap +array indicates which virtual modifiers are bound to each key; each entry is a +bitmask for the virtual modifier bits. The +server.vmodmap +array is indexed by keycode. -The -vmodmap - and -vmods - members of the server map are the "master" virtual modifier definitions. Xkb +The +vmodmap +and +vmods +members of the server map are the master virtual modifier definitions. Xkb automatically propagates any changes to these fields to all other fields that -use virtual modifier mappings (see section 16.4). +use virtual modifier mappings (see section 16.4). -For example, if -Mod3 - is bound to the -Num_Lock - key by the core protocol modifier mapping, and the -NumLock - virtual modifier is bound to they -Num_Lock - key by the virtual modifier mapping, -Mod3 - is added to the set of modifiers associated with -NumLock -. +For example, if +Mod3 +is bound to the +Num_Lock +key by the core protocol modifier mapping, and the +NumLock +virtual modifier is bound to they +Num_Lock +key by the virtual modifier mapping, +Mod3 +is added to the set of modifiers associated with +NumLock. The virtual modifier mapping is normally updated whenever actions are -automatically applied to symbols (see section 16.4 for details), and few +automatically applied to symbols (see section 16.4 for details), and few applications should need to change the virtual modifier mapping explicitly. -Use -XkbGetMap -(see section 14.2) to get the virtual modifiers from the server or use - -XkbGetVirtualMods - (see section 16.4.1) to update a local copy of the virtual modifiers bindings +Use +XkbGetMap +(see section 14.2) to get the virtual modifiers from the server or use +XkbGetVirtualMods +(see section 16.4.1) to update a local copy of the virtual modifiers bindings from the server. To set the binding of a virtual modifier to a real modifier, -use -XkbSetMap - (see - -section 14.3 -). +use +XkbSetMap +(see +section 14.3). To determine the mapping of virtual modifiers to core X protocol modifiers, use - -XkbVirtualModsToReal -. +XkbVirtualModsToReal. - - - - - - - -Bool -XkbVirtualModsToReal -( -xkb, virtual_mask, mask_rtrn -) - - - - -XkbDescPtr - xkb -; /* keyboard description for input device */ - - - - -unsigned int - virtual_mask -; /* virtual modifier mask to translate */ - - - - -unsigned int * -mask_rtrn -; /* backfilled with real modifiers */ - - - - - +XkbVirtualModsToReal + + + Bool XkbVirtualModsToReal + + + XkbDescPtr xkb + unsigned int virtual_mask + unsigned int *mask_rtrn + + + + + + xkb + + + + keyboard description for input device + + + + + + virtual_mask + + + + virtual modifier mask to translate + + + + + + mask_rtrn + + + + backfilled with real modifiers + + + + -If the keyboard description defined by -xkb - includes bindings for virtual modifiers, -XkbVirtualModsToReal - uses those bindings to determine the set of real modifiers that correspond to -the set of virtual modifiers specified in -virtual_mask -. The -virtual_mask - parameter is a mask specifying the virtual modifiers to translate; the i-th -bit (0 relative) of the mask represents the i-th virtual modifier. If -mask_rtrn - is non- -NULL -, -XkbVirtualModsToReal - backfills it with the resulting real modifier mask. If the keyboard -description in -xkb - does not include virtual modifier bindings, -XkbVirtualModsToReal - returns -False -; otherwise, it returns -True -. +If the keyboard description defined by +xkb +includes bindings for virtual modifiers, +XkbVirtualModsToReal +uses those bindings to determine the set of real modifiers that correspond to +the set of virtual modifiers specified in +virtual_mask. +The +virtual_mask +parameter is a mask specifying the virtual modifiers to translate; the i-th +bit (0 relative) of the mask represents the i-th virtual modifier. If +mask_rtrn +is non- +NULL, +XkbVirtualModsToReal +backfills it with the resulting real modifier mask. If the keyboard +description in +xkb +does not include virtual modifier bindings, +XkbVirtualModsToReal +returns +False; +otherwise, it returns +True. It is possible for a local (client-side) keyboard description (the - -xkb - parameter) to not contain any virtual modifier information (simply because the +xkb +parameter) to not contain any virtual modifier information (simply because the client has not requested it) while the server’s corresponding definition may contain virtual modifier information. @@ -332,10 +344,8 @@ contain virtual modifier information. An unbound virtual modifier is one that is not bound to any real modifier -( -server --> -vmods +( +server->vmods [virtual_modifier_index] is zero). @@ -343,22 +353,21 @@ vmods Some Xkb operations ignore modifier definitions in which the virtual modifiers are unbound. Consider this example: - - -if (state matches {Shift}) Do OneThing; -if (state matches {Shift+NumLock}) Do Another; + if (state matches {Shift}) Do OneThing; + if (state matches {Shift+NumLock}) Do Another; + -If the -NumLock - virtual modifier is not bound to any real modifiers, the effective masks for -these two cases are identical (that is, contain only -Shift -). When it is essential to distinguish between -OneThing - and Another, Xkb considers only those modifier definitions for which all +If the +NumLock +virtual modifier is not bound to any real modifiers, the effective masks for +these two cases are identical (that is, contain only +Shift). +When it is essential to distinguish between +OneThing +and Another, Xkb considers only those modifier definitions for which all virtual modifiers are bound. @@ -368,41 +377,43 @@ virtual modifiers are bound. Conventions + +modifiersnames + The Xkb extension does not require any specific virtual modifier names. However, everyone benefits if the same names are used for common modifiers. The following names are suggested: - - - - NumLock - ScrollLock - Alt - Meta - AltGr - LevelThree - + + NumLock + ScrollLock + Alt + Meta + AltGr + LevelThree + + Example -If the second (0-relative) entry in -names.vmods - contains the Atom for "NumLock", then 0x4 (1<<2) is the virtual modifier -bit for the -NumLock - virtual modifier. If -server.vmods -[2] contains -Mod3Mask -, then the -NumLock - virtual modifier is bound to the -Mod3 - real modifier. +If the second (0-relative) entry in +names.vmods +contains the Atom for "NumLock", then 0x4 (1<<2) is the virtual modifier +bit for the +NumLock +virtual modifier. If +server.vmods +[2] contains +Mod3Mask, +then the +NumLock +virtual modifier is bound to the +Mod3 +real modifier. @@ -417,25 +428,25 @@ A virtual modifier definition for this example would have: -Continuing the example, if the keyboard has a -Num_Lock - keysym bound to the key with keycode 14, and the -NumLock - virtual modifier is bound to this key, -server.vmodmap -[14] contains 0x4. +Continuing the example, if the keyboard has a +Num_Lock +keysym bound to the key with keycode 14, and the +NumLock +virtual modifier is bound to this key, +server.vmodmap[14] +contains 0x4. -Finally, if the keyboard also used the real -Mod1 - modifier for numeric lock operations, the modifier definition below would -represent the situation where either the key bound to -Mod1 - or the -NumLock - virtual modifier could be used for this purpose: +Finally, if the keyboard also used the real +Mod1 +modifier for numeric lock operations, the modifier definition below would +represent the situation where either the key bound to +Mod1 +or the +NumLock +virtual modifier could be used for this purpose: diff --git a/libX11/specs/XKB/ch08.xml b/libX11/specs/XKB/ch08.xml index 2b91f00ff..3bb6be629 100644 --- a/libX11/specs/XKB/ch08.xml +++ b/libX11/specs/XKB/ch08.xml @@ -1,32 +1,38 @@ + + Indicators + +indicators + Although the core X implementation supports up to 32 LEDs on an input device, it does not provide any linkage between the state of the LEDs and the logical -state of the input device. For example, most keyboards have a -CapsLock - LED, but X does not provide a mechanism to make the LED automatically follow -the logical state of the -CapsLock - key. +state of the input device. For example, most keyboards have a +CapsLock +LED, but X does not provide a mechanism to make the LED automatically follow +the logical state of the +CapsLock +key. Furthermore, the core X implementation does not provide clients with the -ability to determine what bits in the -led_mask - field of the -XKeyboardState - map to the particular LEDs on the keyboard. For example, X does not provide a -method for a client to determine what bit to set in the -led_mask - field to turn on the -Scroll Lock -LED or whether the keyboard even has a -Scroll Lock - LED. +ability to determine what bits in the +led_mask +field of the +XKeyboardState +map to the particular LEDs on the keyboard. For example, X does not provide a +method for a client to determine what bit to set in the +led_mask +field to turn on the +Scroll Lock +LED or whether the keyboard even has a +Scroll Lock +LED. @@ -38,7 +44,8 @@ to reflect keyboard changes, and determine which of the 32 keyboard indicators reported by the protocol are actually present on the keyboard. Clients may also request immediate notification of changes to the state of any subset of the keyboard indicators, which makes it straightforward to provide an on-screen -"virtual" LED panel. This chapter describes Xkb indicators and the functions +virtual LED panel. +This chapter describes Xkb indicators and the functions used for manipulating them. @@ -49,15 +56,16 @@ used for manipulating them. Xkb provides the capability of symbolically naming indicators. Xkb itself doesn’t use these symbolic names for anything; they are there only to help make the keyboard description comprehensible to humans. To set the names of -specific indicators, use -XkbSetNames - as discussed in Chapter 18. Then set the map using -XkbSetMap - (see section 14.3) or -XkbSetNamedIndicator - (below). To retrieve indicator names, use -XkbGetNames - (Chapter 18). +specific indicators, use +XkbSetNames +as discussed in . Then set the map using +XkbSetMap +(see section 14.3) +or +XkbSetNamedIndicator +(below). To retrieve indicator names, use +XkbGetNames +(). @@ -66,65 +74,65 @@ XkbGetNames Indicator Data Structures -Use the indicator description record, -XkbIndicatorRec -, and its indicator map, -XkbIndicatorMapRec -, to inquire about and control most indicator properties and behaviors. +Use the indicator description record, +XkbIndicatorRec, +and its indicator map, +XkbIndicatorMapRec, +to inquire about and control most indicator properties and behaviors. XkbIndicatorRec + +XkbIndicatorRec + -The description for all the Xkb indicators is held in the -indicators - field of the complete keyboard description (see Chapter 6), which is defined +The description for all the Xkb indicators is held in the +indicators +field of the complete keyboard description (see ), which is defined as follows: - - + #define XkbNumIndicators 32 - - + typedef struct { - unsigned long phys_indicators; /* LEDs existence */ - XkbIndicatorMapRec maps[XkbNumIndicators]; /* indicator maps */ -} XkbIndicatorRec,*XkbIndicatorPtr; + unsigned long phys_indicators; /* LEDs existence */ + XkbIndicatorMapRec maps[XkbNumIndicators]; /* indicator maps */ +} XkbIndicatorRec, *XkbIndicatorPtr; -This structure contains the -phys_indicators - field, which relates some information about the correspondence between +This structure contains the +phys_indicators +field, which relates some information about the correspondence between indicators and physical LEDs on the keyboard, and an array of indicator - -maps -, one map per indicator. +maps, +one map per indicator. -The -phys_indicators - field indicates which indicators are bound to physical LEDs on the keyboard; -if a bit is set in -phys_indicators -, then the associated indicator has a physical LED associated with it. This +The +phys_indicators +field indicates which indicators are bound to physical LEDs on the keyboard; +if a bit is set in +phys_indicators, +then the associated indicator has a physical LED associated with it. This field is necessary because some indicators may not have corresponding physical LEDs on the keyboard. For example, most keyboards have an LED for indicating -the state of -CapsLock -, but most keyboards do not have an LED that indicates the current group. -Because -phys_indicators - describes a physical characteristic of the keyboard, you cannot directly +the state of +CapsLock, +but most keyboards do not have an LED that indicates the current group. +Because +phys_indicators +describes a physical characteristic of the keyboard, you cannot directly change it under program control. However, if a client program loads a -completely new keyboard description via -XkbGetKeyboardByName -, or if a new keyboard is attached and the X implementation notices, -phys_indicators - changes if the indicators for the new keyboard are different. +completely new keyboard description via +XkbGetKeyboardByName, +or if a new keyboard is attached and the X implementation notices, +phys_indicators +changes if the indicators for the new keyboard are different. @@ -132,25 +140,27 @@ phys_indicators XkbIndicatorMapRec + +XkbIndicatorMapRec + Each indicator has its own set of attributes that specify whether clients can explicitly set its state and whether it tracks the keyboard state. The -attributes of each indicator are held in the -maps - array, which is an array of -XkbIndicatorRec - structures: - +attributes of each indicator are held in the +maps +array, which is an array of +XkbIndicatorRec +structures: - + typedef struct { - unsigned char flags; /* how the indicator can be changed */ - unsigned char which_groups; /* match criteria for groups */ - unsigned char groups; /* which keyboard groups the indicator watches */ - unsigned char which_mods; /* match criteria for modifiers */ - XkbModsRec mods; /* which modifiers the indicator watches */ - unsigned int ctrls; /* which controls the indicator watches */ -} XkbIndicatorMapRec, *XkbIndicatorMapPtr; + unsigned char flags; /* how the indicator can be changed */ + unsigned char which_groups; /* match criteria for groups */ + unsigned char groups; /* which keyboard groups the indicator watches */ + unsigned char which_mods; /* match criteria for modifiers */ + XkbModsRec mods; /* which modifiers the indicator watches */ + unsigned int ctrls; /* which controls the indicator watches */ +} XkbIndicatorMapRec, *XkbIndicatorMapPtr; @@ -177,10 +187,10 @@ indicator The effect (if any) of attempts to explicitly change the state of the indicator -using the functions -XkbSetControls - or -XChangeKeyboardControl +using the functions +XkbSetControls +or +XChangeKeyboardControl @@ -188,22 +198,22 @@ XChangeKeyboardControl For more information on the effects of explicit changes to indicators and the -relationship to the indicator map, see section 8.4.1. +relationship to the indicator map, see section 8.4.1. XkbIndicatorMapRec flags field -The -flags - field specifies the conditions under which the indicator can be changed and -the effects of changing the indicator. The valid values for -flags - and their effects are shown in Table 8.1. +The +flags +field specifies the conditions under which the indicator can be changed and +the effects of changing the indicator. The valid values for +flags +and their effects are shown in Table 8.1. -
+
XkbIndicatorMapRec flags Field @@ -219,19 +229,19 @@ flags - XkbIM_NoExplicit + XkbIM_NoExplicit (1L<<7) Client applications cannot change the state of the indicator. - XkbIM_NoAutomatic + XkbIM_NoAutomatic (1L<<6) Xkb does not automatically change the value of the indicator based upon a change in the keyboard state, regardless of the values for the other fields of the indicator map. - XkbIM_LEDDrivesKB + XkbIM_LEDDrivesKB (1L<<5) A client application changing the state of the indicator causes the state of the keyboard to change. @@ -241,67 +251,64 @@ state of the keyboard to change.
-Note that if -XkbIM_NoAutomatic - is not set, by default the indicator follows the keyboard state. +Note that if +XkbIM_NoAutomatic +is not set, by default the indicator follows the keyboard state. -If -XkbIM_LEDDrivesKB - is set and -XkbIM_NoExplicit - is not, and if you call a function which updates the server’s image of the -indicator map (such as -XkbSetIndicatorMap - or -XkbSetNamedIndicator -), Xkb changes the keyboard state and controls to reflect the other fields of +If +XkbIM_LEDDrivesKB +is set and +XkbIM_NoExplicit +is not, and if you call a function which updates the server’s image of the +indicator map (such as +XkbSetIndicatorMap +or +XkbSetNamedIndicator), +Xkb changes the keyboard state and controls to reflect the other fields of the indicator map, as described in the remainder of this section. If you -attempt to explicitly change the value of an indicator for which -XkbIM_LEDDrivesKB - is absent or for which -XkbIM_NoExplicit - is present, keyboard state or controls are unaffected. - - - - -For example, a keyboard designer may want to make the -CapsLock - LED controllable only by the server, but allow the -Scroll Lock - LED to be controlled by client applications. To do so, the keyboard designer -could set the -XkbIM_NoExplicit - flag for the -CapsLock - - -LED, but not set it for the -Scroll Lock - LED. Or the keyboard designer may wish to allow the -CapsLock - LED to be controlled by both the server and client applications and also have -the server to automatically change the -CapsLock - - -modifier state whenever a client application changes the -CapsLock - LED. To do so, the keyboard designer would not set the -XkbIM_NoExplicit - flag, but would instead set the -XkbIM_LEDDrivesKB - flag. +attempt to explicitly change the value of an indicator for which +XkbIM_LEDDrivesKB +is absent or for which +XkbIM_NoExplicit +is present, keyboard state or controls are unaffected. + + + + +For example, a keyboard designer may want to make the +CapsLock +LED controllable only by the server, but allow the +Scroll Lock +LED to be controlled by client applications. To do so, the keyboard designer +could set the +XkbIM_NoExplicit +flag for the +CapsLock +LED, but not set it for the +Scroll Lock +LED. Or the keyboard designer may wish to allow the +CapsLock +LED to be controlled by both the server and client applications and also have +the server to automatically change the +CapsLock + +modifier state whenever a client application changes the +CapsLock +LED. To do so, the keyboard designer would not set the +XkbIM_NoExplicit +flag, but would instead set the +XkbIM_LEDDrivesKB +flag. The remaining fields in the indicator map specify the conditions under which -Xkb automatically turns an indicator on or off (only if -XkbIM_NoAutomatic - is not set). If these conditions match the keyboard state, Xkb turns the +Xkb automatically turns an indicator on or off (only if +XkbIM_NoAutomatic +is not set). If these conditions match the keyboard state, Xkb turns the indicator on. If the conditions do not match, Xkb turns the indicator off. @@ -311,19 +318,18 @@ indicator on. If the conditions do not match, Xkb turns the indicator off. XkbIndicatorMapRec which_groups and groups fields -The -which_groups - and the -groups - fields of an indicator map determine how the keyboard group state affects the -corresponding indicator. The -which_groups - field controls the interpretation of -groups - and may contain any one of the following values: - +The +which_groups +and the +groups +fields of an indicator map determine how the keyboard group state affects the +corresponding indicator. The +which_groups +field controls the interpretation of +groups +and may contain any one of the following values: - + #define XkbIM_UseNone 0 #define XkbIM_UseBase (1L << 0) #define XkbIM_UseLatched (1L << 1) @@ -334,13 +340,12 @@ groups -The -groups +The +groups field specifies what keyboard groups an indicator watches and is the bitwise inclusive OR of the following valid values: - - + #define XkbGroup1Mask (1<<0) #define XkbGroup2Mask (1<<1) #define XkbGroup3Mask (1<<2) @@ -350,16 +355,16 @@ inclusive OR of the following valid values: -If -XkbIM_NoAutomatic - is not set (the keyboard drives the indicator), the effect of -which_groups - and -groups - is shown in Table 8.2. +If +XkbIM_NoAutomatic +is not set (the keyboard drives the indicator), the effect of +which_groups +and +groups +is shown in Table 8.2. - +
XkbIndicatorMapRec which_groups and groups, Keyboard Drives Indicator @@ -374,72 +379,72 @@ Indicator - XkbIM_UseNone + XkbIM_UseNone -The -groups - field and the current keyboard group state are ignored. +The +groups +field and the current keyboard group state are ignored. - XkbIM_UseBase + XkbIM_UseBase -If -groups - is nonzero, the indicator is lit whenever the base keyboard group is nonzero. -If -groups - is zero, the indicator is lit whenever the base keyboard group is zero. +If +groups +is nonzero, the indicator is lit whenever the base keyboard group is nonzero. +If +groups +is zero, the indicator is lit whenever the base keyboard group is zero. - XkbIM_UseLatched + XkbIM_UseLatched -If -groups - is nonzero, the indicator is lit whenever the latched keyboard group is -nonzero. If -groups - is zero, the indicator is lit whenever the latched keyboard group is zero. +If +groups +is nonzero, the indicator is lit whenever the latched keyboard group is +nonzero. If +groups +is zero, the indicator is lit whenever the latched keyboard group is zero. - XkbIM_UseLocked + XkbIM_UseLocked -The -groups - field is interpreted as a mask. The indicator is lit when the current locked -keyboard group matches one of the bits that are set in -groups. +The +groups +field is interpreted as a mask. The indicator is lit when the current locked +keyboard group matches one of the bits that are set in +groups. - XkbIM_UseEffective + XkbIM_UseEffective -The -groups - field is interpreted as a mask. The indicator is lit when the current -effective keyboard group matches one of the bits that are set in -groups -. - +The +groups +field is interpreted as a mask. The indicator is lit when the current +effective keyboard group matches one of the bits that are set in +groups. +
-The effect of -which_groups - and -groups - when you change an indicator for which -XkbIM_LEDDrivesKB - is set (the indicator drives the keyboard) is shown in Table 8.3. The "New -State" column refers to the new state to which you set the indicator. +The effect of +which_groups +and +groups +when you change an indicator for which +XkbIM_LEDDrivesKB +is set (the indicator drives the keyboard) is shown in +Table 8.3. The New State +column refers to the new state to which you set the indicator. - +
XkbIndicatorMapRec which_groups and groups, Indicator Drives Keyboard @@ -456,42 +461,41 @@ Keyboard - XkbIM_UseNone + XkbIM_UseNone On or Off No effect - XkbIM_UseBase + XkbIM_UseBase On or Off No effect - XkbIM_UseLatched + XkbIM_UseLatched On -The -groups - field is treated as a group mask. The keyboard group latch is changed to the -lowest numbered group specified in -groups -; if -groups - is empty, the keyboard group latch is changed to zero. +The +groups +field is treated as a group mask. The keyboard group latch is changed to the +lowest numbered group specified in +groups; +if +groups +is empty, the keyboard group latch is changed to zero. - XkbIM_UseLatched + XkbIM_UseLatched Off -The -groups - field is treated as a group mask. If the indicator is explicitly extinguished, +The +groups +field is treated as a group mask. If the indicator is explicitly extinguished, keyboard group latch is changed to the lowest numbered group not specified in - -groups -; if -groups - is zero, the keyboard group latch is set to the index of the highest legal +groups; +if +groups +is zero, the keyboard group latch is set to the index of the highest legal keyboard group. @@ -499,11 +503,11 @@ keyboard group. XkbIM_UseLocked or XkbIM_UseEffectiveOn -If the -groups - mask is empty, group is not changed; otherwise, the locked keyboard group is -changed to the lowest numbered group specified in -groups. +If the +groups +mask is empty, group is not changed; otherwise, the locked keyboard group is +changed to the lowest numbered group specified in +groups. @@ -511,13 +515,13 @@ groups. Off Locked keyboard group is changed to the lowest numbered group that is not -specified in the -groups - mask, or to -Group1 - if the -groups - mask contains all keyboard groups. +specified in the +groups +mask, or to +Group1 +if the +groups +mask contains all keyboard groups. @@ -529,66 +533,60 @@ groupsXkbIndicatorMapRec which_mods and mods fields -The -mods -field specifies what modifiers an indicator watches. The -mods - field is an Xkb modifier definition, -XkbModsRec -, as described in section 7.2, which can specify both real and virtual -modifiers. The -mods - field takes effect even if some or all of the virtual indicators specified in - -mods - are unbound. To specify the mods field, in general, assign the modifiers of -interest to -mods.real_mods - and the virtual modifiers of interest to -mods.vmods -. You can disregard the -mods.mask - field unless your application needs to interpret the indicator map directly +The +mods +field specifies what modifiers an indicator watches. The +mods +field is an Xkb modifier definition, +XkbModsRec, +as described in section 7.2, which can specify both real and virtual +modifiers. The +mods +field takes effect even if some or all of the virtual indicators specified in +mods +are unbound. To specify the mods field, in general, assign the modifiers of +interest to +mods.real_mods +and the virtual modifiers of interest to +mods.vmods. +You can disregard the +mods.mask +field unless your application needs to interpret the indicator map directly (that is, to simulate automatic indicator behavior on its own). Relatively few applications need to do so, but if you find it necessary, you can either read the indicator map back from the server after you update it (the server automatically updates the mask field whenever any of the real or virtual -modifiers are changed in the modifier definition) or you can use -XkbVirtualModsToReal - to determine the proper contents for the mask field, assuming that the - -XkbDescRec - contains the virtual modifier definitions. - - - - -which_mods - specifies what criteria Xkb uses to determine a match with the corresponding - -mods - field by specifying one or more components of the Xkb keyboard state. If - -XkbIM_NoAutomatic - is not set (the keyboard drives the indicator), the indicator is lit whenever -any of the modifiers specified in the -mask - field of the - mods - modifier definition are also set in any of the current keyboard state -components specified by -which_mods -. Remember that the -mask - field is comprised of all of the real modifiers specified in the definition +modifiers are changed in the modifier definition) or you can use +XkbVirtualModsToReal +to determine the proper contents for the mask field, assuming that the +XkbDescRec +contains the virtual modifier definitions. + + + +which_mods +specifies what criteria Xkb uses to determine a match with the corresponding +mods +field by specifying one or more components of the Xkb keyboard state. If +XkbIM_NoAutomatic +is not set (the keyboard drives the indicator), the indicator is lit whenever +any of the modifiers specified in the +mask +field of the +mods +modifier definition are also set in any of the current keyboard state +components specified by +which_mods. +Remember that the +mask +field is comprised of all of the real modifiers specified in the definition plus any real modifiers that are bound to the virtual modifiers specified in -the definition. (See Chapter 5 for more information on the keyboard state and -Chapter 7 for more information on virtual modifiers.) Use a bitwise inclusive -OR of the following values to compose a value for -which_mods: - +the definition. (See for more information on the keyboard state and + for more information on virtual modifiers.) Use a bitwise inclusive +OR of the following values to compose a value for +which_mods: - + #define XkbIM_UseNone 0 #define XkbIM_UseBase (1L << 0) #define XkbIM_UseLatched (1L << 1) @@ -601,16 +599,16 @@ which_mods: -If -XkbIM_NoAutomatic - is not set (the keyboard drives the indicator), the effect of -which_mods - and -mods - is shown in Table 8.4 +If +XkbIM_NoAutomatic +is not set (the keyboard drives the indicator), the effect of +which_mods +and +mods +is shown in Table 8.4 -
+
XkbIndicatorMapRec which_mods and mods, Keyboard Drives Indicator @@ -624,80 +622,80 @@ mods - XkbIM_UseNone + XkbIM_UseNone The mods field and the current keyboard modifier state are ignored. - XkbIM_UseBase + XkbIM_UseBase -The indicator is lit when any of the modifiers specified in the -mask - field of -mods - are on in the keyboard base state. If both -mods.real_mods - and -mods.vmods - are zero, the indicator is lit when the base keyboard state contains no +The indicator is lit when any of the modifiers specified in the +mask +field of +mods +are on in the keyboard base state. If both +mods.real_mods +and +mods.vmods +are zero, the indicator is lit when the base keyboard state contains no modifiers. - XkbIM_UseLatched + XkbIM_UseLatched -The indicator is lit when any of the modifiers specified in the -mask - field of -mods - are latched. If both -mods.real_mods - and -mods.vmods - are zero, the indicator is lit when none of the modifier keys are latched. +The indicator is lit when any of the modifiers specified in the +mask +field of +mods +are latched. If both +mods.real_mods +and +mods.vmods +are zero, the indicator is lit when none of the modifier keys are latched. - XkbIM_UseLocked + XkbIM_UseLocked -The indicator is lit when any of the modifiers specified in the -mask - field of -mods - are locked. If both -mods.real_mods - and -mods.vmods - are zero, the indicator is lit when none of the modifier keys are locked. +The indicator is lit when any of the modifiers specified in the +mask +field of +mods +are locked. If both +mods.real_mods +and +mods.vmods +are zero, the indicator is lit when none of the modifier keys are locked. - XkbIM_UseEffective + XkbIM_UseEffective -The indicator is lit when any of the modifiers specified in the -mask - field of -mods - are in the effective keyboard state. If both -mods.real_mods - and -mods.vmods - are zero, the indicator is lit when the effective keyboard state contains no +The indicator is lit when any of the modifiers specified in the +mask +field of +mods +are in the effective keyboard state. If both +mods.real_mods +and +mods.vmods +are zero, the indicator is lit when the effective keyboard state contains no modifiers. - XkbIM_UseCompat + XkbIM_UseCompat -The indicator is lit when any of the modifiers specified in the -mask - field of -mods - are in the keyboard compatibility state. If both -mods.real_mods - and -mods.vmods - are zero, the indicator is lit when the keyboard compatibility state contains +The indicator is lit when any of the modifiers specified in the +mask +field of +mods +are in the keyboard compatibility state. If both +mods.real_mods +and +mods.vmods +are zero, the indicator is lit when the keyboard compatibility state contains no modifiers. @@ -706,17 +704,18 @@ no modifiers.
-The effect on the keyboard modifiers of -which_mods - and -mods - when you change an indicator for which -XkbIM_LEDDrivesKB - is set (the indicator drives the keyboard) is shown in Table 8.5. The "New -State" column refers to the new state to which you set the indicator. - +The effect on the keyboard modifiers of +which_mods +and +mods +when you change an indicator for which +XkbIM_LEDDrivesKB +is set (the indicator drives the keyboard) is shown in +Table 8.5. The New State +column refers to the new state to which you set the indicator. + - +
XkbIndicatorMapRec which_mods and mods, Indicator Drives Keyboard @@ -737,58 +736,58 @@ State" column refers to the new state to which you set the indicator. No Effect - XkbIM_UseLatched + XkbIM_UseLatched On -Any modifiers specified in the -mask - field of -mods - are added to the latched modifiers. +Any modifiers specified in the +mask +field of +mods +are added to the latched modifiers. - XkbIM_UseLatched + XkbIM_UseLatched Off -Any modifiers specified in the -mask - field of -mods - are removed from the latched modifiers. +Any modifiers specified in the +mask +field of +mods +are removed from the latched modifiers. XkbIM_UseLocked, XkbIM_UseCompat, or XkbIM_UseEffective On -Any modifiers specified in the -mask - field of -mods - are added to the locked modifiers. +Any modifiers specified in the +mask +field of +mods +are added to the locked modifiers. - XkbIM_UseLocked + XkbIM_UseLocked Off -Any modifiers specified in the -mask - field of -mods - are removed from the locked modifiers. +Any modifiers specified in the +mask +field of +mods +are removed from the locked modifiers. XkbIM_UseCompat or XkbIM_UseEffective Off -Any modifiers specified in the -mask - field of -mods - are removed from both the locked and latched modifiers. +Any modifiers specified in the +mask +field of +mods +are removed from both the locked and latched modifiers. @@ -800,13 +799,12 @@ mods XkbIndicatorMapRec ctrls field -The -ctrls - field specifies what controls (see Chapter 10) the indicator watches and is +The +ctrls +field specifies what controls (see ) the indicator watches and is composed using the bitwise inclusive OR of the following values: - - + #define XkbRepeatKeysMask (1L << 0) #define XkbSlowKeysMask (1L << 1) #define XkbBounceKeysMask (1L << 2) @@ -824,9 +822,8 @@ composed using the bitwise inclusive OR of the following values: Xkb lights the indicator whenever any of the boolean controls specified in - -ctrls - is enabled. +ctrls +is enabled. @@ -842,12 +839,12 @@ different methods. The first method, which is similar to the core X implementation, uses a mask to specify the indicators. The second method, which is more suitable for applications concerned with interoperability, uses indicator names. The correspondence between the indicator name and the bit -position in masks is as follows: one of the parameters returned from -XkbGetNamedIndicators - is an index that is the bit position to use in any function call that requires -a mask of indicator bits, as well as the indicator’s index into the -XkbIndicatorRec - array of indicator maps. +position in masks is as follows: one of the parameters returned from +XkbGetNamedIndicator +is an index that is the bit position to use in any function call that requires +a mask of indicator bits, as well as the indicator’s index into the +XkbIndicatorRec +array of indicator maps. @@ -857,78 +854,79 @@ XkbIndicatorRec Because the state of the indicators is relatively volatile, the keyboard description does not hold the current state of the indicators. To obtain the -current state of the keyboard indicators, use -XkbGetIndicatorState. - - - - - - - - - -Status -XkbGetIndicatorState -( -display -, -device_spec -, -state_return -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int * -state_return -; /* backfilled with a mask of the indicator state */ - - - - - - - - -XkbGetIndicatorState - queries the -display - for the state of the indicators on the device specified by the -device_spec -. For each indicator that is "turned on" on the device, the associated bit is -set in -state_return -. If a compatible version of the Xkb extension is not available in the server, - -XkbGetIndicatorState - returns a -BadMatch - error. Otherwise, it sends the request to the X server, places the state of -the indicators into -state_return, - and returns -Success -. Thus the value reported by -XkbGetIndicatorState - is identical to the value reported by the core protocol. +current state of the keyboard indicators, use +XkbGetIndicatorState. + + +XkbGetIndicatorState + + + Status XkbGetIndicatorState + + + Display *display + unsigned int device_spec + unsigned int *state_return + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + state_return + + + + backfilled with a mask of the indicator state + + + + + + +XkbGetIndicatorState +queries the +display +for the state of the indicators on the device specified by the +device_spec. +For each indicator that is turned on on the device, +the associated bit is set in +state_return. +If a compatible version of the Xkb extension is not available in the server, +XkbGetIndicatorState +returns a +BadMatch +error. Otherwise, it sends the request to the X server, places the state of +the indicators into +state_return, +and returns +Success. +Thus the value reported by +XkbGetIndicatorState +is identical to the value reported by the core protocol. @@ -938,93 +936,91 @@ XkbGetIndicatorState To get the map for one or more indicators, using a mask to specify the -indicators, use -XkbGetIndicatorMap. - - - - - - - - - -Status -XkbGetIndicatorMap -( -dpy -, - which -, - desc -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -unsigned int -which -; /* mask of indicators for which maps should be returned */ - - - - -XkbDescPtr -desc -; /* keyboard description to be updated */ - - - - - - - - -XkbGetIndicatorMap - obtains the maps from the server for only those indicators specified by the - -which - mask and copies the values into the keyboard description specified by - -desc -. If the -indicators - field of the -desc - parameter is -NULL -, -XkbGetIndicatorMap - allocates and initializes it. - - - - - -XkbGetIndicatorMap - can generate -BadAlloc -, -BadLength -, -BadMatch -, and -BadImplementation - errors. - - - - -To free the indicator maps, use -XkbFreeIndicatorMaps - (see section 8.6). +indicators, use +XkbGetIndicatorMap. + + +XkbGetIndicatorMap + + + Status XkbGetIndicatorMap + + + Display *dpy + unsigned int which + XkbDescPtr desc + + + + + + dpy + + + + connection to the X server + + + + + + which + + + + mask of indicators for which maps should be returned + + + + + + desc + + + + keyboard description to be updated + + + + + + +XkbGetIndicatorMap +obtains the maps from the server for only those indicators specified by the +which +mask and copies the values into the keyboard description specified by +desc. +If the +indicators +field of the +desc +parameter is +NULL, +XkbGetIndicatorMap +allocates and initializes it. + + + + +XkbGetIndicatorMap +can generate +BadAlloc, +BadLength, +BadMatch, +and +BadImplementation +errors. + + + + +To free the indicator maps, use +XkbFreeIndicatorMaps +(see section 8.6). @@ -1033,169 +1029,175 @@ XkbFreeIndicatorMapsGetting Indicator Information by Name -Xkb also allows applications to refer to indicators by name. Use -XkbGetNames - to get the indicator names (see Chapter 18). Using names eliminates the need +Xkb also allows applications to refer to indicators by name. Use +XkbGetNames +to get the indicator names (see ). Using names eliminates the need for hard-coding bitmask values for particular keyboards. For example, instead -of using vendor-specific constants such as -WSKBLed_ScrollLock - mask on Digital workstations or -XLED_SCROLL_LOCK - on Sun workstations, you can instead use -XkbGetNamedIndicator - to look up information on the indicator named "Scroll Lock." - - - -Use -XkbGetNamedIndicator - to look up the indicator map and other information for an indicator by name. - - - - - - - - - -Bool -XkbGetNamedIndicator -( -dpy -, - dev_spec -, - name -, - ndx_rtrn -, - state_rtrn -, - map_rtrn -, -real_rtrn -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -unsigned int - device_spec -; /* keyboard device ID, or -XkbUseCoreKbd - */ - - - - -Atom - name -; /* name of the indicator to be retrieved */ - - - - -int * -ndx_rtrn -; /* backfilled with the index of the retrieved indicator */ - - - - -Bool * -state_rtrn -; /* backfilled with the current state of the retrieved indicator */ - - - - -XkbIndicatorMapPtr - map_rtrn -; /* backfilled with the mapping for the retrieved indicator */ - - - - -Bool * -real_rtrn -; /* backfilled with -True - if the named indicator is real (physical) */ - - - - - - - -If the device specified by -device_spec - has an indicator named -name -, - XkbGetNamedIndicator - returns -True - and populates the rest of the parameters with information about the indicator. -Otherwise, -XkbGetNamedIndicator - returns -False -. - - - - -The -ndx_rtrn - field returns the zero-based index of the named indicator. This index is the +of using vendor-specific constants such as +WSKBLed_ScrollLock +mask on Digital workstations or +XLED_SCROLL_LOCK +on Sun workstations, you can instead use +XkbGetNamedIndicator +to look up information on the indicator named Scroll Lock. + + + +Use +XkbGetNamedIndicator +to look up the indicator map and other information for an indicator by name. + + +XkbGetNamedIndicator + + + Bool XkbGetNamedIndicator + + + Display *dpy + unsigned int device_spec + Atom name + int *ndx_rtrn + Bool *state_rtrn + XkbIndicatorMapPtr map_rtrn + Bool *real_rtrn + + + + + + dpy + + + + connection to the X server + + + + + + device_spec + + + + keyboard device ID, or XkbUseCoreKbd + + + + + + name + + + + name of the indicator to be retrieved + + + + + + ndx_rtrn + + + + backfilled with the index of the retrieved indicator + + + + + + state_rtrn + + + + backfilled with the current state of the retrieved indicator + + + + + + map_rtrn + + + + backfilled with the mapping for the retrieved indicator + + + + + + real_rtrn + + + + backfilled with True + if the named indicator is real (physical) + + + + + + +If the device specified by +device_spec +has an indicator named +name, +XkbGetNamedIndicator +returns +True +and populates the rest of the parameters with information about the indicator. +Otherwise, +XkbGetNamedIndicator +returns +False. + + + + +The +ndx_rtrn +field returns the zero-based index of the named indicator. This index is the bit position to use in any function call that requires a mask of indicator -bits, as well as the indicator’s index into the -XkbIndicatorRec - array of indicator maps. -state_rtrn - returns the current state of the named indicator ( -True - = on, -False - = off). -map_rtrn - returns the indicator map for the named indicator. In addition, if the -indicator is mapped to a physical LED, the -real_rtrn - parameter is set to -True -. +bits, as well as the indicator’s index into the +XkbIndicatorRec +array of indicator maps. +state_rtrn +returns the current state of the named indicator +(True += on, +False += off). +map_rtrn +returns the indicator map for the named indicator. In addition, if the +indicator is mapped to a physical LED, the +real_rtrn +parameter is set to +True. -Each of the " -_rtrn -" arguments is optional; you can pass -NULL - for any unneeded " -_rtrn -" arguments. +Each of the "_rtrn" arguments is optional; you can pass +NULL +for any unneeded "_rtrn" arguments. - -XkbGetNamedIndicator - can generate -BadAtom - and -BadImplementation - errors. +XkbGetNamedIndicator +can generate +BadAtom +and +BadImplementation +errors. @@ -1209,22 +1211,22 @@ Just as you can get the indicator map using a mask or using an indicator name, so you can change it using a mask or a name. -You cannot change the -phys_indicators - field of the indicators structure. The only way to change the -phys_indicators - field is to change the keyboard map. +You cannot change the +phys_indicators +field of the indicators structure. The only way to change the +phys_indicators +field is to change the keyboard map. There are two ways to make changes to indicator maps and state: either change a -local copy of the indicator maps and use -XkbSetIndicatorMap - or -XkbSetNamedIndicator -, or, to reduce network traffic, use an - XkbIndicatorChangesRec - structure and use -XkbChangeIndicators. +local copy of the indicator maps and use +XkbSetIndicatorMap +or +XkbSetNamedIndicator, +or, to reduce network traffic, use an +XkbIndicatorChangesRec +structure and use +XkbChangeIndicators. @@ -1233,38 +1235,40 @@ XkbChangeIndicators. This section discusses the effects of explicitly changing indicators depending -upon different settings in the indicator map. See Tables 8.3 and Table 8.5 for +upon different settings in the indicator map. See +Table 8.3 and +Table 8.5 for information on the effects of the indicator map fields when explicit changes are made. -If -XkbIM_LEDDrivesKB - is set and -XkbIM_NoExplicit - is not, and if you call a function that updates the server’s image of the -indicator map (such as -XkbSetIndicatorMap - or -XkbSetNamedIndicator -), Xkb changes the keyboard state and controls to reflect the other fields of +If +XkbIM_LEDDrivesKB +is set and +XkbIM_NoExplicit +is not, and if you call a function that updates the server’s image of the +indicator map (such as +XkbSetIndicatorMap +or +XkbSetNamedIndicator), +Xkb changes the keyboard state and controls to reflect the other fields of the indicator map. If you attempt to explicitly change the value of an -indicator for which -XkbIM_LEDDrivesKB - is absent or for which -XkbIM_NoExplicit - is present, keyboard state or controls are unaffected. +indicator for which +XkbIM_LEDDrivesKB +is absent or for which +XkbIM_NoExplicit +is present, keyboard state or controls are unaffected. -If neither -XkbIM_NoAutomatic - nor -XkbIM_NoExplicit - is set in an indicator map, Xkb honors any request to change the state of the +If neither +XkbIM_NoAutomatic +nor +XkbIM_NoExplicit +is set in an indicator map, Xkb honors any request to change the state of the indicator, but the new state might be immediately superseded by automatic changes to the indicator state if the keyboard state or controls change. @@ -1278,11 +1282,11 @@ controls simultaneously. -If you change an indicator for which both the -XkbIM_LEDDrivesKB - and -XkbIM_NoAutomatic - flags are specified, Xkb applies the keyboard changes specified in the other +If you change an indicator for which both the +XkbIM_LEDDrivesKB +and +XkbIM_NoAutomatic +flags are specified, Xkb applies the keyboard changes specified in the other indicator map fields and changes the indicator to reflect the state that was explicitly requested. The indicator remains in the new state until it is explicitly changed again. @@ -1290,38 +1294,37 @@ explicitly changed again. -If the -XkbIM_NoAutomatic - flag is not set and -XkbIM_LEDDrivesKB - is set, Xkb applies the changes specified in the other indicator map fields +If the +XkbIM_NoAutomatic +flag is not set and +XkbIM_LEDDrivesKB +is set, Xkb applies the changes specified in the other indicator map fields and sets the state of the indicator to the values specified by the indicator map. Note that it is possible in this case for the indicator to end up in a different state than the one that was explicitly requested. For example, Xkb -does not extinguish an indicator with -which_mods - of -XkbIM_UseBase - and -mods - of -Shift - if, at the time Xkb processes the request to extinguish the indicator, one of -the -Shift - keys is physically depressed. +does not extinguish an indicator with +which_mods +of +XkbIM_UseBase +and +mods +of +Shift +if, at the time Xkb processes the request to extinguish the indicator, one of +the +Shift +keys is physically depressed. -If you explicitly light an indicator for which -XkbIM_LEDDrivesKB - is set, Xkb enables all of the boolean controls specified in the -ctrls - field of its indicator map. Explicitly extinguishing such an indicator causes -Xkb to disable all of the boolean controls specified in -ctrls -. +If you explicitly light an indicator for which +XkbIM_LEDDrivesKB +is set, Xkb enables all of the boolean controls specified in the +ctrls +field of its indicator map. Explicitly extinguishing such an indicator causes +Xkb to disable all of the boolean controls specified in +ctrls. @@ -1331,64 +1334,68 @@ ctrls To update the maps for one or more indicators, first modify a local copy of the -keyboard description, then use -XkbSetIndicatorMap - to download the changes to the server: - - - - - - - - - -Bool - XkbSetIndicatorMap -( -dpy -, - which -, - desc -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -unsigned int -which -; /* mask of indicators to change */ - - - - -XkbDescPtr -desc -; /* keyboard description from which the maps are taken */ - - - - - - - -For each - -bit set in the -which -parameter, - XkbSetIndicatorMap - sends the corresponding indicator map from the -desc - parameter to the server. +keyboard description, then use +XkbSetIndicatorMap +to download the changes to the server: + + +XkbSetIndicatorMap + + + Bool XkbSetIndicatorMap + + + Display *dpy + unsigned int which + XkbDescPtr desc + + + + + + dpy + + + + connection to the X server + + + + + + which + + + + mask of indicators to change + + + + + + desc + + + + keyboard description from which the maps are taken + + + + + + +For each +bit set in the +which +parameter, +XkbSetIndicatorMap +sends the corresponding indicator map from the +desc +parameter to the server. @@ -1397,9 +1404,8 @@ descChanging Indicator Maps by Name - -XkbSetNamedIndicator - can do several related things: +XkbSetNamedIndicator +can do several related things: @@ -1425,295 +1431,298 @@ Set the indicator map for the indicator - - - - - - - -Bool - XkbSetNamedIndicator -( -dpy -, - device_spec -, - name -, - change_state, state -, - create_new -, - map -) - - - - -Display * - dpy -; /* connection to the X server */ - - - - -unsigned int - device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -Atom - name -; /* name of the indicator to change */ - - - - -Bool - change_state -; /* whether to change the indicator state or not */ - - - - -Bool - state -; /* desired new state for the indicator */ - - - - -Bool -create_new -; /* whether a new indicator with the specified name should be -created when necessary */ - - - - -XkbIndicatorMapPtr -map -; /* new map for the indicator */ - - - - - +XkbSetNamedIndicator + + + BoolXkbSetNamedIndicator + + + Display *dpy + unsigned int device_spec + Atom name + Bool change_state + Bool state + Bool create_new + XkbIndicatorMapPtr map + + + + + + dpy + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + name + + + + name of the indicator to change + + + + + + change_state + + + + whether to change the indicator state or not + + + + + + state + + + + desired new state for the indicator + + + + + + create_new + + + + whether a new indicator with the specified name should be + created when necessary + + + + + + map + + + + new map for the indicator + + + + If a compatible version of the Xkb extension is not available in the server, - -XkbSetNamedIndicator - returns -False -. Otherwise, it sends a request to the X server to change the indicator -specified by -name - and returns -True. +XkbSetNamedIndicator +returns +False. +Otherwise, it sends a request to the X server to change the indicator +specified by +name +and returns +True. -If -change_state - is -True -, and the optional parameter, -state -, is not -NULL -, -XkbSetNamedIndicator - tells the server to change the state of the named indicator to the value -specified by -state. +If +change_state +is +True, +and the optional parameter, +state, +is not +NULL, +XkbSetNamedIndicator +tells the server to change the state of the named indicator to the value +specified by +state. -If an indicator with the name specified by -name - does not already exist, the -create_new - parameter tells the server whether it should create a new named indicator. If - -create_new - is -True -, the server finds the first indicator that doesn’t have a name and gives it -the name specified by -name. +If an indicator with the name specified by +name +does not already exist, the +create_new +parameter tells the server whether it should create a new named indicator. If +create_new +is +True, +the server finds the first indicator that doesn’t have a name and gives it +the name specified by +name. -If the optional parameter, -map -, is not -NULL -, -XkbSetNamedIndicator - tells the server to change the indicator’s map to the values specified -in map. +If the optional parameter, +map, +is not +NULL, +XkbSetNamedIndicator +tells the server to change the indicator’s map to the values specified +in map. - -XkbSetNamedIndicator - can generate -BadAtom - and -BadImplementation - errors. In addition, it can also generate -XkbIndicatorStateNotify - (see section 8.5), -XkbIndicatorMapNotify -, and -XkbNamesNotify - events (see section 18.5). +XkbSetNamedIndicator +can generate +BadAtom +and +BadImplementation +errors. In addition, it can also generate +XkbIndicatorStateNotify +(see section 8.5), +XkbIndicatorMapNotify, +and +XkbNamesNotify +events (see section 18.5). - + The XkbIndicatorChangesRec Structure + +XkbIndicatorChangesRec + -The -XkbIndicatorChangesRec - identifies small modifications to the indicator map. Use it with the function - -XkbChangeIndicators - to reduce the amount of traffic sent to the server. +The +XkbIndicatorChangesRec +identifies small modifications to the indicator map. Use it with the function +XkbChangeIndicators +to reduce the amount of traffic sent to the server. typedef struct _XkbIndicatorChanges { - unsigned int state_changes; - unsigned int map_changes; -} -XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; + unsigned int state_changes; + unsigned int map_changes; +} XkbIndicatorChangesRec,*XkbIndicatorChangesPtr; -The -state_changes - field is a mask that specifies the indicators that have changed state, and - -map_changes - is a mask that specifies the indicators whose maps have changed. +The +state_changes +field is a mask that specifies the indicators that have changed state, and +map_changes +is a mask that specifies the indicators whose maps have changed. To change indicator maps or state without passing the entire keyboard -description, use -XkbChangeIndicators -. - - - - - - - - - -Bool -XkbChangeIndicators -( -dpy, xkb, changes, state -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -XkbDescPtr -xkb -; /* keyboard description from which names are to be - - - - - taken. */ - - - - -XkbIndicatorChangesPtr -changes -; /* indicators to be updated on the server */ - - - - -unsigned int -state -; /* new state of indicators listed in - - - - - - changes --> -state_changes - */ - - - - - - - - -XkbChangeIndicators - copies any maps specified by -changes - from the keyboard description, -xkb -, to the server specified by -dpy -. If any bits are set in the -state_changes - field of -changes -, -XkbChangeIndicators - also sets the state of those indicators to the values specified in the - -state - mask. A 1 bit in -state - turns the corresponding indicator on, a 0 bit turns it off. - - - - - -XkbChangeIndicator -s can generate -BadAtom - and -BadImplementation - errors. In addition, it can also generate -XkbIndicatorStateNotify - and -XkbIndicatorMapNotify - events (see section 8.5). +description, use +XkbChangeIndicators. + + +XkbChangeIndicators + + + Bool XkbChangeIndicators + + + Display *dpy + XkbDescPtr xkb + XkbIndicatorChangesPtr changes + unsigned int state + + + + + + dpy + + + + connection to the X server + + + + + + xkb + + + + keyboard description from which names are to be taken. + + + + + + changes + + + + indicators to be updated on the server + + + + + + state + + + + new state of indicators listed in changes->state_changes + + + + + + +XkbChangeIndicators +copies any maps specified by +changes +from the keyboard description, +xkb, +to the server specified by +dpy. +If any bits are set in the +state_changes +field of +changes, +XkbChangeIndicators +also sets the state of those indicators to the values specified in the +state +mask. A 1 bit in +state +turns the corresponding indicator on, a 0 bit turns it off. + + + + +XkbChangeIndicators +can generate +BadAtom +and +BadImplementation +errors. In addition, it can also generate +XkbIndicatorStateNotify +and +XkbIndicatorMapNotify +events (see section 8.5). @@ -1722,280 +1731,292 @@ XkbIndicatorMapNotify Tracking Changes to Indicator State or Map - -Whenever an indicator changes state, the server sends -XkbIndicatorStateNotify - events to all interested clients. Similarly, whenever an indicator’s map -changes, the server sends -XkbIndicatorMapNotify - events to all interested clients. - - - - -To receive -XkbIndicatorStateNotify - events, use -XkbSelectEvents - (see section 4.3) with both the -bits_to_change -and - values_for_bits - parameters containing -XkbIndicatorStateNotifyMask -. To receive -XkbIndicatorMapNotify - events, use -XkbSelectEvents - with -XkbIndicatorMapNotifyMask -. - - - - -To receive events for only specific indicators, use -XkbSelectEventDetails -. Set the -event_type - parameter - to XkbIndicatorStateNotify - or -XkbIndicatorMapNotify -, and set both the -bits_to_change -and - values_for_bits - detail parameters to a mask where each bit specifies one indicator, turning on + +eventsXkbIndicatorStateNotify + +XkbIndicatorStateNotifyEvent + + +eventsXkbIndicatorMapNotify + +XkbIndicatorMapNotifyEvent + + +Whenever an indicator changes state, the server sends +XkbIndicatorStateNotify +events to all interested clients. Similarly, whenever an indicator’s map +changes, the server sends +XkbIndicatorMapNotify +events to all interested clients. + + + + +To receive +XkbIndicatorStateNotify +events, use +XkbSelectEvents +(see section 4.3) with both the +bits_to_change +and +values_for_bits +parameters containing +XkbIndicatorStateNotifyMask. +To receive +XkbIndicatorMapNotify +events, use +XkbSelectEvents +with +XkbIndicatorMapNotifyMask. + + + + +To receive events for only specific indicators, use +XkbSelectEventDetails. +Set the +event_type +parameter to +XkbIndicatorStateNotify +or +XkbIndicatorMapNotify, +and set both the +bits_to_change +and +values_for_bits +detail parameters to a mask where each bit specifies one indicator, turning on those bits that specify the indicators for which you want to receive events. Both types of indicator events use the same structure: - - + typedef struct _XkbIndicatorNotify { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* specifies state or map notify */ - int device; /* Xkb device ID, will not be XkbUseCoreKbd */ - unsigned int changed; /* mask of indicators with new state or map */ - unsigned int state; /* current state of all indicators */ -} XkbIndicatorNotifyEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* specifies state or map notify */ + int device; /* Xkb device ID, will not be XkbUseCoreKbd */ + unsigned int changed; /* mask of indicators with new state or map */ + unsigned int state; /* current state of all indicators */ +} XkbIndicatorNotifyEvent; - -xkb_type - is either -XkbIndicatorStateNotify - or -XkbIndicatorMapNotify -, depending on whether the event is a -kbIndicatorStateNotify - event or -kbIndicatorMapNotify - event. - - - -The -changed - parameter is a mask that is the bitwise inclusive OR of the indicators that -have changed. If the event is of type -XkbIndicatorMapNotify -, -changed - reports the maps that changed. If the event is of type -XkbIndicatorStateNotify -, -changed - reports the indicators that have changed state. -state - is a mask that specifies the current state of all indicators, whether they -have changed or not, for both -XkbIndicatorStateNotify - and IndicatorMapNotify events. - - - -When your client application receives either a -XkbIndicatorStateNotify - event or -XkbIndicatorMapNotify - event, you can note the changes in a changes structure by calling -XkbNoteIndicatorChanges. - - - - - - - - - -void -XkbNoteIndicatorChanges -( -old -, - new -, - wanted -) - - - - -XkbIndicatorChangesPtr - old -; /* XkbIndicatorChanges structure to be updated */ - - - - -XkbIndicatorNotifyEvent * -new -; /* event from which changes are to be copied */ - - - - -unsigned int - wanted -; /* which changes are to be noted */ - - - - - - - -The -wanted - parameter is the bitwise inclusive OR of -XkbIndicatorMapMask - and -XkbIndicatorStateMask -. -XkbNoteIndicatorChanges - copies any changes reported in -new - and specified in -wanted - into the changes record specified by -old. +xkb_type +is either +XkbIndicatorStateNotify +or +XkbIndicatorMapNotify, +depending on whether the event is a +XkbIndicatorStateNotify +event or +XkbIndicatorMapNotify, +event. + + + +The +changed +parameter is a mask that is the bitwise inclusive OR of the indicators that +have changed. If the event is of type +XkbIndicatorMapNotify, +changed +reports the maps that changed. If the event is of type +XkbIndicatorStateNotify, +changed +reports the indicators that have changed state. +state +is a mask that specifies the current state of all indicators, whether they +have changed or not, for both +XkbIndicatorStateNotify +and XkbIndicatorMapNotify events. + + + +When your client application receives either a +XkbIndicatorStateNotify +event or +XkbIndicatorMapNotify +event, you can note the changes in a changes structure by calling +XkbNoteIndicatorChanges. + + +XkbNoteIndicatorChanges + + + void XkbNoteIndicatorChanges + + + XkbIndicatorChangesPtr old + XkbIndicatorNotifyEvent *new + unsigned int wanted + + + + + + old + + + + XkbIndicatorChanges structure to be updated + + + + + + new + + + + event from which changes are to be copied + + + + + + wanted + + + + which changes are to be noted + + + + + + +The +wanted +parameter is the bitwise inclusive OR of +XkbIndicatorMapMask +and +XkbIndicatorStateMask. +XkbNoteIndicatorChanges +copies any changes reported in +new +and specified in +wanted +into the changes record specified by +old. To update a local copy of the keyboard description with the actual values, pass -the results of one or more calls to -XkbNoteIndicatorChanges - to -XkbGetIndicatorChanges: - - - - - - - - - - -Status -XkbGetIndicatorChanges -( -dpy -, - xkb -, - changes -, - state -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -XkbDescPtr -xkb -; /* keyboard description to hold the new values */ - - - - -XkbIndicatorChangesPtr -changes -; /* indicator maps/state to be obtained from the server */ - - - - -unsigned int * -state -; /* backfilled with the state of the indicators */ - - - - - - - - -XkbGetIndicatorChanges - examines the -changes - parameter, pulls over the necessary information from the server, and copies -the results into the -xkb - keyboard description. If any bits are set in the -state_changes - field of -changes -, -XkbGetIndicatorChanges - also places the state of those indicators in -state -. If the -indicators - field of -xkb - is -NULL -, -XkbGetIndicatorChanges - allocates and initializes it. To free the -indicators - field, use -XkbFreeIndicators - (see section 8.6). - - - - - -XkbGetIndicatorChanges - can generate -BadAlloc -, -BadImplementation, - and -BadMatch - errors. +the results of one or more calls to +XkbNoteIndicatorChanges +to +XkbGetIndicatorChanges: + + + +XkbGetIndicatorChanges + + + Status XkbGetIndicatorChanges + + + Display *dpy + XkbDescPtr xkb + XkbIndicatorChangesPtr changes + unsigned int *state + + + + + + dpy + + + + connection to the X server + + + + + + xkb + + + + keyboard description to hold the new values + + + + + + changes + + + + indicator maps/state to be obtained from the server + + + + + + state + + + + backfilled with the state of the indicators + + + + + + +XkbGetIndicatorChanges +examines the +changes +parameter, pulls over the necessary information from the server, and copies +the results into the +xkb +keyboard description. If any bits are set in the +state_changes +field of +changes, +XkbGetIndicatorChanges +also places the state of those indicators in +state. +If the +indicators +field of +xkb +is +NULL, +XkbGetIndicatorChanges +allocates and initializes it. To free the +indicators +field, use +XkbFreeIndicatorMaps +(see section 8.6). + + + + +XkbGetIndicatorChanges +can generate +BadAlloc, +BadImplementation, +and +BadMatch +errors. @@ -2004,102 +2025,99 @@ BadMatchAllocating and Freeing Indicator Maps -Most applications do not need to directly allocate the -indicators - member of the keyboard description record (the keyboard description record is -described in Chapter 6). If the need arises, however, use -XkbAllocIndicatorMaps. - - - - - - - - - -Status -XkbAllocIndicatorMaps -( -xkb -) - - - - -XkbDescPtr -xkb -; /* keyboard description structure */ - - - - - - - -The -xkb - parameter must point to a valid keyboard description. If it doesn’t, - -XkbAllocIndicatorMaps - returns a -BadMatch - error. Otherwise, -XkbAllocIndicatorMaps - allocates and initializes the -indicators - member of the keyboard description record and returns -Success -. If -XkbAllocIndicatorMaps - was unable to allocate the indicators record, it reports a Bad -Alloc - error. - - - -To free memory used by the -indicators - member of an -XkbDescRec - structure, use -XkbFreeIndicatorMaps. - - - - - - - - - -void -XkbFreeIndicatorMaps -( -xkb -) - - - - -XkbDescPtr -xkb -; /* keyboard description structure */ - - - - - - - -If the indicators - member of the keyboard description record -pointed to by xkb -is not NULL -, XkbFreeIndicatorMaps +Most applications do not need to directly allocate the +indicators +member of the keyboard description record (the keyboard description record is +described in ). If the need arises, however, use +XkbAllocIndicatorMaps. + + +XkbAllocIndicatorMaps + + + Status XkbAllocIndicatorMaps + + + XkbDescPtr xkb + + + + + + xkb + + + + keyboard description structure + + + + + + +The +xkb +parameter must point to a valid keyboard description. If it doesn’t, +XkbAllocIndicatorMaps +returns a +BadMatch +error. Otherwise, +XkbAllocIndicatorMaps +allocates and initializes the +indicators +member of the keyboard description record and returns +Success. +If +XkbAllocIndicatorMaps +was unable to allocate the indicators record, it reports a +BadAlloc +error. + + + +To free memory used by the +indicators +member of an +XkbDescRec +structure, use +XkbFreeIndicatorMaps. + + +XkbFreeIndicatorMaps + + + void XkbFreeIndicatorMaps + + + XkbDescPtr xkb + + + + + + xkb + + + + keyboard description structure + + + + + + +If the indicators +member of the keyboard description record +pointed to by xkb +is not NULL, +XkbFreeIndicatorMaps frees the memory associated with -the indicators -member of xkb. +the indicators +member of xkb. diff --git a/libX11/specs/XKB/ch09.xml b/libX11/specs/XKB/ch09.xml index 3f14eed68..0241880b9 100644 --- a/libX11/specs/XKB/ch09.xml +++ b/libX11/specs/XKB/ch09.xml @@ -1,22 +1,30 @@ + + Bells +bell The core X protocol allows only applications to explicitly sound the system bell with a given duration, pitch, and volume. Xkb extends this capability by allowing clients to attach symbolic names to bells, disable audible bells, and receive an event whenever the keyboard bell is rung. For the purposes of this -document, the -audible - bell is defined to be the system bell, or the default keyboard bell, as +document, the +audible + +audible bell + +bellaudible +bell is defined to be the system bell, or the default keyboard bell, as opposed to any other audible sound generated elsewhere in the system. -You can ask to receive -XkbBellNotify - events (see section 9.4) when any client rings any one of the following: +You can ask to receive +XkbBellNotify +events (see section 9.4) when any client rings any one of the following: @@ -27,11 +35,11 @@ The default bell -Any bell on an input device that can be specified by a -bell_class - and -bell_id - pair +Any bell on an input device that can be specified by a +bell_class +and +bell_id +pair @@ -45,49 +53,49 @@ visual feedback, if any, that is associated with the name.) -You can also ask to receive -XkbBellNotify - events when the server rings the default bell or if any client has requested +You can also ask to receive +XkbBellNotify +events when the server rings the default bell or if any client has requested events only (without the bell sounding) for any of the bell types previously listed. -You can disable audible bells on a global basis (to set the -AudibleBell - control, see Chapter 10). For example, a client that replaces the keyboard -bell with some other audible cue might want to turn off the -AudibleBell - control to prevent the server from also generating a sound and avoid -cacophony. If you disable audible bells and request to receive -XkbBellNotify - events, you can generate feedback different from the default bell. +You can disable audible bells on a global basis (to set the +AudibleBell +control, see ). For example, a client that replaces the keyboard +bell with some other audible cue might want to turn off the +AudibleBell +control to prevent the server from also generating a sound and avoid +cacophony. If you disable audible bells and request to receive +XkbBellNotify +events, you can generate feedback different from the default bell. -You can, however, override the -AudibleBell - control by calling one of the functions that force the ringing of a bell in -spite of the setting of the -AudibleBell - control — -XkbForceDeviceBell - or -XkbForceBell - (see section 9.3.3). In this case the server does not generate a bell event. +You can, however, override the +AudibleBell +control by calling one of the functions that force the ringing of a bell in +spite of the setting of the +AudibleBell +control — +XkbForceDeviceBell +or +XkbForceBell +(see section 9.3.3). In this case the server does not generate a bell event. Just as some keyboards can produce keyclicks to indicate when a key is pressed or repeating, Xkb can provide feedback for the controls by using special beep -codes. The -AccessXFeedback - control is used to configure the specific types of operations that generate -feedback. See section 10.6.3 for a discussion on -AccessXFeedback - control. +codes. The +AccessXFeedback +control is used to configure the specific types of operations that generate +feedback. See section 10.6.3 for a discussion on +AccessXFeedback +control. @@ -102,20 +110,22 @@ and the events the server generates for bells. You can associate a name to an act of ringing a bell by converting the name to an Atom and then using this name when you call the functions listed in this chapter. If an event is generated as a result, the name is then passed to all -other clients interested in receiving -XkbBellNotify - events. Note that these are arbitrary names and that there is no binding to +other clients interested in receiving +XkbBellNotify +events. Note that these are arbitrary names and that there is no binding to any sounds. Any sounds or other effects (such as visual bells on the screen) must be generated by a client application upon receipt of the bell event containing the name. There is no default name for the default keyboard bell. The server does generate some predefined bells for the AccessX controls (see -section 10.6.3). These named bells are shown in Table 9.1; the name is included -in any bell event sent to clients that have requested to receive -XkbBellNotify - events. +section 10.6.3). +These named bells are shown in Table 9.1; +the name is included +in any bell event sent to clients that have requested to receive +XkbBellNotify +events. -
+
Predefined Bells @@ -200,36 +210,36 @@ XkbBellNotify Using Xkb you can generate bell events that do not necessarily ring the system bell. This is useful if you need to use an audio server instead of the system beep. For example, when an audio client starts, it could disable the audible -bell (the system bell) and then listen for -XkbBellNotify - events (see section 9.4). When it receives a -XkbBellNotify - event, the audio client could then send a request to an audio server to play a +bell (the system bell) and then listen for +XkbBellNotify +events (see section 9.4). When it receives a +XkbBellNotify +event, the audio client could then send a request to an audio server to play a sound. -You can control the audible bells feature by passing the -XkbAudibleBellMask - to -XkbChangeEnabledControls - (see section 10.1.1). If you set -XkbAudibleBellMask - on, the server rings the system bell when a bell event occurs. This is the -default. If you set -XkbAudibleBellMask - off and a bell event occurs, the server does not ring the system bell unless -you call -XkbForceDeviceBell - or -XkbForceBell - (see section 9.3.3). +You can control the audible bells feature by passing the +XkbAudibleBellMask +to +XkbChangeEnabledControls +(see section 10.1.1). If you set +XkbAudibleBellMask +on, the server rings the system bell when a bell event occurs. This is the +default. If you set +XkbAudibleBellMask +off and a bell event occurs, the server does not ring the system bell unless +you call +XkbForceDeviceBell +or +XkbForceBell +(see section 9.3.3). Audible bells are also part of the per-client auto-reset controls. For more -information on auto-reset controls, see section 10.1.2. +information on auto-reset controls, see section 10.1.2. @@ -244,30 +254,29 @@ events. The input extension has two types of feedbacks that can generate bells — bell feedback and keyboard feedback. Some of the functions in this section have - -bell_class - and -bell_id - parameters; set them as follows: Set -bell_class - to -BellFeedbackClass - or -KbdFeedbackClass -. A device can have more than one feedback of each type; set -bell_id - to the particular bell feedback of -bell_class - type. +bell_class +and +bell_id +parameters; set them as follows: Set +bell_class +to +BellFeedbackClass +or +KbdFeedbackClass. +A device can have more than one feedback of each type; set +bell_id +to the particular bell feedback of +bell_class +type. -Table 9.2 shows the conditions that cause a bell to sound or an -XkbBellNotifyEvent - to be generated when a bell function is called. +Table 9.2 shows the conditions that cause +a bell to sound or an XkbBellNotifyEvent +to be generated when a bell function is called. -
+
Bell Sounding and Bell Event Generating @@ -341,230 +350,257 @@ XkbBellNotifyEvent To ring the bell on an X input extension device or the default keyboard, use - -XkbDeviceBell. +XkbDeviceBell. - - - - - - - -Bool -XkbDeviceBell -( -display, window, device_id, bell_class, bell_id, percent, name -) - - - - -Display * - display -; /* connection to the X server */ - - - - -Window - window -; /* window for which the bell is generated, or None */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int -bell_class -; /* X input extension bell class of the bell to be rung */ - - - - -unsigned int -bell_id -; /* X input extension bell ID of the bell to be rung */ - - - - -int -percent -; /* bell volume, from -100 to 100 inclusive */ - - - - -Atom -name -; /* a name for the bell, or -NULL - */ - - - - - +XkbDeviceBell + + + Bool XkbDeviceBell + + + Display *display + Window window + unsigned int device_spec + unsigned int bell_class + unsigned int bell_id + int percent + Atom name + + + + + + display + + + + connection to the X server + + + + + + window + + + + window for which the bell is generated, or None + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + bell_class + + + + X input extension bell class of the bell to be rung + + + + + + bell_id + + + + X input extension bell ID of the bell to be rung + + + + + + percent + + + + bell volume, from −100 to 100 inclusive + + + + + + name + + + + a name for the bell, or NULL + + + + -Set -percent - to be the volume relative to the base volume for the keyboard as described for - -XBell. +Set +percent +to be the volume relative to the base volume for the keyboard as described for +XBell. -Note that -bell_class - and -bell_id - indicate the bell to physically ring. -name - is simply an arbitrary moniker for the client application’s use. +Note that +bell_class +and +bell_id +indicate the bell to physically ring. +name +is simply an arbitrary moniker for the client application’s use. To determine the current feedback settings of an extension input device, use - -XGetFeedbackControl -. See the X input extension documentation for more information on -XGetFeedbackControl - and related data structures. +XGetFeedbackControl. +See the +X input extension documentation for more information on +XGetFeedbackControl +and related data structures. -If a compatible keyboard extension is not present in the X server, -XkbDeviceBell - immediately returns -False -. Otherwise, -XkbDeviceBell +If a compatible keyboard extension is not present in the X server, +XkbDeviceBell +immediately returns +False. +Otherwise, +XkbDeviceBell rings the bell as specified for the display and keyboard device and returns - -True -. If you have disabled the audible bell, the server does not ring the system -bell, although it does generate a -XkbBellNotify - event. +True. +If you have disabled the audible bell, the server does not ring the system +bell, although it does generate a +XkbBellNotify +event. -You can call -XkbDeviceBell - without first initializing the keyboard extension. +You can call +XkbDeviceBell +without first initializing the keyboard extension. As a convenience function, Xkb provides a function to ring the bell on the -default keyboard: -XkbBell. +default keyboard: +XkbBell. - - - - - - - -Bool -XkbBell -( -display, window, percent, name -) - - - - -Display * -display -; /* connection to the X server */ - - - - -Window - window -; /* event window, or None*/ - - - - -int - percent -; /* relative volume, which can range from -100 to 100 inclusive */ - - - - -Atom - name -; /* a bell name, or -NULL - */ - - - - - +XkbBell + + + Bool XkbBell + + + Display *display + Window window + int percent + Atom name + + + + + + display + + + + connection to the X server + + + + + + window + + + + event window, or None + + + + + + percent + + + + relative volume, which can range from −100 to 100 inclusive + + + + + + name + + + + a bell name, or NULL + + + + -If a compatible keyboard extension isn’t present in the X server, -XkbBell - calls -XBell -with the specified -display - and -percent -, and returns -False -. Otherwise, -XkbBell -calls -XkbDeviceBell - with the specified -display, window, percent, -and -name -, a -device_spec - of -XkbUseCoreKbd -, a -bell_class -of -XkbDfltXIClass -, and a -bell_id -of -XkbDfltXIId, - and returns -True. +If a compatible keyboard extension isn’t present in the X server, +XkbBell +calls +XBell +with the specified +display +and +percent, +and returns +False. +Otherwise, +XkbBell +calls +XkbDeviceBell +with the specified +display, +window, +percent, +and +name, +a +device_spec +of +XkbUseCoreKbd, +a +bell_class +of +XkbDfltXIClass, +and a +bell_id +of +XkbDfltXIId, +and returns +True. If you have disabled the audible bell, the server does not ring the system -bell, although it does generate a -XkbBellNotify - event. +bell, although it does generate a +XkbBellNotify +event. -You can call -XkbBell - without first initializing the keyboard extension. +You can call +XkbBell +without first initializing the keyboard extension. @@ -579,7 +615,7 @@ application starts. For example, if an audio client listens for these types of bells, it can -produce a "whoosh" sound when it receives a named bell event to indicate a +produce a whoosh sound when it receives a named bell event to indicate a client just started. In this manner, applications can generate start-up feedback and not worry about producing annoying beeps if an audio server is not running. @@ -588,207 +624,237 @@ running. To cause a bell event for an X input extension device or for the keyboard, -without ringing the corresponding bell, use -XkbDeviceBellEvent. +without ringing the corresponding bell, use +XkbDeviceBellEvent. - - - - - - - -Bool -XkbDeviceBellEvent -( -display, window, device_spec, bell_class, bell_id, percent, name -) - - - - -Display * -display -; /* connection to the X server */ - - - - -Window -window -; /* event window, or None*/ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int -bell_class; - /* input extension bell class for the event */ - - - - -unsigned int -bell_id -; /* input extension bell ID for the event */ - - - - -int -percent -; /* volume for the bell, which can range from -100 to 100 inclusive */ - - - - -Atom -name -; /* a bell name, or -NULL - */ - - - - - +XkbDeviceBellEvent + + + Bool XkbDeviceBellEvent + + + Display *display + Window window + unsigned int device_spec + unsigned int bell_class + unsigned int bell_id + int percent + Atom name + + + + + + display + + + + connection to the X server + + + + + + window + + + + event window, or None + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + bell_class + + + + input extension bell class for the event + + + + + + bell_id + + + + input extension bell ID for the event + + + + + + percent + + + + volume for the bell, which can range from −100 to 100 inclusive + + + + + + name + + + + a bell name, or NULL + + + + -If a compatible keyboard extension isn’t present in the X server, -XkbDeviceBellEvent - immediately returns -False -. Otherwise, -XkbDeviceBellEvent - causes an -XkbBellNotify - event to be sent to all interested clients and returns -True -. Set -percent - to be the volume relative to the base volume for the keyboard as described for -XBell. +If a compatible keyboard extension isn’t present in the X server, +XkbDeviceBellEvent +immediately returns +False. +Otherwise, +XkbDeviceBellEvent +causes an +XkbBellNotify +event to be sent to all interested clients and returns +True. +Set +percent +to be the volume relative to the base volume for the keyboard as described for +XBell. -In addition, -XkbDeviceBellEvent - may generate -Atom - protocol errors as well as -XkbBellNotify - events. You can call -XkbBell - without first initializing the keyboard extension. +In addition, +XkbDeviceBellEvent +may generate +Atom +protocol errors as well as +XkbBellNotify +events. You can call +XkbBell +without first initializing the keyboard extension. As a convenience function, Xkb provides a function to cause a bell event for -the keyboard without ringing the bell: -XkbBellEvent. +the keyboard without ringing the bell: +XkbBellEvent. - - - - - - - -Bool -XkbBellEvent -( -display, window, percent, name -) - - - - -Display * -display -; /* connection to the X server */ - - - - -Window -window -; /* the event window, or None */ - - - - -int -percent -; /* relative volume, which can range from -100 to 100 inclusive */ - - - - -Atom -name -; /* a bell name, or -NULL - */ - - - - - +XkbBellEvent + + + Bool XkbBellEvent + + + Display *display + Window window + int percent + Atom name + + + + + + display + + + + connection to the X server + + + + + + window + + + + the event window, or None + + + + + + percent + + + + relative volume, which can range from −100 to 100 inclusive + + + + + + name + + + + a bell name, or NULL + + + + -If a compatible keyboard extension isn’t present in the X server, -XkbBellEvent - immediately returns -False -. Otherwise, -XkbBellEvent -calls - XkbDeviceBellEvent - with the specified -display, window, percent, -and -name -, a -device_spec - of -XkbUseCoreKbd -, a -bell_class -of -XkbDfltXIClass -, and a -bell_id -of -XkbDfltXIId, - and returns what -XkbDeviceBellEvent - returns. +If a compatible keyboard extension isn’t present in the X server, +XkbBellEvent +immediately returns +False. +Otherwise, +XkbBellEvent +calls +XkbDeviceBellEvent +with the specified +display, +window, +percent, +and +name, +a +device_spec +of +XkbUseCoreKbd, +a +bell_class +of +XkbDfltXIClass, +and a +bell_id +of +XkbDfltXIId, +and returns what +XkbDeviceBellEvent +returns. -XkbBellEvent -generates a XkbBellNotify +XkbBellEvent +generates a XkbBellNotify event. -You can call -XkbBellEvent +You can call +XkbBellEvent without first initializing the keyboard extension. @@ -798,192 +864,205 @@ without first initializing the keyboard extension. To ring the bell on any keyboard, overriding user preference settings for -audible bells, use XkbForceDeviceBell. +audible bells, use XkbForceDeviceBell. - - - - - - - -Bool -XkbForceDeviceBell -( -display, window, device_spec, bell_class, bell_id, percent -) - - - - -Display * -display -; /* connection to the X server */ - - - - -Window -window -; /* event window, or None */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int -bell_class -; /* input extension class of the bell to be rung */ - - - - -unsigned int -bell_id -; /* input extension ID of the bell to be rung */ - - - - -int -percent -; /* relative volume, which can range from -100 to 100 inclusive */ - - - - - +XkbForceDeviceBell + + + Bool XkbForceDeviceBell + + + Display *display + Window window + unsigned int device_spec + unsigned int bell_class + unsigned int bell_id + int percent + + + + + + display + + + + connection to the X server + + + + + + window + + + + event window, or None + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + bell_class + + + + input extension class of the bell to be rung + + + + + + bell_id + + + + input extension ID of the bell to be rung + + + + + + percent + + + + relative volume, which can range from −100 to 100 inclusive + + + + -If a compatible keyboard extension isn’t present in the X server, -XkbForceDeviceBell - immediately returns -False -. Otherwise, -XkbForceDeviceBell +If a compatible keyboard extension isn’t present in the X server, +XkbForceDeviceBell +immediately returns +False. +Otherwise, +XkbForceDeviceBell rings the bell as specified for the display and keyboard device and returns - -True -. Set -percent - to be the volume relative to the base volume for the keyboard as described for - -XBell -. There is no -name - parameter because -XkbForceDeviceBell -does not cause an -XkbBellNotify - event. +True. +Set +percent +to be the volume relative to the base volume for the keyboard as described for +XBell. +There is no +name +parameter because +XkbForceDeviceBell +does not cause an +XkbBellNotify +event. -You can call -XkbBell - without first initializing the keyboard extension. +You can call +XkbBell +without first initializing the keyboard extension. To ring the bell on the default keyboard, overriding user preference settings -for audible bells, use -XkbForceBell. +for audible bells, use +XkbForceBell. - - - - - - - -Bool -XkbForceBell -( -display, percent) - - - - -Display * -display -; /* connection to the X server */ - - - - -int -percent -; /* volume for the bell, which can range from -100 to 100 inclusive */ - - - - - +XkbForceBell + + + Bool XkbForceBell + + + Display *display + int percent + + + + + + display + + + + connection to the X server + + + + + + percent + + + + volume for the bell, which can range from −100 to 100 inclusive + + + + -If a compatible keyboard extension isn’t present in the X server, -XkbForceBell - calls -XBell -with the specified -display - and -percent - and returns -False -. Otherwise, -XkbForceBell -calls -XkbForceDeviceBell - with the specified -display -and - percent -, -device_spec - = -XkbUseCoreKbd -, -bell_class -= -XkbDfltXIClass -, -bell_id -= -XkbDfltXIId, - -window - = None, and -name - = -NULL -, and returns what - XkbForceDeviceBell - returns. +If a compatible keyboard extension isn’t present in the X server, +XkbForceBell +calls +XBell +with the specified +display +and +percent +and returns +False. +Otherwise, +XkbForceBell +calls +XkbForceDeviceBell +with the specified +display +and +percent, +device_spec += +XkbUseCoreKbd, +bell_class += +XkbDfltXIClass, +bell_id += +XkbDfltXIId, +window += None, and +name += +NULL, +and returns what +XkbForceDeviceBell +returns. - -XkbForceBell -does not cause an -XkbBellNotify - event. +XkbForceBell +does not cause an +XkbBellNotify +event. -You can call -XkbBell - without first initializing the keyboard extension. +You can call +XkbBell +without first initializing the keyboard extension. @@ -992,76 +1071,75 @@ XkbBellDetecting Bells -Xkb generates -XkbBellNotify - events for all bells except for those resulting from calls to -XkbForceDeviceBell - and -XkbForceBell -. To receive -XkbBellNotify - events under all possible conditions, pass -XkbBellNotifyMask - in both the -bits_to_change -and - values_for_bits - parameters to -XkbSelectEvents - (see section 4.3). +Xkb generates +XkbBellNotify +events for all bells except for those resulting from calls to +XkbForceDeviceBell +and +XkbForceBell. +To receive +XkbBellNotify +events under all possible conditions, pass +XkbBellNotifyMask +in both the +bits_to_change +and +values_for_bits +parameters to +XkbSelectEvents +(see section 4.3). -The -XkbBellNotify - event has no event details. It is either selected or it is not. However, you -can call -XkbSelectEventDetails - using -XkbBellNotify - as the -event_type - and specifying -XkbAllBellNotifyMask - in -bits_to_change - and -values_for_bits. - This has the same effect as a call to -XkbSelectEvents. +The +XkbBellNotify +event has no event details. It is either selected or it is not. However, you +can call +XkbSelectEventDetails +using +XkbBellNotify +as the +event_type +and specifying +XkbAllBellEventsMask +in +bits_to_change +and +values_for_bits. +This has the same effect as a call to +XkbSelectEvents. -The structure for the -XkbBellNotify - event type contains: - +The structure for the +XkbBellNotify +event type contains: - + typedef struct _XkbBellNotify { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbBellNotify */ - unsigned int device; /* Xkb device ID, will not be XkbUseCoreKbd */ - int percent; /* requested volume as % of max */ - int pitch; /* requested pitch in Hz */ - int duration; /* requested duration in microseconds */ - unsigned int bell_class; /* X input extension feedback class */ - unsigned int bell_id; /* X input extension feedback ID */ - Atom name; /* "name" of requested bell */ - Window window; /* window associated with event */ - Bool event_only; /* False -> the server did not produce a beep */ -} XkbBellNotifyEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbBellNotify */ + unsigned int device; /* Xkb device ID, will not be XkbUseCoreKbd */ + int percent; /* requested volume as % of max */ + int pitch; /* requested pitch in Hz */ + int duration; /* requested duration in microseconds */ + unsigned int bell_class; /* X input extension feedback class */ + unsigned int bell_id; /* X input extension feedback ID */ + Atom name; /* "name" of requested bell */ + Window window; /* window associated with event */ + Bool event_only; /* False → the server did not produce a beep */ +} XkbBellNotifyEvent; If your application needs to generate visual bell feedback on the screen when -it receives a bell event, use the window ID in the -XkbBellNotifyEvent -, if present. +it receives a bell event, use the window ID in the +XkbBellNotifyEvent, +if present. diff --git a/libX11/specs/XKB/ch10.xml b/libX11/specs/XKB/ch10.xml index b7f306938..72727f224 100644 --- a/libX11/specs/XKB/ch10.xml +++ b/libX11/specs/XKB/ch10.xml @@ -1,11 +1,21 @@ + + Keyboard Controls + +controls + +server controls + +controlsserver + The Xkb extension is composed of two parts: a server extension, and a client-side X library extension. This chapter discusses functions used to modify controls effecting the behavior of the server portion of the Xkb -extension. Chapter 11 discusses functions used to modify controls that affect +extension. discusses functions used to modify controls that affect only the behavior of the client portion of the extension; those controls are known as Library Controls. @@ -14,15 +24,23 @@ known as Library Controls. Xkb contains control features that affect the entire keyboard, known as global keyboard controls. Some of the controls may be selectively enabled and -disabled; these controls are known as the -Boolean Controls -. Boolean Controls can be turned on or off under program control and can also +disabled; these controls are known as the +Boolean Controls. + +boolean controls + +controlsboolean +Boolean Controls can be turned on or off under program control and can also be automatically set to an on or off condition when a client program exits. The -remaining controls, known as the -Non-Boolean Controls -, are always active. The - XkbControlsRec - structure describes the current state of most of the global controls and the +remaining controls, known as the +Non-Boolean Controls, + +non-boolean controls + +controlsnon-boolean +are always active. The +XkbControlsRec +structure describes the current state of most of the global controls and the attributes effecting the behavior of each of these Xkb features. This chapter describes the Xkb controls and how to manipulate them. @@ -32,31 +50,32 @@ describes the Xkb controls and how to manipulate them. There are two possible components for each of the Boolean Controls: attributes describing how the control should work, and a state describing whether the behavior as a whole is enabled or disabled. The attributes and state for most -of these controls are held in the -XkbControlsRec - structure (see section 10.8). +of these controls are held in the +XkbControlsRec +structure (see section 10.8). You can manipulate the Xkb controls individually, via convenience functions, or -as a whole. To treat them as a group, modify an -XkbControlsRec - structure to describe all of the changes to be made, and then pass that -structure and appropriate flags to an Xkb library function, or use a -XkbControlsChangesRec - (see section 10.10.1) to reduce network traffic. When using a convenience -function to manipulate one control individually, you do not use an -XkbControlsRec - structure directly. +as a whole. To treat them as a group, modify an +XkbControlsRec +structure to describe all of the changes to be made, and then pass that +structure and appropriate flags to an Xkb library function, or use a +XkbControlsChangesRec +(see section 10.10.1) to reduce network traffic. When using a convenience +function to manipulate one control individually, you do not use an +XkbControlsRec +structure directly. -The Xkb controls are grouped as shown in Table 10.1. +The Xkb controls are grouped as shown in +Table 10.1. -
+
Xkb Keyboard Controls @@ -192,9 +211,9 @@ The Xkb controls are grouped as shown in Table 10.1. The individual categories and controls are described first, together with -functions for manipulating them. A description of the -XkbControlsRec - structure and the general functions for dealing with all of the controls at +functions for manipulating them. A description of the +XkbControlsRec +structure and the general functions for dealing with all of the controls at once follow at the end of the chapter. @@ -203,12 +222,10 @@ once follow at the end of the chapter. Enable and disable the boolean controls under program control by using the - -EnabledControls - control; enable and disable them upon program exit by configuring the - -AutoReset - control. +EnabledControls +control; enable and disable them upon program exit by configuring the +AutoReset +control. @@ -216,124 +233,130 @@ AutoReset The EnabledControls Control -The -EnabledControls - control is a bit mask where each bit that is turned on means the corresponding +The +EnabledControls +control is a bit mask where each bit that is turned on means the corresponding control is enabled, and when turned off, disabled. It corresponds to the - -enabled_ctrls - field of an -XkbControlsRec - structure (see section 10.8). The bits describing which controls are turned on -or off are defined in Table 10.7. - - - - -Use -XkbChangeEnabledControls - to manipulate the -EnabledControls - control. - - - - - - - - - -Bool -XkbChangeEnabledControls -( -dpy -, -device_spec -, -mask -, - values -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* keyboard device to modify */ - - - - -unsigned int -mask -; /* 1 bit -> controls to enable / disable */ - - - - -unsigned int -values -; /* 1 bit => enable, 0 bit => disable */ - - - - - - - -The -mask - parameter specifies the boolean controls to be enabled or disabled, and the - -values - mask specifies the new state for those controls. Valid values for both of +enabled_ctrls +field of an +XkbControlsRec +structure (see section 10.8). The bits describing which controls are turned on +or off are defined in Table 10.7. + + + + +Use +XkbChangeEnabledControls +to manipulate the +EnabledControls +control. + + +XkbChangeEnabledControls + + + Bool XkbChangeEnabledControls + + + Display *dpy + unsigned int device_spec + unsigned int mask + unsigned int values + + + + + + dpy + + + + connection to X server + + + + + + device_spec + + + + keyboard device to modify + + + + + + mask + + + + 1 bit → controls to enable / disable + + + + + + values + + + + 1 bit ⇒ enable, 0 bit ⇒ disable + + + + + + +The +mask +parameter specifies the boolean controls to be enabled or disabled, and the +values +mask specifies the new state for those controls. Valid values for both of these masks are composed of a bitwise inclusive OR of bits taken from the set -of mask bits in Table 10.7, using only those masks with "ok" in the -enabled_ctrls - column. +of mask bits in Table 10.7, +using only those masks with ok in the +enabled_ctrls +column. If the X server does not support a compatible version of Xkb or the Xkb -extension has not been properly initialized, -XkbChangeEnabledControls - returns -False -; otherwise, it sends the request to the X server and returns -True -. +extension has not been properly initialized, +XkbChangeEnabledControls +returns +False; +otherwise, it sends the request to the X server and returns +True. -Note that the -EnabledControls - control only enables and disables controls; it does not configure them. Some -controls, such as the -AudibleBell - control, have no configuration attributes and are therefore manipulated solely +Note that the +EnabledControls +control only enables and disables controls; it does not configure them. Some +controls, such as the +AudibleBell +control, have no configuration attributes and are therefore manipulated solely by enabling and disabling them. Others, however, have additional attributes to -configure their behavior. For example, the -RepeatControl - control uses -repeat_delay - and -repeat_interval - fields to describe the timing behavior of keys that repeat. The -RepeatControl - behavior is turned on or off depending on the value of the -XkbRepeatKeysMask - bit, but you must use other means, as described in this chapter, to configure +configure their behavior. For example, the +RepeatControl +control uses +repeat_delay +and +repeat_interval +fields to describe the timing behavior of keys that repeat. The +RepeatControl +behavior is turned on or off depending on the value of the +XkbRepeatKeysMask +bit, but you must use other means, as described in this chapter, to configure its behavior in detail. @@ -347,255 +370,242 @@ You can configure the boolean controls to automatically be enabled or disabled when a program exits. This capability is controlled via two masks maintained in the X server on a per-client basis. There is no client-side Xkb data structure corresponding to these masks. Whenever the client exits for any reason, any -boolean controls specified in the -auto-reset mask - are set to the corresponding value from the -auto-reset values - mask. This makes it possible for clients to "clean up after themselves" +boolean controls specified in the +auto-reset mask + +auto-reset mask + +maskauto-reset +are set to the corresponding value from the +auto-reset values +mask. This makes it possible for clients to "clean up after themselves" automatically, even if abnormally terminated. The bits used in the masks -correspond to the -EnabledControls - control bits. +correspond to the +EnabledControls +control bits. For example, a client that replaces the keyboard bell with some other audible -cue might want to turn off the -AudibleBell - control to prevent the server from also generating a sound and avoid -cacophony. If the client were to exit without resetting the -AudibleBell -control, the user would be left without any feedback at all. Setting -AudibleBell - in both the auto-reset mask and auto-reset values guarantees that the audible +cue might want to turn off the +AudibleBell +control to prevent the server from also generating a sound and avoid +cacophony. If the client were to exit without resetting the +AudibleBell +control, the user would be left without any feedback at all. Setting +AudibleBell +in both the auto-reset mask and auto-reset values guarantees that the audible bell will be turned back on when the client exits. -To get the current values of the auto-reset controls, use -XkbGetAutoResetControls -. - - - - - - - - - -Bool -XkbGetAutoResetControls -( -dpy -, -auto_ctrls -, -auto_values -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -unsigned int * -auto_ctrls -; /* specifies which bits in -auto_values - are relevant */ - - - - -unsigned int * -auto_values -; /* 1 bit => corresponding control has auto-reset on */ - - - - - - - - -XkbGetAutoResetControls - backfills -auto_ctrls - and -auto_values - with the -AutoReset - control attributes for this particular client. It returns -True - if successful, and -False - otherwise. - - - - -To change the current values of the -AutoReset - control attributes, use -XkbSetAutoResetControls. - - - - - - - - - - -Bool -XkbSetAutoResetControls -( -dpy -, -changes -, - auto_ctrls -, -auto_values -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -unsigned int -changes -; /* controls for which to change auto-reset values */ - - - - -unsigned int * -auto_ctrls -; /* controls from changes that should auto reset */ - - - - -unsigned int * -auto_values -; /* 1 bit => auto-reset on */ - - - - - - - - -XkbSetAutoResetControls changes the auto-reset status and associated auto-reset -values for the controls selected by - -changes - -. For any control selected by - -changes - -, if the corresponding bit is set in - -auto_ctrls - -, the control is configured to auto-reset when the client exits. If the -corresponding bit in - -auto_values - - is on, the control is turned on when the client exits; if zero, the control is -turned off when the client exits. - For any control selected by -changes -, if the corresponding bit is not set in -auto_ctrls -, the control is configured to not reset when the client exits. For example: - - - - - -To leave the auto-reset controls for - -StickyKeys - - the way they are: - +To get the current values of the auto-reset controls, use +XkbGetAutoResetControls. + + +XkbGetAutoResetControls + + + Bool XkbGetAutoResetControls + + + Display *dpy + unsigned int *auto_ctrls + unsigned int *auto_values + + + + + + dpy + + + + connection to X server + + + + + + auto_ctrls + + + + specifies which bits in auto_values are relevant + + + + + + auto_values + + + + 1 bit ⇒ corresponding control has auto-reset on + + + + + + +XkbGetAutoResetControls +backfills +auto_ctrls +and +auto_values +with the +AutoReset +control attributes for this particular client. It returns +True +if successful, and +False +otherwise. + + + + +To change the current values of the +AutoReset +control attributes, use +XkbSetAutoResetControls. + + + +XkbSetAutoResetControls + + + Bool XkbSetAutoResetControls + + + Display *dpy + unsigned int changes + unsigned int *auto_ctrls + unsigned int *auto_values + + + + + + dpy + + + + connection to X server + + + + + + changes + + + + controls for which to change auto-reset values + + + + + + auto_ctrls + + + + controls from changes that should auto reset + + + + + + auto_values + + + + 1 bit ⇒ auto-reset on + + + + + + +XkbSetAutoResetControls +changes the auto-reset status and associated auto-reset +values for the controls selected by +changes. +For any control selected by +changes, +if the corresponding bit is set in +auto_ctrls, +the control is configured to auto-reset when the client exits. If the +corresponding bit in +auto_values +is on, the control is turned on when the client exits; +if zero, the control is turned off when the client exits. +For any control selected by +changes, +if the corresponding bit is not set in +auto_ctrls, +the control is configured to not reset when the client exits. For example: + + + + +To leave the auto-reset controls for +StickyKeys +the way they are: - -ok = XkbSetAutoResetControls(dpy, 0, 0, 0); + + ok = XkbSetAutoResetControls(dpy, 0, 0, 0); - -To change the auto-reset controls so that - -StickyKeys - - are unaffected when the client exits: - +To change the auto-reset controls so that +StickyKeys +are unaffected when the client exits: - -ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, 0, 0); + + ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, 0, 0); - -To change the auto-reset controls so that - -StickyKeys - - are turned off when the client exits: - +To change the auto-reset controls so that +StickyKeys +are turned off when the client exits: - -ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask, 0); + + ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask, 0); - -To change the auto-reset controls so that - -StickyKeys - - are turned on when the client exits: - +To change the auto-reset controls so that +StickyKeys +are turned on when the client exits: - -ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask, -XkbStickyKeysMask); + + ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask, + XkbStickyKeysMask); - -XkbSetAutoResetControls - backfills -auto_ctrls - and -auto_values - with the auto-reset controls for this particular client. Note that all of the +XkbSetAutoResetControls +backfills +auto_ctrls +and +auto_values +with the auto-reset controls for this particular client. Note that all of the bits are valid in the returned values, not just the ones selected in the - -changes - mask. +changes +mask. @@ -605,9 +615,9 @@ changes Control for Bell Behavior -The X server’s generation of sounds is controlled by the -AudibleBell - control. Configuration of different bell sounds is discussed in Chapter 9. +The X server’s generation of sounds is controlled by the +AudibleBell +control. Configuration of different bell sounds is discussed in . @@ -615,17 +625,17 @@ AudibleBell The AudibleBell Control -The -AudibleBell - control is a boolean control that has no attributes. As such, you may enable -and disable it using either the -EnabledControls - control or the -AutoReset - control discussed in section 10.1.1. When enabled, protocol requests to +The +AudibleBell +control is a boolean control that has no attributes. As such, you may enable +and disable it using either the +EnabledControls +control or the +AutoReset +control discussed in section 10.1.1. When enabled, protocol requests to generate a sound result in the X server actually producing a real sound; when disabled, requests to the server to generate a sound are ignored unless the -sound is forced. See section 9.2. +sound is forced. See section 9.2. @@ -634,22 +644,23 @@ sound is forced. See section 9.2. Controls for Repeat Key Behavior + +auto-repeatcontrols + The repeating behavior of keyboard keys is governed by three controls, the - -PerKeyRepeat - control, which is always active, and the -RepeatKeys - and -DetectableAutorepeat - controls, which are boolean controls that may be enabled and disabled. - -PerKeyRepeat - determines which keys are allowed to repeat. -RepeatKeys - governs the behavior of an individual key when it is repeating. -DetectableAutorepeat - allows a client to detect when a key is repeating as a result of being held +PerKeyRepeat +control, which is always active, and the +RepeatKeys +and +DetectableAutorepeat +controls, which are boolean controls that may be enabled and disabled. +PerKeyRepeat +determines which keys are allowed to repeat. +RepeatKeys +governs the behavior of an individual key when it is repeating. +DetectableAutorepeat +allows a client to detect when a key is repeating as a result of being held down. @@ -658,20 +669,20 @@ down. The PerKeyRepeat Control -The -PerKeyRepeat - control is a bitmask long enough to contain a bit for each key on the device; -it determines which individual keys are allowed to repeat. The Xkb -PerKeyRepeat - control provides no functionality different from that available via the core X +The +PerKeyRepeat +control is a bitmask long enough to contain a bit for each key on the device; +it determines which individual keys are allowed to repeat. The Xkb +PerKeyRepeat +control provides no functionality different from that available via the core X protocol. There are no convenience functions in Xkb for manipulating this -control. The -PerKeyRepeat - control settings are carried in the -per_key_repeat - field of an -XkbControlsRec - structure, discussed in section 10.8. +control. The +PerKeyRepeat +control settings are carried in the +per_key_repeat +field of an +XkbControlsRec +structure, discussed in section 10.8. @@ -681,192 +692,200 @@ XkbControlsRec The core protocol allows only control over whether or not the entire keyboard -or individual keys should auto-repeat when held down. -RepeatKeys - is a boolean control that extends this capability by adding control over the -delay until a key begins to repeat and the rate at which it repeats. -RepeatKeys - is coupled with the core auto-repeat control: when -RepeatKeys - is enabled or disabled, the core auto-repeat is enabled or disabled and vice +or individual keys should auto-repeat when held down. +RepeatKeys +is a boolean control that extends this capability by adding control over the +delay until a key begins to repeat and the rate at which it repeats. +RepeatKeys +is coupled with the core auto-repeat control: when +RepeatKeys +is enabled or disabled, the core auto-repeat is enabled or disabled and vice versa. -Auto-repeating keys are controlled by two attributes. The first, -timeout -, is the delay after the initial press of an auto-repeating key and the first -generated repeat event. The second, -interval -, is the delay between all subsequent generated repeat events. As with all +Auto-repeating keys are controlled by two attributes. The first, +timeout, +is the delay after the initial press of an auto-repeating key and the first +generated repeat event. The second, +interval, +is the delay between all subsequent generated repeat events. As with all boolean controls, configuring the attributes that determine how the control -operates does not automatically enable the control as a whole; see section 10.1. - - - - -To get the current attributes of the -RepeatKeys - control for a keyboard device, use -XkbGetAutoRepeatRate -. - - - - - - - - - -Bool -XkbGetAutoRepeatRate -( -display, device_spec, timeout_rtrn, interval_rtrn -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int - device_spec -; /* desired device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int -* timeout_rtrn -; /* backfilled with initial repeat delay, ms */ - - - - -unsigned int -* interval_rtrn -; /* backfilled with subsequent repeat delay, ms */ - - - - - - - - -XkbGetAutoRepeatRate - queries the server for the current values of the -RepeatControls - control attributes, backfills -timeout_rtrn - and -interval_rtrn - with them, and returns -True -. If a compatible version of the Xkb extension is not available in the server - -XkbGetAutoRepeatRate - returns -False -. +operates does not automatically enable the control as a whole; see section 10.1. + + + + +To get the current attributes of the +RepeatKeys +control for a keyboard device, use +XkbGetAutoRepeatRate. + + +XkbGetAutoRepeatRate + + + Bool XkbGetAutoRepeatRate + + + Display *display + unsigned int device_spec + unsigned int *timeout_rtrn + unsigned int *interval_rtrn + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + desired device ID, or XkbUseCoreKbd + + + + + + timeout_rtrn + + + + backfilled with initial repeat delay, ms + + + + + + interval_rtrn + + + + backfilled with subsequent repeat delay, ms + + + + + + +XkbGetAutoRepeatRate +queries the server for the current values of the +RepeatControls +control attributes, backfills +timeout_rtrn +and +interval_rtrn +with them, and returns +True. +If a compatible version of the Xkb extension is not available in the server +XkbGetAutoRepeatRate +returns +False. To set the attributes of the RepeatKeys control for a keyboard device, use - -XkbSetAutoRepeatRate -. - - - - - - - - - - -Bool -XkbSetAutoRepeatRate -( -display, device_spec, timeout, interval -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device to configure, or -XkbUseCoreKbd - */ - - - - -unsigned int - timeout -; /* initial delay, ms */ - - - - -unsigned int - interval -; /* delay between repeats, ms */ - - - - - - - - -XkbSetAutoRepeatRate - sends a request to the X server to configure the -AutoRepeat - control attributes to the values specified in -timeout - and -interval -. - - - - - -XkbSetAutoRepeatRate - does not wait for a reply; it normally returns -True -. Specifying a zero value for either -timeout - or -interval - causes the server to generate a -BadValue - protocol error. If a compatible version of the Xkb extension is not available -in the server, -XkbSetAutoRepeatRate - returns -False -. +XkbSetAutoRepeatRate. + + + +XkbSetAutoRepeatRate + + + Bool XkbSetAutoRepeatRate + + + Display *display + unsigned int device_spec + unsigned int timeout + unsigned int interval + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device to configure, or XkbUseCoreKbd + + + + + + timeout + + + + initial delay, ms + + + + + + interval + + + + delay between repeats, ms + + + + + + +XkbSetAutoRepeatRate +sends a request to the X server to configure the +AutoRepeat +control attributes to the values specified in +timeout +and +interval. + + + + +XkbSetAutoRepeatRate +does not wait for a reply; it normally returns +True. +Specifying a zero value for either +timeout +or +interval +causes the server to generate a +BadValue +protocol error. If a compatible version of the Xkb extension is not available +in the server, +XkbSetAutoRepeatRate +returns +False. @@ -877,242 +896,242 @@ False Auto-repeat is the generation of multiple key events by a keyboard when the user presses a key and holds it down. Keyboard hardware and device-dependent X -server software often implement auto-repeat by generating multiple -KeyPress - events with no intervening -KeyRelease - event. The standard behavior of the X server is to generate a -KeyRelease - event for every -KeyPress - event. If the keyboard hardware and device-dependent software of the X server -implement auto-repeat by generating multiple -KeyPress - events, the device-independent part of the X server by default synthetically -generates a -KeyRelease - event after each -KeyPress - event. This provides predictable behavior for X clients, but does not allow +server software often implement auto-repeat by generating multiple +KeyPress +events with no intervening +KeyRelease +event. The standard behavior of the X server is to generate a +KeyRelease +event for every +KeyPress +event. If the keyboard hardware and device-dependent software of the X server +implement auto-repeat by generating multiple +KeyPress +events, the device-independent part of the X server by default synthetically +generates a +KeyRelease +event after each +KeyPress +event. This provides predictable behavior for X clients, but does not allow those clients to detect the fact that a key is auto-repeating. -Xkb allows clients to request -detectable auto-repeat -. If a client requests and the server supports -DetectableAutorepeat -, Xkb generates -KeyRelease - events only when the key is physically released. If -DetectableAutorepeat - is not supported or has not been requested, the server synthesizes a -KeyRelease - event for each repeating -KeyPress - event it generates. +Xkb allows clients to request +detectable auto-repeat. + +detectable auto-repeat + +auto-repeatdetectable +If a client requests and the server supports +DetectableAutorepeat, +Xkb generates +KeyRelease +events only when the key is physically released. If +DetectableAutorepeat +is not supported or has not been requested, the server synthesizes a +KeyRelease +event for each repeating +KeyPress +event it generates. - -DetectableAutorepeat -, unlike the other controls in this chapter, is not contained in the -XkbControlsRec - structure, nor can it be enabled or disabled via the -EnabledControls - control. Instead, query and set -DetectableAutorepeat - using -XkbGetDetectableAutorepeat - and -XkbSetDetectableAutorepeat -. +DetectableAutorepeat, +unlike the other controls in this chapter, is not contained in the +XkbControlsRec +structure, nor can it be enabled or disabled via the +EnabledControls +control. Instead, query and set +DetectableAutorepeat +using +XkbGetDetectableAutorepeat +and +XkbSetDetectableAutorepeat. - -DetectableAutorepeat - is a condition that applies to all keyboard devices for a client’s +DetectableAutorepeat +is a condition that applies to all keyboard devices for a client’s connection to a given X server; it cannot be selectively set for some devices and not for others. For this reason, none of the Xkb library functions -involving -DetectableAutorepeat - involve a device specifier. - - - - -To determine whether or not the server supports -DetectableAutorepeat -, use -XkbGetDetectableAutorepeat -. - - - - - - - - - -Bool -XkbGetDetectableAutorepeat -( -display, supported_rtrn -) - - - - -Display * - display -; /* connection to X server */ - - - - -Bool * - supported_rtrn -; /* backfilled -True - if -DetectableAutorepeat - supported */ - - - - - - - - -XkbGetDetectableAutorepeat - queries the server for the current state of -DetectableAutorepeat - and waits for a reply. If -supported_rtrn - is not -NULL -, it backfills supported_rtrn with -True - if the server supports -DetectableAutorepeat -, and -False - otherwise. -XkbGetDetectableAutorepeat - returns the current state of -DetectableAutorepeat - for the requesting client: -True - if -DetectableAutorepeat - is set, and -False - otherwise. - - - - -To set -DetectableAutorepeat -, use -XkbSetDetectableAutorepeat -. This request affects all keyboard activity for the requesting client only; +involving +DetectableAutorepeat +involve a device specifier. + + + + +To determine whether or not the server supports +DetectableAutorepeat, +use +XkbGetDetectableAutorepeat. + + +XkbGetDetectableAutorepeat + + + Bool XkbGetDetectableAutorepeat + + + Display *display + Bool *supported_rtrn + + + + + + display + + + + connection to X server + + + + + + supported_rtrn + + + + backfilled True if +DetectableAutorepeat + supported + + + + + + +XkbGetDetectableAutorepeat +queries the server for the current state of +DetectableAutorepeat +and waits for a reply. If +supported_rtrn +is not +NULL, +it backfills supported_rtrn with +True +if the server supports +DetectableAutorepeat, +and +False +otherwise. +XkbGetDetectableAutorepeat +returns the current state of +DetectableAutorepeat +for the requesting client: +True +if +DetectableAutorepeat +is set, and +False +otherwise. + + + + +To set +DetectableAutorepeat, +use +XkbSetDetectableAutorepeat. +This request affects all keyboard activity for the requesting client only; other clients still see the expected nondetectable auto-repeat behavior, unless they have requested otherwise. - - - - - - - -Bool -XkbSetDetectableAutorepeat -( -display, detectable, supported_rtrn -) - - - - -Display * - display -; /* connection to X server */ - - - - -Bool - detectable -; /* -True - => set -DetectableAutorepeat - */ - - - - -Bool * - supported_rtrn -; /* backfilled -True - if -DetectableAutorepeat - supported */ - - - - - - - - -XkbSetDetectableAutorepeat - sends a request to the server to set -DetectableAutorepeat - on for the current client if -detectable - is -True -, and off it -detectable - is -False -; it then waits for a reply. If -supported_rtrn - is not -NULL -, -XkbSetDetectableAutorepeat - backfills -supported_rtrn - with -True - if the server supports -DetectableAutorepeat -, and -False - if it does not. -XkbSetDetectableAutorepeat - returns the current state of -DetectableAutorepeat - for the requesting client: -True - if -DetectableAutorepeat - is set, and -False - otherwise. +XkbSetDetectableAutorepeat + + + Bool XkbSetDetectableAutorepeat + + + Display *display + Bool detectable + Bool *supported_rtrn + + + + + + display + + + + connection to X server + + + + + + detectable + + + + True ⇒ set +DetectableAutorepeat + + + + + + supported_rtrn + + + + backfilled True if +DetectableAutorepeat + supported + + + + + + +XkbSetDetectableAutorepeat +sends a request to the server to set +DetectableAutorepeat +on for the current client if +detectable +is +True, +and off it +detectable +is +False; +it then waits for a reply. If +supported_rtrn +is not +NULL, +XkbSetDetectableAutorepeat +backfills +supported_rtrn +with +True +if the server supports +DetectableAutorepeat, +and +False +if it does not. +XkbSetDetectableAutorepeat +returns the current state of +DetectableAutorepeat +for the requesting client: +True +if +DetectableAutorepeat +is set, and +False +otherwise. @@ -1132,37 +1151,37 @@ keyboards. -Xkb includes direct support for two keyboard overlays, using the -Overlay1 - and -Overlay2 - controls. When -Overlay1 - is enabled, all of the keys that are members of the first keyboard overlay -generate an alternate keycode. When -Overlay2 - is enabled, all of the keys that are members of the second keyboard overlay +Xkb includes direct support for two keyboard overlays, using the +Overlay1 +and +Overlay2 +controls. When +Overlay1 +is enabled, all of the keys that are members of the first keyboard overlay +generate an alternate keycode. When +Overlay2 +is enabled, all of the keys that are members of the second keyboard overlay generate an alternate keycode. The two overlays are mutually exclusive; any -particular key may be in at most one overlay. -Overlay1 - and -Overlay2 - are boolean controls. As such, you may enable and disable them using either -the -EnabledControls - control or the -AutoReset - control discussed in section 10.1.1. +particular key may be in at most one overlay. +Overlay1 +and +Overlay2 +are boolean controls. As such, you may enable and disable them using either +the +EnabledControls +control or the +AutoReset +control discussed in section 10.1.1. To specify the overlay to which a key belongs and the alternate keycode it -should generate when that overlay is enabled, assign it either the -XkbKB_Overlay1 - or -XkbKB_Overlay2 - key behaviors, as described in section 16.2. +should generate when that overlay is enabled, assign it either the +XkbKB_Overlay1 +or +XkbKB_Overlay2 +key behaviors, as described in section 16.2. @@ -1174,20 +1193,20 @@ XkbKB_Overlay2 Using Xkb, it is possible to configure the keyboard to allow simulation of the X pointer device. This simulation includes both movement of the pointer itself and press and release events associated with the buttons on the pointer. Two -controls affect this behavior: the -MouseKeys - control determines whether or not simulation of the pointer device is active, -as well as configuring the default button; the -MouseKeysAccel - control determines the movement characteristics of the pointer when simulated +controls affect this behavior: the +MouseKeys +control determines whether or not simulation of the pointer device is active, +as well as configuring the default button; the +MouseKeysAccel +control determines the movement characteristics of the pointer when simulated via the keyboard. Both of them are boolean controls; as such, you may enable -and disable them using either the -EnabledControls - control or the -AutoReset - control discussed in section 10.1.1. The individual keys that simulate +and disable them using either the +EnabledControls +control or the +AutoReset +control discussed in section 10.1.1. The individual keys that simulate different aspects of the pointer device are determined by the keyboard mapping, -discussed in Chapter 16. +discussed in . @@ -1195,64 +1214,63 @@ discussed in Chapter 16. The MouseKeys Control -The -MouseKeys - control allows a user to control all the mouse functions from the keyboard. -When -MouseKeys - are enabled, all keys with -MouseKeys - actions bound to them generate core pointer events instead of normal -KeyPress - and -KeyRelease - events. +The +MouseKeys +control allows a user to control all the mouse functions from the keyboard. +When +MouseKeys +are enabled, all keys with +MouseKeys +actions bound to them generate core pointer events instead of normal +KeyPress +and +KeyRelease +events. -The -MouseKeys - control has a single attribute, -mk_dflt_btn - that specifies the core button number to be used by mouse keys actions that do +The +MouseKeys +control has a single attribute, +mk_dflt_btn +that specifies the core button number to be used by mouse keys actions that do not explicitly specify a button. There is no convenience function for getting -or setting the attribute; instead use -XkbGetControls - and -XkbSetControls - (see sections 10.9 and 10.10). - - - -MouseKeys - can also be turned on and off by pressing the key combination necessary to -produce an -XK_Pointer_EnableKeys - keysym. The de facto default standard for this is -Shift+Alt+NumLock -, but this may vary depending on the keymap. +or setting the attribute; instead use +XkbGetControls +and +XkbSetControls +(see section 10.9 and section 10.10). + + + +MouseKeys +can also be turned on and off by pressing the key combination necessary to +produce an +XK_Pointer_EnableKeys +keysym. The de facto default standard for this is +ShiftAltNumLock, +but this may vary depending on the keymap. The MouseKeysAccel Control -When the -MouseKeysAccel - control is enabled, the effect of a key-activated pointer motion action +When the +MouseKeysAccel +control is enabled, the effect of a key-activated pointer motion action changes as a key is held down. If the control is disabled, pressing a -mouse-pointer key yields one mouse event. When -MouseKeysAccel - is enabled, mouse movement is defined by an initial distance specified in the - -XkbSA_MovePtr - action and the following fields in the -XkbControlsRec - structure (see section 10.8). +mouse-pointer key yields one mouse event. When +MouseKeysAccel +is enabled, mouse movement is defined by an initial distance specified in the +XkbSA_MovePtr +action and the following fields in the +XkbControlsRec +structure (see section 10.8). -
+
MouseKeysAccel Fields @@ -1293,35 +1311,34 @@ speed There are no convenience functions to query or change the attributes of the - -MouseKeysAccel - control; instead use -XkbGetControls - and -XkbSetControls - (see sections 10.9 and 10.10). +MouseKeysAccel +control; instead use +XkbGetControls +and +XkbSetControls +(see section 10.9 and section 10.10). -The effects of the attributes of the -MouseKeysAccel - control depend on whether the -XkbSA_MovePtr - action (see section 16.1) specifies relative or absolute pointer motion. +The effects of the attributes of the +MouseKeysAccel +control depend on whether the +XkbSA_MovePtr +action (see section 16.1) specifies relative or absolute pointer motion. Absolute Pointer Motion -If an -XkbSA_MovePtr - action specifies an absolute position for one of the coordinates but still +If an +XkbSA_MovePtr +action specifies an absolute position for one of the coordinates but still allows acceleration, all repeated events contain any absolute coordinates -specified in the action. For example, if the -XkbSA_MovePtr - action specifies an absolute position for the X direction, but a relative +specified in the action. For example, if the +XkbSA_MovePtr +action specifies an absolute position for the X direction, but a relative motion for the Y direction, the pointer accelerates in the Y direction, but stays at the same X position. @@ -1332,43 +1349,41 @@ stays at the same X position. Relative Pointer Motion -If the -XkbSA_MovePtr - action specifies relative motion, the initial event always moves the cursor -the distance specified in the action. After -mk_delay - milliseconds, a second motion event is generated, and another occurs every - -mk_interval - milliseconds until the user releases the key. +If the +XkbSA_MovePtr +action specifies relative motion, the initial event always moves the cursor +the distance specified in the action. After +mk_delay +milliseconds, a second motion event is generated, and another occurs every +mk_interval +milliseconds until the user releases the key. -Between the time of the second motion event and -mk_time_to_max - intervals, the change in pointer distance per interval increases with each -interval. After -mk_time_to_max - intervals have elapsed, the change in pointer distance per interval remains +Between the time of the second motion event and +mk_time_to_max +intervals, the change in pointer distance per interval increases with each +interval. After +mk_time_to_max +intervals have elapsed, the change in pointer distance per interval remains the same and is calculated by multiplying the original distance specified in -the action by -mk_max_speed -. +the action by +mk_max_speed. -For example, if the -XkbSA_MovePtr - action specifies a relative motion in the X direction of 5, -mk_delay -=160, -mk_interval -=40, -mk_time_to_max -=30, and -mk_max_speed +For example, if the +XkbSA_MovePtr +action specifies a relative motion in the X direction of 5, +mk_delay +=160, +mk_interval +=40, +mk_time_to_max +=30, and +mk_max_speed =30, the following happens when the user presses the key: @@ -1381,100 +1396,101 @@ pressed. -After 160 milliseconds ( -mk_delay -), and every 40 milliseconds thereafter ( -mk_interval -), the pointer moves in the X direction. +After 160 milliseconds +(mk_delay), +and every 40 milliseconds thereafter +(mk_interval), +the pointer moves in the X direction. The distance in the X direction increases with each interval until 30 intervals -( -mk_time_to_max -) have elapsed. +( +mk_time_to_max) +have elapsed. After 30 intervals, the pointer stops accelerating, and moves 150 pixels -( -mk_max_speed - * the original distance) every interval thereafter, until the key is released. +( +mk_max_speed +* the original distance) every interval thereafter, until the key is released. -The increase in pointer difference for each interval is a function of - mk_curve. - Events after the first but before maximum acceleration has been achieved are +The increase in pointer difference for each interval is a function of +mk_curve. +Events after the first but before maximum acceleration has been achieved are accelerated according to the formula: - - - + + + -Where -action_delta - is the relative motion specified by the -XkbSA_MovePtr - action, -mk_max_speed -and -mk_time_to_max - are parameters to the -MouseKeysAccel - control, and the curveFactor is computed using the -MouseKeysAccel - -mk_curve - parameter as follows: +Where +action_delta +is the relative motion specified by the +XkbSA_MovePtr +action, +mk_max_speed +and +mk_time_to_max +are parameters to the +MouseKeysAccel +control, and the curveFactor is computed using the +MouseKeysAccel +mk_curve +parameter as follows: - - - - - - -With the result that a -mk_curve - of zero causes the distance moved to increase linearly from -action_delta - to - - - - -. A negative -mk_curve - causes an initial sharp increase in acceleration that tapers off, and a + + + + + + +With the result that a +mk_curve +of zero causes the distance moved to increase linearly from +action_delta +to + + +. +A negative +mk_curve +causes an initial sharp increase in acceleration that tapers off, and a positive curve yields a slower initial increase in acceleration followed by a sharp increase as the number of pointer events generated by the action -approaches -mk_time_to_max -. The legal values for -mk_curve - are between -1000 and 1000. +approaches +mk_time_to_max. +The legal values for +mk_curve +are between −1000 and 1000. -A distance vs. time graph of the pointer motion is shown in Figure 10.1. +A distance vs. time graph of the pointer motion is shown in +Figure 10.1. - - - - - +
+ MouseKeys Acceleration + + + + +
-let alone use it, if -SlowKeys - is not enabled. To allow easier access to some of the controls, the -AccessXKeys - control provides a set of special key sequences similar to those available in +who needs +SlowKeys +(see section 10.6.6) may not even be able to start the graphical application, +let alone use it, if +SlowKeys +is not enabled. To allow easier access to some of the controls, the +AccessXKeys +control provides a set of special key sequences similar to those available in AccessDOS. -When the -AccessXKeys - control is enabled, the user can turn controls on or off from the keyboard by +When the +AccessXKeys +control is enabled, the user can turn controls on or off from the keyboard by entering the following standard key sequences: -Holding down a shift key by itself for eight seconds toggles the -SlowKeys - control. +Holding down a Shift key by itself for eight seconds +toggles the +SlowKeys +control. -Pressing and releasing the left or right -Shift - key five times in a row, without any intervening key events and with less than +Pressing and releasing the left or right +Shift +key five times in a row, without any intervening key events and with less than 30 seconds delay between consecutive presses, toggles the state of the - -StickyKeys - control. +StickyKeys +control. -Simultaneously operating two or more modifier keys deactivates the -StickyKeys - control. +Simultaneously operating two or more modifier keys deactivates the +StickyKeys +control. -When the -AccessXKeys - control is disabled, Xkb does not look for the above special key sequences. +When the +AccessXKeys +control is disabled, Xkb does not look for the above special key sequences. Some of these key sequences optionally generate audible feedback of the change -in state, as described in section 10.6.3, or -XkbControlsNotify - events, described in section 10.11. +in state, as described in section 10.6.3, or +XkbControlsNotify +events, described in section 10.11. @@ -1574,288 +1590,300 @@ in state, as described in section 10.6.3, or The AccessXTimeout Control -In environments where computers are shared, features such as -SlowKeys - present a problem: if -SlowKeys - is on, the keyboard can appear to be unresponsive because keys are not +In environments where computers are shared, features such as +SlowKeys +present a problem: if +SlowKeys +is on, the keyboard can appear to be unresponsive because keys are not accepted until they are held for a certain period of time. To help solve this -problem, Xkb provides an -AccessXTimeout - control to automatically change the enabled/disabled state of any boolean -controls and to change the value of the -AccessXKeys - and -AccessXFeedback - control attributes if the keyboard is idle for a specified period of time. - - - - -When a timeout as specified by -AccessXTimeout - occurs and a control is consequently modified, Xkb generates an -XkbControlsNotify - event. For more information on -XkbControlsNotify - events, refer to section 10.11. - - - - -Use -XkbGetAccessXTimeout - to query the current -AccessXTimeout - options for a keyboard device. - - - - - - - - - -Bool -XkbGetAccessXTimeout -( -display -, - device_spec -, - timeout_rtrn -, - ctrls_mask_rtrn -, - ctrls_values_rtrn -, - options_mask_rtrn, options_values_rtrn -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device to query, or -XkbUseCoreKbd - */ - - - - -unsigned short * -timeout_rtrn -; /* delay until AccessXTimeout, seconds */ - - - - -unsigned int * - ctrls_mask_rtrn -; /* backfilled with controls to modify */ - - - - -unsigned int * -ctrls_values_rtrn -; /* backfilled with on/off status for controls */ - - - - -unsigned short * -opts_mask_rtrn -; /* backfilled with -ax_options - to modify */ - - - - -unsigned short * -opts_values_rtrn -; /* backfilled with values for -ax_options - */ - - - - - - - - -XkbGetAccessXTimeout - sends a request to the X server to obtain the current values for the -AccessXTimeout - attributes, waits for a reply, and backfills the values into the appropriate -arguments. - -The parameters -opts_mask_rtrn - and -opts_values_rtrn - are backfilled with the options to modify and the values for -ax_options -, which is a field in the -XkbControlsRec - structure (see section 10.8). - -XkbGetAccessXTimeout -returns - - -True - if successful; if a compatible version of the Xkb extension is not available -in the server, -XkbGetAccessXTimeout - returns -False -. - - - - -To configure the -AccessXTimeout - options for a keyboard device, use -XkbSetAccessXTimeout -. - - - - - - - - - - -Bool -XkbSetAccessXTimeout -( -display -, - device_spec, timeout, ctrls_mask, ctrls_values, opts_mask, -opts_values -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int - device_spec -; /* device to configure, or -XkbUseCoreKbd - */ - - - - -unsigned short -timeout -; /* seconds idle until AccessXTimeout occurs */ - - - - -unsigned int - ctrls_mask -; /* boolean controls to modify */ - - - - -unsigned int - ctrls_values -; /* new bits for controls selected by -ctrls_mask - */ - - - - -unsigned short -opts_mask -; /* -ax_options - to change */ - - - - -unsigned short -opts_values -; /* new bits for -ax_options - selected by -opts_mask - */ - - - - - - - - -timeout - specifies the number of seconds the keyboard must be idle before the controls -are modified. -ctrls_mask - specifies what controls are to be enabled or disabled, and -ctrls_values - specifies whether those controls are to be enabled or disabled. The bit values -correspond to those for enabling and disabling boolean controls (see section -10.1.1). The -opts_mask - field specifies which attributes of the -AccessXKeys - and -AccessXFeedback - controls are to be changed, and -opts_values - specifies the new values for those options. The bit values correspond to those -for the -ax_options - field of an -XkbDescRec - (see section 10.8). - - - - - -XkbSetAccessXTimeout - sends a request to configure the -AccessXTimeout - control to the server. - -It does not wait for a reply, and normally returns -True -. If a compatible version of the Xkb extension is not available in the server, - -XkbSetAccessXTimeout - returns -False -. +problem, Xkb provides an +AccessXTimeout +control to automatically change the enabled/disabled state of any boolean +controls and to change the value of the +AccessXKeys +and +AccessXFeedback +control attributes if the keyboard is idle for a specified period of time. + + + + +When a timeout as specified by +AccessXTimeout +occurs and a control is consequently modified, Xkb generates an +XkbControlsNotify +event. For more information on +XkbControlsNotify +events, refer to section 10.11. + + + + +Use +XkbGetAccessXTimeout +to query the current +AccessXTimeout +options for a keyboard device. + + +XkbGetAccessXTimeout + + + Bool XkbGetAccessXTimeout + + + Display *display + unsigned int device_spec + unsigned short *timeout_rtrn + unsigned int *ctrls_mask_rtrn + unsigned int *ctrls_values_rtrn + unsigned short *opts_mask_rtrn + unsigned short *opts_values_rtrn + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device to query, or XkbUseCoreKbd + + + + + + timeout_rtrn + + + + delay until AccessXTimeout, seconds + + + + + + ctrls_mask_rtrn + + + + backfilled with controls to modify + + + + + + ctrls_values_rtrn + + + + backfilled with on/off status for controls + + + + + + opts_mask_rtrn + + + + backfilled with ax_options to modify + + + + + + opts_values_rtrn + + + + backfilled with values for ax_options + + + + + + +XkbGetAccessXTimeout +sends a request to the X server to obtain the current values for the +AccessXTimeout +attributes, waits for a reply, and backfills the values into the appropriate +arguments. +The parameters +opts_mask_rtrn +and +opts_values_rtrn +are backfilled with the options to modify and the values for +ax_options, +which is a field in the +XkbControlsRec +structure (see section 10.8). +XkbGetAccessXTimeout +returns +True +if successful; if a compatible version of the Xkb extension is not available +in the server, +XkbGetAccessXTimeout +returns +False. + + + + +To configure the +AccessXTimeout +options for a keyboard device, use +XkbSetAccessXTimeout. + + + +XkbSetAccessXTimeout + + + Bool XkbSetAccessXTimeout + + + Display *display + unsigned int device_spec + unsigned short timeout + unsigned int ctrls_mask + unsigned int ctrls_values + unsigned short opts_mask + unsigned short opts_values + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device to configure, or XkbUseCoreKbd + + + + + + timeout + + + + seconds idle until AccessXTimeout occurs + + + + + + ctrls_mask + + + + boolean controls to modify + + + + + + ctrls_values + + + + new bits for controls selected by ctrls_mask + + + + + + opts_mask + + + + ax_options to change + + + + + + opts_values + + + + new bits for ax_options selected by opts_mask + + + + + + +timeout +specifies the number of seconds the keyboard must be idle before the controls +are modified. +ctrls_mask +specifies what controls are to be enabled or disabled, and +ctrls_values +specifies whether those controls are to be enabled or disabled. The bit values +correspond to those for enabling and disabling boolean controls +(see section 10.1.1). The +opts_mask +field specifies which attributes of the +AccessXKeys +and +AccessXFeedback +controls are to be changed, and +opts_values +specifies the new values for those options. The bit values correspond to those +for the +ax_options +field of an +XkbDescRec +(see section 10.8). + + + + +XkbSetAccessXTimeout +sends a request to configure the +AccessXTimeout +control to the server. +It does not wait for a reply, and normally returns +True. +If a compatible version of the Xkb extension is not available in the server, +XkbSetAccessXTimeout +returns +False. @@ -1866,27 +1894,27 @@ False Just as some keyboards can produce keyclicks to indicate when a key is pressed or repeating, Xkb can provide feedback for the controls by using special beep -codes. Use the -AccessXFeedback - control to configure the specific types of operations that generate feedback. +codes. Use the +AccessXFeedback +control to configure the specific types of operations that generate feedback. -There is no convenience function for modifying the -AccessXFeedback - control, although the feedback as a whole can be enabled or disabled just as -other boolean controls are (see section 10.1). Individual beep codes are turned -on or off by modifying the following bits in the -ax_options - field of an -XkbControlsRec - structure and using -XkbSetControls - (see section 10.10): +There is no convenience function for modifying the +AccessXFeedback +control, although the feedback as a whole can be enabled or disabled just as +other boolean controls are (see section 10.1). Individual beep codes are turned +on or off by modifying the following bits in the +ax_options +field of an +XkbControlsRec +structure and using +XkbSetControls +(see section 10.10): -
MouseKeys Acceleration
+
AccessXFeedback Masks @@ -1904,77 +1932,77 @@ XkbSetControls LED turned on High-pitched beep - XkbAX_IndicatorFBMask + XkbAX_IndicatorFBMask LED turned off Low-pitched beep - XkbAX_IndicatorFBMask + XkbAX_IndicatorFBMask More than one LED changed state Two high-pitched beeps - XkbAX_IndicatorFBMask + XkbAX_IndicatorFBMask Control turned on Rising tone - XkbAX_FeatureFBMask + XkbAX_FeatureFBMask Control turned off Falling tone - XkbAX_FeatureFBMask + XkbAX_FeatureFBMask More than one control changed state Two high-pitched beeps - XkbAX_FeatureFBMask + XkbAX_FeatureFBMask SlowKeys and BounceKeys about to be turned on or off Three high-pitched beeps - XkbAX_SlowWarnFBMask + XkbAX_SlowWarnFBMask SlowKeys key pressed Medium-pitched beep - XkbAX_SKPressFBMask + XkbAX_SKPressFBMask SlowKeys key accepted Medium-pitched beep - XkbAX_SKAcceptFBMask + XkbAX_SKAcceptFBMask SlowKeys key rejected Low-pitched beep - XkbAX_SKRejectFBMask + XkbAX_SKRejectFBMask Accepted SlowKeys key released Medium-pitched beep - XkbAX_SKReleaseFBMask + XkbAX_SKReleaseFBMask BounceKeys key rejected Low-pitched beep - XkbAX_BKRejectFBMask + XkbAX_BKRejectFBMask StickyKeys key latched Low-pitched beep followed by high-pitched beep - XkbAX_StickyKeysFBMask + XkbAX_StickyKeysFBMask StickyKeys key locked High-pitched beep - XkbAX_StickyKeysFBMask + XkbAX_StickyKeysFBMask StickyKeys key unlocked Low-pitched beep - XkbAX_StickyKeysFBMask + XkbAX_StickyKeysFBMask @@ -1985,18 +2013,18 @@ Implementations that cannot generate continuous tones may generate multiple beeps instead of falling and rising tones; for example, they can generate a high-pitched beep followed by a low-pitched beep instead of a continuous falling tone. Other implementations can only ring the bell with one fixed -pitch. In these cases, use the -XkbAX_DumbBellFBMask - bit of -ax_options - to indicate that the bell can only ring with a fixed pitch. +pitch. In these cases, use the +XkbAX_DumbBellFBMask +bit of +ax_options +to indicate that the bell can only ring with a fixed pitch. -When any of the above feedbacks occur, Xkb may generate a -XkbBellNotify - event (see section 9.4). +When any of the above feedbacks occur, Xkb may generate a +XkbBellNotify +event (see section 9.4). @@ -2004,39 +2032,42 @@ XkbBellNotify AccessXNotify Events + +eventsXkbAccessXNotify + +XkbAccessXNotifyEvent + -The server can generate -XkbAccessXNotify - events for some of the global keyboard controls. The structure for the - -XkbAccessXNotify - event type is as follows: - +The server can generate +XkbAccessXNotify +events for some of the global keyboard controls. The structure for the +XkbAccessXNotify +event type is as follows: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbAccessXNotify */ - int device; /* Xkb device ID, will not be XkbUseCoreKbd */ - int detail; /* XkbAXN_* */ - KeyCode keycode; /* key of event */ - int slowKeysDelay; /* current SlowKeys delay */ - int debounceDelay; /* current debounce delay */ -} XkbAccessXNotifyEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbAccessXNotify */ + int device; /* Xkb device ID, will not be XkbUseCoreKbd */ + int detail; /* XkbAXN_* */ + KeyCode keycode; /* key of event */ + int slowKeysDelay; /* current SlowKeys delay */ + int debounceDelay; /* current debounce delay */ +} XkbAccessXNotifyEvent; -The -detail - field describes what AccessX event just occurred and can be any of the values -in Table 10.4. +The +detail +field describes what AccessX event just occurred and can be any of the values +in Table 10.4. -
+
AccessXNotify Events @@ -2050,33 +2081,33 @@ in Table 10.4. - XkbAXN_SKPress + XkbAXN_SKPress A key was pressed when SlowKeys was enabled. - XkbAXN_SKAccept + XkbAXN_SKAccept A key was accepted (held longer than the SlowKeys delay). - XkbAXN_SKRelease + XkbAXN_SKRelease An accepted SlowKeys key was released. - XkbAXN_SKReject + XkbAXN_SKReject A key was rejected (released before the SlowKeys delay expired). - XkbAXN_BKAccept + XkbAXN_BKAccept A key was accepted by BounceKeys. - XkbAXN_BKReject + XkbAXN_BKReject A key was rejected (pressed before the BounceKeys delay expired). - XkbAXN_AXKWarning + XkbAXN_AXKWarning AccessXKeys is about to turn on/off StickyKeys or BounceKeys. @@ -2084,59 +2115,58 @@ expired).
-The -keycode - field reports the keycode of the key for which the event occurred. If the -action is related to -SlowKeys -, the -slowKeysDelay - field contains the current -SlowKeys - acceptance delay. If the action is related to -BounceKeys -, the -debounceDelay - field contains the current -BounceKeys - debounce delay. +The +keycode +field reports the keycode of the key for which the event occurred. If the +action is related to +SlowKeys, +the +slowKeysDelay +field contains the current +SlowKeys +acceptance delay. If the action is related to +BounceKeys, +the +debounceDelay +field contains the current +BounceKeys +debounce delay. Selecting for AccessX Events -To receive -XkbAccessXNotify - events under all possible conditions, use -XkbSelectEvents - (see section 4.3) and pass -XkbAccesXNotifyMask - in both -bits_to_change - and -values_for_bits -. +To receive +XkbAccessXNotify +events under all possible conditions, use +XkbSelectEvents +(see section 4.3) and pass +XkbAccessXNotifyMask +in both +bits_to_change +and +values_for_bits. -To receive -XkbStateNotify - events only under certain conditions, use -XkbSelectEventDetails - using -XkbAccessXNotify - as the -event_type - and specifying the desired state changes in -bits_to_change - and -values_for_bits - using mask bits from Table 10.5. +To receive +XkbStateNotify +events only under certain conditions, use +XkbSelectEventDetails +using +XkbAccessXNotify +as the +event_type +and specifying the desired state changes in +bits_to_change +and +values_for_bits +using mask bits from Table 10.5. - +
AccessXNotify Event Details @@ -2152,37 +2182,37 @@ values_for_bits - XkbAXN_SKPressMask + XkbAXN_SKPressMask (1<<0) Slow key press notification wanted - XkbAXN_SKAcceptMask + XkbAXN_SKAcceptMask (1<<1) Slow key accept notification wanted - XkbAXN_SKRejectMask + XkbAXN_SKRejectMask (1<<2) Slow key reject notification wanted - XkbAXN_SKReleaseMask + XkbAXN_SKReleaseMask (1<<3) Slow key release notification wanted - XkbAXN_BKAcceptMask + XkbAXN_BKAcceptMask (1<<4) Bounce key accept notification wanted - XkbAXN_BKRejectMask + XkbAXN_BKRejectMask (1<<5) Bounce key reject notification wanted - XkbAXN_AXKWarningMask + XkbAXN_AXKWarningMask (1<<6) AccessX warning notification wanted @@ -2201,26 +2231,25 @@ values_for_bitsStickyKeys, RepeatKeys, and MouseKeys Events -The -StickyKeys -, -RepeatKeys -, and -MouseKeys - controls do not generate specific events. Instead, the latching, unlatching, -locking, or unlocking of modifiers using -StickyKeys - generates -XkbStateNotify - events as described in section 5.4. Repeating keys generate normal -KeyPress - and -KeyRelease - events, though the auto-repeat can be detected using -DetectableAutorepeat - (see section 10.3.3). Finally, -MouseKeys - generates pointer events identical to those of the core pointer device. +The +StickyKeys, +RepeatKeys, +and +MouseKeys +controls do not generate specific events. Instead, the latching, unlatching, +locking, or unlocking of modifiers using +StickyKeys +generates +XkbStateNotify +events as described in section 5.4. Repeating keys generate normal +KeyPress +and +KeyRelease +events, though the auto-repeat can be detected using +DetectableAutorepeat +(see section 10.3.3). Finally, +MouseKeys +generates pointer events identical to those of the core pointer device. @@ -2231,186 +2260,181 @@ MouseKeys Some users may accidentally bump keys while moving a hand or typing stick toward the key they want. Usually, the keys that are accidentally bumped are -just hit for a very short period of time. The -SlowKeys - control helps filter these accidental bumps by telling the server to wait a -specified period, called the -SlowKeys acceptance delay -, before delivering key events. If the key is released before this period +just hit for a very short period of time. The +SlowKeys +control helps filter these accidental bumps by telling the server to wait a +specified period, called the +SlowKeys acceptance delay, +before delivering key events. If the key is released before this period elapses, no key events are generated. Users can then bump any number of keys on their way to the one they want without accidentally getting those characters. Once they have reached the key they want, they can then hold the desired key -long enough for the computer to accept it. -SlowKeys - is a boolean control with one configurable attribute. +long enough for the computer to accept it. +SlowKeys +is a boolean control with one configurable attribute. -When the -SlowKeys - control is active, the server reports the initial key press, subsequent +When the +SlowKeys +control is active, the server reports the initial key press, subsequent acceptance or rejection, and release of any key to interested clients by -sending an appropriate -AccessXNotify - event (see section 10.6.4). - - - -To get the -SlowKeys - acceptance delay for a keyboard device, use -XkbGetSlowKeysDelay -. - - - - - - - - - -Bool -XkbGetSlowKeysDelay -( -display -, - device_spec -, - delay_rtrn -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int * -delay_rtrn -; /* backfilled with -SlowKeys - delay, ms */ - - - - - - - - -XkbGetSlowKeysDelay -requests the attributes of the -SlowKeys - control from the server, waits for a reply and backfills -delay_rtrn -with the -SlowKeys - delay attribute. -XkbGetSlowKeysDelay -returns -True - if successful; if a compatible version of the Xkb extension is not available -in the server, -XkbGetSlowKeysDelay - returns -False -. - - - - -To set the -SlowKeys - acceptance delay for a keyboard device, use -XkbSetSlowKeysDelay -. - - - - - - - - - - -Bool -XkbSetSlowKeysDelay -( -display -, - device_spec -, - delay -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device to configure, or -XkbUseCoreKbd - */ - - - - -unsigned int -delay -; /* -SlowKeys - delay, ms */ - - - - - - - - -XkbSetSlowKeysDelay - sends a request to configure the -SlowKeys - control to the server. - -It does not wait for a reply, and normally returns -True -. Specifying a value of -0 - for the -delay -parameter causes -XkbSetSlowKeys - to generate a -BadValue - protocol error. If a compatible version of the Xkb extension is not available -in the server -XkbSetSlowKeysDelay - returns -False -. +sending an appropriate +AccessXNotify +event (see section 10.6.4). + + + +To get the +SlowKeys +acceptance delay for a keyboard device, use +XkbGetSlowKeysDelay. + + +XkbGetSlowKeysDelay + + + Bool XkbGetSlowKeysDelay + + + Display *display + unsigned int device_spec + unsigned int *delay_rtrn + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + delay_rtrn + + + + backfilled with SlowKeys delay, ms + + + + + + +XkbGetSlowKeysDelay +requests the attributes of the +SlowKeys +control from the server, waits for a reply and backfills +delay_rtrn +with the +SlowKeys +delay attribute. +XkbGetSlowKeysDelay +returns +True +if successful; if a compatible version of the Xkb extension is not available +in the server, +XkbGetSlowKeysDelay +returns +False. + + + + +To set the +SlowKeys +acceptance delay for a keyboard device, use +XkbSetSlowKeysDelay. + + + +XkbSetSlowKeysDelay + + + Bool XkbSetSlowKeysDelay + + + Display *display + unsigned int device_spec + unsigned int delay + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device to configure, or XkbUseCoreKbd + + + + + + delay + + + + SlowKeys delay, ms + + + + + + +XkbSetSlowKeysDelay +sends a request to configure the +SlowKeys +control to the server. +It does not wait for a reply, and normally returns +True. +Specifying a value of +0 +for the +delay +parameter causes +XkbSetSlowKeysDelay +to generate a +BadValue +protocol error. If a compatible version of the Xkb extension is not available +in the server +XkbSetSlowKeysDelay +returns +False. @@ -2419,183 +2443,180 @@ FalseThe BounceKeys Control -Some users may accidentally "bounce" on a key when they release it. They press -it once, then accidentally press it again after they release it. The -BounceKeys - control temporarily disables a key after it has been pressed, effectively -"debouncing" the keyboard. The period of time the key is disabled after it is -released is known as the -BounceKeys delay -. -BounceKeys - is a boolean control. - - - - -When the -BounceKeys - control is active, the server reports acceptance or rejection of any key to -interested clients by sending an appropriate -AccessXNotify - event (see section 10.6.4). - - - - -Use -XkbGetBounceKeysDelay - to query the current -BounceKeys - delay for a keyboard device. - - - - - - - - - -Bool -XkbGetBounceKeysDelay -( -display -, - device_spec -, - delay_rtrn -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int * -delay_rtrn -; /* backfilled with bounce keys delay, ms */ - - - - - - - - -XkbGetBounceKeysDelay -requests the attributes of the -BounceKeys - control from the server, waits for a reply, and backfills -delay_rtrn -with the -BounceKeys - delay attribute. -XkbGetBounceKeysDelay -returns - - -True - if successful; if a compatible version of the Xkb extension is not available -in the server -XkbGetSlowKeysDelay - returns -False -. - - - - -To set the -BounceKeys - delay for a keyboard device, use -XkbSetBounceKeysDelay -. - - - - - - - - - - -Bool -XkbSetBounceKeysDelay -( -display -, - device_spec -, - delay -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int - device_spec -; /* device to configure, or -XkbUseCoreKbd - */ - - - - -unsigned int -delay -; /* bounce keys delay, ms */ - - - - - - - - -XkbSetBounceKeysDelay - sends a request to configure the -BounceKeys - control to the server. - -It does not wait for a reply and normally returns -True -. Specifying a value of -zero -for the -delay -parameter causes -XkbSetBounceKeysDelay - to generate a -BadValue - protocol error. If a compatible version of the Xkb extension is not available -in the server, -XkbSetBounceKeysDelay - returns -False -. +Some users may accidentally bounce on a key when they release it. +They press it once, then accidentally press it again after they release it. The +BounceKeys +control temporarily disables a key after it has been pressed, effectively +debouncing the keyboard. The period of time the key is disabled +after it is released is known as the +BounceKeys delay. +BounceKeys +is a boolean control. + + + + +When the +BounceKeys +control is active, the server reports acceptance or rejection of any key to +interested clients by sending an appropriate +AccessXNotify +event (see section 10.6.4). + + + + +Use +XkbGetBounceKeysDelay +to query the current +BounceKeys +delay for a keyboard device. + + +XkbGetBounceKeysDelay + + + Bool XkbGetBounceKeysDelay + + + Display *display + unsigned int device_spec + unsigned int *delay_rtrn + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + delay_rtrn + + + + backfilled with bounce keys delay, ms + + + + + + +XkbGetBounceKeysDelay +requests the attributes of the +BounceKeys +control from the server, waits for a reply, and backfills +delay_rtrn +with the +BounceKeys +delay attribute. +XkbGetBounceKeysDelay +returns +True +if successful; if a compatible version of the Xkb extension is not available +in the server +XkbGetSlowKeysDelay +returns +False. + + + + +To set the +BounceKeys +delay for a keyboard device, use +XkbSetBounceKeysDelay. + + + +XkbSetBounceKeysDelay + + + Bool XkbSetBounceKeysDelay + + + Display *display + unsigned int device_spec + unsigned int delay + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device to configure, or XkbUseCoreKbd + + + + + + delay + + + + bounce keys delay, ms + + + + + + +XkbSetBounceKeysDelay +sends a request to configure the +BounceKeys +control to the server. +It does not wait for a reply and normally returns +True. +Specifying a value of +zero +for the +delay +parameter causes +XkbSetBounceKeysDelay +to generate a +BadValue +protocol error. If a compatible version of the Xkb extension is not available +in the server, +XkbSetBounceKeysDelay +returns +False. @@ -2605,32 +2626,30 @@ False Some people find it difficult or even impossible to press two keys at once. For example, a one-fingered typist or someone using a mouth stick cannot press the - -Shift - and -1 - keys at the same time. The -StickyKeys - control solves this problem by changing the behavior of the modifier keys. -With -StickyKeys -, the user can first press a modifier, release it, then press another key. For +Shift +and +1 +keys at the same time. The +StickyKeys +control solves this problem by changing the behavior of the modifier keys. +With +StickyKeys, +the user can first press a modifier, release it, then press another key. For example, to get an exclamation point on a PC-style keyboard, the user can press -the -Shift - key, release it, and then press the -1 - key. +the +Shift +key, release it, and then press the +1 +key. - -StickyKeys - also allows users to lock modifier keys without requiring special locking -keys. When -StickyKeys - is enabled, a modifier is latched when the user presses it just once. The user +StickyKeys +also allows users to lock modifier keys without requiring special locking +keys. When +StickyKeys +is enabled, a modifier is latched when the user presses it just once. The user can press a modifier twice in a row to lock it, and then unlock it by pressing it one more time. @@ -2639,42 +2658,41 @@ it one more time. When a modifier is latched, it becomes unlatched when the user presses a nonmodifier key or a pointer button. For instance, to enter the sequence - -Shift -+ -Control -+ -Z - the user could press and release the -Shift - key to latch it, then press and release the -Control - key to latch it, and finally press and release the Z key. Because the - -Control - key is a modifier key, pressing it does not unlatch the -Shift - key. Thus, after the user presses the -Control - key, both the -Shift - and -Control - modifiers are latched. When the user presses the -Z - key, the effect is as though the user had pressed -Shift -+ -Control -+ -Z -. In addition, because the -Z - key is not a modifier key, the -Shift - and -Control - modifiers are unlatched. + +Shift +Control +Z + +the user could press and release the +Shift +key to latch it, then press and release the +Control +key to latch it, and finally press and release the +Z key. Because the +Control +key is a modifier key, pressing it does not unlatch the +Shift +key. Thus, after the user presses the +Control +key, both the +Shift +and +Control +modifiers are latched. When the user presses the +Z +key, the effect is as though the user had pressed + +Shift +Control +Z +. +In addition, because the +Z +key is not a modifier key, the +Shift +and +Control +modifiers are unlatched. @@ -2683,35 +2701,30 @@ Locking a modifier key means that the modifier affects any key or pointer button the user presses until the user unlocks it or it is unlocked programmatically. For example, to enter the sequence ("XKB") on a keyboard where ‘(’ is a shifted ‘9’, ‘)’ is a shifted ‘0’, and ‘"’ -is a shifted single quote, the user could press and release the -Shift - key twice to lock the -Shift - modifier. Then, when the user presses the -9 -, -‘ -, -x -, -k -, -b -, -‘ -, and -0 - keys in sequence, it generates ("XKB"). To unlock the -Shift - modifier, the user can press and release the -Shift - key. +is a shifted single quote, the user could press and release the +Shift +key twice to lock the +Shift +modifier. Then, when the user presses the +9, +', +x, +k, +b, +', +and +0 +keys in sequence, it generates ("XKB"). To unlock the +Shift +modifier, the user can press and release the +Shift +key. StickyKeys - is a boolean control with two separate attributes that may be individually +is a boolean control with two separate attributes that may be individually configured: one to automatically disable it, and one to control the latching behavior of modifier keys. @@ -2720,205 +2733,206 @@ behavior of modifier keys. StickyKeys Options -The -StickyKeys - control has two options that can be accessed via the -ax_options - of an -XkbControlsRec - structure (see section 10.8). The first option, -TwoKeys -, specifies whether -StickyKeys - should automatically turn off when two keys are pressed at the same time. This +The +StickyKeys +control has two options that can be accessed via the +ax_options +of an +XkbControlsRec +structure (see section 10.8). The first option, +TwoKeys, +specifies whether +StickyKeys +should automatically turn off when two keys are pressed at the same time. This feature is useful for shared computers so people who do not want them do not -need to turn -StickyKeys - off if a previous user left -StickyKeys - on. The second option, -LatchToLock -, specifies whether or not -StickyKeys - locks a modifier when pressed twice in a row. +need to turn +StickyKeys +off if a previous user left +StickyKeys +on. The second option, +LatchToLock, +specifies whether or not +StickyKeys +locks a modifier when pressed twice in a row. -Use -XkbGetStickyKeysOptions - to query the current -StickyKeys - attributes for a keyboard device. - - - - - - - - - -Bool -XkbGetStickyKeysOptions -( -display -, - device_spec -, - options_rtrn -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int * -options_rtrn -; /* backfilled with StickyKeys option mask */ - - - - - - - - -XkbGetStickyKeysOptions -requests the attributes of the -StickyKeys - control from the server, waits for a reply, and backfills -options_rtrn -with a mask indicating whether the individual -StickyKeys - options are on or off. Valid bits in -options_rtrn - are: - +Use +XkbGetStickyKeysOptions +to query the current +StickyKeys +attributes for a keyboard device. + + +XkbGetStickyKeysOptions + + + Bool XkbGetStickyKeysOptions + + + Display *display + unsigned int device_spec + unsigned int *options_rtrn + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + options_rtrn + + + + backfilled with StickyKeys option mask + + + + + + +XkbGetStickyKeysOptions +requests the attributes of the +StickyKeys +control from the server, waits for a reply, and backfills +options_rtrn +with a mask indicating whether the individual +StickyKeys +options are on or off. Valid bits in +options_rtrn +are: - - - XkbAX_TwoKeysMask - XkbAX_LatchToLockMask - + + XkbAX_TwoKeysMask + XkbAX_LatchToLockMask + - -XkbGetStickyKeysOptions -returns -True - if successful; if a compatible version of the Xkb extension is not available -in the server -XkbGetStickyKeysOptions - returns -False -. +XkbGetStickyKeysOptions +returns +True +if successful; if a compatible version of the Xkb extension is not available +in the server +XkbGetStickyKeysOptions +returns +False. -To set the -StickyKeys - attributes for a keyboard device, use -XkbSetStickyKeysOptions -. - - - - - - - - - - -Bool -XkbSetStickyKeysOptions -( -display -, - device_spec, mask, values -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device to configure, or XkbUseCoreKbd */ - - - - -unsigned int -mask -; /* selects StickyKeys attributes to modify */ - - - - -unsigned int -values; - /* values for selected attributes */ - - - - - - - - -XkbSetStickyKeysOptions - sends a request to configure the -StickyKeys - control to the server. - -It does not wait for a reply and normally returns -True -. The valid bits to use for both the -mask - and -values - parameters are: - +To set the +StickyKeys +attributes for a keyboard device, use +XkbSetStickyKeysOptions. + + + +XkbSetStickyKeysOptions + + + Bool XkbSetStickyKeysOptions + + + Display *display + unsigned int device_spec + unsigned int mask + unsigned int values + + + + + + display + + + + connection to X server + + + + + + device_spec + + + + device to configure, or XkbUseCoreKbd + + + + + + mask + + + + selects StickyKeys attributes to modify + + + + + + values + + + + values for selected attributes + + + + + + +XkbSetStickyKeysOptions +sends a request to configure the +StickyKeys +control to the server. +It does not wait for a reply and normally returns +True. +The valid bits to use for both the +mask +and +values +parameters are: - - - XkbAX_TwoKeysMask - XkbAX_LatchToLockMask - + + XkbAX_TwoKeysMask + XkbAX_LatchToLockMask + - If a compatible version of the Xkb extension is not available in the server, - -XkbSetStickyKeysOptions - returns -False -. +If a compatible version of the Xkb extension is not available in the server, +XkbSetStickyKeysOptions +returns +False. @@ -2931,36 +2945,33 @@ False There are several controls that apply to the keyboard mapping in general. They control handling of out-of-range group indices and how modifiers are processed and consumed in the server. These are: - - - - GroupsWrap - IgnoreGroupLock - IgnoreLockMods - InternalMods - + + GroupsWrap + IgnoreGroupLock + IgnoreLockMods + InternalMods + - -IgnoreGroupLock - is a boolean control; the rest are always active. +IgnoreGroupLock +is a boolean control; the rest are always active. Without the modifier processing options provided by Xkb, passive grabs set via -translations in a client (for example, -Alt<KeyPress>space -) do not trigger if any modifiers other than those specified by the translation -are set. This results in problems in the user interface when either -NumLock - or a secondary keyboard group is active. The -IgnoreLockMods - and -IgnoreGroupLock - controls make it possible to avoid this behavior without exhaustively +translations in a client (for example, +Alt<KeyPress>space) +do not trigger if any modifiers other than those specified by the translation +are set. This results in problems in the user interface when either +NumLock +or a secondary keyboard group is active. The +IgnoreLockMods +and +IgnoreGroupLock +controls make it possible to avoid this behavior without exhaustively specifying a grab for every possible modifier combination. @@ -2968,23 +2979,23 @@ specifying a grab for every possible modifier combination. The GroupsWrap Control -The -GroupsWrap - control determines how illegal groups are handled on a global basis. There are +The +GroupsWrap +control determines how illegal groups are handled on a global basis. There are a number of valid keyboard sequences that can cause the effective group number to go out of range. When this happens, the group must be normalized back to a -valid number. The -GroupsWrap - control specifies how this is done. +valid number. The +GroupsWrap +control specifies how this is done. When dealing with group numbers, all computations are done using the group index, which is the group number minus one. There are three different -algorithms; the -GroupsWrap - control specifies which one is used: +algorithms; the +GroupsWrap +control specifies which one is used: @@ -2992,9 +3003,9 @@ GroupsWrap XkbRedirectIntoRange All invalid group numbers are converted to a valid group number by taking the -last four bits of the -GroupsWrap - control and using them as the group index. If the result is still out of +last four bits of the +GroupsWrap +control and using them as the group index. If the result is still out of range, Group one is used. @@ -3018,25 +3029,24 @@ modulus applied to the group index. -There are no convenience functions for manipulating the -GroupsWrap - control. Manipulate the -GroupsWrap - control via the -groups_wrap - field in the -XkbControlsRec - structure, then use -XkbSetControls - and -XkbGetControls - (see section 10.9 and section 10.10) to query and change this control. +There are no convenience functions for manipulating the +GroupsWrap +control. Manipulate the +GroupsWrap +control via the +groups_wrap +field in the +XkbControlsRec +structure, then use +XkbSetControls +and +XkbGetControls +(see section 10.9 and section 10.10) to query and change this control. -See also section 15.3.2 or a discussion of the related field, - -group_info -, which also normalizes a group under certain circumstances. +See also section 15.3.2 or a discussion of the related field, +group_info, +which also normalizes a group under certain circumstances. @@ -3050,176 +3060,184 @@ unanticipated side effects. -The -IgnoreLockMods - control specifies modifiers that should be excluded from grab calculations. -These modifiers are also not reported in any core events except -KeyPress - and -KeyRelease - events that do not activate a passive grab and that do not occur while a grab +The +IgnoreLockMods +control specifies modifiers that should be excluded from grab calculations. +These modifiers are also not reported in any core events except +KeyPress +and +KeyRelease +events that do not activate a passive grab and that do not occur while a grab is active. -Manipulate the -IgnoreLockMods - control via the -ignore_lock - field in the -XkbControlsRec - structure, then use -XkbSetControls - and -XkbGetControls - (see sections 10.9 and 10.10) to query and change this control. Alternatively, -use -XkbSetIgnoreLockMods -. - - - - -To set the modifiers that, if locked, are not to be reported in matching events -to passive grabs, use -XkbSetIgnoreLockMods. +Manipulate the +IgnoreLockMods +control via the +ignore_lock +field in the +XkbControlsRec +structure, then use +XkbSetControls +and +XkbGetControls +(see section 10.9 and section 10.10) to query and change this control. Alternatively, +use +XkbSetIgnoreLockMods. - - - - - - - -Bool -XkbSetIgnoreLockMods -( -display, device_spec, affect_real, real_values, affect_virtual, -virtual_values -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int - affect_real -; /* mask of real modifiers affected by this call */ - - - - -unsigned int - real_values -; /* values for affected real modifiers (1=>set, 0=>unset) */ - - - - -unsigned int - affect_virtual -; /* mask of virtual modifiers affected by this call */ - - - - -unsigned int - virtual_values -; /* values for affected virtual modifiers (1=>set, 0=>unset) -*/ - - - - - - - - -XkbSetIgnoreLockMods - sends a request to the server to change the server’s -IgnoreLockMods - control. -affect_real - and -real_values - are masks of real modifier bits indicating which real modifiers are to be -added and removed from the server’s -IgnoreLockMods - control. Modifiers selected by both -affect_real - and -real_values - are added to the server’s -IgnoreLockMods - control; those selected by -affect_real - but not by -real_values - are removed from the server’s -IgnoreLockMods - control. Valid values for -affect_real - and -real_values - consist of any combination of the eight core modifier bits: -ShiftMask -, -LockMask -, -ControlMask -, -Mod1Mask - - -Mod5Mask -. -affect_virtual - and -virtual_values - are masks of virtual modifier bits indicating which virtual modifiers are to -be added and removed from the server’s -IgnoreLockMods - control. Modifiers selected by both -affect_virtual - and -virtual_values - are added to the server’s -IgnoreLockMods - control; those selected by -affect_virtual - but not by -virtual_values - are removed from the server’s -IgnoreLockMods - control. - -See section 7.1 for a discussion of virtual modifier masks to use in -affect_virtual - and -virtual_values -. -XkbSetIgnoreLockMods - does not wait for a reply from the server. It returns -True - if the request was sent, and -False - otherwise. + + +To set the modifiers that, if locked, are not to be reported in matching events +to passive grabs, use +XkbSetIgnoreLockMods. + + +XkbSetIgnoreLockMods + + + Bool XkbSetIgnoreLockMods + + + Display *display + unsigned int device_spec + unsigned int affect_real + unsigned int real_values + unsigned int affect_virtual + unsigned int virtual_values + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + affect_real + + + + mask of real modifiers affected by this call + + + + + + real_values + + + + values for affected real modifiers (1⇒set, 0⇒unset) + + + + + + affect_virtual + + + + mask of virtual modifiers affected by this call + + + + + + virtual_values + + + + values for affected virtual modifiers (1⇒set, 0⇒unset) + + + + + + +XkbSetIgnoreLockMods +sends a request to the server to change the server’s +IgnoreLockMods +control. +affect_real +and +real_values +are masks of real modifier bits indicating which real modifiers are to be +added and removed from the server’s +IgnoreLockMods +control. Modifiers selected by both +affect_real +and +real_values +are added to the server’s +IgnoreLockMods +control; those selected by +affect_real +but not by +real_values +are removed from the server’s +IgnoreLockMods +control. Valid values for +affect_real +and +real_values +consist of any combination of the eight core modifier bits: +ShiftMask, +LockMask, +ControlMask, +Mod1Mask +– +Mod5Mask. +affect_virtual +and +virtual_values +are masks of virtual modifier bits indicating which virtual modifiers are to +be added and removed from the server’s +IgnoreLockMods +control. Modifiers selected by both +affect_virtual +and +virtual_values +are added to the server’s +IgnoreLockMods +control; those selected by +affect_virtual +but not by +virtual_values +are removed from the server’s +IgnoreLockMods +control. +See section 7.1 for a discussion of virtual modifier masks to use in +affect_virtual +and +virtual_values. +XkbSetIgnoreLockMods +does not wait for a reply from the server. It returns +True +if the request was sent, and +False +otherwise. @@ -3227,18 +3245,18 @@ False The IgnoreGroupLock Control -The -IgnoreGroupLock - control is a boolean control with no attributes. If enabled, it specifies that +The +IgnoreGroupLock +control is a boolean control with no attributes. If enabled, it specifies that the locked state of the keyboard group should not be considered when activating passive grabs. -Because -IgnoreGroupLock - is a boolean control with no attributes, use the general boolean controls -functions (see section 10.1) to change its state. +Because +IgnoreGroupLock +is a boolean control with no attributes, use the general boolean controls +functions (see section 10.1) to change its state. @@ -3249,171 +3267,176 @@ functions (see section 10.1) to change its state. The core protocol does not provide any means to prevent a modifier from being reported in events sent to clients; Xkb, however makes this possible via the - -InternalMods - control. It specifies modifiers that should be consumed by the server and not +InternalMods +control. It specifies modifiers that should be consumed by the server and not reported to clients. When a key is pressed and a modifier that has its bit set -in the -InternalMods - control is reported to the server, the server uses the modifier when +in the +InternalMods +control is reported to the server, the server uses the modifier when determining the actions to apply for the key. The server then clears the bit, so it is not actually reported to the client. In addition, modifiers specified -in the -InternalMods - control are not used to determine grabs and are not used to calculate core +in the +InternalMods +control are not used to determine grabs and are not used to calculate core protocol compatibility state. -Manipulate the -InternalMods - control via the -internal - field in the -XkbControlsRec - structure, using -XkbSetControls - and -XkbGetControls - (see sections10.9 and 10.10). Alternatively, use -XkbSetServerInternalMods -. +Manipulate the +InternalMods +control via the +internal +field in the +XkbControlsRec +structure, using +XkbSetControls +and +XkbGetControls +(see section 10.9 +and section 10.10). Alternatively, use +XkbSetServerInternalMods. To set the modifiers that are consumed by the server before events are -delivered to the client, use -XkbSetServerInternalMods. - - - - - - - - - -Bool -XkbSetServerInternalMods -( -display, device_spec, affect_real, real_values, affect_virtual, -virtual_values -) - - - - -Display * -display -; /* connection to the X server */ - - - - -unsigned int -device_spec -;‘ /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int - affect_real -; /* mask of real modifiers affected by this call */ - - - - -unsigned int - real_values -; /* values for affected real modifiers (1=>set, 0=>unset) */ - - - - -unsigned int - affect_virtual -; /* mask of virtual modifiers affected by this call */ - - - - -unsigned int - virtual_values -; /* values for affected virtual modifiers (1=>set, 0=>unset) -*/ - - - - - - - - -XkbSetServerInternalMods - sends a request to the server to change the internal modifiers consumed by the -server. -affect_real - and -real_values - are masks of real modifier bits indicating which real modifiers are to be +delivered to the client, use +XkbSetServerInternalMods. + + +XkbSetServerInternalMods + + + Bool XkbSetServerInternalMods + + + Display *display + unsigned int device_spec + unsigned int affect_real + unsigned int real_values + unsigned int affect_virtual + unsigned int virtual_values + + + + + + display + + + + connection to the X server + + + + + + device_spec + + + + ‘device ID, or XkbUseCoreKbd + + + + + + affect_real + + + + mask of real modifiers affected by this call + + + + + + real_values + + + + values for affected real modifiers (1⇒set, 0⇒unset) + + + + + + affect_virtual + + + + mask of virtual modifiers affected by this call + + + + + + virtual_values + + + + values for affected virtual modifiers (1⇒set, 0⇒unset) + + + + + + +XkbSetServerInternalMods +sends a request to the server to change the internal modifiers consumed by the +server. +affect_real +and +real_values +are masks of real modifier bits indicating which real modifiers are to be added and removed from the server’s internal modifiers control. Modifiers -selected by both -affect_real - and -real_values - are added to the server’s internal modifiers control; those selected by - -affect_real - but not by -real_values - are removed from the server’s internal modifiers mask. Valid values for - -affect_real - and -real_values - consist of any combination of the eight core modifier bits: -ShiftMask -, -LockMask -, -ControlMask -, -Mod1Mask - - -Mod5Mask -. - affect_virtual - and -virtual_values - are masks of virtual modifier bits indicating which virtual modifiers are to +selected by both +affect_real +and +real_values +are added to the server’s internal modifiers control; those selected by +affect_real +but not by +real_values +are removed from the server’s internal modifiers mask. Valid values for +affect_real +and +real_values +consist of any combination of the eight core modifier bits: +ShiftMask, +LockMask, +ControlMask, +Mod1Mask +– +Mod5Mask. +affect_virtual +and +virtual_values +are masks of virtual modifier bits indicating which virtual modifiers are to be added and removed from the server’s internal modifiers control. Modifiers -selected by both -affect_virtual - and -virtual_values - are added to the server’s internal modifiers control; those selected by - -affect_virtual - but not by -virtual_values - are removed from the server’s internal modifiers control. - -See section 7.1 for a discussion of virtual modifier masks to use in -affect_virtual - and -virtual_values -. - XkbSetServerInternalMods - does not wait for a reply from the server. It returns -True - if the request was sent and -False - otherwise. +selected by both +affect_virtual +and +virtual_values +are added to the server’s internal modifiers control; those selected by +affect_virtual +but not by +virtual_values +are removed from the server’s internal modifiers control. +See section 7.1 for a discussion of virtual modifier masks to use in +affect_virtual +and +virtual_values. +XkbSetServerInternalMods +does not wait for a reply from the server. It returns +True +if the request was sent and +False +otherwise. @@ -3422,77 +3445,87 @@ False The XkbControlsRec Structure + +XkbControlsRec + Many of the individual controls described in sections 10.1 through 10.7 may be manipulated via convenience functions discussed in those sections. Some of -them, however, have no convenience functions. The -XkbControlsRec - structure allows the manipulation of one or more of the controls in a single -operation and to track changes to any of them in conjunction with the -XkbGetControls - and -XkbSetControls - functions. This is the only way to manipulate those controls that have no +them, however, have no convenience functions. The +XkbControlsRec +structure allows the manipulation of one or more of the controls in a single +operation and to track changes to any of them in conjunction with the +XkbGetControls +and +XkbSetControls +functions. This is the only way to manipulate those controls that have no convenience functions. -The -XkbControlsRec - structure is defined as follows: - +The +XkbControlsRec +structure is defined as follows: - #define XkbMaxLegalKeyCode 255 #define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) - - - - + typedef struct { - unsigned char mk_dflt_btn; /* default button for keyboard driven mouse */ - unsigned char num_groups; /* number of keyboard groups */ - unsigned char groups_wrap; /* how to wrap out-of-bounds groups */ - XkbModsRec internal; /* defines server internal modifiers */ - XkbModsRec ignore_lock; /* modifiers to ignore when checking for grab */ - unsigned int enabled_ctrls; /* 1 bit => corresponding boolean control enabled */ - unsigned short repeat_delay; /* ms delay until first repeat */ - unsigned short repeat_interval; /* ms delay between repeats */ - unsigned short slow_keys_delay; /* ms minimum time key must be down to be ok */ - unsigned short debounce_delay; /* ms delay before key reactivated */ - unsigned short mk_delay; /* ms delay to second mouse motion event */ - unsigned short mk_interval; /* ms delay between repeat mouse events */ - unsigned short mk_time_to_max; /* # intervals until constant mouse move */ - unsigned short mk_max_speed; /* multiplier for maximum mouse speed */ - short mk_curve; /* determines mouse move curve type */ - unsigned short ax_options; /* 1 bit => Access X option enabled */ - unsigned short ax_timeout; /* seconds until Access X disabled */ - unsigned short axt_opts_mask; /* 1 bit => options to reset on Access X timeout */ - unsigned short axt_opts_values; /* 1 bit => turn option on, 0=> off */ - unsigned int axt_ctrls_mask; /* which bits in enabled_ctrls to modify */ - unsigned int axt_ctrls_values; /* values for new bits in enabled_ctrls */ - unsigned char per_key_repeat[XkbPerKeyBitArraySize]; /* per key auto repeat */ -} XkbControlsRec, *XkbControlsPtr; + unsigned char mk_dflt_btn; /* default button for + keyboard driven mouse */ + unsigned char num_groups; /* number of keyboard groups */ + unsigned char groups_wrap; /* how to wrap out-of-bounds groups */ + XkbModsRec internal; /* defines server internal modifiers */ + XkbModsRec ignore_lock; /* modifiers to ignore when + checking for grab */ + unsigned int enabled_ctrls; /* 1 bit ⇒ corresponding + boolean control enabled */ + unsigned short repeat_delay; /* ms delay until first repeat */ + unsigned short repeat_interval; /* ms delay between repeats */ + unsigned short slow_keys_delay; /* ms minimum time key must be + down to be ok */ + unsigned short debounce_delay; /* ms delay before key reactivated */ + unsigned short mk_delay; /* ms delay to second mouse + motion event */ + unsigned short mk_interval; /* ms delay between repeat mouse + events */ + unsigned short mk_time_to_max; /* # intervals until constant + mouse move */ + unsigned short mk_max_speed; /* multiplier for maximum mouse speed */ + short mk_curve; /* determines mouse move curve type */ + unsigned short ax_options; /* 1 bit ⇒ Access X option enabled */ + unsigned short ax_timeout; /* seconds until Access X disabled */ + unsigned short axt_opts_mask; /* 1 bit ⇒ options to reset + on Access X timeout */ + unsigned short axt_opts_values; /* 1 bit ⇒ turn option on, 0⇒ off */ + unsigned int axt_ctrls_mask; /* which bits in enabled_ctrls + to modify */ + unsigned int axt_ctrls_values; /* values for new bits in + enabled_ctrls */ + unsigned char per_key_repeat[XkbPerKeyBitArraySize]; + /* per key auto repeat */ +} XkbControlsRec, *XkbControlsPtr; -The general-purpose functions that work with the -XkbControlsRec - structure use a mask to specify which controls are to be manipulated. Table -10.6 lists these controls, the masks used to select them in the general -function calls ( -which - parameter), and the data fields in the -XkbControlsRec - structure that comprise each of the individual controls. Also listed are the +The general-purpose functions that work with the +XkbControlsRec +structure use a mask to specify which controls are to be manipulated. +Table 10.6 +lists these controls, the masks used to select them in the general +function calls +(which +parameter), and the data fields in the +XkbControlsRec +structure that comprise each of the individual controls. Also listed are the bit used to turn boolean controls on and off and the section where each control is described in more detail. -
+
Xkb Controls @@ -3513,21 +3546,21 @@ is described in more detail. AccessXFeedback - XkbAccessXFeedbackMask + XkbAccessXFeedbackMask ax_options: XkbAX_*FBMask XkbAccessXFeedback­Mask - 10.6.3 + 10.6.3 AccessXKeys XkbAccessXKeys­Mask - 10.6.1 + 10.6.1 AccessXTimeout - XkbAccessXTimeoutMask + XkbAccessXTimeoutMask ax_timeout axt_opts_mask @@ -3536,81 +3569,81 @@ is described in more detail. axt_ctrls_values XkbAccessXTimeout­Mask - 10.6.2 + 10.6.2 AudibleBell - XkbAudibleBellMask - 9.2 + XkbAudibleBellMask + 9.2 AutoReset - 10.1.2 + 10.1.2 BounceKeys - XkbBounceKeysMask + XkbBounceKeysMask debounce_delay - XkbBounceKeysMask - 10.6.7 + XkbBounceKeysMask + 10.6.7 Detectable-Autorepeat - 10.3.3 + 10.3.3 EnabledControls - XkbControlsEnabledMask + XkbControlsEnabledMask enabled_ctrls Non-Boolean Control - 10.1.1 + 10.1.1 GroupsWrap - XkbGroupsWrapMask + XkbGroupsWrapMask groups_wrap Non-Boolean Control - 10.7.1 + 10.7.1 IgnoreGroupLock XkbIgnoreGroupLock­Mask - 10.7.3 + 10.7.3 IgnoreLockMods - XkbIgnoreLockModsMask + XkbIgnoreLockModsMask ignore_lock Non-Boolean Control - 5.1 + 5.1 InternalMods - XkbInternalModsMask + XkbInternalModsMask internal Non-Boolean Control - 5.1 + 5.1 MouseKeys - XkbMouseKeysMask + XkbMouseKeysMask mk_dflt_btn - XkbMouseKeysMask - 10.5.1 + XkbMouseKeysMask + 10.5.1 MouseKeysAccel - XkbMouseKeysAccelMask + XkbMouseKeysAccelMask mk_delay mk_interval @@ -3619,75 +3652,76 @@ is described in more detail. mk_curve XkbMouseKeysAccel­Mask - 10.5.2 + 10.5.2 Overlay1 - XkbOverlay1Mask - 10.4 + XkbOverlay1Mask + 10.4 Overlay2 - XkbOverlay2Mask - 10.4 + XkbOverlay2Mask + 10.4 PerKeyRepeat - XkbPerKeyRepeatMask + XkbPerKeyRepeatMask per_key_repeat Non-Boolean Control - 10.3.1 + 10.3.1 RepeatKeys - XkbRepeatKeysMask + XkbRepeatKeysMask repeat_delay repeat_interval - XkbRepeatKeysMask - 10.3 + XkbRepeatKeysMask + 10.3 SlowKeys - XkbSlowKeysMask + XkbSlowKeysMask slow_keys_delay - XkbSlowKeysMask - 10.6.6 + XkbSlowKeysMask + 10.6.6 StickyKeys - XkbStickyKeysMask + XkbStickyKeysMask ax_options: XkbAX_Two­KeysMask XkbAX_Latch­ToLockMask - XkbStickyKeysMask - 10.6.8 + XkbStickyKeysMask + 10.6.8
-Table 10.7 shows the actual values for the individual mask bits used to select +Table 10.7 +shows the actual values for the individual mask bits used to select controls for modification and to enable and disable the control. Note that the same mask bit is used to specify general modifications to the parameters used -to configure the control ( -which -), and to enable and disable the control ( -enabled_ctrls -). The anomalies in the table (no "ok" in column) are for controls that have no +to configure the control +(which), +and to enable and disable the control +(enabled_ctrls). +The anomalies in the table (no ok in column) are for controls that have no configurable attributes; and for controls that are not boolean controls and therefore cannot be enabled or disabled. - +
Controls Mask Bits @@ -3705,127 +3739,127 @@ therefore cannot be enabled or disabled. - XkbRepeatKeysMask + XkbRepeatKeysMask ok ok (1L<<0) - XkbSlowKeysMask + XkbSlowKeysMask ok ok (1L<<1) - XkbBounceKeysMask + XkbBounceKeysMask ok ok (1L<<2) - XkbStickyKeysMask + XkbStickyKeysMask ok ok (1L<<3) - XkbMouseKeysMask + XkbMouseKeysMask ok ok (1L<<4) - XkbMouseKeysAccelMask + XkbMouseKeysAccelMask ok ok (1L<<5) - XkbAccessXKeysMask + XkbAccessXKeysMask ok ok (1L<<6) - XkbAccessXTimeoutMask + XkbAccessXTimeoutMask ok ok (1L<<7) - XkbAccessXFeedbackMask + XkbAccessXFeedbackMask ok ok (1L<<8) - XkbAudibleBellMask + XkbAudibleBellMask ok (1L<<9) - XkbOverlay1Mask + XkbOverlay1Mask ok (1L<<10) - XkbOverlay2Mask + XkbOverlay2Mask ok (1L<<11) - XkbIgnoreGroupLockMask + XkbIgnoreGroupLockMask ok (1L<<12) - XkbGroupsWrapMask + XkbGroupsWrapMask ok (1L<<27) - XkbInternalModsMask + XkbInternalModsMask ok (1L<<28) - XkbIgnoreLockModsMask + XkbIgnoreLockModsMask ok (1L<<29) - XkbPerKeyRepeatMask + XkbPerKeyRepeatMask ok (1L<<30) - XkbControlsEnabledMask + XkbControlsEnabledMask ok (1L<<31) - XkbAccessXOptionsMask + XkbAccessXOptionsMask ok ok (XkbStickyKeysMask | XkbAccessXFeedbackMask) - XkbAllBooleanCtrlsMask + XkbAllBooleanCtrlsMask ok (0x00001FFF) - XkbAllControlsMask + XkbAllControlsMask ok (0xF8001FFF) @@ -3835,9 +3869,9 @@ therefore cannot be enabled or disabled.
-The individual fields of the -XkbControlsRec - structure are defined as follows. +The individual fields of the +XkbControlsRec +structure are defined as follows. @@ -3846,20 +3880,15 @@ XkbControlsRec mk_dflt_btn - -mk_dflt_btn is an attribute of the - -MouseKeys - - control - (see section 10.5 -). It - specifies the mouse button number to use for keyboard simulated mouse button -operations. Its value should be one of the core symbols -Button1 - - -Button5 -. +mk_dflt_btn is an attribute of the +MouseKeys +control +(see section 10.5). It +specifies the mouse button number to use for keyboard simulated mouse button +operations. Its value should be one of the core symbols +Button1 +– +Button5. @@ -3868,11 +3897,10 @@ Button5 num_groups - -num_groups - is not a part of any control, but is reported in the -XkbControlsRec - structure whenever any of its components are fetched from the server. It +num_groups +is not a part of any control, but is reported in the +XkbControlsRec +structure whenever any of its components are fetched from the server. It reports the number of groups the particular keyboard configuration uses and is computed automatically by the server whenever the keyboard mapping changes. @@ -3883,17 +3911,16 @@ computed automatically by the server whenever the keyboard mapping changes. groups_wrap - -groups_wrap - is an attribute of the -GroupsWrap - control (see section 10.7.1). It specifies the handling of illegal groups on a -global basis. Valid values for -groups_wrap - are shown in Table 10.8. +groups_wrap +is an attribute of the +GroupsWrap +control (see section 10.7.1). It specifies the handling of illegal groups on a +global basis. Valid values for +groups_wrap +are shown in Table 10.8. - +
GroupsWrap options (groups_wrap field) @@ -3907,15 +3934,15 @@ groups_wrap - XkbWrapIntoRange + XkbWrapIntoRange (0x00) - XkbClampIntoRange + XkbClampIntoRange (0x40) - XkbRedirectIntoRange + XkbRedirectIntoRange (0x80) @@ -3923,11 +3950,11 @@ groups_wrap
-When -groups_wrap - is set to -XkbRedirectIntoRange -, its four low-order bits specify the index of the group to use. +When +groups_wrap +is set to +XkbRedirectIntoRange, +its four low-order bits specify the index of the group to use. @@ -3936,23 +3963,18 @@ XkbRedirectIntoRange internal - -internal - is an attribute of the -InternalMods - control (see section 10.7.4). It specifies modifiers to be consumed in the +internal +is an attribute of the +InternalMods +control (see section 10.7.4). It specifies modifiers to be consumed in the server and not passed on to clients when events are reported. Valid values -consist of any combination of the eight core modifier bits: -ShiftMask -, -LockMask -, -ControlMask -, -Mod1Mask - - -Mod5Mask -. +consist of any combination of the eight core modifier bits: +ShiftMask, +LockMask, +ControlMask, +Mod1Mask +– +Mod5Mask. @@ -3961,23 +3983,18 @@ Mod5Mask ignore_lock - -ignore_lock - is an attribute of the -IgnoreLockMods - control (see section 10.7.2). It specifies modifiers to be ignored in grab +ignore_lock +is an attribute of the +IgnoreLockMods +control (see section 10.7.2). It specifies modifiers to be ignored in grab calculations. Valid values consist of any combination of the eight core -modifier bits: -ShiftMask -, -LockMask -, -ControlMask -, -Mod1Mask - - -Mod5Mask -. +modifier bits: +ShiftMask, +LockMask, +ControlMask, +Mod1Mask +– +Mod5Mask. @@ -3986,16 +4003,16 @@ Mod5Mask enabled_ctrls - -enabled_ctrls - is an attribute of the -EnabledControls - control (see section 10.1.1). It contains one bit per boolean control. Each +enabled_ctrls +is an attribute of the +EnabledControls +control (see section 10.1.1). It contains one bit per boolean control. Each bit determines whether the corresponding control is enabled or disabled; a one bit means the control is enabled. The mask bits used to enable these controls -are listed in Table 10.7, using only those masks with "ok" in the -enabled_ctrls - column. +are listed in Table 10.7, +using only those masks with ok in the +enabled_ctrls +column. @@ -4004,17 +4021,16 @@ enabled_ctrls repeat_delay and repeat_interval - -repeat_delay - and -repeat_interval - are attributes of the -RepeatKeys - control (see section 10.3.2). -repeat_delay - is the initial delay before a key begins repeating, in milliseconds; -repeat_interval - is the delay between subsequent key events, in milliseconds. +repeat_delay +and +repeat_interval +are attributes of the +RepeatKeys +control (see section 10.3.2). +repeat_delay +is the initial delay before a key begins repeating, in milliseconds; +repeat_interval +is the delay between subsequent key events, in milliseconds. @@ -4023,13 +4039,12 @@ repeat_interval slow_keys_delay - -slow_keys_delay - is an attribute of the -SlowKeys - control (see section 10.6.6). Its value specifies the -SlowKeys - acceptance delay period in milliseconds before a key press is accepted by the +slow_keys_delay +is an attribute of the +SlowKeys +control (see section 10.6.6). Its value specifies the +SlowKeys +acceptance delay period in milliseconds before a key press is accepted by the server. @@ -4039,13 +4054,12 @@ server. debounce_delay - -debounce_delay - is an attribute of the -BounceKeys - control (see section 10.6.7). Its value specifies the -BounceKeys - delay period in milliseconds for which the key is disabled after having been +debounce_delay +is an attribute of the +BounceKeys +control (see section 10.6.7). Its value specifies the +BounceKeys +delay period in milliseconds for which the key is disabled after having been pressed before another press of the same key is accepted by the server. @@ -4055,19 +4069,15 @@ pressed before another press of the same key is accepted by the server. mk_delay, mk_interval, mk_time_to_max, mk_max_speed, and mk_curve - -mk_delay -, -mk_interval -, -mk_time_to_max -, -mk_max_speed -, and -mk_curve - are attributes of the -MouseKeysAccel - control. Refer to section 10.5.2 for a description of these fields and the +mk_delay, +mk_interval, +mk_time_to_max, +mk_max_speed, +and +mk_curve +are attributes of the +MouseKeysAccel +control. Refer to section 10.5.2 for a description of these fields and the units involved. @@ -4077,20 +4087,19 @@ units involved. ax_options -The -ax_options - field contains attributes used to configure two different controls, the - -StickyKeys - control (see section 10.6.8) and the -AccessXFeedback - control (see section 10.6.3). The -ax_options - field is a bitmask and may include any combination of the bits defined in -Table 10.9. +The +ax_options +field contains attributes used to configure two different controls, the +StickyKeys +control (see section 10.6.8) and the +AccessXFeedback +control (see section 10.6.3). The +ax_options +field is a bitmask and may include any combination of the bits defined in +Table 10.9. - +
Access X Enable/Disable Bits (ax_options field) @@ -4107,67 +4116,67 @@ Table 10.9. AccessXFeedback - XkbAX_SKPressFBMask + XkbAX_SKPressFBMask (1L<<0) - XkbAX_SKAcceptFBMask + XkbAX_SKAcceptFBMask (1L << 1) - XkbAX_FeatureFBMask + XkbAX_FeatureFBMask (1L << 2) - XkbAX_SlowWarnFBMask + XkbAX_SlowWarnFBMask (1L << 3) - XkbAX_IndicatorFBMask + XkbAX_IndicatorFBMask (1L << 4) - XkbAX_StickyKeysFBMask + XkbAX_StickyKeysFBMask (1L << 5) - XkbAX_SKReleaseFBMask + XkbAX_SKReleaseFBMask (1L << 8) - XkbAX_SKRejectFBMask + XkbAX_SKRejectFBMask (1L << 9) - XkbAX_BKRejectFBMask + XkbAX_BKRejectFBMask (1L << 10) - XkbAX_DumbBellFBMask + XkbAX_DumbBellFBMask (1L << 11) StickyKeys - XkbAX_TwoKeysMask + XkbAX_TwoKeysMask (1L << 6) - XkbAX_LatchToLockMask + XkbAX_LatchToLockMask (1L << 7) - XkbAX_AllOptionsMask + XkbAX_AllOptionsMask (0xFFF) @@ -4176,100 +4185,93 @@ Table 10.9. The fields pertaining to each control are relevant only when the control is -enabled ( -XkbAccessXFeedbackMask - or -XkbStickyKeysMask - bit is turned on in the -enabled_cntrls - field). +enabled +(XkbAccessXFeedbackMask +or +XkbStickyKeysMask +bit is turned on in the +enabled_ctrls +field). -Xkb provides a set of convenience macros for working with the -ax_options - field of an -XkbControlsRec - structure: - +Xkb provides a set of convenience macros for working with the +ax_options +field of an +XkbControlsRec +structure: - -#define XkbAX_NeedOption -(c,w) ((c)->ax_options&(w)) + +#define XkbAX_NeedOption(c,w) ((c)->ax_options & (w)) -The -XkbAX_NeedOption - macro is useful for determining whether a particular AccessX option is enabled -or not. It accepts a pointer to an -XkbControlsRec - structure and a valid mask bit from Table 10.9. If the specified mask bit in -the -ax_options - field of the controls structure is set, the macro returns the mask bit. +The +XkbAX_NeedOption +macro is useful for determining whether a particular AccessX option is enabled +or not. It accepts a pointer to an +XkbControlsRec +structure and a valid mask bit from +Table 10.9. +If the specified mask bit in the +ax_options +field of the controls structure is set, the macro returns the mask bit. Otherwise, it returns zero. Thus, - - - - -XkbAX_NeedOption(ctlrec, XkbAX_LatchToLockMask) - + + XkbAX_NeedOption(ctlrec, XkbAX_LatchToLockMask) + - is nonzero if the latch to lock transition for latching keys is enabled, and -zero if it is disabled. Note that -XkbAX_NeedOption - only determines whether or not the particular capability is configured to -operate; the -XkbAccessXFeedbackMask - bit must also be turned on in -enabled_ctrls - for the capability to actually be functioning. +zero if it is disabled. Note that +XkbAX_NeedOption +only determines whether or not the particular capability is configured to +operate; the +XkbAccessXFeedbackMask +bit must also be turned on in +enabled_ctrls +for the capability to actually be functioning. -#define XkbAX_AnyFeedback -(c) ((c)->enabled_ctrls&XkbAccessXFeedbackMask) +#define XkbAX_AnyFeedback(c) \ + ((c)->enabled_ctrls & XkbAccessXFeedbackMask) -The -XkbAX_AnyFeeback - macro accepts a pointer to an -XkbControlsRec - structure and tells whether the -AccessXFeedback - control is enabled or not. If the -AccessXFeedback - control is enabled, the macro returns -XkbAccessXFeedbackMask -. Otherwise, it returns zero. +The +XkbAX_AnyFeedback +macro accepts a pointer to an +XkbControlsRec +structure and tells whether the +AccessXFeedback +control is enabled or not. If the +AccessXFeedback +control is enabled, the macro returns +XkbAccessXFeedbackMask. +Otherwise, it returns zero. -#define XkbAX_NeedFeedback -(c,w) (XkbAX_AnyFeedback(c)&&XkbAX_NeedOption(c,w)) +#define XkbAX_NeedFeedback(c,w) \ + (XkbAX_AnyFeedback(c) && XkbAX_NeedOption(c,w)) -The -XkbAX_NeedFeedback - macro is useful for determining if both the -AccessXFeedback - control and a particular AccessX feedback option are enabled. The macro -accepts a pointer to an -XkbControlsRec - structure and a feedback option from the table above. If both the -AccessXFeedback - control and the specified feedback option are enabled, the macro returns - -True -. Otherwise it returns -False -. +The +XkbAX_NeedFeedback +macro is useful for determining if both the +AccessXFeedback +control and a particular AccessX feedback option are enabled. The macro +accepts a pointer to an +XkbControlsRec +structure and a feedback option from the table above. If both the +AccessXFeedback +control and the specified feedback option are enabled, the macro returns +True. +Otherwise it returns +False. @@ -4279,19 +4281,15 @@ id='ax_timeout_axt_opts_mask_axt_opts_values_axt_ctrls_mask_and_axt_ctrls_values ax_timeout, axt_opts_mask, axt_opts_values, axt_ctrls_mask, and axt_ctrls_values - -ax_timeout -, -act_opts_mask -, -axt_opts_values -, -axt_ctrls_mask -, and -axt_ctrls_values - are attributes of the -AccessXTimeout - control. Refer to section 10.6.2 for a description of these fields and the +ax_timeout, +axt_opts_mask, +axt_opts_values, +axt_ctrls_mask, +and +axt_ctrls_values +are attributes of the +AccessXTimeout +control. Refer to section 10.6.2 for a description of these fields and the units involved. @@ -4301,30 +4299,30 @@ units involved. per_key_repeat -The -per_key_repeat - field mirrors the -auto_repeats - field of the core protocol -XKeyboardState - structure: changing the -auto_repeats - field automatically changes -per_key_repeat - and vice versa. It is provided for convenience and to reduce protocol traffic. +The +per_key_repeat +field mirrors the +auto_repeats +field of the core protocol +XKeyboardState +structure: changing the +auto_repeats +field automatically changes +per_key_repeat +and vice versa. It is provided for convenience and to reduce protocol traffic. For example, to obtain the individual repeat key behavior as well as the repeat -delay and rate, use -XkbGetControls -. If the -per_key_repeat - were not in this structure, you would have to call both -XGetKeyboardControl - and -XkbGetControls - to get this information. The bits correspond to keycodes. The first seven keys -(keycodes 1-7) are indicated in -per_key_repeat -[0], with bit position 0 (low order) corresponding to the fictitious keycode 0. +delay and rate, use +XkbGetControls. +If the +per_key_repeat +were not in this structure, you would have to call both +XGetKeyboardControl +and +XkbGetControls +to get this information. The bits correspond to keycodes. The first seven keys +(keycodes 1–7) are indicated in +per_key_repeat[0], +with bit position 0 (low order) corresponding to the fictitious keycode 0. Following array elements correspond to 8 keycodes per element. A 1 bit indicates that the key is a repeating key. @@ -4337,404 +4335,395 @@ indicates that the key is a repeating key. Querying Controls -Use -XkbGetControls - to find the current state of Xkb server controls. - - - - - - - - - -Status -XkbGetControls -( -display, which, xkb) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned long - which -; /* mask of controls requested */ - - - - -XkbDescPtr - xkb -; /* keyboard description for controls information*/ - - - - - - - - -XkbGetControls - queries the server for the requested control information, waits for a reply, +Use +XkbGetControls +to find the current state of Xkb server controls. + + +XkbGetControls + + + Status XkbGetControls + + + Display *display + unsigned long which + XkbDescPtr xkb + + + + + + display + + + + connection to X server + + + + + + which + + + + mask of controls requested + + + + + + xkb + + + + keyboard description for controls information + + + + + + +XkbGetControls +queries the server for the requested control information, waits for a reply, and then copies the server’s values for the requested information into the - -ctrls - structure of the -xkb - argument. Only those components specified by the -which - parameter are copied. Valid values for -which - are any combination of the masks listed in Table 10.7 that have "ok" in the - -which - column. - - - - -If -xkb --> -ctrls -is -NULL -, -XkbGetControls - allocates and initializes it before obtaining the values specified by - -which -. If -xkb --> -ctrls - is not -NULL -, -XkbGetControls - modifies only those portions of -xkb --> -ctrls - corresponding to the values specified by -which -. - - - - - -XkbGetControls - returns -Success - if successful; otherwise, it returns -BadAlloc - if it cannot obtain sufficient storage, -BadMatch - if -xkb - is -NULL - or -which - is empty, or -BadImplementation -. - - - - -To free the -ctrls - member of a keyboard description, use -XkbFreeControls - (see section 10.12) - - - - -The -num_groups - field in the -ctrls - structure is always filled in by -XkbGetControls -, regardless of which bits are selected by -which -. +ctrls +structure of the +xkb +argument. Only those components specified by the +which +parameter are copied. Valid values for +which +are any combination of the masks listed in +Table 10.7 that have ok in the +which +column. - - -Changing Controls - -There are two ways to make changes to controls: either change a local copy -keyboard description and call -XkbSetControls -, or, to reduce network traffic, use an - XkbControlsChangesRec - structure and call -XkbChangeControls -. +If +xkb->ctrls +is +NULL, +XkbGetControls +allocates and initializes it before obtaining the values specified by +which. +If +xkb->ctrls +is not +NULL, +XkbGetControls +modifies only those portions of +xkb->ctrls +corresponding to the values specified by +which. -To change the state of one or more controls, first modify the -ctrls - structure in a local copy of the keyboard description and then use -XkbSetControls - to copy those changes to the X server. +XkbGetControls +returns +Success +if successful; otherwise, it returns +BadAlloc +if it cannot obtain sufficient storage, +BadMatch +if +xkb +is +NULL +or +which +is empty, or +BadImplementation. - - - - - - - -Bool -XkbSetControls -( -display, which, xkb) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned long - which -; /* mask of controls to change */ - - - - -XkbDescPtr -xkb -; /* -ctrls - field contains new values to be set */ - - - - - -For each bit that is set in the -which - parameter, -XkbSetControls - sends the corresponding values from the -xkb --> -ctrls - field to the server. Valid values for -which - are any combination of the masks listed in Table 10.7 that have "ok" in the - -which - column. +To free the +ctrls +member of a keyboard description, use +XkbFreeControls +(see section 10.12) -If -xkb --> -ctrls - is -NULL -, the server does not support a compatible version of Xkb, or the Xkb extension -has not been properly initialized, -XkbSetControls - returns -False -. Otherwise, it sends the request to the X server and returns -True -. +The +num_groups +field in the +ctrls +structure is always filled in by +XkbGetControls, +regardless of which bits are selected by +which. + + +Changing Controls + -Note that changes to attributes of controls in the -XkbControlsRec - structure are apparent only when the associated control is enabled, although +There are two ways to make changes to controls: either change a local copy +keyboard description and call +XkbSetControls, +or, to reduce network traffic, use an +XkbControlsChangesRec +structure and call +XkbChangeControls. + + + + +To change the state of one or more controls, first modify the +ctrls +structure in a local copy of the keyboard description and then use +XkbSetControls +to copy those changes to the X server. + + +XkbSetControls + + + Bool XkbSetControls + + + Display *display + unsigned long which + XkbDescPtr xkb + + + + + + display + + + + connection to X server + + + + + + which + + + + mask of controls to change + + + + + + xkb + + + + ctrls field contains new values to be set + + + + + + +For each bit that is set in the +which +parameter, +XkbSetControls +sends the corresponding values from the +xkb->ctrls +field to the server. Valid values for +which +are any combination of the masks listed in +Table 10.7 that have ok in the +which +column. + + + + +If +xkb->ctrls +is +NULL, +the server does not support a compatible version of Xkb, or the Xkb extension +has not been properly initialized, +XkbSetControls +returns +False. +Otherwise, it sends the request to the X server and returns +True. + + + + +Note that changes to attributes of controls in the +XkbControlsRec +structure are apparent only when the associated control is enabled, although the corresponding values are still updated in the X server. For example, the - -repeat_delay - and -repeat_interval - fields are ignored unless the -RepeatKeys - control is enabled (that is, the X server’s equivalent of -xkb->ctrls - has -XkbRepeatKeyMask - set in -enabled_ctrls -). It is permissible to modify the attributes of a control in one call to -XkbSetControls and enable the control in a subsequent call. See section 10.1.1 +repeat_delay +and +repeat_interval +fields are ignored unless the +RepeatKeys +control is enabled (that is, the X server’s equivalent of +xkb->ctrls +has +XkbRepeatKeysMask +set in +enabled_ctrls). +It is permissible to modify the attributes of a control in one call to +XkbSetControls and enable the control in a subsequent call. See section 10.1.1 for more information on enabling and disabling controls. -Note that the -enabled_ctrls - field is itself a control — the -EnabledControls - control. As such, to set a specific configuration of enabled and disabled -boolean controls, you must set -enabled_ctrls - to the appropriate bits to enable only the controls you want and disable all -others, then specify the -XkbControlsEnabledMask - in a call to -XkbSetControls -. Because this is somewhat awkward if all you want to do is enable and disable +Note that the +enabled_ctrls +field is itself a control — the +EnabledControls +control. As such, to set a specific configuration of enabled and disabled +boolean controls, you must set +enabled_ctrls +to the appropriate bits to enable only the controls you want and disable all +others, then specify the +XkbControlsEnabledMask +in a call to +XkbSetControls. +Because this is somewhat awkward if all you want to do is enable and disable controls, and not modify any of their attributes, a convenience function is -also provided for this purpose ( -XkbChangeEnabledControls -, section 10.1.1). +also provided for this purpose +(XkbChangeEnabledControls, +section 10.1.1). The XkbControlsChangesRec Structure + +XkbControlsChangesRec + -The -XkbControlsChangesRec - structure allows applications to track modifications to an -XkbControlsRec - structure and thereby reduce the amount of traffic sent to the server. The -same -XkbControlsChangesRec - structure may be used in several successive modifications to the same - -XkbControlsRec - structure, then subsequently used to cause all of the changes, and only the -changes, to be propagated to the server. The -XkbControlsChangesRec - structure is defined as follows: - +The +XkbControlsChangesRec +structure allows applications to track modifications to an +XkbControlsRec +structure and thereby reduce the amount of traffic sent to the server. The +same +XkbControlsChangesRec +structure may be used in several successive modifications to the same +XkbControlsRec +structure, then subsequently used to cause all of the changes, and only the +changes, to be propagated to the server. The +XkbControlsChangesRec +structure is defined as follows: - + typedef struct _XkbControlsChanges { - unsigned int changed_ctrls; /* bits indicating changed control data */ - unsigned int enabled_ctrls_changes; /* bits indicating enabled/disabled controls */ - Bool num_groups_changed; /* True if - number of keyboard groups changed */ -} XkbControlsChangesRec,*XkbControlsChangesPtr; + unsigned int changed_ctrls; /* bits indicating changed + control data */ + unsigned int enabled_ctrls_changes; /* bits indicating + enabled/disabled controls */ + Bool num_groups_changed; /* True if number of keyboard + groups changed */ +} XkbControlsChangesRec, *XkbControlsChangesPtr; -The -changed_ctrls - field is a mask specifying which logical sets of data in the controls -structure have been modified. In this context, modified means -set -, that is, if a value is set to the same value it previously contained, it has -still been modified, and is noted as changed. Valid values for -changed_ctrls - are any combination of the masks listed in Table 10.7 that have "ok" in the - -changed_ctrls - column. Setting a bit implies the corresponding data fields from the "Relevant -XkbControlsRec Data Fields" column in Table 10.6 have been modified. The - -enabled_ctrls_changes - field specifies which bits in the -enabled_ctrls - field have changed. If the number of keyboard groups has changed, the -num_groups_changed - field is set to True. +The +changed_ctrls +field is a mask specifying which logical sets of data in the controls +structure have been modified. In this context, modified means +set, +that is, if a value is set to the same value it previously contained, it has +still been modified, and is noted as changed. Valid values for +changed_ctrls +are any combination of the masks listed in +Table 10.7 that have ok in the +changed_ctrls +column. Setting a bit implies the corresponding data fields from the +Relevant XkbControlsRec Data Fields column in +Table 10.6 have been modified. The +enabled_ctrls_changes +field specifies which bits in the +enabled_ctrls +field have changed. If the number of keyboard groups has changed, the +num_groups_changed +field is set to True. If you have an Xkb description with controls that have been modified and an - -XkbControlsChangesRec - that describes the changes that have been made, the -XkbChangeControls - function provides a flexible method for updating the controls in a server to +XkbControlsChangesRec +that describes the changes that have been made, the +XkbChangeControls +function provides a flexible method for updating the controls in a server to match those in the changed keyboard description. - - - - - - - -Bool -XkbChangeControls -( -dpy, xkb, changes -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -XkbDescPtr -xkb -; /* keyboard description with changed -xkb->ctrls - */ - - - - -XkbControlsChangesPtr -changes -; /* which parts of -xkb->ctrls - have changed */ - - - - - - - - -XkbChangeControls - copies any controls fields specified by -changes - from the keyboard description controls structure, -xkb --> -ctrls -, to the server specified by -dpy -. +XkbChangeControls + + + Bool XkbChangeControls + + + Display *dpy + XkbDescPtr xkb + XkbControlsChangesPtr changes + + + + + + dpy + + + + connection to X server + + + + + + xkb + + + + keyboard description with changed xkb->ctrls + + + + + + changes + + + + which parts of xkb->ctrls have changed + + + + + + +XkbChangeControls +copies any controls fields specified by +changes +from the keyboard description controls structure, +xkb->ctrls, +to the server specified by +dpy. @@ -4743,313 +4732,313 @@ dpy Tracking Changes to Keyboard Controls + +eventsXkbControlsNotify + +XkbControlsNotifyEvent + Whenever a field in the controls structure changes in the server’s keyboard -description, the server sends an -XkbControlsNotify - event to all interested clients.To receive -XkbControlsNotify - events under all possible conditions, use -XkbSelectEvents - (see section 4.3) and pass -XkbControlsNotifyMask - in both -bits_to_change - and -values_for_bits -. +description, the server sends an +XkbControlsNotify +event to all interested clients.To receive +XkbControlsNotify +events under all possible conditions, use +XkbSelectEvents +(see section 4.3) and pass +XkbControlsNotifyMask +in both +bits_to_change +and +values_for_bits. -To receive -XkbControlsNotify - events only under certain conditions, use -XkbSelectEventDetails - using -XkbControlsNotify - as the -event_type - and specifying the desired state changes in -bits_to_change - and -values_for_bits - using mask bits from Table 10.7. +To receive +XkbControlsNotify +events only under certain conditions, use +XkbSelectEventDetails +using +XkbControlsNotify +as the +event_type +and specifying the desired state changes in +bits_to_change +and +values_for_bits +using mask bits from Table 10.7. -The structure for the -XkbControlsNotify - event is defined as follows: - +The structure for the +XkbControlsNotify +event is defined as follows: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbCompatMapNotify */ - int device; /* Xkb device ID, will not be XkbUseCoreKbd */ - unsigned int changed_ctrls; /* bits indicating which controls data have changed*/ - unsigned int enabled_ctrls; /* controls currently enabled in server */ - unsigned int enabled_ctrl_changes; /* bits indicating enabled/disabled controls */ - int num_groups; /* current number of keyboard groups */ - KeyCode keycode; /* != 0 => keycode of key causing change */ - char event_type; /* Type of event causing change */ - char req_major; /* major event code of event causing change */ - char req_minor; /* minor event code of event causing change */ -} XkbControlsNotifyEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbCompatMapNotify */ + int device; /* Xkb device ID, + will not be XkbUseCoreKbd */ + unsigned int changed_ctrls; /* bits indicating which controls + data have changed */ + unsigned int enabled_ctrls; /* controls currently enabled in server */ + unsigned int enabled_ctrl_changes; /* bits indicating + enabled/disabled controls */ + int num_groups; /* current number of keyboard groups */ + KeyCode keycode; /* != 0 ⇒ keycode of key causing change */ + char event_type; /* Type of event causing change */ + char req_major; /* major event code of event causing change */ + char req_minor; /* minor event code of event causing change */ +} XkbControlsNotifyEvent; -The -changed_ctrls - field specifies the controls components that have changed and consists of bits -taken from the masks defined in Table 10.7 with "ok" in the -changed_ctrls - column. +The +changed_ctrls +field specifies the controls components that have changed and consists of bits +taken from the masks defined in +Table 10.7 with ok in the +changed_ctrls +column. -The controls currently enabled in the server are reported in the -enabled_ctrls - field. If any controls were just enabled or disabled (that is, the contents of -the -enabled_ctrls - field changed), they are flagged in the -enabled_ctrl_changes - field. The valid bits for these fields are the masks listed in Table 10.7 with -"ok" in the -enabled_ctrls - column. The -num_groups - field reports the number of groups bound to the key belonging to the most +The controls currently enabled in the server are reported in the +enabled_ctrls +field. If any controls were just enabled or disabled (that is, the contents of +the +enabled_ctrls +field changed), they are flagged in the +enabled_ctrl_changes +field. The valid bits for these fields are the masks listed in +Table 10.7 with +ok in the +enabled_ctrls +column. The +num_groups +field reports the number of groups bound to the key belonging to the most number of groups and is automatically updated when the keyboard mapping changes. -If the change was caused by a request from a client, the -keycode - and -event_type - fields are set to -zero -and the -req_major - and -req_minor - fields identify the request. The -req_major - value is the same as the major extension opcode. Otherwise, -event_type - is set to the type of event that caused the change (one of -KeyPress -, -KeyRelease -, -DeviceKeyPress -, -DeviceKeyRelease -, -ButtonPress - or -ButtonRelease -), and -req_major - and -req_minor - are undefined. If -event_type - is -KeyPress -, -KeyRelease -, -DeviceKeyPress -, or -DeviceKeyRelease -, the -keycode - field is set to the key that caused the change. If -event_type - is -ButtonPress - or -ButtonRelease -, -keycode - contains the button number. - - - - -When a client receives an -XkbControlsNotify - event, it can note the changes in a changes structure using -XkbNoteControlsChanges -. - - - - - - - - - -void -XkbNoteControlsChanges -( -changes -, - new -, - wanted -) - - - - -XkbControlsChangesPtr - changes -; /* records changes indicated by new */ - - - - -XkbControlsNotifyEvent * - new -; /* tells which things have changed */ - - - - -unsigned int - wanted -; /* tells which parts of new to record in changes */ - - - - - - - -The -wanted - parameter is a bitwise inclusive OR of bits taken from the set of masks -specified in Table 10.7 with "ok" in the -changed_ctrls - column. -XkbNoteControlsChanges - copies any changes reported in -new - and specified in -wanted - into the changes record specified by -old -. - - - - -Use -XkbGetControlsChanges - to update a local copy of a keyboard description with the changes previously -noted by one or more calls to -XkbNoteControlsChanges. - - - - - - - - - - -Status -XkbGetControlsChanges -( -dpy -, - xkb -, - changes -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -XkbDescPtr -xkb -; /* -xkb->ctrls - will be updated */ - - - - -XkbNameChangesPtr -changes -; /* indicates which parts of -xkb->ctrls - to update */ - - - - - - - - -XkbGetControlsChanges - examines the -changes - parameter, queries the server for the necessary information, and copies the -results into the -xkb --> -ctrls - keyboard description. If the -ctrls - field of -xkb - is -NULL -, -XkbGetControlsChanges - allocates and initializes it. To free the -ctrls - field, use -XkbFreeControls - (see section 10.12). - - - - - -XkbGetControlsChanges - returns -Success - if successful and can generate -BadAlloc -, -BadImplementation, - and -BadMatch - errors. +If the change was caused by a request from a client, the +keycode +and +event_type +fields are set to +zero +and the +req_major +and +req_minor +fields identify the request. The +req_major +value is the same as the major extension opcode. Otherwise, +event_type +is set to the type of event that caused the change (one of +KeyPress, +KeyRelease, +DeviceKeyPress, +DeviceKeyRelease, +ButtonPress +or +ButtonRelease), +and +req_major +and +req_minor +are undefined. If +event_type +is +KeyPress, +KeyRelease, +DeviceKeyPress, +or +DeviceKeyRelease, +the +keycode +field is set to the key that caused the change. If +event_type +is +ButtonPress +or +ButtonRelease, +keycode +contains the button number. + + + + +When a client receives an +XkbControlsNotify +event, it can note the changes in a changes structure using +XkbNoteControlsChanges. + + +XkbNoteControlsChanges + + + void XkbNoteControlsChanges + + + XkbControlsChangesPtr changes + XkbControlsNotifyEvent *new + unsigned int wanted + + + + + + changes + + + + records changes indicated by new + + + + + + new + + + + tells which things have changed + + + + + + wanted + + + + tells which parts of new to record in changes + + + + + + +The +wanted +parameter is a bitwise inclusive OR of bits taken from the set of masks +specified in Table 10.7 with ok +in the +changed_ctrls +column. +XkbNoteControlsChanges +copies any changes reported in +new +and specified in +wanted +into the changes record specified by +changes. + + + + +Use +XkbGetControlsChanges +to update a local copy of a keyboard description with the changes previously +noted by one or more calls to +XkbNoteControlsChanges. + + + +XkbGetControlsChanges + + + Status XkbGetControlsChanges + + + Display *dpy + XkbDescPtr xkb + XkbNameChangesPtr changes + + + + + + dpy + + + + connection to X server + + + + + + xkb + + + + xkb->ctrls will be updated + + + + + + changes + + + + indicates which parts of xkb->ctrls to update + + + + + + +XkbGetControlsChanges +examines the +changes +parameter, queries the server for the necessary information, and copies the +results into the +xkb->ctrls +keyboard description. If the +ctrls +field of +xkb +is +NULL, +XkbGetControlsChanges +allocates and initializes it. To free the +ctrls +field, use +XkbFreeControls +(see section 10.12). + + + + +XkbGetControlsChanges +returns +Success +if successful and can generate +BadAlloc, +BadImplementation, +and +BadMatch +errors. @@ -5058,190 +5047,188 @@ BadMatchAllocating and Freeing an XkbControlsRec -The need to allocate an -XkbControlsRec - structure seldom arises; Xkb creates one when an application calls -XkbGetControls - or a related function. For those situations where there is not an -XkbControlsRec - structure allocated in the -XkbDescRec -, allocate one by calling -XkbAllocControls -. - - - - - - - - - -Status -XkbAllocControls -( -xkb, which -) - - - - -XkbDescPtr - xkb -; /* Xkb description in which to allocate ctrls rec */ - - - - -unsigned int - which -; /* mask of components of -ctrls - to allocate */ - - - - - - - - -XkbAllocControls - allocates the -ctrls - field of the -xkb - parameter, initializes all fields to zero, and returns -Success -. If the -ctrls - field is not -NULL -, -XkbAllocControls - simply returns -Success -. If -xkb - is -NULL -, -XkbAllocControls - reports a -BadMatch - error. If the -ctrls - field could not be allocated, it reports a -BadAlloc - error. - - - - -The -which - mask specifies the individual fields of the -ctrls - structure to be allocated and can contain any of the valid masks defined in -Table 10.7. Because none of the currently existing controls have any structures +The need to allocate an +XkbControlsRec +structure seldom arises; Xkb creates one when an application calls +XkbGetControls +or a related function. For those situations where there is not an +XkbControlsRec +structure allocated in the +XkbDescRec, +allocate one by calling +XkbAllocControls. + + +XkbAllocControls + + + Status XkbAllocControls + + + XkbDescPtr xkb + unsigned int which + + + + + + xkb + + + + Xkb description in which to allocate ctrls rec + + + + + + which + + + + mask of components of ctrls to allocate + + + + + + +XkbAllocControls +allocates the +ctrls +field of the +xkb +parameter, initializes all fields to zero, and returns +Success. +If the +ctrls +field is not +NULL, +XkbAllocControls +simply returns +Success. +If +xkb +is +NULL, +XkbAllocControls +reports a +BadMatch +error. If the +ctrls +field could not be allocated, it reports a +BadAlloc +error. + + + + +The +which +mask specifies the individual fields of the +ctrls +structure to be allocated and can contain any of the valid masks defined in +Table 10.7. +Because none of the currently existing controls have any structures associated with them, which is currently of little practical value in this call. -To free memory used by the -ctrls - member of an -XkbDescRec -structure, use -XkbFreeControls: - - - - - - - - - - -void -XkbFreeControls -( -xkb, which, free_all -) - - - - -XkbDescPtr - xkb -; /* Xkb description in which to free controls components */ - - - - -unsigned int -which -; /* mask of components of -ctrls - to free */ - - - - -Bool -free_all -; /* -True - => free everything + ctrls itself */ - - - - - - - - -XkbFreeControls - frees the specified components of the -ctrls - field in the -xkb - keyboard description and sets the corresponding structure component values to - -NULL - or -zero -. The -which - mask specifies the fields of -ctrls - to be freed and can contain any of the controls components specified in Table -10.7. - - - - -If -free_all - is -True -, -XkbFreeControls - frees every non- -NULL - structure component in the controls, frees the -XkbControlsRec - structure referenced by the -ctrls - member of -xkb -, and sets -ctrls - to -NULL. +To free memory used by the +ctrls +member of an +XkbDescRec +structure, use +XkbFreeControls: + + + +XkbFreeControls + + + void XkbFreeControls + + + XkbDescPtr xkb + unsigned int which + Bool free_all + + + + + + xkb + + + + Xkb description in which to free controls components + + + + + + which + + + + mask of components of ctrls to free + + + + + + free_all + + + + True ⇒ free everything + ctrls itself + + + + + + +XkbFreeControls +frees the specified components of the +ctrls +field in the +xkb +keyboard description and sets the corresponding structure component values to +NULL +or +zero. +The +which +mask specifies the fields of +ctrls +to be freed and can contain any of the controls components specified in +Table 10.7. + + + + +If +free_all +is +True, +XkbFreeControls +frees every non- +NULL +structure component in the controls, frees the +XkbControlsRec +structure referenced by the +ctrls +member of +xkb, +and sets +ctrls +to +NULL. @@ -5250,136 +5237,146 @@ NULL. You can configure the boolean per-client controls which affect the state -reported in button and key events. See section 12.1.1, 12.3, 12.5, and 16.3.11 -of the XKB Protocol specification for more details. - - - - -To get the current values of the -per-client - controls, use -XkbGetPerClientControls -. - - - - - - - - - -Bool -XkbGetPerClientControls -( -dpy -, -ctrls -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -unsigned int * -ctrls -; /* 1 bit => corresponding control is on */ - - - - - - - - -XkbGetPerClientControls - backfills -ctrls - with the -per-client -control attributes for this particular client. It returns -True - if successful, and -False - otherwise. - - - - -To change the current values of the -per-client - control attributes, use -XkbSetPerClientControls. - - - - - - - - - - -Bool -XkbSetPerClientControls -( -dpy -, -ctrls -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -unsigned int -change -; /* 1 bit => change control */ - - - - -unsigned int * -value -; /* 1 bit => control on */ - - - - - - - - -XkbSetPerClientControls changes the per-client values for the controls selected -by - -change to the corresponding value in value. Legal values for change and value +reported in button and key events. See +section 12.1.1, +12.3, +12.5, +and +16.3.11 +of the +XKB Protocol specification +for more details. + + + + +To get the current values of the +per-client +controls, use +XkbGetPerClientControls. + + +XkbGetPerClientControls + + + Bool XkbGetPerClientControls + + + Display *dpy + unsigned int *ctrls + + + + + + dpy + + + + connection to X server + + + + + + ctrls + + + + 1 bit ⇒ corresponding control is on + + + + + + +XkbGetPerClientControls +backfills +ctrls +with the +per-client +control attributes for this particular client. It returns +True +if successful, and +False +otherwise. + + + + +To change the current values of the +per-client +control attributes, use +XkbSetPerClientControls. + + + +XkbSetPerClientControls + + + Bool XkbSetPerClientControls + + + Display *dpy + unsigned int change + unsigned int *value + + + + + + dpy + + + + connection to X server + + + + + + change + + + + 1 bit ⇒ change control + + + + + + value + + + + 1 bit ⇒ control on + + + + + + +XkbSetPerClientControls +changes the per-client values for the controls selected by +change to the corresponding value in +value. Legal values for +change and value are: XkbPCF_GrabsUseXKBStateMask, XkbPCF_LookupStateWhenGrabbed, and XkbPCF_SendEventUsesXKBState. More than one control may be changed at one time by OR-ing the values together. XkbSetPerClientControls backfills value with the - - -per-client - -control attributes for this particular client. -It returns -True - if successful, and -False - otherwise. +per-client +control attributes for this particular client. +It returns +True +if successful, and +False +otherwise. diff --git a/libX11/specs/XKB/ch11.xml b/libX11/specs/XKB/ch11.xml index 52f089775..6463878b6 100644 --- a/libX11/specs/XKB/ch11.xml +++ b/libX11/specs/XKB/ch11.xml @@ -1,13 +1,20 @@ + + X Library Controls The Xkb extension is composed of two parts: a server extension, and a -client-side X library extension. Chapter 10 discusses functions used to modify +client-side X library extension. discusses functions used to modify controls affecting the behavior of the server portion of the Xkb extension. This chapter discusses functions used to modify controls that affect only the behavior of the client portion of the extension; these controls are known as -Library Controls. +Library Controls. + +library controls + +controlslibrary @@ -35,9 +42,11 @@ Controls affecting event delivery -There are two types of string lookups performed by -XLookupString -. The first type involves translating a single keycode into a string; the +There are two types of string lookups performed by +XLookupString. + +XLookupString +The first type involves translating a single keycode into a string; the controls in the first category affect this type of lookup. The second type involves translating a series of keysyms into a string; the controls in the second category affect this type of lookup. @@ -57,33 +66,33 @@ enabled may be missing. Controls Affecting Keycode-to-String Translation -The first type of string lookups, which are here called -simple string lookups -, involves translating a single keycode into a string. Because these simple +The first type of string lookups, which are here called +simple string lookups, +involves translating a single keycode into a string. Because these simple lookups involve only a single keycode, all of the information needed to do the translation is contained in the keyboard state in a single event. The controls affecting simple string lookups are: - - - ForceLatin1Lookup - ConsumeLookupMods - LevelOneUsesShiftAndLock - + + ForceLatin1Lookup + ConsumeLookupMods + LevelOneUsesShiftAndLock + + ForceLatin1Lookup -If the -ForceLatin1Lookup - control is enabled, -XLookupString - only returns strings using the Latin1 character set. If -ForceLatin1Lookup - is not enabled, -XLookupString - can return characters that are not in the Latin1 set. By default, this control +If the +ForceLatin1Lookup +control is enabled, +XLookupString +only returns strings using the Latin1 character set. If +ForceLatin1Lookup +is not enabled, +XLookupString +can return characters that are not in the Latin1 set. By default, this control is disabled, allowing characters outside of the Latin1 set to be returned. @@ -93,9 +102,9 @@ is disabled, allowing characters outside of the Latin1 set to be returned. ConsumeLookupMods -Simple string lookups in -XLookupString - involve two different translation phases. The first phase translates raw +Simple string lookups in +XLookupString +involve two different translation phases. The first phase translates raw device keycodes to individual keysyms. The second phase attempts to map the resulting keysym into a string of one or more characters. In the first phase, some of the modifiers are normally used to determine the appropriate shift @@ -104,64 +113,62 @@ level for a key. -The -ConsumeLookupMods - control determines whether or not -XLookupString - -consumes - the modifiers it uses during the first phase of processing (mapping a keycode +The +ConsumeLookupMods +control determines whether or not +XLookupString +consumes +the modifiers it uses during the first phase of processing (mapping a keycode to a keysym). When a modifier is consumed, it is effectively removed from the -working copy of the keyboard state information -XLookupString - is using and appears to be unset for the remainder of the processing. +working copy of the keyboard state information +XLookupString +is using and appears to be unset for the remainder of the processing. -If the -ConsumeLookupMods - control is enabled, -XLookupString - does not use the modifiers used to translate the keycode of the event to a +If the +ConsumeLookupMods +control is enabled, +XLookupString +does not use the modifiers used to translate the keycode of the event to a keysym when it is determining the string associated with a keysym. For example, assume the keymap for the ‘A’ key only contains the shift modifier and the - -ConsumeLookupMods - control is enabled. If a user presses the -Shift - key and the -A - key while the -Num_Lock - key is locked, -XLookupString - uses the -Shift - modifier when mapping the keycode for the ‘a’ key to the keysym for -‘A’; subsequently, it only uses the -NumLock - modifier when determining the string associated with the keysym ‘A’. +ConsumeLookupMods +control is enabled. If a user presses the +Shift +key and the +A +key while the +Num_Lock +key is locked, +XLookupString +uses the +Shift +modifier when mapping the keycode for the ‘a’ key to the keysym for +‘A’; subsequently, it only uses the +NumLock +modifier when determining the string associated with the keysym ‘A’. -If the -ConsumeLookupMods - control is not enabled, -XLookupString - uses all of the event modifiers to determine the string associated with a -keysym. This behavior mirrors the behavior of -XLookupString - in the core implementation. +If the +ConsumeLookupMods +control is not enabled, +XLookupString +uses all of the event modifiers to determine the string associated with a +keysym. This behavior mirrors the behavior of +XLookupString +in the core implementation. -The -ConsumeLookupMods - control is unset by default. For more information on modifier consumption, -refer to Chapter 12. +The +ConsumeLookupMods +control is unset by default. For more information on modifier consumption, +refer to . @@ -170,18 +177,18 @@ refer to Chapter 12. AlwaysConsumeShiftAndLock -The -AlwaysConsumeShiftAndLock - control, if enabled, forces -XLookupString - to consume the -Shift - and -Lock - modifiers when processing all keys, even if the definition for the key type -does not specify these modifiers. The -AlwaysConsumeShiftAndLock - control is unset by default. See section 15.2 for a discussion of key types. +The +AlwaysConsumeShiftAndLock +control, if enabled, forces +XLookupString +to consume the +Shift +and +Lock +modifiers when processing all keys, even if the definition for the key type +does not specify these modifiers. The +AlwaysConsumeShiftAndLock +control is unset by default. See section 15.2 for a discussion of key types. @@ -191,23 +198,25 @@ AlwaysConsumeShiftAndLock Controls Affecting Compose Processing -The second type of string lookup performed by -XLookupString - involves translating a series of keysyms into a string. Because these lookups -can involve more than one key event, they require -XLookupString - to retain some state information between successive calls. The process of -mapping a series of keysyms to a string is known as -compose processing -. The controls affecting compose processing are: +The second type of string lookup performed by +XLookupString +involves translating a series of keysyms into a string. Because these lookups +can involve more than one key event, they require +XLookupString +to retain some state information between successive calls. The process of +mapping a series of keysyms to a string is known as +compose processing. + +compose processing +The controls affecting compose processing are: + + + ConsumeKeysOnComposeFail + ComposeLED + BeepOnComposeFail + - -ConsumeKeysOnComposeFail -ComposeLED -BeepOnComposeFail - - Because different vendors have historically used different algorithms to implement compose processing, and these algorithms may be incompatible with the @@ -221,36 +230,36 @@ the compose processing controls is optional in an Xkb implementation. Some compose processing algorithms signal the start of a compose sequence by a -key event meaning "start compose". +key event meaning start compose. Another possibility is to have the compose processing simply be the result of a finite state acceptor; a compose sequence would never fail for a properly written finite state acceptor. The subsequent key events should normally result in a valid composition yielding a valid translation to a string. If the subsequent key events do not have a valid translation, some decision must be made about what to do with the key events -that were processed while attempting the compose. The -ConsumeKeysOnComposeFail - control allows a client to specify what happens with the key events -XLookupString - has been considering when it reaches a dead end in a compose sequence. +that were processed while attempting the compose. The +ConsumeKeysOnComposeFail +control allows a client to specify what happens with the key events +XLookupString +has been considering when it reaches a dead end in a compose sequence. -If the -ConsumeKeysOnComposeFail - control is set, all keys associated with a failed compose sequence should be -consumed (discarded). If the -ConsumeKeysOnComposeFail - control is not set, the key events associated with a failed compose sequence +If the +ConsumeKeysOnComposeFail +control is set, all keys associated with a failed compose sequence should be +consumed (discarded). If the +ConsumeKeysOnComposeFail +control is not set, the key events associated with a failed compose sequence should be processed as a normal sequence of key events. -The -ConsumeKeysOnComposeFail - control is disabled by default. +The +ConsumeKeysOnComposeFail +control is disabled by default. @@ -259,30 +268,28 @@ ConsumeKeysOnComposeFail ComposeLED -The -ComposeLED - control allows a client to specify whether or not an indicator should be set +The +ComposeLED +control allows a client to specify whether or not an indicator should be set and cleared to provide feedback when compose processing is in progress. The control does not specify which indicator should be used; the mapping for this -is up to the individual implementation. If the -ComposeLED - control is enabled, it specifies that an indicator should be set when a +is up to the individual implementation. If the +ComposeLED +control is enabled, it specifies that an indicator should be set when a compose sequence is in progress and cleared when one is not in progress. The - -ComposeLED - control is disabled by default. +ComposeLED +control is disabled by default. While the Xkb extension does not specify the type of type of indicator to be -used when the -ComposeLED - control is implemented, a consistent convention between implementations is to +used when the +ComposeLED +control is implemented, a consistent convention between implementations is to everyone’s benefit. If a named indicator is used for this purpose, the -recommended name is " -Compose -". Note that some implementations may use an unnamed, custom hardware LED for +recommended name is “Compose”. +Note that some implementations may use an unnamed, custom hardware LED for this purpose. @@ -292,34 +299,30 @@ this purpose. BeepOnComposeFail -The -BeepOnComposeFail - control allows a client to specify whether or not a bell should be activated +The +BeepOnComposeFail +control allows a client to specify whether or not a bell should be activated to provide feedback when a compose sequence fails. The control does not specify the type of bell that should be used; the mapping for this is up to the -individual implementation. If the -BeepOnComposeFail - control is enabled, it specifies that a bell should be activated when a -compose sequence fails. The -BeepOnComposeFail - control is disabled by default. If implemented, the bell should be activated -using -XkbBell - or -XkbDeviceBell -. +individual implementation. If the +BeepOnComposeFail +control is enabled, it specifies that a bell should be activated when a +compose sequence fails. The +BeepOnComposeFail +control is disabled by default. If implemented, the bell should be activated +using +XkbBell +or +XkbDeviceBell. While the Xkb extension does not specify the type of bell to be used when the - -BeepOnComposeFail - control is implemented, a consistent convention between implementations is to +BeepOnComposeFail +control is implemented, a consistent convention between implementations is to everyone’s benefit. If a named bell is used for this purpose, the recommended -name is " -ComposeFail -". +name is “ComposeFail”. @@ -331,31 +334,36 @@ ComposeFail IgnoreNewKeyboards + +eventsNewKeyboardNotify + +eventsMappingNotify + -When Xkb is initialized, it implicitly forces requests for -NewKeyboardNotify - events. These events may be used by the Xkb library extension internally; they -are normally translated into core protocol -MappingNotify - events before being passed to the client. While delivering the event to the +When Xkb is initialized, it implicitly forces requests for +NewKeyboardNotify +events. These events may be used by the Xkb library extension internally; they +are normally translated into core protocol +MappingNotify +events before being passed to the client. While delivering the event to the client is appropriate in most cases, it is not appropriate for some clients that maintain per-key data structures. This is because once the server has sent -a -NewKeyboardNotify - event, it is free to send the client events for all keys in the new range and +a +NewKeyboardNotify +event, it is free to send the client events for all keys in the new range and that range may be outside of the per-key data structures the client is maintaining. -The -IgnoreNewKeyboards - control, if enabled, prevents Xkb from mapping -NewKeyboardNotify - events to core -MappingNotify - events and passing them to the client. The control is initially disabled. +The +IgnoreNewKeyboards +control, if enabled, prevents Xkb from mapping +NewKeyboardNotify +events to core +MappingNotify +events and passing them to the client. The control is initially disabled. @@ -367,10 +375,10 @@ MappingNotify The Library Controls are manipulated using functions that deal with bitmasks to indicate which controls to manipulate. The controls are identified by the masks -defined in Table 11.1. +defined in Table 11.1. -
+
Library Control Masks @@ -384,35 +392,35 @@ defined in Table 11.1. - XkbLC_ForceLatin1Lookup + XkbLC_ForceLatin1Lookup (1 << 0) - XkbLC_ConsumeLookupMods + XkbLC_ConsumeLookupMods (1 << 1) - XkbLC_AlwaysConsumeShiftAndLock + XkbLC_AlwaysConsumeShiftAndLock (1 << 2) - XkbLC_IgnoreNewKeyboards + XkbLC_IgnoreNewKeyboards (1 << 3) - XkbLC_ConsumeKeysOnComposeFail + XkbLC_ConsumeKeysOnComposeFail (1 << 29) - XkbLC_ComposeLED + XkbLC_ComposeLED (1 << 30) - XkbLC_BeepOnComposeFail + XkbLC_BeepOnComposeFail (1 << 31) - XkbLC_AllControls + XkbLC_AllControls (0xc0000007) @@ -424,39 +432,38 @@ defined in Table 11.1. To determine which Library Controls are actually -implemented, use XkbXlibControlsImplemented. +implemented, use XkbXlibControlsImplemented. - - - - - - - -unsigned int -XkbXlibControlsImplemented -( -display -) - - - - -Display * - display -; /* connection to X server */ - - - - - +XkbXlibControlsImplemented + + + unsigned int XkbXlibControlsImplemented + + + Display *display + + + + + + display + + + + connection to X server + + + + - -XkbXlibControlsImplemented - returns a bitmask indicating the controls actually implemented in the Xkb -library and is composed of an inclusive OR of bits from Table 11.1. +XkbXlibControlsImplemented +returns a bitmask indicating the controls actually implemented in the Xkb +library and is composed of an inclusive OR of bits from +Table 11.1. @@ -465,41 +472,39 @@ library and is composed of an inclusive OR of bits from Table 11.1. Determining the State of the Library Controls -To determine the current state of the Library Controls, use -XkbGetXlibControls -. +To determine the current state of the Library Controls, use +XkbGetXlibControls. - - - - - - - -unsigned int -XkbGetXlibControls -( -display -) - - - - -Display * - display -; /* connection to X server */ - - - - - +XkbGetXlibControls + + + unsigned int XkbGetXlibControls + + + Display *display + + + + + + display + + + + connection to X server + + + + - -XkbGetXlibControls - returns the current state of the Library Controls as a bit mask that is an -inclusive OR of the control masks from Table 11.1 for the controls that are +XkbGetXlibControls +returns the current state of the Library Controls as a bit mask that is an +inclusive OR of the control masks from +Table 11.1 for the controls that are enabled. For the optional compose processing controls, the fact that a control is enabled does not imply that it is actually implemented. @@ -510,65 +515,72 @@ is enabled does not imply that it is actually implemented. To change the state of the Library Controls, use -XkbSetXlibControls. +XkbSetXlibControls. - - - - - - - -Bool -XkbSetXlibControls -( -display, bits_to_change, values_for_bits -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned long -bits_to_change -; /* selects controls to be modified */ - - - - -unsigned long -values_for_bits -; /* turns selected controls on (1) or off (0) */ - - - - - +XkbSetXlibControls + + + Bool XkbSetXlibControls + + + Display *display + unsigned long bits_to_change + unsigned long values_for_bits + + + + + + display + + + + connection to X server + + + + + + bits_to_change + + + + selects controls to be modified + + + + + + values_for_bits + + + + turns selected controls on (1) or off (0) + + + + - -XkbSetXlibControls - modifies the state of the controls selected by -bits_to_change -; only the controls selected by -bits_to_change - are modified. If the bit corresponding to a control is on in -bits_to_change - and also on in values_for_bits, the control is enabled. If the bit -corresponding to a control is on in -bits_to_change - but off in -values_for_bits -, the control is disabled. -bits_to_change - should be an inclusive OR of bits from Table 11.1. +XkbSetXlibControls +modifies the state of the controls selected by +bits_to_change; +only the controls selected by +bits_to_change +are modified. If the bit corresponding to a control is on in +bits_to_change +and also on in values_for_bits, the control is enabled. If the bit +corresponding to a control is on in +bits_to_change +but off in +values_for_bits, +the control is disabled. +bits_to_change +should be an inclusive OR of bits from +Table 11.1. diff --git a/libX11/specs/XKB/ch12.xml b/libX11/specs/XKB/ch12.xml index 1a062014e..fcfa8f9f2 100644 --- a/libX11/specs/XKB/ch12.xml +++ b/libX11/specs/XKB/ch12.xml @@ -1,3 +1,6 @@ + + Interpreting Key Events @@ -11,12 +14,12 @@ several core X library functions. Effects of Xkb on the Core X Library -When support for Xkb is built into the X library, the -XOpenDisplay - function looks for a compatible version of Xkb on the server. If it finds a -compatible version, it initializes the extension and enables -implicit support - for Xkb in a number of X library functions. This makes it possible for clients +When support for Xkb is built into the X library, the +XOpenDisplay +function looks for a compatible version of Xkb on the server. If it finds a +compatible version, it initializes the extension and enables +implicit support +for Xkb in a number of X library functions. This makes it possible for clients to take advantage of nearly all Xkb features without having to be rewritten or even recompiled, if they are built with shared libraries. This implicit support is invisible to most clients, but it can have side effects, so the extension @@ -28,10 +31,10 @@ includes ways to control or disable it. Effects of Xkb on Event State -Because -XOpenDisplay - initializes Xkb, some events contain an Xkb description of the keyboard state -instead of that normally used by the core protocol. See section 17.1.1 for more +Because +XOpenDisplay +initializes Xkb, some events contain an Xkb description of the keyboard state +instead of that normally used by the core protocol. See section 17.1.1 for more information about the differences between Xkb keyboard state and that reported by the core protocol. @@ -41,50 +44,53 @@ by the core protocol. Effects of Xkb on MappingNotify Events + +eventsMappingNotify + When Xkb is missing or disabled, the X library tracks changes to the keyboard -mapping using -MappingNotify - events. Whenever the keyboard mapping is changed, the server sends all clients -a -MappingNotify - event to report the change. When a client receives a -MappingNotify - event, it is supposed to call -XRefreshKeyboardMapping - to update the keyboard description used internally by the X library. +mapping using +MappingNotify +events. Whenever the keyboard mapping is changed, the server sends all clients +a +MappingNotify +event to report the change. When a client receives a +MappingNotify +event, it is supposed to call +XRefreshKeyboardMapping +to update the keyboard description used internally by the X library. -The X Keyboard Extension uses -XkbMapNotify - and -XkbNewKeyboardNotify - events to track changes to the keyboard mapping. When an Xkb-aware client -receives either event, it should call -XkbRefreshKeyboardMapping - to update the keyboard description used internally by the X library. To avoid -duplicate events, the X server does not send core protocol -MappingNotify - events to a client that has selected for -XkbMapNotify - events. +The X Keyboard Extension uses +XkbMapNotify +and +XkbNewKeyboardNotify +events to track changes to the keyboard mapping. When an Xkb-aware client +receives either event, it should call +XkbRefreshKeyboardMapping +to update the keyboard description used internally by the X library. To avoid +duplicate events, the X server does not send core protocol +MappingNotify +events to a client that has selected for +XkbMapNotify +events. -The implicit support for Xkb selects for -XkbMapNotify - events. This means that clients that do not explicitly use Xkb but that are +The implicit support for Xkb selects for +XkbMapNotify +events. This means that clients that do not explicitly use Xkb but that are using a version of the X library that has implicit support for Xkb do not -receive -MappingNotify - events over the wire. Clients that were not written with Xkb in mind do not +receive +MappingNotify +events over the wire. Clients that were not written with Xkb in mind do not recognize or properly handle the new Xkb events, so the implicit support -converts them to -MappingNotify - events that report approximately the same information, unless the client has +converts them to +MappingNotify +events that report approximately the same information, unless the client has explicitly selected for the Xkb version of the event. @@ -92,21 +98,20 @@ explicitly selected for the Xkb version of the event. An Xkb-capable X server does not send events from keys that fall outside the legal range of keycodes expected by that client. Once the server sends a client -an -XkbNewKeyboardNotify - event, it reports events from all keys because it assumes that any client that -has receieved an -XkbNewKeyboardNotify - event expects key events from the new range of keycodes. The implicit support -for Xkb asks for -XkbNewKeyboardNotify - events, so the range of keycodes reported to the client might vary without the +an +XkbNewKeyboardNotify +event, it reports events from all keys because it assumes that any client that +has received an +XkbNewKeyboardNotify +event expects key events from the new range of keycodes. The implicit support +for Xkb asks for +XkbNewKeyboardNotify +events, so the range of keycodes reported to the client might vary without the client’s knowledge. Most clients don’t really care about the range of legal keycodes, but some clients maintain information about each key and might have problems with events that come from unexpected keys. Such clients can set the - -XkbLC_IgnoreNewKeyboards - library control (see section 11.3.1) to prevent the implicit support from +XkbLC_IgnoreNewKeyboards +library control (see section 11.3.1) to prevent the implicit support from requesting notification of changes to the legal range of keycodes. @@ -117,16 +122,16 @@ requesting notification of changes to the legal range of keycodes. The following X library functions are modified by Xkb: - - - XKeycodeToKeysym - XKeysymToKeycode - XLookupKeysym - XLookupString - XRefreshKeyboardMapping - XRebindKeysym - + + XKeycodeToKeysym + XKeysymToKeycode + XLookupKeysym + XLookupString + XRefreshKeyboardMapping + XRebindKeysym + + The implicit support for Xkb replaces a number of X library functions with @@ -138,23 +143,25 @@ clients. - -The -XKeycodeToKeysym - function reports the keysym associated with a particular index for a single + +The +XKeycodeToKeysym +XKeycodeToKeysym +function reports the keysym associated with a particular index for a single key. The index specifies a column of symbols in the core keyboard mapping (that -is, as reported by the core protocol -GetKeyboardMapping - request). The order of the symbols in the core mapping does not necessarily -correspond to the order of the symbols used by Xkb; section 17.1.3 describes +is, as reported by the core protocol +GetKeyboardMapping +request). The order of the symbols in the core mapping does not necessarily +correspond to the order of the symbols used by Xkb; section 17.1.3 describes the differences. - -The -XKeysymToKeycode - function reports a keycode to which a particular keysym is bound. When Xkb is + +The +XKeysymToKeycode +XKeysymToKeycode +function reports a keycode to which a particular keysym is bound. When Xkb is missing or disabled, this function looks in each column of the core keyboard mapping in turn and returns the lowest numbered key that matches in the lowest numbered group. When Xkb is present, this function uses the Xkb ordering for @@ -162,65 +169,67 @@ symbols instead. - -The -XLookupKeysym - function reports the symbol in a specific column of the key associated with an + +The +XLookupKeysym +XLookupKeysym +function reports the symbol in a specific column of the key associated with an event. Whether or not Xkb is present, the column specifies an index into the core symbol mapping. - -The -XLookupString - function reports the symbol and string associated with a key event, taking + +The +XLookupString +XLookupString +function reports the symbol and string associated with a key event, taking into account the keycode and keyboard state as reported in the event. When Xkb -is disabled or missing, -XLookupString - uses the rules specified by the core protocol and reports only ISO Latin-1 -characters. When Xkb is present, -XLookupString - uses the explicit keyboard group, key types, and rules specified by Xkb. When -Xkb is present, -XLookupString - is allowed, but not required, to return strings in character sets other than +is disabled or missing, +XLookupString +uses the rules specified by the core protocol and reports only ISO Latin-1 +characters. When Xkb is present, +XLookupString +uses the explicit keyboard group, key types, and rules specified by Xkb. When +Xkb is present, +XLookupString +is allowed, but not required, to return strings in character sets other than ISO Latin-1, depending on the current locale. If any key bindings are defined, - -XLookupString - does not use any consumed modifiers (see sections 11.1.2 and 15.2) to +XLookupString +does not use any consumed modifiers (see section 11.1.2 and section 15.2) to determine matching bindings. - -The -XRefreshKeyboardMapping - function updates the X library’s internal representation of the keyboard to -reflect changes reported via -MappingNotify - events. When Xkb is missing or disabled, this function reloads the entire + +The +XRefreshKeyboardMapping +XRefreshKeyboardMapping +function updates the X library’s internal representation of the keyboard to +reflect changes reported via +MappingNotify +events. When Xkb is missing or disabled, this function reloads the entire modifier map or keyboard mapping. When Xkb is present, the implicit Xkb support -keeps track of the changed components reported by each -XkbMapNotify - event and updates only those pieces of the keyboard description that have +keeps track of the changed components reported by each +XkbMapNotify +event and updates only those pieces of the keyboard description that have changed. If the implicit support has not noted any keyboard mapping changes, - -XRefreshKeyboardMapping - updates the entire keyboard description. +XRefreshKeyboardMapping +updates the entire keyboard description. - -The -XRebindKeysym - function associates a string with a keysym and a set of modifiers. Xkb does + +The +XRebindKeysym +XRebindKeysym +function associates a string with a keysym and a set of modifiers. Xkb does not directly change this function, but it does affect the way that the state -reported in the event is compared to the state specified to -XRebindKeysym -. When Xkb is missing or disabled, -XLookupString - returns the specified string if the modifiers in the event exactly match the +reported in the event is compared to the state specified to +XRebindKeysym. +When Xkb is missing or disabled, +XLookupString +returns the specified string if the modifiers in the event exactly match the modifiers from this call. When Xkb is present, any modifiers used to determine the keysym are consumed and are not used to look up the string. @@ -233,616 +242,645 @@ the keysym are consumed and are not used to look up the string. To find the keysym bound to a particular key at a specified group and shift -level, use XkbKeycodeToKeysym. +level, use XkbKeycodeToKeysym. - - - - - - - -KeySym -XkbKeycodeToKeysym -( -dpy, kc, group, level -) - - - - -Display * dpy; /* connection to X server */ - - - - -KeyCode kc; /* key of interest */ - - - - -unsigned int group; /* group of interest */ - - - - -unsigned int level; /* shift level of interest */ - - - - - +XkbKeycodeToKeysym + + + KeySym XkbKeycodeToKeysym + + + Display *dpy + KeyCode kc + unsigned int group + unsigned int level + + + + + + dpy + + + + connection to X server + + + + + + kc + + + + key of interest + + + + + + group + + + + group of interest + + + + + + level + + + + shift level of interest + + + + - -XkbKeycodeToKeysym - returns the keysym bound to a particular group and shift level for a -particular key on the core keyboard. If -kc - is not a legal keycode for the core keyboard, or if -group - or -level - are out of range for the specified key, -XkbKeycodeToKeysym - returns -NoSymbol -. +XkbKeycodeToKeysym +returns the keysym bound to a particular group and shift level for a +particular key on the core keyboard. If +kc +is not a legal keycode for the core keyboard, or if +group +or +level +are out of range for the specified key, +XkbKeycodeToKeysym +returns +NoSymbol. To find the set of modifiers bound to a particular keysym on the core keyboard, -use -XkbKeysymToModifiers -. +use +XkbKeysymToModifiers. - - - - - - - -unsigned - -int -XkbKeysymToModifiers -( -dpy -, - ks -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -KeySym - ks -; /* keysym of interest */ - - - - - +XkbKeysymToModifiers + + + unsigned int XkbKeysymToModifiers + + + Display *dpy + KeySym ks + + + + + + dpy + + + + connection to X server + + + + + + ks + + + + keysym of interest + + + + - -XkbKeysymToModifiers - finds the set of modifiers currently bound to the keysym -ks - on the core keyboard. The value returned is the mask of modifiers bound to the -keysym -ks -. If no modifiers are bound to the keysym, -XkbKeysymToModifiers - returns zero; otherwise, it returns the inclusive OR of zero or more of the -following: -ShiftMask -, -ControlMask -, -LockMask -, -Mod1Mask -, -Mod2Mask -, -Mod3Mask -, -Mod4Mask, - and -Mod5Mask -. +XkbKeysymToModifiers +finds the set of modifiers currently bound to the keysym +ks +on the core keyboard. The value returned is the mask of modifiers bound to the +keysym +ks. +If no modifiers are bound to the keysym, +XkbKeysymToModifiers +returns zero; otherwise, it returns the inclusive OR of zero or more of the +following: +ShiftMask, +ControlMask, +LockMask, +Mod1Mask, +Mod2Mask, +Mod3Mask, +Mod4Mask, +and +Mod5Mask. -Use -XkbLookupKeySym - to find the symbol associated with a key for a particular state. +Use +XkbLookupKeySym +to find the symbol associated with a key for a particular state. - - - - - - - -Bool -XkbLookupKeySym -( -dpy -, - key -, - state -, - mods_rtrn -, - sym_rtrn -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -KeyCode - key -; /* key for which symbols are to be found */ - - - - -unsigned int - state -; /* state for which symbol should be found */ - - - - -unsigned int * - mods_rtrn -; /* backfilled with unconsumed modifiers */ - - - - -KeySym * - sym_rtrn -; /* backfilled with symbol associated with key + state */ - - - - - +XkbLookupKeySym + + + Bool XkbLookupKeySym + + + Display *dpy + KeyCode key + unsigned int state + unsigned int *mods_rtrn + KeySym *sym_rtrn + + + + + + dpy + + + + connection to X server + + + + + + key + + + + key for which symbols are to be found + + + + + + state + + + + state for which symbol should be found + + + + + + mods_rtrn + + + + backfilled with unconsumed modifiers + + + + + + sym_rtrn + + + + backfilled with symbol associated with key + state + + + + - -XkbLookupKeySym - is the equivalent of the core -XLookupKeySym - function. For the core keyboard, given a keycode -key - and an Xkb state -state -, -XkbLookupKeySym - returns the symbol associated with the key in -sym_rtrn - and the list of modifiers that should still be applied in -mods_rtrn -. The -state - parameter is the state from a -KeyPress - or -KeyRelease - event. -XkbLookupKeySym - returns -True - if it succeeds. +XkbLookupKeySym +is the equivalent of the core +XLookupKeySym +function. For the core keyboard, given a keycode +key +and an Xkb state +state, +XkbLookupKeySym +returns the symbol associated with the key in +sym_rtrn +and the list of modifiers that should still be applied in +mods_rtrn. +The +state +parameter is the state from a +KeyPress +or +KeyRelease +event. +XkbLookupKeySym +returns +True +if it succeeds. -Use -XkbLookupKeyBinding - to find the string bound to a key by -XRebindKeySym -. -XkbLookupKeyBinding - is the equivalent of the core -XLookupString - function. +Use +XkbLookupKeyBinding +to find the string bound to a key by +XRebindKeysym. +XkbLookupKeyBinding +is the equivalent of the core +XLookupString +function. - - - - - - - -int -XkbLookupKeyBinding -( -dpy -, - sym -, - state -, - buf -, - nbytes -, - extra_rtrn -) - - - - -Display * - dpy -; /* connection to server */ - - - - -KeySym - sym -; /* symbol to be looked up */ - - - - -unsigned int -state -; /* state for which string is to be looked up */ - - - - -char * - buf -; /* buffer into which returned string is written */ - - - - -int - nbytes -; /* size of buffer in bytes */ - - - - -int * - extra_rtrn -; /* backfilled with number bytes overflow */ - - - - - +XkbLookupKeyBinding + + + int XkbLookupKeyBinding + + + Display *dpy + KeySym sym + unsigned int state + char *buf + int nbytes + int *extra_rtrn + + + + + + dpy + + + + connection to server + + + + + + sym + + + + symbol to be looked up + + + + + + state + + + + state for which string is to be looked up + + + + + + buf + + + + buffer into which returned string is written + + + + + + nbytes + + + + size of buffer in bytes + + + + + + extra_rtrn + + + + backfilled with number bytes overflow + + + + - -XRebindKeysym - binds an ASCII string to a specified keysym, so that the string and keysym are +XRebindKeysym +binds an ASCII string to a specified keysym, so that the string and keysym are returned when the key is pressed and a specified list of modifiers are also -being held down. -XkbLookupKeyBinding - returns in -buf - the string associated with the keysym -sym - and modifier state -state -. -buf - is -NULL - terminated unless there’s an overflow. If the string returned is larger than - -nbytes -, a count of bytes that does not fit into the buffer is returned in extra_rtrn. - -XkbTranslateKeySym - returns the number of bytes that it placed into -buf -. +being held down. +XkbLookupKeyBinding +returns in +buf +the string associated with the keysym +sym +and modifier state +state. +buf +is +NULL +terminated unless there’s an overflow. If the string returned is larger than +nbytes, +a count of bytes that does not fit into the buffer is returned in extra_rtrn. +XkbTranslateKeySym +returns the number of bytes that it placed into +buf. To find the string and symbol associated with a keysym for a given keyboard -state, use -XkbTranslateKeySym -. +state, use +XkbTranslateKeySym. - - - - - - - -int -XkbTranslateKeySym -( -dpy -, - sym_inout -, - mods -, - buf -, - nbytes -, -extra_rtrn -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -KeySym * - sym_inout -; /* symbol to be translated; result of translation */ - - - - -unsigned int - mods -; /* modifiers to apply to -sym_inout - */ - - - - -char * - buf -; /* buffer into which returned string is written */ - - - - -int - nbytes -; /* size of buffer in bytes */ - - - - -int * - extra_rtrn -; /* number of bytes overflow*/ - - - - - +XkbTranslateKeySym + + + int XkbTranslateKeySym + + + Display *dpy + KeySym *sym_inout + unsigned int mods + char *buf + int nbytes + int *extra_rtrn + + + + + + dpy + + + + connection to X server + + + + + + sym_inout + + + + symbol to be translated; result of translation + + + + + + mods + + + + modifiers to apply to sym_inout + + + + + + buf + + + + buffer into which returned string is written + + + + + + nbytes + + + + size of buffer in bytes + + + + + + extra_rtrn + + + + number of bytes overflow + + + + - -XkbTranslateKeySym - applies the transformations specified in -mods - to the symbol specified by -sym_inout -. It returns in -buf - the string, if any, associated with the keysym for the current locale. If the -transformations in -mods - changes the keysym, -sym_inout - is updated accordingly. If the string returned is larger than -nbytes -, a count of bytes that does not fit into the buffer is returned in extra_rtrn. - -XkbTranslateKeySym - returns the number of bytes it placed into -buf -. +XkbTranslateKeySym +applies the transformations specified in +mods +to the symbol specified by +sym_inout. +It returns in +buf +the string, if any, associated with the keysym for the current locale. If the +transformations in +mods +changes the keysym, +sym_inout +is updated accordingly. If the string returned is larger than +nbytes, +a count of bytes that does not fit into the buffer is returned in extra_rtrn. +XkbTranslateKeySym +returns the number of bytes it placed into +buf. To update the keyboard description that is internal to the X library, use - -XkbRefreshKeyboardMapping -. +XkbRefreshKeyboardMapping. - - - - - - - -Status -XkbRefreshKeyboardMapping -( -event) - - - - -XkbMapNotifyEvent * - event -; /* event initiating remapping */ - - - - - +XkbRefreshKeyboardMapping + + + Status XkbRefreshKeyboardMapping + + + XkbMapNotifyEvent *event + + + + + + event + + + + event initiating remapping + + + + - -XkbRefreshKeyboardMapping - is the Xkb equivalent of the core -XRefreshKeyboardMapping - function. It requests that the X server send the current key mapping -information to this client. A client usually invokes -XkbRefreshKeyboardMapping - after receiving an -XkbMapNotify - event. -XkbRefreshKeyboardMapping - returns -Success - if it succeeds and -BadMatch - if the event is not an Xkb event. +XkbRefreshKeyboardMapping +is the Xkb equivalent of the core +XRefreshKeyboardMapping +function. It requests that the X server send the current key mapping +information to this client. A client usually invokes +XkbRefreshKeyboardMapping +after receiving an +XkbMapNotify +event. +XkbRefreshKeyboardMapping +returns +Success +if it succeeds and +BadMatch +if the event is not an Xkb event. -The -XkbMapNotify - event can be generated when some client calls -XkbSetMap -, -XkbChangeMap -, -XkbGetKeyboardByName -, or any of the standard X library functions that change the keyboard mapping +The +XkbMapNotify +event can be generated when some client calls +XkbSetMap, +XkbChangeMap, +XkbGetKeyboardByName, +or any of the standard X library functions that change the keyboard mapping or modifier mapping. -To translate a keycode to a key symbol and modifiers, use -XkbTranslateKeyCode -. +To translate a keycode to a key symbol and modifiers, use +XkbTranslateKeyCode. - - - - - - - -Booll -XkbTranslateKeyCode -( -xkb, key, mods, mods_rtrn, keysym_rtrn) - - - - -XkbDescPtr -xkb -; /* keyboard description to use for translation */ - - - - -KeyCode -key -; /* keycode to translate */ - - - - -unsigned int -mods -; /* modifiers to apply when translating -key - */ - - - - -unsigned int * -mods_rtrn -; /* backfilled with unconsumed modifiers */ - - - - -KeySym * -keysym_rtrn -; /* keysym resulting from translation */ - - - - - +XkbTranslateKeyCode + + + Bool XkbTranslateKeyCode + + + XkbDescPtr xkb + KeyCode key + unsigned int mods + unsigned int *mods_rtrn + KeySym *keysym_rtrn + + + + + + xkb + + + + keyboard description to use for translation + + + + + + key + + + + keycode to translate + + + + + + mods + + + + modifiers to apply when translating key + + + + + + mods_rtrn + + + + backfilled with unconsumed modifiers + + + + + + keysym_rtrn + + + + keysym resulting from translation + + + + - -mods_rtrn - is backfilled with the modifiers consumed by the translation process. - -mods - is a bitwise inclusive OR of the legal modifier masks: -ShiftMask -, -LockMask -, -ControlMask -, -Mod1Mask -, -Mod2Mask -, -Mod3Mask -, -Mod4Mask -, -Mod5Mask -.The -AlwaysConsumeShiftAndLock - library control (see section 11.1.3), if enabled, causes -XkbTranslateKeyCode - to consume shift and lock. - XkbTranslateKeyCode - returns -True - if the translation resulted in a keysym, and -False - if it resulted in -NoSymbol -. +mods_rtrn +is backfilled with the modifiers consumed by the translation process. +mods +is a bitwise inclusive OR of the legal modifier masks: +ShiftMask, +LockMask, +ControlMask, +Mod1Mask, +Mod2Mask, +Mod3Mask, +Mod4Mask, +Mod5Mask. +The +AlwaysConsumeShiftAndLock +library control (see section 11.1.3), if enabled, causes +XkbTranslateKeyCode +to consume shift and lock. +XkbTranslateKeyCode +returns +True +if the translation resulted in a keysym, and +False +if it resulted in +NoSymbol. diff --git a/libX11/specs/XKB/ch13.xml b/libX11/specs/XKB/ch13.xml index ed6066d10..b07a900e6 100644 --- a/libX11/specs/XKB/ch13.xml +++ b/libX11/specs/XKB/ch13.xml @@ -1,3 +1,6 @@ + + Keyboard Geometry @@ -25,17 +28,18 @@ top left corner of the keyboard image. A component’s own origin is also its upper left corner. In some cases a component needs to be drawn rotated. For example, a special keyboard may have a section of keys arranged in rows in a rectangular area, but the entire rectangle may not be in alignment with the -rest of the keyboard, and instead, it is rotated from horizontal by 30 -o -. Rotation for a geometry object is specified in 1/10 o increments about its -origin. An example of a keyboard with rotated sections is shown in Figure 13.1. +rest of the keyboard, and instead, it is rotated from horizontal by 30°. +Rotation for a geometry object is specified in 1/10° increments about its +origin. An example of a keyboard with rotated sections is shown in Figure 13.1. - - - - - +
+ Rotated Keyboard Sections + + + + +
-Some geometry components include a -priority -, which indicates the order in which overlapping objects should be drawn. +Some geometry components include a +priority, +which indicates the order in which overlapping objects should be drawn. Objects should be drawn in order from highest priority (0) to lowest (255). - -The keyboard geometry’s top-level description is stored in a -XkbGeometryRec - structure. This structure contains three types of information: + + +XkbGeometryRec +The keyboard geometry’s top-level description is stored in a +XkbGeometryRec +structure. This structure contains three types of information: @@ -91,14 +97,13 @@ as follows: -The top-level keyboard geometry description includes a list of up to -MaxColors - (32) -color names -. A color name is a string whose interpretation is not specified by Xkb. The - -XkbColorRec - structure provides a field for this name as well as a pixel field. The pixel +The top-level keyboard geometry description includes a list of up to +XkbGeomMaxColors +(32) +color names. +A color name is a string whose interpretation is not specified by Xkb. The +XkbColorRec +structure provides a field for this name as well as a pixel field. The pixel field is a convenient place for an application to store a pixel value or color definition, if it needs to. All other geometry data structures refer to colors using their indices in this global list. @@ -106,15 +111,15 @@ using their indices in this global list. -The top-level keyboard geometry description includes a list of -geometry properties -. A geometry property associates an arbitrary string with an equally arbitrary +The top-level keyboard geometry description includes a list of +geometry properties. +A geometry property associates an arbitrary string with an equally arbitrary name. Geometry properties can be used to provide hints to programs that display images of keyboards, but they are not interpreted by Xkb. No other geometry structures refer to geometry properties. As an example of a possible use of - -properties -, consider the pause/break key on most PC keyboards: the "break" symbol is +properties, +consider the pause/break key on most PC keyboards: the break +symbol is usually on the front of the key and is often a different color. A program might set a property to: @@ -128,40 +133,39 @@ a top label. -The top-level keyboard geometry description includes a list of -key aliases - (see Chapter 18). Key aliases allow the keyboard layout designer to assign +The top-level keyboard geometry description includes a list of +key aliases +(see ). Key aliases allow the keyboard layout designer to assign multiple key names to a single key. Key aliases defined in the geometry component of a keyboard mapping override those defined in the keycodes component of the server database, which -are stored in the -XkbNamesRec - ( -xkb->names -). Therefore, consider the key aliases defined by the geometry before +are stored in the +XkbNamesRec + +(xkb->names). +Therefore, consider the key aliases defined by the geometry before considering key aliases supplied by the keycodes. -The top-level keyboard geometry description includes a list of -shapes -; other keyboard components refer to shapes by their index in this list. A +The top-level keyboard geometry description includes a list of +shapes; +other keyboard components refer to shapes by their index in this list. A shape consists of an arbitrary name of type Atom and one or more closed-polygon - -outlines -. All points in an outline are specified relative to the origin of its +outlines. +All points in an outline are specified relative to the origin of its enclosing shape, that is, whichever shape that contains this outline in its list of outlines. One outline is the primary outline. The primary outline is by -default the first outline, or it can be optionally specified by the -primary - field in the -XkbShapeRec - structure. A keyboard display application can generate a simpler but still +default the first outline, or it can be optionally specified by the +primary +field in the +XkbShapeRec +structure. A keyboard display application can generate a simpler but still accurate keyboard image by displaying only the primary outlines for each shape. -Nonrectangular keys must include a rectangular -approximation - as one of the outlines associated with the shape. The approximation is not +Nonrectangular keys must include a rectangular +approximation +as one of the outlines associated with the shape. The approximation is not normally displayed but can be used by very simple keyboard display applications to generate a recognizable but degraded image of the keyboard. @@ -169,50 +173,50 @@ to generate a recognizable but degraded image of the keyboard. -The -XkbGeometryRec - top-level geometry description contains the following information that +The +XkbGeometryRec +top-level geometry description contains the following information that pertains to the keyboard as a whole: -A -keyboard symbolic name - of type Atom to help users identify the keyboard. +A +keyboard symbolic name +of type Atom to help users identify the keyboard. -The -width - and -height - of the keyboard, in mm/10. For nonrectangular keyboards, the width and height +The +width +and +height +of the keyboard, in mm/10. For nonrectangular keyboards, the width and height describe the smallest bounding box that encloses the outline of the keyboard. -The - base color - of the keyboard is the predominant color on the keyboard and is used as the +The +base color +of the keyboard is the predominant color on the keyboard and is used as the default color for any components whose color is not explicitly specified. -The -label color - is the color used to draw the labels on most of the keyboard keys. +The +label color +is the color used to draw the labels on most of the keyboard keys. -The -label font - is a string that describes the font used to draw labels on most keys; label +The +label font +is a string that describes the font used to draw labels on most keys; label fonts are arbitrary strings, because Xkb does not specify the format or name space for font names. @@ -220,24 +224,26 @@ space for font names. -The keyboard is subdivided into named -sections - of related keys and doodads. The sections and doodads on the keyboard are -listed in the -XkbGeometryRec - top-level keyboard geometry description. A section is composed of keys that -are physically together and logically related. Figure 13.2 shows a keyboard -that is divided into four sections. A -doodad - describes some visible aspect of the keyboard that is not a key and is not a +The keyboard is subdivided into named +sections +of related keys and doodads. The sections and doodads on the keyboard are +listed in the +XkbGeometryRec +top-level keyboard geometry description. A section is composed of keys that +are physically together and logically related. Figure 13.2 shows a keyboard +that is divided into four sections. A +doodad +describes some visible aspect of the keyboard that is not a key and is not a section. - - - - - +
+ Keyboard with Four Sections + + + + +
- - - - - +
+ Xkb Geometry Data Structures + + + + +
- - - - - +
+ Xkb Geometry Data Structures (Doodads) + + + + +
- - - - - +
+ Xkb Geometry Data Structures (Overlays) + + + + +
-typedef struct _XkbGeometry { /* top-level keyboard geometry structure */ - Atom name; /* keyboard name */ - unsigned short width_mm; /* keyboard width in mm / 10 */ - unsigned short height_mm; /* keyboard height in mm / 10 */ - char * label_font; /* font for key labels */ - XkbColorPtr label_color; /* color for key labels - pointer into colors array */ - XkbColorPtr base_color; /* color for basic keyboard - pointer into colors array */ - unsigned short sz_properties; /* size of properties array */ - unsigned short sz_colors; /* size of colors array */ - unsigned short sz_shapes; /* size of shapes array */ - unsigned short sz_sections; /* size of sections array */ - unsigned short sz_doodads; /* size of doodads array */ - unsigned short sz_key_aliases; /* size of key aliases array */ - unsigned short num_properties; /* number of properties in the properties array */ - unsigned short num_colors; /* number of colors in the colors array */ - unsigned short num_shapes; /* number of shapes in the shapes array */ - unsigned short num_sections; /* number of sections in the sections array */ - unsigned short num_doodads; /* number of doodads in the doodads array */ - unsigned short num_key_aliases; /* number of key aliases in the key */ - XkbPropertyPtr properties; /* properties array */ - XkbColorPtr colors; /* colors array */ - XkbShapePtr shapes; /* shapes array */ - XkbSectionPtr sections; /* sections array */ - XkbDoodadPtr doodads; /* doodads array */ - XkbKeyAliasPtr key_aliases; /* key aliases array */ -} XkbGeometryRec*XkbGeometryPtr; +typedef struct _XkbGeometry { /* top-level keyboard geometry structure */ + Atom name; /* keyboard name */ + unsigned short width_mm; /* keyboard width in mm/10 */ + unsigned short height_mm; /* keyboard height in mm/10 */ + char * label_font; /* font for key labels */ + XkbColorPtr label_color; /* color for key labels + - pointer into colors array */ + XkbColorPtr base_color; /* color for basic keyboard + - pointer into colors array */ + unsigned short sz_properties; /* size of properties array */ + unsigned short sz_colors; /* size of colors array */ + unsigned short sz_shapes; /* size of shapes array */ + unsigned short sz_sections; /* size of sections array */ + unsigned short sz_doodads; /* size of doodads array */ + unsigned short sz_key_aliases; /* size of key aliases array */ + unsigned short num_properties; /* number of properties in the + properties array */ + unsigned short num_colors; /* number of colors in the + colors array */ + unsigned short num_shapes; /* number of shapes in the + shapes array */ + unsigned short num_sections; /* number of sections in the + sections array */ + unsigned short num_doodads; /* number of doodads in the + doodads array */ + unsigned short num_key_aliases; /* number of key aliases in the + key_aliases array */ + XkbPropertyPtr properties; /* properties array */ + XkbColorPtr colors; /* colors array */ + XkbShapePtr shapes; /* shapes array */ + XkbSectionPtr sections; /* sections array */ + XkbDoodadPtr doodads; /* doodads array */ + XkbKeyAliasPtr key_aliases; /* key aliases array */ +} XkbGeometryRec, *XkbGeometryPtr; -The -doodads - array is only for doodads not contained in any of the -sections - that has its own -doodads -. The key aliases contained in the -key_aliases - array take precedence over any defined in the keycodes component of the +The +doodads +array is only for doodads not contained in any of the +sections +that has its own +doodads. +The key aliases contained in the +key_aliases +array take precedence over any defined in the keycodes component of the keyboard description. typedef struct _XkbProperty { - char * name; /* property name */ - char * value; /* property value */ -} XkbPropertyRec,*XkbPropertyPtr; + char * name; /* property name */ + char * value; /* property value */ +} XkbPropertyRec, *XkbPropertyPtr; typedef struct _XkbColor { - unsigned int pixel; /* color */ - char * spec; /* color name */ -} XkbColorRec,*XkbColorPtr; + unsigned int pixel; /* color */ + char * spec; /* color name */ +} XkbColorRec, *XkbColorPtr; typedef struct _XkbKeyAliasRec { - char real[XkbKeyNameLength]; /* real name of the key */ - char alias[XkbKeyNameLength]; /* alias for the key */ -} XkbKeyAliasRec,*XkbKeyAliasPtr; + char real[XkbKeyNameLength]; /* real name of the key */ + char alias[XkbKeyNameLength]; /* alias for the key */ +} XkbKeyAliasRec, *XkbKeyAliasPtr; -typedef struct _XkbPoint { /* x,y coordinates */ - short x; - short y; -} XkbPointRec, *XkbPointPtr; +typedef struct _XkbPoint { /* x, y coordinates */ + short x; + short y; +} XkbPointRec, *XkbPointPtr; typedef struct _XkbOutline { - unsigned short num_points; /* number of points in the outline */ - unsigned short sz_points; /* size of the points array */ - unsigned short corner_radius; /* draw corners as circles with this radius */ - XkbPointPtr points; /* array of points defining the outline */ -} XkbOutlineRec, *XkbOutlinePtr; + unsigned short num_points; /* number of points in the outline */ + unsigned short sz_points; /* size of the points array */ + unsigned short corner_radius; /* draw corners as circles + with this radius */ + XkbPointPtr points; /* array of points defining + the outline */ +} XkbOutlineRec, *XkbOutlinePtr; typedef struct _XkbBounds { - short x1,y1; /* upper left corner of the bounds, - in mm/10 */ - short x2,y2; /* lower right corner of the bounds, in - mm/10 */ -} XkbBoundsRec, *XkbBoundsPtr; + short x1, y1; /* upper left corner of the bounds, in mm/10 */ + short x2, y2; /* lower right corner of the bounds, in mm/10 */ +} XkbBoundsRec, *XkbBoundsPtr; typedef struct _XkbShape { - Atom name; /* shape’s name */ - unsigned short num_outlines; /* number of outlines for the shape */ - unsigned short sz_outlines; /* size of the outlines array */ - XkbOutlinePtr outlines; /* array of outlines for the shape */ - XkbOutlinePtr approx; /* pointer into the array to the approximating outline */ - XkbOutlinePtr primary; /* pointer into the array to the primary outline */ - XkbBoundsRec bounds; /* bounding box for the shape; encompasses all outlines */ -} XkbShapeRec, *XkbShapePtr; + Atom name; /* shape’s name */ + unsigned short num_outlines; /* number of outlines for the shape */ + unsigned short sz_outlines; /* size of the outlines array */ + XkbOutlinePtr outlines; /* array of outlines for the shape */ + XkbOutlinePtr approx; /* pointer into the array to the + approximating outline */ + XkbOutlinePtr primary; /* pointer into the array to the + primary outline */ + XkbBoundsRec bounds; /* bounding box for the shape; + encompasses all outlines */ +} XkbShapeRec, *XkbShapePtr; -If -approx - and/or -primary - is -NULL -, the default value is used. The default primary outline is the first element +If +approx +and/or +primary +is +NULL, +the default value is used. The default primary outline is the first element in the outlines array, as is the default approximating outline. -typedef struct _XkbKey { /* key in a row */ - XkbKeyNameRec name; /* key name */ - short gap; /* gap in mm/10 from previous key in row */ - unsigned char shape_ndx; /* index of shape for key */ - unsigned char color_ndx; /* index of color for key body */ -} XkbKeyRec, *XkbKeyPtr; +typedef struct _XkbKey { /* key in a row */ + XkbKeyNameRec name; /* key name */ + short gap; /* gap in mm/10 from previous key in row */ + unsigned char shape_ndx; /* index of shape for key */ + unsigned char color_ndx; /* index of color for key body */ +} XkbKeyRec, *XkbKeyPtr; -typedef struct _XkbRow { /* row in a section */ - short top; /* top coordinate of row origin, relative to section’s origin */ - short left; /* left coordinate of row origin, relative to section’s origin */ - unsigned short num_keys; /* number of keys in the keys array */ - unsigned short sz_keys; /* size of the keys array */ - int vertical; /* True =>vertical row, - False =>horizontal row */ - XkbKeyPtr keys; /* array of keys in the row*/ - XkbBoundsRec bounds; /* bounding box for the row */ -} XkbRowRec, *XkbRowPtr; +typedef struct _XkbRow { /* row in a section */ + short top; /* top coordinate of row origin, + relative to section’s origin */ + short left; /* left coordinate of row origin, + relative to section’s origin */ + unsigned short num_keys; /* number of keys in the keys array */ + unsigned short sz_keys; /* size of the keys array */ + int vertical; /* True ⇒vertical row, + False ⇒horizontal row */ + XkbKeyPtr keys; /* array of keys in the row */ + XkbBoundsRec bounds; /* bounding box for the row */ +} XkbRowRec, *XkbRowPtr; - -top - and -left - are in -mm -/ -10 -. +top +and +left +are in +mm/10. typedef struct _XkbOverlayRec { - Atom name; /* overlay name */ - XkbSectionPtr section_under; /* the section under this overlay */ - unsigned short num_rows; /* number of rows in the rows array */ - unsigned short sz_rows; /* size of the rows array */ - XkbOverlayRowPtr rows; /* array of rows in the overlay */ - XkbBoundsPtr bounds; /* bounding box for the overlay */ -} XkbOverlayRec,*XkbOverlayPtr; + Atom name; /* overlay name */ + XkbSectionPtr section_under; /* the section under this overlay */ + unsigned short num_rows; /* number of rows in the rows array */ + unsigned short sz_rows; /* size of the rows array */ + XkbOverlayRowPtr rows; /* array of rows in the overlay */ + XkbBoundsPtr bounds; /* bounding box for the overlay */ +} XkbOverlayRec, *XkbOverlayPtr; typedef struct _XkbOverlayRow { - unsigned short row_under; /* index into the row under this overlay row */ - unsigned short num_keys; /* number of keys in the keys array */ - unsigned short sz_keys; /* size of the keys array */ - XkbOverlayKeyPtr keys; /* array of keys in the overlay row */ -} XkbOverlayRowRec,*XkbOverlayRowPtr; + unsigned short row_under; /* index into the row under this + overlay row */ + unsigned short num_keys; /* number of keys in the keys array */ + unsigned short sz_keys; /* size of the keys array */ + XkbOverlayKeyPtr keys; /* array of keys in the overlay row */ +} XkbOverlayRowRec, *XkbOverlayRowPtr; - -row_under - is an index into the array of -rows - in the section under this overlay. The section under this overlay row is the -one pointed to by -section_under - in this overlay row’s -XkbOverlayRec -. +row_under +is an index into the array of +rows +in the section under this overlay. The section under this overlay row is the +one pointed to by +section_under +in this overlay row’s +XkbOverlayRec. typedef struct _XkbOverlayKey { - XkbKeyNameRec over; /* name of this overlay key */ - XkbKeyNameRec under; /* name of the key under this overlay key */ -} XkbOverlayKeyRec,*XkbOverlayKeyPtr; + XkbKeyNameRec over; /* name of this overlay key */ + XkbKeyNameRec under; /* name of the key under this overlay key */ +} XkbOverlayKeyRec, *XkbOverlayKeyPtr; typedef struct _XkbSection { - Atom name; /* section name */ - unsigned char priority; /* drawing priority, 0=>highest, 255=>lowest */ - short top; /* top coordinate of section origin */ - short left; /* left coordinate of row origin */ - unsigned short width; /* section width, in mm/10 */ - unsigned short height; /* section height, in mm/10 */ - short angle; /* angle of section rotation, counterclockwise */ - unsigned short num_rows; /* number of rows in the rows array */ - unsigned short num_doodads; /* number of doodads in the doodads array */ - unsigned short num_overlays; /* number of overlays in the overlays array */ - unsigned short sz_rows; /* size of the rows array */ - unsigned short sz_doodads; /* size of the doodads array */ - unsigned short sz_overlays; /* size of the overlays array */ - XkbRowPtr rows; /* section rows array */ - XkbDoodadPtr doodads; /* section doodads array */ - XkbBoundsRec bounds; /* bounding box for the section, before rotation*/ - XkbOverlayPtr overlays; /* section overlays array */ -} XkbSectionRec, *XkbSectionPtr; + Atom name; /* section name */ + unsigned char priority; /* drawing priority, 0⇒highest, 255⇒lowest */ + short top; /* top coordinate of section origin */ + short left; /* left coordinate of row origin */ + unsigned short width; /* section width, in mm/10 */ + unsigned short height; /* section height, in mm/10 */ + short angle; /* angle of section rotation, + counterclockwise */ + unsigned short num_rows; /* number of rows in the rows array */ + unsigned short num_doodads; /* number of doodads in the doodads array */ + unsigned short num_overlays; /* number of overlays in the overlays array */ + unsigned short sz_rows; /* size of the rows array */ + unsigned short sz_doodads; /* size of the doodads array */ + unsigned short sz_overlays; /* size of the overlays array */ + XkbRowPtr rows; /* section rows array */ + XkbDoodadPtr doodads; /* section doodads array */ + XkbBoundsRec bounds; /* bounding box for the section, + before rotation */ + XkbOverlayPtr overlays; /* section overlays array */ +} XkbSectionRec, *XkbSectionPtr; - -top - and -left - are the origin of the section, relative to the origin of the keyboard, in - -mm -/ -10 -. -angle - is in -1 -/ -10 - degrees. +top +and +left +are the origin of the section, relative to the origin of the keyboard, in +mm/10. +angle +is in +1/10 +degrees. DoodadRec Structures -The doodad arrays in the -XkbGeometryRec - and the -XkbSectionRec - may contain any of the doodad structures and types shown in Table 13.1. +The doodad arrays in the +XkbGeometryRec +and the +XkbSectionRec +may contain any of the doodad structures and types shown in +Table 13.1. @@ -977,99 +992,101 @@ The doodad structures form a union: typedef union _XkbDoodad { - XkbAnyDoodadRec any; - XkbShapeDoodadRec shape; - XkbTextDoodadRec text; - XkbIndicatorDoodadRec indicator; - XkbLogoDoodadRec logo; -} XkbDoodadRec, *XkbDoodadPtr; + XkbAnyDoodadRec any; + XkbShapeDoodadRec shape; + XkbTextDoodadRec text; + XkbIndicatorDoodadRec indicator; + XkbLogoDoodadRec logo; +} XkbDoodadRec, *XkbDoodadPtr; -The -top - and -left - coordinates of each doodad are the coordinates of the origin of the doodad -relative to the keyboard’s origin if the doodad is in the -XkbGeometryRec - doodad array, and with respect to the section’s origin if the doodad is in a - -XkbSectionRec - doodad array. The -color_ndx - or -on_color_ndx - and -off_color_ndx - fields are color indices into the -XkbGeometryRec -’s color array and are the colors to draw the doodads with. Similarly, the - -shape_ndx - fields are indices into the -XkbGeometryRec -’s shape array. +The +top +and +left +coordinates of each doodad are the coordinates of the origin of the doodad +relative to the keyboard’s origin if the doodad is in the +XkbGeometryRec +doodad array, and with respect to the section’s origin if the doodad is in a +XkbSectionRec +doodad array. The +color_ndx +or +on_color_ndx +and +off_color_ndx +fields are color indices into the +XkbGeometryRec’s +color array and are the colors to draw the doodads with. Similarly, the +shape_ndx +fields are indices into the +XkbGeometryRec’s +shape array. typedef struct _XkbShapeDoodad { - Atom name; /* doodad name */ - unsigned char type; /* XkbOutlineDoodad - or XkbSolidDoodad */ - unsigned char priority; /* drawing priority, - 0=>highest, 255=>lowest */ - short top; /* top coordinate, in mm/10 */ - short left; /* left coordinate, in mm/10 */ - short angle; /* angle of rotation, clockwise, in 1/10 degrees */ - unsigned short color_ndx; /* doodad color */ - unsigned short shape_ndx; /* doodad shape */ -} XkbShapeDoodadRec, *XkbShapeDoodadPtr; + Atom name; /* doodad name */ + unsigned char type; /* XkbOutlineDoodad + or XkbSolidDoodad */ + unsigned char priority; /* drawing priority, + 0⇒highest, 255⇒lowest */ + short top; /* top coordinate, in mm/10 */ + short left; /* left coordinate, in mm/10 */ + short angle; /* angle of rotation, clockwise, + in 1/10 degrees */ + unsigned short color_ndx; /* doodad color */ + unsigned short shape_ndx; /* doodad shape */ +} XkbShapeDoodadRec, *XkbShapeDoodadPtr; typedef struct _XkbTextDoodad { - Atom name; /* doodad name */ - unsigned char type; /* XkbTextDoodad */ - unsigned char priority; /* drawing priority, - 0=>highest, 255=>lowest */ - short top; /* top coordinate, in mm/10 */ - short left; /* left coordinate, in mm/10 */ - short angle; /* angle of rotation, clockwise, in 1/10 degrees */ - short width; /* width in mm/10 */ - short height; /* height in mm/10 */ - unsigned short color_ndx; /* doodad color */ - char * text; /* doodad text */ - char * font; /* arbitrary font name for doodad text */ -} XkbTextDoodadRec, *XkbTextDoodadPtr; + Atom name; /* doodad name */ + unsigned char type; /* XkbTextDoodad */ + unsigned char priority; /* drawing priority, + 0⇒highest, 255⇒lowest */ + short top; /* top coordinate, in mm/10 */ + short left; /* left coordinate, in mm/10 */ + short angle; /* angle of rotation, clockwise, + in 1/10 degrees */ + short width; /* width in mm/10 */ + short height; /* height in mm/10 */ + unsigned short color_ndx; /* doodad color */ + char * text; /* doodad text */ + char * font; /* arbitrary font name for doodad text */ +} XkbTextDoodadRec, *XkbTextDoodadPtr; typedef struct _XkbIndicatorDoodad { - Atom name; /* doodad name */ - unsigned char type; /* XkbIndicatorDoodad */ - unsigned char priority; /* drawing priority, 0=>highest, 255=>lowest */ - short top; /* top coordinate, in mm/10 */ - short left; /* left coordinate, in mm/10 */ - short angle; /* angle of rotation, clockwise, in 1/10 degrees */ - unsigned short shape_ndx; /* doodad shape */ - unsigned short on_color_ndx; /* color for doodad if indicator is on */ - unsigned short off_color_ndx; /* color for doodad if indicator is off */ -} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; + Atom name; /* doodad name */ + unsigned char type; /* XkbIndicatorDoodad */ + unsigned char priority; /* drawing priority, 0⇒highest, 255⇒lowest */ + short top; /* top coordinate, in mm/10 */ + short left; /* left coordinate, in mm/10 */ + short angle; /* angle of rotation, clockwise, + in 1/10 degrees */ + unsigned short shape_ndx; /* doodad shape */ + unsigned short on_color_ndx; /* color for doodad if indicator is on */ + unsigned short off_color_ndx;/* color for doodad if indicator is off */ +} XkbIndicatorDoodadRec, *XkbIndicatorDoodadPtr; typedef struct _XkbLogoDoodad { - Atom name; /* doodad name */ - unsigned char type; /* XkbLogoDoodad */ - unsigned char priority; /* drawing priority, 0=>highest, 255=>lowest */ - short top; /* top coordinate, in mm/10 */ - short left; /* left coordinate, in mm/10 */ - short angle; /* angle of rotation, clockwise, in 1/10 degrees */ - unsigned short color_ndx; /* doodad color */ - unsigned short shape_ndx; /* doodad shape */ - char * logo_name; /* text for logo */ -} XkbLogoDoodadRec, *XkbLogoDoodadPtr + Atom name; /* doodad name */ + unsigned char type; /* XkbLogoDoodad */ + unsigned char priority; /* drawing priority, 0⇒highest, 255⇒lowest */ + short top; /* top coordinate, in mm/10 */ + short left; /* left coordinate, in mm/10 */ + short angle; /* angle of rotation, clockwise, + in 1/10 degrees */ + unsigned short color_ndx; /* doodad color */ + unsigned short shape_ndx; /* doodad shape */ + char * logo_name; /* text for logo */ +} XkbLogoDoodadRec, *XkbLogoDoodadPtr @@ -1079,131 +1096,133 @@ typedef struct _XkbLogoDoodad { You can load a keyboard geometry as part of the keyboard description returned -by -XkbGetKeyboard -. However, if a keyboard description has been previously loaded, you can -instead obtain the geometry by calling the -XkbGetGeometry -. In this case, the geometry returned is the one associated with the keyboard +by +XkbGetKeyboard. +However, if a keyboard description has been previously loaded, you can +instead obtain the geometry by calling the +XkbGetGeometry. +In this case, the geometry returned is the one associated with the keyboard whose device ID is contained in the keyboard description. To load a keyboard geometry if you already have the keyboard description, use -XkbGetGeometry. - - - - - - - - - -Status -XkbGetGeometry -( -dpy -, - xkb -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -XkbDescPtr - xkb -; /* keyboard description that contains the ID for the keyboard and into -which the geometry should be loaded */ - - - - - - - - -XkbGetGeometry - can return -BadValue -, -BadImplementation -, -BadName -, -BadAlloc, - or -BadLength - errors or -Success - if it succeeds. +XkbGetGeometry. + + +XkbGetGeometry + + + Status XkbGetGeometry + + + Display *dpy + XkbDescPtr xkb + + + + + + dpy + + + + connection to the X server + + + + + + xkb + + + + keyboard description that contains the ID for the keyboard and into + which the geometry should be loaded + + + + + + +XkbGetGeometry +can return +BadValue, +BadImplementation, +BadName, +BadAlloc, +or +BadLength +errors or +Success +if it succeeds. It is also possible to load a keyboard geometry by name. The X server maintains -a database of keyboard components (see Chapter 20). To load a keyboard geometry -description from this database by name, use -XkbGetNamedGeometry. - - - - - - - - - -Status -XkbGetNamedGeometry -( -dpy -, - xkb -, - name -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -XkbDescPtr -xkb -; /* keyboard description into which the geometry should be loaded */ - - - - -Atom -name -; /* name of the geometry to be loaded */ - - - - - - - - -XkbGetNamedGeometry - can return -BadName - if the -name - cannot be found. +a database of keyboard components (see ). To load a keyboard geometry +description from this database by name, use +XkbGetNamedGeometry. + + +XkbGetNamedGeometry + + + Status XkbGetNamedGeometry + + + Display *dpy + XkbDescPtr xkb + Atom name + + + + + + dpy + + + + connection to the X server + + + + + + xkb + + + + keyboard description into which the geometry should be loaded + + + + + + name + + + + name of the geometry to be loaded + + + + + + +XkbGetNamedGeometry +can return +BadName +if the +name +cannot be found. @@ -1222,11 +1241,13 @@ of a number of points. The bounding box of a shape is a rectangle that contains all the outlines of that shape. - - - - - +
+ Key Surface, Shape Outlines, and Bounding Box + + + + +
-To determine the bounding box of the top surface of a shape, use -XkbComputeShapeTop. - - - - - - - - - -Bool -XkbComputeShapeTop -( -shape -, - bounds_rtrn -) - - - - -XkbShapePtr - shape -; /* shape to be examined */ - - - - -XkbBoundsPtr - bounds_rtrn - /* backfilled with the bounding box for the shape */ - - - - - - - - -XkbComputeShapeTop - returns a -BoundsRec - that contains two x and y coordinates. These coordinates describe the corners +To determine the bounding box of the top surface of a shape, use +XkbComputeShapeTop. + + +XkbComputeShapeTop + + + Bool XkbComputeShapeTop + + + XkbShapePtr shape + XkbBoundsPtr bounds_rtrn + + + + + + shape + + + + shape to be examined + + + + + + bounds_rtrn + + + + backfilled with the bounding box for the shape + + + + + + +XkbComputeShapeTop +returns a +BoundsRec +that contains two x and y coordinates. These coordinates describe the corners of a rectangle that contains the outline that describes the top surface of the shape. The top surface is defined to be the approximating outline if the - -approx - field of -shape - is not -NULL -. If -approx - is -NULL -, the top surface is defined as the last outline in the -shape -’s array of outlines. -XkbComputeShapeTop - returns -False - if -shape - is -NULL - or if there are no outlines for the shape; otherwise, it returns -True. - - - - -A -ShapeRec - contains a -BoundsRec - that describes the bounds of the shape. If you add or delete an outline to or +approx +field of +shape +is not +NULL. +If +approx +is +NULL, +the top surface is defined as the last outline in the +shape’s +array of outlines. +XkbComputeShapeTop +returns +False +if +shape +is +NULL +or if there are no outlines for the shape; otherwise, it returns +True. + + + + +A +ShapeRec +contains a +BoundsRec +that describes the bounds of the shape. If you add or delete an outline to or from a shape, the bounding box must be updated. To update the bounding box of a -shape, use XkbComputeShapeBounds. - - - - - - - - - - -Bool -XkbComputeShapeBounds -( -shape -) - - - - -XkbShapePtr - shape -; /* shape to be examined */ - - - - - - - - -XkbComputeShapeBounds - updates the -BoundsRec - contained in the -shape - by examining all the outlines of the shape and setting the -BoundsRec - to the minimum x and minimum y, and maximum x and maximum y values found in -those outlines. -XkbComputeShapeBounds - returns -False - if -shape - is -NULL - or if there are no outlines for the shape; otherwise, it returns -True -. - - - - If you add or delete a key to or from a row, or if you update the shape of one +shape, use XkbComputeShapeBounds. + + + +XkbComputeShapeBounds + + + Bool XkbComputeShapeBounds + + + XkbShapePtr shape + + + + + + shape + + + + shape to be examined + + + + + + +XkbComputeShapeBounds +updates the +BoundsRec +contained in the +shape +by examining all the outlines of the shape and setting the +BoundsRec +to the minimum x and minimum y, and maximum x and maximum y values found in +those outlines. +XkbComputeShapeBounds +returns +False +if +shape +is +NULL +or if there are no outlines for the shape; otherwise, it returns +True. + + + +If you add or delete a key to or from a row, or if you update the shape of one of the keys in that row, you may need to update the bounding box of that row. -To update the bounding box of a row, use XkbComputeRowBounds. - - - - - - - - - -Bool -XkbComputeRowBounds -( -geom -, - section -, - row -) - - - - -XkbGeometryPtr - geom -; /* geometry that contains the -section - */ - - - - -XkbSectionPtr - section -; /* section that contains the row */ - - - - -XkbRowPtr -row -; /* row to be examined and updated */ - - - - - - - - -XkbComputeRowBounds - checks the bounds of all keys in the -row -and updates the bounding box of the row if necessary. -XkbComputeRowBounds - returns -False - if any of the arguments is -NULL -; otherwise, it returns -True -. - - - - If you add or delete a row to or from a section, or if you change the geometry +To update the bounding box of a row, use XkbComputeRowBounds. + + +XkbComputeRowBounds + + + Bool XkbComputeRowBounds + + + XkbGeometryPtr geom + XkbSectionPtr section + XkbRowPtr row + + + + + + geom + + + + geometry that contains the section + + + + + + section + + + + section that contains the row + + + + + + row + + + + row to be examined and updated + + + + + + +XkbComputeRowBounds +checks the bounds of all keys in the +row +and updates the bounding box of the row if necessary. +XkbComputeRowBounds +returns +False +if any of the arguments is +NULL; +otherwise, it returns +True. + + + +If you add or delete a row to or from a section, or if you change the geometry of any of the rows in that section, you may need to update the bounding box for that section. To update the bounding box of a section, use -XkbComputeSectionBounds. - - - - - - - - - -Bool -XkbComputeSectionBounds -( -geom -, - section -) - - - - -XkbGeometryPtr - geom -; /* geometry that contains the -section - */ - - - - -XkbSectionPtr - section -; /* section to be examined and updated */ - - - - - - - - -XkbComputeSectionBounds - examines all the rows of the -section - and updates the bounding box of that section so that it contains all rows. - -XkbComputeSectionBounds - returns -False - if any of the arguments is -NULL -; otherwise, it returns -True -. +XkbComputeSectionBounds. + + +XkbComputeSectionBounds + + + Bool XkbComputeSectionBounds + + + XkbGeometryPtr geom + XkbSectionPtr section + + + + + + geom + + + + geometry that contains the section + + + + + + section + + + + section to be examined and updated + + + + + + +XkbComputeSectionBounds +examines all the rows of the +section +and updates the bounding box of that section so that it contains all rows. +XkbComputeSectionBounds +returns +False +if any of the arguments is +NULL; +otherwise, it returns +True. Keys that can generate multiple keycodes may be associated with multiple names. Such keys have a primary name and an alternate name. To find the alternate name -by using the primary name for a key that is part of an overlay, use -XkbFindOverlayForKey. - - - - - - - - - -char * -XkbFindOverlayForKey -( -geom -, - section -, - under -) - - - - -XkbGeometryPtr - geom -; /* geometry that contains the -section - */ - - - - -XkbSectionPtr - section -; /* section to be searched for matching keys */ - - - - -char * - under -. /* primary name of the key to be considered */ - - - - - - - - -XkbFindOverlayForKey - uses the primary name of the key, -under -, to look up the alternate name, which it returns. +by using the primary name for a key that is part of an overlay, use +XkbFindOverlayForKey. + + +XkbFindOverlayForKey + + + char *XkbFindOverlayForKey + + + XkbGeometryPtr geom + XkbSectionPtr section + char *under + + + + + + geom + + + + geometry that contains the section + + + + + + section + + + + section to be searched for matching keys + + + + + + under + + + + .primary name of the key to be considered + + + + + + +XkbFindOverlayForKey +uses the primary name of the key, +under, +to look up the alternate name, which it returns. @@ -1559,25 +1577,21 @@ under Xkb provides functions to add a single new element to the top-level keyboard -geometry. In each case the -num_ - -* - fields of the corresponding structure is incremented by 1. These functions do -not change -sz_ - -* - unless there is no more room in the array. Some of these functions fill in the +geometry. In each case the +num_* +fields of the corresponding structure is incremented by 1. These functions do +not change +sz_* +unless there is no more room in the array. Some of these functions fill in the values of the element’s structure from the arguments. For other functions, you must explicitly write code to fill the structure’s elements. -The top-level geometry description includes a list of -geometry properties -. A geometry property associates an arbitrary string with an equally arbitrary +The top-level geometry description includes a list of +geometry properties. +A geometry property associates an arbitrary string with an equally arbitrary name. Programs that display images of keyboards can use geometry properties as hints, but they are not interpreted by Xkb. No other geometry structures refer to geometry properties. @@ -1585,68 +1599,69 @@ to geometry properties. -To add one property to an existing keyboard geometry description, use -XkbAddGeomProperty -. - - - - - - - - - -XkbPropertyPtr -XkbAddGeomProperty -( -geom -, - name -, - value -) - - - - -XkbGeometryPtr - geom -; /* geometry to be updated */ - - - - -char * - name -; /* name of the new property */ - - - - -char * - value -; /* value for the new property */ - - - - - - - - -XkbAddGeomProperty - adds one property with the specified -name - and -value - to the keyboard geometry specified by geom. - - -XkbAddGeomProperty - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for +To add one property to an existing keyboard geometry description, use +XkbAddGeomProperty. + + +XkbAddGeomProperty + + + XkbPropertyPtr XkbAddGeomProperty + + + XkbGeometryPtr geom + char *name + char *value + + + + + + geom + + + + geometry to be updated + + + + + + name + + + + name of the new property + + + + + + value + + + + value for the new property + + + + + + +XkbAddGeomProperty +adds one property with the specified +name +and +value +to the keyboard geometry specified by geom. +XkbAddGeomProperty +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for the property. To allocate space for an arbitrary number of properties, use the XkbAllocGeomProps function. @@ -1654,62 +1669,65 @@ XkbAllocGeomProps function. To add one key alias to an existing keyboard geometry description, use - -XkbAddGeomKeyAlias -. - - - - - - - - - - -XkbKeyAliasPtr -XkbAddGeomKeyAlias -( -geom -, - alias, real -) - - - - -XkbGeometryPtr - geom -; /* geometry to be updated */ - - - - -char * - alias -; /* alias to be added */ - - - - -char * - real -; /* real name to be bound to the new alias */ - - - - - - - - -XkbAddGeomKeyAlias - adds one key alias with the value alias to the geometry geom, and associates -it with the key whose real name is real. -XkbAddGeomKeyAlias - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for +XkbAddGeomKeyAlias. + + + +XkbAddGeomKeyAlias + + + XkbKeyAliasPtr XkbAddGeomKeyAlias + + + XkbGeometryPtr geom + char *alias + char *real + + + + + + geom + + + + geometry to be updated + + + + + + alias + + + + alias to be added + + + + + + real + + + + real name to be bound to the new alias + + + + + + +XkbAddGeomKeyAlias +adds one key alias with the value alias to the geometry geom, and associates +it with the key whose real name is real. +XkbAddGeomKeyAlias +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for the alias. To allocate space for an arbitrary number of aliases, use the XkbAllocGeomKeyAliases function. @@ -1717,414 +1735,423 @@ XkbAllocGeomKeyAliases function. To add one color name to an existing keyboard geometry description, use - -XkbAddGeomColor -. - - - - - - - - - - -XkbColorPtr -XkbAddGeomColor -( -geom -, - spec -, - pixel -) - - - - -XkbGeometryPtr - geom -; /* geometry to be updated */ - - - - -char * - spec -; /* color to be added */ - - - - -unsigned int - pixel -; /* color to be added */ - - - - - - - - -XkbAddGeomColor - adds the specified color -name - and -pixel - to the specified geometry -geom -. The top-level geometry description includes a list of up to -MaxColors - (32) -color names -. A color -name - is a string whose interpretation is not specified by Xkb and neither is the - -pixel - value’s interpretation. All other geometry data structures refer to colors +XkbAddGeomColor. + + + +XkbAddGeomColor + + + XkbColorPtr XkbAddGeomColor + + + XkbGeometryPtr geom + char *spec + unsigned int pixel + + + + + + geom + + + + geometry to be updated + + + + + + spec + + + + color to be added + + + + + + pixel + + + + color to be added + + + + + + +XkbAddGeomColor +adds the specified color +name +and +pixel +to the specified geometry +geom. +The top-level geometry description includes a list of up to +MaxColors +(32) +color names. +A color +name +is a string whose interpretation is not specified by Xkb and neither is the +pixel +value’s interpretation. All other geometry data structures refer to colors using their indices in this global list or pointers to colors in this list. - -XkbAddGeomColor - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for +XkbAddGeomColor +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for the color. To allocate space for an arbitrary number of colors to a geometry, -use the -XkbAllocGeomColors - function. - - - -To add one outline to an existing shape, use -XkbAddGeomOutline. - - - - - - - - - -XkbOutlinePtr -XkbAddGeomOutline -( -shape -, - sz_points -) - - - - -XkbShapePtr - shape -; /* shape to be updated */ - - - - -int - sz_points -; /* number of points to be reserved */ - - - - - - - -An outline consists of an arbitrary number of points. -XkbAddGeomOutline - adds an outline to the specified -shape - by reserving -sz_points - points for it. The new outline is allocated and zeroed. -XkbAddGeomOutline - returns -NULL - if any of the parameters is empty or if it was not able to allocate space. To +use the +XkbAllocGeomColors +function. + + + +To add one outline to an existing shape, use +XkbAddGeomOutline. + + +XkbAddGeomOutline + + + XkbOutlinePtr XkbAddGeomOutline + + + XkbShapePtr shape + int sz_points + + + + + + shape + + + + shape to be updated + + + + + + sz_points + + + + number of points to be reserved + + + + + + +An outline consists of an arbitrary number of points. +XkbAddGeomOutline +adds an outline to the specified +shape +by reserving +sz_points +points for it. The new outline is allocated and zeroed. +XkbAddGeomOutline +returns +NULL +if any of the parameters is empty or if it was not able to allocate space. To allocate space for an arbitrary number of outlines to a shape, use XkbAllocGeomOutlines. -To add a shape to a keyboard geometry, use -XkbAddGeomShape -. - - - - - - - - - - -XkbShapePtr -XkbAddGeomShape -( -geom -, - name -, - sz_outlines -) - - - - -XkbGeometryPtr - geom -; /* geometry to be updated */ - - - - -Atom - name -; /* name of the new shape */ - - - - -int - sz_outlines -; /* number of outlines to be reserved */ - - - - - +To add a shape to a keyboard geometry, use +XkbAddGeomShape. + + + +XkbAddGeomShape + + + XkbShapePtr XkbAddGeomShape + + + XkbGeometryPtr geom + Atom name + int sz_outlines + + + + + + geom + + + + geometry to be updated + + + + + + name + + + + name of the new shape + + + + + + sz_outlines + + + + number of outlines to be reserved + + + + A geometry contains an arbitrary number of shapes, each of which is made up of -an arbitrary number of outlines. -XkbAddGeomShape - adds a shape to a geometry -geom - by allocating space for -sz_outlines - outlines for it and giving it the name specified by name. If a shape with name - -name - already exists in the geometry, a pointer to the existing shape is returned. - -XkbAddGeomShape - returns -NULL - if any of the parameters is empty or if it was not able to allocate space. To -allocate space for an arbitrary number of geometry shapes, use -XkbAllocGeomShapes -. - - - - -To add one key at the end of an existing row of keys, use -XkbAddGeomKey -. - - - - - - - - - - -XkbKeyPtr -XkbAddGeomKey -( -row -) - - - - -XkbRowPtr - row -; /* row to be updated */ - - - - - - - -Keys are grouped into rows. -XkbAddGeomKey - adds one key to the end of the specified -row -. The key is allocated and zeroed. -XkbAddGeomKey - returns -NULL - if -row - is empty or if it was not able to allocate space for the key. To allocate +an arbitrary number of outlines. +XkbAddGeomShape +adds a shape to a geometry +geom +by allocating space for +sz_outlines +outlines for it and giving it the name specified by name. If a shape with name +name +already exists in the geometry, a pointer to the existing shape is returned. +XkbAddGeomShape +returns +NULL +if any of the parameters is empty or if it was not able to allocate space. To +allocate space for an arbitrary number of geometry shapes, use +XkbAllocGeomShapes. + + + + +To add one key at the end of an existing row of keys, use +XkbAddGeomKey. + + + +XkbAddGeomKey + + + XkbKeyPtr XkbAddGeomKey + + + XkbRowPtr row + + + + + + row + + + + row to be updated + + + + + + +Keys are grouped into rows. +XkbAddGeomKey +adds one key to the end of the specified +row. +The key is allocated and zeroed. +XkbAddGeomKey +returns +NULL +if +row +is empty or if it was not able to allocate space for the key. To allocate space for an arbitrary number of keys to a row, use XkbAllocGeomKeys. -To add one section to an existing keyboard geometry, use -XkbAddGeomSection -. - - - - - - - - - - -XkbSectionPtr -XkbAddGeomSection -( -geom -, - name -, - sz_rows -, - sz_doodads -, - sz_overlays -) - - - - -XkbGeometryPtr - geom -; /* geometry to be updated */ - - - - -Atom - name -; /* name of the new section */ - - - - -int - sz_rows -; /* number of rows to reserve in the section */ - - - - -int - sz_doodads -; /* number of doodads to reserve in the section */ - - - - -int - sz_overlays -; /* number of overlays to reserve in the section */ - - - - - - - -A keyboard geometry contains an arbitrary number of sections. -XkbAddGeomSection - adds one section to an existing keyboard geometry -geom -. The new section contains space for the number of rows, doodads, and overlays -specified by -sz_rows -, -sz_doodads -, and -sz_overlays -. The new section is allocated and zeroed and given the name specified by - -name -. If a section with name -name - already exists in the geometry, a pointer to the existing section is -returned. - XkbAddGeomSection - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for +To add one section to an existing keyboard geometry, use +XkbAddGeomSection. + + + +XkbAddGeomSection + + + XkbSectionPtr XkbAddGeomSection + + + XkbGeometryPtr geom + Atom name + int sz_rows + int sz_doodads + int sz_overlays + + + + + + geom + + + + geometry to be updated + + + + + + name + + + + name of the new section + + + + + + sz_rows + + + + number of rows to reserve in the section + + + + + + sz_doodads + + + + number of doodads to reserve in the section + + + + + + sz_overlays + + + + number of overlays to reserve in the section + + + + + + +A keyboard geometry contains an arbitrary number of sections. +XkbAddGeomSection +adds one section to an existing keyboard geometry +geom. +The new section contains space for the number of rows, doodads, and overlays +specified by +sz_rows, +sz_doodads, +and +sz_overlays. +The new section is allocated and zeroed and given the name specified by +name. +If a section with name +name +already exists in the geometry, a pointer to the existing section is +returned. +XkbAddGeomSection +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for the section. To allocate space for an arbitrary number of sections to a geometry, use XkbAllocGeomSections. -To add a row to a section, use -XkbAddGeomRow -. - - - - - - - - - - -XkbRowPtr -XkbAddGeomRow -( -section -, - sz_keys -) - - - - -XkbSectionPtr - section -; /* section to be updated */ - - - - -int -sz_keys -; /* number of keys to be reserved */ - - - - - +To add a row to a section, use +XkbAddGeomRow. + + + +XkbAddGeomRow + + + XkbRowPtr XkbAddGeomRow + + + XkbSectionPtr section + int sz_keys + + + + + + section + + + + section to be updated + + + + + + sz_keys + + + + number of keys to be reserved + + + + One of the components of a keyboard geometry section is one or more rows of -keys. -XkbAddGeomRow - adds one row to the specified -section -. The newly created row contains space for the number of keys specified in - -sz_keys -. They are allocated and zeroed, but otherwise uninitialized. -XkbAddGeomRow - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for +keys. +XkbAddGeomRow +adds one row to the specified +section. +The newly created row contains space for the number of keys specified in +sz_keys. +They are allocated and zeroed, but otherwise uninitialized. +XkbAddGeomRow +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for the row. To allocate space for an arbitrary number of rows to a section, use the XkbAllocGeomRows function. @@ -2132,85 +2159,88 @@ the XkbAllocGeomRows function. To add one doodad to a section of a keyboard geometry or to the top-level -geometry, use -XkbAddGeomDoodad -. - - - - - - - - - - -XkbDoodadPtr -XkbAddGeomDoodad -( -geom -, - section -, - name -) - - - - -XkbGeometryPtr - geom -; /* geometry to which the doodad is added */ - - - - -XkbSectionPtr - section -; /* section, if any, to which the doodad is added */ - - - - -Atom - name -; /* name of the new doodad */ - - - - - - - -A -doodad - describes some visible aspect of the keyboard that is not a key and is not a -section. -XkbAddGeomDoodad - adds a doodad with name specified by name to the geometry -geom - if section is -NULL - or to the section of the geometry specified by section if -section - is not -NULL -. -XkbAddGeomDoodad - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for -the doodad. If there is already a doodad with the name -name - in the doodad array for the geometry (if -section - is -NULL -) or the section (if -section - is non- -NULL -), a pointer to that doodad is returned. To allocate space for an arbitrary +geometry, use +XkbAddGeomDoodad. + + + +XkbAddGeomDoodad + + + XkbDoodadPtr XkbAddGeomDoodad + + + XkbGeometryPtr geom + XkbSectionPtr section + Atom name + + + + + + geom + + + + geometry to which the doodad is added + + + + + + section + + + + section, if any, to which the doodad is added + + + + + + name + + + + name of the new doodad + + + + + + +A +doodad +describes some visible aspect of the keyboard that is not a key and is not a +section. +XkbAddGeomDoodad +adds a doodad with name specified by name to the geometry +geom +if section is +NULL +or to the section of the geometry specified by section if +section +is not +NULL. +XkbAddGeomDoodad +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for +the doodad. If there is already a doodad with the name +name +in the doodad array for the geometry (if +section +is +NULL) +or the section (if +section +is non- +NULL), +a pointer to that doodad is returned. To allocate space for an arbitrary number of doodads to a section, use the XkbAllocGeomSectionDoodads function. To allocate space for an arbitrary number of doodads to a keyboard geometry, use the XkbAllocGeomDoodads function. @@ -2218,1900 +2248,1963 @@ the XkbAllocGeomDoodads function. -To add one overlay to a section, use -XkbAddGeomOverlay -. +To add one overlay to a section, use +XkbAddGeomOverlay. + + + +XkbAddGeomOverlay + + + XkbOverlayPtr XkbAddGeomOverlay + + + XkbSectionPtr section + Atom name + int sz_rows + + + + + + section + + + + section to which an overlay will be added + + + + + + name + + + + name of the overlay + + + + + + sz_rows + + + + number of rows to reserve in the overlay + + + + + + +XkbAddGeomOverlay +adds an overlay with the specified name to the specified +section. +The new overlay is created with space allocated for sz_rows rows. If an +overlay with name +name +already exists in the section, a pointer to the existing overlay is +returned. +XkbAddGeomOverlay +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for +the overlay. To allocate space for an arbitrary number of overlays to a +section, use the XkbAllocGeomOverlay function. - - - - - - - -XkbOverlayPtr -XkbAddGeomOverlay -( -section -, - name -, - sz_rows -) - - - - -XkbSectionPtr - section -; /* section to which an overlay will be added */ - - - - -Atom - name -; /* name of the overlay */ - - - - -int - sz_rows -; /* number of rows to reserve in the overlay */ - - - - - - - - -XkbAddGeomOverlay - adds an overlay with the specified name to the specified -section -. The new overlay is created with space allocated for sz_rows rows. If an -overlay with name -name - already exists in the section, a pointer to the existing overlay is -returned. - XkbAddGeomOverlay - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for -the overlay. To allocate space for an arbitrary number of overlays to a -section, use the XkbAllocGeomOverlay function. - - - - -To add a row to an existing overlay, use -XkbAddGeomOverlayRow -. - - - - - - - - - - -XkbOverlayRowPtr -XkbAddGeomOverlayRow -( -overlay -, - row_under, sz_keys -) - - - - -XkbOverlayPtr - overlay -; /* overlay to be updated */ - - - - -XkbRowPtr - row_under -; /* row to be overlayed in the section -overlay - overlays */ - - - - -int - sz_keys -; /* number of keys to reserve in the row */ - - - - - - - - -XkbAddGeomOverlayRow - adds one row to the -overlay -. The new row contains space for -sz_keys - keys. If -row_under - specifies a row that doesn’t exist on the underlying section, -XkbAddGeomOverlayRow - returns -NULL - and doesn’t change the overlay. - XkbAddGeomOverlayRow - returns -NULL - if any of the parameters is empty or if it was not able to allocate space for -the overlay. - - - - -To add a key to an existing overlay row, use -XkbAddGeomOverlayKey -. - - - - - - - - - - -XkbOverlayKeyPtr -XkbAddGeomOverlayKey -( -overlay -, - row, under -) - - - - -XkbOverlayPtr - overlay -; /* overlay to be updated */ - - - - -XkbRowPtr - row -; /* row in overlay to be updated */ - - - - -char * - under -; /* primary name of the key to be considered */ - - - - - - - - -XkbAddGeomOverlayKey - adds one key to the -row - in the -overlay -. If there is no key named -under - in the row of the underlying section, -XkbAddGeomOverlayKey - returns -NULL -. - - - - - -Allocating and Freeing Geometry Components - - -Xkb provides a number of functions to allocate and free subcomponents of a -keyboard geometry. Use these functions to create or modify keyboard geometries. -Note that these functions merely allocate space for the new element(s), and it -is up to you to fill in the values explicitly in your code. These allocation -functions increase -sz_ - -* - but never touch -num_ - -* - (unless there is an allocation failure, in which case they reset both - -sz_ - -* - and -num_ - -* - to zero). These functions return -Success - if they succeed, -BadAlloc - if they are not able to allocate space, or -BadValue - if a parameter is not as expected. - - - - -To allocate space for an arbitrary number of outlines to a shape, use -XkbAllocGeomOutlines. - - - - - - - - - -Status -XkbAllocGeomOutlines -( -shape -, - num_needed -) - - - - -XkbShapePtr -shape -; /* shape for which outlines should be allocated */ - - - - -int - num_needed -; /* number of new outlines required */ - - - - - - - - -XkbAllocGeomOutlines - allocates space for -num_needed - outlines in the specified -shape -. The outlines are not initialized. - - - - -To free geometry outlines, use -XkbFreeGeomOutlines -. - - - - - - - - - - -void -XkbFreeGeomOutlines -( -shape -, - first -, - count -, - free_all -) - - - - -XkbShapePtr - shape -; /* shape in which outlines should be freed */ - - - - -int - first -; /* first outline to be freed */ - - - - -int - count -; /* number of outlines to be freed */ - - - - -Bool - free_all; - /* -True - => all outlines are freed */ - - - - - - - -If free_all is -True -, all outlines are freed regardless of the value of first or count. Otherwise, -count outlines are freed beginning with the one specified by first. - - - - -To allocate space for an arbitrary number of keys to a row, use -XkbAllocGeomKeys. - - - - - - - - - - -Status -XkbAllocGeomKeys -( -row -, - num_needed -) - - - - -XkbRowPtr - row -; /* row to which keys should be allocated */ - - - - -int - num_needed -; /* number of new keys required */ - - - - - - - - -XkbAllocGeomKeys - allocates num_needed keys and adds them to the row. No initialization of the -keys is done. - - - - -To free geometry keys, use -XkbFreeGeomKeys -. - - - - - - - - - - -void -XkbFreeGeomKeys -( -row -, - first -, - count -, - free_all -) - - - - -XkbRowPtr - row -; /* row in which keys should be freed */ - - - - -int - first -; /* first key to be freed */ - - - - -int - count -; /* number of keys to be freed */ - - - - -Bool - free_all; - /* -True - => all keys are freed */ - - - - - - - -If free_all is -True -, all keys are freed regardless of the value of first or count. Otherwise, -count keys are freed beginning with the one specified by first. - - - - -To allocate geometry properties, use -XkbAllocGeomProps -. - - - - - - - - - - -Status -XkbAllocGeomProps -( -geom -, - num_needed -) - - - - -XkbGeometryPtr - geom -; /* geometry for which properties should be allocated */ - - - - -int - num_needed -; /* number of new properties required */ - - - - - - - - -XkbAllocGeomProps - allocates space for num_needed properties and adds them to the specified -geometry -geom -. No initialization of the properties is done. A geometry property associates -an arbitrary string with an equally arbitrary name. Geometry properties can be -used to provide hints to programs that display images of keyboards, but they -are not interpreted by Xkb. No other geometry structures refer to geometry -properties. - - - - -To free geometry properties, use -XkbFreeGeomProperties -. - - - - - - - - - - -void -XkbFreeGeomProperties -( -geom -, - first -, - count -, - free_all -) - - - - -XkbGeometryPtr - geom -; /* geometry in which properties should be freed */ - - - - -int - first -; /* first property to be freed */ - - - - -int - count -; /* number of properties to be freed */ - - - - -Bool - free_all; - /* -True - => all properties are freed */ - - - - - - - -If free_all is -True -, all properties are freed regardless of the value of first or count. -Otherwise, count properties are freed beginning with the one specified by first. - - - - -To allocate geometry key aliases, use -XkbAllocGeomKeyAliases -. - - - - - - - - - - -Status -XkbAllocGeomKeyAliases -( -geom -, - num_needed -) - - - - -XkbGeometryPtr - geom -; /* geometry for which key aliases should be allocated */ - - - - -int - num_needed -; /* number of new key aliases required */ - - - - - - - - -XkbAllocGeomKeyAliases - allocates space for num_needed key aliases and adds them to the specified -geometry -geom -. A key alias is a pair of strings that associates an alternate name for a key -with the real name for that key. - - - - -To free geometry key aliases, use -XkbFreeGeomKeyAliases -. - - - - - - - - - - -void -XkbFreeGeomKeyAliases -( -geom -, - first -, -count -, -free_all -) - - - - -XkbGeometryPtr - geom -; /* geometry in which key aliases should be freed */ - - - - -int - first -; /* first key alias to be freed */ - - - - -int - count -; /* number of key aliases to be freed */ - - - - -Bool - free_all; - /* -True - => all key aliases are freed */ - - - - - - - -If free_all is -True -, all aliases in the top level of the specified geometry -geom - are freed regardless of the value of first or count. Otherwise, count aliases -in -geom - are freed beginning with the one specified by first. - - - - -To allocate geometry colors, use -XkbAllocGeomColors -. - - - - - - - - - - -Status -XkbAllocGeomColors -( -geom -, - num_needed -) - - - - -XkbGeometryPtr - geom -; /* geometry for which colors should be allocated */ - - - - -int - num_needed -; /* number of new colors required. */ - - - - - - - - -XkbAllocGeomColors - allocates space for num_needed colors and adds them to the specified geometry - -geom -. A color name is a string whose interpretation is not specified by Xkb. All -other geometry data structures refer to colors using their indices in this -global list or pointers to colors in this list. - - - - -To free geometry colors, use -XkbFreeGeomColors -. - - - - - - - - - - -void -XkbFreeGeomColors -( -geom -, - first -, - count -, - free_all -) - - - - -XkbGeometryPtr - geom -; /* geometry in which colors should be freed */ - - - - -int - first -; /* first color to be freed */ - - - - -int - count -; /* number of colors to be freed */ - - - - -Bool - free_all; - /* -True - => all colors are freed */ - - - - - - - -If free_all is -True -, all colors are freed regardless of the value of first or count. Otherwise, -count colors are freed beginning with the one specified by first. - - - - -To allocate points in an outline, use -XkbAllocGeomPoints -. - - - - - - - - - - -Status -XkbAllocGeomPoints -( -outline -, - num_needed -) - - - - -XkbOutlinePtr - outline -; /* outline for which points should be allocated */ - - - - -int - num_needed -; /* number of new points required */ - - - - - - - - -XkbAllocGeomPoints - allocates space for -num_needed - points in the specified -outline -. The points are not initialized. - - - - -To free points in a outline, use -XkbFreeGeomPoints -. - - - - - - - - - - -void -XkbFreeGeomPoints -( -outline -, - first -, - count -, - free_all -) - - - - -XkbOutlinePtr - outline -; /* outline in which points should be freed */ - - - - -int - first -; /* first point to be freed. */ - - - - -int - count -; /* number of points to be freed */ - - - - -Bool - free_all; - /* -True - => all points are freed */ - - - - - - - -If free_all is -True -, all points are freed regardless of the value of first and count. Otherwise, -the number of points specified by count are freed, beginning with the point -specified by first in the specified outline. - - - - -To allocate space for an arbitrary number of geometry shapes, use -XkbAllocGeomShapes -. - - - - - - - - - - -Status -XkbAllocGeomShapes -( -geom -, - num_needed -) - - - - -XkbGeometryPtr - geom -; /* geometry for which shapes should be allocated */ - - - - -int - num_needed -; /* number of new shapes required */ - - - - - - - - -XkbAllocGeomShapes - allocates space for -num_needed - shapes in the specified geometry -geom -. The shapes are not initialized. - - - - -To free geometry shapes, use -XkbFreeGeomShapes -. - - - - - - - - - - -void -XkbFreeGeomShapes -( -geom -, - first -, - count -, - f ree_all -) - - - - -XkbGeometryPtr - geom -; /* geometry in which shapes should be freed */ - - - - -int - first -; /* first shape to be freed */ - - - - -int - count -; /* number of shapes to be freed */ - - - - -Bool - free_all; - /* -True - => all shapes are freed */ - - - - - - - -If free_all is -True -, all shapes in the geometry are freed regardless of the values of first and -count. Otherwise, count shapes are freed, beginning with the shape specified by -first. - - - - -To allocate geometry sections, use -XkbAllocGeomSections -. - - - - - - - - - - -Status -XkbAllocGeomSections -( -geom -, - num_needed -) - - - - -XkbGeometryPtr - geom -; /*geometry for which sections should be allocated */ - - - - -int - num_needed -; /* number of new sections required */ - - - - - - - -XkbAllocGeomSections - allocates num_needed sections and adds them to the geometry geom. No -initialization of the sections is done. +To add a row to an existing overlay, use +XkbAddGeomOverlayRow. + + + +XkbAddGeomOverlayRow + + + XkbOverlayRowPtr XkbAddGeomOverlayRow + + + XkbOverlayPtr overlay + XkbRowPtr row_under + int sz_keys + + + + + + overlay + + + + overlay to be updated + + + + + + row_under + + + + row to be overlayed in the section overlay + overlays + + + + + + sz_keys + + + + number of keys to reserve in the row + + + + + + +XkbAddGeomOverlayRow +adds one row to the +overlay. +The new row contains space for +sz_keys +keys. If +row_under +specifies a row that doesn’t exist on the underlying section, +XkbAddGeomOverlayRow +returns +NULL +and doesn’t change the overlay. +XkbAddGeomOverlayRow +returns +NULL +if any of the parameters is empty or if it was not able to allocate space for +the overlay. -To free geometry sections, use -XkbFreeGeomSections -. +To add a key to an existing overlay row, use +XkbAddGeomOverlayKey. + + + +XkbAddGeomOverlayKey + + + XkbOverlayKeyPtr XkbAddGeomOverlayKey + + + XkbOverlayPtr overlay + XkbRowPtr row + char *under + + + + + + overlay + + + + overlay to be updated + + + + + + row + + + + row in overlay to be updated + + + + + + under + + + + primary name of the key to be considered + + + + + + +XkbAddGeomOverlayKey +adds one key to the +row +in the +overlay. +If there is no key named +under +in the row of the underlying section, +XkbAddGeomOverlayKey +returns +NULL. - - - - - - - -void -XkbFreeGeomSections -( -geom -, - first -, - count -, - free_all -) - - - - -XkbGeometryPtr - geom -; /* geometry in which sections should be freed */ - - - - -int - first -; /* first section to be freed. */ - - - - -int - count -; /* number of sections to be freed */ - - - - -Bool - free_all; - /* -True - => all sections are freed */ - - - - - + + +Allocating and Freeing Geometry Components -If free_all is -True -, all sections are freed regardless of the value of first and count. Otherwise, -the number of sections specified by count are freed, beginning with the section -specified by first in the specified geometry. +Xkb provides a number of functions to allocate and free subcomponents of a +keyboard geometry. Use these functions to create or modify keyboard geometries. +Note that these functions merely allocate space for the new element(s), and it +is up to you to fill in the values explicitly in your code. These allocation +functions increase +sz_* +but never touch +num_* +(unless there is an allocation failure, in which case they reset both +sz_* +and +num_* +to zero). These functions return +Success +if they succeed, +BadAlloc +if they are not able to allocate space, or +BadValue +if a parameter is not as expected. -To allocate rows in a section, use -XkbAllocGeomRows -. +To allocate space for an arbitrary number of outlines to a shape, use +XkbAllocGeomOutlines. - - - - - - - - -Status -XkbAllocGeomRows -( -section -, - num_needed -) - - - - -XkbSectionPtr -section -; /* section for which rows should be allocated */ - - - - -int - num_needed -; /* number of new rows required */ - - - - - - - - -XkbAllocGeomRows - allocates num_needed rows and adds them to the section. No initialization of -the rows is done. +XkbAllocGeomOutlines + + + Status XkbAllocGeomOutlines + + + XkbShapePtr shape + int num_needed + + + + + + shape + + + + shape for which outlines should be allocated + + + + + + num_needed + + + + number of new outlines required + + + + + + +XkbAllocGeomOutlines +allocates space for +num_needed +outlines in the specified +shape. +The outlines are not initialized. + + + + +To free geometry outlines, use +XkbFreeGeomOutlines. + + + +XkbFreeGeomOutlines + + + void XkbFreeGeomOutlines + + + XkbShapePtr shape + int first + int count + Bool free_all + + + + + + shape + + + + shape in which outlines should be freed + + + + + + first + + + + first outline to be freed + + + + + + count + + + + number of outlines to be freed + + + + + + free_all + + + + True ⇒ all outlines are freed + + + + + + +If free_all is +True, +all outlines are freed regardless of the value of first or count. Otherwise, +count outlines are freed beginning with the one specified by first. -To free rows in a section, use -XkbFreeGeomRows -. +To allocate space for an arbitrary number of keys to a row, use +XkbAllocGeomKeys. - - - - - - - -void -XkbFreeGeomRows -( -section -, - first -, - count -, - free_all -) - - - - -XkbSectionPtr - section -; /* section in which rows should be freed */ - - - - -int - first -; /* first row to be freed. */ - - - - -int - count -; /* number of rows to be freed */ - - - - -Bool - free_all; - /* -True - => all rows are freed */ - - - - - - - -If free_all is -True -, all rows are freed regardless of the value of first and count. Otherwise, the -number of rows specified by count are freed, beginning with the row specified -by first in the specified section. +XkbAllocGeomKeys + + + Status XkbAllocGeomKeys + + + XkbRowPtr row + int num_needed + + + + + + row + + + + row to which keys should be allocated + + + + + + num_needed + + + + number of new keys required + + + + + + +XkbAllocGeomKeys +allocates num_needed keys and adds them to the row. No initialization of the +keys is done. -To allocate overlays in a section, use -XkbAllocGeomOverlays -. +To free geometry keys, use +XkbFreeGeomKeys. + + + +XkbFreeGeomKeys + + + void XkbFreeGeomKeys + + + XkbRowPtr row + int first + int count + Bool free_all + + + + + + row + + + + row in which keys should be freed + + + + + + first + + + + first key to be freed + + + + + + count + + + + number of keys to be freed + + + + + + free_all + + + + True ⇒ all keys are freed + + + + + + +If free_all is +True, +all keys are freed regardless of the value of first or count. Otherwise, +count keys are freed beginning with the one specified by first. - - - - - - - -Status -XkbAllocGeomOverlays -( -section -, - num_needed -) - - - - -XkbSectionPtr -section -; /* section for which overlays should be allocated */ - - - - -int - num_needed -; /* number of new overlays required */ - - - - - - - -XkbAllocGeomRows - allocates num_needed overlays and adds them to the section. No initialization -of the overlays is done. +To allocate geometry properties, use +XkbAllocGeomProps. + + + +XkbAllocGeomProps + + + Status XkbAllocGeomProps + + + XkbGeometryPtr geom + int num_needed + + + + + + geom + + + + geometry for which properties should be allocated + + + + + + num_needed + + + + number of new properties required + + + + + + +XkbAllocGeomProps +allocates space for num_needed properties and adds them to the specified +geometry +geom. +No initialization of the properties is done. A geometry property associates +an arbitrary string with an equally arbitrary name. Geometry properties can be +used to provide hints to programs that display images of keyboards, but they +are not interpreted by Xkb. No other geometry structures refer to geometry +properties. -To free rows in an section, use -XkbFreeGeomOverlays -. +To free geometry properties, use +XkbFreeGeomProperties. + + + +XkbFreeGeomProperties + + + void XkbFreeGeomProperties + + + XkbGeometryPtr geom + int first + int count + Bool free_all + + + + + + geom + + + + geometry in which properties should be freed + + + + + + first + + + + first property to be freed + + + + + + count + + + + number of properties to be freed + + + + + + free_all + + + + True ⇒ all properties are freed + + + + + + +If free_all is +True, +all properties are freed regardless of the value of first or count. +Otherwise, count properties are freed beginning with the one specified by first. - - - - - - - -void -XkbFreeGeomOverlays -( -section -, - first -, - count -, - free_all -) - - - - -XkbSectionPtr - section -; /* section in which overlays should be freed */ - - - - -int - first -; /* first overlay to be freed. */ - - - - -int - count -; /* number of overlays to be freed */ - - - - -Bool - free_all; - /* -True - => all overlays are freed */ - - - - - - -If free_all is -True -, all overlays are freed regardless of the value of first and count. Otherwise, -the number of overlays specified by count are freed, beginning with the overlay -specified by first in the specified section. +To allocate geometry key aliases, use +XkbAllocGeomKeyAliases. + + + +XkbAllocGeomKeyAliases + + + Status XkbAllocGeomKeyAliases + + + XkbGeometryPtr geom + int num_needed + + + + + + geom + + + + geometry for which key aliases should be allocated + + + + + + num_needed + + + + number of new key aliases required + + + + + + +XkbAllocGeomKeyAliases +allocates space for num_needed key aliases and adds them to the specified +geometry +geom. +A key alias is a pair of strings that associates an alternate name for a key +with the real name for that key. -To allocate rows in a overlay, use -XkbAllocGeomOverlayRows -. +To free geometry key aliases, use +XkbFreeGeomKeyAliases. + + + +XkbFreeGeomKeyAliases + + + void XkbFreeGeomKeyAliases + + + XkbGeometryPtr geom + int first + int count + Bool free_all + + + + + + geom + + + + geometry in which key aliases should be freed + + + + + + first + + + + first key alias to be freed + + + + + + count + + + + number of key aliases to be freed + + + + + + free_all + + + + True ⇒ all key aliases are freed + + + + + + +If free_all is +True, +all aliases in the top level of the specified geometry +geom +are freed regardless of the value of first or count. Otherwise, count aliases +in +geom +are freed beginning with the one specified by first. + + + + +To allocate geometry colors, use +XkbAllocGeomColors. + + + +XkbAllocGeomColors + + + Status XkbAllocGeomColors + + + XkbGeometryPtr geom + int num_needed + + + + + + geom + + + + geometry for which colors should be allocated + + + + + + num_needed + + + + number of new colors required. + + + + + + +XkbAllocGeomColors +allocates space for num_needed colors and adds them to the specified geometry +geom. +A color name is a string whose interpretation is not specified by Xkb. All +other geometry data structures refer to colors using their indices in this +global list or pointers to colors in this list. - - - - - - - -Status -XkbAllocGeomOverlayRows -( -overlay -, - num_needed -) - - - - -XkbSectionPtr -overlay -; /* section for which rows should be allocated */ - - - - -int - num_needed -; /* number of new rows required */ - - - - - - - -XkbAllocGeomOverlayRows - allocates num_needed rows and adds them to the overlay. No initialization of -the rows is done. +To free geometry colors, use +XkbFreeGeomColors. + + + +XkbFreeGeomColors + + + void XkbFreeGeomColors + + + XkbGeometryPtr geom + int first + int count + Bool free_all + + + + + + geom + + + + geometry in which colors should be freed + + + + + + first + + + + first color to be freed + + + + + + count + + + + number of colors to be freed + + + + + + free_all + + + + True ⇒ all colors are freed + + + + + + +If free_all is +True, +all colors are freed regardless of the value of first or count. Otherwise, +count colors are freed beginning with the one specified by first. -To free rows in an overlay, use -XkbFreeGeomOverlayRows -. +To allocate points in an outline, use +XkbAllocGeomPoints. + + + +XkbAllocGeomPoints + + + Status XkbAllocGeomPoints + + + XkbOutlinePtr outline + int num_needed + + + + + + outline + + + + outline for which points should be allocated + + + + + + num_needed + + + + number of new points required + + + + + + +XkbAllocGeomPoints +allocates space for +num_needed +points in the specified +outline. +The points are not initialized. + + + + +To free points in a outline, use +XkbFreeGeomPoints. + + + +XkbFreeGeomPoints + + + void XkbFreeGeomPoints + + + XkbOutlinePtr outline + int first + int count + Bool free_all + + + + + + outline + + + + outline in which points should be freed + + + + + + first + + + + first point to be freed. + + + + + + count + + + + number of points to be freed + + + + + + free_all + + + + True ⇒ all points are freed + + + + + + +If free_all is +True, +all points are freed regardless of the value of first and count. Otherwise, +the number of points specified by count are freed, beginning with the point +specified by first in the specified outline. - - - - - - - -void -XkbFreeGeomOverlayRows -( -overlay -, - first -, - count -, - free_all -) - - - - -XkbSectionPtr - overlay -; /* section in which rows should be freed */ - - - - -int - first -; /* first row to be freed. */ - - - - -int - count -; /* number of rows to be freed */ - - - - -Bool - free_all; - /* -True - => all rows are freed */ - - - - - - -If free_all is -True -, all rows are freed regardless of the value of first and count. Otherwise, the -number of rows specified by count are freed, beginning with the row specified -by first in the specified overlay. +To allocate space for an arbitrary number of geometry shapes, use +XkbAllocGeomShapes. + + + +XkbAllocGeomShapes + + + Status XkbAllocGeomShapes + + + XkbGeometryPtr geom + int num_needed + + + + + + geom + + + + geometry for which shapes should be allocated + + + + + + num_needed + + + + number of new shapes required + + + + + + +XkbAllocGeomShapes +allocates space for +num_needed +shapes in the specified geometry +geom. +The shapes are not initialized. + + + + +To free geometry shapes, use +XkbFreeGeomShapes. + + + +XkbFreeGeomShapes + + + void XkbFreeGeomShapes + + + XkbGeometryPtr geom + int first + int count + Bool free_all + + + + + + geom + + + + geometry in which shapes should be freed + + + + + + first + + + + first shape to be freed + + + + + + count + + + + number of shapes to be freed + + + + + + free_all + + + + True ⇒ all shapes are freed + + + + + + +If free_all is +True, +all shapes in the geometry are freed regardless of the values of first and +count. Otherwise, count shapes are freed, beginning with the shape specified by +first. -To allocate keys in an overlay row, use -XkbAllocGeomOverlayKeys -. +To allocate geometry sections, use +XkbAllocGeomSections. + + + +XkbAllocGeomSections + + + Status XkbAllocGeomSections + + + XkbGeometryPtr geom + int num_needed + + + + + + geom + + + + geometry for which sections should be allocated + + + + + + num_needed + + + + number of new sections required + + + + + + +XkbAllocGeomSections +allocates num_needed sections and adds them to the geometry geom. No +initialization of the sections is done. - - - - - - - -Status -XkbAllocGeomOverlayKeys -( -row -, - num_needed -) - - - - -XkbRowPtr -row -; /* section for which rows should be allocated */ - - - - -int - num_needed -; /* number of new rows required */ - - - - - - - -XkbAllocGeomOverlayKeys - allocates num_needed keys and adds them to the row. No initialization of the -keys is done. +To free geometry sections, use +XkbFreeGeomSections. + + + +XkbFreeGeomSections + + + void XkbFreeGeomSections + + + XkbGeometryPtr geom + int first + int count + Bool free_all + + + + + + geom + + + + geometry in which sections should be freed + + + + + + first + + + + first section to be freed. + + + + + + count + + + + number of sections to be freed + + + + + + free_all + + + + True ⇒ all sections are freed + + + + + + +If free_all is +True, +all sections are freed regardless of the value of first and count. Otherwise, +the number of sections specified by count are freed, beginning with the section +specified by first in the specified geometry. -To free keys in an overlay row, use -XkbFreeGeomOverlayKeys -. +To allocate rows in a section, use +XkbAllocGeomRows. + + + +XkbAllocGeomRows + + + Status XkbAllocGeomRows + + + XkbSectionPtr section + int num_needed + + + + + + section + + + + section for which rows should be allocated + + + + + + num_needed + + + + number of new rows required + + + + + + +XkbAllocGeomRows +allocates num_needed rows and adds them to the section. No initialization of +the rows is done. - - - - - - - -void -XkbFreeGeomOverlayKeys -( -row -, - first -, - count -, - free_all -) - - - - -XkbRowPtr - row -; /* row in which keys should be freed */ - - - - -int - first -; /* first key to be freed. */ - - - - -int - count -; /* number of keys to be freed */ - - - - -Bool - free_all; - /* -True - => all keys are freed */ - - - - - - -If free_all is -True -, all keys are freed regardless of the value of first and count. Otherwise, the -number of keys specified by count are freed, beginning with the key specified -by first in the specified row. +To free rows in a section, use +XkbFreeGeomRows. + + + +XkbFreeGeomRows + + + void XkbFreeGeomRows + + + XkbSectionPtr section + int first + int count + Bool free_all + + + + + + section + + + + section in which rows should be freed + + + + + + first + + + + first row to be freed. + + + + + + count + + + + number of rows to be freed + + + + + + free_all + + + + True ⇒ all rows are freed + + + + + + +If free_all is +True, +all rows are freed regardless of the value of first and count. Otherwise, the +number of rows specified by count are freed, beginning with the row specified +by first in the specified section. -To allocate doodads that are global to a keyboard geometry, use -XkbAllocGeomDoodads -. +To allocate overlays in a section, use +XkbAllocGeomOverlays. + + + +XkbAllocGeomOverlays + + + Status XkbAllocGeomOverlays + + + XkbSectionPtr section + int num_needed + + + + + + section + + + + section for which overlays should be allocated + + + + + + num_needed + + + + number of new overlays required + + + + + + +XkbAllocGeomRows +allocates num_needed overlays and adds them to the section. No initialization +of the overlays is done. - - - - - - - -Status -XkbAllocGeomDoodads -( -geom -, - num_needed -) - - - - -XkbGeometryPtr - geom -; /* geometry for which doodads should be allocated */ - - - - -int - num_needed -; /* number of new doodads required */ - - - - - - - -XkbAllocGeomDoodads - allocates num_needed doodads and adds them to the specified geometry -geom -. No initialization of the doodads is done. +To free rows in an section, use +XkbFreeGeomOverlays. + + + +XkbFreeGeomOverlays + + + void XkbFreeGeomOverlays + + + XkbSectionPtr section + int first + int count + Bool free_all + + + + + + section + + + + section in which overlays should be freed + + + + + + first + + + + first overlay to be freed. + + + + + + count + + + + number of overlays to be freed + + + + + + free_all + + + + True ⇒ all overlays are freed + + + + + + +If free_all is +True, +all overlays are freed regardless of the value of first and count. Otherwise, +the number of overlays specified by count are freed, beginning with the overlay +specified by first in the specified section. -To allocate doodads that are specific to a section, use -XkbAllocGeomSectionDoodads -. +To allocate rows in a overlay, use +XkbAllocGeomOverlayRows. + + + +XkbAllocGeomOverlayRows + + + Status XkbAllocGeomOverlayRows + + + XkbSectionPtr overlay + int num_needed + + + + + + overlay + + + + section for which rows should be allocated + + + + + + num_needed + + + + number of new rows required + + + + + + +XkbAllocGeomOverlayRows +allocates num_needed rows and adds them to the overlay. No initialization of +the rows is done. - - - - - - - -Status -XkbAllocGeomSectionDoodads -( -section -, - num_needed -) - - - - -XkbSectionPtr - section -; /* section for which doodads should be allocated */ - - - - -int - num_needed -; /* number of new doodads required */ - - - - - - - -XkbAllocGeomSectionDoodads - allocates num_needed doodads and adds them to the specified -section -. No initialization of the doodads is done. +To free rows in an overlay, use +XkbFreeGeomOverlayRows. + + + +XkbFreeGeomOverlayRows + + + void XkbFreeGeomOverlayRows + + + XkbSectionPtr overlay + int first + int count + Bool free_all + + + + + + overlay + + + + section in which rows should be freed + + + + + + first + + + + first row to be freed. + + + + + + count + + + + number of rows to be freed + + + + + + free_all + + + + True ⇒ all rows are freed + + + + + + +If free_all is +True, +all rows are freed regardless of the value of first and count. Otherwise, the +number of rows specified by count are freed, beginning with the row specified +by first in the specified overlay. -To free geometry doodads, use -XkbFreeGeomDoodads -. +To allocate keys in an overlay row, use +XkbAllocGeomOverlayKeys. + + + +XkbAllocGeomOverlayKeys + + + Status XkbAllocGeomOverlayKeys + + + XkbRowPtr row + int num_needed + + + + + + row + + + + section for which rows should be allocated + + + + + + num_needed + + + + number of new rows required + + + + + + +XkbAllocGeomOverlayKeys +allocates num_needed keys and adds them to the row. No initialization of the +keys is done. - - - - - - - -void -XkbFreeGeomDoodads -( -doodads -, - count -, - free_all -) - - - - -XkbDoodadPtr - doodads -; /* doodads to be freed */ - - - - -int - count -; /* number of doodads to be freed */ - - - - -Bool - free_all; - /* -True - => all doodads are freed */ - - - - - - -If -free_all - is -True -, all doodads in the array are freed, regardless of the value of count. -Otherwise, count doodads are freed. +To free keys in an overlay row, use +XkbFreeGeomOverlayKeys. + + + +XkbFreeGeomOverlayKeys + + + void XkbFreeGeomOverlayKeys + + + XkbRowPtr row + int first + int count + Bool free_all + + + + + + row + + + + row in which keys should be freed + + + + + + first + + + + first key to be freed. + + + + + + count + + + + number of keys to be freed + + + + + + free_all + + + + True ⇒ all keys are freed + + + + + + +If free_all is +True, +all keys are freed regardless of the value of first and count. Otherwise, the +number of keys specified by count are freed, beginning with the key specified +by first in the specified row. -To allocate an entire geometry, use -XkbAllocGeometry -. - +To allocate doodads that are global to a keyboard geometry, use +XkbAllocGeomDoodads. + + +XkbAllocGeomDoodads + + + Status XkbAllocGeomDoodads + + + XkbGeometryPtr geom + int num_needed + + + + + + geom + + + + geometry for which doodads should be allocated + + + + + + num_needed + + + + number of new doodads required + + + + + + +XkbAllocGeomDoodads +allocates num_needed doodads and adds them to the specified geometry +geom. +No initialization of the doodads is done. + + + + +To allocate doodads that are specific to a section, use +XkbAllocGeomSectionDoodads. + + + +XkbAllocGeomSectionDoodads + + + Status XkbAllocGeomSectionDoodads + + + XkbSectionPtr section + int num_needed + + + + + + section + + + + section for which doodads should be allocated + + + + + + num_needed + + + + number of new doodads required + + + + + + +XkbAllocGeomSectionDoodads +allocates num_needed doodads and adds them to the specified +section. +No initialization of the doodads is done. + + + + +To free geometry doodads, use +XkbFreeGeomDoodads. + + + +XkbFreeGeomDoodads + + + void XkbFreeGeomDoodads + + + XkbDoodadPtr doodads + int count + Bool free_all + + + + + + doodads + + + + doodads to be freed + + + + + + count + + + + number of doodads to be freed + + + + + + free_all + + + + True ⇒ all doodads are freed + + + + + + +If +free_all +is +True, +all doodads in the array are freed, regardless of the value of count. +Otherwise, count doodads are freed. + - - - - - - - -Status -XkbAllocGeometry -( -xkb -, - sizes -) - - - - -XkbDescPtr - xkb -; /* keyboard description for which geometry is to be allocated */ - - - - -XkbGeometrySizesPtr - sizes -; /* initial sizes for all geometry components */ - - - - - - -XkbAllocGeometry - allocates a keyboard geometry and adds it to the keyboard description +To allocate an entire geometry, use +XkbAllocGeometry. + + + +XkbAllocGeometry + + + Status XkbAllocGeometry + + + XkbDescPtr xkb + XkbGeometrySizesPtr sizes + + + + + + xkb + + + + keyboard description for which geometry is to be allocated + + + + + + sizes + + + + initial sizes for all geometry components + + + + + + +XkbAllocGeometry +allocates a keyboard geometry and adds it to the keyboard description specified by xkb. The keyboard description should be obtained via the XkbGetKeyboard or XkbAllockeyboard functions. The sizes parameter specifies the number of elements to be reserved for the subcomponents of the keyboard @@ -4121,63 +4214,64 @@ colors, shapes, sections, and doodads. -To free an entire geometry, use -XkbFreeGeometry -. - - - - - - - - - - -void -XkbFreeGeometry -( -geom -, - which -, - free_all -) - - - - -XkbGeometryPtr - geom -; /* geometry to be freed */ - - - - -unsigned int - which -; /* mask of geometry components to be freed */ - - - - -Bool - free_all; - /* -True - => the entire geometry is freed. */ - - - - - +To free an entire geometry, use +XkbFreeGeometry. + + + +XkbFreeGeometry + + + void XkbFreeGeometry + + + XkbGeometryPtr geom + unsigned int which + Bool free_all + + + + + + geom + + + + geometry to be freed + + + + + + which + + + + mask of geometry components to be freed + + + + + + free_all + + + + True ⇒ the entire geometry is freed. + + + + The values of which and free_all determine how much of the specified geometry is freed. The valid values for which are: - - + #define XkbGeomPropertiesMask (1<<0) #define XkbGeomColorsMask (1<<1) #define XkbGeomShapesMask (1<<2) @@ -4187,9 +4281,9 @@ is freed. The valid values for which are: -If free_all is -True -, the entire geometry is freed regardless of the value of which. Otherwise, the +If free_all is +True, +the entire geometry is freed regardless of the value of which. Otherwise, the portions of the geometry specified by which are freed. diff --git a/libX11/specs/XKB/ch14.xml b/libX11/specs/XKB/ch14.xml index 1fcc76800..cb30105c5 100644 --- a/libX11/specs/XKB/ch14.xml +++ b/libX11/specs/XKB/ch14.xml @@ -1,3 +1,6 @@ + + Xkb Keyboard Mapping @@ -11,14 +14,21 @@ utilities for manipulating the keyboard mapping. The mapping consists of two components, a server map and a client map. The - -client - map is the collection of information a client needs to interpret key events +client map + +client map + +mapclient +is the collection of information a client needs to interpret key events from the keyboard. It contains a global list of key types and an array of key symbol maps, each of which describes the symbols bound to a key and the rules -to be used to interpret those symbols. The -server - map contains the information the server needs to interpret key events. This +to be used to interpret those symbols. The +server map + +server map + +mapserver +contains the information the server needs to interpret key events. This includes actions and behaviors for each key, explicit components for a key, and the virtual modifiers and the per-key virtual modifier mapping. @@ -26,20 +36,25 @@ the virtual modifiers and the per-key virtual modifier mapping. For detailed information on particular components of the keyboard map, refer to -Chapter 15, "Xkb Client Keyboard Mapping" and Chapter 16, "Xkb Server Keyboard -Mapping." +, and +. Notation and Terminology + +level + +shift level + The graphic characters or control functions that may be accessed by one key are -logically arranged in groups and levels, where -group - and -level - are defined as in the ISO9995 standard: +logically arranged in groups and levels, where +group +and +level +are defined as in the ISO9995 standard: @@ -74,30 +89,32 @@ character the key is capable of generating. -Level is often referred to as "Shift Level". Levels are numbered sequentially -starting at one. +Level is often referred to as Shift Level. +Levels are numbered sequentially starting at one. Shift level is derived from the modifier state, but not necessarily -in the same way for all keys. For example, the -Shift - modifier selects shift level 2 on most keys, but for keypad keys the modifier -bound to -Num_Lock - (that is, the -NumLock - virtual modifier) also selects shift level 2. +in the same way for all keys. For example, the +Shift +modifier selects shift level 2 on most keys, but for keypad keys the modifier +bound to +Num_Lock +(that is, the +NumLock +virtual modifier) also selects shift level 2. For example, consider the following key (the gray characters indicate symbols that are implied or expected but are not actually engraved on the key): - - - - - +
+ Shift Levels and Groups + + + + +
+For example, Xkb allows key types where the +Control +modifier can be used to access the shift level two of a key. Key types are in +the client map component and are described in detail in section 15.2. Xkb provides precise specification of the behavior of a key using key behaviors. Key behaviors are in the server map component and are described in -detail in section 16.2. +detail in section 16.2. @@ -214,148 +228,150 @@ detail in section 16.2. Xkb provides two functions to obtain the keyboard mapping components from the -server. The first function, -XkbGetMap -, allocates an -XkbDescRec - structure, retrieves mapping components from the server, and stores them in -the -XkbDescRec - structure it just allocated. The second function, -XkbGetUpdatedMap -, retrieves mapping components from the server and stores them in an -XkbDescRec - structure that has previously been allocated. +server. The first function, +XkbGetMap, +allocates an +XkbDescRec +structure, retrieves mapping components from the server, and stores them in +the +XkbDescRec +structure it just allocated. The second function, +XkbGetUpdatedMap, +retrieves mapping components from the server and stores them in an +XkbDescRec +structure that has previously been allocated. -To allocate an -XkbDescRec - structure and populate it with the server’s keyboard client map and server -map, use -XkbGetMap. XkbGetMap -is similar to -XkbGetKeyboard - (see section 6.2), but is used only for obtaining the address of an -XkbDescRec - structure that is populated with keyboard mapping components. It allows finer +To allocate an +XkbDescRec +structure and populate it with the server’s keyboard client map and server +map, use +XkbGetMap. +XkbGetMap +is similar to +XkbGetKeyboard +(see section 6.2), but is used only for obtaining the address of an +XkbDescRec +structure that is populated with keyboard mapping components. It allows finer control over which substructures of the keyboard mapping components are to be -populated. -XkbGetKeyboard - always returns fully populated components, while -XkbGetMap - can be instructed to return a partially populated component. +populated. +XkbGetKeyboard +always returns fully populated components, while +XkbGetMap +can be instructed to return a partially populated component. - - - - - - - -XkbDescPtr -XkbGetMap -( -display, which, device_spec -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int - which -; /* mask selecting subcomponents to populate */ - - - - -unsigned int - device_spec -; /* device_id, or -XkbUseCoreKbd - */ - - - - - +XkbGetMap + + + XkbDescPtr XkbGetMap + + + Display *display + unsigned int which + unsigned int device_spec + + + + + + display + + + + connection to X server + + + + + + which + + + + mask selecting subcomponents to populate + + + + + + device_spec + + + + device_id, or XkbUseCoreKbd + + + + -The -which - mask is a bitwise inclusive OR of the masks defined in Table 14.1. Only those +The +which +mask is a bitwise inclusive OR of the masks defined in +Table 14.1. Only those portions of the keyboard server map and the keyboard client maps that are -specified in -which - are allocated and populated. +specified in +which +are allocated and populated. In addition to allocating and obtaining the server map and the client map, - -XkbGetMap - also sets the -device_spec -, the -min_key_code - -, -and -max_key_code - fields of the keyboard description. +XkbGetMap +also sets the +device_spec, +the +min_key_code, +and +max_key_code +fields of the keyboard description. - -XkbGetMap - is synchronous; it queries the server for the desired information, waits for a -reply, and then returns. If successful -, XkbGetMap - returns a pointer to the -XkbDescRec - structure it allocated. If unsuccessful, -XkbGetMap - returns -NULL -. When unsuccessful, one of the following protocol errors is also generated: - -BadAlloc - (unable to allocate the -XkbDescRec - structure), -BadValue - (some mask bits in -which - are undefined) -, - or -BadImplementation - (a compatible version of the Xkb extension is not available in the server). To -free the returned data, use -XkbFreeClientMap -. +XkbGetMap +is synchronous; it queries the server for the desired information, waits for a +reply, and then returns. If successful, +XkbGetMap +returns a pointer to the +XkbDescRec +structure it allocated. If unsuccessful, +XkbGetMap +returns +NULL. +When unsuccessful, one of the following protocol errors is also generated: +BadAlloc +(unable to allocate the +XkbDescRec +structure), +BadValue +(some mask bits in +which +are undefined), +or +BadImplementation +(a compatible version of the Xkb extension is not available in the server). To +free the returned data, use +XkbFreeClientMap. Xkb also provides convenience functions to get partial component definitions -from the server. These functions are specified in the "convenience functions" -column in Table 14.1. Refer to the sections listed in the table for more +from the server. These functions are specified in the +convenience functions +column in Table 14.1. +Refer to the sections listed in the table for more information on these functions. -
Rotated Keyboard Sections Keyboard with Four Sections Xkb Geometry Data Structures Xkb Geometry Data Structures (Doodads) Xkb Geometry Data Structures (Overlays) Key Surface, Shape Outlines, and Bounding Box Shift Levels and Groups
+
Xkb Mapping Component Masks and Convenience Functions @@ -377,94 +393,94 @@ information on these functions. - XkbKeyTypesMask + XkbKeyTypesMask (1<<0) client - types - size_types - num_types + types + size_types + num_types - XkbGetKeyTypes - XkbResizeKeyType - XkbCopyKeyType - XkbCopyKeyTypes + XkbGetKeyTypes + XkbResizeKeyType + XkbCopyKeyType + XkbCopyKeyTypes - 15.2 + 15.2 - XkbKeySymsMask + XkbKeySymsMask (1<<1) client - syms - size_syms - num_syms - key_sym_map + syms + size_syms + num_syms + key_sym_map - XkbGetKeySyms - XkbResizeKeySyms - XkbChangeTypes­OfKey + XkbGetKeySyms + XkbResizeKeySyms + XkbChangeTypes­OfKey - 15.3 + 15.3 - XkbModifierMapMask + XkbModifierMapMask (1<<2) client - modmap - XkbGetKeyModifier­Map - 15.4 + modmap + XkbGetKeyModifier­Map + 15.4 - XkbExplicitComponentsMask + XkbExplicitComponentsMask (1<<3) server - explicit - XkbGetKeyExplicit­Components - 16.3 + explicit + XkbGetKeyExplicit­Components + 16.3 - XkbKeyActionsMask + XkbKeyActionsMask (1<<4) server - key_acts - acts - num_acts - size_acts + key_acts + acts + num_acts + size_acts - XkbGetKeyActions - XkbResizeKey­Actions + XkbGetKeyActions + XkbResizeKey­Actions - 16.1 + 16.1 - XkbKeyBehaviorsMask + XkbKeyBehaviorsMask (1<<5) server - behaviors - XkbGetKey­Behaviors - 16.2 + behaviors + XkbGetKey­Behaviors + 16.2 - XkbVirtualModsMask + XkbVirtualModsMask (1<<6) server - vmods - XkbGetVirtualMods - 16.4 + vmods + XkbGetVirtualMods + 16.4 - XkbVirtualModMapMask + XkbVirtualModMapMask (1<<7) server - vmodmap - XkbGetVirtualMod­Map - 16.4 + vmodmap + XkbGetVirtualMod­Map + 16.4 @@ -472,9 +488,8 @@ information on these functions. Xkb defines combinations of these masks for convenience: - - + #define XkbResizableInfoMask (XkbKeyTypesMask) #define XkbAllClientInfoMask (XkbKeyTypesMask | XkbKeySymsMask | XkbModifierMapMask) @@ -493,88 +508,95 @@ these components and handle the interdependencies. To update the client or server map information in an existing keyboard -description, use XkbGetUpdatedMap. +description, use XkbGetUpdatedMap. - - - - - - - -Status -XkbGetUpdatedMap -( -display, which, xkb -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int - which -; /* mask selecting subcomponents to populate */ - - - - -XkbDescPtr -xkb -; /* keyboard description to be updated */ - - - - - +XkbGetUpdatedMap + + + Status XkbGetUpdatedMap + + + Display *display + unsigned int which + XkbDescPtr xkb + + + + + + display + + + + connection to X server + + + + + + which + + + + mask selecting subcomponents to populate + + + + + + xkb + + + + keyboard description to be updated + + + + -The -which - parameter is a bitwise inclusive OR of the masks in Table 14.1. If the needed -components of the -xkb - structure are not already allocated, -XkbGetUpdatedMap - allocates them. -XkbGetUpdatedMap - fetches the requested information for the device specified in the -XkbDescRec - passed in the -xkb - parameter. +The +which +parameter is a bitwise inclusive OR of the masks in +Table 14.1. +If the needed components of the +xkb +structure are not already allocated, +XkbGetUpdatedMap +allocates them. +XkbGetUpdatedMap +fetches the requested information for the device specified in the +XkbDescRec +passed in the +xkb +parameter. - -XkbGetUpdatedMap - is synchronous; it queries the server for the desired information, waits for a -reply, and then returns. If successful -, XkbGetUpdatedMap - returns -Success -. If unsuccessful, -XkbGetUpdatedMap - returns one of the following: -BadAlloc - (unable to allocate a component in the -XkbDescRec - structure), -BadValue - (some mask bits in -which - are undefined), -BadImplementation - (a compatible version of the Xkb extension is not available in the server or +XkbGetUpdatedMap +is synchronous; it queries the server for the desired information, waits for a +reply, and then returns. If successful, +XkbGetUpdatedMap +returns +Success. +If unsuccessful, +XkbGetUpdatedMap +returns one of the following: +BadAlloc +(unable to allocate a component in the +XkbDescRec +structure), +BadValue +(some mask bits in +which +are undefined), +BadImplementation +(a compatible version of the Xkb extension is not available in the server or the reply from the server was invalid). @@ -584,183 +606,190 @@ the reply from the server was invalid). There are two ways to make changes to map components: either change a local -copy of the keyboard map and call -XkbSetMap - to send the modified map to the server, or, to reduce network traffic, use -an - XkbMapChangesRec - structure and call XkbChangeMap. +copy of the keyboard map and call +XkbSetMap +to send the modified map to the server, or, to reduce network traffic, use +an +XkbMapChangesRec +structure and call XkbChangeMap. - - - - - - - -Bool -XkbSetMap -( -dpy -, - which -, - xkb -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int - which -; /* mask selecting subcomponents to update */ - - - - -XkbDescPtr - xkb -; /* description from which new values are taken */ - - - - - +XkbSetMap + + + Bool XkbSetMap + + + Display *dpy + unsigned int which + XkbDescPtr xkb + + + + + + dpy + + + + connection to X server + + + + + + which + + + + mask selecting subcomponents to update + + + + + + xkb + + + + description from which new values are taken + + + + -Use -XkbSetMap - to send a complete new set of values for entire components (for example, all -symbols, all actions, and so on) to the server. The -which - parameter specifies the components to be sent to the server, and is a bitwise -inclusive OR of the masks listed in Table 14.1. The -xkb - parameter is a pointer to an -XkbDescRec - structure and contains the information to be copied to the server. For each -bit set in the -which - parameter, -XkbSetMap - takes the corresponding structure values from the -xkb - parameter and sends it to the server specified by -dpy. +Use +XkbSetMap +to send a complete new set of values for entire components (for example, all +symbols, all actions, and so on) to the server. The +which +parameter specifies the components to be sent to the server, and is a bitwise +inclusive OR of the masks listed in +Table 14.1. The +xkb +parameter is a pointer to an +XkbDescRec +structure and contains the information to be copied to the server. For each +bit set in the +which +parameter, +XkbSetMap +takes the corresponding structure values from the +xkb +parameter and sends it to the server specified by +dpy. -If any components specified by -which - are not present in the -xkb - parameter, -XkbSetMap - returns -False -. Otherwise, it sends the update request to the server and returns -True -. -XkbSetMap - can generate -BadAlloc -, -BadLength -, and -BadValue - protocol errors. +If any components specified by +which +are not present in the +xkb +parameter, +XkbSetMap +returns +False. +Otherwise, it sends the update request to the server and returns +True. +XkbSetMap +can generate +BadAlloc, +BadLength, +and +BadValue +protocol errors. Key types, symbol maps, and actions are all interrelated; changes in one require changes in the others. Xkb provides functions to make it easier to edit -these components and handle the interdependencies. Table 14.1 lists these +these components and handle the interdependencies. +Table 14.1 lists these helper functions and provides a pointer to where they are defined. The XkbMapChangesRec Structure + +XkbMapChangesRec -Use the -XkbMapChangesRec - structure to identify and track partial modifications to the mapping +Use the +XkbMapChangesRec +structure to identify and track partial modifications to the mapping components and to reduce the amount of traffic between the server and clients. typedef struct _XkbMapChanges { - unsigned short changed; /* identifies valid components - in structure */ - KeyCode min_key_code; /* lowest numbered keycode for - device */ - KeyCode max_key_code; /* highest numbered keycode for - device */ - unsigned char first_type; /* index of first key type - modified */ - unsigned char num_types; /* # types modified */ - KeyCode first_key_sym; /* first key whose key_sym_map - changed */ - unsigned char num_key_syms; /* # key_sym_map - entries changed */ - KeyCode first_key_act; /* first key whose key_acts - entry changed */ - unsigned char num_key_acts; /* # key_acts - entries changed */ - KeyCode first_key_behavior; /* first key whose behaviors - changed */ - unsigned char num_key_behaviors; /* # behaviors - entries changed */ - KeyCode first_key_explicit; /* first key whose explicit - entry changed */ - unsigned char num_key_explicit; /* # explicit - entries changed */ - KeyCode first_modmap_key; /* first key whose modmap - entry changed */ - unsigned char num_modmap_keys; /* # modmap - entries changed */ - KeyCode first_vmodmap_key; /* first key whose vmodmap - changed */ - unsigned char num_vmodmap_keys; /* # vmodmap - entries changed */ - unsigned char pad1; /* reserved */ - unsigned short vmods; /* mask indicating which vmods - changed */ -} XkbMapChangesRec,*XkbMapChangesPtr; + unsigned short changed; /* identifies valid components + in structure */ + KeyCode min_key_code; /* lowest numbered keycode for + device */ + KeyCode max_key_code; /* highest numbered keycode for + device */ + unsigned char first_type; /* index of first key type + modified */ + unsigned char num_types; /* # types modified */ + KeyCode first_key_sym; /* first key whose key_sym_map + changed */ + unsigned char num_key_syms; /* # key_sym_map + entries changed */ + KeyCode first_key_act; /* first key whose key_acts + entry changed */ + unsigned char num_key_acts; /* # key_acts + entries changed */ + KeyCode first_key_behavior; /* first key whose behaviors + changed */ + unsigned char num_key_behaviors; /* # behaviors + entries changed */ + KeyCode first_key_explicit; /* first key whose explicit + entry changed */ + unsigned char num_key_explicit; /* # explicit + entries changed */ + KeyCode first_modmap_key; /* first key whose modmap + entry changed */ + unsigned char num_modmap_keys; /* # modmap + entries changed */ + KeyCode first_vmodmap_key; /* first key whose vmodmap + changed */ + unsigned char num_vmodmap_keys; /* # vmodmap + entries changed */ + unsigned char pad1; /* reserved */ + unsigned short vmods; /* mask indicating which vmods + changed */ +} XkbMapChangesRec, *XkbMapChangesPtr; -The -changed - field identifies the map components that have changed in an -XkbDescRec - structure and may contain any of the bits in Table 14.1, which are also shown -in Table 14.2. Every 1 bit in -changed - also identifies which other fields in the -XkbMapChangesRec - structure contain valid values, as indicated in Table 14.2. The -min_key_code - and -max_key_code - fields are for reference only; they are ignored on any requests sent to the +The +changed +field identifies the map components that have changed in an +XkbDescRec +structure and may contain any of the bits in +Table 14.1, which are also shown +in Table 14.2. Every 1 bit in +changed +also identifies which other fields in the +XkbMapChangesRec +structure contain valid values, as indicated in +Table 14.2. The +min_key_code +and +max_key_code +fields are for reference only; they are ignored on any requests sent to the server and are always updated by the server whenever it returns the data for an - -XkbMapChangesRec -. +XkbMapChangesRec. -
+
XkbMapChangesRec Masks @@ -776,85 +805,85 @@ XkbMapChangesRec - XkbKeyTypesMask + XkbKeyTypesMask -first_type, -num_types +first_type, +num_types -map->type[first_type] .. -map->type[first_type + num_types - 1] +map->type[first_type] .. +map->type[first_type + num_types - 1] - XkbKeySymsMask + XkbKeySymsMask -first_key_sym, -num_key_syms +first_key_sym, +num_key_syms -map->key_sym_map[first_key_sym] .. -map->key_sym_map[first_key_sym + num_key_syms - 1] +map->key_sym_map[first_key_sym] .. +map->key_sym_map[first_key_sym + num_key_syms - 1] - XkbModifierMapMask + XkbModifierMapMask -first_modmap_key, -num_modmap_keys +first_modmap_key, +num_modmap_keys -map->modmap[first_modmap_key] .. -map->modmap[first_modmap_key + num_modmap_keys-1] +map->modmap[first_modmap_key] .. +map->modmap[first_modmap_key + num_modmap_keys-1] - XkbExplicitComponentsMask + XkbExplicitComponentsMask -first_key_explicit, -num_key_explicit +first_key_explicit, +num_key_explicit -server->explicit[first_key_explicit] .. -server->explicit[first_key_explicit + num_key_explicit - 1] +server->explicit[first_key_explicit] .. +server->explicit[first_key_explicit + num_key_explicit - 1] - XkbKeyActionsMask + XkbKeyActionsMask -first_key_act, -num_key_acts +first_key_act, +num_key_acts -server->key_acts[first_key_act] .. -server->key_acts[first_key_act + num_key_acts - 1] +server->key_acts[first_key_act] .. +server->key_acts[first_key_act + num_key_acts - 1] - XkbKeyBehaviorsMask + XkbKeyBehaviorsMask -first_key_behavior, -num_key_behaviors +first_key_behavior, +num_key_behaviors -server->behaviors[first_key_behavior] .. -server->behaviors[first_key_behavior + num_key_behaviors - 1] +server->behaviors[first_key_behavior] .. +server->behaviors[first_key_behavior + num_key_behaviors - 1] - XkbVirtuawModsMask - vmods - server->vmods[*] + XkbVirtualModsMask + vmods + server->vmods[*] - XkbVirtualModMapMask + XkbVirtualModMapMask -first_vmodmap_key, -num_vmodmap_keys +first_vmodmap_key, +num_vmodmap_keys -server->vmodmap[first_vmodmap_key] .. -server->vmodmap[first_vmodmap_key + num_vmodmap_keys - 1] +server->vmodmap[first_vmodmap_key] .. +server->vmodmap[first_vmodmap_key + num_vmodmap_keys - 1] @@ -864,94 +893,94 @@ XkbMapChangesRec To update only partial components of a keyboard description, modify the appropriate fields in the server and map components of a local copy of the -keyboard description, then call -XkbChangeMap - with an -XkbMapChangesRec - structure indicating which components have changed. +keyboard description, then call +XkbChangeMap +with an +XkbMapChangesRec +structure indicating which components have changed. - - - - - - - -Bool -XkbChangeMap -( -dpy -, - xkb -, - changes -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -XkbDescPtr - xkb -; /* description from which new values are taken */ - - - - -XkbMapChangesPtr - changes -; /*identifies component parts to update */ - - - - - +XkbChangeMap + + + Bool XkbChangeMap + + + Display *dpy + XkbDescPtr xkb + XkbMapChangesPtr changes + + + + + + dpy + + + + connection to X server + + + + + + xkb + + + + description from which new values are taken + + + + + + changes + + + + identifies component parts to update + + + + - -XkbChangeMap - copies any components specified by the -changes - structure from the keyboard description, -xkb -, to the X server specified by -dpy -. +XkbChangeMap +copies any components specified by the +changes +structure from the keyboard description, +xkb, +to the X server specified by +dpy. -If any components specified by -changes - are not present in the -xkb - parameter, -XkbChangeMap - returns -False -. Otherwise, it sends a request to the server and returns -True -. +If any components specified by +changes +are not present in the +xkb +parameter, +XkbChangeMap +returns +False. +Otherwise, it sends a request to the server and returns +True. - -XkbChangeMap - can generate -BadAlloc -, -BadLength -, and -BadValue - protocol errors. +XkbChangeMap +can generate +BadAlloc, +BadLength, +and +BadValue +protocol errors. @@ -960,97 +989,102 @@ BadValue Tracking Changes to Map Components + +eventsXkbMapNotify + +XkbMapNotifyEvent + -The Xkb extension reports -XkbMapNotify - events to clients wanting notification whenever a map component of the Xkb +The Xkb extension reports +XkbMapNotify +events to clients wanting notification whenever a map component of the Xkb description for a device changes. There are many different types of Xkb keyboard map changes. Xkb uses an event detail mask to identify each type of -change. The event detail masks are identical to the masks listed in Table 14.1. +change. The event detail masks are identical to the masks listed in +Table 14.1. -To receive -XkbMapNotify - events under all possible conditions, use -XkbSelectEvents - (see section 4.3) and pass -XkbMapNotifyMask - in both -bits_to_change - and -values_for_bits -. +To receive +XkbMapNotify +events under all possible conditions, use +XkbSelectEvents +(see section 4.3) and pass +XkbMapNotifyMask +in both +bits_to_change +and +values_for_bits. -To receive -XkbMapNotify - events only under certain conditions, use -XkbSelectEventDetails - using -XkbMapNotify - as the -event_type - and specifying the desired map changes in -bits_to_change - and -values_for_bits - using mask bits from Table 14.1. +To receive +XkbMapNotify +events only under certain conditions, use +XkbSelectEventDetails +using +XkbMapNotify +as the +event_type +and specifying the desired map changes in +bits_to_change +and +values_for_bits +using mask bits from Table 14.1. -The structure for -XkbMapNotify - events is: - +The structure for +XkbMapNotify +events is: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbMapNotify */ - int device; /* Xkb device ID, will not be XkbUseCoreKbd */ - unsigned int changed; /* identifies valid fields in rest of event */ - unsigned int resized; /* reserved */ - int first_type; /* index of first key type modified */ - int num_types /* # types modified */ - KeyCode min_key_code; /* minimum keycode for device */ - KeyCode max_key_code; /* maximum keycode for device */ - KeyCode first_key_sym; /* first key whose key_sym_map changed */ - KeyCode first_key_act; /* first key whose key_acts entry changed */ - KeyCode first_key_behavior; /* first key whose behaviors changed */ - KeyCode first_key_explicit; /* first key whose explicit entry changed */ - KeyCode first_modmap_key; /* first key whose modmap entry changed */ - KeyCode first_vmodmap_key; /* # modmap entries changed */ - int num_key_syms; /* # key_sym_map entries changed */ - int num_key_acts; /* # key_acts entries changed */ - int num_key_behaviors; /* # behaviors entries changed */ - int num_key_explicit; /* # explicit entries changed */ - int num_modmap_keys; /* # modmap entries changed */ - int num_vmodmap_keys; /* # vmodmap entries changed */ - unsigned in t vmods; /* mask indicating which vmods changed */ -} XkbMapNotifyEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbMapNotify */ + int device; /* Xkb device ID, will not be XkbUseCoreKbd */ + unsigned int changed; /* identifies valid fields in rest of event */ + unsigned int resized; /* reserved */ + int first_type; /* index of first key type modified */ + int num_types /* # types modified */ + KeyCode min_key_code; /* minimum keycode for device */ + KeyCode max_key_code; /* maximum keycode for device */ + KeyCode first_key_sym; /* first key whose key_sym_map changed */ + KeyCode first_key_act; /* first key whose key_acts entry changed */ + KeyCode first_key_behavior; /* first key whose behaviors changed */ + KeyCode first_key_explicit; /* first key whose explicit entry changed */ + KeyCode first_modmap_key; /* first key whose modmap entry changed */ + KeyCode first_vmodmap_key; /* # modmap entries changed */ + int num_key_syms; /* # key_sym_map entries changed */ + int num_key_acts; /* # key_acts entries changed */ + int num_key_behaviors; /* # behaviors entries changed */ + int num_key_explicit; /* # explicit entries changed */ + int num_modmap_keys; /* # modmap entries changed */ + int num_vmodmap_keys; /* # vmodmap entries changed */ + unsigned int vmods; /* mask indicating which vmods changed */ +} XkbMapNotifyEvent; -The -changed - field specifies the map components that have changed and is the bitwise -inclusive OR of the mask bits defined in Table 14.1. The other fields in this -event are interpreted as the like-named fields in an -XkbMapChangesRec - (see section 14.3.1). The -XkbMapNotifyEvent - structure also has an additional -resized - field that is reserved for future use. +The +changed +field specifies the map components that have changed and is the bitwise +inclusive OR of the mask bits defined in +Table 14.1. The other fields in this +event are interpreted as the like-named fields in an +XkbMapChangesRec +(see section 14.3.1). The +XkbMapNotifyEvent +structure also has an additional +resized +field that is reserved for future use. @@ -1059,9 +1093,9 @@ resized Allocating and Freeing Client and Server Maps -Calling -XkbGetMap - (see section 14.2) should be sufficient for most applications to get client +Calling +XkbGetMap +(see section 14.2) should be sufficient for most applications to get client and server maps. As a result, most applications do not need to directly allocate client and server maps. @@ -1070,28 +1104,26 @@ allocate client and server maps. If you change the number of key types or construct map components without loading the necessary components from the X server, do not allocate any map -components directly using -malloc - or -Xmalloc -. Instead, use the Xkb allocators, -XkbAllocClientMap, - and -XkbAllocServerMap -. +components directly using +malloc +or +Xmalloc. +Instead, use the Xkb allocators, +XkbAllocClientMap, +and +XkbAllocServerMap. -Similarly, use the Xkb destructors, -XkbFreeClientMap, - and -XkbFreeServerMap - instead of -free - or -Xfree -. +Similarly, use the Xkb destructors, +XkbFreeClientMap, +and +XkbFreeServerMap +instead of +free +or +Xfree. @@ -1100,66 +1132,69 @@ Xfree To allocate and initialize an empty client map description record, use - -XkbAllocClientMap. +XkbAllocClientMap. - - - - - - - -Status -XkbAllocClientMap -( -xkb, which, type_count -) - - - - -XkbDescPtr - xkb -; /* keyboard description in which to allocate client map */ - - - - -unsigned int - which -; /* mask selecting map components to allocate */ - - - - -unsigned int - type_count -; /* value of -num_types - field in map to be allocated */ - - - - - +XkbAllocClientMap + + + Status XkbAllocClientMap + + + XkbDescPtr xkb + unsigned int which + unsigned int type_count + + + + + + xkb + + + + keyboard description in which to allocate client map + + + + + + which + + + + mask selecting map components to allocate + + + + + + type_count + + + + value of num_types field in map to be allocated + + + + - -XkbAllocClientMap - allocates and initializes an empty client map in the -map - field of the keyboard description specified by -xkb -. The -which - parameter specifies the particular components of the client map structure to +XkbAllocClientMap +allocates and initializes an empty client map in the +map +field of the keyboard description specified by +xkb. +The +which +parameter specifies the particular components of the client map structure to allocate and is a mask composed by a bitwise inclusive OR of one or more of the -masks shown in Table 14.3. +masks shown in Table 14.3. -
+
XkbAllocClientMap Masks @@ -1173,116 +1208,115 @@ masks shown in Table 14.3. - XkbKeyTypesMask + XkbKeyTypesMask -The -type_count -field specifies the number of entries to preallocate for the -types - field of the client map. If the -type_count -field is less than -XkbNumRequiredTypes - (see section 15.2.1), returns -BadValue. +The +type_count +field specifies the number of entries to preallocate for the +types +field of the client map. If the +type_count +field is less than +XkbNumRequiredTypes +(see section 15.2.1), returns +BadValue. - XkbKeySymsMask + XkbKeySymsMask -The -min_key_code - and -max_key_code - fields of the -xkb - parameter are used to allocate the -syms - and -key_sym_map - fields of the client map. The fields are allocated to contain the maximum -number of entries necessary for -max_key_code - - -min_key_code - + 1 keys. +The +min_key_code +and +max_key_code +fields of the +xkb +parameter are used to allocate the +syms +and +key_sym_map +fields of the client map. The fields are allocated to contain the maximum +number of entries necessary for +max_key_code +− +min_key_code ++ 1 keys. - XkbModifierMapMask + XkbModifierMapMask -The -min_key_code - and -max_key_code - fields of the -xkb - parameter are used to allocate the -modmap - field of the client map. The field is allocated to contain the maximum number -of entries necessary for -max_key_code - - -min_key_code - + 1 keys. +The +min_key_code +and +max_key_code +fields of the +xkb +parameter are used to allocate the +modmap +field of the client map. The field is allocated to contain the maximum number +of entries necessary for +max_key_code +− +min_key_code ++ 1 keys.
-The -min_key_code - and -max_key_code - fields of the -xkb - parameter must be legal values if the -XkbKeySymsMask - or -XkbModifierMapMask - masks are set in the -which - parameter. If they are not valid, -XkbAllocClientMap - returns -BadValue -. +The +min_key_code +and +max_key_code +fields of the +xkb +parameter must be legal values if the +XkbKeySymsMask +or +XkbModifierMapMask +masks are set in the +which +parameter. If they are not valid, +XkbAllocClientMap +returns +BadValue. + -If the client map of the keyboard description is not -NULL -, and any fields are already allocated in the client map, -XkbAllocClientMap - does not overwrite the existing values; it simply ignores that part of the -request. The only exception is the -types - array. If -type_count - is greater than the current -num_types - field of the client map, -XkbAllocClientMap - resizes the -types - array and resets the -num_types - field accordingly. +If the client map of the keyboard description is not +NULL, +and any fields are already allocated in the client map, +XkbAllocClientMap +does not overwrite the existing values; it simply ignores that part of the +request. The only exception is the +types +array. If +type_count +is greater than the current +num_types +field of the client map, +XkbAllocClientMap +resizes the +types +array and resets the +num_types +field accordingly. -If -XkbAllocClientMap - is successful, it returns -Success -. Otherwise, it can return either -BadMatch -, -BadAlloc -, or -BadValue - errors. +If +XkbAllocClientMap +is successful, it returns +Success. +Otherwise, it can return either +BadMatch, +BadAlloc, +or +BadValue +errors. @@ -1291,91 +1325,96 @@ BadValue Freeing a Client Map -To free memory used by the client map member of an -XkbDescRec - structure, use -XkbFreeClientMap. +To free memory used by the client map member of an +XkbDescRec +structure, use +XkbFreeClientMap. - - - - - - - -void -XkbFreeClientMap -( -xkb, which, free_all -) - - - - -XkbDescPtr - xkb -; /* keyboard description containing client map to free */ - - - - -unsigned int - which -; /* mask identifying components of map to free */ - - - - -Bool - free_all -; /* -True - => free all client components and map itself */ - - - - - +XkbFreeClientMap + + + void XkbFreeClientMap + + + XkbDescPtr xkb + unsigned int which + Bool free_all + + + + + + xkb + + + + keyboard description containing client map to free + + + + + + which + + + + mask identifying components of map to free + + + + + + free_all + + + + True + ⇒ free all client components and map itself + + + + - -XkbFreeClientMap - frees the components of client map specified by -which - in the -XkbDescRec - structure specified by the -xkb - parameter and sets the corresponding structure component values to -NULL -. The -which - parameter specifies a combination of the client map masks shown in Table 14.3. +XkbFreeClientMap +frees the components of client map specified by +which +in the +XkbDescRec +structure specified by the +xkb +parameter and sets the corresponding structure component values to +NULL. +The +which +parameter specifies a combination of the client map masks shown in +Table 14.3. -If -free_all - is -True -, -which - is ignored; -XkbFreeClientMap - frees every non- -NULL - structure component in the client map, frees the -XkbClientMapRec - structure referenced by the -map - member of the -xkb - parameter, and sets the -map - member to -NULL. +If +free_all +is +True, +which +is ignored; +XkbFreeClientMap +frees every non- +NULL +structure component in the client map, frees the +XkbClientMapRec +structure referenced by the +map +member of the +xkb +parameter, and sets the +map +member to +NULL. @@ -1385,65 +1424,68 @@ NULL. To allocate and initialize an empty server map description record, use - -XkbAllocServerMap. +XkbAllocServerMap. - - - - - - - -Status -XkbAllocServerMap -( -xkb, which, count_acts -) - - - - -XkbDescPtr - xkb -; /* keyboard description in which to allocate server map */ - - - - -unsigned int - which -; /* mask selecting map components to allocate */ - - - - -unsigned int - count_acts -; /* value of -num_acts - field in map to be allocated */ - - - - - +XkbAllocServerMap + + + Status XkbAllocServerMap + + + XkbDescPtr xkb + unsigned int which + unsigned int count_acts + + + + + + xkb + + + + keyboard description in which to allocate server map + + + + + + which + + + + mask selecting map components to allocate + + + + + + count_acts + + + + value of num_acts field in map to be allocated + + + + - -XkbAllocServerMap - allocates and initializes an empty server map in the -server - field of the keyboard description specified by -xkb -. The -which - parameter specifies the particular components of the server map structure to -allocate, as specified in Table 14.4. +XkbAllocServerMap +allocates and initializes an empty server map in the +server +field of the keyboard description specified by +xkb. +The +which +parameter specifies the particular components of the server map structure to +allocate, as specified in Table 14.4. - +
XkbAllocServerMap Masks @@ -1457,62 +1499,62 @@ allocate, as specified in Table 14.4. - XkbExplicitComponentsMask + XkbExplicitComponentsMask -The -min_key_code - and -max_key_code - fields of the -xkb - parameter are used to allocate the -explicit +The +min_key_code +and +max_key_code +fields of the +xkb +parameter are used to allocate the +explicit field of the server map. - XkbKeyActionsMask + XkbKeyActionsMask -The -min_key_code - and -max_key_code - fields of the -xkb - parameter are used to allocate the -key_acts -field of the server map. The -count_acts - parameter is used to allocate the -acts - field of the server map. +The +min_key_code +and +max_key_code +fields of the +xkb +parameter are used to allocate the +key_acts +field of the server map. The +count_acts +parameter is used to allocate the +acts +field of the server map. - XkbKeyBehaviorsMask + XkbKeyBehaviorsMask -The -min_key_code - and -max_key_code - fields of the -xkb - parameter are used to allocate the -behaviors +The +min_key_code +and +max_key_code +fields of the +xkb +parameter are used to allocate the +behaviors field of the server map. - XkbVirtualModMapMask + XkbVirtualModMapMask -The -min_key_code - and -max_key_code - fields of the -xkb -parameter are used to allocate the -vmodmap +The +min_key_code +and +max_key_code +fields of the +xkb +parameter are used to allocate the +vmodmap field of the server map. @@ -1520,50 +1562,49 @@ field of the server map.
-The -min_key_code - and -max_key_code - fields of the -xkb - parameter must be legal values. If they are not valid, -XkbAllocServerMap - returns -BadValue -. +The +min_key_code +and +max_key_code +fields of the +xkb +parameter must be legal values. If they are not valid, +XkbAllocServerMap +returns +BadValue. + -If the server map of the keyboard description is not -NULL - and any fields are already allocated in the server map, -XkbAllocServerMap - does not overwrite the existing values. The only exception is with the - -acts -array. If the -count_acts -parameter is greater than the current -num_acts -field of the server map, -XkbAllocServerMap - resizes the -acts -array and resets the -num_acts +If the server map of the keyboard description is not +NULL +and any fields are already allocated in the server map, +XkbAllocServerMap +does not overwrite the existing values. The only exception is with the +acts +array. If the +count_acts +parameter is greater than the current +num_acts +field of the server map, +XkbAllocServerMap +resizes the +acts +array and resets the +num_acts field accordingly. -If -XkbAllocServerMap - is successful, it returns -Success -. Otherwise, it can return either -BadMatch - or -BadAlloc - errors. +If +XkbAllocServerMap +is successful, it returns +Success. +Otherwise, it can return either +BadMatch +or +BadAlloc +errors. @@ -1572,85 +1613,91 @@ BadAlloc Freeing a Server Map -To free memory used by the server member of an -XkbDescRec - structure, use -XkbFreeServerMap. +To free memory used by the server member of an +XkbDescRec +structure, use +XkbFreeServerMap. - - - - - - - -void -XkbFreeServerMap -( -xkb, which, free_all -) - - - - -XkbDescPtr - xkb -; /* keyboard description containing server map to free */ - - - - -unsigned int - which -; /* mask identifying components of map to free */ - - - - -Bool - free_all -; /* -True - => free all server map components and server itself */ - - - - - +XkbFreeServerMap + + + void XkbFreeServerMap + + + XkbDescPtr xkb + unsigned int which + Bool free_all + + + + + + xkb + + + + keyboard description containing server map to free + + + + + + which + + + + mask identifying components of map to free + + + + + + free_all + + + + True + ⇒ free all server map components and server itself + + + + -The -XkbFreeServerMap - function frees the specified components of server map in the -XkbDescRec - structure specified by the -xkb - parameter and sets the corresponding structure component values to -NULL -. The -which - parameter specifies a combination of the server map masks and is a bitwise -inclusive OR of the masks listed in Table 14.4. If -free_all - is -True -, -which - is ignored and -XkbFreeServerMap - frees every non- -NULL - structure component in the server map, frees the -XkbServerMapRec - structure referenced by the -server - member of the -xkb - parameter, and sets the -server - member to -NULL. +The +XkbFreeServerMap +function frees the specified components of server map in the +XkbDescRec +structure specified by the +xkb +parameter and sets the corresponding structure component values to +NULL. +The +which +parameter specifies a combination of the server map masks and is a bitwise +inclusive OR of the masks listed in +Table 14.4. If +free_all +is +True, +which +is ignored and +XkbFreeServerMap +frees every non- +NULL +structure component in the server map, frees the +XkbServerMapRec +structure referenced by the +server +member of the +xkb +parameter, and sets the +server +member to +NULL.
diff --git a/libX11/specs/XKB/ch15.xml b/libX11/specs/XKB/ch15.xml index b12bc8cf3..a6f3f7c68 100644 --- a/libX11/specs/XKB/ch15.xml +++ b/libX11/specs/XKB/ch15.xml @@ -1,6 +1,14 @@ + + Xkb Client Keyboard Mapping + +client map + +mapclient + The Xkb client map for a keyboard is the collection of information a client needs to interpret key events from the keyboard. It contains a global list of @@ -10,14 +18,16 @@ bound to a key and the rules to be used to interpret those symbols. -Figure 15.1 shows the relationships between elements in the client map: +Figure 15.1 shows the relationships between elements in the client map: - - - -Xkb Client Map - +
+ Xkb Client Map + + + + +
+ + XkbDescPtr xkb + unsigned int which + int keypadVMod + + + + + + xkb + + + + keyboard description containing client map to initialize + + + + + + which + + + + mask of types to initialize + + + + + + keypadVMod + + + + index of NumLock virtual modifier + + + + + + +XkbInitCanonicalKeyTypes +initializes the first +XkbNumRequiredTypes +key types of the keyboard specified by the +xkb +parameter to their default values. The +which +parameter specifies what canonical key types to initialize and is a bitwise +inclusive OR of the following masks: +XkbOneLevelMask, +XkbTwoLevelMask, +XkbAlphabeticMask, +and +XkbKeypadMask. +Only those canonical types specified by the +which +mask are initialized. + + + + +If +XkbKeypadMask +is set in the +which +parameter, +XkbInitCanonicalKeyTypes +looks up the +NumLock +named virtual modifier to determine which virtual modifier to use when +initializing the KEYPAD key type. If the +NumLock +virtual modifier does not exist, +XkbInitCanonicalKeyTypes +creates it. + + + + +XkbInitCanonicalKeyTypes +normally returns Success. It returns +BadAccess +if the Xkb extension has not been properly initialized, and +BadAccess +if the +xkb +parameter is not valid. @@ -747,92 +754,97 @@ xkb To obtain the list of available key types in the server’s keyboard mapping, -use -XkbGetKeyTypes -. - - - - - - - - - -Status -XkbGetKeyTypes -( -dpy -, - first -, - num -, - xkb -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int - first -; /* index to first type to get, 0 => 1st type */ - - - - -unsigned int -num -; /* number of key types to be returned */ - - - - -XkbDescPtr -xkb -; /* keyboard description containing client map to update */ - - - - - - -XkbGetKeyTypes - is used to obtain descriptions of the key types themselves, not the key types +use +XkbGetKeyTypes. + + +XkbGetKeyTypes + + + Status XkbGetKeyTypes + + + Display *dpy + unsigned int first + unsigned int num + XkbDescPtr xkb + + + + + + dpy + + + + connection to X server + + + + + + first + + + + index to first type to get, 0 ⇒ 1st type + + + + + + num + + + + number of key types to be returned + + + + + + xkb + + + + keyboard description containing client map to update + + + + + +XkbGetKeyTypes +is used to obtain descriptions of the key types themselves, not the key types bound to individual keys. To obtain the key types bound to an individual key, -refer to the -key_sym_map - field of the client map (see section 15.3.1). +refer to the +key_sym_map +field of the client map (see section 15.3.1).
- -XkbGetKeyTypes - queries the server for the desired types, waits for a reply, and returns the -desired types in the -xkb->map->types -. If successful, it returns Success. +XkbGetKeyTypes +queries the server for the desired types, waits for a reply, and returns the +desired types in the +xkb->map->types. +If successful, it returns Success. - -XkbGetKeyTypes - returns -BadAccess - if the Xkb extension has not been properly initialized and -BadValue - if the combination of -first - and -num - results in numbers out of valid range. +XkbGetKeyTypes +returns +BadAccess +if the Xkb extension has not been properly initialized and +BadValue +if the combination of +first +and +num +results in numbers out of valid range. @@ -841,169 +853,170 @@ num Changing the Number of Levels in a Key Type -To change the number of levels in a key type, use -XkbResizeKeyType -. - - - - - - - - - -Status -XkbResizeKeyType -( -xkb -, - type_ndx -, - map_count -, - want_preserve -, - new_num_lvls -) - - - - -XkbDescPtr - xkb -; /* keyboard description containing client map to update */ - - - - -int - type_ndx -; /* index in xkb->map->types of type to change */ - - - - -int -map_count -; /* total # of map entries needed for the type */ - - - - -Bool -want_preserve -; /* -True - => list of preserved modifiers is necessary */ - - - - -int - new_num_lvls -; /* new max # of levels for type */ - - - - - - - - -XkbResizeKeyType - changes the type specified by -xkb --> -map->types -[ -type_ndx +To change the number of levels in a key type, use +XkbResizeKeyType. + + +XkbResizeKeyType + + + Status XkbResizeKeyType + + + XkbDescPtr xkb + int type_ndx + int map_count + Bool want_preserve + int new_num_lvls + + + + + + xkb + + + + keyboard description containing client map to update + + + + + + type_ndx + + + + index in xkb->map->types of type to change + + + + + + map_count + + + + total # of map entries needed for the type + + + + + + want_preserve + + + + True + ⇒ list of preserved modifiers is necessary + + + + + + new_num_lvls + + + + new max # of levels for type + + + + + + +XkbResizeKeyType +changes the type specified by +xkb->map->types +[ +type_ndx ], and reallocates the symbols and actions bound to all keys that use the type, -if necessary. -XkbResizeKeyType - updates only the local copy of the types in -xkb -; to update the server’s copy for the physical device, use -XkbSetMap - or -XkbChangeMap - after calling -XkbResizeKeyType -. - - - - -The -map_count - parameter specifies the total number of map entries needed for the type, and -can be zero or greater. If -map_count - is zero, -XkbResizeKeyType - frees the existing -map - and -preserve - entries for the type if they exist and sets them to -NULL -. - - - - -The -want_preserve - parameter specifies whether a -preserve - list for the key should be created. If -want_preserve - is -True -, the -preserve - list with -map_count - entries is allocated or reallocated if it already exists. Otherwise, if - -want_preserve - is -False -, the -preserve - field is freed if necessary and set to -NULL -. - - - - -The -new_num_lvls - parameter specifies the new maximum number of shift levels for the type and is +if necessary. +XkbResizeKeyType +updates only the local copy of the types in +xkb; +to update the server’s copy for the physical device, use +XkbSetMap +or +XkbChangeMap +after calling +XkbResizeKeyType. + + + + +The +map_count +parameter specifies the total number of map entries needed for the type, and +can be zero or greater. If +map_count +is zero, +XkbResizeKeyType +frees the existing +map +and +preserve +entries for the type if they exist and sets them to +NULL. + + + + +The +want_preserve +parameter specifies whether a +preserve +list for the key should be created. If +want_preserve +is +True, +the +preserve +list with +map_count +entries is allocated or reallocated if it already exists. Otherwise, if +want_preserve +is +False, +the +preserve +field is freed if necessary and set to +NULL. + + + + +The +new_num_lvls +parameter specifies the new maximum number of shift levels for the type and is used to calculate and resize the symbols and actions bound to all keys that use the type. -If -type_ndx - does not specify a legal type, -new_num_lvls - is less than 1, or the -map_count - is less than zero, -XkbResizeKeyType - returns -BadValue -. If -XkbResizeKeyType - encounters any problems with allocation, it returns -BadAlloc -. Otherwise, it returns -Success -. +If +type_ndx +does not specify a legal type, +new_num_lvls +is less than 1, or the +map_count +is less than zero, +XkbResizeKeyType +returns +BadValue. +If +XkbResizeKeyType +encounters any problems with allocation, it returns +BadAlloc. +Otherwise, it returns +Success. @@ -1012,177 +1025,176 @@ Success Copying Key Types -Use -XkbCopyKeyType - and -XkbCopyKeyTypes - to copy one or more -XkbKeyTypeRec - structures. - - - - - - - - - -Status -XkbCopyKeyType -( -from -, - into -) - - - - -XkbKeyTypePtr - from -; /* pointer to XkbKeyTypeRec to be copied */ - - - - -XkbKeyTypePtr - into -; /* pointer to XkbKeyTypeRec to be changed */ - - - - - - - - -XkbCopyKeyType - copies the key type specified by -from - to the key type specified by -into -. Both must point to legal -XkbKeyTypeRec - structures. Xkb assumes -from - and -into - point to different places. As a result, overlaps can be fatal. -XkbCopyKeyType - frees any existing -map -, -preserve -, and -level_names - in -into - prior to copying. If any allocation errors occur while copying -from - to -into -, -XkbCopyKeyType - returns -BadAlloc -. Otherwise, -XkbCopyKeyType - copies -from - to -into - and returns -Success -. - - - - - - - - - - -Status -XkbCopyKeyTypes -( -from -, - into -, -num_types -) - - - - -XkbKeyTypePtr - from -; /* pointer to array of XkbKeyTypeRecs to copy */ - - - - -XkbKeyTypePtr - into -; /* pointer to array of XkbKeyTypeRecs to change */ - - - - -int - num_types -; /* number of types to copy */ - - - - - - - - -XkbCopyKeyTypes - copies -num_types - -XkbKeyTypeRec - structures from the array specified by -from - into the array specified by -into -. It is intended for copying between, rather than within, keyboard +Use +XkbCopyKeyType +and +XkbCopyKeyTypes +to copy one or more +XkbKeyTypeRec +structures. + + +XkbCopyKeyType + + + Status XkbCopyKeyType + + + XkbKeyTypePtr from + XkbKeyTypePtr into + + + + + + from + + + + pointer to XkbKeyTypeRec to be copied + + + + + + into + + + + pointer to XkbKeyTypeRec to be changed + + + + + + +XkbCopyKeyType +copies the key type specified by +from +to the key type specified by +into. +Both must point to legal +XkbKeyTypeRec +structures. Xkb assumes +from +and +into +point to different places. As a result, overlaps can be fatal. +XkbCopyKeyType +frees any existing +map, +preserve, +and +level_names +in +into +prior to copying. If any allocation errors occur while copying +from +to +into, +XkbCopyKeyType +returns +BadAlloc. +Otherwise, +XkbCopyKeyType +copies +from +to +into +and returns +Success. + + + +XkbCopyKeyTypes + + + Status XkbCopyKeyTypes + + + XkbKeyTypePtr from + XkbKeyTypePtr into + int num_types + + + + + + from + + + + pointer to array of XkbKeyTypeRecs to copy + + + + + + into + + + + pointer to array of XkbKeyTypeRecs to change + + + + + + num_types + + + + number of types to copy + + + + + + +XkbCopyKeyTypes +copies +num_types +XkbKeyTypeRec +structures from the array specified by +from +into the array specified by +into. +It is intended for copying between, rather than within, keyboard descriptions, so it doesn’t check for overlaps. The same rules that apply to -the -from - and -into - parameters in -XkbCopyKeyType - apply to each entry of the -from - and -into - arrays of -XkbCopyKeyTypes -. If any allocation errors occur while copying -from - to -into -, -XkbCopyKeyTypes - returns -BadAlloc -. Otherwise, -XkbCopyKeyTypes - copies -from - to -into - and returns -Success -. +the +from +and +into +parameters in +XkbCopyKeyType +apply to each entry of the +from +and +into +arrays of +XkbCopyKeyTypes. +If any allocation errors occur while copying +from +to +into, +XkbCopyKeyTypes +returns +BadAlloc. +Otherwise, +XkbCopyKeyTypes +copies +from +to +into +and returns +Success. @@ -1190,79 +1202,80 @@ Success
Key Symbol Map + +XkbSymMapRec The entire list of key symbols for the keyboard mapping is held in the - -syms - field of the client map. Whereas the core keyboard mapping is a -two-dimensional array of -KeySyms - whose rows are indexed by keycode, the -syms - field of Xkb is a linear list of -KeySyms - that needs to be indexed uniquely for each key. This section describes the key +syms +field of the client map. Whereas the core keyboard mapping is a +two-dimensional array of +KeySyms +whose rows are indexed by keycode, the +syms +field of Xkb is a linear list of +KeySyms +that needs to be indexed uniquely for each key. This section describes the key symbol map and the methods for determining the symbols bound to a key. -The reason the -syms - field is a linear list of -KeySyms - is to reduce the memory consumption associated with a keymap; because Xkb +The reason the +syms +field is a linear list of +KeySyms +is to reduce the memory consumption associated with a keymap; because Xkb allows individual keys to have multiple shift levels and a different number of -groups per key, a single two-dimensional array of -KeySyms - would potentially be very large and sparse. Instead, Xkb provides a small -two-dimensional array of -KeySyms - for each key. To store all of these individual arrays, Xkb concatenates each -array together in the -syms - field of the client map. - - - - -In order to determine which -KeySyms - in the -syms - field are associated with each keycode, the client map contains an array of -key symbol mappings, held in the -key_sym_map - field. The -key_sym_map - field is an array of -XkbSymMapRec - structures indexed by keycode. The -key_sym_map - array has -min_key_code - unused entries at the start to allow direct indexing using a keycode. All +groups per key, a single two-dimensional array of +KeySyms +would potentially be very large and sparse. Instead, Xkb provides a small +two-dimensional array of +KeySyms +for each key. To store all of these individual arrays, Xkb concatenates each +array together in the +syms +field of the client map. + + + + +In order to determine which +KeySyms +in the +syms +field are associated with each keycode, the client map contains an array of +key symbol mappings, held in the +key_sym_map +field. The +key_sym_map +field is an array of +XkbSymMapRec +structures indexed by keycode. The +key_sym_map +array has +min_key_code +unused entries at the start to allow direct indexing using a keycode. All keycodes falling between the minimum and maximum legal keycodes, inclusive, -have -key_sym_map - arrays, whether or not any key actually yields that code. The -KeySymMapRec - structure is defined as follows: - +have +key_sym_map +arrays, whether or not any key actually yields that code. The +KeySymMapRec +structure is defined as follows: - + #define XkbNumKbdGroups 4 #define XkbMaxKbdGroup (XkbNumKbdGroups-1) - - -typedef struct { /* map to keysyms for a single keycode */ - unsigned char kt_index[XkbNumKbdGroups]; /* key type index for each group */ - unsigned char group_info; /* # of groups and out of range group handling */ - unsigned char width; /* max # of shift levels for key */ - unsigned short offset; /* index to keysym table in syms array */ -} XkbSymMapRec, *XkbSymMapPtr; +typedef struct { /* map to keysyms for a single keycode */ + unsigned char kt_index[XkbNumKbdGroups]; + /* key type index for each group */ + unsigned char group_info; /* # of groups and out of range + group handling */ + unsigned char width; /* max # of shift levels for key */ + unsigned short offset; /* index to keysym table in + syms array */ +} XkbSymMapRec, *XkbSymMapPtr; @@ -1274,128 +1287,140 @@ These fields are described in detail in the following sections. Per-Key Key Type Indices -The -kt_index - array of the -XkbSymMapRec - structure contains the indices of the key types (see section 15.2) for each +The +kt_index +array of the +XkbSymMapRec +structure contains the indices of the key types (see section 15.2) for each possible group of symbols associated with the key. To obtain the index of a key type or the pointer to a key type, Xkb provides the following macros, to access the key types: The array of key types is of fixed width and is large enough to -hold key types for the maximum legal number of groups ( -XkbNumKbdGroups -, currently four); if a key has fewer than -XkbNumKbdGroups - groups, the extra key types are reported but ignored. - - - - - - - - -int -XkbKeyTypeIndex -( -xkb, keycode, group -) /* macro*/ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - -int -group -; /* group index */ - - - - - - - - -XkbKeyTypeIndex - computes an index into the -types - vector of the client map in -xkb - from the given -keycode - and -group - index. - - - - - - - - - - -XkbKeyTypePtr -XkbKeyType -( -xkb, keycode, group -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - -int -group -; /* group index */ - - - - - - - - -XkbKeyType - returns a pointer to the key type in the -types - vector of the client map in -xkb - corresponding to the given -keycode - and -group - index. +hold key types for the maximum legal number of groups +(XkbNumKbdGroups, +currently four); if a key has fewer than +XkbNumKbdGroups +groups, the extra key types are reported but ignored. + +XkbKeyTypeIndex + + + int XkbKeyTypeIndex + + + XkbDescPtr xkb + KeyCode keycode + int group + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + group + + + + group index + + + + + + +XkbKeyTypeIndex +computes an index into the +types +vector of the client map in +xkb +from the given +keycode +and +group +index. + + + +XkbKeyType + + + XkbKeyTypePtr XkbKeyType + + + XkbDescPtr xkb + KeyCode keycode + int group + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + group + + + + group index + + + + + + +XkbKeyType +returns a pointer to the key type in the +types +vector of the client map in +xkb +corresponding to the given +keycode +and +group +index. @@ -1404,64 +1429,64 @@ group Per-Key Group Information -The -group_info - field of an -XkbSymMapRec - is an encoded value containing the number of groups of symbols bound to the +The +group_info +field of an +XkbSymMapRec +is an encoded value containing the number of groups of symbols bound to the key as well as the specification of the treatment of out-of-range groups. It is legal for a key to have zero groups, in which case it also has zero symbols and -all events from that key yield -NoSymbol -. To obtain the number of groups of symbols bound to the key, use -XkbKeyNumGroups -. To change the number of groups bound to a key, use -XkbChangeTypesOfKey - (see section 15.3.6). To obtain a mask that determines the treatment of -out-of-range groups, use -XkbKeyGroupInfo - and -XkbOutOfRangeGroupInfo -. +all events from that key yield +NoSymbol. +To obtain the number of groups of symbols bound to the key, use +XkbKeyNumGroups. +To change the number of groups bound to a key, use +XkbChangeTypesOfKey +(see section 15.3.6). To obtain a mask that determines the treatment of +out-of-range groups, use +XkbKeyGroupInfo +and +XkbOutOfRangeGroupInfo. -The keyboard controls (see Chapter 10) contain a -groups_wrap - field specifying the handling of illegal groups on a global basis. That is, +The keyboard controls (see ) contain a +groups_wrap +field specifying the handling of illegal groups on a global basis. That is, when the user performs an action causing the effective group to go out of the -legal range, the -groups_wrap - field specifies how to normalize the effective keyboard group to a group that +legal range, the +groups_wrap +field specifies how to normalize the effective keyboard group to a group that is legal for the keyboard as a whole, but there is no guarantee that the normalized group will be within the range of legal groups for any individual -key. The per-key -group_info - field specifies how a key treats a legal effective group if the key does not -have a type specified for the group of concern. For example, the -Enter - key usually has just one group defined. If the user performs an action causing -the global keyboard group to change to -Group2 -, the -group_info - field for the -Enter - key describes how to handle this situation. +key. The per-key +group_info +field specifies how a key treats a legal effective group if the key does not +have a type specified for the group of concern. For example, the +Enter +key usually has just one group defined. If the user performs an action causing +the global keyboard group to change to +Group2, +the +group_info +field for the +Enter +key describes how to handle this situation. Out-of-range groups for individual keys are mapped to a legal group using the same options as are used for the overall keyboard group. The particular type of -mapping used is controlled by the bits set in the -group_info - flag, as shown in Table 15.2. See section 10.7.1 for more details on the -normalization methods in this table. +mapping used is controlled by the bits set in the +group_info +flag, as shown in Table 15.2. +See section 10.7.1 +for more details on the normalization methods in this table. - +
group_info Range Normalization @@ -1475,16 +1500,16 @@ normalization methods in this table. - XkbRedirectIntoRange - XkbRedirectIntoRange + XkbRedirectIntoRange + XkbRedirectIntoRange - XkbClampIntoRange - XkbClampIntoRange + XkbClampIntoRange + XkbClampIntoRange none of the above - XkbWrapIntoRange + XkbWrapIntoRange @@ -1494,167 +1519,159 @@ normalization methods in this table. Xkb provides the following macros to access group information: - - - - - - - -int -XkbKeyNumGroups -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeyNumGroups - returns the number of groups of symbols bound to the key corresponding to - -keycode -. - - - - - - - - - - -unsigned char -XkbKeyGroupInfo -( -xkb, keycode -) /*macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeyGroupInfo - returns the -group_info - field from the -XkbSymMapRec - structure associated with the key corresponding to -keycode -. - - - - - - - - - - -unsigned char -XkbOutOfRangeGroupInfo -( -grp_inf -) /* macro */ - - - - -unsigned char -grp_inf -; /* group_info field of -XkbSymMapRec - */ - - - - - - - - -XkbOutOfRangeGroupInfo - returns only the out-of-range processing information from the -group_info - field of an -XkbSymMapRec - structure. - - - - - - - - - - -unsigned char -XkbOutOfRangeGroupNumber -( -grp_inf -) /* macro */ - - - - -unsigned char -grp_inf -; /* group_info field of -XkbSymMapRec - */ - - - - - - - - -XkbOutOfRangeGroupNumber - returns the out-of-range group number, represented as a group index, from the - -group_info - field of an -XkbSymMapRec - structure. +XkbKeyNumGroups + + + int XkbKeyNumGroups + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeyNumGroups +returns the number of groups of symbols bound to the key corresponding to +keycode. + + + +XkbKeyGroupInfo + + + unsigned char XkbKeyGroupInfo + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeyGroupInfo +returns the +group_info +field from the +XkbSymMapRec +structure associated with the key corresponding to +keycode. + + + +XkbOutOfRangeGroupInfo + + + unsigned char XkbOutOfRangeGroupInfo + + + unsigned char grp_inf + + + + + + grp_inf + + + + group_info field of XkbSymMapRec + + + + + + +XkbOutOfRangeGroupInfo +returns only the out-of-range processing information from the +group_info +field of an +XkbSymMapRec +structure. + + + +XkbOutOfRangeGroupNumber + + + unsigned char XkbOutOfRangeGroupNumber + + + unsigned char grp_inf + + + + + + grp_inf + + + + group_info field of XkbSymMapRec + + + + + + +XkbOutOfRangeGroupNumber +returns the out-of-range group number, represented as a group index, from the +group_info +field of an +XkbSymMapRec +structure. @@ -1664,13 +1681,13 @@ XkbSymMapRec The maximum number of shift levels for a type is also referred to as the width -of a key type. The -width - field of the -key_sym_map - entry for a key contains the width of the widest type associated with the key. -The -width +of a key type. The +width +field of the +key_sym_map +entry for a key contains the width of the widest type associated with the key. +The +width field cannot be explicitly changed; it is updated automatically whenever the symbols or set of types bound to a key are changed. @@ -1682,13 +1699,13 @@ symbols or set of types bound to a key are changed. The key width and number of groups associated with a key are used to form a -small two-dimensional array of -KeySyms - for a key. This array may be different sizes for different keys. The array for +small two-dimensional array of +KeySyms +for a key. This array may be different sizes for different keys. The array for a single key is stored as a linear list, in row-major order. The arrays for all -of the keys are stored in the -syms - field of the client map. There is one row for each group associated with a key +of the keys are stored in the +syms +field of the client map. There is one row for each group associated with a key and one column for each level. The index corresponding to a given group and shift level is computed as: @@ -1698,297 +1715,315 @@ shift level is computed as: -The -offset - field of the -key_sym_map - entry for a key is used to access the beginning of the array. +The +offset +field of the +key_sym_map +entry for a key is used to access the beginning of the array. -Xkb provides the following macros for accessing the -width - and -offset - for individual keys, as well as macros for accessing the two-dimensional array +Xkb provides the following macros for accessing the +width +and +offset +for individual keys, as well as macros for accessing the two-dimensional array of symbols bound to the key: - - - - - - - -int -XkbKeyGroupsWidth -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeyGroupsWidth - computes the maximum width associated with the key corresponding to -keycode -. - - - - - - - - - - -int -XkbKeyGroupWidth -( -xkb, keycode, grp -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - -int -grp -; /* group of interest */ - - - - - - - - -XkbKeyGroupWidth - computes the width of the type associated with the group -grp - for the key corresponding to -keycode -. - - - - - - - - - - -int -XkbKeySymsOffset -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeySymsOffset - returns the offset of the two-dimensional array of keysyms for the key -corresponding to -keycode -. - - - - - - - - - - -int -XkbKeyNumSyms -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeyNumSyms - returns the total number of keysyms for the key corresponding to -keycode -. - - - - - - - - - - -KeySym * -XkbKeySymsPtr -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeySymsPtr - returns the pointer to the two-dimensional array of keysyms for the key -corresponding to -keycode -. - - - - - - - - - - -KeySym -XkbKeySymEntry -( -xkb, keycode, shift, grp -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - -int -shift -; /* shift level of interest */ - - - - -int -grp -; /* group of interest */ - - - - - - - - -XkbKeySymEntry - returns the -keysym - corresponding to shift level -shift - and group -grp - from the two-dimensional array of keysyms for the key corresponding to - -keycode +XkbKeyGroupsWidth + + + int XkbKeyGroupsWidth + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeyGroupsWidth +computes the maximum width associated with the key corresponding to +keycode. + + + +XkbKeyGroupWidth + + + int XkbKeyGroupWidth + + + XkbDescPtr xkb + KeyCode keycode + int grp + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + grp + + + + group of interest + + + + + + +XkbKeyGroupWidth +computes the width of the type associated with the group +grp +for the key corresponding to +keycode. + + + +XkbKeySymsOffset + + + int XkbKeySymsOffset + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeySymsOffset +returns the offset of the two-dimensional array of keysyms for the key +corresponding to +keycode. + + + +XkbKeyNumSyms + + + int XkbKeyNumSyms + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeyNumSyms +returns the total number of keysyms for the key corresponding to +keycode. + + + +XkbKeySymsPtr + + + KeySym *XkbKeySymsPtr + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeySymsPtr +returns the pointer to the two-dimensional array of keysyms for the key +corresponding to +keycode. + + + +XkbKeySymEntry + + + KeySym XkbKeySymEntry + + + XkbDescPtr xkb + KeyCode keycode + int shift + int grp + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + shift + + + + shift level of interest + + + + + + grp + + + + group of interest + + + + + + +XkbKeySymEntry +returns the +KeySym +corresponding to shift level +shift +and group +grp +from the two-dimensional array of keysyms for the key corresponding to +keycode @@ -1998,114 +2033,118 @@ keycode To obtain the symbols for a subset of the keys in a keyboard description, use - -XkbGetKeySyms -: - - - - - - - - - -Status -XkbGetKeySyms -( -dpy -, - first -, -num -, - xkb -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int - first -; /* keycode of first key to get */ - - - - -unsigned int - num -; /* number of keycodes for which syms desired */ - - - - -XkbDescPtr -xkb -; /* Xkb description to be updated */ - - - - - - - - -XkbGetKeySyms - sends a request to the server to obtain the set of keysyms bound to -num - keys starting with the key whose keycode is -first -. It waits for a reply and returns the keysyms in the -map.syms - field of -xkb -. If successful, -XkbGetKeySyms - returns -Success -. The -xkb - parameter must be a pointer to a valid Xkb keyboard description. - - - - -If the client -map - in the -xkb - parameter has not been allocated, -XkbGetKeySyms - allocates and initializes it before obtaining the symbols. +XkbGetKeySyms: + + + +XkbGetKeySyms + + + Status XkbGetKeySyms + + + Display *dpy + unsigned int first + unsigned int num + XkbDescPtr xkb + + + + + + dpy + + + + connection to X server + + + + + + first + + + + keycode of first key to get + + + + + + num + + + + number of keycodes for which syms desired + + + + + + xkb + + + + Xkb description to be updated + + + + + + +XkbGetKeySyms +sends a request to the server to obtain the set of keysyms bound to +num +keys starting with the key whose keycode is +first. +It waits for a reply and returns the keysyms in the +map.syms +field of +xkb. +If successful, +XkbGetKeySyms +returns +Success. +The +xkb +parameter must be a pointer to a valid Xkb keyboard description. + + + + +If the client +map +in the +xkb +parameter has not been allocated, +XkbGetKeySyms +allocates and initializes it before obtaining the symbols. If a compatible version of Xkb is not available in the server or the Xkb -extension has not been properly initialized, -XkbGetKeySyms - returns -BadAccess -. If -num - is less than 1 or greater than -XkbMaxKeyCount -, -XkbGetKeySyms - returns -BadValue -. If any allocation errors occur, -XkbGetKeySyms - returns -BadAlloc -. +extension has not been properly initialized, +XkbGetKeySyms +returns +BadAccess. +If +num +is less than 1 or greater than +XkbMaxKeyCount, +XkbGetKeySyms +returns +BadValue. +If any allocation errors occur, +XkbGetKeySyms +returns +BadAlloc. @@ -2114,164 +2153,166 @@ BadAllocChanging the Number of Groups and Types Bound to a Key -To change the number of groups and the types bound to a key, use -XkbChangeTypesOfKey -. - - - - -Status -XkbChangeTypesOfKey -( -xkb -, - key -, - n_groups -, - groups -, - new_types_in -, - p_changes -) - - - - - - - - - -XkbDescPtr - xkb -; /* keyboard description to be changed */ - - - - -int - key -; /* keycode for key of interest */ - - - - -int - n_groups -; /* new number of groups for key */ - - - - -unsigned int -groups -; /* mask indicating groups to change */ - - - - -int * -new_types_in -; /* indices for new groups specified in -groups - */ - - - - -XkbMapChangesPtr -p_changes -; /* notes changes made to -xkb - */ - - - - - - - - -XkbChangeTypesOfKey - reallocates the symbols and actions bound to the key, if necessary, and -initializes any new symbols or actions to -NoSymbol - or -NoAction -, as appropriate. If the -p_changes - parameter is not -NULL -, -XkbChangeTypesOfKey - adds the -XkbKeySymsMask - to the -changes - field of -p_changes - and modifies the -first_key_sym - and -num_key_syms - fields of -p_changes - to include the -key - that was changed. See section 14.3.1 for more information on the -XkbMapChangesPtr - structure. If successful, -XkbChangeTypesOfKey - returns -Success -. - - - - -The -n_groups - parameter specifies the new number of groups for the key. The -groups - parameter is a mask specifying the groups for which new types are supplied and -is a bitwise inclusive OR of the following masks: -XkbGroup1Mask -, -XkbGroup2Mask -, -XkbGroup3Mask -, and -XkbGroup4Mask -. - - - - -The -new_types_in - parameter is an integer array of length -n_groups -. Each entry represents the type to use for the associated group and is an -index into -xkb --> -map->types -. The -new_types_in - array is indexed by group index; if -n_groups - is four and -groups - only has -Group1Mask - and -Group3Mask - set, -new_types_in - looks like this: +To change the number of groups and the types bound to a key, use +XkbChangeTypesOfKey. + + + +XkbChangeTypesOfKey + + + Status XkbChangeTypesOfKey + + + XkbDescPtr xkb + int key + int n_groups + unsigned int groups + int *new_types_in + XkbMapChangesPtr p_changes + + + + + + xkb + + + + keyboard description to be changed + + + + + + key + + + + keycode for key of interest + + + + + + n_groups + + + + new number of groups for key + + + + + + groups + + + + mask indicating groups to change + + + + + + new_types_in + + + + indices for new groups specified in groups + + + + + + p_changes + + + + notes changes made to xkb + + + + + + +XkbChangeTypesOfKey +reallocates the symbols and actions bound to the key, if necessary, and +initializes any new symbols or actions to +NoSymbol +or +NoAction, +as appropriate. If the +p_changes +parameter is not +NULL, +XkbChangeTypesOfKey +adds the +XkbKeySymsMask +to the +changes +field of +p_changes +and modifies the +first_key_sym +and +num_key_syms +fields of +p_changes +to include the +key +that was changed. See section 14.3.1 for more information on the +XkbMapChangesPtr +structure. If successful, +XkbChangeTypesOfKey +returns +Success. + + + + +The +n_groups +parameter specifies the new number of groups for the key. The +groups +parameter is a mask specifying the groups for which new types are supplied and +is a bitwise inclusive OR of the following masks: +XkbGroup1Mask, +XkbGroup2Mask, +XkbGroup3Mask, +and +XkbGroup4Mask. + + + + +The +new_types_in +parameter is an integer array of length +n_groups. +Each entry represents the type to use for the associated group and is an +index into +xkb->map->types. +The +new_types_in +array is indexed by group index; if +n_groups +is four and +groups +only has +XkbGroup1Mask +and +XkbGroup3Mask +set, +new_types_in +looks like this: @@ -2286,7 +2327,7 @@ For convenience, Xkb provides the following constants to use as indices to the groups: -
+
Group Index Constants @@ -2300,19 +2341,19 @@ groups: - XkbGroup1Index + XkbGroup1Index 0 - XkbGroup2Index + XkbGroup2Index 1 - XkbGroup3Index + XkbGroup3Index 2 - XkbGroup4Index + XkbGroup4Index 3 @@ -2320,36 +2361,35 @@ groups:
-If the Xkb extension has not been properly initialized, -XkbChangeTypesOfKey - returns -BadAccess -. If the -xkb - parameter it not valid (that is, it is -NULL - or it does not contain a valid client map), -XkbChangeTypesOfKey - returns -Bad -Match. If the -key - is not a valid keycode, -n_groups - is greater than -XkbNumKbdGroups -, or the -groups - mask does not contain any of the valid group mask bits, -XkbChangeTypesOfKey - returns -BadValue -. If it is necessary to resize the key symbols or key actions arrays and any -allocation errors occur, -XkbChangeTypesOfKey - returns -BadAlloc -. +If the Xkb extension has not been properly initialized, +XkbChangeTypesOfKey +returns +BadAccess. +If the +xkb +parameter it not valid (that is, it is +NULL +or it does not contain a valid client map), +XkbChangeTypesOfKey +returns +BadMatch. +If the +key +is not a valid keycode, +n_groups +is greater than +XkbNumKbdGroups, +or the +groups +mask does not contain any of the valid group mask bits, +XkbChangeTypesOfKey +returns +BadValue. +If it is necessary to resize the key symbols or key actions arrays and any +allocation errors occur, +XkbChangeTypesOfKey +returns +BadAlloc. @@ -2358,124 +2398,121 @@ BadAlloc Changing the Number of Symbols Bound to a Key -To change the number of symbols bound to a key, use -XkbResizeKeySyms -. - - - - - - - - - -KeySym * -XkbResizeKeySyms -( -xkb -, - key -, - needed -) - - - - -XkbDescRec * - xkb -; /* keyboard description to be changed */ - - - - -int - key -; /* keycode for key to modify */ - - - - -int - needed -; /* new number of keysyms required for key */ - - - - - - - - -XkbResizeKeySyms - reserves the space needed for -needed - keysyms and returns a pointer to the beginning of the new array that holds the -keysyms. It adjusts the -offset - field of the -key_sym_map - entry for the key if necessary and can also change the -syms -, -num_syms -, and -size_syms - fields of -xkb -- ->map - if it is necessary to reallocate the -syms - array. -XkbResizeKeySyms - does not modify either the width or number of groups associated with the key. - - - - -If -needed - is greater than the current number of keysyms for the key, -XkbResizeKeySyms - initializes all new keysyms in the array to -NoSymbol -. +To change the number of symbols bound to a key, use +XkbResizeKeySyms. + + +XkbResizeKeySyms + + + KeySym *XkbResizeKeySyms + + + XkbDescRec *xkb + int key + int needed + + + + + + xkb + + + + keyboard description to be changed + + + + + + key + + + + keycode for key to modify + + + + + + needed + + + + new number of keysyms required for key + + + + + + +XkbResizeKeySyms +reserves the space needed for +needed +keysyms and returns a pointer to the beginning of the new array that holds the +keysyms. It adjusts the +offset +field of the +key_sym_map +entry for the key if necessary and can also change the +syms, +num_syms, +and +size_syms +fields of +xkb->map +if it is necessary to reallocate the +syms +array. +XkbResizeKeySyms +does not modify either the width or number of groups associated with the key. + + + + +If +needed +is greater than the current number of keysyms for the key, +XkbResizeKeySyms +initializes all new keysyms in the array to +NoSymbol. Because the number of symbols needed by a key is normally computed as width * -number of groups, and -XkbResizeKeySyms - does not modify either the width or number of groups for the key, a -discrepancy exists upon return from -XkbResizeKeySyms - between the space allocated for the keysyms and the number required. The -unused entries in the list of symbols returned by -XkbResizeKeySyms - are not preserved across future calls to any of the map editing functions, so +number of groups, and +XkbResizeKeySyms +does not modify either the width or number of groups for the key, a +discrepancy exists upon return from +XkbResizeKeySyms +between the space allocated for the keysyms and the number required. The +unused entries in the list of symbols returned by +XkbResizeKeySyms +are not preserved across future calls to any of the map editing functions, so you must update the key symbol mapping (which updates the width and number of groups for the key) before calling another allocator function. A call to - -XkbChangeTypesOfKey - will update the mapping. +XkbChangeTypesOfKey +will update the mapping. If any allocation errors occur while resizing the number of symbols bound to -the key, -XkbResizeKeySyms - returns -NULL -. +the key, +XkbResizeKeySyms +returns +NULL. A change to the number of symbols bound to a key should be accompanied by a change in the number of actions bound to a key. Refer to -section 16.1.16 for more information on changing the number of actions bound to +section 16.1.16 for more information on changing the number of actions bound to a key. @@ -2485,29 +2522,23 @@ a key.
The Per-Key Modifier Map -The -modmap - entry of the client map is an array, indexed by keycode, specifying the real +The +modmap +entry of the client map is an array, indexed by keycode, specifying the real modifiers bound to a key. Each entry is a mask composed of a bitwise inclusive -OR of the legal real modifiers: -ShiftMask -, -LockMask -, -ControlMask -, -Mod1Mask -, -Mod2Mask -, -Mod3Mask -, -Mod4Mask -, and -Mod5Mask -. If a bit is set in a -modmap - entry, the corresponding key is bound to that modifier. +OR of the legal real modifiers: +ShiftMask, +LockMask, +ControlMask, +Mod1Mask, +Mod2Mask, +Mod3Mask, +Mod4Mask, +and +Mod5Mask. +If a bit is set in a +modmap +entry, the corresponding key is bound to that modifier. @@ -2515,7 +2546,7 @@ modmap Pressing or releasing the key bound to a modifier changes the modifier set and unset state. The particular manner in which the modifier set and unset state changes is determined by the behavior and actions assigned to the key (see -Chapter 16). +). @@ -2524,100 +2555,103 @@ Chapter 16). To update the modifier map for one or more of the keys in a keyboard -description, use -XkbGetKeyModifierMap -. - - - - - - - - - -Status -XkbGetKeyModifierMap -( -dpy -, - first -, - num -, - xkb -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int -first -; /* keycode of first key to get */ - - - - -unsigned int -num -; /* number of keys for which information is desired */ - - - - -XkbDescPtr -xkb -; /* keyboard description to update */ - - - - - - - - -XkbGetKeyModifierMap - sends a request to the server for the modifier mappings for -num - keys starting with the key whose keycode is -first -. It waits for a reply and places the results in the -xkb -->map->modmap array. If successful, -XkbGetKeyModifier - returns -Success -. - - - - -If the map component of the -xkb - parameter has not been allocated, -XkbGetKeyModifierMap - allocates and initializes it. +description, use +XkbGetKeyModifierMap. + + +XkbGetKeyModifierMap + + + Status XkbGetKeyModifierMap + + + Display *dpy + unsigned int first + unsigned int num + XkbDescPtr xkb + + + + + + dpy + + + + connection to X server + + + + + + first + + + + keycode of first key to get + + + + + + num + + + + number of keys for which information is desired + + + + + + xkb + + + + keyboard description to update + + + + + + +XkbGetKeyModifierMap +sends a request to the server for the modifier mappings for +num +keys starting with the key whose keycode is +first. +It waits for a reply and places the results in the +xkb->map->modmap array. If successful, +XkbGetKeyModifierMap +returns +Success. + + + + +If the map component of the +xkb +parameter has not been allocated, +XkbGetKeyModifierMap +allocates and initializes it. If a compatible version of Xkb is not available in the server or the Xkb -extension has not been properly initialized, -XkbGetKeySyms - returns -BadAccess -. If any allocation errors occur while obtaining the modifier map, -XkbGetKeyModifierMap - returns -BadAlloc -. +extension has not been properly initialized, +XkbGetKeySyms +returns +BadAccess. +If any allocation errors occur while obtaining the modifier map, +XkbGetKeyModifierMap +returns +BadAlloc.
diff --git a/libX11/specs/XKB/ch16.xml b/libX11/specs/XKB/ch16.xml index 2640ea2dd..3f5e42f04 100644 --- a/libX11/specs/XKB/ch16.xml +++ b/libX11/specs/XKB/ch16.xml @@ -1,23 +1,33 @@ + + Xkb Server Keyboard Mapping + +server map + +mapserver + -The -server - field of the complete Xkb keyboard description (see section 6.1) is a pointer +The +server +field of the complete Xkb keyboard description (see section 6.1) is a pointer to the Xkb server map. -Figure 16.1 shows the relationships between elements in the server map: +Figure 16.1 shows the relationships between elements in the server map: - - - -Server Map Relationships - +
+ Server Map Relationships + + + + +
- + + +XkbServerMapRec The Xkb server map contains the information the server needs to interpret key -events and is of type -XkbServerMapRec -: - +events and is of type +XkbServerMapRec: - + #define XkbNumVirtualMods 16 - - -typedef struct { /* Server Map */ - unsigned short num_acts; /* # of occupied entries in acts */ - unsigned short size_acts; /* # of entries in acts */ - XkbAction * acts; /* linear 2d tables of key actions, 1 per keycode */ - XkbBehavior * behaviors; /* key behaviors,1 per keycode */ - unsigned short * key_acts; /* index into acts , 1 per keycode */ - unsigned char * explicit; /* explicit overrides of core remapping, 1 per key */ - unsigned char vmods[XkbNumVirtualMods]; /* real mods bound to virtual mods */ - unsigned short * vmodmap; /* virtual mods bound to key, 1 per keycode*/ -} XkbServerMapRec, *XkbServerMapPtr; +typedef struct { /* Server Map */ + unsigned short num_acts; /* # of occupied entries in acts */ + unsigned short size_acts; /* # of entries in acts */ + XkbAction * acts; /* linear 2d tables of key actions, + 1 per keycode */ + XkbBehavior * behaviors; /* key behaviors, 1 per keycode */ + unsigned short * key_acts; /* index into acts, 1 per keycode */ + unsigned char * explicit; /* explicit overrides of core + remapping, 1 per key */ + unsigned char vmods[XkbNumVirtualMods]; /* real mods bound + to virtual mods */ + unsigned short * vmodmap; /* virtual mods bound to key, + 1 per keycode */ +} XkbServerMapRec, *XkbServerMapPtr; -The -num_acts -, -size_acts -, -acts -, and -key_acts - fields specify the key actions, defined in section 16.1. The -behaviors - field describes the behavior for each key and is defined in section 16.2. The - -explicit - field describes the explicit components for a key and is defined in section -16.3. The -vmods - and the -vmodmap - fields describe the virtual modifiers and the per-key virtual modifier mapping -and are defined in section 16.4. +The +num_acts, +size_acts, +acts, +and +key_acts +fields specify the key actions, defined in section 16.1. The +behaviors +field describes the behavior for each key and is defined in section 16.2. The +explicit +field describes the explicit components for a key and is defined in +section 16.3. The +vmods +and the +vmodmap +fields describe the virtual modifiers and the per-key virtual modifier mapping +and are defined in section 16.4. @@ -78,74 +87,71 @@ and are defined in section 16.4. A key action defines the effect key presses and releases have on the internal state of the server. For example, the expected key action associated with -pressing the -Shift - key is to set the -Shift - modifier. There is zero or one key action associated with each keysym bound to +pressing the +Shift +key is to set the +Shift +modifier. There is zero or one key action associated with each keysym bound to each key. Just as the entire list of key symbols for the keyboard mapping is held in the - -syms - field of the client map, the entire list of key actions for the keyboard -mapping is held in the -acts - array of the server map. The total size of -acts - is specified by -size_acts -, and the number of entries is specified by -num_acts. - - - - -The -key_acts - array, indexed by keycode, describes the actions associated with a key. The - -key_acts - array has -min_key_code - unused entries at the start to allow direct indexing using a keycode. If a - -key_acts - entry is -zero -, it means the key does not have any actions associated with it. If an entry is -not -zero -, the entry represents an index into the -acts - field of the server map, much as the -offset - field of a -KeySymMapRec - structure is an index into the -syms - field of the client map. - - - -The reason the -acts - field is a linear list of -XkbAction -s is to reduce the memory consumption associated with a keymap. Because Xkb +syms +field of the client map, the entire list of key actions for the keyboard +mapping is held in the +acts +array of the server map. The total size of +acts +is specified by +size_acts, +and the number of entries is specified by +num_acts. + + + + +The +key_acts +array, indexed by keycode, describes the actions associated with a key. The +key_acts +array has +min_key_code +unused entries at the start to allow direct indexing using a keycode. If a +key_acts +entry is +zero, +it means the key does not have any actions associated with it. If an entry is +not +zero, +the entry represents an index into the +acts +field of the server map, much as the +offset +field of a +KeySymMapRec +structure is an index into the +syms +field of the client map. + + + +The reason the +acts +field is a linear list of +XkbActions +is to reduce the memory consumption associated with a keymap. Because Xkb allows individual keys to have multiple shift levels and a different number of -groups per key, a single two-dimensional array of -KeySyms - would potentially be very large and sparse. Instead, Xkb provides a small -two-dimensional array of -XkbAction -s for each key. To store all of these individual arrays, Xkb concatenates each -array together in the -acts - field of the server map. +groups per key, a single two-dimensional array of +KeySyms +would potentially be very large and sparse. Instead, Xkb provides a small +two-dimensional array of +XkbActions +for each key. To store all of these individual arrays, Xkb concatenates each +array together in the +acts +field of the server map. @@ -163,290 +169,308 @@ Xkb provides the following macros, to simplify accessing information pertaining to key actions: - - - - - - - -Bool -XkbKeyHasActions -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeyHasActions - returns -True - if the key corresponding to -keycode - has any actions associated with it; otherwise, it returns -False -. - - - - - - - - - - -int -XkbKeyNumActions -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeyNumActions - computes the number of actions associated with the key corresponding to - -keycode -. This should be the same value as the result of -XkbKeyNumSyms - (see section 15.3.3). - - - - - - - - - - -XkbKeyActionPtr -XkbKeyActionsPtr -( -xkb, keycode -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - - - - - -XkbKeyActionsPtr - returns a pointer to the two-dimensional array of key actions associated with -the key corresponding to -keycode -. Use - XkbKeyActionsPtr - only if the key actually has some actions associated with it, that is, - -XkbKeyNumActions +XkbKeyHasActions + + + Bool XkbKeyHasActions + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeyHasActions +returns +True +if the key corresponding to +keycode +has any actions associated with it; otherwise, it returns +False. + + + +XkbKeyNumActions + + + int XkbKeyNumActions + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeyNumActions +computes the number of actions associated with the key corresponding to +keycode. +This should be the same value as the result of +XkbKeyNumSyms +(see section 15.3.3). + + + +XkbKeyActionsPtr + + + XkbKeyActionPtr XkbKeyActionsPtr + + + XkbDescPtr xkb + KeyCode keycode + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + +XkbKeyActionsPtr +returns a pointer to the two-dimensional array of key actions associated with +the key corresponding to +keycode. +Use +XkbKeyActionsPtr +only if the key actually has some actions associated with it, that is, +XkbKeyNumActions (xkb, keycode) returns something greater than zero. - - - - - - - -XkbAction -XkbKeyAction -( -xkb, keycode, idx -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - -int -idx -; /* index for group and shift level */ - - - - - +XkbKeyAction + + + XkbAction XkbKeyAction + + + XkbDescPtr xkb + KeyCode keycode + int idx + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + idx + + + + index for group and shift level + + + + - -XkbKeyAction - returns the key action indexed by -idx - in the two-dimensional array of key actions associated with the key -corresponding to -keycode -. -idx - may be computed from the group and shift level of interest as follows: +XkbKeyAction +returns the key action indexed by +idx +in the two-dimensional array of key actions associated with the key +corresponding to +keycode. +idx +may be computed from the group and shift level of interest as follows: idx = group_index * key_width + shift_level - - - - - - - -XkbAction -XkbKeyActionEntry -( -xkb, keycode, shift, grp -) /* macro */ - - - - -XkbDescPtr -xkb -; /* Xkb description of interest */ - - - - -KeyCode -keycode -; /* keycode of interest */ - - - - -int -shift -; /* shift level within group */ - - - - -int -grp -; /* group index for group of interest */ - - - - - +XkbKeyActionEntry + + + XkbAction XkbKeyActionEntry + + + XkbDescPtr xkb + KeyCode keycode + int shift + int grp + + + + + + xkb + + + + Xkb description of interest + + + + + + keycode + + + + keycode of interest + + + + + + shift + + + + shift level within group + + + + + + grp + + + + group index for group of interest + + + + - -XkbKeyActionEntry - returns the key action corresponding to group -grp - and shift level -lvl - from the two-dimensional table of key actions associated with the key -corresponding to -keycode -. +XkbKeyActionEntry +returns the key action corresponding to group +grp +and shift level +shift +from the two-dimensional table of key actions associated with the key +corresponding to +keycode. The XkbAction Structure + +XkbAction -The description for an action is held in an -XkbAction - structure, which is a union of all possible Xkb action types: - +The description for an action is held in an +XkbAction +structure, which is a union of all possible Xkb action types: - + typedef union _XkbAction { - XkbAnyAction any; - XkbModAction mods; - XkbGroupAction group; - XkbISOAction iso; - XkbPtrAction ptr; - XkbPtrBtnAction btn; - XkbPtrDfltAction dflt; - XkbSwitchScreenAction screen; - XkbCtrlsAction ctrls; - XkbMessageAction msg; - XkbRedirectKeyAction redirect; - XkbDeviceBtnAction devbtn; - XkbDeviceValuatorAction devval; - unsigned char type; -} XkbAction; + XkbAnyAction any; + XkbModAction mods; + XkbGroupAction group; + XkbISOAction iso; + XkbPtrAction ptr; + XkbPtrBtnAction btn; + XkbPtrDfltAction dflt; + XkbSwitchScreenAction screen; + XkbCtrlsAction ctrls; + XkbMessageAction msg; + XkbRedirectKeyAction redirect; + XkbDeviceBtnAction devbtn; + XkbDeviceValuatorAction devval; + unsigned char type; +} XkbAction; -The -type - field is provided for convenience and is the same as the type field in the +The +type +field is provided for convenience and is the same as the type field in the individual structures. The following sections describe the individual structures for each action in detail. @@ -455,36 +479,36 @@ structures for each action in detail. The XkbAnyAction Structure + +XkbAnyAction -The -XkbAnyAction - structure is a convenience structure that refers to any of the actions: - +The +XkbAnyAction +structure is a convenience structure that refers to any of the actions: - + #define XkbAnyActionDataSize 7 - - typedef struct _XkbAnyAction { - unsigned char type; /* type of action; determines interpretation for data */ - unsigned char data[XkbAnyActionDataSize]; -} XkbAnyAction; + unsigned char type; /* type of action; determines interpretation for data */ + unsigned char data[XkbAnyActionDataSize]; +} XkbAnyAction; -The -data - field represents a structure for an action, and its interpretation depends on -the -type - field. The valid values for the -type - field, and the data structures associated with them are shown in Table 16.1: +The +data +field represents a structure for an action, and its interpretation depends on +the +type +field. The valid values for the +type +field, and the data structures associated with them are shown in +Table 16.1: - +
Action Types @@ -502,10 +526,10 @@ type - XkbSA_NoAction + XkbSA_NoAction -XkbSA_NoAction - means the server does not perform an action for the key; this action does not +XkbSA_NoAction +means the server does not perform an action for the key; this action does not have an associated data structure. any @@ -513,91 +537,91 @@ have an associated data structure. -XkbSA_SetMods -XkbSA_LatchMods -XkbSA_LockMods +XkbSA_SetMods +XkbSA_LatchMods +XkbSA_LockMods - XkbModAction + XkbModAction mods - 16.1.3 + 16.1.3 -XkbSA_SetGroup -XkbSA_LatchGroup -XkbSA_LockGroup +XkbSA_SetGroup +XkbSA_LatchGroup +XkbSA_LockGroup - XkbGroupAction + XkbGroupAction group - 16.1.4 + 16.1.4 - XkbSA_MovePtr - XkbPtrAction + XkbSA_MovePtr + XkbPtrAction ptr - 16.1.5 + 16.1.5 -XKbSA_PtrBtn -XkbSA_LockPtrBtn +XkbSA_PtrBtn +XkbSA_LockPtrBtn - XkbPtrBtnActionbtn - 16.1.6 + XkbPtrBtnActionbtn + 16.1.6 - XkbSA_SetPtrDflt - XkbPtrDfltAction + XkbSA_SetPtrDflt + XkbPtrDfltAction dflt - 16.1.7 + 16.1.7 - XkbSA_ISOLock - XkbISOAction + XkbSA_ISOLock + XkbISOAction iso - 16.1.8 + 16.1.8 - XkbSA_SwitchScreen - XkbSwitchScreenAction + XkbSA_SwitchScreen + XkbSwitchScreenAction screen - 16.1.9 + 16.1.9 -XkbSA_SetControls -XkbSA_LockControls +XkbSA_SetControls +XkbSA_LockControls - XkbCtrlsAction + XkbCtrlsAction ctrls - 16.1.10 + 16.1.10 - XkbSA_ActionMessage - XkbMessgeAction + XkbSA_ActionMessage + XkbMessageAction msg - 16.1.11 + 16.1.11 - XkbSA_RedirectKey - XkbRedirectKeyAction + XkbSA_RedirectKey + XkbRedirectKeyAction redirect - 16.1.12 + 16.1.12 -XkbSA_DeviceBtn -XKbSA_LockDeviceBtn +XkbSA_DeviceBtn +XkbSA_LockDeviceBtn - XkbDeviceBtnAction + XkbDeviceBtnAction devbtn - 16.1.13 + 16.1.13 - XkbSA_DeviceValuator - XkbDeviceValuatorAction + XkbSA_DeviceValuator + XkbDeviceValuatorAction devval - 16.1.14 + 16.1.14 @@ -606,53 +630,63 @@ have an associated data structure. Actions for Changing Modifiers’ State + +XkbModAction -Actions associated with the -XkbModAction - structure change the state of the modifiers when keys are pressed and released -(see Chapter 7 for a discussion of modifiers): - +Actions associated with the +XkbModAction +structure change the state of the modifiers when keys are pressed and released +(see for a discussion of modifiers): - + typedef struct _XkbModAction { - unsigned char type; /* XkbSA_{Set|Latch|Lock}Mods */ - unsigned char flags; /* with type , controls the effect on modifiers */ - unsigned char mask; /* same as mask field of a modifier description */ - unsigned char real_mods; /* same as real_mods field of a modifier description */ - unsigned char vmods1; /* derived from vmods field of a modifier description */ - unsigned char vmods2; /* derived from vmods field of a modifier description */ -} XkbModAction; + unsigned char type; /* XkbSA_{Set|Latch|Lock}Mods */ + unsigned char flags; /* with type, controls the effect + on modifiers */ + unsigned char mask; /* same as mask field of + a modifier description */ + unsigned char real_mods; /* same as real_mods field of + a modifier description */ + unsigned char vmods1; /* derived from vmods field of + a modifier description */ + unsigned char vmods2; /* derived from vmods field of + a modifier description */ +} XkbModAction; -In the following description, the term -action modifiers - means the real modifier bits associated with this action. Depending on the -value of -flags - (see Table 16.3), these are designated either in the -mask - field of the -XkbModAction - structure itself or the real modifiers bound to the key for which the action -is being used. In the latter case, this is the client -map --> -modmap -[ -keycode +In the following description, the term +action modifiers + +action modifiers + +modifiersaction +means the real modifier bits associated with this action. Depending on the +value of +flags +(see Table 16.3), +these are designated either in the +mask +field of the +XkbModAction +structure itself or the real modifiers bound to the key for which the action +is being used. In the latter case, this is the client +map->modmap +[ +keycode ] field. -The -type - field can have any of the values shown in Table 16.2. +The +type +field can have any of the values shown in +Table 16.2. -
+
Modifier Action Types @@ -666,7 +700,7 @@ type - XkbSA_SetMods + XkbSA_SetMods @@ -683,78 +717,77 @@ provided no other key affecting the same modifiers is logically down. If no other keys are physically depressed when this key is released, and - -XkbSA_ClearLocks - is set in the -flags - field, the key release unlocks any action modifiers. +XkbSA_ClearLocks +is set in the +flags +field, the key release unlocks any action modifiers. - XkbSA_LatchMods + XkbSA_LatchMods -Key press and key release events have the same effect as for -XkbSA_SetMods -; if no keys are physically depressed when this key is released, key release +Key press and key release events have the same effect as for +XkbSA_SetMods; +if no keys are physically depressed when this key is released, key release events have the following additional effects: -Modifiers unlocked due to -XkbSA_ClearLocks - have no further effect. +Modifiers unlocked due to +XkbSA_ClearLocks +have no further effect. -If -XkbSA_LatchToLock - is set in the -flags - field, a key release locks and then unlatches any remaining action modifiers +If +XkbSA_LatchToLock +is set in the +flags +field, a key release locks and then unlatches any remaining action modifiers that are already latched. -A key release latches any action modifiers not used by the -XkbSA_ClearLocks - and -XkbSA_LatchToLock - flags. +A key release latches any action modifiers not used by the +XkbSA_ClearLocks +and +XkbSA_LatchToLock +flags. - XkbSA_LockMods + XkbSA_LockMods -A key press sets the base state of any action modifiers. If -XkbSA_LockNoLock - is set in the -flags - field, a key press also sets the locked state of any action modifiers. +A key press sets the base state of any action modifiers. If +XkbSA_LockNoLock +is set in the +flags +field, a key press also sets the locked state of any action modifiers. A key release clears any action modifiers in the keyboard’s base modifiers, -provided no other key that affects the same modifiers is down. If -XkbSA_LockNoUnlock - is not set in the -flags - field, and any of the action modifiers were locked before the corresponding +provided no other key that affects the same modifiers is down. If +XkbSA_LockNoUnlock +is not set in the +flags +field, and any of the action modifiers were locked before the corresponding key press occurred, a key release unlocks them. @@ -766,14 +799,15 @@ key press occurred, a key release unlocks them.
-The -flags - field is composed of the bitwise inclusive OR of the masks shown in Table -16.3. A general meaning is given in the table, but the exact meaning depends on -the action type. +The +flags +field is composed of the bitwise inclusive OR of the masks shown in +Table 16.3. +A general meaning is given in the table, but the exact meaning depends on +the action type. - +
Modifier Action Flags @@ -787,50 +821,48 @@ the action type. - XkbSA_UseModMapMods + XkbSA_UseModMapMods If set, the action modifiers are determined by the modifiers bound by the modifier mapping of the key. Otherwise, the action modifiers are set to the -modifiers specified by the -mask -, -real_mods -, -vmod1 -, and -vmod2 - fields. +modifiers specified by the +mask, +real_mods, +vmods1, +and +vmods2 +fields. - XkbSA_ClearLocks + XkbSA_ClearLocks If set and no keys are physically depressed when this key transition occurs, the server unlocks any action modifiers. - XkbSA_LatchToLock + XkbSA_LatchToLock -If set, and the action type is -XkbSA_LatchMods -, the server locks the action modifiers if they are already latched. +If set, and the action type is +XkbSA_LatchMods, +the server locks the action modifiers if they are already latched. - XkbSA_LockNoLock + XkbSA_LockNoLock -If set, and the action type is -XkbSA_LockMods -, the server only unlocks the action modifiers. +If set, and the action type is +XkbSA_LockMods, +the server only unlocks the action modifiers. - XkbSA_LockNoUnlock + XkbSA_LockNoUnlock -If set, and the action is -XkbSA_LockMods -, the server only locks the action modifiers. +If set, and the action is +XkbSA_LockMods, +the server only locks the action modifiers. @@ -838,177 +870,172 @@ XkbSA_LockMods
-If -XkbSA_UseModMapMods - is not set in the -flags - field, the -mask -, -real_mods -, -vmods1 -, and -vmods2 +If +XkbSA_UseModMapMods +is not set in the +flags +field, the +mask, +real_mods, +vmods1, +and +vmods2 fields are used to determine the action modifiers. Otherwise they are ignored -and the modifiers bound to the key (client -map --> -modmap -[ -keycode +and the modifiers bound to the key (client +map->modmap +[ +keycode ]) are used instead. -The -mask -, -real_mods -, -vmods1 -, and -vmods2 - fields represent the components of an Xkb modifier description (see section -7.2). While the -mask - and -real_mods - fields correspond directly to the -mask - and -real_mods - fields of an Xkb modifier description, the -vmods1 - and -vmods2 - fields are combined to correspond to the -vmods - field of an Xkb modifier description. Xkb provides the following macros, to +The +mask, +real_mods, +vmods1, +and +vmods2 +fields represent the components of an Xkb modifier description +(see section 7.2). While the +mask +and +real_mods +fields correspond directly to the +mask +and +real_mods +fields of an Xkb modifier description, the +vmods1 +and +vmods2 +fields are combined to correspond to the +vmods +field of an Xkb modifier description. Xkb provides the following macros, to convert between the two formats: - - - - - - - -unsigned short -XkbModActionVMods -( -act -) /* macro */ - - - - -XkbAction -act -; /* action from which to extract virtual mods */ - - - - - - - - -XkbModActionVMods - returns the -vmods1 - and -vmods2 - fields of -act - converted to the -vmods - format of an Xkb modifier description. - - - - - - - - - - -void -XkbSetModActionVMods -( -act, vmods -) /* macro */ - - - - -XkbAction -act -; /* action in which to set vmods */ - - - - -unsigned short -vmods -; /* virtual mods to set */ - - - - - +XkbModActionVMods + + + unsigned short XkbModActionVMods + + + XkbAction act + + + + + + act + + + + action from which to extract virtual mods + + + + + + +XkbModActionVMods +returns the +vmods1 +and +vmods2 +fields of +act +converted to the +vmods +format of an Xkb modifier description. + + + +XkbSetModActionVMods + + + void XkbSetModActionVMods + + + XkbAction act + unsigned short vmods + + + + + + act + + + + action in which to set vmods + + + + + + vmods + + + + virtual mods to set + + + + - -XkbSetModActionVMods - sets the -vmods1 - and -vmods2 - fields of -act - using the -vmods - format of an Xkb modifier description. +XkbSetModActionVMods +sets the +vmods1 +and +vmods2 +fields of +act +using the +vmods +format of an Xkb modifier description. Despite the fact that the first parameter of these two macros is of -type XkbAction, these macros may be used only with Actions of type -XkbModAction - and -XkbISOAction -. +type XkbAction, these macros may be used only with Actions of type +XkbModAction +and +XkbISOAction. +
Actions for Changing Group State + +XkbGroupAction -Actions associated with the -XkbGroupAction - structure change the current group state when keys are pressed and released -(see Chapter 5 for a description of groups and keyboard state): - +Actions associated with the +XkbGroupAction +structure change the current group state when keys are pressed and released +(see for a description of groups and keyboard state): - + typedef struct _XkbGroupAction { - unsigned char type; /* XkbSA_{Set|Latch|Lock}Group */ - unsigned char flags; /* with type , controls the effect on groups */ - char group_XXX; /* represents a group index or delta */ -} XkbGroupAction; + unsigned char type; /* XkbSA_{Set|Latch|Lock}Group */ + unsigned char flags; /* with type , controls the effect on groups */ + char group_XXX; /* represents a group index or delta */ +} XkbGroupAction; -The -type - field can have any of the following values: +The +type +field can have any of the following values: - +
Group Action Types @@ -1022,76 +1049,72 @@ type - XkbSA_SetGroup + XkbSA_SetGroup -If the -XkbSA_GroupAbsolute - bit is set in the -flags - field, key press events change the base keyboard group to the group specified -by the -group_XXX - field. Otherwise, key press events change the base keyboard group by adding -the -group_XXX - field to the base keyboard group. In either case, the resulting effective +If the +XkbSA_GroupAbsolute +bit is set in the +flags +field, key press events change the base keyboard group to the group specified +by the +group_XXX +field. Otherwise, key press events change the base keyboard group by adding +the +group_XXX +field to the base keyboard group. In either case, the resulting effective keyboard group is brought back into range depending on the value of the - -groups_wrap - field of the controls structure (see section 10.7.1). +groups_wrap +field of the controls structure (see section 10.7.1). -If a key with an -XkbSA_ISOLock - action (see section 16.1.8) is pressed while this key is down, the key release +If a key with an +XkbSA_ISOLock +action (see section 16.1.8) is pressed while this key is down, the key release of this key has no effect. Otherwise, the key release cancels the effects of the key press. -If the -XkbSA_ClearLocks - bit is set in the flags field, and no keys are physically depressed when this +If the +XkbSA_ClearLocks +bit is set in the flags field, and no keys are physically depressed when this key is released, the key release also sets the locked keyboard group to - -Group1 -. - +Group1. + - XkbSA_LatchGroup + XkbSA_LatchGroup -Key press and key release events have the same effect as for -XkbSA_SetGroup -; if no keys are physically depressed when this key is released, key release +Key press and key release events have the same effect as for +XkbSA_SetGroup; +if no keys are physically depressed when this key is released, key release events have the following additional effects. -If the -XkbSA_LatchToLock - bit is set in the -flags - field and the latched keyboard group index is nonzero, the key release adds +If the +XkbSA_LatchToLock +bit is set in the +flags +field and the latched keyboard group index is nonzero, the key release adds the delta applied by the corresponding key press to the locked keyboard group and subtracts it from the latched keyboard group. The locked and effective keyboard group are brought back into range according to the value of the - -groups_wrap - field of the controls structure. +groups_wrap +field of the controls structure. @@ -1103,25 +1126,25 @@ Otherwise, the key press adds the key press delta to the latched keyboard group. - XkbSA_LockGroup + XkbSA_LockGroup -If the -XkbSA_GroupAbsolute - is set in the -flags - field, key press events set the locked keyboard group to the group specified -by the -group_XXX - field. Otherwise, key press events add the group specified by the -group_XXX - field to the locked keyboard group. In either case, the resulting locked and +If the +XkbSA_GroupAbsolute +is set in the +flags +field, key press events set the locked keyboard group to the group specified +by the +group_XXX +field. Otherwise, key press events add the group specified by the +group_XXX +field to the locked keyboard group. In either case, the resulting locked and effective keyboard groups are brought back into range depending on the value of -the -groups_wrap - field of the controls structure. +the +groups_wrap +field of the controls structure. @@ -1137,16 +1160,16 @@ A key release has no effect.
-The -flags - field is composed of the bitwise inclusive OR of the masks shown in Table -16.5. A general meaning is given in the table, but the exact meaning depends on -the action -type -. +The +flags +field is composed of the bitwise inclusive OR of the masks shown in +Table 16.5. +A general meaning is given in the table, but the exact meaning depends on +the action +type. - +
Group Action Flags @@ -1160,28 +1183,28 @@ type - XkbSA_ClearLocks + XkbSA_ClearLocks If set and no keys are physically depressed when this key transition occurs, -the server sets the locked keyboard group to -Group1 - on a key release. +the server sets the locked keyboard group to +Group1 +on a key release. - XkbSA_LatchToLock + XkbSA_LatchToLock -If set, and the action type is -SA_LatchGroup -, the server locks the action group if it is already latched. +If set, and the action type is +XkbSA_LatchGroup, +the server locks the action group if it is already latched. - XkbSA_GroupAbsolute + XkbSA_GroupAbsolute -If set, the -group_XXX - field represents an absolute group number. Otherwise, it represents a group +If set, the +group_XXX +field represents an absolute group number. Otherwise, it represents a group delta to be added to the current group to determine the new group number. @@ -1190,170 +1213,168 @@ delta to be added to the current group to determine the new group number.
-The -group_XXX - field represents a signed character. Xkb provides the following macros to +The +group_XXX +field represents a signed character. Xkb provides the following macros to convert between a signed integer value and a signed character: - - - - - - - -int -XkbSAGroup -( -act -) /* macro */ - - - - -XkbAction -act -; /* action from which to extract group */ - - - - - - - - -XkbSAGroup - returns the -group_XXX - field of -act - converted to a signed int. - - - - - - - - - - -void -XkbSASetGroup -( -act, grp -) /* macro */ - - - - -XkbAction -act -; /* action from which to set group */ - - - - -int -grp -; /* group index to set in -group_XXX - */ - - - - - +XkbSAGroup + + + int XkbSAGroup + + + XkbAction act + + + + + + act + + + + action from which to extract group + + + + + + +XkbSAGroup +returns the +group_XXX +field of +act +converted to a signed int. + + + +XkbSASetGroup + + + void XkbSASetGroup + + + XkbAction act + int grp + + + + + + act + + + + action from which to set group + + + + + + grp + + + + group index to set in group_XXX + + + + - -XkbSASetGroup - sets the -group_XXX - field of -act - from the group index -grp -. +XkbSASetGroup +sets the +group_XXX +field of +act +from the group index +grp. Despite the fact that the first parameter of these two macros is of -type XkbAction, these macros may only be used with Actions of type -XkbGroupAction - and -XkbISOAction -. +type XkbAction, these macros may only be used with Actions of type +XkbGroupAction +and +XkbISOAction. +
Actions for Moving the Pointer + +XkbPtrAction -Actions associated with the -XkbPtrAction - structure move the pointer when keys are pressed and released: - +Actions associated with the +XkbPtrAction +structure move the pointer when keys are pressed and released: - + typedef struct _XkbPtrAction { - unsigned char type; /* XkbSA_MovePtr */ - unsigned char flags; /* determines type of pointer motion */ - unsigned char high_XXX; /* x coordinate, high bits*/ - unsigned char low_XXX; /* y coordinate, low bits */ - unsigned char high_YYY; /* x coordinate, high bits */ - unsigned char low_YYY; /* y coordinate, low bits */ -} XkbPtrAction; + unsigned char type; /* XkbSA_MovePtr */ + unsigned char flags; /* determines type of pointer motion */ + unsigned char high_XXX; /* x coordinate, high bits */ + unsigned char low_XXX; /* y coordinate, low bits */ + unsigned char high_YYY; /* x coordinate, high bits */ + unsigned char low_YYY; /* y coordinate, low bits */ +} XkbPtrAction; -If the -MouseKeys - control is not enabled (see section 10.5.1), -KeyPress - and -KeyRelease - events are treated as though the action is -XkbSA_NoAction. +If the +MouseKeys +control is not enabled (see section 10.5.1), +KeyPress +and +KeyRelease +events are treated as though the action is +XkbSA_NoAction. -If the -MouseKeys - control is enabled, a server action of type -XkbSA_MovePtr - instructs the server to generate core pointer -MotionNotify - events rather than the usual -KeyPress - event, and the corresponding -KeyRelease - event disables any mouse keys timers that were created as a result of handling -the -XkbSA_MovePtr - action. +If the +MouseKeys +control is enabled, a server action of type +XkbSA_MovePtr +instructs the server to generate core pointer +MotionNotify +events rather than the usual +KeyPress +event, and the corresponding +KeyRelease +event disables any mouse keys timers that were created as a result of handling +the +XkbSA_MovePtr +action. -The -type - field of the -XkbPtrAction - structure is always -XkbSA_MovePtr -. +The +type +field of the +XkbPtrAction +structure is always +XkbSA_MovePtr. -The -flags - field is a bitwise inclusive OR of the masks shown in Table 16.6. +The +flags +field is a bitwise inclusive OR of the masks shown in +Table 16.6. - +
Pointer Action Types @@ -1367,25 +1388,25 @@ flags - XkbSA_NoAcceleration + XkbSA_NoAcceleration -If not set, and the -MouseKeysAccel - control is enabled (see section 10.5.2), the -KeyPress - initiates a mouse keys timer for this key; every time the timer expires, the +If not set, and the +MouseKeysAccel +control is enabled (see section 10.5.2), the +KeyPress +initiates a mouse keys timer for this key; every time the timer expires, the cursor moves. - XkbSA_MoveAbsoluteX + XkbSA_MoveAbsoluteX If set, the X portion of the structure specifies the new pointer X coordinate. Otherwise, the X portion is added to the current pointer X coordinate to determine the new pointer X coordinate. - XkbSA_MoveAbsoluteY + XkbSA_MoveAbsoluteY If set, the Y portion of the structure specifies the new pointer Y coordinate. Otherwise, the Y portion is added @@ -1397,262 +1418,261 @@ to the current pointer Y coordinate to determine the new pointer Y coordinate.
-Each of the X and Y coordinantes of the -XkbPtrAction - structure is composed of two signed 16-bit values, that is, the X coordinate -is composed of -high_XXX - and -low_XXX -, and similarly for the Y coordinate. Xkb provides the following macros, to -convert between a signed integer and two signed 16-bit values in -XkbPtrAction - structures: +Each of the X and Y coordinates of the +XkbPtrAction +structure is composed of two signed 16-bit values, that is, the X coordinate +is composed of +high_XXX +and +low_XXX, +and similarly for the Y coordinate. Xkb provides the following macros, to +convert between a signed integer and two signed 16-bit values in +XkbPtrAction +structures: + + +XkbPtrActionX + + + int XkbPtrActionX + + + XkbPtrAction act + + + + + + act + + + + action from which to extract X + + + + + + +XkbPtrActionX +returns the +high_XXX +and +low_XXX +fields of +act +converted to a signed int. + + + +XkbPtrActionY + + + int XkbPtrActionY + + + XkbPtrAction act + + + + + + act + + + + action from which to extract Y + + + + + + +XkbPtrActionY +returns the +high_YYY +and +low_YYY +fields of +act +converted to a signed int. + + + +XkbSetPtrActionX + + + void XkbSetPtrActionX + + + XkbPtrAction act + int x + + + + + + act + + + + action in which to set X + + + + + + x + + + + new value to set + + + + + + +XkbSetPtrActionX +sets the +high_XXX +and +low_XXX +fields of +act +from the signed integer value +x. + + + +XkbSetPtrActionY + + + void XkbSetPtrActionY + + + XkbPtrAction act + int y + + + + + + act + + + + action in which to set Y + + + + + + y + + + + new value to set + + + + + + +XkbSetPtrActionX +sets the +high_YYY +and +low_YYY +fields of +act +from the signed integer value +y. - - - - - - - -int -XkbPtrActionX -( -act -) /* macro */ - - - - -XkbPtrAction -act -; /* action from which to extract X */ - - - - - + +
+ +Actions for Simulating Pointer Button Press and Release + +XkbPtrBtnAction + + +Actions associated with the +XkbPtrBtnAction +structure simulate the press and release of pointer buttons when keys are +pressed and released: + + +typedef struct _XkbPtrBtnAction { + unsigned char type; /* XkbSA_PtrBtn, XkbSA_LockPtrBtn */ + unsigned char flags; /* with type, controls the effect + on pointer buttons */ + unsigned char count; /* controls number of ButtonPress and + ButtonRelease events */ + unsigned char button; /* pointer button to simulate */ +} XkbPtrBtnAction; + - -XkbPtrActionX - returns the -high_XXX - and -low_XXX - fields of -act - converted to a signed int. +If the +MouseKeys +(see section 10.5.1) control is not enabled, +KeyPress +and +KeyRelease +events are treated as though the action is +XkbSA_NoAction. - + +The +type +field can have any one of the values shown in +Table 16.7. + + + +Pointer Button Action Types - + + + + + Type + Effect + + - -int -XkbPtrActionY -( -act -) /* macro */ - - - - -XkbPtrAction -act -; /* action from which to extract Y */ - - - - - - - - -XkbPtrActionY - returns the -high_YYY - and -low_YYY - fields of -act - converted to a signed int. - - - - - - - - - - -void -XkbSetPtrActionX -( -act -, -x -) /* macro */ - - - - -XkbPtrAction -act -; /* action in which to set X */ - - - - -int -x; - /* new value to set */ - - - - - - - - -XkbSetPtrActionX - sets the -high_XXX - and -low_XXX - fields of -act - from the signed integer value -x -. - - - - - - - - - - -void -XkbSetPtrActionY -( -act, y -) /* macro */ - - - - -XkbPtrAction -act -; /* action in which to set Y */ - - - - -int -y -; /* new value to set */ - - - - - - - - -XkbSetPtrActionX - sets the -high_YYY - and -low_YYY - fields of -act - from the signed integer value -y -. - - - - - -Actions for Simulating Pointer Button Press and Release - - -Actions associated with the -XkbPtrBtnAction - structure simulate the press and release of pointer buttons when keys are -pressed and released: - - - -typedef struct _XkbPtrBtnAction { - unsigned char type; /* XkbSA_PtrBtn, XkbSA_LockPtrBtn */ - unsigned char flags; /* with type , controls the effect on pointer buttons*/ - unsigned char count; /* controls number of ButtonPress and ButtonRelease events */ - unsigned char button; /* pointer button to simulate */ -} XkbPtrBtnAction; - - - -If the -MouseKeys - (see section 10.5.1) control is not enabled, -KeyPress - and -KeyRelease - events are treated as though the action is -XkbSA_NoAction -. - - - - -The -type - field can have any one of the values shown in Table 16.7. - - -
-Pointer Button Action Types - - - - - - - Type - Effect - - - - - XkbSA_PtrBtn + XkbSA_PtrBtn -If - XkbSA_UseDfltButton - is set in the -flags - field, the event is generated for the pointer button specified by the - -mk_dflt_btn - attribute of the -MouseKeys - control (see section 10.5.1). Otherwise, the event is generated for the button -specified by the -button - field. +If +XkbSA_UseDfltButton +is set in the +flags +field, the event is generated for the pointer button specified by the +mk_dflt_btn +attribute of the +MouseKeys +control (see section 10.5.1). Otherwise, the event is generated for the button +specified by the +button +field. @@ -1660,83 +1680,81 @@ button If the mouse button specified for this action is logically down, the key press and corresponding key release are ignored and have no effect. Otherwise, a key press causes one or more core pointer button events instead of the usual - -KeyPress - event. If -count - is -zero -, a key press generates a single -ButtonPress - event; if -count - is greater than -zero -, a key press generates -count - pairs of -ButtonPress - and -ButtonRelease - events. +KeyPress +event. If +count +is +zero, +a key press generates a single +ButtonPress +event; if +count +is greater than +zero, +a key press generates +count +pairs of +ButtonPress +and +ButtonRelease +events. -If -count - is -zero -, a key release generates a core pointer -ButtonRelease - that matches the event generated by the corresponding -KeyPress -; if -count - is nonzero, a key release does not cause a -ButtonRelease - event. A key release never generates a key -KeyRelease - event. +If +count +is +zero, +a key release generates a core pointer +ButtonRelease +that matches the event generated by the corresponding +KeyPress; +if +count +is nonzero, a key release does not cause a +ButtonRelease +event. A key release never generates a key +KeyRelease +event. - XkbSA_LockPtrBtn + XkbSA_LockPtrBtn -If the button specified by the -MouseKeys - default button - -or -button - is not locked, a key press causes a -ButtonPress - event instead of a -KeyPress - event and locks the button. If the button is already locked or if -XkbSA_LockNoUnlock - is set in the -flags - field, a key press is ignored and has no effect. +If the button specified by the +MouseKeys +default button +or +button +is not locked, a key press causes a +ButtonPress +event instead of a +KeyPress +event and locks the button. If the button is already locked or if +XkbSA_LockNoUnlock +is set in the +flags +field, a key press is ignored and has no effect. -If the corresponding key press was ignored, and if -XkbSA_LockNoLock - is not set in the -flags - field, a key release generates a -ButtonRelease - event instead of a -KeyRelease - event and unlocks the specified button. If the corresponding key press locked +If the corresponding key press was ignored, and if +XkbSA_LockNoLock +is not set in the +flags +field, a key release generates a +ButtonRelease +event instead of a +KeyRelease +event and unlocks the specified button. If the corresponding key press locked a button, the key release is ignored and has no effect. @@ -1748,16 +1766,16 @@ a button, the key release is ignored and has no effect.
-The -flags - field is composed of the bitwise inclusive OR of the masks shown in Table -16.8. A general meaning is given in the table, but the exact meaning depends on -the action -type. -: +The +flags +field is composed of the bitwise inclusive OR of the masks shown in +Table 16.8. +A general meaning is given in the table, but the exact meaning depends on +the action +type: - +
Pointer Button Action Flags @@ -1771,32 +1789,32 @@ type. - XkbSA_UseDfltButton + XkbSA_UseDfltButton -If set, the action uses the pointer button specified by the -mk_dflt_btn - attribute of the -MouseKeys - control (see section 10.5.1). Otherwise, the action uses the pointer button -specified by the - button +If set, the action uses the pointer button specified by the +mk_dflt_btn +attribute of the +MouseKeys +control (see section 10.5.1). Otherwise, the action uses the pointer button +specified by the +button field. - XkbSA_LockNoLock + XkbSA_LockNoLock -If set, and the action type is -XkbSA_LockPtrBtn -, the server only unlocks the pointer button. +If set, and the action type is +XkbSA_LockPtrBtn, +the server only unlocks the pointer button. - XkbSA_LockNoUnlock + XkbSA_LockNoUnlock -If set, and the action type is -XkbSA_LockPtrBtn -, the server only locks the pointer button. +If set, and the action type is +XkbSA_LockPtrBtn, +the server only locks the pointer button. @@ -1806,62 +1824,63 @@ XkbSA_LockPtrBtn Actions for Changing the Pointer Button Simulated + +XkbPtrDfltAction -Actions associated with the -XkbPtrDfltAction - structure change the -mk_dflt_btn - attribute of the -MouseKeys - control (see section 10.5.1): - +Actions associated with the +XkbPtrDfltAction +structure change the +mk_dflt_btn +attribute of the +MouseKeys +control (see section 10.5.1): - + typedef struct _XkbPtrDfltAction { - unsigned char type; /* XkbSA_SetPtrDflt */ - unsigned char flags; /* controls the pointer button number */ - unsigned char affect; /* XkbSA_AffectDfltBtn */ - char valueXXX; /* new default button member */ -} XkbPtrDfltAction; + unsigned char type; /* XkbSA_SetPtrDflt */ + unsigned char flags; /* controls the pointer button number */ + unsigned char affect; /* XkbSA_AffectDfltBtn */ + char valueXXX; /* new default button member */ +} XkbPtrDfltAction; -If the -MouseKeys - control is not enabled, -KeyPress - and -KeyRelease - events are treated as though the action is -XkbSA_NoAction -. Otherwise, this action changes the -mk_dflt_btn - attribute of the -MouseKeys - control. +If the +MouseKeys +control is not enabled, +KeyPress +and +KeyRelease +events are treated as though the action is +XkbSA_NoAction. +Otherwise, this action changes the +mk_dflt_btn +attribute of the +MouseKeys +control. -The -type - field of the -XkbPtrDfltAction - structure should always be -XkbSA_SetPtrDflt -. +The +type +field of the +XkbPtrDfltAction +structure should always be +XkbSA_SetPtrDflt. -The -flags - field is composed of the bitwise inclusive OR of the values shown in Table -16.9 (currently there is only one value defined). +The +flags +field is composed of the bitwise inclusive OR of the values shown in +Table 16.9 +(currently there is only one value defined). -
+
Pointer Default Flags @@ -1875,13 +1894,13 @@ flags - XkbSA_DfltBtnAbsolute + XkbSA_DfltBtnAbsolute -If set, the -value - field represents an absolute pointer button. Otherwise, the -value - field represents the amount to be added to the current default button. +If set, the +value +field represents an absolute pointer button. Otherwise, the +value +field represents the amount to be added to the current default button. @@ -1889,219 +1908,219 @@ value
-The -affect - field specifies what changes as a result of this action. The only valid value -for the -affect - field is XkbSA_AffectDfltBtn. - - - -The -valueXXX - field is a signed character that represents the new button value for the - -mk_dflt_btn - attribute of the -MouseKeys - control (see section 10.5.1). If -XkbSA_DfltBtnAbsolute - is set in -flags -, -valueXXX - specifies the button to be used; otherwise, -valueXXX - specifies the amount to be added to the current default button. In either +The +affect +field specifies what changes as a result of this action. The only valid value +for the +affect +field is XkbSA_AffectDfltBtn. + + + +The +valueXXX +field is a signed character that represents the new button value for the +mk_dflt_btn +attribute of the +MouseKeys +control (see section 10.5.1). If +XkbSA_DfltBtnAbsolute +is set in +flags, +valueXXX +specifies the button to be used; otherwise, +valueXXX +specifies the amount to be added to the current default button. In either case, illegal button choices are wrapped back around into range. Xkb provides the following macros, to convert between the integer and signed character -values in -XkbPtrDfltAction - structures: - - - - - - - - - -int -XkbSAPtrDfltValue -( -act -) /* macro */ - - - - -XkbAction -act -; /* action from which to extract group */ - - - - - - - - -XkbSAPtrDfltValue - returns the -valueXXX - field of -act - converted to a signed int. - - - - - - - - - - -void -XkbSASetPtrDfltValue -( -act, val -) /* macro */ - - - - -XkbPtrDfltAction -act -; /* action in which to set -valueXXX - */ - - - - -int -val -; /* value to set in -valueXXX - */ - - - - - +values in +XkbPtrDfltAction +structures: + + +XkbSAPtrDfltValue + + + int XkbSAPtrDfltValue + + + XkbAction act + + + + + + act + + + + action from which to extract group + + + + + + +XkbSAPtrDfltValue +returns the +valueXXX +field of +act +converted to a signed int. + + + +XkbSASetPtrDfltValue + + + void XkbSASetPtrDfltValue + + + XkbPtrDfltAction act + int val + + + + + + act + + + + action in which to set valueXXX + + + + + + val + + + + value to set in valueXXX + + + + - -XkbSASetPtrDfltValue - sets the -valueXXX - field of -act - from -val -. +XkbSASetPtrDfltValue +sets the +valueXXX +field of +act +from +val.
Actions for Locking Modifiers and Group + +XkbISOAction -Actions associated with the -XkbISOAction - structure lock modifiers and the group according to the ISO9995 specification. +Actions associated with the +XkbISOAction +structure lock modifiers and the group according to the ISO9995 specification. -Operated by itself, the -XkbISOAction - is just a caps lock. Operated simultaneously with another modifier key, it -transforms the other key into a locking key. For example, press -ISO_Lock -, press and release -Control_L -, release -ISO_Lock - ends up locking the -Control - modifier. +Operated by itself, the +XkbISOAction +is just a caps lock. Operated simultaneously with another modifier key, it +transforms the other key into a locking key. For example, press +ISO_Lock, +press and release +Control_L, +release +ISO_Lock +ends up locking the +Control +modifier. The default behavior is to convert: - - - {Set,Latch}Mods to: LockMods - {Set,Latch}Group to: LockGroup - SetPtrBtn to: LockPtrBtn - SetControls to: LockControls - + + {Set,Latch}Mods to: LockMods + {Set,Latch}Group to: LockGroup + SetPtrBtn to: LockPtrBtn + SetControls to: LockControls + + -The -affects - field allows you to turn those effects on or off individually. Set -XkbSA_ISONoAffectMods - to disable the first, -XkbSA_ISONoAffectGroup - to disable the second, and so forth. +The +affects +field allows you to turn those effects on or off individually. Set +XkbSA_ISONoAffectMods +to disable the first, +XkbSA_ISONoAffectGroup +to disable the second, and so forth. typedef struct _XkbISOAction { - unsigned char type; /* XkbSA_ISOLock */ - unsigned char flags; /* controls changes to group or modifier state */ - unsigned char mask; /* same as mask field of a modifier description */ - unsigned char real_mods; /* same as real_mods field of a modifier description */ - char group_XXX; /* group index or delta group */ - unsigned char affect; /* specifies whether to affect mods, group, ptrbtn, or controls*/ - unsigned char vmods1; /* derived from vmods field of a modifier description */ - unsigned char vmods2; /* derived from vmods field of a modifier description */ -} XkbISOAction; + unsigned char type; /* XkbSA_ISOLock */ + unsigned char flags; /* controls changes to group or + modifier state */ + unsigned char mask; /* same as mask field of + a modifier description */ + unsigned char real_mods; /* same as real_mods field of + a modifier description */ + char group_XXX; /* group index or delta group */ + unsigned char affect; /* specifies whether to affect + mods, group, ptrbtn, or controls */ + unsigned char vmods1; /* derived from vmods field of + a modifier description */ + unsigned char vmods2; /* derived from vmods field of + a modifier description */ +} XkbISOAction; -The -type - field of the -XkbISOAction - structure should always be -XkbSA_ISOLock -. +The +type +field of the +XkbISOAction +structure should always be +XkbSA_ISOLock. -The interpretation of the -flags - field depends on whether the -XkbSA_ISODfltIsGroup - is set in the -flags - field or not. +The interpretation of the +flags +field depends on whether the +XkbSA_ISODfltIsGroup +is set in the +flags +field or not. -If the -XkbSA_ISODfltIsGroup - is set in the -flags - field, the action is used to change the group state. The remaining valid bits -of the -flags - field are composed of a bitwise inclusive OR using the masks shown in Table -16.10. +If the +XkbSA_ISODfltIsGroup +is set in the +flags +field, the action is used to change the group state. The remaining valid bits +of the +flags +field are composed of a bitwise inclusive OR using the masks shown in +Table 16.10. - +
ISO Action Flags when XkbSA_ISODfltIsGroup is Set @@ -2115,85 +2134,85 @@ flags - XkbSA_ISODfltIsGroup + XkbSA_ISODfltIsGroup If set, the action is used to change the base group state. Must be set for the remaining bits in this table to carry their interpretations. -A key press sets the base group as specified by the -group_XXX - field and the -XkbSA_GroupAbsolute - bit of the -flags - field (see section Note). If no other actions are transformed by the -XkbISO_Lock - action, a key release locks the group. Otherwise, a key release clears group +A key press sets the base group as specified by the +group_XXX +field and the +XkbSA_GroupAbsolute +bit of the +flags +field (see section Note). If no other actions are transformed by the +XkbSA_ISOLock +action, a key release locks the group. Otherwise, a key release clears group set by the key press. - XkbSA_GroupAbsolute + XkbSA_GroupAbsolute -If set, the -group_XXX - field represents an absolute group number. Otherwise, it represents a group +If set, the +group_XXX +field represents an absolute group number. Otherwise, it represents a group delta to be added to the current group to determine the new group number. - XkbSA_ISONoAffectMods + XkbSA_ISONoAffectMods -If not set, any -XkbSA_SetMods - or -XkbSA_LatchMods - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockMod - actions instead. +If not set, any +XkbSA_SetMods +or +XkbSA_LatchMods +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockMods +actions instead. - XkbSA_ISONoAffectGroup + XkbSA_ISONoAffectGroup -If not set, any -XkbSA_SetGroup - or -XkbSA_LatchGroup - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockGroup - actions instead. +If not set, any +XkbSA_SetGroup +or +XkbSA_LatchGroup +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockGroup +actions instead. - XkbSA_ISONoAffectPtr + XkbSA_ISONoAffectPtr -If not set, any -XkbSA_PtrBtn - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockPtrBtn - actions instead. +If not set, any +XkbSA_PtrBtn +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockPtrBtn +actions instead. - XkbSA_ISONoAffectCtrls + XkbSA_ISONoAffectCtrls -If not set, any -XkbSA_SetControls - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockControls - actions instead. +If not set, any +XkbSA_SetControls +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockControls +actions instead. @@ -2201,18 +2220,18 @@ XkbSA_LockControls
-If the -XkbSA_ISODfltIsGroup - is not set in the -flags - field, the action is used to change the modifier state and the remaining valid -bits of the -flags - field are composed of a bitwise inclusive OR using the masks shown in Table -16.11. +If the +XkbSA_ISODfltIsGroup +is not set in the +flags +field, the action is used to change the modifier state and the remaining valid +bits of the +flags +field are composed of a bitwise inclusive OR using the masks shown in +Table 16.11. - +
ISO Action Flags when XkbSA_ISODfltIsGroup is Not Set @@ -2226,7 +2245,7 @@ flags - XkbSA_ISODfltIsGroup + XkbSA_ISODfltIsGroup If not set, action is used to change the base modifier state. Must not be set @@ -2234,96 +2253,91 @@ for the remaining bits in this table to carry their interpretations. A key press sets the action modifiers in the keyboard’s base modifiers using -the -mask -, -real_mods -, -vmods1 -, and -vmods2 -fields (see section 16.1.3). If no other actions are transformed by the - -XkbISO_Lock - action, a key release locks the action modifiers. Otherwise, a key release +the +mask, +real_mods, +vmods1, +and +vmods2 +fields (see section 16.1.3). If no other actions are transformed by the +XkbSA_ISOLock +action, a key release locks the action modifiers. Otherwise, a key release clears the base modifiers set by the key press. - XkbSA_UseModMapMods + XkbSA_UseModMapMods If set, the action modifiers are determined by the modifiers bound by the modifier mapping of the key. Otherwise, the action modifiers are set to the -modifiers specified by the -mask -, -real_mods -, -vmod1 -, and -vmod2 - fields. +modifiers specified by the +mask, +real_mods, +vmods1, +and +vmods2 +fields. - XkbSA_LockNoLock + XkbSA_LockNoLock If set, the server only unlocks the action modifiers. - XkbSA_LockNoUnlock + XkbSA_LockNoUnlock If set, the server only locks the action modifiers. - XkbSA_ISONoAffectMods + XkbSA_ISONoAffectMods -If not set, any -XkbSA_SetMods - or -XkbSA_LatchMods - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockMod - actions instead. +If not set, any +XkbSA_SetMods +or +XkbSA_LatchMods +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockMods +actions instead. - XkbSA_ISONoAffectGroup + XkbSA_ISONoAffectGroup -If not set, any -XkbSA_SetGroup - or -XkbSA_LatchGroup - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockGroup - actions instead. +If not set, any +XkbSA_SetGroup +or +XkbSA_LatchGroup +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockGroup +actions instead. - XkbSA_ISONoAffectPtr + XkbSA_ISONoAffectPtr -If not set, any -XkbSA_PtrBtn - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockPtrBtn - actions instead. +If not set, any +XkbSA_PtrBtn +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockPtrBtn +actions instead. - XkbSA_ISONoAffectCtrls + XkbSA_ISONoAffectCtrls -If not set, any -XkbSA_SetControls - actions that occur simultaneously with the -XkbSA_ISOLock - action are treated as -XkbSA_LockControls - actions instead. +If not set, any +XkbSA_SetControls +actions that occur simultaneously with the +XkbSA_ISOLock +action are treated as +XkbSA_LockControls +actions instead. @@ -2331,50 +2345,48 @@ XkbSA_LockControls
-The -group_XXX - field represents a signed character. Xkb provides macros to convert between a +The +group_XXX +field represents a signed character. Xkb provides macros to convert between a signed integer value and a signed character as shown in section Note. -The -mask -, -real_mods -, -vmods1 -, and -vmods2 - fields represent the components of an Xkb modifier description (see section -7.2). While the -mask - and -real_mods - fields correspond directly to the -mask - and -real_mods - fields of an Xkb modifier description, the -vmods1 - and -vmods2 - fields are combined to correspond to the -vmods - field of an Xkb modifier description. Xkb provides macros to convert between -the two formats as shown in section 16.1.3. +The +mask, +real_mods, +vmods1, +and +vmods2 +fields represent the components of an Xkb modifier description +(see section 7.2). While the +mask +and +real_mods +fields correspond directly to the +mask +and +real_mods +fields of an Xkb modifier description, the +vmods1 +and +vmods2 +fields are combined to correspond to the +vmods +field of an Xkb modifier description. Xkb provides macros to convert between +the two formats as shown in section 16.1.3. -The -affect - field is composed of a bitwise inclusive OR using the masks shown in Table -16.11. +The +affect +field is composed of a bitwise inclusive OR using the masks shown in +Table 16.11. - +
ISO Action Affect Field Values @@ -2388,63 +2400,63 @@ affect - XkbSA_ISODNoAffectMods + XkbSA_ISONoAffectMods -If -XkbSA_ISONoAffectMods - is not set, any -SA_SetMods - or -SA_LatchMods - actions occurring simultaneously with the -XkbISOAction - are treated as -SA_LockMods - instead. +If +XkbSA_ISONoAffectMods +is not set, any +SA_SetMods +or +SA_LatchMods +actions occurring simultaneously with the +XkbISOAction +are treated as +SA_LockMods +instead. - XkbSA_ISONoAffectGroup + XkbSA_ISONoAffectGroup -If -XkbSA_ISONoAffectGroup - is not set, any -SA_SetGroup - or -SA_LatchGroup - actions occurring simultaneously with the -XkbISOAction - are treated as -SA_LockGroup - instead. +If +XkbSA_ISONoAffectGroup +is not set, any +SA_SetGroup +or +SA_LatchGroup +actions occurring simultaneously with the +XkbISOAction +are treated as +SA_LockGroup +instead. - XkbSA_ISONoAffectPtr + XkbSA_ISONoAffectPtr -If -XkbSA_ISONoAffectPtr - is not set, any -SA_PtrBtn - actions occurring simultaneously with the -XkbISOAction - are treated as -SA_LockPtrBtn - instead. +If +XkbSA_ISONoAffectPtr +is not set, any +SA_PtrBtn +actions occurring simultaneously with the +XkbISOAction +are treated as +SA_LockPtrBtn +instead. - XkbSA_ISONoAffectCtrls + XkbSA_ISONoAffectCtrls -If -XkbSA_ISONoAffectCtrls - is not set, any -SA_SetControls - actions occurring simultaneously with the -XkbISOAction - are treated as -SA_LockControls - instead. +If +XkbSA_ISONoAffectCtrls +is not set, any +SA_SetControls +actions occurring simultaneously with the +XkbISOAction +are treated as +SA_LockControls +instead. @@ -2454,46 +2466,48 @@ SA_LockControls Actions for Changing the Active Screen + +XkbSwitchScreenAction -Actions associated with the -XkbSwitchScreen - action structure change the active screen on a multiscreen display: +Actions associated with the +XkbSwitchScreenAction +action structure change the active screen on a multiscreen display: This action is optional. Servers are free to ignore the action or any of its flags if they do not support the requested behavior. If the action -is ignored, it behaves like -XkbSA_NoAction -. Otherwise, key press and key release events do not generate an event. +is ignored, it behaves like +XkbSA_NoAction. +Otherwise, key press and key release events do not generate an event. typedef struct _XkbSwitchScreenAction { - unsigned char type; /* XkbSA_SwitchScreen */ - unsigned char flags; /* controls screen switching */ - char screenXXX; /* screen number or delta */ -} XkbSwitchScreenAction; + unsigned char type; /* XkbSA_SwitchScreen */ + unsigned char flags; /* controls screen switching */ + char screenXXX; /* screen number or delta */ +} XkbSwitchScreenAction; -The -type - field of the -XkbSwitchScreenAction - structure should always be -XkbSA_SwitchScreen. +The +type +field of the +XkbSwitchScreenAction +structure should always be +XkbSA_SwitchScreen. -The -flags - field is composed of the bitwise inclusive OR of the masks shown in Table -16.13. +The +flags +field is composed of the bitwise inclusive OR of the masks shown in +Table 16.13. -
+
Switch Screen Action Flags @@ -2507,16 +2521,16 @@ flags - XkbSA_SwitchAbsolute + XkbSA_SwitchAbsolute -If set, the -screenXXX - field represents the index of the new screen. Otherwise, it represents an +If set, the +screenXXX +field represents the index of the new screen. Otherwise, it represents an offset from the current screen to the new screen. - XkbSA_SwitchApplication + XkbSA_SwitchApplication If not set, the action should switch to another screen on the same server. Otherwise, it should switch to another X server or application that @@ -2528,138 +2542,135 @@ shares the same physical display.
-The -screenXXX - field is a signed character value that represents either the relative or -absolute screen index, depending on the state of the -XkbSA_SwitchAbsolute - bit in the -flags - field. Xkb provides the following macros to convert between the integer and -signed character value for screen numbers in -XkbSwitchScreenAction - structures: - - - - - - - - - -int -XkbSAScreen -( -act -) /* macro */ - - - - -XkbSwitchScreenAction -act -; /* action from which to extract screen */ - - - - - - - - -XkbSAScreen - returns the -screenXXX - field of -act - converted to a signed int. - - - - - - - - - - -void -XkbSASetScreen -( -act, s -) /* macro */ - - - - -XkbSwitchScreenAction -act -; /* action in which to set -screenXXX - */ - - - - -int -s -; /* value to set in -screenXXX - */ - - - - - +The +screenXXX +field is a signed character value that represents either the relative or +absolute screen index, depending on the state of the +XkbSA_SwitchAbsolute +bit in the +flags +field. Xkb provides the following macros to convert between the integer and +signed character value for screen numbers in +XkbSwitchScreenAction +structures: + + +XkbSAScreen + + + int XkbSAScreen + + + XkbSwitchScreenAction act + + + + + + act + + + + action from which to extract screen + + + + + + +XkbSAScreen +returns the +screenXXX +field of +act +converted to a signed int. + + + +XkbSASetScreen + + + void XkbSASetScreen + + + XkbSwitchScreenAction act + int s + + + + + + act + + + + action in which to set screenXXX + + + + + + s + + + + value to set in screenXXX + + + + - -XkbSASetScreen - sets the -screenXXX - field of -act - from -s -. +XkbSASetScreen +sets the +screenXXX +field of +act +from +s.
Actions for Changing Boolean Controls State + +XkbCtrlsAction -Actions associated with the -XkbCtrlsAction - structure change the state of the boolean controls (see section 10.1): - +Actions associated with the +XkbCtrlsAction +structure change the state of the boolean controls (see section 10.1): - + typedef struct _XkbCtrlsAction { - unsigned char type; /* XkbSA_SetControls, - XkbSA_LockControls */ - unsigned char flags; /* with type, - controls enabling and disabling of controls */ - unsigned char ctrls3; /* ctrls0 through - ctrls3 represent the boolean controls */ - unsigned char ctrls2; /* ctrls0 through - ctrls3 represent the boolean controls */ - unsigned char ctrls1; /* ctrls0 through - ctrls3 represent the boolean controls */ - unsigned char ctrls0; /* ctrls0 through - ctrls3 represent the boolean controls */ -} XkbCtrlsAction; + unsigned char type; /* XkbSA_SetControls, + XkbSA_LockControls */ + unsigned char flags; /* with type, controls enabling + and disabling of controls */ + unsigned char ctrls3; /* ctrls0 through ctrls3 + represent the boolean controls */ + unsigned char ctrls2; /* ctrls0 through ctrls3 + represent the boolean controls */ + unsigned char ctrls1; /* ctrls0 through ctrls3 + represent the boolean controls */ + unsigned char ctrls0; /* ctrls0 through ctrls3 + represent the boolean controls */ +} XkbCtrlsAction; -The -type - field can have any one of the values shown in Table 16.14. +The +type +field can have any one of the values shown in +Table 16.14. - +
Controls Action Types @@ -2673,14 +2684,14 @@ type - XkbSA_SetControls + XkbSA_SetControls -A key press enables any boolean controls specified in the -ctrls - fields that were not already enabled at the time of the key press. +A key press enables any boolean controls specified in the +ctrls +fields that were not already enabled at the time of the key press. @@ -2690,45 +2701,45 @@ A key release disables any controls enabled by the key press. -This action can cause -XkbControlsNotify - events (see section 10.1). +This action can cause +XkbControlsNotify +events (see section 10.1). - XkbSA_LockControls + XkbSA_LockControls -If the -XkbSA_LockNoLock - bit is not set in the -flags - field, a key press enables any controls specified in the -ctrls - fields that were not already enabled at the time of the key press. +If the +XkbSA_LockNoLock +bit is not set in the +flags +field, a key press enables any controls specified in the +ctrls +fields that were not already enabled at the time of the key press. -If the -XkbSA_LockNoUnlock - bit is not set in the -flags - field, a key release disables any controls specified in the -ctrls - fields that were not already disabled at the time of the key press. +If the +XkbSA_LockNoUnlock +bit is not set in the +flags +field, a key release disables any controls specified in the +ctrls +fields that were not already disabled at the time of the key press. -This action can cause -XkbControlsNotify - events (see section 10.1). +This action can cause +XkbControlsNotify +events (see section 10.1). @@ -2739,13 +2750,13 @@ XkbControlsNotify
-The -flags - field is composed of the bitwise inclusive OR of the masks shown in Table -16.15. +The +flags +field is composed of the bitwise inclusive OR of the masks shown in +Table 16.15. - +
Control Action Flags @@ -2759,19 +2770,19 @@ flags - XkbSA_LockNoLock + XkbSA_LockNoLock -If set, and the action type is -XkbSA_LockControls -, the server only disables controls. +If set, and the action type is +XkbSA_LockControls, +the server only disables controls. - XkbSA_LockNoUnlock + XkbSA_LockNoUnlock -If set, and the action type is -XkbSA_LockControls -, the server only enables controls. +If set, and the action type is +XkbSA_LockControls, +the server only enables controls. @@ -2779,161 +2790,158 @@ XkbSA_LockControls
-The -XkbSA_SetControls - action implements a key that enables a boolean control when pressed and -disables it when released. The -XkbSA_LockControls - action is used to implement a key that toggles the state of a boolean control -each time it is pressed and released. The -XkbSA_LockNoLock - and -XkbSA_LockNoUnlock - flags allow modifying the toggling behavior to only unlock or only lock the +The +XkbSA_SetControls +action implements a key that enables a boolean control when pressed and +disables it when released. The +XkbSA_LockControls +action is used to implement a key that toggles the state of a boolean control +each time it is pressed and released. The +XkbSA_LockNoLock +and +XkbSA_LockNoUnlock +flags allow modifying the toggling behavior to only unlock or only lock the boolean control. -The -ctrls0 -, -ctrls1 -, -ctrls2 -, and -ctrls3 - fields represent the boolean controls in the -enabled_ctrls - field of the controls structure (see section 10.1). Xkb provides the following +The +ctrls0, +ctrls1, +ctrls2, +and +ctrls3 +fields represent the boolean controls in the +enabled_ctrls +field of the controls structure (see section 10.1). Xkb provides the following macros, to convert between the two formats: - - - - - - - -unsigned int -XkbActionCtrls -( -act -) /* macro */ - - - - -XkbCtrlsAction -act -; /* action from which to extract controls */ - - - - - - - - -XkbActionCtrls - returns the -ctrls - fields of -act - converted to an unsigned int. - - - - - - - - - - -void -XkbSAActionSetCtrls -( -act, ctrls -) /* macro */ - - - - -XkbCtrlsAction -act -; /* action in which to set ctrls0-ctrls3 */ - - - - -unsigned int -ctrls -; /* value to set in ctrls0-ctrls3 */ - - - - - +XkbActionCtrls + + + unsigned int XkbActionCtrls + + + XkbCtrlsAction act + + + + + + act + + + + action from which to extract controls + + + + + + +XkbActionCtrls +returns the +ctrls +fields of +act +converted to an unsigned int. + + + +XkbSAActionSetCtrls + + + void XkbSAActionSetCtrls + + + XkbCtrlsAction act + unsigned int ctrls + + + + + + act + + + + action in which to set ctrls0-ctrls3 + + + + + + ctrls + + + + value to set in ctrls0-ctrls3 + + + + - -XkbSAActionSetCtrls - sets the -ctrls0 - through -ctrls3 - fields of -act - from -ctrls -. +XkbSAActionSetCtrls +sets the +ctrls0 +through +ctrls3 +fields of +act +from +ctrls.
Actions for Generating Messages + +XkbMessageAction -Actions associated with the -XkbMessageAction - structure generate -XkbActionMessage - events: - +Actions associated with the +XkbMessageAction +structure generate +XkbActionMessage +events: + + +#define XkbActionMessageLength 6 - -#define XkbActionMessageLength 6 - - typedef struct _XkbMessageAction { - unsigned char type; /* XkbSA_ActionMessage */ - unsigned char flags; /* controls event generation via key presses and releases */ - unsigned char message[XkbActionMessageLength]; /* message */ -} XkbMessageAction; + unsigned char type; /* XkbSA_ActionMessage */ + unsigned char flags; /* controls event generation via + key presses and releases */ + unsigned char message[XkbActionMessageLength]; /* message */ +} XkbMessageAction; -The -type - field of the -XkbMessageAction - structure should always be -XkbSA_ActionMessage -. +The +type +field of the +XkbMessageAction +structure should always be +XkbSA_ActionMessage. -The -flags - field is composed of the bitwise inclusive OR of the masks shown in Table -16.16. +The +flags +field is composed of the bitwise inclusive OR of the masks shown in +Table 16.16. - +
Message Action Flags @@ -2947,35 +2955,35 @@ flags - XkbSA_MessageOnPress + XkbSA_MessageOnPress -If set, key press events generate an -XkbActionMessage - event that reports the keycode, event type, and contents of the -message - field. +If set, key press events generate an +XkbActionMessage +event that reports the keycode, event type, and contents of the +message +field. - XkbSA_MessageOnRelease + XkbSA_MessageOnRelease -If set, key release events generate an -XkbActionMessage - event that reports the keycode, event type, and contents of the -message - field. +If set, key release events generate an +XkbActionMessage +event that reports the keycode, event type, and contents of the +message +field. - XkbSA_MessageGenKeyEvent + XkbSA_MessageGenKeyEvent -If set, key press and key release events generate -KeyPress - and -KeyRelease - events, regardless of whether they generate -XkbActionMessage - events. +If set, key press and key release events generate +KeyPress +and +KeyRelease +events, regardless of whether they generate +XkbActionMessage +events. @@ -2983,143 +2991,145 @@ XkbActionMessage
-The -message - field is an array of -XkbActionMessageLength - unsigned characters and may be set to anything the keymap designer wishes. +The +message +field is an array of +XkbActionMessageLength +unsigned characters and may be set to anything the keymap designer wishes. Detecting Key Action Messages + +eventsXkbActionMessage + +XkbActionMessageEvent -To receive -XkbActionMessage - events by calling either -XkbSelectEvents - or -XkbSelectEventDetails - (see section 4.3). +To receive +XkbActionMessage +events by calling either +XkbSelectEvents +or +XkbSelectEventDetails +(see section 4.3). -To receive -XkbActionMessage - events under all possible conditions, use -XkbSelectEvents - and pass -XkbActionMessageMask - in both -bits_to_change - and -values_for_bits -. +To receive +XkbActionMessage +events under all possible conditions, use +XkbSelectEvents +and pass +XkbActionMessageMask +in both +bits_to_change +and +values_for_bits. -The -XkbActionMessage - event has no event details. However, you can call -XkbSelectEventDetails - using -XkbActionMessage - as the -event_type - and specifying -XkbAllActionMessageMask - in -bits_to_change - and -values_for_bits. - This has the same effect as a call to -XkbSelectEvents. +The +XkbActionMessage +event has no event details. However, you can call +XkbSelectEventDetails +using +XkbActionMessage +as the +event_type +and specifying +XkbAllActionMessagesMask +in +bits_to_change +and +values_for_bits. +This has the same effect as a call to +XkbSelectEvents. -The structure for the -XkbActionMessage - event is defined as follows: - +The structure for the +XkbActionMessage +event is defined as follows: - + typedef struct _XkbActionMessage { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbActionMessage */ - int device; /* Xkb device ID, will not be XkbUseCoreKbd */ - KeyCode keycode; /* keycode of key triggering event */ - Bool press; /* True => key press, - False => release */ - Bool key_event_follows; /* True => KeyPress/KeyRelease follows */ - char message[XkbActionMessageLength+1]; /* message text */ -} XkbActionMessageEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbActionMessage */ + int device; /* Xkb device ID, + will not be XkbUseCoreKbd */ + KeyCode keycode; /* keycode of key triggering event */ + Bool press; /* True ⇒ key press, + False ⇒ release */ + Bool key_event_follows;/* True ⇒ KeyPress/KeyRelease follows */ + char message[XkbActionMessageLength+1]; /* message text */ +} XkbActionMessageEvent; -The -keycode - is the keycode of the key that was pressed or released. The -press - field specifies whether the event was the result of a key press or key +The +keycode +is the keycode of the key that was pressed or released. The +press +field specifies whether the event was the result of a key press or key release. -The -key_event_follows - specifies whether a -KeyPress - (if -press - is -True -) or -KeyRelease - (if -press - is -False -) event is also sent to the client. As with all other Xkb events, -XkbActionMessageEvent -s are delivered to all clients requesting them, regardless of the current -keyboard focus. However, the -KeyPress - or -KeyRelease - event that conditionally follows an -XkbActionMessageEvent - is sent only to the client selected by the current keyboard focus. -key_event_follows - is -True - only for the client that is actually sent the following -KeyPress - or -KeyRelease - event. - - - - -The -message - field is set to the message specified in the action and is guaranteed to be - -NULL --terminated; the Xkb extension forces a -NULL - into -message -[ -XkbActionMessageLength +The +key_event_follows +specifies whether a +KeyPress +(if +press +is +True) +or +KeyRelease +(if +press +is +False) +event is also sent to the client. As with all other Xkb events, +XkbActionMessageEvents +are delivered to all clients requesting them, regardless of the current +keyboard focus. However, the +KeyPress +or +KeyRelease +event that conditionally follows an +XkbActionMessageEvent +is sent only to the client selected by the current keyboard focus. +key_event_follows +is +True +only for the client that is actually sent the following +KeyPress +or +KeyRelease +event. + + + + +The +message +field is set to the message specified in the action and is guaranteed to be +NULL +-terminated; the Xkb extension forces a +NULL +into +message +[ +XkbActionMessageLength ]. @@ -3128,87 +3138,88 @@ XkbActionMessageLength
Actions for Generating a Different Keycode + +XkbRedirectKeyAction -Actions associated with the -XkbRedirectKeyAction - structure generate -KeyPress - and -KeyRelease - events containing a keycode different from the key that was pressed or +Actions associated with the +XkbRedirectKeyAction +structure generate +KeyPress +and +KeyRelease +events containing a keycode different from the key that was pressed or released: - - + typedef struct _XkbRedirectKeyAction { - unsigned char type; /* XkbSA_RedirectKey */ - unsigned char new_key; /* keycode to be put in event */ - unsigned char mods_mask; /* mask of real mods to be reset */ - unsigned char mods; /* mask of real mods to take values from */ - unsigned char vmods_mask0; /* first half of mask of virtual mods to be reset */ - unsigned char vmods_mask1; /* other half of mask of virtual mods to be reset */ - unsigned char vmods0; /* first half of mask of virtual mods to take values from */ - unsigned char vmods1; /* other half of mask of virtual mods to take values from */ -} XkbRedirectKeyAction; + unsigned char type; /* XkbSA_RedirectKey */ + unsigned char new_key; /* keycode to be put in event */ + unsigned char mods_mask; /* mask of real mods to be reset */ + unsigned char mods; /* mask of real mods to take values from */ + unsigned char vmods_mask0; /* first half of mask of virtual mods + to be reset */ + unsigned char vmods_mask1; /* other half of mask of virtual mods + to be reset */ + unsigned char vmods0; /* first half of mask of virtual mods + to take values from */ + unsigned char vmods1; /* other half of mask of virtual mods + to take values from */ +} XkbRedirectKeyAction; -The -type - field for the -XkbRedirectKeyAction - structure should always be -XkbSA_RedirectKey -. +The +type +field for the +XkbRedirectKeyAction +structure should always be +XkbSA_RedirectKey. -Key presses cause a -KeyPress - event for the key specified by the -new_key - field instead of the actual key. The state reported in this event reports the +Key presses cause a +KeyPress +event for the key specified by the +new_key +field instead of the actual key. The state reported in this event reports the current effective modifiers changed as follows: any real modifiers selected by -the -mods_mask - field are set to corresponding values from the -mods - field. Any real modifiers bound to the virtual modifiers specified by the - -vmods_mask0 - and -vmods_mask1 - fields are either set or cleared, depending on the corresponding values in the - -vmods0 - and -vmods1 - fields. If the real and virtual modifier definitions specify conflicting +the +mods_mask +field are set to corresponding values from the +mods +field. Any real modifiers bound to the virtual modifiers specified by the +vmods_mask0 +and +vmods_mask1 +fields are either set or cleared, depending on the corresponding values in the +vmods0 +and +vmods1 +fields. If the real and virtual modifier definitions specify conflicting values for a single modifier, the real modifier definition has priority. -Key releases cause a -KeyRelease - event for the key specified by the -new_key - field instead of the actual key. The state for this event consists of the +Key releases cause a +KeyRelease +event for the key specified by the +new_key +field instead of the actual key. The state for this event consists of the effective keyboard modifiers at the time of the release, changed as described previously. -The -XkbSA_RedirectKey - action normally redirects to another key on the same device as the key that +The +XkbSA_RedirectKey +action normally redirects to another key on the same device as the key that caused the event, unless that device does not belong to the input extension - -KeyClass -, in which case this action causes an event on the core keyboard device. (The +KeyClass, +in which case this action causes an event on the core keyboard device. (The input extension categorizes devices by breaking them into classes. Keyboards, and other input devices with keys, are classified as KeyClass devices by the input extension.) @@ -3216,215 +3227,219 @@ input extension.) -The -vmods_mask0 - and -vmods_mask1 - fields actually represent one -vmods_mask - value, as described in Chapter 7. Xkb provides the following macros, to +The +vmods_mask0 +and +vmods_mask1 +fields actually represent one +vmods_mask +value, as described in . Xkb provides the following macros, to convert between the two formats: - - - - - - - -unsigned int -XkbSARedirectVModsMask -( -act -) /* macro */ - - - - -XkbRedirectKeyAction -act -; /* action from which to extract vmods */ - - - - - - - - -XkbSARedirectVModsMask - returns the -vmods_mask0 - and -vmods_mask1 - fields of -act - converted to an unsigned int. - - - - - - - - - - -void -XkbSARedirectSetVModsMask -( -act, vm -) /* macro */ - - - - -XkbRedirectKeyAction -act -; /* action in which to set vmods */ - - - - -unsigned int -vm -; /* new value for virtual modifier mask */ - - - - - +XkbSARedirectVModsMask + + + unsigned int XkbSARedirectVModsMask + + + XkbRedirectKeyAction act + + + + + + act + + + + action from which to extract vmods + + + + + + +XkbSARedirectVModsMask +returns the +vmods_mask0 +and +vmods_mask1 +fields of +act +converted to an unsigned int. + + + +XkbSARedirectSetVModsMask + + + void XkbSARedirectSetVModsMask + + + XkbRedirectKeyAction act + unsigned int vm + + + + + + act + + + + action in which to set vmods + + + + + + vm + + + + new value for virtual modifier mask + + + + - -XkbSARedirectSetVModsMask - sets the -vmods_mask0 - and -vmods_mask1 - fields of -act - from -vm -. +XkbSARedirectSetVModsMask +sets the +vmods_mask0 +and +vmods_mask1 +fields of +act +from +vm. -Similarly, the -vmods0 - and -vmods1 - fields actually represent one -vmods -value, as described in Chapter 7. To convert between the two formats, Xkb +Similarly, the +vmods0 +and +vmods1 +fields actually represent one +vmods +value, as described in . To convert between the two formats, Xkb provides the following convenience macros: - - - - - - - -unsigned int -XkbSARedirectVMods -( -act -) /* macro */ - - - - -XkbRedirectKeyAction -act -; /* action from which to extract vmods */ - - - - - +XkbSARedirectVMods + + + unsigned int XkbSARedirectVMods + + + XkbRedirectKeyAction act + + + + + + act + + + + action from which to extract vmods + + + + - - XkbSARedirectVModsMask returns the vmods0 - and vmods1 fields of act + + XkbSARedirectVModsMask returns the vmods0 + and vmods1 fields of act converted to an unsigned int. - + - - - - - - - -void -XkbSARedirectSetVMods -( -act, vm -) /* macro */ - - - - -XkbRedirectKeyAction -act -; /* action in which to set vmods */ - - - - -unsigned int -v -; /* new value for virtual modifiers */ - - - - - - - XkbSARedirectSetVModsMask sets the vmods0 - and vmods1 of act from v. - +XkbSARedirectSetVMods + + + void XkbSARedirectSetVMods + + + XkbRedirectKeyAction act + unsigned int v + + + + + + act + + + + action in which to set vmods + + + + + + v + + + + new value for virtual modifiers + + + + + + XkbSARedirectSetVModsMask sets the vmods0 + and vmods1 of act from v. + Actions for Generating DeviceButtonPress and DeviceButtonRelease - - -Actions associated with -XkbDeviceBtnAction - structures generate -DeviceButtonPress - and -DeviceButtonRelease - events instead of normal -KeyPress - and -KeyRelease - events: - - - + +XkbDeviceBtnAction + + +Actions associated with +XkbDeviceBtnAction +structures generate +DeviceButtonPress +and +DeviceButtonRelease +events instead of normal +KeyPress +and +KeyRelease +events: + + typedef struct _XkbDeviceBtnAction { - unsigned char type; /* XkbSA_DeviceBtn, XkbSA_LockDeviceBtn */ - unsigned char flags; /* with type , specifies locking or unlocking */ - unsigned char count; /* controls number of DeviceButtonPress and Release events */ - unsigned char button; /* index of button on device */ - unsigned char device; /* device ID of an X input extension device */ -} XkbDeviceBtnAction; + unsigned char type; /* XkbSA_DeviceBtn, XkbSA_LockDeviceBtn */ + unsigned char flags; /* with type, specifies locking or unlocking */ + unsigned char count; /* controls number of DeviceButtonPress + and Release events */ + unsigned char button; /* index of button on device */ + unsigned char device; /* device ID of an X input extension device */ +} XkbDeviceBtnAction; -The -type - field can have any one of the values shown in Table 16.17. +The +type +field can have any one of the values shown in +Table 16.17. - +
Device Button Action Types @@ -3438,90 +3453,89 @@ type - XkbSA_DeviceBtn + XkbSA_DeviceBtn If the button specified by this action is logically down, the key press and corresponding release are ignored and have no effect. If the device or button -specified by this action are illegal, this action behaves like -XkbSA_NoAction. +specified by this action are illegal, this action behaves like +XkbSA_NoAction. Otherwise, key presses cause one or more input extension device events instead -of the usual key press event. If the -count - field is zero, a key press generates a single -DeviceButtonPress - event. If count is greater than zero, a key press event generates -count - pairs of -DeviceButtonPress - and -DeviceButtonRelease - events. +of the usual key press event. If the +count +field is zero, a key press generates a single +DeviceButtonPress +event. If count is greater than zero, a key press event generates +count +pairs of +DeviceButtonPress +and +DeviceButtonRelease +events. -If -count - is zero, a key release generates an input extension -DeviceButtonRelease - event that matches the event generated by the corresponding key press. If - -count - is nonzero, a key release does not cause a -DeviceButtonRelease - event. Key releases never cause -KeyRelease - events. +If +count +is zero, a key release generates an input extension +DeviceButtonRelease +event that matches the event generated by the corresponding key press. If +count +is nonzero, a key release does not cause a +DeviceButtonRelease +event. Key releases never cause +KeyRelease +events. - XkbSA_LockDeviceBtn + XkbSA_LockDeviceBtn If the device or button specified by this action are illegal, this action -behaves like XkbSA_NoAction. +behaves like XkbSA_NoAction. -Otherwise, if the specified button is not locked and the -XkbSA_LockNoLock - bit is not set in the -flags - field, a key press generates an input extension -DeviceButtonPress - event instead of a -KeyPress - event and locks the button. If the button is already locked or if -XkbSA_LockNoLock - bit is set in the -flags - field, the key press is ignored and has no effect. +Otherwise, if the specified button is not locked and the +XkbSA_LockNoLock +bit is not set in the +flags +field, a key press generates an input extension +DeviceButtonPress +event instead of a +KeyPress +event and locks the button. If the button is already locked or if +XkbSA_LockNoLock +bit is set in the +flags +field, the key press is ignored and has no effect. -If the corresponding key press was ignored, and if the -XkbSA_LockNoUnlock - bit is not set in the -flags - field, a key release generates an input extension -DeviceButtonRelease - event instead of a -KeyRelease - event and unlocks the button. If the corresponding key press locked a button, +If the corresponding key press was ignored, and if the +XkbSA_LockNoUnlock +bit is not set in the +flags +field, a key release generates an input extension +DeviceButtonRelease +event instead of a +KeyRelease +event and unlocks the button. If the corresponding key press locked a button, the key release is ignored and has no effect. @@ -3533,13 +3547,13 @@ the key release is ignored and has no effect.
-The -flags - field is composed of the bitwise inclusive OR of the masks shown in Table -16.18. +The +flags +field is composed of the bitwise inclusive OR of the masks shown in +Table 16.18. - +
Device Button Action Flags @@ -3553,19 +3567,19 @@ flags - XkbSA_LockNoLock + XkbSA_LockNoLock -If set, and the action type is -XkbSA_LockDeviceBtn -, the server only unlocks the button. +If set, and the action type is +XkbSA_LockDeviceBtn, +the server only unlocks the button. - XkbSA_LockNoUnlock + XkbSA_LockNoUnlock -If set, and the action type is -XkbSA_LockDeviceBtn -, the server only locks the button. +If set, and the action type is +XkbSA_LockDeviceBtn, +the server only locks the button. @@ -3575,64 +3589,71 @@ XkbSA_LockDeviceBtn Actions for Simulating Events from Device Valuators - - -A -valuator - manipulates a range of values for some entity, like a mouse axis, a slider or -a dial. Actions associated with -XkbDeviceValuatorAction - structures are used to simulate events from one or two input extension device + +XkbDeviceValuatorAction + + +A +valuator + +valuator +manipulates a range of values for some entity, like a mouse axis, a slider or +a dial. Actions associated with +XkbDeviceValuatorAction +structures are used to simulate events from one or two input extension device valuators. typedef struct _XkbDeviceValuatorAction { - unsigned char type; /* XkbSA_DeviceValuator */ - unsigned char device; /* device ID */ - unsigned char v1_what; /* determines how valuator is to behave for valuator 1 */ - unsigned char v1_ndx; /* specifies a real valuator */ - unsigned char v1_value; /* the value for valuator 1 */ - unsigned char v2_what; /* determines how valuator is to behave for valuator 2 */ - unsigned char v2_ndx; /* specifies a real valuator */ - unsigned char v2_value; /* the value for valuator 1 */ -} XkbDeviceValuatorAction; + unsigned char type; /* XkbSA_DeviceValuator */ + unsigned char device; /* device ID */ + unsigned char v1_what; /* determines how valuator is + to behave for valuator 1 */ + unsigned char v1_ndx; /* specifies a real valuator */ + unsigned char v1_value; /* the value for valuator 1 */ + unsigned char v2_what; /* determines how valuator is + to behave for valuator 2 */ + unsigned char v2_ndx; /* specifies a real valuator */ + unsigned char v2_value; /* the value for valuator 1 */ +} XkbDeviceValuatorAction; -If -device - is illegal or if neither -v1_ndx - nor -v2_ndx - specifies a legal valuator, this action behaves like -XkbSA_NoAction. - - - - -The low four bits of -v1_what - and -v2_what - specify the corresponding scale value (denoted -val<n>Scale - in Table 16.17), if needed. The high four bits of -v1_what - and -v2_what - specify the operation to perform to set the values. The high four bits of - -v1_what - and -v2_what - can have the values shown in Table 16.17; the use of -val<n>Scale - is shown in that table also. - - -
+If +device +is illegal or if neither +v1_ndx +nor +v2_ndx +specifies a legal valuator, this action behaves like +XkbSA_NoAction. + + + + +The low four bits of +v1_what +and +v2_what +specify the corresponding scale value (denoted +val<n>Scale +in Table 16.17), if needed. +The high four bits of +v1_what +and +v2_what +specify the operation to perform to set the values. The high four bits of +v1_what +and +v2_what +can have the values shown in Table 16.17; +the use of +val<n>Scale +is shown in that table also. + + +
Device Valuator v<n>_what High Bits Values @@ -3646,40 +3667,40 @@ val<n>Scale - XkbSA_IgnoreVal + XkbSA_IgnoreVal No action - XkbSA_SetValMin + XkbSA_SetValMin -v<n>_value is set to its minimum legal value. +v<n>_value is set to its minimum legal value. - XkbSA_SetValCenter + XkbSA_SetValCenter -v<n>_valueis centered (to (max-min)/2). +v<n>_valueis centered (to (max-min)/2). - XkbSA_SetValMax + XkbSA_SetValMax -v<n>_value is set to its maximum legal value. +v<n>_value is set to its maximum legal value. - XkbSA_SetValRelative + XkbSA_SetValRelative -v<n>_value * (2 -val<n>Scale) is added to -v<n>_value. +v<n>_value * (2 +val<n>Scale) is added to +v<n>_value. - XkbSA_SetValAbsolute + XkbSA_SetValAbsolute -v<n>_value - is set to (2 val<n>Scale). +v<n>_value +is set to (2 val<n>Scale). @@ -3687,39 +3708,37 @@ val<n>Scale
-Illegal values for -XkbSA_SetValRelative - or -XkbSA_SetValAbsolute - are clamped into range. Note that all of these possibilities are legal for -absolute valuators. For relative valuators, only -XkbSA_SetValRelative - is permitted. Part of the input extension description of a device is the range +Illegal values for +XkbSA_SetValRelative +or +XkbSA_SetValAbsolute +are clamped into range. Note that all of these possibilities are legal for +absolute valuators. For relative valuators, only +XkbSA_SetValRelative +is permitted. Part of the input extension description of a device is the range of legal values for all absolute valuators, whence the maximum and minimum -legal values shown in Table 16.17. +legal values shown in Table 16.17. The following two masks are provided as a convenience to select either portion -of -v1_what - or -v2_what -: - +of +v1_what +or +v2_what: - - #define XkbSA_ValOpMask (0x70) - #define XkbSA_ValScaleMask (0x07) - + +#define XkbSA_ValOpMask (0x70) +#define XkbSA_ValScaleMask (0x07) + +
- -v1_ndx - and -v2_ndx - specify valuators that actually exists. For example, most mice have two +v1_ndx +and +v2_ndx +specify valuators that actually exists. For example, most mice have two valuators (x and y axes) so the only legal values for a mouse would be 0 and 1. For a dial box with eight dials, any value in the range 0..7 would be correct. @@ -3730,118 +3749,120 @@ For a dial box with eight dials, any value in the range 0..7 would be correct. Obtaining Key Actions for Keys from the Server -To update the actions (the -key_acts - array) for a subset of the keys in a keyboard description, use -XkbGetKeyActions -. - - - - - - - - - -Status -XkbGetKeyActions -( -dpy -, - first -, -num -, - xkb -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int -first -; /* keycode of first key of interest */ - - - - -unsigned int -num -; /* number of keys desired */ - - - - -XkbDescPtr -xkb -; /* pointer to keyboard description where result is stored */ - - - - - +To update the actions (the +key_acts +array) for a subset of the keys in a keyboard description, use +XkbGetKeyActions. + + +XkbGetKeyActions + + + Status XkbGetKeyActions + + + Display *dpy + unsigned int first + unsigned int num + XkbDescPtr xkb + + + + + + dpy + + + + connection to X server + + + + + + first + + + + keycode of first key of interest + + + + + + num + + + + number of keys desired + + + + + + xkb + + + + pointer to keyboard description where result is stored + + + + - -XkbGetKeyActions - sends a request to the server to obtain the actions for -num - keys on the keyboard starting with key -first -. It waits for a reply and returns the actions in the -server --> -key_acts - field of -xkb -. If successful, -XkbGetKeyActions - returns -Success -. The -xkb - parameter must be a pointer to a valid Xkb keyboard description. +XkbGetKeyActions +sends a request to the server to obtain the actions for +num +keys on the keyboard starting with key +first. +It waits for a reply and returns the actions in the +server->key_acts +field of +xkb. +If successful, +XkbGetKeyActions +returns +Success. +The +xkb +parameter must be a pointer to a valid Xkb keyboard description. -If the -server - map in the -xkb - parameter has not been allocated, -XkbGetKeyActions - allocates and initializes it before obtaining the actions. +If the +server +map in the +xkb +parameter has not been allocated, +XkbGetKeyActions +allocates and initializes it before obtaining the actions. If the server does not have a compatible version of Xkb, or the Xkb extension -has not been properly initialized, -XkbGetKeyActions - returns -BadAccess -. If -num - is less than 1 or greater than -XkbMaxKeyCount -, -XkbGetKeyActions - returns -BadValue -. If any allocation errors occur, -XkbGetKeyActions - returns -BadAlloc -. +has not been properly initialized, +XkbGetKeyActions +returns +BadAccess. +If +num +is less than 1 or greater than +XkbMaxKeyCount, +XkbGetKeyActions +returns +BadValue. +If any allocation errors occur, +XkbGetKeyActions +returns +BadAlloc. @@ -3850,128 +3871,126 @@ BadAlloc Changing the Number of Actions Bound to a Key -To change the number of actions bound to a key, use -XkbResizeKeyAction -. - - - - - - - - - -XkbAction * -XkbResizeKeyActions -( -xkb -, - key -, - needed -) - - - - -XkbDescRec * - xkb -; /* keyboard description to change */ - - - - -int - key -; /* keycode of key to change */ - - - - -int - needed -; /* new number of actions required */ - - - - - - - -The -xkb - parameter points to the keyboard description containing the -key - whose number of actions is to be changed. The -key - parameter is the keycode of the key to change, and -needed - specifies the new number of actions required for the key. - - - - - -XkbResizeKeyActions - reserves the space needed for the actions and returns a pointer to the -beginning of the new array that holds the actions. It can change the -acts -, -num_acts -, and -size_acts - fields of -xkb --> -server - if it is necessary to reallocate the -acts +To change the number of actions bound to a key, use +XkbResizeKeyActions. + + +XkbResizeKeyActions + + + XkbAction *XkbResizeKeyActions + + + XkbDescRec *xkb + int key + int needed + + + + + + xkb + + + + keyboard description to change + + + + + + key + + + + keycode of key to change + + + + + + needed + + + + new number of actions required + + + + + + +The +xkb +parameter points to the keyboard description containing the +key +whose number of actions is to be changed. The +key +parameter is the keycode of the key to change, and +needed +specifies the new number of actions required for the key. + + + + +XkbResizeKeyActions +reserves the space needed for the actions and returns a pointer to the +beginning of the new array that holds the actions. It can change the +acts, +num_acts, +and +size_acts +fields of +xkb->server +if it is necessary to reallocate the +acts array. -If -needed - is greater than the current number of keysyms for the key, -XkbResizeKeyActions - initializes all new actions in the array to -NoAction -. +If +needed +is greater than the current number of keysyms for the key, +XkbResizeKeyActions +initializes all new actions in the array to +NoAction. Because the number of actions needed by a key is normally computed as width * -number of groups, and -XkbResizeKeyActions - does not modify either the width or number of groups for the key, a -discrepancy exists on return from -XkbResizeKeyActions - between the space allocated for the actions and the number required. The -unused entries in the list of actions returned by -XkbResizeKeyActions - are not preserved across future calls to any of the map editing functions, so +number of groups, and +XkbResizeKeyActions +does not modify either the width or number of groups for the key, a +discrepancy exists on return from +XkbResizeKeyActions +between the space allocated for the actions and the number required. The +unused entries in the list of actions returned by +XkbResizeKeyActions +are not preserved across future calls to any of the map editing functions, so you must update the key actions (which updates the width and number of groups -for the key) before calling another allocator function. A call to -XkbChangeTypesOfKey - updates these. +for the key) before calling another allocator function. A call to +XkbChangeTypesOfKey +updates these. If any allocation errors occur while resizing the number of actions bound to -the key, -XkbResizeKeyActions - returns -NULL -. +the key, +XkbResizeKeyActions +returns +NULL. A change to the number of actions bound to a key should be accompanied by a change in the number of symbols bound to a key. Refer to -section 15.3.7 for more information on changing the number of symbols bound to +section 15.3.7 for more information on changing the number of symbols bound to a key. @@ -3982,9 +4001,9 @@ a key. Key behavior refers to the demeanor of a key. For example, the expected -behavior of the -CapsLock - key is that it logically locks when pressed, and then logically unlocks when +behavior of the +CapsLock +key is that it logically locks when pressed, and then logically unlocks when pressed again. @@ -3993,80 +4012,79 @@ pressed again. Radio Groups -Keys that belong to the same radio group have the -XkbKB_RadioGroup - type in the -type - field and the radio group index specified in the -data - field in the -XkbBehavior - structure. If the radio group has a name in the -XkbNamesRec - structure, the radio group index is the index into the -radio_group - array in the -XkbNamesRec - structure. A radio group key when pressed stays logically down until another +Keys that belong to the same radio group have the +XkbKB_RadioGroup +type in the +type +field and the radio group index specified in the +data +field in the +XkbBehavior +structure. If the radio group has a name in the +XkbNamesRec +structure, the radio group index is the index into the +radio_group +array in the +XkbNamesRec +structure. A radio group key when pressed stays logically down until another key in the radio group is pressed, when the first key becomes logically up and -the new key becomes logically down. Setting the -XkbKB_RGAllowNone - bit in the behavior for all of the keys of the radio group means that pressing +the new key becomes logically down. Setting the +XkbKB_RGAllowNone +bit in the behavior for all of the keys of the radio group means that pressing the logically down member of the radio group causes it to logically release, in which case none of the keys of the radio group would be logically down. If - -XkbKB_RGAllowNone - is not set, there is no way to release the logically down member of the group. +XkbKB_RGAllowNone +is not set, there is no way to release the logically down member of the group. -The low five bits of the -data - field of the -XkbBehavior - structure are the group number, the high three bits are flags. The only flag +The low five bits of the +data +field of the +XkbBehavior +structure are the group number, the high three bits are flags. The only flag currently defined is: - - -#define XkbRG_AllowNone 0x80 + +#define XkbKB_RGAllowNone 0x80
The XkbBehavior Structure + +XkbBehavior -The -behaviors - field of the server map is an array of -XkbBehavior - structures, indexed by keycode, and contains the behavior for each key. The - -XkbBehavior - structure is defined as follows: - +The +behaviors +field of the server map is an array of +XkbBehavior +structures, indexed by keycode, and contains the behavior for each key. The +XkbBehavior +structure is defined as follows: - + typedef struct _XkbBehavior { - unsigned char type; /* behavior type + optional - XkbKB_Permanent bit */ - unsigned char data; -} XkbBehavior; + unsigned char type; /* behavior type + optional + XkbKB_Permanent bit */ + unsigned char data; +} XkbBehavior; -The -type - field specifies the Xkb behavior, and the value of the -data - field depends on the -type -. Xkb supports the key behaviors shown in Table 16.20. +The +type +field specifies the Xkb behavior, and the value of the +data +field depends on the +type. +Xkb supports the key behaviors shown in +Table 16.20. - +
Key Behaviors @@ -4080,43 +4098,43 @@ type - XkbKB_Default + XkbKB_Default -Press and release events are processed normally. The -data - field is unused. +Press and release events are processed normally. The +data +field is unused. - XkbKB_Lock + XkbKB_Lock If a key is logically up (that is, the corresponding bit of the core key map is cleared) when it is pressed, the key press is processed normally and the corresponding release is ignored. If the key is logically down when pressed, the key press is ignored but the corresponding release is processed normally. -The -data - field is unused. +The +data +field is unused. - XkbKB_RadioGroup + XkbKB_RadioGroup If another member of the radio group is logically down (all members of the -radio group have the same index, specified in -data -) when a key is pressed, the server synthesizes a key release for the member +radio group have the same index, specified in +data) +when a key is pressed, the server synthesizes a key release for the member that is logically down and then processes the new key press event normally. If the key itself is logically down when pressed, the key press event is ignored, but the processing of the corresponding key release depends on the -value of the -Xkb_RGAllowNone - bit in -flags -. If it is set, the key release is processed normally; otherwise, the key +value of the +XkbKB_RGAllowNone +bit in +flags. +If it is set, the key release is processed normally; otherwise, the key release is also ignored. @@ -4125,29 +4143,29 @@ All other key release events are ignored. - XkbKB_Overlay1 + XkbKB_Overlay1 -If the -Overlay1 - control is enabled (see section 10.4), -data - is interpreted as a keycode, and events from this key are reported as if they -came from -data -’s keycode. Otherwise, press and release events are processed normally. +If the +Overlay1 +control is enabled (see section 10.4), +data +is interpreted as a keycode, and events from this key are reported as if they +came from +data’s +keycode. Otherwise, press and release events are processed normally. - XkbKB_Overlay2 + XkbKB_Overlay2 -If the -Overlay2 - control is enabled (see section 10.4), -data - is interpreted as a keycode, and events from this key are reported as if they -came from -data -’s keycode. Otherwise, press and release events are processed normally. +If the +Overlay2 +control is enabled (see section 10.4), +data +is interpreted as a keycode, and events from this key are reported as if they +came from +data’s +keycode. Otherwise, press and release events are processed normally. @@ -4155,15 +4173,15 @@ data
-Xkb also provides the mask, -XkbKB_Permanent - to specify whether the key behavior type should be simulated by Xkb or whether +Xkb also provides the mask, +XkbKB_Permanent +to specify whether the key behavior type should be simulated by Xkb or whether the key behavior describes an unalterable physical, electrical, or software -aspect of the keyboard. If the -XkbKB_Permanent - bit is not set in the -type - field, Xkb simulates the behavior in software. Otherwise, Xkb relies upon the +aspect of the keyboard. If the +XkbKB_Permanent +bit is not set in the +type +field, Xkb simulates the behavior in software. Otherwise, Xkb relies upon the keyboard to implement the behavior. @@ -4173,117 +4191,118 @@ keyboard to implement the behavior. Obtaining Key Behaviors for Keys from the Server -To obtain the behaviors (the -behaviors - array) for a subset of the keys in a keyboard description from the server, use - -XkbGetKeyBehaviors -: - - - - - - - - - -Status -XkbGetKeyBehaviors -( -dpy -, - first -, - num -, - xkb -) - - - - -Display * - dpy -; /* connection to server */ - - - - -unsigned int -first -; /* keycode of first key to get */ - - - - -unsigned int -num -; /* number of keys for which behaviors are desired */ - - - - -XkbDescPtr -xkb -; /* Xkb description to contain the result */ - - - - - +To obtain the behaviors (the +behaviors +array) for a subset of the keys in a keyboard description from the server, use +XkbGetKeyBehaviors: + + + +XkbGetKeyBehaviors + + + Status XkbGetKeyBehaviors + + + Display *dpy + unsigned int first + unsigned int num + XkbDescPtr xkb + + + + + + dpy + + + + connection to server + + + + + + first + + + + keycode of first key to get + + + + + + num + + + + number of keys for which behaviors are desired + + + + + + xkb + + + + Xkb description to contain the result + + + + - -XkbGetKeyBehaviors - sends a request to the server to obtain the behaviors for -num - keys on the keyboard starting with the key whose keycode is -first -. It waits for a reply and returns the behaviors in the -server --> -behaviors - field of -xkb -. If successful, -XkbGetKeyBehaviors - returns -Success -. +XkbGetKeyBehaviors +sends a request to the server to obtain the behaviors for +num +keys on the keyboard starting with the key whose keycode is +first. +It waits for a reply and returns the behaviors in the +server->behaviors +field of +xkb. +If successful, +XkbGetKeyBehaviors +returns +Success. -If the -server - map in the -xkb - parameter has not been allocated, -XkbGetKeyBehaviors - allocates and initializes it before obtaining the actions. +If the +server +map in the +xkb +parameter has not been allocated, +XkbGetKeyBehaviors +allocates and initializes it before obtaining the actions. If the server does not have a compatible version of Xkb, or the Xkb extension -has not been properly initialized, -XkbGetKeyBehaviors - returns -BadAccess -. If -num - is less than 1 or greater than -XkbMaxKeyCount -, -XkbGetKeyBehaviors - returns -BadValue -. If any allocation errors occur, -XkbGetKeyBehaviors - returns -BadAlloc -. +has not been properly initialized, +XkbGetKeyBehaviors +returns +BadAccess. +If +num +is less than 1 or greater than +XkbMaxKeyCount, +XkbGetKeyBehaviors +returns +BadValue. +If any allocation errors occur, +XkbGetKeyBehaviors +returns +BadAlloc. @@ -4295,7 +4314,7 @@ BadAlloc Whenever a client remaps the keyboard using core protocol requests, Xkb examines the map to determine likely default values for the components that -cannot be specified using the core protocol (see section 17.1.2 for more +cannot be specified using the core protocol (see section 17.1.2 for more information on how Xkb chooses the default values). @@ -4310,14 +4329,14 @@ mapping. -The explicit components masks are held in the -explicit - field of the server map, which is an array indexed by keycode. Each entry in +The explicit components masks are held in the +explicit +field of the server map, which is an array indexed by keycode. Each entry in this array is a mask that is a bitwise inclusive OR of the values shown in -Table 16.21. +Table 16.21. - +
Explicit Component Masks @@ -4336,32 +4355,32 @@ Table 16.21. ExplicitKeyType1 (1<<0) -Automatic determination of the key type associated with -Group1. +Automatic determination of the key type associated with +Group1. ExplicitKeyType2 (1<<1) -Automatic determination of the key type associated with -Group2. +Automatic determination of the key type associated with +Group2. ExplicitKeyType3 (1<<2) -Automatic determination of the key type associated with -Group3. +Automatic determination of the key type associated with +Group3. ExplicitKeyType4 (1<<3) -Automatic determination of the key type associated with -Group4. +Automatic determination of the key type associated with +Group4. @@ -4382,11 +4401,11 @@ specified in a symbol interpretation. ExplicitBehavior (1<<6) -Automatic assignment of the -XkbKB_Lock - behavior to the key, if the -XkbSI_LockingKey - flag is set in a symbol interpretation. +Automatic assignment of the +XkbKB_Lock +behavior to the key, if the +XkbSI_LockingKey +flag is set in a symbol interpretation. @@ -4406,117 +4425,120 @@ match the key. Obtaining Explicit Components for Keys from the Server -To obtain the explicit components (the -explicit - array) for a subset of the keys in a keyboard description, use -XkbGetKeyExplicitComponents. - - - - - - - - - -Status -XkbGetKeyExplicitComponents -( -dpy -, - first -, - num -, - xkb -) - - - - -Display * - dpy -; /* connection to server */ - - - - -unsigned int -first -; /* keycode of first key to fetch */ - - - - -unsigned int -num -; /* number of keys for which to get explicit info */ - - - - -XkbDescPtr -xkb -; /* Xkb description in which to put results */ - - - - - +To obtain the explicit components (the +explicit +array) for a subset of the keys in a keyboard description, use +XkbGetKeyExplicitComponents. + + +XkbGetKeyExplicitComponents + + + Status XkbGetKeyExplicitComponents + + + Display *dpy + unsigned int first + unsigned int num + XkbDescPtr xkb + + + + + + dpy + + + + connection to server + + + + + + first + + + + keycode of first key to fetch + + + + + + num + + + + number of keys for which to get explicit info + + + + + + xkb + + + + Xkb description in which to put results + + + + - -XkbGetKeyExplicitComponents - sends a request to the server to obtain the explicit components for -num - keys on the keyboard starting with key -first -. It waits for a reply and returns the explicit components in the -server --> -explicit - array of -xkb -. If successful, -XkbGetKeyExplicitComponents - returns -Success -. The -xkb - parameter must be a pointer to a valid Xkb keyboard description. +XkbGetKeyExplicitComponents +sends a request to the server to obtain the explicit components for +num +keys on the keyboard starting with key +first. +It waits for a reply and returns the explicit components in the +server->explicit +array of +xkb. +If successful, +XkbGetKeyExplicitComponents +returns +Success. +The +xkb +parameter must be a pointer to a valid Xkb keyboard description. -If the -server - map in the -xkb - parameter has not been allocated, -XkbGetKeyExplicitComponents - allocates and initializes it before obtaining the actions. +If the +server +map in the +xkb +parameter has not been allocated, +XkbGetKeyExplicitComponents +allocates and initializes it before obtaining the actions. If the server does not have a compatible version of Xkb, or the Xkb extension -has not been properly initialized, -XkbGetKeyExplicitComponents - returns -BadMatch -. If -num - is less than 1 or greater than -XkbMaxKeyCount -, -XkbGetKeyExplicitComponents - returns -BadValue -. If any allocation errors occur, -XkbGetKeyExplicitComponents - returns -BadAlloc -. +has not been properly initialized, +XkbGetKeyExplicitComponents +returns +BadMatch. +If +num +is less than 1 or greater than +XkbMaxKeyCount, +XkbGetKeyExplicitComponents +returns +BadValue. +If any allocation errors occur, +XkbGetKeyExplicitComponents +returns +BadAlloc. @@ -4526,71 +4548,71 @@ BadAllocVirtual Modifier Mapping -The -vmods - member of the server map is a fixed-length array containing -XkbNumVirtualMods - entries. Each entry corresponds to a virtual modifier and provides the binding -of the virtual modifier to the real modifier bits. Each entry in the -vmods - array is a bitwise inclusive OR of the legal modifier masks: - - - - ShiftMask - LockMask - ControlMask - Mod1Mask - Mod2Mask - Mod3Mask - Mod4Mask - Mod5Mask - - - -The -vmodmap - member of the server map is similar to the -modmap - array of the client map (see section 15.4), but is used to define the virtual -modifier mapping for each key. Like the -modmap - member, it is indexed by keycode, and each entry is a mask representing the +The +vmods +member of the server map is a fixed-length array containing +XkbNumVirtualMods +entries. Each entry corresponds to a virtual modifier and provides the binding +of the virtual modifier to the real modifier bits. Each entry in the +vmods +array is a bitwise inclusive OR of the legal modifier masks: + + + + ShiftMask + LockMask + ControlMask + Mod1Mask + Mod2Mask + Mod3Mask + Mod4Mask + Mod5Mask + + + +The +vmodmap +member of the server map is similar to the +modmap +array of the client map (see section 15.4), but is used to define the virtual +modifier mapping for each key. Like the +modmap +member, it is indexed by keycode, and each entry is a mask representing the virtual modifiers bound to the corresponding key: -Each of the bits in a -vmodmap - entry represents an index into the -vmods - member. That is, bit 0 of a -vmodmap - entry refers to index 0 of the -vmods - array, bit 1 refers to index 1, and so on. +Each of the bits in a +vmodmap +entry represents an index into the +vmods +member. That is, bit 0 of a +vmodmap +entry refers to index 0 of the +vmods +array, bit 1 refers to index 1, and so on. -If a bit is set in the -vmodmap - entry for a key, that key is bound to the corresponding virtual modifier in -the -vmods - array. +If a bit is set in the +vmodmap +entry for a key, that key is bound to the corresponding virtual modifier in +the +vmods +array. -The -vmodmap - and -vmods - members of the server map are the "master" virtual modifier definitions. Xkb +The +vmodmap +and +vmods +members of the server map are the master virtual modifier definitions. Xkb automatically propagates any changes to these fields to all other fields that use virtual modifier mappings. @@ -4598,14 +4620,16 @@ use virtual modifier mappings. The overall relationship of fields dealing with virtual modifiers in an Xkb -keyboard description are shown in Figure 16.2. +keyboard description are shown in Figure 16.2. - - - - - +
+ Virtual Modifier Relationships + + + + +
@@ -4618,104 +4642,106 @@ Virtual Modifier RelationshipsObtaining Virtual Modifier Bindings from the Server -To obtain a subset of the virtual modifier bindings (the -vmods - array) in a keyboard description, use -XkbGetVirtualMods -: - - - - - - - - - -Status -XkbGetVirtualMods -( -dpy -, - which -, - xkb -) - - - - -Display * - dpy -; /* connection to server */ - - - - -unsigned int -which -; /* mask indicating virtual modifier bindings to get */ - - - - -XkbDescPtr -xkb -; /* Xkb description where results will be placed */ - - - - - +To obtain a subset of the virtual modifier bindings (the +vmods +array) in a keyboard description, use +XkbGetVirtualMods: + + + +XkbGetVirtualMods + + + Status XkbGetVirtualMods + + + Display *dpy + unsigned int which + XkbDescPtr xkb + + + + + + dpy + + + + connection to server + + + + + + which + + + + mask indicating virtual modifier bindings to get + + + + + + xkb + + + + Xkb description where results will be placed + + + + - -XkbGetVirtualMods - sends a request to the server to obtain the -vmods - entries for the virtual modifiers specified in the mask, -which -, and waits for a reply. See section 7.1 for a description of how to determine -the virtual modifier mask. For each bit set in -which -, -XkbGetVirtualMods - updates the corresponding virtual modifier definition in the -server->vmods - array of -xkb -. The -xkb - parameter must be a pointer to a valid Xkb keyboard description. If -successful, -XkbGetVirtualMods - returns -Success -. +XkbGetVirtualMods +sends a request to the server to obtain the +vmods +entries for the virtual modifiers specified in the mask, +which, +and waits for a reply. See section 7.1 for a description of how to determine +the virtual modifier mask. For each bit set in +which, +XkbGetVirtualMods +updates the corresponding virtual modifier definition in the +server->vmods +array of +xkb. +The +xkb +parameter must be a pointer to a valid Xkb keyboard description. If +successful, +XkbGetVirtualMods +returns +Success. -If the -server - map has not been allocated in the -xkb - parameter, -XkbGetVirtualMods - allocates and initializes it before obtaining the virtual modifier bindings. +If the +server +map has not been allocated in the +xkb +parameter, +XkbGetVirtualMods +allocates and initializes it before obtaining the virtual modifier bindings. If the server does not have a compatible version of Xkb, or the Xkb extension -has not been properly initialized, -XkbGetVirtualMods - returns -BadMatch -. Any errors in allocation cause -XkbGetVirtualMods -to return -BadAlloc. +has not been properly initialized, +XkbGetVirtualMods +returns +BadMatch. +Any errors in allocation cause +XkbGetVirtualMods +to return +BadAlloc. @@ -4724,120 +4750,121 @@ BadAlloc. Obtaining Per-Key Virtual Modifier Mappings from the Server -To obtain the virtual modifier map (the -vmodmap - array) for a subset of the keys in a keyboard description, use -XkbGetKeyVirtualModMap -: - - - - - - - - - -Status -XkbGetKeyVirtualModMap -( -dpy -, - first -, - num -, - xkb -) - - - - -Display * - dpy -; /* connection to server */ - - - - -unsigned int -first -; /* keycode of first key to fetch */ - - - - -unsigned int -num -; /* # keys for which virtual mod maps are desired */ - - - - -XkbDescPtr -xkb -; /* Xkb description where results will be placed */ - - - - - +To obtain the virtual modifier map (the +vmodmap +array) for a subset of the keys in a keyboard description, use +XkbGetKeyVirtualModMap: + + + +XkbGetKeyVirtualModMap + + + Status XkbGetKeyVirtualModMap + + + Display *dpy + unsigned int first + unsigned int num + XkbDescPtr xkb + + + + + + dpy + + + + connection to server + + + + + + first + + + + keycode of first key to fetch + + + + + + num + + + + # keys for which virtual mod maps are desired + + + + + + xkb + + + + Xkb description where results will be placed + + + + - -XkbGetKeyVirutalModmap +XkbGetKeyVirtualModmap sends a request to the server to obtain the virtual modifier mappings for - -num - keys on the keyboard starting with key -first -. It waits for a reply and returns the virtual modifier mappings in the - -server --> -vmodmap - array of -xkb -. If successful, -XkbGetKeyVirtualModMap - returns -Success -. The -xkb - parameter must be a pointer to a valid Xkb keyboard description +num +keys on the keyboard starting with key +first. +It waits for a reply and returns the virtual modifier mappings in the +server->vmodmap +array of +xkb. +If successful, +XkbGetKeyVirtualModMap +returns +Success. +The +xkb +parameter must be a pointer to a valid Xkb keyboard description -If the -server - map in the -xkb - parameter has not been allocated, -XkbGetKeyVirtualModMap - allocates and initializes it before obtaining the virtual modifier mappings. +If the +server +map in the +xkb +parameter has not been allocated, +XkbGetKeyVirtualModMap +allocates and initializes it before obtaining the virtual modifier mappings. If the server does not have a compatible version of Xkb, or the Xkb extension -has not been properly initialized, -XkbGetKeyVirtualModMap - returns -BadMatch -. If -num - is less than 1 or greater than -XkbMaxKeyCount -, -XkbGetKeyVirtualModMap - returns -BadValue -. If any allocation errors occur, -XkbGetKeyVirtualModMap - returns -BadAlloc -. +has not been properly initialized, +XkbGetKeyVirtualModMap +returns +BadMatch. +If +num +is less than 1 or greater than +XkbMaxKeyCount, +XkbGetKeyVirtualModMap +returns +BadValue. +If any allocation errors occur, +XkbGetKeyVirtualModMap +returns +BadAlloc. diff --git a/libX11/specs/XKB/ch17.xml b/libX11/specs/XKB/ch17.xml index 32a1c8cb6..dcc2b214f 100644 --- a/libX11/specs/XKB/ch17.xml +++ b/libX11/specs/XKB/ch17.xml @@ -1,8 +1,11 @@ + + The Xkb Compatibility Map -As shown in Figure 17.1, the X server is normally dealing with more than one +As shown in Figure 17.1, the X server is normally dealing with more than one client, each of which may be receiving events from the keyboard, and each of which may issue requests to modify the keyboard in some manner. Each client may be either Xkb-unaware, Xkb-capable, or Xkb-aware. The server itself may be @@ -15,11 +18,13 @@ Consequently, for some situations, conversions must be made between Xkb state / keyboard mappings and core protocol state / keyboard mappings, and vice versa. - - - - - +
+ Server Interaction with Types of Clients + + + + +
@@ -39,28 +44,30 @@ state and an Xkb keyboard mapping plus a compatibility map used to convert from Xkb components to core components and vice versa. In addition, the server also maintains a core keyboard mapping that approximates the Xkb keyboard mapping. The core keyboard mapping may be updated piecemeal, on a per-key basis. When -the server receives a core protocol -ChangeKeyboardMapping - or -SetModifierMapping - request, it updates its core keyboard mapping, then uses the compatibility map -to update its Xkb keyboard mapping. When the server receives an -XkbSetMap - request, it updates those portions of its Xkb keyboard mapping specified by +the server receives a core protocol +ChangeKeyboardMapping +or +SetModifierMapping +request, it updates its core keyboard mapping, then uses the compatibility map +to update its Xkb keyboard mapping. When the server receives an +XkbSetMap +request, it updates those portions of its Xkb keyboard mapping specified by the request, then uses its compatibility map to update the corresponding parts of its core keyboard map. Consequently, the server’s Xkb keyboard map and also its core keyboard map may contain components that were set directly and -others that were computed. Figure 17.2 illustrates these relationships. +others that were computed. Figure 17.2 illustrates these relationships. The core keyboard map is contained only in the server, not in any client-side data structures. - - - - - +
+ Server Derivation of State and Keyboard Mapping Components + + + + +
@@ -78,15 +85,14 @@ server, which includes a group number, to core protocol state, which does not. -In addition, whenever the Xkb state is retrieved, the -compat_state -, -compat_grab_mods -, and -compat_lookup_mods - fields of the -XkbStateRec - returned indicate the result of applying the compatibility map to the current +In addition, whenever the Xkb state is retrieved, the +compat_state, +compat_grab_mods, +and +compat_lookup_mods +fields of the +XkbStateRec +returned indicate the result of applying the compatibility map to the current Xkb state in the server. @@ -94,11 +100,11 @@ Xkb state in the server. Core Keyboard Mapping to Xkb Keyboard Mapping After core protocol requests received by the server to change the keyboard -mapping ( -ChangeKeyboardMapping - and -SetModifierMapping -) have been applied to the server’s core keyboard map, the results must be +mapping +(ChangeKeyboardMapping +and +SetModifierMapping) +have been applied to the server’s core keyboard map, the results must be transformed to achieve an equivalent change of the Xkb keyboard mapping maintained by the server. @@ -107,9 +113,9 @@ maintained by the server. Xkb Keyboard Mapping to Core Keyboard Mapping After Xkb protocol requests received by the server to change the keyboard -mapping ( -XkbSetMap -) have been applied to the server’s Xkb keyboard map, the results are +mapping +(XkbSetMap) +have been applied to the server’s Xkb keyboard map, the results are transformed to achieve an approximately equivalent change to the core keyboard mapping maintained by the server. @@ -124,45 +130,48 @@ subsequent transformations have a particular result. The XkbCompatMap Structure + +XkbCompatMapRec All configurable aspects of mapping Xkb state and configuration to and from core protocol state and configuration are defined by a compatibility map, -contained in an -XkbCompatMap - structure; plus a set of explicit override controls used to prevent particular +contained in an +XkbCompatMapRec +structure; plus a set of explicit override controls used to prevent particular components of type 2 (core-to-Xkb keyboard mapping) transformations from automatically occurring. These explicit override controls are maintained in a -separate data structure discussed in section 16.3. +separate data structure discussed in section 16.3. -The -compat - member of an Xkb keyboard description ( -XkbDescRec -) points to the - XkbCompatMap - structure: - +The +compat +member of an Xkb keyboard description +(XkbDescRec) +points to the +XkbCompatMapRec +structure: - + typedef struct _XkbCompatMapRec { - XkbSymInterpretPtr sym_interpret; /* symbol based key semantics*/ - XkbModsRec groups[XkbNumKbdGroups]; /* group => modifier map */ - unsigned short num_si; /* # structures used in - sym_interpret */ - unsigned short size_si; /* # structures allocated in - sym_interpret */ -} XkbCompatMapRec, *XkbCompatMapPtr; + XkbSymInterpretPtr sym_interpret; /* symbol based key semantics */ + XkbModsRec groups[XkbNumKbdGroups]; /* group ⇒ modifier map */ + unsigned short num_si; /* # structures used in + sym_interpret */ + unsigned short size_si; /* # structures allocated in + sym_interpret */ +} XkbCompatMapRec, *XkbCompatMapPtr; - - - - - +
+ Xkb Compatibility Data Structures + + + + +
@@ -175,34 +184,38 @@ transformations are made. Xkb State to Core Protocol State Transformation -As shown in Figure 17.3, there are four -group compatibility maps - (contained in -groups - [0..3]) in the -XkbCompatMapRec - structure, one per possible Xkb group. Each group compatibility map is a -modifier definition (see section 7.2 for a description of modifier -definitions). The -mask - component of the definition specifies which real modifiers should be set in +As shown in Figure 17.3, there are four +group compatibility maps + +group compatibility map + +mapgroup compatibility +(contained in +groups +[0..3]) in the +XkbCompatMapRec +structure, one per possible Xkb group. Each group compatibility map is a +modifier definition (see section 7.2 for a description of modifier +definitions). The +mask +component of the definition specifies which real modifiers should be set in the core protocol state field when the corresponding group is active. Because only one group is active at any one time, only one of the four possible transformations is ever applied at any one point in time. If the device -described by the -XkbDescRec - does not support four groups, the extra groups fields are present, but +described by the +XkbDescRec +does not support four groups, the extra groups fields are present, but undefined. -Normally, the Xkb-aware server reports keyboard state in the -state - member of events such as a -KeyPress - event and -ButtonPress - event, encoded as follows: +Normally, the Xkb-aware server reports keyboard state in the +state +member of events such as a +KeyPress +event and +ButtonPress +event, encoded as follows: @@ -222,15 +235,15 @@ ButtonPress 0 - 13-14 + 13–14 Group index - 8-12 + 8–12 Pointer Buttons - 0-7 + 0–7 Modifiers @@ -240,10 +253,10 @@ ButtonPress For Xkb-unaware clients, only core protocol keyboard information may be reported. Because core protocol does not define the group index, the group -index is mapped to modifier bits as specified by the -groups +index is mapped to modifier bits as specified by the +groups [group index] field of the compatibility map (the bits set in the compatibility -map are ORed into bits 0-7 of the state), and bits 13-14 are reported in the +map are ORed into bits 0–7 of the state), and bits 13–14 are reported in the event as zero. @@ -259,7 +272,7 @@ Xkb keyboard mapping in the server, this automatic regeneration of the Xkb keyboard mapping from the core protocol keyboard mapping should not modify any components of the Xkb keyboard mapping that were explicitly set by a client. The client must set explicit override controls to prevent this from happening -(see section 16.3). The core-to-Xkb mapping is done as follows: +(see section 16.3). The core-to-Xkb mapping is done as follows: @@ -291,11 +304,11 @@ Xkb map. For each changed key, determine the number of symbols in each of the groups found in step 1a. There is one explicit override control associated with each -of the four possible groups for each Xkb key, -ExplicitKeyType1 - through -ExplicitKeyType4 -. If no explicit override control is set for a group, the number of symbols +of the four possible groups for each Xkb key, +ExplicitKeyType1 +through +ExplicitKeyType4. +If no explicit override control is set for a group, the number of symbols used for that group from the core map is two. If the explicit override control is set for a group on the key, the number of symbols used for that Xkb group from the core map is the width of the Xkb group with one exception: because of @@ -309,9 +322,9 @@ or the width of the Xkb group. For each changed key, assign the symbols in the core map to the appropriate group on the key. If the total number of symbols required by the Xkb map for a particular key needs more symbols than the core protocol map contains, the -additional symbols are taken to be -NoSymbol - keysyms appended to the end of the core set. If the core map contains more +additional symbols are taken to be +NoSymbol +keysyms appended to the end of the core set. If the core map contains more symbols than are needed by the Xkb map, trailing symbols in the core map are discarded. In the absence of an explicit override for group one or two, symbols are assigned in order by group; the first symbols in the core map are assigned @@ -365,10 +378,10 @@ the corresponding key definitions in the Xkb map. Apply symbol interpretations to modify key operation. This phase is completely -skipped if the -ExplicitInterpret - override control bit is set in the explicit controls mask for the Xkb key (see -section 16.3). +skipped if the +ExplicitInterpret +override control bit is set in the explicit controls mask for the Xkb key (see +section 16.3). @@ -391,24 +404,26 @@ apply a default interpretation. The symbol interpretations used in step 2 are configurable and may be specified -using -XkbSymInterpretRec - structures referenced by the -sym_interpret - field of an -XkbCompatMapRec - (see Figure 17.3). +using +XkbSymInterpretRec +structures referenced by the +sym_interpret +field of an +XkbCompatMapRec +(see Figure 17.3). Symbol Interpretations — the XkbSymInterpretRec Structure + +XkbSymInterpretRec Symbol interpretations are used to guide the X server when it modifies the Xkb keymap in step 2. An initial set of symbol interpretations is loaded by the -server when it starts. A client may add new ones using -XkbSetCompatMap - (see section 17.4). +server when it starts. A client may add new ones using +XkbSetCompatMap +(see section 17.4). @@ -416,62 +431,62 @@ XkbSetCompatMap Symbol interpretations result in key semantics being set. When a symbol interpretation is applied, the following components of server key event processing may be modified for the particular key involved: - - - Virtual modifier map - Auto repeat - Key behavior (may be set to XkbKB_Lock) - Key action (see section 16.1) - + + Virtual modifier map + Auto repeat + Key behavior (may be set to XkbKB_Lock) + Key action (see section 16.1) + + -The XkbSymInterpretRec +The XkbSymInterpretRec structure specifies a symbol interpretation: - - + typedef struct { - KeySym sym; /* keysym of interest or NULL */ - unsigned char flags; /* XkbSI_AutoRepeat, XkbSI_LockingKey */ - unsigned char match; /* specifies how mods is interpreted */ - unsigned char mods; /* modifier bits, correspond to eight real modifiers */ - unsigned char virtual_mod; /* 1 modifier to add to key virtual mod map */ - XkbAnyAction act; /* action to bind to symbol position on key */ -} XkbSymInterpretRec,*XkbSymInterpretPtr; + KeySym sym; /* keysym of interest or NULL */ + unsigned char flags; /* XkbSI_AutoRepeat, XkbSI_LockingKey */ + unsigned char match; /* specifies how mods is interpreted */ + unsigned char mods; /* modifier bits, correspond to + eight real modifiers */ + unsigned char virtual_mod; /* 1 modifier to add to key virtual mod map */ + XkbAnyAction act; /* action to bind to symbol position on key */ +} XkbSymInterpretRec,*XkbSymInterpretPtr; -If -sym - is not -NULL -, it limits the symbol interpretation to keys on which that particular keysym -is selected by the modifiers matching the criteria specified by -mods - and -match -. If -sym - is -NULL -, the interpretation may be applied to any symbol selected on a key when the -modifiers match the criteria specified by -mods - and -match -. - - - - -match -must be one of the values shown in Table 17.1 and specifies how the real -modifiers specified in mods +If +sym +is not +NULL, +it limits the symbol interpretation to keys on which that particular keysym +is selected by the modifiers matching the criteria specified by +mods +and +match. +If +sym +is +NULL, +the interpretation may be applied to any symbol selected on a key when the +modifiers match the criteria specified by +mods +and +match. + + + + +match +must be one of the values shown in +Table 17.1 and specifies how the real +modifiers specified in mods are to be interpreted. -
Virtual Modifier Relationships Server Interaction with Types of Clients Server Derivation of State and Keyboard Mapping Components Xkb Compatibility Data Structures
+
Symbol Interpretation Match Criteria @@ -487,47 +502,47 @@ are to be interpreted. - XkbSI_NoneOf + XkbSI_NoneOf (0) -None of the bits that are on in mods - can be set, but other bits can be. +None of the bits that are on in mods +can be set, but other bits can be. - XkbSI_AnyOfOrNone + XkbSI_AnyOfOrNone (1) -Zero or more of the bits that are on in -mods - can be set, as well as others. +Zero or more of the bits that are on in +mods +can be set, as well as others. - XkbSI_AnyOf + XkbSI_AnyOf (2) -One or more of the bits that are on in -mods - can be set, as well as any others. +One or more of the bits that are on in +mods +can be set, as well as any others. - XkbSI_AllOf + XkbSI_AllOf (3) -All of the bits that are on in -mods - must be set, but others may be set as well. +All of the bits that are on in +mods +must be set, but others may be set as well. - XkbSI_Exactly + XkbSI_Exactly (4) -All of the bits that are on in -mods - must be set, and no other bits may be set. +All of the bits that are on in +mods +must be set, and no other bits may be set. @@ -535,21 +550,21 @@ mods
-In addition to the above bits, -match - may contain the -XkbSI_LevelOneOnly - bit, in which case the modifier match criteria specified by -mods - and -match - applies only if -sym - is in level one of its group; otherwise, -mods - and -match - are ignored and the symbol matches a condition where no modifiers are set. +In addition to the above bits, +match +may contain the +XkbSI_LevelOneOnly +bit, in which case the modifier match criteria specified by +mods +and +match +applies only if +sym +is in level one of its group; otherwise, +mods +and +match +are ignored and the symbol matches a condition where no modifiers are set. @@ -569,28 +584,28 @@ interpretation where: - sym = + sym = 0 - flags = - XkbSI_AutoRepeat + flags = + XkbSI_AutoRepeat - match = - XkbSI_AnyOfOrNone + match = + XkbSI_AnyOfOrNone - mods = + mods = 0 - virtual_mod = - XkbNoModifier + virtual_mod = + XkbNoModifier - act = + act = SA_NoAction @@ -603,74 +618,70 @@ is applied to modify the Xkb map as follows. -The -act - field specifies a single action to be bound to the symbol position; any key +The +act +field specifies a single action to be bound to the symbol position; any key event that selects the symbol causes the action to be taken. Valid actions are -defined in section 16.1. +defined in section 16.1. -If the Xkb keyboard map for the key does not have its -ExplicitVModMap - control set, the -XkbSI_LevelOneOnly - bit and symbol position are examined. If the -XkbSI_LevelOneOnly - bit is not set in -match - or the symbol is in position G1L1, the -virtual_mod - field is examined. If -virtual_mod - is not -XkbNoModifier -, -virtual_mod - specifies a single virtual modifier to be added to the virtual modifier map -for the key. - virtual_mod - is specified as an index in the range [0..15]. +If the Xkb keyboard map for the key does not have its +ExplicitVModMap +control set, the +XkbSI_LevelOneOnly +bit and symbol position are examined. If the +XkbSI_LevelOneOnly +bit is not set in +match +or the symbol is in position G1L1, the +virtual_mod +field is examined. If +virtual_mod +is not +XkbNoModifier, +virtual_mod +specifies a single virtual modifier to be added to the virtual modifier map +for the key. +virtual_mod +is specified as an index in the range [0..15]. If the matching symbol is in position G1L1 of the key, two bits in the flags field potentially specify additional behavior modifications: - - -#define XkbSI_AutoRepeat (1<<0) - /* key repeats if sym is in position G1L1 */ -#define XkbSI_LockingKey (1<<1) - /* set KB_Lock - behavior if sym is in psn G1L1 */ + +#define XkbSI_AutoRepeat (1<<0) /* key repeats if sym + is in position G1L1 */ +#define XkbSI_LockingKey (1<<1) /* set KB_Lock behavior + if sym is in psn G1L1 */ -If the Xkb keyboard map for the key does not have its -ExplicitAutoRepeat - control set, its auto repeat behavior is set based on the value of the - -XkbSI_AutoRepeat - bit. If the -XkbSI_AutoRepeat - bit is set, the auto-repeat behavior of the key is turned on; otherwise, it is +If the Xkb keyboard map for the key does not have its +ExplicitAutoRepeat +control set, its auto repeat behavior is set based on the value of the +XkbSI_AutoRepeat +bit. If the +XkbSI_AutoRepeat +bit is set, the auto-repeat behavior of the key is turned on; otherwise, it is turned off. -If the Xkb keyboard map for the key does not have its -ExplicitBehavior - control set, its locking behavior is set based on the value of the -XkbSI_LockingKey - bit. If -XkbSI_LockingKey - is set, the key behavior is set to -KB_Lock -; otherwise, it is turned off (see section 16.3). +If the Xkb keyboard map for the key does not have its +ExplicitBehavior +control set, its locking behavior is set based on the value of the +XkbSI_LockingKey +bit. If +XkbSI_LockingKey +is set, the key behavior is set to +KB_Lock; +otherwise, it is turned off (see section 16.3). @@ -723,15 +734,15 @@ modifier mapping is generated as well. The modifier mapping contains all of the modifiers affected by any of the actions associated with the key combined with all of the real modifiers associated with any of the virtual modifiers bound to the key. In addition, if any of the actions associated with the key affect any -component of the keyboard group, all of the modifiers in the -mask - field of all of the group compatibility maps are added to the modifier mapping -as well. While an -XkbSA_ISOLock - action can theoretically affect any modifier, if the Xkb mapping for a key -specifies an -XkbSA_ISOLock - action, only the modifiers or group that are set by default are added to the +component of the keyboard group, all of the modifiers in the +mask +field of all of the group compatibility maps are added to the modifier mapping +as well. While an +XkbSA_ISOLock +action can theoretically affect any modifier, if the Xkb mapping for a key +specifies an +XkbSA_ISOLock +action, only the modifiers or group that are set by default are added to the modifier mapping. @@ -742,15 +753,15 @@ modifier mapping. Getting Compatibility Map Components From the Server -Use -XkbGetCompatMap - to fetch any combination of the current compatibility map components from the +Use +XkbGetCompatMap +to fetch any combination of the current compatibility map components from the server. When another client modifies the compatibility map, you are notified if -you have selected for -XkbCompatMapNotify - events (see section 17.5). -XkbGetCompatMap - is particularly useful when you receive an event of this type, as it allows +you have selected for +XkbCompatMapNotify +events (see section 17.5). +XkbGetCompatMap +is particularly useful when you receive an event of this type, as it allows you to update your program’s version of the compatibility map to match the modified version now in the server. If your program is dealing with multiple servers and needs to configure them all in a similar manner, the updated @@ -760,62 +771,69 @@ compatibility map may be used to reconfigure other servers. To make a complete matching configuration you must also update the explicit override components of the server state. - - - - - - - -Status -XkbGetCompatMap -( -display, which, xkb -) - - - - -Display * - display -; /* connection to server */ - - - - -unsigned int - which -; /* mask of compatibility map components to fetch */ - - - - -XkbDescRec * - xkb -; /* keyboard description where results placed */ - - - - - - - - -XkbGetCompatMap - fetches the components of the compatibility map specified in -which - from the server specified by -display - and places them in the -compat - structure of the keyboard description -xkb -. Valid values for -which - are an inclusive OR of the values shown in Table 17.2. - - - +XkbGetCompatMap + + + Status XkbGetCompatMap + + + Display *display + unsigned int which + XkbDescRec *xkb + + + + + + display + + + + connection to server + + + + + + which + + + + mask of compatibility map components to fetch + + + + + + xkb + + + + keyboard description where results placed + + + + + + +XkbGetCompatMap +fetches the components of the compatibility map specified in +which +from the server specified by +display +and places them in the +compat +structure of the keyboard description +xkb. +Valid values for +which +are an inclusive OR of the values shown in +Table 17.2. + + +
Compatibility Map Component Masks @@ -831,17 +849,17 @@ which - XkbSymInterpMask + XkbSymInterpMask (1<<0) Symbol interpretations - XkbGroupCompatMask + XkbGroupCompatMask (1<<1) Group maps - XkbAllCompatMask + XkbAllCompatMask (0x3) All compatibility map components @@ -850,44 +868,42 @@ which
-If no compatibility map structure is allocated in -xkb - upon entry, -XkbGetCompatMap - allocates one. If one already exists, its contents are overwritten with the +If no compatibility map structure is allocated in +xkb +upon entry, +XkbGetCompatMap +allocates one. If one already exists, its contents are overwritten with the returned results. - -XkbGetCompatMap - fetches compatibility map information for the device specified by the - -device_spec - field of -xkb -. Unless you have specifically modified this field, it is the default keyboard -device. -XkbGetCompatMap - returns -Success - if successful, -BadAlloc - if it is unable to obtain necessary storage for either the return values or -work space, -BadMatch - if the -dpy - field of the -xkb - argument is non- -NULL - and does not match the -display - argument, and -BadLength - under certain conditions caused by server or Xkb implementation errors. +XkbGetCompatMap +fetches compatibility map information for the device specified by the +device_spec +field of +xkb. +Unless you have specifically modified this field, it is the default keyboard +device. +XkbGetCompatMap +returns +Success +if successful, +BadAlloc +if it is unable to obtain necessary storage for either the return values or +work space, +BadMatch +if the +dpy +field of the +xkb +argument is non- +NULL +and does not match the +display +argument, and +BadLength +under certain conditions caused by server or Xkb implementation errors. @@ -899,294 +915,310 @@ BadLength Xkb provides several functions that make it easier to apply the compatibility map to configure a client-side Xkb keyboard mapping, given a core protocol representation of part or all of a keyboard mapping. Obtain a core protocol -representation of a keyboard mapping from an actual server (by using -XGetKeyboardMapping -, for example), a data file, or some other source. +representation of a keyboard mapping from an actual server (by using +XGetKeyboardMapping, +for example), a data file, or some other source.
To update a local Xkb keyboard map to reflect the mapping expressed by a core -format mapping by calling the function -XkbUpdateMapFromCore -. - - - - - - - - - -Bool -XkbUpdateMapFromCore -( -xkb -, - first_key -, - num_keys -, - map_width -, - core_keysyms -, - changes -) - - - - -XkbDescPtr - xkb -; /* keyboard description to update */ - - - - -KeyCode - first_key -; /* keycode of first key description to update */ - - - - -int - num_keys -; /* number of key descriptions to update */ - - - - -int - map_width -; /* width of core protocol keymap */ - - - - -KeySym * - core_keysyms -; /* symbols in core protocol keymap */ - - - - -XkbChangesPtr - changes -; /* backfilled with changes made to Xkb */ - - - - - - - - -XkbUpdateMapFromCore - interprets input argument information representing a keyboard map in core -format to update the Xkb keyboard description passed in -xkb -. Only a portion of the Xkb map is updated — the portion corresponding to -keys with keycodes in the range -first_key - through -first_key - + -num_keys - - 1. If -XkbUpdateMapFromCore - is being called in response to a - - -MappingNotify - - -event -, first_key - and -num_keys - are reported in the -MappingNotify - event. -core_keysyms - contains the keysyms corresponding to the keycode range being updated, in core -keyboard description order. -map_width - is the number of keysyms per key in -core_keysyms -. Thus, the first -map_width - entries in -core_keysyms - are for the key with keycode -first_key -, the next -map_width - entries are for key -first_key - + 1, and so on. - - - - -In addition to modifying the Xkb keyboard mapping in -xkb -, -XkbUpdateMapFromCore - backfills the changes structure whose address is passed in -changes - to indicate the modifications that were made. You may then use -changes - in subsequent calls such as -XkbSetMap -, to propagate the local modifications to a server. +format mapping by calling the function +XkbUpdateMapFromCore. + + +XkbUpdateMapFromCore + + + Bool XkbUpdateMapFromCore + + + XkbDescPtr xkb + KeyCode first_key + int num_keys + int map_width + KeySym *core_keysyms + XkbChangesPtr changes + + + + + + xkb + + + + keyboard description to update + + + + + + first_key + + + + keycode of first key description to update + + + + + + num_keys + + + + number of key descriptions to update + + + + + + map_width + + + + width of core protocol keymap + + + + + + core_keysyms + + + + symbols in core protocol keymap + + + + + + changes + + + + backfilled with changes made to Xkb + + + + + + +XkbUpdateMapFromCore +interprets input argument information representing a keyboard map in core +format to update the Xkb keyboard description passed in +xkb. +Only a portion of the Xkb map is updated — the portion corresponding to +keys with keycodes in the range +first_key +through +first_key ++ +num_keys +- 1. If +XkbUpdateMapFromCore +is being called in response to a +MappingNotify +event, +first_key +and +num_keys +are reported in the +MappingNotify +event. +core_keysyms +contains the keysyms corresponding to the keycode range being updated, in core +keyboard description order. +map_width +is the number of keysyms per key in +core_keysyms. +Thus, the first +map_width +entries in +core_keysyms +are for the key with keycode +first_key, +the next +map_width +entries are for key +first_key ++ 1, and so on. + + + + +In addition to modifying the Xkb keyboard mapping in +xkb, +XkbUpdateMapFromCore +backfills the changes structure whose address is passed in +changes +to indicate the modifications that were made. You may then use +changes +in subsequent calls such as +XkbSetMap, +to propagate the local modifications to a server. When dealing with core keyboard mappings or descriptions, it is sometimes necessary to determine the Xkb key types appropriate for the symbols bound to a -key in a core keyboard mapping. Use -XkbKeyTypesForCoreSymbols - for this purpose: - - - - - - - - - - -int -XkbKeyTypesForCoreSymbols -( -map_width -, - core_syms -, - protected, types_inout, xkb_syms_rtrn -) - - - - -XkbDescPtr - xkb -; /* keyboard description in which to place symbols*/ - - - - -int - map_width -; /* width of core protocol keymap in -xkb_syms_rtrn - */ - - - - -KeySym * - core_syms -; /* core protocol format array of KeySyms */ - - - - -unsigned int -protected -; /* explicit key types */ - - - - -int * - types_inout; - /* backfilled with the canonical types bound to groups one and two -for the key */ - - - - -KeySym * -xkb_syms_rtrn - ; /* backfilled with symbols bound to the key in the Xkb mapping */ - - - - - - - - -XkbKeyTypesForCoreSymbols - expands the symbols in -core_syms - and types in -types_inout - according to the rules specified in section 12 of the core protocol, then -chooses canonical key types (canonical key types are defined in section 15.2.1) +key in a core keyboard mapping. Use +XkbKeyTypesForCoreSymbols +for this purpose: + + + +XkbKeyTypesForCoreSymbols + + + int XkbKeyTypesForCoreSymbols + + + XkbDescPtr xkb + int map_width + KeySym *core_syms + unsigned int protected + int *types_inout + KeySym *xkb_syms_rtrn + + + + + + xkb + + + + keyboard description in which to place symbols + + + + + + map_width + + + + width of core protocol keymap in xkb_syms_rtrn + + + + + + core_syms + + + + core protocol format array of KeySyms + + + + + + protected + + + + explicit key types + + + + + + types_inout + + + + backfilled with the canonical types bound to groups one and two + for the key + + + + + + xkb_syms_rtrn + + + + backfilled with symbols bound to the key in the Xkb mapping + + + + + + +XkbKeyTypesForCoreSymbols +expands the symbols in +core_syms +and types in +types_inout +according to the rules specified in section 12 of the core protocol, then +chooses canonical key types (canonical key types are defined in section 15.2.1) for groups 1 and 2 using the rules specified by the Xkb protocol and places -them in -xkb_syms_rtrn -, which will be non- -NULL -. +them in +xkb_syms_rtrn, +which will be non- +NULL. -A core keymap is a two-dimensional array of keysyms. It has -map_width - columns and -max_key_code - rows. -XkbKeyTypesForCoreSymbols - takes a single row from a core keymap, determines the number of groups +A core keymap is a two-dimensional array of keysyms. It has +map_width +columns and +max_key_code +rows. +XkbKeyTypesForCoreSymbols +takes a single row from a core keymap, determines the number of groups associated with it, the type of each group, and the symbols bound to each -group. The return value is the number of groups, -types_inout - has the types for each group, and -xkb_syms_rtrn - has the symbols in Xkb order (that is, groups are contiguous, regardless of +group. The return value is the number of groups, +types_inout +has the types for each group, and +xkb_syms_rtrn +has the symbols in Xkb order (that is, groups are contiguous, regardless of size). - -protected - contains the explicitly protected key types. There is one explicit override +protected +contains the explicitly protected key types. There is one explicit override control associated with each of the four possible groups for each Xkb key, - -ExplicitKeyType1 - through -ExplicitKeyType4 - -; protected -is an inclusive OR of these controls. -map_width - is the width of the core keymap and is not dependent on any Xkb definitions. - -types_inout - is an array of four type indices. On input, -types_inout - contains the indices of any types already assigned to the key, in case they +ExplicitKeyType1 +through +ExplicitKeyType4; +protected +is an inclusive OR of these controls. +map_width +is the width of the core keymap and is not dependent on any Xkb definitions. +types_inout +is an array of four type indices. On input, +types_inout +contains the indices of any types already assigned to the key, in case they are explicitly protected from change. -Upon return, -types_inout - contains any automatically selected (that is, canonical) types plus any +Upon return, +types_inout +contains any automatically selected (that is, canonical) types plus any protected types. Canonical types are assigned to all four groups if there are -enough symbols to do so. The four entries in -types_inout - correspond to the four groups for the key in question. +enough symbols to do so. The four entries in +types_inout +correspond to the four groups for the key in question. @@ -1194,59 +1226,62 @@ types_inout If the groups mapping does not change, but the symbols assigned to an Xkb keyboard compatibility map do change, the semantics of the key may be modified. To apply the new compatibility mapping to an individual key to get its -semantics updated, use -XkbApplyCompatMapToKey -. - - - - - - - - - - -Bool -XkbApplyCompatMapToKey -( -xkb -, - key -, - changes -) - - - - - XkbDescPtr - xkb; -/* keyboard description to be updated */ - - - - - KeyCode - key -; /* key to be updated */ - - - - - XkbChangesPtr - changes -; /* notes changes to the Xkb keyboard description */ - - - - - - - - -XkbApplyCompatMapToKey - essentially performs the operation described in section 17.1.2 to a specific +semantics updated, use +XkbApplyCompatMapToKey. + + + +XkbApplyCompatMapToKey + + + Bool XkbApplyCompatMapToKey + + + XkbDescPtr xkb + KeyCode key + XkbChangesPtr changes + + + + + + xkb + + + + keyboard description to be updated + + + + + + key + + + + key to be updated + + + + + + changes + + + + notes changes to the Xkb keyboard description + + + + + + +XkbApplyCompatMapToKey +essentially performs the operation described in section 17.1.2 to a specific key. This updates the behavior, actions, repeat status, and virtual modifier bindings of the key. @@ -1258,268 +1293,280 @@ bindings of the key. To modify the server’s compatibility map, first modify a local copy of the -Xkb compatibility map, then call -XkbSetCompatMap -. You may allocate a new compatibility map for this purpose using -XkbAllocCompatMap - (see section 17.6). You may also use a compatibility map from another server, -although you need to adjust the -device_spec - field in the -XkbDescRec - accordingly. Note that symbol interpretations in a compatibility map -( -sym_interpret -, the vector of -XkbSymInterpretRec - structures) are also allocated using this same function. - - - - - - - - - -Bool -XkbSetCompatMap -( -display, which, xkb, update_actions -) - - - - -Display * - display -; /* connection to server */ - - - - -unsigned int - which -; /* mask of compat map components to set */ - - - - -XkbDescPtr - xkb -; /* source for compat map components */ - - - - -Bool - update_actions -; /* -True - => apply to server’s keyboard map */ - - - - - - - - -XkbSetCompatMap - copies compatibility map information from the keyboard description in - -xkb - to the server specified in -display -’s compatibility map for the device specified by the -device_spec - field of -xkb -. Unless you have specifically modified this field, it is the default keyboard -device. - which - specifies the compatibility map components to be set, and is an inclusive OR -of the bits shown in Table 17.2. - - - - -After updating its compatibility map for the specified device, if -update_actions - is -True, - the server applies the new compatibility map to its entire keyboard for the +Xkb compatibility map, then call +XkbSetCompatMap. +You may allocate a new compatibility map for this purpose using +XkbAllocCompatMap +(see section 17.6). You may also use a compatibility map from another server, +although you need to adjust the +device_spec +field in the +XkbDescRec +accordingly. Note that symbol interpretations in a compatibility map +( +sym_interpret, +the vector of +XkbSymInterpretRec +structures) are also allocated using this same function. + + +XkbSetCompatMap + + + Bool XkbSetCompatMap + + + Display *display + unsigned int which + XkbDescPtr xkb + Bool update_actions + + + + + + display + + + + connection to server + + + + + + which + + + + mask of compat map components to set + + + + + + xkb + + + + source for compat map components + + + + + + update_actions + + + + True ⇒ apply to server’s keyboard map + + + + + + +XkbSetCompatMap +copies compatibility map information from the keyboard description in +xkb +to the server specified in +display’s +compatibility map for the device specified by the +device_spec +field of +xkb. +Unless you have specifically modified this field, it is the default keyboard +device. +which +specifies the compatibility map components to be set, and is an inclusive OR +of the bits shown in Table 17.2. + + + + +After updating its compatibility map for the specified device, if +update_actions +is +True, +the server applies the new compatibility map to its entire keyboard for the device to generate a new set of key semantics, compatibility state, and a new -core keyboard map. If -update_actions - is -False -, the new compatibility map is not used to generate any modifications to the +core keyboard map. If +update_actions +is +False, +the new compatibility map is not used to generate any modifications to the current device semantics, state, or core keyboard map. One reason for not applying the compatibility map immediately would be if one server was being configured to match another on a piecemeal basis; the map should not be applied -until everything is updated. To force an update at a later time, use -XkbSetCompatMap - specifying -which - as zero and -update_actions - as -True -. - - - - - -XkbSetCompatMap - returns -True - if successful and -False - if unsuccessful. The server may report problems it encounters when processing -the request subsequently via protocol errors. +until everything is updated. To force an update at a later time, use +XkbSetCompatMap +specifying +which +as zero and +update_actions +as +True. -To add a symbol interpretation to the list of symbol interpretations in an - -XkbCompatRec -, use -XkbAddSymInterpret -. +XkbSetCompatMap +returns +True +if successful and +False +if unsuccessful. The server may report problems it encounters when processing +the request subsequently via protocol errors. - - - - - - - -XkbSymInterpretPtr -XkbAddSymInterpret -( -xkb, si, updateMap, changes -) - - - - -XkbDescPtr - xkb -; /* keyboard description to be updated */ - - - - -XkbSymInterpretPtr - si -; /* symbol interpretation to be added */ - - - - -Bool - updateMap -; /* -True -=>apply compatibility map to keys */ - - - - -XkbChangesPtr - changes -; /* changes are put here */ - - - - - - - -XkbAddSymInterpret - adds -si - to the list of symbol interpretations in -xkb -. If -updateMap - is -True -, it (re)applies the compatibility map to all of the keys on the keyboard. If - -changes - is non- -NULL -, it reports the parts of the keyboard that were affected (unless -updateMap - is -True -, not much changes). -XkbAddSymInterpret - returns a pointer to the actual new symbol interpretation in the list or - -NULL - if it failed. +To add a symbol interpretation to the list of symbol interpretations in an +XkbCompatRec, +use +XkbAddSymInterpret. + + + +XkbAddSymInterpret + + + XkbSymInterpretPtr XkbAddSymInterpret + + + XkbDescPtr xkb + XkbSymInterpretPtr si + Bool updateMap + XkbChangesPtr changes + + + + + + xkb + + + + keyboard description to be updated + + + + + + si + + + + symbol interpretation to be added + + + + + + updateMap + + + + True⇒apply compatibility map to keys + + + + + + changes + + + + changes are put here + + + + + + +XkbAddSymInterpret +adds +si +to the list of symbol interpretations in +xkb. +If +updateMap +is +True, +it (re)applies the compatibility map to all of the keys on the keyboard. If +changes +is non- +NULL, +it reports the parts of the keyboard that were affected (unless +updateMap +is +True, +not much changes). +XkbAddSymInterpret +returns a pointer to the actual new symbol interpretation in the list or +NULL +if it failed. Tracking Changes to the Compatibility Map + +eventsXkbCompatMapNotify + +XkbCompatMapNotifyEvent -The server automatically generates -MappingNotify - events when the keyboard mapping changes. If you wish to be notified of -changes to the compatibility map, you should select for -XkbCompatMapNotify - events. If you select for -XkbMapNotify - events, you no longer receive the automatically generated -MappingNotify - events. If you subsequently deselect -XkbMapNotifyEvent - delivery, you again receive -MappingNotify - events. +The server automatically generates +MappingNotify +events when the keyboard mapping changes. If you wish to be notified of +changes to the compatibility map, you should select for +XkbCompatMapNotify +events. If you select for +XkbMapNotify +events, you no longer receive the automatically generated +MappingNotify +events. If you subsequently deselect +XkbMapNotifyEvent +delivery, you again receive +MappingNotify +events. -To receive -XkbCompatMapNotify - events under all possible conditions, use -XkbSelectEvents - (see section 4.3) and pass -XkbCompatMapNotifyMask - in both -bits_to_change - and -values_for_bits -. +To receive +XkbCompatMapNotify +events under all possible conditions, use +XkbSelectEvents +(see section 4.3) and pass +XkbCompatMapNotifyMask +in both +bits_to_change +and +values_for_bits. -To receive -XkbCompatMapNotify - events only under certain conditions, use -XkbSelectEventDetails - using -XkbCompatMapNotify - as the -event_type - and specifying the desired map changes in -bits_to_change - and -values_for_bits - using mask bits from Table 17.2. +To receive +XkbCompatMapNotify +events only under certain conditions, use +XkbSelectEventDetails +using +XkbCompatMapNotify +as the +event_type +and specifying the desired map changes in +bits_to_change +and +values_for_bits +using mask bits from Table 17.2. @@ -1530,71 +1577,65 @@ made by other clients. -The structure for the -XkbCompatMapNotifyEvent - is: - +The structure for the +XkbCompatMapNotifyEvent +is: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True => - synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbCompatMapNotify */ - int device; /* Xkb device ID, will not be - XkbUseCoreKbd */ - unsigned int changed_groups;/* number of group maps changed */ - int first_si; /* index to 1st changed symbol - interpretation */ - int num_si; /* number of changed symbol - interpretations */ - int num_total_si; /* total number of valid symbol - interpretations */ -} XkbCompatMapNotifyEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ + synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbCompatMapNotify */ + int device; /* Xkb device ID, will not be + XkbUseCoreKbd */ + unsigned int changed_groups; /* number of group maps changed */ + int first_si; /* index to 1st changed symbol + interpretation */ + int num_si; /* number of changed symbol + interpretations */ + int num_total_si; /* total number of valid symbol + interpretations */ +} XkbCompatMapNotifyEvent; - -changed_groups - is the number of group compatibility maps that have changed. If you are +changed_groups +is the number of group compatibility maps that have changed. If you are maintaining a corresponding copy of the compatibility map, or get a fresh copy -from the server using -XkbGetCompatMap -, -changed_groups - references -groups -[0.. -changed_groups --1] in the -XkbCompatMapRec - structure. - - - - - -first_si - is the index of the first changed symbol interpretation, -num_si - is the number of changed symbol interpretations, and -num_total_si - is the total number of valid symbol interpretations. If you are maintaining a +from the server using +XkbGetCompatMap, +changed_groups +references +groups +[0.. +changed_groups +-1] in the +XkbCompatMapRec +structure. + + + + +first_si +is the index of the first changed symbol interpretation, +num_si +is the number of changed symbol interpretations, and +num_total_si +is the total number of valid symbol interpretations. If you are maintaining a corresponding copy of the compatibility map, or get a fresh copy from the -server using -XkbGetCompatMap -, -first_si -, -num_si -, and -num_total_si - are appropriate for use with the -compat.sym_interpret - vector in this structure. +server using +XkbGetCompatMap, +first_si, +num_si, +and +num_total_si +are appropriate for use with the +compat.sym_interpret +vector in this structure. @@ -1605,200 +1646,201 @@ compat.sym_interpret If you are modifying the compatibility map, you need to allocate a new compatibility map if you do not already have one available. To do so, use - -XkbAllocCompatMap -. - - - - - - - - - -Status -XkbAllocCompatMap -( -xkb, which, num_si -) - - - - -XkbDescPtr - xkb -; /* keyboard description in which to allocate compat map */ - - - - -unsigned int - which -; /* mask of compatibility map components to allocate */ - - - - -unsigned int - num_si -; /* number of symbol interpretations to allocate */ - - - - - - - - -xkb - specifies the keyboard description for which compatibility maps are to be -allocated. The compatibility map is the -compat - field in this structure. - - - - - -which - specifies the compatibility map components to be allocated (see -XkbGetCompatMap -, in section 17.2). -which - is an inclusive OR of the bits shown in Table 17.2. - - - - - -num_si - specifies the total number of entries to allocate in the symbol interpretation -vector ( -xkb.compat.sym_interpret -). - - - - -Note that symbol interpretations in a compatibility map (the -sym_interpret - vector of -XkbSymInterpretRec - structures) are also allocated using this same function. To ensure that there +XkbAllocCompatMap. + + +XkbAllocCompatMap + + + Status XkbAllocCompatMap + + + XkbDescPtr xkb + unsigned int which + unsigned int num_si + + + + + + xkb + + + + keyboard description in which to allocate compat map + + + + + + which + + + + mask of compatibility map components to allocate + + + + + + num_si + + + + number of symbol interpretations to allocate + + + + + + +xkb +specifies the keyboard description for which compatibility maps are to be +allocated. The compatibility map is the +compat +field in this structure. + + + + +which +specifies the compatibility map components to be allocated (see +XkbGetCompatMap, +in section 17.2). +which +is an inclusive OR of the bits shown in +Table 17.2. + + + + +num_si +specifies the total number of entries to allocate in the symbol interpretation +vector +(xkb.compat.sym_interpret). + + + + + +Note that symbol interpretations in a compatibility map (the +sym_interpret +vector of +XkbSymInterpretRec +structures) are also allocated using this same function. To ensure that there is sufficient space in the symbol interpretation vector for entries to be -added, use -XkbAllocCompatMap - specifying -which - as -XkbSymInterpretMask - and the number of free symbol interpretations needed in -num_si -. - - - - - -XkbAllocCompatMap - returns -Success - if successful, -BadMatch - if -xkb - is -NULL -, or -BadAlloc - if errors are encountered when attempting to allocate storage. - - - - -To free an entire compatibility map or selected portions of one, use -XkbFreeCompatMap -. - - - - - - - - - - -void -XkbFreeCompatMap -( -xkb, which, free_map -) - - - - -XkbDescPtr - xkb -; /* Xkb description in which to free compatibility map */ - - - - -unsigned int - which -; /* mask of compatibility map components to free */ - - - - -Bool - free_map -; /* -True - => free -XkbCompatMap - structure itself */ - - - - - - - - -which - specifies the compatibility map components to be freed (see -XkbGetCompatMap -, in section 17.2). -which - is an inclusive OR of the bits shown in Table 17.2 - - - - - -free_map - indicates whether the -XkbCompatMap - structure itself should be freed. If -free_map - is -True -, -which - is ignored, all non- -NULL - compatibility map components are freed, and the -compat - field in the -XkbDescRec - referenced by -xkb - is set to -NULL -. +added, use +XkbAllocCompatMap +specifying +which +as +XkbSymInterpretMask +and the number of free symbol interpretations needed in +num_si. + + + + +XkbAllocCompatMap +returns +Success +if successful, +BadMatch +if +xkb +is +NULL, +or +BadAlloc +if errors are encountered when attempting to allocate storage. + + + + +To free an entire compatibility map or selected portions of one, use +XkbFreeCompatMap. + + + +XkbFreeCompatMap + + + void XkbFreeCompatMap + + + XkbDescPtr xkb + unsigned int which + Bool free_map + + + + + + xkb + + + + Xkb description in which to free compatibility map + + + + + + which + + + + mask of compatibility map components to free + + + + + + free_map + + + + True ⇒ free XkbCompatMapRec + structure itself + + + + + + +which +specifies the compatibility map components to be freed (see +XkbGetCompatMap, +in section 17.2). +which +is an inclusive OR of the bits shown in +Table 17.2 + + + + +free_map +indicates whether the +XkbCompatMapRec +structure itself should be freed. If +free_map +is +True, +which +is ignored, all non- +NULL +compatibility map components are freed, and the +compat +field in the +XkbDescRec +referenced by +xkb +is set to +NULL. diff --git a/libX11/specs/XKB/ch18.xml b/libX11/specs/XKB/ch18.xml index 806b09a45..0f283ecfc 100644 --- a/libX11/specs/XKB/ch18.xml +++ b/libX11/specs/XKB/ch18.xml @@ -1,3 +1,6 @@ + + Symbolic Names @@ -7,13 +10,12 @@ actually used to interpret events. This makes it difficult to write an application that presents the keyboard to a user in an easy-to-understand way. Such applications have to examine the vendor string and keycodes to determine the type of keyboard connected to the server and then examine keysyms and -modifier mappings to determine the effects of most modifiers (the -Shift -, -Lock - and -Control - modifiers are defined by the core protocol but no semantics are implied for +modifier mappings to determine the effects of most modifiers (the +Shift, +Lock +and +Control +modifiers are defined by the core protocol but no semantics are implied for any other modifiers). @@ -21,69 +23,76 @@ any other modifiers). To make it easier for applications to present a keyboard to the user, Xkb supports symbolic names for most components of the keyboard extension. Most of -these symbolic names are grouped into the -names - component of the keyboard description. +these symbolic names are grouped into the +names +component of the keyboard description. The XkbNamesRec Structure + +XkbKeyNameRec + +XkbKeyAliasRec + +XkbNamesRec The names component of the keyboard description is defined as follows: - - + #define XkbKeyNameLength 4 #define XkbKeyNumVirtualMods 16 #define XkbKeyNumIndicators 32 #define XkbKeyNumKbdGroups 4 #define XkbMaxRadioGroups 32 - - typedef struct { - char name[XkbKeyNameLength]; /* symbolic key names */ -} XkbKeyNameRec,*XkbKeyNamePtr; - + char name[XkbKeyNameLength]; /* symbolic key names */ +} XkbKeyNameRec, *XkbKeyNamePtr; - typedef struct { - char real[XkbKeyNameLength]; - /* this key name must be in the keys array */ - char alias[XkbKeyNameLength]; - /* symbolic key name as alias for the key */ -} XkbKeyAliasRec,*XkbKeyAliasPtr; - + char real[XkbKeyNameLength]; + /* this key name must be in the keys array */ + char alias[XkbKeyNameLength]; + /* symbolic key name as alias for the key */ +} XkbKeyAliasRec, *XkbKeyAliasPtr; - typedef struct _XkbNamesRec { - Atom keycodes; /* identifies range and meaning of keycodes */ - Atom geometry; /* identifies physical location, size, and shape of keys */ - Atom symbols; /* identifies the symbols logically bound to the keys */ - Atom types; /* identifies the set of key types */ - Atom compat; /* identifies actions for keys using core protocol */ - Atom vmods[XkbNumVirtualMods]; /* symbolic names for virtual modifiers */ - Atom indicators[XkbNumIndicators]; /* symbolic names for indicators */ - Atom groups[XkbNumKbdGroups]; /* symbolic names for keyboard groups */ - XkbKeyNamePtr keys; /* symbolic key name array */ - XkbKeyAliasPtr key_aliases; /* real/alias symbolic name pairs array */ - Atom * radio_groups; /* radio group name array */ - Atom phys_symbols; /* identifies the symbols engraved on the keyboard */ - unsigned char num_keys; /* number of keys in the keys array */ - unsigned char num_key_aliases; /* number of keys in the - key_aliases array */ - unsigned short num_rg; /* number of radio groups */ -} XkbNamesRec,*XkbNamesPtr; /* + Atom keycodes; /* identifies range and meaning + of keycodes */ + Atom geometry; /* identifies physical location, + size, and shape of keys */ + Atom symbols; /* identifies the symbols logically + bound to the keys */ + Atom types; /* identifies the set of key types */ + Atom compat; /* identifies actions for keys using + core protocol */ + Atom vmods[XkbNumVirtualMods]; /* symbolic names for + virtual modifiers */ + Atom indicators[XkbNumIndicators]; /* symbolic names + for indicators */ + Atom groups[XkbNumKbdGroups]; /* symbolic names for + keyboard groups */ + XkbKeyNamePtr keys; /* symbolic key name array */ + XkbKeyAliasPtr key_aliases; /* real/alias symbolic name pairs array */ + Atom * radio_groups; /* radio group name array */ + Atom phys_symbols; /* identifies the symbols engraved + on the keyboard */ + unsigned char num_keys; /* number of keys in the keys array */ + unsigned char num_key_aliases; /* number of keys in the + key_aliases array */ + unsigned short num_rg; /* number of radio groups */ +} XkbNamesRec, *XkbNamesPtr; -The -keycodes - name identifies the range and meaning of the keycodes returned by the keyboard -in question. The -geometry - name, on the other hand, identifies the physical location, size and shape of +The +keycodes +name identifies the range and meaning of the keycodes returned by the keyboard +in question. The +geometry +name, on the other hand, identifies the physical location, size and shape of the various keys on the keyboard. As an example to distinguish between these two names, consider function keys on PC-compatible keyboards. Function keys are sometimes above the main keyboard and sometimes to the left of the main @@ -96,36 +105,35 @@ similar keycodes name but may have different geometry names. the keycodes returned by a keyboard; a single keycodes name might cover keyboards with differing numbers of keys provided all keys have the same semantics when present. For example, 101 and 102 key PC keyboards might use the -same name. In these cases, applications can use the keyboard -geometry - name to determine which subset of the named keycodes is in use. +same name. In these cases, applications can use the keyboard +geometry +name to determine which subset of the named keycodes is in use. -The -symbols - name identifies the symbols logically bound to the keys. The symbols name is a +The +symbols +name identifies the symbols logically bound to the keys. The symbols name is a human or application-readable description of the intended locale or usage of -the keyboard with these symbols. The -phys_symbols - name, on the other hand, identifies the symbols actually engraved on the -keyboard. Given this, the -symbols - name and -phys_symbols - names might be different. For example, the description for a keyboard that has +the keyboard with these symbols. The +phys_symbols +name, on the other hand, identifies the symbols actually engraved on the +keyboard. Given this, the +symbols +name and +phys_symbols +names might be different. For example, the description for a keyboard that has English US engravings, but that is using Swiss German symbols might have a - -phys_symbols - name of "en_US" and a -symbols - name of "de_CH." +phys_symbols +name of "en_US" and a +symbols +name of "de_CH." -The -types - name provides some information about the set of key types (see section 15.2) +The +types +name provides some information about the set of key types (see section 15.2) that can be associated with the keyboard. In addition, each key type can have a name, and each shift level of a type can have a name. Although these names are stored in the map description with each of the types, they are accessed using @@ -134,9 +142,9 @@ the same methods as the other symbolic names. -The -compat - name provides some information about the rules used to bind actions to keys +The +compat +name provides some information about the rules used to bind actions to keys that are changed using core protocol requests. @@ -144,27 +152,26 @@ that are changed using core protocol requests. Xkb provides symbolic names for each of the 4 keyboard groups, 16 virtual modifiers, 32 keyboard indicators, and 4 keyboard groups. These names are held -in the -vmods -, -indicators -, and -groups - fixed-length arrays. +in the +vmods, +indicators, +and +groups +fixed-length arrays. Each key has a four-byte symbolic name. All of the symbolic key names are held -in the -keys - array, and -num_keys - reports the number of entries that are in the keys array. For each key, the +in the +keys +array, and +num_keys +reports the number of entries that are in the keys array. For each key, the key name links keys with similar functions or in similar positions on keyboards -that report different keycodes. For example, the -F1 - key may emit keycode 23 on one keyboard and keycode 86 on another. By naming +that report different keycodes. For example, the +F1 +key may emit keycode 23 on one keyboard and keycode 86 on another. By naming this key "FK01" on both keyboards, the keyboard layout designer can reuse parts of keyboard descriptions for different keyboards. @@ -173,37 +180,38 @@ of keyboard descriptions for different keyboards. Key aliases allow the keyboard layout designer to assign multiple key names to a single key. This allows the keyboard layout designer to refer to keys using -either their position or their "function." For example, a keyboard layout +either their position or their function. +For example, a keyboard layout designer may wish to refer to the left arrow key on a PC keyboard using the ISO9995-5 positional specification of A31 or using the functional specification -of LEFT. The -key_aliases - field holds a variable-length array of real and alias key name pairs, and the -total number of entries in the -key_aliases - array is held in -num_key_aliases -. For each real and alias key name pair, the -real - field refers to the a name in the keys array, and the -alias - field refers to the alias for that key. Using the previous example, the +of LEFT. The +key_aliases +field holds a variable-length array of real and alias key name pairs, and the +total number of entries in the +key_aliases +array is held in +num_key_aliases. +For each real and alias key name pair, the +real +field refers to the a name in the keys array, and the +alias +field refers to the alias for that key. Using the previous example, the keyboard designer may use the name A31 in the keys array, but also define the -name LEFT as an alias for A31 in the -key_aliases - array. +name LEFT as an alias for A31 in the +key_aliases +array. Key aliases defined in the geometry component of a keyboard mapping -(see Chapter 13) override those defined in the keycodes component of the server -database, which are stored in the -XkbNamesRec - ( -xkb->names -). Therefore, consider the key aliases defined by the geometry before -considering key aliases supplied by the -XkbNamesRec -. +(see ) override those defined in the keycodes component of the server +database, which are stored in the +XkbNamesRec + +(xkb->names). +Therefore, consider the key aliases defined by the geometry before +considering key aliases supplied by the +XkbNamesRec. + A radio group is a set of keys whose behavior simulates a set of radio buttons. @@ -216,13 +224,13 @@ be logically depressed at one time. Each radio group in the keyboard description can have a name. These names are -held in the variable-length array -radio_groups -, and -num_rg - tells how many elements are in the -radio_groups - array. +held in the variable-length array +radio_groups, +and +num_rg +tells how many elements are in the +radio_groups +array. @@ -234,10 +242,10 @@ radio_groups Xkb provides several functions that work with symbolic names. Each of these functions uses a mask to specify individual fields of the structures described above. These masks and their relationships to the fields in a keyboard -description are shown in Table 18.1. +description are shown in Table 18.1. - +
Symbolic Names Masks @@ -255,91 +263,91 @@ description are shown in Table 18.1. - XkbKeycodesNameMask + XkbKeycodesNameMask (1<<0) Xkb->names keycodes - XkbGeometryNameMask + XkbGeometryNameMask (1<<1) Xkb->names geometry - XkbSymbolsNameMask + XkbSymbolsNameMask (1<<2) Xkb->names symbols - XkbPhysSymbolsNameMask + XkbPhysSymbolsNameMask (1<<3) Xkb->names phys_symbols - XkbTypesNameMask + XkbTypesNameMask (1<<4) Xkb->names type - XkbCompatNameMask + XkbCompatNameMask (1<<5) Xkb->names compat - XkbKeyTypeNamesMask + XkbKeyTypeNamesMask (1<<6) Xkb->map type[*].name - XkbKTLevelNamesMask + XkbKTLevelNamesMask (1<<7) Xkb->map type[*].lvl_names[*] - XkbIndicatorNamesMask + XkbIndicatorNamesMask (1<<8) Xkb->names indicators[*] - XkbKeyNamesMask + XkbKeyNamesMask (1<<9) Xkb->names keys[*], num_keys - XkbKeyAliasesMask + XkbKeyAliasesMask (1<<10) Xkb->names key_aliases[*], num_key_aliases - XkbVirtualModNamesMask + XkbVirtualModNamesMask (1<<11) Xkb->names vmods[*] - XkbGroupNamesMask + XkbGroupNamesMask (1<<12) Xkb->names groups[*] - XkbRGNamesMask + XkbRGNamesMask (1<<13) Xkb->names radio_groups[*], num_rg - XkbComponentNamesMask + XkbComponentNamesMask (0x3f) Xkb->names @@ -352,7 +360,7 @@ description are shown in Table 18.1. - XkbAllNamesMask + XkbAllNamesMask (0x3fff) Xkb->names all name components @@ -366,133 +374,129 @@ description are shown in Table 18.1. Getting Symbolic Names From the Server -To obtain symbolic names from the server, use -XkbGetNames -. +To obtain symbolic names from the server, use +XkbGetNames. - - - - - - - -Status -XkbGetNames -( -dpy, which, Xkb -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -unsigned int -which -; /* mask of names or map components to be updated */ - - - - -XkbDescPtr -xkb - /* keyboard description to be updated */ - - - - - +XkbGetNames + + + Status XkbGetNames + + + Display *dpy + unsigned int which + XkbDescPtr xkb + + + + + + dpy + + + + connection to the X server + + + + + + which + + + + mask of names or map components to be updated + + + + + + xkb + + + + keyboard description to be updated + + + + - -XkbGetNames - retrieves symbolic names for the components of the keyboard extension from the -X server. The -which - parameter specifies the name components to be updated in the -xkb - parameter, and is the bitwise inclusive OR of the valid names mask bits -defined in Table 18.1. +XkbGetNames +retrieves symbolic names for the components of the keyboard extension from the +X server. The +which +parameter specifies the name components to be updated in the +xkb +parameter, and is the bitwise inclusive OR of the valid names mask bits +defined in Table 18.1. -If the -names - field of the keyboard description -xkb - is -NULL -, -XkbGetNames - allocates and initializes the -names - component of the keyboard description before obtaining the values specified by - -which -. If the -names - field of -xkb - is not -NULL -, -XkbGetNames - obtains the values specified by -which - and copies them into the keyboard description -Xkb -. +If the +names +field of the keyboard description +xkb +is +NULL, +XkbGetNames +allocates and initializes the +names +component of the keyboard description before obtaining the values specified by +which. +If the +names +field of +xkb +is not +NULL, +XkbGetNames +obtains the values specified by +which +and copies them into the keyboard description +xkb. -If the -map - component of the -xkb - parameter is -NULL -, -XkbGetNames - does not retrieve type or shift level names, even if -XkbKeyTypeNamesMask - or -XkbKTLevelNamesMask - are set in -which -. +If the +map +component of the +xkb +parameter is +NULL, +XkbGetNames +does not retrieve type or shift level names, even if +XkbKeyTypeNamesMask +or +XkbKTLevelNamesMask +are set in +which. - -XkbGetNames - can return -Success -, or -BadAlloc -, -BadLength -, -BadMatch -, and -BadImplementation - errors. +XkbGetNames +can return +Success, +or +BadAlloc, +BadLength, +BadMatch, +and +BadImplementation +errors. -To free symbolic names, use -XkbFreeNames - (see section 18.6) +To free symbolic names, use +XkbFreeNames +(see section 18.6) @@ -502,122 +506,133 @@ XkbFreeNames To change the symbolic names in the server, first modify a local copy of the -keyboard description and then use either -XkbSetNames, - or, to save network traffic, use a -XkbNameChangesRec -structure and call -XkbChangeNames - to download the changes to the server. -XkbSetNames - and -XkbChangeNames - can generate -BadAlloc -, -BadAtom -, -BadLength -, -BadMatch, - and -BadImplementation - errors. +keyboard description and then use either +XkbSetNames, +or, to save network traffic, use a +XkbNameChangesRec +structure and call +XkbChangeNames +to download the changes to the server. +XkbSetNames +and +XkbChangeNames +can generate +BadAlloc, +BadAtom, +BadLength, +BadMatch, +and +BadImplementation +errors. - - - - - - - -Bool -XkbSetNames -( -dpy, which, first_type, num_types, xkb -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -unsigned int -which -; /* mask of names or map components to be changed */ - - - - -unsigned int -first_type - ; /* first type whose name is to be changed */ - - - - -unsigned int -num_types -; /* number of types for which names are to be changed */ - - - - -XkbDescPtr -xkb -; /* keyboard description from which names are to be taken */ - - - - - +XkbSetNames + + + Bool XkbSetNames + + + Display *dpy + unsigned int which + unsigned int first_type + unsigned int num_types + XkbDescPtr xkb + + + + + + dpy + + + + connection to the X server + + + + + + which + + + + mask of names or map components to be changed + + + + + + first_type + + + + first type whose name is to be changed + + + + + + num_types + + + + number of types for which names are to be changed + + + + + + xkb + + + + keyboard description from which names are to be taken + + + + -Use - XkbSetNames - to change many names at the same time. For each bit set in -which -, -XkbSetNames - takes the corresponding value (or values in the case of arrays) from the -keyboard description -xkb - and sends it to the server. +Use +XkbSetNames +to change many names at the same time. For each bit set in +which, +XkbSetNames +takes the corresponding value (or values in the case of arrays) from the +keyboard description +xkb +and sends it to the server. -The -first_type - and -num_types - arguments are used only if -XkbKeyTypeNamesMask - or -XkbKTLevelNamesMask - is set in -which - and specify a subset of the types for which the corresponding names are to be +The +first_type +and +num_types +arguments are used only if +XkbKeyTypeNamesMask +or +XkbKTLevelNamesMask +is set in +which +and specify a subset of the types for which the corresponding names are to be changed. If either or both of these mask bits are set but the specified types -are illegal, -XkbSetNames - returns -False - and does not update any of the names specified in -which -. The specified types are illegal if -xkb - does not include a map component or if -first_type - and -num_types - specify types that are not defined in the keyboard description. +are illegal, +XkbSetNames +returns +False +and does not update any of the names specified in +which. +The specified types are illegal if +xkb +does not include a map component or if +first_type +and +num_types +specify types that are not defined in the keyboard description. @@ -626,52 +641,52 @@ num_types The XkbNameChangesRec Structure + +XkbNameChangesRec -The -XkbNameChangesRec - allows applications to identify small modifications to the symbolic names and +The +XkbNameChangesRec +allows applications to identify small modifications to the symbolic names and effectively reduces the amount of traffic sent to the server: - - + typedef struct _XkbNameChanges { - unsigned int changed; /* name components that have - changed */ - unsigned char first_type; /* first key type with a new - name */ - unsigned char num_types; /* number of types with new - names */ - unsigned char first_lvl; /* first key type with new level - names */ - unsigned char num_lvls; /* number of key types with new - level names */ - unsigned char num_aliases; /* if key aliases changed, - total number of key aliases */ - unsigned char num_rg; /* if radio groups changed, total - number of radio groups */ - unsigned char first_key; /* first key with a new name */ - unsigned char num_keys; /* number of keys with new names - */ - unsigned short changed_vmods; /* mask of virtual - modifiers for which names have changed */ - unsigned long changed_indicators; /* mask of indicators - for which names were changed */ - unsigned char changed_groups; /* mask of groups for - which names were changed */ -} XkbNameChangesRec, *XkbNameChangesPtr + unsigned int changed; /* name components that have + changed */ + unsigned char first_type; /* first key type with a new name */ + unsigned char num_types; /* number of types with new names */ + unsigned char first_lvl; /* first key type with new level + names */ + unsigned char num_lvls; /* number of key types with new + level names */ + unsigned char num_aliases; /* if key aliases changed, + total number of key aliases */ + unsigned char num_rg; /* if radio groups changed, total + number of radio groups */ + unsigned char first_key; /* first key with a new name */ + unsigned char num_keys; /* number of keys with new names */ + unsigned short changed_vmods; /* mask of virtual modifiers + for which names have changed */ + unsigned long changed_indicators; /* mask of indicators + for which names were changed */ + unsigned char changed_groups; /* mask of groups for + which names were changed */ +} XkbNameChangesRec, *XkbNameChangesPtr; -The -changed - field specifies the name components that have changed and is the bitwise -inclusive OR of the valid names mask bits defined in Table 18.1. The rest of +The +changed +field specifies the name components that have changed and is the bitwise +inclusive OR of the valid names mask bits defined in +Table 18.1. The rest of the fields in the structure specify the ranges that have changed for the -various kinds of symbolic names, as shown in Table 18.2. +various kinds of symbolic names, as shown in +Table 18.2. -
+
XkbNameChanges Fields @@ -689,7 +704,7 @@ various kinds of symbolic names, as shown in Table 18.2. - XkbKeyTypeNamesMask + XkbKeyTypeNamesMask first_type, num_types @@ -698,7 +713,7 @@ various kinds of symbolic names, as shown in Table 18.2. type[*].name - XkbKTLevelNamesMask + XkbKTLevelNamesMask first_lvl, num_lvls @@ -707,19 +722,19 @@ various kinds of symbolic names, as shown in Table 18.2. type[*].lvl_names[*] - XkbKeyAliasesMask + XkbKeyAliasesMask num_aliases Xkb->names key_aliases[*] - XkbRGNamesMask + XkbRGNamesMask num_rg Xkb->names radio_groups[*] - XkbKeyNamesMask + XkbKeyNamesMask first_key, num_keys @@ -728,19 +743,19 @@ various kinds of symbolic names, as shown in Table 18.2. keys[*] - XkbVirtualModNamesMask + XkbVirtualModNamesMask changed_vmods Xkb->names vmods[*] - XkbIndicatorNamesMask + XkbIndicatorNamesMask changed_indicators Xkb->names indicators[*] - XkbGroupNamesMask + XkbGroupNamesMask changed_groups Xkb->names groups[*] @@ -750,70 +765,73 @@ various kinds of symbolic names, as shown in Table 18.2.
- -XkbChangeNames - provides a more flexible method for changing symbolic names than -XkbSetNames - and requires the use of an -XkbNameChangesRec - structure. +XkbChangeNames +provides a more flexible method for changing symbolic names than +XkbSetNames +and requires the use of an +XkbNameChangesRec +structure. - - - - - - - -Bool -XkbChangeNames -( -dpy, xkb, changes -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -XkbDescPtr - xkb -; /* keyboard description from which names are to be taken */ - - - - -XkbNameChangesPtr - changes -; /* names map components to be updated on the server */ - - - - - +XkbChangeNames + + + Bool XkbChangeNames + + + Display *dpy + XkbDescPtr xkb + XkbNameChangesPtr changes + + + + + + dpy + + + + connection to the X server + + + + + + xkb + + + + keyboard description from which names are to be taken + + + + + + changes + + + + names map components to be updated on the server + + + + - -XkbChangeNames - copies any names specified by -changes - from the keyboard description, -xkb -, to the X server specified by -dpy -. - XkbChangeNames - aborts and returns -False - if any illegal type names or type shift level names are specified by -changes -. +XkbChangeNames +copies any names specified by +changes +from the keyboard description, +xkb, +to the X server specified by +dpy. +XkbChangeNames +aborts and returns +False +if any illegal type names or type shift level names are specified by +changes. @@ -821,232 +839,236 @@ changes
Tracking Name Changes + +eventsXkbNamesNotify + +XkbNamesNotifyEvent Whenever a symbolic name changes in the server’s keyboard description, the -server sends a -XkbNamesNotify - event to all interested clients. To receive name notify events, use -XkbSelectEvents - (see section 4.3) with -XkbNamesNotifyMask - in both the -bits_to_change - and -values_for_bits - parameters. +server sends a +XkbNamesNotify +event to all interested clients. To receive name notify events, use +XkbSelectEvents +(see section 4.3) with +XkbNamesNotifyMask +in both the +bits_to_change +and +values_for_bits +parameters. -To receive events for only specific names, use -XkbSelectEventDetails -. Set the -event_type - parameter to -XkbNamesNotify -, and set both the -bits_to_change -and - values_for_bits - detail parameter to a mask composed of a bitwise OR of masks in Table 18.1. +To receive events for only specific names, use +XkbSelectEventDetails. +Set the +event_type +parameter to +XkbNamesNotify, +and set both the +bits_to_change +and +values_for_bits +detail parameter to a mask composed of a bitwise OR of masks in +Table 18.1. -The structure for the -XkbNamesNotify - event is defined as follows: - +The structure for the +XkbNamesNotify +event is defined as follows: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for - event */ - Bool send_event; /* True - => synthetically generated */ - Display * display; /* server connection where event - generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbNamesNotify */ - int device; /* Xkb device ID, will not be - XkbUseCoreKbd */ - unsigned int changed; /* mask of name components -that have changed */ - int first_type; /* first key type with a new name */ - int num_types; /* number of types with new names */ - int first_lvl; /* first key type with new level names */ - int num_lvls; /* number of key types with new level names */ - int num_aliases; /* if key aliases changed, total number - of key aliases */ - int num_radio_groups; /* if radio groups changed, + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbNamesNotify */ + int device; /* Xkb device ID, will not be + XkbUseCoreKbd */ + unsigned int changed; /* mask of name components + that have changed */ + int first_type; /* first key type with a new name */ + int num_types; /* number of types with new names */ + int first_lvl; /* first key type with new level names */ + int num_lvls; /* number of key types with new level names */ + int num_aliases; /* if key aliases changed, total number + of key aliases */ + int num_radio_groups; /* if radio groups changed, total number of radio groups */ - unsigned int changed_vmods; /* mask of virtual modifiers for - which names have changed */ - unsigned int changed_groups; /* mask of groups for - which names were changed */ - unsigned int changed_indicators; /* mask of indicators for which - names were changed */ - int first_key; /* first key with a new name */ - int num_keys; /* number of keys with new names */ -} XkbNamesNotifyEvent; + unsigned int changed_vmods; /* mask of virtual modifiers for + which names have changed */ + unsigned int changed_groups; /* mask of groups for + which names were changed */ + unsigned int changed_indicators; /* mask of indicators for which + names were changed */ + int first_key; /* first key with a new name */ + int num_keys; /* number of keys with new names */ +} XkbNamesNotifyEvent; -The -changed - field specifies the name components that have changed and is the bitwise -inclusive OR of the valid names mask bits defined in Table 18.1. The other -fields in this event are interpreted as the like-named fields in an -XkbNameChangesRec , as previously defined. +The +changed +field specifies the name components that have changed and is the bitwise +inclusive OR of the valid names mask bits defined in +Table 18.1. The other +fields in this event are interpreted as the like-named fields in an +XkbNameChangesRec , as previously defined. -When your application receives a X -kbNamesNotify - event, you can note the changed names in a changes structure using -XkbNoteNameChanges -. +When your application receives a +XkbNamesNotify +event, you can note the changed names in a changes structure using +XkbNoteNameChanges. - - - - - - - -void -XkbNoteNameChanges -( -old -, - new -, - wanted -) - - - - -XkbNameChangesPtr -old -; /* -XkbNameChanges - structure to be updated */ - - - - -XkbNamesNotifyEvent * -new -; /* event from which changes are to be copied */ - - - - -unsigned int -wanted -; /* types of names for which changes are to be noted */ - - - - - +XkbNoteNameChanges + + + void XkbNoteNameChanges + + + XkbNameChangesPtr old + XkbNamesNotifyEvent *new + unsigned int wanted + + + + + + old + + + + XkbNameChangesRec structure to be updated + + + + + + new + + + + event from which changes are to be copied + + + + + + wanted + + + + types of names for which changes are to be noted + + + + -The -wanted - parameter is the bitwise inclusive OR of the valid names mask bits shown in -Table 18.1. -XkbNoteNameChanges - copies any changes that are reported in -new - and specified in -wanted - into the changes record specified by -old -. +The +wanted +parameter is the bitwise inclusive OR of the valid names mask bits shown in +Table 18.1. +XkbNoteNameChanges +copies any changes that are reported in +new +and specified in +wanted +into the changes record specified by +old. To update the local copy of the keyboard description with the actual values, -pass to -XkbGetNameChanges - the results of one or more calls to -XkbNoteNameChanges -. +pass to +XkbGetNameChanges +the results of one or more calls to +XkbNoteNameChanges. - - - - - - - -Status -XkbGetNameChanges -( -dpy -, - xkb -, - changes -) - - - - -Display * -dpy -; /* connection to the X server */ - - - - -XkbDescPtr -xkb -; /* keyboard description to which names are copied */ - - - - -XkbNameChangesPtr -changes -; /* names components to be obtained from the server */ - - - - - +XkbGetNameChanges + + + Status XkbGetNameChanges + + + Display *dpy + XkbDescPtr xkb + XkbNameChangesPtr changes + + + + + + dpy + + + + connection to the X server + + + + + + xkb + + + + keyboard description to which names are copied + + + + + + changes + + + + names components to be obtained from the server + + + + - -XkbGetNameChanges - examines the -changes - parameter, retrieves the necessary information from the server, and places the -results into the -xkb - keyboard description. +XkbGetNameChanges +examines the +changes +parameter, retrieves the necessary information from the server, and places the +results into the +xkb +keyboard description. - -XkbGetNamesChanges - can generate -BadAlloc -, -BadImplementation, - and -BadMatch - errors. +XkbGetNameChanges +can generate +BadAlloc, +BadImplementation, +and +BadMatch +errors. @@ -1056,136 +1078,149 @@ BadMatch Most applications do not need to directly allocate symbolic names structures. -Do not allocate a names structure directly using -malloc - or -Xmalloc - if your application changes the number of key aliases or radio groups or +Do not allocate a names structure directly using +malloc +or +Xmalloc +if your application changes the number of key aliases or radio groups or constructs a symbolic names structure without loading the necessary components -from the X server. Instead use -XkbAllocNames -. +from the X server. Instead use +XkbAllocNames. - - - - - - - -Status -XkbAllocNames -( -xkb, which, num_rg, num_key_aliases) - - - - -XkbDescPtr -xkb; - /* keyboard description for which names are to be allocated */ - - - - -unsigned int -which; - /* mask of names to be allocated */ - - - - -int -num_rg; - /* total number of radio group names needed */ - - - - -int -num_key_aliases; - /* total number of key aliases needed */ - - - - - +XkbAllocNames + + + Status XkbAllocNames + + + XkbDescPtr xkb + unsigned int which + int num_rg + int num_key_aliases + + + + + + xkb + + + + keyboard description for which names are to be allocated + + + + + + which + + + + mask of names to be allocated + + + + + + num_rg + + + + total number of radio group names needed + + + + + + num_key_aliases + + + + total number of key aliases needed + + + + - -XkbAllocNames - can return -BadAlloc -, -BadMatch, - and -BadValue - errors. - -The -which - parameter is the bitwise inclusive OR of the valid names mask bits defined in -Table 18.1. +XkbAllocNames +can return +BadAlloc, +BadMatch, +and +BadValue +errors. +The +which +parameter is the bitwise inclusive OR of the valid names mask bits defined in +Table 18.1. -Do not free symbolic names structures directly using -free - or -XFree -. Use -XkbFreeNames - instead. +Do not free symbolic names structures directly using +free +or +XFree. +Use +XkbFreeNames +instead. - - - - - - - -void -XkbFreeNames -( -xkb, which, free_map) - - - - -XkbDescPtr -xkb -; /* keyboard description for which names are to be freed */ - - - - -unsigned int -which -; /* mask of names components to be freed */ - - - - -Bool -free_map -; /* -True - => XkbNamesRec structure itself should be freed */ - - - - - +XkbFreeNames + + + void XkbFreeNames + + + XkbDescPtr xkb + unsigned int which + Bool free_map + + + + + + xkb + + + + keyboard description for which names are to be freed + + + + + + which + + + + mask of names components to be freed + + + + + + free_map + + + + True + ⇒ XkbNamesRec structure itself should be freed + + + + -The -which - parameter is the bitwise inclusive OR of the valid names mask bits defined in -Table 18.1. +The +which +parameter is the bitwise inclusive OR of the valid names mask bits defined in +Table 18.1.
diff --git a/libX11/specs/XKB/ch19.xml b/libX11/specs/XKB/ch19.xml index 4b4b0a023..faa62a278 100644 --- a/libX11/specs/XKB/ch19.xml +++ b/libX11/specs/XKB/ch19.xml @@ -1,8 +1,12 @@ + + -Replacing a Keyboard "On the Fly" +Replacing a Keyboard <quote>On the Fly</quote> -Some operating system and X server implementations allow "hot plugging" of +Some operating system and X server implementations allow +hot plugging of input devices. When using these implementations, input devices can be unplugged and new ones plugged in without restarting the software that is using those devices. There is no provision in the standard X server for notification of @@ -18,11 +22,11 @@ program may also change the X keyboard programmatically. The XChangeKeyboardDevice input extension request allows a client to designate an input extension keyboard device as the X keyboard, in which case the old X keyboard device becomes inaccessible except via the input device extension. In -this case, core protocol -XMappingNotify - and input extension -XChangeDeviceNotify - events are generated to notify all clients that a new keyboard with a new +this case, core protocol +MappingNotify +and input extension +XChangeDeviceNotify +events are generated to notify all clients that a new keyboard with a new keymap has been designated. @@ -37,77 +41,75 @@ for the client. -Xkb provides an -XkbNewKeyboardNotify - event that reports a change in keyboard geometry and/or the range of supported -keycodes. The server can generate an -XkbNewKeyboardNotify - event when it detects a new keyboard or in response to an -XkbGetKeyboardByName - request that loads a new keyboard description. Selecting for -XkbNewKeyboardNotify - events allows Xkb-aware clients to be notified whenever a keyboard change +Xkb provides an +XkbNewKeyboardNotify +event that reports a change in keyboard geometry and/or the range of supported +keycodes. The server can generate an +XkbNewKeyboardNotify +event when it detects a new keyboard or in response to an +XkbGetKeyboardByName +request that loads a new keyboard description. Selecting for +XkbNewKeyboardNotify +events allows Xkb-aware clients to be notified whenever a keyboard change occurs that may affect the keymap. -When a client requests -XkbNewKeyboardNotify - events, the server compares the range of keycodes for the current keyboard to +When a client requests +XkbNewKeyboardNotify +events, the server compares the range of keycodes for the current keyboard to the range of keycodes that are valid for the client. If they are not the same, -the server immediately sends the client an -XkbNewKeyboardNotify - event. Even if the "new" keyboard is not new to the server, it is new to this -particular client. +the server immediately sends the client an +XkbNewKeyboardNotify +event. Even if the new keyboard is not new to the server, +it is new to this particular client. -When the server sends an -XkbNewKeyboardNotify - event to a client to inform it of a new keycode range, it resets the stored +When the server sends an +XkbNewKeyboardNotify +event to a client to inform it of a new keycode range, it resets the stored range of legal keycodes for the client to the keycode range reported in the event; it does not reset this range for the client if it does not sent an - -XkbNewKeyboardNotify - event to a client. Because Xkb-unaware clients and Xkb-aware clients that do -not request -XkbNewKeyboardNotify - events are never sent these events, the server’s notion of the legal keycode +XkbNewKeyboardNotify +event to a client. Because Xkb-unaware clients and Xkb-aware clients that do +not request +XkbNewKeyboardNotify +events are never sent these events, the server’s notion of the legal keycode range never changes, and these clients never receive events from keys that fall outside of their notion of the legal keycode range. -Clients that have not selected to receive -XkbNewKeyboardNotify - events do, however, receive the -XkbNewKeyboardNotify - event when a keyboard change occurs. Clients that have not selected to receive +Clients that have not selected to receive +XkbNewKeyboardNotify +events do, however, receive the +XkbNewKeyboardNotify +event when a keyboard change occurs. Clients that have not selected to receive this event also receive numerous other events detailing the individual changes that occur when a keyboard change occurs. -Clients wishing to track changes in -min_key_code - and -max_key_code - must watch for both -XkbNewKeyboardNotify - and -XkbMapNotify - events, because a simple mapping change causes an -XkbMapNotify - event and may change the range of valid keycodes, but does not cause an - -XkbNewKeyboardNotify - event. If a client does not select for -XkbNewKeyboardNotify - events, the server restricts the range of keycodes reported to the client. +Clients wishing to track changes in +min_key_code +and +max_key_code +must watch for both +XkbNewKeyboardNotify +and +XkbMapNotify +events, because a simple mapping change causes an +XkbMapNotify +event and may change the range of valid keycodes, but does not cause an +XkbNewKeyboardNotify +event. If a client does not select for +XkbNewKeyboardNotify +events, the server restricts the range of keycodes reported to the client. @@ -118,34 +120,34 @@ In addition to filtering out-of-range key events, Xkb: -Adjusts core protocol -MappingNotify - events to refer only to keys that match the stored legal range. +Adjusts core protocol +MappingNotify +events to refer only to keys that match the stored legal range. Reports keyboard mappings for keys that match the stored legal range to clients -that issue a core protocol -GetKeyboardMapping - request. +that issue a core protocol +GetKeyboardMapping +request. Reports modifier mappings only for keys that match the stored legal range to -clients that issue a core protocol -GetModifierMapping - request. +clients that issue a core protocol +GetModifierMapping +request. -Restricts the core protocol -ChangeKeyboardMapping - and -SetModifierMapping - requests to keys that fall inside the stored legal range. +Restricts the core protocol +ChangeKeyboardMapping +and +SetModifierMapping +requests to keys that fall inside the stored legal range. @@ -158,57 +160,60 @@ manner; all Xkb events report the full range of legal keycodes. No requested Xkb events are discarded, and no Xkb requests have their keycode range clamped. + +eventsXkbNewKeyboardNotify + +XkbNewKeyboardNotifyEvent -The structure for the -XkbNewKeyboardNotify - event is defined as follows: - +The structure for the +XkbNewKeyboardNotify +event is defined as follows: - + typedef struct _XkbNewKeyboardNotify { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event*/ - Bool send_event; /* True - => synthetically generated */ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbNewKeyboardNotify */ - int device; /* device ID of new keyboard */ - int old_device; /* device ID of old keyboard */ - int min_key_code; /* min keycode of new keyboard */ - int max_key_code; /* max keycode of new keyboard */ - int old_min_key_code; /* min keycode of old keyboard */ - int old_max_key_code; /* max keycode of old keyboard */ - unsigned int changed; /* changed aspects - see masks below */ - char req_major; /* major request that caused change */ - char req_minor; /* minor request that caused change */ -} XkbNewKeyboardNotifyEvent; + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbNewKeyboardNotify */ + int device; /* device ID of new keyboard */ + int old_device; /* device ID of old keyboard */ + int min_key_code; /* min keycode of new keyboard */ + int max_key_code; /* max keycode of new keyboard */ + int old_min_key_code; /* min keycode of old keyboard */ + int old_max_key_code; /* max keycode of old keyboard */ + unsigned int changed; /* changed aspects - see masks below */ + char req_major; /* major request that caused change */ + char req_minor; /* minor request that caused change */ +} XkbNewKeyboardNotifyEvent; -To receive name notify events, use -XkbSelectEvents - (see section 4.3) with -XkbNewKeyboardNotifyMask - in both the -bits_to_change - and -values_for_bits - parameters. To receive events for only specific names, use -XkbSelectEventDetails -. Set the -event_type - parameter to -XkbNewKeyboardNotify -, and set both the -bits_to_change -and - values_for_bits - detail parameter to a mask composed of a bitwise OR of masks in Table 19.1. +To receive name notify events, use +XkbSelectEvents +(see section 4.3) with +XkbNewKeyboardNotifyMask +in both the +bits_to_change +and +values_for_bits +parameters. To receive events for only specific names, use +XkbSelectEventDetails. +Set the +event_type +parameter to +XkbNewKeyboardNotify, +and set both the +bits_to_change +and +values_for_bits +detail parameter to a mask composed of a bitwise OR of masks in +Table 19.1. - +
XkbNewKeyboardNotifyEvent Details @@ -224,22 +229,22 @@ and - XkbNKN_KeycodesMask + XkbNKN_KeycodesMask (1L<<0) Notification of keycode range changes wanted - XkbNKN_GeometryMask + XkbNKN_GeometryMask (1L<<1) Notification of geometry changes wanted - XkbNKN_DeviceIDMask + XkbNKN_DeviceIDMask (1L<<2) Notification of device ID changes wanted - XkbNKN_AllChangesMask + XkbAllNewKeyboardEventsMask (0x7) Includes all of the above masks @@ -248,36 +253,35 @@ and
-The -req_major - and -req_minor - fields indicate what type of keyboard change has occurred. +The +req_major +and +req_minor +fields indicate what type of keyboard change has occurred. -If -req_major - and -req_minor - are zero, the device change was not caused by a software request to the server +If +req_major +and +req_minor +are zero, the device change was not caused by a software request to the server — a spontaneous change has occurred, such as hot-plugging a new device. In -this case, -device - is the device identifier for the new, current X keyboard device, but no -implementation-independent guarantee can be made about -old_device -. -old_device - may be identical to -device - (an implementor is permitted to reuse the device specifier when the device -changes); or it may be different. Note that -req_major - and -req_minor - being zero do not necessarily mean that the physical keyboard device has +this case, +device +is the device identifier for the new, current X keyboard device, but no +implementation-independent guarantee can be made about +old_device. +old_device +may be identical to +device +(an implementor is permitted to reuse the device specifier when the device +changes); or it may be different. Note that +req_major +and +req_minor +being zero do not necessarily mean that the physical keyboard device has changed; rather, they only imply a spontaneous change outside of software control (some systems have keyboards that can change personality at the press of a key). @@ -285,45 +289,44 @@ of a key). -If the keyboard change is the result of an X Input Extension -ChangeKeyboardDevice - request, -req_major - contains the input extension major opcode, and -req_minor - contains the input extension request number for -X_ChangeKeyboardDevice -. In this case, -device - and -old_device - are different, with -device - being the identifier for the new, current X keyboard device, and -old_device - being the identifier for the former device. +If the keyboard change is the result of an X Input Extension +ChangeKeyboardDevice +request, +req_major +contains the input extension major opcode, and +req_minor +contains the input extension request number for +X_ChangeKeyboardDevice. +In this case, +device +and +old_device +are different, with +device +being the identifier for the new, current X keyboard device, and +old_device +being the identifier for the former device. -If the keyboard change is the result of an -XkbGetKeyboardByName - function call, which generates an -X_kbGetKbdByName - request, -req_major - contains the Xkb extension base event code (see section 2.4), and -req_minor - contains the event code for the Xkb extension request -X_kbGetKbdByName -. -device - contains the device identifier for the new device, but nothing definitive can -be said for -old_device -; it may be identical to -device -, or it may be different, depending on the implementation. +If the keyboard change is the result of an +XkbGetKeyboardByName +function call, which generates an +X_kbGetKbdByName +request, +req_major +contains the Xkb extension base event code (see section 2.4), and +req_minor +contains the event code for the Xkb extension request +X_kbGetKbdByName. +device +contains the device identifier for the new device, but nothing definitive can +be said for +old_device; +it may be identical to +device, +or it may be different, depending on the implementation.
diff --git a/libX11/specs/XKB/ch20.xml b/libX11/specs/XKB/ch20.xml index 6067b5b8f..33501fb7f 100644 --- a/libX11/specs/XKB/ch20.xml +++ b/libX11/specs/XKB/ch20.xml @@ -1,3 +1,6 @@ + + Server Database of Keyboard Components @@ -5,11 +8,11 @@ The X server maintains a database of keyboard components, identified by component type. The database contains all the information necessary to build a complete keyboard description for a particular device, as well as to assemble -partial descriptions. Table 20.1 identifies the component types and the type of -information they contain. +partial descriptions. Table 20.1 +identifies the component types and the type of information they contain. - +
Server Database Keyboard Components @@ -94,11 +97,11 @@ used to refer to either individual components or a keymap. There may be multiple entries for each of the component types. An entry may be -either -complete - or -partial -. Partial entries describe only a piece of the corresponding keyboard component +either +complete +or +partial. +Partial entries describe only a piece of the corresponding keyboard component and are designed to be combined with other entries of the same type to form a complete entry. @@ -108,43 +111,42 @@ For example, a partial symbols map might describe the differences between a common ASCII keyboard and some national layout. Such a partial map is not useful on its own because it does not include those symbols that are the same on both the ASCII and national layouts (such as function keys). On the other -hand, this partial map can be used to configure -any - ASCII keyboard to use a national layout. +hand, this partial map can be used to configure +any +ASCII keyboard to use a national layout. When a keyboard description is built, the components are processed in the order -in which they appear in Table 20.1; later definitions override earlier ones. +in which they appear in Table 20.1; +later definitions override earlier ones. Component Names -Component names have the form " -class(member) -" where -class - describes a subset of the available components for a particular type and the -optional -member - identifies a specific component from that subset. For example, the name +Component names have the form “class(member)” where +class +describes a subset of the available components for a particular type and the +optional +member +identifies a specific component from that subset. For example, the name "atlantis(acme)" for a symbols component might specify the symbols used for the atlantis national keyboard layout by the vendor "acme." Each class has an -optional -default - member — references that specify a class but not a member refer to the +optional +default +member — references that specify a class but not a member refer to the default member of the class, if one exists. Xkb places no constraints on the interpretation of the class and member names used in component names. -The -class - and -member - names are both specified using characters from the Latin-1 character set. Xkb +The +class +and +member +names are both specified using characters from the Latin-1 character set. Xkb implementations must accept all alphanumeric characters, minus (‘-’) and underscore (‘_’) in class or member names, and must not accept parentheses, plus, vertical bar, percent sign, asterisk, question mark, or white space. The @@ -159,112 +161,109 @@ use of other characters is implementation-dependent. You may ask the server for a list of components for one or more component types. The request takes the form of a set of patterns, one pattern for each of the component types, including a pattern for the complete keyboard description. -To obtain this list, use -XkbListComponents -. +To obtain this list, use +XkbListComponents. - - - - - - - -XkbComponentListPtr - XkbListComponents -( -dpy -, -device_spec -, -ptrns -, -max_inout -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -XkbComponentNamesPtr -ptrns -; /* namelist for components of interest */ - - - - -int * -max_inout -; /* max # returned names, # left over */ - - - - - +XkbListComponents + + + XkbComponentListPtr XkbListComponents + + + Display *dpy + unsigned int device_spec + XkbComponentNamesPtr ptrns + int *max_inout + + + + + + dpy + + + + connection to X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + ptrns + + + + namelist for components of interest + + + + + + max_inout + + + + max # returned names, # left over + + + + - -XkbListComponents - queries the server for a list of component names matching the patterns -specified in -ptrns -. It waits for a reply and returns the matching component names in an -XkbComponentListRec - structure. When you are done using the structure, you should free it using - -XkbFreeComponentList -. -device_spec - indicates a particular device in which the caller is interested. A server is +XkbListComponents +queries the server for a list of component names matching the patterns +specified in +ptrns. +It waits for a reply and returns the matching component names in an +XkbComponentListRec +structure. When you are done using the structure, you should free it using +XkbFreeComponentList. +device_spec +indicates a particular device in which the caller is interested. A server is allowed (but not required) to restrict its reply to portions of the database that are relevant for that particular device. - -ptrns - is a pointer to an -XkbComponentNamesRec -, described below. Each of the fields in -ptrns - contains a pattern naming the components of interest. Each of the patterns is -composed of characters from the ISO -Latin1 - encoding, but can contain only parentheses, the wildcard characters -‘ -? -’ and ‘ -* -’, and characters permitted in a component class or member name (see section -20.1). A pattern may be -NULL -, in which case no components for that type is returned. Pattern matches with -component names are case sensitive. The ‘ -? -’ wildcard matches any single character, except a left or right parenthesis; -the ‘ -* -’ wildcard matches any number of characters, except a left or right +ptrns +is a pointer to an +XkbComponentNamesRec, +described below. Each of the fields in +ptrns +contains a pattern naming the components of interest. Each of the patterns is +composed of characters from the ISO +Latin1 +encoding, but can contain only parentheses, the wildcard characters +‘?’ and ‘*’, +and characters permitted in a component class or member name +(see section 20.1). A pattern may be +NULL, +in which case no components for that type is returned. Pattern matches with +component names are case sensitive. The +‘?’ +wildcard matches any single character, except a left or right parenthesis; +the ‘*’ +wildcard matches any number of characters, except a left or right parenthesis. If an implementation allows additional characters in a component class or member name other than those required by the Xkb extension (see -section 20.1), the result of comparing one of the additional characters to +section 20.1), the result of comparing one of the additional characters to either of the wildcard characters is implementation-dependent. @@ -277,118 +276,112 @@ from the pattern. - -max_inout - is used to throttle the amount of data passed to and from the server. On +max_inout +is used to throttle the amount of data passed to and from the server. On input, it specifies the maximum number of names to be returned (the total -number of names in all component categories). Upon return from -XkbListComponents -, -max_inout - contains the number of names that matched the request but were not returned +number of names in all component categories). Upon return from +XkbListComponents, +max_inout +contains the number of names that matched the request but were not returned because of the limit. - + + +XkbComponentNamesRec The component name patterns used to describe the request are passed to - -XkbListComponents - using an -XkbComponentNamesRec - structure. This structure has no special allocation constraints or +XkbListComponents +using an +XkbComponentNamesRec +structure. This structure has no special allocation constraints or interrelationships with other structures; allocate and free this structure -using standard -malloc - and -free - calls or their equivalent: - +using standard +malloc +and +free +calls or their equivalent: - + typedef struct _XkbComponentNames { - char * keymap; /* keymap names */ - char * keycodes; /* keycode names */ - char * types; /* type names */ - char * compat; /* compatibility map names */ - char * symbols; /* symbol names */ - char * geometry; /* geometry names */ -} XkbComponentNamesRec, *XkbComponentNamesPtr; + char * keymap; /* keymap names */ + char * keycodes; /* keycode names */ + char * types; /* type names */ + char * compat; /* compatibility map names */ + char * symbols; /* symbol names */ + char * geometry; /* geometry names */ +} XkbComponentNamesRec, *XkbComponentNamesPtr; - - -XkbListComponents - returns a pointer to an -XkbComponentListRec -: - + + +XkbComponentListRec + +XkbComponentNameRec +XkbListComponents +returns a pointer to an +XkbComponentListRec: - + typedef struct _XkbComponentList { - int num_keymaps; /* number of entries in keymap */ - int num_keycodes; /* number of entries in keycodes */ - int num_types; /* number of entries in types */ - int num_compat; /* number of entries in compat */ - int num_symbols; /* number of entries in symbols */ - int num_geometry; /* number of entries in geometry; - XkbComponentNamePtr keymap; /* keymap names */ - XkbComponentNamePtr keycodes; /* keycode names */ - XkbComponentNamePtr types; /* type names */ - XkbComponentNamePtr compat; /* compatibility map names */ - XkbComponentNamePtr symbols; /* symbol names */ - XkbComponentNamePtr geometry; /* geometry names */ -} XkbComponentListRec, *XkbComponentListPtr; - + int num_keymaps; /* number of entries in keymap */ + int num_keycodes; /* number of entries in keycodes */ + int num_types; /* number of entries in types */ + int num_compat; /* number of entries in compat */ + int num_symbols; /* number of entries in symbols */ + int num_geometry; /* number of entries in geometry; + XkbComponentNamePtr keymap; /* keymap names */ + XkbComponentNamePtr keycodes; /* keycode names */ + XkbComponentNamePtr types; /* type names */ + XkbComponentNamePtr compat; /* compatibility map names */ + XkbComponentNamePtr symbols; /* symbol names */ + XkbComponentNamePtr geometry; /* geometry names */ +} XkbComponentListRec, *XkbComponentListPtr; - typedef struct _XkbComponentName { - unsigned short flags; /* hints regarding component name */ - char * name; /* name of component */ -} XkbComponentNameRec, *XkbComponentNamePtr; + unsigned short flags; /* hints regarding component name */ + char * name; /* name of component */ +} XkbComponentNameRec, *XkbComponentNamePtr; -Note that the structure used to specify patterns on input is an -XkbComponentNamesRec -, and that used to hold the individual component names upon return is an - -XkbComponentNameRec - (no trailing ‘s’ in Name). +Note that the structure used to specify patterns on input is an +XkbComponentNamesRec, +and that used to hold the individual component names upon return is an +XkbComponentNameRec +(no trailing ‘s’ in Name). -When you are done using the structure returned by -XkbListComponents -, free it using -XkbFreeComponentList -. +When you are done using the structure returned by +XkbListComponents, +free it using +XkbFreeComponentList. - - - - - - - -void -XkbFreeComponentList -(list) - - - - -XkbComponentListPtr list; /* pointer to -XkbComponentListRec - to free */ - - - - - +XkbFreeComponentList + + + void XkbFreeComponentList + + + XkbComponentListPtr list + + + + + + list + + + + pointer to XkbComponentListRec to free + + + + @@ -398,19 +391,21 @@ XkbComponentListRec A set of flags is associated with each component; these flags provide additional hints about the component’s use. These hints are designated by bit -masks in the flags field of the -XkbComponentNameRec - structures contained in the -XkbComponentListRec - returned from -XkbListComponents -. The least significant byte of the flags field has the same meaning for all +masks in the flags field of the +XkbComponentNameRec +structures contained in the +XkbComponentListRec +returned from +XkbListComponents. +The least significant byte of the flags field has the same meaning for all types of keyboard components; the interpretation of the most significant byte -is dependent on the type of component. The flags bits are defined in Table -20.2. The symbols hints in Table 20.2 apply only to partial symbols components -(those with -XkbLC_Partial - also set); full symbols components are assumed to specify all of the pieces. +is dependent on the type of component. The flags bits are defined in +Table 20.2. +The symbols hints in Table 20.2 +apply only to partial symbols components +(those with +XkbLC_Partial +also set); full symbols components are assumed to specify all of the pieces. @@ -419,15 +414,15 @@ The alphanumeric, modifier, keypad or function keys symbols hints should describe the primary intent of the component designer and should not be simply an exhaustive list of the kinds of keys that are affected. For example, national keyboard layouts affect primarily alphanumeric keys, but many affect a -few modifier keys as well; such mappings should set only the -XkbLC_AlphanumericKeys - hint. In general, symbols components should set only one of the four flags -( -XkbLC_AlternateGroup - may be combined with any of the other flags). +few modifier keys as well; such mappings should set only the +XkbLC_AlphanumericKeys +hint. In general, symbols components should set only one of the four flags +( +XkbLC_AlternateGroup +may be combined with any of the other flags). -
+
XkbComponentNameRec Flags Bits @@ -446,19 +441,19 @@ XkbLC_AlternateGroup All Components - XkbLC_Hidden + XkbLC_Hidden Do not present to user (1L<<0) - XkbLC_Default + XkbLC_Default Default member of class (1L<<1) - XkbLC_Partial + XkbLC_Partial Partial component (1L<<2) @@ -488,31 +483,31 @@ XkbLC_AlternateGroup Symbols - XkbLC_AlphanumericKeys + XkbLC_AlphanumericKeys Bindings primarily for alphanumeric keyboard section (1L<<8) - XkbLC_ModifierKeys + XkbLC_ModifierKeys Bindings primarily for modifier keys (1L<<9) - XkbLC_KeypadKeys + XkbLC_KeypadKeys Bindings primarily for numeric keypad keys (1L<<10) - XkbLC_FunctionKeys + XkbLC_FunctionKeys Bindings primarily for function keys (1L<<11) - XkbLC_AlternateGroup + XkbLC_AlternateGroup Bindings for an alternate group (1L<<12) @@ -547,189 +542,179 @@ specific device, in which case the behavior of the device changes accordingly. To build a new keyboard description from a set of named components, and to optionally have the server use the resulting description to replace an active -one, use -XkbGetKeyboardByName -. +one, use +XkbGetKeyboardByName. - - - - - - - -XkbDescPtr -XkbGetKeyboardByName -( -dpy -, -device_spec -, -names -, -want -, -need -, -load -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -XkbComponentNamesPtr -names -; /* names of components to fetch */ - - - - -unsigned int -want -; /* desired structures in returned record */ - - - - -unsigned int -need -; /* mandatory structures in returned record */ - - - - -Bool -load -; /* -True - => load into -device_spec - */ - - - - - +XkbGetKeyboardByName + + + XkbDescPtr XkbGetKeyboardByName + + + Display *dpy + unsigned int device_spec + XkbComponentNamesPtr names + unsigned int want + unsigned int need + Bool load + + + + + + dpy + + + + connection to X server + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + names + + + + names of components to fetch + + + + + + want + + + + desired structures in returned record + + + + + + need + + + + mandatory structures in returned record + + + + + + load + + + + True ⇒ load into device_spec + + + + - -names - contains a set of expressions describing the keyboard components the server -should use to build the new keyboard description. -want - and -need - are bit fields describing the parts of the resulting keyboard description that -should be present in the returned -XkbDescRec -. +names +contains a set of expressions describing the keyboard components the server +should use to build the new keyboard description. +want +and +need +are bit fields describing the parts of the resulting keyboard description that +should be present in the returned +XkbDescRec. -The individual fields in -names - are -component expressions - composed of keyboard component names (no wildcarding as may be used in - -XkbListComponents -), the special component name symbol ‘%’, and the special operator -characters ‘ -+ -’ and ‘ -| -’. A component expression is parsed left to right, as follows: +The individual fields in +names +are +component expressions +composed of keyboard component names (no wildcarding as may be used in +XkbListComponents), +the special component name symbol ‘%’, +and the special operator characters +‘+’ and ‘|’. +A component expression is parsed left to right, as follows: -The special component name " -computed -" may be used in -keycodes - component expressions and refers to a component consisting of a set of +The special component name “computed” +may be used in +keycodes +component expressions and refers to a component consisting of a set of keycodes computed automatically by the server as needed. -The special component name " -canonical -" may be used in -types - component expressions and refers to a partial component defining the four -standard key types: -ALPHABETIC -, -ONE_LEVEL -, -TWO_LEVEL -, and -KEYPAD -. - +The special component name “canonical” may be used in +types +component expressions and refers to a partial component defining the four +standard key types: +ALPHABETIC, +ONE_LEVEL, +TWO_LEVEL, +and +KEYPAD. + -The special component name ‘ -% -’ refers to the keyboard description for the device specified in -device_spec - or the keymap names component. If a keymap names component is specified that -does not begin with ‘+’ or ‘|’ and does not contain ‘ -% -’, then ‘ -% -’ refers to the description generated by the keymap names component. -Otherwise, it refers to the keyboard description for -device_spec -. - +The special component name ‘%’ +refers to the keyboard description for the device specified in +device_spec +or the keymap names component. If a keymap names component is specified that +does not begin with +‘+’ or ‘|’ and does not contain +‘%’, then ‘%’ +refers to the description generated by the keymap names component. +Otherwise, it refers to the keyboard description for +device_spec. + -The ‘ -+ -’ operator specifies that the following component should -override - the currently assembled description; any definitions that are present in both +The ‘+’ +operator specifies that the following component should +override +the currently assembled description; any definitions that are present in both components are taken from the second. -The ‘ -| -’ operator specifies that the next specified component should -augment - the currently assembled description; any definitions that are present in both +The ‘|’ +operator specifies that the next specified component should +augment +the currently assembled description; any definitions that are present in both components are taken from the first. -If the component expression begins with an operator, a leading ‘ -% -’ is implied. +If the component expression begins with an operator, a leading +‘%’ is implied. @@ -741,9 +726,9 @@ entire expression is invalid and is ignored. -For example, if -names->symbols - contained the expression "+de", it specifies that the default member of the +For example, if +names->symbols +contained the expression "+de", it specifies that the default member of the "de" class of symbols should be applied to the current keyboard mapping, overriding any existing definitions (it could also be written "+de(default)"). @@ -753,14 +738,14 @@ overriding any existing definitions (it could also be written "+de(default)"). Here is a slightly more involved example: the expression "acme(ascii)+de(basic)|iso9995-3" constructs a German (de) mapping for the ASCII keyboard supplied by the "acme" vendor. The new definition begins with -the symbols for the ASCII keyboard for Acme ( -acme(ascii) -), overrides them with definitions for the basic German keyboard ( -de(basic) -), and then applies the definitions from the default iso9995-3 keyboard -( -iso9995-3 -) to any undefined keys or groups of keys (part three of the iso9995 standard +the symbols for the ASCII keyboard for Acme +(acme(ascii)), +overrides them with definitions for the basic German keyboard +(de(basic)), +and then applies the definitions from the default iso9995-3 keyboard +( +iso9995-3) +to any undefined keys or groups of keys (part three of the iso9995 standard defines a common set of bindings for the secondary group, but allows national layouts to override those definitions where necessary). @@ -770,74 +755,69 @@ de, basic, iso9995-3) is not defined by Xkb; only the operations and their ordering are. -Note that the presence of a keymap -names - component that does not contain ‘ -% -’ (either explicit or implied by virtue of an expression starting with an +Note that the presence of a keymap +names +component that does not contain +‘%’ +(either explicit or implied by virtue of an expression starting with an operator) indicates a description that is independent of the keyboard -description for the device specified in -device_spec -. The same is true of requests in which the keymap names component is empty and +description for the device specified in +device_spec. +The same is true of requests in which the keymap names component is empty and all five other names components contain expressions void of references to -‘ -% -’. Requests of this form allow you to deal with keyboard definitions +‘%’. +Requests of this form allow you to deal with keyboard definitions independent of any actual device. -The server parses all non- -NULL - fields in -names - and uses them to build a keyboard description. However, before parsing the -expressions in -names -, the server ORs the bits in -want - and -need - together and examines the result in relationship to the expressions in - -names -. Table 20.3 identifies the components that are required for each of the -possible bits in -want - or -need -. If a required component has not been specified in the -names - structure (the corresponding field is -NULL -), the server substitutes the expression " -% -", resulting in the component values being taken from -device_spec -. In addition, if -load - is -True -, the server modifies -names - if necessary (again using a " -% -" entry) to ensure all of the following fields are non- -NULL -: -types -, -keycodes -, -symbols -, and -compat -. - +The server parses all non- +NULL +fields in +names +and uses them to build a keyboard description. However, before parsing the +expressions in +names, +the server ORs the bits in +want +and +need +together and examines the result in relationship to the expressions in +names. +Table 20.3 +identifies the components that are required for each of the +possible bits in +want +or +need. +If a required component has not been specified in the +names +structure (the corresponding field is +NULL), +the server substitutes the expression +“%”, +resulting in the component values being taken from +device_spec. +In addition, if +load +is +True, +the server modifies +names +if necessary (again using a +“%” +entry) to ensure all of the following fields are non- +NULL: + +types, +keycodes, +symbols, +and +compat. -
+
Want and Need Mask Bits and Required Names Components @@ -853,52 +833,52 @@ compat - XkbGBN_TypesMask + XkbGBN_TypesMask Types (1L<<0) - XkbGBN_CompatMapMask + XkbGBN_CompatMapMask Compat (1L<<1) - XkbGBN_ClientSymbolsMask + XkbGBN_ClientSymbolsMask Types + Symbols + Keycodes (1L<<2) - XkbGBN_ServerSymbolsMask + XkbGBN_ServerSymbolsMask Types + Symbols + Keycodes (1L<<3) - XkbGBN_SymbolsMask + XkbGBN_SymbolsMask Symbols (1L<<1) - XkbGBN_IndicatorMapMask + XkbGBN_IndicatorMapMask Compat (1L<<4) - XkbGBN_KeyNamesMask + XkbGBN_KeyNamesMask Keycodes (1L<<5) - XkbGBN_GeometryMask + XkbGBN_GeometryMask Geometry (1L<<6) - XkbGBN_OtherNamesMask + XkbGBN_OtherNamesMask Types + Symbols + Keycodes + Compat + Geometry (1L<<7) - XkbGBN_AllComponentsMask + XkbGBN_AllComponentsMask (0xff) @@ -907,67 +887,63 @@ compat
- -need - specifies a set of keyboard components that the server must be able to resolve -in order for -XkbGetKeyboardByName - to succeed; if any of the components specified in -need - cannot be successfully resolved, -XkbGetKeyboardByName - fails. +need +specifies a set of keyboard components that the server must be able to resolve +in order for +XkbGetKeyboardByName +to succeed; if any of the components specified in +need +cannot be successfully resolved, +XkbGetKeyboardByName +fails. - -want - specifies a set of keyboard components that the server should attempt to +want +specifies a set of keyboard components that the server should attempt to resolve, but that are not mandatory. If the server is unable to resolve any of -these components, -XkbGetKeyboardByName - still succeeds. Bits specified in -want - that are also specified in -need - have no effect in the context of -want -. +these components, +XkbGetKeyboardByName +still succeeds. Bits specified in +want +that are also specified in +need +have no effect in the context of +want. -If -load - is -True -, the server updates its keyboard description for -device_spec - to match the result of the keyboard description just built. If load is - -False -, the server’s description for device -device_spec - is not updated. In all cases, the parts specified by -want - and -need - from the just-built keyboard description are returned. +If +load +is +True, +the server updates its keyboard description for +device_spec +to match the result of the keyboard description just built. If load is +False, +the server’s description for device +device_spec +is not updated. In all cases, the parts specified by +want +and +need +from the just-built keyboard description are returned. -The -names - structure in an -XkbDescRec - keyboard description record (see Chapter 18) contains one field for each of +The +names +structure in an +XkbDescRec +keyboard description record (see ) contains one field for each of the five component types used to build a keyboard description. When a keyboard description is built from a set of database components, the corresponding -fields in this -names - structure are set to match the expressions used to build the component. +fields in this +names +structure are set to match the expressions used to build the component. @@ -977,24 +953,26 @@ database of components and returning all or part of it is diagrammed in Figure 20.1: - - - - Building a New Keyboard Description from the Server Database - +
+ Building a New Keyboard Description from the Server Database + + + + +
-The information returned to the client in the -XkbDescRec - is essentially the result of a series of calls to extract information from a +The information returned to the client in the +XkbDescRec +is essentially the result of a series of calls to extract information from a fictitious device whose description matches the one just built. The calls -corresponding to each of the mask bits are summarized in Table 20.4, together -with the -XkbDescRec - components that are filled in. +corresponding to each of the mask bits are summarized in +Table 20.4, together with the +XkbDescRec +components that are filled in. - +
XkbDescRec Components Returned for Values of Want & Needs @@ -1010,17 +988,17 @@ XkbDescRec - XkbGBN_TypesMask + XkbGBN_TypesMask map.types XkbGetUpdatedMap(dpy, XkbTypesMask, Xkb) - XkbGBN_ServerSymbolsMask + XkbGBN_ServerSymbolsMask server XkbGetUpdatedMap(dpy, XkbAllClientInfoMask, Xkb) - XkbGBN_ClientSymbolsMask + XkbGBN_ClientSymbolsMask map, including map.types XkbGetUpdatedMap(dpy, XkbAllServerInfoMask, Xkb) @@ -1030,17 +1008,17 @@ XkbDescRecXkbGetIndicatorMap(dpy, XkbAllIndicators, Xkb) - XkbGBN_CompatMapMask + XkbGBN_CompatMapMask compat XkbGetCompatMap(dpy, XkbAllCompatMask, Xkb) - XkbGBN_GeometryMask + XkbGBN_GeometryMask geom XkbGetGeometry(dpy, Xkb) - XkbGBN_KeyNamesMask + XkbGBN_KeyNamesMask names.keys names.key_aliases @@ -1050,7 +1028,7 @@ XkbGetNames(dpy, XkbKeyNamesMask | XkbKeyAliasesMask, Xkb) - XkbGBN_OtherNamesMask + XkbGBN_OtherNamesMask names.keycodes names.geometry @@ -1075,37 +1053,35 @@ XkbGetNames(dpy, XkbKeyNamesMask | XkbKeyAliasesMask, Xkb)
-There is no way to determine which components specified in -want - (but not in -need -) were actually fetched, other than breaking the call into successive calls to - -XkbGetKeyboardByName - and specifying individual components. +There is no way to determine which components specified in +want +(but not in +need) +were actually fetched, other than breaking the call into successive calls to +XkbGetKeyboardByName +and specifying individual components. - -XkbGetKeyboardByName - always sets -min_key_code - and -max_key_code - in the returned -XkbDescRec - structure. +XkbGetKeyboardByName +always sets +min_key_code +and +max_key_code +in the returned +XkbDescRec +structure. -XkbGetKeyboardByName +XkbGetKeyboardByName is synchronous; it sends the request to the server to build a new keyboard description and waits for the reply. If successful, the return value is -non-NULL. -XkbGetKeyboardByName -generates a BadMatch +non-NULL. +XkbGetKeyboardByName +generates a BadMatch protocol error if errors are encountered when building the keyboard description. @@ -1114,82 +1090,78 @@ description. If you simply want to obtain information about the current keyboard device, rather than generating a new keyboard description from elements in the server -database, use -XkbGetKeyboard - (see section 6.2). +database, use +XkbGetKeyboard +(see section 6.2). - - - - - - - -XkbDescPtr -XkbGetKeyboard -( -dpy -, -which -, -device_spec -) - - - - -Display * - dpy -; /* connection to X server */ - - - - -unsigned int - which -; /* mask of components of -XkbDescRec - of interest */ - - - - -unsigned int - device_spec -; /* device ID */ - - - - - +XkbGetKeyboard + + + XkbDescPtr XkbGetKeyboard + + + Display *dpy + unsigned int which + unsigned int device_spec + + + + + + dpy + + + + connection to X server + + + + + + which + + + + mask of components of XkbDescRec of interest + + + + + + device_spec + + + + device ID + + + + - -XkbGetKeyboard - is used to read the current description for one or more components of a -keyboard device. It calls -XkbGetKeyboardByName - as follows: +XkbGetKeyboard +is used to read the current description for one or more components of a +keyboard device. It calls +XkbGetKeyboardByName +as follows: - -XkbGetKeyboardByName -( -dpy -, -device_spec -, -NULL -, -which -, -which -, -False -). +XkbGetKeyboardByName +( +dpy, +device_spec, +NULL, +which, +which, +False). + diff --git a/libX11/specs/XKB/ch21.xml b/libX11/specs/XKB/ch21.xml index 7b2c653ba..7d122d92b 100644 --- a/libX11/specs/XKB/ch21.xml +++ b/libX11/specs/XKB/ch21.xml @@ -1,3 +1,6 @@ + + Attaching Xkb Actions to X Input Extension Devices @@ -10,8 +13,8 @@ input extension. Other types of devices supported by the input extension include, but are not limited to: mice, tablets, touchscreens, barcode readers, button boxes, trackballs, identifier devices, data gloves, and eye trackers. Xkb provides additional control over all X input extension devices, whether -they are KeyClass - devices or not, as well as the core keyboard and pointer. +they are KeyClass +devices or not, as well as the core keyboard and pointer. @@ -58,16 +61,16 @@ the following additional access is provided: -If allowed, Xkb functionality for additional -KeyClass - devices supported by the input extension is accessed via those same functions. +If allowed, Xkb functionality for additional +KeyClass +devices supported by the input extension is accessed via those same functions. -If allowed, Xkb functionality for non- -KeyClass - devices supported by the input extension is also accessed via the +If allowed, Xkb functionality for non- +KeyClass +devices supported by the input extension is also accessed via the XkbGetDeviceInfo and XkbSetDeviceInfo functions described in this chapter. @@ -76,11 +79,11 @@ XkbGetDeviceInfo and XkbSetDeviceInfo functions described in this chapter. Each device has an X Input Extension device ID. Each device may have several classes of feedback. For example, there are two types of feedbacks that can -generate bells: bell feedback and keyboard feedback ( -BellFeedbackClass - and -KbdFeedbackClass -). A device can have more than one feedback of each type; the feedback ID +generate bells: bell feedback and keyboard feedback +(BellFeedbackClass +and +KbdFeedbackClass). +A device can have more than one feedback of each type; the feedback ID identifies the particular feedback within its class. @@ -123,109 +126,107 @@ Up to 32 LEDs If the input extension is present and the server allows interaction between the input extension and Xkb, then the core keyboard, the core keyboard indicators, and the core keyboard bells may each be addressed using an appropriate device -spec, class, and ID. The constant -XkbXIDfltID - may be used as the device ID to specify the core keyboard indicators for the +spec, class, and ID. The constant +XkbDfltXIId +may be used as the device ID to specify the core keyboard indicators for the core indicator feedback. The particular device ID corresponding to the core keyboard feedback and the core indicator feedback may be obtained by calling - -XkbGetDeviceInfo - and specifying -XkbUseCoreKbd - as the -device_spec -; the values will be returned in -dflt_kbd_id - and -dflt_led_id -. - - - - -If the server does not allow Xkb access to input extension -KeyClass - devices, attempts to use Xkb requests with those devices fail with a -Bad -Keyboard - error. Attempts to access non- -KeyClass - input extension devices via XkbGetDeviceInfo and XkbSetDeviceInfo fail +XkbGetDeviceInfo +and specifying +XkbUseCoreKbd +as the +device_spec; +the values will be returned in +dflt_kbd_fb +and +dflt_led_fb. + + + + +If the server does not allow Xkb access to input extension +KeyClass +devices, attempts to use Xkb requests with those devices fail with a +BadKeyboard +error. Attempts to access non- +KeyClass +input extension devices via XkbGetDeviceInfo and XkbSetDeviceInfo fail silently if Xkb access to those devices is not supported by the X server. XkbDeviceInfoRec + +XkbDeviceInfoRec + +XkbDeviceLedInfoRec Information about X Input Extension devices is transferred between a client -program and the Xkb extension in an -XkbDeviceInfoRec - structure: - +program and the Xkb extension in an +XkbDeviceInfoRec +structure: - + typedef struct { - char * name; /* name for device */ - Atom type; /* name for class of devices */ - unsigned short device_spec; /* device of interest */ - Bool has_own_state; /* True =>this - device has its own state */ - unsigned short supported; /* bits indicating supported capabilities */ - unsigned short unsupported; /* bits indicating unsupported capabilities */ - unsigned short num_btns; /* number of entries in btn_acts */ - XkbAction * btn_acts; /* button actions */ - unsigned short sz_leds; /* total number of entries in LEDs vector */ - unsigned short num_leds; /* number of valid entries in LEDs vector */ - unsigned short dflt_kbd_fb; /* input extension ID of default (core kbd) indicator */ - unsigned short dflt_led_fb; /* input extension ID of default indicator feedback */ - XkbDeviceLedInfoPtr leds; /* LED descriptions */ -} XkbDeviceInfoRec, *XkbDeviceInfoPtr; - + char * name; /* name for device */ + Atom type; /* name for class of devices */ + unsigned short device_spec; /* device of interest */ + Bool has_own_state; /* True ⇒ this device has + its own state */ + unsigned short supported; /* bits indicating supported capabilities */ + unsigned short unsupported; /* bits indicating unsupported capabilities */ + unsigned short num_btns; /* number of entries in btn_acts */ + XkbAction * btn_acts; /* button actions */ + unsigned short sz_leds; /* total number of entries in LEDs vector */ + unsigned short num_leds; /* number of valid entries in LEDs vector */ + unsigned short dflt_kbd_fb; /* input extension ID of default + (core kbd) indicator */ + unsigned short dflt_led_fb; /* input extension ID of default + indicator feedback */ + XkbDeviceLedInfoPtr leds; /* LED descriptions */ +} XkbDeviceInfoRec, *XkbDeviceInfoPtr; - typedef struct { - unsigned short led_class; /* class for this LED device*/ - unsigned short led_id; /* ID for this LED device */ - unsigned int phys_indicators; /* bits for which LEDs physically - present */ - unsigned int maps_present; /* bits for which LEDs have maps in - maps */ - unsigned int names_present; /* bits for which LEDs are in - names */ - unsigned int state; /* 1 bit => corresponding LED is on */ - Atom names[XkbNumIndicators]; /* names for LEDs */ - XkbIndicatorMapRec maps; /* indicator maps for each LED */ -} XkbDeviceLedInfoRec, *XkbDeviceLedInfoPtr; + unsigned short led_class; /* class for this LED device */ + unsigned short led_id; /* ID for this LED device */ + unsigned int phys_indicators; /* bits for which LEDs physically present */ + unsigned int maps_present; /* bits for which LEDs have maps in maps */ + unsigned int names_present; /* bits for which LEDs are in names */ + unsigned int state; /* 1 bit ⇒ corresponding LED is on */ + Atom names[XkbNumIndicators]; /* names for LEDs */ + XkbIndicatorMapRec maps; /* indicator maps for each LED */ +} XkbDeviceLedInfoRec, *XkbDeviceLedInfoPtr; -The -type - field is a registered symbolic name for a class of devices (for example, -"TABLET"). If a device is a keyboard (that is, is a member of -KeyClass -), it has its own state, and -has_own_state - is -True -. If -has_own_state - is -False -, the state of the core keyboard is used. The -supported - and -unsupported - fields are masks where each bit indicates a capability. The meaning of the -mask bits is listed in Table 21.1, together with the fields in the -XkbDeviceInfoRec - structure that are associated with the capability represented by each bit. The +The +type +field is a registered symbolic name for a class of devices (for example, +"TABLET"). If a device is a keyboard (that is, is a member of +KeyClass), +it has its own state, and +has_own_state +is +True. +If +has_own_state +is +False, +the state of the core keyboard is used. The +supported +and +unsupported +fields are masks where each bit indicates a capability. The meaning of the +mask bits is listed in Table 21.1, +together with the fields in the +XkbDeviceInfoRec +structure that are associated with the capability represented by each bit. The same bits are used to indicate the specific information desired in many of the functions described subsequently in this section. - +
XkbDeviceInfoRec Mask Bits @@ -243,60 +244,60 @@ functions described subsequently in this section. - XkbXI_KeyboardsMask + XkbXI_KeyboardsMask (1L << 0) Clients can use all Xkb requests and events with -KeyClass +KeyClass devices supported by the input device extension. - XkbXI_ButtonActionsMask + XkbXI_ButtonActionsMask num_btns btn_acts (1L <<1) -Clients can assign key actions to buttons on non- -KeyClass +Clients can assign key actions to buttons on non- +KeyClass input extension devices. - XkbXI_IndicatorNamesMask + XkbXI_IndicatorNamesMask leds->names (1L <<2) -Clients can assign names to indicators on non- -KeyClass - input extension devices. +Clients can assign names to indicators on non- +KeyClass +input extension devices. - XkbXI_IndicatorMapsMask + XkbXI_IndicatorMapsMask leds->maps (1L <<3) -Clients can assign indicator maps to indicators on non- -KeyClass - input extension devices. +Clients can assign indicator maps to indicators on non- +KeyClass +input extension devices. - XkbXI_IndicatorStateMask + XkbXI_IndicatorStateMask leds->state (1L <<4) -Clients can request the status of indicators on non- -KeyClass - input extension devices. +Clients can request the status of indicators on non- +KeyClass +input extension devices. - XkbXI_IndicatorsMask + XkbXI_IndicatorsMask sz_leds num_leds @@ -304,42 +305,42 @@ KeyClass (0x1c) -XkbXI_IndicatorNames­Mask | -XkbXI_IndicatorMaps­Mask | -XkbXI_IndicatorState­Mask +XkbXI_IndicatorNames­Mask | +XkbXI_IndicatorMaps­Mask | +XkbXI_IndicatorState­Mask - XkbXI_UnsupportedFeaturesMask + XkbXI_UnsupportedFeaturesMask unsupported (1L <<15) - XkbXI_AllDeviceFeaturesMask + XkbXI_AllDeviceFeaturesMask Those selected by Value column masks (0x1e) -XkbXI_Indicators­Mask | -XkbSI_ButtonActions­Mask +XkbXI_Indicators­Mask | +XkbXI_ButtonActions­Mask - XkbXI_AllFeaturesMask + XkbXI_AllFeaturesMask Those selected by Value column masks (0x1f) -XkbSI_AllDevice­FeaturesMask | -XkbSI_Keyboards­Mask +XkbXI_AllDevice­FeaturesMask | +XkbXI_Keyboards­Mask - XkbXI_AllDetailsMask + XkbXI_AllDetailsMask Those selected by Value column masks (0x801f) -XkbXI_AllFeatures­Mask | -XkbXI_Unsupported­FeaturesMask +XkbXI_AllFeatures­Mask | +XkbXI_Unsupported­FeaturesMask @@ -347,20 +348,17 @@ KeyClass
-The -name -, -type -, -has_own_state -, -supported -, and -unsupported - fields are always filled in when a valid reply is returned from the server -involving an -XkbDeviceInfoRec -. All of the other fields are modified only if the particular function asks for +The +name, +type, +has_own_state, +supported, +and +unsupported +fields are always filled in when a valid reply is returned from the server +involving an +XkbDeviceInfoRec. +All of the other fields are modified only if the particular function asks for them. @@ -371,235 +369,242 @@ them. To determine whether the X server allows Xkb access to particular capabilities of input devices other than the core X keyboard, or to determine the status of -indicator maps, indicator names or button actions on a non- -KeyClass - extension device, use XkbGetDeviceInfo. - - - - - - - - - -XkbDeviceInfoPtr -XkbGetDeviceInfo -( -dpy -, which, device_spec, ind_class, ind_id) - - - - -Display * -dpy -; /* connection to X server */ - - - - -unsigned int which; /* mask indicating information to -return */ - - - - -unsigned int -device_spec -; /* device ID, or -XkbUseCoreKbd - */ - - - - -unsigned int -ind_class -; /* feedback class for indicator requests */ - - - - -unsigned int -ind_id -; /* feedback ID for indicator requests */ - - - - - - - - -XkbGetDeviceInfo - returns information about the input device specified by -device_spec -. Unlike the -device_spec - parameter of most Xkb functions, -device_spec - does not need to be a keyboard device. It must, however, indicate either the +indicator maps, indicator names or button actions on a non- +KeyClass +extension device, use XkbGetDeviceInfo. + + +XkbGetDeviceInfo + + + XkbDeviceInfoPtr XkbGetDeviceInfo + + + Display *dpy + unsigned int which + unsigned int device_spec + unsigned int ind_class + unsigned int ind_id + + + + + + dpy + + + + connection to X server + + + + + + which + + + + mask indicating information to return + + + + + + device_spec + + + + device ID, or XkbUseCoreKbd + + + + + + ind_class + + + + feedback class for indicator requests + + + + + + ind_id + + + + feedback ID for indicator requests + + + + + + +XkbGetDeviceInfo +returns information about the input device specified by +device_spec. +Unlike the +device_spec +parameter of most Xkb functions, +device_spec +does not need to be a keyboard device. It must, however, indicate either the core keyboard or a valid X Input Extension device. -The -which -parameter - +The +which +parameter is a mask specifying optional information to be returned. It is an inclusive OR -of one or more of the values from Table 21.1 and causes the returned -XkbDeviceInfoRec - to contain values for the corresponding fields specified in the table. +of one or more of the values from Table 21.1 +and causes the returned +XkbDeviceInfoRec +to contain values for the corresponding fields specified in the table. -The -XkbDeviceInfoRec - returned by -XkbGetDeviceInfo - always has values for -name - (may be a null string, ""), -type -, -supported -, -unsupported -, -has_own_state -, -dflt_kbd_fd -, and -dflt_kbd_fb -. Other fields are filled in as specified by -which -. +The +XkbDeviceInfoRec +returned by +XkbGetDeviceInfo +always has values for +name +(may be a null string, ""), +type, +supported, +unsupported, +has_own_state, +dflt_kbd_fb, +and +dflt_led_fb. +Other fields are filled in as specified by +which. -Upon return, the -supported - field will be set to the inclusive OR of zero or more bits from Table 21.1; +Upon return, the +supported +field will be set to the inclusive OR of zero or more bits from +Table 21.1; each bit set indicates an optional Xkb extension device feature supported by the server implementation, and a client may modify the associated behavior. -If the -XkbButtonActionsMask - bit is set in -which -, the -XkbDeviceInfoRec - returned will have the button actions ( -btn_acts - field) filled in for all buttons. +If the +XkbXI_ButtonActionsMask +bit is set in +which, +the +XkbDeviceInfoRec +returned will have the button actions +(btn_acts +field) filled in for all buttons. -If -which - includes one of the bits in XkbXI_IndicatorsMask, the feedback class of the +If +which +includes one of the bits in XkbXI_IndicatorsMask, +the feedback class of the indicators must be specified in ind_class, and the feedback ID of the indicators must be specified in ind_id. If the request does not include any of -the bits in XkbXI_IndicatorsMask, the ind_class and ind_id parameters are +the bits in XkbXI_IndicatorsMask, +the ind_class and ind_id parameters are ignored. The class and ID can be obtained via the input device extension XListInputDevices request. -If any of the -XkbXI_IndicatorsMask - bits are set in -which -, the -XkbDeviceInfoRec - returned will have filled in the portions of the -leds - structure corresponding to the indicator feedback identified by -ind_class - and -ind_id -. The -leds - vector of the -XkbDeviceInfoRec - is allocated if necessary and -sz_leds - and -num_leds - filled in. The -led_class -, -led_id - and -phys_indicators - fields of the -leds - entry corresponding to -ind_class - and -ind_id - are always filled in. If -which - contains -XkbXI_IndicatorNamesMask -, the -names_present - and -names - fields of the -leds - structure corresponding to -ind_class - and -ind_id - are returned. - -If -which - contains -XkbXI_IndicatorStateMask - -, - the corresponding -state - field is updated. If -which - contains -XkbXI_IndicatorMapsMask -, the -maps_present - and -maps - fields are updated. +If any of the +XkbXI_IndicatorsMask +bits are set in +which, +the +XkbDeviceInfoRec +returned will have filled in the portions of the +leds +structure corresponding to the indicator feedback identified by +ind_class +and +ind_id. +The +leds +vector of the +XkbDeviceInfoRec +is allocated if necessary and +sz_leds +and +num_leds +filled in. The +led_class, +led_id +and +phys_indicators +fields of the +leds +entry corresponding to +ind_class +and +ind_id +are always filled in. If +which +contains +XkbXI_IndicatorNamesMask, +the +names_present +and +names +fields of the +leds +structure corresponding to +ind_class +and +ind_id +are returned. +If +which +contains +XkbXI_IndicatorStateMask, +the corresponding +state +field is updated. If +which +contains +XkbXI_IndicatorMapsMask, +the +maps_present +and +maps +fields are updated. Xkb provides convenience functions to request subsets of the information -available via -XkbGetDeviceInfo -. These convenience functions mirror some of the mask bits. The functions all -take an -XkbDeviceInfoPtr - as an input argument and operate on the X Input Extension device specified by -the -device_spec - field of the structure. Only the parts of the structure indicated in the -function description are updated. The -XkbDeviceInfo -Rec structure used in the function call can be obtained by calling -XkbGetDeviceInfo or can be allocated by calling XkbAllocDeviceInfo (see section -21.3). +available via +XkbGetDeviceInfo. +These convenience functions mirror some of the mask bits. The functions all +take an +XkbDeviceInfoPtr +as an input argument and operate on the X Input Extension device specified by +the +device_spec +field of the structure. Only the parts of the structure indicated in the +function description are updated. The +XkbDeviceInfoRec +structure used in the function call can be obtained by calling +XkbGetDeviceInfo or can be allocated by calling XkbAllocDeviceInfo +(see section 21.3). @@ -614,131 +619,137 @@ XkbGetDeviceButtonActions. - - - - - - - -Status -XkbGetDeviceButtonActions -( -dpy, device_info, all_buttons, first_button, num_buttons -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -XkbDeviceInfoPtr device_info; /* structure to update with -results */ - - - - -Bool -all_buttons -; /* -True - => get information for all buttons */ - - - - -unsigned int first_button; /* number of first button for -which info is desired */ - - - - -unsigned int num_buttons; /* number of buttons for which -info is desired */ - - - - - - - - -XkbGetDeviceButtonActions - queries the server for the desired button information for the device indicated -by the -device_spec - field of -device_info - and waits for a reply. If successful, - XkbGetDeviceButtonActions - backfills the button actions ( -btn_acts - field of -device_info -) for only the requested buttons, updates the -name -, -type -, -supported -, and -unsupported - fields, and returns -Success -. - - - - - -all_buttons -, -first_button - and -num_buttons - specify the device buttons for which actions should be returned. Setting - -all_buttons - to -True - requests actions for all device buttons; if -all_buttons - is -False -, -first_button - and -num_buttons - specify a range of buttons for which actions are requested. +XkbGetDeviceButtonActions + + + Status XkbGetDeviceButtonActions + + + Display *dpy + XkbDeviceInfoPtr device_info + Bool all_buttons + unsigned int first_button + unsigned int num_buttons + + + + + + dpy + + + + connection to X server + + + + + + device_info + + + + structure to update with results + + + + + + all_buttons + + + + True ⇒ get information for all buttons + + + + + + first_button + + + + number of first button for which info is desired + + + + + + num_buttons + + + + number of buttons for which info is desired + + + + + + +XkbGetDeviceButtonActions +queries the server for the desired button information for the device indicated +by the +device_spec +field of +device_info +and waits for a reply. If successful, +XkbGetDeviceButtonActions +backfills the button actions +(btn_acts +field of +device_info) +for only the requested buttons, updates the +name, +type, +supported, +and +unsupported +fields, and returns +Success. + + + + +all_buttons, +first_button +and +num_buttons +specify the device buttons for which actions should be returned. Setting +all_buttons +to +True +requests actions for all device buttons; if +all_buttons +is +False, +first_button +and +num_buttons +specify a range of buttons for which actions are requested. If a compatible version of Xkb is not available in the server or the Xkb extension has not been properly initialized, XkbGetDeviceButtonActions returns - -BadAccess -. If allocation errors occur, a -BadAlloc - status is returned. If the specified device ( -device_info --> -device_spec -) is invalid, a BadKeyboard status is returned. If the device has no buttons, a -Bad -Match - status is returned. If -first_button - and -num_buttons - specify illegal buttons, a Bad -Value - status is returned. +BadAccess. +If allocation errors occur, a +BadAlloc +status is returned. If the specified device +(device_info->device_spec) +is invalid, a +BadKeyboard +status is returned. If the device has no buttons, a +BadMatch +status is returned. If +first_button +and +num_buttons +specify illegal buttons, a +BadValue +status is returned. @@ -748,181 +759,192 @@ of an input extension device, use XkbGetDeviceLedInfo. - - - - - - - -Status -XkbGetDeviceLedInfo -( -dpy, device_i -nfo, led_class, led_id, which) - - - - -Display * -dpy -; /* connection to X server */ - - - - -XkbDeviceInfoPtr device_info; /* structure to update with -results */ - - - - -unsigned int -led_class -; /* LED feedback class assigned by input extension */ - - - - -unsigned int led_id; /* LED feedback ID assigned by input -extension */ - - - - -unsigned int which; /* mask indicating desired -information */ - - - - - - - - -XkbGetDeviceLedInfo - queries the server for the desired LED information for the feedback specified -by -led_class - and -led_id - for the X input extension device indicated by -device_spec --> -device_info - and waits for a reply. If successful, -XkbGetDeviceLedInfo - backfills the relevant fields of -device_info - as determined by -which - with the results and returns -Success -. Valid values for -which - are the inclusive OR of any of -XkbXI_IndicatorNamesMask -, -XkbXI_IndicatorMapsMask -, and -XkbXI_IndicatorStateMask -. - - - - -The fields of -device_info - that are filled in when this request succeeds are -name, type, supported -, and -unsupported -, and portions of the -leds - structure corresponding to -led_class - and -led_id - as indicated by the bits set in -which -. The -device_info->leds - vector is allocated if necessary and -sz_leds - and -num_leds - filled in. The -led_class -, -led_id - and -phys_indicators - fields of the -device_info --> -leds - entry corresponding to -led_class - and -led_id - are always filled in. - - - - -If -which - contains -XkbXI_IndicatorNamesMask -, the -names_present - and -names - fields of the -device_info --> -leds - structure corresponding to -led_class - and -led_id - are updated, if -which - contains -XkbXI_IndicatorStateMask - -, - the corresponding -state - field is updated, and if -which - contains -XkbXI_IndicatorMapsMask -, the -maps_present - and -maps - fields are updated. +XkbGetDeviceLedInfo + + + Status XkbGetDeviceLedInfo + + + Display *dpy + XkbDeviceInfoPtr device_info + unsigned int led_class + unsigned int led_id + unsigned int which + + + + + + dpy + + + + connection to X server + + + + + + device_info + + + + structure to update with results + + + + + + led_class + + + + LED feedback class assigned by input extension + + + + + + led_id + + + + LED feedback ID assigned by input extension + + + + + + which + + + + mask indicating desired information + + + + + + +XkbGetDeviceLedInfo +queries the server for the desired LED information for the feedback specified +by +led_class +and +led_id +for the X input extension device indicated by +device_spec->device_info +and waits for a reply. If successful, +XkbGetDeviceLedInfo +backfills the relevant fields of +device_info +as determined by +which +with the results and returns +Success. +Valid values for +which +are the inclusive OR of any of +XkbXI_IndicatorNamesMask, +XkbXI_IndicatorMapsMask, +and +XkbXI_IndicatorStateMask. + + + + +The fields of +device_info +that are filled in when this request succeeds are +name, +type, +supported, +and +unsupported, +and portions of the +leds +structure corresponding to +led_class +and +led_id +as indicated by the bits set in +which. +The +device_info->leds +vector is allocated if necessary and +sz_leds +and +num_leds +filled in. The +led_class, +led_id +and +phys_indicators +fields of the +device_info->leds +entry corresponding to +led_class +and +led_id +are always filled in. + + + + +If +which +contains +XkbXI_IndicatorNamesMask, +the +names_present +and +names +fields of the +device_info->leds +structure corresponding to +led_class +and +led_id +are updated, if +which +contains +XkbXI_IndicatorStateMask, +the corresponding +state +field is updated, and if +which +contains +XkbXI_IndicatorMapsMask, +the +maps_present +and +maps +fields are updated. If a compatible version of Xkb is not available in the server or the Xkb -extension has not been properly initialized, -XkbGetDeviceLedInfo - returns -BadAccess -. If allocation errors occur, a BadAlloc status is returned. If the device has -no indicators, a BadMatch error is returned. If -ledClass - or -ledID - have illegal values, a Bad -Value - error is returned. If they have legal values but do not specify a feedback -that contains LEDs and is associated with the specified device, a Bad -Match - error is returned. +extension has not been properly initialized, +XkbGetDeviceLedInfo +returns +BadAccess. +If allocation errors occur, a +BadAlloc +status is returned. If the device has no indicators, a +BadMatch +error is returned. If +ledClass +or +ledID +have illegal values, a +BadValue +error is returned. If they have legal values but do not specify a feedback +that contains LEDs and is associated with the specified device, a +BadMatch +error is returned. @@ -932,396 +954,396 @@ Match Structure -To obtain an -XkbDeviceInfoRec - structure, use XkbGetDeviceInfo or XkbAllocDeviceInfo. - - - - - - - - - -XkbDeviceInfoPtr -XkbAllocDeviceInfo -(device_spec, n_buttons, sz_leds) - - - - -unsigned int device_spec; /* device ID with which -structure will be used */ - - - - -unsigned int -n_buttons -; /* number of button actions to allocate space for*/ - - - - -unsigned int -sz_leds -; /* number of LED feedbacks to allocate space for */ - - - - - - - - -XkbAllocDeviceInfo - allocates space for an -XkbDeviceInfoRec - structure and initializes that structure’s -device_spec - field with the device ID specified by device_spec. If -n_buttons - is nonzero, -n_buttons - -XkbActions - are linked into the -XkbDeviceInfoRec - structure and initialized to zero. If sz_leds is nonzero, -sz_leds - -XkbDeviceLedInfoRec - structures are also allocated and linked into the -XkbDeviceInfoRec - structure. If you request -XkbDeviceLedInfoRec - structures be allocated using this request, you must initialize them +To obtain an +XkbDeviceInfoRec +structure, use XkbGetDeviceInfo or XkbAllocDeviceInfo. + + +XkbAllocDeviceInfo + + + XkbDeviceInfoPtr XkbAllocDeviceInfo + + + unsigned int device_spec + unsigned int n_buttons + unsigned int sz_leds + + + + + + device_spec + + + + device ID with which structure will be used + + + + + + n_buttons + + + + number of button actions to allocate space for + + + + + + sz_leds + + + + number of LED feedbacks to allocate space for + + + + + + +XkbAllocDeviceInfo +allocates space for an +XkbDeviceInfoRec +structure and initializes that structure’s +device_spec +field with the device ID specified by device_spec. If +n_buttons +is nonzero, +n_buttons +XkbActions +are linked into the +XkbDeviceInfoRec +structure and initialized to zero. If sz_leds is nonzero, +sz_leds +XkbDeviceLedInfoRec +structures are also allocated and linked into the +XkbDeviceInfoRec +structure. If you request +XkbDeviceLedInfoRec +structures be allocated using this request, you must initialize them explicitly. -To obtain an -XkbDeviceLedInfoRec - structure, use XkbAllocDeviceLedInfo. - - - - - - - - - - -Status -XkbAllocDeviceLedInfo -(devi, num_needed) - - - - -XkbDeviceInfoPtr -device_info -; /* structure in which to allocate LED space */ - - - - -int -num_needed -; /* number of indicators to allocate space for */ - - - - - - - - -XkbAllocDeviceLedInfo - allocates space for an -XkbDeviceLedInfoRec - and places it in -device_info -. If num_needed is nonzero, -num_needed - -XkbIndicatorMapRec - structures are also allocated and linked into the -XkbDeviceLedInfoRec - structure. If you request -XkbIndicatorMapRec - structures be allocated using this request, you must initialize them +To obtain an +XkbDeviceLedInfoRec +structure, use XkbAllocDeviceLedInfo. + + + +XkbAllocDeviceLedInfo + + + Status XkbAllocDeviceLedInfo + + + XkbDeviceInfoPtr device_info + int num_needed + + + + + + device_info + + + + structure in which to allocate LED space + + + + + + num_needed + + + + number of indicators to allocate space for + + + + + + +XkbAllocDeviceLedInfo +allocates space for an +XkbDeviceLedInfoRec +and places it in +device_info. +If num_needed is nonzero, +num_needed +XkbIndicatorMapRec +structures are also allocated and linked into the +XkbDeviceLedInfoRec +structure. If you request +XkbIndicatorMapRec +structures be allocated using this request, you must initialize them explicitly. All other fields are initialized to zero. -To initialize an -XkbDeviceLedInfoRec - structure, use XkbAddDeviceLedInfo. - - - - - - - - - - -XkbDeviceLedInfoPtr -XkbAddDeviceLedInfo -(device_info, led_class, led_id) - - - - -XkbDeviceInfoPtr device_info; /* structure in which to -add LED info */ - - - - -unsigned int -led_class -; /* input extension class for LED device of interest */ - - - - -unsigned int -led_id -; /* input extension ID for LED device of interest */ - - - - - - - - -XkbAddDeviceLedInfo - first checks to see whether an entry matching -led_class - and -led_id - already exists in the -device_info->leds - array. If it finds a matching entry, it returns a pointer to that entry. -Otherwise, it checks to be sure there is at least one empty entry in -device_info --> -leds - and extends it if there is not enough room. It then increments -device_info --> -num_leds - and fills in the next available entry in -device_info --> -leds - with -led_class - and -led_id -. - - - - -If successful, -XkbAddDeviceLedInfo - returns a pointer to the -XkbDeviceLedInfoRec - structure that was initialized. If unable to allocate sufficient storage, or -if -device_info - points to an invalid -XkbDeviceInfoRec - structure, or if -led_class - or -led_id - are inappropriate, -XkbAddDeviceLedInfo - returns -NULL -. - - - - -To allocate additional space for button actions in an -XkbDeviceInfoRec - structure, use XkbResizeDeviceButtonActions. - - - - - - - - - - -Status -XkbResizeDeviceButtonActions -(device_info, new_total) - - - - -XkbDeviceInfoPtr device_info; /* structure in which to -allocate button actions */ - - - - -unsigned int -new_total -; /* new total number of button actions needed */ - - - - - - - - -XkbResizeDeviceButton - reallocates space, if necessary, to make sure there is room for a total of - -new_total - button actions in the -device_info - structure. Any new entries allocated are zeroed. If successful, -XkbResizeDeviceButton - returns Success. If new_total is zero, all button actions are deleted, - -device_info --> -num_btns - is set to zero, and -device_info --> -btn_acts - is set to -NULL -. If device_info is invalid or new_total is greater than 255, BadValue is -returned. If a memory allocation failure occurs, a -BadAlloc - is returned. - - - - -To free an -XkbDeviceInfoRec - structure, use XkbFreeDeviceInfo. - - - - - - - - - - -void -XkbFreeDeviceInfo -(device_info, which, free_all) - - - - -XkbDeviceInfoPtr device_info; /* pointer to -XkbDeviceInfoRec - in which to free items */ - - - - -unsigned int -which -; /* mask of components of -device_info - to free */ - - - - -Bool -free_all -; /* -True - => free everything, including device_info */ - - - - - - - -If free_all is -True -, the -XkbFreeDeviceInfo - frees all components of -device_info - and the -XkbDeviceInfoRec - structure pointed to by -device_info - itself. If free_all is -False -, the value of which determines which subcomponents are freed. -which -is an inclusive OR of one or more of the values from Table 21.1. If which -contains XkbXI_ButtonActionsMask, all button actions associated with -device_info - are freed, -device_info --> -btn_acts - is set to -NULL -, and -device_info --> -num_btns - is set to zero. If which contains all bits in XkbXI_IndicatorsMask, all - -XkbDeviceLedInfoRec - structures associated with -device_info - are freed, -device_info --> -leds - is set to -NULL -, and -device_info --> -sz_leds - and -device_info --> -num_leds - are set to zero. If which contains XkbXI_IndicatorMapsMask, all indicator maps -associated with -device_info - are cleared, but the number of LEDs and the leds structures themselves are -preserved. If which contains XkbXI_IndicatorNamesMask, all indicator names +To initialize an +XkbDeviceLedInfoRec +structure, use XkbAddDeviceLedInfo. + + + +XkbAddDeviceLedInfo + + + XkbDeviceLedInfoPtr XkbAddDeviceLedInfo + + + XkbDeviceInfoPtr device_info + unsigned int led_class + unsigned int led_id + + + + + + device_info + + + + structure in which to add LED info + + + + + + led_class + + + + input extension class for LED device of interest + + + + + + led_id + + + + input extension ID for LED device of interest + + + + + + +XkbAddDeviceLedInfo +first checks to see whether an entry matching +led_class +and +led_id +already exists in the +device_info->leds +array. If it finds a matching entry, it returns a pointer to that entry. +Otherwise, it checks to be sure there is at least one empty entry in +device_info->leds +and extends it if there is not enough room. It then increments +device_info->num_leds +and fills in the next available entry in +device_info->leds +with +led_class +and +led_id. + + + + +If successful, +XkbAddDeviceLedInfo +returns a pointer to the +XkbDeviceLedInfoRec +structure that was initialized. If unable to allocate sufficient storage, or +if +device_info +points to an invalid +XkbDeviceInfoRec +structure, or if +led_class +or +led_id +are inappropriate, +XkbAddDeviceLedInfo +returns +NULL. + + + + +To allocate additional space for button actions in an +XkbDeviceInfoRec +structure, use XkbResizeDeviceButtonActions. + + + +XkbResizeDeviceButtonActions + + + Status XkbResizeDeviceButtonActions + + + XkbDeviceInfoPtr device_info + unsigned int new_total + + + + + + device_info + + + + structure in which to allocate button actions + + + + + + new_total + + + + new total number of button actions needed + + + + + + +XkbResizeDeviceButtonActions +reallocates space, if necessary, to make sure there is room for a total of +new_total +button actions in the +device_info +structure. Any new entries allocated are zeroed. If successful, +XkbResizeDeviceButtonActions +returns Success. If new_total is zero, all button actions are deleted, +device_info->num_btns +is set to zero, and +device_info->btn_acts +is set to +NULL. +If device_info is invalid or new_total is greater than 255, +BadValue +is returned. If a memory allocation failure occurs, a +BadAlloc +is returned. + + + + +To free an +XkbDeviceInfoRec +structure, use XkbFreeDeviceInfo. + + + +XkbFreeDeviceInfo + + + void XkbFreeDeviceInfo + + + XkbDeviceInfoPtr device_info + unsigned int which + Bool free_all + + + + + + device_info + + + + pointer to XkbDeviceInfoRec in which to free items + + + + + + which + + + + mask of components of device_info to free + + + + + + free_all + + + + True ⇒ free everything, including device_info + + + + + + +If free_all is +True, +the +XkbFreeDeviceInfo +frees all components of +device_info +and the +XkbDeviceInfoRec +structure pointed to by +device_info +itself. If free_all is +False, +the value of which determines which subcomponents are freed. +which +is an inclusive OR of one or more of the values from +Table 21.1. If which +contains XkbXI_ButtonActionsMask, +all button actions associated with +device_info +are freed, +device_info->btn_acts +is set to +NULL, +and +device_info->num_btns +is set to zero. If which contains all bits in +XkbXI_IndicatorsMask, all +XkbDeviceLedInfoRec +structures associated with +device_info +are freed, +device_info->leds +is set to +NULL, +and +device_info->sz_leds +and +device_info->num_leds +are set to zero. If which contains XkbXI_IndicatorMapsMask, +all indicator maps associated with +device_info +are cleared, but the number of LEDs and the leds structures themselves are +preserved. If which contains XkbXI_IndicatorNamesMask, +all indicator names associated with device_info are cleared, but the number of LEDs and the leds structures themselves are preserved. If which contains -XkbXI_IndicatorStateMask, the indicator state associated with the -device_info - leds are set to zeros but the number of LEDs and the leds structures +XkbXI_IndicatorStateMask, +the indicator state associated with the +device_info +leds are set to zeros but the number of LEDs and the leds structures themselves are preserved. @@ -1349,13 +1371,13 @@ core X keyboard. Xkb implementations are required to support key actions for the buttons of the core pointer device, but support for actions on extension devices is optional. Implementations that do not support button actions for extension devices must -not set the -XkbXI_ButtonActionsMask - bit in the -supported - field of an -XkbDeviceInfoRec - structure. +not set the +XkbXI_ButtonActionsMask +bit in the +supported +field of an +XkbDeviceInfoRec +structure. @@ -1363,22 +1385,22 @@ XkbDeviceInfoRec If a client attempts to modify valid characteristics of a device using an implementation that does not support modification of those characteristics, no protocol error is generated. Instead, the server reports a failure for the -request; it also sends an -XkbExtensionDeviceNotify - event to the client that issued the request if the client has selected to +request; it also sends an +XkbExtensionDeviceNotify +event to the client that issued the request if the client has selected to receive these events. To change characteristics of an X Input Extension device in the server, first -modify a local copy of the device structure and then use either -XkbSetDeviceInfo, - or, to save network traffic, use an -XkbDeviceChangesRec - structure (see section 21.6) and call -XkbChangeDeviceInfo - to download the changes to the server. +modify a local copy of the device structure and then use either +XkbSetDeviceInfo, +or, to save network traffic, use an +XkbDeviceChangesRec +structure (see section 21.6) and call +XkbChangeDeviceInfo +to download the changes to the server. @@ -1387,130 +1409,128 @@ To modify some or all of the characteristics of an X Input Extension device, use XkbSetDeviceInfo. - - - - - - - -Bool -XkbSetDeviceInfo -( -dpy -, which, device_info) - - - - -Display * -dpy -; /* connection to X server */ - - - - -unsigned int -which -; /* mask indicating characteristics to modify */ - - - - -XkbDeviceInfoPtr device_info; /* structure defining the -device and modifications */ - - - - - - - - -XkbSetDeviceInfo - sends a request to the server to modify the characteristics of the device -specified in the -device_info - structure. The particular characteristics modified are identified by the bits -set in -which - and take their values from the relevant fields in -device_info - (see Table 21.1). -XkbSetDeviceInfo - returns -True - if the request was successfully sent to the server. If the X server +XkbSetDeviceInfo + + + Bool XkbSetDeviceInfo + + + Display *dpy + unsigned int which + XkbDeviceInfoPtr device_info + + + + + + dpy + + + + connection to X server + + + + + + which + + + + mask indicating characteristics to modify + + + + + + device_info + + + + structure defining the device and modifications + + + + + + +XkbSetDeviceInfo +sends a request to the server to modify the characteristics of the device +specified in the +device_info +structure. The particular characteristics modified are identified by the bits +set in +which +and take their values from the relevant fields in +device_info +(see Table 21.1). +XkbSetDeviceInfo +returns +True +if the request was successfully sent to the server. If the X server implementation does not allow interaction between the X input extension and the -Xkb Extension, the function does nothing and returns -False -. +Xkb Extension, the function does nothing and returns +False. -The -which - parameter specifies which aspects of the device should be changed and is a +The +which +parameter specifies which aspects of the device should be changed and is a bitmask composed of an inclusive OR or one or more of the following bits: - -XkbXI_ButtonActionsMask -, -XkbXI_IndicatorNamesMask -, -XkbXI_IndicatorMapsMask -. If the features requested to be manipulated in -which - are valid for the device, but the server does not support assignment of one or +XkbXI_ButtonActionsMask, +XkbXI_IndicatorNamesMask, +XkbXI_IndicatorMapsMask. +If the features requested to be manipulated in +which +are valid for the device, but the server does not support assignment of one or more of them, that particular portion of the request is ignored. -If the device specified in -device_info --> -device_spec - does not contain buttons and a request affecting buttons is made, or the +If the device specified in +device_info->device_spec +does not contain buttons and a request affecting buttons is made, or the device does not contain indicators and a request affecting indicators is made, -a -BadMatch - protocol error results. +a +BadMatch +protocol error results. -If the -XkbXI_ButtonActionsMask - bit is set in the supported mask returned by XkbGetDeviceInfo, the Xkb +If the +XkbXI_ButtonActionsMask +bit is set in the supported mask returned by XkbGetDeviceInfo, the Xkb extension allows applications to assign key actions to buttons on input -extension devices other than the core keyboard device. If the -XkbXI_ButtonActionsMask - is set in -which -, the actions for all buttons specified in device_info are set to the -XkbAction -s specified in -device_info --> -btn_acts -. If the number of buttons requested to be updated is not valid for the device, - -XkbSetDeviceInfo - returns -False - and a -BadValue - protocol error results. - - - - -If the -XkbXI_IndicatorMaps - and / or -XkbXI_IndicatorNamesMask - bit is set in the supported mask returned by XkbGetDeviceInfo, the Xkb +extension devices other than the core keyboard device. If the +XkbXI_ButtonActionsMask +is set in +which, +the actions for all buttons specified in device_info are set to the +XkbActions +specified in +device_info->btn_acts. +If the number of buttons requested to be updated is not valid for the device, +XkbSetDeviceInfo +returns +False +and a +BadValue +protocol error results. + + + + +If the +XkbXI_IndicatorMapsMask +and / or +XkbXI_IndicatorNamesMask +bit is set in the supported mask returned by XkbGetDeviceInfo, the Xkb extension allows applications to assign maps and / or names to the indicators of nonkeyboard extension devices. If supported, maps and / or names can be assigned to all extension device indicators, whether they are part of a @@ -1519,63 +1539,46 @@ keyboard feedback or part of an indicator feedback. -If the -XkbXI_IndicatorMapsMask - and / or -XkbXI_IndicatorNamesMask - flag is set in -which -, the indicator maps and / or names for all -device_info --> -num_leds - indicator devices specified in -device_info --> -leds - are set to the maps and / or names specified in -device_info --> -leds -. -device_info --> -leds --> -led_class - and -led_id - specify the input extension class and device ID for each indicator device to -modify; if they have invalid values, a -BadValue - protocol error results and -XkbSetDeviceInfo - returns -False -. If they have legal values but do not specify a keyboard or indicator class -feedback for the device in question, a -BadMatch - error results. If any of the values in -device_info --> -leds - --> - -names - are not a valid Atom or -None -, a -BadAtom - protocol error results. +If the +XkbXI_IndicatorMapsMask +and / or +XkbXI_IndicatorNamesMask +flag is set in +which, +the indicator maps and / or names for all +device_info->num_leds +indicator devices specified in +device_info->leds +are set to the maps and / or names specified in +device_info->leds. +device_info->leds->led_class +and +led_id +specify the input extension class and device ID for each indicator device to +modify; if they have invalid values, a +BadValue +protocol error results and +XkbSetDeviceInfo +returns +False. +If they have legal values but do not specify a keyboard or indicator class +feedback for the device in question, a +BadMatch +error results. If any of the values in +device_info->leds->names +are not a valid Atom or +None, +a +BadAtom +protocol error results. Xkb provides convenience functions to modify subsets of the information -accessible via -XkbSetDeviceInfo -. Only the parts of the structure indicated in the function description are +accessible via +XkbSetDeviceInfo. +Only the parts of the structure indicated in the function description are modified. These convenience functions are described as follows. @@ -1586,118 +1589,124 @@ XkbSetDeviceButtonActions. - - - - - - - -Bool -XkbSetDeviceButtonActions -( -dpy -, device, first_button, num_buttons, actions) - - - - -Display * -dpy -; /* connection to X server */ - - - - -XkbDeviceInfoPtr device_info; /* structure defining the -device and modifications */ - - - - -unsigned int first_button; /* number of first button to -update, 0 relative */ - - - - -unsigned int num_buttons; /* number of buttons to update -*/ - - - - - - - - -XkbSetDeviceButtonActions - assigns actions to the buttons of the device specified in -device_info-> -device_spec -. Actions are assigned to -num_buttons - buttons beginning with -first_button - and are taken from the actions specified in -device_info --> -btn_acts -. +XkbSetDeviceButtonActions + + + Bool XkbSetDeviceButtonActions + + + Display *dpy + XkbDeviceInfoPtr device_info + unsigned int first_button + unsigned int num_buttons + + + + + + dpy + + + + connection to X server + + + + + + device_info + + + + structure defining the device and modifications + + + + + + first_button + + + + number of first button to update, 0 relative + + + + + + num_buttons + + + + number of buttons to update + + + + + + +XkbSetDeviceButtonActions +assigns actions to the buttons of the device specified in +device_info->device_spec. +Actions are assigned to +num_buttons +buttons beginning with +first_button +and are taken from the actions specified in +device_info->btn_acts. If the server does not support assignment of Xkb actions to extension device -buttons, -XkbSetDeviceButtonActions - has no effect and returns -False -. If the device has no buttons or if -first_button - or -num_buttons - specify buttons outside of the valid range as determined by -device_info --> -num_btns -, the function has no effect and returns -False -. Otherwise, -XkbSetDeviceButtonActions - sends a request to the server to change the actions for the specified buttons -and returns -True -. +buttons, +XkbSetDeviceButtonActions +has no effect and returns +False. +If the device has no buttons or if +first_button +or +num_buttons +specify buttons outside of the valid range as determined by +device_info->num_btns, +the function has no effect and returns +False. +Otherwise, +XkbSetDeviceButtonActions +sends a request to the server to change the actions for the specified buttons +and returns +True. If the actual request sent to the server involved illegal button numbers, a - -BadValue - protocol error is generated. If an invalid device identifier is specified in -device_info-> -device_spec -, a BadKeyboard protocol error results. If the actual device specified in - -device_info --> -device_spec - does not contain buttons and a request affecting buttons is made, a -BadMatch - protocol error is generated. +BadValue +protocol error is generated. If an invalid device identifier is specified in +device_info->device_spec, +a BadKeyboard +protocol error results. If the actual device specified in +device_info->device_spec +does not contain buttons and a request affecting buttons is made, a +BadMatch +protocol error is generated.
XkbExtensionDeviceNotify Event + +eventsXkbExtensionDeviceNotify + +XkbExtensionDeviceNotifyEvent -The Xkb extension generates -XkbExtensionDeviceNotify - events when the status of an input extension device changes or when an attempt +The Xkb extension generates +XkbExtensionDeviceNotify +events when the status of an input extension device changes or when an attempt is made to use an Xkb feature that is not supported by a particular device. @@ -1706,86 +1715,81 @@ delivered only to the client requesting the event. To track changes to the status of input extension devices or attempts to use -unsupported features of a device, select to receive -XkbExtensionDeviceNotify - events by calling either -XkbSelectEvents - or -XkbSelectEventDetails - (see section 4.3). +unsupported features of a device, select to receive +XkbExtensionDeviceNotify +events by calling either +XkbSelectEvents +or +XkbSelectEventDetails +(see section 4.3). -To receive -XkbExtensionDeviceNotify - events under all possible conditions, call -XkbSelectEvents - and pass -XkbExtensionDeviceNotifyMask - in both -bits_to_change - and -values_for_bits -. +To receive +XkbExtensionDeviceNotify +events under all possible conditions, call +XkbSelectEvents +and pass +XkbExtensionDeviceNotifyMask +in both +bits_to_change +and +values_for_bits. -The -XkbExtensionDeviceNotify - event has no event details. However, you can call -XkbSelectEventDetails - using -XkbExtensionDeviceNotify - as the -event_type - and specifying -XkbAllExtensionDeviceMask - in -bits_to_change - and -values_for_bits. - This has the same effect as a call to -XkbSelectEvents -. +The +XkbExtensionDeviceNotify +event has no event details. However, you can call +XkbSelectEventDetails +using +XkbExtensionDeviceNotify +as the +event_type +and specifying +XkbAllExtensionDeviceEventsMask +in +bits_to_change +and +values_for_bits. +This has the same effect as a call to +XkbSelectEvents. -The structure for -XkbExtensionDeviceNotify - events is: - +The structure for +XkbExtensionDeviceNotify +events is: - + typedef struct { - int type; /* Xkb extension base event code */ - unsigned long serial; /* X server serial number for event */ - Bool send_event; /* True - => synthetically generated*/ - Display * display; /* server connection where event generated */ - Time time; /* server time when event generated */ - int xkb_type; /* XkbExtensionDeviceNotifyEvent */ - int device; /* Xkb device ID, will not be - XkbUseCoreKbd */ - unsigned int reason; /* reason for the event */ - unsigned int supported; /* mask of supported features */ - unsigned int unsupported; /* unsupported features this client + int type; /* Xkb extension base event code */ + unsigned long serial; /* X server serial number for event */ + Bool send_event; /* True ⇒ synthetically generated */ + Display * display; /* server connection where event generated */ + Time time; /* server time when event generated */ + int xkb_type; /* XkbExtensionDeviceNotifyEvent */ + int device; /* Xkb device ID, will not be XkbUseCoreKbd */ + unsigned int reason; /* reason for the event */ + unsigned int supported; /* mask of supported features */ + unsigned int unsupported; /* unsupported features this client attempted to use */ - int first_btn; /* first button that changed */ - int num_btns; /* number of buttons that changed */ - unsigned int leds_defined; /* indicators with names or maps */ - unsigned int led_state; /* current state of the indicators */ - int led_class; /* feedback class for LED changes */ - int led_id; /* feedback ID for LED changes */ -} XkbExtensionDeviceNotifyEvent; + int first_btn; /* first button that changed */ + int num_btns; /* number of buttons that changed */ + unsigned int leds_defined; /* indicators with names or maps */ + unsigned int led_state; /* current state of the indicators */ + int led_class; /* feedback class for LED changes */ + int led_id; /* feedback ID for LED changes */ +} XkbExtensionDeviceNotifyEvent; -The -XkbExtensionDeviceNotify - event has fields enabling it to report changes in the state (on/off) of all of +The +XkbExtensionDeviceNotify +event has fields enabling it to report changes in the state (on/off) of all of the buttons for a device, but only for one LED feedback associated with a device. You will get multiple events when more than one LED feedback changes state or configuration. @@ -1795,43 +1799,44 @@ state or configuration. Tracking Changes to Extension Devices + +XkbDeviceChangesRec + +XkbDeviceLedChangesRec -Changes to an Xkb extension device may be tracked by listening to -XkbDeviceExtensionNotify - events and accumulating the changes in an -XkbDeviceChangesRec - structure. The changes noted in the structure may then be used in subsequent +Changes to an Xkb extension device may be tracked by listening to +XkbExtensionDeviceNotify +events and accumulating the changes in an +XkbDeviceChangesRec +structure. The changes noted in the structure may then be used in subsequent operations to update either a server configuration or a local copy of an Xkb extension device configuration. The changes structure is defined as follows: - - + typedef struct _XkbDeviceChanges { - unsigned int changed; /* bits indicating what has changed */ - unsigned short first_btn; /* number of first button which changed, - if any */ - unsigned short num_btns; /* number of buttons that have changed */ - XkbDeviceLedChangesRec leds; -} XkbDeviceChangesRec,*XkbDeviceChangesPtr; - + unsigned int changed; /* bits indicating what has changed */ + unsigned short first_btn; /* number of first button which changed, + if any */ + unsigned short num_btns; /* number of buttons that have changed */ + XkbDeviceLedChangesRec leds; +} XkbDeviceChangesRec, *XkbDeviceChangesPtr; - typedef struct _XkbDeviceLedChanges { - unsigned short led_class; /* class of this indicator feedback bundle */ - unsigned short led_id; /* ID of this indicator feedback bundle */ - unsigned int names; /* bits indicating which names have changed */ - unsigned int maps; /* bits indicating which maps have changed */ - struct _XkbDeviceLedChanges *next; /* link to indicator change record - for next set */ -} XkbDeviceLedChangesRec,*XkbDeviceLedChangesPtr; + unsigned short led_class; /* class of this indicator feedback bundle */ + unsigned short led_id; /* ID of this indicator feedback bundle */ + unsigned int names; /* bits indicating which names have changed */ + unsigned int maps; /* bits indicating which maps have changed */ + struct _XkbDeviceLedChanges *next; /* link to indicator change record + for next set */ +} XkbDeviceLedChangesRec, *XkbDeviceLedChangesPtr; A local description of the configuration and state of a device may be kept in -an -XkbDeviceInfoRec - structure. The actual state or configuration of the device may change because +an +XkbDeviceInfoRec +structure. The actual state or configuration of the device may change because of XkbSetDeviceInfo and XkbSetButtonActions requests made by clients or by user interaction with the device. The X server sends an XkbExtensionDeviceNotify event to all interested clients when the state of any buttons or indicators or @@ -1847,81 +1852,84 @@ server. -To note device changes reported in an -XkbExtensionDeviceNotify - event, use XkbNoteDeviceChanges. - - - - - - - - - -void -XkbNoteDeviceChanges - ( -old, new, wanted -) - - - - -XkbDeviceChangesPtr -old -; /* structure tracking state changes */ - - - - -XkbExtensionDeviceNotifyEvent * -new -; /* event indicating state changes */ - - - - -unsigned int -wanted -; /* mask indicating changes to note */ - - - - - - - -The wanted field specifies the changes that should be noted in -old -, and is composed of the bitwise inclusive OR of one or more of the masks from -Table 21.1 -. - The -reason - field of the event in -new - indicates the types of changes the event is reporting. -XkbNoteDeviceChanges - updates the -XkbDeviceChangesRec - specified by -old - with the changes that are both specified in -wanted - and contained in -new --> -reason -. +To note device changes reported in an +XkbExtensionDeviceNotify +event, use XkbNoteDeviceChanges. + + +XkbNoteDeviceChanges + + + void XkbNoteDeviceChanges + + + XkbDeviceChangesPtr old + XkbExtensionDeviceNotifyEvent *new + unsigned int wanted + + + + + + old + + + + structure tracking state changes + + + + + + new + + + + event indicating state changes + + + + + + wanted + + + + mask indicating changes to note + + + + + + +The wanted field specifies the changes that should be noted in +old, +and is composed of the bitwise inclusive OR of one or more of the masks from +Table 21.1. +The +reason +field of the event in +new +indicates the types of changes the event is reporting. +XkbNoteDeviceChanges +updates the +XkbDeviceChangesRec +specified by +old +with the changes that are both specified in +wanted +and contained in +new->reason. To update a local copy of the state and configuration of an X input extension -device with the changes previously noted in an -XkbDeviceChangesRec - structure, use XkbGetDeviceInfoChanges. +device with the changes previously noted in an +XkbDeviceChangesRec +structure, use XkbGetDeviceInfoChanges. @@ -1932,62 +1940,66 @@ XkbGetDeviceInfoChanges. - - - - - - - -Status -XkbGetDeviceInfoChanges -( -dpy -, -device_info -, changes) - - - - -Display * -dpy -; /* connection to X server */ - - - - -XkbDeviceInfoPtr device_info; /* structure to update with -results */ - - - - -XkbDeviceChangesPtr -changes -; /* contains notes of changes that have occurred */ - - - - - +XkbGetDeviceInfoChanges + + + Status XkbGetDeviceInfoChanges + + + Display *dpy + XkbDeviceInfoPtr device_info + XkbDeviceChangesPtr changes + + + + + + dpy + + + + connection to X server + + + + + + device_info + + + + structure to update with results + + + + + + changes + + + + contains notes of changes that have occurred + + + + The changes->changed field indicates which attributes of the device -specified in -changes --> -device - have changed. The parameters describing the changes are contained in the other -fields of -changes -. -XkbGetDeviceInfoChanges - uses that information to call XkbGetDeviceInfo to obtain the current status of +specified in +changes->device +have changed. The parameters describing the changes are contained in the other +fields of +changes. +XkbGetDeviceInfoChanges +uses that information to call XkbGetDeviceInfo to obtain the current status of those attributes that have changed. It then updates the local description of -the device in -device_info - with the new information. +the device in +device_info +with the new information. @@ -1997,59 +2009,61 @@ XkbDeviceChangesRec, use XkbChangeDeviceInfo. - - - - - - - -Bool -XkbChangeDeviceInfo - ( -dpy, device_info, changes -) - - - - -Display * -dpy -; /* connection to X server */ - - - - -XkbDeviceInfoPtr -device_info -; /* local copy of device state and configuration */ - - - - -XkbDeviceChangesPtr -changes -; /* note specifying changes in -device_info - */ - - - - - - - - -XkbChangeDeviceInfo - updates the server’s description of the device specified in -device_info --> -device_spec - with the changes specified in -changes - and contained in -device_info -. The update is made by an XkbSetDeviceInfo request. +XkbChangeDeviceInfo + + + Bool XkbChangeDeviceInfo + + + Display *dpy + XkbDeviceInfoPtr device_info + XkbDeviceChangesPtr changes + + + + + + dpy + + + + connection to X server + + + + + + device_info + + + + local copy of device state and configuration + + + + + + changes + + + + note specifying changes in device_info + + + + + + +XkbChangeDeviceInfo +updates the server’s description of the device specified in +device_info->device_spec +with the changes specified in +changes +and contained in +device_info. +The update is made by an XkbSetDeviceInfo request. diff --git a/libX11/specs/XKB/ch22.xml b/libX11/specs/XKB/ch22.xml index 4dea73387..4a3981afa 100644 --- a/libX11/specs/XKB/ch22.xml +++ b/libX11/specs/XKB/ch22.xml @@ -1,3 +1,6 @@ + + Debugging Aids @@ -15,153 +18,175 @@ Both bitmasks are initially all zeros. -To change the values of any of the debug controls, use -XkbSetDebuggingFlags -. +To change the values of any of the debug controls, use +XkbSetDebuggingFlags. - - - - - - - -Bool -XkbSetDebuggingFlags -( -display, mask, flags, msg, ctrls_mask, ctrls, ret_flags, ret_ctrls -) - - - - -Display * - display -; /* connection to X server */ - - - - -unsigned int - mask -; /* mask selecting debug output flags to change */ - - - - -unsigned int - flags -; /* values for debug output flags selected by -mask - */ - - - - -char * - msg -; /* message to print right now */ - - - - -unsigned int -ctrls_mask -; /* mask selecting debug controls to change */ - - - - -unsigned int -ctrls -; /* values for debug controls selected by -ctrls_mask - */ - - - - -unsigned int * - ret_flags -; /* resulting state of all debug output flags */ - - - - -unsigned int * -ret_ctrls -; /* resulting state of all debug controls */ - - - - - +XkbSetDebuggingFlags + + + Bool XkbSetDebuggingFlags + + + Display *display + unsigned int mask + unsigned int flags + char *msg + unsigned int ctrls_mask + unsigned int ctrls + unsigned int *ret_flags + unsigned int *ret_ctrls + + + + + + display + + + + connection to X server + + + + + + mask + + + + mask selecting debug output flags to change + + + + + + flags + + + + values for debug output flags selected by mask + + + + + + msg + + + + message to print right now + + + + + + ctrls_mask + + + + mask selecting debug controls to change + + + + + + ctrls + + + + values for debug controls selected by ctrls_mask + + + + + + ret_flags + + + + resulting state of all debug output flags + + + + + + ret_ctrls + + + + resulting state of all debug controls + + + + - -XkbSetDebuggingFlags - modifies the debug output flags as specified by -mask - and -flags -, modifies the debug controls flags as specified by -ctrls_mask - and -ctrls -, prints the message -msg -, and backfills -ret_flags - and -ret_ctrls - with the resulting debug output and debug controls flags. +XkbSetDebuggingFlags +modifies the debug output flags as specified by +mask +and +flags, +modifies the debug controls flags as specified by +ctrls_mask +and +ctrls, +prints the message +msg, +and backfills +ret_flags +and +ret_ctrls +with the resulting debug output and debug controls flags. -When bits are set in the debug output masks, -mask - and -flags -, Xkb prints debug information corresponding to each bit at appropriate points +When bits are set in the debug output masks, +mask +and +flags, +Xkb prints debug information corresponding to each bit at appropriate points during its processing. The device to which the output is written is implementation-dependent, but is normally the same device to which X server -error messages are directed; thus the bits that can be set in -mask - and -flags - is implementation-specific. To turn on a debug output selection, set the bit -for the output in the -mask - parameter and set the corresponding bit in the -flags - parameter. To turn off event selection for an event, set the bit for the -output in the -mask - parameter and do not set the corresponding bit in the -flags - parameter. +error messages are directed; thus the bits that can be set in +mask +and +flags +is implementation-specific. To turn on a debug output selection, set the bit +for the output in the +mask +parameter and set the corresponding bit in the +flags +parameter. To turn off event selection for an event, set the bit for the +output in the +mask +parameter and do not set the corresponding bit in the +flags +parameter. -When bits are set in the debug controls masks, -ctrls_mask - and -ctrls -, Xkb modifies its behavior according to each controls bit. -ctrls_mask - and -ctrls - are related in the same way that -mask - and -flags - are. The valid controls bits are defined in Table 22.1. +When bits are set in the debug controls masks, +ctrls_mask +and +ctrls, +Xkb modifies its behavior according to each controls bit. +ctrls_mask +and +ctrls +are related in the same way that +mask +and +flags +are. The valid controls bits are defined in +Table 22.1. - +
Debug Control Masks @@ -177,7 +202,7 @@ flags - XkbDF_DisableLocks + XkbDF_DisableLocks (1 << 0) Disable actions that lock modifiers @@ -186,32 +211,30 @@ flags
- -XkbSetDebuggingFlags - returns -True - if successful and -False - otherwise. The only protocol error it may generate is -BadAlloc -, if for some reason it is unable to allocate storage. +XkbSetDebuggingFlags +returns +True +if successful and +False +otherwise. The only protocol error it may generate is +BadAlloc, +if for some reason it is unable to allocate storage. - -XkbSetDebuggingFlags - is intended for developer use and may be disabled in production X servers. If -it is disabled, -XkbSetDebuggingFlags - has no effect and does not generate any protocol errors. +XkbSetDebuggingFlags +is intended for developer use and may be disabled in production X servers. If +it is disabled, +XkbSetDebuggingFlags +has no effect and does not generate any protocol errors. -The message in -msg - is written immediately. The device to which it is written is implementation +The message in +msg +is written immediately. The device to which it is written is implementation dependent but is normally the same device where X server error messages are directed. diff --git a/libX11/specs/XKB/glossary.xml b/libX11/specs/XKB/glossary.xml index 0cccf0f8f..1eb600c90 100644 --- a/libX11/specs/XKB/glossary.xml +++ b/libX11/specs/XKB/glossary.xml @@ -1,3 +1,6 @@ + + Glossary @@ -84,31 +87,31 @@ upon client program exit. The canonical key types are predefined key types that describe the types of keys available on most keyboards. The definitions for the canonical key types -are held in the first -XkbNumRequiredTypes - entries of the -types - field of the client map and are indexed using the following constants: +are held in the first +XkbNumRequiredTypes +entries of the +types +field of the client map and are indexed using the following constants: -XkbOneLevelIndex +XkbOneLevelIndex -XkbTwoLevelIndex +XkbTwoLevelIndex -XkbAlphabeticIndex +XkbAlphabeticIndex -XkbKeypadIndex +XkbKeypadIndex @@ -127,9 +130,9 @@ The key mapping information needed to convert arbitrary keycodes to symbols. Compat Name -The -compat - name is a string that provides some information about the rules used to bind +The +compat +name is a string that provides some information about the rules used to bind actions to keys that are changed using core protocol requests. @@ -186,12 +189,12 @@ processing. Xkb normally consumes modifiers in determining the appropriate symbol for an event, that is, the modifiers are not considered during any of the later stages -of event processing. For those rare occasions when a modifier -should - be considered despite having been used to look up a symbol, key types include -an optional -preserve - field. +of event processing. For those rare occasions when a modifier +should +be considered despite having been used to look up a symbol, key types include +an optional +preserve +field. @@ -209,16 +212,15 @@ An event created from the core X server. Detectable auto-repeat allows a client to detect an auto-repeating key. If a client requests and the server supports detectable auto-repeat, Xkb generates - -KeyRelease - events only when the key is physically released. Thus the client receives a -number of -KeyPress - events for that key without intervening -KeyRelease - events until the key is finally released, when a -KeyRelease - event is received. +KeyRelease +events only when the key is physically released. Thus the client receives a +number of +KeyPress +events for that key without intervening +KeyRelease +events until the key is finally released, when a +KeyRelease +event is received. @@ -228,17 +230,16 @@ KeyRelease The effective group is the arithmetic sum of the locked, latched, and base groups. The effective keyboard group is always brought back into range -depending on the value of the -GroupsWrap - control for the keyboard. If an event occurs with an effective group that is +depending on the value of the +GroupsWrap +control for the keyboard. If an event occurs with an effective group that is legal for the keyboard as a whole, but not for the key in question, the group - -for that event only - is normalized using the algorithm specified by the -group_info - member of the key symbol map ( -XkbSymMapRec -). +for that event only +is normalized using the algorithm specified by the +group_info +member of the key symbol map +(XkbSymMapRec). + @@ -352,14 +353,14 @@ Group 4 have indices of 0 through 3. If a group index exceeds the maximum number of groups permitted for the specified keyboard, it is wrapped or truncated back into range as specified by -the global GroupsWrap control. -GroupsWrap can have the following values: +the global GroupsWrap control. +GroupsWrap can have the following values: + + WrapIntoRange + ClampIntoRange + RedirectIntoRange + - - WrapIntoRange - ClampIntoRange - RedirectIntoRange - @@ -390,8 +391,8 @@ collection of characters. A group usually contains a set of characters that logically belong together and that may be arranged on several shift levels within that group. For example, Group1 could be the English alphabet, and Group2 could be Greek. Xkb supports up to four different groups for an input -device or keyboard. Groups are in the range 1-4 (Group1 - Group4), and are -often referred to as G1 - G4 and indexed as 0 - 3. +device or keyboard. Groups are in the range 1–4 (Group1–Group4), +and are often referred to as G1–G4 and indexed as 0–3. @@ -424,11 +425,11 @@ specifies which lights are on or off. An indicator has its own set of attributes that specify whether clients can explicitly set its state and whether it tracks the keyboard state. The indicator map is the collection of these attributes for each indicator and is -held in the -maps - array, which is an array of -XkbIndicatorRec - structures. +held in the +maps +array, which is an array of +XkbIndicatorRec +structures. @@ -495,7 +496,8 @@ Simulate events on other keys A key alias is a symbolic name for a specific physical key. Key aliases allow the keyboard layout designer to assign multiple key names to a single key. This allows the keyboard layout designer to refer to keys using either their -position or their "function." Key aliases can be specified both in the symbolic +position or their function. +Key aliases can be specified both in the symbolic names component and in the keyboard geometry. Both sets of aliases are always valid, but key alias definitions in the keyboard geometry have priority; if both symbolic names and geometry include aliases, you should consider the @@ -508,11 +510,11 @@ symbolic names section. Key Behavior -The -behaviors - field of the server map is an array of -XkbBehavior -, indexed by keycode, and contains the behavior for each key. The X server uses +The +behaviors +field of the server map is an array of +XkbBehavior, +indexed by keycode, and contains the behavior for each key. The X server uses key behavior to determine whether to process or filter out any given key event; key behavior is independent of keyboard modifier or group state. Each key has exactly one behavior. @@ -542,9 +544,9 @@ exactly one behavior. A key symbol map describes the symbols bound to a key and the rules to be used -to interpret those symbols. It is an array of -XkbSymMapRec - structures indexed by keycode. +to interpret those symbols. It is an array of +XkbSymMapRec +structures indexed by keycode. @@ -554,15 +556,15 @@ XkbSymMapRec Key types are used to determine the shift level of a key given the current state of the keyboard. There is one key type for each group for a key. Key -types are defined using the -XkbKeyTypeRec - and -XkbKTMapEntryRec - structures. Xkb allows up to -XkbMaxKeyTypes - (255) key types to be defined, but requires at least -XkbNumRequiredTypes - (4) predefined types to be in a key map. +types are defined using the +XkbKeyTypeRec +and +XkbKTMapEntryRec +structures. Xkb allows up to +XkbMaxKeyTypes +(255) key types to be defined, but requires at least +XkbNumRequiredTypes +(4) predefined types to be in a key map. @@ -572,7 +574,7 @@ XkbNumRequiredTypes The sound the default bell makes when rung is the system bell or the default keyboard bell. Some input devices may have more than one bell, identified by -bell_class and bell_id. +bell_class and bell_id. @@ -581,11 +583,14 @@ keyboard bell. Some input devices may have more than one bell, identified by There are five types of components stored in the X server database of keyboard -components. They correspond to the -symbols, geometry, keycodes, compat, -and - types - symbolic names associated with a keyboard. +components. They correspond to the +>symbols, +geometry, +keycodes, +compat, +and +types +symbolic names associated with a keyboard. @@ -594,16 +599,16 @@ and A keyboard feedback includes the following: + + Keyclick volume + Bell volume + Bell pitch + Bell duration + Global auto-repeat + Per key auto-repeat + 32 LEDs + - - Keyclick volume - Bell volume - Bell pitch - Bell duration - Global auto-repeat - Per key auto-repeat - 32 LEDs - @@ -622,9 +627,9 @@ key type. Keyboard geometry describes the physical appearance of the keyboard, including the shape, location, and color of all keyboard keys or other visible keyboard -components such as indicators and is stored in a -XkbGeometryRec - structure. The information contained in a keyboard geometry is sufficient to +components such as indicators and is stored in a +XkbGeometryRec +structure. The information contained in a keyboard geometry is sufficient to allow a client program to draw an accurate two-dimensional image of the keyboard. @@ -635,9 +640,9 @@ keyboard. The keyboard geometry name describes the physical location, size, and shape of -the various keys on the keyboard and is part of the -XkbNamesRec - structure. +the various keys on the keyboard and is part of the +XkbNamesRec +structure. @@ -666,9 +671,9 @@ the device. The keycode name describes the range and meaning of the keycodes returned by -the keyboard and is part of the -XkbNamesRec - structure. +the keyboard and is part of the +XkbNamesRec +structure. @@ -741,19 +746,17 @@ to a keysym. A modifier is a logical condition that is either set or unset. The modifiers control the Shift Level selected when a key event occurs. Xkb supports the core -protocol eight modifiers ( -Shift -, -Lock -, -Control -, and -Mod1 - through -Mod5 -), called the -real - modifiers. In addition, Xkb extends modifier flexibility by providing a set of +protocol eight modifiers +(Shift, +Lock, +Control, +and +Mod1 +through +Mod5), +called the +real +modifiers. In addition, Xkb extends modifier flexibility by providing a set of sixteen named virtual modifiers, each of which can be bound to any set of the eight real modifiers. @@ -773,9 +776,9 @@ may be, for example, a shift key or a control key. Modifier Definition -An Xkb modifier definition, held in an -XkbModsRec -, consists of a set of real modifiers, a set of virtual modifiers, and an +An Xkb modifier definition, held in an +XkbModsRec, +consists of a set of real modifiers, a set of virtual modifiers, and an effective mask. The mask is the union of the real modifiers and the set of real modifiers to which the virtual modifiers map; the mask cannot be explicitly changed. @@ -806,12 +809,12 @@ polygon, used in the geometry specification for a keyboard. Physical Indicator Mask -The physical indicator mask is a field in the -XkbIndicatorRec - that indicates which indicators are bound to physical LEDs on the keyboard; if -a bit is set in -phys_indicators -, then the associated indicator has a physical LED associated with it. This +The physical indicator mask is a field in the +XkbIndicatorRec +that indicates which indicators are bound to physical LEDs on the keyboard; if +a bit is set in +phys_indicators, +then the associated indicator has a physical LED associated with it. This field is necessary because some indicators may not have corresponding physical LEDs on the keyboard. @@ -821,13 +824,13 @@ LEDs on the keyboard. Physical Symbol Keyboard Name -The -symbols - keyboard name identifies the symbols logically bound to the keys. The symbols +The +symbols +keyboard name identifies the symbols logically bound to the keys. The symbols name is a human or application-readable description of the intended locale or -usage of the keyboard with these symbols. The -phys_symbols - keyboard name, on the other hand, identifies the symbols actually engraved on +usage of the keyboard with these symbols. The +phys_symbols +keyboard name, on the other hand, identifies the symbols actually engraved on the keyboard. @@ -838,14 +841,14 @@ the keyboard. Xkb normally consumes modifiers in determining the appropriate symbol for an event, that is, the modifiers are not considered during any of the later stages -of event processing. For those rare occasions when a modifier -should - be considered despite having been used to look up a symbol, key types include -an optional -preserve - field. If a modifier is present in the -preserve - list, it is a preserved modifier. +of event processing. For those rare occasions when a modifier +should +be considered despite having been used to look up a symbol, key types include +an optional +preserve +field. If a modifier is present in the +preserve +list, it is a preserved modifier. @@ -865,19 +868,17 @@ be logically depressed at one time. Real Modifier -Xkb supports the eight core protocol modifiers ( -Shift -, -Lock -, -Control -, and -Mod1 - through -Mod5 -); these are called the -real - modifiers, as opposed to the set of sixteen named virtual modifiers that can +Xkb supports the eight core protocol modifiers +(Shift, +Lock, +Control, +and +Mod1 +through +Mod5); +these are called the +real +modifiers, as opposed to the set of sixteen named virtual modifiers that can be bound to any set of the eight real modifiers. @@ -904,13 +905,13 @@ produced when a key is actuated. Symbol Keyboard Name -The -symbols - keyboard name identifies the symbols logically bound to the keys. The symbols +The +symbols +keyboard name identifies the symbols logically bound to the keys. The symbols name is a human or application-readable description of the intended locale or -usage of the keyboard with these symbols. The -phys_symbols - keyboard name, on the other hand, identifies the symbols actually engraved on +usage of the keyboard with these symbols. The +phys_symbols +keyboard name, on the other hand, identifies the symbols actually engraved on the keyboard. @@ -920,9 +921,9 @@ the keyboard. Xkb supports symbolic names for most components of the keyboard extension. Most -of these symbolic names are grouped into the -names - component of the keyboard description. +of these symbolic names are grouped into the +names +component of the keyboard description. @@ -939,9 +940,9 @@ group, and button state information pertaining to the event. Types Name -The -types - name provides some information about the set of key types that can be +The +types +name provides some information about the set of key types that can be associated with the keyboard. In addition, each key type can have a name, and each shift level of a type can have a name. @@ -962,17 +963,15 @@ slider, or a dial. Xkb provides a set of sixteen named virtual modifiers that can be bound to any set of the eight real modifiers. Each virtual modifier can be bound to any set -of the real modifiers ( -Shift -, -Lock -, -Control, - and -Mod1 -- -Mod5 -). +of the real modifiers +(Shift, +Lock, +Control, +and +Mod1 +– +Mod5). + diff --git a/libX11/specs/XKB/xkblib.xml b/libX11/specs/XKB/xkblib.xml index e4aa58741..c7508d484 100644 --- a/libX11/specs/XKB/xkblib.xml +++ b/libX11/specs/XKB/xkblib.xml @@ -105,4 +105,5 @@ other dealings in this Software without prior written authorization. + diff --git a/libXext/configure.ac b/libXext/configure.ac index 491aac086..8efdd1f09 100644 --- a/libXext/configure.ac +++ b/libXext/configure.ac @@ -1,7 +1,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([libXext], [1.3.2], +AC_INIT([libXext], [1.3.3], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXext]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) diff --git a/mesalib/configure.ac b/mesalib/configure.ac index 744e55ce3..d06730d34 100644 --- a/mesalib/configure.ac +++ b/mesalib/configure.ac @@ -32,7 +32,7 @@ LIBDRM_RADEON_REQUIRED=2.4.54 LIBDRM_INTEL_REQUIRED=2.4.52 LIBDRM_NVVIEUX_REQUIRED=2.4.33 LIBDRM_NOUVEAU_REQUIRED="2.4.33 libdrm >= 2.4.41" -LIBDRM_FREEDRENO_REQUIRED=2.4.51 +LIBDRM_FREEDRENO_REQUIRED=2.4.55 DRI2PROTO_REQUIRED=2.6 DRI3PROTO_REQUIRED=1.0 PRESENTPROTO_REQUIRED=1.0 diff --git a/mesalib/docs/GL3.txt b/mesalib/docs/GL3.txt index 0f37da410..f9e33b4fe 100644 --- a/mesalib/docs/GL3.txt +++ b/mesalib/docs/GL3.txt @@ -157,7 +157,7 @@ GL 4.3: GL_ARB_arrays_of_arrays started (Timothy) GL_ARB_ES3_compatibility DONE (i965) GL_ARB_clear_buffer_object DONE (all drivers) - GL_ARB_compute_shader started (Paul Berry) + GL_ARB_compute_shader started (currently stalled) GL_ARB_copy_image not started GL_KHR_debug DONE (all drivers) GL_ARB_explicit_uniform_location DONE (all drivers that support GLSL) @@ -183,7 +183,7 @@ GL 4.4: GLSL 4.4 not started GL_MAX_VERTEX_ATTRIB_STRIDE not started GL_ARB_buffer_storage DONE (i965, nv30, nv50, nvc0, r300, r600, radeonsi) - GL_ARB_clear_texture not started + GL_ARB_clear_texture DONE (i965) GL_ARB_enhanced_layouts not started GL_ARB_multi_bind DONE (all drivers) GL_ARB_query_buffer_object not started diff --git a/mesalib/docs/relnotes/10.3.html b/mesalib/docs/relnotes/10.3.html index 90247c09c..1f4e1da7b 100644 --- a/mesalib/docs/relnotes/10.3.html +++ b/mesalib/docs/relnotes/10.3.html @@ -58,6 +58,7 @@ Note: some of the new features are only available with certain drivers.
  • GL_ARB_seamless_cubemap_per_texture on i965, llvmpipe, nvc0, r600, radeonsi, softpipe
  • GL_ARB_fragment_layer_viewport on nv50, nvc0, llvmpipe, r600
  • GL_AMD_vertex_shader_viewport_index on i965/gen7+, r600
  • +
  • GL_ARB_clear_texture on i965
  • diff --git a/mesalib/src/gallium/auxiliary/util/u_math.h b/mesalib/src/gallium/auxiliary/util/u_math.h index b9ed197d7..f6dcb228f 100644 --- a/mesalib/src/gallium/auxiliary/util/u_math.h +++ b/mesalib/src/gallium/auxiliary/util/u_math.h @@ -812,6 +812,23 @@ util_bswap16(uint16_t n) (n << 8); } +static INLINE void* +util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict src, size_t n) +{ +#ifdef PIPE_ARCH_BIG_ENDIAN + size_t i, e; + asset(n % 4 == 0); + + for (i = 0, e = n / 4; i < e; i++) { + uint32_t * restrict d = (uint32_t* restrict)dest; + const uint32_t * restrict s = (const uint32_t* restrict)src; + d[i] = util_bswap32(s[i]); + } + return dest; +#else + return memcpy(dest, src, n); +#endif +} /** * Clamp X to [MIN, MAX]. diff --git a/mesalib/src/glsl/ast_array_index.cpp b/mesalib/src/glsl/ast_array_index.cpp index f3b060ea6..50f9987c8 100644 --- a/mesalib/src/glsl/ast_array_index.cpp +++ b/mesalib/src/glsl/ast_array_index.cpp @@ -181,7 +181,8 @@ _mesa_ast_array_index_to_hir(void *mem_ctx, if (array->type->is_unsized_array()) { _mesa_glsl_error(&loc, state, "unsized array index must be constant"); } else if (array->type->fields.array->is_interface() - && array->variable_referenced()->data.mode == ir_var_uniform) { + && array->variable_referenced()->data.mode == ir_var_uniform + && !state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) { /* Page 46 in section 4.3.7 of the OpenGL ES 3.00 spec says: * * "All indexes used to index a uniform block array must be diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp index 328cd1b1b..a15ee9c05 100644 --- a/mesalib/src/glsl/ast_to_hir.cpp +++ b/mesalib/src/glsl/ast_to_hir.cpp @@ -5212,7 +5212,7 @@ ast_process_structure_or_interface_block(exec_list *instructions, fields[i].row_major = false; } - i++; + i++; } } diff --git a/mesalib/src/glsl/builtin_variables.cpp b/mesalib/src/glsl/builtin_variables.cpp index 34973023f..4c5b9c070 100644 --- a/mesalib/src/glsl/builtin_variables.cpp +++ b/mesalib/src/glsl/builtin_variables.cpp @@ -672,6 +672,12 @@ builtin_variable_generator::generate_constants() } if (state->is_version(430, 0) || state->ARB_compute_shader_enable) { + add_const("gl_MaxComputeAtomicCounterBuffers", MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS); + add_const("gl_MaxComputeAtomicCounters", MAX_COMPUTE_ATOMIC_COUNTERS); + add_const("gl_MaxComputeImageUniforms", MAX_COMPUTE_IMAGE_UNIFORMS); + add_const("gl_MaxComputeTextureImageUnits", MAX_COMPUTE_TEXTURE_IMAGE_UNITS); + add_const("gl_MaxComputeUniformComponents", MAX_COMPUTE_UNIFORM_COMPONENTS); + add_const_ivec3("gl_MaxComputeWorkGroupCount", state->Const.MaxComputeWorkGroupCount[0], state->Const.MaxComputeWorkGroupCount[1], diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp index 37e1ce33e..4f85b7db8 100644 --- a/mesalib/src/glsl/ir_validate.cpp +++ b/mesalib/src/glsl/ir_validate.cpp @@ -495,7 +495,6 @@ ir_validate::visit_leave(ir_expression *ir) break; case ir_binop_ubo_load: - assert(ir->operands[0]->as_constant()); assert(ir->operands[0]->type == glsl_type::uint_type); assert(ir->operands[1]->type == glsl_type::uint_type); diff --git a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp index d19ce20c7..854309f9b 100644 --- a/mesalib/src/glsl/link_uniform_block_active_visitor.cpp +++ b/mesalib/src/glsl/link_uniform_block_active_visitor.cpp @@ -109,32 +109,44 @@ link_uniform_block_active_visitor::visit_enter(ir_dereference_array *ir) assert((b->num_array_elements == 0) == (b->array_elements == NULL)); assert(b->type != NULL); - /* Determine whether or not this array index has already been added to the - * list of active array indices. At this point all constant folding must - * have occured, and the array index must be a constant. - */ ir_constant *c = ir->array_index->as_constant(); - assert(c != NULL); - const unsigned idx = c->get_uint_component(0); + if (c) { + /* Index is a constant, so mark just that element used, if not already */ + const unsigned idx = c->get_uint_component(0); - unsigned i; - for (i = 0; i < b->num_array_elements; i++) { - if (b->array_elements[i] == idx) - break; - } + unsigned i; + for (i = 0; i < b->num_array_elements; i++) { + if (b->array_elements[i] == idx) + break; + } - assert(i <= b->num_array_elements); + assert(i <= b->num_array_elements); - if (i == b->num_array_elements) { - b->array_elements = reralloc(this->mem_ctx, - b->array_elements, - unsigned, - b->num_array_elements + 1); + if (i == b->num_array_elements) { + b->array_elements = reralloc(this->mem_ctx, + b->array_elements, + unsigned, + b->num_array_elements + 1); - b->array_elements[b->num_array_elements] = idx; + b->array_elements[b->num_array_elements] = idx; - b->num_array_elements++; + b->num_array_elements++; + } + } else { + /* The array index is not a constant, so mark the entire array used. */ + assert(b->type->is_array()); + if (b->num_array_elements < b->type->length) { + b->num_array_elements = b->type->length; + b->array_elements = reralloc(this->mem_ctx, + b->array_elements, + unsigned, + b->num_array_elements); + + for (unsigned i = 0; i < b->num_array_elements; i++) { + b->array_elements[i] = i; + } + } } return visit_continue_with_parent; diff --git a/mesalib/src/glsl/link_uniform_blocks.cpp b/mesalib/src/glsl/link_uniform_blocks.cpp index 53a18c934..fef3626bf 100644 --- a/mesalib/src/glsl/link_uniform_blocks.cpp +++ b/mesalib/src/glsl/link_uniform_blocks.cpp @@ -92,13 +92,13 @@ private: unsigned len = strlen(close_bracket + 1) + 1; memmove(open_bracket, close_bracket + 1, len); - } else { + } else { v->IndexName = v->Name; } const unsigned alignment = record_type - ? record_type->std140_base_alignment(v->RowMajor) - : type->std140_base_alignment(v->RowMajor); + ? record_type->std140_base_alignment(v->RowMajor) + : type->std140_base_alignment(v->RowMajor); unsigned size = type->std140_size(v->RowMajor); this->offset = glsl_align(this->offset, alignment); diff --git a/mesalib/src/glsl/lower_ubo_reference.cpp b/mesalib/src/glsl/lower_ubo_reference.cpp index 90e65bd0e..67b752d3d 100644 --- a/mesalib/src/glsl/lower_ubo_reference.cpp +++ b/mesalib/src/glsl/lower_ubo_reference.cpp @@ -57,7 +57,7 @@ public: void *mem_ctx; struct gl_shader *shader; struct gl_uniform_buffer_variable *ubo_var; - unsigned uniform_block; + ir_rvalue *uniform_block; bool progress; }; @@ -69,9 +69,11 @@ public: * \c UniformBlocks array. */ static const char * -interface_field_name(void *mem_ctx, char *base_name, ir_dereference *d) +interface_field_name(void *mem_ctx, char *base_name, ir_dereference *d, + ir_rvalue **nonconst_block_index) { - ir_constant *previous_index = NULL; + ir_rvalue *previous_index = NULL; + *nonconst_block_index = NULL; while (d != NULL) { switch (d->ir_type) { @@ -79,13 +81,21 @@ interface_field_name(void *mem_ctx, char *base_name, ir_dereference *d) ir_dereference_variable *v = (ir_dereference_variable *) d; if (previous_index && v->var->is_interface_instance() - && v->var->type->is_array()) - return ralloc_asprintf(mem_ctx, - "%s[%d]", - base_name, - previous_index->get_uint_component(0)); - else + && v->var->type->is_array()) { + + ir_constant *const_index = previous_index->as_constant(); + if (!const_index) { + *nonconst_block_index = previous_index; + return ralloc_asprintf(mem_ctx, "%s[0]", base_name); + } else { + return ralloc_asprintf(mem_ctx, + "%s[%d]", + base_name, + const_index->get_uint_component(0)); + } + } else { return base_name; + } break; } @@ -101,7 +111,8 @@ interface_field_name(void *mem_ctx, char *base_name, ir_dereference *d) ir_dereference_array *a = (ir_dereference_array *) d; d = a->array->as_dereference(); - previous_index = a->array_index->as_constant(); + previous_index = a->array_index; + break; } @@ -131,14 +142,24 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) mem_ctx = ralloc_parent(*rvalue); + ir_rvalue *nonconst_block_index; const char *const field_name = interface_field_name(mem_ctx, (char *) var->get_interface_type()->name, - deref); + deref, &nonconst_block_index); - this->uniform_block = -1; + this->uniform_block = NULL; for (unsigned i = 0; i < shader->NumUniformBlocks; i++) { if (strcmp(field_name, shader->UniformBlocks[i].Name) == 0) { - this->uniform_block = i; + + ir_constant *index = new(mem_ctx) ir_constant(i); + + if (nonconst_block_index) { + if (nonconst_block_index->type != glsl_type::uint_type) + nonconst_block_index = i2u(nonconst_block_index); + this->uniform_block = add(nonconst_block_index, index); + } else { + this->uniform_block = index; + } struct gl_uniform_block *block = &shader->UniformBlocks[i]; @@ -149,7 +170,7 @@ lower_ubo_reference_visitor::handle_rvalue(ir_rvalue **rvalue) } } - assert(this->uniform_block != (unsigned) -1); + assert(this->uniform_block); ir_rvalue *offset = new(mem_ctx) ir_constant(0u); unsigned const_offset = 0; @@ -267,11 +288,12 @@ ir_expression * lower_ubo_reference_visitor::ubo_load(const glsl_type *type, ir_rvalue *offset) { + ir_rvalue *block_ref = this->uniform_block->clone(mem_ctx, NULL); return new(mem_ctx) ir_expression(ir_binop_ubo_load, - type, - new(mem_ctx) ir_constant(this->uniform_block), - offset); + type, + block_ref, + offset); } diff --git a/mesalib/src/mapi/glapi/gen/ARB_clear_texture.xml b/mesalib/src/mapi/glapi/gen/ARB_clear_texture.xml new file mode 100644 index 000000000..bd9116f8b --- /dev/null +++ b/mesalib/src/mapi/glapi/gen/ARB_clear_texture.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mesalib/src/mapi/glapi/gen/Makefile.am b/mesalib/src/mapi/glapi/gen/Makefile.am index be7d9e0ef..212731fa4 100644 --- a/mesalib/src/mapi/glapi/gen/Makefile.am +++ b/mesalib/src/mapi/glapi/gen/Makefile.am @@ -112,6 +112,7 @@ API_XML = \ ARB_base_instance.xml \ ARB_blend_func_extended.xml \ ARB_clear_buffer_object.xml \ + ARB_clear_texture.xml \ ARB_color_buffer_float.xml \ ARB_compressed_texture_pixel_storage.xml \ ARB_compute_shader.xml \ diff --git a/mesalib/src/mapi/glapi/gen/gl_API.xml b/mesalib/src/mapi/glapi/gen/gl_API.xml index 882e66e0b..e011509e5 100644 --- a/mesalib/src/mapi/glapi/gen/gl_API.xml +++ b/mesalib/src/mapi/glapi/gen/gl_API.xml @@ -8358,7 +8358,9 @@ - + + + diff --git a/mesalib/src/mesa/drivers/common/driverfuncs.c b/mesalib/src/mesa/drivers/common/driverfuncs.c index 6ece5d80e..4f0f7a686 100644 --- a/mesalib/src/mesa/drivers/common/driverfuncs.c +++ b/mesalib/src/mesa/drivers/common/driverfuncs.c @@ -95,6 +95,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->TexImage = _mesa_store_teximage; driver->TexSubImage = _mesa_store_texsubimage; driver->GetTexImage = _mesa_meta_GetTexImage; + driver->ClearTexSubImage = _mesa_meta_ClearTexSubImage; driver->CopyTexSubImage = _mesa_meta_CopyTexSubImage; driver->GenerateMipmap = _mesa_meta_GenerateMipmap; driver->TestProxyTexImage = _mesa_test_proxy_teximage; diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 89d7a157c..b12898f26 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -40,6 +40,7 @@ #include "main/blit.h" #include "main/bufferobj.h" #include "main/buffers.h" +#include "main/clear.h" #include "main/colortab.h" #include "main/condrender.h" #include "main/depth.h" @@ -47,6 +48,7 @@ #include "main/fbobject.h" #include "main/feedback.h" #include "main/formats.h" +#include "main/format_unpack.h" #include "main/glformats.h" #include "main/image.h" #include "main/macros.h" @@ -71,6 +73,7 @@ #include "main/teximage.h" #include "main/texparam.h" #include "main/texstate.h" +#include "main/texstore.h" #include "main/transformfeedback.h" #include "main/uniforms.h" #include "main/varray.h" @@ -505,6 +508,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, GL_FALSE); } + if (state & MESA_META_DITHER) { + save->DitherFlag = ctx->Color.DitherFlag; + _mesa_set_enable(ctx, GL_DITHER, GL_TRUE); + } + if (state & MESA_META_COLOR_MASK) { memcpy(save->ColorMask, ctx->Color.ColorMask, sizeof(ctx->Color.ColorMask)); @@ -875,6 +883,9 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_set_enable(ctx, GL_COLOR_LOGIC_OP, save->ColorLogicOpEnabled); } + if (state & MESA_META_DITHER) + _mesa_set_enable(ctx, GL_DITHER, save->DitherFlag); + if (state & MESA_META_COLOR_MASK) { GLuint i; for (i = 0; i < ctx->Const.MaxDrawBuffers; i++) { @@ -3339,3 +3350,189 @@ _mesa_meta_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, _mesa_meta_end(ctx); } + +static bool +cleartexsubimage_color(struct gl_context *ctx, + struct gl_texture_image *texImage, + const GLvoid *clearValue, + GLint zoffset) +{ + mesa_format format; + union gl_color_union colorValue; + GLenum datatype; + GLenum status; + + _mesa_meta_bind_fbo_image(GL_COLOR_ATTACHMENT0, texImage, zoffset); + + status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) + return false; + + /* We don't want to apply an sRGB conversion so override the format */ + format = _mesa_get_srgb_format_linear(texImage->TexFormat); + datatype = _mesa_get_format_datatype(format); + + switch (datatype) { + case GL_UNSIGNED_INT: + case GL_INT: + if (clearValue) + _mesa_unpack_uint_rgba_row(format, 1, clearValue, + (GLuint (*)[4]) colorValue.ui); + else + memset(&colorValue, 0, sizeof colorValue); + if (datatype == GL_INT) + _mesa_ClearBufferiv(GL_COLOR, 0, colorValue.i); + else + _mesa_ClearBufferuiv(GL_COLOR, 0, colorValue.ui); + break; + default: + if (clearValue) + _mesa_unpack_rgba_row(format, 1, clearValue, + (GLfloat (*)[4]) colorValue.f); + else + memset(&colorValue, 0, sizeof colorValue); + _mesa_ClearBufferfv(GL_COLOR, 0, colorValue.f); + break; + } + + return true; +} + +static bool +cleartexsubimage_depth_stencil(struct gl_context *ctx, + struct gl_texture_image *texImage, + const GLvoid *clearValue, + GLint zoffset) +{ + GLint stencilValue; + GLfloat depthValue; + GLenum status; + + _mesa_meta_bind_fbo_image(GL_DEPTH_ATTACHMENT, texImage, zoffset); + + if (texImage->_BaseFormat == GL_DEPTH_STENCIL) + _mesa_meta_bind_fbo_image(GL_STENCIL_ATTACHMENT, texImage, zoffset); + + status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER); + if (status != GL_FRAMEBUFFER_COMPLETE) + return false; + + if (clearValue) { + GLuint depthStencilValue[2]; + + /* Convert the clearValue from whatever format it's in to a floating + * point value for the depth and an integer value for the stencil index + */ + _mesa_unpack_float_32_uint_24_8_depth_stencil_row(texImage->TexFormat, + 1, /* n */ + clearValue, + depthStencilValue); + /* We need a memcpy here instead of a cast because we need to + * reinterpret the bytes as a float rather than converting it + */ + memcpy(&depthValue, depthStencilValue, sizeof depthValue); + stencilValue = depthStencilValue[1] & 0xff; + } else { + depthValue = 0.0f; + stencilValue = 0; + } + + if (texImage->_BaseFormat == GL_DEPTH_STENCIL) + _mesa_ClearBufferfi(GL_DEPTH_STENCIL, 0, depthValue, stencilValue); + else + _mesa_ClearBufferfv(GL_DEPTH, 0, &depthValue); + + return true; +} + +static bool +cleartexsubimage_for_zoffset(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint zoffset, + const GLvoid *clearValue) +{ + GLuint fbo; + bool success; + + _mesa_GenFramebuffers(1, &fbo); + _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); + + switch(texImage->_BaseFormat) { + case GL_DEPTH_STENCIL: + case GL_DEPTH_COMPONENT: + success = cleartexsubimage_depth_stencil(ctx, texImage, + clearValue, zoffset); + break; + default: + success = cleartexsubimage_color(ctx, texImage, clearValue, zoffset); + break; + } + + _mesa_DeleteFramebuffers(1, &fbo); + + return success; +} + +static bool +cleartexsubimage_using_fbo(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + const GLvoid *clearValue) +{ + bool success = true; + GLint z; + + _mesa_meta_begin(ctx, + MESA_META_SCISSOR | + MESA_META_COLOR_MASK | + MESA_META_DITHER | + MESA_META_FRAMEBUFFER_SRGB); + + _mesa_set_enable(ctx, GL_DITHER, GL_FALSE); + + _mesa_set_enable(ctx, GL_SCISSOR_TEST, GL_TRUE); + _mesa_Scissor(xoffset, yoffset, width, height); + + for (z = zoffset; z < zoffset + depth; z++) { + if (!cleartexsubimage_for_zoffset(ctx, texImage, z, clearValue)) { + success = false; + break; + } + } + + _mesa_meta_end(ctx); + + return success; +} + +extern void +_mesa_meta_ClearTexSubImage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + const GLvoid *clearValue) +{ + bool res; + + _mesa_unlock_texture(ctx, texImage->TexObject); + + res = cleartexsubimage_using_fbo(ctx, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + clearValue); + + _mesa_lock_texture(ctx, texImage->TexObject); + + if (res) + return; + + _mesa_warning(ctx, + "Falling back to mapping the texture in " + "glClearTexSubImage\n"); + + _mesa_store_cleartexsubimage(ctx, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + clearValue); +} diff --git a/mesalib/src/mesa/drivers/common/meta.h b/mesalib/src/mesa/drivers/common/meta.h index 765f8dfe4..b269dceed 100644 --- a/mesalib/src/mesa/drivers/common/meta.h +++ b/mesalib/src/mesa/drivers/common/meta.h @@ -59,6 +59,7 @@ #define MESA_META_FRAMEBUFFER_SRGB 0x200000 #define MESA_META_OCCLUSION_QUERY 0x400000 #define MESA_META_DRAW_BUFFERS 0x800000 +#define MESA_META_DITHER 0x1000000 /**\}*/ /** @@ -84,6 +85,9 @@ struct save_state GLbitfield BlendEnabled; GLboolean ColorLogicOpEnabled; + /** MESA_META_DITHER */ + GLboolean DitherFlag; + /** MESA_META_COLOR_MASK */ GLubyte ColorMask[MAX_DRAW_BUFFERS][4]; @@ -472,6 +476,13 @@ _mesa_meta_CopyTexSubImage(struct gl_context *ctx, GLuint dims, GLint x, GLint y, GLsizei width, GLsizei height); +extern void +_mesa_meta_ClearTexSubImage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + const GLvoid *clearValue); + extern void _mesa_meta_GetTexImage(struct gl_context *ctx, GLenum format, GLenum type, GLvoid *pixels, diff --git a/mesalib/src/mesa/main/config.h b/mesalib/src/mesa/main/config.h index c96502a7f..4ec4b7502 100644 --- a/mesalib/src/mesa/main/config.h +++ b/mesalib/src/mesa/main/config.h @@ -289,6 +289,17 @@ #define PERFQUERY_HAVE_GPA_EXTENDED_COUNTERS 0 /*@}*/ +/** For GL_ARB_compute_shader */ +/*@{*/ +#define MAX_COMPUTE_UNIFORM_BLOCKS 12 +#define MAX_COMPUTE_TEXTURE_IMAGE_UNITS 16 +#define MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 8 +#define MAX_COMPUTE_ATOMIC_COUNTERS 8 +#define MAX_COMPUTE_SHARED_MEMORY_SIZE 32768 +#define MAX_COMPUTE_UNIFORM_COMPONENTS 512 +#define MAX_COMPUTE_IMAGE_UNIFORMS 8 +/*@}*/ + /* * Color channel component order * diff --git a/mesalib/src/mesa/main/dd.h b/mesalib/src/mesa/main/dd.h index 633ea2c3a..89765351e 100644 --- a/mesalib/src/mesa/main/dd.h +++ b/mesalib/src/mesa/main/dd.h @@ -238,6 +238,20 @@ struct dd_function_table { GLenum format, GLenum type, GLvoid *pixels, struct gl_texture_image *texImage ); + /** + * Called by glClearTex[Sub]Image + * + * Clears a rectangular region of the image to a given value. The + * clearValue argument is either NULL or points to a single texel to use as + * the clear value in the same internal format as the texture image. If it + * is NULL then the texture should be cleared to zeroes. + */ + void (*ClearTexSubImage)(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + const GLvoid *clearValue); + /** * Called by glCopyTex[Sub]Image[123]D(). * diff --git a/mesalib/src/mesa/main/extensions.c b/mesalib/src/mesa/main/extensions.c index 92e3f0d68..9ac8377a4 100644 --- a/mesalib/src/mesa/main/extensions.c +++ b/mesalib/src/mesa/main/extensions.c @@ -90,6 +90,7 @@ static const struct extension extension_table[] = { { "GL_ARB_blend_func_extended", o(ARB_blend_func_extended), GL, 2009 }, { "GL_ARB_buffer_storage", o(ARB_buffer_storage), GL, 2013 }, { "GL_ARB_clear_buffer_object", o(dummy_true), GL, 2012 }, + { "GL_ARB_clear_texture", o(ARB_clear_texture), GL, 2013 }, { "GL_ARB_color_buffer_float", o(ARB_color_buffer_float), GL, 2004 }, { "GL_ARB_compressed_texture_pixel_storage", o(dummy_true), GL, 2011 }, { "GL_ARB_compute_shader", o(ARB_compute_shader), GL, 2012 }, diff --git a/mesalib/src/mesa/main/get_hash_params.py b/mesalib/src/mesa/main/get_hash_params.py index d45962d95..35d6172a3 100644 --- a/mesalib/src/mesa/main/get_hash_params.py +++ b/mesalib/src/mesa/main/get_hash_params.py @@ -774,6 +774,13 @@ descriptor=[ # GL_ARB_compute_shader [ "MAX_COMPUTE_WORK_GROUP_INVOCATIONS", "CONTEXT_INT(Const.MaxComputeWorkGroupInvocations), extra_ARB_compute_shader" ], + [ "MAX_COMPUTE_UNIFORM_BLOCKS", "CONST(MAX_COMPUTE_UNIFORM_BLOCKS), extra_ARB_compute_shader" ], + [ "MAX_COMPUTE_TEXTURE_IMAGE_UNITS", "CONST(MAX_COMPUTE_TEXTURE_IMAGE_UNITS), extra_ARB_compute_shader" ], + [ "MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS", "CONST(MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS), extra_ARB_compute_shader" ], + [ "MAX_COMPUTE_ATOMIC_COUNTERS", "CONST(MAX_COMPUTE_ATOMIC_COUNTERS), extra_ARB_compute_shader" ], + [ "MAX_COMPUTE_SHARED_MEMORY_SIZE", "CONST(MAX_COMPUTE_SHARED_MEMORY_SIZE), extra_ARB_compute_shader" ], + [ "MAX_COMPUTE_UNIFORM_COMPONENTS", "CONST(MAX_COMPUTE_UNIFORM_COMPONENTS), extra_ARB_compute_shader" ], + [ "MAX_COMPUTE_IMAGE_UNIFORMS", "CONST(MAX_COMPUTE_IMAGE_UNIFORMS), extra_ARB_compute_shader" ], # GL_ARB_gpu_shader5 [ "MAX_GEOMETRY_SHADER_INVOCATIONS", "CONST(MAX_GEOMETRY_SHADER_INVOCATIONS), extra_ARB_gpu_shader5" ], diff --git a/mesalib/src/mesa/main/imports.h b/mesalib/src/mesa/main/imports.h index af780b249..09e55ebf0 100644 --- a/mesalib/src/mesa/main/imports.h +++ b/mesalib/src/mesa/main/imports.h @@ -274,10 +274,12 @@ static inline int IROUND_POS(float f) return (int) (f + 0.5F); } +#ifdef __x86_64__ +# include +#endif /** * Convert float to int using a fast method. The rounding mode may vary. - * XXX We could use an x86-64/SSE2 version here. */ static inline int F_TO_I(float f) { @@ -292,6 +294,8 @@ static inline int F_TO_I(float f) fistp r } return r; +#elif defined(__x86_64__) + return _mm_cvt_ss2si(_mm_load_ss(&f)); #else return IROUND(f); #endif diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index 91d9172f9..3f60a5530 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -3527,6 +3527,7 @@ struct gl_extensions GLboolean ARB_base_instance; GLboolean ARB_blend_func_extended; GLboolean ARB_buffer_storage; + GLboolean ARB_clear_texture; GLboolean ARB_color_buffer_float; GLboolean ARB_compute_shader; GLboolean ARB_conservative_depth; diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index a06959463..fb2dee7d8 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -51,6 +51,7 @@ #include "textureview.h" #include "mtypes.h" #include "glformats.h" +#include "texstore.h" /** @@ -2010,6 +2011,43 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx, return true; } +static bool +texture_formats_agree(GLenum internalFormat, + GLenum format) +{ + GLboolean colorFormat; + GLboolean is_format_depth_or_depthstencil; + GLboolean is_internalFormat_depth_or_depthstencil; + + /* Even though there are no color-index textures, we still have to support + * uploading color-index data and remapping it to RGB via the + * GL_PIXEL_MAP_I_TO_[RGBA] tables. + */ + const GLboolean indexFormat = (format == GL_COLOR_INDEX); + + is_internalFormat_depth_or_depthstencil = + _mesa_is_depth_format(internalFormat) || + _mesa_is_depthstencil_format(internalFormat); + + is_format_depth_or_depthstencil = + _mesa_is_depth_format(format) || + _mesa_is_depthstencil_format(format); + + colorFormat = _mesa_is_color_format(format); + + if (_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) + return false; + + if (is_internalFormat_depth_or_depthstencil != + is_format_depth_or_depthstencil) + return false; + + if (_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format)) + return false; + + return true; +} + /** * Test the glTexImage[123]D() parameters for errors. * @@ -2043,17 +2081,8 @@ texture_error_check( struct gl_context *ctx, GLint width, GLint height, GLint depth, GLint border ) { - GLboolean colorFormat; - GLboolean is_format_depth_or_depthstencil; - GLboolean is_internalFormat_depth_or_depthstencil; GLenum err; - /* Even though there are no color-index textures, we still have to support - * uploading color-index data and remapping it to RGB via the - * GL_PIXEL_MAP_I_TO_[RGBA] tables. - */ - const GLboolean indexFormat = (format == GL_COLOR_INDEX); - /* Note: for proxy textures, some error conditions immediately generate * a GL error in the usual way. But others do not generate a GL error. * Instead, they cause the width, height, depth, format fields of the @@ -2136,18 +2165,7 @@ texture_error_check( struct gl_context *ctx, } /* make sure internal format and format basically agree */ - is_internalFormat_depth_or_depthstencil = - _mesa_is_depth_format(internalFormat) || - _mesa_is_depthstencil_format(internalFormat); - - is_format_depth_or_depthstencil = - _mesa_is_depth_format(format) || - _mesa_is_depthstencil_format(format); - - colorFormat = _mesa_is_color_format(format); - if ((_mesa_is_color_format(internalFormat) && !colorFormat && !indexFormat) || - (is_internalFormat_depth_or_depthstencil != is_format_depth_or_depthstencil) || - (_mesa_is_ycbcr_format(internalFormat) != _mesa_is_ycbcr_format(format))) { + if (!texture_formats_agree(internalFormat, format)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTexImage%dD(incompatible internalFormat = %s, format = %s)", dimensions, _mesa_lookup_enum_by_nr(internalFormat), @@ -3818,6 +3836,266 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, x, y, width, height); } +static bool +check_clear_tex_image(struct gl_context *ctx, + const char *function, + struct gl_texture_image *texImage, + GLenum format, GLenum type, + const void *data, + GLubyte *clearValue) +{ + struct gl_texture_object *texObj = texImage->TexObject; + static const GLubyte zeroData[MAX_PIXEL_BYTES]; + GLenum internalFormat = texImage->InternalFormat; + GLenum err; + + if (texObj->Target == GL_TEXTURE_BUFFER) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(buffer texture)", function); + return false; + } + + if (_mesa_is_compressed_format(ctx, internalFormat)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(compressed texture)", function); + return false; + } + + err = _mesa_error_check_format_and_type(ctx, format, type); + if (err != GL_NO_ERROR) { + _mesa_error(ctx, err, + "%s(incompatible format = %s, type = %s)", + function, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type)); + return false; + } + + /* make sure internal format and format basically agree */ + if (!texture_formats_agree(internalFormat, format)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(incompatible internalFormat = %s, format = %s)", + function, + _mesa_lookup_enum_by_nr(internalFormat), + _mesa_lookup_enum_by_nr(format)); + return false; + } + + if (ctx->Version >= 30 || ctx->Extensions.EXT_texture_integer) { + /* both source and dest must be integer-valued, or neither */ + if (_mesa_is_format_integer_color(texImage->TexFormat) != + _mesa_is_enum_format_integer(format)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(integer/non-integer format mismatch)", + function); + return false; + } + } + + if (!_mesa_texstore(ctx, + 1, /* dims */ + texImage->_BaseFormat, + texImage->TexFormat, + 0, /* dstRowStride */ + &clearValue, + 1, 1, 1, /* srcWidth/Height/Depth */ + format, type, + data ? data : zeroData, + &ctx->DefaultPacking)) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid format)", function); + return false; + } + + return true; +} + +static struct gl_texture_object * +get_tex_obj_for_clear(struct gl_context *ctx, + const char *function, + GLuint texture) +{ + struct gl_texture_object *texObj; + + if (texture == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(zero texture)", function); + return NULL; + } + + texObj = _mesa_lookup_texture(ctx, texture); + + if (texObj == NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(non-gen name)", function); + return NULL; + } + + if (texObj->Target == 0) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(unbound tex)", function); + return NULL; + } + + return texObj; +} + +static int +get_tex_images_for_clear(struct gl_context *ctx, + const char *function, + struct gl_texture_object *texObj, + GLint level, + struct gl_texture_image **texImages) +{ + GLenum target; + int i; + + if (level < 0 || level >= MAX_TEXTURE_LEVELS) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid level)", function); + return 0; + } + + if (texObj->Target == GL_TEXTURE_CUBE_MAP) { + for (i = 0; i < MAX_FACES; i++) { + target = GL_TEXTURE_CUBE_MAP_POSITIVE_X + i; + + texImages[i] = _mesa_select_tex_image(ctx, texObj, target, level); + if (texImages[i] == NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "%s(invalid level)", function); + return 0; + } + } + + return MAX_FACES; + } + + texImages[0] = _mesa_select_tex_image(ctx, texObj, texObj->Target, level); + + if (texImages[0] == NULL) { + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid level)", function); + return 0; + } + + return 1; +} + +void GLAPIENTRY +_mesa_ClearTexSubImage( GLuint texture, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, const void *data ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object *texObj; + struct gl_texture_image *texImages[MAX_FACES]; + GLubyte clearValue[MAX_FACES][MAX_PIXEL_BYTES]; + int i, numImages; + int minDepth, maxDepth; + + texObj = get_tex_obj_for_clear(ctx, "glClearTexSubImage", texture); + + if (texObj == NULL) + return; + + _mesa_lock_texture(ctx, texObj); + + numImages = get_tex_images_for_clear(ctx, "glClearTexSubImage", + texObj, level, texImages); + if (numImages == 0) + goto out; + + if (numImages == 1) { + minDepth = -(int) texImages[0]->Border; + maxDepth = texImages[0]->Depth; + } else { + minDepth = 0; + maxDepth = numImages; + } + + if (xoffset < -(GLint) texImages[0]->Border || + yoffset < -(GLint) texImages[0]->Border || + zoffset < minDepth || + width < 0 || + height < 0 || + depth < 0 || + xoffset + width > texImages[0]->Width || + yoffset + height > texImages[0]->Height || + zoffset + depth > maxDepth) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glClearSubTexImage(invalid dimensions)"); + goto out; + } + + if (numImages == 1) { + if (check_clear_tex_image(ctx, "glClearTexSubImage", + texImages[0], + format, type, data, clearValue[0])) { + ctx->Driver.ClearTexSubImage(ctx, + texImages[0], + xoffset, yoffset, zoffset, + width, height, depth, + data ? clearValue[0] : NULL); + } + } else { + for (i = zoffset; i < zoffset + depth; i++) { + if (!check_clear_tex_image(ctx, "glClearTexSubImage", + texImages[i], + format, type, data, clearValue[i])) + goto out; + } + for (i = zoffset; i < zoffset + depth; i++) { + ctx->Driver.ClearTexSubImage(ctx, + texImages[i], + xoffset, yoffset, 0, + width, height, 1, + data ? clearValue[i] : NULL); + } + } + + out: + _mesa_unlock_texture(ctx, texObj); +} + +void GLAPIENTRY +_mesa_ClearTexImage( GLuint texture, GLint level, + GLenum format, GLenum type, const void *data ) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object *texObj; + struct gl_texture_image *texImages[MAX_FACES]; + GLubyte clearValue[MAX_FACES][MAX_PIXEL_BYTES]; + int i, numImages; + + texObj = get_tex_obj_for_clear(ctx, "glClearTexImage", texture); + + if (texObj == NULL) + return; + + _mesa_lock_texture(ctx, texObj); + + numImages = get_tex_images_for_clear(ctx, "glClearTexImage", + texObj, level, texImages); + + for (i = 0; i < numImages; i++) { + if (!check_clear_tex_image(ctx, "glClearTexImage", + texImages[i], + format, type, data, + clearValue[i])) + goto out; + } + + for (i = 0; i < numImages; i++) { + ctx->Driver.ClearTexSubImage(ctx, texImages[i], + -(GLint) texImages[i]->Border, /* xoffset */ + -(GLint) texImages[i]->Border, /* yoffset */ + -(GLint) texImages[i]->Border, /* zoffset */ + texImages[i]->Width, + texImages[i]->Height, + texImages[i]->Depth, + data ? clearValue[i] : NULL); + } + +out: + _mesa_unlock_texture(ctx, texObj); +} + @@ -4578,7 +4856,6 @@ _mesa_TexStorage2DMultisample(GLenum target, GLsizei samples, "glTexStorage2DMultisample"); } - void GLAPIENTRY _mesa_TexStorage3DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, diff --git a/mesalib/src/mesa/main/teximage.h b/mesalib/src/mesa/main/teximage.h index dd1504b40..42305f44f 100644 --- a/mesalib/src/mesa/main/teximage.h +++ b/mesalib/src/mesa/main/teximage.h @@ -260,6 +260,16 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, +extern void GLAPIENTRY +_mesa_ClearTexSubImage( GLuint texture, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLenum type, const void *data ); + +extern void GLAPIENTRY +_mesa_ClearTexImage( GLuint texture, GLint level, + GLenum format, GLenum type, const void *data ); + extern void GLAPIENTRY _mesa_CompressedTexImage1D(GLenum target, GLint level, GLenum internalformat, GLsizei width, diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index d363f9faa..aea53f8d1 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -3830,6 +3830,21 @@ _mesa_texstore_can_use_memcpy(struct gl_context *ctx, return GL_FALSE; } + /* Depth texture data needs clamping in following cases: + * - Floating point dstFormat with signed srcType: clamp to [0.0, 1.0]. + * - Fixed point dstFormat with signed srcType: clamp to [0, 2^n -1]. + * + * All the cases except one (float dstFormat with float srcType) are ruled + * out by _mesa_format_matches_format_and_type() check above. Handle the + * remaining case here. + */ + if ((baseInternalFormat == GL_DEPTH_COMPONENT || + baseInternalFormat == GL_DEPTH_STENCIL) && + (srcType == GL_FLOAT || + srcType == GL_FLOAT_32_UNSIGNED_INT_24_8_REV)) { + return GL_FALSE; + } + return GL_TRUE; } @@ -4079,6 +4094,78 @@ _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, format, type, pixels, packing, "glTexSubImage"); } +static void +clear_image_to_zero(GLubyte *dstMap, GLint dstRowStride, + GLsizei width, GLsizei height, + GLsizei clearValueSize) +{ + GLsizei y; + + for (y = 0; y < height; y++) { + memset(dstMap, 0, clearValueSize * width); + dstMap += dstRowStride; + } +} + +static void +clear_image_to_value(GLubyte *dstMap, GLint dstRowStride, + GLsizei width, GLsizei height, + const GLvoid *clearValue, + GLsizei clearValueSize) +{ + GLsizei y, x; + + for (y = 0; y < height; y++) { + for (x = 0; x < width; x++) { + memcpy(dstMap, clearValue, clearValueSize); + dstMap += clearValueSize; + } + dstMap += dstRowStride - clearValueSize * width; + } +} + +/* + * Fallback for Driver.ClearTexSubImage(). + */ +void +_mesa_store_cleartexsubimage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + const GLvoid *clearValue) +{ + GLubyte *dstMap; + GLint dstRowStride; + GLsizeiptr clearValueSize; + GLsizei z; + + clearValueSize = _mesa_get_format_bytes(texImage->TexFormat); + + for (z = 0; z < depth; z++) { + ctx->Driver.MapTextureImage(ctx, texImage, + z + zoffset, xoffset, yoffset, + width, height, + GL_MAP_WRITE_BIT, + &dstMap, &dstRowStride); + if (dstMap == NULL) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glClearTex*Image"); + return; + } + + if (clearValue) { + clear_image_to_value(dstMap, dstRowStride, + width, height, + clearValue, + clearValueSize); + } else { + clear_image_to_zero(dstMap, dstRowStride, + width, height, + clearValueSize); + } + + ctx->Driver.UnmapTextureImage(ctx, texImage, z + zoffset); + } +} /** * Fallback for Driver.CompressedTexImage() diff --git a/mesalib/src/mesa/main/texstore.h b/mesalib/src/mesa/main/texstore.h index c4cfffde6..dd1e1d015 100644 --- a/mesalib/src/mesa/main/texstore.h +++ b/mesalib/src/mesa/main/texstore.h @@ -117,6 +117,13 @@ _mesa_store_texsubimage(struct gl_context *ctx, GLuint dims, const struct gl_pixelstore_attrib *packing); +extern void +_mesa_store_cleartexsubimage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + const GLvoid *clearValue); + extern void _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, diff --git a/mesalib/src/mesa/main/uniform_query.cpp b/mesalib/src/mesa/main/uniform_query.cpp index 480bc6f16..609d94bd7 100644 --- a/mesalib/src/mesa/main/uniform_query.cpp +++ b/mesalib/src/mesa/main/uniform_query.cpp @@ -91,7 +91,7 @@ _mesa_GetActiveUniformsiv(GLuint program, if (uniformCount < 0) { _mesa_error(ctx, GL_INVALID_VALUE, - "glGetUniformIndices(uniformCount < 0)"); + "glGetActiveUniformsiv(uniformCount < 0)"); return; } diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 5c51e63d9..5ea146547 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2028,6 +2028,15 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) */ emit(ir, TGSI_OPCODE_MAD, result_dst, op[0], op[1], op[2]); break; + case ir_unop_interpolate_at_centroid: + emit(ir, TGSI_OPCODE_INTERP_CENTROID, result_dst, op[0]); + break; + case ir_binop_interpolate_at_offset: + emit(ir, TGSI_OPCODE_INTERP_OFFSET, result_dst, op[0], op[1]); + break; + case ir_binop_interpolate_at_sample: + emit(ir, TGSI_OPCODE_INTERP_SAMPLE, result_dst, op[0], op[1]); + break; case ir_unop_pack_snorm_2x16: case ir_unop_pack_unorm_2x16: case ir_unop_pack_half_2x16: @@ -2049,9 +2058,6 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) case ir_binop_ldexp: case ir_binop_carry: case ir_binop_borrow: - case ir_unop_interpolate_at_centroid: - case ir_binop_interpolate_at_offset: - case ir_binop_interpolate_at_sample: /* This operation is not supported, or should have already been handled. */ assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()"); diff --git a/tools/plink/ssh.c b/tools/plink/ssh.c index 7e63b4e0b..893321e2b 100644 --- a/tools/plink/ssh.c +++ b/tools/plink/ssh.c @@ -6226,6 +6226,10 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, pktin->savedpos += 16; /* skip garbage cookie */ ssh_pkt_getstring(pktin, &str, &len); /* key exchange algorithms */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } preferred = NULL; for (i = 0; i < s->n_preferred_kex; i++) { @@ -6245,8 +6249,8 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, break; } if (!ssh->kex) { - bombout(("Couldn't agree a key exchange algorithm (available: %s)", - str ? str : "(null)")); + bombout(("Couldn't agree a key exchange algorithm" + " (available: %.*s)", len, str)); crStopV; } /* @@ -6256,6 +6260,10 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, */ s->guessok = first_in_commasep_string(preferred, str, len); ssh_pkt_getstring(pktin, &str, &len); /* host key algorithms */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } for (i = 0; i < lenof(hostkey_algs); i++) { if (in_commasep_string(hostkey_algs[i]->name, str, len)) { ssh->hostkey = hostkey_algs[i]; @@ -6263,14 +6271,18 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, } } if (!ssh->hostkey) { - bombout(("Couldn't agree a host key algorithm (available: %s)", - str ? str : "(null)")); + bombout(("Couldn't agree a host key algorithm" + " (available: %.*s)", len, str)); crStopV; } s->guessok = s->guessok && first_in_commasep_string(hostkey_algs[0]->name, str, len); ssh_pkt_getstring(pktin, &str, &len); /* client->server cipher */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } for (i = 0; i < s->n_preferred_ciphers; i++) { const struct ssh2_ciphers *c = s->preferred_ciphers[i]; if (!c) { @@ -6287,12 +6299,16 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, break; } if (!s->cscipher_tobe) { - bombout(("Couldn't agree a client-to-server cipher (available: %s)", - str ? str : "(null)")); + bombout(("Couldn't agree a client-to-server cipher" + " (available: %.*s)", len, str)); crStopV; } ssh_pkt_getstring(pktin, &str, &len); /* server->client cipher */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } for (i = 0; i < s->n_preferred_ciphers; i++) { const struct ssh2_ciphers *c = s->preferred_ciphers[i]; if (!c) { @@ -6309,12 +6325,16 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, break; } if (!s->sccipher_tobe) { - bombout(("Couldn't agree a server-to-client cipher (available: %s)", - str ? str : "(null)")); + bombout(("Couldn't agree a server-to-client cipher" + " (available: %.*s)", len, str)); crStopV; } ssh_pkt_getstring(pktin, &str, &len); /* client->server mac */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } for (i = 0; i < s->nmacs; i++) { if (in_commasep_string(s->maclist[i]->name, str, len)) { s->csmac_tobe = s->maclist[i]; @@ -6322,6 +6342,10 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, } } ssh_pkt_getstring(pktin, &str, &len); /* server->client mac */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } for (i = 0; i < s->nmacs; i++) { if (in_commasep_string(s->maclist[i]->name, str, len)) { s->scmac_tobe = s->maclist[i]; @@ -6329,6 +6353,10 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, } } ssh_pkt_getstring(pktin, &str, &len); /* client->server compression */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } for (i = 0; i < lenof(compressions) + 1; i++) { const struct ssh_compress *c = i == 0 ? s->preferred_comp : compressions[i - 1]; @@ -6345,6 +6373,10 @@ static void do_ssh2_transport(Ssh ssh, void *vin, int inlen, } } ssh_pkt_getstring(pktin, &str, &len); /* server->client compression */ + if (!str) { + bombout(("KEXINIT packet was incomplete")); + crStopV; + } for (i = 0; i < lenof(compressions) + 1; i++) { const struct ssh_compress *c = i == 0 ? s->preferred_comp : compressions[i - 1]; diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index 4338dc551..f3d9654a4 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -139,7 +139,8 @@ AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h dlfcn.h stropts.h \ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_TYPEOF -AC_C_BIGENDIAN([ENDIAN="X_BIG_ENDIAN"], [ENDIAN="X_LITTLE_ENDIAN"]) +AC_C_BIGENDIAN(AC_DEFINE(X_BYTE_ORDER, X_BIG_ENDIAN, [byte order]), + AC_DEFINE(X_BYTE_ORDER, X_LITTLE_ENDIAN, [byte order])) AC_CHECK_SIZEOF([unsigned long]) if test "$ac_cv_sizeof_unsigned_long" = 8; then @@ -648,6 +649,7 @@ AC_ARG_ENABLE(kdrive-kbd, AS_HELP_STRING([--enable-kdrive-kbd], [Build kbd d AC_ARG_ENABLE(kdrive-mouse, AS_HELP_STRING([--enable-kdrive-mouse], [Build mouse driver for kdrive (default: auto)]), [KDRIVE_MOUSE=$enableval], [KDRIVE_MOUSE=auto]) AC_ARG_ENABLE(kdrive-evdev, AS_HELP_STRING([--enable-kdrive-evdev], [Build evdev driver for kdrive (default: auto)]), [KDRIVE_EVDEV=$enableval], [KDRIVE_EVDEV=auto]) AC_ARG_ENABLE(libunwind, AS_HELP_STRING([--enable-libunwind], [Use libunwind for backtracing (default: auto)]), [LIBUNWIND="$enableval"], [LIBUNWIND="auto"]) +AC_ARG_ENABLE(xshmfence, AS_HELP_STRING([--disable-xshmfence], [Disable xshmfence (default: auto)]), [XSHMFENCE="$enableval"], [XSHMFENCE="auto"]) dnl chown/chmod to be setuid root as part of build @@ -787,7 +789,7 @@ DMXPROTO="dmxproto >= 2.2.99.1" VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" WINDOWSWMPROTO="windowswmproto" APPLEWMPROTO="applewmproto >= 1.4" -XSHMFENCE="xshmfence >= 1.1" +LIBXSHMFENCE="xshmfence >= 1.1" dnl Required modules XPROTO="xproto >= 7.0.26" @@ -1235,20 +1237,23 @@ esac AM_CONDITIONAL(BUSFAULT, test x"$BUSFAULT" = xyes) -PKG_CHECK_MODULES([XSHMFENCE], $XSHMFENCE, - [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no]) -AM_CONDITIONAL(XSHMFENCE, test "x$HAVE_XSHMFENCE" = xyes) +PKG_CHECK_MODULES([XSHMFENCE], $LIBXSHMFENCE, [HAVE_XSHMFENCE=yes], [HAVE_XSHMFENCE=no]) +if test "x$XSHMFENCE" = "xauto"; then + XSHMFENCE="$HAVE_XSHMFENCE" +fi -case x"$HAVE_XSHMFENCE" in - xyes) - AC_DEFINE(HAVE_XSHMFENCE, 1, [Have X Shared Memory Fence library]) - REQUIRED_LIBS="$REQUIRED_LIBS xshmfence" - ;; -esac +if test "x$XSHMFENCE" = "xyes"; then + if test "x$HAVE_XSHMFENCE" != "xyes"; then + AC_MSG_ERROR([xshmfence requested but not installed.]) + fi + AC_DEFINE(HAVE_XSHMFENCE, 1, [Have xshmfence support]) + REQUIRED_LIBS="$REQUIRED_LIBS $LIBXSHMFENCE" +fi +AM_CONDITIONAL(XSHMFENCE, [test "x$XSHMFENCE" = xyes]) -case "$DRI3,$HAVE_XSHMFENCE" in +case "$DRI3,$XSHMFENCE" in yes,yes | auto,yes) ;; yes,no) diff --git a/xorg-server/glamor/glamor_sync.c b/xorg-server/glamor/glamor_sync.c index d3d64a925..5e158c33a 100644 --- a/xorg-server/glamor/glamor_sync.c +++ b/xorg-server/glamor/glamor_sync.c @@ -53,7 +53,7 @@ glamor_sync_fence_set_triggered (SyncFence *fence) /* Flush pending rendering operations */ glamor_make_current(glamor); - glFinish(); + glFlush(); fence->funcs.SetTriggered = glamor_fence->set_triggered; fence->funcs.SetTriggered(fence); diff --git a/xorg-server/hw/xfree86/i2c/Makefile.am b/xorg-server/hw/xfree86/i2c/Makefile.am index c31159196..8bf795ded 100644 --- a/xorg-server/hw/xfree86/i2c/Makefile.am +++ b/xorg-server/hw/xfree86/i2c/Makefile.am @@ -1,43 +1,9 @@ noinst_LTLIBRARIES = libi2c.la -multimediadir = $(moduledir)/multimedia -multimedia_LTLIBRARIES = \ - bt829_drv.la \ - fi1236_drv.la \ - msp3430_drv.la \ - tda8425_drv.la \ - tda9850_drv.la \ - tda9885_drv.la \ - uda1380_drv.la - libi2c_la_SOURCES = xf86i2c.c AM_CPPFLAGS = $(XORG_INCS) AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) -sdk_HEADERS = xf86i2c.h bt829.h fi1236.h msp3430.h tda8425.h tda9850.h tda9885.h uda1380.h i2c_def.h - -# -# i2c drivers -# -bt829_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -bt829_drv_la_SOURCES = bt829.c bt829.h bt829_module.c - -fi1236_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -fi1236_drv_la_SOURCES = fi1236.c fi1236.h fi1236_module.c tda9885.c - -msp3430_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -msp3430_drv_la_SOURCES = msp3430.c msp3430.h msp3430_module.c - -tda8425_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -tda8425_drv_la_SOURCES = tda8425.c tda8425.h tda8425_module.c - -tda9850_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -tda9850_drv_la_SOURCES = tda9850.c tda9850.h tda9850_module.c - -tda9885_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -tda9885_drv_la_SOURCES = tda9885.c tda9885.h tda9885_module.c - -uda1380_drv_la_LDFLAGS = -module -avoid-version $(LD_NO_UNDEFINED_FLAG) -uda1380_drv_la_SOURCES = uda1380.c uda1380.h uda1380_module.c +sdk_HEADERS = xf86i2c.h i2c_def.h diff --git a/xorg-server/hw/xfree86/i2c/bt829.c b/xorg-server/hw/xfree86/i2c/bt829.c deleted file mode 100644 index 991c26eab..000000000 --- a/xorg-server/hw/xfree86/i2c/bt829.c +++ /dev/null @@ -1,822 +0,0 @@ -/* TODO: clean up/fix CC code */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include - -#include "xf86.h" -#include "xf86i2c.h" -#include "bt829.h" -#include "i2c_def.h" - -/* Changing the following settings (especially VCROP) may */ -/* require modifying code that calls this driver. */ -#define HCROP 0 /* amount to crop from the left and right edges */ -#define VCROP 0 /* amount to crop from the top and bottom edges */ - -#define BTVERSION (bt->id>>4) - -#define H(X) ( ((X)>>8) & 0xFF ) -#define L(X) ( (X) & 0xFF ) - -#define LIMIT(X,A,B) (((X)<(A)) ? (A) : ((X)>(B)) ? (B) : (X) ) - -/* Bt829 family chip ID's */ -#define BT815 0x02 -#define BT817 0x06 -#define BT819 0x07 -#define BT827 0x0C -#define BT829 0x0E - -/* Bt829 registers */ -#define STATUS 0x00 /* Device Status */ -#define IFORM 0x01 /* Input Format */ -#define TDEC 0x02 /* Temporal Decimation */ -#define CROP 0x03 /* MSB Cropping */ -#define VDELAY_LO 0x04 /* Vertical Delay */ -#define VACTIVE_LO 0x05 /* Vertical Active */ -#define HDELAY_LO 0x06 /* Horizontal Delay */ -#define HACTIVE_LO 0x07 /* Horizontal Active */ -#define HSCALE_HI 0x08 /* Horizontal Scaling */ -#define HSCALE_LO 0x09 /* Horizontal Scaling */ -#define BRIGHT 0x0A /* Brightness Control */ -#define CONTROL 0x0B /* Miscellaneous Control */ -#define CONTRAST_LO 0x0C /* Luma Gain (Contrast) */ -#define SAT_U_LO 0x0D /* Chroma (U) Gain (Saturation) */ -#define SAT_V_LO 0x0E /* Chroma (V) Gain (Saturation) */ -#define HUE 0x0F /* Hue Control */ -#define SCLOOP 0x10 /* SC Loop Control */ -#define WC_UP 0x11 /* White Crush Up Count */ -#define OFORM 0x12 /* Output Format */ -#define VSCALE_HI 0x13 /* Vertical Scaling */ -#define VSCALE_LO 0x14 /* Vertical Scaling */ -#define TEST 0x15 /* Test Control */ -#define VPOLE 0x16 /* Video Timing Polarity */ -#define IDCODE 0x17 /* ID Code */ -#define ADELAY 0x18 /* AGC Delay */ -#define BDELAY 0x19 /* Burst Gate Delay */ -#define ADC 0x1A /* ADC Interface */ -#define VTC 0x1B /* Video Timing Control */ -#define CC_STATUS 0x1C /* Extended Data Services/Closed Capt Status */ -#define CC_DATA 0x1D /* Extended Data Services/Closed Capt Data */ -#define WC_DN 0x1E /* White Crush Down Count */ -#define SRESET 0x1F /* Software Reset */ -#define P_IO 0x3F /* Programmable I/O */ - -static CARD8 -btread(BT829Ptr bt, CARD8 reg) -{ - CARD8 v; - - I2C_WriteRead(&(bt->d), ®, 1, &v, 1); - - return v; -} - -static void -btwrite(BT829Ptr bt, CARD8 reg, CARD8 val) -{ - CARD8 data[2]; - - data[0] = reg; - data[1] = val; - I2C_WriteRead(&(bt->d), data, 2, NULL, 0); -} - -/* - * Register access - */ -static void -btwrite_status(BT829Ptr bt) -{ /* STATUS */ - btwrite(bt, STATUS, 0x00); /* clear */ -} - -static void -btwrite_iform(BT829Ptr bt) -{ /* IFORM */ - int xtsel; - - switch (bt->format) { - case BT829_NTSC: - case BT829_NTSC_JAPAN: - case BT829_PAL_M: - case BT829_PAL_N_COMB: /* gatos says xtsel = 2 */ - xtsel = 1; - break; - case BT829_PAL: - case BT829_PAL_N: - case BT829_SECAM: - xtsel = 2; - break; - default: /* shouldn't get here */ - xtsel = 3; /* hardware default */ - break; - } - - btwrite(bt, IFORM, (bt->mux << 5) | (xtsel << 3) | bt->format); -} - -static void -btwrite_tdec(BT829Ptr bt) -{ /* TDEC */ - /* use default */ -} - -static void -btwrite_crop(BT829Ptr bt) -{ /* CROP */ - btwrite(bt, CROP, (H(bt->vdelay) << 6) | (H(bt->vactive) << 4) | - (H(bt->hdelay) << 2) | H(bt->width)); -} - -static void -btwrite_vdelay_lo(BT829Ptr bt) -{ /* VDELAY_LO */ - btwrite(bt, VDELAY_LO, L(bt->vdelay)); -} - -static void -btwrite_vactive_lo(BT829Ptr bt) -{ /* VACTIVE_LO */ - btwrite(bt, VACTIVE_LO, L(bt->vactive)); -} - -static void -btwrite_hdelay_lo(BT829Ptr bt) -{ /* HDELAY_LO */ - btwrite(bt, HDELAY_LO, L(bt->hdelay)); -} - -static void -btwrite_hactive_lo(BT829Ptr bt) -{ /* HACTIVE_LO */ - btwrite(bt, HACTIVE_LO, L(bt->width)); -} - -static void -btwrite_hscale_hi(BT829Ptr bt) -{ /* HSCALE_HI */ - btwrite(bt, HSCALE_HI, H(bt->hscale)); -} - -static void -btwrite_hscale_lo(BT829Ptr bt) -{ /* HSCALE_LO */ - btwrite(bt, HSCALE_LO, L(bt->hscale)); -} - -static void -btwrite_bright(BT829Ptr bt) -{ /* BRIGHT */ - btwrite(bt, BRIGHT, bt->brightness); -} - -static void -btwrite_control(BT829Ptr bt) -{ /* CONTROL */ - int ldec; - - /* The data sheet says ldec should always be 0 for SECAM */ - /* but the picture quality is better with ldec = 1 */ - ldec = (bt->width > 360); /* gatos says 384 */ - - btwrite(bt, CONTROL, ((bt->mux == bt->svideo_mux) ? 0xC0 : 0x00) | /* LNOTCH and COMP */ - (ldec << 5) | (H(bt->contrast) << 2) | (H(bt->sat_u) << 1) | H(bt-> - sat_v)); -} - -static void -btwrite_contrast_lo(BT829Ptr bt) -{ /* CONTRAST_LO */ - btwrite(bt, CONTRAST_LO, L(bt->contrast)); -} - -static void -btwrite_sat_u_lo(BT829Ptr bt) -{ /* SAT_U_LO */ - btwrite(bt, SAT_U_LO, L(bt->sat_u)); -} - -static void -btwrite_sat_v_lo(BT829Ptr bt) -{ /* SAT_V_LO */ - btwrite(bt, SAT_V_LO, L(bt->sat_v)); -} - -static void -btwrite_hue(BT829Ptr bt) -{ /* HUE */ - btwrite(bt, HUE, bt->hue); -} - -static void -btwrite_scloop(BT829Ptr bt) -{ /* SCLOOP */ - if (BTVERSION >= BT827) { - btwrite(bt, SCLOOP, (bt->format == BT829_SECAM) ? 0x10 : 0x00 /* QCIF or AUTO */ - ); - } -} - -static void -btwrite_wc_up(BT829Ptr bt) -{ /* WC_UP */ - if (BTVERSION >= BT827) { - /* use default */ - } -} - -static void -btwrite_oform(BT829Ptr bt) -{ /* OFORM */ - btwrite(bt, OFORM, (bt->code << 3) | (bt->len << 2) | 0x02 /* RANGE = 0, CORE = 0, VBI_FRAME = 0, OES = 2 (default) */ - ); -} - -static void -btwrite_vscale_hi(BT829Ptr bt) -{ /* VSCALE_HI */ - btwrite(bt, VSCALE_HI, H(bt->vscale) | 0x60 /* YCOMB = 0, COMB = 1, INT = 1 (default) */ - ); -} - -static void -btwrite_vscale_lo(BT829Ptr bt) -{ /* VSCALE_LO */ - btwrite(bt, VSCALE_LO, L(bt->vscale)); -} - -/* TEST should not be written to */ - -static void -btwrite_vpole(BT829Ptr bt) -{ /* VPOLE */ - btwrite(bt, VPOLE, (bt->out_en << 7)); -} - -/* IDCODE is read only */ - -static void -btwrite_adelay(BT829Ptr bt) -{ /* ADELAY */ - switch (bt->format) { - case BT829_NTSC: - case BT829_NTSC_JAPAN: - case BT829_PAL_M: - btwrite(bt, ADELAY, 104); - break; - case BT829_PAL: - case BT829_PAL_N: - case BT829_SECAM: - case BT829_PAL_N_COMB: - btwrite(bt, ADELAY, 127); - break; - default: /* shouldn't get here */ - btwrite(bt, ADELAY, 104); /* hardware default */ - break; - } -} - -static void -btwrite_bdelay(BT829Ptr bt) -{ /* BDELAY */ - switch (bt->format) { - case BT829_NTSC: - case BT829_NTSC_JAPAN: - case BT829_PAL_M: - btwrite(bt, BDELAY, 93); - break; - case BT829_PAL: - case BT829_PAL_N: - case BT829_PAL_N_COMB: - btwrite(bt, BDELAY, 114); - break; - case BT829_SECAM: - btwrite(bt, BDELAY, 160); - break; - default: /* shouldn't get here */ - btwrite(bt, BDELAY, 93); /* hardware default */ - break; - } -} - -static void -btwrite_adc(BT829Ptr bt) -{ /* ADC */ - btwrite(bt, ADC, bt->mux == bt->svideo_mux ? 0x80 : 0x82); /* CSLEEP = 0 or 1 */ -} - -static void -btwrite_vtc(BT829Ptr bt) -{ /* VTC */ - int vfilt = 0; /* hardware default */ - - if (BTVERSION > BT827) { /* gatos says >= BT827 */ - switch (bt->format) { - case BT829_NTSC: - case BT829_NTSC_JAPAN: - case BT829_PAL_M: - case BT829_PAL_N_COMB: /* gatos groups with BT829_PAL */ - if (bt->width <= 360) - vfilt = 1; /* gatos says <= 240 */ - if (bt->width <= 180) - vfilt = 2; /* gatos says <= 120 */ - if (bt->width <= 90) - vfilt = 3; /* gatos says <= 60 */ - break; - case BT829_PAL: - case BT829_PAL_N: - case BT829_SECAM: - if (bt->width <= 384) - vfilt = 1; - if (bt->width <= 192) - vfilt = 2; - if (bt->width <= 96) - vfilt = 3; - break; - default: /* shouldn't get here */ - break; /* use hardware default */ - } - btwrite(bt, VTC, (bt->vbien << 4) | (bt->vbifmt << 3) | vfilt); - } -} - -static void -btwrite_cc_status(BT829Ptr bt) -{ /* CC_STATUS *//* FIXME: ATI specific */ - if (BTVERSION >= BT827) { - if (bt->ccmode == 0) - btwrite(bt, CC_STATUS, 0x00); - /* 0x40 is activate to set the CCVALID line. Not required yet */ - else - btwrite(bt, CC_STATUS, (bt->ccmode << 4) | 0x40); - } -} - -/* CC_DATA is read only */ - -static void -btwrite_wc_dn(BT829Ptr bt) -{ /* WC_DN */ - if (BTVERSION >= BT827) { - /* use default */ - } -} - -static void -bt_reset(BT829Ptr bt) -{ /* SRESET */ - btwrite(bt, SRESET, 0x0); /* Reset all registers */ -} - -static void -btwrite_p_io(BT829Ptr bt) -{ /* P_IO */ - if (BTVERSION >= BT827) { - btwrite(bt, P_IO, bt->p_io); - } -} - -/* - * Deal with dependencies - */ -static void -propagate_changes(BT829Ptr bt) -{ - CARD16 hdelay, unscaled_hdelay, vdelay, hscale, vscale; - int htotal, vactive; - - switch (bt->format) { - case BT829_NTSC: - case BT829_NTSC_JAPAN: - case BT829_PAL_M: - vdelay = 22; - htotal = 754; - vactive = 480; - unscaled_hdelay = 135; - break; - case BT829_PAL: - case BT829_PAL_N: - vdelay = (bt->tunertype == 5) ? 34 : 22; - htotal = 922; - vactive = 576; - unscaled_hdelay = 186; - break; - case BT829_SECAM: - vdelay = 34; - htotal = 922; - vactive = 576; - unscaled_hdelay = 186; - break; - case BT829_PAL_N_COMB: - vdelay = (bt->tunertype == 5) ? 34 : 22; /* windows says 22 */ - htotal = 754; /* gatos and windows say 922 */ - vactive = 576; - unscaled_hdelay = 135; /* gatos and windows say 186 */ - break; - default: /* shouldn't get here */ - vdelay = 22; /* hardware default */ - htotal = 754; - vactive = 480; /* hardware default */ - unscaled_hdelay = 135; - break; - } - - bt->htotal = htotal; /* Used for error checking in bt829_SetCaptSize */ - - hscale = 4096 * htotal / (bt->width + 2 * HCROP) - 4096; - hdelay = - (HCROP + (bt->width + 2 * HCROP) * unscaled_hdelay / htotal) & 0x3FE; - - vactive = vactive - 2 * VCROP; - vdelay = vdelay + VCROP; - vscale = (0x10000 - (512 * vactive / bt->height - 512)) & 0x1FFF; - - if ((hdelay != bt->hdelay) || (vdelay != bt->vdelay) || - (vactive != bt->vactive) || (hscale != bt->hscale) || - (vscale != bt->vscale)) { - bt->hdelay = hdelay; - bt->vdelay = vdelay; - bt->vactive = vactive; - bt->hscale = hscale; - bt->vscale = vscale; - btwrite_crop(bt); - btwrite_vdelay_lo(bt); - btwrite_vactive_lo(bt); - btwrite_hdelay_lo(bt); - btwrite_hscale_hi(bt); - btwrite_hscale_lo(bt); - btwrite_control(bt); - btwrite_vscale_hi(bt); - btwrite_vscale_lo(bt); - } -} - -static void -write_all(BT829Ptr bt) -{ - bt_reset(bt); - propagate_changes(bt); /* ensure consistency */ - btwrite_iform(bt); - btwrite_tdec(bt); - btwrite_crop(bt); - btwrite_vdelay_lo(bt); - btwrite_vactive_lo(bt); - btwrite_hdelay_lo(bt); - btwrite_hactive_lo(bt); - btwrite_hscale_hi(bt); - btwrite_hscale_lo(bt); - btwrite_bright(bt); - btwrite_control(bt); - btwrite_contrast_lo(bt); - btwrite_sat_u_lo(bt); - btwrite_sat_v_lo(bt); - btwrite_hue(bt); - btwrite_scloop(bt); - btwrite_wc_up(bt); - btwrite_oform(bt); - btwrite_vscale_hi(bt); - btwrite_vscale_lo(bt); - btwrite_vpole(bt); - btwrite_adelay(bt); - btwrite_bdelay(bt); - btwrite_adc(bt); - btwrite_vtc(bt); - /* btwrite_cc_status(bt); *//* FIXME: CC code needs cleaning */ - btwrite_wc_dn(bt); - btwrite_p_io(bt); -} - -/* - * Public functions - */ -BT829Ptr -bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr) -{ - BT829Ptr bt; - I2CByte a; - char *devname; - - bt = calloc(1, sizeof(BT829Rec)); - if (bt == NULL) - return NULL; - bt->d.DevName = strdup("BT829 video decoder"); - bt->d.SlaveAddr = addr; - bt->d.pI2CBus = b; - bt->d.NextDev = NULL; - bt->d.StartTimeout = b->StartTimeout; - bt->d.BitTimeout = b->BitTimeout; - bt->d.AcknTimeout = b->AcknTimeout; - bt->d.ByteTimeout = b->ByteTimeout; - - if (!I2C_WriteRead(&(bt->d), NULL, 0, &a, 1)) { - free(bt); - return NULL; - } - - bt->id = btread(bt, IDCODE); - - free((void *) bt->d.DevName); - bt->d.DevName = devname = calloc(200, sizeof(char)); - switch (BTVERSION) { - case BT815: - sprintf(devname, "bt815a video decoder, revision %d", - bt->id & 0xf); - break; - case BT817: - sprintf(devname, "bt817a video decoder, revision %d", - bt->id & 0xf); - break; - case BT819: - sprintf(devname, "bt819a video decoder, revision %d", - bt->id & 0xf); - break; - case BT827: - sprintf(devname, "bt827a/b video decoder, revision %d", - bt->id & 0xf); - break; - case BT829: - sprintf(devname, "bt829a/b video decoder, revision %d", - bt->id & 0xf); - break; - default: - sprintf(devname, - "bt8xx/unknown video decoder version %d, revision %d", - bt->id >> 4, bt->id & 0xf); - break; - } - - /* set default parameters */ - if (!I2CDevInit(&(bt->d))) { - free(bt); - return NULL; - } - - bt->tunertype = 1; - - bt->brightness = 0; /* hardware default */ - bt->ccmode = 0; - bt->code = 0; /* hardware default */ - bt->contrast = 216; /* hardware default */ - bt->format = BT829_NTSC; - bt->height = 480; /* hardware default for vactive */ - bt->hue = 0; /* hardware default */ - bt->len = 1; /* hardware default */ - bt->mux = BT829_MUX0; /* hardware default */ - bt->out_en = 0; /* hardware default */ - bt->p_io = 0; /* hardware default */ - bt->sat_u = 254; /* hardware default */ - bt->sat_v = 180; /* hardware default */ - bt->vbien = 0; /* hardware default */ - bt->vbifmt = 0; /* hardware default */ - bt->width = 640; /* hardware default for hactive */ - - bt->hdelay = 120; /* hardware default */ - bt->hscale = 684; /* hardware default */ - bt->vactive = 480; /* hardware default */ - bt->vdelay = 22; /* hardware default */ - bt->vscale = 0; /* hardware default */ - - bt->htotal = 754; /* NTSC */ - bt->svideo_mux = 0; /* no s-video */ - - return bt; -} - -int -bt829_ATIInit(BT829Ptr bt) -{ - bt->code = 1; - bt->len = 0; - bt->vbien = 1; - bt->vbifmt = 1; - bt->svideo_mux = BT829_MUX1; - - write_all(bt); - - return 0; -} - -int -bt829_SetFormat(BT829Ptr bt, CARD8 format) -{ - if ((format < 1) || (format > 7)) - return -1; - if ((BTVERSION <= BT819) && (format != BT829_NTSC) && (format != BT829_PAL)) - return -1; - if (format == bt->format) - return 0; - bt->format = format; - propagate_changes(bt); - btwrite_iform(bt); - btwrite_scloop(bt); - btwrite_adelay(bt); - btwrite_bdelay(bt); - btwrite_vtc(bt); - return 0; -} - -int -bt829_SetMux(BT829Ptr bt, CARD8 mux) -{ - if ((mux < 1) || (mux > 3)) - return -1; - if (mux == bt->mux) - return 0; - bt->mux = mux; - /* propagate_changes(bt); *//* no dependencies */ - btwrite_iform(bt); - btwrite_control(bt); - btwrite_adc(bt); - return 0; -} - -void -bt829_SetBrightness(BT829Ptr bt, int brightness) -{ - brightness = LIMIT(brightness, -1000, 999); /* ensure -128 <= brightness <= 127 below */ - brightness = (128 * brightness) / 1000; - if (brightness == bt->brightness) - return; - bt->brightness = brightness; - /* propagate_changes(bt); *//* no dependencies */ - btwrite_bright(bt); -} - -void -bt829_SetContrast(BT829Ptr bt, int contrast) -{ - contrast = LIMIT(contrast, -1000, 1000); - contrast = (216 * (contrast + 1000)) / 1000; - if (contrast == bt->contrast) - return; - bt->contrast = contrast; - /* propagate_changes(bt); *//* no dependencies */ - btwrite_control(bt); - btwrite_contrast_lo(bt); -} - -void -bt829_SetSaturation(BT829Ptr bt, int saturation) -{ - CARD16 sat_u, sat_v; - - saturation = LIMIT(saturation, -1000, 1000); - sat_u = (254 * (saturation + 1000)) / 1000; - sat_v = (180 * (saturation + 1000)) / 1000; - if ((sat_u == bt->sat_u) && (sat_v == bt->sat_v)) - return; - bt->sat_u = sat_u; - bt->sat_v = sat_v; - /* propagate_changes(bt); *//* no dependencies */ - btwrite_control(bt); - btwrite_sat_u_lo(bt); - btwrite_sat_v_lo(bt); -} - -void -bt829_SetTint(BT829Ptr bt, int hue) -{ - hue = LIMIT(hue, -1000, 999); /* ensure -128 <= hue <= 127 below */ - hue = (128 * hue) / 1000; - if (hue == bt->hue) - return; - bt->hue = hue; - /* propagate_changes(bt); *//* no dependencies */ - btwrite_hue(bt); -} - -int -bt829_SetCaptSize(BT829Ptr bt, int width, int height) -{ - if ((width > bt->htotal - 2 * HCROP) || - (16 * width < bt->htotal - 32 * HCROP)) - return -1; - if ((height > bt->vactive) || (16 * height < bt->vactive)) - return -1; - if ((width == bt->width) && (height == bt->height)) - return 0; - bt->width = width; - bt->height = height; - propagate_changes(bt); - btwrite_crop(bt); - btwrite_hactive_lo(bt); - btwrite_control(bt); - btwrite_vtc(bt); - return 0; -} - -int -bt829_SetCC(BT829Ptr bt) -{ /* FIXME: should take ccmode as a parameter */ - if (BTVERSION < BT827) - return -1; /* can't do it */ - /* propagate_changes(bt); *//* no dependencies */ - btwrite_cc_status(bt); - /* we write to STATUS to reset the CCVALID flag */ - if (bt->ccmode != 0) - btwrite_status(bt); - return 0; -} - -void -bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en) -{ - out_en = (out_en != 0); - if (out_en == bt->out_en) - return; - bt->out_en = out_en; - /* propagate_changes(bt); *//* no dependencies */ - btwrite_vpole(bt); -} - -void -bt829_SetP_IO(BT829Ptr bt, CARD8 p_io) -{ - if (p_io == bt->p_io) - return; - bt->p_io = p_io; - /* propagate_changes(bt); *//* no dependencies */ - btwrite_p_io(bt); -} - -#define BTREAD(R) btread(bt,(R)) - -#if 0 - -void -bt829_getCCdata(BT829Ptr bt, struct CCdata *data) -{ - CARD8 status; - - data->num_valid = 0; - /* wait for buffer to be half full (means 8/16 bytes) - * either 4 (one of CC/EDS) or 2 (both CC/EDS) frames */ - if (!(BTREAD(STATUS) & 0x04)) - return; /* could comment this line */ - for (; data->num_valid < CC_FIFO_SIZE; data->num_valid++) { - status = BTREAD(CC_STATUS); - if (!(status & 0x04)) - break; - data->data[data->num_valid] = BTREAD(CC_DATA) & 0x7f; - /* stripped high bit (parity) */ - data->status[data->num_valid] = (CCS_EDS * ((status & 0x02) >> 1)) | - (CCS_HIGH * (status & 0x01)) | - (CCS_OVER * ((status & 0x08) >> 3)) | - (CCS_PAR * ((status & 0x80) >> 7)); - } - btwrite(bt, STATUS, 0x00); /* Reset CCVALID status bit */ - return; -} - -#endif - -/* ------------------------------------------------------------------------ */ -/* Debug and report routines */ - -#define DUMPREG(REG) \ - xf86DrvMsg(bt->d.pI2CBus->scrnIndex,X_INFO," %-12s (0x%02X) = 0x%02X\n", \ - #REG,REG,BTREAD(REG)) - -/*static void bt829_dumpregs(BT829Ptr bt) -{ - DUMPREG(STATUS); - DUMPREG(IFORM); - DUMPREG(TDEC); - DUMPREG(CROP); - DUMPREG(VDELAY_LO); - DUMPREG(VACTIVE_LO); - DUMPREG(HDELAY_LO); - DUMPREG(HACTIVE_LO); - DUMPREG(HSCALE_HI); - DUMPREG(HSCALE_LO); - DUMPREG(BRIGHT); - DUMPREG(CONTROL); - DUMPREG(CONTRAST_LO); - DUMPREG(SAT_U_LO); - DUMPREG(SAT_V_LO); - DUMPREG(HUE); - if (BTVERSION >= BT827) { - DUMPREG(SCLOOP); - DUMPREG(WC_UP) ; } - DUMPREG(OFORM); - DUMPREG(VSCALE_HI); - DUMPREG(VSCALE_LO); - DUMPREG(TEST); - DUMPREG(VPOLE); - DUMPREG(IDCODE); - DUMPREG(ADELAY); - DUMPREG(BDELAY); - DUMPREG(ADC); - if (BTVERSION >= BT827) { - DUMPREG(VTC); - DUMPREG(CC_STATUS); - DUMPREG(CC_DATA); - DUMPREG(WC_DN); - DUMPREG(P_IO) ; } -}*/ diff --git a/xorg-server/hw/xfree86/i2c/bt829.h b/xorg-server/hw/xfree86/i2c/bt829.h deleted file mode 100644 index 2709bee50..000000000 --- a/xorg-server/hw/xfree86/i2c/bt829.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef __BT829_H__ -#define __BT829_H__ - -#include "xf86i2c.h" - -typedef struct { - int tunertype; /* Must be set before init */ - /* Private variables */ - I2CDevRec d; - - CARD8 brightness; - CARD8 ccmode; - CARD8 code; - CARD16 contrast; - CARD8 format; - int height; - CARD8 hue; - CARD8 len; - CARD8 mux; - CARD8 out_en; - CARD8 p_io; - CARD16 sat_u; - CARD16 sat_v; - CARD8 vbien; - CARD8 vbifmt; - int width; - - CARD16 hdelay; - CARD16 hscale; - CARD16 vactive; - CARD16 vdelay; - CARD16 vscale; - - CARD16 htotal; - CARD8 id; - CARD8 svideo_mux; -} BT829Rec, *BT829Ptr; - -#define xf86_bt829_Detect bt829_Detect -extern _X_EXPORT BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr); - -/* ATI card specific initialization */ -#define BT829_ATI_ADDR_1 0x8A -#define BT829_ATI_ADDR_2 0x88 - -#define xf86_bt829_ATIInit bt829_ATIInit -extern _X_EXPORT int bt829_ATIInit(BT829Ptr bt); - -#define BT829_NTSC 1 /* NTSC-M */ -#define BT829_NTSC_JAPAN 2 /* NTSC-Japan */ -#define BT829_PAL 3 /* PAL-B,D,G,H,I */ -#define BT829_PAL_M 4 /* PAL-M */ -#define BT829_PAL_N 5 /* PAL-N */ -#define BT829_SECAM 6 /* SECAM */ -#define BT829_PAL_N_COMB 7 /* PAL-N combination */ - -#define xf86_bt829_SetFormat bt829_SetFormat -extern _X_EXPORT int bt829_SetFormat(BT829Ptr bt, CARD8 format); - -#define BT829_MUX2 1 /* ATI -> composite video */ -#define BT829_MUX0 2 /* ATI -> tv tuner */ -#define BT829_MUX1 3 /* ATI -> s-video */ - -#define xf86_bt829_SetMux bt829_SetMux -extern _X_EXPORT int bt829_SetMux(BT829Ptr bt, CARD8 mux); - -#define xf86_bt829_SetCaptSize bt829_SetCaptSize -extern _X_EXPORT int bt829_SetCaptSize(BT829Ptr bt, int width, int height); - -#define xf86_bt829_SetBrightness bt829_SetBrightness -extern _X_EXPORT void bt829_SetBrightness(BT829Ptr bt, int brightness); - -#define xf86_bt829_SetContrast bt829_SetContrast -extern _X_EXPORT void bt829_SetContrast(BT829Ptr bt, int contrast); - -#define xf86_bt829_SetSaturation bt829_SetSaturation -extern _X_EXPORT void bt829_SetSaturation(BT829Ptr bt, int saturation); - -#define xf86_bt829_SetTint bt829_SetTint -extern _X_EXPORT void bt829_SetTint(BT829Ptr bt, int hue); /* Hue */ - -#define xf86_bt829_SetOUT_EN bt829_SetOUT_EN -extern _X_EXPORT void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en); /* VPOLE register */ - -#define xf86_bt829_SetP_IO bt829_SetP_IO -extern _X_EXPORT void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io); /* P_IO register */ - -extern _X_EXPORT int bt829_SetCC(BT829Ptr bt); - -#define BT829SymbolsList \ - "bt829_Detect", \ - "bt829_ATIInit", \ - "bt829_SetFormat", \ - "bt829_SetMux", \ - "bt829_SetBrightness", \ - "bt829_SetContrast", \ - "bt829_SetSaturation", \ - "bt829_SetTint", \ - "bt829_SetCaptSize", \ - "bt829_SetOUT_EN", \ - "bt829_SetP_IO" - -#endif diff --git a/xorg-server/hw/xfree86/i2c/bt829_module.c b/xorg-server/hw/xfree86/i2c/bt829_module.c deleted file mode 100644 index c8a6ac6d1..000000000 --- a/xorg-server/hw/xfree86/i2c/bt829_module.c +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo bt829VersRec = { - "bt829", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData bt829ModuleData = { &bt829VersRec, NULL, NULL }; diff --git a/xorg-server/hw/xfree86/i2c/fi1236.c b/xorg-server/hw/xfree86/i2c/fi1236.c deleted file mode 100644 index ebd14547d..000000000 --- a/xorg-server/hw/xfree86/i2c/fi1236.c +++ /dev/null @@ -1,686 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include -#include -#include - -#include "xf86.h" -#include "xf86i2c.h" -#include "fi1236.h" -#include "tda9885.h" -#include "i2c_def.h" - -#define NUM_TUNERS 8 - -const FI1236_parameters tuner_parms[NUM_TUNERS] = { - /* 0 - FI1236 */ - {733, 884, 12820, 2516, 7220, 0xA2, 0x94, 0x34, 0x8e}, - /* !!!based on documentation - it should be: - {733, 16*55.25, 16*801.25, 16*160, 16*454, 0xA0, 0x90, 0x30, 0x8e}, */ - - /* 1 - FI1216 */ - {623, 16 * 48.75, 16 * 855.25, 16 * 170, 16 * 450, 0xA0, 0x90, 0x30, 0x8e}, - /* 2 - TEMIC FN5AL */ - {623, 16 * 45.75, 16 * 855.25, 16 * 169, 16 * 454, 0xA0, 0x90, 0x30, 0x8e}, - /* 3 - MT2032.. */ - {733, 768, 13760, 0, 0, 0, 0, 0, 0}, - /* 4 - FI1246 */ - {623, 16 * 45.75, 16 * 855.25, 16 * 170, 16 * 450, 0xA0, 0x90, 0x30, 0x8e}, - /* 5 - FI1256 */ - {623, 16 * 49.75, 16 * 863.25, 16 * 170, 16 * 450, 0xA0, 0x90, 0x30, 0x8e}, - /* 6 - FI1236W */ - /*{ 733, 884, 12820, 2516, 7220, 0x1, 0x2, 0x4, 0x8e }, */ - {732, 16 * 55.25, 16 * 801.25, 16 * 160, 16 * 442, 0x1, 0x2, 0x4, 0x8e}, - /* 7 - FM1216ME */ - {623, 16 * 48.25, 16 * 863.25, 16 * 158.00, 16 * 442.00, 0x1, 0x2, 0x4, 0x8e} -}; - -FI1236Ptr -Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr) -{ - FI1236Ptr f; - I2CByte a; - - f = calloc(1, sizeof(FI1236Rec)); - if (f == NULL) - return NULL; - f->d.DevName = strdup("FI12xx Tuner"); - f->d.SlaveAddr = addr; - f->d.pI2CBus = b; - f->d.NextDev = NULL; - f->d.StartTimeout = b->StartTimeout; - f->d.BitTimeout = b->BitTimeout; - f->d.AcknTimeout = b->AcknTimeout; - f->d.ByteTimeout = b->ByteTimeout; - f->type = TUNER_TYPE_FI1236; - f->afc_timer_installed = FALSE; - f->last_afc_hint = TUNER_OFF; - f->video_if = 45.7812; - - if (!I2C_WriteRead(&(f->d), NULL, 0, &a, 1)) { - free(f); - return NULL; - } - FI1236_set_tuner_type(f, TUNER_TYPE_FI1236); - if (!I2CDevInit(&(f->d))) { - free(f); - return NULL; - } - return f; -} - -static void -MT2032_dump_parameters(FI1236Ptr f, MT2032_parameters * m) -{ - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: input f_rf=%g f_if1=%g f_if2=%g f_ref=%g f_ifbw=%g f_step=%g\n", - m->f_rf, m->f_if1, m->f_if2, m->f_ref, m->f_ifbw, m->f_step); - - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: computed f_lo1=%g f_lo2=%g LO1I=%d LO2I=%d SEL=%d STEP=%d NUM=%d\n", - m->f_lo1, m->f_lo2, m->LO1I, m->LO2I, m->SEL, m->STEP, m->NUM); -} - -static void -MT2032_getid(FI1236Ptr f) -{ - CARD8 out[4]; - CARD8 in; - - in = 0x11; - I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 4); - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: Company code 0x%02x%02x, part code 0x%02x, revision code 0x%02x\n", - out[0], out[1], out[2], out[3]); - -} - -/* might be buggy */ -#if 0 -static void -MT2032_shutdown(FI1236Ptr f) -{ - CARD8 data[10]; - - data[0] = 0x00; /* start with register 0x00 */ - data[1] = 0x1A; - data[2] = 0x44; - data[3] = 0x20; - - I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0); - - data[0] = 0x05; /* now start with register 0x05 */ - data[1] = 0xD7; - data[2] = 0x14; - data[3] = 0x05; - I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0); - - data[0] = 0x0B; /* now start with register 0x05 */ - data[1] = 0x8F; - data[2] = 0x07; - data[3] = 0x43; - I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0); - - usleep(15000); -} -#endif - -static void MT2032_dump_status(FI1236Ptr f); - -static void -MT2032_init(FI1236Ptr f) -{ - CARD8 data[10]; - CARD8 value; - CARD8 xogc = 0x00; - - MT2032_getid(f); - - data[0] = 0x02; /* start with register 0x02 */ - data[1] = 0xFF; - data[2] = 0x0F; - data[3] = 0x1F; - - I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0); - - data[0] = 0x06; /* now start with register 0x06 */ - data[1] = 0xE4; - data[2] = 0x8F; - data[3] = 0xC3; - data[4] = 0x4E; - data[5] = 0xEC; - I2C_WriteRead(&(f->d), (I2CByte *) data, 6, NULL, 0); - - data[0] = 0x0d; /* now start with register 0x0d */ - data[1] = 0x32; - I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0); - - while (1) { - usleep(15000); /* wait 15 milliseconds */ - - data[0] = 0x0e; /* register number 7, status */ - value = 0xFF; - if (!I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1)) - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: failed to read XOK\n"); - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: XOK=%d\n", value & 0x01); - if (value & 1) - break; - - data[0] = 0x07; - if (!I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1)) - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: failed to read XOGC\n"); - - xogc = value & 0x7; - if (xogc == 4) - break; /* XOGC has reached 4.. stop */ - xogc--; - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: try XOGC=%d\n", xogc); - usleep(15000); - data[0] = 0x07; /* register number 7, control byte 2 */ - data[1] = 0x08 | xogc; - I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0); - } - f->xogc = xogc; - /* wait before continuing */ - usleep(15000); /* wait 50 milliseconds */ - MT2032_dump_status(f); -} - -static int -MT2032_no_spur_in_band(MT2032_parameters * m) -{ - int n_max, n1, n2; - double f_test; - - n_max = 5; - n1 = 1; - while (1) { - n2 = -n1; - f_test = n1 * (m->f_lo1 - m->f_lo2); - while (1) { - n2--; - f_test = f_test - m->f_lo2; - xf86DrvMsg(0, X_INFO, - "testing f_test=%g n1=%d n2=%d f_lo1=%g f_lo2=%g f_if2=%g\n", - f_test, n1, n2, m->f_lo1, m->f_lo2, m->f_if2); - xf86DrvMsg(0, X_INFO, "d_f=%g f_ifbw=%g\n", - fabs(fabs(f_test) - m->f_if2), m->f_ifbw); - if ((fabs(fabs(f_test) - m->f_if2) * 2.0) <= m->f_ifbw) - return 0; - if (n2 <= -n_max) - break; - /* this line in the manual is bogus. I say it is faster - and more correct to go over all harmonics.. */ -#if 0 - if (f_test < (m->f_lo2 - m->f_if2 - m->f_ifbw)) - break; -#endif - } - n1++; - if (n1 >= n_max) - return 1; - } - -} - -static void -MT2032_calculate_register_settings(MT2032_parameters * m, double f_rf, - double f_if1, double f_if2, double f_ref, - double f_ifbw, double f_step) -{ - int n; - - m->f_rf = f_rf; - m->f_if1 = f_if1; - m->f_if2 = f_if2; - m->f_ref = f_ref; - m->f_ifbw = f_ifbw; - m->f_step = f_step; - - m->f_lo1 = f_rf + f_if1; - m->LO1I = lrint(m->f_lo1 / f_ref); - m->f_lo1 = f_ref * m->LO1I; - - m->f_lo2 = m->f_lo1 - f_rf - f_if2; - - /* check for spurs */ - n = 1; - while (n < 3) { - if (MT2032_no_spur_in_band(m)) - break; - - if (m->f_lo1 < (f_rf + f_if1)) - m->LO1I += n; - else - m->LO1I -= n; - - m->f_lo1 = m->LO1I * f_ref; - m->f_lo2 = m->f_lo1 - f_rf - f_if2; - n++; - } - /* xf86DrvMsg(0, X_INFO, "MT2032: n=%d\n", n); */ - /* select VCO */ - - /* m->f_lo1>1100.0 */ - if (m->f_lo1 < 1370.0) - m->SEL = 4; - else if (m->f_lo1 < 1530.0) - m->SEL = 3; - else if (m->f_lo1 < 1720.0) - m->SEL = 2; - else if (m->f_lo1 < 1890.0) - m->SEL = 1; - else /* m->f_lo1 < 1958.0 */ - m->SEL = 0; - - /* calculate the rest of the registers */ - m->LO2I = floor(m->f_lo2 / f_ref); - m->STEP = floor(3780.0 * f_step / f_ref); - m->NUM = floor(3780.0 * (m->f_lo2 / f_ref - m->LO2I)); - m->NUM = m->STEP * lrint((1.0 * m->NUM) / (1.0 * m->STEP)); -} - -static int -MT2032_wait_for_lock(FI1236Ptr f) -{ - int n; - CARD8 data[10]; - CARD8 value; - - n = 12; - while (1) { - data[0] = 0x0e; /* register number 7, status */ - I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1); - /* xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: LO1LK=%d LO2LK=%d\n", - (value & 0x04)>>2, (value & 0x02)>>1); */ - if ((value & 6) == 6) - break; - usleep(1500); - n--; - if (n < 0) - break; - } - if (n < 0) { - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: failed to set frequency\n"); - return 0; - } - return 1; -} - -static void -MT2032_implement_settings(FI1236Ptr f, MT2032_parameters * m) -{ - CARD8 data[10]; - CARD8 value; - - data[0] = 0x00; /* start with register 0x00 */ - data[1] = (m->LO1I >> 3) - 1; - data[2] = (m->SEL << 4) | (m->LO1I & 0x7); - data[3] = 0x86; - I2C_WriteRead(&(f->d), (I2CByte *) data, 4, NULL, 0); - - data[0] = 0x05; /* start with register 0x05 */ - data[1] = ((m->LO2I & 0x7) << 5) | ((m->LO2I >> 3) - 1); - if (m->f_rf < 400.0) - data[2] = 0xe4; - else - data[2] = 0xf4; - I2C_WriteRead(&(f->d), (I2CByte *) data, 3, NULL, 0); - - data[0] = 0x07; /* register number 7, control byte 2 */ - I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1); - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: using XOGC=%d\n", (value & 0x07)); - data[1] = 8 | (value & 0x7); - I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0); - - data[0] = 0x0b; /* start with register 0x0b */ - data[1] = m->NUM & 0xff; - data[2] = (1 << 7) | ((m->NUM >> 8) & 0x0f); - I2C_WriteRead(&(f->d), (I2CByte *) data, 3, NULL, 0); - - MT2032_wait_for_lock(f); -} - -static void -MT2032_optimize_VCO(FI1236Ptr f, MT2032_parameters * m) -{ - CARD8 data[10]; - CARD8 value; - CARD8 TAD1; - - data[0] = 0x0f; /* register number 7, status */ - I2C_WriteRead(&(f->d), (I2CByte *) data, 1, &value, 1); - TAD1 = value & 0x07; - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: TAD1=%d SEL=%d\n", TAD1, m->SEL); - if (TAD1 < 2) - return; - if (TAD1 == 2) { - if (m->SEL == 0) - return; - m->SEL--; - } - else { - if (m->SEL >= 4) - return; - m->SEL++; - } - data[0] = 0x01; /* start with register 1 */ - data[1] = (m->SEL << 4) | (m->LO1I & 0x7); - I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0); - -} - -static int -FI1236_get_afc_hint(FI1236Ptr f) -{ - CARD8 out; - CARD8 AFC; - - if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) { - TDA9885Ptr t = (TDA9885Ptr) f->afc_source; - - if (t == NULL) - return TUNER_OFF; - - tda9885_getstatus(t); - tda9885_dumpstatus(t); - AFC = t->afc_status & 0x0f; - - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "AFC: FI1236_get_afc_hint: %i\n", AFC); - if (AFC == 0) - return TUNER_TUNED; - else if (AFC <= 0x07) - return TUNER_JUST_BELOW; - else if (AFC < 0x0f) - return TUNER_JUST_ABOVE; - else if (AFC == 0x0f) - return TUNER_TUNED; - } - else { - I2C_WriteRead(&(f->d), NULL, 0, &out, 1); - AFC = out & 0x7; - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "AFC: FI1236_get_afc_hint: %i\n", AFC); - if (AFC == 2) - return TUNER_TUNED; - if (AFC == 3) - return TUNER_JUST_BELOW; - if (AFC == 1) - return TUNER_JUST_ABOVE; - return TUNER_OFF; - } - return TUNER_OFF; -} - -static int -MT2032_get_afc_hint(FI1236Ptr f) -{ - CARD8 in; - CARD8 out[2]; - CARD8 AFC; - - in = 0x0e; - I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 2); - AFC = (out[0] >> 4) & 0x7; -#if 0 - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC=%d TAD1=%d TAD2=%d\n", - AFC, out[1] & 0x7, (out[1] >> 4) & 0x07); -#endif - if (AFC == 2) - return TUNER_TUNED; - if (AFC == 3) - return TUNER_JUST_BELOW; - if (AFC == 1) - return TUNER_JUST_ABOVE; - return TUNER_OFF; -} - -/* this function is for external use only */ -int -TUNER_get_afc_hint(FI1236Ptr f) -{ - if (f->afc_timer_installed) - return TUNER_STILL_TUNING; - return f->last_afc_hint; -} - -static void -MT2032_dump_status(FI1236Ptr f) -{ - CARD8 in; - CARD8 out[2]; - CARD8 AFC; - CARD8 LDONrb; - CARD8 LO1LK, LO2LK, XOK; - CARD8 TAD2, TAD1; - - in = 0x0e; - I2C_WriteRead(&(f->d), (I2CByte *) &in, 1, out, 2); - XOK = out[0] & 1; - LO1LK = (out[0] >> 2) & 1; - LO2LK = (out[0] >> 1) & 1; - LDONrb = (out[0] >> 3) & 1; - - AFC = (out[0] >> 4) & 0x7; - - TAD1 = (out[1] & 0x7); - TAD2 = (out[1] >> 4) & 0x7; - - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: status: XOK=%d LO1LK=%d LO2LK=%d LDONrb=%d AFC=%d TAD1=%d TAD2=%d\n", - XOK, LO1LK, LO2LK, LDONrb, AFC, TAD1, TAD2); - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: status: OSCILLATOR:%s PLL1:%s PLL2:%s\n", - XOK ? "ok" : "off", - LO1LK ? "locked" : "off", LO2LK ? "locked" : "off"); - -} - -static void -MT2032_tune(FI1236Ptr f, double freq, double step) -{ - MT2032_parameters m; - CARD8 data[10]; - int i; - - /* NTSC IF is 44mhz.. but 733/16=45.8125 and all TDAXXXX docs mention - 45.75, 39, 58.75 and 30. */ -#if 0 - MT2032_calculate_register_settings(&m, freq, 1090.0, 45.125, 5.25, 6.0, - step); - MT2032_calculate_register_settings(&m, freq, 1090.0, 45.74, 5.25, 6.0, - step); -#endif - MT2032_calculate_register_settings(&m, freq, 1090.0, f->video_if, 5.25, 3.0, - step); - MT2032_dump_parameters(f, &m); - MT2032_implement_settings(f, &m); - /* MT2032_dump_parameters(f, &m); */ - for (i = 0; i < 3; i++) { - MT2032_optimize_VCO(f, &m); - if (MT2032_wait_for_lock(f)) { - data[0] = 0x02; /* LO Gain control register 0x02 */ - data[1] = 0x20; - I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0); - return; - } - data[0] = 0x07; - data[1] = 0x88 | f->xogc; - I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0); - usleep(15000); - data[1] = 0x08 | f->xogc; - I2C_WriteRead(&(f->d), (I2CByte *) data, 2, NULL, 0); - } - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "MT2032: failed to set frequency\n"); -} - -void -FI1236_set_tuner_type(FI1236Ptr f, int type) -{ - f->type = type; - if (type >= NUM_TUNERS) - type = NUM_TUNERS - 1; - if (type < 0) - type = 0; - memcpy(&(f->parm), &(tuner_parms[type]), sizeof(FI1236_parameters)); - f->original_frequency = f->parm.min_freq; - f->afc_delta = 0; - if (type == TUNER_TYPE_MT2032) { - MT2032_init(f); - return; - } -} - -static CARD32 -AFC_TimerCallback(OsTimerPtr timer, CARD32 time, void *data) -{ - FI1236Ptr f = (FI1236Ptr) data; - - if (FI1236_AFC(f)) - return 150; - else { - f->afc_timer_installed = FALSE; - f->afc_count = 0; - return 0; - } -} - -void -FI1236_tune(FI1236Ptr f, CARD32 frequency) -{ - CARD16 divider; - CARD8 data; - - if (frequency < f->parm.min_freq) - frequency = f->parm.min_freq; - if (frequency > f->parm.max_freq) - frequency = f->parm.max_freq; - - divider = (f->parm.fcar + (CARD16) frequency) & 0x7fff; - f->tuner_data.div1 = (CARD8) ((divider >> 8) & 0x7f); - f->tuner_data.div2 = (CARD8) (divider & 0xff); - f->tuner_data.control = f->parm.control; - - if (frequency < f->parm.threshold1) - f->tuner_data.band = f->parm.band_low; - else if (frequency < f->parm.threshold2) - f->tuner_data.band = f->parm.band_mid; - else - f->tuner_data.band = f->parm.band_high; - - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "Setting tuner band to %d\n", f->tuner_data.band); - - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "Setting tuner frequency to %d\n", (int) frequency); - - if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) { - f->tuner_data.aux = 0x20; - I2C_WriteRead(&(f->d), (I2CByte *) &(f->tuner_data), 5, NULL, 0); - I2C_WriteRead(&(f->d), NULL, 0, &data, 1); - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data); - } - else - I2C_WriteRead(&(f->d), (I2CByte *) &(f->tuner_data), 4, NULL, 0); -} - -void -TUNER_set_frequency(FI1236Ptr f, CARD32 frequency) -{ - if (frequency < f->parm.min_freq) - frequency = f->parm.min_freq; - if (frequency > f->parm.max_freq) - frequency = f->parm.max_freq; - - f->afc_delta = 0; - f->original_frequency = frequency; - - if (f->type == TUNER_TYPE_MT2032) - MT2032_tune(f, (1.0 * frequency) / 16.0, 0.0625); - else - FI1236_tune(f, frequency); - - if (!f->afc_timer_installed) { - f->afc_timer_installed = TRUE; -/* RegisterBlockAndWakeupHandlers(FI1236_BlockHandler, AFCWakeup, f); */ - TimerSet(NULL, 0, 300, AFC_TimerCallback, f); - } - -} - -int -FI1236_AFC(FI1236Ptr f) -{ -#if 0 - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n", - f, f->afc_count, f->original_frequency, f->afc_delta); -#endif - f->afc_count++; - if (f->type == TUNER_TYPE_MT2032) { - f->last_afc_hint = MT2032_get_afc_hint(f); - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "AFC: afc_hint=%d\n", f->last_afc_hint); - if (f->last_afc_hint == TUNER_TUNED) - return 0; - if (f->afc_count > 3) - f->last_afc_hint = TUNER_OFF; - if (f->last_afc_hint == TUNER_OFF) - f->afc_delta = 0; - else - f->afc_delta += f->last_afc_hint; - - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "AFC: Setting tuner frequency to %g\n", - (0.5 * (2 * f->original_frequency + f->afc_delta)) / 16.0); - MT2032_tune(f, - (1.0 * f->original_frequency + 0.5 * f->afc_delta) / 16.0, - 0.03125); - if (f->last_afc_hint == TUNER_OFF) - return 0; - return 1; /* call me again */ - } - else { - f->last_afc_hint = FI1236_get_afc_hint(f); - if (f->last_afc_hint == TUNER_TUNED) { - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: TUNER_TUNNED\n"); - return 0; - } - if (f->afc_count > 3) - f->last_afc_hint = TUNER_OFF; - - if (f->last_afc_hint == TUNER_OFF) - f->afc_delta = 0; - else - f->afc_delta += f->last_afc_hint; - - xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, - "AFC: Setting tuner frequency to %g\n", - (0.5 * (2 * f->original_frequency + f->afc_delta)) / 16.0); - FI1236_tune(f, f->original_frequency + f->afc_delta); - if (f->last_afc_hint == TUNER_OFF) - return 0; - return 1; /* call me again */ - } - return 0; /* done */ -} - -void -fi1236_dump_status(FI1236Ptr f) -{ - if (f->type == TUNER_TYPE_MT2032) - MT2032_dump_status(f); -} diff --git a/xorg-server/hw/xfree86/i2c/fi1236.h b/xorg-server/hw/xfree86/i2c/fi1236.h deleted file mode 100644 index 053089277..000000000 --- a/xorg-server/hw/xfree86/i2c/fi1236.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef __FI1236_H__ -#define __FI1236_H__ - -#include "xf86i2c.h" - -/* why someone has defined NUM someplace else is beyoung me.. */ -#undef NUM - -typedef struct { - CARD32 fcar; /* 16 * fcar_Mhz */ - CARD32 min_freq; /* 16 * min_freq_Mhz */ - CARD32 max_freq; /* 16 * max_freq_Mhz */ - - CARD32 threshold1; /* 16 * Value_Mhz */ - CARD32 threshold2; /* 16 * Value_Mhz */ - - CARD8 band_low; - CARD8 band_mid; - CARD8 band_high; - CARD8 control; -} FI1236_parameters; - -typedef struct { - /* what we want */ - /* all frequencies are in Mhz */ - double f_rf; /* frequency to tune to */ - double f_if1; /* first intermediate frequency */ - double f_if2; /* second intermediate frequency */ - double f_ref; /* reference frequency */ - double f_ifbw; /* bandwidth */ - double f_step; /* step */ - - /* what we compute */ - double f_lo1; - double f_lo2; - int LO1I; - int LO2I; - int SEL; - int STEP; - int NUM; -} MT2032_parameters; - -typedef struct { - I2CDevRec d; - int type; - - void *afc_source; /* The AFC source may be another chip like TDA988x */ - - int afc_delta; - CARD32 original_frequency; - Bool afc_timer_installed; - int afc_count; - int last_afc_hint; - - double video_if; - FI1236_parameters parm; - int xogc; /* for MT2032 */ - - struct { - CARD8 div1; - CARD8 div2; - CARD8 control; - CARD8 band; - CARD8 aux; /* this is for MK3 tuners */ - } tuner_data; -} FI1236Rec, *FI1236Ptr; - -#define TUNER_TYPE_FI1236 0 -#define TUNER_TYPE_FI1216 1 -#define TUNER_TYPE_TEMIC_FN5AL 2 -#define TUNER_TYPE_MT2032 3 -#define TUNER_TYPE_FI1246 4 -#define TUNER_TYPE_FI1256 5 -#define TUNER_TYPE_FI1236W 6 -#define TUNER_TYPE_FM1216ME 7 - -#define FI1236_ADDR(a) ((a)->d.SlaveAddr) - -#define FI1236_ADDR_1 0xC6 -#define FI1236_ADDR_2 0xC0 - -#define TUNER_TUNED 0 -#define TUNER_JUST_BELOW 1 -#define TUNER_JUST_ABOVE -1 -#define TUNER_OFF 4 -#define TUNER_STILL_TUNING 5 - -void FI1236_tune(FI1236Ptr f, CARD32 frequency); - -#define FI1236SymbolsList \ - "Detect_FI1236", \ - "FI1236_set_tuner_type", \ - "TUNER_set_frequency" - -#define xf86_Detect_FI1236 Detect_FI1236 -extern _X_EXPORT FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr); - -#define xf86_FI1236_set_tuner_type FI1236_set_tuner_type -extern _X_EXPORT void FI1236_set_tuner_type(FI1236Ptr f, int type); - -#define xf86_TUNER_set_frequency TUNER_set_frequency -extern _X_EXPORT void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency); - -#define xf86_FI1236_AFC FI1236_AFC -extern _X_EXPORT int FI1236_AFC(FI1236Ptr f); - -#define xf86_TUNER_get_afc_hint TUNER_get_afc_hint -extern _X_EXPORT int TUNER_get_afc_hint(FI1236Ptr f); - -#define xf86_fi1236_dump_status fi1236_dump_status -extern _X_EXPORT void fi1236_dump_status(FI1236Ptr f); - -#endif diff --git a/xorg-server/hw/xfree86/i2c/fi1236_module.c b/xorg-server/hw/xfree86/i2c/fi1236_module.c deleted file mode 100644 index 2f453d964..000000000 --- a/xorg-server/hw/xfree86/i2c/fi1236_module.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo fi1236VersRec = { - "fi1236", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData fi1236ModuleData = { - &fi1236VersRec, - NULL, - NULL -}; diff --git a/xorg-server/hw/xfree86/i2c/msp3430.c b/xorg-server/hw/xfree86/i2c/msp3430.c deleted file mode 100644 index a501489ee..000000000 --- a/xorg-server/hw/xfree86/i2c/msp3430.c +++ /dev/null @@ -1,779 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include - -#include "xf86.h" -#include "xf86i2c.h" -#include "msp3430.h" -#include "i2c_def.h" - -#define CONTROL 0x00 -#define WR_DEM 0x10 -#define RD_DEM 0x11 -#define WR_DSP 0x12 -#define RD_DSP 0x13 - -void InitMSP34xxG(MSP3430Ptr m); -void InitMSP34x5D(MSP3430Ptr m); -void CheckModeMSP34x5D(MSP3430Ptr m); -static const char *MSP_getProductName(CARD16 product_id); -void mpause(int milliseconds); - -#define __MSPDEBUG__ 0 - -#if __MSPDEBUG__ > 3 - -void MSPBeep(MSP3430Ptr m, CARD8 freq); - -#define __MSPBEEP MSPBeep(m,0x14); - -#else - -#define __MSPBEEP -#endif - -static void -SetMSP3430Control(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegValueHigh, - CARD8 RegValueLow) -{ - I2CByte data[3]; - - data[0] = RegAddress; - data[1] = RegValueHigh; - data[2] = RegValueLow; - - I2C_WriteRead(&(m->d), data, 3, NULL, 0); -} - -static void -SetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh, - CARD8 RegSubAddressLow, CARD8 RegValueHigh, CARD8 RegValueLow) -{ - I2CByte data[5]; - -#ifdef MSP_DEBUG - if (!m->registers_present[RegSubAddressLow]) { - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_ERROR, - "Attempt to access non-existent register in MSP34xxX: 0x%02x 0x%02x 0x%02x <- 0x%02x 0x%02x\n", - RegAddress, RegSubAddressHigh, RegSubAddressLow, - RegValueHigh, RegValueLow); - } -#endif - - data[0] = RegAddress; - data[1] = RegSubAddressHigh; - data[2] = RegSubAddressLow; - data[3] = RegValueHigh; - data[4] = RegValueLow; - - I2C_WriteRead(&(m->d), data, 5, NULL, 0); -} - -static void -GetMSP3430Data(MSP3430Ptr m, CARD8 RegAddress, CARD8 RegSubAddressHigh, - CARD8 RegSubAddressLow, CARD8 *RegValueHigh, CARD8 *RegValueLow) -{ - I2CByte send[3]; - I2CByte receive[2]; - - send[0] = RegAddress; - send[1] = RegSubAddressHigh; - send[2] = RegSubAddressLow; - - I2C_WriteRead(&(m->d), send, 3, receive, 2); - - *RegValueHigh = receive[0]; - *RegValueLow = receive[1]; -} - -#if __MSPDEBUG__ > 2 -static void -MSP3430DumpStatus(MSP3430Ptr m) -{ - CARD8 status_hi, status_lo; - CARD8 subaddr, data[2]; - - GetMSP3430Data(m, RD_DEM, 0x02, 0x00, &status_hi, &status_lo); - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "MSP34xx: SAP(8)=%d mono/NICAM(7)=%d stereo=%d %s O_1=%d O_0=%d 2nd car=%d 1st car=%d\n", - status_hi & 1, (status_lo >> 7) & 1, (status_lo >> 6) & 1, - (status_lo >> 5) ? ((status_hi >> 1) & 1 ? "bad NICAM reception" - : "NICAM") : ((status_hi >> 1) & 1 ? "bogus" - : "ANALOG FM/AM"), - (status_lo >> 4) & 1, (status_lo >> 3) & 1, - !((status_lo >> 2) & 1), !((status_lo >> 1) & 1)); - - GetMSP3430Data(m, RD_DEM, 0x00, 0x7E, &status_hi, &status_lo); - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "MSP34xx: standard result=0x%02x%02x\n", status_hi, status_lo); - subaddr = 0x0; - I2C_WriteRead(&(m->d), &subaddr, 1, data, 2); - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP34xx: control=0x%02x%02x\n", - data[1], data[0]); -} -#endif - -/* wrapper */ -void -InitMSP3430(MSP3430Ptr m) -{ -#if __MSPDEBUG__ > 1 - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "InitMSP3430(m->connector=%d, m->standard=%d, m->chip_family=%d)\n", - m->connector, m->standard, m->chip_family); -#endif - switch (m->chip_family) { - case MSPFAMILY_34x0G: - InitMSP34xxG(m); - break; - case MSPFAMILY_34x5G: - InitMSP34xxG(m); - break; - case MSPFAMILY_34x5D: - InitMSP34x5D(m); - break; - } -} - -/*----------------------------------------------------------------- -| common functions for all MSP34xx chips -|----------------------------------------------------------------*/ - -MSP3430Ptr -DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr) -{ - MSP3430Ptr m; - I2CByte a; - CARD8 hardware_version, major_revision, product_code, rom_version; - Bool supported; - - m = calloc(1, sizeof(MSP3430Rec)); - if (m == NULL) - return NULL; - m->d.DevName = strdup("MSP34xx"); - m->d.SlaveAddr = addr; - m->d.pI2CBus = b; - m->d.NextDev = NULL; - m->d.StartTimeout = b->StartTimeout; - m->d.BitTimeout = b->BitTimeout; - m->d.AcknTimeout = b->AcknTimeout; - m->d.ByteTimeout = b->ByteTimeout; - - if (!I2C_WriteRead(&(m->d), NULL, 0, &a, 1)) { - free((void *) m->d.DevName); - free(m); - return NULL; - } - - m->standard = MSP3430_NTSC; - m->connector = MSP3430_CONNECTOR_1; - m->mode = MSPMODE_STEREO_A; /*stereo or chanel A if avail. */ - m->c_format = MSPFORMAT_UNKNOWN; - m->c_standard = MSPSTANDARD_UNKNOWN; - m->c_matrix = m->c_fmmatrix = m->c_source = 0; - m->volume = 0; - m->recheck = FALSE; - - GetMSP3430Data(m, RD_DSP, 0x00, 0x1E, &hardware_version, &major_revision); - GetMSP3430Data(m, RD_DSP, 0x00, 0x1F, &product_code, &rom_version); - m->hardware_version = hardware_version; - m->major_revision = major_revision; - m->product_code = product_code; - m->rom_version = rom_version; - - m->chip_id = ((major_revision << 8) | product_code); - - supported = FALSE; - switch (major_revision) { - case 4: /* 34xxD */ - switch (product_code) { - case 0x05: /* 3405D */ - case 0x0A: /* 3410D */ - case 0x0F: /* 3415D */ - m->chip_family = MSPFAMILY_34x5D; - m->recheck = TRUE; - supported = TRUE; - break; - default: - m->chip_family = MSPFAMILY_34x0D; - } - break; - case 7: /* 34xxG */ - switch (product_code) { - case 0x00: - case 0x0A: - case 0x1E: - case 0x28: - case 0x32: - m->chip_family = MSPFAMILY_34x0G; - supported = TRUE; - break; - case 0x0f: - case 0x19: - case 0x2d: - case 0x37: - case 0x41: - m->chip_family = MSPFAMILY_34x5G; - supported = TRUE; -#ifdef MSP_DEBUG - memset(m->registers_present, 0, 256); -#define A(num) m->registers_present[(num)]=1; -#define B(num1, num2) memset(&(m->registers_present[num1]), 1, num2-num1); - A(0x20) - A(0x30) - A(0x40) - A(0x00) - B(0x01, 0x08) - B(0x0B, 0x0E) - A(0x10) - B(0x12, 0x14) - A(0x16) - A(0x29) -#undef B -#undef A -#endif - break; - default: - m->chip_family = MSPFAMILY_UNKNOWN; - } - break; - default: - m->chip_family = MSPFAMILY_UNKNOWN; - } - - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "Found %s%s, rom version 0x%02x, chip_id=0x%04x\n", - MSP_getProductName(m->chip_id), - supported ? "" : " (unsupported)", rom_version, m->chip_id); - - if (!supported) { - free((void *) m->d.DevName); - free(m); - return NULL; - } - if (!I2CDevInit(&(m->d))) { - free((void *) m->d.DevName); - free(m); - return NULL; - } - - return m; -} - -void -ResetMSP3430(MSP3430Ptr m) -{ - /* Reset the MSP3430 */ - SetMSP3430Control(m, 0x00, 0x80, 0x00); - /* Set it back to normal operation */ - SetMSP3430Control(m, 0x00, 0x00, 0x00); - - m->c_format = MSPFORMAT_UNKNOWN; - m->c_standard = MSPSTANDARD_UNKNOWN; - m->c_matrix = m->c_fmmatrix = m->c_source = 0; - m->volume = 0; -} - -void -MSP3430SetVolume(MSP3430Ptr m, CARD8 value) -{ - CARD8 result; - -#if 0 - CARD8 old_volume; - - GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result); - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 result 0x%02x\n", - result); -#endif - /* save an extra Get call */ - result = 0; - - SetMSP3430Data(m, WR_DSP, 0x00, 0x00, value, result); - - SetMSP3430Data(m, WR_DSP, 0x00, 0x07, value, 0); - m->volume = value; - -#if __MSPDEBUG__ > 2 - MSP3430DumpStatus(m); - __MSPBEEP GetMSP3430Data(m, RD_DSP, 0x00, 0x00, &old_volume, &result); - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "MSP3430 volume 0x%02x\n", - value); -#endif -} - -void -MSP3430SetSAP(MSP3430Ptr m, int mode) -{ - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "Put actual code to change SAP here\n"); - - SetMSP3430Data(m, WR_DSP, 0x00, 0x08, mode & 0xff, 0x20); -} - -#if 0 -void -MSP3430SetSource(MSP3430Ptr m, CARD8 value) -{ - /* Write to DSP, register 0x0008, (loudspeaker channel source/matrix) */ - /* This sets the source to the TV tuner, for stereo operation */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x08, value, 0x20); -} -#endif - -static const char * -MSP_getProductName(CARD16 product_id) -{ - switch (product_id) { - case 0x0400: - return "MSP3400D"; - case 0x040a: - return "MSP3410D"; - case 0x0405: - return "MSP3405D"; - case 0x040f: - return "MSP3415D"; - case 0x0700: - return "MSP3400G"; - case 0x070a: - return "MSP3410G"; - case 0x071e: - return "MSP3430G"; - case 0x0728: - return "MSP3440G"; - case 0x0732: - return "MSP3450G"; - case 0x070f: - return "MSP3415G"; - case 0x0719: - return "MSP3425G"; - case 0x072d: - return "MSP3445G"; - case 0x0737: - return "MSP3455G"; - case 0x0741: - return "MSP3465G"; - } - return "MSP - unknown type"; -} - -#if __MSPDEBUG__ > 2 -/*puts beep in MSP output - freq = 0x01 - 16Hz ... 0x40 - 1kHz ... 0xff - 4kHz -*/ -void -MSPBeep(MSP3430Ptr m, CARD8 freq) -{ - SetMSP3430Data(m, WR_DSP, 0x00, freq, 0x7f, 0x40); - mpause(100); - SetMSP3430Data(m, WR_DSP, 0x00, 0x14, 0x00, 0x00); -} -#endif - -void -mpause(int milliseconds) -{ - int i, m; - - m = milliseconds / 20; - for (i = 0; i < m; i++) - usleep(20000); -} - -/*----------------------------------------------------------------- -| specific functions for all MSP34xxG chips -|----------------------------------------------------------------*/ - -void -InitMSP34xxG(MSP3430Ptr m) -{ - -#if __MSPDEBUG__ > 1 - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "InitMSP34xxG(m->connector=%d, m->standard=%d, m->chip_family=%d)\n", - m->connector, m->standard, m->chip_family); -#endif - /* Reset MSP3430 */ - SetMSP3430Control(m, 0x00, 0x80, 0x00); - /* Set it back to normal operation */ - SetMSP3430Control(m, 0x00, 0x00, 0x00); - - /*set MODUS register */ - /* bits: 0 - automatic sound detection */ - /* 1 - enable STATUS change */ - /* 12 - detect 6.5 Mhz carrier as D/K1, D/K2 or D/K NICAM (does not seem to work ) */ - /* 13 - detect 4.5 Mhz carrier as BTSC */ - if ((m->standard & 0xff) == MSP3430_PAL) { - SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x30, 0x03 | 0x08); /* make O_ pins tristate */ - /* PAL standard */ - SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x01); /* possibly wrong */ - } - else { - SetMSP3430Data(m, WR_DEM, 0x00, 0x30, 0x20, 0x03 | 0x08); - /* standard selection is M-BTSC-Stereo */ - SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x20); - } - - switch (m->connector) { - case MSP3430_CONNECTOR_1: - SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x03, 0x20); - break; - case MSP3430_CONNECTOR_2: - /* this has not been checked yet.. could be bogus */ - /* SCART Input Prescale: 0 dB gain */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00); - SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20); - break; - case MSP3430_CONNECTOR_3: - default: - /* SCART Input Prescale: 0 dB gain */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00); - - SetMSP3430Data(m, WR_DSP, 0x00, 0x08, 0x02, 0x20); - break; - } - - switch (m->standard) { - case MSP3430_PAL: - SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03); - SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a); - SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x03); - /* Set volume to FAST_MUTE. */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00); - break; - case MSP3430_PAL_DK1: - SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03); - SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x00, 0x5a); - SetMSP3430Data(m, WR_DEM, 0x00, 0x20, 0x00, 0x04); - /* Set volume to FAST_MUTE. */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00); - break; - case MSP3430_SECAM: /* is this right ? */ - case MSP3430_NTSC: - /* Write to DSP, register 0x000E, (prescale FM/FM matrix) */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x24, 0x03); - - /* Set volume to FAST_MUTE. */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00); - break; - } - -} - -/*----------------------------------------------------------------- -| specific functions for all MSP34x5D chips -|----------------------------------------------------------------*/ - -void -InitMSP34x5D(MSP3430Ptr m) -{ - int count; - CARD8 high, low; - CARD16 result, standard; - CARD16 peak; - - if (m->c_format == MSPFORMAT_UNKNOWN) - ResetMSP3430(m); - else { - /*mute volume */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0x00, 0x00); - } - - switch (m->connector) { - case MSP3430_CONNECTOR_2: - case MSP3430_CONNECTOR_3: - if (m->c_format != MSPFORMAT_SCART) { - /* SCART Input Prescale: 0 dB gain */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0d, 0x19, 0x00); - /* this has not been checked yet.. could be bogus */ - m->c_format = MSPFORMAT_SCART; /*stereo */ - } - break; - case MSP3430_CONNECTOR_1: - default: - - switch (m->standard & 0x00ff) { - case MSP3430_PAL: - switch (m->standard) { - case MSP3430_PAL_DK1: - standard = MSPSTANDARD_FM_DK1; - break; -/* case MSP3430_PAL_DK2: - standard=MSPSTANDARD_FM_DK2; - break; - case MSP3430_PAL_BG: - may be FM stereo (Germany) or FM NICAM (Scandinavia,spain) - standard=MSPSTANDARD_AUTO; - break; -*/ - default: - standard = MSPSTANDARD_AUTO; - } - break; - case MSP3430_SECAM: - standard = MSPSTANDARD_AUTO; - case MSP3430_NTSC: - /* Only MSP34x5 supported format - Korean NTSC-M */ - standard = MSPSTANDARD_FM_M; - default: - standard = MSPSTANDARD_AUTO; - } - - /*no NICAM support in MSP3410D - force to autodetect */ - if ((m->chip_id == 0x405) && (standard >= MSPSTANDARD_NICAM_BG)) - standard = MSPSTANDARD_AUTO; - - if (m->c_standard != standard) { - - SetMSP3430Data(m, WR_DEM, 0x00, 0x20, standard >> 8, - standard & 0xFF); - if (standard == MSPSTANDARD_AUTO) { - count = 50; /* time shouldn't exceed 1s, just in case */ - do { - usleep(20000); - GetMSP3430Data(m, RD_DEM, 0x00, 0x7e, &high, &low); - result = (high << 8) | low; - --count; - } while (result > 0x07ff && count > 0); - - if ((result > MSPSTANDARD_AUTO)) - standard = result; - else - standard = MSPSTANDARD_UNKNOWN; -#if __MSPDEBUG__ > 1 - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "Detected audio standard: %d\n", result); -#endif - /* result = MSPSTANDARD_NICAM_L can be one of: - SECAM_L - MSPSTANDARD_NICAM_L - D/K1 - MSPSTANDARD_FM_DK1 - D/K2 - MSPSTANDARD_FM_DK2 - D/K-NICAM - MSPSTANDARD_NICAM_DK */ - if (standard == MSPSTANDARD_NICAM_L) { - if ((m->standard & 0x00ff) == MSP3430_PAL) { - /* force PAL D/K */ - standard = MSPSTANDARD_FM_DK1; - SetMSP3430Data(m, WR_DEM, 0x00, 0x20, standard >> 8, - standard & 0xFF); -#if __MSPDEBUG__ > 1 - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "Detected 6.5MHz carrier - forced to D/K1 !!!\n"); -#endif - } - } - } - m->c_standard = standard; - } /*end - standard changed */ - else { - if (standard < MSPSTANDARD_NICAM_BG) { - /* get old value of ident. mode register */ - GetMSP3430Data(m, RD_DSP, 0x00, 0x15, &high, &low); - /* reset Ident-Filter */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x14, 0x00, 0x3F); - /* put back old value to ident. mode register */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x14, 0x00, low); - } - } - - if (standard <= MSPSTANDARD_AUTO) { - m->c_format = MSPFORMAT_1xFM; - } - else if (standard < MSPSTANDARD_NICAM_BG) { - /* set FM prescale */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x30, 0); - /* set FM deemphasis */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0f, - ((standard == MSPSTANDARD_FM_M) ? 0 : 1), 0); - - /* check if FM2 carrier is present */ - /*turn off FM DC Notch */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x17, 0x00, 0x3f); - /*matrix source for Quasi-Peak Detector - stereo: ch2->L ch1->R */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0c, 0x00, 0x20); - - mpause(250); - GetMSP3430Data(m, RD_DSP, 0x00, 0x1A, &high, &low); - peak = (high << 8) | low; -#if __MSPDEBUG__ > 1 - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "Second carrier Quasi-Peak detection: %d\n", peak); -#endif - /*turn on FM DC Notch */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x17, 0x00, 0x00); - - if (peak < 5) { - /* if second carrier not detected - only mono from first carrier */ - m->c_format = MSPFORMAT_1xFM; - } - else { - m->c_format = MSPFORMAT_2xFM; - /*start of FM identification process - FM_WAIT - wait at least 0.5s - used 1s - gives beter resolution */ - mpause(1000); - } - } - else { - if (standard == MSPSTANDARD_NICAM_L) { - m->c_format = MSPFORMAT_NICAM_AM; - /* set AM prescale */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x7C, 0); - } - else { - m->c_format = MSPFORMAT_NICAM_FM; - /* set FM prescale */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, 0x30, 0); - } - /* set FM deemphasis */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x0f, 0x00, 0); - /* set NICAM prescale to 0dB */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x10, 0x20, 0); - } - - break; - } /*end - case conector */ - - CheckModeMSP34x5D(m); - - /* Set volume to FAST_MUTE. */ - /*SetMSP3430Data(m, WR_DSP, 0x00, 0x00, 0xFF, 0x00); */ - /*set volume */ - MSP3430SetVolume(m, m->volume); - -__MSPBEEP} /* EnableMSP34x5D ()... */ - -void -CheckModeMSP34x5D(MSP3430Ptr m) -{ - const char stereo_on = 25; - const char stereo_off = 20; - const char dual_on = -stereo_on; - const char dual_off = -stereo_off; - char detect; - CARD8 matrix, fmmatrix, source, high, low; - - fmmatrix = 0; /*no matrix */ - source = 0; - /*FM*/ switch (m->c_format) { - case MSPFORMAT_NICAM_FM: - case MSPFORMAT_NICAM_AM: - case MSPFORMAT_SCART: - source = ((m->c_format == MSPFORMAT_SCART) ? 2 : 1); - switch (m->mode) { - case MSPMODE_MONO: - matrix = 0x30; - /*MONO*/ break; - case MSPMODE_A: - matrix = 0x00; - /*A*/ break; - case MSPMODE_B: - matrix = 0x10; - /*B*/ break; - default: - matrix = 0x20; - /*STEREO*/ break; - } - break; - default: - case MSPFORMAT_1xFM: - matrix = 0x00; - /*A*/ break; - case MSPFORMAT_2xFM: - switch (m->mode) { - case MSPMODE_MONO: - matrix = 0x30; - /*MONO*/ break; - case MSPMODE_STEREO: - matrix = 0x20; - /*STEREO*/ fmmatrix = ((m->c_standard == MSPSTANDARD_FM_M) ? 2 : 1); - break; - case MSPMODE_AB: - matrix = 0x20; - /*STEREO*/ break; - case MSPMODE_A: - matrix = 0x00; - /*A*/ break; - case MSPMODE_B: - matrix = 0x10; - /*B*/ break; - default: - /*FM_IDENT_CHECK */ - GetMSP3430Data(m, RD_DSP, 0x00, 0x18, &high, &low); - detect = (char) high; -#if __MSPDEBUG__ > 1 - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, - "Stereo Detection Register: %d\n", detect); -#endif - if (detect >= - ((m->c_mode == MSPMODE_STEREO) ? stereo_off : stereo_on)) { - m->c_mode = MSPMODE_STEREO; - matrix = 0x20; - /*STEREO*/ - fmmatrix = ((m->c_standard == MSPSTANDARD_FM_M) ? 2 : 1); - } - else if (detect <= ((m->c_mode == MSPMODE_AB) ? dual_off : dual_on)) { - m->c_mode = MSPMODE_AB; - switch (m->mode) { - case MSPMODE_STEREO_AB: - matrix = 0x20; - break; - case MSPMODE_STEREO_B: - matrix = 0x10; - break; - default: - case MSPMODE_A: - matrix = 0x00; - break; - } - } - else { - m->c_mode = MSPMODE_MONO; - matrix = 0x30; - /*MONO*/} - break; - } /* end - case mode */ - break; - } - - if (m->c_fmmatrix != fmmatrix) { - GetMSP3430Data(m, RD_DSP, 0x00, 0x0e, &high, &low); - SetMSP3430Data(m, WR_DSP, 0x00, 0x0e, high, fmmatrix); - m->c_fmmatrix = fmmatrix; - } - - if ((m->c_matrix != matrix) || (m->c_source != source)) { - /*set chanel source and matrix for loudspeaker */ - SetMSP3430Data(m, WR_DSP, 0x00, 0x08, source, matrix); - - m->c_matrix = matrix; - m->c_source = source; - } - - if (((m->c_format) & 0xF0) == MSPFORMAT_NICAM) - SetMSP3430Data(m, WR_DEM, 0x00, 0x21, 0, 1); - -#if __MSPDEBUG__ > 0 - char *msg; - - switch (matrix) { - case 0x30: - /*MONO*/ msg = "MONO"; - break; - case 0x00: - /*LEFT*/ msg = "MONO/CHANNEL_1"; - break; - case 0x10: - /*RIGHT*/ msg = "MONO/CHANNEL_2"; - break; - case 0x20: - /*LEFT*/ msg = "STEREO"; - break; - default: - msg = "unknown"; - break; - } - xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "Audio mode set to: %s\n", msg); -#endif -} diff --git a/xorg-server/hw/xfree86/i2c/msp3430.h b/xorg-server/hw/xfree86/i2c/msp3430.h deleted file mode 100644 index ef66e1ed8..000000000 --- a/xorg-server/hw/xfree86/i2c/msp3430.h +++ /dev/null @@ -1,116 +0,0 @@ -#ifndef __MSP3430_H__ -#define __MSP3430_H__ - -#include "xf86i2c.h" - -typedef struct { - I2CDevRec d; - - int standard; - int connector; - int mode; - - CARD8 hardware_version, major_revision, product_code, rom_version; -#ifdef MSP_DEBUG - CARD8 registers_present[256]; -#endif - - CARD16 chip_id; - CARD8 chip_family; - Bool recheck; /*reinitialization needed after channel change */ - CARD8 c_format; /*current state of audio format */ - CARD16 c_standard; /*current state of standard register */ - CARD8 c_source; /*current state of source register */ - CARD8 c_matrix; /*current state of matrix register */ - CARD8 c_fmmatrix; /*current state of fmmatrix register */ - int c_mode; /* current state of mode for autoswitchimg */ - CARD8 volume; -} MSP3430Rec, *MSP3430Ptr; - -#define MSP3430_ADDR_1 0x80 -#define MSP3430_ADDR_2 0x84 -#define MSP3430_ADDR_3 0x88 - -#define MSP3430_PAL 1 -#define MSP3430_NTSC 2 -#define MSP3430_PAL_DK1 (0x100 | MSP3430_PAL) -#define MSP3430_SECAM 3 - -#define MSP3430_CONNECTOR_1 1 /* tuner on AIW cards */ -#define MSP3430_CONNECTOR_2 2 /* SVideo on AIW cards */ -#define MSP3430_CONNECTOR_3 3 /* composite on AIW cards */ - -#define MSP3430_ADDR(a) ((a)->d.SlaveAddr) - -#define MSP3430_FAST_MUTE 0xFF -/* a handy volume transform function, -1000..1000 -> 0x01..0x7F */ -#define MSP3430_VOLUME(value) (0x01+(0x7F-0x01)*log(value+1001)/log(2001)) - -/*----------------------------------------------------------*/ - -/* MSP chip families */ -#define MSPFAMILY_UNKNOWN 0 -#define MSPFAMILY_34x0D 1 -#define MSPFAMILY_34x5D 2 -#define MSPFAMILY_34x0G 3 -#define MSPFAMILY_34x5G 4 - -/* values for MSP standard */ -#define MSPSTANDARD_UNKNOWN 0x00 -#define MSPSTANDARD_AUTO 0x01 -#define MSPSTANDARD_FM_M 0x02 -#define MSPSTANDARD_FM_BG 0x03 -#define MSPSTANDARD_FM_DK1 0x04 -#define MSPSTANDARD_FM_DK2 0x04 -#define MSPSTANDARD_NICAM_BG 0x08 -#define MSPSTANDARD_NICAM_L 0x09 -#define MSPSTANDARD_NICAM_I 0x0A -#define MSPSTANDARD_NICAM_DK 0x0B - -/* values for MSP format */ -#define MSPFORMAT_UNKNOWN 0x00 -#define MSPFORMAT_FM 0x10 -#define MSPFORMAT_1xFM 0x00|MSPFORMAT_FM -#define MSPFORMAT_2xFM 0x01|MSPFORMAT_FM -#define MSPFORMAT_NICAM 0x20 -#define MSPFORMAT_NICAM_FM 0x00|MSPFORMAT_NICAM -#define MSPFORMAT_NICAM_AM 0x01|MSPFORMAT_NICAM -#define MSPFORMAT_SCART 0x30 - -/* values for MSP mode */ -#define MSPMODE_UNKNOWN 0 -/* automatic modes */ -#define MSPMODE_STEREO_AB 1 -#define MSPMODE_STEREO_A 2 -#define MSPMODE_STEREO_B 3 -/* forced modes */ -#define MSPMODE_MONO 4 -#define MSPMODE_STEREO 5 -#define MSPMODE_AB 6 -#define MSPMODE_A 7 -#define MSPMODE_B 8 -/*----------------------------------------------------------*/ - -#define xf86_InitMSP3430 InitMSP3430 -extern _X_EXPORT void InitMSP3430(MSP3430Ptr m); - -#define xf86_DetectMSP3430 DetectMSP3430 -extern _X_EXPORT MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr); - -#define xf86_ResetMSP3430 ResetMSP3430 -extern _X_EXPORT void ResetMSP3430(MSP3430Ptr m); - -#define xf86_MSP3430SetVolume MSP3430SetVolume -extern _X_EXPORT void MSP3430SetVolume(MSP3430Ptr m, CARD8 value); - -#define xf86_MSP3430SetSAP MSP3430SetSAP -extern _X_EXPORT void MSP3430SetSAP(MSP3430Ptr m, int mode); - -#define MSP3430SymbolsList \ - "InitMSP3430", \ - "DetectMSP3430", \ - "ResetMSP3430", \ - "MSP3430SetVolume", \ - "MSP3430SetSAP" - -#endif diff --git a/xorg-server/hw/xfree86/i2c/msp3430_module.c b/xorg-server/hw/xfree86/i2c/msp3430_module.c deleted file mode 100644 index e177efe7f..000000000 --- a/xorg-server/hw/xfree86/i2c/msp3430_module.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo msp3430VersRec = { - "msp3430", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData msp3430ModuleData = { - &msp3430VersRec, - NULL, - NULL -}; diff --git a/xorg-server/hw/xfree86/i2c/tda8425.c b/xorg-server/hw/xfree86/i2c/tda8425.c deleted file mode 100644 index 051249b8a..000000000 --- a/xorg-server/hw/xfree86/i2c/tda8425.c +++ /dev/null @@ -1,83 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86i2c.h" -#include "tda8425.h" -#include "i2c_def.h" - -#define TDA8425(a,b) { \ - data[0]=a; \ - data[1]=b; \ - I2C_WriteRead(&(t->d), data, 2, NULL, 0); \ - } - -TDA8425Ptr -Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force) -{ - TDA8425Ptr t; - - t = calloc(1, sizeof(TDA8425Rec)); - if (t == NULL) - return NULL; - t->d.DevName = "TDA8425 BTSC Stereo Audio Processor"; - t->d.SlaveAddr = addr; - t->d.pI2CBus = b; - t->d.NextDev = NULL; - t->d.StartTimeout = b->StartTimeout; - t->d.BitTimeout = b->BitTimeout; - t->d.AcknTimeout = b->AcknTimeout; - t->d.ByteTimeout = b->ByteTimeout; - - if (!force && !I2CProbeAddress(b, addr)) { - free(t); - return NULL; - } - - /* set default parameters */ - if (!I2CDevInit(&(t->d))) { - free(t); - return NULL; - } - - return t; -} - -Bool -tda8425_init(TDA8425Ptr t) -{ - t->stereo = 3; /* 3 = Spacial 2 = Linear 1 = Pseudo 0 = Forced mono */ - t->v_left = 0xFF; /* FF - C0 */ - t->v_right = 0xFF; /* FF - C0 */ - t->bass = 0xF6; /* 0xFF - 0xF0 */ - t->treble = 0xF6; /* 0xFF - 0xF0 */ - t->src_sel = 3; /* 3 - stereo */ - t->mute = TRUE; - t->mux = 0; /* 0 - source one, 1 -source 2 */ - - tda8425_setaudio(t); - return TRUE; -} - -void -tda8425_setaudio(TDA8425Ptr t) -{ - I2CByte data[2]; - - TDA8425(0x00, t->v_left); - TDA8425(0x01, t->v_right); - TDA8425(0x02, t->bass); - TDA8425(0x03, t->treble); - TDA8425(0x08, - 0xC0 | (t->mute ? 0x20 : 0x0) | (t->stereo << 3) | (t-> - src_sel << 1) | - t->mux); -} - -void -tda8425_mute(TDA8425Ptr t, Bool mute) -{ - t->mute = mute; - tda8425_setaudio(t); -} diff --git a/xorg-server/hw/xfree86/i2c/tda8425.h b/xorg-server/hw/xfree86/i2c/tda8425.h deleted file mode 100644 index e3dfb1384..000000000 --- a/xorg-server/hw/xfree86/i2c/tda8425.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef __TDA8425_H__ -#define __TDA8425_H__ - -#include "xf86i2c.h" - -typedef struct { - I2CDevRec d; - - int mux; - int stereo; - int v_left; - int v_right; - int bass; - int treble; - int src_sel; - Bool mute; -} TDA8425Rec, *TDA8425Ptr; - -#define TDA8425_ADDR_1 0x82 - -/* the third parameter is meant to force detection of tda8425. - This is because tda8425 is write-only and complete implementation - of I2C protocol is not always available. Besides address there is no good - way to autodetect it so we have to _know_ it is there anyway */ - -#define xf86_Detect_tda8425 Detect_tda8425 -extern _X_EXPORT TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, - Bool force); -#define xf86_tda8425_init tda8425_init -extern _X_EXPORT Bool tda8425_init(TDA8425Ptr t); - -#define xf86_tda8425_setaudio tda8425_setaudio -extern _X_EXPORT void tda8425_setaudio(TDA8425Ptr t); - -#define xf86_tda8425_mute tda8425_mute -extern _X_EXPORT void tda8425_mute(TDA8425Ptr t, Bool mute); - -#define TDA8425SymbolsList \ - "Detect_tda8425", \ - "tda8425_init", \ - "tda8425_setaudio", \ - "tda8425_mute" - -#endif diff --git a/xorg-server/hw/xfree86/i2c/tda8425_module.c b/xorg-server/hw/xfree86/i2c/tda8425_module.c deleted file mode 100644 index 74c820f73..000000000 --- a/xorg-server/hw/xfree86/i2c/tda8425_module.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo tda8425VersRec = { - "tda8425", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData tda8425ModuleData = { - &tda8425VersRec, - NULL, - NULL -}; diff --git a/xorg-server/hw/xfree86/i2c/tda9850.c b/xorg-server/hw/xfree86/i2c/tda9850.c deleted file mode 100644 index d258bda05..000000000 --- a/xorg-server/hw/xfree86/i2c/tda9850.c +++ /dev/null @@ -1,136 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86i2c.h" -#include "tda9850.h" -#include "i2c_def.h" - -#define TDA9850(a,b) { \ - data[0]=a; \ - data[1]=b; \ - I2C_WriteRead(&(t->d), data, 2, NULL, 0); \ - } - -TDA9850Ptr -Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr) -{ - TDA9850Ptr t; - I2CByte a; - - t = calloc(1, sizeof(TDA9850Rec)); - if (t == NULL) - return NULL; - switch (addr) { - case TDA9850_ADDR_1: - t->d.DevName = "TDA9850 BTSC Stereo+SAP Audio Processor"; - break; - default: - t->d.DevName = "Generic TDAxxxx"; - break; - } - t->d.SlaveAddr = addr; - t->d.pI2CBus = b; - t->d.NextDev = NULL; - t->d.StartTimeout = b->StartTimeout; - t->d.BitTimeout = b->BitTimeout; - t->d.AcknTimeout = b->AcknTimeout; - t->d.ByteTimeout = b->ByteTimeout; - - if (!I2C_WriteRead(&(t->d), NULL, 0, &a, 1)) { - free(t); - return NULL; - } - - /* set default parameters */ - if (!I2CDevInit(&(t->d))) { - free(t); - return NULL; - } - - return t; -} - -Bool -tda9850_init(TDA9850Ptr t) -{ - t->stereo = 1; - t->sap = 0; - t->mute = TRUE; - t->sap_mute = TRUE; - tda9850_setaudio(t); - return TRUE; -} - -void -tda9850_setaudio(TDA9850Ptr t) -{ - CARD8 data[2]; - - if (t->mux == 2) { - TDA9850(0x04, 0x0F); - TDA9850(0x05, 0x0F); - TDA9850(0x06, 0x58); - TDA9850(0x07, 0x07); - TDA9850(0x08, 0x00); - TDA9850(0x09, 0x00); - TDA9850(0x0A, 0x03); - } - else { - TDA9850(0x04, 0x07); - TDA9850(0x05, 0x07); - TDA9850(0x06, 0x58); - TDA9850(0x07, 0x07); - TDA9850(0x08, 0x10); - TDA9850(0x09, 0x10); - TDA9850(0x0A, 0x03); - } - - TDA9850(0x06, - (t->stereo << 6) | (t->sap << 7) | (t->mute ? 0x8 : 0) | (t-> - sap_mute ? - 0x10 : - 0x0)); -} - -void -tda9850_mute(TDA9850Ptr t, Bool mute) -{ - CARD8 data[2]; - - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_mute %s\n", - mute ? "on" : "off"); - t->mute = mute; - - TDA9850(0x06, - (t->stereo << 6) | (t->sap << 7) | (t->mute ? 0x8 : 0x0) | (t-> - sap_mute - ? 0x10 : - 0x0)); -} - -void -tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute) -{ - CARD8 data[2]; - - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "tda9850_sap_mute %s\n", - sap_mute ? "on" : "off"); - t->sap_mute = sap_mute; - - TDA9850(0x06, - (t->stereo << 6) | (t->sap << 7) | (t->mute ? 0x8 : 0x0) | (t-> - sap_mute - ? 0x10 : - 0x0)); -} - -CARD16 -tda9850_getstatus(TDA9850Ptr t) -{ - CARD16 status; - - I2C_WriteRead(&(t->d), NULL, 0, (I2CByte *) &status, 2); - return status; -} diff --git a/xorg-server/hw/xfree86/i2c/tda9850.h b/xorg-server/hw/xfree86/i2c/tda9850.h deleted file mode 100644 index 7d82095f0..000000000 --- a/xorg-server/hw/xfree86/i2c/tda9850.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef __TDA9850_H__ -#define __TDA9850_H__ - -#include "xf86i2c.h" - -typedef struct { - I2CDevRec d; - - int mux; - int stereo; - int sap; - Bool mute; - Bool sap_mute; -} TDA9850Rec, *TDA9850Ptr; - -#define TDA9850_ADDR_1 0xB4 - -#define xf86_Detect_tda9850 Detect_tda9850 -extern _X_EXPORT TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr); - -#define xf86_tda9850_init tda9850_init -extern _X_EXPORT Bool tda9850_init(TDA9850Ptr t); - -#define xf86_tda9850_setaudio tda9850_setaudio -extern _X_EXPORT void tda9850_setaudio(TDA9850Ptr t); - -#define xf86_tda9850_mute tda9850_mute -extern _X_EXPORT void tda9850_mute(TDA9850Ptr t, Bool mute); - -#define xf86_tda9850_sap_mute tda9850_sap_mute -extern _X_EXPORT void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute); - -#define xf86_tda9850_getstatus tda9850_getstatus -extern _X_EXPORT CARD16 tda9850_getstatus(TDA9850Ptr t); - -#define TDA9850SymbolsList \ - "Detect_tda9850", \ - "tda9850_init", \ - "tda9850_setaudio", \ - "tda9850_mute", \ - "tda9850_sap_mute" - -#endif diff --git a/xorg-server/hw/xfree86/i2c/tda9850_module.c b/xorg-server/hw/xfree86/i2c/tda9850_module.c deleted file mode 100644 index 197d65a71..000000000 --- a/xorg-server/hw/xfree86/i2c/tda9850_module.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo tda9850VersRec = { - "tda9850", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData tda9850ModuleData = { - &tda9850VersRec, - NULL, - NULL -}; diff --git a/xorg-server/hw/xfree86/i2c/tda9885.c b/xorg-server/hw/xfree86/i2c/tda9885.c deleted file mode 100644 index fd859bde0..000000000 --- a/xorg-server/hw/xfree86/i2c/tda9885.c +++ /dev/null @@ -1,100 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86i2c.h" -#include "tda9885.h" -#include "i2c_def.h" - -TDA9885Ptr -Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr) -{ - TDA9885Ptr t; - I2CByte a; - - t = calloc(1, sizeof(TDA9885Rec)); - if (t == NULL) - return NULL; - switch (addr) { - case TDA9885_ADDR_1: - case TDA9885_ADDR_2: - case TDA9885_ADDR_3: - case TDA9885_ADDR_4: - t->d.DevName = "TDA9885 Alignment-free IF-PLL"; - break; - default: - t->d.DevName = "Generic TDAxxxx"; - break; - } - t->d.SlaveAddr = addr; - t->d.pI2CBus = b; - t->d.NextDev = NULL; - t->d.StartTimeout = b->StartTimeout; - t->d.BitTimeout = b->BitTimeout; - t->d.AcknTimeout = b->AcknTimeout; - t->d.ByteTimeout = b->ByteTimeout; - - if (!I2C_WriteRead(&(t->d), NULL, 0, &a, 1)) { - free(t); - return NULL; - } - - /* set default parameters */ - if (!I2CDevInit(&(t->d))) { - free(t); - return NULL; - } - - return t; -} - -Bool -tda9885_init(TDA9885Ptr t) -{ - t->forced_mute_audio = 1; - return TRUE; -} - -void -tda9885_getstatus(TDA9885Ptr t) -{ - CARD8 value; - - I2C_WriteRead(&(t->d), NULL, 0, &value, 1); - t->after_reset = value & 1; - t->afc_status = (value >> 1) & 0xf; - t->fm_carrier = (value >> 5) & 1; - t->vif_level = (value >> 6) & 1; - t->afc_win = (value >> 7) & 1; -} - -void -tda9885_setparameters(TDA9885Ptr t) -{ - CARD8 data[4]; - - data[0] = 0; /* start with subaddress 0 */ - data[1] = (t->sound_trap & 1) | ((t->auto_mute_fm & 1) << 1) | ((t->carrier_mode & 1) << 2) | ((t->modulation & 3) << 3) | ((t->forced_mute_audio & 1) << 5) | ((t->port1 & 1) << 6) | ((t->port2 & 1) << 7); /* B data */ - data[2] = (t->top_adjustment & 0x1f) | ((t->deemphasis & 0x3) << 5) | ((t->audio_gain & 1) << 7); /* C data */ - data[3] = (t->standard_sound_carrier & 0x3) | ((t->standard_video_if & 0x07) << 2) | ((t->minimum_gain & 0x01) << 5) | ((t->gating & 0x01) << 6) | ((t->vif_agc & 0x01) << 7); /* E data */ - - I2C_WriteRead(&(t->d), data, 4, NULL, 0); - - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "TDA9885 setparam: B data: %x, C data: %x, E data: %x\n", - data[1], data[2], data[3]); -} - -void -tda9885_dumpstatus(TDA9885Ptr t) -{ - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "TDA9885 status: after_reset=%d afc_status=%d (%3.1f kHz off) fm_carrier=%d vif_level=%d afc_win=%d %s\n", - t->after_reset, t->afc_status, - (t->afc_status < - 8) ? -12.5 - t->afc_status * 25.0 : -12.5 + (16 - - t->afc_status) * - 25.0, t->fm_carrier, t->vif_level, t->afc_win, - t->afc_win ? "VCO in" : "VCO out"); -} diff --git a/xorg-server/hw/xfree86/i2c/tda9885.h b/xorg-server/hw/xfree86/i2c/tda9885.h deleted file mode 100644 index 2d8a8af15..000000000 --- a/xorg-server/hw/xfree86/i2c/tda9885.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef __TDA9885_H__ -#define __TDA9885_H__ - -#include "xf86i2c.h" - -typedef struct { - I2CDevRec d; - - /* write-only parameters */ - /* B DATA */ - CARD8 sound_trap; - CARD8 auto_mute_fm; - CARD8 carrier_mode; - CARD8 modulation; - CARD8 forced_mute_audio; - CARD8 port1; - CARD8 port2; - /* C DATA */ - CARD8 top_adjustment; - CARD8 deemphasis; - CARD8 audio_gain; - /* E DATA */ - CARD8 standard_sound_carrier; - CARD8 standard_video_if; - CARD8 minimum_gain; - CARD8 gating; - CARD8 vif_agc; - /* read-only values */ - - CARD8 after_reset; - CARD8 afc_status; - CARD8 vif_level; - CARD8 afc_win; - CARD8 fm_carrier; -} TDA9885Rec, *TDA9885Ptr; - -#define TDA9885_ADDR_1 0x86 -#define TDA9885_ADDR_2 0x84 -#define TDA9885_ADDR_3 0x96 -#define TDA9885_ADDR_4 0x94 - -#define xf86_Detect_tda9885 Detect_tda9885 -extern _X_EXPORT TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr); - -#define xf86_tda9885_init tda9885_init -extern _X_EXPORT Bool tda9885_init(TDA9885Ptr t); - -#define xf86_tda9885_setparameters tda9885_setparameters -extern _X_EXPORT void tda9885_setparameters(TDA9885Ptr t); - -#define xf86_tda9885_getstatus tda9885_getstatus -extern _X_EXPORT void tda9885_getstatus(TDA9885Ptr t); - -#define xf86_tda9885_dumpstatus tda9885_dumpstatus -extern _X_EXPORT void tda9885_dumpstatus(TDA9885Ptr t); - -#define TDA9885SymbolsList \ - "Detect_tda9885", \ - "tda9885_init", \ - "tda9885_setaudio", \ - "tda9885_mute" - -#endif diff --git a/xorg-server/hw/xfree86/i2c/tda9885_module.c b/xorg-server/hw/xfree86/i2c/tda9885_module.c deleted file mode 100644 index e71bd6061..000000000 --- a/xorg-server/hw/xfree86/i2c/tda9885_module.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo tda9885VersRec = { - "tda9885", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData tda9885ModuleData = { - &tda9885VersRec, - NULL, - NULL -}; diff --git a/xorg-server/hw/xfree86/i2c/uda1380.c b/xorg-server/hw/xfree86/i2c/uda1380.c deleted file mode 100644 index 87226877b..000000000 --- a/xorg-server/hw/xfree86/i2c/uda1380.c +++ /dev/null @@ -1,196 +0,0 @@ -/************************************************************************************* - * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this - * software and associated documentation files (the "Software"), to deal in the Software - * without restriction, including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the author shall not be used in advertising or - * otherwise to promote the sale, use or other dealings in this Software without prior written - * authorization from the author. - * - ************************************************************************************/ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86.h" -#include "xf86i2c.h" -#include "uda1380.h" -#include "i2c_def.h" - -UDA1380Ptr -Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr) -{ - UDA1380Ptr t; - I2CByte a; - - t = calloc(1, sizeof(UDA1380Rec)); - if (t == NULL) - return NULL; - switch (addr) { - case UDA1380_ADDR_1: - case UDA1380_ADDR_2: - t->d.DevName = "UDA1380 Stereo audion coder-decoder"; - break; - default: - t->d.DevName = "Generic UDAxxxx"; - break; - } - t->d.SlaveAddr = addr; - t->d.pI2CBus = b; - t->d.NextDev = NULL; - t->d.StartTimeout = b->StartTimeout; - t->d.BitTimeout = b->BitTimeout; - t->d.AcknTimeout = b->AcknTimeout; - t->d.ByteTimeout = b->ByteTimeout; - - if (!I2C_WriteRead(&(t->d), NULL, 0, &a, 1)) { - free(t); - return NULL; - } - - /* set default parameters */ - if (!I2CDevInit(&(t->d))) { - free(t); - return NULL; - } - - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "UDA1380 stereo coder-decoder detected\n"); - - return t; -} - -Bool -uda1380_init(UDA1380Ptr t) -{ - CARD8 data[3]; - CARD16 tmp; - Bool ret; - - /* Power control */ - data[0] = 0x02; - tmp = - (1 << 13) | (1 << 10) | (1 << 8) | (1 << 7) | (1 << 6) | (1 << 3) | (1 - << - 1); - data[1] = (CARD8) ((tmp >> 8) & 0xff); - data[2] = (CARD8) (tmp & 0xff); - ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0); - if (ret == FALSE) { - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "UDA1380 failed to initialize\n"); - return FALSE; - } - - /* Analog mixer (AVC) */ - data[0] = 0x03; - /* the analog mixer is muted initially */ - data[1] = 0x3f; - data[2] = 0x3f; - ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0); - if (ret == FALSE) { - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "UDA1380 failed to initialize\n"); - return FALSE; - } - - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, "UDA1380 initialized\n"); - - return TRUE; -} - -void -uda1380_shutdown(UDA1380Ptr t) -{ - CARD8 data[3]; - Bool ret; - - /* Power control */ - data[0] = 0x02; - data[1] = 0; - data[2] = 0; - ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0); - if (ret == FALSE) - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "UDA1380 failed to shutdown\n"); -} - -void -uda1380_setvolume(UDA1380Ptr t, INT32 value) -{ - CARD8 data[3]; - - /* - * We have to scale the value ranging from -1000 to 1000 to 0x2c to 0 - */ - CARD8 volume = 47 - (CARD8) ((value + 1000) * 47 / 2000); - Bool ret; - - t->analog_mixer_settings = ((volume << 8) & 0x3f00) | (volume & 0x3f); - - /* Analog mixer (AVC) */ - data[0] = 0x03; - data[1] = volume & 0x3f; - data[2] = volume & 0x3f; - ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0); - if (ret == FALSE) - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "UDA1380 failed to set volume\n"); -} - -void -uda1380_mute(UDA1380Ptr t, Bool mute) -{ - CARD8 data[3]; - Bool ret; - - if (mute == TRUE) { - /* Analog mixer (AVC) */ - data[0] = 0x03; - data[1] = 0xff; - data[2] = 0xff; - ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0); - if (ret == FALSE) - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "UDA1380 failed to mute\n"); - } - else { - /* Analog mixer (AVC) */ - data[0] = 0x03; - data[1] = (CARD8) ((t->analog_mixer_settings >> 8) & 0x3f); - data[2] = (CARD8) (t->analog_mixer_settings & 0x3f); - ret = I2C_WriteRead(&(t->d), data, 3, NULL, 0); - if (ret == FALSE) - xf86DrvMsg(t->d.pI2CBus->scrnIndex, X_INFO, - "UDA1380 failed to unmute\n"); - } -} - -void -uda1380_getstatus(UDA1380Ptr t) -{ -} - -void -uda1380_setparameters(UDA1380Ptr t) -{ -} - -void -uda1380_dumpstatus(UDA1380Ptr t) -{ -} diff --git a/xorg-server/hw/xfree86/i2c/uda1380.h b/xorg-server/hw/xfree86/i2c/uda1380.h deleted file mode 100644 index f0bc6167a..000000000 --- a/xorg-server/hw/xfree86/i2c/uda1380.h +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************************* - * Copyright (C) 2005 Bogdan D. bogdand@users.sourceforge.net - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this - * software and associated documentation files (the "Software"), to deal in the Software - * without restriction, including without limitation the rights to use, copy, modify, - * merge, publish, distribute, sublicense, and/or sell copies of the Software, - * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE - * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the author shall not be used in advertising or - * otherwise to promote the sale, use or other dealings in this Software without prior written - * authorization from the author. - * - * Revision 1.3 2005/09/24 21:56:00 bogdand - * Changed the license to a X/MIT one - * - * Revision 1.2 2005/07/01 22:43:11 daniels - * Change all misc.h and os.h references to . - * - * - ************************************************************************************/ - -#ifndef __UDA1380_H__ -#define __UDA1380_H__ - -#include "xf86i2c.h" - -typedef struct { - I2CDevRec d; - - CARD16 analog_mixer_settings; /* register 0x03 */ - -} UDA1380Rec, *UDA1380Ptr; - -#define UDA1380_ADDR_1 0x30 -#define UDA1380_ADDR_2 0x34 - -#define xf86_Detect_uda1380 Detect_uda1380 -extern _X_EXPORT UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr); - -#define xf86_uda1380_init uda1380_init -extern _X_EXPORT Bool uda1380_init(UDA1380Ptr t); - -#define xf86_uda1380_shutdown uda1380_shutdown -extern _X_EXPORT void uda1380_shutdown(UDA1380Ptr t); - -#define xf86_uda1380_setvolume uda1380_setvolume -extern _X_EXPORT void uda1380_setvolume(UDA1380Ptr t, INT32); - -#define xf86_uda1380_mute uda1380_mute -extern _X_EXPORT void uda1380_mute(UDA1380Ptr t, Bool); - -#define xf86_uda1380_setparameters uda1380_setparameters -extern _X_EXPORT void uda1380_setparameters(UDA1380Ptr t); - -#define xf86_uda1380_getstatus uda1380_getstatus -extern _X_EXPORT void uda1380_getstatus(UDA1380Ptr t); - -#define xf86_uda1380_dumpstatus uda1380_dumpstatus -extern _X_EXPORT void uda1380_dumpstatus(UDA1380Ptr t); - -#define UDA1380SymbolsList \ - "Detect_uda1380", \ - "uda1380_init", \ - "uda1380_shutdown", \ - "uda1380_setvolume", \ - "uda1380_mute", \ - "uda1380_setparameters", \ - "uda1380_getstatus", \ - "uda1380_dumpstatus" - -#endif diff --git a/xorg-server/hw/xfree86/i2c/uda1380_module.c b/xorg-server/hw/xfree86/i2c/uda1380_module.c deleted file mode 100644 index dca834b12..000000000 --- a/xorg-server/hw/xfree86/i2c/uda1380_module.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include "xf86Module.h" - -static XF86ModuleVersionInfo uda1380VersRec = { - "uda1380", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XORG_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* This needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0, 0, 0, 0} -}; - -_X_EXPORT XF86ModuleData uda1380ModuleData = { - &uda1380VersRec, - NULL, - NULL -}; diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c index e1f649a74..f1f7c224f 100644 --- a/xorg-server/hw/xfree86/loader/loadmod.c +++ b/xorg-server/hw/xfree86/loader/loadmod.c @@ -197,7 +197,6 @@ static const char *stdSubdirs[] = { "", "input/", "drivers/", - "multimedia/", "extensions/", "internal/", NULL diff --git a/xorg-server/hw/xfree86/man/xorg.conf.man b/xorg-server/hw/xfree86/man/xorg.conf.man index bc33df197..16312124d 100644 --- a/xorg-server/hw/xfree86/man/xorg.conf.man +++ b/xorg-server/hw/xfree86/man/xorg.conf.man @@ -132,14 +132,14 @@ is the path specified with the .B \-configdir command line option (which may be absolute or relative). .PP -Finally, configuration files will also be searched for in directories -reserved for system use. These are to separate configuration files from -the vendor or 3rd party packages from those of local administration. -These files are found in the following directories: +Finally, configuration files will also be searched for in a directory reserved +for system use. +This is to separate configuration files from the vendor or 3rd party packages +from those of local administration. +These files are found in the following directory: .PP .RS 4 .nf -.I /usr/share/X11/__xconfigdir__ .I __datadir__/X11/__xconfigdir__ .fi .RE diff --git a/xorg-server/hw/xwayland/xwayland-input.c b/xorg-server/hw/xwayland/xwayland-input.c index 990cb82d8..cc5f7df05 100644 --- a/xorg-server/hw/xwayland/xwayland-input.c +++ b/xorg-server/hw/xwayland/xwayland-input.c @@ -491,31 +491,43 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, { struct xwl_seat *xwl_seat = data; - if (caps & WL_SEAT_CAPABILITY_POINTER && xwl_seat->pointer == NULL) { + if (caps & WL_SEAT_CAPABILITY_POINTER && xwl_seat->wl_pointer == NULL) { xwl_seat->wl_pointer = wl_seat_get_pointer(seat); wl_pointer_add_listener(xwl_seat->wl_pointer, &pointer_listener, xwl_seat); - xwl_seat_set_cursor(xwl_seat); - xwl_seat->pointer = - add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc); - } - else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->pointer) { + + if (xwl_seat->pointer) + EnableDevice(xwl_seat->pointer, TRUE); + else { + xwl_seat_set_cursor(xwl_seat); + xwl_seat->pointer = + add_device(xwl_seat, "xwayland-pointer", xwl_pointer_proc); + } + } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && xwl_seat->wl_pointer) { wl_pointer_release(xwl_seat->wl_pointer); - RemoveDevice(xwl_seat->pointer, FALSE); - xwl_seat->pointer = NULL; + xwl_seat->wl_pointer = NULL; + + if (xwl_seat->pointer) + DisableDevice(xwl_seat->pointer, TRUE); } - if (caps & WL_SEAT_CAPABILITY_KEYBOARD && xwl_seat->keyboard == NULL) { + if (caps & WL_SEAT_CAPABILITY_KEYBOARD && xwl_seat->wl_keyboard == NULL) { xwl_seat->wl_keyboard = wl_seat_get_keyboard(seat); wl_keyboard_add_listener(xwl_seat->wl_keyboard, &keyboard_listener, xwl_seat); - xwl_seat->keyboard = - add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc); - } - else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->keyboard) { + + if (xwl_seat->keyboard) + EnableDevice(xwl_seat->keyboard, TRUE); + else { + xwl_seat->keyboard = + add_device(xwl_seat, "xwayland-keyboard", xwl_keyboard_proc); + } + } else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && xwl_seat->wl_keyboard) { wl_keyboard_release(xwl_seat->wl_keyboard); - RemoveDevice(xwl_seat->keyboard, FALSE); - xwl_seat->keyboard = NULL; + xwl_seat->wl_keyboard = NULL; + + if (xwl_seat->keyboard) + DisableDevice(xwl_seat->keyboard, TRUE); } xwl_seat->xwl_screen->expecting_event--; diff --git a/xorg-server/include/dix-config.h.in b/xorg-server/include/dix-config.h.in index f980a3d37..2203f82b4 100644 --- a/xorg-server/include/dix-config.h.in +++ b/xorg-server/include/dix-config.h.in @@ -493,4 +493,7 @@ /* Build glamor's GBM-based EGL support */ #undef GLAMOR_HAS_GBM +/* byte order */ +#undef X_BYTE_ORDER + #endif /* _DIX_CONFIG_H_ */ diff --git a/xorg-server/include/servermd.h b/xorg-server/include/servermd.h index e41331463..0132d67bf 100644 --- a/xorg-server/include/servermd.h +++ b/xorg-server/include/servermd.h @@ -47,290 +47,21 @@ SOFTWARE. #ifndef SERVERMD_H #define SERVERMD_H 1 -/* - * Note: much of this is vestigial from mfb/cfb times. This should - * really be simplified even further. - */ - -/* - * Machine dependent values: - * GLYPHPADBYTES should be chosen with consideration for the space-time - * trade-off. Padding to 0 bytes means that there is no wasted space - * in the font bitmaps (both on disk and in memory), but that access of - * the bitmaps will cause odd-address memory references. Padding to - * 2 bytes would ensure even address memory references and would - * be suitable for a 68010-class machine, but at the expense of wasted - * space in the font bitmaps. Padding to 4 bytes would be good - * for real 32 bit machines, etc. Be sure that you tell the font - * compiler what kind of padding you want because its defines are - * kept separate from this. See server/include/font.h for how - * GLYPHPADBYTES is used. - */ - -#ifdef __avr32__ - -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 - -#endif /* __avr32__ */ - -#ifdef __arm32__ - -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 - -#endif /* __arm32__ */ - -#if defined(__nds32__) - -#define IMAGE_BYTE_ORDER LSBFirst - -#if defined(XF86MONOVGA) || defined(XF86VGA16) || defined(XF86MONO) -#define BITMAP_BIT_ORDER MSBFirst -#else -#define BITMAP_BIT_ORDER LSBFirst -#endif - -#if defined(XF86MONOVGA) || defined(XF86VGA16) -#define BITMAP_SCANLINE_UNIT 8 -#endif - -#define GLYPHPADBYTES 4 -#define GETLEFTBITS_ALIGNMENT 1 -#define LARGE_INSTRUCTION_CACHE -#define AVOID_MEMORY_READ - -#endif /* __nds32__ */ - -#if defined __hppa__ - -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 /* to make fb work */ - /* byte boundries */ -#endif /* hpux || __hppa__ */ - -#if defined(__powerpc__) || defined(__ppc__) || defined(__ppc64__) - -#if defined(__LITTLE_ENDIAN__) -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#else -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#endif -#define GLYPHPADBYTES 4 - -#endif /* PowerPC */ - -#if defined(__sh__) - -#if defined(__BIG_ENDIAN__) -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#else -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 -#endif - -#endif /* SuperH */ - -#if defined(__m32r__) - -#if defined(__BIG_ENDIAN__) -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#else -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 -#endif - -#endif /* __m32r__ */ - -#if (defined(sun) && (defined(__sparc) || defined(sparc))) || \ - (defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \ - defined(__sparc__) || defined(__mc68000__) - -#if defined(__sparc) || defined(__sparc__) -#if !defined(sparc) -#define sparc 1 -#endif -#endif - -#if defined(sun386) || defined(sun5) -#define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */ -#define BITMAP_BIT_ORDER LSBFirst -#else -#define IMAGE_BYTE_ORDER MSBFirst /* Values for the SUN only */ -#define BITMAP_BIT_ORDER MSBFirst -#endif - -#define GLYPHPADBYTES 4 - -#endif /* sun && !(i386 && SVR4) */ - -#if defined(ibm032) || defined (ibm) - -#ifdef __i386__ -#define IMAGE_BYTE_ORDER LSBFirst /* Value for PS/2 only */ -#else -#define IMAGE_BYTE_ORDER MSBFirst /* Values for the RT only */ -#endif -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 1 -/* ibm pcc doesn't understand pragmas. */ +#include "dix-config.h" -#ifdef __i386__ -#define BITMAP_SCANLINE_UNIT 8 -#endif - -#endif /* ibm */ - -#if (defined(mips) || defined(__mips)) - -#if defined(MIPSEL) || defined(__MIPSEL__) -#define IMAGE_BYTE_ORDER LSBFirst /* Values for the PMAX only */ -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 -#else -#define IMAGE_BYTE_ORDER MSBFirst /* Values for the MIPS only */ -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#endif - -#endif /* mips */ - -#if defined(__alpha) || defined(__alpha__) -#define IMAGE_BYTE_ORDER LSBFirst /* Values for the Alpha only */ -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 - -#endif /* alpha */ - -#if defined (linux) && defined (__s390__) - -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 - -#define BITMAP_SCANLINE_UNIT 8 -#define FAST_UNALIGNED_READ - -#endif /* linux/s390 */ - -#if defined (linux) && defined (__s390x__) - -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 - -#define BITMAP_SCANLINE_UNIT 8 -#define FAST_UNALIGNED_READ - -#endif /* linux/s390x */ - -#if defined(__ia64__) || defined(ia64) - -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 - -#endif /* ia64 */ - -#if defined(__amd64__) || defined(amd64) || defined(__amd64) -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 -/* ???? */ -#endif /* AMD64 */ - -#if defined(SVR4) && (defined(__i386__) || defined(__i386) ) || \ - defined(__alpha__) || defined(__alpha) || \ - defined(__i386__) || \ - defined(__s390x__) || defined(__s390__) - -#ifndef IMAGE_BYTE_ORDER -#define IMAGE_BYTE_ORDER LSBFirst -#endif - -#ifndef BITMAP_BIT_ORDER -#define BITMAP_BIT_ORDER LSBFirst -#endif - -#ifndef GLYPHPADBYTES -#define GLYPHPADBYTES 4 -#endif - -#endif /* SVR4 / BSD / i386 */ - -#if defined (linux) && defined (__mc68000__) - -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 - -#endif /* linux/m68k */ - -/* linux on ARM */ -#if defined(linux) && defined(__arm__) -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#define GLYPHPADBYTES 4 -#endif - -/* linux on IBM S/390 */ -#if defined (linux) && defined (__s390__) -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#define GLYPHPADBYTES 4 -#endif /* linux/s390 */ - -#ifdef __aarch64__ - -#ifdef __AARCH64EL__ +#if X_BYTE_ORDER == X_LITTLE_ENDIAN #define IMAGE_BYTE_ORDER LSBFirst #define BITMAP_BIT_ORDER LSBFirst -#endif -#ifdef __AARCH64EB__ +#elif X_BYTE_ORDER == X_BIG_ENDIAN #define IMAGE_BYTE_ORDER MSBFirst #define BITMAP_BIT_ORDER MSBFirst -#endif -#define GLYPHPADBYTES 4 - -#endif /* __aarch64__ */ - -#if defined(__arc__) - -#if defined(__BIG_ENDIAN__) -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst #else -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst +#error "Too weird to live." #endif -#define GLYPHPADBYTES 4 - -#endif /* ARC */ - -#ifdef __xtensa__ -#ifdef __XTENSA_EL__ -#define IMAGE_BYTE_ORDER LSBFirst -#define BITMAP_BIT_ORDER LSBFirst -#endif -#ifdef __XTENSA_EB__ -#define IMAGE_BYTE_ORDER MSBFirst -#define BITMAP_BIT_ORDER MSBFirst -#endif +#ifndef GLYPHPADBYTES #define GLYPHPADBYTES 4 - -#endif /* __xtensa__ */ +#endif /* size of buffer to use with GetImage, measured in bytes. There's obviously * a trade-off between the amount of heap used and the number of times the @@ -390,8 +121,4 @@ extern _X_EXPORT PaddingInfo PixmapWidthPaddingInfo[]; #define BitmapBytePad(w) \ (((int)((w) + BITMAP_SCANLINE_PAD - 1) >> LOG2_BITMAP_PAD) << LOG2_BYTES_PER_SCANLINE_PAD) -#define PixmapWidthInPadUnitsProto(w, d) PixmapWidthInPadUnits(w, d) -#define PixmapBytePadProto(w, d) PixmapBytePad(w, d) -#define BitmapBytePadProto(w) BitmapBytePad(w) - #endif /* SERVERMD_H */ diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c index 872ff93da..8907a6ea1 100644 --- a/xorg-server/mi/mieq.c +++ b/xorg-server/mi/mieq.c @@ -516,7 +516,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev, InternalEvent *event, ScreenPtr screen) verify_internal_event(event); /* refuse events from disabled devices */ - if (!dev->enabled) + if (dev && !dev->enabled) return; /* Custom event handler */ diff --git a/xorg-server/xkeyboard-config/symbols/es b/xorg-server/xkeyboard-config/symbols/es index ab29a05df..ce407ff96 100644 --- a/xorg-server/xkeyboard-config/symbols/es +++ b/xorg-server/xkeyboard-config/symbols/es @@ -86,8 +86,8 @@ xkb_symbols "dvorak" { key {[ apostrophe, question, dead_macron, dead_ogonek ]}; key {[ exclamdown, questiondown, dead_breve, dead_abovedot ]}; - key {[ period, colon, less ]}; - key {[ comma, semicolon, greater ]}; + key {[ period, colon, less, guillemotleft ]}; + key {[ comma, semicolon, greater, guillemotright ]}; key {[ ntilde, Ntilde, lstroke, Lstroke ]}; key {[ p, P, paragraph ]}; key {[ y, Y, yen ]}; -- cgit v1.2.3