summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-07-17 10:56:16 +0000
committerMatthias Clasen <mclasen@redhat.com>2020-07-17 10:56:16 +0000
commit8611faf3385fcc20b00b30284f94c00e890b4429 (patch)
treeca3af8e67143b9580cf4f6f54658742495c6d36e
parent9742200ff697a7ea63e07199fe2127585b740ad9 (diff)
parent7e19911d3f2c8a01e3843b713ed44dcf57e91e75 (diff)
downloadgtk+-8611faf3385fcc20b00b30284f94c00e890b4429.tar.gz
Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master Closes #2776 See merge request GNOME/gtk!2258
-rw-r--r--docs/reference/gtk/migrating-3to4.md2
-rw-r--r--gdk/gdkrgba.c2
-rw-r--r--gsk/gl/gskglrenderer.c302
-rw-r--r--gtk/gtkboxlayout.c20
-rw-r--r--gtk/gtkdebug.h9
-rw-r--r--gtk/gtkicontheme.c10
-rw-r--r--gtk/gtkmain.c1
-rw-r--r--gtk/gtksnapshot.c21
-rw-r--r--gtk/gtkwidget.c44
-rw-r--r--gtk/gtkwidgetprivate.h4
-rw-r--r--gtk/inspector/visual.c21
-rw-r--r--gtk/inspector/visual.ui30
-rw-r--r--gtk/theme/Adwaita/_common.scss24
-rw-r--r--tests/testwidgettransforms.c4
-rw-r--r--testsuite/gsk/compare/clip-nested1.node82
15 files changed, 254 insertions, 322 deletions
diff --git a/docs/reference/gtk/migrating-3to4.md b/docs/reference/gtk/migrating-3to4.md
index d78ed134e6..fb266bb87d 100644
--- a/docs/reference/gtk/migrating-3to4.md
+++ b/docs/reference/gtk/migrating-3to4.md
@@ -170,7 +170,7 @@ in GTK 3, you can prepare for the switch by using gtk_widget_destroy()
only on toplevel windows, and replace all other uses with
gtk_container_remove() or g_object_unref().
-### Reduce the use of generic container APIs</title>
+### Reduce the use of generic container APIs
GTK 4 removes gtk_container_add() and gtk_container_remove(). While there
is not always a replacement for gtk_container_remove() in GTK 3, you can
diff --git a/gdk/gdkrgba.c b/gdk/gdkrgba.c
index b8bd025d3b..4d6d46143c 100644
--- a/gdk/gdkrgba.c
+++ b/gdk/gdkrgba.c
@@ -354,7 +354,7 @@ gdk_rgba_equal (gconstpointer p1,
*
* Returns a textual specification of @rgba in the form
* `rgb(r,g,b)` or
- * `rgba(r g,b,a)`,
+ * `rgba(r,g,b,a)`,
* where “r”, “g”, “b” and “a” represent the red, green,
* blue and alpha values respectively. “r”, “g”, and “b” are
* represented as integers in the range 0 to 255, and “a”
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index 130971e7b9..9df466a248 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -70,7 +70,6 @@ typedef enum
RESET_CLIP = 1 << 1,
RESET_OPACITY = 1 << 2,
DUMP_FRAMEBUFFER = 1 << 3,
- CENTER_CHILD = 1 << 4,
NO_CACHE_PLZ = 1 << 5,
} OffscreenFlags;
@@ -906,6 +905,7 @@ upload_texture (GskGLRenderer *self,
}
else
{
+
out_region->texture_id =
gsk_gl_driver_get_texture_for_texture (self->gl_driver,
texture,
@@ -1152,6 +1152,59 @@ rounded_inner_rect_contains_rect (const GskRoundedRect *rounded,
return graphene_rect_contains_rect (&inner, rect);
}
+/* Current clip is NOT rounded but new one is definitely! */
+static inline bool
+intersect_rounded_rectilinear (const graphene_rect_t *non_rounded,
+ const GskRoundedRect *rounded,
+ GskRoundedRect *result)
+{
+ int n_corners = 0;
+ bool corners[4];
+
+ /* Intersects with top left corner? */
+ n_corners += corners[0] = rounded_rect_has_corner (rounded, 0) &&
+ graphene_rect_intersection (non_rounded,
+ &rounded_rect_corner (rounded, 0), NULL);
+ /* top right? */
+ n_corners += corners[1] = rounded_rect_has_corner (rounded, 1) &&
+ graphene_rect_intersection (non_rounded,
+ &rounded_rect_corner (rounded, 1), NULL);
+ /* bottom right? */
+ n_corners += corners[2] = rounded_rect_has_corner (rounded, 2) &&
+ graphene_rect_intersection (non_rounded,
+ &rounded_rect_corner (rounded, 2), NULL);
+ /* bottom left */
+ n_corners += corners[3] = rounded_rect_has_corner (rounded, 3) &&
+ graphene_rect_intersection (non_rounded,
+ &rounded_rect_corner (rounded, 3), NULL);
+
+ if (corners[0] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 0)))
+ return false;
+ if (corners[1] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 1)))
+ return false;
+ if (corners[2] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 2)))
+ return false;
+ if (corners[3] && !graphene_rect_contains_rect (non_rounded, &rounded_rect_corner (rounded, 3)))
+ return false;
+
+ /* We do intersect with at least one of the corners, but in such a way that the
+ * intersection between the two clips can still be represented by a single rounded
+ * rect in a trivial way. do that. */
+ graphene_rect_intersection (non_rounded, &rounded->bounds, &result->bounds);
+
+ for (int i = 0; i < 4; i++)
+ {
+ if (corners[i])
+ result->corner[i] = rounded->corner[i];
+ else
+ result->corner[i].width = result->corner[i].height = 0;
+ }
+
+ return true;
+}
+
+/* This code intersects the current (maybe rounded) clip with the new
+ * non-rounded clip */
static inline void
render_clipped_child (GskGLRenderer *self,
RenderOpBuilder *builder,
@@ -1159,112 +1212,57 @@ render_clipped_child (GskGLRenderer *self,
GskRenderNode *child)
{
graphene_rect_t transformed_clip;
- GskRoundedRect child_clip;
+ GskRoundedRect intersection;
ops_transform_bounds_modelview (builder, clip, &transformed_clip);
if (builder->clip_is_rectilinear)
- goto trivial;
-
- {
- const GskRoundedRect *cur_clip = builder->current_clip;
- int n_corners = 0;
- bool corners[4];
-
- /* Intersects with top left corner? */
- n_corners += corners[0] = rounded_rect_has_corner (cur_clip, 0) &&
- graphene_rect_intersection (&transformed_clip,
- &rounded_rect_corner (cur_clip, 0), NULL);
- /* top right? */
- n_corners += corners[1] = rounded_rect_has_corner (cur_clip, 1) &&
- graphene_rect_intersection (&transformed_clip,
- &rounded_rect_corner (cur_clip, 1), NULL);
- /* bottom right? */
- n_corners += corners[2] = rounded_rect_has_corner (cur_clip, 2) &&
- graphene_rect_intersection (&transformed_clip,
- &rounded_rect_corner (cur_clip, 2), NULL);
- /* bottom left */
- n_corners += corners[3] = rounded_rect_has_corner (cur_clip, 3) &&
- graphene_rect_intersection (&transformed_clip,
- &rounded_rect_corner (cur_clip, 3), NULL);
-
- if (n_corners == 0)
- goto trivial;
-
- if (corners[0] && !graphene_rect_contains_rect (&transformed_clip, &rounded_rect_corner (cur_clip, 0)))
- goto rtt;
- if (corners[1] && !graphene_rect_contains_rect (&transformed_clip, &rounded_rect_corner (cur_clip, 1)))
- goto rtt;
- if (corners[2] && !graphene_rect_contains_rect (&transformed_clip, &rounded_rect_corner (cur_clip, 2)))
- goto rtt;
- if (corners[3] && !graphene_rect_contains_rect (&transformed_clip, &rounded_rect_corner (cur_clip, 3)))
- goto rtt;
-
- /* We do intersect with at least one of the corners, but in such a way that the
- * intersection between the two clips can still be represented by a single rounded
- * rect in a trivial way. do that. */
- {
- GskRoundedRect real_intersection;
-
- graphene_rect_intersection (&transformed_clip, &cur_clip->bounds, &real_intersection.bounds);
-
- for (int i = 0; i < 4; i++)
- {
- if (corners[i])
- real_intersection.corner[i] = cur_clip->corner[i];
- else
- real_intersection.corner[i].width = real_intersection.corner[i].height = 0;
- }
+ {
+ memset (&intersection, 0, sizeof (GskRoundedRect));
+ graphene_rect_intersection (&transformed_clip,
+ &builder->current_clip->bounds,
+ &intersection.bounds);
- /* Draw with that new clip */
- ops_push_clip (builder, &real_intersection);
+ ops_push_clip (builder, &intersection);
gsk_gl_renderer_add_render_ops (self, child, builder);
ops_pop_clip (builder);
}
- return;
- }
-
-rtt:
- {
- /* well fuck */
- const float scale = ops_get_scale (builder);
- gboolean is_offscreen;
- TextureRegion region;
- GskRoundedRect scaled_clip;
-
- memset (&scaled_clip, 0, sizeof (GskRoundedRect));
-
- scaled_clip.bounds.origin.x = clip->origin.x * scale;
- scaled_clip.bounds.origin.y = clip->origin.y * scale;
- scaled_clip.bounds.size.width = clip->size.width * scale;
- scaled_clip.bounds.size.height = clip->size.height * scale;
-
- ops_push_clip (builder, &scaled_clip);
- if (!add_offscreen_ops (self, builder, &child->bounds,
- child,
- &region, &is_offscreen,
- RESET_OPACITY | FORCE_OFFSCREEN))
- g_assert_not_reached ();
- ops_pop_clip (builder);
+ else if (intersect_rounded_rectilinear (&transformed_clip,
+ builder->current_clip,
+ &intersection))
+ {
+ ops_push_clip (builder, &intersection);
+ gsk_gl_renderer_add_render_ops (self, child, builder);
+ ops_pop_clip (builder);
+ }
+ else
+ {
+ /* well fuck */
+ const float scale = ops_get_scale (builder);
+ gboolean is_offscreen;
+ TextureRegion region;
+ GskRoundedRect scaled_clip;
- ops_set_program (builder, &self->programs->blit_program);
- ops_set_texture (builder, region.texture_id);
+ memset (&scaled_clip, 0, sizeof (GskRoundedRect));
- load_offscreen_vertex_data (ops_draw (builder, NULL), child, builder);
- return;
- }
+ scaled_clip.bounds.origin.x = clip->origin.x * scale;
+ scaled_clip.bounds.origin.y = clip->origin.y * scale;
+ scaled_clip.bounds.size.width = clip->size.width * scale;
+ scaled_clip.bounds.size.height = clip->size.height * scale;
+ ops_push_clip (builder, &scaled_clip);
+ if (!add_offscreen_ops (self, builder, &child->bounds,
+ child,
+ &region, &is_offscreen,
+ RESET_OPACITY | FORCE_OFFSCREEN))
+ g_assert_not_reached ();
+ ops_pop_clip (builder);
-trivial:
- memset (&child_clip, 0, sizeof (GskRoundedRect));
- graphene_rect_intersection (&transformed_clip,
- &builder->current_clip->bounds,
- &child_clip.bounds);
+ ops_set_program (builder, &self->programs->blit_program);
+ ops_set_texture (builder, region.texture_id);
- ops_push_clip (builder, &child_clip);
- gsk_gl_renderer_add_render_ops (self, child, builder);
- ops_pop_clip (builder);
- return;
+ load_offscreen_vertex_data (ops_draw (builder, NULL), child, builder);
+ }
}
static inline void
@@ -1294,6 +1292,29 @@ render_rounded_clip_node (GskGLRenderer *self,
return;
ops_transform_bounds_modelview (builder, &clip->bounds, &transformed_clip.bounds);
+ for (i = 0; i < 4; i ++)
+ {
+ transformed_clip.corner[i].width = clip->corner[i].width * scale;
+ transformed_clip.corner[i].height = clip->corner[i].height * scale;
+ }
+
+ if (builder->clip_is_rectilinear)
+ {
+ GskRoundedRect intersected_clip;
+
+ if (intersect_rounded_rectilinear (&builder->current_clip->bounds,
+ &transformed_clip,
+ &intersected_clip))
+ {
+ ops_push_clip (builder, &intersected_clip);
+ gsk_gl_renderer_add_render_ops (self, child, builder);
+ ops_pop_clip (builder);
+ return;
+ }
+ }
+
+ /* After this point we are really working with a new and a current clip
+ * which both have rounded corners. */
if (!ops_has_clip (builder))
need_offscreen = FALSE;
@@ -1307,12 +1328,16 @@ render_rounded_clip_node (GskGLRenderer *self,
{
/* If they don't intersect at all, we can simply set
* the new clip and add the render ops */
- for (i = 0; i < 4; i ++)
+
+ /* If the new clip entirely contains the current clip, the intersection is simply
+ * the current clip, so we can ignore the new one */
+ if (rounded_inner_rect_contains_rect (&transformed_clip, &builder->current_clip->bounds))
{
- transformed_clip.corner[i].width = clip->corner[i].width * scale;
- transformed_clip.corner[i].height = clip->corner[i].height * scale;
+ gsk_gl_renderer_add_render_ops (self, child, builder);
+ return;
}
+ /* TODO: Intersect current and new clip */
ops_push_clip (builder, &transformed_clip);
gsk_gl_renderer_add_render_ops (self, child, builder);
ops_pop_clip (builder);
@@ -1354,7 +1379,6 @@ render_rounded_clip_node (GskGLRenderer *self,
load_offscreen_vertex_data (ops_draw (builder, NULL), node, builder);
}
- /* Else this node is entirely out of the current clip node and we don't draw it anyway. */
}
static inline void
@@ -1762,7 +1786,6 @@ render_unblurred_outset_shadow_node (GskGLRenderer *self,
}
-
static GdkRGBA COLOR_WHITE = { 1, 1, 1, 1 };
static inline void
render_outset_shadow_node (GskGLRenderer *self,
@@ -1783,19 +1806,32 @@ render_outset_shadow_node (GskGLRenderer *self,
OpShadow *shadow;
int blurred_texture_id;
int cached_tid;
+ bool do_slicing;
/* scaled_outline is the minimal outline we need to draw the given drop shadow,
* enlarged by the spread and offset by the blur radius. */
scaled_outline = *outline;
- /* Shrink our outline to the minimum size that can still hold all the border radii */
- gsk_rounded_rect_shrink_to_minimum (&scaled_outline);
- /* Increase by the spread */
- gsk_rounded_rect_shrink (&scaled_outline, -spread, -spread, -spread, -spread);
- /* Grow bounds but don't grow corners */
- graphene_rect_inset (&scaled_outline.bounds, - extra_blur_pixels, - extra_blur_pixels);
- /* For the center part, we add a few pixels */
- scaled_outline.bounds.size.width += SHADOW_EXTRA_SIZE;
- scaled_outline.bounds.size.height += SHADOW_EXTRA_SIZE;
+
+ if (outline->bounds.size.width < blur_extra ||
+ outline->bounds.size.height < blur_extra)
+ {
+ do_slicing = false;
+ gsk_rounded_rect_shrink (&scaled_outline, -spread, -spread, -spread, -spread);
+ }
+ else
+ {
+ /* Shrink our outline to the minimum size that can still hold all the border radii */
+ gsk_rounded_rect_shrink_to_minimum (&scaled_outline);
+ /* Increase by the spread */
+ gsk_rounded_rect_shrink (&scaled_outline, -spread, -spread, -spread, -spread);
+ /* Grow bounds but don't grow corners */
+ graphene_rect_inset (&scaled_outline.bounds, - blur_extra / 2.0, - blur_extra / 2.0);
+ /* For the center part, we add a few pixels */
+ scaled_outline.bounds.size.width += SHADOW_EXTRA_SIZE;
+ scaled_outline.bounds.size.height += SHADOW_EXTRA_SIZE;
+
+ do_slicing = true;
+ }
texture_width = (int)ceil ((scaled_outline.bounds.size.width + blur_extra) * scale);
texture_height = (int)ceil ((scaled_outline.bounds.size.height + blur_extra) * scale);
@@ -1880,6 +1916,41 @@ render_outset_shadow_node (GskGLRenderer *self,
blurred_texture_id = cached_tid;
}
+
+ if (!do_slicing)
+ {
+ const float min_x = floorf (builder->dx + outline->bounds.origin.x - spread - (blur_extra / 2.0) + dx);
+ const float min_y = floorf (builder->dy + outline->bounds.origin.y - spread - (blur_extra / 2.0) + dy);
+ float x1, x2, y1, y2, tx1, tx2, ty1, ty2;
+
+ ops_set_program (builder, &self->programs->outset_shadow_program);
+ ops_set_color (builder, color);
+ ops_set_texture (builder, blurred_texture_id);
+
+ shadow = ops_begin (builder, OP_CHANGE_OUTSET_SHADOW);
+ shadow->outline = transform_rect (self, builder, outline);
+
+ tx1 = 0; tx2 = 1;
+ ty1 = 0; ty2 = 1;
+
+ x1 = min_x;
+ x2 = min_x + texture_width / scale;
+ y1 = min_y;
+ y2 = min_y + texture_height / scale;
+
+ ops_draw (builder, (GskQuadVertex[GL_N_VERTICES]) {
+ { { x1, y1 }, { tx1, ty2 }, },
+ { { x1, y2 }, { tx1, ty1 }, },
+ { { x2, y1 }, { tx2, ty2 }, },
+
+ { { x2, y2 }, { tx2, ty1 }, },
+ { { x1, y2 }, { tx1, ty1 }, },
+ { { x2, y1 }, { tx2, ty2 }, },
+ });
+ return;
+ }
+
+
ops_set_program (builder, &self->programs->outset_shadow_program);
ops_set_color (builder, color);
ops_set_texture (builder, blurred_texture_id);
@@ -3317,19 +3388,8 @@ add_offscreen_ops (GskGLRenderer *self,
bounds->origin.y * scale,
width, height));
- if (flags & CENTER_CHILD)
- {
- ops_offset (builder,
- (bounds->size.width - child_node->bounds.size.width) / 2.0 -
- child_node->bounds.origin.x,
- (bounds->size.height - child_node->bounds.size.height) / 2.0 -
- child_node->bounds.origin.y);
- }
- else
- {
- builder->dx = 0;
- builder->dy = 0;
- }
+ builder->dx = 0;
+ builder->dy = 0;
if (flags & RESET_OPACITY)
prev_opacity = ops_set_opacity (builder, 1.0);
diff --git a/gtk/gtkboxlayout.c b/gtk/gtkboxlayout.c
index d06f5983a8..042d4084e1 100644
--- a/gtk/gtkboxlayout.c
+++ b/gtk/gtkboxlayout.c
@@ -28,7 +28,6 @@
#include "gtkstylecontextprivate.h"
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
-#include "gtknative.h"
/**
* SECTION:gtkboxlayout
@@ -250,10 +249,8 @@ gtk_box_layout_compute_size (GtkBoxLayout *self,
required_nat += (n_visible_children - 1) * spacing;
}
- if (minimum != NULL)
- *minimum = required_min;
- if (natural != NULL)
- *natural = required_nat;
+ *minimum = required_min;
+ *natural = required_nat;
}
static void
@@ -420,15 +417,10 @@ gtk_box_layout_compute_opposite_size (GtkBoxLayout *self,
}
}
- if (minimum != NULL)
- *minimum = computed_minimum;
- if (natural != NULL)
- *natural = MAX (computed_natural, computed_natural_below + computed_natural_above);
-
- if (min_baseline != NULL)
- *min_baseline = computed_minimum_baseline;
- if (nat_baseline != NULL)
- *nat_baseline = computed_natural_baseline;
+ *minimum = computed_minimum;
+ *natural = MAX (computed_natural, computed_natural_below + computed_natural_above);
+ *min_baseline = computed_minimum_baseline;
+ *nat_baseline = computed_natural_baseline;
}
static void
diff --git a/gtk/gtkdebug.h b/gtk/gtkdebug.h
index 41c8185329..4b1a4806e3 100644
--- a/gtk/gtkdebug.h
+++ b/gtk/gtkdebug.h
@@ -48,11 +48,10 @@ typedef enum {
GTK_DEBUG_INTERACTIVE = 1 << 10,
GTK_DEBUG_TOUCHSCREEN = 1 << 11,
GTK_DEBUG_ACTIONS = 1 << 12,
- GTK_DEBUG_RESIZE = 1 << 13,
- GTK_DEBUG_LAYOUT = 1 << 14,
- GTK_DEBUG_SNAPSHOT = 1 << 15,
- GTK_DEBUG_CONSTRAINTS = 1 << 16,
- GTK_DEBUG_BUILDER_OBJECTS = 1 << 17,
+ GTK_DEBUG_LAYOUT = 1 << 13,
+ GTK_DEBUG_SNAPSHOT = 1 << 14,
+ GTK_DEBUG_CONSTRAINTS = 1 << 15,
+ GTK_DEBUG_BUILDER_OBJECTS = 1 << 16,
} GtkDebugFlag;
#ifdef G_ENABLE_DEBUG
diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c
index ea73167f31..068ca174a5 100644
--- a/gtk/gtkicontheme.c
+++ b/gtk/gtkicontheme.c
@@ -3858,11 +3858,11 @@ gtk_icon_paintable_ensure_texture (GtkIconPaintable *self)
static void
init_color_matrix (graphene_matrix_t *color_matrix,
- graphene_vec4_t *color_offset,
- const GdkRGBA *foreground_color,
- const GdkRGBA *success_color,
- const GdkRGBA *warning_color,
- const GdkRGBA *error_color)
+ graphene_vec4_t *color_offset,
+ const GdkRGBA *foreground_color,
+ const GdkRGBA *success_color,
+ const GdkRGBA *warning_color,
+ const GdkRGBA *error_color)
{
GdkRGBA fg_default = { 0.7450980392156863, 0.7450980392156863, 0.7450980392156863, 1.0};
GdkRGBA success_default = { 0.3046921492332342,0.6015716792553597, 0.023437857633325704, 1.0};
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index 4ce05ced76..b4f74264a6 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -181,7 +181,6 @@ static const GdkDebugKey gtk_debug_keys[] = {
{ "no-css-cache", GTK_DEBUG_NO_CSS_CACHE, "Disable style property cache" },
{ "interactive", GTK_DEBUG_INTERACTIVE, "Enable the GTK inspector" },
{ "touchscreen", GTK_DEBUG_TOUCHSCREEN, "Pretend the pointer is a touchscreen" },
- { "resize", GTK_DEBUG_RESIZE, "Highlight resizing widgets" },
{ "layout", GTK_DEBUG_LAYOUT, "Show layout borders" },
{ "snapshot", GTK_DEBUG_SNAPSHOT, "Generate debug render nodes" },
};
diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c
index 5c80b694eb..b9c99ffb83 100644
--- a/gtk/gtksnapshot.c
+++ b/gtk/gtksnapshot.c
@@ -351,9 +351,6 @@ gtk_snapshot_collect_debug (GtkSnapshot *snapshot,
if (node == NULL)
return NULL;
- if (state->data.debug.message == NULL)
- return node;
-
debug_node = gsk_debug_node_new (node, state->data.debug.message);
gsk_render_node_unref (node);
@@ -377,15 +374,17 @@ gtk_snapshot_push_debug (GtkSnapshot *snapshot,
...)
{
GtkSnapshotState *current_state = gtk_snapshot_get_current_state (snapshot);
- GtkSnapshotState *state;
-
- state = gtk_snapshot_push_state (snapshot,
- current_state->transform,
- gtk_snapshot_collect_debug);
if (GTK_DEBUG_CHECK (SNAPSHOT))
{
va_list args;
+ GtkSnapshotState *state;
+
+ state = gtk_snapshot_push_state (snapshot,
+ current_state->transform,
+ gtk_snapshot_collect_debug);
+
+
va_start (args, message);
state->data.debug.message = g_strdup_vprintf (message, args);
@@ -393,7 +392,9 @@ gtk_snapshot_push_debug (GtkSnapshot *snapshot,
}
else
{
- state->data.debug.message = NULL;
+ gtk_snapshot_push_state (snapshot,
+ current_state->transform,
+ gtk_snapshot_collect_default);
}
}
@@ -1822,7 +1823,7 @@ gtk_snapshot_render_layout (GtkSnapshot *snapshot,
fg_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
shadows_value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_SHADOW);
- has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
+ has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
gtk_snapshot_append_layout (snapshot, layout, fg_color);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 9c1b2570ae..81c7c3e3f5 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2254,9 +2254,6 @@ gtk_widget_init (GTypeInstance *instance, gpointer g_class)
priv->alloc_needed_on_child = TRUE;
priv->draw_needed = TRUE;
priv->focus_on_click = TRUE;
-#ifdef G_ENABLE_DEBUG
- priv->highlight_resize = FALSE;
-#endif
priv->can_focus = TRUE;
priv->focusable = FALSE;
priv->can_target = TRUE;
@@ -3811,12 +3808,6 @@ gtk_widget_allocate (GtkWidget *widget,
}
#ifdef G_ENABLE_DEBUG
- if (GTK_DISPLAY_DEBUG_CHECK (_gtk_widget_get_display (widget), RESIZE))
- {
- priv->highlight_resize = TRUE;
- gtk_widget_queue_draw (widget);
- }
-
if (gtk_widget_get_resize_needed (widget))
{
g_warning ("Allocating size to %s %p without calling gtk_widget_measure(). "
@@ -11356,32 +11347,6 @@ gtk_widget_list_controllers (GtkWidget *widget,
return (GtkEventController **)g_ptr_array_free (controllers, FALSE);
}
-static inline void
-gtk_widget_maybe_add_debug_render_nodes (GtkWidget *widget,
- GtkSnapshot *snapshot)
-{
-#ifdef G_ENABLE_DEBUG
- GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
- GdkDisplay *display = _gtk_widget_get_display (widget);
-
- if (GTK_DISPLAY_DEBUG_CHECK (display, RESIZE) && priv->highlight_resize)
- {
- GdkRGBA blue = {0, 0, 1, 0.2};
- graphene_rect_t bounds;
-
- graphene_rect_init (&bounds,
- 0, 0,
- priv->width, priv->height);
-
- gtk_snapshot_append_color (snapshot,
- &blue,
- &bounds);
- priv->highlight_resize = FALSE;
- gtk_widget_queue_draw (widget);
- }
-#endif
-}
-
static GskRenderNode *
gtk_widget_create_render_node (GtkWidget *widget,
GtkSnapshot *snapshot)
@@ -11408,9 +11373,8 @@ gtk_widget_create_render_node (GtkWidget *widget,
"RenderNode for %s %p",
G_OBJECT_TYPE_NAME (widget), widget);
- filter_value = gtk_css_node_get_style (priv->cssnode)->other->filter;
- if (filter_value)
- gtk_css_filter_value_push_snapshot (filter_value, snapshot);
+ filter_value = style->other->filter;
+ gtk_css_filter_value_push_snapshot (filter_value, snapshot);
if (opacity < 1.0)
gtk_snapshot_push_opacity (snapshot, opacity);
@@ -11436,10 +11400,6 @@ gtk_widget_create_render_node (GtkWidget *widget,
gtk_css_filter_value_pop_snapshot (filter_value, snapshot);
-#ifdef G_ENABLE_DEBUG
- gtk_widget_maybe_add_debug_render_nodes (widget, snapshot);
-#endif
-
gtk_snapshot_pop (snapshot);
return gtk_snapshot_pop_collect (snapshot);
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 1fa09c48fb..d674b9867d 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -66,10 +66,6 @@ struct _GtkWidgetPrivate
guint direction : 2;
-#ifdef G_ENABLE_DEBUG
- guint highlight_resize : 1;
-#endif
-
guint in_destruction : 1;
guint realized : 1;
guint mapped : 1;
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 7f1b40d635..a8d27c21ac 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -83,7 +83,6 @@ struct _GtkInspectorVisualPrivate
GtkWidget *fallback_switch;
GtkWidget *baselines_switch;
GtkWidget *layout_switch;
- GtkWidget *resize_switch;
GtkWidget *focus_switch;
GtkWidget *misc_box;
@@ -423,19 +422,6 @@ layout_activate (GtkSwitch *sw,
}
static void
-widget_resize_activate (GtkSwitch *sw)
-{
- guint flags = gtk_get_debug_flags ();
-
- if (gtk_switch_get_active (sw))
- flags |= GTK_DEBUG_RESIZE;
- else
- flags &= ~GTK_DEBUG_RESIZE;
-
- gtk_set_debug_flags (flags);
-}
-
-static void
focus_activate (GtkSwitch *sw,
GParamSpec *pspec,
GtkInspectorVisual *vis)
@@ -1014,11 +1000,6 @@ row_activated (GtkListBox *box,
GtkSwitch *sw = GTK_SWITCH (vis->priv->layout_switch);
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
}
- else if (gtk_widget_is_ancestor (vis->priv->resize_switch, GTK_WIDGET (row)))
- {
- GtkSwitch *sw = GTK_SWITCH (vis->priv->resize_switch);
- gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
- }
else if (gtk_widget_is_ancestor (vis->priv->focus_switch, GTK_WIDGET (row)))
{
GtkSwitch *sw = GTK_SWITCH (vis->priv->focus_switch);
@@ -1164,7 +1145,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, fallback_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, baselines_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, layout_switch);
- gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, resize_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, focus_switch);
gtk_widget_class_bind_template_callback (widget_class, fps_activate);
@@ -1173,7 +1153,6 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_callback (widget_class, direction_changed);
gtk_widget_class_bind_template_callback (widget_class, baselines_activate);
gtk_widget_class_bind_template_callback (widget_class, layout_activate);
- gtk_widget_class_bind_template_callback (widget_class, widget_resize_activate);
gtk_widget_class_bind_template_callback (widget_class, focus_activate);
gtk_widget_class_bind_template_callback (widget_class, software_gl_activate);
diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui
index 8dece056b5..223bdb3911 100644
--- a/gtk/inspector/visual.ui
+++ b/gtk/inspector/visual.ui
@@ -570,35 +570,6 @@
<property name="margin-bottom">10</property>
<property name="spacing">40</property>
<child>
- <object class="GtkLabel" id="resize_label">
- <property name="label" translatable="yes">Show Widget Resizes</property>
- <property name="halign">start</property>
- <property name="valign">baseline</property>
- <property name="xalign">0.0</property>
- </object>
- </child>
- <child>
- <object class="GtkSwitch" id="resize_switch">
- <property name="halign">end</property>
- <property name="valign">baseline</property>
- <property name="hexpand">1</property>
- <signal name="notify::active" handler="widget_resize_activate"/>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkListBoxRow">
- <child>
- <object class="GtkBox">
- <property name="margin-start">10</property>
- <property name="margin-end">10</property>
- <property name="margin-top">10</property>
- <property name="margin-bottom">10</property>
- <property name="spacing">40</property>
- <child>
<object class="GtkLabel" id="focus_label">
<property name="label" translatable="yes">Show Focus</property>
<property name="halign">start</property>
@@ -712,7 +683,6 @@
<widget name="fallback_label"/>
<widget name="baselines_label"/>
<widget name="layout_label"/>
- <widget name="resize_label"/>
<widget name="focus_label"/>
<widget name="touchscreen_label"/>
<widget name="software_gl_label"/>
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index a7646eade7..104f09d707 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -1465,30 +1465,6 @@ headerbar {
}
}
-.background:not(.tiled):not(.maximized):not(.solid-csd) .titlebar,
-.background:not(.tiled-top):not(.maximized):not(.solid-csd) .titlebar,
-.background:not(.tiled-left):not(.maximized):not(.solid-csd) .titlebar,
-.background:not(.tiled-right):not(.maximized):not(.solid-csd) .titlebar,
-.background:not(.tiled-bottom):not(.maximized):not(.solid-csd) .titlebar {
- &:backdrop, & {
- border-top-left-radius: 7px;
- border-top-right-radius: 7px;
- }
-}
-
-headerbar { // headerbar border rounding
- window:not(.tiled):not(.maximized):not(.fullscreen):not(.solid-csd) separator:first-child + &, // tackles the paned container case
- window:not(.tiled):not(.maximized):not(.fullscreen):not(.solid-csd) &:first-child { &:backdrop, & { border-top-left-radius: 7px; }}
- window:not(.tiled):not(.maximized):not(.fullscreen):not(.solid-csd) &:last-child { &:backdrop, & { border-top-right-radius: 7px; }}
- window:not(.tiled):not(.maximized):not(.fullscreen):not(.solid-csd) stack & { // tackles the stacked headerbars case
- &:first-child, &:last-child {
- &:backdrop, & {
- border-top-left-radius: 7px;
- border-top-right-radius: 7px;
- }
- }
- }
-}
.titlebar:not(headerbar) {
window.csd > & {
diff --git a/tests/testwidgettransforms.c b/tests/testwidgettransforms.c
index fb88488b16..0deca31e4f 100644
--- a/tests/testwidgettransforms.c
+++ b/tests/testwidgettransforms.c
@@ -320,7 +320,7 @@ main (int argc, char **argv)
gtk_button_set_label (GTK_BUTTON (toggle_button), "Picking");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle_button), do_picking);
g_signal_connect (toggle_button, "toggled", G_CALLBACK (toggled_cb), NULL);
- gtk_box_append (GTK_BOX (titlebar), toggle_button);
+ gtk_header_bar_pack_start (GTK_HEADER_BAR (titlebar), toggle_button);
test_widget = gtk_button_new ();
gtk_widget_set_size_request (test_widget, TEST_WIDGET_MIN_SIZE, TEST_WIDGET_MIN_SIZE);
@@ -332,7 +332,7 @@ main (int argc, char **argv)
gtk_widget_set_halign (test_child, GTK_ALIGN_CENTER);
gtk_widget_set_valign (test_child, GTK_ALIGN_CENTER);
gtk_widget_set_size_request (test_child, TEST_WIDGET_MIN_SIZE / 2, TEST_WIDGET_MIN_SIZE / 2);
- gtk_box_append (GTK_BOX (test_widget), test_child);
+ gtk_button_set_child (GTK_BUTTON (test_widget), test_child);
gtk_transform_tester_set_test_widget (GTK_TRANSFORM_TESTER (transform_tester), test_widget);
diff --git a/testsuite/gsk/compare/clip-nested1.node b/testsuite/gsk/compare/clip-nested1.node
index 0e269abe0a..3058b64bd2 100644
--- a/testsuite/gsk/compare/clip-nested1.node
+++ b/testsuite/gsk/compare/clip-nested1.node
@@ -1,48 +1,48 @@
transform {
-transform: scale(8);
-child:container {
+ transform: scale(8);
+ child:container {
-rounded-clip {
- clip: 0 0 50 50 / 30 0 0 0;
- child: rounded-clip {
- clip: 0 0 100 100 / 0;
- child: color {
- bounds: 0 0 50 50;
- color: teal;
+ rounded-clip {
+ clip: 0 0 50 50 / 30 0 0 0;
+ child: rounded-clip {
+ clip: 0 0 100 100 / 0;
+ child: color {
+ bounds: 0 0 50 50;
+ color: teal;
+ }
+ }
}
- }
-}
-debug {
- message: "Clipped-out area";
- child: container {
- color {
- color: black;
- bounds: 0 16 5 14;
- }
- color {
- color: black;
- bounds: 3 12 5 5;
- }
- color {
- color: black;
- bounds: 6 7 5 5;
- }
- color {
- color: black;
- bounds: 10 3 5 5;
- }
- color {
- color: black;
- bounds: 15 0 5 5;
- }
- color {
- color: black;
- bounds: 19 0 14 2;
- }
- }
-}
+ debug {
+ message: "Clipped-out area";
+ child: container {
+ color {
+ color: black;
+ bounds: 0 16 5 14;
+ }
+ color {
+ color: black;
+ bounds: 3 12 5 5;
+ }
+ color {
+ color: black;
+ bounds: 6 7 5 5;
+ }
+ color {
+ color: black;
+ bounds: 10 3 5 5;
+ }
+ color {
+ color: black;
+ bounds: 15 0 5 5;
+ }
+ color {
+ color: black;
+ bounds: 19 0 14 2;
+ }
+ }
+ }
+ }
}
-} \ No newline at end of file