From 99feb376aa2349b3f726c2de19b682ef0e6b4dff Mon Sep 17 00:00:00 2001 From: Per Hedbor <ph@opera.com> Date: Sun, 14 Nov 1999 01:32:33 +0100 Subject: [PATCH] Added pgtk_verify_setup() calls to most create functions lacking them Rev: src/post_modules/GTK/source/gdkatom.pre:1.3 Rev: src/post_modules/GTK/source/gdkbitmap.pre:1.3 Rev: src/post_modules/GTK/source/gdkcolor.pre:1.3 Rev: src/post_modules/GTK/source/gdkdragcontext.pre:1.3 Rev: src/post_modules/GTK/source/gdkfont.pre:1.2 Rev: src/post_modules/GTK/source/gdkgc.pre:1.2 Rev: src/post_modules/GTK/source/gdkimage.pre:1.3 Rev: src/post_modules/GTK/source/gdkpixmap.pre:1.2 Rev: src/post_modules/GTK/source/gdkrectangle.pre:1.3 Rev: src/post_modules/GTK/source/gdkregion.pre:1.3 Rev: src/post_modules/GTK/source/gdkwindow.pre:1.4 Rev: src/post_modules/GTK/source/gtkbutton.pre:1.2 Rev: src/post_modules/GTK/source/gtkcheckbutton.pre:1.2 Rev: src/post_modules/GTK/source/gtkcheckmenuitem.pre:1.2 Rev: src/post_modules/GTK/source/gtklistitem.pre:1.2 Rev: src/post_modules/GTK/source/gtkmenuitem.pre:1.2 Rev: src/post_modules/GTK/source/gtkradiobutton.pre:1.2 Rev: src/post_modules/GTK/source/gtkradiomenuitem.pre:1.3 Rev: src/post_modules/GTK/source/gtktogglebutton.pre:1.2 Rev: src/post_modules/GTK/source/gtktreeitem.pre:1.2 --- src/post_modules/GTK/source/gdkatom.pre | 1 + src/post_modules/GTK/source/gdkbitmap.pre | 1 + src/post_modules/GTK/source/gdkcolor.pre | 1 + .../GTK/source/gdkdragcontext.pre | 2 +- src/post_modules/GTK/source/gdkfont.pre | 1 + src/post_modules/GTK/source/gdkgc.pre | 1 + src/post_modules/GTK/source/gdkimage.pre | 34 +++++++++++++------ src/post_modules/GTK/source/gdkpixmap.pre | 1 + src/post_modules/GTK/source/gdkrectangle.pre | 1 + src/post_modules/GTK/source/gdkregion.pre | 1 + src/post_modules/GTK/source/gdkwindow.pre | 1 + src/post_modules/GTK/source/gtkbutton.pre | 3 +- .../GTK/source/gtkcheckbutton.pre | 3 +- .../GTK/source/gtkcheckmenuitem.pre | 3 +- src/post_modules/GTK/source/gtklistitem.pre | 3 +- src/post_modules/GTK/source/gtkmenuitem.pre | 3 +- .../GTK/source/gtkradiobutton.pre | 3 +- .../GTK/source/gtkradiomenuitem.pre | 3 +- .../GTK/source/gtktogglebutton.pre | 3 +- src/post_modules/GTK/source/gtktreeitem.pre | 3 +- 20 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/post_modules/GTK/source/gdkatom.pre b/src/post_modules/GTK/source/gdkatom.pre index 7da1ef000f..4e124928e5 100644 --- a/src/post_modules/GTK/source/gdkatom.pre +++ b/src/post_modules/GTK/source/gdkatom.pre @@ -8,6 +8,7 @@ NAME_ARGS(atom_name, only_if_exists); { char *atom_name; int only_if_exists; + pgtk_verify_setup(); get_all_args("GDK.Atom( string, int )",args,"%s%d",&atom_name,&only_if_exists); THIS->obj = (void *)gdk_atom_intern( atom_name, only_if_exists ); pop_n_elems(args); diff --git a/src/post_modules/GTK/source/gdkbitmap.pre b/src/post_modules/GTK/source/gdkbitmap.pre index 690140fa9e..eead3282bb 100644 --- a/src/post_modules/GTK/source/gdkbitmap.pre +++ b/src/post_modules/GTK/source/gdkbitmap.pre @@ -12,6 +12,7 @@ NAME_ARGS(image|xsize, void|ysize, void|xbitmapdata); { int x, y; char *d; + pgtk_verify_setup(); if(args == 3) { get_all_args("create", args, "%d%d%s", &x, &y, &d ); diff --git a/src/post_modules/GTK/source/gdkcolor.pre b/src/post_modules/GTK/source/gdkcolor.pre index 3bff682c86..79ebec67a6 100644 --- a/src/post_modules/GTK/source/gdkcolor.pre +++ b/src/post_modules/GTK/source/gdkcolor.pre @@ -13,6 +13,7 @@ NAME_ARGS(r|color,g,b); int r,g,b; GdkColormap *col = gdk_colormap_get_system(); GdkColor *c; + pgtk_verify_setup(); if( args == 1) { struct object *o; diff --git a/src/post_modules/GTK/source/gdkdragcontext.pre b/src/post_modules/GTK/source/gdkdragcontext.pre index 37fd79ae05..3dbe2fbd86 100644 --- a/src/post_modules/GTK/source/gdkdragcontext.pre +++ b/src/post_modules/GTK/source/gdkdragcontext.pre @@ -1,6 +1,6 @@ PROGRAM(GdkDragContext); // The drag context contains all information about the drag'n'drop -// connected to the signal. +// connected to the signal to which it is an argument. // <p> // NOIMG #define GTK_GDKDRAGCONTEXT(X) ((GdkDragContext *)X) diff --git a/src/post_modules/GTK/source/gdkfont.pre b/src/post_modules/GTK/source/gdkfont.pre index b7ece6e94e..364bd545ca 100644 --- a/src/post_modules/GTK/source/gdkfont.pre +++ b/src/post_modules/GTK/source/gdkfont.pre @@ -59,6 +59,7 @@ NAME_ARGS(font_name); // Create a new font object. The string is the font XLFD. { char *n; + pgtk_verify_setup(); if(args) { get_all_args("Gdk.Font", args, "%s", &n); diff --git a/src/post_modules/GTK/source/gdkgc.pre b/src/post_modules/GTK/source/gdkgc.pre index 81edb61a09..4b945f701d 100644 --- a/src/post_modules/GTK/source/gdkgc.pre +++ b/src/post_modules/GTK/source/gdkgc.pre @@ -12,6 +12,7 @@ NAME_ARGS(context); // which the gc will be valid. { struct object *o; + pgtk_verify_setup(); get_all_args("'()", args, "%o", &o); if(get_gdkobject(o, Drawable)) THIS->obj = (void *)gdk_gc_new( (GdkWindow*)get_gdkobject(o,Drawable) ); diff --git a/src/post_modules/GTK/source/gdkimage.pre b/src/post_modules/GTK/source/gdkimage.pre index 63b096387e..1a7d28af6b 100644 --- a/src/post_modules/GTK/source/gdkimage.pre +++ b/src/post_modules/GTK/source/gdkimage.pre @@ -3,21 +3,33 @@ PROGRAM(GdkImage); // Mainly used for W(Image) objects. // // NOIMG -FUNCTION(create, "function(int|void:void)"); -NAME_ARGS(fast_mode); -// Create a new GDK.Image object. The argument is either 0, which indicates that -// you want a 'slow' image. If you use '1', you indicate that you want a 'fast' -// image. Fast images are stored in shared memory, and thus are not sent over -// any network. But please limit your usage of fast images, they use up -// a possibly limited system resource set. See the man page for shmget(2) -// for more information on the limits on shared segments on your system. +FUNCTION(create, "function(int|void,object|void:void)"); +NAME_ARGS(fast_mode,image); +// Create a new GDK.Image object. The firstargument is either 0, which +// indicates that you want a 'slow' image. If you use '1', you +// indicate that you want a 'fast' image. Fast images are stored in +// shared memory, and thus are not sent over any network. But please +// limit your usage of fast images, they use up a possibly limited +// system resource set. See the man page for shmget(2) for more +// information on the limits on shared segments on your system. //<p> -// A 'fast' image will automatically revert back to 'slow' mode if no shared -// memory is available. + +// A 'fast' image will automatically revert back to 'slow' mode if no +// shared memory is available. +// <p> +// If the second argument is specified, it is the actual image data. { + void pgtk_GdkImage_set( int ); + pgtk_verify_setup(); THIS->extra_int = GDK_IMAGE_NORMAL; - if(args && sp[-1].u.integer) + if(args && sp[-args].u.integer) THIS->extra_int = GDK_IMAGE_FASTEST; + if( args == 2) + { + stack_swap(); + pop_stack(); + pgtk_GdkImage_set( 1 ); + } /* Do not add one extra ref for the internal gdk object..*/ /* add_ref(fp->current_object); */ } diff --git a/src/post_modules/GTK/source/gdkpixmap.pre b/src/post_modules/GTK/source/gdkpixmap.pre index a9327488fe..c43d325a9f 100644 --- a/src/post_modules/GTK/source/gdkpixmap.pre +++ b/src/post_modules/GTK/source/gdkpixmap.pre @@ -39,6 +39,7 @@ NAME_ARGS(image); GdkImage *i; int f = 0; struct object *o; + pgtk_verify_setup(); if(THIS->obj) error("Pixmap already initialized\n"); diff --git a/src/post_modules/GTK/source/gdkrectangle.pre b/src/post_modules/GTK/source/gdkrectangle.pre index 01b38ab3a2..c9577fe92f 100644 --- a/src/post_modules/GTK/source/gdkrectangle.pre +++ b/src/post_modules/GTK/source/gdkrectangle.pre @@ -6,6 +6,7 @@ NAME_ARGS(x,y,width,height); // NOIMG { GdkRectangle *r; + pgtk_verify_setup(); THIS->obj = (void *)(r=malloc(sizeof(GdkRectangle))); get_all_args( "GDK.Rectangle", args, "%d%d%d%d", &r->x, &r->y, &r->width, &r->height ); diff --git a/src/post_modules/GTK/source/gdkregion.pre b/src/post_modules/GTK/source/gdkregion.pre index ff0402c4a6..7ebcceee1f 100644 --- a/src/post_modules/GTK/source/gdkregion.pre +++ b/src/post_modules/GTK/source/gdkregion.pre @@ -16,6 +16,7 @@ FUNCTION(create, "function(void:void)"); // // NOIMG { + pgtk_verify_setup(); THIS->obj = (void *)gdk_region_new(); } FUNCTION(destroy, "function(void:void)"); diff --git a/src/post_modules/GTK/source/gdkwindow.pre b/src/post_modules/GTK/source/gdkwindow.pre index 2609ab4898..3fa6fbc352 100644 --- a/src/post_modules/GTK/source/gdkwindow.pre +++ b/src/post_modules/GTK/source/gdkwindow.pre @@ -8,6 +8,7 @@ ARGS(int|object,void|mapping); NAME_ARGS(XWindowID|parent,void|atrributes); // Not for non-experts. I promise. { + pgtk_verify_setup(); if(sp[-args].type == T_INT) { int id; diff --git a/src/post_modules/GTK/source/gtkbutton.pre b/src/post_modules/GTK/source/gtkbutton.pre index bcb0d2ac7f..c4481585b2 100644 --- a/src/post_modules/GTK/source/gtkbutton.pre +++ b/src/post_modules/GTK/source/gtkbutton.pre @@ -18,7 +18,8 @@ FUNCTION(create, "function(string|void:void)") NAME_ARGS(label_text); // If a string is supplied, a W(Label) is created and added to the button. { - if(THIS->obj) error("GTK.Button->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(args) { char *s; diff --git a/src/post_modules/GTK/source/gtkcheckbutton.pre b/src/post_modules/GTK/source/gtkcheckbutton.pre index d2fd1a1ece..204ac9c80d 100644 --- a/src/post_modules/GTK/source/gtkcheckbutton.pre +++ b/src/post_modules/GTK/source/gtkcheckbutton.pre @@ -12,7 +12,8 @@ NAME_ARGS(label); // If no label is specified, use object->add() to add some // other widget (such as an pixmap or image widget) { - if(THIS->obj) error("GTK.Check_button->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(args) { char *s; diff --git a/src/post_modules/GTK/source/gtkcheckmenuitem.pre b/src/post_modules/GTK/source/gtkcheckmenuitem.pre index e9de6f23f7..4ff5954ac0 100644 --- a/src/post_modules/GTK/source/gtkcheckmenuitem.pre +++ b/src/post_modules/GTK/source/gtkcheckmenuitem.pre @@ -11,7 +11,8 @@ NAME_ARGS(label); // If no label is specified, use object->add() to add some // other widget (such as an pixmap or image widget) { - if(THIS->obj) error("GTK.Check_menu_item->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(args) { char *s; diff --git a/src/post_modules/GTK/source/gtklistitem.pre b/src/post_modules/GTK/source/gtklistitem.pre index b0e19810d5..747b3f8c95 100644 --- a/src/post_modules/GTK/source/gtklistitem.pre +++ b/src/post_modules/GTK/source/gtklistitem.pre @@ -7,7 +7,8 @@ NAME_ARGS(label); // string and added to the item. Otherwise, you should add another // widget to the list item with ->add(). { - if(THIS->obj) error("GTK.List_item->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(args) { char *s; diff --git a/src/post_modules/GTK/source/gtkmenuitem.pre b/src/post_modules/GTK/source/gtkmenuitem.pre index 6294fb84db..abe0a6317d 100644 --- a/src/post_modules/GTK/source/gtkmenuitem.pre +++ b/src/post_modules/GTK/source/gtkmenuitem.pre @@ -8,7 +8,8 @@ NAME_ARGS(label); // string and added to the item. Otherwise, you should add another // widget to the list item with ->add(). { - if(THIS->obj) error("GTK.Menu_item->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(args) { char *s; diff --git a/src/post_modules/GTK/source/gtkradiobutton.pre b/src/post_modules/GTK/source/gtkradiobutton.pre index 91df965c09..9f8a055d89 100644 --- a/src/post_modules/GTK/source/gtkradiobutton.pre +++ b/src/post_modules/GTK/source/gtkradiobutton.pre @@ -26,7 +26,8 @@ NAME_ARGS(title,groupmember); o = sp[-1].u.object; } - if(THIS->obj) error("GTK.RadioButton->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(o) mylist=gtk_radio_button_group(GTK_RADIO_BUTTON(get_gtkobject(o))); diff --git a/src/post_modules/GTK/source/gtkradiomenuitem.pre b/src/post_modules/GTK/source/gtkradiomenuitem.pre index 8a914082f9..891df058c4 100644 --- a/src/post_modules/GTK/source/gtkradiomenuitem.pre +++ b/src/post_modules/GTK/source/gtkradiomenuitem.pre @@ -20,7 +20,8 @@ NAME_ARGS(title,groupmember); o = sp[-1].u.object; } - if(THIS->obj) error("GTK.Radio_group->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(o) mylist=gtk_radio_menu_item_group(GTK_RADIO_MENU_ITEM(get_gtkobject(o))); if(label) diff --git a/src/post_modules/GTK/source/gtktogglebutton.pre b/src/post_modules/GTK/source/gtktogglebutton.pre index 8fd0fe2a25..05eec566f5 100644 --- a/src/post_modules/GTK/source/gtktogglebutton.pre +++ b/src/post_modules/GTK/source/gtktogglebutton.pre @@ -14,7 +14,8 @@ NAME_ARGS(label); // If you supply a string, a label will be created and inserted in the button. // Otherwise, use ->add(widget) to create the contents of the button. { - if(THIS->obj) error("GTK.Toggle_button->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(args) { char *s; diff --git a/src/post_modules/GTK/source/gtktreeitem.pre b/src/post_modules/GTK/source/gtktreeitem.pre index 0b495d6bd9..e59e73abac 100644 --- a/src/post_modules/GTK/source/gtktreeitem.pre +++ b/src/post_modules/GTK/source/gtktreeitem.pre @@ -10,7 +10,8 @@ NAME_ARGS(label); // If you specify a string it is used as a label, otherwise pack a widget // in the tree item with ->add(widget). { - if(THIS->obj) error("GTK.Tree_item->create() can only be called once.\n"); + pgtk_verify_not_inited(); + pgtk_verify_setup(); if(args) { char *s; -- GitLab