[gtk+/client-side-decorations] Implement RTL flipping for window controls



commit 589b0a88672e88d7c752a35a4b0b7557594e6f26
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 10 01:15:02 2009 -0400

    Implement RTL flipping for window controls

 gtk/gtkwindow.c |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 83a3b99..c97ea05 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5496,7 +5496,7 @@ gtk_window_size_allocate (GtkWidget     *widget,
   GtkAllocation box_allocation;
   gint frame_width = 0;
   gint title_width = 0;
-  gint icon_width = 0;
+  gint left_width = 0;
   GdkRectangle rect;
   gboolean client_decorated;
 
@@ -5520,12 +5520,16 @@ gtk_window_size_allocate (GtkWidget     *widget,
     {
       gtk_widget_get_child_requisition (priv->title_icon, &deco_requisition);
 
-      deco_allocation.x = frame_width;
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+        deco_allocation.x = allocation->width - frame_width - deco_requisition.width;
+      else
+        deco_allocation.x = frame_width;
       deco_allocation.y = frame_width;
       deco_allocation.width = deco_requisition.width;
       deco_allocation.height = deco_requisition.height;
 
-      icon_width = deco_allocation.width;
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
+        left_width = deco_allocation.width;
 
       gtk_widget_size_allocate (priv->title_icon, &deco_allocation);
     }
@@ -5534,11 +5538,17 @@ gtk_window_size_allocate (GtkWidget     *widget,
     {
       gtk_widget_get_child_requisition (priv->button_box, &box_requisition);
 
-      box_allocation.x = allocation->width - frame_width - box_requisition.width;
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+        box_allocation.x = frame_width;
+      else
+        box_allocation.x = allocation->width - frame_width - box_requisition.width;
       box_allocation.y = frame_width;
       box_allocation.width = box_requisition.width;
       box_allocation.height = box_requisition.height;
 
+      if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+        left_width = box_allocation.width;
+
       gtk_widget_size_allocate (priv->button_box, &box_allocation);
     }
 
@@ -5546,7 +5556,7 @@ gtk_window_size_allocate (GtkWidget     *widget,
     {
       gtk_widget_get_child_requisition (priv->title_label, &deco_requisition);
 
-      deco_allocation.x = 2 * frame_width + icon_width;
+      deco_allocation.x = 2 * frame_width + left_width;
       deco_allocation.y = frame_width;
       deco_allocation.width = MAX (deco_requisition.width, get_available_size_for_label (window));
       deco_allocation.height = deco_requisition.height;



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