enlightenment/src/bin/e_screensaver.c

436 lines
14 KiB
C
Raw Normal View History

#include "e.h"
static Ecore_Event_Handler *_e_screensaver_handler_on = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_off = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_config_mode = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_border_fullscreen = NULL;
static Ecore_Event_Handler *_e_screensaver_handler_border_unfullscreen = NULL;
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;
static Ecore_Event_Handler *_e_screensaver_handler_powersave = NULL;
static E_Dialog *_e_screensaver_ask_presentation_dia = NULL;
static int _e_screensaver_ask_presentation_count = 0;
static int _e_screensaver_timeout = 0;
//static int _e_screensaver_interval = 0;
static int _e_screensaver_blanking = 0;
static int _e_screensaver_expose = 0;
static Ecore_Timer *_e_screensaver_suspend_timer = NULL;
static Eina_Bool _e_screensaver_on = EINA_FALSE;
EAPI int E_EVENT_SCREENSAVER_ON = -1;
EAPI int E_EVENT_SCREENSAVER_OFF = -1;
EAPI int
e_screensaver_timeout_get(Eina_Bool use_idle)
{
int timeout = 0, count = (1 + _e_screensaver_ask_presentation_count);
if ((e_config->screensaver_enable) && (!e_config->mode.presentation))
timeout = e_config->screensaver_timeout * count;
if ((use_idle) && (!e_config->mode.presentation))
{
if (e_config->backlight.idle_dim)
{
if (timeout > 0)
{
if (e_config->backlight.timer < timeout)
timeout = e_config->backlight.timer;
}
else
timeout = e_config->backlight.timer;
}
}
return timeout;
}
EAPI void
e_screensaver_update(void)
{
int timeout = 0, interval = 0, blanking = 0, expose = 0;
Eina_Bool changed = EINA_FALSE;
timeout = e_screensaver_timeout_get(EINA_TRUE);
interval = e_config->screensaver_interval;
blanking = e_config->screensaver_blanking;
expose = e_config->screensaver_expose;
if (_e_screensaver_timeout != timeout)
{
_e_screensaver_timeout = timeout;
changed = EINA_TRUE;
}
// 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 (changed)
#ifdef WAYLAND_ONLY
#else
ecore_x_screensaver_set(timeout, interval, blanking, expose);
#endif
}
EAPI void
e_screensaver_force_update(void)
{
int timeout = e_screensaver_timeout_get(EINA_TRUE);
#ifdef WAYLAND_ONLY
#else
if (!getenv("DISPLAY")) return;
ecore_x_screensaver_set(timeout + 10,
0,
// e_config->screensaver_interval,
!e_config->screensaver_blanking,
!e_config->screensaver_expose);
ecore_x_screensaver_set(timeout,
0,
// e_config->screensaver_interval,
e_config->screensaver_blanking,
e_config->screensaver_expose);
#endif
}
static Eina_Bool
_e_screensaver_handler_config_mode_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
e_screensaver_update();
return ECORE_CALLBACK_PASS_ON;
}
static void
_e_screensaver_ask_presentation_del(void *data)
{
if (_e_screensaver_ask_presentation_dia == data)
_e_screensaver_ask_presentation_dia = NULL;
}
static void
_e_screensaver_ask_presentation_yes(void *data __UNUSED__, E_Dialog *dia)
{
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
_e_screensaver_ask_presentation_no(void *data __UNUSED__, E_Dialog *dia)
{
e_object_del(E_OBJECT(dia));
_e_screensaver_ask_presentation_count = 0;
}
static void
_e_screensaver_ask_presentation_no_increase(void *data __UNUSED__, E_Dialog *dia)
{
_e_screensaver_ask_presentation_count++;
e_screensaver_update();
e_object_del(E_OBJECT(dia));
}
static void
_e_screensaver_ask_presentation_no_forever(void *data __UNUSED__, E_Dialog *dia)
{
e_config->screensaver_ask_presentation = 0;
e_config_save_queue();
e_object_del(E_OBJECT(dia));
_e_screensaver_ask_presentation_count = 0;
}
static void
_e_screensaver_ask_presentation_key_down(void *data, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event)
{
Evas_Event_Key_Down *ev = event;
E_Dialog *dia = data;
if (strcmp(ev->keyname, "Return") == 0)
_e_screensaver_ask_presentation_yes(NULL, dia);
else if (strcmp(ev->keyname, "Escape") == 0)
_e_screensaver_ask_presentation_no(NULL, dia);
}
static void
_e_screensaver_ask_presentation_mode(void)
{
E_Dialog *dia;
if (_e_screensaver_ask_presentation_dia) return;
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;
e_dialog_title_set(dia, _("Activate Presentation Mode?"));
e_dialog_icon_set(dia, "dialog-ask", 64);
e_dialog_text_set(dia,
_("You disabled the screensaver too fast.<br><br>"
"Would you like to enable <b>presentation</b> mode and "
"temporarily disable screen saver, lock and power saving?"));
2012-06-20 23:19:43 -07:00
e_object_del_attach_func_set(E_OBJECT(dia),
_e_screensaver_ask_presentation_del);
2012-06-20 23:19:43 -07:00
e_dialog_button_add(dia, _("Yes"), NULL,
_e_screensaver_ask_presentation_yes, NULL);
2012-06-20 23:19:43 -07:00
e_dialog_button_add(dia, _("No"), NULL,
_e_screensaver_ask_presentation_no, NULL);
e_dialog_button_add(dia, _("No, but increase timeout"), NULL,
_e_screensaver_ask_presentation_no_increase, NULL);
e_dialog_button_add(dia, _("No, and stop asking"), NULL,
_e_screensaver_ask_presentation_no_forever, NULL);
e_dialog_button_focus_num(dia, 0);
e_widget_list_homogeneous_set(dia->box_object, 0);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
evas_object_event_callback_add(dia->bg_object, EVAS_CALLBACK_KEY_DOWN,
_e_screensaver_ask_presentation_key_down, dia);
_e_screensaver_ask_presentation_dia = dia;
}
static Eina_Bool
_e_screensaver_suspend_cb(void *data __UNUSED__)
{
_e_screensaver_suspend_timer = NULL;
if (e_config->screensaver_suspend)
{
if ((e_config->screensaver_suspend_on_ac) ||
(e_powersave_mode_get() > E_POWERSAVE_MODE_LOW))
e_sys_action_do(E_SYS_SUSPEND, NULL);
}
return EINA_FALSE;
}
static Eina_Bool
_e_screensaver_handler_powersave_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
if ((e_config->screensaver_suspend) && (_e_screensaver_on))
{
if (_e_screensaver_suspend_timer)
ecore_timer_del(_e_screensaver_suspend_timer);
2012-06-20 23:19:43 -07:00
_e_screensaver_suspend_timer =
ecore_timer_add(e_config->screensaver_suspend_delay,
_e_screensaver_suspend_cb, NULL);
}
return ECORE_CALLBACK_PASS_ON;
}
static double last_start = 0.0;
static Eina_Bool
_e_screensaver_handler_screensaver_on_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
_e_screensaver_on = EINA_TRUE;
if (_e_screensaver_suspend_timer)
{
ecore_timer_del(_e_screensaver_suspend_timer);
_e_screensaver_suspend_timer = NULL;
}
if (e_config->screensaver_suspend)
_e_screensaver_suspend_timer =
ecore_timer_add(e_config->screensaver_suspend_delay,
_e_screensaver_suspend_cb, NULL);
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
static Eina_Bool
_e_screensaver_handler_screensaver_off_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
// e_screensaver_force_update();
// e_dpms_force_update();
_e_screensaver_on = EINA_FALSE;
if (_e_screensaver_suspend_timer)
{
ecore_timer_del(_e_screensaver_suspend_timer);
_e_screensaver_suspend_timer = NULL;
}
if ((last_start > 0.0) && (e_config->screensaver_ask_presentation))
{
double current = ecore_loop_time_get();
if ((last_start + e_config->screensaver_ask_presentation_timeout)
>= current)
_e_screensaver_ask_presentation_mode();
last_start = 0.0;
}
else if (_e_screensaver_ask_presentation_count)
_e_screensaver_ask_presentation_count = 0;
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_screensaver_handler_border_fullscreen_check_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
e_screensaver_update();
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_screensaver_handler_border_desk_set_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
e_screensaver_update();
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_screensaver_handler_desk_show_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
{
e_screensaver_update();
return ECORE_CALLBACK_PASS_ON;
}
EINTERN void
e_screensaver_preinit(void)
{
E_EVENT_SCREENSAVER_ON = ecore_event_type_new();
E_EVENT_SCREENSAVER_OFF = ecore_event_type_new();
}
EINTERN int
e_screensaver_init(void)
{
_e_screensaver_handler_on = ecore_event_handler_add
(E_EVENT_SCREENSAVER_ON, _e_screensaver_handler_screensaver_on_cb, NULL);
_e_screensaver_handler_off = ecore_event_handler_add
(E_EVENT_SCREENSAVER_OFF, _e_screensaver_handler_screensaver_off_cb, NULL);
_e_screensaver_handler_config_mode = ecore_event_handler_add
(E_EVENT_CONFIG_MODE_CHANGED, _e_screensaver_handler_config_mode_cb, NULL);
_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);
_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);
_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);
_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);
_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);
_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);
_e_screensaver_handler_desk_show = ecore_event_handler_add
(E_EVENT_DESK_SHOW, _e_screensaver_handler_desk_show_cb, NULL);
_e_screensaver_handler_powersave = ecore_event_handler_add
(E_EVENT_POWERSAVE_UPDATE, _e_screensaver_handler_powersave_cb, NULL);
e_screensaver_force_update();
return 1;
}
EINTERN int
e_screensaver_shutdown(void)
{
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;
}
if (_e_screensaver_suspend_timer)
{
ecore_timer_del(_e_screensaver_suspend_timer);
_e_screensaver_suspend_timer = NULL;
}
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
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)
{
ecore_event_handler_del(_e_screensaver_handler_border_unfullscreen);
_e_screensaver_handler_border_unfullscreen = NULL;
}
if (_e_screensaver_handler_border_remove)
{
ecore_event_handler_del(_e_screensaver_handler_border_remove);
_e_screensaver_handler_border_remove = NULL;
}
if (_e_screensaver_handler_border_iconify)
{
ecore_event_handler_del(_e_screensaver_handler_border_iconify);
_e_screensaver_handler_border_iconify = NULL;
}
if (_e_screensaver_handler_border_uniconify)
{
ecore_event_handler_del(_e_screensaver_handler_border_uniconify);
_e_screensaver_handler_border_uniconify = NULL;
}
if (_e_screensaver_handler_border_desk_set)
{
ecore_event_handler_del(_e_screensaver_handler_border_desk_set);
_e_screensaver_handler_border_desk_set = NULL;
}
if (_e_screensaver_handler_desk_show)
{
ecore_event_handler_del(_e_screensaver_handler_desk_show);
_e_screensaver_handler_desk_show = NULL;
}
return 1;
}
EAPI void
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;
}
EAPI Eina_Bool
e_screensaver_on_get(void)
{
return _e_screensaver_on;
}