diff --git a/Makefile.am b/Makefile.am
index 14444964fd..382837057f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -47,47 +47,45 @@ MAINTAINERCLEANFILES = \
$(srcdir)/install-sh \
$(srcdir)/ltmain.sh \
$(srcdir)/missing \
- $(srcdir)/mkinstalldirs \
$(srcdir)/omf.make \
$(srcdir)/xmldocs.make \
$(srcdir)/gtk-doc.make \
$(srcdir)/ChangeLog \
`find "$(srcdir)" -type f -name Makefile.in -print`
-GDKTARGET=@gdktarget@
## Copy .pc files to target-specific names
-gtk+-$(GDKTARGET)-3.0.pc: gtk+-3.0.pc
- rm -f gtk+-$(GDKTARGET)-3.0.pc && \
- cp gtk+-3.0.pc gtk+-$(GDKTARGET)-3.0.pc
+gtk+-x11-3.0.pc gtk+-win32-3.0.pc gtk+-quartz-3.0.pc: gtk+-3.0.pc
+ rm -f $@ && \
+ cp gtk+-3.0.pc $@
-gdk-$(GDKTARGET)-3.0.pc: gdk-3.0.pc
- rm -f gdk-$(GDKTARGET)-3.0.pc && \
- cp gdk-3.0.pc gdk-$(GDKTARGET)-3.0.pc
+gdk-x11-3.0.pc gdk-win32-3.0.pc gdk-quartz-3.0.pc: gdk-3.0.pc
+ rm -f $@ && \
+ cp gdk-3.0.pc $@
-gtk+-$(GDKTARGET)-3.0-uninstalled.pc: gtk+-3.0-uninstalled.pc
- rm -f gtk+-$(GDKTARGET)-3.0-uninstalled.pc && \
- cp gtk+-3.0-uninstalled.pc gtk+-$(GDKTARGET)-3.0-uninstalled.pc
-
-gdk-$(GDKTARGET)-3.0-uninstalled.pc: gdk-3.0-uninstalled.pc
- rm -f gdk-$(GDKTARGET)-3.0-uninstalled.pc && \
- cp gdk-3.0-uninstalled.pc gdk-$(GDKTARGET)-3.0-uninstalled.pc
+gtk+-*-3.0-uninstalled.pc: gtk+-3.0-uninstalled.pc
+ rm -f $@ && \
+ cp gtk+-3.0-uninstalled.pc $@
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = gdk-$(GDKTARGET)-3.0.pc gtk+-$(GDKTARGET)-3.0.pc gail-3.0.pc
+pkgconfig_DATA = gdk-3.0.pc gtk+-3.0.pc gail-3.0.pc
+
+pkgconfig_DATA += ${GDK_BACKENDS:%=gtk+-%-3.0.pc}
+pkgconfig_DATA += ${GDK_BACKENDS:%=gdk-%-3.0.pc}
if OS_UNIX
pkgconfig_DATA += gtk+-unix-print-3.0.pc
endif
-DISTCLEANFILES = \
- gtk+-unix-print-3.0.pc \
- gtk+-$(GDKTARGET)-3.0.pc \
- gdk-$(GDKTARGET)-3.0.pc \
- gail-3.0.pc \
- gtk+-$(GDKTARGET)-3.0-uninstalled.pc \
- gdk-$(GDKTARGET)-3.0-uninstalled.pc \
- gail-3.0-uninstalled.pc \
+DISTCLEANFILES = \
+ gtk+-unix-print-3.0.pc \
+ gtk+-3.0.pc \
+ gtk+-x11-3.0.pc \
+ gdk-3.0.pc \
+ gdk-x11-3.0.pc \
+ gail-3.0.pc \
+ gtk+-3.0-uninstalled.pc \
+ gail-3.0-uninstalled.pc \
config.lt
distclean-local:
@@ -96,8 +94,7 @@ distclean-local:
fi
ChangeLog:
- @echo Creating $@
- @if test -d "$(srcdir)/.git"; then \
+ $(AM_V_GEN) if test -d "$(srcdir)/.git"; then \
(GIT_DIR=$(top_srcdir)/.git ./missing --run git log GTK_2_16_0^^.. --stat) | fmt --split-only > $@.tmp \
&& mv -f $@.tmp $@ \
|| ($(RM) $@.tmp; \
@@ -109,20 +106,7 @@ ChangeLog:
echo A git checkout and git-log is required to generate this file >> $@); \
fi
-## copy the default target for this platform to gdk-3.0.pc and gtk+-3.0.pc
-DEFAULT_GDKTARGET=x11
-install-data-hook:
- (cd $(DESTDIR)$(pkgconfigdir) && \
- test -f gdk-$(DEFAULT_GDKTARGET)-3.0.pc && \
- test -f gtk+-$(DEFAULT_GDKTARGET)-3.0.pc && \
- rm -f gdk-3.0.pc && cp -f gdk-$(DEFAULT_GDKTARGET)-3.0.pc gdk-3.0.pc && \
- rm -f gtk+-3.0.pc && cp -f gtk+-$(DEFAULT_GDKTARGET)-3.0.pc gtk+-3.0.pc) || \
- (cd $(DESTDIR)$(pkgconfigdir) && \
- rm -f gdk-3.0.pc && cp -f gdk-$(GDKTARGET)-3.0.pc gdk-3.0.pc && \
- rm -f gtk+-3.0.pc && cp -f gtk+-$(GDKTARGET)-3.0.pc gtk+-3.0.pc)
-
uninstall-local:
- rm -f $(DESTDIR)$(pkgconfigdir)/gdk-3.0.pc
rm -f $(DESTDIR)$(pkgconfigdir)/gtk+-3.0.pc
dist-hook:
diff --git a/Makefile.decl b/Makefile.decl
index 2f6c579d2d..1ecbc61fe5 100644
--- a/Makefile.decl
+++ b/Makefile.decl
@@ -17,9 +17,15 @@ XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \
1008 1009 4703 4721 4723 4729 4733 4751 9973 9974 9975 9976 9977 9978 9979 \
9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 \
9995 9996 9997 9998 9999
+
+if USE_X11
SKIP_GDKTARGET = \
- test "$(gdktarget)" != "x11" \
- && echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target."
+ false
+else
+SKIP_GDKTARGET = \
+ echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target."
+endif
+
XVFB_START = \
${XVFB} -help 2>/dev/null 1>&2 \
&& XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \
diff --git a/NEWS b/NEWS
index 9fe44fb3ae..42fa6dbce8 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,296 @@
+Overview of Changes in GTK+ 2.99.2
+==================================
+
+* More widget are using GtkStyleContext directly:
+ GtkToolItemGroup, GtkMenuItem, GtkImageMenuItem, GtkMenu,
+ GtkTearoffMenuItem, GtkCheckMenuItem, GtkMenuShell
+
+* gtk-builder-convert now accepts a --target-version option
+
+* Bug fixes:
+ 637965 GtkTreeCellDataFunc called with a wrong column arguments
+ 639127 Misc Win32 GDK building problems
+ 639157 GtkOrientable should add/remove "horizontal" and "vert...
+ 639209 Allow toggling the GtkSwitch by clicking the handle
+ 639286 include gtk/gtktextattributes.h not installed
+ 639327 gtk-builder-convert needs to convert gtkcomboboxentry...
+
+* Translation updates:
+ Arabic
+ Basque
+ Hebrew
+
+Overview of Changes from GTK+ 2.99.0 to 2.99.1
+==============================================
+
+* More widgets are using GtkStyleContext directly:
+ GtkColorButton, GtkColorSelection, GtkHSV,
+ GtkFontSelection, GtkPrintUnixDialog, GtkImage,
+ GtkLayout, GtkViewport, GtkTextDisplay, GtkTextUtil,
+ GtkCalendar
+
+* GtkBuilder support has been added for setting menus
+ on GtkMenuToolButtons and for adding tags to
+ GtkTextTagTable as well as adding items to
+ GtkComboBoxText
+
+* Bug fixes:
+ 350618 start rubber banding on "white space"
+ 612918 Support disabling X11 extensions
+ 635687 problem with pygtk or gtk with gtk.Plug and gtk.Socket...
+ 638017 GtkTextView: Crash in gtk_text_view_set_tabs()
+ 638119 GtkSpinner animation not correctly stopped...
+ 638880 Need a setter for has_user_ref_count
+ 639030 Small cleanup in gailtextview code.
+ 639047 Fix remaining usage of g[dk]ktargetlib.
+ 639079 Obtain the fg color from the renderer
+ 639105 Port GtkTextDisplay to StyleContext.
+ 639106 New CSS style misses distinction between "selected focused"...
+ 639127 Misc Win32 GDK building problems
+ 639157 GtkOrientable should add/ remove "horizontal" and "vertical"...
+
+* Translation updates:
+ British English
+ Galician
+ Hebrew
+ Indonesian
+ Spanish
+
+
+Overview of Changes from GTK+ 2.91.7 to 2.99.0
+==============================================
+
+* Deprecations and removals:
+ - Long-obsolete linuxfb-related GtkWindow APIs have been dropped
+ - All remaining G_SEALed struct members have been removed
+ - GtkThemeEngine has been removed
+ - gdk_display_get_window_at_device_position() has been renamed to
+ gdk_device_get_window_at_position()
+ - gdk_display_get_device_state() has been renamed to
+ gdk_device_get_position()
+ - gdk_device_set_source() has been dropped
+ - gdk_set_pointer_hooks(), gdk_display_set_pointer_hooks() and
+ gdk_display_set_device_hooks() have been removed
+ - The deprecated GtkNotebook:tab-pack child property has been removed
+ - The deprecated gtk_quit_add() functions have been removed
+ - The GtkRange update-policy facility has been removed
+
+* The gtk-update-icon-cache and gtk-builder-convert utilities have
+ been renamed back to their un-suffixed names. Distributions will
+ have to resolve the conflict between GTK+ 2.x and 3.0 packages
+ by dropping one set of the utilities and adding a dependency.
+
+* It is now possible to include multiple GDK backends in a single
+ library. The --with-gdk-backend option has been split into separate
+ --enable-{x11,win32,quartz}-backend options.
+
+* The GDK Quartz backend has been ported to the new GDK backend API
+
+* A number of widgets have been ported to use GtkStyleContext directly:
+ GtkAccelLabel, GtkArrow, GtkSeparator, GtkSpinButton, GtkMessageDialog,
+ GtkFrame, GtkEventBox, GtkScrolledWindow, GtkProgressBar, GtkEntry,
+ GtkFileChooserEntry, GtkSwitch, GtkHandleBox, GtkToolbar, GtkFixed,
+ GtkToolPalette, GtkAboutDialog, GtkAssistant, GtkTrayIcon, GtkPaned,
+ GtkToolButton, GtkSocket, GtkRecentChooser, GtkTooltip, GtkPathBar,
+ GtkWin32EmbedWidget, GtkCellView, GtkDialog, GtkDrawingArea, GtkPlug,
+ GtkEntryCompletion, GtkFileChooserButton, GtkFileChooser, GtkHandleBox,
+ GtkLinkButton, GtkOffscreenWindow
+
+* Various problems with width-for-height geometry management have been
+ fixed in GtkAlignment, GtkCheckButton, GtkBin
+
+* The GtkComboBox, GtkIconView and GtkCellView widgets have been ported
+ to use GtkCellArea for their cell layouts
+
+* The cups print backend can now send print jobs directly in PDF if
+ cups supports it
+
+* GtkNumerableIcon is a variant of GEmblemedIcon for using numbers
+ as emblems
+
+* Bugs fixed:
+ 144324 Leaking dnd contexts with XDnD
+ 165987 unsets DESKTOP_STARTUP_ID
+ 307963 GtkSpinButton clamps value with the wrong maximum.
+ 321958 gtk.Calendar Notes should also say the format of year
+ 533745 Segfault on gdk.DragContext.drag_get_selection()
+ 553404 Out-of-date comment in gtk_text_view_add_child_in_window()
+ 559503 Description should mention gregorian
+ 560177 Applications should send print jobs to CUPS in PDF format...
+ 562182 gtk_init() docs inaccurate
+ 599130 Ending a drag using space or enter doesn't always cause a...
+ 617312 Move documentation to inline comments: GtkDialog
+ 617315 Move documentation to inline comments: GtkDrawingArea
+ 617322 Move documentation to inline comments: GtkEntryCompletion
+ 617327 Move documentation to inline comments: GtkExpander
+ 617471 Migrate API docs from templates to source files...
+ 621720 Use $(AM_V_GEN) to silent the build a bit.
+ 622125 Note that gtk_show_uri needs gvfs to spawn URLs
+ 629955 Deprecate/remove gtk_main and gtk_init_add/remove* API
+ 633795 gdk_event_get_state wrongly extracts GDK_PROPERTY_NOTIFY...
+ 634711 Xlib warning when RANDR is missing
+ 635299 add gtk_selection_data_get_data_with_length API...
+ 637691 Eating events breaks proxied DND
+ 637721 gtk 2.91.6 issue with gtkcellrendererprogress
+ 637736 [GtkAboutDialog] Newlines are ignored in translator-credits
+ 637763 [GtkAboutDialog] no longer display contact link
+ 637834 gtk_widget_verify_invariants: relax toplevel checks
+ 637849 Shell segfaults when unicode characters after U+00FF...
+ 637895 gdk_pointer_grab() deprecated comment is not helpful enough
+ 637907 gtkwindow.h includes a private header
+ 637910 GtkSpinner - does not animate
+ 637958 print dialog doesn't fit on netbook screen size
+ 637974 Gtk+ 2.91.7 build of introspection fails
+ 638179 in draw signal handle call gtk_style_context_add_provider...
+ 638193 GtkSpinButton documentation out of date
+ 638231 GtkSwitch states translation
+ 638386 gdk_x11_display_init_input careless
+ 638580 'application' window's property released too late
+ 638608 gtkenums: add GTK_STATE_FLAG_NORMAL = 0
+
+* Updated translations:
+ Estonian
+ Kurdish
+ Norwegian bokmål
+ Punjabi
+ Spanish
+ Swedish
+ Uighur
+
+
+Overview of Changes from GTK+ 2.91.6 to 2.91.7
+==============================================
+
+* The treeview-refactor branch has been merged, bringing more
+ flexible cell arrangement with GtkCellArea, GtkCellAreaBox, etc
+
+* The gdk-backend branch has been merged. This branch cleans up the
+ internal frontend/backend separation in GDK, with the ultimate goal
+ of allowing to build a single gdk library that contains multiple
+ backends (interesting combinations are x11+wayland or quartz+x11).
+
+ For now, GDK is still restricted to a single backend, but
+ as a first step, the libraries no longer include the backend name
+ in their soname, but are just libgdk-3.0.so and libgtk-3.0.so.
+
+ Only the x11 backend has been kept up to date with this cleanup
+ work, other backends are broken in this release.
+
+* Deprecations and removals:
+ - G_SEALed struct members have been removed from GtkWindowGroup,
+ GtkDrawingArea, GtkTreeStore, GtkTreeModelSort, GtkTreeSelection,
+ GtkSocket, GtkPrintJob, GtkSelectionData
+ - Input device handling:
+ - gdk_display_list_devices, gdk_display_get_core_pointer,
+ gdk_input_set_extension_events, gtk_widget_set_extension_events,
+ gdk_devices_list have been removed
+ - gdk_display_warp_device has been replaced by gdk_device_warp
+ - gdk_enable_multidevice has been replaced by gdk_disable_multidevice
+ - Drag-and-Drop:
+ gdk_drag_context_new, gdk_drag_find_window and gdk_drag_get_protocol
+ have been removed
+ - Property handling:
+ Functions that deal with X11-specific encodings such as Compound Text
+ have been moved to backend-specific API:
+ gdk_string_to_compound_text[_for_display],
+ gdk_utf8_to_compound_text[_for_display], gdk_free_compound_text,
+ gdk_text_property_to_text_list[_for_display], gdk_free_text_list,
+ gdk_text_property_to_utf8_list
+ - Foreign windows:
+ Functions for dealing with GdkWindow wrappers around foreign
+ windows have been moved to backend-specific API.
+ - Application launching:
+ The gdk_spawn_* APIs have been removed, since they were trivial
+ wrappers around g_spawn_* on most platforms and can be replaced
+ by GIO GAppInfo APIs.
+ - Misc. other functions: gdk_net_wm_supports, gdk_set_locale,
+ gdkx_visual_get have been either removed, gdk_set_sm_client_id
+ has been moved to backend-specific API.
+
+* A number of GTK+ widgets have been ported to use GtkStyleContext
+ directly for rendering
+
+* The tracker search backend for the file chooser has been updated
+ to work with libtracker-sparql as available in tracker >= 0.9
+
+* The GtkAboutDialog has been given a facelift. It no longer
+ opens second-level dialogs
+
+* The GDK X11 backend now uses XI2 (including multi-device capabilities)
+ by default. Use gdk_disable_multidevice() to switch back to the
+ XI1/Core implementation
+
+* Bug fixes:
+ 629923 Consider always calling unmap() when unsetting MAPPED flag
+ 634657 Dynamically attached calendar does not respond to mouse clicks
+ 635401 Setting conflict warning does not disappear when conflict is fixed
+ 636732 Gtk+ fails to build
+ 636777 Leak in gtk_css_provider_get_named
+ 637018 Add checks for id-column/entry-text-column >= 0
+ 637069 Custom print settings set in custom-widget-apply are lost
+ 637155 Remove vestiges of support for themes using XSHAPE
+ 637156 Optimize gtk_widget_shape_combine_region (widget, NULL, ...)
+ 637189 gtk_cell_renderer_spin_start_editing uses g_ascii_strtod but...
+ 637243 docs: fix link failure on gtk-doc scanner binaries
+ 637256 gtkstylecontext: fix typos in annotations
+ 637464 Fix GdkWindowFilter internal refcounting
+ 637471 GTK2_RC_FILES should be renamed to GTK3_RC_FILES
+ 637520 Gtk+ seems to have broken Mutter
+ 637606 Missing out annotations for gtk_accelerator_parse and...
+ 637608 Problems with the new AboutDialog
+
+* Translation updates:
+ Estonian
+ Hebrew
+ Kazakh
+ Norwegian bokmål
+ Persian
+ Spanish
+ Vietnamese
+
+
+Overview of Changes from GTK+ 2.91.5 to 2.91.6
+==============================================
+
+* Deprecations, cleanups and API changes:
+ - GdkDrawable and some X11-specific APIs have been removed
+ - GtkStyle and GtkRcStyle have been deprecated
+ - The GdkWindowClass enumeration is now GdkWindowWindowClass
+ - gdk_window_get_geometry lost its depth argument
+ - The old, unused gtk_decorated_window_... functions have
+ been removed.
+
+* GtkComboBox has gained an 'active id' property that is
+ intended for easy binding to settings
+
+* GtkAppChooser: A new family of widgets that allow choosing
+ an application to open a file. This is strongly based on
+ the corresponding nautilus dialog, which it is replacing.
+
+* The GtkStyleContext branch has been merged, changing the APIs
+ that are used to do themed drawing, and the theme engine interfaces.
+ Among the new classes are GtkStyleContext (replacing GtkStyle) and
+ GtkCssProvider (replacing the gtkrc parser). The migration guide
+ contains a chapter about porting from GtkStyle to GtkStyleContext.
+
+* Bugs fixed:
+ 549720 Add a way to hide GtkScale's slider
+ 582557 need open with dialog box to use with IBM's Lotus Notes...
+ 619148 "active ID" properties (GtkComboBox)
+ 636060 use ATK_DEFINE_TYPE where possible
+ 636129 invalid uninstantiatable type `(null)' in cast to `GtkSpinner'
+ 636388 gtk3-demo craches (segfault) when pressing a key in the textarea...
+ 636511 New style override functions do not work on textview
+
+* Updated translations:
+ Estonian
+ Galician
+ Hebrew
+ Persian
+ Slovenian
+ Spanish
+
+
Overview of Changes from GTK+ 2.91.4 to 2.91.5
==============================================
diff --git a/README.win32 b/README.win32
index f7c8ca6307..fbbd691f92 100644
--- a/README.win32
+++ b/README.win32
@@ -85,7 +85,7 @@ LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
LIBS=-lintl \
CFLAGS=-O2 \
./configure \
---with-gdktarget=win32 \
+--enable-win32-backend \
--disable-gdiplus \
--with-included-immodules \
--without-libjasper \
diff --git a/autogen.sh b/autogen.sh
index 2b7c0e7987..4a373e9b95 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,130 +1,32 @@
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
+test -n "$srcdir" || srcdir=`dirname "$0"`
+test -n "$srcdir" || srcdir=.
-ORIGDIR=`pwd`
-cd $srcdir
-PROJECT=Gtk+
-TEST_TYPE=-d
-FILE=gdk
+olddir=`pwd`
+cd "$srcdir"
-DIE=0
-
-have_libtool=false
-if libtoolize --version < /dev/null > /dev/null 2>&1 ; then
- libtool_version=`libtoolize --version |
- head -1 |
- sed -e 's/^\(.*\)([^)]*)\(.*\)$/\1\2/g' \
- -e 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
- case $libtool_version in
- 2.*)
- have_libtool=true
- ;;
- esac
-fi
-if $have_libtool ; then : ; else
- echo
- echo "You must have libtool 2.2 installed to compile $PROJECT."
- echo "Install the appropriate package for your distribution,"
- echo "or get the source tarball at http://ftp.gnu.org/gnu/libtool/"
- DIE=1
-fi
-
-(gtkdocize --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "You must have gtk-doc installed to compile $PROJECT."
- echo "Install the appropriate package for your distribution,"
- echo "or get the source tarball at http://ftp.gnome.org/pub/GNOME/sources/gtk-doc/"
- DIE=1
-}
-
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "You must have autoconf installed to compile $PROJECT."
- echo "Install the appropriate package for your distribution,"
- echo "or get the source tarball at http://ftp.gnu.org/gnu/autoconf/"
- DIE=1
-}
-
-if automake-1.11 --version < /dev/null > /dev/null 2>&1 ; then
- AUTOMAKE=automake-1.11
- ACLOCAL=aclocal-1.11
-else if automake-1.10 --version < /dev/null > /dev/null 2>&1 ; then
- AUTOMAKE=automake-1.10
- ACLOCAL=aclocal-1.10
+GTKDOCIZE=`which gtkdocize`
+if test -z $GTKDOCIZE; then
+ echo "*** No GTK-Doc found, please install it ***"
+ exit 1
else
- echo
- echo "You must have automake 1,10.x or 1.11.x installed to compile $PROJECT."
- echo "Install the appropriate package for your distribution,"
- echo "or get the source tarball at http://ftp.gnu.org/gnu/automake/"
- DIE=1
+ gtkdocize || exit $?
fi
-fi
-
-if test "$DIE" -eq 1; then
- exit 1
-fi
-
-test $TEST_TYPE $FILE || {
- echo "You must run this script in the top-level $PROJECT directory"
- exit 1
-}
-
-# NOCONFIGURE is used by gnome-common; support both
-if ! test -z "$AUTOGEN_SUBDIR_MODE"; then
- NOCONFIGURE=1
-fi
-
-if test -z "$NOCONFIGURE"; then
- if test -z "$*"; then
- echo "I am going to run ./configure with no arguments - if you wish "
- echo "to pass any to it, please specify them on the $0 command line."
- fi
-fi
-
-if test -z "$ACLOCAL_FLAGS"; then
-
- acdir=`$ACLOCAL --print-ac-dir`
- m4list="glib-2.0.m4 glib-gettext.m4"
-
- for file in $m4list
- do
- if [ ! -f "$acdir/$file" ]; then
- echo "WARNING: aclocal's directory is $acdir, but..."
- echo " no file $acdir/$file"
- echo " You may see fatal macro warnings below."
- echo " If these files are installed in /some/dir, set the ACLOCAL_FLAGS "
- echo " environment variable to \"-I /some/dir\", or install"
- echo " $acdir/$file."
- echo ""
- fi
- done
-fi
-
-rm -rf autom4te.cache
# README and INSTALL are required by automake, but may be deleted by clean
# up rules. to get automake to work, simply touch these here, they will be
# regenerated from their corresponding *.in files by ./configure anyway.
touch README INSTALL
-gtkdocize || exit $?
-
-$ACLOCAL -I m4 $ACLOCAL_FLAGS || exit $?
-
-libtoolize --force || exit $?
-
-autoheader || exit $?
-
-$AUTOMAKE --add-missing || exit $?
-autoconf || exit $?
-cd $ORIGDIR || exit $?
-
-if test -z "$NOCONFIGURE"; then
- $srcdir/configure --enable-maintainer-mode $AUTOGEN_CONFIGURE_ARGS "$@" || exit $?
-
- echo
- echo "Now type 'make' to compile $PROJECT."
+AUTORECONF=`which autoreconf`
+if test -z $AUTORECONF; then
+ echo "*** No autoreconf found, please install it ***"
+ exit 1
+else
+ autoreconf --force --install --verbose || exit $?
fi
+
+cd "$olddir"
+test -n "$NOCONFIGURE" || "$srcdir/configure" "$@"
diff --git a/build/win32/vs9/gdk-win32.vcproj b/build/win32/vs9/gdk-win32.vcproj
index 1d6169cca3..ef0fc6e823 100644
--- a/build/win32/vs9/gdk-win32.vcproj
+++ b/build/win32/vs9/gdk-win32.vcproj
@@ -31,7 +31,7 @@
-
-
+
+
+
-
-
-
-
-
-
-
+
diff --git a/build/win32/vs9/gdk.vcprojin b/build/win32/vs9/gdk.vcprojin
index 60e0edea6d..9722543185 100644
--- a/build/win32/vs9/gdk.vcprojin
+++ b/build/win32/vs9/gdk.vcprojin
@@ -31,7 +31,7 @@
#include "libgdk.sourcefiles"
+
diff --git a/build/win32/vs9/gtk+.vsprops b/build/win32/vs9/gtk+.vsprops
index ba5f174139..6cfc45b261 100644
--- a/build/win32/vs9/gtk+.vsprops
+++ b/build/win32/vs9/gtk+.vsprops
@@ -8,13 +8,13 @@
>
@],
[turn on debugging @<:@default=debug_default@:>@]),,
enable_debug=debug_default)
-AC_ARG_ENABLE(xkb,
- [AC_HELP_STRING([--enable-xkb],
- [support XKB [default=maybe]])],,
- [enable_xkb="maybe"])
-AC_ARG_ENABLE(xinerama,
- [AC_HELP_STRING([--enable-xinerama],
- [support xinerama extension if available [default=yes]])],,
- [enable_xinerama="yes"])
+
AC_ARG_ENABLE(rebuilds,
[AC_HELP_STRING([--disable-rebuilds],
[disable all source autogeneration rules])],,
[enable_rebuilds=yes])
-AC_ARG_WITH(xinput,
- [AC_HELP_STRING([--with-xinput=@<:@no/yes@:>@], [support XInput])])
+AC_ARG_ENABLE(gtk2-dependency,
+ AC_HELP_STRING([--enable-gtk2-dependency],
+ [Do not build gtk-update-icon-cache and other shared tools]),,
+ [enable_gtk2_dependency=no])
-if test "$platform_win32" = yes; then
- gdktarget=win32
-else
- gdktarget=x11
+AM_CONDITIONAL(BUILD_ICON_CACHE, [test "x$enable_gtk2_dependency" = xno])
+
+AC_ARG_ENABLE(xkb,
+ [AC_HELP_STRING([--enable-xkb],
+ [support XKB extension [default=maybe]])],,
+ [enable_xkb="maybe"])
+AC_ARG_ENABLE(xinerama,
+ [AC_HELP_STRING([--enable-xinerama],
+ [support Xinerama extension if available [default=maybe]])],,
+ [enable_xinerama="maybe"])
+AC_ARG_ENABLE(xinput,
+ [AC_HELP_STRING([--enable-xinput],
+ [support XInput extension if available [default=yes]])],,
+ [enable_xinput="maybe"])
+AC_ARG_ENABLE(xrandr,
+ [AC_HELP_STRING([--enable-xrandr],
+ [support XRandR extension if available [default=maybe]])],,
+ [enable_xrandr="maybe"])
+AC_ARG_ENABLE(xfixes,
+ [AC_HELP_STRING([--enable-xfixes],
+ [support XFixes extension if available [default=maybe]])],,
+ [enable_xfixes="maybe"])
+AC_ARG_ENABLE(xcomposite,
+ [AC_HELP_STRING([--enable-xcomposite],
+ [support X Composite extension if available [default=maybe]])],,
+ [enable_xcomposite="maybe"])
+AC_ARG_ENABLE(xdamage,
+ [AC_HELP_STRING([--enable-xdamage],
+ [support X Damage extension if available [default=maybe]])],,
+ [enable_xdamage="maybe"])
+
+AC_ARG_ENABLE(x11-backend,
+ [AC_HELP_STRING([--enable-x11-backend],
+ [enable the X11 gdk backend])],
+ [backend_set=yes])
+AC_ARG_ENABLE(win32-backend,
+ [AC_HELP_STRING([--enable-win32-backend],
+ [enable the Win32 gdk backend])],
+ [backend_set=yes])
+AC_ARG_ENABLE(quartz-backend,
+ [AC_HELP_STRING([--enable-quartz-backend],
+ [enable the quartz gdk backend])],
+ [backend_set=yes])
+AC_ARG_ENABLE(broadway-backend,
+ [AC_HELP_STRING([--enable-broadway-backend],
+ [enable the broadway (HTML5) gdk backend])],
+ [backend_set=yes])
+
+if test -z "$backend_set"; then
+ if test "$platform_win32" = yes; then
+ enable_win32_backend=yes
+ else
+ enable_x11_backend=yes
+ fi
fi
-AC_ARG_WITH(gdktarget, [ --with-gdktarget=[[x11/win32/quartz/broadway]] select non-default GDK target],
- gdktarget=$with_gdktarget)
+cairo_backends=
+backend_immodules=
+GDK_BACKENDS=
+GDK_EXTRA_LIBS=
+GDK_EXTRA_CFLAGS=
+GDK_WINDOWING=
+GIO_PACKAGE=gio-2.0
+PANGO_PACKAGES="pango pangocairo"
-AC_SUBST(gdktarget)
-case $gdktarget in
- x11|win32|quartz|broadway) ;;
- *) AC_MSG_ERROR([Invalid target for GDK: use x11, broadway, quartz or win32.]);;
-esac
+if test "x$enable_x11_backend" == xyes; then
+ # GDK calls the xlib backend "x11," cairo calls it "xlib." Other
+ # backend names are identical.
+ cairo_backends="$cairo_backends cairo-xlib"
+ GDK_BACKENDS="$GDK_BACKENDS x11"
+ # Pull in gio-unix for GDesktopAppInfo usage, see at least
+ # gdkapplaunchcontext-x11.c
+ GIO_PACKAGE=gio-unix-2.0
+ backend_immodules="$backend_immodules,xim"
+ GDK_WINDOWING="$GDK_WINDOWING
+#define GDK_WINDOWING_X11"
+fi
-gdktargetlib=libgdk-$gdktarget-$GTK_API_VERSION.la
-gtktargetlib=libgtk-$gdktarget-$GTK_API_VERSION.la
+if test "x$enable_win32_backend" == xyes; then
+ cairo_backends="$cairo_backends cairo-win32"
+ GDK_BACKENDS="$GDK_BACKENDS win32"
+ backend_immodules="$backend_immodules,ime"
+ GDK_WINDOWING="$GDK_WINDOWING
+#define GDK_NATIVE_WINDOW_POINTER
+#define GDK_WINDOWING_WIN32"
+ GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
+ AM_CONDITIONAL(USE_WIN32, true)
+ PANGO_PACKAGES="pangowin32 pangocairo"
+else
+ AM_CONDITIONAL(USE_WIN32, false)
+fi
-AC_SUBST(gdktargetlib)
-AC_SUBST(gtktargetlib)
+if test "x$enable_quartz_backend" == xyes; then
+ cairo_backends="$cairo_backends cairo-quartz"
+ GDK_BACKENDS="$GDK_BACKENDS quartz"
+ GDK_WINDOWING="$GDK_WINDOWING
+#define GDK_WINDOWING_QUARTZ"
+ GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
+ AM_CONDITIONAL(USE_QUARTZ, true)
+else
+ AM_CONDITIONAL(USE_QUARTZ, false)
+fi
+
+if test "x$enable_broadway_backend" == xyes; then
+ GDK_BACKENDS="$GDK_BACKENDS broadway"
+ GDK_WINDOWING="$GDK_WINDOWING
+#define GDK_WINDOWING_BROADWAY"
+ GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lz"
+ AM_CONDITIONAL(USE_BROADWAY, true)
+else
+ AM_CONDITIONAL(USE_BROADWAY, false)
+fi
+
+# strip leading space
+GDK_BACKENDS=${GDK_BACKENDS/# }
+
+AC_SUBST(GDK_BACKENDS)
+
+if test -z "$GDK_BACKENDS"; then
+ AC_MSG_ERROR([No GDK backends selected.])
+fi
if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
@@ -364,21 +460,7 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
cairo-gobject >= cairo_required_version dnl
gdk-pixbuf-2.0 >= gdk_pixbuf_required_version])
-## In addition to checking that cairo is present, we also need to
-## check that the correct cairo backend is there. E.g. if the GDK
-## target is win32 we need the cairo-win32 backend and so on.
-cairo_backend=cairo-$gdktarget
-
-# GDK calls the xlib backend "x11," cairo calls it "xlib." Other
-# backend names are identical.
-if test "x$cairo_backend" = "xcairo-x11"; then
- cairo_backend=cairo-xlib
-fi
-if test "x$cairo_backend" = "xcairo-broadway"; then
- cairo_backend=cairo
-fi
-PKG_CHECK_MODULES(CAIRO_BACKEND,
- [$cairo_backend >= cairo_required_version])
+PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends])
if test "$os_win32" != yes; then
# libtool option to control which symbols are exported
@@ -669,53 +751,6 @@ else
fi
fi
-# `widechar' tests for gdki18n.h
-AC_MSG_CHECKING(for wchar.h)
-AC_TRY_CPP([#include ], gdk_wchar_h=yes, gdk_wchar_h=no)
-if test $gdk_wchar_h = yes; then
- AC_DEFINE(HAVE_WCHAR_H, 1, [Have wchar.h include file])
-fi
-AC_MSG_RESULT($gdk_wchar_h)
-
-# Check for wctype.h (for iswalnum)
-AC_MSG_CHECKING(for wctype.h)
-AC_TRY_CPP([#include ], gdk_wctype_h=yes, gdk_wctype_h=no)
-if test $gdk_wctype_h = yes; then
- AC_DEFINE(HAVE_WCTYPE_H, 1, [Have wctype.h include file])
-fi
-AC_MSG_RESULT($gdk_wctype_h)
-
-# in Solaris 2.5, `iswalnum' is in -lw
-GDK_WLIBS=
-AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
-
-oLIBS="$LIBS"
-LIBS="$LIBS $GDK_WLIBS"
-# The following is necessary for Linux libc-5.4.38
-AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
-AC_TRY_LINK([#include ],[
-#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
-# ifdef HAVE_WCTYPE_H
-# include
-# else
-# ifdef HAVE_WCHAR_H
-# include
-# endif
-# endif
-#else
-# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
-#endif
-iswalnum((wchar_t) 0);
-], gdk_working_wctype=yes, gdk_working_wctype=no)
-LIBS="$oLIBS"
-
-if test $gdk_working_wctype = no; then
- AC_DEFINE(HAVE_BROKEN_WCTYPE, 1, [Is the wctype implementation broken])
- GDK_WLIBS=
-fi
-AC_MSG_RESULT($gdk_working_wctype)
-AC_SUBST(GDK_WLIBS)
-
# Check for uxtheme.h (for MS-Windows Engine)
AC_MSG_CHECKING(for uxtheme.h)
AC_TRY_CPP([#include ], gtk_uxtheme_h=yes, gtk_uxtheme_h=no)
@@ -735,6 +770,7 @@ AC_ARG_ENABLE(modules,
[disable dynamic module loading])])
dynworks=false
+build_dynamic_modules=no
deps=
if test x$enable_modules = xno; then
AC_MSG_RESULT(no)
@@ -762,10 +798,12 @@ else
fi
if $dynworks; then
+ build_dynamic_modules=yes
AC_DEFINE(USE_GMODULE, 1,
[Define to 1 if gmodule works and should be used])
AC_MSG_RESULT(yes)
else
+ build_dynamic_modules=no
AC_MSG_RESULT(no)
fi
fi
@@ -782,8 +820,8 @@ dnl AC_HELP_STRING cause problems.
dnl AC_HELP_STRING([--with-included-immodules=MODULE1 MODULE2 ...],
dnl [build the specified input method modules into gtk])
AC_ARG_WITH(included_immodules,
-[ --with-included-immodules=MODULE1,MODULE2,...
- build the specified input methods into gtk])
+ AC_HELP_STRING([--with-included-immodules=MODULE1,MODULE2,...],
+ [build the specified input methods into gtk]))
if $dynworks; then
:
@@ -794,14 +832,7 @@ else
fi
fi
-all_immodules="am-et,cedilla,cyrillic-translit"
-if test "$gdktarget" = "win32"; then
- all_immodules="${all_immodules},ime"
-fi
-all_immodules="${all_immodules},inuktitut,ipa,multipress,thai,ti-er,ti-et,viqr"
-if test "$gdktarget" = "x11"; then
- all_immodules="${all_immodules},xim"
-fi
+all_immodules="am-et,cedilla,cyrillic-translit,inuktitut,ipa,multipress,thai,ti-er,ti-et,viqr$backend_immodules"
included_immodules=""
# If the switch specified without listing any specific ones, include all
@@ -865,13 +896,15 @@ dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
-if test $cross_compiling = yes; then
+if test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes; then
AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
if test x$GTK_UPDATE_ICON_CACHE = xno; then
REBUILD_PNGS=#
fi
fi
+AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$cross_compiling" = xyes || test "x$enable_gtk2_dependency" = xyes])
+
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
@@ -886,14 +919,12 @@ fi
# Windowing system checks
########################################
-GDK_EXTRA_LIBS="$GDK_WLIBS"
-GDK_EXTRA_CFLAGS=
-
# GTK+ uses some X calls, so needs to link against X directly
GTK_DEP_PACKAGES_FOR_X=
GTK_DEP_LIBS_FOR_X=
+X_EXTENSIONS=
-if test "x$gdktarget" = "xx11"; then
+if test "x$enable_x11_backend" == xyes; then
X_PACKAGES=fontconfig
#
@@ -991,10 +1022,13 @@ if test "x$gdktarget" = "xx11"; then
# Check for XKB support.
if test "x$enable_xkb" = "xyes"; then
- AC_MSG_WARN(XKB support explicitly enabled)
- AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
+ AC_CHECK_FUNC(XkbQueryExtension,
+ X_EXTENSIONS="$X_EXTENSIONS XKB"
+ AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension]),
+ AC_MSG_ERROR([*** XKB extension not found. Check 'config.log' for more details.]))
elif test "x$enable_xkb" = "xmaybe"; then
AC_CHECK_FUNC(XkbQueryExtension,
+ X_EXTENSIONS="$X_EXTENSIONS XKB"
AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension]))
else
AC_MSG_WARN(XKB support explicitly disabled)
@@ -1016,19 +1050,23 @@ if test "x$gdktarget" = "xx11"; then
CFLAGS="$gtk_save_CFLAGS"
- if test "x$enable_xinerama" = "xyes"; then
+ if test "x$enable_xinerama" != "xno"; then
# Check for Xinerama extension (Solaris impl or Xfree impl)
+ have_xfree_xinerama=false
+ have_solaris_xinerama=false
+
gtk_save_cppflags="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $x_cflags"
# Check for XFree
- AC_MSG_CHECKING(for Xinerama support on XFree86)
+ AC_MSG_CHECKING(for Xinerama packages)
- have_xfree_xinerama=false
if $PKG_CONFIG --exists xinerama ; then
+ AC_MSG_RESULT(yes)
have_xfree_xinerama=true
X_PACKAGES="$X_PACKAGES xinerama"
else
+ AC_MSG_RESULT(no)
AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
[AC_CHECK_HEADER(X11/extensions/Xinerama.h,
[GTK_ADD_LIB(x_extra_libs,Xinerama)
@@ -1037,14 +1075,12 @@ if test "x$gdktarget" = "xx11"; then
fi
if $have_xfree_xinerama ; then
+ X_EXTENSIONS="$X_EXTENSIONS Xinerama"
AC_DEFINE(HAVE_XFREE_XINERAMA, 1,
[Define to 1 if XFree Xinerama is available])
AC_DEFINE(HAVE_XINERAMA, 1,
[Define to 1 is Xinerama is available])
- AC_MSG_RESULT(yes)
else
- AC_MSG_RESULT(no)
-
case "$host" in
*-*-solaris*)
# Check for solaris
@@ -1057,6 +1093,7 @@ if test "x$gdktarget" = "xx11"; then
[#include ])])
if $have_solaris_xinerama ; then
+ X_EXTENSIONS="$X_EXTENSIONS Xinerama"
AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1,
[Define to 1 if solaris xinerama is available])
AC_DEFINE(HAVE_XINERAMA, 1,
@@ -1071,9 +1108,14 @@ if test "x$gdktarget" = "xx11"; then
esac
fi
fi
+ if test "x$enable_xinerama" = "xyes" ; then
+ if test "x$have_xfree_xinerama" != "xtrue" -a "x$have_solaris_xinerama" != "xtrue" ; then
+ AC_MSG_ERROR([*** Xinerama extension not found. Check 'config.log' for more details.])
+ fi
+ fi
# set up things for XInput
- if test "x$with_xinput" != "xno" && $PKG_CONFIG --exists "xi" ; then
+ if test "x$enable_xinput" != "xno" && $PKG_CONFIG --exists "xi" ; then
have_xinput=yes
AC_DEFINE(XINPUT_XFREE, 1,
@@ -1082,7 +1124,11 @@ if test "x$gdktarget" = "xx11"; then
X_PACKAGES="$X_PACKAGES xi"
AC_CHECK_HEADER(X11/extensions/XInput2.h,
- have_xinput2=yes; AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]))
+ have_xinput2=yes
+ X_EXTENSIONS="$X_EXTENSIONS XI2"
+ AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]),
+ X_EXTENSIONS="$X_EXTENSIONS XInput")
+
else
AC_DEFINE(XINPUT_NONE, 1,
[Define to 1 if no XInput should be used])
@@ -1091,11 +1137,22 @@ if test "x$gdktarget" = "xx11"; then
AM_CONDITIONAL(XINPUT_XFREE, test "x$have_xinput" = "xyes")
AM_CONDITIONAL(XINPUT_2, test "x$have_xinput2" = "xyes")
- # Check for the RANDR extension
- if $PKG_CONFIG --exists "xrandr >= 1.2.99" ; then
- AC_DEFINE(HAVE_RANDR, 1, [Have the Xrandr extension library])
+ if test "x$enable_xinput" = "xyes" ; then
+ if test "x$have_xinput" != "xyes" -a "x$have_xinput2" != "xyes" ; then
+ AC_MSG_ERROR([*** XInput extension not found. Check 'config.log' for more details.])
+ fi
+ fi
- X_PACKAGES="$X_PACKAGES xrandr"
+ # Check for the RANDR extension
+ if test x"$enable_xrandr" != xno; then
+ if $PKG_CONFIG --exists "xrandr >= 1.2.99" ; then
+ AC_DEFINE(HAVE_RANDR, 1, [Have the Xrandr extension library])
+
+ X_PACKAGES="$X_PACKAGES xrandr"
+ X_EXTENSIONS="$X_EXTENSIONS XRANDR"
+ elif test x"$enable_xrandr" = xyes; then
+ AC_MSG_ERROR([RANDR support requested but xrandr not found])
+ fi
fi
# Checks for Xcursor library
@@ -1108,29 +1165,44 @@ if test "x$gdktarget" = "xx11"; then
# Checks for XFixes extension
- if $PKG_CONFIG --exists xfixes ; then
- AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension])
+ if test x"$enable_xfixes" != xno; then
+ if $PKG_CONFIG --exists xfixes ; then
+ AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension])
- X_PACKAGES="$X_PACKAGES xfixes"
- GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xfixes"
+ X_PACKAGES="$X_PACKAGES xfixes"
+ X_EXTENSIONS="$X_EXTENSIONS XFIXES"
+ GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xfixes"
+ elif test x"$enable_xfixes" = xyes; then
+ AC_MSG_ERROR([XFixes support requested but xfixes not found])
+ fi
fi
# Checks for Xcomposite extension
- if $PKG_CONFIG --exists xcomposite ; then
- AC_DEFINE(HAVE_XCOMPOSITE, 1, [Have the XCOMPOSITE X extension])
+ if test x"$enable_xcomposite" != xno; then
+ if $PKG_CONFIG --exists xcomposite ; then
+ AC_DEFINE(HAVE_XCOMPOSITE, 1, [Have the XCOMPOSITE X extension])
- X_PACKAGES="$X_PACKAGES xcomposite"
- GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xcomposite"
+ X_PACKAGES="$X_PACKAGES xcomposite"
+ X_EXTENSIONS="$X_EXTENSIONS Composite"
+ GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xcomposite"
+ elif test x"$enable_xcomposite" = xyes; then
+ AC_MSG_ERROR([Xcomposite support requested but xcomposite not found])
+ fi
fi
# Checks for Xdamage extension
- if $PKG_CONFIG --exists xdamage ; then
- AC_DEFINE(HAVE_XDAMAGE, 1, [Have the XDAMAGE X extension])
+ if test x"$enable_xdamage" != xno; then
+ if $PKG_CONFIG --exists xdamage ; then
+ AC_DEFINE(HAVE_XDAMAGE, 1, [Have the XDAMAGE X extension])
- X_PACKAGES="$X_PACKAGES xdamage"
- GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xdamage"
+ X_PACKAGES="$X_PACKAGES xdamage"
+ X_EXTENSIONS="$X_EXTENSIONS DAMAGE"
+ GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xdamage"
+ elif test x"$enable_xdamage" = xyes; then
+ AC_MSG_ERROR([Xdamage support requested but xdamage not found])
+ fi
fi
if $have_base_x_pc ; then
@@ -1143,6 +1215,10 @@ if test "x$gdktarget" = "xx11"; then
LIBS="$gtk_save_libs"
AM_CONDITIONAL(USE_X11, true)
+
+ # strip leading space
+ X_EXTENSIONS=${X_EXTENSIONS/# }
+
else
XPACKAGES=
@@ -1152,32 +1228,8 @@ else
AM_CONDITIONAL(HAVE_X11R6, false)
fi
-if test "x$gdktarget" = "xwin32"; then
- GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
- AM_CONDITIONAL(USE_WIN32, true)
-else
- AM_CONDITIONAL(USE_WIN32, false)
-fi
-
-if test "x$gdktarget" = "xquartz"; then
- GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
- AM_CONDITIONAL(USE_QUARTZ, true)
-else
- AM_CONDITIONAL(USE_QUARTZ, false)
-fi
-
-if test "x$gdktarget" = "xbroadway" ; then
- GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lz"
-fi
-
# Check for Pango flags
-if test "x$gdktarget" = "xwin32"; then
- PANGO_PACKAGES="pangowin32 pangocairo"
-else
- PANGO_PACKAGES="pango pangocairo"
-fi
-
AC_MSG_CHECKING(Pango flags)
if $PKG_CONFIG --exists $PANGO_PACKAGES ; then
PANGO_CFLAGS=`$PKG_CONFIG --cflags $PANGO_PACKAGES`
@@ -1207,12 +1259,7 @@ fi
CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"
-# Pull in gio-unix for GDesktopAppInfo usage, see at least gdkapplaunchcontext-x11.c
-if test "x$gdktarget" = "xx11" || test "x$gdktarget" = "xbroadway" ; then
- GDK_PACKAGES="$PANGO_PACKAGES gio-unix-2.0 $X_PACKAGES gdk-pixbuf-2.0 $cairo_backend cairo-gobject"
-else
- GDK_PACKAGES="$PANGO_PACKAGES gio-2.0 gdk-pixbuf-2.0 $cairo_backend cairo-gobject"
-fi
+GDK_PACKAGES="$PANGO_PACKAGES $GIO_PACKAGE $X_PACKAGES gdk-pixbuf-2.0 $cairo_backends cairo-gobject"
GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES`"
GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS"
@@ -1221,7 +1268,7 @@ GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFL
# into the pkg-config files
#
if test $enable_explicit_deps != yes ; then
- GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0"
+ GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 cairo-gobject"
GDK_EXTRA_LIBS=
fi
@@ -1262,7 +1309,7 @@ else
fi
GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0"
-if test "x$gdktarget" = "xx11"; then
+if test "x$enable_x11_backend" == xyes; then
GTK_PACKAGES="$GTK_PACKAGES pangoft2"
fi
GTK_EXTRA_LIBS=
@@ -1331,8 +1378,10 @@ LIBS="$old_LIBS"
# Printing system checks
################################################################
+PRINT_BACKENDS="file lpr"
+
AC_ARG_ENABLE(cups,
- [AC_HELP_STRING([--disable-cups]
+ [AC_HELP_STRING([--disable-cups],
[disable cups print backend])],,
[enable_cups=auto])
@@ -1369,6 +1418,7 @@ else
AC_CHECK_HEADER(cups/cups.h,,AC_MSG_ERROR([[*** Sorry, cups-config present but cups/cups.h missing.]]))
+ PRINT_BACKENDS="$PRINT_BACKENDS cups"
AM_CONDITIONAL(HAVE_CUPS, true)
gtk_save_cflags="$CFLAGS"
@@ -1392,7 +1442,7 @@ fi
#
AC_ARG_ENABLE(papi,
- [AC_HELP_STRING([--disable-papi]
+ [AC_HELP_STRING([--disable-papi],
[disable papi print backend])],,
[enable_papi=auto])
@@ -1402,6 +1452,7 @@ else
AC_MSG_CHECKING(libpapi)
AC_CHECK_LIB(papi, papiServiceCreate, have_papi=yes, have_papi=no)
if test $have_papi = yes; then
+ PRINT_BACKENDS="$PRINT_BACKENDS papi"
AC_DEFINE([HAVE_PAPI], [], [Define to 1 if libpapi available])
fi
AM_CONDITIONAL(HAVE_PAPI, test $have_papi = yes)
@@ -1427,7 +1478,7 @@ if test "$os_win32" != "yes"; then
*** postscript backend enabled.]))
AC_CHECK_HEADER(cairo-svg.h,,AC_MSG_ERROR([
-*** Can't find cairo-svg.h. You must build Cairo with the
+*** Cannot find cairo-svg.h. You must build Cairo with the
*** svg backend enabled.]))
fi
@@ -1438,6 +1489,9 @@ AC_ARG_ENABLE(test-print-backend,
[AC_HELP_STRING([--enable-test-print-backend],
[build test print backend])],,
[enable_test_print_backend=no])
+if test "x$enable_test_print_backend" != "xno" ; then
+ PRINT_BACKENDS="$PRINT_BACKENDS test"
+fi
AM_CONDITIONAL(TEST_PRINT_BACKEND, test "x$enable_test_print_backend" != "xno")
@@ -1478,19 +1532,18 @@ GOBJECT_INTROSPECTION_CHECK([0.9.3])
#################################################
AC_ARG_ENABLE(packagekit,
- AC_HELP_STRING([--disable-packagekit],
- [build packagekit open with module]))
+ AC_HELP_STRING([--disable-packagekit],
+ [build packagekit open-with module]))
-ENABLE_PACKAGEKIT=
+build_packagekit=no
if test "os_win32" != "yes"; then
- if test "x$enable_packagekit" != "xno"; then
- ENABLE_PACKAGEKIT=1
- AC_DEFINE(ENABLE_PACKAGEKIT, 1, [define to enable packagekit])
- fi
+ if test "x$enable_packagekit" != "xno"; then
+ build_packagekit=yes
+ AC_DEFINE(ENABLE_PACKAGEKIT, 1, [define to enable packagekit])
+ fi
fi
-AC_SUBST(ENABLE_PACKAGEKIT)
-AM_CONDITIONAL(ENABLE_PACKAGEKIT, test "x$ENABLE_PACKAGEKIT" = "x1")
+AM_CONDITIONAL(ENABLE_PACKAGEKIT, test "x$build_packagekit" = "xyes")
##################################################
# Checks for gtk-doc and docbook-tools
@@ -1537,36 +1590,28 @@ AC_CONFIG_COMMANDS([gdk/gdkconfig.h], [
* This is a generated file. Please modify `configure.ac'
*/
-#ifndef GDKCONFIG_H
-#define GDKCONFIG_H
+#ifndef __GDKCONFIG_H__
+#define __GDKCONFIG_H__
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
-#ifndef GSEAL
-/* introduce GSEAL() here for all of Gdk and Gtk+ without the need to modify GLib */
-# ifdef GSEAL_ENABLE
-# define GSEAL(ident) _g_sealed__ ## ident
-# else
-# define GSEAL(ident) ident
-# endif
-#endif /* !GSEAL */
+#include
+
+G_BEGIN_DECLS
_______EOF
cat >>$outfile <<_______EOF
$gdk_windowing
-$gdk_wc
_______EOF
cat >>$outfile <<_______EOF
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
-#endif /* GDKCONFIG_H */
+#endif /* __GDKCONFIG_H__ */
_______EOF
@@ -1577,34 +1622,7 @@ _______EOF
mv $outfile gdk/gdkconfig.h
fi
],[
-if test "x$gdktarget" = "xx11" ; then
- gdk_windowing='
-#define GDK_WINDOWING_X11'
-elif test "x$gdktarget" = "xwin32" ; then
- gdk_windowing='
-#define GDK_NATIVE_WINDOW_POINTER
-
-#define GDK_WINDOWING_WIN32'
-elif test "x$gdktarget" = "xquartz" ; then
- gdk_windowing='
-#define GDK_WINDOWING_QUARTZ'
-elif test "x$gdktarget" = "xbroadway" ; then
- gdk_windowing='
-#define GDK_WINDOWING_BROADWAY'
-fi
-
-if test x$gdk_wchar_h = xyes; then
- gdk_wc='
-#define GDK_HAVE_WCHAR_H 1'
-fi
-if test x$gdk_wctype_h = xyes; then
- gdk_wc="\$gdk_wc
-#define GDK_HAVE_WCTYPE_H 1"
-fi
-if test x$gdk_working_wctype = xno; then
- gdk_wc="\$gdk_wc
-#define GDK_HAVE_BROKEN_WCTYPE 1"
-fi
+gdk_windowing='$GDK_WINDOWING'
])
dnl
@@ -1624,7 +1642,7 @@ AC_ARG_ENABLE(Bsymbolic,
enable_Bsymbolic=no)
LDFLAGS="${SAVED_LDFLAGS}"])
-if test "x${enable_Bsymbolic}" == "xyes"; then
+if test "x${enable_Bsymbolic}" = "xyes" ; then
GTK_LINK_FLAGS=-Wl,-Bsymbolic-functions
fi
AC_SUBST(GTK_LINK_FLAGS)
@@ -1637,7 +1655,6 @@ gdk-3.0.pc
gtk+-3.0.pc
gtk+-unix-print-3.0.pc
gail-3.0.pc
-gdk-3.0-uninstalled.pc
gtk+-3.0-uninstalled.pc
gail-3.0-uninstalled.pc
m4macros/Makefile
@@ -1655,6 +1672,7 @@ docs/reference/gdk/version.xml
docs/reference/gtk/Makefile
docs/reference/gtk/version.xml
docs/reference/libgail-util/Makefile
+docs/reference/libgail-util/version.xml
docs/tools/Makefile
build/Makefile
build/win32/Makefile
@@ -1695,5 +1713,19 @@ perf/Makefile
AC_OUTPUT
-echo "configuration:
- target: $gdktarget"
+# beautify the immodule list a bit
+included_immodules=${included_immodules//,/ }
+included_immodules=${included_immodules:-none}
+
+echo "configuration:"
+echo " GDK backends: $GDK_BACKENDS"
+if test "x$enable_x11_backend" = "xyes"; then
+echo " X11 extensions: $X_EXTENSIONS"
+fi
+echo " Print backends: $PRINT_BACKENDS"
+echo " Dynamic modules: $build_dynamic_modules"
+echo " Included immodules: $included_immodules"
+echo " PackageKit support: $build_packagekit"
+echo " Introspection: $found_introspection"
+echo " Debugging: $enable_debug"
+echo " Documentation: $enable_gtk_doc"
diff --git a/demos/Makefile.am b/demos/Makefile.am
index 9fe2ddc33a..dc6fcb632b 100644
--- a/demos/Makefile.am
+++ b/demos/Makefile.am
@@ -11,14 +11,13 @@ INCLUDES = \
$(GTK_DEBUG_FLAGS) \
$(GTK_DEP_CFLAGS)
-DEPS = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib)
+DEPS = \
+ $(top_builddir)/gtk/libgtk-3.0.la
-LDADDS = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib) \
- $(GTK_DEP_LIBS) \
+LDADDS = \
+ $(top_builddir)/gtk/libgtk-3.0.la \
+ $(top_builddir)/gdk/libgdk-3.0.la \
+ $(GTK_DEP_LIBS) \
$(MATH_LIB)
noinst_PROGRAMS = \
diff --git a/demos/gtk-demo/Makefile.am b/demos/gtk-demo/Makefile.am
index 43b706e7ed..5385dcbbb4 100644
--- a/demos/gtk-demo/Makefile.am
+++ b/demos/gtk-demo/Makefile.am
@@ -55,13 +55,12 @@ INCLUDES = \
$(GTK_DEP_CFLAGS)
DEPS = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib)
+ $(top_builddir)/gtk/libgtk-3.0.la
LDADDS = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib) \
- $(GTK_DEP_LIBS) \
+ $(top_builddir)/gtk/libgtk-3.0.la \
+ $(top_builddir)/gdk/libgdk-3.0.la \
+ $(GTK_DEP_LIBS) \
-lm
bin_PROGRAMS = gtk3-demo
diff --git a/demos/gtk-demo/assistant.c b/demos/gtk-demo/assistant.c
index 09f48d4653..232d345c07 100644
--- a/demos/gtk-demo/assistant.c
+++ b/demos/gtk-demo/assistant.c
@@ -110,7 +110,7 @@ create_page1 (GtkWidget *assistant)
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 1");
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), box, GTK_ASSISTANT_PAGE_INTRO);
- pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
+ pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
g_object_unref (pixbuf);
}
@@ -133,7 +133,7 @@ create_page2 (GtkWidget *assistant)
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), box, TRUE);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), box, "Page 2");
- pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
+ pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), box, pixbuf);
g_object_unref (pixbuf);
}
@@ -152,7 +152,7 @@ create_page3 (GtkWidget *assistant)
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), label, "Confirmation");
- pixbuf = gtk_widget_render_icon (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG, NULL);
+ pixbuf = gtk_widget_render_icon_pixbuf (assistant, GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), label, pixbuf);
g_object_unref (pixbuf);
}
diff --git a/demos/gtk-demo/changedisplay.c b/demos/gtk-demo/changedisplay.c
index 2e3d503f66..951d3730ab 100644
--- a/demos/gtk-demo/changedisplay.c
+++ b/demos/gtk-demo/changedisplay.c
@@ -27,6 +27,9 @@
* - Using GtkDialog
*/
#include
+
+#undef GDK_DISABLE_DEPRECATED
+
#include
#include "demo-common.h"
@@ -151,7 +154,7 @@ query_for_toplevel (GdkScreen *screen,
toplevel = NULL;
}
- gdk_cursor_unref (cursor);
+ g_object_unref (cursor);
gtk_widget_destroy (popup);
gdk_flush (); /* Really release the grab */
diff --git a/demos/gtk-demo/clipboard.c b/demos/gtk-demo/clipboard.c
index e77b88c9b2..1a321cc682 100644
--- a/demos/gtk-demo/clipboard.c
+++ b/demos/gtk-demo/clipboard.c
@@ -77,8 +77,8 @@ get_image_pixbuf (GtkImage *image)
return g_object_ref (gtk_image_get_pixbuf (image));
case GTK_IMAGE_STOCK:
gtk_image_get_stock (image, &stock_id, &size);
- return gtk_widget_render_icon (GTK_WIDGET (image),
- stock_id, size, NULL);
+ return gtk_widget_render_icon_pixbuf (GTK_WIDGET (image),
+ stock_id, size);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
@@ -125,7 +125,7 @@ drag_data_received (GtkWidget *widget,
{
GdkPixbuf *pixbuf;
- if (selection_data->length > 0)
+ if (gtk_selection_data_get_length (selection_data) > 0)
{
pixbuf = gtk_selection_data_get_pixbuf (selection_data);
gtk_image_set_from_pixbuf (GTK_IMAGE (data), pixbuf);
diff --git a/demos/gtk-demo/combobox.c b/demos/gtk-demo/combobox.c
index fbe6c12eeb..e9bf96ba22 100644
--- a/demos/gtk-demo/combobox.c
+++ b/demos/gtk-demo/combobox.c
@@ -65,8 +65,8 @@ create_stock_icon_store (void)
{
if (stock_id[i])
{
- pixbuf = gtk_widget_render_icon (cellview, stock_id[i],
- GTK_ICON_SIZE_BUTTON, NULL);
+ pixbuf = gtk_widget_render_icon_pixbuf (cellview, stock_id[i],
+ GTK_ICON_SIZE_BUTTON);
gtk_stock_lookup (stock_id[i], &item);
label = strip_underscore (item.label);
gtk_list_store_append (store, &iter);
diff --git a/demos/gtk-demo/offscreen_window.c b/demos/gtk-demo/offscreen_window.c
index 27ff99ef8d..f547f0727d 100644
--- a/demos/gtk-demo/offscreen_window.c
+++ b/demos/gtk-demo/offscreen_window.c
@@ -290,7 +290,6 @@ gtk_rotated_bin_realize (GtkWidget *widget)
g_signal_connect (bin->offscreen_window, "from-embedder",
G_CALLBACK (offscreen_window_from_parent), bin);
- gtk_widget_style_attach (widget);
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, window);
gtk_style_context_set_background (context, bin->offscreen_window);
diff --git a/demos/gtk-demo/offscreen_window2.c b/demos/gtk-demo/offscreen_window2.c
index 96d953dbbe..ee2e595673 100644
--- a/demos/gtk-demo/offscreen_window2.c
+++ b/demos/gtk-demo/offscreen_window2.c
@@ -228,7 +228,6 @@ gtk_mirror_bin_realize (GtkWidget *widget)
g_signal_connect (bin->offscreen_window, "from-embedder",
G_CALLBACK (offscreen_window_from_parent), bin);
- gtk_widget_style_attach (widget);
context = gtk_widget_get_style_context (widget);
gtk_style_context_set_background (context, window);
gtk_style_context_set_background (context, bin->offscreen_window);
diff --git a/demos/gtk-demo/stock_browser.c b/demos/gtk-demo/stock_browser.c
index e6fed81dd4..d0d3442034 100644
--- a/demos/gtk-demo/stock_browser.c
+++ b/demos/gtk-demo/stock_browser.c
@@ -166,9 +166,9 @@ create_model (void)
}
g_free (sizes);
- info.small_icon = gtk_widget_render_icon (window, info.id,
- size,
- NULL);
+ info.small_icon = gtk_widget_render_icon_pixbuf (window,
+ info.id,
+ size);
if (size != GTK_ICON_SIZE_MENU)
{
diff --git a/demos/gtk-demo/toolpalette.c b/demos/gtk-demo/toolpalette.c
index 2431d6a4fe..73ab5c1878 100644
--- a/demos/gtk-demo/toolpalette.c
+++ b/demos/gtk-demo/toolpalette.c
@@ -41,7 +41,7 @@ canvas_item_new (GtkWidget *widget,
GdkPixbuf *pixbuf;
stock_id = gtk_tool_button_get_stock_id (button);
- pixbuf = gtk_widget_render_icon (widget, stock_id, GTK_ICON_SIZE_DIALOG, NULL);
+ pixbuf = gtk_widget_render_icon_pixbuf (widget, stock_id, GTK_ICON_SIZE_DIALOG);
if (pixbuf)
{
diff --git a/demos/testpixbuf-scale.c b/demos/testpixbuf-scale.c
index ee57763c84..bfff451d9a 100644
--- a/demos/testpixbuf-scale.c
+++ b/demos/testpixbuf-scale.c
@@ -24,9 +24,9 @@ set_interp_type (GtkWidget *widget, gpointer data)
void
overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
{
- if (adjustment->value != overall_alpha)
+ if (gtk_adjustment_get_value (adjustment) != overall_alpha)
{
- overall_alpha = adjustment->value;
+ overall_alpha = gtk_adjustment_get_value (adjustment);
gtk_widget_queue_draw (darea);
}
}
diff --git a/docs/reference/gdk/Makefile.am b/docs/reference/gdk/Makefile.am
index 3015baa9fa..6eeffdb0d7 100644
--- a/docs/reference/gdk/Makefile.am
+++ b/docs/reference/gdk/Makefile.am
@@ -1,5 +1,4 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
AUTOMAKE_OPTIONS = 1.6
@@ -13,40 +12,39 @@ DOC_MAIN_SGML_FILE=gdk-docs.sgml
SCAN_OPTIONS=--deprecated-guards="GDK_ENABLE_BROKEN|GDK_DISABLE_DEPRECATED"
# The directory containing the source code. Relative to $(srcdir)
-DOC_SOURCE_DIR=../../../gdk
+DOC_SOURCE_DIR=../../../gdk ../../../gdk/x11
# Used for dependencies
HFILE_GLOB=$(top_srcdir)/gdk/*.h $(top_srcdir)/gdk/x11/gdkx.h
CFILE_GLOB=$(top_srcdir)/gdk/*.c
# Header files to ignore when scanning
-IGNORE_HFILES= \
+IGNORE_HFILES= \
gdkintl.h \
gdkmarshalers.h \
gdkkeysyms.h \
gdkinternals.h \
gdkprivate.h \
- gdkpoly-generic.h \
+ gdk*private.h \
keyname-table.h \
- win32 \
+ win32 \
x11 \
quartz
# Extra files to add when scanning (relative to $srcdir)
EXTRA_HFILES= \
- ../../../gdk/x11/gdkx.h
+ ../../../gdk/x11/gdkx.h
# CFLAGS and LDFLAGS for compiling scan program. Only needed
# if $(DOC_MODULE).types is non-empty.
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -I$(top_builddir)/gdk \
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ -I$(top_builddir)/gdk \
$(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS)
-GTKDOC_LIBS = $(top_builddir)/gdk/$(gdktargetlib)
-
+GTKDOC_LIBS = $(top_builddir)/gdk/libgdk-3.0.la $(GDK_DEP_LIBS)
# Extra options to supply to gtkdoc-mkdb
MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=gdk
@@ -57,86 +55,85 @@ content_files = \
multihead.sgml
# Images to copy into HTML directory
-HTML_IMAGES = \
+HTML_IMAGES = \
images/rotated-text.png \
- \
- images/X_cursor.png \
- images/arrow.png \
- images/based_arrow_down.png \
- images/based_arrow_up.png \
- images/boat.png \
- images/bogosity.png \
- images/bottom_left_corner.png \
- images/bottom_right_corner.png \
- images/bottom_side.png \
- images/bottom_tee.png \
- images/box_spiral.png \
- images/center_ptr.png \
- images/circle.png \
- images/clock.png \
- images/coffee_mug.png \
- images/cross.png \
- images/cross_reverse.png \
- images/crosshair.png \
- images/diamond_cross.png \
- images/dot.png \
- images/dotbox.png \
- images/double_arrow.png \
- images/draft_large.png \
- images/draft_small.png \
- images/draped_box.png \
- images/exchange.png \
- images/fleur.png \
- images/gobbler.png \
- images/gumby.png \
- images/hand1.png \
- images/hand2.png \
- images/heart.png \
- images/icon.png \
- images/iron_cross.png \
- images/left_ptr.png \
- images/left_side.png \
- images/left_tee.png \
- images/leftbutton.png \
- images/ll_angle.png \
- images/lr_angle.png \
- images/man.png \
- images/middlebutton.png \
- images/mouse.png \
- images/pencil.png \
- images/pirate.png \
- images/plus.png \
- images/question_arrow.png \
- images/right_ptr.png \
- images/right_side.png \
- images/right_tee.png \
- images/rightbutton.png \
- images/rtl_logo.png \
- images/sailboat.png \
- images/sb_down_arrow.png \
- images/sb_h_double_arrow.png \
- images/sb_left_arrow.png \
- images/sb_right_arrow.png \
- images/sb_up_arrow.png \
- images/sb_v_double_arrow.png \
- images/shuttle.png \
- images/sizing.png \
- images/spider.png \
- images/spraycan.png \
- images/star.png \
- images/target.png \
- images/tcross.png \
- images/top_left_arrow.png \
- images/top_left_corner.png \
- images/top_right_corner.png \
- images/top_side.png \
- images/top_tee.png \
- images/trek.png \
- images/ul_angle.png \
- images/umbrella.png \
- images/ur_angle.png \
- images/watch.png \
- images/xterm.png
+ images/X_cursor.png \
+ images/arrow.png \
+ images/based_arrow_down.png \
+ images/based_arrow_up.png \
+ images/boat.png \
+ images/bogosity.png \
+ images/bottom_left_corner.png \
+ images/bottom_right_corner.png \
+ images/bottom_side.png \
+ images/bottom_tee.png \
+ images/box_spiral.png \
+ images/center_ptr.png \
+ images/circle.png \
+ images/clock.png \
+ images/coffee_mug.png \
+ images/cross.png \
+ images/cross_reverse.png \
+ images/crosshair.png \
+ images/diamond_cross.png \
+ images/dot.png \
+ images/dotbox.png \
+ images/double_arrow.png \
+ images/draft_large.png \
+ images/draft_small.png \
+ images/draped_box.png \
+ images/exchange.png \
+ images/fleur.png \
+ images/gobbler.png \
+ images/gumby.png \
+ images/hand1.png \
+ images/hand2.png \
+ images/heart.png \
+ images/icon.png \
+ images/iron_cross.png \
+ images/left_ptr.png \
+ images/left_side.png \
+ images/left_tee.png \
+ images/leftbutton.png \
+ images/ll_angle.png \
+ images/lr_angle.png \
+ images/man.png \
+ images/middlebutton.png \
+ images/mouse.png \
+ images/pencil.png \
+ images/pirate.png \
+ images/plus.png \
+ images/question_arrow.png \
+ images/right_ptr.png \
+ images/right_side.png \
+ images/right_tee.png \
+ images/rightbutton.png \
+ images/rtl_logo.png \
+ images/sailboat.png \
+ images/sb_down_arrow.png \
+ images/sb_h_double_arrow.png \
+ images/sb_left_arrow.png \
+ images/sb_right_arrow.png \
+ images/sb_up_arrow.png \
+ images/sb_v_double_arrow.png \
+ images/shuttle.png \
+ images/sizing.png \
+ images/spider.png \
+ images/spraycan.png \
+ images/star.png \
+ images/target.png \
+ images/tcross.png \
+ images/top_left_arrow.png \
+ images/top_left_corner.png \
+ images/top_right_corner.png \
+ images/top_side.png \
+ images/top_tee.png \
+ images/trek.png \
+ images/ul_angle.png \
+ images/umbrella.png \
+ images/ur_angle.png \
+ images/watch.png \
+ images/xterm.png
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS= \
diff --git a/docs/reference/gdk/gdk-docs.sgml b/docs/reference/gdk/gdk-docs.sgml
index c77b8be902..7be666074f 100644
--- a/docs/reference/gdk/gdk-docs.sgml
+++ b/docs/reference/gdk/gdk-docs.sgml
@@ -20,8 +20,11 @@
+
+
+
@@ -34,7 +37,6 @@
-
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index f4b7e32999..459c1c242c 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -8,8 +8,6 @@ gdk_init
gdk_init_check
gdk_parse_args
gdk_get_display_arg_name
-gdk_set_locale
-gdk_set_sm_client_id
gdk_notify_startup_complete
gdk_notify_startup_complete_with_id
@@ -63,7 +61,6 @@ GdkStatus
GDKVAR
gdk_axis_use_get_type
gdk_byte_order_get_type
-gdk_cap_style_get_type
gdk_crossing_mode_get_type
gdk_cursor_type_get_type
gdk_drag_action_get_type
@@ -79,17 +76,14 @@ gdk_input_mode_get_type
gdk_input_source_get_type
gdk_modifier_type_get_type
gdk_notify_type_get_type
-gdk_overlap_type_get_type
gdk_property_state_get_type
gdk_prop_mode_get_type
gdk_scroll_direction_get_type
gdk_setting_action_get_type
gdk_status_get_type
-gdk_subwindow_mode_get_type
gdk_visibility_state_get_type
gdk_visual_type_get_type
gdk_window_attributes_type_get_type
-gdk_window_class_get_type
gdk_window_edge_get_type
gdk_window_hints_get_type
gdk_window_state_get_type
@@ -122,23 +116,17 @@ gdk_display_sync
gdk_display_flush
gdk_display_close
gdk_display_is_closed
-gdk_display_list_devices
gdk_display_get_event
gdk_display_peek_event
gdk_display_put_event
+gdk_display_has_pending
gdk_display_add_client_message_filter
gdk_display_set_double_click_time
gdk_display_set_double_click_distance
gdk_display_get_pointer
-gdk_display_get_device_state
+gdk_display_list_devices
gdk_display_get_window_at_pointer
-gdk_display_get_window_at_device_position
-GdkDisplayPointerHooks
-gdk_display_set_pointer_hooks
-GdkDisplayDeviceHooks
-gdk_display_set_device_hooks
gdk_display_warp_pointer
-gdk_display_warp_device
gdk_display_supports_cursor_color
gdk_display_supports_cursor_alpha
gdk_display_get_default_cursor_size
@@ -151,7 +139,11 @@ gdk_display_store_clipboard
gdk_display_supports_shapes
gdk_display_supports_input_shapes
gdk_display_supports_composite
+gdk_display_get_app_launch_context
+gdk_display_notify_startup_complete
+
+GDK_DISPLAY
GDK_DISPLAY_OBJECT
GDK_IS_DISPLAY
GDK_TYPE_DISPLAY
@@ -173,7 +165,8 @@ gdk_display_manager_get
gdk_display_manager_get_default_display
gdk_display_manager_set_default_display
gdk_display_manager_list_displays
-gdk_display_get_core_pointer
+gdk_display_manager_open_display
+
GDK_DISPLAY_MANAGER
GDK_DISPLAY_MANAGER_CLASS
@@ -219,10 +212,6 @@ gdk_screen_get_resolution
gdk_screen_set_resolution
gdk_screen_get_active_window
gdk_screen_get_window_stack
-
-gdk_spawn_on_screen
-gdk_spawn_on_screen_with_pipes
-gdk_spawn_command_line_on_screen
GDK_SCREEN
@@ -317,7 +306,6 @@ GDK_VISUAL_GET_CLASS
GdkVisualClass
-GdkVisualPrivate
gdk_visual_get_type
@@ -478,10 +466,8 @@ gdk_window_get_device_cursor
gdk_window_set_device_cursor
gdk_window_get_device_events
gdk_window_set_device_events
-
-
-GdkPointerHooks
-gdk_set_pointer_hooks
+gdk_window_get_source_events
+gdk_window_set_source_events
gdk_offscreen_window_get_surface
@@ -504,7 +490,6 @@ GDK_TYPE_FILTER_RETURN
GDK_TYPE_GRAVITY
GDK_TYPE_MODIFIER_TYPE
GDK_TYPE_WINDOW_ATTRIBUTES_TYPE
-GDK_TYPE_WINDOW_CLASS
GDK_TYPE_WINDOW_EDGE
GDK_TYPE_WINDOW_HINTS
GDK_TYPE_WINDOW_TYPE
@@ -515,7 +500,6 @@ GDK_TYPE_WM_FUNCTION
gdk_window_get_type
gdk_window_window_class_get_type
-GdkWindowObject
GdkWindowClass
GdkWindowImpl
GdkWindowImplClass
@@ -561,17 +545,8 @@ GdkAtom
GDK_ATOM_TO_POINTER
GDK_POINTER_TO_ATOM
GDK_NONE
-gdk_text_property_to_text_list
-gdk_text_property_to_text_list_for_display
-gdk_free_text_list
-gdk_text_property_to_utf8_list
gdk_text_property_to_utf8_list_for_display
-gdk_string_to_compound_text
-gdk_string_to_compound_text_for_display
-gdk_free_compound_text
gdk_utf8_to_string_target
-gdk_utf8_to_compound_text
-gdk_utf8_to_compound_text_for_display
gdk_atom_intern
gdk_atom_intern_static_string
gdk_atom_name
@@ -637,10 +612,6 @@ gdk_threads_add_timeout
gdk_threads_add_timeout_full
gdk_threads_add_timeout_seconds
gdk_threads_add_timeout_seconds_full
-
-
-gdk_threads_lock
-gdk_threads_unlock
@@ -690,25 +661,17 @@ gdk_keymap_get_type
-GdkDeviceManager
-gdkdevicemanager
-GdkDeviceManager
+GdkDevice
+gdkdevice
GdkDevice
-GdkDeviceType
GdkInputSource
GdkInputMode
-GdkDeviceKey
-GdkDeviceAxis
GdkAxisUse
+GdkDeviceType
GdkGrabOwnership
-gdk_enable_multidevice
-gdk_device_manager_get_display
-gdk_device_manager_list_devices
-gdk_device_manager_get_client_pointer
gdk_device_get_name
-gdk_device_set_source
gdk_device_get_source
gdk_device_set_mode
gdk_device_get_mode
@@ -717,11 +680,13 @@ gdk_device_get_key
gdk_device_set_axis_use
gdk_device_get_axis_use
gdk_device_get_associated_device
+gdk_device_list_slave_devices
gdk_device_get_device_type
gdk_device_get_display
gdk_device_get_has_cursor
gdk_device_get_n_axes
gdk_device_get_n_keys
+gdk_device_warp
gdk_device_grab
@@ -729,6 +694,8 @@ gdk_device_ungrab
gdk_device_get_state
+gdk_device_get_position
+gdk_device_get_window_at_position
gdk_device_get_history
gdk_device_free_history
GdkTimeCoord
@@ -736,14 +703,6 @@ gdk_device_get_axis
gdk_device_list_axes
gdk_device_get_axis_value
-
-gdk_input_set_extension_events
-GdkExtensionMode
-
-
-gdk_devices_list
-gdk_device_get_core_pointer
-
GDK_TYPE_AXIS_USE
GDK_TYPE_EXTENSION_MODE
@@ -751,12 +710,6 @@ GDK_TYPE_INPUT_MODE
GDK_TYPE_INPUT_SOURCE
GDK_TYPE_DEVICE_TYPE
GDK_TYPE_GRAB_OWNERSHIP
-GDK_DEVICE_MANAGER
-GDK_DEVICE_MANAGER_CLASS
-GDK_DEVICE_MANAGER_GET_CLASS
-GDK_IS_DEVICE_MANAGER
-GDK_IS_DEVICE_MANAGER_CLASS
-GDK_TYPE_DEVICE_MANAGER
GDK_DEVICE
GDK_DEVICE_CLASS
GDK_DEVICE_GET_CLASS
@@ -766,15 +719,33 @@ GDK_TYPE_DEVICE
GdkDeviceClass
-GdkDevicePrivate
-GdkDeviceManagerClass
-GdkDeviceManagerPrivate
gdk_device_get_type
-gdk_device_manager_get_type
gdk_device_type_get_type
GDK_MAX_TIMECOORD_AXES
+
+GdkDeviceManager
+gdkdevicemanager
+GdkDeviceManager
+gdk_disable_multidevice
+gdk_device_manager_get_display
+gdk_device_manager_list_devices
+gdk_device_manager_get_client_pointer
+
+
+GDK_DEVICE_MANAGER
+GDK_DEVICE_MANAGER_CLASS
+GDK_DEVICE_MANAGER_GET_CLASS
+GDK_IS_DEVICE_MANAGER
+GDK_IS_DEVICE_MANAGER_CLASS
+GDK_TYPE_DEVICE_MANAGER
+
+
+GdkDeviceManagerClass
+gdk_device_manager_get_type
+
+
Events
events
@@ -784,7 +755,6 @@ GDK_CURRENT_TIME
GDK_PRIORITY_EVENTS
GDK_PRIORITY_REDRAW
-
gdk_events_pending
gdk_event_peek
@@ -820,6 +790,8 @@ gdk_event_set_screen
gdk_event_get_screen
gdk_event_get_device
gdk_event_set_device
+gdk_event_get_source_device
+gdk_event_set_source_device
gdk_setting_get
@@ -909,30 +881,31 @@ gdk_cursor_get_type
Drag and Drop
dnd
+GdkDragContext
gdk_drag_get_selection
gdk_drag_abort
gdk_drop_reply
-gdk_drag_context_new
gdk_drag_drop
-gdk_drag_find_window
gdk_drag_find_window_for_screen
-gdk_drag_context_get_source_window
gdk_drag_begin
+gdk_drag_begin_for_device
gdk_drag_motion
gdk_drop_finish
-gdk_drag_get_protocol
gdk_drag_get_protocol_for_display
GdkDragProtocol
-GdkDragContext
GdkDragAction
gdk_drag_status
gdk_drag_drop_succeeded
+
gdk_drag_context_get_actions
gdk_drag_context_get_suggested_action
gdk_drag_context_get_selected_action
gdk_drag_context_list_targets
gdk_drag_context_get_device
gdk_drag_context_set_device
+gdk_drag_context_get_source_window
+gdk_drag_context_get_dest_window
+gdk_drag_context_get_protocol
GDK_DRAG_CONTEXT
@@ -961,25 +934,9 @@ GDK_SCREEN_XNUMBER
GDK_SCREEN_XSCREEN
GDK_CURSOR_XCURSOR
GDK_CURSOR_XDISPLAY
-gdkx_visual_get
-gdk_window_foreign_new
-gdk_window_foreign_new_for_display
-gdk_xid_table_lookup
-gdk_xid_table_lookup_for_display
-gdk_window_lookup
-gdk_window_lookup_for_display
gdk_x11_lookup_xdisplay
gdk_x11_get_server_time
-gdk_net_wm_supports
-gdk_x11_screen_supports_net_wm_hint
-gdk_x11_screen_get_window_manager_name
-gdk_x11_screen_get_monitor_output
-gdk_x11_screen_lookup_visual
-gdk_x11_window_set_user_time
-gdk_x11_window_move_to_current_desktop
gdk_x11_display_get_user_time
-gdk_x11_cursor_get_xcursor
-gdk_x11_cursor_get_xdisplay
gdk_x11_display_broadcast_startup_message
gdk_x11_display_get_startup_notification_id
gdk_x11_display_set_startup_notification_id
@@ -991,14 +948,24 @@ gdk_x11_display_error_trap_pop
gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_set_cursor_theme
gdk_x11_register_standard_event_type
+gdk_x11_screen_get_screen_number
+gdk_x11_screen_get_xscreen
+gdk_x11_screen_get_window_manager_name
+gdk_x11_screen_get_monitor_output
+gdk_x11_screen_lookup_visual
+gdk_x11_screen_supports_net_wm_hint
+gdk_x11_window_foreign_new_for_display
+gdk_x11_window_lookup_for_display
gdk_x11_window_get_xid
+gdk_x11_window_set_user_time
+gdk_x11_window_move_to_current_desktop
gdk_x11_get_default_root_xwindow
gdk_x11_get_default_screen
gdk_x11_get_default_xdisplay
gdk_x11_grab_server
-gdk_x11_screen_get_screen_number
-gdk_x11_screen_get_xscreen
gdk_x11_ungrab_server
+gdk_x11_cursor_get_xcursor
+gdk_x11_cursor_get_xdisplay
gdk_x11_visual_get_xvisual
gdk_x11_atom_to_xatom
gdk_x11_atom_to_xatom_for_display
@@ -1008,10 +975,30 @@ gdk_x11_get_xatom_by_name
gdk_x11_get_xatom_by_name_for_display
gdk_x11_get_xatom_name
gdk_x11_get_xatom_name_for_display
+gdk_x11_set_sm_client_id
+gdk_x11_display_text_property_to_text_list
+gdk_x11_free_text_list
+gdk_x11_display_string_to_compound_text
+gdk_x11_display_utf8_to_compound_text
+gdk_x11_free_compound_text
-GDK_HAVE_WCHAR_H
-GDK_HAVE_WCTYPE_H
+gdk_x11_app_launch_context_get_type
+gdk_x11_cursor_get_type
+gdk_x11_device_core_get_type
+gdk_x11_device_manager_core_get_type
+gdk_x11_device_manager_xi2_get_type
+gdk_x11_device_manager_xi_get_type
+gdk_x11_device_xi2_get_type
+gdk_x11_device_xi_get_type
+gdk_x11_display_get_type
+gdk_x11_display_manager_get_type
+gdk_x11_drag_context_get_type
+gdk_x11_keymap_get_type
+gdk_x11_screen_get_type
+gdk_x11_visual_get_type
+gdk_x11_window_get_type
+gdk_window_impl_x11_get_type
@@ -1033,7 +1020,6 @@ GDK_IS_APP_LAUNCH_CONTEXT
GDK_IS_APP_LAUNCH_CONTEXT_CLASS
GDK_TYPE_APP_LAUNCH_CONTEXT
GdkAppLaunchContextClass
-GdkAppLaunchContextPrivate
gdk_app_launch_context_get_type
diff --git a/docs/reference/gdk/gdk3.types b/docs/reference/gdk/gdk3.types
index bb8607d4f8..abf4374715 100644
--- a/docs/reference/gdk/gdk3.types
+++ b/docs/reference/gdk/gdk3.types
@@ -1,9 +1,13 @@
#include
-gdk_display_get_type
-gdk_display_manager_get_type
-gdk_screen_get_type
-gdk_window_get_type
-gdk_keymap_get_type
+gdk_app_launch_context_get_type
+gdk_cursor_get_type
gdk_device_get_type
gdk_device_manager_get_type
+gdk_display_get_type
+gdk_display_manager_get_type
+gdk_drag_context_get_type
+gdk_keymap_get_type
+gdk_screen_get_type
+gdk_visual_get_type
+gdk_window_get_type
diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am
index 42d23fc1c1..091f06d7b7 100644
--- a/docs/reference/gtk/Makefile.am
+++ b/docs/reference/gtk/Makefile.am
@@ -1,5 +1,4 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
AUTOMAKE_OPTIONS = 1.6
@@ -107,8 +106,8 @@ CPPFLAGS += \
-UGTK_DISABLE_SINGLE_INCLUDES
GTKDOC_LIBS = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib)
+ $(top_builddir)/gtk/libgtk-3.0.la \
+ $(GTK_DEP_LIBS)
# Extra options to supply to gtkdoc-mkdb
@@ -135,8 +134,7 @@ content_files = \
windows.sgml \
x11.sgml \
gtk-query-immodules-3.0.xml \
- gtk-update-icon-cache-3.0.xml \
- gtk-builder-convert-3.0.xml \
+ gtk-update-icon-cache.xml \
visual_index.xml \
getting_started.xml \
overview.xml
@@ -276,6 +274,8 @@ HTML_IMAGES = \
$(top_srcdir)/gtk/stock-icons/24/gtk-page-setup.png \
$(srcdir)/images/aboutdialog.png \
$(srcdir)/images/accel-label.png \
+ $(srcdir)/images/appchooserbutton.png \
+ $(srcdir)/images/appchooserdialog.png \
$(srcdir)/images/assistant.png \
$(srcdir)/images/button.png \
$(srcdir)/images/check-button.png \
@@ -328,7 +328,9 @@ HTML_IMAGES = \
$(srcdir)/images/layout-tbrl.png \
$(srcdir)/images/window-default.png \
$(srcdir)/images/hello-world.png \
- $(srcdir)/images/switch.png
+ $(srcdir)/images/grid-packing.png \
+ $(srcdir)/images/drawing.png \
+ $(srcdir)/images/switch.png \
$(srcdir)/images/linear.png \
$(srcdir)/images/ease.png \
$(srcdir)/images/ease-in-out.png \
@@ -352,7 +354,9 @@ HTML_IMAGES = \
$(srcdir)/images/sliders.png \
$(srcdir)/images/focus.png \
$(srcdir)/images/handles.png \
- $(srcdir)/images/extensions.png
+ $(srcdir)/images/extensions.png \
+ $(srcdir)/images/numerableicon.png \
+ $(srcdir)/images/numerableicon2.png
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=--extra-dir=../gdk/html \
@@ -371,8 +375,7 @@ EXTRA_DIST += version.xml.in
man_MANS = \
gtk-query-immodules-3.0.1 \
- gtk-update-icon-cache-3.0.1 \
- gtk-builder-convert-3.0.1
+ gtk-update-icon-cache.1
if ENABLE_MAN
diff --git a/docs/reference/gtk/building.sgml b/docs/reference/gtk/building.sgml
index ec232717c5..70802e53c9 100644
--- a/docs/reference/gtk/building.sgml
+++ b/docs/reference/gtk/building.sgml
@@ -2,7 +2,7 @@
-
+
Compiling the GTK+ libraries
3
@@ -30,7 +30,7 @@ How to compile GTK+ itself
your operating system will be available, either from your
operating system vendor or from independent sources. If such a
set of packages is available, installing it will get you
- programming wih GTK+ much faster than building it yourself. In
+ programming with GTK+ much faster than building it yourself. In
fact, you may well already have GTK+ installed on your system
already.
@@ -45,7 +45,7 @@ How to compile GTK+ itself
If you are building GTK+ from the distributed source packages,
- then won't need these tools installed; the necessary pieces
+ then you won't need these tools installed; the necessary pieces
of the tools are already included in the source packages. But
it's useful to know a bit about how packages that use these
tools work. A source package is distributed as a
@@ -57,14 +57,15 @@ How to compile GTK+ itself
tar xvfj gtk+-3.0.0.tar.bz2
- In the toplevel of the directory that is created, there will be
+ In the toplevel directory that is created, there will be
a shell script called configure which
you then run to take the template makefiles called
Makefile.in in the package and create
- makefiles customized for your operating system. The configure
- script can be passed various command line arguments to determine how
- the package is built and installed. The most commonly useful
- argument is the --prefix argument which
+ makefiles customized for your operating system.
+ The configure script can be passed
+ various command line arguments to determine how the package
+ is built and installed. The most commonly useful argument is
+ the --prefix argument which
determines where the package is installed. To install a package
in /opt/gtk you would run configure as:
@@ -210,22 +211,6 @@ How to compile GTK+ itself
message translation databases.
-
-
- The JPEG ,
- PNG , and
- TIFF image
- loading libraries are needed to compile GTK+. You probably
- already have these libraries installed, but if not, the
- versions you need are available in the
- dependencies directory on the the
- GTK+
- FTP site. . (Before installing these libraries
- from source, you should check if your operating system
- vendor has prebuilt packages of these libraries that you
- don't have installed.)
-
-
The libraries from the X window system are needed to build
@@ -246,10 +231,16 @@ How to compile GTK+ itself
Cairo
is a graphics library that supports vector graphics and image
- compositing. Both Pango and GTK+ use cairo for much of their
+ compositing. Both Pango and GTK+ use cairo for all of their
drawing.
+
+
+ The GdkPixbuf library provides facilities for loading
+ images in a variety of file formats.
+
+
gobject-introspection
@@ -289,8 +280,8 @@ How to compile GTK+ itself
make install mentioned above. If you're
lucky, this will all go smoothly, and you'll be ready to
start compiling your own GTK+
- applications. You can test your GTK+ installation
- by running the gtk-demo program that
+ applications. You can test your GTK+ installation
+ by running the gtk3-demo program that
GTK+ installs.
@@ -327,7 +318,7 @@ How to compile GTK+ itself
--with-included-immodules=MODULE1,MODULE2,...
- --enable-debug=[no|minimum|yes]
+ --enable-debug=[no/minimum/yes]
--disable-Bsymbolic
@@ -354,13 +345,27 @@ How to compile GTK+ itself
--enable-papi
- --with-xinput=[no|yes]
+ --enable-xinput
+ --disable-xinput
- --with-gdktarget=[x11|win32|quartz]
+ --enable-packagekit
+ --disable-packagekit
- --disable-introspection
+ --enable-x11-backend
+ --disable-x11-backend
+ --enable-win32-backend
+ --disable-win32-backend
+ --enable-quartz-backend
+ --disable-quartz-backend
+
+
+ --enable-introspection=[no/auto/yes]
+
+
+ --enable-gtk2-dependency
+ --disable-gtk2-dependency
@@ -371,14 +376,14 @@ How to compile GTK+ itself
Normally GTK+ will try to build the input method modules
- as little shared libraries that are loaded on
- demand. The --disable-modules
- argument indicates that they should all be built statically
- into the GTK+ library instead. This is useful for
- people who need to produce statically-linked binaries. If
- neither --disable-modules nor
- --enable-modules is specified, then
- the configure script will try to
+ as little shared libraries that are loaded on demand.
+ The --disable-modules argument
+ indicates that they should all be built statically
+ into the GTK+ library instead. This is useful for
+ people who need to produce statically-linked binaries.
+ If neither --disable-modules nor
+ --enable-modules is specified,
+ then the configure script will try to
auto-detect whether shared modules work on your system.
@@ -388,7 +393,8 @@ How to compile GTK+ itself
This option allows you to specify which input method modules you
- want to include.
+ want to include directly into the GTK+ shared library, as opposed
+ to building them as loadable modules.
@@ -396,10 +402,9 @@ How to compile GTK+ itself
--enable-debug
- Turns on various amounts of debugging support. Setting this to 'no'
- disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and
- all cast checks between different object types. Setting it to 'minimum'
- disables only cast checks. Setting it to 'yes' enables
+ Turns on various amounts of debugging support. Setting this to
+ 'no' disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and all cast checks between different object types. Setting it
+ to 'minimum' disables only cast checks. Setting it to 'yes' enables
runtime debugging.
The default is 'minimum'.
Note that 'no' is fast, but dangerous as it tends to destabilize
@@ -416,6 +421,8 @@ How to compile GTK+ itself
The option --disable-Bsymbolic
turns off the use of the -Bsymbolic-functions linker flag.
+ This is only necessary if you want to override GTK+ functions
+ by using LD_PRELOAD .
@@ -469,6 +476,21 @@ How to compile GTK+ itself
+
+ --disable-xinput and
+ --enable-xinput
+
+ Controls whether GTK+ is built with support for the XInput
+ or XInput2 extension. These extensions provide an extended
+ interface to input devices such as graphics tablets.
+ When this support is compiled in, specially written
+ GTK+ programs can get access to subpixel positions,
+ multiple simultaneous input devices, and extra "axes"
+ provided by the device such as pressure and tilt
+ information.
+
+
+
--disable-gtk-doc and
--enable-gtk-doc
@@ -513,33 +535,54 @@ How to compile GTK+ itself
- --with-xinput
+ --disable-packagekit and
+ --enable-packagekit
- Controls whether GTK+ is built with support for the XInput
- or XInput2 extension. These extensions provide an extended
- interface to input devices such as graphics tablets.
- When this support is compiled in, specially written
- GTK+ programs can get access to subpixel positions,
- multiple simultaneous input devices, and extra "axes"
- provided by the device such as pressure and tilt
- information.
+ By default the configure script will try
+ to build the PackageKit support for the open-with dialog if
+ the PackageKit libraries are found.
+ These options can be used to explicitly control whether
+ PackageKit support should be built.
+
- --with-gdktarget
+ --enable-x11-backend ,
+ --disable-x11-backend ,
+ --enable-win32-backend ,
+ --disable-win32-backend ,
+ --enable-quartz-backend ,
+ and --disable-quartz-backend
- Toggles between the supported backends for GDK.
- The default is x11, unless the platform is Windows, in which
- case the default is win32. Other supported backends are
- the quartz backend for OS X.
+ Enables specific backends for GDK. If none of these options
+ are given, the x11 backend will be enabled by default,
+ unless the platform is Windows, in which case the default is
+ win32. If any backend is explicitly enabled or disabled, no
+ other platform will be enabled automatically. Other
+ supported backends are the quartz backend for OS X.
+
- --disable-introspection
+ --enable-introspection
- Build without introspection support.
+ Build with or without introspection support.
+ The default is 'auto'.
+
+
+
+
+ --enable-gtk2-dependency or
+ --disable-gtk2-dependency
+
+
+ Whether to rely on an exiting gtk-update-icon-cache utility
+ instead of building our own. Distributions which are shipping
+ both GTK+ 2.x and GTK+ 3 may want to use this option to
+ avoid file conflicts between these packages.
+ The default is to build gtk-update-icon-cache.
diff --git a/docs/reference/gtk/compiling.sgml b/docs/reference/gtk/compiling.sgml
index f40267fb1b..7382f5c4cd 100644
--- a/docs/reference/gtk/compiling.sgml
+++ b/docs/reference/gtk/compiling.sgml
@@ -2,7 +2,7 @@
-
+
Compiling GTK+ Applications
3
@@ -32,7 +32,7 @@ your system may be different):
$ pkg-config --cflags gtk+-3.0
-pthread -I/usr/include/gtk-3.0 -I/usr/lib64/gtk-3.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12
$ pkg-config --libs gtk+-3.0
- -pthread -lgtk-x11-3.0 -lgdk-x11-3.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-3.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
+ -pthread -lgtk-3.0 -lgdk-3.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-3.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
@@ -69,24 +69,5 @@ define the preprocessor symbol GDK_MULTIDEVICE_SAFE by using the command
line option -DGTK_MULTIDEVICE_SAFE=1 .
-
-The recommended way of using GTK+ has always been to only include the
-toplevel headers gtk.h , gdk.h ,
-gdk-pixbuf.h .
-If you want to make sure that your program follows this recommended
-practise, you can define the preprocessor symbols GTK_DISABLE_SINGLE_INCLUDES
-and GDK_PIXBUF_DISABLE_SINGLE_INCLUDES to make GTK+ generate an error
-when individual headers are directly included.
-There are some exceptions: gdkkeysyms.h is not included in
-gdk.h because the file is quite large; see
- Key Values documentation.
-gdkx.h must be included independently because It's
-platform-specific; see
- X Window System Interaction
-documentation.
-The same for gtkunixprint.h if you use the non-portable
- GtkPrintUnixDialog API.
-
-
diff --git a/docs/reference/gtk/getting_started.xml b/docs/reference/gtk/getting_started.xml
index ddbff64f8f..d47a09f1fd 100644
--- a/docs/reference/gtk/getting_started.xml
+++ b/docs/reference/gtk/getting_started.xml
@@ -12,97 +12,176 @@
Compiling the GTK+ libraries
section in this reference.
- To begin our introduction to GTK, we'll start with the simplest
- program possible. This program will create an empty 200x200 pixel
- window:
+
+ Basics
-
-
-
+ To begin our introduction to GTK, we'll start with the simplest
+ program possible. This program will create an empty 200x200 pixel
+ window:
-
-
- FIXME: MISSING XINCLUDE CONTENT
-
-
+
+
+
- You can compile the program above with GCC using:
-
-
- gcc `pkg-config --cflags gtk+-3.0` -o window-default window-default.c `pkg-config --libs gtk+-3.0`
-
-
- For more information on how to compile a GTK+ application, please
- refer to the Compiling GTK+ Applications
- section in this reference.
-
- All GTK+ applications will, of course, include
- gtk/gtk.h , which declares functions, types and
- macros required by GTK+ applications.
-
- Even if GTK+ installs multiple header files, only the
- top-level gtk/gtk.h header can be directly included
- by third party code. The compiler will abort with an error if any other
- header will be included.
-
- We then proceed into the main () function of the
- application, and we declare a window variable as a pointer
- of type #GtkWidget.
-
- The following line will call gtk_init(), which
- is the initialization function for GTK+; this function will set up GTK+,
- the type system, the connection to the windowing environment, etc. The
- gtk_init() takes as arguments the pointers to the command line arguments
- counter and string array; this allows GTK+ to parse specific command line
- arguments that control the behavior of GTK+ itself. The parsed arguments
- will be removed from the array, leaving the unrecognized ones for your
- application to parse.
-
- For more information on which command line arguments GTK+
- recognizes, please refer to the Running GTK+
- Applications section in this reference.
-
- The call to gtk_window_new() will create a new #GtkWindow and store
- it inside the window variable. The type of the window
- is %GTK_WINDOW_TOPLEVEL, which means that the #GtkWindow will be managed
- by the windowing system: it will have a frame, a title bar and window
- controls, depending on the platform.
-
- In order to terminate the application when the #GtkWindow is
- destroyed, we connect the #GtkWidget::destroy signal to the gtk_main_quit()
- function. This function will terminate the GTK+ main loop started by calling
- gtk_main() later. The #GtkWidget::destroy signal is emitted when a widget is
- destroyed, either by explicitly calling gtk_widget_destroy() or when the
- widget is unparented. Top-level #GtkWindows are also destroyed when
- the Close window control button is clicked.
-
- #GtkWidgets are hidden by default. By calling gtk_widget_show()
- on a #GtkWidget we are asking GTK+ to set the visibility attribute so that it
- can be displayed. All this work is done after the main loop has been
- started.
-
- The last line of interest is the call to gtk_main(). This function will
- start the GTK+ main loop and will block the control flow of the
- main () until the gtk_main_quit() function is
- called.
-
- The following example is slightly more complex, and tries to
- showcase some of the capabilities of GTK+.
-
- In the long tradition of programming languages and libraries,
- it is called Hello, World .
-
-
-
-
-
-
- Hello World in GTK+
-
-
+
+
FIXME: MISSING XINCLUDE CONTENT
-
-
+
+ You can compile the program above with GCC using:
+
+
+ gcc `pkg-config --cflags gtk+-3.0` -o window-default window-default.c `pkg-config --libs gtk+-3.0`
+
+
+ For more information on how to compile a GTK+ application, please
+ refer to the Compiling GTK+ Applications
+ section in this reference.
+
+ All GTK+ applications will, of course, include
+ gtk/gtk.h , which declares functions, types and
+ macros required by GTK+ applications.
+
+ Even if GTK+ installs multiple header files, only the
+ top-level gtk/gtk.h header can be directly included
+ by third party code. The compiler will abort with an error if any other
+ header is directly included.
+
+ We then proceed into the main () function of the
+ application, and we declare a window variable as a pointer
+ of type #GtkWidget.
+
+ The following line will call gtk_init(), which
+ is the initialization function for GTK+; this function will set up GTK+,
+ the type system, the connection to the windowing environment, etc. The
+ gtk_init() takes as arguments the pointers to the command line arguments
+ counter and string array; this allows GTK+ to parse specific command line
+ arguments that control the behavior of GTK+ itself. The parsed arguments
+ will be removed from the array, leaving the unrecognized ones for your
+ application to parse.
+
+ For more information on which command line arguments GTK+
+ recognizes, please refer to the Running GTK+
+ Applications section in this reference.
+
+ The call to gtk_window_new() will create a new #GtkWindow and store
+ it inside the window variable. The type of the window
+ is %GTK_WINDOW_TOPLEVEL, which means that the #GtkWindow will be managed
+ by the windowing system: it will have a frame, a title bar and window
+ controls, depending on the platform.
+
+ In order to terminate the application when the #GtkWindow is
+ destroyed, we connect the #GtkWidget::destroy signal to the gtk_main_quit()
+ function. This function will terminate the GTK+ main loop started by calling
+ gtk_main() later. The #GtkWidget::destroy signal is emitted when a widget is
+ destroyed, either by explicitly calling gtk_widget_destroy() or when the
+ widget is unparented. Top-level #GtkWindows are also destroyed when
+ the Close window control button is clicked.
+
+ #GtkWidgets are hidden by default. By calling gtk_widget_show()
+ on a #GtkWidget we are asking GTK+ to set the visibility attribute so that it
+ can be displayed. All this work is done after the main loop has been
+ started.
+
+ The last line of interest is the call to gtk_main(). This function will
+ start the GTK+ main loop and will block the control flow of the
+ main() until the gtk_main_quit() function is called.
+
+ While the program is running, GTK+ is receiving
+ events . These are typically input events caused by
+ the user interacting with your program, but also things like messages from
+ the window manager or other applications. GTK+ processes these and as a
+ result, signals may be emitted on your widgets.
+ Connecting handlers for these signals is how you normally make your
+ program do something in response to user input.
+
+ The following example is slightly more complex, and tries to
+ showcase some of the capabilities of GTK+.
+
+ In the long tradition of programming languages and libraries,
+ it is called Hello, World .
+
+
+
+
+
+
+ Hello World in GTK+
+
+
+ FIXME: MISSING XINCLUDE CONTENT
+
+
+
+
+
+
+ Packing
+
+ When creating an application, you'll want to put more than one widget
+ inside a window. Our first helloworld example only used one widget so we
+ could simply use a gtk_container_add() call to "pack" the widget into the
+ window. But when you want to put more than one widget into a window, it
+ it becomes important to control how each widget is positioned and sized.
+ This is where packing comes in.
+
+ GTK+ comes with a large variety of layout containers
+ whose purpose it is to control the layout of the child widgets that are
+ added to them. See for an overview.
+
+ The following example shows how the GtkGrid container lets you
+ arrange several buttons:
+
+
+
+
+
+
+ Packing buttons
+
+
+ FIXME: MISSING XINCLUDE CONTENT
+
+
+
+
+
+
+ Drawing
+
+ Many widgets, like buttons, do all their drawing themselves. You
+ just tell them the label you want to see, and they figure out what font
+ to use, draw the button outline and focus rectangle, etc. Sometimes, it
+ is necessary to do some custom drawing. In that case, a #GtkDrawingArea
+ might be the right widget to use. It offers a canvas on which you can
+ draw by connecting to the #GtkWidget::draw signal.
+
+
+ The contents of a widget often need to be partially or fully redrawn,
+ e.g. when another window is moved and uncovers part of the widget, or
+ when tie window containing it is resized. It is also possible to explicitly
+ cause part or all of the widget to be redrawn, by calling
+ gtk_widget_queue_draw() or its variants. GTK+ takes care of most of the
+ details by providing a ready-to-use cairo context to the ::draw signal
+ handler.
+
+ The following example shows a ::draw signal handler. It is a bit
+ more complicated than the previous examples, since it also demonstrates
+ input event handling by means of ::button-press and ::motion-notify
+ handlers.
+
+
+
+
+
+
+ Drawing in response to input
+
+
+ FIXME: MISSING XINCLUDE CONTENT
+
+
+
+
diff --git a/docs/reference/gtk/gtk-builder-convert-3.0.xml b/docs/reference/gtk/gtk-builder-convert-3.0.xml
deleted file mode 100644
index eccfe336f3..0000000000
--- a/docs/reference/gtk/gtk-builder-convert-3.0.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-gtk-builder-convert-3.0
-1
-
-
-
-gtk-builder-convert-3.0
-Glade file conversion utility
-
-
-
-
-gtk-builder-convert-3.0
---skip-windows
---root name
-input
-output
-
-
-
-Description
-gtk-builder-convert-3.0 converts glade files
-into XML files which can be loaded with GtkBuilder.
-
-
-It expects the name of a glade file as the first argument, and writes
-its output the file specified as the second argument.
-
-
-
-Options
-
-
- --skip-windows
- -w
- Convert everything but GtkWindow subclasses.
-
-
- --root
- -r
- Convert only the widget named name
- and its children.
-
-
-
-
-Bugs
-
-Toolbars are not handled.
-
-
-Support for accessibility is not yet implemented.
-
-
-The script requires a python interpreter to run.
-
-
-
-
diff --git a/docs/reference/gtk/gtk-docs.sgml b/docs/reference/gtk/gtk-docs.sgml
index 3671b672e9..9f57e97057 100644
--- a/docs/reference/gtk/gtk-docs.sgml
+++ b/docs/reference/gtk/gtk-docs.sgml
@@ -61,6 +61,7 @@
+
@@ -151,6 +152,9 @@
+
+
+
@@ -353,8 +357,7 @@
GTK+ Tools
-
-
+
diff --git a/docs/reference/gtk/gtk-query-immodules-3.0.xml b/docs/reference/gtk/gtk-query-immodules-3.0.xml
index 609323c7e2..c9e541b6d2 100644
--- a/docs/reference/gtk/gtk-query-immodules-3.0.xml
+++ b/docs/reference/gtk/gtk-query-immodules-3.0.xml
@@ -2,7 +2,7 @@
-
+
gtk-query-immodules-3.0
diff --git a/docs/reference/gtk/gtk-update-icon-cache-3.0.xml b/docs/reference/gtk/gtk-update-icon-cache.xml
similarity index 91%
rename from docs/reference/gtk/gtk-update-icon-cache-3.0.xml
rename to docs/reference/gtk/gtk-update-icon-cache.xml
index 477f37c381..2a5bc27fbf 100644
--- a/docs/reference/gtk/gtk-update-icon-cache-3.0.xml
+++ b/docs/reference/gtk/gtk-update-icon-cache.xml
@@ -5,18 +5,18 @@
-gtk-update-icon-cache-3.0
+gtk-update-icon-cache
1
-gtk-update-icon-cache-3.0
+gtk-update-icon-cache
Icon theme caching utility
-gtk-update-icon-cache-3.0
+gtk-update-icon-cache
--force
--ignore-theme-index
--index-only
@@ -29,7 +29,7 @@
Description
- gtk-update-icon-cache-3.0 creates mmap()able cache
+ gtk-update-icon-cache creates mmap()able cache
files for icon themes.
@@ -39,7 +39,7 @@
information about the icons in the directory tree below the given directory.
- GTK+ can use the cache files created by gtk-update-icon-cache-3.0
+ GTK+ can use the cache files created by gtk-update-icon-cache
to avoid a lot of system call and disk seek overhead when the application
starts. Since the format of the cache files allows them to be mmap()ed
shared between multiple applications, the overall memory consumption is
@@ -60,7 +60,7 @@
--ignore-theme-index
-t
Don't check for the existence of 'index.theme' in the icon
- theme directory. Without this option, gtk-update-icon-cache-3.0
+ theme directory. Without this option, gtk-update-icon-cache
refuses to create an icon cache in a directory which does not appear to
be the toplevel directory of an icon theme.
@@ -104,5 +104,3 @@ None known yet.
-
-
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 32759d9b21..8134a01b86 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -791,6 +791,8 @@ gtk_combo_box_new
gtk_combo_box_new_with_entry
gtk_combo_box_new_with_model
gtk_combo_box_new_with_model_and_entry
+gtk_combo_box_new_with_area
+gtk_combo_box_new_with_area_and_entry
gtk_combo_box_get_wrap_width
gtk_combo_box_set_wrap_width
gtk_combo_box_get_row_span_column
@@ -994,9 +996,6 @@ gtk_editable_get_editable
GTK_EDITABLE
GTK_IS_EDITABLE
GTK_TYPE_EDITABLE
-GTK_EDITABLE_CLASS
-GTK_IS_EDITABLE_CLASS
-GTK_EDITABLE_GET_CLASS
GTK_EDITABLE_GET_IFACE
gtk_editable_get_type
@@ -1119,6 +1118,7 @@ gtk_entry_buffer_get_type
GtkEntryCompletion
GtkEntryCompletionMatchFunc
gtk_entry_completion_new
+gtk_entry_completion_new_with_area
gtk_entry_completion_get_entry
gtk_entry_completion_set_model
gtk_entry_completion_get_model
@@ -1621,6 +1621,7 @@ gtk_hseparator_get_type
GtkIconView
GtkIconViewForeachFunc
gtk_icon_view_new
+gtk_icon_view_new_with_area
gtk_icon_view_new_with_model
gtk_icon_view_set_model
gtk_icon_view_get_model
@@ -1678,7 +1679,7 @@ gtk_icon_view_unset_model_drag_source
gtk_icon_view_unset_model_drag_dest
gtk_icon_view_set_reorderable
gtk_icon_view_get_reorderable
-gtk_icon_view_set_drag_dest_item
+gtk_icon_view_set_drag_dest_item
gtk_icon_view_get_drag_dest_item
gtk_icon_view_get_dest_item_at_pos
gtk_icon_view_create_drag_icon
@@ -1736,9 +1737,7 @@ GTK_IMAGE_GET_CLASS
GtkImagePrivate
gtk_image_get_type
GtkImageIconSetData
-GtkImageImageData
GtkImagePixbufData
-GtkImagePixmapData
GtkImageStockData
GtkImageAnimationData
GtkImageIconNameData
@@ -2120,6 +2119,8 @@ gtk_menu_shell_activate_item
gtk_menu_shell_cancel
gtk_menu_shell_set_take_focus
gtk_menu_shell_get_take_focus
+gtk_menu_shell_get_selected_item
+gtk_menu_shell_get_parent_shell
GtkMenuDirectionType
GTK_MENU_SHELL
@@ -2269,6 +2270,34 @@ GtkNotebookTab
GtkNotebookPrivate
+
+gtknumerableicon
+GtkNumerableIcon
+GtkNumerableIcon
+gtk_numerable_icon_new
+gtk_numerable_icon_new_with_style_context
+gtk_numerable_icon_get_background_gicon
+gtk_numerable_icon_set_background_gicon
+gtk_numerable_icon_get_background_icon_name
+gtk_numerable_icon_set_background_icon_name
+gtk_numerable_icon_get_count
+gtk_numerable_icon_set_count
+gtk_numerable_icon_get_label
+gtk_numerable_icon_set_label
+gtk_numerable_icon_get_style_context
+gtk_numerable_icon_set_style_context
+
+GTK_NUMERABLE_ICON
+GTK_IS_NUMERABLE_ICON
+GTK_TYPE_NUMERABLE_ICON
+GTK_NUMERABLE_ICON_CLASS
+GTK_IS_NUMERABLE_ICON_CLASS
+GTK_NUMERABLE_ICON_GET_CLASS
+
+
+gtk_numerable_icon_get_type
+
+
gtkoffscreenwindow
GtkOffscreenWindow
@@ -2449,15 +2478,15 @@ gtk_range_set_fill_level
gtk_range_set_restrict_to_fill_level
gtk_range_set_show_fill_level
gtk_range_get_adjustment
-gtk_range_set_update_policy
gtk_range_set_adjustment
gtk_range_get_inverted
gtk_range_set_inverted
-gtk_range_get_update_policy
gtk_range_get_value
+gtk_range_set_value
gtk_range_set_increments
gtk_range_set_range
-gtk_range_set_value
+gtk_range_get_round_digits
+gtk_range_set_round_digits
GtkSensitivityType
gtk_range_set_lower_stepper_sensitivity
gtk_range_get_lower_stepper_sensitivity
@@ -2482,8 +2511,6 @@ GTK_RANGE_GET_CLASS
gtk_range_get_type
GtkRangePrivate
-GtkRangeLayout
-GtkRangeStepTimer
@@ -2772,13 +2799,11 @@ gtk_scrollable_set_vscroll_policy
-GtkScrollableIface
-GTK_IS_SCROLLABLE
-GTK_IS_SCROLLABLE_CLASS
-GTK_SCROLLABLE
-GTK_SCROLLABLE_CLASS
-GTK_SCROLLABLE_GET_IFACE
+GtkScrollableInterface
GTK_TYPE_SCROLLABLE
+GTK_SCROLLABLE
+GTK_IS_SCROLLABLE
+GTK_SCROLLABLE_GET_IFACE
gtk_scrollable_get_type
@@ -3001,7 +3026,7 @@ GTK_SPINNER
GTK_IS_SPINNER
GTK_TYPE_SPINNER
GTK_SPINNER_CLASS
-GTK_IS_SPINER_CLASS
+GTK_IS_SPINNER_CLASS
GTK_SPINNER_GET_CLASS
GTK_IS_SPINNER_CLASS
@@ -3227,7 +3252,6 @@ GTK_TEXT_BUFFER_GET_CLASS
GtkTextBufferPrivate
gtk_text_buffer_get_type
-GtkTextLogAttrCache
@@ -3496,8 +3520,6 @@ GtkTextViewPrivate
gtk_text_view_get_type
gtk_text_child_anchor_get_type
GtkTextBTree
-GtkTextWindow
-GtkTextPendingScroll
@@ -3929,6 +3951,7 @@ gtk_tree_model_get_iter_first
gtk_tree_model_get_path
gtk_tree_model_get_value
gtk_tree_model_iter_next
+gtk_tree_model_iter_previous
gtk_tree_model_iter_children
gtk_tree_model_iter_has_child
gtk_tree_model_iter_n_children
@@ -4145,6 +4168,7 @@ GtkTreeViewColumnSizing
GtkTreeCellDataFunc
GtkTreeViewColumn
gtk_tree_view_column_new
+gtk_tree_view_column_new_with_area
gtk_tree_view_column_new_with_attributes
gtk_tree_view_column_pack_start
gtk_tree_view_column_pack_end
@@ -4333,6 +4357,7 @@ gtk_tree_view_get_type
GtkCellView
GtkCellView
gtk_cell_view_new
+gtk_cell_view_new_with_context
gtk_cell_view_new_with_text
gtk_cell_view_new_with_markup
gtk_cell_view_new_with_pixbuf
@@ -4343,6 +4368,10 @@ gtk_cell_view_get_displayed_row
gtk_cell_view_get_size_of_row
gtk_cell_view_set_background_color
gtk_cell_view_set_background_rgba
+gtk_cell_view_set_draw_sensitive
+gtk_cell_view_get_draw_sensitive
+gtk_cell_view_set_fit_model
+gtk_cell_view_get_fit_model
GtkCellViewClass
GTK_TYPE_CELL_VIEW
@@ -4364,6 +4393,7 @@ GtkCellLayoutIface
GtkCellLayoutDataFunc
gtk_cell_layout_pack_start
gtk_cell_layout_pack_end
+gtk_cell_layout_get_area
gtk_cell_layout_get_cells
gtk_cell_layout_reorder
gtk_cell_layout_clear
@@ -4380,6 +4410,129 @@ GTK_CELL_LAYOUT_GET_IFACE
gtk_cell_layout_get_type
+
+gtkcellarea
+GtkCellArea
+GtkCellArea
+GtkCellAreaClass
+GtkCellCallback
+GtkCellAllocCallback
+GTK_CELL_AREA_WARN_INVALID_CELL_PROPERTY_ID
+gtk_cell_area_add
+gtk_cell_area_remove
+gtk_cell_area_has_renderer
+gtk_cell_area_foreach
+gtk_cell_area_foreach_alloc
+gtk_cell_area_event
+gtk_cell_area_render
+gtk_cell_area_set_style_detail
+gtk_cell_area_get_style_detail
+gtk_cell_area_get_cell_allocation
+gtk_cell_area_get_cell_at_position
+gtk_cell_area_create_context
+gtk_cell_area_copy_context
+gtk_cell_area_get_request_mode
+gtk_cell_area_get_preferred_width
+gtk_cell_area_get_preferred_height_for_width
+gtk_cell_area_get_preferred_height
+gtk_cell_area_get_preferred_width_for_height
+gtk_cell_area_get_current_path_string
+gtk_cell_area_apply_attributes
+gtk_cell_area_attribute_connect
+gtk_cell_area_attribute_disconnect
+gtk_cell_area_class_install_cell_property
+gtk_cell_area_class_find_cell_property
+gtk_cell_area_class_list_cell_properties
+gtk_cell_area_add_with_properties
+gtk_cell_area_cell_set
+gtk_cell_area_cell_get
+gtk_cell_area_cell_set_valist
+gtk_cell_area_cell_get_valist
+gtk_cell_area_cell_set_property
+gtk_cell_area_cell_get_property
+gtk_cell_area_is_activatable
+gtk_cell_area_activate
+gtk_cell_area_focus
+gtk_cell_area_set_focus_cell
+gtk_cell_area_get_focus_cell
+gtk_cell_area_add_focus_sibling
+gtk_cell_area_remove_focus_sibling
+gtk_cell_area_is_focus_sibling
+gtk_cell_area_get_focus_siblings
+gtk_cell_area_get_focus_from_sibling
+gtk_cell_area_get_edited_cell
+gtk_cell_area_get_edit_widget
+gtk_cell_area_activate_cell
+gtk_cell_area_stop_editing
+gtk_cell_area_inner_cell_area
+gtk_cell_area_request_renderer
+
+GTK_CELL_AREA
+GTK_IS_CELL_AREA
+GTK_TYPE_CELL_AREA
+gtk_cell_area_get_type
+GTK_CELL_AREA_CLASS
+GTK_IS_CELL_AREA_CLASS
+GTK_CELL_AREA_GET_CLASS
+GtkCellAreaPrivate
+
+
+
+gtkcellareacontext
+GtkCellAreaContext
+GtkCellAreaContextClass
+GtkCellAreaContext
+gtk_cell_area_context_get_area
+gtk_cell_area_context_allocate
+gtk_cell_area_context_reset
+gtk_cell_area_context_get_preferred_width
+gtk_cell_area_context_get_preferred_height
+gtk_cell_area_context_get_preferred_height_for_width
+gtk_cell_area_context_get_preferred_width_for_height
+gtk_cell_area_context_get_allocation
+gtk_cell_area_context_push_preferred_width
+gtk_cell_area_context_push_preferred_height
+
+
+GTK_CELL_AREA_CONTEXT
+GTK_IS_CELL_AREA_CONTEXT
+GTK_TYPE_CELL_AREA_CONTEXT
+gtk_cell_area_context_get_type
+GTK_CELL_AREA_CONTEXT_CLASS
+GTK_IS_CELL_AREA_CONTEXT_CLASS
+GTK_CELL_AREA_CONTEXT_GET_CLASS
+GtkCellAreaContextPrivate
+
+
+
+gtkcellareabox
+GtkCellAreaBox
+GtkCellAreaBox
+GtkCellAreaBoxClass
+gtk_cell_area_box_new
+gtk_cell_area_box_pack_start
+gtk_cell_area_box_pack_end
+gtk_cell_area_box_get_spacing
+gtk_cell_area_box_set_spacing
+
+
+GTK_CELL_AREA_BOX
+GTK_IS_CELL_AREA_BOX
+GTK_TYPE_CELL_AREA_BOX
+GTK_CELL_AREA_BOX_CLASS
+GTK_IS_CELL_AREA_BOX_CLASS
+GTK_CELL_AREA_BOX_GET_CLASS
+GTK_CELL_AREA_BOX_CONTEXT
+GTK_CELL_AREA_BOX_CONTEXT_CLASS
+GTK_CELL_AREA_BOX_CONTEXT_GET_CLASS
+GTK_IS_CELL_AREA_BOX_CONTEXT
+GTK_IS_CELL_AREA_BOX_CONTEXT_CLASS
+
+
+gtk_cell_area_box_get_type
+GtkCellAreaBoxPrivate
+
+
gtkcellrenderer
GtkCellRenderer
@@ -4387,6 +4540,7 @@ GtkCellRendererState
GtkCellRendererMode
GtkCellRenderer
GtkCellRendererClass
+gtk_cell_renderer_get_aligned_area
gtk_cell_renderer_get_size
gtk_cell_renderer_render
gtk_cell_renderer_activate
@@ -4402,6 +4556,7 @@ gtk_cell_renderer_get_alignment
gtk_cell_renderer_set_alignment
gtk_cell_renderer_get_padding
gtk_cell_renderer_set_padding
+gtk_cell_renderer_is_activatable
gtk_cell_renderer_get_preferred_height
@@ -4410,8 +4565,6 @@ gtk_cell_renderer_get_preferred_size
gtk_cell_renderer_get_preferred_width
gtk_cell_renderer_get_preferred_width_for_height
gtk_cell_renderer_get_request_mode
-gtk_cell_view_get_desired_height_for_width_of_row
-gtk_cell_view_get_desired_width_of_row
GTK_CELL_RENDERER
@@ -4423,6 +4576,8 @@ GTK_CELL_RENDERER_GET_CLASS
GtkCellRendererPrivate
gtk_cell_renderer_get_type
+gtk_cell_renderer_mode_get_type
+gtk_cell_renderer_state_get_type
@@ -4586,6 +4741,7 @@ GTK_IS_CELL_RENDERER_ACCEL_CLASS
GTK_CELL_RENDERER_ACCEL_GET_CLASS
gtk_cell_renderer_accel_get_type
+gtk_cell_renderer_accel_mode_get_type
GtkCellRendererAccelPrivate
@@ -4818,11 +4974,11 @@ gtk_widget_get_parent_window
gtk_widget_set_events
gtk_widget_get_events
gtk_widget_add_events
-gtk_widget_set_extension_events
-gtk_widget_get_extension_events
gtk_widget_set_device_events
gtk_widget_get_device_events
gtk_widget_add_device_events
+gtk_widget_set_device_enabled
+gtk_widget_get_device_enabled
gtk_widget_get_toplevel
gtk_widget_get_ancestor
gtk_widget_get_visual
@@ -4868,7 +5024,6 @@ gtk_widget_pop_composite_child
gtk_widget_push_composite_child
gtk_widget_queue_draw_area
gtk_widget_queue_draw_region
-gtk_widget_reset_shapes
gtk_widget_set_app_paintable
gtk_widget_set_double_buffered
gtk_widget_set_redraw_on_allocate
@@ -5073,8 +5228,6 @@ gtk_window_begin_resize_drag
gtk_window_begin_move_drag
gtk_window_set_decorated
gtk_window_set_deletable
-gtk_window_set_frame_dimensions
-gtk_window_set_has_frame
gtk_window_set_mnemonic_modifier
gtk_window_set_type_hint
gtk_window_set_skip_taskbar_hint
@@ -5090,8 +5243,6 @@ gtk_window_get_default_icon_list
gtk_window_get_default_icon_name
gtk_window_get_default_size
gtk_window_get_destroy_with_parent
-gtk_window_get_frame_dimensions
-gtk_window_get_has_frame
gtk_window_get_icon
gtk_window_get_icon_list
gtk_window_get_icon_name
@@ -5135,6 +5286,7 @@ gtk_window_resize_grip_is_visible
gtk_window_get_resize_grip_area
gtk_window_get_application
gtk_window_set_application
+gtk_window_set_has_user_ref_count
GTK_WINDOW
@@ -5178,7 +5330,6 @@ gtk_window_group_get_type
gtkmain
General
-gtk_set_locale
gtk_disable_setlocale
gtk_get_default_language
gtk_parse_args
@@ -5208,16 +5359,6 @@ gtk_grab_remove
gtk_device_grab_add
gtk_device_grab_remove
-
-GtkFunction
-gtk_quit_add_destroy
-gtk_quit_add
-GtkCallbackMarshal
-GtkArg
-gtk_quit_add_full
-gtk_quit_remove
-gtk_quit_remove_by_data
-
GTK_PRIORITY_RESIZE
@@ -5267,7 +5408,7 @@ GtkWidgetPath
gtk_widget_path_append_type
gtk_widget_path_copy
gtk_widget_path_free
-gtk_widget_path_get_widget_type
+gtk_widget_path_get_object_type
gtk_widget_path_has_parent
gtk_widget_path_is_type
gtk_widget_path_iter_add_class
@@ -5275,7 +5416,7 @@ gtk_widget_path_iter_add_region
gtk_widget_path_iter_clear_classes
gtk_widget_path_iter_clear_regions
gtk_widget_path_iter_get_name
-gtk_widget_path_iter_get_widget_type
+gtk_widget_path_iter_get_object_type
gtk_widget_path_iter_has_class
gtk_widget_path_iter_has_name
gtk_widget_path_iter_has_qclass
@@ -5287,10 +5428,16 @@ gtk_widget_path_iter_list_regions
gtk_widget_path_iter_remove_class
gtk_widget_path_iter_remove_region
gtk_widget_path_iter_set_name
-gtk_widget_path_iter_set_widget_type
+gtk_widget_path_iter_set_object_type
gtk_widget_path_length
gtk_widget_path_new
gtk_widget_path_prepend_type
+
+
+GTK_TYPE_WIDGET_PATH
+
+
+gtk_widget_path_get_type
@@ -5383,6 +5530,22 @@ GTK_STYLE_CLASS_MENUITEM
GTK_STYLE_CLASS_PROGRESSBAR
GTK_STYLE_CLASS_SPINNER
GTK_STYLE_CLASS_TOOLBAR
+GTK_STYLE_CLASS_PANE_SEPARATOR
+GTK_STYLE_CLASS_DND
+GTK_STYLE_CLASS_ERROR
+GTK_STYLE_CLASS_EXPANDER
+GTK_STYLE_CLASS_FRAME
+GTK_STYLE_CLASS_HIGHLIGHT
+GTK_STYLE_CLASS_INFO
+GTK_STYLE_CLASS_MARK
+GTK_STYLE_CLASS_NOTEBOOK
+GTK_STYLE_CLASS_QUESTION
+GTK_STYLE_CLASS_SCALE
+GTK_STYLE_CLASS_SPINBUTTON
+GTK_STYLE_CLASS_VIEW
+GTK_STYLE_CLASS_WARNING
+GTK_STYLE_CLASS_HORIZONTAL
+GTK_STYLE_CLASS_VERTICAL
GTK_STYLE_REGION_COLUMN
GTK_STYLE_REGION_COLUMN_HEADER
GTK_STYLE_REGION_ROW
@@ -5409,6 +5572,7 @@ gtk_style_context_get_border_color
gtk_style_context_get_border
gtk_style_context_get_padding
gtk_style_context_get_margin
+gtk_style_context_get_font
gtk_style_context_invalidate
gtk_style_context_state_is_running
gtk_style_context_lookup_color
@@ -5416,6 +5580,8 @@ gtk_style_context_lookup_icon_set
gtk_style_context_notify_state_change
gtk_style_context_pop_animatable_region
gtk_style_context_push_animatable_region
+gtk_style_context_cancel_animations
+gtk_style_context_scroll_animations
gtk_style_context_remove_provider
gtk_style_context_remove_provider_for_screen
gtk_style_context_reset_widgets
@@ -5519,6 +5685,7 @@ gtk_theming_engine_get_border_color
gtk_theming_engine_get_border
gtk_theming_engine_get_padding
gtk_theming_engine_get_margin
+gtk_theming_engine_get_font
gtk_theming_engine_has_class
gtk_theming_engine_has_region
gtk_theming_engine_lookup_color
@@ -5715,6 +5882,7 @@ gtk_selection_data_targets_include_rich_text
gtk_selection_data_get_selection
gtk_selection_data_get_data
gtk_selection_data_get_length
+gtk_selection_data_get_data_with_length
gtk_selection_data_get_data_type
gtk_selection_data_get_display
gtk_selection_data_get_format
@@ -5877,7 +6045,6 @@ GtkShadowType
GtkStateType
GtkStateFlags
GtkToolbarStyle
-GtkUpdateType
GtkWindowPosition
GtkWindowType
GtkSortType
@@ -6556,6 +6723,26 @@ gtk_print_job_get_surface
gtk_print_job_send
gtk_print_job_set_track_print_status
gtk_print_job_get_track_print_status
+gtk_print_job_get_pages
+gtk_print_job_set_pages
+gtk_print_job_get_page_ranges
+gtk_print_job_set_page_ranges
+gtk_print_job_get_page_set
+gtk_print_job_set_page_set
+gtk_print_job_get_num_copies
+gtk_print_job_set_num_copies
+gtk_print_job_get_scale
+gtk_print_job_set_scale
+gtk_print_job_get_n_up
+gtk_print_job_set_n_up
+gtk_print_job_get_n_up_layout
+gtk_print_job_set_n_up_layout
+gtk_print_job_get_rotate
+gtk_print_job_set_rotate
+gtk_print_job_get_collate
+gtk_print_job_set_collate
+gtk_print_job_get_reverse
+gtk_print_job_set_reverse
GTK_TYPE_PRINT_JOB
@@ -6748,9 +6935,18 @@ gtk_app_chooser_refresh
GTK_TYPE_APP_CHOOSER
GTK_APP_CHOOSER
GTK_IS_APP_CHOOSER
+GTK_APP_CHOOSER_GET_IFACE
gtk_app_chooser_get_type
+GTK_APP_CHOOSER_ONLINE
+GTK_APP_CHOOSER_ONLINE_GET_IFACE
+GTK_APP_CHOOSER_ONLINE_PK
+GTK_APP_CHOOSER_ONLINE_PK_CLASS
+GTK_APP_CHOOSER_ONLINE_PK_GET_CLASS
+GTK_IS_APP_CHOOSER_ONLINE
+GTK_IS_APP_CHOOSER_ONLINE_PK
+GTK_IS_APP_CHOOSER_ONLINE_PK_CLASS
diff --git a/docs/reference/gtk/gtk3.types b/docs/reference/gtk/gtk3.types
index c385a37c48..47295b1679 100644
--- a/docs/reference/gtk/gtk3.types
+++ b/docs/reference/gtk/gtk3.types
@@ -26,6 +26,9 @@ gtk_buildable_get_type
gtk_button_box_get_type
gtk_button_get_type
gtk_calendar_get_type
+gtk_cell_area_get_type
+gtk_cell_area_box_get_type
+gtk_cell_area_context_get_type
gtk_cell_editable_get_type
gtk_cell_layout_get_type
gtk_cell_renderer_accel_get_type
@@ -98,6 +101,7 @@ gtk_message_dialog_get_type
gtk_misc_get_type
gtk_mount_operation_get_type
gtk_notebook_get_type
+gtk_numerable_icon_get_type
gtk_offscreen_window_get_type
gtk_orientable_get_type
gtk_page_setup_get_type
diff --git a/docs/reference/gtk/images/appchooserbutton.png b/docs/reference/gtk/images/appchooserbutton.png
new file mode 100644
index 0000000000..02b48003ac
Binary files /dev/null and b/docs/reference/gtk/images/appchooserbutton.png differ
diff --git a/docs/reference/gtk/images/appchooserdialog.png b/docs/reference/gtk/images/appchooserdialog.png
new file mode 100644
index 0000000000..fd9aa7023a
Binary files /dev/null and b/docs/reference/gtk/images/appchooserdialog.png differ
diff --git a/docs/reference/gtk/images/drawing.png b/docs/reference/gtk/images/drawing.png
new file mode 100644
index 0000000000..a5105002ef
Binary files /dev/null and b/docs/reference/gtk/images/drawing.png differ
diff --git a/docs/reference/gtk/images/grid-packing.png b/docs/reference/gtk/images/grid-packing.png
new file mode 100644
index 0000000000..3dec7d5fcd
Binary files /dev/null and b/docs/reference/gtk/images/grid-packing.png differ
diff --git a/docs/reference/gtk/images/numerableicon.png b/docs/reference/gtk/images/numerableicon.png
new file mode 100644
index 0000000000..fc94b61423
Binary files /dev/null and b/docs/reference/gtk/images/numerableicon.png differ
diff --git a/docs/reference/gtk/images/numerableicon2.png b/docs/reference/gtk/images/numerableicon2.png
new file mode 100644
index 0000000000..70ab765781
Binary files /dev/null and b/docs/reference/gtk/images/numerableicon2.png differ
diff --git a/docs/reference/gtk/migrating-2to3.xml b/docs/reference/gtk/migrating-2to3.xml
index fc39ff1e24..6022ce7a1b 100644
--- a/docs/reference/gtk/migrating-2to3.xml
+++ b/docs/reference/gtk/migrating-2to3.xml
@@ -1,6 +1,7 @@
]>
Migrating from GTK+ 2.x to GTK+ 3
@@ -99,10 +100,11 @@
To ensure that your application does not have problems with this, you
- define the preprocessor symbol GSEAL_ENABLE . This
- will make the compiler catch all uses of direct access to struct fields
- so that you can go through them one by one and replace them with a call
- to an accessor function instead.
+ define the preprocessor symbol GSEAL_ENABLE while
+ building your application against GTK+ 2.x. This will make the compiler
+ catch all uses of direct access to struct fields so that you can go
+ through them one by one and replace them with a call to an accessor
+ function instead.
make CFLAGS+="-DGSEAL_ENABLE"
@@ -122,6 +124,53 @@
+
+ Use GIO for launching applications
+
+ The gdk_spawn family of functions has been
+ deprecated in GDK 2.24 and removed from GDK 3. Various replacements
+ exist; the best replacement depends on the circumstances:
+
+ If you are opening a document or URI by launching a command
+ like firefox http://my-favourite-website.com or
+ gnome-open ghelp:epiphany , it is best to just use
+ gtk_show_uri(); as an added benefit, your application will henceforth
+ respect the users preference for what application to use.
+ If you are launching a regular, installed application that
+ has a desktop file, it is best to use GIOs #GAppInfo with a suitable
+ launch context.
+
+ GAppInfo *info;
+ GAppLaunchContext *context;
+ GError *error = NULL;
+
+ info = g_desktop_app_info_new ("epiphany.desktop");
+ context = gdk_display_get_app_launch_context (display);
+ g_app_info_launch (info, NULL, context, &error);
+
+ if (error)
+ {
+ g_warning ("Failed to launch epiphany: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (info);
+ g_object_unref (context);
+
+
+ If you are launching a custom commandline, you can
+ still use g_app_info_launch() with a GAppInfo that is constructed
+ with g_app_info_create_from_commandline(), or you can use the
+ more lowlevel g_spawn family of functions
+ (e.g. g_spawn_command_line_async()), and pass DISPLAY
+ in the environment. gdk_screen_make_display_name() can be
+ used to find the right value for the DISPLAY
+ environment variable.
+
+
+
+
+
Use cairo for drawing
@@ -655,7 +704,7 @@ g_object_unref (pixbuf);
in 'native' surfaces. Therefore, #GdkColormap and related functions
have been removed in GTK+ 3, and visuals are used instead. The
colormap-handling functions of #GtkWidget (gtk_widget_set_colormap(),
- etc) have been removed and gtk_window_set_visual() has been added.
+ etc) have been removed and gtk_widget_set_visual() has been added.
Setting up a translucent window
You might have a screen-changed handler like the following
@@ -691,12 +740,55 @@ on_alpha_screen_changed (GtkWindow *window,
if (visual == NULL)
visual = gdk_screen_get_system_visual (screen);
- gtk_window_set_visual (window, visual);
+ gtk_widget_set_visual (window, visual);
}
+
+ Backend-specific code
+
+ In GTK+ 2.x, GDK could only be compiled for one backend at a time,
+ and the %GDK_WINDOWING_X11 or %GDK_WINDOWING_WIN32 macros could
+ be used to find out which one you are dealing with:
+
+#ifdef GDK_WINDOWING_X11
+ if (timestamp != GDK_CURRENT_TIME)
+ gdk_x11_window_set_user_time (gdk_window, timestamp);
+#endif
+#ifdef GDK_WINDOWING_WIN32
+ /* ... win32 specific code ... */
+#endif
+
+ In GTK+ 3, GDK can be built with multiple backends, and currently
+ used backend has to be determined at runtime, typically using
+ type-check macros on a #GdkDisplay or #GdkWindow. You still need
+ to use the #GDK_WINDOWING macros to only compile code referring
+ to supported backends:
+
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ if (timestamp != GDK_CURRENT_TIME)
+ gdk_x11_window_set_user_time (gdk_window, timestamp);
+ }
+ else
+#endif
+#ifdef GDK_WINDOWING_WIN32
+ if (GDK_IS_WIN32_DISPLAY (display))
+ {
+ /* ... win32 specific code ... */
+ }
+ else
+#endif
+ {
+ g_warning ("Unsupported GDK backend");
+ }
+
+
+
+
The GtkWidget::draw signal
@@ -954,6 +1046,8 @@ gtk_arrow_draw (GtkWidget *widget,
+
+
diff --git a/docs/reference/gtk/migrating-ClientSideWindows.sgml b/docs/reference/gtk/migrating-ClientSideWindows.sgml
deleted file mode 100644
index 017249c3e9..0000000000
--- a/docs/reference/gtk/migrating-ClientSideWindows.sgml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
- Migrating to client-side windows
-
-
- In version 2.18, GDK has been changed to use client-side windows. This
- means that there is no longer a 1-1 correspondence between #GdkWindows
- and windows in the underlying window system. In particular, it is no
- longer correct to assume that each window has an associated XID.
- Code that makes this assumption can sometimes be fixed by calling
- gdk_window_ensure_native() on the windows in question.
- Calling gdk_x11_window_get_xid() (or GDK_WINDOW_XID()) from the
- X11-specific API on a non-native window will explicitly call
- gdk_window_ensure_native(), so old code using this will continue to
- work. A small gotcha is that the GDK_WINDOW_XID() call is no longer a
- trivial accessor for the XID of the window, and thus must not be called
- from another thread without taking locking precautions.
-
-
-
- GDK looks for the GDK_NATIVE_WINDOWS environment variable
- and makes all windows native if it is set. It also tries to be more
- compatible with the way prior versions worked in some other ways.
-
-
-
- Some applications assume that they can just operate on the X windows
- corresponding to their GDK windows without ever telling GDK. One
- example that we've seen is changing the child window stacking order
- using XRestackWindows(). Fixing this properly requires to fix the code
- to use GDK functions to achieve whatever it is trying to achieve.
- To make this easier in the case of stacking order changes, we've added
- a gdk_window_restack() function.
-
-
-
- One change that can cause problems for some applications is that GDK
- is more aggressive about optimizing away expose events. Code that does
- more than just repainting exposed areas in response to expose events
- may be affected by this.
-
-
-
- Problems can also occur when using cairo for drawing. One thing that can
- go wrong is clip handling. You may not use cairo_reset_clip() on a
- cairo_t on a cairo context created via gdk_cairo_create() or passed to
- the GtkWidget::draw signal.
-
-
-
- Due to a weird API in XClearArea the gdk_window_clear_area() call handled
- a specified width or height of zero to mean "to end of window" for
- non-double-buffered drawing. This has been changed to be consistent with
- the docs and what happens in the double-buffered case. All code in GTK+
- that relied on this has been fixed, but it is possible (although unlikely)
- that third party applications rely on this. If you need to do this, just
- implement it yourself using gdk_drawable_get_size().
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkAboutDialog.sgml b/docs/reference/gtk/migrating-GtkAboutDialog.sgml
deleted file mode 100644
index 07c7ca1453..0000000000
--- a/docs/reference/gtk/migrating-GtkAboutDialog.sgml
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
- Migrating from GnomeAbout to GtkAboutDialog
-
-
- Since version 2.6, GTK+ provides the #GtkAboutDialog widget as a
- replacement for the GnomeAbout dialog in
- the libgnomeui library.
-
-
-
- #GtkAboutDialog supports all features found in GnomeAbout .
- The GtkAboutDialog API is bigger, since it follows
- the GTK+ policy to have getters and setters for all widget properties,
- but it isn't much more complex than GnomeAbout .
-
-
-
- To convert an application that uses GnomeAbout to
- GtkAboutDialog , as a first step, replace calls
- like
-
- const gchar *documentors[] = {
- "Documenter 1",
- "Documenter 2",
- NULL
- };
-
- const gchar *documentors[] = {
- "Author 1",
- "Author 2",
- NULL
- };
-
- GtkWidget *about = gnome_about_new ("GNOME Test Program", VERSION,
- "(C) 1998-2001 The Free Software Foundation",
- "Program to display GNOME functions.",
- authors,
- documenters,
- _("translator-credits"),
- "logo.png");
-
- by something like
-
- GdkPixbuf *logo = gdk_pixbuf_new_from_file ("logo.png", NULL);
- GtkWidget *about = g_object_new (GTK_TYPE_ABOUT_DIALOG,
- "name", "GNOME Test Program",
- "version", VERSION,
- "copyright", "(C) 1998-2001 The Free Software Foundation",
- "comments", "Program to display GNOME functions.",
- "authors", authors,
- "documenters", documenters,
- "translator-credits", _("translator-credits"),
- "logo", logo,
- NULL);
- g_object_unref (pixbuf);
-
- If the g_object_new() construction scares you, you can also use
- gtk_about_dialog_new() to construct the dialog and then use the
- setters for the individual properties.
-
-
-
- Once you are done with the initial conversion, you may want to look into
- using some of the features of GtkAboutDialog
- which are not present in GnomeAbout .
-
-
- You can specify license information with the
- #GtkAboutDialog:license property
-
-
- You can add separate credits for artists with the
- #GtkAboutDialog:artists property
-
-
- You can add a pointer to the website of your application, using the
- #GtkAboutDialog:website and #GtkAboutDialog:website-label properties.
-
-
- If your credits contain email addresses or URLs, you can turn them
- into clickable links using gtk_about_dialog_set_email_hook() and
- gtk_about_dialog_set_url_hook().
-
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkAction.sgml b/docs/reference/gtk/migrating-GtkAction.sgml
deleted file mode 100644
index 46a574805c..0000000000
--- a/docs/reference/gtk/migrating-GtkAction.sgml
+++ /dev/null
@@ -1,445 +0,0 @@
-
-
-
-
-
- Federico
- Mena-Quintero
-
-
- federico@ximian.com
-
-
-
-
-
- Migrating from old menu and toolbar systems to GtkAction
-
-
- Prior to GTK+ 2.4, there were several APIs in use to create menus
- and toolbars. GTK+ itself included #GtkItemFactory, which was
- historically used in the GIMP; libgnomeui provided the gnome-ui
- set of macros; libbonoboui provided a complex mechanism to do menu
- merging across embedded components. GTK+ 2.4 includes a system
- for creating menus and toolbars, with merging of items, based
- around the #GtkAction mechanism.
-
-
-
- Actions and Action Groups
-
-
- A #GtkAction represents an operation that the user can perform from
- the menus and toolbars of an application. It is similar to "verbs"
- in other menu systems. A #GtkAction has a name, which is its identifier,
- and it can have several widgets that represent it in the user interface.
- For example, an action for EditCopy can have a menu item
- as well as a toolbar button associated to it. If there is nothing selected
- in the document, the application can simply de-sensitize the
- EditCopy action; this will cause both the menu
- item and the toolbar button to be de-sensitized automatically.
- Similarly, whenever the user selects the menu item or the
- toolbar button associated to the EditCopy
- action, the corresponding #GtkAction object will emit an
- "activate" signal.
-
-
-
- #GtkActionGroup is simply a group of #GtkAction objects. An
- application may want to have several groups: one for global
- actions such as "new document", "about", and "exit"; then one
- group for each open document with actions specific to the
- document, such as "cut", "copy", "paste", and "print".
-
-
-
- Normal actions are simply commands, such as
- FileSave or EditCopy .
- Toggle actions can be active or inactive, such as
- FormatBold or ViewShowRulers .
- Radio actions define a set of items for which one and only one
- can be active at a time, for example, {
- ViewHighQuality ,
- ViewNormalQuality ,
- ViewLowQuality }.
-
-
-
-
- User Interface Manager Object
-
-
- #GtkUIManager is an object that can construct menu and toolbar widgets
- from an XML description. These widgets are in turn associated to
- corresponding actions and action groups.
-
-
-
- #GtkUIManager supports merging of menus and toolbars for applications
- that have multiple components, each with separate sets of commands.
- For example, a word processor that can embed images may want to have
- toolbar buttons for Bold and Italic when the cursor is on a text
- block, but Crop and Brightness/Contrast buttons when the cursor
- is on an image. These actions, which change depending on the
- state of the application, can be merged and de-merged from a
- #GtkUIManager as appropriate.
-
-
-
-
- Migrating from GnomeUIInfo
-
-
- Prior to GTK+ 2.4, some applications used the GnomeUIInfo
- mechanism from
- <libgnomeui/gnome-app-helper.h> to
- define their menus and toolbars. With it, a program decleres an
- array of GnomeUIInfo structures, which
- contain information for menu or toolbar items such as their
- label, icon, and accelerator key. Then, one calls
- gnome_app_fill_menu() or gnome_app_fill_toolbar(), or one of the
- related functions, to create the appropriate widgets based on
- these structures.
-
-
-
- A downside of this API is that the same structures are used to
- pass back pointers to the widgets that got created. This means
- that the structures cannot simply be kept around if the program
- requires multiple instances of the user interface (e.g. several
- windows); each new invocation of gnome_app_fill_menu() would
- overwrite the widget fields of the structures.
-
-
-
- Another disadvantage is that there is no automatic way to
- synchronize the state of related controls. If there are toolbar
- toogle buttons for "Bold", "Italic", "Underline", and also
- corresponding menu items under "Format/Bold", etc., one has to
- synchronize their toggled states by hand whenever the user
- selects any one of them.
-
-
-
- Finally, there is no way to do menu and toolbar merging for
- applications that require embedded components.
-
-
-
- To convert an application that uses GnomeUIInfo into the new
- GtkAction mechanism, you need to do several things:
-
-
-
-
-
- Separate your existing GnomeUIInfo entries into normal
- actions, toggle actions, and radio actions, and then create
- a separate array of #GtkActionEntry structures
- for each group. This will allow you to create the necessary
- #GtkActionGroup objects. Note that this does not describe
- the actual "shape" that your menus and toolbars will have;
- it simply defines the set of commands that will appear in them.
-
-
-
-
- Create an XML description of your menus and toolbars for use
- with #GtkUIManager. This defines the actual shape of the menus
- and toolbars.
-
-
-
-
- Port the code that uses gnome-app and gnome-app-helper to
- #GtkAction and #GtkUIManager.
-
-
-
-
- If your GnomeUIInfo entries use GNOME_APP_PIXMAP_DATA or
- GNOME_APP_PIXMAP_FILENAME for pixmaps, you have to create a
- #GtkIconFactory, add it to the list of default factories, then
- create a #GtkIconSet for each of your own icons. Add the sets to
- the factory, and use the id in the #GtkActionEntry like a regular
- GTK+ stock id.
-
-
-
-
-
- GnomeUIInfo Example
-
-
- The following code shows a declaration of a simple menu bar to
- be used with gnome_app_fill_menu() or similar. The menu hierarchy i
- looks like this:
-
-
-
-
- File
-
- Open
- —
- Exit
-
-
-
-
- View
-
- Zoom In
- Zoom Out
- —
- [ ] Full Screen
- —
- ( ) High Quality
- ( ) Normal Quality
- ( ) Low Quality
-
-
-
-
-
-static GnomeUIInfo file_menu_items[] = {
- { GNOME_APP_UI_ITEM, "_Open", "Open a file",
- open_callback, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GTK_STOCK_OPEN,
- 'o', GDK_CONTROL_MASK, NULL },
- { GNOME_APP_UI_SEPARATOR },
- { GNOME_APP_UI_ITEM, "E_xit", "Exit the program",
- exit_callback, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GTK_STOCK_QUIT,
- 'q', GDK_CONTROL_MASK, NULL},
- { GNOME_APP_UI_ENDOFINFO }
-};
-
-static GnomeUIInfo view_radio_items[] = {
- { GNOME_APP_UI_ITEM, "_High Quality", "Display images in high quality, slow mode",
- high_quality_callback, NULL, NULL, GNOME_APP_PIXMAP_FILENAME, "high-quality.png",
- 0, 0, NULL },
- { GNOME_APP_UI_ITEM, "_Normal Quality", "Display images in normal quality",
- normal_quality_callback, NULL, NULL, GNOME_APP_PIXMAP_FILENAME, "normal-quality.png",
- 0, 0, NULL },
- { GNOME_APP_UI_ITEM, "_Low Quality", "Display images in low quality, fast mode",
- low_quality_callback, NULL, NULL, GNOME_APP_PIXMAP_FILENAME, "low-quality.png",
- 0, 0, NULL },
- { GNOME_APP_UI_ENDOFINFO }
-};
-
-static GnomeUIInfo view_menu_items[] = {
- { GNOME_APP_UI_ITEM, "Zoom _In", "Zoom into the image",
- zoom_in_callback, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GTK_STOCK_ZOOM_IN,
- GDK_PLUS, 0, NULL },
- { GNOME_APP_UI_ITEM, "Zoom _Out", "Zoom away from the image",
- zoom_out_callback, NULL, NULL, GNOME_APP_PIXMAP_STOCK, GTK_STOCK_ZOOM_OUT,
- GDK_MINUS, 0, NULL },
- { GNOME_APP_UI_SEPARATOR },
- { GNOME_APP_UI_TOGGLEITEM, "_Full Screen", "Switch between full screen and windowed mode",
- full_screen_callback, NULL, NULL, GNOME_APP_PIXMAP_NONE, NULL,
- GDK_F11, 0, NULL },
- { GNOME_APP_UI_SEPARATOR },
- { GNOME_APP_UI_RADIOITEMS, NULL, NULL, view_radio_items },
- { GNOME_APP_UI_ENDOFINFO }
-};
-
-static GnomeUIInfo menubar[] = {
- { GNOME_APP_UI_SUBTREE, "_File", NULL, file_menu_items },
- { GNOME_APP_UI_SUBTREE, "_View", NULL, view_menu_items },
- { GNOME_APP_UI_ENDOFINFO }
-}
-
-
-
-
- GtkActionEntry Structures
-
-
- The following code is the set of actions that are present in
- the previous
- example. Note that the toggle and radio entries are
- separate from normal actions. Also, note that #GtkActionEntry
- structures take key names in the format of gtk_accelerator_parse()
- rather than key values plus modifiers; you will have to convert these
- values by hand. For example, %GDK_F11 with no modifiers is equivalent
- to a key name of "F11" . Likewise, "o"
- with %GDK_CONTROL_MASK is equivalent to "<ontrol>O" .
-
-
-
-/* Normal items */
-static const GtkActionEntry entries[] = {
- { "FileMenu", NULL, "_File" },
- { "ViewMenu", NULL, "_View" },
- { "Open", GTK_STOCK_OPEN, "_Open", "<control>O", "Open a file", open_action_callback },
- { "Exit", GTK_STOCK_QUIT, "E_xit", "<control>Q", "Exit the program", exit_action_callback },
- { "ZoomIn", GTK_STOCK_ZOOM_IN, "Zoom _In", "plus", "Zoom into the image", zoom_in_action_callback },
- { "ZoomOut", GTK_STOCK_ZOOM_OUT, "Zoom _Out", "minus", "Zoom away from the image", zoom_out_action_callback },
-};
-
-/* Toggle items */
-static const GtkToggleActionEntry toggle_entries[] = {
- { "FullScreen", NULL, "_Full Screen", "F11", "Switch between full screen and windowed mode", full_screen_action_callback, FALSE }
-};
-
-/* Radio items */
-static const GtkRadioActionEntry radio_entries[] = {
- { "HighQuality", "my-stock-high-quality", "_High Quality", NULL, "Display images in high quality, slow mode", 0 },
- { "NormalQuality", "my-stock-normal-quality", "_Normal Quality", NULL, "Display images in normal quality", 1 },
- { "LowQuality", "my-stock-low-quality", "_Low Quality", NULL, "Display images in low quality, fast mode", 2 }
-};
-
-
-
-
- XML Description
-
-
- After extracting the actions, you will need to create an XML
- description of the actual layout of your menus and toolbars
- for use with #GtkUIManager. The following code shows a simple
- menu bar that corresponds to the previous
- example. Note that the File and
- View menus have their names specified in
- the action
- entries, not in the XML itself. This is because the
- XML description only contains identifiers
- for the items in the GUI, rather than human-readable names.
-
-
-
-static const char *ui_description =
-"<ui>"
-" <menubar name='MainMenu'>"
-" <menu action='FileMenu'>"
-" <menuitem action='Open'/>"
-" <menuitem action='Exit'/>"
-" </menu>"
-" <menu action='ViewMenu'>"
-" <menuitem action='ZoomIn'/>"
-" <menuitem action='ZoomOut'/>"
-" <separator/>"
-" <menuitem action='FullScreen'/>"
-" <separator/>"
-" <menuitem action='HighQuality'/>"
-" <menuitem action='NormalQuality'/>"
-" <menuitem action='LowQuality'/>"
-" </menu>"
-" </menubar>"
-"</ui>";
-
-
-
-
- Creating the Menu Bar
-
-
- In this last example, we will create a #GtkActionGroup based on the
- action entries
- we created above. We will then create a #GtkUIManager with the XML description of the menu
- layout. We will also extract the accelerator group and the
- widgets from the #GtkUIManager put them into a window.
-
-
-
-GtkWidget *window;
-GtkWidget *vbox;
-GtkWidget *menubar;
-GtkActionGroup *action_group;
-GtkUIManager *ui_manager;
-GtkAccelGroup *accel_group;
-GError *error;
-
-register_my_stock_icons ();
-
-window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
-vbox = gtk_vbox_new (FALSE, 0);
-gtk_container_add (GTK_CONTAINER (window), vbox);
-
-action_group = gtk_action_group_new ("MenuActions");
-gtk_action_group_add_actions (action_group, entries, G_N_ELEMENTS (entries), window);
-gtk_action_group_add_toggle_actions (action_group, toggle_entries, G_N_ELEMENTS (toggle_entries), window);
-gtk_action_group_add_radio_actions (action_group, radio_entries, G_N_ELEMENTS (radio_entries), 0, radio_action_callback, window);
-
-ui_manager = gtk_ui_manager_new ();
-gtk_ui_manager_insert_action_group (ui_manager, action_group, 0);
-
-accel_group = gtk_ui_manager_get_accel_group (ui_manager);
-gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-
-error = NULL;
-if (!gtk_ui_manager_add_ui_from_string (ui_manager, ui_description, -1, &error))
- {
- g_message ("building menus failed: %s", error->message);
- g_error_free (error);
- exit (EXIT_FAILURE);
- }
-
-menubar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");
-gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
-
-gtk_widget_show_all (window);
-
-
-
-
- Registering the icons
-
-
- Here we show how the register_my_stock_icons() function
- used in the previous example could look like.
-
-
-
-static struct {
- gchar *filename;
- gchar *stock_id;
-} stock_icons[] = {
- { "high-quality.png", "my-stock-high-quality" },
- { "normal-quality.png", "my-stock-normal-quality" },
- { "low-quality.png", "my-stock-low-quality" },
-};
-
-static gint n_stock_icons = G_N_ELEMENTS (stock_icons);
-
-static void
-register_my_stock_icons (void)
-{
- GtkIconFactory *icon_factory;
- GtkIconSet *icon_set;
- GtkIconSource *icon_source;
- gint i;
-
- icon_factory = gtk_icon_factory_new ();
-
- for (i = 0; i < n_stock_icons; i++)
- {
- icon_set = gtk_icon_set_new ();
- icon_source = gtk_icon_source_new ();
- gtk_icon_source_set_filename (icon_source, stock_icons[i].filename);
- gtk_icon_set_add_source (icon_set, icon_source);
- gtk_icon_source_free (icon_source);
- gtk_icon_factory_add (icon_factory, stock_icons[i].stock_id, icon_set);
- gtk_icon_set_unref (icon_set);
- }
-
- gtk_icon_factory_add_default (icon_factory);
-
- g_object_unref (icon_factory);
-}
-
-
-
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkAssistant.sgml b/docs/reference/gtk/migrating-GtkAssistant.sgml
deleted file mode 100644
index ef4fbfabcc..0000000000
--- a/docs/reference/gtk/migrating-GtkAssistant.sgml
+++ /dev/null
@@ -1,178 +0,0 @@
-
-
-
-
-
- Carlos
- Garnacho
-
-
- carlosg@gnome.org
-
-
-
-
-
- Migrating from GnomeDruid to GtkAssistant
-
-
- Since version 2.10, GTK+ provides the GtkAssistant widget as a replacement
- for the GnomeDruid widget in the libgnomeui
- library.
-
-
-
- Conceptually, both GtkAssistant and
- GnomeDruid do the same task, but there are
- several areas where the API has been completely redesigned, so this
- chapter covers the main changes between both widgets.
-
-
-
- Inserting pages
-
-
- GnomeDruid was implemented as a container for
- GnomeDruidPage abstract objects, which are
- implemented by the GnomeDruidPageEdge and
- GnomeDruidPageStandard widgets. Instead,
- GtkAssistant allows any widget to be a page,
- and implements per-page settings (such as page type or title) as
- child properties. So instead of:
-
-
-
-/* Page 1 */
-page = gnome_druid_page_edge_new (GNOME_EDGE_START);
-gnome_druid_page_edge_set_test (GNOME_DRUID_PAGE_EDGE (page),
- "Welcome to the assistant, it will make your life easier");
-gtk_widget_show (page);
-gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (page));
-
-/* Page 2 */
-page = gnome_druid_page_standard_new ();
-gtk_container_add (GTK_CONTAINER (GNOME_DRUID_PAGE_STANDARD (page)->vbox,
- create_page1 ());
-gtk_widget_show_all (page);
-gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (page));
-
-/* Page 3 */
-page = gnome_druid_page_edge_new (GNOME_EDGE_FINISH);
-gnome_druid_page_edge_set_test (GNOME_DRUID_PAGE_EDGE (page),
- "Now you are done, your life is easier");
-gtk_widget_show (page);
-gnome_druid_append_page (GNOME_DRUID (druid), GNOME_DRUID_PAGE (page));
-
-
-
- You have to write:
-
-
-
-gtk_assistant_append_page (GTK_ASSISTANT (assistant),
- gtk_label_new ("Welcome to the assistant, it will make your life easier"));
-gtk_assistant_append_page (GTK_ASSISTANT (assistant),
- create_page1 ());
-gtk_assistant_append_page (GTK_ASSISTANT (assistant),
- gtk_label_new ("Now you are done, your life is easier");
-
-
-
-
- Decorating the assistant pages
-
-
- To decorate your assistant pages, GtkAssistant provides similar functions
- to GnomeDruid , so you have to transform code like this:
-
-
-
-gnome_druid_page_edge_set_title (GNOME_DRUID_PAGE_EDGE (page), "Welcome");
-gnome_druid_page_edge_set_logo (GNOME_DRUID_PAGE_EDGE (page), logo_pixbuf);
-gnome_druid_page_edge_set_watermark (GNOME_DRUID_PAGE_EDGE (page), watermark_pixbuf);
-
-
-
- Into this:
-
-
-
-gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), page_widget, "Welcome");
-gtk_assistant_set_page_header_image (GTK_ASSISTANT (assistant), page_widget, logo_pixbuf);
-gtk_assistant_set_page_side_image (GTK_ASSISTANT (assistant), page_widget, watermark_pixbuf);
-
-
-
- Where page_widget is the widget used as a page.
-
-
-
-
- Setting the page flow
-
-
- Here is the area where GtkAssistant and GnomeDruid
- differ the most. While GnomeDruid used the "next" and "back" signals from the
- GnomeDruidPage , GtkAssistant uses the following
- techniques:
-
-
-
-
- gtk_assistant_set_forward_page_func (): Allows to define a GtkAssistantPageFunc to let the
- assistant know which will be the following page given the current page.
-
-
- gtk_assistant_set_page_complete (): Lets the assistant know whether the specified page is complete
- or not, updating buttons state accordingly.
-
-
- gtk_assistant_set_page_type (): Lets the assistant know the page role and update the buttons
- state accordingly. Pages can have the following roles:
-
- Intro
- Content
- Progress
- Confirmation
- Summary
-
-
-
-
-
- A sample GtkAssistantPageFunc could look like this:
-
-
-
-static gint
-forward_page_function (gint current_page,
- gpointer data)
-{
- switch (current_page)
- {
- case 0:
- return 1;
- case 1:
- if (check_page1_data ())
- return 2;
- else
- return 3;
- case 2:
- return 3;
- default:
- return -1;
- }
-}
-
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkBuilder.sgml b/docs/reference/gtk/migrating-GtkBuilder.sgml
deleted file mode 100644
index 1fd843c8a6..0000000000
--- a/docs/reference/gtk/migrating-GtkBuilder.sgml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
- Migrating from libglade to GtkBuilder
-
-
- Since version 2.12, GTK+ provides #GtkBuilder to construct
- user interfaces from XML descriptions, similar to the functionality
- provided by #GladeXML in the libglade library.
-
-
-
- A good way to start a migration from libglade to GtkBuilder is using
- glade3 to convert your .glade file.
- If your code uses the @root parameter of glade_xml_new(),
- you can use gtk_builder_add_objects_from_file() to construct only certain
- objects from a GtkBuilder file.
-
-
-
- Alternatively, GTK+ also offers the
- gtk-builder-convert script you can use
- to do the conversion; in which case you should be careful to inspect the output
- and make sure you didn't lose any data.
-
-
-
- Step-by-step instructions for porting code from libglade to GtkBuilder
-
-
- libglade GtkBuilder
-
-
-
- ]]>
- not needed
-
-
- GladeXML*
- GtkBuilder*
-
-
- glade_xml_new (FILE, "first_widget", NULL)
-
-
-GError* error = NULL;
-GtkBuilder* builder = gtk_builder_new ();
-if (!gtk_builder_add_from_file (builder, FILE, &error))
- {
- g_warning ("Couldn't load builder file: %s", error->message);
- g_error_free (error);
- }
-
-
-
-
- glade_xml_get_widget (gxml, “widget_name”)
- GTK_WIDGET (gtk_builder_get_object (builder, “widget_name”))
-
-
- glade_get_widget_name (widget)
- gtk_widget_get_name (widget)
-
-
- glade_xml_get_widget_prefix (gxml, “prefix”)
- can be emulated by gtk_builder_get_objects (builder) together with manual filtering. It returns a GSList* instead of a GList* though.
-
-
-
-
-
-
- While GtkBuilder strives to be a complete replacement for
- libglade, there are a number of areas where it is currently
- still behind libglade:
-
-
-
- GtkBuilder supports context information in translatable
- properties in a slightly different way than libglade.
- Intltool does not yet support this; see
- bug
- 454894 for the current status of intltool support for
- GtkBuilder files. Thankfully, context in translations is a
- rarely used feature, and if you are not using it, intltools
- glade format support works just fine for GtkBuilder files.
-
-
-
- While libglade can often tolerate multiple widgets having the
- same id in a glade file, GtkBuilder will not accept duplicate
- object ids. Both gtk-builder-convert
- and the GtkBuilder parser emit warnings when they see
- duplicate ids.
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkColorButton.sgml b/docs/reference/gtk/migrating-GtkColorButton.sgml
deleted file mode 100644
index be0e8b1d0c..0000000000
--- a/docs/reference/gtk/migrating-GtkColorButton.sgml
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
- Migrating from GnomeColorPicker to GtkColorButton
-
-
- Since version 2.6, GTK+ provides the #GtkColorButton
- widget as a replacement for the GnomeColorPicker
- widget in the libgnomeui library.
-
-
-
- Porting an application from GnomeColorPicker to
- GtkColorButton is very simple.
- GtkColorButton doesn't support dithering
- (since it is rarely needed on modern hardware), and it doesn't have
- setters and getters to set the color from floating point or integer
- components. So instead of
-
- guint red, green, blue, alpha;
- /* ... */
- gnome_color_picker_set_i8 (color_picker, red, green, blue, alpha);
-
- you have to write
-
- GdkColor color;
-
- color.red = red << 8;
- color.green = green << 8;
- color.blue = blue << 8;
- gtk_color_button_set_color (color_picker, &color);
- gtk_color_button_set_alpha (color_picker, alpha << 8);
-
- and similarly for the setters taking other number formats. For
- gnome_color_picker_set_i16() no conversion is needed,
- for gnome_color_picker_set_d() , you need to convert
- the color components like this:
-
- color.red = (guint16) (red * 65535.0 + 0.5);
- color.green = (guint16) (green * 65535.0 + 0.5);
- color.blue = (guint16) (blue * 65535.0 + 0.5);
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkComboBox.sgml b/docs/reference/gtk/migrating-GtkComboBox.sgml
deleted file mode 100644
index 4114bdc15a..0000000000
--- a/docs/reference/gtk/migrating-GtkComboBox.sgml
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-
-
- Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and
- GtkComboBoxEntry
-
-
- Prior to 2.4, GTK+ offered two widgets for the task of selecting one
- item from a list of options. #GtkOptionMenu presents the list of
- options as a menu while #GtkCombo presents them in a Windows-style list
- popup. The only difference between the two is that a #GtkCombo allows to
- manually edit the selected value, while the #GtkOptionMenu does not.
-
-
- In GTK+ 2.4, a unified API for list selection was introduced, with
- #GtkComboBox for the non-editable case and #GtkComboBoxEntry for the
- editable case.
- The selection of the display style — menu or list —
- is no longer done at the API level, but has been made themeable via
- the style property #GtkComboBox:appears-as-list.
-
-
-
-
-
- Migrating from GtkCombo to GtkComboBoxEntry
-
-
- Here is an example of a simple, but typical use of a #GtkCombo:
-
-GtkWidget *combo;
-GList *items = NULL;
-
-items = g_list_append (items, "First Item");
-items = g_list_append (items, "Second Item");
-items = g_list_append (items, "Third Item");
-
-combo = gtk_combo_new ();
-gtk_combo_set_popdown_strings (GTK_COMBO (combo), items);
-
- In order to react to the user's selection, connect to the #GtkCombo::changed
- signal on the combo and use
- gtk_entry_get_text (GTK_ENTRY (combo->entry))
- to retrieve the selected text.
-
-
- And here is how it would be done using #GtkComboBoxEntry:
-
-combo_box = gtk_combo_box_entry_new_text ();
-
-gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "First Item");
-gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "Second Item");
-gtk_combo_box_append_text (GTK_COMBO_BOX (combo_box), "Third Item");
-
- In order to react to the user's selection, connect to the #GtkComboBox::changed
- signal on the combo and use
- gtk_entry_get_text (GTK_ENTRY (GTK_BIN (combo_box)->child))
- to retrieve the selected text.
-
-
-
-
- New features
-
-
- The new widgets have more to offer than a mere combination of the
- features of #GtkOptionMenu and #GtkCombo. Notable new features
- include:
-
-
- Grid mode
- Sometimes it is preferable to display the available
- options not in a linear list, but in a grid. A typical example
- would be a "color combo" where the individual items are small
- square color swatches. The new widgets support gridded display
- with the functions
- gtk_combo_box_set_wrap_width(),
- gtk_combo_box_set_row_span_column() and
- gtk_combo_box_set_column_span_column().
-
-
-
- Display of icons
- An often-heard complaint about #GtkOptionMenu is that
- the icons which appear in the image menu items in its menu are not
- displayed in the button showing the selected item. This limitation
- has been removed in #GtkComboBox; the selected item appears in the
- same way as the options in the popup.
-
-
-
- Full tree model power
-
- Since the new widgets are built around the same models that are
- used for #GtkTreeView, all of the powerful machinery of tree models
- and cell renderers can be used.
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkEntry-icons.sgml b/docs/reference/gtk/migrating-GtkEntry-icons.sgml
deleted file mode 100644
index 93e21b5356..0000000000
--- a/docs/reference/gtk/migrating-GtkEntry-icons.sgml
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
- Migrating from SexyIconEntry to GtkEntry
-
-
- GTK+ 2.16 supports showing icons inside a #GtkEntry, similar to
- SexyIconEntry. Porting from SexyIconEntry to GtkEntry is relatively
- straightforward. The main difference between the two APIs is that
- SexyIconEntry uses #GtkImage widgets in a somewhat awkward way as
- storage vehicles for icons, while GtkEntry allows to specify icons
- via pixbufs, stock ids, icon names or #GIcons. So, if your code uses
- e.g.:
-
-image = gtk_image_new_from_stock (GTK_STOCK_NEW, GTK_ICON_SIZE_MENU);
-sexy_icon_entry_set_icon (entry, SEXY_ICON_ENTRY_PRIMARY, image);
-
- you can get rid of the @image, and directly write:
-
-gtk_entry_set_icon_from_stock (entry, GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_NEW);
-
-
-
-
- The signals SexyIconEntry::icon-pressed and SexyIconEntry::icon-released
- have been renamed to #GtkEntry::icon-press and #GtkEntry::icon-release
- to avoid problems due to signal name clashes. Also, the signature of the
- signals has changed from
-
-void (*icon_pressed) (SexyIconEntry *entry,
- SexyIconEntryPosition icon_pos,
- int button)
-
-to
-
-void (*icon_press) (GtkEntry *entry,
- GtkEntryIconPosition icon_pos,
- GdkEventButton *event)
-
- The new signature has the advantage that the signal handler can use
- the timestamp of the event, e.g. for passing it to gtk_menu_popup().
- When adapting an existing signal handler to the new signature, you
- should note that the button number is easily available as @event->button,
- as shown in the following example:
-
-static void
-icon_pressed_cb (SexyIconEntry *entry,
- SexyIconEntryPosition position,
- int button,
- gpointer data)
-{
- GtkMenu *menu = data;
-
- if (position == SEXY_ICON_ENTRY_PRIMARY)
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
- button, GDK_CURRENT_TIME);
-}
-
- can be ported as:
-
-static void
-icon_press_cb (GtkEntry *entry,
- GtkEntryIconPosition position,
- GdkEventButton *event,
- gpointer data)
-{
- GtkMenu *menu = data;
-
- if (position == GTK_ENTRY_ICON_PRIMARY)
- gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
- event->button, event->time);
-}
-
-
-
-
- Another difference is that SexyIconEntry offers manual control of
- the icon prelighting, via sexy_icon_entry_set_icon_highlight().
- #GtkEntry prelights automatically when appropriate, depending on
- whether the icon is activatable and sensitive. You should make
- sure that your icons are properly marked as activatable or nonactivatable
- and sensitive or insensitive:
-
-
- Sensitive, but non-activatable icons are
- good for purely informational purposes.
-
-
- Icons should be marked as insensitive if the
- function that they trigger is currently not available.
-
-
-
-
-
- GtkEntry has no direct equivalent of the special-purpose function
- sexy_icon_entry_add_clear_button(). If you need this functionality,
- the following code works:
-
-static void
-icon_pressed_cb (GtkEntry *entry,
- gint position,
- GdkEventButton *event,
- gpointer data)
-{
- if (position == GTK_ENTRY_ICON_SECONDARY)
- gtk_entry_set_text (entry, "");
-}
-
-static void
-text_changed_cb (GtkEntry *entry,
- GParamSpec *pspec,
- GtkWidget *button)
-{
- gboolean has_text;
-
- has_text = gtk_entry_get_text_length (entry) > 0;
- gtk_entry_set_icon_sensitive (entry,
- GTK_ENTRY_ICON_SECONDARY,
- has_text);
-}
-
-
- /* ... */
-
- /* Set up the clear icon */
- gtk_entry_set_icon_from_stock (GTK_ENTRY (entry),
- GTK_ENTRY_ICON_SECONDARY,
- GTK_STOCK_CLEAR);
- g_signal_connect (entry, "icon-press",
- G_CALLBACK (icon_pressed_cb), NULL);
- g_signal_connect (entry, "notify::text",
- G_CALLBACK (text_changed_cb), find_button);
-
- /* ... */
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkFileChooser.sgml b/docs/reference/gtk/migrating-GtkFileChooser.sgml
deleted file mode 100644
index 731086af81..0000000000
--- a/docs/reference/gtk/migrating-GtkFileChooser.sgml
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
-
-
-
- Federico
- Mena-Quintero
-
-
- federico@ximian.com
-
-
-
-
-
- Migrating from GtkFileSelection to GtkFileChooser
-
-
- #GtkFileChooser, starting with GTK+ 2.4, is the new set of APIs for file
- selection widgets and dialogs. Previous versions of GTK+ used #GtkFileSelection,
- which has numerous problems.
-
-
-
- #GtkFileChooser is an abstract interface that can be implemented by widgets
- that perform file selection tasks. Two widgets in GTK+ implement this
- interface: #GtkFileChooserDialog and #GtkFileChooserWidget. Most applications
- simply need to use #GtkFileChooserDialog, which is a dialog box that allows the
- user to select existing files for opening them, or to pick new filenames for
- saving documents. #GtkFileChooserWidget is for special applications that need to
- embed a file selection widget inside a larger window. In the context of GTK+,
- #GtkFileChooserDialog is simply a #GtkDialog box with a #GtkFileChooserWidget.
- inside.
-
-
-
- Creating a GtkFileChooserDialog
-
-
- To create a #GtkFileChooserDialog, you simply call gtk_file_chooser_dialog_new().
- This function is similar to gtk_dialog_new() in that it takes parameters for the
- title of the dialog box and its transient parent, as well as its
- buttons. In addition, it takes in an argument that determines
- whether the file chooser dialog will be used for opening
- existing files or for saving to a possibly new file.
-
-
-
- Please see for
- how to create a simple file chooser dialog and extract the
- selected filename from it.
-
-
-
-
- Selection Modes
-
-
- #GtkFileChooser can be used in two modes, to select a single file at a
- time or to select a set of more than one file. To set this, use
- gtk_file_chooser_set_select_multiple(). In single-selection
- mode, you can use gtk_file_chooser_get_filename() to get a file
- name from the local file system or gtk_file_chooser_get_uri() to
- get a full-formed URI. In multiple-selection mode, you can use
- gtk_file_chooser_get_filenames() to get a #GSList of filename strings, or
- gtk_file_chooser_get_uris() to get a list of URI strings.
-
-
-
- Also, you can configure #GtkFileChooser to select files
- or folders. Consider a backup program that needs to let the
- user select a folder that will be backed up along with its
- subfolders. To configure whether #GtkFileChooser is used to select
- files or folders, use gtk_file_chooser_set_action(). In
- addition, this lets you configure whether the file chooser will
- be used to select existing files or folders (e.g. for
- "File/Open"), or to type in new filenames (for
- "File/Save As...").
-
-
-
-
- Installing a Preview widget
-
-
- Many applications need to have a preview facility within their
- file chooser dialogs. Previous to GTK+ 2.4, one needed to
- access the #GtkFileSelection widget hierarchy directly to hook in
- a preview widget. With #GtkFileChooser, there is a
- dedicated API to do this.
-
-
-
- Please see the section on
- creating preview widgets for more information.
-
-
-
-
-
-
- New features
-
-
- New features in #GtkFileChooser include the following:
-
-
-
-
-
- Ability to select URIs rather than just local files. You
- must use a #GtkFileSystem implementation that supports this,
- for example the gnome-vfs backend.
-
-
-
-
-
- Present a list of application-specific shortcut folders.
- For example, a paint program may want to add a shortcut for
- its /usr/share/paint_program/Clipart
- folder.
-
-
-
-
-
- Define custom filters so that not all the files in a folder
- are listed. For example, you could filter out backup files,
- or show only image files.
-
-
-
-
-
- To see how to use these features, please consult the #GtkFileChooser
- reference documentation.
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkIconView.sgml b/docs/reference/gtk/migrating-GtkIconView.sgml
deleted file mode 100644
index f1fe85264e..0000000000
--- a/docs/reference/gtk/migrating-GtkIconView.sgml
+++ /dev/null
@@ -1,153 +0,0 @@
-
-
-
-
- Migrating from GnomeIconList to GtkIconView
-
-
- Since version 2.6, GTK+ provides the #GtkIconView widget. It is similar in
- functionality to the GnomeIconList widget in the
- libgnomeui library, both widgets provide a way to lay out named icons in
- a grid. The distinctive feature of the GTK+ widget is that it follows the
- model-view pattern, allowing it to share the actual data (i.e. the names
- and images of the icons) with other views.
-
-
-
- #GtkIconView currently doesn't support some features found in
- GnomeIconList . Icons can not be positioned freely,
- the spacing is not customizable, and it is not possible to edit the names of
- icons.
-
-
-
- To convert an application that uses GnomeIconList
- to #GtkIconView, the first step is to organize your data in a #GtkTreeModel.
- GnomeIconList lets you directly insert data with
- gnome_icon_list_insert() and gnome_icon_list_insert_pixbuf() and their
- append variants. So, if you previously had a function to fill your icon
- list similar to this one:
-
- void
- fill_icon_list (GnomeIconList *icon_list)
- {
- gnome_icon_list_append (icon_list, "file1.png", "Icon 1");
- gnome_icon_list_append (icon_list, "file2.png", "Icon 2");
-
- /* more icons ... */
- }
-
- you will have to create a tree model, attach your icon view to it, and
- fill the model:
-
- enum {
- PIXBUF_COLUMN,
- TEXT_COLUMN,
-
- /* you can have more columns here, e.g */
-
- DATA_COLUMN
- };
-
- void
- fill_model (GtkListStore *store)
- {
- GtkTreeIter iter;
- GdkPixbuf *pixbuf;
-
- gtk_list_store_append (store, &iter);
- pixbuf = gdk_pixbuf_new_from_file ("file1.png", NULL);
- gtk_list_store_set (store, &iter, PIXBUF_COLUMN, pixbuf, TEXT_COLUMN, "Icon 1", -1);
- g_object_unref (pixbuf);
-
- gtk_list_store_append (store, &iter);
- pixbuf = gdk_pixbuf_new_from_file ("file2.png", NULL);
- gtk_list_store_set (store, &iter, PIXBUF_COLUMN, pixbuf, TEXT_COLUMN, "Icon 2", -1);
- g_object_unref (pixbuf);
-
- /* more icons ... */
- }
-
- int
- main (int argc, char *argv[])
- {
- GtkWidget *icon_view;
- GtkListStore *store;
-
- gtk_init (&argc, &argv);
-
- /* do other initialization... */
-
- /* construct the GtkIconView */
- icon_view = gtk_icon_view_new ();
- store = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_POINTER);
-
- gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (icon_view), PIXBUF_COLUMN);
- gtk_icon_view_set_text_column (GTK_ICON_VIEW (icon_view), TEXT_COLUMN);
- gtk_icon_view_set_model (GTK_ICON_VIEW (icon_view), GTK_TREE_MODEL (store));
-
- fill_model (store);
-
- /* ... */
- }
-
- This example uses a #GtkListStore as model, but part of the elegance of the
- model-view pattern is that you can easily use another tree model implementation,
- or even write your own custom tree model.
-
-
-
- Your application may make use of extra data attached to the icons in the
- GnomeIconList via gnome_icon_list_set_icon_data() and
- gnome_icon_list_get_icon_data(). With #GtkIconView such data is most
- conveniently stored in an extra column in the tree model, so you would
- call a function like
-
- void
- set_icon_data (GtkIconView *icon_view,
- gint idx,
- gpointer data)
- {
- GtkTreeModel *model;
- GtkTreeIter iter;
-
- model = gtk_icon_view_get_model (icon_view);
-
- if (gtk_tree_model_iter_nth_child (model, &iter, NULL, idx))
- gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- DATA_COLUMN, data, -1);
- }
-
- assuming that your tree model has a DATA_COLUMN of type
- %G_TYPE_POINTER.
-
-
-
- There is a number of minor API differences between
- GnomeIconList and
- GtkIconView :
-
-
- GnomeIconListMode is replaced by the
- orientation
- property of GtkIconView
-
-
- GtkIconView can not be frozen in the same
- way as GnomeIconList can with
- gnome_icon_list_freeze() and gnome_icon_list_thaw(). Instead you can
- replace the whole model of a GtkIconView ,
- instead of doing many small changes to the existing model.
-
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkLabel-links.sgml b/docs/reference/gtk/migrating-GtkLabel-links.sgml
deleted file mode 100644
index 350aa8fb3f..0000000000
--- a/docs/reference/gtk/migrating-GtkLabel-links.sgml
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- Migrating from SexyUrlLabel to GtkLabel
-
-
- GTK+ 2.18 supports showing links inside a #GtkLabel, similar to
- SexyUrlLabel. Porting from SexyUrlLabel to GtkLabel is relatively
- straightforward. GtkLabel accepts links in the markup using the
- same HTML a notation that SexyUrlLabel uses. In addition
- to the href attribute, GtkLabel accepts a title attribute that
- is displayed as a tooltip on the link. Instead of
- sexy_url_label_set_markup(), just call gtk_label_set_markup().
-
-
- One difference between the two APIs is that the ::url-activated signal
- from SexyUrlLabel has been replaced by the #GtkLabel::activate-link
- signal. The need for connecting to this signal is greatly reduced,
- since GtkLabel has a default handler that calls gtk_show_uri().
-
-
diff --git a/docs/reference/gtk/migrating-GtkLinkButton.sgml b/docs/reference/gtk/migrating-GtkLinkButton.sgml
deleted file mode 100644
index a4c003e05a..0000000000
--- a/docs/reference/gtk/migrating-GtkLinkButton.sgml
+++ /dev/null
@@ -1,81 +0,0 @@
-
-
-
-
- Migrating from GnomeHRef to GtkLinkButton
-
-
- Since version 2.10, GTK+ provides the #GtkLinkButton widget as a
- replacement for the GnomeHRef widget
- in the libgnomeui library.
-
-
-
- Porting an application from GnomeHRef to
- #GtkLinkButton is very simple. #GtkLinkButton does not have a
- default action for #GtkButton::clicked signal. So instead of simply
- creating the widget
-
- GtkWidget *button;
-
- button = gnome_href_new (url, "");
-
- you will have to handle the activation of the #GtkLinkButton, using
- the ::clicked signal for instance
-
- static void
- link_button_clicked_cb (GtkWidget *widget,
- gpointer data)
- {
- const gchar *link;
-
- link = gtk_link_button_get_uri (GTK_LINK_BUTTON (widget));
- open_browser_at_url (link);
- }
-
- /* ... */
-
- GtkWidget *button;
-
- button = gtk_link_button_new (url);
- g_signal_connect (button, "clicked",
- G_CALLBACK (link_button_clicked_cb), NULL);
-
- If you have more than one #GtkLinkButton instead of connecting
- a signal to each one, you can use a "hook function" which will be
- called whenever a user activates a link button
-
- static void
- link_button_hook (GtkLinkButton *button,
- const gchar *link,
- gpointer user_data)
-
- {
- open_browser_at_url (link);
- }
-
- /* ... */
-
- GtkWidget *button1 = gtk_link_button_new (uri1);
- GtkWidget *button2 = gtk_link_button_new (uri2);
-
- gtk_link_button_set_uri_hook (link_button_hook, NULL, NULL);
-
-
-
-
-
- Starting with GTK+ 2.16, it is no longer necessary to set up a uri hook
- manually, since GTK+ now defaults to calling gtk_show_uri() if no uri
- hook has been set.
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkRecentChooser.sgml b/docs/reference/gtk/migrating-GtkRecentChooser.sgml
deleted file mode 100644
index 039c461a6c..0000000000
--- a/docs/reference/gtk/migrating-GtkRecentChooser.sgml
+++ /dev/null
@@ -1,323 +0,0 @@
-
-
-
-
-
- Emmanuele
- Bassi
-
-
- ebassi@gmail.com
-
-
-
-
-
- Migrating from EggRecent to GtkRecentChooser
-
-
- Since version 2.10, GTK+ provides a way of handling the recently used
- documents. It is similar to the code that has lived inside the libegg
- library and has been incorporated by many applications. The GTK+ version
- aims to completely replace that code, and offers many distinctive features
- that improve the registration and visualization of the recently used
- documents, such as:
-
-
-
-
-
- Better performances while reading and writing the list of recently used
- files
-
-
- More meta-data available for each recent document, like the
- applications that have registered a document inside the list, the last
- time and the number of times the same application did register a
- document inside the list, an optional user readable name and
- description of the document
-
-
- Improved the ability to sort and filter the documents, also using
- custom sorting and filtering functions
-
-
- New widgets for displaying the list, and better integration with
- current #GtkFileChooser and #GtkUIManager widgets
-
-
-
-
-
- Managing the Recently Used Documents
-
-
- #GtkRecentManager is used to manage the Recently Used Documents. To
- create a new #GtkRecentManager, you simply call gtk_recent_manager_new().
- Like the EggRecentModel inside EggRecent, the
- #GtkRecentManager loads the list of the recent documents and notifies
- you of changes inside the list.
-
-
-
- Usually, instead of creating a new #GtkRecentManager each time you
- need it, you'll want to use the gtk_recent_manager_get_default()
- function.
-
-
-
- To add a document to the list, you can use gtk_recent_manager_add_item(),
- like:
-
- GtkRecentManager *manager;
-
- manager = gtk_recent_manager_new ();
-
- if (!gtk_recent_manager_add_item (manager, document_uri))
- {
- /* warn about the error */
- }
-
- g_object_unref (manager);
-
- The gtk_recent_manager_add_item() function will try and guess some of the
- meta-data associated to a URI. If you know some of meta-data about the
- document yourself, set the desired fields of a #GtkRecentData structure
- and pass it to the gtk_recent_manager_add_full() function instead:
-
- GtkRecentManager *manager;
- GtkRecentData *recent_data;
-
- manager = gtk_recent_manager_new ();
-
- recent_data = g_new0 (GtkRecentData, 1);
- /* the user visible name of the document (maybe its title); should
- * be preferred when displaying the item into the list
- */
- recent_data->display_name = document_name;
-
- /* the MIME type is mandatory */
- recent_data->mime_type = document_mime_type;
-
- /* the name of the application that is registering the document
- * (also mandatory); usually, the same name you used with
- * the g_set_application_name () function.
- */
- recent_data-&app_name = APP_NAME;
-
- /* the command to open a file; the %u string will be automagically
- * expanded to the document's URI when getting the application's
- * command line from the GtkRecentInfo object with
- * gtk_recent_info_get_application_info ()
- */
- recent_data-&app_exec = g_strjoin (" ", g_get_prgname (), "--open-file", "%u", NULL);
-
- if (!gtk_recent_manager_add_full (manager, document_uri, recent_data))
- {
- /* warn about the error */
- }
-
- g_free (recent_data->app_exec);
- g_free (recent_data);
- g_object_unref (manager);
-
-
-
-
- Getting the list of items is also similar to
- EggRecentModel ; the GtkRecentInfo data is
- allocated at look up time in order not to waste memory keeping it
- around, so you must remember to free the data inside the list and then
- the list itself when you are done using it:
-
- GtkRecentManager *manager;
- GList *recent_items, *l;
-
- manager = gtk_recent_manager_get_default();
-
- recent_items = gtk_recent_manager_get_items (manager);
- for (l = recent_items; l != NULL; l = l->next)
- {
- GtkRecentInfo *recent_info = l->data;
-
- do_something_with_the_item (recent_info);
- }
-
- /* free everything and the list */
- g_list_foreach (recent_items, (GFunc) gtk_recent_info_unref, NULL);
- g_list_free (recent_items);
-
- You can also look up a single item:
-
- GtkRecentInfo *recent_info;
- GError *error = NULL;
-
- recent_info = gtk_recent_manager_lookup_item (manager, document_uri, &error);
- if (error)
- {
- display_error (error);
-
- g_error_free (error);
- }
- else
- {
- do_something_with_the_item (recent_info);
-
- gtk_recent_info_unref (recent_info);
- }
-
- The #GtkRecentInfo is a reference counted boxed type, and it holds all
- the meta-data of a recently used document, like its display name, its
- description, the list of each application that has registered the
- document or the list of groups to which the document belong.
-
-
-
-
-
- Displaying the Recently Used Documents
-
-
- Displaying the Recently Used Documents list is handled by any widget
- implementing the #GtkRecentChooser interface. These widgets also handle
- the sorting and filtering of the list; they will create their own
- #GtkRecentManager objects by default:
-
- GtkWidget *chooser;
- gint response;
-
- /* create a new dialog with the recently used documents list shown
- * using a GtkTreeView widget
- */
- chooser = gtk_recent_chooser_dialog_new ("Recent Documents",
- parent_window,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_OK,
- NULL);
- /* set the sorting order to "most recently used first" */
- gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (chooser), GTK_RECENT_SORT_MRU);
- response = gtk_dialog_run (GTK_DIALOG (chooser));
- if (response == GTK_RESPONSE_OK)
- {
- GtkRecentInfo *info;
-
- info = gtk_recent_chooser_get_current_item (GTK_RECENT_CHOOSER (chooser));
- do_something_with_the_item (info);
-
- gtk_recent_info_unref (info);
- }
-
- gtk_widget_destroy (chooser);
-
-
-
-
-
-
- Advanced usage
-
-
- The #GtkRecentChooser widgets might display items sorted and filtered,
- either with already supplied or custom sorting and filtering functions.
- The biggest difference from the EggRecentView
- widgets in EggRecent is that the #GtkRecentChooser widgets will use
- their own copy of the list and will apply the sorting and filtering
- functions only on the copy; this allows the creation of many viewers
- with a single controller, like using many #GtkTreeView with a single
- #GtkTreeModel instance.
-
-
-
- Available sorting methods are:
-
- /* no sorting */
- gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (chooser), GTK_RECENT_SORT_NONE);
-
- /* most recently used first */
- gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (chooser), GTK_RECENT_SORT_MRU);
-
- /* most recently used last */
- gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (chooser), GTK_RECENT_SORT_LRU);
-
- You can create your own sorting function, and the use the
- GTK_RECENT_SORT_CUSTOM method:
-
- /* custom sorting function, based on the registration count
- * (most used first)
- */
- static void
- sort_by_usage_count (GtkRecentInfo *a,
- GtkRecentInfo *b,
- gpointer data)
- {
- gint count_a, count_b;
-
- count_a = count_b = 0;
-
- if (gtk_recent_info_has_application (a, APP_NAME))
- gtk_recent_info_get_application_info (a, APP_NAME, NULL, &count_a, NULL);
-
- if (gtk_recent_info_has_application (b, APP_NAME))
- gtk_recent_info_get_application_info (b, APP_NAME, NULL, &count_b, NULL);
-
- return count_a < count_b;
- }
-
- ...
-
- /* set custom sorting and set the custom sorting function */
- gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (chooser),
- GTK_RECENT_SORT_CUSTOM);
- gtk_recent_chooser_set_sort_func (GTK_RECENT_CHOOSER,
- sort_by_usage_count,
- NULL, /* sort function data */
- NULL /* destroy notify for the data */);
-
-
-
-
- Filtering is done using the #GtkRecentFilter object, similar to the
- #GtkFileFilter object used by the #GtkFileChooser widgets. The
- #GtkRecentFilter object has a set of pre-defined options based on the
- meta-data exposed by the #GtkRecentInfo object. It also allows custom
- filtering function:
-
- GtkRecentFilter *filter;
-
- filter = gtk_recent_filter_new ();
-
- /* set the user visible name of the filter */
- gtk_recent_filter_set_name (filter, "Since Last Month");
-
- /* set the maximum age of a recently used document */
- gtk_recent_filter_set_age (filter, 31);
-
- /* the chooser takes the ownership of the object */
- gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (chooser), filter);
-
- /* set the currently used filter */
- gtk_recent_chooser_set_filter (GTK_RECENT_CHOOSER (chooser), filter);
-
- filter = gtk_recent_filter_new ();
- gtk_recent_filter_set_name (filter, "Every text file");
- gtk_recent_filter_set_mime_type (filter, "text/plain");
-
- gtk_recent_chooser_add_filter (GTK_RECENT_CHOOSER (chooser), filter);
-
- The #GtkRecentChooserWidget and #GtkRecentChooserDialog widgets allow
- multiple filters and the selection of an appropriate one; the
- #GtkRecentChooserMenu widget allows just a single filter object.
-
-
-
-
-
-
-
diff --git a/docs/reference/gtk/migrating-GtkStyleContext.xml b/docs/reference/gtk/migrating-GtkStyleContext.xml
index 775fee0545..42ede40768 100644
--- a/docs/reference/gtk/migrating-GtkStyleContext.xml
+++ b/docs/reference/gtk/migrating-GtkStyleContext.xml
@@ -1,9 +1,9 @@
-
-
- Migrating from GtkStyle to GtkStyleContext
+
+ Theming changes
In GTK+ 3.0, #GtkStyleContext was added to replace #GtkStyle and
@@ -14,7 +14,7 @@
porting applications, libraries and widgets.
-
+
Migrating themes
@@ -27,9 +27,9 @@
with possible variants such as the dark theme being named
gtk-dark.css in the same directory.
-
+
-
+
Migrating theme engines
@@ -141,9 +141,9 @@
attempt to handle.
-
+
-
+
Extending the CSS parser
@@ -175,9 +175,9 @@
style property can be modified in CSS as
-GtkWidget-focus-line-width .
-
+
-
+
Using the CSS file format
@@ -358,6 +358,15 @@
independently.
+
+ In the same vein, the light, dark and mid color variants that
+ were available in GtkStyle should be replaced by a combination of
+ symbolic colors and custom CSS, where necessary. text_aa should
+ really not be used anywhere, anyway, and the white and black colors
+ that were available in GtkStyle can just be replaced by literal
+ GdkRGBA structs.
+
+
Access to colors has also changed a bit. With #GtkStyle, the common
way to access colors is:
@@ -393,9 +402,9 @@
It is worth mentioning that the new file format does not support
custom keybindings nor stock icon mappings as the RC format did.
-
+
-
+
A checklist for widgets
@@ -486,15 +495,34 @@
- Replace all gtk_paint_*() calls with corresponding
- gtk_render_*() calls. The most distinctive changes
- are the use of #GtkStateFlags to represent the widget state and the
- lack of #GtkShadowType. For gtk_render_check() and gtk_render_option(),
- the @shadow_type parameter is replaced by the #GTK_STATE_FLAG_ACTIVE
- and #GTK_STATE_FLAG_INCONSISTENT state flags. For things such as
- pressed/unpressed button states, #GTK_STATE_FLAG_ACTIVE is used, and
- the CSS may style normal/active states differently to render
- outset/inset borders, respectively.
+
+ Replace all gtk_paint_*() calls with corresponding
+ gtk_render_*() calls.
+
+
+ The most distinctive changes are the use of #GtkStateFlags to
+ represent the widget state and the lack of #GtkShadowType. Note
+ that widget state is now passed implicitly via the context, so
+ to render in a certain state, you have to temporarily set the
+ state on the context, as in the following example:
+
+
+ Rendering with a specific state
+
+ gtk_style_context_save (context);
+ gtk_style_context_set_state (context, GTK_STATE_FLAG_ACTIVE);
+ gtk_render_check (context, cr, x, y, width, height);
+ gtk_style_context_restore (context);
+
+
+
+ For gtk_render_check() and gtk_render_option(), the @shadow_type
+ parameter is replaced by the #GTK_STATE_FLAG_ACTIVE and
+ #GTK_STATE_FLAG_INCONSISTENT state flags. For things such as
+ pressed/unpressed button states, #GTK_STATE_FLAG_ACTIVE is used,
+ and the CSS may style normal/active states differently to render
+ outset/inset borders, respectively.
+
@@ -515,9 +543,9 @@
of this is merely a guideline. Widgets may choose to follow it or not.
-
+
-
+
Parsing of custom resources
As a consequence of the RC format going away, calling gtk_rc_parse() or
@@ -528,15 +556,32 @@
Typically, the provider will be a #GtkCssProvider, which parse CSS
information from a file or from a string.
+
+ Using a custom GtkStyleProvider
+
+ GtkStyleContext *context;
+ GtkCssProvider *provider;
+ context = gtk_widget_get_style_context (widget);
+ provider = gtk_css_provider_new ();
+ gtk_css_provider_load_from_data (GTK_CSS_PROVIDER (provider),
+ ".frame1 {\n"
+ " border-image: url('gradient1.png') 10 10 10 10 stretch;\n"
+ "}\n", -1, NULL);
+ gtk_style_context_add_provider (context,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (provider);
+
+
Notice that you can also get style information from custom resources
by implementing the #GtkStyleProvider interface yourself. This is
an advanced feature that should be rarely used.
-
+
-
+
Bonus points
@@ -627,5 +672,5 @@
-
-
+
+
diff --git a/docs/reference/gtk/migrating-GtkTooltip.sgml b/docs/reference/gtk/migrating-GtkTooltip.sgml
deleted file mode 100644
index 56b2a7d18f..0000000000
--- a/docs/reference/gtk/migrating-GtkTooltip.sgml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
- Migrating from GtkTooltips to GtkTooltip
-
-
- GTK+ 2.12 brings a completely new tooltip implementation which
- allows many things that were not possible with the old
- #GtkTooltips interface. The new possibilities are explained
- in more detail in the section about #GtkTooltip.
-
-
-
- A number of complications of the old API have been removed:
-
-
-
- Tooltips can not be grouped anymore. The old tooltips
- API allowed this by using multiple #GtkTooltips objects.
- We believe that the timeout behaviour of the new tooltips
- implementation is better and makes it unnecessary to use
- grouping as a way to overcome shortcomings of the
- fast-tooltips mode.
-
-
-
- Timeouts can not be set individually anymore. Instead
- there are settings #GtkSettings:gtk-tooltip-timeout,
- #GtkSettings:gtk-tooltip-browse-timeout and
- #GtkSettings:gtk-tooltip-browse-mode-timeout to influence
- the behaviour of tooltips globally.
-
-
-
-
-
-
- Here is an example of setting a tooltip on a widget with the old API:
-
-GtkTooltips *tooltips = gtk_tooltips_new ();
-gtk_tooltips_set_tip (tooltips, widget, "Some tips", NULL);
-
-
-
- Using the new tooltips API, it is no longer necessary to create
- an object:
-
-gtk_widget_set_tooltip_text (widget, "Some tips");
-
-
-
- Similarly, setting a tooltip on a #GtkToolItem gets
- simplified from
-
-gtk_tool_item_set_tooltip (toolitem, toolbar->tooltips, "tool tip", NULL);
-
- to
-
-gtk_tool_item_set_tooltip_text (toolitem, text);
-
-
-
-
diff --git a/docs/reference/gtk/other_software.sgml b/docs/reference/gtk/other_software.sgml
index 052f6c6e27..4b413a2b45 100644
--- a/docs/reference/gtk/other_software.sgml
+++ b/docs/reference/gtk/other_software.sgml
@@ -2,7 +2,7 @@
-
+
Mixing GTK+ with other software
3
diff --git a/docs/reference/gtk/question_index.sgml b/docs/reference/gtk/question_index.sgml
index 8b9c3c0f8c..b633a48f4d 100644
--- a/docs/reference/gtk/question_index.sgml
+++ b/docs/reference/gtk/question_index.sgml
@@ -35,8 +35,8 @@ How do I get started with GTK+?
-The GTK+ website offers a
-tutorial and a
+The GTK+ website offers a
+tutorial and a
FAQ . More documentation ranging
from whitepapers to online books can be found at the
GNOME developer's site .
@@ -47,7 +47,7 @@ this reference manual for details.
-Where can I get help with GTK+, submit a bug report, or make a feature
+Where can I get help with GTK+, submit a bug report, or make a feature
request?
@@ -102,11 +102,11 @@ state (explained in its documentation).
-For strings returned from functions, they will be declared "const" (using
-#G_CONST_RETURN) if they should not be freed. Non-const strings should be
-freed with g_free(). Arrays follow the same rule. (If you find an exception
-to the rules, please report a bug to http://bugzilla.gnome.org .)
+For strings returned from functions, they will be declared "const" (using
+#G_CONST_RETURN) if they should not be freed. Non-const strings should be
+freed with g_free(). Arrays follow the same rule. If you find an
+undocumented exception to the rules, please report a bug to http://bugzilla.gnome.org .
@@ -164,8 +164,8 @@ How do I use GTK+ with threads?
-This is covered in the GDK threads
-documentation. See also the GThread
+This is covered in the GDK threads
+documentation. See also the GThread
documentation for portable threading primitives.
@@ -182,33 +182,37 @@ How do I internationalize a GTK+ program?
Most people use GNU
gettext , already required in order to install GLib. On a UNIX
-or Linux system with gettext installed, type info gettext
+or Linux system with gettext installed, type info gettext
to read the documentation.
-The short checklist on how to use gettext is: call bindtextdomain() so gettext
-can find the files containing your translations, call textdomain() to set the
-default translation domain, call bind_textdomain_codeset() to request that
-all translated strings are returned in UTF-8, then call gettext() to look up
-each string to be translated in the default domain.
+The short checklist on how to use gettext is: call bindtextdomain() so
+gettext can find the files containing your translations, call textdomain()
+to set the default translation domain, call bind_textdomain_codeset() to
+request that all translated strings are returned in UTF-8, then call
+gettext() to look up each string to be translated in the default domain.
+
+
+gi18n.h provides the following shorthand macros for
+convenience.
Conventionally, people define macros as follows for convenience:
- #define _(x) gettext (x)
- #define N_(x) x
+ #define _(x) gettext (x)
+ #define N_(x) x
+ #define C_(ctx,x) pgettext (ctx, x)
-You use N_() (N stands for no-op) to mark a string for translation in a
-context where a function call to gettext() is not allowed, such as in an
-array initializer.
-You eventually have to call gettext() on the string to actually fetch the
-translation. _() both marks the string for translation and actually
+You use N_() (N stands for no-op) to mark a string for translation in
+a location where a function call to gettext() is not allowed, such as
+in an array initializer.
+You eventually have to call gettext() on the string to actually fetch
+the translation. _() both marks the string for translation and actually
translates it.
-
-
-Nowadays, GLib provides the common shorthand macros in the header file
-gi18n.h , so you don't have to define them yourself,
-just include that header.
+The C_() macro (C stands for context) adds an additional context to
+the string that is marked for translation, which can help to disambiguate
+short strings that might need different translations in different
+parts of your program.
Code using these macros ends up looking like this:
@@ -231,21 +235,21 @@ Code using these macros ends up looking like this:
-Libraries using gettext should use dgettext() instead of gettext(), which
-allows them to specify the translation domain each time they ask for a
-translation. Libraries should also avoid calling textdomain(), since they
-will be specifying the domain instead of using the default. For dgettext()
-the _() macro can be defined as:
-
-
- #define _(x) dgettext ("MyDomain", x)
-
-
+Libraries using gettext should use dgettext() instead of gettext(), which
+allows them to specify the translation domain each time they ask for a
+translation. Libraries should also avoid calling textdomain(), since
+they will be specifying the domain instead of using the default.
-Again, GLib comes with the gi18n-lib.h , saving you the
-trouble of defining the macros by hand. The macros in that header expect the
-translation domain to be specified by the %GETTEXT_PACKAGE macro.
+With the convention that the macro GETTEXT_PACKAGE is
+defined to hold your libraries translation domain,
+gi18n-lib.h can be included to provide
+the following convenience:
+
+
+ #define _(x) dgettext (GETTEXT_PACKAGE, x)
+
+
@@ -259,9 +263,9 @@ How do I use non-ASCII characters in GTK+ programs ?
-GTK+ uses Unicode (more exactly
-UTF-8) for all text. UTF-8 encodes each Unicode codepoint as a sequence of
-one to six bytes and has a number of nice properties which make it a good
+GTK+ uses Unicode (more exactly
+UTF-8) for all text. UTF-8 encodes each Unicode codepoint as a sequence of
+one to six bytes and has a number of nice properties which make it a good
choice for working with Unicode text in C programs:
@@ -271,30 +275,30 @@ ASCII characters are encoded by their familiar ASCII codepoints.
ASCII characters never appear as part of any other character.
-The zero byte doesn't occur as part of a character, so that UTF-8 strings
-can be manipulated with the usual C library functions for handling
+The zero byte doesn't occur as part of a character, so that UTF-8 strings
+can be manipulated with the usual C library functions for handling
zero-terminated strings.
-More information about Unicode and UTF-8 can be found in the
-UTF-8 and Unicode i
+More information about Unicode and UTF-8 can be found in the
+UTF-8 and Unicode
FAQ for Unix/Linux .
GLib provides functions for converting strings between UTF-8 and other
encodings, see g_locale_to_utf8() and g_convert().
Text coming from external sources (e.g. files or user input), has to be
-converted to UTF-8 before being handed over to GTK+. The following example
-writes the content of a IS0-8859-1 encoded text file to
+converted to UTF-8 before being handed over to GTK+. The following example
+writes the content of a IS0-8859-1 encoded text file to
stdout :
gchar *text, *utf8_text;
gsize length;
GError *error = NULL;
-if (g_file_get_contents (filename, &text, &length, NULL))
+if (g_file_get_contents (filename, &text, &length, NULL))
{
- utf8_text = g_convert (text, length, "UTF-8", "ISO-8859-1",
+ utf8_text = g_convert (text, length, "UTF-8", "ISO-8859-1",
NULL, NULL, &error);
if (error != NULL)
{
@@ -304,7 +308,7 @@ if (g_file_get_contents (filename, &text, &length, NULL))
else
g_print (utf8_text);
}
-else
+else
fprintf (stderr, "Unable to read file %s\n", filename);
@@ -315,36 +319,37 @@ handling non-ASCII content:
direct UTF-8
If your editor and compiler are capable of handling UTF-8 encoded sources,
-it is very convenient to simply use UTF-8 for string literals, since it allows
-you to edit the strings in "wysiwyg". Note that choosing this option may
-reduce the portability of your code.
+it is very convenient to simply use UTF-8 for string literals, since it
+allows you to edit the strings in "wysiwyg". Note that choosing this option
+may reduce the portability of your code.
escaped UTF-8
-Even if your toolchain can't handle UTF-8 directly, you can still encode string
-literals in UTF-8 by using octal or hexadecimal escapes like
-\212 or \xa8 to
-encode each byte. This is portable, but modifying the escaped strings is not
-very convenient. Be careful when mixing hexadecimal escapes with ordinary text;
+Even if your toolchain can't handle UTF-8 directly, you can still encode
+string literals in UTF-8 by using octal or hexadecimal escapes like
+\212 or \xa8 to encode each byte.
+This is portable, but modifying the escaped strings is not very convenient.
+Be careful when mixing hexadecimal escapes with ordinary text;
"\xa8abcd" is a string of length 1 !
runtime conversion
-If the string literals can be represented in an encoding which your toolchain
-can handle (e.g. IS0-8859-1), you can write your source files in that encoding
-and use g_convert() to convert the strings to UTF-8 at runtime. Note that this
-has some runtime overhead, so you may want to move the conversion out of inner
-loops.
+If the string literals can be represented in an encoding which your
+toolchain can handle (e.g. IS0-8859-1), you can write your source files
+in that encoding and use g_convert() to convert the strings to UTF-8 at
+runtime. Note that this has some runtime overhead, so you may want to move
+the conversion out of inner loops.
-Here is an example showing the three approaches using the copyright sign
-© which has Unicode and ISO-8859-1 codepoint 169 and is represented in
-UTF-8 by the two bytes 194, 169:
+Here is an example showing the three approaches using the copyright sign
+© which has Unicode and ISO-8859-1 codepoint 169 and is represented
+in UTF-8 by the two bytes 194, 169, or "\302\251" as
+a string literal:
g_print ("direct UTF-8: ©");
g_print ("escaped UTF-8: \302\251");
@@ -368,9 +373,9 @@ How do I use GTK+ with C++?
-There are two ways to approach this. The GTK+ header files use the subset
-of C that's also valid C++, so you can simply use the normal GTK+ API
-in a C++ program. Alternatively, you can use a "C++ binding"
+There are two ways to approach this. The GTK+ header files use the subset
+of C that's also valid C++, so you can simply use the normal GTK+ API
+in a C++ program. Alternatively, you can use a "C++ binding"
such as gtkmm
which provides a native C++ API.
@@ -380,20 +385,20 @@ connected to signals, not methods. So you will need to use global
functions or "static" class functions for signal connections.
-Another common issue when using GTK+ directly is that
-C++ will not implicitly convert an integer to an enumeration.
+Another common issue when using GTK+ directly is that
+C++ will not implicitly convert an integer to an enumeration.
This comes up when using bitfields; in C you can write the following
code:
- gdk_window_set_events (gdk_window,
+ gdk_window_set_events (gdk_window,
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
while in C++ you must write:
- gdk_window_set_events (gdk_window,
+ gdk_window_set_events (gdk_window,
(GdkEventMask) GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
@@ -427,19 +432,19 @@ How do I load an image or animation from a file?
-To load an image file straight into a display widget, use
-gtk_image_new_from_file() If the file load fails,
-gtk_image_new_from_file() will display no image graphic — to detect
-a failed load yourself, use gdk_pixbuf_new_from_file() directly, then
-gtk_image_new_from_pixbuf(). .
+To load an image file straight into a display widget, use
+gtk_image_new_from_file() If the file load fails,
+gtk_image_new_from_file() will display no image graphic — to detect
+a failed load yourself, use gdk_pixbuf_new_from_file() directly, then
+gtk_image_new_from_pixbuf(). .
To load an image for another purpose, use gdk_pixbuf_new_from_file(). To i
load an animation, use gdk_pixbuf_animation_new_from_file().
-gdk_pixbuf_animation_new_from_file() can also load non-animated images, so
-use it in combination with gdk_pixbuf_animation_is_static_image() to load a
-file of unknown type.
+gdk_pixbuf_animation_new_from_file() can also load non-animated images, so
+use it in combination with gdk_pixbuf_animation_is_static_image() to load a
+file of unknown type.
-To load an image or animation file asynchronously (without blocking), use
+To load an image or animation file asynchronously (without blocking), use
#GdkPixbufLoader.
@@ -453,19 +458,17 @@ How do I draw text ?
-To draw a piece of text, use a Pango layout and gdk_draw_layout(),
-using code like the following:
+To draw a piece of text, use a Pango layout and pango_cairo_show_layout().
layout = gtk_widget_create_pango_layout (widget, text);
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
- pango_layout_set_font_description (layout, fontdesc);
- gdk_draw_layout (..., layout);
+ pango_layout_set_font_description (layout, fontdesc);
+ pango_cairo_show_layout (cr, layout);
pango_font_description_free (fontdesc);
g_object_unref (layout);
-Do not use the deprecated #GdkFont and gdk_draw_text().
@@ -486,19 +489,18 @@ How do I measure the size of a piece of text ?
-To obtain the size of a piece of text, use a Pango layout and
+To obtain the size of a piece of text, use a Pango layout and
pango_layout_get_pixel_size(), using code like the following:
layout = gtk_widget_create_pango_layout (widget, text);
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
- pango_layout_set_font_description (layout, fontdesc);
+ pango_layout_set_font_description (layout, fontdesc);
pango_layout_get_pixel_size (layout, &width, &height);
pango_font_description_free (fontdesc);
g_object_unref (layout);
-Do not use the deprecated function gdk_text_width().
@@ -512,21 +514,21 @@ section of Pango manua
-Why are types not registered if I use their GTK_TYPE_BLAH
+Why are types not registered if I use their GTK_TYPE_BLAH
macro ?
-The GTK_TYPE_BLAH macros are defined as calls to
+The GTK_TYPE_BLAH macros are defined as calls to
gtk_blah_get_type() , and the _get_type() i
functions are declared as %G_GNUC_CONST which allows the compiler to optimize
the call away if it appears that the value is not being used.
-A common workaround for this problem is to store the result in a volatile
+A common workaround for this problem is to store the result in a volatile
variable, which keeps the compiler from optimizing the call away.
volatile GType dummy = GTK_TYPE_BLAH;
@@ -545,28 +547,29 @@ How do I create a transparent toplevel window ?
To make a window transparent, it needs to use a visual which supports that.
-This is done by getting the RGBA colormap of the screen with
-gdk_screen_get_rgba_colormap() and setting it on the window. Note that
-gdk_screen_get_rgba_colormap() will return %NULL if transparent windows
-are not supported on the screen; also note that this may change from
-screen to screen, so it needs to be repeated whenever the window is moved
-to a different screen.
+This is done by getting the RGBA visual of the screen with
+gdk_screen_get_rgba_visual() and setting it on the window. Note that
+gdk_screen_get_rgba_visual() will return %NULL if transparent windows
+are not supported on the screen, you should fall back to
+gdk_screen_get_system_visual() in that case. Additionally, note that this
+will change from screen to screen, so it needs to be repeated whenever the
+window is moved to a different screen.
-GdkColormap *colormap;
+GdkVisual *visual;
-colormap = gdk_screen_get_rgba_colormap (screen);
-if (!colormap)
- colormap = gdk_screen_get_rgb_colormap (screen);
+visual = gdk_screen_get_rgba_visual (screen);
+if (visual == NULL)
+ visual = gdk_screen_get_system_visual (screen);
-gtk_widget_set_colormap (widget, colormap);
+gtk_widget_set_visual (GTK_WIDGET (window), visual);
-One possibility to fill the alpha channel on the window is to use
-gdk_draw_rgb_32_image().
+To fill the alpha channel on the window simply use cairos
+RGBA drawing capabilities.
Note that the presence of an RGBA visual is no guarantee that the
-window will actually appear transparent on screen. On X11, this
-requires a compositing manager to be running. See
+window will actually appear transparent on screen. On X11, this
+requires a compositing manager to be running. See
gtk_widget_is_composited() for a way to find out if the alpha
channel will be respected.
@@ -585,10 +588,8 @@ channel will be respected.
See tree widget overview — you
-should use the #GtkTreeView widget. (A list is just a tree with no branches,
-so the tree widget is used for lists as well.) Do not use the deprecated
-widgets #GtkTree or #GtkCList/#GtkCTree in newly-written code, they are
-less flexible and result in an inferior user interface.
+should use the #GtkTreeView widget. (A list is just a tree with no branches,
+so the tree widget is used for lists as well).
@@ -601,12 +602,11 @@ less flexible and result in an inferior user interface.
See text widget overview — you
-should use the #GtkTextView widget. Do not use the deprecated widget #GtkText
-in newly-written code, it has a number of problems that are best avoided.
+should use the #GtkTextView widget.
-If you only have a small amount of text, #GtkLabel may also be appropriate
-of course. It can be made selectable with gtk_label_set_selectable(). For a
+If you only have a small amount of text, #GtkLabel may also be appropriate
+of course. It can be made selectable with gtk_label_set_selectable(). For a
single-line text entry, see #GtkEntry.
@@ -620,8 +620,8 @@ single-line text entry, see #GtkEntry.
-#GtkImage can display images in just about any format GTK+ understands.
-You can also use #GtkDrawingArea if you need to do something more complex,
+#GtkImage can display images in just about any format GTK+ understands.
+You can also use #GtkDrawingArea if you need to do something more complex,
such as draw text or graphics over the top of the image.
@@ -637,7 +637,8 @@ would use a combo box?
With GTK+, a #GtkComboBox is the recommended widget to use for this use case.
This widget looks like either a combo box or the current option menu, depending
-on the current theme. If you need an editable text entry, use #GtkComboBoxEntry.
+on the current theme. If you need an editable text entry, use the
+#GtkComboBox:has-entry property.
@@ -652,17 +653,14 @@ How do I change the color of a widget?
-See gtk_widget_modify_fg(), gtk_widget_modify_bg(), gtk_widget_modify_base(),
-and gtk_widget_modify_text(). See GTK+
-resource files for more discussion. You can also change widget color
-by installing a resource file and parsing it with gtk_rc_add_default_file().
-The advantage of a resource file is that users can then override the
-color you've chosen.
+See gtk_widget_override_color() and gtk_widget_override_background_color().
+You can also change the appearance of a widget by installing a
+custom style provider, see gtk_style_context_add_provider().
-To change the background color for widgets such as #GtkLabel that have
-no background, place them in a #GtkEventBox and set the background of the
-event box.
+To change the background color for widgets such as #GtkLabel that
+have no background, place them in a #GtkEventBox and set the background
+of the event box.
@@ -672,35 +670,38 @@ How do I change the font of a widget?
-This has several possible answers, depending on what exactly you want to
-achieve. One option is gtk_widget_modify_font(). Note that this function
-can be used to change only the font size, as in the following example:
-
+This has several possible answers, depending on what exactly you want to
+achieve. One option is gtk_widget_override_font().
+
PangoFontDesc *font_desc = pango_font_description_new ();
pango_font_description_set_size (font_desc, 40);
- gtk_widget_modify_font (widget, font);
+ gtk_widget_override_font (widget, font);
pango_font_description_free (font_desc);
-
+
-If you want to make the text of a label larger, you can use
+If you want to make the text of a label larger, you can use
gtk_label_set_markup():
-
+
gtk_label_set_markup (label, "<big>big text</big>");
-
-This is preferred for many apps because it's a relative size to the
-user's chosen font size. See g_markup_escape_text() if you are
+
+This is preferred for many apps because it's a relative size to the
+user's chosen font size. See g_markup_escape_text() if you are
constructing such strings on the fly.
You can also change the font of a widget by putting
- gtk-font-name = "Sans 30"
+ .my-widget-class {
+ font: Sans 30;
+ }
-in a resource file and parsing it with gtk_rc_add_default_file().
-The advantage of a resource file is that users can then override the font you
-have chosen. See GTK+ resource files
-for more discussion.
+in a CSS file, loading it with gtk_css_provider_load_from_file(), and
+adding the provider with gtk_style_context_add_provider_for_screen().
+To associate this style information with your widget, set a style class
+on its #GtkStyleContext using gtk_style_context_add_class().
+The advantage of this approach is that users can then override the font
+you have chosen. See the #GtkStyleContext documentation for more discussion.
@@ -710,8 +711,9 @@ for more discussion.
How do I disable/ghost/desensitize a widget?
- In GTK+ a disabled widget is termed "insensitive." See
-gtk_widget_set_sensitive().
+
+In GTK+ a disabled widget is termed "insensitive."
+See gtk_widget_set_sensitive().
@@ -750,14 +752,14 @@ How do I make a text widget display its complete contents in a specific font?
-If you use gtk_text_buffer_insert_with_tags() with appropriate tags to select
-the font, the inserted text will have the desired appearance, but text typed
-in by the user before or after the tagged block will appear in the default
-style.
+If you use gtk_text_buffer_insert_with_tags() with appropriate tags to
+select the font, the inserted text will have the desired appearance, but
+text typed in by the user before or after the tagged block will appear in
+the default style.
-To ensure that all text has the desired appearance, use gtk_widget_modify_font()
-to change the default font for the widget.
+To ensure that all text has the desired appearance, use
+gtk_widget_override_font() to change the default font for the widget.
@@ -774,17 +776,17 @@ A good way to keep a text buffer scrolled to the end is to place a
mark at the end of the buffer, and
give it right gravity. The gravity has the effect that text inserted
at the mark gets inserted before , keeping the mark
-at the end.
+at the end.
-
+
To ensure that the end of the buffer remains visible, use
gtk_text_view_scroll_to_mark() to scroll to the mark after
inserting new text.
-The gtk-demo application contains an example of this technique.
+The gtk-demo application contains an example of this technique.
@@ -801,25 +803,10 @@ How do I associate some data with a row in the tree?
-Remember that the #GtkTreeModel columns don't necessarily have to be displayed.
-So you can put non-user-visible data in your model just like any other data,
-and retrieve it with gtk_tree_model_get(). See the
- tree widget overview.
-
-
-
-
-
-
-What's the #GtkTreeView equivalent of gtk_clist_find_row_from_data()?
-
-
-
-
-As there is no separate data column in the #GtkTreeModel, there's no
-built in function to find the iter from data. You can write a custom
-searching function to walk the tree and find the data, or use
-gtk_tree_model_foreach().
+Remember that the #GtkTreeModel columns don't necessarily have to be
+displayed. So you can put non-user-visible data in your model just
+like any other data, and retrieve it with gtk_tree_model_get().
+See the tree widget overview.
@@ -831,9 +818,9 @@ How do I put an image and some text in the same column?
-You can pack more than one #GtkCellRenderer into a single #GtkTreeViewColumn
-using gtk_tree_view_column_pack_start() or gtk_tree_view_column_pack_end().
-So pack both a #GtkCellRendererPixbuf and a #GtkCellRendererText into the
+You can pack more than one #GtkCellRenderer into a single #GtkTreeViewColumn
+using gtk_tree_view_column_pack_start() or gtk_tree_view_column_pack_end().
+So pack both a #GtkCellRendererPixbuf and a #GtkCellRendererText into the
column.
@@ -841,15 +828,15 @@ column.
-I can set data easily on my #GtkTreeStore/#GtkListStore models using
+I can set data easily on my #GtkTreeStore/#GtkListStore models using
gtk_list_store_set() and gtk_tree_store_set(), but can't read it back?
Both the #GtkTreeStore and the #GtkListStore implement the #GtkTreeModel
-interface. Consequentially, the can use any function this interface
-implements. The easiest way to read a set of data back is to use
+interface. Consequentially, you can use any function this interface
+implements. The easiest way to read a set of data back is to use
gtk_tree_model_get().
@@ -861,14 +848,14 @@ How do I change the way that numbers are formatted by #GtkTreeView?
Use gtk_tree_view_insert_column_with_data_func()
-or gtk_tree_view_column_set_cell_data_func() and do the conversion from i
-number to string yourself (with, say, g_strdup_printf()).
+or gtk_tree_view_column_set_cell_data_func() and do the conversion
+from number to string yourself (with, say, g_strdup_printf()).
The following example demonstrates this:
-enum
+enum
{
DOUBLE_COLUMN,
N_COLUMNS
@@ -877,11 +864,11 @@ enum
GtkListStore *mycolumns;
GtkTreeView *treeview;
-void
+void
my_cell_double_to_text (GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
+ GtkCellRenderer *cell,
GtkTreeModel *tree_model,
- GtkTreeIter *iter,
+ GtkTreeIter *iter,
gpointer data)
{
GtkCellRendererText *cell_text = (GtkCellRendererText *)cell;
@@ -896,7 +883,7 @@ my_cell_double_to_text (GtkTreeViewColumn *tree_column,
g_free (text);
}
-void
+void
set_up_new_columns (GtkTreeView *myview)
{
GtkCellRendererText *renderer;
@@ -912,7 +899,7 @@ set_up_new_columns (GtkTreeView *myview)
/* Create a new column that has a title ("Example column"),
* uses the above created renderer that will render the double
- * value into text from the associated model's rows.
+ * value into text from the associated model's rows.
*/
column = gtk_tree_view_column_new ();
gtk_tree_view_column_set_title (column, "Example column");
@@ -926,10 +913,10 @@ set_up_new_columns (GtkTreeView *myview)
*/
/* Set up a custom function that will be called when the column content
* is rendered. We use the func_data pointer as an index into our
- * model. This is convenient when using multi column lists.
+ * model. This is convenient when using multi column lists.
*/
gtk_tree_view_column_set_cell_data_func (column, renderer,
- my_cell_double_to_text,
+ my_cell_double_to_text,
(gpointer)DOUBLE_COLUMN, NULL);
}
@@ -957,42 +944,15 @@ How do I use cairo to draw in GTK+ applications ?
-Use gdk_cairo_create() to obtain a cairo context for drawing
-on a GDK window or pixmap. See Cairo
-Interaction for some more useful functions.
-
-
-
-
-
-I have created a cairo context with gdk_cairo_create(), but when I
-later use it, my drawing does not show up. Why is that ?
-
-
-
-
-All drawing in GTK+ is normally done in an expose handler, and GTK+
-creates a temporary pixmap for double-buffering the drawing. If you
-create a cairo context outside the expose handler, it is backed
-by the GDK window itself, not the double-buffering pixmap. Consequently,
-any drawing you do with that cairo context gets overwritten at the
-end of the expose handler, when the double-buffering pixmap is copied
-back.
+The #GtkWidget::draw signal gets a ready-to-use cairo context
+as parameter that you should use.
-Possible solutions to this problem are:
-
-
-Turn off double-buffering, with gtk_widget_set_double_buffered().
-This is not ideal, since it can cause some flickering.
-
-
-Create the cairo context inside the expose handler. If you do this,
-gdk_create_cairo() arranges for it to be backed by the double-buffering
-pixmap. This is the preferred solution, and is used throughout GTK+
-itself.
-
-
+All drawing in GTK+ is normally done in a draw handler, and GTK+
+creates a temporary pixmap for double-buffering the drawing.
+It is possible to turn off double-buffering, with
+gtk_widget_set_double_buffered(), but this is not ideal,
+since it can cause some flickering.
@@ -1000,7 +960,7 @@ itself.
Can I improve the performance of my application by using the
-Glitz backend of cairo ?
+Glitz or GL backend of cairo ?
@@ -1020,7 +980,7 @@ Can I use cairo to draw on a #GdkPixbuf ?
No, at least not yet. The cairo image surface does not support the
-pixel format used by GdkPixbuf.
+pixel format used by GdkPixbuf.
diff --git a/docs/reference/gtk/resources.sgml b/docs/reference/gtk/resources.sgml
index c051f6cce1..4abcac5dcf 100644
--- a/docs/reference/gtk/resources.sgml
+++ b/docs/reference/gtk/resources.sgml
@@ -2,7 +2,7 @@
-
+
Mailing lists and bug reports
3
diff --git a/docs/reference/gtk/running.sgml b/docs/reference/gtk/running.sgml
index 82a3c2070b..9a9376ba64 100644
--- a/docs/reference/gtk/running.sgml
+++ b/docs/reference/gtk/running.sgml
@@ -267,15 +267,6 @@ additional environment variables.
-
- GTK2_RC_FILES
-
-
- Specifies a list of RC files to parse instead of the default ones;
- see Resource Files.
-
-
-
GTK_EXE_PREFIX
@@ -377,6 +368,15 @@ nevertheless.
+
+ GDK_SYNCHRONIZE
+
+
+ If set, GDK makes all X requests synchronously. This is a useful
+ option for debugging, but it will slow down the performance considerably.
+
+
+
XDG_DATA_HOME , XDG_DATA_DIRS
@@ -389,6 +389,19 @@ nevertheless.
+
+ DESKTOP_STARTUP_ID
+
+
+ GTK+ uses this environment variable to provide startup notification
+ according to the Startup Notification Spec .
+ Following the specification, GTK+ unsets this variable after reading
+ it (to keep it from leaking to child processes). So, if you need its
+ value for your own purposes, you have to read it before calling
+ gtk_init().
+
+
+
diff --git a/docs/reference/gtk/text_widget.sgml b/docs/reference/gtk/text_widget.sgml
index f425a8b702..aaf04e36a8 100644
--- a/docs/reference/gtk/text_widget.sgml
+++ b/docs/reference/gtk/text_widget.sgml
@@ -2,7 +2,7 @@
-
+
Text Widget Overview
3
diff --git a/docs/reference/gtk/tmpl/.gitignore b/docs/reference/gtk/tmpl/.gitignore
index 24771fefd3..e7c14a5afa 100644
--- a/docs/reference/gtk/tmpl/.gitignore
+++ b/docs/reference/gtk/tmpl/.gitignore
@@ -8,6 +8,7 @@ gtkbuilder.sgml
gtkbutton.sgml
gtkcalendar.sgml
gtkcelleditable.sgml
+gtkcelllayout.sgml
gtkcellrenderer.sgml
gtkcellrenderertext.sgml
gtkcellview.sgml
@@ -16,9 +17,17 @@ gtkcolorsel.sgml
gtkcombobox.sgml
gtkcomboboxentry.sgml
gtkcontainer.sgml
+gtkdialog.sgml
+gtkdrawingarea.sgml
gtkeditable.sgml
gtkentry.sgml
gtkentrybuffer.sgml
+gtkenum.sgml
+gtkeventbox.sgml
+gtkexpander.sgml
+gtkfeatures.sgml
+gtkfixed.sgml
+gtkfilefilter.sgml
gtkhbox.sgml
gtkiconview.sgml
gtkimcontextsimple.sgml
@@ -26,6 +35,10 @@ gtkimmulticontext.sgml
gtkitemfactory.sgml
gtklayout.sgml
gtklinkbutton.sgml
+gtkmain.sgml
+gtkmenu.sgml
+gtkmenubar.sgml
+gtkmenushell.sgml
gtkmessagedialog.sgml
gtknotebook.sgml
gtkobject.sgml
@@ -35,6 +48,7 @@ gtkpagesetupunixdialog.sgml
gtkpaned.sgml
gtkpapersize.sgml
gtkprinter.sgml
+gtkprintjob.sgml
gtkprogressbar.sgml
gtkradioaction.sgml
gtkradiobutton.sgml
@@ -49,6 +63,7 @@ gtkscale.sgml
gtkscalebutton.sgml
gtkscrollbar.sgml
gtkscrolledwindow.sgml
+gtkselection.sgml
gtkseparator.sgml
gtkseparatormenuitem.sgml
gtkseparatortoolitem.sgml
@@ -57,6 +72,7 @@ gtkstatusbar.sgml
gtkstyle.sgml
gtktesting.sgml
gtktextiter.sgml
+gtktexttag.sgml
gtktexttagtable.sgml
gtktextview.sgml
gtktoggleaction.sgml
@@ -64,6 +80,7 @@ gtktoolbar.sgml
gtktoolitem.sgml
gtktooltip.sgml
gtktreednd.sgml
+gtktreemodel.sgml
gtktreemodelfilter.sgml
gtktreeselection.sgml
gtktreesortable.sgml
diff --git a/docs/reference/gtk/tmpl/gtkcelllayout.sgml b/docs/reference/gtk/tmpl/gtkcelllayout.sgml
deleted file mode 100644
index 166d2cb996..0000000000
--- a/docs/reference/gtk/tmpl/gtkcelllayout.sgml
+++ /dev/null
@@ -1,186 +0,0 @@
-
-GtkCellLayout
-
-
-An interface for packing cells
-
-
-
-#GtkCellLayout is an interface to be implemented by all objects which
-want to provide a #GtkTreeViewColumn-like API for packing cells, setting
-attributes and data funcs.
-
-
-
-One of the notable features provided by implementations of GtkCellLayout
-are attributes . Attributes let you set the properties
-in flexible ways. They can just be set to constant values like regular
-properties. But they can also be mapped to a column of the underlying
-tree model with gtk_cell_layout_set_attributes(), which means that the value
-of the attribute can change from cell to cell as they are rendered by the
-cell renderer. Finally, it is possible to specify a function with
-gtk_cell_layout_set_cell_data_func() that is called to determine the value
-of the attribute for each cell that is rendered.
-
-
-
-GtkCellLayouts as GtkBuildable
-
-Implementations of GtkCellLayout which also implement the GtkBuildable
-interface (#GtkCellView, #GtkIconView, #GtkComboBox, #GtkComboBoxEntry,
-#GtkEntryCompletion, #GtkTreeViewColumn) accept GtkCellRenderer objects
-as <child> elements in UI definitions. They support a custom
-<attributes> element for their children, which can contain
-multiple <attribute> elements. Each <attribute> element has
-a name attribute which specifies a property of the cell renderer; the
-content of the element is the attribute value.
-
-
-A UI definition fragment specifying attributes
-
-
-
-
- 0
-
- "
-
-]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@g_iface:
-@pack_start:
-@pack_end:
-@clear:
-@add_attribute:
-@set_cell_data_func:
-@clear_attributes:
-@reorder:
-@get_cells:
-
-
-
-A function which should set the value of @cell_layout's cell renderer(s)
-as appropriate.
-
-
-@cell_layout: a #GtkCellLayout
-@cell: the cell renderer whose value is to be set
-@tree_model: the model
-@iter: a #GtkTreeIter indicating the row to set the value for
-@data: user data passed to gtk_cell_layout_set_cell_data_func()
-
-
-
-
-
-
-
-@cell_layout:
-@cell:
-@expand:
-
-
-
-
-
-
-
-@cell_layout:
-@cell:
-@expand:
-
-
-
-
-
-
-
-@cell_layout:
-@Returns:
-
-
-
-
-
-
-
-@cell_layout:
-@cell:
-@position:
-
-
-
-
-
-
-
-@cell_layout:
-
-
-
-
-
-
-
-@cell_layout:
-@cell:
-@Varargs:
-
-
-
-
-
-
-
-@cell_layout:
-@cell:
-@attribute:
-@column:
-
-
-
-
-
-
-
-@cell_layout:
-@cell:
-@func:
-@func_data:
-@destroy:
-
-
-
-
-
-
-
-@cell_layout:
-@cell:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkdialog.sgml b/docs/reference/gtk/tmpl/gtkdialog.sgml
deleted file mode 100644
index 13c902f2ca..0000000000
--- a/docs/reference/gtk/tmpl/gtkdialog.sgml
+++ /dev/null
@@ -1,406 +0,0 @@
-
-GtkDialog
-
-
-Create popup windows
-
-
-
-
-Dialog boxes are a convenient way to prompt the user for a small amount of
-input, e.g. to display a message, ask a question, or anything else that does
-not require extensive effort on the user's part.
-
-
-
-GTK+ treats a dialog as a window split vertically. The top section is a
-#GtkVBox known as the content_area , and is
-where widgets such as a #GtkLabel or a #GtkEntry should be packed.
-The bottom area is known as the action_area .
-This is generally used for packing buttons into the dialog which may
-perform functions such as cancel, ok, or apply.
-
-
-
-GtkDialog boxes are created with a call to gtk_dialog_new() or
-gtk_dialog_new_with_buttons(). gtk_dialog_new_with_buttons() is recommended;
-it allows you to set the dialog title, some convenient flags, and add simple
-buttons.
-
-
-
-If 'dialog' is a newly created dialog, the two primary areas of the window
-can be accessed through gtk_dialog_get_content_area() and
-gtk_dialog_get_action_area(), as can be seen from the example, below.
-
-
-
-A 'modal' dialog (that is, one which freezes the rest of the application from
-user input), can be created by calling gtk_window_set_modal() on the dialog. Use
-the GTK_WINDOW() macro to cast the widget returned from gtk_dialog_new() into a
-#GtkWindow. When using gtk_dialog_new_with_buttons() you can also pass the
-#GTK_DIALOG_MODAL flag to make a dialog modal.
-
-
-
-If you add buttons to #GtkDialog using gtk_dialog_new_with_buttons(),
-gtk_dialog_add_button(), gtk_dialog_add_buttons(), or
-gtk_dialog_add_action_widget(), clicking the button will emit a signal called
-"response" with a response ID that you specified. GTK+ will never assign a
-meaning to positive response IDs; these are entirely user-defined. But for
-convenience, you can use the response IDs in the #GtkResponseType enumeration
-(these all have values less than zero). If a dialog receives a delete event,
-the "response" signal will be emitted with a response ID of #GTK_RESPONSE_DELETE_EVENT.
-
-
-
-
-If you want to block waiting for a dialog to return before returning control
-flow to your code, you can call gtk_dialog_run(). This function enters a
-recursive main loop and waits for the user to respond to the dialog, returning the
-response ID corresponding to the button the user clicked.
-
-
-
-For the simple dialog in the following example, in reality you'd probably use
-#GtkMessageDialog to save yourself some effort. But you'd need to create the
-dialog contents manually if you had more than a simple message in the dialog.
-
-Simple GtkDialog usage.
-
-
-/* Function to open a dialog box displaying the message provided. */
-
-void quick_message (gchar *message) {
-
- GtkWidget *dialog, *label, *content_area;
-
- /* Create the widgets */
-
- dialog = gtk_dialog_new_with_buttons ("Message",
- main_application_window,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_OK,
- GTK_RESPONSE_NONE,
- NULL);
- content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
- label = gtk_label_new (message);
-
- /* Ensure that the dialog box is destroyed when the user responds. */
-
- g_signal_connect_swapped (dialog,
- "response",
- G_CALLBACK (gtk_widget_destroy),
- dialog);
-
- /* Add the label, and show everything we've added to the dialog. */
-
- gtk_container_add (GTK_CONTAINER (content_area), label);
- gtk_widget_show_all (dialog);
-}
-
-
-
-
-
-GtkDialog as GtkBuildable
-
-The GtkDialog implementation of the GtkBuildable interface exposes the
-@vbox and @action_area as internal children with the names "vbox" and
-"action_area".
-
-
-GtkDialog supports a custom <action-widgets> element, which
-can contain multiple <action-widget> elements. The "response"
-attribute specifies a numeric response, and the content of the element
-is the id of widget (which should be a child of the dialogs @action_area).
-
-
-A GtkDialog UI definition fragment.
-
- "
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- button_ok
- button_cancel
-
-
-]]>
-
-
-
-
-
-
-
-
-#GtkVBox
-Pack widgets vertically.
-
-
-#GtkWindow
-Alter the properties of your dialog box.
-
-
-#GtkButton
-Add them to the action_area to get a
-response from the user.
-
-
-
-
-
-
-
-
-
-
-
-
-vbox is a #GtkVBox - the main part of the
-dialog box.
-
-
-
-action_area is a #GtkHButtonBox packed below the
-dividing #GtkHSeparator in the dialog. It is treated exactly the same
-as any other #GtkHButtonBox.
-
-
-
-
-
-
-
-
-@dialog: the object which received the signal.
-
-
-
-
-
-
-@dialog:
-@arg1:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Flags used to influence dialog construction.
-
-
-@GTK_DIALOG_MODAL: Make the constructed dialog modal,
- see gtk_window_set_modal().
-@GTK_DIALOG_DESTROY_WITH_PARENT: Destroy the dialog when its
- parent is destroyed, see gtk_window_set_destroy_with_parent().
-
-
-
-Predefined values for use as response ids in gtk_dialog_add_button().
-All predefined values are negative, GTK+ leaves positive values for
-application-defined response ids.
-
-
-@GTK_RESPONSE_NONE: Returned if an action widget has no response id, or if
- the dialog gets programmatically hidden or destroyed.
-@GTK_RESPONSE_REJECT: Generic response id, not used by GTK+ dialogs.
-@GTK_RESPONSE_ACCEPT: Generic response id, not used by GTK+ dialogs.
-@GTK_RESPONSE_DELETE_EVENT: Returned if the dialog is deleted.
-@GTK_RESPONSE_OK: Returned by OK buttons in GTK+ dialogs.
-@GTK_RESPONSE_CANCEL: Returned by Cancel buttons in GTK+ dialogs.
-@GTK_RESPONSE_CLOSE: Returned by Close buttons in GTK+ dialogs.
-@GTK_RESPONSE_YES: Returned by Yes buttons in GTK+ dialogs.
-@GTK_RESPONSE_NO: Returned by No buttons in GTK+ dialogs.
-@GTK_RESPONSE_APPLY: Returned by Apply buttons in GTK+ dialogs.
-@GTK_RESPONSE_HELP: Returned by Help buttons in GTK+ dialogs.
-
-
-
-Creates a new dialog box. Widgets should not be packed into this #GtkWindow
-directly, but into the @vbox and @action_area, as described above.
-
-
-@void:
-@Returns: a new #GtkDialog.
-
-
-
-
-
-
-
-@title:
-@parent:
-@flags:
-@first_button_text:
-@Varargs:
-@Returns:
-
-
-
-
-
-
-
-@dialog:
-@Returns:
-
-
-
-
-
-
-
-@dialog:
-@response_id:
-
-
-
-
-
-
-
-@dialog:
-@button_text:
-@response_id:
-@Returns:
-
-
-
-
-
-
-
-@dialog:
-@first_button_text:
-@Varargs:
-
-
-
-
-
-
-
-@dialog:
-@child:
-@response_id:
-
-
-
-
-
-
-
-@dialog:
-@response_id:
-
-
-
-
-
-
-
-@dialog:
-@response_id:
-@setting:
-
-
-
-
-
-
-
-@dialog:
-@widget:
-@Returns:
-
-
-
-
-
-
-
-@dialog:
-@response_id:
-@Returns:
-
-
-
-
-
-
-
-@dialog:
-@Returns:
-
-
-
-
-
-
-
-@dialog:
-@Returns:
-
-
-
-
-
-
-
-@screen:
-@Returns:
-
-
-
-
-
-
-
-@dialog:
-@first_response_id:
-@Varargs:
-
-
-
-
-
-
-
-@dialog:
-@n_params:
-@new_order:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkdrawingarea.sgml b/docs/reference/gtk/tmpl/gtkdrawingarea.sgml
deleted file mode 100644
index 2ec329cc83..0000000000
--- a/docs/reference/gtk/tmpl/gtkdrawingarea.sgml
+++ /dev/null
@@ -1,131 +0,0 @@
-
-GtkDrawingArea
-
-
-A widget for custom user interface elements
-
-
-
-
-The #GtkDrawingArea widget is used for creating custom user interface
-elements. It's essentially a blank widget; you can draw on
-widget->window . After creating a drawing area,
-the application may want to connect to:
-
-
-
-
- Mouse and button press signals to respond to input from
- the user. (Use gtk_widget_add_events() to enable events
- you wish to receive.)
-
-
-
-
- The "realize" signal to take any necessary actions
- when the widget is instantiated on a particular display.
- (Create GDK resources in response to this signal.)
-
-
-
-
- The "configure_event" signal to take any necessary actions
- when the widget changes size.
-
-
-
-
- The "expose_event" signal to handle redrawing the
- contents of the widget.
-
-
-
-
-
-The following code portion demonstrates using a drawing
-area to display a circle in the normal widget foreground
-color.
-Note that GDK automatically clears the exposed area
-to the background color before sending the expose event, and
-that drawing is implicitly clipped to the exposed area.
-
-
-Simple GtkDrawingArea usage.
-
-gboolean
-expose_event_callback (GtkWidget *widget, GdkEventExpose *event, gpointer data)
-{
- cairo_t *cr;
-
- cr = gdk_cairo_create (event->window);
-
- cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
- cairo_paint (cr);
-
- cairo_destroy (cr);
-
- return TRUE;
-}
-[...]
- GtkWidget *drawing_area = gtk_drawing_area_new ();
- gtk_widget_set_size_request (drawing_area, 100, 100);
- g_signal_connect (G_OBJECT (drawing_area), "expose_event",
- G_CALLBACK (expose_event_callback), NULL);
-
-
-
-
-Expose events are normally delivered when a drawing area first comes
-onscreen, or when it's covered by another window and then uncovered
-(exposed). You can also force an expose event by adding to the "damage
-region" of the drawing area's window; gtk_widget_queue_draw_area() and
-gdk_window_invalidate_rect() are equally good ways to do this. You'll
-then get an expose event for the invalid region.
-
-
-
-The available routines for drawing are documented on the GDK Drawing Primitives page.
-See also gdk_draw_pixbuf() for drawing a #GdkPixbuf.
-
-
-
-To receive mouse events on a drawing area, you will need to enable
-them with gtk_widget_add_events(). To receive keyboard events, you
-will need to set the #GTK_CAN_FOCUS flag on the drawing area, and
-should probably draw some user-visible indication that the drawing
-area is focused. Use the GTK_HAS_FOCUS() macro in your expose event
-handler to decide whether to draw the focus indicator. See
-gtk_paint_focus() for one way to draw focus.
-
-
-
-
-Sometimes #GtkImage is a useful alternative to a drawing area.
-You can put a #GdkPixmap in the #GtkImage and draw to the #GdkPixmap,
-calling gtk_widget_queue_draw() on the #GtkImage when you want to
-refresh to the screen.
-
-
-
-
-
-
-
-
-
-
-The #GtkDrawingArea struct contains private data only, and
-should be accessed using the functions below.
-
-
-
-
-
-Creates a new drawing area.
-
-
-@void:
-@Returns: a new #GtkDrawingArea
-
-
diff --git a/docs/reference/gtk/tmpl/gtkentrycompletion.sgml b/docs/reference/gtk/tmpl/gtkentrycompletion.sgml
deleted file mode 100644
index b0422c1311..0000000000
--- a/docs/reference/gtk/tmpl/gtkentrycompletion.sgml
+++ /dev/null
@@ -1,377 +0,0 @@
-
-GtkEntryCompletion
-
-
-Completion functionality for GtkEntry
-
-
-
-#GtkEntryCompletion is an auxiliary object to be used in conjunction with
-#GtkEntry to provide the completion functionality. It implements the
-#GtkCellLayout interface, to allow the user to add extra cells to the
-#GtkTreeView with completion matches.
-
-
-"Completion functionality" means that when the user modifies the text
-in the entry, #GtkEntryCompletion checks which rows in the model match
-the current content of the entry, and displays a list of matches.
-By default, the matching is done by comparing the entry text
-case-insensitively against the text column of the model (see
-gtk_entry_completion_set_text_column()), but this can be overridden with
-a custom match function (see gtk_entry_completion_set_match_func()).
-
-
-When the user selects a completion, the content of the entry is updated.
-By default, the content of the entry is replaced by the text column of the
-model, but this can be overridden by connecting to the ::match-selected signal
-and updating the entry in the signal handler. Note that you should return
-%TRUE from the signal handler to suppress the default behaviour.
-
-
-To add completion functionality to an entry, use gtk_entry_set_completion().
-
-
-In addition to regular completion matches, which will be inserted into the
-entry when they are selected, #GtkEntryCompletion also allows to display
-"actions" in the popup window. Their appearance is similar to menuitems,
-to differentiate them clearly from completion strings. When an action is
-selected, the ::action-activated signal is emitted.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The GtkEntryCompletion struct contains only private data.
-
-
-
-
-
-
-
-
-@entrycompletion: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@entrycompletion: the object which received the signal.
-@arg1:
-@arg2:
-@Returns:
-
-
-
-
-
-
-@entrycompletion: the object which received the signal.
-@arg1:
-@Returns:
-
-
-
-
-
-
-@entrycompletion: the object which received the signal.
-@arg1:
-@arg2:
-@Returns:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-A function which decides whether the row indicated by @iter matches a given
-@key, and should be displayed as a possible completion for @key. Note that
-@key is normalized and case-folded (see g_utf8_normalize() and
-g_utf8_casefold()). If this is not appropriate, match functions have access
-to the unmodified key via gtk_entry_get_text (GTK_ENTRY (gtk_entry_completion_get_entry ())) .
-
-
-@completion: the #GtkEntryCompletion
-@key: the string to match, normalized and case-folded
-@iter: a #GtkTreeIter indicating the row to match
-@user_data: user data given to gtk_entry_completion_set_match_func()
-@Returns: %TRUE if @iter should be displayed as a possible completion for @key
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@model:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@func:
-@func_data:
-@func_notify:
-
-
-
-
-
-
-
-@completion:
-@length:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-
-
-
-
-
-
-
-@completion:
-@index_:
-@text:
-
-
-
-
-
-
-
-@completion:
-@index_:
-@markup:
-
-
-
-
-
-
-
-@completion:
-@index_:
-
-
-
-
-
-
-
-@completion:
-@column:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@inline_completion:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@inline_selection:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@popup_completion:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@popup_set_width:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
-
-
-
-
-
-@completion:
-@popup_single_match:
-
-
-
-
-
-
-
-@completion:
-@Returns:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkenums.sgml b/docs/reference/gtk/tmpl/gtkenums.sgml
deleted file mode 100644
index 897821f075..0000000000
--- a/docs/reference/gtk/tmpl/gtkenums.sgml
+++ /dev/null
@@ -1,458 +0,0 @@
-
-Standard Enumerations
-
-
-Public enumerated types used throughout GTK+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@GTK_ACCEL_VISIBLE:
-@GTK_ACCEL_LOCKED:
-@GTK_ACCEL_MASK:
-
-
-
-Used to specify the placement of scroll arrows in scrolling menus.
-
-
-@GTK_ARROWS_BOTH: Place one arrow on each end of the menu.
-@GTK_ARROWS_START: Place both arrows at the top of the menu.
-@GTK_ARROWS_END: Place both arrows at the bottom of the menu.
-
-
-
-Used to indicate the direction in which a #GtkArrow should point.
-
-
-@GTK_ARROW_UP: Represents an upward pointing arrow.
-@GTK_ARROW_DOWN: Represents a downward pointing arrow.
-@GTK_ARROW_LEFT: Represents a left pointing arrow.
-@GTK_ARROW_RIGHT: Represents a right pointing arrow.
-@GTK_ARROW_NONE: No arrow. Since 2.10.
-
-
-
-Denotes the expansion properties that a widget will have when it (or its
-parent) is resized.
-
-
-@GTK_EXPAND: the widget should expand to take up any extra space in its
-container that has been allocated.
-@GTK_SHRINK: the widget should shrink as and when possible.
-@GTK_FILL: the widget should fill the space allocated to it.
-
-
-
-Used to dictate the style that a #GtkButtonBox uses to layout the buttons it
-contains. (See also: #GtkVButtonBox and #GtkHButtonBox).
-
-
-@GTK_BUTTONBOX_SPREAD: Buttons are evenly spread across the box.
-@GTK_BUTTONBOX_EDGE: Buttons are placed at the edges of the box.
-@GTK_BUTTONBOX_START: Buttons are grouped towards the start of the box,
- (on the left for a HBox, or the top for a VBox).
-@GTK_BUTTONBOX_END: Buttons are grouped towards the end of the box,
- (on the right for a HBox, or the bottom for a VBox).
-@GTK_BUTTONBOX_CENTER: Buttons are centered in the box. Since 2.12
-
-
-
-Specifies which corner a child widget should be placed in when packed into
-a #GtkScrolledWindow. This is effectively the opposite of where the scroll
-bars are placed.
-
-
-@GTK_CORNER_TOP_LEFT: Place the scrollbars on the right and bottom of the
-widget (default behaviour).
-@GTK_CORNER_BOTTOM_LEFT: Place the scrollbars on the top and right of the
-widget.
-@GTK_CORNER_TOP_RIGHT: Place the scrollbars on the left and bottom of the
-widget.
-@GTK_CORNER_BOTTOM_RIGHT: Place the scrollbars on the top and left of the
-widget.
-
-
-
-
-
-
-@GTK_DELETE_CHARS:
-@GTK_DELETE_WORD_ENDS:
-@GTK_DELETE_WORDS:
-@GTK_DELETE_DISPLAY_LINES:
-@GTK_DELETE_DISPLAY_LINE_ENDS:
-@GTK_DELETE_PARAGRAPH_ENDS:
-@GTK_DELETE_PARAGRAPHS:
-@GTK_DELETE_WHITESPACE:
-
-
-
-
-
-
-@GTK_DIR_TAB_FORWARD:
-@GTK_DIR_TAB_BACKWARD:
-@GTK_DIR_UP:
-@GTK_DIR_DOWN:
-@GTK_DIR_LEFT:
-@GTK_DIR_RIGHT:
-
-
-
-Used to specify the style of the expanders drawn by a #GtkTreeView.
-
-
-@GTK_EXPANDER_COLLAPSED: The style used for a collapsed subtree.
-@GTK_EXPANDER_SEMI_COLLAPSED: Intermediate style used during animation.
-@GTK_EXPANDER_SEMI_EXPANDED: Intermediate style used during animation.
-@GTK_EXPANDER_EXPANDED: The style used for an expanded subtree.
-
-
-
-
-
-
-@GTK_IM_PREEDIT_NOTHING:
-@GTK_IM_PREEDIT_CALLBACK:
-@GTK_IM_PREEDIT_NONE:
-
-
-
-
-
-
-@GTK_IM_STATUS_NOTHING:
-@GTK_IM_STATUS_CALLBACK:
-@GTK_IM_STATUS_NONE:
-
-
-
-Used for justifying the text inside a #GtkLabel widget. (See also
-#GtkAlignment).
-
-
-@GTK_JUSTIFY_LEFT: The text is placed at the left edge of the label.
-@GTK_JUSTIFY_RIGHT: The text is placed at the right edge of the label.
-@GTK_JUSTIFY_CENTER: The text is placed in the center of the label.
-@GTK_JUSTIFY_FILL: The text is placed is distributed across the label.
-
-
-
-
-
-
-@GTK_MOVEMENT_LOGICAL_POSITIONS:
-@GTK_MOVEMENT_VISUAL_POSITIONS:
-@GTK_MOVEMENT_WORDS:
-@GTK_MOVEMENT_DISPLAY_LINES:
-@GTK_MOVEMENT_DISPLAY_LINE_ENDS:
-@GTK_MOVEMENT_PARAGRAPHS:
-@GTK_MOVEMENT_PARAGRAPH_ENDS:
-@GTK_MOVEMENT_PAGES:
-@GTK_MOVEMENT_BUFFER_ENDS:
-@GTK_MOVEMENT_HORIZONTAL_PAGES:
-
-
-
-Represents the orientation of widgets which can be switched between horizontal
-and vertical orientation on the fly, like #GtkToolbar.
-
-
-@GTK_ORIENTATION_HORIZONTAL: The widget is in horizontal orientation.
-@GTK_ORIENTATION_VERTICAL: The widget is in vertical orientation.
-
-
-
-Represents the packing location #GtkBox children. (See: #GtkVBox,
-#GtkHBox, and #GtkButtonBox).
-
-
-@GTK_PACK_START: The child is packed into the start of the box
-@GTK_PACK_END: The child is packed into the end of the box
-
-
-
-
-
-
-@GTK_PATH_PRIO_LOWEST:
-@GTK_PATH_PRIO_GTK:
-@GTK_PATH_PRIO_APPLICATION:
-@GTK_PATH_PRIO_THEME:
-@GTK_PATH_PRIO_RC:
-@GTK_PATH_PRIO_HIGHEST:
-
-
-
-
-
-
-@GTK_PATH_WIDGET:
-@GTK_PATH_WIDGET_CLASS:
-@GTK_PATH_CLASS:
-
-
-
-Determines when a scroll bar will be visible.
-
-
-@GTK_POLICY_ALWAYS: The scrollbar is always visible.
-@GTK_POLICY_AUTOMATIC: The scrollbar will appear and disappear as necessary. For example,
-when all of a #GtkCList can not be seen.
-@GTK_POLICY_NEVER: The scrollbar will never appear.
-
-
-
-Describes which edge of a widget a certain feature is positioned at, e.g. the
-tabs of a #GtkNotebook, the handle of a #GtkHandleBox or the label of a
-#GtkScale.
-
-
-@GTK_POS_LEFT: The feature is at the left edge.
-@GTK_POS_RIGHT: The feature is at the right edge.
-@GTK_POS_TOP: The feature is at the top edge.
-@GTK_POS_BOTTOM: The feature is at the bottom edge.
-
-
-
-Indicated the relief to be drawn around a #GtkButton.
-
-
-@GTK_RELIEF_NORMAL: Draw a normal relief.
-@GTK_RELIEF_HALF: A half relief.
-@GTK_RELIEF_NONE: No relief.
-
-
-
-
-
-
-@GTK_RESIZE_PARENT:
-@GTK_RESIZE_QUEUE:
-@GTK_RESIZE_IMMEDIATE: Deprecated.
-
-
-
-
-
-
-@GTK_SCROLL_STEPS:
-@GTK_SCROLL_PAGES:
-@GTK_SCROLL_ENDS:
-@GTK_SCROLL_HORIZONTAL_STEPS:
-@GTK_SCROLL_HORIZONTAL_PAGES:
-@GTK_SCROLL_HORIZONTAL_ENDS:
-
-
-
-
-
-
-@GTK_SCROLL_NONE:
-@GTK_SCROLL_JUMP:
-@GTK_SCROLL_STEP_BACKWARD:
-@GTK_SCROLL_STEP_FORWARD:
-@GTK_SCROLL_PAGE_BACKWARD:
-@GTK_SCROLL_PAGE_FORWARD:
-@GTK_SCROLL_STEP_UP:
-@GTK_SCROLL_STEP_DOWN:
-@GTK_SCROLL_PAGE_UP:
-@GTK_SCROLL_PAGE_DOWN:
-@GTK_SCROLL_STEP_LEFT:
-@GTK_SCROLL_STEP_RIGHT:
-@GTK_SCROLL_PAGE_LEFT:
-@GTK_SCROLL_PAGE_RIGHT:
-@GTK_SCROLL_START:
-@GTK_SCROLL_END:
-
-
-
-Used to control what selections users are allowed to make.
-
-
-@GTK_SELECTION_NONE: No selection is possible.
-@GTK_SELECTION_SINGLE: Zero or one element may be selected.
-@GTK_SELECTION_BROWSE: Exactly one element is selected. In some circumstances,
- such as initially or during a search operation, it's possible for no element
- to be selected with %GTK_SELECTION_BROWSE. What is really enforced is that
- the user can't deselect a currently selected element except by selecting
- another element.
-@GTK_SELECTION_MULTIPLE: Any number of elements may be selected.
- Clicks toggle the state of an item. Any number of elements may be selected.
- The Ctrl key may be used to enlarge the selection, and Shift key to select
- between the focus and the child pointed to. Some widgets may also allow
- Click-drag to select a range of elements.
-
-
-
-Used to change the appearance of an outline typically provided by a #GtkFrame.
-
-
-@GTK_SHADOW_NONE: No outline.
-@GTK_SHADOW_IN: The outline is bevelled inwards.
-@GTK_SHADOW_OUT: The outline is bevelled outwards like a button.
-@GTK_SHADOW_ETCHED_IN: The outline has a sunken 3d appearance.
-@GTK_SHADOW_ETCHED_OUT: The outline has a raised 3d appearance
-
-
-
-
-
-
-@GTK_STATE_NORMAL:
-@GTK_STATE_ACTIVE:
-@GTK_STATE_PRELIGHT:
-@GTK_STATE_SELECTED:
-@GTK_STATE_INSENSITIVE:
-@GTK_STATE_INCONSISTENT:
-@GTK_STATE_FOCUSED:
-
-
-
-
-
-
-@GTK_STATE_FLAG_ACTIVE:
-@GTK_STATE_FLAG_PRELIGHT:
-@GTK_STATE_FLAG_SELECTED:
-@GTK_STATE_FLAG_INSENSITIVE:
-@GTK_STATE_FLAG_INCONSISTENT:
-@GTK_STATE_FLAG_FOCUSED:
-
-
-
-Used to customize the appearance of a #GtkToolbar. Note that
-setting the toolbar style overrides the user's preferences
-for the default toolbar style. Note that if the button has only
-a label set and GTK_TOOLBAR_ICONS is used, the label will be
-visible, and vice versa.
-
-
-@GTK_TOOLBAR_ICONS: Buttons display only icons in the toolbar.
-@GTK_TOOLBAR_TEXT: Buttons display only text labels in the toolbar.
-@GTK_TOOLBAR_BOTH: Buttons display text and icons in the toolbar.
-@GTK_TOOLBAR_BOTH_HORIZ: Buttons display icons and text alongside each
-other, rather than vertically stacked
-
-
-
-Used by #GtkRange to control the policy for notifying value changes.
-
-
-@GTK_UPDATE_CONTINUOUS: Notify updates whenever the value changed
-@GTK_UPDATE_DISCONTINUOUS: Notify updates when the mouse button has been released
-@GTK_UPDATE_DELAYED: Space out updates with a small timeout
-
-
-
-Window placement can be influenced using this enumeration. Note that
-using #GTK_WIN_POS_CENTER_ALWAYS is almost always a bad idea.
-It won't necessarily work well with all window managers or on all windowing systems.
-
-
-@GTK_WIN_POS_NONE: No influence is made on placement.
-@GTK_WIN_POS_CENTER: Windows should be placed in the center of the screen.
-@GTK_WIN_POS_MOUSE: Windows should be placed at the current mouse position.
-@GTK_WIN_POS_CENTER_ALWAYS: Keep window centered as it changes size, etc.
-@GTK_WIN_POS_CENTER_ON_PARENT: Center the window on its transient
-parent (see gtk_window_set_transient_for()).
-
-
-
-A #GtkWindow can be one of these types. Most things you'd consider a
-"window" should have type #GTK_WINDOW_TOPLEVEL; windows with this type
-are managed by the window manager and have a frame by default (call
-gtk_window_set_decorated() to toggle the frame). Windows with type
-#GTK_WINDOW_POPUP are ignored by the window manager; window manager
-keybindings won't work on them, the window manager won't decorate the
-window with a frame, many GTK+ features that rely on the window
-manager will not work (e.g. resize grips and
-maximization/minimization). #GTK_WINDOW_POPUP is used to implement
-widgets such as #GtkMenu or tooltips that you normally don't think of
-as windows per se. Nearly all windows should be #GTK_WINDOW_TOPLEVEL.
-In particular, do not use #GTK_WINDOW_POPUP just to turn off
-the window borders; use gtk_window_set_decorated() for that.
-
-
-@GTK_WINDOW_TOPLEVEL: A regular window, such as a dialog.
-@GTK_WINDOW_POPUP: A special window such as a tooltip.
-
-
-
-Determines the direction of a sort.
-
-
-@GTK_SORT_ASCENDING: Sorting is in ascending order.
-@GTK_SORT_DESCENDING: Sorting is in descending order.
-
-
-
-Gives an indication why a drag operation failed.
-The value can by obtained by connecting to the
-#GtkWidget::drag-failed signal.
-
-
-@GTK_DRAG_RESULT_SUCCESS: The drag operation was successful
-@GTK_DRAG_RESULT_NO_TARGET: No suitable drag target
-@GTK_DRAG_RESULT_USER_CANCELLED: The user cancelled the drag operation
-@GTK_DRAG_RESULT_TIMEOUT_EXPIRED: The drag operation timed out
-@GTK_DRAG_RESULT_GRAB_BROKEN: The pointer or keyboard grab used
- for the drag operation was broken
-@GTK_DRAG_RESULT_ERROR: The drag operation failed due to some
- unspecified error
-
-
-
-
-
-
-@GTK_JUNCTION_NONE:
-@GTK_JUNCTION_CORNER_TOPLEFT:
-@GTK_JUNCTION_CORNER_TOPRIGHT:
-@GTK_JUNCTION_CORNER_BOTTOMLEFT:
-@GTK_JUNCTION_CORNER_BOTTOMRIGHT:
-@GTK_JUNCTION_TOP:
-@GTK_JUNCTION_BOTTOM:
-@GTK_JUNCTION_LEFT:
-@GTK_JUNCTION_RIGHT:
-
-
-
-
-
-
-@GTK_BORDER_STYLE_NONE:
-@GTK_BORDER_STYLE_SOLID:
-@GTK_BORDER_STYLE_INSET:
-@GTK_BORDER_STYLE_OUTSET:
-
-
-
-
-
-
-@GTK_REGION_EVEN:
-@GTK_REGION_ODD:
-@GTK_REGION_FIRST:
-@GTK_REGION_LAST:
-@GTK_REGION_SORTED:
-
diff --git a/docs/reference/gtk/tmpl/gtkeventbox.sgml b/docs/reference/gtk/tmpl/gtkeventbox.sgml
deleted file mode 100644
index 66bbeea422..0000000000
--- a/docs/reference/gtk/tmpl/gtkeventbox.sgml
+++ /dev/null
@@ -1,86 +0,0 @@
-
-GtkEventBox
-
-
-A widget used to catch events for widgets which do not have their own window
-
-
-
-The #GtkEventBox widget is a subclass of #GtkBin which also has its own window.
-It is useful since it allows you to catch events for widgets which do not
-have their own window.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The #GtkEventBox-struct struct contains private data only, and
-should be accessed using the functions below.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Creates a new #GtkEventBox.
-
-
-@void:
-@Returns: a new #GtkEventBox.
-
-
-
-
-
-
-
-@event_box:
-@above_child:
-
-
-
-
-
-
-
-@event_box:
-@Returns:
-
-
-
-
-
-
-
-@event_box:
-@visible_window:
-
-
-
-
-
-
-
-@event_box:
-@Returns:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkexpander.sgml b/docs/reference/gtk/tmpl/gtkexpander.sgml
deleted file mode 100644
index 77427b4d00..0000000000
--- a/docs/reference/gtk/tmpl/gtkexpander.sgml
+++ /dev/null
@@ -1,296 +0,0 @@
-
-GtkExpander
-
-
-A container which can hide its child
-
-
-
-A #GtkExpander allows the user to hide or show its child by clicking
-on an expander triangle similar to the triangles used in a #GtkTreeView.
-
-
-
-Normally you use an expander as you would use any other descendant
-of #GtkBin; you create the child widget and use gtk_container_add()
-to add it to the expander. When the expander is toggled, it will take
-care of showing and hiding the child automatically.
-
-
-
-Special Usage
-
-
-There are situations in which you may prefer to show and hide the
-expanded widget yourself, such as when you want to actually create
-the widget at expansion time. In this case, create a #GtkExpander
-but do not add a child to it. The expander widget has an
-expanded property which can be used to monitor
-its expansion state. You should watch this property with a signal
-connection as follows:
-
-
-
-expander = gtk_expander_new_with_mnemonic ("_More Options");
-g_signal_connect (expander, "notify::expanded",
- G_CALLBACK (expander_callback), NULL);
-
-...
-
-static void
-expander_callback (GObject *object,
- GParamSpec *param_spec,
- gpointer user_data)
-{
- GtkExpander *expander;
-
- expander = GTK_EXPANDER (object);
-
- if (gtk_expander_get_expanded (expander))
- {
- /* Show or create widgets */
- }
- else
- {
- /* Hide or destroy widgets */
- }
-}
-
-
-
-GtkExpander as GtkBuildable
-
-The GtkExpander implementation of the GtkBuildable interface
-supports placing a child in the label position by specifying
-"label" as the "type" attribute of a <child> element.
-A normal content child can be specified without specifying
-a <child> type attribute.
-
-
-A UI definition fragment with GtkExpander
-
-
-
-
-
-
-
-
-]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@expander: the object which received the signal.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@label:
-@Returns:
-
-
-
-
-
-
-
-@label:
-@Returns:
-
-
-
-
-
-
-
-@expander:
-@expanded:
-
-
-
-
-
-
-
-@expander:
-@Returns:
-
-
-
-
-
-
-
-@expander:
-@spacing:
-
-
-
-
-
-
-
-@expander:
-@Returns:
-
-
-
-
-
-
-
-@expander:
-@label:
-
-
-
-
-
-
-
-@expander:
-@Returns:
-
-
-
-
-
-
-
-@expander:
-@use_underline:
-
-
-
-
-
-
-
-@expander:
-@Returns:
-
-
-
-
-
-
-
-@expander:
-@use_markup:
-
-
-
-
-
-
-
-@expander:
-@Returns:
-
-
-
-
-
-
-
-@expander:
-@label_widget:
-
-
-
-
-
-
-
-@expander:
-@Returns:
-
-
-
-
-
-
-
-@expander:
-@label_fill:
-
-
-
-
-
-
-
-@expander:
-@Returns:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkfeatures.sgml b/docs/reference/gtk/tmpl/gtkfeatures.sgml
deleted file mode 100644
index d52d82e78f..0000000000
--- a/docs/reference/gtk/tmpl/gtkfeatures.sgml
+++ /dev/null
@@ -1,135 +0,0 @@
-
-Version Information
-
-
-Variables and functions to check the GTK+ version
-
-
-
-GTK+ provides version information, primarily useful in configure checks
-for builds that have a configure script. Applications will not
-typically use the features described here.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-@required_major:
-@required_minor:
-@required_micro:
-@Returns:
-
-
-
-
-Like #gtk_major_version, but from the headers used at
-application compile time, rather than from the library linked against
-at application run time.
-
-
-
-
-
-
-Like #gtk_minor_version, but from the headers used at
-application compile time, rather than from the library linked against
-at application run time.
-
-
-
-
-
-
-Like #gtk_micro_version, but from the headers used at
-application compile time, rather than from the library linked against
-at application run time.
-
-
-
-
-
-
-Like #gtk_binary_age, but from the headers used at
-application compile time, rather than from the library linked against
-at application run time.
-
-
-
-
-
-
-Like #gtk_interface_age, but from the headers used at
-application compile time, rather than from the library linked against
-at application run time.
-
-
-
-
-
-
-Returns %TRUE if the version of the GTK+ header files is the same
-as or newer than the passed-in version.
-
-
-@major: major version (e.g. 1 for version 1.2.5)
-@minor: minor version (e.g. 2 for version 1.2.5)
-@micro: micro version (e.g. 5 for version 1.2.5)
-
-
diff --git a/docs/reference/gtk/tmpl/gtkfilefilter.sgml b/docs/reference/gtk/tmpl/gtkfilefilter.sgml
deleted file mode 100644
index 4f22a3cca7..0000000000
--- a/docs/reference/gtk/tmpl/gtkfilefilter.sgml
+++ /dev/null
@@ -1,170 +0,0 @@
-
-GtkFileFilter
-
-
-A filter for selecting a file subset
-
-
-
-A GtkFileFilter can be used to restrict the files being shown
-in a #GtkFileChooser. Files can be filtered based on their name
-(with gtk_file_filter_add_pattern()), on their mime type (with
-gtk_file_filter_add_mime_type()), or by a custom filter function
-(with gtk_file_filter_add_custom()).
-
-
-
-Filtering by mime types handles aliasing and subclassing of mime
-types; e.g. a filter for text/plain also matches a file with mime
-type application/rtf, since application/rtf is a subclass of
-text/plain. Note that #GtkFileFilter allows wildcards for the
-subtype of a mime type, so you can e.g. filter for image/*.
-
-
-
-Normally, filters are used by adding them to a #GtkFileChooser,
-see gtk_file_chooser_add_filter(), but it is also possible
-to manually use a filter on a file with gtk_file_filter_filter().
-
-
-
-
-#GtkFileChooser
-
-
-
-
-
-
-
-
-
-
-The GtkFileFilter struct contains
-only private fields and should not be directly accessed.
-
-
-
-
-
-A GtkFileFilterInfo struct is used
-to pass information about the tested file to
-gtk_file_filter_filter().
-
-
-@contains: Flags indicating which of the following fields need
- are filled
-@filename: the filename of the file being tested
-@uri: the URI for the file being tested
-@display_name: the string that will be used to display the file
- in the file chooser
-@mime_type: the mime type of the file
-
-
-
-These flags indicate what parts of a #GtkFileFilterInfo struct
-are filled or need to be filled.
-
-
-@GTK_FILE_FILTER_FILENAME: the filename of the file being tested
-@GTK_FILE_FILTER_URI: the URI for the file being tested
-@GTK_FILE_FILTER_DISPLAY_NAME: the string that will be used to
- display the file in the file chooser
-@GTK_FILE_FILTER_MIME_TYPE: the mime type of the file
-
-
-
-The type of function that is used with custom filters,
-see gtk_file_filter_add_custom().
-
-
-@filter_info: a #GtkFileFilterInfo that is filled according
- to the @needed flags passed to gtk_file_filter_add_custom()
-@data: user data passed to gtk_file_filter_add_custom()
-@Returns: %TRUE if the file should be displayed
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@filter:
-@name:
-
-
-
-
-
-
-
-@filter:
-@Returns:
-
-
-
-
-
-
-
-@filter:
-@mime_type:
-
-
-
-
-
-
-
-@filter:
-@pattern:
-
-
-
-
-
-
-
-@filter:
-
-
-
-
-
-
-
-@filter:
-@needed:
-@func:
-@data:
-@notify:
-
-
-
-
-
-
-
-@filter:
-@Returns:
-
-
-
-
-
-
-
-@filter:
-@filter_info:
-@Returns:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkfixed.sgml b/docs/reference/gtk/tmpl/gtkfixed.sgml
deleted file mode 100644
index b2366aa2fd..0000000000
--- a/docs/reference/gtk/tmpl/gtkfixed.sgml
+++ /dev/null
@@ -1,133 +0,0 @@
-
-GtkFixed
-
-
-A container which allows you to position widgets at fixed coordinates
-
-
-
-The #GtkFixed widget is a container which can place child widgets at fixed
-positions and with fixed sizes, given in pixels. #GtkFixed performs no
-automatic layout management.
-
-
-
-For most applications, you should not use this container! It keeps
-you from having to learn about the other GTK+ containers, but it
-results in broken applications.
-With #GtkFixed, the following things will result in truncated text,
-overlapping widgets, and other display bugs:
-
-
-Themes, which may change widget sizes.
-
-
-
-Fonts other than the one you used to write the app will of
-course change the size of widgets containing text; keep in mind that
-users may use a larger font because of difficulty reading the default,
-or they may be using Windows or the framebuffer port of GTK+, where
-different fonts are available.
-
-
-
-
-Translation of text into other languages changes its size. Also,
-display of non-English text will use a different font in many cases.
-
-
-
-
-
-
-In addition, the fixed widget can't properly be mirrored in
-right-to-left languages such as Hebrew and Arabic. i.e. normally GTK+
-will flip the interface to put labels to the right of the thing they
-label, but it can't do that with #GtkFixed. So your application will
-not be usable in right-to-left languages.
-
-
-
-Finally, fixed positioning makes it kind of annoying to add/remove GUI
-elements, since you have to reposition all the other elements. This is
-a long-term maintenance problem for your application.
-
-
-
-If you know none of these things are an issue for your application,
-and prefer the simplicity of #GtkFixed, by all means use the
-widget. But you should be aware of the tradeoffs.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The #GtkFixed-struct struct contains the following fields.
-(These fields should be considered read-only. They should never be set by
-an application.)
-
-
-
-
-
-
-#GList *children;
-a list of #GtkFixedChild elements, containing the child widgets and
-their positions.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Creates a new #GtkFixed.
-
-
-@void:
-@Returns: a new #GtkFixed.
-
-
-
-
-Adds a widget to a #GtkFixed container at the given position.
-
-
-@fixed: a #GtkFixed.
-@widget: the widget to add.
-@x: the horizontal position to place the widget at.
-@y: the vertical position to place the widget at.
-
-
-
-
-Moves a child of a #GtkFixed container to the given position.
-
-
-@fixed: a #GtkFixed.
-@widget: the child widget.
-@x: the horizontal position to move the widget to.
-@y: the vertical position to move the widget to.
-
-
diff --git a/docs/reference/gtk/tmpl/gtkmain.sgml b/docs/reference/gtk/tmpl/gtkmain.sgml
deleted file mode 100644
index c49a5d92c0..0000000000
--- a/docs/reference/gtk/tmpl/gtkmain.sgml
+++ /dev/null
@@ -1,626 +0,0 @@
-
-Main loop and Events
-
-
-Library initialization, main event loop, and events
-
-
-
-
-Before using GTK+, you need to initialize it; initialization connects
-to the window system display, and parses some standard command line
-arguments. The gtk_init() function initializes GTK+. gtk_init() exits
-the application if errors occur; to avoid this, use gtk_init_check().
-gtk_init_check() allows you to recover from a failed GTK+
-initialization - you might start up your application in text mode instead.
-
-
-
-Like all GUI toolkits, GTK+ uses an event-driven programming
-model. When the user is doing nothing, GTK+ sits in the
-main loop and waits for input. If the user
-performs some action - say, a mouse click - then the main loop "wakes
-up" and delivers an event to GTK+. GTK+ forwards the event to one or
-more widgets.
-
-
-
-When widgets receive an event, they frequently emit one or more
-signals . Signals notify your program that
-"something interesting happened" by invoking functions you've
-connected to the signal with g_signal_connect(). Functions connected
-to a signal are often termed callbacks .
-
-
-
-When your callbacks are invoked, you would typically take some action
-- for example, when an Open button is clicked you might display a
-#GtkFileSelectionDialog. After a callback finishes, GTK+ will return
-to the main loop and await more user input.
-
-
-
-Typical main function for a GTK+ application
-
-int
-main (int argc, char **argv)
-{
- /* Initialize i18n support */
- gtk_set_locale ();
-
- /* Initialize the widget set */
- gtk_init (&argc, &argv);
-
- /* Create the main window */
- mainwin = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- /* Set up our GUI elements */
- ...
-
- /* Show the application window */
- gtk_widget_show_all (mainwin);
-
- /* Enter the main event loop, and wait for user interaction */
- gtk_main ();
-
- /* The user lost interest */
- return 0;
-}
-
-
-
-
-It's OK to use the GLib main loop directly instead of gtk_main(),
-though it involves slightly more typing. See #GMainLoop in the GLib
-documentation.
-
-
-
-
-See the GLib manual, especially #GMainLoop and signal-related
-functions such as g_signal_connect().
-
-
-
-
-
-
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@argc:
-@argv:
-@Returns:
-
-
-
-
-
-
-
-
-
-
-
-@argc:
-@argv:
-
-
-
-
-
-
-@argc:
-@argv:
-@Returns:
-
-
-
-
-
-
-
-@argc:
-@argv:
-@parameter_string:
-@entries:
-@translation_domain:
-@error:
-@Returns:
-
-
-
-
-
-
-
-@open_default_display:
-@Returns:
-
-
-
-
-Checks if any events are pending. This can be used to update the GUI
-and invoke timeouts etc. while doing some time intensive computation.
-
-
-
-Updating the GUI during a long computation.
-
- /* computation going on */
-...
- while (gtk_events_pending ())
- gtk_main_iteration ();
-...
- /* computation continued */
-
-
-
-@void:
-@Returns: %TRUE if any events are pending, %FALSE otherwise.
-
-
-
-
-Runs the main loop until gtk_main_quit() is called. You can nest calls to
-gtk_main(). In that case gtk_main_quit() will make the innermost invocation
-of the main loop return.
-
-
-@void:
-
-
-
-
-Asks for the current nesting level of the main loop. This can be useful
-when calling gtk_quit_add().
-
-
-@void:
-@Returns: the nesting level of the current invocation of the main loop.
-
-
-
-
-Makes the innermost invocation of the main loop return when it regains
-control.
-
-
-@void:
-
-
-
-
-Runs a single iteration of the mainloop. If no events are waiting to be
-processed GTK+ will block until the next event is noticed. If you don't
-want to block look at gtk_main_iteration_do() or check if any events are
-pending with gtk_events_pending() first.
-
-
-@void:
-@Returns: %TRUE if gtk_main_quit() has been called for the innermost mainloop.
-
-
-
-
-Runs a single iteration of the mainloop. If no events are available either
-return or block dependent on the value of @blocking.
-
-
-@blocking: %TRUE if you want GTK+ to block if no events are pending.
-@Returns: %TRUE if gtk_main_quit() has been called for the innermost mainloop.
-
-
-
-
-Processes a single GDK event. This is public only to allow filtering of events
-between GDK and GTK+. You will not usually need to call this function directly.
-
-
-While you should not call this function directly, you might want to know
-how exactly events are handled. So here is what this function does with
-the event:
-
-
-
-
- Compress enter/leave notify events. If the event passed build an
- enter/leave pair together with the next event (peeked from GDK)
- both events are thrown away. This is to avoid a backlog of (de-)highlighting
- widgets crossed by the pointer.
-
-
- Find the widget which got the event. If the widget can't be determined
- the event is thrown away unless it belongs to a INCR transaction. In that
- case it is passed to gtk_selection_incr_event().
-
-
- Then the event is passed on a stack so you can query the currently handled
- event with gtk_get_current_event().
-
-
- The event is sent to a widget. If a grab is active all events for
- widgets that are not in the contained in the grab widget are sent to the
- latter with a few exceptions:
-
-
-
- Deletion and destruction events are still sent to the event widget for
- obvious reasons.
-
-
- Events which directly relate to the visual representation of the event
- widget.
-
-
- Leave events are delivered to the event widget if there was an enter
- event delivered to it before without the paired leave event.
-
-
- Drag events are not redirected because it is unclear what the semantics
- of that would be.
-
-
-
- Another point of interest might be that all key events are first passed
- through the key snooper functions if there are any. Read the description
- of gtk_key_snooper_install() if you need this feature.
-
-
- After finishing the delivery the event is popped from the event stack.
-
-
-
-@event: An event to process (normally) passed by GDK.
-
-
-
-
-Each GTK+ module must have a function gtk_module_init() with this prototype.
-This function is called after loading the module with the @argc and @argv
-cleaned from any arguments that GTK+ handles itself.
-
-
-@argc: Pointer to the number of arguments remaining after gtk_init().
-@argv: Points to the argument vector.
-
-
-
-
-
-
-
-@display:
-@Since: 2.2
-
-
-
-
-All this function does it to return %TRUE. This can be useful for example
-if you want to inhibit the deletion of a window. Of course you should
-not do this as the user expects a reaction from clicking the close
-icon of the window...
-
-
-
-A persistent window
-
-##include <gtk/gtk.h>
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *win, *but;
-
- gtk_init( &argc, &argv );
-
- win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- g_signal_connect (win, "delete-event",
- G_CALLBACK (gtk_true), NULL);
- g_signal_connect (win, "destroy",
- G_CALLBACK (gtk_main_quit), NULL);
-
- but = gtk_button_new_with_label ("Close yourself. I mean it!");
- g_signal_connect_swapped (but, "clicked",
- G_CALLBACK (gtk_object_destroy), win);
- gtk_container_add (GTK_CONTAINER (win), but);
-
- gtk_widget_show_all (win);
- gtk_main ();
- return 0;
-}
-
-
-
-@void:
-@Returns: %TRUE
-
-
-
-
-Analogical to gtk_true() this function does nothing
-but always returns %FALSE.
-
-
-@void:
-@Returns: %FALSE
-
-
-
-
-Makes @widget the current grabbed widget. This means that interaction with
-other widgets in the same application is blocked and mouse as well as
-keyboard events are delivered to this widget.
-
-
-If @widget is not sensitive, it is not set as the current grabbed
-widget and this function does nothing.
-
-
-@widget: The widget that grabs keyboard and pointer events.
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-Removes the grab from the given widget. You have to pair calls to gtk_grab_add()
-and gtk_grab_remove().
-
-
-If @widget does not have the grab, this function does nothing.
-
-
-@widget: The widget which gives up the grab.
-
-
-
-
-
-
-
-@widget:
-@device:
-@block_others:
-
-
-
-
-
-
-
-@widget:
-@device:
-
-
-
-
-
-
-
-@data:
-@Returns:
-
-
-
-
-Trigger destruction of @object in case the mainloop at level @main_level
-is quit.
-
-
-@main_level: Level of the mainloop which shall trigger the destruction.
-@object: Object to be destroyed.
-@Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-
-
-Registers a function to be called when an instance of the mainloop is left.
-
-
-@main_level: Level at which termination the function shall be called. You
- can pass 0 here to have the function run at the termination of the current
- mainloop.
-@function: The function to call. This should return 0 to be removed from the
- list of quit handlers. Otherwise the function might be called again.
-@data: Pointer to pass when calling @function.
-@Returns: A handle for this quit handler (you need this for gtk_quit_remove())
- or 0 if you passed a %NULL pointer in @function.
-@Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-
-
-
-
-
-@object:
-@data:
-@n_args:
-@args:
-
-
-
-
-
-
-
-@type:
-@name:
-
-
-
-Registers a function to be called when an instance of the mainloop is left.
-In comparison to gtk_quit_add() this function adds the possibility to
-pass a marshaller and a function to be called when the quit handler is freed.
-
-
-The former can be used to run interpreted code instead of a compiled function
-while the latter can be used to free the information stored in @data (while
-you can do this in @function as well)... So this function will mostly be
-used by GTK+ wrappers for languages other than C.
-
-
-@main_level: Level at which termination the function shall be called. You
- can pass 0 here to have the function run at the termination of the current
- mainloop.
-@function: The function to call. This should return 0 to be removed from the
- list of quit handlers. Otherwise the function might be called again.
-@marshal: The marshaller to be used. If this is non-%NULL, @function is
- ignored.
-@data: Pointer to pass when calling @function.
-@destroy: Function to call to destruct @data. Gets @data as argument.
-@Returns: A handle for this quit handler (you need this for gtk_quit_remove())
- or 0 if you passed a %NULL pointer in @function.
-@Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-
-
-Removes a quit handler by its identifier.
-
-
-@quit_handler_id: Identifier for the handler returned when installing it.
-@Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-
-
-Removes a quit handler identified by its @data field.
-
-
-@data: The pointer passed as @data to gtk_quit_add() or gtk_quit_add_full().
-@Deprecated: This function is going to be removed in GTK+ 3.0
-
-
-
-
-Use this priority for resizing related stuff. It is used internally by
-GTK+ to compute the sizes of widgets. This priority is higher than
-%GDK_PRIORITY_REDRAW to avoid resizing a widget which was just redrawn.
-
-
-
-
-
-
-Installs a key snooper function, which will get called on all key events
-before delivering them normally.
-
-
-@snooper: a #GtkKeySnoopFunc.
-@func_data: data to pass to @snooper.
-@Returns: a unique id for this key snooper for use with gtk_key_snooper_remove().
-
-
-
-
-Key snooper functions are called before normal event delivery.
-They can be used to implement custom key event handling.
-
-
-@grab_widget: the widget to which the event will be delivered.
-@event: the key event.
-@func_data: the @func_data supplied to gtk_key_snooper_install().
-@Returns: %TRUE to stop further processing of @event, %FALSE to continue.
-
-
-
-
-Removes the key snooper function with the given id.
-
-
-@snooper_handler_id: Identifies the key snooper to remove.
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@state:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@event:
-@Returns:
-
-
-
-
-
-
-
-@widget:
-@event:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkmenu.sgml b/docs/reference/gtk/tmpl/gtkmenu.sgml
deleted file mode 100644
index 2ca8386954..0000000000
--- a/docs/reference/gtk/tmpl/gtkmenu.sgml
+++ /dev/null
@@ -1,494 +0,0 @@
-
-GtkMenu
-
-
-A menu widget
-
-
-
-A #GtkMenu is a #GtkMenuShell that implements a drop down menu consisting of
-a list of #GtkMenuItem objects which can be navigated and activated by the
-user to perform application functions.
-
-
-
-A #GtkMenu is most commonly dropped down by activating a #GtkMenuItem in a
-#GtkMenuBar or popped up by activating a #GtkMenuItem in another #GtkMenu.
-
-
-
-A #GtkMenu can also be popped up by activating a #GtkOptionMenu.
-Other composite widgets such as the #GtkNotebook can pop up a #GtkMenu
-as well.
-
-
-
-Applications can display a #GtkMenu as a popup menu by calling the
-gtk_menu_popup() function. The example below shows how an application
-can pop up a menu when the 3rd mouse button is pressed.
-
-
-
-Connecting the popup signal handler.
-
- /* connect our handler which will popup the menu */
- g_signal_connect_swapped (window, "button_press_event",
- G_CALLBACK (my_popup_handler), menu);
-
-
-
-
-Signal handler which displays a popup menu.
-
-static gint
-my_popup_handler (GtkWidget *widget, GdkEvent *event)
-{
- GtkMenu *menu;
- GdkEventButton *event_button;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- /* The "widget" is the menu that was supplied when
- * g_signal_connect_swapped() was called.
- */
- menu = GTK_MENU (widget);
-
- if (event->type == GDK_BUTTON_PRESS)
- {
- event_button = (GdkEventButton *) event;
- if (event_button->button == 3)
- {
- gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
- event_button->button, event_button->time);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The #GtkMenu struct contains private data only, and
-should be accessed using the functions below.
-
-
-
-
-
-
-
-
-@menu: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Creates a new #GtkMenu.
-
-
-@void:
-@Returns: a new #GtkMenu.
-
-
-
-
-
-
-
-@menu:
-@screen:
-
-
-
-
-Moves a #GtkMenuItem to a new position within the #GtkMenu.
-
-
-@menu: a #GtkMenu.
-@child: the #GtkMenuItem to move.
-@position: the new position to place @child. Positions are numbered from
-0 to n-1.
-
-
-
-
-
-
-
-@menu:
-@child:
-@left_attach:
-@right_attach:
-@top_attach:
-@bottom_attach:
-
-
-
-
-
-
-
-@menu:
-@device:
-@parent_menu_shell:
-@parent_menu_item:
-@func:
-@data:
-@destroy:
-@button:
-@activate_time:
-
-
-
-
-
-@menu:
-@parent_menu_shell:
-@parent_menu_item:
-@func:
-@data:
-@button:
-@activate_time:
-
-
-
-
-Set the #GtkAccelGroup which holds global accelerators for the menu.
-This accelerator group needs to also be added to all windows that
-this menu is being used in with gtk_window_add_accel_group(), in order
-for those windows to support all the accelerators contained in this group.
-
-
-@menu: a #GtkMenu.
-@accel_group: the #GtkAccelGroup to be associated with the menu.
-
-
-
-
-Gets the #GtkAccelGroup which holds global accelerators for the menu.
-See gtk_menu_set_accel_group().
-
-
-@menu: a #GtkMenu.
-@Returns: the #GtkAccelGroup associated with the menu.
-
-
-
-
-
-
-
-@menu:
-@accel_path:
-
-
-
-
-
-
-
-@menu:
-@Returns:
-
-
-
-
-
-
-@menu:
-@title:
-
-
-
-
-
-
-
-@menu:
-@Returns:
-
-
-
-
-
-
-
-@menu:
-@monitor_num:
-
-
-
-
-
-
-
-@menu:
-@Returns:
-
-
-
-
-
-
-
-@menu:
-@Returns:
-
-
-
-
-
-
-
-@menu:
-@reserve_toggle_size:
-
-
-
-
-
-
-
-@menu:
-@Returns:
-
-
-
-
-Removes the menu from the screen.
-
-
-@menu: a #GtkMenu.
-
-
-
-
-Repositions the menu according to its position function.
-
-
-@menu: a #GtkMenu.
-
-
-
-
-Returns the selected menu item from the menu. This is used by the
-#GtkOptionMenu.
-
-
-@menu: a #GtkMenu.
-@Returns: the #GtkMenuItem that was last selected in the menu. If a
-selection has not yet been made, the first menu item is selected.
-
-
-
-
-Selects the specified menu item within the menu. This is used by the
-#GtkOptionMenu and should not be used by anyone else.
-
-
-@menu: a #GtkMenu.
-@index_: the index of the menu item to select. Index values are from
-0 to n-1.
-
-
-
-
-Changes the tearoff state of the menu. A menu is normally displayed
-as drop down menu which persists as long as the menu is active. It can
-also be displayed as a tearoff menu which persists until it is closed
-or reattached.
-
-
-@menu: a #GtkMenu.
-@torn_off: If %TRUE, menu is displayed as a tearoff menu.
-
-
-
-
-Attaches the menu to the widget and provides a callback function that will
-be invoked when the menu calls gtk_menu_detach() during its destruction.
-
-
-@menu: a #GtkMenu.
-@attach_widget: the #GtkWidget that the menu will be attached to.
-@detacher: the user supplied callback function that will be called when
-the menu calls gtk_menu_detach().
-
-
-
-
-Detaches the menu from the widget to which it had been attached.
-This function will call the callback function, @detacher, provided
-when the gtk_menu_attach_to_widget() function was called.
-
-
-@menu: a #GtkMenu.
-
-
-
-
-Returns the #GtkWidget that the menu is attached to.
-
-
-@menu: a #GtkMenu.
-@Returns: the #GtkWidget that the menu is attached to.
-
-
-
-
-
-
-
-@widget:
-@Returns:
-
-
-
-
-A user function supplied when calling gtk_menu_popup() which controls the
-positioning of the menu when it is displayed. The function sets the @x
-and @y parameters to the coordinates where the menu is to be drawn.
-To make the menu appear on a different monitor than the mouse pointer,
-gtk_menu_set_monitor() must be called.
-
-
-@menu: a #GtkMenu.
-@x: address of the #gint representing the horizontal position where the
-menu shall be drawn. This is an output parameter.
-@y: address of the #gint representing the vertical position where the
-menu shall be drawn. This is an output parameter.
-@push_in: This parameter controls how menus placed outside the monitor are handled.
- If this is set to %TRUE and part of the menu is outside the monitor then
- GTK+ pushes the window into the visible area, effectively modifying the
- popup position.
- Note that moving and possibly resizing the menu around will alter the
- scroll position to keep the menu items "in place", i.e. at the same monitor
- position they would have been without resizing.
- In practice, this behavior is only useful for combobox popups or option
- menus and cannot be used to simply confine a menu to monitor boundaries.
- In that case, changing the scroll offset is not desirable.
-@user_data: the data supplied by the user in the gtk_menu_popup() @data
-parameter.
-
-
-
-
-A user function supplied when calling gtk_menu_attach_to_widget() which
-will be called when the menu is later detached from the widget.
-
-
-@attach_widget: the #GtkWidget that the menu is being detached from.
-@menu: the #GtkMenu being detached.
-
-
diff --git a/docs/reference/gtk/tmpl/gtkmenubar.sgml b/docs/reference/gtk/tmpl/gtkmenubar.sgml
deleted file mode 100644
index 89504630b8..0000000000
--- a/docs/reference/gtk/tmpl/gtkmenubar.sgml
+++ /dev/null
@@ -1,104 +0,0 @@
-
-GtkMenuBar
-
-
-A subclass widget for GtkMenuShell which holds GtkMenuItem widgets
-
-
-
-The #GtkMenuBar is a subclass of #GtkMenuShell which contains one to many #GtkMenuItem. The result is a standard menu bar which can hold many menu items. #GtkMenuBar allows for a shadow type to be set for aesthetic purposes. The shadow types are defined in the #gtk_menu_bar_set_shadow_type function.
-
-
-
-
-#GtkMenuShell, #GtkMenu, #GtkMenuItem
-
-
-
-
-
-
-
-
-
-
-The #GtkMenuBar struct contains the following fields. (These fields should be considered read-only. They should never be set by an application.)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Creates the new #GtkMenuBar
-
-
-@void:
-@Returns: the #GtkMenuBar
-
-
-
-
-Determines how widgets should be packed insided menubars and
-menuitems contained in menubars.
-
-
-@GTK_PACK_DIRECTION_LTR: Widgets are packed left-to-right.
-@GTK_PACK_DIRECTION_RTL: Widgets are packed right-to-left.
-@GTK_PACK_DIRECTION_TTB: Widgets are packed top-to-bottom.
-@GTK_PACK_DIRECTION_BTT: Widgets are packed bottom-to-top.
-
-
-
-
-
-
-@menubar:
-@pack_dir:
-
-
-
-
-
-
-
-@menubar:
-@Returns:
-
-
-
-
-
-
-
-@menubar:
-@child_pack_dir:
-
-
-
-
-
-
-
-@menubar:
-@Returns:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkmenushell.sgml b/docs/reference/gtk/tmpl/gtkmenushell.sgml
deleted file mode 100644
index 2153098b23..0000000000
--- a/docs/reference/gtk/tmpl/gtkmenushell.sgml
+++ /dev/null
@@ -1,224 +0,0 @@
-
-GtkMenuShell
-
-
-A base class for menu objects
-
-
-
-A #GtkMenuShell is the abstract base class used to derive the
-#GtkMenu and #GtkMenuBar subclasses.
-
-
-
-A #GtkMenuShell is a container of #GtkMenuItem objects arranged in a
-list which can be navigated, selected, and activated by the user to perform
-application functions. A #GtkMenuItem can have a submenu associated with it,
-allowing for nested hierarchical menus.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The #GtkMenuShell-struct struct contains the following fields.
-(These fields should be considered read-only. They should never be set by
-an application.)
-
-
-
-
-
-
-#GList *children;
-The list of #GtkMenuItem objects contained by this #GtkMenuShell.
-
-
-
-
-
-
-
-
-An action signal that activates the current menu item within the menu
-shell.
-
-
-@menushell: the object which received the signal.
-@force_hide: if TRUE, hide the menu after activating the menu item.
-
-
-
-An action signal which cancels the selection within the menu shell.
-Causes the GtkMenuShell::selection-done signal to be emitted.
-
-
-@menushell: the object which received the signal.
-
-
-
-
-
-
-@menushell: the object which received the signal.
-@arg1:
-
-
-
-This signal is emitted when a menu shell is deactivated.
-
-
-@menushell: the object which received the signal.
-
-
-
-An action signal which moves the current menu item in the direction
-specified by @direction.
-
-
-@menushell: the object which received the signal.
-@direction: the direction to move.
-
-
-
-
-
-
-@menushell: the object which received the signal.
-@arg1:
-@Returns:
-
-
-
-This signal is emitted when a selection has been completed within a menu
-shell.
-
-
-@menushell: the object which received the signal.
-
-
-
-
-
-
-
-
-Adds a new #GtkMenuItem to the end of the menu shell's item list.
-
-
-@menu_shell: a #GtkMenuShell.
-@child: The #GtkMenuItem to add.
-
-
-
-
-Adds a new #GtkMenuItem to the beginning of the menu shell's item list.
-
-
-@menu_shell: a #GtkMenuShell.
-@child: The #GtkMenuItem to add.
-
-
-
-
-Adds a new #GtkMenuItem to the menu shell's item list at the position
-indicated by @position.
-
-
-@menu_shell: a #GtkMenuShell.
-@child: The #GtkMenuItem to add.
-@position: The position in the item list where @child is added.
-Positions are numbered from 0 to n-1.
-
-
-
-
-Deactivates the menu shell. Typically this results in the menu shell
-being erased from the screen.
-
-
-@menu_shell: a #GtkMenuShell.
-
-
-
-
-Selects the menu item from the menu shell.
-
-
-@menu_shell: a #GtkMenuShell.
-@menu_item: The #GtkMenuItem to select.
-
-
-
-
-
-
-
-@menu_shell:
-@search_sensitive:
-
-
-
-
-Deselects the currently selected item from the menu shell, if any.
-
-
-@menu_shell: a #GtkMenuShell.
-
-
-
-
-Activates the menu item within the menu shell.
-
-
-@menu_shell: a #GtkMenuShell.
-@menu_item: The #GtkMenuItem to activate.
-@force_deactivate: If TRUE, force the deactivation of the menu shell
-after the menu item is activated.
-
-
-
-
-
-
-
-@menu_shell:
-
-
-
-
-
-
-
-@menu_shell:
-@take_focus:
-
-
-
-
-
-
-
-@menu_shell:
-@Returns:
-
-
-
-
-An enumeration representing directional movements within a menu.
-
-
-@GTK_MENU_DIR_PARENT: To the parent menu shell.
-@GTK_MENU_DIR_CHILD: To the submenu, if any, associated with the item.
-@GTK_MENU_DIR_NEXT: To the next menu item.
-@GTK_MENU_DIR_PREV: To the previous menu item.
-
diff --git a/docs/reference/gtk/tmpl/gtkmenutoolbutton.sgml b/docs/reference/gtk/tmpl/gtkmenutoolbutton.sgml
index c56eab0d76..5326d02498 100644
--- a/docs/reference/gtk/tmpl/gtkmenutoolbutton.sgml
+++ b/docs/reference/gtk/tmpl/gtkmenutoolbutton.sgml
@@ -16,6 +16,24 @@ A GtkToolItem containing a button with an additional dropdown menu
#GtkMenuToolButton. Use gtk_menu_tool_button_new_from_stock() to
create a new #GtkMenuToolButton containing a stock item.
+
diff --git a/docs/reference/gtk/tmpl/gtkprintjob.sgml b/docs/reference/gtk/tmpl/gtkprintjob.sgml
deleted file mode 100644
index 09d2681327..0000000000
--- a/docs/reference/gtk/tmpl/gtkprintjob.sgml
+++ /dev/null
@@ -1,186 +0,0 @@
-
-GtkPrintJob
-
-
-Represents a print job
-
-
-
-A #GtkPrintJob object represents a job that is sent to a
-printer. You only need to deal directly with print jobs if
-you use the non-portable #GtkPrintUnixDialog API.
-
-
-Use gtk_print_job_get_surface() to obtain the cairo surface
-onto which the pages must be drawn. Use gtk_print_job_send()
-to send the finished job to the printer. If you don't use cairo
-#GtkPrintJob also supports printing of manually generated postscript,
-via gtk_print_job_set_source_file().
-
-
-
-
-
-Printing support was added in GTK+ 2.10.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The GtkPrintJob struct contains only private members
-and should not be directly accessed.
-
-
-
-
-
-
-
-
-@printjob: the object which received the signal.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-The type of callback that is passed to gtk_print_job_send().
-It is called when the print job has been completely sent.
-
-
-@print_job: the #GtkPrintJob
-@user_data: user data that has been passed to gtk_print_job_send()
-@error: a #GError that contains error information if the sending
- of the print job failed, otherwise %NULL
-
-
-
-
-
-
-
-@title:
-@printer:
-@settings:
-@page_setup:
-@Returns:
-
-
-
-
-
-
-
-@job:
-@Returns:
-
-
-
-
-
-
-
-@job:
-@Returns:
-
-
-
-
-
-
-
-@job:
-@Returns:
-
-
-
-
-
-
-
-@job:
-@Returns:
-
-
-
-
-
-
-
-@job:
-@filename:
-@error:
-@Returns:
-
-
-
-
-
-
-
-@job:
-@error:
-@Returns:
-
-
-
-
-
-
-
-@job:
-@callback:
-@user_data:
-@dnotify:
-
-
-
-
-
-
-
-@job:
-@track_status:
-
-
-
-
-
-
-
-@job:
-@Returns:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkprintoperation.sgml b/docs/reference/gtk/tmpl/gtkprintoperation.sgml
index 00cc328b35..0b0446026e 100644
--- a/docs/reference/gtk/tmpl/gtkprintoperation.sgml
+++ b/docs/reference/gtk/tmpl/gtkprintoperation.sgml
@@ -630,14 +630,11 @@ The #GQuark used for #GtkPrintError errors.
-The type of function that is passed to gtk_print_run_page_setup_dialog_async().
-This function will be called when the page setup dialog is dismissed, and
-also serves as destroy notify for @data.
+
-@page_setup: the #GtkPageSetup that has been
-@data: user data that has been passed to
- gtk_print_run_page_setup_dialog_async().
+@page_setup:
+@data:
diff --git a/docs/reference/gtk/tmpl/gtkselection.sgml b/docs/reference/gtk/tmpl/gtkselection.sgml
deleted file mode 100644
index 4d6542d720..0000000000
--- a/docs/reference/gtk/tmpl/gtkselection.sgml
+++ /dev/null
@@ -1,542 +0,0 @@
-
-Selections
-
-
-Functions for handling inter-process communication via selections
-
-
-
-
-The selection mechanism provides the basis for different types
-of communication between processes. In particular, drag and drop and
-#GtkClipboard work via selections. You will very seldom or
-never need to use most of the functions in this section directly;
-#GtkClipboard provides a nicer interface to the same functionality.
-
-
-Some of the datatypes defined this section are used in
-the #GtkClipboard and drag-and-drop API's as well. The
-#GtkTargetEntry structure and #GtkTargetList objects represent
-lists of data types that are supported when sending or
-receiving data. The #GtkSelectionData object is used to
-store a chunk of data along with the data type and other
-associated information.
-
-
-
-
-
-
-
-#GtkWidget
-Much of the operation of selections happens via
- signals for #GtkWidget. In particular, if you are
- using the functions in this section, you may need
- to pay attention to ::selection_get,
- ::selection_received, and :selection_clear_event
- signals.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-A #GtkTargetEntry structure represents a single type of
-data than can be supplied for by a widget for a selection
-or for supplied or received during drag-and-drop. It
-contains a string representing the drag type, a flags
-field (used only for drag and drop - see #GtkTargetFlags),
-and an application assigned integer ID. The integer
-ID will later be passed as a signal parameter for signals
-like "selection_get". It allows the application to identify
-the target type without extensive string compares.
-
-
-@target:
-@flags:
-@info:
-
-
-
-A #GtkTargetList structure is a reference counted list
-of #GtkTargetPair. It is used to represent the same
-information as a table of #GtkTargetEntry, but in
-an efficient form. This structure should be treated as
-opaque.
-
-
-@list:
-@ref_count:
-
-
-
-Internally used structure in the drag-and-drop and
-selection handling code.
-
-
-@target:
-@flags:
-@info:
-
-
-
-
-
-
-@target:
-@flags:
-@info:
-@Returns:
-
-
-
-
-
-
-
-@data:
-@Returns:
-
-
-
-
-
-
-
-@data:
-
-
-
-
-
-
-@targets:
-@ntargets:
-@Returns:
-
-
-
-
-
-
-@list:
-@Returns:
-
-
-
-
-
-
-@list:
-
-
-
-
-
-
-@list:
-@target:
-@flags:
-@info:
-
-
-
-
-
-
-@list:
-@targets:
-@ntargets:
-
-
-
-
-
-
-
-@list:
-@info:
-
-
-
-
-
-
-
-@list:
-@info:
-@writable:
-
-
-
-
-
-
-
-@list:
-@info:
-
-
-
-
-
-
-
-@list:
-@info:
-@deserializable:
-@buffer:
-
-
-
-
-
-
-@list:
-@target:
-
-
-
-
-
-
-@list:
-@target:
-@info:
-@Returns:
-
-
-
-
-
-
-
-@targets:
-@n_targets:
-
-
-
-
-
-
-
-@list:
-@n_targets:
-@Returns:
-
-
-
-
-
-
-@widget:
-@selection:
-@time_:
-@Returns:
-
-
-
-
-
-
-
-@display:
-@widget:
-@selection:
-@time_:
-@Returns:
-
-
-
-
-
-
-@widget:
-@selection:
-@target:
-@info:
-
-
-
-
-
-
-@widget:
-@selection:
-@targets:
-@ntargets:
-
-
-
-
-
-
-
-@widget:
-@selection:
-
-
-
-
-
-
-@widget:
-@selection:
-@target:
-@time_:
-@Returns: x
-
-
-
-
-
-
-@selection_data:
-@type:
-@format:
-@data:
-@length:
-
-
-
-
-
-
-
-@selection_data:
-@str:
-@len:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@pixbuf:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@uris:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@targets:
-@n_atoms:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@writable:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@buffer:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@selection_data:
-@Returns:
-
-
-
-
-
-
-
-@targets:
-@n_targets:
-@writable:
-@Returns:
-
-
-
-
-
-
-
-@targets:
-@n_targets:
-@Returns:
-
-
-
-
-
-
-
-@targets:
-@n_targets:
-@Returns:
-
-
-
-
-
-
-
-@targets:
-@n_targets:
-@buffer:
-@Returns:
-
-
-
-
-
-
-@widget:
-
-
-
-
-
-
-@data:
-@Returns:
-
-
-
-
-
-
-@data:
-
-
diff --git a/docs/reference/gtk/tmpl/gtkspinbutton.sgml b/docs/reference/gtk/tmpl/gtkspinbutton.sgml
deleted file mode 100644
index b6c899c5f3..0000000000
--- a/docs/reference/gtk/tmpl/gtkspinbutton.sgml
+++ /dev/null
@@ -1,482 +0,0 @@
-
-GtkSpinButton
-
-
-Retrieve an integer or floating-point number from the user
-
-
-
-A #GtkSpinButton is an ideal way to allow the user to set the value of some
-attribute. Rather than having to directly type a number into a #GtkEntry,
-#GtkSpinButton allows the user to click on one of two arrows to increment or
-decrement the displayed value. A value can still be typed in, with the bonus
-that it can be checked to ensure it is in a given range.
-
-
-The main properties of a #GtkSpinButton are through a #GtkAdjustment. See the
-#GtkAdjustment section for more details about an adjustment's properties.
-
-
-
-Using a GtkSpinButton to get an integer.
-
-
-/* Provides a function to retrieve an integer value from a GtkSpinButton
- * and creates a spin button to model percentage values.
- */
-
-gint grab_int_value (GtkSpinButton *a_spinner, gpointer user_data) {
- return gtk_spin_button_get_value_as_int (a_spinner);
-}
-
-void create_integer_spin_button (void) {
-
- GtkWidget *window, *spinner;
- GtkAdjustment *spinner_adj;
-
- spinner_adj = gtk_adjustment_new (50.0, 0.0, 100.0, 1.0, 5.0, 5.0);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_set_border_width (GTK_CONTAINER (window), 5);
-
- /* creates the spinner, with no decimal places */
- spinner = gtk_spin_button_new (spinner_adj, 1.0, 0);
- gtk_container_add (GTK_CONTAINER (window), spinner);
-
- gtk_widget_show_all (window);
- return;
-}
-
-
-
-
-
-
-
-Using a GtkSpinButton to get a floating point value.
-
-
-/* Provides a function to retrieve a floating point value from a
- * GtkSpinButton, and creates a high precision spin button.
- */
-
-gfloat grab_int_value (GtkSpinButton *a_spinner, gpointer user_data) {
- return gtk_spin_button_get_value (a_spinner);
-}
-
-void create_floating_spin_button (void) {
-
- GtkWidget *window, *spinner;
- GtkAdjustment *spinner_adj;
-
- spinner_adj = gtk_adjustment_new (2.500, 0.0, 5.0, 0.001, 0.1, 0.1);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_container_set_border_width (GTK_CONTAINER (window), 5);
-
- /* creates the spinner, with three decimal places */
- spinner = gtk_spin_button_new (spinner_adj, 0.001, 3);
- gtk_container_add (GTK_CONTAINER (window), spinner);
-
- gtk_widget_show_all (window);
- return;
-}
-
-
-
-
-
-
-
-
-
-#GtkEntry
-retrieve text rather than numbers.
-
-
-
-
-
-
-
-
-
-
-
-
-entry is the #GtkEntry part of the #GtkSpinButton
-widget, and can be used accordingly. All other fields contain private data
-and should only be modified using the functions below.
-
-
-
-
-
-
-
-
-@spinbutton: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@spinbutton: the object which received the signal.
-@arg1:
-@Returns:
-
-
-
-
-
-
-@spinbutton: the object which received the signal.
-@Returns:
-
-
-
-
-
-
-@spinbutton: the object which received the signal.
-
-
-
-
-
-
-@spinbutton: the object which received the signal.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-the type of border that surrounds the arrows of a spin button.
-
-
-
-
-
-
-
-
-
-GTK_UPDATE_ALWAYS
-When refreshing your #GtkSpinButton, the value is always displayed.
-
-
-GTK_UPDATE_IF_VALID
-When refreshing your #GtkSpinButton, the value is only displayed if it is valid within the bounds of the spin button's #GtkAdjustment.
-
-
-
-
-@GTK_UPDATE_ALWAYS:
-@GTK_UPDATE_IF_VALID:
-
-
-
-
-
-
-
-
-GTK_SPIN_STEP_FORWARD,
-GTK_SPIN_STEP_BACKWARD,
-GTK_SPIN_PAGE_FORWARD,
-GTK_SPIN_PAGE_BACKWARD
-These values spin a #GtkSpinButton by the relevant values of the spin button's #GtkAdjustment.
-
-
-GTK_SPIN_HOME,
-GTK_SPIN_END
-These set the spin button's value to the minimum or maxmimum possible values, (set by its #GtkAdjustment), respectively.
-
-
-GTK_SPIN_USER_DEFINED
-The programmer must specify the exact amount to spin the #GtkSpinButton.
-
-
-
-
-@GTK_SPIN_STEP_FORWARD:
-@GTK_SPIN_STEP_BACKWARD:
-@GTK_SPIN_PAGE_FORWARD:
-@GTK_SPIN_PAGE_BACKWARD:
-@GTK_SPIN_HOME:
-@GTK_SPIN_END:
-@GTK_SPIN_USER_DEFINED:
-
-
-
-
-
-
-@spin_button:
-@adjustment:
-@climb_rate:
-@digits:
-
-
-
-
-Creates a new #GtkSpinButton.
-
-
-@adjustment: the #GtkAdjustment object that this spin button should use.
-@climb_rate: specifies how much the spin button changes when an arrow is clicked on.
-@digits: the number of decimal places to display.
-@Returns: The new spin button as a #GtkWidget.
-
-
-
-
-
-
-
-@min:
-@max:
-@step:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@adjustment:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@digits:
-
-
-
-
-
-
-
-@spin_button:
-@step:
-@page:
-
-
-
-
-
-
-
-@spin_button:
-@min:
-@max:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@value:
-
-
-
-
-
-
-
-@spin_button:
-@policy:
-
-
-
-
-
-
-
-@spin_button:
-@numeric:
-
-
-
-
-
-
-
-@spin_button:
-@direction:
-@increment:
-
-
-
-
-
-
-
-@spin_button:
-@wrap:
-
-
-
-
-
-
-
-@spin_button:
-@snap_to_ticks:
-
-
-
-
-
-
-
-@spin_button:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@step:
-@page:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@min:
-@max:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-@spin_button:
-@Returns:
-
-
-
-
-
-
-
-
-
diff --git a/docs/reference/gtk/tmpl/gtktextbuffer.sgml b/docs/reference/gtk/tmpl/gtktextbuffer.sgml
index f7cfdef356..ff1c01a417 100644
--- a/docs/reference/gtk/tmpl/gtktextbuffer.sgml
+++ b/docs/reference/gtk/tmpl/gtktextbuffer.sgml
@@ -931,7 +931,7 @@ It must return the serialized form of the content.
@register_buffer: the #GtkTextBuffer for which the format is registered
-@content_buffer: the #GtkTextsBuffer to serialize
+@content_buffer: the #GtkTextBuffer to serialize
@start: start of the block of text to serialize
@end: end of the block of text to serialize
@length: Return location for the length of the serialized data
diff --git a/docs/reference/gtk/tmpl/gtktexttag.sgml b/docs/reference/gtk/tmpl/gtktexttag.sgml
deleted file mode 100644
index 85203a04d9..0000000000
--- a/docs/reference/gtk/tmpl/gtktexttag.sgml
+++ /dev/null
@@ -1,498 +0,0 @@
-
-GtkTextTag
-
-
-A tag that can be applied to text in a GtkTextBuffer
-
-
-
-You may wish to begin by reading the text widget
-conceptual overview which gives an overview of all the objects and data
-types related to the text widget and how they work together.
-
-
-
-Tags should be in the #GtkTextTagTable for a given #GtkTextBuffer
-before using them with that buffer.
-
-
-
-gtk_text_buffer_create_tag() is the best way to create tags.
-See gtk-demo for numerous examples.
-
-
-
-The "invisible" property was not implemented for GTK+ 2.0.
-It is working (with minor issues) since 2.8.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@texttag: the object which received the signal.
-@arg1:
-@event:
-@arg2:
-@Returns:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-Describes a type of line wrapping.
-
-
-@GTK_WRAP_NONE: do not wrap lines; just make the text area wider
-@GTK_WRAP_CHAR: wrap text, breaking lines anywhere the cursor can
- appear (between characters, usually - if you want to
- be technical, between graphemes, see
- pango_get_log_attrs())
-@GTK_WRAP_WORD: wrap text, breaking lines in between words
-@GTK_WRAP_WORD_CHAR: wrap text, breaking lines in between words, or if
- that is not enough, also between graphemes.
-
-
-
-Using #GtkTextAttributes directly should rarely be necessary. It's
-primarily useful with gtk_text_iter_get_attributes(). As with most
-GTK+ structs, the fields in this struct should only be read, never
-modified directly.
-
-
-@appearance: pointer to sub-struct containing certain attributes
-@justification:
-@direction:
-@font:
-@font_scale:
-@left_margin:
-@indent:
-@right_margin:
-@pixels_above_lines:
-@pixels_below_lines:
-@pixels_inside_wrap:
-@tabs:
-@wrap_mode:
-@language:
-@invisible:
-@bg_full_height:
-@editable:
-
-
-
-
-
-
-@name:
-@Returns:
-
-
-
-
-
-
-
-@tag:
-@Returns:
-
-
-
-
-
-
-
-@tag:
-@priority:
-
-
-
-
-
-
-
-@tag:
-@event_object:
-@event:
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@bg_color:
-@fg_color:
-@rise:
-@underline:
-@strikethrough:
-@draw_bg:
-@inside_selection:
-@is_text:
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@src:
-@Returns:
-
-
-
-
-
-
-
-@src:
-@dest:
-
-
-
-
-
-
-
-@values:
-
-
-
-
-
-
-
-@values:
-@Returns:
-
-
diff --git a/docs/reference/gtk/tmpl/gtktreemodel.sgml b/docs/reference/gtk/tmpl/gtktreemodel.sgml
deleted file mode 100644
index 07dcd45d0e..0000000000
--- a/docs/reference/gtk/tmpl/gtktreemodel.sgml
+++ /dev/null
@@ -1,864 +0,0 @@
-
-GtkTreeModel
-
-
-The tree interface used by GtkTreeView
-
-
-
-The #GtkTreeModel interface defines a generic tree interface for use by
-the #GtkTreeView widget. It is an abstract interface, and is designed
-to be usable with any appropriate data structure. The programmer just
-has to implement this interface on their own data type for it to be
-viewable by a #GtkTreeView widget.
-
-
-
-The model is represented as a hierarchical tree of strongly-typed,
-columned data. In other words, the model can be seen as a tree where
-every node has different values depending on which column is being
-queried. The type of data found in a column is determined by using the
-GType system (ie. #G_TYPE_INT, #GTK_TYPE_BUTTON, #G_TYPE_POINTER, etc.).
-The types are homogeneous per column across all nodes. It is important
-to note that this interface only provides a way of examining a model and
-observing changes. The implementation of each individual model decides
-how and if changes are made.
-
-
-
-In order to make life simpler for programmers who do not need to write
-their own specialized model, two generic models are provided — the
-#GtkTreeStore and the #GtkListStore. To use these, the developer simply
-pushes data into these models as necessary. These models provide the
-data structure as well as all appropriate tree interfaces. As a result,
-implementing drag and drop, sorting, and storing data is trivial. For
-the vast majority of trees and lists, these two models are sufficient.
-
-
-
-Models are accessed on a node/column level of granularity. One can
-query for the value of a model at a certain node and a certain column
-on that node. There are two structures used to reference a particular
-node in a model. They are the #GtkTreePath and the #GtkTreeIter
-
-
-Here, iter is short for iterator
-
-
-Most of the interface consists of operations on a #GtkTreeIter.
-
-
-
-A path is essentially a potential node. It is a location on a model
-that may or may not actually correspond to a node on a specific model.
-The #GtkTreePath struct can be converted into either an array of
-unsigned integers or a string. The string form is a list of numbers
-separated by a colon. Each number refers to the offset at that level.
-Thus, the path 0
refers to the root node and the path
-2:4
refers to the fifth child of the third node.
-
-
-
-By contrast, a #GtkTreeIter is a reference to a specific node on a
-specific model. It is a generic struct with an integer and three
-generic pointers. These are filled in by the model in a model-specific
-way. One can convert a path to an iterator by calling
-gtk_tree_model_get_iter(). These iterators are the primary way of
-accessing a model and are similar to the iterators used by
-#GtkTextBuffer. They are generally statically allocated on the stack and
-only used for a short time. The model interface defines a set of
-operations using them for navigating the model.
-
-
-
-It is expected that models fill in the iterator with private data. For
-example, the #GtkListStore model, which is internally a simple linked
-list, stores a list node in one of the pointers. The #GtkTreeModelSort
-stores an array and an offset in two of the pointers. Additionally,
-there is an integer field. This field is generally filled with a unique
-stamp per model. This stamp is for catching errors resulting from using
-invalid iterators with a model.
-
-
-
-The lifecycle of an iterator can be a little confusing at first.
-Iterators are expected to always be valid for as long as the model is
-unchanged (and doesn't emit a signal). The model is considered to own
-all outstanding iterators and nothing needs to be done to free them from
-the user's point of view. Additionally, some models guarantee that an
-iterator is valid for as long as the node it refers to is valid (most
-notably the #GtkTreeStore and #GtkListStore). Although generally
-uninteresting, as one always has to allow for the case where iterators
-do not persist beyond a signal, some very important performance
-enhancements were made in the sort model. As a result, the
-#GTK_TREE_MODEL_ITERS_PERSIST flag was added to indicate this behavior.
-
-
-
-To help show some common operation of a model, some examples are
-provided. The first example shows three ways of getting the iter at the
-location 3:2:5
. While the first method shown is easier,
-the second is much more common, as you often get paths from callbacks.
-
-
-
-Acquiring a GtkTreeIter
-
-/* Three ways of getting the iter pointing to the location
- */
-{
- GtkTreePath *path;
- GtkTreeIter iter;
- GtkTreeIter parent_iter;
-
- /* get the iterator from a string */
- gtk_tree_model_get_iter_from_string (model, &iter, "3:2:5");
-
- /* get the iterator from a path */
- path = gtk_tree_path_new_from_string ("3:2:5");
- gtk_tree_model_get_iter (model, &iter, path);
- gtk_tree_path_free (path);
-
-
- /* walk the tree to find the iterator */
- gtk_tree_model_iter_nth_child (model, &iter, NULL, 3);
- parent_iter = iter;
- gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 2);
- parent_iter = iter;
- gtk_tree_model_iter_nth_child (model, &iter, &parent_iter, 5);
-}
-
-
-
-
-
-This second example shows a quick way of iterating through a list and
-getting a string and an integer from each row. The
-populate_model function used below is not shown, as
-it is specific to the #GtkListStore. For information on how to write
-such a function, see the #GtkListStore documentation.
-
-Reading data from a GtkTreeModel
-
-enum
-{
- STRING_COLUMN,
- INT_COLUMN,
- N_COLUMNS
-};
-
-{
- GtkTreeModel *list_store;
- GtkTreeIter iter;
- gboolean valid;
- gint row_count = 0;
-
- /* make a new list_store */
- list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
-
- /* Fill the list store with data */
- populate_model (list_store);
-
- /* Get the first iter in the list */
- valid = gtk_tree_model_get_iter_first (list_store, &iter);
-
- while (valid)
- {
- /* Walk through the list, reading each row */
- gchar *str_data;
- gint int_data;
-
- /* Make sure you terminate calls to gtk_tree_model_get()
- * with a '-1' value
- */
- gtk_tree_model_get (list_store, &iter,
- STRING_COLUMN, &str_data,
- INT_COLUMN, &int_data,
- -1);
-
- /* Do something with the data */
- g_print ("Row %d: (%s,%d)\n", row_count, str_data, int_data);
- g_free (str_data);
-
- row_count ++;
- valid = gtk_tree_model_iter_next (list_store, &iter);
- }
-}
-
-
-
-
-
-
-#GtkTreeView, #GtkTreeStore, #GtkListStore, GtkTreeDnd, #GtkTreeSortable
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@treemodel: the object which received the signal.
-@arg1:
-@arg2:
-
-
-
-
-
-
-@treemodel: the object which received the signal.
-@arg1:
-
-
-
-
-
-
-@treemodel: the object which received the signal.
-@arg1:
-@arg2:
-
-
-
-
-
-
-@treemodel: the object which received the signal.
-@arg1:
-@arg2:
-
-
-
-
-
-
-@treemodel: the object which received the signal.
-@arg1:
-@arg2:
-@arg3:
-
-
-
-The GtkTreeIter is the primary structure for
-accessing a structure. Models are expected to put a unique integer in
-the stamp member, and put model-specific
-data in the three user_data members.
-
-
-@stamp: A unique stamp to catch invalid iterators
-@user_data: Model specific data
-@user_data2: Model specific data
-@user_data3: Model specific data
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-@g_iface:
-@row_changed:
-@row_inserted:
-@row_has_child_toggled:
-@row_deleted:
-@rows_reordered:
-@get_flags:
-@get_n_columns:
-@get_column_type:
-@get_iter:
-@get_path:
-@get_value:
-@iter_next:
-@iter_children:
-@iter_has_child:
-@iter_n_children:
-@iter_nth_child:
-@iter_parent:
-@ref_node:
-@unref_node:
-
-
-
-
-
-
-@model: The #GtkTreeModel currently being iterated
-@path: The current #GtkTreePath
-@iter: The current #GtkTreeIter
-@data: The user data passed to gtk_tree_model_foreach()
-@Returns: %TRUE to stop iterating, %FALSE to continue.
-
-
-
-
-These flags indicate various properties of a #GtkTreeModel. They are
-returned by gtk_tree_model_get_flags(), and must be static for the
-lifetime of the object. A more complete description of
-#GTK_TREE_MODEL_ITERS_PERSIST can be found in the overview of this
-section.
-
-
-@GTK_TREE_MODEL_ITERS_PERSIST: Iterators survive all signals emitted by the tree.
-@GTK_TREE_MODEL_LIST_ONLY: The model is a list only, and never has children
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@Returns:
-
-
-
-
-
-
-
-@first_index:
-@Varargs:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@Returns:
-
-
-
-
-
-
-
-@void:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@index_:
-
-
-
-
-
-
-
-@path:
-@index_:
-
-
-
-
-
-
-
-@path:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@depth:
-@Returns:
-
-
-
-
-
-
-
-@path:
-
-
-
-
-
-
-
-@path:
-@Returns:
-
-
-
-
-
-
-
-@a:
-@b:
-@Returns:
-
-
-
-
-
-
-
-@path:
-
-
-
-
-
-
-
-@path:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@Returns:
-
-
-
-
-
-
-
-@path:
-
-
-
-
-
-
-
-@path:
-@descendant:
-@Returns:
-
-
-
-
-
-
-
-@path:
-@ancestor:
-@Returns:
-
-
-
-
-
-
-
-@model:
-@path:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@model:
-@path:
-@Returns:
-
-
-
-
-
-
-
-@reference:
-@Returns:
-
-
-
-
-
-
-
-@reference:
-@Returns:
-
-
-
-
-
-
-
-@reference:
-@Returns:
-
-
-
-
-
-
-
-@reference:
-
-
-
-
-
-
-
-@reference:
-@Returns:
-
-
-
-
-
-
-
-@proxy:
-@path:
-
-
-
-
-
-
-
-@proxy:
-@path:
-
-
-
-
-
-
-
-@proxy:
-@path:
-@iter:
-@new_order:
-
-
-
-
-
-
-
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@iter:
-
-
-
-
-
-
-
-@tree_model:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@index_:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@path:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@path_string:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@column:
-@value:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@parent:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@parent:
-@n:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@child:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@Returns:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@Varargs:
-
-
-
-
-
-
-
-@tree_model:
-@iter:
-@var_args:
-
-
-
-
-
-
-
-@model:
-@func:
-@user_data:
-
-
-
-
-
-
-
-@tree_model:
-@path:
-@iter:
-
-
-
-
-
-
-
-@tree_model:
-@path:
-@iter:
-
-
-
-
-
-
-
-@tree_model:
-@path:
-@iter:
-
-
-
-
-
-
-
-@tree_model:
-@path:
-
-
-
-
-
-
-
-@tree_model:
-@path:
-@iter:
-@new_order:
-
-
diff --git a/docs/reference/gtk/tree_widget.sgml b/docs/reference/gtk/tree_widget.sgml
index bdd707d2a0..8a3f096b07 100644
--- a/docs/reference/gtk/tree_widget.sgml
+++ b/docs/reference/gtk/tree_widget.sgml
@@ -2,7 +2,7 @@
-
+
Tree and List Widget Overview
3
diff --git a/docs/reference/gtk/visual_index.xml b/docs/reference/gtk/visual_index.xml
index 7a11071cef..b1e1fe1237 100644
--- a/docs/reference/gtk/visual_index.xml
+++ b/docs/reference/gtk/visual_index.xml
@@ -30,6 +30,9 @@
+
+
+
@@ -123,6 +126,9 @@
+
+
+
diff --git a/docs/reference/gtk/windows.sgml b/docs/reference/gtk/windows.sgml
index f5918a18a4..7b3402e6e2 100644
--- a/docs/reference/gtk/windows.sgml
+++ b/docs/reference/gtk/windows.sgml
@@ -2,7 +2,7 @@
-
+
Using GTK+ on Windows
3
diff --git a/docs/reference/gtk/x11.sgml b/docs/reference/gtk/x11.sgml
index dab177cbcf..0fede1b7fe 100644
--- a/docs/reference/gtk/x11.sgml
+++ b/docs/reference/gtk/x11.sgml
@@ -2,7 +2,7 @@
-
+
Using GTK+ on the X Window System
3
@@ -20,13 +20,13 @@ X11 aspects of using GTK+
GTK+ for the X Window System
-On UNIX, the X backend is the default build for GTK+. So
-you don't need to do anything special when compiling it,
+On UNIX, the X backend is the default build for GTK+.
+So you don't need to do anything special when compiling it,
and everything should "just work."
-To mix low-level Xlib routines into a GTK program,
+To mix low-level Xlib routines into a GTK program,
see GDK X Window
System interaction in the GDK manual.
@@ -35,8 +35,7 @@ System interaction in the GDK manual.
X11-specific commandline options
-The X backend understands some additional command line
-arguments.
+The X backend understands some additional command line arguments.
@@ -44,34 +43,7 @@ arguments.
The name of the X display to open instead of the one specified
-in the DISPLAY environment variable.
-
-
-
-
---screen screen_number
-
-
- The number of the screen within the default display. This overrides
- any screen number specified in the display name specified by
- by he --display command line option or
- the DISPLAY environment variable. If this screen
- cannot be opened, then GTK+ will fall back to the screen
- specified in the display name. This option is not useful
- interactively; the intended purposes is that when a program
- registers its command line with a session
- manager for later restarting, it can save the
- screen it is on, without having to worry if it might be
- restarted on a different display.
-
-
-
-
---sync
-
-
-Makes all X requests synchronously. This is a useful option for
-debugging, but it will slow down the performance considerably.
+in the DISPLAY environment variable.
diff --git a/docs/reference/libgail-util/Makefile.am b/docs/reference/libgail-util/Makefile.am
index cfd0f688d0..8c30e2daf7 100644
--- a/docs/reference/libgail-util/Makefile.am
+++ b/docs/reference/libgail-util/Makefile.am
@@ -1,5 +1,4 @@
## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
AUTOMAKE_OPTIONS = 1.7
@@ -27,10 +26,14 @@ GTKDOC_LIBS = $(top_builddir)/modules/other/gail/libgail-util/libgailutil.la
# gtkdoc-mkdb related varaibles
MKDB_OPTIONS =
-content_files =
+content_files = \
+ version.xml
HTML_IMAGES =
include $(top_srcdir)/gtk-doc.make
+# Other files to distribute
+EXTRA_DIST += version.xml.in
+
-include $(top_srcdir)/git.mk
diff --git a/docs/reference/libgail-util/gail-libgail-util-docs.sgml b/docs/reference/libgail-util/gail-libgail-util-docs.sgml
index e35ae2b1d0..9e71f8aca2 100644
--- a/docs/reference/libgail-util/gail-libgail-util-docs.sgml
+++ b/docs/reference/libgail-util/gail-libgail-util-docs.sgml
@@ -2,6 +2,7 @@
+
]>
diff --git a/docs/reference/libgail-util/version.xml.in b/docs/reference/libgail-util/version.xml.in
new file mode 100644
index 0000000000..3bb59ac105
--- /dev/null
+++ b/docs/reference/libgail-util/version.xml.in
@@ -0,0 +1 @@
+@GTK_VERSION@
diff --git a/docs/tools/Makefile.am b/docs/tools/Makefile.am
index def51f2eef..c4a1c8bfcb 100644
--- a/docs/tools/Makefile.am
+++ b/docs/tools/Makefile.am
@@ -1,22 +1,21 @@
include $(top_srcdir)/Makefile.decl
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_builddir)/gdk \
- -I$(top_srcdir)/gdk \
- -I$(top_srcdir)/gdk/x11 \
- $(GTK_DEBUG_FLAGS) \
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_builddir)/gdk \
+ -I$(top_srcdir)/gdk \
+ -I$(top_srcdir)/gdk/x11 \
+ $(GTK_DEBUG_FLAGS) \
$(GTK_DEP_CFLAGS)
-DEPS = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib)
+DEPS = \
+ $(top_builddir)/gtk/libgtk-3.0.la
-LDADDS = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib) \
- $(GTK_DEP_LIBS) \
- $(GDK_DEP_LIBS) \
+LDADDS = \
+ $(top_builddir)/gtk/libgtk-3.0.la \
+ $(top_builddir)/gdk/libgdk-3.0.la \
+ $(GTK_DEP_LIBS) \
+ $(GDK_DEP_LIBS) \
-lm
if USE_X11
diff --git a/docs/tools/shooter.c b/docs/tools/shooter.c
index f9492f62e1..fa7e8459c2 100644
--- a/docs/tools/shooter.c
+++ b/docs/tools/shooter.c
@@ -138,7 +138,7 @@ take_window_shot (Window child,
else
xid = child;
- window = gdk_window_foreign_new (xid);
+ window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), xid);
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
diff --git a/docs/tools/widgets.c b/docs/tools/widgets.c
index 73081038e6..e847442a88 100644
--- a/docs/tools/widgets.c
+++ b/docs/tools/widgets.c
@@ -1070,6 +1070,39 @@ create_assistant (void)
return info;
}
+static WidgetInfo *
+create_appchooserbutton (void)
+{
+ GtkWidget *picker;
+ GtkWidget *align, *vbox;
+
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
+ align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
+ picker = gtk_app_chooser_button_new ("text/plain");
+ gtk_container_add (GTK_CONTAINER (align), picker);
+ gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox),
+ gtk_label_new ("Application Button"),
+ FALSE, FALSE, 0);
+
+ return new_widget_info ("appchooserbutton", vbox, SMALL);
+}
+
+static WidgetInfo *
+create_appchooserdialog (void)
+{
+ WidgetInfo *info;
+ GtkWidget *widget;
+
+ widget = gtk_app_chooser_dialog_new_for_content_type (NULL, 0, "image/png");
+ gtk_window_set_default_size (GTK_WINDOW (widget), 200, 300);
+
+ info = new_widget_info ("appchooserdialog", widget, ASIS);
+ info->include_decorations = TRUE;
+
+ return info;
+}
+
GList *
get_all_widgets (void)
{
@@ -1117,6 +1150,8 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_print_dialog ());
retval = g_list_prepend (retval, create_volume_button ());
retval = g_list_prepend (retval, create_switch ());
+ retval = g_list_prepend (retval, create_appchooserbutton ());
+ retval = g_list_prepend (retval, create_appchooserdialog ());
return retval;
}
diff --git a/docs/widget_system.txt b/docs/widget_system.txt
index 1c2867cad5..9463f10db9 100644
--- a/docs/widget_system.txt
+++ b/docs/widget_system.txt
@@ -255,7 +255,7 @@ In the following
widget->parent && GTK_WIDGET_MAPPED (widget->parent) &&
GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_CHILD_VISIBLE
- => GTK_WIDGET_MAPPED (widget)
+ <=> GTK_WIDGET_MAPPED (widget)
Note:, the definition
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 0dbef0aa44..440197fd0e 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -45,8 +45,15 @@ INCLUDES = \
$(GTK_DEP_CFLAGS)
LDADD = \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib) \
+ $(top_builddir)/gtk/libgtk-3.0.la \
$(GTK_DEP_LIBS)
-noinst_PROGRAMS = hello-world window-default
+drawing_LDADD = $(LDADD) \
+ $(top_builddir)/gdk/libgdk-3.0.la
+
+noinst_PROGRAMS = \
+ hello-world \
+ window-default \
+ bloatpad \
+ grid-packing \
+ drawing
diff --git a/gtk/tests/gtk-example-application.c b/examples/bloatpad.c
similarity index 100%
rename from gtk/tests/gtk-example-application.c
rename to examples/bloatpad.c
diff --git a/examples/drawing.c b/examples/drawing.c
new file mode 100644
index 0000000000..28f291b8b8
--- /dev/null
+++ b/examples/drawing.c
@@ -0,0 +1,200 @@
+#include
+
+/* Surface to store current scribbles */
+static cairo_surface_t *surface = NULL;
+
+static void
+clear_surface (void)
+{
+ cairo_t *cr;
+
+ cr = cairo_create (surface);
+
+ cairo_set_source_rgb (cr, 1, 1, 1);
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
+}
+
+/* Create a new surface of the appropriate size to store our scribbles */
+static gboolean
+configure_event_cb (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer data)
+{
+ if (surface)
+ cairo_surface_destroy (surface);
+
+ surface = gdk_window_create_similar_surface (gtk_widget_get_window (widget),
+ CAIRO_CONTENT_COLOR,
+ gtk_widget_get_allocated_width (widget),
+ gtk_widget_get_allocated_height (widget));
+
+ /* Initialize the surface to white */
+ clear_surface ();
+
+ /* We've handled the configure event, no need for further processing. */
+ return TRUE;
+}
+
+/* Redraw the screen from the surface. Note that the ::draw
+ * signal receives a ready-to-be-used cairo_t that is already
+ * clipped to only draw the exposed areas of the widget
+ */
+static gboolean
+draw_cb (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer data)
+{
+ cairo_set_source_surface (cr, surface, 0, 0);
+ cairo_paint (cr);
+
+ return FALSE;
+}
+
+/* Draw a rectangle on the surface at the given position */
+static void
+draw_brush (GtkWidget *widget,
+ gdouble x,
+ gdouble y)
+{
+ cairo_t *cr;
+
+ /* Paint to the surface, where we store our state */
+ cr = cairo_create (surface);
+
+ cairo_rectangle (cr, x - 3, y - 3, 6, 6);
+ cairo_fill (cr);
+
+ cairo_destroy (cr);
+
+ /* Now invalidate the affected region of the drawing area. */
+ gtk_widget_queue_draw_area (widget, x - 3, y - 3, 6, 6);
+}
+
+/* Handle button press events by either drawing a rectangle
+ * or clearing the surface, depending on which button was pressed.
+ * The ::button-press signal handler receives a GdkEventButton
+ * struct which contains this information.
+ */
+static gboolean
+button_press_event_cb (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer data)
+{
+ /* paranoia check, in case we haven't gotten a configure event */
+ if (surface == NULL)
+ return FALSE;
+
+ if (event->button == 1)
+ {
+ draw_brush (widget, event->x, event->y);
+ }
+ else if (event->button == 3)
+ {
+ clear_surface ();
+ gtk_widget_queue_draw (widget);
+ }
+
+ /* We've handled the event, stop processing */
+ return TRUE;
+}
+
+/* Handle motion events by continuing to draw if button 1 is
+ * still held down. The ::motion-notify signal handler receives
+ * a GdkEventMotion struct which contains this information.
+ */
+static gboolean
+motion_notify_event_cb (GtkWidget *widget,
+ GdkEventMotion *event,
+ gpointer data)
+{
+ int x, y;
+ GdkModifierType state;
+
+ /* paranoia check, in case we haven't gotten a configure event */
+ if (surface == NULL)
+ return FALSE;
+
+ /* This call is very important; it requests the next motion event.
+ * If you don't call gdk_window_get_pointer() you'll only get
+ * a single motion event. The reason is that we specified
+ * GDK_POINTER_MOTION_HINT_MASK to gtk_widget_set_events().
+ * If we hadn't specified that, we could just use event->x, event->y
+ * as the pointer location. But we'd also get deluged in events.
+ * By requesting the next event as we handle the current one,
+ * we avoid getting a huge number of events faster than we
+ * can cope.
+ */
+ gdk_window_get_pointer (event->window, &x, &y, &state);
+
+ if (state & GDK_BUTTON1_MASK)
+ draw_brush (widget, x, y);
+
+ /* We've handled it, stop processing */
+ return TRUE;
+}
+
+static void
+close_window (void)
+{
+ if (surface)
+ cairo_surface_destroy (surface);
+
+ gtk_main_quit ();
+}
+
+int
+main (int argc,
+ char *argv[])
+{
+ GtkWidget *window;
+ GtkWidget *frame;
+ GtkWidget *da;
+
+ gtk_init (&argc, &argv);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");
+
+ g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
+
+ gtk_container_set_border_width (GTK_CONTAINER (window), 8);
+
+ frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER (window), frame);
+
+ da = gtk_drawing_area_new ();
+ /* set a minimum size */
+ gtk_widget_set_size_request (da, 100, 100);
+
+ gtk_container_add (GTK_CONTAINER (frame), da);
+
+ /* Signals used to handle the backing surface */
+ g_signal_connect (da, "draw",
+ G_CALLBACK (draw_cb), NULL);
+ g_signal_connect (da,"configure-event",
+ G_CALLBACK (configure_event_cb), NULL);
+
+ /* Event signals */
+ g_signal_connect (da, "motion-notify-event",
+ G_CALLBACK (motion_notify_event_cb), NULL);
+ g_signal_connect (da, "button-press-event",
+ G_CALLBACK (button_press_event_cb), NULL);
+
+ /* Ask to receive events the drawing area doesn't normally
+ * subscribe to. In particular, we need to ask for the
+ * button press and motion notify events that want to handle.
+ */
+ gtk_widget_set_events (da, gtk_widget_get_events (da)
+ | GDK_BUTTON_PRESS_MASK
+ | GDK_POINTER_MOTION_MASK
+ | GDK_POINTER_MOTION_HINT_MASK);
+
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/examples/grid-packing.c b/examples/grid-packing.c
new file mode 100644
index 0000000000..9943babac7
--- /dev/null
+++ b/examples/grid-packing.c
@@ -0,0 +1,73 @@
+#include
+
+static void
+print_hello (GtkWidget *widget,
+ gpointer data)
+{
+ g_print ("Hello World\n");
+}
+
+int
+main (int argc,
+ char *argv[])
+{
+ GtkWidget *window;
+ GtkWidget *grid;
+ GtkWidget *button;
+
+ /* This is called in all GTK applications. Arguments are parsed
+ * from the command line and are returned to the application.
+ */
+ gtk_init (&argc, &argv);
+
+ /* create a new window, and set its title */
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title (GTK_WINDOW (window), "Grid");
+ g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+ gtk_container_set_border_width (GTK_CONTAINER (window), 10);
+
+ /* Here we construct the container that is going pack our buttons */
+ grid = gtk_grid_new ();
+
+ /* Pack the container in the window */
+ gtk_container_add (GTK_CONTAINER (window), grid);
+
+ button = gtk_button_new_with_label ("Button 1");
+ g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
+
+ /* Place the first button in the grid cell (0, 0), and make it fill
+ * just 1 cell horizontally and vertically (ie no spanning)
+ */
+ gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1);
+
+ button = gtk_button_new_with_label ("Button 2");
+ g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
+
+ /* Place the second button in the grid cell (1, 0), and make it fill
+ * just 1 cell horizontally and vertically (ie no spanning)
+ */
+ gtk_grid_attach (GTK_GRID (grid), button, 1, 0, 1, 1);
+
+ button = gtk_button_new_with_label ("Quit");
+ g_signal_connect (button, "clicked", G_CALLBACK (gtk_main_quit), NULL);
+
+ /* Place the Quit button in the grid cell (0, 1), and make it
+ * span 2 columns.
+ */
+ gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1);
+
+ /* Now that we are done packing our widgets, we show them all
+ * in one go, by calling gtk_widget_show_all() on the window.
+ * This call recursively calls gtk_widget_show() on all widgets
+ * that are contained in the window, directly or indirectly.
+ */
+ gtk_widget_show_all (window);
+
+ /* All GTK applications must have a gtk_main(). Control ends here
+ * and waits for an event to occur (like a key press or a mouse event),
+ * until gtk_main_quit() is called.
+ */
+ gtk_main ();
+
+ return 0;
+}
diff --git a/examples/gtkdial/dial_test.c b/examples/gtkdial/dial_test.c
index b82c921bec..a0884afdcf 100644
--- a/examples/gtkdial/dial_test.c
+++ b/examples/gtkdial/dial_test.c
@@ -9,7 +9,7 @@ void value_changed( GtkAdjustment *adjustment,
{
char buffer[16];
- sprintf(buffer,"%4.2f",adjustment->value);
+ sprintf(buffer,"%4.2f",gtk_adjustment_get_value (adjustment));
gtk_label_set_text (GTK_LABEL (label), buffer);
}
diff --git a/examples/gtkdial/gtkdial.c b/examples/gtkdial/gtkdial.c
index 39338f67c6..8adb035c46 100644
--- a/examples/gtkdial/gtkdial.c
+++ b/examples/gtkdial/gtkdial.c
@@ -199,9 +199,9 @@ gtk_dial_set_adjustment (GtkDial *dial,
G_CALLBACK (gtk_dial_adjustment_value_changed),
(gpointer) dial);
- dial->old_value = adjustment->value;
- dial->old_lower = adjustment->lower;
- dial->old_upper = adjustment->upper;
+ dial->old_value = gtk_adjustment_get_value (adjustment);
+ dial->old_lower = gtk_adjustment_get_lower (adjustment);
+ dial->old_upper = gtk_adjustment_get_upper (adjustment);
gtk_dial_update (dial);
}
@@ -314,8 +314,8 @@ gtk_dial_expose( GtkWidget *widget,
xc = widget->allocation.width / 2;
yc = widget->allocation.height / 2;
- upper = dial->adjustment->upper;
- lower = dial->adjustment->lower;
+ upper = gtk_adjustment_get_upper (dial->adjustment);
+ lower = gtk_adjustment_get_lower (dial->adjustment);
/* Erase old pointer */
@@ -490,7 +490,7 @@ gtk_dial_button_release( GtkWidget *widget,
g_source_remove (dial->timer);
if ((dial->policy != GTK_UPDATE_CONTINUOUS) &&
- (dial->old_value != dial->adjustment->value))
+ (dial->old_value != gtk_adjustment_get_value (dial->adjustment)))
g_signal_emit_by_name (dial->adjustment, "value_changed");
}
@@ -566,7 +566,7 @@ gtk_dial_update_mouse( GtkDial *dial, gint x, gint y )
xc = GTK_WIDGET(dial)->allocation.width / 2;
yc = GTK_WIDGET(dial)->allocation.height / 2;
- old_value = dial->adjustment->value;
+ old_value = gtk_adjustment_get_value (dial->adjustment);
dial->angle = atan2(yc-y, x-xc);
if (dial->angle < -M_PI/2.)
@@ -578,10 +578,10 @@ gtk_dial_update_mouse( GtkDial *dial, gint x, gint y )
if (dial->angle > 7.*M_PI/6.)
dial->angle = 7.*M_PI/6.;
- dial->adjustment->value = dial->adjustment->lower + (7.*M_PI/6 - dial->angle) *
- (dial->adjustment->upper - dial->adjustment->lower) / (4.*M_PI/3.);
+ gtk_adjustment_get_value (dial->adjustment) = gtk_adjustment_get_lower (dial->adjustment) + (7.*M_PI/6 - dial->angle) *
+ (gtk_adjustment_get_upper (dial->adjustment) - gtk_adjustment_get_lower (dial->adjustment)) / (4.*M_PI/3.);
- if (dial->adjustment->value != old_value)
+ if (gtk_adjustment_get_value (dial->adjustment) != old_value)
{
if (dial->policy == GTK_UPDATE_CONTINUOUS)
{
@@ -612,22 +612,22 @@ gtk_dial_update (GtkDial *dial)
g_return_if_fail (dial != NULL);
g_return_if_fail (GTK_IS_DIAL (dial));
- new_value = dial->adjustment->value;
+ new_value = gtk_adjustment_get_value (dial->adjustment);
- if (new_value < dial->adjustment->lower)
- new_value = dial->adjustment->lower;
+ if (new_value < gtk_adjustment_get_lower (dial->adjustment))
+ new_value = gtk_adjustment_get_lower (dial->adjustment);
- if (new_value > dial->adjustment->upper)
- new_value = dial->adjustment->upper;
+ if (new_value > gtk_adjustment_get_upper (dial->adjustment))
+ new_value = gtk_adjustment_get_upper (dial->adjustment);
- if (new_value != dial->adjustment->value)
+ if (new_value != gtk_adjustment_get_value (dial->adjustment))
{
- dial->adjustment->value = new_value;
+ gtk_adjustment_get_value (dial->adjustment) = new_value;
g_signal_emit_by_name (dial->adjustment, "value_changed");
}
- dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
- (dial->adjustment->upper - dial->adjustment->lower);
+ dial->angle = 7.*M_PI/6. - (new_value - gtk_adjustment_get_lower (dial->adjustment)) * 4.*M_PI/3. /
+ (gtk_adjustment_get_upper (dial->adjustment) - gtk_adjustment_get_lower (dial->adjustment));
gtk_widget_queue_draw (GTK_WIDGET (dial));
}
@@ -643,15 +643,15 @@ gtk_dial_adjustment_changed (GtkAdjustment *adjustment,
dial = GTK_DIAL (data);
- if ((dial->old_value != adjustment->value) ||
- (dial->old_lower != adjustment->lower) ||
- (dial->old_upper != adjustment->upper))
+ if ((dial->old_value != gtk_adjustment_get_value (adjustment)) ||
+ (dial->old_lower != gtk_adjustment_get_lower (adjustment)) ||
+ (dial->old_upper != gtk_adjustment_get_upper (adjustment)))
{
gtk_dial_update (dial);
- dial->old_value = adjustment->value;
- dial->old_lower = adjustment->lower;
- dial->old_upper = adjustment->upper;
+ dial->old_value = gtk_adjustment_get_value (adjustment);
+ dial->old_lower = gtk_adjustment_get_lower (adjustment);
+ dial->old_upper = gtk_adjustment_get_upper (adjustment);
}
}
@@ -666,10 +666,10 @@ gtk_dial_adjustment_value_changed (GtkAdjustment *adjustment,
dial = GTK_DIAL (data);
- if (dial->old_value != adjustment->value)
+ if (dial->old_value != gtk_adjustment_get_value (adjustment))
{
gtk_dial_update (dial);
- dial->old_value = adjustment->value;
+ dial->old_value = gtk_adjustment_get_value (adjustment);
}
}
diff --git a/examples/hello-world.c b/examples/hello-world.c
index 50c792f12f..204b46eb4d 100644
--- a/examples/hello-world.c
+++ b/examples/hello-world.c
@@ -1,7 +1,8 @@
#include
/* This is a callback function. The data arguments are ignored
- * in this example. More on callbacks below. */
+ * in this example. More on callbacks below.
+ */
static void
print_hello (GtkWidget *widget,
gpointer data)
diff --git a/gdk-3.0-uninstalled.pc.in b/gdk-3.0-uninstalled.pc.in
deleted file mode 100644
index 45adcf0f06..0000000000
--- a/gdk-3.0-uninstalled.pc.in
+++ /dev/null
@@ -1,8 +0,0 @@
-target=@gdktarget@
-
-Name: GDK Uninstalled
-Description: GTK+ Drawing Kit (${target} target), Not Installed
-Version: @VERSION@
-Requires: gdk-pixbuf-@GTK_API_VERSION@-uninstalled @GDK_PACKAGES@
-Libs: ${pc_top_builddir}/${pcfiledir}/gdk/libgdk-${target}-@GTK_API_VERSION@.la @GDK_EXTRA_LIBS@
-Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@/gdk -I${pc_top_builddir}/${pcfiledir}/@srcdir@ -I${pc_top_builddir}/${pcfiledir} @GDK_EXTRA_CFLAGS@
diff --git a/gdk-3.0.pc.in b/gdk-3.0.pc.in
index fe21977748..5c7d27e51b 100644
--- a/gdk-3.0.pc.in
+++ b/gdk-3.0.pc.in
@@ -2,11 +2,11 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
-target=@gdktarget@
+targets=@GDK_BACKENDS@
Name: GDK
-Description: GTK+ Drawing Kit (${target} target)
+Description: GTK+ Drawing Kit
Version: @VERSION@
Requires: @GDK_PACKAGES@
-Libs: -L${libdir} -lgdk-${target}-@GTK_API_VERSION@ @GDK_EXTRA_LIBS@
-Cflags: -I${includedir}/gtk-@GTK_API_VERSION@ -I${libdir}/gtk-@GTK_API_VERSION@/include @GDK_EXTRA_CFLAGS@ -DGSEAL_ENABLE
+Libs: -L${libdir} -lgdk-@GTK_API_VERSION@ @GDK_EXTRA_LIBS@
+Cflags: -I${includedir}/gtk-@GTK_API_VERSION@ @GDK_EXTRA_CFLAGS@
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index eadfc81fe5..90b4520cd8 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -3,23 +3,26 @@ include $(top_srcdir)/Makefile.decl
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = \
- --add-include-path=../gdk
+ --add-include-path=../gdk \
+ --warn-all
INTROSPECTION_COMPILER_ARGS = \
--includedir=$(srcdir) \
--includedir=.
-SUBDIRS = $(gdktarget) . tests
+SUBDIRS = $(GDK_BACKENDS) . tests
+
DIST_SUBDIRS = win32 x11 quartz broadway tests
CLEANFILES =
-EXTRA_DIST += \
+EXTRA_DIST += \
keynames.txt \
keyname-table.h \
+ gdkkeynames.c \
gen-keyname-table.pl \
- gdkconfig.h.win32 \
+ gdkconfig.h.win32 \
gdkkeysyms-update.pl \
- gdk.def \
+ gdk.def \
gdkmarshalers.list \
gdkwindowimpl.h \
makeenums.pl \
@@ -29,16 +32,15 @@ EXTRA_DIST += \
gdkenumtypes.h.template \
abicheck.sh
-INCLUDES = \
+INCLUDES = \
-DG_LOG_DOMAIN=\"Gdk\" \
-DGDK_COMPILATION \
-I$(top_srcdir) \
+ -I$(top_builddir) \
-I$(top_builddir)/gdk \
- $(GTK_DEBUG_FLAGS) \
+ $(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS)
-gtarget=$(gdktarget)
-
if PLATFORM_WIN32
no_undefined = -no-undefined
endif
@@ -46,12 +48,12 @@ endif
# libtool stuff: set version and export symbols for resolving
# since automake doesn't support conditionalized libsomething_la_LDFLAGS
# we use the general approach here
-LDADD = \
- $(GTK_LINK_FLAGS) \
- -version-info $(LT_VERSION_INFO) \
- -export-dynamic \
- -rpath $(libdir) \
- $(no_undefined) \
+LDADD = \
+ $(GTK_LINK_FLAGS) \
+ -version-info $(LT_VERSION_INFO) \
+ -export-dynamic \
+ -rpath $(libdir) \
+ $(no_undefined) \
$(LIBTOOL_EXPORT_OPTIONS)
#
@@ -60,7 +62,7 @@ LDADD = \
#
# GDK header files for public installation (non-generated)
#
-gdk_public_h_sources = \
+gdk_public_h_sources = \
gdk.h \
gdkapplaunchcontext.h \
gdkcairo.h \
@@ -72,7 +74,6 @@ gdk_public_h_sources = \
gdkdisplaymanager.h \
gdkdnd.h \
gdkevents.h \
- gdkinput.h \
gdkkeys.h \
gdkkeysyms.h \
gdkkeysyms-compat.h \
@@ -85,49 +86,58 @@ gdk_public_h_sources = \
gdkrgba.h \
gdkscreen.h \
gdkselection.h \
- gdkspawn.h \
gdktestutils.h \
gdkthreads.h \
gdktypes.h \
gdkvisual.h \
gdkwindow.h
-gdk_built_public_sources = \
+gdk_built_public_sources = \
+ gdkconfig.h \
gdkenumtypes.h
-gdk_private_headers = \
- gdkinternals.h \
+gdk_private_headers = \
+ gdkapplaunchcontextprivate.h \
+ gdkcursorprivate.h \
+ gdkdevicemanagerprivate.h \
gdkdeviceprivate.h \
+ gdkdisplaymanagerprivate.h \
+ gdkdisplayprivate.h \
+ gdkdndprivate.h \
+ gdkscreenprivate.h \
+ gdkinternals.h \
gdkintl.h \
- gdkpoly-generic.h
+ gdkkeysprivate.h \
+ gdkvisualprivate.h \
+ gdkx.h
-gdk_c_sources = \
- gdk.c \
- gdkapplaunchcontext.c \
- gdkcairo.c \
- gdkcolor.c \
- gdkcursor.c \
- gdkdevice.c \
- gdkdevicemanager.c \
- gdkdisplay.c \
- gdkdisplaymanager.c \
- gdkdnd.c \
- gdkevents.c \
- gdkglobals.c \
- gdkkeys.c \
- gdkkeyuni.c \
- gdkoffscreenwindow.c \
- gdkpango.c \
- gdkpixbuf-drawable.c \
- gdkrectangle.c \
- gdkrgba.c \
- gdkscreen.c \
- gdkselection.c \
- gdkvisual.c \
- gdkwindow.c \
+gdk_c_sources = \
+ gdk.c \
+ gdkapplaunchcontext.c \
+ gdkcairo.c \
+ gdkcolor.c \
+ gdkcursor.c \
+ gdkdevice.c \
+ gdkdevicemanager.c \
+ gdkdisplay.c \
+ gdkdisplaymanager.c \
+ gdkdnd.c \
+ gdkevents.c \
+ gdkglobals.c \
+ gdkkeys.c \
+ gdkkeyuni.c \
+ gdkoffscreenwindow.c \
+ gdkpango.c \
+ gdkpixbuf-drawable.c \
+ gdkrectangle.c \
+ gdkrgba.c \
+ gdkscreen.c \
+ gdkselection.c \
+ gdkvisual.c \
+ gdkwindow.c \
gdkwindowimpl.c
-gdk_built_sources = \
+gdk_built_sources = \
gdkenumtypes.c \
gdkmarshalers.h \
gdkmarshalers.c \
@@ -147,22 +157,28 @@ common_sources = \
gdkmarshalers.c \
gdkmarshalers.h
-libgdk_broadway_3_0_la_SOURCES = $(common_sources)
-libgdk_broadway_3_0_la_LIBADD = broadway/libgdk-broadway.la $(GDK_DEP_LIBS)
-libgdk_broadway_3_0_la_LDFLAGS = $(LDADD)
+libgdk_3_0_la_SOURCES = $(common_sources)
+libgdk_3_0_la_LIBADD = $(GDK_DEP_LIBS)
+libgdk_3_0_la_LDFLAGS = $(LDADD)
-libgdk_x11_3_0_la_SOURCES = $(common_sources)
-libgdk_x11_3_0_la_LIBADD = x11/libgdk-x11.la $(GDK_DEP_LIBS)
-libgdk_x11_3_0_la_LDFLAGS = $(LDADD)
+if USE_X11
+libgdk_3_0_la_LIBADD += x11/libgdk-x11.la
+endif # USE_X11
-libgdk_quartz_3_0_la_SOURCES = $(common_sources) gdkkeynames.c
-libgdk_quartz_3_0_la_LIBADD = quartz/libgdk-quartz.la $(GDK_DEP_LIBS)
-libgdk_quartz_3_0_la_LDFLAGS = $(LDADD)
+if USE_QUARTZ
+libgdk_3_0_la_LIBADD += quartz/libgdk-quartz.la
+endif # USE_QUARTZ
-libgdk_win32_3_0_la_SOURCES = $(common_sources) gdkkeynames.c
-libgdk_win32_3_0_la_LIBADD = win32/libgdk-win32.la $(GDK_DEP_LIBS)
-libgdk_win32_3_0_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o gdk.def
-libgdk_win32_3_0_la_LDFLAGS = -Wl,win32/rc/gdk-win32-res.o -export-symbols $(srcdir)/gdk.def $(LDADD)
+if USE_WIN32
+libgdk_3_0_la_SOURCES += gdkkeynames.c
+libgdk_3_0_la_LIBADD += win32/libgdk-win32.la
+libgdk_3_0_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o gdk.def
+libgdk_3_0_la_LDFLAGS += -Wl,win32/rc/gdk-win32-res.o -export-symbols $(srcdir)/gdk.def
+endif # USE_WIN32
+
+if USE_BROADWAY
+libgdk_3_0_la_LIBADD += broadway/libgdk-broadway.la
+endif # USE_BROADWAY
if HAVE_INTROSPECTION
@@ -172,12 +188,14 @@ introspection_files = \
gdkenumtypes.c \
gdkenumtypes.h
-Gdk-3.0.gir: $(gdktargetlib) Makefile
-Gdk_3_0_gir_SCANNERFLAGS = --warn-all
+Gdk-3.0.gir: libgdk-3.0.la Makefile
+Gdk_3_0_gir_SCANNERFLAGS = \
+ --c-include="gdk/gdk.h"
Gdk_3_0_gir_INCLUDES = Gio-2.0 GdkPixbuf-2.0 Pango-1.0 cairo-1.0
-Gdk_3_0_gir_LIBS = $(gdktargetlib)
+Gdk_3_0_gir_LIBS = libgdk-3.0.la
Gdk_3_0_gir_FILES = $(introspection_files)
Gdk_3_0_gir_CFLAGS = $(INCLUDES)
+Gdk_3_0_gir_EXPORT_PACKAGES = gdk-3.0
INTROSPECTION_GIRS += Gdk-3.0.gir
if USE_X11
@@ -186,11 +204,11 @@ x11_introspection_files = \
x11/gdkapplaunchcontext-x11.c \
x11/gdkasync.c \
x11/gdkcursor-x11.c \
- x11/gdkdevice-core.c \
- x11/gdkdevicemanager-core.c \
+ x11/gdkdevice-core-x11.c \
+ x11/gdkdevicemanager-core-x11.c \
x11/gdkdevicemanager-x11.c \
- x11/gdkdevicemanager-xi2.c \
x11/gdkdevicemanager-xi.c \
+ x11/gdkdevicemanager-xi2.c \
x11/gdkdevice-xi2.c \
x11/gdkdevice-xi.c \
x11/gdkdisplay-x11.c \
@@ -198,16 +216,12 @@ x11_introspection_files = \
x11/gdkeventsource.c \
x11/gdkeventtranslator.c \
x11/gdkgeometry-x11.c \
- x11/gdkglobals-x11.c \
- x11/gdkim-x11.c \
- x11/gdkinput.c \
x11/gdkkeys-x11.c \
x11/gdkmain-x11.c \
x11/gdkproperty-x11.c \
x11/gdkscreen-x11.c \
x11/gdkselection-x11.c \
x11/gdksettings.c \
- x11/gdkspawn-x11.c \
x11/gdktestutils-x11.c \
x11/gdkvisual-x11.c \
x11/gdkwindow-x11.c \
@@ -215,18 +229,28 @@ x11_introspection_files = \
x11/gdkxid.c \
x11/xsettings-client.c \
x11/xsettings-common.c \
- x11/gdkx.h
+ x11/gdkx.h \
+ x11/gdkx11cursor.h \
+ x11/gdkx11display.h \
+ x11/gdkx11property.h \
+ x11/gdkx11screen.h \
+ x11/gdkx11selection.h \
+ x11/gdkx11utils.h \
+ x11/gdkx11visual.h \
+ x11/gdkx11window.h
-GdkX11-3.0.gir: $(gdktargetlib) Gdk-3.0.gir Makefile
-GdkX11_3_0_gir_SCANNERFLAGS = --warn-all --strip-prefix=Gdk
+GdkX11-3.0.gir: libgdk-3.0.la Gdk-3.0.gir Makefile
+GdkX11_3_0_gir_SCANNERFLAGS = \
+ --strip-prefix=Gdk \
+ --c-include="gdk/gdkx.h" \
+ --include-uninstalled=$(top_builddir)/gdk/Gdk-3.0.gir
GdkX11_3_0_gir_INCLUDES = Gio-2.0 Gdk-3.0 GdkPixbuf-2.0 Pango-1.0 xlib-2.0
-GdkX11_3_0_gir_LIBS = $(gdktargetlib)
+GdkX11_3_0_gir_LIBS = libgdk-3.0.la
GdkX11_3_0_gir_FILES = $(x11_introspection_files)
GdkX11_3_0_gir_CFLAGS = $(INCLUDES) -L$(top_builddir)/gdk
+GdkX11_3_0_gir_EXPORT_PACKAGES = gdk-x11-3.0
INTROSPECTION_GIRS += GdkX11-3.0.gir
-introspection_files += $(filter-out x11/gdkx.h, $(x11_introspection_files))
-
endif # USE_X11
girdir = $(datadir)/gir-1.0
@@ -270,37 +294,22 @@ endif
# This places the generated .def file in srcdir, since it is expected to be there.
# (The one from a tarball is)
gdk.def: gdk.symbols
- (echo -e EXPORTS; $(CPP) -P -DGDK_WINDOWING_WIN32 - <$(srcdir)/gdk.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gdk.def
+ $(AM_V_GEN) (echo -e EXPORTS; $(CPP) -P -DGDK_WINDOWING_WIN32 - <$(srcdir)/gdk.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gdk.def
TESTS_ENVIRONMENT = srcdir="$(srcdir)"
if OS_LINUX
TESTS = abicheck.sh
endif
-
-lib_LTLIBRARIES = $(gdktargetlib)
-
-EXTRA_LTLIBRARIES = libgdk-broadway-3.0.la libgdk-x11-3.0.la libgdk-win32-3.0.la libgdk-quartz-3.0.la
+lib_LTLIBRARIES = libgdk-3.0.la
MAINTAINERCLEANFILES = $(gdk_built_sources) stamp-gdkenumtypes.h
EXTRA_DIST += $(gdk_built_sources)
EXTRA_HEADERS =
-#
-# Rule to install gdkconfig.h header file
-#
-configexecincludedir = $(libdir)/gtk-3.0/include
-#configexecinclude_DATA = gdkconfig.h
-
-install-exec-local: gdkconfig.h
- $(mkinstalldirs) $(DESTDIR)$(configexecincludedir)
- file=$(DESTDIR)$(configexecincludedir)/gdkconfig.h; \
- if test -r $$file && cmp -s gdkconfig.h $$file; then :; \
- else $(INSTALL_DATA) gdkconfig.h $$file; fi
-
install-exec-hook:
if DISABLE_EXPLICIT_DEPS
- $(SHELL) $(top_srcdir)/sanitize-la.sh $(DESTDIR)$(libdir)/$(gdktargetlib)
+ $(SHELL) $(top_srcdir)/sanitize-la.sh $(DESTDIR)$(libdir)/libgdk-3.0.la
endif
#note: not gdkconfig.h
@@ -311,40 +320,40 @@ BUILT_SOURCES = \
gdkenumtypes.h: stamp-gdkenumtypes.h
@true
stamp-gdkenumtypes.h: @REBUILD@ $(gdk_public_h_sources) gdkenumtypes.h.template
- ( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.h.template \
+ $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.h.template \
$(gdk_public_h_sources) ) >> xgen-geth \
&& (cmp -s xgen-geth gdkenumtypes.h || cp xgen-geth gdkenumtypes.h ) \
&& rm -f xgen-geth \
&& echo timestamp > $(@F)
gdkenumtypes.c: @REBUILD@ $(gdk_public_h_sources) gdkenumtypes.c.template
- ( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.c.template \
+ $(AM_V_GEN) ( cd $(srcdir) && $(GLIB_MKENUMS) --template gdkenumtypes.c.template \
$(gdk_public_h_sources) ) > xgen-getc \
&& cp xgen-getc gdkenumtypes.c \
&& rm -f xgen-getc
-#
+#
# Marshaller generation
#
gdkmarshalers.h: @REBUILD@ gdkmarshalers.list
- $(GLIB_GENMARSHAL) --prefix=_gdk_marshal $(srcdir)/gdkmarshalers.list --header > gdkmarshalers-h.tmp \
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gdk_marshal $(srcdir)/gdkmarshalers.list --header > gdkmarshalers-h.tmp \
&& mv gdkmarshalers-h.tmp gdkmarshalers.h \
|| ( rm -f gdkmarshalers-h.tmp && exit 1)
gdkmarshalers.c: @REBUILD@ gdkmarshalers.list
- $(GLIB_GENMARSHAL) --prefix=_gdk_marshal $(srcdir)/gdkmarshalers.list --body > gdkmarshalers-c.tmp \
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=_gdk_marshal $(srcdir)/gdkmarshalers.list --body > gdkmarshalers-c.tmp \
&& mv gdkmarshalers-c.tmp gdkmarshalers.c \
|| ( rm -f gdkmarshalers-c.tmp && exit 1 )
gdkconfig.h: stamp-gc-h
- @if test -f gdkconfig.h; then :; \
+ $(AM_V_GEN) if test -f gdkconfig.h; then :; \
else rm -f stamp-gc-h; $(MAKE) stamp-gc-h; fi
stamp-gc-h: $(top_builddir)/config.status
- cd $(top_builddir) && $(SHELL) ./config.status gdk/gdkconfig.h
+ $(AM_V_at) cd $(top_builddir) && $(SHELL) ./config.status gdk/gdkconfig.h
echo timestamp > stamp-gc-h
dist-hook: ../build/win32/vs9/gdk.vcproj
../build/win32/vs9/gdk.vcproj: ../build/win32/vs9/gdk.vcprojin
- for F in $(libgdk_win32_3_0_la_SOURCES); do \
+ for F in $(libgdk_3_0_la_SOURCES); do \
case $$F in \
*.c) echo ' ' \
;; \
diff --git a/gdk/abicheck.sh b/gdk/abicheck.sh
index a33eef8e59..2bfefafcfa 100755
--- a/gdk/abicheck.sh
+++ b/gdk/abicheck.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-cpp -P -DGDK_ENABLE_BROKEN -include ../config.h -include ./gdkconfig.h ${srcdir:-.}/gdk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' | sort | uniq > expected-abi
-nm -D -g --defined-only .libs/libgdk-x11-3.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
+cpp -P -DGDK_WINDOWING_X11 ${srcdir:-.}/gdk.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' | sort | uniq > expected-abi
+nm -D -g --defined-only .libs/libgdk-3.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
diff -u expected-abi actual-abi && rm -f expected-abi actual-abi
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 003ad34847..6bb7f8deea 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -48,6 +48,48 @@
* utility functions.
*/
+/**
+ * GDK_WINDOWING_X11:
+ *
+ * The #GDK_WINDOWING_X11 macro is defined if the X11 backend
+ * is supported.
+ *
+ * Use this macro to guard code that is specific to the X11-backend.
+ * Since GDK may be configured with multiple backends, an additional
+ * runtime check for the used backend is recommended:
+ *
+ * |[
+ * #ifdef GDK_WINDOWING_X11
+ * if (GDK_IS_X11_DISPLAY (display))
+ * {
+ * /* make X11-specific calls here */
+ * }
+ * else
+ * #endif
+ * #ifdef GDK_WINDOWING_QUARTZ
+ * if (GDK_IS_QUARTZ_DISPLAY (display))
+ * {
+ * /* make Quartz-specific calls here &ast/
+ * }
+ * else
+ * #endif
+ * g_error ("Unsupported GDK backend");
+ * ]|
+ */
+
+/**
+ * GDK_WINDOWING_WIN32:
+ *
+ * The #GDK_WINDOWING_WIN32 macro is defined if the Win32 backend
+ * is supported.
+ */
+
+/**
+ * GDK_WINDOWING_QUARTZ:
+ *
+ * The #GDK_WINDOWING_QUARTZ macro is defined if the Quartz backend
+ * is supported.
+ */
typedef struct _GdkPredicate GdkPredicate;
@@ -69,9 +111,9 @@ struct _GdkThreadsDispatch
/* Private variable declarations
*/
-static int gdk_initialized = 0; /* 1 if the library is initialized,
- * 0 otherwise.
- */
+static int gdk_initialized = 0; /* 1 if the library is initialized,
+ * 0 otherwise.
+ */
static gchar *gdk_progclass = NULL;
@@ -82,37 +124,32 @@ static GCallback gdk_threads_unlock = NULL;
#ifdef G_ENABLE_DEBUG
static const GDebugKey gdk_debug_keys[] = {
- {"events", GDK_DEBUG_EVENTS},
- {"misc", GDK_DEBUG_MISC},
- {"dnd", GDK_DEBUG_DND},
- {"xim", GDK_DEBUG_XIM},
+ {"events", GDK_DEBUG_EVENTS},
+ {"misc", GDK_DEBUG_MISC},
+ {"dnd", GDK_DEBUG_DND},
+ {"xim", GDK_DEBUG_XIM},
{"nograbs", GDK_DEBUG_NOGRABS},
- {"colormap", GDK_DEBUG_COLORMAP},
- {"input", GDK_DEBUG_INPUT},
- {"cursor", GDK_DEBUG_CURSOR},
- {"multihead", GDK_DEBUG_MULTIHEAD},
- {"xinerama", GDK_DEBUG_XINERAMA},
- {"draw", GDK_DEBUG_DRAW},
- {"eventloop", GDK_DEBUG_EVENTLOOP}
+ {"colormap", GDK_DEBUG_COLORMAP},
+ {"input", GDK_DEBUG_INPUT},
+ {"cursor", GDK_DEBUG_CURSOR},
+ {"multihead", GDK_DEBUG_MULTIHEAD},
+ {"xinerama", GDK_DEBUG_XINERAMA},
+ {"draw", GDK_DEBUG_DRAW},
+ {"eventloop", GDK_DEBUG_EVENTLOOP}
};
-static const int gdk_ndebug_keys = G_N_ELEMENTS (gdk_debug_keys);
-
-#endif /* G_ENABLE_DEBUG */
-
-#ifdef G_ENABLE_DEBUG
static gboolean
gdk_arg_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
guint debug_value = g_parse_debug_string (value,
- (GDebugKey *) gdk_debug_keys,
- gdk_ndebug_keys);
+ (GDebugKey *) gdk_debug_keys,
+ G_N_ELEMENTS (gdk_debug_keys));
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{
- g_set_error (error,
- G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
- _("Error parsing option --gdk-debug"));
+ g_set_error (error,
+ G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+ _("Error parsing option --gdk-debug"));
return FALSE;
}
@@ -125,14 +162,14 @@ static gboolean
gdk_arg_no_debug_cb (const char *key, const char *value, gpointer user_data, GError **error)
{
guint debug_value = g_parse_debug_string (value,
- (GDebugKey *) gdk_debug_keys,
- gdk_ndebug_keys);
+ (GDebugKey *) gdk_debug_keys,
+ G_N_ELEMENTS (gdk_debug_keys));
if (debug_value == 0 && value != NULL && strcmp (value, "") != 0)
{
- g_set_error (error,
- G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
- _("Error parsing option --gdk-no-debug"));
+ g_set_error (error,
+ G_OPTION_ERROR, G_OPTION_ERROR_FAILED,
+ _("Error parsing option --gdk-no-debug"));
return FALSE;
}
@@ -168,9 +205,6 @@ static const GOptionEntry gdk_args[] = {
{ "display", 0, G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &_gdk_display_name,
/* Description of --display=DISPLAY in --help output */ N_("X display to use"),
/* Placeholder in --display=DISPLAY in --help output */ N_("DISPLAY") },
- { "screen", 0, 0, G_OPTION_ARG_INT, &_gdk_screen_number,
- /* Description of --screen=SCREEN in --help output */ N_("X screen to use"),
- /* Placeholder in --screen=SCREEN in --help output */ N_("SCREEN") },
#ifdef G_ENABLE_DEBUG
{ "gdk-debug", 0, 0, G_OPTION_ARG_CALLBACK, gdk_arg_debug_cb,
/* Description of --gdk-debug=FLAGS in --help output */ N_("GDK debugging flags to set"),
@@ -185,15 +219,14 @@ static const GOptionEntry gdk_args[] = {
/**
* gdk_add_option_entries_libgtk_only:
* @group: An option group.
- *
+ *
* Appends gdk option entries to the passed in option group. This is
* not public API and must not be used by applications.
- **/
+ */
void
gdk_add_option_entries_libgtk_only (GOptionGroup *group)
{
g_option_group_add_entries (group, gdk_args);
- g_option_group_add_entries (group, _gdk_windowing_args);
}
void
@@ -213,24 +246,22 @@ gdk_pre_parse_libgtk_only (void)
gchar *debug_string = getenv("GDK_DEBUG");
if (debug_string != NULL)
_gdk_debug_flags = g_parse_debug_string (debug_string,
- (GDebugKey *) gdk_debug_keys,
- gdk_ndebug_keys);
+ (GDebugKey *) gdk_debug_keys,
+ G_N_ELEMENTS (gdk_debug_keys));
}
-#endif /* G_ENABLE_DEBUG */
+#endif /* G_ENABLE_DEBUG */
if (getenv ("GDK_NATIVE_WINDOWS"))
{
_gdk_native_windows = TRUE;
- /* Ensure that this is not propagated
- to spawned applications */
+ /* Ensure that this is not propagated to spawned applications */
g_unsetenv ("GDK_NATIVE_WINDOWS");
}
g_type_init ();
- /* Do any setup particular to the windowing system
- */
- _gdk_windowing_init ();
+ /* Do any setup particular to the windowing system */
+ gdk_display_manager_get ();
}
@@ -252,7 +283,7 @@ gdk_pre_parse_libgtk_only (void)
**/
void
gdk_parse_args (int *argc,
- char ***argv)
+ char ***argv)
{
GOptionContext *option_context;
GOptionGroup *option_group;
@@ -262,15 +293,14 @@ gdk_parse_args (int *argc,
return;
gdk_pre_parse_libgtk_only ();
-
+
option_context = g_option_context_new (NULL);
g_option_context_set_ignore_unknown_options (option_context, TRUE);
g_option_context_set_help_enabled (option_context, FALSE);
option_group = g_option_group_new (NULL, NULL, NULL, NULL, NULL);
g_option_context_set_main_group (option_context, option_group);
-
+
g_option_group_add_entries (option_group, gdk_args);
- g_option_group_add_entries (option_group, _gdk_windowing_args);
if (!g_option_context_parse (option_context, argc, argv, &error))
{
@@ -282,7 +312,7 @@ gdk_parse_args (int *argc,
GDK_NOTE (MISC, g_message ("progname: \"%s\"", g_get_prgname ()));
}
-/**
+/**
* gdk_get_display_arg_name:
*
* Gets the display name specified in the command line arguments passed
@@ -297,25 +327,20 @@ G_CONST_RETURN gchar *
gdk_get_display_arg_name (void)
{
if (!_gdk_display_arg_name)
- {
- if (_gdk_screen_number >= 0)
- _gdk_display_arg_name = _gdk_windowing_substitute_screen_number (_gdk_display_name, _gdk_screen_number);
- else
- _gdk_display_arg_name = g_strdup (_gdk_display_name);
- }
+ _gdk_display_arg_name = g_strdup (_gdk_display_name);
return _gdk_display_arg_name;
}
/**
* gdk_display_open_default_libgtk_only:
- *
+ *
* Opens the default display specified by command line arguments or
* environment variables, sets it as the default display, and returns
* it. gdk_parse_args must have been called first. If the default
* display has previously been set, simply returns that. An internal
* function that should not be used by applications.
- *
+ *
* Return value: (transfer none): the default display, if it could be
* opened, otherwise %NULL.
**/
@@ -325,25 +350,13 @@ gdk_display_open_default_libgtk_only (void)
GdkDisplay *display;
g_return_val_if_fail (gdk_initialized, NULL);
-
+
display = gdk_display_get_default ();
if (display)
return display;
display = gdk_display_open (gdk_get_display_arg_name ());
- if (!display && _gdk_screen_number >= 0)
- {
- g_free (_gdk_display_arg_name);
- _gdk_display_arg_name = g_strdup (_gdk_display_name);
-
- display = gdk_display_open (_gdk_display_name);
- }
-
- if (display)
- gdk_display_manager_set_default_display (gdk_display_manager_get (),
- display);
-
return display;
}
@@ -352,20 +365,20 @@ gdk_display_open_default_libgtk_only (void)
* @argc: (inout): the number of command line arguments.
* @argv: (array length=argc) (inout): the array of command line arguments.
*
- * Initializes the GDK library and connects to the X server, returning %TRUE on
- * success.
+ * Initializes the GDK library and connects to the windowing system,
+ * returning %TRUE on success.
*
- * Any arguments used by GDK are removed from the array and @argc and @argv are
- * updated accordingly.
+ * Any arguments used by GDK are removed from the array and @argc and @argv
+ * are updated accordingly.
*
- * GTK+ initializes GDK in gtk_init() and so this function is not usually needed
- * by GTK+ applications.
+ * GTK+ initializes GDK in gtk_init() and so this function is not usually
+ * needed by GTK+ applications.
*
* Returns: %TRUE if initialization succeeded.
*/
gboolean
gdk_init_check (int *argc,
- char ***argv)
+ char ***argv)
{
gdk_parse_args (argc, argv);
@@ -378,15 +391,15 @@ gdk_init_check (int *argc,
* @argc: (inout): the number of command line arguments.
* @argv: (array length=argc) (inout): the array of command line arguments.
*
- * Initializes the GDK library and connects to the X server.
+ * Initializes the GDK library and connects to the windowing system.
* If initialization fails, a warning message is output and the application
* terminates with a call to exit(1) .
*
- * Any arguments used by GDK are removed from the array and @argc and @argv are
- * updated accordingly.
+ * Any arguments used by GDK are removed from the array and @argc and @argv
+ * are updated accordingly.
*
- * GTK+ initializes GDK in gtk_init() and so this function is not usually needed
- * by GTK+ applications.
+ * GTK+ initializes GDK in gtk_init() and so this function is not usually
+ * needed by GTK+ applications.
*/
void
gdk_init (int *argc, char ***argv)
@@ -549,28 +562,28 @@ gdk_init (int *argc, char ***argv)
* say_something = (yes_or_no != data->what);
*
* if(say_something)
- * {
- * /* set the variable */
- * yes_or_no = data->what;
- * }
+ * {
+ * /* set the variable */
+ * yes_or_no = data->what;
+ * }
*
* /* Unlock the yes_or_no variable */
* G_UNLOCK (yes_or_no);
*
* if (say_something)
- * {
- * /* get GTK thread lock */
- * gdk_threads_enter ();
+ * {
+ * /* get GTK thread lock */
+ * gdk_threads_enter ();
*
- * /* set label text */
- * if(data->what == YES_IT_IS)
- * gtk_label_set_text (GTK_LABEL (data->label), "O yes, it is!");
- * else
- * gtk_label_set_text (GTK_LABEL (data->label), "O no, it isn't!");
+ * /* set label text */
+ * if(data->what == YES_IT_IS)
+ * gtk_label_set_text (GTK_LABEL (data->label), "O yes, it is!");
+ * else
+ * gtk_label_set_text (GTK_LABEL (data->label), "O no, it isn't!");
*
- * /* release GTK thread lock */
- * gdk_threads_leave ();
- * }
+ * /* release GTK thread lock */
+ * gdk_threads_leave ();
+ * }
* }
*
* return NULL;
@@ -724,10 +737,10 @@ gdk_threads_init (void)
**/
void
gdk_threads_set_lock_functions (GCallback enter_fn,
- GCallback leave_fn)
+ GCallback leave_fn)
{
g_return_if_fail (gdk_threads_lock == NULL &&
- gdk_threads_unlock == NULL);
+ gdk_threads_unlock == NULL);
gdk_threads_lock = enter_fn;
gdk_threads_unlock = leave_fn;
@@ -764,7 +777,7 @@ gdk_threads_dispatch_free (gpointer data)
/**
* gdk_threads_add_idle_full:
* @priority: the priority of the idle source. Typically this will be in the
- * range btweeen #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE
+ * range between #G_PRIORITY_DEFAULT_IDLE and #G_PRIORITY_HIGH_IDLE
* @function: function to call
* @data: data to pass to @function
* @notify: (allow-none): function to call when the idle is removed, or %NULL
@@ -817,9 +830,9 @@ gdk_threads_dispatch_free (gpointer data)
*/
guint
gdk_threads_add_idle_full (gint priority,
- GSourceFunc function,
- gpointer data,
- GDestroyNotify notify)
+ GSourceFunc function,
+ gpointer data,
+ GDestroyNotify notify)
{
GdkThreadsDispatch *dispatch;
@@ -852,7 +865,7 @@ gdk_threads_add_idle_full (gint priority,
*/
guint
gdk_threads_add_idle (GSourceFunc function,
- gpointer data)
+ gpointer data)
{
return gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE,
function, data, NULL);
@@ -973,9 +986,9 @@ gdk_threads_add_timeout (guint interval,
* @interval: the time between calls to the function, in seconds
* @function: function to call
* @data: data to pass to @function
- * @notify: (allow-none): function to call when the timeout is removed, or %NULL
+ * @notify: (allow-none): function to call when the timeout is removed, or %NULL
*
- * A variant of gdk_threads_add_timout_full() with second-granularity.
+ * A variant of gdk_threads_add_timeout_full() with second-granularity.
* See g_timeout_add_seconds_full() for a discussion of why it is
* a good idea to use this function if you don't need finer granularity.
*
@@ -1063,24 +1076,24 @@ gdk_set_program_class (const char *program_class)
}
/**
- * gdk_enable_multidevice:
+ * gdk_disable_multidevice:
*
- * Enables multidevice support in GDK. This call must happen prior
+ * Disables multidevice support in GDK. This call must happen prior
* to gdk_display_open(), gtk_init(), gtk_init_with_args() or
* gtk_init_check() in order to take effect.
*
- * Note that individual #GdkWindows still need to explicitly
- * enable multidevice awareness through gdk_window_set_support_multidevice().
- *
- * This function must be called before initializing GDK.
+ * Most common GTK+ applications won't ever need to call this. Only
+ * applications that do mixed GDK/Xlib calls could want to disable
+ * multidevice support if such Xlib code deals with input devices in
+ * any way and doesn't observe the presence of XInput 2.
*
* Since: 3.0
- **/
+ */
void
-gdk_enable_multidevice (void)
+gdk_disable_multidevice (void)
{
if (gdk_initialized)
return;
- _gdk_enable_multidevice = TRUE;
+ _gdk_disable_multidevice = TRUE;
}
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 851185a8c0..2b849695d6 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -29,6 +29,7 @@
#define __GDK_H_INSIDE__
+#include
#include
#include
#include
@@ -40,7 +41,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -51,7 +51,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index f884f6011f..9fb4b63149 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -50,7 +50,6 @@ gdk_device_get_associated_device
gdk_device_get_axis
gdk_device_get_axis_use
gdk_device_get_axis_value
-gdk_device_get_core_pointer
gdk_device_get_device_type
gdk_device_get_display
gdk_device_get_has_cursor
@@ -60,38 +59,37 @@ gdk_device_get_mode
gdk_device_get_name
gdk_device_get_n_axes
gdk_device_get_n_keys
+gdk_device_get_position
gdk_device_get_source
gdk_device_get_state
gdk_device_get_type G_GNUC_CONST
+gdk_device_get_window_at_position
gdk_device_grab
gdk_device_grab_info_libgtk_only
gdk_device_list_axes
-gdk_device_manager_core_get_type
+gdk_device_list_slave_devices
gdk_device_manager_get_client_pointer
gdk_device_manager_get_display
gdk_device_manager_get_type G_GNUC_CONST
gdk_device_manager_list_devices
-gdk_device_manager_xi2_get_type
-gdk_device_manager_xi_get_type
gdk_device_set_axis_use
gdk_device_set_key
gdk_device_set_mode
-gdk_device_set_source
-gdk_devices_list
gdk_device_type_get_type G_GNUC_CONST
gdk_device_ungrab
+gdk_device_warp
+gdk_disable_multidevice
gdk_display_add_client_message_filter
gdk_display_beep
gdk_display_close
gdk_display_device_is_grabbed
gdk_display_flush
-gdk_display_get_core_pointer
+gdk_display_get_app_launch_context
gdk_display_get_default
gdk_display_get_default_cursor_size
gdk_display_get_default_group
gdk_display_get_default_screen
gdk_display_get_device_manager
-gdk_display_get_device_state
gdk_display_get_event
gdk_display_get_maximal_cursor_size
gdk_display_get_name
@@ -99,8 +97,8 @@ gdk_display_get_n_screens
gdk_display_get_pointer
gdk_display_get_screen
gdk_display_get_type G_GNUC_CONST
-gdk_display_get_window_at_device_position
gdk_display_get_window_at_pointer
+gdk_display_has_pending
gdk_display_is_closed
gdk_display_keyboard_ungrab
gdk_display_list_devices
@@ -108,7 +106,9 @@ gdk_display_manager_get
gdk_display_manager_get_default_display
gdk_display_manager_get_type G_GNUC_CONST
gdk_display_manager_list_displays
+gdk_display_manager_open_display
gdk_display_manager_set_default_display
+gdk_display_notify_startup_complete
gdk_display_open
gdk_display_open_default_libgtk_only
gdk_display_peek_event
@@ -116,10 +116,8 @@ gdk_display_pointer_is_grabbed
gdk_display_pointer_ungrab
gdk_display_put_event
gdk_display_request_selection_notification
-gdk_display_set_device_hooks
gdk_display_set_double_click_distance
gdk_display_set_double_click_time
-gdk_display_set_pointer_hooks
gdk_display_store_clipboard
gdk_display_supports_clipboard_persistence
gdk_display_supports_composite
@@ -129,25 +127,24 @@ gdk_display_supports_input_shapes
gdk_display_supports_selection_notification
gdk_display_supports_shapes
gdk_display_sync
-gdk_display_warp_device
gdk_display_warp_pointer
gdk_drag_abort
gdk_drag_action_get_type G_GNUC_CONST
gdk_drag_begin
+gdk_drag_begin_for_device
gdk_drag_context_get_actions
+gdk_drag_context_get_dest_window
gdk_drag_context_get_device
+gdk_drag_context_get_protocol
gdk_drag_context_get_selected_action
gdk_drag_context_get_source_window
gdk_drag_context_get_suggested_action
gdk_drag_context_get_type G_GNUC_CONST
gdk_drag_context_list_targets
-gdk_drag_context_new
gdk_drag_context_set_device
gdk_drag_drop
gdk_drag_drop_succeeded
-gdk_drag_find_window
gdk_drag_find_window_for_screen
-gdk_drag_get_protocol
gdk_drag_get_protocol_for_display
gdk_drag_get_selection
gdk_drag_motion
@@ -155,7 +152,6 @@ gdk_drag_protocol_get_type G_GNUC_CONST
gdk_drag_status
gdk_drop_finish
gdk_drop_reply
-gdk_enable_multidevice
gdk_error_trap_pop
gdk_error_trap_pop_ignored
gdk_error_trap_push
@@ -167,6 +163,7 @@ gdk_event_get_coords
gdk_event_get_device
gdk_event_get_root_coords
gdk_event_get_screen
+gdk_event_get_source_device
gdk_event_get_state
gdk_event_get_time
gdk_event_get_type G_GNUC_CONST
@@ -181,20 +178,15 @@ gdk_event_send_client_message_for_display
gdk_event_send_clientmessage_toall
gdk_event_set_device
gdk_event_set_screen
+gdk_event_set_source_device
gdk_events_get_angle
gdk_events_get_center
gdk_events_get_distance
gdk_events_pending
-gdk_event_translator_get_handled_events
-gdk_event_translator_get_type G_GNUC_CONST
-gdk_event_translator_select_window_events
-gdk_event_translator_translate
gdk_event_type_get_type G_GNUC_CONST
gdk_extension_mode_get_type G_GNUC_CONST
gdk_filter_return_get_type G_GNUC_CONST
gdk_flush
-gdk_free_compound_text
-gdk_free_text_list
gdk_get_default_root_window
gdk_get_display
gdk_get_display_arg_name
@@ -206,7 +198,6 @@ gdk_gravity_get_type G_GNUC_CONST
gdk_init
gdk_init_check
gdk_input_mode_get_type G_GNUC_CONST
-gdk_input_set_extension_events
gdk_input_source_get_type G_GNUC_CONST
gdk_keyboard_grab
gdk_keyboard_ungrab
@@ -233,7 +224,6 @@ gdk_keyval_to_unicode G_GNUC_CONST
gdk_keyval_to_upper G_GNUC_CONST
gdk_list_visuals
gdk_modifier_type_get_type G_GNUC_CONST
-gdk_net_wm_supports
gdk_notify_startup_complete
gdk_notify_startup_complete_with_id
gdk_notify_type_get_type G_GNUC_CONST
@@ -315,26 +305,15 @@ gdk_selection_property_get
gdk_selection_send_notify
gdk_selection_send_notify_for_display
gdk_set_double_click_time
-gdk_set_locale
-gdk_set_pointer_hooks
gdk_set_program_class
gdk_set_show_events
-gdk_set_sm_client_id
gdk_setting_action_get_type G_GNUC_CONST
gdk_setting_get
-gdk_spawn_command_line_on_screen
-gdk_spawn_on_screen
-gdk_spawn_on_screen_with_pipes
gdk_status_get_type G_GNUC_CONST
-gdk_string_to_compound_text
-gdk_string_to_compound_text_for_display
gdk_synthesize_window_state
gdk_test_render_sync
gdk_test_simulate_button
gdk_test_simulate_key
-gdk_text_property_to_text_list
-gdk_text_property_to_text_list_for_display
-gdk_text_property_to_utf8_list
gdk_text_property_to_utf8_list_for_display
gdk_threads_add_idle
gdk_threads_add_idle_full
@@ -347,8 +326,6 @@ gdk_threads_init
gdk_threads_leave
gdk_threads_set_lock_functions
gdk_unicode_to_keyval G_GNUC_CONST
-gdk_utf8_to_compound_text
-gdk_utf8_to_compound_text_for_display
gdk_utf8_to_string_target
gdk_visibility_state_get_type G_GNUC_CONST
gdk_visual_get_best
@@ -370,13 +347,16 @@ gdk_visual_get_type G_GNUC_CONST
gdk_visual_get_visual_type
gdk_visual_type_get_type G_GNUC_CONST
#ifdef GDK_WINDOWING_WIN32
-gdk_win32_drawable_get_handle
gdk_win32_handle_table_lookup
gdk_win32_icon_to_pixbuf_libgtk_only
gdk_win32_pixbuf_to_hicon_libgtk_only
gdk_win32_selection_add_targets
gdk_win32_set_modal_dialog_libgtk_only
gdk_win32_window_is_win32
+gdk_win32_window_get_handle
+gdk_win32_display_get_type
+gdk_win32_window_foreign_new_for_display
+gdk_win32_window_lookup_for_display
#endif
gdk_window_add_filter
gdk_window_at_pointer
@@ -386,7 +366,7 @@ gdk_window_begin_move_drag
gdk_window_begin_paint_rect
gdk_window_begin_paint_region
gdk_window_begin_resize_drag
-gdk_window_class_class_get_type G_GNUC_CONST
+gdk_window_window_class_get_type G_GNUC_CONST
gdk_window_configure_finished
gdk_window_constrain_size
gdk_window_coords_from_parent
@@ -401,8 +381,6 @@ gdk_window_end_paint
gdk_window_ensure_native
gdk_window_flush
gdk_window_focus
-gdk_window_foreign_new
-gdk_window_foreign_new_for_display
gdk_window_freeze_toplevel_updates_libgtk_only
gdk_window_freeze_updates
gdk_window_fullscreen
@@ -434,6 +412,7 @@ gdk_window_get_position
gdk_window_get_root_coords
gdk_window_get_root_origin
gdk_window_get_screen
+gdk_window_get_source_events
gdk_window_get_state
gdk_window_get_support_multidevice
gdk_window_get_toplevel
@@ -450,7 +429,9 @@ gdk_window_hide
gdk_window_hints_get_type G_GNUC_CONST
gdk_window_iconify
gdk_window_impl_get_type G_GNUC_CONST
+#ifdef GDK_WINDOWING_X11
gdk_window_impl_x11_get_type G_GNUC_CONST
+#endif
gdk_window_input_shape_combine_region
gdk_window_invalidate_maybe_recurse
gdk_window_invalidate_rect
@@ -460,8 +441,6 @@ gdk_window_is_input_only
gdk_window_is_shaped
gdk_window_is_viewable
gdk_window_is_visible
-gdk_window_lookup
-gdk_window_lookup_for_display
gdk_window_lower
gdk_window_maximize
gdk_window_merge_child_input_shapes
@@ -507,6 +486,7 @@ gdk_window_set_override_redirect
gdk_window_set_role
gdk_window_set_skip_pager_hint
gdk_window_set_skip_taskbar_hint
+gdk_window_set_source_events
gdk_window_set_startup_id
gdk_window_set_static_gravities
gdk_window_set_support_multidevice
@@ -530,21 +510,38 @@ gdk_window_unstick
gdk_window_withdraw
gdk_wm_decoration_get_type G_GNUC_CONST
gdk_wm_function_get_type G_GNUC_CONST
+#ifdef GDK_WINDOWING_X11
+gdk_x11_app_launch_context_get_type
gdk_x11_atom_to_xatom
gdk_x11_atom_to_xatom_for_display
+gdk_x11_cursor_get_type
gdk_x11_cursor_get_xcursor
gdk_x11_cursor_get_xdisplay
+gdk_x11_device_core_get_type
+gdk_x11_device_manager_core_get_type
+gdk_x11_device_manager_xi2_get_type
+gdk_x11_device_manager_xi_get_type
+gdk_x11_device_xi2_get_type
+gdk_x11_device_xi_get_type
gdk_x11_display_broadcast_startup_message
gdk_x11_display_error_trap_pop
gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_error_trap_push
gdk_x11_display_get_startup_notification_id
+gdk_x11_display_get_type
gdk_x11_display_get_user_time
gdk_x11_display_get_xdisplay
gdk_x11_display_grab
+gdk_x11_display_manager_get_type
gdk_x11_display_set_cursor_theme
gdk_x11_display_set_startup_notification_id
+gdk_x11_display_string_to_compound_text
+gdk_x11_display_text_property_to_text_list
gdk_x11_display_ungrab
+gdk_x11_display_utf8_to_compound_text
+gdk_x11_drag_context_get_type
+gdk_x11_free_compound_text
+gdk_x11_free_text_list
gdk_x11_get_default_root_xwindow
gdk_x11_get_default_screen
gdk_x11_get_default_xdisplay
@@ -554,21 +551,26 @@ gdk_x11_get_xatom_by_name_for_display
gdk_x11_get_xatom_name
gdk_x11_get_xatom_name_for_display
gdk_x11_grab_server
+gdk_x11_keymap_get_type
gdk_x11_lookup_xdisplay
gdk_x11_register_standard_event_type
gdk_x11_screen_get_monitor_output
gdk_x11_screen_get_screen_number
+gdk_x11_screen_get_type
gdk_x11_screen_get_window_manager_name
gdk_x11_screen_get_xscreen
gdk_x11_screen_lookup_visual
gdk_x11_screen_supports_net_wm_hint
+gdk_x11_set_sm_client_id
gdk_x11_ungrab_server
+gdk_x11_visual_get_type
gdk_x11_visual_get_xvisual
+gdk_x11_window_foreign_new_for_display
+gdk_x11_window_lookup_for_display
+gdk_x11_window_get_type
gdk_x11_window_get_xid
gdk_x11_window_move_to_current_desktop
gdk_x11_window_set_user_time
gdk_x11_xatom_to_atom
gdk_x11_xatom_to_atom_for_display
-gdk_xid_table_lookup
-gdk_xid_table_lookup_for_display
-gdkx_visual_get
+#endif
diff --git a/gdk/gdkapplaunchcontext.c b/gdk/gdkapplaunchcontext.c
index 1bd4dbbf29..5f9aa249c5 100644
--- a/gdk/gdkapplaunchcontext.c
+++ b/gdk/gdkapplaunchcontext.c
@@ -22,9 +22,7 @@
#include "config.h"
-#include "gdkapplaunchcontext.h"
-
-#include "gdkinternals.h"
+#include "gdkapplaunchcontextprivate.h"
#include "gdkscreen.h"
#include "gdkintl.h"
@@ -43,9 +41,9 @@
*
* GdkAppLaunchContext *context;
*
- * context = gdk_app_launch_context_new ();
+ * context = gdk_display_get_app_launch_context (display);
*
- * gdk_app_launch_context_set_screen (my_screen);
+ * gdk_app_launch_context_set_screen (screen);
* gdk_app_launch_context_set_timestamp (event->time);
*
* if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))
@@ -61,10 +59,56 @@ static void gdk_app_launch_context_finalize (GObject *object);
static gchar * gdk_app_launch_context_get_display (GAppLaunchContext *context,
GAppInfo *info,
GList *files);
+static gchar * gdk_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
+ GAppInfo *info,
+ GList *files);
+static void gdk_app_launch_context_launch_failed (GAppLaunchContext *context,
+ const gchar *startup_notify_id);
-G_DEFINE_TYPE (GdkAppLaunchContext, gdk_app_launch_context,
- G_TYPE_APP_LAUNCH_CONTEXT)
+enum
+{
+ PROP_0,
+ PROP_DISPLAY
+};
+
+G_DEFINE_TYPE (GdkAppLaunchContext, gdk_app_launch_context, G_TYPE_APP_LAUNCH_CONTEXT)
+
+static void
+gdk_app_launch_context_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GdkAppLaunchContext *context = GDK_APP_LAUNCH_CONTEXT (object);
+
+ switch (prop_id)
+ {
+ case PROP_DISPLAY:
+ g_value_set_object (value, context->display);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+gdk_app_launch_context_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GdkAppLaunchContext *context = GDK_APP_LAUNCH_CONTEXT (object);
+
+ switch (prop_id)
+ {
+ case PROP_DISPLAY:
+ context->display = g_value_dup_object (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
static void
gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
@@ -72,44 +116,42 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GAppLaunchContextClass *context_class = G_APP_LAUNCH_CONTEXT_CLASS (klass);
+ gobject_class->set_property = gdk_app_launch_context_set_property,
+ gobject_class->get_property = gdk_app_launch_context_get_property;
+
gobject_class->finalize = gdk_app_launch_context_finalize;
context_class->get_display = gdk_app_launch_context_get_display;
- context_class->get_startup_notify_id = _gdk_windowing_get_startup_notify_id;
- context_class->launch_failed = _gdk_windowing_launch_failed;
+ context_class->get_startup_notify_id = gdk_app_launch_context_get_startup_notify_id;
+ context_class->launch_failed = gdk_app_launch_context_launch_failed;
- g_type_class_add_private (klass, sizeof (GdkAppLaunchContextPrivate));
+ g_object_class_install_property (gobject_class, PROP_DISPLAY,
+ g_param_spec_object ("display", P_("Display"), P_("Display"),
+ GDK_TYPE_DISPLAY,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
static void
gdk_app_launch_context_init (GdkAppLaunchContext *context)
{
- context->priv = G_TYPE_INSTANCE_GET_PRIVATE (context,
- GDK_TYPE_APP_LAUNCH_CONTEXT,
- GdkAppLaunchContextPrivate);
- context->priv->workspace = -1;
+ context->workspace = -1;
}
static void
gdk_app_launch_context_finalize (GObject *object)
{
- GdkAppLaunchContext *context;
- GdkAppLaunchContextPrivate *priv;
+ GdkAppLaunchContext *context = GDK_APP_LAUNCH_CONTEXT (object);
- context = GDK_APP_LAUNCH_CONTEXT (object);
+ if (context->display)
+ g_object_unref (context->display);
- priv = context->priv;
+ if (context->screen)
+ g_object_unref (context->screen);
- if (priv->display)
- g_object_unref (priv->display);
+ if (context->icon)
+ g_object_unref (context->icon);
- if (priv->screen)
- g_object_unref (priv->screen);
-
- if (priv->icon)
- g_object_unref (priv->icon);
-
- g_free (priv->icon_name);
+ g_free (context->icon_name);
G_OBJECT_CLASS (gdk_app_launch_context_parent_class)->finalize (object);
}
@@ -119,16 +161,14 @@ gdk_app_launch_context_get_display (GAppLaunchContext *context,
GAppInfo *info,
GList *files)
{
+ GdkAppLaunchContext *ctx = GDK_APP_LAUNCH_CONTEXT (context);
GdkDisplay *display;
- GdkAppLaunchContextPrivate *priv;
- priv = GDK_APP_LAUNCH_CONTEXT (context)->priv;
+ if (ctx->screen)
+ return gdk_screen_make_display_name (ctx->screen);
- if (priv->screen)
- return gdk_screen_make_display_name (priv->screen);
-
- if (priv->display)
- display = priv->display;
+ if (ctx->display)
+ display = ctx->display;
else
display = gdk_display_get_default ();
@@ -144,22 +184,17 @@ gdk_app_launch_context_get_display (GAppLaunchContext *context,
* using this context. See also gdk_app_launch_context_set_screen().
*
* Since: 2.14
+ *
+ * Deprecated: 3.0: Use gdk_display_get_app_launch_context() instead
*/
void
gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
- GdkDisplay *display)
+ GdkDisplay *display)
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
g_return_if_fail (display == NULL || GDK_IS_DISPLAY (display));
- if (context->priv->display)
- {
- g_object_unref (context->priv->display);
- context->priv->display = NULL;
- }
-
- if (display)
- context->priv->display = g_object_ref (display);
+ g_warn_if_fail (display == NULL || display == context->display);
}
/**
@@ -178,19 +213,21 @@ gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
*/
void
gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
- GdkScreen *screen)
+ GdkScreen *screen)
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
g_return_if_fail (screen == NULL || GDK_IS_SCREEN (screen));
- if (context->priv->screen)
+ g_return_if_fail (screen == NULL || gdk_screen_get_display (screen) == context->display);
+
+ if (context->screen)
{
- g_object_unref (context->priv->screen);
- context->priv->screen = NULL;
+ g_object_unref (context->screen);
+ context->screen = NULL;
}
if (screen)
- context->priv->screen = g_object_ref (screen);
+ context->screen = g_object_ref (screen);
}
/**
@@ -199,12 +236,12 @@ gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
* @desktop: the number of a workspace, or -1
*
* Sets the workspace on which applications will be launched when
- * using this context when running under a window manager that
- * supports multiple workspaces, as described in the
- * Extended
- * Window Manager Hints .
+ * using this context when running under a window manager that
+ * supports multiple workspaces, as described in the
+ * Extended
+ * Window Manager Hints .
*
- * When the workspace is not specified or @desktop is set to -1,
+ * When the workspace is not specified or @desktop is set to -1,
* it is up to the window manager to pick one, typically it will
* be the current workspace.
*
@@ -212,11 +249,11 @@ gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
*/
void
gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
- gint desktop)
+ gint desktop)
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
- context->priv->workspace = desktop;
+ context->workspace = desktop;
}
/**
@@ -225,7 +262,7 @@ gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
* @timestamp: a timestamp
*
* Sets the timestamp of @context. The timestamp should ideally
- * be taken from the event that triggered the launch.
+ * be taken from the event that triggered the launch.
*
* Window managers can use this information to avoid moving the
* focus to the newly launched application when the user is busy
@@ -236,11 +273,11 @@ gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
*/
void
gdk_app_launch_context_set_timestamp (GdkAppLaunchContext *context,
- guint32 timestamp)
+ guint32 timestamp)
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
- context->priv->timestamp = timestamp;
+ context->timestamp = timestamp;
}
/**
@@ -265,14 +302,14 @@ gdk_app_launch_context_set_icon (GdkAppLaunchContext *context,
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
g_return_if_fail (icon == NULL || G_IS_ICON (icon));
- if (context->priv->icon)
+ if (context->icon)
{
- g_object_unref (context->priv->icon);
- context->priv->icon = NULL;
+ g_object_unref (context->icon);
+ context->icon = NULL;
}
if (icon)
- context->priv->icon = g_object_ref (icon);
+ context->icon = g_object_ref (icon);
}
/**
@@ -280,25 +317,25 @@ gdk_app_launch_context_set_icon (GdkAppLaunchContext *context,
* @context: a #GdkAppLaunchContext
* @icon_name: (allow-none): an icon name, or %NULL
*
- * Sets the icon for applications that are launched with this context.
- * The @icon_name will be interpreted in the same way as the Icon field
- * in desktop files. See also gdk_app_launch_context_set_icon().
+ * Sets the icon for applications that are launched with this context.
+ * The @icon_name will be interpreted in the same way as the Icon field
+ * in desktop files. See also gdk_app_launch_context_set_icon().
*
* If both @icon and @icon_name are set, the @icon_name takes priority.
- * If neither @icon or @icon_name is set, the icon is taken from either
- * the file that is passed to launched application or from the #GAppInfo
+ * If neither @icon or @icon_name is set, the icon is taken from either
+ * the file that is passed to launched application or from the #GAppInfo
* for the launched application itself.
- *
+ *
* Since: 2.14
*/
void
gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
- const char *icon_name)
+ const char *icon_name)
{
g_return_if_fail (GDK_IS_APP_LAUNCH_CONTEXT (context));
- g_free (context->priv->icon_name);
- context->priv->icon_name = g_strdup (icon_name);
+ g_free (context->icon_name);
+ context->icon_name = g_strdup (icon_name);
}
/**
@@ -309,9 +346,25 @@ gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
* Returns: a new #GdkAppLaunchContext
*
* Since: 2.14
+ *
+ * Deprecated: 3.0: Use gdk_display_get_app_launch_context() instead
*/
GdkAppLaunchContext *
gdk_app_launch_context_new (void)
{
- return g_object_new (GDK_TYPE_APP_LAUNCH_CONTEXT, NULL);
+ return gdk_display_get_app_launch_context (gdk_display_get_default ());
+}
+
+static char *
+gdk_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
+ GAppInfo *info,
+ GList *files)
+{
+ return NULL;
+}
+
+static void
+gdk_app_launch_context_launch_failed (GAppLaunchContext *context,
+ const gchar *startup_notify_id)
+{
}
diff --git a/gdk/gdkapplaunchcontext.h b/gdk/gdkapplaunchcontext.h
index cb53025c46..96aeeba967 100644
--- a/gdk/gdkapplaunchcontext.h
+++ b/gdk/gdkapplaunchcontext.h
@@ -28,48 +28,33 @@
#define __GDK_APP_LAUNCH_CONTEXT_H__
#include
+#include
#include
G_BEGIN_DECLS
#define GDK_TYPE_APP_LAUNCH_CONTEXT (gdk_app_launch_context_get_type ())
#define GDK_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContext))
-#define GDK_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContextClass))
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
-#define GDK_IS_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDK_TYPE_APP_LAUNCH_CONTEXT))
-#define GDK_APP_LAUNCH_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContextClass))
-typedef struct GdkAppLaunchContext GdkAppLaunchContext;
-typedef struct GdkAppLaunchContextClass GdkAppLaunchContextClass;
-typedef struct GdkAppLaunchContextPrivate GdkAppLaunchContextPrivate;
-
-struct GdkAppLaunchContext
-{
- GAppLaunchContext parent_instance;
-
- GdkAppLaunchContextPrivate *priv;
-};
-
-struct GdkAppLaunchContextClass
-{
- GAppLaunchContextClass parent_class;
-};
GType gdk_app_launch_context_get_type (void);
+#ifndef GDK_DISABLE_DEPRECATED
GdkAppLaunchContext *gdk_app_launch_context_new (void);
void gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
- GdkDisplay *display);
+ GdkDisplay *display);
+#endif
void gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
- GdkScreen *screen);
+ GdkScreen *screen);
void gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,
- gint desktop);
+ gint desktop);
void gdk_app_launch_context_set_timestamp (GdkAppLaunchContext *context,
- guint32 timestamp);
+ guint32 timestamp);
void gdk_app_launch_context_set_icon (GdkAppLaunchContext *context,
- GIcon *icon);
+ GIcon *icon);
void gdk_app_launch_context_set_icon_name (GdkAppLaunchContext *context,
- const char *icon_name);
+ const char *icon_name);
G_END_DECLS
diff --git a/gdk/gdkapplaunchcontextprivate.h b/gdk/gdkapplaunchcontextprivate.h
new file mode 100644
index 0000000000..2ae0f2a30e
--- /dev/null
+++ b/gdk/gdkapplaunchcontextprivate.h
@@ -0,0 +1,50 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_APP_LAUNCH_CONTEXT_PRIVATE_H__
+#define __GDK_APP_LAUNCH_CONTEXT_PRIVATE_H__
+
+#include
+#include "gdkapplaunchcontext.h"
+#include "gdktypes.h"
+
+G_BEGIN_DECLS
+
+#define GDK_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContextClass))
+#define GDK_IS_APP_LAUNCH_CONTEXT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GDK_TYPE_APP_LAUNCH_CONTEXT))
+#define GDK_APP_LAUNCH_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContextClass))
+
+
+typedef GAppLaunchContextClass GdkAppLaunchContextClass;
+
+struct _GdkAppLaunchContext
+{
+ GAppLaunchContext parent_instance;
+
+ GdkDisplay *display;
+ GdkScreen *screen;
+ gint workspace;
+ guint32 timestamp;
+ GIcon *icon;
+ char *icon_name;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c
index 475e96fbff..1418b1bd0a 100644
--- a/gdk/gdkcursor.c
+++ b/gdk/gdkcursor.c
@@ -27,8 +27,9 @@
#include "config.h"
#include "gdkcursor.h"
-
-#include "gdkdisplay.h"
+#include "gdkcursorprivate.h"
+#include "gdkdisplayprivate.h"
+#include "gdkintl.h"
#include "gdkinternals.h"
@@ -53,28 +54,112 @@
* #GdkWindowAttr struct passed to gdk_window_new().
*/
+/**
+ * GdkCursor:
+ *
+ * The #GdkCursor structure represents a cursor. Its contents are private.
+ */
-G_DEFINE_BOXED_TYPE (GdkCursor, gdk_cursor,
- gdk_cursor_ref,
- gdk_cursor_unref)
+enum {
+ PROP_0,
+ PROP_CURSOR_TYPE,
+ PROP_DISPLAY
+};
+
+G_DEFINE_ABSTRACT_TYPE (GdkCursor, gdk_cursor, G_TYPE_OBJECT)
+
+static void
+gdk_cursor_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GdkCursor *cursor = GDK_CURSOR (object);
+
+ switch (prop_id)
+ {
+ case PROP_CURSOR_TYPE:
+ g_value_set_enum (value, cursor->type);
+ break;
+ case PROP_DISPLAY:
+ g_value_set_object (value, cursor->display);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gdk_cursor_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GdkCursor *cursor = GDK_CURSOR (object);
+
+ switch (prop_id)
+ {
+ case PROP_CURSOR_TYPE:
+ cursor->type = g_value_get_enum (value);
+ break;
+ case PROP_DISPLAY:
+ cursor->display = g_value_get_object (value);
+ /* check that implementations actually provide the display when constructing */
+ g_assert (cursor->display != NULL);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gdk_cursor_class_init (GdkCursorClass *cursor_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (cursor_class);
+
+ object_class->get_property = gdk_cursor_get_property;
+ object_class->set_property = gdk_cursor_set_property;
+
+ g_object_class_install_property (object_class,
+ PROP_CURSOR_TYPE,
+ g_param_spec_enum ("cursor-type",
+ P_("Cursor type"),
+ P_("Standard cursor type"),
+ GDK_TYPE_CURSOR_TYPE, GDK_X_CURSOR,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ g_object_class_install_property (object_class,
+ PROP_DISPLAY,
+ g_param_spec_object ("display",
+ P_("Display"),
+ P_("Display of this cursor"),
+ GDK_TYPE_DISPLAY,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+}
+
+static void
+gdk_cursor_init (GdkCursor *cursor)
+{
+}
/**
* gdk_cursor_ref:
* @cursor: a #GdkCursor
- *
+ *
* Adds a reference to @cursor.
- *
+ *
* Return value: Same @cursor that was passed in
- **/
+ *
+ * Deprecated: 3.0: Use g_object_ref() instead
+ */
GdkCursor*
gdk_cursor_ref (GdkCursor *cursor)
{
g_return_val_if_fail (cursor != NULL, NULL);
- g_return_val_if_fail (cursor->ref_count > 0, NULL);
- cursor->ref_count += 1;
-
- return cursor;
+ return g_object_ref (cursor);
}
/**
@@ -83,31 +168,28 @@ gdk_cursor_ref (GdkCursor *cursor)
*
* Removes a reference from @cursor, deallocating the cursor
* if no references remain.
- *
- **/
+ *
+ * Deprecated: 3.0: Use g_object_unref() instead
+ */
void
gdk_cursor_unref (GdkCursor *cursor)
{
g_return_if_fail (cursor != NULL);
- g_return_if_fail (cursor->ref_count > 0);
- cursor->ref_count -= 1;
-
- if (cursor->ref_count == 0)
- _gdk_cursor_destroy (cursor);
+ g_object_unref (cursor);
}
/**
* gdk_cursor_new:
* @cursor_type: cursor to create
- *
+ *
* Creates a new cursor from the set of builtin cursors for the default display.
* See gdk_cursor_new_for_display().
*
* To make the cursor invisible, use %GDK_BLANK_CURSOR.
- *
+ *
* Return value: a new #GdkCursor
- **/
+ */
GdkCursor*
gdk_cursor_new (GdkCursorType cursor_type)
{
@@ -131,3 +213,185 @@ gdk_cursor_get_cursor_type (GdkCursor *cursor)
return cursor->type;
}
+
+/**
+ * gdk_cursor_new_for_display:
+ * @display: the #GdkDisplay for which the cursor will be created
+ * @cursor_type: cursor to create
+ *
+ * Creates a new cursor from the set of builtin cursors.
+ * Some useful ones are:
+ *
+ *
+ * #GDK_RIGHT_PTR (right-facing arrow)
+ *
+ *
+ * #GDK_CROSSHAIR (crosshair)
+ *
+ *
+ * #GDK_XTERM (I-beam)
+ *
+ *
+ * #GDK_WATCH (busy)
+ *
+ *
+ * #GDK_FLEUR (for moving objects)
+ *
+ *
+ * #GDK_HAND1 (a right-pointing hand)
+ *
+ *
+ * #GDK_HAND2 (a left-pointing hand)
+ *
+ *
+ * #GDK_LEFT_SIDE (resize left side)
+ *
+ *
+ * #GDK_RIGHT_SIDE (resize right side)
+ *
+ *
+ * #GDK_TOP_LEFT_CORNER (resize northwest corner)
+ *
+ *
+ * #GDK_TOP_RIGHT_CORNER (resize northeast corner)
+ *
+ *
+ * #GDK_BOTTOM_LEFT_CORNER (resize southwest corner)
+ *
+ *
+ * #GDK_BOTTOM_RIGHT_CORNER (resize southeast corner)
+ *
+ *
+ * #GDK_TOP_SIDE (resize top side)
+ *
+ *
+ * #GDK_BOTTOM_SIDE (resize bottom side)
+ *
+ *
+ * #GDK_SB_H_DOUBLE_ARROW (move vertical splitter)
+ *
+ *
+ * #GDK_SB_V_DOUBLE_ARROW (move horizontal splitter)
+ *
+ *
+ * #GDK_BLANK_CURSOR (Blank cursor). Since 2.16
+ *
+ *
+ *
+ * Return value: a new #GdkCursor
+ *
+ * Since: 2.2
+ **/
+GdkCursor*
+gdk_cursor_new_for_display (GdkDisplay *display,
+ GdkCursorType cursor_type)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+
+ return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_type (display, cursor_type);
+}
+
+/**
+ * gdk_cursor_new_from_name:
+ * @display: the #GdkDisplay for which the cursor will be created
+ * @name: the name of the cursor
+ *
+ * Creates a new cursor by looking up @name in the current cursor
+ * theme.
+ *
+ * Returns: a new #GdkCursor, or %NULL if there is no cursor with
+ * the given name
+ *
+ * Since: 2.8
+ */
+GdkCursor*
+gdk_cursor_new_from_name (GdkDisplay *display,
+ const gchar *name)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+
+ return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_name (display, name);
+}
+
+/**
+ * gdk_cursor_new_from_pixbuf:
+ * @display: the #GdkDisplay for which the cursor will be created
+ * @pixbuf: the #GdkPixbuf containing the cursor image
+ * @x: the horizontal offset of the 'hotspot' of the cursor.
+ * @y: the vertical offset of the 'hotspot' of the cursor.
+ *
+ * Creates a new cursor from a pixbuf.
+ *
+ * Not all GDK backends support RGBA cursors. If they are not
+ * supported, a monochrome approximation will be displayed.
+ * The functions gdk_display_supports_cursor_alpha() and
+ * gdk_display_supports_cursor_color() can be used to determine
+ * whether RGBA cursors are supported;
+ * gdk_display_get_default_cursor_size() and
+ * gdk_display_get_maximal_cursor_size() give information about
+ * cursor sizes.
+ *
+ * If @x or @y are -1 , the pixbuf must have
+ * options named "x_hot" and "y_hot", resp., containing
+ * integer values between %0 and the width resp. height of
+ * the pixbuf. (Since: 3.0)
+ *
+ * On the X backend, support for RGBA cursors requires a
+ * sufficently new version of the X Render extension.
+ *
+ * Returns: a new #GdkCursor.
+ *
+ * Since: 2.4
+ */
+GdkCursor *
+gdk_cursor_new_from_pixbuf (GdkDisplay *display,
+ GdkPixbuf *pixbuf,
+ gint x,
+ gint y)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+ g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
+
+ return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_pixbuf (display, pixbuf, x, y);
+}
+
+/**
+ * gdk_cursor_get_display:
+ * @cursor: a #GdkCursor.
+ *
+ * Returns the display on which the #GdkCursor is defined.
+ *
+ * Returns: (transfer none): the #GdkDisplay associated to @cursor
+ *
+ * Since: 2.2
+ */
+
+GdkDisplay *
+gdk_cursor_get_display (GdkCursor *cursor)
+{
+ g_return_val_if_fail (GDK_IS_CURSOR (cursor), NULL);
+
+ return cursor->display;
+}
+
+/**
+ * gdk_cursor_get_image:
+ * @cursor: a #GdkCursor
+ *
+ * Returns a #GdkPixbuf with the image used to display the cursor.
+ *
+ * Note that depending on the capabilities of the windowing system and
+ * on the cursor, GDK may not be able to obtain the image data. In this
+ * case, %NULL is returned.
+ *
+ * Returns: (transfer full): a #GdkPixbuf representing @cursor, or %NULL
+ *
+ * Since: 2.8
+ */
+GdkPixbuf*
+gdk_cursor_get_image (GdkCursor *cursor)
+{
+ g_return_val_if_fail (GDK_IS_CURSOR (cursor), NULL);
+
+ return GDK_CURSOR_GET_CLASS (cursor)->get_image (cursor);
+}
diff --git a/gdk/gdkcursor.h b/gdk/gdkcursor.h
index a421828389..89b0ef1d59 100644
--- a/gdk/gdkcursor.h
+++ b/gdk/gdkcursor.h
@@ -36,7 +36,10 @@
G_BEGIN_DECLS
-#define GDK_TYPE_CURSOR (gdk_cursor_get_type ())
+#define GDK_TYPE_CURSOR (gdk_cursor_get_type ())
+#define GDK_CURSOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_CURSOR, GdkCursor))
+#define GDK_IS_CURSOR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_CURSOR))
+
/**
* GdkCursorType:
@@ -208,18 +211,6 @@ typedef enum
GDK_CURSOR_IS_PIXMAP = -1
} GdkCursorType;
-/**
- * GdkCursor:
- *
- * A #GdkCursor structure represents a cursor.
- */
-struct _GdkCursor
-{
- /*< private >*/
- GdkCursorType GSEAL (type);
- guint GSEAL (ref_count);
-};
-
/* Cursors
*/
@@ -234,11 +225,13 @@ GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display,
GdkPixbuf *pixbuf,
gint x,
gint y);
-GdkDisplay* gdk_cursor_get_display (GdkCursor *cursor);
-GdkCursor* gdk_cursor_ref (GdkCursor *cursor);
-void gdk_cursor_unref (GdkCursor *cursor);
GdkCursor* gdk_cursor_new_from_name (GdkDisplay *display,
const gchar *name);
+GdkDisplay* gdk_cursor_get_display (GdkCursor *cursor);
+#ifndef GDK_DISABLE_DEPRECATED
+GdkCursor* gdk_cursor_ref (GdkCursor *cursor);
+void gdk_cursor_unref (GdkCursor *cursor);
+#endif
GdkPixbuf* gdk_cursor_get_image (GdkCursor *cursor);
GdkCursorType gdk_cursor_get_cursor_type (GdkCursor *cursor);
diff --git a/gdk/gdkinput.h b/gdk/gdkcursorprivate.h
similarity index 60%
rename from gdk/gdkinput.h
rename to gdk/gdkcursorprivate.h
index 3ea024dc2d..3d32ffb18f 100644
--- a/gdk/gdkinput.h
+++ b/gdk/gdkcursorprivate.h
@@ -24,37 +24,35 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
-#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
-#error "Only can be included directly."
-#endif
+#ifndef __GDK_CURSOR_PRIVATE_H__
+#define __GDK_CURSOR_PRIVATE_H__
-#ifndef __GDK_INPUT_H__
-#define __GDK_INPUT_H__
-
-#include
-#include
+#include
G_BEGIN_DECLS
-#if !defined (GDK_MULTIDEVICE_SAFE) && !defined (GDK_DISABLE_DEPRECATED)
+#define GDK_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_CURSOR, GdkCursorClass))
+#define GDK_IS_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_CURSOR))
+#define GDK_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_CURSOR, GdkCursorClass))
-#ifndef GDK_MULTIHEAD_SAFE
+typedef struct _GdkCursorClass GdkCursorClass;
-/* Returns a list of GdkDevice * */
-GList * gdk_devices_list (void);
+struct _GdkCursor
+{
+ GObject parent_instance;
-#ifndef GTK_DISABLE_DEPRECATED
-GdkDevice *gdk_device_get_core_pointer (void);
-#endif
+ /*< private >*/
+ GdkCursorType type;
+ GdkDisplay *display;
+};
-#endif /* GDK_MULTIHEAD_SAFE */
+struct _GdkCursorClass
+{
+ GObjectClass parent_class;
-void gdk_input_set_extension_events (GdkWindow *window,
- gint mask,
- GdkExtensionMode mode);
-
-#endif /* !GDK_MULTIDEVICE_SAFE && GDK_DISABLE_DEPRECATED */
+ GdkPixbuf * (* get_image) (GdkCursor * cursor);
+};
G_END_DECLS
-#endif /* __GDK_INPUT_H__ */
+#endif /* __GDK_CURSOR_PRIVATE_H__ */
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 4e9b3d24e8..1b772bae3b 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -19,20 +19,25 @@
#include "config.h"
-#include "gdkdevice.h"
+#include
#include "gdkdeviceprivate.h"
-#include "gdkintl.h"
+#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
+#include "gdkintl.h"
-
-typedef struct _GdkDeviceKey GdkDeviceKey;
-
-struct _GdkDeviceKey
-{
- guint keyval;
- GdkModifierType modifiers;
-};
+/**
+ * SECTION:gdkdevice
+ * @Short_description: Object representing an input device
+ * @Title: GdkDevice
+ * @See_also: #GdkDeviceManager
+ *
+ * The #GdkDevice object represents a single input device.
+ *
+ * See the #GdkDeviceManager documentation for more information
+ * about the various kinds of master and slave devices, and their
+ * relationships.
+ */
typedef struct _GdkAxisInfo GdkAxisInfo;
@@ -49,21 +54,14 @@ struct _GdkAxisInfo
gdouble resolution;
};
-struct _GdkDevicePrivate
-{
- gchar *name;
- GdkInputSource source;
- GdkInputMode mode;
- gboolean has_cursor;
- gint num_keys;
- GdkDeviceKey *keys;
- GdkDeviceManager *device_manager;
- GdkDisplay *display;
- GdkDevice *associated;
- GdkDeviceType type;
- GArray *axes;
+enum {
+ CHANGED,
+ LAST_SIGNAL
};
+static guint signals [LAST_SIGNAL] = { 0 };
+
+
static void gdk_device_dispose (GObject *object);
static void gdk_device_set_property (GObject *object,
guint prop_id,
@@ -108,8 +106,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Since: 3.0
*/
g_object_class_install_property (object_class,
- PROP_DISPLAY,
- g_param_spec_object ("display",
+ PROP_DISPLAY,
+ g_param_spec_object ("display",
P_("Device Display"),
P_("Display which the device belongs to"),
GDK_TYPE_DISPLAY,
@@ -123,8 +121,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Since: 3.0
*/
g_object_class_install_property (object_class,
- PROP_DEVICE_MANAGER,
- g_param_spec_object ("device-manager",
+ PROP_DEVICE_MANAGER,
+ g_param_spec_object ("device-manager",
P_("Device manager"),
P_("Device manager which the device belongs to"),
GDK_TYPE_DEVICE_MANAGER,
@@ -138,8 +136,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Since: 3.0
*/
g_object_class_install_property (object_class,
- PROP_NAME,
- g_param_spec_string ("name",
+ PROP_NAME,
+ g_param_spec_string ("name",
P_("Device name"),
P_("Device name"),
NULL,
@@ -170,8 +168,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Since: 3.0
*/
g_object_class_install_property (object_class,
- PROP_ASSOCIATED_DEVICE,
- g_param_spec_object ("associated-device",
+ PROP_ASSOCIATED_DEVICE,
+ g_param_spec_object ("associated-device",
P_("Associated device"),
P_("Associated pointer or keyboard with this device"),
GDK_TYPE_DEVICE,
@@ -184,8 +182,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Since: 3.0
*/
g_object_class_install_property (object_class,
- PROP_INPUT_SOURCE,
- g_param_spec_enum ("input-source",
+ PROP_INPUT_SOURCE,
+ g_param_spec_enum ("input-source",
P_("Input source"),
P_("Source type for the device"),
GDK_TYPE_INPUT_SOURCE,
@@ -201,7 +199,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
*/
g_object_class_install_property (object_class,
PROP_INPUT_MODE,
- g_param_spec_enum ("input-mode",
+ g_param_spec_enum ("input-mode",
P_("Input mode for the device"),
P_("Input mode for the device"),
GDK_TYPE_INPUT_MODE,
@@ -216,8 +214,8 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Since: 3.0
*/
g_object_class_install_property (object_class,
- PROP_HAS_CURSOR,
- g_param_spec_boolean ("has-cursor",
+ PROP_HAS_CURSOR,
+ g_param_spec_boolean ("has-cursor",
P_("Whether the device has a cursor"),
P_("Whether there is a visible cursor following device motion"),
FALSE,
@@ -231,55 +229,66 @@ gdk_device_class_init (GdkDeviceClass *klass)
* Since: 3.0
*/
g_object_class_install_property (object_class,
- PROP_N_AXES,
- g_param_spec_uint ("n-axes",
+ PROP_N_AXES,
+ g_param_spec_uint ("n-axes",
P_("Number of axes in the device"),
P_("Number of axes in the device"),
0, G_MAXUINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
- g_type_class_add_private (object_class, sizeof (GdkDevicePrivate));
+ /**
+ * GdkDevice::changed:
+ * @device: the #GdkDevice that changed.
+ *
+ * The ::changed signal is emitted either when the #GdkDevice
+ * has changed the number of either axes or keys. For example
+ * In X this will normally happen when the slave device routing
+ * events through the master device changes (for example, user
+ * switches from the USB mouse to a tablet), in that case the
+ * master device will change to reflect the new slave device
+ * axes and keys.
+ */
+ signals[CHANGED] =
+ g_signal_new (g_intern_static_string ("changed"),
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
}
static void
gdk_device_init (GdkDevice *device)
{
- GdkDevicePrivate *priv;
-
- device->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (device,
- GDK_TYPE_DEVICE,
- GdkDevicePrivate);
-
- priv->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
+ device->axes = g_array_new (FALSE, TRUE, sizeof (GdkAxisInfo));
}
static void
gdk_device_dispose (GObject *object)
{
- GdkDevicePrivate *priv;
- GdkDevice *device;
+ GdkDevice *device = GDK_DEVICE (object);
- device = GDK_DEVICE (object);
- priv = device->priv;
+ if (device->type == GDK_DEVICE_TYPE_SLAVE)
+ _gdk_device_remove_slave (device->associated, device);
- if (priv->associated)
+ if (device->associated)
{
- _gdk_device_set_associated_device (priv->associated, NULL);
- g_object_unref (priv->associated);
- priv->associated = NULL;
+ _gdk_device_set_associated_device (device->associated, NULL);
+ g_object_unref (device->associated);
+ device->associated = NULL;
}
- if (priv->axes)
+ if (device->axes)
{
- g_array_free (priv->axes, TRUE);
- priv->axes = NULL;
+ g_array_free (device->axes, TRUE);
+ device->axes = NULL;
}
- g_free (priv->name);
- g_free (priv->keys);
+ g_free (device->name);
+ g_free (device->keys);
- priv->name = NULL;
- priv->keys = NULL;
+ device->name = NULL;
+ device->keys = NULL;
G_OBJECT_CLASS (gdk_device_parent_class)->dispose (object);
}
@@ -291,33 +300,32 @@ gdk_device_set_property (GObject *object,
GParamSpec *pspec)
{
GdkDevice *device = GDK_DEVICE (object);
- GdkDevicePrivate *priv = device->priv;
switch (prop_id)
{
case PROP_DISPLAY:
- priv->display = g_value_get_object (value);
+ device->display = g_value_get_object (value);
break;
case PROP_DEVICE_MANAGER:
- priv->device_manager = g_value_get_object (value);
+ device->manager = g_value_get_object (value);
break;
case PROP_NAME:
- if (priv->name)
- g_free (priv->name);
+ if (device->name)
+ g_free (device->name);
- priv->name = g_value_dup_string (value);
+ device->name = g_value_dup_string (value);
break;
case PROP_TYPE:
- priv->type = g_value_get_enum (value);
+ device->type = g_value_get_enum (value);
break;
case PROP_INPUT_SOURCE:
- priv->source = g_value_get_enum (value);
+ device->source = g_value_get_enum (value);
break;
case PROP_INPUT_MODE:
gdk_device_set_mode (device, g_value_get_enum (value));
break;
case PROP_HAS_CURSOR:
- priv->has_cursor = g_value_get_boolean (value);
+ device->has_cursor = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -332,36 +340,35 @@ gdk_device_get_property (GObject *object,
GParamSpec *pspec)
{
GdkDevice *device = GDK_DEVICE (object);
- GdkDevicePrivate *priv = device->priv;
switch (prop_id)
{
case PROP_DISPLAY:
- g_value_set_object (value, priv->display);
+ g_value_set_object (value, device->display);
break;
case PROP_DEVICE_MANAGER:
- g_value_set_object (value, priv->device_manager);
+ g_value_set_object (value, device->manager);
break;
case PROP_ASSOCIATED_DEVICE:
- g_value_set_object (value, priv->associated);
+ g_value_set_object (value, device->associated);
break;
case PROP_NAME:
- g_value_set_string (value, priv->name);
+ g_value_set_string (value, device->name);
break;
case PROP_TYPE:
- g_value_set_enum (value, priv->type);
+ g_value_set_enum (value, device->type);
break;
case PROP_INPUT_SOURCE:
- g_value_set_enum (value, priv->source);
+ g_value_set_enum (value, device->source);
break;
case PROP_INPUT_MODE:
- g_value_set_enum (value, priv->mode);
+ g_value_set_enum (value, device->mode);
break;
case PROP_HAS_CURSOR:
- g_value_set_boolean (value, priv->has_cursor);
+ g_value_set_boolean (value, device->has_cursor);
break;
case PROP_N_AXES:
- g_value_set_uint (value, priv->axes->len);
+ g_value_set_uint (value, device->axes->len);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -377,7 +384,7 @@ gdk_device_get_property (GObject *object,
* or %NULL.
* @mask: location to store the modifiers, or %NULL.
*
- * Gets the current state of a device relative to @window.
+ * Gets the current state of a pointer device relative to @window.
*/
void
gdk_device_get_state (GdkDevice *device,
@@ -386,12 +393,105 @@ gdk_device_get_state (GdkDevice *device,
GdkModifierType *mask)
{
g_return_if_fail (GDK_IS_DEVICE (device));
+ g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_DEVICE_GET_CLASS (device)->get_state)
GDK_DEVICE_GET_CLASS (device)->get_state (device, window, axes, mask);
}
+/**
+ * gdk_device_get_position:
+ * @device: pointer device to query status about.
+ * @screen: (out) (transfer none) (allow-none): location to store the #GdkScreen
+ * the @device is on, or %NULL.
+ * @x: (out) (allow-none): location to store root window X coordinate of @device, or %NULL.
+ * @y: (out) (allow-none): location to store root window Y coordinate of @device, or %NULL.
+ *
+ * Gets the current location of @device.
+ *
+ * Since: 3.0
+ **/
+void
+gdk_device_get_position (GdkDevice *device,
+ GdkScreen **screen,
+ gint *x,
+ gint *y)
+{
+ GdkDisplay *display;
+ gint tmp_x, tmp_y;
+ GdkScreen *default_screen;
+ GdkWindow *root;
+
+ g_return_if_fail (GDK_IS_DEVICE (device));
+ g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
+
+ display = gdk_device_get_display (device);
+ default_screen = gdk_display_get_default_screen (display);
+
+ _gdk_device_query_state (device,
+ gdk_screen_get_root_window (default_screen),
+ &root, NULL,
+ &tmp_x, &tmp_y,
+ NULL, NULL, NULL);
+
+ if (screen)
+ *screen = gdk_window_get_screen (root);
+ if (x)
+ *x = tmp_x;
+ if (y)
+ *y = tmp_y;
+}
+
+/**
+ * gdk_device_get_window_at_position:
+ * @device: pointer #GdkDevice to query info to.
+ * @win_x: (out) (allow-none): return location for the X coordinate of the device location,
+ * relative to the window origin, or %NULL.
+ * @win_y: (out) (allow-none): return location for the Y coordinate of the device location,
+ * relative to the window origin, or %NULL.
+ *
+ * Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
+ * %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
+ *
+ * Returns: (transfer none): the #GdkWindow under the device position, or %NULL.
+ *
+ * Since: 3.0
+ **/
+GdkWindow *
+gdk_device_get_window_at_position (GdkDevice *device,
+ gint *win_x,
+ gint *win_y)
+{
+ gint tmp_x, tmp_y;
+ GdkWindow *window;
+
+ g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
+
+ window = _gdk_device_window_at_position (device, &tmp_x, &tmp_y, NULL, FALSE);
+
+ /* This might need corrections, as the native window returned
+ may contain client side children */
+ if (window)
+ {
+ double xx, yy;
+
+ window = _gdk_window_find_descendant_at (window,
+ tmp_x, tmp_y,
+ &xx, &yy);
+ tmp_x = floor (xx + 0.5);
+ tmp_y = floor (yy + 0.5);
+ }
+
+ if (win_x)
+ *win_x = tmp_x;
+ if (win_y)
+ *win_y = tmp_y;
+
+ return window;
+}
+
/**
* gdk_device_get_history:
* @device: a #GdkDevice
@@ -401,7 +501,7 @@ gdk_device_get_state (GdkDevice *device,
* @events: (array length=n_events) (out) (transfer none): location to store a newly-allocated array of #GdkTimeCoord, or %NULL
* @n_events: location to store the length of @events, or %NULL
*
- * Obtains the motion history for a device; given a starting and
+ * Obtains the motion history for a pointer device; given a starting and
* ending timestamp, return all events in the motion history for
* the device in the given range of time. Some windowing systems
* do not support motion history, in which case, %FALSE will
@@ -420,6 +520,7 @@ gdk_device_get_history (GdkDevice *device,
gint *n_events)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
if (n_events)
@@ -448,7 +549,7 @@ _gdk_device_allocate_history (GdkDevice *device,
for (i = 0; i < n_events; i++)
result[i] = g_malloc (sizeof (GdkTimeCoord) -
- sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->priv->axes->len));
+ sizeof (double) * (GDK_MAX_TIMECOORD_AXES - device->axes->len));
return result;
}
@@ -486,7 +587,7 @@ gdk_device_get_name (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- return device->priv->name;
+ return device->name;
}
/**
@@ -503,8 +604,9 @@ gboolean
gdk_device_get_has_cursor (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
- return device->priv->has_cursor;
+ return device->has_cursor;
}
/**
@@ -522,24 +624,7 @@ gdk_device_get_source (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
- return device->priv->source;
-}
-
-/**
- * gdk_device_set_source:
- * @device: a #GdkDevice.
- * @source: the source type.
- *
- * Sets the source type for an input device.
- **/
-void
-gdk_device_set_source (GdkDevice *device,
- GdkInputSource source)
-{
- g_return_if_fail (GDK_IS_DEVICE (device));
-
- device->priv->source = source;
- g_object_notify (G_OBJECT (device), "input-source");
+ return device->source;
}
/**
@@ -557,7 +642,7 @@ gdk_device_get_mode (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
- return device->priv->mode;
+ return device->mode;
}
/**
@@ -577,21 +662,16 @@ gdk_device_set_mode (GdkDevice *device,
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
- if (device->priv->mode == mode)
+ if (device->mode == mode)
return TRUE;
if (mode == GDK_MODE_DISABLED &&
gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER)
return FALSE;
- /* FIXME: setting has_cursor when mode is window? */
-
- device->priv->mode = mode;
+ device->mode = mode;
g_object_notify (G_OBJECT (device), "input-mode");
- if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER)
- _gdk_input_check_extension_events (device);
-
return TRUE;
}
@@ -610,7 +690,7 @@ gdk_device_get_n_keys (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
- return device->priv->num_keys;
+ return device->num_keys;
}
/**
@@ -634,17 +714,17 @@ gdk_device_get_key (GdkDevice *device,
GdkModifierType *modifiers)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
- g_return_val_if_fail (index_ < device->priv->num_keys, FALSE);
+ g_return_val_if_fail (index_ < device->num_keys, FALSE);
- if (!device->priv->keys[index_].keyval &&
- !device->priv->keys[index_].modifiers)
+ if (!device->keys[index_].keyval &&
+ !device->keys[index_].modifiers)
return FALSE;
if (keyval)
- *keyval = device->priv->keys[index_].keyval;
+ *keyval = device->keys[index_].keyval;
if (modifiers)
- *modifiers = device->priv->keys[index_].modifiers;
+ *modifiers = device->keys[index_].modifiers;
return TRUE;
}
@@ -661,20 +741,20 @@ gdk_device_get_key (GdkDevice *device,
**/
void
gdk_device_set_key (GdkDevice *device,
- guint index_,
- guint keyval,
- GdkModifierType modifiers)
+ guint index_,
+ guint keyval,
+ GdkModifierType modifiers)
{
g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (index_ < device->priv->num_keys);
+ g_return_if_fail (index_ < device->num_keys);
- device->priv->keys[index_].keyval = keyval;
- device->priv->keys[index_].modifiers = modifiers;
+ device->keys[index_].keyval = keyval;
+ device->keys[index_].modifiers = modifiers;
}
/**
* gdk_device_get_axis_use:
- * @device: a #GdkDevice.
+ * @device: a pointer #GdkDevice.
* @index_: the index of the axis.
*
* Returns the axis use for @index_.
@@ -690,16 +770,17 @@ gdk_device_get_axis_use (GdkDevice *device,
GdkAxisInfo *info;
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_AXIS_IGNORE);
- g_return_val_if_fail (index_ < device->priv->axes->len, GDK_AXIS_IGNORE);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, GDK_AXIS_IGNORE);
+ g_return_val_if_fail (index_ < device->axes->len, GDK_AXIS_IGNORE);
- info = &g_array_index (device->priv->axes, GdkAxisInfo, index_);
+ info = &g_array_index (device->axes, GdkAxisInfo, index_);
return info->use;
}
/**
* gdk_device_set_axis_use:
- * @device: a #GdkDevice
+ * @device: a pointer #GdkDevice
* @index_: the index of the axis
* @use: specifies how the axis is used
*
@@ -707,17 +788,16 @@ gdk_device_get_axis_use (GdkDevice *device,
**/
void
gdk_device_set_axis_use (GdkDevice *device,
- guint index_,
- GdkAxisUse use)
+ guint index_,
+ GdkAxisUse use)
{
- GdkDevicePrivate *priv;
GdkAxisInfo *info;
g_return_if_fail (GDK_IS_DEVICE (device));
- g_return_if_fail (index_ < device->priv->axes->len);
+ g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
+ g_return_if_fail (index_ < device->axes->len);
- priv = device->priv;
- info = &g_array_index (priv->axes, GdkAxisInfo, index_);
+ info = &g_array_index (device->axes, GdkAxisInfo, index_);
info->use = use;
switch (use)
@@ -753,13 +833,9 @@ gdk_device_set_axis_use (GdkDevice *device,
GdkDisplay *
gdk_device_get_display (GdkDevice *device)
{
- GdkDevicePrivate *priv;
-
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- priv = device->priv;
-
- return priv->display;
+ return device->display;
}
/**
@@ -783,37 +859,98 @@ gdk_device_get_display (GdkDevice *device)
GdkDevice *
gdk_device_get_associated_device (GdkDevice *device)
{
- GdkDevicePrivate *priv;
-
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
- priv = device->priv;
+ return device->associated;
+}
- return priv->associated;
+static void
+_gdk_device_set_device_type (GdkDevice *device,
+ GdkDeviceType type)
+{
+ if (device->type != type)
+ {
+ device->type = type;
+
+ g_object_notify (G_OBJECT (device), "type");
+ }
}
void
_gdk_device_set_associated_device (GdkDevice *device,
GdkDevice *associated)
{
- GdkDevicePrivate *priv;
-
g_return_if_fail (GDK_IS_DEVICE (device));
g_return_if_fail (associated == NULL || GDK_IS_DEVICE (associated));
- priv = device->priv;
-
- if (priv->associated == associated)
+ if (device->associated == associated)
return;
- if (priv->associated)
+ if (device->associated)
{
- g_object_unref (priv->associated);
- priv->associated = NULL;
+ g_object_unref (device->associated);
+ device->associated = NULL;
}
if (associated)
- priv->associated = g_object_ref (associated);
+ device->associated = g_object_ref (associated);
+
+ if (device->type != GDK_DEVICE_TYPE_MASTER)
+ {
+ if (device->associated)
+ _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_SLAVE);
+ else
+ _gdk_device_set_device_type (device, GDK_DEVICE_TYPE_FLOATING);
+ }
+}
+
+/**
+ * gdk_device_list_slave_devices:
+ * @device: a #GdkDevice
+ *
+ * If the device if of type %GDK_DEVICE_TYPE_MASTER, it will return
+ * the list of slave devices attached to it, otherwise it will return
+ * %NULL
+ *
+ * Returns: (transfer container): the list of slave devices, or %NULL. The
+ * list must be freed with g_list_free(), the contents of the list
+ * are owned by GTK+ and should not be freed.
+ **/
+GList *
+gdk_device_list_slave_devices (GdkDevice *device)
+{
+ g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_MASTER, NULL);
+
+ return g_list_copy (device->slaves);
+}
+
+void
+_gdk_device_add_slave (GdkDevice *device,
+ GdkDevice *slave)
+{
+ g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
+ g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
+
+ if (!g_list_find (device->slaves, slave))
+ device->slaves = g_list_prepend (device->slaves, slave);
+}
+
+void
+_gdk_device_remove_slave (GdkDevice *device,
+ GdkDevice *slave)
+{
+ GList *elem;
+
+ g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
+ g_return_if_fail (gdk_device_get_device_type (slave) != GDK_DEVICE_TYPE_MASTER);
+
+ elem = g_list_find (device->slaves, slave);
+
+ if (!elem)
+ return;
+
+ device->slaves = g_list_delete_link (device->slaves, elem);
}
/**
@@ -829,18 +966,14 @@ _gdk_device_set_associated_device (GdkDevice *device,
GdkDeviceType
gdk_device_get_device_type (GdkDevice *device)
{
- GdkDevicePrivate *priv;
-
g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_DEVICE_TYPE_MASTER);
- priv = device->priv;
-
- return priv->type;
+ return device->type;
}
/**
* gdk_device_get_n_axes:
- * @device: a #GdkDevice
+ * @device: a pointer #GdkDevice
*
* Returns the number of axes the device currently has.
*
@@ -852,13 +985,14 @@ gint
gdk_device_get_n_axes (GdkDevice *device)
{
g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, 0);
- return device->priv->axes->len;
+ return device->axes->len;
}
/**
* gdk_device_list_axes:
- * @device: a #GdkDevice
+ * @device: a pointer #GdkDevice
*
* Returns a #GList of #GdkAtoms, containing the labels for
* the axes that @device currently has.
@@ -871,17 +1005,17 @@ gdk_device_get_n_axes (GdkDevice *device)
GList *
gdk_device_list_axes (GdkDevice *device)
{
- GdkDevicePrivate *priv;
GList *axes = NULL;
gint i;
- priv = device->priv;
+ g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
- for (i = 0; i < priv->axes->len; i++)
+ for (i = 0; i < device->axes->len; i++)
{
GdkAxisInfo axis_info;
- axis_info = g_array_index (priv->axes, GdkAxisInfo, i);
+ axis_info = g_array_index (device->axes, GdkAxisInfo, i);
axes = g_list_prepend (axes, GDK_ATOM_TO_POINTER (axis_info.label));
}
@@ -890,7 +1024,7 @@ gdk_device_list_axes (GdkDevice *device)
/**
* gdk_device_get_axis_value:
- * @device: a #GdkDevice.
+ * @device: a pointer #GdkDevice.
* @axes: pointer to an array of axes
* @axis_label: #GdkAtom with the axis label.
* @value: location to store the found value.
@@ -909,21 +1043,19 @@ gdk_device_get_axis_value (GdkDevice *device,
GdkAtom axis_label,
gdouble *value)
{
- GdkDevicePrivate *priv;
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
- priv = device->priv;
-
- for (i = 0; i < priv->axes->len; i++)
+ for (i = 0; i < device->axes->len; i++)
{
GdkAxisInfo axis_info;
- axis_info = g_array_index (priv->axes, GdkAxisInfo, i);
+ axis_info = g_array_index (device->axes, GdkAxisInfo, i);
if (axis_info.label != axis_label)
continue;
@@ -955,23 +1087,21 @@ gdk_device_get_axis (GdkDevice *device,
GdkAxisUse use,
gdouble *value)
{
- GdkDevicePrivate *priv;
gint i;
g_return_val_if_fail (GDK_IS_DEVICE (device), FALSE);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, FALSE);
if (axes == NULL)
return FALSE;
- priv = device->priv;
+ g_return_val_if_fail (device->axes != NULL, FALSE);
- g_return_val_if_fail (priv->axes != NULL, FALSE);
-
- for (i = 0; i < priv->axes->len; i++)
+ for (i = 0; i < device->axes->len; i++)
{
GdkAxisInfo axis_info;
- axis_info = g_array_index (priv->axes, GdkAxisInfo, i);
+ axis_info = g_array_index (device->axes, GdkAxisInfo, i);
if (axis_info.use != use)
continue;
@@ -1004,7 +1134,10 @@ get_native_grab_event_mask (GdkEventMask grab_mask)
/**
* gdk_device_grab:
- * @device: a #GdkDevice
+ * @device: a #GdkDevice. To get the device you can use gtk_get_current_event_device()
+ * or gdk_event_get_device() if the grab is in reaction to an event. Also, you can use
+ * gdk_device_manager_get_client_pointer() but only in code that isn't triggered by a
+ * #GdkEvent and there aren't other means to get a meaningful #GdkDevice to operate on.
* @window: the #GdkWindow which will own the grab (the grab window)
* @grab_ownership: specifies the grab ownership.
* @owner_events: if %FALSE then all device events are reported with respect to
@@ -1059,8 +1192,8 @@ gdk_device_grab (GdkDevice *device,
GdkGrabStatus res;
GdkWindow *native;
- g_return_val_if_fail (GDK_IS_DEVICE (device), 0);
- g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
+ g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_GRAB_SUCCESS);
+ g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_SUCCESS);
if (_gdk_native_windows)
native = window;
@@ -1072,21 +1205,23 @@ gdk_device_grab (GdkDevice *device,
native = gdk_offscreen_window_get_embedder (native);
if (native == NULL ||
- (!_gdk_window_has_impl (native) &&
- !gdk_window_is_viewable (native)))
- return GDK_GRAB_NOT_VIEWABLE;
+ (!_gdk_window_has_impl (native) &&
+ !gdk_window_is_viewable (native)))
+ return GDK_GRAB_NOT_VIEWABLE;
native = gdk_window_get_toplevel (native);
}
- res = _gdk_windowing_device_grab (device,
- window,
- native,
- owner_events,
- get_native_grab_event_mask (event_mask),
- NULL,
- cursor,
- time_);
+ if (native == NULL || GDK_WINDOW_DESTROYED (native))
+ return GDK_GRAB_NOT_VIEWABLE;
+
+ res = GDK_DEVICE_GET_CLASS (device)->grab (device,
+ native,
+ owner_events,
+ get_native_grab_event_mask (event_mask),
+ NULL,
+ cursor,
+ time_);
if (res == GDK_GRAB_SUCCESS)
{
@@ -1094,7 +1229,7 @@ gdk_device_grab (GdkDevice *device,
gulong serial;
display = gdk_window_get_display (window);
- serial = _gdk_windowing_window_get_next_serial (display);
+ serial = _gdk_display_get_next_serial (display);
_gdk_display_add_device_grab (display,
device,
@@ -1111,17 +1246,66 @@ gdk_device_grab (GdkDevice *device,
return res;
}
+/**
+ * gdk_device_ungrab:
+ * @device: a #GdkDevice
+ * @time_: a timestap (e.g. %GDK_CURRENT_TIME).
+ *
+ * Release any grab on @device.
+ *
+ * Since: 3.0
+ */
+void
+gdk_device_ungrab (GdkDevice *device,
+ guint32 time_)
+{
+ g_return_if_fail (GDK_IS_DEVICE (device));
+
+ GDK_DEVICE_GET_CLASS (device)->ungrab (device, time_);
+}
+
+/**
+ * gdk_device_warp:
+ * @device: the device to warp.
+ * @screen: the screen to warp @device to.
+ * @x: the X coordinate of the destination.
+ * @y: the Y coordinate of the destination.
+ *
+ * Warps @device in @display to the point @x,@y on
+ * the screen @screen, unless the device is confined
+ * to a window by a grab, in which case it will be moved
+ * as far as allowed by the grab. Warping the pointer
+ * creates events as if the user had moved the mouse
+ * instantaneously to the destination.
+ *
+ * Note that the pointer should normally be under the
+ * control of the user. This function was added to cover
+ * some rare use cases like keyboard navigation support
+ * for the color picker in the #GtkColorSelectionDialog.
+ *
+ * Since: 3.0
+ **/
+void
+gdk_device_warp (GdkDevice *device,
+ GdkScreen *screen,
+ gint x,
+ gint y)
+{
+ g_return_if_fail (GDK_IS_DEVICE (device));
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+ g_return_if_fail (gdk_device_get_display (device) == gdk_screen_get_display (screen));
+
+ GDK_DEVICE_GET_CLASS (device)->warp (device, screen, x, y);
+}
+
/* Private API */
void
_gdk_device_reset_axes (GdkDevice *device)
{
- GdkDevicePrivate *priv;
gint i;
- priv = device->priv;
-
- for (i = priv->axes->len - 1; i >= 0; i--)
- g_array_remove_index (priv->axes, i);
+ for (i = device->axes->len - 1; i >= 0; i--)
+ g_array_remove_index (device->axes, i);
g_object_notify (G_OBJECT (device), "n-axes");
}
@@ -1134,12 +1318,9 @@ _gdk_device_add_axis (GdkDevice *device,
gdouble max_value,
gdouble resolution)
{
- GdkDevicePrivate *priv;
GdkAxisInfo axis_info;
guint pos;
- priv = device->priv;
-
axis_info.use = use;
axis_info.label = label_atom;
axis_info.min_value = min_value;
@@ -1164,8 +1345,8 @@ _gdk_device_add_axis (GdkDevice *device,
break;
}
- priv->axes = g_array_append_val (priv->axes, axis_info);
- pos = device->priv->axes->len - 1;
+ device->axes = g_array_append_val (device->axes, axis_info);
+ pos = device->axes->len - 1;
g_object_notify (G_OBJECT (device), "n-axes");
@@ -1176,11 +1357,11 @@ void
_gdk_device_set_keys (GdkDevice *device,
guint num_keys)
{
- if (device->priv->keys)
- g_free (device->priv->keys);
+ if (device->keys)
+ g_free (device->keys);
- device->priv->num_keys = num_keys;
- device->priv->keys = g_new0 (GdkDeviceKey, num_keys);
+ device->num_keys = num_keys;
+ device->keys = g_new0 (GdkDeviceKey, num_keys);
}
static GdkAxisInfo *
@@ -1205,12 +1386,9 @@ GdkAxisUse
_gdk_device_get_axis_use (GdkDevice *device,
guint index_)
{
- GdkDevicePrivate *priv;
GdkAxisInfo info;
- priv = device->priv;
-
- info = g_array_index (priv->axes, GdkAxisInfo, index_);
+ info = g_array_index (device->axes, GdkAxisInfo, index_);
return info.use;
}
@@ -1221,7 +1399,6 @@ _gdk_device_translate_window_coord (GdkDevice *device,
gdouble value,
gdouble *axis_value)
{
- GdkDevicePrivate *priv;
GdkAxisInfo axis_info;
GdkAxisInfo *axis_info_x, *axis_info_y;
gdouble device_width, device_height;
@@ -1232,12 +1409,10 @@ _gdk_device_translate_window_coord (GdkDevice *device,
gdouble device_aspect;
gint window_width, window_height;
- priv = device->priv;
-
- if (index_ >= priv->axes->len)
+ if (index_ >= device->axes->len)
return FALSE;
- axis_info = g_array_index (priv->axes, GdkAxisInfo, index_);
+ axis_info = g_array_index (device->axes, GdkAxisInfo, index_);
if (axis_info.use != GDK_AXIS_X &&
axis_info.use != GDK_AXIS_Y)
@@ -1246,11 +1421,11 @@ _gdk_device_translate_window_coord (GdkDevice *device,
if (axis_info.use == GDK_AXIS_X)
{
axis_info_x = &axis_info;
- axis_info_y = find_axis_info (priv->axes, GDK_AXIS_Y);
+ axis_info_y = find_axis_info (device->axes, GDK_AXIS_Y);
}
else
{
- axis_info_x = find_axis_info (priv->axes, GDK_AXIS_X);
+ axis_info_x = find_axis_info (device->axes, GDK_AXIS_X);
axis_info_y = &axis_info;
}
@@ -1337,17 +1512,16 @@ _gdk_device_translate_screen_coord (GdkDevice *device,
gdouble value,
gdouble *axis_value)
{
- GdkDevicePrivate *priv = device->priv;
GdkAxisInfo axis_info;
gdouble axis_width, scale, offset;
- if (priv->mode != GDK_MODE_SCREEN)
+ if (device->mode != GDK_MODE_SCREEN)
return FALSE;
- if (index_ >= priv->axes->len)
+ if (index_ >= device->axes->len)
return FALSE;
- axis_info = g_array_index (priv->axes, GdkAxisInfo, index_);
+ axis_info = g_array_index (device->axes, GdkAxisInfo, index_);
if (axis_info.use != GDK_AXIS_X &&
axis_info.use != GDK_AXIS_Y)
@@ -1386,16 +1560,13 @@ _gdk_device_translate_axis (GdkDevice *device,
gdouble value,
gdouble *axis_value)
{
- GdkDevicePrivate *priv;
GdkAxisInfo axis_info;
gdouble axis_width, out;
- priv = device->priv;
-
- if (index_ >= priv->axes->len)
+ if (index_ >= device->axes->len)
return FALSE;
- axis_info = g_array_index (priv->axes, GdkAxisInfo, index_);
+ axis_info = g_array_index (device->axes, GdkAxisInfo, index_);
if (axis_info.use == GDK_AXIS_X ||
axis_info.use == GDK_AXIS_Y)
@@ -1410,3 +1581,39 @@ _gdk_device_translate_axis (GdkDevice *device,
return TRUE;
}
+
+gboolean
+_gdk_device_query_state (GdkDevice *device,
+ GdkWindow *window,
+ GdkWindow **root_window,
+ GdkWindow **child_window,
+ gint *root_x,
+ gint *root_y,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask)
+{
+ return GDK_DEVICE_GET_CLASS (device)->query_state (device,
+ window,
+ root_window,
+ child_window,
+ root_x,
+ root_y,
+ win_x,
+ win_y,
+ mask);
+}
+
+GdkWindow *
+_gdk_device_window_at_position (GdkDevice *device,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask,
+ gboolean get_toplevel)
+{
+ return GDK_DEVICE_GET_CLASS (device)->window_at_position (device,
+ win_x,
+ win_y,
+ mask,
+ get_toplevel);
+}
diff --git a/gdk/gdkdevice.h b/gdk/gdkdevice.h
index 27375f7621..1e4ae22b3b 100644
--- a/gdk/gdkdevice.h
+++ b/gdk/gdkdevice.h
@@ -33,8 +33,6 @@ G_BEGIN_DECLS
#define GDK_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE, GdkDevice))
#define GDK_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE))
-typedef struct _GdkDevice GdkDevice;
-typedef struct _GdkDevicePrivate GdkDevicePrivate;
typedef struct _GdkTimeCoord GdkTimeCoord;
/**
@@ -156,27 +154,17 @@ struct _GdkTimeCoord
gdouble axes[GDK_MAX_TIMECOORD_AXES];
};
-struct _GdkDevice
-{
- GObject parent_instance;
-
- /*< private >*/
- GdkDevicePrivate *priv;
-};
-
-GType gdk_device_get_type (void) G_GNUC_CONST;
+GType gdk_device_get_type (void) G_GNUC_CONST;
G_CONST_RETURN gchar *gdk_device_get_name (GdkDevice *device);
gboolean gdk_device_get_has_cursor (GdkDevice *device);
/* Functions to configure a device */
GdkInputSource gdk_device_get_source (GdkDevice *device);
-void gdk_device_set_source (GdkDevice *device,
- GdkInputSource source);
GdkInputMode gdk_device_get_mode (GdkDevice *device);
gboolean gdk_device_set_mode (GdkDevice *device,
- GdkInputMode mode);
+ GdkInputMode mode);
gint gdk_device_get_n_keys (GdkDevice *device);
gboolean gdk_device_get_key (GdkDevice *device,
@@ -184,9 +172,9 @@ gboolean gdk_device_get_key (GdkDevice *device,
guint *keyval,
GdkModifierType *modifiers);
void gdk_device_set_key (GdkDevice *device,
- guint index_,
- guint keyval,
- GdkModifierType modifiers);
+ guint index_,
+ guint keyval,
+ GdkModifierType modifiers);
GdkAxisUse gdk_device_get_axis_use (GdkDevice *device,
guint index_);
@@ -196,17 +184,26 @@ void gdk_device_set_axis_use (GdkDevice *device,
void gdk_device_get_state (GdkDevice *device,
- GdkWindow *window,
- gdouble *axes,
- GdkModifierType *mask);
+ GdkWindow *window,
+ gdouble *axes,
+ GdkModifierType *mask);
+void gdk_device_get_position (GdkDevice *device,
+ GdkScreen **screen,
+ gint *x,
+ gint *y);
+GdkWindow *
+ gdk_device_get_window_at_position
+ (GdkDevice *device,
+ gint *win_x,
+ gint *win_y);
gboolean gdk_device_get_history (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events);
+ GdkWindow *window,
+ guint32 start,
+ guint32 stop,
+ GdkTimeCoord ***events,
+ gint *n_events);
void gdk_device_free_history (GdkTimeCoord **events,
- gint n_events);
+ gint n_events);
gint gdk_device_get_n_axes (GdkDevice *device);
GList * gdk_device_list_axes (GdkDevice *device);
@@ -216,12 +213,13 @@ gboolean gdk_device_get_axis_value (GdkDevice *device,
gdouble *value);
gboolean gdk_device_get_axis (GdkDevice *device,
- gdouble *axes,
- GdkAxisUse use,
- gdouble *value);
+ gdouble *axes,
+ GdkAxisUse use,
+ gdouble *value);
GdkDisplay * gdk_device_get_display (GdkDevice *device);
GdkDevice * gdk_device_get_associated_device (GdkDevice *device);
+GList * gdk_device_list_slave_devices (GdkDevice *device);
GdkDeviceType gdk_device_get_device_type (GdkDevice *device);
@@ -236,6 +234,11 @@ GdkGrabStatus gdk_device_grab (GdkDevice *device,
void gdk_device_ungrab (GdkDevice *device,
guint32 time_);
+void gdk_device_warp (GdkDevice *device,
+ GdkScreen *screen,
+ gint x,
+ gint y);
+
gboolean gdk_device_grab_info_libgtk_only (GdkDisplay *display,
GdkDevice *device,
GdkWindow **grab_window,
diff --git a/gdk/gdkdevicemanager.c b/gdk/gdkdevicemanager.c
index 56499bcb64..33fd1082ba 100644
--- a/gdk/gdkdevicemanager.c
+++ b/gdk/gdkdevicemanager.c
@@ -19,74 +19,90 @@
#include "config.h"
-#include "gdkdevicemanager.h"
-
+#include "gdkdevicemanagerprivate.h"
+#include "gdkdisplay.h"
#include "gdkintl.h"
-#include "gdkinternals.h"
/**
* SECTION:gdkdevicemanager
* @Short_description: Functions for handling input devices
- * @Long_description: In addition to a single pointer and keyboard for user interface input, GDK
- * contains support for a variety of input devices, including graphics tablets,
- * touchscreens and multiple pointers/keyboards interacting simultaneously with
- * the user interface. Under X, the support for multiple input devices is done
- * through the XInput 2 extension, which also supports
- * additional features such as sub-pixel positioning information and additional
- * device-dependent information.
* @Title: GdkDeviceManager
- * @See_also: #GdkDevice, #GdkEvent, gdk_enable_multidevice()
+ * @See_also: #GdkDevice, #GdkEvent
*
- * By default, GDK supports the traditional single keyboard/pointer input scheme (Plus additional
- * special input devices such as tablets. In short, backwards compatible with 2.X). Since version 3.0,
- * if gdk_enable_multidevice() is called before gdk_display_open() and the platform supports it, GDK
- * will be aware of multiple keyboard/pointer pairs interacting simultaneously with the user interface.
+ * In addition to a single pointer and keyboard for user interface input,
+ * GDK contains support for a variety of input devices, including graphics
+ * tablets, touchscreens and multiple pointers/keyboards interacting
+ * simultaneously with the user interface. Under X, the support for multiple
+ * input devices is done through the XInput 2 extension,
+ * which also supports additional features such as sub-pixel positioning
+ * information and additional device-dependent information.
*
- * Conceptually, in multidevice mode there are 2 device types, virtual devices (or master devices)
- * are represented by the pointer cursors and keyboard foci that are seen on the screen. physical
- * devices (or slave devices) represent the hardware that is controlling the virtual devices, and
- * thus has no visible cursor on the screen.
+ * By default, and if the platform supports it, GDK is aware of multiple
+ * keyboard/pointer pairs and multitouch devices, this behavior can be
+ * changed by calling gdk_disable_multidevice() before gdk_display_open(),
+ * although there would be rarely a reason to do that. For a widget or
+ * window to be dealt as multipointer aware,
+ * gdk_window_set_support_multidevice() or
+ * gtk_widget_set_support_multidevice() must have been called on it.
*
- * Virtual devices are always paired, there is a keyboard device for every pointer device,
- * associations between devices may be inspected through gdk_device_get_associated_device().
+ * Conceptually, in multidevice mode there are 2 device types, virtual
+ * devices (or master devices) are represented by the pointer cursors
+ * and keyboard foci that are seen on the screen. Physical devices (or
+ * slave devices) represent the hardware that is controlling the virtual
+ * devices, and thus has no visible cursor on the screen.
*
- * There may be several virtual devices, and several physical devices could be controlling each of
- * these virtual devices. Physical devices may also be "floating", which means they are not attached
- * to any virtual device.
+ * Virtual devices are always paired, there is a keyboard device for every
+ * pointer device, associations between devices may be inspected through
+ * gdk_device_get_associated_device().
*
- * By default, GDK will automatically listen for events coming from all master devices, setting the
- * #GdkDevice for all events coming from input devices
+ * There may be several virtual devices, and several physical devices could
+ * be controlling each of these virtual devices. Physical devices may also
+ * be "floating", which means they are not attached to any virtual device.
+ *
+ * By default, GDK will automatically listen for events coming from all
+ * master devices, setting the #GdkDevice for all events coming from input
+ * devices,
*
- * Events containing device information are #GDK_MOTION_NOTIFY, #GDK_BUTTON_PRESS, #GDK_2BUTTON_PRESS,
- * #GDK_3BUTTON_PRESS, #GDK_BUTTON_RELEASE, #GDK_SCROLL, #GDK_KEY_PRESS, #GDK_KEY_RELEASE,
- * #GDK_ENTER_NOTIFY, #GDK_LEAVE_NOTIFY, #GDK_FOCUS_CHANGE, #GDK_PROXIMITY_IN, #GDK_PROXIMITY_OUT,
- * #GDK_DRAG_ENTER, #GDK_DRAG_LEAVE, #GDK_DRAG_MOTION, #GDK_DRAG_STATUS, #GDK_DROP_START,
- * #GDK_DROP_FINISHED and #GDK_GRAB_BROKEN.
+ * Events containing device information are #GDK_MOTION_NOTIFY,
+ * #GDK_BUTTON_PRESS, #GDK_2BUTTON_PRESS, #GDK_3BUTTON_PRESS,
+ * #GDK_BUTTON_RELEASE, #GDK_SCROLL, #GDK_KEY_PRESS, #GDK_KEY_RELEASE,
+ * #GDK_ENTER_NOTIFY, #GDK_LEAVE_NOTIFY, #GDK_FOCUS_CHANGE,
+ * #GDK_PROXIMITY_IN, #GDK_PROXIMITY_OUT, #GDK_DRAG_ENTER, #GDK_DRAG_LEAVE,
+ * #GDK_DRAG_MOTION, #GDK_DRAG_STATUS, #GDK_DROP_START, #GDK_DROP_FINISHED
+ * and #GDK_GRAB_BROKEN.
*
- * , although gdk_window_set_support_multidevice() has to be called on #GdkWindow in order to
- * support additional features of multiple pointer interaction, such as multiple, per-device enter/leave
- * events. The default setting will emit just one enter/leave event pair for all devices on the window.
- * See gdk_window_set_support_multidevice() documentation for more information.
+ * although gdk_window_set_support_multidevice() has to be called on
+ * #GdkWindows in order to support additional features of multiple pointer
+ * interaction, such as multiple, per-device enter/leave events. The default
+ * setting will emit just one enter/leave event pair for all devices on the
+ * window. See gdk_window_set_support_multidevice() documentation for more
+ * information.
*
- * In order to listen for events coming from other than a virtual device, gdk_window_set_device_events()
- * must be called. Generally, this function can be used to modify the event mask for any given device.
+ * In order to listen for events coming from other than a virtual device,
+ * gdk_window_set_device_events() must be called. Generally, this function
+ * can be used to modify the event mask for any given device.
*
- * Input devices may also provide additional information besides X/Y. For example, graphics tablets may
- * also provide pressure and X/Y tilt information. This information is device-dependent, and may be
- * queried through gdk_device_get_axis(). In multidevice mode, virtual devices will change axes in order
- * to always represent the physical device that is routing events through it. Whenever the physical device
- * changes, the #GdkDevice:n-axes property will be notified, and gdk_device_list_axes() will return the
- * new device axes.
+ * Input devices may also provide additional information besides X/Y.
+ * For example, graphics tablets may also provide pressure and X/Y tilt
+ * information. This information is device-dependent, and may be
+ * queried through gdk_device_get_axis(). In multidevice mode, virtual
+ * devices will change axes in order to always represent the physical
+ * device that is routing events through it. Whenever the physical device
+ * changes, the #GdkDevice:n-axes property will be notified, and
+ * gdk_device_list_axes() will return the new device axes.
*
- * Devices may also have associated keys or macro buttons. Such keys can be
- * globally set to map into normal X keyboard events. The mapping is set using gdk_device_set_key().
+ * Devices may also have associated keys or
+ * macro buttons. Such keys can be globally set to map into normal X
+ * keyboard events. The mapping is set using gdk_device_set_key().
*
- * In order to query the device hierarchy and be aware of changes in the device hierarchy (such as
- * virtual devices being created or removed, or physical devices being plugged or unplugged), GDK
- * provides #GdkDeviceManager. On X11, multidevice support is implemented through XInput 2. If
- * gdk_enable_multidevice() is called, the XInput 2.x #GdkDeviceManager implementation will be used
- * as input source, else either the core or XInput 1.x implementations will be used.
+ * In order to query the device hierarchy and be aware of changes in the
+ * device hierarchy (such as virtual devices being created or removed, or
+ * physical devices being plugged or unplugged), GDK provides
+ * #GdkDeviceManager. On X11, multidevice support is implemented through
+ * XInput 2. Unless gdk_disable_multidevice() is called, the XInput 2.x
+ * #GdkDeviceManager implementation will be used as input source, else
+ * either the core or XInput 1.x implementations will be used.
*/
static void gdk_device_manager_set_property (GObject *object,
@@ -116,12 +132,6 @@ enum {
static guint signals [LAST_SIGNAL] = { 0 };
-struct _GdkDeviceManagerPrivate
-{
- GdkDisplay *display;
-};
-
-
static void
gdk_device_manager_class_init (GdkDeviceManagerClass *klass)
{
@@ -182,12 +192,16 @@ gdk_device_manager_class_init (GdkDeviceManagerClass *klass)
* @device_manager: the object on which the signal is emitted
* @device: the #GdkDevice that changed.
*
- * The ::device-changed signal is emitted either when some
- * #GdkDevice has changed the number of either axes or keys.
- * For example In X this will normally happen when the slave
- * device routing events through the master device changes,
- * in that case the master device will change to reflect the
- * new slave device axes and keys.
+ * The ::device-changed signal is emitted whenever a device
+ * has changed in the hierarchy, either slave devices being
+ * disconnected from their master device or connected to
+ * another one, or master devices being added or removed
+ * a slave device.
+ *
+ * If a slave device is detached from all master devices
+ * (gdk_device_get_associated_device() returns %NULL), its
+ * #GdkDeviceType will change to %GDK_DEVICE_TYPE_FLOATING,
+ * if it's attached, it will change to %GDK_DEVICE_TYPE_SLAVE.
*/
signals [DEVICE_CHANGED] =
g_signal_new (g_intern_static_string ("device-changed"),
@@ -198,18 +212,11 @@ gdk_device_manager_class_init (GdkDeviceManagerClass *klass)
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
GDK_TYPE_DEVICE);
-
- g_type_class_add_private (object_class, sizeof (GdkDeviceManagerPrivate));
}
static void
gdk_device_manager_init (GdkDeviceManager *device_manager)
{
- GdkDeviceManagerPrivate *priv;
-
- device_manager->priv = priv = G_TYPE_INSTANCE_GET_PRIVATE (device_manager,
- GDK_TYPE_DEVICE_MANAGER,
- GdkDeviceManagerPrivate);
}
static void
@@ -218,14 +225,10 @@ gdk_device_manager_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GdkDeviceManagerPrivate *priv;
-
- priv = GDK_DEVICE_MANAGER (object)->priv;
-
switch (prop_id)
{
case PROP_DISPLAY:
- priv->display = g_value_get_object (value);
+ GDK_DEVICE_MANAGER (object)->display = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -239,14 +242,11 @@ gdk_device_manager_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GdkDeviceManagerPrivate *priv;
-
- priv = GDK_DEVICE_MANAGER (object)->priv;
switch (prop_id)
{
case PROP_DISPLAY:
- g_value_set_object (value, priv->display);
+ g_value_set_object (value, GDK_DEVICE_MANAGER (object)->display);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -269,13 +269,9 @@ gdk_device_manager_get_property (GObject *object,
GdkDisplay *
gdk_device_manager_get_display (GdkDeviceManager *device_manager)
{
- GdkDeviceManagerPrivate *priv;
-
g_return_val_if_fail (GDK_IS_DEVICE_MANAGER (device_manager), NULL);
- priv = device_manager->priv;
-
- return priv->display;
+ return device_manager->display;
}
/**
diff --git a/gdk/gdkdevicemanager.h b/gdk/gdkdevicemanager.h
index bed2bbba86..d49ef63521 100644
--- a/gdk/gdkdevicemanager.h
+++ b/gdk/gdkdevicemanager.h
@@ -31,47 +31,15 @@ G_BEGIN_DECLS
#define GDK_TYPE_DEVICE_MANAGER (gdk_device_manager_get_type ())
#define GDK_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_MANAGER, GdkDeviceManager))
-#define GDK_DEVICE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_MANAGER, GdkDeviceManagerClass))
#define GDK_IS_DEVICE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_MANAGER))
-#define GDK_IS_DEVICE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_MANAGER))
-#define GDK_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER, GdkDeviceManagerClass))
-typedef struct _GdkDeviceManager GdkDeviceManager;
-typedef struct _GdkDeviceManagerPrivate GdkDeviceManagerPrivate;
-typedef struct _GdkDeviceManagerClass GdkDeviceManagerClass;
-struct _GdkDeviceManager
-{
- GObject parent_instance;
+GType gdk_device_manager_get_type (void) G_GNUC_CONST;
- /*< private >*/
- GdkDeviceManagerPrivate *priv;
-};
-
-struct _GdkDeviceManagerClass
-{
- GObjectClass parent_class;
-
- /* Signals */
- void (* device_added) (GdkDeviceManager *device_manager,
- GdkDevice *device);
- void (* device_removed) (GdkDeviceManager *device_manager,
- GdkDevice *device);
- void (* device_changed) (GdkDeviceManager *device_manager,
- GdkDevice *device);
-
- /* VMethods */
- GList * (* list_devices) (GdkDeviceManager *device_manager,
- GdkDeviceType type);
- GdkDevice * (* get_client_pointer) (GdkDeviceManager *device_manager);
-};
-
-GType gdk_device_manager_get_type (void) G_GNUC_CONST;
-
-GdkDisplay * gdk_device_manager_get_display (GdkDeviceManager *device_manager);
-GList * gdk_device_manager_list_devices (GdkDeviceManager *device_manager,
- GdkDeviceType type);
-GdkDevice * gdk_device_manager_get_client_pointer (GdkDeviceManager *device_manager);
+GdkDisplay * gdk_device_manager_get_display (GdkDeviceManager *device_manager);
+GList * gdk_device_manager_list_devices (GdkDeviceManager *device_manager,
+ GdkDeviceType type);
+GdkDevice * gdk_device_manager_get_client_pointer (GdkDeviceManager *device_manager);
G_END_DECLS
diff --git a/gdk/gdkdevicemanagerprivate.h b/gdk/gdkdevicemanagerprivate.h
new file mode 100644
index 0000000000..df5a046961
--- /dev/null
+++ b/gdk/gdkdevicemanagerprivate.h
@@ -0,0 +1,63 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_DEVICE_MANAGER_PRIVATE_H__
+#define __GDK_DEVICE_MANAGER_PRIVATE_H__
+
+#include "gdkdevicemanager.h"
+
+G_BEGIN_DECLS
+
+
+#define GDK_DEVICE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_MANAGER, GdkDeviceManagerClass))
+#define GDK_IS_DEVICE_MANAGER_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_MANAGER))
+#define GDK_DEVICE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER, GdkDeviceManagerClass))
+
+
+typedef struct _GdkDeviceManagerClass GdkDeviceManagerClass;
+
+struct _GdkDeviceManager
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GdkDisplay *display;
+};
+
+struct _GdkDeviceManagerClass
+{
+ GObjectClass parent_class;
+
+ /* Signals */
+ void (* device_added) (GdkDeviceManager *device_manager,
+ GdkDevice *device);
+ void (* device_removed) (GdkDeviceManager *device_manager,
+ GdkDevice *device);
+ void (* device_changed) (GdkDeviceManager *device_manager,
+ GdkDevice *device);
+
+ /* VMethods */
+ GList * (* list_devices) (GdkDeviceManager *device_manager,
+ GdkDeviceType type);
+ GdkDevice * (* get_client_pointer) (GdkDeviceManager *device_manager);
+};
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/gdkdeviceprivate.h b/gdk/gdkdeviceprivate.h
index d878ae634d..8816576b53 100644
--- a/gdk/gdkdeviceprivate.h
+++ b/gdk/gdkdeviceprivate.h
@@ -20,8 +20,9 @@
#ifndef __GDK_DEVICE_PRIVATE_H__
#define __GDK_DEVICE_PRIVATE_H__
-#include
-#include
+#include "gdkdevice.h"
+#include "gdkdevicemanager.h"
+#include "gdkevents.h"
G_BEGIN_DECLS
@@ -30,22 +31,50 @@ G_BEGIN_DECLS
#define GDK_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE, GdkDeviceClass))
typedef struct _GdkDeviceClass GdkDeviceClass;
+typedef struct _GdkDeviceKey GdkDeviceKey;
+
+struct _GdkDeviceKey
+{
+ guint keyval;
+ GdkModifierType modifiers;
+};
+
+struct _GdkDevice
+{
+ GObject parent_instance;
+
+ gchar *name;
+ GdkInputSource source;
+ GdkInputMode mode;
+ gboolean has_cursor;
+ gint num_keys;
+ GdkDeviceKey *keys;
+ GdkDeviceManager *manager;
+ GdkDisplay *display;
+ /* Paired master for master,
+ * associated master for slaves
+ */
+ GdkDevice *associated;
+ GList *slaves;
+ GdkDeviceType type;
+ GArray *axes;
+};
struct _GdkDeviceClass
{
GObjectClass parent_class;
- gboolean (* get_history) (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events);
+ gboolean (* get_history) (GdkDevice *device,
+ GdkWindow *window,
+ guint32 start,
+ guint32 stop,
+ GdkTimeCoord ***events,
+ gint *n_events);
- void (* get_state) (GdkDevice *device,
- GdkWindow *window,
- gdouble *axes,
- GdkModifierType *mask);
+ void (* get_state) (GdkDevice *device,
+ GdkWindow *window,
+ gdouble *axes,
+ GdkModifierType *mask);
void (* set_window_cursor) (GdkDevice *device,
GdkWindow *window,
@@ -55,10 +84,10 @@ struct _GdkDeviceClass
GdkScreen *screen,
gint x,
gint y);
- gboolean (* query_state) (GdkDevice *device,
- GdkWindow *window,
- GdkWindow **root_window,
- GdkWindow **child_window,
+ gboolean (* query_state) (GdkDevice *device,
+ GdkWindow *window,
+ GdkWindow **root_window,
+ GdkWindow **child_window,
gint *root_x,
gint *root_y,
gint *win_x,
@@ -123,8 +152,24 @@ gboolean _gdk_device_translate_axis (GdkDevice *device,
GdkTimeCoord ** _gdk_device_allocate_history (GdkDevice *device,
gint n_events);
-void _gdk_input_check_extension_events (GdkDevice *device);
-
+void _gdk_device_add_slave (GdkDevice *device,
+ GdkDevice *slave);
+void _gdk_device_remove_slave (GdkDevice *device,
+ GdkDevice *slave);
+gboolean _gdk_device_query_state (GdkDevice *device,
+ GdkWindow *window,
+ GdkWindow **root_window,
+ GdkWindow **child_window,
+ gint *root_x,
+ gint *root_y,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask);
+GdkWindow * _gdk_device_window_at_position (GdkDevice *device,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask,
+ gboolean get_toplevel);
G_END_DECLS
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index d5c01fdc02..fa2e645467 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -24,7 +24,9 @@
#include "config.h"
#include "gdkdisplay.h"
+#include "gdkdisplayprivate.h"
+#include "gdkdeviceprivate.h"
#include "gdkevents.h"
#include "gdkwindowimpl.h"
#include "gdkinternals.h"
@@ -32,7 +34,6 @@
#include "gdkscreen.h"
#include
-#include
/**
@@ -69,106 +70,11 @@ enum {
static void gdk_display_dispose (GObject *object);
static void gdk_display_finalize (GObject *object);
-static void multihead_get_device_state (GdkDisplay *display,
- GdkDevice *device,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow * multihead_window_get_device_position (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow * multihead_window_at_device_position (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y);
-static void multihead_default_get_pointer (GdkDisplay *display,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow * multihead_default_window_get_pointer (GdkDisplay *display,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow * multihead_default_window_at_pointer (GdkDisplay *display,
- gint *win_x,
- gint *win_y);
-
-
-static void singlehead_get_pointer (GdkDisplay *display,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow* singlehead_window_get_pointer (GdkDisplay *display,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow* singlehead_window_at_pointer (GdkDisplay *display,
- gint *win_x,
- gint *win_y);
-
-static GdkWindow* singlehead_default_window_get_pointer (GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow* singlehead_default_window_at_pointer (GdkScreen *screen,
- gint *win_x,
- gint *win_y);
-static GdkWindow *gdk_window_real_window_get_device_position (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-static GdkWindow *gdk_display_real_get_window_at_device_position (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y);
+static GdkAppLaunchContext *gdk_display_real_get_app_launch_context (GdkDisplay *display);
static guint signals[LAST_SIGNAL] = { 0 };
-static char *gdk_sm_client_id;
-
-static const GdkDisplayDeviceHooks default_device_hooks = {
- _gdk_windowing_get_device_state,
- gdk_window_real_window_get_device_position,
- gdk_display_real_get_window_at_device_position
-};
-
-static const GdkDisplayDeviceHooks multihead_pointer_hooks = {
- multihead_get_device_state,
- multihead_window_get_device_position,
- multihead_window_at_device_position
-};
-
-static const GdkDisplayPointerHooks multihead_default_pointer_hooks = {
- multihead_default_get_pointer,
- multihead_default_window_get_pointer,
- multihead_default_window_at_pointer
-};
-
-static const GdkDisplayPointerHooks singlehead_pointer_hooks = {
- singlehead_get_pointer,
- singlehead_window_get_pointer,
- singlehead_window_at_pointer
-};
-
-static const GdkPointerHooks singlehead_default_pointer_hooks = {
- singlehead_default_window_get_pointer,
- singlehead_default_window_at_pointer
-};
-
-static const GdkPointerHooks *singlehead_current_pointer_hooks = &singlehead_default_pointer_hooks;
-static const GdkDisplayPointerHooks *multihead_current_pointer_hooks = &multihead_default_pointer_hooks;
-
G_DEFINE_TYPE (GdkDisplay, gdk_display, G_TYPE_OBJECT)
static void
@@ -179,6 +85,9 @@ gdk_display_class_init (GdkDisplayClass *class)
object_class->finalize = gdk_display_finalize;
object_class->dispose = gdk_display_dispose;
+ class->get_app_launch_context = gdk_display_real_get_app_launch_context;
+ class->window_type = GDK_TYPE_WINDOW;
+
/**
* GdkDisplay::opened:
* @display: the object on which the signal is emitted
@@ -270,13 +179,9 @@ gdk_display_opened (GdkDisplay *display)
static void
gdk_display_init (GdkDisplay *display)
{
- _gdk_displays = g_slist_prepend (_gdk_displays, display);
-
display->double_click_time = 250;
display->double_click_distance = 5;
- display->device_hooks = &default_device_hooks;
-
display->device_grabs = g_hash_table_new (NULL, NULL);
display->motion_hint_info = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) g_free);
@@ -294,28 +199,16 @@ gdk_display_init (GdkDisplay *display)
static void
gdk_display_dispose (GObject *object)
{
- GdkDisplay *display = GDK_DISPLAY_OBJECT (object);
+ GdkDisplay *display = GDK_DISPLAY (object);
GdkDeviceManager *device_manager;
- device_manager = gdk_display_get_device_manager (GDK_DISPLAY_OBJECT (object));
+ device_manager = gdk_display_get_device_manager (GDK_DISPLAY (object));
g_list_foreach (display->queued_events, (GFunc)gdk_event_free, NULL);
g_list_free (display->queued_events);
display->queued_events = NULL;
display->queued_tail = NULL;
- _gdk_displays = g_slist_remove (_gdk_displays, object);
-
- if (gdk_display_get_default () == display)
- {
- if (_gdk_displays)
- gdk_display_manager_set_default_display (gdk_display_manager_get(),
- _gdk_displays->data);
- else
- gdk_display_manager_set_default_display (gdk_display_manager_get(),
- NULL);
- }
-
if (device_manager)
{
/* this is to make it drop devices which may require using the X
@@ -331,7 +224,7 @@ gdk_display_dispose (GObject *object)
static void
gdk_display_finalize (GObject *object)
{
- GdkDisplay *display = GDK_DISPLAY_OBJECT (object);
+ GdkDisplay *display = GDK_DISPLAY (object);
g_hash_table_foreach_remove (display->device_grabs,
free_device_grabs_foreach,
@@ -406,8 +299,8 @@ GdkEvent*
gdk_display_get_event (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-
- _gdk_events_queue (display);
+
+ GDK_DISPLAY_GET_CLASS (display)->queue_events (display);
return _gdk_event_unqueue (display);
}
@@ -607,6 +500,29 @@ gdk_beep (void)
gdk_display_beep (gdk_display_get_default ());
}
+/**
+ * gdk_flush:
+ *
+ * Flushes the output buffers of all display connections and waits
+ * until all requests have been processed.
+ * This is rarely needed by applications.
+ */
+void
+gdk_flush (void)
+{
+ GSList *list, *l;
+
+ list = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ for (l = list; l; l = l->next)
+ {
+ GdkDisplay *display = l->data;
+
+ GDK_DISPLAY_GET_CLASS (display)->sync (display);
+ }
+
+ g_slist_free (list);
+}
+
/**
* gdk_event_send_client_message:
* @event: the #GdkEvent to send, which should be a #GdkEventClient.
@@ -649,88 +565,6 @@ gdk_event_send_clientmessage_toall (GdkEvent *event)
gdk_screen_broadcast_client_message (gdk_screen_get_default (), event);
}
-/**
- * gdk_device_get_core_pointer:
- *
- * Returns the core pointer device for the default display.
- *
- * Return value: (transfer none): the core pointer device; this is owned
- * by the display and should not be freed.
- *
- * Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
- * gdk_event_get_device() if a #GdkEvent with pointer device
- * information is available.
- **/
-GdkDevice *
-gdk_device_get_core_pointer (void)
-{
- return gdk_display_get_core_pointer (gdk_display_get_default ());
-}
-
-/**
- * gdk_display_get_core_pointer:
- * @display: a #GdkDisplay
- *
- * Returns the core pointer device for the given display
- *
- * Return value: (transfer none): the core pointer device; this is owned by the
- * display and should not be freed.
- *
- * Since: 2.2
- *
- * Deprecated: 3.0: Use gdk_device_manager_get_client_pointer() instead, or
- * gdk_event_get_device() if a #GdkEvent with device
- * information is available.
- **/
-GdkDevice *
-gdk_display_get_core_pointer (GdkDisplay *display)
-{
- return display->core_pointer;
-}
-
-/**
- * gdk_set_sm_client_id:
- * @sm_client_id: the client id assigned by the session manager when the
- * connection was opened, or %NULL to remove the property.
- *
- * Sets the SM_CLIENT_ID property on the application's leader window so that
- * the window manager can save the application's state using the X11R6 ICCCM
- * session management protocol.
- *
- * See the X Session Management Library documentation for more information on
- * session management and the Inter-Client Communication Conventions Manual
- * (ICCCM) for information on the WM_CLIENT_LEADER property.
- * (Both documents are part of the X Window System distribution.)
- **/
-void
-gdk_set_sm_client_id (const gchar* sm_client_id)
-{
- GSList *displays, *tmp_list;
-
- g_free (gdk_sm_client_id);
- gdk_sm_client_id = g_strdup (sm_client_id);
-
- displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
- for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
- _gdk_windowing_display_set_sm_client_id (tmp_list->data, sm_client_id);
-
- g_slist_free (displays);
-}
-
-/**
- * _gdk_get_sm_client_id:
- *
- * Gets the client ID set with gdk_set_sm_client_id(), if any.
- *
- * Return value: Session ID, or %NULL if gdk_set_sm_client_id()
- * has never been called.
- **/
-const char *
-_gdk_get_sm_client_id (void)
-{
- return gdk_sm_client_id;
-}
-
void
_gdk_display_enable_motion_hints (GdkDisplay *display,
GdkDevice *device)
@@ -748,7 +582,7 @@ _gdk_display_enable_motion_hints (GdkDisplay *display,
if (*device_serial != 0)
{
- serial = _gdk_windowing_window_get_next_serial (display);
+ serial = _gdk_display_get_next_serial (display);
/* We might not actually generate the next request, so
make sure this triggers always, this may cause it to
trigger slightly too early, but this is just a hint
@@ -760,113 +594,6 @@ _gdk_display_enable_motion_hints (GdkDisplay *display,
}
}
-/**
- * gdk_display_get_device_state:
- * @display: a #GdkDisplay.
- * @device: device to query status to.
- * @screen: location to store the #GdkScreen the @device is on, or %NULL.
- * @x: location to store root window X coordinate of @device, or %NULL.
- * @y: location to store root window Y coordinate of @device, or %NULL.
- * @mask: location to store current modifier mask for @device, or %NULL.
- *
- * Gets the current location and state of @device for a given display.
- *
- * Since: 3.0
- **/
-void
-gdk_display_get_device_state (GdkDisplay *display,
- GdkDevice *device,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkScreen *tmp_screen;
- gint tmp_x, tmp_y;
- GdkModifierType tmp_mask;
-
- g_return_if_fail (GDK_IS_DISPLAY (display));
- g_return_if_fail (GDK_IS_DEVICE (device));
-
- display->device_hooks->get_device_state (display, device, &tmp_screen, &tmp_x, &tmp_y, &tmp_mask);
-
- if (screen)
- *screen = tmp_screen;
- if (x)
- *x = tmp_x;
- if (y)
- *y = tmp_y;
- if (mask)
- *mask = tmp_mask;
-}
-
-/**
- * gdk_display_get_window_at_device_position:
- * @display: a #GdkDisplay.
- * @device: #GdkDevice to query info to.
- * @win_x: return location for the X coordinate of the device location, relative to the window origin, or %NULL.
- * @win_y: return location for the Y coordinate of the device location, relative to the window origin, or %NULL.
- *
- * Obtains the window underneath @device, returning the location of the device in @win_x and @win_y. Returns
- * %NULL if the window tree under @device is not known to GDK (for example, belongs to another application).
- *
- * Returns: (transfer none): the #GdkWindow under the device position, or %NULL.
- *
- * Since: 3.0
- **/
-GdkWindow *
-gdk_display_get_window_at_device_position (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y)
-{
- gint tmp_x, tmp_y;
- GdkWindow *window;
-
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
-
- window = display->device_hooks->window_at_device_position (display, device, &tmp_x, &tmp_y);
-
- if (win_x)
- *win_x = tmp_x;
- if (win_y)
- *win_y = tmp_y;
-
- return window;
-}
-
-/**
- * gdk_display_set_device_hooks:
- * @display: a #GdkDisplay.
- * @new_hooks: a table of pointers to functions for getting quantities related to all
- * devices position, or %NULL to restore the default table.
- *
- * This function allows for hooking into the operation of getting the current location of any
- * #GdkDevice on a particular #GdkDisplay. This is only useful for such low-level tools as
- * an event recorder. Applications should never have any reason to use this facility.
- *
- * Returns: (transfer none): The previous device hook table.
- *
- * Since: 3.0
- **/
-GdkDisplayDeviceHooks *
-gdk_display_set_device_hooks (GdkDisplay *display,
- const GdkDisplayDeviceHooks *new_hooks)
-{
- const GdkDisplayDeviceHooks *result;
-
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- result = display->device_hooks;
-
- if (new_hooks)
- display->device_hooks = new_hooks;
- else
- display->device_hooks = &default_device_hooks;
-
- return (GdkDisplayDeviceHooks *) result;
-}
-
/**
* gdk_display_get_pointer:
* @display: a #GdkDisplay
@@ -881,7 +608,7 @@ gdk_display_set_device_hooks (GdkDisplay *display,
*
* Since: 2.2
*
- * Deprecated: 3.0: Use gdk_display_get_device_state() instead.
+ * Deprecated: 3.0: Use gdk_device_get_position() instead.
**/
void
gdk_display_get_pointer (GdkDisplay *display,
@@ -890,71 +617,36 @@ gdk_display_get_pointer (GdkDisplay *display,
gint *y,
GdkModifierType *mask)
{
+ GdkScreen *default_screen;
+ GdkWindow *root;
+ gint tmp_x, tmp_y;
+ GdkModifierType tmp_mask;
+
g_return_if_fail (GDK_IS_DISPLAY (display));
- gdk_display_get_device_state (display, display->core_pointer, screen, x, y, mask);
-}
+ if (gdk_display_is_closed (display))
+ return;
-static GdkWindow *
-gdk_display_real_get_window_at_device_position (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y)
-{
- GdkWindow *window;
- gint x, y;
+ default_screen = gdk_display_get_default_screen (display);
- window = _gdk_windowing_window_at_device_position (display, device, &x, &y, NULL, FALSE);
+ /* We call _gdk_device_query_state() here manually instead of
+ * gdk_device_get_position() because we care about the modifier mask */
- /* This might need corrections, as the native window returned
- may contain client side children */
- if (window)
- {
- double xx, yy;
-
- window = _gdk_window_find_descendant_at (window,
- x, y,
- &xx, &yy);
- x = floor (xx + 0.5);
- y = floor (yy + 0.5);
- }
-
- *win_x = x;
- *win_y = y;
-
- return window;
-}
-
-static GdkWindow *
-gdk_window_real_window_get_device_position (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- gint tmpx, tmpy;
- GdkModifierType tmp_mask;
- gboolean normal_child;
-
- normal_child = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_device_state (window,
- device,
- &tmpx, &tmpy,
- &tmp_mask);
- /* We got the coords on the impl, convert to the window */
- tmpx -= window->abs_x;
- tmpy -= window->abs_y;
+ _gdk_device_query_state (display->core_pointer,
+ gdk_screen_get_root_window (default_screen),
+ &root, NULL,
+ &tmp_x, &tmp_y,
+ NULL, NULL,
+ &tmp_mask);
+ if (screen)
+ *screen = gdk_window_get_screen (root);
if (x)
- *x = tmpx;
+ *x = tmp_x;
if (y)
- *y = tmpy;
+ *y = tmp_y;
if (mask)
*mask = tmp_mask;
-
- if (normal_child)
- return _gdk_window_find_child_at (window, tmpx, tmpy);
- return NULL;
}
/**
@@ -974,7 +666,7 @@ gdk_window_real_window_get_device_position (GdkDisplay *display,
*
* Since: 2.2
*
- * Deprecated: 3.0: Use gdk_display_get_window_at_device_position() instead.
+ * Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
**/
GdkWindow *
gdk_display_get_window_at_pointer (GdkDisplay *display,
@@ -983,209 +675,7 @@ gdk_display_get_window_at_pointer (GdkDisplay *display,
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- return gdk_display_get_window_at_device_position (display, display->core_pointer, win_x, win_y);
-}
-
-static void
-multihead_get_device_state (GdkDisplay *display,
- GdkDevice *device,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- multihead_current_pointer_hooks->get_pointer (display, screen, x, y, mask);
-}
-
-static GdkWindow *
-multihead_window_get_device_position (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- return multihead_current_pointer_hooks->window_get_pointer (display, window, x, y, mask);
-}
-
-static GdkWindow *
-multihead_window_at_device_position (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y)
-{
- return multihead_current_pointer_hooks->window_at_pointer (display, win_x, win_y);
-}
-
-static void
-multihead_default_get_pointer (GdkDisplay *display,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- return _gdk_windowing_get_device_state (display,
- display->core_pointer,
- screen, x, y, mask);
-}
-
-static GdkWindow *
-multihead_default_window_get_pointer (GdkDisplay *display,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- return gdk_window_real_window_get_device_position (display,
- display->core_pointer,
- window, x, y, mask);
-}
-
-static GdkWindow *
-multihead_default_window_at_pointer (GdkDisplay *display,
- gint *win_x,
- gint *win_y)
-{
- return gdk_display_real_get_window_at_device_position (display,
- display->core_pointer,
- win_x, win_y);
-}
-
-/**
- * gdk_display_set_pointer_hooks:
- * @display: a #GdkDisplay
- * @new_hooks: a table of pointers to functions for getting
- * quantities related to the current pointer position,
- * or %NULL to restore the default table.
- *
- * This function allows for hooking into the operation
- * of getting the current location of the pointer on a particular
- * display. This is only useful for such low-level tools as an
- * event recorder. Applications should never have any
- * reason to use this facility.
- *
- * Return value: (transfer none): the previous pointer hook table
- *
- * Since: 2.2
- *
- * Deprecated: 3.0: Use gdk_display_set_device_hooks() instead.
- **/
-GdkDisplayPointerHooks *
-gdk_display_set_pointer_hooks (GdkDisplay *display,
- const GdkDisplayPointerHooks *new_hooks)
-{
- const GdkDisplayPointerHooks *result = multihead_current_pointer_hooks;
-
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
-
- if (new_hooks)
- multihead_current_pointer_hooks = new_hooks;
- else
- multihead_current_pointer_hooks = &multihead_default_pointer_hooks;
-
- gdk_display_set_device_hooks (display, &multihead_pointer_hooks);
-
- return (GdkDisplayPointerHooks *)result;
-}
-
-static void
-singlehead_get_pointer (GdkDisplay *display,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkScreen *default_screen = gdk_display_get_default_screen (display);
- GdkWindow *root_window = gdk_screen_get_root_window (default_screen);
-
- *screen = default_screen;
-
- singlehead_current_pointer_hooks->get_pointer (root_window, x, y, mask);
-}
-
-static GdkWindow*
-singlehead_window_get_pointer (GdkDisplay *display,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- return singlehead_current_pointer_hooks->get_pointer (window, x, y, mask);
-}
-
-static GdkWindow*
-singlehead_window_at_pointer (GdkDisplay *display,
- gint *win_x,
- gint *win_y)
-{
- GdkScreen *default_screen = gdk_display_get_default_screen (display);
-
- return singlehead_current_pointer_hooks->window_at_pointer (default_screen,
- win_x, win_y);
-}
-
-static GdkWindow*
-singlehead_default_window_get_pointer (GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkDisplay *display;
-
- display = gdk_window_get_display (window);
-
- return gdk_window_real_window_get_device_position (display,
- display->core_pointer,
- window, x, y, mask);
-}
-
-static GdkWindow*
-singlehead_default_window_at_pointer (GdkScreen *screen,
- gint *win_x,
- gint *win_y)
-{
- GdkDisplay *display;
-
- display = gdk_screen_get_display (screen);
-
- return gdk_display_real_get_window_at_device_position (display,
- display->core_pointer,
- win_x, win_y);
-}
-
-/**
- * gdk_set_pointer_hooks:
- * @new_hooks: a table of pointers to functions for getting
- * quantities related to the current pointer position,
- * or %NULL to restore the default table.
- *
- * This function allows for hooking into the operation
- * of getting the current location of the pointer. This
- * is only useful for such low-level tools as an
- * event recorder. Applications should never have any
- * reason to use this facility.
- *
- * This function is not multihead safe. For multihead operation,
- * see gdk_display_set_pointer_hooks().
- *
- * Return value: the previous pointer hook table
- *
- * Deprecated: 3.0: Use gdk_display_set_device_hooks() instead.
- **/
-GdkPointerHooks *
-gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks)
-{
- const GdkPointerHooks *result = singlehead_current_pointer_hooks;
-
- if (new_hooks)
- singlehead_current_pointer_hooks = new_hooks;
- else
- singlehead_current_pointer_hooks = &singlehead_default_pointer_hooks;
-
- gdk_display_set_pointer_hooks (gdk_display_get_default (),
- &singlehead_pointer_hooks);
-
- return (GdkPointerHooks *)result;
+ return gdk_device_get_window_at_position (display->core_pointer, win_x, win_y);
}
static void
@@ -1299,6 +789,7 @@ _gdk_display_add_device_grab (GdkDisplay *display,
static void
synthesize_crossing_events (GdkDisplay *display,
GdkDevice *device,
+ GdkDevice *source_device,
GdkWindow *src_window,
GdkWindow *dest_window,
GdkCrossingMode crossing_mode,
@@ -1334,7 +825,7 @@ synthesize_crossing_events (GdkDisplay *display,
_gdk_synthesize_crossing_events (display,
src_window,
dest_window,
- device,
+ device, source_device,
crossing_mode,
x, y, state,
time,
@@ -1348,7 +839,7 @@ synthesize_crossing_events (GdkDisplay *display,
_gdk_synthesize_crossing_events (display,
src_window,
NULL,
- device,
+ device, source_device,
crossing_mode,
x, y, state,
time,
@@ -1363,7 +854,7 @@ synthesize_crossing_events (GdkDisplay *display,
_gdk_synthesize_crossing_events (display,
src_window,
NULL,
- device,
+ device, source_device,
crossing_mode,
x, y, state,
time,
@@ -1374,7 +865,7 @@ synthesize_crossing_events (GdkDisplay *display,
_gdk_synthesize_crossing_events (display,
NULL,
dest_window,
- device,
+ device, source_device,
crossing_mode,
x, y, state,
time,
@@ -1394,7 +885,7 @@ get_current_toplevel (GdkDisplay *display,
int x, y;
GdkModifierType state;
- pointer_window = _gdk_windowing_window_at_device_position (display, device, &x, &y, &state, TRUE);
+ pointer_window = _gdk_device_window_at_position (device, &x, &y, &state, TRUE);
if (pointer_window != NULL &&
(GDK_WINDOW_DESTROYED (pointer_window) ||
@@ -1405,12 +896,14 @@ get_current_toplevel (GdkDisplay *display,
*x_out = x;
*y_out = y;
*state_out = state;
+
return pointer_window;
}
static void
switch_to_pointer_grab (GdkDisplay *display,
GdkDevice *device,
+ GdkDevice *source_device,
GdkDeviceGrabInfo *grab,
GdkDeviceGrabInfo *last_grab,
guint32 time,
@@ -1446,7 +939,7 @@ switch_to_pointer_grab (GdkDisplay *display,
src_window = info->window_under_pointer;
if (src_window != grab->window)
- synthesize_crossing_events (display, device,
+ synthesize_crossing_events (display, device, source_device,
src_window, grab->window,
GDK_CROSSING_GRAB, time, serial);
@@ -1497,7 +990,7 @@ switch_to_pointer_grab (GdkDisplay *display,
}
if (pointer_window != last_grab->window)
- synthesize_crossing_events (display, device,
+ synthesize_crossing_events (display, device, source_device,
last_grab->window, pointer_window,
GDK_CROSSING_UNGRAB, time, serial);
@@ -1512,6 +1005,7 @@ switch_to_pointer_grab (GdkDisplay *display,
void
_gdk_display_device_grab_update (GdkDisplay *display,
GdkDevice *device,
+ GdkDevice *source_device,
gulong current_serial)
{
GdkDeviceGrabInfo *current_grab, *next_grab;
@@ -1536,7 +1030,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
if (!current_grab->activated)
{
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
- switch_to_pointer_grab (display, device, current_grab, NULL, time, current_serial);
+ switch_to_pointer_grab (display, device, source_device, current_grab, NULL, time, current_serial);
}
break;
@@ -1564,7 +1058,7 @@ _gdk_display_device_grab_update (GdkDisplay *display,
g_hash_table_insert (display->device_grabs, device, grabs);
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
- switch_to_pointer_grab (display, device,
+ switch_to_pointer_grab (display, device, source_device,
next_grab, current_grab,
time, current_serial);
@@ -1745,8 +1239,8 @@ _gdk_display_pointer_info_foreach (GdkDisplay *display,
* gdk_device_grab_info_libgtk_only:
* @display: the display for which to get the grab information
* @device: device to get the grab information from
- * @grab_window: location to store current grab window
- * @owner_events: location to store boolean indicating whether
+ * @grab_window: (out) (transfer none): location to store current grab window
+ * @owner_events: (out): location to store boolean indicating whether
* the @owner_events flag to gdk_keyboard_grab() or
* gdk_pointer_grab() was %TRUE.
*
@@ -1862,3 +1356,862 @@ gdk_display_get_device_manager (GdkDisplay *display)
return display->device_manager;
}
+
+/**
+ * gdk_display_get_name:
+ * @display: a #GdkDisplay
+ *
+ * Gets the name of the display.
+ *
+ * Returns: a string representing the display name. This string is owned
+ * by GDK and should not be modified or freed.
+ *
+ * Since: 2.2
+ */
+G_CONST_RETURN gchar *
+gdk_display_get_name (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->get_name (display);
+}
+
+gchar *
+gdk_get_display (void)
+{
+ return g_strdup (gdk_display_get_name (gdk_display_get_default ()));
+}
+
+/**
+ * gdk_display_get_n_screens:
+ * @display: a #GdkDisplay
+ *
+ * Gets the number of screen managed by the @display.
+ *
+ * Returns: number of screens.
+ *
+ * Since: 2.2
+ */
+gint
+gdk_display_get_n_screens (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->get_n_screens (display);
+}
+
+/**
+ * gdk_display_get_screen:
+ * @display: a #GdkDisplay
+ * @screen_num: the screen number
+ *
+ * Returns a screen object for one of the screens of the display.
+ *
+ * Returns: (transfer none): the #GdkScreen object
+ *
+ * Since: 2.2
+ */
+GdkScreen *
+gdk_display_get_screen (GdkDisplay *display,
+ gint screen_num)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->get_screen (display, screen_num);
+}
+
+/**
+ * gdk_display_get_default_screen:
+ * @display: a #GdkDisplay
+ *
+ * Get the default #GdkScreen for @display.
+ *
+ * Returns: (transfer none): the default #GdkScreen object for @display
+ *
+ * Since: 2.2
+ */
+GdkScreen *
+gdk_display_get_default_screen (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->get_default_screen (display);
+}
+
+/**
+ * gdk_display_beep:
+ * @display: a #GdkDisplay
+ *
+ * Emits a short beep on @display
+ *
+ * Since: 2.2
+ */
+void
+gdk_display_beep (GdkDisplay *display)
+{
+ GDK_DISPLAY_GET_CLASS(display)->beep (display);
+}
+
+/**
+ * gdk_display_sync:
+ * @display: a #GdkDisplay
+ *
+ * Flushes any requests queued for the windowing system and waits until all
+ * requests have been handled. This is often used for making sure that the
+ * display is synchronized with the current state of the program. Calling
+ * gdk_display_sync() before gdk_error_trap_pop() makes sure that any errors
+ * generated from earlier requests are handled before the error trap is
+ * removed.
+ *
+ * This is most useful for X11. On windowing systems where requests are
+ * handled synchronously, this function will do nothing.
+ *
+ * Since: 2.2
+ */
+void
+gdk_display_sync (GdkDisplay *display)
+{
+ GDK_DISPLAY_GET_CLASS(display)->sync (display);
+}
+
+/**
+ * gdk_display_flush:
+ * @display: a #GdkDisplay
+ *
+ * Flushes any requests queued for the windowing system; this happens automatically
+ * when the main loop blocks waiting for new events, but if your application
+ * is drawing without returning control to the main loop, you may need
+ * to call this function explicitely. A common case where this function
+ * needs to be called is when an application is executing drawing commands
+ * from a thread other than the thread where the main loop is running.
+ *
+ * This is most useful for X11. On windowing systems where requests are
+ * handled synchronously, this function will do nothing.
+ *
+ * Since: 2.4
+ */
+void
+gdk_display_flush (GdkDisplay *display)
+{
+ GDK_DISPLAY_GET_CLASS(display)->flush (display);
+}
+
+/**
+ * gdk_display_get_default_group:
+ * @display: a #GdkDisplay
+ *
+ * Returns the default group leader window for all toplevel windows
+ * on @display. This window is implicitly created by GDK.
+ * See gdk_window_set_group().
+ *
+ * Return value: (transfer none): The default group leader window
+ * for @display
+ *
+ * Since: 2.4
+ **/
+GdkWindow *
+gdk_display_get_default_group (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->get_default_group (display);
+}
+
+/**
+ * gdk_display_supports_selection_notification:
+ * @display: a #GdkDisplay
+ *
+ * Returns whether #GdkEventOwnerChange events will be
+ * sent when the owner of a selection changes.
+ *
+ * Return value: whether #GdkEventOwnerChange events will
+ * be sent.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gdk_display_supports_selection_notification (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->supports_selection_notification (display);
+}
+
+/**
+ * gdk_display_request_selection_notification:
+ * @display: a #GdkDisplay
+ * @selection: the #GdkAtom naming the selection for which
+ * ownership change notification is requested
+ *
+ * Request #GdkEventOwnerChange events for ownership changes
+ * of the selection named by the given atom.
+ *
+ * Return value: whether #GdkEventOwnerChange events will
+ * be sent.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gdk_display_request_selection_notification (GdkDisplay *display,
+ GdkAtom selection)
+
+{
+ return GDK_DISPLAY_GET_CLASS(display)->request_selection_notification (display, selection);
+}
+
+/**
+ * gdk_display_supports_clipboard_persistence
+ * @display: a #GdkDisplay
+ *
+ * Returns whether the speicifed display supports clipboard
+ * persistance; i.e. if it's possible to store the clipboard data after an
+ * application has quit. On X11 this checks if a clipboard daemon is
+ * running.
+ *
+ * Returns: %TRUE if the display supports clipboard persistance.
+ *
+ * Since: 2.6
+ */
+gboolean
+gdk_display_supports_clipboard_persistence (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->supports_clipboard_persistence (display);
+}
+
+/**
+ * gdk_display_store_clipboard
+ * @display: a #GdkDisplay
+ * @clipboard_window: a #GdkWindow belonging to the clipboard owner
+ * @time_: a timestamp
+ * @targets: an array of targets that should be saved, or %NULL
+ * if all available targets should be saved.
+ * @n_targets: length of the @targets array
+ *
+ * Issues a request to the clipboard manager to store the
+ * clipboard data. On X11, this is a special program that works
+ * according to the freedesktop clipboard specification, available at
+ *
+ * http://www.freedesktop.org/Standards/clipboard-manager-spec .
+ *
+ * Since: 2.6
+ */
+void
+gdk_display_store_clipboard (GdkDisplay *display,
+ GdkWindow *clipboard_window,
+ guint32 time_,
+ const GdkAtom *targets,
+ gint n_targets)
+{
+ GDK_DISPLAY_GET_CLASS(display)->store_clipboard (display, clipboard_window, time_, targets, n_targets);
+}
+
+/**
+ * gdk_display_supports_shapes:
+ * @display: a #GdkDisplay
+ *
+ * Returns %TRUE if gdk_window_shape_combine_mask() can
+ * be used to create shaped windows on @display.
+ *
+ * Returns: %TRUE if shaped windows are supported
+ *
+ * Since: 2.10
+ */
+gboolean
+gdk_display_supports_shapes (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->supports_shapes (display);
+}
+
+/**
+ * gdk_display_supports_input_shapes:
+ * @display: a #GdkDisplay
+ *
+ * Returns %TRUE if gdk_window_input_shape_combine_mask() can
+ * be used to modify the input shape of windows on @display.
+ *
+ * Returns: %TRUE if windows with modified input shape are supported
+ *
+ * Since: 2.10
+ */
+gboolean
+gdk_display_supports_input_shapes (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->supports_input_shapes (display);
+}
+
+/**
+ * gdk_display_supports_composite:
+ * @display: a #GdkDisplay
+ *
+ * Returns %TRUE if gdk_window_set_composited() can be used
+ * to redirect drawing on the window using compositing.
+ *
+ * Currently this only works on X11 with XComposite and
+ * XDamage extensions available.
+ *
+ * Returns: %TRUE if windows may be composited.
+ *
+ * Since: 2.12
+ */
+gboolean
+gdk_display_supports_composite (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->supports_composite (display);
+}
+
+/**
+ * gdk_display_list_devices:
+ * @display: a #GdkDisplay
+ *
+ * Returns the list of available input devices attached to @display.
+ * The list is statically allocated and should not be freed.
+ *
+ * Return value: (transfer none) (element-type GdkDevice):
+ * a list of #GdkDevice
+ *
+ * Since: 2.2
+ *
+ * Deprecated: 3.0: Use gdk_device_manager_list_devices() instead.
+ **/
+GList *
+gdk_display_list_devices (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->list_devices (display);
+}
+
+/**
+ * gdk_event_send_client_message_for_display:
+ * @display: the #GdkDisplay for the window where the message is to be sent.
+ * @event: the #GdkEvent to send, which should be a #GdkEventClient.
+ * @winid: the window to send the client message to.
+ *
+ * On X11, sends an X ClientMessage event to a given window. On
+ * Windows, sends a message registered with the name
+ * GDK_WIN32_CLIENT_MESSAGE.
+ *
+ * This could be used for communicating between different
+ * applications, though the amount of data is limited to 20 bytes on
+ * X11, and to just four bytes on Windows.
+ *
+ * Returns: non-zero on success.
+ *
+ * Since: 2.2
+ */
+gboolean
+gdk_event_send_client_message_for_display (GdkDisplay *display,
+ GdkEvent *event,
+ GdkNativeWindow winid)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->send_client_message (display, event, winid);
+}
+
+/**
+ * gdk_display_add_client_message_filter:
+ * @display: a #GdkDisplay for which this message filter applies
+ * @message_type: the type of ClientMessage events to receive.
+ * This will be checked against the @message_type field
+ * of the XClientMessage event struct.
+ * @func: the function to call to process the event.
+ * @data: user data to pass to @func.
+ *
+ * Adds a filter to be called when X ClientMessage events are received.
+ * See gdk_window_add_filter() if you are interested in filtering other
+ * types of events.
+ *
+ * Since: 2.2
+ **/
+void
+gdk_display_add_client_message_filter (GdkDisplay *display,
+ GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data)
+{
+ GDK_DISPLAY_GET_CLASS(display)->add_client_message_filter (display, message_type, func, data);
+}
+
+/**
+ * gdk_add_client_message_filter:
+ * @message_type: the type of ClientMessage events to receive. This will be
+ * checked against the message_type field of the
+ * XClientMessage event struct.
+ * @func: the function to call to process the event.
+ * @data: user data to pass to @func.
+ *
+ * Adds a filter to the default display to be called when X ClientMessage events
+ * are received. See gdk_display_add_client_message_filter().
+ **/
+void
+gdk_add_client_message_filter (GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data)
+{
+ gdk_display_add_client_message_filter (gdk_display_get_default (),
+ message_type, func, data);
+}
+
+static GdkAppLaunchContext *
+gdk_display_real_get_app_launch_context (GdkDisplay *display)
+{
+ GdkAppLaunchContext *ctx;
+
+ ctx = g_object_new (GDK_TYPE_APP_LAUNCH_CONTEXT,
+ "display", display,
+ NULL);
+
+ return ctx;
+}
+
+/**
+ * gdk_display_get_app_launch_context:
+ * @display: a #GdkDisplay
+ *
+ * Returns a #GdkAppLaunchContext suitable for launching
+ * applications on the given display.
+ *
+ * Returns: a new #GdkAppLaunchContext for @display.
+ * Free with g_object_unref() when done
+ *
+ * Since: 3.0
+ */
+GdkAppLaunchContext *
+gdk_display_get_app_launch_context (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS(display)->get_app_launch_context (display);
+}
+
+/**
+ * gdk_drag_get_protocol_for_display:
+ * @display: the #GdkDisplay where the destination window resides
+ * @xid: the windowing system id of the destination window.
+ * @protocol: location where the supported DND protocol is returned.
+ *
+ * Finds out the DND protocol supported by a window.
+ *
+ * Return value: the windowing system id of the window where the drop
+ * should happen. This may be @xid or the id of a proxy window,
+ * or zero if @xid does not support Drag and Drop.
+ *
+ * Since: 2.2
+ */
+GdkNativeWindow
+gdk_drag_get_protocol_for_display (GdkDisplay *display,
+ GdkNativeWindow xid,
+ GdkDragProtocol *protocol)
+{
+ return GDK_DISPLAY_GET_CLASS (display)->get_drag_protocol (display, xid, protocol, NULL);
+}
+
+/**
+ * gdk_display_open:
+ * @display_name: the name of the display to open
+ *
+ * Opens a display.
+ *
+ * Return value: (transfer none): a #GdkDisplay, or %NULL
+ * if the display could not be opened
+ *
+ * Since: 2.2
+ */
+GdkDisplay *
+gdk_display_open (const gchar *display_name)
+{
+ return gdk_display_manager_open_display (gdk_display_manager_get (), display_name);
+}
+
+/**
+ * gdk_display_has_pending:
+ * @display: a #GdkDisplay
+ *
+ * Returns whether the display has events that are waiting
+ * to be processed.
+ *
+ * Returns: %TRUE if there are events ready to be processed.
+ *
+ * Since: 3.0
+ */
+gboolean
+gdk_display_has_pending (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS (display)->has_pending (display);
+}
+
+/**
+ * gdk_display_supports_cursor_alpha:
+ * @display: a #GdkDisplay
+ *
+ * Returns %TRUE if cursors can use an 8bit alpha channel
+ * on @display. Otherwise, cursors are restricted to bilevel
+ * alpha (i.e. a mask).
+ *
+ * Returns: whether cursors can have alpha channels.
+ *
+ * Since: 2.4
+ */
+gboolean
+gdk_display_supports_cursor_alpha (GdkDisplay *display)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
+
+ return GDK_DISPLAY_GET_CLASS (display)->supports_cursor_alpha (display);
+}
+
+/**
+ * gdk_display_supports_cursor_color:
+ * @display: a #GdkDisplay
+ *
+ * Returns %TRUE if multicolored cursors are supported
+ * on @display. Otherwise, cursors have only a forground
+ * and a background color.
+ *
+ * Returns: whether cursors can have multiple colors.
+ *
+ * Since: 2.4
+ */
+gboolean
+gdk_display_supports_cursor_color (GdkDisplay *display)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
+
+ return GDK_DISPLAY_GET_CLASS (display)->supports_cursor_color (display);
+}
+
+/**
+ * gdk_display_get_default_cursor_size:
+ * @display: a #GdkDisplay
+ *
+ * Returns the default size to use for cursors on @display.
+ *
+ * Returns: the default cursor size.
+ *
+ * Since: 2.4
+ */
+guint
+gdk_display_get_default_cursor_size (GdkDisplay *display)
+{
+ guint width, height;
+
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
+
+ GDK_DISPLAY_GET_CLASS (display)->get_default_cursor_size (display,
+ &width,
+ &height);
+
+ return MIN (width, height);
+}
+
+/**
+ * gdk_display_get_maximal_cursor_size:
+ * @display: a #GdkDisplay
+ * @width: (out): the return location for the maximal cursor width
+ * @height: (out): the return location for the maximal cursor height
+ *
+ * Gets the maximal size to use for cursors on @display.
+ *
+ * Since: 2.4
+ */
+void
+gdk_display_get_maximal_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height)
+{
+ g_return_if_fail (GDK_IS_DISPLAY (display));
+
+ GDK_DISPLAY_GET_CLASS (display)->get_maximal_cursor_size (display,
+ width,
+ height);
+}
+
+/**
+ * gdk_display_warp_pointer:
+ * @display: a #GdkDisplay
+ * @screen: the screen of @display to warp the pointer to
+ * @x: the x coordinate of the destination
+ * @y: the y coordinate of the destination
+ *
+ * Warps the pointer of @display to the point @x,@y on
+ * the screen @screen, unless the pointer is confined
+ * to a window by a grab, in which case it will be moved
+ * as far as allowed by the grab. Warping the pointer
+ * creates events as if the user had moved the mouse
+ * instantaneously to the destination.
+ *
+ * Note that the pointer should normally be under the
+ * control of the user. This function was added to cover
+ * some rare use cases like keyboard navigation support
+ * for the color picker in the #GtkColorSelectionDialog.
+ *
+ * Since: 2.8
+ *
+ * Deprecated: 3.0: Use gdk_device_warp() instead.
+ */
+void
+gdk_display_warp_pointer (GdkDisplay *display,
+ GdkScreen *screen,
+ gint x,
+ gint y)
+{
+ gdk_device_warp (display->core_pointer,
+ screen,
+ x, y);
+}
+
+gulong
+_gdk_display_get_next_serial (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS (display)->get_next_serial (display);
+}
+
+
+/**
+ * gdk_notify_startup_complete:
+ *
+ * Indicates to the GUI environment that the application has finished
+ * loading. If the applications opens windows, this function is
+ * normally called after opening the application's initial set of
+ * windows.
+ *
+ * GTK+ will call this function automatically after opening the first
+ * #GtkWindow unless gtk_window_set_auto_startup_notification() is called
+ * to disable that feature.
+ *
+ * Since: 2.2
+ **/
+void
+gdk_notify_startup_complete (void)
+{
+ gdk_notify_startup_complete_with_id (NULL);
+}
+
+/**
+ * gdk_notify_startup_complete_with_id:
+ * @startup_id: a startup-notification identifier, for which
+ * notification process should be completed
+ *
+ * Indicates to the GUI environment that the application has
+ * finished loading, using a given identifier.
+ *
+ * GTK+ will call this function automatically for #GtkWindow
+ * with custom startup-notification identifier unless
+ * gtk_window_set_auto_startup_notification() is called to
+ * disable that feature.
+ *
+ * Since: 2.12
+ */
+void
+gdk_notify_startup_complete_with_id (const gchar* startup_id)
+{
+ GdkDisplay *display;
+
+ display = gdk_display_get_default ();
+ if (display)
+ gdk_display_notify_startup_complete (display, startup_id);
+}
+
+/**
+ * gdk_display_notify_startup_complete:
+ * @display: a #GdkDisplay
+ * @startup_id: a startup-notification identifier, for which
+ * notification process should be completed
+ *
+ * Indicates to the GUI environment that the application has
+ * finished loading, using a given identifier.
+ *
+ * GTK+ will call this function automatically for #GtkWindow
+ * with custom startup-notification identifier unless
+ * gtk_window_set_auto_startup_notification() is called to
+ * disable that feature.
+ *
+ * Since: 3.0
+ */
+void
+gdk_display_notify_startup_complete (GdkDisplay *display,
+ const gchar *startup_id)
+{
+ GDK_DISPLAY_GET_CLASS (display)->notify_startup_complete (display, startup_id);
+}
+
+void
+_gdk_display_event_data_copy (GdkDisplay *display,
+ const GdkEvent *event,
+ GdkEvent *new_event)
+{
+ GDK_DISPLAY_GET_CLASS (display)->event_data_copy (display, event, new_event);
+}
+
+void
+_gdk_display_event_data_free (GdkDisplay *display,
+ GdkEvent *event)
+{
+ GDK_DISPLAY_GET_CLASS (display)->event_data_free (display, event);
+}
+
+void
+_gdk_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask)
+{
+ GDK_DISPLAY_GET_CLASS (display)->create_window_impl (display,
+ window,
+ real_parent,
+ screen,
+ event_mask,
+ attributes,
+ attributes_mask);
+}
+
+GdkWindow *
+_gdk_display_create_window (GdkDisplay *display)
+{
+ return g_object_new (GDK_DISPLAY_GET_CLASS (display)->window_type, NULL);
+}
+
+/**
+ * gdk_keymap_get_for_display:
+ * @display: the #GdkDisplay.
+ *
+ * Returns the #GdkKeymap attached to @display.
+ *
+ * Return value: (transfer none): the #GdkKeymap attached to @display.
+ *
+ * Since: 2.2
+ */
+GdkKeymap*
+gdk_keymap_get_for_display (GdkDisplay *display)
+{
+ return GDK_DISPLAY_GET_CLASS (display)->get_keymap (display);
+}
+
+typedef struct _GdkGlobalErrorTrap GdkGlobalErrorTrap;
+
+struct _GdkGlobalErrorTrap
+{
+ GSList *displays;
+};
+
+static GQueue gdk_error_traps = G_QUEUE_INIT;
+
+/**
+ * gdk_error_trap_push:
+ *
+ * This function allows X errors to be trapped instead of the normal
+ * behavior of exiting the application. It should only be used if it
+ * is not possible to avoid the X error in any other way. Errors are
+ * ignored on all #GdkDisplay currently known to the
+ * #GdkDisplayManager. If you don't care which error happens and just
+ * want to ignore everything, pop with gdk_error_trap_pop_ignored().
+ * If you need the error code, use gdk_error_trap_pop() which may have
+ * to block and wait for the error to arrive from the X server.
+ *
+ * This API exists on all platforms but only does anything on X.
+ *
+ * You can use gdk_x11_display_error_trap_push() to ignore errors
+ * on only a single display.
+ *
+*
+ * Trapping an X error
+ *
+ * gdk_error_trap_push ();
+ *
+ * // ... Call the X function which may cause an error here ...
+ *
+ *
+ * if (gdk_error_trap_pop ())
+ * {
+ * // ... Handle the error here ...
+ * }
+ *
+ *
+ */
+void
+gdk_error_trap_push (void)
+{
+ GdkDisplayManager *manager;
+ GdkDisplayClass *class;
+ GdkGlobalErrorTrap *trap;
+ GSList *l;
+
+ manager = gdk_display_manager_get ();
+ class = GDK_DISPLAY_GET_CLASS (gdk_display_manager_get_default_display (manager));
+
+ if (class->push_error_trap == NULL)
+ return;
+
+ trap = g_slice_new (GdkGlobalErrorTrap);
+ trap->displays = gdk_display_manager_list_displays (manager);
+
+ g_slist_foreach (trap->displays, (GFunc) g_object_ref, NULL);
+ for (l = trap->displays; l != NULL; l = l->next)
+ {
+ class->push_error_trap (l->data);
+ }
+
+ g_queue_push_head (&gdk_error_traps, trap);
+}
+
+static gint
+gdk_error_trap_pop_internal (gboolean need_code)
+{
+ GdkDisplayManager *manager;
+ GdkDisplayClass *class;
+ GdkGlobalErrorTrap *trap;
+ gint result;
+ GSList *l;
+
+ manager = gdk_display_manager_get ();
+ class = GDK_DISPLAY_GET_CLASS (gdk_display_manager_get_default_display (manager));
+
+ if (class->pop_error_trap == NULL)
+ return 0;
+
+ trap = g_queue_pop_head (&gdk_error_traps);
+
+ g_return_val_if_fail (trap != NULL, 0);
+
+ result = 0;
+ for (l = trap->displays; l != NULL; l = l->next)
+ {
+ gint code = 0;
+
+ code = class->pop_error_trap (l->data, !need_code);
+
+ /* we use the error on the last display listed, why not. */
+ if (code != 0)
+ result = code;
+ }
+
+ g_slist_free_full (trap->displays, g_object_unref);
+ g_slice_free (GdkGlobalErrorTrap, trap);
+
+ return result;
+}
+
+/**
+ * gdk_error_trap_pop_ignored:
+ *
+ * Removes an error trap pushed with gdk_error_trap_push(), but
+ * without bothering to wait and see whether an error occurred. If an
+ * error arrives later asynchronously that was triggered while the
+ * trap was pushed, that error will be ignored.
+ *
+ * Since: 3.0
+ */
+void
+gdk_error_trap_pop_ignored (void)
+{
+ gdk_error_trap_pop_internal (FALSE);
+}
+
+/**
+ * gdk_error_trap_pop:
+ *
+ * Removes an error trap pushed with gdk_error_trap_push().
+ * May block until an error has been definitively received
+ * or not received from the X server. gdk_error_trap_pop_ignored()
+ * is preferred if you don't need to know whether an error
+ * occurred, because it never has to block. If you don't
+ * need the return value of gdk_error_trap_pop(), use
+ * gdk_error_trap_pop_ignored().
+ *
+ * Prior to GDK 3.0, this function would not automatically
+ * sync for you, so you had to gdk_flush() if your last
+ * call to Xlib was not a blocking round trip.
+ *
+ * Return value: X error code or 0 on success
+ */
+gint
+gdk_error_trap_pop (void)
+{
+ return gdk_error_trap_pop_internal (TRUE);
+}
diff --git a/gdk/gdkdisplay.h b/gdk/gdkdisplay.h
index 17afa4bfc7..af779096c8 100644
--- a/gdk/gdkdisplay.h
+++ b/gdk/gdkdisplay.h
@@ -1,7 +1,7 @@
/*
* gdkdisplay.h
- *
- * Copyright 2001 Sun Microsystems Inc.
+ *
+ * Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede
*
@@ -34,180 +34,12 @@
G_BEGIN_DECLS
-typedef struct _GdkDisplayClass GdkDisplayClass;
-typedef struct _GdkDisplayPointerHooks GdkDisplayPointerHooks;
-typedef struct _GdkDisplayDeviceHooks GdkDisplayDeviceHooks;
-
#define GDK_TYPE_DISPLAY (gdk_display_get_type ())
-#define GDK_DISPLAY_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY, GdkDisplay))
-#define GDK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass))
+#define GDK_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY, GdkDisplay))
#define GDK_IS_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY))
-#define GDK_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY))
-#define GDK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))
-
-/* Tracks information about the keyboard grab on this display */
-typedef struct
-{
- GdkWindow *window;
- GdkWindow *native_window;
- gulong serial;
- gboolean owner_events;
- guint32 time;
-} GdkKeyboardGrabInfo;
-
-/* Tracks information about which window and position the pointer last was in.
- * This is useful when we need to synthesize events later.
- * Note that we track toplevel_under_pointer using enter/leave events,
- * so in the case of a grab, either with owner_events==FALSE or with the
- * pointer in no clients window the x/y coordinates may actually be outside
- * the window.
- */
-typedef struct
-{
- GdkWindow *toplevel_under_pointer; /* The toplevel window with mouse inside, tracked via native events */
- GdkWindow *window_under_pointer; /* The window that last got sent a normal enter event */
- gdouble toplevel_x, toplevel_y;
- guint32 state;
- guint32 button;
-} GdkPointerWindowInfo;
-
-typedef struct
-{
- guint32 button_click_time[2]; /* The last 2 button click times. */
- GdkWindow *button_window[2]; /* The last 2 windows to receive button presses. */
- gint button_number[2]; /* The last 2 buttons to be pressed. */
- gint button_x[2]; /* The last 2 button click positions. */
- gint button_y[2];
-} GdkMultipleClickInfo;
-
-struct _GdkDisplay
-{
- GObject parent_instance;
-
- /*< private >*/
- GList *GSEAL (queued_events);
- GList *GSEAL (queued_tail);
-
- /* Information for determining if the latest button click
- * is part of a double-click or triple-click
- */
- GHashTable *GSEAL (multiple_click_info);
-
- guint GSEAL (double_click_time); /* Maximum time between clicks in msecs */
- GdkDevice *GSEAL (core_pointer); /* Core pointer device */
-
- const GdkDisplayDeviceHooks *GSEAL (device_hooks); /* Current hooks for querying pointer */
-
- guint GSEAL (closed) : 1; /* Whether this display has been closed */
- guint GSEAL (ignore_core_events) : 1; /* Don't send core motion and button event */
-
- guint GSEAL (double_click_distance); /* Maximum distance between clicks in pixels */
-
- GHashTable *GSEAL (device_grabs);
- GHashTable *GSEAL (motion_hint_info);
-
- /* Hashtable containing a GdkPointerWindowInfo for each device */
- GHashTable *GSEAL (pointers_info);
-
- /* Last reported event time from server */
- guint32 GSEAL (last_event_time);
-
- /* Device manager associated to the display */
- GdkDeviceManager *GSEAL (device_manager);
-};
-
-struct _GdkDisplayClass
-{
- GObjectClass parent_class;
-
- G_CONST_RETURN gchar * (*get_display_name) (GdkDisplay *display);
- gint (*get_n_screens) (GdkDisplay *display);
- GdkScreen * (*get_screen) (GdkDisplay *display,
- gint screen_num);
- GdkScreen * (*get_default_screen) (GdkDisplay *display);
-
-
- /* Signals */
- void (*closed) (GdkDisplay *display,
- gboolean is_error);
-};
-
-/**
- * GdkDisplayPointerHooks:
- * @get_pointer: Obtains the current pointer position and modifier state.
- * The position is given in coordinates relative to the screen containing
- * the pointer, which is returned in @screen.
- * @window_get_pointer: Obtains the window underneath the mouse pointer.
- * Current pointer position and modifier state are returned in @x, @y and
- * @mask. The position is given in coordinates relative to @window.
- * @window_at_pointer: Obtains the window underneath the mouse pointer,
- * returning the location of that window in @win_x, @win_y. Returns %NULL
- * if the window under the mouse pointer is not known to GDK (for example,
- * belongs to another application).
- *
- * A table of pointers to functions for getting quantities related to
- * the current pointer position. Each #GdkDisplay has a table of this type,
- * which can be set using gdk_display_set_pointer_hooks().
- *
- * This is only useful for such low-level tools as an event recorder.
- * Applications should never have any reason to use this facility
- *
- * Since: 2.2
- */
-struct _GdkDisplayPointerHooks
-{
- void (*get_pointer) (GdkDisplay *display,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
- GdkWindow* (*window_get_pointer) (GdkDisplay *display,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
- GdkWindow* (*window_at_pointer) (GdkDisplay *display,
- gint *win_x,
- gint *win_y);
-};
-
-/**
- * GdkDisplayDeviceHooks:
- * @get_device_state: Obtains the current position and modifier state for
- * @device. The position is given in coordinates relative to the window
- * containing the pointer, which is returned in @window.
- * @window_get_device_position: Obtains the window underneath the device
- * position. Current device position and modifier state are returned in
- * @x, @y and @mask. The position is given in coordinates relative to
- * @window.
- * @window_at_device_position: Obtains the window underneath the device
- * position, returning the location of that window in @win_x, @win_y.
- * Returns %NULL if the window under the mouse pointer is not known to
- * GDK (for example, belongs to another application).
- *
- * A table of pointers to functions for getting quantities related to
- * the current device position. Each #GdkDisplay has a table of this type,
- * which can be set using gdk_display_set_device_hooks().
- */
-struct _GdkDisplayDeviceHooks
-{
- void (* get_device_state) (GdkDisplay *display,
- GdkDevice *device,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
- GdkWindow * (* window_get_device_position) (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
- GdkWindow * (* window_at_device_position) (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y);
-};
+#ifndef GDK_DISABLE_DEPRECATED
+#define GDK_DISPLAY_OBJECT(object) GDK_DISPLAY(object)
+#endif
GType gdk_display_get_type (void) G_GNUC_CONST;
GdkDisplay *gdk_display_open (const gchar *display_name);
@@ -216,15 +48,17 @@ G_CONST_RETURN gchar * gdk_display_get_name (GdkDisplay *display);
gint gdk_display_get_n_screens (GdkDisplay *display);
GdkScreen * gdk_display_get_screen (GdkDisplay *display,
- gint screen_num);
+ gint screen_num);
GdkScreen * gdk_display_get_default_screen (GdkDisplay *display);
#ifndef GDK_MULTIDEVICE_SAFE
+#ifndef GDK_DISABLE_DEPRECATED
void gdk_display_pointer_ungrab (GdkDisplay *display,
- guint32 time_);
+ guint32 time_);
void gdk_display_keyboard_ungrab (GdkDisplay *display,
- guint32 time_);
+ guint32 time_);
gboolean gdk_display_pointer_is_grabbed (GdkDisplay *display);
+#endif /* GDK_DISABLE_DEPRECATED */
#endif /* GDK_MULTIDEVICE_SAFE */
gboolean gdk_display_device_is_grabbed (GdkDisplay *display,
@@ -233,7 +67,7 @@ void gdk_display_beep (GdkDisplay *display);
void gdk_display_sync (GdkDisplay *display);
void gdk_display_flush (GdkDisplay *display);
-void gdk_display_close (GdkDisplay *display);
+void gdk_display_close (GdkDisplay *display);
gboolean gdk_display_is_closed (GdkDisplay *display);
#ifndef GDK_DISABLE_DEPRECATED
@@ -243,93 +77,70 @@ GList * gdk_display_list_devices (GdkDisplay *display);
GdkEvent* gdk_display_get_event (GdkDisplay *display);
GdkEvent* gdk_display_peek_event (GdkDisplay *display);
void gdk_display_put_event (GdkDisplay *display,
- const GdkEvent *event);
+ const GdkEvent *event);
+gboolean gdk_display_has_pending (GdkDisplay *display);
void gdk_display_add_client_message_filter (GdkDisplay *display,
- GdkAtom message_type,
- GdkFilterFunc func,
- gpointer data);
+ GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data);
void gdk_display_set_double_click_time (GdkDisplay *display,
- guint msec);
+ guint msec);
void gdk_display_set_double_click_distance (GdkDisplay *display,
- guint distance);
+ guint distance);
GdkDisplay *gdk_display_get_default (void);
#ifndef GDK_MULTIDEVICE_SAFE
-
#ifndef GDK_DISABLE_DEPRECATED
-GdkDevice *gdk_display_get_core_pointer (GdkDisplay *display);
-#endif /* GDK_DISABLE_DEPRECATED */
-
void gdk_display_get_pointer (GdkDisplay *display,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
+ GdkScreen **screen,
+ gint *x,
+ gint *y,
+ GdkModifierType *mask);
GdkWindow * gdk_display_get_window_at_pointer (GdkDisplay *display,
- gint *win_x,
- gint *win_y);
+ gint *win_x,
+ gint *win_y);
void gdk_display_warp_pointer (GdkDisplay *display,
- GdkScreen *screen,
- gint x,
- gint y);
+ GdkScreen *screen,
+ gint x,
+ gint y);
+#endif /* GDK_DISABLE_DEPRECATED */
#endif /* GDK_MULTIDEVICE_SAFE */
-void gdk_display_get_device_state (GdkDisplay *display,
- GdkDevice *device,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-GdkWindow * gdk_display_get_window_at_device_position (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y);
-void gdk_display_warp_device (GdkDisplay *display,
- GdkDevice *device,
- GdkScreen *screen,
- gint x,
- gint y);
-
-#ifndef GDK_MULTIDEVICE_SAFE
-GdkDisplayPointerHooks *gdk_display_set_pointer_hooks (GdkDisplay *display,
- const GdkDisplayPointerHooks *new_hooks);
-#endif /* GDK_MULTIDEVICE_SAFE */
-
-GdkDisplayDeviceHooks *gdk_display_set_device_hooks (GdkDisplay *display,
- const GdkDisplayDeviceHooks *new_hooks);
-
GdkDisplay *gdk_display_open_default_libgtk_only (void);
gboolean gdk_display_supports_cursor_alpha (GdkDisplay *display);
gboolean gdk_display_supports_cursor_color (GdkDisplay *display);
guint gdk_display_get_default_cursor_size (GdkDisplay *display);
void gdk_display_get_maximal_cursor_size (GdkDisplay *display,
- guint *width,
- guint *height);
+ guint *width,
+ guint *height);
GdkWindow *gdk_display_get_default_group (GdkDisplay *display);
gboolean gdk_display_supports_selection_notification (GdkDisplay *display);
gboolean gdk_display_request_selection_notification (GdkDisplay *display,
- GdkAtom selection);
+ GdkAtom selection);
gboolean gdk_display_supports_clipboard_persistence (GdkDisplay *display);
void gdk_display_store_clipboard (GdkDisplay *display,
- GdkWindow *clipboard_window,
- guint32 time_,
- const GdkAtom *targets,
- gint n_targets);
+ GdkWindow *clipboard_window,
+ guint32 time_,
+ const GdkAtom *targets,
+ gint n_targets);
gboolean gdk_display_supports_shapes (GdkDisplay *display);
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
gboolean gdk_display_supports_composite (GdkDisplay *display);
+void gdk_display_notify_startup_complete (GdkDisplay *display,
+ const gchar *startup_id);
GdkDeviceManager * gdk_display_get_device_manager (GdkDisplay *display);
+GdkAppLaunchContext *gdk_display_get_app_launch_context (GdkDisplay *display);
G_END_DECLS
-#endif /* __GDK_DISPLAY_H__ */
+#endif /* __GDK_DISPLAY_H__ */
diff --git a/gdk/gdkdisplaymanager.c b/gdk/gdkdisplaymanager.c
index ec975f26fa..79ed85aebd 100644
--- a/gdk/gdkdisplaymanager.c
+++ b/gdk/gdkdisplaymanager.c
@@ -21,19 +21,32 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
-#include "gdkdisplaymanager.h"
-
-#include "gdkscreen.h"
-#include "gdkdisplay.h"
+#include "gdkconfig.h"
+#include "gdkdisplaymanagerprivate.h"
#include "gdkinternals.h"
#include "gdkmarshalers.h"
#include "gdkintl.h"
+#ifdef GDK_WINDOWING_X11
+#include "x11/gdkx.h"
+#endif
+
+#ifdef GDK_WINDOWING_QUARTZ
+/* We immediately include gdkquartzdisplaymanager.h here instead of
+ * gdkquartz.h so that we do not have to enable -xobjective-c for the
+ * "generic" GDK source code.
+ */
+#include "quartz/gdkquartzdisplaymanager.h"
+#endif
+
+#ifdef GDK_WINDOWING_WIN32
+#include "win32/gdkwin32.h"
+#endif
/**
* SECTION:gdkdisplaymanager
@@ -58,18 +71,16 @@ enum {
static void gdk_display_manager_class_init (GdkDisplayManagerClass *klass);
static void gdk_display_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
static void gdk_display_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
static guint signals[LAST_SIGNAL] = { 0 };
-static GdkDisplay *default_display = NULL;
-
G_DEFINE_TYPE (GdkDisplayManager, gdk_display_manager, G_TYPE_OBJECT)
static void
@@ -82,32 +93,32 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
/**
* GdkDisplayManager::display-opened:
- * @display_manager: the object on which the signal is emitted
+ * @manager: the object on which the signal is emitted
* @display: the opened display
*
- * The ::display_opened signal is emitted when a display is opened.
+ * The ::display-opened signal is emitted when a display is opened.
*
* Since: 2.2
*/
signals[DISPLAY_OPENED] =
g_signal_new (g_intern_static_string ("display-opened"),
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkDisplayManagerClass, display_opened),
- NULL, NULL,
- _gdk_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1,
- GDK_TYPE_DISPLAY);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GdkDisplayManagerClass, display_opened),
+ NULL, NULL,
+ _gdk_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ GDK_TYPE_DISPLAY);
g_object_class_install_property (object_class,
- PROP_DEFAULT_DISPLAY,
- g_param_spec_object ("default-display",
- P_("Default Display"),
- P_("The default display for GDK"),
- GDK_TYPE_DISPLAY,
- G_PARAM_READWRITE|G_PARAM_STATIC_NAME|
- G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
+ PROP_DEFAULT_DISPLAY,
+ g_param_spec_object ("default-display",
+ P_("Default Display"),
+ P_("The default display for GDK"),
+ GDK_TYPE_DISPLAY,
+ G_PARAM_READWRITE|G_PARAM_STATIC_NAME|
+ G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB));
}
static void
@@ -117,15 +128,15 @@ gdk_display_manager_init (GdkDisplayManager *manager)
static void
gdk_display_manager_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_DEFAULT_DISPLAY:
gdk_display_manager_set_default_display (GDK_DISPLAY_MANAGER (object),
- g_value_get_object (value));
+ g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -135,14 +146,15 @@ gdk_display_manager_set_property (GObject *object,
static void
gdk_display_manager_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
switch (prop_id)
{
case PROP_DEFAULT_DISPLAY:
- g_value_set_object (value, default_display);
+ g_value_set_object (value,
+ gdk_display_manager_get_default_display (GDK_DISPLAY_MANAGER (object)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -155,37 +167,66 @@ gdk_display_manager_get_property (GObject *object,
*
* Gets the singleton #GdkDisplayManager object.
*
- * Returns: (transfer none): The global #GdkDisplayManager singleton; gdk_parse_pargs(),
- * gdk_init(), or gdk_init_check() must have been called first.
+ * When called for the first time, this function consults the
+ * GDK_BACKEND to find out which of the supported
+ * GDK backends to use (in case GDK has been compiled with multiple
+ * backends).
+ *
+ * Returns: (transfer none): The global #GdkDisplayManager singleton;
+ * gdk_parse_args(), gdk_init(), or gdk_init_check() must have
+ * been called first.
*
* Since: 2.2
**/
GdkDisplayManager*
gdk_display_manager_get (void)
{
- static GdkDisplayManager *display_manager = NULL;
+ static GdkDisplayManager *manager = NULL;
- if (!display_manager)
- display_manager = g_object_new (GDK_TYPE_DISPLAY_MANAGER, NULL);
+ if (!manager)
+ {
+ const gchar *backend;
- return display_manager;
+ backend = g_getenv ("GDK_BACKEND");
+#ifdef GDK_WINDOWING_X11
+ if (backend == NULL || strcmp (backend, "x11") == 0)
+ manager = g_object_new (gdk_x11_display_manager_get_type (), NULL);
+ else
+#endif
+#ifdef GDK_WINDOWING_QUARTZ
+ if (backend == NULL || strcmp (backend, "quartz") == 0)
+ manager = g_object_new (gdk_quartz_display_manager_get_type (), NULL);
+ else
+#endif
+#ifdef GDK_WINDOWING_WIN32
+ if (backend == NULL || strcmp (backend, "win32") == 0)
+ manager = g_object_new (gdk_win32_display_manager_get_type (), NULL);
+ else
+#endif
+ if (backend != NULL)
+ g_error ("Unsupported GDK backend: %s", backend);
+ else
+ g_error ("No GDK backend found");
+ }
+
+ return manager;
}
/**
* gdk_display_manager_get_default_display:
- * @display_manager: a #GdkDisplayManager
+ * @manager: a #GdkDisplayManager
*
* Gets the default #GdkDisplay.
*
- * Returns: (transfer none): a #GdkDisplay, or %NULL if there is no default
- * display.
+ * Returns: (transfer none): a #GdkDisplay, or %NULL
+ * if there is no default display.
*
* Since: 2.2
*/
GdkDisplay *
-gdk_display_manager_get_default_display (GdkDisplayManager *display_manager)
+gdk_display_manager_get_default_display (GdkDisplayManager *manager)
{
- return default_display;
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->get_default_display (manager);
}
/**
@@ -203,7 +244,7 @@ gdk_display_manager_get_default_display (GdkDisplayManager *display_manager)
GdkDisplay *
gdk_display_get_default (void)
{
- return default_display;
+ return gdk_display_manager_get_default_display (gdk_display_manager_get ());
}
/**
@@ -219,6 +260,10 @@ gdk_display_get_default (void)
GdkScreen *
gdk_screen_get_default (void)
{
+ GdkDisplay *default_display;
+
+ default_display = gdk_display_get_default ();
+
if (default_display)
return gdk_display_get_default_screen (default_display);
else
@@ -227,7 +272,7 @@ gdk_screen_get_default (void)
/**
* gdk_display_manager_set_default_display:
- * @display_manager: a #GdkDisplayManager
+ * @manager: a #GdkDisplayManager
* @display: a #GdkDisplay
*
* Sets @display as the default display.
@@ -235,30 +280,113 @@ gdk_screen_get_default (void)
* Since: 2.2
**/
void
-gdk_display_manager_set_default_display (GdkDisplayManager *display_manager,
- GdkDisplay *display)
+gdk_display_manager_set_default_display (GdkDisplayManager *manager,
+ GdkDisplay *display)
{
- default_display = display;
+ GDK_DISPLAY_MANAGER_GET_CLASS (manager)->set_default_display (manager, display);
- _gdk_windowing_set_default_display (display);
-
- g_object_notify (G_OBJECT (display_manager), "default-display");
+ g_object_notify (G_OBJECT (manager), "default-display");
}
/**
* gdk_display_manager_list_displays:
- * @display_manager: a #GdkDisplayManager
+ * @manager: a #GdkDisplayManager
*
* List all currently open displays.
- *
- * Return value: (transfer container) (element-type GdkDisplay): a newly allocated
- * #GSList of #GdkDisplay objects. Free this list with g_slist_free() when you
- * are done with it.
+ *
+ * Return value: (transfer container) (element-type GdkDisplay): a newly
+ * allocated #GSList of #GdkDisplay objects. Free with g_slist_free()
+ * when you are done with it.
*
* Since: 2.2
**/
GSList *
-gdk_display_manager_list_displays (GdkDisplayManager *display_manager)
+gdk_display_manager_list_displays (GdkDisplayManager *manager)
{
- return g_slist_copy (_gdk_displays);
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->list_displays (manager);
+}
+
+/**
+ * gdk_display_manager_open_display:
+ * @manager: a #GdkDisplayManager
+ * @name: the name of the display to open
+ *
+ * Opens a display.
+ *
+ * Return value: (transfer none): a #GdkDisplay, or %NULL
+ * if the display could not be opened
+ *
+ * Since: 3.0
+ */
+GdkDisplay *
+gdk_display_manager_open_display (GdkDisplayManager *manager,
+ const gchar *name)
+{
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->open_display (manager, name);
+}
+
+/**
+ * gdk_atom_intern:
+ * @atom_name: a string.
+ * @only_if_exists: if %TRUE, GDK is allowed to not create a new atom, but
+ * just return %GDK_NONE if the requested atom doesn't already
+ * exists. Currently, the flag is ignored, since checking the
+ * existance of an atom is as expensive as creating it.
+ *
+ * Finds or creates an atom corresponding to a given string.
+ *
+ * Returns: the atom corresponding to @atom_name.
+ */
+GdkAtom
+gdk_atom_intern (const gchar *atom_name,
+ gboolean only_if_exists)
+{
+ GdkDisplayManager *manager = gdk_display_manager_get ();
+
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->atom_intern (manager, atom_name, TRUE);
+}
+
+/**
+ * gdk_atom_intern_static_string:
+ * @atom_name: a static string
+ *
+ * Finds or creates an atom corresponding to a given string.
+ *
+ * Note that this function is identical to gdk_atom_intern() except
+ * that if a new #GdkAtom is created the string itself is used rather
+ * than a copy. This saves memory, but can only be used if the string
+ * will always exist. It can be used with statically
+ * allocated strings in the main program, but not with statically
+ * allocated memory in dynamically loaded modules, if you expect to
+ * ever unload the module again (e.g. do not use this function in
+ * GTK+ theme engines).
+ *
+ * Returns: the atom corresponding to @atom_name
+ *
+ * Since: 2.10
+ */
+GdkAtom
+gdk_atom_intern_static_string (const gchar *atom_name)
+{
+ GdkDisplayManager *manager = gdk_display_manager_get ();
+
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->atom_intern (manager, atom_name, FALSE);
+}
+
+/**
+ * gdk_atom_name:
+ * @atom: a #GdkAtom.
+ *
+ * Determines the string corresponding to an atom.
+ *
+ * Returns: a newly-allocated string containing the string
+ * corresponding to @atom. When you are done with the
+ * return value, you should free it using g_free().
+ */
+gchar *
+gdk_atom_name (GdkAtom atom)
+{
+ GdkDisplayManager *manager = gdk_display_manager_get ();
+
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->get_atom_name (manager, atom);
}
diff --git a/gdk/gdkdisplaymanager.h b/gdk/gdkdisplaymanager.h
index 4d5bd989a4..4c0e02cc11 100644
--- a/gdk/gdkdisplaymanager.h
+++ b/gdk/gdkdisplaymanager.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -39,34 +39,18 @@ G_BEGIN_DECLS
#define GDK_TYPE_DISPLAY_MANAGER (gdk_display_manager_get_type ())
#define GDK_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManager))
-#define GDK_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManagerClass))
#define GDK_IS_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_MANAGER))
-#define GDK_IS_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_MANAGER))
-#define GDK_DISPLAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManagerClass))
-typedef struct _GdkDisplayManager GdkDisplayManager;
-typedef struct _GdkDisplayManagerClass GdkDisplayManagerClass;
-struct _GdkDisplayManager
-{
- GObject parent_instance;
-};
-
-struct _GdkDisplayManagerClass
-{
- GObjectClass parent_class;
-
- void (*display_opened) (GdkDisplayManager *display_manager,
- GdkDisplay *display);
-};
-
-GType gdk_display_manager_get_type (void) G_GNUC_CONST;
+GType gdk_display_manager_get_type (void) G_GNUC_CONST;
GdkDisplayManager *gdk_display_manager_get (void);
-GdkDisplay * gdk_display_manager_get_default_display (GdkDisplayManager *display_manager);
-void gdk_display_manager_set_default_display (GdkDisplayManager *display_manager,
- GdkDisplay *display);
-GSList * gdk_display_manager_list_displays (GdkDisplayManager *display_manager);
+GdkDisplay * gdk_display_manager_get_default_display (GdkDisplayManager *manager);
+void gdk_display_manager_set_default_display (GdkDisplayManager *manager,
+ GdkDisplay *display);
+GSList * gdk_display_manager_list_displays (GdkDisplayManager *manager);
+GdkDisplay * gdk_display_manager_open_display (GdkDisplayManager *manager,
+ const gchar *name);
G_END_DECLS
diff --git a/gdk/gdkdisplaymanagerprivate.h b/gdk/gdkdisplaymanagerprivate.h
new file mode 100644
index 0000000000..6c1df3e11e
--- /dev/null
+++ b/gdk/gdkdisplaymanagerprivate.h
@@ -0,0 +1,71 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010, Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_DISPLAY_MANAGER_PRIVATE_H__
+#define __GDK_DISPLAY_MANAGER_PRIVATE_H__
+
+#include "gdkdisplaymanager.h"
+
+G_BEGIN_DECLS
+
+#define GDK_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManagerClass))
+#define GDK_IS_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_MANAGER))
+#define GDK_DISPLAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_MANAGER, GdkDisplayManagerClass))
+
+typedef struct _GdkDisplayManagerClass GdkDisplayManagerClass;
+
+struct _GdkDisplayManager
+{
+ GObject parent_instance;
+};
+
+struct _GdkDisplayManagerClass
+{
+ GObjectClass parent_class;
+
+ GSList * (*list_displays) (GdkDisplayManager *manager);
+ GdkDisplay * (*get_default_display) (GdkDisplayManager *manager);
+ void (*set_default_display) (GdkDisplayManager *manager,
+ GdkDisplay *display);
+ GdkDisplay * (*open_display) (GdkDisplayManager *manager,
+ const gchar *name);
+
+ /* FIXME the following should really be frontend-only, not vfuncs */
+ GdkAtom (*atom_intern) (GdkDisplayManager *manager,
+ const gchar *atom_name,
+ gboolean copy_name);
+ gchar * (*get_atom_name) (GdkDisplayManager *manager,
+ GdkAtom atom);
+ guint (*lookup_keyval) (GdkDisplayManager *manager,
+ const gchar *name);
+ gchar * (*get_keyval_name) (GdkDisplayManager *manager,
+ guint keyval);
+ void (*keyval_convert_case) (GdkDisplayManager *manager,
+ guint keyval,
+ guint *lower,
+ guint *upper);
+
+ /* signals */
+ void (*display_opened) (GdkDisplayManager *manager,
+ GdkDisplay *display);
+};
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h
new file mode 100644
index 0000000000..fc82f4f093
--- /dev/null
+++ b/gdk/gdkdisplayprivate.h
@@ -0,0 +1,299 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_DISPLAY_PRIVATE_H__
+#define __GDK_DISPLAY_PRIVATE_H__
+
+#include "gdkdisplay.h"
+#include "gdkwindow.h"
+#include "gdkcursor.h"
+
+G_BEGIN_DECLS
+
+#define GDK_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY, GdkDisplayClass))
+#define GDK_IS_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY))
+#define GDK_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY, GdkDisplayClass))
+
+
+typedef struct _GdkDisplayClass GdkDisplayClass;
+
+/* Tracks information about the keyboard grab on this display */
+typedef struct
+{
+ GdkWindow *window;
+ GdkWindow *native_window;
+ gulong serial;
+ gboolean owner_events;
+ guint32 time;
+} GdkKeyboardGrabInfo;
+
+/* Tracks information about the pointer grab on this display */
+typedef struct
+{
+ GdkWindow *window;
+ GdkWindow *native_window;
+ gulong serial_start;
+ gulong serial_end; /* exclusive, i.e. not active on serial_end */
+ gboolean owner_events;
+ guint event_mask;
+ gboolean implicit;
+ guint32 time;
+ GdkGrabOwnership ownership;
+
+ guint activated : 1;
+ guint implicit_ungrab : 1;
+} GdkDeviceGrabInfo;
+
+/* Tracks information about which window and position the pointer last was in.
+ * This is useful when we need to synthesize events later.
+ * Note that we track toplevel_under_pointer using enter/leave events,
+ * so in the case of a grab, either with owner_events==FALSE or with the
+ * pointer in no clients window the x/y coordinates may actually be outside
+ * the window.
+ */
+typedef struct
+{
+ GdkWindow *toplevel_under_pointer; /* toplevel window containing the pointer, */
+ /* tracked via native events */
+ GdkWindow *window_under_pointer; /* window that last got a normal enter event */
+ gdouble toplevel_x, toplevel_y;
+ guint32 state;
+ guint32 button;
+} GdkPointerWindowInfo;
+
+typedef struct
+{
+ guint32 button_click_time[2]; /* last 2 button click times */
+ GdkWindow *button_window[2]; /* last 2 windows to receive button presses */
+ gint button_number[2]; /* last 2 buttons to be pressed */
+ gint button_x[2]; /* last 2 button click positions */
+ gint button_y[2];
+} GdkMultipleClickInfo;
+
+struct _GdkDisplay
+{
+ GObject parent_instance;
+
+ GList *queued_events;
+ GList *queued_tail;
+
+ /* Information for determining if the latest button click
+ * is part of a double-click or triple-click
+ */
+ GHashTable *multiple_click_info;
+ guint double_click_time; /* Maximum time between clicks in msecs */
+ GdkDevice *core_pointer; /* Core pointer device */
+
+ guint closed : 1; /* Whether this display has been closed */
+ guint ignore_core_events : 1; /* Don't send core motion and button event */
+
+ guint double_click_distance; /* Maximum distance between clicks in pixels */
+
+ GHashTable *device_grabs;
+ GHashTable *motion_hint_info;
+
+ GHashTable *pointers_info; /* GdkPointerWindowInfo for each device */
+ guint32 last_event_time; /* Last reported event time from server */
+
+ GdkDeviceManager *device_manager;
+};
+
+struct _GdkDisplayClass
+{
+ GObjectClass parent_class;
+
+ GType window_type; /* type for native windows for this display, set in class_init */
+
+ G_CONST_RETURN gchar * (*get_name) (GdkDisplay *display);
+ gint (*get_n_screens) (GdkDisplay *display);
+ GdkScreen * (*get_screen) (GdkDisplay *display,
+ gint screen_num);
+ GdkScreen * (*get_default_screen) (GdkDisplay *display);
+ void (*beep) (GdkDisplay *display);
+ void (*sync) (GdkDisplay *display);
+ void (*flush) (GdkDisplay *display);
+ gboolean (*has_pending) (GdkDisplay *display);
+ void (*queue_events) (GdkDisplay *display);
+ GdkWindow * (*get_default_group) (GdkDisplay *display);
+ gboolean (*supports_selection_notification) (GdkDisplay *display);
+ gboolean (*request_selection_notification) (GdkDisplay *display,
+ GdkAtom selection);
+ gboolean (*supports_shapes) (GdkDisplay *display);
+ gboolean (*supports_input_shapes) (GdkDisplay *display);
+ gboolean (*supports_composite) (GdkDisplay *display);
+ gboolean (*supports_cursor_alpha) (GdkDisplay *display);
+ gboolean (*supports_cursor_color) (GdkDisplay *display);
+
+ gboolean (*supports_clipboard_persistence) (GdkDisplay *display);
+ void (*store_clipboard) (GdkDisplay *display,
+ GdkWindow *clipboard_window,
+ guint32 time_,
+ const GdkAtom *targets,
+ gint n_targets);
+
+ void (*get_default_cursor_size) (GdkDisplay *display,
+ guint *width,
+ guint *height);
+ void (*get_maximal_cursor_size) (GdkDisplay *display,
+ guint *width,
+ guint *height);
+ GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
+ GdkCursorType type);
+ GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
+ const gchar *name);
+ GdkCursor * (*get_cursor_for_pixbuf) (GdkDisplay *display,
+ GdkPixbuf *pixbuf,
+ gint x,
+ gint y);
+
+ GList * (*list_devices) (GdkDisplay *display);
+ gboolean (*send_client_message) (GdkDisplay *display,
+ GdkEvent *event,
+ GdkNativeWindow winid);
+ void (*add_client_message_filter) (GdkDisplay *display,
+ GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data);
+ GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
+ GdkNativeWindow (*get_drag_protocol) (GdkDisplay *display,
+ GdkNativeWindow winid,
+ GdkDragProtocol *protocol,
+ guint *version);
+
+ void (*before_process_all_updates) (GdkDisplay *display);
+ void (*after_process_all_updates) (GdkDisplay *display);
+
+ gulong (*get_next_serial) (GdkDisplay *display);
+
+ void (*notify_startup_complete) (GdkDisplay *display,
+ const gchar *startup_id);
+ void (*event_data_copy) (GdkDisplay *display,
+ const GdkEvent *event,
+ GdkEvent *new_event);
+ void (*event_data_free) (GdkDisplay *display,
+ GdkEvent *event);
+ void (*create_window_impl) (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
+
+ GdkKeymap * (*get_keymap) (GdkDisplay *display);
+ void (*push_error_trap) (GdkDisplay *display);
+ gint (*pop_error_trap) (GdkDisplay *display,
+ gboolean ignore);
+
+ GdkWindow * (*get_selection_owner) (GdkDisplay *display,
+ GdkAtom selection);
+ gboolean (*set_selection_owner) (GdkDisplay *display,
+ GdkWindow *owner,
+ GdkAtom selection,
+ guint32 time,
+ gboolean send_event);
+ void (*send_selection_notify) (GdkDisplay *dispay,
+ GdkNativeWindow requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ GdkAtom property,
+ guint32 time);
+ gint (*get_selection_property) (GdkDisplay *display,
+ GdkWindow *requestor,
+ guchar **data,
+ GdkAtom *type,
+ gint *format);
+ void (*convert_selection) (GdkDisplay *display,
+ GdkWindow *requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ guint32 time);
+
+ gint (*text_property_to_utf8_list) (GdkDisplay *display,
+ GdkAtom encoding,
+ gint format,
+ const guchar *text,
+ gint length,
+ gchar ***list);
+ gchar * (*utf8_to_string_target) (GdkDisplay *display,
+ const gchar *text);
+
+ /* Signals */
+ void (*closed) (GdkDisplay *display,
+ gboolean is_error);
+};
+
+
+typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
+ GdkDevice *device,
+ GdkPointerWindowInfo *device_info,
+ gpointer user_data);
+
+void _gdk_display_device_grab_update (GdkDisplay *display,
+ GdkDevice *device,
+ GdkDevice *source_device,
+ gulong current_serial);
+GdkDeviceGrabInfo * _gdk_display_get_last_device_grab (GdkDisplay *display,
+ GdkDevice *device);
+GdkDeviceGrabInfo * _gdk_display_add_device_grab (GdkDisplay *display,
+ GdkDevice *device,
+ GdkWindow *window,
+ GdkWindow *native_window,
+ GdkGrabOwnership grab_ownership,
+ gboolean owner_events,
+ GdkEventMask event_mask,
+ gulong serial_start,
+ guint32 time,
+ gboolean implicit);
+GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
+ GdkDevice *device,
+ gulong serial);
+gboolean _gdk_display_end_device_grab (GdkDisplay *display,
+ GdkDevice *device,
+ gulong serial,
+ GdkWindow *if_child,
+ gboolean implicit);
+gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
+ GdkDevice *device,
+ gulong serial);
+void _gdk_display_enable_motion_hints (GdkDisplay *display,
+ GdkDevice *device);
+GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
+ GdkDevice *device);
+void _gdk_display_pointer_info_foreach (GdkDisplay *display,
+ GdkDisplayPointerInfoForeach func,
+ gpointer user_data);
+gulong _gdk_display_get_next_serial (GdkDisplay *display);
+void _gdk_display_event_data_copy (GdkDisplay *display,
+ const GdkEvent *event,
+ GdkEvent *new_event);
+void _gdk_display_event_data_free (GdkDisplay *display,
+ GdkEvent *event);
+void _gdk_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
+GdkWindow * _gdk_display_create_window (GdkDisplay *display);
+
+G_END_DECLS
+
+#endif /* __GDK_DISPLAY_PRIVATE_H__ */
diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c
index cccae0968a..bb2e6a854e 100644
--- a/gdk/gdkdnd.c
+++ b/gdk/gdkdnd.c
@@ -26,8 +26,7 @@
#include "config.h"
-#include "gdkdnd.h"
-
+#include "gdkdndprivate.h"
#include "gdkdisplay.h"
#include "gdkwindow.h"
@@ -48,53 +47,6 @@
* the GTK+ documentation for more information.
*/
-/**
- * gdk_drag_find_window:
- * @context: a #GdkDragContext.
- * @drag_window: a window which may be at the pointer position, but
- * should be ignored, since it is put up by the drag source as an icon.
- * @x_root: the x position of the pointer in root coordinates.
- * @y_root: the y position of the pointer in root coordinates.
- * @dest_window: (out): location to store the destination window in.
- * @protocol: (out): location to store the DND protocol in.
- *
- * Finds the destination window and DND protocol to use at the
- * given pointer position.
- *
- * This function is called by the drag source to obtain the
- * @dest_window and @protocol parameters for gdk_drag_motion().
- **/
-void
-gdk_drag_find_window (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkWindow **dest_window,
- GdkDragProtocol *protocol)
-{
- gdk_drag_find_window_for_screen (context, drag_window,
- gdk_window_get_screen (context->source_window),
- x_root, y_root, dest_window, protocol);
-}
-
-/**
- * gdk_drag_get_protocol:
- * @xid: the windowing system id of the destination window.
- * @protocol: location where the supported DND protocol is returned.
- *
- * Finds out the DND protocol supported by a window.
- *
- * Return value: the windowing system specific id for the window where
- * the drop should happen. This may be @xid or the id of a proxy
- * window, or zero if @xid doesn't support Drag and Drop.
- **/
-GdkNativeWindow
-gdk_drag_get_protocol (GdkNativeWindow xid,
- GdkDragProtocol *protocol)
-{
- return gdk_drag_get_protocol_for_display (gdk_display_get_default (), xid, protocol);
-}
-
/**
* gdk_drag_context_list_targets:
* @context: a #GdkDragContext
@@ -185,3 +137,321 @@ gdk_drag_context_get_source_window (GdkDragContext *context)
return context->source_window;
}
+
+/**
+ * gdk_drag_context_get_dest_window:
+ * @context: a #GdkDragContext
+ *
+ * Returns the destination windw for the DND operation.
+ *
+ * Return value: (transfer none): a #GdkWindow
+ *
+ * Since: 3.0
+ **/
+GdkWindow *
+gdk_drag_context_get_dest_window (GdkDragContext *context)
+{
+ g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
+
+ return context->dest_window;
+}
+
+/**
+ * gdk_drag_context_get_protocol:
+ * @context: a #GdkDragContext
+ *
+ * Returns the drag protocol thats used by this context.
+ *
+ * Returns: the drag protocol
+ *
+ * Since: 3.0
+ */
+GdkDragProtocol
+gdk_drag_context_get_protocol (GdkDragContext *context)
+{
+ g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_DRAG_PROTO_NONE);
+
+ return context->protocol;
+}
+
+/**
+ * gdk_drag_context_set_device:
+ * @context: a #GdkDragContext
+ * @device: a #GdkDevice
+ *
+ * Associates a #GdkDevice to @context, so all Drag and Drop events
+ * for @context are emitted as if they came from this device.
+ */
+void
+gdk_drag_context_set_device (GdkDragContext *context,
+ GdkDevice *device)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+ g_return_if_fail (GDK_IS_DEVICE (device));
+
+ if (context->device)
+ g_object_unref (context->device);
+
+ context->device = device;
+
+ if (context->device)
+ g_object_ref (context->device);
+}
+
+/**
+ * gdk_drag_context_get_device:
+ * @context: a #GdkDragContext
+ *
+ * Returns the #GdkDevice associated to the drag context.
+ *
+ * Returns: (transfer none): The #GdkDevice associated to @context.
+ **/
+GdkDevice *
+gdk_drag_context_get_device (GdkDragContext *context)
+{
+ g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
+
+ return context->device;
+}
+
+G_DEFINE_TYPE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
+
+static void
+gdk_drag_context_init (GdkDragContext *context)
+{
+}
+
+static void
+gdk_drag_context_finalize (GObject *object)
+{
+ GdkDragContext *context = GDK_DRAG_CONTEXT (object);
+
+ g_list_free (context->targets);
+
+ if (context->source_window)
+ g_object_unref (context->source_window);
+
+ if (context->dest_window)
+ g_object_unref (context->dest_window);
+
+ G_OBJECT_CLASS (gdk_drag_context_parent_class)->finalize (object);
+}
+
+static void
+gdk_drag_context_class_init (GdkDragContextClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = gdk_drag_context_finalize;
+}
+
+/**
+ * gdk_drag_find_window_for_screen:
+ * @context: a #GdkDragContext
+ * @drag_window: a window which may be at the pointer position, but
+ * should be ignored, since it is put up by the drag source as an icon
+ * @screen: the screen where the destination window is sought
+ * @x_root: the x position of the pointer in root coordinates
+ * @y_root: the y position of the pointer in root coordinates
+ * @dest_window: (out): location to store the destination window in
+ * @protocol: (out): location to store the DND protocol in
+ *
+ * Finds the destination window and DND protocol to use at the
+ * given pointer position.
+ *
+ * This function is called by the drag source to obtain the
+ * @dest_window and @protocol parameters for gdk_drag_motion().
+ *
+ * Since: 2.2
+ */
+void
+gdk_drag_find_window_for_screen (GdkDragContext *context,
+ GdkWindow *drag_window,
+ GdkScreen *screen,
+ gint x_root,
+ gint y_root,
+ GdkWindow **dest_window,
+ GdkDragProtocol *protocol)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ *dest_window = GDK_DRAG_CONTEXT_GET_CLASS (context)
+ ->find_window (context, drag_window, screen, x_root, y_root, protocol);
+}
+
+/**
+ * gdk_drag_status:
+ * @context: a #GdkDragContext
+ * @action: the selected action which will be taken when a drop happens,
+ * or 0 to indicate that a drop will not be accepted
+ * @time_: the timestamp for this operation
+ *
+ * Selects one of the actions offered by the drag source.
+ *
+ * This function is called by the drag destination in response to
+ * gdk_drag_motion() called by the drag source.
+ */
+void
+gdk_drag_status (GdkDragContext *context,
+ GdkDragAction action,
+ guint32 time_)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_status (context, action, time_);
+}
+
+/**
+ * gdk_drag_motion:
+ * @context: a #GdkDragContext
+ * @dest_window: the new destination window, obtained by
+ * gdk_drag_find_window()
+ * @protocol: the DND protocol in use, obtained by gdk_drag_find_window()
+ * @x_root: the x position of the pointer in root coordinates
+ * @y_root: the y position of the pointer in root coordinates
+ * @suggested_action: the suggested action
+ * @possible_actions: the possible actions
+ * @time_: the timestamp for this operation
+ *
+ * Updates the drag context when the pointer moves or the
+ * set of actions changes.
+ *
+ * This function is called by the drag source.
+ */
+gboolean
+gdk_drag_motion (GdkDragContext *context,
+ GdkWindow *dest_window,
+ GdkDragProtocol protocol,
+ gint x_root,
+ gint y_root,
+ GdkDragAction suggested_action,
+ GdkDragAction possible_actions,
+ guint32 time_)
+{
+ g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), FALSE);
+
+ return GDK_DRAG_CONTEXT_GET_CLASS (context)
+ ->drag_motion (context,
+ dest_window,
+ protocol,
+ x_root,
+ y_root,
+ suggested_action,
+ possible_actions,
+ time_);
+}
+
+/**
+ * gdk_drag_abort:
+ * @context: a #GdkDragContext
+ * @time_: the timestamp for this operation
+ *
+ * Aborts a drag without dropping.
+ *
+ * This function is called by the drag source.
+ */
+void
+gdk_drag_abort (GdkDragContext *context,
+ guint32 time_)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_abort (context, time_);
+}
+
+/**
+ * gdk_drag_drop:
+ * @context: a #GdkDragContext
+ * @time_: the timestamp for this operation
+ *
+ * Drops on the current destination.
+ *
+ * This function is called by the drag source.
+ */
+void
+gdk_drag_drop (GdkDragContext *context,
+ guint32 time_)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_drop (context, time_);
+}
+
+/**
+ * gdk_drop_reply:
+ * @context: a #GdkDragContext
+ * @accepted: %TRUE if the drop is accepted
+ * @time_: the timestamp for this operation
+ *
+ * Accepts or rejects a drop.
+ *
+ * This function is called by the drag destination in response
+ * to a drop initiated by the drag source.
+ */
+void
+gdk_drop_reply (GdkDragContext *context,
+ gboolean accepted,
+ guint32 time_)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_reply (context, accepted, time_);
+}
+
+/**
+ * gdk_drop_finish:
+ * @context: a #GtkDragContext
+ * @success: %TRUE if the data was successfully received
+ * @time_: the timestamp for this operation
+ *
+ * Ends the drag operation after a drop.
+ *
+ * This function is called by the drag destination.
+ */
+void
+gdk_drop_finish (GdkDragContext *context,
+ gboolean success,
+ guint32 time_)
+{
+ g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
+
+ GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_finish (context, success, time_);
+}
+
+/**
+ * gdk_drag_drop_succeeded:
+ * @context: a #GdkDragContext
+ *
+ * Returns whether the dropped data has been successfully
+ * transferred. This function is intended to be used while
+ * handling a %GDK_DROP_FINISHED event, its return value is
+ * meaningless at other times.
+ *
+ * Return value: %TRUE if the drop was successful.
+ *
+ * Since: 2.6
+ **/
+gboolean
+gdk_drag_drop_succeeded (GdkDragContext *context)
+{
+ g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), FALSE);
+
+ return GDK_DRAG_CONTEXT_GET_CLASS (context)->drop_status (context);
+}
+
+/**
+ * gdk_drag_get_selection:
+ * @context: a #GdkDragContext.
+ *
+ * Returns the selection atom for the current source window.
+ *
+ * Return value: the selection atom, or %GDK_NONE
+ */
+GdkAtom
+gdk_drag_get_selection (GdkDragContext *context)
+{
+ g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_NONE);
+ g_return_val_if_fail (context->source_window != NULL, GDK_NONE);
+
+ return GDK_DRAG_CONTEXT_GET_CLASS (context)->get_selection (context);
+}
diff --git a/gdk/gdkdnd.h b/gdk/gdkdnd.h
index b257d1e8f0..06c5f31ccf 100644
--- a/gdk/gdkdnd.h
+++ b/gdk/gdkdnd.h
@@ -36,7 +36,9 @@
G_BEGIN_DECLS
-typedef struct _GdkDragContext GdkDragContext;
+#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
+#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
+#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
/**
* GdkDragAction:
@@ -81,60 +83,15 @@ typedef enum
{
GDK_DRAG_PROTO_MOTIF,
GDK_DRAG_PROTO_XDND,
- GDK_DRAG_PROTO_ROOTWIN, /* A root window with nobody claiming
- * drags */
- GDK_DRAG_PROTO_NONE, /* Not a valid drag window */
- GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */
- GDK_DRAG_PROTO_OLE2, /* The complex OLE2 dnd (not implemented) */
- GDK_DRAG_PROTO_LOCAL /* Intra-app */
+ GDK_DRAG_PROTO_ROOTWIN,
+ GDK_DRAG_PROTO_NONE,
+ GDK_DRAG_PROTO_WIN32_DROPFILES,
+ GDK_DRAG_PROTO_OLE2,
+ GDK_DRAG_PROTO_LOCAL
} GdkDragProtocol;
-/* Object that holds information about a drag in progress.
- * this is used on both source and destination sides.
- */
-typedef struct _GdkDragContextClass GdkDragContextClass;
-
-#define GDK_TYPE_DRAG_CONTEXT (gdk_drag_context_get_type ())
-#define GDK_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAG_CONTEXT, GdkDragContext))
-#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
-#define GDK_IS_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAG_CONTEXT))
-#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
-#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
-
-struct _GdkDragContext {
- GObject parent_instance;
-
- /*< public >*/
-
- GdkDragProtocol GSEAL (protocol);
-
- gboolean GSEAL (is_source);
-
- GdkWindow *GSEAL (source_window);
- GdkWindow *GSEAL (dest_window);
-
- GList *GSEAL (targets);
- GdkDragAction GSEAL (actions);
- GdkDragAction GSEAL (suggested_action);
- GdkDragAction GSEAL (action);
-
- guint32 GSEAL (start_time);
-
- /*< private >*/
-
- gpointer GSEAL (windowing_data);
-};
-
-struct _GdkDragContextClass {
- GObjectClass parent_class;
-
-};
-
-/* Drag and Drop */
-
-GType gdk_drag_context_get_type (void) G_GNUC_CONST;
-GdkDragContext * gdk_drag_context_new (void);
+GType gdk_drag_context_get_type (void) G_GNUC_CONST;
void gdk_drag_context_set_device (GdkDragContext *context,
GdkDevice *device);
@@ -146,61 +103,55 @@ GdkDragAction gdk_drag_context_get_suggested_action (GdkDragContext *context)
GdkDragAction gdk_drag_context_get_selected_action (GdkDragContext *context);
GdkWindow *gdk_drag_context_get_source_window (GdkDragContext *context);
+GdkWindow *gdk_drag_context_get_dest_window (GdkDragContext *context);
+GdkDragProtocol gdk_drag_context_get_protocol (GdkDragContext *context);
/* Destination side */
void gdk_drag_status (GdkDragContext *context,
- GdkDragAction action,
- guint32 time_);
+ GdkDragAction action,
+ guint32 time_);
void gdk_drop_reply (GdkDragContext *context,
- gboolean ok,
- guint32 time_);
+ gboolean accepted,
+ guint32 time_);
void gdk_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time_);
+ gboolean success,
+ guint32 time_);
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
/* Source side */
-GdkDragContext * gdk_drag_begin (GdkWindow *window,
- GList *targets);
+GdkDragContext * gdk_drag_begin (GdkWindow *window,
+ GList *targets);
+
+GdkDragContext * gdk_drag_begin_for_device (GdkWindow *window,
+ GdkDevice *device,
+ GList *targets);
GdkNativeWindow gdk_drag_get_protocol_for_display (GdkDisplay *display,
- GdkNativeWindow xid,
- GdkDragProtocol *protocol);
+ GdkNativeWindow xid,
+ GdkDragProtocol *protocol);
void gdk_drag_find_window_for_screen (GdkDragContext *context,
- GdkWindow *drag_window,
- GdkScreen *screen,
- gint x_root,
- gint y_root,
- GdkWindow **dest_window,
- GdkDragProtocol *protocol);
-
-#ifndef GDK_MULTIHEAD_SAFE
-GdkNativeWindow gdk_drag_get_protocol (GdkNativeWindow xid,
- GdkDragProtocol *protocol);
-
-void gdk_drag_find_window (GdkDragContext *context,
- GdkWindow *drag_window,
- gint x_root,
- gint y_root,
- GdkWindow **dest_window,
- GdkDragProtocol *protocol);
-#endif /* GDK_MULTIHEAD_SAFE */
+ GdkWindow *drag_window,
+ GdkScreen *screen,
+ gint x_root,
+ gint y_root,
+ GdkWindow **dest_window,
+ GdkDragProtocol *protocol);
gboolean gdk_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time_);
+ GdkWindow *dest_window,
+ GdkDragProtocol protocol,
+ gint x_root,
+ gint y_root,
+ GdkDragAction suggested_action,
+ GdkDragAction possible_actions,
+ guint32 time_);
void gdk_drag_drop (GdkDragContext *context,
- guint32 time_);
+ guint32 time_);
void gdk_drag_abort (GdkDragContext *context,
- guint32 time_);
+ guint32 time_);
gboolean gdk_drag_drop_succeeded (GdkDragContext *context);
G_END_DECLS
diff --git a/gdk/gdkdndprivate.h b/gdk/gdkdndprivate.h
new file mode 100644
index 0000000000..f1124304a6
--- /dev/null
+++ b/gdk/gdkdndprivate.h
@@ -0,0 +1,91 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010, Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_DND_PRIVATE_H__
+#define __GDK_DND_PRIVATE_H__
+
+#include "gdkdnd.h"
+
+G_BEGIN_DECLS
+
+
+#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
+#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
+#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
+
+typedef struct _GdkDragContextClass GdkDragContextClass;
+
+
+struct _GdkDragContextClass {
+ GObjectClass parent_class;
+
+ GdkWindow * (*find_window) (GdkDragContext *context,
+ GdkWindow *drag_window,
+ GdkScreen *screen,
+ gint x_root,
+ gint y_root,
+ GdkDragProtocol *protocol);
+ GdkAtom (*get_selection) (GdkDragContext *context);
+ gboolean (*drag_motion) (GdkDragContext *context,
+ GdkWindow *dest_window,
+ GdkDragProtocol protocol,
+ gint root_x,
+ gint root_y,
+ GdkDragAction suggested_action,
+ GdkDragAction possible_actions,
+ guint32 time_);
+ void (*drag_status) (GdkDragContext *context,
+ GdkDragAction action,
+ guint32 time_);
+ void (*drag_abort) (GdkDragContext *context,
+ guint32 time_);
+ void (*drag_drop) (GdkDragContext *context,
+ guint32 time_);
+ void (*drop_reply) (GdkDragContext *context,
+ gboolean accept,
+ guint32 time_);
+ void (*drop_finish) (GdkDragContext *context,
+ gboolean success,
+ guint32 time_);
+ gboolean (*drop_status) (GdkDragContext *context);
+};
+
+struct _GdkDragContext {
+ GObject parent_instance;
+
+ /*< private >*/
+ GdkDragProtocol protocol;
+
+ gboolean is_source;
+ GdkWindow *source_window;
+ GdkWindow *dest_window;
+
+ GList *targets;
+ GdkDragAction actions;
+ GdkDragAction suggested_action;
+ GdkDragAction action;
+
+ guint32 start_time;
+
+ GdkDevice *device;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 438beb8a1f..1878799fea 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -27,6 +27,7 @@
#include "config.h"
#include "gdkinternals.h"
+#include "gdkdisplayprivate.h"
#include
#include
@@ -276,6 +277,45 @@ gdk_event_handler_set (GdkEventFunc func,
_gdk_event_notify = notify;
}
+/**
+ * gdk_events_pending:
+ *
+ * Checks if any events are ready to be processed for any display.
+ *
+ * Return value: %TRUE if any events are pending.
+ */
+gboolean
+gdk_events_pending (void)
+{
+ GSList *list, *l;
+ gboolean pending;
+
+ pending = FALSE;
+ list = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ for (l = list; l; l = l->next)
+ {
+ if (_gdk_event_queue_find_first (l->data))
+ {
+ pending = TRUE;
+ goto out;
+ }
+ }
+
+ for (l = list; l; l = l->next)
+ {
+ if (gdk_display_has_pending (l->data))
+ {
+ pending = TRUE;
+ goto out;
+ }
+ }
+
+ out:
+ g_slist_free (list);
+
+ return pending;
+}
+
/**
* gdk_event_get:
*
@@ -289,16 +329,21 @@ gdk_event_handler_set (GdkEventFunc func,
GdkEvent*
gdk_event_get (void)
{
- GSList *tmp_list;
+ GSList *list, *l;
+ GdkEvent *event;
- for (tmp_list = _gdk_displays; tmp_list; tmp_list = tmp_list->next)
+ event = NULL;
+ list = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ for (l = list; l; l = l->next)
{
- GdkEvent *event = gdk_display_get_event (tmp_list->data);
+ event = gdk_display_get_event (l->data);
if (event)
- return event;
+ break;
}
- return NULL;
+ g_slist_free (list);
+
+ return event;
}
/**
@@ -314,16 +359,21 @@ gdk_event_get (void)
GdkEvent*
gdk_event_peek (void)
{
- GSList *tmp_list;
+ GSList *list, *l;
+ GdkEvent *event;
- for (tmp_list = _gdk_displays; tmp_list; tmp_list = tmp_list->next)
+ event = NULL;
+ list = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ for (l = list; l; l = l->next)
{
- GdkEvent *event = gdk_display_peek_event (tmp_list->data);
+ event = gdk_display_peek_event (l->data);
if (event)
- return event;
+ break;
}
- return NULL;
+ g_slist_free (list);
+
+ return event;
}
/**
@@ -521,8 +571,8 @@ gdk_event_copy (const GdkEvent *event)
}
if (gdk_event_is_allocated (event))
- _gdk_windowing_event_data_copy (event, new_event);
-
+ _gdk_display_event_data_copy (gdk_display_get_default (), event, new_event);
+
return new_event;
}
@@ -589,7 +639,7 @@ gdk_event_free (GdkEvent *event)
break;
}
- _gdk_windowing_event_data_free (event);
+ _gdk_display_event_data_free (gdk_display_get_default (), event);
g_hash_table_remove (event_hash, event);
g_slice_free (GdkEventPrivate, (GdkEventPrivate*) event);
@@ -706,8 +756,6 @@ gdk_event_get_state (const GdkEvent *event,
*state = event->crossing.state;
return TRUE;
case GDK_PROPERTY_NOTIFY:
- *state = event->property.state;
- return TRUE;
case GDK_VISIBILITY_NOTIFY:
case GDK_CLIENT_EVENT:
case GDK_CONFIGURE:
@@ -1076,6 +1124,66 @@ gdk_event_get_device (const GdkEvent *event)
}
}
+/**
+ * gdk_event_set_source_device:
+ * @event: a #GdkEvent
+ * @device: a #GdkDevice
+ *
+ * Sets the slave device for @event to @device. The event
+ * must have been allocated by GTK+, for instance, by
+ * gdk_event_copy().
+ *
+ * Since: 3.0
+ **/
+void
+gdk_event_set_source_device (GdkEvent *event,
+ GdkDevice *device)
+{
+ GdkEventPrivate *private;
+
+ g_return_if_fail (gdk_event_is_allocated (event));
+ g_return_if_fail (GDK_IS_DEVICE (device));
+
+ private = (GdkEventPrivate *) event;
+
+ private->source_device = device;
+}
+
+/**
+ * gdk_event_get_source_device:
+ * @event: a #GdkEvent
+ *
+ * This function returns the hardware (slave) #GdkDevice that has triggered the event,
+ * falling back to the virtual (master) device (as in gdk_event_get_device()) if the
+ * event wasn't caused by interaction with a hardware device. This may happen for
+ * example in synthesized crossing events after a #GdkWindow updates its geometry or
+ * a grab is acquired/released.
+ *
+ * If the event does not contain device field, this function will return %NULL.
+ *
+ * Returns: a #GdkDevice, or %NULL.
+ *
+ * Since: 3.0
+ **/
+GdkDevice *
+gdk_event_get_source_device (const GdkEvent *event)
+{
+ GdkEventPrivate *private;
+
+ g_return_val_if_fail (event != NULL, NULL);
+
+ if (!gdk_event_is_allocated (event))
+ return NULL;
+
+ private = (GdkEventPrivate *) event;
+
+ if (private->source_device)
+ return private->source_device;
+
+ /* Fallback to event device */
+ return gdk_event_get_device (event);
+}
+
/**
* gdk_event_request_motions:
* @event: a valid #GdkEvent
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index fcefc6c1c8..258be496a1 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -100,7 +100,7 @@ typedef union _GdkEvent GdkEvent;
/**
* GdkEventFunc:
* @event: the #GdkEvent to process.
- * @data: user data set when the event handler was installed with
+ * @data: (closure): user data set when the event handler was installed with
* gdk_event_handler_set().
*
* Specifies the type of function passed to gdk_event_handler_set() to
@@ -1089,6 +1089,9 @@ gboolean gdk_event_get_axis (const GdkEvent *event,
void gdk_event_set_device (GdkEvent *event,
GdkDevice *device);
GdkDevice* gdk_event_get_device (const GdkEvent *event);
+void gdk_event_set_source_device (GdkEvent *event,
+ GdkDevice *device);
+GdkDevice* gdk_event_get_source_device (const GdkEvent *event);
void gdk_event_request_motions (const GdkEventMotion *event);
gboolean gdk_events_get_distance (GdkEvent *event1,
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
index 5413886694..085568fbca 100644
--- a/gdk/gdkglobals.c
+++ b/gdk/gdkglobals.c
@@ -35,9 +35,7 @@
guint _gdk_debug_flags = 0;
GList *_gdk_default_filters = NULL;
gchar *_gdk_display_name = NULL;
-gint _gdk_screen_number = -1;
gchar *_gdk_display_arg_name = NULL;
gboolean _gdk_native_windows = FALSE;
-gboolean _gdk_enable_multidevice = FALSE;
+gboolean _gdk_disable_multidevice = FALSE;
-GSList *_gdk_displays = NULL;
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index a0063cdc97..e7baa04a68 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -30,10 +30,9 @@
#define __GDK_INTERNALS_H__
#include
-#include
-#include
-#include
-#include
+#include "gdkwindowimpl.h"
+#include "gdkdisplay.h"
+#include "gdkprivate.h"
G_BEGIN_DECLS
@@ -44,8 +43,8 @@ G_BEGIN_DECLS
/* Debugging support */
typedef struct _GdkColorInfo GdkColorInfo;
-typedef struct _GdkEventFilter GdkEventFilter;
-typedef struct _GdkClientFilter GdkClientFilter;
+typedef struct _GdkEventFilter GdkEventFilter;
+typedef struct _GdkClientFilter GdkClientFilter;
typedef enum {
GDK_COLOR_WRITEABLE = 1 << 0
@@ -80,26 +79,26 @@ typedef enum {
GDK_DEBUG_DND = 1 << 2,
GDK_DEBUG_XIM = 1 << 3,
GDK_DEBUG_NOGRABS = 1 << 4,
- GDK_DEBUG_COLORMAP = 1 << 5,
- GDK_DEBUG_INPUT = 1 << 6,
- GDK_DEBUG_CURSOR = 1 << 7,
- GDK_DEBUG_MULTIHEAD = 1 << 8,
- GDK_DEBUG_XINERAMA = 1 << 9,
- GDK_DEBUG_DRAW = 1 <<10,
+ GDK_DEBUG_COLORMAP = 1 << 5,
+ GDK_DEBUG_INPUT = 1 << 6,
+ GDK_DEBUG_CURSOR = 1 << 7,
+ GDK_DEBUG_MULTIHEAD = 1 << 8,
+ GDK_DEBUG_XINERAMA = 1 << 9,
+ GDK_DEBUG_DRAW = 1 <<10,
GDK_DEBUG_EVENTLOOP = 1 <<11
} GdkDebugFlag;
extern GList *_gdk_default_filters;
-extern GdkWindow *_gdk_parent_root;
+extern GdkWindow *_gdk_parent_root;
extern guint _gdk_debug_flags;
extern gboolean _gdk_native_windows;
#ifdef G_ENABLE_DEBUG
-#define GDK_NOTE(type,action) G_STMT_START { \
- if (_gdk_debug_flags & GDK_DEBUG_##type) \
- { action; }; } G_STMT_END
+#define GDK_NOTE(type,action) G_STMT_START { \
+ if (_gdk_debug_flags & GDK_DEBUG_##type) \
+ { action; }; } G_STMT_END
#else /* !G_ENABLE_DEBUG */
@@ -156,33 +155,11 @@ struct _GdkEventPrivate
GdkScreen *screen;
gpointer windowing_data;
GdkDevice *device;
+ GdkDevice *source_device;
};
-/* Tracks information about the pointer grab on this display */
-typedef struct
-{
- GdkWindow *window;
- GdkWindow *native_window;
- gulong serial_start;
- gulong serial_end; /* exclusive, i.e. not active on serial_end */
- gboolean owner_events;
- guint event_mask;
- gboolean implicit;
- guint32 time;
- GdkGrabOwnership ownership;
-
- guint activated : 1;
- guint implicit_ungrab : 1;
-} GdkDeviceGrabInfo;
-
-typedef struct _GdkInputWindow GdkInputWindow;
typedef struct _GdkWindowPaint GdkWindowPaint;
-typedef void (* GdkDisplayPointerInfoForeach) (GdkDisplay *display,
- GdkDevice *device,
- GdkPointerWindowInfo *device_info,
- gpointer user_data);
-
struct _GdkWindow
{
GObject parent_instance;
@@ -252,7 +229,6 @@ struct _GdkWindow
guint num_offscreen_children;
GdkWindowPaint *implicit_paint;
- GdkInputWindow *input_window; /* only set for impl windows */
GList *outstanding_moves;
@@ -263,28 +239,33 @@ struct _GdkWindow
GList *devices_inside;
GHashTable *device_events;
+
+ GHashTable *source_event_masks;
+ gulong device_added_handler_id;
+ gulong device_changed_handler_id;
};
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
#define GDK_WINDOW_DESTROYED(d) (GDK_WINDOW (d)->destroyed)
-extern GSList *_gdk_displays;
extern gchar *_gdk_display_name;
extern gint _gdk_screen_number;
extern gchar *_gdk_display_arg_name;
-extern gboolean _gdk_enable_multidevice;
+extern gboolean _gdk_disable_multidevice;
-void _gdk_events_queue (GdkDisplay *display);
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
+void _gdk_event_filter_unref (GdkWindow *window,
+ GdkEventFilter *filter);
+
void _gdk_event_emit (GdkEvent *event);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
- GList *node);
+ GList *node);
GList* _gdk_event_queue_prepend (GdkDisplay *display,
- GdkEvent *event);
+ GdkEvent *event);
GList* _gdk_event_queue_append (GdkDisplay *display,
- GdkEvent *event);
+ GdkEvent *event);
GList* _gdk_event_queue_insert_after (GdkDisplay *display,
GdkEvent *after_event,
GdkEvent *event);
@@ -292,7 +273,7 @@ GList* _gdk_event_queue_insert_before(GdkDisplay *display,
GdkEvent *after_event,
GdkEvent *event);
void _gdk_event_button_generate (GdkDisplay *display,
- GdkEvent *event);
+ GdkEvent *event);
void _gdk_windowing_event_data_copy (const GdkEvent *src,
GdkEvent *dst);
@@ -302,8 +283,6 @@ void gdk_synthesize_window_state (GdkWindow *window,
GdkWindowState unset_flags,
GdkWindowState set_flags);
-GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
-
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
GdkRectangle *extents);
@@ -314,12 +293,6 @@ gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
cairo_surface_t *
_gdk_window_ref_cairo_surface (GdkWindow *window);
-void _gdk_window_impl_new (GdkWindow *window,
- GdkWindow *real_parent,
- GdkScreen *screen,
- GdkEventMask event_mask,
- GdkWindowAttr *attributes,
- gint attributes_mask);
void _gdk_window_destroy (GdkWindow *window,
gboolean foreign_destroy);
void _gdk_window_clear_update_area (GdkWindow *window);
@@ -331,8 +304,6 @@ void _gdk_window_process_updates_recurse (GdkWindow *window,
void _gdk_screen_close (GdkScreen *screen);
-const char *_gdk_get_sm_client_id (void);
-
/*****************************************
* Interfaces provided by windowing code *
*****************************************/
@@ -341,74 +312,20 @@ const char *_gdk_get_sm_client_id (void);
void _gdk_cursor_destroy (GdkCursor *cursor);
-void _gdk_windowing_init (void);
-
extern const GOptionEntry _gdk_windowing_args[];
-void _gdk_windowing_set_default_display (GdkDisplay *display);
-
gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
- gint screen_number);
+ gint screen_number);
-gulong _gdk_windowing_window_get_next_serial (GdkDisplay *display);
-void _gdk_windowing_window_get_offsets (GdkWindow *window,
- gint *x_offset,
- gint *y_offset);
-
-
-void _gdk_windowing_get_device_state (GdkDisplay *display,
- GdkDevice *device,
- GdkScreen **screen,
- gint *x,
- gint *y,
- GdkModifierType *mask);
-GdkWindow* _gdk_windowing_window_at_device_position (GdkDisplay *display,
- GdkDevice *device,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask,
- gboolean get_toplevel);
-GdkGrabStatus _gdk_windowing_device_grab (GdkDevice *device,
- GdkWindow *window,
- GdkWindow *native,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time);
void _gdk_windowing_got_event (GdkDisplay *display,
- GList *event_link,
- GdkEvent *event,
- gulong serial);
-
-void _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
- cairo_region_t *expose_region);
-void _gdk_windowing_before_process_all_updates (void);
-void _gdk_windowing_after_process_all_updates (void);
-
-/* Return the number of bits-per-pixel for images of the specified depth. */
-gint _gdk_windowing_get_bits_for_depth (GdkDisplay *display,
- gint depth);
-
+ GList *event_link,
+ GdkEvent *event,
+ gulong serial);
#define GDK_WINDOW_IS_MAPPED(window) (((window)->state & GDK_WINDOW_STATE_WITHDRAWN) == 0)
-
-/* Called when gdk_window_destroy() is called on a foreign window
- * or an ancestor of the foreign window. It should generally reparent
- * the window out of it's current heirarchy, hide it, and then
- * send a message to the owner requesting that the window be destroyed.
- */
-void _gdk_windowing_window_destroy_foreign (GdkWindow *window);
-
-void _gdk_windowing_display_set_sm_client_id (GdkDisplay *display,
- const gchar *sm_client_id);
-
-void _gdk_windowing_window_set_composited (GdkWindow *window,
- gboolean composited);
-
#define GDK_TYPE_PAINTABLE (_gdk_paintable_get_type ())
#define GDK_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PAINTABLE, GdkPaintable))
-#define GDK_IS_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
+#define GDK_IS_PAINTABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PAINTABLE))
#define GDK_PAINTABLE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GDK_TYPE_PAINTABLE, GdkPaintableIface))
typedef struct _GdkPaintable GdkPaintable;
@@ -426,82 +343,31 @@ struct _GdkPaintableIface
GType _gdk_paintable_get_type (void) G_GNUC_CONST;
-struct GdkAppLaunchContextPrivate
-{
- GdkDisplay *display;
- GdkScreen *screen;
- gint workspace;
- guint32 timestamp;
- GIcon *icon;
- char *icon_name;
-};
-
-char *_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
- GAppInfo *info,
- GList *files);
-void _gdk_windowing_launch_failed (GAppLaunchContext *context,
- const char *startup_notify_id);
-
-void _gdk_display_device_grab_update (GdkDisplay *display,
- GdkDevice *device,
- gulong current_serial);
-GdkDeviceGrabInfo *_gdk_display_get_last_device_grab (GdkDisplay *display,
- GdkDevice *device);
-GdkDeviceGrabInfo *_gdk_display_add_device_grab (GdkDisplay *display,
- GdkDevice *device,
- GdkWindow *window,
- GdkWindow *native_window,
- GdkGrabOwnership grab_ownership,
- gboolean owner_events,
- GdkEventMask event_mask,
- unsigned long serial_start,
- guint32 time,
- gboolean implicit);
-GdkDeviceGrabInfo * _gdk_display_has_device_grab (GdkDisplay *display,
- GdkDevice *device,
- gulong serial);
-gboolean _gdk_display_end_device_grab (GdkDisplay *display,
- GdkDevice *device,
- gulong serial,
- GdkWindow *if_child,
- gboolean implicit);
-gboolean _gdk_display_check_grab_ownership (GdkDisplay *display,
- GdkDevice *device,
- gulong serial);
-void _gdk_display_enable_motion_hints (GdkDisplay *display,
- GdkDevice *device);
-
-GdkPointerWindowInfo * _gdk_display_get_pointer_info (GdkDisplay *display,
- GdkDevice *device);
-
-void _gdk_display_pointer_info_foreach (GdkDisplay *display,
- GdkDisplayPointerInfoForeach func,
- gpointer user_data);
-
void _gdk_window_invalidate_for_expose (GdkWindow *window,
- cairo_region_t *region);
+ cairo_region_t *region);
GdkWindow * _gdk_window_find_child_at (GdkWindow *window,
- int x, int y);
+ int x, int y);
GdkWindow * _gdk_window_find_descendant_at (GdkWindow *toplevel,
- double x, double y,
- double *found_x,
- double *found_y);
+ double x, double y,
+ double *found_x,
+ double *found_y);
void _gdk_window_add_damage (GdkWindow *toplevel,
- cairo_region_t *damaged_region);
+ cairo_region_t *damaged_region);
GdkEvent * _gdk_make_event (GdkWindow *window,
- GdkEventType type,
- GdkEvent *event_in_queue,
- gboolean before_event);
+ GdkEventType type,
+ GdkEvent *event_in_queue,
+ gboolean before_event);
gboolean _gdk_window_event_parent_of (GdkWindow *parent,
GdkWindow *child);
void _gdk_synthesize_crossing_events (GdkDisplay *display,
- GdkWindow *src,
- GdkWindow *dest,
+ GdkWindow *src,
+ GdkWindow *dest,
GdkDevice *device,
+ GdkDevice *source_device,
GdkCrossingMode mode,
gint toplevel_x,
gint toplevel_y,
@@ -512,7 +378,7 @@ void _gdk_synthesize_crossing_events (GdkDisplay *display,
gboolean non_linear);
void _gdk_display_set_window_under_pointer (GdkDisplay *display,
GdkDevice *device,
- GdkWindow *window);
+ GdkWindow *window);
void _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window);
@@ -524,29 +390,19 @@ cairo_region_t *_gdk_window_calculate_full_clip_region (GdkWindow *window
gint *base_y_offset);
gboolean _gdk_window_has_impl (GdkWindow *window);
GdkWindow * _gdk_window_get_impl_window (GdkWindow *window);
-GdkWindow *_gdk_window_get_input_window_for_event (GdkWindow *native_window,
- GdkEventType event_type,
- int x, int y,
- gulong serial);
/*****************************
* offscreen window routines *
*****************************/
GType gdk_offscreen_window_get_type (void);
void _gdk_offscreen_window_new (GdkWindow *window,
- GdkWindowAttr *attributes,
- gint attributes_mask);
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
cairo_surface_t * _gdk_offscreen_window_create_surface (GdkWindow *window,
gint width,
gint height);
-/************************************
- * Initialization and exit routines *
- ************************************/
-
-void _gdk_windowing_exit (void);
-
G_END_DECLS
#endif /* __GDK_INTERNALS_H__ */
diff --git a/gdk/gdkkeynames.c b/gdk/gdkkeynames.c
index bbebc3b26b..6d1fcd4475 100644
--- a/gdk/gdkkeynames.c
+++ b/gdk/gdkkeynames.c
@@ -45,8 +45,8 @@ gdk_keys_keyval_compare (const void *pkey, const void *pbase)
return (*(int *) pkey) - ((gdk_key *) pbase)->keyval;
}
-gchar*
-gdk_keyval_name (guint keyval)
+static gchar*
+_gdk_keyval_name (guint keyval)
{
static gchar buf[100];
gdk_key *found;
@@ -86,8 +86,8 @@ gdk_keys_name_compare (const void *pkey, const void *pbase)
(const char *) (keynames + ((const gdk_key *) pbase)->offset));
}
-guint
-gdk_keyval_from_name (const gchar *keyval_name)
+static guint
+_gdk_keyval_from_name (const gchar *keyval_name)
{
gdk_key *found;
diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c
index 102b6f08e0..74993d6c20 100644
--- a/gdk/gdkkeys.c
+++ b/gdk/gdkkeys.c
@@ -26,9 +26,9 @@
#include "config.h"
-#include "gdkkeys.h"
-
+#include "gdkkeysprivate.h"
#include "gdkdisplay.h"
+#include "gdkdisplaymanagerprivate.h"
/**
@@ -183,12 +183,6 @@ gdk_keymap_init (GdkKeymap *keymap)
/* Other key-handling stuff
*/
-#ifndef HAVE_XCONVERTCASE
-#include "gdkkeysyms.h"
-
-/* compatibility function from X11R6.3, since XConvertCase is not
- * supplied by X11R5.
- */
/**
* gdk_keyval_convert_case:
* @symbol: a keyval
@@ -197,133 +191,16 @@ gdk_keymap_init (GdkKeymap *keymap)
*
* Obtains the upper- and lower-case versions of the keyval @symbol.
* Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
- *
- **/
+ */
void
gdk_keyval_convert_case (guint symbol,
- guint *lower,
- guint *upper)
+ guint *lower,
+ guint *upper)
{
- guint xlower = symbol;
- guint xupper = symbol;
+ GdkDisplayManager *manager = gdk_display_manager_get ();
- /* Check for directly encoded 24-bit UCS characters: */
- if ((symbol & 0xff000000) == 0x01000000)
- {
- if (lower)
- *lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
- if (upper)
- *upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
- return;
- }
-
- switch (symbol >> 8)
- {
- case 0: /* Latin 1 */
- if ((symbol >= GDK_KEY_A) && (symbol <= GDK_KEY_Z))
- xlower += (GDK_KEY_a - GDK_KEY_A);
- else if ((symbol >= GDK_KEY_a) && (symbol <= GDK_KEY_z))
- xupper -= (GDK_KEY_a - GDK_KEY_A);
- else if ((symbol >= GDK_KEY_Agrave) && (symbol <= GDK_KEY_Odiaeresis))
- xlower += (GDK_KEY_agrave - GDK_KEY_Agrave);
- else if ((symbol >= GDK_KEY_agrave) && (symbol <= GDK_KEY_odiaeresis))
- xupper -= (GDK_KEY_agrave - GDK_KEY_Agrave);
- else if ((symbol >= GDK_KEY_Ooblique) && (symbol <= GDK_KEY_Thorn))
- xlower += (GDK_KEY_oslash - GDK_KEY_Ooblique);
- else if ((symbol >= GDK_KEY_oslash) && (symbol <= GDK_KEY_thorn))
- xupper -= (GDK_KEY_oslash - GDK_KEY_Ooblique);
- break;
-
- case 1: /* Latin 2 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (symbol == GDK_KEY_Aogonek)
- xlower = GDK_KEY_aogonek;
- else if (symbol >= GDK_KEY_Lstroke && symbol <= GDK_KEY_Sacute)
- xlower += (GDK_KEY_lstroke - GDK_KEY_Lstroke);
- else if (symbol >= GDK_KEY_Scaron && symbol <= GDK_KEY_Zacute)
- xlower += (GDK_KEY_scaron - GDK_KEY_Scaron);
- else if (symbol >= GDK_KEY_Zcaron && symbol <= GDK_KEY_Zabovedot)
- xlower += (GDK_KEY_zcaron - GDK_KEY_Zcaron);
- else if (symbol == GDK_KEY_aogonek)
- xupper = GDK_KEY_Aogonek;
- else if (symbol >= GDK_KEY_lstroke && symbol <= GDK_KEY_sacute)
- xupper -= (GDK_KEY_lstroke - GDK_KEY_Lstroke);
- else if (symbol >= GDK_KEY_scaron && symbol <= GDK_KEY_zacute)
- xupper -= (GDK_KEY_scaron - GDK_KEY_Scaron);
- else if (symbol >= GDK_KEY_zcaron && symbol <= GDK_KEY_zabovedot)
- xupper -= (GDK_KEY_zcaron - GDK_KEY_Zcaron);
- else if (symbol >= GDK_KEY_Racute && symbol <= GDK_KEY_Tcedilla)
- xlower += (GDK_KEY_racute - GDK_KEY_Racute);
- else if (symbol >= GDK_KEY_racute && symbol <= GDK_KEY_tcedilla)
- xupper -= (GDK_KEY_racute - GDK_KEY_Racute);
- break;
-
- case 2: /* Latin 3 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (symbol >= GDK_KEY_Hstroke && symbol <= GDK_KEY_Hcircumflex)
- xlower += (GDK_KEY_hstroke - GDK_KEY_Hstroke);
- else if (symbol >= GDK_KEY_Gbreve && symbol <= GDK_KEY_Jcircumflex)
- xlower += (GDK_KEY_gbreve - GDK_KEY_Gbreve);
- else if (symbol >= GDK_KEY_hstroke && symbol <= GDK_KEY_hcircumflex)
- xupper -= (GDK_KEY_hstroke - GDK_KEY_Hstroke);
- else if (symbol >= GDK_KEY_gbreve && symbol <= GDK_KEY_jcircumflex)
- xupper -= (GDK_KEY_gbreve - GDK_KEY_Gbreve);
- else if (symbol >= GDK_KEY_Cabovedot && symbol <= GDK_KEY_Scircumflex)
- xlower += (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
- else if (symbol >= GDK_KEY_cabovedot && symbol <= GDK_KEY_scircumflex)
- xupper -= (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
- break;
-
- case 3: /* Latin 4 */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (symbol >= GDK_KEY_Rcedilla && symbol <= GDK_KEY_Tslash)
- xlower += (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
- else if (symbol >= GDK_KEY_rcedilla && symbol <= GDK_KEY_tslash)
- xupper -= (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
- else if (symbol == GDK_KEY_ENG)
- xlower = GDK_KEY_eng;
- else if (symbol == GDK_KEY_eng)
- xupper = GDK_KEY_ENG;
- else if (symbol >= GDK_KEY_Amacron && symbol <= GDK_KEY_Umacron)
- xlower += (GDK_KEY_amacron - GDK_KEY_Amacron);
- else if (symbol >= GDK_KEY_amacron && symbol <= GDK_KEY_umacron)
- xupper -= (GDK_KEY_amacron - GDK_KEY_Amacron);
- break;
-
- case 6: /* Cyrillic */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (symbol >= GDK_KEY_Serbian_DJE && symbol <= GDK_KEY_Serbian_DZE)
- xlower -= (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
- else if (symbol >= GDK_KEY_Serbian_dje && symbol <= GDK_KEY_Serbian_dze)
- xupper += (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
- else if (symbol >= GDK_KEY_Cyrillic_YU && symbol <= GDK_KEY_Cyrillic_HARDSIGN)
- xlower -= (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
- else if (symbol >= GDK_KEY_Cyrillic_yu && symbol <= GDK_KEY_Cyrillic_hardsign)
- xupper += (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
- break;
-
- case 7: /* Greek */
- /* Assume the KeySym is a legal value (ignore discontinuities) */
- if (symbol >= GDK_KEY_Greek_ALPHAaccent && symbol <= GDK_KEY_Greek_OMEGAaccent)
- xlower += (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
- else if (symbol >= GDK_KEY_Greek_alphaaccent && symbol <= GDK_KEY_Greek_omegaaccent &&
- symbol != GDK_KEY_Greek_iotaaccentdieresis &&
- symbol != GDK_KEY_Greek_upsilonaccentdieresis)
- xupper -= (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
- else if (symbol >= GDK_KEY_Greek_ALPHA && symbol <= GDK_KEY_Greek_OMEGA)
- xlower += (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
- else if (symbol >= GDK_KEY_Greek_alpha && symbol <= GDK_KEY_Greek_omega &&
- symbol != GDK_KEY_Greek_finalsmallsigma)
- xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
- break;
- }
-
- if (lower)
- *lower = xlower;
- if (upper)
- *upper = xupper;
+ GDK_DISPLAY_MANAGER_GET_CLASS (manager)->keyval_convert_case (manager, symbol, lower, upper);
}
-#endif
/**
* gdk_keyval_to_upper:
@@ -407,7 +284,7 @@ gdk_keyval_is_lower (guint keyval)
return FALSE;
}
-/**
+/**
* gdk_keymap_get_default:
*
* Returns the #GdkKeymap attached to the default display.
@@ -419,3 +296,329 @@ gdk_keymap_get_default (void)
{
return gdk_keymap_get_for_display (gdk_display_get_default ());
}
+
+/**
+ * gdk_keymap_get_direction:
+ * @keymap: a #GdkKeymap
+ *
+ * Returns the direction of effective layout of the keymap.
+ *
+ * Returns: %PANGO_DIRECTION_LTR or %PANGO_DIRECTION_RTL
+ * if it can determine the direction. %PANGO_DIRECTION_NEUTRAL
+ * otherwise.
+ **/
+PangoDirection
+gdk_keymap_get_direction (GdkKeymap *keymap)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->get_direction (keymap);
+}
+
+/**
+ * gdk_keymap_have_bidi_layouts:
+ * @keymap: a #GdkKeymap
+ *
+ * Determines if keyboard layouts for both right-to-left and left-to-right
+ * languages are in use.
+ *
+ * Returns: %TRUE if there are layouts in both directions, %FALSE otherwise
+ *
+ * Since: 2.12
+ **/
+gboolean
+gdk_keymap_have_bidi_layouts (GdkKeymap *keymap)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->have_bidi_layouts (keymap);
+}
+
+/**
+ * gdk_keymap_get_caps_lock_state:
+ * @keymap: a #GdkKeymap
+ *
+ * Returns whether the Caps Lock modifer is locked.
+ *
+ * Returns: %TRUE if Caps Lock is on
+ *
+ * Since: 2.16
+ */
+gboolean
+gdk_keymap_get_caps_lock_state (GdkKeymap *keymap)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->get_caps_lock_state (keymap);
+}
+
+/**
+ * gdk_keymap_get_num_lock_state:
+ * @keymap: a #GdkKeymap
+ *
+ * Returns whether the Num Lock modifer is locked.
+ *
+ * Returns: %TRUE if Num Lock is on
+ *
+ * Since: 3.0
+ */
+gboolean
+gdk_keymap_get_num_lock_state (GdkKeymap *keymap)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->get_num_lock_state (keymap);
+}
+
+/**
+ * gdk_keymap_get_entries_for_keyval:
+ * @keymap: a #GdkKeymap
+ * @keyval: a keyval, such as %GDK_a, %GDK_Up, %GDK_Return, etc.
+ * @keys: (out): return location for an array of #GdkKeymapKey
+ * @n_keys: (out): return location for number of elements in returned array
+ *
+ * Obtains a list of keycode/group/level combinations that will
+ * generate @keyval. Groups and levels are two kinds of keyboard mode;
+ * in general, the level determines whether the top or bottom symbol
+ * on a key is used, and the group determines whether the left or
+ * right symbol is used. On US keyboards, the shift key changes the
+ * keyboard level, and there are no groups. A group switch key might
+ * convert a keyboard between Hebrew to English modes, for example.
+ * #GdkEventKey contains a %group field that indicates the active
+ * keyboard group. The level is computed from the modifier mask.
+ * The returned array should be freed
+ * with g_free().
+ *
+ * Return value: %TRUE if keys were found and returned
+ **/
+gboolean
+gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
+ guint keyval,
+ GdkKeymapKey **keys,
+ gint *n_keys)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->get_entries_for_keyval (keymap, keyval, keys, n_keys);
+}
+
+/**
+ * gdk_keymap_get_entries_for_keycode:
+ * @keymap: a #GdkKeymap
+ * @hardware_keycode: a keycode
+ * @keys: (out): return location for array of #GdkKeymapKey, or %NULL
+ * @keyvals: (out): return location for array of keyvals, or %NULL
+ * @n_entries: length of @keys and @keyvals
+ *
+ * Returns the keyvals bound to @hardware_keycode.
+ * The Nth #GdkKeymapKey in @keys is bound to the Nth
+ * keyval in @keyvals. Free the returned arrays with g_free().
+ * When a keycode is pressed by the user, the keyval from
+ * this list of entries is selected by considering the effective
+ * keyboard group and level. See gdk_keymap_translate_keyboard_state().
+ *
+ * Returns: %TRUE if there were any entries
+ **/
+gboolean
+gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
+ guint hardware_keycode,
+ GdkKeymapKey **keys,
+ guint **keyvals,
+ gint *n_entries)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->get_entries_for_keycode (keymap, hardware_keycode, keys, keyvals, n_entries);
+}
+
+/**
+ * gdk_keymap_lookup_key:
+ * @keymap: a #GdkKeymap
+ * @key: a #GdkKeymapKey with keycode, group, and level initialized
+ *
+ * Looks up the keyval mapped to a keycode/group/level triplet.
+ * If no keyval is bound to @key, returns 0. For normal user input,
+ * you want to use gdk_keymap_translate_keyboard_state() instead of
+ * this function, since the effective group/level may not be
+ * the same as the current keyboard state.
+ *
+ * Return value: a keyval, or 0 if none was mapped to the given @key
+ **/
+guint
+gdk_keymap_lookup_key (GdkKeymap *keymap,
+ const GdkKeymapKey *key)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->lookup_key (keymap, key);
+}
+
+/**
+ * gdk_keymap_translate_keyboard_state:
+ * @keymap: a #GdkKeymap
+ * @hardware_keycode: a keycode
+ * @state: a modifier state
+ * @group: active keyboard group
+ * @keyval: (out) (allow-none): return location for keyval, or %NULL
+ * @effective_group: (out) (allow-none): return location for effective
+ * group, or %NULL
+ * @level: (out) (allow-none): return location for level, or %NULL
+ * @consumed_modifiers: (out) (allow-none): return location for modifiers
+ * that were used to determine the group or level, or %NULL
+ *
+ * Translates the contents of a #GdkEventKey into a keyval, effective
+ * group, and level. Modifiers that affected the translation and
+ * are thus unavailable for application use are returned in
+ * @consumed_modifiers.
+ * See for an explanation of
+ * groups and levels. The @effective_group is the group that was
+ * actually used for the translation; some keys such as Enter are not
+ * affected by the active keyboard group. The @level is derived from
+ * @state. For convenience, #GdkEventKey already contains the translated
+ * keyval, so this function isn't as useful as you might think.
+ *
+ *
+ * @consumed_modifiers gives modifiers that should be masked out
+ * from @state when comparing this key press to a hot key. For
+ * instance, on a US keyboard, the plus
+ * symbol is shifted, so when comparing a key press to a
+ * <Control>plus accelerator <Shift> should
+ * be masked out.
+ *
+ *
+ * /* We want to ignore irrelevant modifiers like ScrollLock */
+ * #define ALL_ACCELS_MASK (GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK)
+ * gdk_keymap_translate_keyboard_state (keymap, event->hardware_keycode,
+ * event->state, event->group,
+ * &keyval, NULL, NULL, &consumed);
+ * if (keyval == GDK_PLUS &&
+ * (event->state & ~consumed & ALL_ACCELS_MASK) == GDK_CONTROL_MASK)
+ * /* Control was pressed */
+ *
+ *
+ * An older interpretation @consumed_modifiers was that it contained
+ * all modifiers that might affect the translation of the key;
+ * this allowed accelerators to be stored with irrelevant consumed
+ * modifiers, by doing:
+ *
+ * /* XXX Don't do this XXX */
+ * if (keyval == accel_keyval &&
+ * (event->state & ~consumed & ALL_ACCELS_MASK) == (accel_mods & ~consumed))
+ * /* Accelerator was pressed */
+ *
+ *
+ * However, this did not work if multi-modifier combinations were
+ * used in the keymap, since, for instance, <Control>
+ * would be masked out even if only <Control><Alt>
+ * was used in the keymap. To support this usage as well as well as
+ * possible, all single modifier combinations
+ * that could affect the key for any combination of modifiers will
+ * be returned in @consumed_modifiers; multi-modifier combinations
+ * are returned only when actually found in @state. When you store
+ * accelerators, you should always store them with consumed modifiers
+ * removed. Store <Control>plus ,
+ * not <Control><Shift>plus ,
+ *
+ *
+ * Return value: %TRUE if there was a keyval bound to the keycode/state/group
+ **/
+gboolean
+gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
+ guint hardware_keycode,
+ GdkModifierType state,
+ gint group,
+ guint *keyval,
+ gint *effective_group,
+ gint *level,
+ GdkModifierType *consumed_modifiers)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->translate_keyboard_state (keymap,
+ hardware_keycode,
+ state,
+ group,
+ keyval,
+ effective_group,
+ level,
+ consumed_modifiers);
+}
+
+/**
+ * gdk_keymap_add_virtual_modifiers:
+ * @keymap: a #GdkKeymap
+ * @state: pointer to the modifier mask to change
+ *
+ * Adds virtual modifiers (i.e. Super, Hyper and Meta) which correspond
+ * to the real modifiers (i.e Mod2, Mod3, ...) in @modifiers.
+ * are set in @state to their non-virtual counterparts (i.e. Mod2,
+ * Mod3,...) and set the corresponding bits in @state.
+ *
+ * GDK already does this before delivering key events, but for
+ * compatibility reasons, it only sets the first virtual modifier
+ * it finds, whereas this function sets all matching virtual modifiers.
+ *
+ * This function is useful when matching key events against
+ * accelerators.
+ *
+ * Since: 2.20
+ */
+void
+gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
+ GdkModifierType *state)
+{
+ GDK_KEYMAP_GET_CLASS(keymap)->add_virtual_modifiers (keymap, state);
+}
+
+/**
+ * gdk_keymap_map_virtual_modifiers:
+ * @keymap: a #GdkKeymap
+ * @state: pointer to the modifier state to map
+ *
+ * Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
+ * are set in @state to their non-virtual counterparts (i.e. Mod2,
+ * Mod3,...) and set the corresponding bits in @state.
+ *
+ * This function is useful when matching key events against
+ * accelerators.
+ *
+ * Returns: %TRUE if no virtual modifiers were mapped to the
+ * same non-virtual modifier. Note that %FALSE is also returned
+ * if a virtual modifier is mapped to a non-virtual modifier that
+ * was already set in @state.
+ *
+ * Since: 2.20
+ */
+gboolean
+gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
+ GdkModifierType *state)
+{
+ return GDK_KEYMAP_GET_CLASS(keymap)->map_virtual_modifiers (keymap, state);
+}
+
+/**
+ * gdk_keyval_name:
+ * @keyval: a key value
+ *
+ * Converts a key value into a symbolic name.
+ *
+ * The names are the same as those in the
+ * <gdk/gdkkeysyms.h> header file
+ * but without the leading "GDK_KEY_".
+ *
+ * Return value: (transfer none): a string containing the name of the key,
+ * or %NULL if @keyval is not a valid key. The string should not be
+ * modified.
+ */
+gchar*
+gdk_keyval_name (guint keyval)
+{
+ GdkDisplayManager *manager = gdk_display_manager_get ();
+
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->get_keyval_name (manager, keyval);
+}
+
+/**
+ * gdk_keyval_from_name:
+ * @keyval_name: a key name
+ *
+ * Converts a key name to a key value.
+ *
+ * The names are the same as those in the
+ * <gdk/gdkkeysyms.h> header file
+ * but without the leading "GDK_KEY_".
+ *
+ * Returns: the corresponding key value, or %GDK_KEY_VoidSymbol
+ * if the key name is not a valid key
+ */
+guint
+gdk_keyval_from_name (const gchar *keyval_name)
+{
+ GdkDisplayManager *manager = gdk_display_manager_get ();
+
+ return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->lookup_keyval (manager, keyval_name);
+}
diff --git a/gdk/gdkkeys.h b/gdk/gdkkeys.h
index 4551b98905..346fe40ac5 100644
--- a/gdk/gdkkeys.h
+++ b/gdk/gdkkeys.h
@@ -65,13 +65,7 @@ struct _GdkKeymapKey
#define GDK_TYPE_KEYMAP (gdk_keymap_get_type ())
#define GDK_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_KEYMAP, GdkKeymap))
-#define GDK_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_KEYMAP, GdkKeymapClass))
#define GDK_IS_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_KEYMAP))
-#define GDK_IS_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_KEYMAP))
-#define GDK_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_KEYMAP, GdkKeymapClass))
-
-typedef struct _GdkKeymap GdkKeymap;
-typedef struct _GdkKeymapClass GdkKeymapClass;
/**
* GdkKeymap:
@@ -83,20 +77,6 @@ typedef struct _GdkKeymapClass GdkKeymapClass;
* state; the second phase is to look up the keycode/group/level triplet
* in the keymap and see what keyval it corresponds to.
*/
-struct _GdkKeymap
-{
- GObject parent_instance;
- GdkDisplay *GSEAL (display);
-};
-
-struct _GdkKeymapClass
-{
- GObjectClass parent_class;
-
- void (*direction_changed) (GdkKeymap *keymap);
- void (*keys_changed) (GdkKeymap *keymap);
- void (*state_changed) (GdkKeymap *keymap);
-};
GType gdk_keymap_get_type (void) G_GNUC_CONST;
diff --git a/gdk/gdkkeysprivate.h b/gdk/gdkkeysprivate.h
new file mode 100644
index 0000000000..c0f1f0eaa9
--- /dev/null
+++ b/gdk/gdkkeysprivate.h
@@ -0,0 +1,80 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_KEYS_PRIVATE_H__
+#define __GDK_KEYS_PRIVATE_H__
+
+#include "gdkkeys.h"
+
+G_BEGIN_DECLS
+
+#define GDK_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_KEYMAP, GdkKeymapClass))
+#define GDK_IS_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_KEYMAP))
+#define GDK_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_KEYMAP, GdkKeymapClass))
+
+typedef struct _GdkKeymapClass GdkKeymapClass;
+
+struct _GdkKeymapClass
+{
+ GObjectClass parent_class;
+
+ PangoDirection (* get_direction) (GdkKeymap *keymap);
+ gboolean (* have_bidi_layouts) (GdkKeymap *keymap);
+ gboolean (* get_caps_lock_state) (GdkKeymap *keymap);
+ gboolean (* get_num_lock_state) (GdkKeymap *keymap);
+ gboolean (* get_entries_for_keyval) (GdkKeymap *keymap,
+ guint keyval,
+ GdkKeymapKey **keys,
+ gint *n_keys);
+ gboolean (* get_entries_for_keycode) (GdkKeymap *keymap,
+ guint hardware_keycode,
+ GdkKeymapKey **keys,
+ guint **keyvals,
+ gint *n_entries);
+ guint (* lookup_key) (GdkKeymap *keymap,
+ const GdkKeymapKey *key);
+ gboolean (* translate_keyboard_state) (GdkKeymap *keymap,
+ guint hardware_keycode,
+ GdkModifierType state,
+ gint group,
+ guint *keyval,
+ gint *effective_group,
+ gint *level,
+ GdkModifierType *consumed_modifiers);
+ void (* add_virtual_modifiers) (GdkKeymap *keymap,
+ GdkModifierType *state);
+ gboolean (* map_virtual_modifiers) (GdkKeymap *keymap,
+ GdkModifierType *state);
+
+
+ /* Signals */
+ void (*direction_changed) (GdkKeymap *keymap);
+ void (*keys_changed) (GdkKeymap *keymap);
+ void (*state_changed) (GdkKeymap *keymap);
+};
+
+struct _GdkKeymap
+{
+ GObject parent_instance;
+ GdkDisplay *display;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/gdkmain.h b/gdk/gdkmain.h
index 75ffb4e62a..bcbe4d07dc 100644
--- a/gdk/gdkmain.h
+++ b/gdk/gdkmain.h
@@ -50,30 +50,6 @@ gboolean gdk_init_check (gint *argc,
void gdk_add_option_entries_libgtk_only (GOptionGroup *group);
void gdk_pre_parse_libgtk_only (void);
-/**
- * gdk_set_locale:
- *
- * Initializes the support for internationalization by calling the setlocale()
- * system call. This function is called by gtk_set_locale() and so GTK+
- * applications should use that instead.
- *
- * The locale to use is determined by the LANG environment variable,
- * so to run an application in a certain locale you can do something like this:
- *
- *
- * export LANG="fr"
- * ... run application ...
- *
- *
- *
- * If the locale is not supported by X then it is reset to the standard "C"
- * locale.
- *
- * Returns: the resulting locale.
- */
-gchar* gdk_set_locale (void);
-void gdk_enable_multidevice (void);
-
G_CONST_RETURN gchar *gdk_get_program_class (void);
void gdk_set_program_class (const gchar *program_class);
@@ -93,14 +69,16 @@ G_CONST_RETURN gchar *gdk_get_display_arg_name (void);
/**
* gdk_get_display:
*
- * Gets the name of the display, which usually comes from the DISPLAY
- * environment variable or the --display command line option.
+ * Gets the name of the display, which usually comes from the
+ * DISPLAY environment variable or the
+ * --display command line option.
*
* Returns: the name of the display.
*/
-gchar* gdk_get_display (void);
+gchar* gdk_get_display (void);
#ifndef GDK_MULTIDEVICE_SAFE
+#ifndef GDK_DISABLE_DEPRECATED
GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
gboolean owner_events,
GdkEventMask event_mask,
@@ -110,14 +88,17 @@ GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
GdkGrabStatus gdk_keyboard_grab (GdkWindow *window,
gboolean owner_events,
guint32 time_);
+#endif /* GDK_DISABLE_DEPRECATED */
#endif /* GDK_MULTIDEVICE_SAFE */
#ifndef GDK_MULTIHEAD_SAFE
#ifndef GDK_MULTIDEVICE_SAFE
+#ifndef GDK_DISABLE_DEPRECATED
void gdk_pointer_ungrab (guint32 time_);
void gdk_keyboard_ungrab (guint32 time_);
gboolean gdk_pointer_is_grabbed (void);
+#endif /* GDK_DISABLE_DEPRECATED */
#endif /* GDK_MULTIDEVICE_SAFE */
gint gdk_screen_width (void) G_GNUC_CONST;
@@ -132,15 +113,10 @@ void gdk_beep (void);
#endif /* GDK_MULTIHEAD_SAFE */
-/**
- * gdk_flush:
- *
- * Flushes the X output buffer and waits until all requests have been processed
- * by the server. This is rarely needed by applications. It's main use is for
- * trapping X errors with gdk_error_trap_push() and gdk_error_trap_pop().
- */
void gdk_flush (void);
+void gdk_disable_multidevice (void);
+
G_END_DECLS
#endif /* __GDK_MAIN_H__ */
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 9ade91bee1..fa1518f0d7 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -549,8 +549,7 @@ gdk_offscreen_window_get_geometry (GdkWindow *window,
gint *x,
gint *y,
gint *width,
- gint *height,
- gint *depth)
+ gint *height)
{
if (!GDK_WINDOW_DESTROYED (window))
{
@@ -562,8 +561,6 @@ gdk_offscreen_window_get_geometry (GdkWindow *window,
*width = window->width;
if (height)
*height = window->height;
- if (depth)
- *depth = window->depth;
}
}
@@ -690,6 +687,24 @@ gdk_offscreen_window_get_embedder (GdkWindow *window)
return offscreen->embedder;
}
+static void
+gdk_offscreen_window_do_nothing (GdkWindow *window)
+{
+}
+
+static void
+gdk_offscreen_window_set_boolean (GdkWindow *window,
+ gboolean setting)
+{
+}
+
+static void
+gdk_offscreen_window_process_updates_recurse (GdkWindow *window,
+ cairo_region_t *region)
+{
+ _gdk_window_process_updates_recurse (window, region);
+}
+
static void
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
{
@@ -702,21 +717,80 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
impl_class->show = gdk_offscreen_window_show;
impl_class->hide = gdk_offscreen_window_hide;
impl_class->withdraw = gdk_offscreen_window_withdraw;
+ impl_class->set_events = gdk_offscreen_window_set_events;
+ impl_class->get_events = gdk_offscreen_window_get_events;
impl_class->raise = gdk_offscreen_window_raise;
impl_class->lower = gdk_offscreen_window_lower;
+ impl_class->restack_under = NULL;
+ impl_class->restack_toplevel = NULL;
impl_class->move_resize = gdk_offscreen_window_move_resize;
impl_class->set_background = gdk_offscreen_window_set_background;
- impl_class->get_events = gdk_offscreen_window_get_events;
- impl_class->set_events = gdk_offscreen_window_set_events;
impl_class->reparent = gdk_offscreen_window_reparent;
+ impl_class->set_device_cursor = NULL;
impl_class->get_geometry = gdk_offscreen_window_get_geometry;
+ impl_class->get_root_coords = gdk_offscreen_window_get_root_coords;
+ impl_class->get_device_state = gdk_offscreen_window_get_device_state;
impl_class->shape_combine_region = gdk_offscreen_window_shape_combine_region;
impl_class->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
impl_class->set_static_gravities = gdk_offscreen_window_set_static_gravities;
impl_class->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
impl_class->translate = gdk_offscreen_window_translate;
- impl_class->get_root_coords = gdk_offscreen_window_get_root_coords;
- impl_class->get_device_state = gdk_offscreen_window_get_device_state;
impl_class->destroy = gdk_offscreen_window_destroy;
+ impl_class->destroy_foreign = NULL;
impl_class->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
+ impl_class->get_shape = NULL;
+ impl_class->get_input_shape = NULL;
+ impl_class->beep = NULL;
+
+ impl_class->focus = NULL;
+ impl_class->set_type_hint = NULL;
+ impl_class->get_type_hint = NULL;
+ impl_class->set_modal_hint = NULL;
+ impl_class->set_skip_taskbar_hint = gdk_offscreen_window_set_boolean;
+ impl_class->set_skip_pager_hint = gdk_offscreen_window_set_boolean;
+ impl_class->set_urgency_hint = NULL;
+ impl_class->set_geometry_hints = NULL;
+ impl_class->set_title = NULL;
+ impl_class->set_role = NULL;
+ impl_class->set_startup_id = NULL;
+ impl_class->set_transient_for = NULL;
+ impl_class->get_root_origin = NULL;
+ impl_class->get_frame_extents = NULL;
+ impl_class->set_override_redirect = NULL;
+ impl_class->set_accept_focus = NULL;
+ impl_class->set_focus_on_map = NULL;
+ impl_class->set_icon_list = NULL;
+ impl_class->set_icon_name = NULL;
+ impl_class->iconify = gdk_offscreen_window_do_nothing;
+ impl_class->deiconify = gdk_offscreen_window_do_nothing;
+ impl_class->stick = gdk_offscreen_window_do_nothing;
+ impl_class->unstick = gdk_offscreen_window_do_nothing;
+ impl_class->maximize = gdk_offscreen_window_do_nothing;
+ impl_class->unmaximize = gdk_offscreen_window_do_nothing;
+ impl_class->fullscreen = gdk_offscreen_window_do_nothing;
+ impl_class->unfullscreen = gdk_offscreen_window_do_nothing;
+ impl_class->set_keep_above = gdk_offscreen_window_set_boolean;
+ impl_class->set_keep_below = gdk_offscreen_window_set_boolean;
+ impl_class->get_group = NULL;
+ impl_class->set_group = NULL;
+ impl_class->set_decorations = NULL;
+ impl_class->get_decorations = NULL;
+ impl_class->set_functions = NULL;
+ impl_class->set_functions = NULL;
+ impl_class->begin_resize_drag = NULL;
+ impl_class->begin_move_drag = NULL;
+ impl_class->enable_synchronized_configure = gdk_offscreen_window_do_nothing;
+ impl_class->configure_finished = NULL;
+ impl_class->set_opacity = NULL;
+ impl_class->set_composited = NULL;
+ impl_class->destroy_notify = NULL;
+ impl_class->register_dnd = NULL;
+ impl_class->drag_begin = NULL;
+ impl_class->process_updates_recurse = gdk_offscreen_window_process_updates_recurse;
+ impl_class->sync_rendering = NULL;
+ impl_class->simulate_key = NULL;
+ impl_class->simulate_button = NULL;
+ impl_class->get_property = NULL;
+ impl_class->change_property = NULL;
+ impl_class->delete_property = NULL;
}
diff --git a/gdk/gdkpoly-generic.h b/gdk/gdkpoly-generic.h
deleted file mode 100644
index 660c689adb..0000000000
--- a/gdk/gdkpoly-generic.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/* $TOG: poly.h /main/5 1998/02/06 17:47:27 kaleb $ */
-/************************************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All Rights Reserved.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-
-/*
- * This file contains a few macros to help track
- * the edge of a filled object. The object is assumed
- * to be filled in scanline order, and thus the
- * algorithm used is an extension of Bresenham's line
- * drawing algorithm which assumes that y is always the
- * major axis.
- * Since these pieces of code are the same for any filled shape,
- * it is more convenient to gather the library in one
- * place, but since these pieces of code are also in
- * the inner loops of output primitives, procedure call
- * overhead is out of the question.
- * See the author for a derivation if needed.
- */
-
-
-/*
- * In scan converting polygons, we want to choose those pixels
- * which are inside the polygon. Thus, we add .5 to the starting
- * x coordinate for both left and right edges. Now we choose the
- * first pixel which is inside the pgon for the left edge and the
- * first pixel which is outside the pgon for the right edge.
- * Draw the left pixel, but not the right.
- *
- * How to add .5 to the starting x coordinate:
- * If the edge is moving to the right, then subtract dy from the
- * error term from the general form of the algorithm.
- * If the edge is moving to the left, then add dy to the error term.
- *
- * The reason for the difference between edges moving to the left
- * and edges moving to the right is simple: If an edge is moving
- * to the right, then we want the algorithm to flip immediately.
- * If it is moving to the left, then we don't want it to flip until
- * we traverse an entire pixel.
- */
-#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
- int dx; /* local storage */ \
-\
- /* \
- * if the edge is horizontal, then it is ignored \
- * and assumed not to be processed. Otherwise, do this stuff. \
- */ \
- if ((dy) != 0) { \
- xStart = (x1); \
- dx = (x2) - xStart; \
- if (dx < 0) { \
- m = dx / (dy); \
- m1 = m - 1; \
- incr1 = -2 * dx + 2 * (dy) * m1; \
- incr2 = -2 * dx + 2 * (dy) * m; \
- d = 2 * m * (dy) - 2 * dx - 2 * (dy); \
- } else { \
- m = dx / (dy); \
- m1 = m + 1; \
- incr1 = 2 * dx - 2 * (dy) * m1; \
- incr2 = 2 * dx - 2 * (dy) * m; \
- d = -2 * m * (dy) + 2 * dx; \
- } \
- } \
-}
-
-#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
- if (m1 > 0) { \
- if (d > 0) { \
- minval += m1; \
- d += incr1; \
- } \
- else { \
- minval += m; \
- d += incr2; \
- } \
- } else {\
- if (d >= 0) { \
- minval += m1; \
- d += incr1; \
- } \
- else { \
- minval += m; \
- d += incr2; \
- } \
- } \
-}
-
-
-/*
- * This structure contains all of the information needed
- * to run the bresenham algorithm.
- * The variables may be hardcoded into the declarations
- * instead of using this structure to make use of
- * register declarations.
- */
-typedef struct {
- int minor_axis; /* minor axis */
- int d; /* decision variable */
- int m, m1; /* slope and slope+1 */
- int incr1, incr2; /* error increments */
-} BRESINFO;
-
-
-#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
- BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \
- bres.m, bres.m1, bres.incr1, bres.incr2)
-
-#define BRESINCRPGONSTRUCT(bres) \
- BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2)
-
-
-
-/*
- * These are the data structures needed to scan
- * convert regions. Two different scan conversion
- * methods are available -- the even-odd method, and
- * the winding number method.
- * The even-odd rule states that a point is inside
- * the polygon if a ray drawn from that point in any
- * direction will pass through an odd number of
- * path segments.
- * By the winding number rule, a point is decided
- * to be inside the polygon if a ray drawn from that
- * point in any direction passes through a different
- * number of clockwise and counter-clockwise path
- * segments.
- *
- * These data structures are adapted somewhat from
- * the algorithm in (Foley/Van Dam) for scan converting
- * polygons.
- * The basic algorithm is to start at the top (smallest y)
- * of the polygon, stepping down to the bottom of
- * the polygon by incrementing the y coordinate. We
- * keep a list of edges which the current scanline crosses,
- * sorted by x. This list is called the Active Edge Table (AET)
- * As we change the y-coordinate, we update each entry in
- * in the active edge table to reflect the edges new xcoord.
- * This list must be sorted at each scanline in case
- * two edges intersect.
- * We also keep a data structure known as the Edge Table (ET),
- * which keeps track of all the edges which the current
- * scanline has not yet reached. The ET is basically a
- * list of ScanLineList structures containing a list of
- * edges which are entered at a given scanline. There is one
- * ScanLineList per scanline at which an edge is entered.
- * When we enter a new edge, we move it from the ET to the AET.
- *
- * From the AET, we can implement the even-odd rule as in
- * (Foley/Van Dam).
- * The winding number rule is a little trickier. We also
- * keep the EdgeTableEntries in the AET linked by the
- * nextWETE (winding EdgeTableEntry) link. This allows
- * the edges to be linked just as before for updating
- * purposes, but only uses the edges linked by the nextWETE
- * link as edges representing spans of the polygon to
- * drawn (as with the even-odd rule).
- */
-
-/*
- * for the winding number rule
- */
-#define CLOCKWISE 1
-#define COUNTERCLOCKWISE -1
-
-typedef struct _EdgeTableEntry {
- int ymax; /* ycoord at which we exit this edge. */
- BRESINFO bres; /* Bresenham info to run the edge */
- struct _EdgeTableEntry *next; /* next in the list */
- struct _EdgeTableEntry *back; /* for insertion sort */
- struct _EdgeTableEntry *nextWETE; /* for winding num rule */
- int ClockWise; /* flag for winding number rule */
-} EdgeTableEntry;
-
-
-typedef struct _ScanLineList{
- int scanline; /* the scanline represented */
- EdgeTableEntry *edgelist; /* header node */
- struct _ScanLineList *next; /* next in the list */
-} ScanLineList;
-
-
-typedef struct {
- int ymax; /* ymax for the polygon */
- int ymin; /* ymin for the polygon */
- ScanLineList scanlines; /* header node */
-} EdgeTable;
-
-
-/*
- * Here is a struct to help with storage allocation
- * so we can allocate a big chunk at a time, and then take
- * pieces from this heap when we need to.
- */
-#define SLLSPERBLOCK 25
-
-typedef struct _ScanLineListBlock {
- ScanLineList SLLs[SLLSPERBLOCK];
- struct _ScanLineListBlock *next;
-} ScanLineListBlock;
-
-
-
-/*
- *
- * a few macros for the inner loops of the fill code where
- * performance considerations don't allow a procedure call.
- *
- * Evaluate the given edge at the given scanline.
- * If the edge has expired, then we leave it and fix up
- * the active edge table; otherwise, we increment the
- * x value to be ready for the next scanline.
- * The winding number rule is in effect, so we must notify
- * the caller when the edge has been removed so he
- * can reorder the Winding Active Edge Table.
- */
-#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \
- if (pAET->ymax == y) { /* leaving this edge */ \
- pPrevAET->next = pAET->next; \
- pAET = pPrevAET->next; \
- fixWAET = 1; \
- if (pAET) \
- pAET->back = pPrevAET; \
- } \
- else { \
- BRESINCRPGONSTRUCT(pAET->bres); \
- pPrevAET = pAET; \
- pAET = pAET->next; \
- } \
-}
-
-
-/*
- * Evaluate the given edge at the given scanline.
- * If the edge has expired, then we leave it and fix up
- * the active edge table; otherwise, we increment the
- * x value to be ready for the next scanline.
- * The even-odd rule is in effect.
- */
-#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \
- if (pAET->ymax == y) { /* leaving this edge */ \
- pPrevAET->next = pAET->next; \
- pAET = pPrevAET->next; \
- if (pAET) \
- pAET->back = pPrevAET; \
- } \
- else { \
- BRESINCRPGONSTRUCT(pAET->bres); \
- pPrevAET = pAET; \
- pAET = pAET->next; \
- } \
-}
diff --git a/gdk/gdkproperty.h b/gdk/gdkproperty.h
index 4ea6f8153d..014234e983 100644
--- a/gdk/gdkproperty.h
+++ b/gdk/gdkproperty.h
@@ -54,83 +54,39 @@ typedef enum
GdkAtom gdk_atom_intern (const gchar *atom_name,
- gboolean only_if_exists);
+ gboolean only_if_exists);
GdkAtom gdk_atom_intern_static_string (const gchar *atom_name);
gchar* gdk_atom_name (GdkAtom atom);
gboolean gdk_property_get (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gulong offset,
- gulong length,
- gint pdelete,
- GdkAtom *actual_property_type,
- gint *actual_format,
- gint *actual_length,
- guchar **data);
+ GdkAtom property,
+ GdkAtom type,
+ gulong offset,
+ gulong length,
+ gint pdelete,
+ GdkAtom *actual_property_type,
+ gint *actual_format,
+ gint *actual_length,
+ guchar **data);
void gdk_property_change (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gint format,
- GdkPropMode mode,
- const guchar *data,
- gint nelements);
+ GdkAtom property,
+ GdkAtom type,
+ gint format,
+ GdkPropMode mode,
+ const guchar *data,
+ gint nelements);
void gdk_property_delete (GdkWindow *window,
- GdkAtom property);
+ GdkAtom property);
-#ifndef GDK_MULTIHEAD_SAFE
-gint gdk_text_property_to_text_list (GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list);
-gint gdk_text_property_to_utf8_list (GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list);
-gboolean gdk_utf8_to_compound_text (const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length);
-gint gdk_string_to_compound_text (const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length);
-#endif /* GDK_MULTIHEAD_SAFE */
+gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
+ GdkAtom encoding,
+ gint format,
+ const guchar *text,
+ gint length,
+ gchar ***list);
-gint gdk_text_property_to_text_list_for_display (GdkDisplay *display,
- GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list);
-gint gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
- GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list);
-
-gchar *gdk_utf8_to_string_target (const gchar *str);
-gint gdk_string_to_compound_text_for_display (GdkDisplay *display,
- const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length);
-gboolean gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
- const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length);
-
-void gdk_free_text_list (gchar **list);
-void gdk_free_compound_text (guchar *ctext);
+gchar *gdk_utf8_to_string_target (const gchar *str);
G_END_DECLS
diff --git a/gdk/gdkrgba.c b/gdk/gdkrgba.c
index c2cf2fca31..97c4071119 100644
--- a/gdk/gdkrgba.c
+++ b/gdk/gdkrgba.c
@@ -32,11 +32,31 @@
* SECTION:rgba_colors
* @Short_description: RGBA colors
* @Title: RGBA Colors
+ *
+ * The #GdkRGBA struct is a convenient way to pass rgba colors around.
+ * It's based on cairo's way to deal with colors and mirros its behavior.
+ * All values are in the range from 0.0 to 1.0 inclusive. So the color
+ * (0.0, 0.0, 0.0, 0.0) represents transparent black and
+ * (1.0, 1.0, 1.0, 1.0) is opaque white. Other values will be clamped
+ * to this range when drawing.
*/
G_DEFINE_BOXED_TYPE (GdkRGBA, gdk_rgba,
gdk_rgba_copy, gdk_rgba_free)
+/**
+ * GdkRGBA:
+ * @red: The intensity of the red channel from 0.0 to 1.0 inclusive.
+ * @green: The intensity of the green channel from 0.0 to 1.0 inclusive.
+ * @blue: The intensity of the blue channel from 0.0 to 1.0 inclusive.
+ * @alpha: The opacity of the color from 0.0 for completely translucent to
+ * 1.0 for opaque.
+ *
+ * The GdkRGBA structure is used to pass around color data. When using it
+ * as struct members or on the stack, you want to use the struct directly
+ * and not allocate it.
+ */
+
/**
* gdk_rgba_copy:
* @rgba: a #GdkRGBA
@@ -49,7 +69,7 @@ G_DEFINE_BOXED_TYPE (GdkRGBA, gdk_rgba,
* Since: 3.0
**/
GdkRGBA *
-gdk_rgba_copy (GdkRGBA *rgba)
+gdk_rgba_copy (const GdkRGBA *rgba)
{
GdkRGBA *copy;
diff --git a/gdk/gdkrgba.h b/gdk/gdkrgba.h
index 2b7670477a..d0d1286c7b 100644
--- a/gdk/gdkrgba.h
+++ b/gdk/gdkrgba.h
@@ -45,7 +45,7 @@ struct _GdkRGBA
#define GDK_TYPE_RGBA (gdk_rgba_get_type ())
-GdkRGBA * gdk_rgba_copy (GdkRGBA *rgba);
+GdkRGBA * gdk_rgba_copy (const GdkRGBA *rgba);
void gdk_rgba_free (GdkRGBA *rgba);
gboolean gdk_rgba_parse (GdkRGBA *rgba,
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index 57b17ff880..7658bfab9c 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -23,8 +23,7 @@
#include "config.h"
-#include "gdkscreen.h"
-
+#include "gdkscreenprivate.h"
#include "gdkrectangle.h"
#include "gdkwindow.h"
#include "gdkintl.h"
@@ -304,7 +303,7 @@ gdk_screen_get_monitor_at_window (GdkScreen *screen,
g_return_val_if_fail (GDK_IS_SCREEN (screen), -1);
gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width,
- &win_rect.height, NULL);
+ &win_rect.height);
gdk_window_get_origin (window, &win_rect.x, &win_rect.y);
num_monitors = gdk_screen_get_n_monitors (screen);
@@ -531,3 +530,457 @@ gdk_screen_set_property (GObject *object,
break;
}
}
+
+/**
+ * gdk_screen_get_display:
+ * @screen: a #GdkScreen
+ *
+ * Gets the display to which the @screen belongs.
+ *
+ * Returns: (transfer none): the display to which @screen belongs
+ *
+ * Since: 2.2
+ **/
+GdkDisplay *
+gdk_screen_get_display (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_display (screen);
+}
+
+
+/**
+ * gdk_screen_get_width:
+ * @screen: a #GdkScreen
+ *
+ * Gets the width of @screen in pixels
+ *
+ * Returns: the width of @screen in pixels.
+ *
+ * Since: 2.2
+ **/
+gint
+gdk_screen_get_width (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_width (screen);
+}
+
+/**
+ * gdk_screen_get_height:
+ * @screen: a #GdkScreen
+ *
+ * Gets the height of @screen in pixels
+ *
+ * Returns: the height of @screen in pixels.
+ *
+ * Since: 2.2
+ **/
+gint
+gdk_screen_get_height (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_height (screen);
+}
+
+/**
+ * gdk_screen_get_width_mm:
+ * @screen: a #GdkScreen
+ *
+ * Gets the width of @screen in millimeters.
+ * Note that on some X servers this value will not be correct.
+ *
+ * Returns: the width of @screen in millimeters.
+ *
+ * Since: 2.2
+ **/
+gint
+gdk_screen_get_width_mm (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_width_mm (screen);
+}
+
+/**
+ * gdk_screen_get_height_mm:
+ * @screen: a #GdkScreen
+ *
+ * Returns the height of @screen in millimeters.
+ * Note that on some X servers this value will not be correct.
+ *
+ * Returns: the heigth of @screen in millimeters.
+ *
+ * Since: 2.2
+ **/
+gint
+gdk_screen_get_height_mm (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_height_mm (screen);
+}
+
+/**
+ * gdk_screen_get_number:
+ * @screen: a #GdkScreen
+ *
+ * Gets the index of @screen among the screens in the display
+ * to which it belongs. (See gdk_screen_get_display())
+ *
+ * Returns: the index
+ *
+ * Since: 2.2
+ **/
+gint
+gdk_screen_get_number (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_number (screen);
+}
+
+/**
+ * gdk_screen_get_root_window:
+ * @screen: a #GdkScreen
+ *
+ * Gets the root window of @screen.
+ *
+ * Returns: (transfer none): the root window
+ *
+ * Since: 2.2
+ **/
+GdkWindow *
+gdk_screen_get_root_window (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_root_window (screen);
+}
+
+/**
+ * gdk_screen_get_n_monitors:
+ * @screen: a #GdkScreen
+ *
+ * Returns the number of monitors which @screen consists of.
+ *
+ * Returns: number of monitors which @screen consists of
+ *
+ * Since: 2.2
+ */
+gint
+gdk_screen_get_n_monitors (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_n_monitors (screen);
+}
+
+/**
+ * gdk_screen_get_primary_monitor:
+ * @screen: a #GdkScreen.
+ *
+ * Gets the primary monitor for @screen. The primary monitor
+ * is considered the monitor where the 'main desktop' lives.
+ * While normal application windows typically allow the window
+ * manager to place the windows, specialized desktop applications
+ * such as panels should place themselves on the primary monitor.
+ *
+ * If no primary monitor is configured by the user, the return value
+ * will be 0, defaulting to the first monitor.
+ *
+ * Returns: An integer index for the primary monitor, or 0 if none is configured.
+ *
+ * Since: 2.20
+ */
+gint
+gdk_screen_get_primary_monitor (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_primary_monitor (screen);
+}
+
+/**
+ * gdk_screen_get_monitor_width_mm:
+ * @screen: a #GdkScreen
+ * @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
+ *
+ * Gets the width in millimeters of the specified monitor, if available.
+ *
+ * Returns: the width of the monitor, or -1 if not available
+ *
+ * Since: 2.14
+ */
+gint
+gdk_screen_get_monitor_width_mm (GdkScreen *screen,
+ gint monitor_num)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_monitor_width_mm (screen, monitor_num);
+}
+
+/**
+ * gdk_screen_get_monitor_height_mm:
+ * @screen: a #GdkScreen
+ * @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
+ *
+ * Gets the height in millimeters of the specified monitor.
+ *
+ * Returns: the height of the monitor, or -1 if not available
+ *
+ * Since: 2.14
+ */
+gint
+gdk_screen_get_monitor_height_mm (GdkScreen *screen,
+ gint monitor_num)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_monitor_height_mm (screen, monitor_num);
+}
+
+/**
+ * gdk_screen_get_monitor_plug_name:
+ * @screen: a #GdkScreen
+ * @monitor_num: number of the monitor, between 0 and gdk_screen_get_n_monitors (screen)
+ *
+ * Returns the output name of the specified monitor.
+ * Usually something like VGA, DVI, or TV, not the actual
+ * product name of the display device.
+ *
+ * Returns: a newly-allocated string containing the name of the monitor,
+ * or %NULL if the name cannot be determined
+ *
+ * Since: 2.14
+ */
+gchar *
+gdk_screen_get_monitor_plug_name (GdkScreen *screen,
+ gint monitor_num)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_monitor_plug_name (screen, monitor_num);
+}
+
+/**
+ * gdk_screen_get_monitor_geometry:
+ * @screen: a #GdkScreen
+ * @monitor_num: the monitor number, between 0 and gdk_screen_get_n_monitors (screen)
+ * @dest: (out) (allow-none): a #GdkRectangle to be filled with the monitor geometry
+ *
+ * Retrieves the #GdkRectangle representing the size and position of
+ * the individual monitor within the entire screen area.
+ *
+ * Note that the size of the entire screen area can be retrieved via
+ * gdk_screen_get_width() and gdk_screen_get_height().
+ *
+ * Since: 2.2
+ */
+void
+gdk_screen_get_monitor_geometry (GdkScreen *screen,
+ gint monitor_num,
+ GdkRectangle *dest)
+{
+ GDK_SCREEN_GET_CLASS(screen)->get_monitor_geometry (screen, monitor_num, dest);
+}
+
+/**
+ * gdk_screen_list_visuals:
+ * @screen: the relevant #GdkScreen.
+ *
+ * Lists the available visuals for the specified @screen.
+ * A visual describes a hardware image data format.
+ * For example, a visual might support 24-bit color, or 8-bit color,
+ * and might expect pixels to be in a certain format.
+ *
+ * Call g_list_free() on the return value when you're finished with it.
+ *
+ * Return value: (transfer container) (element-type GdkVisual):
+ * a list of visuals; the list must be freed, but not its contents
+ *
+ * Since: 2.2
+ **/
+GList *
+gdk_screen_list_visuals (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->list_visuals (screen);
+}
+
+/**
+ * gdk_screen_get_system_visual:
+ * @screen: a #GdkScreen.
+ *
+ * Get the system's default visual for @screen.
+ * This is the visual for the root window of the display.
+ * The return value should not be freed.
+ *
+ * Return value: (transfer none): the system visual
+ *
+ * Since: 2.2
+ **/
+GdkVisual *
+gdk_screen_get_system_visual (GdkScreen * screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_system_visual (screen);
+}
+
+/**
+ * gdk_screen_get_rgba_visual:
+ * @screen: a #GdkScreen
+ *
+ * Gets a visual to use for creating windows with an alpha channel.
+ * The windowing system on which GTK+ is running
+ * may not support this capability, in which case %NULL will
+ * be returned. Even if a non-%NULL value is returned, its
+ * possible that the window's alpha channel won't be honored
+ * when displaying the window on the screen: in particular, for
+ * X an appropriate windowing manager and compositing manager
+ * must be running to provide appropriate display.
+ *
+ * This functionality is not implemented in the Windows backend.
+ *
+ * For setting an overall opacity for a top-level window, see
+ * gdk_window_set_opacity().
+ *
+ * Return value: (transfer none): a visual to use for windows with an
+ * alpha channel or %NULL if the capability is not available.
+ *
+ * Since: 2.8
+ **/
+GdkVisual *
+gdk_screen_get_rgba_visual (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_rgba_visual (screen);
+}
+
+/**
+ * gdk_screen_is_composited:
+ * @screen: a #GdkScreen
+ *
+ * Returns whether windows with an RGBA visual can reasonably
+ * be expected to have their alpha channel drawn correctly on
+ * the screen.
+ *
+ * On X11 this function returns whether a compositing manager is
+ * compositing @screen.
+ *
+ * Return value: Whether windows with RGBA visuals can reasonably be
+ * expected to have their alpha channels drawn correctly on the screen.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gdk_screen_is_composited (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->is_composited (screen);
+}
+
+/**
+ * gdk_screen_make_display_name:
+ * @screen: a #GdkScreen
+ *
+ * Determines the name to pass to gdk_display_open() to get
+ * a #GdkDisplay with this screen as the default screen.
+ *
+ * Return value: a newly allocated string, free with g_free()
+ *
+ * Since: 2.2
+ **/
+gchar *
+gdk_screen_make_display_name (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->make_display_name (screen);
+}
+
+/**
+ * gdk_screen_get_active_window:
+ * @screen: a #GdkScreen
+ *
+ * Returns the screen's currently active window.
+ *
+ * On X11, this is done by inspecting the _NET_ACTIVE_WINDOW property
+ * on the root window, as described in the Extended Window
+ * Manager Hints . If there is no currently currently active
+ * window, or the window manager does not support the
+ * _NET_ACTIVE_WINDOW hint, this function returns %NULL.
+ *
+ * On other platforms, this function may return %NULL, depending on whether
+ * it is implementable on that platform.
+ *
+ * The returned window should be unrefed using g_object_unref() when
+ * no longer needed.
+ *
+ * Return value: (transfer full): the currently active window, or %NULL.
+ *
+ * Since: 2.10
+ **/
+GdkWindow *
+gdk_screen_get_active_window (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_active_window (screen);
+}
+
+/**
+ * gdk_screen_get_window_stack:
+ * @screen: a #GdkScreen
+ *
+ * Returns a #GList of #GdkWindows representing the current
+ * window stack.
+ *
+ * On X11, this is done by inspecting the _NET_CLIENT_LIST_STACKING
+ * property on the root window, as described in the Extended Window
+ * Manager Hints . If the window manager does not support the
+ * _NET_CLIENT_LIST_STACKING hint, this function returns %NULL.
+ *
+ * On other platforms, this function may return %NULL, depending on whether
+ * it is implementable on that platform.
+ *
+ * The returned list is newly allocated and owns references to the
+ * windows it contains, so it should be freed using g_list_free() and
+ * its windows unrefed using g_object_unref() when no longer needed.
+ *
+ * Return value: (transfer full) (element-type GdkWindow):
+ * a list of #GdkWindows for the current window stack,
+ * or %NULL.
+ *
+ * Since: 2.10
+ **/
+GList *
+gdk_screen_get_window_stack (GdkScreen *screen)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_window_stack (screen);
+}
+
+/**
+ * gdk_screen_broadcast_client_message:
+ * @screen: the #GdkScreen where the event will be broadcasted.
+ * @event: the #GdkEvent.
+ *
+ * On X11, sends an X ClientMessage event to all toplevel windows on
+ * @screen.
+ *
+ * Toplevel windows are determined by checking for the WM_STATE property,
+ * as described in the Inter-Client Communication Conventions Manual (ICCCM).
+ * If no windows are found with the WM_STATE property set, the message is
+ * sent to all children of the root window.
+ *
+ * On Windows, broadcasts a message registered with the name
+ * GDK_WIN32_CLIENT_MESSAGE to all top-level windows. The amount of
+ * data is limited to one long, i.e. four bytes.
+ *
+ * Since: 2.2
+ */
+void
+gdk_screen_broadcast_client_message (GdkScreen *screen,
+ GdkEvent *event)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->broadcast_client_message (screen, event);
+}
+
+/**
+ * gdk_screen_get_setting:
+ * @screen: the #GdkScreen where the setting is located
+ * @name: the name of the setting
+ * @value: location to store the value of the setting
+ *
+ * Retrieves a desktop-wide setting such as double-click time
+ * for the #GdkScreen @screen.
+ *
+ * FIXME needs a list of valid settings here, or a link to
+ * more information.
+ *
+ * Returns: %TRUE if the setting existed and a value was stored
+ * in @value, %FALSE otherwise.
+ *
+ * Since: 2.2
+ **/
+gboolean
+gdk_screen_get_setting (GdkScreen *screen,
+ const gchar *name,
+ GValue *value)
+{
+ return GDK_SCREEN_GET_CLASS(screen)->get_setting (screen, name, value);
+}
diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h
index 208c4cdc89..dadb9666c4 100644
--- a/gdk/gdkscreen.h
+++ b/gdk/gdkscreen.h
@@ -1,7 +1,7 @@
/*
* gdkscreen.h
- *
- * Copyright 2001 Sun Microsystems Inc.
+ *
+ * Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede
*
@@ -34,47 +34,16 @@
G_BEGIN_DECLS
-typedef struct _GdkScreenClass GdkScreenClass;
-
#define GDK_TYPE_SCREEN (gdk_screen_get_type ())
#define GDK_SCREEN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SCREEN, GdkScreen))
-#define GDK_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SCREEN, GdkScreenClass))
#define GDK_IS_SCREEN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SCREEN))
-#define GDK_IS_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SCREEN))
-#define GDK_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SCREEN, GdkScreenClass))
-/**
- * GdkScreen:
- *
- * This is a currently just a placeholder typedef for the first argument of
- * the #GdkPointerHooks.window_at_pointer function in #GdkPointerHooks.
- * It will be used when GDK gets multihead support.
- *
- * Since: 2.2
- */
-struct _GdkScreen
-{
- GObject parent_instance;
-
- guint GSEAL (closed) : 1;
-
- cairo_font_options_t *GSEAL (font_options);
- double GSEAL (resolution); /* pixels/points scale factor for fonts */
-};
-
-struct _GdkScreenClass
-{
- GObjectClass parent_class;
-
- void (*size_changed) (GdkScreen *screen);
- void (*composited_changed) (GdkScreen *screen);
- void (*monitors_changed) (GdkScreen *screen);
-};
GType gdk_screen_get_type (void) G_GNUC_CONST;
-GdkVisual* gdk_screen_get_system_visual (GdkScreen *screen);
+
+GdkVisual * gdk_screen_get_system_visual (GdkScreen *screen);
GdkVisual * gdk_screen_get_rgba_visual (GdkScreen *screen);
-gboolean gdk_screen_is_composited (GdkScreen *screen);
+gboolean gdk_screen_is_composited (GdkScreen *screen);
GdkWindow * gdk_screen_get_root_window (GdkScreen *screen);
GdkDisplay * gdk_screen_get_display (GdkScreen *screen);
@@ -91,13 +60,13 @@ gchar * gdk_screen_make_display_name (GdkScreen *screen);
gint gdk_screen_get_n_monitors (GdkScreen *screen);
gint gdk_screen_get_primary_monitor (GdkScreen *screen);
void gdk_screen_get_monitor_geometry (GdkScreen *screen,
- gint monitor_num,
- GdkRectangle *dest);
+ gint monitor_num,
+ GdkRectangle *dest);
gint gdk_screen_get_monitor_at_point (GdkScreen *screen,
- gint x,
- gint y);
+ gint x,
+ gint y);
gint gdk_screen_get_monitor_at_window (GdkScreen *screen,
- GdkWindow *window);
+ GdkWindow *window);
gint gdk_screen_get_monitor_width_mm (GdkScreen *screen,
gint monitor_num);
gint gdk_screen_get_monitor_height_mm (GdkScreen *screen,
@@ -106,20 +75,20 @@ gchar * gdk_screen_get_monitor_plug_name (GdkScreen *screen,
gint monitor_num);
void gdk_screen_broadcast_client_message (GdkScreen *screen,
- GdkEvent *event);
+ GdkEvent *event);
GdkScreen *gdk_screen_get_default (void);
gboolean gdk_screen_get_setting (GdkScreen *screen,
- const gchar *name,
- GValue *value);
+ const gchar *name,
+ GValue *value);
void gdk_screen_set_font_options (GdkScreen *screen,
- const cairo_font_options_t *options);
+ const cairo_font_options_t *options);
const cairo_font_options_t *gdk_screen_get_font_options (GdkScreen *screen);
void gdk_screen_set_resolution (GdkScreen *screen,
- gdouble dpi);
+ gdouble dpi);
gdouble gdk_screen_get_resolution (GdkScreen *screen);
GdkWindow *gdk_screen_get_active_window (GdkScreen *screen);
@@ -127,4 +96,4 @@ GList *gdk_screen_get_window_stack (GdkScreen *screen);
G_END_DECLS
-#endif /* __GDK_SCREEN_H__ */
+#endif /* __GDK_SCREEN_H__ */
diff --git a/gdk/gdkscreenprivate.h b/gdk/gdkscreenprivate.h
new file mode 100644
index 0000000000..630b112ed4
--- /dev/null
+++ b/gdk/gdkscreenprivate.h
@@ -0,0 +1,104 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_SCREEN_PRIVATE_H__
+#define __GDK_SCREEN_PRIVATE_H__
+
+#include "gdkscreen.h"
+#include "gdkvisual.h"
+
+G_BEGIN_DECLS
+
+#define GDK_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SCREEN, GdkScreenClass))
+#define GDK_IS_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SCREEN))
+#define GDK_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SCREEN, GdkScreenClass))
+
+typedef struct _GdkScreenClass GdkScreenClass;
+
+struct _GdkScreen
+{
+ GObject parent_instance;
+
+ guint closed : 1;
+
+ cairo_font_options_t *font_options;
+ double resolution; /* pixels/points scale factor for fonts */
+};
+
+struct _GdkScreenClass
+{
+ GObjectClass parent_class;
+
+ GdkDisplay * (* get_display) (GdkScreen *screen);
+ gint (* get_width) (GdkScreen *screen);
+ gint (* get_height) (GdkScreen *screen);
+ gint (* get_width_mm) (GdkScreen *screen);
+ gint (* get_height_mm) (GdkScreen *screen);
+ gint (* get_number) (GdkScreen *screen);
+ GdkWindow * (* get_root_window) (GdkScreen *screen);
+ gint (* get_n_monitors) (GdkScreen *screen);
+ gint (* get_primary_monitor) (GdkScreen *screen);
+ gint (* get_monitor_width_mm) (GdkScreen *screen,
+ gint monitor_num);
+ gint (* get_monitor_height_mm) (GdkScreen *screen,
+ gint monitor_num);
+ gchar * (* get_monitor_plug_name) (GdkScreen *screen,
+ gint monitor_num);
+ void (* get_monitor_geometry) (GdkScreen *screen,
+ gint monitor_num,
+ GdkRectangle *dest);
+ GList * (* list_visuals) (GdkScreen *screen);
+ GdkVisual * (* get_system_visual) (GdkScreen *screen);
+ GdkVisual * (* get_rgba_visual) (GdkScreen *screen);
+ gboolean (* is_composited) (GdkScreen *screen);
+ gchar * (* make_display_name) (GdkScreen *screen);
+ GdkWindow * (* get_active_window) (GdkScreen *screen);
+ GList * (* get_window_stack) (GdkScreen *screen);
+ void (* broadcast_client_message) (GdkScreen *screen,
+ GdkEvent *event);
+ gboolean (* get_setting) (GdkScreen *screen,
+ const gchar *name,
+ GValue *value);
+ gint (* visual_get_best_depth) (GdkScreen *screen);
+ GdkVisualType (* visual_get_best_type) (GdkScreen *screen);
+ GdkVisual * (* visual_get_best) (GdkScreen *screen);
+ GdkVisual * (* visual_get_best_with_depth) (GdkScreen *screen,
+ gint depth);
+ GdkVisual * (* visual_get_best_with_type) (GdkScreen *screen,
+ GdkVisualType visual_type);
+ GdkVisual * (* visual_get_best_with_both) (GdkScreen *screen,
+ gint depth,
+ GdkVisualType visual_type);
+ void (* query_depths) (GdkScreen *screen,
+ gint **depths,
+ gint *count);
+ void (* query_visual_types) (GdkScreen *screen,
+ GdkVisualType **visual_types,
+ gint *count);
+
+
+ /* Signals: */
+ void (*size_changed) (GdkScreen *screen);
+ void (*composited_changed) (GdkScreen *screen);
+ void (*monitors_changed) (GdkScreen *screen);
+};
+
+G_END_DECLS
+
+#endif /* __GDK_SCREEN_PRIVATE_H__ */
diff --git a/gdk/gdkselection.c b/gdk/gdkselection.c
index 9468604fe6..27adfdf7d5 100644
--- a/gdk/gdkselection.c
+++ b/gdk/gdkselection.c
@@ -29,7 +29,7 @@
#include "gdkselection.h"
#include "gdkproperty.h"
-#include "gdkdisplay.h"
+#include "gdkdisplayprivate.h"
/**
@@ -138,111 +138,196 @@ gdk_selection_send_notify (GdkNativeWindow requestor,
}
/**
- * gdk_text_property_to_text_list:
- * @encoding: an atom representing the encoding. The most common
- * values for this are STRING ,
- * or COMPOUND_TEXT . This is
- * value used as the type for the property.
- * @format: the format of the property.
- * @text: the text data.
- * @length: the length of the property, in items.
- * @list: location to store a terminated array of strings
- * in the encoding of the current locale. This
- * array should be freed using gdk_free_text_list().
+ * gdk_selection_owner_set_for_display:
+ * @display: the #GdkDisplay
+ * @owner: a #GdkWindow or %NULL to indicate that the owner for
+ * the given should be unset
+ * @selection: an atom identifying a selection
+ * @time_: timestamp to use when setting the selection
+ * If this is older than the timestamp given last time the owner was
+ * set for the given selection, the request will be ignored
+ * @send_event: if %TRUE, and the new owner is different from the current
+ * owner, the current owner will be sent a SelectionClear event
*
- * Converts a text string from the encoding as it is stored in
- * a property into an array of strings in the encoding of
- * the current local. (The elements of the array represent
- * the nul-separated elements of the original text string.)
+ * Sets the #GdkWindow @owner as the current owner of the selection @selection.
*
- * Returns: the number of strings stored in @list, or 0,
- * if the conversion failed.
+ * Returns: %TRUE if the selection owner was successfully changed to owner,
+ * otherwise %FALSE.
+ *
+ * Since: 2.2
*/
-gint
-gdk_text_property_to_text_list (GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list)
+gboolean
+gdk_selection_owner_set_for_display (GdkDisplay *display,
+ GdkWindow *owner,
+ GdkAtom selection,
+ guint32 time,
+ gboolean send_event)
{
- return gdk_text_property_to_text_list_for_display (gdk_display_get_default (),
- encoding, format, text, length, list);
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
+ g_return_val_if_fail (selection != GDK_NONE, FALSE);
+
+ return GDK_DISPLAY_GET_CLASS (display)
+ ->set_selection_owner (display, owner, selection, time, send_event);
}
/**
- * gdk_text_property_to_utf8_list:
+ * gdk_selection_owner_get_for_display:
+ * @display: a #GdkDisplay
+ * @selection: an atom indentifying a selection
+ *
+ * Determine the owner of the given selection.
+ *
+ * Note that the return value may be owned by a different
+ * process if a foreign window was previously created for that
+ * window, but a new foreign window will never be created by this call.
+ *
+ * Returns: (transfer none): if there is a selection owner for this window,
+ * and it is a window known to the current process, the #GdkWindow that
+ * owns the selection, otherwise %NULL.
+ *
+ * Since: 2.2
+ */
+GdkWindow *
+gdk_selection_owner_get_for_display (GdkDisplay *display,
+ GdkAtom selection)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+ g_return_val_if_fail (selection != GDK_NONE, NULL);
+
+ return GDK_DISPLAY_GET_CLASS (display)->get_selection_owner (display, selection);
+}
+
+/**
+ * gdk_selection_send_notify_for_display:
+ * @display: the #GdkDisplay where @requestor is realized
+ * @requestor: window to which to deliver response
+ * @selection: selection that was requested
+ * @target: target that was selected
+ * @property: property in which the selection owner stored the data,
+ * or %GDK_NONE to indicate that the request was rejected
+ * @time_: timestamp
+ *
+ * Send a response to SelectionRequest event.
+ *
+ * Since: 2.2
+ */
+void
+gdk_selection_send_notify_for_display (GdkDisplay *display,
+ GdkNativeWindow requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ GdkAtom property,
+ guint32 time_)
+{
+ g_return_if_fail (GDK_IS_DISPLAY (display));
+
+ GDK_DISPLAY_GET_CLASS (display)
+ ->send_selection_notify (display, requestor, selection,target, property, time_);
+}
+
+/**
+ * gdk_selection_property_get:
+ * @requestor: the window on which the data is stored
+ * @data: location to store a pointer to the retrieved data.
+ If the retrieval failed, %NULL we be stored here, otherwise, it
+ will be non-%NULL and the returned data should be freed with g_free()
+ when you are finished using it. The length of the
+ allocated memory is one more than the length
+ of the returned data, and the final byte will always
+ be zero, to ensure nul-termination of strings
+ * @prop_type: location to store the type of the property
+ * @prop_format: location to store the format of the property
+ *
+ * Retrieves selection data that was stored by the selection
+ * data in response to a call to gdk_selection_convert(). This function
+ * will not be used by applications, who should use the #GtkClipboard
+ * API instead.
+ *
+ * Return value: the length of the retrieved data.
+ */
+gint
+gdk_selection_property_get (GdkWindow *requestor,
+ guchar **data,
+ GdkAtom *ret_type,
+ gint *ret_format)
+{
+ GdkDisplay *display;
+
+ g_return_val_if_fail (GDK_IS_WINDOW (requestor), 0);
+
+ display = gdk_window_get_display (requestor);
+
+ return GDK_DISPLAY_GET_CLASS (display)
+ ->get_selection_property (display, requestor, data, ret_type, ret_format);
+}
+
+void
+gdk_selection_convert (GdkWindow *requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ guint32 time)
+{
+ GdkDisplay *display;
+
+ g_return_if_fail (selection != GDK_NONE);
+
+ display = gdk_window_get_display (requestor);
+
+ GDK_DISPLAY_GET_CLASS (display)
+ ->convert_selection (display, requestor, selection, target, time);
+}
+
+/**
+ * gdk_text_property_to_utf8_list_for_display:
+ * @display: a #GdkDisplay
* @encoding: an atom representing the encoding of the text
* @format: the format of the property
* @text: the text to convert
* @length: the length of @text, in bytes
- * @list: (allow-none): location to store the list of strings or %NULL. The
+ * @list: location to store the list of strings or %NULL. The
* list should be freed with g_strfreev().
- *
- * Convert a text property in the giving encoding to
- * a list of UTF-8 strings.
- *
- * Return value: the number of strings in the resulting
- * list.
- **/
-gint
-gdk_text_property_to_utf8_list (GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list)
-{
- return gdk_text_property_to_utf8_list_for_display (gdk_display_get_default (),
- encoding, format, text, length, list);
-}
-
-/**
- * gdk_string_to_compound_text:
- * @str: a nul-terminated string.
- * @encoding: location to store the encoding atom (to be used as
- * the type for the property).
- * @format: location to store the format for the property.
- * @ctext: location to store newly allocated data for the property.
- * @length: location to store the length of @ctext in items.
*
- * Converts a string from the encoding of the current locale
- * into a form suitable for storing in a window property.
+ * Converts a text property in the given encoding to
+ * a list of UTF-8 strings.
*
- * Returns: 0 upon sucess, non-zero upon failure.
+ * Return value: the number of strings in the resulting list
+ *
+ * Since: 2.2
*/
gint
-gdk_string_to_compound_text (const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length)
+gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
+ GdkAtom encoding,
+ gint format,
+ const guchar *text,
+ gint length,
+ gchar ***list)
{
- return gdk_string_to_compound_text_for_display (gdk_display_get_default (),
- str, encoding, format,
- ctext, length);
+ g_return_val_if_fail (text != NULL, 0);
+ g_return_val_if_fail (length >= 0, 0);
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
+
+ return GDK_DISPLAY_GET_CLASS (display)
+ ->text_property_to_utf8_list (display, encoding, format, text, length, list);
}
/**
- * gdk_utf8_to_compound_text:
- * @str: a UTF-8 string
- * @encoding: location to store resulting encoding
- * @format: location to store format of the result
- * @ctext: location to store the data of the result
- * @length: location to store the length of the data
- * stored in @ctext
- *
- * Convert from UTF-8 to compound text.
- *
- * Return value: %TRUE if the conversion succeeded, otherwise
- * false.
+ * gdk_utf8_to_string_target:
+ * @str: a UTF-8 string
+ *
+ * Converts an UTF-8 string into the best possible representation
+ * as a STRING. The representation of characters not in STRING
+ * is not specified; it may be as pseudo-escape sequences
+ * \x{ABCD}, or it may be in some other form of approximation.
+ *
+ * Return value: the newly-allocated string, or %NULL if the
+ * conversion failed. (It should not fail for
+ * any properly formed UTF-8 string unless system
+ * limits like memory or file descriptors are exceeded.)
**/
-gboolean
-gdk_utf8_to_compound_text (const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length)
+gchar *
+gdk_utf8_to_string_target (const gchar *str)
{
- return gdk_utf8_to_compound_text_for_display (gdk_display_get_default (),
- str, encoding, format,
- ctext, length);
+ GdkDisplay *display = gdk_display_get_default ();
+
+ return GDK_DISPLAY_GET_CLASS (display)->utf8_to_string_target (display, str);
}
diff --git a/gdk/gdkspawn.h b/gdk/gdkspawn.h
deleted file mode 100644
index cb7a2eac16..0000000000
--- a/gdk/gdkspawn.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Mark McLoughlin
- */
-
-#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
-#error "Only can be included directly."
-#endif
-
-#ifndef __GDK_SPAWN_H__
-#define __GDK_SPAWN_H__
-
-#include
-
-G_BEGIN_DECLS
-
-gboolean gdk_spawn_on_screen (GdkScreen *screen,
- const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GPid *child_pid,
- GError **error);
-
-gboolean gdk_spawn_on_screen_with_pipes (GdkScreen *screen,
- const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GPid *child_pid,
- gint *standard_input,
- gint *standard_output,
- gint *standard_error,
- GError **error);
-
-gboolean gdk_spawn_command_line_on_screen (GdkScreen *screen,
- const gchar *command_line,
- GError **error);
-
-G_END_DECLS
-
-#endif /* __GDK_SPAWN_H__ */
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 865a7f5226..d655ff97da 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -43,7 +43,7 @@
* itself, but also occasionally when compiling programs that use GDK
* (or GTK). One such setting is what windowing API backend is in use.
*/
-#include
+#include
/* some common magic values */
@@ -69,7 +69,7 @@ G_BEGIN_DECLS
/* Type definitions for the basic structures.
*/
-typedef struct _GdkPoint GdkPoint;
+typedef struct _GdkPoint GdkPoint;
/**
* GdkRectangle:
@@ -77,7 +77,7 @@ typedef struct _GdkPoint GdkPoint;
* Defines the position and size of a rectangle. It is identical to
* #cairo_rectangle_int_t.
*/
-typedef cairo_rectangle_int_t GdkRectangle;
+typedef cairo_rectangle_int_t GdkRectangle;
/**
* GdkAtom:
@@ -131,22 +131,22 @@ typedef gpointer GdkNativeWindow;
#else
typedef guint32 GdkNativeWindow;
#endif
-
-/* Forward declarations of commonly used types
- */
-typedef struct _GdkColor GdkColor;
-typedef struct _GdkRGBA GdkRGBA;
-typedef struct _GdkCursor GdkCursor;
-typedef struct _GdkVisual GdkVisual;
-/**
- * GdkWindow:
- *
- * An opaque structure representing an onscreen drawable.
- */
+/* Forward declarations of commonly used types */
+typedef struct _GdkColor GdkColor;
+typedef struct _GdkRGBA GdkRGBA;
+typedef struct _GdkCursor GdkCursor;
+typedef struct _GdkVisual GdkVisual;
+typedef struct _GdkDevice GdkDevice;
+typedef struct _GdkDragContext GdkDragContext;
+
+typedef struct _GdkDisplayManager GdkDisplayManager;
+typedef struct _GdkDeviceManager GdkDeviceManager;
+typedef struct _GdkDisplay GdkDisplay;
+typedef struct _GdkScreen GdkScreen;
typedef struct _GdkWindow GdkWindow;
-typedef struct _GdkDisplay GdkDisplay;
-typedef struct _GdkScreen GdkScreen;
+typedef struct _GdkKeymap GdkKeymap;
+typedef struct _GdkAppLaunchContext GdkAppLaunchContext;
/**
* GdkByteOrder:
@@ -210,13 +210,13 @@ typedef enum
typedef enum
{
GDK_SHIFT_MASK = 1 << 0,
- GDK_LOCK_MASK = 1 << 1,
+ GDK_LOCK_MASK = 1 << 1,
GDK_CONTROL_MASK = 1 << 2,
- GDK_MOD1_MASK = 1 << 3,
- GDK_MOD2_MASK = 1 << 4,
- GDK_MOD3_MASK = 1 << 5,
- GDK_MOD4_MASK = 1 << 6,
- GDK_MOD5_MASK = 1 << 7,
+ GDK_MOD1_MASK = 1 << 3,
+ GDK_MOD2_MASK = 1 << 4,
+ GDK_MOD3_MASK = 1 << 5,
+ GDK_MOD4_MASK = 1 << 6,
+ GDK_MOD5_MASK = 1 << 7,
GDK_BUTTON1_MASK = 1 << 8,
GDK_BUTTON2_MASK = 1 << 9,
GDK_BUTTON3_MASK = 1 << 10,
@@ -238,11 +238,11 @@ typedef enum
typedef enum
{
- GDK_OK = 0,
- GDK_ERROR = -1,
+ GDK_OK = 0,
+ GDK_ERROR = -1,
GDK_ERROR_PARAM = -2,
GDK_ERROR_FILE = -3,
- GDK_ERROR_MEM = -4
+ GDK_ERROR_MEM = -4
} GdkStatus;
/**
diff --git a/gdk/gdkvisual.c b/gdk/gdkvisual.c
index cba4a7b3d3..c1b0160f2e 100644
--- a/gdk/gdkvisual.c
+++ b/gdk/gdkvisual.c
@@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
* gdkvisual.c
- *
- * Copyright 2001 Sun Microsystems Inc.
+ *
+ * Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede
*
@@ -23,9 +23,8 @@
#include "config.h"
-#include "gdkvisual.h"
-
-#include "gdkscreen.h"
+#include "gdkvisualprivate.h"
+#include "gdkscreenprivate.h"
/**
@@ -33,31 +32,52 @@
* @Short_description: Low-level display hardware information
* @Title: Visuals
*
- * A #GdkVisual describes a particular video hardware display format. It includes
- * information about the number of bits used for each color, the way the bits are
- * translated into an RGB value for display, and the way the bits are stored in
- * memory. For example, a piece of display hardware might support 24-bit color,
- * 16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes. For a given
- * pixel size, pixels can be in different formats; for example the "red" element
- * of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower
- * 4 bits.
+ * A #GdkVisual describes a particular video hardware display format.
+ * It includes information about the number of bits used for each color,
+ * the way the bits are translated into an RGB value for display, and
+ * the way the bits are stored in memory. For example, a piece of display
+ * hardware might support 24-bit color, 16-bit color, or 8-bit color;
+ * meaning 24/16/8-bit pixel sizes. For a given pixel size, pixels can
+ * be in different formats; for example the "red" element of an RGB pixel
+ * may be in the top 8 bits of the pixel, or may be in the lower 4 bits.
*
* There are several standard visuals. The visual returned by
* gdk_screen_get_system_visual() is the system's default visual.
*
- * A number of functions are provided for determining the "best" available visual.
- * For the purposes of making this determination, higher bit depths are considered
- * better, and for visuals of the same bit depth, %GDK_VISUAL_PSEUDO_COLOR is
- * preferred at 8bpp, otherwise, the visual types are ranked in the order of
- * (highest to lowest) %GDK_VISUAL_DIRECT_COLOR, %GDK_VISUAL_TRUE_COLOR,
- * %GDK_VISUAL_PSEUDO_COLOR, %GDK_VISUAL_STATIC_COLOR, %GDK_VISUAL_GRAYSCALE,
- * then %GDK_VISUAL_STATIC_GRAY.
+ * A number of functions are provided for determining the "best" available
+ * visual. For the purposes of making this determination, higher bit depths
+ * are considered better, and for visuals of the same bit depth,
+ * %GDK_VISUAL_PSEUDO_COLOR is preferred at 8bpp, otherwise, the visual
+ * types are ranked in the order of(highest to lowest)
+ * %GDK_VISUAL_DIRECT_COLOR, %GDK_VISUAL_TRUE_COLOR,
+ * %GDK_VISUAL_PSEUDO_COLOR, %GDK_VISUAL_STATIC_COLOR,
+ * %GDK_VISUAL_GRAYSCALE, then %GDK_VISUAL_STATIC_GRAY.
*/
+G_DEFINE_TYPE (GdkVisual, gdk_visual, G_TYPE_OBJECT)
+
+static void
+gdk_visual_init (GdkVisual *visual)
+{
+}
+
+static void
+gdk_visual_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gdk_visual_parent_class)->finalize (object);
+}
+
+static void
+gdk_visual_class_init (GdkVisualClass *visual_class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (visual_class);
+
+ object_class->finalize = gdk_visual_finalize;
+}
/**
* gdk_list_visuals:
- *
+ *
* Lists the available visuals for the default screen.
* (See gdk_screen_list_visuals())
* A visual describes a hardware image data format.
@@ -65,10 +85,10 @@
* and might expect pixels to be in a certain format.
*
* Call g_list_free() on the return value when you're finished with it.
- *
+ *
* Return value: (transfer container) (element-type GdkVisual):
* a list of visuals; the list must be freed, but not its contents
- **/
+ */
GList*
gdk_list_visuals (void)
{
@@ -77,19 +97,168 @@ gdk_list_visuals (void)
/**
* gdk_visual_get_system:
- *
+ *
* Get the system's default visual for the default GDK screen.
* This is the visual for the root window of the display.
* The return value should not be freed.
- *
+ *
* Return value: (transfer none): system visual
- **/
+ */
GdkVisual*
gdk_visual_get_system (void)
{
return gdk_screen_get_system_visual (gdk_screen_get_default());
}
+/**
+ * gdk_visual_get_best_depth:
+ *
+ * Get the best available depth for the default GDK screen. "Best"
+ * means "largest," i.e. 32 preferred over 24 preferred over 8 bits
+ * per pixel.
+ *
+ * Return value: best available depth
+ */
+gint
+gdk_visual_get_best_depth (void)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_depth (screen);
+}
+
+/**
+ * gdk_visual_get_best_type:
+ *
+ * Return the best available visual type for the default GDK screen.
+ *
+ * Return value: best visual type
+ */
+GdkVisualType
+gdk_visual_get_best_type (void)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_type (screen);
+}
+
+/**
+ * gdk_visual_get_best:
+ *
+ * Get the visual with the most available colors for the default
+ * GDK screen. The return value should not be freed.
+ *
+ * Return value: (transfer none): best visual
+ */
+GdkVisual*
+gdk_visual_get_best (void)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ return GDK_SCREEN_GET_CLASS(screen)->visual_get_best (screen);
+}
+
+/**
+ * gdk_visual_get_best_with_depth:
+ * @depth: a bit depth
+ *
+ * Get the best visual with depth @depth for the default GDK screen.
+ * Color visuals and visuals with mutable colormaps are preferred
+ * over grayscale or fixed-colormap visuals. The return value should
+ * not be freed. %NULL may be returned if no visual supports @depth.
+ *
+ * Return value: (transfer none): best visual for the given depth
+ */
+GdkVisual*
+gdk_visual_get_best_with_depth (gint depth)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_with_depth (screen, depth);
+}
+
+/**
+ * gdk_visual_get_best_with_type:
+ * @visual_type: a visual type
+ *
+ * Get the best visual of the given @visual_type for the default GDK screen.
+ * Visuals with higher color depths are considered better. The return value
+ * should not be freed. %NULL may be returned if no visual has type
+ * @visual_type.
+ *
+ * Return value: (transfer none): best visual of the given type
+ */
+GdkVisual*
+gdk_visual_get_best_with_type (GdkVisualType visual_type)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_with_type (screen,
+ visual_type);
+}
+
+/**
+ * gdk_visual_get_best_with_both:
+ * @depth: a bit depth
+ * @visual_type: a visual type
+ *
+ * Combines gdk_visual_get_best_with_depth() and
+ * gdk_visual_get_best_with_type().
+ *
+ * Return value: (transfer none): best visual with both @depth and
+ * @visual_type, or %NULL if none
+ */
+GdkVisual*
+gdk_visual_get_best_with_both (gint depth,
+ GdkVisualType visual_type)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_with_both (screen, depth, visual_type);
+}
+
+/**
+ * gdk_query_depths:
+ * @depths: (out) (array): return location for available depths
+ * @count: (out): return location for number of available depths
+ *
+ * This function returns the available bit depths for the default
+ * screen. It's equivalent to listing the visuals
+ * (gdk_list_visuals()) and then looking at the depth field in each
+ * visual, removing duplicates.
+ *
+ * The array returned by this function should not be freed.
+ */
+void
+gdk_query_depths (gint **depths,
+ gint *count)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ GDK_SCREEN_GET_CLASS(screen)->query_depths (screen, depths, count);
+}
+
+/**
+ * gdk_query_visual_types:
+ * @visual_types: return location for the available visual types
+ * @count: return location for the number of available visual types
+ *
+ * This function returns the available visual types for the default
+ * screen. It's equivalent to listing the visuals
+ * (gdk_list_visuals()) and then looking at the type field in each
+ * visual, removing duplicates.
+ *
+ * The array returned by this function should not be freed.
+ */
+void
+gdk_query_visual_types (GdkVisualType **visual_types,
+ gint *count)
+{
+ GdkScreen *screen = gdk_screen_get_default();
+
+ GDK_SCREEN_GET_CLASS(screen)->query_visual_types (screen, visual_types, count);
+}
+
/**
* gdk_visual_get_visual_type:
* @visual: A #GdkVisual.
@@ -182,15 +351,15 @@ gdk_visual_get_bits_per_rgb (GdkVisual *visual)
/**
* gdk_visual_get_red_pixel_details:
- * @visual: A #GdkVisual.
- * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL.
- * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
- * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
+ * @visual: A #GdkVisual
+ * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL
+ * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
+ * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
*
* Obtains values that are needed to calculate red pixel values in TrueColor
- * and DirectColor. The "mask" is the significant bits within the pixel.
+ * and DirectColor. The "mask" is the significant bits within the pixel.
* The "shift" is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). Finally, "precision" refers
+ * to be in position (according to the "mask"). Finally, "precision" refers
* to how much precision the pixel value contains for a particular primary.
*
* Since: 2.22
@@ -216,14 +385,14 @@ gdk_visual_get_red_pixel_details (GdkVisual *visual,
/**
* gdk_visual_get_green_pixel_details:
* @visual: a #GdkVisual
- * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL.
- * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
- * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
+ * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL
+ * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
+ * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
*
* Obtains values that are needed to calculate green pixel values in TrueColor
- * and DirectColor. The "mask" is the significant bits within the pixel.
+ * and DirectColor. The "mask" is the significant bits within the pixel.
* The "shift" is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). Finally, "precision" refers
+ * to be in position (according to the "mask"). Finally, "precision" refers
* to how much precision the pixel value contains for a particular primary.
*
* Since: 2.22
@@ -249,14 +418,14 @@ gdk_visual_get_green_pixel_details (GdkVisual *visual,
/**
* gdk_visual_get_blue_pixel_details:
* @visual: a #GdkVisual
- * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL.
- * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
- * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL.
+ * @mask: (out) (allow-none): A pointer to a #guint32 to be filled in, or %NULL
+ * @shift: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
+ * @precision: (out) (allow-none): A pointer to a #gint to be filled in, or %NULL
*
* Obtains values that are needed to calculate blue pixel values in TrueColor
- * and DirectColor. The "mask" is the significant bits within the pixel.
+ * and DirectColor. The "mask" is the significant bits within the pixel.
* The "shift" is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). Finally, "precision" refers
+ * to be in position (according to the "mask"). Finally, "precision" refers
* to how much precision the pixel value contains for a particular primary.
*
* Since: 2.22
@@ -278,3 +447,21 @@ gdk_visual_get_blue_pixel_details (GdkVisual *visual,
if (precision)
*precision = visual->blue_prec;
}
+
+/**
+ * gdk_visual_get_screen:
+ * @visual: a #GdkVisual
+ *
+ * Gets the screen to which this visual belongs
+ *
+ * Return value: (transfer none): the screen to which this visual belongs.
+ *
+ * Since: 2.2
+ */
+GdkScreen *
+gdk_visual_get_screen (GdkVisual *visual)
+{
+ g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL);
+
+ return visual->screen;
+}
diff --git a/gdk/gdkvisual.h b/gdk/gdkvisual.h
index 5fa4ad919c..1d21bcf248 100644
--- a/gdk/gdkvisual.h
+++ b/gdk/gdkvisual.h
@@ -37,13 +37,7 @@ G_BEGIN_DECLS
#define GDK_TYPE_VISUAL (gdk_visual_get_type ())
#define GDK_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_VISUAL, GdkVisual))
-#define GDK_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_VISUAL, GdkVisualClass))
#define GDK_IS_VISUAL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_VISUAL))
-#define GDK_IS_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_VISUAL))
-#define GDK_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_VISUAL, GdkVisualClass))
-
-typedef struct _GdkVisualPrivate GdkVisualPrivate;
-typedef struct _GdkVisualClass GdkVisualClass;
/**
* GdkVisualType:
@@ -84,75 +78,29 @@ typedef enum
*
* The #GdkVisual structure contains information about
* a particular visual.
- *
- *
- * Constructing a pixel value from components
- *
- * guint
- * pixel_from_rgb (GdkVisual *visual,
- * guchar r, guchar b, guchar g)
- * {
- * return ((r >> (16 - visual->red_prec)) << visual->red_shift) |
- * ((g >> (16 - visual->green_prec)) << visual->green_shift) |
- * ((r >> (16 - visual->blue_prec)) << visual->blue_shift);
- * }
- *
- *
*/
-struct _GdkVisual
-{
- /*< private >*/
- GObject parent_instance;
-
- GdkVisualType GSEAL (type); /* Type of visual this is (PseudoColor, TrueColor, etc) */
- gint GSEAL (depth); /* Bit depth of this visual */
- GdkByteOrder GSEAL (byte_order);
- gint GSEAL (colormap_size); /* Size of a colormap for this visual */
- gint GSEAL (bits_per_rgb); /* Number of significant bits per red, green and blue. */
-
- /* The red, green and blue masks, shifts and precisions refer
- * to value needed to calculate pixel values in TrueColor and DirectColor
- * visuals. The "mask" is the significant bits within the pixel. The
- * "shift" is the number of bits left we must shift a primary for it
- * to be in position (according to the "mask"). "prec" refers to how
- * much precision the pixel value contains for a particular primary.
- */
- guint32 GSEAL (red_mask);
- gint GSEAL (red_shift);
- gint GSEAL (red_prec);
-
- guint32 GSEAL (green_mask);
- gint GSEAL (green_shift);
- gint GSEAL (green_prec);
-
- guint32 GSEAL (blue_mask);
- gint GSEAL (blue_shift);
- gint GSEAL (blue_prec);
-
- GdkVisualPrivate *priv;
-};
GType gdk_visual_get_type (void) G_GNUC_CONST;
#ifndef GDK_MULTIHEAD_SAFE
-gint gdk_visual_get_best_depth (void);
-GdkVisualType gdk_visual_get_best_type (void);
-GdkVisual* gdk_visual_get_system (void);
-GdkVisual* gdk_visual_get_best (void);
-GdkVisual* gdk_visual_get_best_with_depth (gint depth);
+gint gdk_visual_get_best_depth (void);
+GdkVisualType gdk_visual_get_best_type (void);
+GdkVisual* gdk_visual_get_system (void);
+GdkVisual* gdk_visual_get_best (void);
+GdkVisual* gdk_visual_get_best_with_depth (gint depth);
GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
-GdkVisual* gdk_visual_get_best_with_both (gint depth,
- GdkVisualType visual_type);
+GdkVisual* gdk_visual_get_best_with_both (gint depth,
+ GdkVisualType visual_type);
-void gdk_query_depths (gint **depths,
- gint *count);
+void gdk_query_depths (gint **depths,
+ gint *count);
void gdk_query_visual_types (GdkVisualType **visual_types,
- gint *count);
+ gint *count);
GList* gdk_list_visuals (void);
#endif
-GdkScreen *gdk_visual_get_screen (GdkVisual *visual);
+GdkScreen *gdk_visual_get_screen (GdkVisual *visual);
GdkVisualType gdk_visual_get_visual_type (GdkVisual *visual);
gint gdk_visual_get_depth (GdkVisual *visual);
diff --git a/gdk/gdkvisualprivate.h b/gdk/gdkvisualprivate.h
new file mode 100644
index 0000000000..075916a6f2
--- /dev/null
+++ b/gdk/gdkvisualprivate.h
@@ -0,0 +1,66 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2010 Red Hat, Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_VISUAL_PRIVATE_H__
+#define __GDK_VISUAL_PRIVATE_H__
+
+#include "gdkvisual.h"
+
+G_BEGIN_DECLS
+
+#define GDK_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_VISUAL, GdkVisualClass))
+#define GDK_IS_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_VISUAL))
+#define GDK_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_VISUAL, GdkVisualClass))
+
+typedef struct _GdkVisualClass GdkVisualClass;
+
+struct _GdkVisual
+{
+ GObject parent_instance;
+
+ /*< private >*/
+ GdkVisualType type;
+ gint depth;
+ GdkByteOrder byte_order;
+ gint colormap_size;
+ gint bits_per_rgb;
+
+ guint32 red_mask;
+ gint red_shift;
+ gint red_prec;
+
+ guint32 green_mask;
+ gint green_shift;
+ gint green_prec;
+
+ guint32 blue_mask;
+ gint blue_shift;
+ gint blue_prec;
+
+ GdkScreen *screen;
+};
+
+struct _GdkVisualClass
+{
+ GObjectClass parent_class;
+};
+
+G_END_DECLS
+
+#endif
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 4307f34ae9..30d5c8d52c 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -31,17 +31,14 @@
#include "gdkwindow.h"
-#ifdef GDK_WINDOWING_X11
-#include "x11/gdkx.h" /* For workaround */
-#endif
-
#include "gdkrectangle.h"
#include "gdkinternals.h"
#include "gdkintl.h"
-#include "gdkscreen.h"
+#include "gdkscreenprivate.h"
+#include "gdkdisplayprivate.h"
#include "gdkdeviceprivate.h"
+#include "gdkvisualprivate.h"
#include "gdkmarshalers.h"
-#include "gdkscreen.h"
#include "gdkwindowimpl.h"
#include
@@ -222,8 +219,6 @@ static void gdk_window_drop_cairo_surface (GdkWindow *private);
static void gdk_window_free_paint_stack (GdkWindow *window);
-static void gdk_window_init (GdkWindow *window);
-static void gdk_window_class_init (GdkWindowClass *klass);
static void gdk_window_finalize (GObject *object);
static void gdk_window_set_property (GObject *object,
@@ -276,22 +271,7 @@ new_region_tag (void)
return ++tag;
}
-GType
-gdk_window_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- object_type = g_type_register_static_simple (G_TYPE_OBJECT,
- "GdkWindow",
- sizeof (GdkWindowClass),
- (GClassInitFunc) gdk_window_class_init,
- sizeof (GdkWindow),
- (GInstanceInitFunc) gdk_window_init,
- 0);
-
- return object_type;
-}
+G_DEFINE_ABSTRACT_TYPE (GdkWindow, gdk_window, G_TYPE_OBJECT)
GType
_gdk_paintable_get_type (void)
@@ -389,11 +369,11 @@ gdk_window_class_init (GdkWindowClass *klass)
*/
g_object_class_install_property (object_class,
PROP_CURSOR,
- g_param_spec_boxed ("cursor",
- P_("Cursor"),
- P_("Cursor"),
- GDK_TYPE_CURSOR,
- G_PARAM_READWRITE));
+ g_param_spec_object ("cursor",
+ P_("Cursor"),
+ P_("Cursor"),
+ GDK_TYPE_CURSOR,
+ G_PARAM_READWRITE));
/**
* GdkWindow::pick-embedded-child:
@@ -568,7 +548,7 @@ gdk_window_finalize (GObject *object)
cairo_region_destroy (window->input_shape);
if (window->cursor)
- gdk_cursor_unref (window->cursor);
+ g_object_unref (window->cursor);
if (window->device_cursor)
g_hash_table_destroy (window->device_cursor);
@@ -576,6 +556,9 @@ gdk_window_finalize (GObject *object)
if (window->device_events)
g_hash_table_destroy (window->device_events);
+ if (window->source_event_masks)
+ g_hash_table_destroy (window->source_event_masks);
+
if (window->devices_inside)
g_list_free (window->devices_inside);
@@ -593,7 +576,7 @@ gdk_window_set_property (GObject *object,
switch (prop_id)
{
case PROP_CURSOR:
- gdk_window_set_cursor (window, g_value_get_boxed (value));
+ gdk_window_set_cursor (window, g_value_get_object (value));
break;
default:
@@ -613,7 +596,7 @@ gdk_window_get_property (GObject *object,
switch (prop_id)
{
case PROP_CURSOR:
- g_value_set_boxed (value, gdk_window_get_cursor (window));
+ g_value_set_object (value, gdk_window_get_cursor (window));
break;
default:
@@ -1272,6 +1255,7 @@ gdk_window_new (GdkWindow *parent,
{
GdkWindow *window;
GdkScreen *screen;
+ GdkDisplay *display;
int x, y;
gboolean native;
GdkEventMask event_mask;
@@ -1306,7 +1290,9 @@ gdk_window_new (GdkWindow *parent,
return NULL;
}
- window = g_object_new (GDK_TYPE_WINDOW, NULL);
+ display = gdk_screen_get_display (screen);
+
+ window = _gdk_display_create_window (display);
/* Windows with a foreign parent are treated as if they are children
* of the root window, except for actual creation.
@@ -1335,19 +1321,6 @@ gdk_window_new (GdkWindow *parent,
window->width = (attributes->width > 1) ? (attributes->width) : (1);
window->height = (attributes->height > 1) ? (attributes->height) : (1);
-#ifdef GDK_WINDOWING_X11
- /* Work around a bug where Xorg refuses to map toplevel InputOnly windows
- * from an untrusted client: http://bugs.freedesktop.org/show_bug.cgi?id=6988
- */
- if (attributes->wclass == GDK_INPUT_ONLY &&
- window->parent->window_type == GDK_WINDOW_ROOT &&
- !G_LIKELY (GDK_DISPLAY_X11 (GDK_WINDOW_DISPLAY (parent))->trusted_client))
- {
- g_warning ("Coercing GDK_INPUT_ONLY toplevel window to GDK_INPUT_OUTPUT to work around bug in Xorg server");
- attributes->wclass = GDK_INPUT_OUTPUT;
- }
-#endif
-
if (attributes->wclass == GDK_INPUT_ONLY)
{
/* Backwards compatiblity - we've always ignored
@@ -1403,8 +1376,8 @@ gdk_window_new (GdkWindow *parent,
if (window->parent)
window->parent->children = g_list_prepend (window->parent->children, window);
- window->device_cursor = g_hash_table_new_full (NULL, NULL, NULL,
- (GDestroyNotify) gdk_cursor_unref);
+ window->device_cursor = g_hash_table_new_full (NULL, NULL,
+ NULL, g_object_unref);
native = _gdk_native_windows; /* Default */
if (window->parent->window_type == GDK_WINDOW_ROOT)
@@ -1424,7 +1397,7 @@ gdk_window_new (GdkWindow *parent,
event_mask = get_native_event_mask (window);
/* Create the impl */
- _gdk_window_impl_new (window, real_parent, screen, event_mask, attributes, attributes_mask);
+ _gdk_display_create_window_impl (display, window, real_parent, screen, event_mask, attributes, attributes_mask);
window->impl_window = window;
/* This will put the native window topmost in the native parent, which may
@@ -1696,67 +1669,6 @@ gdk_window_reparent (GdkWindow *window,
_gdk_synthesize_crossing_events_for_geometry_change (window);
}
-static gboolean
-temporary_disable_extension_events (GdkWindow*window)
-{
- GdkWindow*child;
- GList *l;
- gboolean res;
-
- if (window->extension_events != 0)
- {
- g_object_set_data (G_OBJECT (window),
- "gdk-window-extension-events",
- GINT_TO_POINTER (window->extension_events));
- gdk_input_set_extension_events ((GdkWindow *)window, 0,
- GDK_EXTENSION_EVENTS_NONE);
- }
- else
- res = FALSE;
-
- for (l = window->children; l != NULL; l = l->next)
- {
- child = l->data;
-
- if (window->impl_window == child->impl_window)
- res |= temporary_disable_extension_events (child);
- }
-
- return res;
-}
-
-static void
-reenable_extension_events (GdkWindow *window)
-{
- GdkWindow *child;
- GList *l;
- int mask;
-
- mask = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window),
- "gdk-window-extension-events"));
-
- if (mask != 0)
- {
- /* We don't have the mode here, so we pass in cursor.
- This works with the current code since mode is not
- stored except as part of the mask, and cursor doesn't
- change the mask. */
- gdk_input_set_extension_events ((GdkWindow *)window, mask,
- GDK_EXTENSION_EVENTS_CURSOR);
- g_object_set_data (G_OBJECT (window),
- "gdk-window-extension-events",
- NULL);
- }
-
- for (l = window->children; l != NULL; l = l->next)
- {
- child = l->data;
-
- if (window->impl_window == child->impl_window)
- reenable_extension_events (window);
- }
-}
-
/**
* gdk_window_ensure_native:
* @window: a #GdkWindow
@@ -1777,11 +1689,11 @@ gdk_window_ensure_native (GdkWindow *window)
{
GdkWindow *impl_window;
GdkWindowImpl *new_impl, *old_impl;
+ GdkDisplay *display;
GdkScreen *screen;
GdkWindow *above;
GList listhead;
GdkWindowImplClass *impl_class;
- gboolean disabled_extension_events;
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
@@ -1800,21 +1712,17 @@ gdk_window_ensure_native (GdkWindow *window)
/* Need to create a native window */
- /* First we disable any extension events on the window or its
- descendants to handle the native input window moving */
- disabled_extension_events = FALSE;
- if (impl_window->input_window)
- disabled_extension_events = temporary_disable_extension_events (window);
-
gdk_window_drop_cairo_surface (window);
screen = gdk_window_get_screen (window);
+ display = gdk_screen_get_display (screen);
old_impl = window->impl;
- _gdk_window_impl_new (window, window->parent,
- screen,
- get_native_event_mask (window),
- NULL, 0);
+ _gdk_display_create_window_impl (display,
+ window, window->parent,
+ screen,
+ get_native_event_mask (window),
+ NULL, 0);
new_impl = window->impl;
window->impl = old_impl;
@@ -1845,36 +1753,68 @@ gdk_window_ensure_native (GdkWindow *window)
reparent_to_impl (window);
if (!window->input_only)
- {
- impl_class->set_background (window, window->background);
- }
+ impl_class->set_background (window, window->background);
impl_class->input_shape_combine_region (window,
- window->input_shape,
- 0, 0);
+ window->input_shape,
+ 0, 0);
if (gdk_window_is_viewable (window))
impl_class->show (window, FALSE);
- if (disabled_extension_events)
- reenable_extension_events (window);
-
return TRUE;
}
+/**
+ * _gdk_event_filter_unref:
+ * @window: A #GdkWindow, or %NULL to be the global window
+ * @filter: A window filter
+ *
+ * Release a reference to @filter. Note this function may
+ * mutate the list storage, so you need to handle this
+ * if iterating over a list of filters.
+ */
+void
+_gdk_event_filter_unref (GdkWindow *window,
+ GdkEventFilter *filter)
+{
+ GList **filters;
+ GList *tmp_list;
+
+ if (window == NULL)
+ filters = &_gdk_default_filters;
+ else
+ filters = &window->filters;
+
+ tmp_list = *filters;
+ while (tmp_list)
+ {
+ GdkEventFilter *iter_filter = tmp_list->data;
+ GList *node;
+
+ node = tmp_list;
+ tmp_list = tmp_list->next;
+
+ if (iter_filter != filter)
+ continue;
+
+ g_assert (iter_filter->ref_count > 0);
+
+ filter->ref_count--;
+ if (filter->ref_count != 0)
+ continue;
+
+ *filters = g_list_remove_link (*filters, node);
+ g_free (filter);
+ g_list_free_1 (node);
+ }
+}
+
static void
window_remove_filters (GdkWindow *window)
{
- if (window->filters)
- {
- GList *tmp_list;
-
- for (tmp_list = window->filters; tmp_list; tmp_list = tmp_list->next)
- g_free (tmp_list->data);
-
- g_list_free (window->filters);
- window->filters = NULL;
- }
+ while (window->filters)
+ _gdk_event_filter_unref (window, window->filters->data);
}
static void
@@ -1967,7 +1907,12 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
* foreign windows in our hierarchy.
*/
if (window->parent)
- _gdk_windowing_window_destroy_foreign (window);
+ {
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
+
+ if (gdk_window_has_impl (window))
+ impl_class->destroy_foreign (window);
+ }
/* Also for historical reasons, we remove any filters
* on a foreign window when it or a parent is destroyed;
@@ -2554,16 +2499,8 @@ gdk_window_remove_filter (GdkWindow *window,
if ((filter->function == function) && (filter->data == data))
{
filter->flags |= GDK_EVENT_FILTER_REMOVED;
- filter->ref_count--;
- if (filter->ref_count != 0)
- return;
- if (window)
- window->filters = g_list_remove_link (window->filters, node);
- else
- _gdk_default_filters = g_list_remove_link (_gdk_default_filters, node);
- g_list_free_1 (node);
- g_free (filter);
+ _gdk_event_filter_unref (window, filter);
return;
}
@@ -4074,19 +4011,18 @@ gdk_window_process_updates_internal (GdkWindow *window)
cairo_region_get_extents (update_area, &clip_box);
end_implicit = gdk_window_begin_implicit_paint (window, &clip_box);
expose_region = cairo_region_copy (update_area);
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
if (!end_implicit)
{
/* Rendering is not double buffered by gdk, do outstanding
* moves and queue antiexposure immediately. No need to do
* any tricks */
gdk_window_flush_outstanding_moves (window);
- impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
save_region = impl_class->queue_antiexpose (window, update_area);
}
-
/* Render the invalid areas to the implicit paint, by sending exposes.
* May flush if non-double buffered widget draw. */
- _gdk_windowing_window_process_updates_recurse (window, expose_region);
+ impl_class->process_updates_recurse (window, expose_region);
if (end_implicit)
{
@@ -4095,17 +4031,12 @@ gdk_window_process_updates_internal (GdkWindow *window)
/* By this time we know that any outstanding expose for this
* area is invalid and we can avoid it, so queue an antiexpose.
- * However, it may be that due to an non-double buffered expose
* we have already started drawing to the window, so it would
* be to late to anti-expose now. Since this is merely an
* optimization we just avoid doing it at all in that case.
*/
- if (window->implicit_paint != NULL &&
- !window->implicit_paint->flushed)
- {
- impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
- save_region = impl_class->queue_antiexpose (window, update_area);
- }
+ if (window->implicit_paint != NULL && !window->implicit_paint->flushed)
+ save_region = impl_class->queue_antiexpose (window, update_area);
gdk_window_end_implicit_paint (window);
}
@@ -4128,11 +4059,39 @@ gdk_window_process_updates_internal (GdkWindow *window)
static void
flush_all_displays (void)
{
- GSList *displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
- GSList *tmp_list;
+ GSList *displays, *l;
- for (tmp_list = displays; tmp_list; tmp_list = tmp_list->next)
- gdk_display_flush (tmp_list->data);
+ displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ for (l = displays; l; l = l->next)
+ gdk_display_flush (l->data);
+
+ g_slist_free (displays);
+}
+
+static void
+before_process_all_updates (void)
+{
+ GSList *displays, *l;
+ GdkDisplayClass *display_class;
+
+ displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ display_class = GDK_DISPLAY_GET_CLASS (displays->data);
+ for (l = displays; l; l = l->next)
+ display_class->before_process_all_updates (l->data);
+
+ g_slist_free (displays);
+}
+
+static void
+after_process_all_updates (void)
+{
+ GSList *displays, *l;
+ GdkDisplayClass *display_class;
+
+ displays = gdk_display_manager_list_displays (gdk_display_manager_get ());
+ display_class = GDK_DISPLAY_GET_CLASS (displays->data);
+ for (l = displays; l; l = l->next)
+ display_class->after_process_all_updates (l->data);
g_slist_free (displays);
}
@@ -4180,7 +4139,7 @@ gdk_window_process_all_updates (void)
update_windows = NULL;
update_idle = 0;
- _gdk_windowing_before_process_all_updates ();
+ before_process_all_updates ();
g_slist_foreach (old_update_windows, (GFunc)g_object_ref, NULL);
@@ -4205,7 +4164,7 @@ gdk_window_process_all_updates (void)
flush_all_displays ();
- _gdk_windowing_after_process_all_updates ();
+ after_process_all_updates ();
in_process_all_updates = FALSE;
@@ -4982,7 +4941,7 @@ gdk_window_get_pointer (GdkWindow *window,
/**
* gdk_window_get_device_position:
* @window: a #GdkWindow.
- * @device: #GdkDevice to query to.
+ * @device: pointer #GdkDevice to query to.
* @x: (out) (allow-none): return location for the X coordinate of @device, or %NULL.
* @y: (out) (allow-none): return location for the Y coordinate of @device, or %NULL.
* @mask: (out) (allow-none): return location for the modifier mask, or %NULL.
@@ -4992,8 +4951,7 @@ gdk_window_get_pointer (GdkWindow *window,
* corner of @window.
*
* Return value: (transfer none): The window underneath @device (as with
- * gdk_display_get_window_at_device_position()), or %NULL if the
- * window is not known to GDK.
+ * gdk_device_get_window_at_position()), or %NULL if the window is not known to GDK.
*
* Since: 3.0
**/
@@ -5004,20 +4962,21 @@ gdk_window_get_device_position (GdkWindow *window,
gint *y,
GdkModifierType *mask)
{
- GdkDisplay *display;
gint tmp_x, tmp_y;
GdkModifierType tmp_mask;
- GdkWindow *child;
+ gboolean normal_child;
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
- tmp_x = 0;
- tmp_y = 0;
-
- display = gdk_window_get_display (window);
- child = display->device_hooks->window_get_device_position (display, device, window,
- &tmp_x, &tmp_y, &tmp_mask);
+ normal_child = GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_device_state (window,
+ device,
+ &tmp_x, &tmp_y,
+ &tmp_mask);
+ /* We got the coords on the impl, convert to the window */
+ tmp_x -= window->abs_x;
+ tmp_y -= window->abs_y;
if (x)
*x = tmp_x;
@@ -5026,9 +4985,11 @@ gdk_window_get_device_position (GdkWindow *window,
if (mask)
*mask = tmp_mask;
- _gdk_display_enable_motion_hints (display, device);
+ _gdk_display_enable_motion_hints (gdk_window_get_display (window), device);
- return child;
+ if (normal_child)
+ return _gdk_window_find_child_at (window, tmp_x, tmp_y);
+ return NULL;
}
/**
@@ -5047,7 +5008,7 @@ gdk_window_get_device_position (GdkWindow *window,
*
* Return value: (transfer none): window under the mouse pointer
*
- * Deprecated: 3.0: Use gdk_display_get_window_at_device_position() instead.
+ * Deprecated: 3.0: Use gdk_device_get_window_at_position() instead.
**/
GdkWindow*
gdk_window_at_pointer (gint *win_x,
@@ -5070,25 +5031,6 @@ gdk_get_default_root_window (void)
return gdk_screen_get_root_window (gdk_screen_get_default ());
}
-/**
- * gdk_window_foreign_new:
- * @anid: a native window handle.
- *
- * Wraps a native window for the default display in a #GdkWindow.
- * This may fail if the window has been destroyed.
- *
- * For example in the X backend, a native window handle is an Xlib
- * XID .
- *
- * Return value: (transfer full): the newly-created #GdkWindow wrapper
- * for the native window, or %NULL if the window has been destroyed.
- **/
-GdkWindow *
-gdk_window_foreign_new (GdkNativeWindow anid)
-{
- return gdk_window_foreign_new_for_display (gdk_display_get_default (), anid);
-}
-
static void
get_all_native_children (GdkWindow *window,
GList **native)
@@ -5698,8 +5640,9 @@ gdk_window_hide (GdkWindow *window)
{
GdkDevice *device = d->data;
- if (_gdk_display_end_device_grab (display, device,
- _gdk_windowing_window_get_next_serial (display),
+ if (_gdk_display_end_device_grab (display,
+ device,
+ _gdk_display_get_next_serial (display),
window,
TRUE))
gdk_device_ungrab (device, GDK_CURRENT_TIME);
@@ -6716,14 +6659,14 @@ gdk_window_set_cursor (GdkWindow *window,
if (window->cursor)
{
- gdk_cursor_unref (window->cursor);
+ g_object_unref (window->cursor);
window->cursor = NULL;
}
if (!GDK_WINDOW_DESTROYED (window))
{
if (cursor)
- window->cursor = gdk_cursor_ref (cursor);
+ window->cursor = g_object_ref (cursor);
_gdk_display_pointer_info_foreach (display,
update_cursor_foreach,
@@ -6736,7 +6679,7 @@ gdk_window_set_cursor (GdkWindow *window,
/**
* gdk_window_get_device_cursor:
* @window: a #GdkWindow.
- * @device: a #GdkDevice.
+ * @device: a master, pointer #GdkDevice.
*
* Retrieves a #GdkCursor pointer for the @device currently set on the
* specified #GdkWindow, or %NULL. If the return value is %NULL then
@@ -6755,6 +6698,8 @@ gdk_window_get_device_cursor (GdkWindow *window,
{
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD, NULL);
+ g_return_val_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER, NULL);
return g_hash_table_lookup (window->device_cursor, device);
}
@@ -6762,7 +6707,7 @@ gdk_window_get_device_cursor (GdkWindow *window,
/**
* gdk_window_set_device_cursor:
* @window: a #Gdkwindow
- * @device: a #GdkDevice
+ * @device: a master, pointer #GdkDevice
* @cursor: a #GdkCursor
*
* Sets a specific #GdkCursor for a given device when it gets inside @window.
@@ -6783,13 +6728,15 @@ gdk_window_set_device_cursor (GdkWindow *window,
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (GDK_IS_DEVICE (device));
+ g_return_if_fail (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD);
+ g_return_if_fail (gdk_device_get_device_type (device) == GDK_DEVICE_TYPE_MASTER);
display = gdk_window_get_display (window);
if (!cursor)
g_hash_table_remove (window->device_cursor, device);
else
- g_hash_table_replace (window->device_cursor, device, gdk_cursor_ref (cursor));
+ g_hash_table_replace (window->device_cursor, device, g_object_ref (cursor));
if (!GDK_WINDOW_DESTROYED (window))
{
@@ -6809,7 +6756,6 @@ gdk_window_set_device_cursor (GdkWindow *window,
* @y: (out) (allow-none): return location for Y coordinate of window (relative to its parent)
* @width: (out) (allow-none): return location for width of window
* @height: (out) (allow-none): return location for height of window
- * @depth: (out) (allow-none): return location for bit depth of window
*
* Any of the return location arguments to this function may be %NULL,
* if you aren't interested in getting the value of that field.
@@ -6839,8 +6785,7 @@ gdk_window_get_geometry (GdkWindow *window,
gint *x,
gint *y,
gint *width,
- gint *height,
- gint *depth)
+ gint *height)
{
GdkWindow *parent;
GdkWindowImplClass *impl_class;
@@ -6861,8 +6806,7 @@ gdk_window_get_geometry (GdkWindow *window,
{
impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
impl_class->get_geometry (window, x, y,
- width, height,
- depth);
+ width, height);
/* This reports the position wrt to the native parent, we need to convert
it to be relative to the client side parent */
parent = window->parent;
@@ -6884,8 +6828,6 @@ gdk_window_get_geometry (GdkWindow *window,
*width = window->width;
if (height)
*height = window->height;
- if (depth)
- *depth = window->depth;
}
}
}
@@ -7169,6 +7111,9 @@ gdk_window_shape_combine_region (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window))
return;
+ if (!window->shape && shape_region == NULL)
+ return;
+
window->shaped = (shape_region != NULL);
if (window->shape)
@@ -7494,6 +7439,7 @@ gdk_window_set_composited (GdkWindow *window,
gboolean composited)
{
GdkDisplay *display;
+ GdkWindowImplClass *impl_class;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -7507,14 +7453,16 @@ gdk_window_set_composited (GdkWindow *window,
display = gdk_window_get_display (window);
- if (!gdk_display_supports_composite (display) && composited)
+ impl_class = GDK_WINDOW_IMPL_GET_CLASS (window->impl);
+
+ if (composited && (!gdk_display_supports_composite (display) || !impl_class->set_composited))
{
g_warning ("gdk_window_set_composited called but "
- "compositing is not supported");
+ "compositing is not supported");
return;
}
- _gdk_windowing_window_set_composited (window, composited);
+ impl_class->set_composited (window, composited);
recompute_visible_regions (window, TRUE, FALSE);
@@ -8052,7 +8000,7 @@ gdk_window_beep (GdkWindow *window)
if (toplevel)
{
- if (GDK_WINDOW_IMPL_CLASS (toplevel)->beep (window))
+ if (GDK_WINDOW_IMPL_GET_CLASS (toplevel->impl)->beep (window))
return;
}
@@ -8340,6 +8288,7 @@ send_crossing_event (GdkDisplay *display,
GdkNotifyType notify_type,
GdkWindow *subwindow,
GdkDevice *device,
+ GdkDevice *source_device,
gint toplevel_x,
gint toplevel_y,
GdkModifierType mask,
@@ -8399,6 +8348,10 @@ send_crossing_event (GdkDisplay *display,
{
event = _gdk_make_event ((GdkWindow *)window, type, event_in_queue, TRUE);
gdk_event_set_device (event, device);
+
+ if (source_device)
+ gdk_event_set_source_device (event, source_device);
+
event->crossing.time = time_;
event->crossing.subwindow = subwindow;
if (subwindow)
@@ -8426,6 +8379,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
GdkWindow *src,
GdkWindow *dest,
GdkDevice *device,
+ GdkDevice *source_device,
GdkCrossingMode mode,
gint toplevel_x,
gint toplevel_y,
@@ -8481,7 +8435,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
a, GDK_LEAVE_NOTIFY,
mode,
notify_type,
- NULL, device,
+ NULL, device, source_device,
toplevel_x, toplevel_y,
mask, time_,
event_in_queue,
@@ -8503,7 +8457,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
mode,
notify_type,
(GdkWindow *)last,
- device,
+ device, source_device,
toplevel_x, toplevel_y,
mask, time_,
event_in_queue,
@@ -8550,7 +8504,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
mode,
notify_type,
(GdkWindow *)next,
- device,
+ device, source_device,
toplevel_x, toplevel_y,
mask, time_,
event_in_queue,
@@ -8572,7 +8526,7 @@ _gdk_synthesize_crossing_events (GdkDisplay *display,
mode,
notify_type,
NULL,
- device,
+ device, source_device,
toplevel_x, toplevel_y,
mask, time_,
event_in_queue,
@@ -8743,7 +8697,7 @@ gdk_pointer_grab (GdkWindow * window,
display = gdk_window_get_display (window);
- serial = _gdk_windowing_window_get_next_serial (display);
+ serial = _gdk_display_get_next_serial (display);
device_manager = gdk_display_get_device_manager (display);
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
@@ -8756,14 +8710,13 @@ gdk_pointer_grab (GdkWindow * window,
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
- res = _gdk_windowing_device_grab (device,
- window,
- native,
- owner_events,
- get_native_grab_event_mask (event_mask),
- confine_to,
- cursor,
- time);
+ res = GDK_DEVICE_GET_CLASS (device)->grab (device,
+ native,
+ owner_events,
+ get_native_grab_event_mask (event_mask),
+ confine_to,
+ cursor,
+ time);
if (res == GDK_GRAB_SUCCESS)
_gdk_display_add_device_grab (display,
@@ -8847,8 +8800,7 @@ gdk_keyboard_grab (GdkWindow *window,
}
display = gdk_window_get_display (window);
-
- serial = _gdk_windowing_window_get_next_serial (display);
+ serial = _gdk_display_get_next_serial (display);
device_manager = gdk_display_get_device_manager (display);
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
@@ -8861,14 +8813,13 @@ gdk_keyboard_grab (GdkWindow *window,
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
continue;
- res = _gdk_windowing_device_grab (device,
- window,
- native,
- owner_events,
- GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
- NULL,
- NULL,
- time);
+ res = GDK_DEVICE_GET_CLASS (device)->grab (device,
+ native,
+ owner_events,
+ GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
+ NULL,
+ NULL,
+ time);
if (res == GDK_GRAB_SUCCESS)
_gdk_display_add_device_grab (display,
@@ -8905,6 +8856,143 @@ gdk_window_geometry_changed (GdkWindow *window)
_gdk_synthesize_crossing_events_for_geometry_change (window);
}
+static void
+source_events_device_added (GdkDeviceManager *device_manager,
+ GdkDevice *device,
+ gpointer user_data)
+{
+ GdkWindow *window;
+ GdkEventMask event_mask;
+ GdkInputSource source;
+
+ if (gdk_device_get_device_type (device) != GDK_DEVICE_TYPE_FLOATING)
+ return;
+
+ window = user_data;
+ source = gdk_device_get_source (device);
+
+ event_mask = GPOINTER_TO_INT (g_hash_table_lookup (window->source_event_masks,
+ GINT_TO_POINTER (source)));
+ if (event_mask)
+ gdk_window_set_device_events (window, device, event_mask);
+}
+
+static void
+source_events_device_changed (GdkDeviceManager *device_manager,
+ GdkDevice *device,
+ gpointer user_data)
+{
+ GdkDeviceType type;
+ GdkInputSource source;
+ GdkEventMask event_mask;
+ GdkWindow *window;
+
+ window = user_data;
+ type = gdk_device_get_device_type (device);
+ source = gdk_device_get_source (device);
+
+ event_mask = GPOINTER_TO_INT (g_hash_table_lookup (window->source_event_masks,
+ GINT_TO_POINTER (source)));
+
+ if (!event_mask)
+ return;
+
+ if (type == GDK_DEVICE_TYPE_FLOATING)
+ {
+ /* The device was just floated, enable its event mask */
+ gdk_window_set_device_events (window, device, event_mask);
+ }
+ else if (type == GDK_DEVICE_TYPE_SLAVE)
+ gdk_window_set_device_events (window, device, 0);
+}
+
+/**
+ * gdk_window_set_source_events:
+ * @window: a #GdkWindow
+ * @source: a #GdkInputSource to define the source class.
+ * @event_mask: event mask for @window
+ *
+ * Sets the event mask for any floating device (i.e. not attached to any
+ * visible pointer) that has the source defined as @source. This event
+ * mask will be applied both to currently existing, newly added devices
+ * after this call, and devices being attached/detached.
+ *
+ * Since: 3.0
+ **/
+void
+gdk_window_set_source_events (GdkWindow *window,
+ GdkInputSource source,
+ GdkEventMask event_mask)
+{
+ GdkDeviceManager *device_manager;
+ GdkDisplay *display;
+ GList *devices, *d;
+ guint size;
+
+ g_return_if_fail (GDK_IS_WINDOW (window));
+
+ display = gdk_window_get_display (window);
+ device_manager = gdk_display_get_device_manager (display);
+
+ devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
+
+ /* Set event mask for existing devices */
+ for (d = devices; d; d = d->next)
+ {
+ GdkDevice *device = d->data;
+
+ if (source == gdk_device_get_source (device))
+ gdk_window_set_device_events (window, device, event_mask);
+ }
+
+ /* Update accounting */
+ if (G_UNLIKELY (!window->source_event_masks))
+ window->source_event_masks = g_hash_table_new (NULL, NULL);
+
+ if (event_mask)
+ g_hash_table_insert (window->source_event_masks,
+ GUINT_TO_POINTER (source),
+ GUINT_TO_POINTER (event_mask));
+ else
+ g_hash_table_remove (window->source_event_masks,
+ GUINT_TO_POINTER (source));
+
+ size = g_hash_table_size (window->source_event_masks);
+
+ /* Update handler if needed */
+ if (!window->device_added_handler_id && size > 0)
+ {
+ window->device_added_handler_id =
+ g_signal_connect (device_manager, "device-added",
+ G_CALLBACK (source_events_device_added), window);
+ window->device_changed_handler_id =
+ g_signal_connect (device_manager, "device-changed",
+ G_CALLBACK (source_events_device_changed), window);
+ }
+ else if (window->device_added_handler_id && size == 0)
+ g_signal_handler_disconnect (device_manager, window->device_added_handler_id);
+}
+
+/**
+ * gdk_window_get_source_events:
+ * @window: a #GdkWindow
+ * @source: a #GdkInputSource to define the source class.
+ *
+ * Returns the event mask for @window corresponding to the device class specified
+ * by @source.
+ *
+ * Returns: source event mask for @window
+ **/
+GdkEventMask
+gdk_window_get_source_events (GdkWindow *window,
+ GdkInputSource source)
+{
+ g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
+
+ return GPOINTER_TO_UINT (g_hash_table_lookup (window->source_event_masks,
+ GUINT_TO_POINTER (source)));
+}
+
static gboolean
do_synthesize_crossing_event (gpointer data)
{
@@ -8922,7 +9010,7 @@ do_synthesize_crossing_event (gpointer data)
return FALSE;
display = gdk_window_get_display (changed_toplevel);
- serial = _gdk_windowing_window_get_next_serial (display);
+ serial = _gdk_display_get_next_serial (display);
g_hash_table_iter_init (&iter, display->pointers_info);
while (g_hash_table_iter_next (&iter, &key, &value))
@@ -8944,7 +9032,7 @@ do_synthesize_crossing_event (gpointer data)
_gdk_synthesize_crossing_events (display,
pointer_info->window_under_pointer,
new_window_under_pointer,
- device,
+ device, NULL,
GDK_CROSSING_NORMAL,
pointer_info->toplevel_x,
pointer_info->toplevel_y,
@@ -9060,7 +9148,7 @@ proxy_pointer_event (GdkDisplay *display,
GdkWindow *toplevel_window, *event_window;
GdkWindow *pointer_window;
GdkPointerWindowInfo *pointer_info;
- GdkDevice *device;
+ GdkDevice *device, *source_device;
GdkEvent *event;
guint state;
gdouble toplevel_x, toplevel_y;
@@ -9072,6 +9160,7 @@ proxy_pointer_event (GdkDisplay *display,
gdk_event_get_state (source_event, &state);
time_ = gdk_event_get_time (source_event);
device = gdk_event_get_device (source_event);
+ source_device = gdk_event_get_source_device (source_event);
pointer_info = _gdk_display_get_pointer_info (display, device);
toplevel_window = convert_native_coords_to_toplevel (event_window,
toplevel_x, toplevel_y,
@@ -9105,7 +9194,7 @@ proxy_pointer_event (GdkDisplay *display,
_gdk_synthesize_crossing_events (display,
pointer_info->window_under_pointer,
event_window,
- device,
+ device, source_device,
source_event->crossing.mode,
toplevel_x, toplevel_y,
state, time_,
@@ -9121,7 +9210,7 @@ proxy_pointer_event (GdkDisplay *display,
source_event->crossing.mode,
source_event->crossing.detail,
NULL,
- device,
+ device, source_device,
toplevel_x, toplevel_y,
state, time_,
source_event,
@@ -9151,7 +9240,7 @@ proxy_pointer_event (GdkDisplay *display,
source_event->crossing.mode,
source_event->crossing.detail,
NULL,
- device,
+ device, source_device,
toplevel_x, toplevel_y,
state, time_,
source_event,
@@ -9161,7 +9250,7 @@ proxy_pointer_event (GdkDisplay *display,
_gdk_synthesize_crossing_events (display,
event_window,
pointer_window,
- device,
+ device, source_device,
source_event->crossing.mode,
toplevel_x, toplevel_y,
state, time_,
@@ -9180,7 +9269,7 @@ proxy_pointer_event (GdkDisplay *display,
_gdk_synthesize_crossing_events (display,
pointer_info->window_under_pointer,
pointer_window,
- device,
+ device, source_device,
GDK_CROSSING_NORMAL,
toplevel_x, toplevel_y,
state, time_,
@@ -9241,6 +9330,7 @@ proxy_pointer_event (GdkDisplay *display,
event->motion.device = source_event->motion.device;
event->motion.axes = g_memdup (source_event->motion.axes,
sizeof (gdouble) * gdk_device_get_n_axes (source_event->motion.device));
+ gdk_event_set_source_device (event, source_device);
}
}
@@ -9270,7 +9360,7 @@ proxy_button_event (GdkEvent *source_event,
gdouble toplevel_x, toplevel_y;
GdkDisplay *display;
GdkWindow *w;
- GdkDevice *device;
+ GdkDevice *device, *source_device;
type = source_event->any.type;
event_window = source_event->any.window;
@@ -9278,6 +9368,7 @@ proxy_button_event (GdkEvent *source_event,
gdk_event_get_state (source_event, &state);
time_ = gdk_event_get_time (source_event);
device = gdk_event_get_device (source_event);
+ source_device = gdk_event_get_source_device (source_event);
display = gdk_window_get_display (source_event->any.window);
toplevel_window = convert_native_coords_to_toplevel (event_window,
toplevel_x, toplevel_y,
@@ -9314,7 +9405,7 @@ proxy_button_event (GdkEvent *source_event,
serial,
time_,
TRUE);
- _gdk_display_device_grab_update (display, device, serial);
+ _gdk_display_device_grab_update (display, device, source_device, serial);
}
pointer_window = get_pointer_window (display, toplevel_window, device,
@@ -9351,6 +9442,8 @@ proxy_button_event (GdkEvent *source_event,
event->button.axes = g_memdup (source_event->button.axes,
sizeof (gdouble) * gdk_device_get_n_axes (source_event->button.device));
+ gdk_event_set_source_device (event, source_device);
+
if (type == GDK_BUTTON_PRESS)
_gdk_event_button_generate (display, event);
return TRUE;
@@ -9364,6 +9457,7 @@ proxy_button_event (GdkEvent *source_event,
event->scroll.y_root = source_event->scroll.y_root;
event->scroll.state = state;
event->scroll.device = source_event->scroll.device;
+ gdk_event_set_source_device (event, source_device);
return TRUE;
default:
@@ -9457,20 +9551,21 @@ _gdk_windowing_got_event (GdkDisplay *display,
guint old_state, old_button;
GdkDeviceGrabInfo *button_release_grab;
GdkPointerWindowInfo *pointer_info;
- GdkDevice *device;
+ GdkDevice *device, *source_device;
gboolean is_toplevel;
if (gdk_event_get_time (event) != GDK_CURRENT_TIME)
display->last_event_time = gdk_event_get_time (event);
device = gdk_event_get_device (event);
+ source_device = gdk_event_get_source_device (event);
if (device)
{
GdkInputMode mode;
g_object_get (device, "input-mode", &mode, NULL);
- _gdk_display_device_grab_update (display, device, serial);
+ _gdk_display_device_grab_update (display, device, source_device, serial);
if (mode == GDK_MODE_DISABLED ||
!_gdk_display_check_grab_ownership (display, device, serial))
@@ -9515,7 +9610,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
serial,
gdk_event_get_time (event),
TRUE);
- _gdk_display_device_grab_update (display, device, serial);
+ _gdk_display_device_grab_update (display, device, source_device, serial);
}
if (event->type == GDK_BUTTON_RELEASE &&
!event->any.send_event)
@@ -9528,7 +9623,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
{
button_release_grab->serial_end = serial;
button_release_grab->implicit_ungrab = FALSE;
- _gdk_display_device_grab_update (display, device, serial);
+ _gdk_display_device_grab_update (display, device, source_device, serial);
}
}
@@ -9650,7 +9745,7 @@ _gdk_windowing_got_event (GdkDisplay *display,
{
button_release_grab->serial_end = serial;
button_release_grab->implicit_ungrab = FALSE;
- _gdk_display_device_grab_update (display, device, serial);
+ _gdk_display_device_grab_update (display, device, source_device, serial);
}
}
@@ -9663,88 +9758,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
}
}
-
-static GdkWindow *
-get_extension_event_window (GdkDisplay *display,
- GdkWindow *pointer_window,
- GdkEventType type,
- gulong serial)
-{
- guint evmask;
- GdkWindow *w, *grab_window;
- GdkDeviceGrabInfo *grab;
-
- /* FIXME: which device? */
- grab = _gdk_display_has_device_grab (display, display->core_pointer, serial);
-
- if (grab != NULL && !grab->owner_events)
- {
- evmask = grab->event_mask;
-
- grab_window = grab->window;
-
- if (evmask & type_masks[type])
- return grab_window;
- else
- return NULL;
- }
-
- w = pointer_window;
- while (w != NULL)
- {
- evmask = w->extension_events;
-
- if (evmask & type_masks[type])
- return w;
-
- w = get_event_parent (w);
- }
-
- if (grab != NULL &&
- grab->owner_events)
- {
- evmask = grab->event_mask;
-
- if (evmask & type_masks[type])
- return grab->window;
- else
- return NULL;
- }
-
- return NULL;
-}
-
-
-GdkWindow *
-_gdk_window_get_input_window_for_event (GdkWindow *native_window,
- GdkEventType event_type,
- int x, int y,
- gulong serial)
-{
- GdkDisplay *display;
- GdkWindow *toplevel_window;
- GdkWindow *pointer_window;
- GdkWindow *event_win;
- gdouble toplevel_x, toplevel_y;
-
- toplevel_x = x;
- toplevel_y = y;
-
- display = gdk_window_get_display (native_window);
- toplevel_window = convert_native_coords_to_toplevel (native_window,
- toplevel_x, toplevel_y,
- &toplevel_x, &toplevel_y);
- /* FIXME: which device? */
- pointer_window = get_pointer_window (display, toplevel_window, NULL,
- toplevel_x, toplevel_y, serial);
- event_win = get_extension_event_window (display,
- pointer_window,
- event_type,
- serial);
-
- return event_win;
-}
-
/**
* gdk_window_create_similar_surface:
* @window: window to make new surface similar to
@@ -9793,3 +9806,1131 @@ gdk_window_create_similar_surface (GdkWindow * window,
return surface;
}
+/**
+ * gdk_window_focus:
+ * @window: a #GdkWindow
+ * @timestamp: timestamp of the event triggering the window focus
+ *
+ * Sets keyboard focus to @window. In most cases, gtk_window_present()
+ * should be used on a #GtkWindow, rather than calling this function.
+ *
+ **/
+void
+gdk_window_focus (GdkWindow *window,
+ guint32 timestamp)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->focus (window, timestamp);
+}
+
+/**
+ * gdk_window_set_type_hint:
+ * @window: A toplevel #GdkWindow
+ * @hint: A hint of the function this window will have
+ *
+ * The application can use this call to provide a hint to the window
+ * manager about the functionality of a window. The window manager
+ * can use this information when determining the decoration and behaviour
+ * of the window.
+ *
+ * The hint must be set before the window is mapped.
+ **/
+void
+gdk_window_set_type_hint (GdkWindow *window,
+ GdkWindowTypeHint hint)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_type_hint (window, hint);
+}
+
+/**
+ * gdk_window_get_type_hint:
+ * @window: A toplevel #GdkWindow
+ *
+ * This function returns the type hint set for a window.
+ *
+ * Return value: The type hint set for @window
+ *
+ * Since: 2.10
+ **/
+GdkWindowTypeHint
+gdk_window_get_type_hint (GdkWindow *window)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_type_hint (window);
+}
+
+/**
+ * gdk_window_set_modal_hint:
+ * @window: A toplevel #GdkWindow
+ * @modal: %TRUE if the window is modal, %FALSE otherwise.
+ *
+ * The application can use this hint to tell the window manager
+ * that a certain window has modal behaviour. The window manager
+ * can use this information to handle modal windows in a special
+ * way.
+ *
+ * You should only use this on windows for which you have
+ * previously called gdk_window_set_transient_for()
+ **/
+void
+gdk_window_set_modal_hint (GdkWindow *window,
+ gboolean modal)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_modal_hint (window, modal);
+}
+
+/**
+ * gdk_window_set_skip_taskbar_hint:
+ * @window: a toplevel #GdkWindow
+ * @skips_taskbar: %TRUE to skip the taskbar
+ *
+ * Toggles whether a window should appear in a task list or window
+ * list. If a window's semantic type as specified with
+ * gdk_window_set_type_hint() already fully describes the window, this
+ * function should not be called in addition,
+ * instead you should allow the window to be treated according to
+ * standard policy for its semantic type.
+ *
+ * Since: 2.2
+ **/
+void
+gdk_window_set_skip_taskbar_hint (GdkWindow *window,
+ gboolean skips_taskbar)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_skip_taskbar_hint (window, skips_taskbar);
+}
+
+/**
+ * gdk_window_set_skip_pager_hint:
+ * @window: a toplevel #GdkWindow
+ * @skips_pager: %TRUE to skip the pager
+ *
+ * Toggles whether a window should appear in a pager (workspace
+ * switcher, or other desktop utility program that displays a small
+ * thumbnail representation of the windows on the desktop). If a
+ * window's semantic type as specified with gdk_window_set_type_hint()
+ * already fully describes the window, this function should
+ * not be called in addition, instead you should
+ * allow the window to be treated according to standard policy for
+ * its semantic type.
+ *
+ * Since: 2.2
+ **/
+void
+gdk_window_set_skip_pager_hint (GdkWindow *window,
+ gboolean skips_pager)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_skip_pager_hint (window, skips_pager);
+}
+
+/**
+ * gdk_window_set_urgency_hint:
+ * @window: a toplevel #GdkWindow
+ * @urgent: %TRUE if the window is urgent
+ *
+ * Toggles whether a window needs the user's
+ * urgent attention.
+ *
+ * Since: 2.8
+ **/
+void
+gdk_window_set_urgency_hint (GdkWindow *window,
+ gboolean urgent)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_urgency_hint (window, urgent);
+}
+
+/**
+ * gdk_window_set_geometry_hints:
+ * @window: a toplevel #GdkWindow
+ * @geometry: geometry hints
+ * @geom_mask: bitmask indicating fields of @geometry to pay attention to
+ *
+ * Sets the geometry hints for @window. Hints flagged in @geom_mask
+ * are set, hints not flagged in @geom_mask are unset.
+ * To unset all hints, use a @geom_mask of 0 and a @geometry of %NULL.
+ *
+ * This function provides hints to the windowing system about
+ * acceptable sizes for a toplevel window. The purpose of
+ * this is to constrain user resizing, but the windowing system
+ * will typically (but is not required to) also constrain the
+ * current size of the window to the provided values and
+ * constrain programatic resizing via gdk_window_resize() or
+ * gdk_window_move_resize().
+ *
+ * Note that on X11, this effect has no effect on windows
+ * of type %GDK_WINDOW_TEMP or windows where override redirect
+ * has been turned on via gdk_window_set_override_redirect()
+ * since these windows are not resizable by the user.
+ *
+ * Since you can't count on the windowing system doing the
+ * constraints for programmatic resizes, you should generally
+ * call gdk_window_constrain_size() yourself to determine
+ * appropriate sizes.
+ *
+ **/
+void
+gdk_window_set_geometry_hints (GdkWindow *window,
+ const GdkGeometry *geometry,
+ GdkWindowHints geom_mask)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_geometry_hints (window, geometry, geom_mask);
+}
+
+/**
+ * gdk_window_set_title:
+ * @window: a toplevel #GdkWindow
+ * @title: title of @window
+ *
+ * Sets the title of a toplevel window, to be displayed in the titlebar.
+ * If you haven't explicitly set the icon name for the window
+ * (using gdk_window_set_icon_name()), the icon name will be set to
+ * @title as well. @title must be in UTF-8 encoding (as with all
+ * user-readable strings in GDK/GTK+). @title may not be %NULL.
+ **/
+void
+gdk_window_set_title (GdkWindow *window,
+ const gchar *title)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_title (window, title);
+}
+
+/**
+ * gdk_window_set_role:
+ * @window: a toplevel #GdkWindow
+ * @role: a string indicating its role
+ *
+ * When using GTK+, typically you should use gtk_window_set_role() instead
+ * of this low-level function.
+ *
+ * The window manager and session manager use a window's role to
+ * distinguish it from other kinds of window in the same application.
+ * When an application is restarted after being saved in a previous
+ * session, all windows with the same title and role are treated as
+ * interchangeable. So if you have two windows with the same title
+ * that should be distinguished for session management purposes, you
+ * should set the role on those windows. It doesn't matter what string
+ * you use for the role, as long as you have a different role for each
+ * non-interchangeable kind of window.
+ *
+ **/
+void
+gdk_window_set_role (GdkWindow *window,
+ const gchar *role)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_role (window, role);
+}
+
+/**
+ * gdk_window_set_startup_id:
+ * @window: a toplevel #GdkWindow
+ * @startup_id: a string with startup-notification identifier
+ *
+ * When using GTK+, typically you should use gtk_window_set_startup_id()
+ * instead of this low-level function.
+ *
+ * Since: 2.12
+ *
+ **/
+void
+gdk_window_set_startup_id (GdkWindow *window,
+ const gchar *startup_id)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_startup_id (window, startup_id);
+}
+
+/**
+ * gdk_window_set_transient_for:
+ * @window: a toplevel #GdkWindow
+ * @parent: another toplevel #GdkWindow
+ *
+ * Indicates to the window manager that @window is a transient dialog
+ * associated with the application window @parent. This allows the
+ * window manager to do things like center @window on @parent and
+ * keep @window above @parent.
+ *
+ * See gtk_window_set_transient_for() if you're using #GtkWindow or
+ * #GtkDialog.
+ **/
+void
+gdk_window_set_transient_for (GdkWindow *window,
+ GdkWindow *parent)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_transient_for (window, parent);
+}
+
+/**
+ * gdk_window_get_root_origin:
+ * @window: a toplevel #GdkWindow
+ * @x: return location for X position of window frame
+ * @y: return location for Y position of window frame
+ *
+ * Obtains the top-left corner of the window manager frame in root
+ * window coordinates.
+ *
+ **/
+void
+gdk_window_get_root_origin (GdkWindow *window,
+ gint *x,
+ gint *y)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_root_origin (window, x, y);
+}
+
+/**
+ * gdk_window_get_frame_extents:
+ * @window: a toplevel #GdkWindow
+ * @rect: rectangle to fill with bounding box of the window frame
+ *
+ * Obtains the bounding box of the window, including window manager
+ * titlebar/borders if any. The frame position is given in root window
+ * coordinates. To get the position of the window itself (rather than
+ * the frame) in root window coordinates, use gdk_window_get_origin().
+ *
+ **/
+void
+gdk_window_get_frame_extents (GdkWindow *window,
+ GdkRectangle *rect)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_frame_extents (window, rect);
+}
+
+/**
+ * gdk_window_set_override_redirect:
+ * @window: a toplevel #GdkWindow
+ * @override_redirect: %TRUE if window should be override redirect
+ *
+ * An override redirect window is not under the control of the window manager.
+ * This means it won't have a titlebar, won't be minimizable, etc. - it will
+ * be entirely under the control of the application. The window manager
+ * can't see the override redirect window at all.
+ *
+ * Override redirect should only be used for short-lived temporary
+ * windows, such as popup menus. #GtkMenu uses an override redirect
+ * window in its implementation, for example.
+ *
+ **/
+void
+gdk_window_set_override_redirect (GdkWindow *window,
+ gboolean override_redirect)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_override_redirect (window, override_redirect);
+}
+
+/**
+ * gdk_window_set_accept_focus:
+ * @window: a toplevel #GdkWindow
+ * @accept_focus: %TRUE if the window should receive input focus
+ *
+ * Setting @accept_focus to %FALSE hints the desktop environment that the
+ * window doesn't want to receive input focus.
+ *
+ * On X, it is the responsibility of the window manager to interpret this
+ * hint. ICCCM-compliant window manager usually respect it.
+ *
+ * Since: 2.4
+ **/
+void
+gdk_window_set_accept_focus (GdkWindow *window,
+ gboolean accept_focus)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_accept_focus (window, accept_focus);
+}
+
+/**
+ * gdk_window_set_focus_on_map:
+ * @window: a toplevel #GdkWindow
+ * @focus_on_map: %TRUE if the window should receive input focus when mapped
+ *
+ * Setting @focus_on_map to %FALSE hints the desktop environment that the
+ * window doesn't want to receive input focus when it is mapped.
+ * focus_on_map should be turned off for windows that aren't triggered
+ * interactively (such as popups from network activity).
+ *
+ * On X, it is the responsibility of the window manager to interpret
+ * this hint. Window managers following the freedesktop.org window
+ * manager extension specification should respect it.
+ *
+ * Since: 2.6
+ **/
+void
+gdk_window_set_focus_on_map (GdkWindow *window,
+ gboolean focus_on_map)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_focus_on_map (window, focus_on_map);
+}
+
+/**
+ * gdk_window_set_icon_list:
+ * @window: The #GdkWindow toplevel window to set the icon of.
+ * @pixbufs: (transfer none) (element-type GdkPixbuf):
+ * A list of pixbufs, of different sizes.
+ *
+ * Sets a list of icons for the window. One of these will be used
+ * to represent the window when it has been iconified. The icon is
+ * usually shown in an icon box or some sort of task bar. Which icon
+ * size is shown depends on the window manager. The window manager
+ * can scale the icon but setting several size icons can give better
+ * image quality since the window manager may only need to scale the
+ * icon by a small amount or not at all.
+ *
+ **/
+void
+gdk_window_set_icon_list (GdkWindow *window,
+ GList *pixbufs)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_icon_list (window, pixbufs);
+}
+
+/**
+ * gdk_window_set_icon_name:
+ * @window: a toplevel #GdkWindow
+ * @name: name of window while iconified (minimized)
+ *
+ * Windows may have a name used while minimized, distinct from the
+ * name they display in their titlebar. Most of the time this is a bad
+ * idea from a user interface standpoint. But you can set such a name
+ * with this function, if you like.
+ *
+ * After calling this with a non-%NULL @name, calls to gdk_window_set_title()
+ * will not update the icon title.
+ *
+ * Using %NULL for @name unsets the icon title; further calls to
+ * gdk_window_set_title() will again update the icon title as well.
+ **/
+void
+gdk_window_set_icon_name (GdkWindow *window,
+ const gchar *name)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_icon_name (window, name);
+}
+
+/**
+ * gdk_window_iconify:
+ * @window: a toplevel #GdkWindow
+ *
+ * Asks to iconify (minimize) @window. The window manager may choose
+ * to ignore the request, but normally will honor it. Using
+ * gtk_window_iconify() is preferred, if you have a #GtkWindow widget.
+ *
+ * This function only makes sense when @window is a toplevel window.
+ *
+ **/
+void
+gdk_window_iconify (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->iconify (window);
+}
+
+/**
+ * gdk_window_deiconify:
+ * @window: a toplevel #GdkWindow
+ *
+ * Attempt to deiconify (unminimize) @window. On X11 the window manager may
+ * choose to ignore the request to deiconify. When using GTK+,
+ * use gtk_window_deiconify() instead of the #GdkWindow variant. Or better yet,
+ * you probably want to use gtk_window_present(), which raises the window, focuses it,
+ * unminimizes it, and puts it on the current desktop.
+ *
+ **/
+void
+gdk_window_deiconify (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->deiconify (window);
+}
+
+/**
+ * gdk_window_stick:
+ * @window: a toplevel #GdkWindow
+ *
+ * "Pins" a window such that it's on all workspaces and does not scroll
+ * with viewports, for window managers that have scrollable viewports.
+ * (When using #GtkWindow, gtk_window_stick() may be more useful.)
+ *
+ * On the X11 platform, this function depends on window manager
+ * support, so may have no effect with many window managers. However,
+ * GDK will do the best it can to convince the window manager to stick
+ * the window. For window managers that don't support this operation,
+ * there's nothing you can do to force it to happen.
+ *
+ **/
+void
+gdk_window_stick (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->stick (window);
+}
+
+/**
+ * gdk_window_unstick:
+ * @window: a toplevel #GdkWindow
+ *
+ * Reverse operation for gdk_window_stick(); see gdk_window_stick(),
+ * and gtk_window_unstick().
+ *
+ **/
+void
+gdk_window_unstick (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->unstick (window);
+}
+
+/**
+ * gdk_window_maximize:
+ * @window: a toplevel #GdkWindow
+ *
+ * Maximizes the window. If the window was already maximized, then
+ * this function does nothing.
+ *
+ * On X11, asks the window manager to maximize @window, if the window
+ * manager supports this operation. Not all window managers support
+ * this, and some deliberately ignore it or don't have a concept of
+ * "maximized"; so you can't rely on the maximization actually
+ * happening. But it will happen with most standard window managers,
+ * and GDK makes a best effort to get it to happen.
+ *
+ * On Windows, reliably maximizes the window.
+ *
+ **/
+void
+gdk_window_maximize (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->maximize (window);
+}
+
+/**
+ * gdk_window_unmaximize:
+ * @window: a toplevel #GdkWindow
+ *
+ * Unmaximizes the window. If the window wasn't maximized, then this
+ * function does nothing.
+ *
+ * On X11, asks the window manager to unmaximize @window, if the
+ * window manager supports this operation. Not all window managers
+ * support this, and some deliberately ignore it or don't have a
+ * concept of "maximized"; so you can't rely on the unmaximization
+ * actually happening. But it will happen with most standard window
+ * managers, and GDK makes a best effort to get it to happen.
+ *
+ * On Windows, reliably unmaximizes the window.
+ *
+ **/
+void
+gdk_window_unmaximize (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->unmaximize (window);
+}
+
+/**
+ * gdk_window_fullscreen:
+ * @window: a toplevel #GdkWindow
+ *
+ * Moves the window into fullscreen mode. This means the
+ * window covers the entire screen and is above any panels
+ * or task bars.
+ *
+ * If the window was already fullscreen, then this function does nothing.
+ *
+ * On X11, asks the window manager to put @window in a fullscreen
+ * state, if the window manager supports this operation. Not all
+ * window managers support this, and some deliberately ignore it or
+ * don't have a concept of "fullscreen"; so you can't rely on the
+ * fullscreenification actually happening. But it will happen with
+ * most standard window managers, and GDK makes a best effort to get
+ * it to happen.
+ *
+ * Since: 2.2
+ **/
+void
+gdk_window_fullscreen (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->fullscreen (window);
+}
+
+/**
+ * gdk_window_unfullscreen:
+ * @window: a toplevel #GdkWindow
+ *
+ * Moves the window out of fullscreen mode. If the window was not
+ * fullscreen, does nothing.
+ *
+ * On X11, asks the window manager to move @window out of the fullscreen
+ * state, if the window manager supports this operation. Not all
+ * window managers support this, and some deliberately ignore it or
+ * don't have a concept of "fullscreen"; so you can't rely on the
+ * unfullscreenification actually happening. But it will happen with
+ * most standard window managers, and GDK makes a best effort to get
+ * it to happen.
+ *
+ * Since: 2.2
+ **/
+void
+gdk_window_unfullscreen (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->unfullscreen (window);
+}
+
+/**
+ * gdk_window_set_keep_above:
+ * @window: a toplevel #GdkWindow
+ * @setting: whether to keep @window above other windows
+ *
+ * Set if @window must be kept above other windows. If the
+ * window was already above, then this function does nothing.
+ *
+ * On X11, asks the window manager to keep @window above, if the window
+ * manager supports this operation. Not all window managers support
+ * this, and some deliberately ignore it or don't have a concept of
+ * "keep above"; so you can't rely on the window being kept above.
+ * But it will happen with most standard window managers,
+ * and GDK makes a best effort to get it to happen.
+ *
+ * Since: 2.4
+ **/
+void
+gdk_window_set_keep_above (GdkWindow *window,
+ gboolean setting)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_keep_above (window, setting);
+}
+
+/**
+ * gdk_window_set_keep_below:
+ * @window: a toplevel #GdkWindow
+ * @setting: whether to keep @window below other windows
+ *
+ * Set if @window must be kept below other windows. If the
+ * window was already below, then this function does nothing.
+ *
+ * On X11, asks the window manager to keep @window below, if the window
+ * manager supports this operation. Not all window managers support
+ * this, and some deliberately ignore it or don't have a concept of
+ * "keep below"; so you can't rely on the window being kept below.
+ * But it will happen with most standard window managers,
+ * and GDK makes a best effort to get it to happen.
+ *
+ * Since: 2.4
+ **/
+void
+gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_keep_below (window, setting);
+}
+
+/**
+ * gdk_window_get_group:
+ * @window: a toplevel #GdkWindow
+ *
+ * Returns the group leader window for @window. See gdk_window_set_group().
+ *
+ * Return value: (transfer none): the group leader window for @window
+ *
+ * Since: 2.4
+ **/
+GdkWindow *
+gdk_window_get_group (GdkWindow *window)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_group (window);
+}
+
+/**
+ * gdk_window_set_group:
+ * @window: a toplevel #GdkWindow
+ * @leader: group leader window, or %NULL to restore the default group leader window
+ *
+ * Sets the group leader window for @window. By default,
+ * GDK sets the group leader for all toplevel windows
+ * to a global window implicitly created by GDK. With this function
+ * you can override this default.
+ *
+ * The group leader window allows the window manager to distinguish
+ * all windows that belong to a single application. It may for example
+ * allow users to minimize/unminimize all windows belonging to an
+ * application at once. You should only set a non-default group window
+ * if your application pretends to be multiple applications.
+ **/
+void
+gdk_window_set_group (GdkWindow *window,
+ GdkWindow *leader)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_group (window, leader);
+}
+
+/**
+ * gdk_window_set_decorations:
+ * @window: a toplevel #GdkWindow
+ * @decorations: decoration hint mask
+ *
+ * "Decorations" are the features the window manager adds to a toplevel #GdkWindow.
+ * This function sets the traditional Motif window manager hints that tell the
+ * window manager which decorations you would like your window to have.
+ * Usually you should use gtk_window_set_decorated() on a #GtkWindow instead of
+ * using the GDK function directly.
+ *
+ * The @decorations argument is the logical OR of the fields in
+ * the #GdkWMDecoration enumeration. If #GDK_DECOR_ALL is included in the
+ * mask, the other bits indicate which decorations should be turned off.
+ * If #GDK_DECOR_ALL is not included, then the other bits indicate
+ * which decorations should be turned on.
+ *
+ * Most window managers honor a decorations hint of 0 to disable all decorations,
+ * but very few honor all possible combinations of bits.
+ *
+ **/
+void
+gdk_window_set_decorations (GdkWindow *window,
+ GdkWMDecoration decorations)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_decorations (window, decorations);
+}
+
+/**
+ * gdk_window_get_decorations:
+ * @window: The toplevel #GdkWindow to get the decorations from
+ * @decorations: The window decorations will be written here
+ *
+ * Returns the decorations set on the GdkWindow with
+ * gdk_window_set_decorations().
+ *
+ * Returns: %TRUE if the window has decorations set, %FALSE otherwise.
+ **/
+gboolean
+gdk_window_get_decorations(GdkWindow *window,
+ GdkWMDecoration *decorations)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_decorations (window, decorations);
+}
+
+/**
+ * gdk_window_set_functions:
+ * @window: a toplevel #GdkWindow
+ * @functions: bitmask of operations to allow on @window
+ *
+ * Sets hints about the window management functions to make available
+ * via buttons on the window frame.
+ *
+ * On the X backend, this function sets the traditional Motif window
+ * manager hint for this purpose. However, few window managers do
+ * anything reliable or interesting with this hint. Many ignore it
+ * entirely.
+ *
+ * The @functions argument is the logical OR of values from the
+ * #GdkWMFunction enumeration. If the bitmask includes #GDK_FUNC_ALL,
+ * then the other bits indicate which functions to disable; if
+ * it doesn't include #GDK_FUNC_ALL, it indicates which functions to
+ * enable.
+ *
+ **/
+void
+gdk_window_set_functions (GdkWindow *window,
+ GdkWMFunction functions)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_functions (window, functions);
+}
+
+/**
+ * gdk_window_begin_resize_drag:
+ * @window: a toplevel #GdkWindow
+ * @edge: the edge or corner from which the drag is started
+ * @button: the button being used to drag
+ * @root_x: root window X coordinate of mouse click that began the drag
+ * @root_y: root window Y coordinate of mouse click that began the drag
+ * @timestamp: timestamp of mouse click that began the drag (use gdk_event_get_time())
+ *
+ * Begins a window resize operation (for a toplevel window).
+ * You might use this function to implement a "window resize grip," for
+ * example; in fact #GtkStatusbar uses it. The function works best
+ * with window managers that support the Extended Window Manager Hints , but has a
+ * fallback implementation for other window managers.
+ *
+ **/
+void
+gdk_window_begin_resize_drag (GdkWindow *window,
+ GdkWindowEdge edge,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->begin_resize_drag (window, edge, button, root_x, root_y, timestamp);
+}
+
+/**
+ * gdk_window_begin_move_drag:
+ * @window: a toplevel #GdkWindow
+ * @button: the button being used to drag
+ * @root_x: root window X coordinate of mouse click that began the drag
+ * @root_y: root window Y coordinate of mouse click that began the drag
+ * @timestamp: timestamp of mouse click that began the drag
+ *
+ * Begins a window move operation (for a toplevel window). You might
+ * use this function to implement a "window move grip," for
+ * example. The function works best with window managers that support
+ * the Extended
+ * Window Manager Hints , but has a fallback implementation for
+ * other window managers.
+ *
+ **/
+void
+gdk_window_begin_move_drag (GdkWindow *window,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->begin_move_drag (window, button, root_x, root_y, timestamp);
+}
+
+/**
+ * gdk_window_enable_synchronized_configure:
+ * @window: a toplevel #GdkWindow
+ *
+ * Indicates that the application will cooperate with the window
+ * system in synchronizing the window repaint with the window
+ * manager during resizing operations. After an application calls
+ * this function, it must call gdk_window_configure_finished() every
+ * time it has finished all processing associated with a set of
+ * Configure events. Toplevel GTK+ windows automatically use this
+ * protocol.
+ *
+ * On X, calling this function makes @window participate in the
+ * _NET_WM_SYNC_REQUEST window manager protocol.
+ *
+ * Since: 2.6
+ **/
+void
+gdk_window_enable_synchronized_configure (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->enable_synchronized_configure (window);
+}
+
+/**
+ * gdk_window_configure_finished:
+ * @window: a toplevel #GdkWindow
+ *
+ * Signal to the window system that the application has finished
+ * handling Configure events it has received. Window Managers can
+ * use this to better synchronize the frame repaint with the
+ * application. GTK+ applications will automatically call this
+ * function when appropriate.
+ *
+ * This function can only be called if gdk_window_enable_synchronized_configure()
+ * was called previously.
+ *
+ * Since: 2.6
+ **/
+void
+gdk_window_configure_finished (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->configure_finished (window);
+}
+
+/**
+ * gdk_window_set_opacity:
+ * @window: a top-level #GdkWindow
+ * @opacity: opacity
+ *
+ * Request the windowing system to make @window partially transparent,
+ * with opacity 0 being fully transparent and 1 fully opaque. (Values
+ * of the opacity parameter are clamped to the [0,1] range.)
+ *
+ * On X11, this works only on X screens with a compositing manager
+ * running.
+ *
+ * For setting up per-pixel alpha, see gdk_screen_get_rgba_visual().
+ * For making non-toplevel windows translucent, see
+ * gdk_window_set_composited().
+ *
+ * Since: 2.12
+ */
+void
+gdk_window_set_opacity (GdkWindow *window,
+ gdouble opacity)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_opacity (window, opacity);
+}
+
+/* This function is called when the XWindow is really gone.
+ */
+void
+gdk_window_destroy_notify (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->destroy_notify (window);
+}
+
+/**
+ * gdk_window_register_dnd:
+ * @window: a #GdkWindow.
+ *
+ * Registers a window as a potential drop destination.
+ */
+void
+gdk_window_register_dnd (GdkWindow *window)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->register_dnd (window);
+}
+
+/**
+ * gdk_drag_begin:
+ * @window: the source window for this drag.
+ * @targets: (transfer none) (element-type GdkAtom): the offered targets,
+ * as list of #GdkAtoms
+ *
+ * Starts a drag and creates a new drag context for it.
+ * This function assumes that the drag is controlled by the
+ * client pointer device, use gdk_drag_begin_for_device() to
+ * begin a drag with a different device.
+ *
+ * This function is called by the drag source.
+ *
+ * Return value: (transfer full): a newly created #GdkDragContext
+ */
+GdkDragContext *
+gdk_drag_begin (GdkWindow *window,
+ GList *targets)
+{
+ GdkDeviceManager *device_manager;
+ GdkDevice *device;
+
+ device_manager = gdk_display_get_device_manager (gdk_window_get_display (window));
+ device = gdk_device_manager_get_client_pointer (device_manager);
+
+ return gdk_drag_begin_for_device (window, device, targets);
+}
+
+/**
+ * gdk_drag_begin_for_device:
+ * @window: the source window for this drag
+ * @device: the device that controls this drag
+ * @targets: (transfer none) (element-type GdkAtom): the offered targets,
+ * as list of #GdkAtoms
+ *
+ * Starts a drag and creates a new drag context for it.
+ *
+ * This function is called by the drag source.
+ *
+ * Return value: (transfer full): a newly created #GdkDragContext
+ */
+GdkDragContext *
+gdk_drag_begin_for_device (GdkWindow *window,
+ GdkDevice *device,
+ GList *targets)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->drag_begin (window, device, targets);
+}
+
+/**
+ * gdk_test_render_sync:
+ * @window: a mapped #GdkWindow
+ *
+ * Retrieves a pixel from @window to force the windowing
+ * system to carry out any pending rendering commands.
+ *
+ * This function is intended to be used to synchronize with rendering
+ * pipelines, to benchmark windowing system rendering operations.
+ *
+ * Since: 2.14
+ **/
+void
+gdk_test_render_sync (GdkWindow *window)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->sync_rendering (window);
+}
+
+/**
+ * gdk_test_simulate_key:
+ * @window: a #GdkWindow to simulate a key event for
+ * @x: x coordinate within @window for the key event
+ * @y: y coordinate within @window for the key event
+ * @keyval: A GDK keyboard value
+ * @modifiers: Keyboard modifiers the event is setup with
+ * @key_pressrelease: either %GDK_KEY_PRESS or %GDK_KEY_RELEASE
+ *
+ * This function is intended to be used in GTK+ test programs.
+ * If (@x,@y) are > (-1,-1), it will warp the mouse pointer to
+ * the given (@x,@y) coordinates within @window and simulate a
+ * key press or release event.
+ *
+ * When the mouse pointer is warped to the target location, use
+ * of this function outside of test programs that run in their
+ * own virtual windowing system (e.g. Xvfb) is not recommended.
+ * If (@x,@y) are passed as (-1,-1), the mouse pointer will not
+ * be warped and @window origin will be used as mouse pointer
+ * location for the event.
+ *
+ * Also, gdk_test_simulate_key() is a fairly low level function,
+ * for most testing purposes, gtk_test_widget_send_key() is the
+ * right function to call which will generate a key press event
+ * followed by its accompanying key release event.
+ *
+ * Returns: whether all actions necessary for a key event simulation
+ * were carried out successfully
+ *
+ * Since: 2.14
+ */
+gboolean
+gdk_test_simulate_key (GdkWindow *window,
+ gint x,
+ gint y,
+ guint keyval,
+ GdkModifierType modifiers,
+ GdkEventType key_pressrelease)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)
+ ->simulate_key (window, x, y, keyval, modifiers, key_pressrelease);
+}
+
+/**
+ * gdk_test_simulate_button:
+ * @window: a #GdkWindow to simulate a button event for
+ * @x: x coordinate within @window for the button event
+ * @y: y coordinate within @window for the button event
+ * @button: Number of the pointer button for the event, usually 1, 2 or 3
+ * @modifiers: Keyboard modifiers the event is setup with
+ * @button_pressrelease: either %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE
+ *
+ * This function is intended to be used in GTK+ test programs.
+ * It will warp the mouse pointer to the given (@x,@y) coordinates
+ * within @window and simulate a button press or release event.
+ * Because the mouse pointer needs to be warped to the target
+ * location, use of this function outside of test programs that
+ * run in their own virtual windowing system (e.g. Xvfb) is not
+ * recommended.
+ *
+* Also, gdk_test_simulate_button() is a fairly low level function,
+ * for most testing purposes, gtk_test_widget_click() is the right
+ * function to call which will generate a button press event followed
+ * by its accompanying button release event.
+ *
+ * Returns: whether all actions necessary for a button event simulation
+ * were carried out successfully
+ *
+ * Since: 2.14
+ */
+gboolean
+gdk_test_simulate_button (GdkWindow *window,
+ gint x,
+ gint y,
+ guint button, /*1..3*/
+ GdkModifierType modifiers,
+ GdkEventType button_pressrelease)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)
+ ->simulate_button (window, x, y, button, modifiers, button_pressrelease);
+}
+
+/**
+ * gdk_property_get:
+ * @window: a #GdkWindow
+ * @property: the property to retrieve
+ * @type: the desired property type, or %GDK_NONE, if any type of data
+ * is acceptable. If this does not match the actual
+ * type, then @actual_format and @actual_length will
+ * be filled in, a warning will be printed to stderr
+ * and no data will be returned.
+ * @offset: the offset into the property at which to begin
+ * retrieving data, in 4 byte units.
+ * @length: the length of the data to retrieve in bytes. Data is
+ * considered to be retrieved in 4 byte chunks, so @length
+ * will be rounded up to the next highest 4 byte boundary
+ * (so be careful not to pass a value that might overflow
+ * when rounded up).
+ * @pdelete: if %TRUE, delete the property after retrieving the
+ * data.
+ * @actual_property_type: location to store the actual type of
+* the property.
+ * @actual_format: location to store the actual return format of the
+ * data; either 8, 16 or 32 bits.
+ * @actual_length: location to store the length of the retrieved data, in
+ * bytes. Data returned in the 32 bit format is stored
+ * in a long variable, so the actual number of 32 bit
+ * elements should be be calculated via
+ * @actual_length / sizeof(glong) to ensure portability to
+ * 64 bit systems.
+ * @data: location to store a pointer to the data. The retrieved
+ * data should be freed with g_free() when you are finished
+ * using it.
+ *
+ * Retrieves a portion of the contents of a property. If the
+ * property does not exist, then the function returns %FALSE,
+ * and %GDK_NONE will be stored in @actual_property_type.
+ *
+ *
+ *
+ * The XGetWindowProperty() function that gdk_property_get()
+ * uses has a very confusing and complicated set of semantics.
+ * uses has a very confusing and complicated set of semantics.
+ * Unfortunately, gdk_property_get() makes the situation
+ * worse instead of better (the semantics should be considered
+ * undefined), and also prints warnings to stderr in cases where it
+ * should return a useful error to the program. You are advised to use
+ * XGetWindowProperty() directly until a replacement function for
+ * gdk_property_get()
+ * is provided.
+ *
+ *
+ *
+ * Returns: %TRUE if data was successfully received and stored
+ * in @data, otherwise %FALSE.
+ */
+gboolean
+gdk_property_get (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gulong offset,
+ gulong length,
+ gint pdelete,
+ GdkAtom *actual_property_type,
+ gint *actual_format_type,
+ gint *actual_length,
+ guchar **data)
+{
+ return GDK_WINDOW_IMPL_GET_CLASS (window->impl)
+ ->get_property (window, property, type, offset, length, pdelete,
+ actual_property_type, actual_format_type,
+ actual_length, data);
+}
+
+/**
+ * gdk_property_change:
+ * @window: a #GdkWindow
+ * @property: the property to change
+ * @type: the new type for the property. If @mode is
+ * %GDK_PROP_MODE_PREPEND or %GDK_PROP_MODE_APPEND, then this
+ * must match the existing type or an error will occur.
+ * @format: the new format for the property. If @mode is
+ * %GDK_PROP_MODE_PREPEND or %GDK_PROP_MODE_APPEND, then this
+ * must match the existing format or an error will occur.
+ * @mode: a value describing how the new data is to be combined
+ * with the current data.
+ * @data: the data (a guchar *
+ * gushort * , or gulong * ,
+ * depending on @format), cast to a guchar * .
+ * @nelements: the number of elements of size determined by the format,
+ * contained in @data.
+ *
+ * Changes the contents of a property on a window.
+ */
+void
+gdk_property_change (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gint format,
+ GdkPropMode mode,
+ const guchar *data,
+ gint nelements)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)
+ ->change_property (window, property, type, format, mode, data, nelements);
+}
+
+/**
+ * gdk_property_delete:
+ * @window: a #GdkWindow
+ * @property: the property to delete
+ *
+ * Deletes a property from a window.
+ */
+void
+gdk_property_delete (GdkWindow *window,
+ GdkAtom property)
+{
+ GDK_WINDOW_IMPL_GET_CLASS (window->impl)->delete_property (window, property);
+}
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 936e69af20..1cac906945 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -38,7 +38,6 @@ G_BEGIN_DECLS
typedef struct _GdkGeometry GdkGeometry;
typedef struct _GdkWindowAttr GdkWindowAttr;
-typedef struct _GdkPointerHooks GdkPointerHooks;
typedef struct _GdkWindowRedirect GdkWindowRedirect;
/**
@@ -446,35 +445,6 @@ struct _GdkGeometry
GdkGravity win_gravity;
};
-/**
- * GdkPointerHooks:
- * @get_pointer: Obtains the current pointer position and modifier state.
- * The position is given in coordinates relative to the window containing
- * the pointer, which is returned in @window.
- * @window_at_pointer: Obtains the window underneath the mouse pointer,
- * returning the location of that window in @win_x, @win_y. Returns %NULL
- * if the window under the mouse pointer is not known to GDK (for example,
- * belongs to another application).
- *
- * A table of pointers to functions for getting quantities related to
- * the current pointer position. GDK has one global table of this type,
- * which can be set using gdk_set_pointer_hooks().
- *
- * This is only useful for such low-level tools as an event recorder.
- * Applications should never have any reason to use this facility
- */
-struct _GdkPointerHooks
-{
- GdkWindow* (*get_pointer) (GdkWindow *window,
- gint *x,
- gint *y,
- GdkModifierType *mask);
- GdkWindow* (*window_at_pointer) (GdkScreen *screen, /* unused */
- gint *win_x,
- gint *win_y);
-};
-
-typedef struct _GdkWindowObject GdkWindowObject;
typedef struct _GdkWindowClass GdkWindowClass;
#define GDK_TYPE_WINDOW (gdk_window_get_type ())
@@ -643,18 +613,7 @@ GdkWindowState gdk_window_get_state (GdkWindow *window);
* window gravity on all children.
*/
gboolean gdk_window_set_static_gravities (GdkWindow *window,
- gboolean use_static);
-
-/* Functions to create/lookup windows from their native equivalents */
-#ifndef GDK_MULTIHEAD_SAFE
-GdkWindow* gdk_window_foreign_new (GdkNativeWindow anid);
-GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
-#endif
-GdkWindow *gdk_window_foreign_new_for_display (GdkDisplay *display,
- GdkNativeWindow anid);
-GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
- GdkNativeWindow anid);
-
+ gboolean use_static);
/* GdkWindow */
@@ -677,7 +636,6 @@ void gdk_window_set_urgency_hint (GdkWindow *window,
void gdk_window_set_geometry_hints (GdkWindow *window,
const GdkGeometry *geometry,
GdkWindowHints geom_mask);
-void gdk_set_sm_client_id (const gchar *sm_client_id);
cairo_region_t *gdk_window_get_clip_region (GdkWindow *window);
cairo_region_t *gdk_window_get_visible_region(GdkWindow *window);
@@ -720,8 +678,7 @@ void gdk_window_get_geometry (GdkWindow *window,
gint *x,
gint *y,
gint *width,
- gint *height,
- gint *depth);
+ gint *height);
int gdk_window_get_width (GdkWindow *window);
int gdk_window_get_height (GdkWindow *window);
void gdk_window_get_position (GdkWindow *window,
@@ -780,6 +737,12 @@ void gdk_window_set_device_events (GdkWindow *window,
GdkEventMask gdk_window_get_device_events (GdkWindow *window,
GdkDevice *device);
+void gdk_window_set_source_events (GdkWindow *window,
+ GdkInputSource source,
+ GdkEventMask event_mask);
+GdkEventMask gdk_window_get_source_events (GdkWindow *window,
+ GdkInputSource source);
+
void gdk_window_set_icon_list (GdkWindow *window,
GList *pixbufs);
void gdk_window_set_icon_name (GdkWindow *window,
@@ -880,10 +843,6 @@ void gdk_window_constrain_size (GdkGeometry *geometry,
void gdk_window_enable_synchronized_configure (GdkWindow *window);
void gdk_window_configure_finished (GdkWindow *window);
-#if !defined (GDK_MULTIHEAD_SAFE) && !defined (GDK_MULTIDEVICE_SAFE)
-GdkPointerHooks *gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
-#endif /* !GDK_MULTIHEAD_SAFE && !GDK_MULTIDEVICE_SAFE */
-
GdkWindow *gdk_get_default_root_window (void);
/* Offscreen redirection */
diff --git a/gdk/gdkwindowimpl.h b/gdk/gdkwindowimpl.h
index 0332a31b71..fd9add2de0 100644
--- a/gdk/gdkwindowimpl.h
+++ b/gdk/gdkwindowimpl.h
@@ -28,6 +28,7 @@
#define __GDK_WINDOW_IMPL_H__
#include
+#include
G_BEGIN_DECLS
@@ -91,8 +92,7 @@ struct _GdkWindowImplClass
gint *x,
gint *y,
gint *width,
- gint *height,
- gint *depth);
+ gint *height);
gint (* get_root_coords) (GdkWindow *window,
gint x,
gint y,
@@ -141,19 +141,27 @@ struct _GdkWindowImplClass
*
* window: The window being destroyed
* recursing: If TRUE, then this is being called because a parent
- * was destroyed. This generally means that the call to the windowing system
- * to destroy the window can be omitted, since it will be destroyed as a result
- * of the parent being destroyed. Unless @foreign_destroy
- *
- * foreign_destroy: If TRUE, the window or a parent was destroyed by some external
- * agency. The window has already been destroyed and no windowing
- * system calls should be made. (This may never happen for some
- * windowing systems.)
+ * was destroyed. This generally means that the call to the windowing
+ * system to destroy the window can be omitted, since it will be
+ * destroyed as a result of the parent being destroyed.
+ * Unless @foreign_destroy
+ * foreign_destroy: If TRUE, the window or a parent was destroyed by some
+ * external agency. The window has already been destroyed and no
+ * windowing system calls should be made. (This may never happen
+ * for some windowing systems.)
*/
void (* destroy) (GdkWindow *window,
gboolean recursing,
gboolean foreign_destroy);
+
+ /* Called when gdk_window_destroy() is called on a foreign window
+ * or an ancestor of the foreign window. It should generally reparent
+ * the window out of it's current heirarchy, hide it, and then
+ * send a message to the owner requesting that the window be destroyed.
+ */
+ void (*destroy_foreign) (GdkWindow *window);
+
cairo_surface_t * (* resize_cairo_surface) (GdkWindow *window,
cairo_surface_t *surface,
gint width,
@@ -161,6 +169,126 @@ struct _GdkWindowImplClass
/* optional */
gboolean (* beep) (GdkWindow *window);
+
+ void (* focus) (GdkWindow *window,
+ guint32 timestamp);
+ void (* set_type_hint) (GdkWindow *window,
+ GdkWindowTypeHint hint);
+ GdkWindowTypeHint (* get_type_hint) (GdkWindow *window);
+ void (* set_modal_hint) (GdkWindow *window,
+ gboolean modal);
+ void (* set_skip_taskbar_hint) (GdkWindow *window,
+ gboolean skips_taskbar);
+ void (* set_skip_pager_hint) (GdkWindow *window,
+ gboolean skips_pager);
+ void (* set_urgency_hint) (GdkWindow *window,
+ gboolean urgent);
+ void (* set_geometry_hints) (GdkWindow *window,
+ const GdkGeometry *geometry,
+ GdkWindowHints geom_mask);
+ void (* set_title) (GdkWindow *window,
+ const gchar *title);
+ void (* set_role) (GdkWindow *window,
+ const gchar *role);
+ void (* set_startup_id) (GdkWindow *window,
+ const gchar *startup_id);
+ void (* set_transient_for) (GdkWindow *window,
+ GdkWindow *parent);
+ void (* get_root_origin) (GdkWindow *window,
+ gint *x,
+ gint *y);
+ void (* get_frame_extents) (GdkWindow *window,
+ GdkRectangle *rect);
+ void (* set_override_redirect) (GdkWindow *window,
+ gboolean override_redirect);
+ void (* set_accept_focus) (GdkWindow *window,
+ gboolean accept_focus);
+ void (* set_focus_on_map) (GdkWindow *window,
+ gboolean focus_on_map);
+ void (* set_icon_list) (GdkWindow *window,
+ GList *pixbufs);
+ void (* set_icon_name) (GdkWindow *window,
+ const gchar *name);
+ void (* iconify) (GdkWindow *window);
+ void (* deiconify) (GdkWindow *window);
+ void (* stick) (GdkWindow *window);
+ void (* unstick) (GdkWindow *window);
+ void (* maximize) (GdkWindow *window);
+ void (* unmaximize) (GdkWindow *window);
+ void (* fullscreen) (GdkWindow *window);
+ void (* unfullscreen) (GdkWindow *window);
+ void (* set_keep_above) (GdkWindow *window,
+ gboolean setting);
+ void (* set_keep_below) (GdkWindow *window,
+ gboolean setting);
+ GdkWindow * (* get_group) (GdkWindow *window);
+ void (* set_group) (GdkWindow *window,
+ GdkWindow *leader);
+ void (* set_decorations) (GdkWindow *window,
+ GdkWMDecoration decorations);
+ gboolean (* get_decorations) (GdkWindow *window,
+ GdkWMDecoration *decorations);
+ void (* set_functions) (GdkWindow *window,
+ GdkWMFunction functions);
+ void (* begin_resize_drag) (GdkWindow *window,
+ GdkWindowEdge edge,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp);
+ void (* begin_move_drag) (GdkWindow *window,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp);
+ void (* enable_synchronized_configure) (GdkWindow *window);
+ void (* configure_finished) (GdkWindow *window);
+ void (* set_opacity) (GdkWindow *window,
+ gdouble opacity);
+ void (* set_composited) (GdkWindow *window,
+ gboolean composited);
+ void (* destroy_notify) (GdkWindow *window);
+ void (* register_dnd) (GdkWindow *window);
+ GdkDragContext * (*drag_begin) (GdkWindow *window,
+ GdkDevice *device,
+ GList *targets);
+
+ void (*process_updates_recurse) (GdkWindow *window,
+ cairo_region_t *region);
+
+ void (*sync_rendering) (GdkWindow *window);
+ gboolean (*simulate_key) (GdkWindow *window,
+ gint x,
+ gint y,
+ guint keyval,
+ GdkModifierType modifiers,
+ GdkEventType event_type);
+ gboolean (*simulate_button) (GdkWindow *window,
+ gint x,
+ gint y,
+ guint button,
+ GdkModifierType modifiers,
+ GdkEventType event_type);
+
+ gboolean (*get_property) (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gulong offset,
+ gulong length,
+ gint pdelete,
+ GdkAtom *actual_type,
+ gint *actual_format,
+ gint *actual_length,
+ guchar **data);
+ void (*change_property) (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gint format,
+ GdkPropMode mode,
+ const guchar *data,
+ gint n_elements);
+ void (*delete_property) (GdkWindow *window,
+ GdkAtom property);
};
/* Interface Functions */
diff --git a/gdk/x11/gdkglobals-x11.c b/gdk/gdkx.h
similarity index 78%
rename from gdk/x11/gdkglobals-x11.c
rename to gdk/gdkx.h
index de616092f0..3f474b43c2 100644
--- a/gdk/x11/gdkglobals-x11.c
+++ b/gdk/gdkx.h
@@ -21,17 +21,13 @@
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
-#include "config.h"
+/* This is a kludge to be able to include gdk/gdkx.h from inside the
+ * GTK source tree.
+ * Also, this hopefully serves as a warning to new backends to put
+ * their header into the backend dir from the start.
+ */
-#include "gdktypes.h"
-#include "gdkprivate-x11.h"
-
-#include
-
-
-gboolean _gdk_use_xshm = TRUE; /* used as a cmd line arg */
-GdkAtom _gdk_selection_property;
-gboolean _gdk_synchronize = FALSE;
+#include
diff --git a/gdk/makefile.msc b/gdk/makefile.msc
index 49c5978610..0d88d1e417 100644
--- a/gdk/makefile.msc
+++ b/gdk/makefile.msc
@@ -19,8 +19,7 @@ WTKIT = $(TOP)\wtkit126
# Nothing much configurable below
# overwrite version?
-GTK_VER=2.0
-GDK_PIXBUF_VER=$(GTK_VER)
+GTK_VER=3.0
!IFNDEF PERL
PERL = perl
@@ -28,20 +27,19 @@ PERL = perl
INCLUDES = -FImsvc_recommended_pragmas.h \
-I . -I .. \
- $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CAIRO_CFLAGS) -I ../gdk-pixbuf \
+ $(GLIB_CFLAGS) $(PANGO_CFLAGS) $(CAIRO_CFLAGS) $(GDK_PIXBUF_CFLAGS) \
DEFINES = \
- -DHAVE_CONFIG_H -DGDK_ENABLE_BROKEN \
+ -DHAVE_CONFIG_H \
-DGDK_VERSION=\"$(GTK_VER)\" \
-DG_LOG_DOMAIN=\"Gdk\" \
-DGDK_COMPILATION -DG_LOG_DOMAIN=\"Gdk\"
EXTRALIBS = \
$(WTKIT)\lib\i386\wntab32x.lib \
- $(GLIB_LIBS) \
- ..\gdk-pixbuf\gdk_pixbuf-$(GDK_PIXBUF_VER).lib \
- $(PANGOWIN32_LIBS) $(PANGOCAIRO_LIBS) $(INTL_LIBS) $(CAIRO_LIBS) \
- $(PANGOCAIRO_LIBS)
+ $(GLIB_LIBS) $(GDK_PIXBUF_LIBS) \
+ $(CAIRO_LIBS) $(CAIRO_GOBJECT_LIBS) \
+ $(PANGOWIN32_LIBS) $(PANGOCAIRO_LIBS) $(INTL_LIBS)
gdk-win32-backend :
cd win32
@@ -57,8 +55,8 @@ all: \
gdkmarshalers.c \
gdk-win32-backend \
libgdk-win32-$(GTK_VER)-0.dll \
- testgdk.exe \
- gdk-win32-$(GTK_VER)s.lib \
+# testgdk.exe \
+# gdk-win32-$(GTK_VER)s.lib \
# gdk-x11-$(GTK_VER).dll \
gdk_OBJECTS = \
@@ -67,15 +65,14 @@ gdk_OBJECTS = \
gdkcairo.obj \
gdkcolor.obj \
gdkcursor.obj \
+ gdkdevice.obj \
+ gdkdevicemanager.obj \
gdkdisplay.obj \
gdkdisplaymanager.obj \
gdkdnd.obj \
- gdkdraw.obj \
gdkenumtypes.obj \
gdkevents.obj \
- gdkgc.obj \
gdkglobals.obj \
- gdkwindowimpl.obj \
gdkkeynames.obj \
gdkkeys.obj \
gdkkeyuni.obj \
@@ -83,31 +80,43 @@ gdk_OBJECTS = \
gdkoffscreenwindow.obj \
gdkpango.obj \
gdkpixbuf-drawable.obj \
- gdkpixbuf-render.obj \
gdkrectangle.obj \
+ gdkrgba.obj \
gdkscreen.obj \
gdkselection.obj \
gdkvisual.obj \
- gdkwindow.obj
+ gdkwindow.obj \
+ gdkwindowimpl.obj \
-gdk_public_h_sources = \
- gdk.h \
- gdkcolor.h \
- gdkcursor.h \
- gdkdnd.h \
- gdkdrawable.h \
- gdkevents.h \
- gdkgc.h \
- gdkkeysyms.h \
- gdkinput.h \
- gdkkeys.h \
- gdkpango.h \
- gdkpixbuf.h \
- gdkproperty.h \
- gdkselection.h \
- gdktypes.h \
- gdkvisual.h \
- gdkwindow.h \
+gdk_public_h_sources = \
+ gdk.h \
+ gdkapplaunchcontext.h \
+ gdkcairo.h \
+ gdkcolor.h \
+ gdkcursor.h \
+ gdkdevice.h \
+ gdkdevicemanager.h \
+ gdkdisplay.h \
+ gdkdisplaymanager.h \
+ gdkdnd.h \
+ gdkevents.h \
+ gdkkeys.h \
+ gdkkeysyms.h \
+ gdkkeysyms-compat.h \
+ gdkmain.h \
+ gdkpango.h \
+ gdkpixbuf.h \
+ gdkprivate.h \
+ gdkproperty.h \
+ gdkrectangle.h \
+ gdkrgba.h \
+ gdkscreen.h \
+ gdkselection.h \
+ gdktestutils.h \
+ gdkthreads.h \
+ gdktypes.h \
+ gdkvisual.h \
+ gdkwindow.h
# private marshalers
gdkmarshalers.h : gdkmarshalers.list
@@ -136,6 +145,7 @@ gdk.def: gdk.symbols
-DG_GNUC_CONST= \
gdk.symbols >> gdk.def
+# /force /verbose:lib
libgdk-win32-$(GTK_VER)-0.dll : $(gdk_OBJECTS) gdk.def win32\gdk-win32.lib
$(CC) $(CFLAGS) -LD -Fe$@ $(gdk_OBJECTS) win32\gdk-win32.lib $(EXTRALIBS) \
gdi32.lib user32.lib imm32.lib shell32.lib ole32.lib uuid.lib win32\gdk.res \
diff --git a/gdk/quartz/GdkQuartzWindow.c b/gdk/quartz/GdkQuartzNSWindow.c
similarity index 91%
rename from gdk/quartz/GdkQuartzWindow.c
rename to gdk/quartz/GdkQuartzNSWindow.c
index eb3cce8947..ee21797383 100644
--- a/gdk/quartz/GdkQuartzWindow.c
+++ b/gdk/quartz/GdkQuartzNSWindow.c
@@ -18,11 +18,12 @@
* Boston, MA 02111-1307, USA.
*/
-#import "GdkQuartzWindow.h"
-#include "gdkwindow-quartz.h"
+#import "GdkQuartzNSWindow.h"
+#include "gdkquartzwindow.h"
+#include "gdkdnd-quartz.h"
#include "gdkprivate-quartz.h"
-@implementation GdkQuartzWindow
+@implementation GdkQuartzNSWindow
-(BOOL)windowShouldClose:(id)sender
{
@@ -140,7 +141,6 @@
-(void)windowDidMove:(NSNotification *)aNotification
{
GdkWindow *window = [[self contentView] gdkWindow];
- GdkWindowObject *private = (GdkWindowObject *)window;
GdkEvent *event;
_gdk_quartz_window_update_position (window);
@@ -148,10 +148,10 @@
/* Synthesize a configure event */
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = g_object_ref (window);
- event->configure.x = private->x;
- event->configure.y = private->y;
- event->configure.width = private->width;
- event->configure.height = private->height;
+ event->configure.x = window->x;
+ event->configure.y = window->y;
+ event->configure.width = window->width;
+ event->configure.height = window->height;
_gdk_event_queue_append (gdk_display_get_default (), event);
}
@@ -160,23 +160,22 @@
{
NSRect content_rect = [self contentRectForFrameRect:[self frame]];
GdkWindow *window = [[self contentView] gdkWindow];
- GdkWindowObject *private = (GdkWindowObject *)window;
GdkEvent *event;
- private->width = content_rect.size.width;
- private->height = content_rect.size.height;
+ window->width = content_rect.size.width;
+ window->height = content_rect.size.height;
- [[self contentView] setFrame:NSMakeRect (0, 0, private->width, private->height)];
+ [[self contentView] setFrame:NSMakeRect (0, 0, window->width, window->height)];
_gdk_window_update_size (window);
/* Synthesize a configure event */
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = g_object_ref (window);
- event->configure.x = private->x;
- event->configure.y = private->y;
- event->configure.width = private->width;
- event->configure.height = private->height;
+ event->configure.x = window->x;
+ event->configure.y = window->y;
+ event->configure.width = window->width;
+ event->configure.height = window->height;
_gdk_event_queue_append (gdk_display_get_default (), event);
}
@@ -199,8 +198,7 @@
-(BOOL)canBecomeMainWindow
{
GdkWindow *window = [[self contentView] gdkWindow];
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
switch (impl->type_hint)
{
@@ -229,16 +227,15 @@
-(BOOL)canBecomeKeyWindow
{
GdkWindow *window = [[self contentView] gdkWindow];
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
- if (!private->accept_focus)
+ if (!window->accept_focus)
return NO;
/* Popup windows should not be able to get focused in the window
* manager sense, it's only handled through grabs.
*/
- if (private->window_type == GDK_WINDOW_TEMP)
+ if (window->window_type == GDK_WINDOW_TEMP)
return NO;
switch (impl->type_hint)
@@ -268,8 +265,7 @@
- (void)showAndMakeKey:(BOOL)makeKey
{
GdkWindow *window = [[self contentView] gdkWindow];
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
inShowOrHide = YES;
@@ -284,8 +280,7 @@
- (void)hide
{
GdkWindow *window = [[self contentView] gdkWindow];
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
inShowOrHide = YES;
[impl->toplevel orderOut:nil];
@@ -447,7 +442,7 @@ update_context_from_dragging_info (id sender)
{
g_assert (current_context != NULL);
- GDK_DRAG_CONTEXT_PRIVATE (current_context)->dragging_info = sender;
+ GDK_QUARTZ_DRAG_CONTEXT (current_context)->dragging_info = sender;
current_context->suggested_action = drag_operation_to_drag_action ([sender draggingSourceOperationMask]);
current_context->actions = current_context->suggested_action;
}
@@ -461,7 +456,7 @@ update_context_from_dragging_info (id sender)
if (current_context)
g_object_unref (current_context);
- current_context = gdk_drag_context_new ();
+ current_context = g_object_new (GDK_TYPE_QUARTZ_DRAG_CONTEXT, NULL);
update_context_from_dragging_info (sender);
window = [[self contentView] gdkWindow];
diff --git a/gdk/quartz/GdkQuartzWindow.h b/gdk/quartz/GdkQuartzNSWindow.h
similarity index 95%
rename from gdk/quartz/GdkQuartzWindow.h
rename to gdk/quartz/GdkQuartzNSWindow.h
index e6d1b4e155..676c48a9e6 100644
--- a/gdk/quartz/GdkQuartzWindow.h
+++ b/gdk/quartz/GdkQuartzNSWindow.h
@@ -1,4 +1,4 @@
-/* GdkQuartzWindow.h
+/* GdkQuartzNSWindow.h
*
* Copyright (C) 2005-2007 Imendio AB
*
@@ -22,7 +22,7 @@
#import
#include
-@interface GdkQuartzWindow : NSWindow {
+@interface GdkQuartzNSWindow : NSWindow {
BOOL inMove;
BOOL inShowOrHide;
diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c
index 8c6132b2ab..1b41aecd93 100644
--- a/gdk/quartz/GdkQuartzView.c
+++ b/gdk/quartz/GdkQuartzView.c
@@ -19,7 +19,7 @@
*/
#import "GdkQuartzView.h"
-#include "gdkwindow-quartz.h"
+#include "gdkquartzwindow.h"
#include "gdkprivate-quartz.h"
#include "gdkquartz.h"
@@ -68,8 +68,7 @@
-(void)drawRect:(NSRect)rect
{
GdkRectangle gdk_rect;
- GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (gdk_window->impl);
const NSRect *drawn_rects;
NSInteger count;
int i;
@@ -78,7 +77,7 @@
if (GDK_WINDOW_DESTROYED (gdk_window))
return;
- if (!(private->event_mask & GDK_EXPOSURE_MASK))
+ if (!(gdk_window->event_mask & GDK_EXPOSURE_MASK))
return;
if (NSEqualRects (rect, NSZeroRect))
@@ -127,8 +126,7 @@
*/
-(void)updateTrackingRect
{
- GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (gdk_window->impl);
NSRect rect;
if (!impl->toplevel)
diff --git a/gdk/quartz/Makefile.am b/gdk/quartz/Makefile.am
index b0a967d1e8..9b2135326e 100644
--- a/gdk/quartz/Makefile.am
+++ b/gdk/quartz/Makefile.am
@@ -1,6 +1,7 @@
include $(top_srcdir)/Makefile.decl
libgdkincludedir = $(includedir)/gtk-3.0/gdk
+libgdkquartzincludedir = $(includedir)/gtk-3.0/gdk/quartz
INCLUDES = \
-DG_LOG_DOMAIN=\"Gdk\" \
@@ -19,33 +20,28 @@ noinst_LTLIBRARIES = libgdk-quartz.la
libgdk_quartz_la_SOURCES = \
GdkQuartzView.c \
GdkQuartzView.h \
- GdkQuartzWindow.c \
- GdkQuartzWindow.h \
- gdkapplaunchcontext-quartz.c \
+ GdkQuartzNSWindow.c \
+ GdkQuartzNSWindow.h \
gdkcursor-quartz.c \
- gdkdevice-core.c \
- gdkdevicemanager-core.c \
+ gdkdevice-core-quartz.c \
+ gdkdevicemanager-core-quartz.c \
+ gdkdevicemanager-core-quartz.h \
gdkdisplay-quartz.c \
+ gdkdisplaymanager-quartz.c \
gdkdnd-quartz.c \
- gdkdrawable-quartz.c \
- gdkdrawable-quartz.h \
+ gdkdnd-quartz.h \
gdkevents-quartz.c \
gdkeventloop-quartz.c \
- gdkgeometry-quartz.c \
gdkglobals-quartz.c \
- gdkim-quartz.c \
- gdkinput.c \
- gdkinputprivate.h \
gdkkeys-quartz.c \
- gdkmain-quartz.c \
gdkprivate-quartz.h \
gdkproperty-quartz.c \
gdkquartz.h \
gdkscreen-quartz.c \
gdkscreen-quartz.h \
gdkselection-quartz.c \
- gdkspawn-quartz.c \
gdktestutils-quartz.c \
+ gdkutils-quartz.c \
gdkvisual-quartz.c \
gdkwindow-quartz.c \
gdkwindow-quartz.h \
@@ -54,5 +50,18 @@ libgdk_quartz_la_SOURCES = \
libgdkinclude_HEADERS = \
gdkquartz.h
+libgdkquartzinclude_HEADERS = \
+ gdkquartzcursor.h \
+ gdkquartzdevice-core.h \
+ gdkquartzdevicemanager-core.h \
+ gdkquartzdisplay.h \
+ gdkquartzdisplaymanager.h \
+ gdkquartzdnd.h \
+ gdkquartzkeys.h \
+ gdkquartzscreen.h \
+ gdkquartzutils.h \
+ gdkquartzvisual.h \
+ gdkquartzwindow.h
+
-include $(top_srcdir)/git.mk
diff --git a/gdk/quartz/gdkapplaunchcontext-quartz.c b/gdk/quartz/gdkapplaunchcontext-quartz.c
deleted file mode 100644
index ce0b9c2828..0000000000
--- a/gdk/quartz/gdkapplaunchcontext-quartz.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* gdkapplaunchcontext-quartz.c - Gtk+ implementation for GAppLaunchContext
-
- Copyright (C) 2007 Red Hat, Inc.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Matthias Clasen
-*/
-
-#include "config.h"
-
-#include "gdkapplaunchcontext.h"
-
-
-char *
-_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
- GAppInfo *info,
- GList *files)
-{
- return NULL;
-}
-
-void
-_gdk_windowing_launch_failed (GAppLaunchContext *context,
- const char *startup_notify_id)
-{
-}
-
-
diff --git a/gdk/quartz/gdkcursor-quartz.c b/gdk/quartz/gdkcursor-quartz.c
index 96dc7704e0..22b7676acb 100644
--- a/gdk/quartz/gdkcursor-quartz.c
+++ b/gdk/quartz/gdkcursor-quartz.c
@@ -22,27 +22,40 @@
#include "gdkdisplay.h"
#include "gdkcursor.h"
+#include "gdkcursorprivate.h"
+#include "gdkquartzcursor.h"
#include "gdkprivate-quartz.h"
#include "xcursors.h"
+struct _GdkQuartzCursor
+{
+ GdkCursor cursor;
+
+ NSCursor *nscursor;
+};
+
+struct _GdkQuartzCursorClass
+{
+ GdkCursorClass cursor_class;
+};
+
+
static GdkCursor *cached_xcursors[G_N_ELEMENTS (xcursors)];
static GdkCursor *
gdk_quartz_cursor_new_from_nscursor (NSCursor *nscursor,
GdkCursorType cursor_type)
{
- GdkCursorPrivate *private;
- GdkCursor *cursor;
+ GdkQuartzCursor *private;
- private = g_new (GdkCursorPrivate, 1);
+ private = g_object_new (GDK_TYPE_QUARTZ_CURSOR,
+ "cursor-type", cursor_type,
+ "display", _gdk_display,
+ NULL);
private->nscursor = nscursor;
- cursor = (GdkCursor *)private;
- cursor->type = cursor_type;
- cursor->ref_count = 1;
-
- return cursor;
+ return GDK_CURSOR (private);
}
static GdkCursor *
@@ -175,14 +188,14 @@ create_builtin_cursor (GdkCursorType cursor_type)
}
GdkCursor*
-gdk_cursor_new_for_display (GdkDisplay *display,
- GdkCursorType cursor_type)
+_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
+ GdkCursorType cursor_type)
{
NSCursor *nscursor;
g_return_val_if_fail (display == gdk_display_get_default (), NULL);
- switch (cursor_type)
+ switch (cursor_type)
{
case GDK_XTERM:
nscursor = [NSCursor IBeamCursor];
@@ -237,92 +250,23 @@ gdk_cursor_new_for_display (GdkDisplay *display,
return gdk_quartz_cursor_new_from_nscursor (nscursor, cursor_type);
}
-static NSImage *
-_gdk_quartz_pixbuf_to_ns_image (GdkPixbuf *pixbuf)
-{
- NSBitmapImageRep *bitmap_rep;
- NSImage *image;
- gboolean has_alpha;
-
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
-
- /* Create a bitmap image rep */
- bitmap_rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
- pixelsWide:gdk_pixbuf_get_width (pixbuf)
- pixelsHigh:gdk_pixbuf_get_height (pixbuf)
- bitsPerSample:8 samplesPerPixel:has_alpha ? 4 : 3
- hasAlpha:has_alpha isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace
- bytesPerRow:0 bitsPerPixel:0];
-
- {
- /* Add pixel data to bitmap rep */
- guchar *src, *dst;
- int src_stride, dst_stride;
- int x, y;
-
- src_stride = gdk_pixbuf_get_rowstride (pixbuf);
- dst_stride = [bitmap_rep bytesPerRow];
-
- for (y = 0; y < gdk_pixbuf_get_height (pixbuf); y++)
- {
- src = gdk_pixbuf_get_pixels (pixbuf) + y * src_stride;
- dst = [bitmap_rep bitmapData] + y * dst_stride;
-
- for (x = 0; x < gdk_pixbuf_get_width (pixbuf); x++)
- {
- if (has_alpha)
- {
- guchar red, green, blue, alpha;
-
- red = *src++;
- green = *src++;
- blue = *src++;
- alpha = *src++;
-
- *dst++ = (red * alpha) / 255;
- *dst++ = (green * alpha) / 255;
- *dst++ = (blue * alpha) / 255;
- *dst++ = alpha;
- }
- else
- {
- *dst++ = *src++;
- *dst++ = *src++;
- *dst++ = *src++;
- }
- }
- }
- }
-
- image = [[NSImage alloc] init];
- [image addRepresentation:bitmap_rep];
- [bitmap_rep release];
- [image autorelease];
-
- return image;
-}
GdkCursor *
-gdk_cursor_new_from_pixbuf (GdkDisplay *display,
- GdkPixbuf *pixbuf,
- gint x,
- gint y)
+_gdk_quartz_display_get_cursor_for_pixbuf (GdkDisplay *display,
+ GdkPixbuf *pixbuf,
+ gint x,
+ gint y)
{
NSImage *image;
NSCursor *nscursor;
GdkCursor *cursor;
gboolean has_alpha;
- g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
- g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL);
- g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL);
-
GDK_QUARTZ_ALLOC_POOL;
has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
- image = _gdk_quartz_pixbuf_to_ns_image (pixbuf);
+ image = gdk_quartz_pixbuf_to_ns_image_libgtk_only (pixbuf);
nscursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(x, y)];
cursor = gdk_quartz_cursor_new_from_nscursor (nscursor, GDK_CURSOR_IS_PIXMAP);
@@ -332,82 +276,95 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
return cursor;
}
-GdkCursor*
-gdk_cursor_new_from_name (GdkDisplay *display,
- const gchar *name)
+GdkCursor*
+_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
+ const gchar *name)
{
/* FIXME: Implement */
return NULL;
}
+G_DEFINE_TYPE (GdkQuartzCursor, gdk_quartz_cursor, GDK_TYPE_CURSOR)
+
+static GdkPixbuf *gdk_quartz_cursor_get_image (GdkCursor *cursor);
+
+static void
+gdk_quartz_cursor_finalize (GObject *object)
+{
+ GdkQuartzCursor *private = GDK_QUARTZ_CURSOR (object);
+
+ if (private->nscursor)
+ [private->nscursor release];
+ private->nscursor = NULL;
+}
+
+static void
+gdk_quartz_cursor_class_init (GdkQuartzCursorClass *quartz_cursor_class)
+{
+ GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (quartz_cursor_class);
+ GObjectClass *object_class = G_OBJECT_CLASS (quartz_cursor_class);
+
+ object_class->finalize = gdk_quartz_cursor_finalize;
+
+ cursor_class->get_image = gdk_quartz_cursor_get_image;
+}
+
+static void
+gdk_quartz_cursor_init (GdkQuartzCursor *cursor)
+{
+}
+
+
+gboolean
+_gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display)
+{
+ return TRUE;
+}
+
+gboolean
+_gdk_quartz_display_supports_cursor_color (GdkDisplay *display)
+{
+ return TRUE;
+}
+
void
-_gdk_cursor_destroy (GdkCursor *cursor)
+_gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height)
{
- GdkCursorPrivate *private;
-
- g_return_if_fail (cursor != NULL);
- g_return_if_fail (cursor->ref_count == 0);
-
- private = (GdkCursorPrivate *)cursor;
- [private->nscursor release];
-
- g_free (private);
-}
-
-gboolean
-gdk_display_supports_cursor_alpha (GdkDisplay *display)
-{
- g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
-
- return TRUE;
-}
-
-gboolean
-gdk_display_supports_cursor_color (GdkDisplay *display)
-{
- g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
-
- return TRUE;
-}
-
-guint
-gdk_display_get_default_cursor_size (GdkDisplay *display)
-{
- g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
-
/* Mac OS X doesn't have the notion of a default size */
- return 32;
+ *width = 32;
+ *height = 32;
}
-void
-gdk_display_get_maximal_cursor_size (GdkDisplay *display,
- guint *width,
- guint *height)
+void
+_gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height)
{
- g_return_if_fail (GDK_IS_DISPLAY (display));
-
/* Cursor sizes in Mac OS X can be arbitrarily large */
*width = 65536;
*height = 65536;
}
-GdkDisplay *
-gdk_cursor_get_display (GdkCursor *cursor)
+NSCursor *
+_gdk_quartz_cursor_get_ns_cursor (GdkCursor *cursor)
{
- g_return_val_if_fail (cursor != NULL, NULL);
+ GdkQuartzCursor *cursor_private;
- return gdk_display_get_default ();
+ if (!cursor)
+ return [NSCursor arrowCursor];
+
+ g_return_val_if_fail (GDK_IS_QUARTZ_CURSOR (cursor), NULL);
+
+ cursor_private = GDK_QUARTZ_CURSOR (cursor);
+
+ return cursor_private->nscursor;
}
-GdkPixbuf *
-gdk_cursor_get_image (GdkCursor *cursor)
+static GdkPixbuf *
+gdk_quartz_cursor_get_image (GdkCursor *cursor)
{
/* FIXME: Implement */
return NULL;
}
-
-NSImage *
-gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf)
-{
- return _gdk_quartz_pixbuf_to_ns_image (pixbuf);
-}
diff --git a/gdk/quartz/gdkdevice-core-quartz.c b/gdk/quartz/gdkdevice-core-quartz.c
new file mode 100644
index 0000000000..f42cc5d18d
--- /dev/null
+++ b/gdk/quartz/gdkdevice-core-quartz.c
@@ -0,0 +1,371 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2009 Carlos Garnacho
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include
+#include
+
+#import "GdkQuartzView.h"
+#include "gdkquartzwindow.h"
+#include "gdkquartzcursor.h"
+#include "gdkprivate-quartz.h"
+#include "gdkquartzdevice-core.h"
+
+struct _GdkQuartzDeviceCore
+{
+ GdkDevice parent_instance;
+};
+
+struct _GdkQuartzDeviceCoreClass
+{
+ GdkDeviceClass parent_class;
+};
+
+static gboolean gdk_quartz_device_core_get_history (GdkDevice *device,
+ GdkWindow *window,
+ guint32 start,
+ guint32 stop,
+ GdkTimeCoord ***events,
+ gint *n_events);
+static void gdk_quartz_device_core_get_state (GdkDevice *device,
+ GdkWindow *window,
+ gdouble *axes,
+ GdkModifierType *mask);
+static void gdk_quartz_device_core_set_window_cursor (GdkDevice *device,
+ GdkWindow *window,
+ GdkCursor *cursor);
+static void gdk_quartz_device_core_warp (GdkDevice *device,
+ GdkScreen *screen,
+ gint x,
+ gint y);
+static gboolean gdk_quartz_device_core_query_state (GdkDevice *device,
+ GdkWindow *window,
+ GdkWindow **root_window,
+ GdkWindow **child_window,
+ gint *root_x,
+ gint *root_y,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask);
+static GdkGrabStatus gdk_quartz_device_core_grab (GdkDevice *device,
+ GdkWindow *window,
+ gboolean owner_events,
+ GdkEventMask event_mask,
+ GdkWindow *confine_to,
+ GdkCursor *cursor,
+ guint32 time_);
+static void gdk_quartz_device_core_ungrab (GdkDevice *device,
+ guint32 time_);
+static GdkWindow * gdk_quartz_device_core_window_at_position (GdkDevice *device,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask,
+ gboolean get_toplevel);
+static void gdk_quartz_device_core_select_window_events (GdkDevice *device,
+ GdkWindow *window,
+ GdkEventMask event_mask);
+
+
+G_DEFINE_TYPE (GdkQuartzDeviceCore, gdk_quartz_device_core, GDK_TYPE_DEVICE)
+
+static void
+gdk_quartz_device_core_class_init (GdkQuartzDeviceCoreClass *klass)
+{
+ GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
+
+ device_class->get_history = gdk_quartz_device_core_get_history;
+ device_class->get_state = gdk_quartz_device_core_get_state;
+ device_class->set_window_cursor = gdk_quartz_device_core_set_window_cursor;
+ device_class->warp = gdk_quartz_device_core_warp;
+ device_class->query_state = gdk_quartz_device_core_query_state;
+ device_class->grab = gdk_quartz_device_core_grab;
+ device_class->ungrab = gdk_quartz_device_core_ungrab;
+ device_class->window_at_position = gdk_quartz_device_core_window_at_position;
+ device_class->select_window_events = gdk_quartz_device_core_select_window_events;
+}
+
+static void
+gdk_quartz_device_core_init (GdkQuartzDeviceCore *quartz_device_core)
+{
+ GdkDevice *device;
+
+ device = GDK_DEVICE (quartz_device_core);
+
+ _gdk_device_add_axis (device, GDK_NONE, GDK_AXIS_X, 0, 0, 1);
+ _gdk_device_add_axis (device, GDK_NONE, GDK_AXIS_Y, 0, 0, 1);
+}
+
+static gboolean
+gdk_quartz_device_core_get_history (GdkDevice *device,
+ GdkWindow *window,
+ guint32 start,
+ guint32 stop,
+ GdkTimeCoord ***events,
+ gint *n_events)
+{
+ return FALSE;
+}
+
+static void
+gdk_quartz_device_core_get_state (GdkDevice *device,
+ GdkWindow *window,
+ gdouble *axes,
+ GdkModifierType *mask)
+{
+ gint x_int, y_int;
+
+ gdk_window_get_pointer (window, &x_int, &y_int, mask);
+
+ if (axes)
+ {
+ axes[0] = x_int;
+ axes[1] = y_int;
+ }
+}
+
+static void
+translate_coords_to_child_coords (GdkWindow *parent,
+ GdkWindow *child,
+ gint *x,
+ gint *y)
+{
+ GdkWindow *current = child;
+
+ if (child == parent)
+ return;
+
+ while (current != parent)
+ {
+ gint tmp_x, tmp_y;
+
+ gdk_window_get_origin (current, &tmp_x, &tmp_y);
+
+ *x -= tmp_x;
+ *y -= tmp_y;
+
+ current = gdk_window_get_effective_parent (current);
+ }
+}
+
+static void
+gdk_quartz_device_core_set_window_cursor (GdkDevice *device,
+ GdkWindow *window,
+ GdkCursor *cursor)
+{
+ NSCursor *nscursor;
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return;
+
+ nscursor = _gdk_quartz_cursor_get_ns_cursor (cursor);
+
+ [nscursor set];
+}
+
+static void
+gdk_quartz_device_core_warp (GdkDevice *device,
+ GdkScreen *screen,
+ gint x,
+ gint y)
+{
+ CGDisplayMoveCursorToPoint (CGMainDisplayID (), CGPointMake (x, y));
+}
+
+static GdkWindow *
+gdk_quartz_device_core_query_state_helper (GdkWindow *window,
+ GdkDevice *device,
+ gint *x,
+ gint *y,
+ GdkModifierType *mask)
+{
+ GdkWindow *toplevel;
+ NSPoint point;
+ gint x_tmp, y_tmp;
+ GdkWindow *found_window;
+
+ g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ {
+ *x = 0;
+ *y = 0;
+ *mask = 0;
+ return NULL;
+ }
+
+ toplevel = gdk_window_get_effective_toplevel (window);
+
+ *mask = _gdk_quartz_events_get_current_event_mask ();
+
+ /* Get the y coordinate, needs to be flipped. */
+ if (window == _gdk_root)
+ {
+ point = [NSEvent mouseLocation];
+ _gdk_quartz_window_nspoint_to_gdk_xy (point, &x_tmp, &y_tmp);
+ }
+ else
+ {
+ GdkWindowImplQuartz *impl;
+ NSWindow *nswindow;
+
+ impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
+ nswindow = impl->toplevel;
+
+ point = [nswindow mouseLocationOutsideOfEventStream];
+
+ x_tmp = point.x;
+ y_tmp = toplevel->height - point.y;
+
+ window = toplevel;
+ }
+
+ found_window = _gdk_quartz_window_find_child (window, x_tmp, y_tmp,
+ FALSE);
+
+ if (found_window == _gdk_root)
+ found_window = NULL;
+ else if (found_window)
+ translate_coords_to_child_coords (window, found_window,
+ &x_tmp, &y_tmp);
+
+ if (x)
+ *x = x_tmp;
+
+ if (y)
+ *y = y_tmp;
+
+ return found_window;
+}
+
+static gboolean
+gdk_quartz_device_core_query_state (GdkDevice *device,
+ GdkWindow *window,
+ GdkWindow **root_window,
+ GdkWindow **child_window,
+ gint *root_x,
+ gint *root_y,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask)
+{
+ GdkDisplay *display;
+ GdkWindow *found_window;
+ NSPoint point;
+ gint x_tmp, y_tmp;
+
+ found_window = gdk_quartz_device_core_query_state_helper (window, device,
+ win_x, win_y,
+ mask);
+ if (!found_window)
+ return FALSE;
+
+ display = gdk_window_get_display (window);
+
+ if (root_window)
+ *root_window = _gdk_root;
+
+ if (child_window)
+ *child_window = found_window;
+
+ point = [NSEvent mouseLocation];
+ _gdk_quartz_window_nspoint_to_gdk_xy (point, &x_tmp, &y_tmp);
+
+ if (root_x)
+ *root_x = x_tmp;
+
+ if (root_y)
+ *root_y = y_tmp;
+
+ return TRUE;
+}
+
+static GdkGrabStatus
+gdk_quartz_device_core_grab (GdkDevice *device,
+ GdkWindow *window,
+ gboolean owner_events,
+ GdkEventMask event_mask,
+ GdkWindow *confine_to,
+ GdkCursor *cursor,
+ guint32 time_)
+{
+ /* Should remain empty */
+ return GDK_GRAB_SUCCESS;
+}
+
+static void
+gdk_quartz_device_core_ungrab (GdkDevice *device,
+ guint32 time_)
+{
+ GdkDeviceGrabInfo *grab;
+
+ grab = _gdk_display_get_last_device_grab (_gdk_display, device);
+ if (grab)
+ grab->serial_end = 0;
+
+ _gdk_display_device_grab_update (_gdk_display, device, NULL, 0);
+}
+
+static GdkWindow *
+gdk_quartz_device_core_window_at_position (GdkDevice *device,
+ gint *win_x,
+ gint *win_y,
+ GdkModifierType *mask,
+ gboolean get_toplevel)
+{
+ GdkDisplay *display;
+ GdkScreen *screen;
+ GdkWindow *found_window;
+ NSPoint point;
+ gint x_tmp, y_tmp;
+
+ display = gdk_device_get_display (device);
+ screen = gdk_display_get_default_screen (display);
+
+ /* Get mouse coordinates, find window under the mouse pointer */
+ point = [NSEvent mouseLocation];
+ _gdk_quartz_window_nspoint_to_gdk_xy (point, &x_tmp, &y_tmp);
+
+ found_window = _gdk_quartz_window_find_child (_gdk_root, x_tmp, y_tmp,
+ get_toplevel);
+
+ if (found_window)
+ translate_coords_to_child_coords (_gdk_root, found_window,
+ &x_tmp, &y_tmp);
+
+ if (win_x)
+ *win_x = found_window ? x_tmp : -1;
+
+ if (win_y)
+ *win_y = found_window ? y_tmp : -1;
+
+ if (mask)
+ *mask = _gdk_quartz_events_get_current_event_mask ();
+
+ return found_window;
+}
+
+static void
+gdk_quartz_device_core_select_window_events (GdkDevice *device,
+ GdkWindow *window,
+ GdkEventMask event_mask)
+{
+ /* The mask is set in the common code. */
+}
diff --git a/gdk/quartz/gdkdevice-core.c b/gdk/quartz/gdkdevice-core.c
deleted file mode 100644
index 57dc3de728..0000000000
--- a/gdk/quartz/gdkdevice-core.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2009 Carlos Garnacho
- * Copyright (C) 2010 Kristian Rietveld
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#import "GdkQuartzView.h"
-#include "gdkwindow-quartz.h"
-#include "gdkprivate-quartz.h"
-#include "gdkdevice-core.h"
-
-static gboolean gdk_device_core_get_history (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events);
-static void gdk_device_core_get_state (GdkDevice *device,
- GdkWindow *window,
- gdouble *axes,
- GdkModifierType *mask);
-static void gdk_device_core_set_window_cursor (GdkDevice *device,
- GdkWindow *window,
- GdkCursor *cursor);
-static void gdk_device_core_warp (GdkDevice *device,
- GdkScreen *screen,
- gint x,
- gint y);
-static gboolean gdk_device_core_query_state (GdkDevice *device,
- GdkWindow *window,
- GdkWindow **root_window,
- GdkWindow **child_window,
- gint *root_x,
- gint *root_y,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask);
-static GdkGrabStatus gdk_device_core_grab (GdkDevice *device,
- GdkWindow *window,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time_);
-static void gdk_device_core_ungrab (GdkDevice *device,
- guint32 time_);
-static GdkWindow * gdk_device_core_window_at_position (GdkDevice *device,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask,
- gboolean get_toplevel);
-static void gdk_device_core_select_window_events (GdkDevice *device,
- GdkWindow *window,
- GdkEventMask event_mask);
-
-
-G_DEFINE_TYPE (GdkDeviceCore, gdk_device_core, GDK_TYPE_DEVICE)
-
-static void
-gdk_device_core_class_init (GdkDeviceCoreClass *klass)
-{
- GdkDeviceClass *device_class = GDK_DEVICE_CLASS (klass);
-
- device_class->get_history = gdk_device_core_get_history;
- device_class->get_state = gdk_device_core_get_state;
- device_class->set_window_cursor = gdk_device_core_set_window_cursor;
- device_class->warp = gdk_device_core_warp;
- device_class->query_state = gdk_device_core_query_state;
- device_class->grab = gdk_device_core_grab;
- device_class->ungrab = gdk_device_core_ungrab;
- device_class->window_at_position = gdk_device_core_window_at_position;
- device_class->select_window_events = gdk_device_core_select_window_events;
-}
-
-static void
-gdk_device_core_init (GdkDeviceCore *device_core)
-{
- GdkDevice *device;
-
- device = GDK_DEVICE (device_core);
-
- _gdk_device_add_axis (device, GDK_NONE, GDK_AXIS_X, 0, 0, 1);
- _gdk_device_add_axis (device, GDK_NONE, GDK_AXIS_Y, 0, 0, 1);
-}
-
-static gboolean
-gdk_device_core_get_history (GdkDevice *device,
- GdkWindow *window,
- guint32 start,
- guint32 stop,
- GdkTimeCoord ***events,
- gint *n_events)
-{
- return FALSE;
-}
-
-static void
-gdk_device_core_get_state (GdkDevice *device,
- GdkWindow *window,
- gdouble *axes,
- GdkModifierType *mask)
-{
- gint x_int, y_int;
-
- gdk_window_get_pointer (window, &x_int, &y_int, mask);
-
- if (axes)
- {
- axes[0] = x_int;
- axes[1] = y_int;
- }
-}
-
-static void
-translate_coords_to_child_coords (GdkWindow *parent,
- GdkWindow *child,
- gint *x,
- gint *y)
-{
- GdkWindow *current = child;
-
- if (child == parent)
- return;
-
- while (current != parent)
- {
- gint tmp_x, tmp_y;
-
- gdk_window_get_origin (current, &tmp_x, &tmp_y);
-
- *x -= tmp_x;
- *y -= tmp_y;
-
- current = gdk_window_get_effective_parent (current);
- }
-}
-
-static void
-gdk_device_core_set_window_cursor (GdkDevice *device,
- GdkWindow *window,
- GdkCursor *cursor)
-{
- GdkCursorPrivate *cursor_private;
- NSCursor *nscursor;
-
- cursor_private = (GdkCursorPrivate*) cursor;
-
- if (GDK_WINDOW_DESTROYED (window))
- return;
-
- if (!cursor)
- nscursor = [NSCursor arrowCursor];
- else
- nscursor = cursor_private->nscursor;
-
- [nscursor set];
-}
-
-static void
-gdk_device_core_warp (GdkDevice *device,
- GdkScreen *screen,
- gint x,
- gint y)
-{
- CGDisplayMoveCursorToPoint (CGMainDisplayID (), CGPointMake (x, y));
-}
-
-static GdkWindow *
-gdk_device_core_query_state_helper (GdkWindow *window,
- GdkDevice *device,
- gint *x,
- gint *y,
- GdkModifierType *mask)
-{
- GdkWindowObject *toplevel;
- GdkWindowObject *private;
- NSPoint point;
- gint x_tmp, y_tmp;
- GdkWindow *found_window;
-
- g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
-
- if (GDK_WINDOW_DESTROYED (window))
- {
- *x = 0;
- *y = 0;
- *mask = 0;
- return NULL;
- }
-
- toplevel = GDK_WINDOW_OBJECT (gdk_window_get_effective_toplevel (window));
-
- *mask = _gdk_quartz_events_get_current_event_mask ();
-
- /* Get the y coordinate, needs to be flipped. */
- if (window == _gdk_root)
- {
- point = [NSEvent mouseLocation];
- _gdk_quartz_window_nspoint_to_gdk_xy (point, &x_tmp, &y_tmp);
- }
- else
- {
- GdkWindowImplQuartz *impl;
- NSWindow *nswindow;
-
- impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
- private = GDK_WINDOW_OBJECT (toplevel);
- nswindow = impl->toplevel;
-
- point = [nswindow mouseLocationOutsideOfEventStream];
-
- x_tmp = point.x;
- y_tmp = private->height - point.y;
-
- window = (GdkWindow *)toplevel;
- }
-
- found_window = _gdk_quartz_window_find_child (window, x_tmp, y_tmp,
- FALSE);
-
- if (found_window == _gdk_root)
- found_window = NULL;
- else if (found_window)
- translate_coords_to_child_coords (window, found_window,
- &x_tmp, &y_tmp);
-
- *x = x_tmp;
- *y = y_tmp;
-
- return found_window;
-}
-
-static gboolean
-gdk_device_core_query_state (GdkDevice *device,
- GdkWindow *window,
- GdkWindow **root_window,
- GdkWindow **child_window,
- gint *root_x,
- gint *root_y,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask)
-{
- GdkDisplay *display;
- GdkWindow *found_window;
- NSPoint point;
- gint x_tmp, y_tmp;
-
- found_window = gdk_device_core_query_state_helper (window, device,
- win_x, win_y,
- mask);
- if (!found_window)
- return FALSE;
-
- display = gdk_window_get_display (window);
-
- if (root_window)
- *root_window = _gdk_root;
-
- if (child_window)
- *child_window = found_window;
-
- point = [NSEvent mouseLocation];
- _gdk_quartz_window_nspoint_to_gdk_xy (point, &x_tmp, &y_tmp);
-
- if (root_x)
- *root_x = x_tmp;
-
- if (root_y)
- *root_y = y_tmp;
-
- return TRUE;
-}
-
-static GdkGrabStatus
-gdk_device_core_grab (GdkDevice *device,
- GdkWindow *window,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time_)
-{
- /* Should remain empty */
- return GDK_GRAB_SUCCESS;
-}
-
-static void
-gdk_device_core_ungrab (GdkDevice *device,
- guint32 time_)
-{
- /* Should remain empty */
-}
-
-static GdkWindow *
-gdk_device_core_window_at_position (GdkDevice *device,
- gint *win_x,
- gint *win_y,
- GdkModifierType *mask,
- gboolean get_toplevel)
-{
- GdkDisplay *display;
- GdkScreen *screen;
- GdkWindow *found_window;
- NSPoint point;
- gint x_tmp, y_tmp;
-
- display = gdk_device_get_display (device);
- screen = gdk_display_get_default_screen (display);
-
- /* Get mouse coordinates, find window under the mouse pointer */
- point = [NSEvent mouseLocation];
- _gdk_quartz_window_nspoint_to_gdk_xy (point, &x_tmp, &y_tmp);
-
- found_window = _gdk_quartz_window_find_child (_gdk_root, x_tmp, y_tmp,
- get_toplevel);
-
- if (found_window)
- translate_coords_to_child_coords (_gdk_root, found_window,
- &x_tmp, &y_tmp);
-
- if (win_x)
- *win_x = found_window ? x_tmp : -1;
-
- if (win_y)
- *win_y = found_window ? y_tmp : -1;
-
- if (mask)
- *mask = _gdk_quartz_events_get_current_event_mask ();
-
- return found_window;
-}
-
-static void
-gdk_device_core_select_window_events (GdkDevice *device,
- GdkWindow *window,
- GdkEventMask event_mask)
-{
- /* The mask is set in the common code. */
-}
diff --git a/gdk/quartz/gdkdevicemanager-core.c b/gdk/quartz/gdkdevicemanager-core-quartz.c
similarity index 53%
rename from gdk/quartz/gdkdevicemanager-core.c
rename to gdk/quartz/gdkdevicemanager-core-quartz.c
index e96e9a9bf3..f5d0ab6cc4 100644
--- a/gdk/quartz/gdkdevicemanager-core.c
+++ b/gdk/quartz/gdkdevicemanager-core-quartz.c
@@ -21,41 +21,43 @@
#include
#include
-#include "gdkdevicemanager-core.h"
-#include "gdkdevice-core.h"
+#include
+#include
+#include "gdkdevicemanager-core-quartz.h"
+#include "gdkquartzdevice-core.h"
#include "gdkkeysyms.h"
#define HAS_FOCUS(toplevel) \
((toplevel)->has_focus || (toplevel)->has_pointer_focus)
-static void gdk_device_manager_core_finalize (GObject *object);
-static void gdk_device_manager_core_constructed (GObject *object);
+static void gdk_quartz_device_manager_core_finalize (GObject *object);
+static void gdk_quartz_device_manager_core_constructed (GObject *object);
-static GList * gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager,
- GdkDeviceType type);
-static GdkDevice * gdk_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager);
+static GList * gdk_quartz_device_manager_core_list_devices (GdkDeviceManager *device_manager,
+ GdkDeviceType type);
+static GdkDevice * gdk_quartz_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager);
-G_DEFINE_TYPE (GdkDeviceManagerCore, gdk_device_manager_core, GDK_TYPE_DEVICE_MANAGER)
+G_DEFINE_TYPE (GdkQuartzDeviceManagerCore, gdk_quartz_device_manager_core, GDK_TYPE_DEVICE_MANAGER)
static void
-gdk_device_manager_core_class_init (GdkDeviceManagerCoreClass *klass)
+gdk_quartz_device_manager_core_class_init (GdkQuartzDeviceManagerCoreClass *klass)
{
GdkDeviceManagerClass *device_manager_class = GDK_DEVICE_MANAGER_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = gdk_device_manager_core_finalize;
- object_class->constructed = gdk_device_manager_core_constructed;
- device_manager_class->list_devices = gdk_device_manager_core_list_devices;
- device_manager_class->get_client_pointer = gdk_device_manager_core_get_client_pointer;
+ object_class->finalize = gdk_quartz_device_manager_core_finalize;
+ object_class->constructed = gdk_quartz_device_manager_core_constructed;
+ device_manager_class->list_devices = gdk_quartz_device_manager_core_list_devices;
+ device_manager_class->get_client_pointer = gdk_quartz_device_manager_core_get_client_pointer;
}
static GdkDevice *
create_core_pointer (GdkDeviceManager *device_manager,
GdkDisplay *display)
{
- return g_object_new (GDK_TYPE_DEVICE_CORE,
+ return g_object_new (GDK_TYPE_QUARTZ_DEVICE_CORE,
"name", "Core Pointer",
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_MOUSE,
@@ -70,7 +72,7 @@ static GdkDevice *
create_core_keyboard (GdkDeviceManager *device_manager,
GdkDisplay *display)
{
- return g_object_new (GDK_TYPE_DEVICE_CORE,
+ return g_object_new (GDK_TYPE_QUARTZ_DEVICE_CORE,
"name", "Core Keyboard",
"type", GDK_DEVICE_TYPE_MASTER,
"input-source", GDK_SOURCE_KEYBOARD,
@@ -82,30 +84,30 @@ create_core_keyboard (GdkDeviceManager *device_manager,
}
static void
-gdk_device_manager_core_init (GdkDeviceManagerCore *device_manager)
+gdk_quartz_device_manager_core_init (GdkQuartzDeviceManagerCore *device_manager)
{
}
static void
-gdk_device_manager_core_finalize (GObject *object)
+gdk_quartz_device_manager_core_finalize (GObject *object)
{
- GdkDeviceManagerCore *device_manager_core;
+ GdkQuartzDeviceManagerCore *quartz_device_manager_core;
- device_manager_core = GDK_DEVICE_MANAGER_CORE (object);
+ quartz_device_manager_core = GDK_QUARTZ_DEVICE_MANAGER_CORE (object);
- g_object_unref (device_manager_core->core_pointer);
- g_object_unref (device_manager_core->core_keyboard);
+ g_object_unref (quartz_device_manager_core->core_pointer);
+ g_object_unref (quartz_device_manager_core->core_keyboard);
- G_OBJECT_CLASS (gdk_device_manager_core_parent_class)->finalize (object);
+ G_OBJECT_CLASS (gdk_quartz_device_manager_core_parent_class)->finalize (object);
}
static void
-gdk_device_manager_core_constructed (GObject *object)
+gdk_quartz_device_manager_core_constructed (GObject *object)
{
- GdkDeviceManagerCore *device_manager;
+ GdkQuartzDeviceManagerCore *device_manager;
GdkDisplay *display;
- device_manager = GDK_DEVICE_MANAGER_CORE (object);
+ device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (object);
display = gdk_device_manager_get_display (GDK_DEVICE_MANAGER (object));
device_manager->core_pointer = create_core_pointer (GDK_DEVICE_MANAGER (device_manager), display);
device_manager->core_keyboard = create_core_keyboard (GDK_DEVICE_MANAGER (device_manager), display);
@@ -115,27 +117,27 @@ gdk_device_manager_core_constructed (GObject *object)
}
static GList *
-gdk_device_manager_core_list_devices (GdkDeviceManager *device_manager,
- GdkDeviceType type)
+gdk_quartz_device_manager_core_list_devices (GdkDeviceManager *device_manager,
+ GdkDeviceType type)
{
- GdkDeviceManagerCore *device_manager_core;
+ GdkQuartzDeviceManagerCore *quartz_device_manager_core;
GList *devices = NULL;
if (type == GDK_DEVICE_TYPE_MASTER)
{
- device_manager_core = (GdkDeviceManagerCore *) device_manager;
- devices = g_list_prepend (devices, device_manager_core->core_keyboard);
- devices = g_list_prepend (devices, device_manager_core->core_pointer);
+ quartz_device_manager_core = (GdkQuartzDeviceManagerCore *) device_manager;
+ devices = g_list_prepend (devices, quartz_device_manager_core->core_keyboard);
+ devices = g_list_prepend (devices, quartz_device_manager_core->core_pointer);
}
return devices;
}
static GdkDevice *
-gdk_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager)
+gdk_quartz_device_manager_core_get_client_pointer (GdkDeviceManager *device_manager)
{
- GdkDeviceManagerCore *device_manager_core;
+ GdkQuartzDeviceManagerCore *quartz_device_manager_core;
- device_manager_core = (GdkDeviceManagerCore *) device_manager;
- return device_manager_core->core_pointer;
+ quartz_device_manager_core = (GdkQuartzDeviceManagerCore *) device_manager;
+ return quartz_device_manager_core->core_pointer;
}
diff --git a/gtk/gtkwindow-decorate.h b/gdk/quartz/gdkdevicemanager-core-quartz.h
similarity index 55%
rename from gtk/gtkwindow-decorate.h
rename to gdk/quartz/gdkdevicemanager-core-quartz.h
index 9f182f457b..48fc56c9d7 100644
--- a/gtk/gtkwindow-decorate.h
+++ b/gdk/quartz/gdkdevicemanager-core-quartz.h
@@ -1,5 +1,7 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2001 Red Hat, Inc.
+/* gdkdevicemanager-quartz.h
+ *
+ * Copyright (C) 2009 Carlos Garnacho
+ * Copyright (C) 2010 Kristian Rietveld
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -17,25 +19,26 @@
* Boston, MA 02111-1307, USA.
*/
-/*
- * Authors: Alexander Larsson
- */
+#ifndef __GDK_QUARTZ_DEVICE_MANAGER_CORE__
+#define __GDK_QUARTZ_DEVICE_MANAGER_CORE__
-#ifndef __GTK_WINDOW_DECORATE_H__
-#define __GTK_WINDOW_DECORATE_H__
+#include
+#include
G_BEGIN_DECLS
-void gtk_decorated_window_init (GtkWindow *window);
-void gtk_decorated_window_calculate_frame_size (GtkWindow *window);
-void gtk_decorated_window_set_title (GtkWindow *window,
- const gchar *title);
-void gtk_decorated_window_move_resize_window (GtkWindow *window,
- gint x,
- gint y,
- gint width,
- gint height);
+struct _GdkQuartzDeviceManagerCore
+{
+ GdkDeviceManager parent_object;
+ GdkDevice *core_pointer;
+ GdkDevice *core_keyboard;
+};
+
+struct _GdkQuartzDeviceManagerCoreClass
+{
+ GdkDeviceManagerClass parent_class;
+};
G_END_DECLS
-#endif /* __GTK_WINDOW_DECORATE_H__ */
+#endif /* __GDK_QUARTZ_DEVICE_MANAGER__ */
diff --git a/gdk/quartz/gdkdevicemanager-core.h b/gdk/quartz/gdkdevicemanager-core.h
deleted file mode 100644
index 0a337fcd00..0000000000
--- a/gdk/quartz/gdkdevicemanager-core.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 2009 Carlos Garnacho
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GDK_DEVICE_MANAGER_CORE_H__
-#define __GDK_DEVICE_MANAGER_CORE_H__
-
-#include
-
-G_BEGIN_DECLS
-
-#define GDK_TYPE_DEVICE_MANAGER_CORE (gdk_device_manager_core_get_type ())
-#define GDK_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCore))
-#define GDK_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCoreClass))
-#define GDK_IS_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_MANAGER_CORE))
-#define GDK_IS_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_DEVICE_MANAGER_CORE))
-#define GDK_DEVICE_MANAGER_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_DEVICE_MANAGER_CORE, GdkDeviceManagerCoreClass))
-
-typedef struct _GdkDeviceManagerCore GdkDeviceManagerCore;
-typedef struct _GdkDeviceManagerCoreClass GdkDeviceManagerCoreClass;
-
-struct _GdkDeviceManagerCore
-{
- GdkDeviceManager parent_object;
- GdkDevice *core_pointer;
- GdkDevice *core_keyboard;
-};
-
-struct _GdkDeviceManagerCoreClass
-{
- GdkDeviceManagerClass parent_class;
-};
-
-GType gdk_device_manager_core_get_type (void) G_GNUC_CONST;
-
-
-G_END_DECLS
-
-#endif /* __GDK_DEVICE_MANAGER_CORE_H__ */
diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c
index 556f84eee5..357c3c0b54 100644
--- a/gdk/quartz/gdkdisplay-quartz.c
+++ b/gdk/quartz/gdkdisplay-quartz.c
@@ -20,13 +20,30 @@
#include "config.h"
-#include "gdk.h"
-#include "gdkprivate-quartz.h"
-#include "gdkscreen-quartz.h"
-#include "gdkdevicemanager-core.h"
+#include
+#include
-GdkWindow *
-gdk_display_get_default_group (GdkDisplay *display)
+#include "gdkprivate-quartz.h"
+#include "gdkquartzscreen.h"
+#include "gdkquartzwindow.h"
+#include "gdkquartzdisplay.h"
+#include "gdkquartzdevicemanager-core.h"
+
+
+struct _GdkQuartzDisplay
+{
+ GdkDisplay display;
+
+ GList *input_devices;
+};
+
+struct _GdkQuartzDisplayClass
+{
+ GdkDisplayClass display_class;
+};
+
+static GdkWindow *
+gdk_quartz_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
@@ -35,22 +52,66 @@ gdk_display_get_default_group (GdkDisplay *display)
return NULL;
}
-void
-_gdk_windowing_set_default_display (GdkDisplay *display)
-{
- g_assert (display == NULL || _gdk_display == display);
-}
-
GdkDeviceManager *
_gdk_device_manager_new (GdkDisplay *display)
{
- return g_object_new (GDK_TYPE_DEVICE_MANAGER_CORE,
+ return g_object_new (GDK_TYPE_QUARTZ_DEVICE_MANAGER_CORE,
"display", display,
NULL);
}
+static void
+gdk_quartz_display_init_input (GdkDisplay *display)
+{
+ GdkQuartzDisplay *display_quartz;
+ GdkDeviceManager *device_manager;
+ GList *list, *l;
+
+ display_quartz = GDK_QUARTZ_DISPLAY (display);
+ device_manager = gdk_display_get_device_manager (_gdk_display);
+
+ /* For backwards compabitility, just add floating devices that are
+ * not keyboards.
+ */
+ list = gdk_device_manager_list_devices (device_manager,
+ GDK_DEVICE_TYPE_FLOATING);
+ for (l = list; l; l = l->next)
+ {
+ GdkDevice *device = l->data;
+
+ if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
+ continue;
+
+ display_quartz->input_devices = g_list_prepend (display_quartz->input_devices,
+ g_object_ref (l->data));
+ }
+
+ g_list_free (list);
+
+ /* Now set "core" pointer to the first master device that is a pointer. */
+ list = gdk_device_manager_list_devices (device_manager,
+ GDK_DEVICE_TYPE_MASTER);
+
+ for (l = list; l; l = l->next)
+ {
+ GdkDevice *device = list->data;
+
+ if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
+ continue;
+
+ display->core_pointer = device;
+ break;
+ }
+
+ /* Add the core pointer to the devices list */
+ display_quartz->input_devices = g_list_prepend (display_quartz->input_devices,
+ g_object_ref (display->core_pointer));
+
+ g_list_free (list);
+}
+
GdkDisplay *
-gdk_display_open (const gchar *display_name)
+_gdk_quartz_display_open (const gchar *display_name)
{
if (_gdk_display != NULL)
return NULL;
@@ -58,22 +119,21 @@ gdk_display_open (const gchar *display_name)
/* Initialize application */
[NSApplication sharedApplication];
- _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL);
+ _gdk_display = g_object_new (gdk_quartz_display_get_type (), NULL);
_gdk_display->device_manager = _gdk_device_manager_new (_gdk_display);
- _gdk_visual_init ();
+ _gdk_screen = g_object_new (gdk_quartz_screen_get_type (), NULL);
+ _gdk_quartz_screen_init_visuals (_gdk_screen);
- _gdk_screen = _gdk_screen_quartz_new ();
+ _gdk_quartz_window_init_windowing (_gdk_display, _gdk_screen);
- _gdk_windowing_window_init ();
+ _gdk_quartz_events_init ();
- _gdk_events_init ();
-
- _gdk_input_init ();
+ gdk_quartz_display_init_input (_gdk_display);
#if 0
/* FIXME: Remove the #if 0 when we have these functions */
- _gdk_dnd_init ();
+ _gdk_quartz_dnd_init ();
#endif
g_signal_emit_by_name (gdk_display_manager_get (),
@@ -82,8 +142,8 @@ gdk_display_open (const gchar *display_name)
return _gdk_display;
}
-G_CONST_RETURN gchar *
-gdk_display_get_name (GdkDisplay *display)
+static const gchar *
+gdk_quartz_display_get_name (GdkDisplay *display)
{
static gchar *display_name = NULL;
@@ -97,17 +157,17 @@ gdk_display_get_name (GdkDisplay *display)
return display_name;
}
-int
-gdk_display_get_n_screens (GdkDisplay *display)
+static gint
+gdk_quartz_display_get_n_screens (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return 1;
}
-GdkScreen *
-gdk_display_get_screen (GdkDisplay *display,
- gint screen_num)
+static GdkScreen *
+gdk_quartz_display_get_screen (GdkDisplay *display,
+ gint screen_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (screen_num == 0, NULL);
@@ -115,22 +175,34 @@ gdk_display_get_screen (GdkDisplay *display,
return _gdk_screen;
}
-GdkScreen *
-gdk_display_get_default_screen (GdkDisplay *display)
+static GdkScreen *
+gdk_quartz_display_get_default_screen (GdkDisplay *display)
{
return _gdk_screen;
}
-void
-gdk_display_beep (GdkDisplay *display)
+static void
+gdk_quartz_display_beep (GdkDisplay *display)
{
g_return_if_fail (GDK_IS_DISPLAY (display));
NSBeep();
}
-gboolean
-gdk_display_supports_selection_notification (GdkDisplay *display)
+static void
+gdk_quartz_display_sync (GdkDisplay *display)
+{
+ /* Not supported. */
+}
+
+static void
+gdk_quartz_display_flush (GdkDisplay *display)
+{
+ /* Not supported. */
+}
+
+static gboolean
+gdk_quartz_display_supports_selection_notification (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
@@ -138,56 +210,162 @@ gdk_display_supports_selection_notification (GdkDisplay *display)
return FALSE;
}
-gboolean
-gdk_display_request_selection_notification (GdkDisplay *display,
- GdkAtom selection)
+static gboolean
+gdk_quartz_display_request_selection_notification (GdkDisplay *display,
+ GdkAtom selection)
{
/* FIXME: Implement */
return FALSE;
}
-gboolean
-gdk_display_supports_clipboard_persistence (GdkDisplay *display)
+static gboolean
+gdk_quartz_display_supports_clipboard_persistence (GdkDisplay *display)
{
/* FIXME: Implement */
return FALSE;
}
-gboolean
-gdk_display_supports_shapes (GdkDisplay *display)
+static gboolean
+gdk_quartz_display_supports_shapes (GdkDisplay *display)
{
/* FIXME: Implement */
return FALSE;
}
-gboolean
-gdk_display_supports_input_shapes (GdkDisplay *display)
+static gboolean
+gdk_quartz_display_supports_input_shapes (GdkDisplay *display)
{
/* FIXME: Implement */
return FALSE;
}
-void
-gdk_display_store_clipboard (GdkDisplay *display,
- GdkWindow *clipboard_window,
- guint32 time_,
- const GdkAtom *targets,
- gint n_targets)
+static void
+gdk_quartz_display_store_clipboard (GdkDisplay *display,
+ GdkWindow *clipboard_window,
+ guint32 time_,
+ const GdkAtom *targets,
+ gint n_targets)
{
/* FIXME: Implement */
}
-gboolean
-gdk_display_supports_composite (GdkDisplay *display)
+static gboolean
+gdk_quartz_display_supports_composite (GdkDisplay *display)
{
/* FIXME: Implement */
return FALSE;
}
-gulong
-_gdk_windowing_window_get_next_serial (GdkDisplay *display)
+static GList *
+gdk_quartz_display_list_devices (GdkDisplay *display)
+{
+ g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
+
+ return GDK_QUARTZ_DISPLAY (display)->input_devices;
+}
+
+static gulong
+gdk_quartz_display_get_next_serial (GdkDisplay *display)
{
return 0;
}
+
+static void
+gdk_quartz_display_notify_startup_complete (GdkDisplay *display,
+ const gchar *startup_id)
+{
+ /* FIXME: Implement? */
+}
+
+
+G_DEFINE_TYPE (GdkQuartzDisplay, gdk_quartz_display, GDK_TYPE_DISPLAY)
+
+static void
+gdk_quartz_display_init (GdkQuartzDisplay *display)
+{
+ _gdk_quartz_display_manager_add_display (gdk_display_manager_get (),
+ GDK_DISPLAY_OBJECT (display));
+}
+
+static void
+gdk_quartz_display_dispose (GObject *object)
+{
+ GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
+
+ _gdk_quartz_display_manager_remove_display (gdk_display_manager_get (),
+ GDK_DISPLAY_OBJECT (object));
+
+ g_list_foreach (display_quartz->input_devices,
+ (GFunc) g_object_run_dispose, NULL);
+
+ G_OBJECT_CLASS (gdk_quartz_display_parent_class)->dispose (object);
+}
+
+static void
+gdk_quartz_display_finalize (GObject *object)
+{
+ GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
+
+ g_list_foreach (display_quartz->input_devices, (GFunc) g_object_unref, NULL);
+ g_list_free (display_quartz->input_devices);
+
+ G_OBJECT_CLASS (gdk_quartz_display_parent_class)->finalize (object);
+}
+
+static void
+gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class);
+
+ object_class->finalize = gdk_quartz_display_finalize;
+
+ display_class->window_type = GDK_TYPE_QUARTZ_WINDOW;
+
+ display_class->get_name = gdk_quartz_display_get_name;
+ display_class->get_n_screens = gdk_quartz_display_get_n_screens;
+ display_class->get_screen = gdk_quartz_display_get_screen;
+ display_class->get_default_screen = gdk_quartz_display_get_default_screen;
+ display_class->beep = gdk_quartz_display_beep;
+ display_class->sync = gdk_quartz_display_sync;
+ display_class->flush = gdk_quartz_display_flush;
+ display_class->queue_events = _gdk_quartz_display_queue_events;
+ display_class->has_pending = _gdk_quartz_display_has_pending;
+ display_class->get_default_group = gdk_quartz_display_get_default_group;
+ display_class->supports_selection_notification = gdk_quartz_display_supports_selection_notification;
+ display_class->request_selection_notification = gdk_quartz_display_request_selection_notification;
+ display_class->supports_clipboard_persistence = gdk_quartz_display_supports_clipboard_persistence;
+ display_class->store_clipboard = gdk_quartz_display_store_clipboard;
+ display_class->supports_shapes = gdk_quartz_display_supports_shapes;
+ display_class->supports_input_shapes = gdk_quartz_display_supports_input_shapes;
+ display_class->supports_composite = gdk_quartz_display_supports_composite;
+ display_class->list_devices = gdk_quartz_display_list_devices;
+ display_class->send_client_message = _gdk_quartz_display_send_client_message;
+ display_class->add_client_message_filter = _gdk_quartz_display_add_client_message_filter;
+ display_class->get_drag_protocol = _gdk_quartz_display_get_drag_protocol;
+ display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type;
+ display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name;
+ display_class->get_cursor_for_pixbuf = _gdk_quartz_display_get_cursor_for_pixbuf;
+ display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size;
+ display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size;
+ display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha;
+ display_class->supports_cursor_color = _gdk_quartz_display_supports_cursor_color;
+
+ display_class->before_process_all_updates = _gdk_quartz_display_before_process_all_updates;
+ display_class->after_process_all_updates = _gdk_quartz_display_after_process_all_updates;
+ display_class->get_next_serial = gdk_quartz_display_get_next_serial;
+ display_class->notify_startup_complete = gdk_quartz_display_notify_startup_complete;
+ display_class->event_data_copy = _gdk_quartz_display_event_data_copy;
+ display_class->event_data_free = _gdk_quartz_display_event_data_free;
+ display_class->create_window_impl = _gdk_quartz_display_create_window_impl;
+ display_class->get_keymap = _gdk_quartz_display_get_keymap;
+ display_class->get_selection_owner = _gdk_quartz_display_get_selection_owner;
+ display_class->set_selection_owner = _gdk_quartz_display_set_selection_owner;
+ display_class->send_selection_notify = _gdk_quartz_display_send_selection_notify;
+ display_class->get_selection_property = _gdk_quartz_display_get_selection_property;
+ display_class->convert_selection = _gdk_quartz_display_convert_selection;
+ display_class->text_property_to_utf8_list = _gdk_quartz_display_text_property_to_utf8_list;
+ display_class->utf8_to_string_target = _gdk_quartz_display_utf8_to_string_target;
+}
diff --git a/gdk/quartz/gdkdisplaymanager-quartz.c b/gdk/quartz/gdkdisplaymanager-quartz.c
new file mode 100644
index 0000000000..087d5b3856
--- /dev/null
+++ b/gdk/quartz/gdkdisplaymanager-quartz.c
@@ -0,0 +1,177 @@
+/* GDK - The GIMP Drawing Kit
+ * gdkdisplaymanager-quartz.c
+ *
+ * Copyright (C) 2005 Imendio AB
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * Author: Matthias clasen
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include
+#include
+
+#include "gdkquartzdisplay.h"
+#include "gdkquartzdisplaymanager.h"
+#include "gdkprivate-quartz.h"
+
+#include "gdkdisplaymanagerprivate.h"
+#include "gdkinternals.h"
+
+struct _GdkQuartzDisplayManager
+{
+ GdkDisplayManager parent;
+
+ GdkDisplay *default_display;
+ GSList *displays;
+};
+
+
+G_DEFINE_TYPE (GdkQuartzDisplayManager, gdk_quartz_display_manager, GDK_TYPE_DISPLAY_MANAGER)
+
+static GdkDisplay *
+gdk_quartz_display_manager_open_display (GdkDisplayManager *manager,
+ const gchar *name)
+{
+ return _gdk_quartz_display_open (name);
+}
+
+static GSList *
+gdk_quartz_display_manager_list_displays (GdkDisplayManager *manager)
+{
+ GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
+
+ return g_slist_copy (manager_quartz->displays);
+}
+
+static GdkDisplay *
+gdk_quartz_display_manager_get_default_display (GdkDisplayManager *manager)
+{
+ return GDK_QUARTZ_DISPLAY_MANAGER (manager)->default_display;
+}
+
+static void
+gdk_quartz_display_manager_set_default_display (GdkDisplayManager *manager,
+ GdkDisplay *display)
+{
+ GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
+
+ manager_quartz->default_display = display;
+}
+
+#include "../gdkkeynames.c"
+
+static gchar *
+gdk_quartz_display_manager_get_keyval_name (GdkDisplayManager *manager,
+ guint keyval)
+{
+ return _gdk_keyval_name (keyval);
+}
+
+static guint
+gdk_quartz_display_manager_lookup_keyval (GdkDisplayManager *manager,
+ const gchar *name)
+{
+ return _gdk_keyval_from_name (name);
+}
+
+static void
+gdk_quartz_display_manager_keyval_convert_case (GdkDisplayManager *manager,
+ guint symbol,
+ guint *lower,
+ guint *upper)
+{
+ /* FIXME implement this */
+ if (lower)
+ *lower = symbol;
+ if (upper)
+ *upper = symbol;
+}
+
+static void
+gdk_quartz_display_manager_init (GdkQuartzDisplayManager *manager)
+{
+ ProcessSerialNumber psn = { 0, kCurrentProcess };
+ void (*_gtk_quartz_framework_init_ptr) (void);
+
+ /* Make the current process a foreground application, i.e. an app
+ * with a user interface, in case we're not running from a .app bundle
+ */
+ TransformProcessType (&psn, kProcessTransformToForegroundApplication);
+
+ /* Initialize GTK+ framework if there is one. */
+ _gtk_quartz_framework_init_ptr = dlsym (RTLD_DEFAULT, "_gtk_quartz_framework_init");
+ if (_gtk_quartz_framework_init_ptr)
+ _gtk_quartz_framework_init_ptr ();
+}
+
+static void
+gdk_quartz_display_manager_finalize (GObject *object)
+{
+ g_error ("A GdkQuartzDisplayManager object was finalized. This should not happen");
+ G_OBJECT_CLASS (gdk_quartz_display_manager_parent_class)->finalize (object);
+}
+
+static void
+gdk_quartz_display_manager_class_init (GdkQuartzDisplayManagerClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
+
+ object_class->finalize = gdk_quartz_display_manager_finalize;
+
+ manager_class->open_display = gdk_quartz_display_manager_open_display;
+ manager_class->list_displays = gdk_quartz_display_manager_list_displays;
+ manager_class->set_default_display = gdk_quartz_display_manager_set_default_display;
+ manager_class->get_default_display = gdk_quartz_display_manager_get_default_display;
+ manager_class->atom_intern = _gdk_quartz_display_manager_atom_intern;
+ manager_class->get_atom_name = _gdk_quartz_display_manager_get_atom_name;
+ manager_class->lookup_keyval = gdk_quartz_display_manager_lookup_keyval;
+ manager_class->get_keyval_name = gdk_quartz_display_manager_get_keyval_name;
+ manager_class->keyval_convert_case = gdk_quartz_display_manager_keyval_convert_case;
+}
+
+void
+_gdk_quartz_display_manager_add_display (GdkDisplayManager *manager,
+ GdkDisplay *display)
+{
+ GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
+
+ if (manager_quartz->displays == NULL)
+ gdk_display_manager_set_default_display (manager, display);
+
+ manager_quartz->displays = g_slist_prepend (manager_quartz->displays, display);
+}
+
+void
+_gdk_quartz_display_manager_remove_display (GdkDisplayManager *manager,
+ GdkDisplay *display)
+{
+ GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
+
+ manager_quartz->displays = g_slist_remove (manager_quartz->displays, display);
+
+ if (manager_quartz->default_display == display)
+ {
+ if (manager_quartz->displays)
+ gdk_display_manager_set_default_display (manager, manager_quartz->displays->data);
+ else
+ gdk_display_manager_set_default_display (manager, NULL);
+ }
+}
diff --git a/gdk/quartz/gdkdnd-quartz.c b/gdk/quartz/gdkdnd-quartz.c
index 73a68df063..7ba1705c54 100644
--- a/gdk/quartz/gdkdnd-quartz.c
+++ b/gdk/quartz/gdkdnd-quartz.c
@@ -19,122 +19,11 @@
*/
#include "gdkdnd.h"
+#include "gdkquartzdnd.h"
#include "gdkprivate-quartz.h"
-static gpointer parent_class = NULL;
-static void
-gdk_drag_context_finalize (GObject *object)
-{
- GdkDragContext *context = GDK_DRAG_CONTEXT (object);
- GdkDragContextPrivate *private = GDK_DRAG_CONTEXT_PRIVATE (context);
-
- g_free (private);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_drag_context_init (GdkDragContext *dragcontext)
-{
- GdkDragContextPrivate *priv = g_new0 (GdkDragContextPrivate, 1);
-
- dragcontext->windowing_data = priv;
-}
-
-static void
-gdk_drag_context_class_init (GdkDragContextClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_drag_context_finalize;
-}
-
-GType
-gdk_drag_context_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkDragContextClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_drag_context_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkDragContext),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_drag_context_init,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkDragContext",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-GdkDragContext *
-gdk_drag_context_new (void)
-{
- return (GdkDragContext *)g_object_new (gdk_drag_context_get_type (), NULL);
-}
-
-/**
- * gdk_drag_context_set_device:
- * @context: a #GdkDragContext
- * @device: a #GdkDevice
- *
- * Associates a #GdkDevice to @context, so all Drag and Drop events
- * for @context are emitted as if they came from this device.
- **/
-void
-gdk_drag_context_set_device (GdkDragContext *context,
- GdkDevice *device)
-{
- GdkDragContextPrivate *private;
-
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
- g_return_if_fail (GDK_IS_DEVICE (device));
-
- private = GDK_DRAG_CONTEXT_PRIVATE (context);
-
- if (private->device)
- {
- g_object_unref (private->device);
- private->device = NULL;
- }
-
- if (device)
- private->device = g_object_ref (device);
-}
-
-/**
- * gdk_drag_context_get_device:
- * @context: a #GdkDragContext
- *
- * Returns the #GdkDevice associated to the drag context.
- *
- * Returns: The #GdkDevice associated to @context.
- **/
-GdkDevice *
-gdk_drag_context_get_device (GdkDragContext *context)
-{
- GdkDragContextPrivate *private;
-
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
-
- private = GDK_DRAG_CONTEXT_PRIVATE (context);
-
- return private->device;
-}
+G_DEFINE_TYPE (GdkQuartzDragContext, gdk_quartz_drag_context, GDK_TYPE_DRAG_CONTEXT)
GdkDragContext *_gdk_quartz_drag_source_context = NULL;
@@ -145,117 +34,112 @@ gdk_quartz_drag_source_context ()
return _gdk_quartz_drag_source_context;
}
-GdkDragContext *
-gdk_drag_begin (GdkWindow *window,
- GList *targets)
+GdkDragContext *
+_gdk_quartz_window_drag_begin (GdkWindow *window,
+ GdkDevice *device,
+ GList *targets)
{
- GdkDeviceManager *device_manager;
-
g_assert (_gdk_quartz_drag_source_context == NULL);
-
+
/* Create fake context */
- _gdk_quartz_drag_source_context = gdk_drag_context_new ();
+ _gdk_quartz_drag_source_context = g_object_new (GDK_TYPE_QUARTZ_DRAG_CONTEXT,
+ NULL);
_gdk_quartz_drag_source_context->is_source = TRUE;
- device_manager = gdk_display_get_device_manager (gdk_display_get_default ());
- gdk_drag_context_set_device (_gdk_quartz_drag_source_context,
- gdk_device_manager_get_client_pointer (device_manager));
+ gdk_drag_context_set_device (_gdk_quartz_drag_source_context, device);
return _gdk_quartz_drag_source_context;
}
-gboolean
-gdk_drag_motion (GdkDragContext *context,
- GdkWindow *dest_window,
- GdkDragProtocol protocol,
- gint x_root,
- gint y_root,
- GdkDragAction suggested_action,
- GdkDragAction possible_actions,
- guint32 time)
+static gboolean
+gdk_quartz_drag_context_drag_motion (GdkDragContext *context,
+ GdkWindow *dest_window,
+ GdkDragProtocol protocol,
+ gint x_root,
+ gint y_root,
+ GdkDragAction suggested_action,
+ GdkDragAction possible_actions,
+ guint32 time)
{
/* FIXME: Implement */
return FALSE;
}
-guint32
-gdk_drag_get_protocol_for_display (GdkDisplay *display,
- guint32 xid,
- GdkDragProtocol *protocol)
+GdkNativeWindow
+_gdk_quartz_display_get_drag_protocol (GdkDisplay *display,
+ GdkNativeWindow xid,
+ GdkDragProtocol *protocol,
+ guint *version)
{
/* FIXME: Implement */
return 0;
}
-void
-gdk_drag_find_window_for_screen (GdkDragContext *context,
- GdkWindow *drag_window,
- GdkScreen *screen,
- gint x_root,
- gint y_root,
- GdkWindow **dest_window,
- GdkDragProtocol *protocol)
+static GdkWindow *
+gdk_quartz_drag_context_find_window (GdkDragContext *context,
+ GdkWindow *drag_window,
+ GdkScreen *screen,
+ gint x_root,
+ gint y_root,
+ GdkDragProtocol *protocol)
+{
+ /* FIXME: Implement */
+ return NULL;
+}
+
+static void
+gdk_quartz_drag_context_drag_drop (GdkDragContext *context,
+ guint32 time)
{
/* FIXME: Implement */
}
-void
-gdk_drag_drop (GdkDragContext *context,
- guint32 time)
+static void
+gdk_quartz_drag_context_drag_abort (GdkDragContext *context,
+ guint32 time)
{
/* FIXME: Implement */
}
-void
-gdk_drag_abort (GdkDragContext *context,
- guint32 time)
-{
- g_return_if_fail (context != NULL);
-
- /* FIXME: Implement */
-}
-
-void
-gdk_drag_status (GdkDragContext *context,
- GdkDragAction action,
- guint32 time)
+static void
+gdk_quartz_drag_context_drag_status (GdkDragContext *context,
+ GdkDragAction action,
+ guint32 time)
{
context->action = action;
}
-void
-gdk_drop_reply (GdkDragContext *context,
- gboolean ok,
- guint32 time)
-{
- g_return_if_fail (context != NULL);
-
- /* FIXME: Implement */
-}
-
-void
-gdk_drop_finish (GdkDragContext *context,
- gboolean success,
- guint32 time)
+static void
+gdk_quartz_drag_context_drop_reply (GdkDragContext *context,
+ gboolean ok,
+ guint32 time)
{
/* FIXME: Implement */
}
-void
-gdk_window_register_dnd (GdkWindow *window)
+static void
+gdk_quartz_drag_context_drop_finish (GdkDragContext *context,
+ gboolean success,
+ guint32 time)
{
/* FIXME: Implement */
}
-GdkAtom
-gdk_drag_get_selection (GdkDragContext *context)
+void
+_gdk_quartz_window_register_dnd (GdkWindow *window)
+{
+ /* FIXME: Implement */
+}
+
+static GdkAtom
+gdk_quartz_drag_context_get_selection (GdkDragContext *context)
{
/* FIXME: Implement */
return GDK_NONE;
}
-gboolean
-gdk_drag_drop_succeeded (GdkDragContext *context)
+static gboolean
+gdk_quartz_drag_context_drop_status (GdkDragContext *context)
{
/* FIXME: Implement */
return FALSE;
@@ -264,5 +148,35 @@ gdk_drag_drop_succeeded (GdkDragContext *context)
id
gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context)
{
- return GDK_DRAG_CONTEXT_PRIVATE (context)->dragging_info;
+ return GDK_QUARTZ_DRAG_CONTEXT (context)->dragging_info;
+}
+
+static void
+gdk_quartz_drag_context_init (GdkQuartzDragContext *context)
+{
+}
+
+static void
+gdk_quartz_drag_context_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gdk_quartz_drag_context_parent_class)->finalize (object);
+}
+
+static void
+gdk_quartz_drag_context_class_init (GdkQuartzDragContextClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
+
+ object_class->finalize = gdk_quartz_drag_context_finalize;
+
+ context_class->find_window = gdk_quartz_drag_context_find_window;
+ context_class->drag_status = gdk_quartz_drag_context_drag_status;
+ context_class->drag_motion = gdk_quartz_drag_context_drag_motion;
+ context_class->drag_abort = gdk_quartz_drag_context_drag_abort;
+ context_class->drag_drop = gdk_quartz_drag_context_drag_drop;
+ context_class->drop_reply = gdk_quartz_drag_context_drop_reply;
+ context_class->drop_finish = gdk_quartz_drag_context_drop_finish;
+ context_class->drop_status = gdk_quartz_drag_context_drop_status;
+ context_class->get_selection = gdk_quartz_drag_context_get_selection;
}
diff --git a/gdk/quartz/gdkdnd-quartz.h b/gdk/quartz/gdkdnd-quartz.h
new file mode 100644
index 0000000000..ebe787d0aa
--- /dev/null
+++ b/gdk/quartz/gdkdnd-quartz.h
@@ -0,0 +1,47 @@
+/* gdkdnd-quartz.h
+ *
+ * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GDK_QUARTZ_DND__
+#define __GDK_QUARTZ_DND__
+
+#include
+#include
+
+#include
+
+G_BEGIN_DECLS
+
+struct _GdkQuartzDragContext
+{
+ GdkDragContext context;
+
+ id dragging_info;
+ GdkDevice *device;
+};
+
+struct _GdkQuartzDragContextClass
+{
+ GdkDragContextClass context_class;
+};
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_DND__ */
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
deleted file mode 100644
index 632f0cd009..0000000000
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* gdkdrawable-quartz.c
- *
- * Copyright (C) 2005-2007 Imendio AB
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include
-#include
-#include "gdkprivate-quartz.h"
-
-static gpointer parent_class;
-
-static cairo_user_data_key_t gdk_quartz_cairo_key;
-
-typedef struct {
- GdkDrawable *drawable;
- CGContextRef cg_context;
-} GdkQuartzCairoSurfaceData;
-
-static void
-gdk_quartz_cairo_surface_destroy (void *data)
-{
- GdkQuartzCairoSurfaceData *surface_data = data;
- GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (surface_data->drawable);
-
- impl->cairo_surface = NULL;
-
- gdk_quartz_drawable_release_context (surface_data->drawable,
- surface_data->cg_context);
-
- g_free (surface_data);
-}
-
-static cairo_surface_t *
-gdk_quartz_create_cairo_surface (GdkDrawable *drawable,
- int width,
- int height)
-{
- CGContextRef cg_context;
- GdkQuartzCairoSurfaceData *surface_data;
- cairo_surface_t *surface;
-
- cg_context = gdk_quartz_drawable_get_context (drawable, TRUE);
-
- if (!cg_context)
- return NULL;
-
- surface_data = g_new (GdkQuartzCairoSurfaceData, 1);
- surface_data->drawable = drawable;
- surface_data->cg_context = cg_context;
-
- surface = cairo_quartz_surface_create_for_cg_context (cg_context,
- width, height);
-
- cairo_surface_set_user_data (surface, &gdk_quartz_cairo_key,
- surface_data,
- gdk_quartz_cairo_surface_destroy);
-
- return surface;
-}
-
-static cairo_surface_t *
-gdk_quartz_ref_cairo_surface (GdkDrawable *drawable)
-{
- GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable);
-
- if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable) &&
- GDK_WINDOW_DESTROYED (impl->wrapper))
- return NULL;
-
- if (!impl->cairo_surface)
- {
- impl->cairo_surface =
- gdk_quartz_create_cairo_surface (drawable,
- gdk_window_get_width (impl->wrapper),
- gdk_window_get_height (impl->wrapper));
- }
- else
- cairo_surface_reference (impl->cairo_surface);
-
- return impl->cairo_surface;
-}
-
-static void
-gdk_drawable_impl_quartz_finalize (GObject *object)
-{
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_drawable_impl_quartz_finalize;
-
- drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
- drawable_class->create_cairo_surface = gdk_quartz_create_cairo_surface;
-}
-
-GType
-gdk_drawable_impl_quartz_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkDrawableImplQuartzClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_drawable_impl_quartz_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkDrawableImplQuartz),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (GDK_TYPE_DRAWABLE,
- "GdkDrawableImplQuartz",
- &object_info, 0);
- }
-
- return object_type;
-}
-
-CGContextRef
-gdk_quartz_drawable_get_context (GdkDrawable *drawable,
- gboolean antialias)
-{
- if (!GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS (drawable)->get_context)
- {
- g_warning ("%s doesn't implement GdkDrawableImplQuartzClass::get_context()",
- G_OBJECT_TYPE_NAME (drawable));
- return NULL;
- }
-
- return GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS (drawable)->get_context (drawable, antialias);
-}
-
-void
-gdk_quartz_drawable_release_context (GdkDrawable *drawable,
- CGContextRef cg_context)
-{
- if (!GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS (drawable)->release_context)
- {
- g_warning ("%s doesn't implement GdkDrawableImplQuartzClass::release_context()",
- G_OBJECT_TYPE_NAME (drawable));
- return;
- }
-
- GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS (drawable)->release_context (drawable, cg_context);
-}
-
-/* Help preventing "beam sync penalty" where CG makes all graphics code
- * block until the next vsync if we try to flush (including call display on
- * a view) too often. We do this by limiting the manual flushing done
- * outside of expose calls to less than some frequency when measured over
- * the last 4 flushes. This is a bit arbitray, but seems to make it possible
- * for some quick manual flushes (such as gtkruler or gimp's marching ants)
- * without hitting the max flush frequency.
- *
- * If drawable NULL, no flushing is done, only registering that a flush was
- * done externally.
- */
-void
-_gdk_quartz_drawable_flush (GdkDrawable *drawable)
-{
- static struct timeval prev_tv;
- static gint intervals[4];
- static gint index;
- struct timeval tv;
- gint ms;
-
- gettimeofday (&tv, NULL);
- ms = (tv.tv_sec - prev_tv.tv_sec) * 1000 + (tv.tv_usec - prev_tv.tv_usec) / 1000;
- intervals[index++ % 4] = ms;
-
- if (drawable)
- {
- ms = intervals[0] + intervals[1] + intervals[2] + intervals[3];
-
- /* ~25Hz on average. */
- if (ms > 4*40)
- {
- if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable))
- {
- GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (drawable);
-
- [window_impl->toplevel flushWindow];
- }
-
- prev_tv = tv;
- }
- }
- else
- prev_tv = tv;
-}
-
-void
-_gdk_quartz_drawable_finish (GdkDrawable *drawable)
-{
- GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable);
-
- if (impl->cairo_surface)
- {
- cairo_surface_finish (impl->cairo_surface);
- cairo_surface_set_user_data (impl->cairo_surface, &gdk_quartz_cairo_key,
- NULL, NULL);
- impl->cairo_surface = NULL;
- }
-}
diff --git a/gdk/quartz/gdkdrawable-quartz.h b/gdk/quartz/gdkdrawable-quartz.h
deleted file mode 100644
index 24d17d83ea..0000000000
--- a/gdk/quartz/gdkdrawable-quartz.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* gdkdrawable-quartz.h
- *
- * Copyright (C) 2005 Imendio AB
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GDK_DRAWABLE_QUARTZ_H__
-#define __GDK_DRAWABLE_QUARTZ_H__
-
-#include
-
-#include
-
-G_BEGIN_DECLS
-
-/* Drawable implementation for Quartz
- */
-
-typedef struct _GdkDrawableImplQuartz GdkDrawableImplQuartz;
-typedef struct _GdkDrawableImplQuartzClass GdkDrawableImplQuartzClass;
-
-#define GDK_TYPE_DRAWABLE_IMPL_QUARTZ (gdk_drawable_impl_quartz_get_type ())
-#define GDK_DRAWABLE_IMPL_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE_IMPL_QUARTZ, GdkDrawableImplQuartz))
-#define GDK_DRAWABLE_IMPL_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE_IMPL_QUARTZ, GdkDrawableImplQuartzClass))
-#define GDK_IS_DRAWABLE_IMPL_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL_QUARTZ))
-#define GDK_IS_DRAWABLE_IMPL_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE_IMPL_QUARTZ))
-#define GDK_DRAWABLE_IMPL_QUARTZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE_IMPL_QUARTZ, GdkDrawableImplQuartzClass))
-
-struct _GdkDrawableImplQuartz
-{
- GdkDrawable parent_instance;
-
- GdkDrawable *wrapper;
-
- cairo_surface_t *cairo_surface;
-};
-
-struct _GdkDrawableImplQuartzClass
-{
- GdkDrawableClass parent_class;
-
- /* vtable */
- CGContextRef (*get_context) (GdkDrawable* drawable,
- gboolean antialias);
- void (*release_context) (GdkDrawable *drawable,
- CGContextRef cg_context);
-};
-
-GType gdk_drawable_impl_quartz_get_type (void);
-CGContextRef gdk_quartz_drawable_get_context (GdkDrawable *drawable,
- gboolean antialias);
-void gdk_quartz_drawable_release_context (GdkDrawable *drawable,
- CGContextRef context);
-
-G_END_DECLS
-
-#endif /* __GDK_DRAWABLE_QUARTZ_H__ */
diff --git a/gdk/quartz/gdkeventloop-quartz.c b/gdk/quartz/gdkeventloop-quartz.c
index 71c15b8a95..39f5c0aee3 100644
--- a/gdk/quartz/gdkeventloop-quartz.c
+++ b/gdk/quartz/gdkeventloop-quartz.c
@@ -632,21 +632,20 @@ gdk_event_check (GSource *source)
GDK_THREADS_ENTER ();
- /* XXX: This check isn't right it won't handle a recursive GLib main
- * loop run within an outer CFRunLoop run. Such loops will pile up
- * memory. Fixing this requires setting a flag *only* when we call
- * g_main_context_check() from within the run loop iteraton code,
- * and also maintaining our own stack of run loops... allocating and
- * releasing NSAutoReleasePools not properly nested with CFRunLoop
- * runs seems to cause problems.
- */
- if (current_loop_level == 0)
+/* Refresh the autorelease pool if we're at the base CFRunLoop level
+ * (indicated by current_loop_level) and the base g_main_loop level
+ * (indicated by g_main_depth()). Messing with the autorelease pool at
+ * any level of nesting can cause access to deallocated memory because
+ * autorelease_pool is static and releasing a pool will cause all
+ * pools allocated inside of it to be released as well.
+ */
+ if (current_loop_level == 0 && g_main_depth() == 0)
{
if (autorelease_pool)
[autorelease_pool release];
autorelease_pool = [[NSAutoreleasePool alloc] init];
}
-
+
retval = (_gdk_event_queue_find_first (_gdk_display) != NULL ||
_gdk_quartz_event_loop_check_pending ());
@@ -664,7 +663,7 @@ gdk_event_dispatch (GSource *source,
GDK_THREADS_ENTER ();
- _gdk_events_queue (_gdk_display);
+ _gdk_quartz_display_queue_events (_gdk_display);
event = _gdk_event_unqueue (_gdk_display);
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 44f10cbbf4..348dff1954 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -29,10 +29,13 @@
#import
#include
+#include
+
#include "gdkscreen.h"
#include "gdkkeysyms.h"
+#include "gdkquartzdisplay.h"
#include "gdkprivate-quartz.h"
-#include "gdkdevicemanager-core.h"
+#include "gdkquartzdevicemanager-core.h"
#define GRIP_WIDTH 15
#define GRIP_HEIGHT 15
@@ -52,15 +55,8 @@ static int current_button_state;
static void append_event (GdkEvent *event,
gboolean windowing);
-NSEvent *
-gdk_quartz_event_get_nsevent (GdkEvent *event)
-{
- /* FIXME: If the event here is unallocated, we crash. */
- return ((GdkEventPrivate *) event)->windowing_data;
-}
-
void
-_gdk_events_init (void)
+_gdk_quartz_events_init (void)
{
_gdk_quartz_event_loop_init ();
@@ -68,53 +64,10 @@ _gdk_events_init (void)
}
gboolean
-gdk_events_pending (void)
+_gdk_quartz_display_has_pending (GdkDisplay *display)
{
- return (_gdk_event_queue_find_first (_gdk_display) ||
- (_gdk_quartz_event_loop_check_pending ()));
-}
-
-void
-gdk_device_ungrab (GdkDevice *device,
- guint32 time_)
-{
- GdkDeviceGrabInfo *grab;
-
- grab = _gdk_display_get_last_device_grab (_gdk_display, device);
- if (grab)
- grab->serial_end = 0;
-
- _gdk_display_device_grab_update (_gdk_display, device, 0);
-}
-
-GdkGrabStatus
-_gdk_windowing_device_grab (GdkDevice *device,
- GdkWindow *window,
- GdkWindow *native,
- gboolean owner_events,
- GdkEventMask event_mask,
- GdkWindow *confine_to,
- GdkCursor *cursor,
- guint32 time)
-{
- g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
- g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
-
- if (!window || GDK_WINDOW_DESTROYED (window))
- return GDK_GRAB_NOT_VIEWABLE;
-
- _gdk_display_add_device_grab (_gdk_display,
- device,
- window,
- native,
- GDK_OWNERSHIP_NONE,
- owner_events,
- event_mask,
- 0,
- time,
- FALSE);
-
- return GDK_GRAB_SUCCESS;
+ return (_gdk_event_queue_find_first (display) ||
+ (_gdk_quartz_event_loop_check_pending ()));
}
static void
@@ -137,7 +90,7 @@ break_all_grabs (guint32 time)
grab->implicit_ungrab = TRUE;
}
- _gdk_display_device_grab_update (_gdk_display, l->data, 0);
+ _gdk_display_device_grab_update (_gdk_display, l->data, NULL, 0);
}
g_list_free (list);
@@ -354,13 +307,13 @@ create_focus_event (GdkWindow *window,
gboolean in)
{
GdkEvent *event;
- GdkDeviceManagerCore *device_manager;
+ GdkQuartzDeviceManagerCore *device_manager;
event = gdk_event_new (GDK_FOCUS_CHANGE);
event->focus_change.window = window;
event->focus_change.in = in;
- device_manager = GDK_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
+ device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
gdk_event_set_device (event, device_manager->core_keyboard);
return event;
@@ -374,7 +327,6 @@ generate_motion_event (GdkWindow *window)
NSPoint screen_point;
NSWindow *nswindow;
GdkQuartzView *view;
- GdkWindowObject *private;
GdkEvent *event;
gint x, y, x_root, y_root;
GdkDisplay *display;
@@ -383,8 +335,7 @@ generate_motion_event (GdkWindow *window)
event->any.window = NULL;
event->any.send_event = TRUE;
- private = (GdkWindowObject *)window;
- nswindow = ((GdkWindowImplQuartz *)private->impl)->toplevel;
+ nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
view = (GdkQuartzView *)[nswindow contentView];
display = gdk_window_get_display (window);
@@ -396,7 +347,7 @@ generate_motion_event (GdkWindow *window)
point = [nswindow convertScreenToBase:screen_point];
x = point.x;
- y = private->height - point.y;
+ y = window->height - point.y;
event->any.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
@@ -423,7 +374,7 @@ _gdk_quartz_events_update_focus_window (GdkWindow *window,
if (got_focus && window == current_keyboard_window)
return;
- /* FIXME: Don't do this when grabbed? Or make GdkQuartzWindow
+ /* FIXME: Don't do this when grabbed? Or make GdkQuartzNSWindow
* disallow it in the first place instead?
*/
@@ -464,7 +415,6 @@ _gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
NSPoint point;
NSPoint screen_point;
NSWindow *nswindow;
- GdkWindowObject *private;
GdkEvent *event;
gint x, y, x_root, y_root;
@@ -472,8 +422,7 @@ _gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
event->any.window = NULL;
event->any.send_event = FALSE;
- private = (GdkWindowObject *)window;
- nswindow = ((GdkWindowImplQuartz *)private->impl)->toplevel;
+ nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
screen_point = [NSEvent mouseLocation];
@@ -482,7 +431,7 @@ _gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
point = [nswindow convertScreenToBase:screen_point];
x = point.x;
- y = private->height - point.y;
+ y = window->height - point.y;
event->crossing.window = window;
event->crossing.subwindow = NULL;
@@ -503,13 +452,12 @@ _gdk_quartz_events_send_enter_notify_event (GdkWindow *window)
void
_gdk_quartz_events_send_map_event (GdkWindow *window)
{
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (!impl->toplevel)
return;
- if (private->event_mask & GDK_STRUCTURE_MASK)
+ if (window->event_mask & GDK_STRUCTURE_MASK)
{
GdkEvent event;
@@ -533,17 +481,15 @@ find_toplevel_under_pointer (GdkDisplay *display,
toplevel = info->toplevel_under_pointer;
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
{
- GdkWindowObject *private;
NSWindow *nswindow;
NSPoint point;
- private = (GdkWindowObject *)toplevel;
- nswindow = ((GdkWindowImplQuartz *)private->impl)->toplevel;
+ nswindow = ((GdkWindowImplQuartz *)toplevel->impl)->toplevel;
point = [nswindow convertScreenToBase:screen_point];
*x = point.x;
- *y = private->height - point.y;
+ *y = toplevel->height - point.y;
}
return toplevel;
@@ -599,13 +545,11 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
GdkQuartzView *view;
GdkDisplay *display;
GdkDeviceGrabInfo *grab;
- GdkWindowObject *private;
view = (GdkQuartzView *)[[nsevent window] contentView];
toplevel = [view gdkWindow];
display = gdk_window_get_display (toplevel);
- private = GDK_WINDOW_OBJECT (toplevel);
event_type = [nsevent type];
point = [nsevent locationInWindow];
@@ -657,18 +601,16 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
{
/* Finally check the grab window. */
GdkWindow *grab_toplevel;
- GdkWindowObject *grab_private;
NSWindow *grab_nswindow;
grab_toplevel = gdk_window_get_effective_toplevel (grab->window);
- grab_private = (GdkWindowObject *)grab_toplevel;
- grab_nswindow = ((GdkWindowImplQuartz *)grab_private->impl)->toplevel;
+ grab_nswindow = ((GdkWindowImplQuartz *)grab_toplevel->impl)->toplevel;
point = [grab_nswindow convertScreenToBase:screen_point];
/* Note: x_root and y_root are already right. */
*x = point.x;
- *y = grab_private->height - point.y;
+ *y = grab_toplevel->height - point.y;
return grab_toplevel;
}
@@ -699,13 +641,11 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
if (toplevel_under_pointer
&& WINDOW_IS_TOPLEVEL (toplevel_under_pointer))
{
- GdkWindowObject *toplevel_private;
GdkWindowImplQuartz *toplevel_impl;
toplevel = toplevel_under_pointer;
- toplevel_private = (GdkWindowObject *)toplevel;
- toplevel_impl = (GdkWindowImplQuartz *)toplevel_private->impl;
+ toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
if ([toplevel_impl->toplevel showsResizeIndicator])
{
@@ -756,17 +696,15 @@ find_window_for_ns_event (NSEvent *nsevent,
NSPoint screen_point;
NSEventType event_type;
GdkWindow *toplevel;
- GdkWindowObject *private;
view = (GdkQuartzView *)[[nsevent window] contentView];
toplevel = [view gdkWindow];
- private = GDK_WINDOW_OBJECT (toplevel);
point = [nsevent locationInWindow];
screen_point = [[nsevent window] convertBaseToScreen:point];
*x = point.x;
- *y = private->height - point.y;
+ *y = toplevel->height - point.y;
_gdk_quartz_window_nspoint_to_gdk_xy (screen_point, x_root, y_root);
@@ -934,11 +872,8 @@ fill_scroll_event (GdkWindow *window,
gint y_root,
GdkScrollDirection direction)
{
- GdkWindowObject *private;
NSPoint point;
- private = GDK_WINDOW_OBJECT (window);
-
point = [nsevent locationInWindow];
event->any.type = GDK_SCROLL;
@@ -960,7 +895,7 @@ fill_key_event (GdkWindow *window,
GdkEventType type)
{
GdkEventPrivate *priv;
- GdkDeviceManagerCore *device_manager;
+ GdkQuartzDeviceManagerCore *device_manager;
gchar buf[7];
gunichar c = 0;
@@ -975,10 +910,10 @@ fill_key_event (GdkWindow *window,
event->key.group = ([nsevent modifierFlags] & NSAlternateKeyMask) ? 1 : 0;
event->key.keyval = GDK_KEY_VoidSymbol;
- device_manager = GDK_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
+ device_manager = GDK_QUARTZ_DEVICE_MANAGER_CORE (_gdk_display->device_manager);
gdk_event_set_device (event, device_manager->core_keyboard);
- gdk_keymap_translate_keyboard_state (NULL,
+ gdk_keymap_translate_keyboard_state (gdk_keymap_get_for_display (_gdk_display),
event->key.hardware_keycode,
event->key.state,
event->key.group,
@@ -1083,17 +1018,13 @@ synthesize_crossing_event (GdkWindow *window,
gint x_root,
gint y_root)
{
- GdkWindowObject *private;
-
- private = GDK_WINDOW_OBJECT (window);
-
switch ([nsevent type])
{
case NSMouseEntered:
/* Enter events are considered always to be from the root window as we
* can't know for sure from what window we enter.
*/
- if (!(private->event_mask & GDK_ENTER_NOTIFY_MASK))
+ if (!(window->event_mask & GDK_ENTER_NOTIFY_MASK))
return FALSE;
fill_crossing_event (window, event, nsevent,
@@ -1109,7 +1040,7 @@ synthesize_crossing_event (GdkWindow *window,
* since there is no way to reliably get information about what new
* window is entered when exiting one.
*/
- if (!(private->event_mask & GDK_LEAVE_NOTIFY_MASK))
+ if (!(window->event_mask & GDK_LEAVE_NOTIFY_MASK))
return FALSE;
fill_crossing_event (window, event, nsevent,
@@ -1204,7 +1135,7 @@ gdk_event_translate (GdkEvent *event,
* dragged. This is a workaround for the window getting events for
* the window title.
*/
- if ([(GdkQuartzWindow *)nswindow isInMove])
+ if ([(GdkQuartzNSWindow *)nswindow isInMove])
{
break_all_grabs (get_time_from_ns_event (nsevent));
return FALSE;
@@ -1220,14 +1151,13 @@ gdk_event_translate (GdkEvent *event,
/* Apply any window filters. */
if (GDK_IS_WINDOW (window))
{
- GdkWindowObject *filter_private = (GdkWindowObject *) window;
GdkFilterReturn result;
- if (filter_private->filters)
+ if (window->filters)
{
g_object_ref (window);
- result = gdk_event_apply_filters (nsevent, event, &filter_private->filters);
+ result = gdk_event_apply_filters (nsevent, event, &window->filters);
g_object_unref (window);
@@ -1248,8 +1178,7 @@ gdk_event_translate (GdkEvent *event,
event_type == NSOtherMouseDown ||
event_type == NSLeftMouseDown))
{
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (![NSApp isActive])
{
@@ -1363,7 +1292,7 @@ gdk_event_translate (GdkEvent *event,
}
void
-_gdk_events_queue (GdkDisplay *display)
+_gdk_quartz_display_queue_events (GdkDisplay *display)
{
NSEvent *nsevent;
@@ -1403,60 +1332,35 @@ _gdk_events_queue (GdkDisplay *display)
}
void
-gdk_flush (void)
+_gdk_quartz_display_add_client_message_filter (GdkDisplay *display,
+ GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data)
{
/* Not supported. */
}
-void
-gdk_display_add_client_message_filter (GdkDisplay *display,
- GdkAtom message_type,
- GdkFilterFunc func,
- gpointer data)
-{
- /* Not supported. */
-}
-
-void
-gdk_add_client_message_filter (GdkAtom message_type,
- GdkFilterFunc func,
- gpointer data)
-{
- /* Not supported. */
-}
-
-void
-gdk_display_sync (GdkDisplay *display)
-{
- /* Not supported. */
-}
-
-void
-gdk_display_flush (GdkDisplay *display)
-{
- /* Not supported. */
-}
gboolean
-gdk_event_send_client_message_for_display (GdkDisplay *display,
- GdkEvent *event,
- GdkNativeWindow winid)
+_gdk_quartz_display_send_client_message (GdkDisplay *display,
+ GdkEvent *event,
+ GdkNativeWindow winid)
{
/* Not supported. */
return FALSE;
}
void
-gdk_screen_broadcast_client_message (GdkScreen *screen,
- GdkEvent *event)
+_gdk_quartz_screen_broadcast_client_message (GdkScreen *screen,
+ GdkEvent *event)
{
/* Not supported. */
}
gboolean
-gdk_screen_get_setting (GdkScreen *screen,
- const gchar *name,
- GValue *value)
+_gdk_quartz_screen_get_setting (GdkScreen *screen,
+ const gchar *name,
+ GValue *value)
{
if (strcmp (name, "gtk-double-click-time") == 0)
{
@@ -1513,8 +1417,9 @@ gdk_screen_get_setting (GdkScreen *screen,
}
void
-_gdk_windowing_event_data_copy (const GdkEvent *src,
- GdkEvent *dst)
+_gdk_quartz_display_event_data_copy (GdkDisplay *display,
+ const GdkEvent *src,
+ GdkEvent *dst)
{
GdkEventPrivate *priv_src = (GdkEventPrivate *) src;
GdkEventPrivate *priv_dst = (GdkEventPrivate *) dst;
@@ -1527,7 +1432,8 @@ _gdk_windowing_event_data_copy (const GdkEvent *src,
}
void
-_gdk_windowing_event_data_free (GdkEvent *event)
+_gdk_quartz_display_event_data_free (GdkDisplay *display,
+ GdkEvent *event)
{
GdkEventPrivate *priv = (GdkEventPrivate *) event;
diff --git a/gdk/quartz/gdkgeometry-quartz.c b/gdk/quartz/gdkgeometry-quartz.c
deleted file mode 100644
index bd602e33df..0000000000
--- a/gdk/quartz/gdkgeometry-quartz.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* gdkgeometry-quartz.c
- *
- * Copyright (C) 2005 Imendio AB
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include "gdkprivate-quartz.h"
-
-void
-_gdk_quartz_window_translate (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy)
-{
- cairo_region_t *invalidate, *scrolled;
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)private->impl;
- GdkRectangle extents;
-
- cairo_region_get_extents (area, &extents);
-
- [impl->view scrollRect:NSMakeRect (extents.x - dx, extents.y - dy,
- extents.width, extents.height)
- by:NSMakeSize (dx, dy)];
-
- if (impl->needs_display_region)
- {
- cairo_region_t *intersection;
-
- /* Invalidate already invalidated area that was moved at new
- * location.
- */
- intersection = cairo_region_copy (impl->needs_display_region);
- cairo_region_intersect (intersection, area);
- cairo_region_translate (intersection, dx, dy);
-
- _gdk_quartz_window_set_needs_display_in_region (window, intersection);
- cairo_region_destroy (intersection);
- }
-
- /* Calculate newly exposed area that needs invalidation */
- scrolled = cairo_region_copy (area);
- cairo_region_translate (scrolled, dx, dy);
-
- invalidate = cairo_region_copy (area);
- cairo_region_subtract (invalidate, scrolled);
- cairo_region_destroy (scrolled);
-
- _gdk_quartz_window_set_needs_display_in_region (window, invalidate);
- cairo_region_destroy (invalidate);
-}
-
-gboolean
-_gdk_quartz_window_queue_antiexpose (GdkWindow *window,
- cairo_region_t *area)
-{
- return FALSE;
-}
diff --git a/gdk/quartz/gdkinput-old.c b/gdk/quartz/gdkinput-old.c
deleted file mode 100644
index 3ed0609d5a..0000000000
--- a/gdk/quartz/gdkinput-old.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/* gdkinput.c
- *
- * Copyright (C) 2005 Imendio AB
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include "gdkinput.h"
-
-GType
-gdk_device_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkDeviceClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) NULL,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkDevicePrivate),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkDevice",
- &object_info, 0);
- }
-
- return object_type;
-}
-
-void
-gdk_device_set_key (GdkDevice *device,
- guint index,
- guint keyval,
- GdkModifierType modifiers)
-{
- /* FIXME: Implement */
-}
-
-gboolean
-gdk_device_get_axis (GdkDevice *device, gdouble *axes, GdkAxisUse use, gdouble *value)
-{
- /* FIXME: Implement */
- return FALSE;
-}
-
diff --git a/gdk/quartz/gdkinput.c b/gdk/quartz/gdkinput.c
deleted file mode 100644
index 31d1bd2c18..0000000000
--- a/gdk/quartz/gdkinput.c
+++ /dev/null
@@ -1,287 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-#include
-
-#include "gdkprivate-quartz.h"
-#include "gdkinput.h"
-#include "gdkprivate.h"
-#include "gdkinputprivate.h"
-#include
-#include
-
-/* Addition used for extension_events mask */
-#define GDK_ALL_DEVICES_MASK (1<<30)
-
-GdkDevice *_gdk_core_pointer = NULL;
-
-/* Global variables */
-
-gchar *_gdk_input_gxid_host;
-gint _gdk_input_gxid_port;
-gint _gdk_input_ignore_core;
-GList *_gdk_input_windows;
-GList *_gdk_input_devices;
-
-
-GList *
-gdk_devices_list (void)
-{
- return _gdk_input_devices;
-}
-
-GList *
-gdk_display_list_devices (GdkDisplay *dpy)
-{
- return _gdk_input_devices;
-}
-
-static void
-_gdk_input_select_device_events (GdkWindow *impl_window,
- GdkDevice *device)
-{
- guint event_mask;
- GdkWindowObject *w;
- GdkInputWindow *iw;
- GdkInputMode mode;
- gboolean has_cursor;
- GdkDeviceType type;
- GList *l;
-
- event_mask = 0;
- iw = ((GdkWindowObject *)impl_window)->input_window;
-
- g_object_get (device,
- "type", &type,
- "input-mode", &mode,
- "has-cursor", &has_cursor,
- NULL);
-
- if (iw == NULL ||
- mode == GDK_MODE_DISABLED ||
- type == GDK_DEVICE_TYPE_MASTER)
- return;
-
- for (l = _gdk_input_windows; l != NULL; l = l->next)
- {
- w = l->data;
-
- if (has_cursor || (w->extension_events & GDK_ALL_DEVICES_MASK))
- {
- event_mask = w->extension_events;
-
- if (event_mask)
- event_mask |= GDK_PROXIMITY_OUT_MASK
- | GDK_BUTTON_PRESS_MASK
- | GDK_BUTTON_RELEASE_MASK;
-
- gdk_window_set_device_events ((GdkWindow *) w, device, event_mask);
- }
- }
-}
-
-gint
-_gdk_input_enable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- return TRUE;
-}
-
-gint
-_gdk_input_disable_window (GdkWindow *window, GdkDevicePrivate *gdkdev)
-{
- return TRUE;
-}
-
-
-GdkInputWindow *
-_gdk_input_window_find(GdkWindow *window)
-{
- GList *tmp_list;
-
- for (tmp_list=_gdk_input_windows; tmp_list; tmp_list=tmp_list->next)
- if (((GdkInputWindow *)(tmp_list->data))->window == window)
- return (GdkInputWindow *)(tmp_list->data);
-
- return NULL; /* Not found */
-}
-
-/* FIXME: this routine currently needs to be called between creation
- and the corresponding configure event (because it doesn't get the
- root_relative_geometry). This should work with
- gtk_window_set_extension_events, but will likely fail in other
- cases */
-
-void
-gdk_input_set_extension_events (GdkWindow *window,
- gint mask,
- GdkExtensionMode mode)
-{
- GdkWindowObject *window_private;
- GdkWindowObject *impl_window;
- GList *tmp_list;
- GdkInputWindow *iw;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GDK_WINDOW_IS_QUARTZ (window));
-
- window_private = (GdkWindowObject*) window;
- impl_window = (GdkWindowObject *)_gdk_window_get_impl_window (window);
-
- if (mode == GDK_EXTENSION_EVENTS_NONE)
- mask = 0;
-
- if (mask != 0)
- {
- iw = g_new (GdkInputWindow, 1);
-
- iw->window = window;
- iw->mode = mode;
-
- iw->obscuring = NULL;
- iw->num_obscuring = 0;
- iw->grabbed = FALSE;
-
- _gdk_input_windows = g_list_append (_gdk_input_windows, iw);
- window_private->extension_events = mask;
-
- /* Add enter window events to the event mask */
- /* FIXME, this is not needed for XINPUT_NONE */
- gdk_window_set_events (window,
- gdk_window_get_events (window) |
- GDK_ENTER_NOTIFY_MASK);
- }
- else
- {
- iw = _gdk_input_window_find (window);
- if (iw)
- {
- _gdk_input_windows = g_list_remove (_gdk_input_windows,iw);
- g_free (iw);
- }
-
- window_private->extension_events = 0;
- }
-
- for (tmp_list = _gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- GdkDevice *dev = tmp_list->data;
-
- _gdk_input_select_device_events (GDK_WINDOW (impl_window), dev);
- }
-}
-
-void
-_gdk_input_window_destroy (GdkWindow *window)
-{
- GdkInputWindow *input_window;
-
- input_window = _gdk_input_window_find (window);
- g_return_if_fail (input_window != NULL);
-
- _gdk_input_windows = g_list_remove (_gdk_input_windows,input_window);
- g_free (input_window);
-}
-
-void
-_gdk_input_check_extension_events (GdkDevice *device)
-{
-}
-
-void
-_gdk_input_init (void)
-{
- GdkDeviceManager *device_manager;
- GList *list, *l;
-
- device_manager = gdk_display_get_device_manager (_gdk_display);
-
- /* For backward compatibility, just add floating devices that are
- * not keyboards.
- */
- list = gdk_device_manager_list_devices (device_manager,
- GDK_DEVICE_TYPE_FLOATING);
- for (l = list; l; l = l->next)
- {
- GdkDevice *device = l->data;
-
- if (gdk_device_get_source(device) == GDK_SOURCE_KEYBOARD)
- continue;
-
- _gdk_input_devices = g_list_prepend (_gdk_input_devices, l->data);
- }
-
- g_list_free (list);
-
- /* Now set "core" pointer to the first master device that is a pointer.
- */
- list = gdk_device_manager_list_devices (device_manager,
- GDK_DEVICE_TYPE_MASTER);
-
- for (l = list; l; l = l->next)
- {
- GdkDevice *device = list->data;
-
- if (gdk_device_get_source(device) != GDK_SOURCE_MOUSE)
- continue;
-
- _gdk_display->core_pointer = device;
- break;
- }
-
- g_list_free (list);
-
- /* Add the core pointer to the devices list */
- _gdk_input_devices = g_list_prepend (_gdk_input_devices,
- _gdk_display->core_pointer);
-
- _gdk_input_ignore_core = FALSE;
-}
-
-void
-_gdk_input_exit (void)
-{
- GList *tmp_list;
- GdkDevicePrivate *gdkdev;
-
- for (tmp_list = _gdk_input_devices; tmp_list; tmp_list = tmp_list->next)
- {
- gdkdev = (GdkDevicePrivate *)(tmp_list->data);
- if (gdkdev != (GdkDevicePrivate *)_gdk_core_pointer)
- {
- gdk_device_set_mode ((GdkDevice *)gdkdev, GDK_MODE_DISABLED);
- g_object_unref(gdkdev);
- }
- }
-
- g_list_free (_gdk_input_devices);
-
- for (tmp_list = _gdk_input_windows; tmp_list; tmp_list = tmp_list->next)
- {
- g_free (tmp_list->data);
- }
- g_list_free (_gdk_input_windows);
-}
diff --git a/gdk/quartz/gdkinputprivate.h b/gdk/quartz/gdkinputprivate.h
deleted file mode 100644
index 7ba4293a8e..0000000000
--- a/gdk/quartz/gdkinputprivate.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GDK_INPUTPRIVATE_H__
-#define __GDK_INPUTPRIVATE_H__
-
-#include "config.h"
-#include "gdkinput.h"
-#include "gdkevents.h"
-#include "gdkquartz.h"
-
-typedef struct _GdkAxisInfo GdkAxisInfo;
-typedef struct _GdkInputVTable GdkInputVTable;
-
-struct _GdkInputVTable {
- gint (*set_mode) (guint32 deviceid, GdkInputMode mode);
- void (*set_axes) (guint32 deviceid, GdkAxisUse *axes);
- void (*set_key) (guint32 deviceid,
- guint index,
- guint keyval,
- GdkModifierType modifiers);
-
- GdkTimeCoord* (*motion_events) (GdkWindow *window,
- guint32 deviceid,
- guint32 start,
- guint32 stop,
- gint *nevents_return);
- void (*get_pointer) (GdkWindow *window,
- guint32 deviceid,
- gdouble *x,
- gdouble *y,
- gdouble *pressure,
- gdouble *xtilt,
- gdouble *ytilt,
- GdkModifierType *mask);
- gint (*grab_pointer) (GdkWindow * window,
- gint owner_events,
- GdkEventMask event_mask,
- GdkWindow * confine_to,
- guint32 time);
- void (*ungrab_pointer) (guint32 time);
-
- void (*configure_event) (GdkEventConfigure *event, GdkWindow *window);
- void (*enter_event) (GdkEventCrossing *event, GdkWindow *window);
- gint (*other_event) (GdkEvent *event, GdkWindow *window);
- /* Handle an unidentified event. Returns TRUE if handled, FALSE
- otherwise */
- gint (*window_none_event) (GdkEvent *event);
- gint (*enable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
- gint (*disable_window) (GdkWindow *window, GdkDevicePrivate *gdkdev);
-};
-
-/* information about a device axis */
-struct _GdkAxisInfo
-{
- /* reported x resolution */
- gint xresolution;
-
- /* reported x minimum/maximum values */
- gint xmin_value, xmax_value;
-
- /* calibrated resolution (for aspect ration) - only relative values
- between axes used */
- gint resolution;
-
- /* calibrated minimum/maximum values */
- gint min_value, max_value;
-};
-
-#define GDK_INPUT_NUM_EVENTC 6
-
-struct _GdkDevicePrivate {
- GdkDevice info;
-};
-
-struct _GdkInputWindow
-{
- /* gdk window */
- GdkWindow *window;
-
- /* Extension mode (GDK_EXTENSION_EVENTS_ALL/CURSOR) */
- GdkExtensionMode mode;
-
- /* position relative to root window */
- gint root_x;
- gint root_y;
-
- /* rectangles relative to window of windows obscuring this one */
- GdkRectangle *obscuring;
- gint num_obscuring;
-
- /* Is there a pointer grab for this window ? */
- gint grabbed;
-};
-
-/* Global data */
-
-extern const GdkDevice gdk_input_core_info;
-extern GdkDevice *_gdk_core_pointer;
-extern GList *_gdk_input_devices;
-extern GList *_gdk_input_windows;
-
-extern GdkInputVTable gdk_input_vtable;
-/* information about network port and host for gxid daemon */
-extern gchar *_gdk_input_gxid_host;
-extern gint _gdk_input_gxid_port;
-extern gint _gdk_input_ignore_core;
-
-/* Function declarations */
-
-GdkInputWindow * _gdk_input_window_find (GdkWindow *window);
-void _gdk_input_window_destroy (GdkWindow *window);
-void _gdk_input_init (void);
-void _gdk_input_exit (void);
-gint _gdk_input_enable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-gint _gdk_input_disable_window (GdkWindow *window,
- GdkDevicePrivate *gdkdev);
-void _gdk_init_input_core (void);
-
-void _gdk_input_window_crossing (GdkWindow *window,
- gboolean enter);
-
-void _gdk_input_exit (void);
-
-#endif /* __GDK_INPUTPRIVATE_H__ */
diff --git a/gdk/quartz/gdkkeys-quartz.c b/gdk/quartz/gdkkeys-quartz.c
index a077bfa225..768d10d58c 100644
--- a/gdk/quartz/gdkkeys-quartz.c
+++ b/gdk/quartz/gdkkeys-quartz.c
@@ -54,6 +54,8 @@
#include
#include
#include "gdk.h"
+#include "gdkquartzkeys.h"
+#include "gdkkeysprivate.h"
#include "gdkkeysyms.h"
#define NUM_KEYCODES 128
@@ -61,6 +63,27 @@
static GdkKeymap *default_keymap = NULL;
+struct _GdkQuartzKeymap
+{
+ GdkKeymap keymap;
+};
+
+struct _GdkQuartzKeymapClass
+{
+ GdkKeymapClass keymap_class;
+};
+
+G_DEFINE_TYPE (GdkQuartzKeymap, gdk_quartz_keymap, GDK_TYPE_KEYMAP)
+
+GdkKeymap *
+_gdk_quartz_display_get_keymap (GdkDisplay *display)
+{
+ if (default_keymap == NULL)
+ default_keymap = g_object_new (gdk_quartz_keymap_get_type (), NULL);
+
+ return default_keymap;
+}
+
/* Note: we could check only if building against the 10.5 SDK instead, but
* that would make non-xml layouts not work in 32-bit which would be a quite
* bad regression. This way, old unsupported layouts will just not work in
@@ -420,58 +443,42 @@ maybe_update_keymap (void)
}
}
-GdkKeymap *
-gdk_keymap_get_for_display (GdkDisplay *display)
-{
- g_return_val_if_fail (display == gdk_display_get_default (), NULL);
-
- if (default_keymap == NULL)
- default_keymap = g_object_new (gdk_keymap_get_type (), NULL);
-
- return default_keymap;
-}
-
-PangoDirection
-gdk_keymap_get_direction (GdkKeymap *keymap)
+static PangoDirection
+gdk_quartz_keymap_get_direction (GdkKeymap *keymap)
{
return PANGO_DIRECTION_NEUTRAL;
}
-gboolean
-gdk_keymap_have_bidi_layouts (GdkKeymap *keymap)
+static gboolean
+gdk_quartz_keymap_have_bidi_layouts (GdkKeymap *keymap)
{
/* FIXME: Can we implement this? */
return FALSE;
}
-gboolean
-gdk_keymap_get_caps_lock_state (GdkKeymap *keymap)
+static gboolean
+gdk_quartz_keymap_get_caps_lock_state (GdkKeymap *keymap)
{
/* FIXME: Implement this. */
return FALSE;
}
-gboolean
-gdk_keymap_get_num_lock_state (GdkKeymap *keymap)
+static gboolean
+gdk_quartz_keymap_get_num_lock_state (GdkKeymap *keymap)
{
/* FIXME: Implement this. */
return FALSE;
}
-gboolean
-gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
- guint keyval,
- GdkKeymapKey **keys,
- gint *n_keys)
+static gboolean
+gdk_quartz_keymap_get_entries_for_keyval (GdkKeymap *keymap,
+ guint keyval,
+ GdkKeymapKey **keys,
+ gint *n_keys)
{
GArray *keys_array;
int i;
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
- g_return_val_if_fail (keys != NULL, FALSE);
- g_return_val_if_fail (n_keys != NULL, FALSE);
- g_return_val_if_fail (keyval != 0, FALSE);
-
maybe_update_keymap ();
*n_keys = 0;
@@ -498,20 +505,17 @@ gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
return *n_keys > 0;;
}
-gboolean
-gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
- guint hardware_keycode,
- GdkKeymapKey **keys,
- guint **keyvals,
- gint *n_entries)
+static gboolean
+gdk_quartz_keymap_get_entries_for_keycode (GdkKeymap *keymap,
+ guint hardware_keycode,
+ GdkKeymapKey **keys,
+ guint **keyvals,
+ gint *n_entries)
{
GArray *keys_array, *keyvals_array;
int i;
guint *p;
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
- g_return_val_if_fail (n_entries != NULL, FALSE);
-
maybe_update_keymap ();
*n_entries = 0;
@@ -562,14 +566,10 @@ gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
return *n_entries > 0;
}
-guint
-gdk_keymap_lookup_key (GdkKeymap *keymap,
- const GdkKeymapKey *key)
+static guint
+gdk_quartz_keymap_lookup_key (GdkKeymap *keymap,
+ const GdkKeymapKey *key)
{
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), 0);
- g_return_val_if_fail (key != NULL, 0);
- g_return_val_if_fail (key->group < 4, 0);
-
/* FIXME: Implement */
return 0;
@@ -609,23 +609,20 @@ translate_keysym (guint hardware_keycode,
return tmp_keyval;
}
-gboolean
-gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
- guint hardware_keycode,
- GdkModifierType state,
- gint group,
- guint *keyval,
- gint *effective_group,
- gint *level,
- GdkModifierType *consumed_modifiers)
+static gboolean
+gdk_quartz_keymap_translate_keyboard_state (GdkKeymap *keymap,
+ guint hardware_keycode,
+ GdkModifierType state,
+ gint group,
+ guint *keyval,
+ gint *effective_group,
+ gint *level,
+ GdkModifierType *consumed_modifiers)
{
guint tmp_keyval;
GdkModifierType bit;
guint tmp_modifiers = 0;
- g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
- g_return_val_if_fail (group >= 0 && group <= 1, FALSE);
-
maybe_update_keymap ();
if (keyval)
@@ -659,16 +656,16 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
return TRUE;
}
-void
-gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
- GdkModifierType *state)
+static void
+gdk_quartz_keymap_add_virtual_modifiers (GdkKeymap *keymap,
+ GdkModifierType *state)
{
/* FIXME: For now, we've mimiced the Windows backend. */
}
-gboolean
-gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
- GdkModifierType *state)
+static gboolean
+gdk_quartz_keymap_map_virtual_modifiers (GdkKeymap *keymap,
+ GdkModifierType *state)
{
/* FIXME: For now, we've mimiced the Windows backend. */
return TRUE;
@@ -733,3 +730,34 @@ _gdk_quartz_keys_is_modifier (guint keycode)
return FALSE;
}
+
+static void
+gdk_quartz_keymap_init (GdkQuartzKeymap *keymap)
+{
+}
+
+static void
+gdk_quartz_keymap_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gdk_quartz_keymap_parent_class)->finalize (object);
+}
+
+static void
+gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass);
+
+ object_class->finalize = gdk_quartz_keymap_finalize;
+
+ keymap_class->get_direction = gdk_quartz_keymap_get_direction;
+ keymap_class->have_bidi_layouts = gdk_quartz_keymap_have_bidi_layouts;
+ keymap_class->get_caps_lock_state = gdk_quartz_keymap_get_caps_lock_state;
+ keymap_class->get_num_lock_state = gdk_quartz_keymap_get_num_lock_state;
+ keymap_class->get_entries_for_keyval = gdk_quartz_keymap_get_entries_for_keyval;
+ keymap_class->get_entries_for_keycode = gdk_quartz_keymap_get_entries_for_keycode;
+ keymap_class->lookup_key = gdk_quartz_keymap_lookup_key;
+ keymap_class->translate_keyboard_state = gdk_quartz_keymap_translate_keyboard_state;
+ keymap_class->add_virtual_modifiers = gdk_quartz_keymap_add_virtual_modifiers;
+ keymap_class->map_virtual_modifiers = gdk_quartz_keymap_map_virtual_modifiers;
+}
diff --git a/gdk/quartz/gdkmain-quartz.c b/gdk/quartz/gdkmain-quartz.c
deleted file mode 100644
index 6e84756907..0000000000
--- a/gdk/quartz/gdkmain-quartz.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* gdkmain-quartz.c
- *
- * Copyright (C) 2005 Imendio AB
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include
-
-#include "gdk.h"
-#include
-
-const GOptionEntry _gdk_windowing_args[] = {
- { NULL }
-};
-
-void
-_gdk_windowing_init (void)
-{
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- void (*_gtk_quartz_framework_init_ptr) (void);
-
- /* Make the current process a foreground application, i.e. an app
- * with a user interface, in case we're not running from a .app bundle
- */
- TransformProcessType (&psn, kProcessTransformToForegroundApplication);
-
- /* Initialize GTK+ framework if there is one. */
- _gtk_quartz_framework_init_ptr = dlsym (RTLD_DEFAULT, "_gtk_quartz_framework_init");
- if (_gtk_quartz_framework_init_ptr)
- _gtk_quartz_framework_init_ptr ();
-}
-
-void
-gdk_error_trap_push (void)
-{
-}
-
-gint
-gdk_error_trap_pop (void)
-{
- return 0;
-}
-
-void
-gdk_error_trap_pop_ignored (void)
-{
-}
-
-gchar *
-gdk_get_display (void)
-{
- return g_strdup (gdk_display_get_name (gdk_display_get_default ()));
-}
-
-void
-gdk_notify_startup_complete (void)
-{
- /* FIXME: Implement? */
-}
-
-void
-gdk_notify_startup_complete_with_id (const gchar* startup_id)
-{
- /* FIXME: Implement? */
-}
-
-void
-gdk_window_set_startup_id (GdkWindow *window,
- const gchar *startup_id)
-{
- /* FIXME: Implement? */
-}
-
-void
-_gdk_windowing_display_set_sm_client_id (GdkDisplay *display,
- const gchar *sm_client_id)
-{
-}
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index ca9eae30b1..44f186a425 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -25,8 +25,11 @@
#define GDK_QUARTZ_RELEASE_POOL [pool release]
#include
-#include
#include
+#include
+#include
+#include
+#include
#include
@@ -34,50 +37,191 @@
#include "config.h"
-#define GDK_DRAG_CONTEXT_PRIVATE(context) ((GdkDragContextPrivate *) GDK_DRAG_CONTEXT (context)->windowing_data)
-
-typedef struct _GdkCursorPrivate GdkCursorPrivate;
-typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
-
-struct _GdkVisualClass
-{
- GObjectClass parent_class;
-};
-
-struct _GdkCursorPrivate
-{
- GdkCursor cursor;
- NSCursor *nscursor;
-};
-
-struct _GdkDragContextPrivate
-{
- id dragging_info;
- GdkDevice *device;
-};
-
extern GdkDisplay *_gdk_display;
extern GdkScreen *_gdk_screen;
extern GdkWindow *_gdk_root;
extern GdkDragContext *_gdk_quartz_drag_source_context;
-#define GDK_WINDOW_IS_QUARTZ(win) (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindowObject *)win)->impl))
+#define GDK_WINDOW_IS_QUARTZ(win) (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindow *)win)->impl))
/* Initialization */
-void _gdk_windowing_update_window_sizes (GdkScreen *screen);
-void _gdk_windowing_window_init (void);
-void _gdk_events_init (void);
-void _gdk_visual_init (void);
-void _gdk_input_init (void);
+void _gdk_quartz_window_init_windowing (GdkDisplay *display,
+ GdkScreen *screen);
+void _gdk_quartz_events_init (void);
void _gdk_quartz_event_loop_init (void);
-/* GC */
+/* Cursor */
+NSCursor *_gdk_quartz_cursor_get_ns_cursor (GdkCursor *cursor);
+
+/* Events */
typedef enum {
- GDK_QUARTZ_CONTEXT_STROKE = 1 << 0,
- GDK_QUARTZ_CONTEXT_FILL = 1 << 1,
- GDK_QUARTZ_CONTEXT_TEXT = 1 << 2
-} GdkQuartzContextValuesMask;
+ GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
+} GdkQuartzEventSubType;
+
+void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
+ gboolean got_focus);
+void _gdk_quartz_events_send_map_event (GdkWindow *window);
+GdkEventMask _gdk_quartz_events_get_current_event_mask (void);
+
+void _gdk_quartz_events_send_enter_notify_event (GdkWindow *window);
+
+/* Event loop */
+gboolean _gdk_quartz_event_loop_check_pending (void);
+NSEvent * _gdk_quartz_event_loop_get_pending (void);
+void _gdk_quartz_event_loop_release_event (NSEvent *event);
+
+/* Keys */
+GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
+gboolean _gdk_quartz_keys_is_modifier (guint keycode);
+
+/* Drag and Drop */
+void _gdk_quartz_window_register_dnd (GdkWindow *window);
+GdkDragContext * _gdk_quartz_window_drag_begin (GdkWindow *window,
+ GdkDevice *device,
+ GList *targets);
+
+/* Display */
+
+GdkDisplay * _gdk_quartz_display_open (const gchar *name);
+
+/* Display methods - events */
+void _gdk_quartz_display_queue_events (GdkDisplay *display);
+gboolean _gdk_quartz_display_has_pending (GdkDisplay *display);
+
+void _gdk_quartz_display_event_data_copy (GdkDisplay *display,
+ const GdkEvent *src,
+ GdkEvent *dst);
+void _gdk_quartz_display_event_data_free (GdkDisplay *display,
+ GdkEvent *event);
+
+gboolean _gdk_quartz_display_send_client_message (GdkDisplay *display,
+ GdkEvent *event,
+ GdkNativeWindow winid);
+void _gdk_quartz_display_add_client_message_filter (GdkDisplay *display,
+ GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data);
+
+/* Display methods - cursor */
+GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
+ GdkCursorType type);
+GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
+ const gchar *name);
+GdkCursor *_gdk_quartz_display_get_cursor_for_pixbuf (GdkDisplay *display,
+ GdkPixbuf *pixbuf,
+ gint x,
+ gint y);
+gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display);
+gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display);
+void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height);
+void _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height);
+
+/* Display methods - window */
+void _gdk_quartz_display_before_process_all_updates (GdkDisplay *display);
+void _gdk_quartz_display_after_process_all_updates (GdkDisplay *display);
+void _gdk_quartz_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
+
+/* Display methods - keymap */
+GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display);
+
+/* Display methods - Drag and Drop */
+GdkNativeWindow _gdk_quartz_display_get_drag_protocol (GdkDisplay *display,
+ GdkNativeWindow xid,
+ GdkDragProtocol *protocol,
+ guint *version);
+
+/* Display methods - selection */
+gboolean _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
+ GdkWindow *owner,
+ GdkAtom selection,
+ guint32 time,
+ gboolean send_event);
+GdkWindow * _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
+ GdkAtom selection);
+void _gdk_quartz_display_send_selection_notify (GdkDisplay *display,
+ GdkNativeWindow requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ GdkAtom property,
+ guint32 time);
+gint _gdk_quartz_display_get_selection_property (GdkDisplay *display,
+ GdkWindow *requestor,
+ guchar **data,
+ GdkAtom *ret_type,
+ gint *ret_format);
+void _gdk_quartz_display_convert_selection (GdkDisplay *display,
+ GdkWindow *requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ guint32 time);
+gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
+ GdkAtom encoding,
+ gint format,
+ const guchar *text,
+ gint length,
+ gchar ***list);
+gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
+ const gchar *str);
+
+
+/* Display manager */
+void _gdk_quartz_display_manager_add_display (GdkDisplayManager *manager,
+ GdkDisplay *display);
+void _gdk_quartz_display_manager_remove_display (GdkDisplayManager *manager,
+ GdkDisplay *display);
+
+/* Display manager methods - events */
+GdkAtom _gdk_quartz_display_manager_atom_intern (GdkDisplayManager *manager,
+ const gchar *atom_name,
+ gboolean copy_name);
+gchar * _gdk_quartz_display_manager_get_atom_name (GdkDisplayManager *manager,
+ GdkAtom atom);
+
+/* Screen */
+GdkScreen *_gdk_quartz_screen_new (void);
+void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
+
+/* Screen methods - visual */
+GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen);
+GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
+gint _gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen);
+GdkVisualType _gdk_quartz_screen_visual_get_best_type (GdkScreen *screen);
+GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
+GdkVisual* _gdk_quartz_screen_visual_get_best (GdkScreen *screen);
+GdkVisual* _gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
+ gint depth);
+GdkVisual* _gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
+ GdkVisualType visual_type);
+GdkVisual* _gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
+ gint depth,
+ GdkVisualType visual_type);
+void _gdk_quartz_screen_query_depths (GdkScreen *screen,
+ gint **depths,
+ gint *count);
+void _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
+ GdkVisualType **visual_types,
+ gint *count);
+void _gdk_quartz_screen_init_visuals (GdkScreen *screen);
+GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen);
+
+/* Screen methods - events */
+void _gdk_quartz_screen_broadcast_client_message (GdkScreen *screen,
+ GdkEvent *event);
+gboolean _gdk_quartz_screen_get_setting (GdkScreen *screen,
+ const gchar *name,
+ GValue *value);
+
/* Window */
gboolean _gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
@@ -104,45 +248,44 @@ void _gdk_quartz_window_did_resign_main (GdkWindow *window);
void _gdk_quartz_window_debug_highlight (GdkWindow *window,
gint number);
-void _gdk_quartz_window_set_needs_display_in_region (GdkWindow *window,
- cairo_region_t *region);
-
void _gdk_quartz_window_update_position (GdkWindow *window);
-/* Events */
-typedef enum {
- GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
-} GdkQuartzEventSubType;
-void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
- gboolean got_focus);
-void _gdk_quartz_events_send_map_event (GdkWindow *window);
-GdkEventMask _gdk_quartz_events_get_current_event_mask (void);
+/* Window methods - testing */
+void _gdk_quartz_window_sync_rendering (GdkWindow *window);
+gboolean _gdk_quartz_window_simulate_key (GdkWindow *window,
+ gint x,
+ gint y,
+ guint keyval,
+ GdkModifierType modifiers,
+ GdkEventType key_pressrelease);
+gboolean _gdk_quartz_window_simulate_button (GdkWindow *window,
+ gint x,
+ gint y,
+ guint button,
+ GdkModifierType modifiers,
+ GdkEventType button_pressrelease);
-void _gdk_quartz_events_send_enter_notify_event (GdkWindow *window);
+/* Window methods - property */
+gboolean _gdk_quartz_window_get_property (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gulong offset,
+ gulong length,
+ gint pdelete,
+ GdkAtom *actual_property_type,
+ gint *actual_format_type,
+ gint *actual_length,
+ guchar **data);
+void _gdk_quartz_window_change_property (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gint format,
+ GdkPropMode mode,
+ const guchar *data,
+ gint nelements);
+void _gdk_quartz_window_delete_property (GdkWindow *window,
+ GdkAtom property);
-/* Event loop */
-gboolean _gdk_quartz_event_loop_check_pending (void);
-NSEvent * _gdk_quartz_event_loop_get_pending (void);
-void _gdk_quartz_event_loop_release_event (NSEvent *event);
-
-/* Keys */
-GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
-gboolean _gdk_quartz_keys_is_modifier (guint keycode);
-
-/* Drawable */
-void _gdk_quartz_drawable_finish (GdkDrawable *drawable);
-void _gdk_quartz_drawable_flush (GdkDrawable *drawable);
-
-/* Geometry */
-void _gdk_quartz_window_scroll (GdkWindow *window,
- gint dx,
- gint dy);
-void _gdk_quartz_window_translate (GdkWindow *window,
- cairo_region_t *area,
- gint dx,
- gint dy);
-gboolean _gdk_quartz_window_queue_antiexpose (GdkWindow *window,
- cairo_region_t *area);
#endif /* __GDK_PRIVATE_QUARTZ_H__ */
diff --git a/gdk/quartz/gdkproperty-quartz.c b/gdk/quartz/gdkproperty-quartz.c
index 3496b5c1db..40a45cc991 100644
--- a/gdk/quartz/gdkproperty-quartz.c
+++ b/gdk/quartz/gdkproperty-quartz.c
@@ -151,61 +151,56 @@ intern_atom_internal (const gchar *atom_name, gboolean allocate)
}
GdkAtom
-gdk_atom_intern (const gchar *atom_name,
- gboolean only_if_exists)
+_gdk_quartz_display_manager_atom_intern (GdkDisplayManager *manager,
+ const gchar *atom_name,
+ gboolean copy_name)
{
- return intern_atom_internal (atom_name, TRUE);
+ return intern_atom_internal (atom_name, copy_name);
}
-GdkAtom
-gdk_atom_intern_static_string (const gchar *atom_name)
-{
- return intern_atom_internal (atom_name, FALSE);
-}
-
-
gchar *
-gdk_atom_name (GdkAtom atom)
+_gdk_quartz_display_manager_get_atom_name (GdkDisplayManager *manager,
+ GdkAtom atom)
{
ensure_atom_tables ();
-
+
if (GPOINTER_TO_INT (atom) >= atoms_to_names->len)
return NULL;
-
+
return g_strdup (g_ptr_array_index (atoms_to_names, GPOINTER_TO_INT (atom)));
}
void
-gdk_property_delete (GdkWindow *window,
- GdkAtom property)
+_gdk_quartz_window_delete_property (GdkWindow *window,
+ GdkAtom property)
{
/* FIXME: Implement */
}
gint
-gdk_property_get (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gulong offset,
- gulong length,
- gint pdelete,
- GdkAtom *actual_property_type,
- gint *actual_format_type,
- gint *actual_length,
- guchar **data)
+_gdk_quartz_window_get_property (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gulong offset,
+ gulong length,
+ gint pdelete,
+ GdkAtom *actual_property_type,
+ gint *actual_format_type,
+ gint *actual_length,
+ guchar **data)
{
/* FIXME: Implement */
return 0;
}
void
-gdk_property_change (GdkWindow *window,
- GdkAtom property,
- GdkAtom type,
- gint format,
- GdkPropMode mode,
- const guchar *data,
- gint nelements)
+_gdk_quartz_window_change_property (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gint format,
+ GdkPropMode mode,
+ const guchar *data,
+ gint nelements)
{
/* FIXME: Implement */
}
diff --git a/gdk/quartz/gdkquartz.h b/gdk/quartz/gdkquartz.h
index 48c47484cb..ea00837393 100644
--- a/gdk/quartz/gdkquartz.h
+++ b/gdk/quartz/gdkquartz.h
@@ -22,6 +22,8 @@
#define __GDK_QUARTZ_H__
#include
+
+#include
#include
G_BEGIN_DECLS
@@ -39,12 +41,22 @@ typedef unsigned int NSUInteger;
typedef float CGFloat;
#endif
-NSWindow *gdk_quartz_window_get_nswindow (GdkWindow *window);
-NSView *gdk_quartz_window_get_nsview (GdkWindow *window);
-NSImage *gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf);
-id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context);
-NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
-
G_END_DECLS
+#define __GDKQUARTZ_H_INSIDE__
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#undef __GDKQUARTZ_H_INSIDE__
+
#endif /* __GDK_QUARTZ_H__ */
diff --git a/gdk/quartz/gdkquartzcursor.h b/gdk/quartz/gdkquartzcursor.h
new file mode 100644
index 0000000000..7ab9498ea5
--- /dev/null
+++ b/gdk/quartz/gdkquartzcursor.h
@@ -0,0 +1,51 @@
+/* gdkquartzcursor.h
+ *
+ * Copyright (C) 2005-2007 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_CURSOR_H__
+#define __GDK_QUARTZ_CURSOR_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_CURSOR (gdk_quartz_cursor_get_type ())
+#define GDK_QUARTZ_CURSOR(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_CURSOR, GdkQuartzCursor))
+#define GDK_QUARTZ_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_CURSOR, GdkQuartzCursorClass))
+#define GDK_IS_QUARTZ_CURSOR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_CURSOR))
+#define GDK_IS_QUARTZ_CURSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_CURSOR))
+#define GDK_QUARTZ_CURSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_CURSOR, GdkQuartzCursorClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzCursor GdkQuartzCursor;
+#else
+typedef GdkCursor GdkQuartzCursor;
+#endif
+typedef struct _GdkQuartzCursorClass GdkQuartzCursorClass;
+
+GType gdk_quartz_cursor_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_CURSOR_H__ */
diff --git a/gdk/quartz/gdkquartzdevice-core.h b/gdk/quartz/gdkquartzdevice-core.h
new file mode 100644
index 0000000000..018a1df9cf
--- /dev/null
+++ b/gdk/quartz/gdkquartzdevice-core.h
@@ -0,0 +1,45 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2009 Carlos Garnacho
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_DEVICE_CORE_H__
+#define __GDK_QUARTZ_DEVICE_CORE_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_DEVICE_CORE (gdk_quartz_device_core_get_type ())
+#define GDK_QUARTZ_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_QUARTZ_DEVICE_CORE, GdkQuartzDeviceCore))
+#define GDK_QUARTZ_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_QUARTZ_DEVICE_CORE, GdkQuartzDeviceCoreClass))
+#define GDK_IS_QUARTZ_DEVICE_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_QUARTZ_DEVICE_CORE))
+#define GDK_IS_QUARTZ_DEVICE_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_QUARTZ_DEVICE_CORE))
+#define GDK_QUARTZ_DEVICE_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_QUARTZ_DEVICE_CORE, GdkQuartzDeviceCoreClass))
+
+typedef struct _GdkQuartzDeviceCore GdkQuartzDeviceCore;
+typedef struct _GdkQuartzDeviceCoreClass GdkQuartzDeviceCoreClass;
+
+GType gdk_quartz_device_core_get_type (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_DEVICE_CORE_H__ */
diff --git a/gdk/quartz/gdkquartzdevicemanager-core.h b/gdk/quartz/gdkquartzdevicemanager-core.h
new file mode 100644
index 0000000000..eed8f50859
--- /dev/null
+++ b/gdk/quartz/gdkquartzdevicemanager-core.h
@@ -0,0 +1,47 @@
+/* GDK - The GIMP Drawing Kit
+ * Copyright (C) 2009 Carlos Garnacho
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_DEVICE_MANAGER_CORE_H__
+#define __GDK_QUARTZ_DEVICE_MANAGER_CORE_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_DEVICE_MANAGER_CORE (gdk_quartz_device_manager_core_get_type ())
+#define GDK_QUARTZ_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_QUARTZ_DEVICE_MANAGER_CORE, GdkQuartzDeviceManagerCore))
+#define GDK_QUARTZ_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GDK_TYPE_QUARTZ_DEVICE_MANAGER_CORE, GdkQuartzDeviceManagerCoreClass))
+#define GDK_IS_QUARTZ_DEVICE_MANAGER_CORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_QUARTZ_DEVICE_MANAGER_CORE))
+#define GDK_IS_QUARTZ_DEVICE_MANAGER_CORE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), GDK_TYPE_QUARTZ_DEVICE_MANAGER_CORE))
+#define GDK_QUARTZ_DEVICE_MANAGER_CORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GDK_TYPE_QUARTZ_DEVICE_MANAGER_CORE, GdkQuartzDeviceManagerCoreClass))
+
+typedef struct _GdkQuartzDeviceManagerCore GdkQuartzDeviceManagerCore;
+typedef struct _GdkQuartzDeviceManagerCoreClass GdkQuartzDeviceManagerCoreClass;
+
+
+GType gdk_quartz_device_manager_core_get_type (void) G_GNUC_CONST;
+
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_DEVICE_MANAGER_CORE_H__ */
diff --git a/gdk/quartz/gdkquartzdisplay.h b/gdk/quartz/gdkquartzdisplay.h
new file mode 100644
index 0000000000..708ad2f596
--- /dev/null
+++ b/gdk/quartz/gdkquartzdisplay.h
@@ -0,0 +1,52 @@
+/* gdkquartzdisplay.h
+ *
+ * Copyright (C) 2005-2007 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_DISPLAY_H__
+#define __GDK_QUARTZ_DISPLAY_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_DISPLAY (gdk_quartz_display_get_type ())
+#define GDK_QUARTZ_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_DISPLAY, GdkQuartzDisplay))
+#define GDK_QUARTZ_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_DISPLAY, GdkQuartzDisplayClass))
+#define GDK_IS_QUARTZ_DISPLAY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_DISPLAY))
+#define GDK_IS_QUARTZ_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_DISPLAY))
+#define GDK_QUARTZ_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_DISPLAY, GdkQuartzDisplayClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzDisplay GdkQuartzDisplay;
+#else
+typedef GdkDisplay GdkQuartzDisplay;
+#endif
+typedef struct _GdkQuartzDisplayClass GdkQuartzDisplayClass;
+
+
+GType gdk_quartz_display_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_DISPLAY_H__ */
diff --git a/gdk/quartz/gdkquartzdisplaymanager.h b/gdk/quartz/gdkquartzdisplaymanager.h
new file mode 100644
index 0000000000..00a71ae5c2
--- /dev/null
+++ b/gdk/quartz/gdkquartzdisplaymanager.h
@@ -0,0 +1,48 @@
+/* gdkquartzdisplaymanager.h
+ *
+ * Copyright (C) 2005-2007 Imendio AB
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_DISPLAY_MANAGER_H__
+#define __GDK_QUARTZ_DISPLAY_MANAGER_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_DISPLAY_MANAGER (gdk_quartz_display_manager_get_type ())
+#define GDK_QUARTZ_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_DISPLAY_MANAGER, GdkQuartzDisplayManager))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzDisplayManager GdkQuartzDisplayManager;
+#else
+typedef GdkDisplayManager _GdkQuartzDisplayManager;
+#endif
+typedef struct _GdkDisplayManagerClass GdkQuartzDisplayManagerClass;
+
+
+GType gdk_quartz_display_manager_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_DISPLAY_MANAGER_H__ */
diff --git a/gdk/quartz/gdkquartzdnd.h b/gdk/quartz/gdkquartzdnd.h
new file mode 100644
index 0000000000..2199d0d403
--- /dev/null
+++ b/gdk/quartz/gdkquartzdnd.h
@@ -0,0 +1,53 @@
+/* gdkquartzdnd.h
+ *
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_DND_H__
+#define __GDK_QUARTZ_DND_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_DRAG_CONTEXT (gdk_quartz_drag_context_get_type ())
+#define GDK_QUARTZ_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_DRAG_CONTEXT, GdkQuartzDragContext))
+#define GDK_QUARTZ_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_DRAG_CONTEXT, GdkQuartzDragContextClass))
+#define GDK_IS_QUARTZ_DRAG_CONTEXT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_DRAG_CONTEXT))
+#define GDK_IS_QUARTZ_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_DRAG_CONTEXT))
+#define GDK_QUARTZ_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_DRAG_CONTEXT, GdkQuartzDragContextClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzDragContext GdkQuartzDragContext;
+#else
+typedef GdkDragContext GdkQuartzDragContext;
+#endif
+typedef struct _GdkQuartzDragContextClass GdkQuartzDragContextClass;
+
+
+GType gdk_quartz_drag_context_get_type (void);
+
+id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_DRAG_CONTEXT_H__ */
diff --git a/gdk/quartz/gdkquartzkeys.h b/gdk/quartz/gdkquartzkeys.h
new file mode 100644
index 0000000000..b9e1dfe071
--- /dev/null
+++ b/gdk/quartz/gdkquartzkeys.h
@@ -0,0 +1,51 @@
+/* gdkquartzkeyd.h
+ *
+ * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_KEYS_H__
+#define __GDK_QUARTZ_KEYS_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_KEYMAP (gdk_quartz_keymap_get_type ())
+#define GDK_QUARTZ_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_KEYMAP, GdkQuartzKeymap))
+#define GDK_QUARTZ_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_KEYMAP, GdkQuartzKeymapClass))
+#define GDK_IS_QUARTZ_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_KEYMAP))
+#define GDK_IS_QUARTZ_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_KEYMAP))
+#define GDK_QUARTZ_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_KEYMAP, GdkQuartzKeymapClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzKeymap GdkQuartzKeymap;
+#else
+typedef GdkKeymap GdkQuartzKeymap;
+#endif
+typedef struct _GdkQuartzKeymapClass GdkQuartzKeymapClass;
+
+GType gdk_quartz_keymap_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_KEYS_H__ */
diff --git a/gdk/quartz/gdkquartzscreen.h b/gdk/quartz/gdkquartzscreen.h
new file mode 100644
index 0000000000..b8b17bfade
--- /dev/null
+++ b/gdk/quartz/gdkquartzscreen.h
@@ -0,0 +1,51 @@
+/* gdkquartzscreen.h
+ *
+ * Copyright (C) 2009, 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_SCREEN_H__
+#define __GDK_QUARTZ_SCREEN_H__
+
+G_BEGIN_DECLS
+
+#include
+
+#define GDK_TYPE_QUARTZ_SCREEN (gdk_quartz_screen_get_type ())
+#define GDK_QUARTZ_SCREEN(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_SCREEN, GdkQuartzScreen))
+#define GDK_QUARTZ_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_SCREEN, GdkQuartzScreenClass))
+#define GDK_IS_QUARTZ_SCREEN(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_SCREEN))
+#define GDK_IS_QUARTZ_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_SCREEN))
+#define GDK_QUARTZ_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_SCREEN, GdkQuartzScreenClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzScreen GdkQuartzScreen;
+#else
+typedef GdkScreen GdkQuartzScreen;
+#endif
+typedef struct _GdkQuartzScreenClass GdkQuartzScreenClass;
+
+
+GType gdk_quartz_screen_get_type (void);
+
+G_END_DECLS
+
+#endif /* _GDK_QUARTZ_SCREEN_H_ */
diff --git a/gdk/quartz/gdkquartzutils.h b/gdk/quartz/gdkquartzutils.h
new file mode 100644
index 0000000000..a3eeda16e3
--- /dev/null
+++ b/gdk/quartz/gdkquartzutils.h
@@ -0,0 +1,38 @@
+/* gdkquartzutils.h
+ *
+ * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_UTILS_H__
+#define __GDK_QUARTZ_UTILS_H__
+
+#include
+
+G_BEGIN_DECLS
+
+NSImage *gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf);
+NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_UTILS_H__ */
diff --git a/gdk/quartz/gdkquartzvisual.h b/gdk/quartz/gdkquartzvisual.h
new file mode 100644
index 0000000000..ba3acbc83d
--- /dev/null
+++ b/gdk/quartz/gdkquartzvisual.h
@@ -0,0 +1,52 @@
+/* gdkquartzvisual.h
+ *
+ * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_VISUAL_H__
+#define __GDK_QUARTZ_VISUAL_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_VISUAL (gdk_quartz_visual_get_type ())
+#define GDK_QUARTZ_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_VISUAL, GdkQuartzVisual))
+#define GDK_QUARTZ_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_VISUAL, GdkQuartzVisualClass))
+#define GDK_IS_QUARTZ_VISUAL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_VISUAL))
+#define GDK_IS_QUARTZ_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_VISUAL))
+#define GDK_QUARTZ_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_VISUAL, GdkQuartzVisualClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzVisual GdkQuartzVisual;
+#else
+typedef GdkVisual GdkQuartzVisual;
+#endif
+typedef struct _GdkQuartzVisualClass GdkQuartzVisualClass;
+
+
+GType gdk_quartz_visual_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_VISUAL_H__ */
diff --git a/gdk/quartz/gdkquartzwindow.h b/gdk/quartz/gdkquartzwindow.h
new file mode 100644
index 0000000000..934b4c4135
--- /dev/null
+++ b/gdk/quartz/gdkquartzwindow.h
@@ -0,0 +1,54 @@
+/* gdkquartzwindow.h
+ *
+ * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#if !defined (__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
+#error "Only can be included directly."
+#endif
+
+#ifndef __GDK_QUARTZ_WINDOW_H__
+#define __GDK_QUARTZ_WINDOW_H__
+
+#include
+
+G_BEGIN_DECLS
+
+#define GDK_TYPE_QUARTZ_WINDOW (gdk_quartz_window_get_type ())
+#define GDK_QUARTZ_WINDOW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_WINDOW, GdkQuartzWindow))
+#define GDK_QUARTZ_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_WINDOW, GdkQuartzWindowClass))
+#define GDK_IS_QUARTZ_WINDOW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_WINDOW))
+#define GDK_IS_QUARTZ_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_WINDOW))
+#define GDK_QUARTZ_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_WINDOW, GdkQuartzWindowClass))
+
+#ifdef GDK_COMPILATION
+typedef struct _GdkQuartzWindow GdkQuartzWindow;
+#else
+typedef GdkWindow GdkQuartzWindow;
+#endif
+typedef struct _GdkQuartzWindowClass GdkQuartzWindowClass;
+
+GType gdk_quartz_window_get_type (void);
+
+NSWindow *gdk_quartz_window_get_nswindow (GdkWindow *window);
+NSView *gdk_quartz_window_get_nsview (GdkWindow *window);
+
+G_END_DECLS
+
+#endif /* __GDK_QUARTZ_WINDOW_H__ */
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index d90366e91d..678a947243 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -1,7 +1,7 @@
/* gdkscreen-quartz.c
*
* Copyright (C) 2005 Imendio AB
- * Copyright (C) 2009 Kristian Rietveld
+ * Copyright (C) 2009,2010 Kristian Rietveld
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,9 @@
*/
#include "config.h"
-#include "gdk.h"
-#include "gdkscreen-quartz.h"
+
+#include
+
#include "gdkprivate-quartz.h"
@@ -48,7 +49,7 @@
* all monitors in the root window. Once that size is known, we iterate
* over the monitors and translate their Cocoa position to a position
* in the root window of the GdkScreen. This happens below in the
- * function gdk_screen_quartz_calculate_layout().
+ * function gdk_quartz_screen_calculate_layout().
*
* A Cocoa coordinate is always relative to the origin of the monitor
* coordinate space. Such coordinates are mapped to their respective
@@ -59,47 +60,38 @@
* but GDK coordinates can *not*!
*/
-static void gdk_screen_quartz_dispose (GObject *object);
-static void gdk_screen_quartz_finalize (GObject *object);
-static void gdk_screen_quartz_calculate_layout (GdkScreenQuartz *screen);
+static void gdk_quartz_screen_dispose (GObject *object);
+static void gdk_quartz_screen_finalize (GObject *object);
+static void gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen);
static void display_reconfiguration_callback (CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void *userInfo);
-G_DEFINE_TYPE (GdkScreenQuartz, _gdk_screen_quartz, GDK_TYPE_SCREEN);
+G_DEFINE_TYPE (GdkQuartzScreen, gdk_quartz_screen, GDK_TYPE_SCREEN);
static void
-_gdk_screen_quartz_class_init (GdkScreenQuartzClass *klass)
+gdk_quartz_screen_init (GdkQuartzScreen *quartz_screen)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = gdk_screen_quartz_dispose;
- object_class->finalize = gdk_screen_quartz_finalize;
-}
-
-static void
-_gdk_screen_quartz_init (GdkScreenQuartz *screen_quartz)
-{
- GdkScreen *screen = GDK_SCREEN (screen_quartz);
+ GdkScreen *screen = GDK_SCREEN (quartz_screen);
NSScreen *nsscreen;
nsscreen = [[NSScreen screens] objectAtIndex:0];
gdk_screen_set_resolution (screen,
72.0 * [nsscreen userSpaceScaleFactor]);
- gdk_screen_quartz_calculate_layout (screen_quartz);
+ gdk_quartz_screen_calculate_layout (quartz_screen);
CGDisplayRegisterReconfigurationCallback (display_reconfiguration_callback,
screen);
- screen_quartz->emit_monitors_changed = FALSE;
+ quartz_screen->emit_monitors_changed = FALSE;
}
static void
-gdk_screen_quartz_dispose (GObject *object)
+gdk_quartz_screen_dispose (GObject *object)
{
- GdkScreenQuartz *screen = GDK_SCREEN_QUARTZ (object);
+ GdkQuartzScreen *screen = GDK_QUARTZ_SCREEN (object);
if (screen->screen_changed_id)
{
@@ -110,11 +102,11 @@ gdk_screen_quartz_dispose (GObject *object)
CGDisplayRemoveReconfigurationCallback (display_reconfiguration_callback,
screen);
- G_OBJECT_CLASS (_gdk_screen_quartz_parent_class)->dispose (object);
+ G_OBJECT_CLASS (gdk_quartz_screen_parent_class)->dispose (object);
}
static void
-gdk_screen_quartz_screen_rects_free (GdkScreenQuartz *screen)
+gdk_quartz_screen_screen_rects_free (GdkQuartzScreen *screen)
{
screen->n_screens = 0;
@@ -126,16 +118,16 @@ gdk_screen_quartz_screen_rects_free (GdkScreenQuartz *screen)
}
static void
-gdk_screen_quartz_finalize (GObject *object)
+gdk_quartz_screen_finalize (GObject *object)
{
- GdkScreenQuartz *screen = GDK_SCREEN_QUARTZ (object);
+ GdkQuartzScreen *screen = GDK_QUARTZ_SCREEN (object);
- gdk_screen_quartz_screen_rects_free (screen);
+ gdk_quartz_screen_screen_rects_free (screen);
}
static void
-gdk_screen_quartz_calculate_layout (GdkScreenQuartz *screen)
+gdk_quartz_screen_calculate_layout (GdkQuartzScreen *screen)
{
NSArray *array;
int i;
@@ -143,7 +135,7 @@ gdk_screen_quartz_calculate_layout (GdkScreenQuartz *screen)
GDK_QUARTZ_ALLOC_POOL;
- gdk_screen_quartz_screen_rects_free (screen);
+ gdk_quartz_screen_screen_rects_free (screen);
array = [NSScreen screens];
@@ -192,18 +184,48 @@ gdk_screen_quartz_calculate_layout (GdkScreenQuartz *screen)
GDK_QUARTZ_RELEASE_POOL;
}
+void
+_gdk_quartz_screen_update_window_sizes (GdkScreen *screen)
+{
+ GList *windows, *list;
+
+ /* The size of the root window is so that it can contain all
+ * monitors attached to this machine. The monitors are laid out
+ * within this root window. We calculate the size of the root window
+ * and the positions of the different monitors in gdkscreen-quartz.c.
+ *
+ * This data is updated when the monitor configuration is changed.
+ */
+
+ /* FIXME: At some point, fetch the root window from GdkScreen. But
+ * on OS X will we only have a single root window anyway.
+ */
+ _gdk_root->x = 0;
+ _gdk_root->y = 0;
+ _gdk_root->abs_x = 0;
+ _gdk_root->abs_y = 0;
+ _gdk_root->width = gdk_screen_get_width (screen);
+ _gdk_root->height = gdk_screen_get_height (screen);
+
+ windows = gdk_screen_get_toplevel_windows (screen);
+
+ for (list = windows; list; list = list->next)
+ _gdk_quartz_window_update_position (list->data);
+
+ g_list_free (windows);
+}
static void
-process_display_reconfiguration (GdkScreenQuartz *screen)
+process_display_reconfiguration (GdkQuartzScreen *screen)
{
int width, height;
width = gdk_screen_get_width (GDK_SCREEN (screen));
height = gdk_screen_get_height (GDK_SCREEN (screen));
- gdk_screen_quartz_calculate_layout (GDK_SCREEN_QUARTZ (screen));
+ gdk_quartz_screen_calculate_layout (GDK_QUARTZ_SCREEN (screen));
- _gdk_windowing_update_window_sizes (GDK_SCREEN (screen));
+ _gdk_quartz_screen_update_window_sizes (GDK_SCREEN (screen));
if (screen->emit_monitors_changed)
{
@@ -219,7 +241,7 @@ process_display_reconfiguration (GdkScreenQuartz *screen)
static gboolean
screen_changed_idle (gpointer data)
{
- GdkScreenQuartz *screen = data;
+ GdkQuartzScreen *screen = data;
process_display_reconfiguration (data);
@@ -233,7 +255,7 @@ display_reconfiguration_callback (CGDirectDisplayID display,
CGDisplayChangeSummaryFlags flags,
void *userInfo)
{
- GdkScreenQuartz *screen = userInfo;
+ GdkQuartzScreen *screen = userInfo;
if (flags & kCGDisplayBeginConfigurationFlag)
{
@@ -263,34 +285,22 @@ display_reconfiguration_callback (CGDirectDisplayID display,
}
}
-GdkScreen *
-_gdk_screen_quartz_new (void)
+static GdkDisplay *
+gdk_quartz_screen_get_display (GdkScreen *screen)
{
- return g_object_new (GDK_TYPE_SCREEN_QUARTZ, NULL);
-}
-
-GdkDisplay *
-gdk_screen_get_display (GdkScreen *screen)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return _gdk_display;
}
-GdkWindow *
-gdk_screen_get_root_window (GdkScreen *screen)
+static GdkWindow *
+gdk_quartz_screen_get_root_window (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return _gdk_root;
}
-gint
-gdk_screen_get_number (GdkScreen *screen)
+static gint
+gdk_quartz_screen_get_number (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return 0;
}
@@ -304,20 +314,16 @@ _gdk_windowing_substitute_screen_number (const gchar *display_name,
return g_strdup (display_name);
}
-gint
-gdk_screen_get_width (GdkScreen *screen)
+static gint
+gdk_quartz_screen_get_width (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
- return GDK_SCREEN_QUARTZ (screen)->width;
+ return GDK_QUARTZ_SCREEN (screen)->width;
}
-gint
-gdk_screen_get_height (GdkScreen *screen)
+static gint
+gdk_quartz_screen_get_height (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
- return GDK_SCREEN_QUARTZ (screen)->height;
+ return GDK_QUARTZ_SCREEN (screen)->height;
}
static gint
@@ -352,110 +358,125 @@ get_nsscreen_for_monitor (gint monitor_num)
return screen;
}
-gint
-gdk_screen_get_width_mm (GdkScreen *screen)
+static gint
+gdk_quartz_screen_get_width_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return get_mm_from_pixels (get_nsscreen_for_monitor (0),
- GDK_SCREEN_QUARTZ (screen)->width);
+ GDK_QUARTZ_SCREEN (screen)->width);
}
-gint
-gdk_screen_get_height_mm (GdkScreen *screen)
+static gint
+gdk_quartz_screen_get_height_mm (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return get_mm_from_pixels (get_nsscreen_for_monitor (0),
- GDK_SCREEN_QUARTZ (screen)->height);
+ GDK_QUARTZ_SCREEN (screen)->height);
}
-gint
-gdk_screen_get_n_monitors (GdkScreen *screen)
+static gint
+gdk_quartz_screen_get_n_monitors (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
- return GDK_SCREEN_QUARTZ (screen)->n_screens;
+ return GDK_QUARTZ_SCREEN (screen)->n_screens;
}
-gint
-gdk_screen_get_primary_monitor (GdkScreen *screen)
+static gint
+gdk_quartz_screen_get_primary_monitor (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
-
return 0;
}
-gint
-gdk_screen_get_monitor_width_mm (GdkScreen *screen,
- gint monitor_num)
+static gint
+gdk_quartz_screen_get_monitor_width_mm (GdkScreen *screen,
+ gint monitor_num)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
- g_return_val_if_fail (monitor_num < gdk_screen_get_n_monitors (screen), 0);
- g_return_val_if_fail (monitor_num >= 0, 0);
-
return get_mm_from_pixels (get_nsscreen_for_monitor (monitor_num),
- GDK_SCREEN_QUARTZ (screen)->screen_rects[monitor_num].width);
+ GDK_QUARTZ_SCREEN (screen)->screen_rects[monitor_num].width);
}
-gint
-gdk_screen_get_monitor_height_mm (GdkScreen *screen,
- gint monitor_num)
+static gint
+gdk_quartz_screen_get_monitor_height_mm (GdkScreen *screen,
+ gint monitor_num)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), 0);
- g_return_val_if_fail (monitor_num < gdk_screen_get_n_monitors (screen), 0);
- g_return_val_if_fail (monitor_num >= 0, 0);
-
return get_mm_from_pixels (get_nsscreen_for_monitor (monitor_num),
- GDK_SCREEN_QUARTZ (screen)->screen_rects[monitor_num].height);
+ GDK_QUARTZ_SCREEN (screen)->screen_rects[monitor_num].height);
}
-gchar *
-gdk_screen_get_monitor_plug_name (GdkScreen *screen,
- gint monitor_num)
+static gchar *
+gdk_quartz_screen_get_monitor_plug_name (GdkScreen *screen,
+ gint monitor_num)
{
/* FIXME: Is there some useful name we could use here? */
return NULL;
}
-void
-gdk_screen_get_monitor_geometry (GdkScreen *screen,
- gint monitor_num,
- GdkRectangle *dest)
+static void
+gdk_quartz_screen_get_monitor_geometry (GdkScreen *screen,
+ gint monitor_num,
+ GdkRectangle *dest)
{
- g_return_if_fail (GDK_IS_SCREEN (screen));
- g_return_if_fail (monitor_num < gdk_screen_get_n_monitors (screen));
- g_return_if_fail (monitor_num >= 0);
-
- *dest = GDK_SCREEN_QUARTZ (screen)->screen_rects[monitor_num];
+ *dest = GDK_QUARTZ_SCREEN (screen)->screen_rects[monitor_num];
}
-gchar *
-gdk_screen_make_display_name (GdkScreen *screen)
+static gchar *
+gdk_quartz_screen_make_display_name (GdkScreen *screen)
{
return g_strdup (gdk_display_get_name (_gdk_display));
}
-GdkWindow *
-gdk_screen_get_active_window (GdkScreen *screen)
+static GdkWindow *
+gdk_quartz_screen_get_active_window (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return NULL;
}
-GList *
-gdk_screen_get_window_stack (GdkScreen *screen)
+static GList *
+gdk_quartz_screen_get_window_stack (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return NULL;
}
-gboolean
-gdk_screen_is_composited (GdkScreen *screen)
+static gboolean
+gdk_quartz_screen_is_composited (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
-
return TRUE;
}
+
+static void
+gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass);
+
+ object_class->dispose = gdk_quartz_screen_dispose;
+ object_class->finalize = gdk_quartz_screen_finalize;
+
+ screen_class->get_display = gdk_quartz_screen_get_display;
+ screen_class->get_width = gdk_quartz_screen_get_width;
+ screen_class->get_height = gdk_quartz_screen_get_height;
+ screen_class->get_width_mm = gdk_quartz_screen_get_width_mm;
+ screen_class->get_height_mm = gdk_quartz_screen_get_height_mm;
+ screen_class->get_number = gdk_quartz_screen_get_number;
+ screen_class->get_root_window = gdk_quartz_screen_get_root_window;
+ screen_class->get_n_monitors = gdk_quartz_screen_get_n_monitors;
+ screen_class->get_primary_monitor = gdk_quartz_screen_get_primary_monitor;
+ screen_class->get_monitor_width_mm = gdk_quartz_screen_get_monitor_width_mm;
+ screen_class->get_monitor_height_mm = gdk_quartz_screen_get_monitor_height_mm;
+ screen_class->get_monitor_plug_name = gdk_quartz_screen_get_monitor_plug_name;
+ screen_class->get_monitor_geometry = gdk_quartz_screen_get_monitor_geometry;
+ screen_class->is_composited = gdk_quartz_screen_is_composited;
+ screen_class->make_display_name = gdk_quartz_screen_make_display_name;
+ screen_class->get_active_window = gdk_quartz_screen_get_active_window;
+ screen_class->get_window_stack = gdk_quartz_screen_get_window_stack;
+ screen_class->broadcast_client_message = _gdk_quartz_screen_broadcast_client_message;
+ screen_class->get_setting = _gdk_quartz_screen_get_setting;
+ screen_class->get_rgba_visual = _gdk_quartz_screen_get_rgba_visual;
+ screen_class->get_system_visual = _gdk_quartz_screen_get_system_visual;
+ screen_class->visual_get_best_depth = _gdk_quartz_screen_visual_get_best_depth;
+ screen_class->visual_get_best_type = _gdk_quartz_screen_visual_get_best_type;
+ screen_class->visual_get_best = _gdk_quartz_screen_visual_get_best;
+ screen_class->visual_get_best_with_depth = _gdk_quartz_screen_visual_get_best_with_depth;
+ screen_class->visual_get_best_with_type = _gdk_quartz_screen_visual_get_best_with_type;
+ screen_class->visual_get_best_with_both = _gdk_quartz_screen_visual_get_best_with_both;
+ screen_class->query_depths = _gdk_quartz_screen_query_depths;
+ screen_class->query_visual_types = _gdk_quartz_screen_query_visual_types;
+ screen_class->list_visuals = _gdk_quartz_screen_list_visuals;
+}
diff --git a/gdk/quartz/gdkscreen-quartz.h b/gdk/quartz/gdkscreen-quartz.h
index 4d211e3828..1999b5c19d 100644
--- a/gdk/quartz/gdkscreen-quartz.h
+++ b/gdk/quartz/gdkscreen-quartz.h
@@ -1,6 +1,6 @@
/* gdkscreen-quartz.h
*
- * Copyright (C) 2009 Kristian Rietveld
+ * Copyright (C) 2009,2010 Kristian Rietveld
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -18,22 +18,14 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef __GDK_SCREEN_QUARTZ_H__
-#define __GDK_SCREEN_QUARTZ_H__
+#ifndef __GDK_QUARTZ_SCREEN__
+#define __GDK_QUARTZ_SCREEN__
+
+#include
G_BEGIN_DECLS
-typedef struct _GdkScreenQuartz GdkScreenQuartz;
-typedef struct _GdkScreenQuartzClass GdkScreenQuartzClass;
-
-#define GDK_TYPE_SCREEN_QUARTZ (_gdk_screen_quartz_get_type ())
-#define GDK_SCREEN_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_SCREEN_QUARTZ, GdkScreenQuartz))
-#define GDK_SCREEN_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_SCREEN_QUARTZ, GdkScreenQuartzClass))
-#define GDK_IS_SCREEN_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_SCREEN_QUARTZ))
-#define GDK_IS_SCREEN_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_SCREEN_QUARTZ))
-#define GDK_SCREEN_QUARTZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_SCREEN_QUARTZ, GdkScreenQuartzClass))
-
-struct _GdkScreenQuartz
+struct _GdkQuartzScreen
{
GdkScreen parent_instance;
@@ -54,14 +46,11 @@ struct _GdkScreenQuartz
guint emit_monitors_changed : 1;
};
-struct _GdkScreenQuartzClass
+struct _GdkQuartzScreenClass
{
GdkScreenClass parent_class;
};
-GType _gdk_screen_quartz_get_type (void);
-GdkScreen *_gdk_screen_quartz_new (void);
-
G_END_DECLS
-#endif /* _GDK_SCREEN_QUARTZ_H_ */
+#endif /* __GDK_QUARTZ_SCREEN__ */
diff --git a/gdk/quartz/gdkselection-quartz.c b/gdk/quartz/gdkselection-quartz.c
index c327eb9ef0..446a23e48f 100644
--- a/gdk/quartz/gdkselection-quartz.c
+++ b/gdk/quartz/gdkselection-quartz.c
@@ -26,111 +26,64 @@
#include "gdkproperty.h"
gboolean
-gdk_selection_owner_set_for_display (GdkDisplay *display,
- GdkWindow *owner,
- GdkAtom selection,
- guint32 time,
- gint send_event)
+_gdk_quartz_display_set_selection_owner (GdkDisplay *display,
+ GdkWindow *owner,
+ GdkAtom selection,
+ guint32 time,
+ gint send_event)
{
/* FIXME: Implement */
return TRUE;
}
GdkWindow*
-gdk_selection_owner_get_for_display (GdkDisplay *display,
- GdkAtom selection)
+_gdk_quartz_display_get_selection_owner (GdkDisplay *display,
+ GdkAtom selection)
{
/* FIXME: Implement */
return NULL;
}
void
-gdk_selection_convert (GdkWindow *requestor,
- GdkAtom selection,
- GdkAtom target,
- guint32 time)
+_gdk_quartz_display_convert_selection (GdkDisplay *display,
+ GdkWindow *requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ guint32 time)
{
/* FIXME: Implement */
}
gint
-gdk_selection_property_get (GdkWindow *requestor,
- guchar **data,
- GdkAtom *ret_type,
- gint *ret_format)
+_gdk_quartz_display_get_selection_property (GdkDisplay *display,
+ GdkWindow *requestor,
+ guchar **data,
+ GdkAtom *ret_type,
+ gint *ret_format)
{
/* FIXME: Implement */
return 0;
}
void
-gdk_selection_send_notify_for_display (GdkDisplay *display,
- guint32 requestor,
- GdkAtom selection,
- GdkAtom target,
- GdkAtom property,
- guint32 time)
-{
- /* FIXME: Implement */
-}
-
-gint
-gdk_text_property_to_text_list_for_display (GdkDisplay *display,
- GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list)
-{
- /* FIXME: Implement */
- return 0;
-}
-
-gint
-gdk_string_to_compound_text_for_display (GdkDisplay *display,
- const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length)
-{
- /* FIXME: Implement */
- return 0;
-}
-
-void gdk_free_compound_text (guchar *ctext)
+_gdk_quartz_display_send_selection_notify (GdkDisplay *display,
+ GdkNativeWindow requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ GdkAtom property,
+ guint32 time)
{
/* FIXME: Implement */
}
gchar *
-gdk_utf8_to_string_target (const gchar *str)
+_gdk_quartz_display_utf8_to_string_target (GdkDisplay *display,
+ const gchar *str)
{
/* FIXME: Implement */
return NULL;
}
-gboolean
-gdk_utf8_to_compound_text_for_display (GdkDisplay *display,
- const gchar *str,
- GdkAtom *encoding,
- gint *format,
- guchar **ctext,
- gint *length)
-{
- /* FIXME: Implement */
- return 0;
-}
-
-void
-gdk_free_text_list (gchar **list)
-{
- g_return_if_fail (list != NULL);
-
- g_free (*list);
- g_free (list);
-}
-
static gint
make_list (const gchar *text,
gint length,
@@ -200,13 +153,13 @@ make_list (const gchar *text,
return n_strings;
}
-gint
-gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
- GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list)
+gint
+_gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
+ GdkAtom encoding,
+ gint format,
+ const guchar *text,
+ gint length,
+ gchar ***list)
{
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (length >= 0, 0);
diff --git a/gdk/quartz/gdkspawn-quartz.c b/gdk/quartz/gdkspawn-quartz.c
deleted file mode 100644
index 6cddd648b1..0000000000
--- a/gdk/quartz/gdkspawn-quartz.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Mark McLoughlin
- */
-
-#include "config.h"
-
-#include "gdkspawn.h"
-
-#include
-#include
-
-gboolean
-gdk_spawn_on_screen (GdkScreen *screen,
- const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GPid *child_pid,
- GError **error)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
- g_assert (sizeof(GPid) == sizeof(int));
-
- return g_spawn_async (working_directory,
- argv,
- envp,
- flags,
- child_setup,
- user_data,
- child_pid,
- error);
-}
-
-gboolean
-gdk_spawn_on_screen_with_pipes (GdkScreen *screen,
- const gchar *working_directory,
- gchar **argv,
- gchar **envp,
- GSpawnFlags flags,
- GSpawnChildSetupFunc child_setup,
- gpointer user_data,
- GPid *child_pid,
- gint *standard_input,
- gint *standard_output,
- gint *standard_error,
- GError **error)
-{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
- g_assert (sizeof(GPid) == sizeof(int));
-
- return g_spawn_async_with_pipes (working_directory,
- argv,
- envp,
- flags,
- child_setup,
- user_data,
- child_pid,
- standard_input,
- standard_output,
- standard_error,
- error);
-}
-
-gboolean
-gdk_spawn_command_line_on_screen (GdkScreen *screen,
- const gchar *command_line,
- GError **error)
-{
- gchar **argv = NULL;
- gboolean retval;
-
- g_return_val_if_fail (command_line != NULL, FALSE);
-
- if (!g_shell_parse_argv (command_line,
- NULL, &argv,
- error))
- return FALSE;
-
- retval = gdk_spawn_on_screen (screen,
- NULL, argv, NULL,
- G_SPAWN_SEARCH_PATH,
- NULL, NULL, NULL,
- error);
- g_strfreev (argv);
-
- return retval;
-}
diff --git a/gdk/quartz/gdktestutils-quartz.c b/gdk/quartz/gdktestutils-quartz.c
index f62baa4619..731b00b2ca 100644
--- a/gdk/quartz/gdktestutils-quartz.c
+++ b/gdk/quartz/gdktestutils-quartz.c
@@ -22,54 +22,19 @@
#include
#include
-/**
- * gdk_test_render_sync
- * @window: a mapped GdkWindow
- *
- * This function retrives a pixel from @window to force the windowing
- * system to carry out any pending rendering commands.
- * This function is intended to be used to syncronize with rendering
- * pipelines, to benchmark windowing system rendering operations.
- **/
void
-gdk_test_render_sync (GdkWindow *window)
+_gdk_quartz_window_sync_rendering (GdkWindow *window)
{
/* FIXME: Find out if there is a way to implement this on quartz. */
}
-/**
- * gdk_test_simulate_key
- * @window: Gdk window to simulate a key event for.
- * @x: x coordinate within @window for the key event.
- * @y: y coordinate within @window for the key event.
- * @keyval: A Gdk keyboard value.
- * @modifiers: Keyboard modifiers the event is setup with.
- * @key_pressrelease: either %GDK_KEY_PRESS or %GDK_KEY_RELEASE
- *
- * This function is intended to be used in Gtk+ test programs.
- * If (@x,@y) are > (-1,-1), it will warp the mouse pointer to
- * the given (@x,@y) corrdinates within @window and simulate a
- * key press or release event.
- * When the mouse pointer is warped to the target location, use
- * of this function outside of test programs that run in their
- * own virtual windowing system (e.g. Xvfb) is not recommended.
- * If (@x,@y) are passed as (-1,-1), the mouse pointer will not
- * be warped and @window origin will be used as mouse pointer
- * location for the event.
- * Also, gtk_test_simulate_key() is a fairly low level function,
- * for most testing purposes, gtk_test_widget_send_key() is the
- * right function to call which will generate a key press event
- * followed by its accompanying key release event.
- *
- * Returns: wether all actions neccessary for a key event simulation were carried out successfully.
- **/
gboolean
-gdk_test_simulate_key (GdkWindow *window,
- gint x,
- gint y,
- guint keyval,
- GdkModifierType modifiers,
- GdkEventType key_pressrelease)
+_gdk_quartz_window_simulate_key (GdkWindow *window,
+ gint x,
+ gint y,
+ guint keyval,
+ GdkModifierType modifiers,
+ GdkEventType key_pressrelease)
{
g_return_val_if_fail (key_pressrelease == GDK_KEY_PRESS || key_pressrelease == GDK_KEY_RELEASE, FALSE);
g_return_val_if_fail (window != NULL, FALSE);
@@ -82,36 +47,13 @@ gdk_test_simulate_key (GdkWindow *window,
return FALSE;
}
-/**
- * gdk_test_simulate_button
- * @window: Gdk window to simulate a button event for.
- * @x: x coordinate within @window for the button event.
- * @y: y coordinate within @window for the button event.
- * @button: Number of the pointer button for the event, usually 1, 2 or 3.
- * @modifiers: Keyboard modifiers the event is setup with.
- * @button_pressrelease: either %GDK_BUTTON_PRESS or %GDK_BUTTON_RELEASE
- *
- * This function is intended to be used in Gtk+ test programs.
- * It will warp the mouse pointer to the given (@x,@y) corrdinates
- * within @window and simulate a button press or release event.
- * Because the mouse pointer needs to be warped to the target
- * location, use of this function outside of test programs that
- * run in their own virtual windowing system (e.g. Xvfb) is not
- * recommended.
- * Also, gtk_test_simulate_button() is a fairly low level function,
- * for most testing purposes, gtk_test_widget_click() is the right
- * function to call which will generate a button press event followed
- * by its accompanying button release event.
- *
- * Returns: wether all actions neccessary for a button event simulation were carried out successfully.
- **/
gboolean
-gdk_test_simulate_button (GdkWindow *window,
- gint x,
- gint y,
- guint button, /*1..3*/
- GdkModifierType modifiers,
- GdkEventType button_pressrelease)
+_gdk_quartz_window_simulate_button (GdkWindow *window,
+ gint x,
+ gint y,
+ guint button, /*1..3*/
+ GdkModifierType modifiers,
+ GdkEventType button_pressrelease)
{
g_return_val_if_fail (button_pressrelease == GDK_BUTTON_PRESS || button_pressrelease == GDK_BUTTON_RELEASE, FALSE);
g_return_val_if_fail (window != NULL, FALSE);
diff --git a/gdk/quartz/gdkutils-quartz.c b/gdk/quartz/gdkutils-quartz.c
new file mode 100644
index 0000000000..122a31cb07
--- /dev/null
+++ b/gdk/quartz/gdkutils-quartz.c
@@ -0,0 +1,99 @@
+/* gdkutils-quartz.c
+ *
+ * Copyright (C) 2005 Imendio AB
+ * Copyright (C) 2010 Kristian Rietveld
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include
+
+#include
+#include "gdkprivate-quartz.h"
+
+NSImage *
+gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf)
+{
+ NSBitmapImageRep *bitmap_rep;
+ NSImage *image;
+ gboolean has_alpha;
+
+ has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
+
+ /* Create a bitmap image rep */
+ bitmap_rep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
+ pixelsWide:gdk_pixbuf_get_width (pixbuf)
+ pixelsHigh:gdk_pixbuf_get_height (pixbuf)
+ bitsPerSample:8 samplesPerPixel:has_alpha ? 4 : 3
+ hasAlpha:has_alpha isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace
+ bytesPerRow:0 bitsPerPixel:0];
+
+ {
+ /* Add pixel data to bitmap rep */
+ guchar *src, *dst;
+ int src_stride, dst_stride;
+ int x, y;
+
+ src_stride = gdk_pixbuf_get_rowstride (pixbuf);
+ dst_stride = [bitmap_rep bytesPerRow];
+
+ for (y = 0; y < gdk_pixbuf_get_height (pixbuf); y++)
+ {
+ src = gdk_pixbuf_get_pixels (pixbuf) + y * src_stride;
+ dst = [bitmap_rep bitmapData] + y * dst_stride;
+
+ for (x = 0; x < gdk_pixbuf_get_width (pixbuf); x++)
+ {
+ if (has_alpha)
+ {
+ guchar red, green, blue, alpha;
+
+ red = *src++;
+ green = *src++;
+ blue = *src++;
+ alpha = *src++;
+
+ *dst++ = (red * alpha) / 255;
+ *dst++ = (green * alpha) / 255;
+ *dst++ = (blue * alpha) / 255;
+ *dst++ = alpha;
+ }
+ else
+ {
+ *dst++ = *src++;
+ *dst++ = *src++;
+ *dst++ = *src++;
+ }
+ }
+ }
+ }
+
+ image = [[NSImage alloc] init];
+ [image addRepresentation:bitmap_rep];
+ [bitmap_rep release];
+ [image autorelease];
+
+ return image;
+}
+
+NSEvent *
+gdk_quartz_event_get_nsevent (GdkEvent *event)
+{
+ /* FIXME: If the event here is unallocated, we crash. */
+ return ((GdkEventPrivate *) event)->windowing_data;
+}
diff --git a/gdk/quartz/gdkvisual-quartz.c b/gdk/quartz/gdkvisual-quartz.c
index 917e5abcaf..d88141d259 100644
--- a/gdk/quartz/gdkvisual-quartz.c
+++ b/gdk/quartz/gdkvisual-quartz.c
@@ -20,53 +20,26 @@
#include "config.h"
-#include "gdkvisual.h"
+#include "gdkvisualprivate.h"
+#include "gdkquartzvisual.h"
#include "gdkprivate-quartz.h"
+
+struct _GdkQuartzVisual
+{
+ GdkVisual visual;
+};
+
+struct _GdkQuartzVisualClass
+{
+ GdkVisualClass visual_class;
+};
+
+
static GdkVisual *system_visual;
static GdkVisual *rgba_visual;
static GdkVisual *gray_visual;
-static void
-gdk_visual_finalize (GObject *object)
-{
- g_error ("A GdkVisual object was finalized. This should not happen");
-}
-
-static void
-gdk_visual_class_init (GObjectClass *class)
-{
- class->finalize = gdk_visual_finalize;
-}
-
-GType
-gdk_visual_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkVisualClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_visual_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkVisual),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkVisual",
- &object_info, 0);
- }
-
- return object_type;
-}
-
static void
gdk_visual_decompose_mask (gulong mask,
gint *shift,
@@ -89,14 +62,17 @@ gdk_visual_decompose_mask (gulong mask,
}
static GdkVisual *
-create_standard_visual (gint depth)
+create_standard_visual (GdkScreen *screen,
+ gint depth)
{
- GdkVisual *visual = g_object_new (GDK_TYPE_VISUAL, NULL);
+ GdkVisual *visual = g_object_new (GDK_TYPE_QUARTZ_VISUAL, NULL);
+
+ visual->screen = screen;
visual->depth = depth;
visual->byte_order = GDK_MSB_FIRST; /* FIXME: Should this be different on intel macs? */
visual->colormap_size = 0;
-
+
visual->type = GDK_VISUAL_TRUE_COLOR;
visual->red_mask = 0xff0000;
@@ -117,9 +93,11 @@ create_standard_visual (gint depth)
}
static GdkVisual *
-create_gray_visual (void)
+create_gray_visual (GdkScreen *screen)
{
- GdkVisual *visual = g_object_new (GDK_TYPE_VISUAL, NULL);
+ GdkVisual *visual = g_object_new (GDK_TYPE_QUARTZ_VISUAL, NULL);
+
+ visual->screen = screen;
visual->depth = 1;
visual->byte_order = GDK_MSB_FIRST;
@@ -130,49 +108,53 @@ create_gray_visual (void)
return visual;
}
-void
-_gdk_visual_init (void)
+
+G_DEFINE_TYPE (GdkQuartzVisual, gdk_quartz_visual, GDK_TYPE_VISUAL)
+
+static void
+gdk_quartz_visual_init (GdkQuartzVisual *quartz_visual)
+{
+}
+
+static void
+gdk_quartz_visual_class_init (GdkQuartzVisualClass *class)
{
- system_visual = create_standard_visual (24);
- rgba_visual = create_standard_visual (32);
- gray_visual = create_gray_visual ();
}
/* We prefer the system visual for now ... */
gint
-gdk_visual_get_best_depth (void)
+_gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen)
{
return system_visual->depth;
}
GdkVisualType
-gdk_visual_get_best_type (void)
+_gdk_quartz_screen_visual_get_best_type (GdkScreen *screen)
{
return system_visual->type;
}
GdkVisual *
-gdk_screen_get_rgba_visual (GdkScreen *screen)
+_gdk_quartz_screen_get_rgba_visual (GdkScreen *screen)
{
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
return rgba_visual;
}
GdkVisual*
-gdk_screen_get_system_visual (GdkScreen *screen)
+_gdk_quartz_screen_get_system_visual (GdkScreen *screen)
{
return system_visual;
}
GdkVisual*
-gdk_visual_get_best (void)
+_gdk_quartz_screen_visual_get_best (GdkScreen *screen)
{
return system_visual;
}
GdkVisual*
-gdk_visual_get_best_with_depth (gint depth)
+_gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
+ gint depth)
{
GdkVisual *visual = NULL;
@@ -198,7 +180,8 @@ gdk_visual_get_best_with_depth (gint depth)
}
GdkVisual*
-gdk_visual_get_best_with_type (GdkVisualType visual_type)
+_gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
+ GdkVisualType visual_type)
{
if (system_visual->type == visual_type)
return system_visual;
@@ -209,8 +192,9 @@ gdk_visual_get_best_with_type (GdkVisualType visual_type)
}
GdkVisual*
-gdk_visual_get_best_with_both (gint depth,
- GdkVisualType visual_type)
+_gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
+ gint depth,
+ GdkVisualType visual_type)
{
if (system_visual->depth == depth
&& system_visual->type == visual_type)
@@ -227,23 +211,33 @@ gdk_visual_get_best_with_both (gint depth,
/* For these, we also prefer the system visual */
void
-gdk_query_depths (gint **depths,
- gint *count)
+_gdk_quartz_screen_query_depths (GdkScreen *screen,
+ gint **depths,
+ gint *count)
{
*count = 1;
*depths = &system_visual->depth;
}
void
-gdk_query_visual_types (GdkVisualType **visual_types,
- gint *count)
+_gdk_quartz_screen_query_visual_types (GdkScreen *screen,
+ GdkVisualType **visual_types,
+ gint *count)
{
*count = 1;
*visual_types = &system_visual->type;
}
+void
+_gdk_quartz_screen_init_visuals (GdkScreen *screen)
+{
+ system_visual = create_standard_visual (screen, 24);
+ rgba_visual = create_standard_visual (screen, 32);
+ gray_visual = create_gray_visual (screen);
+}
+
GList*
-gdk_screen_list_visuals (GdkScreen *screen)
+_gdk_quartz_screen_list_visuals (GdkScreen *screen)
{
GList *visuals = NULL;
@@ -253,12 +247,3 @@ gdk_screen_list_visuals (GdkScreen *screen)
return visuals;
}
-
-GdkScreen *
-gdk_visual_get_screen (GdkVisual *visual)
-{
- g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL);
-
- return gdk_screen_get_default ();
-}
-
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index 40b9dbb854..a6fc4ed22e 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -20,14 +20,20 @@
*/
#include "config.h"
-#include
-#include "gdk.h"
-#include "gdkdeviceprivate.h"
+#include
+#include
+#include
+
#include "gdkwindowimpl.h"
#include "gdkprivate-quartz.h"
-#include "gdkscreen-quartz.h"
-#include "gdkinputprivate.h"
+#include "gdkquartzscreen.h"
+#include "gdkquartzcursor.h"
+
+#include
+
+#include
+#include
static gpointer parent_class;
static gpointer root_window_parent_class;
@@ -37,6 +43,8 @@ static gboolean in_process_all_updates = FALSE;
static GSList *main_window_stack;
+void _gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl);
+
#define FULLSCREEN_DATA "fullscreen-data"
typedef struct
@@ -57,39 +65,62 @@ static FullscreenSavedGeometry *get_fullscreen_geometry (GdkWindow *window);
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
-static void gdk_window_impl_iface_init (GdkWindowImplIface *iface);
+/*
+ * GdkQuartzWindow
+ */
+
+struct _GdkQuartzWindow
+{
+ GdkWindow parent;
+};
+
+struct _GdkQuartzWindowClass
+{
+ GdkWindowClass parent_class;
+};
+
+G_DEFINE_TYPE (GdkQuartzWindow, gdk_quartz_window, GDK_TYPE_WINDOW);
+
+static void
+gdk_quartz_window_class_init (GdkQuartzWindowClass *quartz_window_class)
+{
+}
+
+static void
+gdk_quartz_window_init (GdkQuartzWindow *quartz_window)
+{
+}
+
+
+/*
+ * GdkQuartzWindowImpl
+ */
NSView *
gdk_quartz_window_get_nsview (GdkWindow *window)
{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
if (GDK_WINDOW_DESTROYED (window))
return NULL;
- return ((GdkWindowImplQuartz *)private->impl)->view;
+ return ((GdkWindowImplQuartz *)window->impl)->view;
}
NSWindow *
gdk_quartz_window_get_nswindow (GdkWindow *window)
{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
if (GDK_WINDOW_DESTROYED (window))
return NULL;
- return ((GdkWindowImplQuartz *)private->impl)->toplevel;
+ return ((GdkWindowImplQuartz *)window->impl)->toplevel;
}
static CGContextRef
-gdk_window_impl_quartz_get_context (GdkDrawable *drawable,
- gboolean antialias)
+gdk_window_impl_quartz_get_context (GdkWindowImplQuartz *window_impl,
+ gboolean antialias)
{
- GdkDrawableImplQuartz *drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable);
- GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (drawable);
CGContextRef cg_context;
- if (GDK_WINDOW_DESTROYED (drawable_impl->wrapper))
+ if (GDK_WINDOW_DESTROYED (window_impl->wrapper))
return NULL;
/* Lock focus when not called as part of a drawRect call. This
@@ -143,18 +174,16 @@ gdk_window_impl_quartz_get_context (GdkDrawable *drawable,
}
static void
-gdk_window_impl_quartz_release_context (GdkDrawable *drawable,
- CGContextRef cg_context)
+gdk_window_impl_quartz_release_context (GdkWindowImplQuartz *window_impl,
+ CGContextRef cg_context)
{
- GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (drawable);
-
CGContextRestoreGState (cg_context);
CGContextSetAllowsAntialiasing (cg_context, TRUE);
- /* See comment in gdk_quartz_drawable_get_context(). */
+ /* See comment in gdk_quartz_window_get_context(). */
if (window_impl->in_paint_rect_count == 0)
{
- _gdk_quartz_drawable_flush (drawable);
+ _gdk_quartz_window_flush (window_impl);
[window_impl->view unlockFocus];
}
}
@@ -210,7 +239,7 @@ gdk_window_impl_quartz_finalize (GObject *object)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (object);
- check_grab_destroy (GDK_DRAWABLE_IMPL_QUARTZ (object)->wrapper);
+ check_grab_destroy (GDK_WINDOW_IMPL_QUARTZ (object)->wrapper);
if (impl->paint_clip_region)
cairo_region_destroy (impl->paint_clip_region);
@@ -221,18 +250,114 @@ gdk_window_impl_quartz_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static void
-gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
+/* Help preventing "beam sync penalty" where CG makes all graphics code
+ * block until the next vsync if we try to flush (including call display on
+ * a view) too often. We do this by limiting the manual flushing done
+ * outside of expose calls to less than some frequency when measured over
+ * the last 4 flushes. This is a bit arbitray, but seems to make it possible
+ * for some quick manual flushes (such as gtkruler or gimp's marching ants)
+ * without hitting the max flush frequency.
+ *
+ * If drawable NULL, no flushing is done, only registering that a flush was
+ * done externally.
+ */
+void
+_gdk_quartz_window_flush (GdkWindowImplQuartz *window_impl)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkDrawableImplQuartzClass *drawable_quartz_class = GDK_DRAWABLE_IMPL_QUARTZ_CLASS (klass);
+ static struct timeval prev_tv;
+ static gint intervals[4];
+ static gint index;
+ struct timeval tv;
+ gint ms;
- parent_class = g_type_class_peek_parent (klass);
+ gettimeofday (&tv, NULL);
+ ms = (tv.tv_sec - prev_tv.tv_sec) * 1000 + (tv.tv_usec - prev_tv.tv_usec) / 1000;
+ intervals[index++ % 4] = ms;
- object_class->finalize = gdk_window_impl_quartz_finalize;
+ if (window_impl)
+ {
+ ms = intervals[0] + intervals[1] + intervals[2] + intervals[3];
- drawable_quartz_class->get_context = gdk_window_impl_quartz_get_context;
- drawable_quartz_class->release_context = gdk_window_impl_quartz_release_context;
+ /* ~25Hz on average. */
+ if (ms > 4*40)
+ {
+ if (window_impl)
+ [window_impl->toplevel flushWindow];
+
+ prev_tv = tv;
+ }
+ }
+ else
+ prev_tv = tv;
+}
+
+static cairo_user_data_key_t gdk_quartz_cairo_key;
+
+typedef struct {
+ GdkWindowImplQuartz *window_impl;
+ CGContextRef cg_context;
+} GdkQuartzCairoSurfaceData;
+
+static void
+gdk_quartz_cairo_surface_destroy (void *data)
+{
+ GdkQuartzCairoSurfaceData *surface_data = data;
+
+ surface_data->window_impl->cairo_surface = NULL;
+
+ gdk_quartz_window_release_context (surface_data->window_impl,
+ surface_data->cg_context);
+
+ g_free (surface_data);
+}
+
+static cairo_surface_t *
+gdk_quartz_create_cairo_surface (GdkWindowImplQuartz *impl,
+ int width,
+ int height)
+{
+ CGContextRef cg_context;
+ GdkQuartzCairoSurfaceData *surface_data;
+ cairo_surface_t *surface;
+
+ cg_context = gdk_quartz_window_get_context (impl, TRUE);
+
+ if (!cg_context)
+ return NULL;
+
+ surface_data = g_new (GdkQuartzCairoSurfaceData, 1);
+ surface_data->window_impl = impl;
+ surface_data->cg_context = cg_context;
+
+ surface = cairo_quartz_surface_create_for_cg_context (cg_context,
+ width, height);
+
+ cairo_surface_set_user_data (surface, &gdk_quartz_cairo_key,
+ surface_data,
+ gdk_quartz_cairo_surface_destroy);
+
+ return surface;
+}
+
+static cairo_surface_t *
+gdk_quartz_ref_cairo_surface (GdkWindow *window)
+{
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
+
+ if (GDK_WINDOW_DESTROYED (window))
+ return NULL;
+
+ if (!impl->cairo_surface)
+ {
+ impl->cairo_surface =
+ gdk_quartz_create_cairo_surface (impl,
+ gdk_window_get_width (impl->wrapper),
+ gdk_window_get_height (impl->wrapper));
+ }
+ else
+ cairo_surface_reference (impl->cairo_surface);
+
+ return impl->cairo_surface;
}
static void
@@ -247,16 +372,15 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
const cairo_region_t *region)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
- GdkWindowObject *private = (GdkWindowObject*) window;
cairo_region_t *clipped_and_offset_region;
cairo_t *cr;
clipped_and_offset_region = cairo_region_copy (region);
cairo_region_intersect (clipped_and_offset_region,
- private->clip_region_with_children);
+ window->clip_region_with_children);
cairo_region_translate (clipped_and_offset_region,
- private->abs_x, private->abs_y);
+ window->abs_x, window->abs_y);
if (impl->begin_paint_count == 0)
impl->paint_clip_region = cairo_region_reference (clipped_and_offset_region);
@@ -270,19 +394,19 @@ gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
cr = gdk_cairo_create (window);
- cairo_translate (cr, -private->abs_x, -private->abs_y);
+ cairo_translate (cr, -window->abs_x, -window->abs_y);
gdk_cairo_region (cr, clipped_and_offset_region);
cairo_clip (cr);
- while (private->background == NULL && private->parent)
+ while (window->background == NULL && window->parent)
{
- cairo_translate (cr, -private->x, private->y);
- private = private->parent;
+ cairo_translate (cr, -window->x, window->y);
+ window = window->parent;
}
- if (private->background)
- cairo_set_source (cr, private->background);
+ if (window->background)
+ cairo_set_source (cr, window->background);
else
cairo_set_source_rgba (cr, 0, 0, 0, 0);
@@ -309,16 +433,14 @@ gdk_window_impl_quartz_end_paint (GdkPaintable *paintable)
}
}
-void
-_gdk_quartz_window_set_needs_display_in_region (GdkWindow *window,
- cairo_region_t *region)
+static void
+gdk_quartz_window_set_needs_display_in_region (GdkWindow *window,
+ cairo_region_t *region)
{
- GdkWindowObject *private;
GdkWindowImplQuartz *impl;
int i, n_rects;
- private = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (!impl->needs_display_region)
impl->needs_display_region = cairo_region_create ();
@@ -336,8 +458,8 @@ _gdk_quartz_window_set_needs_display_in_region (GdkWindow *window,
}
void
-_gdk_windowing_window_process_updates_recurse (GdkWindow *window,
- cairo_region_t *region)
+_gdk_quartz_window_process_updates_recurse (GdkWindow *window,
+ cairo_region_t *region)
{
/* Make sure to only flush each toplevel at most once if we're called
* from process_all_updates.
@@ -349,12 +471,10 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
toplevel = gdk_window_get_effective_toplevel (window);
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
{
- GdkWindowObject *toplevel_private;
GdkWindowImplQuartz *toplevel_impl;
NSWindow *nswindow;
- toplevel_private = (GdkWindowObject *)toplevel;
- toplevel_impl = (GdkWindowImplQuartz *)toplevel_private->impl;
+ toplevel_impl = (GdkWindowImplQuartz *)toplevel->impl;
nswindow = toplevel_impl->toplevel;
/* In theory, we could skip the flush disabling, since we only
@@ -370,7 +490,7 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
}
if (WINDOW_IS_TOPLEVEL (window))
- _gdk_quartz_window_set_needs_display_in_region (window, region);
+ gdk_quartz_window_set_needs_display_in_region (window, region);
else
_gdk_window_process_updates_recurse (window, region);
@@ -381,7 +501,7 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
}
void
-_gdk_windowing_before_process_all_updates (void)
+_gdk_quartz_display_before_process_all_updates (GdkDisplay *display)
{
in_process_all_updates = TRUE;
@@ -389,7 +509,7 @@ _gdk_windowing_before_process_all_updates (void)
}
void
-_gdk_windowing_after_process_all_updates (void)
+_gdk_quartz_display_after_process_all_updates (GdkDisplay *display)
{
GSList *old_update_nswindows = update_nswindows;
GSList *tmp_list = update_nswindows;
@@ -402,7 +522,7 @@ _gdk_windowing_after_process_all_updates (void)
[[nswindow contentView] displayIfNeeded];
- _gdk_quartz_drawable_flush (NULL);
+ _gdk_quartz_window_flush (NULL);
[nswindow enableFlushWindow];
[nswindow flushWindow];
@@ -425,54 +545,6 @@ gdk_window_impl_quartz_paintable_init (GdkPaintableIface *iface)
iface->end_paint = gdk_window_impl_quartz_end_paint;
}
-GType
-_gdk_window_impl_quartz_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkWindowImplQuartzClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_window_impl_quartz_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkWindowImplQuartz),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_window_impl_quartz_init,
- };
-
- const GInterfaceInfo paintable_info =
- {
- (GInterfaceInitFunc) gdk_window_impl_quartz_paintable_init,
- NULL,
- NULL
- };
-
- const GInterfaceInfo window_impl_info =
- {
- (GInterfaceInitFunc) gdk_window_impl_iface_init,
- NULL,
- NULL
- };
-
- object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_QUARTZ,
- "GdkWindowImplQuartz",
- &object_info, 0);
- g_type_add_interface_static (object_type,
- GDK_TYPE_PAINTABLE,
- &paintable_info);
- g_type_add_interface_static (object_type,
- GDK_TYPE_WINDOW_IMPL,
- &window_impl_info);
- }
-
- return object_type;
-}
-
static const gchar *
get_default_title (void)
{
@@ -493,15 +565,12 @@ get_ancestor_coordinates_from_child (GdkWindow *child_window,
gint *ancestor_x,
gint *ancestor_y)
{
- GdkWindowObject *child_private = GDK_WINDOW_OBJECT (child_window);
- GdkWindowObject *ancestor_private = GDK_WINDOW_OBJECT (ancestor_window);
-
- while (child_private != ancestor_private)
+ while (child_window != ancestor_window)
{
- child_x += child_private->x;
- child_y += child_private->y;
+ child_x += child_window->x;
+ child_y += child_window->y;
- child_private = child_private->parent;
+ child_window = child_window->parent;
}
*ancestor_x = child_x;
@@ -511,7 +580,6 @@ get_ancestor_coordinates_from_child (GdkWindow *child_window,
void
_gdk_quartz_window_debug_highlight (GdkWindow *window, gint number)
{
- GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
gint x, y;
gint gx, gy;
GdkWindow *toplevel;
@@ -542,10 +610,10 @@ _gdk_quartz_window_debug_highlight (GdkWindow *window, gint number)
x += tx;
y += ty;
- _gdk_quartz_window_gdk_xy_to_xy (x, y + private->height,
+ _gdk_quartz_window_gdk_xy_to_xy (x, y + window->height,
&gx, &gy);
- rect = NSMakeRect (gx, gy, private->width, private->height);
+ rect = NSMakeRect (gx, gy, window->width, window->height);
if (debug_window[number] && NSEqualRects (rect, old_rect[number]))
return;
@@ -615,7 +683,7 @@ _gdk_quartz_window_gdk_xy_to_xy (gint gdk_x,
gint *ns_x,
gint *ns_y)
{
- GdkScreenQuartz *screen_quartz = GDK_SCREEN_QUARTZ (_gdk_screen);
+ GdkQuartzScreen *screen_quartz = GDK_QUARTZ_SCREEN (_gdk_screen);
if (ns_y)
*ns_y = screen_quartz->height - gdk_y + screen_quartz->min_y;
@@ -630,7 +698,7 @@ _gdk_quartz_window_xy_to_gdk_xy (gint ns_x,
gint *gdk_x,
gint *gdk_y)
{
- GdkScreenQuartz *screen_quartz = GDK_SCREEN_QUARTZ (_gdk_screen);
+ GdkQuartzScreen *screen_quartz = GDK_QUARTZ_SCREEN (_gdk_screen);
if (gdk_y)
*gdk_y = screen_quartz->height - ns_y + screen_quartz->min_y;
@@ -659,22 +727,22 @@ find_child_window_helper (GdkWindow *window,
GdkWindowImplQuartz *impl;
GList *l;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (window == _gdk_root)
update_toplevel_order ();
for (l = impl->sorted_children; l; l = l->next)
{
- GdkWindowObject *child_private = l->data;
- GdkWindowImplQuartz *child_impl = GDK_WINDOW_IMPL_QUARTZ (child_private->impl);
+ GdkWindow *child = l->data;
+ GdkWindowImplQuartz *child_impl = GDK_WINDOW_IMPL_QUARTZ (child->impl);
int temp_x, temp_y;
- if (!GDK_WINDOW_IS_MAPPED (child_private))
+ if (!GDK_WINDOW_IS_MAPPED (child))
continue;
- temp_x = x_offset + child_private->x;
- temp_y = y_offset + child_private->y;
+ temp_x = x_offset + child->x;
+ temp_y = y_offset + child->y;
/* Special-case the root window. We have to include the title
* bar in the checks, otherwise the window below the title bar
@@ -698,7 +766,7 @@ find_child_window_helper (GdkWindow *window,
if (titlebar_height > 0 &&
x >= temp_x && y >= temp_y - titlebar_height &&
- x < temp_x + child_private->width && y < temp_y)
+ x < temp_x + child->width && y < temp_y)
{
/* The root means "unknown" i.e. a window not managed by
* GDK.
@@ -709,7 +777,7 @@ find_child_window_helper (GdkWindow *window,
if ((!get_toplevel || (get_toplevel && window == _gdk_root)) &&
x >= temp_x && y >= temp_y &&
- x < temp_x + child_private->width && y < temp_y + child_private->height)
+ x < temp_x + child->width && y < temp_y + child->height)
{
/* Look for child windows. */
return find_child_window_helper (l->data,
@@ -732,9 +800,7 @@ _gdk_quartz_window_find_child (GdkWindow *window,
gint y,
gboolean get_toplevel)
{
- GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
-
- if (x >= 0 && y >= 0 && x < private->width && y < private->height)
+ if (x >= 0 && y >= 0 && x < window->width && y < window->height)
return find_child_window_helper (window, x, y, 0, 0, get_toplevel);
return NULL;
@@ -746,7 +812,7 @@ _gdk_quartz_window_did_become_main (GdkWindow *window)
{
main_window_stack = g_slist_remove (main_window_stack, window);
- if (GDK_WINDOW_OBJECT (window)->window_type != GDK_WINDOW_TEMP)
+ if (window->window_type != GDK_WINDOW_TEMP)
main_window_stack = g_slist_prepend (main_window_stack, window);
clear_toplevel_order ();
@@ -774,8 +840,7 @@ _gdk_quartz_window_did_resign_main (GdkWindow *window)
GDK_WINDOW_IS_MAPPED (new_window) &&
WINDOW_IS_TOPLEVEL (new_window))
{
- GdkWindowObject *private = (GdkWindowObject *) new_window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (new_window->impl);
[impl->toplevel makeKeyAndOrderFront:impl->toplevel];
}
@@ -812,42 +877,38 @@ get_nsscreen_for_point (gint x, gint y)
}
void
-_gdk_window_impl_new (GdkWindow *window,
- GdkWindow *real_parent,
- GdkScreen *screen,
- GdkEventMask event_mask,
- GdkWindowAttr *attributes,
- gint attributes_mask)
+_gdk_quartz_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask)
{
- GdkWindowObject *private;
GdkWindowImplQuartz *impl;
- GdkDrawableImplQuartz *draw_impl;
GdkWindowImplQuartz *parent_impl;
GDK_QUARTZ_ALLOC_POOL;
- private = (GdkWindowObject *)window;
-
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_QUARTZ, NULL);
- private->impl = (GdkDrawable *)impl;
- draw_impl = GDK_DRAWABLE_IMPL_QUARTZ (impl);
- draw_impl->wrapper = GDK_DRAWABLE (window);
+ window->impl = GDK_WINDOW_IMPL (impl);
+ impl->wrapper = window;
- parent_impl = GDK_WINDOW_IMPL_QUARTZ (private->parent->impl);
+ parent_impl = GDK_WINDOW_IMPL_QUARTZ (window->parent->impl);
- switch (private->window_type)
+ switch (window->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_TEMP:
- if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
+ if (GDK_WINDOW_TYPE (window->parent) != GDK_WINDOW_ROOT)
{
/* The common code warns for this case */
- parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (_gdk_root)->impl);
+ parent_impl = GDK_WINDOW_IMPL_QUARTZ (_gdk_root->impl);
}
}
/* Maintain the z-ordered list of children. */
- if (private->parent != (GdkWindowObject *)_gdk_root)
+ if (window->parent != _gdk_root)
parent_impl->sorted_children = g_list_prepend (parent_impl->sorted_children, window);
else
clear_toplevel_order ();
@@ -875,16 +936,16 @@ _gdk_window_impl_new (GdkWindow *window,
* to find the screen the window will be on and correct the
* content_rect coordinates to be relative to that screen.
*/
- _gdk_quartz_window_gdk_xy_to_xy (private->x, private->y, &nx, &ny);
+ _gdk_quartz_window_gdk_xy_to_xy (window->x, window->y, &nx, &ny);
screen = get_nsscreen_for_point (nx, ny);
screen_rect = [screen frame];
nx -= screen_rect.origin.x;
ny -= screen_rect.origin.y;
- content_rect = NSMakeRect (nx, ny - private->height,
- private->width,
- private->height);
+ content_rect = NSMakeRect (nx, ny - window->height,
+ window->width,
+ window->height);
if (attributes->window_type == GDK_WINDOW_TEMP ||
attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
@@ -899,11 +960,11 @@ _gdk_window_impl_new (GdkWindow *window,
NSResizableWindowMask);
}
- impl->toplevel = [[GdkQuartzWindow alloc] initWithContentRect:content_rect
- styleMask:style_mask
- backing:NSBackingStoreBuffered
- defer:NO
- screen:screen];
+ impl->toplevel = [[GdkQuartzNSWindow alloc] initWithContentRect:content_rect
+ styleMask:style_mask
+ backing:NSBackingStoreBuffered
+ defer:NO
+ screen:screen];
if (attributes_mask & GDK_WA_TITLE)
title = attributes->title;
@@ -930,14 +991,14 @@ _gdk_window_impl_new (GdkWindow *window,
case GDK_WINDOW_CHILD:
{
- GdkWindowImplQuartz *parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (private->parent)->impl);
+ GdkWindowImplQuartz *parent_impl = GDK_WINDOW_IMPL_QUARTZ (window->parent->impl);
- if (!private->input_only)
+ if (!window->input_only)
{
- NSRect frame_rect = NSMakeRect (private->x + private->parent->abs_x,
- private->y + private->parent->abs_y,
- private->width,
- private->height);
+ NSRect frame_rect = NSMakeRect (window->x + window->parent->abs_x,
+ window->y + window->parent->abs_y,
+ window->width,
+ window->height);
impl->view = [[GdkQuartzView alloc] initWithFrame:frame_rect];
@@ -966,8 +1027,7 @@ _gdk_quartz_window_update_position (GdkWindow *window)
{
NSRect frame_rect;
NSRect content_rect;
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
GDK_QUARTZ_ALLOC_POOL;
@@ -976,88 +1036,54 @@ _gdk_quartz_window_update_position (GdkWindow *window)
_gdk_quartz_window_xy_to_gdk_xy (content_rect.origin.x,
content_rect.origin.y + content_rect.size.height,
- &private->x, &private->y);
+ &window->x, &window->y);
GDK_QUARTZ_RELEASE_POOL;
}
void
-_gdk_windowing_update_window_sizes (GdkScreen *screen)
+_gdk_quartz_window_init_windowing (GdkDisplay *display,
+ GdkScreen *screen)
{
- GList *windows, *list;
- GdkWindowObject *private = (GdkWindowObject *)_gdk_root;
-
- /* The size of the root window is so that it can contain all
- * monitors attached to this machine. The monitors are laid out
- * within this root window. We calculate the size of the root window
- * and the positions of the different monitors in gdkscreen-quartz.c.
- *
- * This data is updated when the monitor configuration is changed.
- */
- private->x = 0;
- private->y = 0;
- private->abs_x = 0;
- private->abs_y = 0;
- private->width = gdk_screen_get_width (screen);
- private->height = gdk_screen_get_height (screen);
-
- windows = gdk_screen_get_toplevel_windows (screen);
-
- for (list = windows; list; list = list->next)
- _gdk_quartz_window_update_position (list->data);
-
- g_list_free (windows);
-}
-
-void
-_gdk_windowing_window_init (void)
-{
- GdkWindowObject *private;
GdkWindowImplQuartz *impl;
- GdkDrawableImplQuartz *drawable_impl;
g_assert (_gdk_root == NULL);
- _gdk_root = g_object_new (GDK_TYPE_WINDOW, NULL);
+ _gdk_root = _gdk_display_create_window (display);
- private = (GdkWindowObject *)_gdk_root;
- private->impl = g_object_new (_gdk_root_window_impl_quartz_get_type (), NULL);
- private->impl_window = private;
- private->visual = gdk_screen_get_system_visual (_gdk_screen);
+ _gdk_root->impl = g_object_new (_gdk_root_window_impl_quartz_get_type (), NULL);
+ _gdk_root->impl_window = _gdk_root;
+ _gdk_root->visual = gdk_screen_get_system_visual (screen);
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (_gdk_root)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (_gdk_root->impl);
- _gdk_windowing_update_window_sizes (_gdk_screen);
+ _gdk_quartz_screen_update_window_sizes (screen);
- private->state = 0; /* We don't want GDK_WINDOW_STATE_WITHDRAWN here */
- private->window_type = GDK_WINDOW_ROOT;
- private->depth = 24;
- private->viewable = TRUE;
+ _gdk_root->state = 0; /* We don't want GDK_WINDOW_STATE_WITHDRAWN here */
+ _gdk_root->window_type = GDK_WINDOW_ROOT;
+ _gdk_root->depth = 24;
+ _gdk_root->viewable = TRUE;
- drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (private->impl);
-
- drawable_impl->wrapper = GDK_DRAWABLE (private);
+ impl->wrapper = _gdk_root;
}
static void
-_gdk_quartz_window_destroy (GdkWindow *window,
- gboolean recursing,
- gboolean foreign_destroy)
+gdk_quartz_window_destroy (GdkWindow *window,
+ gboolean recursing,
+ gboolean foreign_destroy)
{
- GdkWindowObject *private;
GdkWindowImplQuartz *impl;
- GdkWindowObject *parent;
+ GdkWindow *parent;
- private = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
main_window_stack = g_slist_remove (main_window_stack, window);
g_list_free (impl->sorted_children);
impl->sorted_children = NULL;
- parent = private->parent;
+ parent = window->parent;
if (parent)
{
GdkWindowImplQuartz *parent_impl = GDK_WINDOW_IMPL_QUARTZ (parent->impl);
@@ -1065,7 +1091,13 @@ _gdk_quartz_window_destroy (GdkWindow *window,
parent_impl->sorted_children = g_list_remove (parent_impl->sorted_children, window);
}
- _gdk_quartz_drawable_finish (GDK_DRAWABLE (impl));
+ if (impl->cairo_surface)
+ {
+ cairo_surface_finish (impl->cairo_surface);
+ cairo_surface_set_user_data (impl->cairo_surface, &gdk_quartz_cairo_key,
+ NULL, NULL);
+ impl->cairo_surface = NULL;
+ }
if (!recursing && !foreign_destroy)
{
@@ -1092,8 +1124,8 @@ gdk_window_quartz_resize_cairo_surface (GdkWindow *window,
return NULL;
}
-void
-_gdk_windowing_window_destroy_foreign (GdkWindow *window)
+static void
+gdk_quartz_window_destroy_foreign (GdkWindow *window)
{
/* Foreign windows aren't supported in OSX. */
}
@@ -1104,14 +1136,13 @@ _gdk_windowing_window_destroy_foreign (GdkWindow *window)
static void
gdk_window_quartz_show (GdkWindow *window, gboolean already_mapped)
{
- GdkWindowObject *private = (GdkWindowObject *)window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gboolean focus_on_map;
GDK_QUARTZ_ALLOC_POOL;
if (!GDK_WINDOW_IS_MAPPED (window))
- focus_on_map = private->focus_on_map;
+ focus_on_map = window->focus_on_map;
else
focus_on_map = TRUE;
@@ -1119,10 +1150,10 @@ gdk_window_quartz_show (GdkWindow *window, gboolean already_mapped)
{
gboolean make_key;
- make_key = (private->accept_focus && focus_on_map &&
- private->window_type != GDK_WINDOW_TEMP);
+ make_key = (window->accept_focus && focus_on_map &&
+ window->window_type != GDK_WINDOW_TEMP);
- [(GdkQuartzWindow*)impl->toplevel showAndMakeKey:make_key];
+ [(GdkQuartzNSWindow*)impl->toplevel showAndMakeKey:make_key];
clear_toplevel_order ();
_gdk_quartz_events_send_map_event (window);
@@ -1136,10 +1167,10 @@ gdk_window_quartz_show (GdkWindow *window, gboolean already_mapped)
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_WITHDRAWN, 0);
- if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
+ if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
gdk_window_maximize (window);
- if (private->state & GDK_WINDOW_STATE_ICONIFIED)
+ if (window->state & GDK_WINDOW_STATE_ICONIFIED)
gdk_window_iconify (window);
if (impl->transient_for && !GDK_WINDOW_DESTROYED (impl->transient_for))
@@ -1158,7 +1189,7 @@ _gdk_quartz_window_detach_from_parent (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window));
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
g_return_if_fail (impl->toplevel != NULL);
@@ -1166,7 +1197,7 @@ _gdk_quartz_window_detach_from_parent (GdkWindow *window)
{
GdkWindowImplQuartz *parent_impl;
- parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (impl->transient_for)->impl);
+ parent_impl = GDK_WINDOW_IMPL_QUARTZ (impl->transient_for->impl);
[parent_impl->toplevel removeChildWindow:impl->toplevel];
clear_toplevel_order ();
}
@@ -1180,7 +1211,7 @@ _gdk_quartz_window_attach_to_parent (GdkWindow *window)
g_return_if_fail (GDK_IS_WINDOW (window));
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
g_return_if_fail (impl->toplevel != NULL);
@@ -1188,7 +1219,7 @@ _gdk_quartz_window_attach_to_parent (GdkWindow *window)
{
GdkWindowImplQuartz *parent_impl;
- parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (impl->transient_for)->impl);
+ parent_impl = GDK_WINDOW_IMPL_QUARTZ (impl->transient_for->impl);
[parent_impl->toplevel addChildWindow:impl->toplevel ordered:NSWindowAbove];
clear_toplevel_order ();
}
@@ -1197,7 +1228,6 @@ _gdk_quartz_window_attach_to_parent (GdkWindow *window)
void
gdk_window_quartz_hide (GdkWindow *window)
{
- GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl;
/* Make sure we're not stuck in fullscreen mode. */
@@ -1208,7 +1238,7 @@ gdk_window_quartz_hide (GdkWindow *window)
_gdk_window_clear_update_area (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (WINDOW_IS_TOPLEVEL (window))
{
@@ -1220,7 +1250,7 @@ gdk_window_quartz_hide (GdkWindow *window)
if (impl->transient_for)
_gdk_quartz_window_detach_from_parent (window);
- [(GdkQuartzWindow*)impl->toplevel hide];
+ [(GdkQuartzNSWindow*)impl->toplevel hide];
}
else if (impl->view)
{
@@ -1241,7 +1271,6 @@ move_resize_window_internal (GdkWindow *window,
gint width,
gint height)
{
- GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl;
GdkRectangle old_visible;
GdkRectangle new_visible;
@@ -1253,12 +1282,12 @@ move_resize_window_internal (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
- if ((x == -1 || (x == private->x)) &&
- (y == -1 || (y == private->y)) &&
- (width == -1 || (width == private->width)) &&
- (height == -1 || (height == private->height)))
+ if ((x == -1 || (x == window->x)) &&
+ (y == -1 || (y == window->y)) &&
+ (width == -1 || (width == window->width)) &&
+ (height == -1 || (height == window->height)))
{
return;
}
@@ -1268,17 +1297,17 @@ move_resize_window_internal (GdkWindow *window,
/* The previously visible area of this window in a coordinate
* system rooted at the origin of this window.
*/
- old_visible.x = -private->x;
- old_visible.y = -private->y;
+ old_visible.x = -window->x;
+ old_visible.y = -window->y;
- old_visible.width = private->width;
- old_visible.height = private->height;
+ old_visible.width = window->width;
+ old_visible.height = window->height;
}
if (x != -1)
{
- delta.width = x - private->x;
- private->x = x;
+ delta.width = x - window->x;
+ window->x = x;
}
else
{
@@ -1287,8 +1316,8 @@ move_resize_window_internal (GdkWindow *window,
if (y != -1)
{
- delta.height = y - private->y;
- private->y = y;
+ delta.height = y - window->y;
+ window->y = y;
}
else
{
@@ -1296,10 +1325,10 @@ move_resize_window_internal (GdkWindow *window,
}
if (width != -1)
- private->width = width;
+ window->width = width;
if (height != -1)
- private->height = height;
+ window->height = height;
GDK_QUARTZ_ALLOC_POOL;
@@ -1309,27 +1338,27 @@ move_resize_window_internal (GdkWindow *window,
NSRect frame_rect;
gint gx, gy;
- _gdk_quartz_window_gdk_xy_to_xy (private->x, private->y + private->height,
+ _gdk_quartz_window_gdk_xy_to_xy (window->x, window->y + window->height,
&gx, &gy);
- content_rect = NSMakeRect (gx, gy, private->width, private->height);
+ content_rect = NSMakeRect (gx, gy, window->width, window->height);
frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
[impl->toplevel setFrame:frame_rect display:YES];
}
else
{
- if (!private->input_only)
+ if (!window->input_only)
{
NSRect nsrect;
- nsrect = NSMakeRect (private->x, private->y, private->width, private->height);
+ nsrect = NSMakeRect (window->x, window->y, window->width, window->height);
/* The newly visible area of this window in a coordinate
* system rooted at the origin of this window.
*/
- new_visible.x = -private->x;
- new_visible.y = -private->y;
+ new_visible.x = -window->x;
+ new_visible.y = -window->y;
new_visible.width = old_visible.width; /* parent has not changed size */
new_visible.height = old_visible.height; /* parent has not changed size */
@@ -1358,7 +1387,7 @@ move_resize_window_internal (GdkWindow *window,
[impl->view setFrame:nsrect];
- _gdk_quartz_window_set_needs_display_in_region (window, expose_region);
+ gdk_quartz_window_set_needs_display_in_region (window, expose_region);
}
else
{
@@ -1381,7 +1410,7 @@ window_quartz_move (GdkWindow *window,
{
g_return_if_fail (GDK_IS_WINDOW (window));
- if (((GdkWindowObject *)window)->state & GDK_WINDOW_STATE_FULLSCREEN)
+ if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
return;
move_resize_window_internal (window, x, y, -1, -1);
@@ -1394,7 +1423,7 @@ window_quartz_resize (GdkWindow *window,
{
g_return_if_fail (GDK_IS_WINDOW (window));
- if (((GdkWindowObject *)window)->state & GDK_WINDOW_STATE_FULLSCREEN)
+ if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
return;
if (width < 1)
@@ -1448,7 +1477,7 @@ gdk_window_quartz_reparent (GdkWindow *window,
gint x,
gint y)
{
- GdkWindowObject *private, *old_parent_private, *new_parent_private;
+ GdkWindow *old_parent;
GdkWindowImplQuartz *impl, *old_parent_impl, *new_parent_impl;
NSView *view, *new_parent_view;
@@ -1459,16 +1488,14 @@ gdk_window_quartz_reparent (GdkWindow *window,
return FALSE;
}
- private = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
view = impl->view;
- new_parent_private = GDK_WINDOW_OBJECT (new_parent);
- new_parent_impl = GDK_WINDOW_IMPL_QUARTZ (new_parent_private->impl);
+ new_parent_impl = GDK_WINDOW_IMPL_QUARTZ (new_parent->impl);
new_parent_view = new_parent_impl->view;
- old_parent_private = GDK_WINDOW_OBJECT (private->parent);
- old_parent_impl = GDK_WINDOW_IMPL_QUARTZ (old_parent_private->impl);
+ old_parent = window->parent;
+ old_parent_impl = GDK_WINDOW_IMPL_QUARTZ (old_parent->impl);
[view retain];
@@ -1477,9 +1504,9 @@ gdk_window_quartz_reparent (GdkWindow *window,
[view release];
- private->parent = new_parent_private;
+ window->parent = new_parent;
- if (old_parent_private)
+ if (old_parent)
{
old_parent_impl->sorted_children = g_list_remove (old_parent_impl->sorted_children, window);
}
@@ -1496,14 +1523,12 @@ gdk_window_quartz_reparent (GdkWindow *window,
static void
update_toplevel_order (void)
{
- GdkWindowObject *root;
GdkWindowImplQuartz *root_impl;
NSEnumerator *enumerator;
id nswindow;
GList *toplevels = NULL;
- root = GDK_WINDOW_OBJECT (_gdk_root);
- root_impl = GDK_WINDOW_IMPL_QUARTZ (root->impl);
+ root_impl = GDK_WINDOW_IMPL_QUARTZ (_gdk_root->impl);
if (root_impl->sorted_children)
return;
@@ -1530,11 +1555,9 @@ update_toplevel_order (void)
static void
clear_toplevel_order (void)
{
- GdkWindowObject *root;
GdkWindowImplQuartz *root_impl;
- root = GDK_WINDOW_OBJECT (_gdk_root);
- root_impl = GDK_WINDOW_IMPL_QUARTZ (root->impl);
+ root_impl = GDK_WINDOW_IMPL_QUARTZ (_gdk_root->impl);
g_list_free (root_impl->sorted_children);
root_impl->sorted_children = NULL;
@@ -1550,14 +1573,14 @@ gdk_window_quartz_raise (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
[impl->toplevel orderFront:impl->toplevel];
clear_toplevel_order ();
}
else
{
- GdkWindowObject *parent = GDK_WINDOW_OBJECT (window)->parent;
+ GdkWindow *parent = window->parent;
if (parent)
{
@@ -1581,14 +1604,14 @@ gdk_window_quartz_lower (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
[impl->toplevel orderBack:impl->toplevel];
clear_toplevel_order ();
}
else
{
- GdkWindowObject *parent = GDK_WINDOW_OBJECT (window)->parent;
+ GdkWindow *parent = window->parent;
if (parent)
{
@@ -1624,18 +1647,12 @@ gdk_window_quartz_set_device_cursor (GdkWindow *window,
GdkDevice *device,
GdkCursor *cursor)
{
- GdkCursorPrivate *cursor_private;
NSCursor *nscursor;
- cursor_private = (GdkCursorPrivate *)cursor;
-
if (GDK_WINDOW_DESTROYED (window))
return;
- if (!cursor)
- nscursor = [NSCursor arrowCursor];
- else
- nscursor = cursor_private->nscursor;
+ nscursor = _gdk_quartz_cursor_get_ns_cursor (cursor);
[nscursor set];
}
@@ -1645,18 +1662,15 @@ gdk_window_quartz_get_geometry (GdkWindow *window,
gint *x,
gint *y,
gint *width,
- gint *height,
- gint *depth)
+ gint *height)
{
GdkWindowImplQuartz *impl;
- GdkWindowObject *private;
NSRect ns_rect;
if (GDK_WINDOW_DESTROYED (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
- private = GDK_WINDOW_OBJECT (window);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (window == _gdk_root)
{
if (x)
@@ -1665,9 +1679,9 @@ gdk_window_quartz_get_geometry (GdkWindow *window,
*y = 0;
if (width)
- *width = private->width;
+ *width = window->width;
if (height)
- *height = private->height;
+ *height = window->height;
}
else if (WINDOW_IS_TOPLEVEL (window))
{
@@ -1713,9 +1727,6 @@ gdk_window_quartz_get_geometry (GdkWindow *window,
if (height)
*height = ns_rect.size.height;
}
-
- if (depth)
- *depth = gdk_visual_get_depth (gdk_window_get_visual (window));
}
static gint
@@ -1725,7 +1736,6 @@ gdk_window_quartz_get_root_coords (GdkWindow *window,
gint *root_x,
gint *root_y)
{
- GdkWindowObject *private;
int tmp_x = 0, tmp_y = 0;
GdkWindow *toplevel;
NSRect content_rect;
@@ -1751,10 +1761,8 @@ gdk_window_quartz_get_root_coords (GdkWindow *window,
return 1;
}
- private = GDK_WINDOW_OBJECT (window);
-
toplevel = gdk_window_get_toplevel (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
content_rect = [impl->toplevel contentRectForFrameRect:[impl->toplevel frame]];
@@ -1765,15 +1773,15 @@ gdk_window_quartz_get_root_coords (GdkWindow *window,
tmp_x += x;
tmp_y += y;
- while (private != GDK_WINDOW_OBJECT (toplevel))
+ while (window != toplevel)
{
- if (_gdk_window_has_impl ((GdkWindow *)private))
+ if (_gdk_window_has_impl ((GdkWindow *)window))
{
- tmp_x += private->x;
- tmp_y += private->y;
+ tmp_x += window->x;
+ tmp_y += window->y;
}
- private = private->parent;
+ window = window->parent;
}
if (root_x)
@@ -1784,10 +1792,10 @@ gdk_window_quartz_get_root_coords (GdkWindow *window,
return TRUE;
}
-void
-gdk_window_get_root_origin (GdkWindow *window,
- gint *x,
- gint *y)
+static void
+gdk_quartz_window_get_root_origin (GdkWindow *window,
+ gint *x,
+ gint *y)
{
GdkRectangle rect;
@@ -1811,10 +1819,9 @@ gdk_window_quartz_get_device_state_helper (GdkWindow *window,
gint *y,
GdkModifierType *mask)
{
- GdkWindowObject *toplevel;
- GdkWindowObject *private;
NSPoint point;
gint x_tmp, y_tmp;
+ GdkWindow *toplevel;
GdkWindow *found_window;
g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
@@ -1827,7 +1834,7 @@ gdk_window_quartz_get_device_state_helper (GdkWindow *window,
return NULL;
}
- toplevel = GDK_WINDOW_OBJECT (gdk_window_get_toplevel (window));
+ toplevel = gdk_window_get_toplevel (window);
*mask = _gdk_quartz_events_get_current_event_mask ();
@@ -1843,13 +1850,12 @@ gdk_window_quartz_get_device_state_helper (GdkWindow *window,
NSWindow *nswindow;
impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
- private = GDK_WINDOW_OBJECT (toplevel);
nswindow = impl->toplevel;
point = [nswindow mouseLocationOutsideOfEventStream];
x_tmp = point.x;
- y_tmp = private->height - point.y;
+ y_tmp = toplevel->height - point.y;
window = (GdkWindow *)toplevel;
}
@@ -1894,15 +1900,6 @@ _gdk_windowing_get_device_state (GdkDisplay *display,
gdk_window_quartz_get_device_state_helper (_gdk_root, device, x, y, mask);
}
-void
-gdk_display_warp_pointer (GdkDisplay *display,
- GdkScreen *screen,
- gint x,
- gint y)
-{
- CGDisplayMoveCursorToPoint (CGMainDisplayID (), CGPointMake (x, y));
-}
-
/* Returns coordinates relative to the found window. */
GdkWindow *
_gdk_windowing_window_at_pointer (GdkDisplay *display,
@@ -1921,18 +1918,15 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display,
&tmp_mask);
if (found_window)
{
- GdkWindowObject *private;
-
/* The coordinates returned above are relative the root, we want
* coordinates relative the window here.
*/
- private = GDK_WINDOW_OBJECT (found_window);
- while (private != GDK_WINDOW_OBJECT (_gdk_root))
+ while (found_window != _gdk_root)
{
- x -= private->x;
- y -= private->y;
+ x -= found_window->x;
+ y -= found_window->y;
- private = private->parent;
+ found_window = found_window->parent;
}
*win_x = x;
@@ -1950,21 +1944,19 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display,
if (get_toplevel)
{
- GdkWindowObject *w = (GdkWindowObject *)found_window;
/* Requested toplevel, find it. */
/* TODO: This can be implemented more efficient by never
recursing into children in the first place */
- if (w)
+ if (found_window)
{
/* Convert to toplevel */
- while (w->parent != NULL &&
- w->parent->window_type != GDK_WINDOW_ROOT)
+ while (found_window->parent != NULL &&
+ found_window->parent->window_type != GDK_WINDOW_ROOT)
{
- *win_x += w->x;
- *win_y += w->y;
- w = w->parent;
+ *win_x += found_window->x;
+ *win_y += found_window->y;
+ found_window = found_window->parent;
}
- found_window = (GdkWindow *)w;
}
}
@@ -1992,7 +1984,7 @@ gdk_window_quartz_get_events (GdkWindow *window)
if (GDK_WINDOW_DESTROYED (window))
return 0;
else
- return GDK_WINDOW_OBJECT (window)->event_mask;
+ return window->event_mask;
}
static void
@@ -2002,9 +1994,9 @@ gdk_window_quartz_set_events (GdkWindow *window,
/* The mask is set in the common code. */
}
-void
-gdk_window_set_urgency_hint (GdkWindow *window,
- gboolean urgent)
+static void
+gdk_quartz_window_set_urgency_hint (GdkWindow *window,
+ gboolean urgent)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
@@ -2013,10 +2005,10 @@ gdk_window_set_urgency_hint (GdkWindow *window,
/* FIXME: Implement */
}
-void
-gdk_window_set_geometry_hints (GdkWindow *window,
- const GdkGeometry *geometry,
- GdkWindowHints geom_mask)
+static void
+gdk_quartz_window_set_geometry_hints (GdkWindow *window,
+ const GdkGeometry *geometry,
+ GdkWindowHints geom_mask)
{
GdkWindowImplQuartz *impl;
@@ -2026,7 +2018,7 @@ gdk_window_set_geometry_hints (GdkWindow *window,
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (!impl->toplevel)
return;
@@ -2091,9 +2083,9 @@ gdk_window_set_geometry_hints (GdkWindow *window,
}
}
-void
-gdk_window_set_title (GdkWindow *window,
- const gchar *title)
+static void
+gdk_quartz_window_set_title (GdkWindow *window,
+ const gchar *title)
{
GdkWindowImplQuartz *impl;
@@ -2103,7 +2095,7 @@ gdk_window_set_title (GdkWindow *window,
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *)window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (impl->toplevel)
{
@@ -2113,9 +2105,9 @@ gdk_window_set_title (GdkWindow *window,
}
}
-void
-gdk_window_set_role (GdkWindow *window,
- const gchar *role)
+static void
+gdk_quartz_window_set_role (GdkWindow *window,
+ const gchar *role)
{
if (GDK_WINDOW_DESTROYED (window) ||
WINDOW_IS_TOPLEVEL (window))
@@ -2124,9 +2116,16 @@ gdk_window_set_role (GdkWindow *window,
/* FIXME: Implement */
}
-void
-gdk_window_set_transient_for (GdkWindow *window,
- GdkWindow *parent)
+static void
+gdk_quartz_window_set_startup_id (GdkWindow *window,
+ const gchar *startup_id)
+{
+ /* FIXME: Implement? */
+}
+
+static void
+gdk_quartz_window_set_transient_for (GdkWindow *window,
+ GdkWindow *parent)
{
GdkWindowImplQuartz *window_impl;
GdkWindowImplQuartz *parent_impl;
@@ -2135,7 +2134,7 @@ gdk_window_set_transient_for (GdkWindow *window,
!WINDOW_IS_TOPLEVEL (window))
return;
- window_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ window_impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (!window_impl->toplevel)
return;
@@ -2149,7 +2148,7 @@ gdk_window_set_transient_for (GdkWindow *window,
window_impl->transient_for = NULL;
}
- parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (parent)->impl);
+ parent_impl = GDK_WINDOW_IMPL_QUARTZ (parent->impl);
if (parent_impl->toplevel)
{
/* We save the parent because it needs to be unset/reset when
@@ -2169,7 +2168,7 @@ gdk_window_set_transient_for (GdkWindow *window,
* be shown unconditionally here. If it is not shown, the
* window will be added in show() instead.
*/
- if (!(GDK_WINDOW_OBJECT (window)->state & GDK_WINDOW_STATE_WITHDRAWN))
+ if (!(window->state & GDK_WINDOW_STATE_WITHDRAWN))
_gdk_quartz_window_attach_to_parent (window);
}
}
@@ -2195,22 +2194,18 @@ gdk_window_quartz_input_shape_combine_region (GdkWindow *window,
/* FIXME: Implement */
}
-void
-gdk_window_set_override_redirect (GdkWindow *window,
- gboolean override_redirect)
+static void
+gdk_quartz_window_set_override_redirect (GdkWindow *window,
+ gboolean override_redirect)
{
/* FIXME: Implement */
}
-void
-gdk_window_set_accept_focus (GdkWindow *window,
- gboolean accept_focus)
+static void
+gdk_quartz_window_set_accept_focus (GdkWindow *window,
+ gboolean accept_focus)
{
- GdkWindowObject *private;
-
- private = (GdkWindowObject *)window;
-
- private->accept_focus = accept_focus != FALSE;
+ window->accept_focus = accept_focus != FALSE;
}
static gboolean
@@ -2225,39 +2220,83 @@ gdk_window_quartz_set_static_gravities (GdkWindow *window,
return FALSE;
}
-void
-gdk_window_set_focus_on_map (GdkWindow *window,
- gboolean focus_on_map)
+static gboolean
+gdk_quartz_window_queue_antiexpose (GdkWindow *window,
+ cairo_region_t *area)
{
- GdkWindowObject *private;
-
- private = (GdkWindowObject *)window;
-
- private->focus_on_map = focus_on_map != FALSE;
+ return FALSE;
}
-void
-gdk_window_set_icon_name (GdkWindow *window,
- const gchar *name)
+static void
+gdk_quartz_window_translate (GdkWindow *window,
+ cairo_region_t *area,
+ gint dx,
+ gint dy)
+{
+ cairo_region_t *invalidate, *scrolled;
+ GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)window->impl;
+ GdkRectangle extents;
+
+ cairo_region_get_extents (area, &extents);
+
+ [impl->view scrollRect:NSMakeRect (extents.x - dx, extents.y - dy,
+ extents.width, extents.height)
+ by:NSMakeSize (dx, dy)];
+
+ if (impl->needs_display_region)
+ {
+ cairo_region_t *intersection;
+
+ /* Invalidate already invalidated area that was moved at new
+ * location.
+ */
+ intersection = cairo_region_copy (impl->needs_display_region);
+ cairo_region_intersect (intersection, area);
+ cairo_region_translate (intersection, dx, dy);
+
+ gdk_quartz_window_set_needs_display_in_region (window, intersection);
+ cairo_region_destroy (intersection);
+ }
+
+ /* Calculate newly exposed area that needs invalidation */
+ scrolled = cairo_region_copy (area);
+ cairo_region_translate (scrolled, dx, dy);
+
+ invalidate = cairo_region_copy (area);
+ cairo_region_subtract (invalidate, scrolled);
+ cairo_region_destroy (scrolled);
+
+ gdk_quartz_window_set_needs_display_in_region (window, invalidate);
+ cairo_region_destroy (invalidate);
+}
+
+static void
+gdk_quartz_window_set_focus_on_map (GdkWindow *window,
+ gboolean focus_on_map)
+{
+ window->focus_on_map = focus_on_map != FALSE;
+}
+
+static void
+gdk_quartz_window_set_icon_name (GdkWindow *window,
+ const gchar *name)
{
/* FIXME: Implement */
}
-void
-gdk_window_focus (GdkWindow *window,
- guint32 timestamp)
+static void
+gdk_quartz_window_focus (GdkWindow *window,
+ guint32 timestamp)
{
- GdkWindowObject *private;
GdkWindowImplQuartz *impl;
- private = (GdkWindowObject*) window;
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return;
- if (private->accept_focus && private->window_type != GDK_WINDOW_TEMP)
+ if (window->accept_focus && window->window_type != GDK_WINDOW_TEMP)
{
GDK_QUARTZ_ALLOC_POOL;
[impl->toplevel makeKeyAndOrderFront:impl->toplevel];
@@ -2333,9 +2372,9 @@ window_type_hint_to_shadow (GdkWindowTypeHint hint)
}
-void
-gdk_window_set_type_hint (GdkWindow *window,
- GdkWindowTypeHint hint)
+static void
+gdk_quartz_window_set_type_hint (GdkWindow *window,
+ GdkWindowTypeHint hint)
{
GdkWindowImplQuartz *impl;
@@ -2343,7 +2382,7 @@ gdk_window_set_type_hint (GdkWindow *window,
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
impl->type_hint = hint;
@@ -2355,19 +2394,19 @@ gdk_window_set_type_hint (GdkWindow *window,
[impl->toplevel setLevel: window_type_hint_to_level (hint)];
}
-GdkWindowTypeHint
-gdk_window_get_type_hint (GdkWindow *window)
+static GdkWindowTypeHint
+gdk_quartz_window_get_type_hint (GdkWindow *window)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return GDK_WINDOW_TYPE_HINT_NORMAL;
- return GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl)->type_hint;
+ return GDK_WINDOW_IMPL_QUARTZ (window->impl)->type_hint;
}
-void
-gdk_window_set_modal_hint (GdkWindow *window,
- gboolean modal)
+static void
+gdk_quartz_window_set_modal_hint (GdkWindow *window,
+ gboolean modal)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
@@ -2376,9 +2415,9 @@ gdk_window_set_modal_hint (GdkWindow *window,
/* FIXME: Implement */
}
-void
-gdk_window_set_skip_taskbar_hint (GdkWindow *window,
- gboolean skips_taskbar)
+static void
+gdk_quartz_window_set_skip_taskbar_hint (GdkWindow *window,
+ gboolean skips_taskbar)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
@@ -2387,9 +2426,9 @@ gdk_window_set_skip_taskbar_hint (GdkWindow *window,
/* FIXME: Implement */
}
-void
-gdk_window_set_skip_pager_hint (GdkWindow *window,
- gboolean skips_pager)
+static void
+gdk_quartz_window_set_skip_pager_hint (GdkWindow *window,
+ gboolean skips_pager)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
@@ -2398,15 +2437,14 @@ gdk_window_set_skip_pager_hint (GdkWindow *window,
/* FIXME: Implement */
}
-void
-gdk_window_begin_resize_drag (GdkWindow *window,
- GdkWindowEdge edge,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+static void
+gdk_quartz_window_begin_resize_drag (GdkWindow *window,
+ GdkWindowEdge edge,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp)
{
- GdkWindowObject *private;
GdkWindowImplQuartz *impl;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2420,8 +2458,7 @@ gdk_window_begin_resize_drag (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window))
return;
- private = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (!impl->toplevel)
{
@@ -2429,25 +2466,23 @@ gdk_window_begin_resize_drag (GdkWindow *window,
return;
}
- [(GdkQuartzWindow *)impl->toplevel beginManualResize];
+ [(GdkQuartzNSWindow *)impl->toplevel beginManualResize];
}
-void
-gdk_window_begin_move_drag (GdkWindow *window,
- gint button,
- gint root_x,
- gint root_y,
- guint32 timestamp)
+static void
+gdk_quartz_window_begin_move_drag (GdkWindow *window,
+ gint button,
+ gint root_x,
+ gint root_y,
+ guint32 timestamp)
{
- GdkWindowObject *private;
GdkWindowImplQuartz *impl;
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return;
- private = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (!impl->toplevel)
{
@@ -2455,28 +2490,26 @@ gdk_window_begin_move_drag (GdkWindow *window,
return;
}
- [(GdkQuartzWindow *)impl->toplevel beginManualMove];
+ [(GdkQuartzNSWindow *)impl->toplevel beginManualMove];
}
-void
-gdk_window_set_icon_list (GdkWindow *window,
- GList *pixbufs)
+static void
+gdk_quartz_window_set_icon_list (GdkWindow *window,
+ GList *pixbufs)
{
/* FIXME: Implement */
}
-void
-gdk_window_get_frame_extents (GdkWindow *window,
- GdkRectangle *rect)
+static void
+gdk_quartz_window_get_frame_extents (GdkWindow *window,
+ GdkRectangle *rect)
{
- GdkWindowObject *private;
GdkWindow *toplevel;
GdkWindowImplQuartz *impl;
NSRect ns_rect;
g_return_if_fail (rect != NULL);
- private = GDK_WINDOW_OBJECT (window);
rect->x = 0;
rect->y = 0;
@@ -2484,7 +2517,7 @@ gdk_window_get_frame_extents (GdkWindow *window,
rect->height = 1;
toplevel = gdk_window_get_effective_toplevel (window);
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
ns_rect = [impl->toplevel frame];
@@ -2496,9 +2529,9 @@ gdk_window_get_frame_extents (GdkWindow *window,
rect->height = ns_rect.size.height;
}
-void
-gdk_window_set_decorations (GdkWindow *window,
- GdkWMDecoration decorations)
+static void
+gdk_quartz_window_set_decorations (GdkWindow *window,
+ GdkWMDecoration decorations)
{
GdkWindowImplQuartz *impl;
NSUInteger old_mask, new_mask;
@@ -2508,7 +2541,7 @@ gdk_window_set_decorations (GdkWindow *window,
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (decorations == 0 || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP ||
impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN )
@@ -2574,9 +2607,9 @@ gdk_window_set_decorations (GdkWindow *window,
GDK_QUARTZ_RELEASE_POOL;
}
-gboolean
-gdk_window_get_decorations (GdkWindow *window,
- GdkWMDecoration *decorations)
+static gboolean
+gdk_quartz_window_get_decorations (GdkWindow *window,
+ GdkWMDecoration *decorations)
{
GdkWindowImplQuartz *impl;
@@ -2584,7 +2617,7 @@ gdk_window_get_decorations (GdkWindow *window,
!WINDOW_IS_TOPLEVEL (window))
return FALSE;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (decorations)
{
@@ -2603,9 +2636,9 @@ gdk_window_get_decorations (GdkWindow *window,
return TRUE;
}
-void
-gdk_window_set_functions (GdkWindow *window,
- GdkWMFunction functions)
+static void
+gdk_quartz_window_set_functions (GdkWindow *window,
+ GdkWMFunction functions)
{
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2619,24 +2652,24 @@ _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
return FALSE;
}
-void
-gdk_window_stick (GdkWindow *window)
+static void
+gdk_quartz_window_stick (GdkWindow *window)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return;
}
-void
-gdk_window_unstick (GdkWindow *window)
+static void
+gdk_quartz_window_unstick (GdkWindow *window)
{
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL (window))
return;
}
-void
-gdk_window_maximize (GdkWindow *window)
+static void
+gdk_quartz_window_maximize (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
@@ -2644,7 +2677,7 @@ gdk_window_maximize (GdkWindow *window)
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (GDK_WINDOW_IS_MAPPED (window))
{
@@ -2663,8 +2696,8 @@ gdk_window_maximize (GdkWindow *window)
}
}
-void
-gdk_window_unmaximize (GdkWindow *window)
+static void
+gdk_quartz_window_unmaximize (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
@@ -2672,7 +2705,7 @@ gdk_window_unmaximize (GdkWindow *window)
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (GDK_WINDOW_IS_MAPPED (window))
{
@@ -2691,8 +2724,8 @@ gdk_window_unmaximize (GdkWindow *window)
}
}
-void
-gdk_window_iconify (GdkWindow *window)
+static void
+gdk_quartz_window_iconify (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
@@ -2700,7 +2733,7 @@ gdk_window_iconify (GdkWindow *window)
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (GDK_WINDOW_IS_MAPPED (window))
{
@@ -2719,8 +2752,8 @@ gdk_window_iconify (GdkWindow *window)
}
}
-void
-gdk_window_deiconify (GdkWindow *window)
+static void
+gdk_quartz_window_deiconify (GdkWindow *window)
{
GdkWindowImplQuartz *impl;
@@ -2728,7 +2761,7 @@ gdk_window_deiconify (GdkWindow *window)
!WINDOW_IS_TOPLEVEL (window))
return;
- impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
if (GDK_WINDOW_IS_MAPPED (window))
{
@@ -2753,11 +2786,10 @@ get_fullscreen_geometry (GdkWindow *window)
return g_object_get_data (G_OBJECT (window), FULLSCREEN_DATA);
}
-void
-gdk_window_fullscreen (GdkWindow *window)
+static void
+gdk_quartz_window_fullscreen (GdkWindow *window)
{
FullscreenSavedGeometry *geometry;
- GdkWindowObject *private = (GdkWindowObject *) window;
NSRect frame;
if (GDK_WINDOW_DESTROYED (window) ||
@@ -2769,10 +2801,10 @@ gdk_window_fullscreen (GdkWindow *window)
{
geometry = g_new (FullscreenSavedGeometry, 1);
- geometry->x = private->x;
- geometry->y = private->y;
- geometry->width = private->width;
- geometry->height = private->height;
+ geometry->x = window->x;
+ geometry->y = window->y;
+ geometry->width = window->width;
+ geometry->height = window->height;
if (!gdk_window_get_decorations (window, &geometry->decor))
geometry->decor = GDK_DECOR_ALL;
@@ -2794,8 +2826,8 @@ gdk_window_fullscreen (GdkWindow *window)
gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
}
-void
-gdk_window_unfullscreen (GdkWindow *window)
+static void
+gdk_quartz_window_unfullscreen (GdkWindow *window)
{
FullscreenSavedGeometry *geometry;
@@ -2822,11 +2854,11 @@ gdk_window_unfullscreen (GdkWindow *window)
}
}
-void
-gdk_window_set_keep_above (GdkWindow *window, gboolean setting)
+static void
+gdk_quartz_window_set_keep_above (GdkWindow *window,
+ gboolean setting)
{
- GdkWindowObject *private = (GdkWindowObject *) window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gint level;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2841,11 +2873,11 @@ gdk_window_set_keep_above (GdkWindow *window, gboolean setting)
[impl->toplevel setLevel: level + (setting ? 1 : 0)];
}
-void
-gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
+static void
+gdk_quartz_window_set_keep_below (GdkWindow *window,
+ gboolean setting)
{
- GdkWindowObject *private = (GdkWindowObject *) window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
gint level;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -2860,8 +2892,8 @@ gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
[impl->toplevel setLevel: level - (setting ? 1 : 0)];
}
-GdkWindow *
-gdk_window_get_group (GdkWindow *window)
+static GdkWindow *
+gdk_quartz_window_get_group (GdkWindow *window)
{
g_return_val_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD, NULL);
@@ -2874,57 +2906,34 @@ gdk_window_get_group (GdkWindow *window)
return NULL;
}
-void
-gdk_window_set_group (GdkWindow *window,
- GdkWindow *leader)
+static void
+gdk_quartz_window_set_group (GdkWindow *window,
+ GdkWindow *leader)
{
/* FIXME: Implement */
}
-GdkWindow*
-gdk_window_foreign_new_for_display (GdkDisplay *display,
- GdkNativeWindow anid)
-{
- /* Foreign windows aren't supported in Mac OS X */
- return NULL;
-}
-
-GdkWindow*
-gdk_window_lookup (GdkNativeWindow anid)
-{
- /* Foreign windows aren't supported in Mac OS X */
- return NULL;
-}
-
-GdkWindow *
-gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
-{
- /* Foreign windows aren't supported in Mac OS X */
- return NULL;
-}
-
-void
-gdk_window_enable_synchronized_configure (GdkWindow *window)
+static void
+gdk_quartz_window_enable_synchronized_configure (GdkWindow *window)
{
}
-void
-gdk_window_configure_finished (GdkWindow *window)
+static void
+gdk_quartz_window_configure_finished (GdkWindow *window)
{
}
-void
-gdk_window_destroy_notify (GdkWindow *window)
+static void
+gdk_quartz_window_destroy_notify (GdkWindow *window)
{
check_grab_destroy (window);
}
-void
-gdk_window_set_opacity (GdkWindow *window,
- gdouble opacity)
+static void
+gdk_quartz_window_set_opacity (GdkWindow *window,
+ gdouble opacity)
{
- GdkWindowObject *private = (GdkWindowObject *) window;
- GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
+ GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (window->impl);
g_return_if_fail (GDK_IS_WINDOW (window));
g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
@@ -2941,11 +2950,6 @@ gdk_window_set_opacity (GdkWindow *window,
[impl->toplevel setAlphaValue: opacity];
}
-void
-_gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
-{
-}
-
static cairo_region_t *
gdk_quartz_window_get_shape (GdkWindow *window)
{
@@ -2960,45 +2964,178 @@ gdk_quartz_window_get_input_shape (GdkWindow *window)
return NULL;
}
+
static void
-gdk_window_impl_iface_init (GdkWindowImplIface *iface)
+gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
{
- iface->show = gdk_window_quartz_show;
- iface->hide = gdk_window_quartz_hide;
- iface->withdraw = gdk_window_quartz_withdraw;
- iface->set_events = gdk_window_quartz_set_events;
- iface->get_events = gdk_window_quartz_get_events;
- iface->raise = gdk_window_quartz_raise;
- iface->lower = gdk_window_quartz_lower;
- iface->restack_toplevel = gdk_window_quartz_restack_toplevel;
- iface->move_resize = gdk_window_quartz_move_resize;
- iface->set_background = gdk_window_quartz_set_background;
- iface->reparent = gdk_window_quartz_reparent;
- iface->set_device_cursor = gdk_window_quartz_set_device_cursor;
- iface->get_geometry = gdk_window_quartz_get_geometry;
- iface->get_root_coords = gdk_window_quartz_get_root_coords;
- iface->get_device_state = gdk_window_quartz_get_device_state;
- iface->shape_combine_region = gdk_window_quartz_shape_combine_region;
- iface->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
- iface->set_static_gravities = gdk_window_quartz_set_static_gravities;
- iface->queue_antiexpose = _gdk_quartz_window_queue_antiexpose;
- iface->translate = _gdk_quartz_window_translate;
- iface->destroy = _gdk_quartz_window_destroy;
- iface->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
- iface->get_shape = gdk_quartz_window_get_shape;
- iface->get_input_shape = gdk_quartz_window_get_input_shape;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkWindowImplClass *impl_class = GDK_WINDOW_IMPL_CLASS (klass);
+ GdkWindowImplQuartzClass *impl_quartz_class = GDK_WINDOW_IMPL_QUARTZ_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gdk_window_impl_quartz_finalize;
+
+ impl_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
+ impl_class->show = gdk_window_quartz_show;
+ impl_class->hide = gdk_window_quartz_hide;
+ impl_class->withdraw = gdk_window_quartz_withdraw;
+ impl_class->set_events = gdk_window_quartz_set_events;
+ impl_class->get_events = gdk_window_quartz_get_events;
+ impl_class->raise = gdk_window_quartz_raise;
+ impl_class->lower = gdk_window_quartz_lower;
+ impl_class->restack_toplevel = gdk_window_quartz_restack_toplevel;
+ impl_class->move_resize = gdk_window_quartz_move_resize;
+ impl_class->set_background = gdk_window_quartz_set_background;
+ impl_class->reparent = gdk_window_quartz_reparent;
+ impl_class->set_device_cursor = gdk_window_quartz_set_device_cursor;
+ impl_class->get_geometry = gdk_window_quartz_get_geometry;
+ impl_class->get_root_coords = gdk_window_quartz_get_root_coords;
+ impl_class->get_device_state = gdk_window_quartz_get_device_state;
+ impl_class->shape_combine_region = gdk_window_quartz_shape_combine_region;
+ impl_class->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
+ impl_class->set_static_gravities = gdk_window_quartz_set_static_gravities;
+ impl_class->queue_antiexpose = gdk_quartz_window_queue_antiexpose;
+ impl_class->translate = gdk_quartz_window_translate;
+ impl_class->destroy = gdk_quartz_window_destroy;
+ impl_class->destroy_foreign = gdk_quartz_window_destroy_foreign;
+ impl_class->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;
+ impl_class->get_shape = gdk_quartz_window_get_shape;
+ impl_class->get_input_shape = gdk_quartz_window_get_input_shape;
+
+ impl_class->focus = gdk_quartz_window_focus;
+ impl_class->set_type_hint = gdk_quartz_window_set_type_hint;
+ impl_class->get_type_hint = gdk_quartz_window_get_type_hint;
+ impl_class->set_modal_hint = gdk_quartz_window_set_modal_hint;
+ impl_class->set_skip_taskbar_hint = gdk_quartz_window_set_skip_taskbar_hint;
+ impl_class->set_skip_pager_hint = gdk_quartz_window_set_skip_pager_hint;
+ impl_class->set_urgency_hint = gdk_quartz_window_set_urgency_hint;
+ impl_class->set_geometry_hints = gdk_quartz_window_set_geometry_hints;
+ impl_class->set_title = gdk_quartz_window_set_title;
+ impl_class->set_role = gdk_quartz_window_set_role;
+ impl_class->set_startup_id = gdk_quartz_window_set_startup_id;
+ impl_class->set_transient_for = gdk_quartz_window_set_transient_for;
+ impl_class->get_root_origin = gdk_quartz_window_get_root_origin;
+ impl_class->get_frame_extents = gdk_quartz_window_get_frame_extents;
+ impl_class->set_override_redirect = gdk_quartz_window_set_override_redirect;
+ impl_class->set_accept_focus = gdk_quartz_window_set_accept_focus;
+ impl_class->set_focus_on_map = gdk_quartz_window_set_focus_on_map;
+ impl_class->set_icon_list = gdk_quartz_window_set_icon_list;
+ impl_class->set_icon_name = gdk_quartz_window_set_icon_name;
+ impl_class->iconify = gdk_quartz_window_iconify;
+ impl_class->deiconify = gdk_quartz_window_deiconify;
+ impl_class->stick = gdk_quartz_window_stick;
+ impl_class->unstick = gdk_quartz_window_unstick;
+ impl_class->maximize = gdk_quartz_window_maximize;
+ impl_class->unmaximize = gdk_quartz_window_unmaximize;
+ impl_class->fullscreen = gdk_quartz_window_fullscreen;
+ impl_class->unfullscreen = gdk_quartz_window_unfullscreen;
+ impl_class->set_keep_above = gdk_quartz_window_set_keep_above;
+ impl_class->set_keep_below = gdk_quartz_window_set_keep_below;
+ impl_class->get_group = gdk_quartz_window_get_group;
+ impl_class->set_group = gdk_quartz_window_set_group;
+ impl_class->set_decorations = gdk_quartz_window_set_decorations;
+ impl_class->get_decorations = gdk_quartz_window_get_decorations;
+ impl_class->set_functions = gdk_quartz_window_set_functions;
+ impl_class->set_functions = gdk_quartz_window_set_functions;
+ impl_class->begin_resize_drag = gdk_quartz_window_begin_resize_drag;
+ impl_class->begin_move_drag = gdk_quartz_window_begin_move_drag;
+ impl_class->enable_synchronized_configure = gdk_quartz_window_enable_synchronized_configure;
+ impl_class->configure_finished = gdk_quartz_window_configure_finished;
+ impl_class->set_opacity = gdk_quartz_window_set_opacity;
+ impl_class->destroy_notify = gdk_quartz_window_destroy_notify;
+ impl_class->register_dnd = _gdk_quartz_window_register_dnd;
+ impl_class->drag_begin = _gdk_quartz_window_drag_begin;
+ impl_class->process_updates_recurse = _gdk_quartz_window_process_updates_recurse;
+ impl_class->sync_rendering = _gdk_quartz_window_sync_rendering;
+ impl_class->simulate_key = _gdk_quartz_window_simulate_key;
+ impl_class->simulate_button = _gdk_quartz_window_simulate_button;
+ impl_class->get_property = _gdk_quartz_window_get_property;
+ impl_class->change_property = _gdk_quartz_window_change_property;
+ impl_class->delete_property = _gdk_quartz_window_delete_property;
+
+
+ impl_quartz_class->get_context = gdk_window_impl_quartz_get_context;
+ impl_quartz_class->release_context = gdk_window_impl_quartz_release_context;
+}
+
+GType
+_gdk_window_impl_quartz_get_type (void)
+{
+ static GType object_type = 0;
+
+ if (!object_type)
+ {
+ const GTypeInfo object_info =
+ {
+ sizeof (GdkWindowImplQuartzClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) gdk_window_impl_quartz_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (GdkWindowImplQuartz),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gdk_window_impl_quartz_init,
+ };
+
+ const GInterfaceInfo paintable_info =
+ {
+ (GInterfaceInitFunc) gdk_window_impl_quartz_paintable_init,
+ NULL,
+ NULL
+ };
+
+ object_type = g_type_register_static (GDK_TYPE_WINDOW_IMPL,
+ "GdkWindowImplQuartz",
+ &object_info, 0);
+ g_type_add_interface_static (object_type,
+ GDK_TYPE_PAINTABLE,
+ &paintable_info);
+ }
+
+ return object_type;
+}
+
+CGContextRef
+gdk_quartz_window_get_context (GdkWindowImplQuartz *window,
+ gboolean antialias)
+{
+ if (!GDK_WINDOW_IMPL_QUARTZ_GET_CLASS (window)->get_context)
+ {
+ g_warning ("%s doesn't implement GdkWindowImplQuartzClass::get_context()",
+ G_OBJECT_TYPE_NAME (window));
+ return NULL;
+ }
+
+ return GDK_WINDOW_IMPL_QUARTZ_GET_CLASS (window)->get_context (window, antialias);
+}
+
+void
+gdk_quartz_window_release_context (GdkWindowImplQuartz *window,
+ CGContextRef cg_context)
+{
+ if (!GDK_WINDOW_IMPL_QUARTZ_GET_CLASS (window)->release_context)
+ {
+ g_warning ("%s doesn't implement GdkWindowImplQuartzClass::release_context()",
+ G_OBJECT_TYPE_NAME (window));
+ return;
+ }
+
+ GDK_WINDOW_IMPL_QUARTZ_GET_CLASS (window)->release_context (window, cg_context);
}
+
static CGContextRef
-gdk_root_window_impl_quartz_get_context (GdkDrawable *drawable,
- gboolean antialias)
+gdk_root_window_impl_quartz_get_context (GdkWindowImplQuartz *window,
+ gboolean antialias)
{
- GdkDrawableImplQuartz *drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable);
CGColorSpaceRef colorspace;
CGContextRef cg_context;
+ GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (window);
- if (GDK_WINDOW_DESTROYED (drawable_impl->wrapper))
+ if (GDK_WINDOW_DESTROYED (window_impl->wrapper))
return NULL;
/* We do not have the notion of a root window on OS X. We fake this
@@ -3014,8 +3151,8 @@ gdk_root_window_impl_quartz_get_context (GdkDrawable *drawable,
}
static void
-gdk_root_window_impl_quartz_release_context (GdkDrawable *drawable,
- CGContextRef cg_context)
+gdk_root_window_impl_quartz_release_context (GdkWindowImplQuartz *window,
+ CGContextRef cg_context)
{
CGContextRelease (cg_context);
}
@@ -3023,12 +3160,12 @@ gdk_root_window_impl_quartz_release_context (GdkDrawable *drawable,
static void
gdk_root_window_impl_quartz_class_init (GdkRootWindowImplQuartzClass *klass)
{
- GdkDrawableImplQuartzClass *drawable_quartz_class = GDK_DRAWABLE_IMPL_QUARTZ_CLASS (klass);
+ GdkWindowImplQuartzClass *window_quartz_class = GDK_WINDOW_IMPL_QUARTZ_CLASS (klass);
root_window_parent_class = g_type_class_peek_parent (klass);
- drawable_quartz_class->get_context = gdk_root_window_impl_quartz_get_context;
- drawable_quartz_class->release_context = gdk_root_window_impl_quartz_release_context;
+ window_quartz_class->get_context = gdk_root_window_impl_quartz_get_context;
+ window_quartz_class->release_context = gdk_root_window_impl_quartz_release_context;
}
static void
diff --git a/gdk/quartz/gdkwindow-quartz.h b/gdk/quartz/gdkwindow-quartz.h
index b591eebc81..f89c20cfba 100644
--- a/gdk/quartz/gdkwindow-quartz.h
+++ b/gdk/quartz/gdkwindow-quartz.h
@@ -21,9 +21,9 @@
#ifndef __GDK_WINDOW_QUARTZ_H__
#define __GDK_WINDOW_QUARTZ_H__
-#include
#import
-#import
+#import
+#include "gdk/gdkwindowimpl.h"
G_BEGIN_DECLS
@@ -42,7 +42,9 @@ typedef struct _GdkWindowImplQuartzClass GdkWindowImplQuartzClass;
struct _GdkWindowImplQuartz
{
- GdkDrawableImplQuartz parent_instance;
+ GdkWindowImpl parent_instance;
+
+ GdkWindow *wrapper;
NSWindow *toplevel;
NSTrackingRectTag tracking_rect;
@@ -60,15 +62,26 @@ struct _GdkWindowImplQuartz
GList *sorted_children;
cairo_region_t *needs_display_region;
+
+ cairo_surface_t *cairo_surface;
};
struct _GdkWindowImplQuartzClass
{
- GdkDrawableImplQuartzClass parent_class;
+ GdkWindowImplClass parent_class;
+
+ CGContextRef (* get_context) (GdkWindowImplQuartz *window,
+ gboolean antialias);
+ void (* release_context) (GdkWindowImplQuartz *window,
+ CGContextRef cg_context);
};
GType _gdk_window_impl_quartz_get_type (void);
+CGContextRef gdk_quartz_window_get_context (GdkWindowImplQuartz *window,
+ gboolean antialias);
+void gdk_quartz_window_release_context (GdkWindowImplQuartz *window,
+ CGContextRef context);
/* Root window implementation for Quartz
*/
diff --git a/gdk/tests/Makefile.am b/gdk/tests/Makefile.am
index 04e5b253fe..5cadc6d35c 100644
--- a/gdk/tests/Makefile.am
+++ b/gdk/tests/Makefile.am
@@ -12,17 +12,25 @@ AM_CPPFLAGS = \
progs_ldadd = \
$(GDK_DEP_LIBS) \
- $(top_builddir)/gdk/libgdk-$(gdktarget)-$(GTK_API_VERSION).la \
+ $(top_builddir)/gdk/libgdk-$(GTK_API_VERSION).la \
$(NULL)
#TEST_PROGS += check-gdk-cairo
-check_gdk_cairo_SOURCES = check-gdk-cairo.c
-check_gdk_cairo_LDADD = $(progs_ldadd)
+#check_gdk_cairo_SOURCES = check-gdk-cairo.c
+#check_gdk_cairo_LDADD = $(progs_ldadd)
TEST_PROGS += gdk-color
gdk_color_SOURCES = gdk-color.c
gdk_color_LDADD = $(progs_ldadd)
+TEST_PROGS += encoding
+encoding_SOURCES = encoding.c
+encoding_LDADD = $(progs_ldadd)
+
+TEST_PROGS += display
+display_SOURCES = display.c
+display_LDADD = $(progs_ldadd)
+
CLEANFILES = \
cairosurface.png \
gdksurface.png
diff --git a/gdk/tests/display.c b/gdk/tests/display.c
new file mode 100644
index 0000000000..79fbcfd254
--- /dev/null
+++ b/gdk/tests/display.c
@@ -0,0 +1,74 @@
+#include
+
+#include
+
+static void
+test_unset_display (void)
+{
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+ {
+ GdkDisplayManager *manager;
+
+ g_unsetenv ("DISPLAY");
+
+ g_assert (!gdk_init_check (NULL, NULL));
+ manager = gdk_display_manager_get ();
+ g_assert (manager != NULL);
+ g_assert (gdk_display_manager_get_default_display (manager) == NULL);
+
+ exit (0);
+ }
+ g_test_trap_assert_passed ();
+
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+ {
+ g_unsetenv ("DISPLAY");
+
+ gdk_init (NULL, NULL);
+
+ exit (0);
+ }
+ g_test_trap_assert_failed ();
+ g_test_trap_assert_stderr ("*cannot open display*");
+}
+
+static void
+test_bad_display (void)
+{
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+ {
+ GdkDisplayManager *manager;
+
+ g_setenv ("DISPLAY", "poo", TRUE);
+
+ g_assert (!gdk_init_check (NULL, NULL));
+ manager = gdk_display_manager_get ();
+ g_assert (manager != NULL);
+ g_assert (gdk_display_manager_get_default_display (manager) == NULL);
+
+ exit (0);
+ }
+ g_test_trap_assert_passed ();
+
+ if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
+ {
+ g_setenv ("DISPLAY", "poo", TRUE);
+
+ gdk_init (NULL, NULL);
+
+ exit (0);
+ }
+ g_test_trap_assert_failed ();
+ g_test_trap_assert_stderr ("*cannot open display*");
+}
+
+int
+main (int argc, char *argv[])
+{
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/display/unset-display", test_unset_display);
+ g_test_add_func ("/display/bad-display", test_bad_display);
+
+ return g_test_run ();
+}
diff --git a/gdk/tests/encoding.c b/gdk/tests/encoding.c
new file mode 100644
index 0000000000..546bf29fae
--- /dev/null
+++ b/gdk/tests/encoding.c
@@ -0,0 +1,46 @@
+#include
+#ifdef GDK_WINDOWING_X11
+#include
+#endif
+
+static void
+test_to_text_list (void)
+{
+ GdkDisplay *display;
+
+ display = gdk_display_get_default ();
+
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (display))
+ {
+ GdkAtom encoding;
+ gint format;
+ const guchar *text;
+ gint length;
+ gchar **list;
+ gint n;
+
+ encoding = gdk_atom_intern ("UTF8_STRING", FALSE);
+ format = 8;
+ text = (const guchar*)"abcdef \304\201 \304\205\0ABCDEF \304\200 \304\204";
+ length = 25;
+ n = gdk_x11_display_text_property_to_text_list (display, encoding, format, text, length, &list);
+ g_assert_cmpint (n, ==, 2);
+ g_assert (g_str_has_prefix (list[0], "abcdef "));
+ g_assert (g_str_has_prefix (list[1], "ABCDEF "));
+
+ gdk_x11_free_text_list (list);
+ }
+#endif
+}
+
+int
+main (int argc, char *argv[])
+{
+ g_test_init (&argc, &argv, NULL);
+ gdk_init (&argc, &argv);
+
+ g_test_add_func ("/encoding/to-text-list", test_to_text_list);
+
+ return g_test_run ();
+}
diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am
index d851ccf056..404ddd6aef 100644
--- a/gdk/win32/Makefile.am
+++ b/gdk/win32/Makefile.am
@@ -25,8 +25,6 @@ EXTRA_DIST += \
makefile.msc
libgdk_win32_la_SOURCES = \
- xcursors.h \
- gdkapplaunchcontext-win32.c \
gdkcursor-win32.c \
gdkdevicemanager-win32.c \
gdkdevicemanager-win32.h \
@@ -35,13 +33,11 @@ libgdk_win32_la_SOURCES = \
gdkdevice-wintab.c \
gdkdevice-wintab.h \
gdkdisplay-win32.c \
+ gdkdisplaymanager-win32.c \
gdkdnd-win32.c \
- gdkdrawable-win32.c \
- gdkdrawable-win32.h \
gdkevents-win32.c \
gdkgeometry-win32.c \
gdkglobals-win32.c \
- gdkim-win32.c \
gdkinput.c \
gdkkeys-win32.c \
gdkmain-win32.c \
@@ -49,15 +45,22 @@ libgdk_win32_la_SOURCES = \
gdkproperty-win32.c \
gdkscreen-win32.c \
gdkselection-win32.c \
- gdkspawn-win32.c \
gdktestutils-win32.c \
gdkvisual-win32.c \
+ gdkwin32cursor.h \
+ gdkwin32display.h \
+ gdkwin32displaymanager.h \
+ gdkwin32dnd.h \
gdkwin32.h \
gdkwin32id.c \
+ gdkwin32keys.h \
+ gdkwin32screen.h \
+ gdkwin32window.h \
gdkwindow-win32.c \
gdkwindow-win32.h \
+ pktdef.h \
wintab.h \
- pktdef.h
+ xcursors.h
libgdkinclude_HEADERS = \
gdkwin32.h
diff --git a/gdk/win32/gdkapplaunchcontext-win32.c b/gdk/win32/gdkapplaunchcontext-win32.c
deleted file mode 100644
index 8a7323c51d..0000000000
--- a/gdk/win32/gdkapplaunchcontext-win32.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* gdkapplaunchcontext-win32.c - Gtk+ implementation for GAppLaunchContext
-
- Copyright (C) 2007 Red Hat, Inc.
-
- The Gnome Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The Gnome Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the Gnome Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
-
- Author: Matthias Clasen
-*/
-
-#include "config.h"
-
-#include "gdkapplaunchcontext.h"
-
-
-char *
-_gdk_windowing_get_startup_notify_id (GAppLaunchContext *context,
- GAppInfo *info,
- GList *files)
-{
- return NULL;
-}
-
-void
-_gdk_windowing_launch_failed (GAppLaunchContext *context,
- const char *startup_notify_id)
-{
-}
-
-
diff --git a/gdk/win32/gdkcursor-win32.c b/gdk/win32/gdkcursor-win32.c
index 3053b917c0..313b0d8a4f 100644
--- a/gdk/win32/gdkcursor-win32.c
+++ b/gdk/win32/gdkcursor-win32.c
@@ -24,6 +24,7 @@
#include "gdkscreen.h"
#include "gdkcursor.h"
#include "gdkprivate-win32.h"
+#include "gdkwin32cursor.h"
#ifdef __MINGW32__
#include
@@ -135,25 +136,47 @@ hcursor_from_type (GdkCursorType cursor_type)
return rv;
}
+struct _GdkWin32CursorClass
+{
+ GdkCursorClass cursor_class;
+};
+
+G_DEFINE_TYPE (GdkWin32Cursor, gdk_win32_cursor, GDK_TYPE_CURSOR)
+
+static void
+_gdk_win32_cursor_finalize (GObject *object)
+{
+ GdkWin32Cursor *private = GDK_WIN32_CURSOR (object);
+
+ if (GetCursor () == private->hcursor)
+ SetCursor (NULL);
+
+ if (!DestroyCursor (private->hcursor))
+ WIN32_API_FAILED ("DestroyCursor");
+
+ G_OBJECT_CLASS (gdk_win32_cursor_parent_class)->finalize (object);
+}
+
static GdkCursor*
cursor_new_from_hcursor (HCURSOR hcursor,
GdkCursorType cursor_type)
{
- GdkCursorPrivate *private;
+ GdkWin32Cursor *private;
GdkCursor *cursor;
- private = g_new (GdkCursorPrivate, 1);
+ private = g_object_new (GDK_TYPE_WIN32_CURSOR,
+ "cursor-type", cursor_type,
+ "display", _gdk_display,
+ NULL);
private->hcursor = hcursor;
cursor = (GdkCursor*) private;
- cursor->type = cursor_type;
- cursor->ref_count = 1;
return cursor;
}
GdkCursor*
-gdk_cursor_new_for_display (GdkDisplay *display,
- GdkCursorType cursor_type)
+_gdk_win32_display_get_cursor_for_type (GdkDisplay *display,
+ GdkCursorType cursor_type)
{
HCURSOR hcursor;
@@ -206,8 +229,8 @@ static struct {
};
GdkCursor*
-gdk_cursor_new_from_name (GdkDisplay *display,
- const gchar *name)
+_gdk_win32_display_get_cursor_for_name (GdkDisplay *display,
+ const gchar *name)
{
HCURSOR hcursor = NULL;
int i;
@@ -229,32 +252,6 @@ gdk_cursor_new_from_name (GdkDisplay *display,
return NULL;
}
-void
-_gdk_cursor_destroy (GdkCursor *cursor)
-{
- GdkCursorPrivate *private;
-
- g_return_if_fail (cursor != NULL);
- private = (GdkCursorPrivate *) cursor;
-
- GDK_NOTE (CURSOR, g_print ("_gdk_cursor_destroy: %p\n",
- (cursor->type == GDK_CURSOR_IS_PIXMAP) ? private->hcursor : 0));
-
- if (GetCursor () == private->hcursor)
- SetCursor (NULL);
-
- if (!DestroyCursor (private->hcursor))
- WIN32_API_FAILED ("DestroyCursor");
-
- g_free (private);
-}
-
-GdkDisplay *
-gdk_cursor_get_display (GdkCursor *cursor)
-{
- return gdk_display_get_default ();
-}
-
GdkPixbuf *
gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon)
{
@@ -431,19 +428,19 @@ gdk_win32_icon_to_pixbuf_libgtk_only (HICON hicon)
return pixbuf;
}
-GdkPixbuf*
-gdk_cursor_get_image (GdkCursor *cursor)
+static GdkPixbuf *
+_gdk_win32_cursor_get_image (GdkCursor *cursor)
{
g_return_val_if_fail (cursor != NULL, NULL);
- return gdk_win32_icon_to_pixbuf_libgtk_only (((GdkCursorPrivate *) cursor)->hcursor);
+ return gdk_win32_icon_to_pixbuf_libgtk_only (((GdkWin32Cursor *) cursor)->hcursor);
}
GdkCursor *
-gdk_cursor_new_from_pixbuf (GdkDisplay *display,
- GdkPixbuf *pixbuf,
- gint x,
- gint y)
+_gdk_win32_display_get_cursor_for_pixbuf (GdkDisplay *display,
+ GdkPixbuf *pixbuf,
+ gint x,
+ gint y)
{
HCURSOR hcursor;
@@ -458,8 +455,8 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display,
return cursor_new_from_hcursor (hcursor, GDK_CURSOR_IS_PIXMAP);
}
-gboolean
-gdk_display_supports_cursor_alpha (GdkDisplay *display)
+gboolean
+_gdk_win32_display_supports_cursor_alpha (GdkDisplay *display)
{
g_return_val_if_fail (display == _gdk_display, FALSE);
@@ -467,25 +464,30 @@ gdk_display_supports_cursor_alpha (GdkDisplay *display)
}
gboolean
-gdk_display_supports_cursor_color (GdkDisplay *display)
+_gdk_win32_display_supports_cursor_color (GdkDisplay *display)
{
g_return_val_if_fail (display == _gdk_display, FALSE);
return TRUE;
}
-guint
-gdk_display_get_default_cursor_size (GdkDisplay *display)
+void
+_gdk_win32_display_get_default_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height)
{
- g_return_val_if_fail (display == _gdk_display, 0);
-
- return MIN (GetSystemMetrics (SM_CXCURSOR), GetSystemMetrics (SM_CYCURSOR));
+ g_return_if_fail (display == _gdk_display);
+
+ if (width)
+ *width = GetSystemMetrics (SM_CXCURSOR);
+ if (height)
+ *height = GetSystemMetrics (SM_CYCURSOR);
}
void
-gdk_display_get_maximal_cursor_size (GdkDisplay *display,
- guint *width,
- guint *height)
+_gdk_win32_display_get_maximal_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height)
{
g_return_if_fail (display == _gdk_display);
@@ -818,3 +820,18 @@ gdk_win32_pixbuf_to_hicon_libgtk_only (GdkPixbuf *pixbuf)
{
return _gdk_win32_pixbuf_to_hicon (pixbuf);
}
+
+static void
+gdk_win32_cursor_init (GdkWin32Cursor *cursor)
+{
+}
+static void
+gdk_win32_cursor_class_init(GdkWin32CursorClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkCursorClass *cursor_class = GDK_CURSOR_CLASS (klass);
+
+ object_class->finalize = _gdk_win32_cursor_finalize;
+
+ cursor_class->get_image = _gdk_win32_cursor_get_image;
+}
diff --git a/gdk/win32/gdkdevice-win32.c b/gdk/win32/gdkdevice-win32.c
index 54f1f0b6c8..c0a1bb3ddd 100644
--- a/gdk/win32/gdkdevice-win32.c
+++ b/gdk/win32/gdkdevice-win32.c
@@ -24,6 +24,7 @@
#include
#include
+#include "gdkdisplayprivate.h"
#include "gdkdevice-win32.h"
#include "gdkwin32.h"
@@ -134,14 +135,14 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor)
{
- GdkCursorPrivate *cursor_private;
- GdkWindowObject *parent_window;
+ GdkWin32Cursor *cursor_private;
+ GdkWindow *parent_window;
GdkWindowImplWin32 *impl;
HCURSOR hcursor;
HCURSOR hprevcursor;
- impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
- cursor_private = (GdkCursorPrivate*) cursor;
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
+ cursor_private = (GdkWin32Cursor*) cursor;
hprevcursor = impl->hcursor;
@@ -164,13 +165,11 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
* first ancestor that has cursor defined, and if so, set
* new cursor.
*/
- GdkWindowObject *curr_window_obj = GDK_WINDOW_OBJECT (curr_window);
-
- while (curr_window_obj &&
- !GDK_WINDOW_IMPL_WIN32 (curr_window_obj->impl)->hcursor)
+ while (curr_window && curr_window->impl &&
+ !GDK_WINDOW_IMPL_WIN32 (curr_window->impl)->hcursor)
{
- curr_window_obj = curr_window_obj->parent;
- if (curr_window_obj == GDK_WINDOW_OBJECT (window))
+ curr_window = curr_window->parent;
+ if (curr_window == GDK_WINDOW (window))
{
SetCursor (hcursor);
break;
@@ -188,7 +187,7 @@ gdk_device_win32_set_window_cursor (GdkDevice *device,
{
/* Look for a suitable cursor to use instead */
hcursor = NULL;
- parent_window = GDK_WINDOW_OBJECT (window)->parent;
+ parent_window = GDK_WINDOW (window)->parent;
while (hcursor == NULL)
{
@@ -329,12 +328,19 @@ static void
gdk_device_win32_ungrab (GdkDevice *device,
guint32 time_)
{
+ GdkDeviceGrabInfo *info;
GdkDisplay *display;
display = gdk_device_get_display (device);
+ info = _gdk_display_get_last_device_grab (display, device);
+
+ if (info)
+ info->serial_end = 0;
if (gdk_device_get_source (device) != GDK_SOURCE_KEYBOARD)
ReleaseCapture ();
+
+ _gdk_display_device_grab_update (display, device, NULL, 0);
}
static GdkWindow *
diff --git a/gdk/win32/gdkdevice-wintab.c b/gdk/win32/gdkdevice-wintab.c
index 9d5ed79ef6..351105fe0c 100644
--- a/gdk/win32/gdkdevice-wintab.c
+++ b/gdk/win32/gdkdevice-wintab.c
@@ -372,7 +372,7 @@ _gdk_input_check_extension_events (GdkDevice *device)
for (l = input_windows; l; l = l->next)
{
- GdkWindowObject *window_private;
+ GdkWindow *window_private;
GdkEventMask event_mask = 0;
window_private = l->data;
diff --git a/gdk/win32/gdkdevicemanager-win32.c b/gdk/win32/gdkdevicemanager-win32.c
index 6a7b6e71d8..1af90395f6 100644
--- a/gdk/win32/gdkdevicemanager-win32.c
+++ b/gdk/win32/gdkdevicemanager-win32.c
@@ -29,6 +29,8 @@
#include "gdkdeviceprivate.h"
#include "gdkdevice-win32.h"
#include "gdkdevice-wintab.h"
+#include "gdkwin32.h"
+#include "gdkdisplayprivate.h"
#include
#include
@@ -860,7 +862,6 @@ _gdk_input_other_event (GdkEvent *event,
GdkWindow *window)
{
GdkDisplay *display;
- GdkWindowObject *obj;
GdkDeviceWintab *device = NULL;
GdkDeviceGrabInfo *last_grab;
GdkEventMask masktest;
@@ -900,8 +901,6 @@ _gdk_input_other_event (GdkEvent *event,
return FALSE;
}
- obj = GDK_WINDOW_OBJECT (window);
-
switch (msg->message)
{
case WT_PACKET:
@@ -928,7 +927,6 @@ _gdk_input_other_event (GdkEvent *event,
g_object_unref (window);
window = g_object_ref (last_grab->window);
- obj = GDK_WINDOW_OBJECT (window);
}
if (window == _gdk_root)
@@ -1006,12 +1004,12 @@ _gdk_input_other_event (GdkEvent *event,
{
GDK_NOTE (EVENTS_OR_INPUT, g_print ("... not selected\n"));
- if (obj->parent == GDK_WINDOW_OBJECT (_gdk_root))
+ if (window->parent == GDK_WINDOW (_gdk_root))
return FALSE;
/* It is not good to propagate the extended events up to the parent
* if this window wants normal (not extended) motion/button events */
- if (obj->event_mask & masktest)
+ if (window->event_mask & masktest)
{
GDK_NOTE (EVENTS_OR_INPUT,
g_print ("... wants ordinary event, ignoring this\n"));
@@ -1022,8 +1020,7 @@ _gdk_input_other_event (GdkEvent *event,
pt.y = y;
ClientToScreen (GDK_WINDOW_HWND (window), &pt);
g_object_unref (window);
- window = (GdkWindow *) obj->parent;
- obj = GDK_WINDOW_OBJECT (window);
+ window = window->parent;
g_object_ref (window);
ScreenToClient (GDK_WINDOW_HWND (window), &pt);
x = pt.x;
diff --git a/gdk/win32/gdkdevicemanager-win32.h b/gdk/win32/gdkdevicemanager-win32.h
index 69d26b7561..6e09737d0e 100644
--- a/gdk/win32/gdkdevicemanager-win32.h
+++ b/gdk/win32/gdkdevicemanager-win32.h
@@ -20,7 +20,7 @@
#ifndef __GDK_DEVICE_MANAGER_WIN32_H__
#define __GDK_DEVICE_MANAGER_WIN32_H__
-#include
+#include
G_BEGIN_DECLS
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 3d43c26ddd..da920984ca 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -21,6 +21,10 @@
#include "config.h"
#include "gdk.h"
#include "gdkprivate-win32.h"
+#include "gdkdisplayprivate.h"
+#include "gdkwin32display.h"
+#include "gdkwin32screen.h"
+#include "gdkwin32window.h"
#define HAVE_MONITOR_INFO
@@ -36,8 +40,8 @@ _gdk_windowing_set_default_display (GdkDisplay *display)
g_assert (display == NULL || _gdk_display == display);
}
-gulong
-_gdk_windowing_window_get_next_serial (GdkDisplay *display)
+static gulong
+gdk_win32_display_get_next_serial (GdkDisplay *display)
{
return 0;
}
@@ -179,7 +183,7 @@ _gdk_monitor_init (void)
}
GdkDisplay *
-gdk_display_open (const gchar *display_name)
+_gdk_win32_display_open (const gchar *display_name)
{
GDK_NOTE (MISC, g_print ("gdk_display_open: %s\n", (display_name ? display_name : "NULL")));
@@ -199,8 +203,8 @@ gdk_display_open (const gchar *display_name)
return NULL;
}
- _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL);
- _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL);
+ _gdk_display = g_object_new (GDK_TYPE_WIN32_DISPLAY, NULL);
+ _gdk_screen = g_object_new (GDK_TYPE_WIN32_SCREEN, NULL);
_gdk_monitor_init ();
_gdk_visual_init ();
@@ -220,8 +224,20 @@ gdk_display_open (const gchar *display_name)
return _gdk_display;
}
-G_CONST_RETURN gchar *
-gdk_display_get_name (GdkDisplay *display)
+struct _GdkWin32Display
+{
+ GdkDisplay display;
+};
+
+struct _GdkWin32DisplayClass
+{
+ GdkDisplayClass display_class;
+};
+
+G_DEFINE_TYPE (GdkWin32Display, gdk_win32_display, GDK_TYPE_DISPLAY)
+
+static G_CONST_RETURN gchar *
+gdk_win32_display_get_name (GdkDisplay *display)
{
HDESK hdesk = GetThreadDesktop (GetCurrentThreadId ());
char dummy;
@@ -277,24 +293,24 @@ gdk_display_get_name (GdkDisplay *display)
window_station_name,
desktop_name);
- GDK_NOTE (MISC, g_print ("gdk_display_get_name: %s\n", display_name));
+ GDK_NOTE (MISC, g_print ("gdk_win32_display_get_name: %s\n", display_name));
display_name_cache = display_name;
return display_name_cache;
}
-gint
-gdk_display_get_n_screens (GdkDisplay *display)
+static gint
+gdk_win32_display_get_n_screens (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return 1;
}
-GdkScreen *
-gdk_display_get_screen (GdkDisplay *display,
- gint screen_num)
+static GdkScreen *
+gdk_win32_display_get_screen (GdkDisplay *display,
+ gint screen_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (screen_num == 0, NULL);
@@ -302,16 +318,16 @@ gdk_display_get_screen (GdkDisplay *display,
return _gdk_screen;
}
-GdkScreen *
-gdk_display_get_default_screen (GdkDisplay *display)
+static GdkScreen *
+gdk_win32_display_get_default_screen (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return _gdk_screen;
}
-GdkWindow *
-gdk_display_get_default_group (GdkDisplay *display)
+static GdkWindow *
+gdk_win32_display_get_default_group (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
@@ -320,30 +336,30 @@ gdk_display_get_default_group (GdkDisplay *display)
return NULL;
}
-gboolean
-gdk_display_supports_selection_notification (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_selection_notification (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return FALSE;
}
-gboolean
-gdk_display_request_selection_notification (GdkDisplay *display,
+static gboolean
+gdk_win32_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
{
return FALSE;
}
-gboolean
-gdk_display_supports_clipboard_persistence (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_clipboard_persistence (GdkDisplay *display)
{
return FALSE;
}
-void
-gdk_display_store_clipboard (GdkDisplay *display,
+static void
+gdk_win32_display_store_clipboard (GdkDisplay *display,
GdkWindow *clipboard_window,
guint32 time_,
const GdkAtom *targets,
@@ -351,16 +367,16 @@ gdk_display_store_clipboard (GdkDisplay *display,
{
}
-gboolean
-gdk_display_supports_shapes (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return TRUE;
}
-gboolean
-gdk_display_supports_input_shapes (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_input_shapes (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
@@ -371,8 +387,142 @@ gdk_display_supports_input_shapes (GdkDisplay *display)
return FALSE;
}
-gboolean
-gdk_display_supports_composite (GdkDisplay *display)
+static gboolean
+gdk_win32_display_supports_composite (GdkDisplay *display)
{
return FALSE;
}
+
+static void
+gdk_win32_display_beep (GdkDisplay *display)
+{
+ g_return_if_fail (display == gdk_display_get_default());
+ if (!MessageBeep (-1))
+ Beep(1000, 50);
+}
+
+static void
+gdk_win32_display_flush (GdkDisplay * display)
+{
+ g_return_if_fail (display == _gdk_display);
+
+ GdiFlush ();
+}
+
+static void
+gdk_win32_display_dispose (GObject *object)
+{
+}
+
+static void
+gdk_win32_display_finalize (GObject *object)
+{
+}
+
+static void
+gdk_win32_display_init(GdkWin32Display *display)
+{
+}
+
+static void
+gdk_win32_display_before_process_all_updates (GdkDisplay *display)
+{
+ /* nothing */
+}
+static void
+gdk_win32_display_after_process_all_updates (GdkDisplay *display)
+{
+ /* nothing */
+}
+static void
+gdk_win32_display_notify_startup_complete (GdkDisplay *display,
+ const gchar *startup_id)
+{
+ /* nothing */
+}
+static void
+gdk_win32_display_event_data_copy (GdkDisplay *display,
+ const GdkEvent *src,
+ GdkEvent *dst)
+{
+ /* nothing */
+}
+static void
+gdk_win32_display_event_data_free (GdkDisplay *display,
+ GdkEvent *event)
+{
+ /* nothing */
+}
+static void
+gdk_win32_display_push_error_trap (GdkDisplay *display)
+{
+ /* nothing */
+}
+static gint
+gdk_win32_display_pop_error_trap (GdkDisplay *display,
+ gboolean ignored)
+{
+ return 0;
+}
+static void
+gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (klass);
+
+ object_class->dispose = gdk_win32_display_dispose;
+ object_class->finalize = gdk_win32_display_finalize;
+
+ display_class->window_type = GDK_TYPE_WIN32_WINDOW;
+
+ display_class->get_name = gdk_win32_display_get_name;
+ display_class->get_n_screens = gdk_win32_display_get_n_screens;
+ display_class->get_screen = gdk_win32_display_get_screen;
+ display_class->get_default_screen = gdk_win32_display_get_default_screen;
+ display_class->beep = gdk_win32_display_beep;
+ display_class->sync = _gdk_win32_display_sync;
+ display_class->flush = gdk_win32_display_flush;
+ display_class->has_pending = _gdk_win32_display_has_pending;
+ display_class->queue_events = _gdk_win32_display_queue_events;
+ display_class->get_default_group = gdk_win32_display_get_default_group;
+
+ display_class->supports_selection_notification = gdk_win32_display_supports_selection_notification;
+ display_class->request_selection_notification = gdk_win32_display_request_selection_notification;
+ display_class->supports_clipboard_persistence = gdk_win32_display_supports_clipboard_persistence;
+ display_class->store_clipboard = gdk_win32_display_store_clipboard;
+ display_class->supports_shapes = gdk_win32_display_supports_shapes;
+ display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes;
+ display_class->supports_composite = gdk_win32_display_supports_composite;
+
+ display_class->list_devices = _gdk_win32_display_list_devices;
+ display_class->send_client_message = _gdk_win32_display_send_client_message;
+ display_class->add_client_message_filter = _gdk_win32_display_add_client_message_filter;
+ //? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context;
+ display_class->get_drag_protocol = _gdk_win32_display_get_drag_protocol;
+ display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type;
+ display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name;
+ display_class->get_cursor_for_pixbuf = _gdk_win32_display_get_cursor_for_pixbuf;
+ display_class->get_default_cursor_size = _gdk_win32_display_get_default_cursor_size;
+ display_class->get_maximal_cursor_size = _gdk_win32_display_get_maximal_cursor_size;
+ display_class->supports_cursor_alpha = _gdk_win32_display_supports_cursor_alpha;
+ display_class->supports_cursor_color = _gdk_win32_display_supports_cursor_color;
+
+ display_class->before_process_all_updates = gdk_win32_display_before_process_all_updates;
+ display_class->after_process_all_updates = gdk_win32_display_after_process_all_updates;
+ display_class->get_next_serial = gdk_win32_display_get_next_serial;
+ display_class->notify_startup_complete = gdk_win32_display_notify_startup_complete;
+ display_class->event_data_copy = gdk_win32_display_event_data_copy;
+ display_class->event_data_free = gdk_win32_display_event_data_free;
+ display_class->create_window_impl = _gdk_win32_display_create_window_impl;
+
+ display_class->get_keymap = _gdk_win32_display_get_keymap;
+ display_class->push_error_trap = gdk_win32_display_push_error_trap;
+ display_class->pop_error_trap = gdk_win32_display_pop_error_trap;
+ display_class->get_selection_owner = _gdk_win32_display_get_selection_owner;
+ display_class->set_selection_owner = _gdk_win32_display_set_selection_owner;
+ display_class->send_selection_notify = _gdk_win32_display_send_selection_notify;
+ display_class->get_selection_property = _gdk_win32_display_get_selection_property;
+ display_class->convert_selection = _gdk_win32_display_convert_selection;
+ display_class->text_property_to_utf8_list = _gdk_win32_display_text_property_to_utf8_list;
+ display_class->utf8_to_string_target = _gdk_win32_display_utf8_to_string_target;
+}
diff --git a/gdk/win32/gdkdisplaymanager-win32.c b/gdk/win32/gdkdisplaymanager-win32.c
new file mode 100644
index 0000000000..3df8d1752e
--- /dev/null
+++ b/gdk/win32/gdkdisplaymanager-win32.c
@@ -0,0 +1,135 @@
+/* GDK - The GIMP Drawing Kit
+ * gdkdisplaymanager-win32.c
+ *
+ * Copyright 2010 Hans Breuer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "gdkwin32display.h"
+#include "gdkwin32displaymanager.h"
+#include "gdkprivate-win32.h"
+
+#include "gdkdisplaymanagerprivate.h"
+#include "gdkinternals.h"
+
+struct _GdkWin32DisplayManager
+{
+ GdkDisplayManager parent_instance;
+};
+
+struct _GdkWin32DisplayManagerClass
+{
+ GdkDisplayManagerClass parent_instance;
+};
+
+G_DEFINE_TYPE (GdkWin32DisplayManager, gdk_win32_display_manager, GDK_TYPE_DISPLAY_MANAGER)
+
+static GdkDisplay *
+gdk_win32_display_manager_open_display (GdkDisplayManager *manager,
+ const gchar *name)
+{
+ return _gdk_win32_display_open (name);
+}
+
+static GSList *
+gdk_win32_display_manager_list_displays (GdkDisplayManager *manager)
+{
+ return g_slist_append (NULL, gdk_display_get_default ());
+}
+
+static GdkDisplay *
+gdk_win32_display_manager_get_default_display (GdkDisplayManager *manager)
+{
+ return _gdk_win32_display_open (NULL);
+}
+
+static void
+gdk_win32_display_manager_set_default_display (GdkDisplayManager *manager,
+ GdkDisplay *display)
+{
+ g_assert (gdk_display_get_default () == display);
+}
+
+#include "../gdkkeynames.c"
+
+static gchar *
+gdk_win32_display_manager_get_keyval_name (GdkDisplayManager *manager,
+ guint keyval)
+{
+ return _gdk_keyval_name (keyval);
+}
+
+static guint
+gdk_win32_display_manager_lookup_keyval (GdkDisplayManager *manager,
+ const gchar *name)
+{
+ return _gdk_keyval_from_name (name);
+}
+
+static void
+gdk_win32_display_manager_keyval_convert_case (GdkDisplayManager *manager,
+ guint symbol,
+ guint *lower,
+ guint *upper)
+{
+ /* FIXME implement this */
+ if (lower)
+ *lower = symbol;
+ if (upper)
+ *upper = symbol;
+}
+
+static void
+gdk_win32_display_manager_init (GdkWin32DisplayManager *manager)
+{
+ static once = TRUE;
+ /* relies on displaymanager being a singleton , but our init functions
+ * call gtk_diplay_maanger_get() again */
+ if (once)
+ {
+ once = FALSE;
+ _gdk_win32_windowing_init ();
+ }
+}
+
+static void
+gdk_win32_display_manager_finalize (GObject *object)
+{
+ g_error ("A GdkWin32DisplayManager object was finalized. This should not happen");
+ G_OBJECT_CLASS (gdk_win32_display_manager_parent_class)->finalize (object);
+}
+
+static void
+gdk_win32_display_manager_class_init (GdkWin32DisplayManagerClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
+
+ object_class->finalize = gdk_win32_display_manager_finalize;
+
+ manager_class->open_display = gdk_win32_display_manager_open_display;
+ manager_class->list_displays = gdk_win32_display_manager_list_displays;
+ manager_class->set_default_display = gdk_win32_display_manager_set_default_display;
+ manager_class->get_default_display = gdk_win32_display_manager_get_default_display;
+ manager_class->atom_intern = _gdk_win32_display_manager_atom_intern;
+ manager_class->get_atom_name = _gdk_win32_display_manager_get_atom_name;
+ manager_class->lookup_keyval = gdk_win32_display_manager_lookup_keyval;
+ manager_class->get_keyval_name = gdk_win32_display_manager_get_keyval_name;
+ manager_class->keyval_convert_case = gdk_win32_display_manager_keyval_convert_case;
+}
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
index 46b871bdef..9788e90d08 100644
--- a/gdk/win32/gdkdnd-win32.c
+++ b/gdk/win32/gdkdnd-win32.c
@@ -76,6 +76,9 @@
#include "gdkproperty.h"
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
+#include "gdkwin32.h"
+#include "gdkwin32dnd.h"
+#include "gdk/gdkdndprivate.h"
#include
@@ -98,7 +101,6 @@ typedef enum {
* this is used on both source and destination sides.
*/
struct _GdkDragContextPrivateWin32 {
- GdkDevice *device;
gboolean being_finalized;
gint ref_count;
IUnknown *iface;
@@ -108,23 +110,29 @@ struct _GdkDragContextPrivateWin32 {
guint drop_failed : 1; /* Whether the drop was unsuccessful */
};
-#define PRIVATE_DATA(context) ((GdkDragContextPrivateWin32 *) GDK_DRAG_CONTEXT (context)->windowing_data)
+#define PRIVATE_DATA(context) (GDK_WIN32_DRAG_CONTEXT (context)->windowing_data)
static GList *contexts;
static GdkDragContext *current_dest_drag = NULL;
-static void gdk_drag_context_init (GdkDragContext *dragcontext);
-static void gdk_drag_context_class_init (GdkDragContextClass *klass);
-static void gdk_drag_context_finalize (GObject *object);
+struct _GdkWin32DragContext
+{
+ GdkDragContext context;
+
+ GdkDragContextPrivateWin32 *windowing_data;
+};
-static gpointer parent_class = NULL;
+struct _GdkWin32DragContextClass
+{
+ GdkDragContextClass parent_class;
+};
+
+G_DEFINE_TYPE (GdkWin32DragContext, gdk_win32_drag_context, GDK_TYPE_DRAG_CONTEXT)
static gboolean use_ole2_dnd = FALSE;
-G_DEFINE_TYPE (GdkDragContext, gdk_drag_context, G_TYPE_OBJECT)
-
static void
-gdk_drag_context_init (GdkDragContext *dragcontext)
+gdk_win32_drag_context_init (GdkWin32DragContext *dragcontext)
{
GdkDragContextPrivateWin32 *private;
@@ -149,19 +157,7 @@ gdk_drag_context_init (GdkDragContext *dragcontext)
}
static void
-gdk_drag_context_class_init (GdkDragContextClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_drag_context_finalize;
-
- g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
-}
-
-static void
-gdk_drag_context_finalize (GObject *object)
+gdk_win32_drag_context_finalize (GObject *object)
{
GdkDragContext *context = GDK_DRAG_CONTEXT (object);
@@ -193,7 +189,7 @@ gdk_drag_context_finalize (GObject *object)
}
}
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (gdk_win32_drag_context_parent_class)->finalize (object);
}
/* Drag Contexts */
@@ -204,39 +200,6 @@ gdk_drag_context_new (void)
return g_object_new (GDK_TYPE_DRAG_CONTEXT, NULL);
}
-GdkDevice *
-gdk_drag_context_get_device (GdkDragContext *context)
-{
- GdkDragContextPrivateWin32 *private;
-
- g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), NULL);
-
- private = PRIVATE_DATA (context);
-
- return private->device;
-}
-
-void
-gdk_drag_context_set_device (GdkDragContext *context,
- GdkDevice *device)
-{
- GdkDragContextPrivateWin32 *private;
-
- g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
- g_return_if_fail (GDK_IS_DEVICE (device));
-
- private = PRIVATE_DATA (context);
-
- if (private->device)
- {
- g_object_unref (private->device);
- private->device = NULL;
- }
-
- if (device)
- private->device = g_object_ref (device);
-}
-
static GdkDragContext *
gdk_drag_context_find (gboolean is_source,
GdkWindow *source,
@@ -1237,7 +1200,7 @@ target_context_new (GdkWindow *window)
result->context->suggested_action = GDK_ACTION_MOVE;
result->context->action = GDK_ACTION_MOVE;
- private = result->context->windowing_data;
+ private = PRIVATE_DATA(result->context);
private->iface = (IUnknown *) &result->idt;
idroptarget_addref (&result->idt);
@@ -1273,7 +1236,7 @@ source_context_new (GdkWindow *window,
result->context->dest_window = NULL;
result->context->targets = g_list_copy (targets);
- private = result->context->windowing_data;
+ private = PRIVATE_DATA(result->context);
private->iface = (IUnknown *) &result->ids;
idropsource_addref (&result->ids);
@@ -1853,8 +1816,9 @@ gdk_drag_do_leave (GdkDragContext *context,
}
GdkDragContext *
-gdk_drag_begin (GdkWindow *window,
- GList *targets)
+_gdk_win32_window_drag_begin (GdkWindow *window,
+ GdkDevice *device,
+ GList *targets)
{
if (!use_ole2_dnd)
{
@@ -1874,6 +1838,7 @@ gdk_drag_begin (GdkWindow *window,
new_context->source_window = window;
g_object_ref (window);
+ gdk_drag_context_set_device (new_context, device);
new_context->targets = g_list_copy (targets);
new_context->actions = 0;
@@ -2008,13 +1973,14 @@ _gdk_win32_dnd_do_dragdrop (void)
}
GdkNativeWindow
-gdk_drag_get_protocol_for_display (GdkDisplay *display,
- GdkNativeWindow xid,
- GdkDragProtocol *protocol)
+_gdk_win32_display_get_drag_protocol (GdkDisplay *display,
+ GdkNativeWindow xid,
+ GdkDragProtocol *protocol,
+ guint *version)
{
GdkWindow *window;
- window = gdk_window_lookup (xid);
+ window = gdk_win32_window_lookup_for_display (display, xid);
if (window &&
gdk_window_get_window_type (window) != GDK_WINDOW_FOREIGN)
{
@@ -2025,6 +1991,9 @@ gdk_drag_get_protocol_for_display (GdkDisplay *display,
else
*protocol = GDK_DRAG_PROTO_LOCAL;
+ /* even X11 code not always intializes it */
+ *version = 0;
+
return xid;
}
}
@@ -2032,15 +2001,15 @@ gdk_drag_get_protocol_for_display (GdkDisplay *display,
return 0;
}
-void
-gdk_drag_find_window_for_screen (GdkDragContext *context,
+static GdkWindow *
+gdk_win32_drag_context_find_window (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
gint x_root,
gint y_root,
- GdkWindow **dest_window,
GdkDragProtocol *protocol)
{
+ GdkWindow *dest_window;
POINT pt;
HWND hwnd;
@@ -2050,14 +2019,14 @@ gdk_drag_find_window_for_screen (GdkDragContext *context,
hwnd = WindowFromPoint (pt);
if (hwnd == NULL)
- *dest_window = NULL;
+ dest_window = NULL;
else
{
- *dest_window = gdk_win32_handle_table_lookup (hwnd);
- if (*dest_window)
- g_object_ref (*dest_window);
+ dest_window = gdk_win32_handle_table_lookup (hwnd);
+ if (dest_window)
+ g_object_ref (dest_window);
else
- *dest_window = gdk_window_foreign_new_for_display (_gdk_display, hwnd);
+ dest_window = gdk_win32_window_foreign_new_for_display (_gdk_display, hwnd);
if (use_ole2_dnd)
*protocol = GDK_DRAG_PROTO_OLE2;
@@ -2072,12 +2041,14 @@ gdk_drag_find_window_for_screen (GdkDragContext *context,
(drag_window ? GDK_WINDOW_HWND (drag_window) : NULL),
x_root, y_root,
hwnd,
- (*dest_window ? GDK_WINDOW_HWND (*dest_window) : NULL),
+ (dest_window ? GDK_WINDOW_HWND (dest_window) : NULL),
_gdk_win32_drag_protocol_to_string (*protocol)));
+
+ return dest_window;
}
-gboolean
-gdk_drag_motion (GdkDragContext *context,
+static gboolean
+gdk_win32_drag_context_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
GdkDragProtocol protocol,
gint x_root,
@@ -2215,8 +2186,8 @@ gdk_drag_motion (GdkDragContext *context,
return FALSE;
}
-void
-gdk_drag_drop (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drag_drop (GdkDragContext *context,
guint32 time)
{
g_return_if_fail (context != NULL);
@@ -2235,8 +2206,8 @@ gdk_drag_drop (GdkDragContext *context,
}
}
-void
-gdk_drag_abort (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drag_abort (GdkDragContext *context,
guint32 time)
{
g_return_if_fail (context != NULL);
@@ -2249,8 +2220,8 @@ gdk_drag_abort (GdkDragContext *context,
/* Destination side */
-void
-gdk_drag_status (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time)
{
@@ -2304,8 +2275,8 @@ gdk_drag_status (GdkDragContext *context,
}
}
-void
-gdk_drop_reply (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drop_reply (GdkDragContext *context,
gboolean ok,
guint32 time)
{
@@ -2321,8 +2292,8 @@ gdk_drop_reply (GdkDragContext *context,
}
}
-void
-gdk_drop_finish (GdkDragContext *context,
+static void
+gdk_win32_drag_context_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time)
{
@@ -2391,7 +2362,7 @@ gdk_destroy_filter (GdkXEvent *xev,
#endif
void
-gdk_window_register_dnd (GdkWindow *window)
+_gdk_win32_window_register_dnd (GdkWindow *window)
{
target_drag_context *ctx;
HRESULT hr;
@@ -2450,8 +2421,14 @@ gdk_window_register_dnd (GdkWindow *window)
}
}
-GdkAtom
-gdk_drag_get_selection (GdkDragContext *context)
+static gboolean
+gdk_win32_drag_context_drop_status (GdkDragContext *context)
+{
+ return ! PRIVATE_DATA (context)->drop_failed;
+}
+
+static GdkAtom
+gdk_win32_drag_context_get_selection (GdkDragContext *context)
{
switch (context->protocol)
{
@@ -2466,15 +2443,25 @@ gdk_drag_get_selection (GdkDragContext *context)
}
}
-gboolean
-gdk_drag_drop_succeeded (GdkDragContext *context)
+static void
+gdk_win32_drag_context_class_init (GdkWin32DragContextClass *klass)
{
- GdkDragContextPrivateWin32 *private;
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkDragContextClass *context_class = GDK_DRAG_CONTEXT_CLASS (klass);
- g_return_val_if_fail (context != NULL, FALSE);
+ gdk_win32_drag_context_parent_class = g_type_class_peek_parent (klass);
- private = PRIVATE_DATA (context);
+ object_class->finalize = gdk_win32_drag_context_finalize;
- /* FIXME: Can we set drop_failed when the drop has failed? */
- return !private->drop_failed;
+ context_class->find_window = gdk_win32_drag_context_find_window;
+ context_class->drag_status = gdk_win32_drag_context_drag_status;
+ context_class->drag_motion = gdk_win32_drag_context_drag_motion;
+ context_class->drag_abort = gdk_win32_drag_context_drag_abort;
+ context_class->drag_drop = gdk_win32_drag_context_drag_drop;
+ context_class->drop_reply = gdk_win32_drag_context_drop_reply;
+ context_class->drop_finish = gdk_win32_drag_context_drop_finish;
+ context_class->drop_status = gdk_win32_drag_context_drop_status;
+ context_class->get_selection = gdk_win32_drag_context_get_selection;
+
+ g_type_class_add_private (object_class, sizeof (GdkDragContextPrivateWin32));
}
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
deleted file mode 100644
index 051569b138..0000000000
--- a/gdk/win32/gdkdrawable-win32.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998-2004 Tor Lillqvist
- * Copyright (C) 2001-2005 Hans Breuer
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-#include
-#include
-#include
-
-#include
-#include
-
-#include "gdkprivate-win32.h"
-
-static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
-static cairo_surface_t *gdk_win32_create_cairo_surface (GdkDrawable *drawable,
- int width,
- int height);
-
-static void gdk_drawable_impl_win32_finalize (GObject *object);
-
-static const cairo_user_data_key_t gdk_win32_cairo_key;
-
-G_DEFINE_TYPE (GdkDrawableImplWin32, _gdk_drawable_impl_win32, GDK_TYPE_DRAWABLE)
-
-
-static void
-_gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
-{
- GdkDrawableClass *drawable_class = GDK_DRAWABLE_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gdk_drawable_impl_win32_finalize;
-
- drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
- drawable_class->create_cairo_surface = gdk_win32_create_cairo_surface;
-}
-
-static void
-_gdk_drawable_impl_win32_init (GdkDrawableImplWin32 *impl)
-{
-}
-
-static void
-gdk_drawable_impl_win32_finalize (GObject *object)
-{
- G_OBJECT_CLASS (_gdk_drawable_impl_win32_parent_class)->finalize (object);
-}
-
-/*****************************************************
- * Win32 specific implementations of generic functions *
- *****************************************************/
-
-/* Drawing
- */
-
-/**
- * _gdk_win32_drawable_acquire_dc
- * @drawable: a Win32 #GdkDrawable implementation
- *
- * Gets a DC with the given drawable selected into
- * it.
- *
- * Return value: The DC, on success. Otherwise
- * %NULL. If this function succeeded
- * _gdk_win32_drawable_release_dc() must be called
- * release the DC when you are done using it.
- **/
-HDC
-_gdk_win32_drawable_acquire_dc (GdkDrawable *drawable)
-{
- GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
-
- if (GDK_IS_WINDOW_IMPL_WIN32 (drawable) &&
- GDK_WINDOW_DESTROYED (impl->wrapper))
- return NULL;
-
- if (!impl->hdc)
- {
- impl->hdc = GetDC (impl->handle);
- if (!impl->hdc)
- WIN32_GDI_FAILED ("GetDC");
- }
-
- if (impl->hdc)
- {
- impl->hdc_count++;
- return impl->hdc;
- }
- else
- {
- return NULL;
- }
-}
-
-/**
- * _gdk_win32_drawable_release_dc
- * @drawable: a Win32 #GdkDrawable implementation
- *
- * Releases the reference count for the DC
- * from _gdk_win32_drawable_acquire_dc()
- **/
-void
-_gdk_win32_drawable_release_dc (GdkDrawable *drawable)
-{
- GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
-
- g_return_if_fail (impl->hdc_count > 0);
-
- impl->hdc_count--;
- if (impl->hdc_count == 0)
- {
- if (impl->saved_dc_bitmap)
- {
- GDI_CALL (SelectObject, (impl->hdc, impl->saved_dc_bitmap));
- impl->saved_dc_bitmap = NULL;
- }
-
- if (impl->hdc)
- {
- GDI_CALL (ReleaseDC, (impl->handle, impl->hdc));
- impl->hdc = NULL;
- }
- }
-}
-
-static cairo_surface_t *
-gdk_win32_create_cairo_surface (GdkDrawable *drawable,
- gint width,
- gint height)
-{
- /* width and height are determined from the DC */
- return gdk_win32_ref_cairo_surface (drawable);
-}
-
-static void
-gdk_win32_cairo_surface_destroy (void *data)
-{
- GdkDrawableImplWin32 *impl = data;
-
- _gdk_win32_drawable_release_dc (GDK_DRAWABLE (impl));
- impl->cairo_surface = NULL;
-}
-
-static cairo_surface_t *
-gdk_win32_ref_cairo_surface (GdkDrawable *drawable)
-{
- GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
-
- if (GDK_IS_WINDOW_IMPL_WIN32 (drawable) &&
- GDK_WINDOW_DESTROYED (impl->wrapper))
- return NULL;
-
- if (!impl->cairo_surface)
- {
- HDC hdc = _gdk_win32_drawable_acquire_dc (drawable);
- if (!hdc)
- return NULL;
-
- impl->cairo_surface = cairo_win32_surface_create (hdc);
-
- cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key,
- drawable, gdk_win32_cairo_surface_destroy);
- }
- else
- cairo_surface_reference (impl->cairo_surface);
-
- return impl->cairo_surface;
-}
-
-HGDIOBJ
-gdk_win32_drawable_get_handle (GdkDrawable *drawable)
-{
- return GDK_DRAWABLE_HANDLE (drawable);
-}
-
-/**
- * _gdk_win32_drawable_finish
- * @drawable: a Win32 #GdkDrawable implementation
- *
- * Releases any resources allocated internally for the drawable.
- * This is called when the drawable becomes unusable, i.e.
- * gdk_window_destroy() is called.
- **/
-void
-_gdk_win32_drawable_finish (GdkDrawable *drawable)
-{
- GdkDrawableImplWin32 *impl = GDK_DRAWABLE_IMPL_WIN32 (drawable);
-
- if (impl->cairo_surface)
- {
- cairo_surface_finish (impl->cairo_surface);
- cairo_surface_set_user_data (impl->cairo_surface, &gdk_win32_cairo_key, NULL, NULL);
- }
-
- g_assert (impl->hdc_count == 0);
-}
-
diff --git a/gdk/win32/gdkdrawable-win32.h b/gdk/win32/gdkdrawable-win32.h
deleted file mode 100644
index fba149a24c..0000000000
--- a/gdk/win32/gdkdrawable-win32.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GDK_DRAWABLE_WIN32_H__
-#define __GDK_DRAWABLE_WIN32_H__
-
-#include
-#include
-
-G_BEGIN_DECLS
-
-/* Drawable implementation for Win32
- */
-
-typedef struct _GdkDrawableImplWin32 GdkDrawableImplWin32;
-typedef struct _GdkDrawableImplWin32Class GdkDrawableImplWin32Class;
-
-#define GDK_TYPE_DRAWABLE_IMPL_WIN32 (_gdk_drawable_impl_win32_get_type ())
-#define GDK_DRAWABLE_IMPL_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DRAWABLE_IMPL_WIN32, GdkDrawableImplWin32))
-#define GDK_DRAWABLE_IMPL_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAWABLE_IMPL_WIN32, GdkDrawableImplWin32Class))
-#define GDK_IS_DRAWABLE_IMPL_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DRAWABLE_IMPL_WIN32))
-#define GDK_IS_DRAWABLE_IMPL_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAWABLE_IMPL_WIN32))
-#define GDK_DRAWABLE_IMPL_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAWABLE_IMPL_WIN32, GdkDrawableImplWin32Class))
-
-struct _GdkDrawableImplWin32
-{
- GdkDrawable parent_instance;
- GdkDrawable *wrapper;
- HANDLE handle;
-
- guint hdc_count;
- HDC hdc;
- HBITMAP saved_dc_bitmap; /* Original bitmap for dc */
- cairo_surface_t *cairo_surface;
-};
-
-struct _GdkDrawableImplWin32Class
-{
- GdkDrawableClass parent_class;
-};
-
-GType _gdk_drawable_impl_win32_get_type (void);
-
-HDC _gdk_win32_drawable_acquire_dc (GdkDrawable *drawable);
-void _gdk_win32_drawable_release_dc (GdkDrawable *drawable);
-void _gdk_win32_drawable_finish (GdkDrawable *drawable);
-
-G_END_DECLS
-
-#endif /* __GDK_DRAWABLE_WIN32_H__ */
diff --git a/gdk/win32/gdkevents-win32.c b/gdk/win32/gdkevents-win32.c
index e29df5538f..450f8c1495 100644
--- a/gdk/win32/gdkevents-win32.c
+++ b/gdk/win32/gdkevents-win32.c
@@ -46,11 +46,15 @@
#include
#include "gdk.h"
+#include "gdkdisplayprivate.h"
#include "gdkprivate-win32.h"
#include "gdkkeysyms.h"
#include "gdkdevicemanager-win32.h"
#include "gdkdeviceprivate.h"
#include "gdkdevice-wintab.h"
+#include "gdkwin32.h"
+#include "gdkwin32dnd.h"
+#include "gdkdndprivate.h"
#include
@@ -390,10 +394,10 @@ _gdk_events_init (void)
}
gboolean
-gdk_events_pending (void)
+_gdk_win32_display_has_pending (GdkDisplay *display)
{
MSG msg;
- return (_gdk_event_queue_find_first (_gdk_display) ||
+ return (_gdk_event_queue_find_first (display) ||
(modal_win32_dialog == NULL &&
PeekMessageW (&msg, NULL, 0, 0, PM_NOREMOVE)));
}
@@ -449,15 +453,15 @@ _gdk_windowing_device_grab (GdkDevice *device,
guint32 time)
{
HCURSOR hcursor;
- GdkCursorPrivate *cursor_private;
+ GdkWin32Cursor *cursor_private;
gint return_val;
- GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) native_window)->impl);
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (native_window->impl);
g_return_val_if_fail (window != NULL, 0);
g_return_val_if_fail (GDK_IS_WINDOW (window), 0);
g_return_val_if_fail (confine_to == NULL || GDK_IS_WINDOW (confine_to), 0);
- cursor_private = (GdkCursorPrivate*) cursor;
+ cursor_private = (GdkWin32Cursor*) cursor;
if (!cursor)
hcursor = NULL;
@@ -492,28 +496,6 @@ _gdk_windowing_device_grab (GdkDevice *device,
return return_val;
}
-void
-gdk_device_ungrab (GdkDevice *device,
- guint32 time)
-{
- GdkDeviceGrabInfo *info;
- GdkDisplay *display;
-
- g_return_if_fail (GDK_IS_DEVICE (device));
-
- display = gdk_device_get_display (device);
- info = _gdk_display_get_last_device_grab (display, device);
-
- if (info)
- {
- info->serial_end = 0;
- GDK_DEVICE_GET_CLASS (device)->ungrab (device, time);
- }
-
- _gdk_display_device_grab_update (display, device, 0);
-}
-
-
static GdkWindow *
find_window_for_mouse_event (GdkWindow* reported_window,
MSG* msg)
@@ -562,20 +544,11 @@ find_window_for_mouse_event (GdkWindow* reported_window,
return other_window;
}
-void
-gdk_display_add_client_message_filter (GdkDisplay *display,
- GdkAtom message_type,
- GdkFilterFunc func,
- gpointer data)
-{
- /* XXX */
- gdk_add_client_message_filter (message_type, func, data);
-}
-
void
-gdk_add_client_message_filter (GdkAtom message_type,
- GdkFilterFunc func,
- gpointer data)
+_gdk_win32_display_add_client_message_filter (GdkDisplay *display,
+ GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data)
{
GdkClientFilter *filter = g_new (GdkClientFilter, 1);
@@ -1105,7 +1078,7 @@ apply_event_filters (GdkWindow *window,
static void
show_window_recurse (GdkWindow *window, gboolean hide_window)
{
- GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
GSList *children = impl->transient_children;
GdkWindow *child = NULL;
@@ -1128,9 +1101,9 @@ show_window_recurse (GdkWindow *window, gboolean hide_window)
{
if (!hide_window)
{
- if (GDK_WINDOW_OBJECT (window)->state & GDK_WINDOW_STATE_ICONIFIED)
+ if (gdk_window_get_state (window) & GDK_WINDOW_STATE_ICONIFIED)
{
- if (GDK_WINDOW_OBJECT (window)->state & GDK_WINDOW_STATE_MAXIMIZED)
+ if (gdk_window_get_state (window) & GDK_WINDOW_STATE_MAXIMIZED)
{
ShowWindow (GDK_WINDOW_HWND (window), SW_SHOWMAXIMIZED);
}
@@ -1154,7 +1127,7 @@ static void
do_show_window (GdkWindow *window, gboolean hide_window)
{
GdkWindow *tmp_window = NULL;
- GdkWindowImplWin32 *tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+ GdkWindowImplWin32 *tmp_impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (!tmp_impl->changing_state)
{
@@ -1162,7 +1135,7 @@ do_show_window (GdkWindow *window, gboolean hide_window)
while (tmp_impl->transient_owner != NULL)
{
tmp_window = tmp_impl->transient_owner;
- tmp_impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (tmp_window)->impl);
+ tmp_impl = GDK_WINDOW_IMPL_WIN32 (tmp_window->impl);
}
/* If we couldn't find one, use the window provided. */
@@ -1209,7 +1182,7 @@ synthesize_enter_or_leave_event (GdkWindow *window,
append_event (event);
if (type == GDK_ENTER_NOTIFY &&
- ((GdkWindowObject *) window)->extension_events != 0)
+ window->extension_events != 0)
_gdk_device_wintab_update_window_coords (window);
}
@@ -1235,7 +1208,7 @@ propagate (GdkWindow **window,
* device is used
*/
if (check_extended &&
- ((GdkWindowObject *) grab_window)->extension_events != 0 &&
+ grab_window->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored for grabber)"));
@@ -1260,13 +1233,13 @@ propagate (GdkWindow **window,
while (TRUE)
{
if (check_extended &&
- ((GdkWindowObject *) *window)->extension_events != 0 &&
+ (*window)->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
return FALSE;
}
- if ((*doesnt_want_it) (((GdkWindowObject *) *window)->event_mask, msg))
+ if ((*doesnt_want_it) ((*window)->event_mask, msg))
{
/* Owner doesn't want it, propagate to parent. */
GdkWindow *parent = gdk_window_get_parent (*window);
@@ -1278,7 +1251,7 @@ propagate (GdkWindow **window,
/* Event source is grabbed with owner_events TRUE */
if (check_extended &&
- ((GdkWindowObject *) grab_window)->extension_events != 0 &&
+ grab_window->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored for grabber)"));
@@ -1338,7 +1311,6 @@ handle_configure_event (MSG *msg,
{
RECT client_rect;
POINT point;
- GdkWindowObject *window_object;
GetClientRect (msg->hwnd, &client_rect);
point.x = client_rect.left; /* always 0 */
@@ -1352,17 +1324,15 @@ handle_configure_event (MSG *msg,
point.y += _gdk_offset_y;
}
- window_object = GDK_WINDOW_OBJECT (window);
-
- window_object->width = client_rect.right - client_rect.left;
- window_object->height = client_rect.bottom - client_rect.top;
+ window->width = client_rect.right - client_rect.left;
+ window->height = client_rect.bottom - client_rect.top;
- window_object->x = point.x;
- window_object->y = point.y;
+ window->x = point.x;
+ window->y = point.y;
_gdk_window_update_size (window);
- if (window_object->event_mask & GDK_STRUCTURE_MASK)
+ if (window->event_mask & GDK_STRUCTURE_MASK)
{
GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
@@ -1610,7 +1580,7 @@ ensure_stacking_on_unminimize (MSG *msg)
if (rover_gdkw)
{
GdkWindowImplWin32 *rover_impl =
- (GdkWindowImplWin32 *)((GdkWindowObject *)rover_gdkw)->impl;
+ GDK_WINDOW_IMPL_WIN32 (rover_gdkw->impl);
if (GDK_WINDOW_IS_MAPPED (rover_gdkw) &&
(rover_impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
@@ -1633,7 +1603,7 @@ static gboolean
ensure_stacking_on_window_pos_changing (MSG *msg,
GdkWindow *window)
{
- GdkWindowImplWin32 *impl = (GdkWindowImplWin32 *)((GdkWindowObject *) window)->impl;
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
WINDOWPOS *windowpos = (WINDOWPOS *) msg->lParam;
if (GetActiveWindow () == msg->hwnd &&
@@ -1661,7 +1631,7 @@ ensure_stacking_on_window_pos_changing (MSG *msg,
if (rover_gdkw)
{
GdkWindowImplWin32 *rover_impl =
- (GdkWindowImplWin32 *)((GdkWindowObject *)rover_gdkw)->impl;
+ GDK_WINDOW_IMPL_WIN32 (rover_gdkw->impl);
if (GDK_WINDOW_IS_MAPPED (rover_gdkw) &&
(rover_impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
@@ -1688,7 +1658,7 @@ static void
ensure_stacking_on_activate_app (MSG *msg,
GdkWindow *window)
{
- GdkWindowImplWin32 *impl = (GdkWindowImplWin32 *)((GdkWindowObject *) window)->impl;
+ GdkWindowImplWin32 *impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
impl->type_hint == GDK_WINDOW_TYPE_HINT_DIALOG ||
@@ -1718,7 +1688,7 @@ ensure_stacking_on_activate_app (MSG *msg,
if (rover_gdkw)
{
GdkWindowImplWin32 *rover_impl =
- (GdkWindowImplWin32 *)((GdkWindowObject *)rover_gdkw)->impl;
+ GDK_WINDOW_IMPL_WIN32 (rover_gdkw->impl);
if (GDK_WINDOW_IS_MAPPED (rover_gdkw) &&
(rover_impl->type_hint == GDK_WINDOW_TYPE_HINT_UTILITY ||
@@ -1838,11 +1808,11 @@ gdk_event_translate (MSG *msg,
*/
#define return GOTO_DONE_INSTEAD
- if (!GDK_WINDOW_DESTROYED (window) && ((GdkWindowObject *) window)->filters)
+ if (!GDK_WINDOW_DESTROYED (window) && window->filters)
{
/* Apply per-window filters */
- GdkFilterReturn result = apply_event_filters (window, msg, &((GdkWindowObject *) window)->filters);
+ GdkFilterReturn result = apply_event_filters (window, msg, &window->filters);
if (result == GDK_FILTER_REMOVE || result == GDK_FILTER_TRANSLATE)
{
@@ -2018,7 +1988,7 @@ gdk_event_translate (MSG *msg,
build_key_event_state (event, key_state);
- gdk_keymap_translate_keyboard_state (NULL,
+ gdk_keymap_translate_keyboard_state (_gdk_win32_display_get_keymap (_gdk_display),
event->key.hardware_keycode,
event->key.state,
event->key.group,
@@ -2098,7 +2068,7 @@ gdk_event_translate (MSG *msg,
for (i = 0; i < ccount; i++)
{
- if (((GdkWindowObject *) window)->event_mask & GDK_KEY_PRESS_MASK)
+ if (window->event_mask & GDK_KEY_PRESS_MASK)
{
/* Build a key press event */
event = gdk_event_new (GDK_KEY_PRESS);
@@ -2109,7 +2079,7 @@ gdk_event_translate (MSG *msg,
append_event (event);
}
- if (((GdkWindowObject *) window)->event_mask & GDK_KEY_RELEASE_MASK)
+ if (window->event_mask & GDK_KEY_RELEASE_MASK)
{
/* Build a key release event. */
event = gdk_event_new (GDK_KEY_RELEASE);
@@ -2183,7 +2153,7 @@ gdk_event_translate (MSG *msg,
assign_object (&window, find_window_for_mouse_event (window, msg));
#if 0
- if (((GdkWindowObject *) window)->extension_events != 0 &&
+ if (window->extension_events != 0 &&
_gdk_input_ignore_core)
{
GDK_NOTE (EVENTS, g_print (" (ignored)"));
@@ -2253,7 +2223,7 @@ gdk_event_translate (MSG *msg,
GET_X_LPARAM (msg->lParam), GET_Y_LPARAM (msg->lParam)));
#if 0 /* TODO_CSW? */
if (current_toplevel != NULL &&
- (((GdkWindowObject *) current_toplevel)->event_mask & GDK_LEAVE_NOTIFY_MASK))
+ (current_toplevel->event_mask & GDK_LEAVE_NOTIFY_MASK))
{
synthesize_enter_or_leave_event (current_toplevel, msg,
GDK_LEAVE_NOTIFY, GDK_CROSSING_NORMAL, GDK_NOTIFY_ANCESTOR);
@@ -2366,7 +2336,7 @@ gdk_event_translate (MSG *msg,
GdkWindow *tmp;
if (gdk_window_get_window_type (window) == GDK_WINDOW_TEMP
- || !((GdkWindowObject *)window)->accept_focus)
+ || !window->accept_focus)
{
*ret_valp = MA_NOACTIVATE;
return_val = TRUE;
@@ -2399,7 +2369,7 @@ gdk_event_translate (MSG *msg,
!keyboard_grab->owner_events)
break;
- if (!(((GdkWindowObject *) window)->event_mask & GDK_FOCUS_CHANGE_MASK))
+ if (!(window->event_mask & GDK_FOCUS_CHANGE_MASK))
break;
if (GDK_WINDOW_DESTROYED (window))
@@ -2442,7 +2412,7 @@ gdk_event_translate (MSG *msg,
if (grab_window != NULL && p_grab_cursor != NULL)
hcursor = p_grab_cursor;
else if (!GDK_WINDOW_DESTROYED (window))
- hcursor = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl)->hcursor;
+ hcursor = GDK_WINDOW_IMPL_WIN32 (window->impl)->hcursor;
else
hcursor = NULL;
@@ -2465,7 +2435,7 @@ gdk_event_translate (MSG *msg,
(msg->lParam == SW_PARENTOPENING ? "PARENTOPENING" :
"???")))))));
- if (!(((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK))
+ if (!(window->event_mask & GDK_STRUCTURE_MASK))
break;
if (msg->lParam == SW_OTHERUNZOOM ||
@@ -2482,7 +2452,7 @@ gdk_event_translate (MSG *msg,
if (event->any.type == GDK_UNMAP)
{
- impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (impl->transient_owner && GetForegroundWindow () == GDK_WINDOW_HWND (window))
{
@@ -2548,7 +2518,7 @@ gdk_event_translate (MSG *msg,
GdkWindowState withdrawn_bit =
IsWindowVisible (msg->hwnd) ? GDK_WINDOW_STATE_WITHDRAWN : 0;
- if (((GdkWindowObject *) window)->state & GDK_WINDOW_STATE_ICONIFIED)
+ if (window->state & GDK_WINDOW_STATE_ICONIFIED)
ensure_stacking_on_unminimize (msg);
if (!GDK_WINDOW_DESTROYED (window))
@@ -2575,10 +2545,10 @@ gdk_event_translate (MSG *msg,
GDK_WINDOW_STATE_MAXIMIZED);
}
- if (((GdkWindowObject *) window)->resize_count > 1)
- ((GdkWindowObject *) window)->resize_count -= 1;
+ if (window->resize_count > 1)
+ window->resize_count -= 1;
- if (((GdkWindowObject *) window)->extension_events != 0)
+ if (window->extension_events != 0)
_gdk_device_wintab_update_window_coords (window);
return_val = TRUE;
@@ -2637,11 +2607,11 @@ gdk_event_translate (MSG *msg,
GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD &&
!GDK_WINDOW_DESTROYED (window))
{
- if (((GdkWindowObject *) window)->event_mask & GDK_STRUCTURE_MASK)
+ if (window->event_mask & GDK_STRUCTURE_MASK)
{
GDK_NOTE (EVENTS, g_print (" do magic"));
- if (((GdkWindowObject *) window)->resize_count > 1)
- ((GdkWindowObject *) window)->resize_count -= 1;
+ if (window->resize_count > 1)
+ window->resize_count -= 1;
handle_configure_event (msg, window);
g_main_context_iteration (NULL, FALSE);
@@ -2673,7 +2643,7 @@ gdk_event_translate (MSG *msg,
_gdk_win32_rect_to_string (&rect),
_gdk_win32_rect_to_string (drag)));
- impl = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl);
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
orig_drag = *drag;
if (impl->hint_flags & GDK_HINT_RESIZE_INC)
{
@@ -2876,7 +2846,7 @@ gdk_event_translate (MSG *msg,
if (GDK_WINDOW_DESTROYED (window))
break;
- impl = GDK_WINDOW_IMPL_WIN32 (((GdkWindowObject *) window)->impl);
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
mmi = (MINMAXINFO*) msg->lParam;
GDK_NOTE (EVENTS, g_print (" (mintrack:%ldx%ld maxtrack:%ldx%ld "
"maxpos:%+ld%+ld maxsize:%ldx%ld)",
@@ -2950,7 +2920,7 @@ gdk_event_translate (MSG *msg,
append_event (event);
- impl = GDK_WINDOW_IMPL_WIN32 (GDK_WINDOW_OBJECT (window)->impl);
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
if (impl->transient_owner && GetForegroundWindow() == GDK_WINDOW_HWND (window))
{
@@ -3146,7 +3116,7 @@ done:
}
void
-_gdk_events_queue (GdkDisplay *display)
+_gdk_win32_display_queue_events (GdkDisplay *display)
{
MSG msg;
@@ -3214,7 +3184,7 @@ gdk_event_dispatch (GSource *source,
GDK_THREADS_ENTER ();
- _gdk_events_queue (_gdk_display);
+ _gdk_win32_display_queue_events (_gdk_display);
event = _gdk_event_unqueue (_gdk_display);
if (event)
@@ -3263,9 +3233,9 @@ check_for_too_much_data (GdkEvent *event)
}
gboolean
-gdk_event_send_client_message_for_display (GdkDisplay *display,
- GdkEvent *event,
- GdkNativeWindow winid)
+_gdk_win32_display_send_client_message (GdkDisplay *display,
+ GdkEvent *event,
+ GdkNativeWindow winid)
{
check_for_too_much_data (event);
@@ -3275,7 +3245,7 @@ gdk_event_send_client_message_for_display (GdkDisplay *display,
}
void
-gdk_screen_broadcast_client_message (GdkScreen *screen,
+_gdk_win32_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event)
{
check_for_too_much_data (event);
@@ -3286,24 +3256,7 @@ gdk_screen_broadcast_client_message (GdkScreen *screen,
}
void
-gdk_flush (void)
-{
-#if 0
- MSG msg;
-
- /* Process all messages currently available */
- while (PeekMessageW (&msg, NULL, 0, 0, PM_REMOVE))
- {
- TranslateMessage (&msg);
- DispatchMessageW (&msg);
- }
-#endif
-
- GdiFlush ();
-}
-
-void
-gdk_display_sync (GdkDisplay * display)
+_gdk_win32_display_sync (GdkDisplay * display)
{
MSG msg;
@@ -3314,27 +3267,3 @@ gdk_display_sync (GdkDisplay * display)
DispatchMessageW (&msg);
}
-void
-gdk_display_flush (GdkDisplay * display)
-{
- g_return_if_fail (display == _gdk_display);
-
- /* Nothing */
-}
-
-gboolean
-gdk_net_wm_supports (GdkAtom property)
-{
- return FALSE;
-}
-
-void
-_gdk_windowing_event_data_copy (const GdkEvent *src,
- GdkEvent *dst)
-{
-}
-
-void
-_gdk_windowing_event_data_free (GdkEvent *event)
-{
-}
diff --git a/gdk/win32/gdkgeometry-win32.c b/gdk/win32/gdkgeometry-win32.c
index 947095e379..c16920886e 100644
--- a/gdk/win32/gdkgeometry-win32.c
+++ b/gdk/win32/gdkgeometry-win32.c
@@ -42,6 +42,7 @@
#include "gdk.h" /* For gdk_rectangle_intersect */
#include "gdkinternals.h"
#include "gdkprivate-win32.h"
+#include "gdkwin32.h"
#define SIZE_LIMIT 32767
@@ -58,22 +59,20 @@ _gdk_window_move_resize_child (GdkWindow *window,
gint height)
{
GdkWindowImplWin32 *impl;
- GdkWindowObject *obj;
gboolean is_move;
gboolean is_resize;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
- obj = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
- is_move = (x - obj->x != 0) && (y - obj->y != 0);
- is_resize = obj->width != width && obj->height != height;
+ is_move = (x - window->x != 0) && (y - window->y != 0);
+ is_resize = window->width != width && window->height != height;
GDK_NOTE (MISC, g_print ("_gdk_window_move_resize_child: %s@%+d%+d %dx%d@%+d%+d\n",
- _gdk_win32_drawable_description (window),
- obj->x, obj->y, width, height, x, y));
+ _gdk_win32_window_description (window),
+ window->x, window->y, width, height, x, y));
if (width > 65535 || height > 65535)
{
@@ -85,10 +84,10 @@ _gdk_window_move_resize_child (GdkWindow *window,
height = 65535;
}
- obj->x = x;
- obj->y = y;
- obj->width = width;
- obj->height = height;
+ window->x = x;
+ window->y = y;
+ window->width = width;
+ window->height = height;
_gdk_win32_window_tmp_unset_parent_bg (window);
_gdk_win32_window_tmp_unset_bg (window, TRUE);
@@ -96,19 +95,18 @@ _gdk_window_move_resize_child (GdkWindow *window,
GDK_NOTE (MISC, g_print ("... SetWindowPos(%p,NULL,%d,%d,%d,%d,"
"NOACTIVATE|NOZORDER%s%s)\n",
GDK_WINDOW_HWND (window),
- obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y,
+ window->x + window->parent->abs_x, window->y + window->parent->abs_y,
width, height,
(is_move ? "" : "|NOMOVE"),
(is_resize ? "" : "|NOSIZE")));
API_CALL (SetWindowPos, (GDK_WINDOW_HWND (window), NULL,
- obj->x + obj->parent->abs_x, obj->y + obj->parent->abs_y,
+ window->x + window->parent->abs_x, window->y + window->parent->abs_y,
width, height,
SWP_NOACTIVATE | SWP_NOZORDER |
(is_move ? 0 : SWP_NOMOVE) |
(is_resize ? 0 : SWP_NOSIZE)));
- //_gdk_win32_window_tmp_reset_parent_bg (window);
_gdk_win32_window_tmp_reset_bg (window, TRUE);
}
@@ -116,28 +114,24 @@ void
_gdk_win32_window_tmp_unset_bg (GdkWindow *window,
gboolean recurse)
{
- GdkWindowObject *private;
-
g_return_if_fail (GDK_IS_WINDOW (window));
- private = (GdkWindowObject *)window;
-
- if (private->input_only || private->destroyed ||
- (private->window_type != GDK_WINDOW_ROOT &&
+ if (window->input_only || window->destroyed ||
+ (window->window_type != GDK_WINDOW_ROOT &&
!GDK_WINDOW_IS_MAPPED (window)))
return;
if (_gdk_window_has_impl (window) &&
GDK_WINDOW_IS_WIN32 (window) &&
- private->window_type != GDK_WINDOW_ROOT &&
- private->window_type != GDK_WINDOW_FOREIGN)
+ window->window_type != GDK_WINDOW_ROOT &&
+ window->window_type != GDK_WINDOW_FOREIGN)
tmp_unset_bg (window);
if (recurse)
{
GList *l;
- for (l = private->children; l != NULL; l = l->next)
+ for (l = window->children; l != NULL; l = l->next)
_gdk_win32_window_tmp_unset_bg (l->data, TRUE);
}
}
@@ -146,10 +140,8 @@ static void
tmp_unset_bg (GdkWindow *window)
{
GdkWindowImplWin32 *impl;
- GdkWindowObject *obj;
- obj = (GdkWindowObject *) window;
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
impl->no_bg = TRUE;
}
@@ -157,11 +149,9 @@ tmp_unset_bg (GdkWindow *window)
static void
tmp_reset_bg (GdkWindow *window)
{
- GdkWindowObject *obj;
GdkWindowImplWin32 *impl;
- obj = GDK_WINDOW_OBJECT (window);
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
+ impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
impl->no_bg = FALSE;
}
@@ -169,12 +159,10 @@ tmp_reset_bg (GdkWindow *window)
void
_gdk_win32_window_tmp_unset_parent_bg (GdkWindow *window)
{
- GdkWindowObject *private = (GdkWindowObject*)window;
-
- if (GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_ROOT)
+ if (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT)
return;
- window = _gdk_window_get_impl_window ((GdkWindow*)private->parent);
+ window = _gdk_window_get_impl_window (window->parent);
_gdk_win32_window_tmp_unset_bg (window, FALSE);
}
@@ -182,18 +170,16 @@ void
_gdk_win32_window_tmp_reset_bg (GdkWindow *window,
gboolean recurse)
{
- GdkWindowObject *private = (GdkWindowObject*)window;
-
g_return_if_fail (GDK_IS_WINDOW (window));
- if (private->input_only || private->destroyed ||
- (private->window_type != GDK_WINDOW_ROOT && !GDK_WINDOW_IS_MAPPED (window)))
+ if (window->input_only || window->destroyed ||
+ (window->window_type != GDK_WINDOW_ROOT && !GDK_WINDOW_IS_MAPPED (window)))
return;
if (_gdk_window_has_impl (window) &&
GDK_WINDOW_IS_WIN32 (window) &&
- private->window_type != GDK_WINDOW_ROOT &&
- private->window_type != GDK_WINDOW_FOREIGN)
+ window->window_type != GDK_WINDOW_ROOT &&
+ window->window_type != GDK_WINDOW_FOREIGN)
{
tmp_reset_bg (window);
}
@@ -202,79 +188,7 @@ _gdk_win32_window_tmp_reset_bg (GdkWindow *window,
{
GList *l;
- for (l = private->children; l != NULL; l = l->next)
+ for (l = window->children; l != NULL; l = l->next)
_gdk_win32_window_tmp_reset_bg (l->data, TRUE);
}
}
-
-/*
-void
-_gdk_win32_window_tmp_reset_bg (GdkWindow *window)
-{
- GdkWindowImplWin32 *impl;
- GdkWindowObject *obj;
-
- obj = (GdkWindowObject *) window;
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
-
- impl->no_bg = FALSE;
-}
-*/
-
-#if 0
-static cairo_region_t *
-gdk_window_clip_changed (GdkWindow *window,
- GdkRectangle *old_clip,
- GdkRectangle *new_clip)
-{
- GdkWindowImplWin32 *impl;
- GdkWindowObject *obj;
- cairo_region_t *old_clip_region;
- cairo_region_t *new_clip_region;
-
- if (((GdkWindowObject *)window)->input_only)
- return NULL;
-
- obj = (GdkWindowObject *) window;
- impl = GDK_WINDOW_IMPL_WIN32 (obj->impl);
-
- old_clip_region = cairo_region_create_rectangle (old_clip);
- new_clip_region = cairo_region_create_rectangle (new_clip);
-
- /* Trim invalid region of window to new clip rectangle
- */
- if (obj->update_area)
- cairo_region_intersect (obj->update_area, new_clip_region);
-
- /* Invalidate newly exposed portion of window
- */
- cairo_region_subtract (new_clip_region, old_clip_region);
- if (!cairo_region_is_empty (new_clip_region))
- gdk_window_tmp_unset_bg (window);
- else
- {
- cairo_region_destroy (new_clip_region);
- new_clip_region = NULL;
- }
-
- cairo_region_destroy (old_clip_region);
-
- return new_clip_region;
-}
-#endif
-
-#if 0
-static void
-gdk_window_post_scroll (GdkWindow *window,
- cairo_region_t *new_clip_region)
-{
- GDK_NOTE (EVENTS,
- g_print ("gdk_window_clip_changed: invalidating region: %s\n",
- _gdk_win32_cairo_region_to_string (new_clip_region)));
-
- gdk_window_invalidate_region (window, new_clip_region, FALSE);
- g_print ("gdk_window_post_scroll\n");
- cairo_region_destroy (new_clip_region);
-}
-
-#endif
diff --git a/gdk/win32/gdkim-win32.c b/gdk/win32/gdkim-win32.c
deleted file mode 100644
index dd7cf87944..0000000000
--- a/gdk/win32/gdkim-win32.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998-2004 Tor Lillqvist
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include
-#include
-#include
-
-#include "gdkinternals.h"
-#include "gdkwin32.h"
-
-gchar*
-gdk_set_locale (void)
-{
- if (!setlocale (LC_ALL, ""))
- g_warning ("locale not supported by C library");
-
- return g_win32_getlocale ();
-}
diff --git a/gdk/win32/gdkinput.c b/gdk/win32/gdkinput.c
index 32de7fc28d..64e461dd6d 100644
--- a/gdk/win32/gdkinput.c
+++ b/gdk/win32/gdkinput.c
@@ -34,7 +34,8 @@
#include "config.h"
#include "gdkdisplay.h"
-#include "gdkinput.h"
+#include "gdkdevice.h"
+#include "gdkdisplayprivate.h"
#include "gdkprivate-win32.h"
#include "gdkdevicemanager-win32.h"
@@ -47,11 +48,11 @@ GList *_gdk_input_windows;
GList *
gdk_devices_list (void)
{
- return gdk_display_list_devices (_gdk_display);
+ return _gdk_win32_display_list_devices (_gdk_display);
}
GList *
-gdk_display_list_devices (GdkDisplay *dpy)
+_gdk_win32_display_list_devices (GdkDisplay *dpy)
{
g_return_val_if_fail (dpy == _gdk_display, NULL);
@@ -69,7 +70,6 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
GdkExtensionMode mode)
{
GdkDeviceManager *device_manager;
- GdkWindowObject *window_private;
GList *devices, *d;
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -80,8 +80,7 @@ gdk_input_set_extension_events (GdkWindow *window, gint mask,
if (mode == GDK_EXTENSION_EVENTS_NONE)
mask = 0;
- window_private = (GdkWindowObject *) window;
- window_private->extension_events = mask;
+ window->extension_events = mask;
device_manager = gdk_display_get_device_manager (_gdk_display);
devices = gdk_device_manager_list_devices (device_manager,
diff --git a/gdk/win32/gdkkeys-win32.c b/gdk/win32/gdkkeys-win32.c
index dbeb1092eb..8b253d4ae8 100644
--- a/gdk/win32/gdkkeys-win32.c
+++ b/gdk/win32/gdkkeys-win32.c
@@ -35,9 +35,28 @@
#include "gdkprivate-win32.h"
#include "gdkinternals.h"
#include "gdkkeysyms.h"
+#include "gdkkeysprivate.h"
+#include "gdkwin32keys.h"
#include "config.h"
+struct _GdkWin32KeymapClass
+{
+ GdkKeymapClass parent_class;
+};
+
+struct _GdkWin32Keymap
+{
+ GdkKeymap parent_instance;
+};
+
+G_DEFINE_TYPE (GdkWin32Keymap, gdk_win32_keymap, GDK_TYPE_KEYMAP)
+
+static void
+gdk_win32_keymap_init (GdkWin32Keymap *keymap)
+{
+}
+
guint _gdk_keymap_serial = 0;
gboolean _gdk_keyboard_has_altgr = FALSE;
guint _scancode_rshift = 0;
@@ -489,18 +508,18 @@ update_keymap (void)
}
GdkKeymap*
-gdk_keymap_get_for_display (GdkDisplay *display)
+_gdk_win32_display_get_keymap (GdkDisplay *display)
{
g_return_val_if_fail (display == gdk_display_get_default (), NULL);
if (default_keymap == NULL)
- default_keymap = g_object_new (gdk_keymap_get_type (), NULL);
+ default_keymap = g_object_new (gdk_win32_keymap_get_type (), NULL);
return default_keymap;
}
-PangoDirection
-gdk_keymap_get_direction (GdkKeymap *keymap)
+static PangoDirection
+gdk_win32_keymap_get_direction (GdkKeymap *keymap)
{
update_keymap ();
@@ -520,8 +539,8 @@ gdk_keymap_get_direction (GdkKeymap *keymap)
}
}
-gboolean
-gdk_keymap_have_bidi_layouts (GdkKeymap *keymap)
+static gboolean
+gdk_win32_keymap_have_bidi_layouts (GdkKeymap *keymap)
{
/* Should we check if the kayboard layouts switchable at the moment
* cover both directionalities? What does the doc comment in
@@ -530,20 +549,20 @@ gdk_keymap_have_bidi_layouts (GdkKeymap *keymap)
return FALSE;
}
-gboolean
-gdk_keymap_get_caps_lock_state (GdkKeymap *keymap)
+static gboolean
+gdk_win32_keymap_get_caps_lock_state (GdkKeymap *keymap)
{
return ((GetKeyState (VK_CAPITAL) & 1) != 0);
}
-gboolean
-gdk_keymap_get_num_lock_state (GdkKeymap *keymap)
+static gboolean
+gdk_win32_keymap_get_num_lock_state (GdkKeymap *keymap)
{
return ((GetKeyState (VK_NUMLOCK) & 1) != 0);
}
-gboolean
-gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
+static gboolean
+gdk_win32_keymap_get_entries_for_keyval (GdkKeymap *keymap,
guint keyval,
GdkKeymapKey **keys,
gint *n_keys)
@@ -618,8 +637,8 @@ gdk_keymap_get_entries_for_keyval (GdkKeymap *keymap,
return *n_keys > 0;
}
-gboolean
-gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
+static gboolean
+gdk_win32_keymap_get_entries_for_keycode (GdkKeymap *keymap,
guint hardware_keycode,
GdkKeymapKey **keys,
guint **keyvals,
@@ -712,8 +731,8 @@ gdk_keymap_get_entries_for_keycode (GdkKeymap *keymap,
return *n_entries > 0;
}
-guint
-gdk_keymap_lookup_key (GdkKeymap *keymap,
+static guint
+gdk_win32_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key)
{
guint sym;
@@ -741,8 +760,8 @@ gdk_keymap_lookup_key (GdkKeymap *keymap,
return sym;
}
-gboolean
-gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
+static gboolean
+gdk_win32_keymap_translate_keyboard_state (GdkKeymap *keymap,
guint hardware_keycode,
GdkModifierType state,
gint group,
@@ -878,16 +897,41 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
return tmp_keyval != GDK_KEY_VoidSymbol;
}
-void
-gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
+static void
+gdk_win32_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
}
-gboolean
-gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
+static gboolean
+gdk_win32_keymap_map_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
{
/* FIXME: Is this the right thing to do? */
return TRUE;
}
+
+static void
+gdk_win32_keymap_finalize (GObject *object)
+{
+}
+
+static void
+gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass);
+
+ object_class->finalize = gdk_win32_keymap_finalize;
+
+ keymap_class->get_direction = gdk_win32_keymap_get_direction;
+ keymap_class->have_bidi_layouts = gdk_win32_keymap_have_bidi_layouts;
+ keymap_class->get_caps_lock_state = gdk_win32_keymap_get_caps_lock_state;
+ keymap_class->get_num_lock_state = gdk_win32_keymap_get_num_lock_state;
+ keymap_class->get_entries_for_keyval = gdk_win32_keymap_get_entries_for_keyval;
+ keymap_class->get_entries_for_keycode = gdk_win32_keymap_get_entries_for_keycode;
+ keymap_class->lookup_key = gdk_win32_keymap_lookup_key;
+ keymap_class->translate_keyboard_state = gdk_win32_keymap_translate_keyboard_state;
+ keymap_class->add_virtual_modifiers = gdk_win32_keymap_add_virtual_modifiers;
+ keymap_class->map_virtual_modifiers = gdk_win32_keymap_map_virtual_modifiers;
+}
diff --git a/gdk/win32/gdkmain-win32.c b/gdk/win32/gdkmain-win32.c
index e48e2bef40..a876631df6 100644
--- a/gdk/win32/gdkmain-win32.c
+++ b/gdk/win32/gdkmain-win32.c
@@ -38,6 +38,7 @@
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkprivate-win32.h"
+#include "gdkwin32.h"
#include
@@ -64,7 +65,7 @@ const GOptionEntry _gdk_windowing_args[] = {
{ NULL }
};
-int __stdcall
+BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
DWORD dwReason,
LPVOID reserved)
@@ -75,7 +76,7 @@ DllMain (HINSTANCE hinstDLL,
}
void
-_gdk_windowing_init (void)
+_gdk_win32_windowing_init (void)
{
gchar buf[10];
@@ -151,89 +152,6 @@ _gdk_other_api_failed (const gchar *where,
g_warning ("%s: %s failed", where, api);
}
-gint
-gdk_screen_get_width (GdkScreen *screen)
-{
- return GDK_WINDOW_OBJECT (_gdk_root)->width;
-}
-
-gint
-gdk_screen_get_height (GdkScreen *screen)
-{
- return GDK_WINDOW_OBJECT (_gdk_root)->height;
-}
-gint
-gdk_screen_get_width_mm (GdkScreen *screen)
-{
- return (double) gdk_screen_get_width (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSX) * 25.4;
-}
-
-gint
-gdk_screen_get_height_mm (GdkScreen *screen)
-{
- return (double) gdk_screen_get_height (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSY) * 25.4;
-}
-
-void
-_gdk_windowing_display_set_sm_client_id (GdkDisplay *display,
- const gchar *sm_client_id)
-{
- g_warning("gdk_set_sm_client_id %s", sm_client_id ? sm_client_id : "NULL");
-}
-
-void
-gdk_display_beep (GdkDisplay *display)
-{
- g_return_if_fail (display == gdk_display_get_default());
- Beep(1000, 50);
-}
-
-void
-_gdk_windowing_exit (void)
-{
- _gdk_win32_dnd_exit ();
- CoUninitialize ();
- DeleteDC (_gdk_display_hdc);
- _gdk_display_hdc = NULL;
-}
-
-gchar *
-gdk_get_display (void)
-{
- return g_strdup (gdk_display_get_name (gdk_display_get_default ()));
-}
-
-void
-gdk_error_trap_push (void)
-{
-}
-
-gint
-gdk_error_trap_pop (void)
-{
- return 0;
-}
-
-void
-gdk_error_trap_pop_ignored (void)
-{
-}
-
-void
-gdk_notify_startup_complete (void)
-{
-}
-
-void
-gdk_notify_startup_complete_with_id (const gchar* startup_id)
-{
-}
-
-void
-gdk_window_set_startup_id (GdkWindow *window,
- const gchar *startup_id)
-{
-}
#ifdef G_ENABLE_DEBUG
@@ -1043,13 +961,13 @@ _gdk_win32_cairo_region_to_string (const cairo_region_t *rgn)
}
gchar *
-_gdk_win32_drawable_description (GdkDrawable *d)
+_gdk_win32_window_description (GdkWindow *d)
{
- g_return_val_if_fail (GDK_IS_DRAWABLE (d), NULL);
+ g_return_val_if_fail (GDK_IS_WINDOW (d), NULL);
return static_printf ("%s:%p:%dx%dx%d",
G_OBJECT_TYPE_NAME (d),
- GDK_DRAWABLE_HANDLE (d),
+ GDK_WINDOW_HWND (d),
gdk_window_get_width (GDK_WINDOW (d)),
gdk_window_get_height (GDK_WINDOW (d)),
gdk_visual_get_depth (gdk_window_get_visual (GDK_WINDOW (d))));
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 384167ee2b..2889e66cb6 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -36,6 +36,7 @@
#endif
#include
+#include
#include
#include "gdkinternals.h"
@@ -103,16 +104,14 @@
#define GDK_DEBUG_MISC_OR_COLORMAP (GDK_DEBUG_MISC|GDK_DEBUG_COLORMAP)
#define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS)
-//#define GDK_WINDOW_SCREEN(win) (_gdk_screen)
GdkScreen *GDK_WINDOW_SCREEN(GObject *win);
-#define GDK_WINDOW_IS_WIN32(win) (GDK_IS_WINDOW_IMPL_WIN32 (((GdkWindowObject *)win)->impl))
+#define GDK_WINDOW_IS_WIN32(win) (GDK_IS_WINDOW_IMPL_WIN32 (win->impl))
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
-typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
-struct _GdkCursorPrivate
+struct _GdkWin32Cursor
{
GdkCursor cursor;
HCURSOR hcursor;
@@ -126,11 +125,6 @@ struct _GdkWin32SingleFont
FONTSIGNATURE fs;
};
-struct _GdkVisualClass
-{
- GObjectClass parent_class;
-};
-
typedef enum {
GDK_WIN32_PE_STATIC,
GDK_WIN32_PE_AVAILABLE,
@@ -167,9 +161,6 @@ void _gdk_win32_window_move_region (GdkWindow *window,
const cairo_region_t *region,
gint dx,
gint dy);
-void _gdk_win32_windowing_window_get_offsets (GdkWindow *window,
- gint *x_offset,
- gint *y_offset);
void _gdk_win32_selection_init (void);
@@ -211,7 +202,7 @@ gchar *_gdk_win32_window_style_to_string (LONG style);
gchar *_gdk_win32_window_exstyle_to_string (LONG style);
gchar *_gdk_win32_window_pos_bits_to_string (UINT flags);
gchar *_gdk_win32_drag_action_to_string (GdkDragAction actions);
-gchar *_gdk_win32_drawable_description (GdkDrawable *d);
+gchar *_gdk_win32_window_description (GdkWindow *d);
gchar *_gdk_win32_rop2_to_string (int rop2);
gchar *_gdk_win32_lbstyle_to_string (UINT brush_style);
@@ -374,7 +365,149 @@ HICON _gdk_win32_pixbuf_to_hcursor (GdkPixbuf *pixbuf,
gint y_hotspot);
gboolean _gdk_win32_pixbuf_to_hicon_supports_alpha (void);
+/* GdkDisplay member functions */
+GdkNativeWindow _gdk_win32_display_get_drag_protocol (GdkDisplay *display,
+ GdkNativeWindow xid,
+ GdkDragProtocol *protocol,
+ guint *version);
+
+GdkCursor *_gdk_win32_display_get_cursor_for_type (GdkDisplay *display,
+ GdkCursorType cursor_type);
+GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay *display,
+ const gchar *name);
+GdkCursor *_gdk_win32_display_get_cursor_for_pixbuf (GdkDisplay *display,
+ GdkPixbuf *pixbuf,
+ gint x,
+ gint y);
+void _gdk_win32_display_get_default_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height);
+void _gdk_win32_display_get_maximal_cursor_size (GdkDisplay *display,
+ guint *width,
+ guint *height);
+gboolean _gdk_win32_display_supports_cursor_alpha (GdkDisplay *display);
+gboolean _gdk_win32_display_supports_cursor_color (GdkDisplay *display);
+
+GList *_gdk_win32_display_list_devices (GdkDisplay *dpy);
+
+gboolean _gdk_win32_display_send_client_message (GdkDisplay *display,
+ GdkEvent *event,
+ GdkNativeWindow winid);
+void _gdk_win32_display_add_client_message_filter (GdkDisplay *display,
+ GdkAtom message_type,
+ GdkFilterFunc func,
+ gpointer data);
+void _gdk_win32_display_sync (GdkDisplay * display);
+gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
+void _gdk_win32_display_queue_events (GdkDisplay *display);
+
+gboolean _gdk_win32_selection_owner_set_for_display (GdkDisplay *display,
+ GdkWindow *owner,
+ GdkAtom selection,
+ guint32 time,
+ gboolean send_event);
+GdkWindow *_gdk_win32_display_get_selection_owner (GdkDisplay *display,
+ GdkAtom selection);
+gboolean _gdk_win32_display_set_selection_owner (GdkDisplay *display,
+ GdkWindow *owner,
+ GdkAtom selection,
+ guint32 time,
+ gboolean send_event);
+void _gdk_win32_display_send_selection_notify (GdkDisplay *display,
+ GdkNativeWindow requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ GdkAtom property,
+ guint32 time);
+gint _gdk_win32_display_get_selection_property (GdkDisplay *display,
+ GdkWindow *requestor,
+ guchar **data,
+ GdkAtom *ret_type,
+ gint *ret_format);
+void _gdk_win32_display_convert_selection (GdkDisplay *display,
+ GdkWindow *requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ guint32 time);
+gint _gdk_win32_display_text_property_to_utf8_list (GdkDisplay *display,
+ GdkAtom encoding,
+ gint format,
+ const guchar *text,
+ gint length,
+ gchar ***list);
+gchar *_gdk_win32_display_utf8_to_string_target (GdkDisplay *display, const gchar *str);
+
+GdkKeymap *_gdk_win32_display_get_keymap (GdkDisplay *display);
+
+void _gdk_win32_display_create_window_impl (GdkDisplay *display,
+ GdkWindow *window,
+ GdkWindow *real_parent,
+ GdkScreen *screen,
+ GdkEventMask event_mask,
+ GdkWindowAttr *attributes,
+ gint attributes_mask);
+
+/* stray GdkWindowImplWin32 members */
+void _gdk_win32_window_register_dnd (GdkWindow *window);
+GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, GdkDevice *device, GList *targets);
+gboolean _gdk_win32_window_simulate_key (GdkWindow *window,
+ gint x,
+ gint y,
+ guint keyval,
+ GdkModifierType modifiers,
+ GdkEventType key_pressrelease);
+gboolean _gdk_win32_window_simulate_button (GdkWindow *window,
+ gint x,
+ gint y,
+ guint button, /*1..3*/
+ GdkModifierType modifiers,
+ GdkEventType button_pressrelease);
+
+gint _gdk_win32_window_get_property (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gulong offset,
+ gulong length,
+ gint pdelete,
+ GdkAtom *actual_property_type,
+ gint *actual_format_type,
+ gint *actual_length,
+ guchar **data);
+void _gdk_win32_window_change_property (GdkWindow *window,
+ GdkAtom property,
+ GdkAtom type,
+ gint format,
+ GdkPropMode mode,
+ const guchar *data,
+ gint nelements);
+void _gdk_win32_window_delete_property (GdkWindow *window, GdkAtom property);
+
+/* Stray GdkWin32Screen members */
+GdkVisual *_gdk_win32_screen_get_system_visual (GdkScreen *screen);
+void _gdk_win32_screen_broadcast_client_message (GdkScreen *screen, GdkEvent *event);
+gboolean _gdk_win32_screen_get_setting (GdkScreen *screen, const gchar *name, GValue *value);
+gint _gdk_win32_screen_visual_get_best_depth (GdkScreen *screen);
+GdkVisualType _gdk_win32_screen_visual_get_best_type (GdkScreen *screen);
+GdkVisual *_gdk_win32_screen_visual_get_best (GdkScreen *screen);
+GdkVisual *_gdk_win32_screen_visual_get_best_with_depth (GdkScreen *screen, gint depth);
+GdkVisual *_gdk_win32_screen_visual_get_best_with_type (GdkScreen *screen, GdkVisualType visual_type);
+GdkVisual *_gdk_win32_screen_visual_get_best_with_both (GdkScreen *screen, gint depth, GdkVisualType visual_type);
+void _gdk_win32_screen_query_depths (GdkScreen *screen, gint **depths, gint *count);
+void _gdk_win32_screen_query_visual_types (GdkScreen *screen,
+ GdkVisualType **visual_types,
+ gint *count);
+GList *_gdk_win32_screen_list_visuals (GdkScreen *screen);
+
+/* Distributed display manager implementation */
+GdkDisplay *_gdk_win32_display_open (const gchar *display_name);
+GdkAtom _gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
+ const gchar *atom_name,
+ gint only_if_exists);
+gchar *_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager,
+ GdkAtom atom);
+
/* Initialization */
+void _gdk_win32_windowing_init (void);
void _gdk_windowing_window_init (GdkScreen *screen);
void _gdk_root_window_size_init (void);
void _gdk_monitor_init(void);
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index 542f83a9cb..b8882bc336 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -34,10 +34,12 @@
#include "gdkproperty.h"
#include "gdkselection.h"
#include "gdkprivate-win32.h"
+#include "gdkwin32.h"
GdkAtom
-gdk_atom_intern (const gchar *atom_name,
- gint only_if_exists)
+_gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
+ const gchar *atom_name,
+ gint only_if_exists)
{
ATOM win32_atom;
GdkAtom retval;
@@ -84,17 +86,9 @@ gdk_atom_intern (const gchar *atom_name,
return retval;
}
-GdkAtom
-gdk_atom_intern_static_string (const gchar *atom_name)
-{
- /* on X11 this is supposed to save memory. On win32 there seems to be
- * no way to make a difference ?
- */
- return gdk_atom_intern (atom_name, FALSE);
-}
-
gchar *
-gdk_atom_name (GdkAtom atom)
+_gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager,
+ GdkAtom atom)
{
ATOM win32_atom;
gchar name[256];
@@ -122,7 +116,7 @@ gdk_atom_name (GdkAtom atom)
}
gint
-gdk_property_get (GdkWindow *window,
+_gdk_win32_window_get_property (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gulong offset,
@@ -145,7 +139,7 @@ gdk_property_get (GdkWindow *window,
}
void
-gdk_property_change (GdkWindow *window,
+_gdk_win32_window_change_property (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gint format,
@@ -268,8 +262,8 @@ gdk_property_change (GdkWindow *window,
}
void
-gdk_property_delete (GdkWindow *window,
- GdkAtom property)
+_gdk_win32_window_delete_property (GdkWindow *window,
+ GdkAtom property)
{
gchar *prop_name;
@@ -354,7 +348,7 @@ gdk_property_delete (GdkWindow *window,
*/
gboolean
-gdk_screen_get_setting (GdkScreen *screen,
+_gdk_win32_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value)
{
diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c
index 047e948b45..12b18d56fb 100644
--- a/gdk/win32/gdkscreen-win32.c
+++ b/gdk/win32/gdkscreen-win32.c
@@ -20,37 +20,77 @@
#include "config.h"
#include "gdk.h"
#include "gdkprivate-win32.h"
+#include "gdkscreenprivate.h"
+#include "gdkwin32screen.h"
-GdkDisplay *
-gdk_screen_get_display (GdkScreen *screen)
+struct _GdkWin32Screen
+{
+ GdkScreen parent_instance;
+};
+struct _GdkWin32ScreenClass
+{
+ GdkScreenClass parent_class;
+};
+G_DEFINE_TYPE (GdkWin32Screen, gdk_win32_screen, GDK_TYPE_SCREEN)
+static void
+gdk_win32_screen_init(GdkWin32Screen *display)
+{
+}
+
+static GdkDisplay *
+gdk_win32_screen_get_display (GdkScreen *screen)
{
return _gdk_display;
}
-GdkWindow *
-gdk_screen_get_root_window (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_width (GdkScreen *screen)
+{
+ return GDK_WINDOW (_gdk_root)->width;
+}
+
+static gint
+gdk_win32_screen_get_height (GdkScreen *screen)
+{
+ return GDK_WINDOW (_gdk_root)->height;
+}
+
+static gint
+gdk_win32_screen_get_width_mm (GdkScreen *screen)
+{
+ return (double) gdk_screen_get_width (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSX) * 25.4;
+}
+
+static gint
+gdk_win32_screen_get_height_mm (GdkScreen *screen)
+{
+ return (double) gdk_screen_get_height (screen) / GetDeviceCaps (_gdk_display_hdc, LOGPIXELSY) * 25.4;
+}
+
+static GdkWindow *
+gdk_win32_screen_get_root_window (GdkScreen *screen)
{
return _gdk_root;
}
-gint
-gdk_screen_get_n_monitors (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_n_monitors (GdkScreen *screen)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
return _gdk_num_monitors;
}
-gint
-gdk_screen_get_primary_monitor (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_primary_monitor (GdkScreen *screen)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
return 0;
}
-gint
-gdk_screen_get_monitor_width_mm (GdkScreen *screen,
+static gint
+gdk_win32_screen_get_monitor_width_mm (GdkScreen *screen,
gint num_monitor)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
@@ -60,8 +100,8 @@ gdk_screen_get_monitor_width_mm (GdkScreen *screen,
return _gdk_monitors[num_monitor].width_mm;
}
-gint
-gdk_screen_get_monitor_height_mm (GdkScreen *screen,
+static gint
+gdk_win32_screen_get_monitor_height_mm (GdkScreen *screen,
gint num_monitor)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
@@ -71,8 +111,8 @@ gdk_screen_get_monitor_height_mm (GdkScreen *screen,
return _gdk_monitors[num_monitor].height_mm;
}
-gchar *
-gdk_screen_get_monitor_plug_name (GdkScreen *screen,
+static gchar *
+gdk_win32_screen_get_monitor_plug_name (GdkScreen *screen,
gint num_monitor)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
@@ -82,8 +122,8 @@ gdk_screen_get_monitor_plug_name (GdkScreen *screen,
return g_strdup (_gdk_monitors[num_monitor].name);
}
-void
-gdk_screen_get_monitor_geometry (GdkScreen *screen,
+static void
+gdk_win32_screen_get_monitor_geometry (GdkScreen *screen,
gint num_monitor,
GdkRectangle *dest)
{
@@ -94,16 +134,16 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen,
*dest = _gdk_monitors[num_monitor].rect;
}
-GdkVisual *
-gdk_screen_get_rgba_visual (GdkScreen *screen)
+static GdkVisual *
+gdk_win32_screen_get_rgba_visual (GdkScreen *screen)
{
g_return_val_if_fail (screen == _gdk_screen, NULL);
return NULL;
}
-gint
-gdk_screen_get_number (GdkScreen *screen)
+static gint
+gdk_win32_screen_get_number (GdkScreen *screen)
{
g_return_val_if_fail (screen == _gdk_screen, 0);
@@ -120,32 +160,83 @@ _gdk_windowing_substitute_screen_number (const gchar *display_name,
return g_strdup (display_name);
}
-gchar *
-gdk_screen_make_display_name (GdkScreen *screen)
+static gchar *
+gdk_win32_screen_make_display_name (GdkScreen *screen)
{
return g_strdup (gdk_display_get_name (_gdk_display));
}
-GdkWindow *
-gdk_screen_get_active_window (GdkScreen *screen)
+static GdkWindow *
+gdk_win32_screen_get_active_window (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return NULL;
}
-GList *
-gdk_screen_get_window_stack (GdkScreen *screen)
+static GList *
+gdk_win32_screen_get_window_stack (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return NULL;
}
-gboolean
-gdk_screen_is_composited (GdkScreen *screen)
+static gboolean
+gdk_win32_screen_is_composited (GdkScreen *screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
return FALSE;
}
+
+static void
+gdk_win32_screen_finalize (GObject *object)
+{
+}
+
+static void
+gdk_win32_screen_dispose (GObject *object)
+{
+}
+
+static void
+gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GdkScreenClass *screen_class = GDK_SCREEN_CLASS (klass);
+
+ object_class->dispose = gdk_win32_screen_dispose;
+ object_class->finalize = gdk_win32_screen_finalize;
+
+ screen_class->get_display = gdk_win32_screen_get_display;
+ screen_class->get_width = gdk_win32_screen_get_width;
+ screen_class->get_height = gdk_win32_screen_get_height;
+ screen_class->get_width_mm = gdk_win32_screen_get_width_mm;
+ screen_class->get_height_mm = gdk_win32_screen_get_height_mm;
+ screen_class->get_number = gdk_win32_screen_get_number;
+ screen_class->get_root_window = gdk_win32_screen_get_root_window;
+ screen_class->get_n_monitors = gdk_win32_screen_get_n_monitors;
+ screen_class->get_primary_monitor = gdk_win32_screen_get_primary_monitor;
+ screen_class->get_monitor_width_mm = gdk_win32_screen_get_monitor_width_mm;
+ screen_class->get_monitor_height_mm = gdk_win32_screen_get_monitor_height_mm;
+ screen_class->get_monitor_plug_name = gdk_win32_screen_get_monitor_plug_name;
+ screen_class->get_monitor_geometry = gdk_win32_screen_get_monitor_geometry;
+ screen_class->get_system_visual = _gdk_win32_screen_get_system_visual;
+ screen_class->get_rgba_visual = gdk_win32_screen_get_rgba_visual;
+ screen_class->is_composited = gdk_win32_screen_is_composited;
+ screen_class->make_display_name = gdk_win32_screen_make_display_name;
+ screen_class->get_active_window = gdk_win32_screen_get_active_window;
+ screen_class->get_window_stack = gdk_win32_screen_get_window_stack;
+ screen_class->broadcast_client_message = _gdk_win32_screen_broadcast_client_message;
+ screen_class->get_setting = _gdk_win32_screen_get_setting;
+ screen_class->visual_get_best_depth = _gdk_win32_screen_visual_get_best_depth;
+ screen_class->visual_get_best_type = _gdk_win32_screen_visual_get_best_type;
+ screen_class->visual_get_best = _gdk_win32_screen_visual_get_best;
+ screen_class->visual_get_best_with_depth = _gdk_win32_screen_visual_get_best_with_depth;
+ screen_class->visual_get_best_with_type = _gdk_win32_screen_visual_get_best_with_type;
+ screen_class->visual_get_best_with_both = _gdk_win32_screen_visual_get_best_with_both;
+ screen_class->query_depths = _gdk_win32_screen_query_depths;
+ screen_class->query_visual_types = _gdk_win32_screen_query_visual_types;
+ screen_class->list_visuals = _gdk_win32_screen_list_visuals;
+}
\ No newline at end of file
diff --git a/gdk/win32/gdkselection-win32.c b/gdk/win32/gdkselection-win32.c
index e3936a9b3e..5b56321a3e 100644
--- a/gdk/win32/gdkselection-win32.c
+++ b/gdk/win32/gdkselection-win32.c
@@ -33,6 +33,7 @@
#include "gdkselection.h"
#include "gdkdisplay.h"
#include "gdkprivate-win32.h"
+#include "gdkwin32.h"
/* We emulate the GDK_SELECTION window properties of windows (as used
* in the X11 backend) by using a hash table from window handles to
@@ -253,11 +254,11 @@ get_mapped_gdk_atom_name (GdkAtom gdk_target)
}
gboolean
-gdk_selection_owner_set_for_display (GdkDisplay *display,
- GdkWindow *owner,
- GdkAtom selection,
- guint32 time,
- gboolean send_event)
+_gdk_win32_display_set_selection_owner (GdkDisplay *display,
+ GdkWindow *owner,
+ GdkAtom selection,
+ guint32 time,
+ gboolean send_event)
{
HWND hwnd;
GdkEvent tmp_event;
@@ -333,8 +334,8 @@ gdk_selection_owner_set_for_display (GdkDisplay *display,
}
GdkWindow*
-gdk_selection_owner_get_for_display (GdkDisplay *display,
- GdkAtom selection)
+_gdk_win32_display_get_selection_owner (GdkDisplay *display,
+ GdkAtom selection)
{
GdkWindow *window;
@@ -351,7 +352,8 @@ gdk_selection_owner_get_for_display (GdkDisplay *display,
return gdk_win32_handle_table_lookup ((GdkNativeWindow) owner);
}
- window = gdk_window_lookup ((GdkNativeWindow) g_hash_table_lookup (sel_owner_table, selection));
+ window = gdk_win32_window_lookup_for_display (display,
+ (GdkNativeWindow) g_hash_table_lookup (sel_owner_table, selection));
GDK_NOTE (DND, {
gchar *sel_name = gdk_atom_name (selection);
@@ -387,10 +389,11 @@ generate_selection_notify (GdkWindow *requestor,
}
void
-gdk_selection_convert (GdkWindow *requestor,
- GdkAtom selection,
- GdkAtom target,
- guint32 time)
+_gdk_win32_display_convert_selection (GdkDisplay *display,
+ GdkWindow *requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ guint32 time)
{
HGLOBAL hdata;
GdkAtom property = _gdk_selection;
@@ -804,10 +807,11 @@ gdk_selection_convert (GdkWindow *requestor,
}
gint
-gdk_selection_property_get (GdkWindow *requestor,
- guchar **data,
- GdkAtom *ret_type,
- gint *ret_format)
+_gdk_win32_display_get_selection_property (GdkDisplay *display,
+ GdkWindow *requestor,
+ guchar **data,
+ GdkAtom *ret_type,
+ gint *ret_format)
{
GdkSelProp *prop;
@@ -869,12 +873,12 @@ _gdk_selection_property_delete (GdkWindow *window)
}
void
-gdk_selection_send_notify_for_display (GdkDisplay *display,
- GdkNativeWindow requestor,
- GdkAtom selection,
- GdkAtom target,
- GdkAtom property,
- guint32 time)
+_gdk_win32_display_send_selection_notify (GdkDisplay *display,
+ GdkNativeWindow requestor,
+ GdkAtom selection,
+ GdkAtom target,
+ GdkAtom property,
+ guint32 time)
{
g_return_if_fail (display == _gdk_display);
@@ -1020,13 +1024,13 @@ make_list (const gchar *text,
return n_strings;
}
-gint
-gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
- GdkAtom encoding,
- gint format,
- const guchar *text,
- gint length,
- gchar ***list)
+gint
+_gdk_win32_display_text_property_to_utf8_list (GdkDisplay *display,
+ GdkAtom encoding,
+ gint format,
+ const guchar *text,
+ gint length,
+ gchar ***list)
{
g_return_val_if_fail (text != NULL, 0);
g_return_val_if_fail (length >= 0, 0);
@@ -1086,7 +1090,8 @@ gdk_string_to_compound_text_for_display (GdkDisplay *display,
}
gchar *
-gdk_utf8_to_string_target (const gchar *str)
+_gdk_win32_display_utf8_to_string_target (GdkDisplay *display,
+ const gchar *str)
{
return _gdk_utf8_to_string_target_internal (str, strlen (str));
}
diff --git a/gdk/win32/gdkspawn-win32.c b/gdk/win32/gdkspawn-win32.c
deleted file mode 100644
index 6cddd648b1..0000000000
--- a/gdk/win32/gdkspawn-win32.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2003 Sun Microsystems Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors: Mark McLoughlin
- */
-
-#include "config.h"
-
-#include "gdkspawn.h"
-
-#include