2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
9 #include "ecore_x_private.h"
11 static int _dpms_available;
14 _ecore_x_dpms_init(void)
17 int _dpms_major, _dpms_minor;
22 if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
32 * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
34 * Functions related to the X DPMS extension.
38 * Checks if the X DPMS extension is available on the server.
39 * @return @c 1 if the X DPMS extension is available, @c 0 otherwise.
40 * @ingroup Ecore_X_DPMS_Group
43 ecore_x_dpms_query(void)
45 return _dpms_available;
49 * Checks if the X server is capable of DPMS.
50 * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
51 * @ingroup Ecore_X_DPMS_Group
54 ecore_x_dpms_capable_get(void)
57 LOGFN(__FILE__, __LINE__, __FUNCTION__);
58 return DPMSCapable(_ecore_x_disp);
65 * Checks the DPMS state of the display.
66 * @return @c 1 if DPMS is enabled, @c 0 otherwise.
67 * @ingroup Ecore_X_DPMS_Group
70 ecore_x_dpms_enabled_get(void)
74 unsigned short power_lvl;
76 LOGFN(__FILE__, __LINE__, __FUNCTION__);
77 DPMSInfo(_ecore_x_disp, &power_lvl, &state);
85 * Sets the DPMS state of the display.
86 * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
87 * @ingroup Ecore_X_DPMS_Group
90 ecore_x_dpms_enabled_set(int enabled)
93 LOGFN(__FILE__, __LINE__, __FUNCTION__);
95 DPMSEnable(_ecore_x_disp);
97 DPMSDisable(_ecore_x_disp);
102 * Gets the timeouts. The values are in unit of seconds.
103 * @param standby Amount of time of inactivity before standby mode will be invoked.
104 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
105 * @param off Amount of time of inactivity before the monitor is shut off.
106 * @ingroup Ecore_X_DPMS_Group
109 ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off)
112 LOGFN(__FILE__, __LINE__, __FUNCTION__);
113 DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby,
114 (unsigned short *)suspend, (unsigned short *)off);
119 * Sets the timeouts. The values are in unit of seconds.
120 * @param standby Amount of time of inactivity before standby mode will be invoked.
121 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
122 * @param off Amount of time of inactivity before the monitor is shut off.
123 * @ingroup Ecore_X_DPMS_Group
126 ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off)
129 LOGFN(__FILE__, __LINE__, __FUNCTION__);
130 return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off);
137 * Returns the amount of time of inactivity before standby mode is invoked.
138 * @return The standby timeout value.
139 * @ingroup Ecore_X_DPMS_Group
142 ecore_x_dpms_timeout_standby_get()
145 unsigned short standby, suspend, off;
147 LOGFN(__FILE__, __LINE__, __FUNCTION__);
148 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
156 * Returns the amount of time of inactivity before the second level of
157 * power saving is invoked.
158 * @return The suspend timeout value.
159 * @ingroup Ecore_X_DPMS_Group
162 ecore_x_dpms_timeout_suspend_get()
165 unsigned short standby, suspend, off;
167 LOGFN(__FILE__, __LINE__, __FUNCTION__);
168 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
176 * Returns the amount of time of inactivity before the third and final
177 * level of power saving is invoked.
178 * @return The off timeout value.
179 * @ingroup Ecore_X_DPMS_Group
182 ecore_x_dpms_timeout_off_get()
185 unsigned short standby, suspend, off;
187 LOGFN(__FILE__, __LINE__, __FUNCTION__);
188 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
196 * Sets the standby timeout (in unit of seconds).
197 * @param new_standby Amount of time of inactivity before standby mode will be invoked.
198 * @ingroup Ecore_X_DPMS_Group
201 ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
204 unsigned short standby, suspend, off;
206 LOGFN(__FILE__, __LINE__, __FUNCTION__);
207 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
208 DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off);
213 * Sets the suspend timeout (in unit of seconds).
214 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
215 * @ingroup Ecore_X_DPMS_Group
218 ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
221 unsigned short standby, suspend, off;
223 LOGFN(__FILE__, __LINE__, __FUNCTION__);
224 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
225 DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off);
230 * Sets the off timeout (in unit of seconds).
231 * @param off Amount of time of inactivity before the monitor is shut off.
232 * @ingroup Ecore_X_DPMS_Group
235 ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
238 unsigned short standby, suspend, off;
240 LOGFN(__FILE__, __LINE__, __FUNCTION__);
241 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
242 DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout);