Alan Coopersmith wrote:
> John Martin wrote:
>
>> On my b127 system with an Apple keyboard (no bell, I believe):
>>
>
> Current Xorg builds should be trying to sound the bell via both
> /dev/kbd & /dev/audio, and I don't think can tell if the keyboard
> bell is missing (or broken, as it was in several workstations
> for some builds).
>
>
>> if ((rv = XBell(dpy, 100)) != Success) {
>> if (XGetErrorText(dpy, rv, buf, sizeof(buf)) == Success)
>> XBell: BadRequest (invalid request code or no such operation)
>>
>
> The return from XBell isn't an XError code - in fact, XBell() is
> hardcoded to always return 1 since it's asynchronous and has just
> added to the outgoing request buffer when it returns:
> http://cgit.freedesktop.org/xorg/lib/libX11/tree/src/Bell.c#n34
>
> (So your test case also fails since there's no CloseDisplay()
> XFlush(), or Xsync() after the XBell call to actually send
> the queued requests to the server.)
>
The more complete test case still doesn't sound a bell on my system
with a local connection on b127:
$ cat test.c
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
int
main(int argc, char *argv[], char *envp[])
{
Display *dpy;
int rv;
if ((dpy = XOpenDisplay(NULL)) == NULL) {
perror("Opening display");
return (1);
}
(void)XBell(dpy, 100);
XFlush(dpy);
XCloseDisplay(dpy);
return (0);
}
$ cc test.c -lX11
$ ./a.out
$