From d9792a777788d45ff4f20a42ac937e66504ac63f Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Thu, 29 Nov 2012 06:59:29 +0000 Subject: [PATCH] improve randr rotate snapping calculations SVN revision: 79815 --- src/modules/conf_randr/e_smart_monitor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/modules/conf_randr/e_smart_monitor.c b/src/modules/conf_randr/e_smart_monitor.c index e7108a295..a0f81b18d 100644 --- a/src/modules/conf_randr/e_smart_monitor.c +++ b/src/modules/conf_randr/e_smart_monitor.c @@ -1549,8 +1549,7 @@ _e_smart_monitor_resolution_get(E_Smart_Data *sd, Evas_Coord width, Evas_Coord h static Ecore_X_Randr_Orientation _e_smart_monitor_orientation_get(int rotation) { - if (rotation < 0) rotation += 360; - else if (rotation > 360) rotation -= 360; + rotation %= 360; /* find the closest rotation of rotation within 'fuzziness' tolerance */ if (((rotation - ROTATE_SNAP_FUZZINESS) <= 0) || @@ -1565,8 +1564,8 @@ _e_smart_monitor_orientation_get(int rotation) else if (((rotation - ROTATE_SNAP_FUZZINESS) <= 270) || ((rotation + ROTATE_SNAP_FUZZINESS) <= 270)) return ECORE_X_RANDR_ORIENTATION_ROT_270; - else if (((rotation - ROTATE_SNAP_FUZZINESS) <= 360) || - ((rotation + ROTATE_SNAP_FUZZINESS) <= 360)) + else if (((rotation - ROTATE_SNAP_FUZZINESS) < 360) || + ((rotation + ROTATE_SNAP_FUZZINESS) < 360)) return ECORE_X_RANDR_ORIENTATION_ROT_0; return -1;