forked from AuroraMiddleware/gtk
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
This commit is contained in:
parent
bd3b53c4c7
commit
9894b89bd9
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-10-23 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-10-23 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-10-23 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-10-23 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-10-23 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-10-23 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
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>
|
2001-10-23 Havoc Pennington <hp@redhat.com>
|
||||||
|
|
||||||
* gtk/gtktextview.c (gtk_text_view_update_im_spot_location):
|
* 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 (GTK_IS_TEXT_LAYOUT (layout));
|
||||||
g_return_if_fail (target_iter != NULL);
|
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);
|
get_line_at_y (layout, y, &line, &line_top);
|
||||||
|
|
||||||
display = gtk_text_layout_get_line_display (layout, line, FALSE);
|
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;
|
x -= display->x_offset;
|
||||||
y -= line_top + display->top_margin;
|
y -= line_top + display->top_margin;
|
||||||
|
|
||||||
/* We clamp y to the area of the actual layout so that the layouts
|
/* If we are below the layout, position the cursor at the last character
|
||||||
* hit testing works OK on the space above and below the layout
|
* of the line.
|
||||||
*/
|
*/
|
||||||
y = CLAMP (y, 0, display->height - display->top_margin - display->bottom_margin - 1);
|
if (y > display->height - display->top_margin - display->bottom_margin)
|
||||||
|
|
||||||
if (!pango_layout_xy_to_index (display->layout, x * PANGO_SCALE, y * PANGO_SCALE,
|
|
||||||
&byte_index, &trailing))
|
|
||||||
{
|
{
|
||||||
byte_index = _gtk_text_line_byte_count (line);
|
byte_index = _gtk_text_line_byte_count (line);
|
||||||
trailing = 0;
|
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);
|
line_display_index_to_iter (layout, display, target_iter, byte_index, trailing);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user