billiob pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=9822adbaa90c62a18dbba435f53d3f5d7e393644

commit 9822adbaa90c62a18dbba435f53d3f5d7e393644
Author: Mike Blumenkrantz <[email protected]>
Date:   Wed Aug 15 19:40:06 2018 +0200

    options: add info to 'React to key presses' option when multisense is 
disabled
    
    Summary: this informs the user that key press audio is not available
    
    Reviewers: billiob
    
    Tags: #terminology
    
    Differential Revision: https://phab.enlightenment.org/D6840
---
 src/bin/main.c             | 25 +++++++++++++++++++++++++
 src/bin/options_behavior.c | 12 ++++++++++++
 2 files changed, 37 insertions(+)

diff --git a/src/bin/main.c b/src/bin/main.c
index be2951a..6a4b8f3 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -21,9 +21,32 @@
 
 int terminology_starting_up;
 int _log_domain = -1;
+Eina_Bool multisense_available = EINA_TRUE;
 
 static Config *_main_config = NULL;
 
+static void
+_check_multisense(void)
+{
+   int enabled;
+   Eina_Bool setting = edje_audio_channel_mute_get(EDJE_CHANNEL_EFFECT);
+
+   /* older versions of efl have no capability for determining whether 
multisense support
+    * is available
+    * to check, attempt to set mute on a channel and check the value: if the 
value has not been
+    * set then the multisense codepath is disabled
+    *
+    * this is a no-op in either case, as the function only sets an internal 
variable and returns
+    */
+   for (enabled = 0; enabled < 2; enabled++)
+     {
+        edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, enabled);
+        if (enabled != edje_audio_channel_mute_get(EDJE_CHANNEL_EFFECT))
+          multisense_available = EINA_FALSE;
+     }
+   edje_audio_channel_mute_set(EDJE_CHANNEL_EFFECT, setting);
+}
+
 Config *
 main_config_get(void)
 {
@@ -612,6 +635,8 @@ elm_main(int argc, char **argv)
           }
      }
 
+   _check_multisense();
+
    if (theme)
      {
         char path[PATH_MAX];
diff --git a/src/bin/options_behavior.c b/src/bin/options_behavior.c
index 86fa048..09aedec 100644
--- a/src/bin/options_behavior.c
+++ b/src/bin/options_behavior.c
@@ -17,6 +17,7 @@ typedef struct _Behavior_Ctx {
      Config *config;
 } Behavior_Ctx;
 
+extern Eina_Bool multisense_available;
 
 #define CB(_cfg_name, _inv)                                     \
 static void                                                     \
@@ -407,6 +408,17 @@ options_behavior(Evas_Object *opbox, Evas_Object *term)
    _add_cursors_option(bx, ctx);
 
    CX(_("React to key presses"), flicker_on_key, 0);
+   if (!multisense_available)
+     {
+        Evas_Object *lbl;
+
+        lbl = elm_label_add(bx);
+        evas_object_size_hint_weight_set(lbl, EVAS_HINT_EXPAND, 0.0);
+        evas_object_size_hint_align_set(lbl, 0.0, 0.5);
+        elm_box_pack_before(bx, lbl, o);
+        elm_object_text_set(lbl, _("Audio Support for key presses 
<failure>DISABLED</failure>!"));
+        evas_object_show(lbl);
+     }
    CX(_("Visual Bell"), disable_visual_bell, 1);
    CX(_("Bell rings"), bell_rings, 0);
    CX(_("Urgent Bell"), urg_bell, 0);

-- 


Reply via email to