[gtk+] widget: Untagle if statements
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] widget: Untagle if statements
- Date: Mon, 19 May 2014 02:26:25 +0000 (UTC)
commit d260694a373f2bc33000d37a5478b114fc357ac4
Author: Benjamin Otte <otte redhat com>
Date: Mon May 19 04:24:10 2014 +0200
widget: Untagle if statements
Reduces the number of nested ifs and makes the code clearer.
gtk/gtkwidget.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 6a12469..3112f46 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5654,9 +5654,9 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
/* Size allocation is god... after consulting god, no further requests or allocations are needed */
priv->alloc_needed = FALSE;
- if (gtk_widget_get_mapped (widget))
+ if (gtk_widget_get_mapped (widget) && priv->redraw_on_alloc)
{
- if (!gtk_widget_get_has_window (widget) && priv->redraw_on_alloc && position_changed)
+ if (!gtk_widget_get_has_window (widget) && position_changed)
{
/* Invalidate union(old_allaction,priv->allocation) in priv->window
*/
@@ -5669,16 +5669,13 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
if (size_changed || baseline_changed)
{
- if (priv->redraw_on_alloc)
- {
- /* Invalidate union(old_allaction,priv->allocation) in priv->window and descendents owned by
widget
- */
- cairo_region_t *invalidate = cairo_region_create_rectangle (&priv->allocation);
- cairo_region_union_rectangle (invalidate, &old_allocation);
+ /* Invalidate union(old_allaction,priv->allocation) in priv->window and descendents owned by widget
+ */
+ cairo_region_t *invalidate = cairo_region_create_rectangle (&priv->allocation);
+ cairo_region_union_rectangle (invalidate, &old_allocation);
- gtk_widget_invalidate_widget_windows (widget, invalidate);
- cairo_region_destroy (invalidate);
- }
+ gtk_widget_invalidate_widget_windows (widget, invalidate);
+ cairo_region_destroy (invalidate);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]