Compare commits
18 Commits
main
...
cherry-pic
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d65e6fe116 | ||
|
|
04dc23d047 | ||
|
|
c95d677083 | ||
|
|
d87ac9761d | ||
|
|
ea7acdace3 | ||
|
|
f55cbf5643 | ||
|
|
a1912482ce | ||
|
|
8d18ef4f5c | ||
|
|
9af8f92ba1 | ||
|
|
d31dc4343b | ||
|
|
ce651ee924 | ||
|
|
96e0c0f095 | ||
|
|
f548ee93a2 | ||
|
|
a2d29d6a72 | ||
|
|
2c34a8a970 | ||
|
|
bd181cab67 | ||
|
|
f4a7c2a7c5 | ||
|
|
40bc44503a |
@@ -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),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)",
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user