From dc3b140fd7aece1280272d70e7df8ae348f2377c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 13:48:08 -0400 Subject: [PATCH 01/11] Cosmetics --- gsk/gl/gskglrenderer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 4cfe31535c..16a76dbff8 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -1120,7 +1120,7 @@ compile_glshader (GskGLRenderer *self, program->glshader.texture_locations[2] = glGetUniformLocation(program->id, "u_texture3"); program->glshader.texture_locations[3] = glGetUniformLocation(program->id, "u_texture4"); - /* We use u_textue1 for the texture 0 in the glshaders, so alias it here so we can use the regular setters */ + /* We use u_texture1 for the texture 0 in the glshaders, so alias it here so we can use the regular setters */ program->source_location = program->glshader.texture_locations[0]; for (int i = 0; i < G_N_ELEMENTS (program->glshader.args_locations); i++) From ffb51b6888f9b199f31434cfeca89203130471c7 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 15:08:50 -0400 Subject: [PATCH 02/11] Require gtk-doc 1.33 We'll hopefully get a gtk-doc release out with that version number soon. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ac940638fc..ab4e0a1f31 100644 --- a/meson.build +++ b/meson.build @@ -383,7 +383,7 @@ graphene_dep = dependency('graphene-gobject-1.0', version: graphene_req, fallback: ['graphene', 'graphene_dep']) iso_codes_dep = dependency('iso-codes', required: false) -gtk_doc_dep = dependency('gtk-doc', version: '>=1.99', +gtk_doc_dep = dependency('gtk-doc', version: '>=1.33', fallback: ['gtk-doc', 'dummy_dep'], default_options: ['tests=false', 'yelp_manual=false'], required: get_option('gtk_doc')) From 4d90259b9bfcac6f24d9168ab4b505452c7c832b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 15:11:37 -0400 Subject: [PATCH 03/11] Use gtk-doc from master I've merged the relevant parts from the gtk-doc-for-gtk4 branch. --- subprojects/gtk-doc.wrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subprojects/gtk-doc.wrap b/subprojects/gtk-doc.wrap index 2f71008fc3..79ec37220a 100644 --- a/subprojects/gtk-doc.wrap +++ b/subprojects/gtk-doc.wrap @@ -1,5 +1,5 @@ [wrap-git] directory=gtk-doc url=https://gitlab.gnome.org/GNOME/gtk-doc.git -revision=gtk-doc-for-gtk4 +revision=master depth=1 From f4bfa16136dc08868fd58434b3d7f3dccd9a72bf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 15:14:33 -0400 Subject: [PATCH 04/11] Update the release script If things go according to plan, we don't need to include gtk-doc as a subproject in the next snapshot. --- make-release.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/make-release.sh b/make-release.sh index 69a4a0d037..905e223dc8 100755 --- a/make-release.sh +++ b/make-release.sh @@ -10,10 +10,10 @@ if [ -d ${release_build_dir} ]; then fi # we include gtk-doc since we need the gtk-doc-for-gtk4 branch -meson setup --force-fallback-for gtk-doc ${release_build_dir} || exit +meson setup ${release_build_dir} || exit # make the release tarball -meson dist -C${release_build_dir} --include-subprojects || exit +meson dist -C${release_build_dir} || exit # now build the docs meson configure -Dgtk_doc=true ${release_build_dir} || exit From c43d535aabd532eb76512e4d864d40c99804b8f5 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 17:07:53 -0400 Subject: [PATCH 05/11] docs: Fix a copy-paste error --- gtk/gtkpicture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gtk/gtkpicture.c b/gtk/gtkpicture.c index 9c2b87c9e7..fc030fd80d 100644 --- a/gtk/gtkpicture.c +++ b/gtk/gtkpicture.c @@ -62,7 +62,7 @@ * * # Accessibility * - * GtkImage uses the #GTK_ACCESSIBLE_ROLE_IMG role. + * GtkPicture uses the #GTK_ACCESSIBLE_ROLE_IMG role. */ enum From 3cf8904d0bf7549644c912ece587426829290735 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 17:14:58 -0400 Subject: [PATCH 06/11] Add GTK_INPUT_HINT_PRIVATE Add a flag that requests that input methods should not update personalized data (such as typing history). Fixes: #2261 --- gtk/gtkenums.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index be5bd75a9e..d1ca41cb1a 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -866,6 +866,8 @@ typedef enum * @GTK_INPUT_HINT_VERTICAL_WRITING: The text is vertical * @GTK_INPUT_HINT_EMOJI: Suggest offering Emoji support * @GTK_INPUT_HINT_NO_EMOJI: Suggest not offering Emoji support + * @GTK_INPUT_HINT_PRIVATE: Request that the input method should not + * update personalized data (like typing history) * * Describes hints that might be taken into account by input methods * or applications. Note that input methods may already tailor their @@ -890,7 +892,8 @@ typedef enum GTK_INPUT_HINT_INHIBIT_OSK = 1 << 7, GTK_INPUT_HINT_VERTICAL_WRITING = 1 << 8, GTK_INPUT_HINT_EMOJI = 1 << 9, - GTK_INPUT_HINT_NO_EMOJI = 1 << 10 + GTK_INPUT_HINT_NO_EMOJI = 1 << 10, + GTK_INPUT_HINT_PRIVATE = 1 << 11, } GtkInputHints; /** From c9f3034e826ace06541d4ae967e4130db3c849b3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 19:33:43 -0400 Subject: [PATCH 07/11] gdk: Remove an unused variable --- gdk/gdkglobals.c | 1 - 1 file changed, 1 deletion(-) diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c index 644dcfa63f..22b4cf0f44 100644 --- a/gdk/gdkglobals.c +++ b/gdk/gdkglobals.c @@ -30,4 +30,3 @@ #include guint _gdk_debug_flags = 0; -GList *_gdk_default_filters = NULL; From f6bd2f4d3fa81d02b810093378cbf1ad5ea39da4 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 21:25:39 -0400 Subject: [PATCH 08/11] Add a test for gsk_gl_shader_compile This is not super useful, but at least we can test that we get an error message including the shader text. --- testsuite/gsk/shader.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/testsuite/gsk/shader.c b/testsuite/gsk/shader.c index 7983d94c04..555acb0869 100644 --- a/testsuite/gsk/shader.c +++ b/testsuite/gsk/shader.c @@ -201,6 +201,40 @@ test_format_args (void) g_object_unref (shader); } +static void +test_compile (void) +{ + GBytes *bytes; + GskGLShader *shader; + GdkSurface *surface; + GskRenderer *renderer; + GError *error = NULL; + gboolean ret; + + bytes = g_bytes_new_static ("blaat", 6); + shader = gsk_gl_shader_new_from_bytes (bytes); + g_assert_nonnull (shader); + + surface = gdk_surface_new_toplevel (gdk_display_get_default ()); + renderer = gsk_renderer_new_for_surface (surface); + g_assert_nonnull (renderer); + + ret = gsk_gl_shader_compile (shader, renderer, &error); + + g_assert_false (ret); + g_assert_nonnull (error); + if (g_str_equal (G_OBJECT_TYPE_NAME (renderer), "GskGLRenderer")) + g_assert_nonnull (strstr (error->message, "blaat")); + else + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED); + g_clear_error (&error); + + gsk_renderer_unrealize (renderer); + g_object_unref (renderer); + g_object_unref (surface); + g_bytes_unref (bytes); +} + int main (int argc, char *argv[]) @@ -210,6 +244,7 @@ main (int argc, g_test_add_func ("/shader/create/simple", test_create_simple); g_test_add_func ("/shader/create/data", test_create_data); g_test_add_func ("/shader/format-args", test_format_args); + g_test_add_func ("/shader/compile", test_compile); return g_test_run (); } From da8ee53e2de2d0891f37b72fe434f659ed1b8f33 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 1 Oct 2020 23:35:06 -0400 Subject: [PATCH 09/11] emojichooser: Allow inserting multiple Emoji Don't close the Emoji chooser when the Control key is held while clicking. So you can insert multiple Emoji without having to reopen the chooser every time. Fixes: #1002 --- gtk/gtkemojichooser.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/gtk/gtkemojichooser.c b/gtk/gtkemojichooser.c index 55c8f328ad..e660e6c5aa 100644 --- a/gtk/gtkemojichooser.c +++ b/gtk/gtkemojichooser.c @@ -378,6 +378,22 @@ add_recent_item (GtkEmojiChooser *chooser, g_variant_unref (item); } +static gboolean +should_close (GtkEmojiChooser *chooser) +{ + GdkDisplay *display; + GdkSeat *seat; + GdkDevice *device; + GdkModifierType state; + + display = gtk_widget_get_display (GTK_WIDGET (chooser)); + seat = gdk_display_get_default_seat (display); + device = gdk_seat_get_keyboard (seat); + state = gdk_device_get_modifier_state (device); + + return (state & GDK_CONTROL_MASK) == 0; +} + static void emoji_activated (GtkFlowBox *box, GtkFlowBoxChild *child, @@ -389,7 +405,16 @@ emoji_activated (GtkFlowBox *box, GVariant *item; gunichar modifier; - gtk_popover_popdown (GTK_POPOVER (chooser)); + if (should_close (chooser)) + gtk_popover_popdown (GTK_POPOVER (chooser)); + else + { + GtkWidget *popover; + + popover = gtk_widget_get_ancestor (GTK_WIDGET (box), GTK_TYPE_POPOVER); + if (popover != GTK_WIDGET (chooser)) + gtk_popover_popdown (GTK_POPOVER (popover)); + } label = gtk_flow_box_child_get_child (child); text = g_strdup (gtk_label_get_label (GTK_LABEL (label))); From 9033336a2347fe74687cce4912a98cac98105bf6 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 2 Oct 2020 22:28:17 -0400 Subject: [PATCH 10/11] css: Move _gtk_css_print_string around Move this to a separate header, since it is not parser functionality, and kill the duplicate gtkcssparserprivate.h header. --- gsk/gskrendernodeparser.c | 1 + gtk/css/gtkcssparserprivate.h | 3 --- .../gtkcssserializer.c} | 6 +++-- .../gtkcssserializerprivate.h} | 26 ++++++++++++------- gtk/css/meson.build | 1 + gtk/gtkcssarrayvalueprivate.h | 4 ++- gtk/gtkcssbgsizevalueprivate.h | 4 ++- gtk/gtkcssbordervalueprivate.h | 4 ++- gtk/gtkcsscolorvalueprivate.h | 4 ++- gtk/gtkcsscornervalueprivate.h | 4 ++- gtk/gtkcsseasevalueprivate.h | 4 ++- gtk/gtkcssenumvalueprivate.h | 4 ++- gtk/gtkcssfiltervalueprivate.h | 4 ++- gtk/gtkcssfontfeaturesvalue.c | 4 ++- gtk/gtkcssfontfeaturesvalueprivate.h | 4 ++- gtk/gtkcssfontvariationsvalue.c | 4 ++- gtk/gtkcssfontvariationsvalueprivate.h | 4 ++- gtk/gtkcssimageicontheme.c | 1 + gtk/gtkcssimageprivate.h | 4 ++- gtk/gtkcsskeyframesprivate.h | 4 ++- gtk/gtkcssnumbervalueprivate.h | 4 ++- gtk/gtkcsspalettevalueprivate.h | 4 ++- gtk/gtkcsspositionvalueprivate.h | 4 ++- gtk/gtkcssprovider.c | 4 ++- gtk/gtkcssrepeatvalueprivate.h | 4 ++- gtk/gtkcssselectorprivate.h | 4 ++- gtk/gtkcssshadowvalueprivate.h | 4 ++- gtk/gtkcssshorthandpropertyprivate.h | 4 ++- gtk/gtkcssstringvalue.c | 1 + gtk/gtkcssstringvalueprivate.h | 4 ++- gtk/gtkcssstylepropertyimpl.c | 4 ++- gtk/gtkcsstransformvalueprivate.h | 4 ++- gtk/gtkstyleproperty.c | 4 ++- gtk/gtkstylepropertyprivate.h | 4 ++- gtk/meson.build | 1 - 35 files changed, 105 insertions(+), 43 deletions(-) rename gtk/{gtkcssparser.c => css/gtkcssserializer.c} (93%) rename gtk/{gtkcssparserprivate.h => css/gtkcssserializerprivate.h} (59%) diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index 667a68f8a9..06d1bdb4d2 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -32,6 +32,7 @@ #include #include "gtk/css/gtkcssdataurlprivate.h" #include "gtk/css/gtkcssparserprivate.h" +#include "gtk/css/gtkcssserializerprivate.h" #ifdef CAIRO_HAS_SCRIPT_SURFACE #include diff --git a/gtk/css/gtkcssparserprivate.h b/gtk/css/gtkcssparserprivate.h index 9239477020..349ad67999 100644 --- a/gtk/css/gtkcssparserprivate.h +++ b/gtk/css/gtkcssparserprivate.h @@ -151,9 +151,6 @@ gsize gtk_css_parser_consume_any (GtkCssParser gsize n_options, gpointer user_data); - -void _gtk_css_print_string (GString *str, - const char *string); G_END_DECLS #endif /* __GTK_CSS_PARSER_H__ */ diff --git a/gtk/gtkcssparser.c b/gtk/css/gtkcssserializer.c similarity index 93% rename from gtk/gtkcssparser.c rename to gtk/css/gtkcssserializer.c index bb5b0a8c4a..838a7fb3f4 100644 --- a/gtk/gtkcssparser.c +++ b/gtk/css/gtkcssserializer.c @@ -17,8 +17,11 @@ #include "config.h" -#include "gtkcssparserprivate.h" +#include "gtkcssserializerprivate.h" +/* Escape a string so that it can be parsed + * as a css string again. + */ void _gtk_css_print_string (GString *str, const char *string) @@ -63,4 +66,3 @@ _gtk_css_print_string (GString *str, out: g_string_append_c (str, '"'); } - diff --git a/gtk/gtkcssparserprivate.h b/gtk/css/gtkcssserializerprivate.h similarity index 59% rename from gtk/gtkcssparserprivate.h rename to gtk/css/gtkcssserializerprivate.h index 68fa8a18d2..2d1a16949f 100644 --- a/gtk/gtkcssparserprivate.h +++ b/gtk/css/gtkcssserializerprivate.h @@ -1,10 +1,10 @@ -/* GTK - The GIMP Toolkit - * Copyright (C) 2011 Benjamin Otte +/* + * Copyright © 2020 Red Hat, Inc * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. + * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,15 +13,21 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . + * + * Authors: Matthias Clasen */ -#ifndef __GTK_CSS_PARSER_PRIVATE_H__ -#define __GTK_CSS_PARSER_PRIVATE_H__ -#include +#ifndef __GTK_CSS_SERIALIZER_H__ +#define __GTK_CSS_SERIALIZER_H__ -#include -#include "gtk/css/gtkcsstokenizerprivate.h" -#include "gtk/css/gtkcssparserprivate.h" +#include -#endif /* __GTK_CSS_PARSER_PRIVATE_H__ */ +G_BEGIN_DECLS + +void _gtk_css_print_string (GString *str, + const char *string); + +G_END_DECLS + +#endif /* __GTK_CSS_SERIALIZER_H__ */ diff --git a/gtk/css/meson.build b/gtk/css/meson.build index 00284baf36..6b24561928 100644 --- a/gtk/css/meson.build +++ b/gtk/css/meson.build @@ -8,6 +8,7 @@ gtk_css_private_sources = files([ 'gtkcssdataurl.c', 'gtkcssparser.c', 'gtkcsstokenizer.c', + 'gtkcssserializer.c', ]) gtk_css_public_headers = files([ diff --git a/gtk/gtkcssarrayvalueprivate.h b/gtk/gtkcssarrayvalueprivate.h index fb9fb376c0..1f9f38b006 100644 --- a/gtk/gtkcssarrayvalueprivate.h +++ b/gtk/gtkcssarrayvalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_ARRAY_VALUE_PRIVATE_H__ #define __GTK_CSS_ARRAY_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" #include "gtktypes.h" diff --git a/gtk/gtkcssbgsizevalueprivate.h b/gtk/gtkcssbgsizevalueprivate.h index 5f31ff2208..47e356ead6 100644 --- a/gtk/gtkcssbgsizevalueprivate.h +++ b/gtk/gtkcssbgsizevalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_BG_SIZE_VALUE_PRIVATE_H__ #define __GTK_CSS_BG_SIZE_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssimageprivate.h" #include "gtkcssvalueprivate.h" diff --git a/gtk/gtkcssbordervalueprivate.h b/gtk/gtkcssbordervalueprivate.h index fe49904002..0fcaaf7db7 100644 --- a/gtk/gtkcssbordervalueprivate.h +++ b/gtk/gtkcssbordervalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_BORDER_VALUE_PRIVATE_H__ #define __GTK_CSS_BORDER_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssnumbervalueprivate.h" #include "gtkcssvalueprivate.h" diff --git a/gtk/gtkcsscolorvalueprivate.h b/gtk/gtkcsscolorvalueprivate.h index 49387d2c43..f96f6f4234 100644 --- a/gtk/gtkcsscolorvalueprivate.h +++ b/gtk/gtkcsscolorvalueprivate.h @@ -18,7 +18,9 @@ #ifndef __GTK_CSS_COLOR_VALUE_PRIVATE_H__ #define __GTK_CSS_COLOR_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcsscornervalueprivate.h b/gtk/gtkcsscornervalueprivate.h index 59451a7840..a364ce9df5 100644 --- a/gtk/gtkcsscornervalueprivate.h +++ b/gtk/gtkcsscornervalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_CORNER_VALUE_PRIVATE_H__ #define __GTK_CSS_CORNER_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcsseasevalueprivate.h b/gtk/gtkcsseasevalueprivate.h index 6b4dab3717..8aa2770fee 100644 --- a/gtk/gtkcsseasevalueprivate.h +++ b/gtk/gtkcsseasevalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_EASE_VALUE_PRIVATE_H__ #define __GTK_CSS_EASE_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcssenumvalueprivate.h b/gtk/gtkcssenumvalueprivate.h index 22bab5f1f4..7ac181b7a9 100644 --- a/gtk/gtkcssenumvalueprivate.h +++ b/gtk/gtkcssenumvalueprivate.h @@ -21,7 +21,9 @@ #define __GTK_CSS_ENUM_VALUE_PRIVATE_H__ #include "gtkenums.h" -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcsstypesprivate.h" #include "gtkcssvalueprivate.h" diff --git a/gtk/gtkcssfiltervalueprivate.h b/gtk/gtkcssfiltervalueprivate.h index b9eabaa237..6d76f906b7 100644 --- a/gtk/gtkcssfiltervalueprivate.h +++ b/gtk/gtkcssfiltervalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_FILTER_VALUE_PRIVATE_H__ #define __GTK_CSS_FILTER_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcssfontfeaturesvalue.c b/gtk/gtkcssfontfeaturesvalue.c index c5f79eff89..faedc8cf44 100644 --- a/gtk/gtkcssfontfeaturesvalue.c +++ b/gtk/gtkcssfontfeaturesvalue.c @@ -20,7 +20,9 @@ #include "config.h" #include "gtkcsstypesprivate.h" -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssnumbervalueprivate.h" #include "gtkcssfontfeaturesvalueprivate.h" diff --git a/gtk/gtkcssfontfeaturesvalueprivate.h b/gtk/gtkcssfontfeaturesvalueprivate.h index f78a8cd182..b0001da986 100644 --- a/gtk/gtkcssfontfeaturesvalueprivate.h +++ b/gtk/gtkcssfontfeaturesvalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_FONT_FEATURES_VALUE_PRIVATE_H__ #define __GTK_CSS_FONT_FEATURES_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcssfontvariationsvalue.c b/gtk/gtkcssfontvariationsvalue.c index 174cacf417..2ecae30ab0 100644 --- a/gtk/gtkcssfontvariationsvalue.c +++ b/gtk/gtkcssfontvariationsvalue.c @@ -19,7 +19,9 @@ #include "config.h" -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssnumbervalueprivate.h" #include "gtkcssfontvariationsvalueprivate.h" diff --git a/gtk/gtkcssfontvariationsvalueprivate.h b/gtk/gtkcssfontvariationsvalueprivate.h index 90e0fd3a84..c468848190 100644 --- a/gtk/gtkcssfontvariationsvalueprivate.h +++ b/gtk/gtkcssfontvariationsvalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_FONT_VARIATIONS_VALUE_PRIVATE_H__ #define __GTK_CSS_FONT_VARIATIONS_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c index 2fa93d2540..debde7ee00 100644 --- a/gtk/gtkcssimageicontheme.c +++ b/gtk/gtkcssimageicontheme.c @@ -23,6 +23,7 @@ #include +#include "gtk/css/gtkcssserializerprivate.h" #include "gtksettingsprivate.h" #include "gtksnapshot.h" #include "gtkstyleproviderprivate.h" diff --git a/gtk/gtkcssimageprivate.h b/gtk/gtkcssimageprivate.h index d4e4e669ea..707c5d7648 100644 --- a/gtk/gtkcssimageprivate.h +++ b/gtk/gtkcssimageprivate.h @@ -23,7 +23,9 @@ #include #include -#include "gtk/gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtk/gtkcsstypesprivate.h" #include "gtk/gtksnapshot.h" #include "gtk/gtkstyleprovider.h" diff --git a/gtk/gtkcsskeyframesprivate.h b/gtk/gtkcsskeyframesprivate.h index 89de02536c..359184840a 100644 --- a/gtk/gtkcsskeyframesprivate.h +++ b/gtk/gtkcsskeyframesprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_KEYFRAMES_PRIVATE_H__ #define __GTK_CSS_KEYFRAMES_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" #include "gtktypes.h" diff --git a/gtk/gtkcssnumbervalueprivate.h b/gtk/gtkcssnumbervalueprivate.h index bcac90e45e..5ea9b8f63b 100644 --- a/gtk/gtkcssnumbervalueprivate.h +++ b/gtk/gtkcssnumbervalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_NUMBER_VALUE_PRIVATE_H__ #define __GTK_CSS_NUMBER_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcsstypesprivate.h" #include "gtkcssvalueprivate.h" diff --git a/gtk/gtkcsspalettevalueprivate.h b/gtk/gtkcsspalettevalueprivate.h index b422494a8a..baf25b90e7 100644 --- a/gtk/gtkcsspalettevalueprivate.h +++ b/gtk/gtkcsspalettevalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_PALETTE_VALUE_PRIVATE_H__ #define __GTK_CSS_PALETTE_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcsspositionvalueprivate.h b/gtk/gtkcsspositionvalueprivate.h index fc87fbcbce..2ef70df8d7 100644 --- a/gtk/gtkcsspositionvalueprivate.h +++ b/gtk/gtkcsspositionvalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_POSITION_VALUE_PRIVATE_H__ #define __GTK_CSS_POSITION_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c index db84e1daef..ebbc1a165a 100644 --- a/gtk/gtkcssprovider.c +++ b/gtk/gtkcssprovider.c @@ -19,11 +19,13 @@ #include "gtkcssproviderprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkbitmaskprivate.h" #include "gtkcssarrayvalueprivate.h" #include "gtkcsscolorvalueprivate.h" #include "gtkcsskeyframesprivate.h" -#include "gtkcssparserprivate.h" #include "gtkcssselectorprivate.h" #include "gtkcssshorthandpropertyprivate.h" #include "gtksettingsprivate.h" diff --git a/gtk/gtkcssrepeatvalueprivate.h b/gtk/gtkcssrepeatvalueprivate.h index 7e8baa315f..02665c5792 100644 --- a/gtk/gtkcssrepeatvalueprivate.h +++ b/gtk/gtkcssrepeatvalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_REPEAT_VALUE_PRIVATE_H__ #define __GTK_CSS_REPEAT_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkcssselectorprivate.h b/gtk/gtkcssselectorprivate.h index 9cff8e90a8..af6781867f 100644 --- a/gtk/gtkcssselectorprivate.h +++ b/gtk/gtkcssselectorprivate.h @@ -18,9 +18,11 @@ #ifndef __GTK_CSS_SELECTOR_PRIVATE_H__ #define __GTK_CSS_SELECTOR_PRIVATE_H__ +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtk/gtkcountingbloomfilterprivate.h" #include "gtk/gtkcsstypesprivate.h" -#include "gtk/gtkcssparserprivate.h" #define GDK_ARRAY_ELEMENT_TYPE gpointer #define GDK_ARRAY_TYPE_NAME GtkCssSelectorMatches diff --git a/gtk/gtkcssshadowvalueprivate.h b/gtk/gtkcssshadowvalueprivate.h index c14d686566..5784dfa516 100644 --- a/gtk/gtkcssshadowvalueprivate.h +++ b/gtk/gtkcssshadowvalueprivate.h @@ -23,9 +23,11 @@ #include #include +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkborder.h" #include "gtktypes.h" -#include "gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" #include "gtkroundedboxprivate.h" #include "gtksnapshot.h" diff --git a/gtk/gtkcssshorthandpropertyprivate.h b/gtk/gtkcssshorthandpropertyprivate.h index 52b8a470a9..4af065b265 100644 --- a/gtk/gtkcssshorthandpropertyprivate.h +++ b/gtk/gtkcssshorthandpropertyprivate.h @@ -22,7 +22,9 @@ #include -#include "gtk/gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtk/gtkcssstylepropertyprivate.h" #include "gtk/gtkstylepropertyprivate.h" diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c index c211c33afa..269a86e717 100644 --- a/gtk/gtkcssstringvalue.c +++ b/gtk/gtkcssstringvalue.c @@ -18,6 +18,7 @@ #include "config.h" #include "gtkcssstringvalueprivate.h" +#include "gtk/css/gtkcssserializerprivate.h" #include diff --git a/gtk/gtkcssstringvalueprivate.h b/gtk/gtkcssstringvalueprivate.h index 5fb703b6e3..8645077cd0 100644 --- a/gtk/gtkcssstringvalueprivate.h +++ b/gtk/gtkcssstringvalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_STRING_VALUE_PRIVATE_H__ #define __GTK_CSS_STRING_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcsstypesprivate.h" #include "gtkcssvalueprivate.h" diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index eabafee6df..de7f2e3762 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -23,7 +23,9 @@ #include #include -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssstylepropertyprivate.h" #include "gtkcsstypesprivate.h" #include "gtkintl.h" diff --git a/gtk/gtkcsstransformvalueprivate.h b/gtk/gtkcsstransformvalueprivate.h index 143dd87868..d6b8191d4b 100644 --- a/gtk/gtkcsstransformvalueprivate.h +++ b/gtk/gtkcsstransformvalueprivate.h @@ -20,7 +20,9 @@ #ifndef __GTK_CSS_TRANSFORM_VALUE_PRIVATE_H__ #define __GTK_CSS_TRANSFORM_VALUE_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssvalueprivate.h" G_BEGIN_DECLS diff --git a/gtk/gtkstyleproperty.c b/gtk/gtkstyleproperty.c index d0c82ec72c..e6fee266f0 100644 --- a/gtk/gtkstyleproperty.c +++ b/gtk/gtkstyleproperty.c @@ -20,7 +20,9 @@ #include "gtkstylepropertyprivate.h" #include "gtkcssprovider.h" -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkcssshorthandpropertyprivate.h" #include "gtkcssstylepropertyprivate.h" #include "gtkcsstypesprivate.h" diff --git a/gtk/gtkstylepropertyprivate.h b/gtk/gtkstylepropertyprivate.h index 385913f83e..b57331dd84 100644 --- a/gtk/gtkstylepropertyprivate.h +++ b/gtk/gtkstylepropertyprivate.h @@ -18,7 +18,9 @@ #ifndef __GTK_STYLEPROPERTY_PRIVATE_H__ #define __GTK_STYLEPROPERTY_PRIVATE_H__ -#include "gtkcssparserprivate.h" +#include +#include "gtk/css/gtkcsstokenizerprivate.h" +#include "gtk/css/gtkcssparserprivate.h" #include "gtkstylecontextprivate.h" #include "gtkcssvalueprivate.h" diff --git a/gtk/meson.build b/gtk/meson.build index 3e18f05cb6..8edef68f8b 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -82,7 +82,6 @@ gtk_private_sources = files([ 'gtkcssnodestylecache.c', 'gtkcssnumbervalue.c', 'gtkcsspalettevalue.c', - 'gtkcssparser.c', 'gtkcsspositionvalue.c', 'gtkcssrepeatvalue.c', 'gtkcssselector.c', From a9809b0f67d71cd7bfb1815d368a1fdfd1b3ba8b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 2 Oct 2020 22:31:29 -0400 Subject: [PATCH 11/11] Allow inserting newlines in css strings Rename _gtk_css_print_string to strip the _ and add an insert_newlines argument to it. Update all callers, and make the render node serializer insert newlines. --- gsk/gskrendernodeparser.c | 2 +- gtk/css/gtkcssserializer.c | 10 +++++++--- gtk/css/gtkcssserializerprivate.h | 5 +++-- gtk/gtkcssimageicontheme.c | 2 +- gtk/gtkcssstringvalue.c | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index 06d1bdb4d2..c07b749bf6 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -2126,7 +2126,7 @@ append_string_param (Printer *p, { _indent (p); g_string_append_printf (p->str, "%s: ", param_name); - _gtk_css_print_string (p->str, value); + gtk_css_print_string (p->str, value, TRUE); g_string_append_c (p->str, ';'); g_string_append_c (p->str, '\n'); } diff --git a/gtk/css/gtkcssserializer.c b/gtk/css/gtkcssserializer.c index 838a7fb3f4..d939f38cb6 100644 --- a/gtk/css/gtkcssserializer.c +++ b/gtk/css/gtkcssserializer.c @@ -23,8 +23,9 @@ * as a css string again. */ void -_gtk_css_print_string (GString *str, - const char *string) +gtk_css_print_string (GString *str, + const char *string, + gboolean multiline) { gsize len; @@ -42,7 +43,10 @@ _gtk_css_print_string (GString *str, case '\0': goto out; case '\n': - g_string_append (str, "\\A "); + if (multiline) + g_string_append (str, "\\A\\\n"); + else + g_string_append (str, "\\A "); break; case '\r': g_string_append (str, "\\D "); diff --git a/gtk/css/gtkcssserializerprivate.h b/gtk/css/gtkcssserializerprivate.h index 2d1a16949f..86f9934faa 100644 --- a/gtk/css/gtkcssserializerprivate.h +++ b/gtk/css/gtkcssserializerprivate.h @@ -25,8 +25,9 @@ G_BEGIN_DECLS -void _gtk_css_print_string (GString *str, - const char *string); +void gtk_css_print_string (GString *str, + const char *string, + gboolean multiline); G_END_DECLS diff --git a/gtk/gtkcssimageicontheme.c b/gtk/gtkcssimageicontheme.c index debde7ee00..109b0abd83 100644 --- a/gtk/gtkcssimageicontheme.c +++ b/gtk/gtkcssimageicontheme.c @@ -133,7 +133,7 @@ gtk_css_image_icon_theme_print (GtkCssImage *image, GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image); g_string_append (string, "-gtk-icontheme("); - _gtk_css_print_string (string, icon_theme->name); + gtk_css_print_string (string, icon_theme->name, FALSE); g_string_append (string, ")"); } diff --git a/gtk/gtkcssstringvalue.c b/gtk/gtkcssstringvalue.c index 269a86e717..b72427de11 100644 --- a/gtk/gtkcssstringvalue.c +++ b/gtk/gtkcssstringvalue.c @@ -70,7 +70,7 @@ gtk_css_value_string_print (const GtkCssValue *value, return; } - _gtk_css_print_string (str, value->string); + gtk_css_print_string (str, value->string, FALSE); } static void