2 * Copyright 2002 Red Hat Inc., Durham, North Carolina.
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation on the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial
16 * portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
22 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
23 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * Rickard E. (Rik) Faith <faith@redhat.com>
39 pkc(XKeyboardControl
* kc
, unsigned long vm
)
41 if (vm
& KBKeyClickPercent
)
42 printf(" key_click_percent = %d\n", kc
->key_click_percent
);
43 if (vm
& KBBellPercent
)
44 printf(" bell_percent = %d\n", kc
->bell_percent
);
46 printf(" bell_pitch = %d\n", kc
->bell_pitch
);
47 if (vm
& KBBellDuration
)
48 printf(" bell_duration = %d\n", kc
->bell_duration
);
50 printf(" led = 0x%x\n", kc
->led
);
52 printf(" led_mode = %d\n", kc
->led_mode
);
54 printf(" key = %d\n", kc
->key
);
55 if (vm
& KBAutoRepeatMode
)
56 printf(" auto_repeat_mode = %d\n", kc
->auto_repeat_mode
);
60 pks(XKeyboardState
* ks
)
62 printf(" key_click_percent = %d\n", ks
->key_click_percent
);
63 printf(" bell_percent = %d\n", ks
->bell_percent
);
64 printf(" bell_pitch = %u\n", ks
->bell_pitch
);
65 printf(" bell_duration = %u\n", ks
->bell_duration
);
66 printf(" led_mask = 0x%lx\n", ks
->led_mask
);
67 printf(" global_auto_repeat = %d\n", ks
->global_auto_repeat
);
71 main(int argc
, char **argv
)
73 Display
*display
= XOpenDisplay(NULL
);
79 printf("Usage: xbell percent baseVolume pitch duration\n");
83 vm
= (KBBellPercent
| KBBellPitch
| KBBellDuration
);
84 kc
.key_click_percent
= atoi(argv
[1]);
85 kc
.bell_percent
= atoi(argv
[2]);
86 kc
.bell_pitch
= atoi(argv
[3]);
87 kc
.bell_duration
= atoi(argv
[4]);
91 XChangeKeyboardControl(display
, vm
, &kc
);
94 XGetKeyboardControl(display
, &ks
);
99 XCloseDisplay(display
);