Odd XBell(3) inconsistancy

James Cloos cloos at jhcloos.com
Thu Sep 5 14:44:25 PDT 2013


I have my .xinitrc run xset -b to avoid most audio interuptions.

But have my window manager configured to give an audio alert when it
detect new mail in a certain mbox file.  And that works.

Looking at the wm's src, I see that it just calls XBell(display(),100).

Based on XBell(3), it makes sense that that would result in:

      0 - [(0 * 100) / 100] + 100 == 100

and be audible.  Althogh I haven't found the code to confirm the manpage.

But I cannot replicate that in any other X11 client, including a simple:

#include <stdlib.h>
#include <X11/Xlib.h>

int main (int argc, char *argv[])
{
  int vol = 100;
  char *disp = NULL;
  Display *display;

  if (argc > 1)
    vol = atoi(argv[1]);

  if (display = XOpenDisplay(NULL)
    XBell(display, vol);
}

Does anyone have any ideas why the wm is able to sound the bell but no
other clients can?  I don't have a second box here anymore, so I cannot
attach gdb to the server or the wm.

I did find two places in the server src where linux' KDMKTONE ioctl is
called.  hw/dmx/input/lnx-keyboard.c uses:

 ioctl(priv->fd, KDMKTONE, ((1193190 / pitch) & 0xffff)|(duration << 16));

whereas hw/xfree86/os-support/linux/lnx_bell.c uses:

 ioctl(xf86Info.consoleFd, KDMKTONE, ((1193190 / pitch) & 0xffff)|((duration * loudness / 50) << 16));

might the wm hit the first and everything else the latter?

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the xorg-devel mailing list