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)
-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 e44f60314..08ed30734 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
171 return sink; 171 return sink;
172} 172}
173 173
174E_API void*
175e_client_volume_sink_input_get(E_Client_Volume_Sink *sink)
176{
177 return sink->input;
178}
179
180E_API void
181e_client_volume_sink_input_set(E_Client_Volume_Sink *sink, void *emix_input)
182{
183 sink->input = emix_input;
184}
185
174E_API void 186E_API void
175e_client_volume_sink_del(E_Client_Volume_Sink *sink) 187e_client_volume_sink_del(E_Client_Volume_Sink *sink)
176{ 188{
diff --git a/src/bin/e_client_volume.h b/src/bin/e_client_volume.h
index 12ae83628..5d9568c98 100644
--- a/src/bin/e_client_volume.h
+++ b/src/bin/e_client_volume.h
@@ -1,6 +1,7 @@
1#ifndef E_CLIENT_VOLUME_H_ 1#ifndef E_CLIENT_VOLUME_H_
2#define E_CLIENT_VOLUME_H_ 2#define E_CLIENT_VOLUME_H_
3 3
4
4typedef struct _E_Client_Volume_Sink E_Client_Volume_Sink; 5typedef struct _E_Client_Volume_Sink E_Client_Volume_Sink;
5typedef struct _E_Event_Client_Volume_Sink E_Event_Client_Volume_Sink; 6typedef struct _E_Event_Client_Volume_Sink E_Event_Client_Volume_Sink;
6 7
@@ -26,6 +27,7 @@ struct _E_Client_Volume_Sink
26 E_Client_Volume_Sink_Name_Get func_name_get; 27 E_Client_Volume_Sink_Name_Get func_name_get;
27 void *data; 28 void *data;
28 Eina_List *clients; 29 Eina_List *clients;
30 void *input;
29}; 31};
30 32
31struct _E_Event_Client_Volume_Sink 33struct _E_Event_Client_Volume_Sink
@@ -57,4 +59,7 @@ E_API void e_client_volume_sink_update(E_Client_Volume_Sink *mixer);
57E_API void e_client_volume_display_set(E_Client *ec, int volume, Eina_Bool mute); 59E_API void e_client_volume_display_set(E_Client *ec, int volume, Eina_Bool mute);
58E_API void e_client_volume_object_emit(E_Client *ec, const char *sig, const char *src); 60E_API void e_client_volume_object_emit(E_Client *ec, const char *sig, const char *src);
59 61
62E_API void* e_client_volume_sink_input_get(E_Client_Volume_Sink *sink);
63E_API void e_client_volume_sink_input_set(E_Client_Volume_Sink *sink, void *emix_input);
64
60#endif 65#endif
diff --git a/src/modules/mixer/backend.c b/src/modules/mixer/backend.c
index 7fcb2c73c..3e9d130a7 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)
551 _sink_input_max_get, 551 _sink_input_max_get,
552 _sink_input_name_get, 552 _sink_input_name_get,
553 input); 553 input);
554 e_client_volume_sink_input_set(sink, input);
554 e_client_volume_sink_append(ec, sink); 555 e_client_volume_sink_append(ec, sink);
555 _client_sinks = eina_list_append(_client_sinks, sink); 556 _client_sinks = eina_list_append(_client_sinks, sink);
556 found = EINA_TRUE; 557 found = EINA_TRUE;
diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c
index 24692c6e7..7b41488ba 100644
--- a/src/modules/mixer/e_mod_main.c
+++ b/src/modules/mixer/e_mod_main.c
@@ -64,6 +64,21 @@ struct _Instance
64static Context *mixer_context = NULL; 64static Context *mixer_context = NULL;
65static Eina_List *_handlers = NULL; 65static Eina_List *_handlers = NULL;
66 66
67static Emix_Sink*
68current_focused_client_sink_get(void)
69{
70 E_Client *client = e_client_focused_get();
71 if (!client) return NULL;
72 Eina_List *inputs = client->sinks;
73 if (eina_list_count(inputs) == 0) return NULL;
74 E_Client_Volume_Sink *first_vsink = eina_list_data_get(inputs);
75 if (!first_vsink) return NULL;
76 Emix_Sink_Input *input = e_client_volume_sink_input_get(first_vsink);
77 if (!input) return NULL;
78
79 return input->sink;
80}
81
67static void 82static void
68_mixer_popup_update(Instance *inst, int mute, int vol) 83_mixer_popup_update(Instance *inst, int mute, int vol)
69{ 84{
@@ -108,9 +123,14 @@ _mixer_gadget_update(void)
108 123
109 if (inst->list) 124 if (inst->list)
110 { 125 {
126 Emix_Sink *current_sink = current_focused_client_sink_get();
127
111 EINA_LIST_FOREACH(elm_list_items_get(inst->list), ll, it) 128 EINA_LIST_FOREACH(elm_list_items_get(inst->list), ll, it)
112 { 129 {
113 if (backend_sink_default_get() == elm_object_item_data_get(it)) 130 Emix_Sink *sink = elm_object_item_data_get(it);
131 if (sink == current_sink)
132 elm_list_item_selected_set(it, EINA_TRUE);
133 else if (!current_sink && backend_sink_default_get() == elm_object_item_data_get(it))
114 elm_list_item_selected_set(it, EINA_TRUE); 134 elm_list_item_selected_set(it, EINA_TRUE);
115 } 135 }
116 } 136 }
@@ -184,6 +204,7 @@ _mixer_sinks_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
184{ 204{
185 Instance *inst; 205 Instance *inst;
186 Eina_List *l, *ll; 206 Eina_List *l, *ll;
207 Emix_Sink *current_sink = current_focused_client_sink_get();
187 208
188 EINA_LIST_FOREACH(mixer_context->instances, l, inst) 209 EINA_LIST_FOREACH(mixer_context->instances, l, inst)
189 { 210 {
@@ -199,10 +220,13 @@ _mixer_sinks_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
199 220
200 it = elm_list_item_append(inst->list, s->name, NULL, NULL, 221 it = elm_list_item_append(inst->list, s->name, NULL, NULL,
201 _sink_selected_cb, s); 222 _sink_selected_cb, s);
202 if (backend_sink_default_get() == s) 223 if (current_sink == s)
224 default_it = it;
225 else if (!current_sink && backend_sink_default_get() == s)
203 default_it = it; 226 default_it = it;
204 } 227 }
205 elm_list_go(inst->list); 228 elm_list_go(inst->list);
229
206 if (default_it) 230 if (default_it)
207 elm_list_item_selected_set(default_it, EINA_TRUE); 231 elm_list_item_selected_set(default_it, EINA_TRUE);
208 } 232 }
@@ -211,14 +235,16 @@ _mixer_sinks_changed(void *data EINA_UNUSED, int type EINA_UNUSED, void *event E
211 return ECORE_CALLBACK_PASS_ON; 235 return ECORE_CALLBACK_PASS_ON;
212} 236}
213 237
238
214static void 239static void
215_popup_new(Instance *inst) 240_popup_new(Instance *inst)
216{ 241{
217 Evas_Object *button, *list, *slider, *bx; 242 Evas_Object *button, *list, *slider, *bx;
218 Emix_Sink *s; 243 Emix_Sink *s, *current_focused_sink;
219 Eina_List *l; 244 Eina_List *l;
220 Elm_Object_Item *default_it = NULL; 245 Elm_Object_Item *default_it = NULL;
221 246
247 current_focused_sink = current_focused_client_sink_get();
222 inst->popup = e_gadcon_popup_new(inst->gcc, 0); 248 inst->popup = e_gadcon_popup_new(inst->gcc, 0);
223 list = elm_box_add(e_comp->elm); 249 list = elm_box_add(e_comp->elm);
224 250
@@ -227,12 +253,15 @@ _popup_new(Instance *inst)
227 evas_object_size_hint_align_set(inst->list, EVAS_HINT_FILL, EVAS_HINT_FILL); 253 evas_object_size_hint_align_set(inst->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
228 evas_object_size_hint_weight_set(inst->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 254 evas_object_size_hint_weight_set(inst->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
229 evas_object_show(inst->list); 255 evas_object_show(inst->list);
256
230 EINA_LIST_FOREACH((Eina_List *)emix_sinks_get(), l, s) 257 EINA_LIST_FOREACH((Eina_List *)emix_sinks_get(), l, s)
231 { 258 {
232 Elm_Object_Item *it; 259 Elm_Object_Item *it;
233 260
234 it = elm_list_item_append(inst->list, s->name, NULL, NULL, _sink_selected_cb, s); 261 it = elm_list_item_append(inst->list, s->name, NULL, NULL, _sink_selected_cb, s);
235 if (backend_sink_default_get() == s) 262 if (current_focused_sink == s)
263 default_it = it;
264 else if (!current_focused_sink && backend_sink_default_get() == s)
236 default_it = it; 265 default_it = it;
237 } 266 }
238 elm_list_go(inst->list); 267 elm_list_go(inst->list);