[gedit] Manage the gravity as a position and manage RTL case.



commit 16ab3496aa39f3adad76e9a427414f87a8797cbc
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Nov 16 20:51:49 2010 +0100

    Manage the gravity as a position and manage RTL case.

 gedit/gedit-overlay.c    |    9 +++++++--
 gedit/gedit-view-frame.c |   12 +++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gedit/gedit-overlay.c b/gedit/gedit-overlay.c
index 09e1cae..98e2695 100644
--- a/gedit/gedit-overlay.c
+++ b/gedit/gedit-overlay.c
@@ -310,11 +310,15 @@ set_children_positions (GeditOverlay *overlay)
 		/* FIXME: Add all the gravities here */
 		switch (child->gravity)
 		{
-			/* The gravity is the inverse of the place we want */
-			case GDK_GRAVITY_SOUTH_WEST:
+			/* The gravity is treated as position and not as a gravity */
+			case GDK_GRAVITY_NORTH_EAST:
 				alloc.x = priv->main_alloc.width - req.width - child->offset;
 				alloc.y = 0;
 				break;
+			case GDK_GRAVITY_NORTH_WEST:
+				alloc.x = child->offset;
+				alloc.y = 0;
+				break;
 			default:
 				alloc.x = 0;
 				alloc.y = 0;
@@ -663,6 +667,7 @@ gedit_overlay_new (GtkWidget *main_widget)
 	                                 NULL));
 }
 
+/* Note: see that we use the gravity as a position */
 void
 gedit_overlay_add_animated_widget (GeditOverlay                       *overlay,
                                    GtkWidget                          *widget,
diff --git a/gedit/gedit-view-frame.c b/gedit/gedit-view-frame.c
index da5df5c..0f3ce9a 100644
--- a/gedit/gedit-view-frame.c
+++ b/gedit/gedit-view-frame.c
@@ -1264,6 +1264,7 @@ start_interactive_search_real (GeditViewFrame *frame)
 	GtkTextBuffer *buffer;
 	GtkTextMark *mark;
 	GtkTextIter iter;
+	GdkGravity gravity;
 
 	/* FIXME: it enters here twice, why? */
 
@@ -1299,13 +1300,22 @@ start_interactive_search_real (GeditViewFrame *frame)
 
 	frame->priv->search_widget = create_search_widget (frame);
 
+	if (gtk_widget_get_direction (frame->priv->search_entry) == GTK_TEXT_DIR_RTL)
+	{
+		gravity = GDK_GRAVITY_NORTH_WEST;
+	}
+	else
+	{
+		gravity = GDK_GRAVITY_NORTH_EAST;
+	}
+
 	gedit_overlay_add_animated_widget (GEDIT_OVERLAY (frame->priv->overlay),
 	                                   frame->priv->search_widget,
 	                                   300,
 	                                   GEDIT_THEATRICS_CHOREOGRAPHER_EASING_EXPONENTIAL_IN_OUT,
 	                                   GEDIT_THEATRICS_CHOREOGRAPHER_BLOCKING_DOWNSTAGE,
 	                                   GTK_ORIENTATION_VERTICAL,
-	                                   GDK_GRAVITY_SOUTH_WEST,
+	                                   gravity,
 	                                   SEARCH_POPUP_OFFSET);
 
 	init_search_entry (frame);



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