keyboard bell woes (ignores xset)

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 16 15:30:05 PDT 2010


On Tue, Mar 16, 2010 at 01:12:54PM -0700, Jeremy Huddleston wrote:
> Actually, as I read this again, I noticed that it is behaving as per the spec:
> 
> XBell(dpy, 100) with base = 0:
> base - [(base * percent) / 100] + percent = 0 - 0 + 100 = 100
> 
> XBell(dpy, 100) with base = 100:
> base - [(base * percent) / 100] + percent = 100 - 100 + 100 = 100
> 
> So... this just seems a bit deceptive... if 'xset -b' is supposed to mute
> the keyboard bell, why was XBell() designed to work around this?

I think you need to ask the question the other way round - why does 
xset -b provide a functionality that XBell() can route around. I'm pretty
sure XBell() was there first :)

Looks like to really disable the bell for core requests you need to call
XkbSetControls() with the XkbAudibleBellMask. That way it can only be
overridden by a forced XkbBell() request, not by any core requests.
xset at this point doesn't do xkb but I don't se why it couldn't.

Cheers,
  Peter
 
 
> On Mar 16, 2010, at 11:47, Jeremy Huddleston wrote:
> 
> > I turn off the bell using 'xset -b' :
> > ~ $ xset -q | grep bell
> >  bell percent:  0    bell pitch:  400    bell duration:  100
> > 
> > but when I do XBell(dpy, 100), the bell still rings at volume 100.
> > 
> > #0  DDXRingBell (volume=100, pitch=400, duration=100) at quartzAudio.c:223
> > #1  0x0000000100138ba2 in CoreKeyboardBell (volume=100, pDev=0x115b708e0, arg=0x115b71100, something=0) at devices.c:498
> > #2  0x0000000100105114 in XkbHandleBell (force=0 '\0', eventOnly=0 '\0', kbd=0x115b708e0, percent=100 'd', pCtrl=0x115b71100, class=0 '\0', name=0, pWin=0x0, pClient=0x115e11c00) at xkbEvents.c:514
> > 
> > Shouldn't the bell percent set by 'xset' be multiplied by the volume passed to XBell?  From XBell(3):
> > 
> > """
> >       The XBell function rings the bell on the keyboard on the specified display, if possible.  The specified
> >       volume is relative to the base volume for the keyboard.  If the value for the percent argument is not in
> >       the range -100 to 100 inclusive, a BadValue error results.  The volume at which the bell rings when the
> >       percent argument is nonnegative is:
> > 
> >              base - [(base * percent) / 100] + percent
> > 
> >       The volume at which the bell rings when the percent argument is negative is:
> > 
> >              base + [(base * percent) / 100]
> > """
> > 
> > --Jeremy



More information about the xorg-devel mailing list