[gtksourceview/wip/chergert/gsv-gtk4: 140/189] completion: use GdkPopupLayout API



commit 5132889d50e4c98c3eaad7c5fccd3aaf537a0df0
Author: Christian Hergert <chergert redhat com>
Date:   Fri Mar 6 15:53:57 2020 -0800

    completion: use GdkPopupLayout API

 gtksourceview/gtksourcecompletion.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index f1cd6656..00ffd57f 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -738,6 +738,7 @@ update_info_position (GtkSourceCompletion *completion)
 {
        GdkSurface *main_surface;
        GdkSurface *info_surface;
+       GdkPopupLayout *layout;
        GdkRectangle geom;
 
        if (!GTK_IS_NATIVE (completion->main_window) ||
@@ -758,12 +759,10 @@ update_info_position (GtkSourceCompletion *completion)
        geom.width = gdk_surface_get_width (main_surface);
        geom.height = gdk_surface_get_height (main_surface);
 
-       gdk_surface_move_to_rect (info_surface,
-                                 &geom,
-                                 GDK_GRAVITY_NORTH_EAST,
-                                 GDK_GRAVITY_NORTH_WEST,
-                                 GDK_ANCHOR_FLIP_X,
-                                 0, 0);
+       layout = gdk_popup_layout_new (&geom, GDK_GRAVITY_NORTH_EAST, GDK_GRAVITY_NORTH_WEST);
+       gdk_popup_layout_set_anchor_hints (layout, GDK_ANCHOR_FLIP_X);
+       gdk_surface_present_popup (info_surface, geom.width, geom.height, layout);
+       gdk_popup_layout_unref (layout);
 }
 
 static GtkSourceCompletionProvider *


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