[gtk+/wip/baedert/gtkimageview: 62/118] GtkImageView: Use w/2, h/2 anchor point in _set_angle



commit 9cc7c484f962e1da854fe344e021f877c63f1ccb
Author: Timm Bäder <mail baedert org>
Date:   Mon Jan 25 17:21:19 2016 +0100

    GtkImageView: Use w/2, h/2 anchor point in _set_angle

 gtk/gtkimageview.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkimageview.c b/gtk/gtkimageview.c
index aad31dc..99b72ac 100644
--- a/gtk/gtkimageview.c
+++ b/gtk/gtkimageview.c
@@ -1215,16 +1215,16 @@ gtk_image_view_set_angle (GtkImageView *image_view,
   if (!priv->image_surface)
     return;
 
-  // XXX Pass a width/2, height/2 anchor here.
-  //
   // TODO: Would we have to document this behavior? Or make it configurable?
-
-
   if (priv->hadjustment && priv->vadjustment && !priv->fit_allocation)
-    gtk_image_view_fix_anchor (image_view,
-                               priv->anchor_x,
-                               priv->anchor_y,
-                               &state);
+    {
+      int pointer_x = gtk_widget_get_allocated_width (GTK_WIDGET (image_view)) / 2;
+      int pointer_y = gtk_widget_get_allocated_height (GTK_WIDGET (image_view)) / 2;
+      gtk_image_view_fix_anchor (image_view,
+                                 pointer_x,
+                                 pointer_y,
+                                 &state);
+    }
 
   if (priv->fit_allocation)
     gtk_widget_queue_draw (GTK_WIDGET (image_view));


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