]> git.saurik.com Git - wxWidgets.git/commitdiff
Better place for coordinate mirroring and removal
authorRobert Roebling <robert@roebling.de>
Sat, 14 Oct 2006 07:06:50 +0000 (07:06 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 14 Oct 2006 07:06:50 +0000 (07:06 +0000)
    of stupid hack.
  This makes the positioning correct in the end but
    leaves window hopping when resizing unsolved
    in RTL mode.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42000 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/win_gtk.h
src/gtk/toplevel.cpp
src/gtk/win_gtk.c
src/gtk/window.cpp

index 0340f05dfd4335b0366ddd7a4b06c23a91d86ff5..a2cca98a3a37d0bbef6a8a4152260a63c5f4a3a7 100644 (file)
@@ -53,8 +53,6 @@ struct _GtkPizza
     guint m_xoffset;
     guint m_yoffset;
     
-    gint  m_width;
-
     GdkWindow *bin_window;
 };
 
index 7b883348dc14c7bb0be924447f3aadde2a5deccb..8a294525a439e3e429aee4312096567dbb27b53d 100644 (file)
@@ -243,9 +243,6 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
         win->m_width = alloc->width;
         win->m_height = alloc->height;
         
-        if (win->m_mainWidget)
-            GTK_PIZZA(win->m_mainWidget)->m_width = win->m_width;
-        
         win->GtkUpdateSize();
     }
 }
@@ -566,8 +563,6 @@ bool wxTopLevelWindowGTK::Create( wxWindow *parent,
     GTK_WIDGET_UNSET_FLAGS( m_mainWidget, GTK_CAN_FOCUS );
     gtk_container_add( GTK_CONTAINER(m_widget), m_mainWidget );
 
-    GTK_PIZZA(m_mainWidget)->m_width = m_width;
-        
     if (m_miniEdge == 0) // wxMiniFrame has its own version.
     {
        // For m_mainWidget themes
@@ -862,9 +857,6 @@ void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int si
     if (width != -1) m_width = width;
     if (height != -1) m_height = height;
     
-    if (m_mainWidget)
-        GTK_PIZZA(m_mainWidget)->m_width = m_width;
-
 /*
     if ((sizeFlags & wxSIZE_AUTO_WIDTH) == wxSIZE_AUTO_WIDTH)
     {
index c827c087ea4771cba6cc6e046bacb02d7a1d5911..31a826d1dd701a6c3104ab05a613368268e54f6e 100644 (file)
@@ -193,8 +193,6 @@ gtk_pizza_init (GtkPizza *pizza)
 
     pizza->m_xoffset = 0;
     pizza->m_yoffset = 0;
-    
-    pizza->m_width = -1;
 }
 
 GtkWidget*
@@ -299,8 +297,8 @@ gtk_pizza_put (GtkPizza   *pizza,
 
     if (gtk_widget_get_direction( GTK_WIDGET(pizza) ) == GTK_TEXT_DIR_RTL)
     {
-        // reverse horizontal placement
-        x = pizza->m_width - x - width;
+        /* reverse horizontal placement */
+        x = GTK_WIDGET(pizza)->allocation.width - x - width;
     }
 
     child_info = g_new (GtkPizzaChild, 1);
@@ -311,9 +309,6 @@ gtk_pizza_put (GtkPizza   *pizza,
     child_info->width = width;
     child_info->height = height;
 
-    if (GTK_IS_PIZZA(widget))
-        GTK_PIZZA(widget)->m_width = width;
-                
     pizza->children = g_list_append (pizza->children, child_info);
 
     if (GTK_WIDGET_REALIZED (pizza))
@@ -357,26 +352,16 @@ gtk_pizza_set_size (GtkPizza   *pizza,
 
         if (child->widget == widget)
         {
-            gint new_x = x;
-            if (gtk_widget_get_direction( GTK_WIDGET(pizza) ) == GTK_TEXT_DIR_RTL)
-            {
-                // reverse horizontal placement
-                new_x = pizza->m_width - new_x - width;
-            }
-
-            if ((child->x == new_x) &&
+            if ((child->x == x) &&
                 (child->y == y) &&
                 (child->width == width) &&
                 (child->height == height)) return;
 
-            child->x = new_x;
+            child->x = x;
             child->y = y;
             child->width = width;
             child->height = height;
             
-            if (GTK_IS_PIZZA(widget))
-                GTK_PIZZA(widget)->m_width = width;
-
             gtk_widget_set_size_request (widget, width, height);
 
             return;
@@ -578,6 +563,7 @@ gtk_pizza_size_allocate (GtkWidget     *widget,
     gint x,y,w,h;
     GtkPizzaChild *child;
     GList *children;
+    gboolean only_resize;
 
     g_return_if_fail (widget != NULL);
     g_return_if_fail (GTK_IS_PIZZA(widget));
@@ -585,6 +571,8 @@ gtk_pizza_size_allocate (GtkWidget     *widget,
 
     pizza = GTK_PIZZA (widget);
 
+    only_resize = ((widget->allocation.x == allocation->x) &&
+                   (widget->allocation.y == allocation->y));
     widget->allocation = *allocation;
 
     if (pizza->shadow_type == GTK_MYSHADOW_NONE)
@@ -606,8 +594,12 @@ gtk_pizza_size_allocate (GtkWidget     *widget,
 
     if (GTK_WIDGET_REALIZED (widget))
     {
-        gdk_window_move_resize( widget->window, x, y, w, h );
-        gdk_window_move_resize( pizza->bin_window, 0, 0, w, h );
+        if (only_resize)
+            gdk_window_resize( widget->window, w, h );
+        else
+            gdk_window_move_resize( widget->window, x, y, w, h );
+            
+        gdk_window_resize( pizza->bin_window, w, h );
     }
 
     children = pizza->children;
@@ -742,6 +734,13 @@ gtk_pizza_allocate_child (GtkPizza      *pizza,
     allocation.width = requisition.width;
     allocation.height = requisition.height;
 
+    if (gtk_widget_get_direction( GTK_WIDGET(pizza) ) == GTK_TEXT_DIR_RTL)
+    {
+        /* reverse horizontal placement */
+        printf( "alloc width %d\n", GTK_WIDGET(pizza)->allocation.width );
+        allocation.x = GTK_WIDGET(pizza)->allocation.width - child->x - allocation.width - pizza->m_xoffset; 
+    }
+    
     gtk_widget_size_allocate (child->widget, &allocation);
 }
 
index e8f35a2e8eafad76cbd16a34b83509604b79bc73..a4edb3bbd892dba2c76c1318248d4381cd6b8592 100644 (file)
@@ -2114,8 +2114,6 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget),
                 alloc->height );
 #endif
                 
-    GTK_PIZZA(win->m_wxwindow)->m_width = win->GetClientSize().x;
-
     win->m_oldClientWidth = client_width;
     win->m_oldClientHeight = client_height;