]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkinvisible.c
Don't add attributes with empty ranges. (fixes #101564 and #80637)
[~andy/gtk] / gtk / gtkinvisible.c
index fc0ecdef3ec0bb99c385ff1c6659380f84063f41..7b7896bf3432d6bf644ec1c57f12d6a71d48d203 100644 (file)
@@ -25,7 +25,6 @@
  */
 
 #include <gdk/gdk.h>
-#include "gtksignal.h"
 #include "gtkinvisible.h"
 #include "gtkintl.h"
 
@@ -57,28 +56,30 @@ static GObject *gtk_invisible_constructor (GType                  type,
                                           guint                  n_construct_properties,
                                           GObjectConstructParam *construct_params);
 
-GObjectClass *parent_class;
+static GObjectClass *parent_class;
 
-GtkType
+GType
 gtk_invisible_get_type (void)
 {
-  static GtkType invisible_type = 0;
+  static GType invisible_type = 0;
 
   if (!invisible_type)
     {
-      static const GtkTypeInfo invisible_info =
+      static const GTypeInfo invisible_info =
       {
-       "GtkInvisible",
-       sizeof (GtkInvisible),
        sizeof (GtkInvisibleClass),
-       (GtkClassInitFunc) gtk_invisible_class_init,
-       (GtkObjectInitFunc) gtk_invisible_init,
-       /* reserved_1 */ NULL,
-        /* reserved_2 */ NULL,
-        (GtkClassInitFunc) NULL,
+       NULL,           /* base_init */
+       NULL,           /* base_finalize */
+       (GClassInitFunc) gtk_invisible_class_init,
+       NULL,           /* class_finalize */
+       NULL,           /* class_data */
+       sizeof (GtkInvisible),
+       0,              /* n_preallocs */
+       (GInstanceInitFunc) gtk_invisible_init,
       };
 
-      invisible_type = gtk_type_unique (GTK_TYPE_WIDGET, &invisible_info);
+      invisible_type = g_type_register_static (GTK_TYPE_WIDGET, "GtkInvisible",
+                                              &invisible_info, 0);
     }
 
   return invisible_type;
@@ -111,7 +112,7 @@ gtk_invisible_class_init (GtkInvisibleClass *class)
                                   PROP_SCREEN,
                                   g_param_spec_object ("screen",
                                                        _("Screen"),
-                                                       _("The screen where this window will be displayed."),
+                                                       _("The screen where this window will be displayed"),
                                                        GDK_TYPE_SCREEN,
                                                        G_PARAM_READWRITE));
 }
@@ -124,11 +125,11 @@ gtk_invisible_init (GtkInvisible *invisible)
   GTK_WIDGET_UNSET_FLAGS (invisible, GTK_NO_WINDOW);
   GTK_WIDGET_SET_FLAGS (invisible, GTK_TOPLEVEL);
 
-  gtk_widget_ref (GTK_WIDGET (invisible));
+  g_object_ref (invisible);
   gtk_object_sink (GTK_OBJECT (invisible));
 
   invisible->has_user_ref_count = TRUE;
-  invisible->screen = gdk_get_default_screen ();
+  invisible->screen = gdk_screen_get_default ();
   
   colormap = _gtk_widget_peek_colormap ();
   if (colormap)
@@ -143,7 +144,7 @@ gtk_invisible_destroy (GtkObject *object)
   if (invisible->has_user_ref_count)
     {
       invisible->has_user_ref_count = FALSE;
-      gtk_widget_unref (GTK_WIDGET (invisible));
+      g_object_unref (invisible);
     }
 }
 
@@ -155,6 +156,8 @@ gtk_invisible_destroy (GtkObject *object)
  * Creates a new #GtkInvisible object for a specified screen
  *
  * Return value: a newly created #GtkInvisible object
+ *
+ * Since: 2.2
  **/
 GtkWidget* 
 gtk_invisible_new_for_screen (GdkScreen *screen)
@@ -183,11 +186,15 @@ gtk_invisible_new (void)
  * @screen: a #GdkScreen.
  *
  * Sets the #GdkScreen where the #GtkInvisible object will be displayed.
+ *
+ * Since: 2.2
  **/ 
 void
 gtk_invisible_set_screen (GtkInvisible *invisible,
                          GdkScreen    *screen)
 {
+  GtkWidget *widget;
+  GdkScreen *previous_screen;
   gboolean was_realized;
   
   g_return_if_fail (GTK_IS_INVISIBLE (invisible));
@@ -196,16 +203,21 @@ gtk_invisible_set_screen (GtkInvisible *invisible,
   if (screen == invisible->screen)
     return;
 
+  widget = GTK_WIDGET (invisible);
+
+  previous_screen = invisible->screen;
   was_realized = GTK_WIDGET_REALIZED (invisible);
 
   if (was_realized)
-    gtk_widget_unrealize (GTK_WIDGET (invisible));
+    gtk_widget_unrealize (widget);
   
   invisible->screen = screen;
+  if (screen != previous_screen)
+    _gtk_widget_propagate_screen_changed (widget, previous_screen);
   g_object_notify (G_OBJECT (invisible), "screen");
   
   if (was_realized)
-    gtk_widget_realize (GTK_WIDGET (invisible));
+    gtk_widget_realize (widget);
 }
 
 /**
@@ -214,7 +226,9 @@ gtk_invisible_set_screen (GtkInvisible *invisible,
  *
  * Returns the #GdkScreen object associated with @invisible
  *
- * Return value : the associated #GdkScreen.
+ * Return value: the associated #GdkScreen.
+ *
+ * Since: 2.2
  **/
 GdkScreen *
 gtk_invisible_get_screen (GtkInvisible *invisible)