Compare commits

...

5 Commits

Author SHA1 Message Date
Benjamin Otte
b4960eed8a widget: Store category of widget transform
And pass that category through to the transform node that we create for
it.
2019-02-19 08:25:54 +01:00
Benjamin Otte
80be6ec08d widget: Make gtk_widget_allocate() take a GtkMatrix
We can reason about GtkMatrix way better - and determine its category or
do equality checks.
2019-02-19 08:25:54 +01:00
Benjamin Otte
e0d23240d8 gtk: Add GtkMatrix
This is a new object (well, boxed type, but I'm calling it object) for
dealing with matrices in a more constructive way than graphene_matrix_t
by keeping track of how the matrix was created.

This way, reasoning about the matrix becomes easier, and we can create
better ways to print it or transition from one matrix to another one.

An example of this is that while a 0 degree and a 360degree rotation are
both the identity matrix, doing a transition between the two would cause
a rotation.
2019-02-19 08:25:54 +01:00
Benjamin Otte
8dc108a2a6 gsk: Add GskMatrixCategory
We'll use that soon.
2019-02-19 08:25:54 +01:00
Benjamin Otte
cd3a905d89 widget: Remove gtk_widget_get_allocated_size()
Use gtk_widget_get_allocated_width/height in the only user (GtkStack),
even though that isn't 100% correct.
2019-02-19 08:25:54 +01:00
15 changed files with 1387 additions and 77 deletions

View File

@@ -2387,6 +2387,7 @@ struct _GskTransformNode
GskRenderNode *child;
graphene_matrix_t transform;
GskMatrixCategory category;
};
static void
@@ -2422,7 +2423,7 @@ gsk_transform_node_draw (GskRenderNode *node,
}
}
#define GSK_TRANSFORM_NODE_VARIANT_TYPE "(dddddddddddddddduv)"
#define GSK_TRANSFORM_NODE_VARIANT_TYPE "(idddddddddddddddduv)"
static GVariant *
gsk_transform_node_serialize (GskRenderNode *node)
@@ -2433,6 +2434,7 @@ gsk_transform_node_serialize (GskRenderNode *node)
graphene_matrix_to_float (&self->transform, mat);
return g_variant_new (GSK_TRANSFORM_NODE_VARIANT_TYPE,
self->category,
(double) mat[0], (double) mat[1], (double) mat[2], (double) mat[3],
(double) mat[4], (double) mat[5], (double) mat[6], (double) mat[7],
(double) mat[8], (double) mat[9], (double) mat[10], (double) mat[11],
@@ -2448,6 +2450,7 @@ gsk_transform_node_deserialize (GVariant *variant,
graphene_matrix_t transform;
double mat[16];
guint32 child_type;
gint32 category;
GVariant *child_variant;
GskRenderNode *result, *child;
@@ -2455,6 +2458,7 @@ gsk_transform_node_deserialize (GVariant *variant,
return NULL;
g_variant_get (variant, GSK_TRANSFORM_NODE_VARIANT_TYPE,
&category,
&mat[0], &mat[1], &mat[2], &mat[3],
&mat[4], &mat[5], &mat[6], &mat[7],
&mat[8], &mat[9], &mat[10], &mat[11],
@@ -2475,7 +2479,7 @@ gsk_transform_node_deserialize (GVariant *variant,
mat[12], mat[13], mat[14], mat[15]
});
result = gsk_transform_node_new (child, &transform);
result = gsk_transform_node_new_with_category (child, &transform, category);
gsk_render_node_unref (child);
@@ -2508,15 +2512,39 @@ GskRenderNode *
gsk_transform_node_new (GskRenderNode *child,
const graphene_matrix_t *transform)
{
GskTransformNode *self;
g_return_val_if_fail (GSK_IS_RENDER_NODE (child), NULL);
g_return_val_if_fail (transform != NULL, NULL);
return gsk_transform_node_new_with_category (child, transform, GSK_MATRIX_CATEGORY_UNKNOWN);
}
/*<private>
* gsk_transform_node_new_with_category:
* @child: The node to transform
* @transform: The transform to apply
* @category: The category @transform belongs to
*
* Creates a #GskRenderNode that will transform the given @child
* with the given @transform.
*
* The given @category will be used by renderers for optimizations and must
* be correct. If you do not know the category of @transform, use
* %GSK_MATRIX_CATEGORY_UNKNOWN.
*
* Returns: A new #GskRenderNode
**/
GskRenderNode *
gsk_transform_node_new_with_category (GskRenderNode *child,
const graphene_matrix_t *transform,
GskMatrixCategory category)
{
GskTransformNode *self;
self = (GskTransformNode *) gsk_render_node_new (&GSK_TRANSFORM_NODE_CLASS, 0);
self->child = gsk_render_node_ref (child);
graphene_matrix_init_from_matrix (&self->transform, transform);
self->category = category;
graphene_matrix_transform_bounds (&self->transform,
&child->bounds,
@@ -2552,6 +2580,16 @@ gsk_transform_node_peek_transform (GskRenderNode *node)
return &self->transform;
}
GskMatrixCategory
gsk_transform_node_get_category (GskRenderNode *node)
{
GskTransformNode *self = (GskTransformNode *) node;
g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_TRANSFORM_NODE), GSK_MATRIX_CATEGORY_UNKNOWN);
return self->category;
}
/*** GSK_OFFSET_NODE ***/
typedef struct _GskOffsetNode GskOffsetNode;

View File

@@ -6,6 +6,44 @@
G_BEGIN_DECLS
/*<private>
* GskMatrixCategory:
* @GSK_MATRIX_CATEGORY_UNKNOWN: The category of the matrix has not been
* determined.
* @GSK_MATRIX_CATEGORY_ANY: Analyzing the matrix concluded that it does
* not fit in any other category.
* @GSK_MATRIX_CATEGORY_LINEAR: The matrix is linear independant and
* should therefor be invertible. Note that this is not guaranteed
* to actually be true due to rounding errors when inverting.
* @GSK_MATRIX_CATEGORY_2D: The matrix is a 2D matrix. This is equivalent
* to graphene_matrix_is_2d() returning %TRUE. In particular, this
* means that Cairo can deal with the matrix.
* @GSK_MATRIX_CATEGORY_2D_SCALE: The matrix is a combination of 2D scale
* and 2D translation operations. In particular, this means that any
* rectangle can be transformed exactly using this matrix.
* @GSK_MATRIX_CATEGORY_2D_TRANSLATE: The matrix is a 2D translation only.
* @GSK_MATRIX_CATEGORY_IDENTITY: The matrix is the identity matrix.
*
* The categories of matrices relevant for GSK and GTK. Note that any
* category includes matrices of all later categories. So if you want
* to for example check if a matrix is a 2D matrix,
* `category >= GSK_MATRIX_CATEGORY_2D` is the way to do this.
*
* Also keep in mind that rounding errors may cause matrices to not
* conform to their categories. Otherwise, matrix operations done via
* mutliplication will not worsen categories. So for the matrix
* multiplication `C = A * B`, `category(C) = MIN (category(A), category(B))`.
*/
typedef enum
{
GSK_MATRIX_CATEGORY_UNKNOWN,
GSK_MATRIX_CATEGORY_DEGENERATE,
GSK_MATRIX_CATEGORY_LINEAR,
GSK_MATRIX_CATEGORY_2D_SCALE,
GSK_MATRIX_CATEGORY_2D_TRANSLATE,
GSK_MATRIX_CATEGORY_IDENTITY
} GskMatrixCategory;
typedef struct _GskRenderNodeClass GskRenderNodeClass;
#define GSK_IS_RENDER_NODE_TYPE(node,type) (GSK_IS_RENDER_NODE (node) && (node)->node_class->node_type == (type))
@@ -58,6 +96,11 @@ GskRenderNode * gsk_render_node_deserialize_node (GskRenderNodeType typ
GskRenderNode * gsk_cairo_node_new_for_surface (const graphene_rect_t *bounds,
cairo_surface_t *surface);
GskRenderNode * gsk_transform_node_new_with_category (GskRenderNode *child,
const graphene_matrix_t *transform,
GskMatrixCategory category);
GskMatrixCategory gsk_transform_node_get_category (GskRenderNode *node);
GskRenderNode * gsk_text_node_new_with_bounds (PangoFont *font,
PangoGlyphString *glyphs,
const GdkRGBA *color,

View File

@@ -140,6 +140,7 @@
#include <gtk/gtkliststore.h>
#include <gtk/gtklockbutton.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkmatrix.h>
#include <gtk/gtkmaplistmodel.h>
#include <gtk/gtkmediacontrols.h>
#include <gtk/gtkmediafile.h>

1086
gtk/gtkmatrix.c Normal file

File diff suppressed because it is too large Load Diff

105
gtk/gtkmatrix.h Normal file
View File

@@ -0,0 +1,105 @@
/*
* Copyright © 2019 Benjamin Otte
*
* 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.1 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/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#ifndef __GTK_MATRIX_H__
#define __GTK_MATRIX_H__
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif
#include <graphene.h>
#include <gtk/gtktypes.h>
G_BEGIN_DECLS
#define GTK_TYPE_MATRIX (gtk_matrix_get_type ())
typedef enum
{
GTK_MATRIX_TYPE_IDENTITY,
GTK_MATRIX_TYPE_TRANSFORM,
GTK_MATRIX_TYPE_TRANSLATE,
GTK_MATRIX_TYPE_ROTATE,
GTK_MATRIX_TYPE_SCALE
} GtkMatrixType;
GDK_AVAILABLE_IN_ALL
GType gtk_matrix_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_ref (GtkMatrix *self);
GDK_AVAILABLE_IN_ALL
void gtk_matrix_unref (GtkMatrix *self);
GDK_AVAILABLE_IN_ALL
void gtk_matrix_print (GtkMatrix *self,
GString *string);
GDK_AVAILABLE_IN_ALL
char * gtk_matrix_to_string (GtkMatrix *self);
GDK_AVAILABLE_IN_ALL
void gtk_matrix_compute (GtkMatrix *self,
graphene_matrix_t *out_matrix);
GDK_AVAILABLE_IN_ALL
gboolean gtk_matrix_equal (GtkMatrix *first,
GtkMatrix *second) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_transition (GtkMatrix *from,
GtkMatrix *to,
double progress);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_get_identity (void) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_identity (GtkMatrix *next);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_transform (GtkMatrix *next,
const graphene_matrix_t *matrix);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_translate (GtkMatrix *next,
const graphene_point_t *point);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_translate_3d (GtkMatrix *next,
const graphene_point3d_t *point);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_rotate (GtkMatrix *next,
float angle);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_rotate_3d (GtkMatrix *next,
float angle,
const graphene_vec3_t *axis);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_scale (GtkMatrix *next,
float factor_x,
float factor_y);
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_scale_3d (GtkMatrix *next,
float factor_x,
float factor_y,
float factor_z);
GDK_AVAILABLE_IN_ALL
GtkMatrixType gtk_matrix_get_matrix_type (GtkMatrix *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_ALL
GtkMatrix * gtk_matrix_get_next (GtkMatrix *self) G_GNUC_PURE;
G_END_DECLS
#endif /* __GTK_MATRIX_H__ */

36
gtk/gtkmatrixprivate.h Normal file
View File

@@ -0,0 +1,36 @@
/*
* Copyright © 2019 Benjamin Otte
*
* 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.1 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/>.
*
* Authors: Benjamin Otte <otte@gnome.org>
*/
#ifndef __GTK_MATRIX_PRIVATE_H__
#define __GTK_MATRIX_PRIVATE_H__
#include "gtkmatrix.h"
#include <gsk/gsk.h>
#include "gsk/gskrendernodeprivate.h"
G_BEGIN_DECLS
GskMatrixCategory gtk_matrix_categorize (GtkMatrix *self);
G_END_DECLS
#endif /* __GTK_MATRIX_PRIVATE_H__ */

View File

@@ -296,7 +296,9 @@ gtk_snapshot_collect_transform (GtkSnapshot *snapshot,
if (node == NULL)
return NULL;
transform_node = gsk_transform_node_new (node, &state->data.transform.transform);
transform_node = gsk_transform_node_new_with_category (node,
&state->data.transform.transform,
state->data.transform.category);
gsk_render_node_unref (node);
@@ -306,6 +308,16 @@ gtk_snapshot_collect_transform (GtkSnapshot *snapshot,
void
gtk_snapshot_push_transform (GtkSnapshot *snapshot,
const graphene_matrix_t *transform)
{
gtk_snapshot_push_transform_with_category (snapshot,
transform,
GSK_MATRIX_CATEGORY_UNKNOWN);
}
void
gtk_snapshot_push_transform_with_category (GtkSnapshot *snapshot,
const graphene_matrix_t *transform,
GskMatrixCategory category)
{
GtkSnapshotState *previous_state;
GtkSnapshotState *state;
@@ -325,6 +337,10 @@ gtk_snapshot_push_transform (GtkSnapshot *snapshot,
));
graphene_matrix_multiply (transform, &offset, &state->data.transform.transform);
if (previous_state->translate_x || previous_state->translate_y)
state->data.transform.category = MIN (GSK_MATRIX_CATEGORY_2D_TRANSLATE, category);
else
state->data.transform.category = category;
}
static GskRenderNode *

View File

@@ -20,6 +20,8 @@
#include "gtksnapshot.h"
#include "gsk/gskrendernodeprivate.h"
G_BEGIN_DECLS
typedef struct _GtkSnapshotState GtkSnapshotState;
@@ -40,6 +42,7 @@ struct _GtkSnapshotState {
union {
struct {
graphene_matrix_t transform;
GskMatrixCategory category;
} transform;
struct {
double opacity;
@@ -103,6 +106,9 @@ void gtk_snapshot_append_node_internal (GtkSnapshot
GtkSnapshot * gtk_snapshot_new_with_parent (GtkSnapshot *parent_snapshot);
void gtk_snapshot_push_transform_with_category (GtkSnapshot *snapshot,
const graphene_matrix_t*transform,
GskMatrixCategory category);
G_END_DECLS
#endif /* __GTK_SNAPSHOT_PRIVATE_H__ */

View File

@@ -1195,12 +1195,9 @@ set_visible_child (GtkStack *stack,
{
if (gtk_widget_is_visible (widget))
{
GtkAllocation allocation;
priv->last_visible_child = priv->visible_child;
gtk_widget_get_allocated_size (priv->last_visible_child->widget, &allocation, NULL);
priv->last_visible_widget_width = allocation.width;
priv->last_visible_widget_height = allocation.height;
priv->last_visible_widget_width = gtk_widget_get_allocated_width (priv->last_visible_child->widget);
priv->last_visible_widget_height = gtk_widget_get_allocated_height (priv->last_visible_child->widget);
}
else
{

View File

@@ -38,6 +38,7 @@ typedef struct _GtkBuilder GtkBuilder;
typedef struct _GtkClipboard GtkClipboard;
typedef struct _GtkEventController GtkEventController;
typedef struct _GtkGesture GtkGesture;
typedef struct _GtkMatrix GtkMatrix;
typedef struct _GtkRequisition GtkRequisition;
typedef struct _GtkRoot GtkRoot;
typedef struct _GtkSelectionData GtkSelectionData;

View File

@@ -47,8 +47,9 @@
#include "gtkgesturesingle.h"
#include "gtkgestureswipe.h"
#include "gtkintl.h"
#include "gtkmarshalers.h"
#include "gtkmain.h"
#include "gtkmarshalers.h"
#include "gtkmatrixprivate.h"
#include "gtkmenu.h"
#include "gtkpopover.h"
#include "gtkprivate.h"
@@ -4152,15 +4153,20 @@ gtk_widget_size_allocate (GtkWidget *widget,
const GtkAllocation *allocation,
int baseline)
{
graphene_matrix_t transform;
GtkMatrix *transform;
if (allocation->x || allocation->y)
transform = gtk_matrix_translate (NULL, &GRAPHENE_POINT_INIT (allocation->x, allocation->y));
else
transform = NULL;
graphene_matrix_init_translate (&transform,
&GRAPHENE_POINT3D_INIT (allocation->x, allocation->y, 0));
gtk_widget_allocate (widget,
allocation->width,
allocation->height,
baseline,
&transform);
transform);
gtk_matrix_unref (transform);
}
/**
@@ -4169,7 +4175,7 @@ gtk_widget_size_allocate (GtkWidget *widget,
* @width: New width of @widget
* @height: New height of @widget
* @baseline: New baseline of @widget, or -1
* @transform: Transformation to be applied to @widget
* @transform: (tranisfer none): Transformation to be applied to @widget
*
* This function is only used by #GtkWidget subclasses, to assign a size,
* position and (optionally) baseline to their child widgets.
@@ -4181,11 +4187,11 @@ gtk_widget_size_allocate (GtkWidget *widget,
* For a version that does not take a transform, see gtk_widget_size_allocate()
*/
void
gtk_widget_allocate (GtkWidget *widget,
int width,
int height,
int baseline,
const graphene_matrix_t *transform)
gtk_widget_allocate (GtkWidget *widget,
int width,
int height,
int baseline,
GtkMatrix *transform)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
GdkRectangle adjusted;
@@ -4197,11 +4203,13 @@ gtk_widget_allocate (GtkWidget *widget,
gint min_width, min_height;
GtkCssStyle *style;
GtkBorder margin, border, padding;
graphene_matrix_t computed;
#ifdef G_ENABLE_DEBUG
GdkDisplay *display;
#endif
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (baseline >= -1);
g_return_if_fail (transform != NULL);
gtk_widget_push_verify_invariants (widget);
@@ -4231,11 +4239,11 @@ gtk_widget_allocate (GtkWidget *widget,
baseline_changed = priv->allocated_size_baseline != baseline;
size_changed = (priv->allocated_width != width ||
priv->allocated_height != height);
transform_changed = memcmp (&priv->allocated_transform,
transform,
sizeof (graphene_matrix_t)) != 0;
transform_changed = !gtk_matrix_equal (priv->allocated_transform, transform);
graphene_matrix_init_from_matrix (&priv->allocated_transform, transform);
gtk_matrix_ref (transform);
gtk_matrix_unref (priv->allocated_transform);
priv->allocated_transform = transform;
priv->allocated_width = width;
priv->allocated_height = height;
priv->allocated_size_baseline = baseline;
@@ -4325,7 +4333,11 @@ gtk_widget_allocate (GtkWidget *widget,
baseline -= margin.top + border.top + padding.top;
graphene_matrix_init_translate (&priv->transform, &GRAPHENE_POINT3D_INIT (adjusted.x, adjusted.y, 0));
graphene_matrix_multiply (&priv->transform, transform, &priv->transform);
gtk_matrix_compute (transform, &computed);
graphene_matrix_multiply (&priv->transform, &computed, &priv->transform);
priv->transform_category = gtk_matrix_categorize (transform);
if (adjusted.x || adjusted.y)
priv->transform_category = MIN (priv->transform_category, GSK_MATRIX_CATEGORY_2D_TRANSLATE);
if (!alloc_needed && !size_changed && !baseline_changed)
{
@@ -6229,7 +6241,7 @@ _gtk_widget_set_visible_flag (GtkWidget *widget,
if (!visible)
{
graphene_matrix_init_identity (&priv->allocated_transform);
g_clear_pointer (&priv->allocated_transform, gtk_matrix_unref);
priv->allocated_width = 0;
priv->allocated_height = 0;
priv->allocated_size_baseline = 0;
@@ -11131,41 +11143,6 @@ gtk_widget_get_has_tooltip (GtkWidget *widget)
return priv->has_tooltip;
}
/**
* gtk_widget_get_allocated_size:
* @widget: a #GtkWidget
* @allocation: (out): a pointer to a #GtkAllocation to copy to
* @baseline: (out) (allow-none): a pointer to an integer to copy to
*
* Retrieves the widgets allocated size.
*
* This function returns the last values passed to
* gtk_widget_size_allocate(). The value differs from
* the size returned in gtk_widget_get_allocation() in that functions
* like gtk_widget_set_halign() can adjust the allocation, but not
* the value returned by this function.
*
* If a widget is not visible, its allocated size is 0.
*/
void
gtk_widget_get_allocated_size (GtkWidget *widget,
GtkAllocation *allocation,
int *baseline)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (allocation != NULL);
allocation->x = graphene_matrix_get_value (&priv->allocated_transform, 3, 0);
allocation->y = graphene_matrix_get_value (&priv->allocated_transform, 3, 1);
allocation->width = priv->allocated_width;
allocation->height = priv->allocated_height;
if (baseline)
*baseline = priv->allocated_size_baseline;
}
/**
* gtk_widget_get_allocation:
* @widget: a #GtkWidget
@@ -11907,7 +11884,7 @@ gtk_widget_ensure_allocate (GtkWidget *widget)
priv->allocated_width,
priv->allocated_height,
priv->allocated_size_baseline,
&priv->allocated_transform);
priv->allocated_transform);
}
else if (priv->alloc_needed_on_child)
{
@@ -13479,20 +13456,15 @@ gtk_widget_snapshot_child (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (child);
gboolean needs_transform;
g_return_if_fail (_gtk_widget_get_parent (child) == widget);
g_return_if_fail (snapshot != NULL);
needs_transform = !graphene_matrix_is_identity (&priv->transform);
if (needs_transform)
gtk_snapshot_push_transform (snapshot, &priv->transform);
gtk_snapshot_push_transform_with_category (snapshot, &priv->transform, priv->transform_category);
gtk_widget_snapshot (child, snapshot);
if (needs_transform)
gtk_snapshot_pop (snapshot);
gtk_snapshot_pop (snapshot);
}
/**

View File

@@ -416,7 +416,7 @@ void gtk_widget_allocate (GtkWidget *widget,
int width,
int height,
int baseline,
const graphene_matrix_t *transform);
GtkMatrix *transform);
GDK_AVAILABLE_IN_ALL
GtkSizeRequestMode gtk_widget_get_request_mode (GtkWidget *widget);
@@ -605,10 +605,6 @@ GDK_AVAILABLE_IN_ALL
int gtk_widget_get_allocated_height (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
int gtk_widget_get_allocated_baseline (GtkWidget *widget);
GDK_AVAILABLE_IN_ALL
void gtk_widget_get_allocated_size (GtkWidget *widget,
GtkAllocation *allocation,
int *baseline);
GDK_AVAILABLE_IN_ALL
void gtk_widget_get_allocation (GtkWidget *widget,

View File

@@ -38,6 +38,8 @@
#include "gtkinvisibleprivate.h"
#include "gtkgesture.h"
#include "gsk/gskrendernodeprivate.h"
G_BEGIN_DECLS
#define GTK_STATE_FLAGS_BITS 14
@@ -144,12 +146,13 @@ struct _GtkWidgetPrivate
GtkStyleContext *context;
/* The widget's allocated size */
graphene_matrix_t allocated_transform;
GtkMatrix *allocated_transform;
int allocated_width;
int allocated_height;
gint allocated_size_baseline;
graphene_matrix_t transform;
GskMatrixCategory transform_category;
int width;
int height;
int baseline;

View File

@@ -901,6 +901,14 @@ populate_render_node_properties (GtkListStore *store,
case GSK_TRANSFORM_NODE:
{
static const char * category_names[] = {
[GSK_MATRIX_CATEGORY_UNKNOWN] = "unknown",
[GSK_MATRIX_CATEGORY_DEGENERATE] = "degenerate",
[GSK_MATRIX_CATEGORY_LINEAR] = "linear",
[GSK_MATRIX_CATEGORY_2D_SCALE] = "2D scale",
[GSK_MATRIX_CATEGORY_2D_TRANSLATE] = "2D transform",
[GSK_MATRIX_CATEGORY_IDENTITY] = "identity"
};
float f[16];
guint i;
@@ -913,6 +921,7 @@ populate_render_node_properties (GtkListStore *store,
add_text_row (store, i == 0 ? "Matrix" : "", row_string);
g_free (row_string);
}
add_text_row (store, "Category", category_names[gsk_transform_node_get_category (node)]);
}
break;

View File

@@ -117,6 +117,7 @@ gtk_private_sources = files([
'gtkkineticscrolling.c',
'gtkkeyhash.c',
'gtkmagnifier.c',
'gtkmatrix.c',
'gtkmenusectionbox.c',
'gtkmenutracker.c',
'gtkmenutrackeritem.c',