[gtk+/overlay: 25/34] Untangle nested switch
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/overlay: 25/34] Untangle nested switch
- Date: Sat, 11 Jun 2011 01:00:45 +0000 (UTC)
commit cf8daffec19afa009bf77544b7000d9bca12d494
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 10 19:16:55 2011 -0400
Untangle nested switch
Looks much cleaner this way.
gtk/gtkoverlay.c | 88 +++++++++++++-----------------------------------------
1 files changed, 21 insertions(+), 67 deletions(-)
---
diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c
index 13c7f61..5aa7392 100644
--- a/gtk/gtkoverlay.c
+++ b/gtk/gtkoverlay.c
@@ -274,81 +274,35 @@ gtk_overlay_size_allocate (GtkWidget *widget,
x_offset = child->x_offset;
y_offset = child->y_offset;
- /* FIXME: Add all the positions here */
switch (halign)
{
+ case GTK_ALIGN_START:
+ alloc.x = x_offset;
+ break;
+ case GTK_ALIGN_CENTER:
+ alloc.x = MAX (main_alloc.x, main_alloc.width / 2 - req.width / 2 + x_offset);
+ break;
case GTK_ALIGN_END:
- switch (valign)
- {
- case GTK_ALIGN_START:
- alloc.x = MAX (main_alloc.x, main_alloc.width - req.width + x_offset);
- alloc.y = y_offset;
- break;
-
- case GTK_ALIGN_END:
- alloc.x = MAX (main_alloc.x, main_alloc.width - req.width + x_offset);
- alloc.y = MAX (main_alloc.y, main_alloc.height - req.height + y_offset);
- break;
-
- case GTK_ALIGN_CENTER:
- alloc.x = MAX (main_alloc.x, main_alloc.width - req.width + x_offset);
- alloc.y = MAX (main_alloc.y, main_alloc.height / 2 - req.height / 2 + y_offset);
- break;
-
- default:
- break;
- }
- break;
+ alloc.x = MAX (main_alloc.x, main_alloc.width - req.width + x_offset);
+ break;
+ default:
+ alloc.x = 0;
+ }
+ switch (valign)
+ {
case GTK_ALIGN_START:
- switch (valign)
- {
- case GTK_ALIGN_START:
- alloc.x = x_offset;
- alloc.y = y_offset;
- break;
-
- case GTK_ALIGN_END:
- alloc.x = x_offset;
- alloc.y = MAX (main_alloc.y, main_alloc.height - req.height + y_offset);
- break;
-
- case GTK_ALIGN_CENTER:
- alloc.x = x_offset;
- alloc.y = MAX (main_alloc.y, main_alloc.height / 2 - req.height / 2 + y_offset);
- break;
-
- default:
- break;
- }
- break;
-
+ alloc.y = y_offset;
+ break;
case GTK_ALIGN_CENTER:
- switch (valign)
- {
- case GTK_ALIGN_START:
- alloc.x = MAX (main_alloc.x, main_alloc.width / 2 - req.width / 2 + x_offset);
- alloc.y = y_offset;
- break;
-
- case GTK_ALIGN_END:
- alloc.x = MAX (main_alloc.x, main_alloc.width / 2 - req.width / 2 + x_offset);
- alloc.y = MAX (main_alloc.y, main_alloc.height - req.height + y_offset);
- break;
-
- case GTK_ALIGN_CENTER:
- alloc.x = MAX (main_alloc.x, main_alloc.width / 2 - req.width / 2 + x_offset);
- alloc.y = MAX (main_alloc.y, main_alloc.height / 2 - req.height / 2 + y_offset);
- break;
-
- default:
- break;
- }
- break;
-
+ alloc.y = MAX (main_alloc.y, main_alloc.height / 2 - req.height / 2 + y_offset);
+ break;
+ case GTK_ALIGN_END:
+ alloc.y = MAX (main_alloc.y, main_alloc.height - req.height + y_offset);
+ break;
default:
- alloc.x = 0;
alloc.y = 0;
+ break;
}
alloc.width = MIN (main_alloc.width, req.width);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]