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



commit db3cc2c816307b851758a8b1129155f2513f5a0e
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]