Compare commits

...

17 Commits

Author SHA1 Message Date
Erwann Chenede
845b1f3211 removed GdkScreen from gdk_pango_get_gc
removed all the move resize data from GdkDisplay put it into local variable in and attached it to
GdkDisplay Object.
2001-06-13 21:51:38 +00:00
Erwann Chenede
8ba19314c6 removed gdk_window_get_[screen|display] replaced by gdk_drawable_get_*
modified gdk_keymap_*
2001-06-13 18:49:30 +00:00
Erwann Chenede
c5faaf2132 misc indentation fixes 2001-06-12 12:23:26 +00:00
Erwann Chenede
a9cec4e3d0 remove DEFAULT_GDK_* to proper functions.
changed dpy_mgr to gdk_display_manager (added a fct to get it).
2001-06-11 13:25:41 +00:00
Erwann Chenede
cbdedb210d *** empty log message *** 2001-06-08 18:15:30 +00:00
Erwann Chenede
4e71d42920 change strange naming convention from : root_parent parent_root root_window
root_window and xroot_window (modified fct too).
added gdk_widget_get_display
2001-06-08 18:00:31 +00:00
Erwann Chenede
7ef95bf051 remove for_screen alternate function for gdk_.itmap_create_for_data, etc
finished swapping args where GdkScreen or GdkDisplay where not at the first place.
2001-06-08 16:43:53 +00:00
Erwann Chenede
73f340ea73 move gdk_screen_width|heigth* to gdkdisplay
removed gdk_colormap_new_for_screen
implemented gdk_display_flush to replace gdk_flush
2001-06-08 14:33:38 +00:00
Erwann Chenede
bb0b5342c9 All _for_display function added now have the GdkDisplay arg as the first arg. 2001-06-08 11:19:25 +00:00
Erwann Chenede
24b845f8f6 Added GdkDisplay to GdkKeymap
Removed all for_display associated to GdkKeymap
2001-06-07 18:01:45 +00:00
Erwann Chenede
f7d0a21a2b change gdk_atom_intern_for_display to gdk_display_atom
change its signature to swap arg 3 and arg 1
2001-06-07 15:37:08 +00:00
Erwann Chenede
86f52bfd26 replaced gdk.h:void gdk_set_use_xshm_for_display (GdkDisplay * display,
replaced
gdk.h:void    gdk_set_use_xshm_for_display  (GdkDisplay * display, gboolean use_xshm);
gdk.h:gboolean  gdk_get_use_xshm_for_display  (GdkDisplay * display);
gdk.h:void        gdk_pointer_ungrab_for_display (GdkDisplay * display,
gdk.h:void        gdk_keyboard_ungrab_for_display (GdkDisplay * display,
gdk.h:gboolean      gdk_pointer_is_grabbed_for_display (GdkDisplay * display);
gdk.h:void gdk_beep_for_display (GdkDisplay * display);

by

void	gdk_display_use_xshm_set  (GdkDisplay *display, gboolean use_xshm);
gboolean        gdk_display_use_xshm_get        (GdkDisplay * display);
void          gdk_display_pointer_ungrab      (GdkDisplay * display, guint32 time);
void          gdk_display_keyboard_ungrab (GdkDisplay * display, guint32 time);
gboolean        gdk_display_is_pointer_grabbed  (GdkDisplay * display);
void	gdk_display_beep    (GdkDisplay * display);
2001-06-06 14:20:19 +00:00
Erwann Chenede
63f140c9c8 06/06/01 Erwann Chenede
Sync the gtk-multihead branch with cvs HEAD
2001-06-06 12:33:30 +00:00
Erwann Chenede
d47c6f30ff 5/6/01 erwann More fixes, added a new small test problem.
5/6/01 erwann
More fixes, added a new small test problem.
2001-06-05 16:10:23 +00:00
Erwann Chenede
565b8c42d4 Various bug fixes for multiple display support and drag and drop 2001-05-29 16:26:43 +00:00
Erwann Chenede
6768cfdf2f Multidisplay is now working, check crude test in tests/testmultidisplay.c 2001-05-24 15:25:50 +00:00
Erwann Chenede
28314a4bf1 *** empty log message *** 2001-05-17 20:23:34 +00:00
399 changed files with 24796 additions and 14097 deletions

View File

@@ -1,3 +1,33 @@
2001-05-17 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkbbox.c:
Add properties, based on patch by Lee Mallabone.
* gtk/gtknotebook.c:
* gtk/gtktoolbar.c:
Convert from GtkArg to GParam, based on patch by John Margaglione.
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkrange.c:
Move adjustment property to GtkRange.
* gtk/gtklabel.c:
Setup mnemonics on property changes
* gtk/gtkwidget.c (gtk_widget_get_property):
GdkExtensionMode is an enum, not a flag. Set it with
g_value_set_enum ().
* tests/prop-editor.c:
Better propery editor.
* tests/testgtk.c:
Add new property test. Pass zero to the property editor to
get properties from all derived types.
Sun May 13 12:01:12 2001 Owen Taylor <otaylor@redhat.com>
* autogen.sh (have_automake): Require libtool-1.4,

View File

@@ -1,3 +1,33 @@
2001-05-17 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkbbox.c:
Add properties, based on patch by Lee Mallabone.
* gtk/gtknotebook.c:
* gtk/gtktoolbar.c:
Convert from GtkArg to GParam, based on patch by John Margaglione.
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkrange.c:
Move adjustment property to GtkRange.
* gtk/gtklabel.c:
Setup mnemonics on property changes
* gtk/gtkwidget.c (gtk_widget_get_property):
GdkExtensionMode is an enum, not a flag. Set it with
g_value_set_enum ().
* tests/prop-editor.c:
Better propery editor.
* tests/testgtk.c:
Add new property test. Pass zero to the property editor to
get properties from all derived types.
Sun May 13 12:01:12 2001 Owen Taylor <otaylor@redhat.com>
* autogen.sh (have_automake): Require libtool-1.4,

View File

@@ -1,3 +1,33 @@
2001-05-17 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkbbox.c:
Add properties, based on patch by Lee Mallabone.
* gtk/gtknotebook.c:
* gtk/gtktoolbar.c:
Convert from GtkArg to GParam, based on patch by John Margaglione.
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkrange.c:
Move adjustment property to GtkRange.
* gtk/gtklabel.c:
Setup mnemonics on property changes
* gtk/gtkwidget.c (gtk_widget_get_property):
GdkExtensionMode is an enum, not a flag. Set it with
g_value_set_enum ().
* tests/prop-editor.c:
Better propery editor.
* tests/testgtk.c:
Add new property test. Pass zero to the property editor to
get properties from all derived types.
Sun May 13 12:01:12 2001 Owen Taylor <otaylor@redhat.com>
* autogen.sh (have_automake): Require libtool-1.4,

View File

@@ -1,3 +1,33 @@
2001-05-17 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkbbox.c:
Add properties, based on patch by Lee Mallabone.
* gtk/gtknotebook.c:
* gtk/gtktoolbar.c:
Convert from GtkArg to GParam, based on patch by John Margaglione.
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkrange.c:
Move adjustment property to GtkRange.
* gtk/gtklabel.c:
Setup mnemonics on property changes
* gtk/gtkwidget.c (gtk_widget_get_property):
GdkExtensionMode is an enum, not a flag. Set it with
g_value_set_enum ().
* tests/prop-editor.c:
Better propery editor.
* tests/testgtk.c:
Add new property test. Pass zero to the property editor to
get properties from all derived types.
Sun May 13 12:01:12 2001 Owen Taylor <otaylor@redhat.com>
* autogen.sh (have_automake): Require libtool-1.4,

View File

@@ -1,3 +1,33 @@
2001-05-17 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkbbox.c:
Add properties, based on patch by Lee Mallabone.
* gtk/gtknotebook.c:
* gtk/gtktoolbar.c:
Convert from GtkArg to GParam, based on patch by John Margaglione.
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkrange.c:
Move adjustment property to GtkRange.
* gtk/gtklabel.c:
Setup mnemonics on property changes
* gtk/gtkwidget.c (gtk_widget_get_property):
GdkExtensionMode is an enum, not a flag. Set it with
g_value_set_enum ().
* tests/prop-editor.c:
Better propery editor.
* tests/testgtk.c:
Add new property test. Pass zero to the property editor to
get properties from all derived types.
Sun May 13 12:01:12 2001 Owen Taylor <otaylor@redhat.com>
* autogen.sh (have_automake): Require libtool-1.4,

View File

@@ -1,3 +1,33 @@
2001-05-17 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkbbox.c:
Add properties, based on patch by Lee Mallabone.
* gtk/gtknotebook.c:
* gtk/gtktoolbar.c:
Convert from GtkArg to GParam, based on patch by John Margaglione.
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkrange.c:
Move adjustment property to GtkRange.
* gtk/gtklabel.c:
Setup mnemonics on property changes
* gtk/gtkwidget.c (gtk_widget_get_property):
GdkExtensionMode is an enum, not a flag. Set it with
g_value_set_enum ().
* tests/prop-editor.c:
Better propery editor.
* tests/testgtk.c:
Add new property test. Pass zero to the property editor to
get properties from all derived types.
Sun May 13 12:01:12 2001 Owen Taylor <otaylor@redhat.com>
* autogen.sh (have_automake): Require libtool-1.4,

View File

@@ -1,3 +1,33 @@
2001-05-17 Alexander Larsson <alla@lysator.liu.se>
* gtk/gtkbbox.c:
Add properties, based on patch by Lee Mallabone.
* gtk/gtknotebook.c:
* gtk/gtktoolbar.c:
Convert from GtkArg to GParam, based on patch by John Margaglione.
* gtk/gtkhscale.c:
* gtk/gtkvscale.c:
* gtk/gtkhscrollbar.c:
* gtk/gtkvscrollbar.c:
* gtk/gtkrange.c:
Move adjustment property to GtkRange.
* gtk/gtklabel.c:
Setup mnemonics on property changes
* gtk/gtkwidget.c (gtk_widget_get_property):
GdkExtensionMode is an enum, not a flag. Set it with
g_value_set_enum ().
* tests/prop-editor.c:
Better propery editor.
* tests/testgtk.c:
Add new property test. Pass zero to the property editor to
get properties from all derived types.
Sun May 13 12:01:12 2001 Owen Taylor <otaylor@redhat.com>
* autogen.sh (have_automake): Require libtool-1.4,

View File

@@ -14,7 +14,7 @@ DIE=0
have_libtool=false
if libtool --version < /dev/null > /dev/null 2>&1 ; then
libtool_version=`libtoolize --version | libtoolize --version | sed 's/^[^0-9]*\([0-9.]\+\).*/\1/'`
libtool_version=`libtoolize --version | libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
case $libtool_version in
1.4*)
have_libtool=true
@@ -77,7 +77,7 @@ esac
if test -z "$ACLOCAL_FLAGS"; then
acdir=`aclocal --print-ac-dir`
m4list="glib-2.0.m4 gettext.m4"
m4list="glib-2.0.m4 glib-gettext.m4"
for file in $m4list
do
@@ -93,18 +93,6 @@ if test -z "$ACLOCAL_FLAGS"; then
done
fi
echo "Running gettextize... Ignore non-fatal messages."
# Hmm, we specify --force here, since otherwise things dont'
# get added reliably, but we don't want to overwrite intl
# while making dist.
echo "no" | gettextize --copy --force
#
# Really bad hack
echo "Munging po/Makefile.in.in"
sed s%@PACKAGE@%@GETTEXT_PACKAGE@% < po/Makefile.in.in > po/Makefile.in.in.new
mv po/Makefile.in.in.new po/Makefile.in.in
aclocal $ACLOCAL_FLAGS
# optionally feature autoheader

View File

@@ -62,9 +62,9 @@ AC_SUBST(LT_AGE)
# gdk-pixbuf gets versioned separately, and for now, using standard
# libtool versioning, not GTK+-style versioning
#
GDK_PIXBUF_MAJOR=0
GDK_PIXBUF_MINOR=8
GDK_PIXBUF_MICRO=0
GDK_PIXBUF_MAJOR=$GTK_MAJOR_VERSION
GDK_PIXBUF_MINOR=$GTK_MINOR_VERSION
GDK_PIXBUF_MICRO=$GTK_MICRO_VERSION
GDK_PIXBUF_VERSION="${GDK_PIXBUF_MAJOR}.${GDK_PIXBUF_MINOR}.${GDK_PIXBUF_MICRO}"
AC_SUBST(GDK_PIXBUF_MAJOR)
AC_SUBST(GDK_PIXBUF_MINOR)
@@ -226,10 +226,10 @@ AC_SUBST(STRIP_END)
# i18n stuff
ALL_LINGUAS="az ca cs da de el en_GB en@IPA es et eu fa fi fr ga gl he hr hu ia it ja ko lt nl nn no pl pt pt_BR ro ru sk sl sp sr sv tr uk vi wa zh_TW zh_CN"
AM_GTK_GNU_GETTEXT
AM_GLIB_GNU_GETTEXT
LIBS="$LIBS $INTLLIBS"
# AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
# AM_GLIB_GNU_GETTEXT above substs $DATADIRNAME
# this is the directory where the *.{mo,gmo} files are installed
gtklocaledir='${prefix}/${DATADIRNAME}/locale'
AC_SUBST(gtklocaledir)
@@ -564,8 +564,6 @@ AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
if $dynworks ; then
STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG"
else
STATIC_LIB_DEPS=
if echo "$included_loaders" | grep "\(^\|\,\)tiff\(\$\|\,\)" > /dev/null; then
STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBTIFF"
@@ -576,6 +574,8 @@ else
if echo "$included_loaders" | grep "\(^\|\,\)png\(\$\|\,\)" > /dev/null; then
STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBPNG"
fi
else
STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG"
fi
# Checks to see if we should compile in MMX support (there will be
@@ -619,11 +619,11 @@ fi
AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
GDK_PIXBUF_PACKAGES=gmodule-2.0
GDK_PIXBUF_PACKAGES="gmodule-2.0 gobject-2.0"
GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB"
GDK_PIXBUF_EXTRA_CFLAGS=
GDK_PIXBUF_DEP_LIBS="`pkg-config --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
GDK_PIXBUF_DEP_CFLAGS="`pkg-config --cflags $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
AC_SUBST(GDK_PIXBUF_PACKAGES)
AC_SUBST(GDK_PIXBUF_EXTRA_LIBS)
@@ -640,48 +640,54 @@ GDK_EXTRA_LIBS=$GDK_WLIBS
GDK_EXTRA_CFLAGS=
if test "x$gdktarget" = "xx11"; then
# Find the X11 include and library directories
AC_PATH_X
AC_PATH_XTRA
# We start off with the libraries from Pango
if test "x$x_includes" = "x"; then
x_includes="/usr/include"
## be sure we also have Pango built with xft support
if $PKG_CONFIG --exists pangoxft ; then
PANGO_PACKAGES="pangox pangoxft"
have_xft=true
AC_DEFINE(HAVE_XFT)
else
PANGO_PACKAGES="pangox"
have_xft=false
fi
AM_CONDITIONAL(HAVE_XFT, $have_xft)
CFLAGS="$CFLAGS $X_CFLAGS"
LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
x_libs="`$PKG_CONFIG --libs $PANGO_PACKAGES`"
x_cflags="`$PKG_CONFIG --cflags $PANGO_PACKAGES`"
x_extra_libs=
if test "x$no_x" = "xyes"; then
AC_MSG_ERROR([
*** X libraries or include files not found. Check 'config.log' for
*** more details.])
fi
# Checks for libraries.
# Check for the X11 library
AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
# Sanity check for the X11 library
AC_CHECK_LIB(X11, XOpenDisplay, :,
AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
$X_EXTRA_LIBS)
$x_libs)
if test "x$enable_shm" = "xyes"; then
# Check for the Xext library (needed for XShm extention)
AC_CHECK_LIB(Xext, XShmAttach,
x_libs="-lXext $x_libs",
AC_CHECK_LIB(Xext, XShmAttach,
if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
x_extra_libs="-lXext"
fi,
# On AIX, it is in XextSam instead, but we still need -lXext
AC_CHECK_LIB(XextSam, XShmAttach,
x_libs="-lXextSam -lXext $x_libs",
if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
x_extra_libs="-lXextSam -lXext"
else
x_extra_libs="-lXextSam"
fi
no_xext_lib=yes, $x_libs),
$x_libs)
fi
GDK_PIXBUF_XLIB_EXTRA_CFLAGS="$x_cflags"
GDK_PIXBUF_XLIB_EXTRA_LIBS="$x_ldflags $x_libs"
# Don't ever pull in the pangoxft libraries for gdk-pixbuf-x11
GDK_PIXBUF_XLIB_EXTRA_LIBS="$x_extra_libs `$PKG_CONFIG --libs pangox`"
# Check for shaped window extension
AC_CHECK_LIB(Xext, XShapeCombineMask,
if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
x_libs="-lXext $x_libs"
if test -z "`echo $x_extra_libs $x_libs | grep "\-lXext" 2> /dev/null`"; then
x_extra_libs="-lXext $x_extra_libs"
fi
AC_DEFINE(HAVE_SHAPE_EXT),
,
@@ -694,44 +700,6 @@ if test "x$gdktarget" = "xx11"; then
,
$x_libs)
#
# Checks for FreeType
#
FREETYPE_LIBS=
FREETYPE_CFLAGS=
have_freetype=false
AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
if test "x$FREETYPE_CONFIG" != "xno" ; then
FREETYPE_CFLAGS=`freetype-config --cflags`
FREETYPE_LIBS=`freetype-config --libs`
AC_CHECK_LIB(freetype, FT_New_Face, have_freetype=true
,:,$FREETYPE_LIBS)
fi
#
# Checks for Xft/XRender
#
have_xft=false
if test $have_freetype = true ; then
AC_CHECK_LIB(Xrender, XRenderFindFormat,
AC_CHECK_LIB(Xft, XftFontOpen, have_xft=true, :, -lXrender -lXext $X_LIBS $FREETYPE_LIBS)
,:,-lXext $X_LIBS)
## be sure we also have Pango built with xft support
if ! $PKG_CONFIG --exists pangoxft ; then
have_xft=false
AC_MSG_WARN([X render extension found, but Pango lacks Xft support])
fi
if $have_xft = 'true' ; then
X_LIBS="-lXft -lXrender -lXext $FREETYPE_LIBS $X_LIBS"
AC_DEFINE(HAVE_XFT)
fi
fi
AM_CONDITIONAL(HAVE_XFT, $have_xft)
# Check for XIM support.
AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
@@ -783,10 +751,10 @@ if test "x$gdktarget" = "xx11"; then
if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
AC_DEFINE(XINPUT_GXI)
xinput_progs=gxid
x_libs="-lXi $x_libs"
x_extra_libs="-lXi $x_extra_libs"
elif test "x$with_xinput" = "xxfree"; then
AC_DEFINE(XINPUT_XFREE)
x_libs="-lXi $x_libs"
x_extra_libs="-lXi $x_extra_libs"
else
AC_DEFINE(XINPUT_NONE)
fi
@@ -815,8 +783,8 @@ if test "x$gdktarget" = "xx11"; then
fi
fi
GDK_EXTRA_CFLAGS="$GDK_EXTRA_CFLAGS $x_cflags"
GDK_EXTRA_LIBS="$x_ldflags $x_libs $GDK_EXTRA_LIBS"
GDK_EXTRA_CFLAGS=
GDK_EXTRA_LIBS="$x_extra_libs"
# these are already defined above
#gdktargetlib = "libgdk-x11-1.3.la"
@@ -830,8 +798,8 @@ fi
AC_SUBST(xinput_progs)
GDK_PIXBUF_XLIB_PACKAGES=
GDK_PIXBUF_XLIB_DEP_LIBS="`pkg-config --libs $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_XLIB_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
GDK_PIXBUF_XLIB_DEP_CFLAGS="`pkg-config --cflags $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_PIXBUF_XLIB_EXTRA_CFLAGS"
GDK_PIXBUF_XLIB_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_XLIB_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
GDK_PIXBUF_XLIB_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_PIXBUF_XLIB_EXTRA_CFLAGS"
AC_SUBST(GDK_PIXBUF_XLIB_PACKAGES)
AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_LIBS)
@@ -917,14 +885,14 @@ CFLAGS="$CFLAGS $PANGO_CFLAGS"
AC_CHECK_LIB(pango, pango_context_new, :, AC_MSG_ERROR([
*** Can't link to Pango. Pango is required to build
*** GTK+. For more information see http://www.pango.org]), $PANGO_LIBS $x_ldflags $x_libs)
*** GTK+. For more information see http://www.pango.org]), $PANGO_LIBS)
CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags"
GDK_PACKAGES=$PANGO_PACKAGES
GDK_DEP_LIBS="`pkg-config --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
GDK_DEP_CFLAGS="`pkg-config --cflags $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS"
GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS"
AC_SUBST(GDK_PACKAGES)
AC_SUBST(GDK_EXTRA_LIBS)
@@ -959,8 +927,8 @@ AC_CHECK_LIB(atk, atk_object_get_type, : , AC_MSG_ERROR([
GTK_PACKAGES=atk
GTK_EXTRA_LIBS=
GTK_EXTRA_CFLAGS=
GTK_DEP_LIBS="`pkg-config --libs $GTK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
GTK_DEP_CFLAGS="`pkg-config --cflags $GTK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
GTK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GTK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags $GTK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
AC_SUBST(GTK_PACKAGES)
AC_SUBST(GTK_EXTRA_LIBS)

View File

@@ -1,3 +1,8 @@
2001-06-04 Havoc Pennington <hp@redhat.com>
* gdk-pixbuf-xlibrgb.c (xlib_rgb_init): remove C++ comment,
reported by Dan McNichol
Mon Jan 8 11:41:41 2001 Owen Taylor <otaylor@redhat.com>
* Makefile.am (INCLUDES): Add @x_cflags@ (#36310)

View File

@@ -730,7 +730,7 @@ xlib_rgb_set_gray_cmap (Colormap cmap)
void
xlib_rgb_init (Display *display, Screen *screen)
{
int prefDepth = -1; // let the function do the visual scoring
int prefDepth = -1; /* let the function do the visual scoring */
xlib_rgb_init_with_depth(display, screen, prefDepth);
}

View File

@@ -5,6 +5,7 @@ democodedir=$(datadir)/gtk-2.0/demo
## These should be in the order you want them to appear in the
## demo app, which means alphabetized by demo title, not filename
demos = @STRIP_BEGIN@ \
appwindow.c \
button_box.c \
colorsel.c \
dialog.c \
@@ -14,6 +15,8 @@ demos = @STRIP_BEGIN@ \
menus.c \
panes.c \
pixbufs.c \
sizegroup.c \
stock_browser.c \
textview.c \
@STRIP_END@

342
demos/gtk-demo/appwindow.c Normal file
View File

@@ -0,0 +1,342 @@
/* Application main window
*
* Demonstrates a typical application window, with menubar, toolbar, statusbar.
*/
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
static void
menuitem_cb (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (callback_data),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"You selected or toggled the menu item: \"%s\"",
gtk_item_factory_path_from_widget (widget));
/* Close dialog on user response */
g_signal_connectc (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy),
NULL,
FALSE);
gtk_widget_show (dialog);
}
static GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, menuitem_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", menuitem_cb, 0, "<StockItem>", GTK_STOCK_NEW },
{ "/File/_Open", "<control>O", menuitem_cb, 0, "<StockItem>", GTK_STOCK_OPEN },
{ "/File/_Save", "<control>S", menuitem_cb, 0, "<StockItem>", GTK_STOCK_SAVE },
{ "/File/Save _As...", NULL, menuitem_cb, 0, "<StockItem>", GTK_STOCK_SAVE },
{ "/File/sep1", NULL, menuitem_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", menuitem_cb, 0, "<StockItem>", GTK_STOCK_QUIT },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Color/_Red", NULL, menuitem_cb, 0, "<RadioItem>" },
{ "/_Preferences/Color/_Green", NULL, menuitem_cb, 0, "/Preferences/Color/Red" },
{ "/_Preferences/Color/_Blue", NULL, menuitem_cb, 0, "/Preferences/Color/Red" },
{ "/_Preferences/_Shape", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Shape/_Square", NULL, menuitem_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Rectangle", NULL, menuitem_cb, 0, "/Preferences/Shape/Square" },
{ "/_Preferences/Shape/_Oval", NULL, menuitem_cb, 0, "/Preferences/Shape/Rectangle" },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/Help/_About", NULL, menuitem_cb, 0 },
};
static void
toolbar_cb (GtkWidget *button,
gpointer data)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (data),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"You selected a toolbar button");
/* Close dialog on user response */
g_signal_connectc (G_OBJECT (dialog),
"response",
G_CALLBACK (gtk_widget_destroy),
NULL,
FALSE);
gtk_widget_show (dialog);
}
/* This function registers our custom toolbar icons, so they can be themed.
*
* It's totally optional to do this, you could just manually insert icons
* and have them not be themeable, especially if you never expect people
* to theme your app.
*/
static void
register_stock_icons (void)
{
static gboolean registered = FALSE;
if (!registered)
{
GdkPixbuf *pixbuf;
GtkIconFactory *factory;
static GtkStockItem items[] = {
{ "demo-gtk-logo",
"_GTK!",
0, 0, NULL }
};
registered = TRUE;
/* Register our stock items */
gtk_stock_add (items, G_N_ELEMENTS (items));
/* Add our custom icon factory to the list of defaults */
factory = gtk_icon_factory_new ();
gtk_icon_factory_add_default (factory);
/* Try current directory */
pixbuf = gdk_pixbuf_new_from_file ("./gtk-logo-rgb.gif", NULL);
/* Try install directory */
if (pixbuf == NULL)
pixbuf = gdk_pixbuf_new_from_file (DEMOCODEDIR"/gtk-logo-rgb.gif", NULL);
/* Register icon to accompany stock item */
if (pixbuf != NULL)
{
GtkIconSet *icon_set;
GdkPixbuf *transparent;
/* The gtk-logo-rgb icon has a white background, make it transparent */
transparent = gdk_pixbuf_add_alpha (pixbuf, TRUE, 0xff, 0xff, 0xff);
icon_set = gtk_icon_set_new_from_pixbuf (transparent);
gtk_icon_factory_add (factory, "demo-gtk-logo", icon_set);
gtk_icon_set_unref (icon_set);
g_object_unref (G_OBJECT (pixbuf));
g_object_unref (G_OBJECT (transparent));
}
else
g_warning ("failed to load GTK logo for toolbar");
/* Drop our reference to the factory, GTK will hold a reference. */
g_object_unref (G_OBJECT (factory));
}
}
static void
update_statusbar (GtkTextBuffer *buffer,
GtkStatusbar *statusbar)
{
gchar *msg;
gint row, col;
gint count;
GtkTextIter iter;
gtk_statusbar_pop (statusbar, 0); /* clear any previous message, underflow is allowed */
count = gtk_text_buffer_get_char_count (buffer);
gtk_text_buffer_get_iter_at_mark (buffer,
&iter,
gtk_text_buffer_get_insert (buffer));
row = gtk_text_iter_get_line (&iter);
col = gtk_text_iter_get_line_offset (&iter);
msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
row, col, count);
gtk_statusbar_push (statusbar, 0, msg);
g_free (msg);
}
static void
mark_set_callback (GtkTextBuffer *buffer,
const GtkTextIter *new_location,
GtkTextMark *mark,
gpointer data)
{
update_statusbar (buffer, GTK_STATUSBAR (data));
}
GtkWidget *
do_appwindow (void)
{
if (!window)
{
GtkWidget *table;
GtkWidget *toolbar;
GtkWidget *statusbar;
GtkWidget *contents;
GtkWidget *sw;
GtkTextBuffer *buffer;
GtkAccelGroup *accel_group;
GtkItemFactory *item_factory;
register_stock_icons ();
/* Create the toplevel window
*/
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Application Window");
/* NULL window variable when window is closed */
g_signal_connectc (G_OBJECT (window), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&window, TRUE);
table = gtk_table_new (1, 4, FALSE);
gtk_container_add (GTK_CONTAINER (window), table);
/* Create the menubar
*/
accel_group = gtk_accel_group_new ();
gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
gtk_accel_group_unref (accel_group);
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", accel_group);
/* Set up item factory to go away with the window */
gtk_object_ref (GTK_OBJECT (item_factory));
gtk_object_sink (GTK_OBJECT (item_factory));
g_object_set_data_full (G_OBJECT (window),
"<main>",
item_factory,
(GDestroyNotify) g_object_unref);
/* create menu items */
gtk_item_factory_create_items (item_factory, G_N_ELEMENTS (menu_items),
menu_items, window);
gtk_table_attach (GTK_TABLE (table),
gtk_item_factory_get_widget (item_factory, "<main>"),
/* X direction */ /* Y direction */
0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Create the toolbar
*/
toolbar = gtk_toolbar_new ();
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_OPEN,
"This is a demo button with an 'open' icon",
NULL,
G_CALLBACK (toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_QUIT,
"This is a demo button with a 'quit' icon",
NULL,
G_CALLBACK (toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
"demo-gtk-logo",
"This is a demo button with a 'gtk' icon",
NULL,
G_CALLBACK (toolbar_cb),
window, /* user data for callback */
-1); /* -1 means "append" */
gtk_table_attach (GTK_TABLE (table),
toolbar,
/* X direction */ /* Y direction */
0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Create document
*/
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
GTK_SHADOW_IN);
gtk_table_attach (GTK_TABLE (table),
sw,
/* X direction */ /* Y direction */
0, 1, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
0, 0);
gtk_window_set_default_size (GTK_WINDOW (window),
200, 200);
contents = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (sw),
contents);
/* Create statusbar */
statusbar = gtk_statusbar_new ();
gtk_table_attach (GTK_TABLE (table),
statusbar,
/* X direction */ /* Y direction */
0, 1, 3, 4,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Show text widget info in the statusbar */
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (contents));
g_signal_connectc (G_OBJECT (buffer),
"changed",
G_CALLBACK (update_statusbar),
statusbar, FALSE);
g_signal_connectc (G_OBJECT (buffer),
"mark_set", /* cursor moved */
G_CALLBACK (mark_set_callback),
statusbar, FALSE);
update_statusbar (buffer, GTK_STATUSBAR (statusbar));
}
if (!GTK_WIDGET_VISIBLE (window))
{
gtk_widget_show_all (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}

View File

@@ -7,7 +7,7 @@
static GtkWidget *
create_bbox (gint horizontal,
char* title,
char *title,
gint spacing,
gint layout)
{
@@ -28,10 +28,10 @@ create_bbox (gint horizontal,
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), layout);
gtk_box_set_spacing (GTK_BOX (bbox), spacing);
button = gtk_button_new_from_stock (GTK_STOCK_BUTTON_OK);
button = gtk_button_new_from_stock (GTK_STOCK_OK);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_from_stock (GTK_STOCK_BUTTON_CANCEL);
button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
gtk_container_add (GTK_CONTAINER (bbox), button);
button = gtk_button_new_from_stock (GTK_STOCK_HELP);
@@ -43,7 +43,7 @@ create_bbox (gint horizontal,
GtkWidget *
do_button_box (void)
{
static GtkWidget* window = NULL;
static GtkWidget *window = NULL;
GtkWidget *main_vbox;
GtkWidget *vbox;
GtkWidget *hbox;
@@ -72,19 +72,19 @@ do_button_box (void)
gtk_container_add (GTK_CONTAINER (frame_horz), vbox);
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD),
create_bbox (TRUE, "Spread", 40, GTK_BUTTONBOX_SPREAD),
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE),
create_bbox (TRUE, "Edge", 40, GTK_BUTTONBOX_EDGE),
TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START),
create_bbox (TRUE, "Start", 40, GTK_BUTTONBOX_START),
TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (vbox),
create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END),
create_bbox (TRUE, "End", 40, GTK_BUTTONBOX_END),
TRUE, TRUE, 5);
frame_vert = gtk_frame_new ("Vertical Button Boxes");
@@ -95,19 +95,19 @@ do_button_box (void)
gtk_container_add (GTK_CONTAINER (frame_vert), hbox);
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Spread", 30, GTK_BUTTONBOX_SPREAD),
create_bbox (FALSE, "Spread", 30, GTK_BUTTONBOX_SPREAD),
TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Edge", 30, GTK_BUTTONBOX_EDGE),
create_bbox (FALSE, "Edge", 30, GTK_BUTTONBOX_EDGE),
TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "Start", 30, GTK_BUTTONBOX_START),
create_bbox (FALSE, "Start", 30, GTK_BUTTONBOX_START),
TRUE, TRUE, 5);
gtk_box_pack_start (GTK_BOX (hbox),
create_bbox (FALSE, "End", 30, GTK_BUTTONBOX_END),
create_bbox (FALSE, "End", 30, GTK_BUTTONBOX_END),
TRUE, TRUE, 5);
}
@@ -116,11 +116,10 @@ do_button_box (void)
gtk_widget_show_all (window);
}
else
{
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}

View File

@@ -14,7 +14,7 @@ static GtkWidget *frame;
static void
change_color_callback (GtkWidget *button,
gpointer data)
gpointer data)
{
GtkWidget *dialog;
GtkColorSelection *colorsel;
@@ -35,7 +35,7 @@ change_color_callback (GtkWidget *button,
if (response == GTK_RESPONSE_OK)
{
gtk_color_selection_get_current_color (colorsel,
&color);
&color);
gtk_widget_modify_bg (da, GTK_STATE_NORMAL, &color);
}
@@ -92,8 +92,8 @@ do_colorsel (void)
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (change_color_callback),
NULL);
GTK_SIGNAL_FUNC (change_color_callback),
NULL);
}
if (!GTK_WIDGET_VISIBLE (window))

View File

@@ -10,7 +10,8 @@ static GtkWidget *entry1 = NULL;
static GtkWidget *entry2 = NULL;
static void
message_dialog_clicked (GtkButton *button, gpointer user_data)
message_dialog_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *dialog;
static gint i = 1;
@@ -28,7 +29,8 @@ message_dialog_clicked (GtkButton *button, gpointer user_data)
}
static void
interactive_dialog_clicked (GtkButton *button, gpointer user_data)
interactive_dialog_clicked (GtkButton *button,
gpointer user_data)
{
GtkWidget *dialog;
GtkWidget *hbox;
@@ -42,7 +44,7 @@ interactive_dialog_clicked (GtkButton *button, gpointer user_data)
dialog = gtk_dialog_new_with_buttons ("Interactive Dialog",
GTK_WINDOW (window),
GTK_DIALOG_MODAL| GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_BUTTON_OK,
GTK_STOCK_OK,
GTK_RESPONSE_OK,
NULL);
@@ -59,7 +61,7 @@ interactive_dialog_clicked (GtkButton *button, gpointer user_data)
gtk_box_pack_start (GTK_BOX (hbox), table, TRUE, TRUE, 0);
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_table_attach_defaults (GTK_TABLE (table),
label,
label,
0, 1, 0, 1);
local_entry1 = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (local_entry1), gtk_entry_get_text (GTK_ENTRY (entry1)));
@@ -68,7 +70,7 @@ interactive_dialog_clicked (GtkButton *button, gpointer user_data)
label = gtk_label_new_with_mnemonic ("E_ntry 2");
gtk_table_attach_defaults (GTK_TABLE (table),
label,
label,
0, 1, 1, 2);
local_entry2 = gtk_entry_new ();
@@ -142,8 +144,8 @@ do_dialog (void)
label = gtk_label_new_with_mnemonic ("_Entry 1");
gtk_table_attach_defaults (GTK_TABLE (table),
label,
0, 1, 0, 1);
label,
0, 1, 0, 1);
entry1 = gtk_entry_new ();
gtk_table_attach_defaults (GTK_TABLE (table), entry1, 1, 2, 0, 1);
@@ -152,8 +154,8 @@ do_dialog (void)
label = gtk_label_new_with_mnemonic ("E_ntry 2");
gtk_table_attach_defaults (GTK_TABLE (table),
label,
0, 1, 1, 2);
label,
0, 1, 1, 2);
entry2 = gtk_entry_new ();
gtk_table_attach_defaults (GTK_TABLE (table), entry2, 1, 2, 1, 2);
@@ -165,7 +167,7 @@ do_dialog (void)
gtk_widget_show_all (window);
}
else
{
{
gtk_widget_destroy (window);
window = NULL;
}

View File

@@ -21,17 +21,17 @@ static GdkPixmap *pixmap = NULL;
/* Create a new pixmap of the appropriate size to store our scribbles */
static gboolean
scribble_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
gpointer data)
scribble_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
gpointer data)
{
if (pixmap)
g_object_unref (G_OBJECT (pixmap));
pixmap = gdk_pixmap_new (widget->window,
widget->allocation.width,
widget->allocation.height,
-1);
widget->allocation.width,
widget->allocation.height,
-1);
/* Initialize the pixmap to white */
gdk_draw_rectangle (pixmap,
@@ -48,8 +48,8 @@ scribble_configure_event (GtkWidget *widget,
/* Redraw the screen from the pixmap */
static gboolean
scribble_expose_event (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)
GdkEventExpose *event,
gpointer data)
{
/* We use the "foreground GC" for the widget since it already exists,
* but honestly any GC would work. The only thing to worry about
@@ -57,12 +57,12 @@ scribble_expose_event (GtkWidget *widget,
*/
gdk_draw_drawable (widget->window,
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
pixmap,
/* Only copy the area that was exposed. */
event->area.x, event->area.y,
event->area.x, event->area.y,
event->area.width, event->area.height);
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
pixmap,
/* Only copy the area that was exposed. */
event->area.x, event->area.y,
event->area.x, event->area.y,
event->area.width, event->area.height);
return FALSE;
}
@@ -70,8 +70,8 @@ scribble_expose_event (GtkWidget *widget,
/* Draw a rectangle on the screen */
static void
draw_brush (GtkWidget *widget,
gdouble x,
gdouble y)
gdouble x,
gdouble y)
{
GdkRectangle update_rect;
@@ -89,14 +89,14 @@ draw_brush (GtkWidget *widget,
/* Now invalidate the affected region of the drawing area. */
gdk_window_invalidate_rect (widget->window,
&update_rect,
FALSE);
&update_rect,
FALSE);
}
static gboolean
scribble_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
scribble_button_press_event (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
{
if (pixmap == NULL)
return FALSE; /* paranoia check, in case we haven't gotten a configure event */
@@ -109,9 +109,9 @@ scribble_button_press_event (GtkWidget *widget,
}
static gboolean
scribble_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event,
gpointer data)
scribble_motion_notify_event (GtkWidget *widget,
GdkEventMotion *event,
gpointer data)
{
int x, y;
GdkModifierType state;
@@ -141,9 +141,9 @@ scribble_motion_notify_event (GtkWidget *widget,
static gboolean
checkerboard_expose (GtkWidget *da,
GdkEventExpose *event,
gpointer data)
checkerboard_expose (GtkWidget *da,
GdkEventExpose *event,
gpointer data)
{
gint i, j, xcount, ycount;
GdkGC *gc1, *gc2;
@@ -182,28 +182,28 @@ checkerboard_expose (GtkWidget *da,
j = SPACING;
ycount = xcount % 2; /* start with even/odd depending on row */
while (j < da->allocation.height)
{
GdkGC *gc;
if (ycount % 2)
gc = gc1;
else
gc = gc2;
{
GdkGC *gc;
if (ycount % 2)
gc = gc1;
else
gc = gc2;
/* If we're outside event->area, this will do nothing.
* It might be mildly more efficient if we handled
* the clipping ourselves, but again we're feeling lazy.
*/
gdk_draw_rectangle (da->window,
gc,
TRUE,
i, j,
CHECK_SIZE,
CHECK_SIZE);
/* If we're outside event->area, this will do nothing.
* It might be mildly more efficient if we handled
* the clipping ourselves, but again we're feeling lazy.
*/
gdk_draw_rectangle (da->window,
gc,
TRUE,
i, j,
CHECK_SIZE,
CHECK_SIZE);
j += CHECK_SIZE + SPACING;
++ycount;
}
j += CHECK_SIZE + SPACING;
++ycount;
}
i += CHECK_SIZE + SPACING;
++xcount;
@@ -245,7 +245,7 @@ do_drawingarea (void)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Checkerboard pattern</u>");
"<u>Checkerboard pattern</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
@@ -259,9 +259,9 @@ do_drawingarea (void)
gtk_container_add (GTK_CONTAINER (frame), da);
gtk_signal_connect (GTK_OBJECT (da),
"expose_event",
GTK_SIGNAL_FUNC (checkerboard_expose),
NULL);
"expose_event",
GTK_SIGNAL_FUNC (checkerboard_expose),
NULL);
/*
* Create the scribble area
@@ -269,7 +269,7 @@ do_drawingarea (void)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Scribble area</u>");
"<u>Scribble area</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
@@ -285,26 +285,26 @@ do_drawingarea (void)
/* Signals used to handle backing pixmap */
gtk_signal_connect (GTK_OBJECT (da), "expose_event",
GTK_SIGNAL_FUNC (scribble_expose_event), NULL);
GTK_SIGNAL_FUNC (scribble_expose_event), NULL);
gtk_signal_connect (GTK_OBJECT (da),"configure_event",
GTK_SIGNAL_FUNC (scribble_configure_event), NULL);
GTK_SIGNAL_FUNC (scribble_configure_event), NULL);
/* Event signals */
gtk_signal_connect (GTK_OBJECT (da), "motion_notify_event",
GTK_SIGNAL_FUNC (scribble_motion_notify_event), NULL);
GTK_SIGNAL_FUNC (scribble_motion_notify_event), NULL);
gtk_signal_connect (GTK_OBJECT (da), "button_press_event",
GTK_SIGNAL_FUNC (scribble_button_press_event), NULL);
GTK_SIGNAL_FUNC (scribble_button_press_event), NULL);
/* Ask to receive events the drawing area doesn't normally
* subscribe to
*/
gtk_widget_set_events (da, gtk_widget_get_events (da)
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -22,10 +22,11 @@ static guint load_timeout = 0;
static FILE* image_stream = NULL;
static void
progressive_prepared_callback (GdkPixbufLoader* loader, gpointer data)
progressive_prepared_callback (GdkPixbufLoader *loader,
gpointer data)
{
GdkPixbuf* pixbuf;
GtkWidget* image;
GdkPixbuf *pixbuf;
GtkWidget *image;
image = GTK_WIDGET (data);
@@ -39,12 +40,14 @@ progressive_prepared_callback (GdkPixbufLoader* loader, gpointer data)
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
}
static void
progressive_updated_callback (GdkPixbufLoader* loader,
gint x, gint y, gint width, gint height,
gpointer data)
static void progressive_updated_callback (GdkPixbufLoader *loader,
gint x,
gint y,
gint width,
gint height,
gpointer data)
{
GtkWidget* image;
GtkWidget *image;
image = GTK_WIDGET (data);
@@ -80,158 +83,158 @@ progressive_timeout (gpointer data)
bytes_read = fread (buf, 1, 256, image_stream);
if (ferror (image_stream))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failure reading image file 'alphatest.png': %s",
g_strerror (errno));
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failure reading image file 'alphatest.png': %s",
g_strerror (errno));
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
fclose (image_stream);
image_stream = NULL;
fclose (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
}
return FALSE; /* uninstall the timeout */
}
if (!gdk_pixbuf_loader_write (pixbuf_loader,
buf, bytes_read,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
buf, bytes_read,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
fclose (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
fclose (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
load_timeout = 0;
return FALSE; /* uninstall the timeout */
}
return FALSE; /* uninstall the timeout */
}
if (feof (image_stream))
{
fclose (image_stream);
image_stream = NULL;
{
fclose (image_stream);
image_stream = NULL;
/* Errors can happen on close, e.g. if the image
* file was truncated we'll know on close that
* it was incomplete.
*/
error = NULL;
if (!gdk_pixbuf_loader_close (pixbuf_loader,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
/* Errors can happen on close, e.g. if the image
* file was truncated we'll know on close that
* it was incomplete.
*/
error = NULL;
if (!gdk_pixbuf_loader_close (pixbuf_loader,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
g_object_unref (G_OBJECT (pixbuf_loader));
pixbuf_loader = NULL;
load_timeout = 0;
return FALSE; /* uninstall the timeout */
}
g_object_unref (G_OBJECT (pixbuf_loader));
pixbuf_loader = NULL;
}
g_object_unref (G_OBJECT (pixbuf_loader));
pixbuf_loader = NULL;
load_timeout = 0;
return FALSE; /* uninstall the timeout */
}
g_object_unref (G_OBJECT (pixbuf_loader));
pixbuf_loader = NULL;
}
}
else
{
const gchar *filename;
if (g_file_test ("./alphatest.png", G_FILE_TEST_EXISTS))
filename = "./alphatest.png";
filename = "./alphatest.png";
else
filename = DEMOCODEDIR"/alphatest.png";
filename = DEMOCODEDIR"/alphatest.png";
image_stream = fopen (filename, "r");
if (image_stream == NULL)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Unable to open image file 'alphatest.png': %s",
g_strerror (errno));
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Unable to open image file 'alphatest.png': %s",
g_strerror (errno));
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
load_timeout = 0;
load_timeout = 0;
return FALSE; /* uninstall the timeout */
}
return FALSE; /* uninstall the timeout */
}
if (pixbuf_loader)
{
gdk_pixbuf_loader_close (pixbuf_loader, NULL);
g_object_unref (G_OBJECT (pixbuf_loader));
pixbuf_loader = NULL;
}
{
gdk_pixbuf_loader_close (pixbuf_loader, NULL);
g_object_unref (G_OBJECT (pixbuf_loader));
pixbuf_loader = NULL;
}
pixbuf_loader = gdk_pixbuf_loader_new ();
g_signal_connect_data (G_OBJECT (pixbuf_loader),
"area_prepared",
G_CALLBACK (progressive_prepared_callback),
image,
NULL, FALSE, FALSE);
"area_prepared",
G_CALLBACK (progressive_prepared_callback),
image,
NULL, FALSE, FALSE);
g_signal_connect_data (G_OBJECT (pixbuf_loader),
"area_updated",
G_CALLBACK (progressive_updated_callback),
image,
NULL, FALSE, FALSE);
"area_updated",
G_CALLBACK (progressive_updated_callback),
image,
NULL, FALSE, FALSE);
}
/* leave timeout installed */
@@ -249,13 +252,13 @@ start_progressive_loading (GtkWidget *image)
* pauses in the reading process.
*/
load_timeout = g_timeout_add (150,
progressive_timeout,
image);
progressive_timeout,
image);
}
static void
cleanup_callback (GtkObject *object,
gpointer data)
gpointer data)
{
if (load_timeout)
{
@@ -300,7 +303,7 @@ do_images (void)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Image loaded from a file</u>");
"<u>Image loaded from a file</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
@@ -316,48 +319,48 @@ do_images (void)
* so you can run gtk-demo without installing GTK
*/
if (g_file_test ("./gtk-logo-rgb.gif", G_FILE_TEST_EXISTS))
{
/* This code shows off error handling. You can just use
* gtk_image_new_from_file() instead if you don't want to report
* errors to the user. If the file doesn't load when using
* gtk_image_new_from_file(), a "missing image" icon will
* be displayed instead.
*/
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_file ("./gtk-logo-rgb.gif",
&error);
if (error)
{
GtkWidget *dialog;
{
/* This code shows off error handling. You can just use
* gtk_image_new_from_file() instead if you don't want to report
* errors to the user. If the file doesn't load when using
* gtk_image_new_from_file(), a "missing image" icon will
* be displayed instead.
*/
GdkPixbuf *pixbuf;
GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_file ("./gtk-logo-rgb.gif",
&error);
if (error)
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Unable to open image file 'gtk-logo-rgb.gif': %s",
error->message);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
}
image = gtk_image_new_from_pixbuf (pixbuf);
}
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Unable to open image file 'gtk-logo-rgb.gif': %s",
error->message);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
}
image = gtk_image_new_from_pixbuf (pixbuf);
}
else
{
/* This is the simpler code, with no error handling.
* Here we're loading the installed gtk-logo-rgb.gif instead
* of the one in the current directory.
*/
image = gtk_image_new_from_file (DEMOCODEDIR"/gtk-logo-rgb.gif");
}
{
/* This is the simpler code, with no error handling.
* Here we're loading the installed gtk-logo-rgb.gif instead
* of the one in the current directory.
*/
image = gtk_image_new_from_file (DEMOCODEDIR"/gtk-logo-rgb.gif");
}
gtk_container_add (GTK_CONTAINER (frame), image);
@@ -366,7 +369,7 @@ do_images (void)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Animation loaded from a file</u>");
"<u>Animation loaded from a file</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);
@@ -382,9 +385,9 @@ do_images (void)
* so you can run gtk-demo without installing GTK
*/
if (g_file_test ("./floppybuddy.gif", G_FILE_TEST_EXISTS))
image = gtk_image_new_from_file ("./floppybuddy.gif");
image = gtk_image_new_from_file ("./floppybuddy.gif");
else
image = gtk_image_new_from_file (DEMOCODEDIR"/floppybuddy.gif");
image = gtk_image_new_from_file (DEMOCODEDIR"/floppybuddy.gif");
gtk_container_add (GTK_CONTAINER (frame), image);
@@ -394,7 +397,7 @@ do_images (void)
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label),
"<u>Progressive image loading</u>");
"<u>Progressive image loading</u>");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
frame = gtk_frame_new (NULL);

View File

@@ -7,36 +7,37 @@
#include <gtk/gtk.h>
static void
gtk_ifactory_cb (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
gtk_ifactory_cb (gpointer callback_data,
guint callback_action,
GtkWidget *widget)
{
g_message ("ItemFactory: activated \"%s\"", gtk_item_factory_path_from_widget (widget));
g_message ("ItemFactory: activated \"%s\"",
gtk_item_factory_path_from_widget (widget));
}
static GtkItemFactoryEntry menu_items[] =
{
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_File", NULL, 0, 0, "<Branch>" },
{ "/File/tearoff1", NULL, gtk_ifactory_cb, 0, "<Tearoff>" },
{ "/File/_New", "<control>N", gtk_ifactory_cb, 0 },
{ "/File/_Open", "<control>O", gtk_ifactory_cb, 0 },
{ "/File/_Save", "<control>S", gtk_ifactory_cb, 0 },
{ "/File/Save _As...", NULL, gtk_ifactory_cb, 0 },
{ "/File/sep1", NULL, gtk_ifactory_cb, 0, "<Separator>" },
{ "/File/_Quit", "<control>Q", gtk_ifactory_cb, 0 },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Color/_Red", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Color/_Green", NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },
{ "/_Preferences/Color/_Blue", NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },
{ "/_Preferences/_Shape", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
{ "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
{ "/_Preferences", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/_Color", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Color/_Red", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Color/_Green", NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },
{ "/_Preferences/Color/_Blue", NULL, gtk_ifactory_cb, 0, "/Preferences/Color/Red" },
{ "/_Preferences/_Shape", NULL, 0, 0, "<Branch>" },
{ "/_Preferences/Shape/_Square", NULL, gtk_ifactory_cb, 0, "<RadioItem>" },
{ "/_Preferences/Shape/_Rectangle", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Square" },
{ "/_Preferences/Shape/_Oval", NULL, gtk_ifactory_cb, 0, "/Preferences/Shape/Rectangle" },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/Help/_About", NULL, gtk_ifactory_cb, 0 },
{ "/_Help", NULL, 0, 0, "<LastBranch>" },
{ "/Help/_About", NULL, gtk_ifactory_cb, 0 },
};
static int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
@@ -78,9 +79,10 @@ do_item_factory (void)
/* preselect /Preferences/Shape/Oval over the other radios
*/
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_item_factory_get_item (item_factory,
"/Preferences/Shape/Oval")),
TRUE);
gtk_check_menu_item_set_active
(GTK_CHECK_MENU_ITEM (gtk_item_factory_get_item (item_factory,
"/Preferences/Shape/Oval")),
TRUE);
box1 = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), box1);

View File

@@ -1,5 +1,6 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -93,6 +94,271 @@ read_line (FILE *stream, GString *str)
return n_read > 0;
}
/* Stupid syntax highlighting.
*
* No regex was used in the making of this highlighting.
* It should only work for simple cases. This is good, as
* that's all we should have in the demos.
*/
/* This code should not be used elsewhere, except perhaps as an example of how
* to iterate through a text buffer.
*/
enum {
STATE_NORMAL,
STATE_IN_COMMENT,
};
static gchar *tokens[] =
{
"/*",
"\"",
NULL
};
static gchar *types[] =
{
"static",
"const ",
"void",
"gint",
"int ",
"char ",
"gchar ",
"gfloat",
"float",
"gint8",
"gint16",
"gint32",
"guint",
"guint8",
"guint16",
"guint32",
"guchar",
"glong",
"gboolean" ,
"gshort",
"gushort",
"gulong",
"gdouble",
"gldouble",
"gpointer",
"NULL",
"GList",
"GSList",
"FALSE",
"TRUE",
"FILE ",
"GtkObject ",
"GtkColorSelection ",
"GtkWidget ",
"GtkButton ",
"GdkColor ",
"GdkRectangle ",
"GdkEventExpose ",
"GdkGC ",
"GdkPixbufLoader ",
"GdkPixbuf ",
"GError",
"size_t",
NULL
};
static gchar *control[] =
{
" if ",
" while ",
" else",
" do ",
" for ",
"?",
":",
"return ",
"goto ",
NULL
};
void
parse_chars (gchar *text,
gchar **end_ptr,
gint *state,
gchar **tag,
gboolean start)
{
gint i;
gchar *next_token;
/* Handle comments first */
if (*state == STATE_IN_COMMENT)
{
*end_ptr = strstr (text, "*/");
if (*end_ptr)
{
*end_ptr += 2;
*state = STATE_NORMAL;
*tag = "comment";
}
return;
}
*tag = NULL;
*end_ptr = NULL;
/* check for comment */
if (!strncmp (text, "/*", 2))
{
*end_ptr = strstr (text, "*/");
if (*end_ptr)
*end_ptr += 2;
else
*state = STATE_IN_COMMENT;
*tag = "comment";
return;
}
/* check for preprocessor defines */
if (*text == '#' && start)
{
*end_ptr = NULL;
*tag = "preprocessor";
return;
}
/* functions */
if (start && * text != '\t' && *text != ' ' && *text != '{' && *text != '}')
{
if (strstr (text, "("))
{
*end_ptr = strstr (text, "(");
*tag = "function";
return;
}
}
/* check for types */
for (i = 0; types[i] != NULL; i++)
if (!strncmp (text, types[i], strlen (types[i])))
{
*end_ptr = text + strlen (types[i]);
*tag = "type";
return;
}
/* check for control */
for (i = 0; control[i] != NULL; i++)
if (!strncmp (text, control[i], strlen (control[i])))
{
*end_ptr = text + strlen (control[i]);
*tag = "control";
return;
}
/* check for string */
if (text[0] == '"')
{
gint maybe_escape = FALSE;
*end_ptr = text + 1;
*tag = "string";
while (**end_ptr != '\000')
{
if (**end_ptr == '\"' && !maybe_escape)
{
*end_ptr += 1;
return;
}
if (**end_ptr == '\\')
maybe_escape = TRUE;
else
maybe_escape = FALSE;
*end_ptr += 1;
}
return;
}
/* not at the start of a tag. Find the next one. */
for (i = 0; tokens[i] != NULL; i++)
{
next_token = strstr (text, tokens[i]);
if (next_token)
{
if (*end_ptr)
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
else
*end_ptr = next_token;
}
}
for (i = 0; types[i] != NULL; i++)
{
next_token = strstr (text, types[i]);
if (next_token)
{
if (*end_ptr)
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
else
*end_ptr = next_token;
}
}
for (i = 0; control[i] != NULL; i++)
{
next_token = strstr (text, control[i]);
if (next_token)
{
if (*end_ptr)
*end_ptr = (*end_ptr<next_token)?*end_ptr:next_token;
else
*end_ptr = next_token;
}
}
}
/* While not as cool as c-mode, this will do as a quick attempt at highlighting */
static void
fontify ()
{
GtkTextIter start_iter, next_iter, tmp_iter;
gint state;
gchar *text;
gchar *start_ptr, *end_ptr;
gchar *tag;
state = STATE_NORMAL;
gtk_text_buffer_get_iter_at_offset (source_buffer, &start_iter, 0);
next_iter = start_iter;
while (gtk_text_iter_forward_line (&next_iter))
{
gboolean start = TRUE;
start_ptr = text = gtk_text_iter_get_text (&start_iter, &next_iter);
do
{
parse_chars (start_ptr, &end_ptr, &state, &tag, start);
start = FALSE;
if (end_ptr)
{
tmp_iter = start_iter;
gtk_text_iter_forward_chars (&tmp_iter, end_ptr - start_ptr);
}
else
{
tmp_iter = next_iter;
}
if (tag)
gtk_text_buffer_apply_tag_by_name (info_buffer, tag, &start_iter, &tmp_iter);
start_iter = tmp_iter;
start_ptr = end_ptr;
}
while (end_ptr);
g_free (text);
start_iter = next_iter;
}
}
void
load_file (const gchar *filename)
{
@@ -230,8 +496,7 @@ load_file (const gchar *filename)
}
}
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
gtk_text_buffer_apply_tag_by_name (info_buffer, "source", &start, &end);
fontify ();
g_string_free (buffer, TRUE);
}
@@ -282,7 +547,7 @@ button_press_event_cb (GtkTreeView *tree_view,
gtk_signal_connect (GTK_OBJECT (window),
"destroy",
window_closed_cb,
GTK_SIGNAL_FUNC (window_closed_cb),
cbdata);
}
else
@@ -334,7 +599,7 @@ row_activated_cb (GtkTreeView *tree_view,
gtk_signal_connect (GTK_OBJECT (window),
"destroy",
window_closed_cb,
GTK_SIGNAL_FUNC (window_closed_cb),
cbdata);
}
}
@@ -381,7 +646,7 @@ create_text (GtkTextBuffer **buffer,
if (is_source)
{
font_desc = pango_font_description_from_string ("Courier 10");
font_desc = pango_font_description_from_string ("Courier 12");
gtk_widget_modify_font (text_view, font_desc);
pango_font_description_free (font_desc);
@@ -450,7 +715,7 @@ create_tree (void)
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
GTK_TREE_VIEW_COLUMN (column));
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", GTK_SIGNAL_FUNC (selection_cb), model);
gtk_signal_connect (GTK_OBJECT (tree_view), "row_activated", GTK_SIGNAL_FUNC (row_activated_cb), model);
return tree_view;
@@ -505,10 +770,26 @@ main (int argc, char **argv)
"font", "Sans 18",
NULL);
tag = gtk_text_buffer_create_tag (info_buffer, "source",
"font", "Courier 10",
"pixels_above_lines", 0,
"pixels_below_lines", 0,
tag = gtk_text_buffer_create_tag (info_buffer, "comment",
"foreground", "blue",
NULL);
tag = gtk_text_buffer_create_tag (info_buffer, "type",
"foreground", "red",
NULL);
tag = gtk_text_buffer_create_tag (info_buffer, "string",
"foreground", "SpringGreen3",
"weight", PANGO_WEIGHT_BOLD,
NULL);
tag = gtk_text_buffer_create_tag (info_buffer, "control",
"foreground", "purple",
NULL);
tag = gtk_text_buffer_create_tag (info_buffer, "preprocessor",
"style", PANGO_STYLE_OBLIQUE,
"foreground", "burlywood4",
NULL);
tag = gtk_text_buffer_create_tag (info_buffer, "function",
"weight", PANGO_WEIGHT_BOLD,
"foreground", "DarkGoldenrod4",
NULL);
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);

View File

@@ -28,13 +28,14 @@
*
*/
#include <stdio.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
static GtkWidget*
create_menu (gint depth, gboolean tearoff)
#include <stdio.h>
static GtkWidget *
create_menu (gint depth,
gboolean tearoff)
{
GtkWidget *menu;
GtkWidget *menuitem;
@@ -215,4 +216,3 @@ do_menus (void)
return window;
}

View File

@@ -14,7 +14,8 @@
#include <gtk/gtk.h>
void
toggle_resize (GtkWidget *widget, GtkWidget *child)
toggle_resize (GtkWidget *widget,
GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
@@ -33,7 +34,8 @@ toggle_resize (GtkWidget *widget, GtkWidget *child)
}
void
toggle_shrink (GtkWidget *widget, GtkWidget *child)
toggle_shrink (GtkWidget *widget,
GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
@@ -52,7 +54,7 @@ toggle_shrink (GtkWidget *widget, GtkWidget *child)
}
GtkWidget *
create_pane_options (GtkPaned *paned,
create_pane_options (GtkPaned *paned,
const gchar *frame_label,
const gchar *label1,
const gchar *label2)

View File

@@ -9,7 +9,7 @@
* off how to use GtkDrawingArea to do a simple animation.
*
* Look at the Image demo for additional pixbuf usage examples.
*
*
*/
#include <config.h>
@@ -17,8 +17,6 @@
#include <gtk/gtk.h>
#include <math.h>
#define FRAME_DELAY 50
#define RELATIVE_BACKGROUND_NAME "background.jpg"
@@ -49,14 +47,14 @@ static const char *installed_image_names[] = {
#define N_IMAGES G_N_ELEMENTS (relative_image_names)
/* demo window */
static GtkWindow *window = NULL;
static GtkWidget *window = NULL;
/* Current frame */
static GdkPixbuf *frame;
/* Background image */
static GdkPixbuf *background;
static int back_width, back_height;
static gint back_width, back_height;
/* Images */
static GdkPixbuf *images[N_IMAGES];
@@ -64,18 +62,16 @@ static GdkPixbuf *images[N_IMAGES];
/* Widgets */
static GtkWidget *da;
/* Loads the images for the demo and returns whether the operation succeeded */
static gboolean
load_pixbufs (GError **error)
{
int i;
const char **image_names;
gint i;
const gchar **image_names;
if (background)
return TRUE; /* already loaded earlier */
background = gdk_pixbuf_new_from_file (RELATIVE_BACKGROUND_NAME, NULL);
if (!background)
@@ -83,7 +79,7 @@ load_pixbufs (GError **error)
if (!background)
return FALSE; /* note that "error" was filled in and returned */
back_width = gdk_pixbuf_get_width (background);
back_height = gdk_pixbuf_get_height (background);
@@ -91,12 +87,12 @@ load_pixbufs (GError **error)
image_names = relative_image_names;
else
image_names = installed_image_names;
for (i = 0; i < N_IMAGES; i++)
{
images[i] = gdk_pixbuf_new_from_file (image_names[i], error);
if (!images[i])
return FALSE; /* Note that "error" was filled with a GError */
return FALSE; /* Note that "error" was filled with a GError */
}
return TRUE;
@@ -104,7 +100,9 @@ load_pixbufs (GError **error)
/* Expose callback for the drawing area */
static gint
expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
expose_cb (GtkWidget *widget,
GdkEventExpose *event,
gpointer data)
{
guchar *pixels;
int rowstride;
@@ -112,14 +110,14 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
rowstride = gdk_pixbuf_get_rowstride (frame);
pixels = gdk_pixbuf_get_pixels (frame) + rowstride * event->area.y + event->area.x * 3;
gdk_draw_rgb_image_dithalign (widget->window,
widget->style->black_gc,
event->area.x, event->area.y,
event->area.width, event->area.height,
GDK_RGB_DITHER_NORMAL,
pixels, rowstride,
event->area.x, event->area.y);
widget->style->black_gc,
event->area.x, event->area.y,
event->area.width, event->area.height,
GDK_RGB_DITHER_NORMAL,
pixels, rowstride,
event->area.x, event->area.y);
return TRUE;
}
@@ -138,7 +136,7 @@ timeout (gpointer data)
double radius;
gdk_pixbuf_copy_area (background, 0, 0, back_width, back_height,
frame, 0, 0);
frame, 0, 0);
f = (double) (frame_num % CYCLE_LEN) / CYCLE_LEN;
@@ -181,16 +179,16 @@ timeout (gpointer data)
r2.height = back_height;
if (gdk_rectangle_intersect (&r1, &r2, &dest))
gdk_pixbuf_composite (images[i],
frame,
dest.x, dest.y,
dest.width, dest.height,
xpos, ypos,
k, k,
GDK_INTERP_NEAREST,
((i & 1)
? MAX (127, fabs (255 * sin (f * 2.0 * M_PI)))
: MAX (127, fabs (255 * cos (f * 2.0 * M_PI)))));
gdk_pixbuf_composite (images[i],
frame,
dest.x, dest.y,
dest.width, dest.height,
xpos, ypos,
k, k,
GDK_INTERP_NEAREST,
((i & 1)
? MAX (127, fabs (255 * sin (f * 2.0 * M_PI)))
: MAX (127, fabs (255 * cos (f * 2.0 * M_PI)))));
}
gtk_widget_queue_draw (da);
@@ -203,7 +201,7 @@ static guint timeout_id;
static void
cleanup_callback (GtkObject *object,
gpointer data)
gpointer data)
{
g_source_remove (timeout_id);
timeout_id = 0;
@@ -216,53 +214,53 @@ do_pixbufs (void)
{
GError *error;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");
gtk_window_set_resizeable (GTK_WINDOW (window), FALSE);
gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (cleanup_callback), NULL);
error = NULL;
if (!load_pixbufs (&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load an image: %s",
error->message);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
}
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load an image: %s",
error->message);
g_error_free (error);
gtk_signal_connect (GTK_OBJECT (dialog),
"response",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
}
else
{
gtk_widget_set_usize (window, back_width, back_height);
frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
da = gtk_drawing_area_new ();
gtk_signal_connect (GTK_OBJECT (da), "expose_event",
GTK_SIGNAL_FUNC (expose_cb), NULL);
gtk_container_add (GTK_CONTAINER (window), da);
timeout_id = gtk_timeout_add (FRAME_DELAY, timeout, NULL);
}
{
gtk_widget_set_usize (window, back_width, back_height);
frame = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, back_width, back_height);
da = gtk_drawing_area_new ();
gtk_signal_connect (GTK_OBJECT (da), "expose_event",
GTK_SIGNAL_FUNC (expose_cb), NULL);
gtk_container_add (GTK_CONTAINER (window), da);
timeout_id = gtk_timeout_add (FRAME_DELAY, timeout, NULL);
}
}
if (!GTK_WIDGET_VISIBLE (window))
{
gtk_widget_show_all (window);

172
demos/gtk-demo/sizegroup.c Normal file
View File

@@ -0,0 +1,172 @@
/* Size Groups
*
* GtkSizeGroup provides a mechanism for grouping a number of
* widgets together so they all request the same amount of space.
* This is typically useful when you want a column of widgets to
* have the same size, but you can't use a GtkTable widget.
*
* Note that size groups only affect the amount of space requested,
* not the size that the widgets finally receive. If you want the
* widgets in a GtkSizeGroup to actually be the same size, you need
* to pack them in such a way that they get the size they request
* and not more. For example, if you are packing your widgets
* into a table, you would not include the GTK_FILL flag.
*/
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
/* Convenience function to create an option menu holding a number of strings
*/
GtkWidget *
create_option_menu (const char **strings)
{
GtkWidget *menu;
GtkWidget *option_menu;
const char **str;
menu = gtk_menu_new ();
for (str = strings; *str; str++)
{
GtkWidget *menu_item = gtk_menu_item_new_with_label (*str);
gtk_widget_show (menu_item);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
}
option_menu = gtk_option_menu_new ();
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
return option_menu;
}
static void
add_row (GtkTable *table,
int row,
GtkSizeGroup *size_group,
const char *label_text,
const char **options)
{
GtkWidget *option_menu;
GtkWidget *label;
label = gtk_label_new (label_text);
gtk_misc_set_alignment (GTK_MISC (label), 0, 1);
gtk_table_attach (GTK_TABLE (table), label,
0, 1, row, row + 1,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
option_menu = create_option_menu (options);
gtk_size_group_add_widget (size_group, option_menu);
gtk_table_attach (GTK_TABLE (table), option_menu,
1, 2, row, row + 1,
0, 0,
0, 0);
}
static void
toggle_grouping (GtkToggleButton *check_button,
GtkSizeGroup *size_group)
{
GtkSizeGroupMode new_mode;
/* GTK_SIZE_GROUP_NONE is not generally useful, but is useful
* here to show the effect of GTK_SIZE_GROUP_HORIZONTAL by
* contrast.
*/
if (gtk_toggle_button_get_active (check_button))
new_mode = GTK_SIZE_GROUP_HORIZONTAL;
else
new_mode = GTK_SIZE_GROUP_NONE;
gtk_size_group_set_mode (size_group, new_mode);
}
GtkWidget *
do_sizegroup (void)
{
GtkWidget *table;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *check_button;
GtkSizeGroup *size_group;
static const char *color_options[] = {
"Red", "Green", "Blue", NULL
};
static const char *dash_options[] = {
"Solid", "Dashed", "Dotted", NULL
};
static const char *end_options[] = {
"Square", "Round", "Arrow", NULL
};
if (!window)
{
window = gtk_dialog_new_with_buttons ("GtkSizeGroup",
NULL, 0,
GTK_STOCK_CLOSE,
GTK_RESPONSE_NONE,
NULL);
gtk_window_set_resizeable (GTK_WINDOW (window), FALSE);
gtk_signal_connect (GTK_OBJECT (window), "response",
GTK_SIGNAL_FUNC (gtk_widget_destroy), NULL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
vbox = gtk_vbox_new (FALSE, 5);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), vbox, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
/* Create one frame holding color options
*/
frame = gtk_frame_new ("Color Options");
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
table = gtk_table_new (2, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
gtk_container_add (GTK_CONTAINER (frame), table);
add_row (GTK_TABLE (table), 0, size_group, "Foreground", color_options);
add_row (GTK_TABLE (table), 1, size_group, "Background", color_options);
/* And another frame holding line style options
*/
frame = gtk_frame_new ("Line Options");
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
table = gtk_table_new (2, 2, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (table), 5);
gtk_table_set_row_spacings (GTK_TABLE (table), 5);
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
gtk_container_add (GTK_CONTAINER (frame), table);
add_row (GTK_TABLE (table), 0, size_group, "Dashing", dash_options);
add_row (GTK_TABLE (table), 1, size_group, "Line ends", end_options);
/* And a check button to turn grouping on and off */
check_button = gtk_check_button_new_with_label ("Enable grouping");
gtk_box_pack_start (GTK_BOX (vbox), check_button, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_grouping), size_group);
}
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -0,0 +1,520 @@
/* Stock Item/Icon Browser
*
* This source code for this demo doesn't demonstrate anything
* particularly useful in applications. The purpose of the "demo" is
* just to provide a handy place to browse the available stock icons
* and stock items.
*/
#include <string.h>
#include <gtk/gtk.h>
static GtkWidget *window = NULL;
typedef struct _StockItemInfo StockItemInfo;
struct _StockItemInfo
{
gchar *id;
GtkStockItem item;
GdkPixbuf *small_icon;
gchar *macro;
gchar *accel_str;
};
/* Make StockItemInfo a boxed type so we can automatically
* manage memory
*/
#define STOCK_ITEM_INFO_TYPE stock_item_info_get_type ()
static void
stock_item_info_free (StockItemInfo *info)
{
g_free (info->id);
g_free (info->macro);
g_free (info->accel_str);
if (info->small_icon)
g_object_unref (G_OBJECT (info->small_icon));
g_free (info);
}
static StockItemInfo*
stock_item_info_copy (StockItemInfo *src)
{
StockItemInfo *info;
info = g_new (StockItemInfo, 1);
info->id = g_strdup (src->id);
info->macro = g_strdup (src->macro);
info->accel_str = g_strdup (src->accel_str);
info->item = src->item;
info->small_icon = src->small_icon;
if (info->small_icon)
g_object_ref (G_OBJECT (info->small_icon));
return info;
}
static GType
stock_item_info_get_type (void)
{
static GType our_type = 0;
if (our_type == 0)
our_type = g_boxed_type_register_static ("StockItemInfo",
NULL,
(GBoxedCopyFunc) stock_item_info_copy,
(GBoxedFreeFunc) stock_item_info_free,
FALSE);
return our_type;
}
typedef struct _StockItemDisplay StockItemDisplay;
struct _StockItemDisplay
{
GtkWidget *type_label;
GtkWidget *macro_label;
GtkWidget *id_label;
GtkWidget *label_accel_label;
GtkWidget *icon_image;
};
/* columns in the tree model */
enum {
COLUMN_ICON_MACRO,
COLUMN_LABEL,
COLUMN_ACCEL,
COLUMN_ID
};
static gchar*
id_to_macro (const gchar *id)
{
GString *macro;
const gchar *cp;
gchar *p;
/* gtk-foo -> GTK_STOCK_FOO */
cp = id;
while (*cp && *cp != '-')
++cp;
if (*cp == '\0')
return g_strdup ("??UNKNOWN??");
macro = g_string_new (NULL);
g_string_append_len (macro, id, cp - id);
g_string_append (macro, "_STOCK");
g_string_append (macro, cp);
p = macro->str;
while (*p)
{
if (*p == '-')
*p = '_';
++p;
}
g_strup (macro->str);
return g_string_free (macro, FALSE);
}
static GtkTreeModel*
create_model (void)
{
GtkListStore *store;
GSList *ids;
GSList *tmp_list;
store = gtk_list_store_new_with_types (1, STOCK_ITEM_INFO_TYPE);
ids = gtk_stock_list_ids ();
ids = g_slist_sort (ids, (GCompareFunc) strcmp);
tmp_list = ids;
while (tmp_list != NULL)
{
StockItemInfo info;
GtkStockItem item;
GtkTreeIter iter;
GtkIconSet *icon_set;
info.id = tmp_list->data;
if (gtk_stock_lookup (info.id, &item))
{
info.item = item;
}
else
{
info.item.label = NULL;
info.item.stock_id = NULL;
info.item.modifier = 0;
info.item.keyval = 0;
info.item.translation_domain = NULL;
}
/* only show icons for stock IDs that have default icons */
icon_set = gtk_icon_factory_lookup_default (info.id);
if (icon_set)
{
GtkIconSize *sizes = NULL;
gint n_sizes = 0;
gint i;
GtkIconSize size;
/* See what sizes this stock icon really exists at */
gtk_icon_set_get_sizes (icon_set, &sizes, &n_sizes);
/* Use menu size if it exists, otherwise first size found */
size = sizes[0];
i = 0;
while (i < n_sizes)
{
if (sizes[i] == GTK_ICON_SIZE_MENU)
{
size = GTK_ICON_SIZE_MENU;
break;
}
++i;
}
g_free (sizes);
info.small_icon = gtk_widget_render_icon (window, info.id,
size,
NULL);
if (size != GTK_ICON_SIZE_MENU)
{
/* Make the result the proper size for our thumbnail */
gint w, h;
GdkPixbuf *scaled;
gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &w, &h);
scaled = gdk_pixbuf_scale_simple (info.small_icon,
w, h,
GDK_INTERP_BILINEAR);
g_object_unref (G_OBJECT (info.small_icon));
info.small_icon = scaled;
}
}
else
info.small_icon = NULL;
if (info.item.keyval != 0)
{
info.accel_str = gtk_accelerator_name (info.item.keyval,
info.item.modifier);
}
else
{
info.accel_str = g_strdup ("");
}
info.macro = id_to_macro (info.id);
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, &info, -1);
g_free (info.macro);
g_free (info.accel_str);
if (info.small_icon)
g_object_unref (G_OBJECT (info.small_icon));
tmp_list = g_slist_next (tmp_list);
}
g_slist_foreach (ids, (GFunc)g_free, NULL);
g_slist_free (ids);
return GTK_TREE_MODEL (store);
}
static void
selection_changed (GtkTreeSelection *selection)
{
GtkTreeView *treeview;
StockItemDisplay *display;
GtkTreeModel *model;
GtkTreeIter iter;
treeview = gtk_tree_selection_get_tree_view (selection);
display = g_object_get_data (G_OBJECT (treeview), "stock-display");
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
StockItemInfo *info;
gchar *str;
gtk_tree_model_get (model, &iter,
0, &info,
-1);
if (info->small_icon && info->item.label)
gtk_label_set_text (GTK_LABEL (display->type_label), "Icon and Item");
else if (info->small_icon)
gtk_label_set_text (GTK_LABEL (display->type_label), "Icon Only");
else if (info->item.label)
gtk_label_set_text (GTK_LABEL (display->type_label), "Item Only");
else
gtk_label_set_text (GTK_LABEL (display->type_label), "???????");
gtk_label_set_text (GTK_LABEL (display->macro_label), info->macro);
gtk_label_set_text (GTK_LABEL (display->id_label), info->id);
if (info->item.label)
{
str = g_strdup_printf ("%s %s", info->item.label, info->accel_str);
gtk_label_set_text_with_mnemonic (GTK_LABEL (display->label_accel_label), str);
g_free (str);
}
else
{
gtk_label_set_text (GTK_LABEL (display->label_accel_label), "");
}
/* The problem here is that some icons don't have SIZE_LARGE_TOOLBAR,
* so we get a "missing image" icon...
*/
if (info->small_icon)
gtk_image_set_from_stock (GTK_IMAGE (display->icon_image), info->id,
GTK_ICON_SIZE_LARGE_TOOLBAR);
else
gtk_image_set_from_pixbuf (GTK_IMAGE (display->icon_image), NULL);
stock_item_info_free (info);
}
else
{
gtk_label_set_text (GTK_LABEL (display->type_label), "No selected item");
gtk_label_set_text (GTK_LABEL (display->macro_label), "");
gtk_label_set_text (GTK_LABEL (display->id_label), "");
gtk_label_set_text (GTK_LABEL (display->label_accel_label), "");
gtk_image_set_from_pixbuf (GTK_IMAGE (display->icon_image), NULL);
}
}
static void
macro_set_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
StockItemInfo *info;
gtk_tree_model_get (model, iter,
0, &info,
-1);
g_object_set (GTK_CELL_RENDERER (cell),
"text", info->macro,
"pixbuf", info->small_icon,
NULL);
stock_item_info_free (info);
}
static void
id_set_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
StockItemInfo *info;
gtk_tree_model_get (model, iter,
0, &info,
-1);
g_object_set (GTK_CELL_RENDERER (cell),
"text", info->id,
NULL);
stock_item_info_free (info);
}
static void
accel_set_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
StockItemInfo *info;
gtk_tree_model_get (model, iter,
0, &info,
-1);
g_object_set (GTK_CELL_RENDERER (cell),
"text", info->accel_str,
NULL);
stock_item_info_free (info);
}
static void
label_set_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *model,
GtkTreeIter *iter,
gpointer data)
{
StockItemInfo *info;
gtk_tree_model_get (model, iter,
0, &info,
-1);
g_object_set (GTK_CELL_RENDERER (cell),
"text", info->item.label,
NULL);
stock_item_info_free (info);
}
GtkWidget *
do_stock_browser (void)
{
if (!window)
{
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *sw;
GtkWidget *treeview;
GtkWidget *align;
GtkTreeModel *model;
GtkCellRenderer *cell_renderer;
StockItemDisplay *display;
GtkTreeSelection *selection;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Stock Icons and Items");
gtk_signal_connect (GTK_OBJECT (window), "destroy", GTK_SIGNAL_FUNC (gtk_widget_destroyed), &window);
gtk_container_set_border_width (GTK_CONTAINER (window), 8);
hbox = gtk_hbox_new (FALSE, 8);
gtk_container_add (GTK_CONTAINER (window), hbox);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_box_pack_start (GTK_BOX (hbox), sw, FALSE, FALSE, 0);
model = create_model ();
treeview = gtk_tree_view_new_with_model (model);
g_object_unref (G_OBJECT (model));
gtk_container_add (GTK_CONTAINER (sw), treeview);
cell_renderer = gtk_cell_renderer_text_pixbuf_new ();
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
-1,
"Macro",
cell_renderer,
macro_set_func,
NULL,
NULL);
g_object_unref (G_OBJECT (cell_renderer));
cell_renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
-1,
"Label",
cell_renderer,
label_set_func,
NULL,
NULL);
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
-1,
"Accel",
cell_renderer,
accel_set_func,
NULL,
NULL);
gtk_tree_view_insert_column_with_data_func (GTK_TREE_VIEW (treeview),
-1,
"ID",
cell_renderer,
id_set_func,
NULL,
NULL);
g_object_unref (G_OBJECT (cell_renderer));
align = gtk_alignment_new (0.5, 0.0, 0.0, 0.0);
gtk_box_pack_end (GTK_BOX (hbox), align, FALSE, FALSE, 0);
frame = gtk_frame_new ("Selected Item");
gtk_container_add (GTK_CONTAINER (align), frame);
vbox = gtk_vbox_new (FALSE, 8);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 4);
gtk_container_add (GTK_CONTAINER (frame), vbox);
display = g_new (StockItemDisplay, 1);
g_object_set_data_full (G_OBJECT (treeview),
"stock-display",
display,
g_free); /* free display with treeview */
display->type_label = gtk_label_new (NULL);
display->macro_label = gtk_label_new (NULL);
display->id_label = gtk_label_new (NULL);
display->label_accel_label = gtk_label_new (NULL);
display->icon_image = gtk_image_new_from_pixbuf (NULL); /* empty image */
gtk_box_pack_start (GTK_BOX (vbox), display->type_label,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), display->icon_image,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), display->label_accel_label,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), display->macro_label,
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox), display->id_label,
FALSE, FALSE, 0);
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
gtk_tree_selection_set_mode (selection, GTK_TREE_SELECTION_SINGLE);
g_signal_connect_data (G_OBJECT (selection),
"selection_changed",
G_CALLBACK (selection_changed),
NULL, NULL, FALSE, FALSE);
}
if (!GTK_WIDGET_VISIBLE (window))
{
gtk_widget_show_all (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}

View File

@@ -12,30 +12,30 @@
/* Don't copy this bad example; inline RGB data is always a better
* idea than inline XPMs.
*/
static char *book_closed_xpm[] = {
static char *book_closed_xpm[] = {
"16 16 6 1",
" c None s None",
". c black",
"X c red",
"o c yellow",
"O c #808080",
"# c white",
" ",
" .. ",
" ..XX. ",
" ..XXXXX. ",
" ..XXXXXXXX. ",
".ooXXXXXXXXX. ",
"..ooXXXXXXXXX. ",
" c None s None",
". c black",
"X c red",
"o c yellow",
"O c #808080",
"# c white",
" ",
" .. ",
" ..XX. ",
" ..XXXXX. ",
" ..XXXXXXXX. ",
".ooXXXXXXXXX. ",
"..ooXXXXXXXXX. ",
".X.ooXXXXXXXXX. ",
".XX.ooXXXXXX.. ",
" .XX.ooXXX..#O ",
".XX.ooXXXXXX.. ",
" .XX.ooXXX..#O ",
" .XX.oo..##OO. ",
" .XX..##OO.. ",
" .X.#OO.. ",
" ..O.. ",
" .. ",
" "
" .XX..##OO.. ",
" .X.#OO.. ",
" ..O.. ",
" .. ",
" "
};
@@ -63,111 +63,111 @@ create_tags (GtkTextBuffer *buffer)
* new copies of the same tags for every buffer.
*
* Tags are assigned default priorities in order of addition to the
* tag table. That is, tags created later that affect the same text
* tag table. That is, tags created later that affect the same text
* property affected by an earlier tag will override the earlier
* tag. You can modify tag priorities with
* gtk_text_tag_set_priority().
*/
gtk_text_buffer_create_tag (buffer, "heading",
"weight", PANGO_WEIGHT_BOLD,
"size", 20 * PANGO_SCALE,
NULL);
"weight", PANGO_WEIGHT_BOLD,
"size", 20 * PANGO_SCALE,
NULL);
gtk_text_buffer_create_tag (buffer, "italic",
"style", PANGO_STYLE_ITALIC, NULL);
"style", PANGO_STYLE_ITALIC, NULL);
gtk_text_buffer_create_tag (buffer, "bold",
"weight", PANGO_WEIGHT_BOLD, NULL);
"weight", PANGO_WEIGHT_BOLD, NULL);
gtk_text_buffer_create_tag (buffer, "big",
/* points times the PANGO_SCALE factor */
"size", 30 * PANGO_SCALE, NULL);
/* points times the PANGO_SCALE factor */
"size", 30 * PANGO_SCALE, NULL);
gtk_text_buffer_create_tag (buffer, "xx-small",
"scale", PANGO_SCALE_XX_SMALL, NULL);
"scale", PANGO_SCALE_XX_SMALL, NULL);
gtk_text_buffer_create_tag (buffer, "x-large",
"scale", PANGO_SCALE_X_LARGE, NULL);
"scale", PANGO_SCALE_X_LARGE, NULL);
gtk_text_buffer_create_tag (buffer, "monospace",
"family", "monospace", NULL);
"family", "monospace", NULL);
gtk_text_buffer_create_tag (buffer, "blue_foreground",
"foreground", "blue", NULL);
"foreground", "blue", NULL);
gtk_text_buffer_create_tag (buffer, "red_background",
"background", "red", NULL);
"background", "red", NULL);
stipple = gdk_bitmap_create_from_data (NULL,
gray50_bits, gray50_width,
gray50_height);
gray50_bits, gray50_width,
gray50_height);
gtk_text_buffer_create_tag (buffer, "background_stipple",
"background_stipple", stipple, NULL);
"background_stipple", stipple, NULL);
gtk_text_buffer_create_tag (buffer, "foreground_stipple",
"foreground_stipple", stipple, NULL);
"foreground_stipple", stipple, NULL);
g_object_unref (G_OBJECT (stipple));
gtk_text_buffer_create_tag (buffer, "big_gap_before_line",
"pixels_above_lines", 30, NULL);
"pixels_above_lines", 30, NULL);
gtk_text_buffer_create_tag (buffer, "big_gap_after_line",
"pixels_below_lines", 30, NULL);
"pixels_below_lines", 30, NULL);
gtk_text_buffer_create_tag (buffer, "double_spaced_line",
"pixels_inside_wrap", 10, NULL);
"pixels_inside_wrap", 10, NULL);
gtk_text_buffer_create_tag (buffer, "not_editable",
"editable", FALSE, NULL);
"editable", FALSE, NULL);
gtk_text_buffer_create_tag (buffer, "word_wrap",
"wrap_mode", GTK_WRAP_WORD, NULL);
"wrap_mode", GTK_WRAP_WORD, NULL);
gtk_text_buffer_create_tag (buffer, "char_wrap",
"wrap_mode", GTK_WRAP_CHAR, NULL);
"wrap_mode", GTK_WRAP_CHAR, NULL);
gtk_text_buffer_create_tag (buffer, "no_wrap",
"wrap_mode", GTK_WRAP_NONE, NULL);
"wrap_mode", GTK_WRAP_NONE, NULL);
gtk_text_buffer_create_tag (buffer, "center",
"justification", GTK_JUSTIFY_CENTER, NULL);
"justification", GTK_JUSTIFY_CENTER, NULL);
gtk_text_buffer_create_tag (buffer, "right_justify",
"justification", GTK_JUSTIFY_RIGHT, NULL);
"justification", GTK_JUSTIFY_RIGHT, NULL);
gtk_text_buffer_create_tag (buffer, "wide_margins",
"left_margin", 50, "right_margin", 50,
NULL);
"left_margin", 50, "right_margin", 50,
NULL);
gtk_text_buffer_create_tag (buffer, "strikethrough",
"strikethrough", TRUE, NULL);
"strikethrough", TRUE, NULL);
gtk_text_buffer_create_tag (buffer, "underline",
"underline", PANGO_UNDERLINE_SINGLE, NULL);
"underline", PANGO_UNDERLINE_SINGLE, NULL);
gtk_text_buffer_create_tag (buffer, "double_underline",
"underline", PANGO_UNDERLINE_DOUBLE, NULL);
"underline", PANGO_UNDERLINE_DOUBLE, NULL);
gtk_text_buffer_create_tag (buffer, "superscript",
"rise", 10 * PANGO_SCALE, /* 10 pixels */
"size", 8 * PANGO_SCALE, /* 8 points */
NULL);
"rise", 10 * PANGO_SCALE, /* 10 pixels */
"size", 8 * PANGO_SCALE, /* 8 points */
NULL);
gtk_text_buffer_create_tag (buffer, "subscript",
"rise", -10 * PANGO_SCALE, /* 10 pixels */
"size", 8 * PANGO_SCALE, /* 8 points */
NULL);
"rise", -10 * PANGO_SCALE, /* 10 pixels */
"size", 8 * PANGO_SCALE, /* 8 points */
NULL);
gtk_text_buffer_create_tag (buffer, "rtl_quote",
"wrap_mode", GTK_WRAP_WORD,
"direction", GTK_TEXT_DIR_RTL,
"indent", 30,
"left_margin", 20,
"right_margin", 20,
NULL);
"wrap_mode", GTK_WRAP_WORD,
"direction", GTK_TEXT_DIR_RTL,
"indent", 30,
"left_margin", 20,
"right_margin", 20,
NULL);
}
static void
@@ -187,88 +187,88 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_insert (buffer, &iter, "The text widget can display text with all kinds of nifty attributes. It also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Font styles. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "For example, you can have ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"italic", -1,
"italic", NULL);
"italic", -1,
"italic", NULL);
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"bold", -1,
"bold", NULL);
"bold", -1,
"bold", NULL);
gtk_text_buffer_insert (buffer, &iter, ", or ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"monospace (typewriter)", -1,
"monospace", NULL);
"monospace (typewriter)", -1,
"monospace", NULL);
gtk_text_buffer_insert (buffer, &iter, ", or ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"big", -1,
"big", NULL);
"big", -1,
"big", NULL);
gtk_text_buffer_insert (buffer, &iter, " text. ", -1);
gtk_text_buffer_insert (buffer, &iter, "It's best not to hardcode specific text sizes; you can use relative sizes as with CSS, such as ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"xx-small", -1,
"xx-small", NULL);
"xx-small", -1,
"xx-small", NULL);
gtk_text_buffer_insert (buffer, &iter, " or ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"x-large", -1,
"x-large", NULL);
"x-large", -1,
"x-large", NULL);
gtk_text_buffer_insert (buffer, &iter, " to ensure that your program properly adapts if the user changes the default font size.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Colors. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "Colors such as ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"a blue foreground", -1,
"blue_foreground", NULL);
"a blue foreground", -1,
"blue_foreground", NULL);
gtk_text_buffer_insert (buffer, &iter, " or ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"a red background", -1,
"red_background", NULL);
"a red background", -1,
"red_background", NULL);
gtk_text_buffer_insert (buffer, &iter, " or even ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"a stippled red background", -1,
"red_background",
"background_stipple",
NULL);
"a stippled red background", -1,
"red_background",
"background_stipple",
NULL);
gtk_text_buffer_insert (buffer, &iter, " or ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"a stippled blue foreground on solid red background", -1,
"blue_foreground",
"red_background",
"foreground_stipple",
NULL);
"a stippled blue foreground on solid red background", -1,
"blue_foreground",
"red_background",
"foreground_stipple",
NULL);
gtk_text_buffer_insert (buffer, &iter, " (select that to read it) can be used.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Underline, strikethrough, and rise. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"Strikethrough", -1,
"strikethrough", NULL);
"Strikethrough", -1,
"strikethrough", NULL);
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"underline", -1,
"underline", NULL);
"underline", -1,
"underline", NULL);
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"double underline", -1,
"double_underline", NULL);
"double underline", -1,
"double_underline", NULL);
gtk_text_buffer_insert (buffer, &iter, ", ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"superscript", -1,
"superscript", NULL);
"superscript", -1,
"superscript", NULL);
gtk_text_buffer_insert (buffer, &iter, ", and ", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"subscript", -1,
"subscript", NULL);
"subscript", -1,
"subscript", NULL);
gtk_text_buffer_insert (buffer, &iter, " are all supported.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Images. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
gtk_text_buffer_insert_pixbuf (buffer, &iter, pixbuf);
@@ -277,68 +277,68 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_insert (buffer, &iter, " for example.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Spacing. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "You can adjust the amount of space before each line.\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line has a whole lot of space before it.\n", -1,
"big_gap_before_line", "wide_margins", NULL);
"This line has a whole lot of space before it.\n", -1,
"big_gap_before_line", "wide_margins", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", -1,
"big_gap_after_line", "wide_margins", NULL);
"You can also adjust the amount of space after each line; this line has a whole lot of space after it.\n", -1,
"big_gap_after_line", "wide_margins", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", -1,
"double_spaced_line", "wide_margins", NULL);
"You can also adjust the amount of space between wrapped lines; this line has extra space between each wrapped line in the same paragraph. To show off wrapping, some filler text: the quick brown fox jumped over the lazy dog. Blah blah blah blah blah blah blah blah blah.\n", -1,
"double_spaced_line", "wide_margins", NULL);
gtk_text_buffer_insert (buffer, &iter, "Also note that those lines have extra-wide margins.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Editability. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", -1,
"not_editable", NULL);
"This line is 'locked down' and can't be edited by the user - just try it! You can't delete this line.\n\n", -1,
"not_editable", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Wrapping. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter,
"This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1);
"This line (and most of the others in this buffer) is word-wrapped, using the proper Unicode algorithm. Word wrap should work in all scripts and languages that GTK+ supports. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1,
"char_wrap", NULL);
"This line has character-based wrapping, and can wrap between any two character glyphs. Let's make this a long paragraph to demonstrate: blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah\n\n", -1,
"char_wrap", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", -1,
"no_wrap", NULL);
"This line has all wrapping turned off, so it makes the horizontal scrollbar appear.\n\n\n", -1,
"no_wrap", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Justification. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"\nThis line has center justification.\n", -1,
"center", NULL);
"\nThis line has center justification.\n", -1,
"center", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"This line has right justification.\n", -1,
"right_justify", NULL);
"This line has right justification.\n", -1,
"right_justify", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter,
"\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", -1,
"wide_margins", NULL);
"\nThis line has big wide margins. Text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text.\n", -1,
"wide_margins", NULL);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Internationalization. ", -1,
"heading", NULL);
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter,
"You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch Süd) Grüß Gott\nGreek (Ελληνικά) Γειά σας\nHebrew שלום\nJapanese (日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n", -1);
"You can put all sorts of Unicode text in the buffer.\n\nGerman (Deutsch Süd) Grüß Gott\nGreek (Ελληνικά) Γειά σας\nHebrew שלום\nJapanese (日本語)\n\nThe widget properly handles bidirectional text, word wrapping, DOS/UNIX/Unicode paragraph separators, grapheme boundaries, and so on using the Pango internationalization framework.\n", -1);
gtk_text_buffer_insert (buffer, &iter, "Here's a word-wrapped quote in a right-to-left language:\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "وقد بدأ ثلاث من أكثر المؤسسات تقدما في شبكة اكسيون برامجها كمنظمات لا تسعى للربح، ثم تحولت في السنوات الخمس الماضية إلى مؤسسات مالية منظمة، وباتت جزءا من النظام المالي في بلدانها، ولكنها تتخصص في خدمة قطاع المشروعات الصغيرة. وأحد أكثر هذه المؤسسات نجاحا هو »بانكوسول« في بوليفيا.\n\n", -1,
"rtl_quote", NULL);
"rtl_quote", NULL);
gtk_text_buffer_insert (buffer, &iter, "\n\nThis demo doesn't demonstrate all the GtkTextBuffer features; it leaves out, for example: invisible/hidden text (doesn't work in GTK 2, but planned), tab stops, application-drawn areas on the sides of the widget for displaying breakpoints and such...", -1);
@@ -364,7 +364,7 @@ do_textview (void)
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_default_size (GTK_WINDOW (window),
450, 450);
450, 450);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
@@ -388,16 +388,16 @@ do_textview (void)
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_paned_add1 (GTK_PANED (vpaned), sw);
gtk_container_add (GTK_CONTAINER (sw), view1);
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_paned_add2 (GTK_PANED (vpaned), sw);
gtk_container_add (GTK_CONTAINER (sw), view2);

View File

@@ -8,13 +8,13 @@
#include <gdk/linux-fb/gdkfb.h>
#endif
int close_app(GtkWidget *widget, gpointer data)
int close_app (GtkWidget *widget, gpointer data)
{
gtk_main_quit();
gtk_main_quit ();
return TRUE;
}
int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
int expose_cb (GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
{
GdkPixbuf *pixbuf;
@@ -22,7 +22,7 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
"pixbuf");
if(gdk_pixbuf_get_has_alpha (pixbuf))
{
gdk_draw_rgb_32_image(drawing_area->window,
gdk_draw_rgb_32_image (drawing_area->window,
drawing_area->style->black_gc,
evt->area.x, evt->area.y,
evt->area.width,
@@ -35,7 +35,7 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
}
else
{
gdk_draw_rgb_image(drawing_area->window,
gdk_draw_rgb_image (drawing_area->window,
drawing_area->style->black_gc,
evt->area.x, evt->area.y,
evt->area.width,
@@ -49,32 +49,34 @@ int expose_cb(GtkWidget *drawing_area, GdkEventExpose *evt, gpointer data)
return FALSE;
}
int configure_cb(GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
int configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
{
GdkPixbuf *pixbuf;
GdkScreen *scr = gdk_drawable_get_screen (drawing_area->window);
pixbuf = (GdkPixbuf *) gtk_object_get_data(GTK_OBJECT(drawing_area),
"pixbuf");
g_print("X:%d Y:%d\n", evt->width, evt->height);
g_print ("X:%d Y:%d\n", evt->width, evt->height);
if(evt->width != gdk_pixbuf_get_width (pixbuf) || evt->height != gdk_pixbuf_get_height (pixbuf))
{
GdkWindow *root;
GdkPixbuf *new_pixbuf;
root = GDK_ROOT_PARENT();
new_pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
root = GDK_SCREEN_GET_CLASS (scr)->get_root_window (scr);
new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
0, 0, 0, 0, evt->width, evt->height);
gtk_object_set_data(GTK_OBJECT(drawing_area), "pixbuf", new_pixbuf);
gdk_pixbuf_unref(pixbuf);
gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", new_pixbuf);
gdk_pixbuf_unref (pixbuf);
}
return FALSE;
}
extern void pixbuf_init();
extern void pixbuf_init ();
int main(int argc, char **argv)
int main (int argc, char **argv)
{
GdkWindow *root;
GtkWidget *window;
@@ -84,38 +86,38 @@ int main(int argc, char **argv)
pixbuf_init ();
gtk_init(&argc, &argv);
gdk_rgb_set_verbose(TRUE);
gdk_rgb_init();
gtk_init (&argc, &argv);
gdk_rgb_set_verbose (TRUE);
gdk_rgb_init ();
gtk_widget_set_default_colormap(gdk_rgb_get_cmap());
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
root = GDK_ROOT_PARENT();
pixbuf = gdk_pixbuf_get_from_drawable(NULL, root, NULL,
root = gdk_screen_get_root_window(gdk_get_default_screen ());
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
0, 0, 0, 0, 150, 160);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_signal_connect(GTK_OBJECT(window), "delete_event",
GTK_SIGNAL_FUNC(close_app), NULL);
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(close_app), NULL);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
GTK_SIGNAL_FUNC (close_app), NULL);
gtk_signal_connect (GTK_OBJECT (window), "destroy",
GTK_SIGNAL_FUNC (close_app), NULL);
vbox = gtk_vbox_new(FALSE, 0);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER(window), vbox);
drawing_area = gtk_drawing_area_new();
gtk_widget_set_usize(GTK_WIDGET(drawing_area),
drawing_area = gtk_drawing_area_new ();
gtk_widget_set_usize (GTK_WIDGET (drawing_area),
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
GTK_SIGNAL_FUNC(expose_cb), NULL);
gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
GTK_SIGNAL_FUNC (expose_cb), NULL);
gtk_signal_connect(GTK_OBJECT(drawing_area), "configure_event",
GTK_SIGNAL_FUNC(configure_cb), NULL);
gtk_object_set_data(GTK_OBJECT(drawing_area), "pixbuf", pixbuf);
gtk_box_pack_start(GTK_BOX(vbox), drawing_area, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
GTK_SIGNAL_FUNC (configure_cb), NULL);
gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", pixbuf);
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
gtk_widget_show_all(window);
gtk_main();
gtk_widget_show_all (window);
gtk_main ();
return 0;
}

View File

@@ -96,7 +96,7 @@ int
configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
{
GdkPixbuf *pixbuf;
GdkScreen *scr = gdk_drawable_get_screen (drawing_area->window);
pixbuf = (GdkPixbuf *) gtk_object_get_data (GTK_OBJECT (drawing_area),
"pixbuf");
@@ -105,7 +105,7 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
GdkWindow *root;
GdkPixbuf *new_pixbuf;
root = GDK_ROOT_PARENT ();
root = GDK_SCREEN_GET_CLASS (scr)->get_root_window (scr);
new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
0, 0, 0, 0, evt->width, evt->height);
gtk_object_set_data (GTK_OBJECT (drawing_area), "pixbuf", new_pixbuf);
@@ -128,7 +128,7 @@ main (int argc, char **argv)
gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
root = GDK_ROOT_PARENT ();
root = gdk_screen_get_root_window (gdk_get_default_screen ());
pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
0, 0, 0, 0, 150, 160);

View File

@@ -322,3 +322,33 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
* GdkColorContext is gone; you probably weren't using it anyway.
Use GdkColormap and the gdk_rgb_* functions instead.
* GtkMenuBar now draws the GtkContainer::border_width space outside
the frame, not inside the frame
* In GTK 1.2, if an event handler returned TRUE it prevented
propagation of that event to parent widgets. That is, the
event signal would not be emitted on parent widgets. In
GTK 2.0, if an event handler returns TRUE, the current signal
emission on the current widget is immediately stopped. That is,
other callbacks connected to the signal will not be invoked.
* gtk_toolbar_new() no longer has arguments. This function
was broken because the default GtkToolbarStyle (icons, text, both)
is now a user preference, which is overridden when you call
gtk_toolbar_set_style(). The constructor forced everyone to
override the preference, which was undesirable. So to port
your app, decide if you want to force the toolbar style
or conform to the user's global defaults; if you want to force
it, call gtk_toolbar_set_style().
The orientation arg was removed from toolbar_new() as well, just
because it wasn't very useful and we were breaking the function
anyway so had an opportunity to lose it. Call
gtk_toolbar_set_orientation() to set toolbar orientation.
* GtkRange/GtkScrollbar/GtkScale were rewritten; this means that most
theme engines won't draw them properly, and any custom subclasses of
these widgets will need a rewrite (though if you could figure out
how to subclass the old version of GtkRange, you have our
respect). Also, GtkTroughType is gone.

View File

@@ -1,3 +1,26 @@
Tue Jun 5 10:54:48 2001 Owen Taylor <otaylor@redhat.com>
* gtk/tmpl/gtkenums.sgml: Improve docs for GtkStateType.
(Fixes #55751, among other things.)
Mon Jun 4 15:08:21 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtk-overrides.txt: Remove GtkArgSetFunc, GtkArgGetFunc.
Wed May 30 16:56:07 2001 Owen Taylor <otaylor@redhat.com>
* gtk/tmpl/gtkrc.sgml (pattern): Correct typoe when
describing order of composition. (#53371, Skip Montanaro)
2001-05-22 Havoc Pennington <hp@pobox.com>
* gtk/gtk-sections.txt: add gtk_bin_get_child
Fri May 18 12:28:08 2001 Owen Taylor <otaylor@redhat.com>
* gtk/tmpl/gtksizegroup.sgml gtk/gtk-sections.txt gtk/gtk.types:
Add documentation about GtkSizeGroup.
2001-05-11 Havoc Pennington <hp@pobox.com>
* gtk/tmpl/gtkvruler.sgml,

View File

@@ -75,6 +75,7 @@
<!entity GtkScrollbar SYSTEM "sgml/gtkscrollbar.sgml">
<!entity GtkScrolledWindow SYSTEM "sgml/gtkscrolledwindow.sgml">
<!entity GtkSeparator SYSTEM "sgml/gtkseparator.sgml">
<!entity GtkSizeGroup SYSTEM "sgml/gtksizegroup.sgml">
<!entity GtkSocket SYSTEM "sgml/gtksocket.sgml">
<!entity GtkSpinButton SYSTEM "sgml/gtkspinbutton.sgml">
<!entity GtkStatusbar SYSTEM "sgml/gtkstatusbar.sgml">
@@ -352,6 +353,7 @@ An advanced widget set.
&GtkHandleBox;
&GtkIMContext;
&GtkIMMulticontext;
&GtkSizeGroup;
&GtkTooltips;
&GtkViewport;
</sect1>

View File

@@ -1,23 +1,6 @@
# These are manually-edited to override or add declarations to those scanned
# from the GTK header files.
# These haven't been given parameter names in the header files.
<USER_FUNCTION>
<NAME>GtkArgGetFunc</NAME>
<RETURNS>void</RETURNS>
GtkObject *object,
GtkArg *arg,
guint arg_id
</USER_FUNCTION>
<USER_FUNCTION>
<NAME>GtkArgSetFunc</NAME>
<RETURNS>void</RETURNS>
GtkObject *object,
GtkArg *arg,
guint arg_id
</USER_FUNCTION>
# GtkAllocation is the same as GtkRectangle
<STRUCT>

View File

@@ -115,6 +115,7 @@ GTK_BUTTON_BOX_GET_CLASS
<FILE>gtkbin</FILE>
<TITLE>GtkBin</TITLE>
GtkBin
gtk_bin_get_child
<SUBSECTION Standard>
GTK_BIN
GTK_IS_BIN
@@ -1917,7 +1918,24 @@ GTK_TYPE_SETTINGS
gtk_settings_get_type
</SECTION>
<SECTION>
<FILE>gtksizegroup</FILE>
<TITLE>GtkSizeGroup</TITLE>
GtkSizeGroupMode
gtk_size_group_new
gtk_size_group_set_mode
gtk_size_group_get_mode
gtk_size_group_add_widget
gtk_size_group_remove_widget
<SUBSECTION Standard>
GTK_SIZE_GROUP
GTK_IS_SIZE_GROUP
GTK_TYPE_SIZE_GROUP
gtk_size_group_get_type
GTK_SIZE_GROUP_CLASS
GTK_IS_SIZE_GROUP_CLASS
GTK_SIZE_GROUP_GET_CLASS
</SECTION>
<SECTION>
<FILE>gtksocket</FILE>
@@ -3766,26 +3784,77 @@ gtk_stock_add
gtk_stock_add_static
gtk_stock_item_copy
gtk_stock_item_free
gtk_stock_list_items
gtk_stock_list_ids
gtk_stock_lookup
<SUBSECTION Stock IDs>
GTK_STOCK_BUTTON_APPLY
GTK_STOCK_BUTTON_CANCEL
GTK_STOCK_BUTTON_CLOSE
GTK_STOCK_BUTTON_NO
GTK_STOCK_BUTTON_OK
GTK_STOCK_BUTTON_YES
GTK_STOCK_ADD
GTK_STOCK_APPLY
GTK_STOCK_BOLD
GTK_STOCK_CANCEL
GTK_STOCK_CDROM
GTK_STOCK_CLEAR
GTK_STOCK_CLOSE
GTK_STOCK_CONVERT
GTK_STOCK_COPY
GTK_STOCK_CUT
GTK_STOCK_DELETE
GTK_STOCK_DIALOG_ERROR
GTK_STOCK_DIALOG_INFO
GTK_STOCK_DIALOG_QUESTION
GTK_STOCK_DIALOG_WARNING
GTK_STOCK_EXECUTE
GTK_STOCK_FIND
GTK_STOCK_FIND_AND_REPLACE
GTK_STOCK_FLOPPY
GTK_STOCK_GOTO_BOTTOM
GTK_STOCK_GOTO_FIRST
GTK_STOCK_GOTO_LAST
GTK_STOCK_GOTO_TOP
GTK_STOCK_GO_BACK
GTK_STOCK_GO_DOWN
GTK_STOCK_GO_FORWARD
GTK_STOCK_GO_UP
GTK_STOCK_HELP
GTK_STOCK_NEW
GTK_STOCK_OPEN
GTK_STOCK_QUIT
GTK_STOCK_SAVE
GTK_STOCK_CLOSE
GTK_STOCK_HOME
GTK_STOCK_INDEX
GTK_STOCK_ITALIC
GTK_STOCK_JUMP_TO
GTK_STOCK_JUSTIFY_CENTER
GTK_STOCK_JUSTIFY_FILL
GTK_STOCK_JUSTIFY_LEFT
GTK_STOCK_JUSTIFY_RIGHT
GTK_STOCK_MISSING_IMAGE
GTK_STOCK_NEW
GTK_STOCK_NO
GTK_STOCK_OK
GTK_STOCK_OPEN
GTK_STOCK_PASTE
GTK_STOCK_PREFERENCES
GTK_STOCK_PRINT
GTK_STOCK_PRINT_PREVIEW
GTK_STOCK_PROPERTIES
GTK_STOCK_QUIT
GTK_STOCK_REDO
GTK_STOCK_REFRESH
GTK_STOCK_REMOVE
GTK_STOCK_REVERT_TO_SAVED
GTK_STOCK_SAVE
GTK_STOCK_SAVE_AS
GTK_STOCK_SELECT_COLOR
GTK_STOCK_SELECT_FONT
GTK_STOCK_SORT_ASCENDING
GTK_STOCK_SORT_DESCENDING
GTK_STOCK_SPELL_CHECK
GTK_STOCK_STOP
GTK_STOCK_STRIKETHROUGH
GTK_STOCK_UNDELETE
GTK_STOCK_UNDERLINE
GTK_STOCK_UNDO
GTK_STOCK_YES
GTK_STOCK_ZOOM_100
GTK_STOCK_ZOOM_FIT
GTK_STOCK_ZOOM_IN
GTK_STOCK_ZOOM_OUT
</SECTION>

View File

@@ -73,6 +73,7 @@ gtk_scale_get_type
gtk_scrollbar_get_type
gtk_scrolled_window_get_type
gtk_separator_get_type
gtk_size_group_get_type
gtk_socket_get_type
gtk_spin_button_get_type
gtk_statusbar_get_type

View File

@@ -209,6 +209,42 @@ Get the array of signals defined for this object.
@obj: the object to fetch the signals from.
<!-- ##### MACRO GTK_STOCK_BUTTON_APPLY ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_CANCEL ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_CLOSE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_NO ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_OK ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_YES ##### -->
<para>
</para>
<!-- ##### MACRO GTK_TREE_SELECTION ##### -->
<para>
A macro that returns a GList that contains the selection of the root tree of @obj.
@@ -301,6 +337,36 @@ Use to get the value of a GtkArg whose GtkType is GTK_TYPE_C_FOREIGN
@a:
<!-- ##### ARG GtkAccelLabel:accel-width ##### -->
<para>
</para>
<!-- ##### USER_FUNCTION GtkArgGetFunc ##### -->
<para>
Define a function pointer. Deprecated.
</para>
@object:
@arg:
@arg_id:
<!-- ##### USER_FUNCTION GtkArgSetFunc ##### -->
<para>
Define a function pointer. Deprecated.
</para>
@object:
@arg:
@arg_id:
<!-- ##### ARG GtkContainer:reallocate-redraws ##### -->
<para>
</para>
<!-- ##### STRUCT GtkData ##### -->
<para>
The #GtkData-struct struct contains no public fields.
@@ -540,6 +606,18 @@ gtk_font_selection_set_filter().
</para>
<!-- ##### ARG GtkHScale:adjustment ##### -->
<para>
the #GtkAdjustment which sets the range of the scale.
</para>
<!-- ##### ARG GtkHScrollbar:adjustment ##### -->
<para>
</para>
<!-- ##### STRUCT GtkIMContextSimple ##### -->
<para>
@@ -723,6 +801,24 @@ produce superscript and subscript.
</para>
<!-- ##### ARG GtkTextView:justify ##### -->
<para>
</para>
<!-- ##### ARG GtkVScale:adjustment ##### -->
<para>
the #GtkAdjustment which sets the range of the scale.
</para>
<!-- ##### ARG GtkVScrollbar:adjustment ##### -->
<para>
</para>
<!-- ##### SIGNAL GtkWidget::activate-mnemonic ##### -->
<para>
@@ -983,6 +1079,14 @@ Get the type of GtkIdentifier.
@Returns: GtkType -- the enumerated type of something.
<!-- ##### FUNCTION gtk_image_menu_item_add_image ##### -->
<para>
</para>
@image_menu_item:
@child:
<!-- ##### FUNCTION gtk_label_set_markup_with_accel ##### -->
<para>
@@ -1417,6 +1521,13 @@ Creates a border around the arrows of a #GtkSpinButton. The type of border is de
@spin_button: a #GtkSpinButton
@shadow_type: the new border type.
<!-- ##### FUNCTION gtk_stock_list_items ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gtk_trace_referencing ##### -->
<para>
Private: print debugging information while doing a gtk_object_ref() or
@@ -1471,6 +1582,15 @@ a gtk_object_unref().
@column:
@value:
<!-- ##### FUNCTION gtk_tree_view_column_set_cell_data ##### -->
<para>
</para>
@tree_column:
@tree_model:
@iter:
<!-- ##### FUNCTION gtk_type_check_class_cast ##### -->
<para>
Given a GtkTypeClass pointer @klass, and a GtkType @cast_type, make

View File

@@ -150,3 +150,8 @@ box.
@ipad_y: the vertical padding that should be used by each button in @widget.
<!-- ##### ARG GtkButtonBox:layout-style ##### -->
<para>
</para>

View File

@@ -40,3 +40,12 @@ an application.)
</para>
<!-- ##### FUNCTION gtk_bin_get_child ##### -->
<para>
</para>
@bin:
@Returns:

View File

@@ -422,8 +422,3 @@ GtkContainer
</para>
<!-- ##### ARG GtkContainer:reallocate-redraws ##### -->
<para>
</para>

View File

@@ -248,11 +248,11 @@ contains grayscale or red-green-blue data.
</para>
@GTK_SCROLL_NONE:
@GTK_SCROLL_JUMP:
@GTK_SCROLL_STEP_BACKWARD:
@GTK_SCROLL_STEP_FORWARD:
@GTK_SCROLL_PAGE_BACKWARD:
@GTK_SCROLL_PAGE_FORWARD:
@GTK_SCROLL_JUMP:
@GTK_SCROLL_STEP_UP:
@GTK_SCROLL_STEP_DOWN:
@GTK_SCROLL_PAGE_UP:
@@ -261,6 +261,8 @@ contains grayscale or red-green-blue data.
@GTK_SCROLL_STEP_RIGHT:
@GTK_SCROLL_PAGE_LEFT:
@GTK_SCROLL_PAGE_RIGHT:
@GTK_SCROLL_START:
@GTK_SCROLL_END:
<!-- ##### ENUM GtkSelectionMode ##### -->
<para>
@@ -286,15 +288,19 @@ does
<!-- ##### ENUM GtkStateType ##### -->
<para>
This type indicates the current state of a widget.
This type indicates the current state of a widget; the state determines how
the widget is drawn. The #GtkStateType enumeration is also used to
identify different colors in a #GtkStyle for drawing, so states can be
used for subparts of a widget as well as entire widgets.
</para>
@GTK_STATE_NORMAL: The state during normal operation.
@GTK_STATE_ACTIVE: The widget is currently active, such as a
@GTK_STATE_PRELIGHT: The mouse pointer is over the widget.
@GTK_STATE_SELECTED:
@GTK_STATE_INSENSITIVE: The state of the widget can not be altered by the
user. Its appearance will usually indicate this.
@GTK_STATE_NORMAL: State during normal operation.
@GTK_STATE_ACTIVE: State of a currently active widget, such as a depressed button.
@GTK_STATE_PRELIGHT: State indicating that the mouse pointer is over
the widget and the widget will respond to mouse clicks.
@GTK_STATE_SELECTED: State of a selected item, such the selected row in a list.
@GTK_STATE_INSENSITIVE: State indicating that the widget is
unresponsive to user actions.
<!-- ##### ENUM GtkSubmenuDirection ##### -->
<para>
@@ -325,16 +331,6 @@ for the default toolbar style.
@GTK_TOOLBAR_BOTH_HORIZ: Buttons display icons and text alongside each
other, rather than vertically stacked
<!-- ##### ENUM GtkTroughType ##### -->
<para>
</para>
@GTK_TROUGH_NONE:
@GTK_TROUGH_START:
@GTK_TROUGH_END:
@GTK_TROUGH_JUMP:
<!-- ##### ENUM GtkUpdateType ##### -->
<para>

View File

@@ -106,3 +106,18 @@ Sets the text displayed in the preview area.
@text: the text to display in the preview area.
<!-- ##### ARG GtkFontSelection:font-name ##### -->
<para>
</para>
<!-- ##### ARG GtkFontSelection:font ##### -->
<para>
</para>
<!-- ##### ARG GtkFontSelection:preview-text ##### -->
<para>
</para>

View File

@@ -37,8 +37,3 @@ Creates a new #GtkHScale.
@Returns: a new #GtkHScale.
<!-- ##### ARG GtkHScale:adjustment ##### -->
<para>
the #GtkAdjustment which sets the range of the scale.
</para>

View File

@@ -33,8 +33,3 @@ Creates a new horizontal scrollbar.
@Returns: the new GTKHScrollbar
<!-- ##### ARG GtkHScrollbar:adjustment ##### -->
<para>
</para>

View File

@@ -27,15 +27,6 @@ GtkImageMenuItem
</para>
<!-- ##### FUNCTION gtk_image_menu_item_add_image ##### -->
<para>
</para>
@image_menu_item:
@child:
<!-- ##### FUNCTION gtk_image_menu_item_get_image ##### -->
<para>
@@ -58,9 +49,10 @@ GtkImageMenuItem
</para>
@Returns:
<!-- # Unused Parameters # -->
@widget:
@label:
@Returns:
<!-- ##### FUNCTION gtk_image_menu_item_new_from_stock ##### -->

View File

@@ -168,3 +168,13 @@ Set the width of the gutter. (The area between the two panes).
@Returns:
<!-- ##### ARG GtkPaned:position ##### -->
<para>
</para>
<!-- ##### ARG GtkPaned:position-set ##### -->
<para>
</para>

View File

@@ -72,6 +72,7 @@ GtkRange
@range: the object which received the signal.
@arg1:
<!-- # Unused Parameters # -->
@arg2:
<!-- ##### ARG GtkRange:update-policy ##### -->
@@ -79,3 +80,8 @@ GtkRange
</para>
<!-- ##### ARG GtkRange:adjustment ##### -->
<para>
</para>

View File

@@ -188,7 +188,7 @@ or <literal>class</literal> declaration. All styles
applying to a particular widget are composited together
with <literal>widget</literal> declarations overriding
<literal>widget_class</literal> declarations which, in
turn, override <literal>widget</literal> declarations.
turn, override <literal>class</literal> declarations.
Within each type of declaration, later declarations override
earlier ones.
</para>

View File

@@ -72,16 +72,6 @@ Sets the position in which the current value is displayed.
@pos: the position in which the current value is displayed.
<!-- ##### FUNCTION gtk_scale_get_value_width ##### -->
<para>
An internal function used to get the maximum width needed to display the value
string.
</para>
@scale: a #GtkScale.
@Returns: the maximum width needed to display the value string.
<!-- ##### SIGNAL GtkScale::format-value ##### -->
<para>

View File

@@ -0,0 +1,112 @@
<!-- ##### SECTION Title ##### -->
GtkSizeGroup
<!-- ##### SECTION Short_Description ##### -->
Grouping widgets so they request the same size
<!-- ##### SECTION Long_Description ##### -->
<para>
#GtkSizeGroup provides a mechanism for grouping a number of widgets
together so they all request the same amount of space. This is
typically useful when you want a column of widgets to have the same
size, but you can't use a #GtkTable widget.
</para>
<para>
In detail, the size requested for each widget in a #GtkSizeGroup is
the maximum of the sizes that would have been requested for each
widget in the size group if they were not in the size group. The mode
of the size group (see gtk_size_group_set_mode()) determines whether
this applies to the horizontal size, the vertical size, or both sizes.
</para>
<para>
Note that size groups only affect the amount of space requested, not
the size that the widgets finally receive. If you want the widgets in
a #GtkSizeGroup to actually be the same size, you need to pack them in
such a way that they get the size they request and not more. For
example, if you are packing your widgets into a table, you would not
include the %GTK_FILL flag.
</para>
<para>
#GtkSizeGroup objects are referenced by each widget in the size group,
so once you have added all widgets to a #GtkSizeGroup, you can drop
the initial reference to the size group with g_object_unref(). If the
widgets in the size group are subsequently destroyed, then they will
be removed from the size group and drop their references on the size
group; when all widgets have been removed, the size group will be
freed.
</para>
<para>
Widgets can be part of multiple size groups; GTK+ will compute the
horizontal size of a widget from the horizontal requisition of all
widgets that can be reached from the widget by a chain of size groups
of type %GTK_SIZE_GROUP_HORIZONTAL or %GTK_SIZE_GROUP_BOTH, and the
vertical size from the vertical requisition of all widgets that can be
reached from the widget by a chain of size groups of type
%GTK_SIZE_GROUP_VERTICAL or %GTK_SIZE_GROUP_BOTH.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### ENUM GtkSizeGroupMode ##### -->
<para>
</para>
@GTK_SIZE_GROUP_NONE:
@GTK_SIZE_GROUP_HORIZONTAL:
@GTK_SIZE_GROUP_VERTICAL:
@GTK_SIZE_GROUP_BOTH:
<!-- ##### FUNCTION gtk_size_group_new ##### -->
<para>
</para>
@mode:
@Returns:
<!-- ##### FUNCTION gtk_size_group_set_mode ##### -->
<para>
</para>
@size_group:
@type:
<!-- ##### FUNCTION gtk_size_group_get_mode ##### -->
<para>
</para>
@size_group:
@Returns:
<!-- ##### FUNCTION gtk_size_group_add_widget ##### -->
<para>
</para>
@size_group:
@widget:
<!-- ##### FUNCTION gtk_size_group_remove_widget ##### -->
<para>
</para>
@size_group:
@widget:
<!-- ##### ARG GtkSizeGroup:mode ##### -->
<para>
</para>

View File

@@ -64,7 +64,7 @@ Stock Items
@item:
<!-- ##### FUNCTION gtk_stock_list_items ##### -->
<!-- ##### FUNCTION gtk_stock_list_ids ##### -->
<para>
</para>
@@ -82,42 +82,77 @@ Stock Items
@Returns:
<!-- ##### MACRO GTK_STOCK_BUTTON_APPLY ##### -->
<!-- ##### MACRO GTK_STOCK_ADD ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_CANCEL ##### -->
<!-- ##### MACRO GTK_STOCK_APPLY ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_CLOSE ##### -->
<!-- ##### MACRO GTK_STOCK_BOLD ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_NO ##### -->
<!-- ##### MACRO GTK_STOCK_CANCEL ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_OK ##### -->
<!-- ##### MACRO GTK_STOCK_CDROM ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_BUTTON_YES ##### -->
<!-- ##### MACRO GTK_STOCK_CLEAR ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_CLOSE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_CONVERT ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_COPY ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_CUT ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_DELETE ##### -->
<para>
</para>
@@ -152,6 +187,90 @@ Stock Items
<!-- ##### MACRO GTK_STOCK_EXECUTE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_FIND ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_FIND_AND_REPLACE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_FLOPPY ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GOTO_BOTTOM ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GOTO_FIRST ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GOTO_LAST ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GOTO_TOP ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GO_BACK ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GO_DOWN ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GO_FORWARD ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_GO_UP ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_HELP ##### -->
<para>
@@ -159,35 +278,56 @@ Stock Items
<!-- ##### MACRO GTK_STOCK_NEW ##### -->
<!-- ##### MACRO GTK_STOCK_HOME ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_OPEN ##### -->
<!-- ##### MACRO GTK_STOCK_INDEX ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_QUIT ##### -->
<!-- ##### MACRO GTK_STOCK_ITALIC ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SAVE ##### -->
<!-- ##### MACRO GTK_STOCK_JUMP_TO ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_CLOSE ##### -->
<!-- ##### MACRO GTK_STOCK_JUSTIFY_CENTER ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_JUSTIFY_FILL ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_JUSTIFY_LEFT ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_JUSTIFY_RIGHT ##### -->
<para>
</para>
@@ -201,3 +341,220 @@ Stock Items
<!-- ##### MACRO GTK_STOCK_NEW ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_NO ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_OK ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_OPEN ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_PASTE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_PREFERENCES ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_PRINT ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_PRINT_PREVIEW ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_PROPERTIES ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_QUIT ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_REDO ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_REFRESH ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_REMOVE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_REVERT_TO_SAVED ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SAVE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SAVE_AS ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SELECT_COLOR ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SELECT_FONT ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SORT_ASCENDING ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SORT_DESCENDING ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_SPELL_CHECK ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_STOP ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_STRIKETHROUGH ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_UNDELETE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_UNDERLINE ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_UNDO ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_YES ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_ZOOM_100 ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_ZOOM_FIT ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_ZOOM_IN ##### -->
<para>
</para>
<!-- ##### MACRO GTK_STOCK_ZOOM_OUT ##### -->
<para>
</para>

View File

@@ -665,7 +665,7 @@ types related to the text widget and how they work together.
</para>
<!-- ##### ARG GtkTextView:justify ##### -->
<!-- ##### ARG GtkTextView:justification ##### -->
<para>
</para>
@@ -690,3 +690,8 @@ types related to the text widget and how they work together.
</para>
<!-- ##### ARG GtkTextView:cursor-visible ##### -->
<para>
</para>

View File

@@ -174,6 +174,11 @@ Should be connected if you wish to perform an action whenever the
Sets whether the toggle button should be pressed in or not.
</para>
<!-- ##### ARG GtkToggleButton:inconsistent ##### -->
<para>
</para>
<!-- ##### ARG GtkToggleButton:draw-indicator ##### -->
<para>
A value of TRUE causes the toggle button to be invisible. FALSE displays it

View File

@@ -78,9 +78,10 @@ SPACE is just a space in the style of the toolbar's GtkToolbarSpaceStyle. BUTTON
creates a new toolbar.
</para>
@Returns: the newly created toolbar.
<!-- # Unused Parameters # -->
@orientation: a #GtkOrientation. It determines whether the toolbar appears horizontally or vertically.
@style: a #GtkToolbarStyle. It determines if the toolbar will contain buttons with just labels, just images, or both.
@Returns: the newly created toolbar.
<!-- ##### FUNCTION gtk_toolbar_append_item ##### -->

View File

@@ -34,8 +34,9 @@ GtkTreeViewColumn
@alignment:
@window:
@xalign:
@model_changed_signal:
@property_changed_signal:
@width:
@requested_width:
@min_width:
@max_width:
@displayed_width:
@@ -53,7 +54,7 @@ GtkTreeViewColumn
@sort_column_id:
@sort_order:
@visible:
@button_active:
@clickable:
@dirty:
@show_sort_indicator:
@maybe_reordered:
@@ -115,16 +116,6 @@ GtkTreeViewColumn
@Varargs:
<!-- ##### FUNCTION gtk_tree_view_column_set_cell_data ##### -->
<para>
</para>
@tree_column:
@tree_model:
@iter:
<!-- ##### FUNCTION gtk_tree_view_column_set_visible ##### -->
<para>
@@ -239,6 +230,8 @@ GtkTreeViewColumn
</para>
@tree_column:
@clickable:
<!-- # Unused Parameters # -->
@active:

View File

@@ -217,26 +217,6 @@ Define a function pointer.
</para>
<!-- ##### USER_FUNCTION GtkArgGetFunc ##### -->
<para>
Define a function pointer. Deprecated.
</para>
@object:
@arg:
@arg_id:
<!-- ##### USER_FUNCTION GtkArgSetFunc ##### -->
<para>
Define a function pointer. Deprecated.
</para>
@object:
@arg:
@arg_id:
<!-- ##### TYPEDEF GtkTypeObject ##### -->
<para>
A GtkTypeObject defines the minimum structure requirements

View File

@@ -37,8 +37,3 @@ Creates a new #GtkVScale.
@Returns: a new #GtkVScale.
<!-- ##### ARG GtkVScale:adjustment ##### -->
<para>
the #GtkAdjustment which sets the range of the scale.
</para>

View File

@@ -33,8 +33,3 @@ Creates a new vertical scrollbar.
@Returns: the new GTKVScrollbar
<!-- ##### ARG GtkVScrollbar:adjustment ##### -->
<para>
</para>

View File

@@ -1,3 +1,68 @@
2001-05-08 Havoc Pennington <hp@redhat.com>
* gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): docs fixup,
and fix behavior to still subst color if the original image
had alpha
2001-06-04 Havoc Pennington <hp@redhat.com>
* io-pnm.c (pnm_skip_whitespace): patch from Szekeres Istvan,
bug #52560
2001-06-01 Havoc Pennington <hp@redhat.com>
Apply patch from sandmann@daimi.au.dk, with some tweaks.
Makes things a bit more robust, and adds test-loaders.c
which is good for finding further robustness bugs to fix.
* io-tiff.c: Try to work around libtiff suckiness a bit;
put a giant thread lock on the whole loader,
paranoically check both whether error handlers were called and
also whether functions return false. Handle case where width or
height is 0. Various cleanups.
* io-png.c (gdk_pixbuf__png_image_stop_load): only unref pixbuf
if it existed
(png_error_callback): apparently libpng expects you to longjmp out
of this thing?
* io-gif.c (struct _GifContext): remove unused "pixbuf" field
(lzw_read_byte): change "Mail jrb if this fails" g_warning
to a g_set_error()
(gif_get_lzw): check for out-of-memory
(gif_prepare_lzw): catch/report an error
(new_context): use try_malloc, since GifContext is nearly 70K
(gdk_pixbuf__gif_image_load_increment): set context->buf to NULL
so we don't crash later.
* Makefile.am: Add test-loaders
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): handle context ==
NULL due to errors
2001-05-29 Darin Adler <darin@eazel.com>
* gdk-pixbuf.h: Fix prototype to use "(void)" instead of "()".
Mon May 28 14:21:35 2001 Jonathan Blandford <jrb@redhat.com>
* io-bmp.c: Patch from Helmethead <hoshem@mel.comcen.com.au> to
fix up bmp decoder to:
- adds 16 bpp bmp support (bug #53884)
- adds OS/2 1.x format bmp support (bug #54964)
- adds 4 bpp RLE compressed bmp support
- adds 1 bpp colormap support
- fixes negative height (top down) bmp support
2001-05-25 Hans Breuer <hans@breuer.org>
* gdk_pixbuf.def : reflect Havoc's recent api change
Sun May 20 12:53:49 2001 Owen Taylor <otaylor@redhat.com>
* Makefile.am (libgdk_pixbuf_1_3_la_LDFLAGS): Remove an
excess $(GLIB_LIBS).
Sun May 13 11:59:11 2001 Owen Taylor <otaylor@redhat.com>
* Makefile.am: Make modules depend on libgdk_pixbuf.la.

View File

@@ -160,8 +160,8 @@ builtin_objs = @INCLUDED_LOADER_OBJ@
endif
noinst_PROGRAMS = test-gdk-pixbuf
TESTS = test-gdk-pixbuf
TESTS = test-gdk-pixbuf test-loaders
noinst_PROGRAMS = $(TESTS)
DEPS = libgdk_pixbuf-1.3.la
INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
@@ -170,11 +170,14 @@ INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
@INCLUDED_LOADER_DEFINE@ \
@GTK_DEBUG_FLAGS@ \
@GDK_PIXBUF_DEP_CFLAGS@
AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(loaderdir)\""
AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(loaderdir)\"" "-DBUILT_MODULES_DIR=\"$(srcdir)/.libs\""
LDADDS = libgdk_pixbuf-1.3.la
test_gdk_pixbuf_LDADD = $(LDADDS)
test_loaders_LDADD = $(LDADDS)
test_loaders_SOURCES = test-loaders.c test-images.h
bin_PROGRAMS=make-inline-pixbuf
@@ -182,6 +185,8 @@ make_inline_pixbuf_SOURCES=make-inline-pixbuf.c
make_inline_pixbuf_LDADD = $(LDADDS)
#
# The GdkPixBuf library
#
@@ -204,8 +209,7 @@ libgdk_pixbuf_1_3_la_SOURCES = \
libgdk_pixbuf_1_3_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
@LIBTOOL_EXPORT_OPTIONS@ \
$(GLIB_LIBS)
@LIBTOOL_EXPORT_OPTIONS@
libgdk_pixbuf_1_3_la_LIBADD = pixops/libpixops.la $(builtin_objs) $(GDK_PIXBUF_DEP_LIBS)
libgdk_pixbuf_1_3_la_DEPENDENCIES = $(builtin_objs)

View File

@@ -345,7 +345,7 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
g_return_val_if_fail (count >= 0, FALSE);
priv = loader->priv;
/* we expect it's not to be closed */
g_return_val_if_fail (priv->closed == FALSE, FALSE);
@@ -532,7 +532,7 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
if (priv->image_module == NULL)
gdk_pixbuf_loader_load_module (loader, NULL, NULL);
if (priv->image_module && priv->image_module->stop_load)
if (priv->image_module && priv->image_module->stop_load && priv->context)
retval = priv->image_module->stop_load (priv->context, error);
priv->closed = TRUE;

View File

@@ -30,18 +30,20 @@
/**
* gdk_pixbuf_add_alpha:
* @pixbuf: A pixbuf.
* @substitute_color: Whether to substitute a color for zero opacity. If this
* @substitute_color: Whether to set a color to zero opacity. If this
* is #FALSE, then the (@r, @g, @b) arguments will be ignored.
* @r: Red value to substitute.
* @g: Green value to substitute.
* @b: Blue value to substitute.
*
* Takes an existing pixbuf and adds an alpha channel to it. If the original
* pixbuf already had alpha information, then the contents of the new pixbuf are
* exactly the same as the original's. Otherwise, the new pixbuf will have all
* pixels with full opacity if @substitute_color is #FALSE. If
* @substitute_color is #TRUE, then the color specified by (@r, @g, @b) will be
* substituted for zero opacity.
* Takes an existing pixbuf and adds an alpha channel to it.
* If the existing pixbuf already had an alpha channel, the channel
* values are copied from the original; otherwise, the alpha channel
* is initialized to 255 (full opacity).
*
* If @substitute_color is #TRUE, then the color specified by (@r, @g, @b) will be
* assigned zero opacity. That is, if you pass (255, 255, 255) for the
* substitute color, all white pixels will become fully transparent.
*
* Return value: A newly-created pixbuf with a reference count of 1.
**/
@@ -62,10 +64,12 @@ gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,
if (!new_pixbuf)
return NULL;
return new_pixbuf;
}
new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
if (!substitute_color)
return new_pixbuf;
} else {
new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
}
if (!new_pixbuf)
return NULL;
@@ -75,16 +79,26 @@ gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,
src = pixbuf->pixels + y * pixbuf->rowstride;
dest = new_pixbuf->pixels + y * new_pixbuf->rowstride;
for (x = 0; x < pixbuf->width; x++) {
tr = *dest++ = *src++;
tg = *dest++ = *src++;
tb = *dest++ = *src++;
if (substitute_color && tr == r && tg == g && tb == b)
*dest++ = 0;
else
*dest++ = 255;
if (pixbuf->has_alpha) {
/* Just subst color, we already copied everything else */
for (x = 0; x < pixbuf->width; x++) {
if (src[0] == r && src[1] == g && src[2] == b)
dest[3] = 0;
src += 4;
dest += 4;
}
} else {
for (x = 0; x < pixbuf->width; x++) {
tr = *dest++ = *src++;
tg = *dest++ = *src++;
tb = *dest++ = *src++;
if (substitute_color && tr == r && tg == g && tb == b)
*dest++ = 0;
else
*dest++ = 255;
}
}
}

View File

@@ -88,7 +88,7 @@ typedef enum {
GDK_PIXBUF_ERROR_FAILED
} GdkPixbufError;
GQuark gdk_pixbuf_error_quark () G_GNUC_CONST;
GQuark gdk_pixbuf_error_quark (void) G_GNUC_CONST;

View File

@@ -3,11 +3,15 @@ EXPORTS
_gdk_pixbuf_get_named_module
_gdk_pixbuf_load_module
gdk_pixbuf_add_alpha
gdk_pixbuf_animation_get_frames
gdk_pixbuf_animation_get_height
gdk_pixbuf_animation_get_num_frames
gdk_pixbuf_animation_get_iter
gdk_pixbuf_animation_get_static_image
gdk_pixbuf_animation_get_type
gdk_pixbuf_animation_get_width
gdk_pixbuf_animation_is_static_image
gdk_pixbuf_animation_iter_advance
gdk_pixbuf_animation_iter_get_delay_time
gdk_pixbuf_animation_iter_get_pixbuf
gdk_pixbuf_animation_new_from_file
gdk_pixbuf_animation_ref
gdk_pixbuf_animation_unref
@@ -17,14 +21,6 @@ EXPORTS
gdk_pixbuf_copy
gdk_pixbuf_copy_area
gdk_pixbuf_error_quark
gdk_pixbuf_frame_copy
gdk_pixbuf_frame_free
gdk_pixbuf_frame_get_action
gdk_pixbuf_frame_get_delay_time
gdk_pixbuf_frame_get_pixbuf
gdk_pixbuf_frame_get_type
gdk_pixbuf_frame_get_x_offset
gdk_pixbuf_frame_get_y_offset
gdk_pixbuf_get_bits_per_sample
gdk_pixbuf_get_colorspace
gdk_pixbuf_get_has_alpha

View File

@@ -23,14 +23,6 @@
* Boston, MA 02111-1307, USA.
*/
/*
Known bugs:
* 4bpp compressed files don't work
* bi-tonal files aren't tested with palettes
*/
#include <config.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
@@ -72,6 +64,15 @@ struct BitmapInfoHeader {
guint biClrImportant;
};
/* biCompression values */
#define BI_RGB 0
#define BI_RLE8 1
#define BI_RLE4 2
#define BI_BITFIELDS 3
#define BI_JPEG 4
#define BI_PNG 5
/*
DumpBIH printf's the values in a BitmapInfoHeader to the screen, for
@@ -116,8 +117,9 @@ static void DumpBIH(unsigned char *BIH)
the current bitmap */
struct headerpair {
guint width;
guint height;
guint32 size;
gint32 width;
gint32 height;
guint depth;
guint Negative; /* Negative = 1 -> top down BMP,
Negative = 0 -> bottom up BMP */
@@ -125,17 +127,12 @@ struct headerpair {
/* Data needed for the "state" during decompression */
struct bmp_compression_state {
gint phase; /* 0 = clean,
1 = count received
2 = escape received
3 = in "raw" run
4 = Relative part 1 is next
5 = Relative part 2 is next
6 = end of image -> No more input allowed
*/
gint phase;
gint RunCount;
gint XDelta;
gint YDelta;
guchar *linebuff;
gint linebuffsize; /* these two counts in nibbles */
gint linebuffdone;
};
/* Progressive loading */
@@ -145,18 +142,19 @@ struct bmp_progressive_state {
ModuleUpdatedNotifyFunc updated_func;
gpointer user_data;
gint HeaderSize; /* The size of the header-part (incl colormap) */
guchar *HeaderBuf; /* The buffer for the header (incl colormap) */
gint HeaderDone; /* The nr of bytes actually in HeaderBuf */
guint LineWidth;
guint Lines; /* # of finished lines */
gint LineWidth; /* The width of a line in bytes */
guchar *LineBuf; /* Buffer for 1 line */
gint LineDone; /* # of bytes in LineBuf */
gint Lines; /* # of finished lines */
guchar *buff;
gint BufferSize;
gint BufferDone;
guchar (*Colormap)[3];
gint Type; /*
32 = RGB + alpha
24 = RGB
16 = RGB
4 = 4 bpp colormapped
8 = 8 bpp colormapped
1 = 1 bit bitonal
@@ -227,34 +225,38 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
struct bmp_progressive_state *State,
GError **error)
{
gboolean retval = TRUE;
/* FIXME this is totally unrobust against bogus image data. */
if (State->BufferSize < GUINT32_FROM_LE (* (guint32 *) &BIH[0]) + 14) {
State->BufferSize = GUINT32_FROM_LE (* (guint32 *) &BIH[0]) + 14;
State->buff = g_realloc (State->buff, State->BufferSize);
return TRUE;
}
#if DUMPBIH
DumpBIH(BIH);
#endif
State->Header.width =
(int) (BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) +
(BIH[4]);
State->Header.height =
(int) (BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) +
(BIH[8]);
State->Header.depth = (int) (BIH[15] << 8) + (BIH[14]);;
State->Header.size = GUINT32_FROM_LE (* (guint32 *) &BIH[0]);
if (State->Header.size == 40) {
State->Header.width = GINT32_FROM_LE (* (gint32 *) &BIH[4]);
State->Header.height = GINT32_FROM_LE (* (gint32 *) &BIH[8]);
State->Header.depth = GUINT16_FROM_LE (* (guint16 *) &BIH[14]);
State->Compressed = GUINT32_FROM_LE (* (guint32 *) &BIH[16]);
} else if (State->Header.size == 12) {
State->Header.width = GUINT16_FROM_LE (* (guint16 *) &BIH[4]);
State->Header.height = GUINT16_FROM_LE (* (guint16 *) &BIH[6]);
State->Header.depth = GUINT16_FROM_LE (* (guint16 *) &BIH[10]);
State->Compressed = 0;
} else {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has unsupported header size"));
return FALSE;
}
State->Type = State->Header.depth; /* This may be less trivial someday */
State->HeaderSize =
(int) ((BFH[13] << 24) + (BFH[12] << 16) + (BFH[11] << 8) +
(BFH[10]));
if (State->HeaderSize >= 14 + 40 + 1024)
State->HeaderBuf =
g_realloc(State->HeaderBuf, State->HeaderSize);
if ((BIH[16] != 0) || (BIH[17] != 0) || (BIH[18] != 0)
|| (BIH[19] != 0)) {
State->Compressed = 1;
}
/* Negative heights indicates bottom-down pixelorder */
if (State->Header.height < 0) {
@@ -266,28 +268,44 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
State->Header.Negative = 0;
}
if (State->Header.width == 0 || State->Header.height == 0 ||
(State->Compressed == BI_RLE4 && State->Type != 4) ||
(State->Compressed == BI_RLE8 && State->Type != 8) ||
State->Compressed > BI_RLE4) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data"));
return FALSE;
}
if (State->Type == 32)
State->LineWidth = State->Header.width * 4;
if (State->Type == 24)
else if (State->Type == 24)
State->LineWidth = State->Header.width * 3;
if (State->Type == 8)
else if (State->Type == 16)
State->LineWidth = State->Header.width * 2;
else if (State->Type == 8)
State->LineWidth = State->Header.width * 1;
if (State->Type == 4)
else if (State->Type == 4)
State->LineWidth = (State->Header.width + 1) / 2;
if (State->Type == 1) {
else if (State->Type == 1) {
State->LineWidth = State->Header.width / 8;
if ((State->Header.width & 7) != 0)
State->LineWidth++;
} else {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("BMP image has bogus header data"));
return FALSE;
}
/* Pad to a 32 bit boundary */
if (((State->LineWidth % 4) > 0) && (State->Compressed == 0))
if (((State->LineWidth % 4) > 0) && (State->Compressed == BI_RGB))
State->LineWidth = (State->LineWidth / 4) * 4 + 4;
if (State->LineBuf == NULL)
State->LineBuf = g_malloc(State->LineWidth);
if (State->pixbuf == NULL) {
if (State->Type == 32)
State->pixbuf =
@@ -305,7 +323,7 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load bitmap image"));
retval = FALSE;
return FALSE;
}
if (State->prepared_func != NULL)
@@ -314,7 +332,47 @@ static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
}
return retval;
if (State->Compressed != BI_RGB) {
State->compr.linebuffdone = 0;
State->compr.linebuffsize = State->Header.width;
if (State->Type == 8)
State->compr.linebuffsize *= 2;
State->compr.linebuff = g_malloc ((State->compr.linebuffsize + 1) / 2);
}
State->BufferDone = 0;
if (State->Type <= 8)
State->BufferSize = GUINT32_FROM_LE (* (guint32 *) &BFH[10]) - 14 - State->Header.size;
else if (State->Compressed != BI_RGB)
State->BufferSize = 2;
else
State->BufferSize = State->LineWidth;
State->buff = g_realloc (State->buff, State->BufferSize);
return TRUE;
}
static void DecodeColormap (guchar *buff,
struct bmp_progressive_state *State,
GError **error)
{
gint i;
State->Colormap = g_malloc ((1 << State->Header.depth) * sizeof (*State->Colormap));
for (i = 0; i < (1 << State->Header.depth); i++)
{
State->Colormap[i][0] = buff[i * (State->Header.size == 12 ? 3 : 4)];
State->Colormap[i][1] = buff[i * (State->Header.size == 12 ? 3 : 4) + 1];
State->Colormap[i][2] = buff[i * (State->Header.size == 12 ? 3 : 4) + 2];
}
State->BufferDone = 0;
if (State->Compressed != BI_RGB)
State->BufferSize = 2;
else
State->BufferSize = State->LineWidth;
State->buff = g_realloc (State->buff, State->BufferSize);
}
/*
@@ -336,16 +394,13 @@ gdk_pixbuf__bmp_image_begin_load(ModulePreparedNotifyFunc prepared_func,
context->updated_func = updated_func;
context->user_data = user_data;
context->HeaderSize = 54;
context->HeaderBuf = g_malloc(14 + 40 + 1024);
/* 14 for the BitmapFileHeader, 40 for the BitmapImageHeader and
1024 for the colormap */
context->BufferSize = 26;
context->buff = g_malloc(26);
context->BufferDone = 0;
/* 14 for the BitmapFileHeader, 12 for the BitmapImageHeader */
context->HeaderDone = 0;
context->Colormap = NULL;
context->LineWidth = 0;
context->LineBuf = NULL;
context->LineDone = 0;
context->Lines = 0;
context->Type = 0;
@@ -376,17 +431,16 @@ static gboolean gdk_pixbuf__bmp_image_stop_load(gpointer data, GError **error)
g_return_val_if_fail(context != NULL, TRUE);
if (context->LineBuf != NULL)
g_free(context->LineBuf);
context->LineBuf = NULL;
if (context->compr.linebuff != NULL)
g_free(context->compr.linebuff);
if (context->HeaderBuf != NULL)
g_free(context->HeaderBuf);
context->LineBuf = NULL;
if (context->Colormap != NULL)
g_free(context->Colormap);
if (context->pixbuf)
gdk_pixbuf_unref(context->pixbuf);
g_free(context->buff);
g_free(context);
return TRUE;
@@ -412,10 +466,10 @@ static void OneLine32(struct bmp_progressive_state *context)
context->pixbuf->rowstride *
context->Lines);
while (X < context->Header.width) {
Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
Pixels[X * 4 + 1] = context->LineBuf[X * 4 + 1];
Pixels[X * 4 + 2] = context->LineBuf[X * 4 + 0];
Pixels[X * 4 + 3] = context->LineBuf[X * 4 + 3];
Pixels[X * 4 + 0] = context->buff[X * 4 + 2];
Pixels[X * 4 + 1] = context->buff[X * 4 + 1];
Pixels[X * 4 + 2] = context->buff[X * 4 + 0];
Pixels[X * 4 + 3] = context->buff[X * 4 + 3];
X++;
}
@@ -436,14 +490,36 @@ static void OneLine24(struct bmp_progressive_state *context)
context->pixbuf->rowstride *
context->Lines);
while (X < context->Header.width) {
Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
Pixels[X * 3 + 1] = context->LineBuf[X * 3 + 1];
Pixels[X * 3 + 2] = context->LineBuf[X * 3 + 0];
Pixels[X * 3 + 0] = context->buff[X * 3 + 2];
Pixels[X * 3 + 1] = context->buff[X * 3 + 1];
Pixels[X * 3 + 2] = context->buff[X * 3 + 0];
X++;
}
}
static void OneLine16(struct bmp_progressive_state *context)
{
gint X;
guchar *Pixels;
X = 0;
if (context->Header.Negative == 0)
Pixels = (context->pixbuf->pixels +
context->pixbuf->rowstride *
(context->Header.height - context->Lines - 1));
else
Pixels = (context->pixbuf->pixels +
context->pixbuf->rowstride *
context->Lines);
while (X < context->Header.width) {
Pixels[X * 3 + 0] = (GUINT16_FROM_LE (* (guint16 *) &context->buff[X * 2]) & 0x7C00) >> 7;
Pixels[X * 3 + 1] = (GUINT16_FROM_LE (* (guint16 *) &context->buff[X * 2]) & 0x03E0) >> 2;
Pixels[X * 3 + 2] = (GUINT16_FROM_LE (* (guint16 *) &context->buff[X * 2]) & 0x001F) << 3;
X++;
}
}
static void OneLine8(struct bmp_progressive_state *context)
{
gint X;
@@ -460,11 +536,11 @@ static void OneLine8(struct bmp_progressive_state *context)
context->Lines);
while (X < context->Header.width) {
Pixels[X * 3 + 0] =
context->HeaderBuf[4 * context->LineBuf[X] + 56];
context->Colormap[context->buff[X]][2];
Pixels[X * 3 + 1] =
context->HeaderBuf[4 * context->LineBuf[X] + 55];
context->Colormap[context->buff[X]][1];
Pixels[X * 3 + 2] =
context->HeaderBuf[4 * context->LineBuf[X] + 54];
context->Colormap[context->buff[X]][0];
X++;
}
}
@@ -487,23 +563,23 @@ static void OneLine4(struct bmp_progressive_state *context)
while (X < context->Header.width) {
guchar Pix;
Pix = context->LineBuf[X / 2];
Pix = context->buff[X / 2];
Pixels[X * 3 + 0] =
context->HeaderBuf[4 * (Pix >> 4) + 56];
context->Colormap[Pix >> 4][2];
Pixels[X * 3 + 1] =
context->HeaderBuf[4 * (Pix >> 4) + 55];
context->Colormap[Pix >> 4][1];
Pixels[X * 3 + 2] =
context->HeaderBuf[4 * (Pix >> 4) + 54];
context->Colormap[Pix >> 4][0];
X++;
if (X < context->Header.width) {
/* Handle the other 4 bit pixel only when there is one */
Pixels[X * 3 + 0] =
context->HeaderBuf[4 * (Pix & 15) + 56];
context->Colormap[Pix & 15][2];
Pixels[X * 3 + 1] =
context->HeaderBuf[4 * (Pix & 15) + 55];
context->Colormap[Pix & 15][1];
Pixels[X * 3 + 2] =
context->HeaderBuf[4 * (Pix & 15) + 54];
context->Colormap[Pix & 15][0];
X++;
}
}
@@ -527,11 +603,11 @@ static void OneLine1(struct bmp_progressive_state *context)
while (X < context->Header.width) {
gint Bit;
Bit = (context->LineBuf[X / 8]) >> (7 - (X & 7));
Bit = (context->buff[X / 8]) >> (7 - (X & 7));
Bit = Bit & 1;
Pixels[X * 3 + 0] = Bit * 255;
Pixels[X * 3 + 1] = Bit * 255;
Pixels[X * 3 + 2] = Bit * 255;
Pixels[X * 3 + 0] = context->Colormap[Bit][2];
Pixels[X * 3 + 1] = context->Colormap[Bit][1];
Pixels[X * 3 + 2] = context->Colormap[Bit][0];
X++;
}
}
@@ -539,7 +615,7 @@ static void OneLine1(struct bmp_progressive_state *context)
static void OneLine(struct bmp_progressive_state *context)
{
context->LineDone = 0;
context->BufferDone = 0;
if (context->Lines >= context->Header.height)
return;
@@ -547,6 +623,8 @@ static void OneLine(struct bmp_progressive_state *context)
OneLine32(context);
if (context->Type == 24)
OneLine24(context);
if (context->Type == 16)
OneLine16(context);
if (context->Type == 8)
OneLine8(context);
if (context->Type == 4)
@@ -567,147 +645,131 @@ static void OneLine(struct bmp_progressive_state *context)
}
}
/* DoCompressedByte handles 1 byte of incomming compressed data */
static void
DoCompressedByte(struct bmp_progressive_state *context, guchar ** buf,
gint * size)
DoCompressed(struct bmp_progressive_state *context)
{
gint BytesToCopy;
gint count, pos;
switch (context->compr.phase) {
case 0: /* Neutral state */
if ((*buf)[0] != 0) { /* run count */
context->compr.phase = 1;
context->compr.RunCount = (*buf)[0];
if (context->buff[0] != 0) { /* run count */
context->compr.RunCount = context->buff[0];
if (context->Type == 8)
context->compr.RunCount *= 2;
while (context->compr.RunCount > 0) {
if (context->compr.linebuffdone & 1) {
guchar *ptr = context->compr.linebuff +
context->compr.linebuffdone / 2;
*ptr = (*ptr & 0xF0) | (context->buff[1] >> 4);
context->buff[1] = (context->buff[1] << 4) |
(context->buff[1] >> 4);
context->compr.linebuffdone++;
context->compr.RunCount--;
}
if (context->compr.RunCount) {
count = context->compr.linebuffsize -
context->compr.linebuffdone;
if (count > context->compr.RunCount)
count = context->compr.RunCount;
memset (context->compr.linebuff +
context->compr.linebuffdone / 2,
context->buff[1],
(count + 1) / 2);
context->compr.RunCount -= count;
context->compr.linebuffdone += count;
}
if (context->compr.linebuffdone == context->compr.linebuffsize) {
guchar *tmp = context->buff;
context->buff = context->compr.linebuff;
OneLine (context);
context->buff = tmp;
if (context->compr.linebuffdone & 1)
context->buff[1] = (context->buff[1] << 4) |
(context->buff[1] >> 4);
context->compr.linebuffdone = 0;
}
}
} else { /* Escape */
context->compr.phase = 2;
}
(*buf)++;
(*size)--;
break;
case 1: /* Run count received.... */
while (context->compr.RunCount > 0) {
BytesToCopy =
context->LineWidth - context->LineDone;
if (BytesToCopy > context->compr.RunCount)
BytesToCopy = context->compr.RunCount;
if (BytesToCopy > 0) {
memset(context->LineBuf +
context->LineDone, (*buf)[0],
BytesToCopy);
if (context->buff[1] == 0) { /* End of line */
if (context->compr.linebuffdone) {
guchar *tmp = context->buff;
context->buff = context->compr.linebuff;
OneLine (context);
context->buff = tmp;
context->compr.RunCount -= BytesToCopy;
context->LineDone += BytesToCopy;
context->compr.linebuffdone = 0;
}
} else if (context->buff[1] == 1) { /* End of image */
if (context->compr.linebuffdone) {
guchar *tmp = context->buff;
context->buff = context->compr.linebuff;
OneLine (context);
context->buff = tmp;
}
context->compr.phase = 2;
} else if (context->buff[1] == 2) /* Cursor displacement */
; /* not implemented */
else {
context->compr.phase = 1;
context->compr.RunCount = context->buff[1];
if (context->Type == 8)
context->compr.RunCount *= 2;
context->BufferSize = (context->compr.RunCount + 3) / 4 * 2;
context->buff = g_realloc (context->buff, context->BufferSize);
}
if ((context->LineDone >= context->LineWidth)
&& (context->LineWidth > 0)) {
OneLine(context);
}
context->BufferDone = 0;
break;
case 1:
pos = 0;
while (pos < context->compr.RunCount) {
count = context->compr.linebuffsize - context->compr.linebuffdone;
if (count > context->compr.RunCount)
count = context->compr.RunCount;
if ((context->compr.linebuffdone & 1) || (pos & 1)) {
gint i, newval;
guchar *ptr;
for (i = 0; i < count; i++) {
ptr = context->compr.linebuff + (i +
context->compr.linebuffdone) / 2;
newval = *(context->buff + (pos + i) / 2) & (0xf0 >> (((pos + i) % 2) * 4));
if (((pos + i) % 2) ^ ((context->compr.linebuffdone + i) % 2)) {
if ((pos + i) % 2)
newval <<= 4;
else
newval >>= 4;
}
*ptr = (*ptr & (0xf << (((i + context->compr.linebuffdone) % 2) * 4))) | newval;
}
} else {
memmove (context->compr.linebuff +
context->compr.linebuffdone / 2,
context->buff + pos / 2,
(count + 1) / 2);
}
pos += count;
context->compr.linebuffdone += count;
if (context->compr.linebuffdone == context->compr.linebuffsize) {
guchar *tmp = context->buff;
context->buff = context->compr.linebuff;
OneLine (context);
context->buff = tmp;
context->compr.linebuffdone = 0;
}
}
context->compr.phase = 0;
(*buf)++;
(*size)--;
context->BufferSize = 2;
context->buff = g_realloc (context->buff, context->BufferSize);
context->BufferDone = 0;
break;
case 2: /* Escape received */
if ((*buf)[0] == 0) { /* End of line */
context->compr.phase = 0;
if (context->LineDone > 0)
OneLine(context);
} else if ((*buf)[0] == 1) { /* End of image */
OneLine(context);
context->compr.phase = 6;
(*size) = 0;
break;
} else if ((*buf)[0] == 2) { /* Cursor displacement */
context->compr.phase = 4;
} else {
context->compr.phase = 3;
context->compr.RunCount = (*buf)[0];
if (context->compr.RunCount & 1)
context->compr.phase = 7;
}
(*buf)++;
(*size)--;
break;
case 3:
while ((context->compr.RunCount > 0)
&& (*size > 0)) {
BytesToCopy =
context->LineWidth - context->LineDone;
if (BytesToCopy > context->compr.RunCount)
BytesToCopy = context->compr.RunCount;
if (BytesToCopy > *size)
BytesToCopy = *size;
if (BytesToCopy > 0) {
memcpy(context->LineBuf +
context->LineDone, *buf,
BytesToCopy);
context->compr.RunCount -= BytesToCopy;
(*buf) += BytesToCopy;
(*size) -= BytesToCopy;
context->LineDone += BytesToCopy;
}
if ((context->LineDone >= context->LineWidth)
&& (context->LineWidth > 0))
OneLine(context);
}
if (context->compr.RunCount <= 0)
context->compr.phase = 0;
break;
case 4:
context->compr.phase = 5;
context->compr.XDelta = (*buf)[0];
(*buf)++;
(*size)--;
break;
case 5:
context->compr.phase = 0;
context->compr.YDelta = (*buf)[0];
g_assert(0); /* No implementatio of this yet */
/* If this happens, please email me (arjan@fenrus.demon.nl)
the image concerned. */
(*buf)++;
(*size)--;
break;
case 6:
(*size) = 0;
break;
case 7: /* Odd raw run */
while ((context->compr.RunCount > 0) && (*size > 0)) {
BytesToCopy =
context->LineWidth - context->LineDone;
if (BytesToCopy > context->compr.RunCount)
BytesToCopy = context->compr.RunCount;
if (BytesToCopy > *size)
BytesToCopy = *size;
if (BytesToCopy > 0) {
memcpy(context->LineBuf +
context->LineDone, *buf,
BytesToCopy);
context->compr.RunCount -= BytesToCopy;
(*buf) += BytesToCopy;
(*size) -= BytesToCopy;
context->LineDone += BytesToCopy;
}
if ((context->LineDone >= context->LineWidth)
&& (context->LineWidth > 0))
OneLine(context);
}
if (context->compr.RunCount <= 0)
context->compr.phase = 8;
break;
case 8: /* Eat dummy byte; */
(*buf)++;
(*size)--;
context->compr.phase = 0;
case 2:
context->BufferDone = 0;
break;
}
}
@@ -731,55 +793,37 @@ gdk_pixbuf__bmp_image_load_increment(gpointer data,
gint BytesToCopy;
while (size > 0) {
g_assert(context->LineDone >= 0);
if (context->HeaderDone < context->HeaderSize) { /* We still
if (context->BufferDone < context->BufferSize) { /* We still
have headerbytes to do */
BytesToCopy =
context->HeaderSize - context->HeaderDone;
context->BufferSize - context->BufferDone;
if (BytesToCopy > size)
BytesToCopy = size;
memmove(context->HeaderBuf + context->HeaderDone,
memmove(context->buff + context->BufferDone,
buf, BytesToCopy);
size -= BytesToCopy;
buf += BytesToCopy;
context->HeaderDone += BytesToCopy;
} else if (context->Compressed) {
/* Compression is done 1 byte at a time for now */
DoCompressedByte(context, &buf, &size);
} else {
/* Uncompressed pixeldata */
BytesToCopy =
context->LineWidth - context->LineDone;
if (BytesToCopy > size)
BytesToCopy = size;
if (BytesToCopy > 0) {
memmove(context->LineBuf +
context->LineDone, buf,
BytesToCopy);
size -= BytesToCopy;
buf += BytesToCopy;
context->LineDone += BytesToCopy;
}
if ((context->LineDone >= context->LineWidth)
&& (context->LineWidth > 0))
OneLine(context);
context->BufferDone += BytesToCopy;
if (context->BufferDone != context->BufferSize)
break;
}
if (context->HeaderDone >= 14 + 40)
if (!DecodeHeader(context->HeaderBuf,
context->HeaderBuf + 14, context,
error))
return FALSE;
if (!context->Header.size) {
if (!DecodeHeader (context->buff,
context->buff + 14, context,
error))
return FALSE;
}
else if (context->Type <= 8 && context->Colormap == NULL)
DecodeColormap (context->buff, context, error);
else if (context->Compressed != BI_RGB)
DoCompressed(context);
else
/* Uncompressed pixeldata */
OneLine(context);
}
return TRUE;

View File

@@ -123,7 +123,6 @@ struct _GifContext
unsigned int frame_bit_pixel;
unsigned int aspect_ratio;
GdkPixbuf *pixbuf;
GdkPixbufGifAnim *animation;
GdkPixbufFrame *frame;
Gif89 gif89;
@@ -198,10 +197,10 @@ static int count = 0;
/* Returns TRUE if read is OK,
* FALSE if more memory is needed. */
static int
static gboolean
gif_read (GifContext *context, guchar *buffer, size_t len)
{
gint retval;
gboolean retval;
#ifdef IO_GIFDEBUG
gint i;
#endif
@@ -586,9 +585,13 @@ lzw_read_byte (GifContext *context)
int count;
unsigned char buf[260];
/*g_error (" DID WE EVER EVER GET HERE\n");*/
g_warning ("Unhandled Case. If you have an image that causes this, let me <jrb@redhat.com> know.\n");
/* FIXME - we should handle this case */
g_set_error (context->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("GIF image loader can't understand this image."));
return -2;
if (ZeroDataBlock) {
return -2;
}
@@ -735,7 +738,15 @@ gif_get_lzw (GifContext *context)
8,
context->frame_len,
context->frame_height);
if (!context->frame->pixbuf) {
g_free (context->frame);
g_set_error (context->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file"));
return -2;
}
context->frame->x_offset = context->x_offset;
context->frame->y_offset = context->y_offset;
context->frame->need_recomposite = TRUE;
@@ -962,6 +973,14 @@ gif_prepare_lzw (GifContext *context)
/*g_message (_("GIF: EOF / read error on image data\n"));*/
return -1;
}
if (context->lzw_set_code_size > MAX_LZW_BITS) {
g_set_error (context->error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("GIF image is corrupt (incorrect LZW compression)"));
return -2;
}
context->lzw_code_size = context->lzw_set_code_size + 1;
context->lzw_clear_code = 1 << context->lzw_set_code_size;
@@ -974,6 +993,9 @@ gif_prepare_lzw (GifContext *context)
context->code_last_byte = 0;
context->code_done = FALSE;
g_assert (context->lzw_clear_code <=
G_N_ELEMENTS (context->lzw_table[0]));
for (i = 0; i < context->lzw_clear_code; ++i) {
context->lzw_table[0][i] = 0;
context->lzw_table[1][i] = i;
@@ -1188,7 +1210,7 @@ gif_get_next_step (GifContext *context)
}
#define LOG(x)
#define LOG(x) /* g_print ("%d: %s\n", __LINE__, x); */
static gint
gif_main_loop (GifContext *context)
@@ -1269,8 +1291,12 @@ new_context (void)
{
GifContext *context;
context = g_new0 (GifContext, 1);
context = g_try_malloc (sizeof (GifContext));
if (context == NULL)
return NULL;
memset (context, 0, sizeof (GifContext));
context->animation = g_object_new (GDK_TYPE_PIXBUF_GIF_ANIM, NULL);
context->frame = NULL;
context->file = NULL;
@@ -1297,6 +1323,15 @@ gdk_pixbuf__gif_image_load (FILE *file, GError **error)
g_return_val_if_fail (file != NULL, NULL);
context = new_context ();
if (context == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file"));
return NULL;
}
context->file = file;
context->error = error;
@@ -1333,6 +1368,15 @@ gdk_pixbuf__gif_image_begin_load (ModulePreparedNotifyFunc prepare_func,
count = 0;
#endif
context = new_context ();
if (context == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file"));
return NULL;
}
context->error = error;
context->prepare_func = prepare_func;
context->update_func = update_func;
@@ -1401,8 +1445,10 @@ gdk_pixbuf__gif_image_load_increment (gpointer data,
retval = gif_main_loop (context);
if (retval == -2)
if (retval == -2) {
context->buf = NULL;
return FALSE;
}
if (retval == -1) {
/* we didn't have enough memory */
/* prepare for the next image_load_increment */
@@ -1437,6 +1483,14 @@ gdk_pixbuf__gif_image_load_animation (FILE *file,
context = new_context ();
if (context == NULL) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Not enough memory to load GIF file"));
return NULL;
}
context->error = error;
context->file = file;

View File

@@ -1,3 +1,4 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/* GdkPixbuf library - PNG image loader
*
* Copyright (C) 1999 Mark Crichton
@@ -403,7 +404,8 @@ gdk_pixbuf__png_image_stop_load (gpointer context, GError **error)
* we have unused image data
*/
gdk_pixbuf_unref(lc->pixbuf);
if (lc->pixbuf)
gdk_pixbuf_unref (lc->pixbuf);
png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
g_free(lc);
@@ -606,6 +608,8 @@ png_error_callback(png_structp png_read_ptr,
_("Fatal error reading PNG image file: %s"),
error_msg);
}
longjmp (png_read_ptr->jmpbuf, 1);
}
static void
@@ -639,7 +643,8 @@ gdk_pixbuf__png_image_save (FILE *f,
guchar *ptr;
guchar *pixels;
int x, y, j;
png_bytep row_ptr, data = NULL;
png_bytep row_ptr;
png_bytep data;
png_color_8 sig_bit;
int w, h, rowstride;
int has_alpha;
@@ -661,6 +666,7 @@ gdk_pixbuf__png_image_save (FILE *f,
}
#endif
}
data = NULL;
bpc = gdk_pixbuf_get_bits_per_sample (pixbuf);
w = gdk_pixbuf_get_width (pixbuf);

View File

@@ -195,7 +195,14 @@ pnm_skip_whitespace (PnmIOBuffer *inbuf, GError **error)
for ( ; inptr < inend; inptr++) {
if (*inptr == '#') {
/* in comment - skip to the end of this line */
for ( ; *inptr != '\n' && inptr < inend; inptr++);
for ( ; *inptr != '\n' && inptr < inend; inptr++)
;
if ( *inptr != '\n' ) {
/* couldn't read whole comment */
return PNM_SUSPEND;
}
} else if (!isspace (*inptr)) {
inbuf->byte = inptr;
inbuf->nbytes = (guint) (inend - inptr);

View File

@@ -1,3 +1,4 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
/* GdkPixbuf library - TIFF image loader
*
* Copyright (C) 1999 Mark Crichton
@@ -6,6 +7,7 @@
* Authors: Mark Crichton <crichton@gimp.org>
* Federico Mena-Quintero <federico@gimp.org>
* Jonathan Blandford <jrb@redhat.com>
* S<>ren Sandmann <sandmann@daimi.au.dk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -42,103 +44,197 @@
#endif
typedef struct _TiffData TiffData;
struct _TiffData
typedef struct _TiffContext TiffContext;
struct _TiffContext
{
ModulePreparedNotifyFunc prepare_func;
ModuleUpdatedNotifyFunc update_func;
gpointer user_data;
gchar *tempname;
FILE *file;
gboolean all_okay;
guchar *buffer;
guint allocated;
guint used;
guint pos;
};
static GdkPixbuf *
gdk_pixbuf__tiff_image_load_real (FILE *f, TiffData *context, GError **error)
/* There's no user data for the error handlers, so we just have to
* put a big-ass lock on the whole TIFF loader
*/
G_LOCK_DEFINE_STATIC (tiff_loader);
static char *global_error = NULL;
static TIFFErrorHandler orig_error_handler = NULL;
static TIFFErrorHandler orig_warning_handler = NULL;
static void
tiff_warning_handler (const char *mod, const char *fmt, va_list ap)
{
/* Don't print anything; we should not be dumping junk to
* stderr, since that may be bad for some apps.
*/
/* libTIFF seems to occasionally warn about things that
* are really errors, so maybe we should just call tiff_error_handler
* here.
*/
}
static void
tiff_error_handler (const char *mod, const char *fmt, va_list ap)
{
if (global_error) {
/* Blah, loader called us twice */
return;
}
global_error = g_strdup_vprintf (fmt, ap);
}
static void
tiff_push_handlers (void)
{
if (global_error)
g_warning ("TIFF loader left crufty global_error around, FIXME");
orig_error_handler = TIFFSetErrorHandler (tiff_error_handler);
orig_warning_handler = TIFFSetWarningHandler (tiff_warning_handler);
}
static void
tiff_pop_handlers (void)
{
if (global_error)
g_warning ("TIFF loader left crufty global_error around, FIXME");
TIFFSetErrorHandler (orig_error_handler);
TIFFSetWarningHandler (orig_warning_handler);
}
static void
tiff_set_error (GError **error,
int error_code,
const char *msg)
{
/* Take the error message from libtiff and merge it with
* some context we provide.
*/
g_set_error (error,
GDK_PIXBUF_ERROR,
error_code,
"%s%s%s",
msg, global_error ? ": " : "", global_error);
if (global_error) {
g_free (global_error);
global_error = NULL;
}
}
static GdkPixbuf *
tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
{
TIFF *tiff;
guchar *pixels = NULL;
guchar *tmppix;
gint w, h, x, y, num_pixs, fd;
uint32 *rast, *tmp_rast;
gint w, h, x, y, num_pixs;
GdkPixbuf *pixbuf;
fd = fileno (f);
tiff = TIFFFdOpen (fd, "libpixbuf-tiff", "r");
if (!tiff) {
/* We're called with the lock held. */
g_return_val_if_fail (global_error == NULL, NULL);
if (!TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &w) || global_error) {
tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED,
_("Could not get image width (bad TIFF file)"));
return NULL;
}
if (!TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &h) || global_error) {
tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED,
_("Could not get image height (bad TIFF file)"));
return NULL;
}
num_pixs = w * h;
if (num_pixs == 0) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Failed to open TIFF image"));
return NULL;
_("Width or height of TIFF image is zero"));
return NULL;
}
TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &h);
num_pixs = w * h;
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, w, h);
if (!pixbuf) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
TIFFClose (tiff);
return NULL;
return NULL;
}
G_UNLOCK (tiff_loader);
if (context)
(* context->prepare_func) (pixbuf, NULL, context->user_data);
G_LOCK (tiff_loader);
/* Yes, it needs to be _TIFFMalloc... */
rast = (uint32 *) _TIFFmalloc (num_pixs * sizeof (uint32));
rast = (uint32 *) _TIFFmalloc (num_pixs * sizeof (uint32));
if (!rast) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
TIFFClose (tiff);
return NULL;
return NULL;
}
if (!TIFFReadRGBAImage (tiff, w, h, rast, 0) || global_error) {
tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED,
_("Failed to load RGB data from TIFF file"));
_TIFFfree (rast);
if (TIFFReadRGBAImage (tiff, w, h, rast, 0)) {
pixels = gdk_pixbuf_get_pixels (pixbuf);
return NULL;
}
pixels = gdk_pixbuf_get_pixels (pixbuf);
g_assert (pixels);
tmppix = pixels;
for (y = 0; y < h; y++) {
/* Unexplainable...are tiffs backwards? */
/* Also looking at the GIMP plugin, this
* whole reading thing can be a bit more
* robust.
*/
tmp_rast = rast + ((h - y - 1) * w);
for (x = 0; x < w; x++) {
tmppix[0] = TIFFGetR (*tmp_rast);
tmppix[1] = TIFFGetG (*tmp_rast);
tmppix[2] = TIFFGetB (*tmp_rast);
tmppix[3] = TIFFGetA (*tmp_rast);
tmp_rast++;
tmppix += 4;
}
}
g_assert (pixels);
tmppix = pixels;
_TIFFfree (rast);
for (y = 0; y < h; y++) {
/* Unexplainable...are tiffs backwards? */
/* Also looking at the GIMP plugin, this
* whole reading thing can be a bit more
* robust.
*/
tmp_rast = rast + ((h - y - 1) * w);
for (x = 0; x < w; x++) {
tmppix[0] = TIFFGetR (*tmp_rast);
tmppix[1] = TIFFGetG (*tmp_rast);
tmppix[2] = TIFFGetB (*tmp_rast);
tmppix[3] = TIFFGetA (*tmp_rast);
tmp_rast++;
tmppix += 4;
}
}
}
_TIFFfree (rast);
TIFFClose (tiff);
if (context) {
G_UNLOCK (tiff_loader);
if (context)
(* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
gdk_pixbuf_unref (pixbuf);
}
return pixbuf;
G_LOCK (tiff_loader);
return pixbuf;
}
@@ -148,17 +244,49 @@ gdk_pixbuf__tiff_image_load_real (FILE *f, TiffData *context, GError **error)
static GdkPixbuf *
gdk_pixbuf__tiff_image_load (FILE *f, GError **error)
{
return gdk_pixbuf__tiff_image_load_real (f, NULL, error);
TIFF *tiff;
int fd;
GdkPixbuf *pixbuf;
g_return_val_if_fail (f != NULL, NULL);
G_LOCK (tiff_loader);
tiff_push_handlers ();
fd = fileno (f);
tiff = TIFFFdOpen (fd, "libpixbuf-tiff", "r");
if (!tiff) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
_("Failed to open TIFF image"));
tiff_pop_handlers ();
G_UNLOCK (tiff_loader);
return NULL;
}
pixbuf = tiff_image_parse (tiff, NULL, error);
TIFFClose (tiff);
if (global_error) {
tiff_set_error (error,
GDK_PIXBUF_ERROR_FAILED,
_("TIFFClose operation failed"));
}
tiff_pop_handlers ();
G_UNLOCK (tiff_loader);
return pixbuf;
}
/* Progressive loader */
/*
* Tiff loading progressively cannot be done. We write it to a file, then load
* the file when it's done. It's not pretty.
*/
static gpointer
gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func,
@@ -166,54 +294,165 @@ gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func,
gpointer user_data,
GError **error)
{
TiffData *context;
gint fd;
context = g_new (TiffData, 1);
TiffContext *context;
context = g_new0 (TiffContext, 1);
context->prepare_func = prepare_func;
context->update_func = update_func;
context->user_data = user_data;
context->all_okay = TRUE;
fd = g_file_open_tmp ("gdkpixbuf-tif-tmp.XXXXXX", &context->tempname,
NULL);
if (fd < 0) {
g_free (context);
return NULL;
}
context->file = fdopen (fd, "w");
if (context->file == NULL) {
g_free (context->tempname);
g_free (context);
return NULL;
}
context->buffer = NULL;
context->allocated = 0;
context->used = 0;
context->pos = 0;
return context;
}
static tsize_t
tiff_read (thandle_t handle, tdata_t buf, tsize_t size)
{
TiffContext *context = (TiffContext *)handle;
if (context->pos + size > context->used)
return 0;
memcpy (buf, context->buffer + context->pos, size);
context->pos += size;
return size;
}
static tsize_t
tiff_write (thandle_t handle, tdata_t buf, tsize_t size)
{
return -1;
}
static toff_t
tiff_seek (thandle_t handle, toff_t offset, int whence)
{
TiffContext *context = (TiffContext *)handle;
switch (whence) {
case SEEK_SET:
if (offset > context->used || offset < 0)
return -1;
context->pos = offset;
break;
case SEEK_CUR:
if (offset + context->pos >= context->used)
return -1;
context->pos += offset;
break;
case SEEK_END:
if (offset + context->used > context->used)
return -1;
context->pos = context->used + offset;
break;
default:
return -1;
break;
}
return context->pos;
}
static int
tiff_close (thandle_t context)
{
return 0;
}
static toff_t
tiff_size (thandle_t handle)
{
TiffContext *context = (TiffContext *)handle;
return context->used;
}
static int
tiff_map_file (thandle_t handle, tdata_t *buf, toff_t *size)
{
TiffContext *context = (TiffContext *)handle;
*buf = context->buffer;
*size = context->used;
return 0;
}
static void
tiff_unmap_file (thandle_t handle, tdata_t data, toff_t offset)
{
}
static gboolean
gdk_pixbuf__tiff_image_stop_load (gpointer data,
GError **error)
{
TiffData *context = (TiffData*) data;
gboolean retval = FALSE;
TiffContext *context = data;
TIFF *tiff;
gboolean retval;
g_return_val_if_fail (data != NULL, TRUE);
g_return_val_if_fail (data != NULL, FALSE);
fflush (context->file);
rewind (context->file);
if (context->all_okay) {
G_LOCK (tiff_loader);
tiff_push_handlers ();
tiff = TIFFClientOpen ("libtiff-pixbuf", "r", data,
tiff_read, tiff_write,
tiff_seek, tiff_close,
tiff_size,
tiff_map_file, tiff_unmap_file);
if (!tiff) {
g_set_error (error,
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_FAILED,
_("Failed to load TIFF image"));
retval = FALSE;
} else {
GdkPixbuf *pixbuf;
pixbuf = gdk_pixbuf__tiff_image_load_real (context->file, context, error);
if (pixbuf != NULL)
retval = TRUE;
pixbuf = tiff_image_parse (tiff, context, error);
if (pixbuf)
g_object_unref (G_OBJECT (pixbuf));
retval = pixbuf != NULL;
TIFFClose (tiff);
}
if (global_error)
g_warning ("Error left set in TIFF loader\n");
g_free (context->buffer);
g_free (context);
fclose (context->file);
unlink (context->tempname);
g_free (context->tempname);
g_free ((TiffData *) context);
tiff_pop_handlers ();
G_UNLOCK (tiff_loader);
return retval;
}
static gboolean
make_available_at_least (TiffContext *context, guint needed)
{
guchar *new_buffer = NULL;
guint need_alloc;
need_alloc = context->used + needed;
if (need_alloc > context->allocated) {
guint new_size = 1;
while (new_size < need_alloc)
new_size *= 2;
new_buffer = g_try_realloc (context->buffer, new_size);
if (new_buffer) {
context->buffer = new_buffer;
context->allocated = new_size;
return TRUE;
}
return FALSE;
}
return TRUE;
}
@@ -221,28 +460,28 @@ static gboolean
gdk_pixbuf__tiff_image_load_increment (gpointer data, const guchar *buf,
guint size, GError **error)
{
TiffData *context = (TiffData *) data;
TiffContext *context = (TiffContext *) data;
g_return_val_if_fail (data != NULL, FALSE);
if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
context->all_okay = FALSE;
if (!make_available_at_least (context, size)) {
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
_("Failed to write to temporary file when loading TIFF image"));
return FALSE;
}
GDK_PIXBUF_ERROR,
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
_("Insufficient memory to open TIFF file"));
return FALSE;
}
memcpy (context->buffer + context->used, buf, size);
context->used += size;
return TRUE;
}
void
gdk_pixbuf__tiff_fill_vtable (GdkPixbufModule *module)
{
module->load = gdk_pixbuf__tiff_image_load;
module->begin_load = gdk_pixbuf__tiff_image_begin_load;
module->stop_load = gdk_pixbuf__tiff_image_stop_load;
module->load_increment = gdk_pixbuf__tiff_image_load_increment;
module->load = gdk_pixbuf__tiff_image_load;
module->begin_load = gdk_pixbuf__tiff_image_begin_load;
module->stop_load = gdk_pixbuf__tiff_image_stop_load;
module->load_increment = gdk_pixbuf__tiff_image_load_increment;
}

2362
gdk-pixbuf/test-images.h Normal file

File diff suppressed because it is too large Load Diff

445
gdk-pixbuf/test-loaders.c Normal file
View File

@@ -0,0 +1,445 @@
/* -*- Mode: C; c-basic-offset: 2; -*- */
/* GdkPixbuf library - test loaders
*
* Copyright (C) 2001 S<>ren Sandmann (sandmann@daimi.au.dk)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include "gdk-pixbuf.h"
#include <stdio.h>
#include <stdlib.h>
#include "test-images.h"
#include <time.h>
#include <string.h>
#define PRETEND_MEM_SIZE (16 * 1024 * 1024)
#define REMAINING_MEM_SIZE 5000
static int current_allocation = 0;
static int max_allocation = 0;
#define HEADER_SPACE sizeof(void*)
static gpointer
record_bytes (gpointer mem, gsize bytes)
{
if (mem == NULL ||
(current_allocation + bytes) > max_allocation)
{
if (mem)
free (mem);
return NULL;
}
*(void **)mem = GINT_TO_POINTER (bytes);
g_assert (GPOINTER_TO_INT (*(void**)mem) == bytes);
g_assert (current_allocation >= 0);
current_allocation += bytes;
g_assert (current_allocation >= 0);
g_assert ( mem == (void*) ((((char*)mem) + HEADER_SPACE) - HEADER_SPACE) );
return ((char*)mem) + HEADER_SPACE;
}
static gpointer
limited_try_malloc (gsize n_bytes)
{
return record_bytes (malloc (n_bytes + HEADER_SPACE), n_bytes);
}
static gpointer
limited_malloc (gsize n_bytes)
{
return limited_try_malloc (n_bytes);
}
static gpointer
limited_calloc (gsize n_blocks,
gsize n_block_bytes)
{
int bytes = n_blocks * n_block_bytes + HEADER_SPACE;
gpointer mem = malloc (bytes);
memset (mem, 0, bytes);
return record_bytes (mem, n_blocks * n_block_bytes);
}
static void
limited_free (gpointer mem)
{
gpointer real = ((char*)mem) - HEADER_SPACE;
g_assert (current_allocation >= 0);
current_allocation -= GPOINTER_TO_INT (*(void**)real);
g_assert (current_allocation >= 0);
free (real);
}
static gpointer
limited_try_realloc (gpointer mem,
gsize n_bytes)
{
if (mem == NULL)
{
return limited_try_malloc (n_bytes);
}
else
{
gpointer real;
g_assert (mem);
real = ((char*)mem) - HEADER_SPACE;
g_assert (current_allocation >= 0);
current_allocation -= GPOINTER_TO_INT (*(void**)real);
g_assert (current_allocation >= 0);
return record_bytes (realloc (real, n_bytes + HEADER_SPACE), n_bytes);
}
}
static gpointer
limited_realloc (gpointer mem,
gsize n_bytes)
{
return limited_try_realloc (mem, n_bytes);
}
static GMemVTable limited_table = {
limited_malloc,
limited_realloc,
limited_free,
limited_calloc,
limited_try_malloc,
limited_try_realloc
};
static gboolean
test_loader (const guchar *bytes, gsize len, gboolean data_is_ok)
{
GdkPixbufLoader *loader;
GError *err = NULL;
gboolean did_fail = FALSE;
loader = gdk_pixbuf_loader_new ();
gdk_pixbuf_loader_write (loader, bytes, len, &err);
if (err)
{
g_error_free (err);
err = NULL;
did_fail = TRUE;
}
gdk_pixbuf_loader_close (loader, NULL);
if (err)
{
g_error_free (err);
err = NULL;
did_fail = TRUE;
}
g_object_unref (G_OBJECT (loader));
if (data_is_ok == did_fail)
return FALSE;
else
return TRUE;
}
static void
mem_test (const guchar *bytes, gsize len)
{
gboolean did_fail = FALSE;
GError *err = NULL;
GdkPixbufLoader *loader;
GList *loaders = NULL;
GList *i;
do {
loader = gdk_pixbuf_loader_new ();
gdk_pixbuf_loader_write (loader, bytes, len, &err);
if (err)
{
g_error_free (err);
err = NULL;
did_fail = TRUE;
}
gdk_pixbuf_loader_close (loader, NULL);
if (err)
{
g_error_free (err);
err = NULL;
did_fail = TRUE;
}
loaders = g_list_prepend (loaders, loader);
} while (!did_fail);
for (i = loaders; i != NULL; i = i->next)
g_object_unref (G_OBJECT (i->data));
g_list_free (loaders);
}
void
assault (const gchar *header, gsize header_size,
int n_images, gboolean verbose)
{
enum { N_CHARACTERS = 10000 };
int j;
for (j = 0; j < n_images; ++j)
{
GError *err = NULL;
int i;
GdkPixbufLoader *loader;
if (verbose)
g_print ("'img' no: %d\n", j);
loader = gdk_pixbuf_loader_new ();
gdk_pixbuf_loader_write (loader, header, header_size, &err);
if (err)
{
g_error_free (err);
continue;
}
for (i = 0; i < N_CHARACTERS; ++i)
{
int r = g_random_int ();
if (verbose)
{
int j;
for (j = 0; j < sizeof (r); j++)
g_print ("%u, ", ((guchar *)&r)[j]);
}
gdk_pixbuf_loader_write (loader, (guchar *)&r, sizeof (r), &err);
if (err)
{
g_error_free (err);
err = NULL;
break;
}
}
if (verbose)
g_print ("\n");
gdk_pixbuf_loader_close (loader, &err);
if (err)
{
g_error_free (err);
err = NULL;
}
g_object_unref (G_OBJECT (loader));
}
}
static void
randomly_modify (const guchar *image, guint size, gboolean verbose)
{
int i;
guchar *img_copy = g_malloc (size);
for (i = 0; i < size; i++)
img_copy [i] = image[i];
for (i = 0; i < size / 4; i++)
{
int j;
guint index = rand () % size;
guchar byte = rand () % 256;
img_copy[index] = byte;
if (verbose)
g_print ("%d\n", i);
if (verbose)
for (j = 0; j < size; j++)
g_print ("%u, ", img_copy[j]);
test_loader (img_copy, size, FALSE);
}
g_free (img_copy);
}
#define TEST(bytes, data_is_ok) \
do { \
g_print ("%-30s", " " #bytes " "); \
fflush (stdout); \
if (test_loader (bytes, sizeof (bytes), data_is_ok)) \
g_print ("\tpassed\n"); \
else \
g_print ("\tFAILED\n"); \
} while (0)
#define LOWMEMTEST(bytes) \
do { \
g_print ("%-30s", "memory " #bytes " "); \
fflush (stdout); \
mem_test (bytes, sizeof (bytes)); \
g_print ("\tpassed\n"); \
} while (0)
#define TEST_RANDOM(header, n_img, verbose) \
do { \
static guchar h[] = { header }; \
g_print ("%-30s", "random " #header " "); \
fflush (stdout); \
assault (h, sizeof (h), n_img, verbose); \
g_print ("\tpassed\n"); \
} while (0);
#define TEST_RANDOMLY_MODIFIED(image, verbose) \
do { \
g_print ("%-30s", "randomly modified " #image " "); \
fflush (stdout); \
randomly_modify (image, sizeof (image), verbose); \
g_print ("\tpassed\n"); \
} while (0);
static void
almost_exhaust_memory (void)
{
gpointer x = g_malloc (REMAINING_MEM_SIZE);
while (g_try_malloc (REMAINING_MEM_SIZE / 10))
;
g_free (x);
}
static void
write_seed (int seed)
{
FILE *f;
/* write this so you can reproduce failed tests */
f = fopen ("test-loaders-seed", "w");
if (!f)
{
perror ("fopen");
exit (EXIT_FAILURE);
}
if (fprintf (f, "%d\n", seed) < 0)
{
perror ("fprintf");
exit (EXIT_FAILURE);
}
if (fclose (f) < 0)
{
perror ("fclose");
exit (EXIT_FAILURE);
}
g_print ("seed: %d\n", seed);
}
int
main (int argc, char **argv)
{
int seed;
/* Set a malloc which emulates low mem */
max_allocation = G_MAXINT;
g_mem_set_vtable (&limited_table);
if (argc > 1)
seed = atoi (argv[1]);
else
{
seed = time (NULL);
write_seed (seed);
}
g_random_set_seed (seed);
g_type_init (G_TYPE_DEBUG_NONE);
g_log_set_fatal_mask (NULL, G_LOG_LEVEL_WARNING | G_LOG_LEVEL_ERROR | G_LOG_LEVEL_CRITICAL);
putenv ("GDK_PIXBUF_MODULEDIR="BUILT_MODULES_DIR);
TEST (valid_gif_test, TRUE);
TEST (gif_test_1, FALSE);
TEST (gif_test_2, FALSE);
TEST (gif_test_3, FALSE);
TEST (gif_test_4, FALSE);
TEST (valid_png_test, TRUE);
TEST (png_test_1, FALSE);
#if 0
TEST (png_test_2, FALSE);
#endif
TEST (valid_jpeg_test, TRUE);
TEST (valid_tiff1_test, TRUE);
TEST (tiff1_test_1, FALSE);
#if 0
TEST_RANDOMLY_MODIFIED (valid_gif_test, FALSE); // these all break more or
TEST_RANDOMLY_MODIFIED (valid_png_test, FALSE); // less spectacularly, patched or not
TEST_RANDOMLY_MODIFIED (valid_tiff1_test, FALSE);
#endif
TEST_RANDOMLY_MODIFIED (valid_jpeg_test, FALSE); // The jpeg loader does not break
#if 0
TEST_RANDOM (GIF_HEADER, 150, FALSE);
TEST_RANDOM (PNG_HEADER, 10000, FALSE);
TEST_RANDOM (JPEG_HEADER, 8000, FALSE);
TEST_RANDOM (TIFF1_HEADER, 150, FALSE);
TEST_RANDOM (TIFF2_HEADER, 150, FALSE);
#endif
/* memory tests */
/* How do the loaders behave when memory is low?
It depends on the state the above tests left the
memory in.
- Sometimes the png loader tries to report an
"out of memory", but then g_strdup_printf() calls
g_malloc(), which fails.
- There are unchecked realloc()s inside libtiff, which means it
will never work with low memory, unless something drastic is
done, like allocating a lot of memory upfront and release it
before entering libtiff. Also, some TIFFReadRGBAImage calls
returns successfully, even though they have called the error
handler with an 'out of memory' message.
*/
max_allocation = PRETEND_MEM_SIZE;
almost_exhaust_memory ();
g_print ("Allocated %dK of %dK, %dK free during tests\n",
current_allocation / 1024, max_allocation / 1024,
(max_allocation - current_allocation) / 1024);
#if 0
LOWMEMTEST (valid_tiff1_test);
#endif
LOWMEMTEST (valid_gif_test);
LOWMEMTEST (valid_png_test);
LOWMEMTEST (valid_jpeg_test);
return 0;
}

View File

@@ -33,7 +33,6 @@ LDFLAGS = @STRIP_BEGIN@ \
@LIBTOOL_EXPORT_OPTIONS@ \
$(top_builddir)/gdk-pixbuf/libgdk_pixbuf-1.3.la \
@GDK_DEP_LIBS@ \
-lm \
@STRIP_END@
#
@@ -70,6 +69,9 @@ gdk_public_h_sources = @STRIP_BEGIN@ \
gdktypes.h \
gdkvisual.h \
gdkwindow.h \
gdkdisplay.h \
gdkscreen.h \
gdkdisplaymgr.h \
@STRIP_END@
gdk_headers = @STRIP_BEGIN@ \
@@ -102,6 +104,9 @@ gdk_c_sources = @STRIP_BEGIN@ \
gdkregion-generic.c \
gdkregion-generic.h \
gdkwindow.c \
gdkdisplay.c \
gdkscreen.c \
gdkdisplaymgr.c \
@STRIP_END@
#

View File

@@ -74,7 +74,8 @@ static const GDebugKey gdk_debug_keys[] = {
{"misc", GDK_DEBUG_MISC},
{"dnd", GDK_DEBUG_DND},
{"color-context", GDK_DEBUG_COLOR_CONTEXT},
{"xim", GDK_DEBUG_XIM}
{"xim", GDK_DEBUG_XIM},
{"multihead", GDK_DEBUG_MULTIHEAD}
};
static const int gdk_ndebug_keys = sizeof(gdk_debug_keys)/sizeof(GDebugKey);
@@ -273,7 +274,8 @@ gdk_init_check (int *argc,
gchar **argv_orig = NULL;
gint argc_orig = 0;
GdkArgContext *arg_context;
gboolean result;
GdkDisplay *display;
GdkScreen *screen;
int i;
if (gdk_initialized)
@@ -323,22 +325,23 @@ gdk_init_check (int *argc,
GDK_NOTE (MISC, g_message ("progname: \"%s\"", g_get_prgname ()));
g_type_init (0);
result = _gdk_windowing_init_check (argc_orig, argv_orig);
display = _gdk_windowing_init_check (argc_orig, argv_orig);
for (i = 0; i < argc_orig; i++)
g_free(argv_orig[i]);
g_free(argv_orig);
if (!result)
if (!display)
return FALSE;
screen = GDK_DISPLAY_GET_CLASS(display)->get_default_screen(display);
gdk_visual_init ();
_gdk_windowing_window_init ();
_gdk_windowing_image_init ();
gdk_events_init ();
_gdk_visual_init (screen);
_gdk_windowing_window_init(screen);
_gdk_windowing_image_init (display);
gdk_events_init (display);
gdk_input_init ();
gdk_dnd_init ();
gdk_dnd_init (display);
gdk_initialized = 1;
@@ -350,7 +353,7 @@ gdk_init (int *argc, char ***argv)
{
if (!gdk_init_check (argc, argv))
{
g_warning ("cannot open display: %s", gdk_get_display ());
g_warning ("cannot open display: %s", gdk_get_display_arg_name ());
exit(1);
}
}

View File

@@ -48,6 +48,8 @@
#include <gdk/gdktypes.h>
#include <gdk/gdkvisual.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdkdisplay.h>
#include <gdk/gdkscreen.h>
#include <gdk/gdkcompat.h>
@@ -73,12 +75,10 @@ gchar* gdk_set_locale (void);
*/
void gdk_error_trap_push (void);
gint gdk_error_trap_pop (void);
void gdk_set_use_xshm (gboolean use_xshm);
gboolean gdk_get_use_xshm (void);
gchar* gdk_get_display (void);
gchar* gdk_get_display_arg_name (void);
#ifndef GDK_DISABLE_DEPRECATED
gint gdk_input_add_full (gint source,
@@ -108,11 +108,11 @@ gboolean gdk_pointer_is_grabbed (void);
gint gdk_screen_width (void) G_GNUC_CONST;
gint gdk_screen_height (void) G_GNUC_CONST;
gint gdk_screen_width_mm (void) G_GNUC_CONST;
gint gdk_screen_height_mm (void) G_GNUC_CONST;
void gdk_flush (void);
void gdk_beep (void);
void gdk_set_double_click_time (guint msec);
@@ -126,9 +126,11 @@ void gdk_rectangle_union (GdkRectangle *src1,
GdkRectangle *src2,
GdkRectangle *dest);
#define GDK_TYPE_RECTANGLE (gdk_rectangle_get_type ())
/* Conversion functions between wide char and multibyte strings.
*/
gchar *gdk_wcstombs (const GdkWChar *src);
gchar *gdk_wcstombs (const GdkWChar *src);
gint gdk_mbstowcs (GdkWChar *dest,
const gchar *src,
gint dest_max);

View File

@@ -25,7 +25,8 @@
*/
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
#include "gdkcolor.h"
#include "gdkinternals.h"
@@ -248,3 +249,912 @@ gdk_visual_get_type (void)
return our_type;
}
/* Color parsing
*/
/* The following 2 routines (parse_color, find_color) come from Tk, via the Win32
* port of GDK. The licensing terms on these (longer than the functions) is:
*
* This software is copyrighted by the Regents of the University of
* California, Sun Microsystems, Inc., and other parties. The following
* terms apply to all files associated with the software unless explicitly
* disclaimed in individual files.
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice is included verbatim in any distributions. No written agreement,
* license, or royalty fee is required for any of the authorized uses.
* Modifications to this software may be copyrighted by their authors
* and need not follow the licensing terms described here, provided that
* the new terms are clearly indicated on the first page of each file where
* they apply.
*
* IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
* FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
* ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
* DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
* IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
* NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
* MODIFICATIONS.
*
* GOVERNMENT USE: If you are acquiring this software on behalf of the
* U.S. government, the Government shall have only "Restricted Rights"
* in the software and related documentation as defined in the Federal
* Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
* are acquiring the software on behalf of the Department of Defense, the
* software shall be classified as "Commercial Computer Software" and the
* Government shall have only "Restricted Rights" as defined in Clause
* 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
* authors grant the U.S. Government and others acting in its behalf
* permission to use and distribute the software in accordance with the
* terms specified in this license.
*/
typedef struct {
const char *name;
unsigned char red;
unsigned char green;
unsigned char blue;
} ColorEntry;
static ColorEntry xColors[] = {
{ "alice blue", 240, 248, 255 },
{ "AliceBlue", 240, 248, 255 },
{ "antique white", 250, 235, 215 },
{ "AntiqueWhite", 250, 235, 215 },
{ "AntiqueWhite1", 255, 239, 219 },
{ "AntiqueWhite2", 238, 223, 204 },
{ "AntiqueWhite3", 205, 192, 176 },
{ "AntiqueWhite4", 139, 131, 120 },
{ "aquamarine", 127, 255, 212 },
{ "aquamarine1", 127, 255, 212 },
{ "aquamarine2", 118, 238, 198 },
{ "aquamarine3", 102, 205, 170 },
{ "aquamarine4", 69, 139, 116 },
{ "azure", 240, 255, 255 },
{ "azure1", 240, 255, 255 },
{ "azure2", 224, 238, 238 },
{ "azure3", 193, 205, 205 },
{ "azure4", 131, 139, 139 },
{ "beige", 245, 245, 220 },
{ "bisque", 255, 228, 196 },
{ "bisque1", 255, 228, 196 },
{ "bisque2", 238, 213, 183 },
{ "bisque3", 205, 183, 158 },
{ "bisque4", 139, 125, 107 },
{ "black", 0, 0, 0 },
{ "blanched almond", 255, 235, 205 },
{ "BlanchedAlmond", 255, 235, 205 },
{ "blue", 0, 0, 255 },
{ "blue violet", 138, 43, 226 },
{ "blue1", 0, 0, 255 },
{ "blue2", 0, 0, 238 },
{ "blue3", 0, 0, 205 },
{ "blue4", 0, 0, 139 },
{ "BlueViolet", 138, 43, 226 },
{ "brown", 165, 42, 42 },
{ "brown1", 255, 64, 64 },
{ "brown2", 238, 59, 59 },
{ "brown3", 205, 51, 51 },
{ "brown4", 139, 35, 35 },
{ "burlywood", 222, 184, 135 },
{ "burlywood1", 255, 211, 155 },
{ "burlywood2", 238, 197, 145 },
{ "burlywood3", 205, 170, 125 },
{ "burlywood4", 139, 115, 85 },
{ "cadet blue", 95, 158, 160 },
{ "CadetBlue", 95, 158, 160 },
{ "CadetBlue1", 152, 245, 255 },
{ "CadetBlue2", 142, 229, 238 },
{ "CadetBlue3", 122, 197, 205 },
{ "CadetBlue4", 83, 134, 139 },
{ "chartreuse", 127, 255, 0 },
{ "chartreuse1", 127, 255, 0 },
{ "chartreuse2", 118, 238, 0 },
{ "chartreuse3", 102, 205, 0 },
{ "chartreuse4", 69, 139, 0 },
{ "chocolate", 210, 105, 30 },
{ "chocolate1", 255, 127, 36 },
{ "chocolate2", 238, 118, 33 },
{ "chocolate3", 205, 102, 29 },
{ "chocolate4", 139, 69, 19 },
{ "coral", 255, 127, 80 },
{ "coral1", 255, 114, 86 },
{ "coral2", 238, 106, 80 },
{ "coral3", 205, 91, 69 },
{ "coral4", 139, 62, 47 },
{ "cornflower blue", 100, 149, 237 },
{ "CornflowerBlue", 100, 149, 237 },
{ "cornsilk", 255, 248, 220 },
{ "cornsilk1", 255, 248, 220 },
{ "cornsilk2", 238, 232, 205 },
{ "cornsilk3", 205, 200, 177 },
{ "cornsilk4", 139, 136, 120 },
{ "cyan", 0, 255, 255 },
{ "cyan1", 0, 255, 255 },
{ "cyan2", 0, 238, 238 },
{ "cyan3", 0, 205, 205 },
{ "cyan4", 0, 139, 139 },
{ "dark blue", 0, 0, 139 },
{ "dark cyan", 0, 139, 139 },
{ "dark goldenrod", 184, 134, 11 },
{ "dark gray", 169, 169, 169 },
{ "dark green", 0, 100, 0 },
{ "dark grey", 169, 169, 169 },
{ "dark khaki", 189, 183, 107 },
{ "dark magenta", 139, 0, 139 },
{ "dark olive green", 85, 107, 47 },
{ "dark orange", 255, 140, 0 },
{ "dark orchid", 153, 50, 204 },
{ "dark red", 139, 0, 0 },
{ "dark salmon", 233, 150, 122 },
{ "dark sea green", 143, 188, 143 },
{ "dark slate blue", 72, 61, 139 },
{ "dark slate gray", 47, 79, 79 },
{ "dark slate grey", 47, 79, 79 },
{ "dark turquoise", 0, 206, 209 },
{ "dark violet", 148, 0, 211 },
{ "DarkBlue", 0, 0, 139 },
{ "DarkCyan", 0, 139, 139 },
{ "DarkGoldenrod", 184, 134, 11 },
{ "DarkGoldenrod1", 255, 185, 15 },
{ "DarkGoldenrod2", 238, 173, 14 },
{ "DarkGoldenrod3", 205, 149, 12 },
{ "DarkGoldenrod4", 139, 101, 8 },
{ "DarkGray", 169, 169, 169 },
{ "DarkGreen", 0, 100, 0 },
{ "DarkGrey", 169, 169, 169 },
{ "DarkKhaki", 189, 183, 107 },
{ "DarkMagenta", 139, 0, 139 },
{ "DarkOliveGreen", 85, 107, 47 },
{ "DarkOliveGreen1", 202, 255, 112 },
{ "DarkOliveGreen2", 188, 238, 104 },
{ "DarkOliveGreen3", 162, 205, 90 },
{ "DarkOliveGreen4", 110, 139, 61 },
{ "DarkOrange", 255, 140, 0 },
{ "DarkOrange1", 255, 127, 0 },
{ "DarkOrange2", 238, 118, 0 },
{ "DarkOrange3", 205, 102, 0 },
{ "DarkOrange4", 139, 69, 0 },
{ "DarkOrchid", 153, 50, 204 },
{ "DarkOrchid1", 191, 62, 255 },
{ "DarkOrchid2", 178, 58, 238 },
{ "DarkOrchid3", 154, 50, 205 },
{ "DarkOrchid4", 104, 34, 139 },
{ "DarkRed", 139, 0, 0 },
{ "DarkSalmon", 233, 150, 122 },
{ "DarkSeaGreen", 143, 188, 143 },
{ "DarkSeaGreen1", 193, 255, 193 },
{ "DarkSeaGreen2", 180, 238, 180 },
{ "DarkSeaGreen3", 155, 205, 155 },
{ "DarkSeaGreen4", 105, 139, 105 },
{ "DarkSlateBlue", 72, 61, 139 },
{ "DarkSlateGray", 47, 79, 79 },
{ "DarkSlateGray1", 151, 255, 255 },
{ "DarkSlateGray2", 141, 238, 238 },
{ "DarkSlateGray3", 121, 205, 205 },
{ "DarkSlateGray4", 82, 139, 139 },
{ "DarkSlateGrey", 47, 79, 79 },
{ "DarkTurquoise", 0, 206, 209 },
{ "DarkViolet", 148, 0, 211 },
{ "deep pink", 255, 20, 147 },
{ "deep sky blue", 0, 191, 255 },
{ "DeepPink", 255, 20, 147 },
{ "DeepPink1", 255, 20, 147 },
{ "DeepPink2", 238, 18, 137 },
{ "DeepPink3", 205, 16, 118 },
{ "DeepPink4", 139, 10, 80 },
{ "DeepSkyBlue", 0, 191, 255 },
{ "DeepSkyBlue1", 0, 191, 255 },
{ "DeepSkyBlue2", 0, 178, 238 },
{ "DeepSkyBlue3", 0, 154, 205 },
{ "DeepSkyBlue4", 0, 104, 139 },
{ "dim gray", 105, 105, 105 },
{ "dim grey", 105, 105, 105 },
{ "DimGray", 105, 105, 105 },
{ "DimGrey", 105, 105, 105 },
{ "dodger blue", 30, 144, 255 },
{ "DodgerBlue", 30, 144, 255 },
{ "DodgerBlue1", 30, 144, 255 },
{ "DodgerBlue2", 28, 134, 238 },
{ "DodgerBlue3", 24, 116, 205 },
{ "DodgerBlue4", 16, 78, 139 },
{ "firebrick", 178, 34, 34 },
{ "firebrick1", 255, 48, 48 },
{ "firebrick2", 238, 44, 44 },
{ "firebrick3", 205, 38, 38 },
{ "firebrick4", 139, 26, 26 },
{ "floral white", 255, 250, 240 },
{ "FloralWhite", 255, 250, 240 },
{ "forest green", 34, 139, 34 },
{ "ForestGreen", 34, 139, 34 },
{ "gainsboro", 220, 220, 220 },
{ "ghost white", 248, 248, 255 },
{ "GhostWhite", 248, 248, 255 },
{ "gold", 255, 215, 0 },
{ "gold1", 255, 215, 0 },
{ "gold2", 238, 201, 0 },
{ "gold3", 205, 173, 0 },
{ "gold4", 139, 117, 0 },
{ "goldenrod", 218, 165, 32 },
{ "goldenrod1", 255, 193, 37 },
{ "goldenrod2", 238, 180, 34 },
{ "goldenrod3", 205, 155, 29 },
{ "goldenrod4", 139, 105, 20 },
{ "gray", 190, 190, 190 },
{ "gray0", 0, 0, 0 },
{ "gray1", 3, 3, 3 },
{ "gray10", 26, 26, 26 },
{ "gray100", 255, 255, 255 },
{ "gray11", 28, 28, 28 },
{ "gray12", 31, 31, 31 },
{ "gray13", 33, 33, 33 },
{ "gray14", 36, 36, 36 },
{ "gray15", 38, 38, 38 },
{ "gray16", 41, 41, 41 },
{ "gray17", 43, 43, 43 },
{ "gray18", 46, 46, 46 },
{ "gray19", 48, 48, 48 },
{ "gray2", 5, 5, 5 },
{ "gray20", 51, 51, 51 },
{ "gray21", 54, 54, 54 },
{ "gray22", 56, 56, 56 },
{ "gray23", 59, 59, 59 },
{ "gray24", 61, 61, 61 },
{ "gray25", 64, 64, 64 },
{ "gray26", 66, 66, 66 },
{ "gray27", 69, 69, 69 },
{ "gray28", 71, 71, 71 },
{ "gray29", 74, 74, 74 },
{ "gray3", 8, 8, 8 },
{ "gray30", 77, 77, 77 },
{ "gray31", 79, 79, 79 },
{ "gray32", 82, 82, 82 },
{ "gray33", 84, 84, 84 },
{ "gray34", 87, 87, 87 },
{ "gray35", 89, 89, 89 },
{ "gray36", 92, 92, 92 },
{ "gray37", 94, 94, 94 },
{ "gray38", 97, 97, 97 },
{ "gray39", 99, 99, 99 },
{ "gray4", 10, 10, 10 },
{ "gray40", 102, 102, 102 },
{ "gray41", 105, 105, 105 },
{ "gray42", 107, 107, 107 },
{ "gray43", 110, 110, 110 },
{ "gray44", 112, 112, 112 },
{ "gray45", 115, 115, 115 },
{ "gray46", 117, 117, 117 },
{ "gray47", 120, 120, 120 },
{ "gray48", 122, 122, 122 },
{ "gray49", 125, 125, 125 },
{ "gray5", 13, 13, 13 },
{ "gray50", 127, 127, 127 },
{ "gray51", 130, 130, 130 },
{ "gray52", 133, 133, 133 },
{ "gray53", 135, 135, 135 },
{ "gray54", 138, 138, 138 },
{ "gray55", 140, 140, 140 },
{ "gray56", 143, 143, 143 },
{ "gray57", 145, 145, 145 },
{ "gray58", 148, 148, 148 },
{ "gray59", 150, 150, 150 },
{ "gray6", 15, 15, 15 },
{ "gray60", 153, 153, 153 },
{ "gray61", 156, 156, 156 },
{ "gray62", 158, 158, 158 },
{ "gray63", 161, 161, 161 },
{ "gray64", 163, 163, 163 },
{ "gray65", 166, 166, 166 },
{ "gray66", 168, 168, 168 },
{ "gray67", 171, 171, 171 },
{ "gray68", 173, 173, 173 },
{ "gray69", 176, 176, 176 },
{ "gray7", 18, 18, 18 },
{ "gray70", 179, 179, 179 },
{ "gray71", 181, 181, 181 },
{ "gray72", 184, 184, 184 },
{ "gray73", 186, 186, 186 },
{ "gray74", 189, 189, 189 },
{ "gray75", 191, 191, 191 },
{ "gray76", 194, 194, 194 },
{ "gray77", 196, 196, 196 },
{ "gray78", 199, 199, 199 },
{ "gray79", 201, 201, 201 },
{ "gray8", 20, 20, 20 },
{ "gray80", 204, 204, 204 },
{ "gray81", 207, 207, 207 },
{ "gray82", 209, 209, 209 },
{ "gray83", 212, 212, 212 },
{ "gray84", 214, 214, 214 },
{ "gray85", 217, 217, 217 },
{ "gray86", 219, 219, 219 },
{ "gray87", 222, 222, 222 },
{ "gray88", 224, 224, 224 },
{ "gray89", 227, 227, 227 },
{ "gray9", 23, 23, 23 },
{ "gray90", 229, 229, 229 },
{ "gray91", 232, 232, 232 },
{ "gray92", 235, 235, 235 },
{ "gray93", 237, 237, 237 },
{ "gray94", 240, 240, 240 },
{ "gray95", 242, 242, 242 },
{ "gray96", 245, 245, 245 },
{ "gray97", 247, 247, 247 },
{ "gray98", 250, 250, 250 },
{ "gray99", 252, 252, 252 },
{ "green", 0, 255, 0 },
{ "green yellow", 173, 255, 47 },
{ "green1", 0, 255, 0 },
{ "green2", 0, 238, 0 },
{ "green3", 0, 205, 0 },
{ "green4", 0, 139, 0 },
{ "GreenYellow", 173, 255, 47 },
{ "grey", 190, 190, 190 },
{ "grey0", 0, 0, 0 },
{ "grey1", 3, 3, 3 },
{ "grey10", 26, 26, 26 },
{ "grey100", 255, 255, 255 },
{ "grey11", 28, 28, 28 },
{ "grey12", 31, 31, 31 },
{ "grey13", 33, 33, 33 },
{ "grey14", 36, 36, 36 },
{ "grey15", 38, 38, 38 },
{ "grey16", 41, 41, 41 },
{ "grey17", 43, 43, 43 },
{ "grey18", 46, 46, 46 },
{ "grey19", 48, 48, 48 },
{ "grey2", 5, 5, 5 },
{ "grey20", 51, 51, 51 },
{ "grey21", 54, 54, 54 },
{ "grey22", 56, 56, 56 },
{ "grey23", 59, 59, 59 },
{ "grey24", 61, 61, 61 },
{ "grey25", 64, 64, 64 },
{ "grey26", 66, 66, 66 },
{ "grey27", 69, 69, 69 },
{ "grey28", 71, 71, 71 },
{ "grey29", 74, 74, 74 },
{ "grey3", 8, 8, 8 },
{ "grey30", 77, 77, 77 },
{ "grey31", 79, 79, 79 },
{ "grey32", 82, 82, 82 },
{ "grey33", 84, 84, 84 },
{ "grey34", 87, 87, 87 },
{ "grey35", 89, 89, 89 },
{ "grey36", 92, 92, 92 },
{ "grey37", 94, 94, 94 },
{ "grey38", 97, 97, 97 },
{ "grey39", 99, 99, 99 },
{ "grey4", 10, 10, 10 },
{ "grey40", 102, 102, 102 },
{ "grey41", 105, 105, 105 },
{ "grey42", 107, 107, 107 },
{ "grey43", 110, 110, 110 },
{ "grey44", 112, 112, 112 },
{ "grey45", 115, 115, 115 },
{ "grey46", 117, 117, 117 },
{ "grey47", 120, 120, 120 },
{ "grey48", 122, 122, 122 },
{ "grey49", 125, 125, 125 },
{ "grey5", 13, 13, 13 },
{ "grey50", 127, 127, 127 },
{ "grey51", 130, 130, 130 },
{ "grey52", 133, 133, 133 },
{ "grey53", 135, 135, 135 },
{ "grey54", 138, 138, 138 },
{ "grey55", 140, 140, 140 },
{ "grey56", 143, 143, 143 },
{ "grey57", 145, 145, 145 },
{ "grey58", 148, 148, 148 },
{ "grey59", 150, 150, 150 },
{ "grey6", 15, 15, 15 },
{ "grey60", 153, 153, 153 },
{ "grey61", 156, 156, 156 },
{ "grey62", 158, 158, 158 },
{ "grey63", 161, 161, 161 },
{ "grey64", 163, 163, 163 },
{ "grey65", 166, 166, 166 },
{ "grey66", 168, 168, 168 },
{ "grey67", 171, 171, 171 },
{ "grey68", 173, 173, 173 },
{ "grey69", 176, 176, 176 },
{ "grey7", 18, 18, 18 },
{ "grey70", 179, 179, 179 },
{ "grey71", 181, 181, 181 },
{ "grey72", 184, 184, 184 },
{ "grey73", 186, 186, 186 },
{ "grey74", 189, 189, 189 },
{ "grey75", 191, 191, 191 },
{ "grey76", 194, 194, 194 },
{ "grey77", 196, 196, 196 },
{ "grey78", 199, 199, 199 },
{ "grey79", 201, 201, 201 },
{ "grey8", 20, 20, 20 },
{ "grey80", 204, 204, 204 },
{ "grey81", 207, 207, 207 },
{ "grey82", 209, 209, 209 },
{ "grey83", 212, 212, 212 },
{ "grey84", 214, 214, 214 },
{ "grey85", 217, 217, 217 },
{ "grey86", 219, 219, 219 },
{ "grey87", 222, 222, 222 },
{ "grey88", 224, 224, 224 },
{ "grey89", 227, 227, 227 },
{ "grey9", 23, 23, 23 },
{ "grey90", 229, 229, 229 },
{ "grey91", 232, 232, 232 },
{ "grey92", 235, 235, 235 },
{ "grey93", 237, 237, 237 },
{ "grey94", 240, 240, 240 },
{ "grey95", 242, 242, 242 },
{ "grey96", 245, 245, 245 },
{ "grey97", 247, 247, 247 },
{ "grey98", 250, 250, 250 },
{ "grey99", 252, 252, 252 },
{ "honeydew", 240, 255, 240 },
{ "honeydew1", 240, 255, 240 },
{ "honeydew2", 224, 238, 224 },
{ "honeydew3", 193, 205, 193 },
{ "honeydew4", 131, 139, 131 },
{ "hot pink", 255, 105, 180 },
{ "HotPink", 255, 105, 180 },
{ "HotPink1", 255, 110, 180 },
{ "HotPink2", 238, 106, 167 },
{ "HotPink3", 205, 96, 144 },
{ "HotPink4", 139, 58, 98 },
{ "indian red", 205, 92, 92 },
{ "IndianRed", 205, 92, 92 },
{ "IndianRed1", 255, 106, 106 },
{ "IndianRed2", 238, 99, 99 },
{ "IndianRed3", 205, 85, 85 },
{ "IndianRed4", 139, 58, 58 },
{ "ivory", 255, 255, 240 },
{ "ivory1", 255, 255, 240 },
{ "ivory2", 238, 238, 224 },
{ "ivory3", 205, 205, 193 },
{ "ivory4", 139, 139, 131 },
{ "khaki", 240, 230, 140 },
{ "khaki1", 255, 246, 143 },
{ "khaki2", 238, 230, 133 },
{ "khaki3", 205, 198, 115 },
{ "khaki4", 139, 134, 78 },
{ "lavender", 230, 230, 250 },
{ "lavender blush", 255, 240, 245 },
{ "LavenderBlush", 255, 240, 245 },
{ "LavenderBlush1", 255, 240, 245 },
{ "LavenderBlush2", 238, 224, 229 },
{ "LavenderBlush3", 205, 193, 197 },
{ "LavenderBlush4", 139, 131, 134 },
{ "lawn green", 124, 252, 0 },
{ "LawnGreen", 124, 252, 0 },
{ "lemon chiffon", 255, 250, 205 },
{ "LemonChiffon", 255, 250, 205 },
{ "LemonChiffon1", 255, 250, 205 },
{ "LemonChiffon2", 238, 233, 191 },
{ "LemonChiffon3", 205, 201, 165 },
{ "LemonChiffon4", 139, 137, 112 },
{ "light blue", 173, 216, 230 },
{ "light coral", 240, 128, 128 },
{ "light cyan", 224, 255, 255 },
{ "light goldenrod", 238, 221, 130 },
{ "light goldenrod yellow", 250, 250, 210 },
{ "light gray", 211, 211, 211 },
{ "light green", 144, 238, 144 },
{ "light grey", 211, 211, 211 },
{ "light pink", 255, 182, 193 },
{ "light salmon", 255, 160, 122 },
{ "light sea green", 32, 178, 170 },
{ "light sky blue", 135, 206, 250 },
{ "light slate blue", 132, 112, 255 },
{ "light slate gray", 119, 136, 153 },
{ "light slate grey", 119, 136, 153 },
{ "light steel blue", 176, 196, 222 },
{ "light yellow", 255, 255, 224 },
{ "LightBlue", 173, 216, 230 },
{ "LightBlue1", 191, 239, 255 },
{ "LightBlue2", 178, 223, 238 },
{ "LightBlue3", 154, 192, 205 },
{ "LightBlue4", 104, 131, 139 },
{ "LightCoral", 240, 128, 128 },
{ "LightCyan", 224, 255, 255 },
{ "LightCyan1", 224, 255, 255 },
{ "LightCyan2", 209, 238, 238 },
{ "LightCyan3", 180, 205, 205 },
{ "LightCyan4", 122, 139, 139 },
{ "LightGoldenrod", 238, 221, 130 },
{ "LightGoldenrod1", 255, 236, 139 },
{ "LightGoldenrod2", 238, 220, 130 },
{ "LightGoldenrod3", 205, 190, 112 },
{ "LightGoldenrod4", 139, 129, 76 },
{ "LightGoldenrodYellow", 250, 250, 210 },
{ "LightGray", 211, 211, 211 },
{ "LightGreen", 144, 238, 144 },
{ "LightGrey", 211, 211, 211 },
{ "LightPink", 255, 182, 193 },
{ "LightPink1", 255, 174, 185 },
{ "LightPink2", 238, 162, 173 },
{ "LightPink3", 205, 140, 149 },
{ "LightPink4", 139, 95, 101 },
{ "LightSalmon", 255, 160, 122 },
{ "LightSalmon1", 255, 160, 122 },
{ "LightSalmon2", 238, 149, 114 },
{ "LightSalmon3", 205, 129, 98 },
{ "LightSalmon4", 139, 87, 66 },
{ "LightSeaGreen", 32, 178, 170 },
{ "LightSkyBlue", 135, 206, 250 },
{ "LightSkyBlue1", 176, 226, 255 },
{ "LightSkyBlue2", 164, 211, 238 },
{ "LightSkyBlue3", 141, 182, 205 },
{ "LightSkyBlue4", 96, 123, 139 },
{ "LightSlateBlue", 132, 112, 255 },
{ "LightSlateGray", 119, 136, 153 },
{ "LightSlateGrey", 119, 136, 153 },
{ "LightSteelBlue", 176, 196, 222 },
{ "LightSteelBlue1", 202, 225, 255 },
{ "LightSteelBlue2", 188, 210, 238 },
{ "LightSteelBlue3", 162, 181, 205 },
{ "LightSteelBlue4", 110, 123, 139 },
{ "LightYellow", 255, 255, 224 },
{ "LightYellow1", 255, 255, 224 },
{ "LightYellow2", 238, 238, 209 },
{ "LightYellow3", 205, 205, 180 },
{ "LightYellow4", 139, 139, 122 },
{ "lime green", 50, 205, 50 },
{ "LimeGreen", 50, 205, 50 },
{ "linen", 250, 240, 230 },
{ "magenta", 255, 0, 255 },
{ "magenta1", 255, 0, 255 },
{ "magenta2", 238, 0, 238 },
{ "magenta3", 205, 0, 205 },
{ "magenta4", 139, 0, 139 },
{ "maroon", 176, 48, 96 },
{ "maroon1", 255, 52, 179 },
{ "maroon2", 238, 48, 167 },
{ "maroon3", 205, 41, 144 },
{ "maroon4", 139, 28, 98 },
{ "medium aquamarine", 102, 205, 170 },
{ "medium blue", 0, 0, 205 },
{ "medium orchid", 186, 85, 211 },
{ "medium purple", 147, 112, 219 },
{ "medium sea green", 60, 179, 113 },
{ "medium slate blue", 123, 104, 238 },
{ "medium spring green", 0, 250, 154 },
{ "medium turquoise", 72, 209, 204 },
{ "medium violet red", 199, 21, 133 },
{ "MediumAquamarine", 102, 205, 170 },
{ "MediumBlue", 0, 0, 205 },
{ "MediumOrchid", 186, 85, 211 },
{ "MediumOrchid1", 224, 102, 255 },
{ "MediumOrchid2", 209, 95, 238 },
{ "MediumOrchid3", 180, 82, 205 },
{ "MediumOrchid4", 122, 55, 139 },
{ "MediumPurple", 147, 112, 219 },
{ "MediumPurple1", 171, 130, 255 },
{ "MediumPurple2", 159, 121, 238 },
{ "MediumPurple3", 137, 104, 205 },
{ "MediumPurple4", 93, 71, 139 },
{ "MediumSeaGreen", 60, 179, 113 },
{ "MediumSlateBlue", 123, 104, 238 },
{ "MediumSpringGreen", 0, 250, 154 },
{ "MediumTurquoise", 72, 209, 204 },
{ "MediumVioletRed", 199, 21, 133 },
{ "midnight blue", 25, 25, 112 },
{ "MidnightBlue", 25, 25, 112 },
{ "mint cream", 245, 255, 250 },
{ "MintCream", 245, 255, 250 },
{ "misty rose", 255, 228, 225 },
{ "MistyRose", 255, 228, 225 },
{ "MistyRose1", 255, 228, 225 },
{ "MistyRose2", 238, 213, 210 },
{ "MistyRose3", 205, 183, 181 },
{ "MistyRose4", 139, 125, 123 },
{ "moccasin", 255, 228, 181 },
{ "navajo white", 255, 222, 173 },
{ "NavajoWhite", 255, 222, 173 },
{ "NavajoWhite1", 255, 222, 173 },
{ "NavajoWhite2", 238, 207, 161 },
{ "NavajoWhite3", 205, 179, 139 },
{ "NavajoWhite4", 139, 121, 94 },
{ "navy", 0, 0, 128 },
{ "navy blue", 0, 0, 128 },
{ "NavyBlue", 0, 0, 128 },
{ "old lace", 253, 245, 230 },
{ "OldLace", 253, 245, 230 },
{ "olive drab", 107, 142, 35 },
{ "OliveDrab", 107, 142, 35 },
{ "OliveDrab1", 192, 255, 62 },
{ "OliveDrab2", 179, 238, 58 },
{ "OliveDrab3", 154, 205, 50 },
{ "OliveDrab4", 105, 139, 34 },
{ "orange", 255, 165, 0 },
{ "orange red", 255, 69, 0 },
{ "orange1", 255, 165, 0 },
{ "orange2", 238, 154, 0 },
{ "orange3", 205, 133, 0 },
{ "orange4", 139, 90, 0 },
{ "OrangeRed", 255, 69, 0 },
{ "OrangeRed1", 255, 69, 0 },
{ "OrangeRed2", 238, 64, 0 },
{ "OrangeRed3", 205, 55, 0 },
{ "OrangeRed4", 139, 37, 0 },
{ "orchid", 218, 112, 214 },
{ "orchid1", 255, 131, 250 },
{ "orchid2", 238, 122, 233 },
{ "orchid3", 205, 105, 201 },
{ "orchid4", 139, 71, 137 },
{ "pale goldenrod", 238, 232, 170 },
{ "pale green", 152, 251, 152 },
{ "pale turquoise", 175, 238, 238 },
{ "pale violet red", 219, 112, 147 },
{ "PaleGoldenrod", 238, 232, 170 },
{ "PaleGreen", 152, 251, 152 },
{ "PaleGreen1", 154, 255, 154 },
{ "PaleGreen2", 144, 238, 144 },
{ "PaleGreen3", 124, 205, 124 },
{ "PaleGreen4", 84, 139, 84 },
{ "PaleTurquoise", 175, 238, 238 },
{ "PaleTurquoise1", 187, 255, 255 },
{ "PaleTurquoise2", 174, 238, 238 },
{ "PaleTurquoise3", 150, 205, 205 },
{ "PaleTurquoise4", 102, 139, 139 },
{ "PaleVioletRed", 219, 112, 147 },
{ "PaleVioletRed1", 255, 130, 171 },
{ "PaleVioletRed2", 238, 121, 159 },
{ "PaleVioletRed3", 205, 104, 137 },
{ "PaleVioletRed4", 139, 71, 93 },
{ "papaya whip", 255, 239, 213 },
{ "PapayaWhip", 255, 239, 213 },
{ "peach puff", 255, 218, 185 },
{ "PeachPuff", 255, 218, 185 },
{ "PeachPuff1", 255, 218, 185 },
{ "PeachPuff2", 238, 203, 173 },
{ "PeachPuff3", 205, 175, 149 },
{ "PeachPuff4", 139, 119, 101 },
{ "peru", 205, 133, 63 },
{ "pink", 255, 192, 203 },
{ "pink1", 255, 181, 197 },
{ "pink2", 238, 169, 184 },
{ "pink3", 205, 145, 158 },
{ "pink4", 139, 99, 108 },
{ "plum", 221, 160, 221 },
{ "plum1", 255, 187, 255 },
{ "plum2", 238, 174, 238 },
{ "plum3", 205, 150, 205 },
{ "plum4", 139, 102, 139 },
{ "powder blue", 176, 224, 230 },
{ "PowderBlue", 176, 224, 230 },
{ "purple", 160, 32, 240 },
{ "purple1", 155, 48, 255 },
{ "purple2", 145, 44, 238 },
{ "purple3", 125, 38, 205 },
{ "purple4", 85, 26, 139 },
{ "red", 255, 0, 0 },
{ "red1", 255, 0, 0 },
{ "red2", 238, 0, 0 },
{ "red3", 205, 0, 0 },
{ "red4", 139, 0, 0 },
{ "rosy brown", 188, 143, 143 },
{ "RosyBrown", 188, 143, 143 },
{ "RosyBrown1", 255, 193, 193 },
{ "RosyBrown2", 238, 180, 180 },
{ "RosyBrown3", 205, 155, 155 },
{ "RosyBrown4", 139, 105, 105 },
{ "royal blue", 65, 105, 225 },
{ "RoyalBlue", 65, 105, 225 },
{ "RoyalBlue1", 72, 118, 255 },
{ "RoyalBlue2", 67, 110, 238 },
{ "RoyalBlue3", 58, 95, 205 },
{ "RoyalBlue4", 39, 64, 139 },
{ "saddle brown", 139, 69, 19 },
{ "SaddleBrown", 139, 69, 19 },
{ "salmon", 250, 128, 114 },
{ "salmon1", 255, 140, 105 },
{ "salmon2", 238, 130, 98 },
{ "salmon3", 205, 112, 84 },
{ "salmon4", 139, 76, 57 },
{ "sandy brown", 244, 164, 96 },
{ "SandyBrown", 244, 164, 96 },
{ "sea green", 46, 139, 87 },
{ "SeaGreen", 46, 139, 87 },
{ "SeaGreen1", 84, 255, 159 },
{ "SeaGreen2", 78, 238, 148 },
{ "SeaGreen3", 67, 205, 128 },
{ "SeaGreen4", 46, 139, 87 },
{ "seashell", 255, 245, 238 },
{ "seashell1", 255, 245, 238 },
{ "seashell2", 238, 229, 222 },
{ "seashell3", 205, 197, 191 },
{ "seashell4", 139, 134, 130 },
{ "sienna", 160, 82, 45 },
{ "sienna1", 255, 130, 71 },
{ "sienna2", 238, 121, 66 },
{ "sienna3", 205, 104, 57 },
{ "sienna4", 139, 71, 38 },
{ "sky blue", 135, 206, 235 },
{ "SkyBlue", 135, 206, 235 },
{ "SkyBlue1", 135, 206, 255 },
{ "SkyBlue2", 126, 192, 238 },
{ "SkyBlue3", 108, 166, 205 },
{ "SkyBlue4", 74, 112, 139 },
{ "slate blue", 106, 90, 205 },
{ "slate gray", 112, 128, 144 },
{ "slate grey", 112, 128, 144 },
{ "SlateBlue", 106, 90, 205 },
{ "SlateBlue1", 131, 111, 255 },
{ "SlateBlue2", 122, 103, 238 },
{ "SlateBlue3", 105, 89, 205 },
{ "SlateBlue4", 71, 60, 139 },
{ "SlateGray", 112, 128, 144 },
{ "SlateGray1", 198, 226, 255 },
{ "SlateGray2", 185, 211, 238 },
{ "SlateGray3", 159, 182, 205 },
{ "SlateGray4", 108, 123, 139 },
{ "SlateGrey", 112, 128, 144 },
{ "snow", 255, 250, 250 },
{ "snow1", 255, 250, 250 },
{ "snow2", 238, 233, 233 },
{ "snow3", 205, 201, 201 },
{ "snow4", 139, 137, 137 },
{ "spring green", 0, 255, 127 },
{ "SpringGreen", 0, 255, 127 },
{ "SpringGreen1", 0, 255, 127 },
{ "SpringGreen2", 0, 238, 118 },
{ "SpringGreen3", 0, 205, 102 },
{ "SpringGreen4", 0, 139, 69 },
{ "steel blue", 70, 130, 180 },
{ "SteelBlue", 70, 130, 180 },
{ "SteelBlue1", 99, 184, 255 },
{ "SteelBlue2", 92, 172, 238 },
{ "SteelBlue3", 79, 148, 205 },
{ "SteelBlue4", 54, 100, 139 },
{ "tan", 210, 180, 140 },
{ "tan1", 255, 165, 79 },
{ "tan2", 238, 154, 73 },
{ "tan3", 205, 133, 63 },
{ "tan4", 139, 90, 43 },
{ "thistle", 216, 191, 216 },
{ "thistle1", 255, 225, 255 },
{ "thistle2", 238, 210, 238 },
{ "thistle3", 205, 181, 205 },
{ "thistle4", 139, 123, 139 },
{ "tomato", 255, 99, 71 },
{ "tomato1", 255, 99, 71 },
{ "tomato2", 238, 92, 66 },
{ "tomato3", 205, 79, 57 },
{ "tomato4", 139, 54, 38 },
{ "turquoise", 64, 224, 208 },
{ "turquoise1", 0, 245, 255 },
{ "turquoise2", 0, 229, 238 },
{ "turquoise3", 0, 197, 205 },
{ "turquoise4", 0, 134, 139 },
{ "violet", 238, 130, 238 },
{ "violet red", 208, 32, 144 },
{ "VioletRed", 208, 32, 144 },
{ "VioletRed1", 255, 62, 150 },
{ "VioletRed2", 238, 58, 140 },
{ "VioletRed3", 205, 50, 120 },
{ "VioletRed4", 139, 34, 82 },
{ "wheat", 245, 222, 179 },
{ "wheat1", 255, 231, 186 },
{ "wheat2", 238, 216, 174 },
{ "wheat3", 205, 186, 150 },
{ "wheat4", 139, 126, 102 },
{ "white", 255, 255, 255 },
{ "white smoke", 245, 245, 245 },
{ "WhiteSmoke", 245, 245, 245 },
{ "yellow", 255, 255, 0 },
{ "yellow green", 154, 205, 50 },
{ "yellow1", 255, 255, 0 },
{ "yellow2", 238, 238, 0 },
{ "yellow3", 205, 205, 0 },
{ "yellow4", 139, 139, 0 },
{ "YellowGreen", 154, 205, 50 }
};
static int
compare_xcolor_entries (const void *a, const void *b)
{
return g_strcasecmp ((const char *) a, ((const ColorEntry *) b)->name);
}
static gboolean
find_color (const char *name,
guint16 *red,
guint16 *green,
guint16 *blue)
{
ColorEntry *found;
found = bsearch (name, xColors, G_N_ELEMENTS (xColors),
sizeof (ColorEntry),
compare_xcolor_entries);
if (found == NULL)
return FALSE;
*red = (found->red * 65535) / 255;
*green = (found->green * 65535) / 255;
*blue = (found->blue * 65535) / 255;
return TRUE;
}
static gboolean
color_parse (const char *spec,
guint16 *red,
guint16 *green,
guint16 *blue)
{
if (spec[0] == '#')
{
char fmt[16];
int i, r, g, b;
if ((i = strlen (spec+1)) % 3)
return FALSE;
i /= 3;
sprintf (fmt, "%%%dx%%%dx%%%dx", i, i, i);
if (sscanf (spec+1, fmt, &r, &g, &b) != 3)
return FALSE;
if (i == 4)
{
if (red)
*red = r;
if (green)
*green = g;
if (blue)
*blue = b;
}
else if (i == 1)
{
if (red)
*red = (r * 65535) / 15;
if (green)
*green = (g * 65535) / 15;
if (blue)
*blue = (b * 65535) / 15;
}
else if (i == 2)
{
if (red)
*red = (r * 65535) / 255;
if (green)
*green = (g * 65535) / 255;
if (blue)
*blue = (b * 65535) / 255;
}
else /* if (i == 3) */
{
if (red)
*red = (r * 65535) / 4095;
if (green)
*green = (g * 65535) / 4095;
if (blue)
*blue = (b * 65535) / 4095;
}
}
else
{
if (!find_color(spec, red, green, blue))
return FALSE;
}
return TRUE;
}
gboolean
gdk_color_parse (const gchar *spec,
GdkColor *color)
{
return color_parse (spec, &color->red, &color->green, &color->blue);
}

View File

@@ -46,6 +46,7 @@ struct _GdkColormap
/*< private >*/
GdkVisual *visual;
GdkScreen *screen;
gpointer windowing_data;
};
@@ -62,9 +63,11 @@ GdkColormap* gdk_colormap_new (GdkVisual *visual,
gboolean allocate);
GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
void gdk_colormap_unref (GdkColormap *cmap);
#ifndef GDK_MULTIHEAD_SAFE
GdkColormap* gdk_colormap_get_system (void);
#endif
gint gdk_colormap_get_system_size (void);
GdkColormap* gdk_colormap_get_system_for_screen (GdkScreen * screen);
void gdk_colormap_change (GdkColormap *colormap,
gint ncolors);

View File

@@ -24,13 +24,19 @@ struct _GdkCursor
/* Cursors
*/
GdkCursor* gdk_cursor_new_for_screen (GdkScreen * screen,
GdkCursorType cursor_type);
#ifndef GDK_MULTIHEAD_SAFE
GdkCursor* gdk_cursor_new (GdkCursorType cursor_type);
#endif
GdkCursor* gdk_cursor_new_from_pixmap (GdkPixmap *source,
GdkPixmap *mask,
GdkColor *fg,
GdkColor *bg,
gint x,
gint y);
GdkCursor* gdk_cursor_ref (GdkCursor *cursor);
void gdk_cursor_unref (GdkCursor *cursor);

70
gdk/gdkdisplay.c Normal file
View File

@@ -0,0 +1,70 @@
#include <glib.h>
#include "gdkdisplay.h"
#include "gdkdisplaymgr.h"
#include "gdkinternals.h"
static void gdk_display_class_init (GdkDisplayClass * class);
GType
gdk_display_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info = {
sizeof (GdkDisplayClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplay),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkDisplay", &object_info, 0);
}
return object_type;
}
static void
gdk_display_class_init (GdkDisplayClass * class)
{
/* class->parent_class = g_type_class_peek_parent (class);*/
}
GdkDisplay *
gdk_display_new (gchar * display_name)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (gdk_display_manager)->
open_display (gdk_display_manager, display_name);
}
gchar *
gdk_display_get_name (GdkDisplay * dpy)
{
return GDK_DISPLAY_GET_CLASS (dpy)->get_display_name (dpy);
}
gint
gdk_display_get_n_screens (GdkDisplay * dpy)
{
return GDK_DISPLAY_GET_CLASS (dpy)->get_n_screens (dpy);
}
GdkScreen *
gdk_display_get_screen (GdkDisplay * dpy, gint screen_num)
{
return GDK_DISPLAY_GET_CLASS (dpy)->get_screen (dpy, screen_num);
}
GdkScreen *
gdk_display_get_default_screen (GdkDisplay * dpy)
{
return GDK_DISPLAY_GET_CLASS (dpy)->get_default_screen (dpy);
}

62
gdk/gdkdisplay.h Normal file
View File

@@ -0,0 +1,62 @@
#ifndef __GDK_DISPLAY_H__
#define __GDK_DISPLAY_H__
#include <gdk/gdktypes.h>
#include <gobject/gobject.h>
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
typedef struct _GdkDisplayClass GdkDisplayClass;
#define GDK_TYPE_DISPLAY (gdk_display_get_type ())
#define GDK_DISPLAY(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_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))
struct _GdkDisplay
{
GObject parent_instance;
};
struct _GdkDisplayClass
{
GObjectClass parent_class;
GdkDisplay *(*new_display) (gchar * display_name);
gchar *(*get_display_name) (GdkDisplay * dpy);
gint (*get_n_screens) (GdkDisplay * dpy);
GdkScreen *(*get_screen) (GdkDisplay * dpy, gint screen_num);
GdkScreen *(*get_default_screen) (GdkDisplay * dpy);
};
GType gdk_display_get_type (void);
GdkDisplay *gdk_display_init_new (int argc, char **argv,
char *display_name);
GdkDisplay *gdk_display_new (gchar * display_name);
gchar *gdk_display_get_name (GdkDisplay * dpy);
gint gdk_display_get_n_screens (GdkDisplay * dpy);
GdkScreen *gdk_display_get_screen (GdkDisplay * dpy, gint screen_num);
GdkScreen *gdk_display_get_default_screen (GdkDisplay * dpy);
void gdk_display_set_use_xshm (GdkDisplay * display, gboolean use_xshm);
gboolean gdk_display_get_use_xshm (GdkDisplay * display);
void gdk_display_pointer_ungrab (GdkDisplay * display, guint32 time);
void gdk_display_keyboard_ungrab (GdkDisplay * display, guint32 time);
gboolean gdk_display_pointer_is_grabbed (GdkDisplay * display);
void gdk_display_beep (GdkDisplay * display);
GdkAtom gdk_display_atom (GdkDisplay * dpy,
const gchar * atom_name, gboolean only_if_exists);
gchar *gdk_display_atom_name (GdkDisplay * dpy, GdkAtom atom);
void gdk_display_sync (GdkDisplay * display);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GDK_DISPLAY_H__ */

81
gdk/gdkdisplaymgr.c Normal file
View File

@@ -0,0 +1,81 @@
#include "gdkprivate.h"
#include "gdkdisplaymgr.h"
static void gdk_display_manager_class_init (GObjectClass * class);
GType
gdk_display_manager_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info = {
sizeof (GdkDisplayManagerClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_display_manager_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkDisplayManager),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (G_TYPE_OBJECT,
"GdkDisplayManager",
&object_info, 0);
}
return object_type;
}
static void
gdk_display_manager_class_init (GObjectClass * class)
{
}
GdkDisplay *
gdk_display_manager_get_default_display (GdkDisplayManager * dpy_mgr)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (dpy_mgr)->
get_default_display (dpy_mgr);
}
GdkDisplay *
gdk_display_manager_open_display (GdkDisplayManager * dpy_mgr,
gchar * display_name)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (dpy_mgr)->open_display (dpy_mgr,
display_name);
}
gint
gdk_display_manager_get_display_count (GdkDisplayManager * dpy_mgr)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (dpy_mgr)->get_display_count (dpy_mgr);
}
GdkDisplay *
gdk_get_default_display (void)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (gdk_display_manager)->
get_default_display (gdk_display_manager);
}
GdkScreen *
gdk_get_default_screen (void)
{
GdkDisplay *dpy = gdk_get_default_display ();
return GDK_DISPLAY_GET_CLASS (dpy)->get_default_screen (dpy);
}
GdkDisplayManager *
gdk_get_display_manager (void)
{
return gdk_display_manager;
}

56
gdk/gdkdisplaymgr.h Normal file
View File

@@ -0,0 +1,56 @@
#ifndef __GDK_DISPLAY_MANAGER__
#define __GDK_DISPLAY_MANAGER__
#include "gdkdisplay.h"
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#define GDK_TYPE_DISPLAY_MGR (gdk_display_manager_type())
#define GDK_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_DISPLAY_MGR, GdkDisplayManager))
#define GDK_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DISPLAY_MGR, GdkDisplayManagerClass))
#define GDK_IS_DISPLAY_MGR(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_DISPLAY_MGR))
#define GDK_IS_DISPLAY_MGR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DISPLAY_MGR))
#define GDK_DISPLAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DISPLAY_MGR, GdkDisplayManagerClass))
typedef struct _GdkDisplayManager GdkDisplayManager;
typedef struct _GdkDisplayManagerClass GdkDisplayManagerClass;
struct _GdkDisplayManager
{
GObject parent_instance;
GdkDisplay *default_display;
GSList *open_displays;
};
struct _GdkDisplayManagerClass
{
GObjectClass parent_class;
GdkDisplay *(*open_display) (GdkDisplayManager * dpy_mgr,
gchar * display_name);
void (*set_default_display) (GdkDisplayManager * dpy_mgr,
GdkDisplay * default_display);
GdkDisplay *(*get_default_display) (GdkDisplayManager * dpy_mgr);
gint (*get_display_count) (GdkDisplayManager * dpy_mgr);
};
GType gdk_display_manager_get_type (void);
GdkDisplay *gdk_display_manager_get_default_display (GdkDisplayManager *
dpy_mgr);
GdkDisplay *gdk_display_manager_open_display (GdkDisplayManager * dpy_mgr,
gchar * display_name);
gint gdk_display_manager_get_display_count (GdkDisplayManager * dpy_mgr);
GdkDisplay *gdk_get_default_display (void);
GdkScreen *gdk_get_default_screen (void);
GdkDisplayManager *gdk_get_display_manager (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __GDK_DISPLAY_MANAGER__ */

View File

@@ -98,7 +98,8 @@ GdkAtom gdk_drag_get_selection (GdkDragContext *context);
GdkDragContext * gdk_drag_begin (GdkWindow *window,
GList *targets);
guint32 gdk_drag_get_protocol (guint32 xid,
guint32 gdk_drag_get_protocol (GdkDisplay *display,
guint32 xid,
GdkDragProtocol *protocol);
void gdk_drag_find_window (GdkDragContext *context,
GdkWindow *drag_window,

View File

@@ -177,7 +177,37 @@ gdk_drawable_get_depth (GdkDrawable *drawable)
return GDK_DRAWABLE_GET_CLASS (drawable)->get_depth (drawable);
}
/**
* gdk_drawable_get_screen:
* @drawable: a #GdkDrawable
*
* Gets the #GdkScreen associated with the GdkDrawable
*
* Return value: a pointer to a #GdkScreen object
**/
GdkScreen*
gdk_drawable_get_screen(GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
return GDK_DRAWABLE_GET_CLASS (drawable)->get_screen (drawable);
}
/**
* gdk_drawable_get_display:
* @drawable: a #GdkDrawable
*
* Gets the #GdkDisplay associated with the GdkDrawable
*
* Return value: a pointer to a #GdkDisplay object
**/
GdkDisplay*
gdk_drawable_get_display(GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
return GDK_DRAWABLE_GET_CLASS (drawable)->get_display (drawable);
}
/**
* gdk_drawable_set_colormap:
* @drawable: a #GdkDrawable

View File

@@ -111,8 +111,10 @@ struct _GdkDrawableClass
void (*set_colormap) (GdkDrawable *drawable,
GdkColormap *cmap);
GdkColormap* (*get_colormap) (GdkDrawable *drawable);
GdkVisual* (*get_visual) (GdkDrawable *drawable);
GdkColormap* (*get_colormap) (GdkDrawable *drawable);
GdkVisual* (*get_visual) (GdkDrawable *drawable);
GdkScreen* (*get_screen) (GdkDrawable *drawable);
GdkDisplay* (*get_display) (GdkDrawable *drawable);
GdkImage* (*get_image) (GdkDrawable *drawable,
gint x,
@@ -155,6 +157,8 @@ void gdk_drawable_set_colormap (GdkDrawable *drawable,
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
gint gdk_drawable_get_depth (GdkDrawable *drawable);
GdkScreen * gdk_drawable_get_screen (GdkDrawable *drawable);
GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
GdkDrawable* gdk_drawable_ref (GdkDrawable *drawable);
void gdk_drawable_unref (GdkDrawable *drawable);

View File

@@ -201,7 +201,7 @@ gdk_event_handler_set (GdkEventFunc func,
GdkEvent*
gdk_event_get (void)
{
gdk_events_queue ();
gdk_events_queue (gdk_get_default_display ());
return gdk_event_unqueue ();
}

View File

@@ -31,11 +31,14 @@ struct _GdkFont
GType gdk_font_get_type (void);
GdkFont* gdk_font_load (const gchar *font_name);
GdkFont* gdk_fontset_load (const gchar *fontset_name);
GdkFont *gdk_font_load_for_display (GdkDisplay * display,
const gchar * font_name);
GdkFont* gdk_font_load (const gchar *font_name);
GdkFont *gdk_fontset_load_for_display (GdkDisplay * display,
const gchar * fontset_name);
GdkFont* gdk_fontset_load (const gchar *fontset_name);
GdkFont *gdk_font_from_description_for_display (GdkDisplay * display,
PangoFontDescription *font_desc);
GdkFont* gdk_font_from_description (PangoFontDescription *font_desc);
GdkFont* gdk_font_ref (GdkFont *font);
@@ -94,6 +97,7 @@ void gdk_string_extents (GdkFont *font,
gint *width,
gint *ascent,
gint *descent);
GdkDisplay* gdk_font_get_display(GdkFont* font);
#ifdef GDK_WINDOWING_WIN32
/* Ditto temporary */

View File

@@ -489,3 +489,6 @@ gdk_gc_set_rgb_bg_color (GdkGC *gc, GdkColor *color)
gdk_rgb_find_color (cmap, &tmp_color);
gdk_gc_set_foreground (gc, &tmp_color);
}

View File

@@ -248,6 +248,7 @@ void gdk_gc_set_rgb_fg_color (GdkGC *gc,
GdkColor *color);
void gdk_gc_set_rgb_bg_color (GdkGC *gc,
GdkColor *color);
GdkScreen * gdk_gc_get_screen (GdkGC *gc);
#ifdef __cplusplus
}

View File

@@ -30,12 +30,12 @@
#include "config.h"
guint gdk_debug_flags = 0;
GdkWindow *gdk_parent_root = NULL;
gint gdk_error_code = 0;
gint gdk_error_warnings = TRUE;
GList *gdk_default_filters = NULL;
GMutex *gdk_threads_mutex = NULL; /* Global GDK lock */
GList *gdk_queued_events = NULL;
GList *gdk_queued_tail = NULL;
GdkDisplayManager *gdk_display_manager = NULL;

View File

@@ -43,7 +43,8 @@ typedef enum {
GDK_DEBUG_EVENTS = 1 << 1,
GDK_DEBUG_DND = 1 << 2,
GDK_DEBUG_COLOR_CONTEXT = 1 << 3,
GDK_DEBUG_XIM = 1 << 4
GDK_DEBUG_XIM = 1 << 4,
GDK_DEBUG_MULTIHEAD = 1 << 5
} GdkDebugFlag;
extern gint gdk_debug_level;
@@ -108,8 +109,8 @@ extern GList *gdk_queued_tail;
GdkEvent* gdk_event_new (void);
void gdk_events_init (void);
void gdk_events_queue (void);
void gdk_events_init (GdkDisplay * display);
void gdk_events_queue (GdkDisplay * display);
GdkEvent* gdk_event_unqueue (void);
GList* gdk_event_queue_find_first (void);
@@ -143,8 +144,9 @@ void _gdk_colormap_real_destroy (GdkColormap *colormap);
void _gdk_cursor_destroy (GdkCursor *cursor);
extern GdkArgDesc _gdk_windowing_args[];
gboolean _gdk_windowing_init_check (int argc,
GdkDisplay * _gdk_windowing_init_check (int argc,
char **argv);
void _gdk_windowing_screen_init (GdkScreen * scr);
void _gdk_windowing_window_get_offsets (GdkWindow *window,
gint *x_offset,
gint *y_offset);
@@ -195,11 +197,11 @@ GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
* Initialization and exit routines *
************************************/
void _gdk_windowing_window_init (void);
void gdk_visual_init (void);
void gdk_dnd_init (void);
void _gdk_windowing_window_init (GdkScreen *screen);
void _gdk_visual_init (GdkScreen *screen);
void gdk_dnd_init (GdkDisplay *display);
void _gdk_windowing_image_init (void);
void _gdk_windowing_image_init (GdkDisplay *display);
void gdk_image_exit (void);
void gdk_input_init (void);

View File

@@ -24,8 +24,11 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "gdkkeys.h"
#include <config.h>
#include "gdkdisplay.h"
#include "gdkdisplaymgr.h"
#include "gdkinternals.h"
#include "gdkkeys.h"
static void gdk_keymap_init (GdkKeymap *keymap);
static void gdk_keymap_class_init (GdkKeymapClass *klass);
@@ -80,18 +83,24 @@ gdk_keymap_class_init (GdkKeymapClass *klass)
static void
gdk_keymap_finalize (GObject *object)
{
GdkKeymap *keymap = GDK_KEYMAP (object);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
GdkKeymap*
gdk_keymap_get_for_display (GdkDisplay *display)
{
GdkKeymap *keymap = g_object_new (gdk_keymap_get_type (), NULL);
keymap->display = display;
return keymap;
}
GdkKeymap*
gdk_keymap_get_default (void)
{
static GdkKeymap *keymap = NULL;
if (keymap == NULL)
keymap = g_object_new (gdk_keymap_get_type (), NULL);
keymap = gdk_keymap_get_for_display (gdk_get_default_display ());
return keymap;
}

View File

@@ -64,7 +64,8 @@ typedef struct _GdkKeymapClass GdkKeymapClass;
struct _GdkKeymap
{
GObject parent_instance;
GObject parent_instance;
GdkDisplay* display;
};
struct _GdkKeymapClass
@@ -75,6 +76,7 @@ struct _GdkKeymapClass
GType gdk_keymap_get_type (void) G_GNUC_CONST;
GdkKeymap* gdk_keymap_get_default (void);
GdkKeymap* gdk_keymap_get_for_display (GdkDisplay * display);
guint gdk_keymap_lookup_key (GdkKeymap *keymap,

View File

@@ -21,6 +21,7 @@
#include "gdkgc.h"
#include "gdkpango.h"
#include "gdkrgb.h"
#include "gdkscreen.h"
#include "gdkprivate.h"
#define GDK_INFO_KEY "gdk-info"
@@ -83,9 +84,13 @@ gdk_pango_get_gc (PangoContext *context,
{
GdkGC *result;
GdkPangoContextInfo *info;
GdkWindow *root_window;
GdkScreen *screen;
g_return_val_if_fail (context != NULL, NULL);
screen = g_object_get_data (G_OBJECT (context), "gdk-screen");
info = gdk_pango_context_get_info (context, FALSE);
if (info == NULL || info->colormap == NULL)
@@ -93,8 +98,9 @@ gdk_pango_get_gc (PangoContext *context,
g_warning ("you must set the colormap on a PangoContext before using it to draw a layout");
return NULL;
}
result = gdk_gc_new (gdk_parent_root);
root_window = gdk_screen_get_root_window (screen);
result = gdk_gc_new (root_window);
gdk_gc_copy (result, base_gc);
if (fg_color)
@@ -180,11 +186,14 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
gint rise = 0;
gboolean embossed;
GdkBitmap *stipple;
GdkScreen *screen;
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (line != NULL);
screen = gdk_drawable_get_screen (drawable);
context = pango_layout_get_context (line->layout);
pango_layout_line_get_extents (line,NULL, &overall_rect);
@@ -261,7 +270,8 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
tmp.green = foreground->green;
}
fg_gc = gdk_pango_get_gc (context, fg_set ? &tmp : NULL,
fg_gc = gdk_pango_get_gc (context,
fg_set ? &tmp : NULL,
stipple, gc);
}
else
@@ -277,7 +287,10 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
if (embossed)
{
PangoColor color = { 65535, 65535, 65535 };
GdkGC *white_gc = gdk_pango_get_gc (context, &color, stipple, fg_gc);
GdkGC *white_gc = gdk_pango_get_gc (context,
&color,
stipple,
fg_gc);
gdk_draw_glyphs (drawable, white_gc, run->item->analysis.font,
gx + 1,
gy + 1,
@@ -680,7 +693,7 @@ gdk_pango_attr_embossed_new (gboolean embossed)
*
* Obtains a clip region which contains the areas where the given
* ranges of text would be drawn. @x_origin and @y_origin are the same
* position you would pass to gdk_draw_layout_line(). @index_ranges
* position you would pass to gdk_draw_layout_line (). @index_ranges
* should contain ranges of bytes in the layout's text. The clip
* region will include space to the left or right of the line (to the
* layout bounding box) if you have indexes above or below the indexes
@@ -758,7 +771,7 @@ gdk_pango_layout_line_get_clip_region (PangoLayoutLine *line,
*
* Obtains a clip region which contains the areas where the given ranges
* of text would be drawn. @x_origin and @y_origin are the same position
* you would pass to gdk_draw_layout_line(). @index_ranges should contain
* you would pass to gdk_draw_layout_line (). @index_ranges should contain
* ranges of bytes in the layout's text.
*
* Return value: a clip region containing the given ranges

View File

@@ -34,7 +34,10 @@ extern "C" {
* in it to create new GC's and to set the colors on those GC's.
* A colormap is not sufficient.
*/
PangoContext *gdk_pango_context_get_for_screen (GdkScreen * screen);
#ifndef GDK_MULTIHEAD_SAFE
PangoContext *gdk_pango_context_get (void);
#endif
void gdk_pango_context_set_colormap (PangoContext *context,
GdkColormap *colormap);

View File

@@ -25,7 +25,7 @@
#include <config.h>
#include <stdio.h>
#include <string.h>
#include "gdk.h" /* For gdk_screen_width/gdk_screen_height */
#include "gdk.h"
#include "gdkcolor.h"
#include "gdkimage.h"
#include "gdkvisual.h"
@@ -992,7 +992,7 @@ convert_real_slow (GdkImage *image,
width = image->width;
height = image->height;
bpl = image->bpl;
v = gdk_colormap_get_visual(cmap);
v = gdk_colormap_get_visual (cmap);
d(printf("rgb mask/shift/prec = %x:%x:%x %d:%d:%d %d:%d:%d\n",
v->red_mask, v->green_mask, v->blue_mask,
@@ -1075,7 +1075,7 @@ rgbconvert (GdkImage *image,
{
int index = (image->byte_order == GDK_MSB_FIRST) | (alpha != 0) << 1;
int bank=5; /* default fallback converter */
GdkVisual *v = gdk_colormap_get_visual(cmap);
GdkVisual *v = gdk_colormap_get_visual (cmap);
d(printf("masks = %x:%x:%x\n", v->red_mask, v->green_mask, v->blue_mask));
d(printf("image depth = %d, bits per pixel = %d\n", image->depth, image->bits_per_pixel));
@@ -1128,7 +1128,7 @@ rgbconvert (GdkImage *image,
if (bank==5)
{
convert_real_slow(image, pixels, rowstride, cmap, alpha);
convert_real_slow (image, pixels, rowstride, cmap, alpha);
}
else
{
@@ -1153,7 +1153,7 @@ rgbconvert (GdkImage *image,
* @width: Width in pixels of region to get.
* @height: Height in pixels of region to get.
*
* Transfers image data from a Gdk drawable and converts it to an RGB(A)
* Transfers image data from a Gdk drawable and converts it to an RGB (A)
* representation inside a GdkPixbuf.
*
* If the drawable @src is a pixmap, then a suitable colormap must be specified,
@@ -1202,7 +1202,7 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
g_return_val_if_fail (src != NULL, NULL);
if (GDK_IS_WINDOW (src))
/* FIXME: this is not perfect, since is_viewable() only tests
/* FIXME: this is not perfect, since is_viewable () only tests
* recursively up the Gdk parent window tree, but stops at
* foreign windows or Gdk toplevels. I.e. if a window manager
* unmapped one of its own windows, this won't work.
@@ -1225,7 +1225,7 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
{
g_warning ("%s: Source drawable has no colormap; either pass "
"in a colormap, or set the colormap on the drawable "
"with gdk_drawable_set_colormap()", G_STRLOC);
"with gdk_drawable_set_colormap ()", G_STRLOC);
return NULL;
}
@@ -1253,8 +1253,8 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
ret = gdk_window_get_origin (src, &src_xorigin, &src_yorigin);
g_return_val_if_fail (ret != FALSE, NULL);
screen_width = gdk_screen_width ();
screen_height = gdk_screen_height ();
screen_width = gdk_screen_get_width (gdk_drawable_get_screen(src));
screen_height = gdk_screen_get_height (gdk_drawable_get_screen(src));
screen_srcx = src_xorigin + src_x;
screen_srcy = src_yorigin + src_y;
@@ -1290,7 +1290,7 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
alpha,
cmap);
gdk_image_destroy(image);
gdk_image_destroy (image);
return dest;
}

View File

@@ -24,8 +24,8 @@
#include <gdk/gdk.h>
#include "gdk-pixbuf-private.h"
#include "gdkpixbuf.h"
#include "gdkinternals.h"
/**
* gdk_pixbuf_render_threshold_alpha:
@@ -245,7 +245,7 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
* significant performance penalty depending on the size and the complexity of
* the alpha channel of the image. If performance is crucial, consider handling
* the alpha channel yourself (possibly by caching it in your application) and
* using gdk_pixbuf_render_to_drawable() or GdkRGB directly instead.
* using gdk_pixbuf_render_to_drawable () or GdkRGB directly instead.
*
* The #GDK_PIXBUF_ALPHA_FULL mode involves round trips to the X
* server, and may also be somewhat slow in its current implementation
@@ -279,7 +279,7 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
/* Clip to the drawable; this is required for get_from_drawable() so
/* Clip to the drawable; this is required for get_from_drawable () so
* can't be done implicitly
*/
@@ -316,7 +316,8 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
{
if (alpha_mode == GDK_PIXBUF_ALPHA_BILEVEL)
{
bitmap = gdk_pixmap_new (NULL, width, height, 1);
bitmap = gdk_pixmap_new (gdk_screen_get_root_window(gdk_drawable_get_screen(drawable)), width, height, 1);
gdk_pixbuf_render_threshold_alpha (pixbuf, bitmap,
src_x, src_y,
0, 0,
@@ -398,17 +399,18 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
* and @mask_return arguments, respectively, and renders a pixbuf and its
* corresponding tresholded alpha mask to them. This is merely a convenience
* function; applications that need to render pixbufs with dither offsets or to
* given drawables should use gdk_pixbuf_render_to_drawable_alpha() or
* gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha().
* given drawables should use gdk_pixbuf_render_to_drawable_alpha () or
* gdk_pixbuf_render_to_drawable (), and gdk_pixbuf_render_threshold_alpha ().
*
* If the pixbuf does not have an alpha channel, then *@mask_return will be set
* to NULL.
**/
void
gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold)
gdk_pixbuf_render_pixmap_and_mask_for_screen (GdkPixbuf *pixbuf,
GdkScreen *screen,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold)
{
g_return_if_fail (pixbuf != NULL);
@@ -416,8 +418,8 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
{
GdkGC *gc;
*pixmap_return = gdk_pixmap_new (NULL, pixbuf->width, pixbuf->height,
gdk_rgb_get_visual ()->depth);
*pixmap_return = gdk_pixmap_new (gdk_screen_get_root_window(screen), pixbuf->width, pixbuf->height, gdk_rgb_get_visual ()->depth);
gc = gdk_gc_new (*pixmap_return);
gdk_pixbuf_render_to_drawable (pixbuf, *pixmap_return, gc,
0, 0, 0, 0,
@@ -431,7 +433,8 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
{
if (pixbuf->has_alpha)
{
*mask_return = gdk_pixmap_new (NULL, pixbuf->width, pixbuf->height, 1);
*mask_return = gdk_pixmap_new (gdk_screen_get_root_window(screen), pixbuf->width, pixbuf->height, 1);
gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return,
0, 0, 0, 0,
pixbuf->width, pixbuf->height,
@@ -441,3 +444,17 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
*mask_return = NULL;
}
}
void
gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold)
{
GDK_NOTE (MULTIHEAD,g_message ("Use gdk_pixbuf_render_pixmap_and_mask_for_screen instead\n"));
gdk_pixbuf_render_pixmap_and_mask_for_screen (pixbuf,
gdk_get_default_screen(),
pixmap_return,
mask_return,
alpha_threshold);
}

View File

@@ -45,10 +45,17 @@ void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
GdkRgbDither dither,
int x_dither,
int y_dither);
#ifndef GDK_MULTIHEAD_SAFE
void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold);
#endif
void gdk_pixbuf_render_pixmap_and_mask_for_screen (GdkPixbuf *pixbuf,
GdkScreen *screen,
GdkPixmap **pixmap_return,
GdkBitmap **mask_return,
int alpha_threshold);
/* Fetching a region from a drawable */
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,

View File

@@ -27,6 +27,7 @@
#include "gdkpixmap.h"
#include "gdkinternals.h"
#include "gdkpixbuf.h"
#include "gdkscreen.h"
static GdkGC *gdk_pixmap_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
@@ -183,6 +184,7 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
drawable_class->draw_glyphs = gdk_pixmap_draw_glyphs;
drawable_class->draw_image = gdk_pixmap_draw_image;
drawable_class->get_depth = gdk_pixmap_real_get_depth;
drawable_class->get_screen = gdk_pixmap_get_screen;
drawable_class->get_size = gdk_pixmap_real_get_size;
drawable_class->set_colormap = gdk_pixmap_real_set_colormap;
drawable_class->get_colormap = gdk_pixmap_real_get_colormap;
@@ -431,13 +433,14 @@ gdk_pixmap_get_image (GdkDrawable *drawable,
}
static GdkBitmap *
make_solid_mask (gint width, gint height)
make_solid_mask (GdkScreen *screen, gint width, gint height)
{
GdkBitmap *bitmap;
GdkGC *gc;
GdkGCValues gc_values;
bitmap = gdk_pixmap_new (NULL, width, height, 1);
bitmap = gdk_pixmap_new (gdk_screen_get_root_window(screen), width, height, 1);
gc_values.foreground.pixel = 1;
gc = gdk_gc_new_with_values (bitmap, &gc_values, GDK_GC_FOREGROUND);
@@ -461,10 +464,8 @@ gdk_pixmap_colormap_new_from_pixbuf (GdkColormap *colormap,
GdkPixbuf *render_pixbuf;
GdkGC *tmp_gc;
pixmap = gdk_pixmap_new (NULL,
gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf),
gdk_colormap_get_visual (colormap)->depth);
pixmap = gdk_pixmap_new (gdk_screen_get_root_window(colormap->screen), gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), gdk_colormap_get_visual (colormap)->depth);
gdk_drawable_set_colormap (pixmap, colormap);
if (transparent_color)
@@ -490,10 +491,10 @@ gdk_pixmap_colormap_new_from_pixbuf (GdkColormap *colormap,
gdk_pixbuf_unref (render_pixbuf);
if (mask)
gdk_pixbuf_render_pixmap_and_mask (pixbuf, NULL, mask, 128);
gdk_pixbuf_render_pixmap_and_mask_for_screen (pixbuf, colormap->screen, NULL, mask, 128);
if (mask && !*mask)
*mask = make_solid_mask (gdk_pixbuf_get_width (pixbuf),
*mask = make_solid_mask (colormap->screen, gdk_pixbuf_get_width (pixbuf),
gdk_pixbuf_get_height (pixbuf));
return pixmap;

View File

@@ -16,7 +16,7 @@ typedef struct _GdkPixmapObjectClass GdkPixmapObjectClass;
#define GDK_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXMAP, GdkPixmapObjectClass))
#define GDK_IS_PIXMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXMAP))
#define GDK_IS_PIXMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXMAP))
#define GDK_PIXMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP, GdkPixmapClass))
#define GDK_PIXMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXMAP, GdkPixmapObjectClass))
#define GDK_PIXMAP_OBJECT(object) ((GdkPixmapObject *) GDK_PIXMAP (object))
struct _GdkPixmapObject
@@ -73,6 +73,8 @@ GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
GdkColor *transparent_color,
gchar **data);
GdkScreen * gdk_pixmap_get_screen (GdkDrawable *drawable);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@@ -35,6 +35,7 @@
#include <gdk/gdkregion.h>
#include <gdk/gdkvisual.h>
#include <gdk/gdkwindow.h>
#include <gdk/gdkdisplaymgr.h>
#ifdef __cplusplus
extern "C" {
@@ -80,9 +81,9 @@ struct _GdkClientFilter {
void gdk_window_destroy_notify (GdkWindow *window);
GDKVAR GdkWindow *gdk_parent_root;
GDKVAR gint gdk_error_code;
GDKVAR gint gdk_error_warnings;
GDKVAR GdkDisplayManager *gdk_display_manager;
#ifdef __cplusplus
}

View File

@@ -16,7 +16,7 @@ typedef enum
GdkAtom gdk_atom_intern (const gchar *atom_name,
gboolean only_if_exists);
gchar* gdk_atom_name (GdkAtom atom) G_GNUC_CONST;
gchar* gdk_atom_name (GdkAtom atom);
gboolean gdk_property_get (GdkWindow *window,
GdkAtom property,
@@ -37,12 +37,23 @@ void gdk_property_change (GdkWindow *window,
gint nelements);
void gdk_property_delete (GdkWindow *window,
GdkAtom property);
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_text_list (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);
gint gdk_text_property_to_utf8_list (GdkAtom encoding,
gint format,
const guchar *text,
@@ -50,6 +61,18 @@ gint gdk_text_property_to_utf8_list (GdkAtom encoding,
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);
gboolean gdk_utf8_to_compound_text (const gchar *str,
GdkAtom *encoding,
gint *format,

Some files were not shown because too many files have changed in this diff Show More