Merge branch 'wip/otte/for-master' into 'master'

Wip/otte/for master

See merge request GNOME/gtk!2997
This commit is contained in:
Matthias Clasen 2020-12-24 07:13:22 +00:00
commit 7e579bb59a
19 changed files with 95 additions and 198 deletions

View File

@ -53,31 +53,30 @@
<child>
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<object class="GtkSearchBar" id="searchbar">
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<relation name="controls">listview</relation>
</accessibility>
</object>
</child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<relation name="controls">listview</relation>
</accessibility>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<property name="vexpand">1</property>
<child>
<object class="GtkListView" id="listview">
<style>
@ -94,7 +93,6 @@
</accessibility>
</object>
</child>
</object>
</child>
</object>

View File

@ -98,19 +98,22 @@ gsk_render_node_write_to_file
GskScalingFilter
gsk_render_node_get_bounds
<SUBSECTION Nodes>
<SUBSECTION>
gsk_color_node_new
gsk_color_node_get_color
gsk_texture_node_new
gsk_texture_node_get_texture
<SUBSECTION>
GskColorStop
gsk_linear_gradient_node_new
gsk_repeating_linear_gradient_node_new
gsk_linear_gradient_node_get_start
gsk_linear_gradient_node_get_end
gsk_linear_gradient_node_get_n_color_stops
gsk_linear_gradient_node_get_color_stops
gsk_repeating_linear_gradient_node_new
<SUBSECTION>
gsk_radial_gradient_node_new
gsk_repeating_radial_gradient_node_new
gsk_radial_gradient_node_get_n_color_stops
gsk_radial_gradient_node_get_color_stops
gsk_radial_gradient_node_get_start
@ -118,16 +121,18 @@ gsk_radial_gradient_node_get_end
gsk_radial_gradient_node_get_hradius
gsk_radial_gradient_node_get_vradius
gsk_radial_gradient_node_get_center
gsk_repeating_radial_gradient_node_new
<SUBSECTION>
gsk_conic_gradient_node_new
gsk_conic_gradient_node_get_n_color_stops
gsk_conic_gradient_node_get_color_stops
gsk_conic_gradient_node_get_center
gsk_conic_gradient_node_get_rotation
<SUBSECTION>
gsk_border_node_new
gsk_border_node_get_outline
gsk_border_node_get_widths
gsk_border_node_get_colors
<SUBSECTION>
gsk_inset_shadow_node_new
gsk_inset_shadow_node_get_outline
gsk_inset_shadow_node_get_color
@ -135,6 +140,7 @@ gsk_inset_shadow_node_get_dx
gsk_inset_shadow_node_get_dy
gsk_inset_shadow_node_get_spread
gsk_inset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_outset_shadow_node_new
gsk_outset_shadow_node_get_outline
gsk_outset_shadow_node_get_color
@ -142,45 +148,57 @@ gsk_outset_shadow_node_get_dx
gsk_outset_shadow_node_get_dy
gsk_outset_shadow_node_get_spread
gsk_outset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_cairo_node_new
gsk_cairo_node_get_draw_context
gsk_cairo_node_get_surface
<SUBSECTION>
gsk_container_node_new
gsk_container_node_get_n_children
gsk_container_node_get_child
<SUBSECTION>
gsk_transform_node_new
gsk_transform_node_get_child
gsk_transform_node_get_transform
<SUBSECTION>
gsk_opacity_node_new
gsk_opacity_node_get_child
gsk_opacity_node_get_opacity
<SUBSECTION>
gsk_color_matrix_node_new
gsk_color_matrix_node_get_child
gsk_color_matrix_node_get_color_matrix
gsk_color_matrix_node_get_color_offset
<SUBSECTION>
gsk_repeat_node_new
gsk_repeat_node_get_child
gsk_repeat_node_get_child_bounds
<SUBSECTION>
gsk_clip_node_new
gsk_clip_node_get_child
gsk_clip_node_get_clip
<SUBSECTION>
gsk_rounded_clip_node_new
gsk_rounded_clip_node_get_child
gsk_rounded_clip_node_get_clip
<SUBSECTION>
GskShadow
gsk_shadow_node_new
gsk_shadow_node_get_shadow
gsk_shadow_node_get_n_shadows
gsk_shadow_node_get_child
<SUBSECTION>
GskBlendMode
gsk_blend_node_new
gsk_blend_node_get_bottom_child
gsk_blend_node_get_top_child
gsk_blend_node_get_blend_mode
<SUBSECTION>
gsk_cross_fade_node_new
gsk_cross_fade_node_get_start_child
gsk_cross_fade_node_get_end_child
gsk_cross_fade_node_get_progress
<SUBSECTION>
gsk_text_node_new
gsk_text_node_get_font
gsk_text_node_get_glyphs
@ -188,12 +206,15 @@ gsk_text_node_get_color
gsk_text_node_has_color_glyphs
gsk_text_node_get_num_glyphs
gsk_text_node_get_offset
<SUBSECTION>
gsk_blur_node_new
gsk_blur_node_get_child
gsk_blur_node_get_radius
<SUBSECTION>
gsk_debug_node_new
gsk_debug_node_get_child
gsk_debug_node_get_message
<SUBSECTION>
gsk_gl_shader_node_new
gsk_gl_shader_node_get_n_children
gsk_gl_shader_node_get_child

View File

@ -182,6 +182,7 @@ G_GNUC_UNUSED static inline void
gdk_array(splice) (GdkArray *self,
gsize pos,
gsize removed,
gboolean stolen,
_T_ *additions,
gsize added)
{
@ -192,8 +193,9 @@ gdk_array(splice) (GdkArray *self,
g_assert (pos + removed <= size);
remaining = size - pos - removed;
gdk_array(free_elements) (gdk_array(index) (self, pos),
gdk_array(index) (self, pos + removed));
if (!stolen)
gdk_array(free_elements) (gdk_array(index) (self, pos),
gdk_array(index) (self, pos + removed));
gdk_array(reserve) (self, size - removed + added);
@ -225,9 +227,9 @@ gdk_array(set_size) (GdkArray *self,
{
gsize old_size = gdk_array(get_size) (self);
if (new_size > old_size)
gdk_array(splice) (self, old_size, 0, NULL, new_size - old_size);
gdk_array(splice) (self, old_size, 0, FALSE, NULL, new_size - old_size);
else
gdk_array(splice) (self, new_size, old_size - new_size, NULL, 0);
gdk_array(splice) (self, new_size, old_size - new_size, FALSE, NULL, 0);
}
G_GNUC_UNUSED static void
@ -241,6 +243,7 @@ gdk_array(append) (GdkArray *self,
gdk_array(splice) (self,
gdk_array(get_size) (self),
0,
FALSE,
#ifdef GDK_ARRAY_BY_VALUE
value,
#else

View File

@ -2762,6 +2762,16 @@ gsk_transform_node_draw (GskRenderNode *node,
ctm.xx, ctm.yx,
ctm.xy, ctm.yy,
ctm.x0, ctm.y0));
if (xx * yy == xy * yx)
{
/* broken matrix here. This can happen during transitions
* (like when flipping an axis at the point where scale == 0)
* and just means that nothing should be drawn.
* But Cairo thows lots of ugly errors instead of silently
* going on. So We silently go on.
*/
return;
}
cairo_transform (cr, &ctm);
gsk_render_node_draw (self->child, cr);

View File

@ -100,7 +100,7 @@ gtk_accels_remove (GtkAccels *accels,
position = gtk_accels_find (accels, action_and_target);
if (position < gtk_accels_get_size (accels))
gtk_accels_splice (accels, position, 1, NULL, 0);
gtk_accels_splice (accels, position, 1, FALSE, NULL, 0);
}
/*< private >

View File

@ -167,7 +167,7 @@ gtk_css_selector_matches_insert_sorted (GtkCssSelectorMatches *matches,
break;
}
gtk_css_selector_matches_splice (matches, i, 0, (gpointer[1]) { data }, 1);
gtk_css_selector_matches_splice (matches, i, 0, FALSE, (gpointer[1]) { data }, 1);
}
static inline gboolean

View File

@ -587,11 +587,12 @@ gtk_list_view_size_allocate (GtkWidget *widget,
int min, nat, row_height;
int x, y;
GtkOrientation orientation, opposite_orientation;
GtkScrollablePolicy scroll_policy;
GtkScrollablePolicy scroll_policy, opposite_scroll_policy;
orientation = gtk_list_base_get_orientation (GTK_LIST_BASE (self));
opposite_orientation = OPPOSITE_ORIENTATION (orientation);
scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), orientation);
opposite_scroll_policy = gtk_list_base_get_scroll_policy (GTK_LIST_BASE (self), opposite_orientation);
/* step 0: exit early if list is empty */
if (gtk_list_item_manager_get_root (self->item_manager) == NULL)
@ -602,7 +603,7 @@ gtk_list_view_size_allocate (GtkWidget *widget,
-1,
&min, &nat, NULL, NULL);
self->list_width = orientation == GTK_ORIENTATION_VERTICAL ? width : height;
if (scroll_policy == GTK_SCROLL_MINIMUM)
if (opposite_scroll_policy == GTK_SCROLL_MINIMUM)
self->list_width = MAX (min, self->list_width);
else
self->list_width = MAX (nat, self->list_width);

View File

@ -206,7 +206,7 @@ gtk_multi_filter_remove (GtkMultiFilter *self,
filter = gtk_filters_get (&self->filters, position);
g_signal_handlers_disconnect_by_func (filter, gtk_multi_filter_changed_cb, self);
gtk_filters_splice (&self->filters, position, 1, NULL, 0);
gtk_filters_splice (&self->filters, position, 1, FALSE, NULL, 0);
gtk_filter_changed (GTK_FILTER (self),
GTK_MULTI_FILTER_GET_CLASS (self)->removal_change);

View File

@ -432,7 +432,7 @@ gtk_multi_sorter_remove (GtkMultiSorter *self,
sorter = gtk_sorters_get (&self->sorters, position);
g_signal_handlers_disconnect_by_func (sorter, gtk_multi_sorter_changed_cb, self);
gtk_sorters_splice (&self->sorters, position, 1, NULL, 0);
gtk_sorters_splice (&self->sorters, position, 1, FALSE, NULL, 0);
gtk_sorter_changed_with_keys (GTK_SORTER (self),
GTK_SORTER_CHANGE_LESS_STRICT,

View File

@ -516,7 +516,7 @@ gtk_picture_new_for_filename (const char *filename)
* gtk_picture_new_for_resource:
* @resource_path: (nullable): resource path to play back
*
* Creates a new #GtkPicture displaying the file @filename.
* Creates a new #GtkPicture displaying the resource at @resource_path.
*
* This is a utility function that calls gtk_picture_new_for_file().
* See that function for details.

View File

@ -26,139 +26,6 @@
#include <string.h>
/**
* _gtk_rounded_box_init_rect:
* @box: box to initialize
* @x: x coordinate of box
* @y: y coordinate of box
* @width: width of box
* @height: height of box
*
* Initializes the given @box to represent the given rectangle.
* The
**/
void
_gtk_rounded_box_init_rect (GskRoundedRect *box,
double x,
double y,
double width,
double height)
{
memset (box, 0, sizeof (GskRoundedRect));
box->bounds.origin.x = x;
box->bounds.origin.y = y;
box->bounds.size.width = width;
box->bounds.size.height = height;
}
/* clamp border radius, following CSS specs */
static void
gtk_rounded_box_clamp_border_radius (GskRoundedRect *box)
{
double factor = 1.0;
double corners;
corners = box->corner[GSK_CORNER_TOP_LEFT].width + box->corner[GSK_CORNER_TOP_RIGHT].width;
if (corners != 0)
factor = MIN (factor, box->bounds.size.width / corners);
corners = box->corner[GSK_CORNER_TOP_RIGHT].height + box->corner[GSK_CORNER_BOTTOM_RIGHT].height;
if (corners != 0)
factor = MIN (factor, box->bounds.size.height / corners);
corners = box->corner[GSK_CORNER_BOTTOM_RIGHT].width + box->corner[GSK_CORNER_BOTTOM_LEFT].width;
if (corners != 0)
factor = MIN (factor, box->bounds.size.width / corners);
corners = box->corner[GSK_CORNER_TOP_LEFT].height + box->corner[GSK_CORNER_BOTTOM_LEFT].height;
if (corners != 0)
factor = MIN (factor, box->bounds.size.height / corners);
box->corner[GSK_CORNER_TOP_LEFT].width *= factor;
box->corner[GSK_CORNER_TOP_LEFT].height *= factor;
box->corner[GSK_CORNER_TOP_RIGHT].width *= factor;
box->corner[GSK_CORNER_TOP_RIGHT].height *= factor;
box->corner[GSK_CORNER_BOTTOM_RIGHT].width *= factor;
box->corner[GSK_CORNER_BOTTOM_RIGHT].height *= factor;
box->corner[GSK_CORNER_BOTTOM_LEFT].width *= factor;
box->corner[GSK_CORNER_BOTTOM_LEFT].height *= factor;
}
static void
_gtk_rounded_box_apply_border_radius (GskRoundedRect *box,
const GtkCssValue * const corner[4])
{
box->corner[GSK_CORNER_TOP_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_LEFT],
box->bounds.size.width);
box->corner[GSK_CORNER_TOP_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_LEFT],
box->bounds.size.height);
box->corner[GSK_CORNER_TOP_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_RIGHT],
box->bounds.size.width);
box->corner[GSK_CORNER_TOP_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_RIGHT],
box->bounds.size.height);
box->corner[GSK_CORNER_BOTTOM_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_RIGHT],
box->bounds.size.width);
box->corner[GSK_CORNER_BOTTOM_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_RIGHT],
box->bounds.size.height);
box->corner[GSK_CORNER_BOTTOM_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_LEFT],
box->bounds.size.width);
box->corner[GSK_CORNER_BOTTOM_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_LEFT],
box->bounds.size.height);
gtk_rounded_box_clamp_border_radius (box);
}
void
gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
GskRoundedRect *padding_box,
GskRoundedRect *content_box,
GtkCssStyle *style,
double x,
double y,
double width,
double height)
{
const GtkCssValue *corner[4];
GskRoundedRect box;
gsk_rounded_rect_init_from_rect (&box, &GRAPHENE_RECT_INIT (x, y, width, height), 0);
corner[GSK_CORNER_TOP_LEFT] = style->border->border_top_left_radius;
corner[GSK_CORNER_TOP_RIGHT] = style->border->border_top_right_radius;
corner[GSK_CORNER_BOTTOM_LEFT] = style->border->border_bottom_left_radius;
corner[GSK_CORNER_BOTTOM_RIGHT] = style->border->border_bottom_right_radius;
_gtk_rounded_box_apply_border_radius (&box, corner);
if (border_box)
gsk_rounded_rect_init_copy (border_box, &box);
if (padding_box || content_box)
{
gsk_rounded_rect_shrink (&box,
_gtk_css_number_value_get (style->border->border_top_width, 100),
_gtk_css_number_value_get (style->border->border_right_width, 100),
_gtk_css_number_value_get (style->border->border_bottom_width, 100),
_gtk_css_number_value_get (style->border->border_left_width, 100));
if (padding_box)
gsk_rounded_rect_init_copy (padding_box, &box);
if (content_box)
{
gsk_rounded_rect_shrink (&box,
_gtk_css_number_value_get (style->size->padding_top, 100),
_gtk_css_number_value_get (style->size->padding_right, 100),
_gtk_css_number_value_get (style->size->padding_bottom, 100),
_gtk_css_number_value_get (style->size->padding_left, 100));
gsk_rounded_rect_init_copy (content_box, &box);
}
}
}
typedef struct {
double angle1;
double angle2;
@ -591,12 +458,3 @@ _gtk_rounded_box_path_left (const GskRoundedRect *outer,
cairo_close_path (cr);
}
void
_gtk_rounded_box_clip_path (const GskRoundedRect *box,
cairo_t *cr)
{
cairo_rectangle (cr,
box->bounds.origin.x, box->bounds.origin.y,
box->bounds.size.width, box->bounds.size.height);
}

View File

@ -28,20 +28,6 @@
G_BEGIN_DECLS
void _gtk_rounded_box_init_rect (GskRoundedRect *box,
double x,
double y,
double width,
double height);
void gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
GskRoundedRect *padding_box,
GskRoundedRect *content_box,
GtkCssStyle *style,
double x,
double y,
double width,
double height);
double _gtk_rounded_box_guess_length (const GskRoundedRect *box,
GtkCssSide side);
@ -60,8 +46,6 @@ void _gtk_rounded_box_path_bottom (const GskRounde
void _gtk_rounded_box_path_left (const GskRoundedRect *outer,
const GskRoundedRect *inner,
cairo_t *cr);
void _gtk_rounded_box_clip_path (const GskRoundedRect *box,
cairo_t *cr);
G_END_DECLS

View File

@ -1386,7 +1386,7 @@ gtk_snapshot_pop_one (GtkSnapshot *snapshot)
/* Remove all the state's nodes from the list of nodes */
g_assert (state->start_node_index + state->n_nodes == gtk_snapshot_nodes_get_size (&snapshot->nodes));
gtk_snapshot_nodes_splice (&snapshot->nodes, state->start_node_index, state->n_nodes, NULL, 0);
gtk_snapshot_nodes_splice (&snapshot->nodes, state->start_node_index, state->n_nodes, FALSE, NULL, 0);
}
else
{
@ -1400,7 +1400,7 @@ gtk_snapshot_pop_one (GtkSnapshot *snapshot)
g_assert (previous_state->start_node_index + previous_state->n_nodes == gtk_snapshot_nodes_get_size (&snapshot->nodes));
}
gtk_snapshot_states_splice (&snapshot->state_stack, state_index, 1, NULL, 0);
gtk_snapshot_states_splice (&snapshot->state_stack, state_index, 1, FALSE, NULL, 0);
return node;
}

View File

@ -471,7 +471,7 @@ gtk_string_list_splice (GtkStringList *self,
else
n_additions = 0;
objects_splice (&self->items, position, n_removals, NULL, n_additions);
objects_splice (&self->items, position, n_removals, FALSE, NULL, n_additions);
for (i = 0; i < n_additions; i++)
{

View File

@ -545,6 +545,11 @@ gtk_video_notify_cb (GtkMediaStream *stream,
gtk_video_update_error (self);
if (g_str_equal (pspec->name, "playing"))
gtk_video_update_playing (self);
if (g_str_equal (pspec->name, "prepared"))
{
if (self->autoplay && gtk_media_stream_is_prepared (stream))
gtk_media_stream_play (stream);
}
}
/**

View File

@ -77,7 +77,7 @@ gdk_array(test_splice) (void)
for (j = 0; j < add; j++)
sum += ++additions[j];
gdk_array(splice) (&v, pos, remove, additions, add);
gdk_array(splice) (&v, pos, remove, FALSE, additions, add);
{
gsize total = 0;
for (j = 0; j < gdk_array(get_size) (&v); j++)

View File

@ -0,0 +1,16 @@
transform {
/* break the transform on purpose, because
this is valid in GSK and should result
in nothing being drawn. */
transform: scale(0);
child: color {
color: red;
bounds: 0 0 100 100;
}
}
/* make sure the rendering has a size */
color {
color: transparent;
bounds: 0 0 1 1;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

View File

@ -48,6 +48,7 @@ compare_render_tests = [
'empty-shadow',
'empty-texture',
'empty-transform',
'invalid-transform',
'opacity_clip',
'outset_shadow_offset_both',
'outset_shadow_offset_x',