Commit 9894b89b authored by Havoc Pennington's avatar Havoc Pennington Committed by Havoc Pennington

Apply fix from Dov Grobgeld, #61858

2001-10-23  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
	fix from Dov Grobgeld, #61858
parent bd3b53c4
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
fix from Dov Grobgeld, #61858
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
......
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
fix from Dov Grobgeld, #61858
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
......
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
fix from Dov Grobgeld, #61858
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
......
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
fix from Dov Grobgeld, #61858
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
......
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
fix from Dov Grobgeld, #61858
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
......
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
fix from Dov Grobgeld, #61858
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
......
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (gtk_text_layout_get_iter_at_pixel): Apply
fix from Dov Grobgeld, #61858
2001-10-23 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
......
......@@ -2117,14 +2117,6 @@ gtk_text_layout_get_iter_at_pixel (GtkTextLayout *layout,
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
g_return_if_fail (target_iter != NULL);
/* Adjust pixels to be on-screen. This gives nice
behavior if the user is dragging with a pointer grab.
*/
if (x < 0)
x = 0;
if (x > layout->width)
x = layout->width;
get_line_at_y (layout, y, &line, &line_top);
display = gtk_text_layout_get_line_display (layout, line, FALSE);
......@@ -2132,17 +2124,23 @@ gtk_text_layout_get_iter_at_pixel (GtkTextLayout *layout,
x -= display->x_offset;
y -= line_top + display->top_margin;
/* We clamp y to the area of the actual layout so that the layouts
* hit testing works OK on the space above and below the layout
/* If we are below the layout, position the cursor at the last character
* of the line.
*/
y = CLAMP (y, 0, display->height - display->top_margin - display->bottom_margin - 1);
if (!pango_layout_xy_to_index (display->layout, x * PANGO_SCALE, y * PANGO_SCALE,
&byte_index, &trailing))
if (y > display->height - display->top_margin - display->bottom_margin)
{
byte_index = _gtk_text_line_byte_count (line);
trailing = 0;
}
else
{
/* Ignore the "outside" return value from pango. Pango is doing
* the right thing even if we are outside the layout in the
* x-direction.
*/
pango_layout_xy_to_index (display->layout, x * PANGO_SCALE, y * PANGO_SCALE,
&byte_index, &trailing);
}
line_display_index_to_iter (layout, display, target_iter, byte_index, trailing);
......
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