e_remember: add e_client sound volume support

@features
This commit is contained in:
Michaël Bouchaud (yoz) 2016-10-14 20:49:35 +02:00
parent 307f0831ce
commit 6e8070d226
5 changed files with 50 additions and 3 deletions

View File

@ -64,6 +64,7 @@ e_client_volume_sink_del(E_Client_Volume_Sink *sink)
EINA_LIST_FREE(sink->clients, ec)
{
ec->sinks = eina_list_remove(ec->sinks, sink);
e_comp_object_frame_volume_update(ec->frame);
}
free(sink);
}

View File

@ -385,6 +385,10 @@ _e_config_edd_init(Eina_Bool old)
E_CONFIG_VAL(D, T, prop.desktop_file, STR);
E_CONFIG_VAL(D, T, prop.offer_resistance, UCHAR);
E_CONFIG_VAL(D, T, prop.opacity, UCHAR);
E_CONFIG_VAL(D, T, prop.volume, INT);
E_CONFIG_VAL(D, T, prop.volume_min, INT);
E_CONFIG_VAL(D, T, prop.volume_max, INT);
E_CONFIG_VAL(D, T, prop.mute, UCHAR);
E_CONFIG_VAL(D, T, uuid, STR);
E_CONFIG_VAL(D, T, pid, INT);

View File

@ -12,6 +12,7 @@ static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E
#define MODE_NOTHING 0
#define MODE_GEOMETRY E_REMEMBER_APPLY_POS | E_REMEMBER_APPLY_SIZE
#define MODE_LOCKS E_REMEMBER_APPLY_LOCKS
#define MODE_VOLUME E_REMEMBER_APPLY_VOLUME
#define MODE_GEOMETRY_LOCKS E_REMEMBER_APPLY_POS | E_REMEMBER_APPLY_SIZE | E_REMEMBER_APPLY_LOCKS
#define MODE_ALL E_REMEMBER_APPLY_POS | E_REMEMBER_APPLY_SIZE | E_REMEMBER_APPLY_LAYER | \
E_REMEMBER_APPLY_LOCKS | E_REMEMBER_APPLY_BORDER | E_REMEMBER_APPLY_STICKY | \
@ -62,6 +63,7 @@ struct _E_Config_Dialog_Data
int keep_settings;
int offer_resistance;
int apply_opacity;
int apply_volume;
} remember;
int applied;
@ -279,6 +281,8 @@ _fill_data(E_Config_Dialog_Data *cfdata)
cfdata->remember.offer_resistance = 1;
if (rem->apply & E_REMEMBER_APPLY_OPACITY)
cfdata->remember.apply_opacity = 1;
if (rem->apply & E_REMEMBER_APPLY_VOLUME)
cfdata->remember.apply_volume = 1;
}
if (!rem) cfdata->mode = MODE_NOTHING;
@ -610,6 +614,8 @@ _advanced_apply_data(E_Config_Dialog *cfd EINA_UNUSED, E_Config_Dialog_Data *cfd
rem->apply |= E_REMEMBER_APPLY_OFFER_RESISTANCE;
if (cfdata->remember.apply_opacity)
rem->apply |= E_REMEMBER_APPLY_OPACITY;
if (cfdata->remember.apply_volume)
rem->apply |= E_REMEMBER_APPLY_VOLUME;
if (ec && (!rem->apply && !rem->prop.desktop_file))
{
@ -654,6 +660,8 @@ _basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dia
e_widget_list_object_append(o, ob, 1, 1, 0.5);
ob = e_widget_radio_add(evas, _("Size, Position and Locks"), MODE_GEOMETRY_LOCKS, rg);
e_widget_list_object_append(o, ob, 1, 1, 0.5);
ob = e_widget_radio_add(evas, _("Volume"), MODE_VOLUME, rg);
e_widget_list_object_append(o, ob, 1, 1, 0.5);
ob = e_widget_radio_add(evas, _("All"), MODE_ALL, rg);
e_widget_list_object_append(o, ob, 1, 1, 0.5);
return o;
@ -789,10 +797,13 @@ _advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data
e_widget_table_object_append(of, ob, 0, 7, 1, 1, 1, 0, 1, 0);
oc = e_widget_check_add(evas, _("Application file or name (.desktop)"),
&(cfdata->remember.apply_desktop_file));
e_widget_table_object_append(of, oc, 0, 8, 1, 1, 1, 0, 1, 0);
e_widget_table_object_append(of, ob, 0, 8, 1, 1, 1, 0, 1, 0);
oc = e_widget_check_add(evas, _("Volume"),
&(cfdata->remember.apply_volume));
e_widget_table_object_append(of, oc, 0, 9, 1, 1, 1, 0, 1, 0);
ob = e_widget_entry_add(cfd->dia->win, &cfdata->desktop, NULL, NULL, NULL);
e_widget_check_widget_disable_on_unchecked_add(oc, ob);
e_widget_table_object_append(of, ob, 0, 9, 2, 1, 1, 0, 1, 0);
e_widget_table_object_append(of, ob, 0, 10, 2, 1, 1, 0, 1, 0);
e_widget_toolbook_page_append(o, NULL, _("Properties"), of, 1, 1, 1, 1, 0.5, 0.0);
of = e_widget_table_add(e_win_evas_win_get(evas), 0);

View File

@ -133,7 +133,8 @@ e_remember_internal_save(void)
E_REMEMBER_APPLY_SKIP_PAGER |
E_REMEMBER_APPLY_SKIP_TASKBAR |
E_REMEMBER_APPLY_OFFER_RESISTANCE |
E_REMEMBER_APPLY_OPACITY);
E_REMEMBER_APPLY_OPACITY |
E_REMEMBER_APPLY_VOLUME);
_e_remember_update(ec, rem);
remembers->list = eina_list_append(remembers->list, rem);
@ -552,6 +553,22 @@ e_remember_apply(E_Remember *rem, E_Client *ec)
ec->want_focus = 1;
if (rem->apply & E_REMEMBER_APPLY_OPACITY)
ec->netwm.opacity = rem->prop.opacity;
if (rem->apply & E_REMEMBER_APPLY_VOLUME)
{
if (!ec->volume_control_enabled)
{
ec->volume_control_enabled = EINA_TRUE;
ec->volume = rem->prop.volume;
ec->volume_min = rem->prop.volume_min;
ec->volume_max = rem->prop.volume_max;
ec->mute = rem->prop.mute;
}
else
{
e_client_volume_set(ec, rem->prop.volume);
e_client_volume_mute_set(ec, rem->prop.mute);
}
}
if (temporary)
_e_remember_free(rem);
@ -788,6 +805,14 @@ _e_remember_update(E_Client *ec, E_Remember *rem)
rem->pid = ec->netwm.pid;
rem->apply_first_only = 1;
}
if (rem->apply & E_REMEMBER_APPLY_VOLUME)
{
rem->prop.volume = ec->volume;
rem->prop.volume_min = ec->volume_min;
rem->prop.volume_max = ec->volume_max;
rem->prop.mute = ec->mute;
}
rem->no_reopen = ec->internal_no_reopen;
{
E_Event_Remember_Update *ev;

View File

@ -36,6 +36,7 @@ typedef struct _E_Remember E_Remember;
#define E_REMEMBER_APPLY_OFFER_RESISTANCE (1 << 16)
#define E_REMEMBER_APPLY_OPACITY (1 << 17)
#define E_REMEMBER_APPLY_UUID (1 << 18)
#define E_REMEMBER_APPLY_VOLUME (1 << 19)
#define E_REMEMBER_INTERNAL_DIALOGS (1 << 0)
#define E_REMEMBER_INTERNAL_FM_WINS (1 << 1)
@ -109,6 +110,11 @@ struct _E_Remember
const char *command;
const char *desktop_file;
unsigned char opacity;
int volume;
int volume_min;
int volume_max;
unsigned char mute;
} prop;
Eina_Stringshare *uuid;
int pid;