Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gtk
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1,144
Issues
1,144
List
Boards
Labels
Milestones
Merge Requests
96
Merge Requests
96
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
GNOME
gtk
Commits
d865cf4b
Commit
d865cf4b
authored
Nov 13, 2010
by
Carlos Garnacho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GtkStyleProperties: Handle GdkColor types.
Just in case.
parent
8b9b9c22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
7 deletions
+46
-7
gtk/gtkstyleproperties.c
gtk/gtkstyleproperties.c
+46
-7
No files found.
gtk/gtkstyleproperties.c
View file @
d865cf4b
...
...
@@ -575,10 +575,13 @@ gtk_style_properties_set_property (GtkStyleProperties *props,
return
;
}
if
(
node
->
property_type
==
GDK_TYPE_RGBA
)
if
(
node
->
property_type
==
GDK_TYPE_RGBA
||
node
->
property_type
==
GDK_TYPE_COLOR
)
{
/* Allow GtkSymbolicColor as well */
g_return_if_fail
(
value_type
==
GDK_TYPE_RGBA
||
value_type
==
GTK_TYPE_SYMBOLIC_COLOR
);
g_return_if_fail
(
value_type
==
GDK_TYPE_RGBA
||
value_type
==
GDK_TYPE_COLOR
||
value_type
==
GTK_TYPE_SYMBOLIC_COLOR
);
}
else
if
(
node
->
property_type
==
CAIRO_GOBJECT_TYPE_PATTERN
)
{
...
...
@@ -727,6 +730,27 @@ resolve_color (GtkStyleProperties *props,
return
TRUE
;
}
static
gboolean
resolve_color_rgb
(
GtkStyleProperties
*
props
,
GValue
*
value
)
{
GdkColor
color
=
{
0
};
GdkRGBA
rgba
;
if
(
!
gtk_symbolic_color_resolve
(
g_value_get_boxed
(
value
),
props
,
&
rgba
))
return
FALSE
;
color
.
red
=
rgba
.
red
*
65535
.
+
0
.
5
;
color
.
green
=
rgba
.
green
*
65535
.
+
0
.
5
;
color
.
blue
=
rgba
.
blue
*
65535
.
+
0
.
5
;
g_value_unset
(
value
);
g_value_init
(
value
,
GDK_TYPE_COLOR
);
g_value_set_boxed
(
value
,
&
color
);
return
TRUE
;
}
static
gboolean
resolve_gradient
(
GtkStyleProperties
*
props
,
GValue
*
value
)
...
...
@@ -799,9 +823,17 @@ gtk_style_properties_get_property (GtkStyleProperties *props,
if
(
G_VALUE_TYPE
(
val
)
==
GTK_TYPE_SYMBOLIC_COLOR
)
{
g_return_val_if_fail
(
node
->
property_type
==
GDK_TYPE_RGBA
,
FALSE
);
if
(
!
resolve_color
(
props
,
val
))
if
(
node
->
property_type
==
GDK_TYPE_RGBA
)
{
if
(
!
resolve_color
(
props
,
val
))
return
FALSE
;
}
else
if
(
node
->
property_type
==
GDK_TYPE_COLOR
)
{
if
(
!
resolve_color_rgb
(
props
,
val
))
return
FALSE
;
}
else
return
FALSE
;
}
else
if
(
G_VALUE_TYPE
(
val
)
==
GTK_TYPE_GRADIENT
)
...
...
@@ -866,9 +898,16 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
if
(
G_VALUE_TYPE
(
val
)
==
GTK_TYPE_SYMBOLIC_COLOR
)
{
g
_return_if_fail
(
node
->
property_type
==
GDK_TYPE_RGBA
)
;
g
boolean
resolved
;
if
(
!
resolve_color
(
props
,
val
))
if
(
node
->
property_type
==
GDK_TYPE_RGBA
)
resolved
=
resolve_color
(
props
,
val
);
else
if
(
node
->
property_type
==
GDK_TYPE_COLOR
)
resolved
=
resolve_color_rgb
(
props
,
val
);
else
resolved
=
FALSE
;
if
(
!
resolved
)
val
=
&
node
->
default_value
;
}
else
if
(
G_VALUE_TYPE
(
val
)
==
GTK_TYPE_GRADIENT
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment