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

Various small fixes

Closes #5380

See merge request GNOME/gtk!5662
This commit is contained in:
Benjamin Otte
2023-03-16 20:59:17 +00:00
4 changed files with 33 additions and 20 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

@@ -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

@@ -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