summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-12-02 02:29:27 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-12-02 02:29:27 +0000
commit09ec2015e9b05b8d2b325cfb6abd0b11716347c1 (patch)
treed0c98bb3e86b15c2363106109500694fb3bc5b53
parent6d2c0d04e97f5afd47aed2aacf062b3c83e27db5 (diff)
downloadenlightenment-09ec2015e9b05b8d2b325cfb6abd0b11716347c1.tar.gz
e backlight - offer suspend api for wl's drm mod to turn on/off
-rw-r--r--src/bin/e_backlight.c15
-rw-r--r--src/bin/e_backlight.h1
-rw-r--r--src/modules/wl_drm/e_mod_main.c3
3 files changed, 19 insertions, 0 deletions
diff --git a/src/bin/e_backlight.c b/src/bin/e_backlight.c
index d26b3178d2..0e56f90373 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 0a8b239bd8..d8a59154ba 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 bb8582c52a..61807a6987 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();