e client mixer - stop messing with mute + volume state just for display

so add a new sink or get an update on state and e will SEt volume/mute
settings, not just passively disdplay them. this has been messing up
rage's winlist (mouse over on right) for several months now... and e
is/was wrong.

this doesnt fix all. if an app has multiple streams really this client
mixer needs to display a control per stream, not a single one - eg in
a popup. in fact volume shoud likely be done in a popup instead of
inside titlebar anyway :)

but this fixes the most annoying problem where withotu users doing
anything, the audio starts to play from streams explicitly muted by
the app...
This commit is contained in:
Carsten Haitzler 2017-02-19 21:15:35 +09:00
parent bcea889340
commit 718f0fe0f4
2 changed files with 16 additions and 9 deletions

View File

@ -199,14 +199,8 @@ e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sink *sink)
volume_max = e_client_volume_sink_max_get(sink);
if (ec->volume_max > volume_max)
ec->volume_max = volume_max;
if ((ec->volume_min > ec->volume)
|| (ec->volume_max < ec->volume))
e_client_volume_set(ec, ec->volume);
e_client_volume_sink_get(sink, &volume, &mute);
if ((ec->volume != volume) || (ec->mute != mute))
{
e_client_volume_sink_set(sink, ec->volume, ec->mute);
}
e_client_volume_display_set(ec, volume, mute);
}
else
{
@ -242,11 +236,22 @@ e_client_volume_sink_update(E_Client_Volume_Sink *sink)
e_client_volume_sink_get(sink, &volume, &mute);
EINA_LIST_FOREACH(sink->clients, l, ec)
{
e_client_volume_set(ec, volume);
e_client_volume_mute_set(ec, mute);
e_client_volume_display_set(ec, volume, mute);
}
}
E_API void
e_client_volume_display_set(E_Client *ec, int volume, Eina_Bool mute)
{
ec->volume = volume;
ec->mute = !!mute;
if (mute)
_e_client_volume_event_simple(ec, E_EVENT_CLIENT_MUTE);
else
_e_client_volume_event_simple(ec, E_EVENT_CLIENT_UNMUTE);
_e_client_volume_event_simple(ec, E_EVENT_CLIENT_VOLUME);
}
E_API void
e_client_volume_set(E_Client *ec, int volume)
{

View File

@ -41,4 +41,6 @@ E_API void e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sin
E_API void e_client_volume_sink_remove(E_Client *ec, E_Client_Volume_Sink *mixer);
E_API void e_client_volume_sink_update(E_Client_Volume_Sink *mixer);
E_API void e_client_volume_display_set(E_Client *ec, int volume, Eina_Bool mute);
#endif