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 event window, or None
16
17       percent
18              relative volume, which can range from -100 to 100 inclusive
19
20       name   a bell name, or NULL
21

DESCRIPTION

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

RETURN VALUES

164       FALSE          The  XkbBell  function returns FALSE if XlibDisplayNoXkb
165                      is set.
166

STRUCTURES

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

SEE ALSO

206       XBell(3),  XkbBellNotify(3),  XkbChangeEnabledControls(3),   XkbDevice‐
207       Bell(3), XkbForceBell(3), XkbForceDeviceBell(3), XkbUseCoreKbd(3)
208
209
210
211
212
213
214
215
216X Version 11                     libX11 1.8.7                       XkbBell(3)
Impressum