widget: Remove app-paintable

This commit is contained in:
Timm Bäder 2016-10-30 17:01:19 +01:00
parent 567f6373c8
commit 5071206d60
18 changed files with 30 additions and 133 deletions

View File

@ -971,7 +971,6 @@ do_foreigndrawing (GtkWidget *do_widget)
gtk_widget_set_size_request (da, 400, 400);
gtk_widget_set_hexpand (da, TRUE);
gtk_widget_set_vexpand (da, TRUE);
gtk_widget_set_app_paintable (da, TRUE);
gtk_container_add (GTK_CONTAINER (box), da);
g_signal_connect (da, "draw", G_CALLBACK (draw_cb), NULL);

View File

@ -567,7 +567,6 @@ do_toolpalette (GtkWidget *do_widget)
/* ===== passive DnD dest ===== */
contents = gtk_drawing_area_new ();
gtk_widget_set_app_paintable (contents, TRUE);
g_object_connect (contents,
"signal::draw", canvas_draw, NULL,
@ -594,7 +593,6 @@ do_toolpalette (GtkWidget *do_widget)
/* ===== interactive DnD dest ===== */
contents = gtk_drawing_area_new ();
gtk_widget_set_app_paintable (contents, TRUE);
g_object_connect (contents,
"signal::draw", canvas_draw, NULL,

View File

@ -4705,7 +4705,6 @@ gtk_widget_render_icon
gtk_widget_render_icon_pixbuf
gtk_widget_queue_draw_area
gtk_widget_queue_draw_region
gtk_widget_set_app_paintable
gtk_widget_set_redraw_on_allocate
gtk_widget_mnemonic_activate
gtk_widget_class_install_style_property
@ -4763,7 +4762,6 @@ gtk_widget_get_allocated_baseline
gtk_widget_get_allocated_size
gtk_widget_get_clip
gtk_widget_set_clip
gtk_widget_get_app_paintable
gtk_widget_get_can_default
gtk_widget_set_can_default
gtk_widget_get_can_focus

View File

@ -798,7 +798,6 @@ create_page_setup_dialog (void)
settings);
info = new_widget_info ("pagesetupdialog", widget, ASIS);
gtk_widget_set_app_paintable (info->window, FALSE);
info->include_decorations = TRUE;
return info;

View File

@ -1579,20 +1579,16 @@ gtk_drag_set_icon_widget_internal (GdkDragContext *context,
if (!info->icon_window)
{
GdkDisplay *display;
GdkScreen *screen;
screen = gdk_window_get_screen (gdk_drag_context_get_source_window (context));
display = gdk_window_get_display (gdk_drag_context_get_source_window (context));
info->icon_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (info->icon_window), GDK_WINDOW_TYPE_HINT_DND);
gtk_window_set_screen (GTK_WINDOW (info->icon_window), screen);
gtk_widget_set_size_request (info->icon_window, 24, 24);
gtk_widget_set_events (info->icon_window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
if (gdk_display_is_composited (display))
gtk_widget_set_app_paintable (info->icon_window, TRUE);
gtk_style_context_remove_class (gtk_widget_get_style_context (info->icon_window), "background");
gtk_window_set_hardcoded_window (GTK_WINDOW (info->icon_window),
gdk_drag_context_get_drag_window (context));
@ -1802,11 +1798,12 @@ gtk_drag_set_icon_surface (GdkDragContext *context,
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
gtk_widget_set_events (window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_widget_set_app_paintable (window, TRUE);
gtk_widget_set_size_request (window, extents.width, extents.height);
gtk_widget_realize (window);
gtk_style_context_remove_class (gtk_widget_get_style_context (window), "background");
pattern = cairo_pattern_create_for_surface (surface);
cairo_matrix_init_translate (&matrix, extents.x, extents.y);
cairo_pattern_set_matrix (pattern, &matrix);

View File

@ -521,8 +521,7 @@ static gboolean
gtk_event_box_draw (GtkWidget *widget,
cairo_t *cr)
{
if (gtk_widget_get_has_window (widget) &&
!gtk_widget_get_app_paintable (widget))
if (gtk_widget_get_has_window (widget))
{
GtkStyleContext *context;

View File

@ -969,7 +969,6 @@ gtk_gl_area_init (GtkGLArea *area)
GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
gtk_widget_set_has_window (GTK_WIDGET (area), FALSE);
gtk_widget_set_app_paintable (GTK_WIDGET (area), TRUE);
priv->auto_render = TRUE;
priv->needs_render = TRUE;

View File

@ -566,7 +566,6 @@ enum {
PROP_HEIGHT_REQUEST,
PROP_VISIBLE,
PROP_SENSITIVE,
PROP_APP_PAINTABLE,
PROP_CAN_FOCUS,
PROP_HAS_FOCUS,
PROP_IS_FOCUS,
@ -1115,13 +1114,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
TRUE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
widget_props[PROP_APP_PAINTABLE] =
g_param_spec_boolean ("app-paintable",
P_("Application paintable"),
P_("Whether the application will paint directly on the widget"),
FALSE,
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
widget_props[PROP_CAN_FOCUS] =
g_param_spec_boolean ("can-focus",
P_("Can focus"),
@ -3266,9 +3258,6 @@ gtk_widget_set_property (GObject *object,
case PROP_SENSITIVE:
gtk_widget_set_sensitive (widget, g_value_get_boolean (value));
break;
case PROP_APP_PAINTABLE:
gtk_widget_set_app_paintable (widget, g_value_get_boolean (value));
break;
case PROP_CAN_FOCUS:
gtk_widget_set_can_focus (widget, g_value_get_boolean (value));
break;
@ -3441,9 +3430,6 @@ gtk_widget_get_property (GObject *object,
case PROP_SENSITIVE:
g_value_set_boolean (value, gtk_widget_get_sensitive (widget));
break;
case PROP_APP_PAINTABLE:
g_value_set_boolean (value, gtk_widget_get_app_paintable (widget));
break;
case PROP_CAN_FOCUS:
g_value_set_boolean (value, gtk_widget_get_can_focus (widget));
break;
@ -8413,63 +8399,6 @@ gtk_widget_set_mapped (GtkWidget *widget,
widget->priv->mapped = mapped;
}
/**
* gtk_widget_set_app_paintable:
* @widget: a #GtkWidget
* @app_paintable: %TRUE if the application will paint on the widget
*
* Sets whether the application intends to draw on the widget in
* an #GtkWidget::draw handler.
*
* This is a hint to the widget and does not affect the behavior of
* the GTK+ core; many widgets ignore this flag entirely. For widgets
* that do pay attention to the flag, such as #GtkEventBox and #GtkWindow,
* the effect is to suppress default themed drawing of the widget's
* background. (Children of the widget will still be drawn.) The application
* is then entirely responsible for drawing the widget background.
*
* Note that the background is still drawn when the widget is mapped.
**/
void
gtk_widget_set_app_paintable (GtkWidget *widget,
gboolean app_paintable)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
app_paintable = (app_paintable != FALSE);
if (widget->priv->app_paintable != app_paintable)
{
widget->priv->app_paintable = app_paintable;
if (_gtk_widget_is_drawable (widget))
gtk_widget_queue_draw (widget);
g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_APP_PAINTABLE]);
}
}
/**
* gtk_widget_get_app_paintable:
* @widget: a #GtkWidget
*
* Determines whether the application intends to draw on the widget in
* an #GtkWidget::draw handler.
*
* See gtk_widget_set_app_paintable()
*
* Returns: %TRUE if the widget is app paintable
*
* Since: 2.18
**/
gboolean
gtk_widget_get_app_paintable (GtkWidget *widget)
{
g_return_val_if_fail (GTK_IS_WIDGET (widget), FALSE);
return widget->priv->app_paintable;
}
/**
* gtk_widget_set_redraw_on_allocate:
* @widget: a #GtkWidget

View File

@ -823,12 +823,6 @@ void gtk_widget_set_mapped (GtkWidget *widget,
GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_get_mapped (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_set_app_paintable (GtkWidget *widget,
gboolean app_paintable);
GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_get_app_paintable (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_set_redraw_on_allocate (GtkWidget *widget,
gboolean redraw_on_allocate);

View File

@ -65,7 +65,6 @@ struct _GtkWidgetPrivate
guint receives_default : 1;
guint has_grab : 1;
guint shadowed : 1;
guint app_paintable : 1;
guint redraw_on_alloc : 1;
guint no_show_all : 1;
guint child_visible : 1;

View File

@ -6808,18 +6808,15 @@ update_opaque_region (GtkWindow *window,
cairo_region_t *opaque_region;
GtkStyleContext *context;
gboolean is_opaque = FALSE;
const GdkRGBA *color;
if (!_gtk_widget_get_realized (widget))
return;
context = gtk_widget_get_style_context (widget);
if (!gtk_widget_get_app_paintable (widget))
{
const GdkRGBA *color;
color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_BACKGROUND_COLOR));
is_opaque = (color->alpha >= 1.0);
}
if (gtk_widget_get_opacity (widget) < 1.0)
is_opaque = FALSE;
@ -9456,8 +9453,6 @@ gtk_window_get_render_node (GtkWidget *widget,
gtk_style_context_restore (context);
}
if (!gtk_widget_get_app_paintable (widget))
{
if (priv->title_box &&
gtk_widget_get_visible (priv->title_box) &&
gtk_widget_get_child_visible (priv->title_box))
@ -9479,7 +9474,6 @@ gtk_window_get_render_node (GtkWidget *widget,
(window_border.left + window_border.right),
allocation.height -
(window_border.top + window_border.bottom + title_height));
}
cairo_destroy (cr);

View File

@ -194,7 +194,6 @@ main(int argc, char **argv)
gtk_window_set_keep_above (GTK_WINDOW (window), TRUE);
gtk_window_set_gravity (GTK_WINDOW (window), GDK_GRAVITY_CENTER);
gtk_widget_set_app_paintable (window, TRUE);
g_signal_connect (window, "draw",
G_CALLBACK (on_window_draw), NULL);

View File

@ -43,9 +43,7 @@ main (int argc, char **argv)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
gtk_widget_set_app_paintable (window, TRUE);
gtk_widget_add_events (window, GDK_POINTER_MOTION_MASK);
gtk_widget_set_app_paintable (window, TRUE);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);

View File

@ -149,7 +149,6 @@ main (int argc, char *argv[])
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
ebox = gtk_event_box_new ();
gtk_widget_set_app_paintable (ebox, TRUE);
gtk_container_add (GTK_CONTAINER (ebox), label);
gtk_box_pack_start (GTK_BOX (vbox), combo, FALSE, TRUE);

View File

@ -256,7 +256,6 @@ create_alpha_window (GtkWidget *widget)
"_Close", 0,
NULL);
gtk_widget_set_app_paintable (window, TRUE);
g_signal_connect (window, "draw",
G_CALLBACK (on_alpha_window_draw), NULL);

View File

@ -37,7 +37,6 @@ on_map_event (GtkWidget *parent,
popup = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_size_request (GTK_WIDGET (popup), 20, 20);
gtk_widget_set_app_paintable (GTK_WIDGET (popup), TRUE);
gtk_window_set_transient_for (GTK_WINDOW (popup), GTK_WINDOW (parent));
g_signal_connect (popup, "draw", G_CALLBACK (draw_popup), NULL);
g_signal_connect (parent, "motion-notify-event", G_CALLBACK (place_popup), popup);

View File

@ -59,7 +59,6 @@ query_tooltip_custom_cb (GtkWidget *widget,
{
GtkWindow *window = gtk_widget_get_tooltip_window (widget);
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
g_signal_connect (window, "draw", G_CALLBACK (draw_tooltip), NULL);
return TRUE;

View File

@ -374,7 +374,6 @@ main(int argc, char **argv)
}
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_widget_set_app_paintable (window, TRUE);
gtk_window_set_default_size (GTK_WINDOW (window), 300, 300);
g_signal_connect (window, "draw",