e backlight - offer suspend api for wl's drm mod to turn on/off

devs/bu5hm4n/mixerfun
Carsten Haitzler 2 years ago
parent 6d2c0d04e9
commit 09ec2015e9
  1. 15
      src/bin/e_backlight.c
  2. 1
      src/bin/e_backlight.h
  3. 3
      src/modules/wl_drm/e_mod_main.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);
}
}

@ -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

@ -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();

Loading…
Cancel
Save