summaryrefslogtreecommitdiff
path: root/src/lib/ecore_x/xcb/ecore_xcb_randr.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2013-05-08 09:53:43 +0100
committerChris Michael <cp.michael@samsung.com>2013-05-08 09:53:43 +0100
commitf5a1889db388d66b1bc621a673d62f3102524981 (patch)
tree3706c218a00edce6e82f1bd885200d8c21b17d29 /src/lib/ecore_x/xcb/ecore_xcb_randr.c
parent291d45f045e3d49ac164af7c6fdc7337ef5028d0 (diff)
Add missing randr_crtc_info_get function to xcb.
Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_x/xcb/ecore_xcb_randr.c')
-rw-r--r--src/lib/ecore_x/xcb/ecore_xcb_randr.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
index f3ae9b5f28..8497da851e 100644
--- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c
+++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c
@@ -1992,6 +1992,91 @@ ecore_x_randr_crtc_size_get(Ecore_X_Window root,
1992#endif 1992#endif
1993} 1993}
1994 1994
1995EAPI Ecore_X_Randr_Crtc_Info *
1996ecore_x_randr_crtc_info_get(Ecore_X_Window root, const Ecore_X_Randr_Crtc crtc)
1997{
1998 Ecore_X_Randr_Crtc_Info *ret = NULL;
1999
2000 LOGFN(__FILE__, __LINE__, __FUNCTION__);
2001 CHECK_XCB_CONN;
2002
2003#ifdef ECORE_XCB_RANDR
2004 RANDR_CHECK_1_2_RET(NULL);
2005
2006 if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return NULL;
2007
2008 if (_randr_version >= RANDR_1_3)
2009 {
2010 xcb_randr_get_screen_resources_current_reply_t *reply;
2011 xcb_timestamp_t stamp = 0;
2012
2013 reply = _ecore_xcb_randr_13_get_resources(root);
2014 if (reply)
2015 {
2016 xcb_randr_get_crtc_info_cookie_t rcookie;
2017 xcb_randr_get_crtc_info_reply_t *rreply;
2018
2019 if (_randr_version >= RANDR_1_3)
2020 stamp = _ecore_xcb_randr_13_get_resource_timestamp(root);
2021 else if (_randr_version == RANDR_1_2)
2022 stamp = _ecore_xcb_randr_12_get_resource_timestamp(root);
2023
2024 rcookie =
2025 xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc,
2026 stamp);
2027
2028 rreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn,
2029 rcookie, NULL);
2030 if (rreply)
2031 {
2032
2033 if ((ret = malloc(sizeof(Ecore_X_Randr_Crtc_Info))))
2034 {
2035 ret->timestamp = rreply->timestamp;
2036 ret->x = rreply->x;
2037 ret->y = rreply->y;
2038 ret->width = rreply->width;
2039 ret->height = rreply->height;
2040 ret->mode = rreply->mode;
2041 ret->rotation = rreply->rotation;
2042 ret->noutput =
2043 xcb_randr_get_crtc_info_outputs_length(rreply);
2044 ret->npossible =
2045 xcb_randr_get_crtc_info_possible_length(rreply);
2046
2047 if ((ret->outputs =
2048 malloc(ret->noutput * sizeof(Ecore_X_Randr_Output))))
2049 {
2050 xcb_randr_output_t *outs;
2051 int i = 0;
2052
2053 outs = xcb_randr_get_crtc_info_outputs(rreply);
2054 for (i = 0; i < ret->noutput; i++)
2055 ret->outputs[i] = outs[i];
2056 }
2057
2058 if ((ret->possible =
2059 malloc(ret->npossible * sizeof(Ecore_X_Randr_Output))))
2060 {
2061 xcb_randr_output_t *outs;
2062 int i = 0;
2063
2064 outs = xcb_randr_get_crtc_info_possible(rreply);
2065 for (i = 0; i < ret->npossible; i++)
2066 ret->possible[i] = outs[i];
2067 }
2068 }
2069 free(rreply);
2070 }
2071
2072 free(reply);
2073 }
2074 }
2075#endif
2076
2077 return ret;
2078}
2079
1995EAPI Ecore_X_Randr_Refresh_Rate 2080EAPI Ecore_X_Randr_Refresh_Rate
1996ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, 2081ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root,
1997 Ecore_X_Randr_Crtc crtc, 2082 Ecore_X_Randr_Crtc crtc,