Merge branch 'matthiasc/for-master' into 'master'

Matthiasc/for master

Closes #2261 and #1002

See merge request GNOME/gtk!2654
This commit is contained in:
Matthias Clasen 2020-10-03 03:55:32 +00:00
commit 949f22b8b2
44 changed files with 187 additions and 58 deletions

View File

@ -30,4 +30,3 @@
#include <stdio.h>
guint _gdk_debug_flags = 0;
GList *_gdk_default_filters = NULL;

View File

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

View File

@ -32,6 +32,7 @@
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcssdataurlprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtk/css/gtkcssserializerprivate.h"
#ifdef CAIRO_HAS_SCRIPT_SURFACE
#include <cairo-script.h>
@ -2125,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');
}

View File

@ -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__ */

View File

@ -17,11 +17,15 @@
#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)
gtk_css_print_string (GString *str,
const char *string,
gboolean multiline)
{
gsize len;
@ -39,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 ");
@ -63,4 +70,3 @@ _gtk_css_print_string (GString *str,
out:
g_string_append_c (str, '"');
}

View File

@ -1,10 +1,10 @@
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
/*
* 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,22 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#ifndef __GTK_CSS_PARSER_PRIVATE_H__
#define __GTK_CSS_PARSER_PRIVATE_H__
#include <gtk/gtkcssprovider.h>
#ifndef __GTK_CSS_SERIALIZER_H__
#define __GTK_CSS_SERIALIZER_H__
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include <glib.h>
#endif /* __GTK_CSS_PARSER_PRIVATE_H__ */
G_BEGIN_DECLS
void gtk_css_print_string (GString *str,
const char *string,
gboolean multiline);
G_END_DECLS
#endif /* __GTK_CSS_SERIALIZER_H__ */

View File

@ -8,6 +8,7 @@ gtk_css_private_sources = files([
'gtkcssdataurl.c',
'gtkcssparser.c',
'gtkcsstokenizer.c',
'gtkcssserializer.c',
])
gtk_css_public_headers = files([

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_ARRAY_VALUE_PRIVATE_H__
#define __GTK_CSS_ARRAY_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
#include "gtktypes.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_BG_SIZE_VALUE_PRIVATE_H__
#define __GTK_CSS_BG_SIZE_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssimageprivate.h"
#include "gtkcssvalueprivate.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_BORDER_VALUE_PRIVATE_H__
#define __GTK_CSS_BORDER_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssvalueprivate.h"

View File

@ -18,7 +18,9 @@
#ifndef __GTK_CSS_COLOR_VALUE_PRIVATE_H__
#define __GTK_CSS_COLOR_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_CORNER_VALUE_PRIVATE_H__
#define __GTK_CSS_CORNER_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_EASE_VALUE_PRIVATE_H__
#define __GTK_CSS_EASE_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -21,7 +21,9 @@
#define __GTK_CSS_ENUM_VALUE_PRIVATE_H__
#include "gtkenums.h"
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkcssvalueprivate.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_FILTER_VALUE_PRIVATE_H__
#define __GTK_CSS_FILTER_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -20,7 +20,9 @@
#include "config.h"
#include "gtkcsstypesprivate.h"
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssfontfeaturesvalueprivate.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_FONT_FEATURES_VALUE_PRIVATE_H__
#define __GTK_CSS_FONT_FEATURES_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -19,7 +19,9 @@
#include "config.h"
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssfontvariationsvalueprivate.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_FONT_VARIATIONS_VALUE_PRIVATE_H__
#define __GTK_CSS_FONT_VARIATIONS_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -23,6 +23,7 @@
#include <math.h>
#include "gtk/css/gtkcssserializerprivate.h"
#include "gtksettingsprivate.h"
#include "gtksnapshot.h"
#include "gtkstyleproviderprivate.h"
@ -132,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, ")");
}

View File

@ -23,7 +23,9 @@
#include <cairo.h>
#include <glib-object.h>
#include "gtk/gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtk/gtkcsstypesprivate.h"
#include "gtk/gtksnapshot.h"
#include "gtk/gtkstyleprovider.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_KEYFRAMES_PRIVATE_H__
#define __GTK_CSS_KEYFRAMES_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
#include "gtktypes.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_NUMBER_VALUE_PRIVATE_H__
#define __GTK_CSS_NUMBER_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkcssvalueprivate.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_PALETTE_VALUE_PRIVATE_H__
#define __GTK_CSS_PALETTE_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_POSITION_VALUE_PRIVATE_H__
#define __GTK_CSS_POSITION_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -19,11 +19,13 @@
#include "gtkcssproviderprivate.h"
#include <gtk/css/gtkcss.h>
#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"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_REPEAT_VALUE_PRIVATE_H__
#define __GTK_CSS_REPEAT_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

@ -18,9 +18,11 @@
#ifndef __GTK_CSS_SELECTOR_PRIVATE_H__
#define __GTK_CSS_SELECTOR_PRIVATE_H__
#include <gtk/css/gtkcss.h>
#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

View File

@ -23,9 +23,11 @@
#include <cairo.h>
#include <pango/pango.h>
#include <gtk/css/gtkcss.h>
#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"

View File

@ -22,7 +22,9 @@
#include <glib-object.h>
#include "gtk/gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtk/gtkcssstylepropertyprivate.h"
#include "gtk/gtkstylepropertyprivate.h"

View File

@ -18,6 +18,7 @@
#include "config.h"
#include "gtkcssstringvalueprivate.h"
#include "gtk/css/gtkcssserializerprivate.h"
#include <string.h>
@ -69,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

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_STRING_VALUE_PRIVATE_H__
#define __GTK_CSS_STRING_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkcssvalueprivate.h"

View File

@ -23,7 +23,9 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <math.h>
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkintl.h"

View File

@ -20,7 +20,9 @@
#ifndef __GTK_CSS_TRANSFORM_VALUE_PRIVATE_H__
#define __GTK_CSS_TRANSFORM_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS

View File

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

View File

@ -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;
/**

View File

@ -62,7 +62,7 @@
*
* # Accessibility
*
* GtkImage uses the #GTK_ACCESSIBLE_ROLE_IMG role.
* GtkPicture uses the #GTK_ACCESSIBLE_ROLE_IMG role.
*/
enum

View File

@ -20,7 +20,9 @@
#include "gtkstylepropertyprivate.h"
#include "gtkcssprovider.h"
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkcssshorthandpropertyprivate.h"
#include "gtkcssstylepropertyprivate.h"
#include "gtkcsstypesprivate.h"

View File

@ -18,7 +18,9 @@
#ifndef __GTK_STYLEPROPERTY_PRIVATE_H__
#define __GTK_STYLEPROPERTY_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include <gtk/css/gtkcss.h>
#include "gtk/css/gtkcsstokenizerprivate.h"
#include "gtk/css/gtkcssparserprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtkcssvalueprivate.h"

View File

@ -82,7 +82,6 @@ gtk_private_sources = files([
'gtkcssnodestylecache.c',
'gtkcssnumbervalue.c',
'gtkcsspalettevalue.c',
'gtkcssparser.c',
'gtkcsspositionvalue.c',
'gtkcssrepeatvalue.c',
'gtkcssselector.c',

View File

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

View File

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

View File

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

View File

@ -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 ();
}