summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-14 12:20:53 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-05-14 12:20:53 +0100
commit6fad7e2a7638befccdc897c6eca7da72e41645fa (patch)
tree0c72ac8450a2ca82170efdc317fb00614da634a6 /src
parent344a6acc364250c37ca4aa3ea28589882fdf6999 (diff)
Revert "e_client_volume: Reparent sink if a new window comes and match this one"
this is also causing issues. segv's. asan is finding them. re-open D8929 This reverts commit eae3cd37e830b82fee160dbc67ea3a75971dffc7.
Diffstat (limited to 'src')
-rw-r--r--src/modules/mixer/gadget/backend.c145
1 files changed, 63 insertions, 82 deletions
diff --git a/src/modules/mixer/gadget/backend.c b/src/modules/mixer/gadget/backend.c
index 3afc0c187..66ebb2652 100644
--- a/src/modules/mixer/gadget/backend.c
+++ b/src/modules/mixer/gadget/backend.c
@@ -45,7 +45,6 @@ static int _sink_input_min_get(void *data);
45static int _sink_input_max_get(void *data); 45static int _sink_input_max_get(void *data);
46static const char *_sink_input_name_get(void *data); 46static const char *_sink_input_name_get(void *data);
47static pid_t _get_ppid(pid_t pid); 47static pid_t _get_ppid(pid_t pid);
48static E_Client_Volume_Sink *_sink_input_e_client_volume_sink_find(Emix_Sink_Input *input, pid_t *ret_pid);
49static void _sink_input_event(int type, Emix_Sink_Input *input); 48static void _sink_input_event(int type, Emix_Sink_Input *input);
50static void _events_cb(void *data, enum Emix_Event type, void *event_info); 49static void _events_cb(void *data, enum Emix_Event type, void *event_info);
51static Eina_Bool _desklock_cb(void *data, int type, void *info); 50static Eina_Bool _desklock_cb(void *data, int type, void *info);
@@ -524,75 +523,51 @@ _get_ppid(pid_t pid)
524 return ppid; 523 return ppid;
525} 524}
526 525
527static E_Client_Volume_Sink *
528_sink_input_e_client_volume_sink_find(Emix_Sink_Input *input, pid_t *ret_pid)
529{
530 Eina_List *clients, *l;
531 E_Client *ec;
532 E_Client_Volume_Sink *sink = NULL;
533 pid_t pid;
534 Eina_Bool found = EINA_FALSE;
535
536 pid = input->pid;
537
538 EINA_LIST_FOREACH(_client_sinks, l, sink)
539 {
540 if (sink->data == input)
541 break;
542 }
543
544 for (;;)
545 {
546 if ((pid <= 1) || (pid == getpid())) break;
547 clients = e_client_focus_stack_get();
548 EINA_LIST_FOREACH(clients, l, ec)
549 {
550 if ((ec->netwm.pid == pid) && (!ec->parent))
551 {
552 DBG("Sink found the client %s",
553 e_client_util_name_get(ec));
554 if (!sink)
555 {
556 DBG("Create a new client_volume_sink");
557 sink = e_client_volume_sink_new(_sink_input_get,
558 _sink_input_set,
559 _sink_input_min_get,
560 _sink_input_max_get,
561 _sink_input_name_get,
562 input);
563 }
564 e_client_volume_sink_append(ec, sink);
565 _client_sinks = eina_list_append(_client_sinks, sink);
566 found = EINA_TRUE;
567 }
568 }
569 if (found) break;
570 pid = _get_ppid(pid);
571 }
572 if (ret_pid) *ret_pid = pid;
573 return found ? sink : NULL;
574}
575
576static void 526static void
577_sink_input_event(int type, Emix_Sink_Input *input) 527_sink_input_event(int type, Emix_Sink_Input *input)
578{ 528{
579 Eina_List *l; 529 Eina_List *clients, *l, *ll;
530 E_Client *ec;
580 E_Client_Volume_Sink *sink; 531 E_Client_Volume_Sink *sink;
532 pid_t pid;
533 Eina_Bool found = EINA_FALSE;
581 534
582 switch (type) 535 switch (type)
583 { 536 {
584 case EMIX_SINK_INPUT_ADDED_EVENT: 537 case EMIX_SINK_INPUT_ADDED_EVENT:
585 _sink_input_e_client_volume_sink_find(input, NULL); 538 pid = input->pid;
539 for (;;)
540 {
541 if ((pid <= 1) || (pid == getpid())) return;
542 clients = e_client_focus_stack_get();
543 EINA_LIST_FOREACH(clients, l, ec)
544 {
545 if ((ec->netwm.pid == pid) && (!ec->parent))
546 {
547 DBG("Sink found the client %s",
548 e_client_util_name_get(ec));
549 sink = e_client_volume_sink_new(_sink_input_get,
550 _sink_input_set,
551 _sink_input_min_get,
552 _sink_input_max_get,
553 _sink_input_name_get,
554 input);
555 e_client_volume_sink_append(ec, sink);
556 _client_sinks = eina_list_append(_client_sinks, sink);
557 found = EINA_TRUE;
558 }
559 }
560 if (found) break;
561 pid = _get_ppid(pid);
562 }
586 break; 563 break;
587 case EMIX_SINK_INPUT_REMOVED_EVENT: 564 case EMIX_SINK_INPUT_REMOVED_EVENT:
588 EINA_LIST_FOREACH(_client_sinks, l, sink) 565 EINA_LIST_FOREACH_SAFE(_client_sinks, l, ll, sink)
589 { 566 {
590 if (sink->data == input) 567 if (sink->data == input)
591 { 568 {
592 DBG("Client sink del");
593 e_client_volume_sink_del(sink); 569 e_client_volume_sink_del(sink);
594 _client_sinks = eina_list_remove_list(_client_sinks, l); 570 _client_sinks = eina_list_remove_list(_client_sinks, l);
595 break;
596 } 571 }
597 } 572 }
598 break; 573 break;
@@ -978,33 +953,39 @@ _client_mixer_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
978static Eina_Bool 953static Eina_Bool
979_e_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event) 954_e_client_add(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
980{ 955{
981 E_Event_Client *ev; 956 E_Event_Client *ev;
982 Eina_List *l, *ll; 957 Eina_List *l;
983 Emix_Sink_Input *input; 958 Emix_Sink_Input *input;
984 E_Client *ec; 959 pid_t pid;
985 E_Client_Volume_Sink *sink; 960 E_Client_Volume_Sink *sink;
986 pid_t pid; 961
987 962 ev = event;
988 ev = event; 963
989 964 if (ev->ec->parent) return ECORE_CALLBACK_PASS_ON;
990 if (ev->ec->parent) return ECORE_CALLBACK_PASS_ON; 965 EINA_LIST_FOREACH((Eina_List *)emix_sink_inputs_get(), l, input)
991 EINA_LIST_FOREACH((Eina_List *)emix_sink_inputs_get(), l, input) 966 {
992 { 967 pid = input->pid;
993 sink = _sink_input_e_client_volume_sink_find(input, &pid); 968 while (42)
994 if (sink) 969 {
995 { 970 if (pid <= 1 || pid == getpid()) return ECORE_CALLBACK_PASS_ON;
996 EINA_LIST_FOREACH_SAFE(sink->clients, l, ll, ec) 971 if (ev->ec->netwm.pid == pid)
997 { 972 {
998 if (ec->netwm.pid != pid) 973 DBG("Client(%s) found a sink input",
999 { 974 e_client_util_name_get(ev->ec));
1000 DBG("Clean invalid client sink %s", 975 sink = e_client_volume_sink_new(_sink_input_get,
1001 e_client_util_name_get(ec)); 976 _sink_input_set,
1002 e_client_volume_sink_remove(ec, sink); 977 _sink_input_min_get,
1003 } 978 _sink_input_max_get,
1004 } 979 _sink_input_name_get,
1005 } 980 input);
1006 } 981 e_client_volume_sink_append(ev->ec, sink);
1007 return ECORE_CALLBACK_PASS_ON; 982 _client_sinks = eina_list_append(_client_sinks, sink);
983 return ECORE_CALLBACK_PASS_ON;
984 }
985 pid = _get_ppid(pid);
986 }
987 }
988 return ECORE_CALLBACK_PASS_ON;
1008} 989}
1009 990
1010static Eina_Bool 991static Eina_Bool