[gtk/wip/baedert/for-master: 43/54] stylecontext: Remove render_insertion_cursor()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 43/54] stylecontext: Remove render_insertion_cursor()
- Date: Tue, 13 Oct 2020 03:55:31 +0000 (UTC)
commit fa6792755bb8b76a01199ae2c940b91231c3519c
Author: Timm Bäder <mail baedert org>
Date: Sun Oct 11 11:40:31 2020 +0200
stylecontext: Remove render_insertion_cursor()
This is unused and there already is a snapshot alternative.
gtk/gtkstylecontext.c | 97 ---------------------------------------------------
gtk/gtkstylecontext.h | 10 ------
2 files changed, 107 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 6bd587c927..4150df3ae7 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -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
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index 09cce1a0bc..ae3a474f05 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]