mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 05:50:10 +00:00
stylecontext: Remove render_insertion_cursor()
This is unused and there already is a snapshot alternative.
This commit is contained in:
parent
18c4bdad6f
commit
2bcef7f030
@ -1114,103 +1114,6 @@ snapshot_insertion_cursor (GtkSnapshot *snapshot,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_render_insertion_cursor:
|
||||
* @context: a #GtkStyleContext
|
||||
* @cr: a #cairo_t
|
||||
* @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 on @cr at the specified index of @layout.
|
||||
**/
|
||||
void
|
||||
gtk_render_insertion_cursor (GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction)
|
||||
{
|
||||
GtkStyleContextPrivate *priv = gtk_style_context_get_instance_private (context);
|
||||
gboolean split_cursor;
|
||||
float aspect_ratio;
|
||||
PangoRectangle strong_pos, weak_pos;
|
||||
PangoRectangle *cursor1, *cursor2;
|
||||
GdkSeat *seat;
|
||||
GdkDevice *keyboard;
|
||||
PangoDirection keyboard_direction;
|
||||
PangoDirection direction2;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
g_return_if_fail (cr != NULL);
|
||||
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);
|
||||
|
||||
seat = gdk_display_get_default_seat (priv->display);
|
||||
if (seat)
|
||||
keyboard = gdk_seat_get_keyboard (seat);
|
||||
else
|
||||
keyboard = NULL;
|
||||
if (keyboard)
|
||||
keyboard_direction = gdk_device_get_direction (keyboard);
|
||||
else
|
||||
keyboard_direction = PANGO_DIRECTION_LTR;
|
||||
|
||||
pango_layout_get_cursor_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;
|
||||
}
|
||||
|
||||
draw_insertion_cursor (context,
|
||||
cr,
|
||||
x + PANGO_PIXELS (cursor1->x),
|
||||
y + PANGO_PIXELS (cursor1->y),
|
||||
PANGO_PIXELS (cursor1->height),
|
||||
aspect_ratio,
|
||||
TRUE,
|
||||
direction,
|
||||
direction2 != PANGO_DIRECTION_NEUTRAL);
|
||||
|
||||
if (direction2 != PANGO_DIRECTION_NEUTRAL)
|
||||
{
|
||||
draw_insertion_cursor (context,
|
||||
cr,
|
||||
x + PANGO_PIXELS (cursor2->x),
|
||||
y + PANGO_PIXELS (cursor2->y),
|
||||
PANGO_PIXELS (cursor2->height),
|
||||
aspect_ratio,
|
||||
FALSE,
|
||||
direction2,
|
||||
TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_snapshot_render_insertion_cursor:
|
||||
* @snapshot: snapshot to render to
|
||||
|
@ -130,16 +130,6 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_style_context_get_margin (GtkStyleContext *context,
|
||||
GtkBorder *margin);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_render_insertion_cursor
|
||||
(GtkStyleContext *context,
|
||||
cairo_t *cr,
|
||||
double x,
|
||||
double y,
|
||||
PangoLayout *layout,
|
||||
int index,
|
||||
PangoDirection direction);
|
||||
|
||||
typedef enum {
|
||||
GTK_STYLE_CONTEXT_PRINT_NONE = 0,
|
||||
GTK_STYLE_CONTEXT_PRINT_RECURSE = 1 << 0,
|
||||
|
Loading…
Reference in New Issue
Block a user