minor canvas API fix
- From: Tim Janik <timj gtk org>
- To: 2001-11-27 jacob berkman <jacob ximian com>
- Cc: GnomeNG <gnome-2-0-list gnome org>
- Subject: minor canvas API fix
- Date: Wed, 12 Dec 2001 21:56:21 +0100 (CET)
hi all,
jacob recently added a gulong property to the canvas, which is a pretty
bad idea, ulong/long properties are a porting nightmare, you need
to make sure to set and get them via:
g_object_set (object, "prop", (gulong) 5, NULL);
gulong v;
g_object_get (object, "prop", &v, NULL);
or they'll break on alpha and other sizeof(int)!=sizeof(long) platforms.
also, long/int/short/char is the wrong type in the first place for a
boolean propety. the estimated impact is pretty low, the property got
added just two weeks ago, so code already using it probably just
does g_object_set (canvas, "aa", 1, NULL); anyways (i couldn't find
code using it yet though, except for gnome_canvas_new_aa() which is
already broken for alpha).
so i intend to comit the following fix to gnome canvas:
Index: libgnomecanvas/ChangeLog
===================================================================
RCS file: /cvs/gnome/libgnomecanvas/libgnomecanvas/ChangeLog,v
retrieving revision 1.103
diff -u -u -r1.103 ChangeLog
--- libgnomecanvas/ChangeLog 2001/12/12 05:19:58 1.103
+++ libgnomecanvas/ChangeLog 2001/12/12 20:46:41
@@ -1,3 +1,10 @@
+Wed Dec 12 21:45:08 2001 Tim Janik <timj gtk org>
+
+ * gnome-canvas.c (gnome_canvas_class_init): fix canvas::aa
+ property. it needs to be CONSTRUCT_ONLY because anti-aliased
+ can't be changed after construction. also, this property needs
+ to be boolean and not ulong.
+
2001-12-12 Alexander Larsson <alla lysator liu se>
* gnome-canvas-text.c (gnome_canvas_text_set_font_desc):
Index: libgnomecanvas/gnome-canvas.c
===================================================================
RCS file: /cvs/gnome/libgnomecanvas/libgnomecanvas/gnome-canvas.c,v
retrieving revision 1.140
diff -u -u -r1.140 gnome-canvas.c
--- libgnomecanvas/gnome-canvas.c 2001/12/06 22:51:35 1.140
+++ libgnomecanvas/gnome-canvas.c 2001/12/12 20:46:42
@@ -2036,8 +2036,7 @@
{
switch (prop_id) {
case PROP_AA:
- g_value_set_ulong (value,
- GNOME_CANVAS (object)->aa);
+ g_value_set_boolean (value, GNOME_CANVAS (object)->aa);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2053,7 +2052,7 @@
{
switch (prop_id) {
case PROP_AA:
- GNOME_CANVAS (object)->aa = g_value_get_ulong (value);
+ GNOME_CANVAS (object)->aa = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2102,11 +2101,11 @@
g_object_class_install_property (G_OBJECT_CLASS (object_class),
PROP_AA,
- g_param_spec_ulong ("aa",
- _("Antialiased"),
- _("The antialiasing mode of the canvas."),
- 0, 1, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_param_spec_boolean ("aa",
+ _("Antialiased"),
+ _("The antialiasing mode of the canvas."),
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
canvas_signals[DRAW_BACKGROUND] =
g_signal_new ("draw_background",
@@ -2272,7 +2271,7 @@
gnome_canvas_new_aa (void)
{
return GTK_WIDGET (g_object_new (GNOME_TYPE_CANVAS,
- "aa", 1,
+ "aa", TRUE,
NULL));
}
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]