[gtk/gtk-3-24: 3/4] textview: Use correct aspect ratio when invaldiating cursor
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24: 3/4] textview: Use correct aspect ratio when invaldiating cursor
- Date: Mon, 21 Dec 2020 19:26:40 +0000 (UTC)
commit 2a89189f1a68e0dcd08803855975fcda5e9b3486
Author: Sebastian Keller <skeller gnome org>
Date: Wed Dec 16 18:51:10 2020 +0100
textview: Use correct aspect ratio when invaldiating cursor
The size of the cursor depends on either the gtk-cursor-aspect-ratio
GtkSetting or as of the previous commit on the GtkSetting or the
cursor-aspect-ratio style property. GtkTextView was only considering the
style property.
Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/3441
gtk/gtktextview.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index ba7de83c76..6b26a48798 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -10258,9 +10258,17 @@ text_window_invalidate_cursors (GtkTextWindow *win)
draw_arrow = (strong.x != weak.x || strong.y != weak.y);
- gtk_widget_style_get (win->widget,
- "cursor-aspect-ratio", &cursor_aspect_ratio,
- NULL);
+ g_object_get (gtk_widget_get_settings (win->widget),
+ "gtk-cursor-aspect-ratio", &cursor_aspect_ratio,
+ NULL);
+
+ /* Fall back to style property if the GtkSetting property is unchanged */
+ if (cursor_aspect_ratio == 0.04f)
+ {
+ gtk_widget_style_get (win->widget,
+ "cursor-aspect-ratio", &cursor_aspect_ratio,
+ NULL);
+ }
stem_width = strong.height * cursor_aspect_ratio + 1;
arrow_width = stem_width + 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]