From: Tor Lillqvist Date: Sun, 25 Apr 1999 21:55:05 +0000 (+0000) Subject: Support added for building using a GNU toolchain on Win32, X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=1c84483f3ee8559179b49a200d3cc6854e81b873;hp=eedec945df8925c97e924692b08487a292c01580;p=~andy%2Fgtk Support added for building using a GNU toolchain on Win32, gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. * config.h.win32: Changes for gcc. * gdk/gdkrectangle.c: Include gdk.h as . * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. Protect shl stuff unavaiilable with mingw32 headers. * gdk/win32/gdkevents.c: Fix typo. * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. * gdk/win32/gdkprivate.h: Make up for some stuff missing from the mingw32 headers. * gdk/win32/makefile.msc: Use latest Wintab kit and glib. * gtk/gtkfilesel.c: Include early, to get stat->_stat definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. Test for NATIVE_WIN32, not _MSC_VER. * gtk/gtkmain.c: No use warning about developer version on Win32, there aren't any non-developer versions anyhow. * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. * gtk/makefile.msc: Use pthread from another directory. Minor other changes. --- diff --git a/ChangeLog b/ChangeLog index 4a78e24ce..a7dd2f78f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +1999-04-25 Tor Lillqvist + + Support added for building using a GNU toolchain on Win32, + gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. + + * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. + * config.h.win32: Changes for gcc. + * gdk/gdkrectangle.c: Include gdk.h as . + * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. + * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. + * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. + Protect shl stuff unavaiilable with mingw32 headers. + * gdk/win32/gdkevents.c: Fix typo. + * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. + * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) + * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. + * gdk/win32/gdkprivate.h: Make up for some stuff missing from + the mingw32 headers. + * gdk/win32/makefile.msc: Use latest Wintab kit and glib. + * gtk/gtkfilesel.c: Include early, to get stat->_stat + definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. + Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkmain.c: No use warning about developer version on Win32, + there aren't any non-developer versions anyhow. + * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. + * gtk/makefile.msc: Use pthread from another directory. Minor other + changes. + Wed Apr 21 14:20:22 1999 George Lebl * gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 4a78e24ce..a7dd2f78f 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,32 @@ +1999-04-25 Tor Lillqvist + + Support added for building using a GNU toolchain on Win32, + gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. + + * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. + * config.h.win32: Changes for gcc. + * gdk/gdkrectangle.c: Include gdk.h as . + * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. + * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. + * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. + Protect shl stuff unavaiilable with mingw32 headers. + * gdk/win32/gdkevents.c: Fix typo. + * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. + * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) + * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. + * gdk/win32/gdkprivate.h: Make up for some stuff missing from + the mingw32 headers. + * gdk/win32/makefile.msc: Use latest Wintab kit and glib. + * gtk/gtkfilesel.c: Include early, to get stat->_stat + definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. + Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkmain.c: No use warning about developer version on Win32, + there aren't any non-developer versions anyhow. + * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. + * gtk/makefile.msc: Use pthread from another directory. Minor other + changes. + Wed Apr 21 14:20:22 1999 George Lebl * gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4a78e24ce..a7dd2f78f 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,32 @@ +1999-04-25 Tor Lillqvist + + Support added for building using a GNU toolchain on Win32, + gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. + + * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. + * config.h.win32: Changes for gcc. + * gdk/gdkrectangle.c: Include gdk.h as . + * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. + * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. + * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. + Protect shl stuff unavaiilable with mingw32 headers. + * gdk/win32/gdkevents.c: Fix typo. + * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. + * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) + * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. + * gdk/win32/gdkprivate.h: Make up for some stuff missing from + the mingw32 headers. + * gdk/win32/makefile.msc: Use latest Wintab kit and glib. + * gtk/gtkfilesel.c: Include early, to get stat->_stat + definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. + Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkmain.c: No use warning about developer version on Win32, + there aren't any non-developer versions anyhow. + * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. + * gtk/makefile.msc: Use pthread from another directory. Minor other + changes. + Wed Apr 21 14:20:22 1999 George Lebl * gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 4a78e24ce..a7dd2f78f 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,32 @@ +1999-04-25 Tor Lillqvist + + Support added for building using a GNU toolchain on Win32, + gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. + + * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. + * config.h.win32: Changes for gcc. + * gdk/gdkrectangle.c: Include gdk.h as . + * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. + * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. + * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. + Protect shl stuff unavaiilable with mingw32 headers. + * gdk/win32/gdkevents.c: Fix typo. + * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. + * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) + * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. + * gdk/win32/gdkprivate.h: Make up for some stuff missing from + the mingw32 headers. + * gdk/win32/makefile.msc: Use latest Wintab kit and glib. + * gtk/gtkfilesel.c: Include early, to get stat->_stat + definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. + Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkmain.c: No use warning about developer version on Win32, + there aren't any non-developer versions anyhow. + * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. + * gtk/makefile.msc: Use pthread from another directory. Minor other + changes. + Wed Apr 21 14:20:22 1999 George Lebl * gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 4a78e24ce..a7dd2f78f 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,32 @@ +1999-04-25 Tor Lillqvist + + Support added for building using a GNU toolchain on Win32, + gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. + + * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. + * config.h.win32: Changes for gcc. + * gdk/gdkrectangle.c: Include gdk.h as . + * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. + * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. + * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. + Protect shl stuff unavaiilable with mingw32 headers. + * gdk/win32/gdkevents.c: Fix typo. + * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. + * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) + * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. + * gdk/win32/gdkprivate.h: Make up for some stuff missing from + the mingw32 headers. + * gdk/win32/makefile.msc: Use latest Wintab kit and glib. + * gtk/gtkfilesel.c: Include early, to get stat->_stat + definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. + Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkmain.c: No use warning about developer version on Win32, + there aren't any non-developer versions anyhow. + * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. + * gtk/makefile.msc: Use pthread from another directory. Minor other + changes. + Wed Apr 21 14:20:22 1999 George Lebl * gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4a78e24ce..a7dd2f78f 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,32 @@ +1999-04-25 Tor Lillqvist + + Support added for building using a GNU toolchain on Win32, + gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. + + * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. + * config.h.win32: Changes for gcc. + * gdk/gdkrectangle.c: Include gdk.h as . + * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. + * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. + * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. + Protect shl stuff unavaiilable with mingw32 headers. + * gdk/win32/gdkevents.c: Fix typo. + * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. + * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) + * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. + * gdk/win32/gdkprivate.h: Make up for some stuff missing from + the mingw32 headers. + * gdk/win32/makefile.msc: Use latest Wintab kit and glib. + * gtk/gtkfilesel.c: Include early, to get stat->_stat + definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. + Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkmain.c: No use warning about developer version on Win32, + there aren't any non-developer versions anyhow. + * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. + * gtk/makefile.msc: Use pthread from another directory. Minor other + changes. + Wed Apr 21 14:20:22 1999 George Lebl * gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4a78e24ce..a7dd2f78f 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,32 @@ +1999-04-25 Tor Lillqvist + + Support added for building using a GNU toolchain on Win32, + gcc -mno-cygwin (egcs-1.1.2) on cygwin-b20.1. + + * gdk/win32/makefile.cygwin gtk/makefile.cygwin: New files. + * config.h.win32: Changes for gcc. + * gdk/gdkrectangle.c: Include gdk.h as . + * gdk/gdkcolor.c: config.h.win32 already defines strcasecmp. + * gdk/win32/gdkconfig.h: Only the MS compiler has wctype.h. + * gdk/win32/gdkdnd.c: Protect (unused) OLE2 stuff better. + Protect shl stuff unavaiilable with mingw32 headers. + * gdk/win32/gdkevents.c: Fix typo. + * gdk/win32/gdkglobals.c: Use GDKVAR here also for gcc. + * gdk/win32/gdkim.c: Use OEM code page for multibyte chars. (?) + * gdk/win32/gdkinput.c: Use __try __except only with the MS compiler. + * gdk/win32/gdkprivate.h: Make up for some stuff missing from + the mingw32 headers. + * gdk/win32/makefile.msc: Use latest Wintab kit and glib. + * gtk/gtkfilesel.c: Include early, to get stat->_stat + definition on Win32. Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkfontsel.c: Protect CHARSET redefinition on Win32. + Test for NATIVE_WIN32, not _MSC_VER. + * gtk/gtkmain.c: No use warning about developer version on Win32, + there aren't any non-developer versions anyhow. + * gtk/gtkrc.c: Test for NATIVE_WIN32, not _MSC_VER. + * gtk/makefile.msc: Use pthread from another directory. Minor other + changes. + Wed Apr 21 14:20:22 1999 George Lebl * gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the diff --git a/README.win32 b/README.win32 index cdf266d25..a0f433e0d 100644 --- a/README.win32 +++ b/README.win32 @@ -3,12 +3,15 @@ correct as the Unix/X11 version. For more information about the Win32 port, see http://www.gimp.org/tml/gimp/win32/ or http://www.iki.fi/tml/gimp/win32/ . -As for now, only Microsoft C (the command-line compiler) is -supported. Before compiling, check the BIN definition in -gdk\win32\makefile.msc and gtk\makefile.msc. Compile in gdk\win32 and -gtk with `nmake -f makefile.msc`. Install with `nmake -f makefile.msc -install`. Cygwin ("mingw32", i.e. gcc -mno-cygwin) support will be -added later. +To build GTk+ on Win32, you need either Microsoft compiler and tools, +or egcs-1.1.2 running under cygwin-b20.1. Before compiling, check the +BIN definition in gdk\win32\makefile.msc (or makefile.cygwin) and +gtk\makefile.msc (or makefile.cygwin). Compile in gdk\win32 and gtk +with `nmake -f makefile.msc` or `make -f makefile.cygwin`. + +See the README.win32 file in the GLib distribution for preparations to +build with egcs on cygwin. The tablet support uses the Wintab API. The Wintab development kit can be downloaded from http://www.pointing.com. + diff --git a/config.h.win32 b/config.h.win32 index 77a8137bd..6bfa08138 100755 --- a/config.h.win32 +++ b/config.h.win32 @@ -1,6 +1,6 @@ /* config.h.win32. Handcrafted for Microsoft C */ -#ifndef _MSC_VER +#if ! (defined(_MSC_VER) || defined(__GNUC__)) #error Unrecognized Win32 compiler, edit config.h.win32 by hand #endif @@ -16,7 +16,11 @@ /* Define if you have alloca, as a function or macro. */ #define HAVE_ALLOCA 1 +#ifdef _MSC_VER #define alloca _alloca +#elif defined (__GNUC__) +#define alloca __builtin_alloca +#endif /* Define if you have and it should be used (not on Ultrix). */ /* #undef HAVE_ALLOCA_H */ @@ -121,7 +125,7 @@ /* Define if you have the strcasecmp function. */ #define HAVE_STRCASECMP 1 -#define strcasecmp stricmp +#define strcasecmp _stricmp /* Define if you have the strchr function. */ #define HAVE_STRCHR 1 @@ -166,7 +170,9 @@ #define HAVE_WCHAR_H 1 /* Define if you have the header file. */ +#ifdef _MSC_VER #define HAVE_WCTYPE_H 1 +#endif /* _MSC_VER */ /* Define if you have the i library (-li). */ /* #undef HAVE_LIBI */ diff --git a/gdk/gdkrectangle.c b/gdk/gdkrectangle.c index 8fd435aa9..3eeb540ff 100644 --- a/gdk/gdkrectangle.c +++ b/gdk/gdkrectangle.c @@ -24,7 +24,7 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#include "gdk.h" +#include diff --git a/gdk/win32/gdkcolor-win32.c b/gdk/win32/gdkcolor-win32.c index 06273d3be..2581e317f 100644 --- a/gdk/win32/gdkcolor-win32.c +++ b/gdk/win32/gdkcolor-win32.c @@ -33,10 +33,6 @@ #include "gdkx.h" -#ifdef _MSC_VER -#define strcasecmp stricmp -#endif - static gint gdk_colormap_match_color (GdkColormap *cmap, GdkColor *color, const gchar *available); diff --git a/gdk/win32/gdkcolor.c b/gdk/win32/gdkcolor.c index 06273d3be..2581e317f 100644 --- a/gdk/win32/gdkcolor.c +++ b/gdk/win32/gdkcolor.c @@ -33,10 +33,6 @@ #include "gdkx.h" -#ifdef _MSC_VER -#define strcasecmp stricmp -#endif - static gint gdk_colormap_match_color (GdkColormap *cmap, GdkColor *color, const gchar *available); diff --git a/gdk/win32/gdkconfig.h b/gdk/win32/gdkconfig.h index 502820837..e002349e9 100644 --- a/gdk/win32/gdkconfig.h +++ b/gdk/win32/gdkconfig.h @@ -2,4 +2,6 @@ #define GDK_WINDOWING GDK_WINDOWING_WIN32 #define GDK_HAVE_WCHAR_H 1 +#ifdef _MSC_VER #define GDK_HAVE_WCTYPE_H 1 +#endif diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c index 316d411b9..4ea435441 100644 --- a/gdk/win32/gdkdnd-win32.c +++ b/gdk/win32/gdkdnd-win32.c @@ -31,9 +31,14 @@ #include +#ifdef OLE2_DND #include +#endif + +#ifdef _MSC_VER #include #include +#endif #include #include "gdkx.h" @@ -143,7 +148,7 @@ gdk_drag_context_new (void) return (GdkDragContext *)result; } -#if OLE2_DND +#ifdef OLE2_DND typedef struct { IDropTarget idt; @@ -265,7 +270,7 @@ m_drop (IDropTarget __RPC_FAR *This, GDK_NOTE (DND, g_print ("m_drop\n")); return E_UNEXPECTED; } - + HRESULT STDMETHODCALLTYPE m_query_interface_source (IDropSource __RPC_FAR *This, /* [in] */ REFIID riid, @@ -408,7 +413,7 @@ source_context_new (void) #endif /* OLE2_DND */ -void +void gdk_drag_context_ref (GdkDragContext *context) { g_return_if_fail (context != NULL); @@ -416,7 +421,7 @@ gdk_drag_context_ref (GdkDragContext *context) ((GdkDragContextPrivate *)context)->ref_count++; } -void +void gdk_drag_context_unref (GdkDragContext *context) { GdkDragContextPrivate *private = (GdkDragContextPrivate *)context; @@ -475,6 +480,8 @@ gdk_drag_context_find (gboolean is_source, #endif +#ifdef _MSC_VER + /* From MS Knowledge Base article Q130698 */ /* resolve_link() fills the filename and path buffer @@ -564,6 +571,12 @@ resolve_link(HWND hWnd, return SUCCEEDED (hres); } +#else + +#define resolve_link(hWnd, lpszLinkName, lpszPath, lpszDescription) FALSE + +#endif + static GdkFilterReturn gdk_dropfiles_filter (GdkXEvent *xev, GdkEvent *event, @@ -642,7 +655,6 @@ gdk_dropfiles_filter (GdkXEvent *xev, else return GDK_FILTER_CONTINUE; } - /************************************************************* ************************** Public API *********************** @@ -652,17 +664,20 @@ void gdk_dnd_init (void) { HRESULT hres; - +#ifdef OLE2_DND hres = OleInitialize (NULL); if (! SUCCEEDED (hres)) g_error ("OleInitialize failed"); -} +#endif +} void gdk_dnd_exit (void) { +#ifdef OLE2_DND OleUninitialize (); +#endif } /* Source side */ @@ -747,7 +762,7 @@ gdk_drag_find_window (GdkDragContext *context, } } -gboolean +gboolean gdk_drag_motion (GdkDragContext *context, GdkWindow *dest_window, GdkDragProtocol protocol, @@ -780,7 +795,7 @@ gdk_drag_abort (GdkDragContext *context, /* Destination side */ -void +void gdk_drag_status (GdkDragContext *context, GdkDragAction action, guint32 time) @@ -795,19 +810,18 @@ gdk_drop_reply (GdkDragContext *context, { } -void +void gdk_drop_finish (GdkDragContext *context, gboolean success, guint32 time) { } - -void +void gdk_window_register_dnd (GdkWindow *window) { GdkWindowPrivate *private = (GdkWindowPrivate *) window; -#if OLE2_DND +#ifdef OLE2_DND target_drag_context *context; HRESULT hres; #endif @@ -824,7 +838,7 @@ gdk_window_register_dnd (GdkWindow *window) gdk_window_add_filter (window, gdk_dropfiles_filter, NULL); DragAcceptFiles (private->xwindow, TRUE); -#if OLE2_DND +#ifdef OLE2_DND /* Register for OLE2 d&d */ context = target_context_new (); hres = CoLockObjectExternal ((IUnknown *) &context->idt, TRUE, FALSE); @@ -848,11 +862,11 @@ gdk_window_register_dnd (GdkWindow *window) * gdk_drag_get_selection: * Returns the selection atom for the current source window * arguments: - * + * * results: *************************************************************/ -GdkAtom +GdkAtom gdk_drag_get_selection (GdkDragContext *context) { if (context->protocol == GDK_DRAG_PROTO_WIN32_DROPFILES) diff --git a/gdk/win32/gdkdnd.c b/gdk/win32/gdkdnd.c index 316d411b9..4ea435441 100644 --- a/gdk/win32/gdkdnd.c +++ b/gdk/win32/gdkdnd.c @@ -31,9 +31,14 @@ #include +#ifdef OLE2_DND #include +#endif + +#ifdef _MSC_VER #include #include +#endif #include #include "gdkx.h" @@ -143,7 +148,7 @@ gdk_drag_context_new (void) return (GdkDragContext *)result; } -#if OLE2_DND +#ifdef OLE2_DND typedef struct { IDropTarget idt; @@ -265,7 +270,7 @@ m_drop (IDropTarget __RPC_FAR *This, GDK_NOTE (DND, g_print ("m_drop\n")); return E_UNEXPECTED; } - + HRESULT STDMETHODCALLTYPE m_query_interface_source (IDropSource __RPC_FAR *This, /* [in] */ REFIID riid, @@ -408,7 +413,7 @@ source_context_new (void) #endif /* OLE2_DND */ -void +void gdk_drag_context_ref (GdkDragContext *context) { g_return_if_fail (context != NULL); @@ -416,7 +421,7 @@ gdk_drag_context_ref (GdkDragContext *context) ((GdkDragContextPrivate *)context)->ref_count++; } -void +void gdk_drag_context_unref (GdkDragContext *context) { GdkDragContextPrivate *private = (GdkDragContextPrivate *)context; @@ -475,6 +480,8 @@ gdk_drag_context_find (gboolean is_source, #endif +#ifdef _MSC_VER + /* From MS Knowledge Base article Q130698 */ /* resolve_link() fills the filename and path buffer @@ -564,6 +571,12 @@ resolve_link(HWND hWnd, return SUCCEEDED (hres); } +#else + +#define resolve_link(hWnd, lpszLinkName, lpszPath, lpszDescription) FALSE + +#endif + static GdkFilterReturn gdk_dropfiles_filter (GdkXEvent *xev, GdkEvent *event, @@ -642,7 +655,6 @@ gdk_dropfiles_filter (GdkXEvent *xev, else return GDK_FILTER_CONTINUE; } - /************************************************************* ************************** Public API *********************** @@ -652,17 +664,20 @@ void gdk_dnd_init (void) { HRESULT hres; - +#ifdef OLE2_DND hres = OleInitialize (NULL); if (! SUCCEEDED (hres)) g_error ("OleInitialize failed"); -} +#endif +} void gdk_dnd_exit (void) { +#ifdef OLE2_DND OleUninitialize (); +#endif } /* Source side */ @@ -747,7 +762,7 @@ gdk_drag_find_window (GdkDragContext *context, } } -gboolean +gboolean gdk_drag_motion (GdkDragContext *context, GdkWindow *dest_window, GdkDragProtocol protocol, @@ -780,7 +795,7 @@ gdk_drag_abort (GdkDragContext *context, /* Destination side */ -void +void gdk_drag_status (GdkDragContext *context, GdkDragAction action, guint32 time) @@ -795,19 +810,18 @@ gdk_drop_reply (GdkDragContext *context, { } -void +void gdk_drop_finish (GdkDragContext *context, gboolean success, guint32 time) { } - -void +void gdk_window_register_dnd (GdkWindow *window) { GdkWindowPrivate *private = (GdkWindowPrivate *) window; -#if OLE2_DND +#ifdef OLE2_DND target_drag_context *context; HRESULT hres; #endif @@ -824,7 +838,7 @@ gdk_window_register_dnd (GdkWindow *window) gdk_window_add_filter (window, gdk_dropfiles_filter, NULL); DragAcceptFiles (private->xwindow, TRUE); -#if OLE2_DND +#ifdef OLE2_DND /* Register for OLE2 d&d */ context = target_context_new (); hres = CoLockObjectExternal ((IUnknown *) &context->idt, TRUE, FALSE); @@ -848,11 +862,11 @@ gdk_window_register_dnd (GdkWindow *window) * gdk_drag_get_selection: * Returns the selection atom for the current source window * arguments: - * + * * results: *************************************************************/ -GdkAtom +GdkAtom gdk_drag_get_selection (GdkDragContext *context) { if (context->protocol == GDK_DRAG_PROTO_WIN32_DROPFILES) diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c index 461d3a553..fa839fe89 100644 --- a/gdk/win32/gdkevents-win32.c +++ b/gdk/win32/gdkevents-win32.c @@ -1547,7 +1547,7 @@ gdk_event_translate (GdkEvent *event, is_AltGr_key = FALSE; event->key.type = ((xevent->message == WM_KEYDOWN - | xevent->message == WM_SYSKEYDOWN) ? + || xevent->message == WM_SYSKEYDOWN) ? GDK_KEY_PRESS : GDK_KEY_RELEASE); event->key.window = window; event->key.time = xevent->time; diff --git a/gdk/win32/gdkevents.c b/gdk/win32/gdkevents.c index 461d3a553..fa839fe89 100644 --- a/gdk/win32/gdkevents.c +++ b/gdk/win32/gdkevents.c @@ -1547,7 +1547,7 @@ gdk_event_translate (GdkEvent *event, is_AltGr_key = FALSE; event->key.type = ((xevent->message == WM_KEYDOWN - | xevent->message == WM_SYSKEYDOWN) ? + || xevent->message == WM_SYSKEYDOWN) ? GDK_KEY_PRESS : GDK_KEY_RELEASE); event->key.window = window; event->key.time = xevent->time; diff --git a/gdk/win32/gdkglobals-win32.c b/gdk/win32/gdkglobals-win32.c index f96b092b7..0bb582694 100644 --- a/gdk/win32/gdkglobals-win32.c +++ b/gdk/win32/gdkglobals-win32.c @@ -31,7 +31,7 @@ guint gdk_debug_flags = 0; HWND gdk_root_window; HWND gdk_leader_window; -GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, }; +GDKVAR GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, }; HDC gdk_DC; HINSTANCE gdk_DLLInstance; HINSTANCE gdk_ProgInstance; diff --git a/gdk/win32/gdkglobals.c b/gdk/win32/gdkglobals.c index f96b092b7..0bb582694 100644 --- a/gdk/win32/gdkglobals.c +++ b/gdk/win32/gdkglobals.c @@ -31,7 +31,7 @@ guint gdk_debug_flags = 0; HWND gdk_root_window; HWND gdk_leader_window; -GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, }; +GDKVAR GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, }; HDC gdk_DC; HINSTANCE gdk_DLLInstance; HINSTANCE gdk_ProgInstance; diff --git a/gdk/win32/gdkim-win32.c b/gdk/win32/gdkim-win32.c index 8b49733f6..caeafe53a 100644 --- a/gdk/win32/gdkim-win32.c +++ b/gdk/win32/gdkim-win32.c @@ -26,11 +26,11 @@ #if HAVE_CONFIG_H # include -# if STDC_HEADERS -# include -# endif #endif +#include +#include + #include #include #include "gdkx.h" @@ -172,10 +172,10 @@ gdk_wcstombs (const GdkWChar *src) src_alt = g_new (wchar_t, wcsl+1); for (i = wcsl; i >= 0; i--) src_alt[i] = src[i]; - mbsl = WideCharToMultiByte (CP_ACP, 0, src_alt, wcsl, + mbsl = WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl, NULL, 0, NULL, NULL); mbstr = g_new (guchar, mbsl + 1); - if (!WideCharToMultiByte (CP_ACP, 0, src_alt, wcsl, + if (!WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl, mbstr, mbsl, NULL, NULL)) { g_warning ("gdk_wcstombs: WideCharToMultiByte failed"); @@ -219,9 +219,9 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max) gint i, wcsl; wchar_t *wcstr; - wcsl = MultiByteToWideChar (CP_ACP, 0, src, -1, NULL, 0); - wcstr = g_new (wchar_t, wcsl + 1); - if (!MultiByteToWideChar (CP_ACP, 0, src, -1, wcstr, wcsl)) + wcsl = MultiByteToWideChar (CP_OEMCP, 0, src, -1, NULL, 0); + wcstr = g_new (wchar_t, wcsl); + if (!MultiByteToWideChar (CP_OEMCP, 0, src, -1, wcstr, wcsl)) { g_warning ("gdk_mbstowcs: MultiByteToWideChar failed"); g_free (wcstr); @@ -229,11 +229,11 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max) } if (wcsl > dest_max) wcsl = dest_max; - for (i = 0; i < wcsl; i++) + for (i = 0; i < wcsl && wcstr[i]; i++) dest[i] = wcstr[i]; g_free (wcstr); - return wcsl; + return i; } else { diff --git a/gdk/win32/gdkim.c b/gdk/win32/gdkim.c index 8b49733f6..caeafe53a 100644 --- a/gdk/win32/gdkim.c +++ b/gdk/win32/gdkim.c @@ -26,11 +26,11 @@ #if HAVE_CONFIG_H # include -# if STDC_HEADERS -# include -# endif #endif +#include +#include + #include #include #include "gdkx.h" @@ -172,10 +172,10 @@ gdk_wcstombs (const GdkWChar *src) src_alt = g_new (wchar_t, wcsl+1); for (i = wcsl; i >= 0; i--) src_alt[i] = src[i]; - mbsl = WideCharToMultiByte (CP_ACP, 0, src_alt, wcsl, + mbsl = WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl, NULL, 0, NULL, NULL); mbstr = g_new (guchar, mbsl + 1); - if (!WideCharToMultiByte (CP_ACP, 0, src_alt, wcsl, + if (!WideCharToMultiByte (CP_OEMCP, 0, src_alt, wcsl, mbstr, mbsl, NULL, NULL)) { g_warning ("gdk_wcstombs: WideCharToMultiByte failed"); @@ -219,9 +219,9 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max) gint i, wcsl; wchar_t *wcstr; - wcsl = MultiByteToWideChar (CP_ACP, 0, src, -1, NULL, 0); - wcstr = g_new (wchar_t, wcsl + 1); - if (!MultiByteToWideChar (CP_ACP, 0, src, -1, wcstr, wcsl)) + wcsl = MultiByteToWideChar (CP_OEMCP, 0, src, -1, NULL, 0); + wcstr = g_new (wchar_t, wcsl); + if (!MultiByteToWideChar (CP_OEMCP, 0, src, -1, wcstr, wcsl)) { g_warning ("gdk_mbstowcs: MultiByteToWideChar failed"); g_free (wcstr); @@ -229,11 +229,11 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max) } if (wcsl > dest_max) wcsl = dest_max; - for (i = 0; i < wcsl; i++) + for (i = 0; i < wcsl && wcstr[i]; i++) dest[i] = wcstr[i]; g_free (wcstr); - return wcsl; + return i; } else { diff --git a/gdk/win32/gdkinput-win32.c b/gdk/win32/gdkinput-win32.c index e6369c73e..70063a7a7 100644 --- a/gdk/win32/gdkinput-win32.c +++ b/gdk/win32/gdkinput-win32.c @@ -1460,20 +1460,24 @@ gdk_input_exit (void) HCTX *hctx = (HCTX *) tmp_list->data; BOOL result; +#ifdef _MSC_VER /* For some reason WTEnable and/or WTClose tend to crash here. * Protect with __try/__except to avoid a message box. */ __try { +#endif /* _MSC_VER */ #if 0 WTEnable (*hctx, FALSE); #endif result = WTClose (*hctx); +#ifdef _MSC_VER } __except (/* GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? */ EXCEPTION_EXECUTE_HANDLER /*: EXCEPTION_CONTINUE_SEARCH */) { result = FALSE; } +#endif /* _MSC_VER */ if (!result) g_warning ("gdk_input_exit: Closing Wintab context %#x failed", *hctx); g_free (hctx); diff --git a/gdk/win32/gdkinput.c b/gdk/win32/gdkinput.c index e6369c73e..70063a7a7 100644 --- a/gdk/win32/gdkinput.c +++ b/gdk/win32/gdkinput.c @@ -1460,20 +1460,24 @@ gdk_input_exit (void) HCTX *hctx = (HCTX *) tmp_list->data; BOOL result; +#ifdef _MSC_VER /* For some reason WTEnable and/or WTClose tend to crash here. * Protect with __try/__except to avoid a message box. */ __try { +#endif /* _MSC_VER */ #if 0 WTEnable (*hctx, FALSE); #endif result = WTClose (*hctx); +#ifdef _MSC_VER } __except (/* GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? */ EXCEPTION_EXECUTE_HANDLER /*: EXCEPTION_CONTINUE_SEARCH */) { result = FALSE; } +#endif /* _MSC_VER */ if (!result) g_warning ("gdk_input_exit: Closing Wintab context %#x failed", *hctx); g_free (hctx); diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h index d281b3ed8..20b301bf4 100644 --- a/gdk/win32/gdkprivate-win32.h +++ b/gdk/win32/gdkprivate-win32.h @@ -30,6 +30,24 @@ #define STRICT /* We want strict type checks */ #include +/* Make up for some minor mingw32 lossage */ + +/* PS_JOIN_MASK is missing from the mingw32 headers */ +#ifndef PS_JOIN_MASK +#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND) +#endif + +/* CLR_INVALID is missing */ +#ifndef CLR_INVALID +#define CLR_INVALID CLR_NONE +#endif + +/* MB_CUR_MAX is missing */ +#ifndef MB_CUR_MAX +extern int *__imp___mb_cur_max; +#define MB_CUR_MAX (*__imp___mb_cur_max) +#endif + #include #include diff --git a/gdk/win32/gdkprivate.h b/gdk/win32/gdkprivate.h index d281b3ed8..20b301bf4 100644 --- a/gdk/win32/gdkprivate.h +++ b/gdk/win32/gdkprivate.h @@ -30,6 +30,24 @@ #define STRICT /* We want strict type checks */ #include +/* Make up for some minor mingw32 lossage */ + +/* PS_JOIN_MASK is missing from the mingw32 headers */ +#ifndef PS_JOIN_MASK +#define PS_JOIN_MASK (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND) +#endif + +/* CLR_INVALID is missing */ +#ifndef CLR_INVALID +#define CLR_INVALID CLR_NONE +#endif + +/* MB_CUR_MAX is missing */ +#ifndef MB_CUR_MAX +extern int *__imp___mb_cur_max; +#define MB_CUR_MAX (*__imp___mb_cur_max) +#endif + #include #include diff --git a/gdk/win32/makefile.cygwin b/gdk/win32/makefile.cygwin new file mode 100644 index 000000000..86fbeb1e6 --- /dev/null +++ b/gdk/win32/makefile.cygwin @@ -0,0 +1,89 @@ +## Makefile for building the GDK DLL with egcs on cygwin +## Use: make -f makefile.cygwin install + +# Change this to wherever you want to install the DLL. This directory +# should be in your PATH. +BIN = bin + +# Location of the Wintab toolkit. Downloadable from http://www.pointing.com. +# We use the wntab32x.lib archive library directly (copy it as libwntab32x.a). +WTKIT = ../../../wtkit126 + +OPTIMIZE = -g -O + +################################################################ + +# Nothing much configurable below + +CC = gcc -mno-cygwin -mpentium + +CP = cp +LD = ld +INSTALL = install + +GLIB_VER=1.3 +GTK_VER=1.3 + +GLIB = ../../../glib +CFLAGS = -g -I. -I../.. -I$(WTKIT)/include -I$(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" -DNEAR= -DFAR= + +all: \ + ../../config.h \ + gdk-$(GTK_VER).dll + +install : all + $(INSTALL) gdk-$(GTK_VER).dll $(BIN) + +gdk_OBJECTS = \ + gdk.o \ + gdkcc.o \ + gdkcolor.o \ + gdkcursor.o \ + gdkdnd.o \ + gdkdraw.o \ + gdkevents.o \ + gdkfont.o \ + gdkgc.o \ + gdkglobals.o \ + gdkim.o \ + gdkimage.o \ + gdkinput.o \ + gdkpixmap.o \ + gdkproperty.o \ + gdkrgb.o \ + gdkrectangle.o \ + gdkregion.o \ + gdkselection.o \ + gdkvisual.o \ + gdkwindow.o \ + gdkxid.o + +../../config.h : ../../config.h.win32 + $(CP) ../../config.h.win32 ../../config.h + +gdkres.o : rc/gdk.rc + windres --include-dir rc rc/gdk.rc gdkres.o + +gdk-$(GTK_VER).dll : $(gdk_OBJECTS) gdk.def gdkres.o libwntab32x.a + $(GLIB)/build-dll gdk $(GTK_VER) gdk.def $(gdk_OBJECTS) -L $(GLIB) -lglib-$(GLIB_VER) -L . -lwntab32x -lgdi32 -luser32 -lshell32 -lole32 -luuid $(LDFLAGS) gdkres.o + +libwntab32x.a : $(WTKIT)/lib/i386/wntab32x.lib + cp $(WTKIT)/lib/i386/wntab32x.lib libwntab32x.a + +.c.o : + $(CC) $(CFLAGS) -c -DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\" $< + +gdkrgb.c : ../gdkrgb.c + $(CP) ../gdkrgb.c . + +gdkrectangle.c : ../gdkrectangle.c + $(CP) ../gdkrectangle.c . + +testgdk.exe : testgdk.o gdk-$(GTK_VER).dll + $(CC) $(CFLAGS) -o $@ testgdk.o -L . -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) $(LDFLAGS) + +testgdk.o : testgdk.c + $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testgdk\" testgdk.c + +clean: + -rm *.exe *.o *.dll *.a *.exp *.base diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc index 0594778ec..080767159 100644 --- a/gdk/win32/makefile.msc +++ b/gdk/win32/makefile.msc @@ -6,7 +6,7 @@ BIN = C:\bin # Location of the Wintab toolkit. Downloadable from http://www.pointing.com. -WTKIT = ..\..\..\wtkit125 +WTKIT = ..\..\..\wtkit126 # Full optimization: OPTIMIZE = -Ox @@ -17,18 +17,18 @@ OPTIMIZE = -Ox # Nothing much configurable below -# cl -? described the options +# cl -? describes the options CC = cl -G5 -GF $(OPTIMIZE) -W3 -MD -nologo LDFLAGS = /link /machine:ix86 # /debug /debugtype:cv INSTALL = copy TOUCH = copy makefile.msc+nul -GLIB_VER=1.2 +GLIB_VER=1.3 GTK_VER=1.3 -GLIB = ..\..\..\glib-$(GLIB_VER) -CFLAGS = -I. -I..\.. -I$(WTKIT)\include -I$(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" # -DMULTIPLE_WINDOW_CLASSES +GLIB = ..\..\..\glib +CFLAGS = -I. -I..\.. -I$(WTKIT)\include -I$(GLIB) -DG_ENABLE_DEBUG -DHAVE_CONFIG_H -DGDK_VERSION=\"$(GTK_VER)\" all: \ ..\..\config.h \ diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index b1dac5795..5a654a072 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -26,6 +26,10 @@ #include "config.h" +#include /* To get stat->_stat redefinition + * for mingw32 + */ + #include #include #include @@ -71,14 +75,17 @@ #define STRICT #include -#ifdef _MSC_VER +#ifdef NATIVE_WIN32 #include +#include +#define mkdir(p,m) _mkdir(p) #ifndef S_ISDIR #define S_ISDIR(mode) ((mode)&_S_IFDIR) #endif -#define mkdir(path,mode) mkdir(path) -#endif -#endif + +#endif /* NATIVE_WIN32 */ + +#endif /* WIN32 */ #define DIR_LIST_WIDTH 180 #define DIR_LIST_HEIGHT 180 diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c index 1fdf303a8..39c049f04 100644 --- a/gtk/gtkfontsel.c +++ b/gtk/gtkfontsel.c @@ -70,7 +70,14 @@ #include #include "gdk/gdk.h" +/* Protect against the CHARSET struct in Win32 */ +#if GDK_WINDOWING == GDK_WINDOWING_WIN32 +# define CHARSET CHARSETstruct +#endif #include "gdkx.h" +#if GDK_WINDOWING == GDK_WINDOWING_WIN32 +# undef CHARSET +#endif #include "gdk/gdkkeysyms.h" #include "gtkbutton.h" diff --git a/gtk/gtkitemfactory.c b/gtk/gtkitemfactory.c index b0f2306af..554a7cd64 100644 --- a/gtk/gtkitemfactory.c +++ b/gtk/gtkitemfactory.c @@ -48,7 +48,7 @@ #endif #include -#ifdef _MSC_VER +#ifdef NATIVE_WIN32 #include /* For _open and _close */ #ifndef S_ISREG diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 0ee8c3461..fa558da93 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -439,13 +439,16 @@ gtk_init_check (int *argc, } g_slist_free (gtk_modules); +#ifndef NATIVE_WIN32 + /* No use warning on Win32, there aren't any non-devel versions anyhow... */ g_warning ("" "YOU ARE USING THE DEVEL BRANCH 1.3.x OF GTK+ WHICH IS CURRENTLY\n" " UNDER HEAVY DEVELOPMENT AND FREQUENTLY INTRODUCES INSTABILITIES.\n" " if you don't know why you are getting this, you probably want to\n" " use the stable branch which can be retrived from\n" " ftp://ftp.gtk.org/pub/gtk/v1.2/ or via CVS with\n" " cvs checkout -r glib-1-2 glib; cvs checkout -r gtk-1-2 gtk+"); - +#endif + return TRUE; } void diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 93c39e4dd..09d22a49b 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -50,7 +50,7 @@ #define lstat stat #endif -#ifdef _MSC_VER +#ifdef NATIVE_WIN32 #include #endif diff --git a/gtk/makefile.cygwin b/gtk/makefile.cygwin new file mode 100644 index 000000000..af42316df --- /dev/null +++ b/gtk/makefile.cygwin @@ -0,0 +1,376 @@ +## Makefile for building the GTK DLL with egcs on cygwin +## Use: make -f makefile.cygwin install + +# Change this to wherever you want to install the DLL. This directory +# should be in your PATH. +BIN = /bin + +# This is the location of pthreads for Win32, +# see http://sourceware.cygnus.com/pthreads-win32/ +PTHREADS = ../../pthreads-snap-1999-04-07 +PTHREAD_LIB = -L $(PTHREADS) -lpthread +PTHREAD_INC = -I $(PTHREADS) + +OPTIMIZE = -g -O + +################################################################ + +# Nothing much configurable below + +CC = gcc -mno-cygwin -mpentium + +# Perl and awk are needed to generate some source files. +# These generated source files are distribuyted with the Win32 GTk+ source +# distributions, so don't worry if you don't have perl and awk. +PERL = perl +AWK = awk + +INSTALL = install + +GLIB_VER=1.3 +GTK_VER=1.3 + +GDKSYSDEP = ../gdk/win32 +GLIB = ../../glib + +CFLAGS = $(OPTIMIZE) -I. -I.. -I$(GDKSYSDEP) -I$(GLIB) -I$(GLIB)/gmodule -DGTK_DISABLE_COMPAT_H + +all : \ + ../config.h \ + gtkcompat.h \ + generated \ + gtk-$(GTK_VER).dll\ + testdnd.exe \ + testgtk.exe \ + testinput.exe \ + testrgb.exe \ + testselection.exe \ + simple.exe + +install : all + $(INSTALL) gtk-$(GTK_VER).dll $(BIN) + +gtk_OBJECTS = \ + fnmatch.o \ + gtkaccelgroup.o \ + gtkaccellabel.o \ + gtkadjustment.o \ + gtkalignment.o \ + gtkarg.o \ + gtkarrow.o \ + gtkaspectframe.o\ + gtkbbox.o \ + gtkbin.o \ + gtkbindings.o \ + gtkbox.o \ + gtkbutton.o \ + gtkcalendar.o \ + gtkcheckbutton.o\ + gtkcheckmenuitem.o\ + gtkclist.o \ + gtkcolorsel.o \ + gtkcombo.o \ + gtkcontainer.o \ + gtkctree.o \ + gtkcurve.o \ + gtkdata.o \ + gtkdialog.o \ + gtkdnd.o \ + gtkdrawingarea.o\ + gtkeditable.o \ + gtkentry.o \ + gtkeventbox.o \ + gtkfilesel.o \ + gtkfixed.o \ + gtkfontsel.o \ + gtkframe.o \ + gtkgamma.o \ + gtkgc.o \ + gtkhandlebox.o \ + gtkhbbox.o \ + gtkhbox.o \ + gtkhpaned.o \ + gtkhruler.o \ + gtkhscale.o \ + gtkhscrollbar.o \ + gtkhseparator.o \ + gtkimage.o \ + gtkinputdialog.o\ + gtkinvisible.o \ + gtkitem.o \ + gtkitemfactory.o\ + gtklabel.o \ + gtklayout.o \ + gtklist.o \ + gtklistitem.o \ + gtkmain.o \ + gtkmarshal.o \ + gtkmenu.o \ + gtkmenubar.o \ + gtkmenufactory.o\ + gtkmenuitem.o \ + gtkmenushell.o \ + gtkmisc.o \ + gtknotebook.o \ + gtkobject.o \ + gtkoptionmenu.o \ + gtkpacker.o \ + gtkpaned.o \ + gtkpixmap.o \ + gtkplug.o \ + gtkpreview.o \ + gtkprogress.o \ + gtkprogressbar.o\ + gtkradiobutton.o\ + gtkradiomenuitem.o\ + gtkrange.o \ + gtkrc.o \ + gtkruler.o \ + gtkscale.o \ + gtkscrollbar.o \ + gtkscrolledwindow.o\ + gtkselection.o \ + gtkseparator.o \ + gtksignal.o \ + gtksocket.o \ + gtkspinbutton.o \ + gtkstatusbar.o \ + gtkstyle.o \ + gtktable.o \ + gtktearoffmenuitem.o\ + gtktext.o \ + gtkthemes.o \ + gtktipsquery.o \ + gtktogglebutton.o\ + gtktoolbar.o \ + gtktooltips.o \ + gtktree.o \ + gtktreeitem.o \ + gtktypeutils.o \ + gtkvbbox.o \ + gtkvbox.o \ + gtkviewport.o \ + gtkvpaned.o \ + gtkvruler.o \ + gtkvscale.o \ + gtkvscrollbar.o \ + gtkvseparator.o \ + gtkwidget.o \ + gtkwindow.o + +# Source headers which are non-autogenerated headers +source_headers = \ + gtk.h \ + gtkaccelgroup.h \ + gtkaccellabel.h \ + gtkadjustment.h \ + gtkalignment.h \ + gtkarg.h \ + gtkarrow.h \ + gtkaspectframe.h \ + gtkbin.h \ + gtkbindings.h \ + gtkbbox.h \ + gtkbox.h \ + gtkbutton.h \ + gtkcalendar.h \ + gtkcheckbutton.h \ + gtkcheckmenuitem.h \ + gtkclist.h \ + gtkcolorsel.h \ + gtkcombo.h \ + gtkcompat.h \ + gtkcontainer.h \ + gtkctree.h \ + gtkcurve.h \ + gtkdata.h \ + gtkdebug.h \ + gtkdialog.h \ + gtkdnd.h \ + gtkdrawingarea.h \ + gtkeditable.h \ + gtkentry.h \ + gtkenums.h \ + gtkeventbox.h \ + gtkfilesel.h \ + gtkfixed.h \ + gtkfontsel.h \ + gtkframe.h \ + gtkgamma.h \ + gtkgc.h \ + gtkhandlebox.h \ + gtkhbbox.h \ + gtkhbox.h \ + gtkhpaned.h \ + gtkhruler.h \ + gtkhscale.h \ + gtkhscrollbar.h \ + gtkhseparator.h \ + gtkimage.h \ + gtkinputdialog.h \ + gtkintl.h \ + gtkinvisible.h \ + gtkitem.h \ + gtkitemfactory.h \ + gtklabel.h \ + gtklayout.h \ + gtklist.h \ + gtklistitem.h \ + gtkmain.h \ + gtkmenu.h \ + gtkmenubar.h \ + gtkmenufactory.h \ + gtkmenuitem.h \ + gtkmenushell.h \ + gtkmisc.h \ + gtknotebook.h \ + gtkobject.h \ + gtkoptionmenu.h \ + gtkpacker.h \ + gtkpaned.h \ + gtkpixmap.h \ + gtkplug.h \ + gtkpreview.h \ + gtkprivate.h \ + gtkprogress.h \ + gtkprogressbar.h \ + gtkradiobutton.h \ + gtkradiomenuitem.h \ + gtkrange.h \ + gtkrc.h \ + gtkruler.h \ + gtkscale.h \ + gtkscrollbar.h \ + gtkscrolledwindow.h \ + gtkselection.h \ + gtkseparator.h \ + gtksignal.h \ + gtksocket.h \ + gtkspinbutton.h \ + gtkstyle.h \ + gtkstatusbar.h \ + gtktable.h \ + gtktearoffmenuitem.h \ + gtktext.h \ + gtkthemes.h \ + gtktipsquery.h \ + gtktogglebutton.h \ + gtktoolbar.h \ + gtktooltips.h \ + gtktree.h \ + gtktreeitem.h \ + gtktypeutils.h \ + gtkvbbox.h \ + gtkvbox.h \ + gtkviewport.h \ + gtkvpaned.h \ + gtkvruler.h \ + gtkvscale.h \ + gtkvscrollbar.h \ + gtkvseparator.h \ + gtkwidget.h \ + gtkwindow.h + +# More headers to use when autogenerating. +gdk_headers = \ + ../gdk/gdktypes.h \ + ../gdk/gdkrgb.h + +../config.h : ../config.h.win32 + cp ../config.h.win32 ../config.h + +gtkcompat.h : gtkcompat.h.win32 + cp gtkcompat.h.win32 gtkcompat.h + +# +# Generated source files: +# +generated : gtk.defs gtktypebuiltins.h gtktypebuiltins_vars.c gtktypebuiltins_ids.c gtktypebuiltins_evals.c gtkmarshal.h gtkmarshal.c + +gtk.defs : makeenums.pl gtk-boxed.defs $(source_headers) $(gdk_headers) + $(PERL) makeenums.pl defs $(source_headers) $(gdk_headers) >gd.tmp + cat gd.tmp gtk-boxed.defs >gtk.defs + rm gd.tmp + +# generate type identifier header (GTK_TYPE_WIDGET_FLAGS) +gtktypebuiltins.h: gtk.defs maketypes.awk + $(AWK) -f maketypes.awk gtk.defs macros >gtktypebuiltins.h + +# generate type identifier variables (GTK_TYPE_WIDGET_FLAGS) +gtktypebuiltins_vars.c: gtk.defs maketypes.awk + $(AWK) -f maketypes.awk gtk.defs variables >gtktypebuiltins_vars.c + +# generate type entries for type-id registration +gtktypebuiltins_ids.c: gtk.defs maketypes.awk + $(AWK) -f maketypes.awk gtk.defs entries >gtktypebuiltins_ids.c + +# generate enum value arrays +gtktypebuiltins_evals.c: makeenums.pl gtk.defs + $(PERL) makeenums.pl arrays $(source_headers) $(gdk_headers) >gtktypebuiltins_evals.c + +gtkmarshal.h gtkmarshal.c : gtkmarshal.list genmarshal.pl + $(PERL) genmarshal.pl + -rm gtkmarshal.c + mv s-gmc gtkmarshal.c + -rm gtkmarshal.h + mv s-gmh gtkmarshal.h + +# +# Linking: +# +gtk-$(GTK_VER).dll : generated $(gtk_OBJECTS) gtk.def + $(GLIB)/build-dll gtk $(GTK_VER) gtk.def $(gtk_OBJECTS) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) -lgdi32 -luser32 + +# General rule for compiling the objects into the DLL +.c.o : + $(CC) $(CFLAGS) -c -DGTK_COMPILATION -DG_LOG_DOMAIN=\"Gtk\" $< + +# +# Test programs: +# +testdnd.exe : testdnd.o + $(CC) $(CFLAGS) -o $@ testdnd.o -L . -lgtk-$(GTK_VER) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) $(LDFLAGS) + +# Must have separate rules for these objects that don't go in the DLL +testdnd.o : testdnd.c + $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testdnd\" testdnd.c + +testgtk.exe : testgtk.o + $(CC) $(CFLAGS) -o $@ testgtk.o -L . -lgtk-$(GTK_VER) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) $(LDFLAGS) + +testgtk.o : testgtk.c + $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testgtk\" testgtk.c + +testinput.exe : testinput.o + $(CC) $(CFLAGS) -o $@ testinput.o -L . -lgtk-$(GTK_VER) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) $(LDFLAGS) + +testinput.o : testinput.c + $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testinput\" testinput.c + +testrgb.exe : testrgb.o + $(CC) $(CFLAGS) -o $@ testrgb.o -L . -lgtk-$(GTK_VER) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) $(LDFLAGS) + +testrgb.o : testrgb.c + $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testrgb\" testrgb.c + +testselection.exe : testselection.o + $(CC) $(CFLAGS) -o $@ testselection.o -L . -lgtk-$(GTK_VER) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) $(LDFLAGS) + +testselection.o : testselection.c + $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testselection\" testselection.c + +testthreads.exe : testthreads.o + $(CC) $(CFLAGS) -o $@ testthreads.o -L . -lgtk-$(GTK_VER) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) -lgthread-$(GLIB_VER) $(PTHREAD_LIB) $(LDFLAGS) + +testthreads.o : testthreads.c + $(CC) $(CFLAGS) -I$(PTHREAD_INC) -c -DG_LOG_DOMAIN=\"testthreads\" -DUSE_PTHREADS=1 testthreads.c + +simple.exe : simple.o + $(CC) $(CFLAGS) -o $@ simple.o -L . -lgtk-$(GTK_VER) -L $(GDKSYSDEP) -lgdk-$(GTK_VER) -L $(GLIB) -lglib-$(GLIB_VER) $(LDFLAGS) + +simple.o : simple.c + $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"simple\" simple.c + +# The clean target doesn't remove the generated sources +clean: + -rm *.exe *.o *.dll *.a *.exp *.base diff --git a/gtk/makefile.msc b/gtk/makefile.msc index 7eb412e89..d1066dd28 100755 --- a/gtk/makefile.msc +++ b/gtk/makefile.msc @@ -7,8 +7,9 @@ BIN = C:\bin # This is the location of pthreads for Win32, # see http://sourceware.cygnus.com/pthreads-win32/ -PTHREAD_LIB = ..\..\lib\pthread.lib -PTHREAD_INC = ..\..\include +PTHREADS = ..\..\pthreads-snap-1999-04-07 +PTHREAD_LIB = $(PTHREADS)\pthread.lib +PTHREAD_INC = -I $(PTHREADS) # Full optimization: OPTIMIZE = -Ox @@ -19,7 +20,7 @@ OPTIMIZE = -Ox # Nothing much configurable below -# cl -? described the options +# cl -? describes the options # Some files use near as an identifier CC = cl -G5 -GF $(OPTIMIZE) -W3 -MD -DHAVE_CONFIG_H -nologo -Dnear=xxnear @@ -29,17 +30,15 @@ CC = cl -G5 -GF $(OPTIMIZE) -W3 -MD -DHAVE_CONFIG_H -nologo -Dnear=xxnear PERL = perl AWK = awk -# MEMCHECKLIB = mcw50.lib - -LDFLAGS = /link /machine:ix86 # /debug /debugtype:cv +LDFLAGS = /link /machine:ix86 # /debug INSTALL = copy TOUCH = copy makefile.msc+nul -GLIB_VER=1.2 +GLIB_VER=1.3 GTK_VER=1.3 GDKSYSDEP = ..\gdk\win32 -GLIB = ..\..\glib-$(GLIB_VER) +GLIB = ..\..\glib CFLAGS = -I. -I.. -I$(GDKSYSDEP) -I$(GLIB) -I$(GLIB)\gmodule -DGTK_DISABLE_COMPAT_H @@ -329,7 +328,7 @@ gtkmarshal.h gtkmarshal.c : gtkmarshal.list genmarshal.pl # Linking: # gtk-$(GTK_VER).dll : $(gtk_OBJECTS) gtk.def - $(CC) $(CFLAGS) -LD -Fegtk-$(GTK_VER).dll $(gtk_OBJECTS) $(MEMCHECKLIB) $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gmodule-$(GLIB_VER).lib gdi32.lib user32.lib $(LDFLAGS) /def:gtk.def + $(CC) $(CFLAGS) -LD -Fegtk-$(GTK_VER).dll $(gtk_OBJECTS) $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gmodule-$(GLIB_VER).lib gdi32.lib user32.lib $(LDFLAGS) /def:gtk.def # General rule for compiling the objects into the DLL .c.obj : @@ -338,44 +337,44 @@ gtk-$(GTK_VER).dll : $(gtk_OBJECTS) gtk.def # # Test programs: # -testdnd.exe : testdnd.obj +testdnd.exe : gtk-$(GTK_VER).dll testdnd.obj $(CC) $(CFLAGS) testdnd.obj gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(LDFLAGS) # Must have separate rules for these objects that don't go in the DLL testdnd.obj : testdnd.c $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testdnd\" testdnd.c -testgtk.exe : testgtk.obj - $(CC) $(CFLAGS) testgtk.obj $(MEMCHECKLIB) gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(LDFLAGS) +testgtk.exe : gtk-$(GTK_VER).dll testgtk.obj + $(CC) $(CFLAGS) testgtk.obj gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(LDFLAGS) testgtk.obj : testgtk.c $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testgtk\" testgtk.c -testinput.exe : testinput.obj +testinput.exe : gtk-$(GTK_VER).dll testinput.obj $(CC) $(CFLAGS) testinput.obj gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(LDFLAGS) testinput.obj : testinput.c $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testinput\" testinput.c -testrgb.exe : testrgb.obj +testrgb.exe : gtk-$(GTK_VER).dll testrgb.obj $(CC) $(CFLAGS) testrgb.obj gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(LDFLAGS) testrgb.obj : testrgb.c $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testrgb\" testrgb.c -testselection.exe : testselection.obj +testselection.exe : gtk-$(GTK_VER).dll testselection.obj $(CC) $(CFLAGS) testselection.obj gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(LDFLAGS) testselection.obj : testselection.c $(CC) $(CFLAGS) -c -DG_LOG_DOMAIN=\"testselection\" testselection.c -testthreads.exe : testthreads.obj +testthreads.exe : gtk-$(GTK_VER).dll testthreads.obj $(CC) $(CFLAGS) testthreads.obj gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(GLIB)\gthread-$(GLIB_VER).lib $(PTHREAD_LIB) $(LDFLAGS) testthreads.obj : testthreads.c - $(CC) $(CFLAGS) -I$(PTHREAD_INC) -c -DG_LOG_DOMAIN=\"testthreads\" -DUSE_PTHREADS=1 testthreads.c + $(CC) $(CFLAGS) $(PTHREAD_INC) -c -DG_LOG_DOMAIN=\"testthreads\" -DUSE_PTHREADS=1 testthreads.c -simple.exe : simple.obj +simple.exe : gtk-$(GTK_VER).dll simple.obj $(CC) $(CFLAGS) simple.obj gtk-$(GTK_VER).lib $(GDKSYSDEP)\gdk-$(GTK_VER).lib $(GLIB)\glib-$(GLIB_VER).lib $(LDFLAGS) simple.obj : simple.c