From d6b3ac850d5a9fc91070508a9acfa0b17b3b015e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 1 Jul 2020 16:22:30 +0200 Subject: testsuite: Fix test case indentation --- testsuite/gsk/compare/clip-nested1.node | 82 ++++++++++++++++----------------- 1 file changed, 41 insertions(+), 41 deletions(-) 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 -- cgit v1.2.1 From 34008e6aab564752494e14d186cf4d7b1d930aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 3 Jul 2020 06:41:29 +0200 Subject: gl renderer: Ignore rounded clip that only increase the clip This fixes the widget factory rendering too much. In the widget-factory, we generally have a pretty small update area (two spinners and a progressbar). We take the extents of that as a update area and inital clip. However, the first clip node we see is from the toplevel window, which essentially increases the clip again to almost the entire window. Fix that by ignoring such cases. --- gsk/gl/gskglrenderer.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 130971e7b9..699da4f35d 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -1313,6 +1313,15 @@ render_rounded_clip_node (GskGLRenderer *self, transformed_clip.corner[i].height = clip->corner[i].height * scale; } + /* 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)) + { + 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); -- cgit v1.2.1 From 46bb3e3046969173f7edd3ed5085791fc18f0d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sat, 4 Jul 2020 09:26:08 +0200 Subject: icontheme: Indentation --- gtk/gtkicontheme.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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}; -- cgit v1.2.1 From 4e4207457f63d593b5565665fb87acbb34743bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 5 Jul 2020 11:03:36 +0200 Subject: adwaita: Remove header bar border radius We get this from the window node these days. --- gtk/theme/Adwaita/_common.scss | 24 ------------------------ 1 file changed, 24 deletions(-) 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 > & { -- cgit v1.2.1 From 339d9f05e4f421439fb53711de4145d3d17aa198 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 5 Jul 2020 13:58:52 +0200 Subject: gl renderer: Remove unused flag --- gsk/gl/gskglrenderer.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 699da4f35d..241e7dcce5 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; @@ -3326,19 +3325,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); -- cgit v1.2.1 From 6a60b0f591db47909863543917207e45912a02e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 8 Jul 2020 05:45:34 +0200 Subject: gl renderer: Try to intersect rounded clips more often --- gsk/gl/gskglrenderer.c | 213 ++++++++++++++++++++++++++----------------------- 1 file changed, 115 insertions(+), 98 deletions(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 241e7dcce5..e61dc6a0e8 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -905,6 +905,7 @@ upload_texture (GskGLRenderer *self, } else { + out_region->texture_id = gsk_gl_driver_get_texture_for_texture (self->gl_driver, texture, @@ -1151,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, @@ -1158,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; - } + 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; -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, - ®ion, &is_offscreen, - RESET_OPACITY | FORCE_OFFSCREEN)) - g_assert_not_reached (); - ops_pop_clip (builder); + memset (&scaled_clip, 0, sizeof (GskRoundedRect)); - ops_set_program (builder, &self->programs->blit_program); - ops_set_texture (builder, region.texture_id); - - 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, + ®ion, &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 @@ -1293,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; @@ -1306,11 +1328,6 @@ 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 ++) - { - transformed_clip.corner[i].width = clip->corner[i].width * scale; - transformed_clip.corner[i].height = clip->corner[i].height * scale; - } /* If the new clip entirely contains the current clip, the intersection is simply * the current clip, so we can ignore the new one */ -- cgit v1.2.1 From 6cde64072d6e2fcdca0fb8da249cb26ad57ba358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Wed, 8 Jul 2020 06:14:55 +0200 Subject: gl renderer: Remove outdated comment --- gsk/gl/gskglrenderer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index e61dc6a0e8..db716794c1 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -1379,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 -- cgit v1.2.1 From 37d7ab88dc125ec9ab6ff326f371aa028cfa6df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 12 Jul 2020 09:40:00 +0200 Subject: gl renderer: Avoid 9-slicing things that can't be The outline needs to be large enough so changing the size of the outline does not affect the resulting blurred texture. Fixes #2776 --- gsk/gl/gskglrenderer.c | 67 ++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index db716794c1..9df466a248 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -1786,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, @@ -1807,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); @@ -1904,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); -- cgit v1.2.1 From 11f07cb5ad94fae02aa27c64efae4cce7f45788c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 12 Jul 2020 10:55:31 +0200 Subject: GdkRGBA: Fix typo in documentation --- gdk/gdkrgba.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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” -- cgit v1.2.1 From f721d2de15c1798a45376cdb3a321fec477592bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 12 Jul 2020 11:20:31 +0200 Subject: debug: Remove resize highlighting This has been broken ever since the debug highlighting moved to inspector overlays. --- gtk/gtkdebug.h | 9 ++++----- gtk/gtkmain.c | 1 - gtk/gtkwidget.c | 39 --------------------------------------- gtk/gtkwidgetprivate.h | 4 ---- gtk/inspector/visual.c | 21 --------------------- gtk/inspector/visual.ui | 30 ------------------------------ 6 files changed, 4 insertions(+), 100 deletions(-) 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/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/gtkwidget.c b/gtk/gtkwidget.c index 9c1b2570ae..55d541e054 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) @@ -11436,10 +11401,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; @@ -422,19 +421,6 @@ layout_activate (GtkSwitch *sw, redraw_everything (); } -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, @@ -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 @@ -560,35 +560,6 @@ - - - - - 10 - 10 - 10 - 10 - 40 - - - Show Widget Resizes - start - baseline - 0.0 - - - - - end - baseline - 1 - - - - - - - @@ -712,7 +683,6 @@ - -- cgit v1.2.1 From 720c298786d38437ae61848f6ebbeeb5674eb630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 12 Jul 2020 11:33:34 +0200 Subject: snapshot: Use collect_default directoy in push_debug() Instead of going through collect_debug and then doing a collect_default anyway if the message is NULL. --- gtk/gtksnapshot.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) 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); -- cgit v1.2.1 From f678b3804d3eb8e7b8369ff319d240a9e5f309f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 12 Jul 2020 13:57:20 +0200 Subject: widget: Remove useless if statement filter_value is never NULL anyway. --- gtk/gtkwidget.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 55d541e054..a3215427b4 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -11374,8 +11374,7 @@ gtk_widget_create_render_node (GtkWidget *widget, 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); + gtk_css_filter_value_push_snapshot (filter_value, snapshot); if (opacity < 1.0) gtk_snapshot_push_opacity (snapshot, opacity); -- cgit v1.2.1 From 14589c2a59853eae6d6c9d647b65bd83b1b4c571 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Sun, 12 Jul 2020 14:38:50 +0200 Subject: widget: Save a gtk_css_node_get_style call --- gtk/gtkwidget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index a3215427b4..81c7c3e3f5 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -11373,7 +11373,7 @@ 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; + filter_value = style->other->filter; gtk_css_filter_value_push_snapshot (filter_value, snapshot); if (opacity < 1.0) -- cgit v1.2.1 From de0547ede7f296e3af31bd47fb4b0bb03e6c48fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 17 Jul 2020 06:27:23 +0200 Subject: migration guide: Remove a stray html tag --- docs/reference/gtk/migrating-3to4.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 +### 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 -- cgit v1.2.1 From 2bd87ce771d695343bb9472aaa43ea439d331e26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 17 Jul 2020 06:27:50 +0200 Subject: boxlayout: Remove unused include --- gtk/gtkboxlayout.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gtk/gtkboxlayout.c b/gtk/gtkboxlayout.c index d06f5983a8..c558523a81 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 -- cgit v1.2.1 From c1f5153f6d319b5bd0b6576e6f0ca93d677f23f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 17 Jul 2020 06:31:57 +0200 Subject: boxlayout: Remove unnecessary checks The pointers passed to GtkLayoutManager::measure() are never NULL. The ones passed to gtk_layout_manager_measure() can be, however. --- gtk/gtkboxlayout.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/gtk/gtkboxlayout.c b/gtk/gtkboxlayout.c index c558523a81..042d4084e1 100644 --- a/gtk/gtkboxlayout.c +++ b/gtk/gtkboxlayout.c @@ -249,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 @@ -419,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 -- cgit v1.2.1 From 7e19911d3f2c8a01e3843b713ed44dcf57e91e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Fri, 17 Jul 2020 07:14:50 +0200 Subject: testwidgettransforms: Fix GtkBox casts --- tests/testwidgettransforms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); -- cgit v1.2.1