From 7698b4dd6321f7d1c94c237f765c57d0d3dff678 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 5 Oct 2020 21:27:23 -0400 Subject: [PATCH 1/5] treelistrowsorter: Add a bandaid The GtkTreeListRowSortKeys implementation doesn't know how it wants to cache its keys, and just crashes. Since that is not cool, add a bandaid fix that forces it to recreate its keys instead. Extra work, but hey, no crash. Related: #3228 --- gtk/gtktreelistrowsorter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtk/gtktreelistrowsorter.c b/gtk/gtktreelistrowsorter.c index 740a2ec17f..cf19296a93 100644 --- a/gtk/gtktreelistrowsorter.c +++ b/gtk/gtktreelistrowsorter.c @@ -210,6 +210,9 @@ gtk_tree_list_row_sort_keys_is_compatible (GtkSortKeys *keys, GtkTreeListRowSortKeys *self = (GtkTreeListRowSortKeys *) keys; GtkTreeListRowSortKeys *compare; + /* FIXME https://gitlab.gnome.org/GNOME/gtk/-/issues/3228 */ + return FALSE; + if (keys->klass != other->klass) return FALSE; From 214c35ffc70ae4ec82091e708bccef93afc95e34 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Oct 2020 07:09:13 -0400 Subject: [PATCH 2/5] gdk: Docs tweaks We don't have library initialization api anymore, update the section title to reflect that. --- gdk/gdk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdk/gdk.c b/gdk/gdk.c index b762831657..1cb48f411b 100644 --- a/gdk/gdk.c +++ b/gdk/gdk.c @@ -49,11 +49,11 @@ /** * SECTION:general - * @Short_description: Library initialization and miscellaneous functions + * @Short_description: Library initialization and versioning * @Title: General * - * This section describes the GDK initialization functions and miscellaneous - * utility functions, as well as deprecation facilities. + * This section describes miscellaneous macros and utility functions + * related to library versioning, as well as deprecation facilities. * * The GDK and GTK headers annotate deprecated APIs in a way that produces * compiler warnings if these deprecated APIs are used. The warnings From bdbfaef4d816edb6c1b3f9acd877b33361ca7553 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Oct 2020 09:25:47 -0400 Subject: [PATCH 3/5] gdk: Tweak our GL debug message callback Go back to installing our debug message callback unconditionally if G_ENABLE_CONSISTENCY_CHECKS is defined, and allow opting into it using GDK_DEBUG=gl-debug otherwise. --- gdk/gdkglcontext.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c index 01c67688f2..135db30140 100644 --- a/gdk/gdkglcontext.c +++ b/gdk/gdkglcontext.c @@ -864,7 +864,6 @@ gdk_gl_context_get_use_es (GdkGLContext *context) return priv->use_es > 0; } -#ifdef G_ENABLE_DEBUG static void gl_debug_message_callback (GLenum source, GLenum type, @@ -955,7 +954,6 @@ gl_debug_message_callback (GLenum source, g_warning ("OPENGL:\n Source: %s\n Type: %s\n Severity: %s\n Message: %s", message_source, message_type, message_severity, message); } -#endif /** * gdk_gl_context_realize: @@ -1011,15 +1009,19 @@ gdk_gl_context_check_extensions (GdkGLContext *context) #ifdef G_ENABLE_DEBUG display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)); gl_debug = GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG); +#endif - if (priv->has_debug_output && gl_debug) + if (priv->has_debug_output +#ifndef G_ENABLE_CONSISTENCY_CHECKS + && gl_debug +#endif + ) { gdk_gl_context_make_current (context); glEnable (GL_DEBUG_OUTPUT); glEnable (GL_DEBUG_OUTPUT_SYNCHRONOUS); glDebugMessageCallback (gl_debug_message_callback, NULL); } -#endif if (priv->use_es) { From 22eac2f407ba3503d88d5eb58b9a31566bb7e645 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Oct 2020 11:05:40 -0400 Subject: [PATCH 4/5] window: Fix setting min size We were inadvertedly setting the windows min size to the default size, making it so that you can never shrink a window below its default size. Fixes: #3235 --- gtk/gtkwindow.c | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 52e74e82be..c5c69e2b33 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -4220,13 +4220,13 @@ static void gtk_window_compute_default_size (GtkWindow *window, int max_width, int max_height, - int *width, - int *height) + int *min_width, + int *min_height, + int *nat_width, + int *nat_height) { GtkWidget *widget = GTK_WIDGET (window); - *width = max_width; - *height = max_height; if (gtk_widget_get_request_mode (widget) == GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT) { int minimum, natural; @@ -4234,13 +4234,15 @@ gtk_window_compute_default_size (GtkWindow *window, gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, -1, &minimum, &natural, NULL, NULL); - *height = MAX (minimum, MIN (*height, natural)); + *min_height = minimum; + *nat_height = MAX (minimum, MIN (max_height, natural)); gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, - *height, + *nat_height, &minimum, &natural, NULL, NULL); - *width = MAX (minimum, MIN (*width, natural)); + *min_width = minimum; + *nat_width = MAX (minimum, MIN (max_width, natural)); } else /* GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH or CONSTANT_SIZE */ { @@ -4249,13 +4251,15 @@ gtk_window_compute_default_size (GtkWindow *window, gtk_widget_measure (widget, GTK_ORIENTATION_HORIZONTAL, -1, &minimum, &natural, NULL, NULL); - *width = MAX (minimum, MIN (*width, natural)); + *min_width = minimum; + *nat_width = MAX (minimum, MIN (max_width, natural)); gtk_widget_measure (widget, GTK_ORIENTATION_VERTICAL, - *width, + *nat_width, &minimum, &natural, NULL, NULL); - *height = MAX (minimum, MIN (*height, natural)); + *min_height = minimum; + *nat_height = MAX (minimum, MIN (max_height, natural)); } } @@ -4270,8 +4274,8 @@ toplevel_compute_size (GdkToplevel *toplevel, int width, height; GtkBorder shadow; int bounds_width, bounds_height; - int default_width, default_height; int min_width, min_height; + int nat_width, nat_height; info = gtk_window_get_geometry_info (window, FALSE); @@ -4279,7 +4283,8 @@ toplevel_compute_size (GdkToplevel *toplevel, gtk_window_compute_default_size (window, bounds_width, bounds_height, - &default_width, &default_height); + &min_width, &min_height, + &nat_width, &nat_height); if (priv->need_default_size) { @@ -4291,8 +4296,8 @@ toplevel_compute_size (GdkToplevel *toplevel, gtk_window_get_remembered_size (window, &remembered_width, &remembered_height); - width = MAX (default_width, remembered_width); - height = MAX (default_height, remembered_height); + width = MAX (nat_width, remembered_width); + height = MAX (nat_height, remembered_height); /* Override with default size */ if (info) @@ -4307,9 +4312,9 @@ toplevel_compute_size (GdkToplevel *toplevel, INCLUDE_CSD_SIZE); if (info->default_width > 0) - width = min_width = default_width_csd; + width = default_width_csd; if (info->default_height > 0) - height = min_height = default_height_csd; + height = default_height_csd; } } else @@ -4349,8 +4354,9 @@ toplevel_compute_size (GdkToplevel *toplevel, get_shadow_width (window, &shadow); - min_width = MIN (default_width + shadow.left + shadow.right, width); - min_height = MIN (default_height + shadow.top + shadow.bottom, height); + min_width = MIN (min_width + shadow.left + shadow.right, width); + min_height = MIN (min_height + shadow.top + shadow.bottom, height); + gdk_toplevel_size_set_min_size (size, min_width, min_height); } From 44fd0c18c8b45a356e4400070b277bad320380ef Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 6 Oct 2020 12:53:46 -0400 Subject: [PATCH 5/5] aboutdialog: Fix updating license tab We need to update the license button visibility whenever the license type changes. --- gtk/gtkaboutdialog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index f3304fce2c..ce5c8efb78 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -2378,8 +2378,6 @@ gtk_about_dialog_set_license_type (GtkAboutDialog *about, g_free (license_string); gtk_widget_show (about->license_label); - update_license_button_visibility (about); - g_object_notify_by_pspec (G_OBJECT (about), props[PROP_WRAP_LICENSE]); g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LICENSE]); } @@ -2388,6 +2386,8 @@ gtk_about_dialog_set_license_type (GtkAboutDialog *about, gtk_widget_show (about->license_label); } + update_license_button_visibility (about); + g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LICENSE_TYPE]); g_object_thaw_notify (G_OBJECT (about));