forked from AuroraMiddleware/gtk
textview: Stop using gtk_style_context_save_to_node
This commit is contained in:
parent
a71893f88b
commit
e09138ce45
@ -81,7 +81,6 @@
|
|||||||
|
|
||||||
#include "gtkcsscolorvalueprivate.h"
|
#include "gtkcsscolorvalueprivate.h"
|
||||||
#include "gtkmarshalers.h"
|
#include "gtkmarshalers.h"
|
||||||
#include "gtkstylecontextprivate.h"
|
|
||||||
#include "gtktextbtreeprivate.h"
|
#include "gtktextbtreeprivate.h"
|
||||||
#include "gtktextbufferprivate.h"
|
#include "gtktextbufferprivate.h"
|
||||||
#include "gtktextiterprivate.h"
|
#include "gtktextiterprivate.h"
|
||||||
@ -4029,7 +4028,7 @@ render_para (GskPangoRenderer *crenderer,
|
|||||||
(line_display->insert_index < byte_offset + pango_layout_line_get_length (line) ||
|
(line_display->insert_index < byte_offset + pango_layout_line_get_length (line) ||
|
||||||
(at_last_line && line_display->insert_index == byte_offset + pango_layout_line_get_length (line))))
|
(at_last_line && line_display->insert_index == byte_offset + pango_layout_line_get_length (line))))
|
||||||
{
|
{
|
||||||
GtkStyleContext *context;
|
GtkCssStyle *style;
|
||||||
GdkRGBA cursor_color;
|
GdkRGBA cursor_color;
|
||||||
graphene_rect_t bounds = {
|
graphene_rect_t bounds = {
|
||||||
.origin.x = line_display->x_offset + line_display->block_cursor.x,
|
.origin.x = line_display->x_offset + line_display->block_cursor.x,
|
||||||
@ -4041,8 +4040,8 @@ render_para (GskPangoRenderer *crenderer,
|
|||||||
/* we draw text using base color on filled cursor rectangle
|
/* we draw text using base color on filled cursor rectangle
|
||||||
* of cursor color (normally white on black)
|
* of cursor color (normally white on black)
|
||||||
*/
|
*/
|
||||||
context = _gtk_widget_get_style_context (crenderer->widget);
|
style = gtk_css_node_get_style (gtk_widget_get_css_node (crenderer->widget));
|
||||||
_gtk_style_context_get_cursor_color (context, &cursor_color, NULL);
|
cursor_color = *gtk_css_color_value_get_rgba (style->font->caret_color ? style->font->caret_color : style->core->color);
|
||||||
|
|
||||||
gtk_snapshot_push_opacity (crenderer->snapshot, cursor_alpha);
|
gtk_snapshot_push_opacity (crenderer->snapshot, cursor_alpha);
|
||||||
gtk_snapshot_append_color (crenderer->snapshot, &cursor_color, &bounds);
|
gtk_snapshot_append_color (crenderer->snapshot, &cursor_color, &bounds);
|
||||||
@ -4093,7 +4092,6 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
|||||||
{
|
{
|
||||||
GtkTextLayoutPrivate *priv;
|
GtkTextLayoutPrivate *priv;
|
||||||
GskPangoRenderer *crenderer;
|
GskPangoRenderer *crenderer;
|
||||||
GtkStyleContext *context;
|
|
||||||
int offset_y;
|
int offset_y;
|
||||||
GtkTextIter selection_start, selection_end;
|
GtkTextIter selection_start, selection_end;
|
||||||
int selection_start_line;
|
int selection_start_line;
|
||||||
@ -4106,6 +4104,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
|||||||
GtkTextBTree *btree;
|
GtkTextBTree *btree;
|
||||||
GtkTextLine *first_line;
|
GtkTextLine *first_line;
|
||||||
GtkTextLine *last_line;
|
GtkTextLine *last_line;
|
||||||
|
GtkCssStyle *style;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
|
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
|
||||||
g_return_if_fail (layout->default_style != NULL);
|
g_return_if_fail (layout->default_style != NULL);
|
||||||
@ -4127,8 +4126,8 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
|||||||
if (last_line == NULL)
|
if (last_line == NULL)
|
||||||
last_line = _gtk_text_btree_get_end_iter_line (btree);
|
last_line = _gtk_text_btree_get_end_iter_line (btree);
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||||
gtk_style_context_get_color (context, &color);
|
color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||||
|
|
||||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, offset_y));
|
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, offset_y));
|
||||||
offset_y = 0;
|
offset_y = 0;
|
||||||
@ -4155,14 +4154,12 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
|||||||
selection_end_line = gtk_text_iter_get_line (&selection_end);
|
selection_end_line = gtk_text_iter_get_line (&selection_end);
|
||||||
|
|
||||||
selection_node = gtk_text_view_get_selection_node ((GtkTextView*)widget);
|
selection_node = gtk_text_view_get_selection_node ((GtkTextView*)widget);
|
||||||
gtk_style_context_save_to_node (context, selection_node);
|
style = gtk_css_node_get_style (selection_node);
|
||||||
|
|
||||||
selection = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
|
selection = gtk_css_color_value_get_rgba (style->background->background_color);
|
||||||
|
text_color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||||
|
|
||||||
gtk_style_context_get_color (context, &text_color);
|
|
||||||
draw_selection_text = text_color.alpha > 0;
|
draw_selection_text = text_color.alpha > 0;
|
||||||
|
|
||||||
gtk_style_context_restore (context);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -150,8 +150,8 @@ gtk_text_util_create_drag_icon (GtkWidget *widget,
|
|||||||
|
|
||||||
pango_layout_get_size (layout, &layout_width, &layout_height);
|
pango_layout_get_size (layout, &layout_width, &layout_height);
|
||||||
|
|
||||||
gtk_css_boxes_init_border_box (&boxes,
|
style = gtk_css_node_get_style (gtk_widget_get_css_node (bg_widget));
|
||||||
gtk_style_context_lookup_style (gtk_widget_get_style_context (bg_widget)),
|
gtk_css_boxes_init_border_box (&boxes, style,
|
||||||
0, 0,
|
0, 0,
|
||||||
layout_width / PANGO_SCALE,
|
layout_width / PANGO_SCALE,
|
||||||
layout_height / PANGO_SCALE);
|
layout_height / PANGO_SCALE);
|
||||||
@ -281,9 +281,10 @@ gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
|
|||||||
!gdk_display_is_composited (display))
|
!gdk_display_is_composited (display))
|
||||||
{
|
{
|
||||||
GtkCssBoxes boxes;
|
GtkCssBoxes boxes;
|
||||||
|
GtkCssStyle *css_style;
|
||||||
|
|
||||||
gtk_css_boxes_init_border_box (&boxes,
|
css_style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||||
gtk_style_context_lookup_style (gtk_widget_get_style_context (widget)),
|
gtk_css_boxes_init_border_box (&boxes, css_style,
|
||||||
0, 0, layout_width, layout_height);
|
0, 0, layout_width, layout_height);
|
||||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,6 @@
|
|||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtktextviewchildprivate.h"
|
#include "gtktextviewchildprivate.h"
|
||||||
#include "gtktexthandleprivate.h"
|
#include "gtktexthandleprivate.h"
|
||||||
#include "gtkstylecontextprivate.h"
|
|
||||||
#include "gtkpopover.h"
|
#include "gtkpopover.h"
|
||||||
#include "gtkmagnifierprivate.h"
|
#include "gtkmagnifierprivate.h"
|
||||||
#include "gtkemojichooser.h"
|
#include "gtkemojichooser.h"
|
||||||
@ -5847,7 +5846,7 @@ draw_text (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||||
GtkTextViewPrivate *priv = text_view->priv;
|
GtkTextViewPrivate *priv = text_view->priv;
|
||||||
GtkStyleContext *context;
|
GtkCssStyle *style;
|
||||||
gboolean did_save = FALSE;
|
gboolean did_save = FALSE;
|
||||||
GtkCssBoxes boxes;
|
GtkCssBoxes boxes;
|
||||||
|
|
||||||
@ -5866,16 +5865,13 @@ draw_text (GtkWidget *widget,
|
|||||||
SCREEN_WIDTH (widget),
|
SCREEN_WIDTH (widget),
|
||||||
SCREEN_HEIGHT (widget)));
|
SCREEN_HEIGHT (widget)));
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (widget);
|
style = gtk_css_node_get_style (text_view->priv->text_window->css_node);
|
||||||
gtk_style_context_save_to_node (context, text_view->priv->text_window->css_node);
|
gtk_css_boxes_init_border_box (&boxes, style,
|
||||||
gtk_css_boxes_init_border_box (&boxes,
|
|
||||||
gtk_style_context_lookup_style (context),
|
|
||||||
-priv->xoffset, -priv->yoffset - priv->top_margin,
|
-priv->xoffset, -priv->yoffset - priv->top_margin,
|
||||||
MAX (SCREEN_WIDTH (text_view), priv->width),
|
MAX (SCREEN_WIDTH (text_view), priv->width),
|
||||||
MAX (SCREEN_HEIGHT (text_view), priv->height));
|
MAX (SCREEN_HEIGHT (text_view), priv->height));
|
||||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||||
gtk_css_style_snapshot_border (&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)
|
if (GTK_TEXT_VIEW_GET_CLASS (text_view)->snapshot_layer != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user