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<para> 1621There are no convenience functions in Xkb for manipulating this control. The 1622<emphasis>AccessXTimeout</emphasis> 1623control settings are carried in the 1624<structfield>ax_timeout</structfield>, 1625<structfield>axt_opts_mask</structfield>, 1626<structfield>axt_opts_values</structfield>, 1627<structfield>axt_ctrls_mask</structfield>, 1628and 1629<structfield>axt_ctrls_values</structfield> 1630fields of an 1631<structname>XkbControlsRec</structname> 1632structure, discussed in <link linkend="The_XkbControlsRec_Structure">section 10.8</link>. 1633</para> 1634 1635 1636 1637</sect2> 1638<sect2 id='The_AccessXFeedback_Control'> 1639<title>The AccessXFeedback Control</title> 1640 1641<para> 1642Just as some keyboards can produce keyclicks to indicate when a key is pressed 1643or repeating, Xkb can provide feedback for the controls by using special beep 1644codes. Use the 1645<emphasis>AccessXFeedback</emphasis> 1646control to configure the specific types of operations that generate feedback. 1647</para> 1648 1649 1650<para> 1651There is no convenience function for modifying the 1652<emphasis>AccessXFeedback</emphasis> 1653control, although the feedback as a whole can be enabled or disabled just as 1654other boolean controls are (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>). Individual beep codes are turned 1655on or off by modifying the following bits in the 1656<structfield>ax_options</structfield> 1657field of an 1658<structname>XkbControlsRec</structname> 1659structure and using 1660<function>XkbSetControls</function> 1661(see <link linkend="Changing_Controls">section 10.10</link>): 1662</para> 1663 1664<table id='table10.3' frame='topbot'> 1665<title>AccessXFeedback Masks</title> 1666<?dbfo keep-together="always" ?> 1667<tgroup cols='3' align='left' colsep='0' rowsep='0'> 1668<colspec colname='c1' colwidth='1.0*'/> 1669<colspec colname='c2' colwidth='1.0*'/> 1670<colspec colname='c3' colwidth='1.0*'/> 1671<thead> 1672<row rowsep='1'> 1673 <entry>Action</entry> 1674 <entry>Beep Code</entry> 1675 <entry>ax_options bit</entry> 1676 </row> 1677</thead> 1678<tbody> 1679<row> 1680 <entry>LED turned on</entry> 1681 <entry>High-pitched beep</entry> 1682 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 1683</row> 1684<row> 1685 <entry>LED turned off</entry> 1686 <entry>Low-pitched beep</entry> 1687 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 1688</row> 1689<row> 1690 <entry>More than one LED changed state</entry> 1691 <entry>Two high-pitched beeps</entry> 1692 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 1693</row> 1694<row> 1695 <entry>Control turned on</entry> 1696 <entry>Rising tone</entry> 1697 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 1698</row> 1699<row> 1700 <entry>Control turned off</entry> 1701 <entry>Falling tone</entry> 1702 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 1703</row> 1704<row> 1705 <entry>More than one control changed state</entry> 1706 <entry>Two high-pitched beeps</entry> 1707 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 1708</row> 1709<row> 1710 <entry>SlowKeys and BounceKeys about to be turned on or off</entry> 1711 <entry>Three high-pitched beeps</entry> 1712 <entry><symbol>XkbAX_SlowWarnFBMask</symbol></entry> 1713</row> 1714<row> 1715 <entry>SlowKeys key pressed</entry> 1716 <entry>Medium-pitched beep</entry> 1717 <entry><symbol>XkbAX_SKPressFBMask</symbol></entry> 1718</row> 1719<row> 1720 <entry>SlowKeys key accepted</entry> 1721 <entry>Medium-pitched beep</entry> 1722 <entry><symbol>XkbAX_SKAcceptFBMask</symbol></entry> 1723</row> 1724<row> 1725 <entry>SlowKeys key rejected</entry> 1726 <entry>Low-pitched beep</entry> 1727 <entry><symbol>XkbAX_SKRejectFBMask</symbol></entry> 1728</row> 1729<row> 1730 <entry>Accepted SlowKeys key released</entry> 1731 <entry>Medium-pitched beep</entry> 1732 <entry><symbol>XkbAX_SKReleaseFBMask</symbol></entry> 1733</row> 1734<row> 1735 <entry>BounceKeys key rejected</entry> 1736 <entry>Low-pitched beep</entry> 1737 <entry><symbol>XkbAX_BKRejectFBMask</symbol></entry> 1738</row> 1739<row> 1740 <entry>StickyKeys key latched</entry> 1741 <entry>Low-pitched beep followed by high-pitched beep</entry> 1742 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 1743</row> 1744<row> 1745 <entry>StickyKeys key locked</entry> 1746 <entry>High-pitched beep</entry> 1747 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 1748</row> 1749<row> 1750 <entry>StickyKeys key unlocked</entry> 1751 <entry>Low-pitched beep</entry> 1752 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 1753 </row> 1754</tbody> 1755</tgroup> 1756</table> 1757 1758<para> 1759Implementations that cannot generate continuous tones may generate multiple 1760beeps instead of falling and rising tones; for example, they can generate a 1761high-pitched beep followed by a low-pitched beep instead of a continuous 1762falling tone. Other implementations can only ring the bell with one fixed 1763pitch. In these cases, use the 1764<symbol>XkbAX_DumbBellFBMask</symbol> 1765bit of 1766<structfield>ax_options</structfield> 1767to indicate that the bell can only ring with a fixed pitch. 1768</para> 1769 1770 1771<para> 1772When any of the above feedbacks occur, Xkb may generate a 1773<symbol>XkbBellNotify</symbol> 1774event (see <link linkend="Detecting_Bells">section 9.4</link>). 1775</para> 1776 1777 1778</sect2> 1779<sect2 id='AccessXNotify_Events'> 1780<title>AccessXNotify Events</title> 1781 1782<indexterm significance="preferred" zone="AccessXNotify_Events"> 1783<primary>events</primary><secondary><symbol>XkbAccessXNotify</symbol></secondary></indexterm> 1784<indexterm significance="preferred" zone="AccessXNotify_Events"> 1785<primary><structname>XkbAccessXNotifyEvent</structname></primary></indexterm> 1786 1787<para> 1788The server can generate 1789<symbol>XkbAccessXNotify</symbol> 1790events for some of the global keyboard controls. The structure for the 1791<symbol>XkbAccessXNotify</symbol> 1792event type is as follows: 1793 1794<programlisting> 1795typedef struct { 1796 int type; /* Xkb extension base event code */ 1797 unsigned long serial; /* X server serial number for event */ 1798 Bool send_event; /* <symbol>True</symbol> ⇒ synthetically generated */ 1799 Display * display; /* server connection where event generated */ 1800 Time time; /* server time when event generated */ 1801 int xkb_type; /* <symbol>XkbAccessXNotify</symbol> */ 1802 int device; /* Xkb device ID, will not be <symbol>XkbUseCoreKbd</symbol> */ 1803 int detail; /* XkbAXN_* */ 1804 KeyCode keycode; /* key of event */ 1805 int slowKeysDelay; /* current SlowKeys delay */ 1806 int debounceDelay; /* current debounce delay */ 1807} <structname>XkbAccessXNotifyEvent</structname>; 1808</programlisting></para> 1809 1810<para> 1811The 1812<structfield>detail</structfield> 1813field describes what AccessX event just occurred and can be any of the values 1814in <link linkend="table10.4">Table 10.4</link>. 1815</para> 1816 1817<table id='table10.4' frame='topbot'> 1818<title>AccessXNotify Events</title> 1819<?dbfo keep-together="always" ?> 1820<tgroup cols='2' align='left' colsep='0' rowsep='0'> 1821<colspec colname='c1' colwidth='1.0*'/> 1822<colspec colname='c2' colwidth='2.0*'/> 1823<thead> 1824<row rowsep='1'> 1825 <entry>detail</entry> 1826 <entry>Reason</entry> 1827</row> 1828</thead> 1829<tbody> 1830<row> 1831 <entry><symbol>XkbAXN_SKPress</symbol></entry> 1832 <entry>A key was pressed when SlowKeys was enabled.</entry> 1833</row> 1834<row> 1835 <entry><symbol>XkbAXN_SKAccept</symbol></entry> 1836 <entry>A key was accepted (held longer than the SlowKeys delay).</entry> 1837</row> 1838<row> 1839 <entry><symbol>XkbAXN_SKRelease</symbol></entry> 1840 <entry>An accepted SlowKeys key was released.</entry> 1841</row> 1842<row> 1843 <entry><symbol>XkbAXN_SKReject</symbol></entry> 1844 <entry>A key was rejected (released before the SlowKeys delay 1845expired).</entry> 1846</row> 1847<row> 1848 <entry><symbol>XkbAXN_BKAccept</symbol></entry> 1849 <entry>A key was accepted by BounceKeys.</entry> 1850</row> 1851<row> 1852 <entry><symbol>XkbAXN_BKReject</symbol></entry> 1853 <entry>A key was rejected (pressed before the BounceKeys delay 1854expired).</entry> 1855</row> 1856<row> 1857 <entry><symbol>XkbAXN_AXKWarning</symbol></entry> 1858 <entry>AccessXKeys is about to turn on/off StickyKeys or BounceKeys.</entry> 1859 </row> 1860</tbody> 1861</tgroup> 1862</table> 1863 1864<para> 1865The 1866<structfield>keycode</structfield> 1867field reports the keycode of the key for which the event occurred. If the 1868action is related to 1869<emphasis>SlowKeys</emphasis>, 1870the 1871<structfield>slowKeysDelay</structfield> 1872field contains the current 1873<emphasis>SlowKeys</emphasis> 1874acceptance delay. If the action is related to 1875<emphasis>BounceKeys</emphasis>, 1876the 1877<structfield>debounceDelay</structfield> 1878field contains the current 1879<emphasis>BounceKeys</emphasis> 1880debounce delay. 1881</para> 1882 1883<sect3 id='Selecting_for_AccessX_Events'> 1884<title>Selecting for AccessX Events</title> 1885 1886<para> 1887To receive 1888<symbol>XkbAccessXNotify</symbol> 1889events under all possible conditions, use 1890<function>XkbSelectEvents</function> 1891(see <link linkend="Selecting_Xkb_Events">section 4.3</link>) and pass 1892<symbol>XkbAccessXNotifyMask</symbol> 1893in both 1894<parameter>bits_to_change</parameter> 1895and 1896<parameter>values_for_bits</parameter>. 1897</para> 1898 1899 1900<para> 1901To receive 1902<symbol>XkbStateNotify</symbol> 1903events only under certain conditions, use 1904<function>XkbSelectEventDetails</function> 1905using 1906<symbol>XkbAccessXNotify</symbol> 1907as the 1908<structfield>event_type</structfield> 1909and specifying the desired state changes in 1910<parameter>bits_to_change</parameter> 1911and 1912<parameter>values_for_bits</parameter> 1913using mask bits from <link linkend="table10.5">Table 10.5</link>. 1914</para> 1915 1916<table id='table10.5' frame='topbot'> 1917<title>AccessXNotify Event Details</title> 1918<?dbfo keep-together="always" ?> 1919<tgroup cols='3' align='left' colsep='0' rowsep='0'> 1920<colspec colname='c1' colwidth='1.5*'/> 1921<colspec colname='c2' colwidth='1.0*'/> 1922<colspec colname='c3' colwidth='2.0*'/> 1923<thead> 1924<row rowsep='1'> 1925 <entry>XkbAccessXNotify Event Details</entry> 1926 <entry>Value</entry> 1927 <entry>Circumstances</entry> 1928 </row> 1929</thead> 1930<tbody> 1931 <row> 1932 <entry><symbol>XkbAXN_SKPressMask</symbol></entry> 1933 <entry>(1<<0)</entry> 1934 <entry>Slow key press notification wanted</entry> 1935 </row> 1936 <row> 1937 <entry><symbol>XkbAXN_SKAcceptMask</symbol></entry> 1938 <entry>(1<<1)</entry> 1939 <entry>Slow key accept notification wanted</entry> 1940 </row> 1941 <row> 1942 <entry><symbol>XkbAXN_SKRejectMask</symbol></entry> 1943 <entry>(1<<2)</entry> 1944 <entry>Slow key reject notification wanted</entry> 1945 </row> 1946 <row> 1947 <entry><symbol>XkbAXN_SKReleaseMask</symbol></entry> 1948 <entry>(1<<3)</entry> 1949 <entry>Slow key release notification wanted</entry> 1950 </row> 1951 <row> 1952 <entry><symbol>XkbAXN_BKAcceptMask</symbol></entry> 1953 <entry>(1<<4)</entry> 1954 <entry>Bounce key accept notification wanted</entry> 1955 </row> 1956 <row> 1957 <entry><symbol>XkbAXN_BKRejectMask</symbol></entry> 1958 <entry>(1<<5)</entry> 1959 <entry>Bounce key reject notification wanted</entry> 1960 </row> 1961 <row> 1962 <entry><symbol>XkbAXN_AXKWarningMask</symbol></entry> 1963 <entry>(1<<6)</entry> 1964 <entry>AccessX warning notification wanted</entry> 1965 </row> 1966 <row> 1967 <entry>XkbAXN_AllEventsMask</entry> 1968 <entry>(0x7f)</entry> 1969 <entry>All AccessX features notifications wanted</entry> 1970 </row> 1971</tbody> 1972</tgroup> 1973</table> 1974 1975</sect3> 1976</sect2> 1977<sect2 id='StickyKeys_RepeatKeys_and_MouseKeys_Events'> 1978<title>StickyKeys, RepeatKeys, and MouseKeys Events</title> 1979 1980<para> 1981The 1982<emphasis>StickyKeys</emphasis>, 1983<emphasis>RepeatKeys</emphasis>, 1984and 1985<emphasis>MouseKeys</emphasis> 1986controls do not generate specific events. Instead, the latching, unlatching, 1987locking, or unlocking of modifiers using 1988<emphasis>StickyKeys</emphasis> 1989generates 1990<symbol>XkbStateNotify</symbol> 1991events as described in <link linkend="Tracking_Keyboard_State">section 5.4</link>. Repeating keys generate normal 1992<symbol>KeyPress</symbol> 1993and 1994<symbol>KeyRelease</symbol> 1995events, though the auto-repeat can be detected using 1996<emphasis>DetectableAutorepeat</emphasis> 1997(see <link linkend="The_DetectableAutorepeat_Control">section 10.3.3</link>). Finally, 1998<emphasis>MouseKeys</emphasis> 1999generates pointer events identical to those of the core pointer device. 2000</para> 2001 2002 2003</sect2> 2004<sect2 id='The_SlowKeys_Control'> 2005<title>The SlowKeys Control</title> 2006 2007<para> 2008Some users may accidentally bump keys while moving a hand or typing stick 2009toward the key they want. Usually, the keys that are accidentally bumped are 2010just hit for a very short period of time. The 2011<emphasis>SlowKeys</emphasis> 2012control helps filter these accidental bumps by telling the server to wait a 2013specified period, called the 2014<firstterm>SlowKeys acceptance delay</firstterm>, 2015before delivering key events. If the key is released before this period 2016elapses, no key events are generated. Users can then bump any number of keys on 2017their way to the one they want without accidentally getting those characters. 2018Once they have reached the key they want, they can then hold the desired key 2019long enough for the computer to accept it. 2020<emphasis>SlowKeys</emphasis> 2021is a boolean control with one configurable attribute. 2022</para> 2023 2024<para> 2025When the 2026<emphasis>SlowKeys</emphasis> 2027control is active, the server reports the initial key press, subsequent 2028acceptance or rejection, and release of any key to interested clients by 2029sending an appropriate 2030<emphasis>AccessXNotify</emphasis> 2031event (see <link linkend="AccessXNotify_Events">section 10.6.4</link>). 2032</para> 2033 2034<para> 2035There are no convenience functions in Xkb for manipulating this control. The 2036<emphasis>SlowKeys</emphasis> 2037control settings are carried in the 2038<structfield>slow_keys_delay</structfield> 2039field of an 2040<structname>XkbControlsRec</structname> 2041structure, discussed in <link linkend="The_XkbControlsRec_Structure">section 10.8</link>. 2042</para> 2043 2044</sect2> 2045<sect2 id='The_BounceKeys_Control'> 2046<title>The BounceKeys Control</title> 2047 2048<para> 2049Some users may accidentally <quote>bounce</quote> on a key when they release it. 2050They press it once, then accidentally press it again after they release it. The 2051<emphasis>BounceKeys</emphasis> 2052control temporarily disables a key after it has been pressed, effectively 2053<quote>debouncing</quote> the keyboard. The period of time the key is disabled 2054after it is released is known as the 2055<firstterm>BounceKeys delay</firstterm>. 2056<emphasis>BounceKeys</emphasis> 2057is a boolean control. 2058</para> 2059 2060 2061<para> 2062When the 2063<emphasis>BounceKeys</emphasis> 2064control is active, the server reports acceptance or rejection of any key to 2065interested clients by sending an appropriate 2066<emphasis>AccessXNotify</emphasis> 2067event (see <link linkend="AccessXNotify_Events">section 10.6.4</link>). 2068</para> 2069 2070 2071<para> 2072There are no convenience functions in Xkb for manipulating this control. The 2073<emphasis>BounceKeys</emphasis> 2074control settings are carried in the 2075<structfield>debounce_delay</structfield> 2076field of an 2077<structname>XkbControlsRec</structname> 2078structure, discussed in <link linkend="The_XkbControlsRec_Structure">section 10.8</link>. 2079</para> 2080 2081</sect2> 2082<sect2 id='The_StickyKeys_Control'> 2083<title>The StickyKeys Control</title> 2084 2085<para> 2086Some people find it difficult or even impossible to press two keys at once. For 2087example, a one-fingered typist or someone using a mouth stick cannot press the 2088<keycap>Shift</keycap> 2089and 2090<keycap>1</keycap> 2091keys at the same time. The 2092<emphasis>StickyKeys</emphasis> 2093control solves this problem by changing the behavior of the modifier keys. 2094With 2095<emphasis>StickyKeys</emphasis>, 2096the user can first press a modifier, release it, then press another key. For 2097example, to get an exclamation point on a PC-style keyboard, the user can press 2098the 2099<keycap>Shift</keycap> 2100key, release it, and then press the 2101<keycap>1</keycap> 2102key. 2103</para> 2104 2105 2106<para> 2107<emphasis>StickyKeys</emphasis> 2108also allows users to lock modifier keys without requiring special locking 2109keys. When 2110<emphasis>StickyKeys</emphasis> 2111is enabled, a modifier is latched when the user presses it just once. The user 2112can press a modifier twice in a row to lock it, and then unlock it by pressing 2113it one more time. 2114</para> 2115 2116 2117<para> 2118When a modifier is latched, it becomes unlatched when the user presses a 2119nonmodifier key or a pointer button. For instance, to enter the sequence 2120<keycombo> 2121<keycap>Shift</keycap> 2122<keycap>Control</keycap> 2123<keycap>Z</keycap> 2124</keycombo> 2125the user could press and release the 2126<keycap>Shift</keycap> 2127key to latch it, then press and release the 2128<keycap>Control</keycap> 2129key to latch it, and finally press and release the 2130<keycap>Z</keycap> key. Because the 2131<keycap>Control</keycap> 2132key is a modifier key, pressing it does not unlatch the 2133<keycap>Shift</keycap> 2134key. Thus, after the user presses the 2135<keycap>Control</keycap> 2136key, both the 2137<symbol>Shift</symbol> 2138and 2139<symbol>Control</symbol> 2140modifiers are latched. When the user presses the 2141<keycap>Z</keycap> 2142key, the effect is as though the user had pressed 2143<keycombo> 2144<keycap>Shift</keycap> 2145<keycap>Control</keycap> 2146<keycap>Z</keycap> 2147</keycombo>. 2148In addition, because the 2149<keycap>Z</keycap> 2150key is not a modifier key, the 2151<symbol>Shift</symbol> 2152and 2153<symbol>Control</symbol> 2154modifiers are unlatched. 2155</para> 2156 2157 2158<para> 2159Locking a modifier key means that the modifier affects any key or pointer 2160button the user presses until the user unlocks it or it is unlocked 2161programmatically. For example, to enter the sequence ("XKB") on a keyboard 2162where ‘(’ is a shifted ‘9’, ‘)’ is a shifted ‘0’, and ‘"’ 2163is a shifted single quote, the user could press and release the 2164<keycap>Shift</keycap> 2165key twice to lock the 2166<symbol>Shift</symbol> 2167modifier. Then, when the user presses the 2168<keycap>9</keycap>, 2169<keycap>'</keycap>, 2170<keycap>x</keycap>, 2171<keycap>k</keycap>, 2172<keycap>b</keycap>, 2173<keycap>'</keycap>, 2174and 2175<keycap>0</keycap> 2176keys in sequence, it generates ("XKB"). To unlock the 2177<symbol>Shift</symbol> 2178modifier, the user can press and release the 2179<keycap>Shift</keycap> 2180key. 2181</para> 2182 2183 2184<para> 2185<emphasis>StickyKeys</emphasis> 2186is a boolean control with two separate attributes that may be individually 2187configured: one to automatically disable it, and one to control the latching 2188behavior of modifier keys. 2189</para> 2190 2191<sect3 id='StickyKeys_Options'> 2192<title>StickyKeys Options</title> 2193 2194<para> 2195The 2196<emphasis>StickyKeys</emphasis> 2197control has two options that can be accessed via the 2198<structfield>ax_options</structfield> 2199of an 2200<structname>XkbControlsRec</structname> 2201structure (see <link linkend="The_XkbControlsRec_Structure">section 10.8</link>). The first option, 2202<emphasis>TwoKeys</emphasis>, 2203specifies whether 2204<emphasis>StickyKeys</emphasis> 2205should automatically turn off when two keys are pressed at the same time. This 2206feature is useful for shared computers so people who do not want them do not 2207need to turn 2208<emphasis>StickyKeys</emphasis> 2209off if a previous user left 2210<emphasis>StickyKeys</emphasis> 2211on. The second option, 2212<emphasis>LatchToLock</emphasis>, 2213specifies whether or not 2214<emphasis>StickyKeys</emphasis> 2215locks a modifier when pressed twice in a row. 2216</para> 2217 2218<para> 2219There are no convenience functions in Xkb for manipulating this control. The 2220<emphasis>StickyKeys</emphasis> 2221control settings are carried in the 2222<structfield>ax_options</structfield> 2223field of an 2224<structname>XkbControlsRec</structname> 2225structure, discussed in <link linkend="The_XkbControlsRec_Structure">section 10.8</link>. 2226</para> 2227 2228</sect3> 2229</sect2> 2230</sect1> 2231<sect1 id='Controls_for_General_Keyboard_Mapping'> 2232<title>Controls for General Keyboard Mapping</title> 2233 2234<para> 2235There are several controls that apply to the keyboard mapping in general. They 2236control handling of out-of-range group indices and how modifiers are processed 2237and consumed in the server. These are: 2238 2239 <simplelist type='vert' columns='1'> 2240 <member><emphasis>GroupsWrap</emphasis></member> 2241 <member><emphasis>IgnoreGroupLock</emphasis></member> 2242 <member><emphasis>IgnoreLockMods</emphasis></member> 2243 <member><emphasis>InternalMods</emphasis></member> 2244 </simplelist> 2245</para> 2246 2247<para> 2248<emphasis>IgnoreGroupLock</emphasis> 2249is a boolean control; the rest are always active. 2250</para> 2251 2252 2253<para> 2254Without the modifier processing options provided by Xkb, passive grabs set via 2255translations in a client (for example, 2256<emphasis>Alt<KeyPress>space</emphasis>) 2257do not trigger if any modifiers other than those specified by the translation 2258are set. This results in problems in the user interface when either 2259<emphasis>NumLock</emphasis> 2260or a secondary keyboard group is active. The 2261<emphasis>IgnoreLockMods</emphasis> 2262and 2263<emphasis>IgnoreGroupLock</emphasis> 2264controls make it possible to avoid this behavior without exhaustively 2265specifying a grab for every possible modifier combination. 2266</para> 2267 2268<sect2 id='The_GroupsWrap_Control'> 2269<title>The GroupsWrap Control</title> 2270 2271<para> 2272The 2273<emphasis>GroupsWrap</emphasis> 2274control determines how illegal groups are handled on a global basis. There are 2275a number of valid keyboard sequences that can cause the effective group number 2276to go out of range. When this happens, the group must be normalized back to a 2277valid number. The 2278<emphasis>GroupsWrap</emphasis> 2279control specifies how this is done. 2280</para> 2281 2282 2283<para> 2284When dealing with group numbers, all computations are done using the group 2285index, which is the group number minus one. There are three different 2286algorithms; the 2287<emphasis>GroupsWrap</emphasis> 2288control specifies which one is used: 2289</para> 2290 2291<itemizedlist> 2292<listitem> 2293 <para>XkbRedirectIntoRange</para> 2294 <para> 2295All invalid group numbers are converted to a valid group number by taking the 2296last four bits of the 2297<emphasis>GroupsWrap</emphasis> 2298control and using them as the group index. If the result is still out of 2299range, Group one is used. 2300 </para> 2301</listitem> 2302<listitem> 2303 <para> 2304XkbClampIntoRange 2305 </para> 2306 <para> 2307All invalid group numbers are converted to the nearest valid group number. 2308Group numbers larger than the highest supported group number are mapped to the 2309highest supported group; those less than one are mapped to group one. 2310 </para> 2311</listitem> 2312<listitem> 2313 <para>XkbWrapIntoRange</para> 2314 <para> 2315All invalid group numbers are converted to a valid group number using integer 2316modulus applied to the group index. 2317 </para> 2318</listitem> 2319</itemizedlist> 2320 2321<para> 2322There are no convenience functions for manipulating the 2323<emphasis>GroupsWrap</emphasis> 2324control. Manipulate the 2325<emphasis>GroupsWrap</emphasis> 2326control via the 2327<structfield>groups_wrap</structfield> 2328field in the 2329<structname>XkbControlsRec</structname> 2330structure, then use 2331<function>XkbSetControls</function> 2332and 2333<function>XkbGetControls</function> 2334(see <link linkend="Querying_Controls">section 10.9</link> and <link linkend="Changing_Controls">section 10.10</link>) to query and change this control. 2335</para> 2336 2337<note><para>See also <link linkend="Per_Key_Group_Information">section 15.3.2</link> or a discussion of the related field, 2338<structfield>group_info</structfield>, 2339which also normalizes a group under certain circumstances.</para></note> 2340 2341</sect2> 2342<sect2 id='The_IgnoreLockMods_Control'> 2343<title>The IgnoreLockMods Control</title> 2344 2345<para> 2346The core protocol does not provide a way to exclude specific modifiers from 2347grab calculations, with the result that locking modifiers sometimes have 2348unanticipated side effects. 2349</para> 2350 2351 2352<para> 2353The 2354<emphasis>IgnoreLockMods</emphasis> 2355control specifies modifiers that should be excluded from grab calculations. 2356These modifiers are also not reported in any core events except 2357<symbol>KeyPress</symbol> 2358and 2359<symbol>KeyRelease</symbol> 2360events that do not activate a passive grab and that do not occur while a grab 2361is active. 2362</para> 2363 2364 2365<para> 2366Manipulate the 2367<emphasis>IgnoreLockMods</emphasis> 2368control via the 2369<structfield>ignore_lock</structfield> 2370field in the 2371<structname>XkbControlsRec</structname> 2372structure, then use 2373<function>XkbSetControls</function> 2374and 2375<function>XkbGetControls</function> 2376(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, 2377use 2378<function>XkbSetIgnoreLockMods</function>. 2379</para> 2380 2381 2382<para> 2383To set the modifiers that, if locked, are not to be reported in matching events 2384to passive grabs, use 2385<function>XkbSetIgnoreLockMods</function>. 2386</para> 2387 2388<indexterm significance="preferred" zone="XkbSetIgnoreLockMods"><primary><function>XkbSetIgnoreLockMods</function></primary></indexterm> 2389<funcsynopsis id="XkbSetIgnoreLockMods"> 2390 <funcprototype> 2391 <funcdef>Bool <function>XkbSetIgnoreLockMods</function></funcdef> 2392<!-- ( 2393<parameter>display, device_spec, affect_real, real_values, affect_virtual, 2394virtual_values</parameter> 2395) --> 2396 2397 <paramdef>Display *<parameter>display</parameter></paramdef> 2398 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2399 <paramdef>unsigned int <parameter>affect_real</parameter></paramdef> 2400 <paramdef>unsigned int <parameter>real_values</parameter></paramdef> 2401 <paramdef>unsigned int <parameter>affect_virtual</parameter></paramdef> 2402 <paramdef>unsigned int <parameter>virtual_values</parameter></paramdef> 2403 </funcprototype> 2404</funcsynopsis> 2405<variablelist> 2406 <varlistentry> 2407 <term> 2408 <parameter>display</parameter> 2409 </term> 2410 <listitem> 2411 <para> 2412 connection to the X server 2413 </para> 2414 </listitem> 2415 </varlistentry> 2416 <varlistentry> 2417 <term> 2418 <parameter>device_spec</parameter> 2419 </term> 2420 <listitem> 2421 <para> 2422 device ID, or <symbol>XkbUseCoreKbd</symbol> 2423 </para> 2424 </listitem> 2425 </varlistentry> 2426 <varlistentry> 2427 <term> 2428 <parameter>affect_real</parameter> 2429 </term> 2430 <listitem> 2431 <para> 2432 mask of real modifiers affected by this call 2433 </para> 2434 </listitem> 2435 </varlistentry> 2436 <varlistentry> 2437 <term> 2438 <parameter>real_values</parameter> 2439 </term> 2440 <listitem> 2441 <para> 2442 values for affected real modifiers (1⇒set, 0⇒unset) 2443 </para> 2444 </listitem> 2445 </varlistentry> 2446 <varlistentry> 2447 <term> 2448 <parameter>affect_virtual</parameter> 2449 </term> 2450 <listitem> 2451 <para> 2452 mask of virtual modifiers affected by this call 2453 </para> 2454 </listitem> 2455 </varlistentry> 2456 <varlistentry> 2457 <term> 2458 <parameter>virtual_values</parameter> 2459 </term> 2460 <listitem> 2461 <para> 2462 values for affected virtual modifiers (1⇒set, 0⇒unset) 2463 </para> 2464 </listitem> 2465 </varlistentry> 2466</variablelist> 2467 2468<para> 2469<function>XkbSetIgnoreLockMods</function> 2470sends a request to the server to change the server’s 2471<emphasis>IgnoreLockMods</emphasis> 2472control. 2473<parameter>affect_real</parameter> 2474and 2475<parameter>real_values</parameter> 2476are masks of real modifier bits indicating which real modifiers are to be 2477added and removed from the server’s 2478<emphasis>IgnoreLockMods</emphasis> 2479control. Modifiers selected by both 2480<parameter>affect_real</parameter> 2481and 2482<parameter>real_values</parameter> 2483are added to the server’s 2484<emphasis>IgnoreLockMods</emphasis> 2485control; those selected by 2486<parameter>affect_real</parameter> 2487but not by 2488<parameter>real_values</parameter> 2489are removed from the server’s 2490<emphasis>IgnoreLockMods</emphasis> 2491control. Valid values for 2492<parameter>affect_real</parameter> 2493and 2494<parameter>real_values</parameter> 2495consist of any combination of the eight core modifier bits: 2496<symbol>ShiftMask</symbol>, 2497<symbol>LockMask</symbol>, 2498<symbol>ControlMask</symbol>, 2499<symbol>Mod1Mask</symbol> 2500– 2501<symbol>Mod5Mask</symbol>. 2502<parameter>affect_virtual</parameter> 2503and 2504<parameter>virtual_values</parameter> 2505are masks of virtual modifier bits indicating which virtual modifiers are to 2506be added and removed from the server’s 2507<emphasis>IgnoreLockMods</emphasis> 2508control. Modifiers selected by both 2509<parameter>affect_virtual</parameter> 2510and 2511<parameter>virtual_values</parameter> 2512are added to the server’s 2513<emphasis>IgnoreLockMods</emphasis> 2514control; those selected by 2515<parameter>affect_virtual</parameter> 2516but not by 2517<parameter>virtual_values</parameter> 2518are removed from the server’s 2519<emphasis>IgnoreLockMods</emphasis> 2520control. 2521See <link linkend="Virtual_Modifier_Names_and_Masks">section 7.1</link> for a discussion of virtual modifier masks to use in 2522<parameter>affect_virtual</parameter> 2523and 2524<parameter>virtual_values</parameter>. 2525<function>XkbSetIgnoreLockMods</function> 2526does not wait for a reply from the server. It returns 2527<symbol>True</symbol> 2528if the request was sent, and 2529<symbol>False</symbol> 2530otherwise. 2531</para> 2532 2533</sect2> 2534<sect2 id='The_IgnoreGroupLock_Control'> 2535<title>The IgnoreGroupLock Control</title> 2536 2537<para> 2538The 2539<emphasis>IgnoreGroupLock</emphasis> 2540control is a boolean control with no attributes. If enabled, it specifies that 2541the locked state of the keyboard group should not be considered when activating 2542passive grabs. 2543</para> 2544 2545<para> 2546Because 2547<emphasis>IgnoreGroupLock</emphasis> 2548is a boolean control with no attributes, use the general boolean controls 2549functions (see <link linkend="Controls_that_Enable_and_Disable_Other_Controls">section 10.1</link>) to change its state. 2550</para> 2551 2552 2553</sect2> 2554<sect2 id='The_InternalMods_Control'> 2555<title>The InternalMods Control</title> 2556 2557<para> 2558The core protocol does not provide any means to prevent a modifier from being 2559reported in events sent to clients; Xkb, however makes this possible via the 2560<emphasis>InternalMods</emphasis> 2561control. It specifies modifiers that should be consumed by the server and not 2562reported to clients. When a key is pressed and a modifier that has its bit set 2563in the 2564<emphasis>InternalMods</emphasis> 2565control is reported to the server, the server uses the modifier when 2566determining the actions to apply for the key. The server then clears the bit, 2567so it is not actually reported to the client. In addition, modifiers specified 2568in the 2569<emphasis>InternalMods</emphasis> 2570control are not used to determine grabs and are not used to calculate core 2571protocol compatibility state. 2572</para> 2573 2574 2575<para> 2576Manipulate the 2577<emphasis>InternalMods</emphasis> 2578control via the 2579<structfield>internal</structfield> 2580field in the 2581<structname>XkbControlsRec</structname> 2582structure, using 2583<function>XkbSetControls</function> 2584and 2585<function>XkbGetControls</function> 2586(see <link linkend="Querying_Controls">section 10.9</link> 2587and <link linkend="Changing_Controls">section 10.10</link>). Alternatively, use 2588<function>XkbSetServerInternalMods</function>. 2589</para> 2590 2591 2592<para> 2593To set the modifiers that are consumed by the server before events are 2594delivered to the client, use 2595<function>XkbSetServerInternalMods</function>. 2596</para> 2597 2598<indexterm significance="preferred" zone="XkbSetServerInternalMods"><primary><function>XkbSetServerInternalMods</function></primary></indexterm> 2599<funcsynopsis id="XkbSetServerInternalMods"> 2600 <funcprototype> 2601 <funcdef>Bool <function>XkbSetServerInternalMods</function></funcdef> 2602<!-- ( 2603<parameter>display, device_spec, affect_real, real_values, affect_virtual, 2604virtual_values</parameter> 2605) --> 2606 2607 <paramdef>Display *<parameter>display</parameter></paramdef> 2608 <paramdef>unsigned int <parameter>device_spec</parameter></paramdef> 2609 <paramdef>unsigned int <parameter>affect_real</parameter></paramdef> 2610 <paramdef>unsigned int <parameter>real_values</parameter></paramdef> 2611 <paramdef>unsigned int <parameter>affect_virtual</parameter></paramdef> 2612 <paramdef>unsigned int <parameter>virtual_values</parameter></paramdef> 2613 </funcprototype> 2614</funcsynopsis> 2615<variablelist> 2616 <varlistentry> 2617 <term> 2618 <parameter>display</parameter> 2619 </term> 2620 <listitem> 2621 <para> 2622 connection to the X server 2623 </para> 2624 </listitem> 2625 </varlistentry> 2626 <varlistentry> 2627 <term> 2628 <parameter>device_spec</parameter> 2629 </term> 2630 <listitem> 2631 <para> 2632 ‘device ID, or <symbol>XkbUseCoreKbd</symbol> 2633 </para> 2634 </listitem> 2635 </varlistentry> 2636 <varlistentry> 2637 <term> 2638 <parameter>affect_real</parameter> 2639 </term> 2640 <listitem> 2641 <para> 2642 mask of real modifiers affected by this call 2643 </para> 2644 </listitem> 2645 </varlistentry> 2646 <varlistentry> 2647 <term> 2648 <parameter>real_values</parameter> 2649 </term> 2650 <listitem> 2651 <para> 2652 values for affected real modifiers (1⇒set, 0⇒unset) 2653 </para> 2654 </listitem> 2655 </varlistentry> 2656 <varlistentry> 2657 <term> 2658 <parameter>affect_virtual</parameter> 2659 </term> 2660 <listitem> 2661 <para> 2662 mask of virtual modifiers affected by this call 2663 </para> 2664 </listitem> 2665 </varlistentry> 2666 <varlistentry> 2667 <term> 2668 <parameter>virtual_values</parameter> 2669 </term> 2670 <listitem> 2671 <para> 2672 values for affected virtual modifiers (1⇒set, 0⇒unset) 2673 </para> 2674 </listitem> 2675 </varlistentry> 2676</variablelist> 2677 2678<para> 2679<function>XkbSetServerInternalMods</function> 2680sends a request to the server to change the internal modifiers consumed by the 2681server. 2682<parameter>affect_real</parameter> 2683and 2684<parameter>real_values</parameter> 2685are masks of real modifier bits indicating which real modifiers are to be 2686added and removed from the server’s internal modifiers control. Modifiers 2687selected by both 2688<parameter>affect_real</parameter> 2689and 2690<parameter>real_values</parameter> 2691are added to the server’s internal modifiers control; those selected by 2692<parameter>affect_real</parameter> 2693but not by 2694<parameter>real_values</parameter> 2695are removed from the server’s internal modifiers mask. Valid values for 2696<parameter>affect_real</parameter> 2697and 2698<parameter>real_values</parameter> 2699consist of any combination of the eight core modifier bits: 2700<symbol>ShiftMask</symbol>, 2701<symbol>LockMask</symbol>, 2702<symbol>ControlMask</symbol>, 2703<symbol>Mod1Mask</symbol> 2704– 2705<symbol>Mod5Mask</symbol>. 2706<parameter>affect_virtual</parameter> 2707and 2708<parameter>virtual_values</parameter> 2709are masks of virtual modifier bits indicating which virtual modifiers are to 2710be added and removed from the server’s internal modifiers control. Modifiers 2711selected by both 2712<parameter>affect_virtual</parameter> 2713and 2714<parameter>virtual_values</parameter> 2715are added to the server’s internal modifiers control; those selected by 2716<parameter>affect_virtual</parameter> 2717but not by 2718<parameter>virtual_values</parameter> 2719are removed from the server’s internal modifiers control. 2720See <link linkend="Virtual_Modifier_Names_and_Masks">section 7.1</link> for a discussion of virtual modifier masks to use in 2721<parameter>affect_virtual</parameter> 2722and 2723<parameter>virtual_values</parameter>. 2724<function>XkbSetServerInternalMods</function> 2725does not wait for a reply from the server. It returns 2726<symbol>True</symbol> 2727if the request was sent and 2728<symbol>False</symbol> 2729otherwise. 2730</para> 2731 2732 2733</sect2> 2734</sect1> 2735<sect1 id='The_XkbControlsRec_Structure'> 2736<title>The XkbControlsRec Structure</title> 2737 2738<indexterm significance="preferred" zone="The_XkbControlsRec_Structure"> 2739<primary><structname>XkbControlsRec</structname></primary></indexterm> 2740 2741<para> 2742Many of the individual controls described in sections 10.1 through 10.7 may be 2743manipulated via convenience functions discussed in those sections. Some of 2744them, however, have no convenience functions. The 2745<structname>XkbControlsRec</structname> 2746structure allows the manipulation of one or more of the controls in a single 2747operation and to track changes to any of them in conjunction with the 2748<function>XkbGetControls</function> 2749and 2750<function>XkbSetControls</function> 2751functions. This is the only way to manipulate those controls that have no 2752convenience functions. 2753</para> 2754 2755 2756<para> 2757The 2758<structname>XkbControlsRec</structname> 2759structure is defined as follows: 2760 2761<programlisting> 2762#define XkbMaxLegalKeyCode 255 2763#define XkbPerKeyBitArraySize ((XkbMaxLegalKeyCode+1)/8) 2764 2765typedef struct { 2766 unsigned char mk_dflt_btn; /* default button for 2767 keyboard driven mouse */ 2768 unsigned char num_groups; /* number of keyboard groups */ 2769 unsigned char groups_wrap; /* how to wrap out-of-bounds groups */ 2770 XkbModsRec internal; /* defines server internal modifiers */ 2771 XkbModsRec ignore_lock; /* modifiers to ignore when 2772 checking for grab */ 2773 unsigned int enabled_ctrls; /* 1 bit ⇒ corresponding 2774 boolean control enabled */ 2775 unsigned short repeat_delay; /* ms delay until first repeat */ 2776 unsigned short repeat_interval; /* ms delay between repeats */ 2777 unsigned short slow_keys_delay; /* ms minimum time key must be 2778 down to be ok */ 2779 unsigned short debounce_delay; /* ms delay before key reactivated */ 2780 unsigned short mk_delay; /* ms delay to second mouse 2781 motion event */ 2782 unsigned short mk_interval; /* ms delay between repeat mouse 2783 events */ 2784 unsigned short mk_time_to_max; /* # intervals until constant 2785 mouse move */ 2786 unsigned short mk_max_speed; /* multiplier for maximum mouse speed */ 2787 short mk_curve; /* determines mouse move curve type */ 2788 unsigned short ax_options; /* 1 bit ⇒ Access X option enabled */ 2789 unsigned short ax_timeout; /* seconds until Access X disabled */ 2790 unsigned short axt_opts_mask; /* 1 bit ⇒ options to reset 2791 on Access X timeout */ 2792 unsigned short axt_opts_values; /* 1 bit ⇒ turn option on, 0⇒ off */ 2793 unsigned int axt_ctrls_mask; /* which bits in <structfield>enabled_ctrls</structfield> 2794 to modify */ 2795 unsigned int axt_ctrls_values; /* values for new bits in 2796 <structfield>enabled_ctrls</structfield> */ 2797 unsigned char per_key_repeat[XkbPerKeyBitArraySize]; 2798 /* per key auto repeat */ 2799} <structname>XkbControlsRec</structname>, *XkbControlsPtr; 2800</programlisting> 2801</para> 2802 2803<para> 2804The general-purpose functions that work with the 2805<structname>XkbControlsRec</structname> 2806structure use a mask to specify which controls are to be manipulated. 2807<link linkend="table10.6">Table 10.6</link> 2808lists these controls, the masks used to select them in the general 2809function calls 2810(<structfield>which</structfield> 2811parameter), and the data fields in the 2812<structname>XkbControlsRec</structname> 2813structure that comprise each of the individual controls. Also listed are the 2814bit used to turn boolean controls on and off and the section where each control 2815is described in more detail. 2816</para> 2817 2818<table id='table10.6' frame='topbot'> 2819<title>Xkb Controls</title> 2820<?dbfo keep-together="auto" ?> 2821<tgroup cols='5' align='left' colsep='0' rowsep='0'> 2822<colspec colname='c1' colwidth='2.0*'/> 2823<colspec colname='c2' colwidth='3.1*'/> 2824<colspec colname='c3' colwidth='2.2*'/> 2825<colspec colname='c4' colwidth='2.6*'/> 2826<colspec colname='c5' colwidth='1.0*'/> 2827<thead> 2828<row rowsep='1'> 2829 <entry>Control</entry> 2830 <entry>Control Selection Mask (which parameter)</entry> 2831 <entry>Relevant XkbControlsRec Data Fields</entry> 2832 <entry>Boolean Control enabled_ctrls bit</entry> 2833 <entry>Section</entry> 2834 </row> 2835</thead> 2836<tbody> 2837 <row> 2838 <entry>AccessXFeedback</entry> 2839 <entry><symbol>XkbAccessXFeedbackMask</symbol></entry> 2840 <entry>ax_options: XkbAX_*FBMask</entry> 2841 <entry>XkbAccessXFeedback­Mask</entry> 2842 <entry><link linkend="The_AccessXFeedback_Control">10.6.3</link></entry> 2843 </row> 2844 <row> 2845 <entry>AccessXKeys</entry> 2846 <entry></entry> 2847 <entry></entry> 2848 <entry>XkbAccessXKeys­Mask</entry> 2849 <entry><link linkend="The_AccessXKeys_Control">10.6.1</link></entry> 2850 </row> 2851 <row> 2852 <entry>AccessXTimeout</entry> 2853 <entry><symbol>XkbAccessXTimeoutMask</symbol></entry> 2854 <entry> 2855 <para>ax_timeout</para> 2856 <para>axt_opts_mask</para> 2857 <para>axt_opts_values</para> 2858 <para>axt_ctrls_mask</para> 2859 <para>axt_ctrls_values</para> 2860 </entry> 2861 <entry>XkbAccessXTimeout­Mask</entry> 2862 <entry><link linkend="The_AccessXTimeout_Control">10.6.2</link></entry> 2863 </row> 2864 <row> 2865 <entry>AudibleBell</entry> 2866 <entry></entry> 2867 <entry></entry> 2868 <entry><symbol>XkbAudibleBellMask</symbol></entry> 2869 <entry><link linkend="Audible_Bells">9.2</link></entry> 2870 </row> 2871 <row> 2872 <entry>AutoReset</entry> 2873 <entry></entry> 2874 <entry></entry> 2875 <entry></entry> 2876 <entry><link linkend="The_AutoReset_Control">10.1.2</link></entry> 2877 </row> 2878 <row> 2879 <entry>BounceKeys</entry> 2880 <entry><symbol>XkbBounceKeysMask</symbol></entry> 2881 <entry>debounce_delay</entry> 2882 <entry><symbol>XkbBounceKeysMask</symbol></entry> 2883 <entry><link linkend="The_BounceKeys_Control">10.6.7</link></entry> 2884 </row> 2885 <row> 2886 <entry>Detectable-Autorepeat</entry> 2887 <entry></entry> 2888 <entry></entry> 2889 <entry></entry> 2890 <entry><link linkend="The_DetectableAutorepeat_Control">10.3.3</link></entry> 2891 </row> 2892 <row> 2893 <entry>EnabledControls</entry> 2894 <entry><symbol>XkbControlsEnabledMask</symbol></entry> 2895 <entry>enabled_ctrls</entry> 2896 <entry><emphasis>Non-Boolean Control</emphasis></entry> 2897 <entry><link linkend="The_EnabledControls_Control">10.1.1</link></entry> 2898 </row> 2899 <row> 2900 <entry>GroupsWrap</entry> 2901 <entry><symbol>XkbGroupsWrapMask</symbol></entry> 2902 <entry>groups_wrap</entry> 2903 <entry><emphasis>Non-Boolean Control</emphasis></entry> 2904 <entry><link linkend="The_GroupsWrap_Control">10.7.1</link></entry> 2905 </row> 2906 <row> 2907 <entry>IgnoreGroupLock</entry> 2908 <entry></entry> 2909 <entry></entry> 2910 <entry>XkbIgnoreGroupLock­Mask</entry> 2911 <entry><link linkend="The_IgnoreGroupLock_Control">10.7.3</link></entry> 2912 </row> 2913 <row> 2914 <entry>IgnoreLockMods</entry> 2915 <entry><symbol>XkbIgnoreLockModsMask</symbol></entry> 2916 <entry>ignore_lock</entry> 2917 <entry><emphasis>Non-Boolean Control</emphasis></entry> 2918 <entry><link linkend="Keyboard_State_Description">5.1</link></entry> 2919 </row> 2920 <row> 2921 <entry>InternalMods</entry> 2922 <entry><symbol>XkbInternalModsMask</symbol></entry> 2923 <entry>internal</entry> 2924 <entry><emphasis>Non-Boolean Control</emphasis></entry> 2925 <entry><link linkend="Keyboard_State_Description">5.1</link></entry> 2926 </row> 2927 <row> 2928 <entry>MouseKeys</entry> 2929 <entry><symbol>XkbMouseKeysMask</symbol></entry> 2930 <entry>mk_dflt_btn</entry> 2931 <entry><symbol>XkbMouseKeysMask</symbol></entry> 2932 <entry><link linkend="The_MouseKeys_Control">10.5.1</link></entry> 2933 </row> 2934 <row> 2935 <entry>MouseKeysAccel</entry> 2936 <entry><symbol>XkbMouseKeysAccelMask</symbol></entry> 2937 <entry> 2938 <para>mk_delay</para> 2939 <para>mk_interval</para> 2940 <para>mk_time_to_max</para> 2941 <para>mk_max_speed</para> 2942 <para>mk_curve</para> 2943 </entry> 2944 <entry>XkbMouseKeysAccel­Mask</entry> 2945 <entry><link linkend="The_MouseKeysAccel_Control">10.5.2</link></entry> 2946 </row> 2947 <row> 2948 <entry>Overlay1</entry> 2949 <entry></entry> 2950 <entry></entry> 2951 <entry><symbol>XkbOverlay1Mask</symbol></entry> 2952 <entry><link linkend="Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls">10.4</link></entry> 2953 </row> 2954 <row> 2955 <entry>Overlay2</entry> 2956 <entry></entry> 2957 <entry></entry> 2958 <entry><symbol>XkbOverlay2Mask</symbol></entry> 2959 <entry><link linkend="Controls_for_Keyboard_Overlays_Overlay1_and_Overlay2_Controls">10.4</link></entry> 2960 </row> 2961 <row> 2962 <entry>PerKeyRepeat</entry> 2963 <entry><symbol>XkbPerKeyRepeatMask</symbol></entry> 2964 <entry>per_key_repeat</entry> 2965 <entry><emphasis>Non-Boolean Control</emphasis></entry> 2966 <entry><link linkend="The_PerKeyRepeat_Control">10.3.1</link></entry> 2967 </row> 2968 <row> 2969 <entry>RepeatKeys</entry> 2970 <entry><symbol>XkbRepeatKeysMask</symbol></entry> 2971 <entry> 2972 <para>repeat_delay</para> 2973 <para>repeat_interval</para> 2974 </entry> 2975 <entry><symbol>XkbRepeatKeysMask</symbol></entry> 2976 <entry><link linkend="Controls_for_Repeat_Key_Behavior">10.3</link></entry> 2977 </row> 2978 <row> 2979 <entry>SlowKeys</entry> 2980 <entry><symbol>XkbSlowKeysMask</symbol></entry> 2981 <entry>slow_keys_delay</entry> 2982 <entry><symbol>XkbSlowKeysMask</symbol></entry> 2983 <entry><link linkend="The_SlowKeys_Control">10.6.6</link></entry> 2984 </row> 2985 <row> 2986 <entry>StickyKeys</entry> 2987 <entry><symbol>XkbStickyKeysMask</symbol></entry> 2988 <entry> 2989 <para>ax_options:</para> 2990 <para>XkbAX_Two­KeysMask</para> 2991 <para>XkbAX_Latch­ToLockMask</para> 2992 </entry> 2993 <entry><symbol>XkbStickyKeysMask</symbol></entry> 2994 <entry><link linkend="The_StickyKeys_Control">10.6.8</link></entry> 2995 </row> 2996</tbody> 2997</tgroup> 2998</table> 2999 3000<para> 3001<link linkend="table10.7">Table 10.7</link> 3002shows the actual values for the individual mask bits used to select 3003controls for modification and to enable and disable the control. Note that the 3004same mask bit is used to specify general modifications to the parameters used 3005to configure the control 3006(<structfield>which</structfield>), 3007and to enable and disable the control 3008(<structfield>enabled_ctrls</structfield>). 3009The anomalies in the table (no <quote>ok</quote> in column) are for controls that have no 3010configurable attributes; and for controls that are not boolean controls and 3011therefore cannot be enabled or disabled. 3012</para> 3013 3014<table id='table10.7' frame='topbot'> 3015<title>Controls Mask Bits</title> 3016<?dbfo keep-together="always" ?> 3017<tgroup cols='4' align='left' colsep='0' rowsep='0'> 3018<colspec colname='c1' colwidth='2.6*'/> 3019<colspec colname='c2' colwidth='2.0*'/> 3020<colspec colname='c3' colwidth='1.3*'/> 3021<colspec colname='c4' colwidth='2.0*'/> 3022<thead> 3023<row rowsep='1'> 3024 <entry>Mask Bit</entry> 3025 <entry>which or changed_ctrls</entry> 3026 <entry>enabled_ctrls</entry> 3027 <entry>Value</entry> 3028</row> 3029</thead> 3030<tbody> 3031<row> 3032 <entry><symbol>XkbRepeatKeysMask</symbol></entry> 3033 <entry>ok</entry> 3034 <entry>ok</entry> 3035 <entry>(1L<<0)</entry> 3036 </row> 3037 <row> 3038 <entry><symbol>XkbSlowKeysMask</symbol></entry> 3039 <entry>ok</entry> 3040 <entry>ok</entry> 3041 <entry>(1L<<1)</entry> 3042 </row> 3043 <row> 3044 <entry><symbol>XkbBounceKeysMask</symbol></entry> 3045 <entry>ok</entry> 3046 <entry>ok</entry> 3047 <entry>(1L<<2)</entry> 3048 </row> 3049 <row> 3050 <entry><symbol>XkbStickyKeysMask</symbol></entry> 3051 <entry>ok</entry> 3052 <entry>ok</entry> 3053 <entry>(1L<<3)</entry> 3054 </row> 3055 <row> 3056 <entry><symbol>XkbMouseKeysMask</symbol></entry> 3057 <entry>ok</entry> 3058 <entry>ok</entry> 3059 <entry>(1L<<4)</entry> 3060 </row> 3061 <row> 3062 <entry><symbol>XkbMouseKeysAccelMask</symbol></entry> 3063 <entry>ok</entry> 3064 <entry>ok</entry> 3065 <entry>(1L<<5)</entry> 3066 </row> 3067 <row> 3068 <entry><symbol>XkbAccessXKeysMask</symbol></entry> 3069 <entry>ok</entry> 3070 <entry>ok</entry> 3071 <entry>(1L<<6)</entry> 3072 </row> 3073 <row> 3074 <entry><symbol>XkbAccessXTimeoutMask</symbol></entry> 3075 <entry>ok</entry> 3076 <entry>ok</entry> 3077 <entry>(1L<<7)</entry> 3078 </row> 3079 <row> 3080 <entry><symbol>XkbAccessXFeedbackMask</symbol></entry> 3081 <entry>ok</entry> 3082 <entry>ok</entry> 3083 <entry>(1L<<8)</entry> 3084 </row> 3085 <row> 3086 <entry><symbol>XkbAudibleBellMask</symbol></entry> 3087 <entry></entry> 3088 <entry>ok</entry> 3089 <entry>(1L<<9)</entry> 3090 </row> 3091 <row> 3092 <entry><symbol>XkbOverlay1Mask</symbol></entry> 3093 <entry></entry> 3094 <entry>ok</entry> 3095 <entry>(1L<<10)</entry> 3096 </row> 3097 <row> 3098 <entry><symbol>XkbOverlay2Mask</symbol></entry> 3099 <entry></entry> 3100 <entry>ok</entry> 3101 <entry>(1L<<11)</entry> 3102 </row> 3103 <row> 3104 <entry><symbol>XkbIgnoreGroupLockMask</symbol></entry> 3105 <entry></entry> 3106 <entry>ok</entry> 3107 <entry>(1L<<12)</entry> 3108</row> 3109<row> 3110 <entry><symbol>XkbGroupsWrapMask</symbol></entry> 3111 <entry>ok</entry> 3112 <entry></entry> 3113 <entry>(1L<<27)</entry> 3114</row> 3115<row> 3116 <entry><symbol>XkbInternalModsMask</symbol></entry> 3117 <entry>ok</entry> 3118 <entry></entry> 3119 <entry>(1L<<28)</entry> 3120</row> 3121<row> 3122 <entry><symbol>XkbIgnoreLockModsMask</symbol></entry> 3123 <entry>ok</entry> 3124 <entry></entry> 3125 <entry>(1L<<29)</entry> 3126</row> 3127<row> 3128 <entry><symbol>XkbPerKeyRepeatMask</symbol></entry> 3129 <entry>ok</entry> 3130 <entry></entry> 3131 <entry>(1L<<30)</entry> 3132</row> 3133<row> 3134 <entry><symbol>XkbControlsEnabledMask</symbol></entry> 3135 <entry>ok</entry> 3136 <entry></entry> 3137 <entry>(1L<<31)</entry> 3138</row> 3139<row> 3140 <entry><symbol>XkbAccessXOptionsMask</symbol></entry> 3141 <entry>ok</entry> 3142 <entry>ok</entry> 3143 <entry>(XkbStickyKeysMask | XkbAccessXFeedbackMask)</entry> 3144 </row> 3145 <row> 3146 <entry><symbol>XkbAllBooleanCtrlsMask</symbol></entry> 3147 <entry></entry> 3148 <entry>ok</entry> 3149 <entry>(0x00001FFF) </entry> 3150 </row> 3151 <row> 3152 <entry><symbol>XkbAllControlsMask</symbol></entry> 3153 <entry>ok</entry> 3154 <entry></entry> 3155 <entry>(0xF8001FFF)</entry> 3156 </row> 3157</tbody> 3158</tgroup> 3159</table> 3160 3161<para> 3162The individual fields of the 3163<structname>XkbControlsRec</structname> 3164structure are defined as follows. 3165</para> 3166 3167<sect2> 3168<title/> 3169<sect3 id='mk_dflt_btn'> 3170<title>mk_dflt_btn</title> 3171 3172<para> 3173<structfield>mk_dflt_btn</structfield> is an attribute of the 3174<emphasis>MouseKeys</emphasis> 3175control 3176(see <link linkend="Controls_for_Using_the_Mouse_from_the_Keyboard">section 10.5</link>). It 3177specifies the mouse button number to use for keyboard simulated mouse button 3178operations. Its value should be one of the core symbols 3179<symbol>Button1</symbol> 3180– 3181<symbol>Button5</symbol>. 3182</para> 3183 3184 3185</sect3> 3186<sect3 id='num_groups'> 3187<title>num_groups</title> 3188 3189<para> 3190<structfield>num_groups</structfield> 3191is not a part of any control, but is reported in the 3192<structname>XkbControlsRec</structname> 3193structure whenever any of its components are fetched from the server. It 3194reports the number of groups the particular keyboard configuration uses and is 3195computed automatically by the server whenever the keyboard mapping changes. 3196</para> 3197 3198 3199</sect3> 3200<sect3 id='groups_wrap'> 3201<title>groups_wrap</title> 3202 3203<para> 3204<structfield>groups_wrap</structfield> 3205is an attribute of the 3206<emphasis>GroupsWrap</emphasis> 3207control (see <link linkend="The_GroupsWrap_Control">section 10.7.1</link>). It specifies the handling of illegal groups on a 3208global basis. Valid values for 3209<structfield>groups_wrap</structfield> 3210are shown in <link linkend="table10.8">Table 10.8</link>. 3211</para> 3212 3213<table id='table10.8' frame='topbot'> 3214<title>GroupsWrap options (groups_wrap field)</title> 3215<?dbfo keep-together="always" ?> 3216<tgroup cols='2' align='left' colsep='0' rowsep='0'> 3217<colspec colname='c1' colwidth='1.0*'/> 3218<colspec colname='c2' colwidth='1.0*'/> 3219<thead> 3220<row rowsep='1'> 3221 <entry>groups_wrap symbolic name</entry> 3222 <entry>value</entry> 3223 </row> 3224</thead> 3225<tbody> 3226 <row> 3227 <entry><symbol>XkbWrapIntoRange</symbol></entry> 3228 <entry>(0x00)</entry> 3229 </row> 3230 <row> 3231 <entry><symbol>XkbClampIntoRange</symbol></entry> 3232 <entry>(0x40)</entry> 3233 </row> 3234 <row> 3235 <entry><symbol>XkbRedirectIntoRange</symbol></entry> 3236 <entry>(0x80)</entry> 3237 </row> 3238</tbody> 3239</tgroup> 3240</table> 3241 3242<para> 3243When 3244<structfield>groups_wrap</structfield> 3245is set to 3246<symbol>XkbRedirectIntoRange</symbol>, 3247its four low-order bits specify the index of the group to use. 3248</para> 3249 3250 3251</sect3> 3252<sect3 id='internal'> 3253<title>internal</title> 3254 3255<para> 3256<structfield>internal</structfield> 3257is an attribute of the 3258<emphasis>InternalMods</emphasis> 3259control (see <link linkend="The_InternalMods_Control">section 10.7.4</link>). It specifies modifiers to be consumed in the 3260server and not passed on to clients when events are reported. Valid values 3261consist of any combination of the eight core modifier bits: 3262<symbol>ShiftMask</symbol>, 3263<symbol>LockMask</symbol>, 3264<symbol>ControlMask</symbol>, 3265<symbol>Mod1Mask</symbol> 3266– 3267<symbol>Mod5Mask</symbol>. 3268</para> 3269 3270 3271</sect3> 3272<sect3 id='ignore_lock'> 3273<title>ignore_lock</title> 3274 3275<para> 3276<structfield>ignore_lock</structfield> 3277is an attribute of the 3278<emphasis>IgnoreLockMods</emphasis> 3279control (see <link linkend="The_IgnoreLockMods_Control">section 10.7.2</link>). It specifies modifiers to be ignored in grab 3280calculations. Valid values consist of any combination of the eight core 3281modifier bits: 3282<symbol>ShiftMask</symbol>, 3283<symbol>LockMask</symbol>, 3284<symbol>ControlMask</symbol>, 3285<symbol>Mod1Mask</symbol> 3286– 3287<symbol>Mod5Mask</symbol>. 3288</para> 3289 3290 3291</sect3> 3292<sect3 id='enabled_ctrls'> 3293<title>enabled_ctrls</title> 3294 3295<para> 3296<structfield>enabled_ctrls</structfield> 3297is an attribute of the 3298<emphasis>EnabledControls</emphasis> 3299control (see <link linkend="The_EnabledControls_Control">section 10.1.1</link>). It contains one bit per boolean control. Each 3300bit determines whether the corresponding control is enabled or disabled; a one 3301bit means the control is enabled. The mask bits used to enable these controls 3302are listed in <link linkend="table10.7">Table 10.7</link>, 3303using only those masks with <quote>ok</quote> in the 3304<structfield>enabled_ctrls</structfield> 3305column. 3306</para> 3307 3308 3309</sect3> 3310<sect3 id='repeat_delay_and_repeat_interval'> 3311<title>repeat_delay and repeat_interval</title> 3312 3313<para> 3314<structfield>repeat_delay</structfield> 3315and 3316<structfield>repeat_interval</structfield> 3317are attributes of the 3318<emphasis>RepeatKeys</emphasis> 3319control (see <link linkend="The_RepeatKeys_Control">section 10.3.2</link>). 3320<structfield>repeat_delay</structfield> 3321is the initial delay before a key begins repeating, in milliseconds; 3322<structfield>repeat_interval</structfield> 3323is the delay between subsequent key events, in milliseconds. 3324</para> 3325 3326 3327</sect3> 3328<sect3 id='slow_keys_delay'> 3329<title>slow_keys_delay</title> 3330 3331<para> 3332<structfield>slow_keys_delay</structfield> 3333is an attribute of the 3334<emphasis>SlowKeys</emphasis> 3335control (see <link linkend="The_SlowKeys_Control">section 10.6.6</link>). Its value specifies the 3336<emphasis>SlowKeys</emphasis> 3337acceptance delay period in milliseconds before a key press is accepted by the 3338server. 3339</para> 3340 3341 3342</sect3> 3343<sect3 id='debounce_delay'> 3344<title>debounce_delay</title> 3345 3346<para> 3347<structfield>debounce_delay</structfield> 3348is an attribute of the 3349<emphasis>BounceKeys</emphasis> 3350control (see <link linkend="The_BounceKeys_Control">section 10.6.7</link>). Its value specifies the 3351<emphasis>BounceKeys</emphasis> 3352delay period in milliseconds for which the key is disabled after having been 3353pressed before another press of the same key is accepted by the server. 3354</para> 3355 3356 3357</sect3> 3358<sect3 id='mk_delay_mk_interval_mk_time_to_max_mk_max_speed_and_mk_curve'> 3359<title>mk_delay, mk_interval, mk_time_to_max, mk_max_speed, and mk_curve</title> 3360 3361<para> 3362<structfield>mk_delay</structfield>, 3363<structfield>mk_interval</structfield>, 3364<structfield>mk_time_to_max</structfield>, 3365<structfield>mk_max_speed</structfield>, 3366and 3367<structfield>mk_curve</structfield> 3368are attributes of the 3369<emphasis>MouseKeysAccel</emphasis> 3370control. Refer to <link linkend="The_MouseKeysAccel_Control">section 10.5.2</link> for a description of these fields and the 3371units involved. 3372</para> 3373 3374 3375</sect3> 3376<sect3 id='ax_options'> 3377<title>ax_options</title> 3378 3379<para> 3380The 3381<structfield>ax_options</structfield> 3382field contains attributes used to configure two different controls, the 3383<emphasis>StickyKeys</emphasis> 3384control (see <link linkend="The_StickyKeys_Control">section 10.6.8</link>) and the 3385<emphasis>AccessXFeedback</emphasis> 3386control (see <link linkend="The_AccessXFeedback_Control">section 10.6.3</link>). The 3387<structfield>ax_options</structfield> 3388field is a bitmask and may include any combination of the bits defined in 3389<link linkend="table10.9">Table 10.9</link>. 3390</para> 3391 3392<table id='table10.9' frame='topbot'> 3393<title>Access X Enable/Disable Bits (ax_options field)</title> 3394<?dbfo keep-together="always" ?> 3395<tgroup cols='3' align='left' colsep='0' rowsep='0'> 3396<colspec colname='c1' colwidth='1.0*'/> 3397<colspec colname='c2' colwidth='1.3*'/> 3398<colspec colname='c3' colwidth='0.7*'/> 3399<thead> 3400<row rowsep='1'> 3401 <entry>Access X Control</entry> 3402 <entry>ax_options bit</entry> 3403 <entry>value</entry> 3404 </row> 3405</thead> 3406<tbody> 3407 <row> 3408 <entry>AccessXFeedback</entry> 3409 <entry><symbol>XkbAX_SKPressFBMask</symbol></entry> 3410 <entry>(1L<<0)</entry> 3411 </row> 3412 <row> 3413 <entry></entry> 3414 <entry><symbol>XkbAX_SKAcceptFBMask</symbol></entry> 3415 <entry>(1L << 1)</entry> 3416 </row> 3417 <row> 3418 <entry></entry> 3419 <entry><symbol>XkbAX_FeatureFBMask</symbol></entry> 3420 <entry>(1L << 2)</entry> 3421 </row> 3422 <row> 3423 <entry></entry> 3424 <entry><symbol>XkbAX_SlowWarnFBMask</symbol></entry> 3425 <entry>(1L << 3)</entry> 3426 </row> 3427 <row> 3428 <entry></entry> 3429 <entry><symbol>XkbAX_IndicatorFBMask</symbol></entry> 3430 <entry>(1L << 4)</entry> 3431 </row> 3432 <row> 3433 <entry></entry> 3434 <entry><symbol>XkbAX_StickyKeysFBMask</symbol></entry> 3435 <entry>(1L << 5)</entry> 3436 </row> 3437 <row> 3438 <entry></entry> 3439 <entry><symbol>XkbAX_SKReleaseFBMask</symbol></entry> 3440 <entry>(1L << 8)</entry> 3441 </row> 3442 <row> 3443 <entry></entry> 3444 <entry><symbol>XkbAX_SKRejectFBMask</symbol></entry> 3445 <entry>(1L << 9)</entry> 3446 </row> 3447 <row> 3448 <entry></entry> 3449 <entry><symbol>XkbAX_BKRejectFBMask</symbol></entry> 3450 <entry>(1L << 10)</entry> 3451 </row> 3452 <row> 3453 <entry></entry> 3454 <entry><symbol>XkbAX_DumbBellFBMask</symbol></entry> 3455 <entry>(1L << 11)</entry> 3456 </row> 3457 <row> 3458 <entry>StickyKeys</entry> 3459 <entry><symbol>XkbAX_TwoKeysMask</symbol></entry> 3460 <entry>(1L << 6)</entry> 3461 </row> 3462 <row> 3463 <entry></entry> 3464 <entry><symbol>XkbAX_LatchToLockMask</symbol></entry> 3465 <entry>(1L << 7)</entry> 3466 </row> 3467 <row> 3468 <entry></entry> 3469 <entry><symbol>XkbAX_AllOptionsMask</symbol></entry> 3470 <entry>(0xFFF)</entry> 3471 </row> 3472</tbody> 3473</tgroup> 3474</table> 3475 3476<para> 3477The fields pertaining to each control are relevant only when the control is 3478enabled 3479(<symbol>XkbAccessXFeedbackMask</symbol> 3480or 3481<symbol>XkbStickyKeysMask</symbol> 3482bit is turned on in the 3483<structfield>enabled_ctrls</structfield> 3484field). 3485</para> 3486 3487 3488<para> 3489Xkb provides a set of convenience macros for working with the 3490<structfield>ax_options</structfield> 3491field of an 3492<structname>XkbControlsRec</structname> 3493structure: 3494 3495<programlisting> 3496#define <symbol>XkbAX_NeedOption</symbol>(c,w) ((c)->ax_options & (w)) 3497</programlisting></para> 3498 3499<para> 3500The 3501<symbol>XkbAX_NeedOption</symbol> 3502macro is useful for determining whether a particular AccessX option is enabled 3503or not. It accepts a pointer to an 3504<structname>XkbControlsRec</structname> 3505structure and a valid mask bit from 3506<link linkend="table10.9">Table 10.9</link>. 3507If the specified mask bit in the 3508<structfield>ax_options</structfield> 3509field of the controls structure is set, the macro returns the mask bit. 3510Otherwise, it returns zero. Thus, 3511 3512<programlisting> 3513 XkbAX_NeedOption(ctlrec, XkbAX_LatchToLockMask) 3514</programlisting> 3515 3516is nonzero if the latch to lock transition for latching keys is enabled, and 3517zero if it is disabled. Note that 3518<symbol>XkbAX_NeedOption</symbol> 3519only determines whether or not the particular capability is configured to 3520operate; the 3521<symbol>XkbAccessXFeedbackMask</symbol> 3522bit must also be turned on in 3523<structfield>enabled_ctrls</structfield> 3524for the capability to actually be functioning. 3525</para> 3526 3527<para><programlisting> 3528#define <symbol>XkbAX_AnyFeedback</symbol>(c) \ 3529 ((c)->enabled_ctrls & XkbAccessXFeedbackMask) 3530</programlisting></para> 3531 3532<para> 3533The 3534<symbol>XkbAX_AnyFeedback</symbol> 3535macro accepts a pointer to an 3536<structname>XkbControlsRec</structname> 3537structure and tells whether the 3538<emphasis>AccessXFeedback</emphasis> 3539control is enabled or not. If the 3540<emphasis>AccessXFeedback</emphasis> 3541control is enabled, the macro returns 3542<symbol>XkbAccessXFeedbackMask</symbol>. 3543Otherwise, it returns zero. 3544</para> 3545 3546<para><programlisting> 3547#define <symbol>XkbAX_NeedFeedback</symbol>(c,w) \ 3548 (XkbAX_AnyFeedback(c) && XkbAX_NeedOption(c,w)) 3549</programlisting></para> 3550 3551<para> 3552The 3553<symbol>XkbAX_NeedFeedback</symbol> 3554macro is useful for determining if both the 3555<emphasis>AccessXFeedback</emphasis> 3556control and a particular AccessX feedback option are enabled. The macro 3557accepts a pointer to an 3558<structname>XkbControlsRec</structname> 3559structure and a feedback option from the table above. If both the 3560<emphasis>AccessXFeedback</emphasis> 3561control and the specified feedback option are enabled, the macro returns 3562<symbol>True</symbol>. 3563Otherwise it returns 3564<symbol>False</symbol>. 3565</para> 3566 3567 3568</sect3> 3569<sect3 3570id='ax_timeout_axt_opts_mask_axt_opts_values_axt_ctrls_mask_and_axt_ctrls_values'> 3571<title>ax_timeout, axt_opts_mask, axt_opts_values, axt_ctrls_mask, and axt_ctrls_values</title> 3572 3573<para> 3574<structfield>ax_timeout</structfield>, 3575<structfield>axt_opts_mask</structfield>, 3576<structfield>axt_opts_values</structfield>, 3577<structfield>axt_ctrls_mask</structfield>, 3578and 3579<structfield>axt_ctrls_values</structfield> 3580are attributes of the 3581<emphasis>AccessXTimeout</emphasis> 3582control. Refer to <link linkend="The_AccessXTimeout_Control">section 10.6.2</link> for a description of these fields and the 3583units involved. 3584</para> 3585 3586 3587</sect3> 3588<sect3 id='per_key_repeat'> 3589<title>per_key_repeat</title> 3590 3591<para> 3592The 3593<structfield>per_key_repeat</structfield> 3594field mirrors the 3595<structfield>auto_repeats</structfield> 3596field of the core protocol 3597<structname>XKeyboardState</structname> 3598structure: changing the 3599<structfield>auto_repeats</structfield> 3600field automatically changes 3601<structfield>per_key_repeat</structfield> 3602and vice versa. It is provided for convenience and to reduce protocol traffic. 3603For example, to obtain the individual repeat key behavior as well as the repeat 3604delay and rate, use 3605<function>XkbGetControls</function>. 3606If the 3607<structfield>per_key_repeat</structfield> 3608were not in this structure, you would have to call both 3609<function>XGetKeyboardControl</function> 3610and 3611<function>XkbGetControls</function> 3612to get this information. The bits correspond to keycodes. The first seven keys 3613(keycodes 1–7) are indicated in 3614<structfield>per_key_repeat</structfield>[0], 3615with bit position 0 (low order) corresponding to the fictitious keycode 0. 3616Following array elements correspond to 8 keycodes per element. A 1 bit 3617indicates that the key is a repeating key. 3618</para> 3619 3620 3621</sect3> 3622</sect2> 3623</sect1> 3624<sect1 id='Querying_Controls'> 3625<title>Querying Controls</title> 3626 3627<para> 3628Use 3629<function>XkbGetControls</function> 3630to find the current state of Xkb server controls. 3631</para> 3632 3633<indexterm significance="preferred" zone="XkbGetControls"><primary><function>XkbGetControls</function></primary></indexterm> 3634<funcsynopsis id="XkbGetControls"> 3635 <funcprototype> 3636 <funcdef>Status <function>XkbGetControls</function></funcdef> 3637<!-- ( 3638<parameter>display, which, xkb)</parameter> --> 3639 3640 <paramdef>Display *<parameter>display</parameter></paramdef> 3641 <paramdef>unsigned long <parameter>which</parameter></paramdef> 3642 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 3643 </funcprototype> 3644</funcsynopsis> 3645<variablelist> 3646 <varlistentry> 3647 <term> 3648 <parameter>display</parameter> 3649 </term> 3650 <listitem> 3651 <para> 3652 connection to X server 3653 </para> 3654 </listitem> 3655 </varlistentry> 3656 <varlistentry> 3657 <term> 3658 <parameter>which</parameter> 3659 </term> 3660 <listitem> 3661 <para> 3662 mask of controls requested 3663 </para> 3664 </listitem> 3665 </varlistentry> 3666 <varlistentry> 3667 <term> 3668 <parameter>xkb</parameter> 3669 </term> 3670 <listitem> 3671 <para> 3672 keyboard description for controls information 3673 </para> 3674 </listitem> 3675 </varlistentry> 3676</variablelist> 3677 3678<para> 3679<function>XkbGetControls</function> 3680queries the server for the requested control information, waits for a reply, 3681and then copies the server’s values for the requested information into the 3682<structfield>ctrls</structfield> 3683structure of the 3684<parameter>xkb</parameter> 3685argument. Only those components specified by the 3686<parameter>which</parameter> 3687parameter are copied. Valid values for 3688<parameter>which</parameter> 3689are any combination of the masks listed in 3690<link linkend="table10.7">Table 10.7</link> that have <quote>ok</quote> in the 3691<parameter>which</parameter> 3692column. 3693</para> 3694 3695 3696<para> 3697If 3698<parameter>xkb</parameter>-><structfield>ctrls</structfield> 3699is 3700<symbol>NULL</symbol>, 3701<function>XkbGetControls</function> 3702allocates and initializes it before obtaining the values specified by 3703<parameter>which</parameter>. 3704If 3705<parameter>xkb</parameter>-><structfield>ctrls</structfield> 3706is not 3707<symbol>NULL</symbol>, 3708<function>XkbGetControls</function> 3709modifies only those portions of 3710<parameter>xkb</parameter>-><structfield>ctrls</structfield> 3711corresponding to the values specified by 3712<parameter>which</parameter>. 3713</para> 3714 3715 3716<para> 3717<function>XkbGetControls</function> 3718returns 3719<symbol>Success</symbol> 3720if successful; otherwise, it returns 3721<errorname>BadAlloc</errorname> 3722if it cannot obtain sufficient storage, 3723<errorname>BadMatch</errorname> 3724if 3725<parameter>xkb</parameter> 3726is 3727<symbol>NULL</symbol> 3728or 3729<parameter>which</parameter> 3730is empty, or 3731<errorname>BadImplementation</errorname>. 3732</para> 3733 3734 3735<para> 3736To free the 3737<structfield>ctrls</structfield> 3738member of a keyboard description, use 3739<function>XkbFreeControls</function> 3740(see <link linkend="Allocating_and_Freeing_an_XkbControlsRec">section 10.12</link>) 3741</para> 3742 3743 3744<para> 3745The 3746<structfield>num_groups</structfield> 3747field in the 3748<structfield>ctrls</structfield> 3749structure is always filled in by 3750<function>XkbGetControls</function>, 3751regardless of which bits are selected by 3752<parameter>which</parameter>. 3753</para> 3754 3755 3756</sect1> 3757<sect1 id='Changing_Controls'> 3758<title>Changing Controls</title> 3759 3760<para> 3761There are two ways to make changes to controls: either change a local copy 3762keyboard description and call 3763<function>XkbSetControls</function>, 3764or, to reduce network traffic, use an 3765<structname>XkbControlsChangesRec</structname> 3766structure and call 3767<function>XkbChangeControls</function>. 3768</para> 3769 3770 3771<para> 3772To change the state of one or more controls, first modify the 3773<structfield>ctrls</structfield> 3774structure in a local copy of the keyboard description and then use 3775<function>XkbSetControls</function> 3776to copy those changes to the X server. 3777</para> 3778 3779<indexterm significance="preferred" zone="XkbSetControls"><primary><function>XkbSetControls</function></primary></indexterm> 3780<funcsynopsis id="XkbSetControls"> 3781 <funcprototype> 3782 <funcdef>Bool <function>XkbSetControls</function></funcdef> 3783<!-- ( 3784<parameter>display, which, xkb)</parameter> --> 3785 3786 <paramdef>Display *<parameter>display</parameter></paramdef> 3787 <paramdef>unsigned long <parameter>which</parameter></paramdef> 3788 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 3789 </funcprototype> 3790</funcsynopsis> 3791<variablelist> 3792 <varlistentry> 3793 <term> 3794 <parameter>display</parameter> 3795 </term> 3796 <listitem> 3797 <para> 3798 connection to X server 3799 </para> 3800 </listitem> 3801 </varlistentry> 3802 <varlistentry> 3803 <term> 3804 <parameter>which</parameter> 3805 </term> 3806 <listitem> 3807 <para> 3808 mask of controls to change 3809 </para> 3810 </listitem> 3811 </varlistentry> 3812 <varlistentry> 3813 <term> 3814 <parameter>xkb</parameter> 3815 </term> 3816 <listitem> 3817 <para> 3818 <structfield>ctrls</structfield> field contains new values to be set 3819 </para> 3820 </listitem> 3821 </varlistentry> 3822</variablelist> 3823 3824<para> 3825For each bit that is set in the 3826<parameter>which</parameter> 3827parameter, 3828<function>XkbSetControls</function> 3829sends the corresponding values from the 3830<parameter>xkb</parameter>-><structfield>ctrls</structfield> 3831field to the server. Valid values for 3832<parameter>which</parameter> 3833are any combination of the masks listed in 3834<link linkend="table10.7">Table 10.7</link> that have <quote>ok</quote> in the 3835<parameter>which</parameter> 3836column. 3837</para> 3838 3839 3840<para> 3841If 3842<parameter>xkb</parameter>-><structfield>ctrls</structfield> 3843is 3844<symbol>NULL</symbol>, 3845the server does not support a compatible version of Xkb, or the Xkb extension 3846has not been properly initialized, 3847<function>XkbSetControls</function> 3848returns 3849<symbol>False</symbol>. 3850Otherwise, it sends the request to the X server and returns 3851<symbol>True</symbol>. 3852</para> 3853 3854 3855<para> 3856Note that changes to attributes of controls in the 3857<structname>XkbControlsRec</structname> 3858structure are apparent only when the associated control is enabled, although 3859the corresponding values are still updated in the X server. For example, the 3860<structfield>repeat_delay</structfield> 3861and 3862<structfield>repeat_interval</structfield> 3863fields are ignored unless the 3864<emphasis>RepeatKeys</emphasis> 3865control is enabled (that is, the X server’s equivalent of 3866<structfield>xkb->ctrls</structfield> 3867has 3868<symbol>XkbRepeatKeysMask</symbol> 3869set in 3870<structfield>enabled_ctrls</structfield>). 3871It is permissible to modify the attributes of a control in one call to 3872XkbSetControls and enable the control in a subsequent call. See <link linkend="The_EnabledControls_Control">section 10.1.1</link> 3873for more information on enabling and disabling controls. 3874</para> 3875 3876 3877<para> 3878Note that the 3879<structfield>enabled_ctrls</structfield> 3880field is itself a control — the 3881<emphasis>EnabledControls</emphasis> 3882control. As such, to set a specific configuration of enabled and disabled 3883boolean controls, you must set 3884<structfield>enabled_ctrls</structfield> 3885to the appropriate bits to enable only the controls you want and disable all 3886others, then specify the 3887<symbol>XkbControlsEnabledMask</symbol> 3888in a call to 3889<function>XkbSetControls</function>. 3890Because this is somewhat awkward if all you want to do is enable and disable 3891controls, and not modify any of their attributes, a convenience function is 3892also provided for this purpose 3893(<function>XkbChangeEnabledControls</function>, 3894<link linkend="The_EnabledControls_Control">section 10.1.1</link>). 3895</para> 3896 3897 3898<sect2 id='The_XkbControlsChangesRec_Structure'> 3899<title>The XkbControlsChangesRec Structure</title> 3900 3901<indexterm significance="preferred" zone="The_XkbControlsChangesRec_Structure"> 3902<primary><structname>XkbControlsChangesRec</structname></primary></indexterm> 3903 3904<para> 3905The 3906<structname>XkbControlsChangesRec</structname> 3907structure allows applications to track modifications to an 3908<structname>XkbControlsRec</structname> 3909structure and thereby reduce the amount of traffic sent to the server. The 3910same 3911<structname>XkbControlsChangesRec</structname> 3912structure may be used in several successive modifications to the same 3913<structname>XkbControlsRec</structname> 3914structure, then subsequently used to cause all of the changes, and only the 3915changes, to be propagated to the server. The 3916<structname>XkbControlsChangesRec</structname> 3917structure is defined as follows: 3918 3919<programlisting> 3920typedef struct _XkbControlsChanges { 3921 unsigned int changed_ctrls; /* bits indicating changed 3922 control data */ 3923 unsigned int enabled_ctrls_changes; /* bits indicating 3924 enabled/disabled controls */ 3925 Bool num_groups_changed; /* <symbol>True</symbol> if number of keyboard 3926 groups changed */ 3927} <structname>XkbControlsChangesRec</structname>, *XkbControlsChangesPtr; 3928</programlisting></para> 3929 3930<para> 3931The 3932<structfield>changed_ctrls</structfield> 3933field is a mask specifying which logical sets of data in the controls 3934structure have been modified. In this context, modified means 3935<emphasis>set</emphasis>, 3936that is, if a value is set to the same value it previously contained, it has 3937still been modified, and is noted as changed. Valid values for 3938<structfield>changed_ctrls</structfield> 3939are any combination of the masks listed in 3940<link linkend="table10.7">Table 10.7</link> that have <quote>ok</quote> in the 3941<structfield>changed_ctrls</structfield> 3942column. Setting a bit implies the corresponding data fields from the 3943<quote>Relevant XkbControlsRec Data Fields</quote> column in 3944<link linkend="table10.6">Table 10.6</link> have been modified. The 3945<structfield>enabled_ctrls_changes</structfield> 3946field specifies which bits in the 3947<structfield>enabled_ctrls</structfield> 3948field have changed. If the number of keyboard groups has changed, the 3949<structfield>num_groups_changed</structfield> 3950field is set to <symbol>True</symbol>. 3951</para> 3952 3953 3954<para> 3955If you have an Xkb description with controls that have been modified and an 3956<structname>XkbControlsChangesRec</structname> 3957that describes the changes that have been made, the 3958<function>XkbChangeControls</function> 3959function provides a flexible method for updating the controls in a server to 3960match those in the changed keyboard description. 3961</para> 3962 3963<indexterm significance="preferred" zone="XkbChangeControls"><primary><function>XkbChangeControls</function></primary></indexterm> 3964<funcsynopsis id="XkbChangeControls"> 3965 <funcprototype> 3966 <funcdef>Bool <function>XkbChangeControls</function></funcdef> 3967<!-- ( 3968<parameter>dpy, xkb, changes</parameter> 3969) --> 3970 3971 <paramdef>Display *<parameter>dpy</parameter></paramdef> 3972 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 3973 <paramdef>XkbControlsChangesPtr <parameter>changes</parameter></paramdef> 3974 </funcprototype> 3975</funcsynopsis> 3976<variablelist> 3977 <varlistentry> 3978 <term> 3979 <parameter>dpy</parameter> 3980 </term> 3981 <listitem> 3982 <para> 3983 connection to X server 3984 </para> 3985 </listitem> 3986 </varlistentry> 3987 <varlistentry> 3988 <term> 3989 <parameter>xkb</parameter> 3990 </term> 3991 <listitem> 3992 <para> 3993 keyboard description with changed <structfield>xkb->ctrls</structfield> 3994 </para> 3995 </listitem> 3996 </varlistentry> 3997 <varlistentry> 3998 <term> 3999 <parameter>changes</parameter> 4000 </term> 4001 <listitem> 4002 <para> 4003 which parts of <structfield>xkb->ctrls</structfield> have changed 4004 </para> 4005 </listitem> 4006 </varlistentry> 4007</variablelist> 4008 4009<para> 4010<function>XkbChangeControls</function> 4011copies any controls fields specified by 4012<parameter>changes</parameter> 4013from the keyboard description controls structure, 4014<parameter>xkb</parameter>-><structfield>ctrls</structfield>, 4015to the server specified by 4016<parameter>dpy</parameter>. 4017</para> 4018 4019 4020</sect2> 4021</sect1> 4022<sect1 id='Tracking_Changes_to_Keyboard_Controls'> 4023<title>Tracking Changes to Keyboard Controls</title> 4024 4025<indexterm significance="preferred" zone="Tracking_Changes_to_Keyboard_Controls"> 4026<primary>events</primary><secondary><symbol>XkbControlsNotify</symbol></secondary></indexterm> 4027<indexterm significance="preferred" zone="Tracking_Changes_to_Keyboard_Controls"> 4028<primary><structname>XkbControlsNotifyEvent</structname></primary></indexterm> 4029 4030<para> 4031Whenever a field in the controls structure changes in the server’s keyboard 4032description, the server sends an 4033<symbol>XkbControlsNotify</symbol> 4034event to all interested clients.To receive 4035<symbol>XkbControlsNotify</symbol> 4036events under all possible conditions, use 4037<function>XkbSelectEvents</function> 4038(see <link linkend="Selecting_Xkb_Events">section 4.3</link>) and pass 4039<symbol>XkbControlsNotifyMask</symbol> 4040in both 4041<parameter>bits_to_change</parameter> 4042and 4043<parameter>values_for_bits</parameter>. 4044</para> 4045 4046 4047<para> 4048To receive 4049<symbol>XkbControlsNotify</symbol> 4050events only under certain conditions, use 4051<function>XkbSelectEventDetails</function> 4052using 4053<symbol>XkbControlsNotify</symbol> 4054as the 4055<structfield>event_type</structfield> 4056and specifying the desired state changes in 4057<parameter>bits_to_change</parameter> 4058and 4059<parameter>values_for_bits</parameter> 4060using mask bits from <link linkend="table10.7">Table 10.7</link>. 4061</para> 4062 4063 4064<para> 4065The structure for the 4066<symbol>XkbControlsNotify</symbol> 4067event is defined as follows: 4068 4069<programlisting> 4070typedef struct { 4071 int type; /* Xkb extension base event code */ 4072 unsigned long serial; /* X server serial number for event */ 4073 Bool send_event; /* <symbol>True</symbol> ⇒ synthetically generated */ 4074 Display * display; /* server connection where event generated */ 4075 Time time; /* server time when event generated */ 4076 int xkb_type; /* <symbol>XkbCompatMapNotify</symbol> */ 4077 int device; /* Xkb device ID, 4078 will not be <symbol>XkbUseCoreKbd</symbol> */ 4079 unsigned int changed_ctrls; /* bits indicating which controls 4080 data have changed */ 4081 unsigned int enabled_ctrls; /* controls currently enabled in server */ 4082 unsigned int enabled_ctrl_changes; /* bits indicating 4083 enabled/disabled controls */ 4084 int num_groups; /* current number of keyboard groups */ 4085 KeyCode keycode; /* != 0 ⇒ keycode of key causing change */ 4086 char event_type; /* Type of event causing change */ 4087 char req_major; /* major event code of event causing change */ 4088 char req_minor; /* minor event code of event causing change */ 4089} <structname>XkbControlsNotifyEvent</structname>; 4090</programlisting></para> 4091 4092<para> 4093The 4094<structfield>changed_ctrls</structfield> 4095field specifies the controls components that have changed and consists of bits 4096taken from the masks defined in 4097<link linkend="table10.7">Table 10.7</link> with <quote>ok</quote> in the 4098<structfield>changed_ctrls</structfield> 4099column. 4100</para> 4101 4102 4103<para> 4104The controls currently enabled in the server are reported in the 4105<structfield>enabled_ctrls</structfield> 4106field. If any controls were just enabled or disabled (that is, the contents of 4107the 4108<structfield>enabled_ctrls</structfield> 4109field changed), they are flagged in the 4110<structfield>enabled_ctrl_changes</structfield> 4111field. The valid bits for these fields are the masks listed in 4112<link linkend="table10.7">Table 10.7</link> with 4113<quote>ok</quote> in the 4114<structfield>enabled_ctrls</structfield> 4115column. The 4116<structfield>num_groups</structfield> 4117field reports the number of groups bound to the key belonging to the most 4118number of groups and is automatically updated when the keyboard mapping changes. 4119</para> 4120 4121 4122<para> 4123If the change was caused by a request from a client, the 4124<structfield>keycode</structfield> 4125and 4126<structfield>event_type</structfield> 4127fields are set to 4128<emphasis>zero</emphasis> 4129and the 4130<structfield>req_major</structfield> 4131and 4132<structfield>req_minor</structfield> 4133fields identify the request. The 4134<structfield>req_major</structfield> 4135value is the same as the major extension opcode. Otherwise, 4136<structfield>event_type</structfield> 4137is set to the type of event that caused the change (one of 4138<symbol>KeyPress</symbol>, 4139<symbol>KeyRelease</symbol>, 4140<symbol>DeviceKeyPress</symbol>, 4141<symbol>DeviceKeyRelease</symbol>, 4142<symbol>ButtonPress</symbol> 4143or 4144<symbol>ButtonRelease</symbol>), 4145and 4146<structfield>req_major</structfield> 4147and 4148<structfield>req_minor</structfield> 4149are undefined. If 4150<structfield>event_type</structfield> 4151is 4152<symbol>KeyPress</symbol>, 4153<symbol>KeyRelease</symbol>, 4154<symbol>DeviceKeyPress</symbol>, 4155or 4156<symbol>DeviceKeyRelease</symbol>, 4157the 4158<structfield>keycode</structfield> 4159field is set to the key that caused the change. If 4160<structfield>event_type</structfield> 4161is 4162<symbol>ButtonPress</symbol> 4163or 4164<symbol>ButtonRelease</symbol>, 4165<structfield>keycode</structfield> 4166contains the button number. 4167</para> 4168 4169 4170<para> 4171When a client receives an 4172<symbol>XkbControlsNotify</symbol> 4173event, it can note the changes in a changes structure using 4174<function>XkbNoteControlsChanges</function>. 4175</para> 4176 4177<indexterm significance="preferred" zone="XkbNoteControlsChanges"><primary><function>XkbNoteControlsChanges</function></primary></indexterm> 4178<funcsynopsis id="XkbNoteControlsChanges"> 4179 <funcprototype> 4180 <funcdef>void <function>XkbNoteControlsChanges</function></funcdef> 4181<!-- ( 4182<parameter>changes</parameter>, 4183<parameter>new</parameter>, 4184<parameter>wanted</parameter> 4185) --> 4186 4187 <paramdef>XkbControlsChangesPtr <parameter>changes</parameter></paramdef> 4188 <paramdef>XkbControlsNotifyEvent *<parameter>new</parameter></paramdef> 4189 <paramdef>unsigned int <parameter>wanted</parameter></paramdef> 4190 </funcprototype> 4191</funcsynopsis> 4192<variablelist> 4193 <varlistentry> 4194 <term> 4195 <parameter>changes</parameter> 4196 </term> 4197 <listitem> 4198 <para> 4199 records changes indicated by new 4200 </para> 4201 </listitem> 4202 </varlistentry> 4203 <varlistentry> 4204 <term> 4205 <parameter>new</parameter> 4206 </term> 4207 <listitem> 4208 <para> 4209 tells which things have changed 4210 </para> 4211 </listitem> 4212 </varlistentry> 4213 <varlistentry> 4214 <term> 4215 <parameter>wanted</parameter> 4216 </term> 4217 <listitem> 4218 <para> 4219 tells which parts of new to record in changes 4220 </para> 4221 </listitem> 4222 </varlistentry> 4223</variablelist> 4224 4225<para> 4226The 4227<parameter>wanted</parameter> 4228parameter is a bitwise inclusive OR of bits taken from the set of masks 4229specified in <link linkend="table10.7">Table 10.7</link> with <quote>ok</quote> 4230in the 4231<structfield>changed_ctrls</structfield> 4232column. 4233<function>XkbNoteControlsChanges</function> 4234copies any changes reported in 4235<parameter>new</parameter> 4236and specified in 4237<parameter>wanted</parameter> 4238into the changes record specified by 4239<parameter>changes</parameter>. 4240</para> 4241 4242 4243<para> 4244Use 4245<function>XkbGetControlsChanges</function> 4246to update a local copy of a keyboard description with the changes previously 4247noted by one or more calls to 4248<function>XkbNoteControlsChanges</function>. 4249</para> 4250 4251 4252<indexterm significance="preferred" zone="XkbGetControlsChanges"><primary><function>XkbGetControlsChanges</function></primary></indexterm> 4253<funcsynopsis id="XkbGetControlsChanges"> 4254 <funcprototype> 4255 <funcdef>Status <function>XkbGetControlsChanges</function></funcdef> 4256<!-- ( 4257<parameter>dpy</parameter>, 4258<parameter>xkb</parameter>, 4259<parameter>changes</parameter> 4260) --> 4261 4262 <paramdef>Display *<parameter>dpy</parameter></paramdef> 4263 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 4264 <paramdef>XkbNameChangesPtr <parameter>changes</parameter></paramdef> 4265 </funcprototype> 4266</funcsynopsis> 4267<variablelist> 4268 <varlistentry> 4269 <term> 4270 <parameter>dpy</parameter> 4271 </term> 4272 <listitem> 4273 <para> 4274 connection to X server 4275 </para> 4276 </listitem> 4277 </varlistentry> 4278 <varlistentry> 4279 <term> 4280 <parameter>xkb</parameter> 4281 </term> 4282 <listitem> 4283 <para> 4284 <structfield>xkb->ctrls</structfield> will be updated 4285 </para> 4286 </listitem> 4287 </varlistentry> 4288 <varlistentry> 4289 <term> 4290 <parameter>changes</parameter> 4291 </term> 4292 <listitem> 4293 <para> 4294 indicates which parts of <structfield>xkb->ctrls</structfield> to update 4295 </para> 4296 </listitem> 4297 </varlistentry> 4298</variablelist> 4299 4300<para> 4301<function>XkbGetControlsChanges</function> 4302examines the 4303<parameter>changes</parameter> 4304parameter, queries the server for the necessary information, and copies the 4305results into the 4306<parameter>xkb</parameter>-><structfield>ctrls</structfield> 4307keyboard description. If the 4308<structfield>ctrls</structfield> 4309field of 4310<parameter>xkb</parameter> 4311is 4312<symbol>NULL</symbol>, 4313<function>XkbGetControlsChanges</function> 4314allocates and initializes it. To free the 4315<structfield>ctrls</structfield> 4316field, use 4317<function>XkbFreeControls</function> 4318(see <link linkend="Allocating_and_Freeing_an_XkbControlsRec">section 10.12</link>). 4319</para> 4320 4321 4322<para> 4323<function>XkbGetControlsChanges</function> 4324returns 4325<symbol>Success</symbol> 4326if successful and can generate 4327<errorname>BadAlloc</errorname>, 4328<errorname>BadImplementation</errorname>, 4329and 4330<errorname>BadMatch</errorname> 4331errors. 4332</para> 4333 4334 4335</sect1> 4336<sect1 id='Allocating_and_Freeing_an_XkbControlsRec'> 4337<title>Allocating and Freeing an XkbControlsRec</title> 4338 4339<para> 4340The need to allocate an 4341<structname>XkbControlsRec</structname> 4342structure seldom arises; Xkb creates one when an application calls 4343<function>XkbGetControls</function> 4344or a related function. For those situations where there is not an 4345<structname>XkbControlsRec</structname> 4346structure allocated in the 4347<structname>XkbDescRec</structname>, 4348allocate one by calling 4349<function>XkbAllocControls</function>. 4350</para> 4351 4352<indexterm significance="preferred" zone="XkbAllocControls"><primary><function>XkbAllocControls</function></primary></indexterm> 4353<funcsynopsis id="XkbAllocControls"> 4354 <funcprototype> 4355 <funcdef>Status <function>XkbAllocControls</function></funcdef> 4356<!-- ( 4357<parameter>xkb, which</parameter> 4358) --> 4359 4360 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 4361 <paramdef>unsigned int <parameter>which</parameter></paramdef> 4362 </funcprototype> 4363</funcsynopsis> 4364<variablelist> 4365 <varlistentry> 4366 <term> 4367 <parameter>xkb</parameter> 4368 </term> 4369 <listitem> 4370 <para> 4371 Xkb description in which to allocate ctrls rec 4372 </para> 4373 </listitem> 4374 </varlistentry> 4375 <varlistentry> 4376 <term> 4377 <parameter>which</parameter> 4378 </term> 4379 <listitem> 4380 <para> 4381 mask of components of <structfield>ctrls</structfield> to allocate 4382 </para> 4383 </listitem> 4384 </varlistentry> 4385</variablelist> 4386 4387<para> 4388<function>XkbAllocControls</function> 4389allocates the 4390<structfield>ctrls</structfield> 4391field of the 4392<parameter>xkb</parameter> 4393parameter, initializes all fields to zero, and returns 4394<symbol>Success</symbol>. 4395If the 4396<structfield>ctrls</structfield> 4397field is not 4398<symbol>NULL</symbol>, 4399<function>XkbAllocControls</function> 4400simply returns 4401<symbol>Success</symbol>. 4402If 4403<parameter>xkb</parameter> 4404is 4405<symbol>NULL</symbol>, 4406<function>XkbAllocControls</function> 4407reports a 4408<errorname>BadMatch</errorname> 4409error. If the 4410<structfield>ctrls</structfield> 4411field could not be allocated, it reports a 4412<errorname>BadAlloc</errorname> 4413error. 4414</para> 4415 4416 4417<para> 4418The 4419<parameter>which</parameter> 4420mask specifies the individual fields of the 4421<structfield>ctrls</structfield> 4422structure to be allocated and can contain any of the valid masks defined in 4423<link linkend="table10.7">Table 10.7</link>. 4424Because none of the currently existing controls have any structures 4425associated with them, which is currently of little practical value in this call. 4426</para> 4427 4428 4429<para> 4430To free memory used by the 4431<structfield>ctrls</structfield> 4432member of an 4433<structname>XkbDescRec</structname> 4434structure, use 4435<function>XkbFreeControls</function>: 4436</para> 4437 4438 4439<indexterm significance="preferred" zone="XkbFreeControls"><primary><function>XkbFreeControls</function></primary></indexterm> 4440<funcsynopsis id="XkbFreeControls"> 4441 <funcprototype> 4442 <funcdef>void <function>XkbFreeControls</function></funcdef> 4443<!-- ( 4444<parameter>xkb, which, free_all</parameter> 4445) --> 4446 4447 <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef> 4448 <paramdef>unsigned int <parameter>which</parameter></paramdef> 4449 <paramdef>Bool <parameter>free_all</parameter></paramdef> 4450 </funcprototype> 4451</funcsynopsis> 4452<variablelist> 4453 <varlistentry> 4454 <term> 4455 <parameter>xkb</parameter> 4456 </term> 4457 <listitem> 4458 <para> 4459 Xkb description in which to free controls components 4460 </para> 4461 </listitem> 4462 </varlistentry> 4463 <varlistentry> 4464 <term> 4465 <parameter>which</parameter> 4466 </term> 4467 <listitem> 4468 <para> 4469 mask of components of <structfield>ctrls</structfield> to free 4470 </para> 4471 </listitem> 4472 </varlistentry> 4473 <varlistentry> 4474 <term> 4475 <parameter>free_all</parameter> 4476 </term> 4477 <listitem> 4478 <para> 4479 <symbol>True</symbol> ⇒ free everything + ctrls itself 4480 </para> 4481 </listitem> 4482 </varlistentry> 4483</variablelist> 4484 4485<para> 4486<function>XkbFreeControls</function> 4487frees the specified components of the 4488<structfield>ctrls</structfield> 4489field in the 4490<parameter>xkb</parameter> 4491keyboard description and sets the corresponding structure component values to 4492<symbol>NULL</symbol> 4493or 4494<emphasis>zero</emphasis>. 4495The 4496<parameter>which</parameter> 4497mask specifies the fields of 4498<structfield>ctrls</structfield> 4499to be freed and can contain any of the controls components specified in 4500<link linkend="table10.7">Table 10.7</link>. 4501</para> 4502 4503 4504<para> 4505If 4506<parameter>free_all</parameter> 4507is 4508<symbol>True</symbol>, 4509<function>XkbFreeControls</function> 4510frees every non- 4511<symbol>NULL</symbol> 4512structure component in the controls, frees the 4513<structname>XkbControlsRec</structname> 4514structure referenced by the 4515<structfield>ctrls</structfield> 4516member of 4517<parameter>xkb</parameter>, 4518and sets 4519<structfield>ctrls</structfield> 4520to 4521<symbol>NULL</symbol>. 4522</para> 4523 4524</sect1> 4525<sect1 id='The_Miscellaneous_Per_client_Controls'> 4526<title>The Miscellaneous Per-client Controls</title> 4527 4528<para> 4529You can configure the boolean per-client controls which affect the state 4530reported in button and key events. See 4531<olink targetdoc='xkbproto' targetptr='Setting_a_Passive_Grab_for_an_XKB_State'>section 12.1.1</olink>, 4532<olink targetdoc='xkbproto' targetptr='Effects_of_XKB_on_Core_Protocol_Events'>12.3</olink>, 4533<olink targetdoc='xkbproto' targetptr='Sending_Events_to_Clients'>12.5</olink>, 4534and 4535<olink targetdoc='xkbproto' targetptr='Querying_and_Changing_Per_Client_Flags'>16.3.11</olink> 4536of the 4537<olink targetdoc='xkbproto' targetptr='xkbproto'><citetitle>XKB Protocol specification</citetitle></olink> 4538for more details. 4539</para> 4540 4541 4542<para> 4543To get the current values of the 4544<emphasis>per-client</emphasis> 4545controls, use 4546<function>XkbGetPerClientControls</function>. 4547</para> 4548 4549<indexterm significance="preferred" zone="XkbGetPerClientControls"><primary><function>XkbGetPerClientControls</function></primary></indexterm> 4550<funcsynopsis id="XkbGetPerClientControls"> 4551 <funcprototype> 4552 <funcdef>Bool <function>XkbGetPerClientControls</function></funcdef> 4553<!-- ( 4554<parameter>dpy</parameter>, 4555<parameter>ctrls</parameter> 4556) --> 4557 4558 <paramdef>Display *<parameter>dpy</parameter></paramdef> 4559 <paramdef>unsigned int *<parameter>ctrls</parameter></paramdef> 4560 </funcprototype> 4561</funcsynopsis> 4562<variablelist> 4563 <varlistentry> 4564 <term> 4565 <parameter>dpy</parameter> 4566 </term> 4567 <listitem> 4568 <para> 4569 connection to X server 4570 </para> 4571 </listitem> 4572 </varlistentry> 4573 <varlistentry> 4574 <term> 4575 <parameter>ctrls</parameter> 4576 </term> 4577 <listitem> 4578 <para> 4579 1 bit ⇒ corresponding control is on 4580 </para> 4581 </listitem> 4582 </varlistentry> 4583</variablelist> 4584 4585<para> 4586<function>XkbGetPerClientControls</function> 4587backfills 4588<parameter>ctrls</parameter> 4589with the 4590<emphasis>per-client</emphasis> 4591control attributes for this particular client. It returns 4592<symbol>True</symbol> 4593if successful, and 4594<symbol>False</symbol> 4595otherwise. 4596</para> 4597 4598 4599<para> 4600To change the current values of the 4601<emphasis>per-client</emphasis> 4602control attributes, use 4603<function>XkbSetPerClientControls</function>. 4604</para> 4605 4606 4607<indexterm significance="preferred" zone="XkbSetPerClientControls"><primary><function>XkbSetPerClientControls</function></primary></indexterm> 4608<funcsynopsis id="XkbSetPerClientControls"> 4609 <funcprototype> 4610 <funcdef>Bool <function>XkbSetPerClientControls</function></funcdef> 4611<!-- ( 4612<parameter>dpy</parameter>, 4613<parameter>ctrls</parameter> 4614) --> 4615 4616 <paramdef>Display *<parameter>dpy</parameter></paramdef> 4617 <paramdef>unsigned int <parameter>change</parameter></paramdef> 4618 <paramdef>unsigned int *<parameter>value</parameter></paramdef> 4619 </funcprototype> 4620</funcsynopsis> 4621<variablelist> 4622 <varlistentry> 4623 <term> 4624 <parameter>dpy</parameter> 4625 </term> 4626 <listitem> 4627 <para> 4628 connection to X server 4629 </para> 4630 </listitem> 4631 </varlistentry> 4632 <varlistentry> 4633 <term> 4634 <parameter>change</parameter> 4635 </term> 4636 <listitem> 4637 <para> 4638 1 bit ⇒ change control 4639 </para> 4640 </listitem> 4641 </varlistentry> 4642 <varlistentry> 4643 <term> 4644 <parameter>value</parameter> 4645 </term> 4646 <listitem> 4647 <para> 4648 1 bit ⇒ control on 4649 </para> 4650 </listitem> 4651 </varlistentry> 4652</variablelist> 4653 4654<para> 4655<function>XkbSetPerClientControls</function> 4656changes the per-client values for the controls selected by 4657<parameter>change</parameter> to the corresponding value in 4658<parameter>value</parameter>. Legal values for 4659<parameter>change</parameter> and <parameter>value</parameter> 4660are: XkbPCF_GrabsUseXKBStateMask, XkbPCF_LookupStateWhenGrabbed, and 4661XkbPCF_SendEventUsesXKBState. More than one control may be changed at one time 4662by OR-ing the values together. XkbSetPerClientControls backfills value with the 4663<emphasis>per-client</emphasis> 4664control attributes for this particular client. 4665It returns 4666<symbol>True</symbol> 4667if successful, and 4668<symbol>False</symbol> 4669otherwise. 4670</para> 4671 4672</sect1> 4673</chapter> 4674