Fix clicking to the RHS of text box widgets - now places caret in correct position. Thanks to Dobos D.Calin <calin.dobos@info.uaic.ro>. The second part of this patch has not been included, pending further investigation.
svn path=/trunk/netsurf/; revision=4033
This commit is contained in:
parent
0588417b3c
commit
c95b8ea927
|
@ -111,13 +111,17 @@ bool nsfont_position_in_string(const struct css_style *style,
|
||||||
pango_layout_set_text(layout, string, length);
|
pango_layout_set_text(layout, string, length);
|
||||||
|
|
||||||
pango_layout_xy_to_index(layout, x * PANGO_SCALE, 0, &index, 0);
|
pango_layout_xy_to_index(layout, x * PANGO_SCALE, 0, &index, 0);
|
||||||
|
if (pango_layout_xy_to_index(layout, x * PANGO_SCALE,
|
||||||
|
0, &index, 0) == 0)
|
||||||
|
index = length;
|
||||||
|
|
||||||
pango_layout_index_to_pos(layout, index, &pos);
|
pango_layout_index_to_pos(layout, index, &pos);
|
||||||
|
|
||||||
g_object_unref(layout);
|
g_object_unref(layout);
|
||||||
g_object_unref(context);
|
g_object_unref(context);
|
||||||
pango_font_description_free(desc);
|
pango_font_description_free(desc);
|
||||||
|
|
||||||
*char_offset = index?index+1:0;
|
*char_offset = index;
|
||||||
*actual_x = PANGO_PIXELS(pos.x);
|
*actual_x = PANGO_PIXELS(pos.x);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue