From 31fa887f04313d6379213eb024b9b7585615f2f8 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Fri, 15 May 2020 22:59:00 +0200 Subject: [PATCH] Build "ugly code" in calls-call-display conditionally * meson_options.txt: Added option librem5-hack, defaults to true * src/meson.build: Added conditional define USE_UGLY_CODE which will be set when librem5-hack option is used * src/calls-call-display.c: ifdef'ed ugly_hacks call --- meson_options.txt | 4 ++++ src/calls-call-display.c | 5 +++++ src/meson.build | 3 +++ 3 files changed, 12 insertions(+) diff --git a/meson_options.txt b/meson_options.txt index 03e955e..2e15500 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -9,3 +9,7 @@ option('tests', option('wayland', type: 'feature', value: 'enabled', description: 'Whether to support Wayland lockscreen interaction') + +option('librem5-hack', + type: 'boolean', value: true, + description: 'Whether to use hacky code to support audio output switching (Speaker)') diff --git a/src/calls-call-display.c b/src/calls-call-display.c index 1d8f276..64d81ca 100644 --- a/src/calls-call-display.c +++ b/src/calls-call-display.c @@ -22,6 +22,7 @@ * */ +#include "config.h" #include "calls-call-display.h" #include "calls-call-data.h" #include "util.h" @@ -330,6 +331,7 @@ set_property (GObject *object, } } +#ifdef CALLS_USE_UGLY_CODE //#define UGLY_SOURCE "alsa_input.platform-sound.VoiceCall__hw_CARD_sgtl5000__source" //#define UGLY_SINK "alsa_output.platform-sound.VoiceCall__hw_CARD_sgtl5000__sink" @@ -509,6 +511,7 @@ ugly_hacks (CallsCallDisplay *self) self); } +#endif static void constructed (GObject *object) @@ -519,7 +522,9 @@ constructed (GObject *object) call_state_changed_cb (self, calls_call_get_state (self->call)); +#ifdef CALLS_USE_UGLY_CODE ugly_hacks (self); +#endif G_OBJECT_CLASS (calls_call_display_parent_class)->constructed (object); } diff --git a/src/meson.build b/src/meson.build index a1ff6bf..82ab3ae 100644 --- a/src/meson.build +++ b/src/meson.build @@ -95,6 +95,9 @@ calls_config_data = config_data calls_config_data.set_quoted('VCS_TAG', '@VCS_TAG@') calls_config_data.set10('WL_SCANNER_FOUND', wl_scanner.found()) +use_l5_hacks = get_option('librem5-hack') +calls_config_data.set('CALLS_USE_UGLY_CODE', use_l5_hacks) + config_h_in = configure_file( output: 'config.h.in', configuration: calls_config_data