[gtk+] Add singleton for css number 1.0
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add singleton for css number 1.0
- Date: Thu, 7 Feb 2013 10:13:59 +0000 (UTC)
commit 7d21ec23f6a750f5a7fc2342e4522c0bf817a13a
Author: Alexander Larsson <alexl redhat com>
Date: Wed Feb 6 14:28:20 2013 +0100
Add singleton for css number 1.0
This will be nice as this is will be the default for opacity.
https://bugzilla.gnome.org/show_bug.cgi?id=687842
gtk/gtkcssnumbervalue.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index 19a5f59..ed2bfe5 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -189,7 +189,10 @@ GtkCssValue *
_gtk_css_number_value_new (double value,
GtkCssUnit unit)
{
- static GtkCssValue zero_singleton = { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 0 };
+ static GtkCssValue number_singletons[] = {
+ { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 0 },
+ { >K_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 1 },
+ };
static GtkCssValue px_singletons[] = {
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 0 },
{ >K_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 1 },
@@ -199,8 +202,8 @@ _gtk_css_number_value_new (double value,
};
GtkCssValue *result;
- if (unit == GTK_CSS_NUMBER && value == 0)
- return _gtk_css_value_ref (&zero_singleton);
+ if (unit == GTK_CSS_NUMBER && (value == 0 || value == 1))
+ return _gtk_css_value_ref (&number_singletons[(int) value]);
if (unit == GTK_CSS_PX &&
(value == 0 ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]