mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 20:00:09 +00:00
Merge branch 'deprecate-render' into 'main'
wip: Deprecate gtk_render apis See merge request GNOME/gtk!5100
This commit is contained in:
commit
ed87473bf9
@ -6,6 +6,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@ -5,6 +5,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
show_parsing_error (GtkCssProvider *provider,
|
||||
GtkCssSection *section,
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CanvasItem, canvas_item, CANVAS, ITEM, GtkWidget)
|
||||
|
||||
struct _CanvasItem {
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "gtkshadertoy.h"
|
||||
#include "gskshaderpaintable.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *demo_window = NULL;
|
||||
|
||||
static void
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "script-names.h"
|
||||
#include "unicode-names.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
#define UCD_TYPE_ITEM (ucd_item_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (UcdItem, ucd_item, UCD, ITEM, GObject)
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* Create an object for the pegs that get moved around in the game.
|
||||
*
|
||||
* We implement the GdkPaintable interface for them, so we can use GtkPicture
|
||||
|
@ -348,7 +348,7 @@
|
||||
#include "deprecated/gtkcellareacontext.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtknative.h"
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
#include "gtkstylecontext.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "deprecated/gtktreeprivate.h"
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkrendericonprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "deprecated/gtktreeprivate.h"
|
||||
|
@ -34,6 +34,8 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtktreednd.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,9 +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);
|
||||
|
||||
gtk_snapshot_render_frame (snapshot, context,
|
||||
rect.x, rect.y,
|
||||
rect.width, rect.height);
|
||||
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);
|
||||
}
|
||||
@ -2802,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;
|
||||
@ -2834,16 +2839,14 @@ gtk_icon_view_snapshot_item (GtkIconView *icon_view,
|
||||
|
||||
gtk_style_context_set_state (style_context, state);
|
||||
|
||||
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);
|
||||
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;
|
||||
@ -2865,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);
|
||||
@ -2875,12 +2879,12 @@ gtk_icon_view_snapshot_rubberband (GtkIconView *icon_view,
|
||||
|
||||
gtk_style_context_save_to_node (context, priv->rubberband_node);
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
@ -28,11 +28,17 @@
|
||||
#include "gtkcssshadowvalueprivate.h"
|
||||
#include "gtkcsstransformvalueprivate.h"
|
||||
#include "gtkrendericonprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtksettings.h"
|
||||
|
||||
#include "gsk/gskroundedrectprivate.h"
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
gtk_do_render_icon (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
@ -76,6 +82,8 @@ gtk_do_render_icon (GtkStyleContext *context,
|
||||
* Typical checkmark rendering:
|
||||
*
|
||||
* ![](checks.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_check (GtkStyleContext *context,
|
||||
@ -110,6 +118,8 @@ gtk_render_check (GtkStyleContext *context,
|
||||
* Typical option mark rendering:
|
||||
*
|
||||
* ![](options.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_option (GtkStyleContext *context,
|
||||
@ -142,6 +152,8 @@ gtk_render_option (GtkStyleContext *context,
|
||||
* Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π:
|
||||
*
|
||||
* ![](arrows.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_arrow (GtkStyleContext *context,
|
||||
@ -175,6 +187,8 @@ gtk_render_arrow (GtkStyleContext *context,
|
||||
* `background-image`, `border-width` and `border-radius`:
|
||||
*
|
||||
* ![](background.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_background (GtkStyleContext *context,
|
||||
@ -221,6 +235,8 @@ gtk_render_background (GtkStyleContext *context,
|
||||
* `border-color`, `border-width`, `border-radius` and junctions:
|
||||
*
|
||||
* ![](frames.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_frame (GtkStyleContext *context,
|
||||
@ -268,6 +284,8 @@ gtk_render_frame (GtkStyleContext *context,
|
||||
* Typical expander rendering:
|
||||
*
|
||||
* ![](expanders.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_expander (GtkStyleContext *context,
|
||||
@ -300,6 +318,8 @@ gtk_render_expander (GtkStyleContext *context,
|
||||
* Typical focus rendering:
|
||||
*
|
||||
* ![](focus.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_focus (GtkStyleContext *context,
|
||||
@ -340,6 +360,8 @@ gtk_render_focus (GtkStyleContext *context,
|
||||
* @layout: the `PangoLayout` to render
|
||||
*
|
||||
* Renders @layout on the coordinates @x, @y
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_layout (GtkStyleContext *context,
|
||||
@ -378,6 +400,8 @@ gtk_render_layout (GtkStyleContext *context,
|
||||
* @y1: Y coordinate for the end of the line
|
||||
*
|
||||
* Renders a line from (x0, y0) to (x1, y1).
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_line (GtkStyleContext *context,
|
||||
@ -423,6 +447,8 @@ gtk_render_line (GtkStyleContext *context,
|
||||
* Handles rendered for the paned and grip classes:
|
||||
*
|
||||
* ![](handles.png)
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_handle (GtkStyleContext *context,
|
||||
@ -456,6 +482,8 @@ gtk_render_handle (GtkStyleContext *context,
|
||||
* Renders an activity indicator (such as in `GtkSpinner`).
|
||||
* The state %GTK_STATE_FLAG_CHECKED determines whether there is
|
||||
* activity going on.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_activity (GtkStyleContext *context,
|
||||
@ -488,6 +516,7 @@ gtk_render_activity (GtkStyleContext *context,
|
||||
* regardless of scaling factors, which may not be appropriate when
|
||||
* drawing on displays with high pixel densities.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
**/
|
||||
void
|
||||
gtk_render_icon (GtkStyleContext *context,
|
||||
@ -514,3 +543,178 @@ gtk_render_icon (GtkStyleContext *context,
|
||||
gsk_render_node_draw (node, cr);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_background:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the background
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @width: rectangle width
|
||||
* @height: rectangle height
|
||||
*
|
||||
* Creates a render node for the CSS background according to @context,
|
||||
* and appends it to the current node of @snapshot, without changing
|
||||
* the current node.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_background (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, width, height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_frame:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the frame
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @width: rectangle width
|
||||
* @height: rectangle height
|
||||
*
|
||||
* Creates a render node for the CSS border according to @context,
|
||||
* and appends it to the current node of @snapshot, without changing
|
||||
* the current node.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_frame (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, width, height);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_focus:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the focus ring
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @width: rectangle width
|
||||
* @height: rectangle height
|
||||
*
|
||||
* Creates a render node for the focus outline according to @context,
|
||||
* and appends it to the current node of @snapshot, without changing
|
||||
* the current node.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_focus (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, width, height);
|
||||
gtk_css_style_snapshot_outline (&boxes, snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_layout:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the text
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @layout: the `PangoLayout` to render
|
||||
*
|
||||
* Creates a render node for rendering @layout according to the style
|
||||
* information in @context, and appends it to the current node of @snapshot,
|
||||
* without changing the current node.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_layout (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, 0, 0);
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, x, y, layout);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_insertion_cursor:
|
||||
* @snapshot: snapshot to render to
|
||||
* @context: a `GtkStyleContext`
|
||||
* @x: X origin
|
||||
* @y: Y origin
|
||||
* @layout: the `PangoLayout` of the text
|
||||
* @index: the index in the `PangoLayout`
|
||||
* @direction: the `PangoDirection` of the text
|
||||
*
|
||||
* Draws a text caret using @snapshot at the specified index of @layout.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
GdkDisplay *display;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||
g_return_if_fail (index >= 0);
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, 0, 0);
|
||||
|
||||
display = gtk_style_context_get_display (context);
|
||||
gtk_css_style_snapshot_caret (&boxes, display, snapshot, x, y, layout, index, direction);
|
||||
}
|
@ -28,31 +28,32 @@
|
||||
|
||||
#include <gtk/gtkenums.h>
|
||||
#include <gtk/gtktypes.h>
|
||||
#include <gtk/gtksnapshot.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_check (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_option (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_arrow (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double angle,
|
||||
double x,
|
||||
double y,
|
||||
double size);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_background (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
@ -60,60 +61,97 @@ void gtk_render_background (GtkStyleContext *context,
|
||||
double width,
|
||||
double height);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_frame (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_expander (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_focus (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_layout (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_line (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x0,
|
||||
double y0,
|
||||
double x1,
|
||||
double y1);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_handle (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_activity (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_render_icon (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
GdkTexture *texture,
|
||||
double x,
|
||||
double y);
|
||||
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_snapshot_render_background (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_snapshot_render_frame (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_snapshot_render_focus (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_snapshot_render_layout (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout);
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RENDER_H__ */
|
@ -28,7 +28,7 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -220,7 +220,9 @@ gtk_style_context_impl_set_property (GObject *object,
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DISPLAY:
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_set_display (context, g_value_get_object (value));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@ -341,6 +343,8 @@ gtk_style_context_new_for_node (GtkCssNode *node)
|
||||
* Note: If both priorities are the same, a `GtkStyleProvider`
|
||||
* added through this function takes precedence over another added
|
||||
* through [func@Gtk.StyleContext.add_provider_for_display].
|
||||
*
|
||||
* Deprecated: 4.10: Use style classes instead
|
||||
*/
|
||||
void
|
||||
gtk_style_context_add_provider (GtkStyleContext *context,
|
||||
@ -376,6 +380,8 @@ gtk_style_context_add_provider (GtkStyleContext *context,
|
||||
* @provider: a `GtkStyleProvider`
|
||||
*
|
||||
* Removes @provider from the style providers list in @context.
|
||||
*
|
||||
* Deprecated: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_style_context_remove_provider (GtkStyleContext *context,
|
||||
@ -392,68 +398,14 @@ gtk_style_context_remove_provider (GtkStyleContext *context,
|
||||
_gtk_style_cascade_remove_provider (priv->cascade, provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_add_provider_for_display:
|
||||
* @display: a `GdkDisplay`
|
||||
* @provider: a `GtkStyleProvider`
|
||||
* @priority: the priority of the style provider. The lower
|
||||
* it is, the earlier it will be used in the style construction.
|
||||
* Typically this will be in the range between
|
||||
* %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and
|
||||
* %GTK_STYLE_PROVIDER_PRIORITY_USER
|
||||
*
|
||||
* Adds a global style provider to @display, which will be used
|
||||
* in style construction for all `GtkStyleContexts` under @display.
|
||||
*
|
||||
* GTK uses this to make styling information from `GtkSettings`
|
||||
* available.
|
||||
*
|
||||
* Note: If both priorities are the same, A `GtkStyleProvider`
|
||||
* added through [method@Gtk.StyleContext.add_provider] takes
|
||||
* precedence over another added through this function.
|
||||
**/
|
||||
void
|
||||
gtk_style_context_add_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider,
|
||||
guint priority)
|
||||
{
|
||||
GtkStyleCascade *cascade;
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
||||
g_return_if_fail (!GTK_IS_SETTINGS (provider) || _gtk_settings_get_display (GTK_SETTINGS (provider)) == display);
|
||||
|
||||
cascade = _gtk_settings_get_style_cascade (gtk_settings_get_for_display (display), 1);
|
||||
_gtk_style_cascade_add_provider (cascade, provider, priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_remove_provider_for_display:
|
||||
* @display: a `GdkDisplay`
|
||||
* @provider: a `GtkStyleProvider`
|
||||
*
|
||||
* Removes @provider from the global style providers list in @display.
|
||||
*/
|
||||
void
|
||||
gtk_style_context_remove_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider)
|
||||
{
|
||||
GtkStyleCascade *cascade;
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
||||
g_return_if_fail (!GTK_IS_SETTINGS (provider));
|
||||
|
||||
cascade = _gtk_settings_get_style_cascade (gtk_settings_get_for_display (display), 1);
|
||||
_gtk_style_cascade_remove_provider (cascade, provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_set_state:
|
||||
* @context: a `GtkStyleContext`
|
||||
* @flags: state to represent
|
||||
*
|
||||
* Sets the state to be used for style matching.
|
||||
*
|
||||
* Deprecated: 4.10: You should not use this api
|
||||
*/
|
||||
void
|
||||
gtk_style_context_set_state (GtkStyleContext *context,
|
||||
@ -479,6 +431,8 @@ gtk_style_context_set_state (GtkStyleContext *context,
|
||||
* [method@Gtk.Widget.get_state_flags].
|
||||
*
|
||||
* Returns: the state flags
|
||||
*
|
||||
* Deprecated: 4.10: Use [method@Gtk.Widget.get_state_flags] instead
|
||||
**/
|
||||
GtkStateFlags
|
||||
gtk_style_context_get_state (GtkStyleContext *context)
|
||||
@ -496,6 +450,8 @@ gtk_style_context_get_state (GtkStyleContext *context)
|
||||
* @scale: scale
|
||||
*
|
||||
* Sets the scale to use when getting image assets for the style.
|
||||
*
|
||||
* Deprecated: 4.10: You should not use this api
|
||||
**/
|
||||
void
|
||||
gtk_style_context_set_scale (GtkStyleContext *context,
|
||||
@ -529,6 +485,8 @@ gtk_style_context_set_scale (GtkStyleContext *context,
|
||||
* Returns the scale used for assets.
|
||||
*
|
||||
* Returns: the scale
|
||||
*
|
||||
* Deprecated 4.10: Use [method@Gtk.Widget.get_scale_factor] instead
|
||||
**/
|
||||
int
|
||||
gtk_style_context_get_scale (GtkStyleContext *context)
|
||||
@ -586,6 +544,8 @@ gtk_style_context_save_to_node (GtkStyleContext *context,
|
||||
*
|
||||
* The matching call to [method@Gtk.StyleContext.restore]
|
||||
* must be done before GTK returns to the main loop.
|
||||
*
|
||||
* Deprecated: 4.10: This API will be removed in GTK 5
|
||||
**/
|
||||
void
|
||||
gtk_style_context_save (GtkStyleContext *context)
|
||||
@ -616,6 +576,8 @@ gtk_style_context_save (GtkStyleContext *context)
|
||||
* Restores @context state to a previous stage.
|
||||
*
|
||||
* See [method@Gtk.StyleContext.save].
|
||||
*
|
||||
* Deprecated: 4.10: This API will be removed in GTK 5
|
||||
**/
|
||||
void
|
||||
gtk_style_context_restore (GtkStyleContext *context)
|
||||
@ -653,6 +615,7 @@ gtk_style_context_restore (GtkStyleContext *context)
|
||||
* ```css
|
||||
* .search { ... }
|
||||
* ```
|
||||
* Deprecated: 4.10: Use [method@Gtk.Widget.add_css_class] instead
|
||||
*/
|
||||
void
|
||||
gtk_style_context_add_class (GtkStyleContext *context,
|
||||
@ -675,6 +638,8 @@ gtk_style_context_add_class (GtkStyleContext *context,
|
||||
* @class_name: class name to remove
|
||||
*
|
||||
* Removes @class_name from @context.
|
||||
*
|
||||
* Deprecated: 4.10: Use [method@Gtk.Widget.remove_css_class] instead
|
||||
*/
|
||||
void
|
||||
gtk_style_context_remove_class (GtkStyleContext *context,
|
||||
@ -702,6 +667,8 @@ gtk_style_context_remove_class (GtkStyleContext *context,
|
||||
* given class name.
|
||||
*
|
||||
* Returns: %TRUE if @context has @class_name defined
|
||||
*
|
||||
* Deprecated: 4.10: Use [method@Gtk.Widget.has_css_class] instead
|
||||
**/
|
||||
gboolean
|
||||
gtk_style_context_has_class (GtkStyleContext *context,
|
||||
@ -742,6 +709,8 @@ _gtk_style_context_peek_property (GtkStyleContext *context,
|
||||
* If you are using a `GtkStyleContext` returned from
|
||||
* [method@Gtk.Widget.get_style_context], you do not need to
|
||||
* call this yourself.
|
||||
*
|
||||
* Deprecated: 4.10: You should not use this api
|
||||
*/
|
||||
void
|
||||
gtk_style_context_set_display (GtkStyleContext *context,
|
||||
@ -780,6 +749,8 @@ gtk_style_context_set_display (GtkStyleContext *context,
|
||||
* Returns the `GdkDisplay` to which @context is attached.
|
||||
*
|
||||
* Returns: (transfer none): a `GdkDisplay`.
|
||||
*
|
||||
* Deprecated: 4.10: Use [method@Gtk.Widget.get_display] instead
|
||||
*/
|
||||
GdkDisplay *
|
||||
gtk_style_context_get_display (GtkStyleContext *context)
|
||||
@ -824,6 +795,8 @@ gtk_style_context_resolve_color (GtkStyleContext *context,
|
||||
* Looks up and resolves a color name in the @context color map.
|
||||
*
|
||||
* Returns: %TRUE if @color_name was found and resolved, %FALSE otherwise
|
||||
*
|
||||
* Deprecated: 4.10: This api will be removed in GTK 5
|
||||
*/
|
||||
gboolean
|
||||
gtk_style_context_lookup_color (GtkStyleContext *context,
|
||||
@ -850,6 +823,8 @@ gtk_style_context_lookup_color (GtkStyleContext *context,
|
||||
* @color: (out): return value for the foreground color
|
||||
*
|
||||
* Gets the foreground color for a given state.
|
||||
*
|
||||
* Deprecated: 4.10: Use [method@Gtk.Widget.get_style_color] instead
|
||||
*/
|
||||
void
|
||||
gtk_style_context_get_color (GtkStyleContext *context,
|
||||
@ -867,6 +842,8 @@ gtk_style_context_get_color (GtkStyleContext *context,
|
||||
* @border: (out): return value for the border settings
|
||||
*
|
||||
* Gets the border for a given state as a `GtkBorder`.
|
||||
*
|
||||
* Deprecated: 4.10: This api will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_style_context_get_border (GtkStyleContext *context,
|
||||
@ -891,6 +868,8 @@ gtk_style_context_get_border (GtkStyleContext *context,
|
||||
* @padding: (out): return value for the padding settings
|
||||
*
|
||||
* Gets the padding for a given state as a `GtkBorder`.
|
||||
*
|
||||
* Deprecated: 4.10: This api will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_style_context_get_padding (GtkStyleContext *context,
|
||||
@ -915,6 +894,8 @@ gtk_style_context_get_padding (GtkStyleContext *context,
|
||||
* @margin: (out): return value for the margin settings
|
||||
*
|
||||
* Gets the margin for a given state as a `GtkBorder`.
|
||||
*
|
||||
* Deprecated: 4.10: This api will be removed in GTK 5
|
||||
*/
|
||||
void
|
||||
gtk_style_context_get_margin (GtkStyleContext *context,
|
||||
@ -949,271 +930,6 @@ _gtk_style_context_get_cursor_color (GtkStyleContext *context,
|
||||
*secondary_color = *gtk_css_color_value_get_rgba (style->font->secondary_caret_color ? style->font->secondary_caret_color : style->core->color);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_insertion_cursor (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height,
|
||||
double aspect_ratio,
|
||||
gboolean is_primary,
|
||||
PangoDirection direction,
|
||||
gboolean draw_arrow)
|
||||
{
|
||||
GdkRGBA primary_color;
|
||||
GdkRGBA secondary_color;
|
||||
int stem_width;
|
||||
double angle;
|
||||
double dx, dy;
|
||||
double xx1, yy1, xx2, yy2;
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
|
||||
_gtk_style_context_get_cursor_color (context, &primary_color, &secondary_color);
|
||||
gdk_cairo_set_source_rgba (cr, is_primary ? &primary_color : &secondary_color);
|
||||
|
||||
stem_width = height * aspect_ratio + 1;
|
||||
|
||||
yy1 = y;
|
||||
yy2 = y + height;
|
||||
|
||||
if (width < 0)
|
||||
{
|
||||
xx1 = x;
|
||||
xx2 = x - width;
|
||||
}
|
||||
else
|
||||
{
|
||||
xx1 = x + width;
|
||||
xx2 = x;
|
||||
}
|
||||
|
||||
angle = atan2 (height, width);
|
||||
|
||||
dx = (stem_width/2.0) * cos (M_PI/2 - angle);
|
||||
dy = (stem_width/2.0) * sin (M_PI/2 - angle);
|
||||
|
||||
if (draw_arrow)
|
||||
{
|
||||
if (direction == PANGO_DIRECTION_RTL)
|
||||
{
|
||||
double x0, y0, x1, y1, x2, y2;
|
||||
|
||||
x0 = xx2 - dx + 2 * dy;
|
||||
y0 = yy2 - dy - 2 * dx;
|
||||
|
||||
x1 = x0 + 4 * dy;
|
||||
y1 = y0 - 4 * dx;
|
||||
x2 = x0 + 2 * dy - 3 * dx;
|
||||
y2 = y0 - 2 * dx - 3 * dy;
|
||||
|
||||
cairo_move_to (cr, xx1 + dx, yy1 + dy);
|
||||
cairo_line_to (cr, xx2 + dx, yy2 + dy);
|
||||
cairo_line_to (cr, x2, y2);
|
||||
cairo_line_to (cr, x1, y1);
|
||||
cairo_line_to (cr, xx1 - dx, yy1 - dy);
|
||||
}
|
||||
else if (direction == PANGO_DIRECTION_LTR)
|
||||
{
|
||||
double x0, y0, x1, y1, x2, y2;
|
||||
|
||||
x0 = xx2 + dx + 2 * dy;
|
||||
y0 = yy2 + dy - 2 * dx;
|
||||
|
||||
x1 = x0 + 4 * dy;
|
||||
y1 = y0 - 4 * dx;
|
||||
x2 = x0 + 2 * dy + 3 * dx;
|
||||
y2 = y0 - 2 * dx + 3 * dy;
|
||||
|
||||
cairo_move_to (cr, xx1 - dx, yy1 - dy);
|
||||
cairo_line_to (cr, xx2 - dx, yy2 - dy);
|
||||
cairo_line_to (cr, x2, y2);
|
||||
cairo_line_to (cr, x1, y1);
|
||||
cairo_line_to (cr, xx1 + dx, yy1 + dy);
|
||||
}
|
||||
else
|
||||
g_assert_not_reached();
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_move_to (cr, xx1 + dx, yy1 + dy);
|
||||
cairo_line_to (cr, xx2 + dx, yy2 + dy);
|
||||
cairo_line_to (cr, xx2 - dx, yy2 - dy);
|
||||
cairo_line_to (cr, xx1 - dx, yy1 - dy);
|
||||
}
|
||||
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
get_insertion_cursor_bounds (double width,
|
||||
double height,
|
||||
double aspect_ratio,
|
||||
PangoDirection direction,
|
||||
gboolean draw_arrow,
|
||||
graphene_rect_t *bounds)
|
||||
{
|
||||
int stem_width;
|
||||
|
||||
if (width < 0)
|
||||
width = - width;
|
||||
|
||||
stem_width = height * aspect_ratio + 1;
|
||||
|
||||
graphene_rect_init (bounds,
|
||||
- 2 * stem_width, - stem_width,
|
||||
width + 4 * stem_width, height + 2 * stem_width);
|
||||
}
|
||||
|
||||
static void
|
||||
snapshot_insertion_cursor (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double width,
|
||||
double height,
|
||||
double aspect_ratio,
|
||||
gboolean is_primary,
|
||||
PangoDirection direction,
|
||||
gboolean draw_arrow)
|
||||
{
|
||||
if (width != 0 || draw_arrow)
|
||||
{
|
||||
cairo_t *cr;
|
||||
graphene_rect_t bounds;
|
||||
|
||||
get_insertion_cursor_bounds (width, height, aspect_ratio, direction, draw_arrow, &bounds);
|
||||
cr = gtk_snapshot_append_cairo (snapshot, &bounds);
|
||||
|
||||
draw_insertion_cursor (context, cr, 0, 0, width, height, aspect_ratio, is_primary, direction, draw_arrow);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
else
|
||||
{
|
||||
GdkRGBA primary_color;
|
||||
GdkRGBA secondary_color;
|
||||
int stem_width;
|
||||
int offset;
|
||||
|
||||
_gtk_style_context_get_cursor_color (context, &primary_color, &secondary_color);
|
||||
|
||||
stem_width = height * aspect_ratio + 1;
|
||||
|
||||
/* put (stem_width % 2) on the proper side of the cursor */
|
||||
if (direction == PANGO_DIRECTION_LTR)
|
||||
offset = stem_width / 2;
|
||||
else
|
||||
offset = stem_width - stem_width / 2;
|
||||
|
||||
gtk_snapshot_append_color (snapshot,
|
||||
is_primary ? &primary_color : &secondary_color,
|
||||
&GRAPHENE_RECT_INIT (- offset, 0, stem_width, height));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_insertion_cursor:
|
||||
* @snapshot: snapshot to render to
|
||||
* @context: a `GtkStyleContext`
|
||||
* @x: X origin
|
||||
* @y: Y origin
|
||||
* @layout: the `PangoLayout` of the text
|
||||
* @index: the index in the `PangoLayout`
|
||||
* @direction: the `PangoDirection` of the text
|
||||
*
|
||||
* Draws a text caret using @snapshot at the specified index of @layout.
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction)
|
||||
{
|
||||
GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
|
||||
gboolean split_cursor;
|
||||
double aspect_ratio;
|
||||
PangoRectangle strong_pos, weak_pos;
|
||||
PangoRectangle *cursor1, *cursor2;
|
||||
GdkSeat *seat;
|
||||
PangoDirection keyboard_direction;
|
||||
PangoDirection direction2;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||
g_return_if_fail (index >= 0);
|
||||
|
||||
g_object_get (gtk_settings_get_for_display (priv->display),
|
||||
"gtk-split-cursor", &split_cursor,
|
||||
"gtk-cursor-aspect-ratio", &aspect_ratio,
|
||||
NULL);
|
||||
|
||||
keyboard_direction = PANGO_DIRECTION_LTR;
|
||||
seat = gdk_display_get_default_seat (priv->display);
|
||||
if (seat)
|
||||
{
|
||||
GdkDevice *keyboard = gdk_seat_get_keyboard (seat);
|
||||
|
||||
if (keyboard)
|
||||
keyboard_direction = gdk_device_get_direction (keyboard);
|
||||
}
|
||||
|
||||
pango_layout_get_caret_pos (layout, index, &strong_pos, &weak_pos);
|
||||
|
||||
direction2 = PANGO_DIRECTION_NEUTRAL;
|
||||
|
||||
if (split_cursor)
|
||||
{
|
||||
cursor1 = &strong_pos;
|
||||
|
||||
if (strong_pos.x != weak_pos.x || strong_pos.y != weak_pos.y)
|
||||
{
|
||||
direction2 = (direction == PANGO_DIRECTION_LTR) ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR;
|
||||
cursor2 = &weak_pos;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keyboard_direction == direction)
|
||||
cursor1 = &strong_pos;
|
||||
else
|
||||
cursor1 = &weak_pos;
|
||||
}
|
||||
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x + PANGO_PIXELS (MIN (cursor1->x, cursor1->x + cursor1->width)), y + PANGO_PIXELS (cursor1->y)));
|
||||
snapshot_insertion_cursor (snapshot,
|
||||
context,
|
||||
PANGO_PIXELS (cursor1->width),
|
||||
PANGO_PIXELS (cursor1->height),
|
||||
aspect_ratio,
|
||||
TRUE,
|
||||
direction,
|
||||
direction2 != PANGO_DIRECTION_NEUTRAL);
|
||||
gtk_snapshot_restore (snapshot);
|
||||
|
||||
if (direction2 != PANGO_DIRECTION_NEUTRAL)
|
||||
{
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x + PANGO_PIXELS (MIN (cursor2->x, cursor2->x + cursor2->width)), y + PANGO_PIXELS (cursor2->y)));
|
||||
snapshot_insertion_cursor (snapshot,
|
||||
context,
|
||||
PANGO_PIXELS (cursor2->width),
|
||||
PANGO_PIXELS (cursor2->height),
|
||||
aspect_ratio,
|
||||
FALSE,
|
||||
direction2,
|
||||
TRUE);
|
||||
gtk_snapshot_restore (snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GtkStyleContextPrintFlags:
|
||||
* @GTK_STYLE_CONTEXT_PRINT_NONE: Default value.
|
||||
@ -1246,6 +962,8 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
|
||||
* the format of the returned string, it may change.
|
||||
*
|
||||
* Returns: a newly allocated string representing @context
|
||||
*
|
||||
* Deprecated: 4.10: This api will be removed in GTK 5
|
||||
*/
|
||||
char *
|
||||
gtk_style_context_to_string (GtkStyleContext *context,
|
||||
@ -1258,7 +976,7 @@ gtk_style_context_to_string (GtkStyleContext *context,
|
||||
|
||||
string = g_string_new ("");
|
||||
|
||||
gtk_css_node_print (priv->cssnode, flags, string, 0);
|
||||
gtk_css_node_print (priv->cssnode, (GtkCssNodePrintFlags)flags, string, 0);
|
||||
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
@ -61,72 +61,64 @@ struct _GtkStyleContextClass
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_style_context_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_add_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider,
|
||||
guint priority);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_remove_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_add_provider (GtkStyleContext *context,
|
||||
GtkStyleProvider *provider,
|
||||
guint priority);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_remove_provider (GtkStyleContext *context,
|
||||
GtkStyleProvider *provider);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_save (GtkStyleContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_restore (GtkStyleContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_set_state (GtkStyleContext *context,
|
||||
GtkStateFlags flags);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
GtkStateFlags gtk_style_context_get_state (GtkStyleContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_set_scale (GtkStyleContext *context,
|
||||
int scale);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
int gtk_style_context_get_scale (GtkStyleContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_add_class (GtkStyleContext *context,
|
||||
const char *class_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_remove_class (GtkStyleContext *context,
|
||||
const char *class_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
gboolean gtk_style_context_has_class (GtkStyleContext *context,
|
||||
const char *class_name);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_set_display (GtkStyleContext *context,
|
||||
GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
GdkDisplay *gtk_style_context_get_display (GtkStyleContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
gboolean gtk_style_context_lookup_color (GtkStyleContext *context,
|
||||
const char *color_name,
|
||||
GdkRGBA *color);
|
||||
|
||||
/* Some helper functions to retrieve most common properties */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_get_color (GtkStyleContext *context,
|
||||
GdkRGBA *color);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_get_border (GtkStyleContext *context,
|
||||
GtkBorder *border);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_get_padding (GtkStyleContext *context,
|
||||
GtkBorder *padding);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
void gtk_style_context_get_margin (GtkStyleContext *context,
|
||||
GtkBorder *margin);
|
||||
|
||||
@ -137,7 +129,7 @@ typedef enum {
|
||||
GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE = 1 << 2
|
||||
} GtkStyleContextPrintFlags;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
char * gtk_style_context_to_string (GtkStyleContext *context,
|
||||
GtkStyleContextPrintFlags flags);
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include "gtkscrollable.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtkshortcutcontroller.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtktooltip.h"
|
||||
#include "gtktreednd.h"
|
||||
|
@ -24,6 +24,8 @@ gtk_deprecated_sources = [
|
||||
'deprecated/gtkentrycompletion.c',
|
||||
'deprecated/gtkiconview.c',
|
||||
'deprecated/gtkliststore.c',
|
||||
'deprecated/gtkrender.c',
|
||||
'deprecated/gtkstylecontext.c',
|
||||
'deprecated/gtktreedatalist.c',
|
||||
'deprecated/gtktreednd.c',
|
||||
'deprecated/gtktreemodel.c',
|
||||
@ -63,6 +65,8 @@ gtk_deprecated_headers = [
|
||||
'deprecated/gtkentrycompletion.h',
|
||||
'deprecated/gtkiconview.h',
|
||||
'deprecated/gtkliststore.h',
|
||||
'deprecated/gtkrender.h',
|
||||
'deprecated/gtkstylecontext.h',
|
||||
'deprecated/gtktreednd.h',
|
||||
'deprecated/gtktreemodel.h',
|
||||
'deprecated/gtktreemodelfilter.h',
|
||||
|
@ -205,7 +205,7 @@
|
||||
#include <gtk/gtkprogressbar.h>
|
||||
#include <gtk/gtkrange.h>
|
||||
#include <gtk/gtkrecentmanager.h>
|
||||
#include <gtk/gtkrender.h>
|
||||
#include <gtk/deprecated/gtkrender.h>
|
||||
#include <gtk/gtkrevealer.h>
|
||||
#include <gtk/gtkroot.h>
|
||||
#include <gtk/gtkscale.h>
|
||||
@ -247,7 +247,7 @@
|
||||
#include <gtk/gtkstringfilter.h>
|
||||
#include <gtk/gtkstringlist.h>
|
||||
#include <gtk/gtkstringsorter.h>
|
||||
#include <gtk/gtkstylecontext.h>
|
||||
#include <gtk/deprecated/gtkstylecontext.h>
|
||||
#include <gtk/gtkstyleprovider.h>
|
||||
#include <gtk/gtkswitch.h>
|
||||
#include <gtk/gtksymbolicpaintable.h>
|
||||
|
@ -57,7 +57,9 @@
|
||||
#include "gtkeventcontrollermotion.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
#include "gtkgestureclick.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkcssnodeprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -197,6 +199,9 @@ struct _GtkAboutDialog
|
||||
|
||||
GPtrArray *visited_links;
|
||||
|
||||
GtkCssNode *link_node;
|
||||
GtkCssNode *visited_link_node;
|
||||
|
||||
GtkLicense license_type;
|
||||
|
||||
guint hovering_over_link : 1;
|
||||
@ -707,6 +712,9 @@ update_credits_button_visibility (GtkAboutDialog *about)
|
||||
static void
|
||||
gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
{
|
||||
GtkCssNode *node;
|
||||
GtkStateFlags state;
|
||||
|
||||
/* Data */
|
||||
about->name = NULL;
|
||||
about->version = NULL;
|
||||
@ -735,6 +743,21 @@ gtk_about_dialog_init (GtkAboutDialog *about)
|
||||
/* force defaults */
|
||||
gtk_about_dialog_set_program_name (about, NULL);
|
||||
gtk_about_dialog_set_logo (about, NULL);
|
||||
|
||||
node = gtk_widget_get_css_node (GTK_WIDGET (about));
|
||||
state = gtk_css_node_get_state (node);
|
||||
|
||||
about->link_node = gtk_css_node_new ();
|
||||
gtk_css_node_set_name (about->link_node, g_quark_from_static_string ("link"));
|
||||
gtk_css_node_set_parent (about->link_node, node);
|
||||
gtk_css_node_set_state (about->link_node, state | GTK_STATE_FLAG_LINK);
|
||||
g_object_unref (about->link_node);
|
||||
|
||||
about->visited_link_node = gtk_css_node_new ();
|
||||
gtk_css_node_set_name (about->visited_link_node, g_quark_from_static_string ("link"));
|
||||
gtk_css_node_set_parent (about->visited_link_node, node);
|
||||
gtk_css_node_set_state (about->visited_link_node, state | GTK_STATE_FLAG_VISITED);
|
||||
g_object_unref (about->visited_link_node);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1677,12 +1700,10 @@ follow_if_link (GtkAboutDialog *about,
|
||||
if (uri && !g_ptr_array_find_with_equal_func (about->visited_links, uri, (GCompareFunc)strcmp, NULL))
|
||||
{
|
||||
GdkRGBA visited_link_color;
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (about));
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, gtk_style_context_get_state (context) | GTK_STATE_FLAG_VISITED);
|
||||
gtk_style_context_get_color (context, &visited_link_color);
|
||||
gtk_style_context_restore (context);
|
||||
GtkCssStyle *style;
|
||||
|
||||
style = gtk_css_node_get_style (about->visited_link_node);
|
||||
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL);
|
||||
|
||||
g_ptr_array_add (about->visited_links, g_strdup (uri));
|
||||
@ -1823,15 +1844,13 @@ text_buffer_new (GtkAboutDialog *about,
|
||||
GdkRGBA visited_link_color;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
GtkTextTag *tag;
|
||||
GtkStateFlags state = gtk_widget_get_state_flags (GTK_WIDGET (about));
|
||||
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (about));
|
||||
GtkCssStyle *style;
|
||||
|
||||
style = gtk_css_node_get_style (about->link_node);
|
||||
link_color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
style = gtk_css_node_get_style (about->visited_link_node);
|
||||
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
|
||||
gtk_style_context_save (context);
|
||||
gtk_style_context_set_state (context, state | GTK_STATE_FLAG_LINK);
|
||||
gtk_style_context_get_color (context, &link_color);
|
||||
gtk_style_context_set_state (context, state | GTK_STATE_FLAG_VISITED);
|
||||
gtk_style_context_get_color (context, &visited_link_color);
|
||||
gtk_style_context_restore (context);
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
|
||||
for (p = strings; *p; p++)
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
#include "gtkcssstyleprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
|
||||
#include "gdk/gdkhslaprivate.h"
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
#include "gtkcsskeyframesprivate.h"
|
||||
|
||||
#include "gtkcssstyleprivate.h"
|
||||
#include "gtkcssarrayvalueprivate.h"
|
||||
#include "gtkcssshorthandpropertyprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
|
@ -1388,10 +1388,10 @@ gtk_css_node_get_style_provider (GtkCssNode *cssnode)
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_node_print (GtkCssNode *cssnode,
|
||||
GtkStyleContextPrintFlags flags,
|
||||
GString *string,
|
||||
guint indent)
|
||||
gtk_css_node_print (GtkCssNode *cssnode,
|
||||
GtkCssNodePrintFlags flags,
|
||||
GString *string,
|
||||
guint indent)
|
||||
{
|
||||
gboolean need_newline = FALSE;
|
||||
|
||||
@ -1405,7 +1405,7 @@ gtk_css_node_print (GtkCssNode *cssnode,
|
||||
if (!cssnode->visible)
|
||||
g_string_append_c (string, ']');
|
||||
|
||||
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_CHANGE)
|
||||
if (flags & GTK_CSS_NODE_PRINT_SHOW_CHANGE)
|
||||
{
|
||||
GtkCssStyle *style = gtk_css_node_get_style (cssnode);
|
||||
GtkCssChange change;
|
||||
@ -1417,10 +1417,10 @@ gtk_css_node_print (GtkCssNode *cssnode,
|
||||
|
||||
g_string_append_c (string, '\n');
|
||||
|
||||
if (flags & GTK_STYLE_CONTEXT_PRINT_SHOW_STYLE)
|
||||
if (flags & GTK_CSS_NODE_PRINT_SHOW_STYLE)
|
||||
need_newline = gtk_css_style_print (gtk_css_node_get_style (cssnode), string, indent + 2, TRUE);
|
||||
|
||||
if (flags & GTK_STYLE_CONTEXT_PRINT_RECURSE)
|
||||
if (flags & GTK_CSS_NODE_PRINT_RECURSE)
|
||||
{
|
||||
GtkCssNode *node;
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "gtkcssstylechangeprivate.h"
|
||||
#include "gtkbitmaskprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtklistlistmodelprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -155,10 +154,17 @@ void gtk_css_node_validate (GtkCssNode *
|
||||
|
||||
GtkStyleProvider * gtk_css_node_get_style_provider (GtkCssNode *cssnode) G_GNUC_PURE;
|
||||
|
||||
void gtk_css_node_print (GtkCssNode *cssnode,
|
||||
GtkStyleContextPrintFlags flags,
|
||||
GString *string,
|
||||
guint indent);
|
||||
typedef enum {
|
||||
GTK_CSS_NODE_PRINT_NONE = 0,
|
||||
GTK_CSS_NODE_PRINT_RECURSE = 1 << 0,
|
||||
GTK_CSS_NODE_PRINT_SHOW_STYLE = 1 << 1,
|
||||
GTK_CSS_NODE_PRINT_SHOW_CHANGE = 1 << 2
|
||||
} GtkCssNodePrintFlags;
|
||||
|
||||
void gtk_css_node_print (GtkCssNode *cssnode,
|
||||
GtkCssNodePrintFlags flags,
|
||||
GString *string,
|
||||
guint indent);
|
||||
|
||||
GListModel * gtk_css_node_observe_children (GtkCssNode *cssnode);
|
||||
|
||||
|
@ -18,12 +18,12 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkcssselectorprivate.h"
|
||||
#include "gtkcssnodeprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gtkcssprovider.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
#include <errno.h>
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1500
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "gtkcsstypesprivate.h"
|
||||
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
void
|
||||
gtk_css_change_print (GtkCssChange change,
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "gtkcssanimatedstyleprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "deprecated/gtkstylecontextprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
|
||||
|
@ -96,10 +96,9 @@
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkrender.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkviewport.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
@ -2498,6 +2497,7 @@ gtk_flow_box_snapshot (GtkWidget *widget,
|
||||
GtkFlowBox *box = GTK_FLOW_BOX (widget);
|
||||
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
|
||||
int x, y, width, height;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
GTK_WIDGET_CLASS (gtk_flow_box_parent_class)->snapshot (widget, snapshot);
|
||||
|
||||
@ -2508,7 +2508,7 @@ gtk_flow_box_snapshot (GtkWidget *widget,
|
||||
|
||||
if (priv->rubberband_first && priv->rubberband_last)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
GSequenceIter *iter, *iter1, *iter2;
|
||||
GdkRectangle line_rect, rect;
|
||||
GArray *lines;
|
||||
@ -2520,8 +2520,7 @@ gtk_flow_box_snapshot (GtkWidget *widget,
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT (x, y, width, height));
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save_to_node (context, priv->rubberband_node);
|
||||
style = gtk_css_node_get_style (priv->rubberband_node);
|
||||
|
||||
iter1 = CHILD_PRIV (priv->rubberband_first)->iter;
|
||||
iter2 = CHILD_PRIV (priv->rubberband_last)->iter;
|
||||
@ -2568,8 +2567,8 @@ gtk_flow_box_snapshot (GtkWidget *widget,
|
||||
if (lines->len > 0)
|
||||
{
|
||||
cairo_path_t *path;
|
||||
GtkBorder border;
|
||||
const GdkRGBA *border_color;
|
||||
int border_width;
|
||||
GtkSnapshot *bg_snapshot;
|
||||
GskRenderNode *node;
|
||||
|
||||
@ -2587,7 +2586,8 @@ gtk_flow_box_snapshot (GtkWidget *widget,
|
||||
cairo_clip (cr);
|
||||
|
||||
bg_snapshot = gtk_snapshot_new ();
|
||||
gtk_snapshot_render_background (bg_snapshot, context, x, y, width, height);
|
||||
gtk_css_boxes_init_border_box (&boxes, style, x, y, width, height);
|
||||
gtk_css_style_snapshot_background (&boxes, bg_snapshot);
|
||||
node = gtk_snapshot_free_to_node (bg_snapshot);
|
||||
if (node)
|
||||
{
|
||||
@ -2600,16 +2600,15 @@ gtk_flow_box_snapshot (GtkWidget *widget,
|
||||
cairo_append_path (cr, path);
|
||||
cairo_path_destroy (path);
|
||||
|
||||
border_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BORDER_TOP_COLOR));
|
||||
gtk_style_context_get_border (context, &border);
|
||||
border_color = gtk_css_color_value_get_rgba (style->border->border_top_color ? style->border->border_top_color : style->core->color);
|
||||
border_width = round (_gtk_css_number_value_get (style->border->border_left_width, 100));
|
||||
|
||||
cairo_set_line_width (cr, border.left);
|
||||
cairo_set_line_width (cr, border_width);
|
||||
gdk_cairo_set_source_rgba (cr, border_color);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
g_array_free (lines, TRUE);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
#include "gtkcssnodeprivate.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
|
||||
@ -652,17 +655,15 @@ gtk_gl_area_draw_error_screen (GtkGLArea *area,
|
||||
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
|
||||
PangoLayout *layout;
|
||||
int layout_height;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
layout = gtk_widget_create_pango_layout (GTK_WIDGET (area),
|
||||
priv->error->message);
|
||||
layout = gtk_widget_create_pango_layout (GTK_WIDGET (area), priv->error->message);
|
||||
pango_layout_set_width (layout, width * PANGO_SCALE);
|
||||
pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
|
||||
pango_layout_get_pixel_size (layout, NULL, &layout_height);
|
||||
|
||||
gtk_snapshot_render_layout (snapshot,
|
||||
gtk_widget_get_style_context (GTK_WIDGET (area)),
|
||||
0, (height - layout_height) / 2,
|
||||
layout);
|
||||
gtk_css_boxes_init (&boxes, GTK_WIDGET (area));
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, 0, (height - layout_height) / 2, layout);
|
||||
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
@ -48,7 +48,6 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtksymbolicpaintable.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include "gdk/gdkkeysyms.h"
|
||||
#include "gdk/win32/gdkwin32.h"
|
||||
#include "gtk/gtkimmodule.h"
|
||||
#include "gtk/gtkstylecontextprivate.h"
|
||||
#include "gtk/deprecated/gtkstylecontextprivate.h"
|
||||
#include "gtk/gtkcssstyleprivate.h"
|
||||
|
||||
/* avoid warning */
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "gtkcssstylechangeprivate.h"
|
||||
#include "gtkpangoprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
@ -510,17 +511,18 @@ gtk_inscription_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkInscription *self = GTK_INSCRIPTION (widget);
|
||||
GtkStyleContext *context;
|
||||
float lx, ly;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
if (!self->text || (*self->text == '\0'))
|
||||
return;
|
||||
|
||||
context = _gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT(0, 0, gtk_widget_get_width (widget), gtk_widget_get_height (widget)));
|
||||
gtk_inscription_get_layout_location (self, &lx, &ly);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
|
||||
gtk_css_boxes_init (&boxes, widget);
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, lx, ly, self->layout);
|
||||
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,9 @@
|
||||
#include "gtkshortcuttrigger.h"
|
||||
#include "gtkshow.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
#include "gtktextutilprivate.h"
|
||||
#include "gtktooltip.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
@ -1378,19 +1380,20 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
{
|
||||
GtkLabel *self = GTK_LABEL (widget);
|
||||
GtkLabelSelectionInfo *info;
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
int lx, ly;
|
||||
int width, height;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
if (!self->text || (*self->text == '\0'))
|
||||
return;
|
||||
|
||||
gtk_label_ensure_layout (self);
|
||||
|
||||
context = _gtk_widget_get_style_context (widget);
|
||||
get_layout_location (self, &lx, &ly);
|
||||
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_css_boxes_init (&boxes, widget);
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, lx, ly, self->layout);
|
||||
|
||||
info = self->select_info;
|
||||
if (!info)
|
||||
@ -1409,7 +1412,8 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
range[0] = MIN (info->selection_anchor, info->selection_end);
|
||||
range[1] = MAX (info->selection_anchor, info->selection_end);
|
||||
|
||||
gtk_style_context_save_to_node (context, info->selection_node);
|
||||
style = gtk_css_node_get_style (info->selection_node);
|
||||
gtk_css_boxes_init_border_box (&boxes, style, 0, 0, width, height);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
@ -1417,14 +1421,12 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1443,10 +1445,12 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
PangoDirection cursor_direction;
|
||||
|
||||
cursor_direction = get_cursor_direction (self);
|
||||
gtk_snapshot_render_insertion_cursor (snapshot, context,
|
||||
lx, ly,
|
||||
self->layout, self->select_info->selection_end,
|
||||
cursor_direction);
|
||||
gtk_css_style_snapshot_caret (&boxes, gtk_widget_get_display (widget),
|
||||
snapshot,
|
||||
lx, ly,
|
||||
self->layout,
|
||||
self->select_info->selection_end,
|
||||
cursor_direction);
|
||||
}
|
||||
|
||||
focus_link = gtk_label_get_focus_link (self, NULL);
|
||||
@ -1457,7 +1461,8 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
range[0] = active_link->start;
|
||||
range[1] = active_link->end;
|
||||
|
||||
gtk_style_context_save_to_node (context, active_link->cssnode);
|
||||
style = gtk_css_node_get_style (active_link->cssnode);
|
||||
gtk_css_boxes_init_border_box (&boxes, style, 0, 0, width, height);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
for (i = 0; i < cairo_region_num_rectangles (range_clip); i++)
|
||||
@ -1465,14 +1470,12 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
cairo_region_get_rectangle (range_clip, i, &clip_rect);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_rect));
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, lx, ly, self->layout);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, lx, ly, self->layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
if (focus_link && gtk_widget_has_visible_focus (widget))
|
||||
@ -1480,16 +1483,15 @@ gtk_label_snapshot (GtkWidget *widget,
|
||||
range[0] = focus_link->start;
|
||||
range[1] = focus_link->end;
|
||||
|
||||
gtk_style_context_save_to_node (context, focus_link->cssnode);
|
||||
style = gtk_css_node_get_style (focus_link->cssnode);
|
||||
|
||||
range_clip = gdk_pango_layout_get_clip_region (self->layout, lx, ly, range, 1);
|
||||
cairo_region_get_extents (range_clip, &rect);
|
||||
|
||||
gtk_snapshot_render_focus (snapshot, context, rect.x, rect.y, rect.width, rect.height);
|
||||
gtk_css_boxes_init_border_box (&boxes, style, rect.x, rect.y, rect.width, rect.height);
|
||||
gtk_css_style_snapshot_outline (&boxes, snapshot);
|
||||
|
||||
cairo_region_destroy (range_clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "gtkpopovermenuprivate.h"
|
||||
#include "gtkorientable.h"
|
||||
#include "gtksizerequest.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
|
@ -119,14 +119,13 @@
|
||||
#include "gtkpointerfocusprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkshortcutmanager.h"
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtktooltipprivate.h"
|
||||
#include "gtkcssboxesimplprivate.h"
|
||||
#include "gtknativeprivate.h"
|
||||
|
||||
#include "gtkrender.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkroundedboxprivate.h"
|
||||
#include "gsk/gskroundedrectprivate.h"
|
||||
#include "gtkcssshadowvalueprivate.h"
|
||||
@ -1545,10 +1544,13 @@ create_arrow_render_node (GtkPopover *popover)
|
||||
{
|
||||
GtkPopoverPrivate *priv = gtk_popover_get_instance_private (popover);
|
||||
GtkWidget *widget = GTK_WIDGET (popover);
|
||||
GtkStyleContext *context;
|
||||
GtkBorder border;
|
||||
cairo_t *cr;
|
||||
GtkSnapshot *snapshot;
|
||||
GtkSnapshot *bg_snapshot;
|
||||
GskRenderNode *node;
|
||||
GtkCssBoxes boxes;
|
||||
GtkCssStyle *style;
|
||||
|
||||
snapshot = gtk_snapshot_new ();
|
||||
|
||||
@ -1566,22 +1568,27 @@ create_arrow_render_node (GtkPopover *popover)
|
||||
|
||||
get_border (priv->arrow_node, &border);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save_to_node (context, priv->arrow_node);
|
||||
style = gtk_css_node_get_style (priv->arrow_node);
|
||||
|
||||
/* Render the arrow background */
|
||||
gtk_render_background (context, cr,
|
||||
0, 0,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget));
|
||||
bg_snapshot = gtk_snapshot_new ();
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
0, 0,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget));
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
node = gtk_snapshot_free_to_node (bg_snapshot);
|
||||
if (node)
|
||||
{
|
||||
gsk_render_node_draw (node, cr);
|
||||
gsk_render_node_unref (node);
|
||||
}
|
||||
|
||||
/* Render the border of the arrow tip */
|
||||
if (border.bottom > 0)
|
||||
{
|
||||
GtkCssStyle *style;
|
||||
const GdkRGBA *border_color;
|
||||
|
||||
style = gtk_css_node_get_style (priv->arrow_node);
|
||||
border_color = gtk_css_color_value_get_rgba (style->border->border_left_color ? style->border->border_left_color : style->core->color);
|
||||
|
||||
gtk_popover_apply_tail_path (popover, cr);
|
||||
@ -1594,8 +1601,6 @@ create_arrow_render_node (GtkPopover *popover)
|
||||
cairo_restore (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
priv->arrow_render_node = gtk_snapshot_free_to_node (snapshot);
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkpopovercontentprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
#include "gtkcssstylechangeprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
|
||||
|
@ -46,12 +46,15 @@
|
||||
#include "gtkbuildable.h"
|
||||
#include "gtkmessagedialog.h"
|
||||
#include "gtkbutton.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkdialogprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -1949,23 +1952,34 @@ paint_page (GtkPrintUnixDialog *dialog,
|
||||
const char *text,
|
||||
int text_x)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
int width, height;
|
||||
int text_y;
|
||||
GdkRGBA color;
|
||||
GtkSnapshot *snapshot;
|
||||
GskRenderNode *node;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
width = 20;
|
||||
height = 26;
|
||||
text_y = 21;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save_to_node (context, dialog->collate_paper_node);
|
||||
style = gtk_css_node_get_style (dialog->collate_paper_node);
|
||||
|
||||
gtk_render_background (context, cr, x, y, width, height);
|
||||
gtk_render_frame (context, cr, x, y, width, height);
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gtk_css_boxes_init_border_box (&boxes, style, x, y, width, height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
|
||||
gtk_style_context_get_color (context, &color);
|
||||
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
if (node)
|
||||
{
|
||||
gsk_render_node_draw (node, cr);
|
||||
gsk_render_node_unref (node);
|
||||
}
|
||||
|
||||
color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
|
||||
cairo_select_font_face (cr, "Sans",
|
||||
CAIRO_FONT_SLANT_NORMAL,
|
||||
@ -1973,8 +1987,6 @@ paint_page (GtkPrintUnixDialog *dialog,
|
||||
cairo_set_font_size (cr, 9);
|
||||
cairo_move_to (cr, x + text_x, y + text_y);
|
||||
cairo_show_text (cr, text);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2372,7 +2384,7 @@ draw_page (GtkDrawingArea *da,
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (da);
|
||||
GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (data);
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
double ratio;
|
||||
int w, h, tmp;
|
||||
int pages_x, pages_y, i, x, y, layout_w, layout_h;
|
||||
@ -2392,6 +2404,9 @@ draw_page (GtkDrawingArea *da,
|
||||
double pos_x, pos_y;
|
||||
int pages_per_sheet;
|
||||
gboolean ltr = TRUE;
|
||||
GtkSnapshot *snapshot;
|
||||
GtkCssBoxes boxes;
|
||||
GskRenderNode *node;
|
||||
|
||||
orientation = gtk_page_setup_get_orientation (dialog->page_setup);
|
||||
landscape =
|
||||
@ -2478,16 +2493,24 @@ draw_page (GtkDrawingArea *da,
|
||||
pages_y = tmp;
|
||||
}
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save_to_node (context, dialog->page_layout_paper_node);
|
||||
gtk_style_context_get_color (context, &color);
|
||||
style = gtk_css_node_get_style (dialog->page_layout_paper_node);
|
||||
color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
|
||||
pos_x = (width - w) / 2;
|
||||
pos_y = (height - h) / 2 - 10;
|
||||
cairo_translate (cr, pos_x, pos_y);
|
||||
|
||||
gtk_render_background (context, cr, 1, 1, w, h);
|
||||
gtk_render_frame (context, cr, 1, 1, w, h);
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gtk_css_boxes_init_border_box (&boxes, style, 1, 1, w, h);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
if (node)
|
||||
{
|
||||
gsk_render_node_draw (node, cr);
|
||||
gsk_render_node_unref (node);
|
||||
}
|
||||
|
||||
cairo_set_line_width (cr, 1.0);
|
||||
|
||||
@ -2589,7 +2612,7 @@ draw_page (GtkDrawingArea *da,
|
||||
break;
|
||||
}
|
||||
|
||||
cairo_set_source_rgba (cr, color.red, color.green, color.blue, color.alpha);
|
||||
gdk_cairo_set_source_rgba (cr, &color);
|
||||
if (horizontal)
|
||||
for (y = start_y; y != end_y + dy; y += dy)
|
||||
{
|
||||
@ -2629,9 +2652,8 @@ draw_page (GtkDrawingArea *da,
|
||||
|
||||
g_object_unref (layout);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
|
||||
gtk_style_context_get_color (context, &color);
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||
color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
|
||||
if (page_setup != NULL)
|
||||
{
|
||||
|
310
gtk/gtkrenderlayout.c
Normal file
310
gtk/gtkrenderlayout.c
Normal file
@ -0,0 +1,310 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2022 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssshadowvalueprivate.h"
|
||||
#include "gtkpangoprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtksettings.h"
|
||||
|
||||
|
||||
void
|
||||
gtk_css_style_snapshot_layout (GtkCssBoxes *boxes,
|
||||
GtkSnapshot *snapshot,
|
||||
int x,
|
||||
int y,
|
||||
PangoLayout *layout)
|
||||
{
|
||||
GtkCssStyle *style;
|
||||
const GdkRGBA *color;
|
||||
gboolean has_shadow;
|
||||
|
||||
gtk_snapshot_push_debug (snapshot, "Layout");
|
||||
|
||||
if (x != 0 || y != 0)
|
||||
{
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
|
||||
}
|
||||
|
||||
style = boxes->style;
|
||||
color = gtk_css_color_value_get_rgba (style->core->color);
|
||||
has_shadow = gtk_css_shadow_value_push_snapshot (style->font->text_shadow, snapshot);
|
||||
|
||||
gtk_snapshot_append_layout (snapshot, layout, color);
|
||||
|
||||
if (has_shadow)
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
if (x != 0 || y != 0)
|
||||
gtk_snapshot_restore (snapshot);
|
||||
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
draw_insertion_cursor (cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height,
|
||||
double aspect_ratio,
|
||||
const GdkRGBA *color,
|
||||
PangoDirection direction,
|
||||
gboolean draw_arrow)
|
||||
{
|
||||
int stem_width;
|
||||
double angle;
|
||||
double dx, dy;
|
||||
double xx1, yy1, xx2, yy2;
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_new_path (cr);
|
||||
|
||||
gdk_cairo_set_source_rgba (cr, color);
|
||||
|
||||
stem_width = height * aspect_ratio + 1;
|
||||
|
||||
yy1 = y;
|
||||
yy2 = y + height;
|
||||
|
||||
if (width < 0)
|
||||
{
|
||||
xx1 = x;
|
||||
xx2 = x - width;
|
||||
}
|
||||
else
|
||||
{
|
||||
xx1 = x + width;
|
||||
xx2 = x;
|
||||
}
|
||||
|
||||
angle = atan2 (height, width);
|
||||
|
||||
dx = (stem_width/2.0) * cos (M_PI/2 - angle);
|
||||
dy = (stem_width/2.0) * sin (M_PI/2 - angle);
|
||||
|
||||
if (draw_arrow)
|
||||
{
|
||||
if (direction == PANGO_DIRECTION_RTL)
|
||||
{
|
||||
double x0, y0, x1, y1, x2, y2;
|
||||
|
||||
x0 = xx2 - dx + 2 * dy;
|
||||
y0 = yy2 - dy - 2 * dx;
|
||||
|
||||
x1 = x0 + 4 * dy;
|
||||
y1 = y0 - 4 * dx;
|
||||
x2 = x0 + 2 * dy - 3 * dx;
|
||||
y2 = y0 - 2 * dx - 3 * dy;
|
||||
|
||||
cairo_move_to (cr, xx1 + dx, yy1 + dy);
|
||||
cairo_line_to (cr, xx2 + dx, yy2 + dy);
|
||||
cairo_line_to (cr, x2, y2);
|
||||
cairo_line_to (cr, x1, y1);
|
||||
cairo_line_to (cr, xx1 - dx, yy1 - dy);
|
||||
}
|
||||
else if (direction == PANGO_DIRECTION_LTR)
|
||||
{
|
||||
double x0, y0, x1, y1, x2, y2;
|
||||
|
||||
x0 = xx2 + dx + 2 * dy;
|
||||
y0 = yy2 + dy - 2 * dx;
|
||||
|
||||
x1 = x0 + 4 * dy;
|
||||
y1 = y0 - 4 * dx;
|
||||
x2 = x0 + 2 * dy + 3 * dx;
|
||||
y2 = y0 - 2 * dx + 3 * dy;
|
||||
|
||||
cairo_move_to (cr, xx1 - dx, yy1 - dy);
|
||||
cairo_line_to (cr, xx2 - dx, yy2 - dy);
|
||||
cairo_line_to (cr, x2, y2);
|
||||
cairo_line_to (cr, x1, y1);
|
||||
cairo_line_to (cr, xx1 + dx, yy1 + dy);
|
||||
}
|
||||
else
|
||||
g_assert_not_reached();
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_move_to (cr, xx1 + dx, yy1 + dy);
|
||||
cairo_line_to (cr, xx2 + dx, yy2 + dy);
|
||||
cairo_line_to (cr, xx2 - dx, yy2 - dy);
|
||||
cairo_line_to (cr, xx1 - dx, yy1 - dy);
|
||||
}
|
||||
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
get_insertion_cursor_bounds (double width,
|
||||
double height,
|
||||
double aspect_ratio,
|
||||
PangoDirection direction,
|
||||
gboolean draw_arrow,
|
||||
graphene_rect_t *bounds)
|
||||
{
|
||||
int stem_width;
|
||||
|
||||
if (width < 0)
|
||||
width = - width;
|
||||
|
||||
stem_width = height * aspect_ratio + 1;
|
||||
|
||||
graphene_rect_init (bounds,
|
||||
- 2 * stem_width, - stem_width,
|
||||
width + 4 * stem_width, height + 2 * stem_width);
|
||||
}
|
||||
|
||||
static void
|
||||
snapshot_insertion_cursor (GtkSnapshot *snapshot,
|
||||
GtkCssStyle *style,
|
||||
double width,
|
||||
double height,
|
||||
double aspect_ratio,
|
||||
gboolean is_primary,
|
||||
PangoDirection direction,
|
||||
gboolean draw_arrow)
|
||||
{
|
||||
GdkRGBA color;
|
||||
|
||||
if (is_primary)
|
||||
color = *gtk_css_color_value_get_rgba (style->font->caret_color ? style->font->caret_color : style->core->color);
|
||||
else
|
||||
color = *gtk_css_color_value_get_rgba (style->font->secondary_caret_color ? style->font->secondary_caret_color : style->core->color);
|
||||
|
||||
if (width != 0 || draw_arrow)
|
||||
{
|
||||
cairo_t *cr;
|
||||
graphene_rect_t bounds;
|
||||
|
||||
get_insertion_cursor_bounds (width, height, aspect_ratio, direction, draw_arrow, &bounds);
|
||||
cr = gtk_snapshot_append_cairo (snapshot, &bounds);
|
||||
|
||||
draw_insertion_cursor (cr, 0, 0, width, height, aspect_ratio, &color, direction, draw_arrow);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
else
|
||||
{
|
||||
int stem_width;
|
||||
int offset;
|
||||
|
||||
stem_width = height * aspect_ratio + 1;
|
||||
|
||||
/* put (stem_width % 2) on the proper side of the cursor */
|
||||
if (direction == PANGO_DIRECTION_LTR)
|
||||
offset = stem_width / 2;
|
||||
else
|
||||
offset = stem_width - stem_width / 2;
|
||||
|
||||
gtk_snapshot_append_color (snapshot,
|
||||
&color,
|
||||
&GRAPHENE_RECT_INIT (- offset, 0, stem_width, height));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gtk_css_style_snapshot_caret (GtkCssBoxes *boxes,
|
||||
GdkDisplay *display,
|
||||
GtkSnapshot *snapshot,
|
||||
int x,
|
||||
int y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction)
|
||||
{
|
||||
gboolean split_cursor;
|
||||
double aspect_ratio;
|
||||
PangoRectangle strong_pos, weak_pos;
|
||||
PangoRectangle *cursor1, *cursor2;
|
||||
GdkSeat *seat;
|
||||
PangoDirection keyboard_direction;
|
||||
PangoDirection direction2;
|
||||
|
||||
g_object_get (gtk_settings_get_for_display (display),
|
||||
"gtk-split-cursor", &split_cursor,
|
||||
"gtk-cursor-aspect-ratio", &aspect_ratio,
|
||||
NULL);
|
||||
|
||||
keyboard_direction = PANGO_DIRECTION_LTR;
|
||||
seat = gdk_display_get_default_seat (display);
|
||||
if (seat)
|
||||
{
|
||||
GdkDevice *keyboard = gdk_seat_get_keyboard (seat);
|
||||
|
||||
if (keyboard)
|
||||
keyboard_direction = gdk_device_get_direction (keyboard);
|
||||
}
|
||||
|
||||
pango_layout_get_caret_pos (layout, index, &strong_pos, &weak_pos);
|
||||
|
||||
direction2 = PANGO_DIRECTION_NEUTRAL;
|
||||
|
||||
if (split_cursor)
|
||||
{
|
||||
cursor1 = &strong_pos;
|
||||
|
||||
if (strong_pos.x != weak_pos.x || strong_pos.y != weak_pos.y)
|
||||
{
|
||||
direction2 = (direction == PANGO_DIRECTION_LTR) ? PANGO_DIRECTION_RTL : PANGO_DIRECTION_LTR;
|
||||
cursor2 = &weak_pos;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (keyboard_direction == direction)
|
||||
cursor1 = &strong_pos;
|
||||
else
|
||||
cursor1 = &weak_pos;
|
||||
}
|
||||
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x + PANGO_PIXELS (MIN (cursor1->x, cursor1->x + cursor1->width)), y + PANGO_PIXELS (cursor1->y)));
|
||||
snapshot_insertion_cursor (snapshot,
|
||||
boxes->style,
|
||||
PANGO_PIXELS (cursor1->width),
|
||||
PANGO_PIXELS (cursor1->height),
|
||||
aspect_ratio,
|
||||
TRUE,
|
||||
direction,
|
||||
direction2 != PANGO_DIRECTION_NEUTRAL);
|
||||
gtk_snapshot_restore (snapshot);
|
||||
|
||||
if (direction2 != PANGO_DIRECTION_NEUTRAL)
|
||||
{
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x + PANGO_PIXELS (MIN (cursor2->x, cursor2->x + cursor2->width)), y + PANGO_PIXELS (cursor2->y)));
|
||||
snapshot_insertion_cursor (snapshot,
|
||||
boxes->style,
|
||||
PANGO_PIXELS (cursor2->width),
|
||||
PANGO_PIXELS (cursor2->height),
|
||||
aspect_ratio,
|
||||
FALSE,
|
||||
direction2,
|
||||
TRUE);
|
||||
gtk_snapshot_restore (snapshot);
|
||||
}
|
||||
}
|
||||
|
48
gtk/gtkrenderlayoutprivate.h
Normal file
48
gtk/gtkrenderlayoutprivate.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2022 Red Hat, Inc
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RENDER_LAYOUT_PRIVATE_H__
|
||||
#define __GTK_RENDER_LAYOUT_PRIVATE_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <cairo.h>
|
||||
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtkcssboxesprivate.h"
|
||||
#include "gtktypes.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void gtk_css_style_snapshot_layout (GtkCssBoxes *boxes,
|
||||
GtkSnapshot *snapshot,
|
||||
int x,
|
||||
int y,
|
||||
PangoLayout *layout);
|
||||
|
||||
void gtk_css_style_snapshot_caret (GtkCssBoxes *boxes,
|
||||
GdkDisplay *display,
|
||||
GtkSnapshot *snapshot,
|
||||
int x,
|
||||
int y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RENDER_LAYOUT_PRIVATE_H__ */
|
@ -48,7 +48,8 @@
|
||||
#include "gtkscrollbar.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkviewport.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
@ -1869,10 +1870,10 @@ gtk_scrolled_window_snapshot_scrollbars_junction (GtkScrolledWindow *scrolled_wi
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
||||
GtkAllocation hscr_allocation, vscr_allocation;
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
GdkRectangle junction_rect;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (priv->hscrollbar), &hscr_allocation);
|
||||
gtk_widget_get_allocation (GTK_WIDGET (priv->vscrollbar), &vscr_allocation);
|
||||
@ -1882,17 +1883,13 @@ gtk_scrolled_window_snapshot_scrollbars_junction (GtkScrolledWindow *scrolled_wi
|
||||
junction_rect.width = vscr_allocation.width;
|
||||
junction_rect.height = hscr_allocation.height;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save_to_node (context, priv->junction_node);
|
||||
style = gtk_css_node_get_style (priv->junction_node);
|
||||
|
||||
gtk_snapshot_render_background (snapshot, context,
|
||||
junction_rect.x, junction_rect.y,
|
||||
junction_rect.width, junction_rect.height);
|
||||
gtk_snapshot_render_frame (snapshot, context,
|
||||
junction_rect.x, junction_rect.y,
|
||||
junction_rect.width, junction_rect.height);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
junction_rect.x, junction_rect.y,
|
||||
junction_rect.width, junction_rect.height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1900,15 +1897,14 @@ gtk_scrolled_window_snapshot_overshoot (GtkScrolledWindow *scrolled_window,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
||||
int overshoot_x, overshoot_y;
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
GdkRectangle rect;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
if (!_gtk_scrolled_window_get_overshoot (scrolled_window, &overshoot_x, &overshoot_y))
|
||||
return;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_scrolled_window_inner_allocation (scrolled_window, &rect);
|
||||
|
||||
overshoot_x = CLAMP (overshoot_x, - MAX_OVERSHOOT_DISTANCE, MAX_OVERSHOOT_DISTANCE);
|
||||
@ -1916,32 +1912,36 @@ gtk_scrolled_window_snapshot_overshoot (GtkScrolledWindow *scrolled_window,
|
||||
|
||||
if (overshoot_x > 0)
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_RIGHT]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x + rect.width - overshoot_x, rect.y, overshoot_x, rect.height);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x + rect.width - overshoot_x, rect.y, overshoot_x, rect.height);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->overshoot_node[GTK_POS_RIGHT]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x + rect.width - overshoot_x, rect.y, overshoot_x, rect.height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
else if (overshoot_x < 0)
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_LEFT]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, -overshoot_x, rect.height);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, -overshoot_x, rect.height);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->overshoot_node[GTK_POS_LEFT]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x, rect.y, -overshoot_x, rect.height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
|
||||
if (overshoot_y > 0)
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_BOTTOM]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y + rect.height - overshoot_y, rect.width, overshoot_y);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y + rect.height - overshoot_y, rect.width, overshoot_y);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->overshoot_node[GTK_POS_BOTTOM]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x, rect.y + rect.height - overshoot_y, rect.width, overshoot_y);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
else if (overshoot_y < 0)
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->overshoot_node[GTK_POS_TOP]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, rect.width, -overshoot_y);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, rect.width, -overshoot_y);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->overshoot_node[GTK_POS_TOP]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x, rect.y, rect.width, -overshoot_y);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1950,45 +1950,47 @@ gtk_scrolled_window_snapshot_undershoot (GtkScrolledWindow *scrolled_window,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkScrolledWindowPrivate *priv = gtk_scrolled_window_get_instance_private (scrolled_window);
|
||||
GtkWidget *widget = GTK_WIDGET (scrolled_window);
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
GdkRectangle rect;
|
||||
GtkAdjustment *adj;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_scrolled_window_inner_allocation (scrolled_window, &rect);
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->hscrollbar));
|
||||
if (gtk_adjustment_get_value (adj) < gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj))
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_RIGHT]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x + rect.width - UNDERSHOOT_SIZE, rect.y, UNDERSHOOT_SIZE, rect.height);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x + rect.width - UNDERSHOOT_SIZE, rect.y, UNDERSHOOT_SIZE, rect.height);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->undershoot_node[GTK_POS_RIGHT]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x + rect.width - UNDERSHOOT_SIZE, rect.y, UNDERSHOOT_SIZE, rect.height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
if (gtk_adjustment_get_value (adj) > gtk_adjustment_get_lower (adj))
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_LEFT]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, UNDERSHOOT_SIZE, rect.height);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, UNDERSHOOT_SIZE, rect.height);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->undershoot_node[GTK_POS_LEFT]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x, rect.y, UNDERSHOOT_SIZE, rect.height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
|
||||
adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (priv->vscrollbar));
|
||||
if (gtk_adjustment_get_value (adj) < gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj))
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_BOTTOM]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y + rect.height - UNDERSHOOT_SIZE, rect.width, UNDERSHOOT_SIZE);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y + rect.height - UNDERSHOOT_SIZE, rect.width, UNDERSHOOT_SIZE);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->undershoot_node[GTK_POS_BOTTOM]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x, rect.y + rect.height - UNDERSHOOT_SIZE, rect.width, UNDERSHOOT_SIZE);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
if (gtk_adjustment_get_value (adj) > gtk_adjustment_get_lower (adj))
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->undershoot_node[GTK_POS_TOP]);
|
||||
gtk_snapshot_render_background (snapshot, context, rect.x, rect.y, rect.width, UNDERSHOOT_SIZE);
|
||||
gtk_snapshot_render_frame (snapshot, context, rect.x, rect.y, rect.width, UNDERSHOOT_SIZE);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->undershoot_node[GTK_POS_TOP]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
rect.x, rect.y, rect.width, UNDERSHOOT_SIZE);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "gtkcssproviderprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkscrolledwindow.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "deprecated/gtkstylecontextprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkversion.h"
|
||||
|
@ -23,11 +23,7 @@
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssshadowvalueprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtkrendericonprivate.h"
|
||||
#include "gtkrendernodepaintableprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gsktransformprivate.h"
|
||||
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
@ -1977,150 +1973,6 @@ gtk_snapshot_append_color (GtkSnapshot *snapshot,
|
||||
gtk_snapshot_append_node_internal (snapshot, node);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_background:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the background
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @width: rectangle width
|
||||
* @height: rectangle height
|
||||
*
|
||||
* Creates a render node for the CSS background according to @context,
|
||||
* and appends it to the current node of @snapshot, without changing
|
||||
* the current node.
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_background (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, width, height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_frame:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the frame
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @width: rectangle width
|
||||
* @height: rectangle height
|
||||
*
|
||||
* Creates a render node for the CSS border according to @context,
|
||||
* and appends it to the current node of @snapshot, without changing
|
||||
* the current node.
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_frame (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, width, height);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_focus:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the focus ring
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @width: rectangle width
|
||||
* @height: rectangle height
|
||||
*
|
||||
* Creates a render node for the focus outline according to @context,
|
||||
* and appends it to the current node of @snapshot, without changing
|
||||
* the current node.
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_focus (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes,
|
||||
gtk_style_context_lookup_style (context),
|
||||
x, y, width, height);
|
||||
gtk_css_style_snapshot_outline (&boxes, snapshot);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_layout:
|
||||
* @snapshot: a `GtkSnapshot`
|
||||
* @context: the style context that defines the text
|
||||
* @x: X origin of the rectangle
|
||||
* @y: Y origin of the rectangle
|
||||
* @layout: the `PangoLayout` to render
|
||||
*
|
||||
* Creates a render node for rendering @layout according to the style
|
||||
* information in @context, and appends it to the current node of @snapshot,
|
||||
* without changing the current node.
|
||||
*/
|
||||
void
|
||||
gtk_snapshot_render_layout (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout)
|
||||
{
|
||||
const bool needs_translate = (x != 0 || y != 0);
|
||||
const GdkRGBA *fg_color;
|
||||
GtkCssValue *shadows_value;
|
||||
gboolean has_shadow;
|
||||
|
||||
g_return_if_fail (snapshot != NULL);
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||
|
||||
if (needs_translate)
|
||||
{
|
||||
gtk_snapshot_save (snapshot);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
|
||||
}
|
||||
|
||||
fg_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
|
||||
|
||||
shadows_value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_SHADOW);
|
||||
has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
|
||||
|
||||
gtk_snapshot_append_layout (snapshot, layout, fg_color);
|
||||
|
||||
if (has_shadow)
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
if (needs_translate)
|
||||
gtk_snapshot_restore (snapshot);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_snapshot_append_text (GtkSnapshot *snapshot,
|
||||
PangoFont *font,
|
||||
|
@ -225,43 +225,6 @@ void gtk_snapshot_append_layout (GtkSnapshot
|
||||
const GdkRGBA *color);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_render_background (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_render_frame (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_render_focus (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
double width,
|
||||
double height);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_snapshot_render_layout (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout);
|
||||
GDK_AVAILABLE_IN_ALL /* in gtkstylecontext.c */
|
||||
void gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
|
||||
GtkStyleContext *context,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SNAPSHOT_H__ */
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <gtk/css/gtkcss.h>
|
||||
#include "gtk/css/gtkcsstokenizerprivate.h"
|
||||
#include "gtk/css/gtkcssparserprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtksettingsprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
@ -168,3 +169,65 @@ gtk_style_provider_emit_error (GtkStyleProvider *provider,
|
||||
if (iface->emit_error)
|
||||
iface->emit_error (provider, section, error);
|
||||
}
|
||||
|
||||
|
||||
/* These apis are misnamed, and the rest of GtkStyleContext is deprecated,
|
||||
* so put them here for now
|
||||
*/
|
||||
|
||||
/**
|
||||
* gtk_style_context_add_provider_for_display:
|
||||
* @display: a `GdkDisplay`
|
||||
* @provider: a `GtkStyleProvider`
|
||||
* @priority: the priority of the style provider. The lower
|
||||
* it is, the earlier it will be used in the style construction.
|
||||
* Typically this will be in the range between
|
||||
* %GTK_STYLE_PROVIDER_PRIORITY_FALLBACK and
|
||||
* %GTK_STYLE_PROVIDER_PRIORITY_USER
|
||||
*
|
||||
* Adds a global style provider to @display, which will be used
|
||||
* in style construction for all `GtkStyleContexts` under @display.
|
||||
*
|
||||
* GTK uses this to make styling information from `GtkSettings`
|
||||
* available.
|
||||
*
|
||||
* Note: If both priorities are the same, A `GtkStyleProvider`
|
||||
* added through [method@Gtk.StyleContext.add_provider] takes
|
||||
* precedence over another added through this function.
|
||||
*/
|
||||
void
|
||||
gtk_style_context_add_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider,
|
||||
guint priority)
|
||||
{
|
||||
GtkStyleCascade *cascade;
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
||||
g_return_if_fail (!GTK_IS_SETTINGS (provider) || _gtk_settings_get_display (GTK_SETTINGS (provider)) == display);
|
||||
|
||||
cascade = _gtk_settings_get_style_cascade (gtk_settings_get_for_display (display), 1);
|
||||
_gtk_style_cascade_add_provider (cascade, provider, priority);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_style_context_remove_provider_for_display:
|
||||
* @display: a `GdkDisplay`
|
||||
* @provider: a `GtkStyleProvider`
|
||||
*
|
||||
* Removes @provider from the global style providers list in @display.
|
||||
*/
|
||||
void
|
||||
gtk_style_context_remove_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider)
|
||||
{
|
||||
GtkStyleCascade *cascade;
|
||||
|
||||
g_return_if_fail (GDK_IS_DISPLAY (display));
|
||||
g_return_if_fail (GTK_IS_STYLE_PROVIDER (provider));
|
||||
g_return_if_fail (!GTK_IS_SETTINGS (provider));
|
||||
|
||||
cascade = _gtk_settings_get_style_cascade (gtk_settings_get_for_display (display), 1);
|
||||
_gtk_style_cascade_remove_provider (cascade, provider);
|
||||
}
|
||||
|
||||
|
@ -90,6 +90,15 @@ GType gtk_style_provider_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkStyleProvider, g_object_unref)
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_add_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider,
|
||||
guint priority);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_remove_provider_for_display (GdkDisplay *display,
|
||||
GtkStyleProvider *provider);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_STYLE_PROVIDER_H__ */
|
||||
|
@ -19,6 +19,7 @@
|
||||
#define __GTK_STYLE_PROVIDER_PRIVATE_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtkstyleprovider.h>
|
||||
#include "gtk/gtkcountingbloomfilterprivate.h"
|
||||
#include "gtk/gtkcsskeyframesprivate.h"
|
||||
#include "gtk/gtkcsslookupprivate.h"
|
||||
|
@ -54,7 +54,9 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksettings.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
#include "gtktexthandleprivate.h"
|
||||
#include "gtktexthistoryprivate.h"
|
||||
#include "gtktextutilprivate.h"
|
||||
@ -65,6 +67,7 @@
|
||||
#include "gtknative.h"
|
||||
#include "gtkactionmuxerprivate.h"
|
||||
#include "gtkjoinedmenuprivate.h"
|
||||
#include "deprecated/gtkrender.h"
|
||||
|
||||
#include <cairo-gobject.h>
|
||||
#include <string.h>
|
||||
@ -2521,27 +2524,27 @@ gtk_text_draw_undershoot (GtkText *self,
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
const int text_width = gtk_widget_get_width (GTK_WIDGET (self));
|
||||
const int text_height = gtk_widget_get_height (GTK_WIDGET (self));
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
int min_offset, max_offset;
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (self));
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
gtk_text_get_scroll_limits (self, &min_offset, &max_offset);
|
||||
|
||||
if (priv->scroll_offset > min_offset)
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->undershoot_node[0]);
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, UNDERSHOOT_SIZE, text_height);
|
||||
gtk_snapshot_render_frame (snapshot, context, 0, 0, UNDERSHOOT_SIZE, text_height);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->undershoot_node[0]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style, 0, 0, UNDERSHOOT_SIZE, text_height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
|
||||
if (priv->scroll_offset < max_offset)
|
||||
{
|
||||
gtk_style_context_save_to_node (context, priv->undershoot_node[1]);
|
||||
gtk_snapshot_render_background (snapshot, context, text_width - UNDERSHOOT_SIZE, 0, UNDERSHOOT_SIZE, text_height);
|
||||
gtk_snapshot_render_frame (snapshot, context, text_width - UNDERSHOOT_SIZE, 0, UNDERSHOOT_SIZE, text_height);
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (priv->undershoot_node[1]);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
text_width - UNDERSHOOT_SIZE, 0, UNDERSHOOT_SIZE, text_height);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_border (&boxes, snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4600,20 +4603,21 @@ gtk_text_draw_text (GtkText *self,
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GtkWidget *widget = GTK_WIDGET (self);
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
PangoLayout *layout;
|
||||
int x, y;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
/* Nothing to display at all */
|
||||
if (gtk_text_get_display_mode (self) == DISPLAY_BLANK)
|
||||
return;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
layout = gtk_text_ensure_layout (self, TRUE);
|
||||
|
||||
gtk_text_get_layout_offsets (self, &x, &y);
|
||||
|
||||
gtk_snapshot_render_layout (snapshot, context, x, y, layout);
|
||||
gtk_css_boxes_init (&boxes, widget);
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, x, y, layout);
|
||||
|
||||
if (priv->selection_bound != priv->current_pos)
|
||||
{
|
||||
@ -4631,19 +4635,18 @@ gtk_text_draw_text (GtkText *self,
|
||||
range[0] = MIN (start_index, end_index);
|
||||
range[1] = MAX (start_index, end_index);
|
||||
|
||||
gtk_style_context_save_to_node (context, priv->selection_node);
|
||||
style = gtk_css_node_get_style (priv->selection_node);
|
||||
|
||||
clip = gdk_pango_layout_get_clip_region (layout, x, y, range, 1);
|
||||
cairo_region_get_extents (clip, &clip_extents);
|
||||
|
||||
gtk_css_boxes_init_border_box (&boxes, style, 0, 0, width, height);
|
||||
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_FROM_RECT (&clip_extents));
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, x, y, layout);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_layout (&boxes, snapshot, x, y, layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
cairo_region_destroy (clip);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4654,7 +4657,7 @@ gtk_text_draw_cursor (GtkText *self,
|
||||
{
|
||||
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
|
||||
GtkWidget *widget = GTK_WIDGET (self);
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
PangoRectangle cursor_rect;
|
||||
int cursor_index;
|
||||
gboolean block;
|
||||
@ -4662,8 +4665,10 @@ gtk_text_draw_cursor (GtkText *self,
|
||||
PangoLayout *layout;
|
||||
const char *text;
|
||||
int x, y;
|
||||
GtkCssBoxes boxes;
|
||||
GdkDisplay *display;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
display = gtk_widget_get_display (widget);
|
||||
|
||||
layout = g_object_ref (gtk_text_ensure_layout (self, TRUE));
|
||||
text = pango_layout_get_text (layout);
|
||||
@ -4679,11 +4684,13 @@ gtk_text_draw_cursor (GtkText *self,
|
||||
else
|
||||
block = _gtk_text_util_get_block_cursor_location (layout,
|
||||
cursor_index, &cursor_rect, &block_at_line_end);
|
||||
|
||||
if (!block)
|
||||
{
|
||||
gtk_snapshot_render_insertion_cursor (snapshot, context,
|
||||
x, y,
|
||||
layout, cursor_index, priv->resolved_dir);
|
||||
gtk_css_boxes_init (&boxes, widget);
|
||||
gtk_css_style_snapshot_caret (&boxes, display, snapshot,
|
||||
x, y,
|
||||
layout, cursor_index, priv->resolved_dir);
|
||||
}
|
||||
else /* overwrite_mode */
|
||||
{
|
||||
@ -4696,14 +4703,12 @@ gtk_text_draw_cursor (GtkText *self,
|
||||
bounds.size.width = PANGO_PIXELS (cursor_rect.width);
|
||||
bounds.size.height = PANGO_PIXELS (cursor_rect.height);
|
||||
|
||||
gtk_style_context_save_to_node (context, priv->block_cursor_node);
|
||||
|
||||
style = gtk_css_node_get_style (priv->block_cursor_node);
|
||||
gtk_css_boxes_init_border_box (&boxes, style, 0, 0, width, height);
|
||||
gtk_snapshot_push_clip (snapshot, &bounds);
|
||||
gtk_snapshot_render_background (snapshot, context, 0, 0, width, height);
|
||||
gtk_snapshot_render_layout (snapshot, context, x, y, layout);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
gtk_css_style_snapshot_layout (&boxes,snapshot, x, y, layout);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
g_object_unref (layout);
|
||||
|
@ -81,7 +81,6 @@
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtktextbtreeprivate.h"
|
||||
#include "gtktextbufferprivate.h"
|
||||
#include "gtktextiterprivate.h"
|
||||
@ -92,6 +91,7 @@
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtktextviewprivate.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkrenderlayoutprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -4028,7 +4028,7 @@ render_para (GskPangoRenderer *crenderer,
|
||||
(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;
|
||||
graphene_rect_t bounds = {
|
||||
.origin.x = line_display->x_offset + line_display->block_cursor.x,
|
||||
@ -4040,8 +4040,8 @@ render_para (GskPangoRenderer *crenderer,
|
||||
/* we draw text using base color on filled cursor rectangle
|
||||
* of cursor color (normally white on black)
|
||||
*/
|
||||
context = _gtk_widget_get_style_context (crenderer->widget);
|
||||
_gtk_style_context_get_cursor_color (context, &cursor_color, NULL);
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (crenderer->widget));
|
||||
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_append_color (crenderer->snapshot, &cursor_color, &bounds);
|
||||
@ -4092,7 +4092,6 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
{
|
||||
GtkTextLayoutPrivate *priv;
|
||||
GskPangoRenderer *crenderer;
|
||||
GtkStyleContext *context;
|
||||
int offset_y;
|
||||
GtkTextIter selection_start, selection_end;
|
||||
int selection_start_line;
|
||||
@ -4105,6 +4104,7 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
GtkTextBTree *btree;
|
||||
GtkTextLine *first_line;
|
||||
GtkTextLine *last_line;
|
||||
GtkCssStyle *style;
|
||||
|
||||
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
|
||||
g_return_if_fail (layout->default_style != NULL);
|
||||
@ -4126,8 +4126,8 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
if (last_line == NULL)
|
||||
last_line = _gtk_text_btree_get_end_iter_line (btree);
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_color (context, &color);
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||
color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (0, offset_y));
|
||||
offset_y = 0;
|
||||
@ -4154,14 +4154,12 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
selection_end_line = gtk_text_iter_get_line (&selection_end);
|
||||
|
||||
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;
|
||||
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4257,9 +4255,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,9 +4275,9 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
||||
if (cursor.is_insert || cursor.is_selection_bound)
|
||||
gtk_snapshot_push_opacity (cursor_snapshot, cursor_alpha);
|
||||
|
||||
gtk_snapshot_render_insertion_cursor (cursor_snapshot, context,
|
||||
line_display->x_offset, offset_y + line_display->top_margin,
|
||||
line_display->layout, cursor.pos, dir);
|
||||
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);
|
||||
|
@ -28,12 +28,12 @@
|
||||
#include "gtktextutilprivate.h"
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtktextbuffer.h"
|
||||
#include "gtktextlayoutprivate.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkcssstyleprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
|
||||
#define DRAG_ICON_MAX_WIDTH 250
|
||||
#define DRAG_ICON_MAX_HEIGHT 250
|
||||
@ -140,16 +140,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);
|
||||
gtk_snapshot_render_background (snapshot,
|
||||
gtk_widget_get_style_context (bg_widget),
|
||||
0, 0, layout_width / PANGO_SCALE,
|
||||
layout_height / PANGO_SCALE);
|
||||
|
||||
style = gtk_css_node_get_style (gtk_widget_get_css_node (bg_widget));
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
0, 0,
|
||||
layout_width / PANGO_SCALE,
|
||||
layout_height / PANGO_SCALE);
|
||||
gtk_css_style_snapshot_background (&boxes, snapshot);
|
||||
}
|
||||
|
||||
gtk_snapshot_append_layout (snapshot, layout, color);
|
||||
@ -274,9 +279,13 @@ gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
|
||||
if (!gdk_display_is_rgba (display) ||
|
||||
!gdk_display_is_composited (display))
|
||||
{
|
||||
gtk_snapshot_render_background (snapshot,
|
||||
gtk_widget_get_style_context (widget),
|
||||
0, 0, layout_width, layout_height);
|
||||
GtkCssBoxes boxes;
|
||||
GtkCssStyle *css_style;
|
||||
|
||||
css_style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
|
||||
gtk_css_boxes_init_border_box (&boxes, css_style,
|
||||
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);
|
||||
|
@ -49,7 +49,6 @@
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtktextviewchildprivate.h"
|
||||
#include "gtktexthandleprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkpopover.h"
|
||||
#include "gtkmagnifierprivate.h"
|
||||
#include "gtkemojichooser.h"
|
||||
@ -59,6 +58,9 @@
|
||||
#include "gtkjoinedmenuprivate.h"
|
||||
#include "gtkcsslineheightvalueprivate.h"
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkrenderbackgroundprivate.h"
|
||||
#include "gtkrenderborderprivate.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -5844,8 +5846,9 @@ draw_text (GtkWidget *widget,
|
||||
{
|
||||
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
|
||||
GtkTextViewPrivate *priv = text_view->priv;
|
||||
GtkStyleContext *context;
|
||||
GtkCssStyle *style;
|
||||
gboolean did_save = FALSE;
|
||||
GtkCssBoxes boxes;
|
||||
|
||||
if (priv->border_window_size.left || priv->border_window_size.top)
|
||||
{
|
||||
@ -5862,17 +5865,13 @@ draw_text (GtkWidget *widget,
|
||||
SCREEN_WIDTH (widget),
|
||||
SCREEN_HEIGHT (widget)));
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_save_to_node (context, text_view->priv->text_window->css_node);
|
||||
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));
|
||||
gtk_style_context_restore (context);
|
||||
style = gtk_css_node_get_style (text_view->priv->text_window->css_node);
|
||||
gtk_css_boxes_init_border_box (&boxes, style,
|
||||
-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);
|
||||
|
||||
if (GTK_TEXT_VIEW_GET_CLASS (text_view)->snapshot_layer != NULL)
|
||||
{
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "gtkconstraint.h"
|
||||
#include "gtkcssboxesprivate.h"
|
||||
#include "gtkcssfiltervalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcsstransformvalueprivate.h"
|
||||
#include "gtkcsspositionvalueprivate.h"
|
||||
#include "gtkcssfontvariationsvalueprivate.h"
|
||||
@ -65,7 +66,7 @@
|
||||
#include "gtkshortcuttrigger.h"
|
||||
#include "gtksizegroup-private.h"
|
||||
#include "gtksnapshotprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "deprecated/gtkstylecontextprivate.h"
|
||||
#include "gtktooltipprivate.h"
|
||||
#include "gsktransformprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
@ -2442,8 +2443,10 @@ gtk_widget_root (GtkWidget *widget)
|
||||
priv->root = priv->parent->priv->root;
|
||||
}
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (priv->context)
|
||||
gtk_style_context_set_display (priv->context, gtk_root_get_display (priv->root));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (priv->surface_transform_data)
|
||||
add_parent_surface_transform_changed_listener (widget);
|
||||
@ -2479,8 +2482,10 @@ gtk_widget_unroot (GtkWidget *widget)
|
||||
|
||||
GTK_WIDGET_GET_CLASS (widget)->unroot (widget);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (priv->context)
|
||||
gtk_style_context_set_display (priv->context, gdk_display_get_default ());
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
if (priv->layout_manager)
|
||||
gtk_layout_manager_set_root (priv->layout_manager, NULL);
|
||||
@ -3410,10 +3415,12 @@ gtk_widget_realize (GtkWidget *widget)
|
||||
|
||||
g_signal_emit (widget, widget_signals[REALIZE], 0);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (priv->context)
|
||||
gtk_style_context_set_scale (priv->context, gtk_widget_get_scale_factor (widget));
|
||||
else
|
||||
gtk_widget_get_style_context (widget);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
gtk_widget_pop_verify_invariants (widget);
|
||||
}
|
||||
@ -6737,8 +6744,10 @@ _gtk_widget_scale_changed (GtkWidget *widget)
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (priv->context)
|
||||
gtk_style_context_set_scale (priv->context, gtk_widget_get_scale_factor (widget));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_SCALE_FACTOR]);
|
||||
|
||||
@ -10712,6 +10721,8 @@ _gtk_widget_peek_style_context (GtkWidget *widget)
|
||||
* for the lifetime of @widget.
|
||||
*
|
||||
* Returns: (transfer none): the widgets `GtkStyleContext`
|
||||
*
|
||||
* Deprecated: 4.10: Style contexts will be removed in GTK 5
|
||||
*/
|
||||
GtkStyleContext *
|
||||
gtk_widget_get_style_context (GtkWidget *widget)
|
||||
@ -10726,11 +10737,13 @@ gtk_widget_get_style_context (GtkWidget *widget)
|
||||
|
||||
priv->context = gtk_style_context_new_for_node (priv->cssnode);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
gtk_style_context_set_scale (priv->context, gtk_widget_get_scale_factor (widget));
|
||||
|
||||
display = _gtk_widget_get_display (widget);
|
||||
if (display)
|
||||
gtk_style_context_set_display (priv->context, display);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
}
|
||||
|
||||
return priv->context;
|
||||
@ -12857,6 +12870,33 @@ gtk_widget_set_css_classes (GtkWidget *widget,
|
||||
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CSS_CLASSES]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_widget_get_css_style:
|
||||
* @widget: a `GtkWidget`
|
||||
* @color: (out): return location for the color
|
||||
*
|
||||
* Gets the current foreground color for the widgets
|
||||
* CSS style.
|
||||
*
|
||||
* This function should only be used in snapshot
|
||||
* implementations that need need to do custom
|
||||
* drawing with the foreground color.
|
||||
*
|
||||
* Since: 4.10
|
||||
*/
|
||||
void
|
||||
gtk_widget_get_style_color (GtkWidget *widget,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||
GtkCssStyle *style;
|
||||
|
||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||
|
||||
style = gtk_css_node_get_style (priv->cssnode);
|
||||
*color = *gtk_css_color_value_get_rgba (style->core->color);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gtk_widget_update_orientation:
|
||||
* @widget: a `GtkWidget` implementing `GtkOrientable`
|
||||
|
@ -706,7 +706,7 @@ void gtk_requisition_free (GtkRequisition *requisition);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_widget_in_destruction (GtkWidget *widget);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_10
|
||||
GtkStyleContext * gtk_widget_get_style_context (GtkWidget *widget);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
@ -928,7 +928,9 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_widget_set_css_classes (GtkWidget *widget,
|
||||
const char **classes);
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
void gtk_widget_get_style_color (GtkWidget *widget,
|
||||
GdkRGBA *rgba);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -446,15 +446,6 @@ _gtk_widget_get_display (GtkWidget *widget)
|
||||
return gtk_root_get_display (root);
|
||||
}
|
||||
|
||||
static inline GtkStyleContext *
|
||||
_gtk_widget_get_style_context (GtkWidget *widget)
|
||||
{
|
||||
if (G_LIKELY (widget->priv->context))
|
||||
return widget->priv->context;
|
||||
|
||||
return gtk_widget_get_style_context (widget);
|
||||
}
|
||||
|
||||
static inline gpointer
|
||||
_gtk_widget_peek_request_cache (GtkWidget *widget)
|
||||
{
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#include "gtkcssprovider.h"
|
||||
#include "gtkstyleprovider.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtktextview.h"
|
||||
#include "gtkmessagedialog.h"
|
||||
#include "gtkfilechooserdialog.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "graphdata.h"
|
||||
|
||||
#include "gtksnapshot.h"
|
||||
#include "gtkstylecontext.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
@ -131,7 +130,6 @@ graph_renderer_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GraphRenderer *self = GRAPH_RENDERER (widget);
|
||||
GtkStyleContext *context;
|
||||
double minimum, maximum, diff;
|
||||
double x, y, width, height;
|
||||
cairo_t *cr;
|
||||
@ -155,8 +153,7 @@ graph_renderer_snapshot (GtkWidget *widget,
|
||||
|
||||
diff = maximum - minimum;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_color (context, &color);
|
||||
gtk_widget_get_style_color (widget, &color);
|
||||
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
|
@ -63,7 +63,6 @@
|
||||
#include "gtkrevealer.h"
|
||||
#include "gtklayoutmanager.h"
|
||||
#include "gtkcssprovider.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
|
||||
|
@ -313,10 +313,10 @@ gtk_public_sources = files([
|
||||
'gtkpropertylookuplistmodel.c',
|
||||
'gtkrange.c',
|
||||
'gtkrecentmanager.c',
|
||||
'gtkrender.c',
|
||||
'gtkrenderbackground.c',
|
||||
'gtkrenderborder.c',
|
||||
'gtkrendericon.c',
|
||||
'gtkrenderlayout.c',
|
||||
'gtkrendernodepaintable.c',
|
||||
'gtkrevealer.c',
|
||||
'gtkroot.c',
|
||||
@ -362,7 +362,6 @@ gtk_public_sources = files([
|
||||
'gtkstringfilter.c',
|
||||
'gtkstringlist.c',
|
||||
'gtkstringsorter.c',
|
||||
'gtkstylecontext.c',
|
||||
'gtkstyleprovider.c',
|
||||
'gtkswitch.c',
|
||||
'gtksymbolicpaintable.c',
|
||||
@ -561,7 +560,6 @@ gtk_public_headers = files([
|
||||
'gtkprogressbar.h',
|
||||
'gtkrange.h',
|
||||
'gtkrecentmanager.h',
|
||||
'gtkrender.h',
|
||||
'gtkrevealer.h',
|
||||
'gtkroot.h',
|
||||
'gtkscale.h',
|
||||
@ -603,7 +601,6 @@ gtk_public_headers = files([
|
||||
'gtkstringfilter.h',
|
||||
'gtkstringlist.h',
|
||||
'gtkstringsorter.h',
|
||||
'gtkstylecontext.h',
|
||||
'gtkstyleprovider.h',
|
||||
'gtkswitch.h',
|
||||
'gtksymbolicpaintable.h',
|
||||
|
@ -2,6 +2,8 @@
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
G_DECLARE_FINAL_TYPE (DemoWidget, demo_widget, DEMO, WIDGET, GtkWidget)
|
||||
|
||||
struct _DemoWidget
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static GtkWidget *
|
||||
oriented_test_widget (const char *label, const char *color)
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static void
|
||||
unset_title (GtkWidget *window)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
typedef struct _GtkFocusWidget GtkFocusWidget;
|
||||
typedef struct _GtkFocusWidgetClass GtkFocusWidgetClass;
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "testsuite/testutils.h"
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
@ -27,6 +27,7 @@
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
static char *
|
||||
test_get_reference_file (const char *ui_file)
|
||||
|
@ -27,6 +27,8 @@
|
||||
# include <io.h>
|
||||
#endif
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
|
||||
/* There shall be no other styles */
|
||||
#define GTK_STYLE_PROVIDER_PRIORITY_FORCE G_MAXUINT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user