From a71388d2d6853dae8bffc7897b61917d80c616f4 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 8 Aug 2023 01:37:18 +0200 Subject: [PATCH 1/6] treeviewcolumn: Set ascending class for ascending order The alternative button order confused the code and so the "ascending" class was set for descending order by default, not when alternate order is set. --- gtk/deprecated/gtktreeviewcolumn.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/deprecated/gtktreeviewcolumn.c b/gtk/deprecated/gtktreeviewcolumn.c index 090cf33eb7..f22631c7a8 100644 --- a/gtk/deprecated/gtktreeviewcolumn.c +++ b/gtk/deprecated/gtktreeviewcolumn.c @@ -937,13 +937,13 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column) if ((!alternative && priv->sort_order == GTK_SORT_ASCENDING) || (alternative && priv->sort_order == GTK_SORT_DESCENDING)) { - gtk_widget_remove_css_class (arrow, "descending"); - gtk_widget_add_css_class (arrow, "ascending"); + gtk_widget_remove_css_class (arrow, "ascending"); + gtk_widget_add_css_class (arrow, "descending"); } else { - gtk_widget_remove_css_class (arrow, "ascending"); - gtk_widget_add_css_class (arrow, "descending"); + gtk_widget_remove_css_class (arrow, "descending"); + gtk_widget_add_css_class (arrow, "ascending"); } } From d1c7376b051666fab32557b6f6d853685fd58e3d Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 12 Aug 2023 22:13:07 +0200 Subject: [PATCH 2/6] gdkcontext: Make has_unpack_subimage() do the version check Makes the code look simpler when we actually use that function. --- gdk/gdkglcontext.c | 3 ++- gsk/gl/gskglcommandqueue.c | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 43d6440510..31c39467e5 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -1528,7 +1528,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context) if (gdk_gl_context_get_use_es (context)) { - priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage"); + priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) || + epoxy_has_gl_extension ("GL_EXT_unpack_subimage"); priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug"); } else diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index 4dd222b5d0..1cbd368500 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -1595,8 +1595,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self, { glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height, gl_format, gl_type, data); } - else if (stride % bpp == 0 && - (gdk_gl_context_check_version (self->context, NULL, "3.0") || gdk_gl_context_has_unpack_subimage (self->context))) + else if (stride % bpp == 0 && gdk_gl_context_has_unpack_subimage (self->context)) { glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp); From 07add0144e9f23ba39940e4fa12bd97683d2ed76 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 12 Aug 2023 22:14:11 +0200 Subject: [PATCH 3/6] columnview: Fix refcounting woes The new code did not deal with the GtkScrollInfo properly. Related: #6002 --- gtk/gtkcolumnview.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gtk/gtkcolumnview.c b/gtk/gtkcolumnview.c index c3db9d0e7f..f95738bfce 100644 --- a/gtk/gtkcolumnview.c +++ b/gtk/gtkcolumnview.c @@ -1798,6 +1798,8 @@ gtk_column_view_scroll_to_column (GtkColumnView *self, gtk_adjustment_get_page_size (self->hadjustment)); gtk_adjustment_set_value (self->hadjustment, new_value); + + g_clear_pointer (&scroll_info, gtk_scroll_info_unref); } void @@ -2214,9 +2216,14 @@ gtk_column_view_scroll_to (GtkColumnView *self, if (column && (flags & GTK_LIST_SCROLL_FOCUS)) gtk_column_view_set_focus_column (self, column, FALSE); - gtk_list_view_scroll_to (self->listview, pos, flags, scroll); + gtk_list_view_scroll_to (self->listview, + pos, + flags, + scroll ? gtk_scroll_info_ref (scroll) : NULL); if (column) gtk_column_view_scroll_to_column (self, column, scroll); + else + g_clear_pointer (&scroll, gtk_scroll_info_unref); } From 4cc5a54da31888891391b354fa4c8638ad35c00f Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 12 Aug 2023 22:16:24 +0200 Subject: [PATCH 4/6] viewport: Fix leak Fixes #6002 --- gtk/gtkviewport.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index 73ed29f877..91051ed055 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -744,5 +744,7 @@ gtk_viewport_scroll_to (GtkViewport *viewport, gtk_adjustment_animate_to_value (viewport->adjustment[GTK_ORIENTATION_HORIZONTAL], x); gtk_adjustment_animate_to_value (viewport->adjustment[GTK_ORIENTATION_VERTICAL], y); + + g_clear_pointer (&scroll, gtk_scroll_info_unref); } From dd4b8a4c89eeed4e9229c7c36d76aa5aac7f79ef Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 12 Aug 2023 22:17:29 +0200 Subject: [PATCH 5/6] gl: Pass swizzle array directly There's no need to pass pointers to arrays, as arrays are already pointers. --- gdk/gdkgltexture.c | 4 ++-- gdk/gdkmemoryformat.c | 4 ++-- gdk/gdkmemoryformatprivate.h | 2 +- gsk/gl/gskglcommandqueue.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c index d9d62190d9..c0c57f70cb 100644 --- a/gdk/gdkgltexture.c +++ b/gdk/gdkgltexture.c @@ -153,7 +153,7 @@ gdk_gl_texture_find_format (gboolean use_es, if (gdk_memory_format_alpha (format) != alpha) continue; - if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle)) + if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, q_swizzle)) continue; if (q_format != gl_format || q_type != gl_type) @@ -188,7 +188,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self, FALSE, major, minor, &gl_internal_format, - &gl_format, &gl_type, &gl_swizzle)) + &gl_format, &gl_type, gl_swizzle)) { if (download->stride == expected_stride && download->format == format) diff --git a/gdk/gdkmemoryformat.c b/gdk/gdkmemoryformat.c index ec5583a2ad..ff42f23617 100644 --- a/gdk/gdkmemoryformat.c +++ b/gdk/gdkmemoryformat.c @@ -739,12 +739,12 @@ gdk_memory_format_gl_format (GdkMemoryFormat format, guint *out_internal_format, guint *out_format, guint *out_type, - GLint (*out_swizzle)[4]) + GLint out_swizzle[4]) { *out_internal_format = memory_formats[format].gl.internal_format; *out_format = memory_formats[format].gl.format; *out_type = memory_formats[format].gl.type; - memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4); + memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4); if (gles) { diff --git a/gdk/gdkmemoryformatprivate.h b/gdk/gdkmemoryformatprivate.h index 9f56442de5..65041791f0 100644 --- a/gdk/gdkmemoryformatprivate.h +++ b/gdk/gdkmemoryformatprivate.h @@ -52,7 +52,7 @@ gboolean gdk_memory_format_gl_format (GdkMemoryFormat guint *out_internal_format, guint *out_format, guint *out_type, - GLint (*out_gizzle)[4]); + GLint out_gizzle[4]); void gdk_memory_convert (guchar *dest_data, gsize dest_stride, diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index 1cbd368500..0924b73993 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -1456,7 +1456,7 @@ memory_format_gl_format (GdkMemoryFormat data_format, guint *gl_internalformat, guint *gl_format, guint *gl_type, - GLint (*gl_swizzle)[4]) + GLint gl_swizzle[4]) { GdkMemoryDepth depth; @@ -1577,7 +1577,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self, &gl_internalformat, &gl_format, &gl_type, - &gl_swizzle); + gl_swizzle); gdk_texture_downloader_init (&downloader, texture); gdk_texture_downloader_set_format (&downloader, data_format); @@ -1683,7 +1683,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self, &gl_internalformat, &gl_format, &gl_type, - &gl_swizzle); + gl_swizzle); glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL); From 67a4279d3f3a3349d90071d9b1fecdc4e3ffb2da Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 12 Aug 2023 22:18:10 +0200 Subject: [PATCH 6/6] rendernode: Put typedef into gsktypes.h Makes includes simpler for headers that want to use GskRenderNode. --- gsk/gskrendernode.h | 1 - gsk/gsktypes.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/gsk/gskrendernode.h b/gsk/gskrendernode.h index 7024b47121..dd1e70904d 100644 --- a/gsk/gskrendernode.h +++ b/gsk/gskrendernode.h @@ -35,7 +35,6 @@ G_BEGIN_DECLS #define GSK_SERIALIZATION_ERROR (gsk_serialization_error_quark ()) -typedef struct _GskRenderNode GskRenderNode; typedef struct _GskColorStop GskColorStop; typedef struct _GskShadow GskShadow; diff --git a/gsk/gsktypes.h b/gsk/gsktypes.h index 2fba08a7cf..234f8fe1b0 100644 --- a/gsk/gsktypes.h +++ b/gsk/gsktypes.h @@ -29,6 +29,7 @@ typedef struct _GskPath GskPath; typedef struct _GskPathBuilder GskPathBuilder; typedef struct _GskPathPoint GskPathPoint; typedef struct _GskRenderer GskRenderer; +typedef struct _GskRenderNode GskRenderNode; typedef struct _GskStroke GskStroke; typedef struct _GskTransform GskTransform;