[gnome-control-center] Fix dragging of rotate monitors



commit 579e1f8690e4659645e5d6cd500b04b7302b681f
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 20 17:15:38 2009 -0400

    Fix dragging of rotate monitors
    
    We were using the rotated geometry for drawing, but the unrotated
    geometry for snapping. Reported in bug 578109.

 capplets/display/xrandr-capplet.c |   31 ++++++++-----------------------
 1 files changed, 8 insertions(+), 23 deletions(-)
---
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index 3f4add2..f21857c 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -896,6 +896,13 @@ get_geometry (GnomeOutputInfo *output, int *w, int *h)
 	*h = output->pref_height;
 	*w = output->pref_width;
     }
+   if ((output->rotation & GNOME_RR_ROTATION_90) || (output->rotation & GNOME_RR_ROTATION_270))
+   {
+        int tmp;
+        tmp = *h;
+        *h = *w;
+        *w = tmp;
+   }
 }
 
 #define SPACE 15
@@ -1502,7 +1509,6 @@ paint_output (App *app, cairo_t *cr, int i)
     PangoLayout *layout = get_display_name (app, output);
     PangoRectangle ink_extent, log_extent;
     GdkRectangle viewport;
-    double angle;
     GdkColor output_color;
     double r, g, b;
     double available_w;
@@ -1539,28 +1545,7 @@ paint_output (App *app, cairo_t *cr, int i)
 		     x + (w * scale + 0.5) / 2,
 		     y + (h * scale + 0.5) / 2);
 
-    if (output->rotation & GNOME_RR_ROTATION_0)
-    {
-	angle = 0;
-    }
-    else if (output->rotation & GNOME_RR_ROTATION_90)
-    {
-	angle = 1.5 * G_PI;
-    }
-    else if (output->rotation & GNOME_RR_ROTATION_180)
-    {
-	angle = G_PI;
-    }
-    else if (output->rotation & GNOME_RR_ROTATION_270)
-    {
-	angle = G_PI / 2;
-    }
-    else
-    {
-	angle = 0;
-    }
-
-    cairo_rotate (cr, angle);
+    /* rotation is already applied in get_geometry */
 
     if (output->rotation & GNOME_RR_REFLECT_X)
 	cairo_scale (cr, -1, 1);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]