Enlightenment CVS committal Author : devilhorns Project : e17 Module : libs/ecore
Dir : e17/libs/ecore/src/lib/ecore_x Modified Files: ecore_x_dpms.c Log Message: Fix up ecore_x_dpms...formatting, removed the static int's for dpms version as they are not used anywhere other than the init function. Added traps for dpms_available before calling any dpms functions. =================================================================== RCS file: /cvs/e/e17/libs/ecore/src/lib/ecore_x/ecore_x_dpms.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- ecore_x_dpms.c 9 Mar 2007 01:11:09 -0000 1.2 +++ ecore_x_dpms.c 13 Mar 2007 09:30:17 -0000 1.3 @@ -4,17 +4,14 @@ #include "ecore_x_private.h" - static int _dpms_available; -#ifdef ECORE_XDPMS -static int _dpms_major, _dpms_minor; -#endif - void _ecore_x_dpms_init(void) { #ifdef ECORE_XDPMS + int _dpms_major, _dpms_minor; + _dpms_major = 1; _dpms_minor = 0; @@ -27,15 +24,12 @@ #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. @@ -55,10 +49,10 @@ EAPI int ecore_x_dpms_capable_get(void) { + if (!_dpms_available) return 0; return DPMSCapable(_ecore_x_disp); } - /** * Checks the DPMS state of the display. * @return @c 1 if DPMS is enabled, @c 0 otherwise. @@ -70,11 +64,11 @@ unsigned char state; unsigned short power_lvl; + if (!_dpms_available) return 0; DPMSInfo(_ecore_x_disp, &power_lvl, &state); return state; } - /** * Sets the DPMS state of the display. * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise. @@ -83,13 +77,13 @@ EAPI void ecore_x_dpms_enabled_set(int enabled) { + if (!_dpms_available) return; if (enabled) - DPMSEnable(_ecore_x_disp); + DPMSEnable(_ecore_x_disp); else - DPMSDisable(_ecore_x_disp); + DPMSDisable(_ecore_x_disp); } - /** * Gets the timeouts. The values are in unit of seconds. * @param standby Amount of time of inactivity before standby mode will be invoked. @@ -100,10 +94,11 @@ 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); + if (!_dpms_available) return; + 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. @@ -114,13 +109,10 @@ EAPI int ecore_x_dpms_timeouts_set(unsigned int standby, unsigned int suspend, unsigned int off) { - return DPMSSetTimeouts(_ecore_x_disp, - standby, - suspend, - off); + if (!_dpms_available) return 0; + return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off); } - /** * Returns the amount of time of inactivity before standby mode is invoked. * @return The standby timeout value. @@ -131,11 +123,11 @@ { unsigned short standby, suspend, off; + if (!_dpms_available) return 0; DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); return standby; } - /** * Returns the amount of time of inactivity before the second level of * power saving is invoked. @@ -147,11 +139,11 @@ { unsigned short standby, suspend, off; + if (!_dpms_available) return 0; DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); return suspend; } - /** * Returns the amount of time of inactivity before the third and final * level of power saving is invoked. @@ -163,11 +155,11 @@ { unsigned short standby, suspend, off; + if (!_dpms_available) return 0; DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); return off; } - /** * Sets the standby timeout (in unit of seconds). * @param new_standby Amount of time of inactivity before standby mode will be invoked. @@ -178,14 +170,11 @@ { unsigned short standby, suspend, off; + if (!_dpms_available) return; DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - DPMSSetTimeouts(_ecore_x_disp, - new_timeout, - suspend, - off); + DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off); } - /** * Sets the suspend timeout (in unit of seconds). * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. @@ -196,14 +185,11 @@ { unsigned short standby, suspend, off; + if (!_dpms_available) return; DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - DPMSSetTimeouts(_ecore_x_disp, - standby, - new_timeout, - off); + DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off); } - /** * Sets the off timeout (in unit of seconds). * @param off Amount of time of inactivity before the monitor is shut off. @@ -214,9 +200,7 @@ { unsigned short standby, suspend, off; + if (!_dpms_available) return; DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); - DPMSSetTimeouts(_ecore_x_disp, - standby, - suspend, - new_timeout); + DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout); } ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs