[gtk/deprecate-render] iconview: Port to the gtk_css_style_snapshot api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/deprecate-render] iconview: Port to the gtk_css_style_snapshot api
- Date: Sat, 8 Oct 2022 17:49:21 +0000 (UTC)
commit d9af8964c4e002c1ee3caa2fe3c86e13c4a26c90
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/gtkiconview.c | 50 ++++++++++++++++++++++++--------------------------
1 file changed, 24 insertions(+), 26 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index adab3adc1d..cbfc715f8d 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/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"
@@ -1622,6 +1624,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);
@@ -1710,11 +1713,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);
}
@@ -2798,6 +2800,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;
@@ -2830,18 +2833,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;
@@ -2863,6 +2862,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);
@@ -2873,14 +2873,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]