[gtk/deprecate-render: 31/54] iconview: Port to the gtk_css_style_snapshot api




commit 7cae0295944fedffa336a2038df069c4cea4ba01
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Oct 8 13:40:41 2022 -0400

    iconview: Port to the gtk_css_style_snapshot api
    
    The gtk_snapshot_render api is deprecated, so avoid using it.

 gtk/deprecated/gtkiconview.c | 50 +++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 26 deletions(-)
---
diff --git a/gtk/deprecated/gtkiconview.c b/gtk/deprecated/gtkiconview.c
index 6fc5ff41f5..d2ab36a524 100644
--- a/gtk/deprecated/gtkiconview.c
+++ b/gtk/deprecated/gtkiconview.c
@@ -34,7 +34,9 @@
 #include "gtkprivate.h"
 #include "gtkscrollable.h"
 #include "gtksizerequest.h"
-#include "deprecated/gtkrender.h"
+#include "gtkrenderbackgroundprivate.h"
+#include "gtkrenderborderprivate.h"
+#include "gtksnapshot.h"
 #include "gtkstylecontextprivate.h"
 #include "gtktreednd.h"
 #include "gtktypebuiltins.h"
@@ -1624,6 +1626,7 @@ gtk_icon_view_snapshot (GtkWidget   *widget,
   GtkStyleContext *context;
   int width, height;
   double offset_x, offset_y;
+  GtkCssBoxes boxes;
 
   icon_view = GTK_ICON_VIEW (widget);
 
@@ -1712,11 +1715,10 @@ gtk_icon_view_snapshot (GtkWidget   *widget,
       gtk_style_context_save_to_node (context, icon_view->priv->dndnode);
       gtk_style_context_set_state (context, gtk_style_context_get_state (context) | 
GTK_STATE_FLAG_DROP_ACTIVE);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-      gtk_snapshot_render_frame (snapshot, context,
-                                 rect.x, rect.y,
-                                 rect.width, rect.height);
-G_GNUC_END_IGNORE_DEPRECATIONS
+      gtk_css_boxes_init_border_box (&boxes,
+                                     gtk_style_context_lookup_style (context),
+                                     rect.x, rect.y, rect.width, rect.height);
+      gtk_css_style_snapshot_border (&boxes, snapshot);
 
       gtk_style_context_restore (context);
     }
@@ -2804,6 +2806,7 @@ gtk_icon_view_snapshot_item (GtkIconView     *icon_view,
   GtkWidget *widget = GTK_WIDGET (icon_view);
   GtkIconViewPrivate *priv = icon_view->priv;
   GtkCellAreaContext *context;
+  GtkCssBoxes boxes;
 
   if (priv->model == NULL || item->cell_area.width <= 0 || item->cell_area.height <= 0)
     return;
@@ -2836,18 +2839,14 @@ gtk_icon_view_snapshot_item (GtkIconView     *icon_view,
 
   gtk_style_context_set_state (style_context, state);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_snapshot_render_background (snapshot, style_context,
-                                  x - priv->item_padding,
-                                  y - priv->item_padding,
-                                  item->cell_area.width  + priv->item_padding * 2,
-                                  item->cell_area.height + priv->item_padding * 2);
-  gtk_snapshot_render_frame (snapshot, style_context,
-                             x - priv->item_padding,
-                             y - priv->item_padding,
-                             item->cell_area.width  + priv->item_padding * 2,
-                             item->cell_area.height + priv->item_padding * 2);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_css_boxes_init_border_box (&boxes,
+                                 gtk_style_context_lookup_style (style_context),
+                                 x - priv->item_padding,
+                                 y - priv->item_padding,
+                                 item->cell_area.width  + priv->item_padding * 2,
+                                 item->cell_area.height + priv->item_padding * 2);
+  gtk_css_style_snapshot_background (&boxes, snapshot);
+  gtk_css_style_snapshot_border (&boxes, snapshot);
 
   cell_area.x      = x;
   cell_area.y      = y;
@@ -2869,6 +2868,7 @@ gtk_icon_view_snapshot_rubberband (GtkIconView *icon_view,
   GtkIconViewPrivate *priv = icon_view->priv;
   GtkStyleContext *context;
   GdkRectangle rect;
+  GtkCssBoxes boxes;
 
   rect.x = MIN (priv->rubberband_x1, priv->rubberband_x2);
   rect.y = MIN (priv->rubberband_y1, priv->rubberband_y2);
@@ -2879,14 +2879,12 @@ gtk_icon_view_snapshot_rubberband (GtkIconView *icon_view,
 
   gtk_style_context_save_to_node (context, priv->rubberband_node);
 
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-  gtk_snapshot_render_background (snapshot, context,
-                                  rect.x, rect.y,
-                                  rect.width, rect.height);
-  gtk_snapshot_render_frame (snapshot, context,
-                             rect.x, rect.y,
-                             rect.width, rect.height);
-G_GNUC_END_IGNORE_DEPRECATIONS
+  gtk_css_boxes_init_border_box (&boxes,
+                                 gtk_style_context_lookup_style (context),
+                                 rect.x, rect.y,
+                                 rect.width, rect.height);
+  gtk_css_style_snapshot_background (&boxes, snapshot);
+  gtk_css_style_snapshot_border (&boxes, snapshot);
 
   gtk_style_context_restore (context);
 }


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