[gtk+] sizerequest: Split out size request cache code into separate header



commit 0a1a2ac1484370f8e95bfa3576a7ad211f9b6548
Author: Benjamin Otte <otte redhat com>
Date:   Tue Nov 13 13:41:05 2012 +0100

    sizerequest: Split out size request cache code into separate header

 gtk/Makefile.am                  |    1 +
 gtk/gtksizerequest.c             |    1 +
 gtk/gtksizerequestcacheprivate.h |   69 ++++++++++++++++++++++++++++++++++++++
 gtk/gtkwidget.c                  |    1 +
 gtk/gtkwidgetprivate.h           |   35 -------------------
 5 files changed, 72 insertions(+), 35 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 76f09cf..61d396e 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -519,6 +519,7 @@ gtk_private_h_sources =		\
 	gtkselectionprivate.h	\
 	gtksettingsprivate.h	\
 	gtksizegroup-private.h	\
+	gtksizerequestcacheprivate.h	\
 	gtksocketprivate.h	\
 	gtkstyleanimationprivate.h \
 	gtkstylecascadeprivate.h \
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index e77ecd6..8404bd6 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -27,6 +27,7 @@
 #include "gtkintl.h"
 #include "gtkprivate.h"
 #include "gtksizegroup-private.h"
+#include "gtksizerequestcacheprivate.h"
 #include "gtkwidgetprivate.h"
 #include "deprecated/gtkstyle.h"
 
diff --git a/gtk/gtksizerequestcacheprivate.h b/gtk/gtksizerequestcacheprivate.h
new file mode 100644
index 0000000..143d2b0
--- /dev/null
+++ b/gtk/gtksizerequestcacheprivate.h
@@ -0,0 +1,69 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
+ * file for a list of people on the GTK+ Team.  See the ChangeLog
+ * files for a list of changes.  These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#ifndef __GTK_SIZE_REQUEST_CACHE_PRIVATE_H__
+#define __GTK_SIZE_REQUEST_CACHE_PRIVATE_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+/* Cache as many ranges of height-for-width
+ * (or width-for-height) as can be rational
+ * for a said widget to have, if a label can
+ * only wrap to 3 lines, only 3 caches will
+ * ever be allocated for it.
+ */
+#define GTK_SIZE_REQUEST_CACHED_SIZES   (5)
+
+typedef struct {
+  gint minimum_size;
+  gint natural_size;
+} CachedSize;
+
+typedef struct
+{
+  gint       lower_for_size; /* The minimum for_size with the same result */
+  gint       upper_for_size; /* The maximum for_size with the same result */
+  CachedSize cached_size;
+} SizeRequest;
+
+typedef struct {
+  SizeRequest **widths;
+  SizeRequest **heights;
+
+  CachedSize  cached_width;
+  CachedSize  cached_height;
+
+  guint       cached_widths      : 3;
+  guint       cached_heights     : 3;
+  guint       last_cached_width  : 3;
+  guint       last_cached_height : 3;
+  guint       cached_base_width  : 1;
+  guint       cached_base_height : 1;
+} SizeRequestCache;
+
+G_END_DECLS
+
+#endif /* __GTK_SIZE_REQUEST_CACHE_PRIVATE_H__ */
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index eb82eb8..27353b9 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -41,6 +41,7 @@
 #include "gtkselectionprivate.h"
 #include "gtksettingsprivate.h"
 #include "gtksizegroup-private.h"
+#include "gtksizerequestcacheprivate.h"
 #include "gtkwidget.h"
 #include "gtkwidgetprivate.h"
 #include "gtkwindowprivate.h"
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 3ebd8eb..06ba4af 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -31,41 +31,6 @@
 
 G_BEGIN_DECLS
 
-/* Cache as many ranges of height-for-width
- * (or width-for-height) as can be rational
- * for a said widget to have, if a label can
- * only wrap to 3 lines, only 3 caches will
- * ever be allocated for it.
- */
-#define GTK_SIZE_REQUEST_CACHED_SIZES   (5)
-
-typedef struct {
-  gint minimum_size;
-  gint natural_size;
-} CachedSize;
-
-typedef struct
-{
-  gint       lower_for_size; /* The minimum for_size with the same result */
-  gint       upper_for_size; /* The maximum for_size with the same result */
-  CachedSize cached_size;
-} SizeRequest;
-
-typedef struct {
-  SizeRequest **widths;
-  SizeRequest **heights;
-
-  CachedSize  cached_width;
-  CachedSize  cached_height;
-
-  guint       cached_widths      : 3;
-  guint       cached_heights     : 3;
-  guint       last_cached_width  : 3;
-  guint       last_cached_height : 3;
-  guint       cached_base_width  : 1;
-  guint       cached_base_height : 1;
-} SizeRequestCache;
-
 void         _gtk_widget_set_visible_flag   (GtkWidget *widget,
                                              gboolean   visible);
 gboolean     _gtk_widget_get_in_reparent    (GtkWidget *widget);



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