Commit f89aeecc authored by Matthias Clasen's avatar Matthias Clasen

Merge branch 'cursor-aspect-ratio-gtk3' into 'gtk-3-24'

Cursor aspect ratio fixes for gtk 3

See merge request !2965
parents eec24a09 2a89189f
Pipeline #240609 passed with stages
in 31 minutes and 23 seconds
......@@ -2448,6 +2448,7 @@ gtk_settings_set_property_value_internal (GtkSettings *settings,
GQuark name_quark;
if (!G_VALUE_HOLDS_LONG (&new_value->value) &&
!G_VALUE_HOLDS_FLOAT (&new_value->value) &&
!G_VALUE_HOLDS_DOUBLE (&new_value->value) &&
!G_VALUE_HOLDS_STRING (&new_value->value) &&
!G_VALUE_HOLDS (&new_value->value, G_TYPE_GSTRING))
......@@ -3443,14 +3444,20 @@ gtk_settings_load_from_key_file (GtkSettings *settings,
break;
}
case G_TYPE_FLOAT:
case G_TYPE_DOUBLE:
{
gdouble d_val;
g_value_init (&svalue.value, G_TYPE_DOUBLE);
g_value_init (&svalue.value, value_type);
d_val = g_key_file_get_double (keyfile, "Settings", key, &error);
if (!error)
g_value_set_double (&svalue.value, d_val);
{
if (value_type == G_TYPE_FLOAT)
g_value_set_float (&svalue.value, (float) d_val);
else
g_value_set_double (&svalue.value, d_val);
}
break;
}
......
......@@ -2916,6 +2916,14 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
"gtk-cursor-aspect-ratio", &aspect_ratio,
NULL);
/* Fall back to style property if the GtkSetting property is unchanged */
if (aspect_ratio == 0.04f)
{
gtk_style_context_get_style (context,
"cursor-aspect-ratio", &aspect_ratio,
NULL);
}
keymap_direction = gdk_keymap_get_direction (gdk_keymap_get_for_display (gdk_screen_get_display (priv->screen)));
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
......@@ -3003,6 +3011,14 @@ gtk_draw_insertion_cursor (GtkWidget *widget,
"gtk-cursor-aspect-ratio", &aspect_ratio,
NULL);
/* Fall back to style property if the GtkSetting property is unchanged */
if (aspect_ratio == 0.04f)
{
gtk_style_context_get_style (context,
"cursor-aspect-ratio", &aspect_ratio,
NULL);
}
draw_insertion_cursor (context, cr,
location->x, location->y, location->height,
aspect_ratio,
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment