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

NAME

6       XkbForceBell  - Overrides user preference settings for audible bells to
7       ring the bell on the default keyboard
8

SYNOPSIS

10       Bool XkbForceBell (Display *display, int percent);
11

ARGUMENTS

13       - display
14              connection to the X server
15
16       - percent
17              volume for the bell, which can range from -100 to 100 inclusive
18

DESCRIPTION

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

RETURNS VALUES

162       False          The XkbForceBell function returns False when a  compati‐
163                      ble keyboard extension isn't present in the X server.
164

STRUCTURES

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

SEE ALSO

204       XBell(3),   XkbBell(3),   XkbChangeEnabledControls(3),  XkbForceDevice‐
205       Bell(3), XkbSelectEventDetails(3), XkbSelectEvents(3)
206
207
208
209X Version 11                     libX11 1.6.12                 XkbForceBell(3)
Impressum