]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkwindow.c
Updated Norwegian bokmål translation
[~andy/gtk] / gtk / gtkwindow.c
index c70d6608579841a1dbc6b97be6891f35dd405195..02adf0a5080c16a36a143cad6e440a8743692af3 100644 (file)
 #include "gtkmarshalers.h"
 #include "gtkplug.h"
 #include "gtkbuildable.h"
-#include "gtkalias.h"
+#include "gtksizerequest.h"
 
 #ifdef GDK_WINDOWING_X11
 #include "x11/gdkx.h"
 #endif
 
+/**
+ * SECTION:gtkwindow
+ * @title: GtkWindow
+ * @short_description: Toplevel which can contain other widgets
+ *
+ * <refsect2 id="GtkWindow-BUILDER-UI">
+ * <title>GtkWindow as GtkBuildable</title>
+ * <para>
+ * The GtkWindow implementation of the GtkBuildable interface supports a
+ * custom <tag class="starttag">accel-groups</tag> element, which supports
+ * any number of <tag class="starttag">group</tag> elements representing the
+ * #GtkAccelGroup objects you want to add to your window (synonymous with
+ * gtk_window_add_accel_group().
+ * </para>
+ * <example>
+ * <title>A UI definition fragment with accel groups</title>
+ * <programlisting><![CDATA[
+ * <object class="GtkWindow">
+ *   <accel-groups>
+ *     <group name="accelgroup1"/>
+ *   </accel-groups>
+ * </object>
+ * <!-- -->
+ * ...
+ * <!-- -->
+ * <object class="GtkAccelGroup" id="accelgroup1"/>
+ * ]]></programlisting>
+ * </example>
+ * </refsect2>
+ */
 enum {
   SET_FOCUS,
   FRAME_EVENT,
@@ -166,6 +196,7 @@ struct _GtkWindowGeometryInfo
 };
 
 #define GTK_WINDOW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_WINDOW, GtkWindowPrivate))
+#define GTK_WINDOW_GROUP_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_WINDOW_GROUP, GtkWindowGroupPrivate))
 
 typedef struct _GtkWindowPrivate GtkWindowPrivate;
 
@@ -198,6 +229,21 @@ struct _GtkWindowPrivate
   gchar *startup_id;
 };
 
+typedef struct _GtkDeviceGrabInfo GtkDeviceGrabInfo;
+typedef struct _GtkWindowGroupPrivate GtkWindowGroupPrivate;
+
+struct _GtkDeviceGrabInfo
+{
+  GtkWidget *widget;
+  GdkDevice *device;
+  guint block_others : 1;
+};
+
+struct _GtkWindowGroupPrivate
+{
+  GSList *device_grabs;
+};
+
 static void gtk_window_dispose            (GObject           *object);
 static void gtk_window_destroy            (GtkObject         *object);
 static void gtk_window_finalize           (GObject           *object);
@@ -207,8 +253,6 @@ static void gtk_window_map                (GtkWidget         *widget);
 static void gtk_window_unmap              (GtkWidget         *widget);
 static void gtk_window_realize            (GtkWidget         *widget);
 static void gtk_window_unrealize          (GtkWidget         *widget);
-static void gtk_window_size_request       (GtkWidget         *widget,
-                                          GtkRequisition    *requisition);
 static void gtk_window_size_allocate      (GtkWidget         *widget,
                                           GtkAllocation     *allocation);
 static gint gtk_window_event              (GtkWidget *widget,
@@ -350,9 +394,19 @@ static void gtk_window_buildable_custom_finished (GtkBuildable  *buildable,
                                                      gpointer       user_data);
 
 
+static void gtk_window_size_request_init      (GtkSizeRequestIface *iface);
+static void gtk_window_get_width              (GtkSizeRequest      *widget,
+                                              gint                *minimum_size,
+                                              gint                *natural_size);
+static void gtk_window_get_height             (GtkSizeRequest      *widget,
+                                              gint                *minimum_size,
+                                              gint                *natural_size);
+
 G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
                          G_IMPLEMENT_INTERFACE (GTK_TYPE_BUILDABLE,
-                                               gtk_window_buildable_interface_init))
+                                               gtk_window_buildable_interface_init)
+                        G_IMPLEMENT_INTERFACE (GTK_TYPE_SIZE_REQUEST,
+                                               gtk_window_size_request_init))
 
 static void
 add_tab_bindings (GtkBindingSet    *binding_set,
@@ -451,7 +505,6 @@ gtk_window_class_init (GtkWindowClass *klass)
   widget_class->unmap = gtk_window_unmap;
   widget_class->realize = gtk_window_realize;
   widget_class->unrealize = gtk_window_unrealize;
-  widget_class->size_request = gtk_window_size_request;
   widget_class->size_allocate = gtk_window_size_allocate;
   widget_class->configure_event = gtk_window_configure_event;
   widget_class->key_press_event = gtk_window_key_press_event;
@@ -519,23 +572,6 @@ gtk_window_class_init (GtkWindowClass *klass)
                                                        NULL,
                                                        GTK_PARAM_WRITABLE));
 
-  g_object_class_install_property (gobject_class,
-                                   PROP_ALLOW_SHRINK,
-                                   g_param_spec_boolean ("allow-shrink",
-                                                        P_("Allow Shrink"),
-                                                        /* xgettext:no-c-format */
-                                                        P_("If TRUE, the window has no mimimum size. Setting this to TRUE is 99% of the time a bad idea"),
-                                                        FALSE,
-                                                        GTK_PARAM_READWRITE));
-
-  g_object_class_install_property (gobject_class,
-                                   PROP_ALLOW_GROW,
-                                   g_param_spec_boolean ("allow-grow",
-                                                        P_("Allow Grow"),
-                                                        P_("If TRUE, users can expand the window beyond its minimum size"),
-                                                        TRUE,
-                                                        GTK_PARAM_READWRITE));
-
   g_object_class_install_property (gobject_class,
                                    PROP_RESIZABLE,
                                    g_param_spec_boolean ("resizable",
@@ -814,7 +850,7 @@ gtk_window_class_init (GtkWindowClass *klass)
    * GtkWindow::activate-focus:
    * @window: the window which received the signal
    *
-   * The ::activate-default signal is a
+   * The ::activate-focus signal is a
    * <link linkend="keybinding-signals">keybinding signal</link>
    * which gets emitted when the user activates the currently
    * focused widget of @window.
@@ -900,8 +936,8 @@ gtk_window_init (GtkWindow *window)
   GdkColormap *colormap;
   GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
   
-  GTK_WIDGET_UNSET_FLAGS (window, GTK_NO_WINDOW);
-  GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
+  gtk_widget_set_has_window (GTK_WIDGET (window), TRUE);
+  _gtk_widget_set_is_toplevel (GTK_WIDGET (window), TRUE);
 
   GTK_PRIVATE_SET_FLAG (window, GTK_ANCHORED);
 
@@ -916,8 +952,7 @@ gtk_window_init (GtkWindow *window)
   window->focus_widget = NULL;
   window->default_widget = NULL;
   window->configure_request_count = 0;
-  window->allow_shrink = FALSE;
-  window->allow_grow = TRUE;
+  window->resizable = TRUE;
   window->configure_notify_received = FALSE;
   window->position = GTK_WIN_POS_NONE;
   window->need_default_size = TRUE;
@@ -984,19 +1019,9 @@ gtk_window_set_property (GObject      *object,
     case PROP_STARTUP_ID:
       gtk_window_set_startup_id (window, g_value_get_string (value));
       break; 
-    case PROP_ALLOW_SHRINK:
-      window->allow_shrink = g_value_get_boolean (value);
-      gtk_widget_queue_resize (GTK_WIDGET (window));
-      break;
-    case PROP_ALLOW_GROW:
-      window->allow_grow = g_value_get_boolean (value);
-      gtk_widget_queue_resize (GTK_WIDGET (window));
-      g_object_notify (G_OBJECT (window), "resizable");
-      break;
     case PROP_RESIZABLE:
-      window->allow_grow = g_value_get_boolean (value);
+      window->resizable = g_value_get_boolean (value);
       gtk_widget_queue_resize (GTK_WIDGET (window));
-      g_object_notify (G_OBJECT (window), "allow-grow");
       break;
     case PROP_MODAL:
       gtk_window_set_modal (window, g_value_get_boolean (value));
@@ -1099,14 +1124,8 @@ gtk_window_get_property (GObject      *object,
     case PROP_TITLE:
       g_value_set_string (value, window->title);
       break;
-    case PROP_ALLOW_SHRINK:
-      g_value_set_boolean (value, window->allow_shrink);
-      break;
-    case PROP_ALLOW_GROW:
-      g_value_set_boolean (value, window->allow_grow);
-      break;
     case PROP_RESIZABLE:
-      g_value_set_boolean (value, window->allow_grow);
+      g_value_set_boolean (value, window->resizable);
       break;
     case PROP_MODAL:
       g_value_set_boolean (value, window->modal);
@@ -1396,7 +1415,7 @@ gtk_window_set_title (GtkWindow   *window,
   g_free (window->title);
   window->title = new_title;
 
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     {
       gdk_window_set_title (GTK_WIDGET (window)->window, window->title);
 
@@ -1453,7 +1472,7 @@ gtk_window_set_wmclass (GtkWindow *window,
   g_free (window->wmclass_class);
   window->wmclass_class = g_strdup (wmclass_class);
 
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     g_warning ("gtk_window_set_wmclass: shouldn't set wmclass after window is realized!\n");
 }
 
@@ -1488,7 +1507,7 @@ gtk_window_set_role (GtkWindow   *window,
   g_free (window->wm_role);
   window->wm_role = new_role;
 
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gdk_window_set_role (GTK_WIDGET (window)->window, window->wm_role);
 
   g_object_notify (G_OBJECT (window), "role");
@@ -1516,14 +1535,16 @@ void
 gtk_window_set_startup_id (GtkWindow   *window,
                            const gchar *startup_id)
 {
-  GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
+  GtkWindowPrivate *priv;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
+
+  priv = GTK_WINDOW_GET_PRIVATE (window);
   
   g_free (priv->startup_id);
   priv->startup_id = g_strdup (startup_id);
 
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     {
       guint32 timestamp = extract_time_from_startup_id (priv->startup_id);
 
@@ -1543,7 +1564,8 @@ gtk_window_set_startup_id (GtkWindow   *window,
                                      priv->startup_id);
           
           /* If window is mapped, terminate the startup-notification too */
-          if (GTK_WIDGET_MAPPED (window) && !disable_startup_notification)
+          if (gtk_widget_get_mapped (GTK_WIDGET (window)) &&
+              !disable_startup_notification)
             gdk_notify_startup_complete_with_id (priv->startup_id);
         }
     }
@@ -1590,7 +1612,7 @@ gtk_window_set_focus (GtkWindow *window,
   if (focus)
     {
       g_return_if_fail (GTK_IS_WIDGET (focus));
-      g_return_if_fail (GTK_WIDGET_CAN_FOCUS (focus));
+      g_return_if_fail (gtk_widget_get_can_focus (focus));
     }
 
   if (focus)
@@ -1621,7 +1643,7 @@ _gtk_window_internal_set_focus (GtkWindow *window,
   g_return_if_fail (GTK_IS_WINDOW (window));
 
   if ((window->focus_widget != focus) ||
-      (focus && !GTK_WIDGET_HAS_FOCUS (focus)))
+      (focus && !gtk_widget_has_focus (focus)))
     g_signal_emit (window, window_signals[SET_FOCUS], 0, focus);
 }
 
@@ -1646,7 +1668,7 @@ gtk_window_set_default (GtkWindow *window,
   g_return_if_fail (GTK_IS_WINDOW (window));
 
   if (default_widget)
-    g_return_if_fail (GTK_WIDGET_CAN_DEFAULT (default_widget));
+    g_return_if_fail (gtk_widget_get_can_default (default_widget));
   
   if (window->default_widget != default_widget)
     {
@@ -1660,8 +1682,8 @@ gtk_window_set_default (GtkWindow *window,
          old_default_widget = window->default_widget;
          
          if (window->focus_widget != window->default_widget ||
-             !GTK_WIDGET_RECEIVES_DEFAULT (window->default_widget))
-           GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
+             !gtk_widget_get_receives_default (window->default_widget))
+            _gtk_widget_set_has_default (window->default_widget, FALSE);
          gtk_widget_queue_draw (window->default_widget);
        }
 
@@ -1670,8 +1692,8 @@ gtk_window_set_default (GtkWindow *window,
       if (window->default_widget)
        {
          if (window->focus_widget == NULL ||
-             !GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget))
-           GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
+             !gtk_widget_get_receives_default (window->focus_widget))
+            _gtk_widget_set_has_default (window->default_widget, TRUE);
          gtk_widget_queue_draw (window->default_widget);
        }
 
@@ -1705,35 +1727,6 @@ gtk_window_get_default_widget (GtkWindow *window)
   return window->default_widget;
 }
 
-static void
-gtk_window_set_policy_internal (GtkWindow *window,
-                                gboolean   allow_shrink,
-                                gboolean   allow_grow,
-                                gboolean   auto_shrink)
-{
-  window->allow_shrink = (allow_shrink != FALSE);
-  window->allow_grow = (allow_grow != FALSE);
-
-  g_object_freeze_notify (G_OBJECT (window));
-  g_object_notify (G_OBJECT (window), "allow-shrink");
-  g_object_notify (G_OBJECT (window), "allow-grow");
-  g_object_notify (G_OBJECT (window), "resizable");
-  g_object_thaw_notify (G_OBJECT (window));
-
-  gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
-}
-
-void
-gtk_window_set_policy (GtkWindow *window,
-                      gboolean   allow_shrink,
-                      gboolean   allow_grow,
-                      gboolean   auto_shrink)
-{
-  g_return_if_fail (GTK_IS_WINDOW (window));
-
-  gtk_window_set_policy_internal (window, allow_shrink, allow_grow, auto_shrink);
-}
-
 static gboolean
 handle_keys_changed (gpointer data)
 {
@@ -1968,7 +1961,7 @@ gtk_window_activate_focus (GtkWindow *window)
 {
   g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
 
-  if (window->focus_widget && GTK_WIDGET_IS_SENSITIVE (window->focus_widget))
+  if (window->focus_widget && gtk_widget_is_sensitive (window->focus_widget))
     return gtk_widget_activate (window->focus_widget);
 
   return FALSE;
@@ -1981,7 +1974,7 @@ gtk_window_activate_focus (GtkWindow *window)
  * Retrieves the current focused widget within the window.
  * Note that this is the widget that would have the focus
  * if the toplevel window focused; if the toplevel window
- * is not focused then  <literal>GTK_WIDGET_HAS_FOCUS (widget)</literal> will
+ * is not focused then  <literal>gtk_widget_has_focus (widget)</literal> will
  * not be %TRUE for the widget.
  *
  * Return value: (transfer none): the currently focused widget, or %NULL if there is none.
@@ -2000,7 +1993,7 @@ gtk_window_get_focus (GtkWindow *window)
  * 
  * Activates the default widget for the window, unless the current 
  * focused widget has been configured to receive the default action 
- * (see #GTK_RECEIVES_DEFAULT in #GtkWidgetFlags), in which case the
+ * (see gtk_widget_set_receives_default()), in which case the
  * focused widget is activated. 
  * 
  * Return value: %TRUE if a widget got activated.
@@ -2010,10 +2003,10 @@ gtk_window_activate_default (GtkWindow *window)
 {
   g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
 
-  if (window->default_widget && GTK_WIDGET_IS_SENSITIVE (window->default_widget) &&
-      (!window->focus_widget || !GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget)))
+  if (window->default_widget && gtk_widget_is_sensitive (window->default_widget) &&
+      (!window->focus_widget || !gtk_widget_get_receives_default (window->focus_widget)))
     return gtk_widget_activate (window->default_widget);
-  else if (window->focus_widget && GTK_WIDGET_IS_SENSITIVE (window->focus_widget))
+  else if (window->focus_widget && gtk_widget_is_sensitive (window->focus_widget))
     return gtk_widget_activate (window->focus_widget);
 
   return FALSE;
@@ -2037,6 +2030,8 @@ void
 gtk_window_set_modal (GtkWindow *window,
                      gboolean   modal)
 {
+  GtkWidget *widget;
+
   g_return_if_fail (GTK_IS_WINDOW (window));
 
   modal = modal != FALSE;
@@ -2044,24 +2039,23 @@ gtk_window_set_modal (GtkWindow *window,
     return;
   
   window->modal = modal;
+  widget = GTK_WIDGET (window);
   
   /* adjust desired modality state */
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (widget))
     {
-      GtkWidget *widget = GTK_WIDGET (window);
-      
       if (window->modal)
        gdk_window_set_modal_hint (widget->window, TRUE);
       else
        gdk_window_set_modal_hint (widget->window, FALSE);
     }
 
-  if (GTK_WIDGET_VISIBLE (window))
+  if (gtk_widget_get_visible (widget))
     {
       if (window->modal)
-       gtk_grab_add (GTK_WIDGET (window));
+       gtk_grab_add (widget);
       else
-       gtk_grab_remove (GTK_WIDGET (window));
+       gtk_grab_remove (widget);
     }
 
   g_object_notify (G_OBJECT (window), "modal");
@@ -2206,7 +2200,7 @@ static void
 gtk_window_transient_parent_realized (GtkWidget *parent,
                                      GtkWidget *window)
 {
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gdk_window_set_transient_for (window->window, parent->window);
 }
 
@@ -2214,7 +2208,7 @@ static void
 gtk_window_transient_parent_unrealized (GtkWidget *parent,
                                        GtkWidget *window)
 {
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gdk_property_delete (window->window, 
                         gdk_atom_intern_static_string ("WM_TRANSIENT_FOR"));
 }
@@ -2264,7 +2258,7 @@ gtk_window_unset_transient_for  (GtkWindow *window)
 /**
  * gtk_window_set_transient_for:
  * @window: a #GtkWindow
- * @parent: (allow-none): parent window
+ * @parent: (allow-none): parent window, or %NULL
  *
  * Dialog windows should be set transient for the main application
  * window they were spawned from. This allows <link
@@ -2274,25 +2268,28 @@ gtk_window_unset_transient_for  (GtkWindow *window)
  * functions in GTK+ will sometimes call
  * gtk_window_set_transient_for() on your behalf.
  *
- * On Windows, this function puts the child window on top of the parent, 
+ * Passing %NULL for @parent unsets the current transient window.
+ *
+ * On Windows, this function puts the child window on top of the parent,
  * much as the window manager would have done on X.
- * 
- **/
-void       
-gtk_window_set_transient_for  (GtkWindow *window, 
+ */
+void
+gtk_window_set_transient_for  (GtkWindow *window,
                               GtkWindow *parent)
 {
-  GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
+  GtkWindowPrivate *priv;
   
   g_return_if_fail (GTK_IS_WINDOW (window));
   g_return_if_fail (parent == NULL || GTK_IS_WINDOW (parent));
   g_return_if_fail (window != parent);
 
+  priv = GTK_WINDOW_GET_PRIVATE (window);
+
   if (window->transient_parent)
     {
-      if (GTK_WIDGET_REALIZED (window) && 
-         GTK_WIDGET_REALIZED (window->transient_parent) && 
-         (!parent || !GTK_WIDGET_REALIZED (parent)))
+      if (gtk_widget_get_realized (GTK_WIDGET (window)) &&
+          gtk_widget_get_realized (GTK_WIDGET (window->transient_parent)) &&
+          (!parent || !gtk_widget_get_realized (GTK_WIDGET (parent))))
        gtk_window_transient_parent_unrealized (GTK_WIDGET (window->transient_parent),
                                                GTK_WIDGET (window));
 
@@ -2321,8 +2318,8 @@ gtk_window_set_transient_for  (GtkWindow *window,
       if (window->destroy_with_parent)
         connect_parent_destroyed (window);
       
-      if (GTK_WIDGET_REALIZED (window) &&
-         GTK_WIDGET_REALIZED (parent))
+      if (gtk_widget_get_realized (GTK_WIDGET (window)) &&
+         gtk_widget_get_realized (GTK_WIDGET (parent)))
        gtk_window_transient_parent_realized (GTK_WIDGET (parent),
                                              GTK_WIDGET (window));
 
@@ -2387,7 +2384,7 @@ gtk_window_set_opacity  (GtkWindow *window,
   priv->opacity_set = TRUE;
   priv->opacity = opacity;
 
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gdk_window_set_opacity (GTK_WIDGET (window)->window, priv->opacity);
 }
 
@@ -2436,7 +2433,7 @@ gtk_window_set_type_hint (GtkWindow           *window,
   GtkWindowPrivate *priv;
 
   g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (!GTK_WIDGET_MAPPED (window));
+  g_return_if_fail (!gtk_widget_get_mapped (GTK_WIDGET (window)));
 
   priv = GTK_WINDOW_GET_PRIVATE (window);
 
@@ -2494,7 +2491,7 @@ gtk_window_set_skip_taskbar_hint (GtkWindow *window,
   if (priv->skips_taskbar != setting)
     {
       priv->skips_taskbar = setting;
-      if (GTK_WIDGET_REALIZED (window))
+      if (gtk_widget_get_realized (GTK_WIDGET (window)))
         gdk_window_set_skip_taskbar_hint (GTK_WIDGET (window)->window,
                                           priv->skips_taskbar);
       g_object_notify (G_OBJECT (window), "skip-taskbar-hint");
@@ -2551,7 +2548,7 @@ gtk_window_set_skip_pager_hint (GtkWindow *window,
   if (priv->skips_pager != setting)
     {
       priv->skips_pager = setting;
-      if (GTK_WIDGET_REALIZED (window))
+      if (gtk_widget_get_realized (GTK_WIDGET (window)))
         gdk_window_set_skip_pager_hint (GTK_WIDGET (window)->window,
                                         priv->skips_pager);
       g_object_notify (G_OBJECT (window), "skip-pager-hint");
@@ -2605,7 +2602,7 @@ gtk_window_set_urgency_hint (GtkWindow *window,
   if (priv->urgent != setting)
     {
       priv->urgent = setting;
-      if (GTK_WIDGET_REALIZED (window))
+      if (gtk_widget_get_realized (GTK_WIDGET (window)))
         gdk_window_set_urgency_hint (GTK_WIDGET (window)->window,
                                     priv->urgent);
       g_object_notify (G_OBJECT (window), "urgency-hint");
@@ -2659,7 +2656,7 @@ gtk_window_set_accept_focus (GtkWindow *window,
   if (priv->accept_focus != setting)
     {
       priv->accept_focus = setting;
-      if (GTK_WIDGET_REALIZED (window))
+      if (gtk_widget_get_realized (GTK_WIDGET (window)))
         gdk_window_set_accept_focus (GTK_WIDGET (window)->window,
                                     priv->accept_focus);
       g_object_notify (G_OBJECT (window), "accept-focus");
@@ -2714,7 +2711,7 @@ gtk_window_set_focus_on_map (GtkWindow *window,
   if (priv->focus_on_map != setting)
     {
       priv->focus_on_map = setting;
-      if (GTK_WIDGET_REALIZED (window))
+      if (gtk_widget_get_realized (GTK_WIDGET (window)))
         gdk_window_set_focus_on_map (GTK_WIDGET (window)->window,
                                     priv->focus_on_map);
       g_object_notify (G_OBJECT (window), "focus-on-map");
@@ -2829,8 +2826,8 @@ gtk_window_get_geometry_info (GtkWindow *window,
 /**
  * gtk_window_set_geometry_hints:
  * @window: a #GtkWindow
- * @geometry_widget: widget the geometry hints will be applied to
- * @geometry: struct containing geometry information
+ * @geometry_widget: (allow-none): widget the geometry hints will be applied to or %NULL
+ * @geometry: (allow-none): struct containing geometry information or %NULL
  * @geom_mask: mask indicating which struct fields should be paid attention to
  *
  * This function sets up hints about how a window can be resized by
@@ -3366,7 +3363,7 @@ gtk_window_unrealize_icon (GtkWindow *window)
 /**
  * gtk_window_set_icon_list:
  * @window: a #GtkWindow
- * @list: list of #GdkPixbuf
+ * @list: (element-type GdkPixbuf) (transfer container): list of #GdkPixbuf
  *
  * Sets up the icon representing a #GtkWindow. The icon is used when
  * the window is minimized (also known as iconified).  Some window
@@ -3420,7 +3417,7 @@ gtk_window_set_icon_list (GtkWindow  *window,
   
   gtk_window_unrealize_icon (window);
   
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gtk_window_realize_icon (window);
 
   /* We could try to update our transient children, but I don't think
@@ -3505,7 +3502,7 @@ update_themed_icon (GtkIconTheme *icon_theme,
   
   gtk_window_unrealize_icon (window);
   
-  if (GTK_WIDGET_REALIZED (window))
+  if (gtk_widget_get_realized (GTK_WIDGET (window)))
     gtk_window_realize_icon (window);  
 }
 
@@ -3561,7 +3558,7 @@ gtk_window_set_icon_name (GtkWindow   *window,
  *
  * Since: 2.6
  */
-G_CONST_RETURN gchar *
+const gchar *
 gtk_window_get_icon_name (GtkWindow *window)
 {
   GtkWindowIconInfo *info;
@@ -3627,7 +3624,7 @@ load_pixbuf_verbosely (const char *filename,
  * gtk_window_set_icon_from_file:
  * @window: a #GtkWindow
  * @filename: location of icon file
- * @err: location to store error, or %NULL.
+ * @err: (allow-none): location to store error, or %NULL.
  *
  * Sets the icon for @window.  
  * Warns on failure if @err is %NULL.
@@ -3659,7 +3656,7 @@ gtk_window_set_icon_from_file (GtkWindow   *window,
 
 /**
  * gtk_window_set_default_icon_list:
- * @list: a list of #GdkPixbuf
+ * @list: (element-type GdkPixbuf) (transfer container): a list of #GdkPixbuf
  *
  * Sets an icon list to be used as fallback for windows that haven't
  * had gtk_window_set_icon_list() called on them to set up a
@@ -3703,7 +3700,7 @@ gtk_window_set_default_icon_list (GList *list)
       if (info && info->using_default_icon)
         {
           gtk_window_unrealize_icon (w);
-          if (GTK_WIDGET_REALIZED (w))
+          if (gtk_widget_get_realized (GTK_WIDGET (w)))
             gtk_window_realize_icon (w);
         }
 
@@ -3774,7 +3771,7 @@ gtk_window_set_default_icon_name (const gchar *name)
       if (info && info->using_default_icon && info->using_themed_icon)
         {
           gtk_window_unrealize_icon (w);
-          if (GTK_WIDGET_REALIZED (w))
+          if (gtk_widget_get_realized (GTK_WIDGET (w)))
             gtk_window_realize_icon (w);
         }
 
@@ -3805,7 +3802,7 @@ gtk_window_get_default_icon_name (void)
 /**
  * gtk_window_set_default_icon_from_file:
  * @filename: location of icon file
- * @err: location to store error, or %NULL.
+ * @err: (allow-none): location to store error, or %NULL.
  *
  * Sets an icon to be used as fallback for windows that haven't
  * had gtk_window_set_icon_list() called on them from a file
@@ -3840,7 +3837,7 @@ gtk_window_set_default_icon_from_file (const gchar *filename,
  * but the pixbufs in the list have not had their reference count
  * incremented.
  * 
- * Return value: copy of default icon list 
+ * Return value: (element-type GdkPixbuf) (transfer container): copy of default icon list 
  **/
 GList*
 gtk_window_get_default_icon_list (void)
@@ -3948,8 +3945,8 @@ gtk_window_set_default_size (GtkWindow   *window,
 /**
  * gtk_window_get_default_size:
  * @window: a #GtkWindow
- * @width: location to store the default width, or %NULL
- * @height: location to store the default height, or %NULL
+ * @width: (out) (allow-none): location to store the default width, or %NULL
+ * @height: (out) (allow-none): location to store the default height, or %NULL
  *
  * Gets the default size of the window. A value of -1 for the width or
  * height indicates that a default size has not been explicitly set
@@ -4016,8 +4013,8 @@ gtk_window_resize (GtkWindow *window,
 /**
  * gtk_window_get_size:
  * @window: a #GtkWindow
- * @width: (out): return location for width, or %NULL
- * @height: (out): return location for height, or %NULL
+ * @width: (out) (allow-none): return location for width, or %NULL
+ * @height: (out) (allow-none): return location for height, or %NULL
  *
  * Obtains the current size of @window. If @window is not onscreen,
  * it returns the size GTK+ will suggest to the <link
@@ -4077,7 +4074,7 @@ gtk_window_get_size (GtkWindow *window,
   if (width == NULL && height == NULL)
     return;
 
-  if (GTK_WIDGET_MAPPED (window))
+  if (gtk_widget_get_mapped (GTK_WIDGET (window)))
     {
       gdk_drawable_get_size (GTK_WIDGET (window)->window,
                              &w, &h);
@@ -4156,7 +4153,7 @@ gtk_window_move (GtkWindow *window,
 
   info = gtk_window_get_geometry_info (window, TRUE);  
   
-  if (GTK_WIDGET_MAPPED (window))
+  if (gtk_widget_get_mapped (widget))
     {
       /* we have now sent a request with this position
        * with currently-active constraints, so toggle flag.
@@ -4208,8 +4205,8 @@ gtk_window_move (GtkWindow *window,
 /**
  * gtk_window_get_position:
  * @window: a #GtkWindow
- * @root_x: return location for X coordinate of gravity-determined reference point
- * @root_y: return location for Y coordinate of gravity-determined reference point
+ * @root_x: (out): return location for X coordinate of gravity-determined reference point
+ * @root_y: (out): return location for Y coordinate of gravity-determined reference point
  *
  * This function returns the position you need to pass to
  * gtk_window_move() to keep @window in its current position.  This
@@ -4263,7 +4260,7 @@ gtk_window_get_position (GtkWindow *window,
   
   if (window->gravity == GDK_GRAVITY_STATIC)
     {
-      if (GTK_WIDGET_MAPPED (widget))
+      if (gtk_widget_get_mapped (widget))
         {
           /* This does a server round-trip, which is sort of wrong;
            * but a server round-trip is inevitable for
@@ -4293,7 +4290,7 @@ gtk_window_get_position (GtkWindow *window,
       gint x, y;
       gint w, h;
       
-      if (GTK_WIDGET_MAPPED (widget))
+      if (gtk_widget_get_mapped (widget))
         {
          if (window->frame)
            gdk_window_get_frame_extents (window->frame, &frame_extents);
@@ -4466,9 +4463,9 @@ gtk_window_show (GtkWidget *widget)
   gboolean need_resize;
 
   GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
-  
-  need_resize = container->need_resize || !GTK_WIDGET_REALIZED (widget);
-  container->need_resize = FALSE;
+
+  need_resize = _gtk_container_get_need_resize (container) || !gtk_widget_get_realized (widget);
+  _gtk_container_set_need_resize (container, FALSE);
 
   if (need_resize)
     {
@@ -4505,7 +4502,7 @@ gtk_window_show (GtkWidget *widget)
 
       /* Then we guarantee we have a realize */
       was_realized = FALSE;
-      if (!GTK_WIDGET_REALIZED (widget))
+      if (!gtk_widget_get_realized (widget))
        {
          gtk_widget_realize (widget);
          was_realized = TRUE;
@@ -4556,17 +4553,19 @@ gtk_window_hide (GtkWidget *widget)
 static void
 gtk_window_map (GtkWidget *widget)
 {
+  GtkWidget *child;
   GtkWindow *window = GTK_WINDOW (widget);
   GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (window);
   GdkWindow *toplevel;
   gboolean auto_mnemonics;
 
-  GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+  gtk_widget_set_mapped (widget, TRUE);
 
-  if (window->bin.child &&
-      GTK_WIDGET_VISIBLE (window->bin.child) &&
-      !GTK_WIDGET_MAPPED (window->bin.child))
-    gtk_widget_map (window->bin.child);
+  child = gtk_bin_get_child (&(window->bin));
+  if (child &&
+      gtk_widget_get_visible (child) &&
+      !gtk_widget_get_mapped (child))
+    gtk_widget_map (child);
 
   if (window->frame)
     toplevel = window->frame;
@@ -4649,7 +4648,7 @@ static gboolean
 gtk_window_map_event (GtkWidget   *widget,
                       GdkEventAny *event)
 {
-  if (!GTK_WIDGET_MAPPED (widget))
+  if (!gtk_widget_get_mapped (widget))
     {
       /* we should be be unmapped, but are getting a MapEvent, this may happen
        * to toplevel XWindows if mapping was intercepted by a window manager
@@ -4671,7 +4670,7 @@ gtk_window_unmap (GtkWidget *widget)
   GtkWindowGeometryInfo *info;    
   GdkWindowState state;
 
-  GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
+  gtk_widget_set_mapped (widget, FALSE);
   if (window->frame)
     gdk_window_withdraw (window->frame);
   else 
@@ -4733,10 +4732,10 @@ gtk_window_realize (GtkWidget *widget)
       
       _gtk_container_queue_resize (GTK_CONTAINER (widget));
 
-      g_return_if_fail (!GTK_WIDGET_REALIZED (widget));
+      g_return_if_fail (!gtk_widget_get_realized (widget));
     }
   
-  GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+  gtk_widget_set_realized (widget, TRUE);
   
   switch (window->type)
     {
@@ -4836,7 +4835,7 @@ gtk_window_realize (GtkWidget *widget)
   gtk_window_paint (widget, NULL);
   
   if (window->transient_parent &&
-      GTK_WIDGET_REALIZED (window->transient_parent))
+      gtk_widget_get_realized (GTK_WIDGET (window->transient_parent)))
     gdk_window_set_transient_for (widget->window,
                                  GTK_WIDGET (window->transient_parent)->window);
 
@@ -4926,53 +4925,33 @@ gtk_window_unrealize (GtkWidget *widget)
   GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);
 }
 
-static void
-gtk_window_size_request (GtkWidget      *widget,
-                        GtkRequisition *requisition)
-{
-  GtkWindow *window;
-  GtkBin *bin;
-
-  window = GTK_WINDOW (widget);
-  bin = GTK_BIN (window);
-  
-  requisition->width = GTK_CONTAINER (window)->border_width * 2;
-  requisition->height = GTK_CONTAINER (window)->border_width * 2;
-
-  if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
-    {
-      GtkRequisition child_requisition;
-      
-      gtk_widget_size_request (bin->child, &child_requisition);
-
-      requisition->width += child_requisition.width;
-      requisition->height += child_requisition.height;
-    }
-}
-
 static void
 gtk_window_size_allocate (GtkWidget     *widget,
                          GtkAllocation *allocation)
 {
   GtkWindow *window;
   GtkAllocation child_allocation;
+  GtkWidget *child;
+  guint border_width;
 
   window = GTK_WINDOW (widget);
   widget->allocation = *allocation;
 
-  if (window->bin.child && GTK_WIDGET_VISIBLE (window->bin.child))
+  child = gtk_bin_get_child (&(window->bin));
+  if (child && gtk_widget_get_visible (child))
     {
-      child_allocation.x = GTK_CONTAINER (window)->border_width;
-      child_allocation.y = GTK_CONTAINER (window)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
+      child_allocation.x = border_width;
+      child_allocation.y = border_width;
       child_allocation.width =
        MAX (1, (gint)allocation->width - child_allocation.x * 2);
       child_allocation.height =
        MAX (1, (gint)allocation->height - child_allocation.y * 2);
 
-      gtk_widget_size_allocate (window->bin.child, &child_allocation);
+      gtk_widget_size_allocate (child, &child_allocation);
     }
 
-  if (GTK_WIDGET_REALIZED (widget) && window->frame)
+  if (gtk_widget_get_realized (widget) && window->frame)
     {
       gdk_window_resize (window->frame,
                         allocation->width + window->frame_left + window->frame_right,
@@ -5173,7 +5152,7 @@ gtk_window_propagate_key_event (GtkWindow        *window,
     {
       GtkWidget *parent;
       
-      if (GTK_WIDGET_IS_SENSITIVE (focus))
+      if (gtk_widget_is_sensitive (focus))
         handled = gtk_widget_event (focus, (GdkEvent*) event);
       
       parent = focus->parent;
@@ -5249,7 +5228,7 @@ gtk_window_move_focus (GtkWindow       *window,
 {
   gtk_widget_child_focus (GTK_WIDGET (window), dir);
   
-  if (!GTK_CONTAINER (window)->focus_child)
+  if (!gtk_container_get_focus_child (GTK_CONTAINER (window)))
     gtk_window_set_focus (window, NULL);
 }
 
@@ -5271,27 +5250,48 @@ static void
 do_focus_change (GtkWidget *widget,
                 gboolean   in)
 {
-  GdkEvent *fevent = gdk_event_new (GDK_FOCUS_CHANGE);
-  
+  GdkDeviceManager *device_manager;
+  GList *devices, *d;
+
   g_object_ref (widget);
-  
-  if (in)
-    GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
-  else
-    GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
-  
-  fevent->focus_change.type = GDK_FOCUS_CHANGE;
-  fevent->focus_change.window = widget->window;
-  if (widget->window)
-    g_object_ref (widget->window);
-  fevent->focus_change.in = in;
-  
-  gtk_widget_event (widget, fevent);
-  
-  g_object_notify (G_OBJECT (widget), "has-focus");
 
+  device_manager = gdk_display_get_device_manager (gtk_widget_get_display (widget));
+  devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
+  devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_SLAVE));
+  devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING));
+
+  for (d = devices; d; d = d->next)
+    {
+      GdkDevice *dev = d->data;
+      GdkEvent *fevent;
+
+      if (dev->source != GDK_SOURCE_KEYBOARD)
+        continue;
+
+      /* Skip non-master keyboards that haven't
+       * selected for events from this window
+       */
+      if (gdk_device_get_device_type (dev) != GDK_DEVICE_TYPE_MASTER &&
+          widget->window &&
+          !gdk_window_get_device_events (widget->window, dev))
+        continue;
+
+      fevent = gdk_event_new (GDK_FOCUS_CHANGE);
+
+      fevent->focus_change.type = GDK_FOCUS_CHANGE;
+      fevent->focus_change.window = widget->window;
+      if (widget->window)
+        g_object_ref (widget->window);
+      fevent->focus_change.in = in;
+      gdk_event_set_device (fevent, dev);
+
+      gtk_widget_send_focus_change (widget, fevent);
+
+      gdk_event_free (fevent);
+    }
+
+  g_list_free (devices);
   g_object_unref (widget);
-  gdk_event_free (fevent);
 }
 
 static gint
@@ -5305,7 +5305,7 @@ gtk_window_focus_in_event (GtkWidget     *widget,
    *  the window is visible before actually handling the
    *  event
    */
-  if (GTK_WIDGET_VISIBLE (widget))
+  if (gtk_widget_get_visible (widget))
     {
       _gtk_window_set_has_toplevel_focus (window, TRUE);
       _gtk_window_set_is_active (window, TRUE);
@@ -5392,10 +5392,8 @@ gtk_window_client_event (GtkWidget       *widget,
 static void
 gtk_window_check_resize (GtkContainer *container)
 {
-  GtkWindow *window = GTK_WINDOW (container);
-
-  if (GTK_WIDGET_VISIBLE (container))
-    gtk_window_move_resize (window);
+  if (gtk_widget_get_visible (GTK_WIDGET (container)))
+    gtk_window_move_resize (GTK_WINDOW (container));
 }
 
 static gboolean
@@ -5405,6 +5403,7 @@ gtk_window_focus (GtkWidget        *widget,
   GtkBin *bin;
   GtkWindow *window;
   GtkContainer *container;
+  GtkWidget *child;
   GtkWidget *old_focus_child;
   GtkWidget *parent;
 
@@ -5412,7 +5411,7 @@ gtk_window_focus (GtkWidget        *widget,
   window = GTK_WINDOW (widget);
   bin = GTK_BIN (widget);
 
-  old_focus_child = container->focus_child;
+  old_focus_child = gtk_container_get_focus_child (container);
   
   /* We need a special implementation here to deal properly with wrapping
    * around in the tab chain without the danger of going into an
@@ -5446,9 +5445,10 @@ gtk_window_focus (GtkWidget        *widget,
     }
 
   /* Now try to focus the first widget in the window */
-  if (bin->child)
+  child = gtk_bin_get_child (bin);
+  if (child)
     {
-      if (gtk_widget_child_focus (bin->child, direction))
+      if (gtk_widget_child_focus (child, direction))
         return TRUE;
     }
 
@@ -5468,28 +5468,28 @@ gtk_window_real_set_focus (GtkWindow *window,
     {
       g_object_ref (old_focus);
       g_object_freeze_notify (G_OBJECT (old_focus));
-      old_focus_had_default = GTK_WIDGET_HAS_DEFAULT (old_focus);
+      old_focus_had_default = gtk_widget_has_default (old_focus);
     }
   if (focus)
     {
       g_object_ref (focus);
       g_object_freeze_notify (G_OBJECT (focus));
-      focus_had_default = GTK_WIDGET_HAS_DEFAULT (focus);
+      focus_had_default = gtk_widget_has_default (focus);
     }
   
   if (window->default_widget)
-    had_default = GTK_WIDGET_HAS_DEFAULT (window->default_widget);
+    had_default = gtk_widget_has_default (window->default_widget);
   
   if (window->focus_widget)
     {
-      if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
+      if (gtk_widget_get_receives_default (window->focus_widget) &&
          (window->focus_widget != window->default_widget))
         {
-         GTK_WIDGET_UNSET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
+          _gtk_widget_set_has_default (window->focus_widget, FALSE);
          gtk_widget_queue_draw (window->focus_widget);
          
          if (window->default_widget)
-           GTK_WIDGET_SET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
+            _gtk_widget_set_has_default (window->default_widget, TRUE);
        }
 
       window->focus_widget = NULL;
@@ -5507,14 +5507,14 @@ gtk_window_real_set_focus (GtkWindow *window,
     {
       window->focus_widget = focus;
   
-      if (GTK_WIDGET_RECEIVES_DEFAULT (window->focus_widget) &&
+      if (gtk_widget_get_receives_default (window->focus_widget) &&
          (window->focus_widget != window->default_widget))
        {
-         if (GTK_WIDGET_CAN_DEFAULT (window->focus_widget))
-           GTK_WIDGET_SET_FLAGS (window->focus_widget, GTK_HAS_DEFAULT);
+         if (gtk_widget_get_can_default (window->focus_widget))
+            _gtk_widget_set_has_default (window->focus_widget, TRUE);
 
          if (window->default_widget)
-           GTK_WIDGET_UNSET_FLAGS (window->default_widget, GTK_HAS_DEFAULT);
+            _gtk_widget_set_has_default (window->default_widget, FALSE);
        }
 
       if (window->has_focus)
@@ -5530,12 +5530,12 @@ gtk_window_real_set_focus (GtkWindow *window,
    * is harmless.
    */
   if (window->default_widget &&
-      (had_default != GTK_WIDGET_HAS_DEFAULT (window->default_widget)))
+      (had_default != gtk_widget_has_default (window->default_widget)))
     gtk_widget_queue_draw (window->default_widget);
   
   if (old_focus)
     {
-      if (old_focus_had_default != GTK_WIDGET_HAS_DEFAULT (old_focus))
+      if (old_focus_had_default != gtk_widget_has_default (old_focus))
        gtk_widget_queue_draw (old_focus);
        
       g_object_thaw_notify (G_OBJECT (old_focus));
@@ -5543,7 +5543,7 @@ gtk_window_real_set_focus (GtkWindow *window,
     }
   if (focus)
     {
-      if (focus_had_default != GTK_WIDGET_HAS_DEFAULT (focus))
+      if (focus_had_default != gtk_widget_has_default (focus))
        gtk_widget_queue_draw (focus);
 
       g_object_thaw_notify (G_OBJECT (focus));
@@ -5551,6 +5551,68 @@ gtk_window_real_set_focus (GtkWindow *window,
     }
 }
 
+
+static void
+gtk_window_size_request_init (GtkSizeRequestIface *iface)
+{
+  iface->get_width  = gtk_window_get_width;
+  iface->get_height = gtk_window_get_height;
+}
+
+
+static void 
+gtk_window_get_width (GtkSizeRequest      *widget,
+                     gint                *minimum_size,
+                     gint                *natural_size)
+{
+  GtkWindow *window;
+  GtkWidget *child;
+  guint border_width;
+
+  window = GTK_WINDOW (widget);
+  child  = gtk_bin_get_child (GTK_BIN (window));
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
+  *minimum_size = border_width * 2;
+  *natural_size = border_width * 2;
+
+  if (child && gtk_widget_get_visible (child))
+    {
+      gint child_min, child_nat;
+      gtk_size_request_get_width (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+
+      *minimum_size += child_min;
+      *natural_size += child_nat;
+    }
+}
+
+static void 
+gtk_window_get_height (GtkSizeRequest      *widget,
+                      gint                *minimum_size,
+                      gint                *natural_size)
+{
+  GtkWindow *window;
+  GtkWidget *child;
+  guint border_width;
+
+  window = GTK_WINDOW (widget);
+  child  = gtk_bin_get_child (GTK_BIN (window));
+
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (window));
+  *minimum_size = border_width * 2;
+  *natural_size = border_width * 2;
+
+  if (child && gtk_widget_get_visible (child))
+    {
+      gint child_min, child_nat;
+      gtk_size_request_get_height (GTK_SIZE_REQUEST (child), &child_min, &child_nat);
+
+      *minimum_size += child_min;
+      *natural_size += child_nat;
+    }
+}
+
+
 /**
  * _gtk_window_unset_focus_and_default:
  * @window: a #GtkWindow
@@ -5569,7 +5631,7 @@ _gtk_window_unset_focus_and_default (GtkWindow *window,
   g_object_ref (window);
   g_object_ref (widget);
       
-  if (GTK_CONTAINER (widget->parent)->focus_child == widget)
+  if (gtk_container_get_focus_child (GTK_CONTAINER (widget->parent)) == widget)
     {
       child = window->focus_widget;
       
@@ -5701,9 +5763,10 @@ static GtkWindowPosition
 get_effective_position (GtkWindow *window)
 {
   GtkWindowPosition pos = window->position;
+
   if (pos == GTK_WIN_POS_CENTER_ON_PARENT &&
       (window->transient_parent == NULL ||
-       !GTK_WIDGET_MAPPED (window->transient_parent)))
+       !gtk_widget_get_mapped (GTK_WIDGET (window->transient_parent))))
     pos = GTK_WIN_POS_NONE;
 
   return pos;
@@ -5726,11 +5789,18 @@ get_monitor_containing_pointer (GtkWindow *window)
   gint monitor_num;
   GdkScreen *window_screen;
   GdkScreen *pointer_screen;
+  GdkDisplay *display;
+  GdkDeviceManager *device_manager;
+  GdkDevice *pointer;
 
   window_screen = gtk_window_check_screen (window);
-  gdk_display_get_pointer (gdk_screen_get_display (window_screen),
-                           &pointer_screen,
-                           &px, &py, NULL);
+  display = gdk_screen_get_display (window_screen);
+  device_manager = gdk_display_get_device_manager (display);
+  pointer = gdk_device_manager_get_client_pointer (device_manager);
+
+  gdk_display_get_device_state (display, pointer,
+                                &pointer_screen,
+                                &px, &py, NULL);
 
   if (pointer_screen == window_screen)
     monitor_num = gdk_screen_get_monitor_at_point (pointer_screen, px, py);
@@ -5881,7 +5951,7 @@ gtk_window_compute_configure_request (GtkWindow    *window,
             GdkRectangle monitor;
             gint ox, oy;
             
-            g_assert (GTK_WIDGET_MAPPED (parent_widget)); /* established earlier */
+            g_assert (gtk_widget_get_mapped (parent_widget)); /* established earlier */
 
             if (parent_widget->window != NULL)
               monitor_num = gdk_screen_get_monitor_at_window (screen,
@@ -5913,12 +5983,19 @@ gtk_window_compute_configure_request (GtkWindow    *window,
             gint screen_height = gdk_screen_get_height (screen);
            gint monitor_num;
            GdkRectangle monitor;
+            GdkDisplay *display;
+            GdkDeviceManager *device_manager;
+            GdkDevice *pointer;
             GdkScreen *pointer_screen;
             gint px, py;
-            
-            gdk_display_get_pointer (gdk_screen_get_display (screen),
-                                     &pointer_screen,
-                                     &px, &py, NULL);
+
+            display = gdk_screen_get_display (screen);
+            device_manager = gdk_display_get_device_manager (display);
+            pointer = gdk_device_manager_get_client_pointer (device_manager);
+
+            gdk_display_get_device_state (display, pointer,
+                                          &pointer_screen,
+                                          &px, &py, NULL);
 
             if (pointer_screen == screen)
               monitor_num = gdk_screen_get_monitor_at_point (screen, px, py);
@@ -6339,7 +6416,7 @@ gtk_window_move_resize (GtkWindow *window)
 
          gdk_window_process_updates (widget->window, TRUE);
 
-         if (container->resize_mode == GTK_RESIZE_QUEUE)
+         if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
            gtk_widget_queue_draw (widget);
        }
       else
@@ -6363,7 +6440,7 @@ gtk_window_move_resize (GtkWindow *window)
           * FIXME: we should also dequeue the pending redraws here, since
           * we handle those ourselves upon ->configure_notify_received==TRUE.
           */
-         if (container->resize_mode == GTK_RESIZE_QUEUE)
+         if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
            {
              gtk_widget_queue_resize_no_redraw (widget);
              _gtk_container_dequeue_resize_handler (container);
@@ -6571,7 +6648,7 @@ gtk_window_compute_hints (GtkWindow   *window,
       else
        new_geometry->min_height += extra_height;
     }
-  else if (!window->allow_shrink)
+  else
     {
       *new_flags |= GDK_HINT_MIN_SIZE;
       
@@ -6591,7 +6668,7 @@ gtk_window_compute_hints (GtkWindow   *window,
       else
        new_geometry->max_height += extra_height;
     }
-  else if (!window->allow_grow)
+  else if (!window->resizable)
     {
       *new_flags |= GDK_HINT_MAX_SIZE;
       
@@ -6619,7 +6696,7 @@ static gint
 gtk_window_expose (GtkWidget      *widget,
                   GdkEventExpose *event)
 {
-  if (!GTK_WIDGET_APP_PAINTABLE (widget))
+  if (!gtk_widget_get_app_paintable (widget))
     gtk_window_paint (widget, &event->area);
   
   if (GTK_WIDGET_CLASS (gtk_window_parent_class)->expose_event)
@@ -6653,7 +6730,7 @@ gtk_window_set_has_frame (GtkWindow *window,
                          gboolean   setting)
 {
   g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (!GTK_WIDGET_REALIZED (window));
+  g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));
 
   window->has_frame = setting != FALSE;
 }
@@ -6716,7 +6793,7 @@ gtk_window_set_frame_dimensions (GtkWindow *window,
   window->frame_right = right;
   window->frame_bottom = bottom;
 
-  if (GTK_WIDGET_REALIZED (widget) && window->frame)
+  if (gtk_widget_get_realized (widget) && window->frame)
     {
       gint width = widget->allocation.width + left + right;
       gint height = widget->allocation.height + top + bottom;
@@ -6778,7 +6855,7 @@ gtk_window_present_with_time (GtkWindow *window,
 
   widget = GTK_WIDGET (window);
 
-  if (GTK_WIDGET_VISIBLE (window))
+  if (gtk_widget_get_visible (widget))
     {
       g_assert (widget->window != NULL);
       
@@ -7234,7 +7311,11 @@ gtk_window_set_resizable (GtkWindow *window,
 {
   g_return_if_fail (GTK_IS_WINDOW (window));
 
-  gtk_window_set_policy_internal (window, FALSE, resizable, FALSE);
+  window->resizable = (resizable != FALSE);
+
+  g_object_notify (G_OBJECT (window), "resizable");
+
+  gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
 }
 
 /**
@@ -7254,7 +7335,7 @@ gtk_window_get_resizable (GtkWindow *window)
    * mean by "resizable" (and will be a reliable indicator if
    * set_policy() hasn't been called)
    */
-  return window->allow_grow;
+  return window->resizable;
 }
 
 /**
@@ -7333,9 +7414,8 @@ gtk_window_begin_resize_drag  (GtkWindow    *window,
   GdkWindow *toplevel;
   
   g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (GTK_WIDGET_VISIBLE (window));
-  
   widget = GTK_WIDGET (window);
+  g_return_if_fail (gtk_widget_get_visible (widget));
   
   if (window->frame)
     toplevel = window->frame;
@@ -7351,10 +7431,10 @@ gtk_window_begin_resize_drag  (GtkWindow    *window,
 /**
  * gtk_window_get_frame_dimensions:
  * @window: a #GtkWindow
- * @left: location to store the width of the frame at the left, or %NULL
- * @top: location to store the height of the frame at the top, or %NULL
- * @right: location to store the width of the frame at the returns, or %NULL
- * @bottom: location to store the height of the frame at the bottom, or %NULL
+ * @left: (out) (allow-none): location to store the width of the frame at the left, or %NULL
+ * @top: (out) (allow-none): location to store the height of the frame at the top, or %NULL
+ * @right: (out) (allow-none): location to store the width of the frame at the returns, or %NULL
+ * @bottom: (out) (allow-none): location to store the height of the frame at the bottom, or %NULL
  *
  * (Note: this is a special-purpose function intended for the
  *  framebuffer port; see gtk_window_set_has_frame(). It will not
@@ -7413,9 +7493,8 @@ gtk_window_begin_move_drag  (GtkWindow *window,
   GdkWindow *toplevel;
   
   g_return_if_fail (GTK_IS_WINDOW (window));
-  g_return_if_fail (GTK_WIDGET_VISIBLE (window));
-  
   widget = GTK_WIDGET (window);
+  g_return_if_fail (gtk_widget_get_visible (widget));
   
   if (window->frame)
     toplevel = window->frame;
@@ -7456,11 +7535,11 @@ gtk_window_set_screen (GtkWindow *window,
   widget = GTK_WIDGET (window);
 
   previous_screen = window->screen;
-  was_mapped = GTK_WIDGET_MAPPED (widget);
+  was_mapped = gtk_widget_get_mapped (widget);
 
   if (was_mapped)
     gtk_widget_unmap (widget);
-  if (GTK_WIDGET_REALIZED (widget))
+  if (gtk_widget_get_realized (widget))
     gtk_widget_unrealize (widget);
       
   gtk_window_free_key_hash (window);
@@ -7569,6 +7648,7 @@ gtk_window_has_toplevel_focus (GtkWindow *window)
 static void
 gtk_window_group_class_init (GtkWindowGroupClass *klass)
 {
+  g_type_class_add_private (klass, sizeof (GtkWindowGroupPrivate));
 }
 
 GType
@@ -7616,6 +7696,8 @@ static void
 window_group_cleanup_grabs (GtkWindowGroup *group,
                            GtkWindow      *window)
 {
+  GtkWindowGroupPrivate *priv;
+  GtkDeviceGrabInfo *info;
   GSList *tmp_list;
   GSList *to_remove = NULL;
 
@@ -7633,6 +7715,27 @@ window_group_cleanup_grabs (GtkWindowGroup *group,
       g_object_unref (to_remove->data);
       to_remove = g_slist_delete_link (to_remove, to_remove);
     }
+
+  priv = GTK_WINDOW_GROUP_GET_PRIVATE (group);
+  tmp_list = priv->device_grabs;
+
+  while (tmp_list)
+    {
+      info = tmp_list->data;
+
+      if (gtk_widget_get_toplevel (info->widget) == (GtkWidget *) window)
+        to_remove = g_slist_prepend (to_remove, info);
+
+      tmp_list = tmp_list->next;
+    }
+
+  while (to_remove)
+    {
+      info = to_remove->data;
+
+      gtk_device_grab_remove (info->widget, info->device);
+      to_remove = g_slist_delete_link (to_remove, to_remove);
+    }
 }
 
 /**
@@ -7723,7 +7826,7 @@ gtk_window_group_list_windows (GtkWindowGroup *window_group)
 
 /**
  * gtk_window_get_group:
- * @window: a #GtkWindow, or %NULL
+ * @window: (allow-none): a #GtkWindow, or %NULL
  *
  * Returns the group for @window or the default group, if
  * @window is %NULL or if @window does not have an explicit
@@ -7749,16 +7852,173 @@ gtk_window_get_group (GtkWindow *window)
     }
 }
 
-/* Return the current grab widget of the given group 
+/**
+ * gtk_window_has_group:
+ * @window: a #GtkWindow
+ *
+ * Returns whether @window has an explicit window group.
+ *
+ * Return value: %TRUE if @window has an explicit window group.
+ *
+ * Since 2.22
+ **/
+gboolean
+gtk_window_has_group (GtkWindow *window)
+{
+  g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
+
+  return window->group != NULL;
+}
+
+/**
+ * gtk_window_group_get_current_grab:
+ * @window_group: a #GtkWindowGroup
+ *
+ * Gets the current grab widget of the given group,
+ * see gtk_grab_add().
+ *
+ * Returns: the current grab widget of the group
+ *
+ * Since: 2.22
  */
 GtkWidget *
-_gtk_window_group_get_current_grab (GtkWindowGroup *window_group)
+gtk_window_group_get_current_grab (GtkWindowGroup *window_group)
 {
+  g_return_val_if_fail (GTK_IS_WINDOW_GROUP (window_group), NULL);
+
   if (window_group->grabs)
     return GTK_WIDGET (window_group->grabs->data);
   return NULL;
 }
 
+void
+_gtk_window_group_add_device_grab (GtkWindowGroup *window_group,
+                                   GtkWidget      *widget,
+                                   GdkDevice      *device,
+                                   gboolean        block_others)
+{
+  GtkWindowGroupPrivate *priv;
+  GtkDeviceGrabInfo *info;
+
+  priv = GTK_WINDOW_GROUP_GET_PRIVATE (window_group);
+
+  info = g_slice_new0 (GtkDeviceGrabInfo);
+  info->widget = widget;
+  info->device = device;
+  info->block_others = block_others;
+
+  priv->device_grabs = g_slist_prepend (priv->device_grabs, info);
+}
+
+void
+_gtk_window_group_remove_device_grab (GtkWindowGroup *window_group,
+                                      GtkWidget      *widget,
+                                      GdkDevice      *device)
+{
+  GtkWindowGroupPrivate *priv;
+  GtkDeviceGrabInfo *info;
+  GSList *list, *node = NULL;
+  GdkDevice *other_device;
+
+  priv = GTK_WINDOW_GROUP_GET_PRIVATE (window_group);
+  other_device = gdk_device_get_associated_device (device);
+  list = priv->device_grabs;
+
+  while (list)
+    {
+      info = list->data;
+
+      if (info->widget == widget &&
+          (info->device == device ||
+           info->device == other_device))
+        {
+          node = list;
+          break;
+        }
+
+      list = list->next;
+    }
+
+  if (node)
+    {
+      info = node->data;
+
+      priv->device_grabs = g_slist_delete_link (priv->device_grabs, node);
+      g_slice_free (GtkDeviceGrabInfo, info);
+    }
+}
+
+/**
+ * gtk_window_group_get_current_device_grab:
+ * @window_group: a #GtkWindowGroup
+ * @device: a #GdkDevice
+ *
+ * Returns the current grab widget for @device, or %NULL if none.
+ *
+ * Returns: The grab widget, or %NULL
+ **/
+GtkWidget *
+gtk_window_group_get_current_device_grab (GtkWindowGroup *window_group,
+                                          GdkDevice      *device)
+{
+  GtkWindowGroupPrivate *priv;
+  GtkDeviceGrabInfo *info;
+  GdkDevice *other_device;
+  GSList *list;
+
+  g_return_val_if_fail (GTK_IS_WINDOW_GROUP (window_group), NULL);
+  g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
+
+  priv = GTK_WINDOW_GROUP_GET_PRIVATE (window_group);
+  list = priv->device_grabs;
+  other_device = gdk_device_get_associated_device (device);
+
+  while (list)
+    {
+      info = list->data;
+      list = list->next;
+
+      if (info->device == device ||
+          info->device == other_device)
+        return info->widget;
+    }
+
+  return NULL;
+}
+
+gboolean
+_gtk_window_group_widget_is_blocked_for_device (GtkWindowGroup *window_group,
+                                                GtkWidget      *widget,
+                                                GdkDevice      *device)
+{
+  GtkWindowGroupPrivate *priv;
+  GtkDeviceGrabInfo *info;
+  GdkDevice *other_device;
+  GSList *list;
+
+  priv = GTK_WINDOW_GROUP_GET_PRIVATE (window_group);
+  other_device = gdk_device_get_associated_device (device);
+  list = priv->device_grabs;
+
+  while (list)
+    {
+      info = list->data;
+      list = list->next;
+
+      /* Look for blocking grabs on other device pairs
+       * that have the passed widget within the GTK+ grab.
+       */
+      if (info->block_others &&
+          info->device != device &&
+          info->device != other_device &&
+          (info->widget == widget ||
+           gtk_widget_is_ancestor (widget, info->widget)))
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
 /*
   Derived from XParseGeometry() in XFree86  
 
@@ -8142,9 +8402,9 @@ _gtk_window_keys_foreach (GtkWindow                *window,
       GtkAccelGroup *group = groups->data;
       gint i;
 
-      for (i = 0; i < group->n_accels; i++)
+      for (i = 0; i < group->priv->n_accels; i++)
        {
-         GtkAccelKey *key = &group->priv_accels[i].key;
+         GtkAccelKey *key = &group->priv->priv_accels[i].key;
          
          if (key->accel_key)
            (*func) (window, key->accel_key, key->accel_mods, FALSE, func_data);
@@ -8331,14 +8591,14 @@ window_update_has_focus (GtkWindow *window)
        {
          if (window->focus_widget &&
              window->focus_widget != widget &&
-             !GTK_WIDGET_HAS_FOCUS (window->focus_widget))
+             !gtk_widget_has_focus (window->focus_widget))
            do_focus_change (window->focus_widget, TRUE);       
        }
       else
        {
          if (window->focus_widget &&
              window->focus_widget != widget &&
-             GTK_WIDGET_HAS_FOCUS (window->focus_widget))
+             gtk_widget_has_focus (window->focus_widget))
            do_focus_change (window->focus_widget, FALSE);
        }
     }
@@ -8385,22 +8645,26 @@ void
 _gtk_window_set_is_toplevel (GtkWindow *window,
                             gboolean   is_toplevel)
 {
-  if (GTK_WIDGET_TOPLEVEL (window))
+  GtkWidget *widget;
+
+  widget = GTK_WIDGET (window);
+
+  if (gtk_widget_is_toplevel (widget))
     g_assert (g_slist_find (toplevel_list, window) != NULL);
   else
     g_assert (g_slist_find (toplevel_list, window) == NULL);
 
-  if (is_toplevel == GTK_WIDGET_TOPLEVEL (window))
+  if (is_toplevel == gtk_widget_is_toplevel (widget))
     return;
 
   if (is_toplevel)
     {
-      GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
+      _gtk_widget_set_is_toplevel (widget, TRUE);
       toplevel_list = g_slist_prepend (toplevel_list, window);
     }
   else
     {
-      GTK_WIDGET_UNSET_FLAGS (window, GTK_TOPLEVEL);
+      _gtk_widget_set_is_toplevel (widget, FALSE);
       toplevel_list = g_slist_remove (toplevel_list, window);
     }
 }
@@ -8470,6 +8734,17 @@ gtk_window_get_window_type (GtkWindow *window)
   return window->type;
 }
 
+/**
+ * gtk_window_get_mnemonics_visible:
+ * @window: a #GtkWindow
+ *
+ * Gets the value of the #GtkWindow:mnemonics-visible property.
+ *
+ * Returns: %TRUE if mnemonics are supposed to be visible
+ * in this window.
+ *
+ * Since: 2.20
+ */
 gboolean
 gtk_window_get_mnemonics_visible (GtkWindow *window)
 {
@@ -8482,6 +8757,15 @@ gtk_window_get_mnemonics_visible (GtkWindow *window)
   return priv->mnemonics_visible;
 }
 
+/**
+ * gtk_window_set_mnemonics_visible:
+ * @window: a #GtkWindow
+ * @setting: the new value
+ *
+ * Sets the #GtkWindow:mnemonics-visible property.
+ *
+ * Since: 2.20
+ */
 void
 gtk_window_set_mnemonics_visible (GtkWindow *window,
                                   gboolean   setting)
@@ -8545,6 +8829,3 @@ gtk_window_set_default_icon_from_file (const gchar *filename,
 }
 
 #endif
-
-#define __GTK_WINDOW_C__
-#include "gtkaliasdef.c"