This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit 53a21b1b0df19b38ee39fe3b17d6c62af8e7d234
Author: Carsten Haitzler <[email protected]>
AuthorDate: Tue Jan 17 09:05:54 2023 +0000

    mixer - add params to allow increase/decrease by a given percentage
    
    now can pass a value like 1 or 2 or 3 to go up 1, 2 or 3% instead of
    the default (with no params) of 5%
---
 src/modules/mixer/backend.c | 68 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 61 insertions(+), 7 deletions(-)

diff --git a/src/modules/mixer/backend.c b/src/modules/mixer/backend.c
index 7215f673c..c399467d9 100644
--- a/src/modules/mixer/backend.c
+++ b/src/modules/mixer/backend.c
@@ -174,14 +174,33 @@ _volume_adjust(int step)
 }
 
 static void
-_volume_increase_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
+_volume_increase_cb(E_Object *obj EINA_UNUSED, const char *params)
 {
+   if ((params) && (strlen(params) > 0))
+     {
+        int val = atoi(params);
+        if (val > 0)
+          {
+             _volume_adjust(val);
+             return;
+          }
+     }
    _volume_adjust(VOLUME_STEP);
 }
 
 static void
-_volume_decrease_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
+_volume_decrease_cb(E_Object *obj EINA_UNUSED, const char *params)
 {
+   if ((params) && (strlen(params) > 0))
+     {
+        int val = atoi(params);
+        if (val > 0)
+          {
+             _volume_adjust(-val);
+             return;
+          }
+        return;
+     }
    _volume_adjust(-VOLUME_STEP);
 }
 
@@ -227,14 +246,32 @@ _volume_source_adjust(int step)
 }
 
 static void
-_volume_increase_source_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
+_volume_increase_source_cb(E_Object *obj EINA_UNUSED, const char *params)
 {
+   if ((params) && (strlen(params) > 0))
+     {
+        int val = atoi(params);
+        if (val > 0)
+          {
+             _volume_source_adjust(val);
+             return;
+          }
+     }
    _volume_source_adjust(VOLUME_STEP);
 }
 
 static void
-_volume_decrease_source_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
+_volume_decrease_source_cb(E_Object *obj EINA_UNUSED, const char *params)
 {
+   if ((params) && (strlen(params) > 0))
+     {
+        int val = atoi(params);
+        if (val > 0)
+          {
+             _volume_source_adjust(-val);
+             return;
+          }
+     }
    _volume_source_adjust(-VOLUME_STEP);
 }
 
@@ -246,25 +283,42 @@ _volume_mute_source_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED
 }
 
 static void
-_volume_increase_app_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
+_volume_increase_app_cb(E_Object *obj EINA_UNUSED, const char *params)
 {
    E_Client *ec;
 
    ec = e_client_focused_get();
    if (ec && ec->volume_control_enabled)
      {
-        e_client_volume_set(ec, ec->volume + VOLUME_STEP);
+        if ((params) && (strlen(params) > 0))
+          {
+             int val = atoi(params);
+             if (val > 0)
+               {
+                  e_client_volume_set(ec, ec->volume + val);
+                  return;
+               }
+          }
      }
 }
 
 static void
-_volume_decrease_app_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
+_volume_decrease_app_cb(E_Object *obj EINA_UNUSED, const char *params)
 {
    E_Client *ec;
 
    ec = e_client_focused_get();
    if (ec && ec->volume_control_enabled)
      {
+        if ((params) && (strlen(params) > 0))
+          {
+             int val = atoi(params);
+             if (val > 0)
+               {
+                  e_client_volume_set(ec, ec->volume - val);
+                  return;
+               }
+          }
         e_client_volume_set(ec, ec->volume - VOLUME_STEP);
      }
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to