[gtk/matthiasc/for-main] textview: Avoid misplacing the Emoji chooser



commit b3b0321620ae3a76b893c8b8bc84b8025fb2280f
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Nov 30 19:44:26 2021 -0500

    textview: Avoid misplacing the Emoji chooser
    
    When the iter is at the end of the buffer,
    gtk_text_view_get_iter_location returns a
    rectangle with width 0, which in turn makes
    gdk_rectangle_intersect return FALSE.
    
    Avoid that by always giving the rectangle
    non-empty dimensions.
    
    Fixes: #4503

 gtk/gtktextview.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index f576aaf748..c1b83eb9b3 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -10012,6 +10012,10 @@ gtk_text_view_insert_emoji (GtkTextView *text_view)
                                     gtk_text_buffer_get_insert (buffer));
 
   gtk_text_view_get_iter_location (text_view, &iter, (GdkRectangle *) &rect);
+
+  rect.width = MAX (rect.width, 1);
+  rect.height = MAX (rect.height, 1);
+
   gtk_text_view_buffer_to_window_coords (text_view, GTK_TEXT_WINDOW_TEXT,
                                          rect.x, rect.y, &rect.x, &rect.y);
   _text_window_to_widget_coords (text_view, &rect.x, &rect.y);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]