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>
38 static void pkc(XKeyboardControl
*kc
, unsigned long vm
)
40 if (vm
&KBKeyClickPercent
)
41 printf(" key_click_percent = %d\n", kc
->key_click_percent
);
43 printf(" bell_percent = %d\n", kc
->bell_percent
);
45 printf(" bell_pitch = %d\n", kc
->bell_pitch
);
46 if (vm
&KBBellDuration
)
47 printf(" bell_duration = %d\n", kc
->bell_duration
);
49 printf(" led = 0x%x\n", kc
->led
);
51 printf(" led_mode = %d\n", kc
->led_mode
);
53 printf(" key = %d\n", kc
->key
);
54 if (vm
&KBAutoRepeatMode
)
55 printf(" auto_repeat_mode = %d\n", kc
->auto_repeat_mode
);
58 static void pks(XKeyboardState
*ks
)
60 printf(" key_click_percent = %d\n", ks
->key_click_percent
);
61 printf(" bell_percent = %d\n", ks
->bell_percent
);
62 printf(" bell_pitch = %u\n", ks
->bell_pitch
);
63 printf(" bell_duration = %u\n", ks
->bell_duration
);
64 printf(" led_mask = 0x%lx\n", ks
->led_mask
);
65 printf(" global_auto_repeat = %d\n", ks
->global_auto_repeat
);
68 int main(int argc
, char **argv
)
70 Display
*display
= XOpenDisplay(NULL
);
77 printf("Usage: xbell percent baseVolume pitch duration\n");
84 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
);