]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkpaned.c
Fix DND with frame sync
[~andy/gtk] / gtk / gtkpaned.c
index c9f3f07f79ac25c3b3923e9e65ab7273b4b9df07..7c5ec381f3f0ab9eb0633692b53f4ce2009445dc 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 /*
@@ -34,6 +32,7 @@
 #include "gtkorientable.h"
 #include "gtkwindow.h"
 #include "gtktypebuiltins.h"
+#include "gtkorientableprivate.h"
 #include "gtkprivate.h"
 #include "gtkintl.h"
 #include "a11y/gtkpanedaccessible.h"
@@ -690,7 +689,6 @@ gtk_paned_init (GtkPaned *paned)
   priv->child1 = NULL;
   priv->child2 = NULL;
   priv->handle = NULL;
-  priv->cursor_type = GDK_CROSS;
 
   priv->handle_pos.width = 5;
   priv->handle_pos.height = 5;
@@ -723,6 +721,7 @@ gtk_paned_set_property (GObject        *object,
     {
     case PROP_ORIENTATION:
       priv->orientation = g_value_get_enum (value);
+      _gtk_orientable_set_style_classes (GTK_ORIENTABLE (paned));
 
       if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
         priv->cursor_type = GDK_SB_H_DOUBLE_ARROW;
@@ -905,7 +904,10 @@ gtk_paned_get_preferred_size (GtkWidget      *widget,
   if (priv->child1 && gtk_widget_get_visible (priv->child1))
     {
       get_preferred_size_for_size (priv->child1, orientation, size, &child_min, &child_nat);
-      *minimum = child_min;
+      if (priv->child1_shrink && priv->orientation == orientation)
+        *minimum = 0;
+      else
+        *minimum = child_min;
       *natural = child_nat;
     }
 
@@ -915,7 +917,8 @@ gtk_paned_get_preferred_size (GtkWidget      *widget,
 
       if (priv->orientation == orientation)
         {
-          *minimum += child_min;
+          if (!priv->child2_shrink)
+            *minimum += child_min;
           *natural += child_nat;
         }
       else
@@ -1317,7 +1320,7 @@ gtk_paned_create_child_window (GtkPaned  *paned,
 
   window = gdk_window_new (gtk_widget_get_window (widget),
                            &attributes, attributes_mask);
-  gdk_window_set_user_data (window, paned);
+  gtk_widget_register_window (widget, window);
   gtk_style_context_set_background (gtk_widget_get_style_context (widget), window);
 
   if (child)
@@ -1363,7 +1366,7 @@ gtk_paned_realize (GtkWidget *widget)
 
   priv->handle = gdk_window_new (window,
                                  &attributes, attributes_mask);
-  gdk_window_set_user_data (priv->handle, paned);
+  gtk_widget_register_window (widget, priv->handle);
   if (attributes_mask & GDK_WA_CURSOR)
     g_object_unref (attributes.cursor);
 
@@ -1379,19 +1382,19 @@ gtk_paned_unrealize (GtkWidget *widget)
 
   if (priv->child2)
     gtk_widget_set_parent_window (priv->child2, NULL);
-  gdk_window_set_user_data (priv->child2_window, NULL);
+  gtk_widget_unregister_window (widget, priv->child2_window);
   gdk_window_destroy (priv->child2_window);
   priv->child2_window = NULL;
 
   if (priv->child1)
     gtk_widget_set_parent_window (priv->child1, NULL);
-  gdk_window_set_user_data (priv->child1_window, NULL);
+  gtk_widget_unregister_window (widget, priv->child1_window);
   gdk_window_destroy (priv->child1_window);
   priv->child1_window = NULL;
 
   if (priv->handle)
     {
-      gdk_window_set_user_data (priv->handle, NULL);
+      gtk_widget_unregister_window (widget, priv->handle);
       gdk_window_destroy (priv->handle);
       priv->handle = NULL;
     }