Compare commits

...

18 Commits

Author SHA1 Message Date
Benjamin Otte
d65e6fe116 Merge branch 'wip/otte/for-main' into 'main'
treelistmodel: Clear item in right place

Closes #5681

See merge request GNOME/gtk!5682

(cherry picked from commit 56b904f1e6)

dd1e76e6 treelistmodel: Clear item in right place
2023-03-19 13:10:07 -04:00
Benjamin Otte
04dc23d047 Merge branch 'cherry-pick-f211a217' into 'gtk-4-10'
Merge branch 'wip/otte/for-main' into 'main'

See merge request GNOME/gtk!5679
2023-03-19 14:37:46 +00:00
Matthias Clasen
c95d677083 Merge branch 'for-4-10' into 'gtk-4-10'
[4.10] Cherry-pick "listitem: Claim sequence when handling an event"

See merge request GNOME/gtk!5680
2023-03-19 14:23:16 +00:00
Benjamin Otte
d87ac9761d listitem: Claim sequence when handling an event
See my rants on IRC for why we definitely need to claim gestures by
default in GTK5.

Fixes #5669
2023-03-19 12:12:40 +00:00
Benjamin Otte
ea7acdace3 Merge branch 'wip/otte/for-main' into 'main'
Fix inspector doing weird stuff

Closes #5646

See merge request GNOME/gtk!5678

(cherry picked from commit f211a2177f)

f4be5c80 cssnode: Refer the correct previous item
9048e391 treelistmodel: Cache the item
bf556850 treelistmodel: Track the item in the row
c4636852 treelistmodel: Clarify docs
2023-03-19 02:24:01 -04:00
Danial Behzadi
f55cbf5643 Update Persian translation 2023-03-18 01:10:45 +00:00
Matthias Clasen
a1912482ce Merge branch 'cherry-pick-565c9aed' into 'gtk-4-10'
Merge branch 'gridview-filler-tile-fix' into 'main'

See merge request GNOME/gtk!5666
2023-03-17 04:54:23 +00:00
Benjamin Otte
8d18ef4f5c Merge branch 'gridview-filler-tile-fix' into 'main'
gridview: Fix condition for adding filler tiles

See merge request GNOME/gtk!5664

(cherry picked from commit 565c9aed94)

65b6150e gridview: Fix condition for adding filler tiles
2023-03-16 19:50:28 -04:00
Benjamin Otte
9af8f92ba1 Merge branch 'cherry-pick-fbc8bfb3' into 'gtk-4-10'
Merge branch 'wip/otte/for-main' into 'main'

See merge request GNOME/gtk!5663
2023-03-16 21:46:28 +00:00
Benjamin Otte
d31dc4343b Merge branch 'wip/otte/for-main' into 'main'
Various small fixes

Closes #5380

See merge request GNOME/gtk!5662

(cherry picked from commit fbc8bfb303)

707c63c6 win32: Fix rowstride math
ef3c515c rowstrides are gsize, not int
a0382ef4 listview: Fix culling issues when using CSS padding
2023-03-16 17:05:40 -04:00
Matthias Clasen
ce651ee924 Merge branch 'drag-gl-wayland-hotspot-fix-4-10' into 'gtk-4-10'
[4.10] wayland: Reset pending offset in GL path

See merge request GNOME/gtk!5660
2023-03-16 19:48:45 +00:00
Ivan Molodetskikh
96e0c0f095 wayland: Reset pending offset in GL path
Otherwise GL surfaces that redraw without changing the hotspot have it
applied on top every frame and quickly slide away.

The cairo path and the X11 backend do not have this bug.
2023-03-16 10:54:15 -07:00
Kukuh Syafaat
f548ee93a2 Update Indonesian translation 2023-03-15 12:03:47 +00:00
Changwoo Ryu
a2d29d6a72 Update Korean translation 2023-03-15 10:04:10 +00:00
Aleksandr Melman
2c34a8a970 Update Russian translation 2023-03-14 21:01:53 +00:00
Martin
bd181cab67 Update Slovenian translation 2023-03-14 17:19:43 +00:00
Benjamin Otte
f4a7c2a7c5 Merge branch 'cherry-pick-a05b73cb' into 'gtk-4-10'
Merge branch 'wip/hadess/children-left-msg' into 'main'

See merge request GNOME/gtk!5653
2023-03-14 16:32:44 +00:00
Benjamin Otte
40bc44503a Merge branch 'wip/hadess/children-left-msg' into 'main'
gtk: Fix "children left" warning with fatal warnings

See merge request GNOME/gtk!5652

(cherry picked from commit a05b73cb05)

4f1ea18c gtk: Fix "children left" warning with fatal warnings
2023-03-14 12:32:00 -04:00
16 changed files with 2702 additions and 2594 deletions

View File

@@ -395,7 +395,7 @@ gdk_texture_new_for_pixbuf (GdkPixbuf *pixbuf)
bytes = g_bytes_new_with_free_func (gdk_pixbuf_get_pixels (pixbuf),
gdk_pixbuf_get_height (pixbuf)
* gdk_pixbuf_get_rowstride (pixbuf),
* (gsize) gdk_pixbuf_get_rowstride (pixbuf),
g_object_unref,
g_object_ref (pixbuf));
texture = gdk_memory_texture_new (gdk_pixbuf_get_width (pixbuf),

View File

@@ -65,6 +65,9 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
int dx = impl->pending_buffer_offset_x;
int dy = impl->pending_buffer_offset_y;
impl->pending_buffer_offset_x = 0;
impl->pending_buffer_offset_y = 0;
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
@@ -118,7 +121,7 @@ gdk_wayland_display_init_gl (GdkDisplay *display,
{
GdkWaylandDisplay *self = GDK_WAYLAND_DISPLAY (display);
if (!gdk_display_init_egl (display,
if (!gdk_display_init_egl (display,
EGL_PLATFORM_WAYLAND_EXT,
self->wl_display,
TRUE,

View File

@@ -1005,7 +1005,8 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
} bmi;
HDC hdc;
uint8_t *pixels, *bits;
int rowstride, x, y, w, h;
int x, y, w, h;
gsize rowstride;
if (!GDI_CALL (GetIconInfo, (hicon, &ii)))
return NULL;
@@ -1057,7 +1058,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
no_alpha = FALSE;
pixels += 4;
}
pixels += (w * 4 - rowstride);
pixels += rowstride - w * 4;
}
/* mask */
@@ -1072,7 +1073,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
pixels[3] = 255 - bits[(x + y * w) * 4];
pixels += 4;
}
pixels += (w * 4 - rowstride);
pixels += rowstride - w * 4;
}
}
}
@@ -1146,7 +1147,7 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon,
xorp++;
}
}
pixels += (w * 4 - rowstride);
pixels += rowstride - w * 4;
}
}

View File

@@ -284,7 +284,8 @@ extract_plane (GdkPixbuf *src,
int to_plane)
{
guchar *src_data, *dst_data;
int width, height, src_stride, dst_stride;
int width, height;
gsize src_stride, dst_stride;
guchar *src_row, *dst_row;
int x, y;

View File

@@ -713,7 +713,7 @@ gtk_css_node_reposition (GtkCssNode *node,
{
GTK_CSS_NODE_GET_CLASS (old_parent)->node_removed (old_parent, node, node->previous_sibling);
if (old_parent->children_observer && old_parent != new_parent)
gtk_list_list_model_item_removed (old_parent->children_observer, previous);
gtk_list_list_model_item_removed (old_parent->children_observer, old_previous);
if (old_parent->first_child && node->visible)
gtk_css_node_invalidate (old_parent->first_child, GTK_CSS_CHANGE_NTH_LAST_CHILD);
}

View File

@@ -820,7 +820,7 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
}
}
/* Add a filler tile for empty space in the bottom right */
if (i < self->n_columns)
if (i > 0)
{
GtkListTile *filler;
tile = gtk_list_item_manager_get_last (self->item_manager);

View File

@@ -23,6 +23,7 @@
#include "gtkadjustment.h"
#include "gtkbitset.h"
#include "gtkcssboxesprivate.h"
#include "gtkcssnodeprivate.h"
#include "gtkcsspositionvalueprivate.h"
#include "gtkdragsourceprivate.h"
@@ -1324,6 +1325,8 @@ update_autoscroll (GtkListBase *self,
/*
* gtk_list_base_size_allocate_child:
* @self: The listbase
* @boxes: The CSS boxes of @self to allow for proper
* clipping
* @child: The child
* @x: top left coordinate in the across direction
* @y: top right coordinate in the along direction
@@ -1336,6 +1339,7 @@ update_autoscroll (GtkListBase *self,
**/
static void
gtk_list_base_size_allocate_child (GtkListBase *self,
GtkCssBoxes *boxes,
GtkWidget *child,
int x,
int y,
@@ -1343,10 +1347,9 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
int height)
{
GtkAllocation child_allocation;
int self_width, self_height;
int self_width;
self_width = gtk_widget_get_width (GTK_WIDGET (self));
self_height = gtk_widget_get_height (GTK_WIDGET (self));
if (gtk_list_base_get_orientation (GTK_LIST_BASE (self)) == GTK_ORIENTATION_VERTICAL)
{
@@ -1379,14 +1382,14 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
child_allocation.height = width;
}
if (!gdk_rectangle_intersect (&child_allocation,
&(GdkRectangle) {
- GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
- GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
self_width + GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
self_height + GTK_LIST_BASE_CHILD_MAX_OVERDRAW
},
NULL))
if (!graphene_rect_intersection (gtk_css_boxes_get_padding_rect (boxes),
&GRAPHENE_RECT_INIT(
child_allocation.x + GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
child_allocation.y + GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
child_allocation.width + 2 * GTK_LIST_BASE_CHILD_MAX_OVERDRAW,
child_allocation.height + 2 * GTK_LIST_BASE_CHILD_MAX_OVERDRAW
),
NULL))
{
/* child is fully outside the viewport, hide it and don't allocate it */
gtk_widget_set_child_visible (child, FALSE);
@@ -1399,7 +1402,8 @@ gtk_list_base_size_allocate_child (GtkListBase *self,
}
static void
gtk_list_base_allocate_children (GtkListBase *self)
gtk_list_base_allocate_children (GtkListBase *self,
GtkCssBoxes *boxes)
{
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
GtkListTile *tile;
@@ -1415,6 +1419,7 @@ gtk_list_base_allocate_children (GtkListBase *self)
if (tile->widget)
{
gtk_list_base_size_allocate_child (GTK_LIST_BASE (self),
boxes,
tile->widget,
tile->area.x - dx,
tile->area.y - dy,
@@ -1511,7 +1516,8 @@ gtk_list_base_get_rubberband_coords (GtkListBase *self,
}
static void
gtk_list_base_allocate_rubberband (GtkListBase *self)
gtk_list_base_allocate_rubberband (GtkListBase *self,
GtkCssBoxes *boxes)
{
GtkListBasePrivate *priv = gtk_list_base_get_instance_private (self);
GtkRequisition min_size;
@@ -1531,6 +1537,7 @@ gtk_list_base_allocate_rubberband (GtkListBase *self)
rect.y -= offset_y;
gtk_list_base_size_allocate_child (self,
boxes,
priv->rubberband->widget,
rect.x, rect.y, rect.width, rect.height);
}
@@ -1974,10 +1981,14 @@ gtk_list_base_update_adjustments (GtkListBase *self)
void
gtk_list_base_allocate (GtkListBase *self)
{
GtkCssBoxes boxes;
gtk_css_boxes_init (&boxes, GTK_WIDGET (self));
gtk_list_base_update_adjustments (self);
gtk_list_base_allocate_children (self);
gtk_list_base_allocate_rubberband (self);
gtk_list_base_allocate_children (self, &boxes);
gtk_list_base_allocate_rubberband (self, &boxes);
}
GtkScrollablePolicy

View File

@@ -480,6 +480,7 @@ gtk_list_item_widget_click_gesture_released (GtkGestureClick *gesture,
extend = (state & GDK_SHIFT_MASK) != 0;
modify = (state & GDK_CONTROL_MASK) != 0;
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
gtk_widget_activate_action (GTK_WIDGET (self),
"list.select-item",
"(ubb)",

View File

@@ -45,6 +45,7 @@ typedef struct _TreeAugment TreeAugment;
struct _TreeNode
{
gpointer item;
GListModel *model;
GtkTreeListRow *row;
GtkRbTree *children;
@@ -87,6 +88,7 @@ struct _GtkTreeListRow
GObject parent_instance;
TreeNode *node; /* NULL when the row has been destroyed */
gpointer item;
};
struct _GtkTreeListRowClass
@@ -159,50 +161,6 @@ tree_node_get_n_children (TreeNode *node)
return child_aug->n_items;
}
static guint
tree_node_get_local_position (GtkRbTree *tree,
TreeNode *node)
{
TreeNode *left, *parent;
TreeAugment *left_aug;
guint n;
left = gtk_rb_tree_node_get_left (node);
if (left)
{
left_aug = gtk_rb_tree_get_augment (tree, left);
n = left_aug->n_local;
}
else
{
n = 0;
}
for (parent = gtk_rb_tree_node_get_parent (node);
parent;
parent = gtk_rb_tree_node_get_parent (node))
{
left = gtk_rb_tree_node_get_left (parent);
if (left == node)
{
/* we are the left node, nothing changes */
}
else
{
/* we are the right node */
n++;
if (left)
{
left_aug = gtk_rb_tree_get_augment (tree, left);
n += left_aug->n_local;
}
}
node = parent;
}
return n;
}
static guint
tree_node_get_position (TreeNode *node)
{
@@ -316,30 +274,15 @@ static GListModel *
tree_node_create_model (GtkTreeListModel *self,
TreeNode *node)
{
TreeNode *parent = node->parent;
GListModel *model;
GObject *item;
item = g_list_model_get_item (parent->model,
tree_node_get_local_position (parent->children, node));
model = self->create_func (item, self->user_data);
g_object_unref (item);
model = self->create_func (node->item, self->user_data);
if (model == NULL)
node->empty = TRUE;
return model;
}
static gpointer
tree_node_get_item (TreeNode *node)
{
TreeNode *parent;
parent = node->parent;
return g_list_model_get_item (parent->model,
tree_node_get_local_position (parent->children, node));
}
static GtkTreeListRow *
tree_node_get_row (TreeNode *node)
{
@@ -351,6 +294,7 @@ tree_node_get_row (TreeNode *node)
{
node->row = g_object_new (GTK_TYPE_TREE_LIST_ROW, NULL);
node->row->node = node;
node->row->item = g_object_ref (node->item);
return node->row;
}
@@ -417,6 +361,8 @@ gtk_tree_list_model_items_changed_cb (GListModel *model,
{
child = gtk_rb_tree_insert_before (node->children, child);
child->parent = node;
child->item = g_list_model_get_item (model, position + i);
g_assert (child->item);
}
if (self->autoexpand)
{
@@ -462,6 +408,8 @@ gtk_tree_list_model_clear_node (gpointer data)
gtk_tree_list_row_destroy (node->row);
gtk_tree_list_model_clear_node_children (node);
g_clear_object (&node->item);
}
static void
@@ -516,6 +464,8 @@ gtk_tree_list_model_init_node (GtkTreeListModel *list,
{
node = gtk_rb_tree_insert_after (self->children, node);
node->parent = self;
node->item = g_list_model_get_item (model, i);
g_assert (node ->item);
if (list->autoexpand)
gtk_tree_list_model_expand_node (list, node);
}
@@ -596,7 +546,7 @@ gtk_tree_list_model_get_item (GListModel *list,
if (self->passthrough)
{
return tree_node_get_item (node);
return g_object_ref (node->item);
}
else
{
@@ -997,13 +947,13 @@ gtk_tree_list_row_destroy (GtkTreeListRow *self)
{
g_object_freeze_notify (G_OBJECT (self));
self->node = NULL;
/* FIXME: We could check some properties to avoid excess notifies */
g_object_notify_by_pspec (G_OBJECT (self), row_properties[ROW_PROP_DEPTH]);
g_object_notify_by_pspec (G_OBJECT (self), row_properties[ROW_PROP_EXPANDABLE]);
g_object_notify_by_pspec (G_OBJECT (self), row_properties[ROW_PROP_EXPANDED]);
g_object_notify_by_pspec (G_OBJECT (self), row_properties[ROW_PROP_ITEM]);
self->node = NULL;
g_object_thaw_notify (G_OBJECT (self));
}
@@ -1071,6 +1021,8 @@ gtk_tree_list_row_dispose (GObject *object)
if (self->node)
self->node->row = NULL;
g_clear_object (&self->item);
G_OBJECT_CLASS (gtk_tree_list_row_parent_class)->dispose (object);
}
@@ -1171,7 +1123,8 @@ gtk_tree_list_row_get_position (GtkTreeListRow *self)
* of zero, rows corresponding to items of models of direct children
* of the root model have a depth of 1 and so on.
*
* The depth of a row never changes until the row is destroyed.
* The depth of a row never changes until the row is removed from its model
* at which point it will forever return 0.
*
* Returns: The depth of this row
*/
@@ -1279,7 +1232,8 @@ gtk_tree_list_row_get_expanded (GtkTreeListRow *self)
* This does not mean that the row is actually expanded,
* this can be checked with [method@Gtk.TreeListRow.get_expanded].
*
* If a row is expandable never changes until the row is destroyed.
* If a row is expandable never changes until the row is removed
* from its model at which point it will forever return %FALSE.
*
* Returns: %TRUE if the row is expandable
*/
@@ -1317,21 +1271,16 @@ gtk_tree_list_row_is_expandable (GtkTreeListRow *self)
*
* Gets the item corresponding to this row,
*
* The value returned by this function never changes until the
* row is destroyed.
*
* Returns: (nullable) (type GObject) (transfer full): The item
* of this row or %NULL when the row was destroyed
* of this row. This function is only marked as nullable for backwards
* compatibility reasons.
*/
gpointer
gtk_tree_list_row_get_item (GtkTreeListRow *self)
{
g_return_val_if_fail (GTK_IS_TREE_LIST_ROW (self), NULL);
if (self->node == NULL)
return NULL;
return tree_node_get_item (self->node);
return g_object_ref (self->item);
}
/**
@@ -1371,7 +1320,8 @@ gtk_tree_list_row_get_children (GtkTreeListRow *self)
* %NULL is returned.
*
* The value returned by this function never changes
* until the row is destroyed.
* until the row is removed from its model at which point
* it will forever return %NULL.
*
* Returns: (nullable) (transfer full): The parent of @self
*/

View File

@@ -7637,14 +7637,20 @@ gtk_widget_finalize (GObject *object)
if (_gtk_widget_get_first_child (widget) != NULL)
{
GtkWidget *child;
g_warning ("Finalizing %s %p, but it still has children left:",
gtk_widget_get_name (widget), widget);
GString *s;
s = g_string_new (NULL);
g_string_append_printf (s, "Finalizing %s %p, but it still has children left:",
gtk_widget_get_name (widget), widget);
for (child = _gtk_widget_get_first_child (widget);
child != NULL;
child = _gtk_widget_get_next_sibling (child))
{
g_warning (" - %s %p", gtk_widget_get_name (child), child);
g_string_append_printf (s, "\n - %s %p",
gtk_widget_get_name (child), child);
}
g_warning ("%s", s->str);
g_string_free (s, TRUE);
}
if (g_object_is_floating (object))

1811
po/fa.po

File diff suppressed because it is too large Load Diff

595
po/id.po

File diff suppressed because it is too large Load Diff

362
po/ko.po

File diff suppressed because it is too large Load Diff

543
po/ru.po

File diff suppressed because it is too large Load Diff

1806
po/sl.po

File diff suppressed because it is too large Load Diff

View File

@@ -151,6 +151,12 @@ test_type (gconstpointer data)
if ((pspec->flags & G_PARAM_READABLE) == 0)
continue;
/* This is set by the treelistmodel, plain
* g_object_new() will crash here */
if (g_type_is_a (type, GTK_TYPE_TREE_LIST_ROW) &&
(strcmp (pspec->name, "item") == 0))
continue;
/* This is set via class_init, and we have a11y tests to verify it */
if (g_type_is_a (type, GTK_TYPE_ACCESSIBLE) &&
strcmp (pspec->name, "accessible-role") == 0)