[gtk+] widget: Remove app-paintable



commit 5071206d60d11416b67fb7ac1c9771de06626274
Author: Timm Bäder <mail baedert org>
Date:   Sun Oct 30 17:01:19 2016 +0100

    widget: Remove app-paintable

 demos/gtk-demo/foreigndrawing.c      |    1 -
 demos/gtk-demo/toolpalette.c         |    2 -
 docs/reference/gtk/gtk4-sections.txt |    2 -
 docs/tools/widgets.c                 |    1 -
 gtk/gtkdnd.c                         |    9 +---
 gtk/gtkeventbox.c                    |    3 +-
 gtk/gtkglarea.c                      |    1 -
 gtk/gtkwidget.c                      |   71 ----------------------------------
 gtk/gtkwidget.h                      |   12 +----
 gtk/gtkwidgetprivate.h               |    1 -
 gtk/gtkwindow.c                      |   54 +++++++++++--------------
 tests/animated-resizing.c            |    1 -
 tests/motion-compression.c           |    2 -
 tests/testellipsise.c                |    1 -
 tests/testgtk.c                      |    1 -
 tests/testpopup.c                    |    1 -
 tests/testtooltips.c                 |    1 -
 tests/video-timer.c                  |    1 -
 18 files changed, 31 insertions(+), 134 deletions(-)
---
diff --git a/demos/gtk-demo/foreigndrawing.c b/demos/gtk-demo/foreigndrawing.c
index d024847..11b8b44 100644
--- a/demos/gtk-demo/foreigndrawing.c
+++ b/demos/gtk-demo/foreigndrawing.c
@@ -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);
diff --git a/demos/gtk-demo/toolpalette.c b/demos/gtk-demo/toolpalette.c
index 7ebaf25..da6dfa2 100644
--- a/demos/gtk-demo/toolpalette.c
+++ b/demos/gtk-demo/toolpalette.c
@@ -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,
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index f76eb56..eb7bebc 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -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
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 5c2a7a2..412fa9b 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -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;
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 56ea797..608dfaa 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 99f5b5f..518a28d 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 80312cf..8f8f9f5 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 90df011..da36c58 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 b1ab540..7187c5d 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 fe7e05a..039dc1b 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 e48ed6b..1eeb746 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);
 
diff --git a/tests/animated-resizing.c b/tests/animated-resizing.c
index 2c37857..042ed61 100644
--- a/tests/animated-resizing.c
+++ b/tests/animated-resizing.c
@@ -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);
diff --git a/tests/motion-compression.c b/tests/motion-compression.c
index 1aa2660..31512d6 100644
--- a/tests/motion-compression.c
+++ b/tests/motion-compression.c
@@ -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);
diff --git a/tests/testellipsise.c b/tests/testellipsise.c
index 18b6508..e8d4220 100644
--- a/tests/testellipsise.c
+++ b/tests/testellipsise.c
@@ -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);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index beabc0c..3d092d6 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -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);
 
diff --git a/tests/testpopup.c b/tests/testpopup.c
index cd82468..bb126cb 100644
--- a/tests/testpopup.c
+++ b/tests/testpopup.c
@@ -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);
diff --git a/tests/testtooltips.c b/tests/testtooltips.c
index 4a8884d..93b3ded 100644
--- a/tests/testtooltips.c
+++ b/tests/testtooltips.c
@@ -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;
diff --git a/tests/video-timer.c b/tests/video-timer.c
index bc5de1e..e8b7e0c 100644
--- a/tests/video-timer.c
+++ b/tests/video-timer.c
@@ -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",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]