[gtksourceview/wip/chergert/gsv-gtk4] assistants: handle GTK_POS_TOP separately from other cases



commit a8a74166c615d0c9a46d7227c813647e51749010
Author: Christian Hergert <chergert redhat com>
Date:   Wed Sep 9 14:17:12 2020 -0700

    assistants: handle GTK_POS_TOP separately from other cases

 gtksourceview/gtksourceassistant.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/gtksourceassistant.c b/gtksourceview/gtksourceassistant.c
index 9471ae42..1f08abcc 100644
--- a/gtksourceview/gtksourceassistant.c
+++ b/gtksourceview/gtksourceassistant.c
@@ -177,16 +177,27 @@ _gtk_source_assistant_real_get_offset (GtkSourceAssistant *assistant,
 {
        GtkStyleContext *style_context;
        GtkBorder margin;
+       GtkPositionType pos;
 
        g_assert (GTK_SOURCE_IS_ASSISTANT (assistant));
        g_assert (x != NULL);
        g_assert (y != NULL);
 
+       pos = gtk_popover_get_position (GTK_POPOVER (assistant));
+
        style_context = gtk_widget_get_style_context (GTK_WIDGET (assistant));
        gtk_style_context_get_margin (style_context, &margin);
 
        *x = -margin.left;
-       *y = -margin.top + 1;
+
+       if (pos != GTK_POS_TOP)
+       {
+               *y = -margin.top + 1;
+       }
+       else
+       {
+               *y = margin.bottom - 1;
+       }
 }
 
 static void


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