From ed84b96078f3f1f43cf8885bac10f65caf196305 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 19 Feb 2013 10:58:13 +0000 Subject: [PATCH] Add code to check EFL version. If we are using a newer version, then we can use the new ecore_x_randr_crtc_info_get() function which will save us a lot of X round-trips. Signed-off-by: Christopher Michael SVN revision: 84180 --- src/modules/conf_randr/e_smart_monitor.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/modules/conf_randr/e_smart_monitor.c b/src/modules/conf_randr/e_smart_monitor.c index 03fbb475f..c3b585848 100644 --- a/src/modules/conf_randr/e_smart_monitor.c +++ b/src/modules/conf_randr/e_smart_monitor.c @@ -195,6 +195,29 @@ e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord c /* get the root window */ root = ecore_x_window_root_first_get(); + /* check ecore_x_randr version */ +#if ((ECORE_VERSION_MAJOR >= 1) && (ECORE_VERSION_MINOR >= 8)) + Ecore_X_Randr_Crtc_Info *crtc_info = NULL; + + if ((crtc_info = ecore_x_randr_crtc_info_get(root, crtc))) + { + /* get current orientation */ + sd->crtc.orient = crtc_info->rotation; + + /* get possible orientations for this crtc */ + orients = crtc_info->rotations; + + /* check if orientation is possible and disable if not */ + if (orients <= ECORE_X_RANDR_ORIENTATION_ROT_0) + edje_object_signal_emit(sd->o_frame, "e,state,rotate,disabled", "e"); + + /* get current mode */ + sd->crtc.mode = crtc_info->mode; + + /* free any memory allocated from ecore_x_randr */ + free(crtc_info); + } +#else /* get current orientation */ sd->crtc.orient = ecore_x_randr_crtc_orientation_get(root, crtc); @@ -207,6 +230,7 @@ e_smart_monitor_crtc_set(Evas_Object *obj, Ecore_X_Randr_Crtc crtc, Evas_Coord c /* get current mode */ sd->crtc.mode = ecore_x_randr_crtc_mode_get(root, crtc); +#endif /* check crtc current mode to determine if enabled */ if (sd->crtc.mode != 0)