diff -ur gtk+-2.0.6.orig/configure.in gtk+-2.0.6/configure.in
--- gtk+-2.0.6.orig/configure.in	2002-08-01 05:46:56.000000000 +0900
+++ gtk+-2.0.6/configure.in	2002-09-08 01:08:52.000000000 +0900
@@ -273,7 +273,7 @@
 if test "$os_win32" != yes; then
     # libtool option to control which symbols are exported
     # right now, symbols starting with _ are not exported
-    LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
+    LIBTOOL_EXPORT_OPTIONS='-Wl,--export-all-symbols -export-symbols-regex "^[[^_]].*"'
 else
     # We currently use .def files on Windows (for gdk-pixbuf, gdk and gtk)
     LIBTOOL_EXPORT_OPTIONS=
@@ -1306,6 +1306,12 @@
 GTK_PACKAGES=atk
 GTK_EXTRA_LIBS=
 GTK_EXTRA_CFLAGS= 
+
+# Not only gdk but also gtk needs -lX11 because gtkplug/gtksocket depend on it.
+if test "x$gdktarget" = "xx11"; then 
+  GTK_EXTRA_LIBS="$GTK_EXTRA_LIBS $x_libs"
+fi
+
 GTK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
 GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
 
diff -ur gtk+-2.0.6.orig/gdk/gdktypes.h gtk+-2.0.6/gdk/gdktypes.h
--- gtk+-2.0.6.orig/gdk/gdktypes.h	2002-04-18 07:55:02.000000000 +0900
+++ gtk+-2.0.6/gdk/gdktypes.h	2002-08-21 09:06:44.000000000 +0900
@@ -33,7 +33,7 @@
 #include <pango/pango.h>
 #include <glib-object.h>
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #  ifdef GDK_COMPILATION
 #    define GDKVAR __declspec(dllexport)
 #  else
diff -ur gtk+-2.0.6.orig/gdk/win32/gdkevents-win32.c gtk+-2.0.6/gdk/win32/gdkevents-win32.c
--- gtk+-2.0.6.orig/gdk/win32/gdkevents-win32.c	2002-03-06 09:36:08.000000000 +0900
+++ gtk+-2.0.6/gdk/win32/gdkevents-win32.c	2002-08-28 01:56:46.000000000 +0900
@@ -44,6 +44,11 @@
 #include "gdkinput-win32.h"
 #include "gdkkeysyms.h"
 
+#ifdef G_WITH_CYGWIN
+#include <fcntl.h>
+#include <errno.h>
+#endif
+
 #include <objbase.h>
 
 #if defined (__GNUC__) && defined (HAVE_DIMM_H)
@@ -317,7 +322,13 @@
   source = g_source_new (&event_funcs, sizeof (GSource));
   g_source_set_priority (source, GDK_PRIORITY_EVENTS);
 
+#ifdef G_WITH_CYGWIN
+  event_poll_fd.fd = open("/dev/windows", O_RDONLY);
+  if (event_poll_fd.fd == -1)
+    g_error ("can't open \"/dev/windows\": %s", g_strerror (errno));
+#else
   event_poll_fd.fd = G_WIN32_MSG_HANDLE;
+#endif
   event_poll_fd.events = G_IO_IN;
   
   g_source_add_poll (source, &event_poll_fd);
diff -ur gtk+-2.0.6.orig/gdk/win32/gdkwindow-win32.c gtk+-2.0.6/gdk/win32/gdkwindow-win32.c
--- gtk+-2.0.6.orig/gdk/win32/gdkwindow-win32.c	2002-06-04 07:00:30.000000000 +0900
+++ gtk+-2.0.6/gdk/win32/gdkwindow-win32.c	2002-08-19 09:59:00.000000000 +0900
@@ -34,6 +34,11 @@
 #include "gdkprivate-win32.h"
 #include "gdkinput-win32.h"
 
+/* for Cygwin */
+#if defined(MAX_PATH) && !defined(_MAX_PATH)
+#define _MAX_PATH MAX_PATH
+#endif
+
 static gboolean gdk_window_gravity_works (void);
 static void     gdk_window_set_static_win_gravity (GdkWindow *window, 
 						   gboolean   on);
diff -ur gtk+-2.0.6.orig/gdk/x11/Makefile.am gtk+-2.0.6/gdk/x11/Makefile.am
--- gtk+-2.0.6.orig/gdk/x11/Makefile.am	2002-05-15 08:44:34.000000000 +0900
+++ gtk+-2.0.6/gdk/x11/Makefile.am	2002-09-07 16:56:04.000000000 +0900
@@ -10,6 +10,7 @@
 	-I$(top_builddir)/gdk	\
 	@GTK_DEBUG_FLAGS@ 	\
 	@GDK_DEP_CFLAGS@	\
+	-DGDK_COMPILATION	\
 @STRIP_END@
 
 LDADDS = @STRIP_BEGIN@ 		\
diff -ur gtk+-2.0.6.orig/gdk/x11/gdkdrawable-x11.c gtk+-2.0.6/gdk/x11/gdkdrawable-x11.c
--- gtk+-2.0.6.orig/gdk/x11/gdkdrawable-x11.c	2002-04-18 07:55:02.000000000 +0900
+++ gtk+-2.0.6/gdk/x11/gdkdrawable-x11.c	2002-09-07 16:53:36.000000000 +0900
@@ -727,9 +727,13 @@
   impl = GDK_DRAWABLE_IMPL_X11 (drawable);
 
   if (image->type == GDK_IMAGE_SHARED)
+#ifdef USE_SHM
     XShmPutImage (impl->xdisplay, impl->xid,
                   GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
                   xsrc, ysrc, xdest, ydest, width, height, False);
+#else
+    g_error ("trying to draw shared memory image when gdk was compiled without shared memory support");
+#endif
   else
     XPutImage (impl->xdisplay, impl->xid,
                GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
diff -ur gtk+-2.0.6.orig/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S gtk+-2.0.6/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S
--- gtk+-2.0.6.orig/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S	2002-01-12 07:54:54.000000000 +0900
+++ gtk+-2.0.6/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S	2002-08-18 23:20:32.000000000 +0900
@@ -4,7 +4,7 @@
 .text
 	.align 16
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
 	
 .globl pixops_composite_line_22_4a4_mmx
 	.type	 pixops_composite_line_22_4a4_mmx,@function
diff -ur gtk+-2.0.6.orig/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S gtk+-2.0.6/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S
--- gtk+-2.0.6.orig/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S	2002-01-12 07:54:54.000000000 +0900
+++ gtk+-2.0.6/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S	2002-08-18 23:20:56.000000000 +0900
@@ -4,7 +4,7 @@
 .text
 	.align 16
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
 
 .globl pixops_composite_line_color_22_4a4_mmx
 	.type	 pixops_composite_line_color_22_4a4_mmx,@function
diff -ur gtk+-2.0.6.orig/gdk-pixbuf/pixops/have_mmx.S gtk+-2.0.6/gdk-pixbuf/pixops/have_mmx.S
--- gtk+-2.0.6.orig/gdk-pixbuf/pixops/have_mmx.S	2001-01-23 08:09:46.000000000 +0900
+++ gtk+-2.0.6/gdk-pixbuf/pixops/have_mmx.S	2002-08-18 23:21:08.000000000 +0900
@@ -4,7 +4,7 @@
 .text
 	.align 16
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
 
 .globl pixops_have_mmx
 	.type	 pixops_have_mmx,@function
diff -ur gtk+-2.0.6.orig/gdk-pixbuf/pixops/scale_line_22_33_mmx.S gtk+-2.0.6/gdk-pixbuf/pixops/scale_line_22_33_mmx.S
diff -ur gtk+-2.0.6.orig/gdk-pixbuf/pixops/scale_line_22_33_mmx.S gtk+-2.0.6/gdk-pixbuf/pixops/scale_line_22_33_mmx.S
--- gtk+-2.0.6.orig/gdk-pixbuf/pixops/scale_line_22_33_mmx.S	2002-01-12 07:54:54.000000000 +0900
+++ gtk+-2.0.6/gdk-pixbuf/pixops/scale_line_22_33_mmx.S	2002-08-18 23:21:24.000000000 +0900
@@ -4,7 +4,7 @@
 .text
 	.align 16
 
-#ifndef __MINGW32__
+#if !defined(__MINGW32__) && !defined(__CYGWIN__)
 	
 .globl pixops_scale_line_22_33_mmx
 	.type	 pixops_scale_line_22_33_mmx,@function
Only in gtk+-2.0.6/gdk-pixbuf: pixops.orig
Only in gtk+-2.0.6/gdk-pixbuf: stamp-gdk-pixbuf-marshal.h
diff -ur gtk+-2.0.6.orig/gtk/gtkfilesel.c gtk+-2.0.6/gtk/gtkfilesel.c
--- gtk+-2.0.6.orig/gtk/gtkfilesel.c	2002-06-16 13:02:28.000000000 +0900
+++ gtk+-2.0.6/gtk/gtkfilesel.c	2002-08-28 13:32:28.000000000 +0900
@@ -51,7 +51,7 @@
 #include <windows.h>
 #undef STRICT
 #endif /* G_OS_WIN32 || G_WITH_CYGWIN */
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && !defined(G_WITH_CYGWIN)
 #include <winsock.h>		/* For gethostname */
 #endif
 
@@ -94,6 +94,10 @@
 #endif
 #endif /* G_OS_WIN32 */
 
+#ifdef G_WITH_CYGWIN
+#include <sys/cygwin.h>		/* For cygwin_conv_to_posix_path */
+#endif
+
 #define DIR_LIST_WIDTH   180
 #define DIR_LIST_HEIGHT  180
 #define FILE_LIST_WIDTH  180
@@ -433,7 +437,7 @@
  * instance translate:
  * x:\somepath\file.jpg
  * to:
- * //x/somepath/file.jpg
+ * /cygdrive/x/somepath/file.jpg
  *
  * Replace the path in the selection text field.
  * Return a boolean value concerning whether a
@@ -443,46 +447,32 @@
 translate_win32_path (GtkFileSelection *filesel)
 {
   int updated = 0;
-  gchar *path;
+  const gchar *path;
+  gchar newPath[MAX_PATH];
+  gint len;
 
   /*
    * Retrieve the current path
    */
   path = gtk_entry_get_text (GTK_ENTRY (filesel->selection_entry));
 
-  /*
-   * Translate only if this looks like a DOS-ish
-   * path... First handle any drive letters.
-   */
-  if (isalpha (path[0]) && (path[1] == ':')) {
-    /*
-     * This part kind of stinks... It isn't possible
-     * to know if there is enough space in the current
-     * string for the extra character required in this
-     * conversion.  Assume that there isn't enough space
-     * and use the set function on the text field to
-     * set the newly created string.
-     */
-    gchar *newPath = g_strdup_printf ("//%c/%s", path[0], (path + 3));
-    gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), newPath);
+  cygwin_conv_to_posix_path (path, newPath);
 
-    path = newPath;
-    updated = 1;
-  }
-
-  /*
-   * Now, replace backslashes with forward slashes 
-   * if necessary.
-   */
-  if (strchr (path, '\\'))
+  len = strlen (path);
+  if (len > 0 && (path[len-1] == '/' || path[len-1] == '\\'))
     {
-      int index;
-      for (index = 0; path[index] != '\0'; index++)
-	if (path[index] == '\\')
-	  path[index] = '/';
-      
-      updated = 1;
+      len = strlen (newPath);
+      if (len > 0 && path[len-1] != '/')
+        {
+          newPath[len]   = '/';
+          newPath[len+1] = '\0';
+        }
     }
+
+  updated = (strcmp (path, newPath) != 0);
+
+  if (updated)
+    gtk_entry_set_text (GTK_ENTRY (filesel->selection_entry), newPath);
     
   return updated;
 }
@@ -1916,17 +1906,26 @@
   /* Check to see if the selection was a drive selector */
   if (isalpha (filename[0]) && (filename[1] == ':'))
     {
-      /* It is... map it to a CYGWIN32 drive */
-      gchar *temp_filename = g_strdup_printf ("//%c/", tolower (filename[0]));
+      gchar temp_filename[MAX_PATH];
+      int len;
+
+      cygwin_conv_to_posix_path (filename, temp_filename);
+
+      /* we need trailing '/'. */
+      len = strlen (temp_filename);
+      if (len > 0 && temp_filename[len-1] != '/')
+        {
+          temp_filename[len]   = '/';
+          temp_filename[len+1] = '\0';
+        }
 
       if (free_old)
 	g_free (filename);
 
-      return temp_filename;
+      return g_strdup (temp_filename);
     }
-#else
-  return filename;
 #endif /* G_WITH_CYGWIN */
+  return filename;
 }
 
 static void
@@ -1963,6 +1962,7 @@
 
   gtk_tree_model_get_iter (model, &iter, path);
   gtk_tree_model_get (model, &iter, DIR_COLUMN, &filename, -1);
+  filename = get_real_filename (filename, TRUE);
   gtk_file_selection_populate (fs, filename, FALSE, FALSE);
   g_free (filename);
 }
diff -ur gtk+-2.0.6.orig/gtk/gtkmain.c gtk+-2.0.6/gtk/gtkmain.c
--- gtk+-2.0.6.orig/gtk/gtkmain.c	2002-06-14 22:57:20.000000000 +0900
+++ gtk+-2.0.6/gtk/gtkmain.c	2002-08-25 02:42:32.000000000 +0900
@@ -781,7 +781,7 @@
     }
 }
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
 static void
 check_sizeof_GtkWindow (size_t sizeof_GtkWindow)
diff -ur gtk+-2.0.6.orig/gtk/gtkdebug.h gtk+-2.0.6/gtk/gtkdebug.h
--- gtk+-2.0.6.orig/gtk/gtkdebug.h	2002-02-22 02:13:38.000000000 +0900
+++ gtk+-2.0.6/gtk/gtkdebug.h	2002-08-28 15:55:22.000000000 +0900
@@ -52,7 +52,7 @@
       
 #endif /* G_ENABLE_DEBUG */
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #  ifdef GTK_COMPILATION
 #    define GTKVAR __declspec(dllexport)
 #  else
diff -ur gtk+-2.0.6.orig/gtk/gtktexttypes.h gtk+-2.0.6/gtk/gtktexttypes.h
--- gtk+-2.0.6.orig/gtk/gtktexttypes.h	2000-12-01 08:39:50.000000000 +0900
+++ gtk+-2.0.6/gtk/gtktexttypes.h	2002-08-28 16:02:38.000000000 +0900
@@ -21,7 +21,7 @@
  * Declarations for variables shared among the text-related files:
  */
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #ifdef GTK_COMPILATION
 #define VARIABLE __declspec(dllexport)
 #else
diff -ur gtk+-2.0.6.orig/gtk/queryimmodules.c gtk+-2.0.6/gtk/queryimmodules.c
--- gtk+-2.0.6.orig/gtk/queryimmodules.c	2002-08-01 05:14:42.000000000 +0900
+++ gtk+-2.0.6/gtk/queryimmodules.c	2002-09-09 03:16:42.000000000 +0900
@@ -31,7 +31,7 @@
 #endif
 #include <stdio.h>
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #define SOEXT ".dll"
 #else
 #define SOEXT ".so"
