GtkPopover: Fix rtl positioning

There was some confusion between unflipped and flipped positions.
Both final_position and current_position are meant to be unflipped,
and get_effective_position() needs to be applied to them to get
a flipped position. _gtk_window_set_popover_position() also expects
an unflipped position.

https://bugzilla.gnome.org/show_bug.cgi?id=735014
This commit is contained in:
Matthias Clasen
2014-08-21 11:57:19 -04:00
parent 09286cf968
commit 7645d201d4

View File

@ -771,7 +771,7 @@ gtk_popover_update_position (GtkPopover *popover)
GtkRequisition req; GtkRequisition req;
GtkPositionType pos; GtkPositionType pos;
gint overshoot[4]; gint overshoot[4];
gint i; gint i, j;
gint best; gint best;
if (!priv->window) if (!priv->window)
@ -791,11 +791,11 @@ gtk_popover_update_position (GtkPopover *popover)
if (overshoot[pos] <= 0) if (overshoot[pos] <= 0)
{ {
priv->final_position = pos; priv->final_position = priv->preferred_position;
} }
else if (overshoot[opposite_position (pos)] <= 0) else if (overshoot[opposite_position (pos)] <= 0)
{ {
priv->final_position = opposite_position (pos); priv->final_position = opposite_position (priv->preferred_position);
} }
else else
{ {
@ -803,10 +803,11 @@ gtk_popover_update_position (GtkPopover *popover)
pos = 0; pos = 0;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (overshoot[i] < best) j = get_effective_position (popover, i);
if (overshoot[j] < best)
{ {
pos = i; pos = i;
best = overshoot[i]; best = overshoot[j];
} }
} }
priv->final_position = pos; priv->final_position = pos;