summaryrefslogtreecommitdiff
path: root/frontends/gtk/toolbar.c
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2020-05-08 20:46:37 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2020-05-08 20:46:37 +0100
commit4b8ed9b7775aec686a46b1b2be01a4efa1214e55 (patch)
tree02c359c4946a039a2a9acf374c6fc29768f13c1c /frontends/gtk/toolbar.c
parent14e506f89f971ddbe204576092c6ffec59e85248 (diff)
downloadnetsurf-4b8ed9b7775aec686a46b1b2be01a4efa1214e55.tar.gz
netsurf-4b8ed9b7775aec686a46b1b2be01a4efa1214e55.tar.bz2
GTK: Cause the page-info popup to appear in the right place
To position the page-info window we have to tunnel all the way from the current scaffolding, via its top-level gui window, through to the toolbar. In the toolbar we look up the URL bar and then determine the screen coordinates of the scaffolding via the top level widget GTK semantics. Finally we place the page-info window 4 pixels down and right of the bottom-left of the entry box, which should look nice. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'frontends/gtk/toolbar.c')
-rw-r--r--frontends/gtk/toolbar.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index f2b1d05c8..c6028c94b 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -3799,3 +3799,27 @@ nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb)
return res;
}
+
+/* exported interface documented in toolbar.h */
+nserror nsgtk_toolbar_position_page_info(struct nsgtk_toolbar *tb,
+ struct nsgtk_pi_window *win)
+{
+ struct nsgtk_toolbar_item *item = &tb->items[URL_BAR_ITEM];
+ GtkWidget *widget = GTK_WIDGET(gtk_bin_get_child(GTK_BIN(item->button)));
+ gint rootx, rooty, x, y;
+
+ if (gtk_widget_translate_coordinates(widget,
+ gtk_widget_get_toplevel(widget),
+ 0,
+ gtk_widget_get_allocated_height(widget) - 1,
+ &x, &y) != TRUE) {
+ return NSERROR_UNKNOWN;
+ }
+
+ gtk_window_get_position(GTK_WINDOW(gtk_widget_get_toplevel(widget)),
+ &rootx, &rooty);
+
+ nsgtk_page_info_set_position(win, rootx + x + 4, rooty + y + 4);
+
+ return NSERROR_OK;
+}