aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c')
-rw-r--r--libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c247
1 files changed, 0 insertions, 247 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c
deleted file mode 100644
index 23349f4..0000000
--- a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c
+++ /dev/null
@@ -1,247 +0,0 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif /* ifdef HAVE_CONFIG_H */
4
5#include "ecore_x_private.h"
6
7static Eina_Bool _dpms_available = EINA_FALSE;
8
9void
10_ecore_x_dpms_init(void)
11{
12#ifdef ECORE_XDPMS
13 int _dpms_major, _dpms_minor;
14
15 _dpms_major = 1;
16 _dpms_minor = 0;
17
18 if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
19 _dpms_available = EINA_TRUE;
20 else
21 _dpms_available = EINA_FALSE;
22
23#else /* ifdef ECORE_XDPMS */
24 _dpms_available = EINA_FALSE;
25#endif /* ifdef ECORE_XDPMS */
26}
27
28/**
29 * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
30 *
31 * Functions related to the X DPMS extension.
32 */
33
34/**
35 * Checks if the X DPMS extension is available on the server.
36 * @return @c 1 if the X DPMS extension is available, @c 0 otherwise.
37 * @ingroup Ecore_X_DPMS_Group
38 */
39EAPI Eina_Bool
40ecore_x_dpms_query(void)
41{
42 return _dpms_available;
43}
44
45/**
46 * Checks if the X server is capable of DPMS.
47 * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
48 * @ingroup Ecore_X_DPMS_Group
49 */
50EAPI Eina_Bool
51ecore_x_dpms_capable_get(void)
52{
53#ifdef ECORE_XDPMS
54 LOGFN(__FILE__, __LINE__, __FUNCTION__);
55 return DPMSCapable(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE;
56#else /* ifdef ECORE_XDPMS */
57 return EINA_FALSE;
58#endif /* ifdef ECORE_XDPMS */
59}
60
61/**
62 * Checks the DPMS state of the display.
63 * @return @c 1 if DPMS is enabled, @c 0 otherwise.
64 * @ingroup Ecore_X_DPMS_Group
65 */
66EAPI Eina_Bool
67ecore_x_dpms_enabled_get(void)
68{
69#ifdef ECORE_XDPMS
70 unsigned char state;
71 unsigned short power_lvl;
72
73 LOGFN(__FILE__, __LINE__, __FUNCTION__);
74 DPMSInfo(_ecore_x_disp, &power_lvl, &state);
75 return state ? EINA_TRUE : EINA_FALSE;
76#else /* ifdef ECORE_XDPMS */
77 return EINA_FALSE;
78#endif /* ifdef ECORE_XDPMS */
79}
80
81/**
82 * Sets the DPMS state of the display.
83 * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
84 * @ingroup Ecore_X_DPMS_Group
85 */
86EAPI void
87ecore_x_dpms_enabled_set(int enabled)
88{
89#ifdef ECORE_XDPMS
90 LOGFN(__FILE__, __LINE__, __FUNCTION__);
91 if (enabled)
92 DPMSEnable(_ecore_x_disp);
93 else
94 DPMSDisable(_ecore_x_disp);
95
96#endif /* ifdef ECORE_XDPMS */
97}
98
99/**
100 * Gets the timeouts. The values are in unit of seconds.
101 * @param standby Amount of time of inactivity before standby mode will be invoked.
102 * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
103 * @param off Amount of time of inactivity before the monitor is shut off.
104 * @ingroup Ecore_X_DPMS_Group
105 */
106EAPI void
107ecore_x_dpms_timeouts_get(unsigned int *standby,
108 unsigned int *suspend,
109 unsigned int *off)
110{
111#ifdef ECORE_XDPMS
112 LOGFN(__FILE__, __LINE__, __FUNCTION__);
113 DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby,
114 (unsigned short *)suspend, (unsigned short *)off);
115#endif /* ifdef ECORE_XDPMS */
116}
117
118/**
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
124 */
125EAPI Eina_Bool
126ecore_x_dpms_timeouts_set(unsigned int standby,
127 unsigned int suspend,
128 unsigned int off)
129{
130#ifdef ECORE_XDPMS
131 LOGFN(__FILE__, __LINE__, __FUNCTION__);
132 return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off) ? EINA_TRUE : EINA_FALSE;
133#else /* ifdef ECORE_XDPMS */
134 return EINA_FALSE;
135#endif /* ifdef ECORE_XDPMS */
136}
137
138/**
139 * Returns the amount of time of inactivity before standby mode is invoked.
140 * @return The standby timeout value.
141 * @ingroup Ecore_X_DPMS_Group
142 */
143EAPI unsigned int
144ecore_x_dpms_timeout_standby_get(void)
145{
146#ifdef ECORE_XDPMS
147 unsigned short standby, suspend, off;
148
149 LOGFN(__FILE__, __LINE__, __FUNCTION__);
150 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
151 return standby;
152#else /* ifdef ECORE_XDPMS */
153 return 0;
154#endif /* ifdef ECORE_XDPMS */
155}
156
157/**
158 * Returns the amount of time of inactivity before the second level of
159 * power saving is invoked.
160 * @return The suspend timeout value.
161 * @ingroup Ecore_X_DPMS_Group
162 */
163EAPI unsigned int
164ecore_x_dpms_timeout_suspend_get(void)
165{
166#ifdef ECORE_XDPMS
167 unsigned short standby, suspend, off;
168
169 LOGFN(__FILE__, __LINE__, __FUNCTION__);
170 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
171 return suspend;
172#else /* ifdef ECORE_XDPMS */
173 return 0;
174#endif /* ifdef ECORE_XDPMS */
175}
176
177/**
178 * Returns the amount of time of inactivity before the third and final
179 * level of power saving is invoked.
180 * @return The off timeout value.
181 * @ingroup Ecore_X_DPMS_Group
182 */
183EAPI unsigned int
184ecore_x_dpms_timeout_off_get(void)
185{
186#ifdef ECORE_XDPMS
187 unsigned short standby, suspend, off;
188
189 LOGFN(__FILE__, __LINE__, __FUNCTION__);
190 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
191 return off;
192#else /* ifdef ECORE_XDPMS */
193 return 0;
194#endif /* ifdef ECORE_XDPMS */
195}
196
197/**
198 * Sets the standby timeout (in unit of seconds).
199 * @param new_timeout Amount of time of inactivity before standby mode will be invoked.
200 * @ingroup Ecore_X_DPMS_Group
201 */
202EAPI void
203ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
204{
205#ifdef ECORE_XDPMS
206 unsigned short standby, suspend, off;
207
208 LOGFN(__FILE__, __LINE__, __FUNCTION__);
209 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
210 DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off);
211#endif /* ifdef ECORE_XDPMS */
212}
213
214/**
215 * Sets the suspend timeout (in unit of seconds).
216 * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode.
217 * @ingroup Ecore_X_DPMS_Group
218 */
219EAPI void
220ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
221{
222#ifdef ECORE_XDPMS
223 unsigned short standby, suspend, off;
224
225 LOGFN(__FILE__, __LINE__, __FUNCTION__);
226 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
227 DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off);
228#endif /* ifdef ECORE_XDPMS */
229}
230
231/**
232 * Sets the off timeout (in unit of seconds).
233 * @param new_timeout Amount of time of inactivity before the monitor is shut off.
234 * @ingroup Ecore_X_DPMS_Group
235 */
236EAPI void
237ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
238{
239#ifdef ECORE_XDPMS
240 unsigned short standby, suspend, off;
241
242 LOGFN(__FILE__, __LINE__, __FUNCTION__);
243 DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
244 DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout);
245#endif /* ifdef ECORE_XDPMS */
246}
247