[libdazzle] suggestion: adjust for margin of entry if any
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] suggestion: adjust for margin of entry if any
- Date: Wed, 28 Nov 2018 18:44:29 +0000 (UTC)
commit 33c68229acf35fd84f0174f3be2bc8f4629775d6
Author: Christian Hergert <chergert redhat com>
Date: Wed Nov 28 10:44:17 2018 -0800
suggestion: adjust for margin of entry if any
src/suggestions/dzl-suggestion-entry.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/src/suggestions/dzl-suggestion-entry.c b/src/suggestions/dzl-suggestion-entry.c
index f611798..fc67fc4 100644
--- a/src/suggestions/dzl-suggestion-entry.c
+++ b/src/suggestions/dzl-suggestion-entry.c
@@ -811,7 +811,10 @@ dzl_suggestion_entry_default_position_func (DzlSuggestionEntry *self,
gboolean *is_absolute,
gpointer user_data)
{
+ GtkStyleContext *style_context;
GtkAllocation alloc;
+ GtkStateFlags state;
+ GtkBorder margin;
g_return_if_fail (DZL_IS_SUGGESTION_ENTRY (self));
g_return_if_fail (area != NULL);
@@ -823,6 +826,15 @@ dzl_suggestion_entry_default_position_func (DzlSuggestionEntry *self,
area->y += alloc.height;
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;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]