mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 07:04:29 +00:00
GTK is a multi-platform toolkit for creating graphical user interfaces.
8caba9536c
Massive changes to OLE2 DnD protocol, which was completely broken before: * Keep GdkDragContext and OLE2 objects separate (don't ref/unref them together, don't necessarily create them together). * Keep IDataObject formats in the object itself, not in a global variable. * Fix getdata() to look up the request target in its format list, not in the global hash table * Create target GdkDragContext on each drag_enter, destroy it on drag_leave, whereas IDropTarget is created when a window becomes a drag destination and is re-used indefinitely. * Query the source IDataObject for its supported types, cache them in the target (!) context. This is how GTK+ works, honestly. * Remember current_src_object when we initiate a drag, to be able to detect later on that the data object is ours and use a shortcut when querying targets * Make sure GDK_DRAG_MOTION is only sent when something changes * Support GTK drag cursors * Ensure that exotic GTK clipboard formats are registered (but try to avoid registering formats that can't be used between applications). * Don't enumerate internal formats * Ensure that DnD indicator window can't accept drags or receive any kind of input (use WS_EX_TRANSPARENT). * Remove unneeded indentation in _gdk_win32_dnd_do_dragdrop() * Fix indentation in gdk_win32_drag_context_drop_finish() * Remove obsolete comments in _gdk_win32_window_register_dnd() * Check for DnD in progress when processing WM_KILLFOCUS, don't emit a grab break event in such cases (this allows alt-tabbing while DnD is in progress, though there may be lingering issues with focus after dropping...) * Support Shell ID List -> text/uri-list conversion, now it's possible to drop files (dragged from Explorer) on GTK+ applications * Explicitly use RegisterClipboardFormatA() when we know that the string is not in unicode. Otherwise explicitly use RegisterClipboardFormatW() with a UTF8->UTF16 converted string * Fix _gdk_win32_display_get_selection_owner() to correctly bail when selection owner HWND is NULL (looking up GdkWindow for NULL HWND always succeeds and returns the root window - not the intended effect) * More logging * Send DROP_FINISHED event after DnD loop ends * Send STATUS event on feedback * Move GetKeyboardState() and related code into _gdk_win32_window_drag_begin(), so that it's closer to the point where last_pt and start_pt are set * Use & 0x80 to check for the key being pressed. Windows will set low-order bit to 1 for all mouse buttons to indicate that they are toggled, so simply checking for the value not being 0 is not enough anymore. This is probably a new thing in modern W32 that didn't exist before (OLE2 DnD code is old). * Fixed (hopefully) and simplified HiDPI parts of the code. Also adds managed DnD implementation for W32 GDK backend (for both OLE2 and LOCAL protocols). Mostly a copy of the X11 backend code, but there are some minor differences: * doesn't use drag_window field in GdkDragContext, uses the one in GdkWin32DragContext exclusively * subtracts hotspot offset from the window coordinates when showing the dragback animation * tries to consistently support scaling and caches the scale in the context * Some keynav code is removed (places where grabbing/ungrabbing should happen is marked with TODOs), and the rest is probably inert. Also significantly changes the way selection (and clipboard) is handled (as MSDN rightly notes, the handling for DnD and Clipboard formats is virtually the same, so it makes sense to handle both with the same code): * Don't spam GDK_OWNER_CHANGE, send them only when owner actually changes * Open clipboard when our process becomes the clipboard owner (we are doing it anyway, to empty the clipboard and *become* the owner), and then don't close it until a scheduled selection request event (with TARGETS target) is received. Process that event by announcing all of our supported formats (by that time add_targets() should have been called up the stack, thus the formats are known; just in case, add_targets() will also schedule a selection request, if one isn't scheduled already, so that late-coming formats can still be announced). * Allow clipboard opening for selection_convert() to be delayed if it fails initially. * The last two points above should fix all the bugs about GTK+ rising too much ruckus over OpenClipboard() failures, as owner change *is allowed* to fail (though not all callers currently handle that case), and selection_convert() is asynchronous to begin with. Still, this is somewhat risky, as there's a possibility that the code will work in unexpected ways and the clipboard will remain open. There's now logging to track the clipboard being opened and closed, and a number of failsafes that try to ensure that it isn't kept open for no reason. * Added copious notes on the way clipboard works on X11, Windows and GDK-W32, also removed old comments in DnD implementation, replaced some of them with the new ones * A lot of crufty module-global variables are stuffed into a singleton object, GdkWin32Selection. It's technically possible to make it a sub-object of the Display object (the way Wayland backend does), but since Display object on W32 is a singleton anyway... why bother? * Fixed the send_change_events() a bit (was slightly broken in one of the previous iterations) * Ensure that there's no confusion between selection conversion (an artifact term from X11) and selection transmutation (changing the data to be W32-compatible) * Put all the transmutation code and format-target-matching code into gdkselection-win32.c, now this code isn't spread across multiple files. * Consequently, moved some code away from gdkproperty-win32.c and gdkdnd-win32.c * Extensive format transmutation checks for OLE2 DnD and clipboard. We now keep track of which format mappings are for transmutations, and which aren't (for example, when formats are passed as-is, or when a registered name is just an alias) * Put transmutation code into separate functions * Ensure that drop target keeps a format->target map for supported formats, this is useful when selection_convert() is called, as it only receives a single target and no hints on the format from which the data should be transmuted into this target. * Add clear_targets() on W32, to de called by GTK * Use g_set_object() instead of g_ref_object() where it is allowed. * Fix indentation (and convert tabs to spaces), remove unused variables https://bugzilla.gnome.org/show_bug.cgi?id=786509 |
||
---|---|---|
build | ||
demos | ||
docs | ||
examples | ||
gdk | ||
gtk | ||
libgail-util | ||
m4 | ||
m4macros | ||
modules | ||
po | ||
po-properties | ||
tests | ||
testsuite | ||
acinclude.m4 | ||
AUTHORS | ||
autogen.sh | ||
config.h.win32.in | ||
configure.ac | ||
COPYING | ||
gail-3.0.pc.in | ||
gdk-3.0.pc.in | ||
git.mk | ||
gtk-zip.sh.in | ||
gtk+-3.0.pc.in | ||
gtk+-unix-print-3.0.pc.in | ||
gtk+.doap | ||
HACKING | ||
INSTALL.in | ||
MAINTAINERS | ||
make-pot | ||
Makefile.am | ||
Makefile.decl | ||
makefile.msc | ||
NEWS | ||
NEWS.pre-1-0 | ||
README.commits | ||
README.in | ||
README.win32 | ||
sanitize-la.sh |
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://wiki.gnome.org/Projects/GTK+/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>