Make gtk_widget_override_cursor() take GdkRGBAs

Even though the style properties have the GdkColor type, the other
gtk_widget_override_* API takes RGBA colors, so it is consistent
now.
This commit is contained in:
Carlos Garnacho 2010-12-04 17:44:53 +01:00
parent cd76b057e9
commit 3d28adf317
7 changed files with 93 additions and 14 deletions

View File

@ -326,6 +326,18 @@ Used to change the appearance of an outline typically provided by a #GtkFrame.
@GTK_STATE_INCONSISTENT:
@GTK_STATE_FOCUSED:
<!-- ##### ENUM GtkStateFlags ##### -->
<para>
</para>
@GTK_STATE_FLAG_ACTIVE:
@GTK_STATE_FLAG_PRELIGHT:
@GTK_STATE_FLAG_SELECTED:
@GTK_STATE_FLAG_INSENSITIVE:
@GTK_STATE_FLAG_INCONSISTENT:
@GTK_STATE_FLAG_FOCUSED:
<!-- ##### ENUM GtkToolbarStyle ##### -->
<para>
Used to customize the appearance of a #GtkToolbar. Note that
@ -408,3 +420,39 @@ The value can by obtained by connecting to the
@GTK_DRAG_RESULT_ERROR: The drag operation failed due to some
unspecified error
<!-- ##### ENUM GtkJunctionSides ##### -->
<para>
</para>
@GTK_JUNCTION_NONE:
@GTK_JUNCTION_CORNER_TOPLEFT:
@GTK_JUNCTION_CORNER_TOPRIGHT:
@GTK_JUNCTION_CORNER_BOTTOMLEFT:
@GTK_JUNCTION_CORNER_BOTTOMRIGHT:
@GTK_JUNCTION_TOP:
@GTK_JUNCTION_BOTTOM:
@GTK_JUNCTION_LEFT:
@GTK_JUNCTION_RIGHT:
<!-- ##### ENUM GtkBorderStyle ##### -->
<para>
</para>
@GTK_BORDER_STYLE_NONE:
@GTK_BORDER_STYLE_SOLID:
@GTK_BORDER_STYLE_INSET:
@GTK_BORDER_STYLE_OUTSET:
<!-- ##### ENUM GtkRegionFlags ##### -->
<para>
</para>
@GTK_REGION_EVEN:
@GTK_REGION_ODD:
@GTK_REGION_FIRST:
@GTK_REGION_LAST:
@GTK_REGION_SORTED:

View File

@ -279,6 +279,17 @@ This attribute is optional.</para>
@Returns:
<!-- ##### FUNCTION gtk_icon_set_render_icon_pixbuf ##### -->
<para>
</para>
@icon_set:
@context:
@size:
@Returns:
<!-- ##### FUNCTION gtk_icon_set_unref ##### -->
<para>

View File

@ -449,6 +449,18 @@ The #GQuark used for #GtkIconThemeError errors.
@Returns:
<!-- ##### FUNCTION gtk_icon_info_load_symbolic_for_context ##### -->
<para>
</para>
@icon_info:
@context:
@was_symbolic:
@error:
@Returns:
<!-- ##### FUNCTION gtk_icon_info_set_raw_coordinates ##### -->
<para>

View File

@ -98,7 +98,8 @@ gtk_modifier_style_get_style_property (GtkStyleProvider *provider,
GValue *value)
{
GtkModifierStylePrivate *priv;
GdkColor *color;
GdkRGBA *rgba;
GdkColor color;
gchar *str;
/* Reject non-color types for now */
@ -110,13 +111,17 @@ gtk_modifier_style_get_style_property (GtkStyleProvider *provider,
g_type_name (pspec->owner_type),
pspec->name);
color = g_hash_table_lookup (priv->color_properties, str);
rgba = g_hash_table_lookup (priv->color_properties, str);
g_free (str);
if (!color)
if (!rgba)
return FALSE;
g_value_set_boxed (value, color);
color.red = (guint) (rgba->red * 65535.) + 0.5;
color.green = (guint) (rgba->green * 65535.) + 0.5;
color.blue = (guint) (rgba->blue * 65535.) + 0.5;
g_value_set_boxed (value, &color);
return TRUE;
}
@ -254,10 +259,10 @@ void
gtk_modifier_style_set_color_property (GtkModifierStyle *style,
GType widget_type,
const gchar *prop_name,
const GdkColor *color)
const GdkRGBA *color)
{
GtkModifierStylePrivate *priv;
const GdkColor *old_color;
const GdkRGBA *old_color;
gchar *str;
g_return_if_fail (GTK_IS_MODIFIER_STYLE (style));
@ -270,7 +275,7 @@ gtk_modifier_style_set_color_property (GtkModifierStyle *style,
old_color = g_hash_table_lookup (priv->color_properties, str);
if ((!color && !old_color) ||
(color && old_color && gdk_color_equal (color, old_color)))
(color && old_color && gdk_rgba_equal (color, old_color)))
{
g_free (str);
return;
@ -278,7 +283,7 @@ gtk_modifier_style_set_color_property (GtkModifierStyle *style,
if (color)
g_hash_table_insert (priv->color_properties, str,
gdk_color_copy (color));
gdk_rgba_copy (color));
else
g_hash_table_remove (priv->color_properties, str);

View File

@ -67,7 +67,7 @@ void gtk_modifier_style_map_color (GtkModifierStyle *style,
void gtk_modifier_style_set_color_property (GtkModifierStyle *style,
GType widget_type,
const gchar *prop_name,
const GdkColor *color);
const GdkRGBA *color);
G_END_DECLS

View File

@ -8109,12 +8109,15 @@ gtk_widget_override_symbolic_color (GtkWidget *widget,
* style properties. All other style values are left untouched.
* See also gtk_widget_modify_style().
*
* Note that the underlying properties have the #GdkColor type,
* so the alpha value in @primary and @secondary will be ignored.
*
* Since: 3.0
**/
void
gtk_widget_override_cursor (GtkWidget *widget,
const GdkColor *cursor,
const GdkColor *secondary_cursor)
gtk_widget_override_cursor (GtkWidget *widget,
const GdkRGBA *cursor,
const GdkRGBA *secondary_cursor)
{
GtkModifierStyle *style;

View File

@ -774,8 +774,8 @@ void gtk_widget_override_symbolic_color (GtkWidget *widget,
const gchar *name,
const GdkRGBA *color);
void gtk_widget_override_cursor (GtkWidget *widget,
const GdkColor *cursor,
const GdkColor *secondary_cursor);
const GdkRGBA *cursor,
const GdkRGBA *secondary_cursor);
void gtk_widget_style_attach (GtkWidget *widget);