3 static Ecore_Event_Handler *_e_dpms_handler_config_mode = NULL;
4 static Ecore_Event_Handler *_e_dpms_handler_border_fullscreen = NULL;
5 static Ecore_Event_Handler *_e_dpms_handler_border_unfullscreen = NULL;
6 static Ecore_Event_Handler *_e_dpms_handler_border_remove = NULL;
7 static Ecore_Event_Handler *_e_dpms_handler_border_iconify = NULL;
8 static Ecore_Event_Handler *_e_dpms_handler_border_uniconify = NULL;
9 static Ecore_Event_Handler *_e_dpms_handler_border_desk_set = NULL;
10 static Ecore_Event_Handler *_e_dpms_handler_desk_show = NULL;
12 static unsigned int _e_dpms_timeout_standby = 0;
13 static unsigned int _e_dpms_timeout_suspend = 0;
14 static unsigned int _e_dpms_timeout_off = 0;
15 static int _e_dpms_enabled = EINA_FALSE;
21 unsigned int standby = 0, suspend = 0, off = 0;
23 Eina_Bool changed = EINA_FALSE;
25 enabled = ((e_config->dpms_enable) && (!e_config->mode.presentation) &&
26 (!e_util_fullscreen_curreny_any()));
28 if (_e_dpms_enabled != enabled)
30 _e_dpms_enabled = enabled;
31 ecore_x_dpms_enabled_set(enabled);
35 if (e_config->dpms_standby_enable)
37 standby = e_config->dpms_standby_timeout;
38 if (_e_dpms_timeout_standby != standby)
40 _e_dpms_timeout_standby = standby;
45 if (e_config->dpms_suspend_enable)
47 suspend = e_config->dpms_suspend_timeout;
48 if (_e_dpms_timeout_suspend != suspend)
50 _e_dpms_timeout_suspend = suspend;
55 if (e_config->dpms_off_enable)
57 off = e_config->dpms_off_timeout;
58 if (_e_dpms_timeout_off != off)
60 _e_dpms_timeout_off = off;
65 if (changed) ecore_x_dpms_timeouts_set(standby, suspend, off);
69 e_dpms_force_update(void)
71 unsigned int standby = 0, suspend = 0, off = 0;
74 enabled = ((e_config->dpms_enable) && (!e_config->mode.presentation) &&
75 (!e_util_fullscreen_curreny_any()));
76 ecore_x_dpms_enabled_set(enabled);
78 if (e_config->dpms_standby_enable)
79 standby = e_config->dpms_standby_timeout;
80 if (e_config->dpms_suspend_enable)
81 suspend = e_config->dpms_suspend_timeout;
82 if (e_config->dpms_off_enable)
83 off = e_config->dpms_off_timeout;
84 ecore_x_dpms_timeouts_set(standby + 10, suspend + 10, off + 10);
85 ecore_x_dpms_timeouts_set(standby, suspend, off);
89 _e_dpms_handler_config_mode_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
92 return ECORE_CALLBACK_PASS_ON;
96 _e_dpms_handler_border_fullscreen_check_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
99 return ECORE_CALLBACK_PASS_ON;
103 _e_dpms_handler_border_desk_set_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
106 return ECORE_CALLBACK_PASS_ON;
110 _e_dpms_handler_desk_show_cb(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
113 return ECORE_CALLBACK_PASS_ON;
119 _e_dpms_handler_config_mode = ecore_event_handler_add
120 (E_EVENT_CONFIG_MODE_CHANGED, _e_dpms_handler_config_mode_cb, NULL);
122 _e_dpms_handler_border_fullscreen = ecore_event_handler_add
123 (E_EVENT_BORDER_FULLSCREEN, _e_dpms_handler_border_fullscreen_check_cb, NULL);
125 _e_dpms_handler_border_unfullscreen = ecore_event_handler_add
126 (E_EVENT_BORDER_UNFULLSCREEN, _e_dpms_handler_border_fullscreen_check_cb, NULL);
128 _e_dpms_handler_border_remove = ecore_event_handler_add
129 (E_EVENT_BORDER_REMOVE, _e_dpms_handler_border_fullscreen_check_cb, NULL);
131 _e_dpms_handler_border_iconify = ecore_event_handler_add
132 (E_EVENT_BORDER_ICONIFY, _e_dpms_handler_border_fullscreen_check_cb, NULL);
134 _e_dpms_handler_border_uniconify = ecore_event_handler_add
135 (E_EVENT_BORDER_UNICONIFY, _e_dpms_handler_border_fullscreen_check_cb, NULL);
137 _e_dpms_handler_border_desk_set = ecore_event_handler_add
138 (E_EVENT_BORDER_DESK_SET, _e_dpms_handler_border_desk_set_cb, NULL);
140 _e_dpms_handler_desk_show = ecore_event_handler_add
141 (E_EVENT_DESK_SHOW, _e_dpms_handler_desk_show_cb, NULL);
143 _e_dpms_enabled = ecore_x_dpms_enabled_get();
144 ecore_x_dpms_timeouts_get
145 (&_e_dpms_timeout_standby, &_e_dpms_timeout_suspend, &_e_dpms_timeout_off);
153 e_dpms_shutdown(void)
155 if (_e_dpms_handler_config_mode)
157 ecore_event_handler_del(_e_dpms_handler_config_mode);
158 _e_dpms_handler_config_mode = NULL;
161 if (_e_dpms_handler_border_fullscreen)
163 ecore_event_handler_del(_e_dpms_handler_border_fullscreen);
164 _e_dpms_handler_border_fullscreen = NULL;
167 if (_e_dpms_handler_border_unfullscreen)
169 ecore_event_handler_del(_e_dpms_handler_border_unfullscreen);
170 _e_dpms_handler_border_unfullscreen = NULL;
173 if (_e_dpms_handler_border_remove)
175 ecore_event_handler_del(_e_dpms_handler_border_remove);
176 _e_dpms_handler_border_remove = NULL;
179 if (_e_dpms_handler_border_iconify)
181 ecore_event_handler_del(_e_dpms_handler_border_iconify);
182 _e_dpms_handler_border_iconify = NULL;
185 if (_e_dpms_handler_border_uniconify)
187 ecore_event_handler_del(_e_dpms_handler_border_uniconify);
188 _e_dpms_handler_border_uniconify = NULL;
191 if (_e_dpms_handler_border_desk_set)
193 ecore_event_handler_del(_e_dpms_handler_border_desk_set);
194 _e_dpms_handler_border_desk_set = NULL;
197 if (_e_dpms_handler_desk_show)
199 ecore_event_handler_del(_e_dpms_handler_desk_show);
200 _e_dpms_handler_desk_show = NULL;