From fc7775cb2933eec89df7c0940f6b9abce7053643 Mon Sep 17 00:00:00 2001 From: Marcus Comstedt <marcus@mc.pp.se> Date: Tue, 21 Nov 2000 18:54:38 +0100 Subject: [PATCH] Windows NT compatibility fixes. Rev: src/post_modules/GTK/source/gdkdrawable.pre:1.9 Rev: src/post_modules/GTK/source/gdkgc.pre:1.9 Rev: src/post_modules/GTK/source/gdkpixmap.pre:1.9 Rev: src/post_modules/GTK/source/gdkwindow.pre:1.13 Rev: src/post_modules/GTK/source/global.pre:1.16 Rev: src/post_modules/GTK/source/gtkclist.pre:1.8 Rev: src/post_modules/GTK/source/gtkpaned.pre:1.4 Rev: src/post_modules/GTK/source/gtksocket.pre:1.7 Rev: src/post_modules/GTK/source/gtkwidget.pre:1.11 --- src/post_modules/GTK/source/gdkdrawable.pre | 6 ++++-- src/post_modules/GTK/source/gdkgc.pre | 4 ++++ src/post_modules/GTK/source/gdkpixmap.pre | 6 ++++++ src/post_modules/GTK/source/gdkwindow.pre | 13 +++++++------ src/post_modules/GTK/source/global.pre | 15 ++++++++++++--- src/post_modules/GTK/source/gtkclist.pre | 3 ++- src/post_modules/GTK/source/gtkpaned.pre | 4 ++-- src/post_modules/GTK/source/gtksocket.pre | 4 +++- src/post_modules/GTK/source/gtkwidget.pre | 2 ++ 9 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/post_modules/GTK/source/gdkdrawable.pre b/src/post_modules/GTK/source/gdkdrawable.pre index c91ec1d45f..b0a9402e38 100644 --- a/src/post_modules/GTK/source/gdkdrawable.pre +++ b/src/post_modules/GTK/source/gdkdrawable.pre @@ -1,6 +1,8 @@ class GdkDrawable; #ifndef __NT__ #include <gdk/gdkx.h> +#else +#include <gdk/win32/gdkwin32.h> #endif // The GDK.Bitmap, GDK.Window and GDK.Pixmap classes are all GDK drawables. // <br /> @@ -194,7 +196,7 @@ NAME_ARGS(gc,bitmap,xsrc,ysrc,xdest,ydest,width,height); FUNCTION(xid, "function(void:int)" ) { pop_n_elems( args ); - push_int(GDK_WINDOW_XWINDOW( (GdkWindow *)THIS->obj )); + push_int((INT_TYPE)GDK_WINDOW_XWINDOW( (GdkWindow *)THIS->obj )); } FUNCTION(draw_image, "function(object,object,int,int,int,int,int,int:object)"); @@ -205,7 +207,7 @@ NAME_ARGS(gc,image,xsrc,ysrc,xdest,ydest,width,height); { struct object *g, *p; INT_TYPE xs, ys, xd, yd, w, h; - get_all_args("draw_pixmap",args,"%o%o%d%d%d%d%d%d", + get_all_args("draw_image",args,"%o%o%d%d%d%d%d%d", &g,&p,&xs,&ys,&xd,&yd,&w,&h); gdk_draw_image(TWIN,GC(g),get_gdkobject(p,Image),xs,ys,xd,yd,w,h); RETURN_THIS(); diff --git a/src/post_modules/GTK/source/gdkgc.pre b/src/post_modules/GTK/source/gdkgc.pre index baedc03bf9..f6be8d3a73 100644 --- a/src/post_modules/GTK/source/gdkgc.pre +++ b/src/post_modules/GTK/source/gdkgc.pre @@ -58,7 +58,11 @@ RETURNS(mapping(string:mixed)); if( v.clip_mask ) gdk_pixmap_ref( v.clip_mask ); push_text( "fill" ); push_int( v.fill ); +#ifdef __NT__ + push_text( "tile" ); push_gdkobject( v.tile, Pixmap ); +#else push_text( "tile" ); push_int( v.tile ); +#endif push_text( "function" ); push_int( v.function ); { GdkColor *f = malloc( sizeof( GdkColor ) ); diff --git a/src/post_modules/GTK/source/gdkpixmap.pre b/src/post_modules/GTK/source/gdkpixmap.pre index 0bd282a45e..432f759f02 100644 --- a/src/post_modules/GTK/source/gdkpixmap.pre +++ b/src/post_modules/GTK/source/gdkpixmap.pre @@ -8,6 +8,12 @@ inherit GdkDrawable; // // NOIMG %{ +#ifdef __NT__ +#include <gdk/win32/gdkwin32.h> +#else +#include <gdk/gdkx.h> +#endif + GdkImage *pgtk_pixmap_setup( struct object *o, int *free) { if(get_gdkobject( o, Image )) diff --git a/src/post_modules/GTK/source/gdkwindow.pre b/src/post_modules/GTK/source/gdkwindow.pre index 585d2d8c9c..3390687d3d 100644 --- a/src/post_modules/GTK/source/gdkwindow.pre +++ b/src/post_modules/GTK/source/gdkwindow.pre @@ -2,6 +2,8 @@ class GdkWindow; inherit GdkDrawable; #ifndef __NT__ #include <gdk/gdkx.h> +#else +#include <gdk/win32/gdkwin32.h> #endif // a GDK.Window object. // @@ -413,10 +415,13 @@ NAME_ARGS(property, offset, delete_when_done); else get_all_args( "get_property", args, "%o", &o); - if(gdk_property_get( (GdkWindow *)THIS->obj, get_gdkatom(o), +#ifdef AnyPropertyType AnyPropertyType, +#else + None, +#endif offset, 1024*1024*1024, delete_when_done, @@ -446,11 +451,7 @@ NAME_ARGS(property, offset, delete_when_done); push_Xpseudo32bitstring( retdata, actual_length ); break; } -#ifndef __NT__ - XFree( retdata ); -#else - gfree( retdata ); -#endif + g_free( retdata ); f_aggregate_mapping( 6 ); return; } diff --git a/src/post_modules/GTK/source/global.pre b/src/post_modules/GTK/source/global.pre index bbe5f033cc..eae6b15d23 100644 --- a/src/post_modules/GTK/source/global.pre +++ b/src/post_modules/GTK/source/global.pre @@ -1,5 +1,7 @@ #ifndef __NT__ #include <gdk/gdkx.h> +#else +#include <gdk/win32/gdkwin32.h> #endif require gnome; #include <applet-widget.h> @@ -24,7 +26,7 @@ int IS_OBJECT_PROGRAM(struct program *X) || ((X) == pgtk_selection_data_program)); } -static void backend_callback() +static void backend_callback(struct callback *_cb,void *_x,void *_y) { next_timeout = current_time; #ifndef __NT__ @@ -70,8 +72,13 @@ RETURNS(GDK.Window); pgtk_root_window = low_clone( pgtk_GdkWindow_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); ref_push_object( pgtk_root_window ); @@ -214,7 +221,7 @@ NAME_ARGS(argv, do_not_parse_rc); typedef RETSIGTYPE (*sigtype)(int); sigtype save_sigs[NSIG]; for(sig=1;sig<NSIG;sig++) - signal(e,save_sigs[e]=signal(e,SIG_IGN)); + signal(sig,save_sigs[sig]=signal(sig,SIG_IGN)); #endif /* HAVE_SIGNAL */ #endif /* ! HAVE_SIGACTION */ @@ -280,7 +287,7 @@ NAME_ARGS(argv, do_not_parse_rc); #else /* HAVE_SIGACTION */ #if HAVE_SIGNAL for(sig=1;sig<NSIG;sig++) - signal(e,save_sigs[e]); + signal(sig,save_sigs[sig]); #endif /* HAVE_SIGNAL */ #endif /* HAVE_SIGACTION */ backend_cb = (void *)add_backend_callback( backend_callback, 0, 0); @@ -320,7 +327,9 @@ FUNCTION(flush, "function(void:void)") FUNCTION(low_flush, "function(void:void)") // Flush X. Not normally needed. { +#ifndef __NT__ XFlush( GDK_DISPLAY() ); +#endif my_pop_n_elems( args ); push_int( 0 ); } diff --git a/src/post_modules/GTK/source/gtkclist.pre b/src/post_modules/GTK/source/gtkclist.pre index 17507da55d..c05cf1d868 100644 --- a/src/post_modules/GTK/source/gtkclist.pre +++ b/src/post_modules/GTK/source/gtkclist.pre @@ -236,7 +236,8 @@ NAME_ARGS(row, column); // Return the pixmap and text for the specified cell as a mapping:<br /> // ([ "spacing":spacing, "text":text, "pixmap":pixmap ]) { - INT_TYPE x, y, s; + INT_TYPE x, y; + guint8 s; gchar *t = NULL; GdkPixmap *p = NULL; GdkBitmap *b = NULL; diff --git a/src/post_modules/GTK/source/gtkpaned.pre b/src/post_modules/GTK/source/gtkpaned.pre index 338ac34be7..f27f65ee2a 100644 --- a/src/post_modules/GTK/source/gtkpaned.pre +++ b/src/post_modules/GTK/source/gtkpaned.pre @@ -48,8 +48,8 @@ void pack2( widget widget, int resize, int shrink ); member int handle_size; // The size of the handle, in pixels -member int gutter_size; -// The size of the gutter, in pixels +/* member int gutter_size; + * // The size of the gutter, in pixels */ member int handle_xpos; // The xpos of the handle, in pixels member int handle_ypos; diff --git a/src/post_modules/GTK/source/gtksocket.pre b/src/post_modules/GTK/source/gtksocket.pre index f7d7b0b851..59562468f9 100644 --- a/src/post_modules/GTK/source/gtksocket.pre +++ b/src/post_modules/GTK/source/gtksocket.pre @@ -2,6 +2,8 @@ class socket; inherit container; #ifndef __NT__ #include <gdk/gdkx.h> +#else +#include <gdk/win32/gdkwin32.h> #endif // Together with W(Plug), GTK.Socket provides the ability to embed // widgets from one process into another process in a fashion that is @@ -34,7 +36,7 @@ FUNCTION(id, "function(void:int)"); if( !GTK_WIDGET( THIS->obj )->window ) error("You must realize this widget before calling this function.\n"); my_pop_n_elems( args ); - push_int(GDK_WINDOW_XWINDOW( GTK_WIDGET( THIS->obj )->window )); + push_int((INT_TYPE)GDK_WINDOW_XWINDOW( GTK_WIDGET( THIS->obj )->window )); } FUNCTION(has_plug, "function(void:int)"); diff --git a/src/post_modules/GTK/source/gtkwidget.pre b/src/post_modules/GTK/source/gtkwidget.pre index 88eb4299cd..e44c9fdc5c 100644 --- a/src/post_modules/GTK/source/gtkwidget.pre +++ b/src/post_modules/GTK/source/gtkwidget.pre @@ -309,6 +309,8 @@ string get_name(); #ifndef __NT__ #include <gdk/gdkx.h> +#else +#include <gdk/win32/gdkwin32.h> #endif FUNCTION(set_cursor, "function(int,void|object,void|object:object)"); ARGS(int|void,void|GDK.Color,void|GDK.Color); -- GitLab