[gtksourceview/wip/chergert/gsv-gtk4] completion: track changes to GdkPopup and surface usage
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4] completion: track changes to GdkPopup and surface usage
- Date: Tue, 17 Mar 2020 20:32:03 +0000 (UTC)
commit 0485b6a190395e03cafb9ea588e08ac53e815fe3
Author: Christian Hergert <chergert redhat com>
Date: Tue Mar 17 13:07:51 2020 -0700
completion: track changes to GdkPopup and surface usage
gtksourceview/gtksourcecompletion.c | 22 +++++++++++-----------
gtksourceview/gtksourcecompletioninfo.c | 11 +++++------
2 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 53d84999..3ee8cb88 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -741,30 +741,30 @@ update_info_position (GtkSourceCompletion *completion)
{
GdkSurface *main_surface;
GdkSurface *info_surface;
+ GdkSurface *view_surface;
GdkPopupLayout *layout;
+ GtkRoot *root;
GdkRectangle geom;
if (!GTK_IS_NATIVE (completion->main_window) ||
- !GTK_IS_NATIVE (completion->info_window))
+ !(main_surface = gtk_native_get_surface (GTK_NATIVE (completion->main_window))) ||
+ !GTK_IS_NATIVE (completion->info_window) ||
+ !(info_surface = gtk_native_get_surface (GTK_NATIVE (completion->info_window))) ||
+ !(root = gtk_widget_get_root (GTK_WIDGET (completion->view))) ||
+ !GTK_IS_NATIVE (root) ||
+ !(view_surface = gtk_native_get_surface (GTK_NATIVE (root))))
{
return;
}
- main_surface = gtk_native_get_surface (GTK_NATIVE (completion->main_window));
- info_surface = gtk_native_get_surface (GTK_NATIVE (completion->info_window));
-
- if (main_surface == NULL || info_surface == NULL)
- {
- return;
- }
-
- gdk_surface_get_position (main_surface, &geom.x, &geom.y);
+ geom.x = gdk_popup_get_position_x (GDK_POPUP (main_surface));
+ geom.y = gdk_popup_get_position_y (GDK_POPUP (main_surface));
geom.width = gdk_surface_get_width (main_surface);
geom.height = gdk_surface_get_height (main_surface);
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_present (GDK_POPUP (info_surface), geom.width, geom.height, layout);
gdk_popup_layout_unref (layout);
}
diff --git a/gtksourceview/gtksourcecompletioninfo.c b/gtksourceview/gtksourcecompletioninfo.c
index 239b0bde..ed21886c 100644
--- a/gtksourceview/gtksourcecompletioninfo.c
+++ b/gtksourceview/gtksourcecompletioninfo.c
@@ -199,6 +199,7 @@ move_to_iter (GtkSourceCompletionInfo *window,
GtkTextIter *iter)
{
GdkRectangle location;
+ GdkPopupLayout *layout;
GdkSurface *surface;
GtkRoot *root;
@@ -228,12 +229,10 @@ move_to_iter (GtkSourceCompletionInfo *window,
&location.x,
&location.y);
- gdk_surface_move_to_rect (surface,
- &location,
- GDK_GRAVITY_SOUTH_WEST,
- GDK_GRAVITY_NORTH_WEST,
- GDK_ANCHOR_FLIP_Y,
- 0, 0);
+ layout = gdk_popup_layout_new (&location, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST);
+ gdk_popup_layout_set_anchor_hints (layout, GDK_ANCHOR_FLIP_Y);
+ gdk_popup_present (GDK_POPUP (surface), 0, 0, layout);
+ gdk_popup_layout_unref (layout);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]