aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c
diff options
context:
space:
mode:
authordoursse <doursse>2007-03-09 01:11:09 +0000
committerdoursse <doursse@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2007-03-09 01:11:09 +0000
commitde95d8bd42ff53fdeac594ad841e30cd2bc5d9df (patch)
treef994f17b7cd0a29f39ed4c11421c5f0cbf13556b /legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c
parentdestroy loaded_plugins if it is empty, then set it to NULL (diff)
downloadefl-de95d8bd42ff53fdeac594ad841e30cd2bc5d9df.tar.gz
Move cursor and drawable functions to their own file. DPMS: Add doc, init function, ecore_x_dpms_timeouts_get and rename ecore_x_dpms_capable. As my xorg does not have the dpms extension, someone else has to add its test in configure.in (like other extensions)
SVN revision: 28627
Diffstat (limited to 'legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c')
-rw-r--r--legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c184
1 files changed, 147 insertions, 37 deletions
diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c b/legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c
index 19b46c2a42..47a16406cd 100644
--- a/legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c
+++ b/legacy/ecore/src/lib/ecore_x/ecore_x_dpms.c
@@ -1,33 +1,85 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
-/*
- * DPMS code
- */
-#include "Ecore.h"
+
#include "ecore_x_private.h"
-#include "Ecore_X.h"
-#include "Ecore_X_Atoms.h"
-/* Are we capable */
-EAPI int
-ecore_x_dpms_capable(void)
+
+static int _dpms_available;
+#ifdef ECORE_XDPMS
+static int _dpms_major, _dpms_minor;
+#endif
+
+
+void
+_ecore_x_dpms_init(void)
+{
+#ifdef ECORE_XDPMS
+ _dpms_major = 1;
+ _dpms_minor = 0;
+
+ if (DpmsGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
+ _dpms_available = 1;
+ else
+ _dpms_available = 0;
+#else
+ _dpms_available = 0;
+#endif
+}
+
+
+/**
+ * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions
+ *
+ * Functions related to the X DPMS extension.
+ */
+
+
+
+/**
+ * Checks if the X DPMS extension is available on the server.
+ * @return @c 1 if the X DPMS extension is available, @c 0 otherwise.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI int
+ecore_x_dpms_query(void)
+{
+ return _dpms_available;
+}
+
+/**
+ * Checks if the X server is capable of DPMS.
+ * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI int
+ecore_x_dpms_capable_get(void)
{
- return DPMSCapable(_ecore_x_disp);
+ return DPMSCapable(_ecore_x_disp);
}
-/* Are we enabled */
+
+/**
+ * Checks the DPMS state of the display.
+ * @return @c 1 if DPMS is enabled, @c 0 otherwise.
+ * @ingroup Ecore_X_DPMS_Group
+ */
EAPI int
ecore_x_dpms_enabled_get(void)
{
unsigned char state;
unsigned short power_lvl;
-
+
DPMSInfo(_ecore_x_disp, &power_lvl, &state);
return state;
}
-/* Enable/Disable DPMS */
+
+/**
+ * Sets the DPMS state of the display.
+ * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
+ * @ingroup Ecore_X_DPMS_Group
+ */
EAPI void
ecore_x_dpms_enabled_set(int enabled)
{
@@ -37,36 +89,76 @@ ecore_x_dpms_enabled_set(int enabled)
DPMSDisable(_ecore_x_disp);
}
-/* Set all timeouts to known values */
+
+/**
+ * Gets the timeouts. The values are in unit of seconds.
+ * @param standby Amount of time of inactivity before standby mode will be invoked.
+ * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
+ * @param off Amount of time of inactivity before the monitor is shut off.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI void
+ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off)
+{
+ DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby, (unsigned short *)suspend, (unsigned short *)off);
+}
+
+
+/**
+ * Sets the timeouts. The values are in unit of seconds.
+ * @param standby Amount of time of inactivity before standby mode will be invoked.
+ * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
+ * @param off Amount of time of inactivity before the monitor is shut off.
+ * @ingroup Ecore_X_DPMS_Group
+ */
EAPI int
-ecore_x_dpms_timeouts_set(int standby, int suspend, int off)
+ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off)
{
- return DPMSSetTimeouts(_ecore_x_disp,
- standby,
- suspend,
- off);
+ return DPMSSetTimeouts(_ecore_x_disp,
+ standby,
+ suspend,
+ off);
}
-/* Get/Set Timeouts */
-EAPI int
+
+/**
+ * Returns the amount of time of inactivity before standby mode is invoked.
+ * @return The standby timeout value.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI unsigned int
ecore_x_dpms_timeout_standby_get()
{
unsigned short standby, suspend, off;
-
+
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
return standby;
}
-EAPI int
+
+/**
+ * Returns the amount of time of inactivity before the second level of
+ * power saving is invoked.
+ * @return The suspend timeout value.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI unsigned int
ecore_x_dpms_timeout_suspend_get()
{
unsigned short standby, suspend, off;
-
+
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
return suspend;
}
-EAPI int
+
+/**
+ * Returns the amount of time of inactivity before the third and final
+ * level of power saving is invoked.
+ * @return The off timeout value.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI unsigned int
ecore_x_dpms_timeout_off_get()
{
unsigned short standby, suspend, off;
@@ -75,37 +167,55 @@ ecore_x_dpms_timeout_off_get()
return off;
}
-EAPI void
-ecore_x_dpms_timeout_standby_set(int new_timeout)
+
+/**
+ * Sets the standby timeout (in unit of seconds).
+ * @param new_standby Amount of time of inactivity before standby mode will be invoked.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI void
+ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
{
unsigned short standby, suspend, off;
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
- DPMSSetTimeouts(_ecore_x_disp,
- new_timeout,
+ DPMSSetTimeouts(_ecore_x_disp,
+ new_timeout,
suspend,
off);
}
-EAPI void
-ecore_x_dpms_timeout_suspend_set(int new_timeout)
+
+/**
+ * Sets the suspend timeout (in unit of seconds).
+ * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI void
+ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
{
unsigned short standby, suspend, off;
-
+
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
- DPMSSetTimeouts(_ecore_x_disp,
+ DPMSSetTimeouts(_ecore_x_disp,
standby,
- new_timeout,
+ new_timeout,
off);
}
-EAPI void
-ecore_x_dpms_timeout_off_set(int new_timeout)
+
+/**
+ * Sets the off timeout (in unit of seconds).
+ * @param off Amount of time of inactivity before the monitor is shut off.
+ * @ingroup Ecore_X_DPMS_Group
+ */
+EAPI void
+ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
{
unsigned short standby, suspend, off;
DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
- DPMSSetTimeouts(_ecore_x_disp,
+ DPMSSetTimeouts(_ecore_x_disp,
standby,
suspend,
new_timeout);