Copyright (c) 1999, Oracle and/or its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Bool XkbBell "(\^Display *" "display" "\^," "Window " "window" "\^," "int " "percent" "\^," "Atom " "name" "\^);"
display connection to the X server
window event window, or None
percent relative volume, which can range from -100 to 100 inclusive
name a bell name, or NULL
The core X protocol allows only applications to explicitly sound the system bell with a given duration, pitch, and volume. Xkb extends this capability by allowing clients to attach symbolic names to bells, disable audible bells, and receive an event whenever the keyboard bell is rung. For the purposes of this document, the audible bell is defined to be the system bell, or the default keyboard bell, as opposed to any other audible sound generated elsewhere in the system. You can ask to receive XkbBellNotify events when any client rings any one of the following:
You can also ask to receive XkbBellNotify events when the server rings the default bell or if any client has requested events only (without the bell sounding) for any of the bell types previously listed. You can disable audible bells on a global basis. For example, a client that replaces the keyboard bell with some other audible cue might want to turn off the AudibleBell control to prevent the server from also generating a sound and avoid cacophony. If you disable audible bells and request to receive XkbBellNotify events, you can generate feedback different from the default bell. You can, however, override the AudibleBell control by calling one of the functions that force the ringing of a bell in spite of the setting of the AudibleBell control - XkbForceDeviceBell or XkbForceBell. In this case the server does not generate a bell event. Just as some keyboards can produce keyclicks to indicate when a key is pressed or repeating, Xkb can provide feedback for the controls by using special beep codes. The AccessXFeedback control is used to configure the specific types of operations that generate feedback. Bell Names You can associate a name to an act of ringing a bell by converting the name to an Atom and then using this name when you call the functions listed in this chapter. If an event is generated as a result, the name is then passed to all other clients interested in receiving XkbBellNotify events. Note that these are arbitrary names and that there is no binding to any sounds. Any sounds or other effects (such as visual bells on the screen) must be generated by a client application upon receipt of the bell event containing the name. There is no default name for the default keyboard bell. The server does generate some predefined bells for the AccessX controls. These named bells are shown in Table 1 below; the name is included in any bell event sent to clients that have requested to receive XkbBellNotify events.
| Table 1 Predefined Bells |
| Action Named Bell |
| Indicator turned on AX_IndicatorOn |
| Indicator turned off AX_IndicatorOff |
| More than one indicator changed state AX_IndicatorChange |
| Control turned on AX_FeatureOn |
| Control turned off AX_FeatureOff |
| More than one control changed state AX_FeatureChange |
| SlowKeys and BounceKeys about to be turned on or off AX_SlowKeysWarning |
| SlowKeys key pressed AX_SlowKeyPress |
| SlowKeys key accepted AX_SlowKeyAccept |
| SlowKeys key rejected AX_SlowKeyReject |
| Accepted SlowKeys key released AX_SlowKeyRelease |
| BounceKeys key rejected AX_BounceKeyReject |
| StickyKeys key latched AX_StickyLatch |
| StickyKeys key locked AX_StickyLock |
| StickyKeys key unlocked AX_StickyUnlock |
| Table 2 Bell Sounding and Bell Event Generating |
| Function called AudibleBell Server sounds a bell Server sends an |
| XkbBellNotifyEvent |
| XkbDeviceBell On Yes Yes |
| XkbDeviceBell Off No Yes |
| XkbBell On Yes Yes |
| XkbBell Off No Yes |
| XkbDeviceBellEvent On or Off No Yes |
| XkbBellEvent On or Off No Yes |
| XkbDeviceForceBell On or Off Yes No |
| XkbForceBell On or Off Yes No |
15 FALSE The XkbBell function returns FALSE if XlibDisplayNoXkb is set.
Xkb generates XkbBellNotify events for all bells except for those resulting from calls to XkbForceDeviceBell and XkbForceBell. To receive XkbBellNotify events under all possible conditions, pass XkbBellNotifyMask in both the bits_to_change and values_for_bits parameters to XkbSelectEvents. The XkbBellNotify event has no event details. It is either selected or it is not. However, you can call XkbSelectEventDetails using XkbBellNotify as the event_type and specifying XkbAllBellEventsMask in bits_to_change and values_for_bits. This has the same effect as a call to XkbSelectEvents. The structure for the XkbBellNotify event type contains:
typedef struct _XkbBellNotify {
int type; /* Xkb extension base event code */
unsigned long serial; /* X server serial number for event */
Bool send_event; /* True => synthetically generated */
Display * display; /* server connection where event generated */
Time time; /* server time when event generated */
int xkb_type; /* XkbBellNotify */
unsigned int device; /* Xkb device ID, will not be XkbUseCoreKbd */
int percent; /* requested volume as % of max */
int pitch; /* requested pitch in Hz */
int duration; /* requested duration in microseconds */
unsigned int bell_class; /* X input extension feedback class */
unsigned int bell_id; /* X input extension feedback ID */
Atom name; /* "name" of requested bell */
Window window; /* window associated with event */
Bool event_only; /* False -> the server did not produce a beep */
} XkbBellNotifyEvent;
If your application needs to generate visual bell feedback on the screen when it
receives
a bell event, use the window ID in the XkbBellNotifyEvent, if present.