mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
textview: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
This commit is contained in:
parent
ee76105119
commit
616e0a0d32
@ -92,6 +92,7 @@
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtktextviewprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -4257,9 +4258,15 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
*/
|
||||
if (line_display->cursors != NULL)
|
||||
{
|
||||
GdkDisplay *display;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
if (cursor_snapshot == NULL)
|
||||
cursor_snapshot = gtk_snapshot_new ();
|
||||
|
||||
display = gtk_widget_get_display (widget);
|
||||
gtk_css_boxes_init (&boxes, widget);
|
||||
|
||||
for (int i = 0; i < line_display->cursors->len; i++)
|
||||
{
|
||||
PangoDirection dir;
|
||||
@ -4271,11 +4278,9 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
if (cursor.is_insert || cursor.is_selection_bound)
|
||||
gtk_snapshot_push_opacity (cursor_snapshot, cursor_alpha);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_snapshot_render_insertion_cursor (cursor_snapshot, context,
|
||||
line_display->x_offset, offset_y + line_display->top_margin,
|
||||
line_display->layout, cursor.pos, dir);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_css_style_snapshot_caret (&boxes, display, cursor_snapshot,
|
||||
line_display->x_offset, offset_y + line_display->top_margin,
|
||||
line_display->layout, cursor.pos, dir);
|
||||
|
||||
if (cursor.is_insert || cursor.is_selection_bound)
|
||||
gtk_snapshot_pop (cursor_snapshot);
|
||||
|
@ -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);
|
||||
|
@ -59,7 +59,9 @@
|
||||
#include "gtkjoinedmenuprivate.h"
|
||||
#include "gtkcsslineheightvalueprivate.h"
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -5847,6 +5849,7 @@ draw_text (GtkWidget *widget,
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
GtkStyleContext *context;
|
||||
gboolean did_save = FALSE;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
if (priv->border_window_size.left || priv->border_window_size.top)
|
||||
{
|
||||
@ -5865,16 +5868,13 @@ draw_text (GtkWidget *widget,
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save_to_node (context, text_view->priv->text_window->css_node);
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_snapshot_render_background (snapshot, context,
|
||||
-priv->xoffset, -priv->yoffset - priv->top_margin,
|
||||
MAX (SCREEN_WIDTH (text_view), priv->width),
|
||||
MAX (SCREEN_HEIGHT (text_view), priv->height));
|
||||
gtk_snapshot_render_frame (snapshot, context,
|
||||
-priv->xoffset, -priv->yoffset - priv->top_margin,
|
||||
MAX (SCREEN_WIDTH (text_view), priv->width),
|
||||
MAX (SCREEN_HEIGHT (text_view), priv->height));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
-priv->xoffset, -priv->yoffset - priv->top_margin,
|
||||
MAX (SCREEN_WIDTH (text_view), priv->width),
|
||||
MAX (SCREEN_HEIGHT (text_view), priv->height));
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
if (GTK_TEXT_VIEW_GET_CLASS (text_view)->snapshot_layer != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user