alsamixer: fix display of active/inactive controls

Signed-off-by: Raymond Yau <superquad.vortex2@gmail.com>
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
Raymond Yau 2011-02-28 15:36:36 +01:00 committed by Clemens Ladisch
parent 209796937a
commit cd26f244e7

View file

@ -59,10 +59,21 @@ enum channel_mask {
static int elem_callback(snd_mixer_elem_t *elem, unsigned int mask) static int elem_callback(snd_mixer_elem_t *elem, unsigned int mask)
{ {
unsigned int i;
if (mask & (SND_CTL_EVENT_MASK_REMOVE | if (mask & (SND_CTL_EVENT_MASK_REMOVE |
SND_CTL_EVENT_MASK_INFO | SND_CTL_EVENT_MASK_INFO |
SND_CTL_EVENT_MASK_VALUE)) SND_CTL_EVENT_MASK_VALUE))
controls_changed = TRUE; controls_changed = TRUE;
if (mask & SND_CTL_EVENT_MASK_INFO)
for (i = 0; i < controls_count; ++i)
if (controls[i].elem == elem) {
controls[i].flags &= ~IS_ACTIVE;
if (snd_mixer_selem_is_active(controls[i].elem))
controls[i].flags |= IS_ACTIVE;
}
return 0; return 0;
} }