[libdazzle] multi-paned: adjust x,y coordinates of following widgets
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] multi-paned: adjust x,y coordinates of following widgets
- Date: Thu, 22 Jun 2017 12:02:13 +0000 (UTC)
commit 337b1b45cbe50dfe9f8d25b13387417e74074c6a
Author: Christian Hergert <chergert redhat com>
Date: Thu Jun 22 05:01:44 2017 -0700
multi-paned: adjust x,y coordinates of following widgets
We were not adjusting the x/y of the widgets that came after the expand
widgets. We have to be tricky here because we care about the children
following based on the real widget ordering, not our reverse sorted expand
widgetry.
src/widgets/dzl-multi-paned.c | 37 ++++++++++++++++++++++++++-----------
1 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/src/widgets/dzl-multi-paned.c b/src/widgets/dzl-multi-paned.c
index d1816f7..fd4149a 100644
--- a/src/widgets/dzl-multi-paned.c
+++ b/src/widgets/dzl-multi-paned.c
@@ -1355,22 +1355,24 @@ allocation_stage_expand (DzlMultiPaned *self,
if (IS_HORIZONTAL (state->orientation))
{
+ guint j;
+
g_assert (next->alloc.width >= child->alloc.width);
- adjust = next->alloc.width - child->alloc.width;
- }
- else
- {
- g_assert (next->alloc.height >= child->alloc.height);
- adjust = next->alloc.height - child->alloc.height;
- }
- if (IS_HORIZONTAL (state->orientation))
- {
- adjust = MIN (state->avail_width, adjust);
+ adjust = next->alloc.width - child->alloc.width;
+ if (adjust > state->avail_width)
+ adjust = state->avail_width;
child->alloc.width += adjust;
state->avail_width -= adjust;
+ /* Adjust X of children following */
+ for (j = 0; j < state->n_children; j++)
+ if (state->children[j] == child)
+ break;
+ for (++j; j < state->n_children; j++)
+ state->children[j]->alloc.x += adjust;
+
g_assert (state->avail_width >= 0);
if (state->avail_width == 0)
@@ -1378,11 +1380,24 @@ allocation_stage_expand (DzlMultiPaned *self,
}
else
{
- adjust = MIN (state->avail_height, adjust);
+ guint j;
+
+ g_assert (next->alloc.height >= child->alloc.height);
+
+ adjust = next->alloc.height - child->alloc.height;
+ if (adjust > state->avail_height)
+ adjust = state->avail_height;
child->alloc.height += adjust;
state->avail_height -= adjust;
+ /* Adjust Y of children following */
+ for (j = 0; j < state->n_children; j++)
+ if (state->children[j] == child)
+ break;
+ for (++j; j < state->n_children; j++)
+ state->children[j]->alloc.y += adjust;
+
g_assert (state->avail_height >= 0);
if (state->avail_height == 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]