[epiphany] Adjust address bar popover position
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Adjust address bar popover position
- Date: Sat, 3 Aug 2019 22:41:01 +0000 (UTC)
commit 3058eab3a3b7894afd7db874b01585f3e1e33c01
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Sun Jul 28 17:22:57 2019 +0200
Adjust address bar popover position
Set an own position function for the popover and move it down by 6px.
Fixes: https://gitlab.gnome.org/GNOME/epiphany/issues/855
lib/widgets/ephy-location-entry.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
---
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index d26020e11..972cd0e95 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -840,6 +840,39 @@ leave_notify_cb (GtkWidget *widget,
gtk_widget_unset_state_flags (widget, GTK_STATE_FLAG_PRELIGHT);
}
+static void
+position_func (DzlSuggestionEntry *self,
+ GdkRectangle *area,
+ gboolean *is_absolute,
+ gpointer user_data)
+{
+ GtkStyleContext *style_context;
+ GtkAllocation alloc;
+ GtkStateFlags state;
+ GtkBorder margin;
+
+ g_assert (DZL_IS_SUGGESTION_ENTRY (self));
+ g_assert (area != NULL);
+ g_assert (is_absolute != NULL);
+
+ *is_absolute = FALSE;
+
+ gtk_widget_get_allocation (GTK_WIDGET (self), &alloc);
+
+ area->y += alloc.height;
+ area->y += 6;
+ area->height = 300;
+
+ /* Adjust for bottom margin */
+ style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
+ state = gtk_style_context_get_state (style_context);
+ gtk_style_context_get_margin (style_context, state, &margin);
+
+ area->y -= margin.bottom;
+ area->x += margin.left;
+ area->width -= margin.left + margin.right;
+}
+
static void
ephy_location_entry_construct_contents (EphyLocationEntry *entry)
{
@@ -851,6 +884,7 @@ ephy_location_entry_construct_contents (EphyLocationEntry *entry)
/* URL entry */
entry->url_entry = dzl_suggestion_entry_new ();
+ dzl_suggestion_entry_set_position_func (DZL_SUGGESTION_ENTRY (entry->url_entry), position_func, NULL,
NULL);
gtk_entry_set_icon_tooltip_text (GTK_ENTRY (entry->url_entry), GTK_ENTRY_ICON_PRIMARY, _("Show website
security status and permissions"));
/* Add special widget css provider */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]