diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-10-08 16:57:23 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-10-12 15:35:00 -0400 |
commit | 616e0a0d323875eba7e91cc56db1e7ae3cf23180 (patch) | |
tree | 6ef07ad2ce6a21d77dd3320d6f61e61b074b5e77 /gtk/gtktextutil.c | |
parent | ee761051197095706e6eed72f1d68fcc7d8b5420 (diff) | |
download | gtk+-616e0a0d323875eba7e91cc56db1e7ae3cf23180.tar.gz |
textview: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
Diffstat (limited to 'gtk/gtktextutil.c')
-rw-r--r-- | gtk/gtktextutil.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c index e847e5dcba..010bf6988f 100644 --- a/gtk/gtktextutil.c +++ b/gtk/gtktextutil.c @@ -34,7 +34,7 @@ #include "gtkwidgetprivate.h" #include "gtkcssstyleprivate.h" #include "gtkcsscolorvalueprivate.h" -#include "deprecated/gtkrender.h" +#include "gtkrenderbackgroundprivate.h" #define DRAG_ICON_MAX_WIDTH 250 #define DRAG_ICON_MAX_HEIGHT 250 @@ -141,18 +141,21 @@ gtk_text_util_create_drag_icon (GtkWidget *widget, !gdk_display_is_composited (display)) { GtkWidget *bg_widget; + GtkCssBoxes boxes; if (GTK_IS_TEXT (widget)) bg_widget = gtk_widget_get_parent (widget); else bg_widget = widget; + pango_layout_get_size (layout, &layout_width, &layout_height); -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_snapshot_render_background (snapshot, - gtk_widget_get_style_context (bg_widget), - 0, 0, layout_width / PANGO_SCALE, - layout_height / PANGO_SCALE); -G_GNUC_END_IGNORE_DEPRECATIONS + + gtk_css_boxes_init_border_box (&boxes, + gtk_style_context_lookup_style (gtk_widget_get_style_context (bg_widget)), + 0, 0, + layout_width / PANGO_SCALE, + layout_height / PANGO_SCALE); + gtk_css_style_snapshot_background (&boxes, snapshot); } gtk_snapshot_append_layout (snapshot, layout, color); @@ -277,11 +280,12 @@ gtk_text_util_create_rich_drag_icon (GtkWidget *widget, if (!gdk_display_is_rgba (display) || !gdk_display_is_composited (display)) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_snapshot_render_background (snapshot, - gtk_widget_get_style_context (widget), - 0, 0, layout_width, layout_height); -G_GNUC_END_IGNORE_DEPRECATIONS + GtkCssBoxes boxes; + + gtk_css_boxes_init_border_box (&boxes, + gtk_style_context_lookup_style (gtk_widget_get_style_context (widget)), + 0, 0, layout_width, layout_height); + gtk_css_style_snapshot_background (&boxes, snapshot); } gtk_text_layout_snapshot (layout, widget, snapshot, &(GdkRectangle) { 0, 0, layout_width, layout_height }, 1.0); |