diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkdnd.c | 9 | ||||
-rw-r--r-- | gtk/gtkeventbox.c | 3 | ||||
-rw-r--r-- | gtk/gtkglarea.c | 1 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 71 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 12 | ||||
-rw-r--r-- | gtk/gtkwidgetprivate.h | 1 | ||||
-rw-r--r-- | gtk/gtkwindow.c | 54 |
7 files changed, 31 insertions, 120 deletions
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 56ea797f46..608dfaa30d 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -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); diff --git a/gtk/gtkeventbox.c b/gtk/gtkeventbox.c index 99f5b5fd5f..518a28dda8 100644 --- a/gtk/gtkeventbox.c +++ b/gtk/gtkeventbox.c @@ -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; diff --git a/gtk/gtkglarea.c b/gtk/gtkglarea.c index 80312cf5c0..8f8f9f5cca 100644 --- a/gtk/gtkglarea.c +++ b/gtk/gtkglarea.c @@ -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; diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 90df011290..da36c58f3f 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -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; @@ -8414,63 +8400,6 @@ gtk_widget_set_mapped (GtkWidget *widget, } /** - * 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 * @redraw_on_allocate: if %TRUE, the entire widget will be redrawn diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index b1ab5409a0..7187c5d9e5 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -195,9 +195,9 @@ struct _GtkWidget * width-for-height geometry management for a said widget and is the * default return. * It’s important to note (as described below) that any widget - * which trades height-for-width or width-for-height must respond properly + * which trades height-for-width or width-for-height must respond properly * to both of the virtual methods #GtkWidgetClass.get_preferred_height_for_width() - * and #GtkWidgetClass.get_preferred_width_for_height() since it might be + * and #GtkWidgetClass.get_preferred_width_for_height() since it might be * queried in either #GtkSizeRequestMode by its parent container. * @measure: This is called by containers to obtain the minimum and natural * size of the widget. Depending on the orientation parameter, the passed @@ -712,7 +712,7 @@ gboolean gtk_widget_send_focus_change (GtkWidget *widget, GDK_AVAILABLE_IN_ALL gboolean gtk_widget_activate (GtkWidget *widget); - + GDK_AVAILABLE_IN_ALL gboolean gtk_widget_intersect (GtkWidget *widget, const GdkRectangle *area, @@ -824,12 +824,6 @@ 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); diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index fe7e05aada..039dc1b076 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -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; diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index e48ed6b7f9..1eeb746450 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -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); - } + 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,30 +9453,27 @@ 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)) - title_height = priv->title_height; - else - title_height = 0; - - gtk_render_background (context, cr, - window_border.left, - window_border.top + title_height, - allocation.width - - (window_border.left + window_border.right), - allocation.height - - (window_border.top + window_border.bottom + title_height)); - gtk_render_frame (context, cr, - window_border.left, - window_border.top + title_height, - allocation.width - - (window_border.left + window_border.right), - allocation.height - - (window_border.top + window_border.bottom + title_height)); - } + if (priv->title_box && + gtk_widget_get_visible (priv->title_box) && + gtk_widget_get_child_visible (priv->title_box)) + title_height = priv->title_height; + else + title_height = 0; + + gtk_render_background (context, cr, + window_border.left, + window_border.top + title_height, + allocation.width - + (window_border.left + window_border.right), + allocation.height - + (window_border.top + window_border.bottom + title_height)); + gtk_render_frame (context, cr, + window_border.left, + window_border.top + title_height, + allocation.width - + (window_border.left + window_border.right), + allocation.height - + (window_border.top + window_border.bottom + title_height)); cairo_destroy (cr); |