10f8248bfSmrg<?xml version="1.0" encoding="UTF-8" ?>
20f8248bfSmrg<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
30f8248bfSmrg	  "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
4eb411b4bSmrg<chapter id='Indicators'>
5e9fcaa8aSmrg<title>Indicators</title>
6e9fcaa8aSmrg
70f8248bfSmrg<indexterm significance="preferred" zone="Indicators">
80f8248bfSmrg<primary>indicators</primary></indexterm>
90f8248bfSmrg
10e9fcaa8aSmrg<para>
11e9fcaa8aSmrgAlthough the core X implementation supports up to 32 LEDs on an input device,
12e9fcaa8aSmrgit does not provide any linkage between the state of the LEDs and the logical
130f8248bfSmrgstate of the input device. For example, most keyboards have a
140f8248bfSmrg<guilabel>CapsLock</guilabel>
150f8248bfSmrgLED, but X does not provide a mechanism to make the LED automatically follow
160f8248bfSmrgthe logical state of the
170f8248bfSmrg<keycap>CapsLock</keycap>
180f8248bfSmrgkey.
19e9fcaa8aSmrg</para>
20e9fcaa8aSmrg
21e9fcaa8aSmrg
22e9fcaa8aSmrg<para>
23e9fcaa8aSmrgFurthermore, the core X implementation does not provide clients with the
240f8248bfSmrgability to determine what bits in the
250f8248bfSmrg<structfield>led_mask</structfield>
260f8248bfSmrgfield of the
270f8248bfSmrg<structname>XKeyboardState</structname>
280f8248bfSmrgmap to the particular LEDs on the keyboard. For example, X does not provide a
290f8248bfSmrgmethod for a client to determine what bit to set in the
300f8248bfSmrg<structfield>led_mask</structfield>
310f8248bfSmrgfield to turn on the
320f8248bfSmrg<guilabel>Scroll Lock</guilabel>
330f8248bfSmrgLED or whether the keyboard even has a
340f8248bfSmrg<guilabel>Scroll Lock</guilabel>
350f8248bfSmrgLED.
36e9fcaa8aSmrg</para>
37e9fcaa8aSmrg
38e9fcaa8aSmrg
39e9fcaa8aSmrg<para>
40e9fcaa8aSmrgXkb provides indicator names and programmable indicators to help solve these
41e9fcaa8aSmrgproblems. Using Xkb, clients can determine the names of the various indicators,
42e9fcaa8aSmrgdetermine and control the way that the individual indicators should be updated
43e9fcaa8aSmrgto reflect keyboard changes, and determine which of the 32 keyboard indicators
44e9fcaa8aSmrgreported by the protocol are actually present on the keyboard. Clients may also
45e9fcaa8aSmrgrequest immediate notification of changes to the state of any subset of the
46e9fcaa8aSmrgkeyboard indicators, which makes it straightforward to provide an on-screen
470f8248bfSmrg<quote>virtual</quote> LED panel.
480f8248bfSmrgThis chapter describes Xkb indicators and the functions
49e9fcaa8aSmrgused for manipulating them.
50e9fcaa8aSmrg</para>
51e9fcaa8aSmrg
52eb411b4bSmrg<sect1 id='Indicator_Names'>
53e9fcaa8aSmrg<title>Indicator Names</title>
54e9fcaa8aSmrg
55e9fcaa8aSmrg<para>
56e9fcaa8aSmrgXkb provides the capability of symbolically naming indicators. Xkb itself
57e9fcaa8aSmrgdoesn’t use these symbolic names for anything; they are there only to help
58e9fcaa8aSmrgmake the keyboard description comprehensible to humans. To set the names of
590f8248bfSmrgspecific indicators, use
600f8248bfSmrg<function>XkbSetNames</function>
610f8248bfSmrgas discussed in <xref linkend="Symbolic_Names" />. Then set the map using
620f8248bfSmrg<function>XkbSetMap</function>
630f8248bfSmrg(see <link linkend="Changing_Map_Components_in_the_Server">section 14.3</link>)
640f8248bfSmrgor
653233502eSmrg<function>XkbSetNamedDeviceIndicator</function>
660f8248bfSmrg(below). To retrieve indicator names, use
670f8248bfSmrg<function>XkbGetNames</function>
680f8248bfSmrg(<xref linkend="Symbolic_Names" />).
69e9fcaa8aSmrg</para>
70e9fcaa8aSmrg
71e9fcaa8aSmrg
72e9fcaa8aSmrg</sect1>
73eb411b4bSmrg<sect1 id='Indicator_Data_Structures'>
74e9fcaa8aSmrg<title>Indicator Data Structures</title>
75e9fcaa8aSmrg
76e9fcaa8aSmrg<para>
770f8248bfSmrgUse the indicator description record,
780f8248bfSmrg<structname>XkbIndicatorRec</structname>,
790f8248bfSmrgand its indicator map,
800f8248bfSmrg<structname>XkbIndicatorMapRec</structname>,
810f8248bfSmrgto inquire about and control most indicator properties and behaviors.
82e9fcaa8aSmrg</para>
83e9fcaa8aSmrg
84e9fcaa8aSmrg
85eb411b4bSmrg<sect2 id='XkbIndicatorRec'>
86e9fcaa8aSmrg<title>XkbIndicatorRec</title>
87e9fcaa8aSmrg
880f8248bfSmrg<indexterm significance="preferred" zone="XkbIndicatorRec">
890f8248bfSmrg<primary><structname>XkbIndicatorRec</structname></primary></indexterm>
900f8248bfSmrg
91e9fcaa8aSmrg<para>
920f8248bfSmrgThe description for all the Xkb indicators is held in the
930f8248bfSmrg<structfield>indicators</structfield>
940f8248bfSmrgfield of the complete keyboard description (see <xref linkend="Complete_Keyboard_Description" />), which is defined
95e9fcaa8aSmrgas follows:
96e9fcaa8aSmrg
970f8248bfSmrg<programlisting>
98e9fcaa8aSmrg#define      XkbNumIndicators      32
990f8248bfSmrg
100e9fcaa8aSmrgtypedef struct {
1010f8248bfSmrg    unsigned long           phys_indicators;            /* LEDs existence */
1020f8248bfSmrg    XkbIndicatorMapRec      maps[XkbNumIndicators];     /* indicator maps */
1030f8248bfSmrg} <structname>XkbIndicatorRec</structname>, *XkbIndicatorPtr;
104e9fcaa8aSmrg</programlisting></para>
105e9fcaa8aSmrg
106e9fcaa8aSmrg<para>
1070f8248bfSmrgThis structure contains the
1080f8248bfSmrg<structfield>phys_indicators</structfield>
1090f8248bfSmrgfield, which relates some information about the correspondence between
110e9fcaa8aSmrgindicators and physical LEDs on the keyboard, and an array of indicator
1110f8248bfSmrg<structfield>maps</structfield>,
1120f8248bfSmrgone map per indicator.
113e9fcaa8aSmrg</para>
114e9fcaa8aSmrg
115e9fcaa8aSmrg<para>
1160f8248bfSmrgThe
1170f8248bfSmrg<structfield>phys_indicators</structfield>
1180f8248bfSmrgfield indicates which indicators are bound to physical LEDs on the keyboard;
1190f8248bfSmrgif a bit is set in
1200f8248bfSmrg<structfield>phys_indicators</structfield>,
1210f8248bfSmrgthen the associated indicator has a physical LED associated with it. This
122e9fcaa8aSmrgfield is necessary because some indicators may not have corresponding physical
123e9fcaa8aSmrgLEDs on the keyboard. For example, most keyboards have an LED for indicating
1240f8248bfSmrgthe state of
1250f8248bfSmrg<keycap>CapsLock</keycap>,
1260f8248bfSmrgbut most keyboards do not have an LED that indicates the current group.
1270f8248bfSmrgBecause
1280f8248bfSmrg<structfield>phys_indicators</structfield>
1290f8248bfSmrgdescribes a physical characteristic of the keyboard, you cannot directly
130e9fcaa8aSmrgchange it under program control. However, if a client program loads a
1310f8248bfSmrgcompletely new keyboard description via
1320f8248bfSmrg<function>XkbGetKeyboardByName</function>,
1330f8248bfSmrgor if a new keyboard is attached and the X implementation notices,
1340f8248bfSmrg<structfield>phys_indicators</structfield>
1350f8248bfSmrgchanges if the indicators for the new keyboard are different.
136e9fcaa8aSmrg</para>
137e9fcaa8aSmrg
138e9fcaa8aSmrg
139e9fcaa8aSmrg</sect2>
140eb411b4bSmrg<sect2 id='XkbIndicatorMapRec'>
141e9fcaa8aSmrg<title>XkbIndicatorMapRec</title>
142e9fcaa8aSmrg
1430f8248bfSmrg<indexterm significance="preferred" zone="XkbIndicatorMapRec">
1440f8248bfSmrg<primary><structname>XkbIndicatorMapRec</structname></primary></indexterm>
1450f8248bfSmrg
146e9fcaa8aSmrg<para>
147e9fcaa8aSmrgEach indicator has its own set of attributes that specify whether clients can
148e9fcaa8aSmrgexplicitly set its state and whether it tracks the keyboard state. The
1490f8248bfSmrgattributes of each indicator are held in the
1500f8248bfSmrg<structfield>maps</structfield>
1510f8248bfSmrgarray, which is an array of
1520f8248bfSmrg<structname>XkbIndicatorRec</structname>
1530f8248bfSmrgstructures:
154e9fcaa8aSmrg
1550f8248bfSmrg<programlisting>
156e9fcaa8aSmrgtypedef struct {
1570f8248bfSmrg    unsigned char  flags;         /* how the indicator can be changed */
1580f8248bfSmrg    unsigned char  which_groups;  /* match criteria for groups */
1590f8248bfSmrg    unsigned char  groups;        /* which keyboard groups the indicator watches */
1600f8248bfSmrg    unsigned char  which_mods;    /* match criteria for modifiers */
1610f8248bfSmrg    XkbModsRec     mods;          /* which modifiers the indicator watches */
1620f8248bfSmrg    unsigned int   ctrls;         /* which controls the indicator watches */
1630f8248bfSmrg} <structname>XkbIndicatorMapRec</structname>, *XkbIndicatorMapPtr;
164e9fcaa8aSmrg</programlisting></para>
165e9fcaa8aSmrg
166e9fcaa8aSmrg<para>
167e9fcaa8aSmrgThis indicator map specifies for each indicator:
168e9fcaa8aSmrg</para>
169e9fcaa8aSmrg
170e9fcaa8aSmrg<itemizedlist>
171e9fcaa8aSmrg<listitem>
172e9fcaa8aSmrg  <para>
173e9fcaa8aSmrgThe conditions under which the keyboard modifier state affects the indicator
174e9fcaa8aSmrg  </para>
175e9fcaa8aSmrg</listitem>
176e9fcaa8aSmrg<listitem>
177e9fcaa8aSmrg  <para>
178e9fcaa8aSmrgThe conditions under which the keyboard group state affects the indicator
179e9fcaa8aSmrg  </para>
180e9fcaa8aSmrg</listitem>
181e9fcaa8aSmrg<listitem>
182e9fcaa8aSmrg  <para>
183e9fcaa8aSmrgThe conditions under which the state of the boolean controls affects the
184e9fcaa8aSmrgindicator
185e9fcaa8aSmrg  </para>
186e9fcaa8aSmrg</listitem>
187e9fcaa8aSmrg<listitem>
188e9fcaa8aSmrg  <para>
189e9fcaa8aSmrgThe effect (if any) of attempts to explicitly change the state of the indicator
1900f8248bfSmrgusing the functions
1910f8248bfSmrg<function>XkbSetControls</function>
1920f8248bfSmrgor
1930f8248bfSmrg<function>XChangeKeyboardControl</function>
194e9fcaa8aSmrg
195e9fcaa8aSmrg  </para>
196e9fcaa8aSmrg</listitem>
197e9fcaa8aSmrg</itemizedlist>
198e9fcaa8aSmrg
199e9fcaa8aSmrg<para>
200e9fcaa8aSmrgFor more information on the effects of explicit changes to indicators and the
2010f8248bfSmrgrelationship to the indicator map, see <link linkend="Effects_of_Explicit_Changes_on_Indicators">section 8.4.1</link>.
202e9fcaa8aSmrg</para>
203e9fcaa8aSmrg
204eb411b4bSmrg<sect3 id='XkbIndicatorMapRec_flags_field'>
205e9fcaa8aSmrg<title>XkbIndicatorMapRec flags field</title>
206e9fcaa8aSmrg
207e9fcaa8aSmrg<para>
2080f8248bfSmrgThe
2090f8248bfSmrg<structfield>flags</structfield>
2100f8248bfSmrgfield specifies the conditions under which the indicator can be changed and
2110f8248bfSmrgthe effects of changing the indicator. The valid values for
2120f8248bfSmrg<structfield>flags</structfield>
2130f8248bfSmrgand their effects are shown in <link linkend="table8.1">Table 8.1</link>.
214e9fcaa8aSmrg</para>
215e9fcaa8aSmrg
2160f8248bfSmrg<table id='table8.1' frame='topbot'>
217e9fcaa8aSmrg<title>XkbIndicatorMapRec flags Field</title>
218eb411b4bSmrg<?dbfo keep-together="always" ?>
219eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'>
220eb411b4bSmrg<colspec colname='c1' colwidth='2.0*'/>
221eb411b4bSmrg<colspec colname='c2' colwidth='1.0*'/>
222eb411b4bSmrg<colspec colname='c3' colwidth='3.0*'/>
223e9fcaa8aSmrg<thead>
224eb411b4bSmrg<row rowsep='1'>
225e9fcaa8aSmrg  <entry>Value</entry>
226e9fcaa8aSmrg  <entry></entry>
227e9fcaa8aSmrg  <entry>Effect</entry>
228e9fcaa8aSmrg  </row>
229e9fcaa8aSmrg</thead>
230e9fcaa8aSmrg<tbody>
231eb411b4bSmrg  <row>
2320f8248bfSmrg    <entry><symbol>XkbIM_NoExplicit</symbol></entry>
233e9fcaa8aSmrg    <entry>(1L&lt;&lt;7)</entry>
234e9fcaa8aSmrg    <entry>Client applications cannot change the state of the indicator.</entry>
235e9fcaa8aSmrg  </row>
236eb411b4bSmrg  <row>
2370f8248bfSmrg    <entry><symbol>XkbIM_NoAutomatic</symbol></entry>
238e9fcaa8aSmrg    <entry>(1L&lt;&lt;6)</entry>
239e9fcaa8aSmrg    <entry>Xkb does not automatically change the value of the indicator based
240e9fcaa8aSmrgupon a change in the keyboard state, regardless of the values for the other
241e9fcaa8aSmrgfields of the indicator map.</entry>
242e9fcaa8aSmrg  </row>
243eb411b4bSmrg  <row>
2440f8248bfSmrg    <entry><symbol>XkbIM_LEDDrivesKB</symbol></entry>
245e9fcaa8aSmrg    <entry>(1L&lt;&lt;5)</entry>
246e9fcaa8aSmrg    <entry>A client application changing the state of the indicator causes the
247e9fcaa8aSmrgstate of the keyboard to change.</entry>
248e9fcaa8aSmrg  </row>
249e9fcaa8aSmrg</tbody>
250e9fcaa8aSmrg</tgroup>
251e9fcaa8aSmrg</table>
252e9fcaa8aSmrg
253e9fcaa8aSmrg<para>
2540f8248bfSmrgNote that if
2550f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
2560f8248bfSmrgis not set, by default the indicator follows the keyboard state.
257e9fcaa8aSmrg</para>
258e9fcaa8aSmrg
259e9fcaa8aSmrg
260e9fcaa8aSmrg<para>
2610f8248bfSmrgIf
2620f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
2630f8248bfSmrgis set and
2640f8248bfSmrg<symbol>XkbIM_NoExplicit</symbol>
2650f8248bfSmrgis not, and if you call a function which updates the server’s image of the
2660f8248bfSmrgindicator map (such as
2670f8248bfSmrg<function>XkbSetIndicatorMap</function>
2680f8248bfSmrgor
2693233502eSmrg<function>XkbSetNamedDeviceIndicator</function>),
2700f8248bfSmrgXkb changes the keyboard state and controls to reflect the other fields of
271e9fcaa8aSmrgthe indicator map, as described in the remainder of this section. If you
2720f8248bfSmrgattempt to explicitly change the value of an indicator for which
2730f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
2740f8248bfSmrgis absent or for which
2750f8248bfSmrg<symbol>XkbIM_NoExplicit</symbol>
2760f8248bfSmrgis present, keyboard state or controls are unaffected.
2770f8248bfSmrg</para>
2780f8248bfSmrg
2790f8248bfSmrg
2800f8248bfSmrg<para>
2810f8248bfSmrgFor example, a keyboard designer may want to make the
2820f8248bfSmrg<guilabel>CapsLock</guilabel>
2830f8248bfSmrgLED controllable only by the server, but allow the
2840f8248bfSmrg<guilabel>Scroll Lock</guilabel>
2850f8248bfSmrgLED to be controlled by client applications. To do so, the keyboard designer
2860f8248bfSmrgcould set the
2870f8248bfSmrg<symbol>XkbIM_NoExplicit</symbol>
2880f8248bfSmrgflag for the
2890f8248bfSmrg<guilabel>CapsLock</guilabel>
2900f8248bfSmrgLED, but not set it for the
2910f8248bfSmrg<guilabel>Scroll Lock</guilabel>
2920f8248bfSmrgLED. Or the keyboard designer may wish to allow the
2930f8248bfSmrg<guilabel>CapsLock</guilabel>
2940f8248bfSmrgLED to be controlled by both the server and client applications and also have
2950f8248bfSmrgthe server to automatically change the
2960f8248bfSmrg<emphasis>CapsLock</emphasis>
2970f8248bfSmrg
2980f8248bfSmrgmodifier state whenever a client application changes the
2990f8248bfSmrg<guilabel>CapsLock</guilabel>
3000f8248bfSmrgLED. To do so, the keyboard designer would not set the
3010f8248bfSmrg<symbol>XkbIM_NoExplicit</symbol>
3020f8248bfSmrgflag, but would instead set the
3030f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
3040f8248bfSmrgflag.
305e9fcaa8aSmrg</para>
306e9fcaa8aSmrg
307e9fcaa8aSmrg<para>
308e9fcaa8aSmrgThe remaining fields in the indicator map specify the conditions under which
3090f8248bfSmrgXkb automatically turns an indicator on or off (only if
3100f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
3110f8248bfSmrgis not set). If these conditions match the keyboard state, Xkb turns the
312e9fcaa8aSmrgindicator on. If the conditions do not match, Xkb turns the indicator off.
313e9fcaa8aSmrg</para>
314e9fcaa8aSmrg
315e9fcaa8aSmrg</sect3>
316e9fcaa8aSmrg
317eb411b4bSmrg<sect3 id='XkbIndicatorMapRec_which_groups_and_groups_fields'>
318e9fcaa8aSmrg<title>XkbIndicatorMapRec which_groups and groups fields</title>
319e9fcaa8aSmrg
320e9fcaa8aSmrg<para>
3210f8248bfSmrgThe
3220f8248bfSmrg<structfield>which_groups</structfield>
3230f8248bfSmrgand the
3240f8248bfSmrg<structfield>groups</structfield>
3250f8248bfSmrgfields of an indicator map determine how the keyboard group state affects the
3260f8248bfSmrgcorresponding indicator. The
3270f8248bfSmrg<structfield>which_groups</structfield>
3280f8248bfSmrgfield controls the interpretation of
3290f8248bfSmrg<structfield>groups</structfield>
3300f8248bfSmrgand may contain any one of the following values:
331e9fcaa8aSmrg
3320f8248bfSmrg<programlisting>
333e9fcaa8aSmrg#define XkbIM_UseNone             0
334e9fcaa8aSmrg#define XkbIM_UseBase             (1L &lt;&lt; 0)
335e9fcaa8aSmrg#define XkbIM_UseLatched          (1L &lt;&lt; 1)
336e9fcaa8aSmrg#define XkbIM_UseLocked           (1L &lt;&lt; 2)
337e9fcaa8aSmrg#define XkbIM_UseEffective        (1L &lt;&lt; 3)
338e9fcaa8aSmrg#define XkbIM_UseAnyGroup         XkbIM_UseLatched | XkbIM_UseLocked |
339e9fcaa8aSmrg                                  XkbIM_UseEffective
340e9fcaa8aSmrg</programlisting></para>
341e9fcaa8aSmrg
342e9fcaa8aSmrg<para>
3430f8248bfSmrgThe
3440f8248bfSmrg<structfield>groups</structfield>
345e9fcaa8aSmrgfield specifies what keyboard groups an indicator watches and is the bitwise
346e9fcaa8aSmrginclusive OR of the following valid values:
347e9fcaa8aSmrg
3480f8248bfSmrg<programlisting>
349e9fcaa8aSmrg#define XkbGroup1Mask            (1&lt;&lt;0)
350e9fcaa8aSmrg#define XkbGroup2Mask            (1&lt;&lt;1)
351e9fcaa8aSmrg#define XkbGroup3Mask            (1&lt;&lt;2)
352e9fcaa8aSmrg#define XkbGroup4Mask            (1&lt;&lt;3)
353e9fcaa8aSmrg#define XkbAnyGroupMask          (1&lt;&lt;7)
354e9fcaa8aSmrg#define XkbAllGroupsMask         (0xf)
355e9fcaa8aSmrg</programlisting></para>
356e9fcaa8aSmrg
357e9fcaa8aSmrg<para>
3580f8248bfSmrgIf
3590f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
3600f8248bfSmrgis not set (the keyboard drives the indicator), the effect of
3610f8248bfSmrg<structfield>which_groups</structfield>
3620f8248bfSmrgand
3630f8248bfSmrg<structfield>groups</structfield>
3640f8248bfSmrgis shown in <link linkend="table8.2">Table 8.2</link>.
365e9fcaa8aSmrg</para>
366e9fcaa8aSmrg
3670f8248bfSmrg<table id='table8.2' frame='topbot'>
368e9fcaa8aSmrg<title>XkbIndicatorMapRec which_groups and groups, Keyboard Drives
369e9fcaa8aSmrgIndicator</title>
370eb411b4bSmrg<?dbfo keep-together="always" ?>
371eb411b4bSmrg<tgroup cols='2' align='left' colsep='0' rowsep='0'>
372eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/>
373eb411b4bSmrg<colspec colname='c2' colwidth='2.0*'/>
374e9fcaa8aSmrg<thead>
375eb411b4bSmrg<row rowsep='1'>
376e9fcaa8aSmrg  <entry>which_groups</entry>
377e9fcaa8aSmrg  <entry>Effect</entry>
378e9fcaa8aSmrg  </row>
379e9fcaa8aSmrg</thead>
380e9fcaa8aSmrg<tbody>
381eb411b4bSmrg  <row>
3820f8248bfSmrg    <entry><symbol>XkbIM_UseNone</symbol></entry>
383e9fcaa8aSmrg    <entry>
3840f8248bfSmrgThe
3850f8248bfSmrg<structfield>groups</structfield>
3860f8248bfSmrgfield and the current keyboard group state are ignored.
387e9fcaa8aSmrg    </entry>
388e9fcaa8aSmrg  </row>
389eb411b4bSmrg  <row>
3900f8248bfSmrg    <entry><symbol>XkbIM_UseBase</symbol></entry>
391e9fcaa8aSmrg    <entry>
3920f8248bfSmrgIf
3930f8248bfSmrg<structfield>groups</structfield>
3940f8248bfSmrgis nonzero, the indicator is lit whenever the base keyboard group is nonzero.
3950f8248bfSmrgIf
3960f8248bfSmrg<structfield>groups</structfield>
3970f8248bfSmrgis zero, the indicator is lit whenever the base keyboard group is zero.
398e9fcaa8aSmrg    </entry>
399e9fcaa8aSmrg  </row>
400eb411b4bSmrg  <row>
4010f8248bfSmrg    <entry><symbol>XkbIM_UseLatched</symbol></entry>
402e9fcaa8aSmrg    <entry>
4030f8248bfSmrgIf
4040f8248bfSmrg<structfield>groups</structfield>
4050f8248bfSmrgis nonzero, the indicator is lit whenever the latched keyboard group is
4060f8248bfSmrgnonzero. If
4070f8248bfSmrg<structfield>groups</structfield>
4080f8248bfSmrgis zero, the indicator is lit whenever the latched keyboard group is zero.
409e9fcaa8aSmrg    </entry>
410e9fcaa8aSmrg  </row>
411eb411b4bSmrg  <row>
4120f8248bfSmrg    <entry><symbol>XkbIM_UseLocked</symbol></entry>
413e9fcaa8aSmrg    <entry>
4140f8248bfSmrgThe
4150f8248bfSmrg<structfield>groups</structfield>
4160f8248bfSmrgfield is interpreted as a mask. The indicator is lit when the current locked
4170f8248bfSmrgkeyboard group matches one of the bits that are set in
4180f8248bfSmrg<structfield>groups</structfield>.
419e9fcaa8aSmrg    </entry>
420e9fcaa8aSmrg  </row>
421eb411b4bSmrg  <row>
4220f8248bfSmrg    <entry><symbol>XkbIM_UseEffective</symbol></entry>
423e9fcaa8aSmrg    <entry>
4240f8248bfSmrgThe
4250f8248bfSmrg<structfield>groups</structfield>
4260f8248bfSmrgfield is interpreted as a mask. The indicator is lit when the current
4270f8248bfSmrgeffective keyboard group matches one of the bits that are set in
4280f8248bfSmrg<structfield>groups</structfield>.
4290f8248bfSmrg</entry>
430e9fcaa8aSmrg  </row>
431e9fcaa8aSmrg</tbody>
432e9fcaa8aSmrg</tgroup>
433e9fcaa8aSmrg</table>
434e9fcaa8aSmrg
435e9fcaa8aSmrg<para>
4360f8248bfSmrgThe effect of
4370f8248bfSmrg<structfield>which_groups</structfield>
4380f8248bfSmrgand
4390f8248bfSmrg<structfield>groups</structfield>
4400f8248bfSmrgwhen you change an indicator for which
4410f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
4420f8248bfSmrgis set (the indicator drives the keyboard) is shown in
4430f8248bfSmrg<link linkend="table8.3">Table 8.3</link>. The <quote>New State</quote>
4440f8248bfSmrgcolumn refers to the new state to which you set the indicator.
445e9fcaa8aSmrg</para>
446e9fcaa8aSmrg
4470f8248bfSmrg<table id='table8.3' frame='topbot'>
448e9fcaa8aSmrg<title>XkbIndicatorMapRec which_groups and groups, Indicator Drives
449e9fcaa8aSmrgKeyboard</title>
450eb411b4bSmrg<?dbfo keep-together="always" ?>
451eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'>
452eb411b4bSmrg<colspec colname='c1' colwidth='2.0*'/>
453eb411b4bSmrg<colspec colname='c2' colwidth='1.0*'/>
454eb411b4bSmrg<colspec colname='c3' colwidth='3.0*'/>
455e9fcaa8aSmrg<thead>
456eb411b4bSmrg<row rowsep='1'>
457e9fcaa8aSmrg  <entry>which_groups</entry>
458e9fcaa8aSmrg  <entry>New State</entry>
459e9fcaa8aSmrg  <entry>Effect on Keyboard Group State</entry>
460e9fcaa8aSmrg  </row>
461e9fcaa8aSmrg</thead>
462e9fcaa8aSmrg<tbody>
463eb411b4bSmrg  <row>
4640f8248bfSmrg    <entry><symbol>XkbIM_UseNone</symbol></entry>
465e9fcaa8aSmrg    <entry>On or Off</entry>
466e9fcaa8aSmrg    <entry>No effect</entry>
467e9fcaa8aSmrg  </row>
468eb411b4bSmrg  <row>
4690f8248bfSmrg    <entry><symbol>XkbIM_UseBase</symbol></entry>
470e9fcaa8aSmrg    <entry>On or Off</entry>
471e9fcaa8aSmrg    <entry>No effect</entry>
472e9fcaa8aSmrg  </row>
473eb411b4bSmrg  <row>
4740f8248bfSmrg    <entry><symbol>XkbIM_UseLatched</symbol></entry>
475e9fcaa8aSmrg    <entry>On</entry>
476e9fcaa8aSmrg    <entry>
4770f8248bfSmrgThe
4780f8248bfSmrg<structfield>groups</structfield>
4790f8248bfSmrgfield is treated as a group mask. The keyboard group latch is changed to the
4800f8248bfSmrglowest numbered group specified in
4810f8248bfSmrg<structfield>groups</structfield>;
4820f8248bfSmrgif
4830f8248bfSmrg<structfield>groups</structfield>
4840f8248bfSmrgis empty, the keyboard group latch is changed to zero.
485e9fcaa8aSmrg    </entry>
486e9fcaa8aSmrg  </row>
487eb411b4bSmrg  <row>
4880f8248bfSmrg    <entry><symbol>XkbIM_UseLatched</symbol></entry>
489e9fcaa8aSmrg    <entry>Off</entry>
490e9fcaa8aSmrg    <entry>
4910f8248bfSmrgThe
4920f8248bfSmrg<structfield>groups</structfield>
4930f8248bfSmrgfield is treated as a group mask. If the indicator is explicitly extinguished,
494e9fcaa8aSmrgkeyboard group latch is changed to the lowest numbered group not specified in
4950f8248bfSmrg<structfield>groups</structfield>;
4960f8248bfSmrgif
4970f8248bfSmrg<structfield>groups</structfield>
4980f8248bfSmrgis zero, the keyboard group latch is set to the index of the highest legal
499e9fcaa8aSmrgkeyboard group.
500e9fcaa8aSmrg    </entry>
501e9fcaa8aSmrg  </row>
502eb411b4bSmrg  <row>
503e9fcaa8aSmrg    <entry>XkbIM_UseLocked or XkbIM_UseEffective</entry>
504e9fcaa8aSmrg    <entry>On</entry>
505e9fcaa8aSmrg    <entry>
5060f8248bfSmrgIf the
5070f8248bfSmrg<structfield>groups</structfield>
5080f8248bfSmrgmask is empty, group is not changed; otherwise, the locked keyboard group is
5090f8248bfSmrgchanged to the lowest numbered group specified in
5100f8248bfSmrg<structfield>groups</structfield>.
511e9fcaa8aSmrg    </entry>
512e9fcaa8aSmrg  </row>
513eb411b4bSmrg  <row>
514e9fcaa8aSmrg    <entry>XkbIM_UseLocked or XkbIM_UseEffective</entry>
515e9fcaa8aSmrg    <entry>Off</entry>
516e9fcaa8aSmrg    <entry>
517e9fcaa8aSmrgLocked keyboard group is changed to the lowest numbered group that is not
5180f8248bfSmrgspecified in the
5190f8248bfSmrg<structfield>groups</structfield>
5200f8248bfSmrgmask, or to
5210f8248bfSmrg<emphasis>Group1</emphasis>
5220f8248bfSmrgif the
5230f8248bfSmrg<structfield>groups</structfield>
5240f8248bfSmrgmask contains all keyboard groups.
525e9fcaa8aSmrg    </entry>
526e9fcaa8aSmrg  </row>
527e9fcaa8aSmrg</tbody>
528e9fcaa8aSmrg</tgroup>
529e9fcaa8aSmrg</table>
530e9fcaa8aSmrg
531e9fcaa8aSmrg</sect3>
532eb411b4bSmrg<sect3 id='XkbIndicatorMapRec_which_mods_and_mods_fields'>
533e9fcaa8aSmrg<title>XkbIndicatorMapRec which_mods and mods fields</title>
534e9fcaa8aSmrg
535e9fcaa8aSmrg<para>
5360f8248bfSmrgThe
5370f8248bfSmrg<structfield>mods</structfield>
5380f8248bfSmrgfield specifies what modifiers an indicator watches. The
5390f8248bfSmrg<structfield>mods</structfield>
5400f8248bfSmrgfield is an Xkb modifier definition,
5410f8248bfSmrg<structname>XkbModsRec</structname>,
5420f8248bfSmrgas described in <link linkend="Modifier_Definitions">section 7.2</link>, which can specify both real and virtual
5430f8248bfSmrgmodifiers. The
5440f8248bfSmrg<structfield>mods</structfield>
5450f8248bfSmrgfield takes effect even if some or all of the virtual indicators specified in
5460f8248bfSmrg<structfield>mods</structfield>
5470f8248bfSmrgare unbound. To specify the mods field, in general, assign the modifiers of
5480f8248bfSmrginterest to
5490f8248bfSmrg<structfield>mods.real_mods</structfield>
5500f8248bfSmrgand the virtual modifiers of interest to
5510f8248bfSmrg<structfield>mods.vmods</structfield>.
5520f8248bfSmrgYou can disregard the
5530f8248bfSmrg<structfield>mods.mask</structfield>
5540f8248bfSmrgfield unless your application needs to interpret the indicator map directly
555e9fcaa8aSmrg(that is, to simulate automatic indicator behavior on its own). Relatively few
556e9fcaa8aSmrgapplications need to do so, but if you find it necessary, you can either read
557e9fcaa8aSmrgthe indicator map back from the server after you update it (the server
558e9fcaa8aSmrgautomatically updates the mask field whenever any of the real or virtual
5590f8248bfSmrgmodifiers are changed in the modifier definition) or you can use
5600f8248bfSmrg<function>XkbVirtualModsToReal</function>
5610f8248bfSmrgto determine the proper contents for the mask field, assuming that the
5620f8248bfSmrg<structname>XkbDescRec</structname>
5630f8248bfSmrgcontains the virtual modifier definitions.
5640f8248bfSmrg</para>
5650f8248bfSmrg
5660f8248bfSmrg<para>
5670f8248bfSmrg<structfield>which_mods</structfield>
5680f8248bfSmrgspecifies what criteria Xkb uses to determine a match with the corresponding
5690f8248bfSmrg<structfield>mods</structfield>
5700f8248bfSmrgfield by specifying one or more components of the Xkb keyboard state. If
5710f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
5720f8248bfSmrgis not set (the keyboard drives the indicator), the indicator is lit whenever
5730f8248bfSmrgany of the modifiers specified in the
5740f8248bfSmrg<structfield>mask</structfield>
5750f8248bfSmrgfield of the
5760f8248bfSmrg<structfield>mods</structfield>
5770f8248bfSmrgmodifier definition are also set in any of the current keyboard state
5780f8248bfSmrgcomponents specified by
5790f8248bfSmrg<structfield>which_mods</structfield>.
5800f8248bfSmrgRemember that the
5810f8248bfSmrg<structfield>mask</structfield>
5820f8248bfSmrgfield is comprised of all of the real modifiers specified in the definition
583e9fcaa8aSmrgplus any real modifiers that are bound to the virtual modifiers specified in
5840f8248bfSmrgthe definition. (See <xref linkend="Keyboard_State" /> for more information on the keyboard state and
5850f8248bfSmrg<xref linkend="Virtual_Modifiers" /> for more information on virtual modifiers.) Use a bitwise inclusive
5860f8248bfSmrgOR of the following values to compose a value for
5870f8248bfSmrg<structfield>which_mods</structfield>:
588e9fcaa8aSmrg
5890f8248bfSmrg<programlisting>
590e9fcaa8aSmrg#define XkbIM_UseNone             0
591e9fcaa8aSmrg#define XkbIM_UseBase             (1L &lt;&lt; 0)
592e9fcaa8aSmrg#define XkbIM_UseLatched          (1L &lt;&lt; 1)
593e9fcaa8aSmrg#define XkbIM_UseLocked           (1L &lt;&lt; 2)
594e9fcaa8aSmrg#define XkbIM_UseEffective        (1L &lt;&lt; 3)
595e9fcaa8aSmrg#define XkbIM_UseCompat           (1L &lt;&lt; 4)
596e9fcaa8aSmrg#define XkbIM_UseAnyMods          XkbIM_UseBase | XkbIM_UseLatched |
597e9fcaa8aSmrg                                  XkbIM_UseLocked | XkbIM_UseEffective |
598e9fcaa8aSmrg                                  XkbIM_UseCompat
599e9fcaa8aSmrg</programlisting></para>
600e9fcaa8aSmrg
601e9fcaa8aSmrg<para>
6020f8248bfSmrgIf
6030f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
6040f8248bfSmrgis not set (the keyboard drives the indicator), the effect of
6050f8248bfSmrg<structfield>which_mods</structfield>
6060f8248bfSmrgand
6070f8248bfSmrg<structfield>mods</structfield>
6080f8248bfSmrgis shown in <link linkend="table8.4">Table 8.4</link>
609e9fcaa8aSmrg</para>
610e9fcaa8aSmrg
6110f8248bfSmrg<table id='table8.4' frame='topbot'>
612e9fcaa8aSmrg<title>XkbIndicatorMapRec which_mods and mods, Keyboard Drives Indicator</title>
613eb411b4bSmrg<?dbfo keep-together="always" ?>
614eb411b4bSmrg<tgroup cols='2' align='left' colsep='0' rowsep='0'>
615eb411b4bSmrg<colspec colname='c1' colwidth='1.0*'/>
616eb411b4bSmrg<colspec colname='c2' colwidth='2.0*'/>
617e9fcaa8aSmrg<thead>
618eb411b4bSmrg<row rowsep='1'>
619e9fcaa8aSmrg  <entry>which_mods</entry>
620e9fcaa8aSmrg  <entry>Effect on Keyboard Modifiers</entry>
621e9fcaa8aSmrg  </row>
622e9fcaa8aSmrg</thead>
623e9fcaa8aSmrg<tbody>
624eb411b4bSmrg  <row>
6250f8248bfSmrg    <entry><symbol>XkbIM_UseNone</symbol></entry>
626e9fcaa8aSmrg    <entry>The mods field and the current keyboard modifier state are
627e9fcaa8aSmrgignored.</entry>
628e9fcaa8aSmrg  </row>
629eb411b4bSmrg  <row>
6300f8248bfSmrg    <entry><symbol>XkbIM_UseBase</symbol></entry>
631e9fcaa8aSmrg    <entry>
6320f8248bfSmrgThe indicator is lit when any of the modifiers specified in the
6330f8248bfSmrg<structfield>mask</structfield>
6340f8248bfSmrgfield of
6350f8248bfSmrg<structfield>mods</structfield>
6360f8248bfSmrgare on in the keyboard base state. If both
6370f8248bfSmrg<structfield>mods.real_mods</structfield>
6380f8248bfSmrgand
6390f8248bfSmrg<structfield>mods.vmods</structfield>
6400f8248bfSmrgare zero, the indicator is lit when the base keyboard state contains no
641e9fcaa8aSmrgmodifiers.
642e9fcaa8aSmrg    </entry>
643e9fcaa8aSmrg  </row>
644eb411b4bSmrg  <row>
6450f8248bfSmrg    <entry><symbol>XkbIM_UseLatched</symbol></entry>
646e9fcaa8aSmrg    <entry>
6470f8248bfSmrgThe indicator is lit when any of the modifiers specified in the
6480f8248bfSmrg<structfield>mask</structfield>
6490f8248bfSmrgfield of
6500f8248bfSmrg<structfield>mods</structfield>
6510f8248bfSmrgare latched. If both
6520f8248bfSmrg<structfield>mods.real_mods</structfield>
6530f8248bfSmrgand
6540f8248bfSmrg<structfield>mods.vmods</structfield>
6550f8248bfSmrgare zero, the indicator is lit when none of the modifier keys are latched.
656e9fcaa8aSmrg    </entry>
657e9fcaa8aSmrg  </row>
658eb411b4bSmrg  <row>
6590f8248bfSmrg    <entry><symbol>XkbIM_UseLocked</symbol></entry>
660e9fcaa8aSmrg    <entry>
6610f8248bfSmrgThe indicator is lit when any of the modifiers specified in the
6620f8248bfSmrg<structfield>mask</structfield>
6630f8248bfSmrgfield of
6640f8248bfSmrg<structfield>mods</structfield>
6650f8248bfSmrgare locked. If both
6660f8248bfSmrg<structfield>mods.real_mods</structfield>
6670f8248bfSmrgand
6680f8248bfSmrg<structfield>mods.vmods</structfield>
6690f8248bfSmrgare zero, the indicator is lit when none of the modifier keys are locked.
670e9fcaa8aSmrg    </entry>
671e9fcaa8aSmrg  </row>
672eb411b4bSmrg  <row>
6730f8248bfSmrg    <entry><symbol>XkbIM_UseEffective</symbol></entry>
674e9fcaa8aSmrg    <entry>
6750f8248bfSmrgThe indicator is lit when any of the modifiers specified in the
6760f8248bfSmrg<structfield>mask</structfield>
6770f8248bfSmrgfield of
6780f8248bfSmrg<structfield>mods</structfield>
6790f8248bfSmrgare in the effective keyboard state. If both
6800f8248bfSmrg<structfield>mods.real_mods</structfield>
6810f8248bfSmrgand
6820f8248bfSmrg<structfield>mods.vmods</structfield>
6830f8248bfSmrgare zero, the indicator is lit when the effective keyboard state contains no
684e9fcaa8aSmrgmodifiers.
685e9fcaa8aSmrg    </entry>
686e9fcaa8aSmrg  </row>
687eb411b4bSmrg  <row>
6880f8248bfSmrg    <entry><symbol>XkbIM_UseCompat</symbol></entry>
689e9fcaa8aSmrg    <entry>
6900f8248bfSmrgThe indicator is lit when any of the modifiers specified in the
6910f8248bfSmrg<structfield>mask</structfield>
6920f8248bfSmrgfield of
6930f8248bfSmrg<structfield>mods</structfield>
6940f8248bfSmrgare in the keyboard compatibility state. If both
6950f8248bfSmrg<structfield>mods.real_mods</structfield>
6960f8248bfSmrgand
6970f8248bfSmrg<structfield>mods.vmods</structfield>
6980f8248bfSmrgare zero, the indicator is lit when the keyboard compatibility state contains
699e9fcaa8aSmrgno modifiers.
700e9fcaa8aSmrg    </entry>
701e9fcaa8aSmrg  </row>
702e9fcaa8aSmrg</tbody>
703e9fcaa8aSmrg</tgroup>
704e9fcaa8aSmrg</table>
705e9fcaa8aSmrg
706e9fcaa8aSmrg<para>
7070f8248bfSmrgThe effect on the keyboard modifiers of
7080f8248bfSmrg<structfield>which_mods</structfield>
7090f8248bfSmrgand
7100f8248bfSmrg<structfield>mods</structfield>
7110f8248bfSmrgwhen you change an indicator for which
7120f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
7130f8248bfSmrgis set (the indicator drives the keyboard) is shown in
7140f8248bfSmrg<link linkend="table8.5">Table 8.5</link>. The <quote>New State</quote>
7150f8248bfSmrgcolumn refers to the new state to which you set the indicator.
7160f8248bfSmrg</para>
717e9fcaa8aSmrg
7180f8248bfSmrg<table id='table8.5' frame='topbot'>
719e9fcaa8aSmrg<title>XkbIndicatorMapRec which_mods and mods, Indicator Drives Keyboard</title>
720eb411b4bSmrg<?dbfo keep-together="always" ?>
721eb411b4bSmrg<tgroup cols='3' align='left' colsep='0' rowsep='0'>
722eb411b4bSmrg<colspec colname='c1' colwidth='2.0*'/>
723eb411b4bSmrg<colspec colname='c2' colwidth='1.0*'/>
724eb411b4bSmrg<colspec colname='c3' colwidth='3.0*'/>
725e9fcaa8aSmrg<thead>
726eb411b4bSmrg<row rowsep='1'>
727e9fcaa8aSmrg  <entry>which_mods</entry>
728e9fcaa8aSmrg  <entry>New State</entry>
729e9fcaa8aSmrg  <entry>Effect on Keyboard Modifiers</entry>
730e9fcaa8aSmrg  </row>
731e9fcaa8aSmrg</thead>
732e9fcaa8aSmrg<tbody>
733eb411b4bSmrg  <row>
734e9fcaa8aSmrg    <entry>XkbIM_UseNone or XkbIM_UseBase</entry>
735e9fcaa8aSmrg    <entry>On or Off</entry>
736e9fcaa8aSmrg    <entry>No Effect</entry>
737e9fcaa8aSmrg  </row>
738eb411b4bSmrg  <row>
7390f8248bfSmrg    <entry><symbol>XkbIM_UseLatched</symbol></entry>
740e9fcaa8aSmrg    <entry>On</entry>
741e9fcaa8aSmrg    <entry>
7420f8248bfSmrgAny modifiers specified in the
7430f8248bfSmrg<structfield>mask</structfield>
7440f8248bfSmrgfield of
7450f8248bfSmrg<structfield>mods</structfield>
7460f8248bfSmrgare added to the latched modifiers.
747e9fcaa8aSmrg    </entry>
748e9fcaa8aSmrg  </row>
749eb411b4bSmrg  <row>
7500f8248bfSmrg    <entry><symbol>XkbIM_UseLatched</symbol></entry>
751e9fcaa8aSmrg    <entry>Off</entry>
752e9fcaa8aSmrg    <entry>
7530f8248bfSmrgAny modifiers specified in the
7540f8248bfSmrg<structfield>mask</structfield>
7550f8248bfSmrgfield of
7560f8248bfSmrg<structfield>mods</structfield>
7570f8248bfSmrgare removed from the latched modifiers.
758e9fcaa8aSmrg    </entry>
759e9fcaa8aSmrg  </row>
760eb411b4bSmrg  <row>
761e9fcaa8aSmrg    <entry>XkbIM_UseLocked, XkbIM_UseCompat, or XkbIM_UseEffective</entry>
762e9fcaa8aSmrg    <entry>On</entry>
763e9fcaa8aSmrg    <entry>
7640f8248bfSmrgAny modifiers specified in the
7650f8248bfSmrg<structfield>mask</structfield>
7660f8248bfSmrgfield of
7670f8248bfSmrg<structfield>mods</structfield>
7680f8248bfSmrgare added to the locked modifiers.
769e9fcaa8aSmrg    </entry>
770e9fcaa8aSmrg  </row>
771eb411b4bSmrg  <row>
7720f8248bfSmrg    <entry><symbol>XkbIM_UseLocked</symbol></entry>
773e9fcaa8aSmrg    <entry>Off</entry>
774e9fcaa8aSmrg    <entry>
7750f8248bfSmrgAny modifiers specified in the
7760f8248bfSmrg<structfield>mask</structfield>
7770f8248bfSmrgfield of
7780f8248bfSmrg<structfield>mods</structfield>
7790f8248bfSmrgare removed from the locked modifiers.
780e9fcaa8aSmrg    </entry>
781e9fcaa8aSmrg  </row>
782eb411b4bSmrg  <row>
783e9fcaa8aSmrg    <entry>XkbIM_UseCompat or XkbIM_UseEffective</entry>
784e9fcaa8aSmrg    <entry>Off</entry>
785e9fcaa8aSmrg    <entry>
7860f8248bfSmrgAny modifiers specified in the
7870f8248bfSmrg<structfield>mask</structfield>
7880f8248bfSmrgfield of
7890f8248bfSmrg<structfield>mods</structfield>
7900f8248bfSmrgare removed from both the locked and latched modifiers.
791e9fcaa8aSmrg    </entry>
792e9fcaa8aSmrg  </row>
793e9fcaa8aSmrg</tbody>
794e9fcaa8aSmrg</tgroup>
795e9fcaa8aSmrg</table>
796e9fcaa8aSmrg
797e9fcaa8aSmrg</sect3>
798eb411b4bSmrg<sect3 id='XkbIndicatorMapRec_ctrls_field'>
799e9fcaa8aSmrg<title>XkbIndicatorMapRec ctrls field</title>
800e9fcaa8aSmrg
801e9fcaa8aSmrg<para>
8020f8248bfSmrgThe
8030f8248bfSmrg<structfield>ctrls</structfield>
8040f8248bfSmrgfield specifies what controls (see <xref linkend="Keyboard_Controls" />) the indicator watches and is
805e9fcaa8aSmrgcomposed using the bitwise inclusive OR of the following values:
806e9fcaa8aSmrg
8070f8248bfSmrg<programlisting>
808e9fcaa8aSmrg#define XkbRepeatKeysMask           (1L &lt;&lt; 0)
809e9fcaa8aSmrg#define XkbSlowKeysMask             (1L &lt;&lt; 1)
810e9fcaa8aSmrg#define XkbBounceKeysMask           (1L &lt;&lt; 2)
811e9fcaa8aSmrg#define XkbStickyKeysMask           (1L &lt;&lt; 3)
812e9fcaa8aSmrg#define XkbMouseKeysMask            (1L &lt;&lt; 4)
813e9fcaa8aSmrg#define XkbMouseKeysAccelMask       (1L &lt;&lt; 5)
814e9fcaa8aSmrg#define XkbAccessXKeysMask          (1L &lt;&lt; 6)
815e9fcaa8aSmrg#define XkbAccessXTimeoutMask       (1L &lt;&lt; 7)
816e9fcaa8aSmrg#define XkbAccessXFeedbackMask      (1L &lt;&lt; 8)
817e9fcaa8aSmrg#define XkbAudibleBellMask          (1L &lt;&lt; 9)
818e9fcaa8aSmrg#define XkbOverlay1Mask             (1L &lt;&lt; 10)
819e9fcaa8aSmrg#define XkbOverlay2Mask             (1L &lt;&lt; 11)
820e9fcaa8aSmrg#define XkbAllBooleanCtrlsMask      (0x00001FFF)
821e9fcaa8aSmrg</programlisting></para>
822e9fcaa8aSmrg
823e9fcaa8aSmrg<para>
824e9fcaa8aSmrgXkb lights the indicator whenever any of the boolean controls specified in
8250f8248bfSmrg<structfield>ctrls</structfield>
8260f8248bfSmrgis enabled.
827e9fcaa8aSmrg</para>
828e9fcaa8aSmrg
829e9fcaa8aSmrg
830e9fcaa8aSmrg</sect3>
831e9fcaa8aSmrg</sect2>
832e9fcaa8aSmrg</sect1>
833eb411b4bSmrg<sect1 id='Getting_Information_About_Indicators'>
834e9fcaa8aSmrg<title>Getting Information About Indicators</title>
835e9fcaa8aSmrg
836e9fcaa8aSmrg<para>
837e9fcaa8aSmrgXkb allows applications to obtain information about indicators using two
838e9fcaa8aSmrgdifferent methods. The first method, which is similar to the core X
839e9fcaa8aSmrgimplementation, uses a mask to specify the indicators. The second method, which
840e9fcaa8aSmrgis more suitable for applications concerned with interoperability, uses
841e9fcaa8aSmrgindicator names. The correspondence between the indicator name and the bit
8420f8248bfSmrgposition in masks is as follows: one of the parameters returned from
8433233502eSmrg<function>XkbGetNamedDeviceIndicator</function>
8440f8248bfSmrgis an index that is the bit position to use in any function call that requires
8450f8248bfSmrga mask of indicator bits, as well as the indicator’s index into the
8460f8248bfSmrg<structname>XkbIndicatorRec</structname>
8470f8248bfSmrgarray of indicator maps.
848e9fcaa8aSmrg</para>
849e9fcaa8aSmrg
850e9fcaa8aSmrg
851eb411b4bSmrg<sect2 id='Getting_Indicator_State'>
852e9fcaa8aSmrg<title>Getting Indicator State</title>
853e9fcaa8aSmrg
854e9fcaa8aSmrg<para>
855e9fcaa8aSmrgBecause the state of the indicators is relatively volatile, the keyboard
856e9fcaa8aSmrgdescription does not hold the current state of the indicators. To obtain the
8570f8248bfSmrgcurrent state of the keyboard indicators, use
8580f8248bfSmrg<function>XkbGetIndicatorState</function>.
8590f8248bfSmrg</para>
8600f8248bfSmrg
8610f8248bfSmrg<indexterm significance="preferred" zone="XkbGetIndicatorState"><primary><function>XkbGetIndicatorState</function></primary></indexterm>
8620f8248bfSmrg<funcsynopsis id="XkbGetIndicatorState">
8630f8248bfSmrg  <funcprototype>
8640f8248bfSmrg    <funcdef>Status <function>XkbGetIndicatorState</function></funcdef>
8650f8248bfSmrg<!-- (
8660f8248bfSmrg<parameter>display</parameter>,
8670f8248bfSmrg<parameter>device_spec</parameter>,
8680f8248bfSmrg<parameter>state_return</parameter>
8690f8248bfSmrg) -->
8700f8248bfSmrg
8710f8248bfSmrg    <paramdef>Display *<parameter>display</parameter></paramdef>
8720f8248bfSmrg    <paramdef>unsigned int <parameter>device_spec</parameter></paramdef>
8730f8248bfSmrg    <paramdef>unsigned int *<parameter>state_return</parameter></paramdef>
8740f8248bfSmrg  </funcprototype>
8750f8248bfSmrg</funcsynopsis>
8760f8248bfSmrg<variablelist>
8770f8248bfSmrg  <varlistentry>
8780f8248bfSmrg    <term>
8790f8248bfSmrg      <parameter>display</parameter>
8800f8248bfSmrg    </term>
8810f8248bfSmrg    <listitem>
8820f8248bfSmrg      <para>
8830f8248bfSmrg        connection to the X server
8840f8248bfSmrg      </para>
8850f8248bfSmrg    </listitem>
8860f8248bfSmrg  </varlistentry>
8870f8248bfSmrg  <varlistentry>
8880f8248bfSmrg    <term>
8890f8248bfSmrg      <parameter>device_spec</parameter>
8900f8248bfSmrg    </term>
8910f8248bfSmrg    <listitem>
8920f8248bfSmrg      <para>
8930f8248bfSmrg        device ID, or <symbol>XkbUseCoreKbd</symbol>
8940f8248bfSmrg      </para>
8950f8248bfSmrg    </listitem>
8960f8248bfSmrg  </varlistentry>
8970f8248bfSmrg  <varlistentry>
8980f8248bfSmrg    <term>
8990f8248bfSmrg      <parameter>state_return</parameter>
9000f8248bfSmrg    </term>
9010f8248bfSmrg    <listitem>
9020f8248bfSmrg      <para>
9030f8248bfSmrg        backfilled with a mask of the indicator state
9040f8248bfSmrg      </para>
9050f8248bfSmrg    </listitem>
9060f8248bfSmrg  </varlistentry>
9070f8248bfSmrg</variablelist>
9080f8248bfSmrg
9090f8248bfSmrg<para>
9100f8248bfSmrg<function>XkbGetIndicatorState</function>
9110f8248bfSmrgqueries the
9120f8248bfSmrg<parameter>display</parameter>
9130f8248bfSmrgfor the state of the indicators on the device specified by the
9140f8248bfSmrg<parameter>device_spec</parameter>.
9150f8248bfSmrgFor each indicator that is <quote>turned on</quote> on the device,
9160f8248bfSmrgthe associated bit is set in
9170f8248bfSmrg<parameter>state_return</parameter>.
9180f8248bfSmrgIf a compatible version of the Xkb extension is not available in the server,
9190f8248bfSmrg<function>XkbGetIndicatorState</function>
9200f8248bfSmrgreturns a
9210f8248bfSmrg<errorname>BadMatch</errorname>
9220f8248bfSmrgerror. Otherwise, it sends the request to the X server, places the state of
9230f8248bfSmrgthe indicators into
9240f8248bfSmrg<parameter>state_return</parameter>,
9250f8248bfSmrgand returns
9260f8248bfSmrg<symbol>Success</symbol>.
9270f8248bfSmrgThus the value reported by
9280f8248bfSmrg<function>XkbGetIndicatorState</function>
9290f8248bfSmrgis identical to the value reported by the core protocol.
930e9fcaa8aSmrg</para>
931e9fcaa8aSmrg
932e9fcaa8aSmrg
933e9fcaa8aSmrg</sect2>
934eb411b4bSmrg<sect2 id='Getting_Indicator_Information_by_Index'>
935e9fcaa8aSmrg<title>Getting Indicator Information by Index</title>
936e9fcaa8aSmrg
937e9fcaa8aSmrg<para>
938e9fcaa8aSmrgTo get the map for one or more indicators, using a mask to specify the
9390f8248bfSmrgindicators, use
9400f8248bfSmrg<function>XkbGetIndicatorMap</function>.
9410f8248bfSmrg</para>
9420f8248bfSmrg
9430f8248bfSmrg<indexterm significance="preferred" zone="XkbGetIndicatorMap"><primary><function>XkbGetIndicatorMap</function></primary></indexterm>
9440f8248bfSmrg<funcsynopsis id="XkbGetIndicatorMap">
9450f8248bfSmrg  <funcprototype>
9460f8248bfSmrg    <funcdef>Status <function>XkbGetIndicatorMap</function></funcdef>
9470f8248bfSmrg<!-- (
9480f8248bfSmrg<parameter>dpy</parameter>,
9490f8248bfSmrg<parameter>which</parameter>,
9500f8248bfSmrg<parameter>desc</parameter>
9510f8248bfSmrg) -->
9520f8248bfSmrg
9530f8248bfSmrg    <paramdef>Display *<parameter>dpy</parameter></paramdef>
9540f8248bfSmrg    <paramdef>unsigned int <parameter>which</parameter></paramdef>
9550f8248bfSmrg    <paramdef>XkbDescPtr <parameter>desc</parameter></paramdef>
9560f8248bfSmrg  </funcprototype>
9570f8248bfSmrg</funcsynopsis>
9580f8248bfSmrg<variablelist>
9590f8248bfSmrg  <varlistentry>
9600f8248bfSmrg    <term>
9610f8248bfSmrg      <parameter>dpy</parameter>
9620f8248bfSmrg    </term>
9630f8248bfSmrg    <listitem>
9640f8248bfSmrg      <para>
9650f8248bfSmrg        connection to the X server
9660f8248bfSmrg      </para>
9670f8248bfSmrg    </listitem>
9680f8248bfSmrg  </varlistentry>
9690f8248bfSmrg  <varlistentry>
9700f8248bfSmrg    <term>
9710f8248bfSmrg      <parameter>which</parameter>
9720f8248bfSmrg    </term>
9730f8248bfSmrg    <listitem>
9740f8248bfSmrg      <para>
9750f8248bfSmrg        mask of indicators for which maps should be returned
9760f8248bfSmrg      </para>
9770f8248bfSmrg    </listitem>
9780f8248bfSmrg  </varlistentry>
9790f8248bfSmrg  <varlistentry>
9800f8248bfSmrg    <term>
9810f8248bfSmrg      <parameter>desc</parameter>
9820f8248bfSmrg    </term>
9830f8248bfSmrg    <listitem>
9840f8248bfSmrg      <para>
9850f8248bfSmrg        keyboard description to be updated
9860f8248bfSmrg      </para>
9870f8248bfSmrg    </listitem>
9880f8248bfSmrg  </varlistentry>
9890f8248bfSmrg</variablelist>
9900f8248bfSmrg
9910f8248bfSmrg<para>
9920f8248bfSmrg<function>XkbGetIndicatorMap</function>
9930f8248bfSmrgobtains the maps from the server for only those indicators specified by the
9940f8248bfSmrg<parameter>which</parameter>
9950f8248bfSmrgmask and copies the values into the keyboard description specified by
9960f8248bfSmrg<parameter>desc</parameter>.
9970f8248bfSmrgIf the
9980f8248bfSmrg<structfield>indicators</structfield>
9990f8248bfSmrgfield of the
10000f8248bfSmrg<parameter>desc</parameter>
10010f8248bfSmrgparameter is
10020f8248bfSmrg<symbol>NULL</symbol>,
10030f8248bfSmrg<function>XkbGetIndicatorMap</function>
10040f8248bfSmrgallocates and initializes it.
10050f8248bfSmrg</para>
10060f8248bfSmrg
10070f8248bfSmrg
10080f8248bfSmrg<para>
10090f8248bfSmrg<function>XkbGetIndicatorMap</function>
10100f8248bfSmrgcan generate
10110f8248bfSmrg<errorname>BadAlloc</errorname>,
10120f8248bfSmrg<errorname>BadLength</errorname>,
10130f8248bfSmrg<errorname>BadMatch</errorname>,
10140f8248bfSmrgand
10150f8248bfSmrg<errorname>BadImplementation</errorname>
10160f8248bfSmrgerrors.
10170f8248bfSmrg</para>
10180f8248bfSmrg
10190f8248bfSmrg
10200f8248bfSmrg<para>
10210f8248bfSmrgTo free the indicator maps, use
10220f8248bfSmrg<function>XkbFreeIndicatorMaps</function>
10230f8248bfSmrg(see <link linkend="Allocating_and_Freeing_Indicator_Maps">section 8.6</link>).
1024e9fcaa8aSmrg</para>
1025e9fcaa8aSmrg
1026e9fcaa8aSmrg
1027e9fcaa8aSmrg</sect2>
1028eb411b4bSmrg<sect2 id='Getting_Indicator_Information_by_Name'>
1029e9fcaa8aSmrg<title>Getting Indicator Information by Name</title>
1030e9fcaa8aSmrg
1031e9fcaa8aSmrg<para>
10320f8248bfSmrgXkb also allows applications to refer to indicators by name. Use
10330f8248bfSmrg<function>XkbGetNames</function>
10340f8248bfSmrgto get the indicator names (see <xref linkend="Symbolic_Names" />). Using names eliminates the need
1035e9fcaa8aSmrgfor hard-coding bitmask values for particular keyboards. For example, instead
10360f8248bfSmrgof using vendor-specific constants such as
10370f8248bfSmrg<symbol>WSKBLed_ScrollLock</symbol>
10380f8248bfSmrgmask on Digital workstations or
10390f8248bfSmrg<symbol>XLED_SCROLL_LOCK</symbol>
10400f8248bfSmrgon Sun workstations, you can instead use
10413233502eSmrg<function>XkbGetNamedDeviceIndicator</function> or
10420f8248bfSmrg<function>XkbGetNamedIndicator</function>
10430f8248bfSmrgto look up information on the indicator named <quote>Scroll Lock.</quote>
10440f8248bfSmrg</para>
10450f8248bfSmrg
10460f8248bfSmrg<para>
10470f8248bfSmrgUse
10483233502eSmrg<function>XkbGetNamedDeviceIndicator</function>
10493233502eSmrgto look up the indicator map and other information for an indicator by name
10503233502eSmrgon a specific device.
10510f8248bfSmrg</para>
10520f8248bfSmrg
10533233502eSmrg<indexterm significance="preferred" zone="XkbGetNamedDeviceIndicator"><primary><function>XkbGetNamedDeviceIndicator</function></primary></indexterm>
10543233502eSmrg<funcsynopsis id="XkbGetNamedDeviceIndicator">
10550f8248bfSmrg  <funcprototype>
10563233502eSmrg    <funcdef>Bool <function>XkbGetNamedDeviceIndicator</function></funcdef>
10570f8248bfSmrg<!-- (
10580f8248bfSmrg<parameter>dpy</parameter>,
10590f8248bfSmrg<parameter>dev_spec</parameter>,
10600f8248bfSmrg<parameter>name</parameter>,
10610f8248bfSmrg<parameter>ndx_rtrn</parameter>,
10620f8248bfSmrg<parameter>state_rtrn</parameter>,
10630f8248bfSmrg<parameter>map_rtrn</parameter>,
10640f8248bfSmrg<parameter>real_rtrn</parameter>
10650f8248bfSmrg) -->
10660f8248bfSmrg
10670f8248bfSmrg    <paramdef>Display *<parameter>dpy</parameter></paramdef>
10680f8248bfSmrg    <paramdef>unsigned int <parameter>device_spec</parameter></paramdef>
10693233502eSmrg    <paramdef>unsigned int <parameter>led_class</parameter></paramdef>
10703233502eSmrg    <paramdef>unsigned int <parameter>led_id</parameter></paramdef>
10710f8248bfSmrg    <paramdef>Atom <parameter>name</parameter></paramdef>
10720f8248bfSmrg    <paramdef>int *<parameter>ndx_rtrn</parameter></paramdef>
10730f8248bfSmrg    <paramdef>Bool *<parameter>state_rtrn</parameter></paramdef>
10740f8248bfSmrg    <paramdef>XkbIndicatorMapPtr <parameter>map_rtrn</parameter></paramdef>
10750f8248bfSmrg    <paramdef>Bool *<parameter>real_rtrn</parameter></paramdef>
10760f8248bfSmrg  </funcprototype>
10770f8248bfSmrg</funcsynopsis>
10780f8248bfSmrg<variablelist>
10790f8248bfSmrg  <varlistentry>
10800f8248bfSmrg    <term>
10810f8248bfSmrg      <parameter>dpy</parameter>
10820f8248bfSmrg    </term>
10830f8248bfSmrg    <listitem>
10840f8248bfSmrg      <para>
10850f8248bfSmrg        connection to the X server
10860f8248bfSmrg      </para>
10870f8248bfSmrg    </listitem>
10880f8248bfSmrg  </varlistentry>
10890f8248bfSmrg  <varlistentry>
10900f8248bfSmrg    <term>
10910f8248bfSmrg      <parameter>device_spec</parameter>
10920f8248bfSmrg    </term>
10930f8248bfSmrg    <listitem>
10940f8248bfSmrg      <para>
10950f8248bfSmrg        keyboard device ID, or <symbol>XkbUseCoreKbd</symbol>
10960f8248bfSmrg      </para>
10970f8248bfSmrg    </listitem>
10980f8248bfSmrg  </varlistentry>
10993233502eSmrg  <varlistentry>
11003233502eSmrg    <term>
11013233502eSmrg      <parameter>led_class</parameter>
11023233502eSmrg    </term>
11033233502eSmrg    <listitem>
11043233502eSmrg      <para>
11053233502eSmrg        feedback class, or <symbol>XkbDfltXIClass</symbol>
11063233502eSmrg      </para>
11073233502eSmrg    </listitem>
11083233502eSmrg  </varlistentry>
11093233502eSmrg  <varlistentry>
11103233502eSmrg    <term>
11113233502eSmrg      <parameter>led_id</parameter>
11123233502eSmrg    </term>
11133233502eSmrg    <listitem>
11143233502eSmrg      <para>
11153233502eSmrg        feedback ID, or <symbol>XkbDfltXIId</symbol>
11163233502eSmrg      </para>
11173233502eSmrg    </listitem>
11183233502eSmrg  </varlistentry>
11190f8248bfSmrg  <varlistentry>
11200f8248bfSmrg    <term>
11210f8248bfSmrg      <parameter>name</parameter>
11220f8248bfSmrg    </term>
11230f8248bfSmrg    <listitem>
11240f8248bfSmrg      <para>
11250f8248bfSmrg        name of the indicator to be retrieved
11260f8248bfSmrg      </para>
11270f8248bfSmrg    </listitem>
11280f8248bfSmrg  </varlistentry>
11290f8248bfSmrg  <varlistentry>
11300f8248bfSmrg    <term>
11310f8248bfSmrg      <parameter>ndx_rtrn</parameter>
11320f8248bfSmrg    </term>
11330f8248bfSmrg    <listitem>
11340f8248bfSmrg      <para>
11350f8248bfSmrg        backfilled with the index of the retrieved indicator
11360f8248bfSmrg      </para>
11370f8248bfSmrg    </listitem>
11380f8248bfSmrg  </varlistentry>
11390f8248bfSmrg  <varlistentry>
11400f8248bfSmrg    <term>
11410f8248bfSmrg      <parameter>state_rtrn</parameter>
11420f8248bfSmrg    </term>
11430f8248bfSmrg    <listitem>
11440f8248bfSmrg      <para>
11450f8248bfSmrg        backfilled with the current state of the retrieved indicator
11460f8248bfSmrg      </para>
11470f8248bfSmrg    </listitem>
11480f8248bfSmrg  </varlistentry>
11490f8248bfSmrg  <varlistentry>
11500f8248bfSmrg    <term>
11510f8248bfSmrg      <parameter>map_rtrn</parameter>
11520f8248bfSmrg    </term>
11530f8248bfSmrg    <listitem>
11540f8248bfSmrg      <para>
11550f8248bfSmrg        backfilled with the mapping for the retrieved indicator
11560f8248bfSmrg      </para>
11570f8248bfSmrg    </listitem>
11580f8248bfSmrg  </varlistentry>
11590f8248bfSmrg  <varlistentry>
11600f8248bfSmrg    <term>
11610f8248bfSmrg      <parameter>real_rtrn</parameter>
11620f8248bfSmrg    </term>
11630f8248bfSmrg    <listitem>
11640f8248bfSmrg      <para>
11650f8248bfSmrg        backfilled with <symbol>True</symbol>
11660f8248bfSmrg         if the named indicator is real (physical)
11670f8248bfSmrg      </para>
11680f8248bfSmrg    </listitem>
11690f8248bfSmrg  </varlistentry>
11700f8248bfSmrg</variablelist>
11710f8248bfSmrg
11720f8248bfSmrg<para>
11730f8248bfSmrgIf the device specified by
11740f8248bfSmrg<parameter>device_spec</parameter>
11753233502eSmrgwith feedback specified by
11763233502eSmrg<parameter>led_class</parameter> and <parameter>led_id</parameter>
11770f8248bfSmrghas an indicator named
11780f8248bfSmrg<parameter>name</parameter>,
11793233502eSmrg<function>XkbGetNamedDeviceIndicator</function>
11800f8248bfSmrgreturns
11810f8248bfSmrg<symbol>True</symbol>
11820f8248bfSmrgand populates the rest of the parameters with information about the indicator.
11830f8248bfSmrgOtherwise,
11843233502eSmrg<function>XkbGetNamedDeviceIndicator</function>
11850f8248bfSmrgreturns
11860f8248bfSmrg<symbol>False</symbol>.
11870f8248bfSmrg</para>
11880f8248bfSmrg
11890f8248bfSmrg
11900f8248bfSmrg<para>
11910f8248bfSmrgThe
11920f8248bfSmrg<parameter>ndx_rtrn</parameter>
11930f8248bfSmrgfield returns the zero-based index of the named indicator. This index is the
1194e9fcaa8aSmrgbit position to use in any function call that requires a mask of indicator
11950f8248bfSmrgbits, as well as the indicator’s index into the
11960f8248bfSmrg<structname>XkbIndicatorRec</structname>
11970f8248bfSmrgarray of indicator maps.
11980f8248bfSmrg<parameter>state_rtrn</parameter>
11990f8248bfSmrgreturns the current state of the named indicator
12000f8248bfSmrg(<symbol>True</symbol>
12010f8248bfSmrg= on,
12020f8248bfSmrg<symbol>False</symbol>
12030f8248bfSmrg= off).
12040f8248bfSmrg<parameter>map_rtrn</parameter>
12050f8248bfSmrgreturns the indicator map for the named indicator. In addition, if the
12060f8248bfSmrgindicator is mapped to a physical LED, the
12070f8248bfSmrg<parameter>real_rtrn</parameter>
12080f8248bfSmrgparameter is set to
12090f8248bfSmrg<symbol>True</symbol>.
1210e9fcaa8aSmrg</para>
1211e9fcaa8aSmrg
1212e9fcaa8aSmrg
1213e9fcaa8aSmrg<para>
12140f8248bfSmrgEach of the "<parameter>_rtrn</parameter>" arguments is optional; you can pass
12150f8248bfSmrg<symbol>NULL</symbol>
12160f8248bfSmrgfor any unneeded "<parameter>_rtrn</parameter>" arguments.
1217e9fcaa8aSmrg</para>
1218e9fcaa8aSmrg
1219e9fcaa8aSmrg
1220e9fcaa8aSmrg<para>
12213233502eSmrg<function>XkbGetNamedDeviceIndicator</function>
12220f8248bfSmrgcan generate
12230f8248bfSmrg<errorname>BadAtom</errorname>
12240f8248bfSmrgand
12250f8248bfSmrg<errorname>BadImplementation</errorname>
12260f8248bfSmrgerrors.
1227e9fcaa8aSmrg</para>
1228e9fcaa8aSmrg
12293233502eSmrg<para>
12303233502eSmrgAs a convenience function, Xkb provides a function to get information about
12313233502eSmrgindicators with the default class and identifier on the default device:
12323233502eSmrg<function>XkbGetNamedIndicator</function>.
12333233502eSmrg</para>
12343233502eSmrg
12353233502eSmrg
12363233502eSmrg<indexterm significance="preferred" zone="XkbGetNamedIndicator"><primary><function>XkbGetNamedIndicator</function></primary></indexterm>
12373233502eSmrg<funcsynopsis id="XkbGetNamedIndicator">
12383233502eSmrg  <funcprototype>
12393233502eSmrg    <funcdef>Bool <function>XkbGetNamedIndicator</function></funcdef>
12403233502eSmrg    <paramdef>Display *<parameter>dpy</parameter></paramdef>
12413233502eSmrg    <paramdef>Atom <parameter>name</parameter></paramdef>
12423233502eSmrg    <paramdef>int *<parameter>ndx_rtrn</parameter></paramdef>
12433233502eSmrg    <paramdef>Bool *<parameter>state_rtrn</parameter></paramdef>
12443233502eSmrg    <paramdef>XkbIndicatorMapPtr <parameter>map_rtrn</parameter></paramdef>
12453233502eSmrg    <paramdef>Bool *<parameter>real_rtrn</parameter></paramdef>
12463233502eSmrg  </funcprototype>
12473233502eSmrg</funcsynopsis>
12483233502eSmrg<variablelist>
12493233502eSmrg  <varlistentry>
12503233502eSmrg    <term>
12513233502eSmrg      <parameter>dpy</parameter>
12523233502eSmrg    </term>
12533233502eSmrg    <listitem>
12543233502eSmrg      <para>
12553233502eSmrg        connection to the X server
12563233502eSmrg      </para>
12573233502eSmrg    </listitem>
12583233502eSmrg  </varlistentry>
12593233502eSmrg  <varlistentry>
12603233502eSmrg    <term>
12613233502eSmrg      <parameter>name</parameter>
12623233502eSmrg    </term>
12633233502eSmrg    <listitem>
12643233502eSmrg      <para>
12653233502eSmrg        name of the indicator to be retrieved
12663233502eSmrg      </para>
12673233502eSmrg    </listitem>
12683233502eSmrg  </varlistentry>
12693233502eSmrg  <varlistentry>
12703233502eSmrg    <term>
12713233502eSmrg      <parameter>ndx_rtrn</parameter>
12723233502eSmrg    </term>
12733233502eSmrg    <listitem>
12743233502eSmrg      <para>
12753233502eSmrg        backfilled with the index of the retrieved indicator
12763233502eSmrg      </para>
12773233502eSmrg    </listitem>
12783233502eSmrg  </varlistentry>
12793233502eSmrg  <varlistentry>
12803233502eSmrg    <term>
12813233502eSmrg      <parameter>state_rtrn</parameter>
12823233502eSmrg    </term>
12833233502eSmrg    <listitem>
12843233502eSmrg      <para>
12853233502eSmrg        backfilled with the current state of the retrieved indicator
12863233502eSmrg      </para>
12873233502eSmrg    </listitem>
12883233502eSmrg  </varlistentry>
12893233502eSmrg  <varlistentry>
12903233502eSmrg    <term>
12913233502eSmrg      <parameter>map_rtrn</parameter>
12923233502eSmrg    </term>
12933233502eSmrg    <listitem>
12943233502eSmrg      <para>
12953233502eSmrg        backfilled with the mapping for the retrieved indicator
12963233502eSmrg      </para>
12973233502eSmrg    </listitem>
12983233502eSmrg  </varlistentry>
12993233502eSmrg  <varlistentry>
13003233502eSmrg    <term>
13013233502eSmrg      <parameter>real_rtrn</parameter>
13023233502eSmrg    </term>
13033233502eSmrg    <listitem>
13043233502eSmrg      <para>
13053233502eSmrg        backfilled with <symbol>True</symbol>
13063233502eSmrg         if the named indicator is real (physical)
13073233502eSmrg      </para>
13083233502eSmrg    </listitem>
13093233502eSmrg  </varlistentry>
13103233502eSmrg</variablelist>
13113233502eSmrg
13123233502eSmrg<para>
13133233502eSmrg<function>XkbGetNamedIndicator</function>
13143233502eSmrgcalls
13153233502eSmrg<function>XkbGetNamedDeviceIndicator</function>
13163233502eSmrgwith the specified parameters, a
13173233502eSmrg<structfield>device_spec</structfield>
13183233502eSmrgof
13193233502eSmrg<symbol>XkbUseCoreKbd</symbol>,
13203233502eSmrga
13213233502eSmrg<structfield>led_class</structfield>
13223233502eSmrgof
13233233502eSmrg<symbol>XkbDfltXIClass</symbol>,
13243233502eSmrgand a
13253233502eSmrg<structfield>led_id</structfield>
13263233502eSmrgof
13273233502eSmrg<symbol>XkbDfltXIId</symbol>,
13283233502eSmrgand returns the value which was returned by
13293233502eSmrg<function>XkbGetNamedDeviceIndicator</function>.
13303233502eSmrg</para>
1331e9fcaa8aSmrg
1332e9fcaa8aSmrg</sect2>
1333e9fcaa8aSmrg</sect1>
1334eb411b4bSmrg<sect1 id='Changing_Indicator_Maps_and_State'>
1335e9fcaa8aSmrg<title>Changing Indicator Maps and State</title>
1336e9fcaa8aSmrg
1337e9fcaa8aSmrg<para>
1338e9fcaa8aSmrgJust as you can get the indicator map using a mask or using an indicator name,
1339e9fcaa8aSmrgso you can change it using a mask or a name.
1340e9fcaa8aSmrg</para>
1341e9fcaa8aSmrg
13420f8248bfSmrg<note><para>You cannot change the
13430f8248bfSmrg<structfield>phys_indicators</structfield>
13440f8248bfSmrgfield of the indicators structure. The only way to change the
13450f8248bfSmrg<structfield>phys_indicators</structfield>
13460f8248bfSmrgfield is to change the keyboard map.</para></note>
1347e9fcaa8aSmrg
1348e9fcaa8aSmrg<para>
1349cbfda780SmrgTo make changes to indicator maps and state, change a
13500f8248bfSmrglocal copy of the indicator maps and use
13510f8248bfSmrg<function>XkbSetIndicatorMap</function>
13520f8248bfSmrgor
1353cbfda780Smrg<function>XkbSetNamedDeviceIndicator</function>.
1354e9fcaa8aSmrg</para>
1355e9fcaa8aSmrg
1356e9fcaa8aSmrg
1357eb411b4bSmrg<sect2 id='Effects_of_Explicit_Changes_on_Indicators'>
1358e9fcaa8aSmrg<title>Effects of Explicit Changes on Indicators</title>
1359e9fcaa8aSmrg
1360e9fcaa8aSmrg<para>
1361e9fcaa8aSmrgThis section discusses the effects of explicitly changing indicators depending
13620f8248bfSmrgupon different settings in the indicator map. See
13630f8248bfSmrg<link linkend="table8.3">Table 8.3</link> and
13640f8248bfSmrg<link linkend="table8.5">Table 8.5</link> for
1365e9fcaa8aSmrginformation on the effects of the indicator map fields when explicit changes
1366e9fcaa8aSmrgare made.
1367e9fcaa8aSmrg</para>
1368e9fcaa8aSmrg
1369e9fcaa8aSmrg
1370e9fcaa8aSmrg<para>
13710f8248bfSmrgIf
13720f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
13730f8248bfSmrgis set and
13740f8248bfSmrg<symbol>XkbIM_NoExplicit</symbol>
13750f8248bfSmrgis not, and if you call a function that updates the server’s image of the
13760f8248bfSmrgindicator map (such as
13770f8248bfSmrg<function>XkbSetIndicatorMap</function>
13780f8248bfSmrgor
13793233502eSmrg<function>XkbSetNamedDeviceIndicator</function>),
13800f8248bfSmrgXkb changes the keyboard state and controls to reflect the other fields of
1381e9fcaa8aSmrgthe indicator map. If you attempt to explicitly change the value of an
13820f8248bfSmrgindicator for which
13830f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
13840f8248bfSmrgis absent or for which
13850f8248bfSmrg<symbol>XkbIM_NoExplicit</symbol>
13860f8248bfSmrgis present, keyboard state or controls are unaffected.
1387e9fcaa8aSmrg</para>
1388e9fcaa8aSmrg
1389e9fcaa8aSmrg
1390e9fcaa8aSmrg<para>
13910f8248bfSmrgIf neither
13920f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
13930f8248bfSmrgnor
13940f8248bfSmrg<symbol>XkbIM_NoExplicit</symbol>
13950f8248bfSmrgis set in an indicator map, Xkb honors any request to change the state of the
1396e9fcaa8aSmrgindicator, but the new state might be immediately superseded by automatic
1397e9fcaa8aSmrgchanges to the indicator state if the keyboard state or controls change.
1398e9fcaa8aSmrg</para>
1399e9fcaa8aSmrg
1400e9fcaa8aSmrg
1401e9fcaa8aSmrg<para>
1402e9fcaa8aSmrgThe effects of changing an indicator that drives the keyboard are cumulative;
1403e9fcaa8aSmrgit is possible for a single change to affect keyboard group, modifiers, and
1404e9fcaa8aSmrgcontrols simultaneously.
1405e9fcaa8aSmrg</para>
1406e9fcaa8aSmrg
1407e9fcaa8aSmrg
1408e9fcaa8aSmrg<para>
14090f8248bfSmrgIf you change an indicator for which both the
14100f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
14110f8248bfSmrgand
14120f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
14130f8248bfSmrgflags are specified, Xkb applies the keyboard changes specified in the other
1414e9fcaa8aSmrgindicator map fields and changes the indicator to reflect the state that was
1415e9fcaa8aSmrgexplicitly requested. The indicator remains in the new state until it is
1416e9fcaa8aSmrgexplicitly changed again.
1417e9fcaa8aSmrg</para>
1418e9fcaa8aSmrg
1419e9fcaa8aSmrg
1420e9fcaa8aSmrg<para>
14210f8248bfSmrgIf the
14220f8248bfSmrg<symbol>XkbIM_NoAutomatic</symbol>
14230f8248bfSmrgflag is not set and
14240f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
14250f8248bfSmrgis set, Xkb applies the changes specified in the other indicator map fields
1426e9fcaa8aSmrgand sets the state of the indicator to the values specified by the indicator
1427e9fcaa8aSmrgmap. Note that it is possible in this case for the indicator to end up in a
1428e9fcaa8aSmrgdifferent state than the one that was explicitly requested. For example, Xkb
14290f8248bfSmrgdoes not extinguish an indicator with
14300f8248bfSmrg<structfield>which_mods</structfield>
14310f8248bfSmrgof
14320f8248bfSmrg<symbol>XkbIM_UseBase</symbol>
14330f8248bfSmrgand
14340f8248bfSmrg<structfield>mods</structfield>
14350f8248bfSmrgof
14360f8248bfSmrg<symbol>Shift</symbol>
14370f8248bfSmrgif, at the time Xkb processes the request to extinguish the indicator, one of
14380f8248bfSmrgthe
14390f8248bfSmrg<symbol>Shift</symbol>
14400f8248bfSmrgkeys is physically depressed.
1441e9fcaa8aSmrg</para>
1442e9fcaa8aSmrg
1443e9fcaa8aSmrg
1444e9fcaa8aSmrg<para>
14450f8248bfSmrgIf you explicitly light an indicator for which
14460f8248bfSmrg<symbol>XkbIM_LEDDrivesKB</symbol>
14470f8248bfSmrgis set, Xkb enables all of the boolean controls specified in the
14480f8248bfSmrg<structfield>ctrls</structfield>
14490f8248bfSmrgfield of its indicator map. Explicitly extinguishing such an indicator causes
14500f8248bfSmrgXkb to disable all of the boolean controls specified in
14510f8248bfSmrg<structfield>ctrls</structfield>.
1452e9fcaa8aSmrg</para>
1453e9fcaa8aSmrg
1454e9fcaa8aSmrg
1455e9fcaa8aSmrg</sect2>
1456eb411b4bSmrg<sect2 id='Changing_Indicator_Maps_by_Index'>
1457e9fcaa8aSmrg<title>Changing Indicator Maps by Index</title>
1458e9fcaa8aSmrg
1459e9fcaa8aSmrg<para>
1460e9fcaa8aSmrgTo update the maps for one or more indicators, first modify a local copy of the
14610f8248bfSmrgkeyboard description, then use
14620f8248bfSmrg<function>XkbSetIndicatorMap</function>
14630f8248bfSmrgto download the changes to the server:
14640f8248bfSmrg</para>
14650f8248bfSmrg
14660f8248bfSmrg<indexterm significance="preferred" zone="XkbSetIndicatorMap"><primary><function>XkbSetIndicatorMap</function></primary></indexterm>
14670f8248bfSmrg<funcsynopsis id="XkbSetIndicatorMap">
14680f8248bfSmrg  <funcprototype>
14690f8248bfSmrg    <funcdef>Bool <function>XkbSetIndicatorMap</function></funcdef>
14700f8248bfSmrg<!-- (
14710f8248bfSmrg<parameter>dpy</parameter>,
14720f8248bfSmrg<parameter>which</parameter>,
14730f8248bfSmrg<parameter>desc</parameter>
14740f8248bfSmrg) -->
14750f8248bfSmrg
14760f8248bfSmrg    <paramdef>Display *<parameter>dpy</parameter></paramdef>
14770f8248bfSmrg    <paramdef>unsigned int <parameter>which</parameter></paramdef>
14780f8248bfSmrg    <paramdef>XkbDescPtr <parameter>desc</parameter></paramdef>
14790f8248bfSmrg  </funcprototype>
14800f8248bfSmrg</funcsynopsis>
14810f8248bfSmrg<variablelist>
14820f8248bfSmrg  <varlistentry>
14830f8248bfSmrg    <term>
14840f8248bfSmrg      <parameter>dpy</parameter>
14850f8248bfSmrg    </term>
14860f8248bfSmrg    <listitem>
14870f8248bfSmrg      <para>
14880f8248bfSmrg        connection to the X server
14890f8248bfSmrg      </para>
14900f8248bfSmrg    </listitem>
14910f8248bfSmrg  </varlistentry>
14920f8248bfSmrg  <varlistentry>
14930f8248bfSmrg    <term>
14940f8248bfSmrg      <parameter>which</parameter>
14950f8248bfSmrg    </term>
14960f8248bfSmrg    <listitem>
14970f8248bfSmrg      <para>
14980f8248bfSmrg        mask of indicators to change
14990f8248bfSmrg      </para>
15000f8248bfSmrg    </listitem>
15010f8248bfSmrg  </varlistentry>
15020f8248bfSmrg  <varlistentry>
15030f8248bfSmrg    <term>
15040f8248bfSmrg      <parameter>desc</parameter>
15050f8248bfSmrg    </term>
15060f8248bfSmrg    <listitem>
15070f8248bfSmrg      <para>
15080f8248bfSmrg        keyboard description from which the maps are taken
15090f8248bfSmrg      </para>
15100f8248bfSmrg    </listitem>
15110f8248bfSmrg  </varlistentry>
15120f8248bfSmrg</variablelist>
15130f8248bfSmrg
15140f8248bfSmrg<para>
15150f8248bfSmrgFor each
15160f8248bfSmrgbit set in the
15170f8248bfSmrg<parameter>which</parameter>
15180f8248bfSmrgparameter,
15190f8248bfSmrg<function>XkbSetIndicatorMap</function>
15200f8248bfSmrgsends the corresponding indicator map from the
15210f8248bfSmrg<parameter>desc</parameter>
15220f8248bfSmrgparameter to the server.
1523e9fcaa8aSmrg</para>
1524e9fcaa8aSmrg
1525e9fcaa8aSmrg
1526e9fcaa8aSmrg</sect2>
1527eb411b4bSmrg<sect2 id='Changing_Indicator_Maps_by_Name'>
1528e9fcaa8aSmrg<title>Changing Indicator Maps by Name</title>
1529e9fcaa8aSmrg
1530e9fcaa8aSmrg<para>
15313233502eSmrg<function>XkbSetNamedDeviceIndicator</function> and
15320f8248bfSmrg<function>XkbSetNamedIndicator</function>
15330f8248bfSmrgcan do several related things:
1534e9fcaa8aSmrg</para>
1535e9fcaa8aSmrg
1536e9fcaa8aSmrg<itemizedlist>
1537e9fcaa8aSmrg<listitem>
1538e9fcaa8aSmrg  <para>
1539e9fcaa8aSmrgName an indicator if it is not already named
1540e9fcaa8aSmrg  </para>
1541e9fcaa8aSmrg</listitem>
1542e9fcaa8aSmrg<listitem>
1543e9fcaa8aSmrg  <para>
1544e9fcaa8aSmrgToggle the state of the indicator
1545e9fcaa8aSmrg  </para>
1546e9fcaa8aSmrg</listitem>
1547e9fcaa8aSmrg<listitem>
1548e9fcaa8aSmrg  <para>
1549e9fcaa8aSmrgSet the indicator to a specified state
1550e9fcaa8aSmrg  </para>
1551e9fcaa8aSmrg</listitem>
1552e9fcaa8aSmrg<listitem>
1553e9fcaa8aSmrg  <para>
1554e9fcaa8aSmrgSet the indicator map for the indicator
1555e9fcaa8aSmrg  </para>
1556e9fcaa8aSmrg</listitem>
1557e9fcaa8aSmrg</itemizedlist>
1558e9fcaa8aSmrg
15593233502eSmrg<indexterm significance="preferred" zone="XkbSetNamedDeviceIndicator"><primary><function>XkbSetNamedDeviceIndicator</function></primary></indexterm>
15603233502eSmrg<funcsynopsis id="XkbSetNamedDeviceIndicator">
15610f8248bfSmrg  <funcprototype>
15623233502eSmrg    <funcdef>Bool<function>XkbSetNamedDeviceIndicator</function></funcdef>
15630f8248bfSmrg<!-- (
15640f8248bfSmrg<parameter>dpy</parameter>,
15650f8248bfSmrg<parameter>device_spec</parameter>,
15660f8248bfSmrg<parameter>name</parameter>,
15670f8248bfSmrg<parameter>change_state, state</parameter>,
15680f8248bfSmrg<parameter>create_new</parameter>,
15690f8248bfSmrg<parameter>map</parameter>
15700f8248bfSmrg) -->
15710f8248bfSmrg
15720f8248bfSmrg    <paramdef>Display *<parameter>dpy</parameter></paramdef>
15730f8248bfSmrg    <paramdef>unsigned int <parameter>device_spec</parameter></paramdef>
15743233502eSmrg    <paramdef>unsigned int <parameter>led_class</parameter></paramdef>
15753233502eSmrg    <paramdef>unsigned int <parameter>led_id</parameter></paramdef>
15760f8248bfSmrg    <paramdef>Atom <parameter>name</parameter></paramdef>
15770f8248bfSmrg    <paramdef>Bool <parameter>change_state</parameter></paramdef>
15780f8248bfSmrg    <paramdef>Bool <parameter>state</parameter></paramdef>
15790f8248bfSmrg    <paramdef>Bool <parameter>create_new</parameter></paramdef>
15800f8248bfSmrg    <paramdef>XkbIndicatorMapPtr <parameter>map</parameter></paramdef>
15810f8248bfSmrg  </funcprototype>
15820f8248bfSmrg</funcsynopsis>
15830f8248bfSmrg<variablelist>
15840f8248bfSmrg  <varlistentry>
15850f8248bfSmrg    <term>
15860f8248bfSmrg      <parameter>dpy</parameter>
15870f8248bfSmrg    </term>
15880f8248bfSmrg    <listitem>
15890f8248bfSmrg      <para>
15900f8248bfSmrg        connection to the X server
15910f8248bfSmrg      </para>
15920f8248bfSmrg    </listitem>
15930f8248bfSmrg  </varlistentry>
15940f8248bfSmrg  <varlistentry>
15950f8248bfSmrg    <term>
15960f8248bfSmrg      <parameter>device_spec</parameter>
15970f8248bfSmrg    </term>
15980f8248bfSmrg    <listitem>
15990f8248bfSmrg      <para>
16000f8248bfSmrg        device ID, or <symbol>XkbUseCoreKbd</symbol>
16010f8248bfSmrg      </para>
16020f8248bfSmrg    </listitem>
16030f8248bfSmrg  </varlistentry>
16043233502eSmrg  <varlistentry>
16053233502eSmrg    <term>
16063233502eSmrg      <parameter>led_class</parameter>
16073233502eSmrg    </term>
16083233502eSmrg    <listitem>
16093233502eSmrg      <para>
16103233502eSmrg        feedback class, or <symbol>XkbDfltXIClass</symbol>
16113233502eSmrg      </para>
16123233502eSmrg    </listitem>
16133233502eSmrg  </varlistentry>
16143233502eSmrg  <varlistentry>
16153233502eSmrg    <term>
16163233502eSmrg      <parameter>led_id</parameter>
16173233502eSmrg    </term>
16183233502eSmrg    <listitem>
16193233502eSmrg      <para>
16203233502eSmrg        feedback ID, or <symbol>XkbDfltXIId</symbol>
16213233502eSmrg      </para>
16223233502eSmrg    </listitem>
16233233502eSmrg  </varlistentry>
16240f8248bfSmrg  <varlistentry>
16250f8248bfSmrg    <term>
16260f8248bfSmrg      <parameter>name</parameter>
16270f8248bfSmrg    </term>
16280f8248bfSmrg    <listitem>
16290f8248bfSmrg      <para>
16300f8248bfSmrg        name of the indicator to change
16310f8248bfSmrg      </para>
16320f8248bfSmrg    </listitem>
16330f8248bfSmrg  </varlistentry>
16340f8248bfSmrg  <varlistentry>
16350f8248bfSmrg    <term>
16360f8248bfSmrg      <parameter>change_state</parameter>
16370f8248bfSmrg    </term>
16380f8248bfSmrg    <listitem>
16390f8248bfSmrg      <para>
16400f8248bfSmrg        whether to change the indicator state or not
16410f8248bfSmrg      </para>
16420f8248bfSmrg    </listitem>
16430f8248bfSmrg  </varlistentry>
16440f8248bfSmrg  <varlistentry>
16450f8248bfSmrg    <term>
16460f8248bfSmrg      <parameter>state</parameter>
16470f8248bfSmrg    </term>
16480f8248bfSmrg    <listitem>
16490f8248bfSmrg      <para>
16500f8248bfSmrg        desired new state for the indicator
16510f8248bfSmrg      </para>
16520f8248bfSmrg    </listitem>
16530f8248bfSmrg  </varlistentry>
16540f8248bfSmrg  <varlistentry>
16550f8248bfSmrg    <term>
16560f8248bfSmrg      <parameter>create_new</parameter>
16570f8248bfSmrg    </term>
16580f8248bfSmrg    <listitem>
16590f8248bfSmrg      <para>
16600f8248bfSmrg        whether a new indicator with the specified name should be
16610f8248bfSmrg        created when necessary
16620f8248bfSmrg      </para>
16630f8248bfSmrg    </listitem>
16640f8248bfSmrg  </varlistentry>
16650f8248bfSmrg  <varlistentry>
16660f8248bfSmrg    <term>
16670f8248bfSmrg      <parameter>map</parameter>
16680f8248bfSmrg    </term>
16690f8248bfSmrg    <listitem>
16700f8248bfSmrg      <para>
16710f8248bfSmrg        new map for the indicator
16720f8248bfSmrg      </para>
16730f8248bfSmrg    </listitem>
16740f8248bfSmrg  </varlistentry>
16750f8248bfSmrg</variablelist>
1676e9fcaa8aSmrg
1677e9fcaa8aSmrg<para>
1678e9fcaa8aSmrgIf a compatible version of the Xkb extension is not available in the server,
16793233502eSmrg<function>XkbSetNamedDeviceIndicator</function>
16800f8248bfSmrgreturns
16810f8248bfSmrg<symbol>False</symbol>.
16820f8248bfSmrgOtherwise, it sends a request to the X server to change the indicator
16830f8248bfSmrgspecified by
16840f8248bfSmrg<parameter>name</parameter>
16850f8248bfSmrgand returns
16860f8248bfSmrg<symbol>True</symbol>.
1687e9fcaa8aSmrg</para>
1688e9fcaa8aSmrg
1689e9fcaa8aSmrg
1690e9fcaa8aSmrg<para>
16910f8248bfSmrgIf
16920f8248bfSmrg<parameter>change_state</parameter>
16930f8248bfSmrgis
16940f8248bfSmrg<symbol>True</symbol>,
16953233502eSmrg<function>XkbSetNamedDeviceIndicator</function>
16960f8248bfSmrgtells the server to change the state of the named indicator to the value
16970f8248bfSmrgspecified by
16980f8248bfSmrg<parameter>state</parameter>.
16993233502eSmrgIf
17003233502eSmrg<parameter>change_state</parameter>
17013233502eSmrgis
17023233502eSmrg<symbol>False</symbol>,
17033233502eSmrg<parameter>state</parameter>
17043233502eSmrgis not used.
1705e9fcaa8aSmrg</para>
1706e9fcaa8aSmrg
1707e9fcaa8aSmrg
1708e9fcaa8aSmrg<para>
17090f8248bfSmrgIf an indicator with the name specified by
17100f8248bfSmrg<parameter>name</parameter>
17110f8248bfSmrgdoes not already exist, the
17120f8248bfSmrg<parameter>create_new</parameter>
17130f8248bfSmrgparameter tells the server whether it should create a new named indicator. If
17140f8248bfSmrg<parameter>create_new</parameter>
17150f8248bfSmrgis
17160f8248bfSmrg<symbol>True</symbol>,
17170f8248bfSmrgthe server finds the first indicator that doesn’t have a name and gives it
17180f8248bfSmrgthe name specified by
17190f8248bfSmrg<parameter>name</parameter>.
1720e9fcaa8aSmrg</para>
1721e9fcaa8aSmrg
1722e9fcaa8aSmrg
1723e9fcaa8aSmrg<para>
17240f8248bfSmrgIf the optional parameter,
17250f8248bfSmrg<parameter>map</parameter>,
17260f8248bfSmrgis not
17270f8248bfSmrg<symbol>NULL</symbol>,
17283233502eSmrg<function>XkbSetNamedDeviceIndicator</function>
17290f8248bfSmrgtells the server to change the indicator’s map to the values specified
17300f8248bfSmrgin <parameter>map</parameter>.
1731e9fcaa8aSmrg</para>
1732e9fcaa8aSmrg
1733e9fcaa8aSmrg<para>
17343233502eSmrg<function>XkbSetNamedDeviceIndicator</function>
17350f8248bfSmrgcan generate
17360f8248bfSmrg<errorname>BadAtom</errorname>
17370f8248bfSmrgand
17380f8248bfSmrg<errorname>BadImplementation</errorname>
17390f8248bfSmrgerrors. In addition, it can also generate
17400f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>
17410f8248bfSmrg(see <link linkend="Tracking_Changes_to_Indicator_State_or_Map">section 8.5</link>),
17420f8248bfSmrg<symbol>XkbIndicatorMapNotify</symbol>,
17430f8248bfSmrgand
17440f8248bfSmrg<symbol>XkbNamesNotify</symbol>
17450f8248bfSmrgevents (see <link linkend="Tracking_Name_Changes">section 18.5</link>).
1746e9fcaa8aSmrg</para>
1747e9fcaa8aSmrg
17483233502eSmrg<para>
17493233502eSmrgAs a convenience function, Xkb provides a function to set information about
17503233502eSmrgindicators with the default class and identifier on the default device:
17513233502eSmrg<function>XkbSetNamedIndicator</function>.
17523233502eSmrg</para>
17533233502eSmrg
17543233502eSmrg<indexterm significance="preferred" zone="XkbSetNamedIndicator"><primary><function>XkbSetNamedIndicator</function></primary></indexterm>
17553233502eSmrg<funcsynopsis id="XkbSetNamedIndicator">
17563233502eSmrg  <funcprototype>
17573233502eSmrg    <funcdef>Bool<function>XkbSetNamedIndicator</function></funcdef>
17583233502eSmrg    <paramdef>Display *<parameter>dpy</parameter></paramdef>
17593233502eSmrg    <paramdef>Atom <parameter>name</parameter></paramdef>
17603233502eSmrg    <paramdef>Bool <parameter>change_state</parameter></paramdef>
17613233502eSmrg    <paramdef>Bool <parameter>state</parameter></paramdef>
17623233502eSmrg    <paramdef>Bool <parameter>create_new</parameter></paramdef>
17633233502eSmrg    <paramdef>XkbIndicatorMapPtr <parameter>map</parameter></paramdef>
17643233502eSmrg  </funcprototype>
17653233502eSmrg</funcsynopsis>
17663233502eSmrg<variablelist>
17673233502eSmrg  <varlistentry>
17683233502eSmrg    <term>
17693233502eSmrg      <parameter>dpy</parameter>
17703233502eSmrg    </term>
17713233502eSmrg    <listitem>
17723233502eSmrg      <para>
17733233502eSmrg        connection to the X server
17743233502eSmrg      </para>
17753233502eSmrg    </listitem>
17763233502eSmrg  </varlistentry>
17773233502eSmrg  <varlistentry>
17783233502eSmrg    <term>
17793233502eSmrg      <parameter>name</parameter>
17803233502eSmrg    </term>
17813233502eSmrg    <listitem>
17823233502eSmrg      <para>
17833233502eSmrg        name of the indicator to change
17843233502eSmrg      </para>
17853233502eSmrg    </listitem>
17863233502eSmrg  </varlistentry>
17873233502eSmrg  <varlistentry>
17883233502eSmrg    <term>
17893233502eSmrg      <parameter>change_state</parameter>
17903233502eSmrg    </term>
17913233502eSmrg    <listitem>
17923233502eSmrg      <para>
17933233502eSmrg        whether to change the indicator state or not
17943233502eSmrg      </para>
17953233502eSmrg    </listitem>
17963233502eSmrg  </varlistentry>
17973233502eSmrg  <varlistentry>
17983233502eSmrg    <term>
17993233502eSmrg      <parameter>state</parameter>
18003233502eSmrg    </term>
18013233502eSmrg    <listitem>
18023233502eSmrg      <para>
18033233502eSmrg        desired new state for the indicator
18043233502eSmrg      </para>
18053233502eSmrg    </listitem>
18063233502eSmrg  </varlistentry>
18073233502eSmrg  <varlistentry>
18083233502eSmrg    <term>
18093233502eSmrg      <parameter>create_new</parameter>
18103233502eSmrg    </term>
18113233502eSmrg    <listitem>
18123233502eSmrg      <para>
18133233502eSmrg        whether a new indicator with the specified name should be
18143233502eSmrg        created when necessary
18153233502eSmrg      </para>
18163233502eSmrg    </listitem>
18173233502eSmrg  </varlistentry>
18183233502eSmrg  <varlistentry>
18193233502eSmrg    <term>
18203233502eSmrg      <parameter>map</parameter>
18213233502eSmrg    </term>
18223233502eSmrg    <listitem>
18233233502eSmrg      <para>
18243233502eSmrg        new map for the indicator
18253233502eSmrg      </para>
18263233502eSmrg    </listitem>
18273233502eSmrg  </varlistentry>
18283233502eSmrg</variablelist>
18293233502eSmrg
18303233502eSmrg<para>
18313233502eSmrg<function>XkbSetNamedIndicator</function>
18323233502eSmrgcalls
18333233502eSmrg<function>XkbSetNamedDeviceIndicator</function>
18343233502eSmrgwith the specified parameters, a
18353233502eSmrg<structfield>device_spec</structfield>
18363233502eSmrgof
18373233502eSmrg<symbol>XkbUseCoreKbd</symbol>,
18383233502eSmrga
18393233502eSmrg<structfield>led_class</structfield>
18403233502eSmrgof
18413233502eSmrg<symbol>XkbDfltXIClass</symbol>,
18423233502eSmrgand a
18433233502eSmrg<structfield>led_id</structfield>
18443233502eSmrgof
18453233502eSmrg<symbol>XkbDfltXIId</symbol>,
18463233502eSmrgand returns the value which was returned by
18473233502eSmrg<function>XkbSetNamedDeviceIndicator</function>.
18483233502eSmrg</para>
1849e9fcaa8aSmrg
1850e9fcaa8aSmrg</sect2>
1851e9fcaa8aSmrg
1852e9fcaa8aSmrg</sect1>
1853eb411b4bSmrg<sect1 id='Tracking_Changes_to_Indicator_State_or_Map'>
1854e9fcaa8aSmrg<title>Tracking Changes to Indicator State or Map</title>
1855e9fcaa8aSmrg
18560f8248bfSmrg<indexterm significance="preferred" zone="Tracking_Changes_to_Indicator_State_or_Map">
18570f8248bfSmrg<primary>events</primary><secondary><symbol>XkbIndicatorStateNotify</symbol></secondary></indexterm>
18580f8248bfSmrg<indexterm significance="preferred" zone="Tracking_Changes_to_Indicator_State_or_Map">
18590f8248bfSmrg<primary><structname>XkbIndicatorStateNotifyEvent</structname></primary></indexterm>
18600f8248bfSmrg
18610f8248bfSmrg<indexterm significance="preferred" zone="Tracking_Changes_to_Indicator_State_or_Map">
18620f8248bfSmrg<primary>events</primary><secondary><symbol>XkbIndicatorMapNotify</symbol></secondary></indexterm>
18630f8248bfSmrg<indexterm significance="preferred" zone="Tracking_Changes_to_Indicator_State_or_Map">
18640f8248bfSmrg<primary><structname>XkbIndicatorMapNotifyEvent</structname></primary></indexterm>
18650f8248bfSmrg
18660f8248bfSmrg<para>
18670f8248bfSmrgWhenever an indicator changes state, the server sends
18680f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>
18690f8248bfSmrgevents to all interested clients. Similarly, whenever an indicator’s map
18700f8248bfSmrgchanges, the server sends
18710f8248bfSmrg<symbol>XkbIndicatorMapNotify</symbol>
18720f8248bfSmrgevents to all interested clients.
18730f8248bfSmrg</para>
18740f8248bfSmrg
18750f8248bfSmrg
18760f8248bfSmrg<para>
18770f8248bfSmrgTo receive
18780f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>
18790f8248bfSmrgevents, use
18800f8248bfSmrg<function>XkbSelectEvents</function>
18810f8248bfSmrg(see <link linkend="Selecting_Xkb_Events">section 4.3</link>) with both the
18820f8248bfSmrg<parameter>bits_to_change</parameter>
18830f8248bfSmrgand
18840f8248bfSmrg<parameter>values_for_bits</parameter>
18850f8248bfSmrgparameters containing
18860f8248bfSmrg<symbol>XkbIndicatorStateNotifyMask</symbol>.
18870f8248bfSmrgTo receive
18880f8248bfSmrg<symbol>XkbIndicatorMapNotify</symbol>
18890f8248bfSmrgevents, use
18900f8248bfSmrg<function>XkbSelectEvents</function>
18910f8248bfSmrgwith
18920f8248bfSmrg<symbol>XkbIndicatorMapNotifyMask</symbol>.
18930f8248bfSmrg</para>
18940f8248bfSmrg
18950f8248bfSmrg
18960f8248bfSmrg<para>
18970f8248bfSmrgTo receive events for only specific indicators, use
18980f8248bfSmrg<function>XkbSelectEventDetails</function>.
18990f8248bfSmrgSet the
19000f8248bfSmrg<structfield>event_type</structfield>
19010f8248bfSmrgparameter to
19020f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>
19030f8248bfSmrgor
19040f8248bfSmrg<symbol>XkbIndicatorMapNotify</symbol>,
19050f8248bfSmrgand set both the
19060f8248bfSmrg<parameter>bits_to_change</parameter>
19070f8248bfSmrgand
19080f8248bfSmrg<parameter>values_for_bits</parameter>
19090f8248bfSmrgdetail parameters to a mask where each bit specifies one indicator, turning on
1910e9fcaa8aSmrgthose bits that specify the indicators for which you want to receive events.
1911e9fcaa8aSmrg</para>
1912e9fcaa8aSmrg
1913e9fcaa8aSmrg
1914e9fcaa8aSmrg<para>
1915e9fcaa8aSmrgBoth types of indicator events use the same structure:
1916e9fcaa8aSmrg
19170f8248bfSmrg<programlisting>
1918e9fcaa8aSmrgtypedef struct _XkbIndicatorNotify {
19190f8248bfSmrg    int            type;        /* Xkb extension base event code */
19200f8248bfSmrg    unsigned long  serial;      /* X server serial number for event */
19210f8248bfSmrg    Bool           send_event;  /* <symbol>True</symbol> &rArr; synthetically generated */
19220f8248bfSmrg    Display *      display;     /* server connection where event generated */
19230f8248bfSmrg    Time           time;        /* server time when event generated */
19240f8248bfSmrg    int            xkb_type;    /* specifies state or map notify */
19250f8248bfSmrg    int            device;      /* Xkb device ID, will not be <symbol>XkbUseCoreKbd</symbol> */
19260f8248bfSmrg    unsigned int   changed;     /* mask of indicators with new state or map */
19270f8248bfSmrg    unsigned int   state;       /* current state of all indicators */
19280f8248bfSmrg} <structname>XkbIndicatorNotifyEvent</structname>;
1929e9fcaa8aSmrg</programlisting></para>
1930e9fcaa8aSmrg
1931e9fcaa8aSmrg<para>
19320f8248bfSmrg<structfield>xkb_type</structfield>
19330f8248bfSmrgis either
19340f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>
19350f8248bfSmrgor
19360f8248bfSmrg<symbol>XkbIndicatorMapNotify</symbol>,
19370f8248bfSmrgdepending on whether the event is a
19380f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>
19390f8248bfSmrgevent or
19400f8248bfSmrg<symbol>XkbIndicatorMapNotify</symbol>,
19410f8248bfSmrgevent.
19420f8248bfSmrg</para>
19430f8248bfSmrg
19440f8248bfSmrg<para>
19450f8248bfSmrgThe
19460f8248bfSmrg<structfield>changed</structfield>
19470f8248bfSmrgparameter is a mask that is the bitwise inclusive OR of the indicators that
19480f8248bfSmrghave changed. If the event is of type
19490f8248bfSmrg<symbol>XkbIndicatorMapNotify</symbol>,
19500f8248bfSmrg<structfield>changed</structfield>
19510f8248bfSmrgreports the maps that changed. If the event is of type
19520f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>,
19530f8248bfSmrg<structfield>changed</structfield>
19540f8248bfSmrgreports the indicators that have changed state.
19550f8248bfSmrg<parameter>state</parameter>
19560f8248bfSmrgis a mask that specifies the current state of all indicators, whether they
19570f8248bfSmrghave changed or not, for both
19580f8248bfSmrg<symbol>XkbIndicatorStateNotify</symbol>
19590f8248bfSmrgand <symbol>XkbIndicatorMapNotify</symbol> events.
19600f8248bfSmrg</para>
19610f8248bfSmrg
1962e9fcaa8aSmrg</sect1>
1963eb411b4bSmrg<sect1 id='Allocating_and_Freeing_Indicator_Maps'>
1964e9fcaa8aSmrg<title>Allocating and Freeing Indicator Maps</title>
1965e9fcaa8aSmrg
1966e9fcaa8aSmrg<para>
19670f8248bfSmrgMost applications do not need to directly allocate the
19680f8248bfSmrg<structfield>indicators</structfield>
19690f8248bfSmrgmember of the keyboard description record (the keyboard description record is
19700f8248bfSmrgdescribed in <xref linkend="Complete_Keyboard_Description" />). If the need arises, however, use
19710f8248bfSmrg<function>XkbAllocIndicatorMaps</function>.
19720f8248bfSmrg</para>
19730f8248bfSmrg
19740f8248bfSmrg<indexterm significance="preferred" zone="XkbAllocIndicatorMaps"><primary><function>XkbAllocIndicatorMaps</function></primary></indexterm>
19750f8248bfSmrg<funcsynopsis id="XkbAllocIndicatorMaps">
19760f8248bfSmrg  <funcprototype>
19770f8248bfSmrg    <funcdef>Status <function>XkbAllocIndicatorMaps</function></funcdef>
19780f8248bfSmrg<!-- (
19790f8248bfSmrg<parameter>xkb</parameter>
19800f8248bfSmrg) -->
19810f8248bfSmrg
19820f8248bfSmrg    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
19830f8248bfSmrg  </funcprototype>
19840f8248bfSmrg</funcsynopsis>
19850f8248bfSmrg<variablelist>
19860f8248bfSmrg  <varlistentry>
19870f8248bfSmrg    <term>
19880f8248bfSmrg      <parameter>xkb</parameter>
19890f8248bfSmrg    </term>
19900f8248bfSmrg    <listitem>
19910f8248bfSmrg      <para>
19920f8248bfSmrg        keyboard description structure
19930f8248bfSmrg      </para>
19940f8248bfSmrg    </listitem>
19950f8248bfSmrg  </varlistentry>
19960f8248bfSmrg</variablelist>
19970f8248bfSmrg
19980f8248bfSmrg<para>
19990f8248bfSmrgThe
20000f8248bfSmrg<parameter>xkb</parameter>
20010f8248bfSmrgparameter must point to a valid keyboard description. If it doesn’t,
20020f8248bfSmrg<function>XkbAllocIndicatorMaps</function>
20030f8248bfSmrgreturns a
20040f8248bfSmrg<errorname>BadMatch</errorname>
20050f8248bfSmrgerror. Otherwise,
20060f8248bfSmrg<function>XkbAllocIndicatorMaps</function>
20070f8248bfSmrgallocates and initializes the
20080f8248bfSmrg<structfield>indicators</structfield>
20090f8248bfSmrgmember of the keyboard description record and returns
20100f8248bfSmrg<symbol>Success</symbol>.
20110f8248bfSmrgIf
20120f8248bfSmrg<function>XkbAllocIndicatorMaps</function>
20130f8248bfSmrgwas unable to allocate the indicators record, it reports a
20140f8248bfSmrg<errorname>BadAlloc</errorname>
20150f8248bfSmrgerror.
20160f8248bfSmrg</para>
20170f8248bfSmrg
20180f8248bfSmrg<para>
20190f8248bfSmrgTo free memory used by the
20200f8248bfSmrg<structfield>indicators</structfield>
20210f8248bfSmrgmember of an
20220f8248bfSmrg<structname>XkbDescRec</structname>
20230f8248bfSmrgstructure, use
20240f8248bfSmrg<function>XkbFreeIndicatorMaps</function>.
20250f8248bfSmrg</para>
20260f8248bfSmrg
20270f8248bfSmrg<indexterm significance="preferred" zone="XkbFreeIndicatorMaps"><primary><function>XkbFreeIndicatorMaps</function></primary></indexterm>
20280f8248bfSmrg<funcsynopsis id="XkbFreeIndicatorMaps">
20290f8248bfSmrg  <funcprototype>
20300f8248bfSmrg    <funcdef>void <function>XkbFreeIndicatorMaps</function></funcdef>
20310f8248bfSmrg<!-- (
20320f8248bfSmrg<parameter>xkb</parameter>
20330f8248bfSmrg) -->
20340f8248bfSmrg
20350f8248bfSmrg    <paramdef>XkbDescPtr <parameter>xkb</parameter></paramdef>
20360f8248bfSmrg  </funcprototype>
20370f8248bfSmrg</funcsynopsis>
20380f8248bfSmrg<variablelist>
20390f8248bfSmrg  <varlistentry>
20400f8248bfSmrg    <term>
20410f8248bfSmrg      <parameter>xkb</parameter>
20420f8248bfSmrg    </term>
20430f8248bfSmrg    <listitem>
20440f8248bfSmrg      <para>
20450f8248bfSmrg        keyboard description structure
20460f8248bfSmrg      </para>
20470f8248bfSmrg    </listitem>
20480f8248bfSmrg  </varlistentry>
20490f8248bfSmrg</variablelist>
20500f8248bfSmrg
20510f8248bfSmrg<para>
20520f8248bfSmrgIf the <structfield>indicators</structfield>
20530f8248bfSmrgmember of the keyboard description record
20540f8248bfSmrgpointed to by <parameter>xkb</parameter>
20550f8248bfSmrgis not <symbol>NULL</symbol>,
20560f8248bfSmrg<function>XkbFreeIndicatorMaps</function>
2057e9fcaa8aSmrgfrees the memory associated with
20580f8248bfSmrgthe <structfield>indicators</structfield>
20590f8248bfSmrgmember of <parameter>xkb</parameter>.
2060e9fcaa8aSmrg</para>
2061e9fcaa8aSmrg
2062e9fcaa8aSmrg</sect1>
2063e9fcaa8aSmrg</chapter>
2064