forked from enlightenment/efl
Ecore DPMS Function to get the current dpms power level
This commit is contained in:
parent
fdbc477f79
commit
67df5b4ad1
|
@ -398,6 +398,14 @@ typedef enum _Ecore_X_Error_Code
|
|||
ECORE_X_ERROR_CODE_BAD_IMPLEMENTATION = 17,
|
||||
} Ecore_X_Error_Code;
|
||||
|
||||
typedef enum _Ecore_X_Dpms_Mode
|
||||
{
|
||||
ECORE_X_DPMS_MODE_ON = 0,
|
||||
ECORE_X_DPMS_MODE_STANDBY = 1,
|
||||
ECORE_X_DPMS_MODE_SUSPEND = 2,
|
||||
ECORE_X_DPMS_MODE_OFF = 3
|
||||
} Ecore_X_Dpms_Mode;
|
||||
|
||||
typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In;
|
||||
typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out;
|
||||
typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In;
|
||||
|
@ -2371,6 +2379,7 @@ EAPI Eina_Bool ecore_x_dpms_query(void);
|
|||
EAPI Eina_Bool ecore_x_dpms_capable_get(void);
|
||||
EAPI Eina_Bool ecore_x_dpms_enabled_get(void);
|
||||
EAPI void ecore_x_dpms_enabled_set(int enabled);
|
||||
EAPI Ecore_X_Dpms_Mode ecore_x_dpms_power_level_get(void);
|
||||
EAPI void ecore_x_dpms_timeouts_get(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);
|
||||
EAPI unsigned int ecore_x_dpms_timeout_standby_get(void);
|
||||
|
|
|
@ -319,3 +319,36 @@ ecore_x_dpms_timeout_off_set(unsigned int new_timeout)
|
|||
ecore_x_dpms_timeouts_set(standby, suspend, new_timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the DPMS power level.
|
||||
* @return @c 0 if DPMS is :In Use
|
||||
* @return @c 1 if DPMS is :Blanked, low power
|
||||
* @return @c 2 if DPMS is :Blanked, lower power
|
||||
* @return @c 3 if DPMS is :Shut off, awaiting activity
|
||||
* @return @c -1 otherwise.
|
||||
*/
|
||||
EAPI Ecore_X_Dpms_Mode
|
||||
ecore_x_dpms_power_level_get(void)
|
||||
{
|
||||
Ecore_X_Dpms_Mode ret = -1;
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
xcb_dpms_info_cookie_t cookie;
|
||||
xcb_dpms_info_reply_t *reply;
|
||||
#endif
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
CHECK_XCB_CONN;
|
||||
|
||||
if (!_dpms_avail) return ret;
|
||||
|
||||
#ifdef ECORE_XCB_DPMS
|
||||
cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn);
|
||||
reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL);
|
||||
if (!reply) return -1;
|
||||
|
||||
ret = reply->power_level;
|
||||
free(reply);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,30 @@ ecore_x_dpms_enabled_get(void)
|
|||
#endif /* ifdef ECORE_XDPMS */
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the DPMS power level.
|
||||
* @return @c 0 if DPMS is :In Use
|
||||
* @return @c 1 if DPMS is :Blanked, low power
|
||||
* @return @c 2 if DPMS is :Blanked, lower power
|
||||
* @return @c 3 if DPMS is :Shut off, awaiting activity
|
||||
* @return @c -1 othwhise.
|
||||
*/
|
||||
|
||||
EAPI Ecore_X_Dpms_Mode
|
||||
ecore_x_dpms_power_level_get(void)
|
||||
{
|
||||
#ifdef ECORE_XDPMS
|
||||
unsigned char state;
|
||||
unsigned short power_lvl;
|
||||
|
||||
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
||||
DPMSInfo(_ecore_x_disp, &power_lvl, &state);
|
||||
return (int)power_lvl;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the DPMS state of the display.
|
||||
* @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise.
|
||||
|
|
Loading…
Reference in New Issue