-----------
The History
-----------

For simpler installation and more consistent behaviour, official Windows build of mtPaint is packaged with its own copy of GTK+ runtime environment. Prior to version 3.40, it was GTK+ 2.6.4 - or more accurately, a mix of DLLs from official Windows distributions of GTK+ 2.6.4 and 2.6.9, with libgdk and libgtk being from 2.6.4. This allowed mtPaint to continue to support Windows 98, which became unsupported with GTK+ 2.8.

But since version 2.6.4 had been released in 2005, some improvements in Windows support in GTK+ have been made which are really desirable. Moreover, libraries such as libpng, libjpeg, LibTIFF, FreeType, and even zlib have undergone multiple version changes in the meantime, with bugfixes and other improvements. Still, upgrading the package to a newer official distribution of GTK+ would mean exposing the program to a new set of GTK+ bugs and quirks - which would be hard to detect and counter in time, because I myself do not run Windows. For this reason, mtPaint 3.40 comes with a custom build of GTK+ based on version 2.6.7 with a set of patches backported from the later versions, compiled from source along with all its dependencies.

-------------
The Specifics
-------------

Original patches from GTK+ tree contained in the cumulative patch:
- svn  7886 / git d73fa807875951d0240dce572398992d395bbe77
  Use GetDriveType() to recognize removable drives (in order to avoid
  (REVERTED: was making flash drives inaccessible from file selector)
- svn 12881 / git 0604a90098416694c1d26bfa920e34c3f5d61493
  Remove debugging output. (#302404, Frederic Crozat)
  (APPLIED: cleans up BMP loader)
- svn 12899 / git cf5324d980fcddad8318bf52f5315d39fc4221f6
  Don't grab focus to unrealized widgets. (#302240, Philip Langdale)
  (APPLIED: fixes possible glitch in radiobutton groups)
- svn 12903 / git 0ae5528968af2b0e28eebdb9c4b38f76af129707
  Take multi-monitor offset into account. (#302525)
  (APPLIED)
- svn 12946 / git 35f75bd3401d498201327fe00fa454deb351cee1
  Always initialize child-visible to FALSE, otherwise we may end up with the
  (PARTIALLY APPLIED: fixes possible glitch in GtkNotebook)
- svn 12968 / git ff576e3fe7dce780f2b892967fb16c073656d29d
  Check that GDK_IS_SCREEN(screen) (like the X11 backend does), not screen
  (APPLIED)
- svn 12991 / git 7c337b69f23d4200d4975cc35da13d1d3c00cc1f
  Don't blink the cursor if the entry is not editable. (#304171,Nikos
  (APPLIED)
- svn 12992 / git ef25506011d6bfa67294cdcc8bbdd40185f0bfaa
  Don't bind GDK_Page_Up and GDK_Page_Down twice. (#168333, Hazael Maldonado
  (APPLIED: fixes reaction to PageUp & PageDown keys in sliders)
- svn 12994 / git f4fc3fee869d901eba7b6eaf22a4794b15659a2e
  Keep the popup posted if the button is released over the cellview. This
  (APPLIED: fixes GtkComboBox)
- svn 13027 / git a9c0d119133ea9c22017cf7bb567b5de54b538c0
  If the keysym isn't one of the special cases this function takes care of,
  (APPLIED)
- svn 13057 / git 67f3c556626c6e9fa06b2143c87633e635ed733c
  If blitting from the root window, take the multi-monitor offset into
  (APPLIED)
- svn 13062 / git b27c1cc6ee8e5d86a628a3a96a8c3d56bdc00b7e
  Make autoscrolling work at the bottom of the screen.
  (APPLIED: fixes GtkComboBox)
- svn 13095 / git 36c4c40f8822aa519aa33fa3222f42fc6563dfa8
  Check for overflow. (#306394, Morten Welinder)
  (APPLIED: fixes PNM loader)
- svn 13200 / git 5e575c6df3a3e407042a666a9ba9cbb1e01c0b6c
  [Win32] Borrow this function from GLib HEAD. (_gtk_get_localedir): [Win32]
  (APPLIED: fixes possible problem with non-ASCII installation path)
- svn 13219 / git 4a37701aa1615c30d80a6840fbc836fc2896adaa
  Queue a draw on the old and new focus widgets, if their defaultness
  (APPLIED)
- svn 13224 / git c943c3552a7a8f2aee2bad0d3d694b67c6c8e41c
  Set the actions and suggested_action fields in the GdkDragContext to
  (APPLIED)
- svn 13267 / git 406be320feec1adec2e5794150cb3eea351cb1fb
  Connect to button-release-event as well, to handle touchscreen scenarios
  (APPLIED)
- svn 13438 / git 5454441a8336a0f96a3999143903e394ce1498cd
  Fix handling of Aiptek and Aiptek-like graphical tablets such as Trust on
  (APPLIED)
- svn 13493 / git 91f2fb2d4d3b8f5474121a396c1b191938ad3887
  don't iterate past the end of the string, so pango_layout_get_cursor_pos()
  (APPLIED: fixes a glitch in GtkEntry)
- svn 13498 / git 24d63ffe74df3b5f5780c8c9a8058c341f26da93
  Don't fail if we can't get a keyboard grab. (#168351)
  (APPLIED)
- svn 13588 / git 1cabe720eb48eb0fd29421b4dcdf8c3f58eaf71e
  Avoid spurious core pointer events when the tablet pen is lifted.
  (APPLIED)
- svn 13738 / git bd80abab9f749698ad034aa2a3b313ac62344b9c
  Backport from 2.8.
  (APPLIED: fixes possible crash in GtkComboBox)
- svn 14261 / git 21b6ed0024a44054d99c4930914f4eb81dfdd05b
  2.8.7
  (PARTIALLY APPLIED: fixes two vulnerabilities in XPM loader)
- svn 14527 / git 3750d5da6b2dc7e104b9cc19f60b5724032e67c2
  Get the invalidated region from ScrollWindowEx() instead of an incorrect
  (APPLIED: fixes scrolling of partially covered windows)
- svn 15720 / git f93e5455e983144e133e18b5041aab29afc97360
  [WM_WINDOWPOSCHANGED] Replace identical code as in
  (APPLIED: prerequisite for svn 17834)
- svn 17096 / git 8d601fbde30fd28f9d9fc5e5ebc47cba5e56f351
  New file. Downloaded from freedesktop.org's webcvs. Slighly edited cursors
  (APPLIED: changes to several builtin cursors)
- svn 17299 / git ea7cc8d95eade637c67c5331a9f98863210ad8f1
  Fix Win32 resize events and flickering
  (APPLIED)
- svn 17615 / git f251591cf8d1d6c399485a4b0f95811e628e6b6f
  Fix menuitem rendering in Vista
  (BACKPORTED)
- svn 17645 / git 2cf71073edccd5a445a3baef5a158d85caf16520
  Use native Win32 cursors where it makes sense
  (APPLIED)
- svn 17834 / git 50af49319ad07682cd15913d264cb4a9570e1f8c
  Fix context iterations for handle_configure_event()
  (APPLIED)
- svn 20250 / git 710c9619b944e993f5402e04dc08846851b11f38
  leak of GDI region in function 'handle_wm_paint'
  (APPLIED)
- svn 20726 / git 0d0f9a7fc184db3ff8ce76e49256fee397de3d35
  Windows' System Menu blocks main loop
  (APPLIED)
- svn 20881 / git c8fef535b20ad75f82739f68fce2216c1d62f6ab
  Repaint glitches in widgets
  (APPLIED)
- svn 22511 / git 703a18c25fc4b1e8f06c4b9c8ea7cb74c06b3871
  Can not resize shaped windows on Windows
  (APPLIED)

In addition, there are couple of my own patches, solving the build problems arising from use of recent MinGW on a Linux box (in GTK+ 2.6.x time, official Windows packages were built with MSVC on Windows).

Patch from Pango tree:
- svn 2489 / git d686e1d4ae80b64390149e7336329c0254479161
  On Windows store the default aliases file in a string array. (#492517)
  (BACKPORTED: needed to handle 'pango.aliases' for Windows Vista & Windows 7)

---------
The Build
---------

The build was done on a Slackware Linux system using MinGW cross-compiler installation combined of the following parts:
- TDM-GCC 4.2.4		( http://www.tdragon.net/recentgcc/ )
- binutils 2.19		( http://mingw.sourceforge.net/ )
- MinGW runtime 3.15.2	( http://mingw.sourceforge.net/ )
- Win32 API 3.13	( http://mingw.sourceforge.net/ )

To replicate it, you need the following source packages:
- GTK+ 2.6.7 (this specific version and no other):
    gtk+-2.6.7.tar.bz2
    http://ftp.gtk.org/pub/gtk/v2.6/gtk+-2.6.7.tar.bz2
- Wintab development package:
    wtkit126.zip
    http://www.wacomeng.com/devsupport/downloads/pc/wtkit126.zip
- Pango 1.8.2 (this specific version and no other):
    pango-1.8.2.tar.bz2
    http://ftp.gtk.org/pub/gtk/v2.6/pango-1.8.2.tar.bz2
- ATK 1.9.0:
    atk-1.9.0.tar.bz2
    http://ftp.gtk.org/pub/gtk/v2.6/atk-1.9.0.tar.bz2
- GLib 2.6.6:
    glib-2.6.6.tar.bz2
    http://ftp.gtk.org/pub/gtk/v2.6/glib-2.6.6.tar.bz2
- GNU gettext 0.14.5:
    gettext-0.14.5.tar.gz
    http://ftp.gnu.org/gnu/gettext/gettext-0.14.5.tar.gz
- GNU libiconv 1.9.2:
    libiconv-1.9.2.tar.gz
    http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz
- zlib 1.2.5:
    zlib-1.2.5.tar.bz2
    http://zlib.net/zlib-1.2.5.tar.bz2
- XZ Utils 5.0.3:
    xz-5.0.3.tar.bz2
    http://tukaani.org/xz/xz-5.0.3.tar.bz2
- libpng 1.2.46:
    libpng-1.2.46.tar.gz
    ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.46.tar.gz
- libjpeg 8c:
    jpegsrc.v8c.tar.gz
    http://www.ijg.org/files/jpegsrc.v8c.tar.gz
- LibTIFF 4.0.0:
    tiff-4.0.0.tar.gz
    http://download.osgeo.org/libtiff/tiff-4.0.0.tar.gz
- FreeType 2.4.8:
    freetype-2.4.8.tar.bz2
    http://download.savannah.gnu.org/releases/freetype/freetype-2.4.8.tar.bz2
- giflib 4.1.6:
    giflib-4.1.6.tar.bz2
    http://heanet.dl.sourceforge.net/project/giflib/giflib%204.x/giflib-4.1.6/giflib-4.1.6.tar.bz2
- JasPer 1.900.1 (this specific version and no other):
    jasper-1.900.1.zip
    http://www.ece.uvic.ca/~mdadams/jasper/software/jasper-1.900.1.zip
- Little CMS 2.3:
    lcms2-2.3.tar.gz
    http://heanet.dl.sourceforge.net/project/lcms/lcms/2.3/lcms2-2.3.tar.gz
- Gifsicle 1.64:
    gifsicle-1.64.tar.gz
    http://www.lcdf.org/gifsicle/gifsicle-1.64.tar.gz
- mtPaint 3.40 (or later):
    mtpaint-3.40.tar.bz2

Also you need the following files from 'gtk' subdirectory of mtPaint source package:
  winbuild.sh
  gtk267_5wj.patch
  gtkrc
  pango182_1wj.patch
  pango.aliases

To recreate the "etc/pango/pango.modules" and "etc/gtk-2.0/gdk-pixbuf.loaders" files, you additionally need a working install of Wine.

To do the build, put all requisite files into same directory, adjust the variables in "CONFIGURATION SETTINGS" section of 'winbuild.sh' if necessary, and run 'winbuild.sh'. Subdirectory 'zad' will be created for use in the build process; if the build succeeds, executables and runtime files will be placed under 'zad/pkg', and development libraries and headers, under 'zad/dev'.

---------------------------------
Copyright (C) 2010,2011 Dmitry Groshev
