[gnome-text-editor] page: fix positioning of search bar
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-text-editor] page: fix positioning of search bar
- Date: Sun, 20 Feb 2022 21:11:09 +0000 (UTC)
commit f284e3acb63c83be9e0df8070d45a1730a6128b8
Author: Christian Hergert <christian hergert me>
Date: Sun Feb 20 13:10:41 2022 -0800
page: fix positioning of search bar
This fixes the under allocation as well as the placement not going over
the map when it was supposed to.
Fixes #316
src/editor-page.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/editor-page.c b/src/editor-page.c
index 307a171..b83d210 100644
--- a/src/editor-page.c
+++ b/src/editor-page.c
@@ -503,6 +503,7 @@ get_child_position_cb (GtkOverlay *overlay,
EditorPage *self)
{
GtkRequisition min, nat, map_min;
+ GtkAllocation ov_alloc;
g_assert (GTK_IS_OVERLAY (overlay));
g_assert (GTK_IS_WIDGET (child));
@@ -513,12 +514,13 @@ get_child_position_cb (GtkOverlay *overlay,
!gtk_widget_get_visible (GTK_WIDGET (self->map)))
return FALSE;
+ gtk_widget_get_allocation (GTK_WIDGET (overlay), &ov_alloc);
gtk_widget_get_preferred_size (child, &min, &nat);
gtk_widget_get_preferred_size (GTK_WIDGET (self->map), &map_min, NULL);
- if (nat.width + map_min.width <= alloc->width)
+ if (nat.width + map_min.width <= ov_alloc.width)
{
- alloc->x += alloc->width;
+ alloc->x = ov_alloc.width;
alloc->x -= map_min.width;
alloc->x -= nat.width;
alloc->width = nat.width;
@@ -528,7 +530,7 @@ get_child_position_cb (GtkOverlay *overlay,
else
{
alloc->x = 0;
- alloc->width -= map_min.width;
+ alloc->width = min.width;
alloc->y = 0;
alloc->height = min.height;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]