Commit c44c026e authored by Javier Jardón's avatar Javier Jardón Committed by Tristan Van Berkom

Don't use GTK_WIDGET_NO_WINDOW in internal code anymore

Use gtk_widget_get_has_window() instead

https://bugzilla.gnome.org/show_bug.cgi?id=69872
parent e7127daf
......@@ -3548,7 +3548,7 @@ gtk_default_draw_box (GtkStyle *style,
}
else
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
state_type, area, x, y, width, height);
if (is_spinbutton_box)
......@@ -3824,7 +3824,7 @@ gtk_default_draw_flat_box (GtkStyle *style,
}
else
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
state_type, area, x, y, width, height);
......@@ -4360,7 +4360,7 @@ gtk_default_draw_box_gap (GtkStyle *style,
GdkGC *gc4 = NULL;
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
state_type, area, x, y, width, height);
sanitize_size (window, &width, &height);
......@@ -4576,7 +4576,7 @@ gtk_default_draw_extension (GtkStyle *style,
GdkGC *gc4 = NULL;
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
GTK_STATE_NORMAL, area, x, y, width, height);
sanitize_size (window, &width, &height);
......@@ -4630,7 +4630,7 @@ gtk_default_draw_extension (GtkStyle *style,
{
case GTK_POS_TOP:
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
state_type, area,
x + style->xthickness,
y,
......@@ -4652,7 +4652,7 @@ gtk_default_draw_extension (GtkStyle *style,
break;
case GTK_POS_BOTTOM:
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
state_type, area,
x + style->xthickness,
y + style->ythickness,
......@@ -4674,7 +4674,7 @@ gtk_default_draw_extension (GtkStyle *style,
break;
case GTK_POS_LEFT:
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
state_type, area,
x,
y + style->ythickness,
......@@ -4696,7 +4696,7 @@ gtk_default_draw_extension (GtkStyle *style,
break;
case GTK_POS_RIGHT:
gtk_style_apply_default_background (style, window,
widget && !GTK_WIDGET_NO_WINDOW (widget),
widget && gtk_widget_get_has_window (widget),
state_type, area,
x + style->xthickness,
y + style->ythickness,
......
......@@ -2653,7 +2653,7 @@ gtk_widget_set_property (GObject *object,
gtk_widget_set_style (widget, g_value_get_object (value));
break;
case PROP_EVENTS:
if (!GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_NO_WINDOW (widget))
if (!GTK_WIDGET_REALIZED (widget) && gtk_widget_get_has_window (widget))
gtk_widget_set_events (widget, g_value_get_flags (value));
break;
case PROP_EXTENSION_EVENTS:
......@@ -3391,7 +3391,7 @@ gtk_widget_map (GtkWidget *widget)
g_signal_emit (widget, widget_signals[MAP], 0);
if (GTK_WIDGET_NO_WINDOW (widget))
if (!gtk_widget_get_has_window (widget))
gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
}
}
......@@ -3410,7 +3410,7 @@ gtk_widget_unmap (GtkWidget *widget)
if (GTK_WIDGET_MAPPED (widget))
{
if (GTK_WIDGET_NO_WINDOW (widget))
if (!gtk_widget_get_has_window (widget))
gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
_gtk_tooltip_hide (widget);
g_signal_emit (widget, widget_signals[UNMAP], 0);
......@@ -3427,7 +3427,7 @@ gtk_widget_set_extension_events_internal (GtkWidget *widget,
if (window_list == NULL)
{
if (!GTK_WIDGET_NO_WINDOW (widget))
if (gtk_widget_get_has_window (widget))
window_list = g_list_prepend (NULL, widget->window);
else
window_list = gdk_window_get_children (widget->window);
......@@ -3498,7 +3498,7 @@ gtk_widget_realize (GtkWidget *widget)
if (!GTK_WIDGET_REALIZED (widget))
{
/*
if (GTK_IS_CONTAINER (widget) && !GTK_WIDGET_NO_WINDOW (widget))
if (GTK_IS_CONTAINER (widget) && gtk_widget_get_has_window (widget))
g_message ("gtk_widget_realize(%s)", G_OBJECT_TYPE_NAME (widget));
*/
......@@ -3625,7 +3625,7 @@ gtk_widget_queue_draw_area (GtkWidget *widget,
/* Find the correct widget */
if (!GTK_WIDGET_NO_WINDOW (widget))
if (gtk_widget_get_has_window (widget))
{
if (widget->parent)
{
......@@ -3684,7 +3684,7 @@ static void
gtk_widget_get_draw_rectangle (GtkWidget *widget,
GdkRectangle *rect)
{
if (GTK_WIDGET_NO_WINDOW (widget))
if (!gtk_widget_get_has_window (widget))
{
GtkBorder *draw_border = NULL;
......@@ -3947,7 +3947,7 @@ gtk_widget_invalidate_widget_windows (GtkWidget *widget,
if (!GTK_WIDGET_REALIZED (widget))
return;
if (!GTK_WIDGET_NO_WINDOW (widget) && widget->parent)
if (gtk_widget_get_has_window (widget) && widget->parent)
{
int x, y;
......@@ -3981,7 +3981,7 @@ gtk_widget_queue_shallow_draw (GtkWidget *widget)
* need to convert to the coordinates that widget->allocation
* is in.
*/
if (!GTK_WIDGET_NO_WINDOW (widget) && widget->parent)
if (gtk_widget_get_has_window (widget) && widget->parent)
{
int wx, wy;
......@@ -4077,7 +4077,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
if (GTK_WIDGET_MAPPED (widget))
{
if (GTK_WIDGET_NO_WINDOW (widget) && GTK_WIDGET_REDRAW_ON_ALLOC (widget) && position_changed)
if (!gtk_widget_get_has_window (widget) && GTK_WIDGET_REDRAW_ON_ALLOC (widget) && position_changed)
{
/* Invalidate union(old_allaction,widget->allocation) in widget->window
*/
......@@ -4208,7 +4208,7 @@ gtk_widget_translate_coordinates (GtkWidget *src_widget,
return FALSE;
/* Translate from allocation relative to window relative */
if (!GTK_WIDGET_NO_WINDOW (src_widget) && src_widget->parent)
if (gtk_widget_get_has_window (src_widget) && src_widget->parent)
{
gint wx, wy;
gdk_window_get_position (src_widget->window, &wx, &wy);
......@@ -4257,7 +4257,7 @@ gtk_widget_translate_coordinates (GtkWidget *src_widget,
}
/* 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;
gdk_window_get_position (dest_widget->window, &wx, &wy);
......@@ -4286,7 +4286,7 @@ gtk_widget_real_size_allocate (GtkWidget *widget,
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget) &&
!GTK_WIDGET_NO_WINDOW (widget))
gtk_widget_get_has_window (widget))
{
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
......@@ -5048,7 +5048,7 @@ static void
gtk_widget_reparent_subwindows (GtkWidget *widget,
GdkWindow *new_window)
{
if (GTK_WIDGET_NO_WINDOW (widget))
if (!gtk_widget_get_has_window (widget))
{
GList *children = gdk_window_get_children (widget->window);
GList *tmp_list;
......@@ -5103,7 +5103,7 @@ gtk_widget_reparent_fixup_child (GtkWidget *widget,
{
g_assert (client_data != NULL);
if (GTK_WIDGET_NO_WINDOW (widget))
if (!gtk_widget_get_has_window (widget))
{
if (widget->window)
g_object_unref (widget->window);
......@@ -5193,7 +5193,7 @@ gtk_widget_intersect (GtkWidget *widget,
return_val = gdk_rectangle_intersect (&widget->allocation, area, dest);
if (return_val && intersection && !GTK_WIDGET_NO_WINDOW (widget))
if (return_val && intersection && gtk_widget_get_has_window (widget))
{
intersection->x -= widget->allocation.x;
intersection->y -= widget->allocation.y;
......@@ -5924,7 +5924,7 @@ gtk_widget_get_has_window (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return !GTK_WIDGET_NO_WINDOW (widget);
return !((GTK_OBJECT_FLAGS (widget) & GTK_NO_WINDOW) != 0);
}
/**
......@@ -6874,7 +6874,7 @@ gtk_widget_real_style_set (GtkWidget *widget,
GtkStyle *previous_style)
{
if (GTK_WIDGET_REALIZED (widget) &&
!GTK_WIDGET_NO_WINDOW (widget))
gtk_widget_get_has_window (widget))
gtk_style_set_background (widget->style, widget->window, widget->state);
}
......@@ -8073,7 +8073,7 @@ gtk_widget_add_events (GtkWidget *widget,
{
GList *window_list;
if (GTK_WIDGET_NO_WINDOW (widget))
if (!gtk_widget_get_has_window (widget))
window_list = gdk_window_get_children (widget->window);
else
window_list = g_list_prepend (NULL, widget->window);
......@@ -8347,7 +8347,7 @@ gtk_widget_get_pointer (GtkWidget *widget,
{
gdk_window_get_pointer (widget->window, x, y, NULL);
if (GTK_WIDGET_NO_WINDOW (widget))
if (!gtk_widget_get_has_window (widget))
{
if (x)
*x -= widget->allocation.x;
......@@ -8769,7 +8769,7 @@ gtk_widget_real_map (GtkWidget *widget)
{
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
if (!GTK_WIDGET_NO_WINDOW (widget))
if (gtk_widget_get_has_window (widget))
gdk_window_show (widget->window);
}
}
......@@ -8789,7 +8789,7 @@ gtk_widget_real_unmap (GtkWidget *widget)
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
if (!GTK_WIDGET_NO_WINDOW (widget))
if (gtk_widget_get_has_window (widget))
gdk_window_hide (widget->window);
}
}
......@@ -8805,7 +8805,7 @@ gtk_widget_real_unmap (GtkWidget *widget)
static void
gtk_widget_real_realize (GtkWidget *widget)
{
g_assert (GTK_WIDGET_NO_WINDOW (widget));
g_assert (!gtk_widget_get_has_window (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
if (widget->parent)
......@@ -8847,7 +8847,7 @@ gtk_widget_real_unrealize (GtkWidget *widget)
NULL);
gtk_style_detach (widget->style);
if (!GTK_WIDGET_NO_WINDOW (widget))
if (gtk_widget_get_has_window (widget))
{
gdk_window_set_user_data (widget->window, NULL);
gdk_window_destroy (widget->window);
......@@ -9322,7 +9322,7 @@ gtk_widget_shape_combine_mask (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
/* set_shape doesn't work on widgets without gdk window */
g_return_if_fail (!GTK_WIDGET_NO_WINDOW (widget));
g_return_if_fail (gtk_widget_get_has_window (widget));
if (!shape_mask)
{
......@@ -9377,7 +9377,7 @@ gtk_widget_input_shape_combine_mask (GtkWidget *widget,
g_return_if_fail (GTK_IS_WIDGET (widget));
/* set_shape doesn't work on widgets without gdk window */
g_return_if_fail (!GTK_WIDGET_NO_WINDOW (widget));
g_return_if_fail (gtk_widget_get_has_window (widget));
if (!shape_mask)
{
......@@ -9586,7 +9586,7 @@ gtk_widget_get_snapshot (GtkWidget *widget,
width = widget->allocation.width;
height = widget->allocation.height;
if (widget->parent && !GTK_WIDGET_NO_WINDOW (widget))
if (widget->parent && gtk_widget_get_has_window (widget))
{
/* grow snapshot rectangle to cover all widget windows */
parent_window = gtk_widget_get_parent_window (widget);
......@@ -11006,14 +11006,14 @@ gtk_widget_real_set_has_tooltip (GtkWidget *widget,
if (priv_has_tooltip)
{
if (GTK_WIDGET_REALIZED (widget) && GTK_WIDGET_NO_WINDOW (widget))
if (GTK_WIDGET_REALIZED (widget) && !gtk_widget_get_has_window (widget))
gdk_window_set_events (widget->window,
gdk_window_get_events (widget->window) |
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
if (!GTK_WIDGET_NO_WINDOW (widget))
if (gtk_widget_get_has_window (widget))
gtk_widget_add_events (widget,
GDK_LEAVE_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK |
......
......@@ -205,6 +205,7 @@ typedef enum
#define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
#endif
#ifndef GTK_DISABLE_DEPRECATED
/**
* GTK_WIDGET_NO_WINDOW:
* @wid: a #GtkWidget.
......@@ -214,7 +215,7 @@ typedef enum
* Deprecated: 2.20: Use gtk_widget_get_has_window() instead.
*/
#define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
/* FIXME: Deprecating GTK_WIDGET_NO_WINDOW requires fixing GTK internals. */
#endif
/**
* GTK_WIDGET_REALIZED:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment