1XkbBell(3) XKB FUNCTIONS XkbBell(3)
2
3
4
6 XkbBell - Rings the bell on the default keyboard
7
9 Bool XkbBell (Display *display, Window window, int percent, Atom name);
10
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
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 SlowKeys and BounceKeys about to be turned on or off AX_SlowKeysWarning
95 SlowKeys key pressed AX_SlowKeyPress
96 SlowKeys key accepted AX_SlowKeyAccept
97 SlowKeys key rejected AX_SlowKeyReject
98 Accepted SlowKeys key released AX_SlowKeyRelease
99 BounceKeys key rejected AX_BounceKeyReject
100 StickyKeys key latched AX_StickyLatch
101 StickyKeys key locked AX_StickyLock
102 StickyKeys key unlocked AX_StickyUnlock
103
104 Audible Bells
105
106 Using Xkb you can generate bell events that do not necessarily ring the
107 system bell. This is useful if you need to use an audio server instead
108 of the system beep. For example, when an audio client starts, it could
109 disable the audible bell (the system bell) and then listen for XkbBell‐
110 Notify events. When it receives a XkbBellNotify event, the audio client
111 could then send a request to an audio server to play a sound.
112
113 You can control the audible bells feature by passing the XkbAudible‐
114 BellMask to XkbChangeEnabledControls. If you set XkbAudibleBellMask
115 on, the server rings the system bell when a bell event occurs. This is
116 the default. If you set XkbAudibleBellMask off and a bell event occurs,
117 the server does not ring the system bell unless you call XkbForceDe‐
118 viceBell or XkbForceBell.
119
120 Audible bells are also part of the per-client auto-reset controls.
121
122 Bell Functions
123
124 Use the functions described in this section to ring bells and to gener‐
125 ate bell events.
126
127 The input extension has two types of feedbacks that can generate bells
128 - bell feedback and keyboard feedback. Some of the functions in this
129 section have bell_class and bell_id parameters; set them as follows:
130 Set bell_class to BellFeedbackClass or KbdFeedbackClass. A device can
131 have more than one feedback of each type; set bell_id to the particular
132 bell feedback of bell_class type.
133
134 Table 2 shows the conditions that cause a bell to sound or an XkbBell‐
135 NotifyEvent to be generated when a bell function is called.
136
137
138 Table 2 Bell Sounding and Bell Event Generating
139 ───────────────────────────────────────────────────────────────────────────
140 Function called AudibleBell Server sounds a bell Server sends an
141 XkbBellNotifyEvent
142 ───────────────────────────────────────────────────────────────────────────
143 XkbDeviceBell On Yes Yes
144 XkbDeviceBell Off No Yes
145 XkbBell On Yes Yes
146 XkbBell Off No Yes
147 XkbDeviceBellEvent On or Off No Yes
148 XkbBellEvent On or Off No Yes
149 XkbDeviceForceBell On or Off Yes No
150 XkbForceBell On or Off Yes No
151
152 If a compatible keyboard extension isn't present in the X server,
153 XkbBell calls XBell with the specified display and percent, and returns
154 False. Otherwise, XkbBell calls XkbDeviceBell with the specified dis‐
155 play, window, percent, and name, a device_spec of XkbUseCoreKbd, a
156 bell_class of XkbDfltXIClass, and a bell_id of XkbDfltXIId, and returns
157 True.
158
159 If you have disabled the audible bell, the server does not ring the
160 system bell, although it does generate a XkbBellNotify event.
161
162 You can call XkbBell without first initializing the keyboard extension.
163
165 FALSE The XkbBell function returns FALSE if XlibDisplayNoXkb
166 is set.
167
169 Xkb generates XkbBellNotify events for all bells except for those re‐
170 sulting from calls to XkbForceDeviceBell and XkbForceBell. To receive
171 XkbBellNotify events under all possible conditions, pass XkbBellNotify‐
172 Mask in both the bits_to_change and values_for_bits parameters to XkbS‐
173 electEvents.
174
175 The XkbBellNotify event has no event details. It is either selected or
176 it is not. However, you can call XkbSelectEventDetails using XkbBell‐
177 Notify as the event_type and specifying XkbAllBellEventsMask in
178 bits_to_change and values_for_bits. This has the same effect as a call
179 to XkbSelectEvents.
180
181 The structure for the XkbBellNotify event type contains:
182
183 typedef struct _XkbBellNotify {
184 int type; /* Xkb extension base event code */
185 unsigned long serial; /* X server serial number for event */
186 Bool send_event; /* True => synthetically generated */
187 Display * display; /* server connection where event generated */
188 Time time; /* server time when event generated */
189 int xkb_type; /* XkbBellNotify */
190 unsigned int device; /* Xkb device ID, will not be XkbUseCoreKbd */
191 int percent; /* requested volume as % of max */
192 int pitch; /* requested pitch in Hz */
193 int duration; /* requested duration in microseconds */
194 unsigned int bell_class; /* X input extension feedback class */
195 unsigned int bell_id; /* X input extension feedback ID */
196 Atom name; /* "name" of requested bell */
197 Window window; /* window associated with event */
198 Bool event_only; /* False -> the server did not produce a beep */
199 } XkbBellNotifyEvent;
200
201 If your application needs to generate visual bell feedback on the
202 screen when it receives a bell event, use the window ID in the XkbBell‐
203 NotifyEvent, if present.
204
205
207 XBell(3), XkbBellNotify(3), XkbChangeEnabledControls(3), XkbDevice‐
208 Bell(3), XkbForceBell(3), XkbForceDeviceBell(3), XkbUseCoreKbd(3)
209
210
211
212
213
214
215
216
217X Version 11 libX11 1.8.1 XkbBell(3)