[gnome-control-center] Fix dragging rotated monitors



commit 189a24c280678c8b56ec6d3ee154ba93a7567918
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Mar 18 16:37:22 2011 +0100

    Fix dragging rotated monitors
    
    Need to take rotation into account when handling the snapping.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641345

 panels/display/xrandr-capplet.c |   28 +++++++++++++++++++---------
 1 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/panels/display/xrandr-capplet.c b/panels/display/xrandr-capplet.c
index 0a3e9a4..b4ce00d 100644
--- a/panels/display/xrandr-capplet.c
+++ b/panels/display/xrandr-capplet.c
@@ -1035,10 +1035,23 @@ on_clone_changed (GtkWidget *box, gpointer data)
 }
 
 static void
-get_geometry (GnomeRROutputInfo *output, int *w, int *h)
+apply_rotation_to_geometry (GnomeRROutputInfo *output, int *w, int *h)
 {
   GnomeRRRotation rotation;
 
+  rotation = gnome_rr_output_info_get_rotation (output);
+  if ((rotation & GNOME_RR_ROTATION_90) || (rotation & GNOME_RR_ROTATION_270))
+    {
+      int tmp;
+      tmp = *h;
+      *h = *w;
+      *w = tmp;
+    }
+}
+
+static void
+get_geometry (GnomeRROutputInfo *output, int *w, int *h)
+{
   if (gnome_rr_output_info_is_active (output))
     {
       gnome_rr_output_info_get_geometry (output, NULL, NULL, w, h);
@@ -1049,14 +1062,7 @@ get_geometry (GnomeRROutputInfo *output, int *w, int *h)
       *w = gnome_rr_output_info_get_preferred_width (output);
     }
 
-  rotation = gnome_rr_output_info_get_rotation (output);
-  if ((rotation & GNOME_RR_ROTATION_90) || (rotation & GNOME_RR_ROTATION_270))
-    {
-      int tmp;
-      tmp = *h;
-      *h = *w;
-      *w = tmp;
-    }
+  apply_rotation_to_geometry (output, w, h);
 }
 
 #define SPACE 15
@@ -1165,6 +1171,8 @@ list_edges_for_output (GnomeRROutputInfo *output, GArray *edges)
 
   gnome_rr_output_info_get_geometry (output, &x, &y, &w, &h);
 
+  apply_rotation_to_geometry (output, &w, &h);
+
   /* Top, Bottom, Left, Right */
   add_edge (output, x, y, x + w, y, edges);
   add_edge (output, x, y + h, x + w, y + h, edges);
@@ -1362,6 +1370,8 @@ static void
 get_output_rect (GnomeRROutputInfo *output, GdkRectangle *rect)
 {
   gnome_rr_output_info_get_geometry (output, &rect->x, &rect->y, &rect->width, &rect->height);
+
+  apply_rotation_to_geometry (output, &rect->width, &rect->height);
 }
 
 static gboolean



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