2007-02-13 08:33:35 -08:00
|
|
|
#include "e.h"
|
2009-04-25 09:49:53 -07:00
|
|
|
|
2012-12-08 22:27:42 -08:00
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_on = NULL;
|
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_off = NULL;
|
2009-04-25 09:49:53 -07:00
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_config_mode = NULL;
|
2010-05-28 15:13:20 -07:00
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_border_fullscreen = NULL;
|
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_border_unfullscreen = NULL;
|
2010-07-18 12:06:00 -07:00
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_border_remove = NULL;
|
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_border_iconify = NULL;
|
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_border_uniconify = NULL;
|
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_border_desk_set = NULL;
|
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_desk_show = NULL;
|
2011-08-21 04:02:33 -07:00
|
|
|
static Ecore_Event_Handler *_e_screensaver_handler_powersave = NULL;
|
2009-04-26 19:54:43 -07:00
|
|
|
static E_Dialog *_e_screensaver_ask_presentation_dia = NULL;
|
|
|
|
static int _e_screensaver_ask_presentation_count = 0;
|
2009-04-25 09:49:53 -07:00
|
|
|
|
2010-11-22 07:21:24 -08:00
|
|
|
static int _e_screensaver_timeout = 0;
|
2012-10-11 04:22:58 -07:00
|
|
|
//static int _e_screensaver_interval = 0;
|
2010-11-22 07:21:24 -08:00
|
|
|
static int _e_screensaver_blanking = 0;
|
|
|
|
static int _e_screensaver_expose = 0;
|
|
|
|
|
2011-08-21 03:44:23 -07:00
|
|
|
static Ecore_Timer *_e_screensaver_suspend_timer = NULL;
|
2011-08-21 04:02:33 -07:00
|
|
|
static Eina_Bool _e_screensaver_on = EINA_FALSE;
|
2011-08-21 03:44:23 -07:00
|
|
|
|
2015-07-27 12:46:57 -07:00
|
|
|
static Ecore_Timer *screensaver_idle_timer = NULL;
|
|
|
|
static Eina_Bool screensaver_dimmed = EINA_FALSE;
|
|
|
|
|
|
|
|
#ifdef HAVE_WAYLAND
|
|
|
|
static Ecore_Timer *_e_screensaver_timer;
|
2015-08-04 16:10:09 -07:00
|
|
|
static Eina_Bool _e_screensaver_inhibited = EINA_FALSE;
|
2015-07-27 12:46:57 -07:00
|
|
|
#endif
|
|
|
|
|
2017-07-09 17:08:25 -07:00
|
|
|
static Eina_Bool _screensaver_ignore = EINA_FALSE;
|
e laptop lid fixes to bring back behavior and trim down glitches
so i spent a few days lopening and closing the lids of a few laptops,
plugging and unplugging external screens in, plugging and unplugging
ac power and doing lots of combinations of these. this led to a whole
slew of interrealted issues that were pretty hard to detangle into
just single issues, so this is all one blob.
this fixes:
1. if a lid close gets a monitor unplug from x or e's randr wants to
unplug then this lead to slow unsuspend or lid open times as e was
reconfirguring the screens entireluy on lid open. dont do that. just
keep things as is, unless we have an external display, then reconfigure.
2. we had 2 systems monitoring for a wake. a poller and a systemd
event. this was redundant and lead to interesting things in the debug
output, so clean that up and on systemd systsems use the systemd wake
events
3. some systems dont shut down their screens on lid close, so they
stay open until screensaver timeouts kick in. bad. so also force the
screen to go off on lid close (if the lid screen is the only one we
have).
4. x seems to have a bug where if you force dpms off etc. to turn the
screen on, it still thinks it's of and wont dpms off again after that
until you eother give some input to have the wake event make the dpms
system in x think its now time to go on, or you toggle dpms on and
off, so i found toggling tricks x into thinking the right thing.
this makes some debugging also be consistent with printfs.
all in all i have a pretty well supported laptop doing swimmingly with
e and a not so well designed (acpi dsdt - missing many events like
acpi battery ones, ac power change acpi events, missing logic to power
off a closed screen in firmware or hardware and leaving it to sw...
not this laptop has a tocuh panel and extra fun points awarded since
the touch panel doesnt shut off on lid close... AND it reprots touch
events when it closes as it touches the keys/case... hooray! that has
another work-around local to my system, as efl has no mechanism to do
this).
@fix
2018-05-14 23:40:00 -07:00
|
|
|
static Eina_Bool _screensaver_now = EINA_FALSE;
|
2017-07-09 17:08:25 -07:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int E_EVENT_SCREENSAVER_ON = -1;
|
|
|
|
E_API int E_EVENT_SCREENSAVER_OFF = -1;
|
2015-07-27 13:54:01 -07:00
|
|
|
E_API int E_EVENT_SCREENSAVER_OFF_PRE = -1;
|
2012-12-08 22:27:42 -08:00
|
|
|
|
2015-07-27 12:46:57 -07:00
|
|
|
#ifdef HAVE_WAYLAND
|
|
|
|
static Eina_Bool
|
2015-07-27 13:54:01 -07:00
|
|
|
_e_screensaver_idle_timeout_cb(void *d)
|
2015-07-27 12:46:57 -07:00
|
|
|
{
|
2015-07-27 13:54:01 -07:00
|
|
|
e_screensaver_eval(!!d);
|
2015-07-27 12:46:57 -07:00
|
|
|
_e_screensaver_timer = NULL;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2012-12-08 22:27:42 -08:00
|
|
|
e_screensaver_timeout_get(Eina_Bool use_idle)
|
|
|
|
{
|
|
|
|
int timeout = 0, count = (1 + _e_screensaver_ask_presentation_count);
|
2019-09-11 02:56:21 -07:00
|
|
|
Eina_Bool use_special_instead_of_dim = EINA_FALSE;
|
2013-01-11 02:34:29 -08:00
|
|
|
|
e laptop lid fixes to bring back behavior and trim down glitches
so i spent a few days lopening and closing the lids of a few laptops,
plugging and unplugging external screens in, plugging and unplugging
ac power and doing lots of combinations of these. this led to a whole
slew of interrealted issues that were pretty hard to detangle into
just single issues, so this is all one blob.
this fixes:
1. if a lid close gets a monitor unplug from x or e's randr wants to
unplug then this lead to slow unsuspend or lid open times as e was
reconfirguring the screens entireluy on lid open. dont do that. just
keep things as is, unless we have an external display, then reconfigure.
2. we had 2 systems monitoring for a wake. a poller and a systemd
event. this was redundant and lead to interesting things in the debug
output, so clean that up and on systemd systsems use the systemd wake
events
3. some systems dont shut down their screens on lid close, so they
stay open until screensaver timeouts kick in. bad. so also force the
screen to go off on lid close (if the lid screen is the only one we
have).
4. x seems to have a bug where if you force dpms off etc. to turn the
screen on, it still thinks it's of and wont dpms off again after that
until you eother give some input to have the wake event make the dpms
system in x think its now time to go on, or you toggle dpms on and
off, so i found toggling tricks x into thinking the right thing.
this makes some debugging also be consistent with printfs.
all in all i have a pretty well supported laptop doing swimmingly with
e and a not so well designed (acpi dsdt - missing many events like
acpi battery ones, ac power change acpi events, missing logic to power
off a closed screen in firmware or hardware and leaving it to sw...
not this laptop has a tocuh panel and extra fun points awarded since
the touch panel doesnt shut off on lid close... AND it reprots touch
events when it closes as it touches the keys/case... hooray! that has
another work-around local to my system, as efl has no mechanism to do
this).
@fix
2018-05-14 23:40:00 -07:00
|
|
|
if (_screensaver_now) return 1;
|
2013-01-14 09:26:13 -08:00
|
|
|
if ((e_config->screensaver_enable) && (!e_config->mode.presentation))
|
2017-07-13 02:03:29 -07:00
|
|
|
{
|
|
|
|
if ((e_desklock_state_get()) &&
|
|
|
|
(e_config->screensaver_desklock_timeout > 0))
|
2019-09-11 02:56:21 -07:00
|
|
|
{
|
|
|
|
timeout = e_config->screensaver_desklock_timeout;
|
|
|
|
use_special_instead_of_dim = EINA_TRUE;
|
|
|
|
}
|
2017-07-13 02:03:29 -07:00
|
|
|
else
|
|
|
|
timeout = e_config->screensaver_timeout * count;
|
|
|
|
}
|
2013-01-11 02:34:29 -08:00
|
|
|
|
2019-09-11 02:56:21 -07:00
|
|
|
if ((use_idle) && (!e_config->mode.presentation) &&
|
|
|
|
(!use_special_instead_of_dim))
|
2012-12-08 22:27:42 -08:00
|
|
|
{
|
|
|
|
if (e_config->backlight.idle_dim)
|
|
|
|
{
|
2019-09-18 10:56:42 -07:00
|
|
|
double t2 = e_config->backlight.timer;
|
|
|
|
|
|
|
|
if ((e_powersave_mode_get() > E_POWERSAVE_MODE_LOW) &&
|
|
|
|
(e_config->backlight.battery_timer > 0.0))
|
|
|
|
t2 = e_config->backlight.battery_timer;
|
2012-12-08 22:27:42 -08:00
|
|
|
if (timeout > 0)
|
|
|
|
{
|
2019-09-18 10:56:42 -07:00
|
|
|
if (t2 < timeout) timeout = t2;
|
2012-12-08 22:27:42 -08:00
|
|
|
}
|
2019-09-18 10:56:42 -07:00
|
|
|
else timeout = t2;
|
2012-12-08 22:27:42 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return timeout;
|
|
|
|
}
|
|
|
|
|
2017-07-09 17:08:25 -07:00
|
|
|
E_API void
|
|
|
|
e_screensaver_ignore(void)
|
|
|
|
{
|
|
|
|
_screensaver_ignore = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
E_API void
|
|
|
|
e_screensaver_unignore(void)
|
|
|
|
{
|
|
|
|
_screensaver_ignore = EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
E_API Eina_Bool
|
|
|
|
e_screensaver_ignore_get(void)
|
|
|
|
{
|
|
|
|
return _screensaver_ignore;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2010-11-22 07:21:24 -08:00
|
|
|
e_screensaver_update(void)
|
|
|
|
{
|
2015-07-27 12:46:57 -07:00
|
|
|
int timeout;
|
2010-11-22 07:21:24 -08:00
|
|
|
Eina_Bool changed = EINA_FALSE;
|
|
|
|
|
2012-12-08 22:27:42 -08:00
|
|
|
timeout = e_screensaver_timeout_get(EINA_TRUE);
|
2017-05-06 22:33:05 -07:00
|
|
|
if (!((e_config->screensaver_enable) &&
|
|
|
|
(!e_config->mode.presentation) &&
|
|
|
|
(!((e_util_fullscreen_current_any()) &&
|
|
|
|
(e_config->no_dpms_on_fullscreen)))))
|
|
|
|
timeout = 0;
|
|
|
|
|
2010-11-22 07:21:24 -08:00
|
|
|
if (_e_screensaver_timeout != timeout)
|
|
|
|
{
|
|
|
|
_e_screensaver_timeout = timeout;
|
|
|
|
changed = EINA_TRUE;
|
|
|
|
}
|
2015-07-27 12:46:57 -07:00
|
|
|
#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;
|
|
|
|
|
2012-10-10 03:40:21 -07:00
|
|
|
// if (_e_screensaver_interval != interval)
|
|
|
|
// {
|
|
|
|
// _e_screensaver_interval = interval;
|
|
|
|
// changed = EINA_TRUE;
|
|
|
|
// }
|
2010-11-22 07:21:24 -08:00
|
|
|
if (_e_screensaver_blanking != blanking)
|
|
|
|
{
|
|
|
|
_e_screensaver_blanking = blanking;
|
|
|
|
changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
if (_e_screensaver_expose != expose)
|
|
|
|
{
|
|
|
|
_e_screensaver_expose = expose;
|
|
|
|
changed = EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2015-07-27 12:46:57 -07:00
|
|
|
if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
|
2014-03-18 13:14:04 -07:00
|
|
|
{
|
|
|
|
if (changed)
|
e laptop lid fixes to bring back behavior and trim down glitches
so i spent a few days lopening and closing the lids of a few laptops,
plugging and unplugging external screens in, plugging and unplugging
ac power and doing lots of combinations of these. this led to a whole
slew of interrealted issues that were pretty hard to detangle into
just single issues, so this is all one blob.
this fixes:
1. if a lid close gets a monitor unplug from x or e's randr wants to
unplug then this lead to slow unsuspend or lid open times as e was
reconfirguring the screens entireluy on lid open. dont do that. just
keep things as is, unless we have an external display, then reconfigure.
2. we had 2 systems monitoring for a wake. a poller and a systemd
event. this was redundant and lead to interesting things in the debug
output, so clean that up and on systemd systsems use the systemd wake
events
3. some systems dont shut down their screens on lid close, so they
stay open until screensaver timeouts kick in. bad. so also force the
screen to go off on lid close (if the lid screen is the only one we
have).
4. x seems to have a bug where if you force dpms off etc. to turn the
screen on, it still thinks it's of and wont dpms off again after that
until you eother give some input to have the wake event make the dpms
system in x think its now time to go on, or you toggle dpms on and
off, so i found toggling tricks x into thinking the right thing.
this makes some debugging also be consistent with printfs.
all in all i have a pretty well supported laptop doing swimmingly with
e and a not so well designed (acpi dsdt - missing many events like
acpi battery ones, ac power change acpi events, missing logic to power
off a closed screen in firmware or hardware and leaving it to sw...
not this laptop has a tocuh panel and extra fun points awarded since
the touch panel doesnt shut off on lid close... AND it reprots touch
events when it closes as it touches the keys/case... hooray! that has
another work-around local to my system, as efl has no mechanism to do
this).
@fix
2018-05-14 23:40:00 -07:00
|
|
|
{
|
|
|
|
// 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.
|
2018-07-16 21:19:48 -07:00
|
|
|
if (!e_config->screensaver_dpms_off)
|
|
|
|
{
|
|
|
|
int enabled;
|
e laptop lid fixes to bring back behavior and trim down glitches
so i spent a few days lopening and closing the lids of a few laptops,
plugging and unplugging external screens in, plugging and unplugging
ac power and doing lots of combinations of these. this led to a whole
slew of interrealted issues that were pretty hard to detangle into
just single issues, so this is all one blob.
this fixes:
1. if a lid close gets a monitor unplug from x or e's randr wants to
unplug then this lead to slow unsuspend or lid open times as e was
reconfirguring the screens entireluy on lid open. dont do that. just
keep things as is, unless we have an external display, then reconfigure.
2. we had 2 systems monitoring for a wake. a poller and a systemd
event. this was redundant and lead to interesting things in the debug
output, so clean that up and on systemd systsems use the systemd wake
events
3. some systems dont shut down their screens on lid close, so they
stay open until screensaver timeouts kick in. bad. so also force the
screen to go off on lid close (if the lid screen is the only one we
have).
4. x seems to have a bug where if you force dpms off etc. to turn the
screen on, it still thinks it's of and wont dpms off again after that
until you eother give some input to have the wake event make the dpms
system in x think its now time to go on, or you toggle dpms on and
off, so i found toggling tricks x into thinking the right thing.
this makes some debugging also be consistent with printfs.
all in all i have a pretty well supported laptop doing swimmingly with
e and a not so well designed (acpi dsdt - missing many events like
acpi battery ones, ac power change acpi events, missing logic to power
off a closed screen in firmware or hardware and leaving it to sw...
not this laptop has a tocuh panel and extra fun points awarded since
the touch panel doesnt shut off on lid close... AND it reprots touch
events when it closes as it touches the keys/case... hooray! that has
another work-around local to my system, as efl has no mechanism to do
this).
@fix
2018-05-14 23:40:00 -07:00
|
|
|
|
2018-07-16 21:19:48 -07:00
|
|
|
enabled = ((e_config->screensaver_enable) &&
|
|
|
|
(!e_config->mode.presentation));
|
|
|
|
ecore_x_dpms_enabled_set(!enabled);
|
|
|
|
ecore_x_dpms_enabled_set(enabled);
|
|
|
|
}
|
e laptop lid fixes to bring back behavior and trim down glitches
so i spent a few days lopening and closing the lids of a few laptops,
plugging and unplugging external screens in, plugging and unplugging
ac power and doing lots of combinations of these. this led to a whole
slew of interrealted issues that were pretty hard to detangle into
just single issues, so this is all one blob.
this fixes:
1. if a lid close gets a monitor unplug from x or e's randr wants to
unplug then this lead to slow unsuspend or lid open times as e was
reconfirguring the screens entireluy on lid open. dont do that. just
keep things as is, unless we have an external display, then reconfigure.
2. we had 2 systems monitoring for a wake. a poller and a systemd
event. this was redundant and lead to interesting things in the debug
output, so clean that up and on systemd systsems use the systemd wake
events
3. some systems dont shut down their screens on lid close, so they
stay open until screensaver timeouts kick in. bad. so also force the
screen to go off on lid close (if the lid screen is the only one we
have).
4. x seems to have a bug where if you force dpms off etc. to turn the
screen on, it still thinks it's of and wont dpms off again after that
until you eother give some input to have the wake event make the dpms
system in x think its now time to go on, or you toggle dpms on and
off, so i found toggling tricks x into thinking the right thing.
this makes some debugging also be consistent with printfs.
all in all i have a pretty well supported laptop doing swimmingly with
e and a not so well designed (acpi dsdt - missing many events like
acpi battery ones, ac power change acpi events, missing logic to power
off a closed screen in firmware or hardware and leaving it to sw...
not this laptop has a tocuh panel and extra fun points awarded since
the touch panel doesnt shut off on lid close... AND it reprots touch
events when it closes as it touches the keys/case... hooray! that has
another work-around local to my system, as efl has no mechanism to do
this).
@fix
2018-05-14 23:40:00 -07:00
|
|
|
ecore_x_screensaver_set(timeout, interval, blanking, expose);
|
|
|
|
}
|
2014-03-18 13:14:04 -07:00
|
|
|
}
|
2013-09-11 06:23:43 -07:00
|
|
|
#endif
|
2015-07-27 12:46:57 -07:00
|
|
|
#ifdef HAVE_WAYLAND
|
|
|
|
if (changed && (e_comp->comp_type == E_PIXMAP_TYPE_WL))
|
|
|
|
{
|
|
|
|
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
|
2015-07-28 09:41:05 -07:00
|
|
|
if (timeout)
|
2017-02-03 13:52:28 -08:00
|
|
|
_e_screensaver_timer = ecore_timer_loop_add(timeout, _e_screensaver_idle_timeout_cb, (void*)1);
|
2015-07-27 12:46:57 -07:00
|
|
|
}
|
|
|
|
#endif
|
2010-11-22 07:21:24 -08:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_handler_config_mode_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
2009-04-25 09:49:53 -07:00
|
|
|
{
|
2010-11-22 07:21:24 -08:00
|
|
|
e_screensaver_update();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2009-04-25 09:49:53 -07:00
|
|
|
}
|
|
|
|
|
2009-04-26 19:54:43 -07:00
|
|
|
static void
|
|
|
|
_e_screensaver_ask_presentation_del(void *data)
|
|
|
|
{
|
|
|
|
if (_e_screensaver_ask_presentation_dia == data)
|
|
|
|
_e_screensaver_ask_presentation_dia = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_ask_presentation_yes(void *data EINA_UNUSED, E_Dialog *dia)
|
2009-04-26 19:54:43 -07:00
|
|
|
{
|
|
|
|
e_config->mode.presentation = 1;
|
|
|
|
e_config_mode_changed();
|
|
|
|
e_config_save_queue();
|
|
|
|
e_object_del(E_OBJECT(dia));
|
|
|
|
_e_screensaver_ask_presentation_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_ask_presentation_no(void *data EINA_UNUSED, E_Dialog *dia)
|
2009-04-26 19:54:43 -07:00
|
|
|
{
|
|
|
|
e_object_del(E_OBJECT(dia));
|
|
|
|
_e_screensaver_ask_presentation_count = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_ask_presentation_no_increase(void *data EINA_UNUSED, E_Dialog *dia)
|
2009-04-26 19:54:43 -07:00
|
|
|
{
|
|
|
|
_e_screensaver_ask_presentation_count++;
|
2010-11-22 07:21:24 -08:00
|
|
|
e_screensaver_update();
|
2009-04-26 19:54:43 -07:00
|
|
|
e_object_del(E_OBJECT(dia));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_ask_presentation_no_forever(void *data EINA_UNUSED, E_Dialog *dia)
|
2009-04-26 19:54:43 -07:00
|
|
|
{
|
|
|
|
e_config->screensaver_ask_presentation = 0;
|
|
|
|
e_config_save_queue();
|
|
|
|
e_object_del(E_OBJECT(dia));
|
|
|
|
_e_screensaver_ask_presentation_count = 0;
|
|
|
|
}
|
|
|
|
|
2009-05-06 05:00:19 -07:00
|
|
|
static void
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_ask_presentation_key_down(void *data, Evas *e EINA_UNUSED, Evas_Object *o EINA_UNUSED, void *event)
|
2009-05-06 05:00:19 -07:00
|
|
|
{
|
|
|
|
Evas_Event_Key_Down *ev = event;
|
|
|
|
E_Dialog *dia = data;
|
|
|
|
|
2014-03-13 10:00:57 -07:00
|
|
|
if (strcmp(ev->key, "Return") == 0)
|
2009-05-06 05:00:19 -07:00
|
|
|
_e_screensaver_ask_presentation_yes(NULL, dia);
|
2014-03-13 10:00:57 -07:00
|
|
|
else if (strcmp(ev->key, "Escape") == 0)
|
2009-05-06 05:00:19 -07:00
|
|
|
_e_screensaver_ask_presentation_no(NULL, dia);
|
|
|
|
}
|
|
|
|
|
2009-04-26 19:54:43 -07:00
|
|
|
static void
|
|
|
|
_e_screensaver_ask_presentation_mode(void)
|
|
|
|
{
|
|
|
|
E_Dialog *dia;
|
|
|
|
|
2010-07-18 12:06:00 -07:00
|
|
|
if (_e_screensaver_ask_presentation_dia) return;
|
2009-04-26 19:54:43 -07:00
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
if (!(dia = e_dialog_new(NULL, "E", "_screensaver_ask_presentation"))) return;
|
2009-04-26 19:54:43 -07:00
|
|
|
|
|
|
|
e_dialog_title_set(dia, _("Activate Presentation Mode?"));
|
|
|
|
e_dialog_icon_set(dia, "dialog-ask", 64);
|
2010-07-18 12:06:00 -07:00
|
|
|
e_dialog_text_set(dia,
|
2017-08-21 07:16:30 -07:00
|
|
|
_("You disabled the screensaver too fast.<ps/><ps/>"
|
2013-01-11 02:34:29 -08:00
|
|
|
"Would you like to enable <b>presentation</b> mode and "
|
|
|
|
"temporarily disable screen saver, lock and power saving?"));
|
2010-07-18 12:06:00 -07:00
|
|
|
|
2012-06-20 23:19:43 -07:00
|
|
|
e_object_del_attach_func_set(E_OBJECT(dia),
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_ask_presentation_del);
|
2012-06-20 23:19:43 -07:00
|
|
|
e_dialog_button_add(dia, _("Yes"), NULL,
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_ask_presentation_yes, NULL);
|
2012-06-20 23:19:43 -07:00
|
|
|
e_dialog_button_add(dia, _("No"), NULL,
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_ask_presentation_no, NULL);
|
2010-07-18 12:06:00 -07:00
|
|
|
e_dialog_button_add(dia, _("No, but increase timeout"), NULL,
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_ask_presentation_no_increase, NULL);
|
2010-07-18 12:06:00 -07:00
|
|
|
e_dialog_button_add(dia, _("No, and stop asking"), NULL,
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_ask_presentation_no_forever, NULL);
|
2009-04-26 19:54:43 -07:00
|
|
|
|
|
|
|
e_dialog_button_focus_num(dia, 0);
|
|
|
|
e_widget_list_homogeneous_set(dia->box_object, 0);
|
2014-11-02 18:35:13 -08:00
|
|
|
elm_win_center(dia->win, 1, 1);
|
2009-04-26 19:54:43 -07:00
|
|
|
e_dialog_show(dia);
|
|
|
|
|
2010-07-18 12:06:00 -07:00
|
|
|
evas_object_event_callback_add(dia->bg_object, EVAS_CALLBACK_KEY_DOWN,
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_ask_presentation_key_down, dia);
|
2009-05-06 05:00:19 -07:00
|
|
|
|
2009-04-26 19:54:43 -07:00
|
|
|
_e_screensaver_ask_presentation_dia = dia;
|
|
|
|
}
|
|
|
|
|
2011-08-21 03:44:23 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_suspend_cb(void *data EINA_UNUSED)
|
2011-08-21 03:44:23 -07:00
|
|
|
{
|
|
|
|
_e_screensaver_suspend_timer = NULL;
|
|
|
|
if (e_config->screensaver_suspend)
|
2011-08-21 04:02:33 -07:00
|
|
|
{
|
|
|
|
if ((e_config->screensaver_suspend_on_ac) ||
|
|
|
|
(e_powersave_mode_get() > E_POWERSAVE_MODE_LOW))
|
2019-05-16 05:50:27 -07:00
|
|
|
{
|
|
|
|
if (e_config->screensaver_hibernate)
|
|
|
|
e_sys_action_do(E_SYS_HIBERNATE, NULL);
|
|
|
|
else
|
|
|
|
e_sys_action_do(E_SYS_SUSPEND, NULL);
|
|
|
|
}
|
2011-08-21 04:02:33 -07:00
|
|
|
}
|
2011-08-21 03:44:23 -07:00
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2011-08-21 04:14:36 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_handler_powersave_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
2011-08-21 04:14:36 -07:00
|
|
|
{
|
2019-09-21 15:04:09 -07:00
|
|
|
_e_screensaver_timeout = -1;
|
|
|
|
e_screensaver_update();
|
2011-08-21 04:14:36 -07:00
|
|
|
if ((e_config->screensaver_suspend) && (_e_screensaver_on))
|
|
|
|
{
|
|
|
|
if (_e_screensaver_suspend_timer)
|
2013-01-11 02:34:29 -08:00
|
|
|
ecore_timer_del(_e_screensaver_suspend_timer);
|
2012-06-20 23:19:43 -07:00
|
|
|
_e_screensaver_suspend_timer =
|
2017-02-03 13:52:28 -08:00
|
|
|
ecore_timer_loop_add(e_config->screensaver_suspend_delay,
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_suspend_cb, NULL);
|
2011-08-21 04:14:36 -07:00
|
|
|
}
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-12-08 22:27:42 -08:00
|
|
|
static double last_start = 0.0;
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_handler_screensaver_on_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
2009-04-26 19:54:43 -07:00
|
|
|
{
|
2012-12-08 22:27:42 -08:00
|
|
|
_e_screensaver_on = EINA_TRUE;
|
|
|
|
if (_e_screensaver_suspend_timer)
|
2011-08-21 03:44:23 -07:00
|
|
|
{
|
2012-12-08 22:27:42 -08:00
|
|
|
ecore_timer_del(_e_screensaver_suspend_timer);
|
|
|
|
_e_screensaver_suspend_timer = NULL;
|
2011-08-21 03:44:23 -07:00
|
|
|
}
|
2012-12-08 22:27:42 -08:00
|
|
|
if (e_config->screensaver_suspend)
|
|
|
|
_e_screensaver_suspend_timer =
|
2017-02-03 13:52:28 -08:00
|
|
|
ecore_timer_loop_add(e_config->screensaver_suspend_delay,
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_suspend_cb, NULL);
|
2012-12-08 22:27:42 -08:00
|
|
|
last_start = ecore_loop_time_get();
|
|
|
|
_e_screensaver_ask_presentation_count = 0;
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2012-12-08 22:27:42 -08:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_handler_screensaver_off_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
2012-12-08 22:27:42 -08:00
|
|
|
{
|
|
|
|
// e_dpms_force_update();
|
2013-01-11 02:34:29 -08:00
|
|
|
|
2012-12-08 22:27:42 -08:00
|
|
|
_e_screensaver_on = EINA_FALSE;
|
|
|
|
if (_e_screensaver_suspend_timer)
|
2009-04-26 19:54:43 -07:00
|
|
|
{
|
2012-12-08 22:27:42 -08:00
|
|
|
ecore_timer_del(_e_screensaver_suspend_timer);
|
|
|
|
_e_screensaver_suspend_timer = NULL;
|
2009-04-26 19:54:43 -07:00
|
|
|
}
|
2012-12-08 22:27:42 -08:00
|
|
|
if ((last_start > 0.0) && (e_config->screensaver_ask_presentation))
|
2009-04-26 19:54:43 -07:00
|
|
|
{
|
2013-01-11 02:34:29 -08:00
|
|
|
double current = ecore_loop_time_get();
|
|
|
|
|
|
|
|
if ((last_start + e_config->screensaver_ask_presentation_timeout)
|
2012-12-08 22:27:42 -08:00
|
|
|
>= current)
|
2013-01-11 02:34:29 -08:00
|
|
|
_e_screensaver_ask_presentation_mode();
|
|
|
|
last_start = 0.0;
|
2009-04-26 19:54:43 -07:00
|
|
|
}
|
|
|
|
else if (_e_screensaver_ask_presentation_count)
|
|
|
|
_e_screensaver_ask_presentation_count = 0;
|
2015-07-27 12:46:57 -07:00
|
|
|
#ifdef HAVE_WAYLAND
|
2015-11-23 11:46:32 -08:00
|
|
|
if (_e_screensaver_timeout && (e_comp->comp_type == E_PIXMAP_TYPE_WL))
|
2017-02-03 13:52:28 -08:00
|
|
|
_e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1);
|
2015-07-27 12:46:57 -07:00
|
|
|
#endif
|
2012-12-08 22:27:42 -08:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_handler_border_fullscreen_check_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
2010-05-28 15:13:20 -07:00
|
|
|
{
|
2010-11-22 07:21:24 -08:00
|
|
|
e_screensaver_update();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2010-05-28 15:13:20 -07:00
|
|
|
}
|
|
|
|
|
2010-06-24 09:19:12 -07:00
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_handler_border_desk_set_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
2010-05-28 15:13:20 -07:00
|
|
|
{
|
2010-11-22 07:21:24 -08:00
|
|
|
e_screensaver_update();
|
2010-07-18 12:06:00 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
2015-03-18 15:09:09 -07:00
|
|
|
_e_screensaver_handler_desk_show_cb(void *data EINA_UNUSED, int type EINA_UNUSED, void *event EINA_UNUSED)
|
2010-07-18 12:06:00 -07:00
|
|
|
{
|
2010-11-22 07:21:24 -08:00
|
|
|
e_screensaver_update();
|
2010-06-24 09:19:12 -07:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2010-05-28 15:13:20 -07:00
|
|
|
}
|
|
|
|
|
2015-07-27 12:46:57 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_e_screensaver_idle_timer_cb(void *d EINA_UNUSED)
|
|
|
|
{
|
|
|
|
ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL);
|
|
|
|
screensaver_idle_timer = NULL;
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-12-08 22:27:42 -08:00
|
|
|
EINTERN void
|
|
|
|
e_screensaver_preinit(void)
|
|
|
|
{
|
|
|
|
E_EVENT_SCREENSAVER_ON = ecore_event_type_new();
|
|
|
|
E_EVENT_SCREENSAVER_OFF = ecore_event_type_new();
|
2015-07-27 13:54:01 -07:00
|
|
|
E_EVENT_SCREENSAVER_OFF_PRE = ecore_event_type_new();
|
2012-12-08 22:27:42 -08:00
|
|
|
}
|
|
|
|
|
2010-11-22 07:21:32 -08:00
|
|
|
EINTERN int
|
2007-02-13 08:33:35 -08:00
|
|
|
e_screensaver_init(void)
|
|
|
|
{
|
2012-12-08 22:27:42 -08:00
|
|
|
_e_screensaver_handler_on = ecore_event_handler_add
|
2013-01-11 02:34:29 -08:00
|
|
|
(E_EVENT_SCREENSAVER_ON, _e_screensaver_handler_screensaver_on_cb, NULL);
|
2012-12-08 22:27:42 -08:00
|
|
|
_e_screensaver_handler_off = ecore_event_handler_add
|
2013-01-11 02:34:29 -08:00
|
|
|
(E_EVENT_SCREENSAVER_OFF, _e_screensaver_handler_screensaver_off_cb, NULL);
|
2012-12-08 22:27:42 -08:00
|
|
|
_e_screensaver_handler_config_mode = ecore_event_handler_add
|
2013-01-11 02:34:29 -08:00
|
|
|
(E_EVENT_CONFIG_MODE_CHANGED, _e_screensaver_handler_config_mode_cb, NULL);
|
|
|
|
|
2010-11-22 07:21:24 -08:00
|
|
|
_e_screensaver_handler_border_fullscreen = ecore_event_handler_add
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
(E_EVENT_CLIENT_FULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
|
2010-11-22 07:21:24 -08:00
|
|
|
_e_screensaver_handler_border_unfullscreen = ecore_event_handler_add
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
(E_EVENT_CLIENT_UNFULLSCREEN, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
|
2010-11-22 07:21:24 -08:00
|
|
|
_e_screensaver_handler_border_remove = ecore_event_handler_add
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
(E_EVENT_CLIENT_REMOVE, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
|
2010-11-22 07:21:24 -08:00
|
|
|
_e_screensaver_handler_border_iconify = ecore_event_handler_add
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
(E_EVENT_CLIENT_ICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
|
2010-11-22 07:21:24 -08:00
|
|
|
_e_screensaver_handler_border_uniconify = ecore_event_handler_add
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
(E_EVENT_CLIENT_UNICONIFY, _e_screensaver_handler_border_fullscreen_check_cb, NULL);
|
2010-11-22 07:21:24 -08:00
|
|
|
_e_screensaver_handler_border_desk_set = ecore_event_handler_add
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
(E_EVENT_CLIENT_DESK_SET, _e_screensaver_handler_border_desk_set_cb, NULL);
|
2010-11-22 07:21:24 -08:00
|
|
|
_e_screensaver_handler_desk_show = ecore_event_handler_add
|
2013-01-11 02:34:29 -08:00
|
|
|
(E_EVENT_DESK_SHOW, _e_screensaver_handler_desk_show_cb, NULL);
|
2010-07-18 12:06:00 -07:00
|
|
|
|
2011-08-21 04:02:33 -07:00
|
|
|
_e_screensaver_handler_powersave = ecore_event_handler_add
|
2013-01-11 02:34:29 -08:00
|
|
|
(E_EVENT_POWERSAVE_UPDATE, _e_screensaver_handler_powersave_cb, NULL);
|
|
|
|
|
2010-11-22 07:21:24 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-11-22 07:21:32 -08:00
|
|
|
EINTERN int
|
2010-11-22 07:21:24 -08:00
|
|
|
e_screensaver_shutdown(void)
|
|
|
|
{
|
2012-12-08 22:27:42 -08:00
|
|
|
if (_e_screensaver_handler_on)
|
|
|
|
{
|
|
|
|
ecore_event_handler_del(_e_screensaver_handler_on);
|
|
|
|
_e_screensaver_handler_on = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_off)
|
|
|
|
{
|
|
|
|
ecore_event_handler_del(_e_screensaver_handler_off);
|
|
|
|
_e_screensaver_handler_off = NULL;
|
|
|
|
}
|
2013-01-11 02:34:29 -08:00
|
|
|
|
2011-08-21 03:44:23 -07:00
|
|
|
if (_e_screensaver_suspend_timer)
|
|
|
|
{
|
|
|
|
ecore_timer_del(_e_screensaver_suspend_timer);
|
|
|
|
_e_screensaver_suspend_timer = NULL;
|
|
|
|
}
|
2013-01-11 02:34:29 -08:00
|
|
|
|
2011-08-21 04:02:33 -07:00
|
|
|
if (_e_screensaver_handler_powersave)
|
|
|
|
{
|
|
|
|
ecore_event_handler_del(_e_screensaver_handler_powersave);
|
|
|
|
_e_screensaver_handler_powersave = NULL;
|
|
|
|
}
|
2012-06-20 23:19:43 -07:00
|
|
|
|
2010-11-22 07:21:24 -08:00
|
|
|
if (_e_screensaver_handler_config_mode)
|
|
|
|
{
|
|
|
|
ecore_event_handler_del(_e_screensaver_handler_config_mode);
|
|
|
|
_e_screensaver_handler_config_mode = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_border_fullscreen)
|
|
|
|
{
|
|
|
|
ecore_event_handler_del(_e_screensaver_handler_border_fullscreen);
|
|
|
|
_e_screensaver_handler_border_fullscreen = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_border_unfullscreen)
|
|
|
|
{
|
2010-12-09 01:18:58 -08:00
|
|
|
ecore_event_handler_del(_e_screensaver_handler_border_unfullscreen);
|
|
|
|
_e_screensaver_handler_border_unfullscreen = NULL;
|
2010-11-22 07:21:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_border_remove)
|
|
|
|
{
|
2010-12-09 01:18:58 -08:00
|
|
|
ecore_event_handler_del(_e_screensaver_handler_border_remove);
|
|
|
|
_e_screensaver_handler_border_remove = NULL;
|
2010-11-22 07:21:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_border_iconify)
|
|
|
|
{
|
2010-12-09 01:18:58 -08:00
|
|
|
ecore_event_handler_del(_e_screensaver_handler_border_iconify);
|
|
|
|
_e_screensaver_handler_border_iconify = NULL;
|
2010-11-22 07:21:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_border_uniconify)
|
|
|
|
{
|
2010-12-09 01:18:58 -08:00
|
|
|
ecore_event_handler_del(_e_screensaver_handler_border_uniconify);
|
|
|
|
_e_screensaver_handler_border_uniconify = NULL;
|
2010-11-22 07:21:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_border_desk_set)
|
|
|
|
{
|
2010-12-09 01:18:58 -08:00
|
|
|
ecore_event_handler_del(_e_screensaver_handler_border_desk_set);
|
|
|
|
_e_screensaver_handler_border_desk_set = NULL;
|
2010-11-22 07:21:24 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_e_screensaver_handler_desk_show)
|
|
|
|
{
|
2010-12-09 01:18:58 -08:00
|
|
|
ecore_event_handler_del(_e_screensaver_handler_desk_show);
|
|
|
|
_e_screensaver_handler_desk_show = NULL;
|
2010-11-22 07:21:24 -08:00
|
|
|
}
|
2010-05-28 15:13:20 -07:00
|
|
|
|
2007-02-13 08:33:35 -08:00
|
|
|
return 1;
|
|
|
|
}
|
2013-01-11 02:34:29 -08:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2013-09-11 06:23:43 -07:00
|
|
|
e_screensaver_attrs_set(int timeout, int blanking, int expose)
|
|
|
|
{
|
|
|
|
_e_screensaver_timeout = timeout;
|
|
|
|
// _e_screensaver_interval = ecore_x_screensaver_interval_get();
|
|
|
|
_e_screensaver_blanking = blanking;
|
|
|
|
_e_screensaver_expose = expose;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API Eina_Bool
|
2013-09-11 06:23:43 -07:00
|
|
|
e_screensaver_on_get(void)
|
|
|
|
{
|
|
|
|
return _e_screensaver_on;
|
|
|
|
}
|
2014-07-07 07:35:06 -07:00
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2014-07-07 07:35:06 -07:00
|
|
|
e_screensaver_activate(void)
|
|
|
|
{
|
2015-07-27 12:46:57 -07:00
|
|
|
if (e_screensaver_on_get()) return;
|
|
|
|
|
|
|
|
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
|
2014-07-07 07:35:06 -07:00
|
|
|
#ifndef HAVE_WAYLAND_ONLY
|
2015-07-27 12:46:57 -07:00
|
|
|
if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
|
|
|
|
ecore_x_screensaver_activate();
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_WAYLAND
|
|
|
|
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
|
|
|
|
e_screensaver_eval(1);
|
|
|
|
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
|
2014-07-07 07:35:06 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API void
|
2014-07-07 07:35:06 -07:00
|
|
|
e_screensaver_deactivate(void)
|
|
|
|
{
|
2015-07-27 12:46:57 -07:00
|
|
|
if (!e_screensaver_on_get()) return;
|
|
|
|
|
|
|
|
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
|
2014-07-07 07:35:06 -07:00
|
|
|
#ifndef HAVE_WAYLAND_ONLY
|
2015-07-27 12:46:57 -07:00
|
|
|
if (e_comp->comp_type != E_PIXMAP_TYPE_WL)
|
|
|
|
ecore_x_screensaver_reset();
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_WAYLAND
|
2015-07-27 15:24:34 -07:00
|
|
|
e_screensaver_notidle();
|
2015-07-27 12:46:57 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
e laptop lid fixes to bring back behavior and trim down glitches
so i spent a few days lopening and closing the lids of a few laptops,
plugging and unplugging external screens in, plugging and unplugging
ac power and doing lots of combinations of these. this led to a whole
slew of interrealted issues that were pretty hard to detangle into
just single issues, so this is all one blob.
this fixes:
1. if a lid close gets a monitor unplug from x or e's randr wants to
unplug then this lead to slow unsuspend or lid open times as e was
reconfirguring the screens entireluy on lid open. dont do that. just
keep things as is, unless we have an external display, then reconfigure.
2. we had 2 systems monitoring for a wake. a poller and a systemd
event. this was redundant and lead to interesting things in the debug
output, so clean that up and on systemd systsems use the systemd wake
events
3. some systems dont shut down their screens on lid close, so they
stay open until screensaver timeouts kick in. bad. so also force the
screen to go off on lid close (if the lid screen is the only one we
have).
4. x seems to have a bug where if you force dpms off etc. to turn the
screen on, it still thinks it's of and wont dpms off again after that
until you eother give some input to have the wake event make the dpms
system in x think its now time to go on, or you toggle dpms on and
off, so i found toggling tricks x into thinking the right thing.
this makes some debugging also be consistent with printfs.
all in all i have a pretty well supported laptop doing swimmingly with
e and a not so well designed (acpi dsdt - missing many events like
acpi battery ones, ac power change acpi events, missing logic to power
off a closed screen in firmware or hardware and leaving it to sw...
not this laptop has a tocuh panel and extra fun points awarded since
the touch panel doesnt shut off on lid close... AND it reprots touch
events when it closes as it touches the keys/case... hooray! that has
another work-around local to my system, as efl has no mechanism to do
this).
@fix
2018-05-14 23:40:00 -07:00
|
|
|
E_API void
|
|
|
|
e_screensaver_now_set(Eina_Bool now)
|
|
|
|
{
|
|
|
|
_screensaver_now = now;
|
|
|
|
}
|
|
|
|
|
2015-07-27 12:46:57 -07:00
|
|
|
E_API void
|
|
|
|
e_screensaver_eval(Eina_Bool saver_on)
|
|
|
|
{
|
2019-09-11 02:56:21 -07:00
|
|
|
Eina_Bool use_special_instead_of_dim = EINA_FALSE;
|
|
|
|
|
|
|
|
if ((e_desklock_state_get()) &&
|
|
|
|
(e_config->screensaver_desklock_timeout > 0))
|
|
|
|
use_special_instead_of_dim = EINA_TRUE;
|
2015-07-27 12:46:57 -07:00
|
|
|
if (saver_on)
|
|
|
|
{
|
2019-09-11 02:56:21 -07:00
|
|
|
if ((e_config->backlight.idle_dim) &&
|
|
|
|
(!use_special_instead_of_dim))
|
2015-07-27 12:46:57 -07:00
|
|
|
{
|
2019-09-18 10:56:42 -07:00
|
|
|
double t2 = e_config->backlight.timer;
|
|
|
|
|
|
|
|
if ((e_powersave_mode_get() > E_POWERSAVE_MODE_LOW) &&
|
|
|
|
(e_config->backlight.battery_timer > 0.0))
|
|
|
|
t2 = e_config->backlight.battery_timer;
|
|
|
|
double t = e_config->screensaver_timeout - t2;
|
2015-07-27 12:46:57 -07:00
|
|
|
|
|
|
|
if (t < 1.0) t = 1.0;
|
e laptop lid fixes to bring back behavior and trim down glitches
so i spent a few days lopening and closing the lids of a few laptops,
plugging and unplugging external screens in, plugging and unplugging
ac power and doing lots of combinations of these. this led to a whole
slew of interrealted issues that were pretty hard to detangle into
just single issues, so this is all one blob.
this fixes:
1. if a lid close gets a monitor unplug from x or e's randr wants to
unplug then this lead to slow unsuspend or lid open times as e was
reconfirguring the screens entireluy on lid open. dont do that. just
keep things as is, unless we have an external display, then reconfigure.
2. we had 2 systems monitoring for a wake. a poller and a systemd
event. this was redundant and lead to interesting things in the debug
output, so clean that up and on systemd systsems use the systemd wake
events
3. some systems dont shut down their screens on lid close, so they
stay open until screensaver timeouts kick in. bad. so also force the
screen to go off on lid close (if the lid screen is the only one we
have).
4. x seems to have a bug where if you force dpms off etc. to turn the
screen on, it still thinks it's of and wont dpms off again after that
until you eother give some input to have the wake event make the dpms
system in x think its now time to go on, or you toggle dpms on and
off, so i found toggling tricks x into thinking the right thing.
this makes some debugging also be consistent with printfs.
all in all i have a pretty well supported laptop doing swimmingly with
e and a not so well designed (acpi dsdt - missing many events like
acpi battery ones, ac power change acpi events, missing logic to power
off a closed screen in firmware or hardware and leaving it to sw...
not this laptop has a tocuh panel and extra fun points awarded since
the touch panel doesnt shut off on lid close... AND it reprots touch
events when it closes as it touches the keys/case... hooray! that has
another work-around local to my system, as efl has no mechanism to do
this).
@fix
2018-05-14 23:40:00 -07:00
|
|
|
if (_screensaver_now) t = 1.0;
|
2015-07-27 12:46:57 -07:00
|
|
|
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
|
2017-07-09 17:08:25 -07:00
|
|
|
if (!_screensaver_ignore)
|
2015-07-27 12:46:57 -07:00
|
|
|
{
|
2017-07-09 17:08:25 -07:00
|
|
|
if (e_config->screensaver_enable)
|
|
|
|
screensaver_idle_timer = ecore_timer_loop_add
|
|
|
|
(t, _e_screensaver_idle_timer_cb, NULL);
|
|
|
|
if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_DIM)
|
|
|
|
{
|
|
|
|
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_DIM);
|
|
|
|
screensaver_dimmed = EINA_TRUE;
|
|
|
|
}
|
2015-07-27 12:46:57 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-07-09 17:08:25 -07:00
|
|
|
if (!_screensaver_ignore)
|
|
|
|
{
|
|
|
|
if (!e_screensaver_on_get())
|
|
|
|
ecore_event_add(E_EVENT_SCREENSAVER_ON, NULL, NULL, NULL);
|
|
|
|
}
|
2015-07-27 12:46:57 -07:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (screensaver_idle_timer)
|
|
|
|
{
|
|
|
|
E_FREE_FUNC(screensaver_idle_timer, ecore_timer_del);
|
2019-09-11 02:56:21 -07:00
|
|
|
if ((e_config->backlight.idle_dim) &&
|
|
|
|
(!use_special_instead_of_dim))
|
2015-07-27 12:46:57 -07:00
|
|
|
{
|
|
|
|
if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL)
|
|
|
|
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (screensaver_dimmed)
|
2014-07-07 07:35:06 -07:00
|
|
|
{
|
2015-07-27 12:46:57 -07:00
|
|
|
if (e_backlight_mode_get(NULL) != E_BACKLIGHT_MODE_NORMAL)
|
|
|
|
e_backlight_mode_set(NULL, E_BACKLIGHT_MODE_NORMAL);
|
|
|
|
screensaver_dimmed = EINA_FALSE;
|
2014-07-07 07:35:06 -07:00
|
|
|
}
|
2017-07-09 17:08:25 -07:00
|
|
|
if (!_screensaver_ignore)
|
|
|
|
{
|
|
|
|
if (e_screensaver_on_get())
|
2017-07-13 02:03:29 -07:00
|
|
|
{
|
|
|
|
e_screensaver_update();
|
|
|
|
ecore_event_add(E_EVENT_SCREENSAVER_OFF, NULL, NULL, NULL);
|
|
|
|
}
|
2017-07-09 17:08:25 -07:00
|
|
|
}
|
2015-07-27 12:46:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
E_API void
|
|
|
|
e_screensaver_notidle(void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_WAYLAND
|
2015-08-04 16:10:09 -07:00
|
|
|
if (_e_screensaver_inhibited || (e_comp->comp_type != E_PIXMAP_TYPE_WL)) return;
|
2015-07-27 15:24:34 -07:00
|
|
|
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
|
2015-07-27 12:46:57 -07:00
|
|
|
if (e_screensaver_on_get())
|
2015-07-27 13:54:01 -07:00
|
|
|
{
|
|
|
|
ecore_event_add(E_EVENT_SCREENSAVER_OFF_PRE, NULL, NULL, NULL);
|
2017-02-03 13:52:28 -08:00
|
|
|
_e_screensaver_timer = ecore_timer_loop_add(0.2, _e_screensaver_idle_timeout_cb, NULL);
|
2015-07-27 13:54:01 -07:00
|
|
|
}
|
2015-07-28 09:41:05 -07:00
|
|
|
else if (_e_screensaver_timeout)
|
2017-02-03 13:52:28 -08:00
|
|
|
_e_screensaver_timer = ecore_timer_loop_add(_e_screensaver_timeout, _e_screensaver_idle_timeout_cb, (void*)1);
|
2014-07-07 07:35:06 -07:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2015-08-04 16:10:09 -07:00
|
|
|
E_API void
|
|
|
|
e_screensaver_inhibit_toggle(Eina_Bool inhibit)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_WAYLAND
|
|
|
|
if (e_comp->comp_type != E_PIXMAP_TYPE_WL) return;
|
|
|
|
E_FREE_FUNC(_e_screensaver_timer, ecore_timer_del);
|
|
|
|
_e_screensaver_inhibited = !!inhibit;
|
|
|
|
if (inhibit)
|
|
|
|
e_screensaver_eval(0);
|
|
|
|
else
|
|
|
|
e_screensaver_notidle();
|
|
|
|
#else
|
|
|
|
(void)inhibit;
|
|
|
|
#endif
|
|
|
|
}
|