E_API void e_dpms_update(void) { unsigned int standby = 0, suspend = 0, off = 0; int enabled; Eina_Bool changed = EINA_FALSE; enabled = ((e_config->screensaver_enable) && (!e_config->mode.presentation) && ((!e_util_fullscreen_current_any()) && (!e_config->no_dpms_on_fullscreen)) ); if (_e_dpms_enabled != enabled) { _e_dpms_enabled = enabled; #ifndef HAVE_WAYLAND_ONLY if (e_comp_util_has_x()) ecore_x_dpms_enabled_set(enabled); #endif } if (!enabled) return; if (e_config->screensaver_enable) { off = suspend = standby = e_screensaver_timeout_get(EINA_FALSE); standby += 5; suspend += 6; off += 7; } if (_e_dpms_timeout_standby != standby) { _e_dpms_timeout_standby = standby; changed = EINA_TRUE; } if (_e_dpms_timeout_suspend != suspend) { _e_dpms_timeout_suspend = suspend; changed = EINA_TRUE; } if (_e_dpms_timeout_off != off) { _e_dpms_timeout_off = off; changed = EINA_TRUE; } #ifndef HAVE_WAYLAND_ONLY if (e_comp_util_has_x()) { if (changed) ecore_x_dpms_timeouts_set(standby, suspend, off); } #endif }
EAPI void e_dpms_force_update(void) { unsigned int standby = 0, suspend = 0, off = 0; int enabled; enabled = ((e_config->screensaver_enable) && (!e_config->mode.presentation) && (!e_util_fullscreen_current_any())); ecore_x_dpms_enabled_set(enabled); if (!enabled) return; if (e_config->screensaver_enable) { off = suspend = standby = e_screensaver_timeout_get(EINA_FALSE); standby += 5; suspend += 6; off += 7; } ecore_x_dpms_timeouts_set(standby + 10, suspend + 10, off + 10); ecore_x_dpms_timeouts_set(standby, suspend, off); }
E_API void e_screensaver_update(void) { int timeout; Eina_Bool changed = EINA_FALSE; timeout = e_screensaver_timeout_get(EINA_TRUE); if (!((e_config->screensaver_enable) && (!e_config->mode.presentation) && (!((e_util_fullscreen_current_any()) && (e_config->no_dpms_on_fullscreen))))) timeout = 0; if (_e_screensaver_timeout != timeout) { _e_screensaver_timeout = timeout; changed = EINA_TRUE; } #ifndef HAVE_WAYLAND_ONLY int interval = 0, blanking = 0, expose = 0; interval = e_config->screensaver_interval; blanking = e_config->screensaver_blanking; expose = e_config->screensaver_expose; // if (_e_screensaver_interval != interval) // { // _e_screensaver_interval = interval; // changed = EINA_TRUE; // } if (_e_screensaver_blanking != blanking) { _e_screensaver_blanking = blanking; changed = EINA_TRUE; } if (_e_screensaver_expose != expose) { _e_screensaver_expose = expose; changed = EINA_TRUE; } if (e_comp->comp_type != E_PIXMAP_TYPE_WL) { if (changed) { // this toggling of dpms is a bug workaround in x that i found // where if we change screensaver timeouts and force a manual // wake of the screen e.g. on lid open/close we have to toggle // it for x to stop thinking the monitor is off when it's // actually on and this causes later dpms issues where the // screen doesnt turn off at all because x thinks interanlly // that the monitor is still off... so this is odd, but it's // necessary on some hardware. if (!e_config->screensaver_dpms_off) { int enabled; enabled = ((e_config->screensaver_enable) && (!e_config->mode.presentation)); ecore_x_dpms_enabled_set(!enabled); ecore_x_dpms_enabled_set(enabled); } ecore_x_screensaver_set(timeout, interval, blanking, expose); } } #endif #ifdef HAVE_WAYLAND if (changed && (e_comp->comp_type == E_PIXMAP_TYPE_WL)) { E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del); if (timeout) _e_screensaver_timer = ecore_timer_loop_add(timeout, _e_screensaver_idle_timeout_cb, (void*)1); } #endif }