forked from AuroraMiddleware/gtk
Merge branch 'fix-icontheme-invalidation' into 'master'
Fix icontheme invalidation See merge request GNOME/gtk!1733
This commit is contained in:
commit
8b1e857a67
@ -339,7 +339,7 @@ scale[.fine-tune]
|
|||||||
<member><literal>-gtk-icontheme(<replaceable>Name</replaceable>)</literal></member>
|
<member><literal>-gtk-icontheme(<replaceable>Name</replaceable>)</literal></member>
|
||||||
</simplelist>
|
</simplelist>
|
||||||
The specified icon name is used to look up a themed icon, while taking into
|
The specified icon name is used to look up a themed icon, while taking into
|
||||||
account the values of the -gtk-icon-theme and -gtk-icon-palette properties.
|
account the values of the -gtk-icon-palette property.
|
||||||
This kind of image is mainly used as value of the -gtk-icon-source property.
|
This kind of image is mainly used as value of the -gtk-icon-source property.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
@ -599,11 +599,6 @@ scale[.fine-tune]
|
|||||||
<entry><ulink url="https://www.w3.org/TR/css-backgrounds-3/#typedef-image">Image</ulink>, <literal>builtin</literal> or <literal>none</literal></entry>
|
<entry><ulink url="https://www.w3.org/TR/css-backgrounds-3/#typedef-image">Image</ulink>, <literal>builtin</literal> or <literal>none</literal></entry>
|
||||||
<entry>used for builtin icons in buttons and expanders</entry>
|
<entry>used for builtin icons in buttons and expanders</entry>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
|
||||||
<entry>-gtk-icon-theme</entry>
|
|
||||||
<entry>Theme name</entry>
|
|
||||||
<entry>icon theme to use with -gtk-icontheme()</entry>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<entry>-gtk-icon-size</entry>
|
<entry>-gtk-icon-size</entry>
|
||||||
<entry><ulink url="https://www.w3.org/TR/css3-values/#length-value">Length</ulink></entry>
|
<entry><ulink url="https://www.w3.org/TR/css3-values/#length-value">Length</ulink></entry>
|
||||||
|
@ -2312,6 +2312,7 @@ GtkSettingsValue
|
|||||||
gtk_settings_get_default
|
gtk_settings_get_default
|
||||||
gtk_settings_get_for_display
|
gtk_settings_get_for_display
|
||||||
gtk_settings_reset_property
|
gtk_settings_reset_property
|
||||||
|
GtkSystemSetting
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GtkSettingsClass
|
GtkSettingsClass
|
||||||
GTK_IS_SETTINGS
|
GTK_IS_SETTINGS
|
||||||
@ -4102,7 +4103,6 @@ gtk_widget_set_css_classes
|
|||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
gtk_widget_get_style_context
|
gtk_widget_get_style_context
|
||||||
gtk_widget_reset_style
|
|
||||||
gtk_widget_class_get_css_name
|
gtk_widget_class_get_css_name
|
||||||
gtk_widget_class_set_css_name
|
gtk_widget_class_set_css_name
|
||||||
|
|
||||||
|
@ -176,10 +176,6 @@ gtk_css_animated_style_set_animated_value (GtkCssAnimatedStyle *animated,
|
|||||||
unshare_core (animated);
|
unshare_core (animated);
|
||||||
gtk_css_take_value (&style->core->font_size, value);
|
gtk_css_take_value (&style->core->font_size, value);
|
||||||
break;
|
break;
|
||||||
case GTK_CSS_PROPERTY_ICON_THEME:
|
|
||||||
unshare_core (animated);
|
|
||||||
gtk_css_take_value (&style->core->icon_theme, value);
|
|
||||||
break;
|
|
||||||
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||||
unshare_core (animated);
|
unshare_core (animated);
|
||||||
gtk_css_take_value (&style->core->icon_palette, value);
|
gtk_css_take_value (&style->core->icon_palette, value);
|
||||||
|
@ -1,175 +0,0 @@
|
|||||||
/* GTK - The GIMP Toolkit
|
|
||||||
* Copyright (C) 2011 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.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
|
|
||||||
#include "gtkicontheme.h"
|
|
||||||
#include "gtksettingsprivate.h"
|
|
||||||
#include "gtkstyleproviderprivate.h"
|
|
||||||
#include "gtkintl.h"
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The idea behind this value (and the '-gtk-icon-theme' CSS property) is
|
|
||||||
* to track changes to the icon theme.
|
|
||||||
*
|
|
||||||
* We create a new instance of this value whenever the icon theme changes
|
|
||||||
* (via emitting the changed signal). So as long as the icon theme does
|
|
||||||
* not change, we will compute the same value. We can then compare values
|
|
||||||
* by pointer to see if the icon theme changed.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct _GtkCssValue {
|
|
||||||
GTK_CSS_VALUE_BASE
|
|
||||||
GtkIconTheme *icontheme;
|
|
||||||
guint changed_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_css_value_icon_theme_disconnect_handler (GtkCssValue *value)
|
|
||||||
{
|
|
||||||
if (value->changed_id == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (value->icontheme), "-gtk-css-value", NULL);
|
|
||||||
|
|
||||||
g_signal_handler_disconnect (value->icontheme, value->changed_id);
|
|
||||||
value->changed_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_css_value_icon_theme_changed_cb (GtkIconTheme *icontheme,
|
|
||||||
GtkCssValue *value)
|
|
||||||
{
|
|
||||||
gtk_css_value_icon_theme_disconnect_handler (value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_css_value_icon_theme_free (GtkCssValue *value)
|
|
||||||
{
|
|
||||||
gtk_css_value_icon_theme_disconnect_handler (value);
|
|
||||||
|
|
||||||
if (value->icontheme)
|
|
||||||
g_object_unref (value->icontheme);
|
|
||||||
|
|
||||||
g_slice_free (GtkCssValue, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkCssValue *
|
|
||||||
gtk_css_value_icon_theme_compute (GtkCssValue *icon_theme,
|
|
||||||
guint property_id,
|
|
||||||
GtkStyleProvider *provider,
|
|
||||||
GtkCssStyle *style,
|
|
||||||
GtkCssStyle *parent_style)
|
|
||||||
{
|
|
||||||
GtkIconTheme *icontheme;
|
|
||||||
|
|
||||||
if (icon_theme->icontheme)
|
|
||||||
icontheme = icon_theme->icontheme;
|
|
||||||
else
|
|
||||||
icontheme = gtk_icon_theme_get_for_display (_gtk_settings_get_display (gtk_style_provider_get_settings (provider)));
|
|
||||||
|
|
||||||
return gtk_css_icon_theme_value_new (icontheme);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gtk_css_value_icon_theme_equal (const GtkCssValue *value1,
|
|
||||||
const GtkCssValue *value2)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GtkCssValue *
|
|
||||||
gtk_css_value_icon_theme_transition (GtkCssValue *start,
|
|
||||||
GtkCssValue *end,
|
|
||||||
guint property_id,
|
|
||||||
double progress)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_css_value_icon_theme_print (const GtkCssValue *icon_theme,
|
|
||||||
GString *string)
|
|
||||||
{
|
|
||||||
g_string_append (string, "initial");
|
|
||||||
}
|
|
||||||
|
|
||||||
static const GtkCssValueClass GTK_CSS_VALUE_ICON_THEME = {
|
|
||||||
"GtkCssIconThemeValue",
|
|
||||||
gtk_css_value_icon_theme_free,
|
|
||||||
gtk_css_value_icon_theme_compute,
|
|
||||||
gtk_css_value_icon_theme_equal,
|
|
||||||
gtk_css_value_icon_theme_transition,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
gtk_css_value_icon_theme_print
|
|
||||||
};
|
|
||||||
|
|
||||||
static GtkCssValue default_icon_theme_value = { >K_CSS_VALUE_ICON_THEME, 1, FALSE, NULL, 0 };
|
|
||||||
|
|
||||||
GtkCssValue *
|
|
||||||
gtk_css_icon_theme_value_new (GtkIconTheme *icontheme)
|
|
||||||
{
|
|
||||||
GtkCssValue *result;
|
|
||||||
|
|
||||||
if (icontheme == NULL)
|
|
||||||
return _gtk_css_value_ref (&default_icon_theme_value);
|
|
||||||
|
|
||||||
result = g_object_get_data (G_OBJECT (icontheme), "-gtk-css-value");
|
|
||||||
if (result)
|
|
||||||
return _gtk_css_value_ref (result);
|
|
||||||
|
|
||||||
result = _gtk_css_value_new (GtkCssValue, >K_CSS_VALUE_ICON_THEME);
|
|
||||||
result->icontheme = g_object_ref (icontheme);
|
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (icontheme), I_("-gtk-css-value"), result);
|
|
||||||
result->changed_id = g_signal_connect (icontheme, "changed", G_CALLBACK (gtk_css_value_icon_theme_changed_cb), result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkCssValue *
|
|
||||||
gtk_css_icon_theme_value_parse (GtkCssParser *parser)
|
|
||||||
{
|
|
||||||
GtkIconTheme *icontheme;
|
|
||||||
GtkCssValue *result;
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
s = gtk_css_parser_consume_string (parser);
|
|
||||||
if (s == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
icontheme = gtk_icon_theme_new ();
|
|
||||||
gtk_icon_theme_set_theme_name (icontheme, s);
|
|
||||||
|
|
||||||
result = gtk_css_icon_theme_value_new (icontheme);
|
|
||||||
|
|
||||||
g_object_unref (icontheme);
|
|
||||||
g_free (s);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
GtkIconTheme *
|
|
||||||
gtk_css_icon_theme_value_get_icon_theme (GtkCssValue *value)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (value->class == >K_CSS_VALUE_ICON_THEME, NULL);
|
|
||||||
|
|
||||||
return value->icontheme;
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2012 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.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
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* 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: Alexander Larsson <alexl@gnome.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GTK_CSS_ICON_THEME_VALUE_PRIVATE_H__
|
|
||||||
#define __GTK_CSS_ICON_THEME_VALUE_PRIVATE_H__
|
|
||||||
|
|
||||||
#include "gtkicontheme.h"
|
|
||||||
|
|
||||||
#include "gtkcssparserprivate.h"
|
|
||||||
#include "gtkcssvalueprivate.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
GtkCssValue * gtk_css_icon_theme_value_new (GtkIconTheme *icontheme);
|
|
||||||
|
|
||||||
GtkCssValue * gtk_css_icon_theme_value_parse (GtkCssParser *parser);
|
|
||||||
|
|
||||||
GtkIconTheme * gtk_css_icon_theme_value_get_icon_theme (GtkCssValue *value);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __GTK_CSS_ICON_THEME_VALUE_PRIVATE_H__ */
|
|
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtksettingsprivate.h"
|
#include "gtksettingsprivate.h"
|
||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
#include "gtkstyleproviderprivate.h"
|
#include "gtkstyleproviderprivate.h"
|
||||||
@ -146,10 +145,15 @@ gtk_css_image_icon_theme_compute (GtkCssImage *image,
|
|||||||
{
|
{
|
||||||
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
GtkCssImageIconTheme *icon_theme = GTK_CSS_IMAGE_ICON_THEME (image);
|
||||||
GtkCssImageIconTheme *copy;
|
GtkCssImageIconTheme *copy;
|
||||||
|
GtkSettings *settings;
|
||||||
|
GdkDisplay *display;
|
||||||
|
|
||||||
copy = g_object_new (GTK_TYPE_CSS_IMAGE_ICON_THEME, NULL);
|
copy = g_object_new (GTK_TYPE_CSS_IMAGE_ICON_THEME, NULL);
|
||||||
copy->name = g_strdup (icon_theme->name);
|
copy->name = g_strdup (icon_theme->name);
|
||||||
copy->icon_theme = gtk_css_icon_theme_value_get_icon_theme (style->core->icon_theme);
|
settings = gtk_style_provider_get_settings (provider);
|
||||||
|
display = _gtk_settings_get_display (settings);
|
||||||
|
copy->icon_theme = gtk_icon_theme_get_for_display (display);
|
||||||
|
copy->serial = gtk_icon_theme_get_serial (copy->icon_theme);
|
||||||
copy->scale = gtk_style_provider_get_scale (provider);
|
copy->scale = gtk_style_provider_get_scale (provider);
|
||||||
gtk_icon_theme_lookup_symbolic_colors (style, ©->color, ©->success, ©->warning, ©->error);
|
gtk_icon_theme_lookup_symbolic_colors (style, ©->color, ©->success, ©->warning, ©->error);
|
||||||
|
|
||||||
@ -163,7 +167,9 @@ gtk_css_image_icon_theme_equal (GtkCssImage *image1,
|
|||||||
GtkCssImageIconTheme *icon_theme1 = (GtkCssImageIconTheme *) image1;
|
GtkCssImageIconTheme *icon_theme1 = (GtkCssImageIconTheme *) image1;
|
||||||
GtkCssImageIconTheme *icon_theme2 = (GtkCssImageIconTheme *) image2;
|
GtkCssImageIconTheme *icon_theme2 = (GtkCssImageIconTheme *) image2;
|
||||||
|
|
||||||
return g_str_equal (icon_theme1->name, icon_theme2->name);
|
return icon_theme1->serial == icon_theme2->serial &&
|
||||||
|
icon_theme1->icon_theme == icon_theme2->icon_theme &&
|
||||||
|
g_str_equal (icon_theme1->name, icon_theme2->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -44,7 +44,8 @@ struct _GtkCssImageIconTheme
|
|||||||
GdkRGBA success;
|
GdkRGBA success;
|
||||||
GdkRGBA warning;
|
GdkRGBA warning;
|
||||||
GdkRGBA error;
|
GdkRGBA error;
|
||||||
gint scale;
|
int serial;
|
||||||
|
int scale;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
int cached_size;
|
int cached_size;
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
|
|
||||||
#include "gtkcsspalettevalueprivate.h"
|
#include "gtkcsspalettevalueprivate.h"
|
||||||
|
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtkcsscolorvalueprivate.h"
|
#include "gtkcsscolorvalueprivate.h"
|
||||||
#include "gtkcsscolorvalueprivate.h"
|
#include "gtkcsscolorvalueprivate.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
|
@ -50,7 +50,6 @@ static const int core_props[] = {
|
|||||||
GTK_CSS_PROPERTY_COLOR,
|
GTK_CSS_PROPERTY_COLOR,
|
||||||
GTK_CSS_PROPERTY_DPI,
|
GTK_CSS_PROPERTY_DPI,
|
||||||
GTK_CSS_PROPERTY_FONT_SIZE,
|
GTK_CSS_PROPERTY_FONT_SIZE,
|
||||||
GTK_CSS_PROPERTY_ICON_THEME,
|
|
||||||
GTK_CSS_PROPERTY_ICON_PALETTE
|
GTK_CSS_PROPERTY_ICON_PALETTE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -396,9 +395,6 @@ gtk_css_static_style_set_value (GtkCssStaticStyle *sstyle,
|
|||||||
case GTK_CSS_PROPERTY_FONT_SIZE:
|
case GTK_CSS_PROPERTY_FONT_SIZE:
|
||||||
gtk_css_take_value (&style->core->font_size, value);
|
gtk_css_take_value (&style->core->font_size, value);
|
||||||
break;
|
break;
|
||||||
case GTK_CSS_PROPERTY_ICON_THEME:
|
|
||||||
gtk_css_take_value (&style->core->icon_theme, value);
|
|
||||||
break;
|
|
||||||
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||||
gtk_css_take_value (&style->core->icon_palette, value);
|
gtk_css_take_value (&style->core->icon_palette, value);
|
||||||
break;
|
break;
|
||||||
|
@ -103,8 +103,6 @@ gtk_css_style_get_value (GtkCssStyle *style,
|
|||||||
return style->core->dpi;
|
return style->core->dpi;
|
||||||
case GTK_CSS_PROPERTY_FONT_SIZE:
|
case GTK_CSS_PROPERTY_FONT_SIZE:
|
||||||
return style->core->font_size;
|
return style->core->font_size;
|
||||||
case GTK_CSS_PROPERTY_ICON_THEME:
|
|
||||||
return style->core->icon_theme;
|
|
||||||
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
case GTK_CSS_PROPERTY_ICON_PALETTE:
|
||||||
return style->core->icon_palette;
|
return style->core->icon_palette;
|
||||||
case GTK_CSS_PROPERTY_BACKGROUND_COLOR:
|
case GTK_CSS_PROPERTY_BACKGROUND_COLOR:
|
||||||
|
@ -83,7 +83,6 @@ struct _GtkCssCoreValues {
|
|||||||
GtkCssValue *color;
|
GtkCssValue *color;
|
||||||
GtkCssValue *dpi;
|
GtkCssValue *dpi;
|
||||||
GtkCssValue *font_size;
|
GtkCssValue *font_size;
|
||||||
GtkCssValue *icon_theme;
|
|
||||||
GtkCssValue *icon_palette;
|
GtkCssValue *icon_palette;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@
|
|||||||
#include "gtkcsseasevalueprivate.h"
|
#include "gtkcsseasevalueprivate.h"
|
||||||
#include "gtkcssfiltervalueprivate.h"
|
#include "gtkcssfiltervalueprivate.h"
|
||||||
#include "gtkcssfontfeaturesvalueprivate.h"
|
#include "gtkcssfontfeaturesvalueprivate.h"
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtkcssimageprivate.h"
|
#include "gtkcssimageprivate.h"
|
||||||
#include "gtkcssimagevalueprivate.h"
|
#include "gtkcssimagevalueprivate.h"
|
||||||
#include "gtkcssinitialvalueprivate.h"
|
#include "gtkcssinitialvalueprivate.h"
|
||||||
@ -794,13 +793,6 @@ background_position_parse (GtkCssStyleProperty *property,
|
|||||||
return _gtk_css_array_value_parse (parser, _gtk_css_position_value_parse);
|
return _gtk_css_array_value_parse (parser, _gtk_css_position_value_parse);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GtkCssValue *
|
|
||||||
icon_theme_value_parse (GtkCssStyleProperty *property,
|
|
||||||
GtkCssParser *parser)
|
|
||||||
{
|
|
||||||
return gtk_css_icon_theme_value_parse (parser);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** REGISTRATION ***/
|
/*** REGISTRATION ***/
|
||||||
|
|
||||||
G_STATIC_ASSERT (GTK_CSS_PROPERTY_COLOR == 0);
|
G_STATIC_ASSERT (GTK_CSS_PROPERTY_COLOR == 0);
|
||||||
@ -831,12 +823,6 @@ _gtk_css_style_property_init_properties (void)
|
|||||||
GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_TEXT_SIZE,
|
GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_TEXT_SIZE,
|
||||||
font_size_parse,
|
font_size_parse,
|
||||||
_gtk_css_font_size_value_new (GTK_CSS_FONT_SIZE_MEDIUM));
|
_gtk_css_font_size_value_new (GTK_CSS_FONT_SIZE_MEDIUM));
|
||||||
gtk_css_style_property_register ("-gtk-icon-theme",
|
|
||||||
GTK_CSS_PROPERTY_ICON_THEME,
|
|
||||||
GTK_STYLE_PROPERTY_INHERIT,
|
|
||||||
GTK_CSS_AFFECTS_ICON_TEXTURE,
|
|
||||||
icon_theme_value_parse,
|
|
||||||
gtk_css_icon_theme_value_new (NULL));
|
|
||||||
gtk_css_style_property_register ("-gtk-icon-palette",
|
gtk_css_style_property_register ("-gtk-icon-palette",
|
||||||
GTK_CSS_PROPERTY_ICON_PALETTE,
|
GTK_CSS_PROPERTY_ICON_PALETTE,
|
||||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_INHERIT,
|
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_INHERIT,
|
||||||
|
@ -188,7 +188,6 @@ enum { /*< skip >*/
|
|||||||
GTK_CSS_PROPERTY_COLOR,
|
GTK_CSS_PROPERTY_COLOR,
|
||||||
GTK_CSS_PROPERTY_DPI,
|
GTK_CSS_PROPERTY_DPI,
|
||||||
GTK_CSS_PROPERTY_FONT_SIZE,
|
GTK_CSS_PROPERTY_FONT_SIZE,
|
||||||
GTK_CSS_PROPERTY_ICON_THEME,
|
|
||||||
GTK_CSS_PROPERTY_ICON_PALETTE,
|
GTK_CSS_PROPERTY_ICON_PALETTE,
|
||||||
GTK_CSS_PROPERTY_BACKGROUND_COLOR,
|
GTK_CSS_PROPERTY_BACKGROUND_COLOR,
|
||||||
GTK_CSS_PROPERTY_FONT_FAMILY,
|
GTK_CSS_PROPERTY_FONT_FAMILY,
|
||||||
|
@ -1088,4 +1088,33 @@ typedef enum {
|
|||||||
GTK_CONSTRAINT_VFL_PARSER_ERROR_INVALID_RELATION
|
GTK_CONSTRAINT_VFL_PARSER_ERROR_INVALID_RELATION
|
||||||
} GtkConstraintVflParserError;
|
} GtkConstraintVflParserError;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GtkSystemSetting:
|
||||||
|
* @GTK_SYSTEM_SETTING_DPI: the #GtkSettings:gtk-xft-dpi setting has changed
|
||||||
|
* @GTK_SYSTEM_SETTING_FONT_NAME: The #GtkSettings:gtk-font-name setting has changed
|
||||||
|
* @GTK_SYSTEM_SETTING_FONT_CONFIG: The font configuration has changed in a way that
|
||||||
|
* requires text to be redrawn. This can be any of the
|
||||||
|
* #GtkSettings:gtk-xft-antialias, #GtkSettings:gtk-xft-hinting,
|
||||||
|
* #GtkSettings:gtk-xft-hintstyle, #GtkSettings:gtk-xft-rgba or
|
||||||
|
* #GtkSettings:gtk-fontconfig-timestamp settings
|
||||||
|
* @GTK_SYSTEM_SETTING_DISPLAY: The display has changed
|
||||||
|
* @GTK_SYSTEM_SETTING_ICON_THEME: The icon theme has changed in a way that requires
|
||||||
|
* icons to be looked up again
|
||||||
|
*
|
||||||
|
* Values that can be passed to the GtkWidgetClass.system_setting_changed
|
||||||
|
* vfunc to indicate that a system setting has changed and widgets may
|
||||||
|
* need to drop caches, or react otherwise.
|
||||||
|
*
|
||||||
|
* Most of the values correspond to #GtkSettings properties.
|
||||||
|
*
|
||||||
|
* More values may be added over time.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
GTK_SYSTEM_SETTING_DPI,
|
||||||
|
GTK_SYSTEM_SETTING_FONT_NAME,
|
||||||
|
GTK_SYSTEM_SETTING_FONT_CONFIG,
|
||||||
|
GTK_SYSTEM_SETTING_DISPLAY,
|
||||||
|
GTK_SYSTEM_SETTING_ICON_THEME
|
||||||
|
} GtkSystemSetting;
|
||||||
|
|
||||||
#endif /* __GTK_ENUMS_H__ */
|
#endif /* __GTK_ENUMS_H__ */
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "gtkcellrenderertext.h"
|
#include "gtkcellrenderertext.h"
|
||||||
#include "gtkcellrendererpixbuf.h"
|
#include "gtkcellrendererpixbuf.h"
|
||||||
#include "gtkcombobox.h"
|
#include "gtkcombobox.h"
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtkdroptarget.h"
|
#include "gtkdroptarget.h"
|
||||||
#include "gtkicontheme.h"
|
#include "gtkicontheme.h"
|
||||||
#include "gtkimage.h"
|
#include "gtkimage.h"
|
||||||
@ -273,8 +272,6 @@ static void gtk_file_chooser_button_root (GtkWidget *widget);
|
|||||||
static void gtk_file_chooser_button_map (GtkWidget *widget);
|
static void gtk_file_chooser_button_map (GtkWidget *widget);
|
||||||
static gboolean gtk_file_chooser_button_mnemonic_activate (GtkWidget *widget,
|
static gboolean gtk_file_chooser_button_mnemonic_activate (GtkWidget *widget,
|
||||||
gboolean group_cycling);
|
gboolean group_cycling);
|
||||||
static void gtk_file_chooser_button_css_changed (GtkWidget *widget,
|
|
||||||
GtkCssStyleChange *change);
|
|
||||||
static void gtk_file_chooser_button_state_flags_changed (GtkWidget *widget,
|
static void gtk_file_chooser_button_state_flags_changed (GtkWidget *widget,
|
||||||
GtkStateFlags previous_state);
|
GtkStateFlags previous_state);
|
||||||
|
|
||||||
@ -468,7 +465,6 @@ gtk_file_chooser_button_class_init (GtkFileChooserButtonClass * class)
|
|||||||
widget_class->show = gtk_file_chooser_button_show;
|
widget_class->show = gtk_file_chooser_button_show;
|
||||||
widget_class->hide = gtk_file_chooser_button_hide;
|
widget_class->hide = gtk_file_chooser_button_hide;
|
||||||
widget_class->map = gtk_file_chooser_button_map;
|
widget_class->map = gtk_file_chooser_button_map;
|
||||||
widget_class->css_changed = gtk_file_chooser_button_css_changed;
|
|
||||||
widget_class->root = gtk_file_chooser_button_root;
|
widget_class->root = gtk_file_chooser_button_root;
|
||||||
widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
|
widget_class->mnemonic_activate = gtk_file_chooser_button_mnemonic_activate;
|
||||||
widget_class->state_flags_changed = gtk_file_chooser_button_state_flags_changed;
|
widget_class->state_flags_changed = gtk_file_chooser_button_state_flags_changed;
|
||||||
@ -1347,18 +1343,6 @@ change_icon_theme (GtkFileChooserButton *button)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gtk_file_chooser_button_css_changed (GtkWidget *widget,
|
|
||||||
GtkCssStyleChange *change)
|
|
||||||
{
|
|
||||||
GTK_WIDGET_CLASS (gtk_file_chooser_button_parent_class)->css_changed (widget, change);
|
|
||||||
|
|
||||||
/* We need to update the icon surface, but only in case
|
|
||||||
* the icon theme really changed. */
|
|
||||||
if (!change || gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_ICON_THEME))
|
|
||||||
change_icon_theme (GTK_FILE_CHOOSER_BUTTON (widget));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_file_chooser_button_root (GtkWidget *widget)
|
gtk_file_chooser_button_root (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include <glib/gi18n-lib.h>
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
#include "gtkfilechooser.h"
|
#include "gtkfilechooser.h"
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtkstylecontextprivate.h"
|
#include "gtkstylecontextprivate.h"
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "gtkcssenumvalueprivate.h"
|
#include "gtkcssenumvalueprivate.h"
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtkcssnodeprivate.h"
|
#include "gtkcssnodeprivate.h"
|
||||||
#include "gtkcssnumbervalueprivate.h"
|
#include "gtkcssnumbervalueprivate.h"
|
||||||
#include "gtkcssstyleprivate.h"
|
#include "gtkcssstyleprivate.h"
|
||||||
@ -96,7 +95,7 @@ ensure_paintable_for_gicon (GtkIconHelper *self,
|
|||||||
GtkIconPaintable *icon;
|
GtkIconPaintable *icon;
|
||||||
GtkIconLookupFlags flags;
|
GtkIconLookupFlags flags;
|
||||||
|
|
||||||
icon_theme = gtk_css_icon_theme_value_get_icon_theme (style->core->icon_theme);
|
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (self->owner));
|
||||||
flags = get_icon_lookup_flags (self, style);
|
flags = get_icon_lookup_flags (self, style);
|
||||||
if (preload)
|
if (preload)
|
||||||
flags |= GTK_ICON_LOOKUP_PRELOAD;
|
flags |= GTK_ICON_LOOKUP_PRELOAD;
|
||||||
|
@ -47,8 +47,10 @@
|
|||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtksettingsprivate.h"
|
#include "gtksettingsprivate.h"
|
||||||
#include "gtkstylecontextprivate.h"
|
#include "gtkstylecontextprivate.h"
|
||||||
|
#include "gtkstyleproviderprivate.h"
|
||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtksnapshot.h"
|
#include "gtksnapshot.h"
|
||||||
|
#include "gtkwidgetprivate.h"
|
||||||
#include "gdkpixbufutilsprivate.h"
|
#include "gdkpixbufutilsprivate.h"
|
||||||
#include "gdk/gdktextureprivate.h"
|
#include "gdk/gdktextureprivate.h"
|
||||||
#include "gdk/gdkprofilerprivate.h"
|
#include "gdk/gdkprofilerprivate.h"
|
||||||
@ -331,6 +333,8 @@ struct _GtkIconTheme
|
|||||||
GList *dir_mtimes;
|
GList *dir_mtimes;
|
||||||
|
|
||||||
gulong theme_changed_idle;
|
gulong theme_changed_idle;
|
||||||
|
|
||||||
|
int serial;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkIconThemeClass
|
struct _GtkIconThemeClass
|
||||||
@ -549,9 +553,16 @@ gtk_icon_theme_ref_aquire (GtkIconThemeRef *ref)
|
|||||||
static void
|
static void
|
||||||
gtk_icon_theme_ref_release (GtkIconThemeRef *ref)
|
gtk_icon_theme_ref_release (GtkIconThemeRef *ref)
|
||||||
{
|
{
|
||||||
if (ref->theme)
|
GtkIconTheme *theme;
|
||||||
g_object_unref (ref->theme);
|
|
||||||
|
/* Get a pointer to the theme, becuse when we unlock it could become NULLed by dispose, this pointer still owns a ref */
|
||||||
|
theme = ref->theme;
|
||||||
g_mutex_unlock (&ref->lock);
|
g_mutex_unlock (&ref->lock);
|
||||||
|
|
||||||
|
/* Then unref outside the lock, because otherwis if this is the last ref the dispose handler would deadlock trying to NULL ref->theme */
|
||||||
|
if (theme)
|
||||||
|
g_object_unref (theme);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1308,7 +1319,9 @@ theme_changed_idle__mainthread_unlocked (gpointer user_data)
|
|||||||
|
|
||||||
if (display)
|
if (display)
|
||||||
{
|
{
|
||||||
gtk_style_context_reset_widgets (self->display);
|
GtkSettings *settings = gtk_settings_get_for_display (self->display);
|
||||||
|
gtk_style_provider_changed (GTK_STYLE_PROVIDER (settings));
|
||||||
|
gtk_system_setting_changed (display, GTK_SYSTEM_SETTING_ICON_THEME);
|
||||||
g_object_unref (display);
|
g_object_unref (display);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1344,7 +1357,6 @@ do_theme_change (GtkIconTheme *self)
|
|||||||
blow_themes (self);
|
blow_themes (self);
|
||||||
|
|
||||||
queue_theme_changed (self);
|
queue_theme_changed (self);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1360,6 +1372,13 @@ blow_themes (GtkIconTheme *self)
|
|||||||
self->unthemed_icons = NULL;
|
self->unthemed_icons = NULL;
|
||||||
self->dir_mtimes = NULL;
|
self->dir_mtimes = NULL;
|
||||||
self->themes_valid = FALSE;
|
self->themes_valid = FALSE;
|
||||||
|
self->serial++;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
gtk_icon_theme_get_serial (GtkIconTheme *self)
|
||||||
|
{
|
||||||
|
return self->serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -41,4 +41,6 @@ void gtk_icon_paintable_snapshot_with_colors (GtkIconPaintable *icon,
|
|||||||
const GdkRGBA *warning_color,
|
const GdkRGBA *warning_color,
|
||||||
const GdkRGBA *error_color);
|
const GdkRGBA *error_color);
|
||||||
|
|
||||||
|
int gtk_icon_theme_get_serial (GtkIconTheme *self);
|
||||||
|
|
||||||
#endif /* __GTK_ICON_THEME_PRIVATE_H__ */
|
#endif /* __GTK_ICON_THEME_PRIVATE_H__ */
|
||||||
|
@ -110,6 +110,8 @@ static void gtk_image_measure (GtkWidget *widget,
|
|||||||
|
|
||||||
static void gtk_image_css_changed (GtkWidget *widget,
|
static void gtk_image_css_changed (GtkWidget *widget,
|
||||||
GtkCssStyleChange *change);
|
GtkCssStyleChange *change);
|
||||||
|
static void gtk_image_system_setting_changed (GtkWidget *widget,
|
||||||
|
GtkSystemSetting seting);
|
||||||
static void gtk_image_finalize (GObject *object);
|
static void gtk_image_finalize (GObject *object);
|
||||||
|
|
||||||
static void gtk_image_set_property (GObject *object,
|
static void gtk_image_set_property (GObject *object,
|
||||||
@ -157,6 +159,7 @@ gtk_image_class_init (GtkImageClass *class)
|
|||||||
widget_class->measure = gtk_image_measure;
|
widget_class->measure = gtk_image_measure;
|
||||||
widget_class->unrealize = gtk_image_unrealize;
|
widget_class->unrealize = gtk_image_unrealize;
|
||||||
widget_class->css_changed = gtk_image_css_changed;
|
widget_class->css_changed = gtk_image_css_changed;
|
||||||
|
widget_class->system_setting_changed = gtk_image_system_setting_changed;
|
||||||
widget_class->grab_focus = gtk_widget_grab_focus_none;
|
widget_class->grab_focus = gtk_widget_grab_focus_none;
|
||||||
widget_class->focus = gtk_widget_focus_none;
|
widget_class->focus = gtk_widget_focus_none;
|
||||||
|
|
||||||
@ -1264,6 +1267,18 @@ gtk_image_css_changed (GtkWidget *widget,
|
|||||||
image->baseline_align = 0.0;
|
image->baseline_align = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_image_system_setting_changed (GtkWidget *widget,
|
||||||
|
GtkSystemSetting setting)
|
||||||
|
{
|
||||||
|
GtkImage *image = GTK_IMAGE (widget);
|
||||||
|
|
||||||
|
if (setting == GTK_SYSTEM_SETTING_ICON_THEME)
|
||||||
|
gtk_icon_helper_invalidate (image->icon_helper);
|
||||||
|
|
||||||
|
GTK_WIDGET_CLASS (gtk_image_parent_class)->system_setting_changed (widget, setting);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_image_set_pixel_size:
|
* gtk_image_set_pixel_size:
|
||||||
* @image: a #GtkImage
|
* @image: a #GtkImage
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "gtkmountoperationprivate.h"
|
#include "gtkmountoperationprivate.h"
|
||||||
#include "gtkbox.h"
|
#include "gtkbox.h"
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtkdbusgenerated.h"
|
#include "gtkdbusgenerated.h"
|
||||||
#include "gtkentry.h"
|
#include "gtkentry.h"
|
||||||
#include "gtkbox.h"
|
#include "gtkbox.h"
|
||||||
@ -1206,9 +1205,7 @@ add_pid_to_process_list_store (GtkMountOperation *mount_operation,
|
|||||||
GtkIconTheme *theme;
|
GtkIconTheme *theme;
|
||||||
GtkIconPaintable *icon;
|
GtkIconPaintable *icon;
|
||||||
|
|
||||||
theme = gtk_css_icon_theme_value_get_icon_theme
|
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (mount_operation->priv->dialog)));
|
||||||
(_gtk_style_context_peek_property (gtk_widget_get_style_context (GTK_WIDGET (mount_operation->priv->dialog)),
|
|
||||||
GTK_CSS_PROPERTY_ICON_THEME));
|
|
||||||
icon = gtk_icon_theme_lookup_icon (theme,
|
icon = gtk_icon_theme_lookup_icon (theme,
|
||||||
"application-x-executable",
|
"application-x-executable",
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "gtkstyleproviderprivate.h"
|
#include "gtkstyleproviderprivate.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkversion.h"
|
#include "gtkversion.h"
|
||||||
#include "gtkwidget.h"
|
#include "gtkwidgetprivate.h"
|
||||||
|
|
||||||
#include "gdk/gdk-private.h"
|
#include "gdk/gdk-private.h"
|
||||||
|
|
||||||
@ -1246,32 +1246,28 @@ gtk_settings_notify (GObject *object,
|
|||||||
case PROP_FONT_NAME:
|
case PROP_FONT_NAME:
|
||||||
settings_update_font_values (settings);
|
settings_update_font_values (settings);
|
||||||
settings_invalidate_style (settings);
|
settings_invalidate_style (settings);
|
||||||
gtk_style_context_reset_widgets (settings->display);
|
gtk_system_setting_changed (settings->display, GTK_SYSTEM_SETTING_FONT_NAME);
|
||||||
break;
|
break;
|
||||||
case PROP_THEME_NAME:
|
case PROP_THEME_NAME:
|
||||||
case PROP_APPLICATION_PREFER_DARK_THEME:
|
case PROP_APPLICATION_PREFER_DARK_THEME:
|
||||||
settings_update_theme (settings);
|
settings_update_theme (settings);
|
||||||
break;
|
break;
|
||||||
case PROP_XFT_DPI:
|
case PROP_XFT_DPI:
|
||||||
/* This is a hack because with gtk_rc_reset_styles() doesn't get
|
gtk_system_setting_changed (settings->display, GTK_SYSTEM_SETTING_DPI);
|
||||||
* widgets with gtk_widget_style_set(), and also causes more
|
|
||||||
* recomputation than necessary.
|
|
||||||
*/
|
|
||||||
gtk_style_context_reset_widgets (settings->display);
|
|
||||||
break;
|
break;
|
||||||
case PROP_XFT_ANTIALIAS:
|
case PROP_XFT_ANTIALIAS:
|
||||||
case PROP_XFT_HINTING:
|
case PROP_XFT_HINTING:
|
||||||
case PROP_XFT_HINTSTYLE:
|
case PROP_XFT_HINTSTYLE:
|
||||||
case PROP_XFT_RGBA:
|
case PROP_XFT_RGBA:
|
||||||
settings_update_font_options (settings);
|
settings_update_font_options (settings);
|
||||||
gtk_style_context_reset_widgets (settings->display);
|
gtk_system_setting_changed (settings->display, GTK_SYSTEM_SETTING_FONT_CONFIG);
|
||||||
break;
|
break;
|
||||||
case PROP_FONTCONFIG_TIMESTAMP:
|
case PROP_FONTCONFIG_TIMESTAMP:
|
||||||
if (settings_update_fontconfig (settings))
|
if (settings_update_fontconfig (settings))
|
||||||
gtk_style_context_reset_widgets (settings->display);
|
gtk_system_setting_changed (settings->display, GTK_SYSTEM_SETTING_FONT_CONFIG);
|
||||||
break;
|
break;
|
||||||
case PROP_ENABLE_ANIMATIONS:
|
case PROP_ENABLE_ANIMATIONS:
|
||||||
gtk_style_context_reset_widgets (settings->display);
|
settings_invalidate_style (settings);
|
||||||
break;
|
break;
|
||||||
case PROP_CURSOR_THEME_NAME:
|
case PROP_CURSOR_THEME_NAME:
|
||||||
case PROP_CURSOR_THEME_SIZE:
|
case PROP_CURSOR_THEME_SIZE:
|
||||||
|
@ -415,36 +415,6 @@ gtk_style_context_remove_provider (GtkStyleContext *context,
|
|||||||
_gtk_style_cascade_remove_provider (priv->cascade, provider);
|
_gtk_style_cascade_remove_provider (priv->cascade, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_style_context_reset_widgets:
|
|
||||||
* @display: a #GdkDisplay
|
|
||||||
*
|
|
||||||
* This function recomputes the styles for all widgets under a particular
|
|
||||||
* #GdkDisplay. This is useful when some global parameter has changed that
|
|
||||||
* affects the appearance of all widgets, because when a widget gets a new
|
|
||||||
* style, it will both redraw and recompute any cached information about
|
|
||||||
* its appearance. As an example, it is used when the color scheme changes
|
|
||||||
* in the related #GtkSettings object.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
gtk_style_context_reset_widgets (GdkDisplay *display)
|
|
||||||
{
|
|
||||||
GList *list, *toplevels;
|
|
||||||
|
|
||||||
toplevels = gtk_window_list_toplevels ();
|
|
||||||
g_list_foreach (toplevels, (GFunc) g_object_ref, NULL);
|
|
||||||
|
|
||||||
for (list = toplevels; list; list = list->next)
|
|
||||||
{
|
|
||||||
if (gtk_widget_get_display (list->data) == display)
|
|
||||||
gtk_widget_reset_style (list->data);
|
|
||||||
|
|
||||||
g_object_unref (list->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (toplevels);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_style_context_add_provider_for_display:
|
* gtk_style_context_add_provider_for_display:
|
||||||
* @display: a #GdkDisplay
|
* @display: a #GdkDisplay
|
||||||
|
@ -57,9 +57,6 @@ void _gtk_style_context_get_cursor_color (GtkStyleContext
|
|||||||
AtkAttributeSet *_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
|
AtkAttributeSet *_gtk_style_context_get_attributes (AtkAttributeSet *attributes,
|
||||||
GtkStyleContext *context);
|
GtkStyleContext *context);
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
void gtk_style_context_reset_widgets (GdkDisplay *display);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GTK_STYLE_CONTEXT_PRIVATE_H__ */
|
#endif /* __GTK_STYLE_CONTEXT_PRIVATE_H__ */
|
||||||
|
104
gtk/gtkwidget.c
104
gtk/gtkwidget.c
@ -592,6 +592,8 @@ static gboolean gtk_widget_real_query_tooltip (GtkWidget *widget,
|
|||||||
GtkTooltip *tooltip);
|
GtkTooltip *tooltip);
|
||||||
static void gtk_widget_real_css_changed (GtkWidget *widget,
|
static void gtk_widget_real_css_changed (GtkWidget *widget,
|
||||||
GtkCssStyleChange *change);
|
GtkCssStyleChange *change);
|
||||||
|
static void gtk_widget_real_system_setting_changed (GtkWidget *widget,
|
||||||
|
GtkSystemSetting setting);
|
||||||
|
|
||||||
static void gtk_widget_real_set_focus_child (GtkWidget *widget,
|
static void gtk_widget_real_set_focus_child (GtkWidget *widget,
|
||||||
GtkWidget *child);
|
GtkWidget *child);
|
||||||
@ -911,6 +913,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
|
|||||||
klass->keynav_failed = gtk_widget_real_keynav_failed;
|
klass->keynav_failed = gtk_widget_real_keynav_failed;
|
||||||
klass->query_tooltip = gtk_widget_real_query_tooltip;
|
klass->query_tooltip = gtk_widget_real_query_tooltip;
|
||||||
klass->css_changed = gtk_widget_real_css_changed;
|
klass->css_changed = gtk_widget_real_css_changed;
|
||||||
|
klass->system_setting_changed = gtk_widget_real_system_setting_changed;
|
||||||
|
|
||||||
/* Accessibility support */
|
/* Accessibility support */
|
||||||
klass->priv->accessible_type = GTK_TYPE_ACCESSIBLE;
|
klass->priv->accessible_type = GTK_TYPE_ACCESSIBLE;
|
||||||
@ -4865,6 +4868,29 @@ gtk_widget_real_css_changed (GtkWidget *widget,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_widget_real_system_setting_changed (GtkWidget *widget,
|
||||||
|
GtkSystemSetting setting)
|
||||||
|
{
|
||||||
|
GtkWidget *child;
|
||||||
|
|
||||||
|
if (setting == GTK_SYSTEM_SETTING_DPI ||
|
||||||
|
setting == GTK_SYSTEM_SETTING_FONT_NAME ||
|
||||||
|
setting == GTK_SYSTEM_SETTING_FONT_CONFIG)
|
||||||
|
{
|
||||||
|
gtk_widget_update_pango_context (widget);
|
||||||
|
if (gtk_widget_peek_pango_context (widget))
|
||||||
|
gtk_widget_queue_resize (widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (child = _gtk_widget_get_first_child (widget);
|
||||||
|
child != NULL;
|
||||||
|
child = _gtk_widget_get_next_sibling (child))
|
||||||
|
{
|
||||||
|
gtk_widget_system_setting_changed (child, setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
direction_is_forward (GtkDirectionType direction)
|
direction_is_forward (GtkDirectionType direction)
|
||||||
{
|
{
|
||||||
@ -6001,38 +6027,6 @@ gtk_widget_real_direction_changed (GtkWidget *widget,
|
|||||||
gtk_widget_queue_resize (widget);
|
gtk_widget_queue_resize (widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
reset_style_recurse (GtkWidget *widget, gpointer user_data)
|
|
||||||
{
|
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
|
||||||
|
|
||||||
gtk_css_node_invalidate (priv->cssnode, GTK_CSS_CHANGE_ANY);
|
|
||||||
|
|
||||||
gtk_widget_forall (widget, reset_style_recurse, user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* gtk_widget_reset_style:
|
|
||||||
* @widget: a #GtkWidget
|
|
||||||
*
|
|
||||||
* Updates the style context of @widget and all descendants
|
|
||||||
* by updating its widget path. #GtkContainers may want
|
|
||||||
* to use this on a child when reordering it in a way that a different
|
|
||||||
* style might apply to it.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
gtk_widget_reset_style (GtkWidget *widget)
|
|
||||||
{
|
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
|
||||||
|
|
||||||
reset_style_recurse (widget, NULL);
|
|
||||||
|
|
||||||
g_list_foreach (priv->attached_windows,
|
|
||||||
(GFunc) reset_style_recurse, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef G_ENABLE_CONSISTENCY_CHECKS
|
#ifdef G_ENABLE_CONSISTENCY_CHECKS
|
||||||
|
|
||||||
/* Verify invariants, see docs/widget_system.txt for notes on much of
|
/* Verify invariants, see docs/widget_system.txt for notes on much of
|
||||||
@ -9188,8 +9182,6 @@ gtk_widget_buildable_custom_finished (GtkBuildable *buildable,
|
|||||||
for (l = style_data->classes; l; l = l->next)
|
for (l = style_data->classes; l; l = l->next)
|
||||||
gtk_widget_add_css_class (GTK_WIDGET (buildable), (const char *)l->data);
|
gtk_widget_add_css_class (GTK_WIDGET (buildable), (const char *)l->data);
|
||||||
|
|
||||||
gtk_widget_reset_style (GTK_WIDGET (buildable));
|
|
||||||
|
|
||||||
g_slist_free_full (style_data->classes, g_free);
|
g_slist_free_full (style_data->classes, g_free);
|
||||||
g_slice_free (StyleParserData, style_data);
|
g_slice_free (StyleParserData, style_data);
|
||||||
}
|
}
|
||||||
@ -10555,24 +10547,6 @@ _gtk_widget_get_sizegroups (GtkWidget *widget)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_widget_add_attached_window (GtkWidget *widget,
|
|
||||||
GtkWindow *window)
|
|
||||||
{
|
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
|
||||||
|
|
||||||
priv->attached_windows = g_list_prepend (priv->attached_windows, window);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_gtk_widget_remove_attached_window (GtkWidget *widget,
|
|
||||||
GtkWindow *window)
|
|
||||||
{
|
|
||||||
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
|
||||||
|
|
||||||
priv->attached_windows = g_list_remove (priv->attached_windows, window);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_widget_class_set_css_name:
|
* gtk_widget_class_set_css_name:
|
||||||
* @widget_class: class to set the name on
|
* @widget_class: class to set the name on
|
||||||
@ -10627,6 +10601,32 @@ gtk_widget_css_changed (GtkWidget *widget,
|
|||||||
GTK_WIDGET_GET_CLASS (widget)->css_changed (widget, change);
|
GTK_WIDGET_GET_CLASS (widget)->css_changed (widget, change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_widget_system_setting_changed (GtkWidget *widget,
|
||||||
|
GtkSystemSetting setting)
|
||||||
|
{
|
||||||
|
GTK_WIDGET_GET_CLASS (widget)->system_setting_changed (widget, setting);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gtk_system_setting_changed (GdkDisplay *display,
|
||||||
|
GtkSystemSetting setting)
|
||||||
|
{
|
||||||
|
GList *list, *toplevels;
|
||||||
|
|
||||||
|
toplevels = gtk_window_list_toplevels ();
|
||||||
|
g_list_foreach (toplevels, (GFunc) g_object_ref, NULL);
|
||||||
|
|
||||||
|
for (list = toplevels; list; list = list->next)
|
||||||
|
{
|
||||||
|
if (gtk_widget_get_display (list->data) == display)
|
||||||
|
gtk_widget_system_setting_changed (list->data, setting);
|
||||||
|
g_object_unref (list->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free (toplevels);
|
||||||
|
}
|
||||||
|
|
||||||
GtkCssNode *
|
GtkCssNode *
|
||||||
gtk_widget_get_css_node (GtkWidget *widget)
|
gtk_widget_get_css_node (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
@ -201,6 +201,7 @@ struct _GtkWidget
|
|||||||
* should then discard their caches that depend on CSS and queue resizes or
|
* should then discard their caches that depend on CSS and queue resizes or
|
||||||
* redraws accordingly. The default implementation will take care of this for
|
* redraws accordingly. The default implementation will take care of this for
|
||||||
* all the default CSS properties, so implementations must chain up.
|
* all the default CSS properties, so implementations must chain up.
|
||||||
|
* @system_setting_changed: Emitted when a system setting was changed. Must chain up.
|
||||||
* @snapshot: Vfunc for gtk_widget_snapshot().
|
* @snapshot: Vfunc for gtk_widget_snapshot().
|
||||||
* @contains: Vfunc for gtk_widget_contains().
|
* @contains: Vfunc for gtk_widget_contains().
|
||||||
*/
|
*/
|
||||||
@ -277,6 +278,9 @@ struct _GtkWidgetClass
|
|||||||
void (* css_changed) (GtkWidget *widget,
|
void (* css_changed) (GtkWidget *widget,
|
||||||
GtkCssStyleChange *change);
|
GtkCssStyleChange *change);
|
||||||
|
|
||||||
|
void (* system_setting_changed) (GtkWidget *widget,
|
||||||
|
GtkSystemSetting settings);
|
||||||
|
|
||||||
void (* snapshot) (GtkWidget *widget,
|
void (* snapshot) (GtkWidget *widget,
|
||||||
GtkSnapshot *snapshot);
|
GtkSnapshot *snapshot);
|
||||||
|
|
||||||
@ -676,8 +680,6 @@ void gtk_widget_add_controller (GtkWidget *widget,
|
|||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
void gtk_widget_remove_controller (GtkWidget *widget,
|
void gtk_widget_remove_controller (GtkWidget *widget,
|
||||||
GtkEventController *controller);
|
GtkEventController *controller);
|
||||||
GDK_AVAILABLE_IN_ALL
|
|
||||||
void gtk_widget_reset_style (GtkWidget *widget);
|
|
||||||
|
|
||||||
GDK_AVAILABLE_IN_ALL
|
GDK_AVAILABLE_IN_ALL
|
||||||
PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
|
PangoContext *gtk_widget_create_pango_context (GtkWidget *widget);
|
||||||
|
@ -144,12 +144,6 @@ struct _GtkWidgetPrivate
|
|||||||
*/
|
*/
|
||||||
GtkRoot *root;
|
GtkRoot *root;
|
||||||
|
|
||||||
/* The list of attached windows to this widget.
|
|
||||||
* We keep a list in order to call reset_style to all of them,
|
|
||||||
* recursively.
|
|
||||||
*/
|
|
||||||
GList *attached_windows;
|
|
||||||
|
|
||||||
/* The style for the widget. The style contains the
|
/* The style for the widget. The style contains the
|
||||||
* colors the widget should be drawn in for each state
|
* colors the widget should be drawn in for each state
|
||||||
* along with graphics contexts used to draw with and
|
* along with graphics contexts used to draw with and
|
||||||
@ -243,11 +237,6 @@ void _gtk_widget_remove_sizegroup (GtkWidget *widget,
|
|||||||
gpointer group);
|
gpointer group);
|
||||||
GSList *_gtk_widget_get_sizegroups (GtkWidget *widget);
|
GSList *_gtk_widget_get_sizegroups (GtkWidget *widget);
|
||||||
|
|
||||||
void _gtk_widget_add_attached_window (GtkWidget *widget,
|
|
||||||
GtkWindow *window);
|
|
||||||
void _gtk_widget_remove_attached_window (GtkWidget *widget,
|
|
||||||
GtkWindow *window);
|
|
||||||
|
|
||||||
AtkObject * _gtk_widget_peek_accessible (GtkWidget *widget);
|
AtkObject * _gtk_widget_peek_accessible (GtkWidget *widget);
|
||||||
|
|
||||||
void _gtk_widget_set_has_default (GtkWidget *widget,
|
void _gtk_widget_set_has_default (GtkWidget *widget,
|
||||||
@ -282,6 +271,10 @@ gboolean _gtk_widget_captured_event (GtkWidget *widget,
|
|||||||
|
|
||||||
void gtk_widget_css_changed (GtkWidget *widget,
|
void gtk_widget_css_changed (GtkWidget *widget,
|
||||||
GtkCssStyleChange *change);
|
GtkCssStyleChange *change);
|
||||||
|
void gtk_widget_system_setting_changed (GtkWidget *widget,
|
||||||
|
GtkSystemSetting setting);
|
||||||
|
void gtk_system_setting_changed (GdkDisplay *display,
|
||||||
|
GtkSystemSetting setting);
|
||||||
|
|
||||||
void _gtk_widget_update_parent_muxer (GtkWidget *widget);
|
void _gtk_widget_update_parent_muxer (GtkWidget *widget);
|
||||||
GtkActionMuxer * _gtk_widget_get_action_muxer (GtkWidget *widget,
|
GtkActionMuxer * _gtk_widget_get_action_muxer (GtkWidget *widget,
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "gtkbutton.h"
|
#include "gtkbutton.h"
|
||||||
#include "gtkcheckbutton.h"
|
#include "gtkcheckbutton.h"
|
||||||
#include "gtkcsscornervalueprivate.h"
|
#include "gtkcsscornervalueprivate.h"
|
||||||
#include "gtkcssiconthemevalueprivate.h"
|
|
||||||
#include "gtkcsscolorvalueprivate.h"
|
#include "gtkcsscolorvalueprivate.h"
|
||||||
#include "gtkcssshadowvalueprivate.h"
|
#include "gtkcssshadowvalueprivate.h"
|
||||||
#include "gtkcssstylepropertyprivate.h"
|
#include "gtkcssstylepropertyprivate.h"
|
||||||
@ -2551,11 +2550,7 @@ remove_attach_widget (GtkWindow *window)
|
|||||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||||
|
|
||||||
if (priv->attach_widget)
|
if (priv->attach_widget)
|
||||||
{
|
|
||||||
_gtk_widget_remove_attached_window (priv->attach_widget, window);
|
|
||||||
|
|
||||||
priv->attach_widget = NULL;
|
priv->attach_widget = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -3363,17 +3358,13 @@ icon_list_from_theme (GtkWindow *window,
|
|||||||
{
|
{
|
||||||
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
|
||||||
GList *list;
|
GList *list;
|
||||||
GtkStyleContext *context;
|
|
||||||
GtkCssValue *value;
|
|
||||||
GtkIconTheme *icon_theme;
|
GtkIconTheme *icon_theme;
|
||||||
GtkIconPaintable *info;
|
GtkIconPaintable *info;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
gint *sizes;
|
gint *sizes;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
context = gtk_widget_get_style_context (GTK_WIDGET (window));
|
icon_theme = gtk_icon_theme_get_for_display (priv->display);
|
||||||
value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_THEME);
|
|
||||||
icon_theme = gtk_css_icon_theme_value_get_icon_theme (value);
|
|
||||||
|
|
||||||
sizes = gtk_icon_theme_get_icon_sizes (icon_theme, name);
|
sizes = gtk_icon_theme_get_icon_sizes (icon_theme, name);
|
||||||
|
|
||||||
@ -5736,9 +5727,6 @@ gtk_window_css_changed (GtkWidget *widget,
|
|||||||
|
|
||||||
update_opaque_region (window, &window_border, &allocation);
|
update_opaque_region (window, &window_border, &allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (change == NULL || gtk_css_style_change_changes_property (change, GTK_CSS_PROPERTY_ICON_THEME))
|
|
||||||
update_themed_icon (window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -7118,6 +7106,8 @@ gtk_window_set_display (GtkWindow *window,
|
|||||||
gtk_widget_map (widget);
|
gtk_widget_map (widget);
|
||||||
|
|
||||||
check_scale_changed (window);
|
check_scale_changed (window);
|
||||||
|
|
||||||
|
gtk_widget_system_setting_changed (GTK_WIDGET (window), GTK_SYSTEM_SETTING_DISPLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -55,7 +55,6 @@ gtk_private_sources = files([
|
|||||||
'gtkcssfiltervalue.c',
|
'gtkcssfiltervalue.c',
|
||||||
'gtkcssfontfeaturesvalue.c',
|
'gtkcssfontfeaturesvalue.c',
|
||||||
'gtkcssfontvariationsvalue.c',
|
'gtkcssfontvariationsvalue.c',
|
||||||
'gtkcssiconthemevalue.c',
|
|
||||||
'gtkcssimage.c',
|
'gtkcssimage.c',
|
||||||
'gtkcssimagecrossfade.c',
|
'gtkcssimagecrossfade.c',
|
||||||
'gtkcssimagefallback.c',
|
'gtkcssimagefallback.c',
|
||||||
|
Loading…
Reference in New Issue
Block a user