Commit 51a1bc21 authored by Benjamin Otte's avatar Benjamin Otte

Revert "Avoid type checking overhead for resize-mode"

This reverts commit 3eacfa88.

Apart from the patch not being correct, we don't want to expose private
structures in header files if we can avoid it.
And this type-checking overhead is not an optimization that is even
measurable.

https://bugzilla.gnome.org/show_bug.cgi?id=754932
parent 286e8eec
......@@ -251,6 +251,25 @@
*
*/
struct _GtkContainerPrivate
{
GtkWidget *focus_child;
GdkFrameClock *resize_clock;
guint resize_handler;
guint border_width : 16;
guint border_width_set : 1;
guint has_focus_chain : 1;
guint reallocate_redraws : 1;
guint resize_pending : 1;
guint restyle_pending : 1;
guint resize_mode : 2;
guint request_mode : 2;
};
enum {
ADD,
REMOVE,
......@@ -2052,7 +2071,7 @@ gtk_container_queue_resize_handler (GtkContainer *container)
GtkWidget *widget;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
g_return_if_fail (_GTK_IS_RESIZE_CONTAINER (container));
g_return_if_fail (GTK_IS_RESIZE_CONTAINER (container));
G_GNUC_END_IGNORE_DEPRECATIONS;
widget = GTK_WIDGET (container);
......@@ -2097,7 +2116,7 @@ _gtk_container_queue_resize_internal (GtkContainer *container,
_gtk_size_request_cache_clear (_gtk_widget_peek_request_cache (widget));
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (_GTK_IS_RESIZE_CONTAINER (container))
if (((GtkContainer*)widget)->priv->resize_mode != GTK_RESIZE_PARENT)
break;
G_GNUC_END_IGNORE_DEPRECATIONS;
......@@ -2185,7 +2204,7 @@ gtk_container_real_check_resize (GtkContainer *container)
requisition.height > allocation.height)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (_GTK_IS_RESIZE_CONTAINER (container))
if (GTK_IS_RESIZE_CONTAINER (container))
{
gtk_widget_size_allocate (widget, &allocation);
gtk_widget_set_allocation (widget, &allocation);
......
......@@ -24,24 +24,6 @@
G_BEGIN_DECLS
struct _GtkContainerPrivate
{
GtkWidget *focus_child;
GdkFrameClock *resize_clock;
guint resize_handler;
guint border_width : 16;
guint border_width_set : 1;
guint has_focus_chain : 1;
guint reallocate_redraws : 1;
guint resize_pending : 1;
guint restyle_pending : 1;
guint resize_mode : 2;
guint request_mode : 2;
};
void _gtk_container_queue_resize (GtkContainer *container);
void _gtk_container_queue_restyle (GtkContainer *container);
......@@ -62,16 +44,6 @@ gboolean _gtk_container_get_border_width_set (GtkContainer *container);
void _gtk_container_set_border_width_set (GtkContainer *container,
gboolean border_width_set);
static inline GtkResizeMode _gtk_container_get_resize_mode (GtkContainer *container);
static inline GtkResizeMode
_gtk_container_get_resize_mode (GtkContainer *container)
{
return container->priv->resize_mode;
}
#define _GTK_IS_RESIZE_CONTAINER(container) (_gtk_container_get_resize_mode (GTK_CONTAINER (container)) != GTK_RESIZE_PARENT)
G_END_DECLS
#endif /* __GTK_CONTAINER_PRIVATE_H__ */
......@@ -101,7 +101,7 @@ gtk_css_widget_node_queue_validate (GtkCssNode *node)
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (_GTK_IS_RESIZE_CONTAINER (widget_node->widget))
if (GTK_IS_RESIZE_CONTAINER (widget_node->widget))
widget_node->validate_cb_id = gtk_widget_add_tick_callback (widget_node->widget,
gtk_css_widget_node_queue_callback,
node,
......@@ -115,7 +115,7 @@ gtk_css_widget_node_dequeue_validate (GtkCssNode *node)
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
if (_GTK_IS_RESIZE_CONTAINER (widget_node->widget))
if (GTK_IS_RESIZE_CONTAINER (widget_node->widget))
gtk_widget_remove_tick_callback (widget_node->widget,
widget_node->validate_cb_id);
G_GNUC_END_IGNORE_DEPRECATIONS
......
......@@ -17223,6 +17223,8 @@ _gtk_widget_add_controller (GtkWidget *widget,
EventControllerData *data;
GtkWidgetPrivate *priv;
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (GTK_IS_EVENT_CONTROLLER (controller));
g_return_if_fail (widget == gtk_event_controller_get_widget (controller));
priv = widget->priv;
......
......@@ -9444,7 +9444,7 @@ gtk_window_move_resize (GtkWindow *window)
gtk_widget_size_allocate (widget, &allocation);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (_gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
gtk_widget_queue_draw (widget);
G_GNUC_END_IGNORE_DEPRECATIONS;
}
......@@ -9471,7 +9471,7 @@ gtk_window_move_resize (GtkWindow *window)
* we handle those ourselves upon ->configure_notify_received==TRUE.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
if (_gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
if (gtk_container_get_resize_mode (container) == GTK_RESIZE_QUEUE)
{
gtk_widget_queue_resize_no_redraw (widget);
_gtk_container_dequeue_resize_handler (container);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment