ch10.xml revision 0f8248bf
1<?xml version="1.0" encoding="UTF-8" ?> 2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" 3 "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"> 4<chapter id='Keyboard_Controls'> 5<title>Keyboard Controls</title> 6 7<indexterm significance="preferred" zone="Keyboard_Controls"> 8<primary>controls</primary></indexterm> 9<indexterm significance="preferred" zone="Keyboard_Controls"> 10<primary>server controls</primary></indexterm> 11<indexterm significance="preferred" zone="Keyboard_Controls"> 12<primary>controls</primary><secondary>server</secondary></indexterm> 13 14<para> 15The Xkb extension is composed of two parts: a server extension, and a 16client-side X library extension. This chapter discusses functions used to 17modify controls effecting the behavior of the server portion of the Xkb 18extension. <xref linkend="X_Library_Controls" /> discusses functions used to modify controls that affect 19only the behavior of the client portion of the extension; those controls are 20known as Library Controls. 21</para> 22 23 24<para> 25Xkb contains control features that affect the entire keyboard, known as global 26keyboard controls. Some of the controls may be selectively enabled and 27disabled; these controls are known as the 28<firstterm>Boolean Controls</firstterm>. 29<indexterm significance="preferred" zone="Keyboard_Controls"> 30<primary>boolean controls</primary></indexterm> 31<indexterm significance="preferred" zone="Keyboard_Controls"> 32<primary>controls</primary><secondary>boolean</secondary></indexterm> 33Boolean Controls can be turned on or off under program control and can also 34be automatically set to an on or off condition when a client program exits. The 35remaining controls, known as the 36<firstterm>Non-Boolean Controls</firstterm>, 37<indexterm significance="preferred" zone="Keyboard_Controls"> 38<primary>non-boolean controls</primary></indexterm> 39<indexterm significance="preferred" zone="Keyboard_Controls"> 40<primary>controls</primary><secondary>non-boolean</secondary></indexterm> 41are always active. The 42<structname>XkbControlsRec</structname> 43structure describes the current state of most of the global controls and the 44attributes effecting the behavior of each of these Xkb features. This chapter 45describes the Xkb controls and how to manipulate them. 46</para> 47 48 49<para> 50There are two possible components for each of the Boolean Controls: attributes 51describing how the control should work, and a state describing whether the 52behavior as a whole is enabled or disabled. The attributes and state for most 53of these controls are held in the 54<structname>XkbControlsRec</structname> 55structure (see <link linkend="The_XkbControlsRec_Structure">section 10.8</link>). 56</para> 57 58 59<para> 60You can manipulate the Xkb controls individually, via convenience functions, or 61as a whole. To treat them as a group, modify an 62<structname>XkbControlsRec</structname> 63structure to describe all of the changes to be made, and then pass that 64structure and appropriate flags to an Xkb library function, or use a 65<structname>XkbControlsChangesRec</structname> 66(see <link linkend="The_XkbControlsChangesRec_Structure">section 10.10.1</link>) to reduce network traffic. When using a convenience 67function to manipulate one control individually, you do not use an 68<structname>XkbControlsRec</structname> 69structure directly. 70</para> 71 72 73<para> 74The Xkb controls are grouped as shown in 75<link linkend="table10.1">Table 10.1</link>. 76</para> 77 78<table id='table10.1' frame='topbot'> 79<title>Xkb Keyboard Controls</title> 80<?dbfo keep-together="always" ?> 81<tgroup cols='3' align='left' colsep='0' rowsep='0'> 82<colspec colname='c1' colwidth='1.5*'/> 83<colspec colname='c2' colwidth='1.5*'/> 84<colspec colname='c3' colwidth='1.0*'/> 85<thead> 86<row rowsep='1'> 87 <entry>Type of Control</entry> 88 <entry>Control Name</entry> 89 <entry>Boolean Control?</entry> 90 </row> 91</thead> 92<tbody> 93 <row> 94 <entry>Controls for enabling and disabling other controls</entry> 95 <entry>EnabledControls</entry> 96 <entry>No</entry> 97 </row> 98 <row> 99 <entry></entry> 100 <entry>AutoReset</entry> 101 <entry>No</entry> 102 </row> 103 <row> 104 <entry>Control for bell behavior</entry> 105 <entry>AudibleBell</entry> 106 <entry>Boolean</entry> 107 </row> 108 <row> 109 <entry>Controls for repeat key behavior</entry> 110 <entry>PerKeyRepeat</entry> 111 <entry>No</entry> 112 </row> 113 <row> 114 <entry></entry> 115 <entry>RepeatKeys</entry> 116 <entry>Boolean</entry> 117 </row> 118 <row> 119 <entry></entry> 120 <entry>DetectableAutorepeat</entry> 121 <entry>Boolean</entry> 122 </row> 123 <row> 124 <entry>Controls for keyboard overlays</entry> 125 <entry>Overlay1</entry> 126 <entry>Boolean</entry> 127 </row> 128 <row> 129 <entry></entry> 130 <entry>Overlay2</entry> 131 <entry>Boolean</entry> 132 </row> 133 <row> 134 <entry>Controls for using the mouse from the keyboard</entry> 135 <entry>MouseKeys</entry> 136 <entry>Boolean</entry> 137 </row> 138 <row> 139 <entry></entry> 140 <entry>MouseKeysAccel</entry> 141 <entry>Boolean</entry> 142 </row> 143 <row> 144 <entry>Controls for better keyboard access by </entry> 145 <entry>AccessXFeedback</entry> 146 <entry>Boolean</entry> 147 </row> 148 <row> 149 <entry>physically impaired persons</entry> 150 <entry>AccessXKeys</entry> 151 <entry>Boolean</entry> 152 </row> 153 <row> 154 <entry></entry> 155 <entry>AccessXTimeout</entry> 156 <entry>Boolean</entry> 157 </row> 158 <row> 159 <entry></entry> 160 <entry>BounceKeys</entry> 161 <entry>Boolean</entry> 162 </row> 163 <row> 164 <entry></entry> 165 <entry>SlowKeys</entry> 166 <entry>Boolean</entry> 167 </row> 168 <row> 169 <entry></entry> 170 <entry>StickyKeys</entry> 171 <entry>Boolean</entry> 172 </row> 173 <row> 174 <entry>Controls for general keyboard mapping</entry> 175 <entry>GroupsWrap</entry> 176 <entry>No</entry> 177 </row> 178 <row> 179 <entry></entry> 180 <entry>IgnoreGroupLock</entry> 181 <entry>Boolean</entry> 182 </row> 183 <row> 184 <entry></entry> 185 <entry>IgnoreLockMods</entry> 186 <entry>No</entry> 187 </row> 188 <row> 189 <entry></entry> 190 <entry>InternalMods</entry> 191 <entry>No</entry> 192 </row> 193 <row> 194 <entry>Miscellaneous per-client controls</entry> 195 <entry>GrabsUseXKBState</entry> 196 <entry>Boolean</entry> 197 </row> 198 <row> 199 <entry></entry> 200 <entry>LookupStateWhenGrabbed</entry> 201 <entry>Boolean</entry> 202 </row> 203 <row> 204 <entry></entry> 205 <entry>SendEventUsesXKBState</entry> 206 <entry>Boolean</entry> 207 </row> 208</tbody> 209</tgroup> 210</table> 211 212<para> 213The individual categories and controls are described first, together with 214functions for manipulating them. A description of the 215<structname>XkbControlsRec</structname> 216structure and the general functions for dealing with all of the controls at 217once follow at the end of the chapter. 218</para> 219 220<sect1 id='Controls_that_Enable_and_Disable_Other_Controls'> 221<title>Controls that Enable and Disable Other Controls</title> 222 223<para> 224Enable and disable the boolean controls under program control by using the 225<emphasis>EnabledControls</emphasis> 226control; enable and disable them upon program exit by configuring the 227<emphasis>AutoReset</emphasis> 228control. 229</para> 230 231 232<sect2 id='The_EnabledControls_Control'> 233<title>The EnabledControls Control</title> 234 235<para> 236The 237<emphasis>EnabledControls</emphasis> 238control is a bit mask where each bit that is turned on means the corresponding 239control is enabled, and when turned off, disabled. It corresponds to the 240<structfield>enabled_ctrls</structfield> 241field of an 242<structname>XkbControlsRec</structname> 243structure (see <link linkend="The_XkbControlsRec_Structure">section 10.8</link>). The bits describing which controls are turned on 244or off are defined in <link linkend="table10.7">Table 10.7</link>. 245</para> 246 247 248<para> 249Use 250<function>XkbChangeEnabledControls</function> 251to manipulate the 252<emphasis>EnabledControls</emphasis> 253control. 254</para> 255 256<indexterm significance="preferred" zone="XkbChangeEnabledControls"><primary><function>XkbChangeEnabledControls</function></primary></indexterm> 257<funcsynopsis id="XkbChangeEnabledControls"> 258 <funcprototype> 259 <funcdef>Bool <function>XkbChangeEnabledControls</function></funcdef> 260<!-- ( 261<parameter>dpy</parameter>, 262<parameter>device_spec</parameter>, 263<parameter>mask</parameter>, 264<parameter>values</parameter> 265) --> 266 267 <paramdef>Display *<parameter>dpy</parameter></paramdef> 268 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 269 <paramdef>unsigned int <parameter>mask</parameter></paramdef> 270 <paramdef>unsigned int <parameter>values</parameter></paramdef> 271 </funcprototype> 272</funcsynopsis> 273<variablelist> 274 <varlistentry> 275 <term> 276 <parameter>dpy</parameter> 277 </term> 278 <listitem> 279 <para> 280 connection to X server 281 </para> 282 </listitem> 283 </varlistentry> 284 <varlistentry> 285 <term> 286 <parameter>device_spec</parameter> 287 </term> 288 <listitem> 289 <para> 290 keyboard device to modify 291 </para> 292 </listitem> 293 </varlistentry> 294 <varlistentry> 295 <term> 296 <parameter>mask</parameter> 297 </term> 298 <listitem> 299 <para> 300 1 bit → controls to enable / disable 301 </para> 302 </listitem> 303 </varlistentry> 304 <varlistentry> 305 <term> 306 <parameter>values</parameter> 307 </term> 308 <listitem> 309 <para> 310 1 bit ⇒ enable, 0 bit ⇒ disable 311 </para> 312 </listitem> 313 </varlistentry> 314</variablelist> 315 316<para> 317The 318<parameter>mask</parameter> 319parameter specifies the boolean controls to be enabled or disabled, and the 320<parameter>values</parameter> 321mask specifies the new state for those controls. Valid values for both of 322these masks are composed of a bitwise inclusive OR of bits taken from the set 323of mask bits in <link linkend="table10.7">Table 10.7</link>, 324using only those masks with <quote>ok</quote> in the 325<structfield>enabled_ctrls</structfield> 326column. 327</para> 328 329 330<para> 331If the X server does not support a compatible version of Xkb or the Xkb 332extension has not been properly initialized, 333<function>XkbChangeEnabledControls</function> 334returns 335<symbol>False</symbol>; 336otherwise, it sends the request to the X server and returns 337<symbol>True</symbol>. 338</para> 339 340 341<para> 342Note that the 343<emphasis>EnabledControls</emphasis> 344control only enables and disables controls; it does not configure them. Some 345controls, such as the 346<emphasis>AudibleBell</emphasis> 347control, have no configuration attributes and are therefore manipulated solely 348by enabling and disabling them. Others, however, have additional attributes to 349configure their behavior. For example, the 350<emphasis>RepeatControl</emphasis> 351control uses 352<structfield>repeat_delay</structfield> 353and 354<structfield>repeat_interval</structfield> 355fields to describe the timing behavior of keys that repeat. The 356<emphasis>RepeatControl</emphasis> 357behavior is turned on or off depending on the value of the 358<symbol>XkbRepeatKeysMask</symbol> 359bit, but you must use other means, as described in this chapter, to configure 360its behavior in detail. 361</para> 362 363 364</sect2> 365<sect2 id='The_AutoReset_Control'> 366<title>The AutoReset Control</title> 367 368<para> 369You can configure the boolean controls to automatically be enabled or disabled 370when a program exits. This capability is controlled via two masks maintained in 371the X server on a per-client basis. There is no client-side Xkb data structure 372corresponding to these masks. Whenever the client exits for any reason, any 373boolean controls specified in the 374<firstterm>auto-reset mask</firstterm> 375<indexterm significance="preferred" zone="The_AutoReset_Control"> 376<primary>auto-reset mask</primary></indexterm> 377<indexterm significance="preferred" zone="The_AutoReset_Control"> 378<primary>mask</primary><secondary>auto-reset</secondary></indexterm> 379are set to the corresponding value from the 380<firstterm>auto-reset values</firstterm> 381mask. This makes it possible for clients to "clean up after themselves" 382automatically, even if abnormally terminated. The bits used in the masks 383correspond to the 384<emphasis>EnabledControls</emphasis> 385control bits. 386</para> 387 388 389<para> 390For example, a client that replaces the keyboard bell with some other audible 391cue might want to turn off the 392<emphasis>AudibleBell</emphasis> 393control to prevent the server from also generating a sound and avoid 394cacophony. If the client were to exit without resetting the 395<emphasis>AudibleBell</emphasis> 396control, the user would be left without any feedback at all. Setting 397<emphasis>AudibleBell</emphasis> 398in both the auto-reset mask and auto-reset values guarantees that the audible 399bell will be turned back on when the client exits. 400</para> 401 402 403<para> 404To get the current values of the auto-reset controls, use 405<function>XkbGetAutoResetControls</function>. 406</para> 407 408<indexterm significance="preferred" zone="XkbGetAutoResetControls"><primary><function>XkbGetAutoResetControls</function></primary></indexterm> 409<funcsynopsis id="XkbGetAutoResetControls"> 410 <funcprototype> 411 <funcdef>Bool <function>XkbGetAutoResetControls</function></funcdef> 412<!-- ( 413<parameter>dpy</parameter>, 414<parameter>auto_ctrls</parameter>, 415<parameter>auto_values</parameter> 416) --> 417 418 <paramdef>Display *<parameter>dpy</parameter></paramdef> 419 <paramdef>unsigned int *<parameter>auto_ctrls</parameter></paramdef> 420 <paramdef>unsigned int *<parameter>auto_values</parameter></paramdef> 421 </funcprototype> 422</funcsynopsis> 423<variablelist> 424 <varlistentry> 425 <term> 426 <parameter>dpy</parameter> 427 </term> 428 <listitem> 429 <para> 430 connection to X server 431 </para> 432 </listitem> 433 </varlistentry> 434 <varlistentry> 435 <term> 436 <parameter>auto_ctrls</parameter> 437 </term> 438 <listitem> 439 <para> 440 specifies which bits in <parameter>auto_values</parameter> are relevant 441 </para> 442 </listitem> 443 </varlistentry> 444 <varlistentry> 445 <term> 446 <parameter>auto_values</parameter> 447 </term> 448 <listitem> 449 <para> 450 1 bit ⇒ corresponding control has auto-reset on 451 </para> 452 </listitem> 453 </varlistentry> 454</variablelist> 455 456<para> 457<function>XkbGetAutoResetControls</function> 458backfills 459<parameter>auto_ctrls</parameter> 460and 461<parameter>auto_values</parameter> 462with the 463<emphasis>AutoReset</emphasis> 464control attributes for this particular client. It returns 465<symbol>True</symbol> 466if successful, and 467<symbol>False</symbol> 468otherwise. 469</para> 470 471 472<para> 473To change the current values of the 474<emphasis>AutoReset</emphasis> 475control attributes, use 476<function>XkbSetAutoResetControls</function>. 477</para> 478 479 480<indexterm significance="preferred" zone="XkbSetAutoResetControls"><primary><function>XkbSetAutoResetControls</function></primary></indexterm> 481<funcsynopsis id="XkbSetAutoResetControls"> 482 <funcprototype> 483 <funcdef>Bool <function>XkbSetAutoResetControls</function></funcdef> 484<!-- ( 485<parameter>dpy</parameter>, 486<parameter>changes</parameter>, 487<parameter>auto_ctrls</parameter>, 488<parameter>auto_values</parameter> 489) --> 490 491 <paramdef>Display *<parameter>dpy</parameter></paramdef> 492 <paramdef>unsigned int <parameter>changes</parameter></paramdef> 493 <paramdef>unsigned int *<parameter>auto_ctrls</parameter></paramdef> 494 <paramdef>unsigned int *<parameter>auto_values</parameter></paramdef> 495 </funcprototype> 496</funcsynopsis> 497<variablelist> 498 <varlistentry> 499 <term> 500 <parameter>dpy</parameter> 501 </term> 502 <listitem> 503 <para> 504 connection to X server 505 </para> 506 </listitem> 507 </varlistentry> 508 <varlistentry> 509 <term> 510 <parameter>changes</parameter> 511 </term> 512 <listitem> 513 <para> 514 controls for which to change auto-reset values 515 </para> 516 </listitem> 517 </varlistentry> 518 <varlistentry> 519 <term> 520 <parameter>auto_ctrls</parameter> 521 </term> 522 <listitem> 523 <para> 524 controls from changes that should auto reset 525 </para> 526 </listitem> 527 </varlistentry> 528 <varlistentry> 529 <term> 530 <parameter>auto_values</parameter> 531 </term> 532 <listitem> 533 <para> 534 1 bit ⇒ auto-reset on 535 </para> 536 </listitem> 537 </varlistentry> 538</variablelist> 539 540<para> 541<function>XkbSetAutoResetControls</function> 542changes the auto-reset status and associated auto-reset 543values for the controls selected by 544<parameter>changes</parameter>. 545For any control selected by 546<parameter>changes</parameter>, 547if the corresponding bit is set in 548<parameter>auto_ctrls</parameter>, 549the control is configured to auto-reset when the client exits. If the 550corresponding bit in 551<parameter>auto_values</parameter> 552is on, the control is turned on when the client exits; 553if zero, the control is turned off when the client exits. 554For any control selected by 555<parameter>changes</parameter>, 556if the corresponding bit is not set in 557<parameter>auto_ctrls</parameter>, 558the control is configured to not reset when the client exits. For example: 559</para> 560 561 562<para> 563To leave the auto-reset controls for 564<emphasis>StickyKeys</emphasis> 565the way they are: 566 567<programlisting> 568 ok = XkbSetAutoResetControls(dpy, 0, 0, 0); 569</programlisting></para> 570 571<para> 572To change the auto-reset controls so that 573<emphasis>StickyKeys</emphasis> 574are unaffected when the client exits: 575 576<programlisting> 577 ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, 0, 0); 578</programlisting></para> 579 580<para> 581To change the auto-reset controls so that 582<emphasis>StickyKeys</emphasis> 583are turned off when the client exits: 584 585<programlisting> 586 ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask, 0); 587</programlisting></para> 588 589<para> 590To change the auto-reset controls so that 591<emphasis>StickyKeys</emphasis> 592are turned on when the client exits: 593 594<programlisting> 595 ok = XkbSetAutoResetControls(dpy, XkbStickyKeysMask, XkbStickyKeysMask, 596 XkbStickyKeysMask); 597</programlisting></para> 598 599<para> 600<function>XkbSetAutoResetControls</function> 601backfills 602<parameter>auto_ctrls</parameter> 603and 604<parameter>auto_values</parameter> 605with the auto-reset controls for this particular client. Note that all of the 606bits are valid in the returned values, not just the ones selected in the 607<parameter>changes</parameter> 608mask. 609</para> 610 611 612</sect2> 613</sect1> 614<sect1 id='Control_for_Bell_Behavior'> 615<title>Control for Bell Behavior</title> 616 617<para> 618The X server’s generation of sounds is controlled by the 619<emphasis>AudibleBell</emphasis> 620control. Configuration of different bell sounds is discussed in <xref linkend="Bells" />. 621</para> 622 623 624<sect2 id='The_AudibleBell_Control'> 625<title>The AudibleBell Control</title> 626 627<para> 628The 629<emphasis>AudibleBell</emphasis> 630control is a boolean control that has no attributes. As such, you may enable 631and disable it using either the 632<emphasis>EnabledControls</emphasis> 633control or the 634<emphasis>AutoReset</emphasis> 635control discussed in <link linkend="The_EnabledControls_Control">section 10.1.1</link>. When enabled, protocol requests to 636generate a sound result in the X server actually producing a real sound; when 637disabled, requests to the server to generate a sound are ignored unless the 638sound is forced. See <link linkend="Audible_Bells">section 9.2</link>. 639</para> 640 641 642</sect2> 643</sect1> 644<sect1 id='Controls_for_Repeat_Key_Behavior'> 645<title>Controls for Repeat Key Behavior</title> 646 647<indexterm significance="preferred" zone="Controls_for_Repeat_Key_Behavior"> 648<primary>auto-repeat</primary><secondary>controls</secondary></indexterm> 649 650<para> 651The repeating behavior of keyboard keys is governed by three controls, the 652<emphasis>PerKeyRepeat</emphasis> 653control, which is always active, and the 654<emphasis>RepeatKeys</emphasis> 655and 656<emphasis>DetectableAutorepeat</emphasis> 657controls, which are boolean controls that may be enabled and disabled. 658<emphasis>PerKeyRepeat</emphasis> 659determines which keys are allowed to repeat. 660<emphasis>RepeatKeys</emphasis> 661governs the behavior of an individual key when it is repeating. 662<emphasis>DetectableAutorepeat</emphasis> 663allows a client to detect when a key is repeating as a result of being held 664down. 665</para> 666 667 668<sect2 id='The_PerKeyRepeat_Control'> 669<title>The PerKeyRepeat Control</title> 670 671<para> 672The 673<emphasis>PerKeyRepeat</emphasis> 674control is a bitmask long enough to contain a bit for each key on the device; 675it determines which individual keys are allowed to repeat. The Xkb 676<emphasis>PerKeyRepeat</emphasis> 677control provides no functionality different from that available via the core X 678protocol. There are no convenience functions in Xkb for manipulating this 679control. The 680<emphasis>PerKeyRepeat</emphasis> 681control settings are carried in the 682<structfield>per_key_repeat</structfield> 683field of an 684<structname>XkbControlsRec</structname> 685structure, discussed in <link linkend="The_XkbControlsRec_Structure">section 10.8</link>. 686</para> 687 688 689</sect2> 690<sect2 id='The_RepeatKeys_Control'> 691<title>The RepeatKeys Control</title> 692 693<para> 694The core protocol allows only control over whether or not the entire keyboard 695or individual keys should auto-repeat when held down. 696<emphasis>RepeatKeys</emphasis> 697is a boolean control that extends this capability by adding control over the 698delay until a key begins to repeat and the rate at which it repeats. 699<emphasis>RepeatKeys</emphasis> 700is coupled with the core auto-repeat control: when 701<emphasis>RepeatKeys</emphasis> 702is enabled or disabled, the core auto-repeat is enabled or disabled and vice 703versa. 704</para> 705 706 707<para> 708Auto-repeating keys are controlled by two attributes. The first, 709<firstterm>timeout</firstterm>, 710is the delay after the initial press of an auto-repeating key and the first 711generated repeat event. The second, 712<firstterm>interval</firstterm>, 713is the delay between all subsequent generated repeat events. As with all 714boolean controls, configuring the attributes that determine how the control 715operates does not automatically enable the control as a whole; see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>. 716</para> 717 718 719<para> 720To get the current attributes of the 721<emphasis>RepeatKeys</emphasis> 722control for a keyboard device, use 723<function>XkbGetAutoRepeatRate</function>. 724</para> 725 726<indexterm significance="preferred" zone="XkbGetAutoRepeatRate"><primary><function>XkbGetAutoRepeatRate</function></primary></indexterm> 727<funcsynopsis id="XkbGetAutoRepeatRate"> 728 <funcprototype> 729 <funcdef>Bool <function>XkbGetAutoRepeatRate</function></funcdef> 730<!-- ( 731<parameter>display, device_spec, timeout_rtrn, interval_rtrn</parameter> 732) --> 733 734 <paramdef>Display *<parameter>display</parameter></paramdef> 735 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 736 <paramdef>unsigned int *<parameter>timeout_rtrn</parameter></paramdef> 737 <paramdef>unsigned int *<parameter>interval_rtrn</parameter></paramdef> 738 </funcprototype> 739</funcsynopsis> 740<variablelist> 741 <varlistentry> 742 <term> 743 <parameter>display</parameter> 744 </term> 745 <listitem> 746 <para> 747 connection to X server 748 </para> 749 </listitem> 750 </varlistentry> 751 <varlistentry> 752 <term> 753 <parameter>device_spec</parameter> 754 </term> 755 <listitem> 756 <para> 757 desired device ID, or <symbol>XkbUseCoreKbd</symbol> 758 </para> 759 </listitem> 760 </varlistentry> 761 <varlistentry> 762 <term> 763 <parameter>timeout_rtrn</parameter> 764 </term> 765 <listitem> 766 <para> 767 backfilled with initial repeat delay, ms 768 </para> 769 </listitem> 770 </varlistentry> 771 <varlistentry> 772 <term> 773 <parameter>interval_rtrn</parameter> 774 </term> 775 <listitem> 776 <para> 777 backfilled with subsequent repeat delay, ms 778 </para> 779 </listitem> 780 </varlistentry> 781</variablelist> 782 783<para> 784<function>XkbGetAutoRepeatRate</function> 785queries the server for the current values of the 786<emphasis>RepeatControls</emphasis> 787control attributes, backfills 788<parameter>timeout_rtrn</parameter> 789and 790<parameter>interval_rtrn</parameter> 791with them, and returns 792<symbol>True</symbol>. 793If a compatible version of the Xkb extension is not available in the server 794<function>XkbGetAutoRepeatRate</function> 795returns 796<symbol>False</symbol>. 797</para> 798 799 800<para> 801To set the attributes of the RepeatKeys control for a keyboard device, use 802<function>XkbSetAutoRepeatRate</function>. 803</para> 804 805 806<indexterm significance="preferred" zone="XkbSetAutoRepeatRate"><primary><function>XkbSetAutoRepeatRate</function></primary></indexterm> 807<funcsynopsis id="XkbSetAutoRepeatRate"> 808 <funcprototype> 809 <funcdef>Bool <function>XkbSetAutoRepeatRate</function></funcdef> 810<!-- ( 811<parameter>display, device_spec, timeout, interval</parameter> 812) --> 813 814 <paramdef>Display *<parameter>display</parameter></paramdef> 815 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 816 <paramdef>unsigned int <parameter>timeout</parameter></paramdef> 817 <paramdef>unsigned int <parameter>interval</parameter></paramdef> 818 </funcprototype> 819</funcsynopsis> 820<variablelist> 821 <varlistentry> 822 <term> 823 <parameter>display</parameter> 824 </term> 825 <listitem> 826 <para> 827 connection to X server 828 </para> 829 </listitem> 830 </varlistentry> 831 <varlistentry> 832 <term> 833 <parameter>device_spec</parameter> 834 </term> 835 <listitem> 836 <para> 837 device to configure, or <symbol>XkbUseCoreKbd</symbol> 838 </para> 839 </listitem> 840 </varlistentry> 841 <varlistentry> 842 <term> 843 <parameter>timeout</parameter> 844 </term> 845 <listitem> 846 <para> 847 initial delay, ms 848 </para> 849 </listitem> 850 </varlistentry> 851 <varlistentry> 852 <term> 853 <parameter>interval</parameter> 854 </term> 855 <listitem> 856 <para> 857 delay between repeats, ms 858 </para> 859 </listitem> 860 </varlistentry> 861</variablelist> 862 863<para> 864<function>XkbSetAutoRepeatRate</function> 865sends a request to the X server to configure the 866<emphasis>AutoRepeat</emphasis> 867control attributes to the values specified in 868<parameter>timeout</parameter> 869and 870<parameter>interval</parameter>. 871</para> 872 873 874<para> 875<function>XkbSetAutoRepeatRate</function> 876does not wait for a reply; it normally returns 877<symbol>True</symbol>. 878Specifying a zero value for either 879<parameter>timeout</parameter> 880or 881<parameter>interval</parameter> 882causes the server to generate a 883<errorname>BadValue</errorname> 884protocol error. If a compatible version of the Xkb extension is not available 885in the server, 886<function>XkbSetAutoRepeatRate</function> 887returns 888<symbol>False</symbol>. 889</para> 890 891 892</sect2> 893<sect2 id='The_DetectableAutorepeat_Control'> 894<title>The DetectableAutorepeat Control</title> 895 896<para> 897Auto-repeat is the generation of multiple key events by a keyboard when the 898user presses a key and holds it down. Keyboard hardware and device-dependent X 899server software often implement auto-repeat by generating multiple 900<symbol>KeyPress</symbol> 901events with no intervening 902<symbol>KeyRelease</symbol> 903event. The standard behavior of the X server is to generate a 904<symbol>KeyRelease</symbol> 905event for every 906<symbol>KeyPress</symbol> 907event. If the keyboard hardware and device-dependent software of the X server 908implement auto-repeat by generating multiple 909<symbol>KeyPress</symbol> 910events, the device-independent part of the X server by default synthetically 911generates a 912<symbol>KeyRelease</symbol> 913event after each 914<symbol>KeyPress</symbol> 915event. This provides predictable behavior for X clients, but does not allow 916those clients to detect the fact that a key is auto-repeating. 917</para> 918 919 920<para> 921Xkb allows clients to request 922<firstterm>detectable auto-repeat</firstterm>. 923<indexterm significance="preferred" zone="The_DetectableAutorepeat_Control"> 924<primary>detectable auto-repeat</primary></indexterm> 925<indexterm significance="preferred" zone="The_DetectableAutorepeat_Control"> 926<primary>auto-repeat</primary><secondary>detectable</secondary></indexterm> 927If a client requests and the server supports 928<emphasis>DetectableAutorepeat</emphasis>, 929Xkb generates 930<symbol>KeyRelease</symbol> 931events only when the key is physically released. If 932<emphasis>DetectableAutorepeat</emphasis> 933is not supported or has not been requested, the server synthesizes a 934<symbol>KeyRelease</symbol> 935event for each repeating 936<symbol>KeyPress</symbol> 937event it generates. 938</para> 939 940 941<para> 942<emphasis>DetectableAutorepeat</emphasis>, 943unlike the other controls in this chapter, is not contained in the 944<structname>XkbControlsRec</structname> 945structure, nor can it be enabled or disabled via the 946<emphasis>EnabledControls</emphasis> 947control. Instead, query and set 948<emphasis>DetectableAutorepeat</emphasis> 949using 950<function>XkbGetDetectableAutorepeat</function> 951and 952<function>XkbSetDetectableAutorepeat</function>. 953</para> 954 955 956<para> 957<emphasis>DetectableAutorepeat</emphasis> 958is a condition that applies to all keyboard devices for a client’s 959connection to a given X server; it cannot be selectively set for some devices 960and not for others. For this reason, none of the Xkb library functions 961involving 962<emphasis>DetectableAutorepeat</emphasis> 963involve a device specifier. 964</para> 965 966 967<para> 968To determine whether or not the server supports 969<emphasis>DetectableAutorepeat</emphasis>, 970use 971<function>XkbGetDetectableAutorepeat</function>. 972</para> 973 974<indexterm significance="preferred" zone="XkbGetDetectableAutorepeat"><primary><function>XkbGetDetectableAutorepeat</function></primary></indexterm> 975<funcsynopsis id="XkbGetDetectableAutorepeat"> 976 <funcprototype> 977 <funcdef>Bool <function>XkbGetDetectableAutorepeat</function></funcdef> 978<!-- ( 979<parameter>display, supported_rtrn</parameter> 980) --> 981 982 <paramdef>Display *<parameter>display</parameter></paramdef> 983 <paramdef>Bool *<parameter>supported_rtrn</parameter></paramdef> 984 </funcprototype> 985</funcsynopsis> 986<variablelist> 987 <varlistentry> 988 <term> 989 <parameter>display</parameter> 990 </term> 991 <listitem> 992 <para> 993 connection to X server 994 </para> 995 </listitem> 996 </varlistentry> 997 <varlistentry> 998 <term> 999 <parameter>supported_rtrn</parameter> 1000 </term> 1001 <listitem> 1002 <para> 1003 backfilled <symbol>True</symbol> if 1004<emphasis>DetectableAutorepeat</emphasis> 1005 supported 1006 </para> 1007 </listitem> 1008 </varlistentry> 1009</variablelist> 1010 1011<para> 1012<function>XkbGetDetectableAutorepeat</function> 1013queries the server for the current state of 1014<emphasis>DetectableAutorepeat</emphasis> 1015and waits for a reply. If 1016<parameter>supported_rtrn</parameter> 1017is not 1018<symbol>NULL</symbol>, 1019it backfills supported_rtrn with 1020<symbol>True</symbol> 1021if the server supports 1022<emphasis>DetectableAutorepeat</emphasis>, 1023and 1024<symbol>False</symbol> 1025otherwise. 1026<function>XkbGetDetectableAutorepeat</function> 1027returns the current state of 1028<emphasis>DetectableAutorepeat</emphasis> 1029for the requesting client: 1030<symbol>True</symbol> 1031if 1032<emphasis>DetectableAutorepeat</emphasis> 1033is set, and 1034<symbol>False</symbol> 1035otherwise. 1036</para> 1037 1038 1039<para> 1040To set 1041<emphasis>DetectableAutorepeat</emphasis>, 1042use 1043<function>XkbSetDetectableAutorepeat</function>. 1044This request affects all keyboard activity for the requesting client only; 1045other clients still see the expected nondetectable auto-repeat behavior, unless 1046they have requested otherwise. 1047</para> 1048 1049 1050<indexterm significance="preferred" zone="XkbSetDetectableAutorepeat"><primary><function>XkbSetDetectableAutorepeat</function></primary></indexterm> 1051<funcsynopsis id="XkbSetDetectableAutorepeat"> 1052 <funcprototype> 1053 <funcdef>Bool <function>XkbSetDetectableAutorepeat</function></funcdef> 1054<!-- ( 1055<parameter>display, detectable, supported_rtrn</parameter> 1056) --> 1057 1058 <paramdef>Display *<parameter>display</parameter></paramdef> 1059 <paramdef>Bool <parameter>detectable</parameter></paramdef> 1060 <paramdef>Bool *<parameter>supported_rtrn</parameter></paramdef> 1061 </funcprototype> 1062</funcsynopsis> 1063<variablelist> 1064 <varlistentry> 1065 <term> 1066 <parameter>display</parameter> 1067 </term> 1068 <listitem> 1069 <para> 1070 connection to X server 1071 </para> 1072 </listitem> 1073 </varlistentry> 1074 <varlistentry> 1075 <term> 1076 <parameter>detectable</parameter> 1077 </term> 1078 <listitem> 1079 <para> 1080 <symbol>True</symbol> ⇒ set 1081<emphasis>DetectableAutorepeat</emphasis> 1082 </para> 1083 </listitem> 1084 </varlistentry> 1085 <varlistentry> 1086 <term> 1087 <parameter>supported_rtrn</parameter> 1088 </term> 1089 <listitem> 1090 <para> 1091 backfilled <symbol>True</symbol> if 1092<emphasis>DetectableAutorepeat</emphasis> 1093 supported 1094 </para> 1095 </listitem> 1096 </varlistentry> 1097</variablelist> 1098 1099<para> 1100<function>XkbSetDetectableAutorepeat</function> 1101sends a request to the server to set 1102<emphasis>DetectableAutorepeat</emphasis> 1103on for the current client if 1104<parameter>detectable</parameter> 1105is 1106<symbol>True</symbol>, 1107and off it 1108<parameter>detectable</parameter> 1109is 1110<symbol>False</symbol>; 1111it then waits for a reply. If 1112<parameter>supported_rtrn</parameter> 1113is not 1114<symbol>NULL</symbol>, 1115<function>XkbSetDetectableAutorepeat</function> 1116backfills 1117<parameter>supported_rtrn</parameter> 1118with 1119<symbol>True</symbol> 1120if the server supports 1121<emphasis>DetectableAutorepeat</emphasis>, 1122and 1123<symbol>False</symbol> 1124if it does not. 1125<function>XkbSetDetectableAutorepeat</function> 1126returns the current state of 1127<emphasis>DetectableAutorepeat</emphasis> 1128for the requesting client: 1129<symbol>True</symbol> 1130if 1131<emphasis>DetectableAutorepeat</emphasis> 1132is set, and 1133<symbol>False</symbol> 1134otherwise. 1135</para> 1136 1137 1138</sect2> 1139</sect1> 1140<sect1 id='Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls'> 1141<title>Controls for Keyboard Overlays (Overlay1 and Overlay2 Controls)</title> 1142 1143<para> 1144A keyboard overlay allows some subset of the keyboard to report alternate 1145keycodes when the overlay is enabled. For example, a keyboard overlay can be 1146used to simulate a numeric or editing keypad on a keyboard that does not 1147actually have one by reusing some portion of the keyboard as an overlay. This 1148technique is very common on portable computers and embedded systems with small 1149keyboards. 1150</para> 1151 1152 1153<para> 1154Xkb includes direct support for two keyboard overlays, using the 1155<emphasis>Overlay1</emphasis> 1156and 1157<emphasis>Overlay2</emphasis> 1158controls. When 1159<emphasis>Overlay1</emphasis> 1160is enabled, all of the keys that are members of the first keyboard overlay 1161generate an alternate keycode. When 1162<emphasis>Overlay2</emphasis> 1163is enabled, all of the keys that are members of the second keyboard overlay 1164generate an alternate keycode. The two overlays are mutually exclusive; any 1165particular key may be in at most one overlay. 1166<emphasis>Overlay1</emphasis> 1167and 1168<emphasis>Overlay2</emphasis> 1169are boolean controls. As such, you may enable and disable them using either 1170the 1171<emphasis>EnabledControls</emphasis> 1172control or the 1173<emphasis>AutoReset</emphasis> 1174control discussed in <link linkend="The_EnabledControls_Control">section 10.1.1</link>. 1175</para> 1176 1177 1178<para> 1179To specify the overlay to which a key belongs and the alternate keycode it 1180should generate when that overlay is enabled, assign it either the 1181<symbol>XkbKB_Overlay1</symbol> 1182or 1183<symbol>XkbKB_Overlay2</symbol> 1184key behaviors, as described in <link linkend="Key_Behavior">section 16.2</link>. 1185</para> 1186 1187 1188</sect1> 1189<sect1 id='Controls_for_Using_the_Mouse_from_the_Keyboard'> 1190<title>Controls for Using the Mouse from the Keyboard</title> 1191 1192<para> 1193Using Xkb, it is possible to configure the keyboard to allow simulation of the 1194X pointer device. This simulation includes both movement of the pointer itself 1195and press and release events associated with the buttons on the pointer. Two 1196controls affect this behavior: the 1197<emphasis>MouseKeys</emphasis> 1198control determines whether or not simulation of the pointer device is active, 1199as well as configuring the default button; the 1200<emphasis>MouseKeysAccel</emphasis> 1201control determines the movement characteristics of the pointer when simulated 1202via the keyboard. Both of them are boolean controls; as such, you may enable 1203and disable them using either the 1204<emphasis>EnabledControls</emphasis> 1205control or the 1206<emphasis>AutoReset</emphasis> 1207control discussed in <link linkend="The_EnabledControls_Control">section 10.1.1</link>. The individual keys that simulate 1208different aspects of the pointer device are determined by the keyboard mapping, 1209discussed in <xref linkend="Xkb_Server_Keyboard_Mapping" />. 1210</para> 1211 1212 1213<sect2 id='The_MouseKeys_Control'> 1214<title>The MouseKeys Control</title> 1215 1216<para> 1217The 1218<emphasis>MouseKeys</emphasis> 1219control allows a user to control all the mouse functions from the keyboard. 1220When 1221<emphasis>MouseKeys</emphasis> 1222are enabled, all keys with 1223<emphasis>MouseKeys</emphasis> 1224actions bound to them generate core pointer events instead of normal 1225<symbol>KeyPress</symbol> 1226and 1227<symbol>KeyRelease</symbol> 1228events. 1229</para> 1230 1231 1232<para> 1233The 1234<emphasis>MouseKeys</emphasis> 1235control has a single attribute, 1236<structfield>mk_dflt_btn</structfield> 1237that specifies the core button number to be used by mouse keys actions that do 1238not explicitly specify a button. There is no convenience function for getting 1239or setting the attribute; instead use 1240<function>XkbGetControls</function> 1241and 1242<function>XkbSetControls</function> 1243(see <link linkend="Querying_Controls">section 10.9</link> and <link linkend="Changing_Controls">section 10.10</link>). 1244</para> 1245 1246<note><para> 1247<emphasis>MouseKeys</emphasis> 1248can also be turned on and off by pressing the key combination necessary to 1249produce an 1250<keysym>XK_Pointer_EnableKeys</keysym> 1251keysym. The de facto default standard for this is 1252<keycombo><keycap>Shift</keycap><keycap>Alt</keycap><keycap>NumLock</keycap></keycombo>, 1253but this may vary depending on the keymap.</para></note> 1254 1255</sect2> 1256<sect2 id='The_MouseKeysAccel_Control'> 1257<title>The MouseKeysAccel Control</title> 1258 1259<para> 1260When the 1261<emphasis>MouseKeysAccel</emphasis> 1262control is enabled, the effect of a key-activated pointer motion action 1263changes as a key is held down. If the control is disabled, pressing a 1264mouse-pointer key yields one mouse event. When 1265<emphasis>MouseKeysAccel</emphasis> 1266is enabled, mouse movement is defined by an initial distance specified in the 1267<symbol>XkbSA_MovePtr</symbol> 1268action and the following fields in the 1269<structname>XkbControlsRec</structname> 1270structure (see <link linkend="The_XkbControlsRec_Structure">section 10.8</link>). 1271</para> 1272 1273<table id='table10.2' frame='topbot'> 1274<title>MouseKeysAccel Fields</title> 1275<?dbfo keep-together="always" ?> 1276<tgroup cols='2' align='left' colsep='0' rowsep='0'> 1277<colspec colname='c1' colwidth='1.0*'/> 1278<colspec colname='c2' colwidth='2.0*'/> 1279<thead> 1280<row rowsep='1'> 1281 <entry>Field</entry> 1282 <entry>Function</entry> 1283</row> 1284</thead> 1285<tbody> 1286<row> 1287 <entry>mk_delay</entry> 1288 <entry>Time (ms) between the initial key press and the first repeated 1289motion event</entry> 1290</row> 1291<row> 1292 <entry>mk_interval</entry> 1293 <entry>Time (ms) between repeated motion events</entry> 1294</row> 1295<row> 1296 <entry>mk_time_to_max</entry> 1297 <entry>Number of events (count) before the pointer reaches maximum 1298speed</entry> 1299</row> 1300<row> 1301 <entry>mk_max_speed</entry> 1302 <entry>The maximum speed (in pixels per event) the pointer reaches</entry> 1303</row> 1304<row> 1305 <entry>mk_curve</entry> 1306 <entry>The ramp used to reach maximum pointer speed</entry> 1307 </row> 1308</tbody> 1309</tgroup> 1310</table> 1311 1312<para> 1313There are no convenience functions to query or change the attributes of the 1314<emphasis>MouseKeysAccel</emphasis> 1315control; instead use 1316<function>XkbGetControls</function> 1317and 1318<function>XkbSetControls</function> 1319(see <link linkend="Querying_Controls">section 10.9</link> and <link linkend="Changing_Controls">section 10.10</link>). 1320</para> 1321 1322 1323<para> 1324The effects of the attributes of the 1325<emphasis>MouseKeysAccel</emphasis> 1326control depend on whether the 1327<symbol>XkbSA_MovePtr</symbol> 1328action (see <link linkend="Key_Actions">section 16.1</link>) specifies relative or absolute pointer motion. 1329</para> 1330 1331<sect3 id='Absolute_Pointer_Motion'> 1332<title>Absolute Pointer Motion</title> 1333 1334<para> 1335If an 1336<symbol>XkbSA_MovePtr</symbol> 1337action specifies an absolute position for one of the coordinates but still 1338allows acceleration, all repeated events contain any absolute coordinates 1339specified in the action. For example, if the 1340<symbol>XkbSA_MovePtr</symbol> 1341action specifies an absolute position for the X direction, but a relative 1342motion for the Y direction, the pointer accelerates in the Y direction, but 1343stays at the same X position. 1344</para> 1345 1346 1347</sect3> 1348<sect3 id='Relative_Pointer_Motion'> 1349<title>Relative Pointer Motion</title> 1350 1351<para> 1352If the 1353<symbol>XkbSA_MovePtr</symbol> 1354action specifies relative motion, the initial event always moves the cursor 1355the distance specified in the action. After 1356<structfield>mk_delay</structfield> 1357milliseconds, a second motion event is generated, and another occurs every 1358<structfield>mk_interval</structfield> 1359milliseconds until the user releases the key. 1360</para> 1361 1362 1363<para> 1364Between the time of the second motion event and 1365<structfield>mk_time_to_max</structfield> 1366intervals, the change in pointer distance per interval increases with each 1367interval. After 1368<structfield>mk_time_to_max</structfield> 1369intervals have elapsed, the change in pointer distance per interval remains 1370the same and is calculated by multiplying the original distance specified in 1371the action by 1372<structfield>mk_max_speed</structfield>. 1373</para> 1374 1375 1376<para> 1377For example, if the 1378<symbol>XkbSA_MovePtr</symbol> 1379action specifies a relative motion in the X direction of 5, 1380<structfield>mk_delay</structfield> 1381=160, 1382<structfield>mk_interval</structfield> 1383=40, 1384<structfield>mk_time_to_max</structfield> 1385=30, and 1386<structfield>mk_max_speed</structfield> 1387=30, the following happens when the user presses the key: 1388</para> 1389 1390<itemizedlist> 1391<listitem> 1392 <para> 1393The pointer immediately moves 5 pixels in the X direction when the key is 1394pressed. 1395 </para> 1396</listitem> 1397<listitem> 1398 <para> 1399After 160 milliseconds 1400(<structfield>mk_delay</structfield>), 1401and every 40 milliseconds thereafter 1402(<structfield>mk_interval</structfield>), 1403the pointer moves in the X direction. 1404 </para> 1405</listitem> 1406<listitem> 1407 <para> 1408The distance in the X direction increases with each interval until 30 intervals 1409( 1410<structfield>mk_time_to_max</structfield>) 1411have elapsed. 1412 </para> 1413</listitem> 1414<listitem> 1415 <para> 1416After 30 intervals, the pointer stops accelerating, and moves 150 pixels 1417( 1418<structfield>mk_max_speed</structfield> 1419* the original distance) every interval thereafter, until the key is released. 1420 </para> 1421</listitem> 1422</itemizedlist> 1423 1424<para> 1425The increase in pointer difference for each interval is a function of 1426<structfield>mk_curve</structfield>. 1427Events after the first but before maximum acceleration has been achieved are 1428accelerated according to the formula: 1429</para> 1430 1431<mediaobject> 1432<imageobject> <imagedata format="SVG" fileref="XKBlib-3.svg"/> 1433</imageobject> 1434</mediaobject> 1435 1436 1437<para> 1438Where 1439<emphasis>action_delta</emphasis> 1440is the relative motion specified by the 1441<symbol>XkbSA_MovePtr</symbol> 1442action, 1443<structfield>mk_max_speed</structfield> 1444and 1445<structfield>mk_time_to_max</structfield> 1446are parameters to the 1447<emphasis>MouseKeysAccel</emphasis> 1448control, and the curveFactor is computed using the 1449<emphasis>MouseKeysAccel</emphasis> 1450<structfield>mk_curve</structfield> 1451parameter as follows: 1452</para> 1453 1454<mediaobject> 1455<imageobject> <imagedata format="SVG" fileref="XKBlib-4.svg"/> 1456</imageobject> 1457</mediaobject> 1458 1459 1460<para> 1461With the result that a 1462<structfield>mk_curve</structfield> 1463of zero causes the distance moved to increase linearly from 1464<emphasis>action_delta</emphasis> 1465to <mediaobject> 1466<imageobject> <imagedata format="SVG" fileref="XKBlib-5.svg"/> 1467</imageobject> 1468</mediaobject>. 1469A negative 1470<structfield>mk_curve</structfield> 1471causes an initial sharp increase in acceleration that tapers off, and a 1472positive curve yields a slower initial increase in acceleration followed by a 1473sharp increase as the number of pointer events generated by the action 1474approaches 1475<structfield>mk_time_to_max</structfield>. 1476The legal values for 1477<structfield>mk_curve</structfield> 1478are between −1000 and 1000. 1479</para> 1480 1481 1482<para> 1483A distance vs. time graph of the pointer motion is shown in 1484<link linkend="figure10.1">Figure 10.1</link>. 1485</para> 1486 1487<figure id='figure10.1'> 1488 <title>MouseKeys Acceleration</title> 1489 <mediaobject> 1490 <imageobject> <imagedata format="SVG" fileref="XKBlib-6.svg"/> 1491 </imageobject> 1492 </mediaobject> 1493</figure> 1494 1495<!-- 1496<H5 CLASS="Figure"> 1497MouseKeys Acceleration</H5> 1498--> 1499</sect3> 1500</sect2> 1501</sect1> 1502<sect1 id='Controls_for_Better_Keyboard_Access_by_Physically_ImpairedPersons'> 1503<title>Controls for Better Keyboard Access by Physically Impaired 1504Persons</title> 1505 1506<para> 1507The Xkb extension includes several controls specifically aimed at making 1508keyboard use more effective for physically impaired people. All of these 1509controls are boolean controls and may be individually enabled and disabled, as 1510well as configured to tune their specific behavior. The behavior of these 1511controls is based on the AccessDOS package 1512<footnote><para> 1513AccessDOS provides access to the DOS operating system for people with physical 1514impairments and was developed by the Trace R&D Center at the University of 1515Wisconsin. For more information on AccessDOS, contact the Trace R&D Center, 1516Waisman Center and Department of Industrial Engineering, University of 1517Wisconsin-Madison WI 53705-2280. Phone: 608-262-6966. e-mail: info@trace.wisc.edu. 1518</para></footnote>. 1519</para> 1520 1521<sect2 id='The_AccessXKeys_Control'> 1522<title>The AccessXKeys Control</title> 1523 1524<para> 1525Enabling or disabling the keyboard controls through a graphical user interface 1526may be impossible for people who need to use the controls. For example, a user 1527who needs 1528<emphasis>SlowKeys</emphasis> 1529(see <link linkend="The_SlowKeys_Control">section 10.6.6</link>) may not even be able to start the graphical application, 1530let alone use it, if 1531<emphasis>SlowKeys</emphasis> 1532is not enabled. To allow easier access to some of the controls, the 1533<emphasis>AccessXKeys</emphasis> 1534control provides a set of special key sequences similar to those available in 1535AccessDOS. 1536</para> 1537 1538 1539<para> 1540When the 1541<emphasis>AccessXKeys</emphasis> 1542control is enabled, the user can turn controls on or off from the keyboard by 1543entering the following standard key sequences: 1544</para> 1545 1546<itemizedlist> 1547<listitem> 1548 <para> 1549Holding down a <keycap>Shift</keycap> key by itself for eight seconds 1550toggles the 1551<emphasis>SlowKeys</emphasis> 1552control. 1553 </para> 1554</listitem> 1555<listitem> 1556 <para> 1557Pressing and releasing the left or right 1558<keycap>Shift</keycap> 1559key five times in a row, without any intervening key events and with less than 156030 seconds delay between consecutive presses, toggles the state of the 1561<emphasis>StickyKeys</emphasis> 1562control. 1563 </para> 1564</listitem> 1565<listitem> 1566 <para> 1567Simultaneously operating two or more modifier keys deactivates the 1568<emphasis>StickyKeys</emphasis> 1569control. 1570 </para> 1571</listitem> 1572</itemizedlist> 1573 1574<para> 1575When the 1576<emphasis>AccessXKeys</emphasis> 1577control is disabled, Xkb does not look for the above special key sequences. 1578</para> 1579 1580 1581<para> 1582Some of these key sequences optionally generate audible feedback of the change 1583in state, as described in <link linkend="The_AccessXFeedback_Control">section 10.6.3</link>, or 1584<symbol>XkbControlsNotify</symbol> 1585events, described in <link linkend="Tracking_Changes_to_Keyboard_Controls">section 10.11</link>. 1586</para> 1587 1588</sect2> 1589<sect2 id='The_AccessXTimeout_Control'> 1590<title>The AccessXTimeout Control</title> 1591 1592<para> 1593In environments where computers are shared, features such as 1594<emphasis>SlowKeys</emphasis> 1595present a problem: if 1596<emphasis>SlowKeys</emphasis> 1597is on, the keyboard can appear to be unresponsive because keys are not 1598accepted until they are held for a certain period of time. To help solve this 1599problem, Xkb provides an 1600<emphasis>AccessXTimeout</emphasis> 1601control to automatically change the enabled/disabled state of any boolean 1602controls and to change the value of the 1603<emphasis>AccessXKeys</emphasis> 1604and 1605<emphasis>AccessXFeedback</emphasis> 1606control attributes if the keyboard is idle for a specified period of time. 1607</para> 1608 1609 1610<para> 1611When a timeout as specified by 1612<emphasis>AccessXTimeout</emphasis> 1613occurs and a control is consequently modified, Xkb generates an 1614<symbol>XkbControlsNotify</symbol> 1615event. For more information on 1616<symbol>XkbControlsNotify</symbol> 1617events, refer to <link linkend="Tracking_Changes_to_Keyboard_Controls">section 10.11</link>. 1618</para> 1619 1620 1621<para> 1622Use 1623<function>XkbGetAccessXTimeout</function> 1624to query the current 1625<emphasis>AccessXTimeout</emphasis> 1626options for a keyboard device. 1627</para> 1628 1629<indexterm significance="preferred" zone="XkbGetAccessXTimeout"><primary><function>XkbGetAccessXTimeout</function></primary></indexterm> 1630<funcsynopsis id="XkbGetAccessXTimeout"> 1631 <funcprototype> 1632 <funcdef>Bool <function>XkbGetAccessXTimeout</function></funcdef> 1633<!-- ( 1634<parameter>display</parameter>, 1635<parameter>device_spec</parameter>, 1636<parameter>timeout_rtrn</parameter>, 1637<parameter>ctrls_mask_rtrn</parameter>, 1638<parameter>ctrls_values_rtrn</parameter>, 1639<parameter>options_mask_rtrn, options_values_rtrn</parameter> 1640) --> 1641 1642 <paramdef>Display *<parameter>display</parameter></paramdef> 1643 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 1644 <paramdef>unsigned short *<parameter>timeout_rtrn</parameter></paramdef> 1645 <paramdef>unsigned int *<parameter>ctrls_mask_rtrn</parameter></paramdef> 1646 <paramdef>unsigned int *<parameter>ctrls_values_rtrn</parameter></paramdef> 1647 <paramdef>unsigned short *<parameter>opts_mask_rtrn</parameter></paramdef> 1648 <paramdef>unsigned short *<parameter>opts_values_rtrn</parameter></paramdef> 1649 </funcprototype> 1650</funcsynopsis> 1651<variablelist> 1652 <varlistentry> 1653 <term> 1654 <parameter>display</parameter> 1655 </term> 1656 <listitem> 1657 <para> 1658 connection to X server 1659 </para> 1660 </listitem> 1661 </varlistentry> 1662 <varlistentry> 1663 <term> 1664 <parameter>device_spec</parameter> 1665 </term> 1666 <listitem> 1667 <para> 1668 device to query, or <symbol>XkbUseCoreKbd</symbol> 1669 </para> 1670 </listitem> 1671 </varlistentry> 1672 <varlistentry> 1673 <term> 1674 <parameter>timeout_rtrn</parameter> 1675 </term> 1676 <listitem> 1677 <para> 1678 delay until AccessXTimeout, seconds 1679 </para> 1680 </listitem> 1681 </varlistentry> 1682 <varlistentry> 1683 <term> 1684 <parameter>ctrls_mask_rtrn</parameter> 1685 </term> 1686 <listitem> 1687 <para> 1688 backfilled with controls to modify 1689 </para> 1690 </listitem> 1691 </varlistentry> 1692 <varlistentry> 1693 <term> 1694 <parameter>ctrls_values_rtrn</parameter> 1695 </term> 1696 <listitem> 1697 <para> 1698 backfilled with on/off status for controls 1699 </para> 1700 </listitem> 1701 </varlistentry> 1702 <varlistentry> 1703 <term> 1704 <parameter>opts_mask_rtrn</parameter> 1705 </term> 1706 <listitem> 1707 <para> 1708 backfilled with <structfield>ax_options</structfield> to modify 1709 </para> 1710 </listitem> 1711 </varlistentry> 1712 <varlistentry> 1713 <term> 1714 <parameter>opts_values_rtrn</parameter> 1715 </term> 1716 <listitem> 1717 <para> 1718 backfilled with values for <structfield>ax_options</structfield> 1719 </para> 1720 </listitem> 1721 </varlistentry> 1722</variablelist> 1723 1724<para> 1725<function>XkbGetAccessXTimeout</function> 1726sends a request to the X server to obtain the current values for the 1727<emphasis>AccessXTimeout</emphasis> 1728attributes, waits for a reply, and backfills the values into the appropriate 1729arguments. 1730The parameters 1731<parameter>opts_mask_rtrn</parameter> 1732and 1733<parameter>opts_values_rtrn</parameter> 1734are backfilled with the options to modify and the values for 1735<structfield>ax_options</structfield>, 1736which is a field in the 1737<structname>XkbControlsRec</structname> 1738structure (see <link linkend="The_XkbControlsRec_Structure">section 10.8</link>). 1739<function>XkbGetAccessXTimeout</function> 1740returns 1741<symbol>True</symbol> 1742if successful; if a compatible version of the Xkb extension is not available 1743in the server, 1744<function>XkbGetAccessXTimeout</function> 1745returns 1746<symbol>False</symbol>. 1747</para> 1748 1749 1750<para> 1751To configure the 1752<emphasis>AccessXTimeout</emphasis> 1753options for a keyboard device, use 1754<function>XkbSetAccessXTimeout</function>. 1755</para> 1756 1757 1758<indexterm significance="preferred" zone="XkbSetAccessXTimeout"><primary><function>XkbSetAccessXTimeout</function></primary></indexterm> 1759<funcsynopsis id="XkbSetAccessXTimeout"> 1760 <funcprototype> 1761 <funcdef>Bool <function>XkbSetAccessXTimeout</function></funcdef> 1762<!-- ( 1763<parameter>display</parameter>, 1764<parameter>device_spec, timeout, ctrls_mask, ctrls_values, opts_mask, 1765opts_values</parameter> 1766) --> 1767 1768 <paramdef>Display *<parameter>display</parameter></paramdef> 1769 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 1770 <paramdef>unsigned short <parameter>timeout</parameter></paramdef> 1771 <paramdef>unsigned int <parameter>ctrls_mask</parameter></paramdef> 1772 <paramdef>unsigned int <parameter>ctrls_values</parameter></paramdef> 1773 <paramdef>unsigned short <parameter>opts_mask</parameter></paramdef> 1774 <paramdef>unsigned short <parameter>opts_values</parameter></paramdef> 1775 </funcprototype> 1776</funcsynopsis> 1777<variablelist> 1778 <varlistentry> 1779 <term> 1780 <parameter>display</parameter> 1781 </term> 1782 <listitem> 1783 <para> 1784 connection to X server 1785 </para> 1786 </listitem> 1787 </varlistentry> 1788 <varlistentry> 1789 <term> 1790 <parameter>device_spec</parameter> 1791 </term> 1792 <listitem> 1793 <para> 1794 device to configure, or <symbol>XkbUseCoreKbd</symbol> 1795 </para> 1796 </listitem> 1797 </varlistentry> 1798 <varlistentry> 1799 <term> 1800 <parameter>timeout</parameter> 1801 </term> 1802 <listitem> 1803 <para> 1804 seconds idle until AccessXTimeout occurs 1805 </para> 1806 </listitem> 1807 </varlistentry> 1808 <varlistentry> 1809 <term> 1810 <parameter>ctrls_mask</parameter> 1811 </term> 1812 <listitem> 1813 <para> 1814 boolean controls to modify 1815 </para> 1816 </listitem> 1817 </varlistentry> 1818 <varlistentry> 1819 <term> 1820 <parameter>ctrls_values</parameter> 1821 </term> 1822 <listitem> 1823 <para> 1824 new bits for controls selected by <parameter>ctrls_mask</parameter> 1825 </para> 1826 </listitem> 1827 </varlistentry> 1828 <varlistentry> 1829 <term> 1830 <parameter>opts_mask</parameter> 1831 </term> 1832 <listitem> 1833 <para> 1834 <structfield>ax_options</structfield> to change 1835 </para> 1836 </listitem> 1837 </varlistentry> 1838 <varlistentry> 1839 <term> 1840 <parameter>opts_values</parameter> 1841 </term> 1842 <listitem> 1843 <para> 1844 new bits for <structfield>ax_options</structfield> selected by <parameter>opts_mask</parameter> 1845 </para> 1846 </listitem> 1847 </varlistentry> 1848</variablelist> 1849 1850<para> 1851<parameter>timeout</parameter> 1852specifies the number of seconds the keyboard must be idle before the controls 1853are modified. 1854<parameter>ctrls_mask</parameter> 1855specifies what controls are to be enabled or disabled, and 1856<parameter>ctrls_values</parameter> 1857specifies whether those controls are to be enabled or disabled. The bit values 1858correspond to those for enabling and disabling boolean controls 1859(see <link linkend="The_EnabledControls_Control">section 10.1.1</link>). The 1860<parameter>opts_mask</parameter> 1861field specifies which attributes of the 1862<emphasis>AccessXKeys</emphasis> 1863and 1864<emphasis>AccessXFeedback</emphasis> 1865controls are to be changed, and 1866<parameter>opts_values</parameter> 1867specifies the new values for those options. The bit values correspond to those 1868for the 1869<structfield>ax_options</structfield> 1870field of an 1871<structname>XkbDescRec</structname> 1872(see <link linkend="The_XkbControlsRec_Structure">section 10.8</link>). 1873</para> 1874 1875 1876<para> 1877<function>XkbSetAccessXTimeout</function> 1878sends a request to configure the 1879<emphasis>AccessXTimeout</emphasis> 1880control to the server. 1881It does not wait for a reply, and normally returns 1882<symbol>True</symbol>. 1883If a compatible version of the Xkb extension is not available in the server, 1884<function>XkbSetAccessXTimeout</function> 1885returns 1886<symbol>False</symbol>. 1887</para> 1888 1889 1890</sect2> 1891<sect2 id='The_AccessXFeedback_Control'> 1892<title>The AccessXFeedback Control</title> 1893 1894<para> 1895Just as some keyboards can produce keyclicks to indicate when a key is pressed 1896or repeating, Xkb can provide feedback for the controls by using special beep 1897codes. Use the 1898<emphasis>AccessXFeedback</emphasis> 1899control to configure the specific types of operations that generate feedback. 1900</para> 1901 1902 1903<para> 1904There is no convenience function for modifying the 1905<emphasis>AccessXFeedback</emphasis> 1906control, although the feedback as a whole can be enabled or disabled just as 1907other boolean controls are (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>). Individual beep codes are turned 1908on or off by modifying the following bits in the 1909<structfield>ax_options</structfield> 1910field of an 1911<structname>XkbControlsRec</structname> 1912structure and using 1913<function>XkbSetControls</function> 1914(see <link linkend="Changing_Controls">section 10.10</link>): 1915</para> 1916 1917<table id='table10.3' frame='topbot'> 1918<title>AccessXFeedback Masks</title> 1919<?dbfo keep-together="always" ?> 1920<tgroup cols='3' align='left' colsep='0' rowsep='0'> 1921<colspec colname='c1' colwidth='1.0*'/> 1922<colspec colname='c2' colwidth='1.0*'/> 1923<colspec colname='c3' colwidth='1.0*'/> 1924<thead> 1925<row rowsep='1'> 1926 <entry>Action</entry> 1927 <entry>Beep Code</entry> 1928 <entry>ax_options bit</entry> 1929 </row> 1930</thead> 1931<tbody> 1932<row> 1933 <entry>LED turned on</entry> 1934 <entry>High-pitched beep</entry> 1935 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 1936</row> 1937<row> 1938 <entry>LED turned off</entry> 1939 <entry>Low-pitched beep</entry> 1940 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 1941</row> 1942<row> 1943 <entry>More than one LED changed state</entry> 1944 <entry>Two high-pitched beeps</entry> 1945 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 1946</row> 1947<row> 1948 <entry>Control turned on</entry> 1949 <entry>Rising tone</entry> 1950 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 1951</row> 1952<row> 1953 <entry>Control turned off</entry> 1954 <entry>Falling tone</entry> 1955 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 1956</row> 1957<row> 1958 <entry>More than one control changed state</entry> 1959 <entry>Two high-pitched beeps</entry> 1960 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 1961</row> 1962<row> 1963 <entry>SlowKeys and BounceKeys about to be turned on or off</entry> 1964 <entry>Three high-pitched beeps</entry> 1965 <entry><symbol>XkbAX_SlowWarnFBMask</symbol></entry> 1966</row> 1967<row> 1968 <entry>SlowKeys key pressed</entry> 1969 <entry>Medium-pitched beep</entry> 1970 <entry><symbol>XkbAX_SKPressFBMask</symbol></entry> 1971</row> 1972<row> 1973 <entry>SlowKeys key accepted</entry> 1974 <entry>Medium-pitched beep</entry> 1975 <entry><symbol>XkbAX_SKAcceptFBMask</symbol></entry> 1976</row> 1977<row> 1978 <entry>SlowKeys key rejected</entry> 1979 <entry>Low-pitched beep</entry> 1980 <entry><symbol>XkbAX_SKRejectFBMask</symbol></entry> 1981</row> 1982<row> 1983 <entry>Accepted SlowKeys key released</entry> 1984 <entry>Medium-pitched beep</entry> 1985 <entry><symbol>XkbAX_SKReleaseFBMask</symbol></entry> 1986</row> 1987<row> 1988 <entry>BounceKeys key rejected</entry> 1989 <entry>Low-pitched beep</entry> 1990 <entry><symbol>XkbAX_BKRejectFBMask</symbol></entry> 1991</row> 1992<row> 1993 <entry>StickyKeys key latched</entry> 1994 <entry>Low-pitched beep followed by high-pitched beep</entry> 1995 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 1996</row> 1997<row> 1998 <entry>StickyKeys key locked</entry> 1999 <entry>High-pitched beep</entry> 2000 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 2001</row> 2002<row> 2003 <entry>StickyKeys key unlocked</entry> 2004 <entry>Low-pitched beep</entry> 2005 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 2006 </row> 2007</tbody> 2008</tgroup> 2009</table> 2010 2011<para> 2012Implementations that cannot generate continuous tones may generate multiple 2013beeps instead of falling and rising tones; for example, they can generate a 2014high-pitched beep followed by a low-pitched beep instead of a continuous 2015falling tone. Other implementations can only ring the bell with one fixed 2016pitch. In these cases, use the 2017<symbol>XkbAX_DumbBellFBMask</symbol> 2018bit of 2019<structfield>ax_options</structfield> 2020to indicate that the bell can only ring with a fixed pitch. 2021</para> 2022 2023 2024<para> 2025When any of the above feedbacks occur, Xkb may generate a 2026<symbol>XkbBellNotify</symbol> 2027event (see <link linkend="Detecting_Bells">section 9.4</link>). 2028</para> 2029 2030 2031</sect2> 2032<sect2 id='AccessXNotify_Events'> 2033<title>AccessXNotify Events</title> 2034 2035<indexterm significance="preferred" zone="AccessXNotify_Events"> 2036<primary>events</primary><secondary><symbol>XkbAccessXNotify</symbol></secondary></indexterm> 2037<indexterm significance="preferred" zone="AccessXNotify_Events"> 2038<primary><structname>XkbAccessXNotifyEvent</structname></primary></indexterm> 2039 2040<para> 2041The server can generate 2042<symbol>XkbAccessXNotify</symbol> 2043events for some of the global keyboard controls. The structure for the 2044<symbol>XkbAccessXNotify</symbol> 2045event type is as follows: 2046 2047<programlisting> 2048typedef struct { 2049 int type; /* Xkb extension base event code */ 2050 unsigned long serial; /* X server serial number for event */ 2051 Bool send_event; /* <symbol>True</symbol> ⇒ synthetically generated */ 2052 Display * display; /* server connection where event generated */ 2053 Time time; /* server time when event generated */ 2054 int xkb_type; /* <symbol>XkbAccessXNotify</symbol> */ 2055 int device; /* Xkb device ID, will not be <symbol>XkbUseCoreKbd</symbol> */ 2056 int detail; /* XkbAXN_* */ 2057 KeyCode keycode; /* key of event */ 2058 int slowKeysDelay; /* current SlowKeys delay */ 2059 int debounceDelay; /* current debounce delay */ 2060} <structname>XkbAccessXNotifyEvent</structname>; 2061</programlisting></para> 2062 2063<para> 2064The 2065<structfield>detail</structfield> 2066field describes what AccessX event just occurred and can be any of the values 2067in <link linkend="table10.4">Table 10.4</link>. 2068</para> 2069 2070<table id='table10.4' frame='topbot'> 2071<title>AccessXNotify Events</title> 2072<?dbfo keep-together="always" ?> 2073<tgroup cols='2' align='left' colsep='0' rowsep='0'> 2074<colspec colname='c1' colwidth='1.0*'/> 2075<colspec colname='c2' colwidth='2.0*'/> 2076<thead> 2077<row rowsep='1'> 2078 <entry>detail</entry> 2079 <entry>Reason</entry> 2080</row> 2081</thead> 2082<tbody> 2083<row> 2084 <entry><symbol>XkbAXN_SKPress</symbol></entry> 2085 <entry>A key was pressed when SlowKeys was enabled.</entry> 2086</row> 2087<row> 2088 <entry><symbol>XkbAXN_SKAccept</symbol></entry> 2089 <entry>A key was accepted (held longer than the SlowKeys delay).</entry> 2090</row> 2091<row> 2092 <entry><symbol>XkbAXN_SKRelease</symbol></entry> 2093 <entry>An accepted SlowKeys key was released.</entry> 2094</row> 2095<row> 2096 <entry><symbol>XkbAXN_SKReject</symbol></entry> 2097 <entry>A key was rejected (released before the SlowKeys delay 2098expired).</entry> 2099</row> 2100<row> 2101 <entry><symbol>XkbAXN_BKAccept</symbol></entry> 2102 <entry>A key was accepted by BounceKeys.</entry> 2103</row> 2104<row> 2105 <entry><symbol>XkbAXN_BKReject</symbol></entry> 2106 <entry>A key was rejected (pressed before the BounceKeys delay 2107expired).</entry> 2108</row> 2109<row> 2110 <entry><symbol>XkbAXN_AXKWarning</symbol></entry> 2111 <entry>AccessXKeys is about to turn on/off StickyKeys or BounceKeys.</entry> 2112 </row> 2113</tbody> 2114</tgroup> 2115</table> 2116 2117<para> 2118The 2119<structfield>keycode</structfield> 2120field reports the keycode of the key for which the event occurred. If the 2121action is related to 2122<emphasis>SlowKeys</emphasis>, 2123the 2124<structfield>slowKeysDelay</structfield> 2125field contains the current 2126<emphasis>SlowKeys</emphasis> 2127acceptance delay. If the action is related to 2128<emphasis>BounceKeys</emphasis>, 2129the 2130<structfield>debounceDelay</structfield> 2131field contains the current 2132<emphasis>BounceKeys</emphasis> 2133debounce delay. 2134</para> 2135 2136<sect3 id='Selecting_for_AccessX_Events'> 2137<title>Selecting for AccessX Events</title> 2138 2139<para> 2140To receive 2141<symbol>XkbAccessXNotify</symbol> 2142events under all possible conditions, use 2143<function>XkbSelectEvents</function> 2144(see <link linkend="Selecting_Xkb_Events">section 4.3</link>) and pass 2145<symbol>XkbAccessXNotifyMask</symbol> 2146in both 2147<parameter>bits_to_change</parameter> 2148and 2149<parameter>values_for_bits</parameter>. 2150</para> 2151 2152 2153<para> 2154To receive 2155<symbol>XkbStateNotify</symbol> 2156events only under certain conditions, use 2157<function>XkbSelectEventDetails</function> 2158using 2159<symbol>XkbAccessXNotify</symbol> 2160as the 2161<structfield>event_type</structfield> 2162and specifying the desired state changes in 2163<parameter>bits_to_change</parameter> 2164and 2165<parameter>values_for_bits</parameter> 2166using mask bits from <link linkend="table10.5">Table 10.5</link>. 2167</para> 2168 2169<table id='table10.5' frame='topbot'> 2170<title>AccessXNotify Event Details</title> 2171<?dbfo keep-together="always" ?> 2172<tgroup cols='3' align='left' colsep='0' rowsep='0'> 2173<colspec colname='c1' colwidth='1.5*'/> 2174<colspec colname='c2' colwidth='1.0*'/> 2175<colspec colname='c3' colwidth='2.0*'/> 2176<thead> 2177<row rowsep='1'> 2178 <entry>XkbAccessXNotify Event Details</entry> 2179 <entry>Value</entry> 2180 <entry>Circumstances</entry> 2181 </row> 2182</thead> 2183<tbody> 2184 <row> 2185 <entry><symbol>XkbAXN_SKPressMask</symbol></entry> 2186 <entry>(1<<0)</entry> 2187 <entry>Slow key press notification wanted</entry> 2188 </row> 2189 <row> 2190 <entry><symbol>XkbAXN_SKAcceptMask</symbol></entry> 2191 <entry>(1<<1)</entry> 2192 <entry>Slow key accept notification wanted</entry> 2193 </row> 2194 <row> 2195 <entry><symbol>XkbAXN_SKRejectMask</symbol></entry> 2196 <entry>(1<<2)</entry> 2197 <entry>Slow key reject notification wanted</entry> 2198 </row> 2199 <row> 2200 <entry><symbol>XkbAXN_SKReleaseMask</symbol></entry> 2201 <entry>(1<<3)</entry> 2202 <entry>Slow key release notification wanted</entry> 2203 </row> 2204 <row> 2205 <entry><symbol>XkbAXN_BKAcceptMask</symbol></entry> 2206 <entry>(1<<4)</entry> 2207 <entry>Bounce key accept notification wanted</entry> 2208 </row> 2209 <row> 2210 <entry><symbol>XkbAXN_BKRejectMask</symbol></entry> 2211 <entry>(1<<5)</entry> 2212 <entry>Bounce key reject notification wanted</entry> 2213 </row> 2214 <row> 2215 <entry><symbol>XkbAXN_AXKWarningMask</symbol></entry> 2216 <entry>(1<<6)</entry> 2217 <entry>AccessX warning notification wanted</entry> 2218 </row> 2219 <row> 2220 <entry>XkbAXN_AllEventsMask</entry> 2221 <entry>(0x7f)</entry> 2222 <entry>All AccessX features notifications wanted</entry> 2223 </row> 2224</tbody> 2225</tgroup> 2226</table> 2227 2228</sect3> 2229</sect2> 2230<sect2 id='StickyKeys_RepeatKeys_and_MouseKeys_Events'> 2231<title>StickyKeys, RepeatKeys, and MouseKeys Events</title> 2232 2233<para> 2234The 2235<emphasis>StickyKeys</emphasis>, 2236<emphasis>RepeatKeys</emphasis>, 2237and 2238<emphasis>MouseKeys</emphasis> 2239controls do not generate specific events. Instead, the latching, unlatching, 2240locking, or unlocking of modifiers using 2241<emphasis>StickyKeys</emphasis> 2242generates 2243<symbol>XkbStateNotify</symbol> 2244events as described in <link linkend="Tracking_Keyboard_State">section 5.4</link>. Repeating keys generate normal 2245<symbol>KeyPress</symbol> 2246and 2247<symbol>KeyRelease</symbol> 2248events, though the auto-repeat can be detected using 2249<emphasis>DetectableAutorepeat</emphasis> 2250(see <link linkend="The_DetectableAutorepeat_Control">section 10.3.3</link>). Finally, 2251<emphasis>MouseKeys</emphasis> 2252generates pointer events identical to those of the core pointer device. 2253</para> 2254 2255 2256</sect2> 2257<sect2 id='The_SlowKeys_Control'> 2258<title>The SlowKeys Control</title> 2259 2260<para> 2261Some users may accidentally bump keys while moving a hand or typing stick 2262toward the key they want. Usually, the keys that are accidentally bumped are 2263just hit for a very short period of time. The 2264<emphasis>SlowKeys</emphasis> 2265control helps filter these accidental bumps by telling the server to wait a 2266specified period, called the 2267<firstterm>SlowKeys acceptance delay</firstterm>, 2268before delivering key events. If the key is released before this period 2269elapses, no key events are generated. Users can then bump any number of keys on 2270their way to the one they want without accidentally getting those characters. 2271Once they have reached the key they want, they can then hold the desired key 2272long enough for the computer to accept it. 2273<emphasis>SlowKeys</emphasis> 2274is a boolean control with one configurable attribute. 2275</para> 2276 2277<para> 2278When the 2279<emphasis>SlowKeys</emphasis> 2280control is active, the server reports the initial key press, subsequent 2281acceptance or rejection, and release of any key to interested clients by 2282sending an appropriate 2283<emphasis>AccessXNotify</emphasis> 2284event (see <link linkend="AccessXNotify_Events">section 10.6.4</link>). 2285</para> 2286 2287<para> 2288To get the 2289<emphasis>SlowKeys</emphasis> 2290acceptance delay for a keyboard device, use 2291<function>XkbGetSlowKeysDelay</function>. 2292</para> 2293 2294<indexterm significance="preferred" zone="XkbGetSlowKeysDelay"><primary><function>XkbGetSlowKeysDelay</function></primary></indexterm> 2295<funcsynopsis id="XkbGetSlowKeysDelay"> 2296 <funcprototype> 2297 <funcdef>Bool <function>XkbGetSlowKeysDelay</function></funcdef> 2298<!-- ( 2299<parameter>display</parameter>, 2300<parameter>device_spec</parameter>, 2301<parameter>delay_rtrn</parameter> 2302) --> 2303 2304 <paramdef>Display *<parameter>display</parameter></paramdef> 2305 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2306 <paramdef>unsigned int *<parameter>delay_rtrn</parameter></paramdef> 2307 </funcprototype> 2308</funcsynopsis> 2309<variablelist> 2310 <varlistentry> 2311 <term> 2312 <parameter>display</parameter> 2313 </term> 2314 <listitem> 2315 <para> 2316 connection to X server 2317 </para> 2318 </listitem> 2319 </varlistentry> 2320 <varlistentry> 2321 <term> 2322 <parameter>device_spec</parameter> 2323 </term> 2324 <listitem> 2325 <para> 2326 device ID, or <symbol>XkbUseCoreKbd</symbol> 2327 </para> 2328 </listitem> 2329 </varlistentry> 2330 <varlistentry> 2331 <term> 2332 <parameter>delay_rtrn</parameter> 2333 </term> 2334 <listitem> 2335 <para> 2336 backfilled with <emphasis>SlowKeys</emphasis> delay, ms 2337 </para> 2338 </listitem> 2339 </varlistentry> 2340</variablelist> 2341 2342<para> 2343<function>XkbGetSlowKeysDelay</function> 2344requests the attributes of the 2345<emphasis>SlowKeys</emphasis> 2346control from the server, waits for a reply and backfills 2347<parameter>delay_rtrn</parameter> 2348with the 2349<emphasis>SlowKeys</emphasis> 2350delay attribute. 2351<function>XkbGetSlowKeysDelay</function> 2352returns 2353<symbol>True</symbol> 2354if successful; if a compatible version of the Xkb extension is not available 2355in the server, 2356<function>XkbGetSlowKeysDelay</function> 2357returns 2358<symbol>False</symbol>. 2359</para> 2360 2361 2362<para> 2363To set the 2364<emphasis>SlowKeys</emphasis> 2365acceptance delay for a keyboard device, use 2366<function>XkbSetSlowKeysDelay</function>. 2367</para> 2368 2369 2370<indexterm significance="preferred" zone="XkbSetSlowKeysDelay"><primary><function>XkbSetSlowKeysDelay</function></primary></indexterm> 2371<funcsynopsis id="XkbSetSlowKeysDelay"> 2372 <funcprototype> 2373 <funcdef>Bool <function>XkbSetSlowKeysDelay</function></funcdef> 2374<!-- ( 2375<parameter>display</parameter>, 2376<parameter>device_spec</parameter>, 2377<parameter>delay</parameter> 2378) --> 2379 2380 <paramdef>Display *<parameter>display</parameter></paramdef> 2381 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2382 <paramdef>unsigned int <parameter>delay</parameter></paramdef> 2383 </funcprototype> 2384</funcsynopsis> 2385<variablelist> 2386 <varlistentry> 2387 <term> 2388 <parameter>display</parameter> 2389 </term> 2390 <listitem> 2391 <para> 2392 connection to X server 2393 </para> 2394 </listitem> 2395 </varlistentry> 2396 <varlistentry> 2397 <term> 2398 <parameter>device_spec</parameter> 2399 </term> 2400 <listitem> 2401 <para> 2402 device to configure, or <symbol>XkbUseCoreKbd</symbol> 2403 </para> 2404 </listitem> 2405 </varlistentry> 2406 <varlistentry> 2407 <term> 2408 <parameter>delay</parameter> 2409 </term> 2410 <listitem> 2411 <para> 2412 <emphasis>SlowKeys</emphasis> delay, ms 2413 </para> 2414 </listitem> 2415 </varlistentry> 2416</variablelist> 2417 2418<para> 2419<function>XkbSetSlowKeysDelay</function> 2420sends a request to configure the 2421<emphasis>SlowKeys</emphasis> 2422control to the server. 2423It does not wait for a reply, and normally returns 2424<symbol>True</symbol>. 2425Specifying a value of 2426<literal>0</literal> 2427for the 2428<parameter>delay</parameter> 2429parameter causes 2430<function>XkbSetSlowKeysDelay</function> 2431to generate a 2432<errorname>BadValue</errorname> 2433protocol error. If a compatible version of the Xkb extension is not available 2434in the server 2435<function>XkbSetSlowKeysDelay</function> 2436returns 2437<symbol>False</symbol>. 2438</para> 2439 2440 2441</sect2> 2442<sect2 id='The_BounceKeys_Control'> 2443<title>The BounceKeys Control</title> 2444 2445<para> 2446Some users may accidentally <quote>bounce</quote> on a key when they release it. 2447They press it once, then accidentally press it again after they release it. The 2448<emphasis>BounceKeys</emphasis> 2449control temporarily disables a key after it has been pressed, effectively 2450<quote>debouncing</quote> the keyboard. The period of time the key is disabled 2451after it is released is known as the 2452<firstterm>BounceKeys delay</firstterm>. 2453<emphasis>BounceKeys</emphasis> 2454is a boolean control. 2455</para> 2456 2457 2458<para> 2459When the 2460<emphasis>BounceKeys</emphasis> 2461control is active, the server reports acceptance or rejection of any key to 2462interested clients by sending an appropriate 2463<emphasis>AccessXNotify</emphasis> 2464event (see <link linkend="AccessXNotify_Events">section 10.6.4</link>). 2465</para> 2466 2467 2468<para> 2469Use 2470<function>XkbGetBounceKeysDelay</function> 2471to query the current 2472<emphasis>BounceKeys</emphasis> 2473delay for a keyboard device. 2474</para> 2475 2476<indexterm significance="preferred" zone="XkbGetBounceKeysDelay"><primary><function>XkbGetBounceKeysDelay</function></primary></indexterm> 2477<funcsynopsis id="XkbGetBounceKeysDelay"> 2478 <funcprototype> 2479 <funcdef>Bool <function>XkbGetBounceKeysDelay</function></funcdef> 2480<!-- ( 2481<parameter>display</parameter>, 2482<parameter>device_spec</parameter>, 2483<parameter>delay_rtrn</parameter> 2484) --> 2485 2486 <paramdef>Display *<parameter>display</parameter></paramdef> 2487 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2488 <paramdef>unsigned int *<parameter>delay_rtrn</parameter></paramdef> 2489 </funcprototype> 2490</funcsynopsis> 2491<variablelist> 2492 <varlistentry> 2493 <term> 2494 <parameter>display</parameter> 2495 </term> 2496 <listitem> 2497 <para> 2498 connection to X server 2499 </para> 2500 </listitem> 2501 </varlistentry> 2502 <varlistentry> 2503 <term> 2504 <parameter>device_spec</parameter> 2505 </term> 2506 <listitem> 2507 <para> 2508 device ID, or <symbol>XkbUseCoreKbd</symbol> 2509 </para> 2510 </listitem> 2511 </varlistentry> 2512 <varlistentry> 2513 <term> 2514 <parameter>delay_rtrn</parameter> 2515 </term> 2516 <listitem> 2517 <para> 2518 backfilled with bounce keys delay, ms 2519 </para> 2520 </listitem> 2521 </varlistentry> 2522</variablelist> 2523 2524<para> 2525<function>XkbGetBounceKeysDelay</function> 2526requests the attributes of the 2527<emphasis>BounceKeys</emphasis> 2528control from the server, waits for a reply, and backfills 2529<parameter>delay_rtrn</parameter> 2530with the 2531<emphasis>BounceKeys</emphasis> 2532delay attribute. 2533<function>XkbGetBounceKeysDelay</function> 2534returns 2535<symbol>True</symbol> 2536if successful; if a compatible version of the Xkb extension is not available 2537in the server 2538<function>XkbGetSlowKeysDelay</function> 2539returns 2540<symbol>False</symbol>. 2541</para> 2542 2543 2544<para> 2545To set the 2546<emphasis>BounceKeys</emphasis> 2547delay for a keyboard device, use 2548<function>XkbSetBounceKeysDelay</function>. 2549</para> 2550 2551 2552<indexterm significance="preferred" zone="XkbSetBounceKeysDelay"><primary><function>XkbSetBounceKeysDelay</function></primary></indexterm> 2553<funcsynopsis id="XkbSetBounceKeysDelay"> 2554 <funcprototype> 2555 <funcdef>Bool <function>XkbSetBounceKeysDelay</function></funcdef> 2556<!-- ( 2557<parameter>display</parameter>, 2558<parameter>device_spec</parameter>, 2559<parameter>delay</parameter> 2560) --> 2561 2562 <paramdef>Display *<parameter>display</parameter></paramdef> 2563 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2564 <paramdef>unsigned int <parameter>delay</parameter></paramdef> 2565 </funcprototype> 2566</funcsynopsis> 2567<variablelist> 2568 <varlistentry> 2569 <term> 2570 <parameter>display</parameter> 2571 </term> 2572 <listitem> 2573 <para> 2574 connection to X server 2575 </para> 2576 </listitem> 2577 </varlistentry> 2578 <varlistentry> 2579 <term> 2580 <parameter>device_spec</parameter> 2581 </term> 2582 <listitem> 2583 <para> 2584 device to configure, or <symbol>XkbUseCoreKbd</symbol> 2585 </para> 2586 </listitem> 2587 </varlistentry> 2588 <varlistentry> 2589 <term> 2590 <parameter>delay</parameter> 2591 </term> 2592 <listitem> 2593 <para> 2594 bounce keys delay, ms 2595 </para> 2596 </listitem> 2597 </varlistentry> 2598</variablelist> 2599 2600<para> 2601<function>XkbSetBounceKeysDelay</function> 2602sends a request to configure the 2603<emphasis>BounceKeys</emphasis> 2604control to the server. 2605It does not wait for a reply and normally returns 2606<symbol>True</symbol>. 2607Specifying a value of 2608<emphasis>zero</emphasis> 2609for the 2610<parameter>delay</parameter> 2611parameter causes 2612<function>XkbSetBounceKeysDelay</function> 2613to generate a 2614<errorname>BadValue</errorname> 2615protocol error. If a compatible version of the Xkb extension is not available 2616in the server, 2617<function>XkbSetBounceKeysDelay</function> 2618returns 2619<symbol>False</symbol>. 2620</para> 2621 2622</sect2> 2623<sect2 id='The_StickyKeys_Control'> 2624<title>The StickyKeys Control</title> 2625 2626<para> 2627Some people find it difficult or even impossible to press two keys at once. For 2628example, a one-fingered typist or someone using a mouth stick cannot press the 2629<keycap>Shift</keycap> 2630and 2631<keycap>1</keycap> 2632keys at the same time. The 2633<emphasis>StickyKeys</emphasis> 2634control solves this problem by changing the behavior of the modifier keys. 2635With 2636<emphasis>StickyKeys</emphasis>, 2637the user can first press a modifier, release it, then press another key. For 2638example, to get an exclamation point on a PC-style keyboard, the user can press 2639the 2640<keycap>Shift</keycap> 2641key, release it, and then press the 2642<keycap>1</keycap> 2643key. 2644</para> 2645 2646 2647<para> 2648<emphasis>StickyKeys</emphasis> 2649also allows users to lock modifier keys without requiring special locking 2650keys. When 2651<emphasis>StickyKeys</emphasis> 2652is enabled, a modifier is latched when the user presses it just once. The user 2653can press a modifier twice in a row to lock it, and then unlock it by pressing 2654it one more time. 2655</para> 2656 2657 2658<para> 2659When a modifier is latched, it becomes unlatched when the user presses a 2660nonmodifier key or a pointer button. For instance, to enter the sequence 2661<keycombo> 2662<keycap>Shift</keycap> 2663<keycap>Control</keycap> 2664<keycap>Z</keycap> 2665</keycombo> 2666the user could press and release the 2667<keycap>Shift</keycap> 2668key to latch it, then press and release the 2669<keycap>Control</keycap> 2670key to latch it, and finally press and release the 2671<keycap>Z</keycap> key. Because the 2672<keycap>Control</keycap> 2673key is a modifier key, pressing it does not unlatch the 2674<keycap>Shift</keycap> 2675key. Thus, after the user presses the 2676<keycap>Control</keycap> 2677key, both the 2678<symbol>Shift</symbol> 2679and 2680<symbol>Control</symbol> 2681modifiers are latched. When the user presses the 2682<keycap>Z</keycap> 2683key, the effect is as though the user had pressed 2684<keycombo> 2685<keycap>Shift</keycap> 2686<keycap>Control</keycap> 2687<keycap>Z</keycap> 2688</keycombo>. 2689In addition, because the 2690<keycap>Z</keycap> 2691key is not a modifier key, the 2692<symbol>Shift</symbol> 2693and 2694<symbol>Control</symbol> 2695modifiers are unlatched. 2696</para> 2697 2698 2699<para> 2700Locking a modifier key means that the modifier affects any key or pointer 2701button the user presses until the user unlocks it or it is unlocked 2702programmatically. For example, to enter the sequence ("XKB") on a keyboard 2703where ‘(’ is a shifted ‘9’, ‘)’ is a shifted ‘0’, and ‘"’ 2704is a shifted single quote, the user could press and release the 2705<keycap>Shift</keycap> 2706key twice to lock the 2707<symbol>Shift</symbol> 2708modifier. Then, when the user presses the 2709<keycap>9</keycap>, 2710<keycap>'</keycap>, 2711<keycap>x</keycap>, 2712<keycap>k</keycap>, 2713<keycap>b</keycap>, 2714<keycap>'</keycap>, 2715and 2716<keycap>0</keycap> 2717keys in sequence, it generates ("XKB"). To unlock the 2718<symbol>Shift</symbol> 2719modifier, the user can press and release the 2720<keycap>Shift</keycap> 2721key. 2722</para> 2723 2724 2725<para> 2726<emphasis>StickyKeys</emphasis> 2727is a boolean control with two separate attributes that may be individually 2728configured: one to automatically disable it, and one to control the latching 2729behavior of modifier keys. 2730</para> 2731 2732<sect3 id='StickyKeys_Options'> 2733<title>StickyKeys Options</title> 2734 2735<para> 2736The 2737<emphasis>StickyKeys</emphasis> 2738control has two options that can be accessed via the 2739<structfield>ax_options</structfield> 2740of an 2741<structname>XkbControlsRec</structname> 2742structure (see <link linkend="The_XkbControlsRec_Structure">section 10.8</link>). The first option, 2743<emphasis>TwoKeys</emphasis>, 2744specifies whether 2745<emphasis>StickyKeys</emphasis> 2746should automatically turn off when two keys are pressed at the same time. This 2747feature is useful for shared computers so people who do not want them do not 2748need to turn 2749<emphasis>StickyKeys</emphasis> 2750off if a previous user left 2751<emphasis>StickyKeys</emphasis> 2752on. The second option, 2753<emphasis>LatchToLock</emphasis>, 2754specifies whether or not 2755<emphasis>StickyKeys</emphasis> 2756locks a modifier when pressed twice in a row. 2757</para> 2758 2759 2760<para> 2761Use 2762<function>XkbGetStickyKeysOptions</function> 2763to query the current 2764<emphasis>StickyKeys</emphasis> 2765attributes for a keyboard device. 2766</para> 2767 2768<indexterm significance="preferred" zone="XkbGetStickyKeysOptions"><primary><function>XkbGetStickyKeysOptions</function></primary></indexterm> 2769<funcsynopsis id="XkbGetStickyKeysOptions"> 2770 <funcprototype> 2771 <funcdef>Bool <function>XkbGetStickyKeysOptions</function></funcdef> 2772<!-- ( 2773<parameter>display</parameter>, 2774<parameter>device_spec</parameter>, 2775<parameter>options_rtrn</parameter> 2776) --> 2777 2778 <paramdef>Display *<parameter>display</parameter></paramdef> 2779 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2780 <paramdef>unsigned int *<parameter>options_rtrn</parameter></paramdef> 2781 </funcprototype> 2782</funcsynopsis> 2783<variablelist> 2784 <varlistentry> 2785 <term> 2786 <parameter>display</parameter> 2787 </term> 2788 <listitem> 2789 <para> 2790 connection to X server 2791 </para> 2792 </listitem> 2793 </varlistentry> 2794 <varlistentry> 2795 <term> 2796 <parameter>device_spec</parameter> 2797 </term> 2798 <listitem> 2799 <para> 2800 device ID, or <symbol>XkbUseCoreKbd</symbol> 2801 </para> 2802 </listitem> 2803 </varlistentry> 2804 <varlistentry> 2805 <term> 2806 <parameter>options_rtrn</parameter> 2807 </term> 2808 <listitem> 2809 <para> 2810 backfilled with StickyKeys option mask 2811 </para> 2812 </listitem> 2813 </varlistentry> 2814</variablelist> 2815 2816<para> 2817<function>XkbGetStickyKeysOptions</function> 2818requests the attributes of the 2819<emphasis>StickyKeys</emphasis> 2820control from the server, waits for a reply, and backfills 2821<parameter>options_rtrn</parameter> 2822with a mask indicating whether the individual 2823<emphasis>StickyKeys</emphasis> 2824options are on or off. Valid bits in 2825<parameter>options_rtrn</parameter> 2826are: 2827 2828 <simplelist type='vert' columns='1'> 2829 <member><symbol>XkbAX_TwoKeysMask</symbol></member> 2830 <member><symbol>XkbAX_LatchToLockMask</symbol></member> 2831 </simplelist> 2832</para> 2833 2834<para> 2835<function>XkbGetStickyKeysOptions</function> 2836returns 2837<symbol>True</symbol> 2838if successful; if a compatible version of the Xkb extension is not available 2839in the server 2840<function>XkbGetStickyKeysOptions</function> 2841returns 2842<symbol>False</symbol>. 2843</para> 2844 2845 2846<para> 2847To set the 2848<emphasis>StickyKeys</emphasis> 2849attributes for a keyboard device, use 2850<function>XkbSetStickyKeysOptions</function>. 2851</para> 2852 2853 2854<indexterm significance="preferred" zone="XkbSetStickyKeysOptions"><primary><function>XkbSetStickyKeysOptions</function></primary></indexterm> 2855<funcsynopsis id="XkbSetStickyKeysOptions"> 2856 <funcprototype> 2857 <funcdef>Bool <function>XkbSetStickyKeysOptions</function></funcdef> 2858<!-- ( 2859<parameter>display</parameter>, 2860<parameter>device_spec, mask, values</parameter> 2861) --> 2862 2863 <paramdef>Display *<parameter>display</parameter></paramdef> 2864 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2865 <paramdef>unsigned int <parameter>mask</parameter></paramdef> 2866 <paramdef>unsigned int <parameter>values</parameter></paramdef> 2867 </funcprototype> 2868</funcsynopsis> 2869<variablelist> 2870 <varlistentry> 2871 <term> 2872 <parameter>display</parameter> 2873 </term> 2874 <listitem> 2875 <para> 2876 connection to X server 2877 </para> 2878 </listitem> 2879 </varlistentry> 2880 <varlistentry> 2881 <term> 2882 <parameter>device_spec</parameter> 2883 </term> 2884 <listitem> 2885 <para> 2886 device to configure, or XkbUseCoreKbd 2887 </para> 2888 </listitem> 2889 </varlistentry> 2890 <varlistentry> 2891 <term> 2892 <parameter>mask</parameter> 2893 </term> 2894 <listitem> 2895 <para> 2896 selects StickyKeys attributes to modify 2897 </para> 2898 </listitem> 2899 </varlistentry> 2900 <varlistentry> 2901 <term> 2902 <parameter>values</parameter> 2903 </term> 2904 <listitem> 2905 <para> 2906 values for selected attributes 2907 </para> 2908 </listitem> 2909 </varlistentry> 2910</variablelist> 2911 2912<para> 2913<function>XkbSetStickyKeysOptions</function> 2914sends a request to configure the 2915<emphasis>StickyKeys</emphasis> 2916control to the server. 2917It does not wait for a reply and normally returns 2918<symbol>True</symbol>. 2919The valid bits to use for both the 2920<parameter>mask</parameter> 2921and 2922<parameter>values</parameter> 2923parameters are: 2924 2925 <simplelist type='vert' columns='1'> 2926 <member><symbol>XkbAX_TwoKeysMask</symbol></member> 2927 <member><symbol>XkbAX_LatchToLockMask</symbol></member> 2928 </simplelist> 2929</para> 2930 2931<para> 2932If a compatible version of the Xkb extension is not available in the server, 2933<function>XkbSetStickyKeysOptions</function> 2934returns 2935<symbol>False</symbol>. 2936</para> 2937 2938</sect3> 2939</sect2> 2940</sect1> 2941<sect1 id='Controls_for_General_Keyboard_Mapping'> 2942<title>Controls for General Keyboard Mapping</title> 2943 2944<para> 2945There are several controls that apply to the keyboard mapping in general. They 2946control handling of out-of-range group indices and how modifiers are processed 2947and consumed in the server. These are: 2948 2949 <simplelist type='vert' columns='1'> 2950 <member><emphasis>GroupsWrap</emphasis></member> 2951 <member><emphasis>IgnoreGroupLock</emphasis></member> 2952 <member><emphasis>IgnoreLockMods</emphasis></member> 2953 <member><emphasis>InternalMods</emphasis></member> 2954 </simplelist> 2955</para> 2956 2957<para> 2958<emphasis>IgnoreGroupLock</emphasis> 2959is a boolean control; the rest are always active. 2960</para> 2961 2962 2963<para> 2964Without the modifier processing options provided by Xkb, passive grabs set via 2965translations in a client (for example, 2966<emphasis>Alt<KeyPress>space</emphasis>) 2967do not trigger if any modifiers other than those specified by the translation 2968are set. This results in problems in the user interface when either 2969<emphasis>NumLock</emphasis> 2970or a secondary keyboard group is active. The 2971<emphasis>IgnoreLockMods</emphasis> 2972and 2973<emphasis>IgnoreGroupLock</emphasis> 2974controls make it possible to avoid this behavior without exhaustively 2975specifying a grab for every possible modifier combination. 2976</para> 2977 2978<sect2 id='The_GroupsWrap_Control'> 2979<title>The GroupsWrap Control</title> 2980 2981<para> 2982The 2983<emphasis>GroupsWrap</emphasis> 2984control determines how illegal groups are handled on a global basis. There are 2985a number of valid keyboard sequences that can cause the effective group number 2986to go out of range. When this happens, the group must be normalized back to a 2987valid number. The 2988<emphasis>GroupsWrap</emphasis> 2989control specifies how this is done. 2990</para> 2991 2992 2993<para> 2994When dealing with group numbers, all computations are done using the group 2995index, which is the group number minus one. There are three different 2996algorithms; the 2997<emphasis>GroupsWrap</emphasis> 2998control specifies which one is used: 2999</para> 3000 3001<itemizedlist> 3002<listitem> 3003 <para>XkbRedirectIntoRange</para> 3004 <para> 3005All invalid group numbers are converted to a valid group number by taking the 3006last four bits of the 3007<emphasis>GroupsWrap</emphasis> 3008control and using them as the group index. If the result is still out of 3009range, Group one is used. 3010 </para> 3011</listitem> 3012<listitem> 3013 <para> 3014XkbClampIntoRange 3015 </para> 3016 <para> 3017All invalid group numbers are converted to the nearest valid group number. 3018Group numbers larger than the highest supported group number are mapped to the 3019highest supported group; those less than one are mapped to group one. 3020 </para> 3021</listitem> 3022<listitem> 3023 <para>XkbWrapIntoRange</para> 3024 <para> 3025All invalid group numbers are converted to a valid group number using integer 3026modulus applied to the group index. 3027 </para> 3028</listitem> 3029</itemizedlist> 3030 3031<para> 3032There are no convenience functions for manipulating the 3033<emphasis>GroupsWrap</emphasis> 3034control. Manipulate the 3035<emphasis>GroupsWrap</emphasis> 3036control via the 3037<structfield>groups_wrap</structfield> 3038field in the 3039<structname>XkbControlsRec</structname> 3040structure, then use 3041<function>XkbSetControls</function> 3042and 3043<function>XkbGetControls</function> 3044(see <link linkend="Querying_Controls">section 10.9</link> and <link linkend="Changing_Controls">section 10.10</link>) to query and change this control. 3045</para> 3046 3047<note><para>See also <link linkend="Per_Key_Group_Information">section 15.3.2</link> or a discussion of the related field, 3048<structfield>group_info</structfield>, 3049which also normalizes a group under certain circumstances.</para></note> 3050 3051</sect2> 3052<sect2 id='The_IgnoreLockMods_Control'> 3053<title>The IgnoreLockMods Control</title> 3054 3055<para> 3056The core protocol does not provide a way to exclude specific modifiers from 3057grab calculations, with the result that locking modifiers sometimes have 3058unanticipated side effects. 3059</para> 3060 3061 3062<para> 3063The 3064<emphasis>IgnoreLockMods</emphasis> 3065control specifies modifiers that should be excluded from grab calculations. 3066These modifiers are also not reported in any core events except 3067<symbol>KeyPress</symbol> 3068and 3069<symbol>KeyRelease</symbol> 3070events that do not activate a passive grab and that do not occur while a grab 3071is active. 3072</para> 3073 3074 3075<para> 3076Manipulate the 3077<emphasis>IgnoreLockMods</emphasis> 3078control via the 3079<structfield>ignore_lock</structfield> 3080field in the 3081<structname>XkbControlsRec</structname> 3082structure, then use 3083<function>XkbSetControls</function> 3084and 3085<function>XkbGetControls</function> 3086(see <link linkend="Querying_Controls">section 10.9</link> and <link linkend="Changing_Controls">section 10.10</link>) to query and change this control. Alternatively, 3087use 3088<function>XkbSetIgnoreLockMods</function>. 3089</para> 3090 3091 3092<para> 3093To set the modifiers that, if locked, are not to be reported in matching events 3094to passive grabs, use 3095<function>XkbSetIgnoreLockMods</function>. 3096</para> 3097 3098<indexterm significance="preferred" zone="XkbSetIgnoreLockMods"><primary><function>XkbSetIgnoreLockMods</function></primary></indexterm> 3099<funcsynopsis id="XkbSetIgnoreLockMods"> 3100 <funcprototype> 3101 <funcdef>Bool <function>XkbSetIgnoreLockMods</function></funcdef> 3102<!-- ( 3103<parameter>display, device_spec, affect_real, real_values, affect_virtual, 3104virtual_values</parameter> 3105) --> 3106 3107 <paramdef>Display *<parameter>display</parameter></paramdef> 3108 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 3109 <paramdef>unsigned int <parameter>affect_real</parameter></paramdef> 3110 <paramdef>unsigned int <parameter>real_values</parameter></paramdef> 3111 <paramdef>unsigned int <parameter>affect_virtual</parameter></paramdef> 3112 <paramdef>unsigned int <parameter>virtual_values</parameter></paramdef> 3113 </funcprototype> 3114</funcsynopsis> 3115<variablelist> 3116 <varlistentry> 3117 <term> 3118 <parameter>display</parameter> 3119 </term> 3120 <listitem> 3121 <para> 3122 connection to the X server 3123 </para> 3124 </listitem> 3125 </varlistentry> 3126 <varlistentry> 3127 <term> 3128 <parameter>device_spec</parameter> 3129 </term> 3130 <listitem> 3131 <para> 3132 device ID, or <symbol>XkbUseCoreKbd</symbol> 3133 </para> 3134 </listitem> 3135 </varlistentry> 3136 <varlistentry> 3137 <term> 3138 <parameter>affect_real</parameter> 3139 </term> 3140 <listitem> 3141 <para> 3142 mask of real modifiers affected by this call 3143 </para> 3144 </listitem> 3145 </varlistentry> 3146 <varlistentry> 3147 <term> 3148 <parameter>real_values</parameter> 3149 </term> 3150 <listitem> 3151 <para> 3152 values for affected real modifiers (1⇒set, 0⇒unset) 3153 </para> 3154 </listitem> 3155 </varlistentry> 3156 <varlistentry> 3157 <term> 3158 <parameter>affect_virtual</parameter> 3159 </term> 3160 <listitem> 3161 <para> 3162 mask of virtual modifiers affected by this call 3163 </para> 3164 </listitem> 3165 </varlistentry> 3166 <varlistentry> 3167 <term> 3168 <parameter>virtual_values</parameter> 3169 </term> 3170 <listitem> 3171 <para> 3172 values for affected virtual modifiers (1⇒set, 0⇒unset) 3173 </para> 3174 </listitem> 3175 </varlistentry> 3176</variablelist> 3177 3178<para> 3179<function>XkbSetIgnoreLockMods</function> 3180sends a request to the server to change the server’s 3181<emphasis>IgnoreLockMods</emphasis> 3182control. 3183<parameter>affect_real</parameter> 3184and 3185<parameter>real_values</parameter> 3186are masks of real modifier bits indicating which real modifiers are to be 3187added and removed from the server’s 3188<emphasis>IgnoreLockMods</emphasis> 3189control. Modifiers selected by both 3190<parameter>affect_real</parameter> 3191and 3192<parameter>real_values</parameter> 3193are added to the server’s 3194<emphasis>IgnoreLockMods</emphasis> 3195control; those selected by 3196<parameter>affect_real</parameter> 3197but not by 3198<parameter>real_values</parameter> 3199are removed from the server’s 3200<emphasis>IgnoreLockMods</emphasis> 3201control. Valid values for 3202<parameter>affect_real</parameter> 3203and 3204<parameter>real_values</parameter> 3205consist of any combination of the eight core modifier bits: 3206<symbol>ShiftMask</symbol>, 3207<symbol>LockMask</symbol>, 3208<symbol>ControlMask</symbol>, 3209<symbol>Mod1Mask</symbol> 3210– 3211<symbol>Mod5Mask</symbol>. 3212<parameter>affect_virtual</parameter> 3213and 3214<parameter>virtual_values</parameter> 3215are masks of virtual modifier bits indicating which virtual modifiers are to 3216be added and removed from the server’s 3217<emphasis>IgnoreLockMods</emphasis> 3218control. Modifiers selected by both 3219<parameter>affect_virtual</parameter> 3220and 3221<parameter>virtual_values</parameter> 3222are added to the server’s 3223<emphasis>IgnoreLockMods</emphasis> 3224control; those selected by 3225<parameter>affect_virtual</parameter> 3226but not by 3227<parameter>virtual_values</parameter> 3228are removed from the server’s 3229<emphasis>IgnoreLockMods</emphasis> 3230control. 3231See <link linkend="Virtual_Modifier_Names_and_Masks">section 7.1</link> for a discussion of virtual modifier masks to use in 3232<parameter>affect_virtual</parameter> 3233and 3234<parameter>virtual_values</parameter>. 3235<function>XkbSetIgnoreLockMods</function> 3236does not wait for a reply from the server. It returns 3237<symbol>True</symbol> 3238if the request was sent, and 3239<symbol>False</symbol> 3240otherwise. 3241</para> 3242 3243</sect2> 3244<sect2 id='The_IgnoreGroupLock_Control'> 3245<title>The IgnoreGroupLock Control</title> 3246 3247<para> 3248The 3249<emphasis>IgnoreGroupLock</emphasis> 3250control is a boolean control with no attributes. If enabled, it specifies that 3251the locked state of the keyboard group should not be considered when activating 3252passive grabs. 3253</para> 3254 3255<para> 3256Because 3257<emphasis>IgnoreGroupLock</emphasis> 3258is a boolean control with no attributes, use the general boolean controls 3259functions (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>) to change its state. 3260</para> 3261 3262 3263</sect2> 3264<sect2 id='The_InternalMods_Control'> 3265<title>The InternalMods Control</title> 3266 3267<para> 3268The core protocol does not provide any means to prevent a modifier from being 3269reported in events sent to clients; Xkb, however makes this possible via the 3270<emphasis>InternalMods</emphasis> 3271control. It specifies modifiers that should be consumed by the server and not 3272reported to clients. When a key is pressed and a modifier that has its bit set 3273in the 3274<emphasis>InternalMods</emphasis> 3275control is reported to the server, the server uses the modifier when 3276determining the actions to apply for the key. The server then clears the bit, 3277so it is not actually reported to the client. In addition, modifiers specified 3278in the 3279<emphasis>InternalMods</emphasis> 3280control are not used to determine grabs and are not used to calculate core 3281protocol compatibility state. 3282</para> 3283 3284 3285<para> 3286Manipulate the 3287<emphasis>InternalMods</emphasis> 3288control via the 3289<structfield>internal</structfield> 3290field in the 3291<structname>XkbControlsRec</structname> 3292structure, using 3293<function>XkbSetControls</function> 3294and 3295<function>XkbGetControls</function> 3296(see <link linkend="Querying_Controls">section 10.9</link> 3297and <link linkend="Changing_Controls">section 10.10</link>). Alternatively, use 3298<function>XkbSetServerInternalMods</function>. 3299</para> 3300 3301 3302<para> 3303To set the modifiers that are consumed by the server before events are 3304delivered to the client, use 3305<function>XkbSetServerInternalMods</function>. 3306</para> 3307 3308<indexterm significance="preferred" zone="XkbSetServerInternalMods"><primary><function>XkbSetServerInternalMods</function></primary></indexterm> 3309<funcsynopsis id="XkbSetServerInternalMods"> 3310 <funcprototype> 3311 <funcdef>Bool <function>XkbSetServerInternalMods</function></funcdef> 3312<!-- ( 3313<parameter>display, device_spec, affect_real, real_values, affect_virtual, 3314virtual_values</parameter> 3315) --> 3316 3317 <paramdef>Display *<parameter>display</parameter></paramdef> 3318 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 3319 <paramdef>unsigned int <parameter>affect_real</parameter></paramdef> 3320 <paramdef>unsigned int <parameter>real_values</parameter></paramdef> 3321 <paramdef>unsigned int <parameter>affect_virtual</parameter></paramdef> 3322 <paramdef>unsigned int <parameter>virtual_values</parameter></paramdef> 3323 </funcprototype> 3324</funcsynopsis> 3325<variablelist> 3326 <varlistentry> 3327 <term> 3328 <parameter>display</parameter> 3329 </term> 3330 <listitem> 3331 <para> 3332 connection to the X server 3333 </para> 3334 </listitem> 3335 </varlistentry> 3336 <varlistentry> 3337 <term> 3338 <parameter>device_spec</parameter> 3339 </term> 3340 <listitem> 3341 <para> 3342 ‘device ID, or <symbol>XkbUseCoreKbd</symbol> 3343 </para> 3344 </listitem> 3345 </varlistentry> 3346 <varlistentry> 3347 <term> 3348 <parameter>affect_real</parameter> 3349 </term> 3350 <listitem> 3351 <para> 3352 mask of real modifiers affected by this call 3353 </para> 3354 </listitem> 3355 </varlistentry> 3356 <varlistentry> 3357 <term> 3358 <parameter>real_values</parameter> 3359 </term> 3360 <listitem> 3361 <para> 3362 values for affected real modifiers (1⇒set, 0⇒unset) 3363 </para> 3364 </listitem> 3365 </varlistentry> 3366 <varlistentry> 3367 <term> 3368 <parameter>affect_virtual</parameter> 3369 </term> 3370 <listitem> 3371 <para> 3372 mask of virtual modifiers affected by this call 3373 </para> 3374 </listitem> 3375 </varlistentry> 3376 <varlistentry> 3377 <term> 3378 <parameter>virtual_values</parameter> 3379 </term> 3380 <listitem> 3381 <para> 3382 values for affected virtual modifiers (1⇒set, 0⇒unset) 3383 </para> 3384 </listitem> 3385 </varlistentry> 3386</variablelist> 3387 3388<para> 3389<function>XkbSetServerInternalMods</function> 3390sends a request to the server to change the internal modifiers consumed by the 3391server. 3392<parameter>affect_real</parameter> 3393and 3394<parameter>real_values</parameter> 3395are masks of real modifier bits indicating which real modifiers are to be 3396added and removed from the server’s internal modifiers control. Modifiers 3397selected by both 3398<parameter>affect_real</parameter> 3399and 3400<parameter>real_values</parameter> 3401are added to the server’s internal modifiers control; those selected by 3402<parameter>affect_real</parameter> 3403but not by 3404<parameter>real_values</parameter> 3405are removed from the server’s internal modifiers mask. Valid values for 3406<parameter>affect_real</parameter> 3407and 3408<parameter>real_values</parameter> 3409consist of any combination of the eight core modifier bits: 3410<symbol>ShiftMask</symbol>, 3411<symbol>LockMask</symbol>, 3412<symbol>ControlMask</symbol>, 3413<symbol>Mod1Mask</symbol> 3414– 3415<symbol>Mod5Mask</symbol>. 3416<parameter>affect_virtual</parameter> 3417and 3418<parameter>virtual_values</parameter> 3419are masks of virtual modifier bits indicating which virtual modifiers are to 3420be added and removed from the server’s internal modifiers control. Modifiers 3421selected by both 3422<parameter>affect_virtual</parameter> 3423and 3424<parameter>virtual_values</parameter> 3425are added to the server’s internal modifiers control; those selected by 3426<parameter>affect_virtual</parameter> 3427but not by 3428<parameter>virtual_values</parameter> 3429are removed from the server’s internal modifiers control. 3430See <link linkend="Virtual_Modifier_Names_and_Masks">section 7.1</link> for a discussion of virtual modifier masks to use in 3431<parameter>affect_virtual</parameter> 3432and 3433<parameter>virtual_values</parameter>. 3434<function>XkbSetServerInternalMods</function> 3435does not wait for a reply from the server. It returns 3436<symbol>True</symbol> 3437if the request was sent and 3438<symbol>False</symbol> 3439otherwise. 3440</para> 3441 3442 3443</sect2> 3444</sect1> 3445<sect1 id='The_XkbControlsRec_Structure'> 3446<title>The XkbControlsRec Structure</title> 3447 3448<indexterm significance="preferred" zone="The_XkbControlsRec_Structure"> 3449<primary><structname>XkbControlsRec</structname></primary></indexterm> 3450 3451<para> 3452Many of the individual controls described in sections 10.1 through 10.7 may be 3453manipulated via convenience functions discussed in those sections. Some of 3454them, however, have no convenience functions. The 3455<structname>XkbControlsRec</structname> 3456structure allows the manipulation of one or more of the controls in a single 3457operation and to track changes to any of them in conjunction with the 3458<function>XkbGetControls</function> 3459and 3460<function>XkbSetControls</function> 3461functions. This is the only way to manipulate those controls that have no 3462convenience functions. 3463</para> 3464 3465 3466<para> 3467The 3468<structname>XkbControlsRec</structname> 3469structure is defined as follows: 3470 3471<programlisting> 3472#define XkbMaxLegalKeyCode 255 3473#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) 3474 3475typedef struct { 3476 unsigned char mk_dflt_btn; /* default button for 3477 keyboard driven mouse */ 3478 unsigned char num_groups; /* number of keyboard groups */ 3479 unsigned char groups_wrap; /* how to wrap out-of-bounds groups */ 3480 XkbModsRec internal; /* defines server internal modifiers */ 3481 XkbModsRec ignore_lock; /* modifiers to ignore when 3482 checking for grab */ 3483 unsigned int enabled_ctrls; /* 1 bit ⇒ corresponding 3484 boolean control enabled */ 3485 unsigned short repeat_delay; /* ms delay until first repeat */ 3486 unsigned short repeat_interval; /* ms delay between repeats */ 3487 unsigned short slow_keys_delay; /* ms minimum time key must be 3488 down to be ok */ 3489 unsigned short debounce_delay; /* ms delay before key reactivated */ 3490 unsigned short mk_delay; /* ms delay to second mouse 3491 motion event */ 3492 unsigned short mk_interval; /* ms delay between repeat mouse 3493 events */ 3494 unsigned short mk_time_to_max; /* # intervals until constant 3495 mouse move */ 3496 unsigned short mk_max_speed; /* multiplier for maximum mouse speed */ 3497 short mk_curve; /* determines mouse move curve type */ 3498 unsigned short ax_options; /* 1 bit ⇒ Access X option enabled */ 3499 unsigned short ax_timeout; /* seconds until Access X disabled */ 3500 unsigned short axt_opts_mask; /* 1 bit ⇒ options to reset 3501 on Access X timeout */ 3502 unsigned short axt_opts_values; /* 1 bit ⇒ turn option on, 0⇒ off */ 3503 unsigned int axt_ctrls_mask; /* which bits in <structfield>enabled_ctrls</structfield> 3504 to modify */ 3505 unsigned int axt_ctrls_values; /* values for new bits in 3506 <structfield>enabled_ctrls</structfield> */ 3507 unsigned char per_key_repeat[XkbPerKeyBitArraySize]; 3508 /* per key auto repeat */ 3509} <structname>XkbControlsRec</structname>, *XkbControlsPtr; 3510</programlisting> 3511</para> 3512 3513<para> 3514The general-purpose functions that work with the 3515<structname>XkbControlsRec</structname> 3516structure use a mask to specify which controls are to be manipulated. 3517<link linkend="table10.6">Table 10.6</link> 3518lists these controls, the masks used to select them in the general 3519function calls 3520(<structfield>which</structfield> 3521parameter), and the data fields in the 3522<structname>XkbControlsRec</structname> 3523structure that comprise each of the individual controls. Also listed are the 3524bit used to turn boolean controls on and off and the section where each control 3525is described in more detail. 3526</para> 3527 3528<table id='table10.6' frame='topbot'> 3529<title>Xkb Controls</title> 3530<?dbfo keep-together="auto" ?> 3531<tgroup cols='5' align='left' colsep='0' rowsep='0'> 3532<colspec colname='c1' colwidth='2.0*'/> 3533<colspec colname='c2' colwidth='3.1*'/> 3534<colspec colname='c3' colwidth='2.2*'/> 3535<colspec colname='c4' colwidth='2.6*'/> 3536<colspec colname='c5' colwidth='1.0*'/> 3537<thead> 3538<row rowsep='1'> 3539 <entry>Control</entry> 3540 <entry>Control Selection Mask (which parameter)</entry> 3541 <entry>Relevant XkbControlsRec Data Fields</entry> 3542 <entry>Boolean Control enabled_ctrls bit</entry> 3543 <entry>Section</entry> 3544 </row> 3545</thead> 3546<tbody> 3547 <row> 3548 <entry>AccessXFeedback</entry> 3549 <entry><symbol>XkbAccessXFeedbackMask</symbol></entry> 3550 <entry>ax_options: XkbAX_*FBMask</entry> 3551 <entry>XkbAccessXFeedback­Mask</entry> 3552 <entry><link linkend="The_AccessXFeedback_Control">10.6.3</link></entry> 3553 </row> 3554 <row> 3555 <entry>AccessXKeys</entry> 3556 <entry></entry> 3557 <entry></entry> 3558 <entry>XkbAccessXKeys­Mask</entry> 3559 <entry><link linkend="The_AccessXKeys_Control">10.6.1</link></entry> 3560 </row> 3561 <row> 3562 <entry>AccessXTimeout</entry> 3563 <entry><symbol>XkbAccessXTimeoutMask</symbol></entry> 3564 <entry> 3565 <para>ax_timeout</para> 3566 <para>axt_opts_mask</para> 3567 <para>axt_opts_values</para> 3568 <para>axt_ctrls_mask</para> 3569 <para>axt_ctrls_values</para> 3570 </entry> 3571 <entry>XkbAccessXTimeout­Mask</entry> 3572 <entry><link linkend="The_AccessXTimeout_Control">10.6.2</link></entry> 3573 </row> 3574 <row> 3575 <entry>AudibleBell</entry> 3576 <entry></entry> 3577 <entry></entry> 3578 <entry><symbol>XkbAudibleBellMask</symbol></entry> 3579 <entry><link linkend="Audible_Bells">9.2</link></entry> 3580 </row> 3581 <row> 3582 <entry>AutoReset</entry> 3583 <entry></entry> 3584 <entry></entry> 3585 <entry></entry> 3586 <entry><link linkend="The_AutoReset_Control">10.1.2</link></entry> 3587 </row> 3588 <row> 3589 <entry>BounceKeys</entry> 3590 <entry><symbol>XkbBounceKeysMask</symbol></entry> 3591 <entry>debounce_delay</entry> 3592 <entry><symbol>XkbBounceKeysMask</symbol></entry> 3593 <entry><link linkend="The_BounceKeys_Control">10.6.7</link></entry> 3594 </row> 3595 <row> 3596 <entry>Detectable-Autorepeat</entry> 3597 <entry></entry> 3598 <entry></entry> 3599 <entry></entry> 3600 <entry><link linkend="The_DetectableAutorepeat_Control">10.3.3</link></entry> 3601 </row> 3602 <row> 3603 <entry>EnabledControls</entry> 3604 <entry><symbol>XkbControlsEnabledMask</symbol></entry> 3605 <entry>enabled_ctrls</entry> 3606 <entry><emphasis>Non-Boolean Control</emphasis></entry> 3607 <entry><link linkend="The_EnabledControls_Control">10.1.1</link></entry> 3608 </row> 3609 <row> 3610 <entry>GroupsWrap</entry> 3611 <entry><symbol>XkbGroupsWrapMask</symbol></entry> 3612 <entry>groups_wrap</entry> 3613 <entry><emphasis>Non-Boolean Control</emphasis></entry> 3614 <entry><link linkend="The_GroupsWrap_Control">10.7.1</link></entry> 3615 </row> 3616 <row> 3617 <entry>IgnoreGroupLock</entry> 3618 <entry></entry> 3619 <entry></entry> 3620 <entry>XkbIgnoreGroupLock­Mask</entry> 3621 <entry><link linkend="The_IgnoreGroupLock_Control">10.7.3</link></entry> 3622 </row> 3623 <row> 3624 <entry>IgnoreLockMods</entry> 3625 <entry><symbol>XkbIgnoreLockModsMask</symbol></entry> 3626 <entry>ignore_lock</entry> 3627 <entry><emphasis>Non-Boolean Control</emphasis></entry> 3628 <entry><link linkend="Keyboard_State_Description">5.1</link></entry> 3629 </row> 3630 <row> 3631 <entry>InternalMods</entry> 3632 <entry><symbol>XkbInternalModsMask</symbol></entry> 3633 <entry>internal</entry> 3634 <entry><emphasis>Non-Boolean Control</emphasis></entry> 3635 <entry><link linkend="Keyboard_State_Description">5.1</link></entry> 3636 </row> 3637 <row> 3638 <entry>MouseKeys</entry> 3639 <entry><symbol>XkbMouseKeysMask</symbol></entry> 3640 <entry>mk_dflt_btn</entry> 3641 <entry><symbol>XkbMouseKeysMask</symbol></entry> 3642 <entry><link linkend="The_MouseKeys_Control">10.5.1</link></entry> 3643 </row> 3644 <row> 3645 <entry>MouseKeysAccel</entry> 3646 <entry><symbol>XkbMouseKeysAccelMask</symbol></entry> 3647 <entry> 3648 <para>mk_delay</para> 3649 <para>mk_interval</para> 3650 <para>mk_time_to_max</para> 3651 <para>mk_max_speed</para> 3652 <para>mk_curve</para> 3653 </entry> 3654 <entry>XkbMouseKeysAccel­Mask</entry> 3655 <entry><link linkend="The_MouseKeysAccel_Control">10.5.2</link></entry> 3656 </row> 3657 <row> 3658 <entry>Overlay1</entry> 3659 <entry></entry> 3660 <entry></entry> 3661 <entry><symbol>XkbOverlay1Mask</symbol></entry> 3662 <entry><link linkend="Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls">10.4</link></entry> 3663 </row> 3664 <row> 3665 <entry>Overlay2</entry> 3666 <entry></entry> 3667 <entry></entry> 3668 <entry><symbol>XkbOverlay2Mask</symbol></entry> 3669 <entry><link linkend="Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls">10.4</link></entry> 3670 </row> 3671 <row> 3672 <entry>PerKeyRepeat</entry> 3673 <entry><symbol>XkbPerKeyRepeatMask</symbol></entry> 3674 <entry>per_key_repeat</entry> 3675 <entry><emphasis>Non-Boolean Control</emphasis></entry> 3676 <entry><link linkend="The_PerKeyRepeat_Control">10.3.1</link></entry> 3677 </row> 3678 <row> 3679 <entry>RepeatKeys</entry> 3680 <entry><symbol>XkbRepeatKeysMask</symbol></entry> 3681 <entry> 3682 <para>repeat_delay</para> 3683 <para>repeat_interval</para> 3684 </entry> 3685 <entry><symbol>XkbRepeatKeysMask</symbol></entry> 3686 <entry><link linkend="Controls_for_Repeat_Key_Behavior">10.3</link></entry> 3687 </row> 3688 <row> 3689 <entry>SlowKeys</entry> 3690 <entry><symbol>XkbSlowKeysMask</symbol></entry> 3691 <entry>slow_keys_delay</entry> 3692 <entry><symbol>XkbSlowKeysMask</symbol></entry> 3693 <entry><link linkend="The_SlowKeys_Control">10.6.6</link></entry> 3694 </row> 3695 <row> 3696 <entry>StickyKeys</entry> 3697 <entry><symbol>XkbStickyKeysMask</symbol></entry> 3698 <entry> 3699 <para>ax_options:</para> 3700 <para>XkbAX_Two­KeysMask</para> 3701 <para>XkbAX_Latch­ToLockMask</para> 3702 </entry> 3703 <entry><symbol>XkbStickyKeysMask</symbol></entry> 3704 <entry><link linkend="The_StickyKeys_Control">10.6.8</link></entry> 3705 </row> 3706</tbody> 3707</tgroup> 3708</table> 3709 3710<para> 3711<link linkend="table10.7">Table 10.7</link> 3712shows the actual values for the individual mask bits used to select 3713controls for modification and to enable and disable the control. Note that the 3714same mask bit is used to specify general modifications to the parameters used 3715to configure the control 3716(<structfield>which</structfield>), 3717and to enable and disable the control 3718(<structfield>enabled_ctrls</structfield>). 3719The anomalies in the table (no <quote>ok</quote> in column) are for controls that have no 3720configurable attributes; and for controls that are not boolean controls and 3721therefore cannot be enabled or disabled. 3722</para> 3723 3724<table id='table10.7' frame='topbot'> 3725<title>Controls Mask Bits</title> 3726<?dbfo keep-together="always" ?> 3727<tgroup cols='4' align='left' colsep='0' rowsep='0'> 3728<colspec colname='c1' colwidth='2.6*'/> 3729<colspec colname='c2' colwidth='2.0*'/> 3730<colspec colname='c3' colwidth='1.3*'/> 3731<colspec colname='c4' colwidth='2.0*'/> 3732<thead> 3733<row rowsep='1'> 3734 <entry>Mask Bit</entry> 3735 <entry>which or changed_ctrls</entry> 3736 <entry>enabled_ctrls</entry> 3737 <entry>Value</entry> 3738</row> 3739</thead> 3740<tbody> 3741<row> 3742 <entry><symbol>XkbRepeatKeysMask</symbol></entry> 3743 <entry>ok</entry> 3744 <entry>ok</entry> 3745 <entry>(1L<<0)</entry> 3746 </row> 3747 <row> 3748 <entry><symbol>XkbSlowKeysMask</symbol></entry> 3749 <entry>ok</entry> 3750 <entry>ok</entry> 3751 <entry>(1L<<1)</entry> 3752 </row> 3753 <row> 3754 <entry><symbol>XkbBounceKeysMask</symbol></entry> 3755 <entry>ok</entry> 3756 <entry>ok</entry> 3757 <entry>(1L<<2)</entry> 3758 </row> 3759 <row> 3760 <entry><symbol>XkbStickyKeysMask</symbol></entry> 3761 <entry>ok</entry> 3762 <entry>ok</entry> 3763 <entry>(1L<<3)</entry> 3764 </row> 3765 <row> 3766 <entry><symbol>XkbMouseKeysMask</symbol></entry> 3767 <entry>ok</entry> 3768 <entry>ok</entry> 3769 <entry>(1L<<4)</entry> 3770 </row> 3771 <row> 3772 <entry><symbol>XkbMouseKeysAccelMask</symbol></entry> 3773 <entry>ok</entry> 3774 <entry>ok</entry> 3775 <entry>(1L<<5)</entry> 3776 </row> 3777 <row> 3778 <entry><symbol>XkbAccessXKeysMask</symbol></entry> 3779 <entry>ok</entry> 3780 <entry>ok</entry> 3781 <entry>(1L<<6)</entry> 3782 </row> 3783 <row> 3784 <entry><symbol>XkbAccessXTimeoutMask</symbol></entry> 3785 <entry>ok</entry> 3786 <entry>ok</entry> 3787 <entry>(1L<<7)</entry> 3788 </row> 3789 <row> 3790 <entry><symbol>XkbAccessXFeedbackMask</symbol></entry> 3791 <entry>ok</entry> 3792 <entry>ok</entry> 3793 <entry>(1L<<8)</entry> 3794 </row> 3795 <row> 3796 <entry><symbol>XkbAudibleBellMask</symbol></entry> 3797 <entry></entry> 3798 <entry>ok</entry> 3799 <entry>(1L<<9)</entry> 3800 </row> 3801 <row> 3802 <entry><symbol>XkbOverlay1Mask</symbol></entry> 3803 <entry></entry> 3804 <entry>ok</entry> 3805 <entry>(1L<<10)</entry> 3806 </row> 3807 <row> 3808 <entry><symbol>XkbOverlay2Mask</symbol></entry> 3809 <entry></entry> 3810 <entry>ok</entry> 3811 <entry>(1L<<11)</entry> 3812 </row> 3813 <row> 3814 <entry><symbol>XkbIgnoreGroupLockMask</symbol></entry> 3815 <entry></entry> 3816 <entry>ok</entry> 3817 <entry>(1L<<12)</entry> 3818</row> 3819<row> 3820 <entry><symbol>XkbGroupsWrapMask</symbol></entry> 3821 <entry>ok</entry> 3822 <entry></entry> 3823 <entry>(1L<<27)</entry> 3824</row> 3825<row> 3826 <entry><symbol>XkbInternalModsMask</symbol></entry> 3827 <entry>ok</entry> 3828 <entry></entry> 3829 <entry>(1L<<28)</entry> 3830</row> 3831<row> 3832 <entry><symbol>XkbIgnoreLockModsMask</symbol></entry> 3833 <entry>ok</entry> 3834 <entry></entry> 3835 <entry>(1L<<29)</entry> 3836</row> 3837<row> 3838 <entry><symbol>XkbPerKeyRepeatMask</symbol></entry> 3839 <entry>ok</entry> 3840 <entry></entry> 3841 <entry>(1L<<30)</entry> 3842</row> 3843<row> 3844 <entry><symbol>XkbControlsEnabledMask</symbol></entry> 3845 <entry>ok</entry> 3846 <entry></entry> 3847 <entry>(1L<<31)</entry> 3848</row> 3849<row> 3850 <entry><symbol>XkbAccessXOptionsMask</symbol></entry> 3851 <entry>ok</entry> 3852 <entry>ok</entry> 3853 <entry>(XkbStickyKeysMask | XkbAccessXFeedbackMask)</entry> 3854 </row> 3855 <row> 3856 <entry><symbol>XkbAllBooleanCtrlsMask</symbol></entry> 3857 <entry></entry> 3858 <entry>ok</entry> 3859 <entry>(0x00001FFF) </entry> 3860 </row> 3861 <row> 3862 <entry><symbol>XkbAllControlsMask</symbol></entry> 3863 <entry>ok</entry> 3864 <entry></entry> 3865 <entry>(0xF8001FFF)</entry> 3866 </row> 3867</tbody> 3868</tgroup> 3869</table> 3870 3871<para> 3872The individual fields of the 3873<structname>XkbControlsRec</structname> 3874structure are defined as follows. 3875</para> 3876 3877<sect2> 3878<title/> 3879<sect3 id='mk_dflt_btn'> 3880<title>mk_dflt_btn</title> 3881 3882<para> 3883<structfield>mk_dflt_btn</structfield> is an attribute of the 3884<emphasis>MouseKeys</emphasis> 3885control 3886(see <link linkend="Controls_for_Using_the_Mouse_from_the_Keyboard">section 10.5</link>). It 3887specifies the mouse button number to use for keyboard simulated mouse button 3888operations. Its value should be one of the core symbols 3889<symbol>Button1</symbol> 3890– 3891<symbol>Button5</symbol>. 3892</para> 3893 3894 3895</sect3> 3896<sect3 id='num_groups'> 3897<title>num_groups</title> 3898 3899<para> 3900<structfield>num_groups</structfield> 3901is not a part of any control, but is reported in the 3902<structname>XkbControlsRec</structname> 3903structure whenever any of its components are fetched from the server. It 3904reports the number of groups the particular keyboard configuration uses and is 3905computed automatically by the server whenever the keyboard mapping changes. 3906</para> 3907 3908 3909</sect3> 3910<sect3 id='groups_wrap'> 3911<title>groups_wrap</title> 3912 3913<para> 3914<structfield>groups_wrap</structfield> 3915is an attribute of the 3916<emphasis>GroupsWrap</emphasis> 3917control (see <link linkend="The_GroupsWrap_Control">section 10.7.1</link>). It specifies the handling of illegal groups on a 3918global basis. Valid values for 3919<structfield>groups_wrap</structfield> 3920are shown in <link linkend="table10.8">Table 10.8</link>. 3921</para> 3922 3923<table id='table10.8' frame='topbot'> 3924<title>GroupsWrap options (groups_wrap field)</title> 3925<?dbfo keep-together="always" ?> 3926<tgroup cols='2' align='left' colsep='0' rowsep='0'> 3927<colspec colname='c1' colwidth='1.0*'/> 3928<colspec colname='c2' colwidth='1.0*'/> 3929<thead> 3930<row rowsep='1'> 3931 <entry>groups_wrap symbolic name</entry> 3932 <entry>value</entry> 3933 </row> 3934</thead> 3935<tbody> 3936 <row> 3937 <entry><symbol>XkbWrapIntoRange</symbol></entry> 3938 <entry>(0x00)</entry> 3939 </row> 3940 <row> 3941 <entry><symbol>XkbClampIntoRange</symbol></entry> 3942 <entry>(0x40)</entry> 3943 </row> 3944 <row> 3945 <entry><symbol>XkbRedirectIntoRange</symbol></entry> 3946 <entry>(0x80)</entry> 3947 </row> 3948</tbody> 3949</tgroup> 3950</table> 3951 3952<para> 3953When 3954<structfield>groups_wrap</structfield> 3955is set to 3956<symbol>XkbRedirectIntoRange</symbol>, 3957its four low-order bits specify the index of the group to use. 3958</para> 3959 3960 3961</sect3> 3962<sect3 id='internal'> 3963<title>internal</title> 3964 3965<para> 3966<structfield>internal</structfield> 3967is an attribute of the 3968<emphasis>InternalMods</emphasis> 3969control (see <link linkend="The_InternalMods_Control">section 10.7.4</link>). It specifies modifiers to be consumed in the 3970server and not passed on to clients when events are reported. Valid values 3971consist of any combination of the eight core modifier bits: 3972<symbol>ShiftMask</symbol>, 3973<symbol>LockMask</symbol>, 3974<symbol>ControlMask</symbol>, 3975<symbol>Mod1Mask</symbol> 3976– 3977<symbol>Mod5Mask</symbol>. 3978</para> 3979 3980 3981</sect3> 3982<sect3 id='ignore_lock'> 3983<title>ignore_lock</title> 3984 3985<para> 3986<structfield>ignore_lock</structfield> 3987is an attribute of the 3988<emphasis>IgnoreLockMods</emphasis> 3989control (see <link linkend="The_IgnoreLockMods_Control">section 10.7.2</link>). It specifies modifiers to be ignored in grab 3990calculations. Valid values consist of any combination of the eight core 3991modifier bits: 3992<symbol>ShiftMask</symbol>, 3993<symbol>LockMask</symbol>, 3994<symbol>ControlMask</symbol>, 3995<symbol>Mod1Mask</symbol> 3996– 3997<symbol>Mod5Mask</symbol>. 3998</para> 3999 4000 4001</sect3> 4002<sect3 id='enabled_ctrls'> 4003<title>enabled_ctrls</title> 4004 4005<para> 4006<structfield>enabled_ctrls</structfield> 4007is an attribute of the 4008<emphasis>EnabledControls</emphasis> 4009control (see <link linkend="The_EnabledControls_Control">section 10.1.1</link>). It contains one bit per boolean control. Each 4010bit determines whether the corresponding control is enabled or disabled; a one 4011bit means the control is enabled. The mask bits used to enable these controls 4012are listed in <link linkend="table10.7">Table 10.7</link>, 4013using only those masks with <quote>ok</quote> in the 4014<structfield>enabled_ctrls</structfield> 4015column. 4016</para> 4017 4018 4019</sect3> 4020<sect3 id='repeat_delay_and_repeat_interval'> 4021<title>repeat_delay and repeat_interval</title> 4022 4023<para> 4024<structfield>repeat_delay</structfield> 4025and 4026<structfield>repeat_interval</structfield> 4027are attributes of the 4028<emphasis>RepeatKeys</emphasis> 4029control (see <link linkend="The_RepeatKeys_Control">section 10.3.2</link>). 4030<structfield>repeat_delay</structfield> 4031is the initial delay before a key begins repeating, in milliseconds; 4032<structfield>repeat_interval</structfield> 4033is the delay between subsequent key events, in milliseconds. 4034</para> 4035 4036 4037</sect3> 4038<sect3 id='slow_keys_delay'> 4039<title>slow_keys_delay</title> 4040 4041<para> 4042<structfield>slow_keys_delay</structfield> 4043is an attribute of the 4044<emphasis>SlowKeys</emphasis> 4045control (see <link linkend="The_SlowKeys_Control">section 10.6.6</link>). Its value specifies the 4046<emphasis>SlowKeys</emphasis> 4047acceptance delay period in milliseconds before a key press is accepted by the 4048server. 4049</para> 4050 4051 4052</sect3> 4053<sect3 id='debounce_delay'> 4054<title>debounce_delay</title> 4055 4056<para> 4057<structfield>debounce_delay</structfield> 4058is an attribute of the 4059<emphasis>BounceKeys</emphasis> 4060control (see <link linkend="The_BounceKeys_Control">section 10.6.7</link>). Its value specifies the 4061<emphasis>BounceKeys</emphasis> 4062delay period in milliseconds for which the key is disabled after having been 4063pressed before another press of the same key is accepted by the server. 4064</para> 4065 4066 4067</sect3> 4068<sect3 id='mk_delay_mk_interval_mk_time_to_max_mk_max_speed_and_mk_curve'> 4069<title>mk_delay, mk_interval, mk_time_to_max, mk_max_speed, and mk_curve</title> 4070 4071<para> 4072<structfield>mk_delay</structfield>, 4073<structfield>mk_interval</structfield>, 4074<structfield>mk_time_to_max</structfield>, 4075<structfield>mk_max_speed</structfield>, 4076and 4077<structfield>mk_curve</structfield> 4078are attributes of the 4079<emphasis>MouseKeysAccel</emphasis> 4080control. Refer to <link linkend="The_MouseKeysAccel_Control">section 10.5.2</link> for a description of these fields and the 4081units involved. 4082</para> 4083 4084 4085</sect3> 4086<sect3 id='ax_options'> 4087<title>ax_options</title> 4088 4089<para> 4090The 4091<structfield>ax_options</structfield> 4092field contains attributes used to configure two different controls, the 4093<emphasis>StickyKeys</emphasis> 4094control (see <link linkend="The_StickyKeys_Control">section 10.6.8</link>) and the 4095<emphasis>AccessXFeedback</emphasis> 4096control (see <link linkend="The_AccessXFeedback_Control">section 10.6.3</link>). The 4097<structfield>ax_options</structfield> 4098field is a bitmask and may include any combination of the bits defined in 4099<link linkend="table10.9">Table 10.9</link>. 4100</para> 4101 4102<table id='table10.9' frame='topbot'> 4103<title>Access X Enable/Disable Bits (ax_options field)</title> 4104<?dbfo keep-together="always" ?> 4105<tgroup cols='3' align='left' colsep='0' rowsep='0'> 4106<colspec colname='c1' colwidth='1.0*'/> 4107<colspec colname='c2' colwidth='1.3*'/> 4108<colspec colname='c3' colwidth='0.7*'/> 4109<thead> 4110<row rowsep='1'> 4111 <entry>Access X Control</entry> 4112 <entry>ax_options bit</entry> 4113 <entry>value</entry> 4114 </row> 4115</thead> 4116<tbody> 4117 <row> 4118 <entry>AccessXFeedback</entry> 4119 <entry><symbol>XkbAX_SKPressFBMask</symbol></entry> 4120 <entry>(1L<<0)</entry> 4121 </row> 4122 <row> 4123 <entry></entry> 4124 <entry><symbol>XkbAX_SKAcceptFBMask</symbol></entry> 4125 <entry>(1L << 1)</entry> 4126 </row> 4127 <row> 4128 <entry></entry> 4129 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 4130 <entry>(1L << 2)</entry> 4131 </row> 4132 <row> 4133 <entry></entry> 4134 <entry><symbol>XkbAX_SlowWarnFBMask</symbol></entry> 4135 <entry>(1L << 3)</entry> 4136 </row> 4137 <row> 4138 <entry></entry> 4139 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 4140 <entry>(1L << 4)</entry> 4141 </row> 4142 <row> 4143 <entry></entry> 4144 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 4145 <entry>(1L << 5)</entry> 4146 </row> 4147 <row> 4148 <entry></entry> 4149 <entry><symbol>XkbAX_SKReleaseFBMask</symbol></entry> 4150 <entry>(1L << 8)</entry> 4151 </row> 4152 <row> 4153 <entry></entry> 4154 <entry><symbol>XkbAX_SKRejectFBMask</symbol></entry> 4155 <entry>(1L << 9)</entry> 4156 </row> 4157 <row> 4158 <entry></entry> 4159 <entry><symbol>XkbAX_BKRejectFBMask</symbol></entry> 4160 <entry>(1L << 10)</entry> 4161 </row> 4162 <row> 4163 <entry></entry> 4164 <entry><symbol>XkbAX_DumbBellFBMask</symbol></entry> 4165 <entry>(1L << 11)</entry> 4166 </row> 4167 <row> 4168 <entry>StickyKeys</entry> 4169 <entry><symbol>XkbAX_TwoKeysMask</symbol></entry> 4170 <entry>(1L << 6)</entry> 4171 </row> 4172 <row> 4173 <entry></entry> 4174 <entry><symbol>XkbAX_LatchToLockMask</symbol></entry> 4175 <entry>(1L << 7)</entry> 4176 </row> 4177 <row> 4178 <entry></entry> 4179 <entry><symbol>XkbAX_AllOptionsMask</symbol></entry> 4180 <entry>(0xFFF)</entry> 4181 </row> 4182</tbody> 4183</tgroup> 4184</table> 4185 4186<para> 4187The fields pertaining to each control are relevant only when the control is 4188enabled 4189(<symbol>XkbAccessXFeedbackMask</symbol> 4190or 4191<symbol>XkbStickyKeysMask</symbol> 4192bit is turned on in the 4193<structfield>enabled_ctrls</structfield> 4194field). 4195</para> 4196 4197 4198<para> 4199Xkb provides a set of convenience macros for working with the 4200<structfield>ax_options</structfield> 4201field of an 4202<structname>XkbControlsRec</structname> 4203structure: 4204 4205<programlisting> 4206#define <symbol>XkbAX_NeedOption</symbol>(c,w) ((c)->ax_options & (w)) 4207</programlisting></para> 4208 4209<para> 4210The 4211<symbol>XkbAX_NeedOption</symbol> 4212macro is useful for determining whether a particular AccessX option is enabled 4213or not. It accepts a pointer to an 4214<structname>XkbControlsRec</structname> 4215structure and a valid mask bit from 4216<link linkend="table10.9">Table 10.9</link>. 4217If the specified mask bit in the 4218<structfield>ax_options</structfield> 4219field of the controls structure is set, the macro returns the mask bit. 4220Otherwise, it returns zero. Thus, 4221 4222<programlisting> 4223 XkbAX_NeedOption(ctlrec, XkbAX_LatchToLockMask) 4224</programlisting> 4225 4226is nonzero if the latch to lock transition for latching keys is enabled, and 4227zero if it is disabled. Note that 4228<symbol>XkbAX_NeedOption</symbol> 4229only determines whether or not the particular capability is configured to 4230operate; the 4231<symbol>XkbAccessXFeedbackMask</symbol> 4232bit must also be turned on in 4233<structfield>enabled_ctrls</structfield> 4234for the capability to actually be functioning. 4235</para> 4236 4237<para><programlisting> 4238#define <symbol>XkbAX_AnyFeedback</symbol>(c) \ 4239 ((c)->enabled_ctrls & XkbAccessXFeedbackMask) 4240</programlisting></para> 4241 4242<para> 4243The 4244<symbol>XkbAX_AnyFeedback</symbol> 4245macro accepts a pointer to an 4246<structname>XkbControlsRec</structname> 4247structure and tells whether the 4248<emphasis>AccessXFeedback</emphasis> 4249control is enabled or not. If the 4250<emphasis>AccessXFeedback</emphasis> 4251control is enabled, the macro returns 4252<symbol>XkbAccessXFeedbackMask</symbol>. 4253Otherwise, it returns zero. 4254</para> 4255 4256<para><programlisting> 4257#define <symbol>XkbAX_NeedFeedback</symbol>(c,w) \ 4258 (XkbAX_AnyFeedback(c) && XkbAX_NeedOption(c,w)) 4259</programlisting></para> 4260 4261<para> 4262The 4263<symbol>XkbAX_NeedFeedback</symbol> 4264macro is useful for determining if both the 4265<emphasis>AccessXFeedback</emphasis> 4266control and a particular AccessX feedback option are enabled. The macro 4267accepts a pointer to an 4268<structname>XkbControlsRec</structname> 4269structure and a feedback option from the table above. If both the 4270<emphasis>AccessXFeedback</emphasis> 4271control and the specified feedback option are enabled, the macro returns 4272<symbol>True</symbol>. 4273Otherwise it returns 4274<symbol>False</symbol>. 4275</para> 4276 4277 4278</sect3> 4279<sect3 4280id='ax_timeout_axt_opts_mask_axt_opts_values_axt_ctrls_mask_and_axt_ctrls_values'> 4281<title>ax_timeout, axt_opts_mask, axt_opts_values, axt_ctrls_mask, and axt_ctrls_values</title> 4282 4283<para> 4284<structfield>ax_timeout</structfield>, 4285<structfield>axt_opts_mask</structfield>, 4286<structfield>axt_opts_values</structfield>, 4287<structfield>axt_ctrls_mask</structfield>, 4288and 4289<structfield>axt_ctrls_values</structfield> 4290are attributes of the 4291<emphasis>AccessXTimeout</emphasis> 4292control. Refer to <link linkend="The_AccessXTimeout_Control">section 10.6.2</link> for a description of these fields and the 4293units involved. 4294</para> 4295 4296 4297</sect3> 4298<sect3 id='per_key_repeat'> 4299<title>per_key_repeat</title> 4300 4301<para> 4302The 4303<structfield>per_key_repeat</structfield> 4304field mirrors the 4305<structfield>auto_repeats</structfield> 4306field of the core protocol 4307<structname>XKeyboardState</structname> 4308structure: changing the 4309<structfield>auto_repeats</structfield> 4310field automatically changes 4311<structfield>per_key_repeat</structfield> 4312and vice versa. It is provided for convenience and to reduce protocol traffic. 4313For example, to obtain the individual repeat key behavior as well as the repeat 4314delay and rate, use 4315<function>XkbGetControls</function>. 4316If the 4317<structfield>per_key_repeat</structfield> 4318were not in this structure, you would have to call both 4319<function>XGetKeyboardControl</function> 4320and 4321<function>XkbGetControls</function> 4322to get this information. The bits correspond to keycodes. The first seven keys 4323(keycodes 1–7) are indicated in 4324<structfield>per_key_repeat</structfield>[0], 4325with bit position 0 (low order) corresponding to the fictitious keycode 0. 4326Following array elements correspond to 8 keycodes per element. A 1 bit 4327indicates that the key is a repeating key. 4328</para> 4329 4330 4331</sect3> 4332</sect2> 4333</sect1> 4334<sect1 id='Querying_Controls'> 4335<title>Querying Controls</title> 4336 4337<para> 4338Use 4339<function>XkbGetControls</function> 4340to find the current state of Xkb server controls. 4341</para> 4342 4343<indexterm significance="preferred" zone="XkbGetControls"><primary><function>XkbGetControls</function></primary></indexterm> 4344<funcsynopsis id="XkbGetControls"> 4345 <funcprototype> 4346 <funcdef>Status <function>XkbGetControls</function></funcdef> 4347<!-- ( 4348<parameter>display, which, xkb)</parameter> --> 4349 4350 <paramdef>Display *<parameter>display</parameter></paramdef> 4351 <paramdef>unsigned long <parameter>which</parameter></paramdef> 4352 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 4353 </funcprototype> 4354</funcsynopsis> 4355<variablelist> 4356 <varlistentry> 4357 <term> 4358 <parameter>display</parameter> 4359 </term> 4360 <listitem> 4361 <para> 4362 connection to X server 4363 </para> 4364 </listitem> 4365 </varlistentry> 4366 <varlistentry> 4367 <term> 4368 <parameter>which</parameter> 4369 </term> 4370 <listitem> 4371 <para> 4372 mask of controls requested 4373 </para> 4374 </listitem> 4375 </varlistentry> 4376 <varlistentry> 4377 <term> 4378 <parameter>xkb</parameter> 4379 </term> 4380 <listitem> 4381 <para> 4382 keyboard description for controls information 4383 </para> 4384 </listitem> 4385 </varlistentry> 4386</variablelist> 4387 4388<para> 4389<function>XkbGetControls</function> 4390queries the server for the requested control information, waits for a reply, 4391and then copies the server’s values for the requested information into the 4392<structfield>ctrls</structfield> 4393structure of the 4394<parameter>xkb</parameter> 4395argument. Only those components specified by the 4396<parameter>which</parameter> 4397parameter are copied. Valid values for 4398<parameter>which</parameter> 4399are any combination of the masks listed in 4400<link linkend="table10.7">Table 10.7</link> that have <quote>ok</quote> in the 4401<parameter>which</parameter> 4402column. 4403</para> 4404 4405 4406<para> 4407If 4408<parameter>xkb</parameter>-><structfield>ctrls</structfield> 4409is 4410<symbol>NULL</symbol>, 4411<function>XkbGetControls</function> 4412allocates and initializes it before obtaining the values specified by 4413<parameter>which</parameter>. 4414If 4415<parameter>xkb</parameter>-><structfield>ctrls</structfield> 4416is not 4417<symbol>NULL</symbol>, 4418<function>XkbGetControls</function> 4419modifies only those portions of 4420<parameter>xkb</parameter>-><structfield>ctrls</structfield> 4421corresponding to the values specified by 4422<parameter>which</parameter>. 4423</para> 4424 4425 4426<para> 4427<function>XkbGetControls</function> 4428returns 4429<symbol>Success</symbol> 4430if successful; otherwise, it returns 4431<errorname>BadAlloc</errorname> 4432if it cannot obtain sufficient storage, 4433<errorname>BadMatch</errorname> 4434if 4435<parameter>xkb</parameter> 4436is 4437<symbol>NULL</symbol> 4438or 4439<parameter>which</parameter> 4440is empty, or 4441<errorname>BadImplementation</errorname>. 4442</para> 4443 4444 4445<para> 4446To free the 4447<structfield>ctrls</structfield> 4448member of a keyboard description, use 4449<function>XkbFreeControls</function> 4450(see <link linkend="Allocating_and_Freeing_an_XkbControlsRec">section 10.12</link>) 4451</para> 4452 4453 4454<para> 4455The 4456<structfield>num_groups</structfield> 4457field in the 4458<structfield>ctrls</structfield> 4459structure is always filled in by 4460<function>XkbGetControls</function>, 4461regardless of which bits are selected by 4462<parameter>which</parameter>. 4463</para> 4464 4465 4466</sect1> 4467<sect1 id='Changing_Controls'> 4468<title>Changing Controls</title> 4469 4470<para> 4471There are two ways to make changes to controls: either change a local copy 4472keyboard description and call 4473<function>XkbSetControls</function>, 4474or, to reduce network traffic, use an 4475<structname>XkbControlsChangesRec</structname> 4476structure and call 4477<function>XkbChangeControls</function>. 4478</para> 4479 4480 4481<para> 4482To change the state of one or more controls, first modify the 4483<structfield>ctrls</structfield> 4484structure in a local copy of the keyboard description and then use 4485<function>XkbSetControls</function> 4486to copy those changes to the X server. 4487</para> 4488 4489<indexterm significance="preferred" zone="XkbSetControls"><primary><function>XkbSetControls</function></primary></indexterm> 4490<funcsynopsis id="XkbSetControls"> 4491 <funcprototype> 4492 <funcdef>Bool <function>XkbSetControls</function></funcdef> 4493<!-- ( 4494<parameter>display, which, xkb)</parameter> --> 4495 4496 <paramdef>Display *<parameter>display</parameter></paramdef> 4497 <paramdef>unsigned long <parameter>which</parameter></paramdef> 4498 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 4499 </funcprototype> 4500</funcsynopsis> 4501<variablelist> 4502 <varlistentry> 4503 <term> 4504 <parameter>display</parameter> 4505 </term> 4506 <listitem> 4507 <para> 4508 connection to X server 4509 </para> 4510 </listitem> 4511 </varlistentry> 4512 <varlistentry> 4513 <term> 4514 <parameter>which</parameter> 4515 </term> 4516 <listitem> 4517 <para> 4518 mask of controls to change 4519 </para> 4520 </listitem> 4521 </varlistentry> 4522 <varlistentry> 4523 <term> 4524 <parameter>xkb</parameter> 4525 </term> 4526 <listitem> 4527 <para> 4528 <structfield>ctrls</structfield> field contains new values to be set 4529 </para> 4530 </listitem> 4531 </varlistentry> 4532</variablelist> 4533 4534<para> 4535For each bit that is set in the 4536<parameter>which</parameter> 4537parameter, 4538<function>XkbSetControls</function> 4539sends the corresponding values from the 4540<parameter>xkb</parameter>-><structfield>ctrls</structfield> 4541field to the server. Valid values for 4542<parameter>which</parameter> 4543are any combination of the masks listed in 4544<link linkend="table10.7">Table 10.7</link> that have <quote>ok</quote> in the 4545<parameter>which</parameter> 4546column. 4547</para> 4548 4549 4550<para> 4551If 4552<parameter>xkb</parameter>-><structfield>ctrls</structfield> 4553is 4554<symbol>NULL</symbol>, 4555the server does not support a compatible version of Xkb, or the Xkb extension 4556has not been properly initialized, 4557<function>XkbSetControls</function> 4558returns 4559<symbol>False</symbol>. 4560Otherwise, it sends the request to the X server and returns 4561<symbol>True</symbol>. 4562</para> 4563 4564 4565<para> 4566Note that changes to attributes of controls in the 4567<structname>XkbControlsRec</structname> 4568structure are apparent only when the associated control is enabled, although 4569the corresponding values are still updated in the X server. For example, the 4570<structfield>repeat_delay</structfield> 4571and 4572<structfield>repeat_interval</structfield> 4573fields are ignored unless the 4574<emphasis>RepeatKeys</emphasis> 4575control is enabled (that is, the X server’s equivalent of 4576<structfield>xkb->ctrls</structfield> 4577has 4578<symbol>XkbRepeatKeysMask</symbol> 4579set in 4580<structfield>enabled_ctrls</structfield>). 4581It is permissible to modify the attributes of a control in one call to 4582XkbSetControls and enable the control in a subsequent call. See <link linkend="The_EnabledControls_Control">section 10.1.1</link> 4583for more information on enabling and disabling controls. 4584</para> 4585 4586 4587<para> 4588Note that the 4589<structfield>enabled_ctrls</structfield> 4590field is itself a control — the 4591<emphasis>EnabledControls</emphasis> 4592control. As such, to set a specific configuration of enabled and disabled 4593boolean controls, you must set 4594<structfield>enabled_ctrls</structfield> 4595to the appropriate bits to enable only the controls you want and disable all 4596others, then specify the 4597<symbol>XkbControlsEnabledMask</symbol> 4598in a call to 4599<function>XkbSetControls</function>. 4600Because this is somewhat awkward if all you want to do is enable and disable 4601controls, and not modify any of their attributes, a convenience function is 4602also provided for this purpose 4603(<function>XkbChangeEnabledControls</function>, 4604<link linkend="The_EnabledControls_Control">section 10.1.1</link>). 4605</para> 4606 4607 4608<sect2 id='The_XkbControlsChangesRec_Structure'> 4609<title>The XkbControlsChangesRec Structure</title> 4610 4611<indexterm significance="preferred" zone="The_XkbControlsChangesRec_Structure"> 4612<primary><structname>XkbControlsChangesRec</structname></primary></indexterm> 4613 4614<para> 4615The 4616<structname>XkbControlsChangesRec</structname> 4617structure allows applications to track modifications to an 4618<structname>XkbControlsRec</structname> 4619structure and thereby reduce the amount of traffic sent to the server. The 4620same 4621<structname>XkbControlsChangesRec</structname> 4622structure may be used in several successive modifications to the same 4623<structname>XkbControlsRec</structname> 4624structure, then subsequently used to cause all of the changes, and only the 4625changes, to be propagated to the server. The 4626<structname>XkbControlsChangesRec</structname> 4627structure is defined as follows: 4628 4629<programlisting> 4630typedef struct _XkbControlsChanges { 4631 unsigned int changed_ctrls; /* bits indicating changed 4632 control data */ 4633 unsigned int enabled_ctrls_changes; /* bits indicating 4634 enabled/disabled controls */ 4635 Bool num_groups_changed; /* <symbol>True</symbol> if number of keyboard 4636 groups changed */ 4637} <structname>XkbControlsChangesRec</structname>, *XkbControlsChangesPtr; 4638</programlisting></para> 4639 4640<para> 4641The 4642<structfield>changed_ctrls</structfield> 4643field is a mask specifying which logical sets of data in the controls 4644structure have been modified. In this context, modified means 4645<emphasis>set</emphasis>, 4646that is, if a value is set to the same value it previously contained, it has 4647still been modified, and is noted as changed. Valid values for 4648<structfield>changed_ctrls</structfield> 4649are any combination of the masks listed in 4650<link linkend="table10.7">Table 10.7</link> that have <quote>ok</quote> in the 4651<structfield>changed_ctrls</structfield> 4652column. Setting a bit implies the corresponding data fields from the 4653<quote>Relevant XkbControlsRec Data Fields</quote> column in 4654<link linkend="table10.6">Table 10.6</link> have been modified. The 4655<structfield>enabled_ctrls_changes</structfield> 4656field specifies which bits in the 4657<structfield>enabled_ctrls</structfield> 4658field have changed. If the number of keyboard groups has changed, the 4659<structfield>num_groups_changed</structfield> 4660field is set to <symbol>True</symbol>. 4661</para> 4662 4663 4664<para> 4665If you have an Xkb description with controls that have been modified and an 4666<structname>XkbControlsChangesRec</structname> 4667that describes the changes that have been made, the 4668<function>XkbChangeControls</function> 4669function provides a flexible method for updating the controls in a server to 4670match those in the changed keyboard description. 4671</para> 4672 4673<indexterm significance="preferred" zone="XkbChangeControls"><primary><function>XkbChangeControls</function></primary></indexterm> 4674<funcsynopsis id="XkbChangeControls"> 4675 <funcprototype> 4676 <funcdef>Bool <function>XkbChangeControls</function></funcdef> 4677<!-- ( 4678<parameter>dpy, xkb, changes</parameter> 4679) --> 4680 4681 <paramdef>Display *<parameter>dpy</parameter></paramdef> 4682 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 4683 <paramdef>XkbControlsChangesPtr <parameter>changes</parameter></paramdef> 4684 </funcprototype> 4685</funcsynopsis> 4686<variablelist> 4687 <varlistentry> 4688 <term> 4689 <parameter>dpy</parameter> 4690 </term> 4691 <listitem> 4692 <para> 4693 connection to X server 4694 </para> 4695 </listitem> 4696 </varlistentry> 4697 <varlistentry> 4698 <term> 4699 <parameter>xkb</parameter> 4700 </term> 4701 <listitem> 4702 <para> 4703 keyboard description with changed <structfield>xkb->ctrls</structfield> 4704 </para> 4705 </listitem> 4706 </varlistentry> 4707 <varlistentry> 4708 <term> 4709 <parameter>changes</parameter> 4710 </term> 4711 <listitem> 4712 <para> 4713 which parts of <structfield>xkb->ctrls</structfield> have changed 4714 </para> 4715 </listitem> 4716 </varlistentry> 4717</variablelist> 4718 4719<para> 4720<function>XkbChangeControls</function> 4721copies any controls fields specified by 4722<parameter>changes</parameter> 4723from the keyboard description controls structure, 4724<parameter>xkb</parameter>-><structfield>ctrls</structfield>, 4725to the server specified by 4726<parameter>dpy</parameter>. 4727</para> 4728 4729 4730</sect2> 4731</sect1> 4732<sect1 id='Tracking_Changes_to_Keyboard_Controls'> 4733<title>Tracking Changes to Keyboard Controls</title> 4734 4735<indexterm significance="preferred" zone="Tracking_Changes_to_Keyboard_Controls"> 4736<primary>events</primary><secondary><symbol>XkbControlsNotify</symbol></secondary></indexterm> 4737<indexterm significance="preferred" zone="Tracking_Changes_to_Keyboard_Controls"> 4738<primary><structname>XkbControlsNotifyEvent</structname></primary></indexterm> 4739 4740<para> 4741Whenever a field in the controls structure changes in the server’s keyboard 4742description, the server sends an 4743<symbol>XkbControlsNotify</symbol> 4744event to all interested clients.To receive 4745<symbol>XkbControlsNotify</symbol> 4746events under all possible conditions, use 4747<function>XkbSelectEvents</function> 4748(see <link linkend="Selecting_Xkb_Events">section 4.3</link>) and pass 4749<symbol>XkbControlsNotifyMask</symbol> 4750in both 4751<parameter>bits_to_change</parameter> 4752and 4753<parameter>values_for_bits</parameter>. 4754</para> 4755 4756 4757<para> 4758To receive 4759<symbol>XkbControlsNotify</symbol> 4760events only under certain conditions, use 4761<function>XkbSelectEventDetails</function> 4762using 4763<symbol>XkbControlsNotify</symbol> 4764as the 4765<structfield>event_type</structfield> 4766and specifying the desired state changes in 4767<parameter>bits_to_change</parameter> 4768and 4769<parameter>values_for_bits</parameter> 4770using mask bits from <link linkend="table10.7">Table 10.7</link>. 4771</para> 4772 4773 4774<para> 4775The structure for the 4776<symbol>XkbControlsNotify</symbol> 4777event is defined as follows: 4778 4779<programlisting> 4780typedef struct { 4781 int type; /* Xkb extension base event code */ 4782 unsigned long serial; /* X server serial number for event */ 4783 Bool send_event; /* <symbol>True</symbol> ⇒ synthetically generated */ 4784 Display * display; /* server connection where event generated */ 4785 Time time; /* server time when event generated */ 4786 int xkb_type; /* <symbol>XkbCompatMapNotify</symbol> */ 4787 int device; /* Xkb device ID, 4788 will not be <symbol>XkbUseCoreKbd</symbol> */ 4789 unsigned int changed_ctrls; /* bits indicating which controls 4790 data have changed */ 4791 unsigned int enabled_ctrls; /* controls currently enabled in server */ 4792 unsigned int enabled_ctrl_changes; /* bits indicating 4793 enabled/disabled controls */ 4794 int num_groups; /* current number of keyboard groups */ 4795 KeyCode keycode; /* != 0 ⇒ keycode of key causing change */ 4796 char event_type; /* Type of event causing change */ 4797 char req_major; /* major event code of event causing change */ 4798 char req_minor; /* minor event code of event causing change */ 4799} <structname>XkbControlsNotifyEvent</structname>; 4800</programlisting></para> 4801 4802<para> 4803The 4804<structfield>changed_ctrls</structfield> 4805field specifies the controls components that have changed and consists of bits 4806taken from the masks defined in 4807<link linkend="table10.7">Table 10.7</link> with <quote>ok</quote> in the 4808<structfield>changed_ctrls</structfield> 4809column. 4810</para> 4811 4812 4813<para> 4814The controls currently enabled in the server are reported in the 4815<structfield>enabled_ctrls</structfield> 4816field. If any controls were just enabled or disabled (that is, the contents of 4817the 4818<structfield>enabled_ctrls</structfield> 4819field changed), they are flagged in the 4820<structfield>enabled_ctrl_changes</structfield> 4821field. The valid bits for these fields are the masks listed in 4822<link linkend="table10.7">Table 10.7</link> with 4823<quote>ok</quote> in the 4824<structfield>enabled_ctrls</structfield> 4825column. The 4826<structfield>num_groups</structfield> 4827field reports the number of groups bound to the key belonging to the most 4828number of groups and is automatically updated when the keyboard mapping changes. 4829</para> 4830 4831 4832<para> 4833If the change was caused by a request from a client, the 4834<structfield>keycode</structfield> 4835and 4836<structfield>event_type</structfield> 4837fields are set to 4838<emphasis>zero</emphasis> 4839and the 4840<structfield>req_major</structfield> 4841and 4842<structfield>req_minor</structfield> 4843fields identify the request. The 4844<structfield>req_major</structfield> 4845value is the same as the major extension opcode. Otherwise, 4846<structfield>event_type</structfield> 4847is set to the type of event that caused the change (one of 4848<symbol>KeyPress</symbol>, 4849<symbol>KeyRelease</symbol>, 4850<symbol>DeviceKeyPress</symbol>, 4851<symbol>DeviceKeyRelease</symbol>, 4852<symbol>ButtonPress</symbol> 4853or 4854<symbol>ButtonRelease</symbol>), 4855and 4856<structfield>req_major</structfield> 4857and 4858<structfield>req_minor</structfield> 4859are undefined. If 4860<structfield>event_type</structfield> 4861is 4862<symbol>KeyPress</symbol>, 4863<symbol>KeyRelease</symbol>, 4864<symbol>DeviceKeyPress</symbol>, 4865or 4866<symbol>DeviceKeyRelease</symbol>, 4867the 4868<structfield>keycode</structfield> 4869field is set to the key that caused the change. If 4870<structfield>event_type</structfield> 4871is 4872<symbol>ButtonPress</symbol> 4873or 4874<symbol>ButtonRelease</symbol>, 4875<structfield>keycode</structfield> 4876contains the button number. 4877</para> 4878 4879 4880<para> 4881When a client receives an 4882<symbol>XkbControlsNotify</symbol> 4883event, it can note the changes in a changes structure using 4884<function>XkbNoteControlsChanges</function>. 4885</para> 4886 4887<indexterm significance="preferred" zone="XkbNoteControlsChanges"><primary><function>XkbNoteControlsChanges</function></primary></indexterm> 4888<funcsynopsis id="XkbNoteControlsChanges"> 4889 <funcprototype> 4890 <funcdef>void <function>XkbNoteControlsChanges</function></funcdef> 4891<!-- ( 4892<parameter>changes</parameter>, 4893<parameter>new</parameter>, 4894<parameter>wanted</parameter> 4895) --> 4896 4897 <paramdef>XkbControlsChangesPtr <parameter>changes</parameter></paramdef> 4898 <paramdef>XkbControlsNotifyEvent *<parameter>new</parameter></paramdef> 4899 <paramdef>unsigned int <parameter>wanted</parameter></paramdef> 4900 </funcprototype> 4901</funcsynopsis> 4902<variablelist> 4903 <varlistentry> 4904 <term> 4905 <parameter>changes</parameter> 4906 </term> 4907 <listitem> 4908 <para> 4909 records changes indicated by new 4910 </para> 4911 </listitem> 4912 </varlistentry> 4913 <varlistentry> 4914 <term> 4915 <parameter>new</parameter> 4916 </term> 4917 <listitem> 4918 <para> 4919 tells which things have changed 4920 </para> 4921 </listitem> 4922 </varlistentry> 4923 <varlistentry> 4924 <term> 4925 <parameter>wanted</parameter> 4926 </term> 4927 <listitem> 4928 <para> 4929 tells which parts of new to record in changes 4930 </para> 4931 </listitem> 4932 </varlistentry> 4933</variablelist> 4934 4935<para> 4936The 4937<parameter>wanted</parameter> 4938parameter is a bitwise inclusive OR of bits taken from the set of masks 4939specified in <link linkend="table10.7">Table 10.7</link> with <quote>ok</quote> 4940in the 4941<structfield>changed_ctrls</structfield> 4942column. 4943<function>XkbNoteControlsChanges</function> 4944copies any changes reported in 4945<parameter>new</parameter> 4946and specified in 4947<parameter>wanted</parameter> 4948into the changes record specified by 4949<parameter>changes</parameter>. 4950</para> 4951 4952 4953<para> 4954Use 4955<function>XkbGetControlsChanges</function> 4956to update a local copy of a keyboard description with the changes previously 4957noted by one or more calls to 4958<function>XkbNoteControlsChanges</function>. 4959</para> 4960 4961 4962<indexterm significance="preferred" zone="XkbGetControlsChanges"><primary><function>XkbGetControlsChanges</function></primary></indexterm> 4963<funcsynopsis id="XkbGetControlsChanges"> 4964 <funcprototype> 4965 <funcdef>Status <function>XkbGetControlsChanges</function></funcdef> 4966<!-- ( 4967<parameter>dpy</parameter>, 4968<parameter>xkb</parameter>, 4969<parameter>changes</parameter> 4970) --> 4971 4972 <paramdef>Display *<parameter>dpy</parameter></paramdef> 4973 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 4974 <paramdef>XkbNameChangesPtr <parameter>changes</parameter></paramdef> 4975 </funcprototype> 4976</funcsynopsis> 4977<variablelist> 4978 <varlistentry> 4979 <term> 4980 <parameter>dpy</parameter> 4981 </term> 4982 <listitem> 4983 <para> 4984 connection to X server 4985 </para> 4986 </listitem> 4987 </varlistentry> 4988 <varlistentry> 4989 <term> 4990 <parameter>xkb</parameter> 4991 </term> 4992 <listitem> 4993 <para> 4994 <structfield>xkb->ctrls</structfield> will be updated 4995 </para> 4996 </listitem> 4997 </varlistentry> 4998 <varlistentry> 4999 <term> 5000 <parameter>changes</parameter> 5001 </term> 5002 <listitem> 5003 <para> 5004 indicates which parts of <structfield>xkb->ctrls</structfield> to update 5005 </para> 5006 </listitem> 5007 </varlistentry> 5008</variablelist> 5009 5010<para> 5011<function>XkbGetControlsChanges</function> 5012examines the 5013<parameter>changes</parameter> 5014parameter, queries the server for the necessary information, and copies the 5015results into the 5016<parameter>xkb</parameter>-><structfield>ctrls</structfield> 5017keyboard description. If the 5018<structfield>ctrls</structfield> 5019field of 5020<parameter>xkb</parameter> 5021is 5022<symbol>NULL</symbol>, 5023<function>XkbGetControlsChanges</function> 5024allocates and initializes it. To free the 5025<structfield>ctrls</structfield> 5026field, use 5027<function>XkbFreeControls</function> 5028(see <link linkend="Allocating_and_Freeing_an_XkbControlsRec">section 10.12</link>). 5029</para> 5030 5031 5032<para> 5033<function>XkbGetControlsChanges</function> 5034returns 5035<symbol>Success</symbol> 5036if successful and can generate 5037<errorname>BadAlloc</errorname>, 5038<errorname>BadImplementation</errorname>, 5039and 5040<errorname>BadMatch</errorname> 5041errors. 5042</para> 5043 5044 5045</sect1> 5046<sect1 id='Allocating_and_Freeing_an_XkbControlsRec'> 5047<title>Allocating and Freeing an XkbControlsRec</title> 5048 5049<para> 5050The need to allocate an 5051<structname>XkbControlsRec</structname> 5052structure seldom arises; Xkb creates one when an application calls 5053<function>XkbGetControls</function> 5054or a related function. For those situations where there is not an 5055<structname>XkbControlsRec</structname> 5056structure allocated in the 5057<structname>XkbDescRec</structname>, 5058allocate one by calling 5059<function>XkbAllocControls</function>. 5060</para> 5061 5062<indexterm significance="preferred" zone="XkbAllocControls"><primary><function>XkbAllocControls</function></primary></indexterm> 5063<funcsynopsis id="XkbAllocControls"> 5064 <funcprototype> 5065 <funcdef>Status <function>XkbAllocControls</function></funcdef> 5066<!-- ( 5067<parameter>xkb, which</parameter> 5068) --> 5069 5070 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 5071 <paramdef>unsigned int <parameter>which</parameter></paramdef> 5072 </funcprototype> 5073</funcsynopsis> 5074<variablelist> 5075 <varlistentry> 5076 <term> 5077 <parameter>xkb</parameter> 5078 </term> 5079 <listitem> 5080 <para> 5081 Xkb description in which to allocate ctrls rec 5082 </para> 5083 </listitem> 5084 </varlistentry> 5085 <varlistentry> 5086 <term> 5087 <parameter>which</parameter> 5088 </term> 5089 <listitem> 5090 <para> 5091 mask of components of <structfield>ctrls</structfield> to allocate 5092 </para> 5093 </listitem> 5094 </varlistentry> 5095</variablelist> 5096 5097<para> 5098<function>XkbAllocControls</function> 5099allocates the 5100<structfield>ctrls</structfield> 5101field of the 5102<parameter>xkb</parameter> 5103parameter, initializes all fields to zero, and returns 5104<symbol>Success</symbol>. 5105If the 5106<structfield>ctrls</structfield> 5107field is not 5108<symbol>NULL</symbol>, 5109<function>XkbAllocControls</function> 5110simply returns 5111<symbol>Success</symbol>. 5112If 5113<parameter>xkb</parameter> 5114is 5115<symbol>NULL</symbol>, 5116<function>XkbAllocControls</function> 5117reports a 5118<errorname>BadMatch</errorname> 5119error. If the 5120<structfield>ctrls</structfield> 5121field could not be allocated, it reports a 5122<errorname>BadAlloc</errorname> 5123error. 5124</para> 5125 5126 5127<para> 5128The 5129<parameter>which</parameter> 5130mask specifies the individual fields of the 5131<structfield>ctrls</structfield> 5132structure to be allocated and can contain any of the valid masks defined in 5133<link linkend="table10.7">Table 10.7</link>. 5134Because none of the currently existing controls have any structures 5135associated with them, which is currently of little practical value in this call. 5136</para> 5137 5138 5139<para> 5140To free memory used by the 5141<structfield>ctrls</structfield> 5142member of an 5143<structname>XkbDescRec</structname> 5144structure, use 5145<function>XkbFreeControls</function>: 5146</para> 5147 5148 5149<indexterm significance="preferred" zone="XkbFreeControls"><primary><function>XkbFreeControls</function></primary></indexterm> 5150<funcsynopsis id="XkbFreeControls"> 5151 <funcprototype> 5152 <funcdef>void <function>XkbFreeControls</function></funcdef> 5153<!-- ( 5154<parameter>xkb, which, free_all</parameter> 5155) --> 5156 5157 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 5158 <paramdef>unsigned int <parameter>which</parameter></paramdef> 5159 <paramdef>Bool <parameter>free_all</parameter></paramdef> 5160 </funcprototype> 5161</funcsynopsis> 5162<variablelist> 5163 <varlistentry> 5164 <term> 5165 <parameter>xkb</parameter> 5166 </term> 5167 <listitem> 5168 <para> 5169 Xkb description in which to free controls components 5170 </para> 5171 </listitem> 5172 </varlistentry> 5173 <varlistentry> 5174 <term> 5175 <parameter>which</parameter> 5176 </term> 5177 <listitem> 5178 <para> 5179 mask of components of <structfield>ctrls</structfield> to free 5180 </para> 5181 </listitem> 5182 </varlistentry> 5183 <varlistentry> 5184 <term> 5185 <parameter>free_all</parameter> 5186 </term> 5187 <listitem> 5188 <para> 5189 <symbol>True</symbol> ⇒ free everything + ctrls itself 5190 </para> 5191 </listitem> 5192 </varlistentry> 5193</variablelist> 5194 5195<para> 5196<function>XkbFreeControls</function> 5197frees the specified components of the 5198<structfield>ctrls</structfield> 5199field in the 5200<parameter>xkb</parameter> 5201keyboard description and sets the corresponding structure component values to 5202<symbol>NULL</symbol> 5203or 5204<emphasis>zero</emphasis>. 5205The 5206<parameter>which</parameter> 5207mask specifies the fields of 5208<structfield>ctrls</structfield> 5209to be freed and can contain any of the controls components specified in 5210<link linkend="table10.7">Table 10.7</link>. 5211</para> 5212 5213 5214<para> 5215If 5216<parameter>free_all</parameter> 5217is 5218<symbol>True</symbol>, 5219<function>XkbFreeControls</function> 5220frees every non- 5221<symbol>NULL</symbol> 5222structure component in the controls, frees the 5223<structname>XkbControlsRec</structname> 5224structure referenced by the 5225<structfield>ctrls</structfield> 5226member of 5227<parameter>xkb</parameter>, 5228and sets 5229<structfield>ctrls</structfield> 5230to 5231<symbol>NULL</symbol>. 5232</para> 5233 5234</sect1> 5235<sect1 id='The_Miscellaneous_Per_client_Controls'> 5236<title>The Miscellaneous Per-client Controls</title> 5237 5238<para> 5239You can configure the boolean per-client controls which affect the state 5240reported in button and key events. See 5241<olink targetdoc='xkbproto' targetptr='Setting_a_Passive_Grab_for_an_XKB_State'>section 12.1.1</olink>, 5242<olink targetdoc='xkbproto' targetptr='Effects_of_XKB_on_Core_Protocol_Events'>12.3</olink>, 5243<olink targetdoc='xkbproto' targetptr='Sending_Events_to_Clients'>12.5</olink>, 5244and 5245<olink targetdoc='xkbproto' targetptr='Querying_and_Changing_Per_Client_Flags'>16.3.11</olink> 5246of the 5247<olink targetdoc='xkbproto' targetptr='xkbproto'><citetitle>XKB Protocol specification</citetitle></olink> 5248for more details. 5249</para> 5250 5251 5252<para> 5253To get the current values of the 5254<emphasis>per-client</emphasis> 5255controls, use 5256<function>XkbGetPerClientControls</function>. 5257</para> 5258 5259<indexterm significance="preferred" zone="XkbGetPerClientControls"><primary><function>XkbGetPerClientControls</function></primary></indexterm> 5260<funcsynopsis id="XkbGetPerClientControls"> 5261 <funcprototype> 5262 <funcdef>Bool <function>XkbGetPerClientControls</function></funcdef> 5263<!-- ( 5264<parameter>dpy</parameter>, 5265<parameter>ctrls</parameter> 5266) --> 5267 5268 <paramdef>Display *<parameter>dpy</parameter></paramdef> 5269 <paramdef>unsigned int *<parameter>ctrls</parameter></paramdef> 5270 </funcprototype> 5271</funcsynopsis> 5272<variablelist> 5273 <varlistentry> 5274 <term> 5275 <parameter>dpy</parameter> 5276 </term> 5277 <listitem> 5278 <para> 5279 connection to X server 5280 </para> 5281 </listitem> 5282 </varlistentry> 5283 <varlistentry> 5284 <term> 5285 <parameter>ctrls</parameter> 5286 </term> 5287 <listitem> 5288 <para> 5289 1 bit ⇒ corresponding control is on 5290 </para> 5291 </listitem> 5292 </varlistentry> 5293</variablelist> 5294 5295<para> 5296<function>XkbGetPerClientControls</function> 5297backfills 5298<parameter>ctrls</parameter> 5299with the 5300<emphasis>per-client</emphasis> 5301control attributes for this particular client. It returns 5302<symbol>True</symbol> 5303if successful, and 5304<symbol>False</symbol> 5305otherwise. 5306</para> 5307 5308 5309<para> 5310To change the current values of the 5311<emphasis>per-client</emphasis> 5312control attributes, use 5313<function>XkbSetPerClientControls</function>. 5314</para> 5315 5316 5317<indexterm significance="preferred" zone="XkbSetPerClientControls"><primary><function>XkbSetPerClientControls</function></primary></indexterm> 5318<funcsynopsis id="XkbSetPerClientControls"> 5319 <funcprototype> 5320 <funcdef>Bool <function>XkbSetPerClientControls</function></funcdef> 5321<!-- ( 5322<parameter>dpy</parameter>, 5323<parameter>ctrls</parameter> 5324) --> 5325 5326 <paramdef>Display *<parameter>dpy</parameter></paramdef> 5327 <paramdef>unsigned int <parameter>change</parameter></paramdef> 5328 <paramdef>unsigned int *<parameter>value</parameter></paramdef> 5329 </funcprototype> 5330</funcsynopsis> 5331<variablelist> 5332 <varlistentry> 5333 <term> 5334 <parameter>dpy</parameter> 5335 </term> 5336 <listitem> 5337 <para> 5338 connection to X server 5339 </para> 5340 </listitem> 5341 </varlistentry> 5342 <varlistentry> 5343 <term> 5344 <parameter>change</parameter> 5345 </term> 5346 <listitem> 5347 <para> 5348 1 bit ⇒ change control 5349 </para> 5350 </listitem> 5351 </varlistentry> 5352 <varlistentry> 5353 <term> 5354 <parameter>value</parameter> 5355 </term> 5356 <listitem> 5357 <para> 5358 1 bit ⇒ control on 5359 </para> 5360 </listitem> 5361 </varlistentry> 5362</variablelist> 5363 5364<para> 5365<function>XkbSetPerClientControls</function> 5366changes the per-client values for the controls selected by 5367<parameter>change</parameter> to the corresponding value in 5368<parameter>value</parameter>. Legal values for 5369<parameter>change</parameter> and <parameter>value</parameter> 5370are: XkbPCF_GrabsUseXKBStateMask, XkbPCF_LookupStateWhenGrabbed, and 5371XkbPCF_SendEventUsesXKBState. More than one control may be changed at one time 5372by OR-ing the values together. XkbSetPerClientControls backfills value with the 5373<emphasis>per-client</emphasis> 5374control attributes for this particular client. 5375It returns 5376<symbol>True</symbol> 5377if successful, and 5378<symbol>False</symbol> 5379otherwise. 5380</para> 5381 5382</sect1> 5383</chapter> 5384