GTK is a multi-platform toolkit for creating graphical user interfaces.
Go to file
Aleksander Morgado 90de3c4fc0 win32: use the input locale to decide the default input method
GTK+ tries to automatically assign the best input module based on the
'system locale'. In the specific case of the IME input method, it will
be the default for the whole GTK+ application if the system locale is
either Japanese (ja), Korean (ko) or Chinese (zh). Other defaults are
equally applicable, e.g. if system locale is Catalan (ca), the special
'Cedilla' input module is chosen.

System locale can be changed (e.g. Win7) through the following sequence
(reboot required):
  Control Panel
    Region and Language
      Administrative
        Language for non-Unicode Programs
          Change system locale...

The problem with this behaviour is that changing the 'default input
language' (e.g. from English to Japanese+IME) doesn't affect the GTK+
application. Therefore, I can have an English system locale (where GTK+
will choose Simple IM by default) but then have Japanese+IME as input
language.

Default input language can be changed (e.g. Win7) through the following
sequence (no reboot required):
  System locale can be changed (e.g. Win7) through:
    Control Panel
      Region and Language
        Keyboards and Languages
          Keyboards and other input languages
            Change keyboards...

Default input language can also be changed using the language bar directly.

So, instead of using the system-wide default locale to decide which input
method to use as default, better use the input language specified by the
user, which may be the same as the system-wide default locale, or different.
Following the previous example, with an English system locale and a
Japanese+IME input language, the default input method will now be IME
instead of Simple, which is closer to what's expected by the user.

This change only affects the application during startup; i.e. if the user
changes the input language while the application is running, we wouldn't be
changing the default input method to use. We could do this processing the
WM_INPUTLANGCHANGE messages, though.

https://bugzilla.gnome.org/show_bug.cgi?id=700428
2013-08-31 14:28:10 -04:00
build MSVC Builds: Fix Build of Introspection Files 2013-08-28 14:27:02 +08:00
demos demo: add a multi-line infobar example 2013-08-03 15:15:12 +02:00
docs x11: Add EWMH workspace handling api 2013-08-24 00:51:56 -04:00
examples examples: Use git.mk 2013-08-07 06:18:07 -04:00
gdk gdkwindow-x11: Correct math for filling in the _NET_WM_OPAQUE_REGION property 2013-08-31 13:21:09 -04:00
gtk win32: use the input locale to decide the default input method 2013-08-31 14:28:10 -04:00
libgail-util Change FSF Address 2012-02-27 17:06:11 +00:00
m4 Do not use AC_CANONICAL_TARGET 2013-06-02 11:03:08 +02:00
m4macros m4: Fix GTK_CHECK_BACKEND() to also check for a minimum version 2011-02-17 09:33:07 +00:00
modules Fix missing return from quartz_filter_keypress 2013-08-29 14:12:09 -07:00
po Update Kazakh translation 2013-08-31 17:15:18 +06:00
po-properties Updated Slovenian translation 2013-08-30 22:58:15 +02:00
tests Add a test for animated row insertion/removal 2013-08-26 23:07:05 -04:00
testsuite Fix up a11y tests for recent changes 2013-08-30 22:24:09 -04:00
acinclude.m4 Copy newer versions of JH_CHECK_XML_CATALOG and JH_PATH_XML_CATALOG from 2003-08-10 22:30:02 +00:00
AUTHORS small update 2006-03-24 03:09:08 +00:00
autogen.sh Remove local copy of introspection.m4 2011-08-10 21:15:56 +01:00
config.h.win32.in Update config.h.win32(.in) 2013-08-30 13:48:12 +08:00
configure.ac Post release version bump 2013-08-20 18:54:41 -04:00
COPYING Change FSF Address 2012-02-27 17:06:11 +00:00
gail-3.0.pc.in Bump the version to 3.0.0 2011-02-10 14:41:02 -05:00
gdk-3.0.pc.in Try to fix linking 2011-12-05 20:58:21 -05:00
git.mk Update git.mk, respects AC_CONFIG_AUX_DIR now 2013-07-11 15:28:49 -04:00
gtk-engine-check-abi.sh Add a little script 2006-03-11 02:24:52 +00:00
gtk-zip.sh.in Drop gdk-pixbuf files 2010-06-27 23:30:02 +03:00
gtk+-3.0.pc.in Move pangoft2 to Requires.private 2011-11-22 09:42:31 -05:00
gtk+-unix-print-3.0.pc.in configure.ac: Support multiple GDK backends in one build 2011-01-03 11:59:45 -05:00
gtk+.doap doap: doap files are required to have a lowercase <name> 2013-08-14 12:06:05 +02:00
gtk+.spec.in Revert name change 2008-07-01 22:57:50 +00:00
HACKING Some updates 2011-01-30 02:57:59 -05:00
INSTALL.in Update installation instructions for 3.6 2012-09-24 18:53:03 -04:00
MAINTAINERS update file format 2007-08-08 03:11:35 +00:00
makecopyright Change FSF Address 2012-02-27 17:06:11 +00:00
Makefile.am Update git.mk, respects AC_CONFIG_AUX_DIR now 2013-07-11 15:28:49 -04:00
Makefile.decl Makefile.decl: Set G_TEST_SRCDIR and G_TEST_BUILDDIR 2013-05-29 21:35:53 -04:00
makefile.msc win32: update msvc build 2011-01-02 13:33:06 +01:00
NEWS 3.9.12 2013-08-20 18:53:57 -04:00
NEWS.pre-1-0 ooops, fogot this on my last commit... 1998-05-07 07:45:04 +00:00
README.commits Update README files to refer to git 2009-03-31 19:34:23 -04:00
README.in Update README.in 2013-08-20 15:37:13 +02:00
README.win32 Update README.win32 and Visual C++ Readme.txt's 2011-08-31 14:28:47 +08:00
sanitize-la.sh Some people use a hacked libtool that doesn't even install .la files 2010-04-12 13:42:31 +03:00
sanity_check Rename configure.in to configure.ac 2010-05-07 10:07:23 +02:00

The Win32 backend in GTK+ is not as stable or correct as the X11 one.

For prebuilt runtime and developer packages see
http://ftp.gnome.org/pub/gnome/binaries/win32/

Building GTK+ on Win32
======================

First you obviously need developer packages for the compile-time
dependencies: GDK-Pixbuf, Pango, atk, glib, gettext-runtime, libiconv at least.
See http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies .

For people compiling GTK+ with Visual C++ 2005 or later, it is
recommended that the same compiler is used for at least GDK-Pixbuf,
Pango, atk and glib so that crashes and errors caused by different CRTs
can be avoided.  The VS 2008 project files and/or VS Makefiles are
either already available or will be available in the next stable release.
Unfortunately compiling with Microsoft's compilers versions 2003 or earlier
is not supported as compiling the latest stable GLib (which *is* required for
building this GTK+ release) requires features from newer compilers
and/or Platform SDKs

After installing the dependencies, there are two ways to build GTK+
for win32.

1) GNU tools, ./configure && make install
-----------------------------------------

This requires you have mingw and MSYS.

Use the configure script, and the resulting Makefiles (which use
libtool and gcc to do the compilation). I use this myself, but it can
be hard to setup correctly.

The full script I run to build GTK+ 2.16 unpacked from a source
distribution is as below. This is from bulding GTK+ 2.16.5. I don't
use any script like this to build the development branch, as I don't
distribute any binaries from development branches.

# This is a shell script that calls functions and scripts from
# tml@iki.fi's personal work envíronment. It is not expected to be
# usable unmodified by others, and is included only for reference.

MOD=gtk+
VER=2.16.5
REV=1
ARCH=win32

THIS=${MOD}_${VER}-${REV}_${ARCH}

RUNZIP=${MOD}_${VER}-${REV}_${ARCH}.zip
DEVZIP=${MOD}-dev_${VER}-${REV}_${ARCH}.zip

HEX=`echo $THIS | md5sum | cut -d' ' -f1`
TARGET=c:/devel/target/$HEX

usedev
usemsvs6

(

set -x

DEPS=`latest --arch=${ARCH} glib atk cairo pango libpng zlib libtiff jpeg`
PROXY_LIBINTL=`latest --arch=${ARCH} proxy-libintl`

PKG_CONFIG_PATH=
for D in $DEPS; do
    PATH=/devel/dist/${ARCH}/$D/bin:$PATH
    [ -d /devel/dist/${ARCH}/$D/lib/pkgconfig ] && PKG_CONFIG_PATH=/devel/dist/${ARCH}/$D/lib/pkgconfig:$PKG_CONFIG_PATH
done

LIBPNG=`latest --arch=${ARCH} libpng`
ZLIB=`latest --arch=${ARCH} zlib`
LIBTIFF=`latest --arch=${ARCH} libtiff`
JPEG=`latest --arch=${ARCH} jpeg`

patch -p0 <<'EOF'
EOF

lt_cv_deplibs_check_method='pass_all' \
CC='gcc -mtune=pentium3 -mthreads' \
CPPFLAGS="-I/devel/dist/${ARCH}/${LIBPNG}/include \
-I/devel/dist/${ARCH}/${ZLIB}/include \
-I/devel/dist/${ARCH}/${LIBTIFF}/include \
-I/devel/dist/${ARCH}/${JPEG}/include \
-I/devel/dist/${ARCH}/${PROXY_LIBINTL}/include" \
LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
-L/devel/dist/${ARCH}/${ZLIB}/lib \
-L/devel/dist/${ARCH}/${LIBTIFF}/lib \
-L/devel/dist/${ARCH}/${JPEG}/lib \
-L/devel/dist/${ARCH}/${PROXY_LIBINTL}/lib -Wl,--exclude-libs=libintl.a \
-Wl,--enable-auto-image-base" \
LIBS=-lintl \
CFLAGS=-O2 \
./configure \
--enable-win32-backend \
--disable-gdiplus \
--with-included-immodules \
--without-libjasper \
--enable-debug=yes \
--enable-explicit-deps=no \
--disable-gtk-doc \
--disable-static \
--prefix=$TARGET &&

libtoolcacheize &&
rm gtk/gtk.def &&
(PATH="$PWD/gdk-pixbuf/.libs:/devel/target/$HEX/bin:$PATH" make -j3 install || (rm .libtool-cache* && PATH="/devel/target/$HEX/bin:$PATH" make -j3 install)) &&

PATH="/devel/target/$HEX/bin:$PATH" gdk-pixbuf-query-loaders >/devel/target/$HEX/etc/gtk-2.0/gdk-pixbuf.loaders &&

grep -v -E 'Automatically generated|Created by|LoaderDir =' <$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders >$TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp &&
    mv $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders.temp $TARGET/etc/gtk-2.0/gdk-pixbuf.loaders &&
grep -v -E 'Automatically generated|Created by|ModulesPath =' <$TARGET/etc/gtk-2.0/gtk.immodules >$TARGET/etc/gtk-2.0/gtk.immodules.temp &&
    mv $TARGET/etc/gtk-2.0/gtk.immodules.temp $TARGET/etc/gtk-2.0/gtk.immodules &&

./gtk-zip.sh &&

mv /tmp/${MOD}-${VER}.zip /tmp/$RUNZIP &&
mv /tmp/${MOD}-dev-${VER}.zip /tmp/$DEVZIP

) 2>&1 | tee /devel/src/tml/packaging/$THIS.log

(cd /devel && zip /tmp/$DEVZIP src/tml/packaging/$THIS.{sh,log}) &&
manifestify /tmp/$RUNZIP /tmp/$DEVZIP

You should not just copy the above blindly. There are some things in
the script that are very specific to *my* build setup on *my* current
machine. For instance the "latest" command, the "usedev" and
"usemsvs6" shell functions, the /devel/dist folder. The above script
is really just meant for reference, to give an idea. You really need
to understand what things like PKG_CONFIG_PATH are and set them up
properly after installing the dependencies before building GTK+.

As you see above, after running configure, one can just say "make
install", like on Unix. A post-build fix is needed, running
gdk-pixbuf-query-loaders once more to get a correct gdk-pixbuf.loaders
file.

For a 64-bit build you need to remove the gtk/gtk.def file and let it
be regenerated by the makefilery. This is because the 64-bit GTK dll
has a slightly different list of exported function names. This is on
purpose and not a bug. The API is the same at the source level, and
the same #defines of some function names to actually have a _utf8
suffix is used (just to keep the header simpler). But the
corresponding non-suffixed function to maintain ABI stability are not
needed in the 64-bit case (because there are no older EXEs around that
would require such for ABI stability).


2) Microsoft's tools
--------------------

Use the Microsoft compiler, cl and Make, nmake. Say nmake -f
makefile.msc in gdk and gtk. Be prepared to manually edit various
makefile.msc files, and the makefile snippets in build/win32.

There are also VS 2008/2010 solution and project files to build GTK+, which
are maintained by Chun-wei Fan.  They should build GTK+ out of the box,
provided that the afore-mentioned dependencies are installed.  They will
build GDK with the Win32 backend, GTK+ itself (with GAIL/a11y built in),
the GAIL-Util library and the gtk-demo program.

Please refer to the following GNOME Live! page for a more detailed ouline
on the process of building the GTK+ stack and its dependencies with Visual
C++:

https://live.gnome.org/GTK%2B/Win32/MSVCCompilationOfGTKStack

Alternative 1 also generates Microsoft import libraries (.lib), if you
have lib.exe available. It might also work for cross-compilation from
Unix.

I (Tor) use method 1 myself. Hans Breuer has been taking care of the MSVC
makefiles. At times, we disagree a bit about various issues, and for
instance the makefile.msc files might not produce identically named
DLLs and import libraries as the "autoconfiscated" makefiles and
libtool do. If this bothers you, you will have to fix the makefiles.

Using GTK+ on Win32
===================

To use GTK+ on Win32, you also need either one of the above mentioned
compilers. Other compilers might work, but don't count on it. Look for
prebuilt developer packages (DLLs, import libraries, headers) on the
above website.

Multi-threaded use of GTK+ on Win32
===================================

Multi-threaded GTK+ programs might work on Windows in special simple
cases, but not in general. Sorry. If you have all GTK+ and GDK calls
in the same thread, it might work. Otherwise, probably not at
all. Possible ways to fix this are being investigated.

Wintab
======

The tablet support uses the Wintab API. The Wintab development kit is
no longer required. The wintab.h header file is bundled with GTK+
sources. Unfortunately it seems that only Wacom tablets come with
support for the Wintab API nowadays.

--Tor Lillqvist <tml@iki.fi>, <tml@novell.com>
--Updated by Fan, Chun-wei <fanc999@yahoo.com.tw>