raster pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=09ec2015e9b05b8d2b325cfb6abd0b11716347c1

commit 09ec2015e9b05b8d2b325cfb6abd0b11716347c1
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Wed Dec 2 02:29:27 2020 +0000

    e backlight - offer suspend api for wl's drm mod to turn on/off
---
 src/bin/e_backlight.c           | 15 +++++++++++++++
 src/bin/e_backlight.h           |  1 +
 src/modules/wl_drm/e_mod_main.c |  3 +++
 3 files changed, 19 insertions(+)

diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c
index d26b3178d..0e56f9037 100644
--- a/src/bin/e_backlight.c
+++ b/src/bin/e_backlight.c
@@ -22,6 +22,7 @@ static Eina_List *_devices = NULL;
 static int        _devices_pending_ops = 0;
 static Eina_Bool  _devices_zones_update = EINA_FALSE;
 static Eina_Bool  _own_vt = EINA_TRUE;
+static Eina_Bool  _e_bl_suspend = EINA_FALSE;
 
 static void _backlight_devices_device_set(Backlight_Device *bd, double val);
 static void _backlight_devices_device_update(Backlight_Device *bd);
@@ -876,3 +877,17 @@ e_backlight_devices_get(void)
 {
    return bl_devs;
 }
+
+E_API void
+e_backlight_suspend_set(Eina_Bool suspend)
+{
+   if (_e_bl_suspend == suspend) return;
+   _e_bl_suspend = suspend;
+   _own_vt = !_e_bl_suspend;
+   if (_own_vt)
+     {
+        // we just go back to normal backlight if we gain
+        // the vt again
+        e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL);
+     }
+}
diff --git a/src/bin/e_backlight.h b/src/bin/e_backlight.h
index 0a8b239bd..d8a59154b 100644
--- a/src/bin/e_backlight.h
+++ b/src/bin/e_backlight.h
@@ -35,6 +35,7 @@ E_API double              e_backlight_level_get(E_Zone *zone);
 E_API void                e_backlight_mode_set(E_Zone *zone, E_Backlight_Mode 
mode);
 E_API E_Backlight_Mode    e_backlight_mode_get(E_Zone *zone);
 E_API const Eina_List    *e_backlight_devices_get(void);
+E_API void                e_backlight_suspend_set(Eina_Bool suspend);
 
 #endif
 #endif
diff --git a/src/modules/wl_drm/e_mod_main.c b/src/modules/wl_drm/e_mod_main.c
index bb8582c52..61807a698 100644
--- a/src/modules/wl_drm/e_mod_main.c
+++ b/src/modules/wl_drm/e_mod_main.c
@@ -55,6 +55,7 @@ _e_mod_drm_cb_activate(void *data EINA_UNUSED, int type 
EINA_UNUSED, void *event
      {
         if (session_state) goto end;
         session_state = EINA_TRUE;
+        e_backlight_suspend_set(EINA_FALSE);
 
         ecore_evas_show(e_comp->ee);
         evas_damage_rectangle_add(e_comp->evas, 0, 0, e_comp->w, e_comp->h);
@@ -72,6 +73,8 @@ _e_mod_drm_cb_activate(void *data EINA_UNUSED, int type 
EINA_UNUSED, void *event
    else
      {
         session_state = EINA_FALSE;
+        e_backlight_suspend_set(EINA_TRUE);
+
         ecore_evas_hide(e_comp->ee);
         edje_file_cache_flush();
         edje_collection_cache_flush();

-- 


Reply via email to