[gtk+/wip/otte/gl-drawing: 6/15] API: Remove gtk_cairo_should_draw_window()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gl-drawing: 6/15] API: Remove gtk_cairo_should_draw_window()
- Date: Wed, 23 Nov 2016 16:03:19 +0000 (UTC)
commit 439afa8c15f786e491c3d8bcad9656653e65de39
Author: Benjamin Otte <otte redhat com>
Date: Tue Nov 22 19:31:03 2016 +0100
API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
docs/reference/gtk/gtk4-sections.txt | 1 -
gtk/gtkcalendar.c | 26 +++++-------
gtk/gtkcontainer.c | 12 -----
gtk/gtkiconview.c | 3 -
gtk/gtklayout.c | 16 -------
gtk/gtkmenu.c | 39 +++++++----------
gtk/gtknotebook.c | 6 +--
gtk/gtkpaned.c | 3 +-
gtk/gtkrevealer.c | 16 -------
gtk/gtkscrolledwindow.c | 16 ++-----
gtk/gtkstack.c | 36 ++++++----------
gtk/gtktextview.c | 37 +++++++---------
gtk/gtktreeview.c | 78 ++++++++++++++--------------------
gtk/gtkviewport.c | 11 +----
gtk/gtkwidget.c | 47 --------------------
gtk/gtkwidget.h | 3 -
tests/testgtk.c | 3 -
17 files changed, 99 insertions(+), 254 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index e012a12..6373ee3 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4598,7 +4598,6 @@ gtk_widget_trigger_tooltip_query
gtk_widget_get_window
gtk_widget_register_window
gtk_widget_unregister_window
-gtk_cairo_should_draw_window
gtk_cairo_transform_to_window
gtk_widget_get_allocated_width
gtk_widget_get_allocated_height
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c
index 24f34a3..e8cdc6d 100644
--- a/gtk/gtkcalendar.c
+++ b/gtk/gtkcalendar.c
@@ -2742,26 +2742,22 @@ gtk_calendar_draw (GtkWidget *widget,
{
GtkCalendar *calendar = GTK_CALENDAR (widget);
GtkCalendarPrivate *priv = calendar->priv;
+ GtkStyleContext *context;
int i;
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
- {
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (widget);
+ context = gtk_widget_get_style_context (widget);
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
- gtk_render_background (context, cr, 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
- gtk_render_frame (context, cr, 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
+ gtk_render_background (context, cr, 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+ gtk_render_frame (context, cr, 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
- gtk_style_context_restore (context);
- }
+ gtk_style_context_restore (context);
calendar_paint_main (calendar, cr);
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 767cc5a..928d95e 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -3147,21 +3147,9 @@ gtk_container_should_propagate_draw (GtkContainer *container,
GtkWidget *child,
cairo_t *cr)
{
- GdkWindow *child_in_window;
-
if (!_gtk_widget_is_drawable (child))
return FALSE;
- /* Never propagate to a child window when exposing a window
- * that is not the one the child widget is in.
- */
- if (_gtk_widget_get_has_window (child))
- child_in_window = gdk_window_get_parent (_gtk_widget_get_window (child));
- else
- child_in_window = _gtk_widget_get_window (child);
- if (!gtk_cairo_should_draw_window (cr, child_in_window))
- return FALSE;
-
return TRUE;
}
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index 82ca127..84b77e0 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1757,9 +1757,6 @@ gtk_icon_view_draw (GtkWidget *widget,
gtk_widget_get_allocated_width (widget),
gtk_widget_get_allocated_height (widget));
- if (!gtk_cairo_should_draw_window (cr, icon_view->priv->bin_window))
- return FALSE;
-
cairo_save (cr);
gtk_cairo_transform_to_window (cr, widget, icon_view->priv->bin_window);
diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c
index 28b72d0..f505278 100644
--- a/gtk/gtklayout.c
+++ b/gtk/gtklayout.c
@@ -132,8 +132,6 @@ static void gtk_layout_measure (GtkWidget *widget,
int *natural_baseline);
static void gtk_layout_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static gint gtk_layout_draw (GtkWidget *widget,
- cairo_t *cr);
static void gtk_layout_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_layout_remove (GtkContainer *container,
@@ -603,7 +601,6 @@ gtk_layout_class_init (GtkLayoutClass *class)
widget_class->map = gtk_layout_map;
widget_class->measure = gtk_layout_measure;
widget_class->size_allocate = gtk_layout_size_allocate;
- widget_class->draw = gtk_layout_draw;
container_class->add = gtk_layout_add;
container_class->remove = gtk_layout_remove;
@@ -899,19 +896,6 @@ gtk_layout_size_allocate (GtkWidget *widget,
gtk_layout_set_vadjustment_values (layout);
}
-static gboolean
-gtk_layout_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkLayout *layout = GTK_LAYOUT (widget);
- GtkLayoutPrivate *priv = layout->priv;
-
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- GTK_WIDGET_CLASS (gtk_layout_parent_class)->draw (widget, cr);
-
- return FALSE;
-}
-
/* Container methods
*/
static void
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 3a569f2..7839098 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -2927,6 +2927,7 @@ gtk_menu_draw (GtkWidget *widget,
GtkMenuPrivate *priv;
GtkStyleContext *context;
GtkAllocation allocation;
+ int x, y;
menu = GTK_MENU (widget);
priv = menu->priv;
@@ -2934,34 +2935,26 @@ gtk_menu_draw (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
- {
- gtk_render_background (context, cr, 0, 0,
- allocation.width, allocation.height);
- gtk_render_frame (context, cr, 0, 0,
- allocation.width, allocation.height);
-
- if (priv->upper_arrow_visible)
- gtk_css_gadget_draw (priv->top_arrow_gadget, cr);
+ gtk_render_background (context, cr, 0, 0,
+ allocation.width, allocation.height);
+ gtk_render_frame (context, cr, 0, 0,
+ allocation.width, allocation.height);
- if (priv->lower_arrow_visible)
- gtk_css_gadget_draw (priv->bottom_arrow_gadget, cr);
- }
+ if (priv->upper_arrow_visible)
+ gtk_css_gadget_draw (priv->top_arrow_gadget, cr);
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- {
- int x, y;
+ if (priv->lower_arrow_visible)
+ gtk_css_gadget_draw (priv->bottom_arrow_gadget, cr);
- gdk_window_get_position (priv->view_window, &x, &y);
+ gdk_window_get_position (priv->view_window, &x, &y);
- cairo_rectangle (cr,
- x - allocation.x, y - allocation.y,
- gdk_window_get_width (priv->view_window),
- gdk_window_get_height (priv->view_window));
- cairo_clip (cr);
+ cairo_rectangle (cr,
+ x - allocation.x, y - allocation.y,
+ gdk_window_get_width (priv->view_window),
+ gdk_window_get_height (priv->view_window));
+ cairo_clip (cr);
- GTK_WIDGET_CLASS (gtk_menu_parent_class)->draw (widget, cr);
- }
+ GTK_WIDGET_CLASS (gtk_menu_parent_class)->draw (widget, cr);
return FALSE;
}
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 5f0144f..02939bb 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -2381,11 +2381,9 @@ gtk_notebook_draw (GtkWidget *widget,
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
GtkNotebookPrivate *priv = notebook->priv;
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
- gtk_css_gadget_draw (priv->gadget, cr);
+ gtk_css_gadget_draw (priv->gadget, cr);
- if (priv->operation == DRAG_OPERATION_REORDER &&
- gtk_cairo_should_draw_window (cr, priv->drag_window))
+ if (priv->operation == DRAG_OPERATION_REORDER)
gtk_css_gadget_draw (priv->cur_page->gadget, cr);
return FALSE;
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index a8c5db8..1fadaf5 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1665,8 +1665,7 @@ gtk_paned_render (GtkCssGadget *gadget,
int window_x, window_y;
gtk_widget_get_allocation (widget, &widget_allocation);
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)) &&
- priv->child1 && gtk_widget_get_visible (priv->child1) &&
+ if (priv->child1 && gtk_widget_get_visible (priv->child1) &&
priv->child2 && gtk_widget_get_visible (priv->child2))
gtk_css_gadget_draw (priv->handle_gadget, cr);
diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c
index ae4f141..c9e7693 100644
--- a/gtk/gtkrevealer.c
+++ b/gtk/gtkrevealer.c
@@ -100,8 +100,6 @@ static void gtk_revealer_real_size_allocate (GtkWidget
GtkAllocation *allocation);
static void gtk_revealer_real_map (GtkWidget *widget);
static void gtk_revealer_real_unmap (GtkWidget *widget);
-static gboolean gtk_revealer_real_draw (GtkWidget *widget,
- cairo_t *cr);
static void gtk_revealer_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
@@ -220,7 +218,6 @@ gtk_revealer_class_init (GtkRevealerClass *klass)
widget_class->size_allocate = gtk_revealer_real_size_allocate;
widget_class->map = gtk_revealer_real_map;
widget_class->unmap = gtk_revealer_real_unmap;
- widget_class->draw = gtk_revealer_real_draw;
widget_class->measure = gtk_revealer_measure;
container_class->add = gtk_revealer_real_add;
@@ -652,19 +649,6 @@ gtk_revealer_real_unmap (GtkWidget *widget)
gtk_revealer_stop_animation (revealer);
}
-static gboolean
-gtk_revealer_real_draw (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkRevealer *revealer = GTK_REVEALER (widget);
- GtkRevealerPrivate *priv = gtk_revealer_get_instance_private (revealer);
-
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- GTK_WIDGET_CLASS (gtk_revealer_parent_class)->draw (widget, cr);
-
- return GDK_EVENT_PROPAGATE;
-}
-
/**
* gtk_revealer_set_reveal_child:
* @revealer: a #GtkRevealer
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index bc5f459..9744a98 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1973,20 +1973,14 @@ gtk_scrolled_window_render (GtkCssGadget *gadget,
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
- {
- if (priv->hscrollbar_visible &&
- priv->vscrollbar_visible)
- gtk_scrolled_window_draw_scrollbars_junction (scrolled_window, cr);
- }
+ if (priv->hscrollbar_visible &&
+ priv->vscrollbar_visible)
+ gtk_scrolled_window_draw_scrollbars_junction (scrolled_window, cr);
GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->draw (widget, cr);
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
- {
- gtk_scrolled_window_draw_undershoot (scrolled_window, cr);
- gtk_scrolled_window_draw_overshoot (scrolled_window, cr);
- }
+ gtk_scrolled_window_draw_undershoot (scrolled_window, cr);
+ gtk_scrolled_window_draw_overshoot (scrolled_window, cr);
return FALSE;
}
diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c
index e79056d..610b2f6 100644
--- a/gtk/gtkstack.c
+++ b/gtk/gtkstack.c
@@ -2024,8 +2024,7 @@ gtk_stack_draw_slide (GtkWidget *widget,
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
- if (priv->last_visible_surface &&
- gtk_cairo_should_draw_window (cr, priv->view_window))
+ if (priv->last_visible_surface)
{
GtkAllocation allocation;
int x, y;
@@ -2078,10 +2077,9 @@ gtk_stack_draw_slide (GtkWidget *widget,
cairo_restore (cr);
}
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- gtk_container_propagate_draw (GTK_CONTAINER (stack),
- priv->visible_child->widget,
- cr);
+ gtk_container_propagate_draw (GTK_CONTAINER (stack),
+ priv->visible_child->widget,
+ cr);
}
static gboolean
@@ -2108,19 +2106,15 @@ gtk_stack_render (GtkCssGadget *gadget,
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
GtkStack *stack = GTK_STACK (widget);
GtkStackPrivate *priv = gtk_stack_get_instance_private (stack);
+ GtkStyleContext *context;
cairo_t *pattern_cr;
- if (gtk_cairo_should_draw_window (cr, priv->view_window))
- {
- GtkStyleContext *context;
-
- context = gtk_widget_get_style_context (widget);
- gtk_render_background (context,
- cr,
- 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
- }
+ context = gtk_widget_get_style_context (widget);
+ gtk_render_background (context,
+ cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
if (priv->visible_child)
{
@@ -2153,8 +2147,7 @@ gtk_stack_render (GtkCssGadget *gadget,
switch (priv->active_transition_type)
{
case GTK_STACK_TRANSITION_TYPE_CROSSFADE:
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- gtk_stack_draw_crossfade (widget, cr);
+ gtk_stack_draw_crossfade (widget, cr);
break;
case GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT:
case GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT:
@@ -2170,15 +2163,14 @@ gtk_stack_render (GtkCssGadget *gadget,
case GTK_STACK_TRANSITION_TYPE_UNDER_DOWN:
case GTK_STACK_TRANSITION_TYPE_UNDER_LEFT:
case GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT:
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- gtk_stack_draw_under (widget, cr);
+ gtk_stack_draw_under (widget, cr);
break;
default:
g_assert_not_reached ();
}
}
- else if (gtk_cairo_should_draw_window (cr, priv->bin_window))
+ else
gtk_container_propagate_draw (GTK_CONTAINER (stack),
priv->visible_child->widget,
cr);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index f21ed31..7f4f79a 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5881,27 +5881,24 @@ paint_border_window (GtkTextView *text_view,
GtkStyleContext *context)
{
GdkWindow *window;
+ gint w, h;
+
if (text_window == NULL)
return;
window = gtk_text_view_get_window (text_view, text_window->type);
- if (gtk_cairo_should_draw_window (cr, window))
- {
- gint w, h;
+ w = gdk_window_get_width (window);
+ h = gdk_window_get_height (window);
- gtk_style_context_save_to_node (context, text_window->css_node);
+ gtk_style_context_save_to_node (context, text_window->css_node);
- w = gdk_window_get_width (window);
- h = gdk_window_get_height (window);
-
- cairo_save (cr);
- gtk_cairo_transform_to_window (cr, GTK_WIDGET (text_view), window);
- gtk_render_background (context, cr, 0, 0, w, h);
- cairo_restore (cr);
+ cairo_save (cr);
+ gtk_cairo_transform_to_window (cr, GTK_WIDGET (text_view), window);
+ gtk_render_background (context, cr, 0, 0, w, h);
+ cairo_restore (cr);
- gtk_style_context_restore (context);
- }
+ gtk_style_context_restore (context);
}
static gboolean
@@ -5924,15 +5921,13 @@ gtk_text_view_draw (GtkWidget *widget,
window = gtk_text_view_get_window (GTK_TEXT_VIEW (widget),
GTK_TEXT_WINDOW_TEXT);
- if (gtk_cairo_should_draw_window (cr, window))
- {
- DV(g_print (">Exposed ("G_STRLOC")\n"));
- cairo_save (cr);
- gtk_cairo_transform_to_window (cr, widget, window);
- draw_text (widget, cr);
- cairo_restore (cr);
- }
+ DV(g_print (">Exposed ("G_STRLOC")\n"));
+
+ cairo_save (cr);
+ gtk_cairo_transform_to_window (cr, widget, window);
+ draw_text (widget, cr);
+ cairo_restore (cr);
paint_border_window (GTK_TEXT_VIEW (widget), cr, priv->left_window, context);
paint_border_window (GTK_TEXT_VIEW (widget), cr, priv->right_window, context);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 0e4ab4e..d1c4847 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -5362,37 +5362,36 @@ gtk_tree_view_draw (GtkWidget *widget,
cairo_t *cr)
{
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
- GtkWidget *button;
+ GtkWidget *button;
GtkStyleContext *context;
+ GList *list;
context = gtk_widget_get_style_context (widget);
- if (gtk_cairo_should_draw_window (cr, tree_view->priv->bin_window))
- {
- GList *tmp_list;
+ gtk_render_background (context, cr,
+ 0, 0,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
- cairo_save (cr);
+ cairo_save (cr);
- gtk_cairo_transform_to_window (cr, widget, tree_view->priv->bin_window);
- gtk_tree_view_bin_draw (widget, cr);
+ gtk_cairo_transform_to_window (cr, widget, tree_view->priv->bin_window);
+ gtk_tree_view_bin_draw (widget, cr);
- cairo_restore (cr);
+ cairo_restore (cr);
- /* We can't just chain up to Container::draw as it will try to send the
- * event to the headers, so we handle propagating it to our children
- * (eg. widgets being edited) ourselves.
- */
- tmp_list = tree_view->priv->children;
- while (tmp_list)
- {
- GtkTreeViewChild *child = tmp_list->data;
- tmp_list = tmp_list->next;
+ /* We can't just chain up to Container::draw as it will try to send the
+ * event to the headers, so we handle propagating it to our children
+ * (eg. widgets being edited) ourselves.
+ */
+ for (list = tree_view->priv->children; list; list = list->next)
+ {
+ GtkTreeViewChild *child = list->data;
- gtk_container_propagate_draw (GTK_CONTAINER (tree_view), child->widget, cr);
- }
+ gtk_container_propagate_draw (GTK_CONTAINER (tree_view), child->widget, cr);
}
- else if (tree_view->priv->drag_highlight_window &&
- gtk_cairo_should_draw_window (cr, tree_view->priv->drag_highlight_window))
+
+ if (tree_view->priv->drag_highlight_window)
{
GdkRGBA color;
@@ -5417,39 +5416,26 @@ gtk_tree_view_draw (GtkWidget *widget,
}
cairo_restore (cr);
}
- else
- {
- gtk_render_background (context, cr,
- 0, 0,
- gtk_widget_get_allocated_width (widget),
- gtk_widget_get_allocated_height (widget));
- }
gtk_style_context_save (context);
gtk_style_context_remove_class (context, GTK_STYLE_CLASS_VIEW);
- if (gtk_cairo_should_draw_window (cr, tree_view->priv->header_window))
+ for (list = tree_view->priv->columns; list != NULL; list = list->next)
{
- GList *list;
-
- for (list = tree_view->priv->columns; list != NULL; list = list->next)
- {
- GtkTreeViewColumn *column = list->data;
+ GtkTreeViewColumn *column = list->data;
- if (column == tree_view->priv->drag_column)
- continue;
+ if (column == tree_view->priv->drag_column)
+ continue;
- if (gtk_tree_view_column_get_visible (column))
- {
- button = gtk_tree_view_column_get_button (column);
- gtk_container_propagate_draw (GTK_CONTAINER (tree_view),
- button, cr);
- }
- }
+ if (gtk_tree_view_column_get_visible (column))
+ {
+ button = gtk_tree_view_column_get_button (column);
+ gtk_container_propagate_draw (GTK_CONTAINER (tree_view),
+ button, cr);
+ }
}
-
- if (tree_view->priv->drag_window &&
- gtk_cairo_should_draw_window (cr, tree_view->priv->drag_window))
+
+ if (tree_view->priv->drag_window)
{
button = gtk_tree_view_column_get_button (tree_view->priv->drag_column);
gtk_container_propagate_draw (GTK_CONTAINER (tree_view),
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index 8360dba..40363a8 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -305,13 +305,8 @@ gtk_viewport_render (GtkCssGadget *gadget,
gpointer data)
{
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
- GtkViewport *viewport = GTK_VIEWPORT (widget);
- GtkViewportPrivate *priv = viewport->priv;
- if (gtk_cairo_should_draw_window (cr, priv->bin_window))
- {
- GTK_WIDGET_CLASS (gtk_viewport_parent_class)->draw (widget, cr);
- }
+ GTK_WIDGET_CLASS (gtk_viewport_parent_class)->draw (widget, cr);
return FALSE;
}
@@ -732,9 +727,7 @@ gtk_viewport_draw (GtkWidget *widget,
GtkViewport *viewport = GTK_VIEWPORT (widget);
GtkViewportPrivate *priv = viewport->priv;
- if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)) ||
- gtk_cairo_should_draw_window (cr, priv->bin_window))
- gtk_css_gadget_draw (priv->gadget, cr);
+ gtk_css_gadget_draw (priv->gadget, cr);
return FALSE;
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index cc19f6e..d9eab4e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -6282,53 +6282,6 @@ gtk_widget_get_renderer (GtkWidget *widget)
return NULL;
}
-/**
- * gtk_cairo_should_draw_window:
- * @cr: a cairo context
- * @window: the window to check. @window may not be an input-only
- * window.
- *
- * This function is supposed to be called in #GtkWidget::draw
- * implementations for widgets that support multiple windows.
- * @cr must be untransformed from invoking of the draw function.
- * This function will return %TRUE if the contents of the given
- * @window are supposed to be drawn and %FALSE otherwise. Note
- * that when the drawing was not initiated by the windowing
- * system this function will return %TRUE for all windows, so
- * you need to draw the bottommost window first. Also, do not
- * use “else if” statements to check which window should be drawn.
- *
- * Returns: %TRUE if @window should be drawn
- *
- * Since: 3.0
- */
-gboolean
-gtk_cairo_should_draw_window (cairo_t *cr,
- GdkWindow *window)
-{
- GdkDrawingContext *context;
- GdkWindow *tmp;
-
- g_return_val_if_fail (cr != NULL, FALSE);
- g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
-
- if (gtk_cairo_is_marked_for_draw (cr))
- return TRUE;
-
- context = gdk_cairo_get_drawing_context (cr);
- if (context == NULL)
- return TRUE;
-
- tmp = gdk_drawing_context_get_window (context);
- if (tmp == NULL)
- return TRUE;
-
- while (!gdk_window_has_native (window))
- window = gdk_window_get_parent (window);
-
- return tmp == window;
-}
-
typedef enum {
RENDER_SNAPSHOT,
RENDER_DRAW
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 25d6de4..cea1298 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -1110,9 +1110,6 @@ GDK_AVAILABLE_IN_ALL
gboolean gtk_widget_get_has_tooltip (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
-gboolean gtk_cairo_should_draw_window (cairo_t *cr,
- GdkWindow *window);
-GDK_AVAILABLE_IN_ALL
void gtk_cairo_transform_to_window (cairo_t *cr,
GtkWidget *widget,
GdkWindow *window);
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 68b0c9e..dc4ae5e 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -8323,9 +8323,6 @@ layout_draw_handler (GtkWidget *widget, cairo_t *cr)
layout = GTK_LAYOUT (widget);
bin_window = gtk_layout_get_bin_window (layout);
- if (!gtk_cairo_should_draw_window (cr, bin_window))
- return FALSE;
-
gdk_window_get_position (bin_window, &x, &y);
cairo_translate (cr, x, y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]