2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
5 #include "ecore_x_private.h"
7 static int _dpms_available;
10 _ecore_x_dpms_init(void)
13 int _dpms_major, _dpms_minor;
18 if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
28 * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
30 * Functions related to the X DPMS extension.
34 * Checks if the X DPMS extension is available on the server.
35 * @return @c 1 if the X DPMS extension is available, @c 0 otherwise.
36 * @ingroup Ecore_X_DPMS_Group
39 ecore_x_dpms_query(void)
41 return _dpms_available;
45 * Checks if the X server is capable of DPMS.
46 * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
47 * @ingroup Ecore_X_DPMS_Group
50 ecore_x_dpms_capable_get(void)
53 return DPMSCapable(_ecore_x_disp);
60 * Checks the DPMS state of the display.
61 * @return @c 1 if DPMS is enabled, @c 0 otherwise.
62 * @ingroup Ecore_X_DPMS_Group
65 ecore_x_dpms_enabled_get(void)
69 unsigned short power_lvl;
71 DPMSInfo(_ecore_x_disp, &power_lvl, &state);
79 * Sets the DPMS state of the display.
80 * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
81 * @ingroup Ecore_X_DPMS_Group
84 ecore_x_dpms_enabled_set(int enabled)
88 DPMSEnable(_ecore_x_disp);
90 DPMSDisable(_ecore_x_disp);
95 * Gets the timeouts. The values are in unit of seconds.
96 * @param standby Amount of time of inactivity before standby mode will be invoked.
97 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
98 * @param off Amount of time of inactivity before the monitor is shut off.
99 * @ingroup Ecore_X_DPMS_Group
102 ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off)
105 DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby,
106 (unsigned short *)suspend, (unsigned short *)off);
111 * Sets the timeouts. The values are in unit of seconds.
112 * @param standby Amount of time of inactivity before standby mode will be invoked.
113 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
114 * @param off Amount of time of inactivity before the monitor is shut off.
115 * @ingroup Ecore_X_DPMS_Group
118 ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off)
121 return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off);
128 * Returns the amount of time of inactivity before standby mode is invoked.
129 * @return The standby timeout value.
130 * @ingroup Ecore_X_DPMS_Group
133 ecore_x_dpms_timeout_standby_get()
136 unsigned short standby, suspend, off;
138 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
146 * Returns the amount of time of inactivity before the second level of
147 * power saving is invoked.
148 * @return The suspend timeout value.
149 * @ingroup Ecore_X_DPMS_Group
152 ecore_x_dpms_timeout_suspend_get()
155 unsigned short standby, suspend, off;
157 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
165 * Returns the amount of time of inactivity before the third and final
166 * level of power saving is invoked.
167 * @return The off timeout value.
168 * @ingroup Ecore_X_DPMS_Group
171 ecore_x_dpms_timeout_off_get()
174 unsigned short standby, suspend, off;
176 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
184 * Sets the standby timeout (in unit of seconds).
185 * @param new_standby Amount of time of inactivity before standby mode will be invoked.
186 * @ingroup Ecore_X_DPMS_Group
189 ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
192 unsigned short standby, suspend, off;
194 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
195 DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off);
200 * Sets the suspend timeout (in unit of seconds).
201 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
202 * @ingroup Ecore_X_DPMS_Group
205 ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
208 unsigned short standby, suspend, off;
210 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
211 DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off);
216 * Sets the off timeout (in unit of seconds).
217 * @param off Amount of time of inactivity before the monitor is shut off.
218 * @ingroup Ecore_X_DPMS_Group
221 ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
224 unsigned short standby, suspend, off;
226 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
227 DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout);