[gtk] sizerequest: Remove _gtk_widget_get_preferred_size_and_baseline
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] sizerequest: Remove _gtk_widget_get_preferred_size_and_baseline
- Date: Tue, 7 Jan 2020 16:42:50 +0000 (UTC)
commit 8e4f0b94843dc07c04dae5eaf23fad154b1256a6
Author: Timm Bäder <mail baedert org>
Date: Mon Jan 6 10:22:54 2020 +0100
sizerequest: Remove _gtk_widget_get_preferred_size_and_baseline
Private and unused function.
gtk/gtksizerequest.c | 85 ++++++++++++++++----------------------------------
gtk/gtkwidgetprivate.h | 6 ----
2 files changed, 27 insertions(+), 64 deletions(-)
---
diff --git a/gtk/gtksizerequest.c b/gtk/gtksizerequest.c
index a3f52620a8..82621700a9 100644
--- a/gtk/gtksizerequest.c
+++ b/gtk/gtksizerequest.c
@@ -580,15 +580,14 @@ gtk_widget_get_request_mode (GtkWidget *widget)
return cache->request_mode;
}
-/*
- * _gtk_widget_get_preferred_size_and_baseline:
+/**
+ * gtk_widget_get_preferred_size:
* @widget: a #GtkWidget instance
* @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
* @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
*
- * Retrieves the minimum and natural size and the corresponding baselines of a widget, taking
- * into account the widget’s preference for height-for-width management. The baselines may
- * be -1 which means that no baseline is requested for this widget.
+ * Retrieves the minimum and natural size of a widget, taking
+ * into account the widget’s preference for height-for-width management.
*
* This is used to retrieve a suitable size by container widgets which do
* not impose any restrictions on the child placement. It can be used
@@ -599,16 +598,17 @@ gtk_widget_get_request_mode (GtkWidget *widget)
* widget will generally be a smaller size than the minimum height, since the required
* height for the natural width is generally smaller than the required height for
* the minimum width.
+ *
+ * Use gtk_widget_measure() if you want to support
+ * baseline alignment.
*/
void
-_gtk_widget_get_preferred_size_and_baseline (GtkWidget *widget,
- GtkRequisition *minimum_size,
- GtkRequisition *natural_size,
- gint *minimum_baseline,
- gint *natural_baseline)
+gtk_widget_get_preferred_size (GtkWidget *widget,
+ GtkRequisition *minimum_size,
+ GtkRequisition *natural_size)
{
- gint min_width, nat_width;
- gint min_height, nat_height;
+ int min_width, nat_width;
+ int min_height, nat_height;
g_return_if_fail (GTK_IS_WIDGET (widget));
@@ -618,73 +618,42 @@ _gtk_widget_get_preferred_size_and_baseline (GtkWidget *widget,
&min_width, &nat_width, NULL, NULL);
if (minimum_size)
- {
- minimum_size->width = min_width;
+ {
+ minimum_size->width = min_width;
gtk_widget_measure (widget,
GTK_ORIENTATION_VERTICAL, min_width,
- &minimum_size->height, NULL, minimum_baseline, NULL);
- }
+ &minimum_size->height, NULL, NULL, NULL);
+ }
if (natural_size)
- {
- natural_size->width = nat_width;
+ {
+ natural_size->width = nat_width;
gtk_widget_measure (widget,
GTK_ORIENTATION_VERTICAL, nat_width,
- NULL, &natural_size->height, NULL, natural_baseline);
- }
+ NULL, &natural_size->height, NULL, NULL);
+ }
}
else /* GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT or CONSTANT_SIZE */
{
gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL,
- -1, &min_height, &nat_height, minimum_baseline, natural_baseline);
+ -1, &min_height, &nat_height, NULL, NULL);
if (minimum_size)
- {
- minimum_size->height = min_height;
+ {
+ minimum_size->height = min_height;
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, min_height,
&minimum_size->width, NULL, NULL, NULL);
- }
+ }
if (natural_size)
- {
- natural_size->height = nat_height;
+ {
+ natural_size->height = nat_height;
gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, nat_height,
NULL, &natural_size->width, NULL, NULL);
- }
+ }
}
}
-/**
- * gtk_widget_get_preferred_size:
- * @widget: a #GtkWidget instance
- * @minimum_size: (out) (allow-none): location for storing the minimum size, or %NULL
- * @natural_size: (out) (allow-none): location for storing the natural size, or %NULL
- *
- * Retrieves the minimum and natural size of a widget, taking
- * into account the widget’s preference for height-for-width management.
- *
- * This is used to retrieve a suitable size by container widgets which do
- * not impose any restrictions on the child placement. It can be used
- * to deduce toplevel window and menu sizes as well as child widgets in
- * free-form containers such as GtkLayout.
- *
- * Handle with care. Note that the natural height of a height-for-width
- * widget will generally be a smaller size than the minimum height, since the required
- * height for the natural width is generally smaller than the required height for
- * the minimum width.
- *
- * Use gtk_widget_measure() if you want to support
- * baseline alignment.
- */
-void
-gtk_widget_get_preferred_size (GtkWidget *widget,
- GtkRequisition *minimum_size,
- GtkRequisition *natural_size)
-{
- _gtk_widget_get_preferred_size_and_baseline (widget, minimum_size, natural_size,
- NULL, NULL);
-}
-
static gint
compare_gap (gconstpointer p1,
gconstpointer p2,
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 68595f7aa9..a9c2233169 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -236,12 +236,6 @@ void _gtk_widget_add_attached_window (GtkWidget *widget,
void _gtk_widget_remove_attached_window (GtkWidget *widget,
GtkWindow *window);
-void _gtk_widget_get_preferred_size_and_baseline(GtkWidget *widget,
- GtkRequisition *minimum_size,
- GtkRequisition *natural_size,
- gint *minimum_baseline,
- gint *natural_baseline);
-
const gchar* _gtk_widget_get_accel_path (GtkWidget *widget,
gboolean *locked);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]