Deprecate flag macros for toplevel, state, no window and composite child

Deprecate widget flag macros GTK_WIDGET_STATE, GTK_WIDGET_SAVED_STATE,
GTK_WIDGET_FLAGS, GTK_WIDGET_TOPLEVEL, GTK_WIDGET_NO_WINDOW and
GTK_WIDGET_COMPOSITE_CHILD.

Also deprecate the type macros GTK_WIDGET_TYPE, GTK_OBJECT_TYPE_NAME and
GTK_OBJECT_TYPE which have become redundant.

Instances of GTK_WIDGET_TOPLEVEL are replaced with gtk_widget_is_toplevel,
GTK_WIDGET_TYPE is replaced with G_OBJECT_TYPE, GTK_WIDGET_COMPOSITE_CHILD
is replaced with use of the "composite-child" property and uses of
GTK_WIDGET_NO_WINDOW are adjusted to use gtk_widget_get_has_window.

Uses of GTK_WIDGET_SAVED_STATE and GTK_WIDGET_FLAGS inside GtkWidget are
changed to direct flag usage.

Documentation is updated to refer to gtk_widget_set_has_window and
gtk_widget_get_has_window.

Gail and tests are updated as well.

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=69872
This commit is contained in:
Christian Dywan 2010-01-04 07:49:26 +01:00
parent ac26960e62
commit bb1824c131
51 changed files with 158 additions and 130 deletions

View File

@ -124,11 +124,10 @@
However, in practice it is convenient to have widgets which do However, in practice it is convenient to have widgets which do
not have a <classname>GdkWindow</classname> of their own, but not have a <classname>GdkWindow</classname> of their own, but
rather share the one from their parent widget. Such widgets rather share the one from their parent widget. Such widgets
have the <constant>GTK_NO_WINDOW</constant> <link have called <function>gtk_widget_set_has_window</function> to
linkend="GtkWidgetFlags">widget flag</link> turned on; this disable it; this can be tested easily with the <link
can be tested easily with the <link linkend="gtk-widget-get-has-window"><function>gtk_widget_get_has_window()</function></link>
linkend="GTK-WIDGET-NO-WINDOW-CAPS"><function>GTK_WIDGET_NO_WINDOW()</function></link> function. As such, these are called <firstterm>no-window
macro. As such, these are called <firstterm>no-window
widgets</firstterm>. widgets</firstterm>.
</para> </para>

View File

@ -195,9 +195,8 @@
<para> <para>
A widget that does not have a GdkWindow of its own on which to A widget that does not have a GdkWindow of its own on which to
draw its contents, but rather shares its <glossterm draw its contents, but rather shares its <glossterm
linkend="parent">parent's</glossterm>. Such a widget has the linkend="parent">parent's</glossterm>. This can be tested with
%GTK_NO_WINDOW <link linkend="GtkWidgetFlags">flag</link> set, and the gtk_widget_get_has_window() function. See
can be tested with the GTK_WIDGET_NO_WINDOW() macro. See
<xref linkend="window-no-window-widgets"/> for a detailed <xref linkend="window-no-window-widgets"/> for a detailed
description of this flag. description of this flag.
</para> </para>

View File

@ -111,21 +111,6 @@ if all references are released.
</para> </para>
<!-- ##### MACRO GTK_OBJECT_TYPE ##### -->
<para>
Gets the type of an object.
</para>
@object: a #GtkObject.
<!-- ##### MACRO GTK_OBJECT_TYPE_NAME ##### -->
<para>
Gets the name of an objects type.
</para>
@object: a #GtkObject.
<!-- ##### ENUM GtkObjectFlags ##### --> <!-- ##### ENUM GtkObjectFlags ##### -->
<para> <para>

View File

@ -1695,7 +1695,7 @@ gtk_assistant_insert_page (GtkAssistant *assistant,
g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0); g_return_val_if_fail (GTK_IS_ASSISTANT (assistant), 0);
g_return_val_if_fail (GTK_IS_WIDGET (page), 0); g_return_val_if_fail (GTK_IS_WIDGET (page), 0);
g_return_val_if_fail (page->parent == NULL, 0); g_return_val_if_fail (page->parent == NULL, 0);
g_return_val_if_fail (!GTK_WIDGET_TOPLEVEL (page), 0); g_return_val_if_fail (!gtk_widget_is_toplevel (page), 0);
priv = assistant->priv; priv = assistant->priv;

View File

@ -6149,7 +6149,7 @@ typedef struct
/* The window to which widget->window is relative */ /* The window to which widget->window is relative */
#define ALLOCATION_WINDOW(widget) \ #define ALLOCATION_WINDOW(widget) \
(GTK_WIDGET_NO_WINDOW (widget) ? \ (!gtk_widget_get_has_window (widget) ? \
(widget)->window : \ (widget)->window : \
gdk_window_get_parent ((widget)->window)) gdk_window_get_parent ((widget)->window))

View File

@ -713,7 +713,7 @@ gtk_color_button_clicked (GtkButton *button)
color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog); color_dialog = GTK_COLOR_SELECTION_DIALOG (color_button->priv->cs_dialog);
if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent)) if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
{ {
if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog))) if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (color_dialog)))
gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent)); gtk_window_set_transient_for (GTK_WINDOW (color_dialog), GTK_WINDOW (parent));

View File

@ -1489,7 +1489,7 @@ gtk_combo_box_menu_position_below (GtkMenu *menu,
sx = sy = 0; sx = sy = 0;
if (GTK_WIDGET_NO_WINDOW (child)) if (!gtk_widget_get_has_window (child))
{ {
sx += child->allocation.x; sx += child->allocation.x;
sy += child->allocation.y; sy += child->allocation.y;
@ -1652,7 +1652,7 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
*x = *y = 0; *x = *y = 0;
if (GTK_WIDGET_NO_WINDOW (sample)) if (!gtk_widget_get_has_window (sample))
{ {
*x += sample->allocation.x; *x += sample->allocation.x;
*y += sample->allocation.y; *y += sample->allocation.y;

View File

@ -1261,7 +1261,7 @@ gtk_container_set_resize_mode (GtkContainer *container,
g_return_if_fail (GTK_IS_CONTAINER (container)); g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (resize_mode <= GTK_RESIZE_IMMEDIATE); g_return_if_fail (resize_mode <= GTK_RESIZE_IMMEDIATE);
if (GTK_WIDGET_TOPLEVEL (container) && if (gtk_widget_is_toplevel (GTK_WIDGET (container)) &&
resize_mode == GTK_RESIZE_PARENT) resize_mode == GTK_RESIZE_PARENT)
{ {
resize_mode = GTK_RESIZE_QUEUE; resize_mode = GTK_RESIZE_QUEUE;
@ -1380,7 +1380,7 @@ _gtk_container_queue_resize (GtkContainer *container)
if (resize_container) if (resize_container)
{ {
if (GTK_WIDGET_VISIBLE (resize_container) && if (GTK_WIDGET_VISIBLE (resize_container) &&
(GTK_WIDGET_TOPLEVEL (resize_container) || GTK_WIDGET_REALIZED (resize_container))) (gtk_widget_is_toplevel (GTK_WIDGET (resize_container)) || GTK_WIDGET_REALIZED (resize_container)))
{ {
switch (resize_container->resize_mode) switch (resize_container->resize_mode)
{ {
@ -1690,11 +1690,14 @@ gchar*
_gtk_container_child_composite_name (GtkContainer *container, _gtk_container_child_composite_name (GtkContainer *container,
GtkWidget *child) GtkWidget *child)
{ {
gboolean composite_child;
g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL); g_return_val_if_fail (GTK_IS_CONTAINER (container), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (child), NULL); g_return_val_if_fail (GTK_IS_WIDGET (child), NULL);
g_return_val_if_fail (child->parent == GTK_WIDGET (container), NULL); g_return_val_if_fail (child->parent == GTK_WIDGET (container), NULL);
if (GTK_WIDGET_COMPOSITE_CHILD (child)) g_object_get (child, "composite-child", &composite_child, NULL);
if (composite_child)
{ {
static GQuark quark_composite_name = 0; static GQuark quark_composite_name = 0;
gchar *name; gchar *name;

View File

@ -357,7 +357,7 @@ gtk_drag_highlight_expose (GtkWidget *widget,
{ {
cairo_t *cr; cairo_t *cr;
if (GTK_WIDGET_NO_WINDOW (widget)) if (!gtk_widget_get_has_window (widget))
{ {
x = widget->allocation.x; x = widget->allocation.x;
y = widget->allocation.y; y = widget->allocation.y;
@ -434,7 +434,7 @@ get_toplevel_nswindow (GtkWidget *widget)
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (widget); GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel) && toplevel->window) if (gtk_widget_is_toplevel (toplevel) && toplevel->window)
return [gdk_quartz_window_get_nsview (toplevel->window) window]; return [gdk_quartz_window_get_nsview (toplevel->window) window];
else else
return NULL; return NULL;
@ -697,7 +697,7 @@ gtk_drag_find_widget (GtkWidget *widget,
allocation_to_window_x = widget->allocation.x; allocation_to_window_x = widget->allocation.x;
allocation_to_window_y = widget->allocation.y; allocation_to_window_y = widget->allocation.y;
if (!GTK_WIDGET_NO_WINDOW (widget)) if (gtk_widget_get_has_window (widget))
{ {
/* The allocation is relative to the parent window for /* The allocation is relative to the parent window for
* window widgets, not to widget->window. * window widgets, not to widget->window.

View File

@ -1106,7 +1106,7 @@ gtk_drag_highlight_expose (GtkWidget *widget,
{ {
cairo_t *cr; cairo_t *cr;
if (GTK_WIDGET_NO_WINDOW (widget)) if (!gtk_widget_get_has_window (widget))
{ {
x = widget->allocation.x; x = widget->allocation.x;
y = widget->allocation.y; y = widget->allocation.y;
@ -1860,7 +1860,7 @@ gtk_drag_find_widget (GtkWidget *widget,
allocation_to_window_x = widget->allocation.x; allocation_to_window_x = widget->allocation.x;
allocation_to_window_y = widget->allocation.y; allocation_to_window_y = widget->allocation.y;
if (!GTK_WIDGET_NO_WINDOW (widget)) if (gtk_widget_get_has_window (widget))
{ {
/* The allocation is relative to the parent window for /* The allocation is relative to the parent window for
* window widgets, not to widget->window. * window widgets, not to widget->window.
@ -2065,7 +2065,7 @@ gtk_drag_dest_realized (GtkWidget *widget)
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (widget); GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
gdk_window_register_dnd (toplevel->window); gdk_window_register_dnd (toplevel->window);
} }
@ -2075,7 +2075,7 @@ gtk_drag_dest_hierarchy_changed (GtkWidget *widget,
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (widget); GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel) && GTK_WIDGET_REALIZED (toplevel)) if (gtk_widget_is_toplevel (toplevel) && GTK_WIDGET_REALIZED (toplevel))
gdk_window_register_dnd (toplevel->window); gdk_window_register_dnd (toplevel->window);
} }

View File

@ -79,7 +79,7 @@ gtk_drawing_area_realize (GtkWidget *widget)
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
if (GTK_WIDGET_NO_WINDOW (widget)) if (!gtk_widget_get_has_window (widget))
{ {
GTK_WIDGET_CLASS (gtk_drawing_area_parent_class)->realize (widget); GTK_WIDGET_CLASS (gtk_drawing_area_parent_class)->realize (widget);
} }
@ -121,7 +121,7 @@ gtk_drawing_area_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
{ {
if (!GTK_WIDGET_NO_WINDOW (widget)) if (gtk_widget_get_has_window (widget))
gdk_window_move_resize (widget->window, gdk_window_move_resize (widget->window,
allocation->x, allocation->y, allocation->x, allocation->y,
allocation->width, allocation->height); allocation->width, allocation->height);

View File

@ -2449,7 +2449,7 @@ open_dialog (GtkFileChooserButton *button)
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
if (GTK_WIDGET_TOPLEVEL (toplevel) && GTK_IS_WINDOW (toplevel)) if (gtk_widget_is_toplevel (toplevel) && GTK_IS_WINDOW (toplevel))
{ {
if (GTK_WINDOW (toplevel) != gtk_window_get_transient_for (GTK_WINDOW (priv->dialog))) if (GTK_WINDOW (toplevel) != gtk_window_get_transient_for (GTK_WINDOW (priv->dialog)))
gtk_window_set_transient_for (GTK_WINDOW (priv->dialog), gtk_window_set_transient_for (GTK_WINDOW (priv->dialog),

View File

@ -927,7 +927,7 @@ get_toplevel (GtkWidget *widget)
GtkWidget *toplevel; GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (!GTK_WIDGET_TOPLEVEL (toplevel)) if (!gtk_widget_is_toplevel (toplevel))
return NULL; return NULL;
else else
return GTK_WINDOW (toplevel); return GTK_WINDOW (toplevel);

View File

@ -705,7 +705,7 @@ gtk_font_button_clicked (GtkButton *button)
font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog); font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent)) if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
{ {
if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (font_dialog))) if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (font_dialog)))
gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent)); gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent));

View File

@ -273,7 +273,7 @@ list_row_activated (GtkWidget *widget)
GtkWindow *window; GtkWindow *window;
window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget))); window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (widget)));
if (!GTK_WIDGET_TOPLEVEL (window)) if (!gtk_widget_is_toplevel (GTK_WIDGET (window)))
window = NULL; window = NULL;
if (window if (window

View File

@ -478,7 +478,7 @@ gtk_handle_box_style_set (GtkWidget *widget,
GtkHandleBox *hb = GTK_HANDLE_BOX (widget); GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
if (GTK_WIDGET_REALIZED (widget) && if (GTK_WIDGET_REALIZED (widget) &&
!GTK_WIDGET_NO_WINDOW (widget)) gtk_widget_get_has_window (widget))
{ {
gtk_style_set_background (widget->style, widget->window, gtk_style_set_background (widget->style, widget->window,
widget->state); widget->state);

View File

@ -8487,7 +8487,7 @@ gtk_icon_view_item_accessible_grab_focus (AtkComponent *component)
gtk_widget_grab_focus (item->widget); gtk_widget_grab_focus (item->widget);
gtk_icon_view_set_cursor_item (GTK_ICON_VIEW (item->widget), item->item, -1); gtk_icon_view_set_cursor_item (GTK_ICON_VIEW (item->widget), item->item, -1);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (item->widget)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (item->widget));
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
gtk_window_present (GTK_WINDOW (toplevel)); gtk_window_present (GTK_WINDOW (toplevel));
return TRUE; return TRUE;

View File

@ -1503,7 +1503,7 @@ gtk_label_setup_mnemonic (GtkLabel *label,
connect_mnemonics_visible_notify (GTK_LABEL (widget)); connect_mnemonics_visible_notify (GTK_LABEL (widget));
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
{ {
GtkWidget *menu_shell; GtkWidget *menu_shell;

View File

@ -1986,7 +1986,7 @@ gtk_menu_get_toplevel (GtkWidget *menu)
else if (GTK_IS_WIDGET (attach)) else if (GTK_IS_WIDGET (attach))
{ {
toplevel = gtk_widget_get_toplevel (attach); toplevel = gtk_widget_get_toplevel (attach);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
return toplevel; return toplevel;
} }

View File

@ -690,7 +690,7 @@ gtk_menu_bar_hierarchy_changed (GtkWidget *widget,
if (old_toplevel) if (old_toplevel)
remove_from_window (GTK_WINDOW (old_toplevel), menubar); remove_from_window (GTK_WINDOW (old_toplevel), menubar);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
add_to_window (GTK_WINDOW (toplevel), menubar); add_to_window (GTK_WINDOW (toplevel), menubar);
} }
@ -708,7 +708,7 @@ _gtk_menu_bar_cycle_focus (GtkMenuBar *menubar,
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar)); GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (menubar));
GtkMenuItem *to_activate = NULL; GtkMenuItem *to_activate = NULL;
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
{ {
GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (toplevel)); GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (toplevel));
GList *menubars; GList *menubars;

View File

@ -312,7 +312,7 @@ gtk_misc_realize (GtkWidget *widget)
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
if (GTK_WIDGET_NO_WINDOW (widget)) if (!gtk_widget_get_has_window (widget))
{ {
widget->window = gtk_widget_get_parent_window (widget); widget->window = gtk_widget_get_parent_window (widget);
g_object_ref (widget->window); g_object_ref (widget->window);

View File

@ -1337,7 +1337,7 @@ gtk_notebook_move_focus_out (GtkNotebook *notebook,
* do this by setting a flag, then propagating the focus motion to the notebook. * do this by setting a flag, then propagating the focus motion to the notebook.
*/ */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (notebook)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (notebook));
if (!GTK_WIDGET_TOPLEVEL (toplevel)) if (!gtk_widget_is_toplevel (toplevel))
return; return;
g_object_ref (notebook); g_object_ref (notebook);
@ -4187,7 +4187,7 @@ gtk_notebook_set_focus_child (GtkContainer *container,
*/ */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (container));
if (toplevel && GTK_WIDGET_TOPLEVEL (toplevel)) if (toplevel && gtk_widget_is_toplevel (toplevel))
{ {
page_child = GTK_WINDOW (toplevel)->focus_widget; page_child = GTK_WINDOW (toplevel)->focus_widget;
while (page_child) while (page_child)

View File

@ -53,8 +53,26 @@ G_BEGIN_DECLS
/* Macros for extracting various fields from GtkObject and GtkObjectClass. /* Macros for extracting various fields from GtkObject and GtkObjectClass.
*/ */
#define GTK_OBJECT_TYPE(object) (G_TYPE_FROM_INSTANCE (object)) #ifndef GTK_DISABLE_DEPRECATED
#define GTK_OBJECT_TYPE_NAME(object) (g_type_name (GTK_OBJECT_TYPE (object))) /**
* GTK_OBJECT_TYPE:
* @object: a #GtkObject.
*
* Gets the type of an object.
*
* Deprecated: 2.20: Use G_OBJECT_TYPE() instead.
*/
#define GTK_OBJECT_TYPE G_OBJECT_TYPE
/**
* GTK_OBJECT_TYPE_NAME:
* @object: a #GtkObject.
*
* Gets the name of an object's type.
*
* Deprecated: 2.20: Use G_OBJECT_TYPE_NAME() instead.
*/
#define GTK_OBJECT_TYPE_NAME G_OBJECT_TYPE_NAME
#endif
/* GtkObject only uses the first 4 bits of the flags field. /* GtkObject only uses the first 4 bits of the flags field.
* Derived objects may use the remaining bits. Though this * Derived objects may use the remaining bits. Though this

View File

@ -608,7 +608,7 @@ gtk_option_menu_expose (GtkWidget *widget,
child_event = *event; child_event = *event;
if (GTK_WIDGET_NO_WINDOW (child) && if (!gtk_widget_get_has_window (child) &&
gtk_widget_intersect (child, &event->area, &child_event.area)) gtk_widget_intersect (child, &event->area, &child_event.area))
gtk_widget_event (child, (GdkEvent*) &child_event); gtk_widget_event (child, (GdkEvent*) &child_event);

View File

@ -1707,7 +1707,7 @@ paned_get_focus_widget (GtkPaned *paned)
GtkWidget *toplevel; GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (paned)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (paned));
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
return GTK_WINDOW (toplevel)->focus_widget; return GTK_WINDOW (toplevel)->focus_widget;
return NULL; return NULL;

View File

@ -604,7 +604,7 @@ gtk_plug_realize (GtkWidget *widget)
attributes_mask |= (window->title ? GDK_WA_TITLE : 0); attributes_mask |= (window->title ? GDK_WA_TITLE : 0);
attributes_mask |= (window->wmclass_name ? GDK_WA_WMCLASS : 0); attributes_mask |= (window->wmclass_name ? GDK_WA_WMCLASS : 0);
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
{ {
attributes.window_type = GDK_WINDOW_TOPLEVEL; attributes.window_type = GDK_WINDOW_TOPLEVEL;
@ -651,7 +651,7 @@ gtk_plug_realize (GtkWidget *widget)
static void static void
gtk_plug_show (GtkWidget *widget) gtk_plug_show (GtkWidget *widget)
{ {
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
GTK_WIDGET_CLASS (gtk_plug_parent_class)->show (widget); GTK_WIDGET_CLASS (gtk_plug_parent_class)->show (widget);
else else
GTK_WIDGET_CLASS (bin_class)->show (widget); GTK_WIDGET_CLASS (bin_class)->show (widget);
@ -660,7 +660,7 @@ gtk_plug_show (GtkWidget *widget)
static void static void
gtk_plug_hide (GtkWidget *widget) gtk_plug_hide (GtkWidget *widget)
{ {
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
GTK_WIDGET_CLASS (gtk_plug_parent_class)->hide (widget); GTK_WIDGET_CLASS (gtk_plug_parent_class)->hide (widget);
else else
GTK_WIDGET_CLASS (bin_class)->hide (widget); GTK_WIDGET_CLASS (bin_class)->hide (widget);
@ -674,7 +674,7 @@ void gdk_synthesize_window_state (GdkWindow *window,
static void static void
gtk_plug_map (GtkWidget *widget) gtk_plug_map (GtkWidget *widget)
{ {
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
{ {
GtkBin *bin = GTK_BIN (widget); GtkBin *bin = GTK_BIN (widget);
GtkPlug *plug = GTK_PLUG (widget); GtkPlug *plug = GTK_PLUG (widget);
@ -699,7 +699,7 @@ gtk_plug_map (GtkWidget *widget)
static void static void
gtk_plug_unmap (GtkWidget *widget) gtk_plug_unmap (GtkWidget *widget)
{ {
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
{ {
GtkPlug *plug = GTK_PLUG (widget); GtkPlug *plug = GTK_PLUG (widget);
@ -721,7 +721,7 @@ static void
gtk_plug_size_allocate (GtkWidget *widget, gtk_plug_size_allocate (GtkWidget *widget,
GtkAllocation *allocation) GtkAllocation *allocation)
{ {
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
GTK_WIDGET_CLASS (gtk_plug_parent_class)->size_allocate (widget, allocation); GTK_WIDGET_CLASS (gtk_plug_parent_class)->size_allocate (widget, allocation);
else else
{ {
@ -754,7 +754,7 @@ static gboolean
gtk_plug_key_press_event (GtkWidget *widget, gtk_plug_key_press_event (GtkWidget *widget,
GdkEventKey *event) GdkEventKey *event)
{ {
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
return GTK_WIDGET_CLASS (gtk_plug_parent_class)->key_press_event (widget, event); return GTK_WIDGET_CLASS (gtk_plug_parent_class)->key_press_event (widget, event);
else else
return FALSE; return FALSE;
@ -959,7 +959,7 @@ gtk_plug_focus (GtkWidget *widget,
static void static void
gtk_plug_check_resize (GtkContainer *container) gtk_plug_check_resize (GtkContainer *container)
{ {
if (GTK_WIDGET_TOPLEVEL (container)) if (gtk_widget_is_toplevel (GTK_WIDGET (container)))
GTK_CONTAINER_CLASS (gtk_plug_parent_class)->check_resize (container); GTK_CONTAINER_CLASS (gtk_plug_parent_class)->check_resize (container);
else else
GTK_CONTAINER_CLASS (bin_class)->check_resize (container); GTK_CONTAINER_CLASS (bin_class)->check_resize (container);

View File

@ -373,7 +373,7 @@ get_toplevel (GtkWidget *widget)
GtkWidget *toplevel = NULL; GtkWidget *toplevel = NULL;
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (!GTK_WIDGET_TOPLEVEL (toplevel)) if (!gtk_widget_is_toplevel (toplevel))
return NULL; return NULL;
else else
return GTK_WINDOW (toplevel); return GTK_WINDOW (toplevel);

View File

@ -724,7 +724,7 @@ get_toplevel (GtkWidget *widget)
GtkWidget *toplevel; GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (!GTK_WIDGET_TOPLEVEL (toplevel)) if (!gtk_widget_is_toplevel (toplevel))
return NULL; return NULL;
else else
return GTK_WINDOW (toplevel); return GTK_WINDOW (toplevel);

View File

@ -1216,7 +1216,7 @@ gtk_scrolled_window_move_focus_out (GtkScrolledWindow *scrolled_window,
* a flag, then propagating the focus motion to the notebook. * a flag, then propagating the focus motion to the notebook.
*/ */
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (scrolled_window)); toplevel = gtk_widget_get_toplevel (GTK_WIDGET (scrolled_window));
if (!GTK_WIDGET_TOPLEVEL (toplevel)) if (!gtk_widget_is_toplevel (toplevel))
return; return;
g_object_ref (scrolled_window); g_object_ref (scrolled_window);

View File

@ -157,7 +157,7 @@ real_queue_resize (GtkWidget *widget)
if (widget->parent) if (widget->parent)
_gtk_container_queue_resize (GTK_CONTAINER (widget->parent)); _gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
else if (GTK_WIDGET_TOPLEVEL (widget) && GTK_IS_CONTAINER (widget)) else if (gtk_widget_is_toplevel (widget) && GTK_IS_CONTAINER (widget))
_gtk_container_queue_resize (GTK_CONTAINER (widget)); _gtk_container_queue_resize (GTK_CONTAINER (widget));
} }

View File

@ -602,7 +602,7 @@ socket_update_focus_in (GtkSocket *socket)
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket)); GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
if (GTK_WIDGET_TOPLEVEL (toplevel) && if (gtk_widget_is_toplevel (toplevel) &&
GTK_WINDOW (toplevel)->has_toplevel_focus && GTK_WINDOW (toplevel)->has_toplevel_focus &&
gtk_widget_is_focus (GTK_WIDGET (socket))) gtk_widget_is_focus (GTK_WIDGET (socket)))
focus_in = TRUE; focus_in = TRUE;
@ -625,7 +625,7 @@ socket_update_active (GtkSocket *socket)
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket)); GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (socket));
if (GTK_WIDGET_TOPLEVEL (toplevel) && if (gtk_widget_is_toplevel (toplevel) &&
GTK_WINDOW (toplevel)->is_active) GTK_WINDOW (toplevel)->is_active)
active = TRUE; active = TRUE;
} }
@ -950,7 +950,7 @@ _gtk_socket_advance_toplevel_focus (GtkSocket *socket,
if (!toplevel) if (!toplevel)
return; return;
if (!GTK_WIDGET_TOPLEVEL (toplevel) || GTK_IS_PLUG (toplevel)) if (!gtk_widget_is_toplevel (toplevel) || GTK_IS_PLUG (toplevel))
{ {
gtk_widget_child_focus (toplevel,direction); gtk_widget_child_focus (toplevel,direction);
return; return;

View File

@ -7083,7 +7083,7 @@ typedef struct
/* The window to which widget->window is relative */ /* The window to which widget->window is relative */
#define ALLOCATION_WINDOW(widget) \ #define ALLOCATION_WINDOW(widget) \
(GTK_WIDGET_NO_WINDOW (widget) ? \ (!gtk_widget_get_has_window (widget) ? \
(widget)->window : \ (widget)->window : \
gdk_window_get_parent ((widget)->window)) gdk_window_get_parent ((widget)->window))

View File

@ -619,7 +619,7 @@ window_to_alloc (GtkWidget *dest_widget,
gint *dest_y) gint *dest_y)
{ {
/* Translate from window relative to allocation relative */ /* Translate from window relative to allocation relative */
if (!GTK_WIDGET_NO_WINDOW (dest_widget) && dest_widget->parent) if (gtk_widget_get_has_window (dest_widget) && dest_widget->parent)
{ {
gint wx, wy; gint wx, wy;
gdk_window_get_position (dest_widget->window, &wx, &wy); gdk_window_get_position (dest_widget->window, &wx, &wy);
@ -874,7 +874,7 @@ gtk_tooltip_position (GtkTooltip *tooltip,
if (tooltip->keyboard_mode_enabled) if (tooltip->keyboard_mode_enabled)
{ {
gdk_window_get_origin (new_tooltip_widget->window, &x, &y); gdk_window_get_origin (new_tooltip_widget->window, &x, &y);
if (GTK_WIDGET_NO_WINDOW (new_tooltip_widget)) if (!gtk_widget_get_has_window (new_tooltip_widget))
{ {
x += new_tooltip_widget->allocation.x; x += new_tooltip_widget->allocation.x;
y += new_tooltip_widget->allocation.y; y += new_tooltip_widget->allocation.y;

View File

@ -682,7 +682,7 @@ gtk_tree_item_expose_child (GtkWidget *child,
} *data = client_data; } *data = client_data;
if (GTK_WIDGET_DRAWABLE (child) && if (GTK_WIDGET_DRAWABLE (child) &&
GTK_WIDGET_NO_WINDOW (child) && !gtk_widget_get_has_window (child) &&
(child->window == data->event->window)) (child->window == data->event->window))
{ {
GdkEvent *child_event = gdk_event_new (GDK_EXPOSE); GdkEvent *child_event = gdk_event_new (GDK_EXPOSE);

View File

@ -10499,7 +10499,7 @@ typedef struct
/* The window to which widget->window is relative */ /* The window to which widget->window is relative */
#define ALLOCATION_WINDOW(widget) \ #define ALLOCATION_WINDOW(widget) \
(GTK_WIDGET_NO_WINDOW (widget) ? \ (!gtk_widget_get_has_window (widget) ? \
(widget)->window : \ (widget)->window : \
gdk_window_get_parent ((widget)->window)) gdk_window_get_parent ((widget)->window))

View File

@ -1046,7 +1046,7 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
if (GTK_WIDGET_HAS_FOCUS (tree_column->button)) if (GTK_WIDGET_HAS_FOCUS (tree_column->button))
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (tree_column->tree_view); GtkWidget *toplevel = gtk_widget_get_toplevel (tree_column->tree_view);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
{ {
gtk_window_set_focus (GTK_WINDOW (toplevel), NULL); gtk_window_set_focus (GTK_WINDOW (toplevel), NULL);
} }

View File

@ -840,7 +840,7 @@ gtk_viewport_style_set (GtkWidget *widget,
GtkStyle *previous_style) GtkStyle *previous_style)
{ {
if (GTK_WIDGET_REALIZED (widget) && if (GTK_WIDGET_REALIZED (widget) &&
!GTK_WIDGET_NO_WINDOW (widget)) gtk_widget_get_has_window (widget))
{ {
GtkViewport *viewport = GTK_VIEWPORT (widget); GtkViewport *viewport = GTK_VIEWPORT (widget);

View File

@ -2764,7 +2764,7 @@ gtk_widget_get_property (GObject *object,
g_value_set_boolean (value, (GTK_WIDGET_RECEIVES_DEFAULT (widget) != FALSE)); g_value_set_boolean (value, (GTK_WIDGET_RECEIVES_DEFAULT (widget) != FALSE));
break; break;
case PROP_COMPOSITE_CHILD: case PROP_COMPOSITE_CHILD:
g_value_set_boolean (value, (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE)); g_value_set_boolean (value, (GTK_WIDGET_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0 );
break; break;
case PROP_STYLE: case PROP_STYLE:
g_value_set_object (value, gtk_widget_get_style (widget)); g_value_set_object (value, gtk_widget_get_style (widget));
@ -3046,7 +3046,7 @@ gtk_widget_unparent (GtkWidget *widget)
nqueue = g_object_notify_queue_freeze (G_OBJECT (widget), _gtk_widget_child_property_notify_context); nqueue = g_object_notify_queue_freeze (G_OBJECT (widget), _gtk_widget_child_property_notify_context);
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
_gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget); _gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget);
if (GTK_CONTAINER (widget->parent)->focus_child == widget) if (GTK_CONTAINER (widget->parent)->focus_child == widget)
@ -3178,7 +3178,7 @@ gtk_widget_show (GtkWidget *widget)
if (!GTK_WIDGET_VISIBLE (widget)) if (!GTK_WIDGET_VISIBLE (widget))
{ {
g_object_ref (widget); g_object_ref (widget);
if (!GTK_WIDGET_TOPLEVEL (widget)) if (!gtk_widget_is_toplevel (widget))
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
g_signal_emit (widget, widget_signals[SHOW], 0); g_signal_emit (widget, widget_signals[SHOW], 0);
g_object_notify (G_OBJECT (widget), "visible"); g_object_notify (G_OBJECT (widget), "visible");
@ -3229,7 +3229,7 @@ gtk_widget_show_now (GtkWidget *widget)
/* make sure we will get event */ /* make sure we will get event */
if (!GTK_WIDGET_MAPPED (widget) && if (!GTK_WIDGET_MAPPED (widget) &&
GTK_WIDGET_TOPLEVEL (widget)) gtk_widget_is_toplevel (widget))
{ {
gtk_widget_show (widget); gtk_widget_show (widget);
@ -3261,11 +3261,11 @@ gtk_widget_hide (GtkWidget *widget)
GtkWidget *toplevel = gtk_widget_get_toplevel (widget); GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
g_object_ref (widget); g_object_ref (widget);
if (toplevel != widget && GTK_WIDGET_TOPLEVEL (toplevel)) if (toplevel != widget && gtk_widget_is_toplevel (toplevel))
_gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget); _gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget);
g_signal_emit (widget, widget_signals[HIDE], 0); g_signal_emit (widget, widget_signals[HIDE], 0);
if (!GTK_WIDGET_TOPLEVEL (widget)) if (!gtk_widget_is_toplevel (widget))
gtk_widget_queue_resize (widget); gtk_widget_queue_resize (widget);
g_object_notify (G_OBJECT (widget), "visible"); g_object_notify (G_OBJECT (widget), "visible");
g_object_unref (widget); g_object_unref (widget);
@ -3482,11 +3482,11 @@ gtk_widget_realize (GtkWidget *widget)
{ {
/* /*
if (GTK_IS_CONTAINER (widget) && !GTK_WIDGET_NO_WINDOW (widget)) if (GTK_IS_CONTAINER (widget) && !GTK_WIDGET_NO_WINDOW (widget))
g_message ("gtk_widget_realize(%s)", g_type_name (GTK_WIDGET_TYPE (widget))); g_message ("gtk_widget_realize(%s)", G_OBJECT_TYPE_NAME (widget));
*/ */
if (widget->parent == NULL && if (widget->parent == NULL &&
!GTK_WIDGET_TOPLEVEL (widget)) !gtk_widget_is_toplevel (widget))
g_warning ("Calling gtk_widget_realize() on a widget that isn't " g_warning ("Calling gtk_widget_realize() on a widget that isn't "
"inside a toplevel window is not going to work very well. " "inside a toplevel window is not going to work very well. "
"Widgets must be inside a toplevel container before realizing them."); "Widgets must be inside a toplevel container before realizing them.");
@ -5289,7 +5289,7 @@ gtk_widget_real_grab_focus (GtkWidget *focus_widget)
* be set by the next loop. * be set by the next loop.
*/ */
toplevel = gtk_widget_get_toplevel (focus_widget); toplevel = gtk_widget_get_toplevel (focus_widget);
if (GTK_WIDGET_TOPLEVEL (toplevel) && GTK_IS_WINDOW (toplevel)) if (gtk_widget_is_toplevel (toplevel) && GTK_IS_WINDOW (toplevel))
{ {
widget = GTK_WINDOW (toplevel)->focus_widget; widget = GTK_WINDOW (toplevel)->focus_widget;
@ -5617,7 +5617,7 @@ gtk_widget_grab_default (GtkWidget *widget)
window = gtk_widget_get_toplevel (widget); window = gtk_widget_get_toplevel (widget);
if (window && GTK_WIDGET_TOPLEVEL (window)) if (window && gtk_widget_is_toplevel (window))
gtk_window_set_default (GTK_WINDOW (window), widget); gtk_window_set_default (GTK_WINDOW (window), widget);
else else
g_warning (G_STRLOC ": widget not within a GtkWindow"); g_warning (G_STRLOC ": widget not within a GtkWindow");
@ -5746,7 +5746,7 @@ gtk_widget_get_name (GtkWidget *widget)
if (widget->name) if (widget->name)
return widget->name; return widget->name;
return g_type_name (GTK_WIDGET_TYPE (widget)); return G_OBJECT_TYPE_NAME (widget);
} }
/** /**
@ -6135,7 +6135,7 @@ gtk_widget_set_sensitive (GtkWidget *widget,
if (sensitive) if (sensitive)
{ {
GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE); GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE);
data.state = GTK_WIDGET_SAVED_STATE (widget); data.state = widget->saved_state;
} }
else else
{ {
@ -6224,7 +6224,7 @@ gtk_widget_set_parent (GtkWidget *widget,
g_warning ("Can't set a parent on widget which has a parent\n"); g_warning ("Can't set a parent on widget which has a parent\n");
return; return;
} }
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
{ {
g_warning ("Can't set a parent on a toplevel widget\n"); g_warning ("Can't set a parent on a toplevel widget\n");
return; return;
@ -6804,7 +6804,7 @@ gtk_widget_propagate_hierarchy_changed_recurse (GtkWidget *widget,
gpointer client_data) gpointer client_data)
{ {
HierarchyChangedInfo *info = client_data; HierarchyChangedInfo *info = client_data;
gboolean new_anchored = GTK_WIDGET_TOPLEVEL (widget) || gboolean new_anchored = gtk_widget_is_toplevel (widget) ||
(widget->parent && GTK_WIDGET_ANCHORED (widget->parent)); (widget->parent && GTK_WIDGET_ANCHORED (widget->parent));
if (GTK_WIDGET_ANCHORED (widget) != new_anchored) if (GTK_WIDGET_ANCHORED (widget) != new_anchored)
@ -6846,7 +6846,7 @@ _gtk_widget_propagate_hierarchy_changed (GtkWidget *widget,
info.previous_toplevel = previous_toplevel; info.previous_toplevel = previous_toplevel;
info.previous_screen = previous_toplevel ? gtk_widget_get_screen (previous_toplevel) : NULL; info.previous_screen = previous_toplevel ? gtk_widget_get_screen (previous_toplevel) : NULL;
if (GTK_WIDGET_TOPLEVEL (widget) || if (gtk_widget_is_toplevel (widget) ||
(widget->parent && GTK_WIDGET_ANCHORED (widget->parent))) (widget->parent && GTK_WIDGET_ANCHORED (widget->parent)))
info.new_screen = gtk_widget_get_screen (widget); info.new_screen = gtk_widget_get_screen (widget);
else else
@ -7288,7 +7288,7 @@ gtk_widget_set_child_visible (GtkWidget *widget,
gboolean is_visible) gboolean is_visible)
{ {
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (!GTK_WIDGET_TOPLEVEL (widget)); g_return_if_fail (!gtk_widget_is_toplevel (widget));
g_object_ref (widget); g_object_ref (widget);
@ -7301,7 +7301,7 @@ gtk_widget_set_child_visible (GtkWidget *widget,
GTK_PRIVATE_UNSET_FLAG (widget, GTK_CHILD_VISIBLE); GTK_PRIVATE_UNSET_FLAG (widget, GTK_CHILD_VISIBLE);
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (toplevel != widget && GTK_WIDGET_TOPLEVEL (toplevel)) if (toplevel != widget && gtk_widget_is_toplevel (toplevel))
_gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget); _gtk_window_unset_focus_and_default (GTK_WINDOW (toplevel), widget);
} }
@ -7346,7 +7346,7 @@ gtk_widget_get_screen_unchecked (GtkWidget *widget)
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
{ {
if (GTK_IS_WINDOW (toplevel)) if (GTK_IS_WINDOW (toplevel))
return GTK_WINDOW (toplevel)->screen; return GTK_WINDOW (toplevel)->screen;
@ -7979,7 +7979,7 @@ gtk_widget_set_extension_events (GtkWidget *widget,
* is set on the result. * is set on the result.
* |[ * |[
* GtkWidget *toplevel = gtk_widget_get_toplevel (widget); * GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
* if (GTK_WIDGET_TOPLEVEL (toplevel)) * if (gtk_widget_is_toplevel (toplevel))
* { * {
* /&ast; Perform action on toplevel. &ast;/ * /&ast; Perform action on toplevel. &ast;/
* } * }
@ -8022,10 +8022,10 @@ gtk_widget_get_ancestor (GtkWidget *widget,
{ {
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
while (widget && !g_type_is_a (GTK_WIDGET_TYPE (widget), widget_type)) while (widget && !g_type_is_a (G_OBJECT_TYPE (widget), widget_type))
widget = widget->parent; widget = widget->parent;
if (!(widget && g_type_is_a (GTK_WIDGET_TYPE (widget), widget_type))) if (!(widget && g_type_is_a (G_OBJECT_TYPE (widget), widget_type)))
return NULL; return NULL;
return widget; return widget;
@ -8248,7 +8248,7 @@ gtk_widget_set_composite_name (GtkWidget *widget,
const gchar *name) const gchar *name)
{ {
g_return_if_fail (GTK_IS_WIDGET (widget)); g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_WIDGET_COMPOSITE_CHILD (widget)); g_return_if_fail ((GTK_WIDGET_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0);
g_return_if_fail (name != NULL); g_return_if_fail (name != NULL);
if (!quark_composite_name) if (!quark_composite_name)
@ -8275,7 +8275,7 @@ gtk_widget_get_composite_name (GtkWidget *widget)
{ {
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL); g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
if (GTK_WIDGET_COMPOSITE_CHILD (widget) && widget->parent) if (((GTK_WIDGET_FLAGS (widget) & GTK_COMPOSITE_CHILD) != 0) && widget->parent)
return _gtk_container_child_composite_name (GTK_CONTAINER (widget->parent), return _gtk_container_child_composite_name (GTK_CONTAINER (widget->parent),
widget); widget);
else else
@ -9022,7 +9022,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
GtkStateData *data) GtkStateData *data)
{ {
guint8 old_state = GTK_WIDGET_STATE (widget); guint8 old_state = GTK_WIDGET_STATE (widget);
guint8 old_saved_state = GTK_WIDGET_SAVED_STATE (widget); guint8 old_saved_state = widget->saved_state;
/* don't call this function with state==GTK_STATE_INSENSITIVE, /* don't call this function with state==GTK_STATE_INSENSITIVE,
* parent_sensitive==TRUE on a sensitive widget * parent_sensitive==TRUE on a sensitive widget
@ -9037,7 +9037,7 @@ gtk_widget_propagate_state (GtkWidget *widget,
if (GTK_WIDGET_IS_SENSITIVE (widget)) if (GTK_WIDGET_IS_SENSITIVE (widget))
{ {
if (data->state_restoration) if (data->state_restoration)
GTK_WIDGET_STATE (widget) = GTK_WIDGET_SAVED_STATE (widget); GTK_WIDGET_STATE (widget) = widget->saved_state;
else else
GTK_WIDGET_STATE (widget) = data->state; GTK_WIDGET_STATE (widget) = data->state;
} }
@ -9046,10 +9046,10 @@ gtk_widget_propagate_state (GtkWidget *widget,
if (!data->state_restoration) if (!data->state_restoration)
{ {
if (data->state != GTK_STATE_INSENSITIVE) if (data->state != GTK_STATE_INSENSITIVE)
GTK_WIDGET_SAVED_STATE (widget) = data->state; widget->saved_state = data->state;
} }
else if (GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE) else if (GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE)
GTK_WIDGET_SAVED_STATE (widget) = GTK_WIDGET_STATE (widget); widget->saved_state = GTK_WIDGET_STATE (widget);
GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE; GTK_WIDGET_STATE (widget) = GTK_STATE_INSENSITIVE;
} }
@ -9058,12 +9058,12 @@ gtk_widget_propagate_state (GtkWidget *widget,
GtkWidget *window; GtkWidget *window;
window = gtk_widget_get_toplevel (widget); window = gtk_widget_get_toplevel (widget);
if (window && GTK_WIDGET_TOPLEVEL (window)) if (window && gtk_widget_is_toplevel (window))
gtk_window_set_focus (GTK_WINDOW (window), NULL); gtk_window_set_focus (GTK_WINDOW (window), NULL);
} }
if (old_state != GTK_WIDGET_STATE (widget) || if (old_state != GTK_WIDGET_STATE (widget) ||
old_saved_state != GTK_WIDGET_SAVED_STATE (widget)) old_saved_state != widget->saved_state)
{ {
g_object_ref (widget); g_object_ref (widget);
@ -9899,7 +9899,7 @@ gtk_widget_class_path (GtkWidget *widget,
gchar *d; gchar *d;
guint l; guint l;
string = g_type_name (GTK_WIDGET_TYPE (widget)); string = g_type_name (G_OBJECT_TYPE (widget));
l = strlen (string); l = strlen (string);
while (tmp_path_len <= len + l + 1) while (tmp_path_len <= len + l + 1)
{ {

View File

@ -140,22 +140,30 @@ typedef enum
/* Macros for extracting various fields from GtkWidget and GtkWidgetClass. /* Macros for extracting various fields from GtkWidget and GtkWidgetClass.
*/ */
#ifndef GTK_DISABLE_DEPRECATED
/** /**
* GTK_WIDGET_TYPE: * GTK_WIDGET_TYPE:
* @wid: a #GtkWidget. * @wid: a #GtkWidget.
* *
* Gets the type of a widget. * Gets the type of a widget.
*
* Deprecated: 2.20: Use G_OBJECT_TYPE() instead.
*/ */
#define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid)) #define GTK_WIDGET_TYPE(wid) (GTK_OBJECT_TYPE (wid))
#endif
/** /**
* GTK_WIDGET_STATE: * GTK_WIDGET_STATE:
* @wid: a #GtkWidget. * @wid: a #GtkWidget.
* *
* Returns the current state of the widget, as a #GtkStateType. * Returns the current state of the widget, as a #GtkStateType.
*
* Deprecated: 2.20: Use gtk_widget_get_state() instead.
*/ */
#define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state) #define GTK_WIDGET_STATE(wid) (GTK_WIDGET (wid)->state)
/* FIXME: Deprecating GTK_WIDGET_STATE requires fixing GTK internals. */
#ifndef GTK_DISABLE_DEPRECATED
/** /**
* GTK_WIDGET_SAVED_STATE: * GTK_WIDGET_SAVED_STATE:
* @wid: a #GtkWidget. * @wid: a #GtkWidget.
@ -165,8 +173,11 @@ typedef enum
* The saved state will be restored when a widget gets sensitive * The saved state will be restored when a widget gets sensitive
* again, after it has been made insensitive with gtk_widget_set_state() * again, after it has been made insensitive with gtk_widget_set_state()
* or gtk_widget_set_sensitive(). * or gtk_widget_set_sensitive().
*
* Deprecated: 2.20: Do not used it.
*/ */
#define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state) #define GTK_WIDGET_SAVED_STATE(wid) (GTK_WIDGET (wid)->saved_state)
#endif
/* Macros for extracting the widget flags from GtkWidget. /* Macros for extracting the widget flags from GtkWidget.
@ -176,24 +187,34 @@ typedef enum
* @wid: a #GtkWidget. * @wid: a #GtkWidget.
* *
* Returns the widget flags from @wid. * Returns the widget flags from @wid.
*
* Deprecated: 2.20: Do not use it.
*/ */
#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid)) #define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
/* FIXME: Deprecating GTK_WIDGET_FLAGS requires fixing GTK internals. */
#ifndef GTK_DISABLE_DEPRECATED
/** /**
* GTK_WIDGET_TOPLEVEL: * GTK_WIDGET_TOPLEVEL:
* @wid: a #GtkWidget. * @wid: a #GtkWidget.
* *
* Evaluates to %TRUE if the widget is a toplevel widget. * Evaluates to %TRUE if the widget is a toplevel widget.
*
* Deprecated: 2.20: Use gtk_widget_is_toplevel() instead.
*/ */
#define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0) #define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
#endif
/** /**
* GTK_WIDGET_NO_WINDOW: * GTK_WIDGET_NO_WINDOW:
* @wid: a #GtkWidget. * @wid: a #GtkWidget.
* *
* Evaluates to %TRUE if the widget doesn't have an own #GdkWindow. * Evaluates to %TRUE if the widget doesn't have an own #GdkWindow.
*
* Deprecated: 2.20: Use gtk_widget_get_has_window() instead.
*/ */
#define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0) #define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
/* FIXME: Deprecating GTK_WIDGET_NO_WINDOW requires fixing GTK internals. */
/** /**
* GTK_WIDGET_REALIZED: * GTK_WIDGET_REALIZED:
@ -302,14 +323,17 @@ typedef enum
* mechanism. * mechanism.
*/ */
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0) #define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
#ifndef GTK_DISABLE_DEPRECATED
/** /**
* GTK_WIDGET_COMPOSITE_CHILD: * GTK_WIDGET_COMPOSITE_CHILD:
* @wid: a #GtkWidget. * @wid: a #GtkWidget.
* *
* Evaluates to %TRUE if the widget is a composite child of its parent. * Evaluates to %TRUE if the widget is a composite child of its parent.
*
* Deprecated: 2.20: Use the "composite-child" property instead.
*/ */
#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0) #define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
#endif
/** /**
* GTK_WIDGET_APP_PAINTABLE: * GTK_WIDGET_APP_PAINTABLE:

View File

@ -8385,12 +8385,12 @@ void
_gtk_window_set_is_toplevel (GtkWindow *window, _gtk_window_set_is_toplevel (GtkWindow *window,
gboolean is_toplevel) gboolean is_toplevel)
{ {
if (GTK_WIDGET_TOPLEVEL (window)) if (gtk_widget_is_toplevel (GTK_WIDGET (window)))
g_assert (g_slist_find (toplevel_list, window) != NULL); g_assert (g_slist_find (toplevel_list, window) != NULL);
else else
g_assert (g_slist_find (toplevel_list, window) == NULL); g_assert (g_slist_find (toplevel_list, window) == NULL);
if (is_toplevel == GTK_WIDGET_TOPLEVEL (window)) if (is_toplevel == gtk_widget_is_toplevel (GTK_WIDGET (window)))
return; return;
if (is_toplevel) if (is_toplevel)

View File

@ -1547,7 +1547,7 @@ claim_status_window (GtkIMContextXIM *context_xim)
if (!context_xim->status_window && context_xim->client_widget) if (!context_xim->status_window && context_xim->client_widget)
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (context_xim->client_widget); GtkWidget *toplevel = gtk_widget_get_toplevel (context_xim->client_widget);
if (toplevel && GTK_WIDGET_TOPLEVEL (toplevel)) if (toplevel && gtk_widget_is_toplevel (toplevel))
{ {
StatusWindow *status_window = status_window_get (toplevel); StatusWindow *status_window = status_window_get (toplevel);
@ -1581,7 +1581,7 @@ update_in_toplevel (GtkIMContextXIM *context_xim)
{ {
GtkWidget *toplevel = gtk_widget_get_toplevel (context_xim->client_widget); GtkWidget *toplevel = gtk_widget_get_toplevel (context_xim->client_widget);
context_xim->in_toplevel = (toplevel && GTK_WIDGET_TOPLEVEL (toplevel)); context_xim->in_toplevel = (toplevel && gtk_widget_is_toplevel (toplevel));
} }
else else
context_xim->in_toplevel = FALSE; context_xim->in_toplevel = FALSE;

View File

@ -906,7 +906,7 @@ gail_tree_view_ref_child (AtkObject *obj,
fake_renderer = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, NULL); fake_renderer = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT, NULL);
default_registry = atk_get_default_registry (); default_registry = atk_get_default_registry ();
factory = atk_registry_get_factory (default_registry, factory = atk_registry_get_factory (default_registry,
GTK_OBJECT_TYPE (fake_renderer)); G_OBJECT_TYPE (fake_renderer));
child = atk_object_factory_create_accessible (factory, child = atk_object_factory_create_accessible (factory,
G_OBJECT (fake_renderer)); G_OBJECT (fake_renderer));
gail_return_val_if_fail (GAIL_IS_RENDERER_CELL (child), NULL); gail_return_val_if_fail (GAIL_IS_RENDERER_CELL (child), NULL);
@ -942,7 +942,7 @@ gail_tree_view_ref_child (AtkObject *obj,
default_registry = atk_get_default_registry (); default_registry = atk_get_default_registry ();
factory = atk_registry_get_factory (default_registry, factory = atk_registry_get_factory (default_registry,
GTK_OBJECT_TYPE (renderer)); G_OBJECT_TYPE (renderer));
child = atk_object_factory_create_accessible (factory, child = atk_object_factory_create_accessible (factory,
G_OBJECT (renderer)); G_OBJECT (renderer));
gail_return_val_if_fail (GAIL_IS_RENDERER_CELL (child), NULL); gail_return_val_if_fail (GAIL_IS_RENDERER_CELL (child), NULL);
@ -2200,7 +2200,7 @@ gail_tree_view_grab_cell_focus (GailCellParent *parent,
gtk_tree_path_free (path); gtk_tree_path_free (path);
gtk_widget_grab_focus (widget); gtk_widget_grab_focus (widget);
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
{ {
#ifdef GDK_WINDOWING_X11 #ifdef GDK_WINDOWING_X11
gtk_window_present_with_time (GTK_WINDOW (toplevel), gdk_x11_get_server_time (widget->window)); gtk_window_present_with_time (GTK_WINDOW (toplevel), gdk_x11_get_server_time (widget->window));

View File

@ -739,7 +739,7 @@ gail_widget_grab_focus (AtkComponent *component)
{ {
gtk_widget_grab_focus (widget); gtk_widget_grab_focus (widget);
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
{ {
#ifdef GDK_WINDOWING_X11 #ifdef GDK_WINDOWING_X11
gtk_window_present_with_time (GTK_WINDOW (toplevel), gdk_x11_get_server_time (widget->window)); gtk_window_present_with_time (GTK_WINDOW (toplevel), gdk_x11_get_server_time (widget->window));
@ -777,7 +777,7 @@ gail_widget_set_extents (AtkComponent *component,
return FALSE; return FALSE;
gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
{ {
if (coord_type == ATK_XY_WINDOW) if (coord_type == ATK_XY_WINDOW)
{ {
@ -821,7 +821,7 @@ gail_widget_set_position (AtkComponent *component,
return FALSE; return FALSE;
gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
{ {
if (coord_type == ATK_XY_WINDOW) if (coord_type == ATK_XY_WINDOW)
{ {
@ -862,7 +862,7 @@ gail_widget_set_size (AtkComponent *component,
return FALSE; return FALSE;
gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE); gail_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
if (GTK_WIDGET_TOPLEVEL (widget)) if (gtk_widget_is_toplevel (widget))
{ {
gtk_widget_set_size_request (widget, width, height); gtk_widget_set_size_request (widget, width, height);
return TRUE; return TRUE;

View File

@ -563,7 +563,7 @@ gail_window_get_extents (AtkComponent *component,
gail_return_if_fail (GTK_IS_WINDOW (widget)); gail_return_if_fail (GTK_IS_WINDOW (widget));
if (!GTK_WIDGET_TOPLEVEL (widget)) if (!gtk_widget_is_toplevel (widget))
{ {
AtkComponentIface *parent_iface; AtkComponentIface *parent_iface;
@ -608,7 +608,7 @@ gail_window_get_size (AtkComponent *component,
gail_return_if_fail (GTK_IS_WINDOW (widget)); gail_return_if_fail (GTK_IS_WINDOW (widget));
if (!GTK_WIDGET_TOPLEVEL (widget)) if (!gtk_widget_is_toplevel (widget))
{ {
AtkComponentIface *parent_iface; AtkComponentIface *parent_iface;

View File

@ -22,7 +22,7 @@ _check_object (AtkObject *obj)
GtkWidget* widget = NULL; GtkWidget* widget = NULL;
widget = GTK_ACCESSIBLE (obj)->widget; widget = GTK_ACCESSIBLE (obj)->widget;
typename = g_type_name (GTK_OBJECT_TYPE (widget)); typename = g_type_name (G_OBJECT_TYPE (widget));
g_print ("Widget type name: %s\n", typename ? typename : "NULL"); g_print ("Widget type name: %s\n", typename ? typename : "NULL");
} }
typename = g_type_name (G_OBJECT_TYPE (obj)); typename = g_type_name (G_OBJECT_TYPE (obj));

View File

@ -24,7 +24,7 @@ static void _print_type (AtkObject *obj)
GtkWidget* widget = NULL; GtkWidget* widget = NULL;
widget = GTK_ACCESSIBLE (obj)->widget; widget = GTK_ACCESSIBLE (obj)->widget;
typename = g_type_name (GTK_OBJECT_TYPE (widget)); typename = g_type_name (G_OBJECT_TYPE (widget));
g_print ("\tWidget type name: %s\n", typename ? typename : "NULL"); g_print ("\tWidget type name: %s\n", typename ? typename : "NULL");
} }

View File

@ -54,7 +54,7 @@ static void _print_type (AtkObject *obj)
GtkWidget* widget = NULL; GtkWidget* widget = NULL;
widget = GTK_ACCESSIBLE (obj)->widget; widget = GTK_ACCESSIBLE (obj)->widget;
typename = g_type_name (GTK_OBJECT_TYPE (widget)); typename = g_type_name (G_OBJECT_TYPE (widget));
g_print ("Widget type name: %s\n", typename ? typename : "NULL"); g_print ("Widget type name: %s\n", typename ? typename : "NULL");
} }
typename = g_type_name (G_OBJECT_TYPE (obj)); typename = g_type_name (G_OBJECT_TYPE (obj));

View File

@ -58,7 +58,7 @@ static void _print_type (AtkObject *obj)
GtkWidget* widget = NULL; GtkWidget* widget = NULL;
widget = GTK_ACCESSIBLE (obj)->widget; widget = GTK_ACCESSIBLE (obj)->widget;
typename = g_type_name (GTK_OBJECT_TYPE (widget)); typename = g_type_name (G_OBJECT_TYPE (widget));
g_print ("Widget type name: %s\n", typename ? typename : "NULL"); g_print ("Widget type name: %s\n", typename ? typename : "NULL");
} }
typename = g_type_name (G_OBJECT_TYPE (obj)); typename = g_type_name (G_OBJECT_TYPE (obj));

View File

@ -250,7 +250,7 @@ ensure_and_get_toplevel (GtkWidget *widget)
GtkWidget *window; GtkWidget *window;
toplevel = gtk_widget_get_toplevel (widget); toplevel = gtk_widget_get_toplevel (widget);
if (GTK_WIDGET_TOPLEVEL (toplevel)) if (gtk_widget_is_toplevel (toplevel))
return toplevel; return toplevel;
g_assert (toplevel == widget); /* we don't want extraneous ancestors */ g_assert (toplevel == widget); /* we don't want extraneous ancestors */

View File

@ -336,7 +336,7 @@ target_drag_motion (GtkWidget *widget,
source_widget = gtk_drag_get_source_widget (context); source_widget = gtk_drag_get_source_widget (context);
g_print ("motion, source %s\n", source_widget ? g_print ("motion, source %s\n", source_widget ?
GTK_OBJECT_TYPE_NAME (source_widget) : G_OBJECT_TYPE_NAME (source_widget) :
"NULL"); "NULL");
tmp_list = context->targets; tmp_list = context->targets;

View File

@ -12106,7 +12106,7 @@ find_widget (GtkWidget *widget, FindWidgetData *data)
* but within the allocation are not counted. This is consistent * but within the allocation are not counted. This is consistent
* with the way we highlight drag targets. * with the way we highlight drag targets.
*/ */
if (!GTK_WIDGET_NO_WINDOW (widget)) if (gtk_widget_get_has_window (widget))
{ {
new_allocation.x = 0; new_allocation.x = 0;
new_allocation.y = 0; new_allocation.y = 0;