colorplane: Use content size everywhere
authorTimm Bäder <mail@baedert.org>
Fri, 3 Nov 2017 09:40:43 +0000 (10:40 +0100)
committerTimm Bäder <mail@baedert.org>
Fri, 3 Nov 2017 09:47:02 +0000 (10:47 +0100)
gtk/gtkcolorplane.c

index 898760de5abd0de3e7aaeeabd033ea8577e6c164..7b1e8b11abe5c23bc3b2d902502e043100059b3f 100644 (file)
@@ -56,8 +56,8 @@ sv_to_xy (GtkColorPlane *plane,
   gdouble s, v;
   gint width, height;
 
-  width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
-  height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
+  width = gtk_widget_get_width (GTK_WIDGET (plane));
+  height = gtk_widget_get_height (GTK_WIDGET (plane));
 
   s = gtk_adjustment_get_value (plane->priv->s_adj);
   v = gtk_adjustment_get_value (plane->priv->v_adj);
@@ -76,8 +76,8 @@ plane_snapshot (GtkWidget   *widget,
   cairo_t *cr;
 
   sv_to_xy (plane, &x, &y);
-  width = gtk_widget_get_allocated_width (widget);
-  height = gtk_widget_get_allocated_height (widget);
+  width = gtk_widget_get_width (widget);
+  height = gtk_widget_get_height (widget);
 
   cr = gtk_snapshot_append_cairo (snapshot,
                                   &GRAPHENE_RECT_INIT (0, 0, width, height),
@@ -130,8 +130,8 @@ create_surface (GtkColorPlane *plane)
   if (!gtk_widget_get_realized (widget))
     return;
 
-  width = gtk_widget_get_allocated_width (widget);
-  height = gtk_widget_get_allocated_height (widget);
+  width = gtk_widget_get_width (widget);
+  height = gtk_widget_get_height (widget);
 
   surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
                                                CAIRO_CONTENT_COLOR,
@@ -252,8 +252,8 @@ update_color (GtkColorPlane *plane,
   GtkWidget *widget = GTK_WIDGET (plane);
   gdouble s, v;
 
-  s = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
-  v = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1);
+  s = CLAMP (1 - y * (1.0 / gtk_widget_get_height (widget)), 0, 1);
+  v = CLAMP (x * (1.0 / gtk_widget_get_width (widget)), 0, 1);
   gtk_adjustment_set_value (plane->priv->s_adj, s);
   gtk_adjustment_set_value (plane->priv->v_adj, v);