Tizen 2.0 Release
[profile/ivi/ecore.git] / src / lib / ecore_x / xlib / ecore_x_dpms.c
index d4dac43..23349f4 100644 (file)
@@ -1,10 +1,10 @@
-/*
- * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
- */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif /* ifdef HAVE_CONFIG_H */
 
 #include "ecore_x_private.h"
 
-static int _dpms_available;
+static Eina_Bool _dpms_available = EINA_FALSE;
 
 void
 _ecore_x_dpms_init(void)
@@ -16,12 +16,13 @@ _ecore_x_dpms_init(void)
    _dpms_minor = 0;
 
    if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor))
-     _dpms_available = 1;
+     _dpms_available = EINA_TRUE;
    else
-     _dpms_available = 0;
-#else
-   _dpms_available = 0;
-#endif
+     _dpms_available = EINA_FALSE;
+
+#else /* ifdef ECORE_XDPMS */
+   _dpms_available = EINA_FALSE;
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -35,7 +36,7 @@ _ecore_x_dpms_init(void)
  * @return @c 1 if the X DPMS extension is available, @c 0 otherwise.
  * @ingroup Ecore_X_DPMS_Group
  */
-EAPI int
+EAPI Eina_Bool
 ecore_x_dpms_query(void)
 {
    return _dpms_available;
@@ -46,14 +47,15 @@ ecore_x_dpms_query(void)
  * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise.
  * @ingroup Ecore_X_DPMS_Group
  */
-EAPI int
+EAPI Eina_Bool
 ecore_x_dpms_capable_get(void)
 {
 #ifdef ECORE_XDPMS
-   return DPMSCapable(_ecore_x_disp);
-#else
-   return 0;
-#endif
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   return DPMSCapable(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE;
+#else /* ifdef ECORE_XDPMS */
+   return EINA_FALSE;
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -61,18 +63,19 @@ ecore_x_dpms_capable_get(void)
  * @return @c 1 if DPMS is enabled, @c 0 otherwise.
  * @ingroup Ecore_X_DPMS_Group
  */
-EAPI int
+EAPI Eina_Bool
 ecore_x_dpms_enabled_get(void)
 {
 #ifdef ECORE_XDPMS
    unsigned char state;
    unsigned short power_lvl;
 
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    DPMSInfo(_ecore_x_disp, &power_lvl, &state);
-   return state;
-#else
-   return 0;
-#endif
+   return state ? EINA_TRUE : EINA_FALSE;
+#else /* ifdef ECORE_XDPMS */
+   return EINA_FALSE;
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -84,11 +87,13 @@ EAPI void
 ecore_x_dpms_enabled_set(int enabled)
 {
 #ifdef ECORE_XDPMS
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    if (enabled)
      DPMSEnable(_ecore_x_disp);
    else
      DPMSDisable(_ecore_x_disp);
-#endif
+
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -99,12 +104,15 @@ ecore_x_dpms_enabled_set(int enabled)
  * @ingroup Ecore_X_DPMS_Group
  */
 EAPI void
-ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned int *off)
+ecore_x_dpms_timeouts_get(unsigned int *standby,
+                          unsigned int *suspend,
+                          unsigned int *off)
 {
 #ifdef ECORE_XDPMS
-   DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby, 
-                  (unsigned short *)suspend, (unsigned short *)off);
-#endif
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby,
+                   (unsigned short *)suspend, (unsigned short *)off);
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -114,14 +122,17 @@ ecore_x_dpms_timeouts_get(unsigned int *standby, unsigned int *suspend, unsigned
  * @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(unsigned int standby, unsigned int suspend, unsigned int off)
+EAPI Eina_Bool
+ecore_x_dpms_timeouts_set(unsigned int standby,
+                          unsigned int suspend,
+                          unsigned int off)
 {
 #ifdef ECORE_XDPMS
-   return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off);
-#else
-   return 0;
-#endif
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+   return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off) ? EINA_TRUE : EINA_FALSE;
+#else /* ifdef ECORE_XDPMS */
+   return EINA_FALSE;
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -130,16 +141,17 @@ ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned i
  * @ingroup Ecore_X_DPMS_Group
  */
 EAPI unsigned int
-ecore_x_dpms_timeout_standby_get()
+ecore_x_dpms_timeout_standby_get(void)
 {
 #ifdef ECORE_XDPMS
    unsigned short standby, suspend, off;
 
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
    return standby;
-#else
+#else /* ifdef ECORE_XDPMS */
    return 0;
-#endif
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -149,16 +161,17 @@ ecore_x_dpms_timeout_standby_get()
  * @ingroup Ecore_X_DPMS_Group
  */
 EAPI unsigned int
-ecore_x_dpms_timeout_suspend_get()
+ecore_x_dpms_timeout_suspend_get(void)
 {
 #ifdef ECORE_XDPMS
    unsigned short standby, suspend, off;
 
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
    return suspend;
-#else
+#else /* ifdef ECORE_XDPMS */
    return 0;
-#endif
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
@@ -168,21 +181,22 @@ ecore_x_dpms_timeout_suspend_get()
  * @ingroup Ecore_X_DPMS_Group
  */
 EAPI unsigned int
-ecore_x_dpms_timeout_off_get()
+ecore_x_dpms_timeout_off_get(void)
 {
 #ifdef ECORE_XDPMS
    unsigned short standby, suspend, off;
 
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
    return off;
-#else
+#else /* ifdef ECORE_XDPMS */
    return 0;
-#endif
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
  * Sets the standby timeout (in unit of seconds).
- * @param new_standby Amount of time of inactivity before standby mode will be invoked.
+ * @param new_timeout Amount of time of inactivity before standby mode will be invoked.
  * @ingroup Ecore_X_DPMS_Group
  */
 EAPI void
@@ -191,14 +205,15 @@ ecore_x_dpms_timeout_standby_set(unsigned int new_timeout)
 #ifdef ECORE_XDPMS
    unsigned short standby, suspend, off;
 
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
    DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off);
-#endif
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
  * Sets the suspend timeout (in unit of seconds).
- * @param suspend Amount of time of inactivity before the screen is placed into suspend mode.
+ * @param new_timeout Amount of time of inactivity before the screen is placed into suspend mode.
  * @ingroup Ecore_X_DPMS_Group
  */
 EAPI void
@@ -207,14 +222,15 @@ ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout)
 #ifdef ECORE_XDPMS
    unsigned short standby, suspend, off;
 
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
    DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off);
-#endif
+#endif /* ifdef ECORE_XDPMS */
 }
 
 /**
  * Sets the off timeout (in unit of seconds).
- * @param off     Amount of time of inactivity before the monitor is shut off.
+ * @param new_timeout     Amount of time of inactivity before the monitor is shut off.
  * @ingroup Ecore_X_DPMS_Group
  */
 EAPI void
@@ -223,7 +239,9 @@ ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
 #ifdef ECORE_XDPMS
    unsigned short standby, suspend, off;
 
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
    DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off);
    DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout);
-#endif
+#endif /* ifdef ECORE_XDPMS */
 }
+