summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel@osg.samsung.com>2020-12-26 19:18:33 +0100
committerMarcel Hollerbach <marcel@osg.samsung.com>2020-12-26 19:19:10 +0100
commitd805a9d4ee7034aee60aa8423fc43f60d44cee32 (patch)
tree550bccec26216241bb8f19d78bb809f39acf931b
parent199bc82cbf9c15e0ca2ab6453005ee592f5c6796 (diff)
downloadenlightenment-devs/bu5hm4n/mixerfun.tar.gz
-rw-r--r--src/bin/e_client_volume.c12
-rw-r--r--src/bin/e_client_volume.h5
-rw-r--r--src/modules/mixer/backend.c1
-rw-r--r--src/modules/mixer/e_mod_main.c37
4 files changed, 51 insertions, 4 deletions
diff --git a/src/bin/e_client_volume.c b/src/bin/e_client_volume.c
index e44f603140..08ed30734b 100644
--- a/src/bin/e_client_volume.c
+++ b/src/bin/e_client_volume.c
@@ -171,6 +171,18 @@ e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink
return sink;
}
+E_API void*
+e_client_volume_sink_input_get(E_Client_Volume_Sink *sink)
+{
+ return sink->input;
+}
+
+E_API void
+e_client_volume_sink_input_set(E_Client_Volume_Sink *sink, void *emix_input)
+{
+ sink->input = emix_input;
+}
+
E_API void
e_client_volume_sink_del(E_Client_Volume_Sink *sink)
{
diff --git a/src/bin/e_client_volume.h b/src/bin/e_client_volume.h
index 12ae836289..5d9568c98d 100644
--- a/src/bin/e_client_volume.h
+++ b/src/bin/e_client_volume.h
@@ -1,6 +1,7 @@
#ifndef E_CLIENT_VOLUME_H_
#define E_CLIENT_VOLUME_H_
+
typedef struct _E_Client_Volume_Sink E_Client_Volume_Sink;
typedef struct _E_Event_Client_Volume_Sink E_Event_Client_Volume_Sink;
@@ -26,6 +27,7 @@ struct _E_Client_Volume_Sink
E_Client_Volume_Sink_Name_Get func_name_get;
void *data;
Eina_List *clients;
+ void *input;
};
struct _E_Event_Client_Volume_Sink
@@ -57,4 +59,7 @@ 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);
E_API void e_client_volume_object_emit(E_Client *ec, const char *sig, const char *src);
+E_API void* e_client_volume_sink_input_get(E_Client_Volume_Sink *sink);
+E_API void e_client_volume_sink_input_set(E_Client_Volume_Sink *sink, void *emix_input);
+
#endif
diff --git a/src/modules/mixer/backend.c b/src/modules/mixer/backend.c
index 7fcb2c73c8..3e9d130a7a 100644
--- a/src/modules/mixer/backend.c
+++ b/src/modules/mixer/backend.c
@@ -551,6 +551,7 @@ _sink_input_event(int type, Emix_Sink_Input *input)
_sink_input_max_get,
_sink_input_name_get,
input);
+ e_client_volume_sink_input_set(sink, input);
e_client_volume_sink_append(ec, sink);
_client_sinks = eina_list_append(_client_sinks, sink);
found = EINA_TRUE;
diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c
index 24692c6e71..7b41488ba2 100644
--- a/src/modules/mixer/e_mod_main.c
+++ b/src/modules/mixer/e_mod_main.c
@@ -64,6 +64,21 @@ struct _Instance
static Context *mixer_context = NULL;
static Eina_List *_handlers = NULL;
+static Emix_Sink*
+current_focused_client_sink_get(void)
+{
+ E_Client *client = e_client_focused_get();
+ if (!client) return NULL;
+ Eina_List *inputs = client->sinks;
+ if (eina_list_count(inputs) == 0) return NULL;
+ E_Client_Volume_Sink *first_vsink = eina_list_data_get(inputs);
+ if (!first_vsink) return NULL;
+ Emix_Sink_Input *input = e_client_volume_sink_input_get(first_vsink);
+ if (!input) return NULL;
+
+ return input->sink;
+}
+
static void
_mixer_popup_update(Instance *inst, int mute, int vol)
{
@@ -108,9 +123,14 @@ _mixer_gadget_update(void)
if (inst->list)
{
+ Emix_Sink *current_sink = current_focused_client_sink_get();
+
EINA_LIST_FOREACH(elm_list_items_get(inst->list), ll, it)
{
- if (backend_sink_default_get() == elm_object_item_data_get(it))
+ Emix_Sink *sink = elm_object_item_data_get(it);
+ if (sink == current_sink)
+ elm_list_item_selected_set(it, EINA_TRUE);
+ else if (!current_sink && backend_sink_default_get() == elm_object_item_data_get(it))
elm_list_item_selected_set(it, EINA_TRUE);
}
}
@@ -184,6 +204,7 @@ _mixer_sinks_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
{
Instance *inst;
Eina_List *l, *ll;
+ Emix_Sink *current_sink = current_focused_client_sink_get();
EINA_LIST_FOREACH(mixer_context->instances, l, inst)
{
@@ -199,10 +220,13 @@ _mixer_sinks_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
it = elm_list_item_append(inst->list, s->name, NULL, NULL,
_sink_selected_cb, s);
- if (backend_sink_default_get() == s)
+ if (current_sink == s)
+ default_it = it;
+ else if (!current_sink && backend_sink_default_get() == s)
default_it = it;
}
elm_list_go(inst->list);
+
if (default_it)
elm_list_item_selected_set(default_it, EINA_TRUE);
}
@@ -211,14 +235,16 @@ _mixer_sinks_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
return ECORE_CALLBACK_PASS_ON;
}
+
static void
_popup_new(Instance *inst)
{
Evas_Object *button, *list, *slider, *bx;
- Emix_Sink *s;
+ Emix_Sink *s, *current_focused_sink;
Eina_List *l;
Elm_Object_Item *default_it = NULL;
+ current_focused_sink = current_focused_client_sink_get();
inst->popup = e_gadcon_popup_new(inst->gcc, 0);
list = elm_box_add(e_comp->elm);
@@ -227,12 +253,15 @@ _popup_new(Instance *inst)
evas_object_size_hint_align_set(inst->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
evas_object_size_hint_weight_set(inst->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(inst->list);
+
EINA_LIST_FOREACH((Eina_List *)emix_sinks_get(), l, s)
{
Elm_Object_Item *it;
it = elm_list_item_append(inst->list, s->name, NULL, NULL, _sink_selected_cb, s);
- if (backend_sink_default_get() == s)
+ if (current_focused_sink == s)
+ default_it = it;
+ else if (!current_focused_sink && backend_sink_default_get() == s)
default_it = it;
}
elm_list_go(inst->list);