From: devilhorns Date: Fri, 15 Jul 2011 13:13:38 +0000 (+0000) Subject: Ecore_X: Add a few more missing randr functions to xcb. X-Git-Tag: 2.0_alpha~180^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7e26c28a0cb6eb304f8e3abd5a58c6705a5dcca5;p=framework%2Fuifw%2Fecore.git Ecore_X: Add a few more missing randr functions to xcb. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@61399 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/src/lib/ecore_x/xcb/ecore_xcb_randr.c index 7279e1b..014a774 100644 --- a/src/lib/ecore_x/xcb/ecore_xcb_randr.c +++ b/src/lib/ecore_x/xcb/ecore_xcb_randr.c @@ -1,12 +1,6 @@ /* TODO: List of missing functions * - * ecore_x_randr_crtc_orientations_get - * ecore_x_randr_crtc_orientation_set * ecore_x_randr_crtc_clone_set - * ecore_x_randr_crtc_gamma_ramp_size_get - * ecore_x_randr_crtc_gamma_ramps_get - * ecore_x_randr_crtc_gamma_ramps_set - * ecore_x_randr_mode_size_get * ecore_x_randr_output_size_mm_get * ecore_x_randr_output_crtc_set * ecore_x_randr_edid_valid_header @@ -841,6 +835,49 @@ ecore_x_randr_modes_info_get(Ecore_X_Window root, int *num) } /** + * @brief gets the width and hight of a given mode + * @param mode the mode which's size is to be looked up + * @param w width of given mode in px + * @param h height of given mode in px + */ +EAPI void +ecore_x_randr_mode_size_get(Ecore_X_Window root, Ecore_X_Randr_Mode mode, int *w, int *h) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_resources_cookie_t cookie; + xcb_randr_get_screen_resources_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RANDR + if (mode == Ecore_X_Randr_None) return; + cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_resources_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + xcb_randr_mode_info_iterator_t miter; + + miter = xcb_randr_get_screen_resources_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + if (minfo->id == mode) + { + if (w) *w = minfo->width; + if (h) *h = minfo->height; + break; + } + xcb_randr_mode_info_next(&miter); + } + free(reply); + } +#endif +} + +/** * @brief gets the EDID information of an attached output if available. * Note that this information is not to be compared using ordinary string * comparison functions, since it includes 0-bytes. @@ -1347,6 +1384,64 @@ ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) return ret; } +EAPI Eina_Bool +ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc, Ecore_X_Randr_Orientation orientation) +{ + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RANDR + if (orientation != Ecore_X_Randr_None) + { + ret = + ecore_x_randr_crtc_settings_set(root, crtc, NULL, + Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, + orientation); + } +#endif + return ret; +} + +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, Ecore_X_Randr_Crtc crtc) +{ + Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_resources_cookie_t cookie; + xcb_randr_get_screen_resources_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RANDR + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; + + cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_resources_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, + reply->config_timestamp); + oreply = + xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + ret = oreply->rotations; + free(oreply); + } + free(reply); + } +#endif + + return ret; +} + /* * @brief get a CRTC's possible outputs. * @param root the root window which's screen will be queried