[gtksourceview/wip/chergert/gsv-gtk4: 184/192] completion: track translation changes in GTK




commit 84793436e6d6a6ffa8824980b5db6ecac36e20f9
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 18 16:20:33 2020 -0700

    completion: track translation changes in GTK

 gtksourceview/gtksourcecompletion.c     | 5 +++--
 gtksourceview/gtksourcecompletioninfo.c | 9 +++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 15c8f216a..a825b358a 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -614,6 +614,7 @@ gtk_source_completion_proposals_size_allocate (GtkSourceCompletion *completion,
        gint cell_offset = 0;
        gint column_offset;
        gint x_offset = 0;
+       gdouble x_translated;
 
        if (!gtk_widget_get_realized (GTK_WIDGET (completion->tree_view_proposals)))
        {
@@ -638,10 +639,10 @@ gtk_source_completion_proposals_size_allocate (GtkSourceCompletion *completion,
                                          GTK_WIDGET (completion->main_window),
                                          x_offset,
                                          0,
-                                         &x_offset,
+                                         &x_translated,
                                          NULL);
 
-       _gtk_source_completion_info_set_xoffset (completion->main_window, -x_offset);
+       _gtk_source_completion_info_set_xoffset (completion->main_window, -x_translated);
 }
 
 static void
diff --git a/gtksourceview/gtksourcecompletioninfo.c b/gtksourceview/gtksourcecompletioninfo.c
index 6bd40acce..cbb1df1f6 100644
--- a/gtksourceview/gtksourcecompletioninfo.c
+++ b/gtksourceview/gtksourcecompletioninfo.c
@@ -202,6 +202,8 @@ move_to_iter (GtkSourceCompletionInfo *window,
        GdkPopupLayout *layout;
        GdkSurface *surface;
        GtkRoot *root;
+       gdouble x;
+       gdouble y;
 
        if (!GTK_IS_NATIVE (window))
                return;
@@ -226,8 +228,11 @@ move_to_iter (GtkSourceCompletionInfo *window,
                                          GTK_WIDGET (root),
                                          location.x + window->xoffset,
                                          location.y,
-                                         &location.x,
-                                         &location.y);
+                                         &x,
+                                         &y);
+
+       location.x = x;
+       location.y = y;
 
        layout = gdk_popup_layout_new (&location, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST);
        gdk_popup_layout_set_anchor_hints (layout, GDK_ANCHOR_SLIDE | GDK_ANCHOR_FLIP_Y | GDK_ANCHOR_RESIZE);


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