Index: constraints.c
===================================================================
RCS file: /cvs/gnome/metacity/src/constraints.c,v
retrieving revision 1.8
diff -p -u -r1.8 constraints.c
--- constraints.c	2 May 2003 07:31:59 -0000	1.8
+++ constraints.c	1 Jun 2003 08:19:51 -0000
@@ -1232,7 +1232,7 @@ meta_window_constrain (MetaWindow       
       current = *new;
     }
 
-#if 0
+
   /* Now we have to sort out the aspect ratio */
   {
     /*
@@ -1329,12 +1329,6 @@ meta_window_constrain (MetaWindow       
 
     current = *new;
   }
-
-
-  g_print ("3 x_delta = %d y_delta = %d pos = %d,%d size = %dx%d\n",
-           x_delta, y_delta,
-           current.x, current.y, current.width, current.height);
-#endif
 
   meta_topic (META_DEBUG_GEOMETRY,
               "Constrained %s new %d,%d %dx%d old %d,%d %dx%d\n",
Index: tools/metacity-window-demo.c
===================================================================
RCS file: /cvs/gnome/metacity/src/tools/metacity-window-demo.c,v
retrieving revision 1.14
diff -p -u -r1.14 metacity-window-demo.c
--- tools/metacity-window-demo.c	18 Oct 2002 06:05:09 -0000	1.14
+++ tools/metacity-window-demo.c	1 Jun 2003 08:19:53 -0000
@@ -26,6 +26,8 @@
 
 static GtkWidget* do_appwindow (void);
 
+gboolean aspect_on;
+
 static void
 set_gdk_window_struts (GdkWindow *window,
                        int        left,
@@ -473,6 +475,8 @@ focus_in_event_cb (GtkWidget *window,
   widget = GTK_WIDGET (data);
 
   gtk_label_set_text (GTK_LABEL (widget), "Has focus");
+
+  return TRUE;
 }
 
 
@@ -486,6 +490,8 @@ focus_out_event_cb (GtkWidget *window,
   widget = GTK_WIDGET (data);
 
   gtk_label_set_text (GTK_LABEL (widget), "Not focused");
+
+  return TRUE;
 }
 
 static GtkWidget*
@@ -700,6 +706,35 @@ toggle_decorated_cb (GtkWidget *button,
 }
 
 static void
+toggle_aspect_ratio (GtkWidget *button,
+                     gpointer   data)
+{
+  GtkWidget *window;
+  GdkGeometry geom;
+
+  if (aspect_on)
+    {
+      geom.min_aspect = 0;
+      geom.max_aspect = 65535;
+    }
+  else
+    {
+      geom.min_aspect = 1.777778;
+      geom.max_aspect = 1.777778;
+    }
+
+  aspect_on = !aspect_on;
+
+  window = gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW);
+  if (window)
+    gtk_window_set_geometry_hints (GTK_WINDOW (window),
+				   GTK_WIDGET (data),
+				   &geom,
+				   GDK_HINT_ASPECT);
+				   
+}
+
+static void
 clicked_toolbar_cb (GtkWidget *button,
                     gpointer   data)
 {
@@ -709,7 +744,7 @@ clicked_toolbar_cb (GtkWidget *button,
                                    GTK_DIALOG_DESTROY_WITH_PARENT,
                                    GTK_MESSAGE_INFO,
                                    GTK_BUTTONS_CLOSE,
-                                   "Clicking the toolbar buttons doesn't do anything");
+                                   "Clicking this toolbar button doesn't do anything");
 
   /* Close dialog on user response */
   g_signal_connect (G_OBJECT (dialog),
@@ -785,7 +820,8 @@ do_appwindow (void)
    */
 
   ++window_count;
-  
+  aspect_on = FALSE;
+
   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_window_set_title (GTK_WINDOW (window), "Application Window");
   
@@ -824,6 +860,35 @@ do_appwindow (void)
                     GTK_EXPAND | GTK_FILL,     0,
                     0,                         0);
 
+  /* Create document
+   */
+
+  sw = gtk_scrolled_window_new (NULL, NULL);
+
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+                                  GTK_POLICY_AUTOMATIC,
+                                  GTK_POLICY_AUTOMATIC);
+
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
+                                       GTK_SHADOW_IN);
+      
+  gtk_table_attach (GTK_TABLE (table),
+                    sw,
+                    /* X direction */       /* Y direction */
+                    0, 1,                   2, 3,
+                    GTK_EXPAND | GTK_FILL,  GTK_EXPAND | GTK_FILL,
+                    0,                      0);
+
+  gtk_window_set_default_size (GTK_WINDOW (window),
+                               200, 200);
+      
+  contents = gtk_text_view_new ();
+  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
+                               PANGO_WRAP_WORD);
+      
+  gtk_container_add (GTK_CONTAINER (sw),
+                     contents);
+
   /* Create the toolbar
    */
   toolbar = gtk_toolbar_new ();
@@ -853,6 +918,14 @@ do_appwindow (void)
                             -1);  /* -1 means "append" */
   
   gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
+                            GTK_STOCK_OPEN,
+                            "This is a demo button that locks the aspect ratio using a hint",
+                            NULL,
+                            G_CALLBACK (toggle_aspect_ratio),
+                            contents, /* user data for callback */
+                            -1);  /* -1 means "append" */
+  
+  gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
                             GTK_STOCK_QUIT,
                             "This is a demo button with a 'quit' icon",
                             NULL,
@@ -870,35 +943,6 @@ do_appwindow (void)
                     0, 1,                   1, 2,
                     GTK_EXPAND | GTK_FILL,  0,
                     0,                      0);
-
-  /* Create document
-   */
-
-  sw = gtk_scrolled_window_new (NULL, NULL);
-
-  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
-                                  GTK_POLICY_AUTOMATIC,
-                                  GTK_POLICY_AUTOMATIC);
-
-  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
-                                       GTK_SHADOW_IN);
-      
-  gtk_table_attach (GTK_TABLE (table),
-                    sw,
-                    /* X direction */       /* Y direction */
-                    0, 1,                   2, 3,
-                    GTK_EXPAND | GTK_FILL,  GTK_EXPAND | GTK_FILL,
-                    0,                      0);
-
-  gtk_window_set_default_size (GTK_WINDOW (window),
-                               200, 200);
-      
-  contents = gtk_text_view_new ();
-  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (contents),
-                               PANGO_WRAP_WORD);
-      
-  gtk_container_add (GTK_CONTAINER (sw),
-                     contents);
 
   /* Create statusbar */
 
