1XkbBell(3)                       XKB FUNCTIONS                      XkbBell(3)
2
3
4

NAME

6       XkbBell - Rings the bell on the default keyboard
7

SYNOPSIS

9       Bool XkbBell (Display *display, Window window, int percent, Atom name);
10

ARGUMENTS

12       - display
13              connection to the X server
14
15       - window
16              event window, or None
17
18       - percent
19              relative volume, which can range from -100 to 100 inclusive
20
21       - name a bell name, or NULL
22

DESCRIPTION

24       The  core  X  protocol allows only applications to explicitly sound the
25       system bell with a given duration, pitch, and volume. Xkb extends  this
26       capability  by allowing clients to attach symbolic names to bells, dis‐
27       able audible bells, and receive an event whenever the keyboard bell  is
28       rung. For the purposes of this document, the audible bell is defined to
29       be the system bell, or the default keyboard bell,  as  opposed  to  any
30       other  audible sound generated elsewhere in the system.  You can ask to
31       receive XkbBellNotify events when any client rings any one of the  fol‐
32       lowing:
33
34
35       •    The default bell
36
37       •    Any  bell on an input device that can be specified by a bell_class
38            and bell_id pair
39
40       •    Any bell specified only by an arbitrary name. (This is,  from  the
41            server's  point of view, merely a name, and not connected with any
42            physical sound-generating device.  Some  client  application  must
43            generate the sound, or visual feedback, if any, that is associated
44            with the name.)
45
46
47       You can also ask to receive XkbBellNotify events when the server  rings
48       the  default  bell  or if any client has requested events only (without
49       the bell sounding) for any of the bell types previously listed.
50
51       You can disable audible bells on a global basis. For example, a  client
52       that  replaces the keyboard bell with some other audible cue might want
53       to turn off the AudibleBell control to prevent  the  server  from  also
54       generating  a  sound  and avoid cacophony. If you disable audible bells
55       and request to receive XkbBellNotify events, you can generate  feedback
56       different from the default bell.
57
58       You  can,  however,  override the AudibleBell control by calling one of
59       the functions that force the ringing of a bell in spite of the  setting
60       of  the  AudibleBell  control - XkbForceDeviceBell or XkbForceBell.  In
61       this case the server does not generate a bell event.
62
63       Just as some keyboards can produce keyclicks to indicate when a key  is
64       pressed  or repeating, Xkb can provide feedback for the controls by us‐
65       ing special beep codes. The AccessXFeedback control is used to  config‐
66       ure the specific types of operations that generate feedback.
67
68       Bell Names
69
70       You  can associate a name to an act of ringing a bell by converting the
71       name to an Atom and then using this name when you  call  the  functions
72       listed  in this chapter. If an event is generated as a result, the name
73       is then passed to all other clients interested in receiving  XkbBellNo‐
74       tify  events.  Note that these are arbitrary names and that there is no
75       binding to any sounds. Any sounds or  other  effects  (such  as  visual
76       bells on the screen) must be generated by a client application upon re‐
77       ceipt of the bell event containing the name. There is no  default  name
78       for the default keyboard bell. The server does generate some predefined
79       bells for the AccessX controls. These named bells are shown in Table  1
80       below; the name is included in any bell event sent to clients that have
81       requested to receive XkbBellNotify events.
82
83
84                                 Table 1 Predefined Bells
85       ─────────────────────────────────────────────────────────────────────────────
86       Action                                                    Named Bell
87       ─────────────────────────────────────────────────────────────────────────────
88       Indicator turned on                                       AX_IndicatorOn
89       Indicator turned off                                      AX_IndicatorOff
90       More than one indicator changed state                     AX_IndicatorChange
91       Control turned on                                         AX_FeatureOn
92       Control turned off                                        AX_FeatureOff
93       More than one control changed state                       AX_FeatureChange
94       T{ SlowKeys and BounceKeys about to be turned on or off
95       T}                                                        AX_SlowKeysWarning
96       SlowKeys key pressed                                      AX_SlowKeyPress
97       SlowKeys key accepted                                     AX_SlowKeyAccept
98       SlowKeys key rejected                                     AX_SlowKeyReject
99       Accepted SlowKeys key released                            AX_SlowKeyRelease
100       BounceKeys key rejected                                   AX_BounceKeyReject
101       StickyKeys key latched                                    AX_StickyLatch
102       StickyKeys key locked                                     AX_StickyLock
103       StickyKeys key unlocked                                   AX_StickyUnlock
104
105       Audible Bells
106
107       Using Xkb you can generate bell events that do not necessarily ring the
108       system  bell. This is useful if you need to use an audio server instead
109       of the system beep. For example, when an audio client starts, it  could
110       disable the audible bell (the system bell) and then listen for XkbBell‐
111       Notify events. When it receives a XkbBellNotify event, the audio client
112       could then send a request to an audio server to play a sound.
113
114       You  can  control  the audible bells feature by passing the XkbAudible‐
115       BellMask to XkbChangeEnabledControls.  If  you  set  XkbAudibleBellMask
116       on,  the server rings the system bell when a bell event occurs. This is
117       the default. If you set XkbAudibleBellMask off and a bell event occurs,
118       the  server  does  not ring the system bell unless you call XkbForceDe‐
119       viceBell or XkbForceBell.
120
121       Audible bells are also part of the per-client auto-reset controls.
122
123       Bell Functions
124
125       Use the functions described in this section to ring bells and to gener‐
126       ate bell events.
127
128       The  input extension has two types of feedbacks that can generate bells
129       - bell feedback and keyboard feedback. Some of the  functions  in  this
130       section  have  bell_class  and bell_id parameters; set them as follows:
131       Set bell_class to BellFeedbackClass or KbdFeedbackClass. A  device  can
132       have more than one feedback of each type; set bell_id to the particular
133       bell feedback of bell_class type.
134
135       Table 2 shows the conditions that cause a bell to sound or an  XkbBell‐
136       NotifyEvent to be generated when a bell function is called.
137
138
139                    Table 2 Bell Sounding and Bell Event Generating
140       ───────────────────────────────────────────────────────────────────────────
141       Function called      AudibleBell   Server sounds a bell   Server sends an
142       XkbBellNotifyEvent
143       ───────────────────────────────────────────────────────────────────────────
144       XkbDeviceBell        On            Yes                    Yes
145       XkbDeviceBell        Off           No                     Yes
146       XkbBell              On            Yes                    Yes
147       XkbBell              Off           No                     Yes
148       XkbDeviceBellEvent   On or Off     No                     Yes
149       XkbBellEvent         On or Off     No                     Yes
150       XkbDeviceForceBell   On or Off     Yes                    No
151       XkbForceBell         On or Off     Yes                    No
152
153       If  a  compatible  keyboard  extension  isn't  present in the X server,
154       XkbBell calls XBell with the specified display and percent, and returns
155       False.  Otherwise,  XkbBell calls XkbDeviceBell with the specified dis‐
156       play, window, percent, and name,  a  device_spec  of  XkbUseCoreKbd,  a
157       bell_class of XkbDfltXIClass, and a bell_id of XkbDfltXIId, and returns
158       True.
159
160       If you have disabled the audible bell, the server  does  not  ring  the
161       system bell, although it does generate a XkbBellNotify event.
162
163       You can call XkbBell without first initializing the keyboard extension.
164

RETURN VALUES

166       FALSE          The  XkbBell  function returns FALSE if XlibDisplayNoXkb
167                      is set.
168

STRUCTURES

170       Xkb generates XkbBellNotify events for all bells except for  those  re‐
171       sulting  from calls to XkbForceDeviceBell and XkbForceBell.  To receive
172       XkbBellNotify events under all possible conditions, pass XkbBellNotify‐
173       Mask in both the bits_to_change and values_for_bits parameters to XkbS‐
174       electEvents.
175
176       The XkbBellNotify event has no event details. It is either selected  or
177       it  is not.  However, you can call XkbSelectEventDetails using XkbBell‐
178       Notify  as  the  event_type  and  specifying  XkbAllBellEventsMask   in
179       bits_to_change and values_for_bits.  This has the same effect as a call
180       to XkbSelectEvents.
181
182       The structure for the XkbBellNotify event type contains:
183
184          typedef struct _XkbBellNotify {
185              int            type;        /∗ Xkb extension base event code */
186              unsigned long  serial;      /∗ X server serial number for event */
187              Bool           send_event;  /∗ True => synthetically generated */
188              Display *      display;     /∗ server connection where event generated */
189              Time           time;        /∗ server time when event generated */
190              int            xkb_type;    /∗ XkbBellNotify */
191              unsigned int   device;      /∗ Xkb device ID, will not be XkbUseCoreKbd
192       */
193              int            percent;     /∗ requested volume as % of max */
194              int            pitch;       /∗ requested pitch in Hz */
195              int            duration;    /∗ requested duration in microseconds */
196              unsigned int   bell_class;  /∗ X input extension feedback class */
197              unsigned int   bell_id;     /∗ X input extension feedback ID */
198              Atom           name;        /∗ "name" of requested bell */
199              Window         window;      /∗ window associated with event */
200              Bool           event_only;  /∗ False -> the server did not produce a beep
201       */
202          } XkbBellNotifyEvent;
203
204       If your application needs to  generate  visual  bell  feedback  on  the
205       screen when it receives a bell event, use the window ID in the XkbBell‐
206       NotifyEvent, if present.
207
208

SEE ALSO

210       XBell(3),  XkbBellNotify(3),  XkbChangeEnabledControls(3),   XkbDevice‐
211       Bell(3), XkbForceBell(3), XkbForceDeviceBell(3), XkbUseCoreKbd(3)
212
213
214
215
216
217
218
219
220X Version 11                     libX11 1.7.0                       XkbBell(3)
Impressum