[gtk+] GtkPopover: Fix rtl positioning



commit 7645d201d408964f8ade769e59517e6a98a02364
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Aug 21 11:57:19 2014 -0400

    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

 gtk/gtkpopover.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 0acb133..bdb8c6a 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -771,7 +771,7 @@ gtk_popover_update_position (GtkPopover *popover)
   GtkRequisition req;
   GtkPositionType pos;
   gint overshoot[4];
-  gint i;
+  gint i, j;
   gint best;
 
   if (!priv->window)
@@ -791,11 +791,11 @@ gtk_popover_update_position (GtkPopover *popover)
 
   if (overshoot[pos] <= 0)
     {
-      priv->final_position = pos;
+      priv->final_position = priv->preferred_position;
     }
   else if (overshoot[opposite_position (pos)] <= 0)
     {
-      priv->final_position = opposite_position (pos);
+      priv->final_position = opposite_position (priv->preferred_position);
     }
   else
     {
@@ -803,10 +803,11 @@ gtk_popover_update_position (GtkPopover *popover)
       pos = 0;
       for (i = 0; i < 4; i++)
         {
-          if (overshoot[i] < best)
+          j = get_effective_position (popover, i);
+          if (overshoot[j] < best)
             {
               pos = i;
-              best = overshoot[i];
+              best = overshoot[j];
             }
         }
       priv->final_position = pos;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]