1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
|
<chapter id='Bells'>
<title>Bells</title>
<para>
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 <emphasis>
audible</emphasis>
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.
</para>
<para>
You can ask to receive <emphasis>
XkbBellNotify</emphasis>
events (see section 9.4) when any client rings any one of the following: <!-- xref -->
</para>
<itemizedlist>
<listitem>
<para>
The default bell
</para>
</listitem>
<listitem>
<para>
Any bell on an input device that can be specified by a <emphasis>
bell_class</emphasis>
and <emphasis>
bell_id</emphasis>
pair
</para>
</listitem>
<listitem>
<para>
Any bell specified only by an arbitrary name. (This is, from the server’s
point of view, merely a name, and not connected with any physical
sound-generating device. Some client application must generate the sound, or
visual feedback, if any, that is associated with the name.)
</para>
</listitem>
</itemizedlist>
<para>
You can also ask to receive <emphasis>
XkbBellNotify</emphasis>
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.
</para>
<para>
You can disable audible bells on a global basis (to set the <emphasis>
AudibleBell</emphasis>
control, see Chapter 10). For example, a client that replaces the keyboard
bell with some other audible cue might want to turn off the <emphasis>
AudibleBell</emphasis>
control to prevent the server from also generating a sound and avoid
cacophony. If you disable audible bells and request to receive <emphasis>
XkbBellNotify</emphasis>
events, you can generate feedback different from the default bell.
</para>
<para>
You can, however, override the <emphasis>
AudibleBell</emphasis>
control by calling one of the functions that force the ringing of a bell in
spite of the setting of the <emphasis>
AudibleBell</emphasis>
control — <emphasis>
XkbForceDeviceBell</emphasis>
or <emphasis>
XkbForceBell</emphasis>
(see section 9.3.3). In this case the server does not generate a bell event. <!-- xref -->
</para>
<para>
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 <emphasis>
AccessXFeedback</emphasis>
control is used to configure the specific types of operations that generate
feedback. See section 10.6.3 for a discussion on <emphasis> <!-- xref -->
AccessXFeedback</emphasis>
control.
</para>
<para>
This chapter describes bell names, the functions used to generate named bells,
and the events the server generates for bells.
</para>
<sect1 id='Bell_Names'>
<title>Bell Names</title>
<para>
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 <emphasis>
XkbBellNotify</emphasis>
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 (see
section 10.6.3). These named bells are shown in Table 9.1; the name is included
in any bell event sent to clients that have requested to receive <emphasis>
XkbBellNotify</emphasis>
events.
</para>
<table frame='topbot'>
<title>Predefined Bells</title>
<?dbfo keep-together="always" ?>
<tgroup cols='2' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='1.0*'/>
<thead>
<row rowsep='1'>
<entry>Action</entry>
<entry>Named Bell</entry>
</row>
</thead>
<tbody>
<row>
<entry>Indicator turned on</entry>
<entry>AX_IndicatorOn</entry>
</row>
<row>
<entry>Indicator turned off</entry>
<entry>AX_IndicatorOff</entry>
</row>
<row>
<entry>More than one indicator changed state</entry>
<entry>AX_IndicatorChange</entry>
</row>
<row>
<entry>Control turned on</entry>
<entry>AX_FeatureOn</entry>
</row>
<row>
<entry>Control turned off</entry>
<entry>AX_FeatureOff</entry>
</row>
<row>
<entry>More than one control changed state</entry>
<entry>AX_FeatureChange</entry>
</row>
<row>
<entry>SlowKeys and BounceKeys about to be turned on or off</entry>
<entry>AX_SlowKeysWarning</entry>
</row>
<row>
<entry>SlowKeys key pressed</entry>
<entry>AX_SlowKeyPress</entry>
</row>
<row>
<entry>SlowKeys key accepted</entry>
<entry>AX_SlowKeyAccept</entry>
</row>
<row>
<entry>SlowKeys key rejected</entry>
<entry>AX_SlowKeyReject</entry>
</row>
<row>
<entry>Accepted SlowKeys key released</entry>
<entry>AX_SlowKeyRelease</entry>
</row>
<row>
<entry>BounceKeys key rejected</entry>
<entry>AX_BounceKeyReject</entry>
</row>
<row>
<entry>StickyKeys key latched</entry>
<entry>AX_StickyLatch</entry>
</row>
<row>
<entry>StickyKeys key locked</entry>
<entry>AX_StickyLock</entry>
</row>
<row>
<entry>StickyKeys key unlocked</entry>
<entry>AX_StickyUnlock</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
<sect1 id='Audible_Bells'>
<title>Audible Bells</title>
<para>
Using Xkb you can generate bell events that do not necessarily ring the system
bell. This is useful if you need to use an audio server instead of the system
beep. For example, when an audio client starts, it could disable the audible
bell (the system bell) and then listen for <emphasis>
XkbBellNotify</emphasis>
events (see section 9.4). When it receives a <emphasis> <!-- xref -->
XkbBellNotify</emphasis>
event, the audio client could then send a request to an audio server to play a
sound.
</para>
<para>
You can control the audible bells feature by passing the <emphasis>
XkbAudibleBellMask</emphasis>
to <emphasis>
XkbChangeEnabledControls</emphasis>
(see section 10.1.1). If you set <emphasis> <!-- xref -->
XkbAudibleBellMask</emphasis>
on, the server rings the system bell when a bell event occurs. This is the
default. If you set <emphasis>
XkbAudibleBellMask</emphasis>
off and a bell event occurs, the server does not ring the system bell unless
you call <emphasis>
XkbForceDeviceBell</emphasis>
or <emphasis>
XkbForceBell</emphasis>
(see section 9.3.3). <!-- xref -->
</para>
<para>
Audible bells are also part of the per-client auto-reset controls. For more
information on auto-reset controls, see section 10.1.2. <!-- xref -->
</para>
</sect1>
<sect1 id='Bell_Functions'>
<title>Bell Functions</title>
<para>
Use the functions described in this section to ring bells and to generate bell
events.
</para>
<para>
The input extension has two types of feedbacks that can generate bells — bell
feedback and keyboard feedback. Some of the functions in this section have
<emphasis>
bell_class</emphasis>
and <emphasis>
bell_id</emphasis>
parameters; set them as follows: Set <emphasis>
bell_class</emphasis>
to <emphasis>
BellFeedbackClass</emphasis>
or <emphasis>
KbdFeedbackClass</emphasis>
. A device can have more than one feedback of each type; set <emphasis>
bell_id</emphasis>
to the particular bell feedback of <emphasis>
bell_class</emphasis>
type.
</para>
<para>
Table 9.2 shows the conditions that cause a bell to sound or an <emphasis> <!-- xref -->
XkbBellNotifyEvent</emphasis>
to be generated when a bell function is called.
</para>
<table frame='topbot'>
<title>Bell Sounding and Bell Event Generating</title>
<?dbfo keep-together="always" ?>
<tgroup cols='4' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<colspec colname='c2' colwidth='1.0*'/>
<colspec colname='c3' colwidth='1.0*'/>
<colspec colname='c4' colwidth='1.0*'/>
<thead>
<row rowsep='1'>
<entry>Function called</entry>
<entry>AudibleBell</entry>
<entry>Server sounds a bell</entry>
<entry>Server sends an XkbBellNotifyEvent</entry>
</row>
</thead>
<tbody>
<row>
<entry>XkbDeviceBell</entry>
<entry>On</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry>XkbDeviceBell</entry>
<entry>Off</entry>
<entry>No</entry>
<entry>Yes</entry>
</row>
<row>
<entry>XkbBell</entry>
<entry>On</entry>
<entry>Yes</entry>
<entry>Yes</entry>
</row>
<row>
<entry>XkbBell</entry>
<entry>Off</entry>
<entry>No</entry>
<entry>Yes</entry>
</row>
<row>
<entry>XkbDeviceBellEvent</entry>
<entry>On or Off</entry>
<entry>No</entry>
<entry>Yes</entry>
</row>
<row>
<entry>XkbBellEvent</entry>
<entry>On or Off</entry>
<entry>No</entry>
<entry>Yes</entry>
</row>
<row>
<entry>XkbDeviceForceBell</entry>
<entry>On or Off</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
<row>
<entry>XkbForceBell</entry>
<entry>On or Off</entry>
<entry>Yes</entry>
<entry>No</entry>
</row>
</tbody>
</tgroup>
</table>
<sect2 id='Generating_Named_Bells'>
<title>Generating Named Bells</title>
<para>
To ring the bell on an X input extension device or the default keyboard, use
<emphasis>
XkbDeviceBell.</emphasis>
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Bool <emphasis>
XkbDeviceBell</emphasis>
(<emphasis>
display, window, device_id, bell_class, bell_id, percent, name</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display *<emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Window<emphasis>
window</emphasis>
; /* window for which the bell is generated, or None */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
bell_class</emphasis>
; /* X input extension bell class of the bell to be rung */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
bell_id</emphasis>
; /* X input extension bell ID of the bell to be rung */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
percent</emphasis>
; /* bell volume, from -100 to 100 inclusive */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Atom <emphasis>
name</emphasis>
; /* a name for the bell, or <emphasis>
NULL</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Set <emphasis>
percent</emphasis>
to be the volume relative to the base volume for the keyboard as described for
<emphasis>
XBell</emphasis>.
</para>
<para>
Note that <emphasis>
bell_class</emphasis>
and <emphasis>
bell_id</emphasis>
indicate the bell to physically ring. <emphasis>
name</emphasis>
is simply an arbitrary moniker for the client application’s use.
</para>
<para>
To determine the current feedback settings of an extension input device, use
<emphasis>
XGetFeedbackControl</emphasis>
. See the X input extension documentation for more information on <emphasis>
XGetFeedbackControl</emphasis>
and related data structures.
</para>
<para>
If a compatible keyboard extension is not present in the X server, <emphasis>
XkbDeviceBell</emphasis>
immediately returns <emphasis>
False</emphasis>
. Otherwise, <emphasis>
XkbDeviceBell </emphasis>
rings the bell as specified for the display and keyboard device and returns
<emphasis>
True</emphasis>
. If you have disabled the audible bell, the server does not ring the system
bell, although it does generate a <emphasis>
XkbBellNotify</emphasis>
event.
</para>
<para>
You can call <emphasis>
XkbDeviceBell</emphasis>
without first initializing the keyboard extension.
</para>
<para>
As a convenience function, Xkb provides a function to ring the bell on the
default keyboard: <emphasis>
XkbBell.</emphasis>
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Bool <emphasis>
XkbBell</emphasis>
(<emphasis>
display, window, percent, name</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Window<emphasis>
window</emphasis>
; /* event window, or None*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
int<emphasis>
percent</emphasis>
; /* relative volume, which can range from -100 to 100 inclusive */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Atom<emphasis>
name</emphasis>
; /* a bell name, or <emphasis>
NULL</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
If a compatible keyboard extension isn’t present in the X server, <emphasis>
XkbBell</emphasis>
calls <emphasis>
XBell </emphasis>
with the specified <emphasis>
display</emphasis>
and <emphasis>
percent</emphasis>
, and returns <emphasis>
False</emphasis>
. Otherwise, <emphasis>
XkbBell </emphasis>
calls <emphasis>
XkbDeviceBell</emphasis>
with the specified <emphasis>
display, window, percent, </emphasis>
and <emphasis>
name</emphasis>
, a <emphasis>
device_spec</emphasis>
of <emphasis>
XkbUseCoreKbd</emphasis>
, a <emphasis>
bell_class </emphasis>
of <emphasis>
XkbDfltXIClass</emphasis>
, and a <emphasis>
bell_id </emphasis>
of <emphasis>
XkbDfltXIId,</emphasis>
and returns <emphasis>
True</emphasis>.
</para>
<para>
If you have disabled the audible bell, the server does not ring the system
bell, although it does generate a <emphasis>
XkbBellNotify</emphasis>
event.
</para>
<para>
You can call <emphasis>
XkbBell</emphasis>
without first initializing the keyboard extension.
</para>
</sect2>
<sect2 id='Generating_Named_Bell_Events'>
<title>Generating Named Bell Events</title>
<para>
Using Xkb, you can also generate a named bell event that does not ring any
bell. This allows you to do things such as generate events when your
application starts.
</para>
<para>
For example, if an audio client listens for these types of bells, it can
produce a "whoosh" sound when it receives a named bell event to indicate a
client just started. In this manner, applications can generate start-up
feedback and not worry about producing annoying beeps if an audio server is not
running.
</para>
<para>
To cause a bell event for an X input extension device or for the keyboard,
without ringing the corresponding bell, use <emphasis>
XkbDeviceBellEvent.</emphasis>
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Bool <emphasis>
XkbDeviceBellEvent</emphasis>
(<emphasis>
display, window, device_spec, bell_class, bell_id, percent, name</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Window <emphasis>
window</emphasis>
; /* event window, or None*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
bell_class;</emphasis>
/* input extension bell class for the event */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
bell_id</emphasis>
; /* input extension bell ID for the event */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
percent</emphasis>
; /* volume for the bell, which can range from -100 to 100 inclusive */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Atom <emphasis>
name</emphasis>
; /* a bell name, or <emphasis>
NULL</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
If a compatible keyboard extension isn’t present in the X server, <emphasis>
XkbDeviceBellEvent</emphasis>
immediately returns <emphasis>
False</emphasis>
. Otherwise, <emphasis>
XkbDeviceBellEvent</emphasis>
causes an <emphasis>
XkbBellNotify</emphasis>
event to be sent to all interested clients and returns <emphasis>
True</emphasis>
. Set <emphasis>
percent</emphasis>
to be the volume relative to the base volume for the keyboard as described for
<emphasis>XBell</emphasis>.
</para>
<para>
In addition, <emphasis>
XkbDeviceBellEvent</emphasis>
may generate <emphasis>
Atom</emphasis>
protocol errors as well as <emphasis>
XkbBellNotify</emphasis>
events. You can call <emphasis>
XkbBell</emphasis>
without first initializing the keyboard extension.
</para>
<para>
As a convenience function, Xkb provides a function to cause a bell event for
the keyboard without ringing the bell: <emphasis>
XkbBellEvent.</emphasis>
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Bool <emphasis>
XkbBellEvent</emphasis>
(<emphasis>
display, window, percent, name</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Window <emphasis>
window</emphasis>
; /* the event window, or None */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
percent</emphasis>
; /* relative volume, which can range from -100 to 100 inclusive */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Atom <emphasis>
name</emphasis>
; /* a bell name, or <emphasis>
NULL</emphasis>
*/
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
If a compatible keyboard extension isn’t present in the X server, <emphasis>
XkbBellEvent</emphasis>
immediately returns <emphasis>
False</emphasis>
. Otherwise, <emphasis>
XkbBellEvent </emphasis>
calls<emphasis>
XkbDeviceBellEvent</emphasis>
with the specified <emphasis>
display, window, percent, </emphasis>
and <emphasis>
name</emphasis>
, a <emphasis>
device_spec</emphasis>
of <emphasis>
XkbUseCoreKbd</emphasis>
, a <emphasis>
bell_class </emphasis>
of <emphasis>
XkbDfltXIClass</emphasis>
, and a <emphasis>
bell_id </emphasis>
of <emphasis>
XkbDfltXIId,</emphasis>
and returns what <emphasis>
XkbDeviceBellEvent</emphasis>
returns.
</para>
<para>
<emphasis>XkbBellEvent</emphasis>
generates a <emphasis>XkbBellNotify</emphasis>
event.
</para>
<para>
You can call <emphasis>
XkbBellEvent</emphasis>
without first initializing the keyboard extension.
</para>
</sect2>
<sect2 id='Forcing_a_Server_Generated_Bell'>
<title>Forcing a Server-Generated Bell</title>
<para>
To ring the bell on any keyboard, overriding user preference settings for
audible bells, use <emphasis>XkbForceDeviceBell</emphasis>.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Bool <emphasis>
XkbForceDeviceBell</emphasis>
(<emphasis>
display, window, device_spec, bell_class, bell_id, percent</emphasis>
)
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
Window <emphasis>
window</emphasis>
; /* event window, or None */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
device_spec</emphasis>
; /* device ID, or <emphasis>
XkbUseCoreKbd</emphasis>
*/
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
bell_class</emphasis>
; /* input extension class of the bell to be rung */
</entry>
</row>
<row>
<entry role='functionargdecl'>
unsigned int <emphasis>
bell_id</emphasis>
; /* input extension ID of the bell to be rung */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
percent</emphasis>
; /* relative volume, which can range from -100 to 100 inclusive */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
If a compatible keyboard extension isn’t present in the X server, <emphasis>
XkbForceDeviceBell</emphasis>
immediately returns <emphasis>
False</emphasis>
. Otherwise, <emphasis>
XkbForceDeviceBell </emphasis>
rings the bell as specified for the display and keyboard device and returns
<emphasis>
True</emphasis>
. Set <emphasis>
percent</emphasis>
to be the volume relative to the base volume for the keyboard as described for
<emphasis>
XBell</emphasis>
. There is no <emphasis>
name</emphasis>
parameter because <emphasis>
XkbForceDeviceBell </emphasis>
does not cause an <emphasis>
XkbBellNotify</emphasis>
event.
</para>
<para>
You can call <emphasis>
XkbBell</emphasis>
without first initializing the keyboard extension.
</para>
<para>
To ring the bell on the default keyboard, overriding user preference settings
for audible bells, use <emphasis>
XkbForceBell</emphasis>.
</para>
<informaltable frame='none'>
<?dbfo keep-together="always" ?>
<tgroup cols='1' align='left' colsep='0' rowsep='0'>
<colspec colname='c1' colwidth='1.0*'/>
<tbody>
<row>
<entry role='functiondecl'>
Bool <emphasis>
XkbForceBell</emphasis>
(<emphasis>
display, percent)</emphasis>
</entry>
</row>
<row>
<entry role='functionargdecl'>
Display * <emphasis>
display</emphasis>
; /* connection to the X server */
</entry>
</row>
<row>
<entry role='functionargdecl'>
int <emphasis>
percent</emphasis>
; /* volume for the bell, which can range from -100 to 100 inclusive */
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
If a compatible keyboard extension isn’t present in the X server, <emphasis>
XkbForceBell</emphasis>
calls <emphasis>
XBell </emphasis>
with the specified <emphasis>
display</emphasis>
and <emphasis>
percent</emphasis>
and returns <emphasis>
False</emphasis>
. Otherwise, <emphasis>
XkbForceBell </emphasis>
calls <emphasis>
XkbForceDeviceBell</emphasis>
with the specified <emphasis>
display </emphasis>
and<emphasis>
percent</emphasis>
, <emphasis>
device_spec</emphasis>
=<emphasis>
XkbUseCoreKbd</emphasis>
, <emphasis>
bell_class </emphasis>
= <emphasis>
XkbDfltXIClass</emphasis>
, <emphasis>
bell_id </emphasis>
= <emphasis>
XkbDfltXIId,</emphasis>
<emphasis>
window</emphasis>
= None, and <emphasis>
name</emphasis>
= <emphasis>
NULL</emphasis>
, and returns what<emphasis>
XkbForceDeviceBell</emphasis>
returns.
</para>
<para>
<emphasis>
XkbForceBell </emphasis>
does not cause an <emphasis>
XkbBellNotify</emphasis>
event.
</para>
<para>
You can call <emphasis>
XkbBell</emphasis>
without first initializing the keyboard extension.
</para>
</sect2>
</sect1>
<sect1 id='Detecting_Bells'>
<title>Detecting Bells</title>
<para>
Xkb generates <emphasis>
XkbBellNotify</emphasis>
events for all bells except for those resulting from calls to <emphasis>
XkbForceDeviceBell</emphasis>
and <emphasis>
XkbForceBell</emphasis>
. To receive <emphasis>
XkbBellNotify</emphasis>
events under all possible conditions, pass <emphasis>
XkbBellNotifyMask</emphasis>
in both the <emphasis>
bits_to_change </emphasis>
and<emphasis>
values_for_bits</emphasis>
parameters to <emphasis>
XkbSelectEvents</emphasis>
(see section 4.3). <!-- xref -->
</para>
<para>
The <emphasis>
XkbBellNotify</emphasis>
event has no event details. It is either selected or it is not. However, you
can call <emphasis>
XkbSelectEventDetails</emphasis>
using <emphasis>
XkbBellNotify</emphasis>
as the <emphasis>
event_type</emphasis>
and specifying <emphasis>
XkbAllBellNotifyMask</emphasis>
in <emphasis>
bits_to_change</emphasis>
and <emphasis>
values_for_bits.</emphasis>
This has the same effect as a call to <emphasis>
XkbSelectEvents</emphasis>.
</para>
<para>
The structure for the <emphasis>
XkbBellNotify</emphasis>
event type contains:
</para>
<para><programlisting>
typedef struct _XkbBellNotify {
int type; /* Xkb extension base event code */
unsigned long serial; /* X server serial number for event */
Bool send_event; /* <emphasis> True</emphasis> => synthetically generated */
Display * display; /* server connection where event generated */
Time time; /* server time when event generated */
int xkb_type; /* <emphasis> XkbBellNotify</emphasis> */
unsigned int device; /* Xkb device ID, will not be <emphasis> XkbUseCoreKbd</emphasis> */
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; /* <emphasis> False</emphasis> -> the server did not produce a beep */
} <emphasis>XkbBellNotifyEvent</emphasis>;
</programlisting></para>
<para>
If your application needs to generate visual bell feedback on the screen when
it receives a bell event, use the window ID in the <emphasis>
XkbBellNotifyEvent</emphasis>
, if present.
</para>
</sect1>
</chapter>
|