keyboard bell woes (ignores xset)

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 16 16:52:17 PDT 2010


On Tue, Mar 16, 2010 at 04:37:31PM -0700, Jeremy Huddleston wrote:
> I started looking into this because a user reported that XQuartz was still
> beeping in his xterm even though he uses 'xset -b' ... it turns out that
> xterm is using XkbBell() rather than XBell().  Even with 'xset -b', the
> audible bell is still calling DDXRingBell() with volume = 50...
> 
> I made a reduced test case that does:
> 
> XBell(dpy, 0);            // No beep with 'xset -b'
> XkbBell(dpy, 0, 0, None); // Beep with vol=50 with 'xset -b'
> 
> shouldn't these be the same?

I think so. This may be some wierd interaction between core and XKB with the
bell feedback classes though, where XKB slips through the cracks because on
some device the base is still on the default. No idea on the details though.

Cheers,
  Peter

> On Mar 16, 2010, at 15:30, Peter Hutterer wrote:
> 
> > 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
> > 
> > _______________________________________________
> > xorg-devel at lists.x.org: X.Org development
> > Archives: http://lists.x.org/archives/xorg-devel
> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 




More information about the xorg-devel mailing list