]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkwindow.c
Fix the remaining issues that broke the PLT check
[~andy/gtk] / gtk / gtkwindow.c
index 38868f39520177fa75e198f0f0bf91ae0e60a0ae..1238c2295c53dc7a97e78e282522b68b5fa7de0a 100644 (file)
@@ -24,7 +24,7 @@
  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  */
 
-#include <config.h>
+#include "config.h"
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -310,6 +310,7 @@ static GQuark       quark_gtk_embedded = 0;
 static GQuark       quark_gtk_window_key_hash = 0;
 static GQuark       quark_gtk_window_default_icon_pixmap = 0;
 static GQuark       quark_gtk_window_icon_info = 0;
+static GQuark       quark_gtk_buildable_accels = 0;
 
 static GtkBuildableIface *parent_buildable_iface;
 
@@ -330,6 +331,17 @@ static void gtk_window_buildable_set_buildable_property (GtkBuildable        *bu
                                                         const GValue        *value);
 static void gtk_window_buildable_parser_finished (GtkBuildable     *buildable,
                                                  GtkBuilder       *builder);
+static gboolean gtk_window_buildable_custom_tag_start (GtkBuildable  *buildable,
+                                                      GtkBuilder    *builder,
+                                                      GObject       *child,
+                                                      const gchar   *tagname,
+                                                      GMarkupParser *parser,
+                                                      gpointer      *data);
+static void gtk_window_buildable_custom_finished (GtkBuildable  *buildable,
+                                                     GtkBuilder    *builder,
+                                                     GObject       *child,
+                                                     const gchar   *tagname,
+                                                     gpointer       user_data);
 
 
 G_DEFINE_TYPE_WITH_CODE (GtkWindow, gtk_window, GTK_TYPE_BIN,
@@ -342,10 +354,10 @@ add_tab_bindings (GtkBindingSet    *binding_set,
                  GtkDirectionType  direction)
 {
   gtk_binding_entry_add_signal (binding_set, GDK_Tab, modifiers,
-                                "move_focus", 1,
+                                "move-focus", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
   gtk_binding_entry_add_signal (binding_set, GDK_KP_Tab, modifiers,
-                                "move_focus", 1,
+                                "move-focus", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
 }
 
@@ -357,16 +369,16 @@ add_arrow_bindings (GtkBindingSet    *binding_set,
   guint keypad_keysym = keysym - GDK_Left + GDK_KP_Left;
   
   gtk_binding_entry_add_signal (binding_set, keysym, 0,
-                                "move_focus", 1,
+                                "move-focus", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
   gtk_binding_entry_add_signal (binding_set, keysym, GDK_CONTROL_MASK,
-                                "move_focus", 1,
+                                "move-focus", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
   gtk_binding_entry_add_signal (binding_set, keypad_keysym, 0,
-                                "move_focus", 1,
+                                "move-focus", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
   gtk_binding_entry_add_signal (binding_set, keypad_keysym, GDK_CONTROL_MASK,
-                                "move_focus", 1,
+                                "move-focus", 1,
                                 GTK_TYPE_DIRECTION_TYPE, direction);
 }
 
@@ -383,7 +395,8 @@ extract_time_from_startup_id (const gchar* startup_id)
     
       /* Skip past the "_TIME" part */
       timestr += 5;
-    
+
+      errno = 0;
       timestamp = strtoul (timestr, &end, 0);
       if (end != timestr && errno == 0)
         retval = timestamp;
@@ -415,6 +428,7 @@ gtk_window_class_init (GtkWindowClass *klass)
   quark_gtk_window_key_hash = g_quark_from_static_string ("gtk-window-key-hash");
   quark_gtk_window_default_icon_pixmap = g_quark_from_static_string ("gtk-window-default-icon-pixmap");
   quark_gtk_window_icon_info = g_quark_from_static_string ("gtk-window-icon-info");
+  quark_gtk_buildable_accels = g_quark_from_static_string ("gtk-window-buildable-accels");
 
   gobject_class->dispose = gtk_window_dispose;
   gobject_class->finalize = gtk_window_finalize;
@@ -745,6 +759,7 @@ gtk_window_class_init (GtkWindowClass *klass)
                                                        P_("The transient parent of the dialog"),
                                                        GTK_TYPE_WINDOW,
                                                        GTK_PARAM_READWRITE| G_PARAM_CONSTRUCT));
+
   /**
    * GtkWindow:opacity:
    *
@@ -764,7 +779,7 @@ gtk_window_class_init (GtkWindowClass *klass)
                                                        GTK_PARAM_READWRITE));
 
   window_signals[SET_FOCUS] =
-    g_signal_new (I_("set_focus"),
+    g_signal_new (I_("set-focus"),
                   G_TYPE_FROM_CLASS (gobject_class),
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (GtkWindowClass, set_focus),
@@ -774,7 +789,7 @@ gtk_window_class_init (GtkWindowClass *klass)
                   GTK_TYPE_WIDGET);
   
   window_signals[FRAME_EVENT] =
-    g_signal_new (I_("frame_event"),
+    g_signal_new (I_("frame-event"),
                   G_TYPE_FROM_CLASS (gobject_class),
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET(GtkWindowClass, frame_event),
@@ -783,8 +798,17 @@ gtk_window_class_init (GtkWindowClass *klass)
                   G_TYPE_BOOLEAN, 1,
                   GDK_TYPE_EVENT);
 
+  /**
+   * GtkWindow::activate-focus:
+   * @window: the window which received the signal
+   *
+   * The ::activate-default signal is a
+   * <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user activates the currently
+   * focused widget of @window.
+   */
   window_signals[ACTIVATE_FOCUS] =
-    g_signal_new (I_("activate_focus"),
+    g_signal_new (I_("activate-focus"),
                   G_TYPE_FROM_CLASS (gobject_class),
                   G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                   G_STRUCT_OFFSET (GtkWindowClass, activate_focus),
@@ -793,8 +817,17 @@ gtk_window_class_init (GtkWindowClass *klass)
                   G_TYPE_NONE,
                   0);
 
+  /**
+   * GtkWindow::activate-default:
+   * @window: the window which received the signal
+   *
+   * The ::activate-default signal is a
+   * <link linkend="keybinding-signals">keybinding signal</link>
+   * which gets emitted when the user activates the default widget
+   * of @window.
+   */
   window_signals[ACTIVATE_DEFAULT] =
-    g_signal_new (I_("activate_default"),
+    g_signal_new (I_("activate-default"),
                   G_TYPE_FROM_CLASS (gobject_class),
                   G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
                   G_STRUCT_OFFSET (GtkWindowClass, activate_default),
@@ -803,8 +836,15 @@ gtk_window_class_init (GtkWindowClass *klass)
                   G_TYPE_NONE,
                   0);
 
+  /**
+   * GtkWindow::keys-changed:
+   * @window: the window which received the signal
+   *
+   * The ::keys-changed signal gets emitted when the set of accelerators
+   * or mnemonics that are associated with @window changes.
+   */
   window_signals[KEYS_CHANGED] =
-    g_signal_new (I_("keys_changed"),
+    g_signal_new (I_("keys-changed"),
                   G_TYPE_FROM_CLASS (gobject_class),
                   G_SIGNAL_RUN_FIRST,
                   G_STRUCT_OFFSET (GtkWindowClass, keys_changed),
@@ -820,16 +860,16 @@ gtk_window_class_init (GtkWindowClass *klass)
   binding_set = gtk_binding_set_by_class (klass);
 
   gtk_binding_entry_add_signal (binding_set, GDK_space, 0,
-                                "activate_focus", 0);
+                                "activate-focus", 0);
   gtk_binding_entry_add_signal (binding_set, GDK_KP_Space, 0,
-                                "activate_focus", 0);
+                                "activate-focus", 0);
   
   gtk_binding_entry_add_signal (binding_set, GDK_Return, 0,
-                                "activate_default", 0);
+                                "activate-default", 0);
   gtk_binding_entry_add_signal (binding_set, GDK_ISO_Enter, 0,
-                                "activate_default", 0);
+                                "activate-default", 0);
   gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0,
-                                "activate_default", 0);
+                                "activate-default", 0);
 
   add_arrow_bindings (binding_set, GDK_Up, GTK_DIR_UP);
   add_arrow_bindings (binding_set, GDK_Down, GTK_DIR_DOWN);
@@ -900,7 +940,7 @@ gtk_window_init (GtkWindow *window)
 
   gtk_decorated_window_init (window);
 
-  g_signal_connect (window->screen, "composited_changed",
+  g_signal_connect (window->screen, "composited-changed",
                    G_CALLBACK (gtk_window_on_composited_changed), window);
 }
 
@@ -1137,7 +1177,8 @@ gtk_window_buildable_interface_init (GtkBuildableIface *iface)
   parent_buildable_iface = g_type_interface_peek_parent (iface);
   iface->set_buildable_property = gtk_window_buildable_set_buildable_property;
   iface->parser_finished = gtk_window_buildable_parser_finished;
-
+  iface->custom_tag_start = gtk_window_buildable_custom_tag_start;
+  iface->custom_finished = gtk_window_buildable_custom_finished;
 }
 
 static void
@@ -1159,11 +1200,118 @@ gtk_window_buildable_parser_finished (GtkBuildable *buildable,
                                      GtkBuilder   *builder)
 {
   GtkWindowPrivate *priv = GTK_WINDOW_GET_PRIVATE (buildable);
+  GObject *object;
+  GSList *accels, *l;
 
   if (priv->builder_visible)
     gtk_widget_show (GTK_WIDGET (buildable));
 
-    parent_buildable_iface->parser_finished (buildable, builder);
+  accels = g_object_get_qdata (G_OBJECT (buildable), quark_gtk_buildable_accels);
+  for (l = accels; l; l = l->next)
+    {
+      object = gtk_builder_get_object (builder, l->data);
+      if (!object)
+       {
+         g_warning ("Unknown accel group %s specified in window %s",
+                    (const gchar*)l->data, gtk_buildable_get_name (buildable));
+         continue;
+       }
+      gtk_window_add_accel_group (GTK_WINDOW (buildable),
+                                 GTK_ACCEL_GROUP (object));
+      g_free (l->data);
+    }
+
+  g_object_set_qdata (G_OBJECT (buildable), quark_gtk_buildable_accels, NULL);
+
+  parent_buildable_iface->parser_finished (buildable, builder);
+}
+
+typedef struct {
+  GObject *object;
+  GSList *items;
+} GSListSubParserData;
+
+static void
+window_start_element (GMarkupParseContext *context,
+                         const gchar         *element_name,
+                         const gchar        **names,
+                         const gchar        **values,
+                         gpointer            user_data,
+                         GError            **error)
+{
+  guint i;
+  GSListSubParserData *data = (GSListSubParserData*)user_data;
+
+  if (strcmp (element_name, "group") == 0)
+    {
+      for (i = 0; names[i]; i++)
+       {
+         if (strcmp (names[i], "name") == 0)
+           data->items = g_slist_prepend (data->items, g_strdup (values[i]));
+       }
+    }
+  else if (strcmp (element_name, "accel-groups") == 0)
+    return;
+  else
+    g_warning ("Unsupported tag type for GtkWindow: %s\n",
+              element_name);
+
+}
+
+static const GMarkupParser window_parser =
+  {
+    window_start_element
+  };
+
+static gboolean
+gtk_window_buildable_custom_tag_start (GtkBuildable  *buildable,
+                                      GtkBuilder    *builder,
+                                      GObject       *child,
+                                      const gchar   *tagname,
+                                      GMarkupParser *parser,
+                                      gpointer      *data)
+{
+  GSListSubParserData *parser_data;
+
+  if (parent_buildable_iface->custom_tag_start (buildable, builder, child, 
+                                               tagname, parser, data))
+    return TRUE;
+
+  if (strcmp (tagname, "accel-groups") == 0)
+    {
+      parser_data = g_slice_new0 (GSListSubParserData);
+      parser_data->items = NULL;
+      parser_data->object = G_OBJECT (buildable);
+
+      *parser = window_parser;
+      *data = parser_data;
+      return TRUE;
+    }
+
+  return FALSE;
+}
+
+static void
+gtk_window_buildable_custom_finished (GtkBuildable  *buildable,
+                                         GtkBuilder    *builder,
+                                         GObject       *child,
+                                         const gchar   *tagname,
+                                         gpointer       user_data)
+{
+  GSListSubParserData *data;
+
+  parent_buildable_iface->custom_finished (buildable, builder, child, 
+                                          tagname, user_data);
+
+  if (strcmp (tagname, "accel-groups") != 0)
+    return;
+  
+  data = (GSListSubParserData*)user_data;
+
+  g_object_set_qdata_full (G_OBJECT (buildable), quark_gtk_buildable_accels, 
+                          data->items, (GDestroyNotify) g_slist_free);
+
+  g_slice_free (GSListSubParserData, data);
 }
 
 /**
@@ -1352,18 +1500,21 @@ gtk_window_set_startup_id (GtkWindow   *window,
   
   g_free (priv->startup_id);
   priv->startup_id = g_strdup (startup_id);
-  
+
   if (GTK_WIDGET_REALIZED (window))
     {
+      guint32 timestamp = extract_time_from_startup_id (priv->startup_id);
+
+#ifdef GDK_WINDOWING_X11
+      if (timestamp != GDK_CURRENT_TIME)
+       gdk_x11_window_set_user_time (GTK_WIDGET (window)->window, timestamp);
+#endif
+
       /* Here we differentiate real and "fake" startup notification IDs,
        * constructed on purpose just to pass interaction timestamp
-       */  
+       */
       if (startup_id_is_fake (priv->startup_id))
-        {
-          guint32 timestamp = extract_time_from_startup_id (priv->startup_id);
-
-          gtk_window_present_with_time (window, timestamp);
-        }
+       gtk_window_present_with_time (window, timestamp);
       else 
         {
           gdk_window_set_startup_id (GTK_WIDGET (window)->window,
@@ -1513,14 +1664,31 @@ gtk_window_set_default (GtkWindow *window,
     }
 }
 
-void
-gtk_window_set_policy (GtkWindow *window,
-                      gboolean   allow_shrink,
-                      gboolean   allow_grow,
-                      gboolean   auto_shrink)
+/**
+ * gtk_window_get_default_widget:
+ * @window: a #GtkWindow
+ *
+ * Returns the default widget for @window. See gtk_window_set_default()
+ * for more details.
+ *
+ * Returns: the default widget, or %NULL if there is none.
+ *
+ * Since: 2.14
+ **/
+GtkWidget *
+gtk_window_get_default_widget (GtkWindow *window)
 {
-  g_return_if_fail (GTK_IS_WINDOW (window));
+  g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
+
+  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);
 
@@ -1529,8 +1697,19 @@ gtk_window_set_policy (GtkWindow *window,
   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 (GTK_WIDGET (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
@@ -1575,7 +1754,7 @@ gtk_window_add_accel_group (GtkWindow     *window,
   g_return_if_fail (GTK_IS_ACCEL_GROUP (accel_group));
 
   _gtk_accel_group_attach (accel_group, G_OBJECT (window));
-  g_signal_connect_object (accel_group, "accel_changed",
+  g_signal_connect_object (accel_group, "accel-changed",
                           G_CALLBACK (gtk_window_notify_keys_changed),
                           window, G_CONNECT_SWAPPED);
   gtk_window_notify_keys_changed (window);
@@ -1746,7 +1925,7 @@ gtk_window_set_position (GtkWindow         *window,
        */
       info->position_constraints_changed = TRUE;
 
-      gtk_widget_queue_resize (GTK_WIDGET (window));
+      gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
     }
 
   window->position = position;
@@ -1908,7 +2087,7 @@ gtk_window_list_toplevels (void)
 }
 
 void
-gtk_window_add_embedded_xid (GtkWindow *window, guint xid)
+gtk_window_add_embedded_xid (GtkWindow *window, GdkNativeWindow xid)
 {
   GList *embedded_windows;
 
@@ -1927,7 +2106,7 @@ gtk_window_add_embedded_xid (GtkWindow *window, guint xid)
 }
 
 void
-gtk_window_remove_embedded_xid (GtkWindow *window, guint xid)
+gtk_window_remove_embedded_xid (GtkWindow *window, GdkNativeWindow xid)
 {
   GList *embedded_windows;
   GList *node;
@@ -2033,10 +2212,6 @@ gtk_window_unset_transient_for  (GtkWindow *window)
   
   if (window->transient_parent)
     {
-      if (priv->transient_parent_group)
-       gtk_window_group_remove_window (window->group,
-                                       window);
-
       g_signal_handlers_disconnect_by_func (window->transient_parent,
                                            gtk_window_transient_parent_realized,
                                            window);
@@ -2054,7 +2229,13 @@ gtk_window_unset_transient_for  (GtkWindow *window)
         disconnect_parent_destroyed (window);
       
       window->transient_parent = NULL;
-      priv->transient_parent_group = FALSE;
+
+      if (priv->transient_parent_group)
+       {
+         priv->transient_parent_group = FALSE;
+         gtk_window_group_remove_window (window->group,
+                                         window);
+       }
     }
 }
 
@@ -2671,7 +2852,7 @@ gtk_window_set_geometry_hints (GtkWindow       *window,
       gtk_window_set_gravity (window, geometry->win_gravity);
     }
   
-  gtk_widget_queue_resize (GTK_WIDGET (window));
+  gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
 }
 
 /**
@@ -3330,6 +3511,9 @@ gtk_window_set_icon_name (GtkWindow   *window,
 
   info = ensure_icon_info (window);
 
+  if (g_strcmp0 (info->icon_name, name) == 0)
+    return;
+
   tmp = info->icon_name;
   info->icon_name = g_strdup (name);
   g_free (tmp);
@@ -3530,7 +3714,7 @@ gtk_window_set_default_icon (GdkPixbuf *icon)
 /**
  * gtk_window_set_default_icon_name:
  * @name: the name of the themed icon
- * 
+ *
  * Sets an icon to be used as fallback for windows that haven't
  * had gtk_window_set_icon_list() called on them from a named
  * themed icon, see gtk_window_set_icon_name().
@@ -3577,6 +3761,25 @@ gtk_window_set_default_icon_name (const gchar *name)
   g_list_free (toplevels);
 }
 
+/**
+ * gtk_window_get_default_icon_name:
+ *
+ * Returns the fallback icon name for windows that has been set
+ * with gtk_window_set_default_icon_name(). The returned
+ * string is owned by GTK+ and should not be modified. It
+ * is only valid until the next call to
+ * gtk_window_set_default_icon_name().
+ *
+ * Returns: the fallback icon name for windows
+ *
+ * Since: 2.16
+ */
+const gchar *
+gtk_window_get_default_icon_name (void)
+{
+  return default_icon_name;
+}
+
 /**
  * gtk_window_set_default_icon_from_file:
  * @filename: location of icon file
@@ -3670,7 +3873,7 @@ gtk_window_set_default_size_internal (GtkWindow    *window,
   
   g_object_thaw_notify (G_OBJECT (window));
   
-  gtk_widget_queue_resize (GTK_WIDGET (window));
+  gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
 }
 
 /**
@@ -3785,7 +3988,7 @@ gtk_window_resize (GtkWindow *window,
   info->resize_width = width;
   info->resize_height = height;
 
-  gtk_widget_queue_resize (GTK_WIDGET (window));
+  gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
 }
 
 /**
@@ -3812,7 +4015,7 @@ gtk_window_resize (GtkWindow *window,
  * because the size of the window may change between the time that you
  * get the size and the time that you perform some action assuming
  * that size is the current size. To avoid race conditions, connect to
- * "configure_event" on the window and adjust your size-dependent
+ * "configure-event" on the window and adjust your size-dependent
  * state to match the size delivered in the #GdkEventConfigure.
  *
  * Note 2: The returned size does <emphasis>not</emphasis> include the
@@ -4686,8 +4889,8 @@ gtk_window_unrealize (GtkWidget *widget)
 
   /* Icons */
   gtk_window_unrealize_icon (window);
-  
-  (* GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize) (widget);
+
+  GTK_WIDGET_CLASS (gtk_window_parent_class)->unrealize (widget);
 }
 
 static void
@@ -5110,7 +5313,7 @@ send_client_message_to_embedded_windows (GtkWidget *widget,
       
       while (embedded_windows)
        {
-         guint xid = GPOINTER_TO_UINT (embedded_windows->data);
+         GdkNativeWindow xid = (GdkNativeWindow) embedded_windows->data;
          gdk_event_send_client_message_for_display (gtk_widget_get_display (widget), send_event, xid);
          embedded_windows = embedded_windows->next;
        }
@@ -6020,7 +6223,7 @@ gtk_window_move_resize (GtkWindow *window)
            */
          info->last = saved_last_info;
           
-         gtk_widget_queue_resize (widget); /* migth recurse for GTK_RESIZE_IMMEDIATE */
+         gtk_widget_queue_resize_no_redraw (widget); /* migth recurse for GTK_RESIZE_IMMEDIATE */
        }
 
       return;                  /* Bail out, we didn't really process the move/resize */
@@ -6113,7 +6316,7 @@ gtk_window_move_resize (GtkWindow *window)
           */
          if (container->resize_mode == GTK_RESIZE_QUEUE)
            {
-             gtk_widget_queue_resize (widget);
+             gtk_widget_queue_resize_no_redraw (widget);
              _gtk_container_dequeue_resize_handler (container);
            }
        }
@@ -6569,7 +6772,7 @@ gtk_window_present_with_time (GtkWindow *window,
  * in which case the window will be iconified before it ever appears
  * onscreen.
  *
- * You can track iconification via the "window_state_event" signal
+ * You can track iconification via the "window-state-event" signal
  * on #GtkWidget.
  * 
  **/
@@ -6604,7 +6807,7 @@ gtk_window_iconify (GtkWindow *window)
  * linkend="gtk-X11-arch">window manager</link>) could iconify it
  * again before your code which assumes deiconification gets to run.
  *
- * You can track iconification via the "window_state_event" signal
+ * You can track iconification via the "window-state-event" signal
  * on #GtkWidget.
  **/
 void
@@ -6642,7 +6845,7 @@ gtk_window_deiconify (GtkWindow *window)
  *
  * It's permitted to call this function before showing a window.
  *
- * You can track stickiness via the "window_state_event" signal
+ * You can track stickiness via the "window-state-event" signal
  * on #GtkWidget.
  * 
  **/
@@ -6678,7 +6881,7 @@ gtk_window_stick (GtkWindow *window)
  * manager</link>) could stick it again. But normally the window will
  * end up stuck. Just don't write code that crashes if not.
  *
- * You can track stickiness via the "window_state_event" signal
+ * You can track stickiness via the "window-state-event" signal
  * on #GtkWidget.
  * 
  **/
@@ -6719,7 +6922,7 @@ gtk_window_unstick (GtkWindow *window)
  * in which case the window will be maximized when it appears onscreen
  * initially.
  *
- * You can track maximization via the "window_state_event" signal
+ * You can track maximization via the "window-state-event" signal
  * on #GtkWidget.
  * 
  **/
@@ -6755,7 +6958,7 @@ gtk_window_maximize (GtkWindow *window)
  * managers honor requests to unmaximize. But normally the window will
  * end up unmaximized. Just don't write code that crashes if not.
  *
- * You can track maximization via the "window_state_event" signal
+ * You can track maximization via the "window-state-event" signal
  * on #GtkWidget.
  * 
  **/
@@ -6792,7 +6995,7 @@ gtk_window_unmaximize (GtkWindow *window)
  * windows. But normally the window will end up fullscreen. Just
  * don't write code that crashes if not.
  *
- * You can track the fullscreen state via the "window_state_event" signal
+ * You can track the fullscreen state via the "window-state-event" signal
  * on #GtkWidget.
  * 
  * Since: 2.2
@@ -6832,7 +7035,7 @@ gtk_window_fullscreen (GtkWindow *window)
  * windows. But normally the window will end up restored to its normal
  * state. Just don't write code that crashes if not.
  *
- * You can track the fullscreen state via the "window_state_event" signal
+ * You can track the fullscreen state via the "window-state-event" signal
  * on #GtkWidget.
  * 
  * Since: 2.2
@@ -6877,7 +7080,7 @@ gtk_window_unfullscreen (GtkWindow *window)
  * in which case the window will be kept above when it appears onscreen
  * initially.
  *
- * You can track the above state via the "window_state_event" signal
+ * You can track the above state via the "window-state-event" signal
  * on #GtkWidget.
  *
  * Note that, according to the <ulink 
@@ -6931,7 +7134,7 @@ gtk_window_set_keep_above (GtkWindow *window,
  * in which case the window will be kept below when it appears onscreen
  * initially.
  *
- * You can track the below state via the "window_state_event" signal
+ * You can track the below state via the "window-state-event" signal
  * on #GtkWidget.
  *
  * Note that, according to the <ulink 
@@ -6982,7 +7185,7 @@ gtk_window_set_resizable (GtkWindow *window,
 {
   g_return_if_fail (GTK_IS_WINDOW (window));
 
-  gtk_window_set_policy (window, FALSE, resizable, FALSE);
+  gtk_window_set_policy_internal (window, FALSE, resizable, FALSE);
 }
 
 /**
@@ -7030,7 +7233,7 @@ gtk_window_set_gravity (GtkWindow *window,
 
       /* gtk_window_move_resize() will adapt gravity
        */
-      gtk_widget_queue_resize (GTK_WIDGET (window));
+      gtk_widget_queue_resize_no_redraw (GTK_WIDGET (window));
 
       g_object_notify (G_OBJECT (window), "gravity");
     }
@@ -7218,7 +7421,7 @@ gtk_window_set_screen (GtkWindow *window,
     {
       g_signal_handlers_disconnect_by_func (previous_screen,
                                            gtk_window_on_composited_changed, window);
-      g_signal_connect (screen, "composited_changed", 
+      g_signal_connect (screen, "composited-changed", 
                        G_CALLBACK (gtk_window_on_composited_changed), window);
       
       _gtk_widget_propagate_screen_changed (widget, previous_screen);
@@ -7437,6 +7640,37 @@ gtk_window_group_remove_window (GtkWindowGroup *window_group,
   g_object_unref (window);
 }
 
+/**
+ * gtk_window_group_list_windows:
+ * @window_group: a #GtkWindowGroup
+ *
+ * Returns a list of the #GtkWindows that belong to @window_group.
+ *
+ * Returns: A newly-allocated list of windows inside the group.
+ *
+ * Since: 2.14
+ **/
+GList *
+gtk_window_group_list_windows (GtkWindowGroup *window_group)
+{
+  GList *toplevels, *toplevel, *group_windows;
+
+  g_return_val_if_fail (GTK_IS_WINDOW_GROUP (window_group), NULL);
+
+  group_windows = NULL;
+  toplevels = gtk_window_list_toplevels ();
+
+  for (toplevel = toplevels; toplevel; toplevel = toplevel->next)
+    {
+      GtkWindow *window = toplevel->data;
+
+      if (window_group == window->group)
+       group_windows = g_list_prepend (group_windows, window);
+    }
+
+  return g_list_reverse (group_windows);
+}
+
 /**
  * gtk_window_get_group:
  * @window: a #GtkWindow, or %NULL
@@ -7967,6 +8201,8 @@ gtk_window_activate_key (GtkWindow   *window,
 {
   GtkKeyHash *key_hash;
   GtkWindowKeyEntry *found_entry = NULL;
+  gboolean enable_mnemonics;
+  gboolean enable_accels;
 
   g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
   g_return_val_if_fail (event != NULL, FALSE);
@@ -7975,39 +8211,43 @@ gtk_window_activate_key (GtkWindow   *window,
 
   if (key_hash)
     {
+      GSList *tmp_list;
       GSList *entries = _gtk_key_hash_lookup (key_hash,
                                              event->hardware_keycode,
                                              event->state,
                                              gtk_accelerator_get_default_mod_mask (),
                                              event->group);
-      GSList *tmp_list;
+
+      g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
+                    "gtk-enable-mnemonics", &enable_mnemonics,
+                    "gtk-enable-accels", &enable_accels,
+                    NULL);
 
       for (tmp_list = entries; tmp_list; tmp_list = tmp_list->next)
        {
          GtkWindowKeyEntry *entry = tmp_list->data;
          if (entry->is_mnemonic)
-           {
-             found_entry = entry;
-             break;
-           }
+            {
+              if (enable_mnemonics)
+               {
+                 found_entry = entry;
+                 break;
+               }
+            }
+          else 
+            {
+              if (enable_accels && !found_entry)
+                {
+                 found_entry = entry;
+                }
+            }
        }
-      
-      if (!found_entry && entries)
-       found_entry = entries->data;
 
       g_slist_free (entries);
     }
 
   if (found_entry)
     {
-      gboolean enable_mnemonics;
-      gboolean enable_accels;
-
-      g_object_get (gtk_widget_get_settings (GTK_WIDGET (window)),
-                    "gtk-enable-mnemonics", &enable_mnemonics,
-                    "gtk-enable-accels", &enable_accels,
-                    NULL);
-
       if (found_entry->is_mnemonic)
         {
           if (enable_mnemonics)
@@ -8078,6 +8318,41 @@ _gtk_window_set_is_active (GtkWindow *window,
     }
 }
 
+/**
+ * _gtk_windwo_set_is_toplevel:
+ * @window: a #GtkWindow
+ * @is_toplevel: %TRUE if the window is still a real toplevel (nominally a
+ * parent of the root window); %FALSE if it is not (for example, for an
+ * in-process, parented GtkPlug)
+ *
+ * Internal function used by #GtkPlug when it gets parented/unparented by a
+ * #GtkSocket.  This keeps the @window's #GTK_TOPLEVEL flag in sync with the
+ * global list of toplevel windows.
+ */
+void
+_gtk_window_set_is_toplevel (GtkWindow *window,
+                            gboolean   is_toplevel)
+{
+  if (GTK_WIDGET_TOPLEVEL (window))
+    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))
+    return;
+
+  if (is_toplevel)
+    {
+      GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
+      toplevel_list = g_slist_prepend (toplevel_list, window);
+    }
+  else
+    {
+      GTK_WIDGET_UNSET_FLAGS (window, GTK_TOPLEVEL);
+      toplevel_list = g_slist_remove (toplevel_list, window);
+    }
+}
+
 /**
  * _gtk_window_set_has_toplevel_focus:
  * @window: a #GtkWindow
@@ -8125,7 +8400,7 @@ gtk_window_set_auto_startup_notification (gboolean setting)
   disable_startup_notification = !setting;
 }
 
-#ifdef G_OS_WIN32
+#if defined (G_OS_WIN32) && !defined (_WIN64)
 
 #undef gtk_window_set_icon_from_file