pike.git / src / post_modules / GTK2 / source / global.pre

version» Context lines:

pike.git/src/post_modules/GTK2/source/global.pre:4:   %{   #ifndef __NT__   #include <gdk/gdkprivate.h>   #include <gdk/gdkx.h>   #else   #include <gdk/gdkprivate.h>   #include <gdk/win32/gdkwin32.h>   #endif   /* The main stuff.. */    - int pigtk_is_setup = 0, gnome_is_setup = 0; + int pgtk2_is_setup = 0, pgnome2_is_setup = 0;   /* Not used in this file, really, but we need the require    * 'preprocessor' stuff..    */    - int IS_OBJECT_PROGRAM(struct program *X) + int pgtk2_is_object_program(struct program *X)   {   #ifdef GTK_TYPE_TEXT_ITER -  if ((X)==pgtk_text_iter_program) +  if ((X)==pgtk2_text_iter_program)    return 0;   #endif   #ifdef PANGO_TYPE_TAB_ARRAY -  if ((X)==ppango_tab_array_program) +  if ((X)==ppango2_tab_array_program)    return 0;   #endif   #ifdef GTK_TYPE_TEXT_ATTRIBUTES -  if ((X)==pgtk_text_attributes_program) +  if ((X)==pgtk2_text_attributes_program)    return 0;   #endif   #ifdef GTK_TYPE_TREE_ITER -  if ((X)==pgtk_tree_iter_program) +  if ((X)==pgtk2_tree_iter_program)    return 0;   #endif   #ifdef PANGO_TYPE_ATTR_LIST -  if ((X)==ppango_attr_list_program) +  if ((X)==ppango2_attr_list_program)    return 0;   #endif   #ifdef GTK_TYPE_TREE_PATH -  if ((X)==pgtk_tree_path_program) +  if ((X)==pgtk2_tree_path_program)    return 0;   #endif   #ifdef PANGO_TYPE_FONT_DESCRIPTION -  if ((X)==ppango_font_description_program) +  if ((X)==ppango2_font_description_program)    return 0;   #endif    return 1;   }      static void backend_callback(struct callback *_cb,    void *arg,    void *post_select)   {    if( !post_select )
pike.git/src/post_modules/GTK2/source/global.pre:69:   }      static struct callback *backend_cb;   %}   void parse_rc(string rc)   //! Takes a string and reads it as a gtkrc file.   {    char *s;    get_all_args("parse_rc",args,"%s",&s);    gtk_rc_parse_string(s); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_int(0);   /* gtk_widget_propagate_default_style(); */   }      GDK2.Window root_window()   //! Returns the root window of the current display   {    static struct object *_pgtk_root_window; -  my_pop_n_elems( args ); +  pgtk2_pop_n_elems( args );    if(_pgtk_root_window && _pgtk_root_window->prog )    {    ref_push_object( _pgtk_root_window );    return;    } else if( _pgtk_root_window )    free_object( _pgtk_root_window ); -  _pgtk_root_window = low_clone( pgdk_window_program ); +  _pgtk_root_window = low_clone( pgdk2_window_program );    call_c_initializers( _pgtk_root_window );    /* ugly...*/   #ifdef GDK_ROOT_PARENT    ((struct object_wrapper *)_pgtk_root_window->storage)->obj=    (void *)GDK_ROOT_PARENT();   #else    ((struct object_wrapper *)_pgtk_root_window->storage)->obj=    (void *)&gdk_root_parent;   #endif    add_ref( _pgtk_root_window );
pike.git/src/post_modules/GTK2/source/global.pre:121:   //! triggers, sound, user preferences). If corba init flags are specified,   //! corba initialization is done as well as gnome initialization.   //! corba_init_flags is 0 or more of GNORBA_INIT_SERVER_FUNC (1),   //! GNORBA_INIT_DISABLE_COOKIES (2) and GNORBA_INIT_CORBA_PRIO_HIGH (4)   {    gchar **data;    char *id, *vers;    gint argc;    INT_TYPE flags=0;    -  if( pigtk_is_setup ) +  if( pgtk2_is_setup )    Pike_error( "You should only call GTK2.setup_gtk() or Gnome.init() once\n");       switch( args )    {    default:    Pike_error( "Too few arguments, expected at least 3\n");    case 4:    flags = PGTK_GETINT( Pike_sp-1 );    case 3:    if( !PGTK_ISSTR( Pike_sp-args ) ||    !PGTK_ISSTR( Pike_sp-args+1 ) )    Pike_error("Illegal argument to Gnome.init()\n");    id = PGTK_GETSTR( Pike_sp-args );    vers = PGTK_GETSTR( Pike_sp-args+1 );    data = get_argv( &argc, args-2 );    } -  gnome_is_setup = 1; -  pigtk_is_setup = 1; +  pgnome2_is_setup = 1; +  pgtk2_is_setup = 1;       gtk_set_locale();      /*    if( args == 4 )    applet_widget_init( id, vers, argc, data, NULL, flags, NULL );    else   */    gnome_program_init(id,vers,LIBGNOMEUI_MODULE,argc,data,GNOME_PARAM_NONE);       backend_cb = (void *)add_backend_callback( backend_callback, 0, 0);    -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_and_free_argv( data, argc, 1 );   }      /*   void applet_widget_gtk_main_quit()   //! Exit from the applet_widget_gtk_main function on the next iteration.   {    gtk_main_quit();   }   
pike.git/src/post_modules/GTK2/source/global.pre:235:   //! The single argument, if supplied, is the argument array passed to   //! the program. This is used to set default window titles etc.   //! The second argument, if supplied, indicates that pike specific *rc files   //! should <b>not</b> be parsed.   //! <p>   //! The most common usage is GTK2.setup_gtk(argv);</p>   {    gchar **data;    int argc;    -  if (pigtk_is_setup) +  if (pgtk2_is_setup)    Pike_error("You should only call GTK2.setup_gtk() or Gnome.init() once\n");       if (args)    data=get_argv(&argc,args);    else {    data=g_malloc(sizeof(char *)*2);    if (data==NULL)    SIMPLE_OUT_OF_MEMORY_ERROR("setup_gtk",sizeof(char *)*2);    data[0]=g_strdup("Pike GTK");    argc=1;    } -  pigtk_is_setup=1; +  pgtk2_is_setup=1;    gtk_set_locale();    gtk_init(&argc,&data);    g_type_init();       backend_cb=(void *)add_backend_callback(backend_callback,0,0); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_and_free_argv(data,argc,0);   }      void flush()   //! Flush GDK. Not normally needed, can be useful while doing calculations.   {    gdk_flush();    while(g_main_iteration( 0 ) ); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_int(0);   }      void low_flush()   //! Flush, but do not process events. Not normally needed.   {   #ifndef __NT__    XFlush( GDK_DISPLAY() );   #else    gdk_flush();   #endif -  my_pop_n_elems( args ); +  pgtk2_pop_n_elems( args );    push_int( 0 );   }      array(string) gtk_init(array(string)|void argc, int|void no_pgtkrc)   //! Low level GTK init function (used by setup_gtk).   //! This function is more or less equivalent to the C-GTK+ function gtk_init.   //! setup_gtk does some extra things (such as parsing ~/.pgtkrc).   { -  pgtk_setup_gtk( args ); +  pgtk2_setup_gtk( args );   }         void main()   //! Start GTK in blocking mode.<br />   //! Doing this disables asynchronous I/O in pike.<br />   //! You can return -1 from main in pike to run GTK (and the rest of   //! pike) in asynchronous mode.   { -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    gtk_main();   }      void main_quit()   //! Exit from the gtk_main function on the next iteration.   { -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    gtk_main_quit();   }      int main_level()   //! Return the current recursion depth.   { -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_int( gtk_main_level() );   }      int main_iteration_do(int block)   //! Run one iteration in the mainloop. If block is true, wait for an   //! event before returning.   {    INT_TYPE n;    get_all_args( "gtk_main_iteration_do", args, "%i", &n ); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_int( g_main_iteration( n ) );   }      int true()   //! Always returns true.   { -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_int(1);   }      int false()   //! Always returns false.   { -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_int(0);   }      void grab_add(GTK2.Widget widget)   //! Grab a widget.   {    struct object *o;    get_all_args("gtk_grab_add",args,"%o",&o);    gtk_grab_add(GTK_WIDGET(get_gobject(o))); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }      void grab_remove(GTK2.Widget widget)   //! Remove the grab.   {    struct object *o;    get_all_args("gtk_grab_remove",args,"%o",&o);    gtk_grab_remove(GTK_WIDGET(get_gobject(o))); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }         require x11;      /* Low-level X11 related functions */   %{   #ifdef HAVE_XDPMS   #include <X11/Xext.h>   #include <X11/extensions/dpms.h>
pike.git/src/post_modules/GTK2/source/global.pre:375:    * TODO: Add an atexit() that restores the screensaver.    */    static int timeout_save, dpms_off;   %}      void saver_disable( )   //! Disable the screensaver.   //! This is a low-level X11 function, and thus only works when GDK uses X11   {    int interval, prefer_blank, allow_exp; -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    XGetScreenSaver(GDK_DISPLAY(),    &timeout_save, &interval, &prefer_blank, &allow_exp);    if (timeout_save)    XSetScreenSaver(GDK_DISPLAY(), 0, interval, prefer_blank, allow_exp);      #ifdef HAVE_XDPMS    if (DPMSQueryExtension(GDK_DISPLAY(), &interval, &interval))    {    CARD16 state;    DPMSInfo(GDK_DISPLAY(), &state, &dpms_off);    if (dpms_off)    DPMSDisable(mDisplay); /* monitor powersave off */    }   #endif   }      void saver_enable( )   //! Enable the screensaver again after @[saver_disable] has been called.   //! This is a low-level X11 function, and thus only works when GDK uses X11.   { -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    if( timeout_save )    {    int dummy, interval, prefer_blank, allow_exp;    XGetScreenSaver(GDK_DISPLAY(),    &dummy, &interval, &prefer_blank, &allow_exp);    XSetScreenSaver(GDK_DISPLAY(),    timeout_save, interval, prefer_blank, allow_exp);    }      #ifdef HAVE_XDPMS
pike.git/src/post_modules/GTK2/source/global.pre:425:      void move_cursor( int dx, int dy )   //! Move the mouse-cursor dx,dy pixels, relative to it's current position.   //! This will generate a normal motion event.   //!   //! Note that this is a low-level X11 function, and thus only works   //! when GDK uses X11.   {    INT_TYPE x, y;    get_all_args( "move_cursor", args, "%i%i", &x, &y ); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    XWarpPointer( GDK_DISPLAY(), None, None, 0, 0, 0, 0, x, y );   }      void move_cursor_abs( GDK2.Window w, int dx, int dy )   //! Move the mouse-cursor to x,y, relative to the upper left corner of   //! the specified window. This will generate a normal motion event.   //!   //! Note that this is a low-level X11 function, and thus only works   //! when GDK uses X11.   {    INT_TYPE x, y;    struct object *o;    GdkWindowPrivate *priv;    get_all_args("move_cursor_abs",args,"%o%i%i",&o,&x,&y);    priv = (GdkWindowPrivate *)get_gdkobject( o, window );    if( !priv )    Pike_error("No window specified!\n");    XWarpPointer(GDK_DISPLAY(),None,priv->xwindow,0,0,0,0,x,y); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }      endrequire; /* x11 */      require gtk22;   array(mapping(string:mixed)) get_formats()   //! Get information about the image formats supported.   {    GSList *gsl,*gs2;    gchar **gca;    int i=0,j,k; -  pgtk_verify_setup(); -  my_pop_n_elems(args); +  pgtk2_verify_setup(); +  pgtk2_pop_n_elems(args);    gs2=gsl=gdk_pixbuf_get_formats();    while (gs2) {    i++;    k=0;    ref_push_string(_STR("name"));    push_text(gdk_pixbuf_format_get_name(gs2->data));    k++;       ref_push_string(_STR("description"));    push_text(gdk_pixbuf_format_get_description(gs2->data));
pike.git/src/post_modules/GTK2/source/global.pre:535:   //! and size.   {    GdkPixbufFormat *gpf;    gchar **gca;    int j,k;    char *filename;    int width,height;       get_all_args("get_file_info",args,"%s",&filename);    gpf=gdk_pixbuf_get_file_info(filename,&width,&height); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    k=0;       ref_push_string(_STR("name"));    push_text(gdk_pixbuf_format_get_name(gpf));    k++;       ref_push_string(_STR("description"));    push_text(gdk_pixbuf_format_get_description(gpf));    k++;   
pike.git/src/post_modules/GTK2/source/global.pre:608:    f_aggregate_mapping(k*2);   }      void set_default_icon(GDK2.Pixbuf icon)   //! Sets an icon to be used as fallback for windows that haven't had set_icon()   //! called on them from a pixbuf.   {    struct object *o1;    get_all_args("set_default_icon",args,"%o",&o1);    gtk_window_set_default_icon(GDK_PIXBUF(get_gobject(o1))); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;      require gtk22;   void set_default_icon_from_file(string filename)   //! Sets an icon to be used as fallback for windows that haven't had   //! set_icon_list() called on them from a file on disk.   {    struct svalue *sv;    get_all_args("set_default_icon_from_file",args,"%*",&sv);       gtk_window_set_default_icon_from_file(PGTK_GETSTR(sv),NULL); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;         require gtk26;   void set_default_icon_name(string name)   //! Sets an icon to be as fallback for windows that haven't had set_icon_list()   //! called on them from a themed icon.   {    char *s;    get_all_args("set_default_icon_name",args,"%s",&s);    gtk_window_set_default_icon_name(s); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;      array(GTK2.Widget) list_toplevels()   //! Returns a list of all existing toplevel windows.   {    GList *gl=gtk_window_list_toplevels();    GList *g2=gl;    int i=0; -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    while (g2) {    push_gobject(g2->data);    i++;    g2=g_list_next(g2);    }    f_aggregate(i);    g_list_free(gl);   }      array(GDK2.Pixbuf) get_default_icon_list()   //! Gets the value set by set_default_icon_list().   {    GList *gl=gtk_window_get_default_icon_list();    GList *g2=gl;    int i=0; -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    while (g2) {    push_gobject(g2->data);    g_object_ref(GDK_PIXBUF(g2->data));    i++;    g2=g_list_next(g2);    }    f_aggregate(i);    g_list_free(gl);   }   
pike.git/src/post_modules/GTK2/source/global.pre:695:    if ((ITEM(a)+i)->type!=PIKE_T_OBJECT)    continue;    gp=GDK_PIXBUF(get_gobject((ITEM(a)+i)->u.object));    if (gp)    gl=g_list_append(gl,gp);    }    if (gl) {    gtk_window_set_default_icon_list(gl);    g_list_free(gl);    } -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }      require gtk24;   void set_default_icon(GDK2.Pixbuf pix)   //! Sets an icon to be used as fallback for windows that haven't had   //! set_icon() called on them.   {    struct object *o1;    GdkPixbuf *gp;       get_all_args("set_default_icon",args,"%o",&o1);    gp=GDK_PIXBUF(get_gobject(o1));    if (gp)    gtk_window_set_default_icon(gp); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;      require gtk22;   void set_default_icon_from_file(string filename)   //! Sets an icon to be used as fallback from a file on disk.   {    GError *err=NULL;    char *filename;    int res;       get_all_args("set_default_icon_from_file",args,"%s",&filename);    res=gtk_window_set_default_icon_from_file(filename,&err);    if (!res)    Pike_error("Unable to set icon from file %s: %s\n",filename,err->message); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;      require gtk26;   void set_default_icon_name(string name)   //! Sets an icon to be used as fallback for windows that haven't had   //! set_icon_list() called on them from a named themed icon.   {    struct pike_string *t;       get_all_args("set_default_icon_name",args,"%T",&t);    if (t) {    ref_push_string(t);    f_string_to_utf8(1);    gtk_window_set_default_icon_name(CGSTR0(Pike_sp[-1].u.string));    pop_stack();    } -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;      require gtk24;   GTK2.IconTheme get_default_icon_theme()   //! Gets the icon theme.   {    GtkIconTheme *git=gtk_icon_theme_get_default(); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);    push_gobject(git);   }      void add_builtin_icon(string name, int size, GDK2.Pixbuf pixbuf)   //! Registers a built-in icon for icon theme lookups. The idea of build-in   //! icons is to allow an application or library that uses themed icons to   //! function requiring files to be present in the file system. For instance,   //! the default images for all of GTK2+'s stock icons are registered as built-in   //! icons.   //! <p>   //! In general, if you use add_builtin_icon() you should also install the icon   //! in the icon theme, so that the icon is generally available.   { -  pgtk_verify_inited(); +  pgtk2_verify_inited();    {    char *name;    INT_TYPE size;    struct object *o1;    get_all_args("add_builtin_icon",args,"%s%i%o",&name,&size,&o1);    gtk_icon_theme_add_builtin_icon(name,size,GDK_PIXBUF(get_gobject(o1)));    } -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;      require gtk22;   void set_auto_startup_notification(int setting)   //! By default, after showing the first GTK2.Window for each GDK2.Screen,   //! GTK+ calls GDK2.Screen->notify_startup_complete(). Call this function to   //! disable the automatic startup notification. You might do this if your   //! first window is a splash screen, and you want to delay notification until   //! after your real main window has been shown, for example.   //! <p>   //! In that example, you would disable startup notification temporarily,   //! show your splash screen, then re-enable it so that showing the main   //! window would automatically result in notification.   {    INT_TYPE set;       get_all_args("set_auto_startup_notification",args,"%i",&set);    gtk_window_set_auto_startup_notification(set); -  my_pop_n_elems(args); +  pgtk2_pop_n_elems(args);   }   endrequire;      array(int) version()   //! Returns the version of the GTK library.   {    pop_n_elems(args);    push_int( gtk_major_version );    push_int( gtk_minor_version );    push_int( gtk_micro_version );