Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 90bcb52293 | |||
| 3b48e562dd | |||
| fc12246758 | |||
| ae194d14d1 | |||
| c55a492ad3 | |||
| b70d8c477d |
@@ -28,14 +28,9 @@ GdkWindow *_gdk_root = NULL;
|
||||
GdkOSXVersion
|
||||
gdk_quartz_osx_version (void)
|
||||
{
|
||||
static gint32 minor = GDK_OSX_UNSUPPORTED;
|
||||
|
||||
if (minor == GDK_OSX_UNSUPPORTED)
|
||||
{
|
||||
OSErr err = Gestalt (gestaltSystemVersionMinor, (SInt32*)&minor);
|
||||
|
||||
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
|
||||
}
|
||||
gint minor;
|
||||
OSErr err = Gestalt (gestaltSystemVersionMinor, &minor);
|
||||
g_return_val_if_fail (err == noErr, GDK_OSX_UNSUPPORTED);
|
||||
|
||||
if (minor < GDK_OSX_MIN)
|
||||
return GDK_OSX_UNSUPPORTED;
|
||||
|
||||
@@ -48,8 +48,7 @@ typedef enum
|
||||
GDK_OSX_LEOPARD = 5,
|
||||
GDK_OSX_SNOW_LEOPARD = 6,
|
||||
GDK_OSX_LION = 7,
|
||||
GDK_OSX_MOUNTAIN_LION = 8,
|
||||
GDK_OSX_CURRENT = 8,
|
||||
GDK_OSX_CURRENT = 7,
|
||||
GDK_OSX_NEW = 99
|
||||
} GdkOSXVersion;
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "gdk.h"
|
||||
#include "gdkwindowimpl.h"
|
||||
@@ -1534,7 +1533,7 @@ gdk_win32_window_set_urgency_hint (GdkWindow *window,
|
||||
gboolean urgent)
|
||||
{
|
||||
FLASHWINFO flashwinfo;
|
||||
typedef BOOL (WINAPI *PFN_FlashWindowEx) (FLASHWINFO*);
|
||||
typedef BOOL (*PFN_FlashWindowEx) (FLASHWINFO*);
|
||||
PFN_FlashWindowEx flashWindowEx = NULL;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
@@ -3265,7 +3264,7 @@ gdk_win32_window_set_opacity (GdkWindow *window,
|
||||
gdouble opacity)
|
||||
{
|
||||
LONG exstyle;
|
||||
typedef BOOL (WINAPI *PFN_SetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
|
||||
typedef BOOL (*PFN_SetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
|
||||
PFN_SetLayeredWindowAttributes setLayeredWindowAttributes = NULL;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
|
||||
@@ -82,8 +82,7 @@ static const char gdk_settings_names[] =
|
||||
"Gtk/VisibleFocus\0" "gtk-visible-focus\0"
|
||||
"Gtk/ShellShowsAppMenu\0" "gtk-shell-shows-app-menu\0"
|
||||
"Gtk/ShellShowsMenubar\0" "gtk-shell-shows-menubar\0"
|
||||
"Gtk/EnablePrimaryPaste\0" "gtk-enable-primary-paste\0"
|
||||
"Gtk/RecentFilesMaxAge\0" "gtk-recent-files-max-age\0";
|
||||
"Gtk/EnablePrimaryPaste\0" "gtk-enable-primary-paste\0";
|
||||
|
||||
|
||||
|
||||
@@ -141,6 +140,5 @@ static const struct
|
||||
{ 1767, 1784 },
|
||||
{ 1802, 1824 },
|
||||
{ 1849, 1871 },
|
||||
{ 1895, 1918 },
|
||||
{ 1943, 1965 }
|
||||
{ 1895, 1918 }
|
||||
};
|
||||
|
||||
+7
-10
@@ -148,7 +148,6 @@ deprecated_h_sources = \
|
||||
deprecated/gtkcolorsel.h \
|
||||
deprecated/gtkcolorseldialog.h \
|
||||
deprecated/gtkfontsel.h \
|
||||
deprecated/gtkgradient.h \
|
||||
deprecated/gtkhandlebox.h \
|
||||
deprecated/gtkhbbox.h \
|
||||
deprecated/gtkhbox.h \
|
||||
@@ -157,9 +156,8 @@ deprecated_h_sources = \
|
||||
deprecated/gtkhscrollbar.h \
|
||||
deprecated/gtkhseparator.h \
|
||||
deprecated/gtkhsv.h \
|
||||
deprecated/gtkrc.h \
|
||||
deprecated/gtkstyle.h \
|
||||
deprecated/gtksymboliccolor.h \
|
||||
deprecated/gtkrc.h \
|
||||
deprecated/gtktable.h \
|
||||
deprecated/gtktearoffmenuitem.h \
|
||||
deprecated/gtkvbbox.h \
|
||||
@@ -169,10 +167,6 @@ deprecated_h_sources = \
|
||||
deprecated/gtkvseparator.h \
|
||||
deprecated/gtkvpaned.h
|
||||
|
||||
deprecated_private_h_sources = \
|
||||
deprecated/gtkgradientprivate.h \
|
||||
deprecated/gtksymboliccolorprivate.h
|
||||
|
||||
gtk_public_h_sources = \
|
||||
gtk.h \
|
||||
gtkx.h \
|
||||
@@ -255,6 +249,7 @@ gtk_public_h_sources = \
|
||||
gtkfontchooserdialog.h \
|
||||
gtkfontchooserwidget.h \
|
||||
gtkframe.h \
|
||||
gtkgradient.h \
|
||||
gtkgrid.h \
|
||||
gtkiconfactory.h \
|
||||
gtkicontheme.h \
|
||||
@@ -335,6 +330,7 @@ gtk_public_h_sources = \
|
||||
gtkstyleproperties.h \
|
||||
gtkstyleprovider.h \
|
||||
gtkswitch.h \
|
||||
gtksymboliccolor.h \
|
||||
gtktestutils.h \
|
||||
gtktextattributes.h \
|
||||
gtktextbuffer.h \
|
||||
@@ -482,6 +478,7 @@ gtk_private_h_sources = \
|
||||
gtkfilesystemmodel.h \
|
||||
gtkfontchooserprivate.h \
|
||||
gtkfontchooserutils.h \
|
||||
gtkgradientprivate.h \
|
||||
gtkhslaprivate.h \
|
||||
gtkiconcache.h \
|
||||
gtkiconhelperprivate.h \
|
||||
@@ -530,6 +527,7 @@ gtk_private_h_sources = \
|
||||
gtkstylepropertiesprivate.h \
|
||||
gtkstylepropertyprivate.h \
|
||||
gtkstyleproviderprivate.h \
|
||||
gtksymboliccolorprivate.h \
|
||||
gtktextbtree.h \
|
||||
gtktextbufferserialize.h \
|
||||
gtktextchildprivate.h \
|
||||
@@ -558,7 +556,6 @@ deprecated_c_sources = \
|
||||
deprecated/gtkcolorsel.c \
|
||||
deprecated/gtkcolorseldialog.c \
|
||||
deprecated/gtkfontsel.c \
|
||||
deprecated/gtkgradient.c \
|
||||
deprecated/gtkhandlebox.c \
|
||||
deprecated/gtkhbbox.c \
|
||||
deprecated/gtkhbox.c \
|
||||
@@ -569,7 +566,6 @@ deprecated_c_sources = \
|
||||
deprecated/gtkhsv.c \
|
||||
deprecated/gtkrc.c \
|
||||
deprecated/gtkstyle.c \
|
||||
deprecated/gtksymboliccolor.c \
|
||||
deprecated/gtktable.c \
|
||||
deprecated/gtktearoffmenuitem.c \
|
||||
deprecated/gtkvbbox.c \
|
||||
@@ -725,6 +721,7 @@ gtk_base_c_sources = \
|
||||
gtkfontchooserutils.c \
|
||||
gtkfontchooserwidget.c \
|
||||
gtkframe.c \
|
||||
gtkgradient.c \
|
||||
gtkgrid.c \
|
||||
gtkhsla.c \
|
||||
gtkiconcache.c \
|
||||
@@ -827,6 +824,7 @@ gtk_base_c_sources = \
|
||||
gtkstyleprovider.c \
|
||||
gtkstyleproviderprivate.c \
|
||||
gtkswitch.c \
|
||||
gtksymboliccolor.c \
|
||||
gtktestutils.c \
|
||||
gtktextattributes.c \
|
||||
gtktextbtree.c \
|
||||
@@ -975,7 +973,6 @@ gtk_private_h_sources += $(gtk_use_quartz_private_h_sources)
|
||||
endif
|
||||
|
||||
gtk_all_private_h_sources = \
|
||||
$(deprecated_private_h_sources) \
|
||||
$(gtk_private_h_sources) \
|
||||
$(gtk_use_x11_private_h_sources) \
|
||||
$(gtk_use_win32_private_h_sources) \
|
||||
|
||||
@@ -287,13 +287,10 @@ gtk_cell_accessible_action_do_action (AtkAction *action,
|
||||
{
|
||||
case 0:
|
||||
_gtk_cell_accessible_parent_expand_collapse (parent, cell);
|
||||
break;
|
||||
case 1:
|
||||
_gtk_cell_accessible_parent_edit (parent, cell);
|
||||
break;
|
||||
case 2:
|
||||
_gtk_cell_accessible_parent_activate (parent, cell);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -708,7 +708,7 @@ gtk_icon_view_item_accessible_is_showing (GtkIconViewItemAccessible *item)
|
||||
if (icon_view->priv->hadjustment)
|
||||
visible_rect.x += gtk_adjustment_get_value (icon_view->priv->hadjustment);
|
||||
visible_rect.y = 0;
|
||||
if (icon_view->priv->vadjustment)
|
||||
if (icon_view->priv->hadjustment)
|
||||
visible_rect.y += gtk_adjustment_get_value (icon_view->priv->vadjustment);
|
||||
visible_rect.width = allocation.width;
|
||||
visible_rect.height = allocation.height;
|
||||
|
||||
@@ -499,7 +499,6 @@ gtk_widget_accessible_notify_gtk (GObject *obj,
|
||||
gtk_widget_accessible_update_tooltip (GTK_WIDGET_ACCESSIBLE (atk_obj),
|
||||
widget);
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
atk_object_notify_state_change (atk_obj, state, value);
|
||||
|
||||
@@ -1,359 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
|
||||
*
|
||||
* 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"
|
||||
|
||||
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssrgbavalueprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkhslaprivate.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
#include "gtkstyleproperties.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkwin32themeprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtksymboliccolor
|
||||
* @Short_description: Symbolic colors
|
||||
* @Title: GtkSymbolicColor
|
||||
*
|
||||
* GtkSymbolicColor is a boxed type that represents a symbolic color.
|
||||
* It is the result of parsing a
|
||||
* <link linkend="gtkcssprovider-symbolic-colors">color expression</link>.
|
||||
* To obtain the color represented by a GtkSymbolicColor, it has to
|
||||
* be resolved with gtk_symbolic_color_resolve(), which replaces all
|
||||
* symbolic color references by the colors they refer to (in a given
|
||||
* context) and evaluates mix, shade and other expressions, resulting
|
||||
* in a #GdkRGBA value.
|
||||
*
|
||||
* It is not normally necessary to deal directly with #GtkSymbolicColors,
|
||||
* since they are mostly used behind the scenes by #GtkStyleContext and
|
||||
* #GtkCssProvider.
|
||||
*
|
||||
* #GtkSymbolicColor is deprecated. Symbolic colors are considered an
|
||||
* implementation detail of GTK+.
|
||||
*/
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GtkSymbolicColor, gtk_symbolic_color,
|
||||
gtk_symbolic_color_ref, gtk_symbolic_color_unref)
|
||||
|
||||
struct _GtkSymbolicColor
|
||||
{
|
||||
GtkCssValue *value;
|
||||
gint ref_count;
|
||||
};
|
||||
|
||||
static GtkSymbolicColor *
|
||||
gtk_symbolic_color_new (GtkCssValue *value)
|
||||
{
|
||||
GtkSymbolicColor *symbolic;
|
||||
|
||||
symbolic = g_slice_new0 (GtkSymbolicColor);
|
||||
symbolic->value = value;
|
||||
symbolic->ref_count = 1;
|
||||
|
||||
return symbolic;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_new_literal:
|
||||
* @color: a #GdkRGBA
|
||||
*
|
||||
* Creates a symbolic color pointing to a literal color.
|
||||
*
|
||||
* Returns: a newly created #GtkSymbolicColor
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_symbolic_color_new_literal (const GdkRGBA *color)
|
||||
{
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
return gtk_symbolic_color_new (_gtk_css_color_value_new_literal (color));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_new_name:
|
||||
* @name: color name
|
||||
*
|
||||
* Creates a symbolic color pointing to an unresolved named
|
||||
* color. See gtk_style_context_lookup_color() and
|
||||
* gtk_style_properties_lookup_color().
|
||||
*
|
||||
* Returns: a newly created #GtkSymbolicColor
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_symbolic_color_new_name (const gchar *name)
|
||||
{
|
||||
g_return_val_if_fail (name != NULL, NULL);
|
||||
|
||||
return gtk_symbolic_color_new (_gtk_css_color_value_new_name (name));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_new_shade: (constructor)
|
||||
* @color: another #GtkSymbolicColor
|
||||
* @factor: shading factor to apply to @color
|
||||
*
|
||||
* Creates a symbolic color defined as a shade of
|
||||
* another color. A factor > 1.0 would resolve to
|
||||
* a brighter color, while < 1.0 would resolve to
|
||||
* a darker color.
|
||||
*
|
||||
* Returns: A newly created #GtkSymbolicColor
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_symbolic_color_new_shade (GtkSymbolicColor *color,
|
||||
gdouble factor)
|
||||
{
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
return gtk_symbolic_color_new (_gtk_css_color_value_new_shade (color->value,
|
||||
factor));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_new_alpha: (constructor)
|
||||
* @color: another #GtkSymbolicColor
|
||||
* @factor: factor to apply to @color alpha
|
||||
*
|
||||
* Creates a symbolic color by modifying the relative alpha
|
||||
* value of @color. A factor < 1.0 would resolve to a more
|
||||
* transparent color, while > 1.0 would resolve to a more
|
||||
* opaque color.
|
||||
*
|
||||
* Returns: A newly created #GtkSymbolicColor
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_symbolic_color_new_alpha (GtkSymbolicColor *color,
|
||||
gdouble factor)
|
||||
{
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
return gtk_symbolic_color_new (_gtk_css_color_value_new_alpha (color->value,
|
||||
factor));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_new_mix: (constructor)
|
||||
* @color1: color to mix
|
||||
* @color2: another color to mix
|
||||
* @factor: mix factor
|
||||
*
|
||||
* Creates a symbolic color defined as a mix of another
|
||||
* two colors. a mix factor of 0 would resolve to @color1,
|
||||
* while a factor of 1 would resolve to @color2.
|
||||
*
|
||||
* Returns: A newly created #GtkSymbolicColor
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_symbolic_color_new_mix (GtkSymbolicColor *color1,
|
||||
GtkSymbolicColor *color2,
|
||||
gdouble factor)
|
||||
{
|
||||
g_return_val_if_fail (color1 != NULL, NULL);
|
||||
g_return_val_if_fail (color1 != NULL, NULL);
|
||||
|
||||
return gtk_symbolic_color_new (_gtk_css_color_value_new_mix (color1->value,
|
||||
color2->value,
|
||||
factor));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_new_win32: (constructor)
|
||||
* @theme_class: The theme class to pull color from
|
||||
* @id: The color id
|
||||
*
|
||||
* Creates a symbolic color based on the current win32
|
||||
* theme.
|
||||
*
|
||||
* Note that while this call is available on all platforms
|
||||
* the actual value returned is not reliable on non-win32
|
||||
* platforms.
|
||||
*
|
||||
* Returns: A newly created #GtkSymbolicColor
|
||||
*
|
||||
* Since: 3.4
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
*/
|
||||
GtkSymbolicColor *
|
||||
gtk_symbolic_color_new_win32 (const gchar *theme_class,
|
||||
gint id)
|
||||
{
|
||||
g_return_val_if_fail (theme_class != NULL, NULL);
|
||||
|
||||
return gtk_symbolic_color_new (_gtk_css_color_value_new_win32 (theme_class, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_ref:
|
||||
* @color: a #GtkSymbolicColor
|
||||
*
|
||||
* Increases the reference count of @color
|
||||
*
|
||||
* Returns: the same @color
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_symbolic_color_ref (GtkSymbolicColor *color)
|
||||
{
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
color->ref_count++;
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_unref:
|
||||
* @color: a #GtkSymbolicColor
|
||||
*
|
||||
* Decreases the reference count of @color, freeing its memory if the
|
||||
* reference count reaches 0.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_symbolic_color_unref (GtkSymbolicColor *color)
|
||||
{
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
if (--color->ref_count)
|
||||
return;
|
||||
|
||||
_gtk_css_value_unref (color->value);
|
||||
|
||||
g_slice_free (GtkSymbolicColor, color);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_resolve:
|
||||
* @color: a #GtkSymbolicColor
|
||||
* @props: (allow-none): #GtkStyleProperties to use when resolving
|
||||
* named colors, or %NULL
|
||||
* @resolved_color: (out): return location for the resolved color
|
||||
*
|
||||
* If @color is resolvable, @resolved_color will be filled in
|
||||
* with the resolved color, and %TRUE will be returned. Generally,
|
||||
* if @color can't be resolved, it is due to it being defined on
|
||||
* top of a named color that doesn't exist in @props.
|
||||
*
|
||||
* When @props is %NULL, resolving of named colors will fail, so if
|
||||
* your @color is or references such a color, this function will
|
||||
* return %FALSE.
|
||||
*
|
||||
* Returns: %TRUE if the color has been resolved
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
gboolean
|
||||
gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
GtkStyleProperties *props,
|
||||
GdkRGBA *resolved_color)
|
||||
{
|
||||
GdkRGBA pink = { 1.0, 0.5, 0.5, 1.0 };
|
||||
GtkCssValue *v, *current;
|
||||
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
g_return_val_if_fail (resolved_color != NULL, FALSE);
|
||||
g_return_val_if_fail (props == NULL || GTK_IS_STYLE_PROPERTIES (props), FALSE);
|
||||
|
||||
current = _gtk_css_rgba_value_new_from_rgba (&pink);
|
||||
v = _gtk_css_color_value_resolve (color->value,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (props),
|
||||
current,
|
||||
0,
|
||||
NULL);
|
||||
_gtk_css_value_unref (current);
|
||||
if (v == NULL)
|
||||
return FALSE;
|
||||
|
||||
*resolved_color = *_gtk_css_rgba_value_get_rgba (v);
|
||||
_gtk_css_value_unref (v);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_symbolic_color_to_string:
|
||||
* @color: color to convert to a string
|
||||
*
|
||||
* Converts the given @color to a string representation. This is useful
|
||||
* both for debugging and for serialization of strings. The format of
|
||||
* the string may change between different versions of GTK, but it is
|
||||
* guaranteed that the GTK css parser is able to read the string and
|
||||
* create the same symbolic color from it.
|
||||
*
|
||||
* Returns: a new string representing @color
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
char *
|
||||
gtk_symbolic_color_to_string (GtkSymbolicColor *color)
|
||||
{
|
||||
g_return_val_if_fail (color != NULL, NULL);
|
||||
|
||||
return _gtk_css_value_to_string (color->value);
|
||||
}
|
||||
|
||||
GtkSymbolicColor *
|
||||
_gtk_css_symbolic_value_new (GtkCssParser *parser)
|
||||
{
|
||||
GtkCssValue *value;
|
||||
|
||||
value = _gtk_css_color_value_parse (parser);
|
||||
if (value == NULL)
|
||||
return NULL;
|
||||
|
||||
return gtk_symbolic_color_new (value);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_symbolic_color_get_css_value (GtkSymbolicColor *symbolic)
|
||||
{
|
||||
return symbolic->value;
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SYMBOLIC_COLOR_PRIVATE_H__
|
||||
#define __GTK_SYMBOLIC_COLOR_PRIVATE_H__
|
||||
|
||||
#include "gtk/deprecated/gtksymboliccolor.h"
|
||||
#include "gtk/gtkcssparserprivate.h"
|
||||
#include "gtk/gtkcssvalueprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GtkSymbolicColor * _gtk_css_symbolic_value_new (GtkCssParser *parser);
|
||||
|
||||
GtkCssValue * _gtk_symbolic_color_get_css_value (GtkSymbolicColor *symbolic);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SYMBOLIC_COLOR_PRIVATE_H__ */
|
||||
+2
-2
@@ -66,9 +66,9 @@ main (int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
/* Translators: this message will appear immediately after the */
|
||||
/* usage string - Usage: COMMAND [OPTION]… <THIS_MESSAGE> */
|
||||
/* usage string - Usage: COMMAND [OPTION]... <THIS_MESSAGE> */
|
||||
context =
|
||||
g_option_context_new (_("APPLICATION [URI…] — launch an APPLICATION with URI."));
|
||||
g_option_context_new (_("APPLICATION [URI...] - launch an APPLICATION with URI."));
|
||||
|
||||
/* Translators: this message will appear after the usage string */
|
||||
/* and before the list of options. */
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
#include <gtk/gtkfontchooserdialog.h>
|
||||
#include <gtk/gtkfontchooserwidget.h>
|
||||
#include <gtk/gtkframe.h>
|
||||
#include <gtk/gtkgradient.h>
|
||||
#include <gtk/gtkgrid.h>
|
||||
#include <gtk/gtkiconfactory.h>
|
||||
#include <gtk/gtkicontheme.h>
|
||||
@@ -184,6 +185,7 @@
|
||||
#include <gtk/gtkstyleproperties.h>
|
||||
#include <gtk/gtkstyleprovider.h>
|
||||
#include <gtk/gtkswitch.h>
|
||||
#include <gtk/gtksymboliccolor.h>
|
||||
#include <gtk/gtktextattributes.h>
|
||||
#include <gtk/gtktextbuffer.h>
|
||||
#include <gtk/gtktextbufferrichtext.h>
|
||||
@@ -227,7 +229,6 @@
|
||||
#include <gtk/deprecated/gtkcolorsel.h>
|
||||
#include <gtk/deprecated/gtkcolorseldialog.h>
|
||||
#include <gtk/deprecated/gtkfontsel.h>
|
||||
#include <gtk/deprecated/gtkgradient.h>
|
||||
#include <gtk/deprecated/gtkhandlebox.h>
|
||||
#include <gtk/deprecated/gtkhbbox.h>
|
||||
#include <gtk/deprecated/gtkhbox.h>
|
||||
@@ -238,7 +239,6 @@
|
||||
#include <gtk/deprecated/gtkhseparator.h>
|
||||
#include <gtk/deprecated/gtkrc.h>
|
||||
#include <gtk/deprecated/gtkstyle.h>
|
||||
#include <gtk/deprecated/gtksymboliccolor.h>
|
||||
#include <gtk/deprecated/gtktable.h>
|
||||
#include <gtk/deprecated/gtktearoffmenuitem.h>
|
||||
#include <gtk/deprecated/gtkvbbox.h>
|
||||
|
||||
@@ -2395,8 +2395,6 @@ create_credits_page (GtkAboutDialog *about)
|
||||
gtk_widget_set_valign (grid, GTK_ALIGN_START);
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), grid);
|
||||
|
||||
row = 0;
|
||||
|
||||
if (priv->authors != NULL)
|
||||
add_credits_section (about, GTK_GRID (grid), &row, _("Created by"), priv->authors);
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ gtk_action_helper_action_removed (GtkActionHelper *helper)
|
||||
|
||||
if (helper->active)
|
||||
{
|
||||
helper->active = FALSE;
|
||||
helper->enabled = FALSE;
|
||||
gtk_action_helper_report_change (helper, PROP_ACTIVE);
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ other_application_dialog_response_cb (GtkDialog *dialog,
|
||||
if (response_id != GTK_RESPONSE_OK)
|
||||
{
|
||||
/* reset the active item, otherwise we are stuck on
|
||||
* 'Other application…'
|
||||
* 'Other application...'
|
||||
*/
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (self), self->priv->last_active);
|
||||
gtk_widget_destroy (GTK_WIDGET (dialog));
|
||||
@@ -287,7 +287,7 @@ gtk_app_chooser_button_ensure_dialog_item (GtkAppChooserButton *self,
|
||||
|
||||
gtk_list_store_insert_after (self->priv->store, &iter, &iter2);
|
||||
real_insert_custom_item (self, CUSTOM_ITEM_OTHER_APP,
|
||||
_("Other application…"), NULL,
|
||||
_("Other application..."), NULL,
|
||||
FALSE, &iter);
|
||||
}
|
||||
|
||||
@@ -611,7 +611,7 @@ gtk_app_chooser_button_class_init (GtkAppChooserButtonClass *klass)
|
||||
*/
|
||||
pspec =
|
||||
g_param_spec_boolean ("show-dialog-item",
|
||||
P_("Include an 'Other…' item"),
|
||||
P_("Include an 'Other...' item"),
|
||||
P_("Whether the combobox should include an item that triggers a GtkAppChooserDialog"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
@@ -413,7 +413,7 @@ gtk_cell_renderer_accel_get_preferred_width (GtkCellRenderer *cell,
|
||||
GtkRequisition min_req, nat_req;
|
||||
|
||||
if (priv->sizing_label == NULL)
|
||||
priv->sizing_label = gtk_label_new (_("New accelerator…"));
|
||||
priv->sizing_label = gtk_label_new (_("New accelerator..."));
|
||||
|
||||
gtk_widget_get_preferred_size (priv->sizing_label, &min_req, &nat_req);
|
||||
|
||||
@@ -744,7 +744,7 @@ gtk_cell_renderer_accel_start_editing (GtkCellRenderer *cell,
|
||||
* an accelerator when the cell is clicked to change the
|
||||
* acelerator.
|
||||
*/
|
||||
gtk_label_set_text (GTK_LABEL (label), _("New accelerator…"));
|
||||
gtk_label_set_text (GTK_LABEL (label), _("New accelerator..."));
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (eventbox), label);
|
||||
|
||||
|
||||
+22
-41
@@ -45,7 +45,6 @@ struct _GtkClipboard
|
||||
GObject parent_instance;
|
||||
|
||||
NSPasteboard *pasteboard;
|
||||
NSInteger change_count;
|
||||
|
||||
GdkAtom selection;
|
||||
|
||||
@@ -77,18 +76,13 @@ struct _GtkClipboardClass
|
||||
GdkEventOwnerChange *event);
|
||||
};
|
||||
|
||||
static void gtk_clipboard_class_init (GtkClipboardClass *class);
|
||||
static void gtk_clipboard_finalize (GObject *object);
|
||||
static void gtk_clipboard_owner_change (GtkClipboard *clipboard,
|
||||
GdkEventOwnerChange *event);
|
||||
|
||||
static void clipboard_unset (GtkClipboard *clipboard);
|
||||
static GtkClipboard *clipboard_peek (GdkDisplay *display,
|
||||
GdkAtom selection,
|
||||
gboolean only_if_exists);
|
||||
|
||||
@interface GtkClipboardOwner : NSObject {
|
||||
GtkClipboard *clipboard;
|
||||
|
||||
GtkClipboardGetFunc get_func;
|
||||
GtkClipboardClearFunc clear_func;
|
||||
gpointer user_data;
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -123,15 +117,10 @@ static GtkClipboard *clipboard_peek (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
/* pasteboardChangedOwner is not called immediately, and it's not called
|
||||
* reliably. It is somehow documented in the apple api docs, but the docs
|
||||
* suck and don't really give clear instructions. Therefore we track
|
||||
* changeCount in several places below and clear the clipboard if it
|
||||
* changed.
|
||||
*/
|
||||
- (void)pasteboardChangedOwner:(NSPasteboard *)sender
|
||||
{
|
||||
clipboard_unset (clipboard);
|
||||
if (clear_func)
|
||||
clear_func (clipboard, user_data);
|
||||
|
||||
[self release];
|
||||
}
|
||||
@@ -150,6 +139,15 @@ static GtkClipboard *clipboard_peek (GdkDisplay *display,
|
||||
|
||||
@end
|
||||
|
||||
static void gtk_clipboard_class_init (GtkClipboardClass *class);
|
||||
static void gtk_clipboard_finalize (GObject *object);
|
||||
static void gtk_clipboard_owner_change (GtkClipboard *clipboard,
|
||||
GdkEventOwnerChange *event);
|
||||
|
||||
static void clipboard_unset (GtkClipboard *clipboard);
|
||||
static GtkClipboard *clipboard_peek (GdkDisplay *display,
|
||||
GdkAtom selection,
|
||||
gboolean only_if_exists);
|
||||
|
||||
static const gchar clipboards_owned_key[] = "gtk-clipboards-owned";
|
||||
static GQuark clipboards_owned_key_id = 0;
|
||||
@@ -362,15 +360,6 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
|
||||
}
|
||||
}
|
||||
|
||||
/* call declareTypes before setting the clipboard members because
|
||||
* declareTypes might clear the clipboard
|
||||
*/
|
||||
types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
|
||||
clipboard->change_count = [clipboard->pasteboard declareTypes: [types allObjects]
|
||||
owner: owner];
|
||||
[types release];
|
||||
[pool release];
|
||||
|
||||
clipboard->user_data = user_data;
|
||||
clipboard->have_owner = have_owner;
|
||||
if (have_owner)
|
||||
@@ -382,6 +371,12 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
|
||||
gtk_target_list_unref (clipboard->target_list);
|
||||
clipboard->target_list = gtk_target_list_new (targets, n_targets);
|
||||
|
||||
types = _gtk_quartz_target_entries_to_pasteboard_types (targets, n_targets);
|
||||
|
||||
[clipboard->pasteboard declareTypes:[types allObjects] owner:owner];
|
||||
[types release];
|
||||
[pool release];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -425,12 +420,6 @@ gtk_clipboard_get_owner (GtkClipboard *clipboard)
|
||||
{
|
||||
g_return_val_if_fail (clipboard != NULL, NULL);
|
||||
|
||||
if (clipboard->change_count < [clipboard->pasteboard changeCount])
|
||||
{
|
||||
clipboard_unset (clipboard);
|
||||
clipboard->change_count = [clipboard->pasteboard changeCount];
|
||||
}
|
||||
|
||||
if (clipboard->have_owner)
|
||||
return clipboard->user_data;
|
||||
else
|
||||
@@ -484,8 +473,6 @@ clipboard_unset (GtkClipboard *clipboard)
|
||||
void
|
||||
gtk_clipboard_clear (GtkClipboard *clipboard)
|
||||
{
|
||||
clipboard_unset (clipboard);
|
||||
|
||||
[clipboard->pasteboard declareTypes:nil owner:nil];
|
||||
}
|
||||
|
||||
@@ -669,12 +656,6 @@ gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
GtkSelectionData *selection_data = NULL;
|
||||
|
||||
if (clipboard->change_count < [clipboard->pasteboard changeCount])
|
||||
{
|
||||
clipboard_unset (clipboard);
|
||||
clipboard->change_count = [clipboard->pasteboard changeCount];
|
||||
}
|
||||
|
||||
if (target == gdk_atom_intern_static_string ("TARGETS"))
|
||||
{
|
||||
NSArray *types = [clipboard->pasteboard types];
|
||||
|
||||
+26
-33
@@ -584,42 +584,36 @@ dialog_response (GtkDialog *dialog,
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the dialog and connects its buttons */
|
||||
static void
|
||||
ensure_dialog (GtkColorButton *button)
|
||||
{
|
||||
GtkWidget *parent, *dialog;
|
||||
|
||||
if (button->priv->cs_dialog != NULL)
|
||||
return;
|
||||
|
||||
parent = gtk_widget_get_toplevel (GTK_WIDGET (button));
|
||||
|
||||
button->priv->cs_dialog = dialog = gtk_color_chooser_dialog_new (button->priv->title, NULL);
|
||||
|
||||
if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
|
||||
{
|
||||
if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (dialog)))
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
gtk_window_get_modal (GTK_WINDOW (parent)));
|
||||
}
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (dialog_response), button);
|
||||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (dialog_destroy), button);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gtk_color_button_clicked (GtkButton *b)
|
||||
{
|
||||
GtkColorButton *button = GTK_COLOR_BUTTON (b);
|
||||
GtkWidget *dialog;
|
||||
|
||||
/* if dialog already exists, make sure it's shown and raised */
|
||||
ensure_dialog (button);
|
||||
if (!button->priv->cs_dialog)
|
||||
{
|
||||
/* Create the dialog and connects its buttons */
|
||||
GtkWidget *parent;
|
||||
|
||||
parent = gtk_widget_get_toplevel (GTK_WIDGET (button));
|
||||
|
||||
button->priv->cs_dialog = dialog = gtk_color_chooser_dialog_new (button->priv->title, NULL);
|
||||
|
||||
if (gtk_widget_is_toplevel (parent) && GTK_IS_WINDOW (parent))
|
||||
{
|
||||
if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (dialog)))
|
||||
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
|
||||
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog),
|
||||
gtk_window_get_modal (GTK_WINDOW (parent)));
|
||||
}
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (dialog_response), button);
|
||||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (dialog_destroy), button);
|
||||
}
|
||||
|
||||
gtk_color_chooser_set_use_alpha (GTK_COLOR_CHOOSER (button->priv->cs_dialog),
|
||||
button->priv->use_alpha);
|
||||
@@ -968,9 +962,8 @@ gtk_color_button_add_palette (GtkColorChooser *chooser,
|
||||
{
|
||||
GtkColorButton *button = GTK_COLOR_BUTTON (chooser);
|
||||
|
||||
ensure_dialog (button);
|
||||
|
||||
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (button->priv->cs_dialog),
|
||||
if (button->priv->cs_dialog)
|
||||
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (button->priv->cs_dialog),
|
||||
orientation, colors_per_line, n_colors, colors);
|
||||
}
|
||||
|
||||
|
||||
+13
-33
@@ -51,51 +51,32 @@ gtk_css_value_array_compute (GtkCssValue *value,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssValue *result;
|
||||
GtkCssValue *i_value;
|
||||
guint i, j;
|
||||
gboolean changed = FALSE;
|
||||
guint i;
|
||||
GtkCssDependencies child_deps;
|
||||
|
||||
result = NULL;
|
||||
if (value->n_values == 0)
|
||||
return _gtk_css_value_ref (value);
|
||||
|
||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||
for (i = 0; i < value->n_values; i++)
|
||||
{
|
||||
i_value = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
|
||||
result->values[i] = _gtk_css_value_compute (value->values[i], property_id, provider, values, parent_values, &child_deps);
|
||||
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, child_deps);
|
||||
|
||||
if (result == NULL &&
|
||||
i_value != value->values[i])
|
||||
{
|
||||
result = _gtk_css_array_value_new_from_array (value->values, value->n_values);
|
||||
for (j = 0; j < i; j++)
|
||||
_gtk_css_value_ref (result->values[j]);
|
||||
}
|
||||
|
||||
if (result != NULL)
|
||||
result->values[i] = i_value;
|
||||
else
|
||||
_gtk_css_value_unref (i_value);
|
||||
changed |= (result->values[i] != value->values[i]);
|
||||
}
|
||||
|
||||
if (result == NULL)
|
||||
return _gtk_css_value_ref (value);
|
||||
if (!changed)
|
||||
{
|
||||
_gtk_css_value_unref (result);
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_array_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < value->n_values; i++)
|
||||
{
|
||||
if (_gtk_css_value_needs_compute (value->values[i]))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_array_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -337,7 +318,6 @@ gtk_css_value_array_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
|
||||
gtk_css_value_array_free,
|
||||
gtk_css_value_array_compute,
|
||||
gtk_css_value_array_needs_compute,
|
||||
gtk_css_value_array_equal,
|
||||
gtk_css_value_array_transition,
|
||||
gtk_css_value_array_print
|
||||
|
||||
+1
-10
@@ -69,20 +69,12 @@ gtk_css_value_bg_size_compute (GtkCssValue *value,
|
||||
value->y ? y : NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_bg_size_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return
|
||||
_gtk_css_value_needs_compute (value->x) ||
|
||||
_gtk_css_value_needs_compute (value->y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_bg_size_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
{
|
||||
return value1->cover == value2->cover &&
|
||||
value1->contain == value2->contain &&
|
||||
value2->contain == value2->contain &&
|
||||
(value1->x == value2->x ||
|
||||
(value1->x != NULL && value2->x != NULL &&
|
||||
_gtk_css_value_equal (value1->x, value2->x))) &&
|
||||
@@ -158,7 +150,6 @@ gtk_css_value_bg_size_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_BG_SIZE = {
|
||||
gtk_css_value_bg_size_free,
|
||||
gtk_css_value_bg_size_compute,
|
||||
gtk_css_value_bg_size_needs_compute,
|
||||
gtk_css_value_bg_size_equal,
|
||||
gtk_css_value_bg_size_transition,
|
||||
gtk_css_value_bg_size_print
|
||||
|
||||
@@ -76,20 +76,6 @@ gtk_css_value_border_compute (GtkCssValue *value,
|
||||
return computed;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_border_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (_gtk_css_value_needs_compute (value->values[i]))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_border_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -150,7 +136,6 @@ gtk_css_value_border_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_BORDER = {
|
||||
gtk_css_value_border_free,
|
||||
gtk_css_value_border_compute,
|
||||
gtk_css_value_border_needs_compute,
|
||||
gtk_css_value_border_equal,
|
||||
gtk_css_value_border_transition,
|
||||
gtk_css_value_border_print
|
||||
|
||||
+27
-27
@@ -24,6 +24,7 @@
|
||||
#include "gtkhslaprivate.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
#include "gtkstyleproperties.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
#include "gtkwin32themeprivate.h"
|
||||
|
||||
typedef enum {
|
||||
@@ -135,12 +136,12 @@ gtk_css_value_color_get_fallback (guint property_id,
|
||||
}
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkCssDependencies *dependencies)
|
||||
static GtkCssValue *
|
||||
gtk_css_color_value_resolve_full (GtkCssValue *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkCssDependencies unused;
|
||||
GtkCssValue *value;
|
||||
@@ -160,13 +161,14 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
return _gtk_css_value_ref (color->last_value);
|
||||
case COLOR_TYPE_NAME:
|
||||
{
|
||||
GtkCssValue *named;
|
||||
GtkSymbolicColor *symbolic;
|
||||
|
||||
named = _gtk_style_provider_private_get_color (provider, color->sym_col.name);
|
||||
if (named == NULL)
|
||||
symbolic = _gtk_style_provider_private_get_color (provider, color->sym_col.name);
|
||||
|
||||
if (!symbolic)
|
||||
return NULL;
|
||||
|
||||
value = _gtk_css_color_value_resolve (named, provider, current, current_deps, dependencies);
|
||||
value = _gtk_symbolic_color_resolve_full (symbolic, provider, current, current_deps, dependencies);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -176,14 +178,19 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkHSLA hsla;
|
||||
GdkRGBA shade;
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.shade.color, provider, current, current_deps, dependencies);
|
||||
val = gtk_css_color_value_resolve_full (color->sym_col.shade.color, provider, current, current_deps, dependencies);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
*dependencies = _gtk_css_dependencies_union (*dependencies, 0);
|
||||
|
||||
_gtk_hsla_init_from_rgba (&hsla, _gtk_css_rgba_value_get_rgba (val));
|
||||
_gtk_hsla_shade (&hsla, &hsla, color->sym_col.shade.factor);
|
||||
|
||||
hsla.lightness *= color->sym_col.shade.factor;
|
||||
hsla.lightness = CLAMP (hsla.lightness, 0.0, 1.0);
|
||||
|
||||
hsla.saturation *= color->sym_col.shade.factor;
|
||||
hsla.saturation = CLAMP (hsla.saturation, 0.0, 1.0);
|
||||
|
||||
_gdk_rgba_init_from_hsla (&shade, &hsla);
|
||||
|
||||
@@ -198,7 +205,7 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkCssValue *val;
|
||||
GdkRGBA alpha;
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.alpha.color, provider, current, current_deps, dependencies);
|
||||
val = gtk_css_color_value_resolve_full (color->sym_col.alpha.color, provider, current, current_deps, dependencies);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -218,13 +225,13 @@ _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GdkRGBA color1, color2, res;
|
||||
GtkCssDependencies dep1, dep2;
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.mix.color1, provider, current, current_deps, &dep1);
|
||||
val = gtk_css_color_value_resolve_full (color->sym_col.mix.color1, provider, current, current_deps, &dep1);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
color1 = *_gtk_css_rgba_value_get_rgba (val);
|
||||
_gtk_css_value_unref (val);
|
||||
|
||||
val = _gtk_css_color_value_resolve (color->sym_col.mix.color2, provider, current, current_deps, &dep2);
|
||||
val = gtk_css_color_value_resolve_full (color->sym_col.mix.color2, provider, current, current_deps, &dep2);
|
||||
if (val == NULL)
|
||||
return NULL;
|
||||
color2 = *_gtk_css_rgba_value_get_rgba (val);
|
||||
@@ -322,11 +329,11 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
current_deps = GTK_CSS_DEPENDS_ON_COLOR;
|
||||
}
|
||||
|
||||
resolved = _gtk_css_color_value_resolve (value,
|
||||
provider,
|
||||
current,
|
||||
current_deps,
|
||||
dependencies);
|
||||
resolved = gtk_css_color_value_resolve_full (value,
|
||||
provider,
|
||||
current,
|
||||
current_deps,
|
||||
dependencies);
|
||||
|
||||
if (resolved == NULL)
|
||||
return gtk_css_value_color_get_fallback (property_id, provider, values, parent_values);
|
||||
@@ -334,12 +341,6 @@ gtk_css_value_color_compute (GtkCssValue *value,
|
||||
return resolved;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_color_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_color_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -455,7 +456,6 @@ gtk_css_value_color_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_COLOR = {
|
||||
gtk_css_value_color_free,
|
||||
gtk_css_value_color_compute,
|
||||
gtk_css_value_color_needs_compute,
|
||||
gtk_css_value_color_equal,
|
||||
gtk_css_value_color_transition,
|
||||
gtk_css_value_color_print
|
||||
|
||||
@@ -43,12 +43,6 @@ GtkCssValue * _gtk_css_color_value_new_current_color (void);
|
||||
|
||||
GtkCssValue * _gtk_css_color_value_parse (GtkCssParser *parser);
|
||||
|
||||
GtkCssValue * _gtk_css_color_value_resolve (GtkCssValue *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkCssDependencies *dependencies);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+16
-18
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkcsscomputedvaluesprivate.h"
|
||||
|
||||
#include "gtkcssanimationprivate.h"
|
||||
@@ -121,9 +120,9 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
|
||||
GtkCssDependencies dependencies;
|
||||
GtkCssValue *value;
|
||||
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
gtk_internal_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
|
||||
gtk_internal_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
|
||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
g_return_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider));
|
||||
g_return_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values));
|
||||
|
||||
/* http://www.w3.org/TR/css3-cascade/#cascade
|
||||
* Then, for every element, the value for each property can be found
|
||||
@@ -137,7 +136,7 @@ _gtk_css_computed_values_compute_value (GtkCssComputedValues *values,
|
||||
if (_gtk_css_style_property_is_inherit (prop))
|
||||
specified = _gtk_css_inherit_value_new ();
|
||||
else
|
||||
specified = _gtk_css_initial_value_new (prop);
|
||||
specified = _gtk_css_initial_value_new ();
|
||||
}
|
||||
else
|
||||
_gtk_css_value_ref (specified);
|
||||
@@ -155,8 +154,8 @@ _gtk_css_computed_values_set_animated_value (GtkCssComputedValues *values,
|
||||
guint id,
|
||||
GtkCssValue *value)
|
||||
{
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
gtk_internal_return_if_fail (value != NULL);
|
||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
g_return_if_fail (value != NULL);
|
||||
|
||||
if (values->animated_values == NULL)
|
||||
values->animated_values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref);
|
||||
@@ -176,11 +175,10 @@ _gtk_css_computed_values_set_value (GtkCssComputedValues *values,
|
||||
GtkCssDependencies dependencies,
|
||||
GtkCssSection *section)
|
||||
{
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
|
||||
if (values->values == NULL)
|
||||
values->values = g_ptr_array_new_full (_gtk_css_style_property_get_n_properties (),
|
||||
(GDestroyNotify)_gtk_css_value_unref);
|
||||
values->values = g_ptr_array_new_with_free_func ((GDestroyNotify)_gtk_css_value_unref);
|
||||
if (id >= values->values->len)
|
||||
g_ptr_array_set_size (values->values, id + 1);
|
||||
|
||||
@@ -218,7 +216,7 @@ GtkCssValue *
|
||||
_gtk_css_computed_values_get_value (GtkCssComputedValues *values,
|
||||
guint id)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
|
||||
if (values->animated_values &&
|
||||
id < values->animated_values->len &&
|
||||
@@ -232,7 +230,7 @@ GtkCssValue *
|
||||
_gtk_css_computed_values_get_intrinsic_value (GtkCssComputedValues *values,
|
||||
guint id)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
|
||||
if (values->values == NULL ||
|
||||
id >= values->values->len)
|
||||
@@ -245,7 +243,7 @@ GtkCssSection *
|
||||
_gtk_css_computed_values_get_section (GtkCssComputedValues *values,
|
||||
guint id)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
|
||||
if (values->sections == NULL ||
|
||||
id >= values->sections->len)
|
||||
@@ -530,8 +528,8 @@ _gtk_css_computed_values_advance (GtkCssComputedValues *values,
|
||||
GSList *list;
|
||||
guint i;
|
||||
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
gtk_internal_return_val_if_fail (timestamp >= values->current_time, NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
g_return_val_if_fail (timestamp >= values->current_time, NULL);
|
||||
|
||||
values->current_time = timestamp;
|
||||
old_computed_values = values->animated_values;
|
||||
@@ -580,7 +578,7 @@ _gtk_css_computed_values_is_static (GtkCssComputedValues *values)
|
||||
{
|
||||
GSList *list;
|
||||
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), TRUE);
|
||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), TRUE);
|
||||
|
||||
for (list = values->animations; list; list = list->next)
|
||||
{
|
||||
@@ -594,7 +592,7 @@ _gtk_css_computed_values_is_static (GtkCssComputedValues *values)
|
||||
void
|
||||
_gtk_css_computed_values_cancel_animations (GtkCssComputedValues *values)
|
||||
{
|
||||
gtk_internal_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
g_return_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values));
|
||||
|
||||
if (values->animated_values)
|
||||
{
|
||||
@@ -612,7 +610,7 @@ _gtk_css_computed_values_compute_dependencies (GtkCssComputedValues *values,
|
||||
{
|
||||
GtkBitmask *changes;
|
||||
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), _gtk_bitmask_new ());
|
||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), _gtk_bitmask_new ());
|
||||
|
||||
changes = _gtk_bitmask_copy (parent_changes);
|
||||
changes = _gtk_bitmask_intersect (changes, values->depends_on_parent);
|
||||
|
||||
@@ -60,14 +60,6 @@ gtk_css_value_corner_compute (GtkCssValue *corner,
|
||||
return _gtk_css_corner_value_new (x, y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_corner_needs_compute (const GtkCssValue *corner)
|
||||
{
|
||||
return
|
||||
_gtk_css_value_needs_compute (corner->x) ||
|
||||
_gtk_css_value_needs_compute (corner->y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_corner_equal (const GtkCssValue *corner1,
|
||||
const GtkCssValue *corner2)
|
||||
@@ -112,7 +104,6 @@ gtk_css_value_corner_print (const GtkCssValue *corner,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
|
||||
gtk_css_value_corner_free,
|
||||
gtk_css_value_corner_compute,
|
||||
gtk_css_value_corner_needs_compute,
|
||||
gtk_css_value_corner_equal,
|
||||
gtk_css_value_corner_transition,
|
||||
gtk_css_value_corner_print
|
||||
|
||||
@@ -28,22 +28,16 @@
|
||||
#include "gtkstylepropertiesprivate.h"
|
||||
#include "gtkthemingengine.h"
|
||||
|
||||
#include "deprecated/gtksymboliccolor.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYLE_PROPERTY)
|
||||
|
||||
static GType
|
||||
gtk_css_custom_property_get_specified_type (GParamSpec *pspec)
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if (pspec->value_type == GDK_TYPE_RGBA ||
|
||||
pspec->value_type == GDK_TYPE_COLOR)
|
||||
return GTK_TYPE_SYMBOLIC_COLOR;
|
||||
else
|
||||
return pspec->value_type;
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -211,8 +205,6 @@ gtk_css_custom_property_create_initial_value (GParamSpec *pspec)
|
||||
* </note>
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: Code should use the default properties provided by CSS.
|
||||
**/
|
||||
void
|
||||
gtk_theming_engine_register_property (const gchar *name_space,
|
||||
@@ -262,8 +254,6 @@ gtk_theming_engine_register_property (const gchar *name_space,
|
||||
* a theming engine, you want to use that function instead.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: Code should use the default properties provided by CSS.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
||||
@@ -307,9 +297,6 @@ gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
||||
* Returns: %TRUE if the property is registered, %FALSE otherwise
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: This code could only look up custom properties and
|
||||
* those are deprecated.
|
||||
**/
|
||||
gboolean
|
||||
gtk_style_properties_lookup_property (const gchar *property_name,
|
||||
|
||||
@@ -60,12 +60,6 @@ gtk_css_value_ease_compute (GtkCssValue *value,
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_ease_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_ease_equal (const GtkCssValue *ease1,
|
||||
const GtkCssValue *ease2)
|
||||
@@ -144,7 +138,6 @@ gtk_css_value_ease_print (const GtkCssValue *ease,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_EASE = {
|
||||
gtk_css_value_ease_free,
|
||||
gtk_css_value_ease_compute,
|
||||
gtk_css_value_ease_needs_compute,
|
||||
gtk_css_value_ease_equal,
|
||||
gtk_css_value_ease_transition,
|
||||
gtk_css_value_ease_print
|
||||
|
||||
@@ -45,12 +45,6 @@ gtk_css_value_engine_compute (GtkCssValue *value,
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_engine_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_engine_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -86,7 +80,6 @@ gtk_css_value_engine_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_ENGINE = {
|
||||
gtk_css_value_engine_free,
|
||||
gtk_css_value_engine_compute,
|
||||
gtk_css_value_engine_needs_compute,
|
||||
gtk_css_value_engine_equal,
|
||||
gtk_css_value_engine_transition,
|
||||
gtk_css_value_engine_print
|
||||
|
||||
+1
-170
@@ -19,9 +19,7 @@
|
||||
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
|
||||
#include "gtkcsscomputedvaluesprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
|
||||
/* repeated API */
|
||||
|
||||
@@ -48,12 +46,6 @@ gtk_css_value_enum_compute (GtkCssValue *value,
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_enum_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_enum_equal (const GtkCssValue *enum1,
|
||||
const GtkCssValue *enum2)
|
||||
@@ -82,7 +74,6 @@ gtk_css_value_enum_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_STYLE = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
@@ -133,165 +124,11 @@ _gtk_css_border_style_value_get (const GtkCssValue *value)
|
||||
return value->value;
|
||||
}
|
||||
|
||||
/* GtkCssFontSize */
|
||||
|
||||
/* XXX: Kinda bad to have that machinery here, nobody expects vital font
|
||||
* size code to appear in gtkcssvalueenum.c.
|
||||
*/
|
||||
#define DEFAULT_FONT_SIZE 10
|
||||
|
||||
double
|
||||
_gtk_css_font_size_get_default (GtkStyleProviderPrivate *provider)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
PangoFontDescription *description;
|
||||
char *font_name;
|
||||
double font_size;
|
||||
|
||||
settings = _gtk_style_provider_private_get_settings (provider);
|
||||
if (settings == NULL)
|
||||
return DEFAULT_FONT_SIZE;
|
||||
|
||||
g_object_get (settings, "gtk-font-name", &font_name, NULL);
|
||||
description = pango_font_description_from_string (font_name);
|
||||
g_free (font_name);
|
||||
if (description == NULL)
|
||||
return DEFAULT_FONT_SIZE;
|
||||
|
||||
if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_SIZE)
|
||||
font_size = (double) pango_font_description_get_size (description) / PANGO_SCALE;
|
||||
else
|
||||
font_size = DEFAULT_FONT_SIZE;
|
||||
|
||||
pango_font_description_free (description);
|
||||
return font_size;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_font_size_compute (GtkCssValue *value,
|
||||
guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssComputedValues *values,
|
||||
GtkCssComputedValues *parent_values,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
double font_size;
|
||||
|
||||
switch (value->value)
|
||||
{
|
||||
case GTK_CSS_FONT_SIZE_XX_SMALL:
|
||||
font_size = _gtk_css_font_size_get_default (provider) * 3. / 5;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_X_SMALL:
|
||||
font_size = _gtk_css_font_size_get_default (provider) * 3. / 4;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_SMALL:
|
||||
font_size = _gtk_css_font_size_get_default (provider) * 8. / 9;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
/* fall thru */
|
||||
case GTK_CSS_FONT_SIZE_MEDIUM:
|
||||
font_size = _gtk_css_font_size_get_default (provider);
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_LARGE:
|
||||
font_size = _gtk_css_font_size_get_default (provider) * 6. / 5;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_X_LARGE:
|
||||
font_size = _gtk_css_font_size_get_default (provider) * 3. / 2;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_XX_LARGE:
|
||||
font_size = _gtk_css_font_size_get_default (provider) * 2;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_SMALLER:
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
|
||||
if (parent_values)
|
||||
font_size = _gtk_css_number_value_get (_gtk_css_computed_values_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
else
|
||||
font_size = _gtk_css_font_size_get_default (provider);
|
||||
/* XXX: This is what WebKit does... */
|
||||
font_size /= 1.2;
|
||||
break;
|
||||
case GTK_CSS_FONT_SIZE_LARGER:
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
|
||||
if (parent_values)
|
||||
font_size = _gtk_css_number_value_get (_gtk_css_computed_values_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
else
|
||||
font_size = _gtk_css_font_size_get_default (provider);
|
||||
/* XXX: This is what WebKit does... */
|
||||
font_size *= 1.2;
|
||||
break;
|
||||
}
|
||||
|
||||
return _gtk_css_number_value_new (font_size, GTK_CSS_PX);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_font_size_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_font_size_compute,
|
||||
gtk_css_value_font_size_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
};
|
||||
|
||||
static GtkCssValue font_size_values[] = {
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_SMALLER, "smaller" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_LARGER, "larger" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_XX_SMALL, "xx-small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_X_SMALL, "x-small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_SMALL, "small" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_MEDIUM, "medium" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_LARGE, "large" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_X_LARGE, "x-large" },
|
||||
{ >K_CSS_VALUE_FONT_SIZE, 1, GTK_CSS_FONT_SIZE_XX_LARGE, "xx-large" }
|
||||
};
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_font_size_value_new (GtkCssFontSize font_size)
|
||||
{
|
||||
g_return_val_if_fail (font_size < G_N_ELEMENTS (font_size_values), NULL);
|
||||
|
||||
return _gtk_css_value_ref (&font_size_values[font_size]);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_font_size_value_try_parse (GtkCssParser *parser)
|
||||
{
|
||||
guint i;
|
||||
|
||||
g_return_val_if_fail (parser != NULL, NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (font_size_values); i++)
|
||||
{
|
||||
if (_gtk_css_parser_try (parser, font_size_values[i].name, TRUE))
|
||||
return _gtk_css_value_ref (&font_size_values[i]);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GtkCssFontSize
|
||||
_gtk_css_font_size_value_get (const GtkCssValue *value)
|
||||
{
|
||||
g_return_val_if_fail (value->class == >K_CSS_VALUE_FONT_SIZE, GTK_CSS_FONT_SIZE_MEDIUM);
|
||||
|
||||
return value->value;
|
||||
}
|
||||
|
||||
/* PangoStyle */
|
||||
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_STYLE = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
@@ -340,7 +177,6 @@ _gtk_css_font_style_value_get (const GtkCssValue *value)
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_VARIANT = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
@@ -388,7 +224,6 @@ _gtk_css_font_variant_value_get (const GtkCssValue *value)
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
@@ -457,7 +292,6 @@ _gtk_css_font_weight_value_get (const GtkCssValue *value)
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_AREA = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
@@ -512,7 +346,6 @@ _gtk_css_area_value_get (const GtkCssValue *value)
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
@@ -568,7 +401,6 @@ _gtk_css_direction_value_get (const GtkCssValue *value)
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
@@ -622,7 +454,6 @@ _gtk_css_play_state_value_get (const GtkCssValue *value)
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
|
||||
gtk_css_value_enum_free,
|
||||
gtk_css_value_enum_compute,
|
||||
gtk_css_value_enum_needs_compute,
|
||||
gtk_css_value_enum_equal,
|
||||
gtk_css_value_enum_transition,
|
||||
gtk_css_value_enum_print
|
||||
|
||||
@@ -31,11 +31,6 @@ GtkCssValue * _gtk_css_border_style_value_new (GtkBorderStyle border
|
||||
GtkCssValue * _gtk_css_border_style_value_try_parse (GtkCssParser *parser);
|
||||
GtkBorderStyle _gtk_css_border_style_value_get (const GtkCssValue *value);
|
||||
|
||||
GtkCssValue * _gtk_css_font_size_value_new (GtkCssFontSize size);
|
||||
GtkCssValue * _gtk_css_font_size_value_try_parse (GtkCssParser *parser);
|
||||
GtkCssFontSize _gtk_css_font_size_value_get (const GtkCssValue *value);
|
||||
double _gtk_css_font_size_get_default (GtkStyleProviderPrivate *provider);
|
||||
|
||||
GtkCssValue * _gtk_css_font_style_value_new (PangoStyle style);
|
||||
GtkCssValue * _gtk_css_font_style_value_try_parse (GtkCssParser *parser);
|
||||
PangoStyle _gtk_css_font_style_value_get (const GtkCssValue *value);
|
||||
|
||||
@@ -19,14 +19,11 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gtkcssimagegradientprivate.h"
|
||||
|
||||
#include "gtkcssprovider.h"
|
||||
|
||||
#include "deprecated/gtkgradientprivate.h"
|
||||
#include "deprecated/gtksymboliccolorprivate.h"
|
||||
#include "gtkgradientprivate.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
|
||||
G_DEFINE_TYPE (GtkCssImageGradient, _gtk_css_image_gradient, GTK_TYPE_CSS_IMAGE)
|
||||
|
||||
@@ -477,7 +474,7 @@ _gtk_gradient_parse (GtkCssParser *parser)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
color = _gtk_css_symbolic_value_new (parser);
|
||||
color = _gtk_symbolic_color_new_take_value (_gtk_css_symbolic_value_new (parser));
|
||||
if (color == NULL)
|
||||
{
|
||||
gtk_gradient_unref (gradient);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "gtk/gtkcssimageprivate.h"
|
||||
|
||||
#include <gtk/deprecated/gtkgradient.h>
|
||||
#include <gtk/gtkgradient.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -59,12 +59,6 @@ gtk_css_value_image_compute (GtkCssValue *value,
|
||||
return _gtk_css_image_value_new (computed);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_image_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return _gtk_css_image_value_get_image (value) != NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_image_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -101,7 +95,6 @@ gtk_css_value_image_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_IMAGE = {
|
||||
gtk_css_value_image_free,
|
||||
gtk_css_value_image_compute,
|
||||
gtk_css_value_image_needs_compute,
|
||||
gtk_css_value_image_equal,
|
||||
gtk_css_value_image_transition,
|
||||
gtk_css_value_image_print
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "gtkcssinheritvalueprivate.h"
|
||||
|
||||
#include "gtkcssinitialvalueprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
|
||||
struct _GtkCssValue {
|
||||
@@ -48,7 +48,7 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
}
|
||||
else
|
||||
{
|
||||
return _gtk_css_value_compute (_gtk_css_initial_value_get (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||
property_id,
|
||||
provider,
|
||||
values,
|
||||
@@ -57,12 +57,6 @@ gtk_css_value_inherit_compute (GtkCssValue *value,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_inherit_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_inherit_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -89,7 +83,6 @@ gtk_css_value_inherit_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_INHERIT = {
|
||||
gtk_css_value_inherit_free,
|
||||
gtk_css_value_inherit_compute,
|
||||
gtk_css_value_inherit_needs_compute,
|
||||
gtk_css_value_inherit_equal,
|
||||
gtk_css_value_inherit_transition,
|
||||
gtk_css_value_inherit_print
|
||||
|
||||
@@ -19,16 +19,10 @@
|
||||
|
||||
#include "gtkcssinitialvalueprivate.h"
|
||||
|
||||
#include "gtkcssarrayvalueprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcssstringvalueprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
|
||||
struct _GtkCssValue {
|
||||
GTK_CSS_VALUE_BASE
|
||||
GtkCssStyleProperty *property;
|
||||
gboolean needs_compute;
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -46,43 +40,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
GtkCssComputedValues *parent_values,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
GtkSettings *settings;
|
||||
|
||||
if (!value->needs_compute)
|
||||
return _gtk_css_value_ref (_gtk_css_style_property_get_initial_value (value->property));
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case GTK_CSS_PROPERTY_FONT_FAMILY:
|
||||
settings = _gtk_style_provider_private_get_settings (provider);
|
||||
if (settings)
|
||||
{
|
||||
PangoFontDescription *description;
|
||||
char *font_name;
|
||||
GtkCssValue *value;
|
||||
|
||||
g_object_get (settings, "gtk-font-name", &font_name, NULL);
|
||||
description = pango_font_description_from_string (font_name);
|
||||
g_free (font_name);
|
||||
if (description == NULL)
|
||||
break;
|
||||
|
||||
if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_FAMILY)
|
||||
{
|
||||
value = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (description)));
|
||||
pango_font_description_free (description);
|
||||
return value;
|
||||
}
|
||||
|
||||
pango_font_description_free (description);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (value->property),
|
||||
return _gtk_css_value_compute (_gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (property_id)),
|
||||
property_id,
|
||||
provider,
|
||||
values,
|
||||
@@ -90,12 +48,6 @@ gtk_css_value_initial_compute (GtkCssValue *value,
|
||||
dependencies);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_initial_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_initial_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -122,7 +74,6 @@ gtk_css_value_initial_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
|
||||
gtk_css_value_initial_free,
|
||||
gtk_css_value_initial_compute,
|
||||
gtk_css_value_initial_needs_compute,
|
||||
gtk_css_value_initial_equal,
|
||||
gtk_css_value_initial_transition,
|
||||
gtk_css_value_initial_print
|
||||
@@ -131,21 +82,7 @@ static const GtkCssValueClass GTK_CSS_VALUE_INITIAL = {
|
||||
static GtkCssValue initial = { >K_CSS_VALUE_INITIAL, 1 };
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_initial_value_new (GtkCssStyleProperty *property)
|
||||
_gtk_css_initial_value_new (void)
|
||||
{
|
||||
return _gtk_css_value_ref (_gtk_css_initial_value_get (property));
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_initial_value_get (GtkCssStyleProperty *property)
|
||||
{
|
||||
if (property->css_initial_value == NULL)
|
||||
{
|
||||
property->css_initial_value = g_new0 (GtkCssValue, 1);
|
||||
*property->css_initial_value = initial;
|
||||
property->css_initial_value->property = property;
|
||||
property->css_initial_value->needs_compute =
|
||||
_gtk_css_value_needs_compute (_gtk_css_style_property_get_initial_value (property));
|
||||
}
|
||||
return property->css_initial_value;
|
||||
return _gtk_css_value_ref (&initial);
|
||||
}
|
||||
|
||||
@@ -21,11 +21,10 @@
|
||||
#define __GTK_CSS_INITIAL_VALUE_PRIVATE_H__
|
||||
|
||||
#include "gtkcssvalueprivate.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * _gtk_css_initial_value_new (GtkCssStyleProperty *property);
|
||||
GtkCssValue * _gtk_css_initial_value_get (GtkCssStyleProperty *property);
|
||||
GtkCssValue * _gtk_css_initial_value_new (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -185,7 +185,6 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
|
||||
gtk_css_matcher_widget_path_has_regions,
|
||||
gtk_css_matcher_widget_path_has_region,
|
||||
gtk_css_matcher_widget_path_has_position,
|
||||
FALSE
|
||||
};
|
||||
|
||||
gboolean
|
||||
@@ -289,7 +288,6 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = {
|
||||
gtk_css_matcher_any_has_regions,
|
||||
gtk_css_matcher_any_has_region,
|
||||
gtk_css_matcher_any_has_position,
|
||||
TRUE
|
||||
};
|
||||
|
||||
void
|
||||
@@ -408,7 +406,6 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
|
||||
gtk_css_matcher_superset_has_regions,
|
||||
gtk_css_matcher_superset_has_region,
|
||||
gtk_css_matcher_superset_has_position,
|
||||
FALSE
|
||||
};
|
||||
|
||||
void
|
||||
|
||||
@@ -50,7 +50,6 @@ struct _GtkCssMatcherClass {
|
||||
gboolean forward,
|
||||
int a,
|
||||
int b);
|
||||
gboolean is_any;
|
||||
};
|
||||
|
||||
struct _GtkCssMatcherWidgetPath {
|
||||
@@ -147,12 +146,6 @@ _gtk_css_matcher_has_position (const GtkCssMatcher *matcher,
|
||||
return matcher->klass->has_position (matcher, forward, a, b);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
_gtk_css_matcher_matches_any (const GtkCssMatcher *matcher)
|
||||
{
|
||||
return matcher->klass->is_any;
|
||||
}
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
+4
-61
@@ -20,7 +20,6 @@
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
#include "gtkcssinitialvalueprivate.h"
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
|
||||
struct _GtkCssValue {
|
||||
@@ -35,26 +34,6 @@ gtk_css_value_number_free (GtkCssValue *value)
|
||||
g_slice_free (GtkCssValue, value);
|
||||
}
|
||||
|
||||
static double
|
||||
get_base_font_size (guint property_id,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssComputedValues *values,
|
||||
GtkCssComputedValues *parent_values,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
|
||||
{
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_PARENT;
|
||||
if (parent_values)
|
||||
return _gtk_css_number_value_get (_gtk_css_computed_values_get_value (parent_values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
else
|
||||
return _gtk_css_font_size_get_default (provider);
|
||||
}
|
||||
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
|
||||
return _gtk_css_number_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE), 100);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
gtk_css_value_number_compute (GtkCssValue *number,
|
||||
guint property_id,
|
||||
@@ -69,11 +48,6 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
g_assert_not_reached();
|
||||
/* fall through */
|
||||
case GTK_CSS_PERCENT:
|
||||
/* percentages for font sizes are computed, other percentages aren't */
|
||||
if (property_id == GTK_CSS_PROPERTY_FONT_SIZE)
|
||||
return _gtk_css_number_value_new (number->value / 100.0 *
|
||||
get_base_font_size (property_id, provider, values, parent_values, dependencies),
|
||||
GTK_CSS_PX);
|
||||
case GTK_CSS_NUMBER:
|
||||
case GTK_CSS_PX:
|
||||
case GTK_CSS_DEG:
|
||||
@@ -99,14 +73,16 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
GTK_CSS_PX);
|
||||
break;
|
||||
case GTK_CSS_EM:
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
|
||||
return _gtk_css_number_value_new (number->value *
|
||||
get_base_font_size (property_id, provider, values, parent_values, dependencies),
|
||||
_gtk_css_number_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE), 100),
|
||||
GTK_CSS_PX);
|
||||
break;
|
||||
case GTK_CSS_EX:
|
||||
/* for now we pretend ex is half of em */
|
||||
*dependencies = GTK_CSS_DEPENDS_ON_FONT_SIZE;
|
||||
return _gtk_css_number_value_new (number->value * 0.5 *
|
||||
get_base_font_size (property_id, provider, values, parent_values, dependencies),
|
||||
_gtk_css_number_value_get (_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_FONT_SIZE), 100),
|
||||
GTK_CSS_PX);
|
||||
case GTK_CSS_RAD:
|
||||
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
|
||||
@@ -123,38 +99,6 @@ gtk_css_value_number_compute (GtkCssValue *number,
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_number_needs_compute (const GtkCssValue *number)
|
||||
{
|
||||
switch (number->unit)
|
||||
{
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
/* fall through */
|
||||
case GTK_CSS_PERCENT:
|
||||
/* percentages for font sizes are computed, other percentages aren't */
|
||||
return TRUE;
|
||||
case GTK_CSS_NUMBER:
|
||||
case GTK_CSS_PX:
|
||||
case GTK_CSS_DEG:
|
||||
case GTK_CSS_S:
|
||||
return FALSE;
|
||||
|
||||
case GTK_CSS_PT:
|
||||
case GTK_CSS_PC:
|
||||
case GTK_CSS_IN:
|
||||
case GTK_CSS_CM:
|
||||
case GTK_CSS_MM:
|
||||
case GTK_CSS_EM:
|
||||
case GTK_CSS_EX:
|
||||
case GTK_CSS_RAD:
|
||||
case GTK_CSS_GRAD:
|
||||
case GTK_CSS_TURN:
|
||||
case GTK_CSS_MS:
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_number_equal (const GtkCssValue *number1,
|
||||
const GtkCssValue *number2)
|
||||
@@ -212,7 +156,6 @@ gtk_css_value_number_print (const GtkCssValue *number,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {
|
||||
gtk_css_value_number_free,
|
||||
gtk_css_value_number_compute,
|
||||
gtk_css_value_number_needs_compute,
|
||||
gtk_css_value_number_equal,
|
||||
gtk_css_value_number_transition,
|
||||
gtk_css_value_number_print
|
||||
|
||||
+1
-1
@@ -257,7 +257,7 @@ gtk_css_parser_skip_comment (GtkCssParser *parser)
|
||||
|
||||
parser->data++;
|
||||
|
||||
if (len > 0 && parser->data[-2] == '*')
|
||||
if (parser->data[-2] == '*')
|
||||
return TRUE;
|
||||
if (parser->data[0] == '*')
|
||||
_gtk_css_parser_error (parser, "'/*' in comment block");
|
||||
|
||||
@@ -60,14 +60,6 @@ gtk_css_value_position_compute (GtkCssValue *position,
|
||||
return _gtk_css_position_value_new (x, y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_position_needs_compute (const GtkCssValue *position)
|
||||
{
|
||||
return
|
||||
_gtk_css_value_needs_compute (position->x) ||
|
||||
_gtk_css_value_needs_compute (position->y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_position_equal (const GtkCssValue *position1,
|
||||
const GtkCssValue *position2)
|
||||
@@ -163,7 +155,6 @@ done:
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_POSITION = {
|
||||
gtk_css_value_position_free,
|
||||
gtk_css_value_position_compute,
|
||||
gtk_css_value_position_needs_compute,
|
||||
gtk_css_value_position_equal,
|
||||
gtk_css_value_position_transition,
|
||||
gtk_css_value_position_print
|
||||
|
||||
+520
-92
@@ -27,13 +27,13 @@
|
||||
|
||||
#include "gtkbitmaskprivate.h"
|
||||
#include "gtkcssarrayvalueprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcsskeyframesprivate.h"
|
||||
#include "gtkcssparserprivate.h"
|
||||
#include "gtkcsssectionprivate.h"
|
||||
#include "gtkcssselectorprivate.h"
|
||||
#include "gtkcssshorthandpropertyprivate.h"
|
||||
#include "gtkcssstylefuncsprivate.h"
|
||||
#include "gtksymboliccolor.h"
|
||||
#include "gtkstyleprovider.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkstylepropertiesprivate.h"
|
||||
@@ -986,7 +986,6 @@ struct _WidgetPropertyValue {
|
||||
struct GtkCssRuleset
|
||||
{
|
||||
GtkCssSelector *selector;
|
||||
GtkCssSelectorTree *selector_match;
|
||||
WidgetPropertyValue *widget_style;
|
||||
PropertyValue *styles;
|
||||
GtkBitmask *set_styles;
|
||||
@@ -995,6 +994,37 @@ struct GtkCssRuleset
|
||||
guint owns_widget_style : 1;
|
||||
};
|
||||
|
||||
enum RulesetsTreeType {
|
||||
RULESETS_TREE_TYPE_STATE,
|
||||
RULESETS_TREE_TYPE_CLASS,
|
||||
RULESETS_TREE_TYPE_RULES
|
||||
};
|
||||
|
||||
typedef struct _GtkCssRulesetList GtkCssRulesetList;
|
||||
typedef struct _GtkCssRulesetsTree GtkCssRulesetsTree;
|
||||
|
||||
struct _GtkCssRulesetList {
|
||||
guint *rules;
|
||||
guint num_rules;
|
||||
};
|
||||
|
||||
struct _GtkCssRulesetsTree
|
||||
{
|
||||
enum RulesetsTreeType type;
|
||||
union {
|
||||
GtkCssRulesetList rules;
|
||||
struct {
|
||||
GtkCssRulesetsTree *matched;
|
||||
GtkStateFlags state;
|
||||
} state;
|
||||
struct {
|
||||
GtkCssRulesetsTree *matched;
|
||||
GQuark class;
|
||||
} class;
|
||||
} u;
|
||||
GtkCssRulesetsTree *next;
|
||||
};
|
||||
|
||||
struct _GtkCssScanner
|
||||
{
|
||||
GtkCssProvider *provider;
|
||||
@@ -1012,7 +1042,8 @@ struct _GtkCssProviderPrivate
|
||||
GHashTable *keyframes;
|
||||
|
||||
GArray *rulesets;
|
||||
GtkCssSelectorTree *tree;
|
||||
guint *rulesets_refs;
|
||||
GtkCssRulesetsTree *rulesets_tree;
|
||||
GResource *resource;
|
||||
};
|
||||
|
||||
@@ -1029,6 +1060,7 @@ static void gtk_css_provider_finalize (GObject *object);
|
||||
static void gtk_css_style_provider_iface_init (GtkStyleProviderIface *iface);
|
||||
static void gtk_css_style_provider_private_iface_init (GtkStyleProviderPrivateInterface *iface);
|
||||
static void widget_property_value_list_free (WidgetPropertyValue *head);
|
||||
static void gtk_css_rulesets_tree_free (GtkCssRulesetsTree *tree);
|
||||
|
||||
static gboolean
|
||||
gtk_css_provider_load_internal (GtkCssProvider *css_provider,
|
||||
@@ -1273,10 +1305,17 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
|
||||
ruleset->styles[i].section = NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_ruleset_matches (GtkCssRuleset *ruleset,
|
||||
const GtkCssMatcher *matcher)
|
||||
{
|
||||
return _gtk_css_selector_matches (ruleset->selector, matcher);
|
||||
}
|
||||
|
||||
static GtkCssChange
|
||||
gtk_css_ruleset_get_change (GtkCssRuleset *ruleset)
|
||||
{
|
||||
return _gtk_css_selector_tree_match_get_change (ruleset->selector_match);
|
||||
return _gtk_css_selector_get_change (ruleset->selector);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1398,47 +1437,73 @@ gtk_css_provider_init (GtkCssProvider *css_provider)
|
||||
|
||||
priv->symbolic_colors = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) _gtk_css_value_unref);
|
||||
(GDestroyNotify) gtk_symbolic_color_unref);
|
||||
priv->keyframes = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
(GDestroyNotify) g_free,
|
||||
(GDestroyNotify) _gtk_css_value_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
verify_tree_match_results (GtkCssProvider *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GPtrArray *tree_rules)
|
||||
css_provider_dump_symbolic_colors (GtkCssProvider *css_provider,
|
||||
GtkStyleProperties *props)
|
||||
{
|
||||
#ifdef VERIFY_TREE
|
||||
GtkCssProviderPrivate *priv = provider->priv;
|
||||
GtkCssRuleset *ruleset;
|
||||
gboolean should_match;
|
||||
int i, j;
|
||||
GtkCssProviderPrivate *priv;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
priv = css_provider->priv;
|
||||
g_hash_table_iter_init (&iter, priv->symbolic_colors);
|
||||
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
gboolean found = FALSE;
|
||||
const gchar *name;
|
||||
GtkSymbolicColor *color;
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
name = key;
|
||||
color = value;
|
||||
|
||||
for (j = 0; j < tree_rules->len; j++)
|
||||
{
|
||||
if (ruleset == tree_rules->pdata[j])
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
should_match = _gtk_css_selector_matches (ruleset->selector, matcher);
|
||||
if (found != !!should_match)
|
||||
{
|
||||
g_error ("expected rule '%s' to %s, but it %s\n",
|
||||
_gtk_css_selector_to_string (ruleset->selector),
|
||||
should_match ? "match" : "not match",
|
||||
found ? "matched" : "didn't match");
|
||||
}
|
||||
gtk_style_properties_map_color (props, name, color);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static GtkStyleProperties *
|
||||
gtk_css_provider_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
GtkCssMatcher matcher;
|
||||
GtkCssProvider *css_provider;
|
||||
GtkCssProviderPrivate *priv;
|
||||
GtkStyleProperties *props;
|
||||
guint i, j;
|
||||
|
||||
css_provider = GTK_CSS_PROVIDER (provider);
|
||||
priv = css_provider->priv;
|
||||
props = gtk_style_properties_new ();
|
||||
|
||||
css_provider_dump_symbolic_colors (css_provider, props);
|
||||
if (_gtk_css_matcher_init (&matcher, path, 0))
|
||||
{
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
{
|
||||
GtkCssRuleset *ruleset;
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
|
||||
if (ruleset->styles == NULL)
|
||||
continue;
|
||||
|
||||
if (!gtk_css_ruleset_matches (ruleset, &matcher))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < ruleset->n_styles; j++)
|
||||
_gtk_style_properties_set_property_by_property (props,
|
||||
GTK_CSS_STYLE_PROPERTY (ruleset->styles[i].property),
|
||||
_gtk_css_selector_get_state_flags (ruleset->selector),
|
||||
ruleset->styles[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -1451,7 +1516,6 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
||||
GtkCssProvider *css_provider = GTK_CSS_PROVIDER (provider);
|
||||
GtkCssProviderPrivate *priv = css_provider->priv;
|
||||
WidgetPropertyValue *val;
|
||||
GPtrArray *tree_rules;
|
||||
GtkCssMatcher matcher;
|
||||
gboolean found = FALSE;
|
||||
gchar *prop_name;
|
||||
@@ -1460,20 +1524,22 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
||||
if (!_gtk_css_matcher_init (&matcher, path, state))
|
||||
return FALSE;
|
||||
|
||||
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, &matcher);
|
||||
verify_tree_match_results (css_provider, &matcher, tree_rules);
|
||||
|
||||
prop_name = g_strdup_printf ("-%s-%s",
|
||||
g_type_name (pspec->owner_type),
|
||||
pspec->name);
|
||||
|
||||
for (i = tree_rules->len - 1; i >= 0; i--)
|
||||
for (i = priv->rulesets->len - 1; i >= 0; i--)
|
||||
{
|
||||
GtkCssRuleset *ruleset = tree_rules->pdata[i];
|
||||
GtkCssRuleset *ruleset;
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
|
||||
if (ruleset->widget_style == NULL)
|
||||
continue;
|
||||
|
||||
if (!gtk_css_ruleset_matches (ruleset, &matcher))
|
||||
continue;
|
||||
|
||||
for (val = ruleset->widget_style; val != NULL; val = val->next)
|
||||
{
|
||||
if (strcmp (val->name, prop_name) == 0)
|
||||
@@ -1500,7 +1566,6 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
||||
}
|
||||
|
||||
g_free (prop_name);
|
||||
g_ptr_array_free (tree_rules, TRUE);
|
||||
|
||||
return found;
|
||||
}
|
||||
@@ -1508,10 +1573,11 @@ gtk_css_provider_get_style_property (GtkStyleProvider *provider,
|
||||
static void
|
||||
gtk_css_style_provider_iface_init (GtkStyleProviderIface *iface)
|
||||
{
|
||||
iface->get_style = gtk_css_provider_get_style;
|
||||
iface->get_style_property = gtk_css_provider_get_style_property;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
static GtkSymbolicColor *
|
||||
gtk_css_style_provider_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name)
|
||||
{
|
||||
@@ -1529,6 +1595,117 @@ gtk_css_style_provider_get_keyframes (GtkStyleProviderPrivate *provider,
|
||||
return g_hash_table_lookup (css_provider->priv->keyframes, name);
|
||||
}
|
||||
|
||||
static void
|
||||
collect_possible_rules (GPtrArray *rules_lists,
|
||||
GtkCssRulesetsTree *tree,
|
||||
const GtkCssMatcher *matcher)
|
||||
{
|
||||
if (tree == NULL)
|
||||
return;
|
||||
|
||||
switch (tree->type)
|
||||
{
|
||||
case RULESETS_TREE_TYPE_RULES:
|
||||
g_ptr_array_add (rules_lists, &tree->u.rules);
|
||||
break;
|
||||
case RULESETS_TREE_TYPE_STATE:
|
||||
if ((_gtk_css_matcher_get_state (matcher) & tree->u.state.state) == tree->u.state.state)
|
||||
collect_possible_rules (rules_lists,
|
||||
tree->u.state.matched,
|
||||
matcher);
|
||||
break;
|
||||
case RULESETS_TREE_TYPE_CLASS:
|
||||
if (_gtk_css_matcher_has_class (matcher, tree->u.class.class))
|
||||
collect_possible_rules (rules_lists,
|
||||
tree->u.class.matched,
|
||||
matcher);
|
||||
break;
|
||||
}
|
||||
|
||||
collect_possible_rules (rules_lists,
|
||||
tree->next,
|
||||
matcher);
|
||||
}
|
||||
|
||||
/* Merged two pre-sorted arrays of uints, assumes enough space in destination to fit a_len + b_len */
|
||||
static void
|
||||
merge_uints (guint *dest, const guint *a, int a_len, const guint* b, int b_len)
|
||||
{
|
||||
const guint *a_end = a + a_len;
|
||||
const guint *b_end = b + b_len;
|
||||
|
||||
while (a != a_end ||
|
||||
b != b_end)
|
||||
{
|
||||
if (a == a_end)
|
||||
{
|
||||
memcpy (dest, b, sizeof (guint) * (b_end - b));
|
||||
break;
|
||||
}
|
||||
else if (b == b_end)
|
||||
{
|
||||
memcpy (dest, a, sizeof (guint) * (a_end - a));
|
||||
break;
|
||||
}
|
||||
else if (*a <= *b)
|
||||
*dest++ = *a++;
|
||||
else
|
||||
*dest++ = *b++;
|
||||
}
|
||||
}
|
||||
|
||||
static guint *
|
||||
find_possible_rules (GtkCssRulesetsTree *tree,
|
||||
const GtkCssMatcher *matcher,
|
||||
guint *num_refs_out)
|
||||
{
|
||||
GPtrArray *rules_lists;
|
||||
gint i;
|
||||
guint *merged, *tmp_refs, *swap_ptr;
|
||||
guint merged_size;
|
||||
guint num_refs;
|
||||
|
||||
/* Collect all possible rules from the tree */
|
||||
rules_lists = g_ptr_array_new ();
|
||||
collect_possible_rules (rules_lists, tree, matcher);
|
||||
|
||||
/* Merge the separate sorted lists into one list */
|
||||
num_refs = 0;
|
||||
for (i = 0; i < rules_lists->len; i++)
|
||||
{
|
||||
GtkCssRulesetList *list = (GtkCssRulesetList *)rules_lists->pdata[i];
|
||||
num_refs += list->num_rules;
|
||||
}
|
||||
|
||||
merged = g_new (guint, num_refs);
|
||||
merged_size = 0;
|
||||
tmp_refs = g_new (guint, num_refs);
|
||||
|
||||
/* Merge the already sorted refs list */
|
||||
for (i = 0; i < rules_lists->len; i++)
|
||||
{
|
||||
GtkCssRulesetList *list = (GtkCssRulesetList *)rules_lists->pdata[i];
|
||||
|
||||
if (i == 0)
|
||||
memcpy (merged, list->rules, sizeof (*list->rules) * list->num_rules);
|
||||
else
|
||||
{
|
||||
merge_uints (tmp_refs, merged, merged_size, list->rules, list->num_rules);
|
||||
swap_ptr = merged;
|
||||
merged = tmp_refs;
|
||||
tmp_refs = swap_ptr;
|
||||
}
|
||||
|
||||
merged_size += list->num_rules;
|
||||
}
|
||||
|
||||
g_free (tmp_refs);
|
||||
g_ptr_array_free (rules_lists, TRUE);
|
||||
|
||||
*num_refs_out = num_refs;
|
||||
return merged;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_style_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
@@ -1538,18 +1715,23 @@ gtk_css_style_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
GtkCssProviderPrivate *priv;
|
||||
GtkCssRuleset *ruleset;
|
||||
guint j;
|
||||
int i;
|
||||
GPtrArray *tree_rules;
|
||||
gint i;
|
||||
guint *refs;
|
||||
guint num_refs;
|
||||
|
||||
css_provider = GTK_CSS_PROVIDER (provider);
|
||||
priv = css_provider->priv;
|
||||
|
||||
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, matcher);
|
||||
verify_tree_match_results (css_provider, matcher, tree_rules);
|
||||
if (priv->rulesets->len == 0)
|
||||
return;
|
||||
|
||||
for (i = tree_rules->len - 1; i >= 0; i--)
|
||||
refs = find_possible_rules (priv->rulesets_tree, matcher, &num_refs);
|
||||
if (num_refs == 0)
|
||||
return;
|
||||
|
||||
for (i = num_refs - 1; i >= 0; i--)
|
||||
{
|
||||
ruleset = tree_rules->pdata[i];
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, refs[i]);
|
||||
|
||||
if (ruleset->styles == NULL)
|
||||
continue;
|
||||
@@ -1558,6 +1740,9 @@ gtk_css_style_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
ruleset->set_styles))
|
||||
continue;
|
||||
|
||||
if (!gtk_css_ruleset_matches (ruleset, matcher))
|
||||
continue;
|
||||
|
||||
for (j = 0; j < ruleset->n_styles; j++)
|
||||
{
|
||||
GtkCssStyleProperty *prop = ruleset->styles[j].property;
|
||||
@@ -1576,7 +1761,7 @@ gtk_css_style_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
break;
|
||||
}
|
||||
|
||||
g_ptr_array_free (tree_rules, TRUE);
|
||||
g_free (refs);
|
||||
}
|
||||
|
||||
static GtkCssChange
|
||||
@@ -1586,28 +1771,33 @@ gtk_css_style_provider_get_change (GtkStyleProviderPrivate *provider,
|
||||
GtkCssProvider *css_provider;
|
||||
GtkCssProviderPrivate *priv;
|
||||
GtkCssChange change = 0;
|
||||
GPtrArray *tree_rules;
|
||||
int i;
|
||||
guint *refs;
|
||||
guint num_refs;
|
||||
|
||||
css_provider = GTK_CSS_PROVIDER (provider);
|
||||
priv = css_provider->priv;
|
||||
|
||||
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, matcher);
|
||||
verify_tree_match_results (css_provider, matcher, tree_rules);
|
||||
refs = find_possible_rules (priv->rulesets_tree, matcher, &num_refs);
|
||||
if (num_refs == 0)
|
||||
return change;
|
||||
|
||||
for (i = tree_rules->len - 1; i >= 0; i--)
|
||||
for (i = num_refs - 1; i >= 0; i--)
|
||||
{
|
||||
GtkCssRuleset *ruleset;
|
||||
|
||||
ruleset = tree_rules->pdata[i];
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, refs[i]);
|
||||
|
||||
if (ruleset->styles == NULL)
|
||||
continue;
|
||||
|
||||
if (!gtk_css_ruleset_matches (ruleset, matcher))
|
||||
continue;
|
||||
|
||||
change |= gtk_css_ruleset_get_change (ruleset);
|
||||
}
|
||||
|
||||
g_ptr_array_free (tree_rules, TRUE);
|
||||
g_free (refs);
|
||||
|
||||
return change;
|
||||
}
|
||||
@@ -1635,7 +1825,8 @@ gtk_css_provider_finalize (GObject *object)
|
||||
gtk_css_ruleset_clear (&g_array_index (priv->rulesets, GtkCssRuleset, i));
|
||||
|
||||
g_array_free (priv->rulesets, TRUE);
|
||||
_gtk_css_selector_tree_free (priv->tree);
|
||||
g_free (priv->rulesets_refs);
|
||||
gtk_css_rulesets_tree_free (priv->rulesets_tree);
|
||||
|
||||
g_hash_table_destroy (priv->symbolic_colors);
|
||||
g_hash_table_destroy (priv->keyframes);
|
||||
@@ -1770,12 +1961,14 @@ gtk_css_provider_reset (GtkCssProvider *css_provider)
|
||||
g_hash_table_remove_all (priv->symbolic_colors);
|
||||
g_hash_table_remove_all (priv->keyframes);
|
||||
|
||||
g_free (priv->rulesets_refs);
|
||||
priv->rulesets_refs = NULL;
|
||||
gtk_css_rulesets_tree_free (priv->rulesets_tree);
|
||||
priv->rulesets_tree = NULL;
|
||||
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
gtk_css_ruleset_clear (&g_array_index (priv->rulesets, GtkCssRuleset, i));
|
||||
g_array_set_size (priv->rulesets, 0);
|
||||
_gtk_css_selector_tree_free (priv->tree);
|
||||
priv->tree = NULL;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1878,7 +2071,7 @@ parse_import (GtkCssScanner *scanner)
|
||||
static gboolean
|
||||
parse_color_definition (GtkCssScanner *scanner)
|
||||
{
|
||||
GtkCssValue *color;
|
||||
GtkCssValue *symbolic;
|
||||
char *name;
|
||||
|
||||
gtk_css_scanner_push_section (scanner, GTK_CSS_SECTION_COLOR_DEFINITION);
|
||||
@@ -1902,8 +2095,8 @@ parse_color_definition (GtkCssScanner *scanner)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
color = _gtk_css_color_value_parse (scanner->parser);
|
||||
if (color == NULL)
|
||||
symbolic = _gtk_css_symbolic_value_new (scanner->parser);
|
||||
if (symbolic == NULL)
|
||||
{
|
||||
g_free (name);
|
||||
_gtk_css_parser_resync (scanner->parser, TRUE, 0);
|
||||
@@ -1914,7 +2107,7 @@ parse_color_definition (GtkCssScanner *scanner)
|
||||
if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
|
||||
{
|
||||
g_free (name);
|
||||
_gtk_css_value_unref (color);
|
||||
_gtk_css_value_unref (symbolic);
|
||||
gtk_css_provider_error_literal (scanner->provider,
|
||||
scanner,
|
||||
GTK_CSS_PROVIDER_ERROR,
|
||||
@@ -1926,7 +2119,7 @@ parse_color_definition (GtkCssScanner *scanner)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_hash_table_insert (scanner->provider->priv->symbolic_colors, name, color);
|
||||
g_hash_table_insert (scanner->provider->priv->symbolic_colors, name, symbolic);
|
||||
|
||||
gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_COLOR_DEFINITION);
|
||||
return TRUE;
|
||||
@@ -2406,42 +2599,274 @@ gtk_css_provider_compare_rule (gconstpointer a_,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_rulesets_tree_free (GtkCssRulesetsTree *tree)
|
||||
{
|
||||
if (tree == NULL)
|
||||
return;
|
||||
|
||||
switch (tree->type)
|
||||
{
|
||||
case RULESETS_TREE_TYPE_RULES:
|
||||
break;
|
||||
case RULESETS_TREE_TYPE_STATE:
|
||||
gtk_css_rulesets_tree_free (tree->u.state.matched);
|
||||
break;
|
||||
case RULESETS_TREE_TYPE_CLASS:
|
||||
gtk_css_rulesets_tree_free (tree->u.class.matched);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_css_rulesets_tree_free (tree->next);
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_refs_by_val (gconstpointer pa,
|
||||
gconstpointer pb,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint a = *(guint *)pa;
|
||||
guint b = *(guint *)pb;
|
||||
|
||||
return a - b;
|
||||
}
|
||||
|
||||
static GtkCssRulesetsTree *
|
||||
subdivide_by_none (GtkCssProviderPrivate *priv, guint *refs, guint start, guint end)
|
||||
{
|
||||
GtkCssRulesetsTree *tree;
|
||||
|
||||
tree = g_new0 (GtkCssRulesetsTree, 1);
|
||||
tree->type = RULESETS_TREE_TYPE_RULES;
|
||||
tree->u.rules.rules = refs + start;
|
||||
tree->u.rules.num_rules = end - start;
|
||||
tree->next = NULL;
|
||||
|
||||
/* Sort by rule index (i.e. css prio order) */
|
||||
g_qsort_with_data (tree->u.rules.rules,
|
||||
tree->u.rules.num_rules,
|
||||
sizeof (guint),
|
||||
compare_refs_by_val,
|
||||
NULL);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GQuark class;
|
||||
guint count;
|
||||
} GtkCssPseudoClassCount;
|
||||
|
||||
static gint
|
||||
compare_class_count (gconstpointer pa,
|
||||
gconstpointer pb,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkCssPseudoClassCount *a = (GtkCssPseudoClassCount *)pa;
|
||||
GtkCssPseudoClassCount *b = (GtkCssPseudoClassCount *)pb;
|
||||
|
||||
return b->count - a->count;
|
||||
}
|
||||
|
||||
static GtkCssRulesetsTree *
|
||||
subdivide_by_class (GtkCssProviderPrivate *priv, guint *refs, guint start, guint end)
|
||||
{
|
||||
GHashTable *count_ht;
|
||||
GHashTableIter iter;
|
||||
guint i, j, n_classes;
|
||||
gpointer key, value;
|
||||
GtkCssPseudoClassCount *class_count;
|
||||
GtkCssRulesetsTree *tree;
|
||||
GtkCssRulesetsTree *trees = NULL;
|
||||
|
||||
count_ht = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
|
||||
for (i = start; i < end; i++)
|
||||
{
|
||||
GtkCssSelector *selector = g_array_index (priv->rulesets, GtkCssRuleset, refs[i]).selector;
|
||||
GQuark *classes = _gtk_css_selector_get_primary_classes (selector);
|
||||
|
||||
for (j = 0; classes[j] != 0; j++)
|
||||
{
|
||||
guint count = GPOINTER_TO_INT (g_hash_table_lookup (count_ht, GUINT_TO_POINTER (classes[j])));
|
||||
g_hash_table_replace (count_ht, GUINT_TO_POINTER (classes[j]), GUINT_TO_POINTER (count + 1));
|
||||
}
|
||||
g_free (classes);
|
||||
}
|
||||
|
||||
n_classes = 0;
|
||||
class_count = g_new (GtkCssPseudoClassCount, g_hash_table_size (count_ht));
|
||||
|
||||
g_hash_table_iter_init (&iter, count_ht);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
guint count = GPOINTER_TO_UINT (value);
|
||||
/* Random cuttoff point here. Obviously if any given class has only one item
|
||||
with it, then adding a check doesn't help, and it uses memory. Where
|
||||
is the inflexion point? Lets make it 3... */
|
||||
if (count >= 3)
|
||||
{
|
||||
class_count[n_classes].class = GPOINTER_TO_UINT (key);
|
||||
class_count[n_classes].count = count;
|
||||
n_classes++;
|
||||
}
|
||||
}
|
||||
|
||||
g_hash_table_destroy (count_ht);
|
||||
|
||||
/* Sort largest class counts first */
|
||||
g_qsort_with_data (class_count,
|
||||
n_classes,
|
||||
sizeof (*class_count),
|
||||
compare_class_count,
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < n_classes; i++)
|
||||
{
|
||||
guint split = start;
|
||||
for (j = start; j < end; j++)
|
||||
{
|
||||
GtkCssSelector *selector = g_array_index (priv->rulesets, GtkCssRuleset, refs[j]).selector;
|
||||
|
||||
if (_gtk_css_selector_has_primary_class (selector, class_count[i].class))
|
||||
{
|
||||
guint tmp = refs[split];
|
||||
refs[split] = refs[j];
|
||||
refs[j] = tmp;
|
||||
split++;
|
||||
}
|
||||
}
|
||||
/* Check size again sice nodes may have been used in other trees */
|
||||
if (split - start > 3)
|
||||
{
|
||||
tree = g_new (GtkCssRulesetsTree, 1);
|
||||
tree->type = RULESETS_TREE_TYPE_CLASS;
|
||||
tree->u.class.matched = subdivide_by_none (priv, refs, start, split);
|
||||
tree->u.class.class = class_count[i].class;
|
||||
|
||||
tree->next = trees;
|
||||
trees = tree;
|
||||
start = split;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (class_count);
|
||||
|
||||
if (start != end)
|
||||
{
|
||||
tree = subdivide_by_none (priv, refs, start, end);
|
||||
tree->next = trees;
|
||||
trees = tree;
|
||||
}
|
||||
|
||||
return trees;
|
||||
}
|
||||
|
||||
|
||||
static GtkCssRulesetsTree *
|
||||
subdivide_by_state (GtkCssProviderPrivate *priv, guint *refs, guint start, guint end, guint state)
|
||||
{
|
||||
GtkCssRulesetsTree *tree;
|
||||
guint i;
|
||||
|
||||
if (end == start)
|
||||
return NULL;
|
||||
|
||||
if (state == 0)
|
||||
return subdivide_by_class (priv, refs, start, end);
|
||||
|
||||
// Find first non-set flag
|
||||
for (i = start; i < end; i++)
|
||||
{
|
||||
GtkCssSelector *selector = g_array_index (priv->rulesets, GtkCssRuleset, refs[i]).selector;
|
||||
if ((_gtk_css_selector_get_primary_state_flags (selector) & state) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == start || i == end) /* All or none set, no use subdividing by this */
|
||||
return subdivide_by_state (priv, refs, start, end, state >> 1);
|
||||
|
||||
tree = g_new (GtkCssRulesetsTree, 1);
|
||||
tree->type = RULESETS_TREE_TYPE_STATE;
|
||||
tree->u.state.matched = subdivide_by_state (priv, refs, start, i, state >> 1);
|
||||
tree->u.state.state = state;
|
||||
|
||||
tree->next = subdivide_by_state (priv, refs, i, end, state >> 1);
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_refs_by_flags (gconstpointer pa,
|
||||
gconstpointer pb,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint a = *(guint *)pa;
|
||||
guint b = *(guint *)pb;
|
||||
GArray *rulesets = user_data;
|
||||
GtkCssSelector *selector_a, *selector_b;
|
||||
guint32 flags_a, flags_b;
|
||||
|
||||
selector_a = g_array_index (rulesets, GtkCssRuleset, a).selector;
|
||||
selector_b = g_array_index (rulesets, GtkCssRuleset, b).selector;
|
||||
|
||||
flags_a = _gtk_css_selector_get_primary_state_flags (selector_a);
|
||||
flags_b = _gtk_css_selector_get_primary_state_flags (selector_b);
|
||||
|
||||
return flags_b - flags_a;
|
||||
}
|
||||
|
||||
static void
|
||||
print_tree (GtkCssRulesetsTree *tree, int indent)
|
||||
{
|
||||
if (tree == NULL)
|
||||
return;
|
||||
|
||||
switch (tree->type)
|
||||
{
|
||||
case RULESETS_TREE_TYPE_RULES:
|
||||
printf ("%*sCheck rules %p len %d\n", indent, "", tree->u.rules.rules, tree->u.rules.num_rules);
|
||||
break;
|
||||
case RULESETS_TREE_TYPE_STATE:
|
||||
printf ("%*sMatch state 0x%x ->\n", indent, "", tree->u.state.state);
|
||||
print_tree (tree->u.state.matched, indent + 4);
|
||||
break;
|
||||
case RULESETS_TREE_TYPE_CLASS:
|
||||
printf ("%*sMatch class %s ->\n", indent, "", g_quark_to_string (tree->u.class.class));
|
||||
print_tree (tree->u.class.matched, indent + 4);
|
||||
break;
|
||||
}
|
||||
|
||||
print_tree (tree->next, indent);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_css_provider_postprocess (GtkCssProvider *css_provider)
|
||||
{
|
||||
GtkCssProviderPrivate *priv = css_provider->priv;
|
||||
GtkCssSelectorTreeBuilder *builder;
|
||||
guint i;
|
||||
guint *refs, i;
|
||||
|
||||
g_array_sort (priv->rulesets, gtk_css_provider_compare_rule);
|
||||
|
||||
builder = _gtk_css_selector_tree_builder_new ();
|
||||
refs = g_new (guint, priv->rulesets->len);
|
||||
priv->rulesets_refs = refs;
|
||||
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
refs[i] = i;
|
||||
|
||||
/* Sort by flags, so that high bits set is sorted first at each level */
|
||||
g_qsort_with_data (refs,
|
||||
priv->rulesets->len,
|
||||
sizeof (guint),
|
||||
compare_refs_by_flags,
|
||||
priv->rulesets);
|
||||
|
||||
priv->rulesets_tree = subdivide_by_state (priv, refs, 0, priv->rulesets->len, GTK_STATE_FLAG_BACKDROP);
|
||||
if (g_getenv ("GTK_CSS_DEBUG_TREE"))
|
||||
{
|
||||
GtkCssRuleset *ruleset;
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
|
||||
_gtk_css_selector_tree_builder_add (builder,
|
||||
ruleset->selector,
|
||||
&ruleset->selector_match,
|
||||
ruleset);
|
||||
g_print ("Rulesets tree for proviced %p (%d rules)\n", css_provider, priv->rulesets->len);
|
||||
print_tree (priv->rulesets_tree, 1);
|
||||
}
|
||||
|
||||
priv->tree = _gtk_css_selector_tree_builder_build (builder);
|
||||
_gtk_css_selector_tree_builder_free (builder);
|
||||
|
||||
#ifndef VERIFY_TREE
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
{
|
||||
GtkCssRuleset *ruleset;
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
|
||||
_gtk_css_selector_free (ruleset->selector);
|
||||
ruleset->selector = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -2890,7 +3315,7 @@ gtk_css_ruleset_print (const GtkCssRuleset *ruleset,
|
||||
WidgetPropertyValue *widget_value;
|
||||
guint i;
|
||||
|
||||
_gtk_css_selector_tree_match_print (ruleset->selector_match, str);
|
||||
_gtk_css_selector_print (ruleset->selector, str);
|
||||
|
||||
g_string_append (str, " {\n");
|
||||
|
||||
@@ -2948,6 +3373,7 @@ gtk_css_provider_print_colors (GHashTable *colors,
|
||||
GString *str)
|
||||
{
|
||||
GList *keys, *walk;
|
||||
char *s;
|
||||
|
||||
keys = g_hash_table_get_keys (colors);
|
||||
/* so the output is identical for identical styles */
|
||||
@@ -2956,12 +3382,14 @@ gtk_css_provider_print_colors (GHashTable *colors,
|
||||
for (walk = keys; walk; walk = walk->next)
|
||||
{
|
||||
const char *name = walk->data;
|
||||
GtkCssValue *color = g_hash_table_lookup (colors, (gpointer) name);
|
||||
GtkSymbolicColor *symbolic = g_hash_table_lookup (colors, (gpointer) name);
|
||||
|
||||
g_string_append (str, "@define-color ");
|
||||
g_string_append (str, name);
|
||||
g_string_append (str, " ");
|
||||
_gtk_css_value_print (color, str);
|
||||
s = gtk_symbolic_color_to_string (symbolic);
|
||||
g_string_append (str, s);
|
||||
g_free (s);
|
||||
g_string_append (str, ";\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -44,12 +44,6 @@ gtk_css_value_repeat_compute (GtkCssValue *value,
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_repeat_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_repeat_equal (const GtkCssValue *repeat1,
|
||||
const GtkCssValue *repeat2)
|
||||
@@ -122,7 +116,6 @@ gtk_css_value_border_repeat_print (const GtkCssValue *repeat,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
|
||||
gtk_css_value_repeat_free,
|
||||
gtk_css_value_repeat_compute,
|
||||
gtk_css_value_repeat_needs_compute,
|
||||
gtk_css_value_repeat_equal,
|
||||
gtk_css_value_repeat_transition,
|
||||
gtk_css_value_background_repeat_print
|
||||
@@ -131,7 +124,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_BACKGROUND_REPEAT = {
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_BORDER_REPEAT = {
|
||||
gtk_css_value_repeat_free,
|
||||
gtk_css_value_repeat_compute,
|
||||
gtk_css_value_repeat_needs_compute,
|
||||
gtk_css_value_repeat_equal,
|
||||
gtk_css_value_repeat_transition,
|
||||
gtk_css_value_border_repeat_print
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
|
||||
struct _GtkCssValue {
|
||||
GTK_CSS_VALUE_BASE
|
||||
@@ -44,12 +45,6 @@ gtk_css_value_rgba_compute (GtkCssValue *value,
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_rgba_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_rgba_equal (const GtkCssValue *rgba1,
|
||||
const GtkCssValue *rgba2)
|
||||
@@ -86,7 +81,6 @@ gtk_css_value_rgba_print (const GtkCssValue *rgba,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_RGBA = {
|
||||
gtk_css_value_rgba_free,
|
||||
gtk_css_value_rgba_compute,
|
||||
gtk_css_value_rgba_needs_compute,
|
||||
gtk_css_value_rgba_equal,
|
||||
gtk_css_value_rgba_transition,
|
||||
gtk_css_value_rgba_print
|
||||
|
||||
+98
-965
File diff suppressed because it is too large
Load Diff
@@ -24,8 +24,6 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkCssSelector GtkCssSelector;
|
||||
typedef struct _GtkCssSelectorTree GtkCssSelectorTree;
|
||||
typedef struct _GtkCssSelectorTreeBuilder GtkCssSelectorTreeBuilder;
|
||||
|
||||
GtkCssSelector * _gtk_css_selector_parse (GtkCssParser *parser);
|
||||
void _gtk_css_selector_free (GtkCssSelector *selector);
|
||||
@@ -34,26 +32,18 @@ char * _gtk_css_selector_to_string (const GtkCssSelector *sel
|
||||
void _gtk_css_selector_print (const GtkCssSelector *selector,
|
||||
GString *str);
|
||||
|
||||
GtkStateFlags _gtk_css_selector_get_state_flags (const GtkCssSelector *selector);
|
||||
|
||||
GtkCssChange _gtk_css_selector_get_change (const GtkCssSelector *selector);
|
||||
gboolean _gtk_css_selector_matches (const GtkCssSelector *selector,
|
||||
const GtkCssMatcher *matcher);
|
||||
int _gtk_css_selector_compare (const GtkCssSelector *a,
|
||||
const GtkCssSelector *b);
|
||||
|
||||
void _gtk_css_selector_tree_free (GtkCssSelectorTree *tree);
|
||||
GPtrArray * _gtk_css_selector_tree_match_all (const GtkCssSelectorTree *tree,
|
||||
const GtkCssMatcher *matcher);
|
||||
void _gtk_css_selector_tree_match_print (const GtkCssSelectorTree *tree,
|
||||
GString *str);
|
||||
GtkCssChange _gtk_css_selector_tree_match_get_change (const GtkCssSelectorTree *tree);
|
||||
|
||||
|
||||
GtkCssSelectorTreeBuilder *_gtk_css_selector_tree_builder_new (void);
|
||||
void _gtk_css_selector_tree_builder_add (GtkCssSelectorTreeBuilder *builder,
|
||||
GtkCssSelector *selectors,
|
||||
GtkCssSelectorTree **selector_match,
|
||||
gpointer match);
|
||||
GtkCssSelectorTree * _gtk_css_selector_tree_builder_build (GtkCssSelectorTreeBuilder *builder);
|
||||
void _gtk_css_selector_tree_builder_free (GtkCssSelectorTreeBuilder *builder);
|
||||
GtkStateFlags _gtk_css_selector_get_primary_state_flags (const GtkCssSelector *selector);
|
||||
GQuark * _gtk_css_selector_get_primary_classes (const GtkCssSelector *selector);
|
||||
gboolean _gtk_css_selector_has_primary_class (const GtkCssSelector *selector,
|
||||
GQuark class);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -72,20 +72,6 @@ gtk_css_value_shadows_compute (GtkCssValue *value,
|
||||
return result;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_shadows_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < value->len; i++)
|
||||
{
|
||||
if (_gtk_css_value_needs_compute (value->values[i]))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_shadows_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -195,7 +181,6 @@ gtk_css_value_shadows_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_SHADOWS = {
|
||||
gtk_css_value_shadows_free,
|
||||
gtk_css_value_shadows_compute,
|
||||
gtk_css_value_shadows_needs_compute,
|
||||
gtk_css_value_shadows_equal,
|
||||
gtk_css_value_shadows_transition,
|
||||
gtk_css_value_shadows_print
|
||||
|
||||
@@ -94,18 +94,6 @@ gtk_css_value_shadow_compute (GtkCssValue *shadow,
|
||||
return gtk_css_shadow_value_new (hoffset, voffset, radius, spread, shadow->inset, color);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_shadow_needs_compute (const GtkCssValue *shadow)
|
||||
{
|
||||
return
|
||||
_gtk_css_value_needs_compute (shadow->hoffset) ||
|
||||
_gtk_css_value_needs_compute (shadow->voffset) ||
|
||||
_gtk_css_value_needs_compute (shadow->radius) ||
|
||||
_gtk_css_value_needs_compute (shadow->spread) ||
|
||||
_gtk_css_value_needs_compute (shadow->color);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_shadow_equal (const GtkCssValue *shadow1,
|
||||
const GtkCssValue *shadow2)
|
||||
@@ -166,7 +154,6 @@ gtk_css_value_shadow_print (const GtkCssValue *shadow,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_SHADOW = {
|
||||
gtk_css_value_shadow_free,
|
||||
gtk_css_value_shadow_compute,
|
||||
gtk_css_value_shadow_needs_compute,
|
||||
gtk_css_value_shadow_equal,
|
||||
gtk_css_value_shadow_transition,
|
||||
gtk_css_value_shadow_print
|
||||
|
||||
@@ -102,7 +102,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
|
||||
*/
|
||||
for (i = 0; i < shorthand->subproperties->len; i++)
|
||||
{
|
||||
data[i] = _gtk_css_initial_value_new (shorthand->subproperties->pdata[i]);
|
||||
data[i] = _gtk_css_initial_value_new ();
|
||||
}
|
||||
}
|
||||
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
||||
@@ -135,7 +135,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
|
||||
for (i = 0; i < shorthand->subproperties->len; i++)
|
||||
{
|
||||
if (data[i] == NULL)
|
||||
data[i] = _gtk_css_initial_value_new (shorthand->subproperties->pdata[i]);
|
||||
data[i] = _gtk_css_initial_value_new ();
|
||||
}
|
||||
|
||||
result = _gtk_css_array_value_new_from_array (data, shorthand->subproperties->len);
|
||||
|
||||
@@ -565,8 +565,8 @@ parse_background (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
|
||||
g_ptr_array_unref (arrays[i]);
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
@@ -668,8 +668,8 @@ parse_transition (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
|
||||
g_ptr_array_unref (arrays[i]);
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
@@ -784,8 +784,8 @@ parse_animation (GtkCssShorthandProperty *shorthand,
|
||||
{
|
||||
g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
|
||||
g_ptr_array_unref (arrays[i]);
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
|
||||
@@ -44,12 +44,6 @@ gtk_css_value_string_compute (GtkCssValue *value,
|
||||
return _gtk_css_value_ref (value);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_string_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_string_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -156,7 +150,6 @@ gtk_css_value_ident_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
|
||||
gtk_css_value_string_free,
|
||||
gtk_css_value_string_compute,
|
||||
gtk_css_value_string_needs_compute,
|
||||
gtk_css_value_string_equal,
|
||||
gtk_css_value_string_transition,
|
||||
gtk_css_value_string_print
|
||||
@@ -165,7 +158,6 @@ static const GtkCssValueClass GTK_CSS_VALUE_STRING = {
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_IDENT = {
|
||||
gtk_css_value_string_free,
|
||||
gtk_css_value_string_compute,
|
||||
gtk_css_value_string_needs_compute,
|
||||
gtk_css_value_string_equal,
|
||||
gtk_css_value_string_transition,
|
||||
gtk_css_value_ident_print
|
||||
|
||||
+16
-33
@@ -27,21 +27,20 @@
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssimagegradientprivate.h"
|
||||
#include "gtkcssprovider.h"
|
||||
#include "gtkcssrgbavalueprivate.h"
|
||||
#include "gtkcsstypedvalueprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtkgradient.h"
|
||||
#include "gtkgradientprivate.h"
|
||||
#include "gtkprivatetypebuiltins.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
#include "gtkthemingengine.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkwin32themeprivate.h"
|
||||
|
||||
#include "deprecated/gtkgradientprivate.h"
|
||||
#include "deprecated/gtksymboliccolorprivate.h"
|
||||
|
||||
/* this is in case round() is not provided by the compiler,
|
||||
* such as in the case of C89 compilers, like MSVC
|
||||
*/
|
||||
@@ -172,9 +171,7 @@ rgba_value_parse (GtkCssParser *parser,
|
||||
GtkSymbolicColor *symbolic;
|
||||
GdkRGBA rgba;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
symbolic = _gtk_css_symbolic_value_new (parser);
|
||||
symbolic = _gtk_symbolic_color_new_take_value (_gtk_css_symbolic_value_new (parser));
|
||||
if (symbolic == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -190,8 +187,6 @@ rgba_value_parse (GtkCssParser *parser,
|
||||
g_value_take_boxed (value, symbolic);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -230,11 +225,11 @@ rgba_value_compute (GtkStyleProviderPrivate *provider,
|
||||
GValue new_value = G_VALUE_INIT;
|
||||
GdkRGBA rgba;
|
||||
|
||||
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (symbolic),
|
||||
provider,
|
||||
_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
dependencies);
|
||||
val = _gtk_symbolic_color_resolve_full (symbolic,
|
||||
provider,
|
||||
_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
dependencies);
|
||||
if (val != NULL)
|
||||
{
|
||||
rgba = *_gtk_css_rgba_value_get_rgba (val);
|
||||
@@ -258,9 +253,7 @@ color_value_parse (GtkCssParser *parser,
|
||||
GtkSymbolicColor *symbolic;
|
||||
GdkRGBA rgba;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
symbolic = _gtk_css_symbolic_value_new (parser);
|
||||
symbolic = _gtk_symbolic_color_new_take_value (_gtk_css_symbolic_value_new (parser));
|
||||
if (symbolic == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -281,8 +274,6 @@ color_value_parse (GtkCssParser *parser,
|
||||
g_value_take_boxed (value, symbolic);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -319,11 +310,11 @@ color_value_compute (GtkStyleProviderPrivate *provider,
|
||||
GValue new_value = G_VALUE_INIT;
|
||||
GtkCssValue *val;
|
||||
|
||||
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (g_value_get_boxed (value)),
|
||||
provider,
|
||||
_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
dependencies);
|
||||
val = _gtk_symbolic_color_resolve_full ((GtkSymbolicColor *) g_value_get_boxed (value),
|
||||
provider,
|
||||
_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
dependencies);
|
||||
if (val != NULL)
|
||||
{
|
||||
const GdkRGBA *rgba = _gtk_css_rgba_value_get_rgba (val);
|
||||
@@ -347,7 +338,7 @@ symbolic_color_value_parse (GtkCssParser *parser,
|
||||
{
|
||||
GtkSymbolicColor *symbolic;
|
||||
|
||||
symbolic = _gtk_css_symbolic_value_new (parser);
|
||||
symbolic = _gtk_symbolic_color_new_take_value (_gtk_css_symbolic_value_new (parser));
|
||||
if (symbolic == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -361,8 +352,6 @@ symbolic_color_value_print (const GValue *value,
|
||||
{
|
||||
GtkSymbolicColor *symbolic = g_value_get_boxed (value);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if (symbolic == NULL)
|
||||
g_string_append (string, "none");
|
||||
else
|
||||
@@ -371,8 +360,6 @@ symbolic_color_value_print (const GValue *value,
|
||||
g_string_append (string, s);
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -715,8 +702,6 @@ gradient_value_print (const GValue *value,
|
||||
{
|
||||
GtkGradient *gradient = g_value_get_boxed (value);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if (gradient == NULL)
|
||||
g_string_append (string, "none");
|
||||
else
|
||||
@@ -725,8 +710,6 @@ gradient_value_print (const GValue *value,
|
||||
g_string_append (string, s);
|
||||
g_free (s);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ANIMATED,
|
||||
PROP_AFFECTS_SIZE,
|
||||
PROP_ID,
|
||||
PROP_INHERIT,
|
||||
PROP_INITIAL
|
||||
@@ -46,8 +45,6 @@ enum {
|
||||
|
||||
G_DEFINE_TYPE (GtkCssStyleProperty, _gtk_css_style_property, GTK_TYPE_STYLE_PROPERTY)
|
||||
|
||||
static GtkBitmask *_properties_affecting_size = NULL;
|
||||
|
||||
static void
|
||||
gtk_css_style_property_constructed (GObject *object)
|
||||
{
|
||||
@@ -57,9 +54,6 @@ gtk_css_style_property_constructed (GObject *object)
|
||||
property->id = klass->style_properties->len;
|
||||
g_ptr_array_add (klass->style_properties, property);
|
||||
|
||||
if (property->affects_size)
|
||||
_properties_affecting_size = _gtk_bitmask_set (_properties_affecting_size, property->id, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (_gtk_css_style_property_parent_class)->constructed (object);
|
||||
}
|
||||
|
||||
@@ -76,9 +70,6 @@ gtk_css_style_property_set_property (GObject *object,
|
||||
case PROP_ANIMATED:
|
||||
property->animated = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_AFFECTS_SIZE:
|
||||
property->affects_size = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_INHERIT:
|
||||
property->inherit = g_value_get_boolean (value);
|
||||
break;
|
||||
@@ -105,9 +96,6 @@ gtk_css_style_property_get_property (GObject *object,
|
||||
case PROP_ANIMATED:
|
||||
g_value_set_boolean (value, property->animated);
|
||||
break;
|
||||
case PROP_AFFECTS_SIZE:
|
||||
g_value_set_boolean (value, property->affects_size);
|
||||
break;
|
||||
case PROP_ID:
|
||||
g_value_set_boolean (value, property->id);
|
||||
break;
|
||||
@@ -230,7 +218,7 @@ gtk_css_style_property_parse_value (GtkStyleProperty *property,
|
||||
/* the initial value can be explicitly specified with the
|
||||
* ‘initial’ keyword which all properties accept.
|
||||
*/
|
||||
return _gtk_css_initial_value_new (style_property);
|
||||
return _gtk_css_initial_value_new ();
|
||||
}
|
||||
else if (_gtk_css_parser_try (parser, "inherit", TRUE))
|
||||
{
|
||||
@@ -263,13 +251,6 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
|
||||
P_("Set if the value can be animated"),
|
||||
FALSE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_AFFECTS_SIZE,
|
||||
g_param_spec_boolean ("affects-size",
|
||||
P_("Affects size"),
|
||||
P_("Set if the value affects the sizing of elements"),
|
||||
TRUE,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_ID,
|
||||
g_param_spec_uint ("id",
|
||||
@@ -297,8 +278,6 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
|
||||
property_class->parse_value = gtk_css_style_property_parse_value;
|
||||
|
||||
klass->style_properties = g_ptr_array_new ();
|
||||
|
||||
_properties_affecting_size = _gtk_bitmask_new ();
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -402,23 +381,6 @@ _gtk_css_style_property_is_animated (GtkCssStyleProperty *property)
|
||||
return property->animated;
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_css_style_property_affects_size:
|
||||
* @property: the property
|
||||
*
|
||||
* Queries if the given @property affects the size of elements. This is
|
||||
* used for optimizations inside GTK, where a gtk_widget_queue_resize()
|
||||
* can be avoided if the property does not affect size.
|
||||
*
|
||||
* Returns: %TRUE if the property affects sizing of elements.
|
||||
**/
|
||||
gboolean
|
||||
_gtk_css_style_property_affects_size (GtkCssStyleProperty *property)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CSS_STYLE_PROPERTY (property), FALSE);
|
||||
|
||||
return property->affects_size;
|
||||
}
|
||||
/**
|
||||
* _gtk_css_style_property_get_id:
|
||||
* @property: the property
|
||||
@@ -453,9 +415,3 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
|
||||
|
||||
return property->initial_value;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_css_style_property_changes_affect_size (const GtkBitmask *changes)
|
||||
{
|
||||
return _gtk_bitmask_intersects (changes, _properties_affecting_size);
|
||||
}
|
||||
|
||||
@@ -46,10 +46,9 @@
|
||||
#include "gtkcsscornervalueprivate.h"
|
||||
#include "gtkcsseasevalueprivate.h"
|
||||
#include "gtkcssenginevalueprivate.h"
|
||||
#include "gtkcssimageprivate.h"
|
||||
#include "gtkcssimagegradientprivate.h"
|
||||
#include "gtkcssimageprivate.h"
|
||||
#include "gtkcssimagevalueprivate.h"
|
||||
#include "gtkcssinitialvalueprivate.h"
|
||||
#include "gtkcssenumvalueprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcsspositionvalueprivate.h"
|
||||
@@ -65,8 +64,7 @@
|
||||
|
||||
typedef enum {
|
||||
GTK_STYLE_PROPERTY_INHERIT = (1 << 0),
|
||||
GTK_STYLE_PROPERTY_ANIMATED = (1 << 1),
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE = (1 << 2)
|
||||
GTK_STYLE_PROPERTY_ANIMATED = (1 << 1)
|
||||
} GtkStylePropertyFlags;
|
||||
|
||||
static void
|
||||
@@ -88,7 +86,6 @@ gtk_css_style_property_register (const char * name,
|
||||
|
||||
node = g_object_new (GTK_TYPE_CSS_STYLE_PROPERTY,
|
||||
"value-type", value_type,
|
||||
"affects-size", (flags & GTK_STYLE_PROPERTY_NO_RESIZE) ? FALSE : TRUE,
|
||||
"animated", (flags & GTK_STYLE_PROPERTY_ANIMATED) ? TRUE : FALSE,
|
||||
"inherit", (flags & GTK_STYLE_PROPERTY_INHERIT) ? TRUE : FALSE,
|
||||
"initial-value", initial_value,
|
||||
@@ -162,7 +159,7 @@ assign_border (GtkCssStyleProperty *property,
|
||||
const GtkBorder *border = g_value_get_boxed (value);
|
||||
|
||||
if (border == NULL)
|
||||
return _gtk_css_initial_value_new (property);
|
||||
return _gtk_css_value_ref (_gtk_css_style_property_get_initial_value (property));
|
||||
else
|
||||
return _gtk_css_border_value_new (_gtk_css_number_value_new (border->top, GTK_CSS_PX),
|
||||
_gtk_css_number_value_new (border->right, GTK_CSS_PX),
|
||||
@@ -648,17 +645,15 @@ static GtkCssValue *
|
||||
font_size_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
GtkCssValue *value;
|
||||
gdouble d;
|
||||
|
||||
value = _gtk_css_font_size_value_try_parse (parser);
|
||||
if (value)
|
||||
return value;
|
||||
if (!_gtk_css_parser_try_double (parser, &d))
|
||||
{
|
||||
_gtk_css_parser_error (parser, "Expected a number");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _gtk_css_number_value_parse (parser,
|
||||
GTK_CSS_PARSE_LENGTH
|
||||
| GTK_CSS_PARSE_PERCENT
|
||||
| GTK_CSS_POSITIVE_ONLY
|
||||
| GTK_CSS_NUMBER_AS_PIXELS);
|
||||
return _gtk_css_number_value_new (d, GTK_CSS_PX);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
@@ -868,7 +863,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("color",
|
||||
GTK_CSS_PROPERTY_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
color_parse,
|
||||
color_query,
|
||||
color_assign,
|
||||
@@ -880,14 +875,15 @@ _gtk_css_style_property_init_properties (void)
|
||||
font_size_parse,
|
||||
query_length_as_double,
|
||||
assign_length_from_double,
|
||||
_gtk_css_font_size_value_new (GTK_CSS_FONT_SIZE_MEDIUM));
|
||||
/* XXX: This should be 'normal' */
|
||||
_gtk_css_number_value_new (10.0, GTK_CSS_PX));
|
||||
|
||||
/* properties that aren't referenced when computing values
|
||||
* start here */
|
||||
gtk_css_style_property_register ("background-color",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
color_parse,
|
||||
color_query,
|
||||
color_assign,
|
||||
@@ -929,7 +925,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("text-shadow",
|
||||
GTK_CSS_PROPERTY_TEXT_SHADOW,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
shadow_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -938,7 +934,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("icon-shadow",
|
||||
GTK_CSS_PROPERTY_ICON_SHADOW,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
|
||||
shadow_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -947,7 +943,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("box-shadow",
|
||||
GTK_CSS_PROPERTY_BOX_SHADOW,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
shadow_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1023,7 +1019,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-top-style",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_border_style,
|
||||
query_border_style,
|
||||
assign_border_style,
|
||||
@@ -1039,7 +1035,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-left-style",
|
||||
GTK_CSS_PROPERTY_BORDER_LEFT_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_border_style,
|
||||
query_border_style,
|
||||
assign_border_style,
|
||||
@@ -1055,7 +1051,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-bottom-style",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_border_style,
|
||||
query_border_style,
|
||||
assign_border_style,
|
||||
@@ -1071,7 +1067,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-right-style",
|
||||
GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_border_style,
|
||||
query_border_style,
|
||||
assign_border_style,
|
||||
@@ -1088,7 +1084,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-top-left-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
border_corner_radius_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1097,7 +1093,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-top-right-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
border_corner_radius_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1106,7 +1102,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-bottom-right-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
border_corner_radius_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1115,7 +1111,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-bottom-left-radius",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
border_corner_radius_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1125,7 +1121,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("outline-style",
|
||||
GTK_CSS_PROPERTY_OUTLINE_STYLE,
|
||||
GTK_TYPE_BORDER_STYLE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_border_style,
|
||||
query_border_style,
|
||||
assign_border_style,
|
||||
@@ -1141,7 +1137,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("outline-offset",
|
||||
GTK_CSS_PROPERTY_OUTLINE_OFFSET,
|
||||
G_TYPE_INT,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
outline_parse,
|
||||
query_length_as_int,
|
||||
assign_length_from_int,
|
||||
@@ -1150,7 +1146,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("background-clip",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_CLIP,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_css_area,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1158,7 +1154,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("background-origin",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_ORIGIN,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_css_area,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1166,7 +1162,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("background-size",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_SIZE,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
background_size_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1174,7 +1170,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("background-position",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_POSITION,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
background_position_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1184,7 +1180,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-top-color",
|
||||
GTK_CSS_PROPERTY_BORDER_TOP_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
color_parse,
|
||||
color_query,
|
||||
color_assign,
|
||||
@@ -1192,7 +1188,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-right-color",
|
||||
GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
color_parse,
|
||||
color_query,
|
||||
color_assign,
|
||||
@@ -1200,7 +1196,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-bottom-color",
|
||||
GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
color_parse,
|
||||
color_query,
|
||||
color_assign,
|
||||
@@ -1208,7 +1204,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-left-color",
|
||||
GTK_CSS_PROPERTY_BORDER_LEFT_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
color_parse,
|
||||
color_query,
|
||||
color_assign,
|
||||
@@ -1216,7 +1212,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("outline-color",
|
||||
GTK_CSS_PROPERTY_OUTLINE_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
color_parse,
|
||||
color_query,
|
||||
color_assign,
|
||||
@@ -1225,7 +1221,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("background-repeat",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_REPEAT,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
background_repeat_value_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1234,7 +1230,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("background-image",
|
||||
GTK_CSS_PROPERTY_BACKGROUND_IMAGE,
|
||||
CAIRO_GOBJECT_TYPE_PATTERN,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
background_image_value_parse,
|
||||
background_image_value_query,
|
||||
background_image_value_assign,
|
||||
@@ -1243,7 +1239,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-image-source",
|
||||
GTK_CSS_PROPERTY_BORDER_IMAGE_SOURCE,
|
||||
CAIRO_GOBJECT_TYPE_PATTERN,
|
||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
GTK_STYLE_PROPERTY_ANIMATED,
|
||||
css_image_value_parse,
|
||||
css_image_value_query,
|
||||
css_image_value_assign,
|
||||
@@ -1251,7 +1247,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-image-repeat",
|
||||
GTK_CSS_PROPERTY_BORDER_IMAGE_REPEAT,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
border_image_repeat_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1261,7 +1257,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-image-slice",
|
||||
GTK_CSS_PROPERTY_BORDER_IMAGE_SLICE,
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
border_image_slice_parse,
|
||||
query_border,
|
||||
assign_border,
|
||||
@@ -1272,7 +1268,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("border-image-width",
|
||||
GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH,
|
||||
GTK_TYPE_BORDER,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
border_image_width_parse,
|
||||
query_border,
|
||||
assign_border,
|
||||
@@ -1284,7 +1280,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("transition-property",
|
||||
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_property_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1292,7 +1288,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("transition-duration",
|
||||
GTK_CSS_PROPERTY_TRANSITION_DURATION,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_time_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1300,7 +1296,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("transition-timing-function",
|
||||
GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_timing_function_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1309,7 +1305,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("transition-delay",
|
||||
GTK_CSS_PROPERTY_TRANSITION_DELAY,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_time_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1318,7 +1314,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-name",
|
||||
GTK_CSS_PROPERTY_ANIMATION_NAME,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_property_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1326,7 +1322,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-duration",
|
||||
GTK_CSS_PROPERTY_ANIMATION_DURATION,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_time_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1334,7 +1330,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-timing-function",
|
||||
GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_timing_function_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1343,7 +1339,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-iteration-count",
|
||||
GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
iteration_count_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1351,7 +1347,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-direction",
|
||||
GTK_CSS_PROPERTY_ANIMATION_DIRECTION,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_css_direction,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1359,7 +1355,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-play-state",
|
||||
GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_css_play_state,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1367,7 +1363,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-delay",
|
||||
GTK_CSS_PROPERTY_ANIMATION_DELAY,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
transition_time_parse,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1375,7 +1371,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("animation-fill-mode",
|
||||
GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
|
||||
G_TYPE_NONE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
parse_css_fill_mode,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -1384,7 +1380,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("engine",
|
||||
GTK_CSS_PROPERTY_ENGINE,
|
||||
GTK_TYPE_THEMING_ENGINE,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
engine_parse,
|
||||
engine_query,
|
||||
engine_assign,
|
||||
@@ -1394,7 +1390,7 @@ _gtk_css_style_property_init_properties (void)
|
||||
gtk_css_style_property_register ("gtk-key-bindings",
|
||||
GTK_CSS_PROPERTY_GTK_KEY_BINDINGS,
|
||||
G_TYPE_PTR_ARRAY,
|
||||
GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||
0,
|
||||
bindings_value_parse,
|
||||
bindings_value_query,
|
||||
bindings_value_assign,
|
||||
|
||||
@@ -49,9 +49,6 @@ struct _GtkCssStyleProperty
|
||||
guint id;
|
||||
guint inherit :1;
|
||||
guint animated :1;
|
||||
guint affects_size :1;
|
||||
|
||||
GtkCssValue *css_initial_value; /* Used to quickly find the GCssInitialValue for a property */
|
||||
|
||||
GtkCssStylePropertyParseFunc parse_value;
|
||||
GtkCssStylePropertyQueryFunc query_value;
|
||||
@@ -74,7 +71,6 @@ GtkCssStyleProperty * _gtk_css_style_property_lookup_by_id (guint
|
||||
|
||||
gboolean _gtk_css_style_property_is_inherit (GtkCssStyleProperty *property);
|
||||
gboolean _gtk_css_style_property_is_animated (GtkCssStyleProperty *property);
|
||||
gboolean _gtk_css_style_property_affects_size (GtkCssStyleProperty *property);
|
||||
guint _gtk_css_style_property_get_id (GtkCssStyleProperty *property);
|
||||
GtkCssValue * _gtk_css_style_property_get_initial_value
|
||||
(GtkCssStyleProperty *property);
|
||||
@@ -82,9 +78,6 @@ GtkCssValue * _gtk_css_style_property_get_initial_value
|
||||
void _gtk_css_style_property_print_value (GtkCssStyleProperty *property,
|
||||
GtkCssValue *value,
|
||||
GString *string);
|
||||
|
||||
gboolean _gtk_css_style_property_changes_affect_size
|
||||
(const GtkBitmask *changes);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -47,12 +47,6 @@ gtk_css_value_typed_compute (GtkCssValue *value,
|
||||
return _gtk_css_style_compute_value (provider, values, parent_values, custom->pspec->value_type, value, dependencies);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_typed_needs_compute (const GtkCssValue *value)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_value_typed_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
@@ -79,7 +73,6 @@ gtk_css_value_typed_print (const GtkCssValue *value,
|
||||
static const GtkCssValueClass GTK_CSS_VALUE_TYPED = {
|
||||
gtk_css_value_typed_free,
|
||||
gtk_css_value_typed_compute,
|
||||
gtk_css_value_typed_needs_compute,
|
||||
gtk_css_value_typed_equal,
|
||||
gtk_css_value_typed_transition,
|
||||
gtk_css_value_typed_print
|
||||
|
||||
@@ -161,20 +161,6 @@ typedef enum /*< skip >*/ {
|
||||
GTK_CSS_FILL_BOTH
|
||||
} GtkCssFillMode;
|
||||
|
||||
typedef enum /*< skip >*/ {
|
||||
/* relative font sizes */
|
||||
GTK_CSS_FONT_SIZE_SMALLER,
|
||||
GTK_CSS_FONT_SIZE_LARGER,
|
||||
/* absolute font sizes */
|
||||
GTK_CSS_FONT_SIZE_XX_SMALL,
|
||||
GTK_CSS_FONT_SIZE_X_SMALL,
|
||||
GTK_CSS_FONT_SIZE_SMALL,
|
||||
GTK_CSS_FONT_SIZE_MEDIUM,
|
||||
GTK_CSS_FONT_SIZE_LARGE,
|
||||
GTK_CSS_FONT_SIZE_X_LARGE,
|
||||
GTK_CSS_FONT_SIZE_XX_LARGE
|
||||
} GtkCssFontSize;
|
||||
|
||||
/* for the order in arrays */
|
||||
typedef enum /*< skip >*/ {
|
||||
GTK_CSS_TOP,
|
||||
|
||||
+12
-34
@@ -17,7 +17,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
|
||||
#include "gtkcsscomputedvaluesprivate.h"
|
||||
@@ -46,7 +45,7 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass,
|
||||
GtkCssValue *
|
||||
_gtk_css_value_ref (GtkCssValue *value)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||
g_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
g_atomic_int_add (&value->ref_count, 1);
|
||||
|
||||
@@ -94,10 +93,10 @@ _gtk_css_value_compute (GtkCssValue *value,
|
||||
{
|
||||
GtkCssDependencies fallback;
|
||||
|
||||
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
||||
gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
gtk_internal_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
|
||||
g_return_val_if_fail (value != NULL, NULL);
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
||||
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
|
||||
g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
|
||||
|
||||
if (dependencies == NULL)
|
||||
dependencies = &fallback;
|
||||
@@ -106,33 +105,12 @@ _gtk_css_value_compute (GtkCssValue *value,
|
||||
return value->class->compute (value, property_id, provider, values, parent_values, dependencies);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_css_value_needs_compute:
|
||||
* @value: the value to check or %null
|
||||
*
|
||||
* Checks whether a particular css value *really* needs computation.
|
||||
* A lot of css values are "absolute" (like say "10 px") and never need
|
||||
* any computation done. Such a value would always just return itself
|
||||
* as the computed value. This can be used in some cases to avoid
|
||||
* repeated computations.
|
||||
*
|
||||
* Returns: %false if computing this value always returns itself, %false otherwise
|
||||
**/
|
||||
gboolean
|
||||
_gtk_css_value_needs_compute (GtkCssValue *value)
|
||||
{
|
||||
if (value == NULL)
|
||||
return FALSE;
|
||||
|
||||
return value->class->needs_compute (value);
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_css_value_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (value1 != NULL, FALSE);
|
||||
gtk_internal_return_val_if_fail (value2 != NULL, FALSE);
|
||||
g_return_val_if_fail (value1 != NULL, FALSE);
|
||||
g_return_val_if_fail (value2 != NULL, FALSE);
|
||||
|
||||
if (value1 == value2)
|
||||
return TRUE;
|
||||
@@ -163,8 +141,8 @@ _gtk_css_value_transition (GtkCssValue *start,
|
||||
guint property_id,
|
||||
double progress)
|
||||
{
|
||||
gtk_internal_return_val_if_fail (start != NULL, FALSE);
|
||||
gtk_internal_return_val_if_fail (end != NULL, FALSE);
|
||||
g_return_val_if_fail (start != NULL, FALSE);
|
||||
g_return_val_if_fail (end != NULL, FALSE);
|
||||
|
||||
if (start->class != end->class)
|
||||
return NULL;
|
||||
@@ -177,7 +155,7 @@ _gtk_css_value_to_string (const GtkCssValue *value)
|
||||
{
|
||||
GString *string;
|
||||
|
||||
gtk_internal_return_val_if_fail (value != NULL, NULL);
|
||||
g_return_val_if_fail (value != NULL, NULL);
|
||||
|
||||
string = g_string_new (NULL);
|
||||
_gtk_css_value_print (value, string);
|
||||
@@ -197,8 +175,8 @@ void
|
||||
_gtk_css_value_print (const GtkCssValue *value,
|
||||
GString *string)
|
||||
{
|
||||
gtk_internal_return_if_fail (value != NULL);
|
||||
gtk_internal_return_if_fail (string != NULL);
|
||||
g_return_if_fail (value != NULL);
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
value->class->print (value, string);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ struct _GtkCssValueClass {
|
||||
GtkCssComputedValues *values,
|
||||
GtkCssComputedValues *parent_values,
|
||||
GtkCssDependencies *dependencies);
|
||||
gboolean (* needs_compute) (const GtkCssValue *value);
|
||||
gboolean (* equal) (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2);
|
||||
GtkCssValue * (* transition) (GtkCssValue *start,
|
||||
@@ -72,7 +71,6 @@ GtkCssValue *_gtk_css_value_compute (GtkCssValue
|
||||
GtkCssComputedValues *values,
|
||||
GtkCssComputedValues *parent_values,
|
||||
GtkCssDependencies *dependencies);
|
||||
gboolean _gtk_css_value_needs_compute (GtkCssValue *value);
|
||||
gboolean _gtk_css_value_equal (const GtkCssValue *value1,
|
||||
const GtkCssValue *value2);
|
||||
gboolean _gtk_css_value_equal0 (const GtkCssValue *value1,
|
||||
|
||||
@@ -602,7 +602,7 @@ custom_paper_printer_data_func (GtkCellLayout *cell_layout,
|
||||
if (printer)
|
||||
g_object_set (cell, "text", gtk_printer_get_name (printer), NULL);
|
||||
else
|
||||
g_object_set (cell, "text", _("Margins from Printer…"), NULL);
|
||||
g_object_set (cell, "text", _("Margins from Printer..."), NULL);
|
||||
|
||||
if (printer)
|
||||
g_object_unref (printer);
|
||||
|
||||
+2
-4
@@ -1251,7 +1251,6 @@ get_next_site (GtkExpander *expander,
|
||||
case GTK_DIR_RIGHT:
|
||||
return FOCUS_WIDGET;
|
||||
}
|
||||
break;
|
||||
case FOCUS_WIDGET:
|
||||
switch (direction)
|
||||
{
|
||||
@@ -1265,8 +1264,8 @@ get_next_site (GtkExpander *expander,
|
||||
return FOCUS_LABEL;
|
||||
case GTK_DIR_RIGHT:
|
||||
return ltr ? FOCUS_LABEL : FOCUS_NONE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FOCUS_LABEL:
|
||||
switch (direction)
|
||||
{
|
||||
@@ -1280,8 +1279,8 @@ get_next_site (GtkExpander *expander,
|
||||
return FOCUS_CHILD;
|
||||
case GTK_DIR_RIGHT:
|
||||
return ltr ? FOCUS_CHILD : FOCUS_WIDGET;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case FOCUS_CHILD:
|
||||
switch (direction)
|
||||
{
|
||||
@@ -1294,7 +1293,6 @@ get_next_site (GtkExpander *expander,
|
||||
case GTK_DIR_RIGHT:
|
||||
return FOCUS_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
|
||||
@@ -1032,9 +1032,8 @@ gtk_file_chooser_get_create_folders (GtkFileChooser *chooser)
|
||||
* @chooser: a #GtkFileChooser
|
||||
*
|
||||
* Gets the filename for the currently selected file in
|
||||
* the file selector. The filename is returned as an absolute path. If
|
||||
* multiple files are selected, one of the filenames will be returned at
|
||||
* random.
|
||||
* the file selector. If multiple files are selected,
|
||||
* one of the filenames will be returned at random.
|
||||
*
|
||||
* If the file chooser is in folder mode, this function returns the selected
|
||||
* folder.
|
||||
|
||||
@@ -2043,7 +2043,7 @@ model_add_other (GtkFileChooserButton *button)
|
||||
gtk_list_store_insert (store, &iter, pos);
|
||||
gtk_list_store_set (store, &iter,
|
||||
ICON_COLUMN, NULL,
|
||||
DISPLAY_NAME_COLUMN, _("Other…"),
|
||||
DISPLAY_NAME_COLUMN, _("Other..."),
|
||||
TYPE_COLUMN, ROW_TYPE_OTHER,
|
||||
DATA_COLUMN, NULL,
|
||||
IS_FOLDER_COLUMN, FALSE,
|
||||
|
||||
@@ -3386,7 +3386,7 @@ shortcuts_build_popup_menu (GtkFileChooserDefault *impl)
|
||||
gtk_widget_show (item);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_shortcuts_popup_menu), item);
|
||||
|
||||
item = gtk_menu_item_new_with_label (_("Rename…"));
|
||||
item = gtk_menu_item_new_with_label (_("Rename..."));
|
||||
impl->browse_shortcuts_popup_menu_rename_item = item;
|
||||
g_signal_connect (item, "activate",
|
||||
G_CALLBACK (rename_shortcut_cb), impl);
|
||||
@@ -3865,7 +3865,7 @@ copy_file_clear_cb (GtkClipboard *clipboard,
|
||||
g_slist_free (selected_files);
|
||||
}
|
||||
|
||||
/* Callback used when the "Copy file’s location" menu item is activated */
|
||||
/* Callback used when the "Copy file's location" menu item is activated */
|
||||
static void
|
||||
copy_file_location_cb (GtkMenuItem *item,
|
||||
GtkFileChooserDefault *impl)
|
||||
@@ -4107,7 +4107,7 @@ file_list_drag_motion_cb (GtkWidget *widget,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Sensitizes the "Copy file’s location" context menu item if there is actually
|
||||
/* Sensitizes the "Copy file's location" context menu item if there is actually
|
||||
* a selection active.
|
||||
*/
|
||||
static void
|
||||
@@ -4176,7 +4176,7 @@ file_list_build_popup_menu (GtkFileChooserDefault *impl)
|
||||
impl->browse_files_popup_menu_visit_file_item = file_list_add_image_menu_item (impl, GTK_STOCK_DIRECTORY, _("_Visit this file"),
|
||||
G_CALLBACK (visit_file_cb));
|
||||
|
||||
impl->browse_files_popup_menu_copy_file_location_item = file_list_add_image_menu_item (impl, GTK_STOCK_COPY, _("_Copy file’s location"),
|
||||
impl->browse_files_popup_menu_copy_file_location_item = file_list_add_image_menu_item (impl, GTK_STOCK_COPY, _("_Copy file's location"),
|
||||
G_CALLBACK (copy_file_location_cb));
|
||||
|
||||
impl->browse_files_popup_menu_add_shortcut_item = file_list_add_image_menu_item (impl, GTK_STOCK_ADD, _("_Add to Bookmarks"),
|
||||
|
||||
@@ -17,11 +17,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define GDK_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
#include "gtkgradientprivate.h"
|
||||
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssrgbavalueprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkstyleproperties.h"
|
||||
@@ -43,11 +40,6 @@
|
||||
* It is not normally necessary to deal directly with #GtkGradients,
|
||||
* since they are mostly used behind the scenes by #GtkStyleContext and
|
||||
* #GtkCssProvider.
|
||||
*
|
||||
* #GtkGradient is deprecated. It was used internally by GTK's CSS engine
|
||||
* to represent gradients. As its handling is not conforming to modern
|
||||
* web standards, it is not used anymore. If you want to use gradients in
|
||||
* your own code, please use Cairo directly.
|
||||
*/
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GtkGradient, gtk_gradient,
|
||||
@@ -88,8 +80,6 @@ struct _GtkGradient
|
||||
* Returns: A newly created #GtkGradient
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
GtkGradient *
|
||||
gtk_gradient_new_linear (gdouble x0,
|
||||
@@ -130,8 +120,6 @@ gtk_gradient_new_linear (gdouble x0,
|
||||
* Returns: A newly created #GtkGradient
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
GtkGradient *
|
||||
gtk_gradient_new_radial (gdouble x0,
|
||||
@@ -167,8 +155,6 @@ gtk_gradient_new_radial (gdouble x0,
|
||||
* Adds a stop color to @gradient.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_gradient_add_color_stop (GtkGradient *gradient,
|
||||
@@ -194,8 +180,6 @@ gtk_gradient_add_color_stop (GtkGradient *gradient,
|
||||
* Returns: The same @gradient
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
GtkGradient *
|
||||
gtk_gradient_ref (GtkGradient *gradient)
|
||||
@@ -215,8 +199,6 @@ gtk_gradient_ref (GtkGradient *gradient)
|
||||
* if the reference count reaches 0.
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_gradient_unref (GtkGradient *gradient)
|
||||
@@ -257,8 +239,6 @@ gtk_gradient_unref (GtkGradient *gradient)
|
||||
* Returns: %TRUE if the gradient has been resolved
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
gboolean
|
||||
gtk_gradient_resolve (GtkGradient *gradient,
|
||||
@@ -338,11 +318,11 @@ _gtk_gradient_resolve_full (GtkGradient *gradient,
|
||||
stop = &g_array_index (gradient->stops, ColorStop, i);
|
||||
|
||||
/* if color resolving fails, assume transparency */
|
||||
val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (stop->color),
|
||||
provider,
|
||||
_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
&stop_deps);
|
||||
val = _gtk_symbolic_color_resolve_full (stop->color,
|
||||
provider,
|
||||
_gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
&stop_deps);
|
||||
if (val)
|
||||
{
|
||||
rgba = *_gtk_css_rgba_value_get_rgba (val);
|
||||
@@ -392,8 +372,6 @@ append_number (GString *str,
|
||||
* for using in GTK CSS files.
|
||||
*
|
||||
* Returns: A string representation for @gradient
|
||||
*
|
||||
* Deprecated: 3.8: #GtkGradient is deprecated.
|
||||
**/
|
||||
char *
|
||||
gtk_gradient_to_string (GtkGradient *gradient)
|
||||
@@ -540,9 +518,11 @@ _gtk_gradient_transition (GtkGradient *start,
|
||||
end_stop = &g_array_index (end->stops, ColorStop, i);
|
||||
|
||||
offset = (1 - progress) * start_stop->offset + progress * end_stop->offset;
|
||||
color = gtk_symbolic_color_new_mix (start_stop->color,
|
||||
end_stop->color,
|
||||
progress);
|
||||
color = (GtkSymbolicColor *) _gtk_css_value_transition ((GtkCssValue *) start_stop->color,
|
||||
(GtkCssValue *) end_stop->color,
|
||||
property_id,
|
||||
progress);
|
||||
g_assert (color);
|
||||
gtk_gradient_add_color_stop (gradient, offset, color);
|
||||
gtk_symbolic_color_unref (color);
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkstylecontext.h>
|
||||
#include <gtk/gtkstyleproperties.h>
|
||||
#include <gtk/deprecated/gtksymboliccolor.h>
|
||||
#include <gtk/gtksymboliccolor.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -33,12 +33,10 @@ G_BEGIN_DECLS
|
||||
|
||||
GType gtk_gradient_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkGradient * gtk_gradient_new_linear (gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble x1,
|
||||
gdouble y1);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkGradient * gtk_gradient_new_radial (gdouble x0,
|
||||
gdouble y0,
|
||||
gdouble radius0,
|
||||
@@ -46,27 +44,21 @@ GtkGradient * gtk_gradient_new_radial (gdouble x0,
|
||||
gdouble y1,
|
||||
gdouble radius1);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_gradient_add_color_stop (GtkGradient *gradient,
|
||||
gdouble offset,
|
||||
GtkSymbolicColor *color);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkGradient * gtk_gradient_ref (GtkGradient *gradient);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_gradient_unref (GtkGradient *gradient);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
gboolean gtk_gradient_resolve (GtkGradient *gradient,
|
||||
GtkStyleProperties *props,
|
||||
cairo_pattern_t **resolved_gradient);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
cairo_pattern_t *
|
||||
gtk_gradient_resolve_for_context
|
||||
(GtkGradient *gradient,
|
||||
GtkStyleContext *context);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
char * gtk_gradient_to_string (GtkGradient *gradient);
|
||||
|
||||
G_END_DECLS
|
||||
@@ -183,21 +183,3 @@ _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_hsla_shade (GtkHSLA *dest,
|
||||
const GtkHSLA *src,
|
||||
double factor)
|
||||
{
|
||||
g_return_if_fail (dest != NULL);
|
||||
g_return_if_fail (src != NULL);
|
||||
|
||||
dest->hue = src->hue;
|
||||
|
||||
dest->lightness = src->lightness * factor;
|
||||
dest->lightness = CLAMP (dest->lightness, 0.0, 1.0);
|
||||
|
||||
dest->saturation = src->saturation * factor;
|
||||
dest->saturation = CLAMP (dest->saturation, 0.0, 1.0);
|
||||
|
||||
dest->alpha = src->alpha;
|
||||
}
|
||||
|
||||
@@ -42,10 +42,6 @@ void _gtk_hsla_init_from_rgba (GtkHSLA *hsla,
|
||||
void _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
|
||||
const GtkHSLA *hsla);
|
||||
|
||||
void _gtk_hsla_shade (GtkHSLA *dest,
|
||||
const GtkHSLA *src,
|
||||
double factor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_HSLA_PRIVATE_H__ */
|
||||
|
||||
+100
-501
@@ -24,7 +24,6 @@
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
@@ -161,18 +160,9 @@ typedef enum
|
||||
HAS_ICON_FILE = 1 << 3
|
||||
} IconSuffix;
|
||||
|
||||
#define INFO_CACHE_LRU_SIZE 32
|
||||
#if 0
|
||||
#define DEBUG_CACHE(args) g_print args
|
||||
#else
|
||||
#define DEBUG_CACHE(args)
|
||||
#endif
|
||||
|
||||
struct _GtkIconThemePrivate
|
||||
{
|
||||
GHashTable *info_cache;
|
||||
GList *info_cache_lru;
|
||||
|
||||
gchar *current_theme;
|
||||
gchar *fallback_theme;
|
||||
gchar **search_path;
|
||||
@@ -207,31 +197,10 @@ struct _GtkIconThemePrivate
|
||||
gulong reset_styles_idle;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
gchar **icon_names;
|
||||
gint size;
|
||||
GtkIconLookupFlags flags;
|
||||
} IconInfoKey;
|
||||
|
||||
typedef struct _SymbolicPixbufCache SymbolicPixbufCache;
|
||||
|
||||
struct _SymbolicPixbufCache {
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *proxy_pixbuf;
|
||||
GdkRGBA fg;
|
||||
GdkRGBA success_color;
|
||||
GdkRGBA warning_color;
|
||||
GdkRGBA error_color;
|
||||
SymbolicPixbufCache *next;
|
||||
};
|
||||
|
||||
struct _GtkIconInfo
|
||||
{
|
||||
/* Information about the source
|
||||
*/
|
||||
IconInfoKey key;
|
||||
GtkIconTheme *in_cache;
|
||||
|
||||
gchar *filename;
|
||||
GFile *icon_file;
|
||||
GLoadableIcon *loadable;
|
||||
@@ -262,12 +231,9 @@ struct _GtkIconInfo
|
||||
* the icon.
|
||||
*/
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *proxy_pixbuf;
|
||||
GError *load_error;
|
||||
gdouble scale;
|
||||
|
||||
SymbolicPixbufCache *symbolic_pixbuf_cache;
|
||||
|
||||
GtkRequisition *symbolic_pixbuf_size;
|
||||
};
|
||||
|
||||
@@ -364,8 +330,6 @@ static BuiltinIcon *find_builtin_icon (const gchar *icon_name,
|
||||
gint size,
|
||||
gint *min_difference_p,
|
||||
gboolean *has_larger_p);
|
||||
static void remove_from_lru_cache (GtkIconTheme *icon_theme,
|
||||
GtkIconInfo *icon_info);
|
||||
|
||||
static guint signal_changed = 0;
|
||||
|
||||
@@ -375,46 +339,6 @@ static GHashTable *icon_theme_builtin_icons;
|
||||
GtkIconCache *_builtin_cache = NULL;
|
||||
static GList *builtin_dirs = NULL;
|
||||
|
||||
static guint
|
||||
icon_info_key_hash (gconstpointer _key)
|
||||
{
|
||||
const IconInfoKey *key = _key;
|
||||
guint h = 0;
|
||||
int i;
|
||||
for (i = 0; key->icon_names[i] != NULL; i++)
|
||||
h ^= g_str_hash (key->icon_names[i]);
|
||||
|
||||
h ^= key->size * 0x10001;
|
||||
h ^= key->flags * 0x1000010;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
icon_info_key_equal (gconstpointer _a,
|
||||
gconstpointer _b)
|
||||
{
|
||||
const IconInfoKey *a = _a;
|
||||
const IconInfoKey *b = _b;
|
||||
int i;
|
||||
|
||||
if (a->size != b->size)
|
||||
return FALSE;
|
||||
|
||||
if (a->flags != b->flags)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0;
|
||||
a->icon_names[i] != NULL &&
|
||||
b->icon_names[i] != NULL; i++)
|
||||
{
|
||||
if (strcmp (a->icon_names[i], b->icon_names[i]) != 0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return a->icon_names[i] == NULL && b->icon_names[i] == NULL;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE (GtkIconTheme, gtk_icon_theme, G_TYPE_OBJECT)
|
||||
|
||||
/**
|
||||
@@ -717,25 +641,6 @@ pixbuf_supports_svg (void)
|
||||
return found_svg;
|
||||
}
|
||||
|
||||
/* The icon info was removed from the icon_info_hash hash table */
|
||||
static void
|
||||
icon_info_uncached (GtkIconInfo *icon_info)
|
||||
{
|
||||
GtkIconTheme *icon_theme = icon_info->in_cache;
|
||||
|
||||
DEBUG_CACHE (("removing %p (%s %d 0x%x) from cache (icon_them: %p) (cache size %d)\n",
|
||||
icon_info,
|
||||
g_strjoinv (",", icon_info->key.icon_names),
|
||||
icon_info->key.size, icon_info->key.flags,
|
||||
icon_theme,
|
||||
icon_theme != NULL ? g_hash_table_size (icon_theme->priv->info_cache) : 0));
|
||||
|
||||
icon_info->in_cache = NULL;
|
||||
|
||||
if (icon_theme != NULL)
|
||||
remove_from_lru_cache (icon_theme, icon_info);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_icon_theme_init (GtkIconTheme *icon_theme)
|
||||
{
|
||||
@@ -748,9 +653,6 @@ gtk_icon_theme_init (GtkIconTheme *icon_theme)
|
||||
GtkIconThemePrivate);
|
||||
icon_theme->priv = priv;
|
||||
|
||||
priv->info_cache = g_hash_table_new_full (icon_info_key_hash, icon_info_key_equal, NULL,
|
||||
(GDestroyNotify)icon_info_uncached);
|
||||
|
||||
priv->custom_theme = FALSE;
|
||||
|
||||
xdg_data_dirs = g_get_system_data_dirs ();
|
||||
@@ -810,8 +712,6 @@ do_theme_change (GtkIconTheme *icon_theme)
|
||||
{
|
||||
GtkIconThemePrivate *priv = icon_theme->priv;
|
||||
|
||||
g_hash_table_remove_all (priv->info_cache);
|
||||
|
||||
if (!priv->themes_valid)
|
||||
return;
|
||||
|
||||
@@ -855,9 +755,6 @@ gtk_icon_theme_finalize (GObject *object)
|
||||
icon_theme = GTK_ICON_THEME (object);
|
||||
priv = icon_theme->priv;
|
||||
|
||||
g_hash_table_destroy (priv->info_cache);
|
||||
g_assert (priv->info_cache_lru == NULL);
|
||||
|
||||
if (priv->reset_styles_idle)
|
||||
{
|
||||
g_source_remove (priv->reset_styles_idle);
|
||||
@@ -1409,173 +1306,6 @@ ensure_valid_themes (GtkIconTheme *icon_theme)
|
||||
priv->loading_themes = FALSE;
|
||||
}
|
||||
|
||||
/* The LRU cache is a short list of IconInfos that are kept
|
||||
alive even though their IconInfo would otherwise have
|
||||
been freed, so that we can avoid reloading these
|
||||
constantly.
|
||||
We put infos on the lru list when nothing otherwise
|
||||
references the info. So, when we get a cache hit
|
||||
we remove it from the list, and when the proxy
|
||||
pixmap is released we put it on the list.
|
||||
*/
|
||||
|
||||
static void
|
||||
ensure_lru_cache_space (GtkIconTheme *icon_theme)
|
||||
{
|
||||
GtkIconThemePrivate *priv = icon_theme->priv;
|
||||
GList *l;
|
||||
|
||||
/* Remove last item if LRU full */
|
||||
l = g_list_nth (priv->info_cache_lru, INFO_CACHE_LRU_SIZE - 1);
|
||||
if (l)
|
||||
{
|
||||
GtkIconInfo *icon_info = l->data;
|
||||
|
||||
DEBUG_CACHE (("removing (due to out of space) %p (%s %d 0x%x) from LRU cache (cache size %d)\n",
|
||||
icon_info,
|
||||
g_strjoinv (",", icon_info->key.icon_names),
|
||||
icon_info->key.size, icon_info->key.flags,
|
||||
g_list_length (priv->info_cache_lru)));
|
||||
|
||||
priv->info_cache_lru = g_list_delete_link (priv->info_cache_lru, l);
|
||||
gtk_icon_info_free (icon_info);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_to_lru_cache (GtkIconTheme *icon_theme,
|
||||
GtkIconInfo *icon_info)
|
||||
{
|
||||
GtkIconThemePrivate *priv = icon_theme->priv;
|
||||
|
||||
DEBUG_CACHE (("adding %p (%s %d 0x%x) to LRU cache (cache size %d)\n",
|
||||
icon_info,
|
||||
g_strjoinv (",", icon_info->key.icon_names),
|
||||
icon_info->key.size, icon_info->key.flags,
|
||||
g_list_length (priv->info_cache_lru)));
|
||||
|
||||
g_assert (g_list_find (priv->info_cache_lru, icon_info) == NULL);
|
||||
|
||||
ensure_lru_cache_space (icon_theme);
|
||||
/* prepend new info to LRU */
|
||||
priv->info_cache_lru = g_list_prepend (priv->info_cache_lru,
|
||||
gtk_icon_info_copy (icon_info));
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_in_lru_cache (GtkIconTheme *icon_theme,
|
||||
GtkIconInfo *icon_info)
|
||||
{
|
||||
GtkIconThemePrivate *priv = icon_theme->priv;
|
||||
GList *l;
|
||||
|
||||
l = g_list_find (priv->info_cache_lru, icon_info);
|
||||
if (l)
|
||||
{
|
||||
/* Move to front of LRU if already in it */
|
||||
priv->info_cache_lru = g_list_remove_link (priv->info_cache_lru, l);
|
||||
priv->info_cache_lru = g_list_concat (l, priv->info_cache_lru);
|
||||
}
|
||||
else
|
||||
add_to_lru_cache (icon_theme, icon_info);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_from_lru_cache (GtkIconTheme *icon_theme,
|
||||
GtkIconInfo *icon_info)
|
||||
{
|
||||
GtkIconThemePrivate *priv = icon_theme->priv;
|
||||
if (g_list_find (priv->info_cache_lru, icon_info))
|
||||
{
|
||||
DEBUG_CACHE (("removing %p (%s %d 0x%x) from LRU cache (cache size %d)\n",
|
||||
icon_info,
|
||||
g_strjoinv (",", icon_info->key.icon_names),
|
||||
icon_info->key.size, icon_info->key.flags,
|
||||
g_list_length (priv->info_cache_lru)));
|
||||
|
||||
priv->info_cache_lru = g_list_remove (priv->info_cache_lru, icon_info);
|
||||
gtk_icon_info_free (icon_info);
|
||||
}
|
||||
}
|
||||
|
||||
static SymbolicPixbufCache *
|
||||
symbolic_pixbuf_cache_new (GdkPixbuf *pixbuf,
|
||||
const GdkRGBA *fg,
|
||||
const GdkRGBA *success_color,
|
||||
const GdkRGBA *warning_color,
|
||||
const GdkRGBA *error_color,
|
||||
SymbolicPixbufCache *next)
|
||||
{
|
||||
SymbolicPixbufCache *cache;
|
||||
|
||||
cache = g_new0 (SymbolicPixbufCache, 1);
|
||||
cache->pixbuf = g_object_ref (pixbuf);
|
||||
if (fg)
|
||||
cache->fg = *fg;
|
||||
if (success_color)
|
||||
cache->success_color = *success_color;
|
||||
if (warning_color)
|
||||
cache->warning_color = *warning_color;
|
||||
if (error_color)
|
||||
cache->error_color = *error_color;
|
||||
cache->next = next;
|
||||
return cache;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
rgba_matches (const GdkRGBA *a, const GdkRGBA *b)
|
||||
{
|
||||
GdkRGBA transparent = { 0 };
|
||||
|
||||
/* For matching we treat unset colors as transparent rather
|
||||
than default, which works as well, because transparent
|
||||
will never be used for real symbolic icon colors */
|
||||
if (a == NULL)
|
||||
a = &transparent;
|
||||
|
||||
return
|
||||
fabs(a->red - b->red) < 0.0001 &&
|
||||
fabs(a->green - b->green) < 0.0001 &&
|
||||
fabs(a->blue - b->blue) < 0.0001 &&
|
||||
fabs(a->alpha - b->alpha) < 0.0001;
|
||||
}
|
||||
|
||||
static SymbolicPixbufCache *
|
||||
symbolic_pixbuf_cache_matches (SymbolicPixbufCache *cache,
|
||||
const GdkRGBA *fg,
|
||||
const GdkRGBA *success_color,
|
||||
const GdkRGBA *warning_color,
|
||||
const GdkRGBA *error_color)
|
||||
{
|
||||
while (cache != NULL)
|
||||
{
|
||||
if (rgba_matches (fg, &cache->fg) &&
|
||||
rgba_matches (success_color, &cache->success_color) &&
|
||||
rgba_matches (warning_color, &cache->warning_color) &&
|
||||
rgba_matches (error_color, &cache->error_color))
|
||||
return cache;
|
||||
|
||||
cache = cache->next;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
symbolic_pixbuf_cache_free (SymbolicPixbufCache *cache)
|
||||
{
|
||||
SymbolicPixbufCache *next;
|
||||
|
||||
while (cache != NULL)
|
||||
{
|
||||
next = cache->next;
|
||||
g_object_unref (cache->pixbuf);
|
||||
g_free (cache);
|
||||
|
||||
cache = next;
|
||||
}
|
||||
}
|
||||
|
||||
static GtkIconInfo *
|
||||
choose_icon (GtkIconTheme *icon_theme,
|
||||
const gchar *icon_names[],
|
||||
@@ -1589,31 +1319,9 @@ choose_icon (GtkIconTheme *icon_theme,
|
||||
gboolean allow_svg;
|
||||
gboolean use_builtin;
|
||||
gint i;
|
||||
IconInfoKey key;
|
||||
|
||||
priv = icon_theme->priv;
|
||||
|
||||
ensure_valid_themes (icon_theme);
|
||||
|
||||
key.icon_names = (char **)icon_names;
|
||||
key.size = size;
|
||||
key.flags = flags;
|
||||
|
||||
icon_info = g_hash_table_lookup (priv->info_cache, &key);
|
||||
if (icon_info != NULL)
|
||||
{
|
||||
DEBUG_CACHE (("cache hit %p (%s %d 0x%x) (cache size %d)\n",
|
||||
icon_info,
|
||||
g_strjoinv (",", icon_info->key.icon_names),
|
||||
icon_info->key.size, icon_info->key.flags,
|
||||
g_hash_table_size (priv->info_cache)));
|
||||
|
||||
icon_info = gtk_icon_info_copy (icon_info);
|
||||
remove_from_lru_cache (icon_theme, icon_info);
|
||||
|
||||
return icon_info;
|
||||
}
|
||||
|
||||
if (flags & GTK_ICON_LOOKUP_NO_SVG)
|
||||
allow_svg = FALSE;
|
||||
else if (flags & GTK_ICON_LOOKUP_FORCE_SVG)
|
||||
@@ -1622,6 +1330,8 @@ choose_icon (GtkIconTheme *icon_theme,
|
||||
allow_svg = priv->pixbuf_supports_svg;
|
||||
|
||||
use_builtin = flags & GTK_ICON_LOOKUP_USE_BUILTIN;
|
||||
|
||||
ensure_valid_themes (icon_theme);
|
||||
|
||||
/* for symbolic icons, do a search in all registered themes first;
|
||||
* a theme that inherits them from a parent theme might provide
|
||||
@@ -1707,21 +1417,10 @@ choose_icon (GtkIconTheme *icon_theme,
|
||||
}
|
||||
|
||||
out:
|
||||
if (icon_info)
|
||||
if (icon_info)
|
||||
{
|
||||
icon_info->desired_size = size;
|
||||
icon_info->forced_size = (flags & GTK_ICON_LOOKUP_FORCE_SIZE) != 0;
|
||||
|
||||
icon_info->key.icon_names = g_strdupv ((char **)icon_names);
|
||||
icon_info->key.size = size;
|
||||
icon_info->key.flags = flags;
|
||||
icon_info->in_cache = icon_theme;
|
||||
DEBUG_CACHE (("adding %p (%s %d 0x%x) to cache (cache size %d)\n",
|
||||
icon_info,
|
||||
g_strjoinv (",", icon_info->key.icon_names),
|
||||
icon_info->key.size, icon_info->key.flags,
|
||||
g_hash_table_size (priv->info_cache)));
|
||||
g_hash_table_insert (priv->info_cache, &icon_info->key, icon_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3036,12 +2735,7 @@ gtk_icon_info_free (GtkIconInfo *icon_info)
|
||||
icon_info->ref_count--;
|
||||
if (icon_info->ref_count > 0)
|
||||
return;
|
||||
|
||||
if (icon_info->in_cache)
|
||||
g_hash_table_remove (icon_info->in_cache->priv->info_cache, &icon_info->key);
|
||||
|
||||
g_strfreev (icon_info->key.icon_names);
|
||||
|
||||
|
||||
g_free (icon_info->filename);
|
||||
g_clear_object (&icon_info->icon_file);
|
||||
|
||||
@@ -3055,8 +2749,6 @@ gtk_icon_info_free (GtkIconInfo *icon_info)
|
||||
if (icon_info->symbolic_pixbuf_size)
|
||||
gtk_requisition_free (icon_info->symbolic_pixbuf_size);
|
||||
|
||||
symbolic_pixbuf_cache_free (icon_info->symbolic_pixbuf_cache);
|
||||
|
||||
g_slice_free (GtkIconInfo, icon_info);
|
||||
}
|
||||
|
||||
@@ -3403,22 +3095,6 @@ icon_info_ensure_scale_and_pixbuf (GtkIconInfo *icon_info,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
proxy_pixbuf_destroy (guchar *pixels, gpointer data)
|
||||
{
|
||||
GtkIconInfo *icon_info = data;
|
||||
GtkIconTheme *icon_theme = icon_info->in_cache;
|
||||
|
||||
g_assert (icon_info->proxy_pixbuf != NULL);
|
||||
icon_info->proxy_pixbuf = NULL;
|
||||
|
||||
/* Keep it alive a bit longer */
|
||||
if (icon_theme != NULL)
|
||||
ensure_in_lru_cache (icon_theme, icon_info);
|
||||
|
||||
gtk_icon_info_free (icon_info);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_icon_info_load_icon:
|
||||
* @icon_info: a #GtkIconInfo structure from gtk_icon_theme_lookup_icon()
|
||||
@@ -3464,28 +3140,7 @@ gtk_icon_info_load_icon (GtkIconInfo *icon_info,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Instead of returning the pixbuf directly we
|
||||
return a proxy to it that we don't own (but that
|
||||
shares the data with the one we own). This way
|
||||
we can know when it is freed and ensure the
|
||||
IconInfo is alive (and thus cached) while
|
||||
the pixbuf is still alive. */
|
||||
|
||||
if (icon_info->proxy_pixbuf != NULL)
|
||||
return g_object_ref (icon_info->proxy_pixbuf);
|
||||
|
||||
icon_info->proxy_pixbuf =
|
||||
gdk_pixbuf_new_from_data (gdk_pixbuf_get_pixels (icon_info->pixbuf),
|
||||
gdk_pixbuf_get_colorspace (icon_info->pixbuf),
|
||||
gdk_pixbuf_get_has_alpha (icon_info->pixbuf),
|
||||
gdk_pixbuf_get_bits_per_sample (icon_info->pixbuf),
|
||||
gdk_pixbuf_get_width (icon_info->pixbuf),
|
||||
gdk_pixbuf_get_height (icon_info->pixbuf),
|
||||
gdk_pixbuf_get_rowstride (icon_info->pixbuf),
|
||||
proxy_pixbuf_destroy,
|
||||
gtk_icon_info_copy (icon_info));
|
||||
|
||||
return icon_info->proxy_pixbuf;
|
||||
return g_object_ref (icon_info->pixbuf);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
@@ -3507,109 +3162,40 @@ gdk_rgba_to_css (const GdkRGBA *color)
|
||||
(gint)(color->blue * 255));
|
||||
}
|
||||
|
||||
static void
|
||||
proxy_symbolic_pixbuf_destroy (guchar *pixels, gpointer data)
|
||||
{
|
||||
GtkIconInfo *icon_info = data;
|
||||
GtkIconTheme *icon_theme = icon_info->in_cache;
|
||||
SymbolicPixbufCache *symbolic_cache;
|
||||
|
||||
for (symbolic_cache = icon_info->symbolic_pixbuf_cache;
|
||||
symbolic_cache != NULL;
|
||||
symbolic_cache = symbolic_cache->next)
|
||||
{
|
||||
if (symbolic_cache->proxy_pixbuf != NULL &&
|
||||
gdk_pixbuf_get_pixels (symbolic_cache->proxy_pixbuf) == pixels)
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (symbolic_cache != NULL);
|
||||
g_assert (symbolic_cache->proxy_pixbuf != NULL);
|
||||
|
||||
symbolic_cache->proxy_pixbuf = NULL;
|
||||
|
||||
/* Keep it alive a bit longer */
|
||||
if (icon_theme != NULL)
|
||||
ensure_in_lru_cache (icon_theme, icon_info);
|
||||
|
||||
gtk_icon_info_free (icon_info);
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
symbolic_cache_get_proxy (SymbolicPixbufCache *symbolic_cache,
|
||||
GtkIconInfo *icon_info)
|
||||
{
|
||||
if (symbolic_cache->proxy_pixbuf)
|
||||
return g_object_ref (symbolic_cache->proxy_pixbuf);
|
||||
|
||||
symbolic_cache->proxy_pixbuf =
|
||||
gdk_pixbuf_new_from_data (gdk_pixbuf_get_pixels (symbolic_cache->pixbuf),
|
||||
gdk_pixbuf_get_colorspace (symbolic_cache->pixbuf),
|
||||
gdk_pixbuf_get_has_alpha (symbolic_cache->pixbuf),
|
||||
gdk_pixbuf_get_bits_per_sample (symbolic_cache->pixbuf),
|
||||
gdk_pixbuf_get_width (symbolic_cache->pixbuf),
|
||||
gdk_pixbuf_get_height (symbolic_cache->pixbuf),
|
||||
gdk_pixbuf_get_rowstride (symbolic_cache->pixbuf),
|
||||
proxy_symbolic_pixbuf_destroy,
|
||||
gtk_icon_info_copy (icon_info));
|
||||
|
||||
return symbolic_cache->proxy_pixbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
_gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
|
||||
const GdkRGBA *fg,
|
||||
const GdkRGBA *success_color,
|
||||
const GdkRGBA *warning_color,
|
||||
const GdkRGBA *error_color,
|
||||
const gchar *css_fg,
|
||||
const gchar *css_success,
|
||||
const gchar *css_warning,
|
||||
const gchar *css_error,
|
||||
GError **error)
|
||||
{
|
||||
GInputStream *stream;
|
||||
GdkPixbuf *pixbuf;
|
||||
gchar *css_fg;
|
||||
gchar *css_success;
|
||||
gchar *css_warning;
|
||||
gchar *css_error;
|
||||
gchar *data;
|
||||
gchar *success, *warning, *err;
|
||||
gchar *width, *height, *uri;
|
||||
SymbolicPixbufCache *symbolic_cache;
|
||||
|
||||
symbolic_cache = symbolic_pixbuf_cache_matches (icon_info->symbolic_pixbuf_cache,
|
||||
fg, success_color, warning_color, error_color);
|
||||
if (symbolic_cache)
|
||||
return symbolic_cache_get_proxy (symbolic_cache, icon_info);
|
||||
|
||||
/* css_fg can't possibly have failed, otherwise
|
||||
* that would mean we have a broken style */
|
||||
g_return_val_if_fail (fg != NULL, NULL);
|
||||
g_return_val_if_fail (css_fg != NULL, NULL);
|
||||
|
||||
css_fg = gdk_rgba_to_css (fg);
|
||||
|
||||
css_success = css_warning = css_error = NULL;
|
||||
|
||||
if (warning_color)
|
||||
css_warning = gdk_rgba_to_css (warning_color);
|
||||
|
||||
if (error_color)
|
||||
css_error = gdk_rgba_to_css (error_color);
|
||||
|
||||
if (success_color)
|
||||
css_success = gdk_rgba_to_css (success_color);
|
||||
success = warning = err = NULL;
|
||||
|
||||
if (!css_success)
|
||||
{
|
||||
GdkColor success_default_color = { 0, 0x4e00, 0x9a00, 0x0600 };
|
||||
css_success = gdk_color_to_css (&success_default_color);
|
||||
success = gdk_color_to_css (&success_default_color);
|
||||
}
|
||||
if (!css_warning)
|
||||
{
|
||||
GdkColor warning_default_color = { 0, 0xf500, 0x7900, 0x3e00 };
|
||||
css_warning = gdk_color_to_css (&warning_default_color);
|
||||
warning = gdk_color_to_css (&warning_default_color);
|
||||
}
|
||||
if (!css_error)
|
||||
{
|
||||
GdkColor error_default_color = { 0, 0xcc00, 0x0000, 0x0000 };
|
||||
css_error = gdk_color_to_css (&error_default_color);
|
||||
err = gdk_color_to_css (&error_default_color);
|
||||
}
|
||||
|
||||
if (!icon_info->symbolic_pixbuf_size)
|
||||
@@ -3647,22 +3233,21 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
|
||||
" fill: ", css_fg," !important;\n"
|
||||
" }\n"
|
||||
" .warning {\n"
|
||||
" fill: ", css_warning, " !important;\n"
|
||||
" fill: ", css_warning ? css_warning : warning," !important;\n"
|
||||
" }\n"
|
||||
" .error {\n"
|
||||
" fill: ", css_error ," !important;\n"
|
||||
" fill: ", css_error ? css_error : err," !important;\n"
|
||||
" }\n"
|
||||
" .success {\n"
|
||||
" fill: ", css_success, " !important;\n"
|
||||
" fill: ", css_success ? css_success : success," !important;\n"
|
||||
" }\n"
|
||||
" </style>\n"
|
||||
" <xi:include href=\"", uri, "\"/>\n"
|
||||
"</svg>",
|
||||
NULL);
|
||||
g_free (css_fg);
|
||||
g_free (css_warning);
|
||||
g_free (css_error);
|
||||
g_free (css_success);
|
||||
g_free (warning);
|
||||
g_free (err);
|
||||
g_free (success);
|
||||
g_free (width);
|
||||
g_free (height);
|
||||
g_free (uri);
|
||||
@@ -3676,16 +3261,7 @@ _gtk_icon_info_load_symbolic_internal (GtkIconInfo *icon_info,
|
||||
error);
|
||||
g_object_unref (stream);
|
||||
|
||||
if (pixbuf != NULL)
|
||||
{
|
||||
icon_info->symbolic_pixbuf_cache =
|
||||
symbolic_pixbuf_cache_new (pixbuf, fg, success_color, warning_color, error_color,
|
||||
icon_info->symbolic_pixbuf_cache);
|
||||
|
||||
return symbolic_cache_get_proxy (icon_info->symbolic_pixbuf_cache, icon_info);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3734,6 +3310,11 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
|
||||
gboolean *was_symbolic,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
gchar *css_fg;
|
||||
gchar *css_success;
|
||||
gchar *css_warning;
|
||||
gchar *css_error;
|
||||
gchar *icon_uri;
|
||||
gboolean is_symbolic;
|
||||
|
||||
@@ -3753,10 +3334,29 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
|
||||
if (!is_symbolic)
|
||||
return gtk_icon_info_load_icon (icon_info, error);
|
||||
|
||||
return _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
fg, success_color,
|
||||
warning_color, error_color,
|
||||
error);
|
||||
css_fg = gdk_rgba_to_css (fg);
|
||||
|
||||
css_success = css_warning = css_error = NULL;
|
||||
|
||||
if (warning_color)
|
||||
css_warning = gdk_rgba_to_css (warning_color);
|
||||
|
||||
if (error_color)
|
||||
css_error = gdk_rgba_to_css (error_color);
|
||||
|
||||
if (success_color)
|
||||
css_success = gdk_rgba_to_css (success_color);
|
||||
|
||||
pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
css_fg, css_success,
|
||||
css_warning, css_error,
|
||||
error);
|
||||
g_free (css_fg);
|
||||
g_free (css_warning);
|
||||
g_free (css_success);
|
||||
g_free (css_error);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3790,15 +3390,11 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
|
||||
gboolean *was_symbolic,
|
||||
GError **error)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkRGBA *color = NULL;
|
||||
GdkRGBA fg;
|
||||
GdkRGBA *fgp;
|
||||
GdkRGBA success_color;
|
||||
GdkRGBA *success_colorp;
|
||||
GdkRGBA warning_color;
|
||||
GdkRGBA *warning_colorp;
|
||||
GdkRGBA error_color;
|
||||
GdkRGBA *error_colorp;
|
||||
GdkRGBA rgba;
|
||||
gchar *css_fg = NULL, *css_success;
|
||||
gchar *css_warning, *css_error;
|
||||
GtkStateFlags state;
|
||||
gchar *icon_uri;
|
||||
gboolean is_symbolic;
|
||||
@@ -3819,40 +3415,36 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
|
||||
if (!is_symbolic)
|
||||
return gtk_icon_info_load_icon (icon_info, error);
|
||||
|
||||
fgp = success_colorp = warning_colorp = error_colorp = NULL;
|
||||
|
||||
state = gtk_style_context_get_state (context);
|
||||
gtk_style_context_get (context, state, "color", &color, NULL);
|
||||
if (color)
|
||||
{
|
||||
fg = *color;
|
||||
fgp = &fg;
|
||||
css_fg = gdk_rgba_to_css (color);
|
||||
gdk_rgba_free (color);
|
||||
}
|
||||
|
||||
if (gtk_style_context_lookup_color (context, "success_color", &success_color))
|
||||
success_colorp = &success_color;
|
||||
css_success = css_warning = css_error = NULL;
|
||||
|
||||
if (gtk_style_context_lookup_color (context, "warning_color", &warning_color))
|
||||
warning_colorp = &warning_color;
|
||||
if (gtk_style_context_lookup_color (context, "success_color", &rgba))
|
||||
css_success = gdk_rgba_to_css (&rgba);
|
||||
|
||||
if (gtk_style_context_lookup_color (context, "error_color", &error_color))
|
||||
error_colorp = &error_color;
|
||||
if (gtk_style_context_lookup_color (context, "warning_color", &rgba))
|
||||
css_warning = gdk_rgba_to_css (&rgba);
|
||||
|
||||
return _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
fgp, success_colorp,
|
||||
warning_colorp, error_colorp,
|
||||
error);
|
||||
}
|
||||
if (gtk_style_context_lookup_color (context, "error_color", &rgba))
|
||||
css_error = gdk_rgba_to_css (&rgba);
|
||||
|
||||
static GdkRGBA *
|
||||
color_to_rgba (GdkColor *color, GdkRGBA *rgba)
|
||||
{
|
||||
rgba->red = color->red / 65535.0;
|
||||
rgba->green = color->green / 65535.0;
|
||||
rgba->blue = color->blue / 65535.0;
|
||||
rgba->alpha = 1.0;
|
||||
return rgba;
|
||||
pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
css_fg, css_success,
|
||||
css_warning, css_error,
|
||||
error);
|
||||
|
||||
g_free (css_fg);
|
||||
g_free (css_success);
|
||||
g_free (css_warning);
|
||||
g_free (css_error);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3887,14 +3479,13 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
|
||||
gboolean *was_symbolic,
|
||||
GError **error)
|
||||
{
|
||||
GdkColor color;
|
||||
GdkRGBA fg;
|
||||
GdkRGBA success_color;
|
||||
GdkRGBA *success_colorp;
|
||||
GdkRGBA warning_color;
|
||||
GdkRGBA *warning_colorp;
|
||||
GdkRGBA error_color;
|
||||
GdkRGBA *error_colorp;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkColor success_color;
|
||||
GdkColor warning_color;
|
||||
GdkColor error_color;
|
||||
GdkColor *fg;
|
||||
gchar *css_fg, *css_success;
|
||||
gchar *css_warning, *css_error;
|
||||
gchar *icon_uri;
|
||||
gboolean is_symbolic;
|
||||
|
||||
@@ -3914,23 +3505,31 @@ gtk_icon_info_load_symbolic_for_style (GtkIconInfo *icon_info,
|
||||
if (!is_symbolic)
|
||||
return gtk_icon_info_load_icon (icon_info, error);
|
||||
|
||||
color_to_rgba (&style->fg[state], &fg);
|
||||
fg = &style->fg[state];
|
||||
css_fg = gdk_color_to_css (fg);
|
||||
|
||||
success_colorp = warning_colorp = error_colorp = NULL;
|
||||
css_success = css_warning = css_error = NULL;
|
||||
|
||||
if (gtk_style_lookup_color (style, "success_color", &color))
|
||||
success_colorp = color_to_rgba (&color, &success_color);
|
||||
if (gtk_style_lookup_color (style, "success_color", &success_color))
|
||||
css_success = gdk_color_to_css (&success_color);
|
||||
|
||||
if (gtk_style_lookup_color (style, "warning_color", &color))
|
||||
warning_colorp = color_to_rgba (&color, &warning_color);
|
||||
if (gtk_style_lookup_color (style, "warning_color", &warning_color))
|
||||
css_warning = gdk_color_to_css (&warning_color);
|
||||
|
||||
if (gtk_style_lookup_color (style, "error_color", &color))
|
||||
error_colorp = color_to_rgba (&color, &error_color);
|
||||
if (gtk_style_lookup_color (style, "error_color", &error_color))
|
||||
css_error = gdk_color_to_css (&error_color);
|
||||
|
||||
return _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
&fg, success_colorp,
|
||||
warning_colorp, error_colorp,
|
||||
error);
|
||||
pixbuf = _gtk_icon_info_load_symbolic_internal (icon_info,
|
||||
css_fg, css_success,
|
||||
css_warning, css_error,
|
||||
error);
|
||||
|
||||
g_free (css_fg);
|
||||
g_free (css_success);
|
||||
g_free (css_warning);
|
||||
g_free (css_error);
|
||||
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+12
-38
@@ -371,52 +371,26 @@ check_quartz_special_cases (GtkIMContextSimple *context_simple,
|
||||
gint n_compose)
|
||||
{
|
||||
GtkIMContextSimplePrivate *priv = context_simple->priv;
|
||||
guint value = 0;
|
||||
|
||||
if (n_compose == 2)
|
||||
if (n_compose == 2 &&
|
||||
priv->compose_buffer[1] == GDK_KEY_space)
|
||||
{
|
||||
gunichar value = 0;
|
||||
|
||||
switch (priv->compose_buffer[0])
|
||||
{
|
||||
case GDK_KEY_dead_doubleacute:
|
||||
switch (priv->compose_buffer[1])
|
||||
{
|
||||
case GDK_KEY_dead_doubleacute:
|
||||
case GDK_KEY_space:
|
||||
value = GDK_KEY_quotedbl; break;
|
||||
|
||||
case 'a': value = GDK_KEY_adiaeresis; break;
|
||||
case 'A': value = GDK_KEY_Adiaeresis; break;
|
||||
case 'e': value = GDK_KEY_ediaeresis; break;
|
||||
case 'E': value = GDK_KEY_Ediaeresis; break;
|
||||
case 'i': value = GDK_KEY_idiaeresis; break;
|
||||
case 'I': value = GDK_KEY_Idiaeresis; break;
|
||||
case 'o': value = GDK_KEY_odiaeresis; break;
|
||||
case 'O': value = GDK_KEY_Odiaeresis; break;
|
||||
case 'u': value = GDK_KEY_udiaeresis; break;
|
||||
case 'U': value = GDK_KEY_Udiaeresis; break;
|
||||
case 'y': value = GDK_KEY_ydiaeresis; break;
|
||||
case 'Y': value = GDK_KEY_Ydiaeresis; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_KEY_dead_acute:
|
||||
switch (priv->compose_buffer[1])
|
||||
{
|
||||
case 'c': value = GDK_KEY_ccedilla; break;
|
||||
case 'C': value = GDK_KEY_Ccedilla; break;
|
||||
}
|
||||
break;
|
||||
value = '"'; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (value > 0)
|
||||
{
|
||||
gtk_im_context_simple_commit_char (GTK_IM_CONTEXT (context_simple),
|
||||
gdk_keyval_to_unicode (value));
|
||||
priv->compose_buffer[0] = 0;
|
||||
if (value > 0)
|
||||
{
|
||||
gtk_im_context_simple_commit_char (GTK_IM_CONTEXT (context_simple), value);
|
||||
priv->compose_buffer[0] = 0;
|
||||
|
||||
GTK_NOTE (MISC, g_print ("quartz: U+%04X\n", value));
|
||||
return TRUE;
|
||||
GTK_NOTE (MISC, g_print ("quartz: U+%04X\n", value));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
||||
+1
-1
@@ -3384,7 +3384,7 @@ gtk_label_ensure_layout (GtkLabel *label)
|
||||
pango_attr_list_insert (attrs, attribute);
|
||||
}
|
||||
}
|
||||
else if (priv->markup_attrs || priv->attrs)
|
||||
else if (priv->markup_attrs && priv->markup_attrs)
|
||||
attrs = pango_attr_list_new ();
|
||||
else
|
||||
attrs = NULL;
|
||||
|
||||
+4
-6
@@ -2437,12 +2437,10 @@ list_store_start_element (GMarkupParseContext *context,
|
||||
else if (strcmp (element_name, "row") == 0)
|
||||
;
|
||||
else if (strcmp (element_name, "column") == 0)
|
||||
{
|
||||
for (i = 0; names[i]; i++)
|
||||
if (strcmp (names[i], "type") == 0)
|
||||
data->column_type_names = g_slist_prepend (data->column_type_names,
|
||||
g_strdup (values[i]));
|
||||
}
|
||||
for (i = 0; names[i]; i++)
|
||||
if (strcmp (names[i], "type") == 0)
|
||||
data->column_type_names = g_slist_prepend (data->column_type_names,
|
||||
g_strdup (values[i]));
|
||||
else if (strcmp (element_name, "columns") == 0)
|
||||
;
|
||||
else if (strcmp (element_name, "data") == 0)
|
||||
|
||||
+83
-56
@@ -641,6 +641,15 @@ gtk_menu_class_init (GtkMenuClass *class)
|
||||
-1, G_MAXINT, -1,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("vertical-padding",
|
||||
P_("Vertical Padding"),
|
||||
P_("Extra space at the top and bottom of the menu"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
1,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkMenu:reserve-toggle-size:
|
||||
*
|
||||
@@ -662,15 +671,6 @@ gtk_menu_class_init (GtkMenuClass *class)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/**
|
||||
* GtkMenu:horizontal-padding:
|
||||
*
|
||||
* Extra space at the left and right edges of the menu.
|
||||
*
|
||||
* Deprecated: 3.8: use the standard padding CSS property (through objects
|
||||
* like #GtkStyleContext and #GtkCssProvider); the value of this style
|
||||
* property is ignored.
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("horizontal-padding",
|
||||
P_("Horizontal Padding"),
|
||||
@@ -678,27 +678,7 @@ gtk_menu_class_init (GtkMenuClass *class)
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE |
|
||||
G_PARAM_DEPRECATED));
|
||||
|
||||
/**
|
||||
* GtkMenu:vertical-padding:
|
||||
*
|
||||
* Extra space at the top and bottom of the menu.
|
||||
*
|
||||
* Deprecated: 3.8: use the standard padding CSS property (through objects
|
||||
* like #GtkStyleContext and #GtkCssProvider); the value of this style
|
||||
* property is ignored.
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("vertical-padding",
|
||||
P_("Vertical Padding"),
|
||||
P_("Extra space at the top and bottom of the menu"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
1,
|
||||
GTK_PARAM_READABLE |
|
||||
G_PARAM_DEPRECATED));
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("vertical-offset",
|
||||
@@ -2530,6 +2510,8 @@ gtk_menu_realize (GtkWidget *widget)
|
||||
gint border_width;
|
||||
GtkWidget *child;
|
||||
GList *children;
|
||||
guint vertical_padding;
|
||||
guint horizontal_padding;
|
||||
GtkBorder arrow_border, padding;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU (widget));
|
||||
@@ -2560,14 +2542,19 @@ gtk_menu_realize (GtkWidget *widget)
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (menu),
|
||||
"vertical-padding", &vertical_padding,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
attributes.x = border_width + padding.left;
|
||||
attributes.y = border_width + padding.top;
|
||||
attributes.x = border_width + padding.left + horizontal_padding;
|
||||
attributes.y = border_width + padding.top + vertical_padding;
|
||||
attributes.width = allocation.width -
|
||||
(2 * border_width) - padding.left - padding.right;
|
||||
(2 * (border_width + horizontal_padding)) - padding.left - padding.right;
|
||||
attributes.height = allocation.height -
|
||||
(2 * border_width) - padding.top - padding.bottom;
|
||||
(2 * (border_width + vertical_padding)) - padding.top - padding.bottom;
|
||||
|
||||
get_arrows_border (menu, &arrow_border);
|
||||
attributes.y += arrow_border.top;
|
||||
@@ -2585,9 +2572,9 @@ gtk_menu_realize (GtkWidget *widget)
|
||||
|
||||
attributes.x = 0;
|
||||
attributes.y = 0;
|
||||
attributes.width = allocation.width + (2 * border_width) +
|
||||
attributes.width = allocation.width + (2 * (border_width + horizontal_padding)) +
|
||||
padding.left + padding.right;
|
||||
attributes.height = priv->requested_height - (2 * border_width) +
|
||||
attributes.height = priv->requested_height - (2 * (border_width + vertical_padding)) +
|
||||
padding.top + padding.bottom;
|
||||
|
||||
attributes.width = MAX (1, attributes.width);
|
||||
@@ -2703,6 +2690,7 @@ calculate_line_heights (GtkMenu *menu,
|
||||
GtkMenuShell *menu_shell;
|
||||
GtkWidget *child, *widget;
|
||||
GList *children;
|
||||
guint horizontal_padding;
|
||||
guint border_width;
|
||||
guint n_columns;
|
||||
gint n_heights;
|
||||
@@ -2720,10 +2708,13 @@ calculate_line_heights (GtkMenu *menu,
|
||||
n_columns = gtk_menu_get_n_columns (menu);
|
||||
avail_width = for_width - (2 * priv->toggle_size + priv->accel_size) * n_columns;
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (menu),
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
get_menu_padding (widget, &padding);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
avail_width -= (border_width) * 2 + padding.left + padding.right;
|
||||
avail_width -= (border_width + horizontal_padding) * 2 + padding.left + padding.right;
|
||||
|
||||
for (children = menu_shell->priv->children; children; children = children->next)
|
||||
{
|
||||
@@ -2779,6 +2770,8 @@ gtk_menu_size_allocate (GtkWidget *widget,
|
||||
gint x, y, i;
|
||||
gint width, height;
|
||||
guint border_width;
|
||||
guint vertical_padding;
|
||||
guint horizontal_padding;
|
||||
GtkBorder padding;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU (widget));
|
||||
@@ -2790,6 +2783,11 @@ gtk_menu_size_allocate (GtkWidget *widget,
|
||||
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (menu),
|
||||
"vertical-padding", &vertical_padding,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
get_menu_padding (widget, &padding);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
|
||||
@@ -2800,15 +2798,16 @@ gtk_menu_size_allocate (GtkWidget *widget,
|
||||
NULL);
|
||||
|
||||
/* refresh our cached height request */
|
||||
priv->requested_height = (2 * border_width) + padding.top + padding.bottom;
|
||||
priv->requested_height = (2 * (border_width + vertical_padding)) +
|
||||
padding.top + padding.bottom;
|
||||
for (i = 0; i < priv->heights_length; i++)
|
||||
priv->requested_height += priv->heights[i];
|
||||
|
||||
x = border_width + padding.left;
|
||||
y = border_width + padding.top;
|
||||
width = allocation->width - (2 * border_width) -
|
||||
x = border_width + padding.left + horizontal_padding;
|
||||
y = border_width + padding.top + vertical_padding;
|
||||
width = allocation->width - (2 * (border_width + horizontal_padding)) -
|
||||
padding.left - padding.right;
|
||||
height = allocation->height - (2 * border_width) -
|
||||
height = allocation->height - (2 * (border_width + vertical_padding)) -
|
||||
padding.top - padding.bottom;
|
||||
|
||||
if (menu_shell->priv->active)
|
||||
@@ -2938,18 +2937,22 @@ get_arrows_visible_area (GtkMenu *menu,
|
||||
GtkArrowPlacement arrow_placement;
|
||||
GtkWidget *widget = GTK_WIDGET (menu);
|
||||
guint border_width;
|
||||
guint vertical_padding;
|
||||
guint horizontal_padding;
|
||||
gint scroll_arrow_height;
|
||||
GtkBorder menu_padding;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"vertical-padding", &vertical_padding,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
"scroll-arrow-vlength", &scroll_arrow_height,
|
||||
"arrow-placement", &arrow_placement,
|
||||
NULL);
|
||||
|
||||
get_menu_padding (widget, &menu_padding);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
border->x = border_width + menu_padding.left;
|
||||
border->y = border_width + menu_padding.top;
|
||||
border->x = border_width + menu_padding.left + horizontal_padding;
|
||||
border->y = border_width + menu_padding.top + vertical_padding;
|
||||
border->width = gdk_window_get_width (gtk_widget_get_window (widget));
|
||||
border->height = gdk_window_get_height (gtk_widget_get_window (widget));
|
||||
|
||||
@@ -3134,6 +3137,7 @@ gtk_menu_get_preferred_width (GtkWidget *widget,
|
||||
GList *children;
|
||||
guint max_toggle_size;
|
||||
guint max_accel_width;
|
||||
guint horizontal_padding;
|
||||
guint border_width;
|
||||
gint child_min, child_nat;
|
||||
gint min_width, nat_width;
|
||||
@@ -3222,10 +3226,16 @@ gtk_menu_get_preferred_width (GtkWidget *widget,
|
||||
nat_width += 2 * max_toggle_size + max_accel_width;
|
||||
nat_width *= gtk_menu_get_n_columns (menu);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (menu),
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
get_menu_padding (widget, &padding);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
min_width += (2 * border_width) + padding.left + padding.right;
|
||||
nat_width += (2 * border_width) + padding.left + padding.right;
|
||||
min_width += (2 * (border_width + horizontal_padding)) +
|
||||
padding.left + padding.right;
|
||||
nat_width += (2 * (border_width + horizontal_padding)) +
|
||||
padding.left + padding.right;
|
||||
|
||||
priv->toggle_size = max_toggle_size;
|
||||
priv->accel_size = max_accel_width;
|
||||
@@ -3267,14 +3277,16 @@ gtk_menu_get_preferred_height_for_width (GtkWidget *widget,
|
||||
GtkMenu *menu = GTK_MENU (widget);
|
||||
GtkMenuPrivate *priv = menu->priv;
|
||||
guint *min_heights, *nat_heights;
|
||||
guint border_width;
|
||||
guint vertical_padding, border_width;
|
||||
gint n_heights, i;
|
||||
gint min_height, nat_height;
|
||||
|
||||
gtk_widget_style_get (widget, "vertical-padding", &vertical_padding, NULL);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
get_menu_padding (widget, &padding);
|
||||
|
||||
min_height = nat_height = (2 * border_width) + padding.top + padding.bottom;
|
||||
min_height = nat_height = (border_width + vertical_padding) * 2 +
|
||||
padding.top + padding.bottom;
|
||||
|
||||
n_heights =
|
||||
calculate_line_heights (menu, for_size, &min_heights, &nat_heights);
|
||||
@@ -3856,6 +3868,7 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
GdkWindow *window;
|
||||
gint width, height;
|
||||
guint border;
|
||||
guint vertical_padding;
|
||||
gint win_x, win_y;
|
||||
gint scroll_arrow_height;
|
||||
GtkBorder padding;
|
||||
@@ -3865,11 +3878,12 @@ get_arrows_sensitive_area (GtkMenu *menu,
|
||||
height = gdk_window_get_height (window);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"vertical-padding", &vertical_padding,
|
||||
"scroll-arrow-vlength", &scroll_arrow_height,
|
||||
"arrow-placement", &arrow_placement,
|
||||
NULL);
|
||||
|
||||
border = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
border = gtk_container_get_border_width (GTK_CONTAINER (menu)) + vertical_padding;
|
||||
get_menu_padding (widget, &padding);
|
||||
|
||||
gdk_window_get_position (window, &win_x, &win_y);
|
||||
@@ -4831,6 +4845,8 @@ gtk_menu_scroll_to (GtkMenu *menu,
|
||||
gint view_width, view_height;
|
||||
gint border_width;
|
||||
gint menu_height;
|
||||
guint vertical_padding;
|
||||
guint horizontal_padding;
|
||||
gboolean double_arrows;
|
||||
|
||||
widget = GTK_WIDGET (menu);
|
||||
@@ -4842,17 +4858,23 @@ gtk_menu_scroll_to (GtkMenu *menu,
|
||||
view_width = gtk_widget_get_allocated_width (widget);
|
||||
view_height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (menu),
|
||||
"vertical-padding", &vertical_padding,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
get_menu_padding (widget, &padding);
|
||||
double_arrows = get_double_arrows (menu);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu));
|
||||
|
||||
view_width -= (2 * border_width) + padding.left + padding.right;
|
||||
view_height -= (2 * border_width) + padding.top + padding.bottom;
|
||||
menu_height = priv->requested_height - (2 * border_width) - padding.top - padding.bottom;
|
||||
view_width -= (2 * (border_width + horizontal_padding)) + padding.left + padding.right;
|
||||
view_height -= (2 * (border_width + vertical_padding)) + padding.top + padding.bottom;
|
||||
menu_height = priv->requested_height - (2 * (border_width + vertical_padding)) -
|
||||
padding.top - padding.bottom;
|
||||
|
||||
x = border_width + padding.left;
|
||||
y = border_width + padding.top;
|
||||
x = border_width + padding.left + horizontal_padding;
|
||||
y = border_width + padding.top + vertical_padding;
|
||||
|
||||
if (double_arrows && !priv->tearoff_active)
|
||||
{
|
||||
@@ -5049,18 +5071,23 @@ gtk_menu_scroll_item_visible (GtkMenuShell *menu_shell,
|
||||
if (compute_child_offset (menu, menu_item,
|
||||
&child_offset, &child_height, &last_child))
|
||||
{
|
||||
guint vertical_padding;
|
||||
gboolean double_arrows;
|
||||
GtkBorder padding;
|
||||
|
||||
y = priv->scroll_offset;
|
||||
height = gdk_window_get_height (gtk_widget_get_window (widget));
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"vertical-padding", &vertical_padding,
|
||||
NULL);
|
||||
|
||||
double_arrows = get_double_arrows (menu);
|
||||
get_menu_padding (widget, &padding);
|
||||
|
||||
height -= 2 * gtk_container_get_border_width (GTK_CONTAINER (menu)) +
|
||||
padding.top + padding.bottom;
|
||||
|
||||
padding.top + padding.bottom +
|
||||
2 * vertical_padding;
|
||||
if (child_offset < y)
|
||||
{
|
||||
/* Ignore the enter event we might get if the pointer
|
||||
|
||||
+33
-48
@@ -51,6 +51,9 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
|
||||
#define BORDER_SPACING 0
|
||||
#define DEFAULT_IPADDING 1
|
||||
|
||||
/* Properties */
|
||||
enum {
|
||||
PROP_0,
|
||||
@@ -216,24 +219,14 @@ gtk_menu_bar_class_init (GtkMenuBarClass *class)
|
||||
GTK_SHADOW_OUT,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
/**
|
||||
* GtkMenuBar:internal-padding:
|
||||
*
|
||||
* Amount of border space between the menubar shadow and the menu items
|
||||
*
|
||||
* Deprecated: 3.8: use the standard padding CSS property (through objects
|
||||
* like #GtkStyleContext and #GtkCssProvider); the value of this style
|
||||
* property is ignored.
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("internal-padding",
|
||||
P_("Internal padding"),
|
||||
P_("Amount of border space between the menubar shadow and the menu items"),
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE |
|
||||
G_PARAM_DEPRECATED));
|
||||
DEFAULT_IPADDING,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (GtkMenuBarPrivate));
|
||||
}
|
||||
@@ -339,12 +332,10 @@ gtk_menu_bar_size_request (GtkWidget *widget,
|
||||
GtkMenuShell *menu_shell;
|
||||
GtkWidget *child;
|
||||
GList *children;
|
||||
gint ipadding;
|
||||
guint border_width;
|
||||
gboolean use_toggle_size, use_maximize;
|
||||
gint child_minimum, child_natural;
|
||||
GtkStyleContext *context;
|
||||
GtkBorder border;
|
||||
GtkStateFlags flags;
|
||||
|
||||
*minimum = 0;
|
||||
*natural = 0;
|
||||
@@ -400,28 +391,19 @@ gtk_menu_bar_size_request (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
flags = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, flags, &border);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
*minimum += border.left + border.right;
|
||||
*natural += border.left + border.right;
|
||||
}
|
||||
else
|
||||
{
|
||||
*minimum += border.top + border.bottom;
|
||||
*natural += border.top + border.bottom;
|
||||
}
|
||||
|
||||
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
|
||||
*minimum += border_width * 2;
|
||||
*natural += border_width * 2;
|
||||
*minimum += (border_width + ipadding + BORDER_SPACING) * 2;
|
||||
*natural += (border_width + ipadding + BORDER_SPACING) * 2;
|
||||
|
||||
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
|
||||
{
|
||||
gtk_style_context_get_border (context, flags, &border);
|
||||
GtkStyleContext *context;
|
||||
GtkBorder border;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_border (context, gtk_widget_get_state_flags (widget),
|
||||
&border);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
@@ -480,6 +462,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
|
||||
GtkWidget *child;
|
||||
GList *children;
|
||||
GtkAllocation remaining_space;
|
||||
gint ipadding;
|
||||
guint border_width;
|
||||
GArray *requested_sizes;
|
||||
gint toggle_size;
|
||||
@@ -501,26 +484,28 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
|
||||
|
||||
if (menu_shell->priv->children)
|
||||
{
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags flags;
|
||||
GtkBorder border;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
flags = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, flags, &border);
|
||||
|
||||
gtk_widget_style_get (widget, "internal-padding", &ipadding, NULL);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (menu_bar));
|
||||
|
||||
remaining_space.x = (border_width + border.left);
|
||||
remaining_space.y = (border_width + border.top);
|
||||
remaining_space.x = (border_width +
|
||||
ipadding +
|
||||
BORDER_SPACING);
|
||||
remaining_space.y = (border_width +
|
||||
ipadding +
|
||||
BORDER_SPACING);
|
||||
remaining_space.width = allocation->width -
|
||||
2 * (border_width) - border.left - border.right;
|
||||
2 * (border_width + ipadding + BORDER_SPACING);
|
||||
remaining_space.height = allocation->height -
|
||||
2 * (border_width) - border.top - border.bottom;
|
||||
|
||||
2 * (border_width + ipadding + BORDER_SPACING);
|
||||
|
||||
if (get_shadow_type (menu_bar) != GTK_SHADOW_NONE)
|
||||
{
|
||||
gtk_style_context_get_border (context, flags, &border);
|
||||
GtkStyleContext *context;
|
||||
GtkBorder border;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_get_border (context, gtk_widget_get_state_flags (widget),
|
||||
&border);
|
||||
|
||||
remaining_space.x += border.left;
|
||||
remaining_space.y += border.top;
|
||||
|
||||
+94
-20
@@ -464,24 +464,14 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
|
||||
GTK_PARAM_READABLE),
|
||||
gtk_rc_property_parse_enum);
|
||||
|
||||
/**
|
||||
* GtkMenuItem:horizontal-padding:
|
||||
*
|
||||
* Padding to left and right of the menu item.
|
||||
*
|
||||
* Deprecated: 3.8: use the standard padding CSS property (through objects
|
||||
* like #GtkStyleContext and #GtkCssProvider); the value of this style
|
||||
* property is ignored.
|
||||
*/
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("horizontal-padding",
|
||||
"Horizontal Padding",
|
||||
"Padding to left and right of the menu item",
|
||||
0,
|
||||
G_MAXINT,
|
||||
0,
|
||||
GTK_PARAM_READABLE |
|
||||
G_PARAM_DEPRECATED));
|
||||
3,
|
||||
GTK_PARAM_READABLE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("toggle-spacing",
|
||||
@@ -849,16 +839,35 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
|
||||
GtkWidget *child;
|
||||
GtkWidget *parent;
|
||||
guint accel_width;
|
||||
guint horizontal_padding;
|
||||
guint border_width;
|
||||
GtkPackDirection pack_dir;
|
||||
GtkPackDirection child_pack_dir;
|
||||
gint min_width, nat_width;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
|
||||
min_width = nat_width = 0;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
|
||||
if (GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
pack_dir = gtk_menu_bar_get_pack_direction (GTK_MENU_BAR (parent));
|
||||
child_pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
|
||||
}
|
||||
else
|
||||
{
|
||||
pack_dir = GTK_PACK_DIRECTION_LTR;
|
||||
child_pack_dir = GTK_PACK_DIRECTION_LTR;
|
||||
}
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
@@ -866,8 +875,13 @@ gtk_menu_item_get_preferred_width (GtkWidget *widget,
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
min_width = (border_width * 2) + padding.left + padding.right;
|
||||
nat_width = min_width;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_LTR || child_pack_dir == GTK_PACK_DIRECTION_RTL))
|
||||
min_width += 2 * horizontal_padding;
|
||||
|
||||
nat_width = min_width;
|
||||
|
||||
child = gtk_bin_get_child (bin);
|
||||
|
||||
if (child != NULL && gtk_widget_get_visible (child))
|
||||
@@ -922,7 +936,10 @@ gtk_menu_item_real_get_height (GtkWidget *widget,
|
||||
GtkWidget *child;
|
||||
GtkWidget *parent;
|
||||
guint accel_width;
|
||||
guint horizontal_padding;
|
||||
guint border_width;
|
||||
GtkPackDirection pack_dir;
|
||||
GtkPackDirection child_pack_dir;
|
||||
gint min_height, nat_height;
|
||||
gint avail_size = 0;
|
||||
|
||||
@@ -932,16 +949,39 @@ gtk_menu_item_real_get_height (GtkWidget *widget,
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
bin = GTK_BIN (widget);
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
|
||||
if (GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
pack_dir = gtk_menu_bar_get_pack_direction (GTK_MENU_BAR (parent));
|
||||
child_pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
|
||||
}
|
||||
else
|
||||
{
|
||||
pack_dir = GTK_PACK_DIRECTION_LTR;
|
||||
child_pack_dir = GTK_PACK_DIRECTION_LTR;
|
||||
}
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
min_height = (border_width * 2) + padding.top + padding.bottom;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_TTB || pack_dir == GTK_PACK_DIRECTION_BTT) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_TTB || child_pack_dir == GTK_PACK_DIRECTION_BTT))
|
||||
min_height += 2 * horizontal_padding;
|
||||
|
||||
if (for_size != -1)
|
||||
{
|
||||
avail_size = for_size;
|
||||
avail_size -= (border_width * 2) + padding.left + padding.right;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_LTR || child_pack_dir == GTK_PACK_DIRECTION_RTL))
|
||||
avail_size -= 2 * horizontal_padding;
|
||||
}
|
||||
|
||||
nat_height = min_height;
|
||||
@@ -1452,6 +1492,7 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
||||
GtkBin *bin;
|
||||
GtkAllocation child_allocation;
|
||||
GtkTextDirection direction;
|
||||
GtkPackDirection pack_dir;
|
||||
GtkPackDirection child_pack_dir;
|
||||
GtkWidget *child;
|
||||
GtkWidget *parent;
|
||||
@@ -1466,10 +1507,12 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
||||
parent = gtk_widget_get_parent (widget);
|
||||
if (GTK_IS_MENU_BAR (parent))
|
||||
{
|
||||
pack_dir = gtk_menu_bar_get_pack_direction (GTK_MENU_BAR (parent));
|
||||
child_pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (parent));
|
||||
}
|
||||
else
|
||||
{
|
||||
pack_dir = GTK_PACK_DIRECTION_LTR;
|
||||
child_pack_dir = GTK_PACK_DIRECTION_LTR;
|
||||
}
|
||||
|
||||
@@ -1481,12 +1524,17 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
guint horizontal_padding;
|
||||
guint border_width;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
state = gtk_widget_get_state_flags (widget);
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||
child_allocation.x = border_width + padding.left;
|
||||
child_allocation.y = border_width + padding.top;
|
||||
@@ -1496,6 +1544,19 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
|
||||
child_allocation.height = allocation->height - (border_width * 2) -
|
||||
padding.top - padding.bottom;
|
||||
|
||||
if ((pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_LTR || child_pack_dir == GTK_PACK_DIRECTION_RTL))
|
||||
{
|
||||
child_allocation.x += horizontal_padding;
|
||||
child_allocation.width -= 2 * horizontal_padding;
|
||||
}
|
||||
else if ((pack_dir == GTK_PACK_DIRECTION_TTB || pack_dir == GTK_PACK_DIRECTION_BTT) &&
|
||||
(child_pack_dir == GTK_PACK_DIRECTION_TTB || child_pack_dir == GTK_PACK_DIRECTION_BTT))
|
||||
{
|
||||
child_allocation.y += horizontal_padding;
|
||||
child_allocation.height -= 2 * horizontal_padding;
|
||||
}
|
||||
|
||||
if (child_pack_dir == GTK_PACK_DIRECTION_LTR ||
|
||||
child_pack_dir == GTK_PACK_DIRECTION_RTL)
|
||||
{
|
||||
@@ -1665,20 +1726,26 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
{
|
||||
gint arrow_x, arrow_y;
|
||||
gint arrow_size;
|
||||
guint horizontal_padding;
|
||||
GtkTextDirection direction;
|
||||
gdouble angle;
|
||||
|
||||
direction = gtk_widget_get_direction (widget);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
|
||||
get_arrow_size (widget, child, &arrow_size, NULL);
|
||||
|
||||
if (direction == GTK_TEXT_DIR_LTR)
|
||||
{
|
||||
arrow_x = x + w - arrow_size;
|
||||
arrow_x = x + w - horizontal_padding - arrow_size;
|
||||
angle = G_PI / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
arrow_x = x;
|
||||
arrow_x = x + horizontal_padding;
|
||||
angle = (3 * G_PI) / 2;
|
||||
}
|
||||
|
||||
@@ -1690,22 +1757,24 @@ gtk_menu_item_draw (GtkWidget *widget,
|
||||
{
|
||||
gboolean wide_separators;
|
||||
gint separator_height;
|
||||
guint horizontal_padding;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"wide-separators", &wide_separators,
|
||||
"separator-height", &separator_height,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
NULL);
|
||||
if (wide_separators)
|
||||
gtk_render_frame (context, cr,
|
||||
x + padding.left,
|
||||
x + horizontal_padding + padding.left,
|
||||
y + padding.top,
|
||||
w - padding.left - padding.right,
|
||||
w - (2 * horizontal_padding) - padding.left - padding.right,
|
||||
separator_height);
|
||||
else
|
||||
gtk_render_line (context, cr,
|
||||
x + padding.left,
|
||||
x + horizontal_padding + padding.left,
|
||||
y + padding.top,
|
||||
x + w - padding.right - 1,
|
||||
x + w - horizontal_padding - padding.right - 1,
|
||||
y + padding.top);
|
||||
}
|
||||
|
||||
@@ -2056,6 +2125,8 @@ get_offsets (GtkMenu *menu,
|
||||
gint *horizontal_offset,
|
||||
gint *vertical_offset)
|
||||
{
|
||||
gint vertical_padding;
|
||||
gint horizontal_padding;
|
||||
GtkStyleContext *context;
|
||||
GtkStateFlags state;
|
||||
GtkBorder padding;
|
||||
@@ -2063,6 +2134,8 @@ get_offsets (GtkMenu *menu,
|
||||
gtk_widget_style_get (GTK_WIDGET (menu),
|
||||
"horizontal-offset", horizontal_offset,
|
||||
"vertical-offset", vertical_offset,
|
||||
"horizontal-padding", &horizontal_padding,
|
||||
"vertical-padding", &vertical_padding,
|
||||
NULL);
|
||||
|
||||
context = gtk_widget_get_style_context (GTK_WIDGET (menu));
|
||||
@@ -2070,7 +2143,8 @@ get_offsets (GtkMenu *menu,
|
||||
gtk_style_context_get_padding (context, state, &padding);
|
||||
|
||||
*vertical_offset -= padding.top;
|
||||
*horizontal_offset += padding.left;
|
||||
*vertical_offset -= vertical_padding;
|
||||
*horizontal_offset += horizontal_padding;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+1
-1
@@ -1107,7 +1107,7 @@ gtk_menu_shell_leave_notify (GtkWidget *widget,
|
||||
GdkEventCrossing *event)
|
||||
{
|
||||
if (event->mode == GDK_CROSSING_GTK_GRAB ||
|
||||
event->mode == GDK_CROSSING_GTK_UNGRAB ||
|
||||
event->mode == GDK_CROSSING_GTK_GRAB ||
|
||||
event->mode == GDK_CROSSING_STATE_CHANGED)
|
||||
return TRUE;
|
||||
|
||||
|
||||
+12
-5
@@ -81,6 +81,16 @@ _gtk_modifier_style_init (GtkModifierStyle *modifier_style)
|
||||
priv->style = gtk_style_properties_new ();
|
||||
}
|
||||
|
||||
static GtkStyleProperties *
|
||||
gtk_modifier_style_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
GtkModifierStylePrivate *priv;
|
||||
|
||||
priv = GTK_MODIFIER_STYLE (provider)->priv;
|
||||
return g_object_ref (priv->style);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_modifier_style_get_style_property (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path,
|
||||
@@ -119,10 +129,11 @@ gtk_modifier_style_get_style_property (GtkStyleProvider *provider,
|
||||
static void
|
||||
gtk_modifier_style_provider_init (GtkStyleProviderIface *iface)
|
||||
{
|
||||
iface->get_style = gtk_modifier_style_get_style;
|
||||
iface->get_style_property = gtk_modifier_style_get_style_property;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
static GtkSymbolicColor *
|
||||
gtk_modifier_style_provider_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name)
|
||||
{
|
||||
@@ -256,16 +267,12 @@ _gtk_modifier_style_map_color (GtkModifierStyle *style,
|
||||
|
||||
priv = style->priv;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if (color)
|
||||
symbolic_color = gtk_symbolic_color_new_literal (color);
|
||||
|
||||
gtk_style_properties_map_color (priv->style,
|
||||
name, symbolic_color);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
g_signal_emit (style, signals[CHANGED], 0);
|
||||
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (style));
|
||||
}
|
||||
|
||||
@@ -2504,7 +2504,6 @@ gtk_notebook_size_allocate (GtkWidget *widget,
|
||||
{
|
||||
case GTK_POS_TOP:
|
||||
child_allocation.y += priv->cur_page->requisition.height;
|
||||
/* fall thru */
|
||||
case GTK_POS_BOTTOM:
|
||||
child_allocation.height =
|
||||
MAX (1, child_allocation.height -
|
||||
@@ -2512,7 +2511,6 @@ gtk_notebook_size_allocate (GtkWidget *widget,
|
||||
break;
|
||||
case GTK_POS_LEFT:
|
||||
child_allocation.x += priv->cur_page->requisition.width;
|
||||
/* fall thru */
|
||||
case GTK_POS_RIGHT:
|
||||
child_allocation.width =
|
||||
MAX (1, child_allocation.width -
|
||||
|
||||
@@ -842,7 +842,7 @@ page_name_func (GtkCellLayout *cell_layout,
|
||||
g_object_unref (page_setup);
|
||||
}
|
||||
else
|
||||
g_object_set (cell, "text", _("Manage Custom Sizes…"), NULL);
|
||||
g_object_set (cell, "text", _("Manage Custom Sizes..."), NULL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1913,7 +1913,7 @@ selected_printer_changed (GtkTreeSelection *selection,
|
||||
set_busy_cursor (dialog, TRUE);
|
||||
gtk_list_store_set (GTK_LIST_STORE (priv->printer_list),
|
||||
g_object_get_data (G_OBJECT (printer), "gtk-print-tree-iter"),
|
||||
PRINTER_LIST_COL_STATE, _("Getting printer information…"),
|
||||
PRINTER_LIST_COL_STATE, _("Getting printer information..."),
|
||||
-1);
|
||||
return;
|
||||
}
|
||||
@@ -3326,7 +3326,7 @@ page_name_func (GtkCellLayout *cell_layout,
|
||||
g_object_unref (page_setup);
|
||||
}
|
||||
else
|
||||
g_object_set (cell, "text", _("Manage Custom Sizes…"), NULL);
|
||||
g_object_set (cell, "text", _("Manage Custom Sizes..."), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -37,16 +37,6 @@ G_BEGIN_DECLS
|
||||
#define GTK_PARAM_WRITABLE G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
|
||||
#define GTK_PARAM_READWRITE G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
|
||||
|
||||
#ifdef G_DISABLE_CAST_CHECKS
|
||||
/* This is true for debug no and minimum */
|
||||
#define gtk_internal_return_if_fail(__expr) G_STMT_START{ (void)0; }G_STMT_END
|
||||
#define gtk_internal_return_val_if_fail(__expr, __val) G_STMT_START{ (void)0; }G_STMT_END
|
||||
#else
|
||||
/* This is true for debug yes */
|
||||
#define gtk_internal_return_if_fail(__expr) g_return_if_fail(__expr)
|
||||
#define gtk_internal_return_val_if_fail(__expr, __val) g_return_val_if_fail(__expr, __val)
|
||||
#endif
|
||||
|
||||
const gchar * _gtk_get_datadir (void);
|
||||
const gchar * _gtk_get_libdir (void);
|
||||
const gchar * _gtk_get_sysconfdir (void);
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ _gtk_rounded_box_guess_length (const GtkRoundedBox *box,
|
||||
GtkCssSide side)
|
||||
{
|
||||
double length;
|
||||
GtkCssSide before, after;
|
||||
GtkCssCorner before, after;
|
||||
|
||||
before = side;
|
||||
after = (side + 1) % 4;
|
||||
|
||||
+462
-14
@@ -32,6 +32,7 @@
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkcssproviderprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtksymboliccolor.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkversion.h"
|
||||
|
||||
@@ -114,6 +115,7 @@ struct _GtkSettingsPrivate
|
||||
GdkScreen *screen;
|
||||
GtkCssProvider *theme_provider;
|
||||
GtkCssProvider *key_theme_provider;
|
||||
GtkStyleProperties *style;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
@@ -239,9 +241,15 @@ static void settings_update_cursor_theme (GtkSettings *setting
|
||||
static void settings_update_resolution (GtkSettings *settings);
|
||||
static void settings_update_font_options (GtkSettings *settings);
|
||||
static gboolean settings_update_fontconfig (GtkSettings *settings);
|
||||
static void settings_update_color_scheme (GtkSettings *settings);
|
||||
static void settings_update_theme (GtkSettings *settings);
|
||||
static void settings_update_key_theme (GtkSettings *settings);
|
||||
|
||||
static void merge_color_scheme (GtkSettings *settings,
|
||||
const GValue *value,
|
||||
GtkSettingsSource source);
|
||||
static gchar *get_color_scheme (GtkSettings *settings);
|
||||
static GHashTable *get_color_hash (GtkSettings *settings);
|
||||
static void gtk_settings_load_from_key_file (GtkSettings *settings,
|
||||
const gchar *path,
|
||||
GtkSettingsSource source);
|
||||
@@ -686,9 +694,6 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
* </programlisting>
|
||||
*
|
||||
* Since: 2.10
|
||||
*
|
||||
* Deprecated: 3.8: Color scheme support was dropped and is no longer supported.
|
||||
* You can still set this property, but it will be ignored.
|
||||
*/
|
||||
result = settings_install_property_parser (class,
|
||||
g_param_spec_string ("gtk-color-scheme",
|
||||
@@ -864,8 +869,6 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
* setting, mapping color names to #GdkColor<!-- -->s.
|
||||
*
|
||||
* Since: 2.10
|
||||
*
|
||||
* Deprecated: 3.8: Will always return an empty hash table.
|
||||
*/
|
||||
result = settings_install_property_parser (class,
|
||||
g_param_spec_boxed ("color-hash",
|
||||
@@ -1410,20 +1413,149 @@ gtk_settings_class_init (GtkSettingsClass *class)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_settings_provider_iface_init (GtkStyleProviderIface *iface)
|
||||
settings_ensure_style (GtkSettings *settings)
|
||||
{
|
||||
GtkSettingsPrivate *priv = settings->priv;
|
||||
PangoFontDescription *font_desc;
|
||||
gchar *font_name, *color_scheme;
|
||||
gchar **colors;
|
||||
guint i;
|
||||
|
||||
if (priv->style)
|
||||
return;
|
||||
|
||||
priv->style = gtk_style_properties_new ();
|
||||
|
||||
g_object_get (settings,
|
||||
"gtk-font-name", &font_name,
|
||||
"gtk-color-scheme", &color_scheme,
|
||||
NULL);
|
||||
|
||||
colors = g_strsplit_set (color_scheme, "\n;", -1);
|
||||
|
||||
for (i = 0; colors[i]; i++)
|
||||
{
|
||||
GtkSymbolicColor *color;
|
||||
gchar *name, *pos;
|
||||
GdkRGBA col;
|
||||
|
||||
if (!*colors[i])
|
||||
continue;
|
||||
|
||||
name = colors[i];
|
||||
pos = strchr (colors[i], ':');
|
||||
|
||||
if (!pos)
|
||||
continue;
|
||||
|
||||
/* Set NUL after color name */
|
||||
*pos = '\0';
|
||||
pos++;
|
||||
|
||||
/* Find start of color string */
|
||||
while (*pos == ' ')
|
||||
pos++;
|
||||
|
||||
if (!*pos || !gdk_rgba_parse (&col, pos))
|
||||
continue;
|
||||
|
||||
color = gtk_symbolic_color_new_literal (&col);
|
||||
gtk_style_properties_map_color (priv->style, name, color);
|
||||
gtk_symbolic_color_unref (color);
|
||||
}
|
||||
|
||||
font_desc = pango_font_description_from_string (font_name);
|
||||
|
||||
/* Unset normal attributes from this description,
|
||||
* so they do not override theme values */
|
||||
if (pango_font_description_get_weight (font_desc) == PANGO_WEIGHT_NORMAL)
|
||||
pango_font_description_unset_fields (font_desc,
|
||||
PANGO_FONT_MASK_WEIGHT);
|
||||
|
||||
if (pango_font_description_get_stretch (font_desc) == PANGO_STRETCH_NORMAL)
|
||||
pango_font_description_unset_fields (font_desc,
|
||||
PANGO_FONT_MASK_STRETCH);
|
||||
|
||||
if (pango_font_description_get_variant (font_desc) == PANGO_VARIANT_NORMAL)
|
||||
pango_font_description_unset_fields (font_desc,
|
||||
PANGO_FONT_MASK_VARIANT);
|
||||
|
||||
if (pango_font_description_get_style (font_desc) == PANGO_STYLE_NORMAL)
|
||||
pango_font_description_unset_fields (font_desc,
|
||||
PANGO_FONT_MASK_STYLE);
|
||||
|
||||
gtk_style_properties_set (priv->style, 0,
|
||||
"font", font_desc,
|
||||
NULL);
|
||||
|
||||
pango_font_description_free (font_desc);
|
||||
g_strfreev (colors);
|
||||
g_free (color_scheme);
|
||||
g_free (font_name);
|
||||
}
|
||||
|
||||
static GtkSettings *
|
||||
gtk_settings_style_provider_get_settings (GtkStyleProviderPrivate *provider)
|
||||
static GtkStyleProperties *
|
||||
gtk_settings_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
return GTK_SETTINGS (provider);
|
||||
GtkSettings *settings;
|
||||
|
||||
settings = GTK_SETTINGS (provider);
|
||||
|
||||
settings_ensure_style (settings);
|
||||
|
||||
return g_object_ref (settings->priv->style);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_settings_provider_iface_init (GtkStyleProviderIface *iface)
|
||||
{
|
||||
iface->get_style = gtk_settings_get_style;
|
||||
}
|
||||
|
||||
static GtkSymbolicColor *
|
||||
gtk_settings_style_provider_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name)
|
||||
{
|
||||
GtkSettings *settings = GTK_SETTINGS (provider);
|
||||
|
||||
settings_ensure_style (settings);
|
||||
|
||||
return _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (settings->priv->style), name);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_settings_style_provider_lookup (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher,
|
||||
GtkCssLookup *lookup)
|
||||
{
|
||||
GtkSettings *settings = GTK_SETTINGS (provider);
|
||||
|
||||
settings_ensure_style (settings);
|
||||
|
||||
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (settings->priv->style),
|
||||
matcher,
|
||||
lookup);
|
||||
}
|
||||
|
||||
static GtkCssChange
|
||||
gtk_settings_style_provider_get_change (GtkStyleProviderPrivate *provider,
|
||||
const GtkCssMatcher *matcher)
|
||||
{
|
||||
GtkSettings *settings = GTK_SETTINGS (provider);
|
||||
|
||||
settings_ensure_style (settings);
|
||||
|
||||
return _gtk_style_provider_private_get_change (GTK_STYLE_PROVIDER_PRIVATE (settings->priv->style),
|
||||
matcher);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_settings_provider_private_init (GtkStyleProviderPrivateInterface *iface)
|
||||
{
|
||||
iface->get_settings = gtk_settings_style_provider_get_settings;
|
||||
iface->get_color = gtk_settings_style_provider_get_color;
|
||||
iface->lookup = gtk_settings_style_provider_lookup;
|
||||
iface->get_change = gtk_settings_style_provider_get_change;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1444,6 +1576,8 @@ gtk_settings_finalize (GObject *object)
|
||||
settings_update_provider (priv->screen, &priv->theme_provider, NULL);
|
||||
settings_update_provider (priv->screen, &priv->key_theme_provider, NULL);
|
||||
|
||||
g_clear_object (&priv->style);
|
||||
|
||||
G_OBJECT_CLASS (gtk_settings_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@@ -1527,6 +1661,7 @@ gtk_settings_get_for_screen (GdkScreen *screen)
|
||||
settings_update_cursor_theme (settings);
|
||||
settings_update_resolution (settings);
|
||||
settings_update_font_options (settings);
|
||||
settings_update_color_scheme (settings);
|
||||
}
|
||||
|
||||
return settings;
|
||||
@@ -1563,6 +1698,9 @@ gtk_settings_set_property (GObject *object,
|
||||
|
||||
g_value_copy (value, &priv->property_values[property_id - 1].value);
|
||||
priv->property_values[property_id - 1].source = GTK_SETTINGS_SOURCE_APPLICATION;
|
||||
|
||||
if (pspec->param_id == PROP_COLOR_SCHEME)
|
||||
merge_color_scheme (settings, value, GTK_SETTINGS_SOURCE_APPLICATION);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1580,9 +1718,10 @@ gtk_settings_get_property (GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR_HASH:
|
||||
g_value_take_boxed (value,
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free, (GDestroyNotify) gdk_color_free));
|
||||
g_value_set_boxed (value, get_color_hash (settings));
|
||||
return;
|
||||
case PROP_COLOR_SCHEME:
|
||||
g_value_take_string (value, get_color_scheme (settings));
|
||||
return;
|
||||
default: ;
|
||||
}
|
||||
@@ -1649,6 +1788,14 @@ gtk_settings_get_property (GObject *object,
|
||||
static void
|
||||
settings_invalidate_style (GtkSettings *settings)
|
||||
{
|
||||
GtkSettingsPrivate *priv = settings->priv;
|
||||
|
||||
if (priv->style)
|
||||
{
|
||||
g_object_unref (priv->style);
|
||||
priv->style = NULL;
|
||||
}
|
||||
|
||||
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (settings));
|
||||
}
|
||||
|
||||
@@ -1672,6 +1819,11 @@ gtk_settings_notify (GObject *object,
|
||||
case PROP_DOUBLE_CLICK_DISTANCE:
|
||||
settings_update_double_click (settings);
|
||||
break;
|
||||
case PROP_COLOR_SCHEME:
|
||||
settings_update_color_scheme (settings);
|
||||
settings_invalidate_style (settings);
|
||||
gtk_style_context_reset_widgets (priv->screen);
|
||||
break;
|
||||
case PROP_FONT_NAME:
|
||||
settings_invalidate_style (settings);
|
||||
gtk_style_context_reset_widgets (priv->screen);
|
||||
@@ -1793,6 +1945,9 @@ apply_queued_setting (GtkSettings *settings,
|
||||
if (_gtk_settings_parse_convert (parser, &qvalue->public.value,
|
||||
pspec, &tmp_value))
|
||||
{
|
||||
if (pspec->param_id == PROP_COLOR_SCHEME)
|
||||
merge_color_scheme (settings, &tmp_value, qvalue->source);
|
||||
|
||||
if (priv->property_values[pspec->param_id - 1].source <= qvalue->source)
|
||||
{
|
||||
g_value_copy (&tmp_value, &priv->property_values[pspec->param_id - 1].value);
|
||||
@@ -2423,13 +2578,28 @@ _gtk_settings_handle_event (GdkEventSetting *event)
|
||||
GdkScreen *screen;
|
||||
GtkSettings *settings;
|
||||
GParamSpec *pspec;
|
||||
guint property_id;
|
||||
|
||||
screen = gdk_window_get_screen (event->window);
|
||||
settings = gtk_settings_get_for_screen (screen);
|
||||
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), event->name);
|
||||
|
||||
if (pspec)
|
||||
g_object_notify (G_OBJECT (settings), pspec->name);
|
||||
{
|
||||
property_id = pspec->param_id;
|
||||
|
||||
if (property_id == PROP_COLOR_SCHEME)
|
||||
{
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
if (!gdk_screen_get_setting (screen, pspec->name, &value))
|
||||
g_value_set_static_string (&value, "");
|
||||
merge_color_scheme (settings, &value, GTK_SETTINGS_SOURCE_XSETTING);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
g_object_notify (G_OBJECT (settings), pspec->name);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2677,6 +2847,54 @@ settings_update_resolution (GtkSettings *settings)
|
||||
gdk_screen_set_resolution (priv->screen, dpi);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GHashTable *color_hash;
|
||||
GHashTable *tables[GTK_SETTINGS_SOURCE_APPLICATION + 1];
|
||||
gchar *lastentry[GTK_SETTINGS_SOURCE_APPLICATION + 1];
|
||||
} ColorSchemeData;
|
||||
|
||||
static void
|
||||
color_scheme_data_free (ColorSchemeData *data)
|
||||
{
|
||||
gint i;
|
||||
|
||||
g_hash_table_unref (data->color_hash);
|
||||
|
||||
for (i = 0; i <= GTK_SETTINGS_SOURCE_APPLICATION; i++)
|
||||
{
|
||||
if (data->tables[i])
|
||||
g_hash_table_unref (data->tables[i]);
|
||||
g_free (data->lastentry[i]);
|
||||
}
|
||||
|
||||
g_slice_free (ColorSchemeData, data);
|
||||
}
|
||||
|
||||
static void
|
||||
settings_update_color_scheme (GtkSettings *settings)
|
||||
{
|
||||
if (!g_object_get_data (G_OBJECT (settings), "gtk-color-scheme"))
|
||||
{
|
||||
GtkSettingsPrivate *priv = settings->priv;
|
||||
ColorSchemeData *data;
|
||||
GValue value = G_VALUE_INIT;
|
||||
|
||||
data = g_slice_new0 (ColorSchemeData);
|
||||
data->color_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
||||
(GDestroyNotify) gdk_color_free);
|
||||
g_object_set_data_full (G_OBJECT (settings), "gtk-color-scheme",
|
||||
data, (GDestroyNotify) color_scheme_data_free);
|
||||
|
||||
g_value_init (&value, G_TYPE_STRING);
|
||||
if (priv->screen && gdk_screen_get_setting (priv->screen, "gtk-color-scheme", &value))
|
||||
{
|
||||
merge_color_scheme (settings, &value, GTK_SETTINGS_SOURCE_XSETTING);
|
||||
g_value_unset (&value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
settings_update_provider (GdkScreen *screen,
|
||||
GtkCssProvider **old,
|
||||
@@ -2761,6 +2979,236 @@ settings_update_key_theme (GtkSettings *settings)
|
||||
g_free (key_theme_name);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_color_to_hash (gchar *name,
|
||||
GdkColor *color,
|
||||
GHashTable *target)
|
||||
{
|
||||
GdkColor *old;
|
||||
|
||||
old = g_hash_table_lookup (target, name);
|
||||
if (!old || !gdk_color_equal (old, color))
|
||||
{
|
||||
g_hash_table_insert (target, g_strdup (name), gdk_color_copy (color));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
add_colors_to_hash_from_string (GHashTable *hash,
|
||||
const gchar *colors)
|
||||
{
|
||||
gchar *s, *p, *name;
|
||||
GdkColor color;
|
||||
gboolean changed = FALSE;
|
||||
gchar *copy;
|
||||
|
||||
copy = g_strdup (colors);
|
||||
s = copy;
|
||||
while (s && *s)
|
||||
{
|
||||
name = s;
|
||||
p = strchr (s, ':');
|
||||
if (p)
|
||||
{
|
||||
*p = '\0';
|
||||
p++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
while (*p == ' ')
|
||||
p++;
|
||||
|
||||
s = p;
|
||||
while (*s)
|
||||
{
|
||||
if (*s == '\n' || *s == ';')
|
||||
{
|
||||
*s = '\0';
|
||||
s++;
|
||||
break;
|
||||
}
|
||||
s++;
|
||||
}
|
||||
|
||||
if (gdk_color_parse (p, &color))
|
||||
changed |= add_color_to_hash (name, &color, hash);
|
||||
}
|
||||
|
||||
g_free (copy);
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_color_hash (ColorSchemeData *data,
|
||||
const gchar *str,
|
||||
GtkSettingsSource source)
|
||||
{
|
||||
gboolean changed = FALSE;
|
||||
gint i;
|
||||
GHashTable *old_hash;
|
||||
GHashTableIter iter;
|
||||
gpointer name;
|
||||
gpointer color;
|
||||
|
||||
if ((str == NULL || *str == '\0') &&
|
||||
(data->lastentry[source] == NULL || data->lastentry[source][0] == '\0'))
|
||||
return FALSE;
|
||||
|
||||
if (str && data->lastentry[source] && strcmp (str, data->lastentry[source]) == 0)
|
||||
return FALSE;
|
||||
|
||||
/* For the THEME source we merge the values rather than over-writing
|
||||
* them, since multiple rc files might define independent sets of colors
|
||||
*/
|
||||
if ((source != GTK_SETTINGS_SOURCE_THEME) &&
|
||||
data->tables[source] && g_hash_table_size (data->tables[source]) > 0)
|
||||
{
|
||||
g_hash_table_unref (data->tables[source]);
|
||||
data->tables[source] = NULL;
|
||||
changed = TRUE; /* We can't rely on the code below since str might be "" */
|
||||
}
|
||||
|
||||
if (data->tables[source] == NULL)
|
||||
data->tables[source] = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||
g_free,
|
||||
(GDestroyNotify) gdk_color_free);
|
||||
|
||||
g_free (data->lastentry[source]);
|
||||
data->lastentry[source] = g_strdup (str);
|
||||
|
||||
changed |= add_colors_to_hash_from_string (data->tables[source], str);
|
||||
|
||||
if (!changed)
|
||||
return FALSE;
|
||||
|
||||
/* Rebuild the merged hash table. */
|
||||
if (data->color_hash)
|
||||
{
|
||||
old_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
|
||||
(GDestroyNotify) gdk_color_free);
|
||||
|
||||
g_hash_table_iter_init (&iter, data->color_hash);
|
||||
while (g_hash_table_iter_next (&iter, &name, &color))
|
||||
{
|
||||
g_hash_table_insert (old_hash, name, color);
|
||||
g_hash_table_iter_steal (&iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
old_hash = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i <= GTK_SETTINGS_SOURCE_APPLICATION; i++)
|
||||
{
|
||||
if (data->tables[i])
|
||||
g_hash_table_foreach (data->tables[i], (GHFunc) add_color_to_hash,
|
||||
data->color_hash);
|
||||
}
|
||||
|
||||
if (old_hash)
|
||||
{
|
||||
/* now check if the merged hash has changed */
|
||||
changed = FALSE;
|
||||
if (g_hash_table_size (old_hash) != g_hash_table_size (data->color_hash))
|
||||
changed = TRUE;
|
||||
else
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer key, value, new_value;
|
||||
|
||||
g_hash_table_iter_init (&iter, old_hash);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
{
|
||||
new_value = g_hash_table_lookup (data->color_hash, key);
|
||||
if (!new_value || !gdk_color_equal (value, new_value))
|
||||
{
|
||||
changed = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g_hash_table_unref (old_hash);
|
||||
}
|
||||
else
|
||||
changed = TRUE;
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
static void
|
||||
merge_color_scheme (GtkSettings *settings,
|
||||
const GValue *value,
|
||||
GtkSettingsSource source)
|
||||
{
|
||||
ColorSchemeData *data;
|
||||
const gchar *colors;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (settings));
|
||||
|
||||
colors = g_value_get_string (value);
|
||||
|
||||
settings_update_color_scheme (settings);
|
||||
|
||||
data = (ColorSchemeData *) g_object_get_data (G_OBJECT (settings),
|
||||
"gtk-color-scheme");
|
||||
|
||||
if (update_color_hash (data, colors, source))
|
||||
g_object_notify (G_OBJECT (settings), "color-hash");
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (settings));
|
||||
}
|
||||
|
||||
static GHashTable *
|
||||
get_color_hash (GtkSettings *settings)
|
||||
{
|
||||
ColorSchemeData *data;
|
||||
|
||||
settings_update_color_scheme (settings);
|
||||
|
||||
data = (ColorSchemeData *)g_object_get_data (G_OBJECT (settings),
|
||||
"gtk-color-scheme");
|
||||
|
||||
return data->color_hash;
|
||||
}
|
||||
|
||||
static void
|
||||
append_color_scheme (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data)
|
||||
{
|
||||
gchar *name = (gchar *)key;
|
||||
GdkColor *color = (GdkColor *)value;
|
||||
GString *string = (GString *)data;
|
||||
|
||||
g_string_append_printf (string, "%s: #%04x%04x%04x\n",
|
||||
name, color->red, color->green, color->blue);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
get_color_scheme (GtkSettings *settings)
|
||||
{
|
||||
ColorSchemeData *data;
|
||||
GString *string;
|
||||
|
||||
settings_update_color_scheme (settings);
|
||||
|
||||
data = (ColorSchemeData *) g_object_get_data (G_OBJECT (settings),
|
||||
"gtk-color-scheme");
|
||||
|
||||
string = g_string_new ("");
|
||||
|
||||
g_hash_table_foreach (data->color_hash, append_color_scheme, string);
|
||||
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
GdkScreen *
|
||||
_gtk_settings_get_screen (GtkSettings *settings)
|
||||
|
||||
+8
-17
@@ -152,18 +152,17 @@ G_STATIC_ASSERT (GTK_SIZE_GROUP_VERTICAL == (1 << GTK_ORIENTATION_VERTICAL));
|
||||
G_STATIC_ASSERT (GTK_SIZE_GROUP_BOTH == (GTK_SIZE_GROUP_HORIZONTAL | GTK_SIZE_GROUP_VERTICAL));
|
||||
|
||||
static void
|
||||
add_widget_to_closure (GHashTable *widgets,
|
||||
GHashTable *groups,
|
||||
add_widget_to_closure (GHashTable *set,
|
||||
GtkWidget *widget,
|
||||
GtkOrientation orientation)
|
||||
{
|
||||
GSList *tmp_groups, *tmp_widgets;
|
||||
gboolean hidden;
|
||||
|
||||
if (g_hash_table_lookup (widgets, widget))
|
||||
if (g_hash_table_lookup (set, widget))
|
||||
return;
|
||||
|
||||
g_hash_table_add (widgets, widget);
|
||||
g_hash_table_insert (set, widget, widget);
|
||||
hidden = !gtk_widget_is_visible (widget);
|
||||
|
||||
for (tmp_groups = _gtk_widget_get_sizegroups (widget); tmp_groups; tmp_groups = tmp_groups->next)
|
||||
@@ -171,19 +170,14 @@ add_widget_to_closure (GHashTable *widgets,
|
||||
GtkSizeGroup *tmp_group = tmp_groups->data;
|
||||
GtkSizeGroupPrivate *tmp_priv = tmp_group->priv;
|
||||
|
||||
if (g_hash_table_lookup (groups, tmp_group))
|
||||
continue;
|
||||
|
||||
if (tmp_priv->ignore_hidden && hidden)
|
||||
continue;
|
||||
|
||||
if (!(tmp_priv->mode & (1 << orientation)))
|
||||
continue;
|
||||
|
||||
g_hash_table_add (groups, tmp_group);
|
||||
|
||||
for (tmp_widgets = tmp_priv->widgets; tmp_widgets; tmp_widgets = tmp_widgets->next)
|
||||
add_widget_to_closure (widgets, groups, tmp_widgets->data, orientation);
|
||||
add_widget_to_closure (set, tmp_widgets->data, orientation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,16 +185,13 @@ GHashTable *
|
||||
_gtk_size_group_get_widget_peers (GtkWidget *for_widget,
|
||||
GtkOrientation orientation)
|
||||
{
|
||||
GHashTable *widgets, *groups;
|
||||
GHashTable *result;
|
||||
|
||||
widgets = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
groups = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
result = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
|
||||
add_widget_to_closure (widgets, groups, for_widget, orientation);
|
||||
add_widget_to_closure (result, for_widget, orientation);
|
||||
|
||||
g_hash_table_unref (groups);
|
||||
|
||||
return widgets;
|
||||
return result;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
+28
-31
@@ -91,6 +91,16 @@ gtk_style_cascade_iter_init (GtkStyleCascade *cascade,
|
||||
return gtk_style_cascade_iter_next (cascade, iter);
|
||||
}
|
||||
|
||||
static GtkStyleProperties *
|
||||
gtk_style_cascade_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
/* This function is not used anymore by GTK and nobody
|
||||
* else is ever supposed to call it */
|
||||
g_warn_if_reached ();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_style_cascade_get_style_property (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path,
|
||||
@@ -117,42 +127,30 @@ gtk_style_cascade_get_style_property (GtkStyleProvider *provider,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_cascade_provider_iface_init (GtkStyleProviderIface *iface)
|
||||
static GtkIconFactory *
|
||||
gtk_style_cascade_get_icon_factory (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
iface->get_style_property = gtk_style_cascade_get_style_property;
|
||||
}
|
||||
|
||||
static GtkSettings *
|
||||
gtk_style_cascade_get_settings (GtkStyleProviderPrivate *provider)
|
||||
{
|
||||
GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
|
||||
GtkStyleCascadeIter iter;
|
||||
GtkSettings *settings;
|
||||
GtkStyleProvider *item;
|
||||
|
||||
for (item = gtk_style_cascade_iter_init (cascade, &iter);
|
||||
item;
|
||||
item = gtk_style_cascade_iter_next (cascade, &iter))
|
||||
{
|
||||
if (!GTK_IS_STYLE_PROVIDER_PRIVATE (item))
|
||||
continue;
|
||||
|
||||
settings = _gtk_style_provider_private_get_settings (GTK_STYLE_PROVIDER_PRIVATE (item));
|
||||
if (settings)
|
||||
return settings;
|
||||
}
|
||||
|
||||
/* If anyone ever implements get_icon_factory(), I'll
|
||||
* look at this function. Until then I'll just: */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
static void
|
||||
gtk_style_cascade_provider_iface_init (GtkStyleProviderIface *iface)
|
||||
{
|
||||
iface->get_style = gtk_style_cascade_get_style;
|
||||
iface->get_style_property = gtk_style_cascade_get_style_property;
|
||||
iface->get_icon_factory = gtk_style_cascade_get_icon_factory;
|
||||
}
|
||||
|
||||
static GtkSymbolicColor *
|
||||
gtk_style_cascade_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name)
|
||||
{
|
||||
GtkStyleCascade *cascade = GTK_STYLE_CASCADE (provider);
|
||||
GtkStyleCascadeIter iter;
|
||||
GtkCssValue *color;
|
||||
GtkSymbolicColor *symbolic;
|
||||
GtkStyleProvider *item;
|
||||
|
||||
for (item = gtk_style_cascade_iter_init (cascade, &iter);
|
||||
@@ -161,9 +159,9 @@ gtk_style_cascade_get_color (GtkStyleProviderPrivate *provider,
|
||||
{
|
||||
if (GTK_IS_STYLE_PROVIDER_PRIVATE (item))
|
||||
{
|
||||
color = _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (item), name);
|
||||
if (color)
|
||||
return color;
|
||||
symbolic = _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (item), name);
|
||||
if (symbolic)
|
||||
return symbolic;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -256,7 +254,6 @@ static void
|
||||
gtk_style_cascade_provider_private_iface_init (GtkStyleProviderPrivateInterface *iface)
|
||||
{
|
||||
iface->get_color = gtk_style_cascade_get_color;
|
||||
iface->get_settings = gtk_style_cascade_get_settings;
|
||||
iface->get_keyframes = gtk_style_cascade_get_keyframes;
|
||||
iface->lookup = gtk_style_cascade_lookup;
|
||||
iface->get_change = gtk_style_cascade_get_change;
|
||||
|
||||
+30
-54
@@ -24,11 +24,11 @@
|
||||
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtkcontainerprivate.h"
|
||||
#include "gtkcsscolorvalueprivate.h"
|
||||
#include "gtkcssenginevalueprivate.h"
|
||||
#include "gtkcssnumbervalueprivate.h"
|
||||
#include "gtkcssrgbavalueprivate.h"
|
||||
#include "gtkdebug.h"
|
||||
#include "gtkgradientprivate.h"
|
||||
#include "gtkstylepropertiesprivate.h"
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkthemingengineprivate.h"
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "gtkwidget.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
#include "gtkiconfactory.h"
|
||||
#include "gtkwidgetpath.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
@@ -44,9 +45,6 @@
|
||||
#include "gtksettings.h"
|
||||
#include "gtksettingsprivate.h"
|
||||
|
||||
#include "deprecated/gtkgradientprivate.h"
|
||||
#include "deprecated/gtksymboliccolorprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkstylecontext
|
||||
* @Short_description: Rendering UI elements
|
||||
@@ -372,7 +370,7 @@ struct _GtkStyleContextPrivate
|
||||
GtkCssChange relevant_changes;
|
||||
GtkCssChange pending_changes;
|
||||
|
||||
const GtkBitmask *invalidating_context;
|
||||
guint invalidating_context : 1;
|
||||
guint invalid : 1;
|
||||
};
|
||||
|
||||
@@ -2222,6 +2220,17 @@ _gtk_style_context_peek_property (GtkStyleContext *context,
|
||||
return _gtk_css_computed_values_get_value (data->store, property_id);
|
||||
}
|
||||
|
||||
double
|
||||
_gtk_style_context_get_number (GtkStyleContext *context,
|
||||
guint property_id,
|
||||
double one_hundred_percent)
|
||||
{
|
||||
GtkCssValue *value;
|
||||
|
||||
value = _gtk_style_context_peek_property (context, property_id);
|
||||
return _gtk_css_number_value_get (value, one_hundred_percent);
|
||||
}
|
||||
|
||||
const GValue *
|
||||
_gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
GType widget_type,
|
||||
@@ -2273,8 +2282,6 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
widget_path,
|
||||
state, pspec, &pcache->value))
|
||||
{
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
/* Resolve symbolic colors to GdkColor/GdkRGBA */
|
||||
if (G_VALUE_TYPE (&pcache->value) == GTK_TYPE_SYMBOLIC_COLOR)
|
||||
{
|
||||
@@ -2290,7 +2297,7 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
else
|
||||
g_value_init (&pcache->value, GDK_TYPE_COLOR);
|
||||
|
||||
if (_gtk_style_context_resolve_color (context, _gtk_symbolic_color_get_css_value (color), &rgba, NULL))
|
||||
if (_gtk_style_context_resolve_color (context, color, &rgba, NULL))
|
||||
{
|
||||
if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
|
||||
g_value_set_boxed (&pcache->value, &rgba);
|
||||
@@ -2311,8 +2318,6 @@ _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
gtk_symbolic_color_unref (color);
|
||||
}
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
if (priv->widget)
|
||||
gtk_widget_path_free (widget_path);
|
||||
|
||||
@@ -2698,7 +2703,7 @@ gtk_style_context_get_junction_sides (GtkStyleContext *context)
|
||||
|
||||
gboolean
|
||||
_gtk_style_context_resolve_color (GtkStyleContext *context,
|
||||
GtkCssValue *color,
|
||||
GtkSymbolicColor *color,
|
||||
GdkRGBA *result,
|
||||
GtkCssDependencies *dependencies)
|
||||
{
|
||||
@@ -2708,11 +2713,11 @@ _gtk_style_context_resolve_color (GtkStyleContext *context,
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
g_return_val_if_fail (result != NULL, FALSE);
|
||||
|
||||
val = _gtk_css_color_value_resolve (color,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade),
|
||||
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
dependencies);
|
||||
val = _gtk_symbolic_color_resolve_full (color,
|
||||
GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade),
|
||||
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
|
||||
GTK_CSS_DEPENDS_ON_COLOR,
|
||||
dependencies);
|
||||
if (val == NULL)
|
||||
return FALSE;
|
||||
|
||||
@@ -2736,17 +2741,17 @@ gtk_style_context_lookup_color (GtkStyleContext *context,
|
||||
const gchar *color_name,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
GtkCssValue *value;
|
||||
GtkSymbolicColor *sym_color;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
|
||||
g_return_val_if_fail (color_name != NULL, FALSE);
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
|
||||
value = _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade), color_name);
|
||||
if (value == NULL)
|
||||
sym_color = _gtk_style_provider_private_get_color (GTK_STYLE_PROVIDER_PRIVATE (context->priv->cascade), color_name);
|
||||
if (sym_color == NULL)
|
||||
return FALSE;
|
||||
|
||||
return _gtk_style_context_resolve_color (context, value, color, NULL);
|
||||
return _gtk_style_context_resolve_color (context, sym_color, color, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2960,8 +2965,7 @@ gtk_style_context_update_cache (GtkStyleContext *context,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_context_do_invalidate (GtkStyleContext *context,
|
||||
const GtkBitmask *changes)
|
||||
gtk_style_context_do_invalidate (GtkStyleContext *context)
|
||||
{
|
||||
GtkStyleContextPrivate *priv;
|
||||
|
||||
@@ -2973,11 +2977,11 @@ gtk_style_context_do_invalidate (GtkStyleContext *context,
|
||||
if (priv->invalidating_context)
|
||||
return;
|
||||
|
||||
priv->invalidating_context = changes;
|
||||
priv->invalidating_context = TRUE;
|
||||
|
||||
g_signal_emit (context, signals[CHANGED], 0);
|
||||
|
||||
priv->invalidating_context = NULL;
|
||||
priv->invalidating_context = FALSE;
|
||||
}
|
||||
|
||||
static GtkBitmask *
|
||||
@@ -3167,7 +3171,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
|
||||
}
|
||||
|
||||
if (!_gtk_bitmask_is_empty (changes) || (change & GTK_CSS_CHANGE_FORCE_INVALIDATE))
|
||||
gtk_style_context_do_invalidate (context, changes);
|
||||
gtk_style_context_do_invalidate (context);
|
||||
|
||||
change = _gtk_css_change_for_child (change);
|
||||
for (list = priv->children; list; list = list->next)
|
||||
@@ -3216,18 +3220,10 @@ _gtk_style_context_queue_invalidate (GtkStyleContext *context,
|
||||
void
|
||||
gtk_style_context_invalidate (GtkStyleContext *context)
|
||||
{
|
||||
GtkBitmask *changes;
|
||||
|
||||
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
|
||||
|
||||
gtk_style_context_clear_cache (context);
|
||||
|
||||
changes = _gtk_bitmask_new ();
|
||||
changes = _gtk_bitmask_invert_range (changes,
|
||||
0,
|
||||
_gtk_css_style_property_get_n_properties ());
|
||||
gtk_style_context_do_invalidate (context, changes);
|
||||
_gtk_bitmask_free (changes);
|
||||
gtk_style_context_do_invalidate (context);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4501,26 +4497,6 @@ gtk_draw_insertion_cursor (GtkWidget *widget,
|
||||
draw_arrow);
|
||||
}
|
||||
|
||||
/**
|
||||
* _gtk_style_context_get_changes:
|
||||
* @context: the context to query
|
||||
*
|
||||
* Queries the context for the changes for the currently executing
|
||||
* GtkStyleContext::invalidate signal. If no signal is currently
|
||||
* emitted, this function returns %NULL.
|
||||
*
|
||||
* FIXME 4.0: Make this part of the signal.
|
||||
*
|
||||
* Returns: %NULL or the currently invalidating changes
|
||||
**/
|
||||
const GtkBitmask *
|
||||
_gtk_style_context_get_changes (GtkStyleContext *context)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
|
||||
|
||||
return context->priv->invalidating_context;
|
||||
}
|
||||
|
||||
static AtkAttributeSet *
|
||||
add_attribute (AtkAttributeSet *attributes,
|
||||
AtkTextAttribute attr,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtksymboliccolor.h"
|
||||
#include "gtkbitmaskprivate.h"
|
||||
#include "gtkcssvalueprivate.h"
|
||||
|
||||
@@ -27,11 +28,11 @@ G_BEGIN_DECLS
|
||||
|
||||
void _gtk_style_context_set_widget (GtkStyleContext *context,
|
||||
GtkWidget *widget);
|
||||
const GtkBitmask *
|
||||
_gtk_style_context_get_changes (GtkStyleContext *context);
|
||||
|
||||
GtkCssValue * _gtk_style_context_peek_property (GtkStyleContext *context,
|
||||
guint property_id);
|
||||
double _gtk_style_context_get_number (GtkStyleContext *context,
|
||||
guint property_id,
|
||||
double one_hundred_percent);
|
||||
const GValue * _gtk_style_context_peek_style_property (GtkStyleContext *context,
|
||||
GType widget_type,
|
||||
GtkStateFlags state,
|
||||
@@ -45,7 +46,7 @@ void _gtk_style_context_queue_invalidate (GtkStyleContext *c
|
||||
gboolean _gtk_style_context_check_region_name (const gchar *str);
|
||||
|
||||
gboolean _gtk_style_context_resolve_color (GtkStyleContext *context,
|
||||
GtkCssValue *color,
|
||||
GtkSymbolicColor *color,
|
||||
GdkRGBA *result,
|
||||
GtkCssDependencies *dependencies);
|
||||
void _gtk_style_context_get_cursor_color (GtkStyleContext *context,
|
||||
|
||||
+14
-25
@@ -24,7 +24,9 @@
|
||||
#include <cairo-gobject.h>
|
||||
|
||||
#include "gtkstyleprovider.h"
|
||||
#include "gtksymboliccolor.h"
|
||||
#include "gtkthemingengine.h"
|
||||
#include "gtkgradient.h"
|
||||
#include "gtkcssshorthandpropertyprivate.h"
|
||||
#include "gtkcsstypedvalueprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
@@ -34,10 +36,8 @@
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkwin32themeprivate.h"
|
||||
|
||||
#include "deprecated/gtkgradient.h"
|
||||
#include "deprecated/gtksymboliccolorprivate.h"
|
||||
#include "gtkwin32themeprivate.h"
|
||||
|
||||
/**
|
||||
* SECTION:gtkstyleproperties
|
||||
@@ -279,26 +279,25 @@ gtk_style_properties_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_style_properties_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static GtkStyleProperties *
|
||||
gtk_style_properties_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path)
|
||||
{
|
||||
/* Return style set itself */
|
||||
return g_object_ref (provider);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_style_properties_provider_init (GtkStyleProviderIface *iface)
|
||||
{
|
||||
iface->get_style = gtk_style_properties_get_style;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
static GtkSymbolicColor *
|
||||
gtk_style_properties_provider_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name)
|
||||
{
|
||||
GtkSymbolicColor *symbolic;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
symbolic = gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name);
|
||||
if (symbolic == NULL)
|
||||
return NULL;
|
||||
|
||||
return _gtk_symbolic_color_get_css_value (symbolic);
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
return gtk_style_properties_lookup_color (GTK_STYLE_PROPERTIES (provider), name);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -377,8 +376,6 @@ gtk_style_properties_new (void)
|
||||
* gtk_style_properties_lookup_color()
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
void
|
||||
gtk_style_properties_map_color (GtkStyleProperties *props,
|
||||
@@ -393,8 +390,6 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
|
||||
|
||||
priv = props->priv;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
|
||||
if (G_UNLIKELY (!priv->color_map))
|
||||
priv->color_map = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
@@ -405,8 +400,6 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
|
||||
g_strdup (name),
|
||||
gtk_symbolic_color_ref (color));
|
||||
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
|
||||
_gtk_style_provider_private_changed (GTK_STYLE_PROVIDER_PRIVATE (props));
|
||||
}
|
||||
|
||||
@@ -421,8 +414,6 @@ gtk_style_properties_map_color (GtkStyleProperties *props,
|
||||
* Returns: (transfer none): The mapped color
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: #GtkSymbolicColor is deprecated.
|
||||
**/
|
||||
GtkSymbolicColor *
|
||||
gtk_style_properties_lookup_color (GtkStyleProperties *props,
|
||||
@@ -879,9 +870,7 @@ gtk_style_properties_merge (GtkStyleProperties *props,
|
||||
g_hash_table_lookup (priv->color_map, name))
|
||||
continue;
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
|
||||
gtk_style_properties_map_color (props, name, color);
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,21 +66,17 @@ typedef gboolean (* GtkStylePropertyParser) (const gchar *string,
|
||||
GType gtk_style_properties_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* Next 2 are implemented in gtkcsscustomproperty.c */
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_style_properties_register_property (GtkStylePropertyParser parse_func,
|
||||
GParamSpec *pspec);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
gboolean gtk_style_properties_lookup_property (const gchar *property_name,
|
||||
GtkStylePropertyParser *parse_func,
|
||||
GParamSpec **pspec);
|
||||
|
||||
GtkStyleProperties * gtk_style_properties_new (void);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_style_properties_map_color (GtkStyleProperties *props,
|
||||
const gchar *name,
|
||||
GtkSymbolicColor *color);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_style_properties_lookup_color (GtkStyleProperties *props,
|
||||
const gchar *name);
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "gtkstyleproperties.h"
|
||||
#include "gtkcssstylepropertyprivate.h"
|
||||
#include "gtkstylecontextprivate.h"
|
||||
#include "gtksymboliccolorprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -66,9 +66,6 @@ gtk_style_provider_iface_init (gpointer g_iface)
|
||||
* style settings affecting @path
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: Will always return %NULL for all GTK-provided style providers
|
||||
* as the interface cannot correctly work the way CSS is specified.
|
||||
**/
|
||||
GtkStyleProperties *
|
||||
gtk_style_provider_get_style (GtkStyleProvider *provider,
|
||||
@@ -135,8 +132,6 @@ gtk_style_provider_get_style_property (GtkStyleProvider *provider,
|
||||
* Returns: (transfer none): The icon factory to use for @path, or %NULL
|
||||
*
|
||||
* Since: 3.0
|
||||
*
|
||||
* Deprecated: 3.8: Will always return %NULL for all GTK-provided style providers.
|
||||
**/
|
||||
GtkIconFactory *
|
||||
gtk_style_provider_get_icon_factory (GtkStyleProvider *provider,
|
||||
|
||||
@@ -109,7 +109,6 @@ struct _GtkStyleProviderIface
|
||||
|
||||
GType gtk_style_provider_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkStyleProperties *gtk_style_provider_get_style (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path);
|
||||
|
||||
@@ -119,7 +118,6 @@ gboolean gtk_style_provider_get_style_property (GtkStyleProvider *provider,
|
||||
GParamSpec *pspec,
|
||||
GValue *value);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8_FOR(NULL)
|
||||
GtkIconFactory * gtk_style_provider_get_icon_factory (GtkStyleProvider *provider,
|
||||
GtkWidgetPath *path);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ _gtk_style_provider_private_default_init (GtkStyleProviderPrivateInterface *ifac
|
||||
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
GtkSymbolicColor *
|
||||
_gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name)
|
||||
{
|
||||
@@ -125,18 +125,3 @@ _gtk_style_provider_private_changed (GtkStyleProviderPrivate *provider)
|
||||
g_signal_emit (provider, signals[CHANGED], 0);
|
||||
}
|
||||
|
||||
GtkSettings *
|
||||
_gtk_style_provider_private_get_settings (GtkStyleProviderPrivate *provider)
|
||||
{
|
||||
GtkStyleProviderPrivateInterface *iface;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
|
||||
|
||||
iface = GTK_STYLE_PROVIDER_PRIVATE_GET_INTERFACE (provider);
|
||||
|
||||
if (!iface->get_settings)
|
||||
return NULL;
|
||||
|
||||
return iface->get_settings (provider);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "gtk/gtkcsskeyframesprivate.h"
|
||||
#include "gtk/gtkcsslookupprivate.h"
|
||||
#include "gtk/gtkcssmatcherprivate.h"
|
||||
#include "gtk/gtkcssvalueprivate.h"
|
||||
#include <gtk/gtkenums.h>
|
||||
#include <gtk/gtksymboliccolor.h>
|
||||
#include <gtk/gtktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@@ -39,9 +40,8 @@ struct _GtkStyleProviderPrivateInterface
|
||||
{
|
||||
GTypeInterface g_iface;
|
||||
|
||||
GtkCssValue * (* get_color) (GtkStyleProviderPrivate *provider,
|
||||
GtkSymbolicColor * (* get_color) (GtkStyleProviderPrivate *provider,
|
||||
const char *name);
|
||||
GtkSettings * (* get_settings) (GtkStyleProviderPrivate *provider);
|
||||
GtkCssKeyframes * (* get_keyframes) (GtkStyleProviderPrivate *provider,
|
||||
const char *name);
|
||||
void (* lookup) (GtkStyleProviderPrivate *provider,
|
||||
@@ -56,8 +56,7 @@ struct _GtkStyleProviderPrivateInterface
|
||||
|
||||
GType _gtk_style_provider_private_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkSettings * _gtk_style_provider_private_get_settings (GtkStyleProviderPrivate *provider);
|
||||
GtkCssValue * _gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
|
||||
GtkSymbolicColor * _gtk_style_provider_private_get_color (GtkStyleProviderPrivate *provider,
|
||||
const char *name);
|
||||
GtkCssKeyframes * _gtk_style_provider_private_get_keyframes(GtkStyleProviderPrivate *provider,
|
||||
const char *name);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -31,33 +31,23 @@ G_BEGIN_DECLS
|
||||
|
||||
GType gtk_symbolic_color_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA *color);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_symbolic_color_new_name (const gchar *name);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_symbolic_color_new_shade (GtkSymbolicColor *color,
|
||||
gdouble factor);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_symbolic_color_new_alpha (GtkSymbolicColor *color,
|
||||
gdouble factor);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_symbolic_color_new_mix (GtkSymbolicColor *color1,
|
||||
GtkSymbolicColor *color2,
|
||||
gdouble factor);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_symbolic_color_new_win32 (const gchar *theme_class,
|
||||
gint id);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
GtkSymbolicColor * gtk_symbolic_color_ref (GtkSymbolicColor *color);
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_symbolic_color_unref (GtkSymbolicColor *color);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
char * gtk_symbolic_color_to_string (GtkSymbolicColor *color);
|
||||
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
gboolean gtk_symbolic_color_resolve (GtkSymbolicColor *color,
|
||||
GtkStyleProperties *props,
|
||||
GdkRGBA *resolved_color);
|
||||
@@ -0,0 +1,52 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_SYMBOLIC_COLOR_PRIVATE_H__
|
||||
#define __GTK_SYMBOLIC_COLOR_PRIVATE_H__
|
||||
|
||||
#include "gtk/gtksymboliccolor.h"
|
||||
#include "gtk/gtkcssparserprivate.h"
|
||||
#include "gtk/gtkcssvalueprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * _gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
|
||||
GtkStyleProviderPrivate *provider,
|
||||
GtkCssValue *current,
|
||||
GtkCssDependencies current_deps,
|
||||
GtkCssDependencies *dependencies);
|
||||
|
||||
GtkSymbolicColor * _gtk_symbolic_color_get_current_color (void);
|
||||
|
||||
GtkCssValue * _gtk_css_symbolic_value_new (GtkCssParser *parser);
|
||||
|
||||
/* I made these inline functions instead of macros to gain type safety for the arguments passed in. */
|
||||
static inline GtkSymbolicColor *
|
||||
_gtk_symbolic_color_new_take_value (GtkCssValue *value)
|
||||
{
|
||||
return (GtkSymbolicColor *) value;
|
||||
}
|
||||
|
||||
static inline GtkCssValue *
|
||||
_gtk_css_symbolic_value_new_take_symbolic_color (GtkSymbolicColor *color)
|
||||
{
|
||||
return (GtkCssValue *) color;
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_SYMBOLIC_COLOR_PRIVATE_H__ */
|
||||
+17
-6
@@ -35,7 +35,6 @@
|
||||
#include "gtkcssrgbavalueprivate.h"
|
||||
#include "gtkcssshadowsvalueprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtkhslaprivate.h"
|
||||
#include "gtkthemingengineprivate.h"
|
||||
#include "gtkroundedboxprivate.h"
|
||||
#include "gtkthemingbackgroundprivate.h"
|
||||
@@ -355,6 +354,16 @@ _gtk_theming_engine_peek_property (GtkThemingEngine *engine,
|
||||
return _gtk_style_context_peek_property (engine->priv->context, property_id);
|
||||
}
|
||||
|
||||
double
|
||||
_gtk_theming_engine_get_number (GtkThemingEngine *engine,
|
||||
guint property_id,
|
||||
double one_hundred_percent)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), 0.0);
|
||||
|
||||
return _gtk_style_context_get_number (engine->priv->context, property_id, one_hundred_percent);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_theming_engine_get_property:
|
||||
* @engine: a #GtkThemingEngine
|
||||
@@ -1330,11 +1339,14 @@ color_shade (const GdkRGBA *color,
|
||||
gdouble factor,
|
||||
GdkRGBA *color_return)
|
||||
{
|
||||
GtkHSLA hsla;
|
||||
GtkSymbolicColor *literal, *shade;
|
||||
|
||||
_gtk_hsla_init_from_rgba (&hsla, color);
|
||||
_gtk_hsla_shade (&hsla, &hsla, factor);
|
||||
_gdk_rgba_init_from_hsla (color_return, &hsla);
|
||||
literal = gtk_symbolic_color_new_literal (color);
|
||||
shade = gtk_symbolic_color_new_shade (literal, factor);
|
||||
gtk_symbolic_color_unref (literal);
|
||||
|
||||
gtk_symbolic_color_resolve (shade, NULL, color_return);
|
||||
gtk_symbolic_color_unref (shade);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1646,7 +1658,6 @@ render_border (cairo_t *cr,
|
||||
2 * other_border[GTK_CSS_LEFT]);
|
||||
render_frame_fill (cr, &other_box, other_border, colors, dont_draw);
|
||||
}
|
||||
break;
|
||||
case GTK_BORDER_STYLE_GROOVE:
|
||||
case GTK_BORDER_STYLE_RIDGE:
|
||||
{
|
||||
|
||||
@@ -182,7 +182,6 @@ struct _GtkThemingEngineClass
|
||||
GType gtk_theming_engine_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/* function implemented in gtkcsscustomproperty.c */
|
||||
GDK_DEPRECATED_IN_3_8
|
||||
void gtk_theming_engine_register_property (const gchar *name_space,
|
||||
GtkStylePropertyParser parse_func,
|
||||
GParamSpec *pspec);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user