[gtksourceview] hoverassistant: adjust target location by child left margin



commit 23ffbdf4975d1e66a169408966430cb85205fea1
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 6 13:56:36 2022 -0700

    hoverassistant: adjust target location by child left margin
    
    This way things still relatively line up with the text inside the hover
    assistant popover.

 gtksourceview/gtksourcehoverassistant.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gtksourceview/gtksourcehoverassistant.c b/gtksourceview/gtksourcehoverassistant.c
index 6c634c7d..49f8591e 100644
--- a/gtksourceview/gtksourcehoverassistant.c
+++ b/gtksourceview/gtksourcehoverassistant.c
@@ -283,7 +283,16 @@ static void
 gtk_source_hover_assistant_get_target_location (GtkSourceAssistant *assistant,
                                                 GdkRectangle       *rect)
 {
+       GtkSourceHoverAssistant *self = GTK_SOURCE_HOVER_ASSISTANT (assistant);
+       GtkStyleContext *style_context;
+       GtkBorder padding;
+
        *rect = GTK_SOURCE_HOVER_ASSISTANT (assistant)->hovered_at;
+
+       style_context = gtk_widget_get_style_context (GTK_WIDGET (self->display));
+       gtk_style_context_get_padding (style_context, &padding);
+
+       rect->x -= padding.left;
 }
 
 static void


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