summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>1997-12-18 02:17:14 +0000
committerOwen Taylor <otaylor@src.gnome.org>1997-12-18 02:17:14 +0000
commitd5d01a5af9aaa11762d7ba86760796df00af3786 (patch)
treec12bb7c7980b3177456cab8987755a976297b205
parent65e63db01e93820093c2eb5169d5f8c0be3fe4e5 (diff)
downloadgtk+-d5d01a5af9aaa11762d7ba86760796df00af3786.tar.gz
It's all in the changelog. Well, almost all.
-owt
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in4
-rwxr-xr-xconfigure338
-rw-r--r--configure.in53
-rw-r--r--gdk/gdk.c411
-rw-r--r--gdk/gdk.h40
-rw-r--r--gdk/gdkcolor.c9
-rw-r--r--gdk/gdkfont.c47
-rw-r--r--gdk/gdkgc.c10
-rw-r--r--gdk/gdki18n.h29
-rw-r--r--gdk/gdkinput.c12
-rw-r--r--gdk/gdkinput.h13
-rw-r--r--gdk/gdkinputcommon.h174
-rw-r--r--gdk/gdkinputgxi.h3
-rw-r--r--gdk/gdkinputnone.h1
-rw-r--r--gdk/gdkinputxfree.h68
-rw-r--r--gdk/gdkpixmap.c39
-rw-r--r--gdk/gdkprivate.h10
-rw-r--r--gdk/gdktypes.h27
-rw-r--r--gdk/gdkwindow.c139
-rw-r--r--gdk/gdkxid.c2
-rw-r--r--gdk/gxid_lib.c13
-rw-r--r--gdk/x11/gdkcolor-x11.c9
-rw-r--r--gdk/x11/gdkfont-x11.c47
-rw-r--r--gdk/x11/gdkinput-gxi.c3
-rw-r--r--gdk/x11/gdkinput-none.c1
-rw-r--r--gdk/x11/gdkinput-x11.c174
-rw-r--r--gdk/x11/gdkinput-xfree.c68
-rw-r--r--gdk/x11/gdkinput.c12
-rw-r--r--gdk/x11/gdkmain-x11.c411
-rw-r--r--gdk/x11/gdkpixmap-x11.c39
-rw-r--r--gdk/x11/gdkwindow-x11.c139
-rw-r--r--gdk/x11/gdkxid.c2
-rw-r--r--gdk/x11/gxid_lib.c13
-rwxr-xr-xglib/configure44
-rw-r--r--glib/configure.in15
-rw-r--r--glib/glibconfig.h.in1
-rw-r--r--gtk/gtk.defs1428
-rw-r--r--gtk/gtkaccelerator.c19
-rw-r--r--gtk/gtkaccelerator.h1
-rw-r--r--gtk/gtkcurve.c4
-rw-r--r--gtk/gtkgamma.c4
-rw-r--r--gtk/gtkhscrollbar.c2
-rw-r--r--gtk/gtkinputdialog.c227
-rw-r--r--gtk/gtkinputdialog.h3
-rw-r--r--gtk/gtkmain.c156
-rw-r--r--gtk/gtkmain.h2
-rw-r--r--gtk/gtkmenu.c14
-rw-r--r--gtk/gtkmenufactory.c20
-rw-r--r--gtk/gtkmenuitem.c23
-rw-r--r--gtk/gtkobject.c2
-rw-r--r--gtk/gtkpixmap.c55
-rw-r--r--gtk/gtkprogressbar.c2
-rw-r--r--gtk/gtkrange.c45
-rw-r--r--gtk/gtkrc.c4
-rw-r--r--gtk/gtkruler.c4
-rw-r--r--gtk/gtksignal.c14
-rw-r--r--gtk/gtkstyle.c25
-rw-r--r--gtk/gtktext.c34
-rw-r--r--gtk/gtktooltips.c31
-rw-r--r--gtk/gtktooltips.h3
-rw-r--r--gtk/gtktypebuiltins.c6
-rw-r--r--gtk/gtktypebuiltins.h70
-rw-r--r--gtk/gtkviewport.c64
-rw-r--r--gtk/gtkvscrollbar.c2
-rw-r--r--gtk/gtkwidget.c96
-rw-r--r--gtk/gtkwindow.c108
-rw-r--r--gtk/gtkwindow.h2
-rw-r--r--gtk/testgtk.c189
-rw-r--r--gtk/testinput.c20
-rw-r--r--gtk/testselection.c1
-rw-r--r--tests/testgtk.c189
-rw-r--r--tests/testinput.c20
-rw-r--r--tests/testselection.c1
74 files changed, 3900 insertions, 1412 deletions
diff --git a/Makefile.am b/Makefile.am
index 8f24c51eb2..f8cdfedcc5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,7 +3,7 @@
SRC_SUBDIRS = glib gdk gtk
SUBDIRS = $(SRC_SUBDIRS) docs
-EXTRA_DIST = gtk+.prj makecopyright TODO
+EXTRA_DIST = gtk+.prj makecopyright TODO REFCOUNTING
.PHONY: files populate checkin release
diff --git a/Makefile.in b/Makefile.in
index cb409f1c0d..fd705f20f3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -75,7 +75,7 @@ xinput_progs = @xinput_progs@
SRC_SUBDIRS = glib gdk gtk
SUBDIRS = $(SRC_SUBDIRS) docs
-EXTRA_DIST = gtk+.prj makecopyright TODO
+EXTRA_DIST = gtk+.prj makecopyright TODO REFCOUNTING
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
@@ -88,7 +88,7 @@ ltmain.sh missing mkinstalldirs stamp-h.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP = --best
default: all
diff --git a/configure b/configure
index 9e0143f94f..8d18d05c84 100755
--- a/configure
+++ b/configure
@@ -542,6 +542,9 @@ fi
+# Save this value here, since automake will set cflags later
+cflags_set=${CFLAGS+set}
+
GTK_MAJOR_VERSION=0
GTK_MINOR_VERSION=99
GTK_MICRO_VERSION=0
@@ -574,6 +577,9 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
subdirs="glib"
+# Save this value here, since automake will set cflags later
+cflags_set=${CFLAGS+set}
+
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -585,7 +591,7 @@ subdirs="glib"
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:589: checking for a BSD compatible install" >&5
+echo "configure:595: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -638,7 +644,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:642: checking whether build environment is sane" >&5
+echo "configure:648: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -695,7 +701,7 @@ test "$program_suffix" != NONE &&
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:699: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:705: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -734,7 +740,7 @@ fi
missing_dir=`cd $ac_aux_dir && pwd`
echo $ac_n "checking for working aclocal""... $ac_c" 1>&6
-echo "configure:738: checking for working aclocal" >&5
+echo "configure:744: checking for working aclocal" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -747,7 +753,7 @@ else
fi
echo $ac_n "checking for working autoconf""... $ac_c" 1>&6
-echo "configure:751: checking for working autoconf" >&5
+echo "configure:757: checking for working autoconf" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -760,7 +766,7 @@ else
fi
echo $ac_n "checking for working automake""... $ac_c" 1>&6
-echo "configure:764: checking for working automake" >&5
+echo "configure:770: checking for working automake" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -773,7 +779,7 @@ else
fi
echo $ac_n "checking for working autoheader""... $ac_c" 1>&6
-echo "configure:777: checking for working autoheader" >&5
+echo "configure:783: checking for working autoheader" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -786,7 +792,7 @@ else
fi
echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6
-echo "configure:790: checking for working makeinfo" >&5
+echo "configure:796: checking for working makeinfo" >&5
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
@@ -812,7 +818,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:816: checking host system type" >&5
+echo "configure:822: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -835,7 +841,7 @@ echo "$ac_t""$host" 1>&6
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:839: checking for $ac_word" >&5
+echo "configure:845: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -864,7 +870,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:868: checking for $ac_word" >&5
+echo "configure:874: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -912,7 +918,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:916: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:922: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -922,11 +928,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 926 "configure"
+#line 932 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -946,12 +952,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:950: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:956: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:955: checking whether we are using GNU C" >&5
+echo "configure:961: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -960,7 +966,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:970: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -975,7 +981,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:979: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:985: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1005,7 +1011,7 @@ fi
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1009: checking for $ac_word" >&5
+echo "configure:1015: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1041,10 +1047,10 @@ fi
if test "$with_gnu_ld" = yes; then
echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:1045: checking for GNU ld" >&5
+echo "configure:1051: checking for GNU ld" >&5
else
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
-echo "configure:1048: checking for non-GNU ld" >&5
+echo "configure:1054: checking for non-GNU ld" >&5
fi
if eval "test \"`echo '$''{'ac_cv_path_LD'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1083,7 +1089,7 @@ fi
test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; }
echo $ac_n "checking whether we are using GNU ld""... $ac_c" 1>&6
-echo "configure:1087: checking whether we are using GNU ld" >&5
+echo "configure:1093: checking whether we are using GNU ld" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gnu_ld'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1099,7 +1105,7 @@ echo "$ac_t""$ac_cv_prog_gnu_ld" 1>&6
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1103: checking whether ln -s works" >&5
+echo "configure:1109: checking whether ln -s works" >&5
if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1178,7 +1184,7 @@ $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6
-echo "configure:1182: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo "configure:1188: checking whether to enable maintainer-specific portions of Makefiles" >&5
# Check whether --enable-maintainer-mode or --disable-maintainer-mode was given.
if test "${enable_maintainer_mode+set}" = set; then
enableval="$enable_maintainer_mode"
@@ -1203,7 +1209,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
fi
echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:1207: checking host system type" >&5
+echo "configure:1213: checking host system type" >&5
host_alias=$host
case "$host_alias" in
@@ -1271,14 +1277,14 @@ fi
if test -n "$DEBUGFLAG"; then
- test "${CFLAGS+set}" = set || CFLAGS="$DEBUGFLAG"
+ test "$cflags_set" = set || CFLAGS="$DEBUGFLAG"
else
CFLAGS="$CFLAGS -DNDEBUG"
fi
# Build time sanity check...
echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6
-echo "configure:1282: checking whether build environment is sane" >&5
+echo "configure:1288: checking whether build environment is sane" >&5
# Just in case
sleep 1
echo timestamp > conftestfile
@@ -1320,7 +1326,7 @@ echo "$ac_t""yes" 1>&6
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1324: checking for $ac_word" >&5
+echo "configure:1330: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1349,7 +1355,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1353: checking for $ac_word" >&5
+echo "configure:1359: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1397,7 +1403,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1401: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1407: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1407,11 +1413,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 1411 "configure"
+#line 1417 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -1431,12 +1437,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1435: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1441: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1440: checking whether we are using GNU C" >&5
+echo "configure:1446: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1445,7 +1451,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1455: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -1460,7 +1466,7 @@ if test $ac_cv_prog_gcc = yes; then
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1464: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1470: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1491,7 +1497,7 @@ fi
echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:1495: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:1501: checking for ${CC-cc} option to accept ANSI C" >&5
if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1507,7 +1513,7 @@ for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__
do
CC="$ac_save_CC $ac_arg"
cat > conftest.$ac_ext <<EOF
-#line 1511 "configure"
+#line 1517 "configure"
#include "confdefs.h"
#include <stdarg.h>
#include <stdio.h>
@@ -1544,7 +1550,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
; return 0; }
EOF
-if { (eval echo configure:1548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_prog_cc_stdc="$ac_arg"; break
else
@@ -1578,7 +1584,7 @@ esac
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1582: checking for a BSD compatible install" >&5
+echo "configure:1588: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1628,7 +1634,7 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1632: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1638: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1677,7 +1683,7 @@ fi
# Find the X11 include and library directories
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1681: checking how to run the C preprocessor" >&5
+echo "configure:1687: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1692,13 +1698,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1696 "configure"
+#line 1702 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1702: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1709,13 +1715,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1713 "configure"
+#line 1719 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1725: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
@@ -1742,7 +1748,7 @@ echo "$ac_t""$CPP" 1>&6
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1746: checking for X" >&5
+echo "configure:1752: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -1804,12 +1810,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 1808 "configure"
+#line 1814 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1878,14 +1884,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1882 "configure"
+#line 1888 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:1889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@@ -1991,17 +1997,17 @@ else
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:1995: checking whether -R must be followed by a space" >&5
+echo "configure:2001: checking whether -R must be followed by a space" >&5
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 1998 "configure"
+#line 2004 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_R_nospace=yes
else
@@ -2017,14 +2023,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 2021 "configure"
+#line 2027 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:2028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ac_R_space=yes
else
@@ -2056,7 +2062,7 @@ rm -f conftest*
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:2060: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:2066: checking for dnet_ntoa in -ldnet" >&5
ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2064,7 +2070,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2068 "configure"
+#line 2074 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2075,7 +2081,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:2079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2097,7 +2103,7 @@ fi
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:2101: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:2107: checking for dnet_ntoa in -ldnet_stub" >&5
ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2105,7 +2111,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2109 "configure"
+#line 2115 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2116,7 +2122,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:2120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2145,12 +2151,12 @@ fi
# The nsl library prevents programs from opening the X display
# on Irix 5.2, according to dickey@clark.net.
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2149: checking for gethostbyname" >&5
+echo "configure:2155: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2154 "configure"
+#line 2160 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -2173,7 +2179,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:2177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -2194,7 +2200,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2198: checking for gethostbyname in -lnsl" >&5
+echo "configure:2204: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2202,7 +2208,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2206 "configure"
+#line 2212 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2213,7 +2219,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:2217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2243,12 +2249,12 @@ fi
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:2247: checking for connect" >&5
+echo "configure:2253: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2252 "configure"
+#line 2258 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -2271,7 +2277,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -2292,7 +2298,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2296: checking for connect in -lsocket" >&5
+echo "configure:2302: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2300,7 +2306,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2304 "configure"
+#line 2310 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2311,7 +2317,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2321: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2335,12 +2341,12 @@ fi
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:2339: checking for remove" >&5
+echo "configure:2345: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2344 "configure"
+#line 2350 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -2363,7 +2369,7 @@ remove();
; return 0; }
EOF
-if { (eval echo configure:2367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
@@ -2384,7 +2390,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2388: checking for remove in -lposix" >&5
+echo "configure:2394: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2392,7 +2398,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2396 "configure"
+#line 2402 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2403,7 +2409,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:2407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2427,12 +2433,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2431: checking for shmat" >&5
+echo "configure:2437: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2436 "configure"
+#line 2442 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -2455,7 +2461,7 @@ shmat();
; return 0; }
EOF
-if { (eval echo configure:2459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
@@ -2476,7 +2482,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2480: checking for shmat in -lipc" >&5
+echo "configure:2486: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2484,7 +2490,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2488 "configure"
+#line 2494 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2495,7 +2501,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:2499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2528,7 +2534,7 @@ fi
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2532: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2538: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2536,7 +2542,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2540 "configure"
+#line 2546 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2547,7 +2553,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:2551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2557: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2585,7 +2591,7 @@ LDFLAGS="$X_LDFLAGS $X_LIBS"
# Checks for libraries.
# Check for the X11 library
echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:2589: checking for XOpenDisplay in -lX11" >&5
+echo "configure:2595: checking for XOpenDisplay in -lX11" >&5
ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2593,7 +2599,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lX11 $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2597 "configure"
+#line 2603 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2604,7 +2610,7 @@ int main() {
XOpenDisplay()
; return 0; }
EOF
-if { (eval echo configure:2608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2629,7 +2635,7 @@ fi
if test "x$enable_shm" = "xyes"; then
# Check for the Xext library (needed for XShm extention)
echo $ac_n "checking for XShmAttach in -lXext""... $ac_c" 1>&6
-echo "configure:2633: checking for XShmAttach in -lXext" >&5
+echo "configure:2639: checking for XShmAttach in -lXext" >&5
ac_lib_var=`echo Xext'_'XShmAttach | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2637,7 +2643,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXext $x_libs $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2641 "configure"
+#line 2647 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2648,7 +2654,7 @@ int main() {
XShmAttach()
; return 0; }
EOF
-if { (eval echo configure:2652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2676,7 +2682,7 @@ x_ldflags="$X_LDFLAGS $X_LIBS"
# set up things for XInput
-if test "x$with_xinput" = "xgxi -o x$with_xinput" = "xyes"; then
+if test "x$with_xinput" = "xgxi" -o "x$with_xinput" = "xyes"; then
cat >> confdefs.h <<\EOF
#define XINPUT_GXI 1
EOF
@@ -2710,17 +2716,17 @@ if test "x$enable_shm" = "xyes"; then
# Check for shared memory
ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6
-echo "configure:2714: checking for sys/ipc.h" >&5
+echo "configure:2720: checking for sys/ipc.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2719 "configure"
+#line 2725 "configure"
#include "confdefs.h"
#include <sys/ipc.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2730: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2747,17 +2753,17 @@ fi
ac_safe=`echo "sys/shm.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for sys/shm.h""... $ac_c" 1>&6
-echo "configure:2751: checking for sys/shm.h" >&5
+echo "configure:2757: checking for sys/shm.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2756 "configure"
+#line 2762 "configure"
#include "confdefs.h"
#include <sys/shm.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2761: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -2786,12 +2792,12 @@ fi
# Check whether shmctl IPC_RMID allowes subsequent attaches
if test "$ac_cv_header_sys_shm_h" = "yes"; then
echo $ac_n "checking whether shmctl IPC_RMID allowes subsequent attaches""... $ac_c" 1>&6
-echo "configure:2790: checking whether shmctl IPC_RMID allowes subsequent attaches" >&5
+echo "configure:2796: checking whether shmctl IPC_RMID allowes subsequent attaches" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""assuming no" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2795 "configure"
+#line 2801 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -2817,7 +2823,7 @@ else
}
EOF
-if { (eval echo configure:2821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
cat >> confdefs.h <<\EOF
#define IPC_RMID_DEFERRED_RELEASE 1
@@ -2837,7 +2843,7 @@ fi
# Check for the X shared memory extension header file
echo $ac_n "checking X11/extensions/XShm.h""... $ac_c" 1>&6
-echo "configure:2841: checking X11/extensions/XShm.h" >&5
+echo "configure:2847: checking X11/extensions/XShm.h" >&5
if test "x$no_ext_lib" = "xyes"; then
echo "$ac_t""no" 1>&6
no_xshm=yes
@@ -2857,7 +2863,7 @@ fi
# Check for private display resource base variable
echo $ac_n "checking resource base field in XDisplay""... $ac_c" 1>&6
-echo "configure:2861: checking resource base field in XDisplay" >&5
+echo "configure:2867: checking resource base field in XDisplay" >&5
if eval "test \"`echo '$''{'gtk_cv_display_resource_base'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2865,7 +2871,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2869 "configure"
+#line 2875 "configure"
#include "confdefs.h"
#define XLIB_ILLEGAL_ACCESS
@@ -2881,7 +2887,7 @@ main ()
display->resource_base;
}
EOF
-if { (eval echo configure:2885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2891: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
gtk_cv_display_resource_base="resource_base"
else
@@ -2901,80 +2907,28 @@ cat >> confdefs.h <<EOF
EOF
-# Look for wide string functions in wchar.h or wcstr.h
-
-echo $ac_n "checking for <wchar.h> or <wcstr.h>""... $ac_c" 1>&6
-echo "configure:2908: checking for <wchar.h> or <wcstr.h>" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2910 "configure"
-#include "confdefs.h"
-#include <wchar.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2915: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- gtk_ok=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- gtk_ok=no
-fi
-rm -f conftest*
-if test $gtk_ok = no; then
- cat > conftest.$ac_ext <<EOF
-#line 2930 "configure"
-#include "confdefs.h"
-#include <wcstr.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2935: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- gtk_ok=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- gtk_ok=no
-fi
-rm -f conftest*
- if test $gtk_ok = no; then
- need_x_locale=yes
- fi
-fi
-
-echo "$ac_t""$gtk_ok" 1>&6
-
# Check if X_LOCALE definition is necessary
echo $ac_n "checking need -DX_LOCALE""... $ac_c" 1>&6
-echo "configure:2958: checking need -DX_LOCALE" >&5
-if test x$need_x_locale = xyes; then
- echo "$ac_t""yes (C library doesn't include wide string functions)" 1>&6
-else
- if test "$cross_compiling" = yes; then
+echo "configure:2914: checking need -DX_LOCALE" >&5
+
+if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 2966 "configure"
+#line 2920 "configure"
#include "confdefs.h"
- #include <stdio.h>
- #include <locale.h>
+#include <stdio.h>
+#include <locale.h>
- int
- main ()
- {
- return setlocale (LC_ALL, "${with_locale}") == NULL;
- }
+int
+main ()
+{
+ return setlocale (LC_ALL, "${with_locale}") == NULL;
+}
EOF
-if { (eval echo configure:2978: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
need_x_locale=no
else
@@ -2986,20 +2940,20 @@ fi
rm -fr conftest*
fi
- echo "$ac_t""$need_x_locale" 1>&6
-fi
+echo "$ac_t""$need_x_locale" 1>&6
+
if test $need_x_locale = yes; then
CFLAGS="$CFLAGS -DX_LOCALE"
fi
# Checks for header files.
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2998: checking for ANSI C header files" >&5
+echo "configure:2952: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3003 "configure"
+#line 2957 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -3007,7 +2961,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3011: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -3024,7 +2978,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 3028 "configure"
+#line 2982 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -3042,7 +2996,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 3046 "configure"
+#line 3000 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -3063,7 +3017,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 3067 "configure"
+#line 3021 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3074,7 +3028,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:3078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -3100,12 +3054,12 @@ fi
# Checks for typedefs, structures, and compiler characteristics.
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3104: checking for working const" >&5
+echo "configure:3058: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3109 "configure"
+#line 3063 "configure"
#include "confdefs.h"
int main() {
@@ -3154,7 +3108,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:3158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -3177,12 +3131,12 @@ fi
# Checks for library functions.
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3181: checking return type of signal handlers" >&5
+echo "configure:3135: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3186 "configure"
+#line 3140 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -3199,7 +3153,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:3203: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -3221,16 +3175,16 @@ EOF
# Check for sys/select.h
echo $ac_n "checking fd_set and sys/select""... $ac_c" 1>&6
-echo "configure:3225: checking fd_set and sys/select" >&5
+echo "configure:3179: checking fd_set and sys/select" >&5
cat > conftest.$ac_ext <<EOF
-#line 3227 "configure"
+#line 3181 "configure"
#include "confdefs.h"
#include <sys/types.h>
int main() {
fd_set readMask, writeMask;
; return 0; }
EOF
-if { (eval echo configure:3234: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3188: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
gtk_ok=yes
else
@@ -3242,7 +3196,7 @@ fi
rm -f conftest*
if test $gtk_ok = no; then
cat > conftest.$ac_ext <<EOF
-#line 3246 "configure"
+#line 3200 "configure"
#include "confdefs.h"
#include <sys/select.h>
EOF
diff --git a/configure.in b/configure.in
index eda0652b66..4858d9078a 100644
--- a/configure.in
+++ b/configure.in
@@ -1,6 +1,9 @@
# Process this file with autoconf to produce a configure script.
AC_INIT(gdk/gdktypes.h)
+# Save this value here, since automake will set cflags later
+cflags_set=${CFLAGS+set}
+
GTK_MAJOR_VERSION=0
GTK_MINOR_VERSION=99
GTK_MICRO_VERSION=0
@@ -13,6 +16,9 @@ PACKAGE=gtk+
# Configure glib
AC_CONFIG_SUBDIRS(glib)
+# Save this value here, since automake will set cflags later
+cflags_set=${CFLAGS+set}
+
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
@@ -42,7 +48,7 @@ AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
AC_ARG_WITH(xinput, [ --with-xinput[=no/gxi/xfree] support XInput ])
if test -n "$DEBUGFLAG"; then
- test "${CFLAGS+set}" = set || CFLAGS="$DEBUGFLAG"
+ test "$cflags_set" = set || CFLAGS="$DEBUGFLAG"
else
CFLAGS="$CFLAGS -DNDEBUG"
fi
@@ -104,7 +110,7 @@ x_ldflags="$X_LDFLAGS $X_LIBS"
# set up things for XInput
-if test "x$with_xinput" = "xgxi -o x$with_xinput" = "xyes"; then
+if test "x$with_xinput" = "xgxi" -o "x$with_xinput" = "xyes"; then
AC_DEFINE(XINPUT_GXI)
xinput_progs=gxid
x_libs="-lXi $x_libs"
@@ -199,38 +205,23 @@ gtk_cv_display_resource_base="private3")])
AC_MSG_RESULT($gtk_cv_display_resource_base)
AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
-# Look for wide string functions in wchar.h or wcstr.h
-
-AC_MSG_CHECKING(for <wchar.h> or <wcstr.h>)
-AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
-if test $gtk_ok = no; then
- AC_TRY_CPP([#include <wcstr.h>], gtk_ok=yes, gtk_ok=no)
- if test $gtk_ok = no; then
- need_x_locale=yes
- fi
-fi
-
-AC_MSG_RESULT($gtk_ok)
-
# Check if X_LOCALE definition is necessary
AC_MSG_CHECKING(need -DX_LOCALE)
-if test x$need_x_locale = xyes; then
- AC_MSG_RESULT([yes (C library doesn't include wide string functions)])
-else
- AC_TRY_RUN([
- #include <stdio.h>
- #include <locale.h>
-
- int
- main ()
- {
- return setlocale (LC_ALL, "${with_locale}") == NULL;
- }],
- need_x_locale=no,
- need_x_locale=yes)
- AC_MSG_RESULT($need_x_locale)
-fi
+
+AC_TRY_RUN([
+#include <stdio.h>
+#include <locale.h>
+
+int
+main ()
+{
+ return setlocale (LC_ALL, "${with_locale}") == NULL;
+}],
+need_x_locale=no,
+need_x_locale=yes)
+AC_MSG_RESULT($need_x_locale)
+
if test $need_x_locale = yes; then
CFLAGS="$CFLAGS -DX_LOCALE"
fi
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 6c51986fac..15fbb16c68 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -88,6 +88,7 @@ struct _GdkInput
GdkInputCondition condition;
GdkInputFunction function;
gpointer data;
+ GdkDestroyNotify destroy;
};
struct _GdkPredicate
@@ -99,12 +100,19 @@ struct _GdkPredicate
/*
* Private function declarations
*/
+
+static GdkEvent *gdk_event_new (void);
static gint gdk_event_wait (void);
+static gint gdk_event_apply_filters (XEvent *xevent,
+ GdkEvent *event,
+ GList *filters);
static gint gdk_event_translate (GdkEvent *event,
XEvent *xevent);
+#if 0
static Bool gdk_event_get_type (Display *display,
XEvent *xevent,
XPointer arg);
+#endif
static void gdk_synthesize_click (GdkEvent *event,
gint nclicks);
@@ -157,15 +165,6 @@ static int connection_number = 0; /* The file descriptor numbe
* the "select" system call.
*/
-static gint received_destroy_notify = FALSE; /* Did we just receive a destroy notify
- * event? If so, we need to actually
- * destroy the window which received
- * it now.
- */
-static GdkWindow *window_to_destroy = NULL; /* If we previously received a destroy
- * notify event then this is the window
- * which received that event.
- */
static struct timeval start; /* The time at which the library was
* last initialized.
@@ -603,19 +602,68 @@ gdk_events_pending ()
/*
*--------------------------------------------------------------
+ * gdk_event_get_graphics_expose
+ *
+ * Waits for a GraphicsExpose or NoExpose event
+ *
+ * Arguments:
+ *
+ * Results:
+ * For GraphicsExpose events, returns a pointer to the event
+ * converted into a GdkEvent Otherwise, returns NULL.
+ *
+ * Side effects:
+ *
+ *-------------------------------------------------------------- */
+
+static Bool
+graphics_expose_predicate (Display *display,
+ XEvent *xevent,
+ XPointer arg)
+{
+ GdkWindowPrivate *private = (GdkWindowPrivate *)arg;
+
+ if ((xevent->xany.window == private->xwindow) &&
+ ((xevent->xany.type == GraphicsExpose) ||
+ (xevent->xany.type == NoExpose)))
+ return True;
+ else
+ return False;
+}
+
+GdkEvent *
+gdk_event_get_graphics_expose (GdkWindow *window)
+{
+ XEvent xevent;
+ GdkEvent *event;
+
+ XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer)window);
+
+ if (xevent.xany.type == GraphicsExpose)
+ {
+ event = gdk_event_new ();
+
+ if (gdk_event_translate (event, &xevent))
+ return event;
+ else
+ gdk_event_free (event);
+ }
+
+ return NULL;
+}
+
+/*
+ *--------------------------------------------------------------
* gdk_event_get
*
* Gets the next event.
*
* Arguments:
- * "event" is used to hold the received event.
- * If "event" is NULL an event is received as normal
- * however it is not placed in "event" (and thus no
- * error occurs).
*
* Results:
- * Returns TRUE if an event was received that we care about
- * and FALSE otherwise. This function will also return
+ * If an event was received that we care about, returns
+ * a pointer to that event, to be freed with gdk_event_free.
+ * Otherwise, returns NULL. This function will also return
* before an event is received if the timeout interval
* runs out.
*
@@ -624,45 +672,14 @@ gdk_events_pending ()
*--------------------------------------------------------------
*/
-gint
-gdk_event_get (GdkEvent *event,
- GdkEventFunc pred,
- gpointer data)
+GdkEvent *
+gdk_event_get (void)
{
- GdkEvent *temp_event;
- GdkPredicate event_pred;
+ GdkEvent *event;
GList *temp_list;
XEvent xevent;
- /* If the last event we received was a destroy notify
- * event then we will actually destroy the "gdk" data
- * structures now. We don't want to destroy them at the
- * time of receiving the event since the main program
- * may try to access them and may need to destroy user
- * data that has been attached to the window
- */
- if (received_destroy_notify)
- {
- if (gdk_show_events)
- g_print ("destroying window:\twindow: %ld\n",
- ((GdkWindowPrivate*) window_to_destroy)->xwindow - base_id);
-
- gdk_window_real_destroy (window_to_destroy);
- received_destroy_notify = FALSE;
- window_to_destroy = NULL;
- }
-
- /* Initially we haven't received an event and want to
- * return FALSE. If "event" is non-NULL, then initialize
- * it to the nothing event.
- */
- if (event)
- {
- event->any.type = GDK_NOTHING;
- event->any.window = NULL;
- event->any.send_event = FALSE;
- }
-
+#if 0
if (pred)
{
temp_list = putback_events;
@@ -685,65 +702,61 @@ gdk_event_get (GdkEvent *event,
event_pred.func = pred;
event_pred.data = data;
- if (XCheckIfEvent (gdk_display, &xevent, gdk_event_get_type, (XPointer) &event_pred))
+ if (XCheckIfEvent (gdk_display, &xevent, gdk_event_get_type, (XPointer) & event_pred))
if (event)
return gdk_event_translate (event, &xevent);
}
else
+#endif
+ if (putback_events)
{
- if (putback_events)
- {
- temp_event = putback_events->data;
- *event = *temp_event;
-
- temp_list = putback_events;
- putback_events = putback_events->next;
- if (putback_events)
- putback_events->prev = NULL;
-
- temp_list->next = NULL;
- temp_list->prev = NULL;
- g_list_free (temp_list);
- g_free (temp_event);
-
- return TRUE;
- }
-
- /* Wait for an event to occur or the timeout to elapse.
- * If an event occurs "gdk_event_wait" will return TRUE.
- * If the timeout elapses "gdk_event_wait" will return
- * FALSE.
+ event = putback_events->data;
+
+ temp_list = putback_events;
+ putback_events = g_list_remove_link (putback_events, temp_list);
+ g_list_free_1 (temp_list);
+
+ return event;
+ }
+
+ /* Wait for an event to occur or the timeout to elapse.
+ * If an event occurs "gdk_event_wait" will return TRUE.
+ * If the timeout elapses "gdk_event_wait" will return
+ * FALSE.
+ */
+ if (gdk_event_wait ())
+ {
+ /* If we get here we can rest assurred that an event
+ * has occurred. Read it.
*/
- if (gdk_event_wait ())
- {
- /* If we get here we can rest assurred that an event
- * has occurred. Read it.
- */
#ifdef USE_XIM
- gint filter_status;
- if (xim_using && xim_window)
- do
- { /* dont dispatch events used by IM */
- XNextEvent (gdk_display, &xevent);
- filter_status = XFilterEvent (&xevent,
- GDK_WINDOW_XWINDOW (xim_window));
- } while (filter_status == True);
- else
+ gint filter_status;
+ if (xim_using && xim_window)
+ do
+ { /* don't dispatch events used by IM */
XNextEvent (gdk_display, &xevent);
+ filter_status = XFilterEvent (&xevent,
+ GDK_WINDOW_XWINDOW (xim_window));
+ } while (filter_status == True);
+ else
+ XNextEvent (gdk_display, &xevent);
#else
- XNextEvent (gdk_display, &xevent);
+ XNextEvent (gdk_display, &xevent);
#endif
+ event = gdk_event_new ();
- event->any.send_event = xevent.xany.send_event;
-
- /* If "event" non-NULL.
- */
- if (event)
- return gdk_event_translate (event, &xevent);
- }
+ event->any.type = GDK_NOTHING;
+ event->any.window = NULL;
+ event->any.send_event = FALSE;
+ event->any.send_event = xevent.xany.send_event;
+
+ if (gdk_event_translate (event, &xevent))
+ return event;
+ else
+ gdk_event_free (event);
}
- return FALSE;
+ return NULL;
}
void
@@ -753,8 +766,7 @@ gdk_event_put (GdkEvent *event)
g_return_if_fail (event != NULL);
- new_event = g_new (GdkEvent, 1);
- *new_event = *event;
+ new_event = gdk_event_copy (event);
putback_events = g_list_prepend (putback_events, new_event);
}
@@ -779,13 +791,11 @@ gdk_event_put (GdkEvent *event)
static GMemChunk *event_chunk;
-GdkEvent*
-gdk_event_copy (GdkEvent *event)
+static GdkEvent*
+gdk_event_new (void)
{
GdkEvent *new_event;
- g_return_val_if_fail (event != NULL, NULL);
-
if (event_chunk == NULL)
event_chunk = g_mem_chunk_new ("events",
sizeof (GdkEvent),
@@ -793,8 +803,31 @@ gdk_event_copy (GdkEvent *event)
G_ALLOC_AND_FREE);
new_event = g_chunk_new (GdkEvent, event_chunk);
+
+ return new_event;
+}
+
+GdkEvent*
+gdk_event_copy (GdkEvent *event)
+{
+ GdkEvent *new_event;
+
+ g_return_val_if_fail (event != NULL, NULL);
+
+ new_event = gdk_event_new ();
+
*new_event = *event;
gdk_window_ref (new_event->any.window);
+
+ if ((event->any.type == GDK_KEY_PRESS) ||
+ (event->any.type == GDK_KEY_RELEASE))
+ new_event->key.string = g_strdup (event->key.string);
+
+ if (((event->any.type == GDK_ENTER_NOTIFY) ||
+ (event->any.type == GDK_LEAVE_NOTIFY)) &&
+ (event->crossing.subwindow != NULL))
+ gdk_window_ref (event->crossing.subwindow);
+
return new_event;
}
@@ -822,7 +855,18 @@ gdk_event_free (GdkEvent *event)
g_assert (event_chunk != NULL);
g_return_if_fail (event != NULL);
- gdk_window_unref (event->any.window);
+ if ((event->any.type == GDK_KEY_PRESS) ||
+ (event->any.type == GDK_KEY_RELEASE))
+ g_free (event->key.string);
+
+ if (event->any.window)
+ gdk_window_unref (event->any.window);
+
+ if (((event->any.type == GDK_ENTER_NOTIFY) ||
+ (event->any.type == GDK_LEAVE_NOTIFY)) &&
+ (event->crossing.subwindow != NULL))
+ gdk_window_unref (event->crossing.subwindow);
+
g_mem_chunk_free (event_chunk, event);
}
@@ -1008,10 +1052,11 @@ gdk_timer_disable ()
}
gint
-gdk_input_add (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data)
+gdk_input_add_interp (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ gpointer data,
+ GdkDestroyNotify destroy)
{
static gint next_tag = 1;
GList *list;
@@ -1028,8 +1073,11 @@ gdk_input_add (gint source,
if ((input->source == source) && (input->condition == condition))
{
+ if (input->destroy)
+ (input->destroy) (input->data);
input->function = function;
input->data = data;
+ input->destroy = destroy;
tag = input->tag;
}
}
@@ -1042,6 +1090,7 @@ gdk_input_add (gint source,
input->condition = condition;
input->function = function;
input->data = data;
+ input->destroy = destroy;
tag = input->tag;
inputs = g_list_prepend (inputs, input);
@@ -1050,6 +1099,15 @@ gdk_input_add (gint source,
return tag;
}
+gint
+gdk_input_add (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ gpointer data)
+{
+ return gdk_input_add_interp (source, condition, function, data, NULL);
+}
+
void
gdk_input_remove (gint tag)
{
@@ -1064,6 +1122,9 @@ gdk_input_remove (gint tag)
if (input->tag == tag)
{
+ if (input->destroy)
+ (input->destroy) (input->data);
+
temp_list = list;
if (list->next)
@@ -1471,6 +1532,31 @@ gdk_event_wait ()
}
static gint
+gdk_event_apply_filters (XEvent *xevent,
+ GdkEvent *event,
+ GList *filters)
+{
+ GdkEventFilter *filter;
+ GList *tmp_list;
+ GdkFilterReturn result;
+
+ tmp_list = filters;
+
+ while (tmp_list)
+ {
+ filter = (GdkEventFilter *)tmp_list->data;
+
+ result = (*filter->function)(xevent, event, filter->data);
+ if (result != GDK_FILTER_CONTINUE)
+ return result;
+
+ tmp_list = tmp_list->next;
+ }
+
+ return GDK_FILTER_CONTINUE;
+}
+
+static gint
gdk_event_translate (GdkEvent *event,
XEvent *xevent)
{
@@ -1520,6 +1606,25 @@ gdk_event_translate (GdkEvent *event,
window = gdk_window_lookup (xevent->xany.window);
window_private = (GdkWindowPrivate *) window;
+ if (window == NULL)
+ g_warning ("%#lx -> NULL\n", xevent->xany.window);
+ else
+ gdk_window_ref (window);
+
+
+ /* Check for filters for this window */
+
+ if (window_private)
+ {
+ GdkFilterReturn result;
+ result = gdk_event_apply_filters (xevent, event, window_private->filters);
+
+ if (result != GDK_FILTER_CONTINUE)
+ {
+ return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
+ }
+ }
+
/* We do a "manual" conversion of the XEvent to a
* GdkEvent. The structures are mostly the same so
* the conversion is fairly straightforward. We also
@@ -1555,7 +1660,7 @@ gdk_event_translate (GdkEvent *event,
{ /* retry */
/* alloc adequate size of buffer */
if (gdk_debug_level >= 1)
- g_print("XIM: overflow(required %i)\n", charcount);
+ g_print("XIM: overflow (required %i)\n", charcount);
while (buf_len <= charcount)
buf_len *= 2;
@@ -1603,10 +1708,14 @@ gdk_event_translate (GdkEvent *event,
event->key.window = window;
event->key.time = xevent->xkey.time;
event->key.state = (GdkModifierType) xevent->xkey.state;
- event->key.string = buf;
+ event->key.string = g_strdup (buf);
event->key.length = charcount;
return_val = window_private && !window_private->destroyed;
+
+ if (!return_val)
+ g_free (event->key.string);
+
break;
case KeyRelease:
@@ -2012,6 +2121,14 @@ gdk_event_translate (GdkEvent *event,
event->crossing.type = GDK_LEAVE_NOTIFY;
event->crossing.window = window;
+ /* If the subwindow field of the XEvent is non-NULL, then
+ * lookup the corresponding GdkWindow.
+ */
+ if (xevent->xcrossing.subwindow != None)
+ event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow);
+ else
+ event->crossing.subwindow = NULL;
+
/* Translate the crossing detail into Gdk terms.
*/
switch (xevent->xcrossing.detail)
@@ -2073,31 +2190,30 @@ gdk_event_translate (GdkEvent *event,
break;
case FocusIn:
- /* Print debugging info.
- */
- if (gdk_show_events)
- g_print ("focus in:\t\twindow: %ld\n",
- xevent->xfocus.window - base_id);
-
- event->focus_change.type = GDK_FOCUS_CHANGE;
- event->focus_change.window = window;
- event->focus_change.in = TRUE;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
case FocusOut:
- /* Print debugging info.
+ /* We only care about focus events that indicate that _this_
+ * window (not a ancestor or child) got or lost the focus
*/
- if (gdk_show_events)
- g_print ("focus out:\t\twindow: %ld\n",
- xevent->xfocus.window - base_id);
-
- event->focus_change.type = GDK_FOCUS_CHANGE;
- event->focus_change.window = window;
- event->focus_change.in = FALSE;
-
- return_val = window_private && !window_private->destroyed;
+ switch (xevent->xfocus.detail)
+ {
+ case NotifyAncestor:
+ case NotifyInferior:
+ case NotifyNonlinear:
+ /* Print debugging info.
+ */
+ if (gdk_show_events)
+ g_print ("focus %s:\t\twindow: %ld\n",
+ (xevent->xany.type == FocusIn) ? "in" : "out",
+ xevent->xfocus.window - base_id);
+
+ event->focus_change.type = GDK_FOCUS_CHANGE;
+ event->focus_change.window = window;
+ event->focus_change.in = (xevent->xany.type == FocusIn);
+
+ return_val = window_private && !window_private->destroyed;
+ break;
+ default:
+ }
break;
case KeymapNotify:
@@ -2194,15 +2310,9 @@ gdk_event_translate (GdkEvent *event,
event->any.type = GDK_DESTROY;
event->any.window = window;
- /* Remeber which window received the destroy notify
- * event so that we can destroy our associated
- * data structures the next time the user asks
- * us for an event.
- */
- received_destroy_notify = TRUE;
- window_to_destroy = window;
-
return_val = window_private && !window_private->destroyed;
+
+ gdk_window_destroy_notify (window);
break;
case UnmapNotify:
@@ -2618,9 +2728,29 @@ gdk_event_translate (GdkEvent *event,
break;
}
+ if (return_val)
+ {
+ if (event->any.window)
+ gdk_window_ref (event->any.window);
+ if (((event->any.type == GDK_ENTER_NOTIFY) ||
+ (event->any.type == GDK_LEAVE_NOTIFY)) &&
+ (event->crossing.subwindow != NULL))
+ gdk_window_ref (event->crossing.subwindow);
+ }
+ else
+ {
+ /* Mark this event as having no resources to be freed */
+ event->any.window = NULL;
+ event->any.type = GDK_NOTHING;
+ }
+
+ if (window)
+ gdk_window_unref (window);
+
return return_val;
}
+#if 0
static Bool
gdk_event_get_type (Display *display,
XEvent *xevent,
@@ -2637,6 +2767,7 @@ gdk_event_get_type (Display *display,
return FALSE;
}
+#endif
static void
gdk_synthesize_click (GdkEvent *event,
diff --git a/gdk/gdk.h b/gdk/gdk.h
index 7b05df648b..67fadaf197 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -35,9 +35,8 @@ void gdk_exit (int error_code);
gchar* gdk_set_locale (void);
gint gdk_events_pending (void);
-gint gdk_event_get (GdkEvent *event,
- GdkEventFunc pred,
- gpointer data);
+GdkEvent *gdk_event_get (void);
+GdkEvent *gdk_event_get_graphics_expose (GdkWindow *window);
void gdk_event_put (GdkEvent *event);
GdkEvent *gdk_event_copy (GdkEvent *event);
@@ -58,11 +57,16 @@ void gdk_timer_set (guint32 milliseconds);
void gdk_timer_enable (void);
void gdk_timer_disable (void);
-gint gdk_input_add (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data);
-void gdk_input_remove (gint tag);
+gint gdk_input_add_interp (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ gpointer data,
+ GdkDestroyNotify destroy);
+gint gdk_input_add (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ gpointer data);
+void gdk_input_remove (gint tag);
gint gdk_pointer_grab (GdkWindow * window,
gint owner_events,
@@ -166,6 +170,12 @@ void gdk_window_set_user_data (GdkWindow *window,
void gdk_window_set_override_redirect(GdkWindow *window,
gboolean override_redirect);
+void gdk_window_add_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data);
+void gdk_window_remove_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data);
/*
* This allows for making shaped (partially transparent) windows
@@ -350,8 +360,11 @@ GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
GdkBitmap **mask,
GdkColor *transparent_color,
gchar **data);
-void gdk_pixmap_destroy (GdkPixmap *pixmap);
+GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
+void gdk_pixmap_unref (GdkPixmap *pixmap);
+GdkBitmap *gdk_bitmap_ref (GdkBitmap *pixmap);
+void gdk_bitmap_unref (GdkBitmap *pixmap);
/* Images
@@ -383,10 +396,8 @@ void gdk_image_destroy (GdkImage *image);
*/
GdkColormap* gdk_colormap_new (GdkVisual *visual,
gint allocate);
-void gdk_colormap_destroy (GdkColormap *colormap);
-
-GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
-void gdk_colormap_unref (GdkColormap *cmap);
+GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
+void gdk_colormap_unref (GdkColormap *cmap);
GdkColormap* gdk_colormap_get_system (void);
gint gdk_colormap_get_system_size (void);
@@ -424,9 +435,8 @@ gint gdk_color_equal (GdkColor *colora,
*/
GdkFont* gdk_font_load (const gchar *font_name);
GdkFont* gdk_fontset_load (gchar *fontset_name);
-void gdk_font_free (GdkFont *font);
-void gdk_fontset_free (GdkFont *font);
GdkFont* gdk_font_ref (GdkFont *font);
+void gdk_font_unref (GdkFont *font);
gint gdk_font_id (GdkFont *font);
gint gdk_font_equal (GdkFont *fonta,
GdkFont *fontb);
diff --git a/gdk/gdkcolor.c b/gdk/gdkcolor.c
index 5e66f089ba..3ad8df8d9d 100644
--- a/gdk/gdkcolor.c
+++ b/gdk/gdkcolor.c
@@ -28,6 +28,7 @@ static void gdk_colormap_remove (GdkColormap *cmap);
static guint gdk_colormap_hash (Colormap *cmap);
static gint gdk_colormap_cmp (Colormap *a,
Colormap *b);
+static void gdk_colormap_real_destroy (GdkColormap *colormap);
static GHashTable *colormap_hash = NULL;
@@ -117,7 +118,7 @@ gdk_colormap_new (GdkVisual *visual,
return colormap;
}
-void
+static void
gdk_colormap_real_destroy (GdkColormap *colormap)
{
GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
@@ -132,12 +133,6 @@ gdk_colormap_real_destroy (GdkColormap *colormap)
g_free (colormap);
}
-void
-gdk_colormap_destroy (GdkColormap *colormap)
-{
- gdk_colormap_unref (colormap);
-}
-
GdkColormap*
gdk_colormap_ref (GdkColormap *cmap)
{
diff --git a/gdk/gdkfont.c b/gdk/gdkfont.c
index e1b1e72549..41299dc5eb 100644
--- a/gdk/gdkfont.c
+++ b/gdk/gdkfont.c
@@ -51,7 +51,7 @@ gdk_font_load (const gchar *font_name)
}
GdkFont*
-gdk_fontset_load(gchar *fontset_name)
+gdk_fontset_load (gchar *fontset_name)
{
GdkFont *font;
GdkFontPrivate *private;
@@ -93,26 +93,21 @@ gdk_fontset_load(gchar *fontset_name)
}
return font;
}
-void
-gdk_font_free (GdkFont *font)
+
+GdkFont*
+gdk_font_ref (GdkFont *font)
{
GdkFontPrivate *private;
- g_return_if_fail (font != NULL);
+ g_return_val_if_fail (font != NULL, NULL);
private = (GdkFontPrivate*) font;
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- gdk_xid_table_remove (((XFontStruct *) private->xfont)->fid);
- XFreeFont (private->xdisplay, (XFontStruct *) private->xfont);
- g_free (font);
- }
+ private->ref_count += 1;
+ return font;
}
void
-gdk_fontset_free (GdkFont *font)
+gdk_font_unref (GdkFont *font)
{
GdkFontPrivate *private;
@@ -123,23 +118,23 @@ gdk_fontset_free (GdkFont *font)
private->ref_count -= 1;
if (private->ref_count == 0)
{
- XFreeFontSet (private->xdisplay, (XFontSet) private->xfont);
+ switch (font->type)
+ {
+ case GDK_FONT_FONT:
+ gdk_xid_table_remove (((XFontStruct *) private->xfont)->fid);
+ XFreeFont (private->xdisplay, (XFontStruct *) private->xfont);
+ break;
+ case GDK_FONT_FONTSET:
+ XFreeFontSet (private->xdisplay, (XFontSet) private->xfont);
+ break;
+ default:
+ g_error ("unknown font type.");
+ break;
+ }
g_free (font);
}
}
-GdkFont*
-gdk_font_ref (GdkFont *font)
-{
- GdkFontPrivate *private;
-
- g_return_val_if_fail (font != NULL, NULL);
-
- private = (GdkFontPrivate*) font;
- private->ref_count += 1;
- return font;
-}
-
gint
gdk_font_id (GdkFont *font)
{
diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c
index a7bf8520d2..9436136c85 100644
--- a/gdk/gdkgc.c
+++ b/gdk/gdkgc.c
@@ -141,11 +141,13 @@ gdk_gc_new_with_values (GdkWindow *window,
xvalues.clip_y_origin = values->clip_y_origin;
xvalues_mask |= GCClipYOrigin;
}
+
if (values_mask & GDK_GC_EXPOSURES)
- {
- xvalues.graphics_exposures = values->graphics_exposures;
- xvalues_mask |= GCGraphicsExposures;
- }
+ xvalues.graphics_exposures = values->graphics_exposures;
+ else
+ xvalues.graphics_exposures = False;
+ xvalues_mask |= GCGraphicsExposures;
+
if (values_mask & GDK_GC_LINE_WIDTH)
{
xvalues.line_width = values->line_width;
diff --git a/gdk/gdki18n.h b/gdk/gdki18n.h
index bf1c7391cf..f1625a8f5b 100644
--- a/gdk/gdki18n.h
+++ b/gdk/gdki18n.h
@@ -27,23 +27,8 @@
#include <stdlib.h>
-#if defined(HAVE_WCTYPE_H) && !defined(X_LOCALE)
-# include <wctype.h>
-#else
-# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
-#endif /* HAVE_WCTYPE_H || !X_LOCALE */
-
-#ifndef X_LOCALE
-
-#ifdef HAVE_WCHAR_H
-# include <wchar.h>
-#else
-# ifdef HAVE_WCSTR_H
-# include <wcstr.h>
-# endif
-#endif
+#ifdef X_LOCALE
-#else /* X_LOCALE */
#include <X11/Xfuncproto.h>
#include <X11/Xosdefs.h>
@@ -160,4 +145,16 @@ extern int _g_mbtowc (wchar_t *wstr, const char *str, size_t len);
#endif /* X_LOCALE */
+#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H)) && !defined(X_LOCALE)
+# ifdef HAVE_WCTYPE_H
+# include <wctype.h>
+# else
+# ifdef HAVE_WCHAR_H
+# include <wchar.h>
+# endif
+# endif
+#else
+# define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
+#endif
+
#endif /* __GDK_I18N_H__ */
diff --git a/gdk/gdkinput.c b/gdk/gdkinput.c
index ad4b1fcc93..2efee8606a 100644
--- a/gdk/gdkinput.c
+++ b/gdk/gdkinput.c
@@ -102,6 +102,15 @@ gdk_input_set_axes (guint32 deviceid, GdkAxisUse *axes)
gdk_input_vtable.set_axes (deviceid, axes);
}
+void gdk_input_set_key (guint32 deviceid,
+ guint index,
+ guint keyval,
+ GdkModifierType modifiers)
+{
+ if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_key)
+ gdk_input_vtable.set_key (deviceid, index, keyval, modifiers);
+}
+
GdkTimeCoord *
gdk_input_motion_events (GdkWindow *window,
guint32 deviceid,
@@ -258,7 +267,7 @@ gdk_input_window_destroy (GdkWindow *window)
input_window = gdk_input_window_find (window);
g_return_if_fail (input_window != NULL);
- gdk_input_windows = g_list_remove(gdk_input_windows,input_window);
+ gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
g_free(input_window);
}
@@ -280,6 +289,7 @@ gdk_input_exit (void)
g_free(gdkdev->axes);
#endif
g_free(gdkdev->info.axes);
+ g_free(gdkdev->info.keys);
g_free(gdkdev);
}
}
diff --git a/gdk/gdkinput.h b/gdk/gdkinput.h
index e5ec5a576e..a039679b33 100644
--- a/gdk/gdkinput.h
+++ b/gdk/gdkinput.h
@@ -31,6 +31,11 @@ typedef struct _GdkInputWindow GdkInputWindow;
struct _GdkInputVTable {
gint (*set_mode) (guint32 deviceid, GdkInputMode mode);
void (*set_axes) (guint32 deviceid, GdkAxisUse *axes);
+ void (*set_key) (guint32 deviceid,
+ guint index,
+ guint keyval,
+ GdkModifierType modifiers);
+
GdkTimeCoord* (*motion_events) (GdkWindow *window,
guint32 deviceid,
guint32 start,
@@ -93,8 +98,12 @@ struct _GdkDevicePrivate {
/* Information about XInput device */
XDevice *xdevice;
- int buttonpress_type, buttonrelease_type, motionnotify_type,
- proximityin_type, proximityout_type, changenotify_type;
+ /* minimum key code for device */
+ gint min_keycode;
+
+ int buttonpress_type, buttonrelease_type, keypress_type,
+ keyrelease_type, motionnotify_type, proximityin_type,
+ proximityout_type, changenotify_type;
/* true if we need to select a different set of events, but
can't because this is the core pointer */
diff --git a/gdk/gdkinputcommon.h b/gdk/gdkinputcommon.h
index 5e457e0aa1..9b7d2c6834 100644
--- a/gdk/gdkinputcommon.h
+++ b/gdk/gdkinputcommon.h
@@ -59,6 +59,8 @@ static void gdk_input_common_get_pointer (GdkWindow *window,
gdouble *ytilt,
GdkModifierType *mask);
+#define GDK_MAX_DEVICE_CLASSES 13
+
/* Global variables */
static gint gdk_input_root_width;
@@ -156,6 +158,8 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
/* step through the classes */
gdkdev->info.num_axes = 0;
+ gdkdev->info.num_keys = 0;
+ gdkdev->info.keys = NULL;
gdkdev->axes = 0;
gdkdev->info.has_cursor = 0;
gdkdev->needs_update = FALSE;
@@ -170,6 +174,21 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
{
break;
}
+ case KeyClass:
+ {
+ XKeyInfo *xki = (XKeyInfo *)class;
+ gdkdev->info.num_keys = xki->max_keycode - xki->min_keycode + 1;
+ gdkdev->min_keycode = xki->min_keycode;
+ gdkdev->info.keys = g_new (GdkDeviceKey, gdkdev->info.num_keys);
+
+ for (j=0; j<gdkdev->info.num_keys; j++)
+ {
+ gdkdev->info.keys[j].keyval = 0;
+ gdkdev->info.keys[j].modifiers = 0;
+ }
+
+ break;
+ }
case ValuatorClass:
{
XValuatorInfo *xvi = (XValuatorInfo *)class;
@@ -218,6 +237,8 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
g_free(gdkdev->info.name);
if (gdkdev->axes)
g_free(gdkdev->axes);
+ if (gdkdev->info.keys)
+ g_free(gdkdev->info.keys);
g_free(gdkdev);
return NULL;
}
@@ -225,6 +246,15 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
if (device->use != IsXPointer)
gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->info.deviceid);
+ gdkdev->buttonpress_type = 0;
+ gdkdev->buttonrelease_type = 0;
+ gdkdev->keypress_type = 0;
+ gdkdev->keyrelease_type = 0;
+ gdkdev->motionnotify_type = 0;
+ gdkdev->proximityin_type = 0;
+ gdkdev->proximityout_type = 0;
+ gdkdev->changenotify_type = 0;
+
return gdkdev;
}
@@ -240,11 +270,15 @@ gdk_input_common_find_events(GdkWindow *window,
i = 0;
/* We have to track press and release events in pairs to keep
- track of button state correctly and implement grabbing */
+ track of button state correctly and implement grabbing for
+ the gxi support */
if (mask & GDK_BUTTON_PRESS_MASK || mask & GDK_BUTTON_RELEASE_MASK)
{
- DeviceButtonPress (gdkdev->xdevice, gdkdev->buttonpress_type,
- class);
+ DeviceButtonPress (gdkdev->xdevice, gdkdev->buttonpress_type,
+ class);
+ if (class != 0)
+ classes[i++] = class;
+ DeviceButtonPressGrab (gdkdev->xdevice, 0, class);
if (class != 0)
classes[i++] = class;
DeviceButtonRelease (gdkdev->xdevice, gdkdev->buttonrelease_type,
@@ -258,6 +292,38 @@ gdk_input_common_find_events(GdkWindow *window,
if (class != 0)
classes[i++] = class;
}
+ else
+ if (mask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
+ GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK))
+ {
+ /* Make sure gdkdev->motionnotify_type is set */
+ DeviceMotionNotify (gdkdev->xdevice, gdkdev->motionnotify_type, class);
+ }
+ if (mask & GDK_BUTTON1_MOTION_MASK)
+ {
+ DeviceButton1Motion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_BUTTON2_MOTION_MASK)
+ {
+ DeviceButton2Motion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_BUTTON3_MOTION_MASK)
+ {
+ DeviceButton3Motion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_BUTTON_MOTION_MASK)
+ {
+ DeviceButtonMotion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
if (mask & GDK_POINTER_MOTION_HINT_MASK)
{
/* We'll get into trouble if the macros change, but at least we'll
@@ -266,6 +332,18 @@ gdk_input_common_find_events(GdkWindow *window,
if (class != 0)
classes[i++] = class;
}
+ if (mask & GDK_KEY_PRESS_MASK)
+ {
+ DeviceKeyPress (gdkdev->xdevice, gdkdev->keypress_type, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_KEY_RELEASE_MASK)
+ {
+ DeviceKeyRelease (gdkdev->xdevice, gdkdev->keyrelease_type, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
if (mask & GDK_PROXIMITY_IN_MASK)
{
ProximityIn (gdkdev->xdevice, gdkdev->proximityin_type, class);
@@ -286,7 +364,7 @@ static void
gdk_input_common_select_events(GdkWindow *window,
GdkDevicePrivate *gdkdev)
{
- XEventClass classes[6];
+ XEventClass classes[GDK_MAX_DEVICE_CLASSES];
gint num_classes;
if (gdkdev->info.mode == GDK_MODE_DISABLED)
@@ -492,9 +570,55 @@ gdk_input_common_other_event (GdkEvent *event,
event->button.state = gdk_input_translate_state(xdbe->state,xdbe->device_state);
event->button.button = xdbe->button;
+ if (gdk_show_events)
+ g_print ("button %s:\t\twindow: %ld device: %ld x,y: %f %f button: %d\n",
+ (event->button.type == GDK_BUTTON_PRESS) ? "press" : "release",
+ xdbe->window,
+ xdbe->deviceid,
+ event->button.x, event->button.y,
+ xdbe->button);
+
return TRUE;
}
+ if ((xevent->type == gdkdev->keypress_type) ||
+ (xevent->type == gdkdev->keyrelease_type))
+ {
+ XDeviceKeyEvent *xdke = (XDeviceKeyEvent *)(xevent);
+ event->key.keyval = gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].keyval;
+
+ if (gdk_show_events)
+ g_print ("device key %s:\twindow: %ld device: %ld keycode: %d\n",
+ (event->key.type == GDK_KEY_PRESS) ? "press" : "release",
+ xdke->window,
+ xdke->deviceid,
+ xdke->keycode);
+
+ if (event->key.keyval == 0)
+ {
+ if (gdk_show_events)
+ g_print ("\t\ttranslation - NONE\n");
+
+ return FALSE;
+ }
+
+ event->key.type = (xdke->type == gdkdev->keypress_type) ?
+ GDK_KEY_PRESS : GDK_KEY_RELEASE;
+
+ event->key.window = input_window->window;
+ event->key.time = xdke->time;
+
+ event->key.state = gdk_input_translate_state(xdke->state, xdke->device_state)
+ | gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].modifiers;
+
+ if (gdk_show_events)
+ g_print ("\t\ttranslation - keyval: %d modifiers: %#x\n",
+ event->key.keyval,
+ event->key.state);
+
+ return TRUE;
+ }
+
if (xevent->type == gdkdev->motionnotify_type)
{
XDeviceMotionEvent *xdme = (XDeviceMotionEvent *)(xevent);
@@ -511,15 +635,17 @@ gdk_input_common_other_event (GdkEvent *event,
event->motion.deviceid = xdme->deviceid;
event->motion.state = gdk_input_translate_state(xdme->state,
xdme->device_state);
+ event->motion.is_hint = xdme->is_hint;
event->motion.source = gdkdev->info.source;
event->motion.deviceid = xdme->deviceid;
if (gdk_show_events)
- g_print ("motion notify:\t\twindow: %ld device: %ld x,y: %f %f hint: %s\n",
+ g_print ("motion notify:\t\twindow: %ld device: %ld x,y: %f %f state %#4x hint: %s\n",
xdme->window,
xdme->deviceid,
event->motion.x, event->motion.y,
- (xevent->xmotion.is_hint) ? "true" : "false");
+ event->motion.state,
+ (xdme->is_hint) ? "true" : "false");
return TRUE;
@@ -562,6 +688,21 @@ gdk_input_common_set_axes (guint32 deviceid, GdkAxisUse *axes)
}
}
+void gdk_input_common_set_key (guint32 deviceid,
+ guint index,
+ guint keyval,
+ GdkModifierType modifiers)
+{
+ GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
+
+ gdkdev = gdk_input_find_device (deviceid);
+ g_return_if_fail (gdkdev != NULL);
+ g_return_if_fail (index < gdkdev->info.num_keys);
+
+ gdkdev->info.keys[index].keyval = keyval;
+ gdkdev->info.keys[index].modifiers = modifiers;
+}
+
static GdkTimeCoord *
gdk_input_common_motion_events (GdkWindow *window,
guint32 deviceid,
@@ -658,24 +799,21 @@ gdk_input_common_get_pointer (GdkWindow *window,
switch (input_class->class)
{
case ValuatorClass:
- gdk_input_translate_coordinates(gdkdev, input_window,
- ((XValuatorState *)input_class)->valuators,
- x, y, pressure,
- xtilt, ytilt);
+ gdk_input_translate_coordinates (gdkdev, input_window,
+ ((XValuatorState *)input_class)->valuators,
+ x, y, pressure,
+ xtilt, ytilt);
break;
case ButtonClass:
if (mask)
{
- *mask &= ~(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK |
- GDK_BUTTON3_MASK | GDK_BUTTON4_MASK |
- GDK_BUTTON5_MASK);
- for (i=0; i < ((XButtonState *)input_class)->num_buttons; i++)
- {
- if (((XButtonState *)input_class)->buttons[i])
- *mask |= GDK_BUTTON1_MASK << i;
- }
+ *mask &= 0xFF;
+ if (((XButtonState *)input_class)->num_buttons > 0)
+ *mask |= ((XButtonState *)input_class)->buttons[0] << 7;
+ /* GDK_BUTTON1_MASK = 1 << 8, and button n is stored
+ * in bit 1<<(n%8) in byte n/8. n = 1,2,... */
}
break;
}
diff --git a/gdk/gdkinputgxi.h b/gdk/gdkinputgxi.h
index a30e05f956..3d67eb513e 100644
--- a/gdk/gdkinputgxi.h
+++ b/gdk/gdkinputgxi.h
@@ -75,7 +75,8 @@ gdk_input_init(void)
GList *tmp_list;
gdk_input_vtable.set_mode = gdk_input_gxi_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_key = gdk_input_common_set_key;
gdk_input_vtable.motion_events = gdk_input_gxi_motion_events;
gdk_input_vtable.get_pointer = gdk_input_gxi_get_pointer;
gdk_input_vtable.grab_pointer = gdk_input_gxi_grab_pointer;
diff --git a/gdk/gdkinputnone.h b/gdk/gdkinputnone.h
index 8ae8c4189a..6dd999b837 100644
--- a/gdk/gdkinputnone.h
+++ b/gdk/gdkinputnone.h
@@ -32,6 +32,7 @@ gdk_input_init ()
{
gdk_input_vtable.set_mode = NULL;
gdk_input_vtable.set_axes = NULL;
+ gdk_input_vtable.set_key = NULL;
gdk_input_vtable.motion_events = NULL;
gdk_input_vtable.get_pointer = gdk_input_none_get_pointer;
gdk_input_vtable.grab_pointer = NULL;
diff --git a/gdk/gdkinputxfree.h b/gdk/gdkinputxfree.h
index f742490088..704c11aefa 100644
--- a/gdk/gdkinputxfree.h
+++ b/gdk/gdkinputxfree.h
@@ -44,7 +44,8 @@ void
gdk_input_init(void)
{
gdk_input_vtable.set_mode = gdk_input_xfree_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_key = gdk_input_common_set_key;
gdk_input_vtable.motion_events = gdk_input_common_motion_events;
gdk_input_vtable.get_pointer = gdk_input_common_get_pointer;
gdk_input_vtable.grab_pointer = gdk_input_xfree_grab_pointer;
@@ -229,33 +230,6 @@ gdk_input_xfree_other_event (GdkEvent *event,
gdk_input_ignore_core)
gdk_input_check_proximity();
- /* Do a passive button grab. We have to be careful not to release
- an explicit grab, if any. Doubling the grab should be harmless,
- but we check anyways. */
-
- /* FIXME, finding the proper events here is going to be SLOW - but
- we might have different sets for each window/device combination */
-
- if (return_val> 0 && !input_window->grabbed)
- {
- if (event->type == GDK_BUTTON_PRESS)
- {
- XEventClass event_classes[6];
- gint num_classes;
-
- gdk_input_common_find_events (window, gdkdev,
- ((GdkWindowPrivate *)window)->extension_events,
- event_classes, &num_classes);
-
- XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- TRUE, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, event->button.time);
- }
- else if (event->type == GDK_BUTTON_RELEASE)
- XUngrabDevice( GDK_DISPLAY(), gdkdev->xdevice, event->button.time);
- }
-
return return_val;
}
@@ -284,8 +258,9 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
GdkInputWindow *input_window, *new_window;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
- XEventClass event_classes[6];
+ XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
gint num_classes;
+ gint result;
tmp_list = gdk_input_windows;
new_window = NULL;
@@ -296,15 +271,12 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
return AlreadyGrabbed;
if (input_window->window == window)
- {
- new_window = input_window;
- break;
- }
+ new_window = input_window;
tmp_list = tmp_list->next;
}
- g_return_if_fail (new_window == NULL);
+ g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
new_window->grabbed = TRUE;
@@ -313,17 +285,21 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice && !gdkdev->button_state)
+ gdkdev->xdevice)
{
- gdk_input_common_find_events (window, gdkdev,
- ((GdkWindowPrivate *)window)->extension_events,
+ gdk_input_common_find_events (window, gdkdev,
+ event_mask,
event_classes, &num_classes);
- /* FIXME: we should do something on failure */
- XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- TRUE, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, time);
+ result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
+ GDK_WINDOW_XWINDOW (window),
+ owner_events, num_classes, event_classes,
+ GrabModeAsync, GrabModeAsync, time);
+
+ /* FIXME: if failure occurs on something other than the first
+ device, things will be badly inconsistent */
+ if (result != Success)
+ return result;
}
tmp_list = tmp_list->next;
}
@@ -355,11 +331,9 @@ gdk_input_xfree_ungrab_pointer (guint32 time)
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice && !gdkdev->button_state)
- {
- XUngrabDevice( gdk_display, gdkdev->xdevice, time);
- }
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice)
+ XUngrabDevice( gdk_display, gdkdev->xdevice, time);
+
tmp_list = tmp_list->next;
}
}
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
index b1eaba214d..cf95dfc86e 100644
--- a/gdk/gdkpixmap.c
+++ b/gdk/gdkpixmap.c
@@ -650,22 +650,39 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
return pixmap;
}
-void
-gdk_pixmap_destroy (GdkPixmap *pixmap)
+GdkPixmap*
+gdk_pixmap_ref (GdkPixmap *pixmap)
{
- GdkWindowPrivate *private;
+ GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
+ g_return_val_if_fail (pixmap != NULL, NULL);
- g_return_if_fail (pixmap != NULL);
+ private->ref_count += 1;
+ return pixmap;
+}
- private = (GdkPixmapPrivate*) pixmap;
- if (private->ref_count <= 0)
+void
+gdk_pixmap_unref (GdkPixmap *pixmap)
+{
+ GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
+ g_return_if_fail(pixmap != NULL);
+
+ private->ref_count -= 1;
+ if (private->ref_count == 0)
{
XFreePixmap (private->xdisplay, private->xwindow);
gdk_xid_table_remove (private->xwindow);
- g_free (pixmap);
- }
- else
- {
- private->ref_count -= 1;
+ g_free (private);
}
}
+
+GdkBitmap *
+gdk_bitmap_ref (GdkBitmap *bitmap)
+{
+ return (GdkBitmap *)gdk_pixmap_ref ((GdkPixmap *)bitmap);
+}
+
+void
+gdk_bitmap_unref (GdkBitmap *bitmap)
+{
+ gdk_pixmap_unref ((GdkPixmap *)bitmap);
+}
diff --git a/gdk/gdkprivate.h b/gdk/gdkprivate.h
index faee892e7f..f4e1fa5476 100644
--- a/gdk/gdkprivate.h
+++ b/gdk/gdkprivate.h
@@ -43,6 +43,7 @@ typedef struct _GdkColormapPrivate GdkColormapPrivate;
typedef struct _GdkVisualPrivate GdkVisualPrivate;
typedef struct _GdkFontPrivate GdkFontPrivate;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
+typedef struct _GdkEventFilter GdkEventFilter;
typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
@@ -76,6 +77,8 @@ struct _GdkWindowPrivate
/* need to allow custom drag/drop cursors */
gint extension_events;
+
+ GList *filters;
};
struct _GdkImagePrivate
@@ -149,6 +152,10 @@ struct _GdkDndGlobals {
};
typedef struct _GdkDndGlobals GdkDndGlobals;
+struct _GdkEventFilter {
+ GdkFilterFunc function;
+ gpointer data;
+};
#ifdef USE_XIM
@@ -157,6 +164,7 @@ struct _GdkICPrivate
XIC xic;
GdkIMStyle style;
};
+
typedef struct _GdkICPrivate GdkICPrivate;
#endif /* USE_XIM */
@@ -179,8 +187,8 @@ void gdk_image_exit (void);
GdkColormap* gdk_colormap_lookup (Colormap xcolormap);
GdkVisual* gdk_visual_lookup (Visual *xvisual);
-void gdk_window_real_destroy (GdkWindow *window);
void gdk_window_add_colormap_windows (GdkWindow *window);
+void gdk_window_destroy_notify (GdkWindow *window);
void gdk_xid_table_insert (XID *xid,
gpointer data);
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 714b7f23a0..680cd16bbc 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -79,6 +79,7 @@ typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
typedef struct _GdkEventDropLeave GdkEventDropLeave;
typedef struct _GdkEventClient GdkEventClient;
typedef union _GdkEvent GdkEvent;
+typedef struct _GdkDeviceKey GdkDeviceKey;
typedef struct _GdkDeviceInfo GdkDeviceInfo;
typedef struct _GdkTimeCoord GdkTimeCoord;
typedef gint (*GdkEventFunc) (GdkEvent *event,
@@ -279,6 +280,12 @@ typedef enum
GDK_CURSOR_IS_PIXMAP = -1
} GdkCursorType;
+typedef enum {
+ GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
+ GDK_FILTER_TRANSLATE, /* Translated event stored */
+ GDK_FILTER_REMOVE /* Terminate processing, removing event */
+} GdkFilterReturn;
+
/* Event types.
* Nothing: No event occurred.
* Delete: A window delete event was sent by the window manager.
@@ -568,6 +575,7 @@ typedef void (*GdkInputFunction) (gpointer data,
gint source,
GdkInputCondition condition);
+typedef void (*GdkDestroyNotify) (gpointer data);
/* Color Context modes.
*
@@ -589,7 +597,6 @@ typedef enum
GDK_CC_MODE_PALETTE
} GdkColorContextMode;
-
/* The color type.
* A color consists of red, green and blue values in the
* range 0-65535 and a pixel value. The pixel value is highly
@@ -801,6 +808,12 @@ struct _GdkColorContext
/* Types for XInput support */
+struct _GdkDeviceKey
+{
+ guint keyval;
+ GdkModifierType modifiers;
+};
+
struct _GdkDeviceInfo
{
guint32 deviceid;
@@ -810,6 +823,8 @@ struct _GdkDeviceInfo
gint has_cursor; /* TRUE if the X pointer follows device motion */
gint num_axes;
GdkAxisUse *axes; /* Specifies use for each axis */
+ gint num_keys;
+ GdkDeviceKey *keys;
};
struct _GdkTimeCoord
@@ -822,6 +837,14 @@ struct _GdkTimeCoord
gdouble ytilt;
};
+/* Event filtering */
+
+typedef void GdkXEvent; /* Can be cast to XEvent */
+
+typedef GdkFilterReturn (*GdkFilterFunc) (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data);
+
struct _GdkEventAny
{
GdkEventType type;
@@ -1037,8 +1060,6 @@ struct _GdkEventClient
} data;
};
-typedef void GdkXEvent; /* Can be cast to XEvent */
-
struct _GdkEventOther
{
GdkEventType type;
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 6d9ebff365..240be850ca 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -25,6 +25,7 @@
#include "gdkinput.h"
#include "gdkprivate.h"
#include <stdlib.h>
+#include <stdio.h>
int nevent_masks = 16;
int event_mask_table[18] =
@@ -137,6 +138,8 @@ gdk_window_new (GdkWindow *parent,
private->dnd_drag_data_numtypesavail = 0;
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
+ private->filters = NULL;
+
window->user_data = NULL;
if (attributes_mask & GDK_WA_VISUAL)
@@ -227,6 +230,7 @@ gdk_window_new (GdkWindow *parent,
x, y, private->width, private->height,
0, depth, class, xvisual,
xattributes_mask, &xattributes);
+ gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
switch (private->window_type)
@@ -320,16 +324,24 @@ gdk_window_foreign_new (guint32 anid)
private->destroyed = FALSE;
private->extension_events = 0;
+ private->filters = NULL;
window->user_data = NULL;
+ gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
return window;
}
-void
-gdk_window_destroy (GdkWindow *window)
+/* Call this function when you want a window and all its children to
+ disappear. When xdestroy is true, a request to destroy the XWindow
+ is sent out. When it is false, it is assumed that the XWindow has
+ been or will be destroyed by destroying some ancestor of this
+ window. */
+
+static void
+gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
{
GdkWindowPrivate *private;
GdkWindowPrivate *temp_private;
@@ -340,27 +352,14 @@ gdk_window_destroy (GdkWindow *window)
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
- if(private->dnd_drag_data_numtypesavail > 0)
- {
- free(private->dnd_drag_data_typesavail);
- private->dnd_drag_data_typesavail = NULL;
- }
- if(private->dnd_drop_data_numtypesavail > 0)
- {
- free(private->dnd_drop_data_typesavail);
- private->dnd_drop_data_typesavail = NULL;
- }
-
+
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
- if (private->ref_count >= 1)
- private->ref_count -= 1;
-
- if (!private->destroyed || (private->destroyed == 2))
+ if (!private->destroyed)
{
children = gdk_window_get_children (window);
tmp = children;
@@ -371,18 +370,24 @@ gdk_window_destroy (GdkWindow *window)
tmp = tmp->next;
temp_private = (GdkWindowPrivate*) temp_window;
- if (temp_private && !temp_private->destroyed)
- /* Removes some nice coredumps... /David */
- {
- temp_private->destroyed = 2;
- temp_private->ref_count += 1;
- gdk_window_destroy (temp_window);
- }
+ if (temp_private)
+ gdk_window_internal_destroy (temp_window, FALSE);
}
g_list_free (children);
- if (!private->destroyed)
+ if(private->dnd_drag_data_numtypesavail > 0)
+ {
+ g_free (private->dnd_drag_data_typesavail);
+ private->dnd_drag_data_typesavail = NULL;
+ }
+ if(private->dnd_drop_data_numtypesavail > 0)
+ {
+ g_free (private->dnd_drop_data_typesavail);
+ private->dnd_drop_data_typesavail = NULL;
+ }
+
+ if (xdestroy)
XDestroyWindow (private->xdisplay, private->xwindow);
private->destroyed = TRUE;
}
@@ -393,14 +398,25 @@ gdk_window_destroy (GdkWindow *window)
break;
case GDK_WINDOW_PIXMAP:
- g_warning ("called gdk_window_destroy on a pixmap (use gdk_pixmap_destroy)");
- gdk_pixmap_destroy (window);
+ g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
break;
}
}
+/* Like internal_destroy, but also destroys the reference created by
+ gdk_window_new. */
+
void
-gdk_window_real_destroy (GdkWindow *window)
+gdk_window_destroy (GdkWindow *window)
+{
+ gdk_window_internal_destroy (window, TRUE);
+ gdk_window_unref (window);
+}
+
+/* This function is called when the XWindow is really gone. */
+
+void
+gdk_window_destroy_notify (GdkWindow *window)
{
GdkWindowPrivate *private;
@@ -411,11 +427,8 @@ gdk_window_real_destroy (GdkWindow *window)
if (private->extension_events != 0)
gdk_input_window_destroy (window);
- if (private->ref_count == 0)
- {
- gdk_xid_table_remove (private->xwindow);
- g_free (window);
- }
+ gdk_xid_table_remove (private->xwindow);
+ gdk_window_unref (window);
}
GdkWindow*
@@ -436,7 +449,11 @@ gdk_window_unref (GdkWindow *window)
private->ref_count -= 1;
if (private->ref_count == 0)
- gdk_window_real_destroy (window);
+ {
+ if (!private->destroyed)
+ g_warning ("losing last reference to undestroyed window\n");
+ g_free (window);
+ }
}
void
@@ -1364,6 +1381,60 @@ gdk_window_dnd_data_set (GdkWindow *window,
NoEventMask, &sev);
}
+void
+gdk_window_add_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
+{
+ GdkWindowPrivate *private;
+ GList *tmp_list;
+ GdkEventFilter *filter;
+
+ private = (GdkWindowPrivate *)window;
+
+ tmp_list = private->filters;
+ while (tmp_list)
+ {
+ filter = (GdkEventFilter *)tmp_list->data;
+ if ((filter->function == function) && (filter->data == data))
+ return;
+ tmp_list = tmp_list->next;
+ }
+
+ filter = g_new (GdkEventFilter, 1);
+ filter->function = function;
+ filter->data = data;
+
+ private->filters = g_list_append (private->filters, filter);
+}
+
+void
+gdk_window_remove_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
+{
+ GdkWindowPrivate *private;
+ GList *tmp_list;
+ GdkEventFilter *filter;
+
+ private = (GdkWindowPrivate *)window;
+
+ tmp_list = private->filters;
+ while (tmp_list)
+ {
+ filter = (GdkEventFilter *)tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ if ((filter->function == function) && (filter->data == data))
+ {
+ private->filters = g_list_remove_link (private->filters, tmp_list);
+ g_list_free_1 (tmp_list);
+
+ return;
+ }
+ }
+}
+
void
gdk_window_set_override_redirect(GdkWindow *window,
gboolean override_redirect)
diff --git a/gdk/gdkxid.c b/gdk/gdkxid.c
index 7ee6075c53..94c304f4ed 100644
--- a/gdk/gdkxid.c
+++ b/gdk/gdkxid.c
@@ -16,7 +16,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "gdkprivate.h"
-
+#include <stdio.h>
static guint gdk_xid_hash (XID *xid);
static gint gdk_xid_compare (XID *a,
diff --git a/gdk/gxid_lib.c b/gdk/gxid_lib.c
index 357b764513..64c1e53b1f 100644
--- a/gdk/gxid_lib.c
+++ b/gdk/gxid_lib.c
@@ -5,6 +5,7 @@
*/
#include "../config.h"
+#include "gxid_lib.h"
#ifdef XINPUT_GXI
@@ -16,8 +17,6 @@
#include <netinet/in.h>
#include <netdb.h>
-#include "gxid_lib.h"
-
/* handles mechanics of communicating with a client */
static int
gxid_send_message(char *host, int port, GxidMessage *msg)
@@ -112,5 +111,15 @@ gxid_release_device(char *host, int port, GxidU32 device, GxidU32 window)
return gxid_send_message(host,port,(GxidMessage *)&msg);
}
+#else /* !XINPUT_GXI */
+
+/* Some compilers don't like empty source files */
+int
+gxid_claim_device(char *host, int port, GxidU32 device, GxidU32 window,
+ int exclusive)
+{
+ return 0;
+}
+
#endif /* XINPUT_GXI */
diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c
index 5e66f089ba..3ad8df8d9d 100644
--- a/gdk/x11/gdkcolor-x11.c
+++ b/gdk/x11/gdkcolor-x11.c
@@ -28,6 +28,7 @@ static void gdk_colormap_remove (GdkColormap *cmap);
static guint gdk_colormap_hash (Colormap *cmap);
static gint gdk_colormap_cmp (Colormap *a,
Colormap *b);
+static void gdk_colormap_real_destroy (GdkColormap *colormap);
static GHashTable *colormap_hash = NULL;
@@ -117,7 +118,7 @@ gdk_colormap_new (GdkVisual *visual,
return colormap;
}
-void
+static void
gdk_colormap_real_destroy (GdkColormap *colormap)
{
GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
@@ -132,12 +133,6 @@ gdk_colormap_real_destroy (GdkColormap *colormap)
g_free (colormap);
}
-void
-gdk_colormap_destroy (GdkColormap *colormap)
-{
- gdk_colormap_unref (colormap);
-}
-
GdkColormap*
gdk_colormap_ref (GdkColormap *cmap)
{
diff --git a/gdk/x11/gdkfont-x11.c b/gdk/x11/gdkfont-x11.c
index e1b1e72549..41299dc5eb 100644
--- a/gdk/x11/gdkfont-x11.c
+++ b/gdk/x11/gdkfont-x11.c
@@ -51,7 +51,7 @@ gdk_font_load (const gchar *font_name)
}
GdkFont*
-gdk_fontset_load(gchar *fontset_name)
+gdk_fontset_load (gchar *fontset_name)
{
GdkFont *font;
GdkFontPrivate *private;
@@ -93,26 +93,21 @@ gdk_fontset_load(gchar *fontset_name)
}
return font;
}
-void
-gdk_font_free (GdkFont *font)
+
+GdkFont*
+gdk_font_ref (GdkFont *font)
{
GdkFontPrivate *private;
- g_return_if_fail (font != NULL);
+ g_return_val_if_fail (font != NULL, NULL);
private = (GdkFontPrivate*) font;
-
- private->ref_count -= 1;
- if (private->ref_count == 0)
- {
- gdk_xid_table_remove (((XFontStruct *) private->xfont)->fid);
- XFreeFont (private->xdisplay, (XFontStruct *) private->xfont);
- g_free (font);
- }
+ private->ref_count += 1;
+ return font;
}
void
-gdk_fontset_free (GdkFont *font)
+gdk_font_unref (GdkFont *font)
{
GdkFontPrivate *private;
@@ -123,23 +118,23 @@ gdk_fontset_free (GdkFont *font)
private->ref_count -= 1;
if (private->ref_count == 0)
{
- XFreeFontSet (private->xdisplay, (XFontSet) private->xfont);
+ switch (font->type)
+ {
+ case GDK_FONT_FONT:
+ gdk_xid_table_remove (((XFontStruct *) private->xfont)->fid);
+ XFreeFont (private->xdisplay, (XFontStruct *) private->xfont);
+ break;
+ case GDK_FONT_FONTSET:
+ XFreeFontSet (private->xdisplay, (XFontSet) private->xfont);
+ break;
+ default:
+ g_error ("unknown font type.");
+ break;
+ }
g_free (font);
}
}
-GdkFont*
-gdk_font_ref (GdkFont *font)
-{
- GdkFontPrivate *private;
-
- g_return_val_if_fail (font != NULL, NULL);
-
- private = (GdkFontPrivate*) font;
- private->ref_count += 1;
- return font;
-}
-
gint
gdk_font_id (GdkFont *font)
{
diff --git a/gdk/x11/gdkinput-gxi.c b/gdk/x11/gdkinput-gxi.c
index a30e05f956..3d67eb513e 100644
--- a/gdk/x11/gdkinput-gxi.c
+++ b/gdk/x11/gdkinput-gxi.c
@@ -75,7 +75,8 @@ gdk_input_init(void)
GList *tmp_list;
gdk_input_vtable.set_mode = gdk_input_gxi_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_key = gdk_input_common_set_key;
gdk_input_vtable.motion_events = gdk_input_gxi_motion_events;
gdk_input_vtable.get_pointer = gdk_input_gxi_get_pointer;
gdk_input_vtable.grab_pointer = gdk_input_gxi_grab_pointer;
diff --git a/gdk/x11/gdkinput-none.c b/gdk/x11/gdkinput-none.c
index 8ae8c4189a..6dd999b837 100644
--- a/gdk/x11/gdkinput-none.c
+++ b/gdk/x11/gdkinput-none.c
@@ -32,6 +32,7 @@ gdk_input_init ()
{
gdk_input_vtable.set_mode = NULL;
gdk_input_vtable.set_axes = NULL;
+ gdk_input_vtable.set_key = NULL;
gdk_input_vtable.motion_events = NULL;
gdk_input_vtable.get_pointer = gdk_input_none_get_pointer;
gdk_input_vtable.grab_pointer = NULL;
diff --git a/gdk/x11/gdkinput-x11.c b/gdk/x11/gdkinput-x11.c
index 5e457e0aa1..9b7d2c6834 100644
--- a/gdk/x11/gdkinput-x11.c
+++ b/gdk/x11/gdkinput-x11.c
@@ -59,6 +59,8 @@ static void gdk_input_common_get_pointer (GdkWindow *window,
gdouble *ytilt,
GdkModifierType *mask);
+#define GDK_MAX_DEVICE_CLASSES 13
+
/* Global variables */
static gint gdk_input_root_width;
@@ -156,6 +158,8 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
/* step through the classes */
gdkdev->info.num_axes = 0;
+ gdkdev->info.num_keys = 0;
+ gdkdev->info.keys = NULL;
gdkdev->axes = 0;
gdkdev->info.has_cursor = 0;
gdkdev->needs_update = FALSE;
@@ -170,6 +174,21 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
{
break;
}
+ case KeyClass:
+ {
+ XKeyInfo *xki = (XKeyInfo *)class;
+ gdkdev->info.num_keys = xki->max_keycode - xki->min_keycode + 1;
+ gdkdev->min_keycode = xki->min_keycode;
+ gdkdev->info.keys = g_new (GdkDeviceKey, gdkdev->info.num_keys);
+
+ for (j=0; j<gdkdev->info.num_keys; j++)
+ {
+ gdkdev->info.keys[j].keyval = 0;
+ gdkdev->info.keys[j].modifiers = 0;
+ }
+
+ break;
+ }
case ValuatorClass:
{
XValuatorInfo *xvi = (XValuatorInfo *)class;
@@ -218,6 +237,8 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
g_free(gdkdev->info.name);
if (gdkdev->axes)
g_free(gdkdev->axes);
+ if (gdkdev->info.keys)
+ g_free(gdkdev->info.keys);
g_free(gdkdev);
return NULL;
}
@@ -225,6 +246,15 @@ gdk_input_device_new(XDeviceInfo *device, gint include_core)
if (device->use != IsXPointer)
gdkdev->xdevice = XOpenDevice(gdk_display, gdkdev->info.deviceid);
+ gdkdev->buttonpress_type = 0;
+ gdkdev->buttonrelease_type = 0;
+ gdkdev->keypress_type = 0;
+ gdkdev->keyrelease_type = 0;
+ gdkdev->motionnotify_type = 0;
+ gdkdev->proximityin_type = 0;
+ gdkdev->proximityout_type = 0;
+ gdkdev->changenotify_type = 0;
+
return gdkdev;
}
@@ -240,11 +270,15 @@ gdk_input_common_find_events(GdkWindow *window,
i = 0;
/* We have to track press and release events in pairs to keep
- track of button state correctly and implement grabbing */
+ track of button state correctly and implement grabbing for
+ the gxi support */
if (mask & GDK_BUTTON_PRESS_MASK || mask & GDK_BUTTON_RELEASE_MASK)
{
- DeviceButtonPress (gdkdev->xdevice, gdkdev->buttonpress_type,
- class);
+ DeviceButtonPress (gdkdev->xdevice, gdkdev->buttonpress_type,
+ class);
+ if (class != 0)
+ classes[i++] = class;
+ DeviceButtonPressGrab (gdkdev->xdevice, 0, class);
if (class != 0)
classes[i++] = class;
DeviceButtonRelease (gdkdev->xdevice, gdkdev->buttonrelease_type,
@@ -258,6 +292,38 @@ gdk_input_common_find_events(GdkWindow *window,
if (class != 0)
classes[i++] = class;
}
+ else
+ if (mask & (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK |
+ GDK_BUTTON3_MOTION_MASK | GDK_BUTTON_MOTION_MASK |
+ GDK_POINTER_MOTION_HINT_MASK))
+ {
+ /* Make sure gdkdev->motionnotify_type is set */
+ DeviceMotionNotify (gdkdev->xdevice, gdkdev->motionnotify_type, class);
+ }
+ if (mask & GDK_BUTTON1_MOTION_MASK)
+ {
+ DeviceButton1Motion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_BUTTON2_MOTION_MASK)
+ {
+ DeviceButton2Motion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_BUTTON3_MOTION_MASK)
+ {
+ DeviceButton3Motion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_BUTTON_MOTION_MASK)
+ {
+ DeviceButtonMotion (gdkdev->xdevice, 0, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
if (mask & GDK_POINTER_MOTION_HINT_MASK)
{
/* We'll get into trouble if the macros change, but at least we'll
@@ -266,6 +332,18 @@ gdk_input_common_find_events(GdkWindow *window,
if (class != 0)
classes[i++] = class;
}
+ if (mask & GDK_KEY_PRESS_MASK)
+ {
+ DeviceKeyPress (gdkdev->xdevice, gdkdev->keypress_type, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
+ if (mask & GDK_KEY_RELEASE_MASK)
+ {
+ DeviceKeyRelease (gdkdev->xdevice, gdkdev->keyrelease_type, class);
+ if (class != 0)
+ classes[i++] = class;
+ }
if (mask & GDK_PROXIMITY_IN_MASK)
{
ProximityIn (gdkdev->xdevice, gdkdev->proximityin_type, class);
@@ -286,7 +364,7 @@ static void
gdk_input_common_select_events(GdkWindow *window,
GdkDevicePrivate *gdkdev)
{
- XEventClass classes[6];
+ XEventClass classes[GDK_MAX_DEVICE_CLASSES];
gint num_classes;
if (gdkdev->info.mode == GDK_MODE_DISABLED)
@@ -492,9 +570,55 @@ gdk_input_common_other_event (GdkEvent *event,
event->button.state = gdk_input_translate_state(xdbe->state,xdbe->device_state);
event->button.button = xdbe->button;
+ if (gdk_show_events)
+ g_print ("button %s:\t\twindow: %ld device: %ld x,y: %f %f button: %d\n",
+ (event->button.type == GDK_BUTTON_PRESS) ? "press" : "release",
+ xdbe->window,
+ xdbe->deviceid,
+ event->button.x, event->button.y,
+ xdbe->button);
+
return TRUE;
}
+ if ((xevent->type == gdkdev->keypress_type) ||
+ (xevent->type == gdkdev->keyrelease_type))
+ {
+ XDeviceKeyEvent *xdke = (XDeviceKeyEvent *)(xevent);
+ event->key.keyval = gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].keyval;
+
+ if (gdk_show_events)
+ g_print ("device key %s:\twindow: %ld device: %ld keycode: %d\n",
+ (event->key.type == GDK_KEY_PRESS) ? "press" : "release",
+ xdke->window,
+ xdke->deviceid,
+ xdke->keycode);
+
+ if (event->key.keyval == 0)
+ {
+ if (gdk_show_events)
+ g_print ("\t\ttranslation - NONE\n");
+
+ return FALSE;
+ }
+
+ event->key.type = (xdke->type == gdkdev->keypress_type) ?
+ GDK_KEY_PRESS : GDK_KEY_RELEASE;
+
+ event->key.window = input_window->window;
+ event->key.time = xdke->time;
+
+ event->key.state = gdk_input_translate_state(xdke->state, xdke->device_state)
+ | gdkdev->info.keys[xdke->keycode - gdkdev->min_keycode].modifiers;
+
+ if (gdk_show_events)
+ g_print ("\t\ttranslation - keyval: %d modifiers: %#x\n",
+ event->key.keyval,
+ event->key.state);
+
+ return TRUE;
+ }
+
if (xevent->type == gdkdev->motionnotify_type)
{
XDeviceMotionEvent *xdme = (XDeviceMotionEvent *)(xevent);
@@ -511,15 +635,17 @@ gdk_input_common_other_event (GdkEvent *event,
event->motion.deviceid = xdme->deviceid;
event->motion.state = gdk_input_translate_state(xdme->state,
xdme->device_state);
+ event->motion.is_hint = xdme->is_hint;
event->motion.source = gdkdev->info.source;
event->motion.deviceid = xdme->deviceid;
if (gdk_show_events)
- g_print ("motion notify:\t\twindow: %ld device: %ld x,y: %f %f hint: %s\n",
+ g_print ("motion notify:\t\twindow: %ld device: %ld x,y: %f %f state %#4x hint: %s\n",
xdme->window,
xdme->deviceid,
event->motion.x, event->motion.y,
- (xevent->xmotion.is_hint) ? "true" : "false");
+ event->motion.state,
+ (xdme->is_hint) ? "true" : "false");
return TRUE;
@@ -562,6 +688,21 @@ gdk_input_common_set_axes (guint32 deviceid, GdkAxisUse *axes)
}
}
+void gdk_input_common_set_key (guint32 deviceid,
+ guint index,
+ guint keyval,
+ GdkModifierType modifiers)
+{
+ GdkDevicePrivate *gdkdev = gdk_input_find_device(deviceid);
+
+ gdkdev = gdk_input_find_device (deviceid);
+ g_return_if_fail (gdkdev != NULL);
+ g_return_if_fail (index < gdkdev->info.num_keys);
+
+ gdkdev->info.keys[index].keyval = keyval;
+ gdkdev->info.keys[index].modifiers = modifiers;
+}
+
static GdkTimeCoord *
gdk_input_common_motion_events (GdkWindow *window,
guint32 deviceid,
@@ -658,24 +799,21 @@ gdk_input_common_get_pointer (GdkWindow *window,
switch (input_class->class)
{
case ValuatorClass:
- gdk_input_translate_coordinates(gdkdev, input_window,
- ((XValuatorState *)input_class)->valuators,
- x, y, pressure,
- xtilt, ytilt);
+ gdk_input_translate_coordinates (gdkdev, input_window,
+ ((XValuatorState *)input_class)->valuators,
+ x, y, pressure,
+ xtilt, ytilt);
break;
case ButtonClass:
if (mask)
{
- *mask &= ~(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK |
- GDK_BUTTON3_MASK | GDK_BUTTON4_MASK |
- GDK_BUTTON5_MASK);
- for (i=0; i < ((XButtonState *)input_class)->num_buttons; i++)
- {
- if (((XButtonState *)input_class)->buttons[i])
- *mask |= GDK_BUTTON1_MASK << i;
- }
+ *mask &= 0xFF;
+ if (((XButtonState *)input_class)->num_buttons > 0)
+ *mask |= ((XButtonState *)input_class)->buttons[0] << 7;
+ /* GDK_BUTTON1_MASK = 1 << 8, and button n is stored
+ * in bit 1<<(n%8) in byte n/8. n = 1,2,... */
}
break;
}
diff --git a/gdk/x11/gdkinput-xfree.c b/gdk/x11/gdkinput-xfree.c
index f742490088..704c11aefa 100644
--- a/gdk/x11/gdkinput-xfree.c
+++ b/gdk/x11/gdkinput-xfree.c
@@ -44,7 +44,8 @@ void
gdk_input_init(void)
{
gdk_input_vtable.set_mode = gdk_input_xfree_set_mode;
- gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_axes = gdk_input_common_set_axes;
+ gdk_input_vtable.set_key = gdk_input_common_set_key;
gdk_input_vtable.motion_events = gdk_input_common_motion_events;
gdk_input_vtable.get_pointer = gdk_input_common_get_pointer;
gdk_input_vtable.grab_pointer = gdk_input_xfree_grab_pointer;
@@ -229,33 +230,6 @@ gdk_input_xfree_other_event (GdkEvent *event,
gdk_input_ignore_core)
gdk_input_check_proximity();
- /* Do a passive button grab. We have to be careful not to release
- an explicit grab, if any. Doubling the grab should be harmless,
- but we check anyways. */
-
- /* FIXME, finding the proper events here is going to be SLOW - but
- we might have different sets for each window/device combination */
-
- if (return_val> 0 && !input_window->grabbed)
- {
- if (event->type == GDK_BUTTON_PRESS)
- {
- XEventClass event_classes[6];
- gint num_classes;
-
- gdk_input_common_find_events (window, gdkdev,
- ((GdkWindowPrivate *)window)->extension_events,
- event_classes, &num_classes);
-
- XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- TRUE, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, event->button.time);
- }
- else if (event->type == GDK_BUTTON_RELEASE)
- XUngrabDevice( GDK_DISPLAY(), gdkdev->xdevice, event->button.time);
- }
-
return return_val;
}
@@ -284,8 +258,9 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
GdkInputWindow *input_window, *new_window;
GdkDevicePrivate *gdkdev;
GList *tmp_list;
- XEventClass event_classes[6];
+ XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
gint num_classes;
+ gint result;
tmp_list = gdk_input_windows;
new_window = NULL;
@@ -296,15 +271,12 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
return AlreadyGrabbed;
if (input_window->window == window)
- {
- new_window = input_window;
- break;
- }
+ new_window = input_window;
tmp_list = tmp_list->next;
}
- g_return_if_fail (new_window == NULL);
+ g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
new_window->grabbed = TRUE;
@@ -313,17 +285,21 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice && !gdkdev->button_state)
+ gdkdev->xdevice)
{
- gdk_input_common_find_events (window, gdkdev,
- ((GdkWindowPrivate *)window)->extension_events,
+ gdk_input_common_find_events (window, gdkdev,
+ event_mask,
event_classes, &num_classes);
- /* FIXME: we should do something on failure */
- XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
- GDK_WINDOW_XWINDOW (window),
- TRUE, num_classes, event_classes,
- GrabModeAsync, GrabModeAsync, time);
+ result = XGrabDevice( GDK_DISPLAY(), gdkdev->xdevice,
+ GDK_WINDOW_XWINDOW (window),
+ owner_events, num_classes, event_classes,
+ GrabModeAsync, GrabModeAsync, time);
+
+ /* FIXME: if failure occurs on something other than the first
+ device, things will be badly inconsistent */
+ if (result != Success)
+ return result;
}
tmp_list = tmp_list->next;
}
@@ -355,11 +331,9 @@ gdk_input_xfree_ungrab_pointer (guint32 time)
while (tmp_list)
{
gdkdev = (GdkDevicePrivate *)tmp_list->data;
- if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
- gdkdev->xdevice && !gdkdev->button_state)
- {
- XUngrabDevice( gdk_display, gdkdev->xdevice, time);
- }
+ if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice)
+ XUngrabDevice( gdk_display, gdkdev->xdevice, time);
+
tmp_list = tmp_list->next;
}
}
diff --git a/gdk/x11/gdkinput.c b/gdk/x11/gdkinput.c
index ad4b1fcc93..2efee8606a 100644
--- a/gdk/x11/gdkinput.c
+++ b/gdk/x11/gdkinput.c
@@ -102,6 +102,15 @@ gdk_input_set_axes (guint32 deviceid, GdkAxisUse *axes)
gdk_input_vtable.set_axes (deviceid, axes);
}
+void gdk_input_set_key (guint32 deviceid,
+ guint index,
+ guint keyval,
+ GdkModifierType modifiers)
+{
+ if (deviceid != GDK_CORE_POINTER && gdk_input_vtable.set_key)
+ gdk_input_vtable.set_key (deviceid, index, keyval, modifiers);
+}
+
GdkTimeCoord *
gdk_input_motion_events (GdkWindow *window,
guint32 deviceid,
@@ -258,7 +267,7 @@ gdk_input_window_destroy (GdkWindow *window)
input_window = gdk_input_window_find (window);
g_return_if_fail (input_window != NULL);
- gdk_input_windows = g_list_remove(gdk_input_windows,input_window);
+ gdk_input_windows = g_list_remove (gdk_input_windows,input_window);
g_free(input_window);
}
@@ -280,6 +289,7 @@ gdk_input_exit (void)
g_free(gdkdev->axes);
#endif
g_free(gdkdev->info.axes);
+ g_free(gdkdev->info.keys);
g_free(gdkdev);
}
}
diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c
index 6c51986fac..15fbb16c68 100644
--- a/gdk/x11/gdkmain-x11.c
+++ b/gdk/x11/gdkmain-x11.c
@@ -88,6 +88,7 @@ struct _GdkInput
GdkInputCondition condition;
GdkInputFunction function;
gpointer data;
+ GdkDestroyNotify destroy;
};
struct _GdkPredicate
@@ -99,12 +100,19 @@ struct _GdkPredicate
/*
* Private function declarations
*/
+
+static GdkEvent *gdk_event_new (void);
static gint gdk_event_wait (void);
+static gint gdk_event_apply_filters (XEvent *xevent,
+ GdkEvent *event,
+ GList *filters);
static gint gdk_event_translate (GdkEvent *event,
XEvent *xevent);
+#if 0
static Bool gdk_event_get_type (Display *display,
XEvent *xevent,
XPointer arg);
+#endif
static void gdk_synthesize_click (GdkEvent *event,
gint nclicks);
@@ -157,15 +165,6 @@ static int connection_number = 0; /* The file descriptor numbe
* the "select" system call.
*/
-static gint received_destroy_notify = FALSE; /* Did we just receive a destroy notify
- * event? If so, we need to actually
- * destroy the window which received
- * it now.
- */
-static GdkWindow *window_to_destroy = NULL; /* If we previously received a destroy
- * notify event then this is the window
- * which received that event.
- */
static struct timeval start; /* The time at which the library was
* last initialized.
@@ -603,19 +602,68 @@ gdk_events_pending ()
/*
*--------------------------------------------------------------
+ * gdk_event_get_graphics_expose
+ *
+ * Waits for a GraphicsExpose or NoExpose event
+ *
+ * Arguments:
+ *
+ * Results:
+ * For GraphicsExpose events, returns a pointer to the event
+ * converted into a GdkEvent Otherwise, returns NULL.
+ *
+ * Side effects:
+ *
+ *-------------------------------------------------------------- */
+
+static Bool
+graphics_expose_predicate (Display *display,
+ XEvent *xevent,
+ XPointer arg)
+{
+ GdkWindowPrivate *private = (GdkWindowPrivate *)arg;
+
+ if ((xevent->xany.window == private->xwindow) &&
+ ((xevent->xany.type == GraphicsExpose) ||
+ (xevent->xany.type == NoExpose)))
+ return True;
+ else
+ return False;
+}
+
+GdkEvent *
+gdk_event_get_graphics_expose (GdkWindow *window)
+{
+ XEvent xevent;
+ GdkEvent *event;
+
+ XIfEvent (gdk_display, &xevent, graphics_expose_predicate, (XPointer)window);
+
+ if (xevent.xany.type == GraphicsExpose)
+ {
+ event = gdk_event_new ();
+
+ if (gdk_event_translate (event, &xevent))
+ return event;
+ else
+ gdk_event_free (event);
+ }
+
+ return NULL;
+}
+
+/*
+ *--------------------------------------------------------------
* gdk_event_get
*
* Gets the next event.
*
* Arguments:
- * "event" is used to hold the received event.
- * If "event" is NULL an event is received as normal
- * however it is not placed in "event" (and thus no
- * error occurs).
*
* Results:
- * Returns TRUE if an event was received that we care about
- * and FALSE otherwise. This function will also return
+ * If an event was received that we care about, returns
+ * a pointer to that event, to be freed with gdk_event_free.
+ * Otherwise, returns NULL. This function will also return
* before an event is received if the timeout interval
* runs out.
*
@@ -624,45 +672,14 @@ gdk_events_pending ()
*--------------------------------------------------------------
*/
-gint
-gdk_event_get (GdkEvent *event,
- GdkEventFunc pred,
- gpointer data)
+GdkEvent *
+gdk_event_get (void)
{
- GdkEvent *temp_event;
- GdkPredicate event_pred;
+ GdkEvent *event;
GList *temp_list;
XEvent xevent;
- /* If the last event we received was a destroy notify
- * event then we will actually destroy the "gdk" data
- * structures now. We don't want to destroy them at the
- * time of receiving the event since the main program
- * may try to access them and may need to destroy user
- * data that has been attached to the window
- */
- if (received_destroy_notify)
- {
- if (gdk_show_events)
- g_print ("destroying window:\twindow: %ld\n",
- ((GdkWindowPrivate*) window_to_destroy)->xwindow - base_id);
-
- gdk_window_real_destroy (window_to_destroy);
- received_destroy_notify = FALSE;
- window_to_destroy = NULL;
- }
-
- /* Initially we haven't received an event and want to
- * return FALSE. If "event" is non-NULL, then initialize
- * it to the nothing event.
- */
- if (event)
- {
- event->any.type = GDK_NOTHING;
- event->any.window = NULL;
- event->any.send_event = FALSE;
- }
-
+#if 0
if (pred)
{
temp_list = putback_events;
@@ -685,65 +702,61 @@ gdk_event_get (GdkEvent *event,
event_pred.func = pred;
event_pred.data = data;
- if (XCheckIfEvent (gdk_display, &xevent, gdk_event_get_type, (XPointer) &event_pred))
+ if (XCheckIfEvent (gdk_display, &xevent, gdk_event_get_type, (XPointer) & event_pred))
if (event)
return gdk_event_translate (event, &xevent);
}
else
+#endif
+ if (putback_events)
{
- if (putback_events)
- {
- temp_event = putback_events->data;
- *event = *temp_event;
-
- temp_list = putback_events;
- putback_events = putback_events->next;
- if (putback_events)
- putback_events->prev = NULL;
-
- temp_list->next = NULL;
- temp_list->prev = NULL;
- g_list_free (temp_list);
- g_free (temp_event);
-
- return TRUE;
- }
-
- /* Wait for an event to occur or the timeout to elapse.
- * If an event occurs "gdk_event_wait" will return TRUE.
- * If the timeout elapses "gdk_event_wait" will return
- * FALSE.
+ event = putback_events->data;
+
+ temp_list = putback_events;
+ putback_events = g_list_remove_link (putback_events, temp_list);
+ g_list_free_1 (temp_list);
+
+ return event;
+ }
+
+ /* Wait for an event to occur or the timeout to elapse.
+ * If an event occurs "gdk_event_wait" will return TRUE.
+ * If the timeout elapses "gdk_event_wait" will return
+ * FALSE.
+ */
+ if (gdk_event_wait ())
+ {
+ /* If we get here we can rest assurred that an event
+ * has occurred. Read it.
*/
- if (gdk_event_wait ())
- {
- /* If we get here we can rest assurred that an event
- * has occurred. Read it.
- */
#ifdef USE_XIM
- gint filter_status;
- if (xim_using && xim_window)
- do
- { /* dont dispatch events used by IM */
- XNextEvent (gdk_display, &xevent);
- filter_status = XFilterEvent (&xevent,
- GDK_WINDOW_XWINDOW (xim_window));
- } while (filter_status == True);
- else
+ gint filter_status;
+ if (xim_using && xim_window)
+ do
+ { /* don't dispatch events used by IM */
XNextEvent (gdk_display, &xevent);
+ filter_status = XFilterEvent (&xevent,
+ GDK_WINDOW_XWINDOW (xim_window));
+ } while (filter_status == True);
+ else
+ XNextEvent (gdk_display, &xevent);
#else
- XNextEvent (gdk_display, &xevent);
+ XNextEvent (gdk_display, &xevent);
#endif
+ event = gdk_event_new ();
- event->any.send_event = xevent.xany.send_event;
-
- /* If "event" non-NULL.
- */
- if (event)
- return gdk_event_translate (event, &xevent);
- }
+ event->any.type = GDK_NOTHING;
+ event->any.window = NULL;
+ event->any.send_event = FALSE;
+ event->any.send_event = xevent.xany.send_event;
+
+ if (gdk_event_translate (event, &xevent))
+ return event;
+ else
+ gdk_event_free (event);
}
- return FALSE;
+ return NULL;
}
void
@@ -753,8 +766,7 @@ gdk_event_put (GdkEvent *event)
g_return_if_fail (event != NULL);
- new_event = g_new (GdkEvent, 1);
- *new_event = *event;
+ new_event = gdk_event_copy (event);
putback_events = g_list_prepend (putback_events, new_event);
}
@@ -779,13 +791,11 @@ gdk_event_put (GdkEvent *event)
static GMemChunk *event_chunk;
-GdkEvent*
-gdk_event_copy (GdkEvent *event)
+static GdkEvent*
+gdk_event_new (void)
{
GdkEvent *new_event;
- g_return_val_if_fail (event != NULL, NULL);
-
if (event_chunk == NULL)
event_chunk = g_mem_chunk_new ("events",
sizeof (GdkEvent),
@@ -793,8 +803,31 @@ gdk_event_copy (GdkEvent *event)
G_ALLOC_AND_FREE);
new_event = g_chunk_new (GdkEvent, event_chunk);
+
+ return new_event;
+}
+
+GdkEvent*
+gdk_event_copy (GdkEvent *event)
+{
+ GdkEvent *new_event;
+
+ g_return_val_if_fail (event != NULL, NULL);
+
+ new_event = gdk_event_new ();
+
*new_event = *event;
gdk_window_ref (new_event->any.window);
+
+ if ((event->any.type == GDK_KEY_PRESS) ||
+ (event->any.type == GDK_KEY_RELEASE))
+ new_event->key.string = g_strdup (event->key.string);
+
+ if (((event->any.type == GDK_ENTER_NOTIFY) ||
+ (event->any.type == GDK_LEAVE_NOTIFY)) &&
+ (event->crossing.subwindow != NULL))
+ gdk_window_ref (event->crossing.subwindow);
+
return new_event;
}
@@ -822,7 +855,18 @@ gdk_event_free (GdkEvent *event)
g_assert (event_chunk != NULL);
g_return_if_fail (event != NULL);
- gdk_window_unref (event->any.window);
+ if ((event->any.type == GDK_KEY_PRESS) ||
+ (event->any.type == GDK_KEY_RELEASE))
+ g_free (event->key.string);
+
+ if (event->any.window)
+ gdk_window_unref (event->any.window);
+
+ if (((event->any.type == GDK_ENTER_NOTIFY) ||
+ (event->any.type == GDK_LEAVE_NOTIFY)) &&
+ (event->crossing.subwindow != NULL))
+ gdk_window_unref (event->crossing.subwindow);
+
g_mem_chunk_free (event_chunk, event);
}
@@ -1008,10 +1052,11 @@ gdk_timer_disable ()
}
gint
-gdk_input_add (gint source,
- GdkInputCondition condition,
- GdkInputFunction function,
- gpointer data)
+gdk_input_add_interp (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ gpointer data,
+ GdkDestroyNotify destroy)
{
static gint next_tag = 1;
GList *list;
@@ -1028,8 +1073,11 @@ gdk_input_add (gint source,
if ((input->source == source) && (input->condition == condition))
{
+ if (input->destroy)
+ (input->destroy) (input->data);
input->function = function;
input->data = data;
+ input->destroy = destroy;
tag = input->tag;
}
}
@@ -1042,6 +1090,7 @@ gdk_input_add (gint source,
input->condition = condition;
input->function = function;
input->data = data;
+ input->destroy = destroy;
tag = input->tag;
inputs = g_list_prepend (inputs, input);
@@ -1050,6 +1099,15 @@ gdk_input_add (gint source,
return tag;
}
+gint
+gdk_input_add (gint source,
+ GdkInputCondition condition,
+ GdkInputFunction function,
+ gpointer data)
+{
+ return gdk_input_add_interp (source, condition, function, data, NULL);
+}
+
void
gdk_input_remove (gint tag)
{
@@ -1064,6 +1122,9 @@ gdk_input_remove (gint tag)
if (input->tag == tag)
{
+ if (input->destroy)
+ (input->destroy) (input->data);
+
temp_list = list;
if (list->next)
@@ -1471,6 +1532,31 @@ gdk_event_wait ()
}
static gint
+gdk_event_apply_filters (XEvent *xevent,
+ GdkEvent *event,
+ GList *filters)
+{
+ GdkEventFilter *filter;
+ GList *tmp_list;
+ GdkFilterReturn result;
+
+ tmp_list = filters;
+
+ while (tmp_list)
+ {
+ filter = (GdkEventFilter *)tmp_list->data;
+
+ result = (*filter->function)(xevent, event, filter->data);
+ if (result != GDK_FILTER_CONTINUE)
+ return result;
+
+ tmp_list = tmp_list->next;
+ }
+
+ return GDK_FILTER_CONTINUE;
+}
+
+static gint
gdk_event_translate (GdkEvent *event,
XEvent *xevent)
{
@@ -1520,6 +1606,25 @@ gdk_event_translate (GdkEvent *event,
window = gdk_window_lookup (xevent->xany.window);
window_private = (GdkWindowPrivate *) window;
+ if (window == NULL)
+ g_warning ("%#lx -> NULL\n", xevent->xany.window);
+ else
+ gdk_window_ref (window);
+
+
+ /* Check for filters for this window */
+
+ if (window_private)
+ {
+ GdkFilterReturn result;
+ result = gdk_event_apply_filters (xevent, event, window_private->filters);
+
+ if (result != GDK_FILTER_CONTINUE)
+ {
+ return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
+ }
+ }
+
/* We do a "manual" conversion of the XEvent to a
* GdkEvent. The structures are mostly the same so
* the conversion is fairly straightforward. We also
@@ -1555,7 +1660,7 @@ gdk_event_translate (GdkEvent *event,
{ /* retry */
/* alloc adequate size of buffer */
if (gdk_debug_level >= 1)
- g_print("XIM: overflow(required %i)\n", charcount);
+ g_print("XIM: overflow (required %i)\n", charcount);
while (buf_len <= charcount)
buf_len *= 2;
@@ -1603,10 +1708,14 @@ gdk_event_translate (GdkEvent *event,
event->key.window = window;
event->key.time = xevent->xkey.time;
event->key.state = (GdkModifierType) xevent->xkey.state;
- event->key.string = buf;
+ event->key.string = g_strdup (buf);
event->key.length = charcount;
return_val = window_private && !window_private->destroyed;
+
+ if (!return_val)
+ g_free (event->key.string);
+
break;
case KeyRelease:
@@ -2012,6 +2121,14 @@ gdk_event_translate (GdkEvent *event,
event->crossing.type = GDK_LEAVE_NOTIFY;
event->crossing.window = window;
+ /* If the subwindow field of the XEvent is non-NULL, then
+ * lookup the corresponding GdkWindow.
+ */
+ if (xevent->xcrossing.subwindow != None)
+ event->crossing.subwindow = gdk_window_lookup (xevent->xcrossing.subwindow);
+ else
+ event->crossing.subwindow = NULL;
+
/* Translate the crossing detail into Gdk terms.
*/
switch (xevent->xcrossing.detail)
@@ -2073,31 +2190,30 @@ gdk_event_translate (GdkEvent *event,
break;
case FocusIn:
- /* Print debugging info.
- */
- if (gdk_show_events)
- g_print ("focus in:\t\twindow: %ld\n",
- xevent->xfocus.window - base_id);
-
- event->focus_change.type = GDK_FOCUS_CHANGE;
- event->focus_change.window = window;
- event->focus_change.in = TRUE;
-
- return_val = window_private && !window_private->destroyed;
- break;
-
case FocusOut:
- /* Print debugging info.
+ /* We only care about focus events that indicate that _this_
+ * window (not a ancestor or child) got or lost the focus
*/
- if (gdk_show_events)
- g_print ("focus out:\t\twindow: %ld\n",
- xevent->xfocus.window - base_id);
-
- event->focus_change.type = GDK_FOCUS_CHANGE;
- event->focus_change.window = window;
- event->focus_change.in = FALSE;
-
- return_val = window_private && !window_private->destroyed;
+ switch (xevent->xfocus.detail)
+ {
+ case NotifyAncestor:
+ case NotifyInferior:
+ case NotifyNonlinear:
+ /* Print debugging info.
+ */
+ if (gdk_show_events)
+ g_print ("focus %s:\t\twindow: %ld\n",
+ (xevent->xany.type == FocusIn) ? "in" : "out",
+ xevent->xfocus.window - base_id);
+
+ event->focus_change.type = GDK_FOCUS_CHANGE;
+ event->focus_change.window = window;
+ event->focus_change.in = (xevent->xany.type == FocusIn);
+
+ return_val = window_private && !window_private->destroyed;
+ break;
+ default:
+ }
break;
case KeymapNotify:
@@ -2194,15 +2310,9 @@ gdk_event_translate (GdkEvent *event,
event->any.type = GDK_DESTROY;
event->any.window = window;
- /* Remeber which window received the destroy notify
- * event so that we can destroy our associated
- * data structures the next time the user asks
- * us for an event.
- */
- received_destroy_notify = TRUE;
- window_to_destroy = window;
-
return_val = window_private && !window_private->destroyed;
+
+ gdk_window_destroy_notify (window);
break;
case UnmapNotify:
@@ -2618,9 +2728,29 @@ gdk_event_translate (GdkEvent *event,
break;
}
+ if (return_val)
+ {
+ if (event->any.window)
+ gdk_window_ref (event->any.window);
+ if (((event->any.type == GDK_ENTER_NOTIFY) ||
+ (event->any.type == GDK_LEAVE_NOTIFY)) &&
+ (event->crossing.subwindow != NULL))
+ gdk_window_ref (event->crossing.subwindow);
+ }
+ else
+ {
+ /* Mark this event as having no resources to be freed */
+ event->any.window = NULL;
+ event->any.type = GDK_NOTHING;
+ }
+
+ if (window)
+ gdk_window_unref (window);
+
return return_val;
}
+#if 0
static Bool
gdk_event_get_type (Display *display,
XEvent *xevent,
@@ -2637,6 +2767,7 @@ gdk_event_get_type (Display *display,
return FALSE;
}
+#endif
static void
gdk_synthesize_click (GdkEvent *event,
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
index b1eaba214d..cf95dfc86e 100644
--- a/gdk/x11/gdkpixmap-x11.c
+++ b/gdk/x11/gdkpixmap-x11.c
@@ -650,22 +650,39 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
return pixmap;
}
-void
-gdk_pixmap_destroy (GdkPixmap *pixmap)
+GdkPixmap*
+gdk_pixmap_ref (GdkPixmap *pixmap)
{
- GdkWindowPrivate *private;
+ GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
+ g_return_val_if_fail (pixmap != NULL, NULL);
- g_return_if_fail (pixmap != NULL);
+ private->ref_count += 1;
+ return pixmap;
+}
- private = (GdkPixmapPrivate*) pixmap;
- if (private->ref_count <= 0)
+void
+gdk_pixmap_unref (GdkPixmap *pixmap)
+{
+ GdkWindowPrivate *private = (GdkWindowPrivate *)pixmap;
+ g_return_if_fail(pixmap != NULL);
+
+ private->ref_count -= 1;
+ if (private->ref_count == 0)
{
XFreePixmap (private->xdisplay, private->xwindow);
gdk_xid_table_remove (private->xwindow);
- g_free (pixmap);
- }
- else
- {
- private->ref_count -= 1;
+ g_free (private);
}
}
+
+GdkBitmap *
+gdk_bitmap_ref (GdkBitmap *bitmap)
+{
+ return (GdkBitmap *)gdk_pixmap_ref ((GdkPixmap *)bitmap);
+}
+
+void
+gdk_bitmap_unref (GdkBitmap *bitmap)
+{
+ gdk_pixmap_unref ((GdkPixmap *)bitmap);
+}
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 6d9ebff365..240be850ca 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -25,6 +25,7 @@
#include "gdkinput.h"
#include "gdkprivate.h"
#include <stdlib.h>
+#include <stdio.h>
int nevent_masks = 16;
int event_mask_table[18] =
@@ -137,6 +138,8 @@ gdk_window_new (GdkWindow *parent,
private->dnd_drag_data_numtypesavail = 0;
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
+ private->filters = NULL;
+
window->user_data = NULL;
if (attributes_mask & GDK_WA_VISUAL)
@@ -227,6 +230,7 @@ gdk_window_new (GdkWindow *parent,
x, y, private->width, private->height,
0, depth, class, xvisual,
xattributes_mask, &xattributes);
+ gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
switch (private->window_type)
@@ -320,16 +324,24 @@ gdk_window_foreign_new (guint32 anid)
private->destroyed = FALSE;
private->extension_events = 0;
+ private->filters = NULL;
window->user_data = NULL;
+ gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
return window;
}
-void
-gdk_window_destroy (GdkWindow *window)
+/* Call this function when you want a window and all its children to
+ disappear. When xdestroy is true, a request to destroy the XWindow
+ is sent out. When it is false, it is assumed that the XWindow has
+ been or will be destroyed by destroying some ancestor of this
+ window. */
+
+static void
+gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
{
GdkWindowPrivate *private;
GdkWindowPrivate *temp_private;
@@ -340,27 +352,14 @@ gdk_window_destroy (GdkWindow *window)
g_return_if_fail (window != NULL);
private = (GdkWindowPrivate*) window;
- if(private->dnd_drag_data_numtypesavail > 0)
- {
- free(private->dnd_drag_data_typesavail);
- private->dnd_drag_data_typesavail = NULL;
- }
- if(private->dnd_drop_data_numtypesavail > 0)
- {
- free(private->dnd_drop_data_typesavail);
- private->dnd_drop_data_typesavail = NULL;
- }
-
+
switch (private->window_type)
{
case GDK_WINDOW_TOPLEVEL:
case GDK_WINDOW_CHILD:
case GDK_WINDOW_DIALOG:
case GDK_WINDOW_TEMP:
- if (private->ref_count >= 1)
- private->ref_count -= 1;
-
- if (!private->destroyed || (private->destroyed == 2))
+ if (!private->destroyed)
{
children = gdk_window_get_children (window);
tmp = children;
@@ -371,18 +370,24 @@ gdk_window_destroy (GdkWindow *window)
tmp = tmp->next;
temp_private = (GdkWindowPrivate*) temp_window;
- if (temp_private && !temp_private->destroyed)
- /* Removes some nice coredumps... /David */
- {
- temp_private->destroyed = 2;
- temp_private->ref_count += 1;
- gdk_window_destroy (temp_window);
- }
+ if (temp_private)
+ gdk_window_internal_destroy (temp_window, FALSE);
}
g_list_free (children);
- if (!private->destroyed)
+ if(private->dnd_drag_data_numtypesavail > 0)
+ {
+ g_free (private->dnd_drag_data_typesavail);
+ private->dnd_drag_data_typesavail = NULL;
+ }
+ if(private->dnd_drop_data_numtypesavail > 0)
+ {
+ g_free (private->dnd_drop_data_typesavail);
+ private->dnd_drop_data_typesavail = NULL;
+ }
+
+ if (xdestroy)
XDestroyWindow (private->xdisplay, private->xwindow);
private->destroyed = TRUE;
}
@@ -393,14 +398,25 @@ gdk_window_destroy (GdkWindow *window)
break;
case GDK_WINDOW_PIXMAP:
- g_warning ("called gdk_window_destroy on a pixmap (use gdk_pixmap_destroy)");
- gdk_pixmap_destroy (window);
+ g_error ("called gdk_window_destroy on a pixmap (use gdk_pixmap_unref)");
break;
}
}
+/* Like internal_destroy, but also destroys the reference created by
+ gdk_window_new. */
+
void
-gdk_window_real_destroy (GdkWindow *window)
+gdk_window_destroy (GdkWindow *window)
+{
+ gdk_window_internal_destroy (window, TRUE);
+ gdk_window_unref (window);
+}
+
+/* This function is called when the XWindow is really gone. */
+
+void
+gdk_window_destroy_notify (GdkWindow *window)
{
GdkWindowPrivate *private;
@@ -411,11 +427,8 @@ gdk_window_real_destroy (GdkWindow *window)
if (private->extension_events != 0)
gdk_input_window_destroy (window);
- if (private->ref_count == 0)
- {
- gdk_xid_table_remove (private->xwindow);
- g_free (window);
- }
+ gdk_xid_table_remove (private->xwindow);
+ gdk_window_unref (window);
}
GdkWindow*
@@ -436,7 +449,11 @@ gdk_window_unref (GdkWindow *window)
private->ref_count -= 1;
if (private->ref_count == 0)
- gdk_window_real_destroy (window);
+ {
+ if (!private->destroyed)
+ g_warning ("losing last reference to undestroyed window\n");
+ g_free (window);
+ }
}
void
@@ -1364,6 +1381,60 @@ gdk_window_dnd_data_set (GdkWindow *window,
NoEventMask, &sev);
}
+void
+gdk_window_add_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
+{
+ GdkWindowPrivate *private;
+ GList *tmp_list;
+ GdkEventFilter *filter;
+
+ private = (GdkWindowPrivate *)window;
+
+ tmp_list = private->filters;
+ while (tmp_list)
+ {
+ filter = (GdkEventFilter *)tmp_list->data;
+ if ((filter->function == function) && (filter->data == data))
+ return;
+ tmp_list = tmp_list->next;
+ }
+
+ filter = g_new (GdkEventFilter, 1);
+ filter->function = function;
+ filter->data = data;
+
+ private->filters = g_list_append (private->filters, filter);
+}
+
+void
+gdk_window_remove_filter (GdkWindow *window,
+ GdkFilterFunc function,
+ gpointer data)
+{
+ GdkWindowPrivate *private;
+ GList *tmp_list;
+ GdkEventFilter *filter;
+
+ private = (GdkWindowPrivate *)window;
+
+ tmp_list = private->filters;
+ while (tmp_list)
+ {
+ filter = (GdkEventFilter *)tmp_list->data;
+ tmp_list = tmp_list->next;
+
+ if ((filter->function == function) && (filter->data == data))
+ {
+ private->filters = g_list_remove_link (private->filters, tmp_list);
+ g_list_free_1 (tmp_list);
+
+ return;
+ }
+ }
+}
+
void
gdk_window_set_override_redirect(GdkWindow *window,
gboolean override_redirect)
diff --git a/gdk/x11/gdkxid.c b/gdk/x11/gdkxid.c
index 7ee6075c53..94c304f4ed 100644
--- a/gdk/x11/gdkxid.c
+++ b/gdk/x11/gdkxid.c
@@ -16,7 +16,7 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "gdkprivate.h"
-
+#include <stdio.h>
static guint gdk_xid_hash (XID *xid);
static gint gdk_xid_compare (XID *a,
diff --git a/gdk/x11/gxid_lib.c b/gdk/x11/gxid_lib.c
index 357b764513..64c1e53b1f 100644
--- a/gdk/x11/gxid_lib.c
+++ b/gdk/x11/gxid_lib.c
@@ -5,6 +5,7 @@
*/
#include "../config.h"
+#include "gxid_lib.h"
#ifdef XINPUT_GXI
@@ -16,8 +17,6 @@
#include <netinet/in.h>
#include <netdb.h>
-#include "gxid_lib.h"
-
/* handles mechanics of communicating with a client */
static int
gxid_send_message(char *host, int port, GxidMessage *msg)
@@ -112,5 +111,15 @@ gxid_release_device(char *host, int port, GxidU32 device, GxidU32 window)
return gxid_send_message(host,port,(GxidMessage *)&msg);
}
+#else /* !XINPUT_GXI */
+
+/* Some compilers don't like empty source files */
+int
+gxid_claim_device(char *host, int port, GxidU32 device, GxidU32 window,
+ int exclusive)
+{
+ return 0;
+}
+
#endif /* XINPUT_GXI */
diff --git a/glib/configure b/glib/configure
index a22359467d..cbc97c3bf7 100755
--- a/glib/configure
+++ b/glib/configure
@@ -1227,7 +1227,7 @@ fi
if test -n "$DEBUGFLAG"; then
- test "${CFLAGS+set}" = set || CFLAGS="$DEBUGFLAG"
+ test "$cflags_set" = set || CFLAGS="$DEBUGFLAG"
fi
# Checks for programs.
@@ -2453,10 +2453,10 @@ fi
# (under some other name?) then the definitions would
# belong there. (They are only used in GDK)
-# Look for wide string functions in wchar.h or wcstr.h
+# Check for wchar.h
-echo $ac_n "checking for <wchar.h> or <wcstr.h>""... $ac_c" 1>&6
-echo "configure:2460: checking for <wchar.h> or <wcstr.h>" >&5
+echo $ac_n "checking for wchar.h""... $ac_c" 1>&6
+echo "configure:2460: checking for wchar.h" >&5
cat > conftest.$ac_ext <<EOF
#line 2462 "configure"
#include "confdefs.h"
@@ -2481,44 +2481,20 @@ if test $gtk_ok = yes; then
#define HAVE_WCHAR_H 1
EOF
-else
- cat > conftest.$ac_ext <<EOF
-#line 2487 "configure"
-#include "confdefs.h"
-#include <wcstr.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
- rm -rf conftest*
- gtk_ok=yes
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- gtk_ok=no
-fi
-rm -f conftest*
- if test $gtk_ok = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_WCSTR_H 1
-EOF
-
- fi
fi
+echo "$ac_t""$gtk_ok" 1>&6
# Check for wctype.h (for iswalnum)
-echo $ac_n "checking for <wctype.h>""... $ac_c" 1>&6
-echo "configure:2515: checking for <wctype.h>" >&5
+
+echo $ac_n "checking for wctype.h""... $ac_c" 1>&6
+echo "configure:2491: checking for wctype.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 2517 "configure"
+#line 2493 "configure"
#include "confdefs.h"
#include <wctype.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
diff --git a/glib/configure.in b/glib/configure.in
index 64ff58f497..463f25432f 100644
--- a/glib/configure.in
+++ b/glib/configure.in
@@ -24,7 +24,7 @@ AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]]
, enable_ansi=no)
if test -n "$DEBUGFLAG"; then
- test "${CFLAGS+set}" = set || CFLAGS="$DEBUGFLAG"
+ test "$cflags_set" = set || CFLAGS="$DEBUGFLAG"
fi
# Checks for programs.
@@ -116,21 +116,18 @@ fi
# (under some other name?) then the definitions would
# belong there. (They are only used in GDK)
-# Look for wide string functions in wchar.h or wcstr.h
+# Check for wchar.h
-AC_MSG_CHECKING(for <wchar.h> or <wcstr.h>)
+AC_MSG_CHECKING(for wchar.h)
AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
if test $gtk_ok = yes; then
AC_DEFINE(HAVE_WCHAR_H)
-else
- AC_TRY_CPP([#include <wcstr.h>], gtk_ok=yes, gtk_ok=no)
- if test $gtk_ok = yes; then
- AC_DEFINE(HAVE_WCSTR_H)
- fi
fi
+AC_MSG_RESULT($gtk_ok)
# Check for wctype.h (for iswalnum)
-AC_MSG_CHECKING(for <wctype.h>)
+
+AC_MSG_CHECKING(for wctype.h)
AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
if test $gtk_ok = yes; then
AC_DEFINE(HAVE_WCTYPE_H)
diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in
index 1d1c6f218b..7ce63bbcaa 100644
--- a/glib/glibconfig.h.in
+++ b/glib/glibconfig.h.in
@@ -31,7 +31,6 @@
#undef NO_SYS_SIGLIST
#undef HAVE_WCHAR_H
-#undef HAVE_WCSTR_H
#undef HAVE_WCTYPE_H
/* #undef PACKAGE */
diff --git a/gtk/gtk.defs b/gtk/gtk.defs
index 0228e7a8bf..25d991ee73 100644
--- a/gtk/gtk.defs
+++ b/gtk/gtk.defs
@@ -1,4 +1,4 @@
-; -*- scheme -*-
+;; -*- scheme -*-
;;; Gtk enums
@@ -44,8 +44,8 @@
(automatic GTK_POLICY_AUTOMATIC))
(define-enum GtkUpdateType
- (continous GTK_UPDATE_CONTINUOUS)
- (discontinous GTK_UPDATE_DISCONTINUOUS)
+ (continuous GTK_UPDATE_CONTINUOUS)
+ (discontinuous GTK_UPDATE_DISCONTINUOUS)
(delayed GTK_UPDATE_DELAYED))
(define-flags GtkAttachOptions
@@ -122,6 +122,45 @@
(basic GTK_BASIC)
(user-style GTK_USER_STYLE))
+(define-enum GtkSelectionMode
+ (single GTK_SELECTION_SINGLE)
+ (browse GTK_SELECTION_BROWSE)
+ (multiple GTK_SELECTION_MULTIPLE)
+ (extended GTK_SELECTION_EXTENDED))
+
+(define-enum GtkCurveType
+ (linear GTK_CURVE_TYPE_LINEAR)
+ (spline GTK_CURVE_TYPE_SPLINE)
+ (free GTK_CURVE_TYPE_FREE))
+
+(define-enum GtkFundamentalType
+ (invalid GTK_TYPE_INVALID)
+ (none GTK_TYPE_NONE)
+ (char GTK_TYPE_CHAR)
+ (bool GTK_TYPE_BOOL)
+ (int GTK_TYPE_INT)
+ (uint GTK_TYPE_UINT)
+ (long GTK_TYPE_LONG)
+ (ulong GTK_TYPE_ULONG)
+ (float GTK_TYPE_FLOAT)
+ (string GTK_TYPE_STRING)
+ (enum GTK_TYPE_ENUM)
+ (flags GTK_TYPE_FLAGS)
+ (boxed GTK_TYPE_BOXED)
+ (foreign GTK_TYPE_FOREIGN)
+ (callback GTK_TYPE_CALLBACK)
+ (args GTK_TYPE_ARGS)
+ (pointer GTK_TYPE_POINTER)
+ (signal GTK_TYPE_SIGNAL)
+ (c-callback GTK_TYPE_C_CALLBACK)
+ (object GTK_TYPE_OBJECT))
+
+(define-enum GtkJustification
+ (left GTK_JUSTIFY_LEFT)
+ (right GTK_JUSTIFY_RIGHT)
+ (center GTK_JUSTIFY_CENTER)
+ (fill GTK_JUSTIFY_FILL))
+
;;; Gdk enums
(define-enum GdkWindowType
@@ -322,9 +361,9 @@
;;; Gdk boxed types
-;(define-boxed GdkPoint
-; gdk_point_copy
-; gdk_point_destroy)
+ ;(define-boxed GdkPoint
+ ; gdk_point_copy
+ ; gdk_point_destroy)
(define-boxed GdkColormap
gdk_colormap_ref
@@ -344,247 +383,330 @@
(define-boxed GdkEvent
gdk_event_copy
- gdk_event_free)
+ gdk_event_free
+ "sizeof(GdkEvent)")
+
+(define-boxed GdkColor
+ gdk_color_copy
+ gdk_color_free
+ "sizeof(GdkColor)")
+
+(define-func gtk_style_get_white_interp
+ GdkColor
+ ((GtkStyle style)))
;;; Functions
+;; Gdk
+
+(define-func gdk_font_load
+ GdkFont
+ ((string name)))
+
+;; main
+
(define-func gtk_exit
none
- (int code 0))
+ ((int code (= "0"))))
+
+(define-func gtk_main
+ none
+ ())
+
+(define-func gtk_main_quit
+ none
+ ())
+
+(define-func gtk_main_iteration
+ bool
+ ())
+
+(define-func gtk_timeout_add_interp
+ int
+ ((int interval)
+ (callback function)))
+
+(define-func gtk_timeout_remove
+ none
+ ((int tag)))
+
+(define-func gtk_idle_add_interp
+ int
+ ((callback function)))
+
+(define-func gtk_idle_remove
+ none
+ ((int tag)))
+
+(define-func gtk_input_add_interp
+ int
+ ((int source)
+ (GdkInputCondition condition)
+ (callback callback)))
+
+(define-func gtk_input_remove
+ none
+ ((int tag)))
(define-func gtk_rc_parse
none
- (string file))
+ ((string file)))
(define-func g_mem_chunk_info
- none)
+ none
+ ())
;; GtkObject
(define-func gtk_object_destroy
none
- (GtkObject object))
+ ((GtkObject object)))
+
+;; Signals
+
+(define-func gtk_signal_connect_interp
+ int
+ ((GtkObject object)
+ (string name)
+ (callback func)
+ (bool after (= "0"))))
;; GtkWidget
-(define-object GtkWidget (GtkObject))
+(define-object GtkWidget (GtkObject)
+ (fields
+ (GtkStyle style)))
+
+(define-func gtk_grab_add
+ none
+ ((GtkWidget widget)))
+
+(define-func gtk_grab_remove
+ none
+ ((GtkWidget widget)))
(define-func GTK_WIDGET_STATE
GtkStateType
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func GTK_WIDGET_FLAGS
GtkWidgetFlags
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func GTK_WIDGET_SET_FLAGS
none
- (GtkWidget widget)
- (GtkWidgetFlags flags))
+ ((GtkWidget widget)
+ (GtkWidgetFlags flags)))
(define-func GTK_WIDGET_UNSET_FLAGS
none
- (GtkWidget widget)
- (GtkWidgetFlags flags))
+ ((GtkWidget widget)
+ (GtkWidgetFlags flags)))
(define-func gtk_widget_destroy
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_unparent
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_show
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_hide
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_map
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_unmap
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_realize
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_unrealize
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
-;(define-func gtk_widget_install_accelerator
-; none
-; (GtkWidget widget)
-; (GtkAcceleratorTable table)
-; (string signal_name)
-; (char key)
-; (...))
+ ;(define-func gtk_widget_install_accelerator
+ ; none
+ ; ((GtkWidget widget)
+ ; (GtkAcceleratorTable table)
+ ; (string signal_name)
+ ; (char key)
+ ; (...)))
(define-func gtk_widget_remove_accelerator
none
- (GtkWidget widget)
- (GtkAcceleratorTable table)
- (string signal_name))
+ ((GtkWidget widget)
+ (GtkAcceleratorTable table)
+ (string signal_name)))
-;(define-func gtk_widget_event
-; bool
-; (GtkWidget widget)
-; (GdkEvent event))
+(define-func gtk_widget_event
+ bool
+ ((GtkWidget widget)
+ (GdkEvent event)))
(define-func gtk_widget_activate
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_reparent
none
- (GtkWidget widget)
- (GtkWidget new_parent))
+ ((GtkWidget widget)
+ (GtkWidget new_parent)))
(define-func gtk_widget_popup
none
- (GtkWidget widget)
- (int x)
- (int y))
+ ((GtkWidget widget)
+ (int x)
+ (int y)))
(define-func gtk_widget_basic
bool
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_grab_focus
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_grab_default
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_restore_state
none
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_set_name
none
- (GtkWidget widget)
- (string name))
+ ((GtkWidget widget)
+ (string name)))
(define-func gtk_widget_get_name
static_string
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_set_state
none
- (GtkWidget widget)
- (GtkStateType state))
+ ((GtkWidget widget)
+ (GtkStateType state)))
(define-func gtk_widget_set_sensitive
none
- (GtkWidget widget)
- (bool sensitive))
+ ((GtkWidget widget)
+ (bool sensitive)))
(define-func gtk_widget_set_style
none
- (GtkWidget widget)
- (GtkStyle style))
+ ((GtkWidget widget)
+ (GtkStyle style)))
(define-func gtk_widget_set_uposition
none
- (GtkWidget widget)
- (int x)
- (int y))
+ ((GtkWidget widget)
+ (int x)
+ (int y)))
(define-func gtk_widget_set_usize
none
- (GtkWidget widget)
- (int height)
- (int width))
+ ((GtkWidget widget)
+ (int height)
+ (int width)))
(define-func gtk_widget_set_events
none
- (GtkWidget widget)
- (GdkEventMask events))
+ ((GtkWidget widget)
+ (GdkEventMask events)))
(define-func gtk_widget_set_extension_events
none
- (GtkWidget widget)
- (GdkEventMask events))
+ ((GtkWidget widget)
+ (GdkEventMask events)))
(define-func gtk_widget_get_toplevel
GtkWidget
- (GtkWidget widget))
+ ((GtkWidget widget)))
-;(define-func gtk_widget_get_ancestor
-; GtkWidget
-; (GtkWidget widget)
-; (GtkType type))
+ ;(define-func gtk_widget_get_ancestor
+ ; GtkWidget
+ ; ((GtkWidget widget)
+ ; (GtkType type)))
(define-func gtk_widget_get_colormap
GdkColormap
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_get_visual
GdkVisual
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_get_style
GtkStyle
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_get_events
GdkEventMask
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_get_extension_events
GdkEventMask
- (GtkWidget widget))
+ ((GtkWidget widget)))
(define-func gtk_widget_push_colormap
none
- (GdkColormap cmap))
+ ((GdkColormap cmap)))
(define-func gtk_widget_push_visual
none
- (GdkVisual visual))
+ ((GdkVisual visual)))
(define-func gtk_widget_push_style
none
- (GtkStyle style))
+ ((GtkStyle style)))
(define-func gtk_widget_pop_colormap
- none)
+ none
+ ())
(define-func gtk_widget_pop_visual
- none)
+ none
+ ())
(define-func gtk_widget_pop_style
- none)
+ none
+ ())
(define-func gtk_widget_set_default_colormap
none
- (GdkColormap cmap))
+ ((GdkColormap cmap)))
(define-func gtk_widget_set_default_visual
none
- (GdkVisual visual))
+ ((GdkVisual visual)))
(define-func gtk_widget_set_default_style
none
- (GtkStyle style))
+ ((GtkStyle style)))
(define-func gtk_widget_get_default_colormap
- GdkColormap)
+ GdkColormap
+ ())
(define-func gtk_widget_get_default_visual
- GdkVisual)
+ GdkVisual
+ ())
(define-func gtk_widget_get_default_style
- GtkStyle)
+ GtkStyle
+ ())
;;; Container
@@ -592,49 +714,43 @@
(define-func gtk_container_border_width
none
- (GtkContainer container)
- (int border_width))
+ ((GtkContainer container)
+ (int border_width)))
(define-func gtk_container_add
none
- (GtkContainer container)
- (GtkWidget widget))
+ ((GtkContainer container)
+ (GtkWidget widget)))
(define-func gtk_container_remove
none
- (GtkContainer container)
- (GtkWidget widget))
+ ((GtkContainer container)
+ (GtkWidget widget)))
(define-func gtk_container_disable_resize
none
- (GtkContainer container))
+ ((GtkContainer container)))
(define-func gtk_container_enable_resize
none
- (GtkContainer container))
+ ((GtkContainer container)))
(define-func gtk_container_block_resize
none
- (GtkContainer container))
+ ((GtkContainer container)))
(define-func gtk_container_unblock_resize
none
- (GtkContainer container))
+ ((GtkContainer container)))
(define-func gtk_container_need_resize
bool
- (GtkContainer container)
- (GtkWidget widget))
-
-(define-func gtk_container_check_resize
- none
- (GtkContainer container)
- (GtkWidget widget))
+ ((GtkContainer container)))
(define-func gtk_container_focus
GtkDirectionType
- (GtkContainer container)
- (GtkDirectionType direction))
+ ((GtkContainer container)
+ (GtkDirectionType direction)))
;;; Bin
@@ -646,165 +762,1101 @@
(define-func gtk_window_new
GtkWidget
- (GtkWindowType type))
+ ((GtkWindowType type)))
(define-func gtk_window_set_title
none
- (GtkWindow window)
- (string title))
+ ((GtkWindow window)
+ (string title)))
(define-func gtk_window_set_focus
none
- (GtkWindow window)
- (GtkWidget focus))
+ ((GtkWindow window)
+ (GtkWidget focus)))
(define-func gtk_window_set_default
none
- (GtkWindow window)
- (GtkWidget default))
+ ((GtkWindow window)
+ (GtkWidget default)))
(define-func gtk_window_set_policy
none
- (GtkWindow window)
- (bool allow_shrink)
- (bool allow_grow)
- (bool auto_shrink))
+ ((GtkWindow window)
+ (bool allow_shrink)
+ (bool allow_grow)
+ (bool auto_shrink)))
(define-func gtk_window_add_accelerator_table
none
- (GtkWindow window)
- (GtkAcceleratorTable table))
+ ((GtkWindow window)
+ (GtkAcceleratorTable table)))
(define-func gtk_window_remove_accelerator_table
none
- (GtkWindow window)
- (GtkAcceleratorTable table))
+ ((GtkWindow window)
+ (GtkAcceleratorTable table)))
(define-func gtk_window_position
none
- (GtkWindow window)
- (GtkWindowPosition position))
+ ((GtkWindow window)
+ (GtkWindowPosition position)))
;;; Box
(define-object GtkBox (GtkContainer))
+(define-func gtk_box_pack_start
+ none
+ ((GtkBox box)
+ (GtkWidget child)
+ (bool expand (= "TRUE"))
+ (bool fill (= "TRUE"))
+ (int padding (= "0"))))
+
+(define-func gtk_box_pack_end
+ none
+ ((GtkBox box)
+ (GtkWidget child)
+ (bool expand (= "TRUE"))
+ (bool fill (= "TRUE"))
+ (int padding (= "0"))))
+
+(define-func gtk_box_pack_start_defaults
+ none
+ ((GtkBox box)
+ (GtkWidget child)))
+
+(define-func gtk_box_pack_end_defaults
+ none
+ ((GtkBox box)
+ (GtkWidget child)))
+
+(define-func gtk_box_set_homogeneous
+ none
+ ((GtkBox box)
+ (bool homogenous)))
+
+(define-func gtk_box_set_spacing
+ none
+ ((GtkBox box)
+ (int spacing)))
+
;;; Table
(define-object GtkTable (GtkContainer))
+(define-func gtk_table_new
+ GtkWidget
+ ((int rows)
+ (int columns)
+ (bool homogenous)))
+
+(define-func gtk_table_attach
+ none
+ ((GtkTable table)
+ (GtkWidget child)
+ (int left_attach)
+ (int right_attach)
+ (int top_attach)
+ (int bottom_attach)
+ (GtkAttachOptions xoptions (= "GTK_EXPAND|GTK_FILL"))
+ (GtkAttachOptions yoptions (= "GTK_EXPAND|GTK_FILL"))
+ (int xpadding (= "0"))
+ (int ypadding (= "0"))))
+
+(define-func gtk_table_attach_defaults
+ none
+ ((GtkTable table)
+ (GtkWidget child)
+ (int left_attach)
+ (int right_attach)
+ (int top_attach)
+ (int bottom_attach)))
+
+(define-func gtk_table_set_row_spacing
+ none
+ ((GtkTable table)
+ (int row)
+ (int spacing)))
+
+(define-func gtk_table_set_col_spacing
+ none
+ ((GtkTable table)
+ (int column)
+ (int spacing)))
+
+(define-func gtk_table_set_row_spacings
+ none
+ ((GtkTable table)
+ (int spacing)))
+
+(define-func gtk_table_set_col_spacings
+ none
+ ((GtkTable table)
+ (int spacing)))
+
;;; Button
(define-object GtkButton (GtkContainer))
+(define-func gtk_button_new
+ GtkWidget
+ ())
+
+(define-func gtk_button_new_with_label
+ GtkWidget
+ ((string label)))
+
+(define-func gtk_button_pressed
+ none
+ ((GtkButton button)))
+
+(define-func gtk_button_released
+ none
+ ((GtkButton button)))
+
+(define-func gtk_button_clicked
+ none
+ ((GtkButton button)))
+
+(define-func gtk_button_enter
+ none
+ ((GtkButton button)))
+
+(define-func gtk_button_leave
+ none
+ ((GtkButton button)))
+
;;; ToggleButton
(define-object GtkToggleButton (GtkButton))
+(define-func gtk_toggle_button_new
+ GtkWidget
+ ())
+
+(define-func gtk_toggle_button_new_with_label
+ GtkWidget
+ ((string label)))
+
+(define-func gtk_toggle_button_set_mode
+ none
+ ((GtkToggleButton toggle_button)
+ (bool draw_indicator)))
+
+(define-func gtk_toggle_button_set_state
+ none
+ ((GtkToggleButton toggle_button)
+ (bool state)))
+
+(define-func gtk_toggle_button_toggled
+ none
+ ((GtkToggleButton toggle_button)))
+
;;; CheckButton
(define-object GtkCheckButton (GtkToggleButton))
+(define-func gtk_check_button_new
+ GtkWidget
+ ())
+
+(define-func gtk_check_button_new_with_label
+ GtkWidget
+ ((string label)))
+
;;; RadioButton
(define-object GtkRadioButton (GtkCheckButton))
+(define-func gtk_radio_button_new_interp
+ GtkWidget
+ ((GtkRadioButton group (null-ok))))
-;; misc
+(define-func gtk_radio_button_new_with_label_interp
+ GtkWidget
+ ((GtkRadioButton group (null-ok))
+ (string label)))
+;;; Misc
-(define-func gtk_button_new_with_label
+(define-object GtkMisc (GkWidget))
+
+(define-func gtk_misc_set_alignment
+ none
+ ((GtkMisc misc)
+ (float xalign)
+ (float yalign)))
+
+(define-func gtk_misc_set_padding
+ none
+ ((GtkMisc misc)
+ (int xpad)
+ (int ypad)))
+
+;;; Label
+
+(define-object GtkLabel (GtkMisc))
+
+(define-func gtk_label_new
GtkWidget
- (string label))
+ ((string str)))
+
+(define-func gtk_label_set
+ none
+ ((GtkLabel label)
+ (string str)))
+
+(define-func gtk_label_get_interp
+ static_string
+ ((GtkLabel label)))
+
+;; VBox
+
+(define-object GtkVBox (GtkBox))
(define-func gtk_vbox_new
GtkWidget
- (bool homogenous)
- (int spacing))
+ ((bool homogenous)
+ (int spacing)))
+
+;; HBox
+
+(define-object GtkHBox (GtkBox))
(define-func gtk_hbox_new
GtkWidget
- (bool homogenous)
- (int spacing))
+ ((bool homogenous)
+ (int spacing)))
+
+;; Separator
+
+(define-object GtkSeparator (GtkWidget))
+
+;; HSeparator
+
+(define-object GtkHSeparator (GtkSeparator))
(define-func gtk_hseparator_new
- GtkWidget)
+ GtkWidget
+ ())
-(define-func gtk_box_pack_start
+;; VSeparator
+
+(define-object GtkVSeparator (GtkSeparator))
+
+(define-func gtk_vseparator_new
+ GtkWidget
+ ())
+
+;; Frame
+
+(define-object GtkFrame (GtkBin))
+
+(define-func gtk_frame_new
+ GtkWidget
+ ((string label (null-ok))))
+
+(define-func gtk_frame_set_label
none
- (GtkBox box)
- (GtkWidget child)
- (bool expand)
- (bool fill)
- (int padding))
+ ((GtkFrame frame)
+ (string label)))
-(define-func gtk_table_new
+(define-func gtk_frame_set_label_align
+ none
+ ((GtkFrame frame)
+ (float xalign)
+ (float yalign)))
+
+(define-func gtk_frame_set_shadow_type
+ none
+ ((GtkFrame frame)
+ (GtkShadowType type)))
+
+;; Progress Bar
+
+(define-object GtkProgressBar (GtkWidget)
+ (fields
+ (float percentage)))
+
+(define-func gtk_progress_bar_new
GtkWidget
- (int rows)
- (int columns)
- (bool homogenous))
+ ())
-(define-func gtk_table_attach
+(define-func gtk_progress_bar_update
none
- (GtkTable table)
- (GtkWidget child)
- (int left_attach)
- (int right_attach)
- (int top_attach)
- (int bottom_attach)
- (GtkAttachOptions xoptions)
- (GtkAttachOptions yoptions)
- (int xpadding)
- (int ypadding))
+ ((GtkProgressBar progress_bar)
+ (float percentage)))
-(define-func gtk_table_attach_defaults
+ ;(define-func gtk_progress_bar_percentage
+ ; float
+ ; ((GtkProgressBar progress_bar)))
+
+;; Tooltips
+
+(define-boxed GtkTooltips
+ gtk_tooltips_ref
+ gtk_tooltips_unref)
+
+(define-func gtk_tooltips_new
+ GtkTooltips
+ ())
+
+(define-func gtk_tooltips_destroy
none
- (GtkTable table)
- (GtkWidget child)
- (int left_attach)
- (int right_attach)
- (int top_attach)
- (int bottom_attach))
+ ((GtkTooltips tooltips)))
-(define-func gtk_table_set_row_spacing
+(define-func gtk_tooltips_enable
none
- (GtkTable table)
- (int row)
- (int spacing))
+ ((GtkTooltips tooltips)))
-(define-func gtk_table_set_col_spacing
+(define-func gtk_tooltips_disable
none
- (GtkTable table)
- (int col)
- (int spacing))
+ ((GtkTooltips tooltips)))
-(define-func gtk_table_set_row_spacings
+(define-func gtk_tooltips_set_delay
none
- (GtkTable table)
- (int spacing))
+ ((GtkTooltips tooltips)
+ (int delay)))
-(define-func gtk_table_set_col_spacings
+(define-func gtk_tooltips_set_tips
none
- (GtkTable table)
- (int spacing))
+ ((GtkTooltips tooltips)
+ (GtkWidget widget)
+ (string tips_text (null-ok))))
-(define-func gtk_toggle_button_new_with_label
+(define-func gtk_tooltips_set_colors
+ none
+ ((GtkTooltips tooltips)
+ (GdkColor background)
+ (GdkColor foreground)))
+
+;; MenuShell
+
+(define-object GtkMenuShell (GtkContainer))
+
+(define-func gtk_menu_shell_append
+ none
+ ((GtkMenuShell menu_shell)
+ (GtkWidget child)))
+
+(define-func gtk_menu_shell_prepend
+ none
+ ((GtkMenuShell menu_shell)
+ (GtkWidget child)))
+
+(define-func gtk_menu_shell_insert
+ none
+ ((GtkMenuShell menu_shell)
+ (GtkWidget child)
+ (int position)))
+
+(define-func gtk_menu_shell_deactivate
+ none
+ ((GtkMenuShell menu_shell)))
+
+;; MenuBar
+
+(define-object GtkMenuBar (GtkMenuShell))
+
+(define-func gtk_menu_bar_new
GtkWidget
- (string label))
+ ())
-(define-func gtk_check_button_new_with_label
+(define-func gtk_menu_bar_append
+ none
+ ((GtkMenuBar menu_bar)
+ (GtkWidget child)))
+
+(define-func gtk_menu_bar_prepend
+ none
+ ((GtkMenuBar menu_bar)
+ (GtkWidget child)))
+
+(define-func gtk_menu_bar_insert
+ none
+ ((GtkMenuBar menu_bar)
+ (GtkWidget child)
+ (int position)))
+
+;; Menu
+
+(define-object GtkMenu (GtkMenuShell))
+
+(define-func gtk_menu_new
GtkWidget
- (string label))
+ ())
+
+(define-func gtk_menu_append
+ none
+ ((GtkMenu menu)
+ (GtkWidget child)))
+
+(define-func gtk_menu_prepend
+ none
+ ((GtkMenu menu)
+ (GtkWidget child)))
+
+(define-func gtk_menu_insert
+ none
+ ((GtkMenu menu)
+ (GtkWidget child)
+ (int position)))
+
+(define-func gtk_menu_popup_interp
+ none
+ ((GtkMenu menu)
+ (GtkWidget parent_menu_shell)
+ (GtkWidget parent_menu_item)
+ (int button)
+ (int activate_time)))
-(define-func gtk_radio_button_new_with_label_from_widget
+(define-func gtk_menu_popdown
+ none
+ ((GtkMenu menu)))
+
+(define-func gtk_menu_get_active
GtkWidget
- (GtkRadioButton group)
- (string label))
+ ((GtkMenu menu)))
-(define-func gtk_label_new
+(define-func gtk_menu_set_active
+ none
+ ((GtkMenu menu)
+ (int index)))
+
+(define-func gtk_menu_set_accelerator_table
+ none
+ ((GtkMenu menu)
+ (GtkAcceleratorTable table)))
+
+
+;; Item
+
+(define-object GtkItem (GtkBin))
+
+(define-func gtk_item_select
+ none
+ ((GtkItem item)))
+
+(define-func gtk_item_deselect
+ none
+ ((GtkItem item)))
+
+(define-func gtk_item_toggle
+ none
+ ((GtkItem item)))
+
+;; MenuItem
+
+(define-object GtkMenuItem (GtkItem))
+
+(define-func gtk_menu_item_new
GtkWidget
- (string label))
+ ())
-(define-func gtk_frame_new
+(define-func gtk_menu_item_new_with_label
+ GtkWidget
+ ((string label)))
+
+(define-func gtk_menu_item_set_submenu
+ none
+ ((GtkMenuItem menu_item)
+ (GtkWidget submenu)))
+
+(define-func gtk_menu_item_set_placement
+ none
+ ((GtkMenuItem menu_item)
+ (GtkSubmenuPlacement placement)))
+
+(define-func gtk_menu_item_accelerator_size
+ none
+ ((GtkMenuItem menu_item)))
+
+(define-func gtk_menu_item_configure
+ none
+ ((GtkMenuItem menu_item)
+ (bool show_toggle_indicator)
+ (bool show_submenu_indicator)))
+
+(define-func gtk_menu_item_select
+ none
+ ((GtkMenuItem menu_item)))
+
+(define-func gtk_menu_item_deselect
+ none
+ ((GtkMenuItem menu_item)))
+
+(define-func gtk_menu_item_activate
+ none
+ ((GtkMenuItem menu_item)))
+
+;; CheckMenuItem
+
+(define-object GtkCheckMenuItem (GtkMenuItem))
+
+(define-func gtk_check_menu_item_new
+ GtkWidget
+ ())
+
+(define-func gtk_check_menu_item_new_with_label
GtkWidget
- (string label))
+ ((string label)))
+
+(define-func gtk_check_menu_item_set_state
+ none
+ ((GtkCheckMenuItem check_menu_item)
+ (bool state)))
+
+(define-func gtk_check_menu_item_toggled
+ none
+ ((GtkCheckMenuItem check_menu_item)))
+
+;; RadioMenuItem
+
+(define-object GtkRadioMenuItem (GtkCheckMenuItem))
+
+(define-func gtk_radio_menu_item_new_interp
+ GtkWidget
+ ((GtkRadioMenuItem group (null-ok))))
+
+(define-func gtk_radio_menu_item_new_with_label_interp
+ GtkWidget
+ ((GtkRadioMenuItem group (null-ok))
+ (string label)))
+
+;; OptionMenu
+
+(define-object GtkOptionMenu (GtkButton))
+
+(define-func gtk_option_menu_new
+ GtkWidget
+ ())
+
+(define-func gtk_option_menu_get_menu
+ GtkWidget
+ ((GtkOptionMenu option_menu)))
+
+(define-func gtk_option_menu_set_menu
+ none
+ ((GtkOptionMenu option_menu)
+ (GtkWidget menu)))
+
+(define-func gtk_option_menu_remove_menu
+ none
+ ((GtkOptionMenu option_menu)))
+
+(define-func gtk_option_menu_set_history
+ none
+ ((GtkOptionMenu option_menu)
+ (int index)))
+
+;; Pixmaps
+
+(define-object GtkPixmap (GtkMisc))
+
+(define-func gtk_pixmap_new_interp
+ GtkWidget
+ ((string xpm_file)
+ (GtkWidget intended_parent)))
+
+;; Data
+
+(define-object GtkData (GtkObject))
+
+;; Adjustment
+
+(define-object GtkAdjustment (GtkData))
+
+(define-func gtk_adjustment_new
+ GtkObject
+ ((float value)
+ (float lower)
+ (float upper)
+ (float step_increment)
+ (float page_increment)
+ (float page_size)))
+
+;; ScrolledWidow
+
+(define-object GtkScrolledWindow (GtkContainer))
+
+(define-func gtk_scrolled_window_new
+ GtkWidget
+ ((GtkAdjustment hadjustment (null-ok) (= "NULL"))
+ (GtkAdjustment vadjustment (null-ok) (= "NULL"))))
+
+(define-func gtk_scrolled_window_get_hadjustment
+ GtkAdjustment
+ ((GtkScrolledWindow scrolled_window)))
+
+(define-func gtk_scrolled_window_get_vadjustment
+ GtkAdjustment
+ ((GtkScrolledWindow scrolled_window)))
+
+(define-func gtk_scrolled_window_set_policy
+ none
+ ((GtkScrolledWindow scrolled_window)
+ (GtkPolicyType hscrollbar_policy)
+ (GtkPolicyType vscrollbar_policy)))
+
+;; ListItem
+
+(define-object GtkListItem (GtkItem))
+
+(define-func gtk_list_item_new
+ GtkWidget
+ ())
+
+(define-func gtk_list_item_new_with_label
+ GtkWidget
+ ((string label)))
+
+(define-func gtk_list_item_select
+ none
+ ((GtkListItem list_item)))
+
+(define-func gtk_list_item_deselect
+ none
+ ((GtkListItem list_item)))
+
+;; List
+
+(define-object GtkList (GtkContainer))
+
+(define-func gtk_list_new
+ GtkWidget
+ ())
+
+(define-func gtk_list_append_item
+ none
+ ((GtkList list)
+ (GtkListItem item)))
+
+(define-func gtk_list_prepend_item
+ none
+ ((GtkList list)
+ (GtkListItem item)))
+
+;; XXX many missing
+
+(define-func gtk_list_clear_items
+ none
+ ((GtkList list)
+ (int start)
+ (int end)))
+
+(define-func gtk_list_select_item
+ none
+ ((GtkList list)
+ (int item)))
+
+(define-func gtk_list_unselect_item
+ none
+ ((GtkList list)
+ (int item)))
+
+(define-func gtk_list_select_child
+ none
+ ((GtkList list)
+ (GtkWidget child)))
+
+(define-func gtk_list_unselect_child
+ none
+ ((GtkList list)
+ (GtkWidget child)))
+
+(define-func gtk_list_child_position
+ int
+ ((GtkList list)
+ (GtkWidget child)))
+
+(define-func gtk_list_set_selection_mode
+ none
+ ((GtkList list)
+ (GtkSelectionMode mode)))
+
+;; Notebook
+
+(define-object GtkNotebook (GtkContainer)
+ (fields
+ (GtkPositionType tab_pos)))
+
+(define-func gtk_notebook_new
+ GtkWidget
+ ())
+
+(define-func gtk_notebook_append_page
+ none
+ ((GtkNotebook notebook)
+ (GtkWidget child)
+ (GtkWidget tab_label)))
+
+(define-func gtk_notebook_prepend_page
+ none
+ ((GtkNotebook notebook)
+ (GtkWidget child)
+ (GtkWidget tab_label)))
+
+(define-func gtk_notebook_insert_page
+ none
+ ((GtkNotebook notebook)
+ (GtkWidget child)
+ (GtkWidget tab_label)
+ (int position)))
+
+(define-func gtk_notebook_remove_page
+ none
+ ((GtkNotebook notebook)
+ (int page_num)))
+
+(define-func gtk_notebook_current_page
+ int
+ ((GtkNotebook notebook)))
+
+(define-func gtk_notebook_set_page
+ none
+ ((GtkNotebook notebook)
+ (int page_num)))
+
+(define-func gtk_notebook_next_page
+ none
+ ((GtkNotebook notebook)))
+
+(define-func gtk_notebook_prev_page
+ none
+ ((GtkNotebook notebook)))
+
+(define-func gtk_notebook_set_tab_pos
+ none
+ ((GtkNotebook notebook)
+ (GtkPositionType pos)))
+
+(define-func gtk_notebook_set_show_tabs
+ none
+ ((GtkNotebook notebook)
+ (bool show_tabs)))
+
+(define-func gtk_notebook_set_show_border
+ none
+ ((GtkNotebook notebook)
+ (bool show_border)))
+
+;; Entry
+
+(define-object GtkEntry (GtkWidget))
+
+(define-func gtk_entry_new
+ GtkWidget
+ ())
+
+(define-func gtk_entry_set_text
+ none
+ ((GtkEntry entry)
+ (string text)))
+
+(define-func gtk_entry_append_text
+ none
+ ((GtkEntry entry)
+ (string text)))
+
+(define-func gtk_entry_prepend_text
+ none
+ ((GtkEntry entry)
+ (string text)))
+
+(define-func gtk_entry_set_position
+ none
+ ((GtkEntry entry)
+ (int position)))
+
+(define-func gtk_entry_get_text
+ static_string
+ ((GtkEntry entry)))
+
+;; Text
+
+(define-object GtkText (GtkWidget))
+
+(define-func gtk_text_new
+ GtkWidget
+ ((GtkAdjustment hadj (null-ok))
+ (GtkAdjustment vadj (null-ok))))
+
+(define-func gtk_text_set_editable
+ none
+ ((GtkText text)
+ (bool editable)))
+
+(define-func gtk_text_set_adjustments
+ none
+ ((GtkText text)
+ (GtkAdjustment hadj)
+ (GtkAdjustment vadj)))
+
+(define-func gtk_text_set_point
+ none
+ ((GtkText text)
+ (uint index)))
+
+(define-func gtk_text_get_point
+ uint
+ ((GtkText text)))
+
+(define-func gtk_text_get_length
+ uint
+ ((GtkText text)))
+
+(define-func gtk_text_freeze
+ none
+ ((GtkText text)))
+
+(define-func gtk_text_thaw
+ none
+ ((GtkText text)))
+
+(define-func gtk_text_insert
+ none
+ ((GtkText text)
+ (GdkFont font (null-ok))
+ (GdkColor fore (null-ok))
+ (GdkColor back (null-ok))
+ (string chars)
+ (int length)))
+
+(define-func gtk_text_backward_delete
+ none
+ ((GtkText text)
+ (uint nchars)))
+
+(define-func gtk_text_foreward_delete
+ none
+ ((GtkText text)
+ (uint nchars)))
+
+;; Alignment
+
+(define-object GtkAlignment (GtkBin))
+
+(define-func gtk_alignment_new
+ GtkWidget
+ ((float xalign)
+ (float yalign)
+ (float xscale)
+ (float yscale)))
+
+(define-func gtk_alignment_set
+ none
+ ((GtkAlignment alignment)
+ (float xalign)
+ (float yalign)
+ (float xscale)
+ (float yscale)))
+
+;; Color
+
+ ; XXX lots missing
+
+(define-func gdk_color_parse_interp
+ GdkColor
+ ((string spec)))
+
+;; Preview
+
+(define-object GtkPreview (GtkWidget))
+
+;; XXX lots missing
+
+(define-func gtk_preview_set_install_cmap
+ none
+ ((bool install_cmap)))
+
+(define-func gtk_preview_set_reserved
+ none
+ ((int nreserved)))
+
+(define-func gtk_preview_get_visual
+ GdkVisual
+ ())
+
+(define-func gtk_preview_get_cmap
+ GdkColormap
+ ())
+
+;; ColorSelectionDialog
+
+(define-object GtkColorSelectionDialog (GtkWindow)
+ (fields
+ (GtkWidget colorsel)
+ (GtkWidget main_vbox)
+ (GtkWidget ok_button)
+ (GtkWidget reset_button)
+ (GtkWidget cancel_button)
+ (GtkWidget help_button)))
+
+(define-func gtk_color_selection_dialog_new
+ GtkWidget
+ ((string title)))
+
+;; ColorSelection
+
+(define-object GtkColorSelection (GtkVBox))
+
+(define-func gtk_color_selection_new
+ GtkWidget
+ ())
+
+(define-func gtk_color_selection_set_update_policy
+ none
+ ((GtkColorSelection colorsel)
+ (GtkUpdateType policy)))
+
+(define-func gtk_color_selection_set_opacity
+ none
+ ((GtkColorSelection colorsel)
+ (bool use_opacity)))
+
+;; Range
+
+(define-object GtkRange (GtkWidget))
+
+(define-func gtk_range_get_adjustment
+ GtkAdjustment
+ ((GtkRange range)))
+
+(define-func gtk_range_set_update_policy
+ none
+ ((GtkRange range)
+ (GtkUpdateType policy)))
+
+(define-func gtk_range_set_adjustment
+ none
+ ((GtkRange range)
+ (GtkAdjustment adjustment)))
+
+;; Scale
+
+(define-object GtkScale (GtkRange))
+
+(define-func gtk_scale_set_digits
+ none
+ ((GtkScale scale)
+ (bool digits)))
+
+(define-func gtk_scale_set_draw_value
+ none
+ ((GtkScale scale)
+ (bool draw_value)))
+
+(define-func gtk_scale_set_value_pos
+ none
+ ((GtkScale scale)
+ (GtkPositionType pos)))
+
+;; HScale
+
+(define-object GtkHScale (GtkScale))
+
+(define-func gtk_hscale_new
+ GtkWidget
+ ((GtkAdjustment adjustment)))
+
+;; VScale
+
+(define-object GtkVScale (GtkScale))
+
+(define-func gtk_vscale_new
+ GtkWidget
+ ((GtkAdjustment adjustment)))
+
+;; Scrollbar
+
+(define-object GtkScrollbar (GtkRange))
+
+;; HScrollbar
+
+(define-object GtkHScrollbar (GtkScrollbar))
+
+(define-func gtk_hscrollbar_new
+ GtkWidget
+ ((GtkAdjustment adjustment)))
+
+;; VScrollbar
+
+(define-object GtkVScrollbar (GtkScrollbar))
+
+(define-func gtk_vscrollbar_new
+ GtkWidget
+ ((GtkAdjustment adjustment)))
+
+;; Dialog
+
+(define-object GtkDialog (GtkWindow)
+ (fields
+ (GtkWidget vbox)
+ (GtkWidget action_area)))
+
+(define-func gtk_dialog_new
+ GtkWidget
+ ())
+
+;; Paned
+
+(define-object GtkPaned (GtkContainer))
+
+(define-func gtk_paned_add1
+ none
+ ((GtkPaned paned)
+ (GtkWidget child)))
+
+(define-func gtk_paned_add2
+ none
+ ((GtkPaned paned)
+ (GtkWidget child)))
+
+(define-func gtk_paned_handle_size
+ none
+ ((GtkPaned paned)
+ (int size)))
+
+(define-func gtk_paned_gutter_size
+ none
+ ((GtkPaned paned)
+ (int size)))
+
+;; HPaned
+
+(define-object GtkHPaned (GtkPaned))
+
+(define-func gtk_hpaned_new
+ GtkWidget
+ ())
+
+;; VPaned
+
+(define-object GtkVPaned (GtkPaned))
+
+(define-func gtk_vpaned_new
+ GtkWidget
+ ())
+
+;;; hack
+
+;(define-func panel_register_toy
+; none
+; ((gpointer panel)
+; (GtkWidget applet)
+; (string id)
+; (string params)
+; (int x)
+; (int y)
+; (int flags)))
+
+;(define-func panel_quit
+; none
+; ((gpointer panel)))
+
+;(define-func panel_new_applet
+; none
+; ((gpointer panel)
+; (string applet)
+; (string params)))
diff --git a/gtk/gtkaccelerator.c b/gtk/gtkaccelerator.c
index a06a06a995..cd8b3a7247 100644
--- a/gtk/gtkaccelerator.c
+++ b/gtk/gtkaccelerator.c
@@ -95,17 +95,6 @@ gtk_accelerator_table_find (GtkObject *object,
return NULL;
}
-void
-gtk_accelerator_table_destroy (GtkAcceleratorTable *table)
-{
- g_return_if_fail (table != NULL);
- g_return_if_fail (table->ref_count <= 0);
-
- tables = g_slist_remove (tables, table);
- gtk_accelerator_table_clean (table);
- g_free (table);
-}
-
GtkAcceleratorTable*
gtk_accelerator_table_ref (GtkAcceleratorTable *table)
{
@@ -122,7 +111,11 @@ gtk_accelerator_table_unref (GtkAcceleratorTable *table)
table->ref_count -= 1;
if (table->ref_count <= 0)
- gtk_accelerator_table_destroy (table);
+ {
+ tables = g_slist_remove (tables, table);
+ gtk_accelerator_table_clean (table);
+ g_free (table);
+ }
}
void
@@ -322,7 +315,7 @@ gtk_accelerator_table_init (GtkAcceleratorTable *table)
for (i = 0; i < 256; i++)
table->entries[i] = NULL;
- table->ref_count = 0;
+ table->ref_count = 1;
table->modifier_mask = gtk_accelerator_table_default_mod_mask;
}
diff --git a/gtk/gtkaccelerator.h b/gtk/gtkaccelerator.h
index 975196a0ec..35fdc2d261 100644
--- a/gtk/gtkaccelerator.h
+++ b/gtk/gtkaccelerator.h
@@ -46,7 +46,6 @@ GtkAcceleratorTable* gtk_accelerator_table_find (GtkObject *object,
guchar accelerator_key,
guint8 accelerator_mods);
-void gtk_accelerator_table_destroy (GtkAcceleratorTable *table);
GtkAcceleratorTable *gtk_accelerator_table_ref (GtkAcceleratorTable *table);
void gtk_accelerator_table_unref (GtkAcceleratorTable *table);
void gtk_accelerator_table_install (GtkAcceleratorTable *table,
diff --git a/gtk/gtkcurve.c b/gtk/gtkcurve.c
index d2b6e08c84..93efd10150 100644
--- a/gtk/gtkcurve.c
+++ b/gtk/gtkcurve.c
@@ -296,7 +296,7 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c)
{
case GDK_CONFIGURE:
if (c->pixmap)
- gdk_pixmap_destroy (c->pixmap);
+ gdk_pixmap_unref (c->pixmap);
c->pixmap = 0;
/* fall through */
case GDK_EXPOSE:
@@ -849,7 +849,7 @@ gtk_curve_destroy (GtkObject *object)
curve = GTK_CURVE (object);
if (curve->pixmap)
- gdk_pixmap_destroy (curve->pixmap);
+ gdk_pixmap_unref (curve->pixmap);
if (curve->point)
g_free (curve->point);
if (curve->ctlpoint)
diff --git a/gtk/gtkgamma.c b/gtk/gtkgamma.c
index 1d7abc6fba..977aabe67f 100644
--- a/gtk/gtkgamma.c
+++ b/gtk/gtkgamma.c
@@ -252,8 +252,8 @@ button_realize_callback (GtkWidget *w)
gtk_container_add (GTK_CONTAINER (w), pixmap);
gtk_widget_show (pixmap);
- gdk_pixmap_destroy (pm);
- gdk_pixmap_destroy (mask); /* a bitmap is really just a special pixmap */
+ gdk_pixmap_unref (pm);
+ gdk_bitmap_unref (mask); /* a bitmap is really just a special pixmap */
}
static void
diff --git a/gtk/gtkhscrollbar.c b/gtk/gtkhscrollbar.c
index 9b757d406f..3b52a7a798 100644
--- a/gtk/gtkhscrollbar.c
+++ b/gtk/gtkhscrollbar.c
@@ -147,7 +147,9 @@ gtk_hscrollbar_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
+
range->trough = widget->window;
+ gdk_window_ref (range->trough);
attributes.x = widget->style->klass->xthickness;
attributes.y = widget->style->klass->ythickness;
diff --git a/gtk/gtkinputdialog.c b/gtk/gtkinputdialog.c
index 1d412a32ea..d197fc8e0f 100644
--- a/gtk/gtkinputdialog.c
+++ b/gtk/gtkinputdialog.c
@@ -28,6 +28,7 @@
#include <ctype.h>
#include "gdk/gdkkeysyms.h"
#include "gtkbutton.h"
+#include "gtkentry.h"
#include "gtkhbox.h"
#include "gtkhseparator.h"
#include "gtkinputdialog.h"
@@ -36,15 +37,23 @@
#include "gtkmain.h"
#include "gtkmenu.h"
#include "gtkmenuitem.h"
+#include "gtknotebook.h"
#include "gtkoptionmenu.h"
#include "gtkscrolledwindow.h"
#include "gtksignal.h"
+#include "gtktable.h"
#include "gtkvbox.h"
typedef void (*GtkInputDialogSignal1) (GtkObject *object,
int arg1,
gpointer data);
+typedef struct {
+ gint index;
+ GtkWidget *entry;
+ GtkInputDialog *inputd;
+} GtkInputKeyInfo;
+
enum
{
ENABLE_DEVICE,
@@ -56,6 +65,9 @@ enum
#define AXIS_LIST_WIDTH 160
#define AXIS_LIST_HEIGHT 175
+#define KEYS_LIST_WIDTH 200
+#define KEYS_LIST_HEIGHT 175
+
/* Forward declarations */
static void gtk_input_dialog_marshal_signal1 (GtkObject *object,
@@ -72,6 +84,18 @@ static void gtk_input_dialog_set_mapping_mode(GtkWidget *w,
static void gtk_input_dialog_set_axis(GtkWidget *widget, gpointer data);
static void gtk_input_dialog_fill_axes (GtkInputDialog *inputd,
GdkDeviceInfo *info);
+static void gtk_input_dialog_set_key (GtkInputKeyInfo *key,
+ guint keyval,
+ GdkModifierType modifiers);
+static gint gtk_input_dialog_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ GtkInputKeyInfo *key);
+static void gtk_input_dialog_clear_key (GtkWidget *widget,
+ GtkInputKeyInfo *key);
+static void gtk_input_dialog_destroy_key (GtkWidget *widget,
+ GtkInputKeyInfo *key);
+static void gtk_input_dialog_fill_keys (GtkInputDialog *inputd,
+ GdkDeviceInfo *info);
static GtkObjectClass *parent_class = NULL;
static gint input_dialog_signals[LAST_SIGNAL] = { 0 };
@@ -171,6 +195,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
GtkWidget *menuitem;
GtkWidget *optionmenu;
GtkWidget *separator;
+ GtkWidget *notebook;
GList *tmp_list;
GList *device_info;
@@ -225,17 +250,9 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), device_menu);
gtk_widget_show (label);
- gtk_widget_show (util_box);
/* Device options */
- separator = gtk_hseparator_new();
- gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
- gtk_widget_show (separator);
-
- util_box = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), util_box, FALSE, FALSE, 0);
-
/* mapping mode option menu */
mapping_menu = gtk_menu_new ();
@@ -282,34 +299,65 @@ gtk_input_dialog_init (GtkInputDialog *inputd)
gtk_widget_show (label);
gtk_widget_show (util_box);
+ separator = gtk_hseparator_new();
+ gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, TRUE, 0);
+ gtk_widget_show (separator);
+
+ /* Notebook */
+
+ notebook = gtk_notebook_new ();
+ gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
+ gtk_widget_show (notebook);
+
/* The axis listbox */
label = gtk_label_new ("Axes");
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
inputd->axis_listbox = gtk_scrolled_window_new (NULL, NULL);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->axis_listbox),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
gtk_widget_set_usize (inputd->axis_listbox, AXIS_LIST_WIDTH, AXIS_LIST_HEIGHT);
- gtk_box_pack_start (GTK_BOX (vbox), inputd->axis_listbox, TRUE, TRUE, 0);
+ gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
+ inputd->axis_listbox, label);
+
gtk_widget_show (inputd->axis_listbox);
inputd->axis_list = 0;
- gtk_widget_show(label);
+ /* Keys listbox */
+
+ label = gtk_label_new ("Keys");
+
+ inputd->keys_listbox = gtk_scrolled_window_new (NULL, NULL);
+ gtk_widget_set_usize (inputd->keys_listbox, KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->keys_listbox),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_notebook_append_page (GTK_NOTEBOOK(notebook),
+ inputd->keys_listbox, label);
+
+ gtk_widget_show (inputd->keys_listbox);
+
+ inputd->keys_list = 0;
/* ...set_device expects to get input dialog from widget user data */
gtk_object_set_user_data (GTK_OBJECT (inputd), inputd);
gtk_input_dialog_set_device(GTK_WIDGET(inputd), (gpointer)((long)
((GdkDeviceInfo *)device_info->data)->deviceid));
- }
- /* buttons */
+ }
+ /* We create the save button in any case, so that clients can
+ connect to it, without paying attention to whether it exits */
inputd->save_button = gtk_button_new_with_label ("Save");
GTK_WIDGET_SET_FLAGS (inputd->save_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
inputd->save_button, TRUE, TRUE, 0);
gtk_widget_show (inputd->save_button);
+ if (g_list_length(device_info) <= 1) /* only core device */
+ gtk_widget_set_sensitive(inputd->save_button, FALSE);
+
inputd->close_button = gtk_button_new_with_label ("Close");
GTK_WIDGET_SET_FLAGS (inputd->close_button, GTK_CAN_DEFAULT);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(inputd)->action_area),
@@ -345,6 +393,7 @@ gtk_input_dialog_set_device(GtkWidget *widget, gpointer data)
info = gtk_input_dialog_get_device_info((guint32)data);
gtk_input_dialog_fill_axes(inputd, info);
+ gtk_input_dialog_fill_keys(inputd, info);
gtk_option_menu_set_history(GTK_OPTION_MENU(inputd->mode_optionmenu),
info->mode);
@@ -464,11 +513,8 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
};
int i,j;
- GtkWidget *list_item;
GtkWidget *menu;
GtkWidget *option_menu;
- GtkWidget *vbox;
- GtkWidget *hbox;
GtkWidget *label;
/* remove all the old items */
@@ -477,7 +523,7 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
gtk_widget_hide (inputd->axis_list); /* suppress resizes (or get warnings) */
gtk_widget_destroy (inputd->axis_list);
}
- inputd->axis_list = gtk_vbox_new (FALSE, 0);
+ inputd->axis_list = gtk_table_new (GDK_AXIS_LAST, 2, 0);
gtk_container_add (GTK_CONTAINER (inputd->axis_listbox), inputd->axis_list);
gtk_widget_show (inputd->axis_list);
@@ -487,21 +533,11 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
for (i=GDK_AXIS_X;i<GDK_AXIS_LAST;i++)
{
- list_item = gtk_list_item_new();
-
- gtk_box_pack_start(GTK_BOX(inputd->axis_list),list_item,FALSE,FALSE,0);
- gtk_widget_show (list_item);
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_container_add(GTK_CONTAINER (list_item), vbox);
-
- hbox = gtk_hbox_new (FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 1);
-
/* create the label */
label = gtk_label_new(axis_use_strings[i]);
- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 2);
+ gtk_table_attach (GTK_TABLE (inputd->axis_list), label, 0, 1, i, i+1,
+ 0, 0, 2, 2);
/* and the use option menu */
menu = gtk_menu_new();
@@ -527,7 +563,8 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
}
inputd->axis_items[i] = option_menu = gtk_option_menu_new ();
- gtk_box_pack_start (GTK_BOX (hbox), option_menu, FALSE, FALSE, 2);
+ gtk_table_attach (GTK_TABLE (inputd->axis_list), option_menu,
+ 1, 2, i, i+1, 0, 0, 2, 2);
gtk_widget_show (option_menu);
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu), menu);
@@ -539,8 +576,134 @@ gtk_input_dialog_fill_axes(GtkInputDialog *inputd, GdkDeviceInfo *info)
}
gtk_widget_show (label);
+ }
+}
+
+static void
+gtk_input_dialog_clear_key (GtkWidget *widget, GtkInputKeyInfo *key)
+{
+ gtk_entry_set_text (GTK_ENTRY(key->entry), "(disabled)");
+ gdk_input_set_key (key->inputd->current_device, key->index, 0, 0);
+}
+
+static void
+gtk_input_dialog_set_key (GtkInputKeyInfo *key,
+ guint keyval, GdkModifierType modifiers)
+{
+ GString *str;
+ gchar chars[2];
+
+ if (keyval)
+ {
+ str = g_string_new("");
+
+ if (modifiers & GDK_SHIFT_MASK)
+ g_string_append (str, "Shft+");
+ if (modifiers & GDK_CONTROL_MASK)
+ g_string_append (str, "Ctl+");
+ if (modifiers & GDK_MOD1_MASK)
+ g_string_append (str, "Alt+");
+
+ if ((keyval >= 0x20) && (keyval <= 0xFF))
+ {
+ chars[0] = keyval;
+ chars[1] = 0;
+ g_string_append (str, chars);
+ }
+ else
+ g_string_append (str, "(unknown)");
+ gtk_entry_set_text (GTK_ENTRY(key->entry), str->str);
+
+ g_string_free (str, TRUE);
+ }
+ else
+ {
+ gtk_entry_set_text (GTK_ENTRY(key->entry), "(disabled)");
+ }
+}
+
+static gint
+gtk_input_dialog_key_press (GtkWidget *widget,
+ GdkEventKey *event,
+ GtkInputKeyInfo *key)
+{
+ gtk_input_dialog_set_key (key, event->keyval, event->state & 0xFF);
+ gdk_input_set_key (key->inputd->current_device, key->index,
+ event->keyval, event->state & 0xFF);
+
+ gtk_signal_emit_stop_by_name (GTK_OBJECT(widget), "key_press_event");
+
+ return TRUE;
+}
+
+static void
+gtk_input_dialog_destroy_key (GtkWidget *widget, GtkInputKeyInfo *key)
+{
+ g_free (key);
+}
+
+static void
+gtk_input_dialog_fill_keys(GtkInputDialog *inputd, GdkDeviceInfo *info)
+{
+ int i;
+ GtkWidget *label;
+ GtkWidget *button;
+
+ char buffer[16];
+
+ /* remove all the old items */
+ if (inputd->keys_list)
+ {
+ gtk_widget_hide (inputd->keys_list); /* suppress resizes (or get warnings) */
+ gtk_widget_destroy (inputd->keys_list);
+ }
+
+ inputd->keys_list = gtk_table_new (info->num_keys, 3, FALSE);
+ gtk_container_add (GTK_CONTAINER (inputd->keys_listbox), inputd->keys_list);
+ gtk_widget_show (inputd->keys_list);
+
+ gtk_widget_realize (inputd->keys_list);
+ gdk_window_set_background (inputd->keys_list->window,
+ &inputd->keys_list->style->white);
+
+ for (i=0;i<info->num_keys;i++)
+ {
+ GtkInputKeyInfo *key = g_new (GtkInputKeyInfo, 1);
+ key->index = i;
+ key->inputd = inputd;
+
+ /* create the label */
+
+ sprintf(buffer, "%d", i+1);
+ label = gtk_label_new(buffer);
+ gtk_table_attach (GTK_TABLE (inputd->keys_list), label, 0, 1, i, i+1,
+ 0, 0, 2, 2);
+ gtk_widget_show (label);
+
+ /* the entry */
+
+ key->entry = gtk_entry_new ();
+ gtk_table_attach (GTK_TABLE (inputd->keys_list), key->entry, 1, 2, i, i+1,
+ GTK_EXPAND | GTK_FILL , 0, 2, 2);
+ gtk_widget_show (key->entry);
+
+ gtk_signal_connect (GTK_OBJECT(key->entry), "key_press_event",
+ GTK_SIGNAL_FUNC (gtk_input_dialog_key_press), key);
+ gtk_signal_connect (GTK_OBJECT(key->entry), "destroy",
+ GTK_SIGNAL_FUNC (gtk_input_dialog_destroy_key),
+ key);
+
+ /* and clear button */
+
+ button = gtk_button_new_with_label ("clear");
+ gtk_table_attach (GTK_TABLE (inputd->keys_list), button, 2, 3, i, i+1,
+ 0, 0, 2, 2);
+ gtk_widget_show (button);
+
+ gtk_signal_connect (GTK_OBJECT(button), "clicked",
+ GTK_SIGNAL_FUNC (gtk_input_dialog_clear_key), key);
- gtk_widget_show (hbox);
- gtk_widget_show (vbox);
+ gtk_input_dialog_set_key (key, info->keys[i].keyval,
+ info->keys[i].modifiers);
}
}
diff --git a/gtk/gtkinputdialog.h b/gtk/gtkinputdialog.h
index 93c667f440..80a900090a 100644
--- a/gtk/gtkinputdialog.h
+++ b/gtk/gtkinputdialog.h
@@ -49,6 +49,9 @@ struct _GtkInputDialog
GtkWidget *axis_items[GDK_AXIS_LAST];
guint32 current_device;
+
+ GtkWidget *keys_list;
+ GtkWidget *keys_listbox;
};
struct _GtkInputDialogClass
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index c55ade8a51..e2c064a483 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -38,6 +38,7 @@
typedef struct _GtkInitFunction GtkInitFunction;
typedef struct _GtkTimeoutFunction GtkTimeoutFunction;
typedef struct _GtkIdleFunction GtkIdleFunction;
+typedef struct _GtkInputFunction GtkInputFunction;
struct _GtkInitFunction
{
@@ -66,6 +67,12 @@ struct _GtkIdleFunction
GtkDestroyNotify destroy;
};
+struct _GtkInputFunction
+{
+ GtkCallbackMarshal callback;
+ gpointer data;
+ GtkDestroyNotify destroy;
+};
static void gtk_exit_func (void);
static void gtk_timeout_insert (GtkTimeoutFunction *timeoutf);
@@ -85,10 +92,9 @@ static void gtk_print (gchar *str);
static gint done;
static guint main_level = 0;
static gint initialized = FALSE;
-static GdkEvent next_event;
-static GdkEvent current_event;
-static gint have_event = FALSE;
-static gint have_next_event = FALSE;
+static GdkEvent *next_event = NULL;
+static GdkEvent *current_event = NULL;
+static GList *current_events = NULL;
static GList *grabs = NULL; /* A list of grabs. The grabbing widget
* is the first one on the list.
@@ -219,9 +225,10 @@ gtk_main_quit ()
gint
gtk_main_iteration ()
{
- GdkEvent event_copy;
GtkWidget *event_widget;
GtkWidget *grab_widget;
+ GdkEvent *event = NULL;
+ GList *tmp_list;
done = FALSE;
@@ -240,19 +247,17 @@ gtk_main_iteration ()
return done;
}
- /* If there is a valid event in 'next_event' then copy
- * it to 'event' and unset the flag.
+ /* If there is a valid event in 'next_event' then move it to 'event'
*/
- if (have_next_event)
+ if (next_event)
{
- have_next_event = FALSE;
- have_event = TRUE;
- current_event = next_event;
+ event = next_event;
+ next_event = NULL;
}
/* If we don't have an event then get one.
*/
- if (!have_event)
+ if (!event)
{
/* Handle setting of the "gdk" timer. If there are no
* timeout functions, then the timer is turned off.
@@ -262,21 +267,19 @@ gtk_main_iteration ()
*/
gtk_handle_timer ();
- have_event = gdk_event_get (&current_event, NULL, NULL);
+ event = gdk_event_get ();
}
/* "gdk_event_get" can return FALSE if the timer goes off
* and no events are pending. Therefore, we should make
* sure that we got an event before continuing.
*/
- if (have_event)
+ if (event)
{
- have_event = FALSE;
-
/* If there are any events pending then get the next one.
*/
if (gdk_events_pending () > 0)
- have_next_event = gdk_event_get (&next_event, NULL, NULL);
+ next_event = gdk_event_get ();
/* Try to compress enter/leave notify events. These event
* pairs occur when the mouse is dragged quickly across
@@ -286,19 +289,32 @@ gtk_main_iteration ()
* which contained the mouse initially and highlight the
* widget which ends up containing the mouse.
*/
- if (have_next_event)
- if (((current_event.type == GDK_ENTER_NOTIFY) ||
- (current_event.type == GDK_LEAVE_NOTIFY)) &&
- ((next_event.type == GDK_ENTER_NOTIFY) ||
- (next_event.type == GDK_LEAVE_NOTIFY)) &&
- (next_event.type != current_event.type) &&
- (next_event.any.window == current_event.any.window))
- return done;
+ if (next_event)
+ if (((event->type == GDK_ENTER_NOTIFY) ||
+ (event->type == GDK_LEAVE_NOTIFY)) &&
+ ((next_event->type == GDK_ENTER_NOTIFY) ||
+ (next_event->type == GDK_LEAVE_NOTIFY)) &&
+ (next_event->type != event->type) &&
+ (next_event->any.window == event->any.window))
+ {
+ tmp_list = current_events;
+ current_events = g_list_remove_link (current_events, tmp_list);
+ g_list_free_1 (tmp_list);
+
+ gdk_event_free (event);
+
+ return done;
+ }
+
+ /* Push the event onto a stack of current events for
+ * gdk_current_event_get */
+
+ current_events = g_list_prepend (current_events, event);
/* Find the widget which got the event. We store the widget
* in the user_data field of GdkWindow's.
*/
- event_widget = gtk_get_event_widget (&current_event);
+ event_widget = gtk_get_event_widget (event);
/* If there is a grab in effect...
*/
@@ -325,20 +341,23 @@ gtk_main_iteration ()
* and 2) redirecting these events to the grabbing widget
* could cause the display to be messed up.
*/
- event_copy = current_event;
- switch (event_copy.type)
+ switch (event->type)
{
case GDK_NOTHING:
break;
case GDK_DELETE:
- if (gtk_widget_event (event_widget, &event_copy))
+ gtk_object_ref (GTK_OBJECT (event_widget));
+ if (gtk_widget_event (event_widget, event))
gtk_widget_destroy (event_widget);
+ gtk_object_unref (GTK_OBJECT (event_widget));
break;
case GDK_DESTROY:
- gtk_widget_event (event_widget, &event_copy);
+ gtk_object_ref (GTK_OBJECT (event_widget));
+ gtk_widget_event (event_widget, event);
gtk_widget_destroy (event_widget);
+ gtk_object_unref (GTK_OBJECT (event_widget));
break;
case GDK_PROPERTY_NOTIFY:
@@ -351,8 +370,8 @@ gtk_main_iteration ()
if (event_widget == NULL)
{
- gtk_selection_incr_event (event_copy.any.window,
- &event_copy.property);
+ gtk_selection_incr_event (event->any.window,
+ &event->property);
break;
}
/* otherwise fall through */
@@ -371,7 +390,7 @@ gtk_main_iteration ()
case GDK_DROP_ENTER:
case GDK_DROP_LEAVE:
case GDK_DROP_DATA_AVAIL:
- gtk_widget_event (event_widget, &event_copy);
+ gtk_widget_event (event_widget, event);
break;
case GDK_MOTION_NOTIFY:
@@ -384,15 +403,23 @@ gtk_main_iteration ()
case GDK_PROXIMITY_IN:
case GDK_PROXIMITY_OUT:
case GDK_OTHER_EVENT:
- gtk_propagate_event (grab_widget, &event_copy);
+ gtk_propagate_event (grab_widget, event);
break;
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
if (grab_widget && GTK_WIDGET_IS_SENSITIVE (grab_widget))
- gtk_widget_event (grab_widget, &event_copy);
+ gtk_widget_event (grab_widget, event);
break;
}
+
+ tmp_list = current_events;
+ current_events = g_list_remove_link (current_events, tmp_list);
+ g_list_free_1 (tmp_list);
+
+ gdk_event_free (event);
+
+ current_event = NULL;
}
else
{
@@ -686,12 +713,63 @@ gtk_idle_remove_by_data (gpointer data)
}
}
+static void
+gtk_invoke_input_function (GtkInputFunction *input,
+ gint source,
+ GdkInputCondition condition)
+{
+ GtkArg args[3];
+ args[0].type = GTK_TYPE_INT;
+ args[0].name = NULL;
+ GTK_VALUE_INT(args[0]) = source;
+ args[1].type = GTK_TYPE_GDK_INPUT_CONDITION;
+ args[1].name = NULL;
+ GTK_VALUE_FLAGS(args[1]) = condition;
+ args[2].type = GTK_TYPE_NONE;
+ args[2].name = NULL;
+
+ input->callback (NULL, input->data, 2, args);
+}
+
+static void
+gtk_destroy_input_function (GtkInputFunction *input)
+{
+ if (input->destroy)
+ (input->destroy) (input->data);
+ g_free (input);
+}
+
+gint
+gtk_input_add_interp (gint source,
+ GdkInputCondition condition,
+ GtkCallbackMarshal callback,
+ gpointer data,
+ GtkDestroyNotify destroy)
+{
+ GtkInputFunction *input = g_new (GtkInputFunction, 1);
+ input->callback = callback;
+ input->data = data;
+ input->destroy = destroy;
+ return gdk_input_add_interp (source,
+ condition,
+ (GdkInputFunction) gtk_invoke_input_function,
+ input,
+ (GdkDestroyNotify) gtk_destroy_input_function);
+}
+
void
-gtk_get_current_event (GdkEvent *event)
+gtk_input_remove (gint tag)
{
- g_assert (event != NULL);
-
- *event = current_event;
+ gdk_input_remove (tag);
+}
+
+GdkEvent *
+gtk_get_current_event ()
+{
+ if (current_events)
+ return gdk_event_copy ((GdkEvent *)current_events->data);
+ else
+ return NULL;
}
GtkWidget*
diff --git a/gtk/gtkmain.h b/gtk/gtkmain.h
index c014f190a3..ae588d4d22 100644
--- a/gtk/gtkmain.h
+++ b/gtk/gtkmain.h
@@ -65,7 +65,7 @@ gint gtk_idle_add_interp (GtkCallbackMarshal function,
void gtk_idle_remove (gint tag);
void gtk_idle_remove_by_data (gpointer data);
-void gtk_get_current_event (GdkEvent *event);
+GdkEvent* gtk_get_current_event (void);
GtkWidget* gtk_get_event_widget (GdkEvent *event);
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 13fff9023a..caab1a0a0d 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -247,12 +247,14 @@ gtk_menu_set_accelerator_table (GtkMenu *menu,
g_return_if_fail (menu != NULL);
g_return_if_fail (GTK_IS_MENU (menu));
- if (menu->accelerator_table)
- gtk_accelerator_table_unref (menu->accelerator_table);
-
- menu->accelerator_table = table;
- if (menu->accelerator_table)
- gtk_accelerator_table_ref (menu->accelerator_table);
+ if (menu->accelerator_table != table)
+ {
+ if (menu->accelerator_table)
+ gtk_accelerator_table_unref (menu->accelerator_table);
+ menu->accelerator_table = table;
+ if (menu->accelerator_table)
+ gtk_accelerator_table_ref (menu->accelerator_table);
+ }
}
diff --git a/gtk/gtkmenufactory.c b/gtk/gtkmenufactory.c
index d6e9ea6841..eef5c8a373 100644
--- a/gtk/gtkmenufactory.c
+++ b/gtk/gtkmenufactory.c
@@ -85,6 +85,9 @@ gtk_menu_factory_destroy (GtkMenuFactory *factory)
gtk_menu_factory_destroy (subfactory);
}
+
+ if (factory->table)
+ gtk_accelerator_table_unref (factory->table);
}
void
@@ -237,11 +240,8 @@ gtk_menu_factory_create (GtkMenuFactory *factory,
&accelerator_key,
&accelerator_mods);
if (!factory->table)
- {
- factory->table = gtk_accelerator_table_new ();
- gtk_accelerator_table_ref (factory->table);
- }
-
+ factory->table = gtk_accelerator_table_new ();
+
gtk_widget_install_accelerator (menu_path->widget,
factory->table,
"activate",
@@ -291,10 +291,7 @@ gtk_menu_factory_create (GtkMenuFactory *factory,
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_path->widget), menu);
if (!factory->table)
- {
- factory->table = gtk_accelerator_table_new ();
- gtk_accelerator_table_ref (factory->table);
- }
+ factory->table = gtk_accelerator_table_new ();
gtk_menu_set_accelerator_table (GTK_MENU (menu), factory->table);
}
@@ -369,10 +366,7 @@ gtk_menu_factory_make_widget (GtkMenuFactory *factory)
widget = gtk_menu_new ();
if (!factory->table)
- {
- factory->table = gtk_accelerator_table_new ();
- gtk_accelerator_table_ref (factory->table);
- }
+ factory->table = gtk_accelerator_table_new ();
gtk_menu_set_accelerator_table (GTK_MENU (widget), factory->table);
return widget;
case GTK_MENU_FACTORY_MENU_BAR:
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index f7715fb25e..b023a85e5b 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -207,19 +207,20 @@ gtk_menu_item_set_submenu (GtkMenuItem *menu_item,
g_return_if_fail (menu_item != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (menu_item));
- if (menu_item->submenu)
+ if (menu_item->submenu != submenu)
{
- g_return_if_fail (!GTK_WIDGET_VISIBLE (menu_item->submenu));
- gtk_object_unref (GTK_OBJECT (menu_item->submenu));
- }
-
- menu_item->submenu = submenu;
-
- if (menu_item->submenu)
- gtk_object_ref (GTK_OBJECT (menu_item->submenu));
+ if (menu_item->submenu)
+ {
+ g_return_if_fail (!GTK_WIDGET_VISIBLE (menu_item->submenu));
+ gtk_object_unref (GTK_OBJECT (menu_item->submenu));
+ }
+ menu_item->submenu = submenu;
+ if (menu_item->submenu)
+ gtk_object_ref (GTK_OBJECT (menu_item->submenu));
- if (GTK_WIDGET (menu_item)->parent)
- gtk_widget_queue_resize (GTK_WIDGET (menu_item));
+ if (GTK_WIDGET (menu_item)->parent)
+ gtk_widget_queue_resize (GTK_WIDGET (menu_item));
+ }
}
void
diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c
index ffe487e891..38257b9b4a 100644
--- a/gtk/gtkobject.c
+++ b/gtk/gtkobject.c
@@ -230,7 +230,7 @@ gtk_object_ref (GtkObject *object)
}
/*****************************************
- * gtk_object_new:
+ * gtk_object_unref:
*
* arguments:
*
diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c
index ae640f81f1..66ef1538cc 100644
--- a/gtk/gtkpixmap.c
+++ b/gtk/gtkpixmap.c
@@ -23,7 +23,9 @@ static void gtk_pixmap_class_init (GtkPixmapClass *klass);
static void gtk_pixmap_init (GtkPixmap *pixmap);
static gint gtk_pixmap_expose (GtkWidget *widget,
GdkEventExpose *event);
+static void gtk_pixmap_destroy (GtkObject *object);
+static GtkWidgetClass *parent_class;
guint
gtk_pixmap_get_type ()
@@ -51,10 +53,14 @@ gtk_pixmap_get_type ()
static void
gtk_pixmap_class_init (GtkPixmapClass *class)
{
+ GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
+ object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
+ parent_class = gtk_type_class (gtk_widget_get_type ());
+ object_class->destroy = gtk_pixmap_destroy;
widget_class->expose_event = gtk_pixmap_expose;
}
@@ -82,6 +88,14 @@ gtk_pixmap_new (GdkPixmap *val,
return GTK_WIDGET (pixmap);
}
+static void
+gtk_pixmap_destroy (GtkObject *object)
+{
+ gtk_pixmap_set (GTK_PIXMAP (object), NULL, NULL);
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
void
gtk_pixmap_set (GtkPixmap *pixmap,
GdkPixmap *val,
@@ -92,25 +106,38 @@ gtk_pixmap_set (GtkPixmap *pixmap,
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GTK_IS_PIXMAP (pixmap));
- g_return_if_fail (val != NULL);
- pixmap->pixmap = val;
- pixmap->mask = mask;
-
- if (pixmap->pixmap)
+ if (pixmap->pixmap != val)
{
- gdk_window_get_size (pixmap->pixmap, &width, &height);
- GTK_WIDGET (pixmap)->requisition.width = width + GTK_MISC (pixmap)->xpad * 2;
- GTK_WIDGET (pixmap)->requisition.height = height + GTK_MISC (pixmap)->ypad * 2;
+ if (pixmap->pixmap)
+ gdk_pixmap_unref (pixmap->pixmap);
+ pixmap->pixmap = val;
+ if (pixmap->pixmap)
+ {
+ gdk_pixmap_ref (pixmap->pixmap);
+ gdk_window_get_size (pixmap->pixmap, &width, &height);
+ GTK_WIDGET (pixmap)->requisition.width =
+ width + GTK_MISC (pixmap)->xpad * 2;
+ GTK_WIDGET (pixmap)->requisition.height =
+ height + GTK_MISC (pixmap)->ypad * 2;
+ }
+ else
+ {
+ GTK_WIDGET (pixmap)->requisition.width = 0;
+ GTK_WIDGET (pixmap)->requisition.height = 0;
+ }
+ if (GTK_WIDGET_VISIBLE (pixmap))
+ gtk_widget_queue_resize (GTK_WIDGET (pixmap));
}
- else
+
+ if (pixmap->mask != mask)
{
- GTK_WIDGET (pixmap)->requisition.width = 0;
- GTK_WIDGET (pixmap)->requisition.height = 0;
+ if (pixmap->mask)
+ gdk_bitmap_unref (pixmap->mask);
+ pixmap->mask = mask;
+ if (pixmap->mask)
+ gdk_bitmap_ref (pixmap->mask);
}
-
- if (GTK_WIDGET_VISIBLE (pixmap))
- gtk_widget_queue_resize (GTK_WIDGET (pixmap));
}
void
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 8db560ba0c..620e5eed68 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -199,7 +199,7 @@ gtk_progress_bar_make_pixmap (GtkProgressBar *pbar)
widget = GTK_WIDGET (pbar);
if (pbar->offscreen_pixmap)
- gdk_pixmap_destroy (pbar->offscreen_pixmap);
+ gdk_pixmap_unref (pbar->offscreen_pixmap);
pbar->offscreen_pixmap = gdk_pixmap_new (widget->window,
widget->allocation.width,
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index f00bbf6838..58c41e43f9 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -195,28 +195,33 @@ gtk_range_set_adjustment (GtkRange *range,
g_return_if_fail (range != NULL);
g_return_if_fail (GTK_IS_RANGE (range));
- if (range->adjustment)
+ if (range->adjustment != adjustment)
{
- gtk_signal_disconnect_by_data (GTK_OBJECT (range->adjustment), (gpointer) range);
- gtk_object_unref (GTK_OBJECT (range->adjustment));
+ if (range->adjustment)
+ {
+ gtk_signal_disconnect_by_data (GTK_OBJECT (range->adjustment),
+ (gpointer) range);
+ gtk_object_unref (GTK_OBJECT (range->adjustment));
+ }
+ range->adjustment = adjustment;
+ if (adjustment)
+ {
+ gtk_object_ref (GTK_OBJECT (adjustment));
+ gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
+ (GtkSignalFunc) gtk_range_adjustment_changed,
+ (gpointer) range);
+ gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
+ (GtkSignalFunc) gtk_range_adjustment_value_changed,
+ (gpointer) range);
+
+ range->old_value = adjustment->value;
+ range->old_lower = adjustment->lower;
+ range->old_upper = adjustment->upper;
+ range->old_page_size = adjustment->page_size;
+
+ gtk_range_adjustment_changed (adjustment, (gpointer) range);
+ }
}
-
- range->adjustment = adjustment;
- gtk_object_ref (GTK_OBJECT (range->adjustment));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- (GtkSignalFunc) gtk_range_adjustment_changed,
- (gpointer) range);
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc) gtk_range_adjustment_value_changed,
- (gpointer) range);
-
- range->old_value = adjustment->value;
- range->old_lower = adjustment->lower;
- range->old_upper = adjustment->upper;
- range->old_page_size = adjustment->page_size;
-
- gtk_range_adjustment_changed (range->adjustment, (gpointer) range);
}
void
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index 131dd0b0fb..7ada4f3363 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -441,7 +441,7 @@ gtk_rc_style_init (GtkRcStyle *rc_style)
old_font = rc_style->style->font;
rc_style->style->font = gdk_fontset_load (rc_style->fontset_name);
if (rc_style->style->font)
- gdk_fontset_free (old_font);
+ gdk_font_unref (old_font);
else
rc_style->style->font = old_font;
}
@@ -450,7 +450,7 @@ gtk_rc_style_init (GtkRcStyle *rc_style)
old_font = rc_style->style->font;
rc_style->style->font = gdk_font_load (rc_style->font_name);
if (rc_style->style->font)
- gdk_font_free (old_font);
+ gdk_font_unref (old_font);
else
rc_style->style->font = old_font;
}
diff --git a/gtk/gtkruler.c b/gtk/gtkruler.c
index dad0e11f64..e8a9b07107 100644
--- a/gtk/gtkruler.c
+++ b/gtk/gtkruler.c
@@ -200,7 +200,7 @@ gtk_ruler_unrealize (GtkWidget *widget)
widget->window = NULL;
if (ruler->backing_store)
- gdk_pixmap_destroy (ruler->backing_store);
+ gdk_pixmap_unref (ruler->backing_store);
if (ruler->non_gr_exp_gc)
gdk_gc_destroy (ruler->non_gr_exp_gc);
@@ -286,7 +286,7 @@ gtk_ruler_make_pixmap (GtkRuler *ruler)
(height == widget->allocation.height))
return;
- gdk_pixmap_destroy (ruler->backing_store);
+ gdk_pixmap_unref (ruler->backing_store);
}
ruler->backing_store = gdk_pixmap_new (widget->window,
diff --git a/gtk/gtksignal.c b/gtk/gtksignal.c
index 65efdb991f..2db72ee19c 100644
--- a/gtk/gtksignal.c
+++ b/gtk/gtksignal.c
@@ -1173,11 +1173,8 @@ gtk_params_get (GtkArg *params,
for (i = 0; i < nparams; i++)
{
- if (param_types[i] != GTK_TYPE_NONE)
- {
- params[i].type = param_types[i];
- params[i].name = NULL;
- }
+ params[i].type = param_types[i];
+ params[i].name = NULL;
switch (GTK_FUNDAMENTAL_TYPE (param_types[i]))
{
@@ -1258,11 +1255,8 @@ gtk_params_get (GtkArg *params,
}
}
- if (return_val != GTK_TYPE_NONE)
- {
- params[i].type = return_val;
- params[i].name = NULL;
- }
+ params[i].type = return_val;
+ params[i].name = NULL;
switch (GTK_FUNDAMENTAL_TYPE (return_val))
{
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 8cb2b12578..db9ee483df 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -168,12 +168,13 @@ gtk_style_new ()
style = g_new (GtkStyle, 1);
if (!default_font)
- default_font = gdk_font_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*");
+ default_font =
+ gdk_font_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*");
style->font = default_font;
gdk_font_ref (style->font);
- style->ref_count = 0;
+ style->ref_count = 1;
style->attach_count = 0;
style->colormap = NULL;
style->depth = -1;
@@ -587,7 +588,7 @@ gtk_styles_init ()
initialize = FALSE;
style_cache = g_cache_new ((GCacheNewFunc) gtk_style_new_from_key,
- (GCacheDestroyFunc) gtk_style_destroy,
+ (GCacheDestroyFunc) gtk_style_unref,
(GCacheDupFunc) gtk_style_key_dup,
(GCacheDestroyFunc) gtk_style_key_destroy,
(GHashFunc) gtk_style_key_hash,
@@ -712,14 +713,17 @@ gtk_style_new_from_key (GtkStyleKey *key)
}
if (style)
- break;
+ {
+ gtk_style_ref (style);
+ break;
+ }
}
if (!style)
{
style = g_new (GtkStyle, 1);
- style->ref_count = 0;
+ style->ref_count = 1;
style->attach_count = 0;
style->font = key->font;
@@ -794,9 +798,6 @@ gtk_style_destroy (GtkStyle *style)
{
gint i;
- if (style->ref_count != 0)
- return;
-
if (style->attach_count > 0)
{
gtk_gc_release (style->black_gc);
@@ -816,13 +817,7 @@ gtk_style_destroy (GtkStyle *style)
unattached_styles = g_slist_remove (unattached_styles, style);
- if (style->font->type == GDK_FONT_FONT)
- gdk_font_free (style->font);
- else if (style->font->type == GDK_FONT_FONTSET)
- gdk_fontset_free (style->font);
- else
- g_error("undefined font type\n");
-
+ gdk_font_unref (style->font);
g_free (style);
}
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 4a94de0843..a3f8f219a7 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -244,6 +244,8 @@ static void scroll_up (GtkText* text, gint diff);
static void scroll_down (GtkText* text, gint diff);
static void scroll_int (GtkText* text, gint diff);
+static void process_exposes (GtkText *text);
+
/* Cache Management. */
static GList* remove_cache_line (GtkText* text, GList* list);
@@ -1548,6 +1550,9 @@ delete_char_line_expose (GtkText* text, gchar key, guint old_pixels)
draw_cursor (text, FALSE);
+ if (old_pixels != new_pixels)
+ process_exposes (text);
+
TEXT_ASSERT (text);
TEXT_SHOW(text);
}
@@ -1650,6 +1655,9 @@ insert_char_line_expose (GtkText* text, gchar key, guint old_pixels)
draw_cursor (text, FALSE);
+ if (old_pixels != new_pixels)
+ process_exposes (text);
+
TEXT_SHOW_ADJ (text, text->vadj, "vadj");
TEXT_ASSERT (text);
TEXT_SHOW(text);
@@ -2564,6 +2572,26 @@ scroll_int (GtkText* text, gint diff)
gtk_signal_emit_by_name (GTK_OBJECT (text->vadj), "value_changed");
}
+static void
+process_exposes (GtkText *text)
+{
+ GdkEvent *event;
+
+ /* Make sure graphics expose events are processed before scrolling
+ * again */
+
+ while ((event = gdk_event_get_graphics_expose (text->text_area)) != NULL)
+ {
+ gtk_widget_event (GTK_WIDGET (text), event);
+ if (event->expose.count == 0)
+ {
+ gdk_event_free (event);
+ break;
+ }
+ gdk_event_free (event);
+ }
+}
+
static gint last_visible_line_height (GtkText* text)
{
GList *cache = text->line_start_cache;
@@ -2660,6 +2688,9 @@ scroll_down (GtkText* text, gint diff0)
mouse_click_1 (text, &button);
}
}
+
+ if (height > real_diff)
+ process_exposes (text);
}
static void
@@ -2734,6 +2765,9 @@ scroll_up (GtkText* text, gint diff0)
mouse_click_1 (text, &button);
}
}
+
+ if (height > real_diff)
+ process_exposes (text);
}
/**********************************************************************/
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
index a367504819..774258036e 100644
--- a/gtk/gtktooltips.c
+++ b/gtk/gtktooltips.c
@@ -17,6 +17,7 @@
*/
#include <stdlib.h>
#include <string.h>
+#include <stdio.h>
#include "gtkmain.h"
#include "gtkwidget.h"
@@ -41,7 +42,7 @@ static gint gtk_tooltips_widget_visible (GtkWidget *widget);
static gint gtk_tooltips_timeout (gpointer data);
static void gtk_tooltips_create_window (GtkTooltips *tooltips);
static void gtk_tooltips_draw_tips (GtkTooltips *tooltips);
-
+static void gtk_tooltips_real_destroy (GtkTooltips *tooltips);
GtkTooltips *
gtk_tooltips_new ()
@@ -52,8 +53,7 @@ gtk_tooltips_new ()
if (tooltips != NULL)
{
- tooltips->ref_count = 0;
- tooltips->pending_destroy = 0;
+ tooltips->ref_count = 1;
tooltips->enabled = TRUE;
tooltips->numwidgets = 0;
@@ -81,8 +81,8 @@ gtk_tooltips_unref (GtkTooltips *tooltips)
{
g_return_if_fail (tooltips != NULL);
tooltips->ref_count -= 1;
- if (tooltips->ref_count == 0 && tooltips->pending_destroy)
- gtk_tooltips_destroy (tooltips);
+ if (tooltips->ref_count == 0)
+ gtk_tooltips_real_destroy (tooltips);
}
void
@@ -105,20 +105,14 @@ gtk_tooltips_destroy_data (GtkTooltips *tooltips,
g_free (tooltipsdata);
}
-void
-gtk_tooltips_destroy (GtkTooltips *tooltips)
+static void
+gtk_tooltips_real_destroy (GtkTooltips *tooltips)
{
GList *current;
GtkTooltipsData *tooltipsdata;
g_return_if_fail (tooltips != NULL);
- if (tooltips->ref_count > 0)
- {
- tooltips->pending_destroy = 1;
- return;
- }
-
if (tooltips->timer_active == TRUE)
{
tooltips->timer_active = FALSE;
@@ -627,14 +621,9 @@ gtk_tooltips_widget_remove (GtkWidget *widget,
if (list)
{
tooltipsdata = (GtkTooltipsData*) list->data;
-
- g_free (tooltipsdata->tips_text);
- g_list_foreach (tooltipsdata->row, gtk_tooltips_free_string, 0);
- g_list_free (tooltipsdata->row);
- gtk_signal_disconnect_by_data (GTK_OBJECT (tooltipsdata->widget), (gpointer) tooltips);
- g_free (tooltipsdata);
-
- tooltips->widget_list = g_list_remove (tooltips->widget_list, tooltipsdata);
+ tooltips->widget_list = g_list_remove (tooltips->widget_list,
+ tooltipsdata);
+ gtk_tooltips_destroy_data (tooltips, tooltipsdata);
}
gtk_object_set_data (GTK_OBJECT (widget), "_GtkTooltips", NULL);
diff --git a/gtk/gtktooltips.h b/gtk/gtktooltips.h
index f5c6ddbdb7..5625aa59b9 100644
--- a/gtk/gtktooltips.h
+++ b/gtk/gtktooltips.h
@@ -53,13 +53,10 @@ typedef struct
gint timer_active;
gint ref_count;
- gint pending_destroy;
} GtkTooltips;
GtkTooltips* gtk_tooltips_new (void);
-
-void gtk_tooltips_destroy (GtkTooltips *tooltips);
GtkTooltips* gtk_tooltips_ref (GtkTooltips *tooltips);
void gtk_tooltips_unref (GtkTooltips *tooltips);
diff --git a/gtk/gtktypebuiltins.c b/gtk/gtktypebuiltins.c
index e43573119d..d42ba64b94 100644
--- a/gtk/gtktypebuiltins.c
+++ b/gtk/gtktypebuiltins.c
@@ -20,6 +20,10 @@
{ "GtkPositionType", GTK_TYPE_ENUM },
{ "GtkPreviewType", GTK_TYPE_ENUM },
{ "GtkWidgetFlags", GTK_TYPE_FLAGS },
+ { "GtkSelectionMode", GTK_TYPE_ENUM },
+ { "GtkCurveType", GTK_TYPE_ENUM },
+ { "GtkFundamentalType", GTK_TYPE_ENUM },
+ { "GtkJustification", GTK_TYPE_ENUM },
{ "GdkWindowType", GTK_TYPE_ENUM },
{ "GdkWindowClass", GTK_TYPE_ENUM },
{ "GdkImageType", GTK_TYPE_ENUM },
@@ -51,3 +55,5 @@
{ "GdkFont", GTK_TYPE_BOXED },
{ "GdkWindow", GTK_TYPE_BOXED },
{ "GdkEvent", GTK_TYPE_BOXED },
+ { "GdkColor", GTK_TYPE_BOXED },
+ { "GtkTooltips", GTK_TYPE_BOXED },
diff --git a/gtk/gtktypebuiltins.h b/gtk/gtktypebuiltins.h
index ba9131f0f1..4cf9f8f403 100644
--- a/gtk/gtktypebuiltins.h
+++ b/gtk/gtktypebuiltins.h
@@ -20,35 +20,41 @@
#define GTK_TYPE_POSITION_TYPE (gtk_type_builtins[17])
#define GTK_TYPE_PREVIEW_TYPE (gtk_type_builtins[18])
#define GTK_TYPE_WIDGET_FLAGS (gtk_type_builtins[19])
-#define GTK_TYPE_GDK_WINDOW_TYPE (gtk_type_builtins[20])
-#define GTK_TYPE_GDK_WINDOW_CLASS (gtk_type_builtins[21])
-#define GTK_TYPE_GDK_IMAGE_TYPE (gtk_type_builtins[22])
-#define GTK_TYPE_GDK_VISUAL_TYPE (gtk_type_builtins[23])
-#define GTK_TYPE_GDK_WINDOW_ATTRIBUTES_TYPE (gtk_type_builtins[24])
-#define GTK_TYPE_GDK_WINDOW_HINTS (gtk_type_builtins[25])
-#define GTK_TYPE_GDK_FUNCTION (gtk_type_builtins[26])
-#define GTK_TYPE_GDK_FILL (gtk_type_builtins[27])
-#define GTK_TYPE_GDK_LINE_STYLE (gtk_type_builtins[28])
-#define GTK_TYPE_GDK_CAP_STYLE (gtk_type_builtins[29])
-#define GTK_TYPE_GDK_JOIN_STYLE (gtk_type_builtins[30])
-#define GTK_TYPE_GDK_CURSOR_TYPE (gtk_type_builtins[31])
-#define GTK_TYPE_GDK_EVENT_TYPE (gtk_type_builtins[32])
-#define GTK_TYPE_GDK_EVENT_MASK (gtk_type_builtins[33])
-#define GTK_TYPE_GDK_NOTIFY_TYPE (gtk_type_builtins[34])
-#define GTK_TYPE_GDK_MODIFIER_TYPE (gtk_type_builtins[35])
-#define GTK_TYPE_GDK_SUBWINDOW_MODE (gtk_type_builtins[36])
-#define GTK_TYPE_GDK_INPUT_CONDITION (gtk_type_builtins[37])
-#define GTK_TYPE_GDK_STATUS (gtk_type_builtins[38])
-#define GTK_TYPE_GDK_BYTE_ORDER (gtk_type_builtins[39])
-#define GTK_TYPE_GDK_GCVALUES_MASK (gtk_type_builtins[40])
-#define GTK_TYPE_GDK_SELECTION (gtk_type_builtins[41])
-#define GTK_TYPE_GDK_PROPERTY_STATE (gtk_type_builtins[42])
-#define GTK_TYPE_GDK_PROP_MODE (gtk_type_builtins[43])
-#define GTK_TYPE_ACCELERATOR_TABLE (gtk_type_builtins[44])
-#define GTK_TYPE_STYLE (gtk_type_builtins[45])
-#define GTK_TYPE_GDK_COLORMAP (gtk_type_builtins[46])
-#define GTK_TYPE_GDK_VISUAL (gtk_type_builtins[47])
-#define GTK_TYPE_GDK_FONT (gtk_type_builtins[48])
-#define GTK_TYPE_GDK_WINDOW (gtk_type_builtins[49])
-#define GTK_TYPE_GDK_EVENT (gtk_type_builtins[50])
-#define GTK_TYPE_NUM_BUILTINS 51
+#define GTK_TYPE_SELECTION_MODE (gtk_type_builtins[20])
+#define GTK_TYPE_CURVE_TYPE (gtk_type_builtins[21])
+#define GTK_TYPE_FUNDAMENTAL_TYPE (gtk_type_builtins[22])
+#define GTK_TYPE_JUSTIFICATION (gtk_type_builtins[23])
+#define GTK_TYPE_GDK_WINDOW_TYPE (gtk_type_builtins[24])
+#define GTK_TYPE_GDK_WINDOW_CLASS (gtk_type_builtins[25])
+#define GTK_TYPE_GDK_IMAGE_TYPE (gtk_type_builtins[26])
+#define GTK_TYPE_GDK_VISUAL_TYPE (gtk_type_builtins[27])
+#define GTK_TYPE_GDK_WINDOW_ATTRIBUTES_TYPE (gtk_type_builtins[28])
+#define GTK_TYPE_GDK_WINDOW_HINTS (gtk_type_builtins[29])
+#define GTK_TYPE_GDK_FUNCTION (gtk_type_builtins[30])
+#define GTK_TYPE_GDK_FILL (gtk_type_builtins[31])
+#define GTK_TYPE_GDK_LINE_STYLE (gtk_type_builtins[32])
+#define GTK_TYPE_GDK_CAP_STYLE (gtk_type_builtins[33])
+#define GTK_TYPE_GDK_JOIN_STYLE (gtk_type_builtins[34])
+#define GTK_TYPE_GDK_CURSOR_TYPE (gtk_type_builtins[35])
+#define GTK_TYPE_GDK_EVENT_TYPE (gtk_type_builtins[36])
+#define GTK_TYPE_GDK_EVENT_MASK (gtk_type_builtins[37])
+#define GTK_TYPE_GDK_NOTIFY_TYPE (gtk_type_builtins[38])
+#define GTK_TYPE_GDK_MODIFIER_TYPE (gtk_type_builtins[39])
+#define GTK_TYPE_GDK_SUBWINDOW_MODE (gtk_type_builtins[40])
+#define GTK_TYPE_GDK_INPUT_CONDITION (gtk_type_builtins[41])
+#define GTK_TYPE_GDK_STATUS (gtk_type_builtins[42])
+#define GTK_TYPE_GDK_BYTE_ORDER (gtk_type_builtins[43])
+#define GTK_TYPE_GDK_GCVALUES_MASK (gtk_type_builtins[44])
+#define GTK_TYPE_GDK_SELECTION (gtk_type_builtins[45])
+#define GTK_TYPE_GDK_PROPERTY_STATE (gtk_type_builtins[46])
+#define GTK_TYPE_GDK_PROP_MODE (gtk_type_builtins[47])
+#define GTK_TYPE_ACCELERATOR_TABLE (gtk_type_builtins[48])
+#define GTK_TYPE_STYLE (gtk_type_builtins[49])
+#define GTK_TYPE_GDK_COLORMAP (gtk_type_builtins[50])
+#define GTK_TYPE_GDK_VISUAL (gtk_type_builtins[51])
+#define GTK_TYPE_GDK_FONT (gtk_type_builtins[52])
+#define GTK_TYPE_GDK_WINDOW (gtk_type_builtins[53])
+#define GTK_TYPE_GDK_EVENT (gtk_type_builtins[54])
+#define GTK_TYPE_GDK_COLOR (gtk_type_builtins[55])
+#define GTK_TYPE_TOOLTIPS (gtk_type_builtins[56])
+#define GTK_TYPE_NUM_BUILTINS 57
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index dfa00c4b08..a084b13345 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -145,23 +145,27 @@ gtk_viewport_set_hadjustment (GtkViewport *viewport,
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
g_return_if_fail (adjustment != NULL);
- if (viewport->hadjustment)
+ if (viewport->hadjustment != adjustment)
{
- gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->hadjustment), (gpointer) viewport);
- gtk_object_unref (GTK_OBJECT (viewport->hadjustment));
- }
+ if (viewport->hadjustment)
+ {
+ gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->hadjustment),
+ (gpointer) viewport);
+ gtk_object_unref (GTK_OBJECT (viewport->hadjustment));
+ }
- viewport->hadjustment = adjustment;
- gtk_object_ref (GTK_OBJECT (viewport->hadjustment));
+ viewport->hadjustment = adjustment;
+ gtk_object_ref (GTK_OBJECT (viewport->hadjustment));
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- (GtkSignalFunc) gtk_viewport_adjustment_changed,
- (gpointer) viewport);
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc) gtk_viewport_adjustment_value_changed,
- (gpointer) viewport);
+ gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
+ (GtkSignalFunc) gtk_viewport_adjustment_changed,
+ (gpointer) viewport);
+ gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
+ (GtkSignalFunc)gtk_viewport_adjustment_value_changed,
+ (gpointer) viewport);
- gtk_viewport_adjustment_changed (adjustment, (gpointer) viewport);
+ gtk_viewport_adjustment_changed (adjustment, (gpointer) viewport);
+ }
}
void
@@ -172,23 +176,27 @@ gtk_viewport_set_vadjustment (GtkViewport *viewport,
g_return_if_fail (GTK_IS_VIEWPORT (viewport));
g_return_if_fail (adjustment != NULL);
- if (viewport->vadjustment)
+ if (viewport->vadjustment != adjustment)
{
- gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->vadjustment), (gpointer) viewport);
- gtk_object_unref (GTK_OBJECT (viewport->vadjustment));
- }
-
- viewport->vadjustment = adjustment;
- gtk_object_ref (GTK_OBJECT (viewport->vadjustment));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- (GtkSignalFunc) gtk_viewport_adjustment_changed,
- (gpointer) viewport);
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- (GtkSignalFunc) gtk_viewport_adjustment_value_changed,
- (gpointer) viewport);
+ if (viewport->vadjustment)
+ {
+ gtk_signal_disconnect_by_data (GTK_OBJECT (viewport->vadjustment),
+ (gpointer) viewport);
+ gtk_object_unref (GTK_OBJECT (viewport->vadjustment));
+ }
- gtk_viewport_adjustment_changed (adjustment, (gpointer) viewport);
+ viewport->vadjustment = adjustment;
+ gtk_object_ref (GTK_OBJECT (viewport->vadjustment));
+
+ gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
+ (GtkSignalFunc) gtk_viewport_adjustment_changed,
+ (gpointer) viewport);
+ gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
+ (GtkSignalFunc)gtk_viewport_adjustment_value_changed,
+ (gpointer) viewport);
+
+ gtk_viewport_adjustment_changed (adjustment, (gpointer) viewport);
+ }
}
void
diff --git a/gtk/gtkvscrollbar.c b/gtk/gtkvscrollbar.c
index f272617528..053131e654 100644
--- a/gtk/gtkvscrollbar.c
+++ b/gtk/gtkvscrollbar.c
@@ -146,7 +146,9 @@ gtk_vscrollbar_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
+
range->trough = widget->window;
+ gdk_window_ref (range->trough);
attributes.x = widget->style->klass->xthickness;
attributes.y = widget->style->klass->ythickness;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 7cf35547ea..1ded117db5 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -135,6 +135,8 @@ static GdkColormap* gtk_widget_peek_colormap (void);
static GdkVisual* gtk_widget_peek_visual (void);
static GtkStyle* gtk_widget_peek_style (void);
+static void gtk_widget_reparent_container_child (GtkWidget *widget,
+ gpointer client_data);
static void gtk_widget_set_parent_sensitive (GtkWidget *widget,
gpointer client_data);
static void gtk_widget_propagate_restore (GtkWidget *widget,
@@ -730,11 +732,19 @@ gtk_widget_init (GtkWidget *widget)
colormap = gtk_widget_peek_colormap ();
visual = gtk_widget_peek_visual ();
+ /* XXX - should we ref the colormap and visual, too? */
+
if (colormap != gtk_widget_get_default_colormap ())
- gtk_object_set_data (GTK_OBJECT (widget), colormap_key, colormap);
-
+ {
+ /* gdk_colormap_ref (colormap); */
+ gtk_object_set_data (GTK_OBJECT (widget), colormap_key, colormap);
+ }
+
if (visual != gtk_widget_get_default_visual ())
- gtk_object_set_data (GTK_OBJECT (widget), visual_key, visual);
+ {
+ /* gdk_visual_ref (visual); */
+ gtk_object_set_data (GTK_OBJECT (widget), visual_key, visual);
+ }
}
/*****************************************
@@ -1549,6 +1559,26 @@ gtk_widget_activate (GtkWidget *widget)
* results:
*****************************************/
+static void
+gtk_widget_reparent_container_child(GtkWidget *widget,
+ gpointer client_data)
+{
+ GtkWidget *new_parent = GTK_WIDGET (client_data);
+
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (client_data != NULL);
+
+ if (!GTK_WIDGET_NO_WINDOW (widget))
+ gdk_window_reparent (widget->window, new_parent->window, 0, 0);
+ else if (GTK_IS_CONTAINER (widget))
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ gtk_widget_reparent_container_child,
+ new_parent);
+ else
+ widget->window = new_parent->window;
+}
+
+
void
gtk_widget_reparent (GtkWidget *widget,
GtkWidget *new_parent)
@@ -1559,32 +1589,35 @@ gtk_widget_reparent (GtkWidget *widget,
if (widget->parent != new_parent)
{
+ gtk_object_ref (GTK_OBJECT (widget));
gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
gtk_container_add (GTK_CONTAINER (new_parent), widget);
-
+ gtk_object_unref (GTK_OBJECT (widget));
+
if (GTK_WIDGET_REALIZED (widget))
{
- if (GTK_WIDGET_REALIZED (new_parent) && !GTK_WIDGET_NO_WINDOW (widget))
+ if (GTK_WIDGET_REALIZED (new_parent))
{
- gdk_window_reparent (widget->window, widget->parent->window, 0, 0);
+ if (GTK_WIDGET_NO_WINDOW (widget))
+ {
+ if (GTK_IS_CONTAINER (widget))
+ gtk_container_foreach (GTK_CONTAINER(widget),
+ gtk_widget_reparent_container_child,
+ new_parent);
+ else
+ widget->window = widget->parent->window;
+ }
+ else
+ gdk_window_reparent (widget->window, widget->parent->window, 0, 0);
}
else
- {
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED);
- if (!GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_destroy (widget->window);
- widget->window = NULL;
-
- if (GTK_WIDGET_REALIZED (new_parent))
- gtk_widget_realize (widget);
- if (GTK_WIDGET_MAPPED (new_parent))
- gtk_widget_map (widget);
- }
+ gtk_widget_unrealize (widget);
}
if (!GTK_WIDGET_REALIZED (widget) && GTK_WIDGET_REALIZED (new_parent))
gtk_widget_realize (widget);
- if (!GTK_WIDGET_MAPPED (widget) && GTK_WIDGET_MAPPED (new_parent))
+ if (GTK_WIDGET_VISIBLE (widget) &&
+ !GTK_WIDGET_MAPPED (widget) && GTK_WIDGET_MAPPED (new_parent))
gtk_widget_map (widget);
gtk_widget_queue_resize (widget);
@@ -2446,9 +2479,14 @@ gtk_widget_pop_style ()
void
gtk_widget_set_default_colormap (GdkColormap *colormap)
{
- if (default_colormap && (default_colormap != colormap))
- gdk_colormap_destroy (default_colormap);
- default_colormap = colormap;
+ if (default_colormap != colormap)
+ {
+ if (default_colormap)
+ gdk_colormap_unref (default_colormap);
+ default_colormap = colormap;
+ if (default_colormap)
+ gdk_colormap_ref (default_colormap);
+ }
}
/*****************************************
@@ -2476,11 +2514,14 @@ gtk_widget_set_default_visual (GdkVisual *visual)
void
gtk_widget_set_default_style (GtkStyle *style)
{
- if (default_style)
- gtk_style_unref (default_style);
-
- default_style = style;
- gtk_style_ref (default_style);
+ if (style != default_style)
+ {
+ if (default_style)
+ gtk_style_unref (default_style);
+ default_style = style;
+ if (default_style)
+ gtk_style_ref (default_style);
+ }
}
/* Basically, send a message to all toplevel windows telling them
@@ -2854,7 +2895,7 @@ gtk_real_widget_unrealize (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WIDGET (widget));
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED | GTK_VISIBLE);
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED);
gtk_style_detach (widget->style);
if (!GTK_WIDGET_NO_WINDOW (widget))
@@ -3177,7 +3218,6 @@ gtk_widget_set_style_internal (GtkWidget *widget,
gtk_style_detach (widget->style);
gtk_style_unref (widget->style);
-
widget->style = style;
gtk_style_ref (widget->style);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 4fc8dd5e33..f7ed03ed70 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -25,6 +25,7 @@
enum {
MOVE_RESIZE,
+ SET_FOCUS,
LAST_SIGNAL
};
@@ -35,13 +36,18 @@ typedef gint (*GtkWindowSignal1) (GtkObject *object,
gint arg3,
gint arg4,
gpointer data);
-
+typedef void (*GtkWindowSignal2) (GtkObject *object,
+ gpointer arg1,
+ gpointer data);
static void gtk_window_marshal_signal_1 (GtkObject *object,
GtkSignalFunc func,
gpointer func_data,
GtkArg *args);
-
+static void gtk_window_marshal_signal_2 (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args);
static void gtk_window_class_init (GtkWindowClass *klass);
static void gtk_window_init (GtkWindow *window);
static void gtk_window_arg (GtkWindow *window,
@@ -80,6 +86,8 @@ static gint gtk_real_window_move_resize (GtkWindow *window,
gint *y,
gint width,
gint height);
+static void gtk_real_window_set_focus (GtkWindow *window,
+ GtkWidget *focus);
static gint gtk_window_move_resize (GtkWidget *widget);
static void gtk_window_set_hints (GtkWidget *widget,
GtkRequisition *requisition);
@@ -144,6 +152,15 @@ gtk_window_class_init (GtkWindowClass *klass)
GTK_TYPE_POINTER, GTK_TYPE_POINTER,
GTK_TYPE_INT, GTK_TYPE_INT);
+ window_signals[SET_FOCUS] =
+ gtk_signal_new ("set_focus",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkWindowClass, set_focus),
+ gtk_window_marshal_signal_2,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_POINTER);
+
gtk_object_class_add_signals (object_class, window_signals, LAST_SIGNAL);
object_class->destroy = gtk_window_destroy;
@@ -168,6 +185,7 @@ gtk_window_class_init (GtkWindowClass *klass)
container_class->need_resize = gtk_window_need_resize;
klass->move_resize = gtk_real_window_move_resize;
+ klass->set_focus = gtk_real_window_set_focus;
}
static void
@@ -270,36 +288,7 @@ void
gtk_window_set_focus (GtkWindow *window,
GtkWidget *focus)
{
- GdkEventFocus event;
-
- g_return_if_fail (window != NULL);
- g_return_if_fail (GTK_IS_WINDOW (window));
-
- if (focus && !GTK_WIDGET_CAN_FOCUS (focus))
- return;
-
- if (window->focus_widget != focus)
- {
- if (window->focus_widget)
- {
- event.type = GDK_FOCUS_CHANGE;
- event.window = window->focus_widget->window;
- event.in = FALSE;
-
- gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
- }
-
- window->focus_widget = focus;
-
- if (window->focus_widget)
- {
- event.type = GDK_FOCUS_CHANGE;
- event.window = window->focus_widget->window;
- event.in = TRUE;
-
- gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
- }
- }
+ gtk_signal_emit (GTK_OBJECT (window), window_signals[SET_FOCUS], focus);
}
void
@@ -350,7 +339,8 @@ gtk_window_add_accelerator_table (GtkWindow *window,
g_return_if_fail (GTK_IS_WINDOW (window));
gtk_accelerator_table_ref (table);
- window->accelerator_tables = g_list_prepend (window->accelerator_tables, table);
+ window->accelerator_tables = g_list_prepend (window->accelerator_tables,
+ table);
}
void
@@ -360,7 +350,8 @@ gtk_window_remove_accelerator_table (GtkWindow *window,
g_return_if_fail (window != NULL);
g_return_if_fail (GTK_IS_WINDOW (window));
- window->accelerator_tables = g_list_remove (window->accelerator_tables, table);
+ window->accelerator_tables = g_list_remove (window->accelerator_tables,
+ table);
gtk_accelerator_table_unref (table);
}
@@ -395,6 +386,19 @@ gtk_window_marshal_signal_1 (GtkObject *object,
}
static void
+gtk_window_marshal_signal_2 (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args)
+{
+ GtkWindowSignal2 rfunc;
+
+ rfunc = (GtkWindowSignal2) func;
+
+ (* rfunc) (object, GTK_VALUE_POINTER (args[0]), func_data);
+}
+
+static void
gtk_window_destroy (GtkObject *object)
{
GtkWindow *window;
@@ -1128,6 +1132,42 @@ gtk_window_move_resize (GtkWidget *widget)
}
static void
+gtk_real_window_set_focus (GtkWindow *window,
+ GtkWidget *focus)
+{
+ GdkEventFocus event;
+
+ g_return_if_fail (window != NULL);
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+ if (focus && !GTK_WIDGET_CAN_FOCUS (focus))
+ return;
+
+ if (window->focus_widget != focus)
+ {
+ if (window->focus_widget)
+ {
+ event.type = GDK_FOCUS_CHANGE;
+ event.window = window->focus_widget->window;
+ event.in = FALSE;
+
+ gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
+ }
+
+ window->focus_widget = focus;
+
+ if (window->focus_widget)
+ {
+ event.type = GDK_FOCUS_CHANGE;
+ event.window = window->focus_widget->window;
+ event.in = TRUE;
+
+ gtk_widget_event (window->focus_widget, (GdkEvent*) &event);
+ }
+ }
+}
+
+static void
gtk_window_set_hints (GtkWidget *widget,
GtkRequisition *requisition)
{
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index ff22527312..755b9340c5 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -66,6 +66,8 @@ struct _GtkWindowClass
gint *y,
gint width,
gint height);
+ void (* set_focus) (GtkWindow *window,
+ GtkWidget *focus);
};
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index 1a54d439f7..a1d5545dfe 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -2763,6 +2763,194 @@ create_gamma_curve ()
++count;
}
+static int scroll_test_pos = 0.0;
+static GdkGC *scroll_test_gc = NULL;
+
+static gint
+scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
+ GtkAdjustment *adj)
+{
+ gint i,j;
+ gint imin, imax, jmin, jmax;
+
+ imin = (event->area.x) / 10;
+ imax = (event->area.x + event->area.width + 9) / 10;
+
+ jmin = ((int)adj->value + event->area.y) / 10;
+ jmax = ((int)adj->value + event->area.y + event->area.height + 9) / 10;
+
+ gdk_window_clear_area (widget->window,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
+
+ for (i=imin; i<imax; i++)
+ for (j=jmin; j<jmax; j++)
+ if ((i+j) % 2)
+ gdk_draw_rectangle (widget->window,
+ widget->style->black_gc,
+ TRUE,
+ 10*i, 10*j - (int)adj->value, 1+i%10, 1+j%10);
+
+ return TRUE;
+}
+
+static void
+scroll_test_configure (GtkWidget *widget, GdkEventConfigure *event,
+ GtkAdjustment *adj)
+{
+ adj->page_increment = 0.9 * widget->allocation.height;
+ adj->page_size = widget->allocation.height;
+
+ gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
+}
+
+static void
+scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget)
+{
+ gint source_min = (int)adj->value - scroll_test_pos;
+ gint source_max = source_min + widget->allocation.height;
+ gint dest_min = 0;
+ gint dest_max = widget->allocation.height;
+ GdkRectangle rect;
+ GdkEvent *event;
+
+ scroll_test_pos = adj->value;
+
+ if (!GTK_WIDGET_DRAWABLE (widget))
+ return;
+
+ if (source_min < 0)
+ {
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = widget->allocation.width;
+ rect.height = -source_min;
+ if (rect.height > widget->allocation.height)
+ rect.height = widget->allocation.height;
+
+ source_min = 0;
+ dest_min = rect.height;
+ }
+ else
+ {
+ rect.x = 0;
+ rect.y = 2*widget->allocation.height - source_max;
+ if (rect.y < 0)
+ rect.y = 0;
+ rect.width = widget->allocation.width;
+ rect.height = widget->allocation.height - rect.y;
+
+ source_max = widget->allocation.height;
+ dest_max = rect.y;
+ }
+
+ if (source_min != source_max)
+ {
+ if (scroll_test_gc == NULL)
+ {
+ scroll_test_gc = gdk_gc_new (widget->window);
+ gdk_gc_set_exposures (scroll_test_gc, TRUE);
+ }
+
+ gdk_draw_pixmap (widget->window,
+ scroll_test_gc,
+ widget->window,
+ 0, source_min,
+ 0, dest_min,
+ widget->allocation.width,
+ source_max - source_min);
+
+ /* Make sure graphics expose events are processed before scrolling
+ * again */
+
+ while ((event = gdk_event_get_graphics_expose (widget->window)) != NULL)
+ {
+ gtk_widget_event (widget, event);
+ if (event->expose.count == 0)
+ {
+ gdk_event_free (event);
+ break;
+ }
+ gdk_event_free (event);
+ }
+ }
+
+
+ if (rect.height != 0)
+ gtk_widget_draw (widget, &rect);
+}
+
+
+void
+create_scroll_test ()
+{
+ static GtkWidget *window = NULL;
+ GtkWidget *hbox;
+ GtkWidget *drawing_area;
+ GtkWidget *scrollbar;
+ GtkWidget *button;
+ GtkAdjustment *adj;
+
+ if (!window)
+ {
+ window = gtk_dialog_new ();
+
+ gtk_signal_connect (GTK_OBJECT (window), "destroy",
+ GTK_SIGNAL_FUNC(destroy_window),
+ &window);
+ gtk_signal_connect (GTK_OBJECT (window), "delete_event",
+ GTK_SIGNAL_FUNC(destroy_window),
+ &window);
+
+ gtk_window_set_title (GTK_WINDOW (window), "Scroll Test");
+ gtk_container_border_width (GTK_CONTAINER (window), 0);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), hbox,
+ TRUE, TRUE, 0);
+ gtk_widget_show (hbox);
+
+ drawing_area = gtk_drawing_area_new ();
+ gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
+ gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);
+ gtk_widget_show (drawing_area);
+
+ gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK);
+
+ adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0));
+ scroll_test_pos = 0.0;
+
+ scrollbar = gtk_vscrollbar_new (adj);
+ gtk_box_pack_start (GTK_BOX (hbox), scrollbar, FALSE, FALSE, 0);
+ gtk_widget_show (scrollbar);
+
+ gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
+ GTK_SIGNAL_FUNC (scroll_test_expose), adj);
+ gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
+ GTK_SIGNAL_FUNC (scroll_test_configure), adj);
+
+
+ gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
+ GTK_SIGNAL_FUNC (scroll_test_adjustment_changed),
+ drawing_area);
+
+ /* .. And create some buttons */
+
+ button = gtk_button_new_with_label ("Quit");
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
+ button, TRUE, TRUE, 0);
+
+ gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (window));
+ gtk_widget_show (button);
+ }
+
+ if (!GTK_WIDGET_VISIBLE (window))
+ gtk_widget_show (window);
+ else
+ gtk_widget_destroy (window);
+}
/*
* Timeout Test
@@ -3069,6 +3257,7 @@ create_main_window ()
{ "preview color", create_color_preview },
{ "preview gray", create_gray_preview },
{ "gamma curve", create_gamma_curve },
+ { "test scrolling", create_scroll_test },
{ "test selection", create_selection_test },
{ "test timeout", create_timeout_test },
{ "test idle", create_idle_test },
diff --git a/gtk/testinput.c b/gtk/testinput.c
index 1c6dae0e1d..218e5ca769 100644
--- a/gtk/testinput.c
+++ b/gtk/testinput.c
@@ -96,9 +96,7 @@ static gint
configure_event (GtkWidget *widget, GdkEventConfigure *event)
{
if (pixmap)
- {
- gdk_pixmap_destroy(pixmap);
- }
+ gdk_pixmap_unref (pixmap);
pixmap = gdk_pixmap_new(widget->window,
widget->allocation.width,
widget->allocation.height,
@@ -187,6 +185,17 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
}
static gint
+key_press_event (GtkWidget *widget, GdkEventKey *event)
+{
+ if ((event->keyval >= 0x20) && (event->keyval <= 0xFF))
+ printf("I got a %c\n", event->keyval);
+ else
+ printf("I got some other key\n");
+
+ return TRUE;
+}
+
+static gint
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
{
GdkTimeCoord *coords;
@@ -338,6 +347,8 @@ main (int argc, char *argv[])
(GtkSignalFunc) motion_notify_event, NULL);
gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
(GtkSignalFunc) button_press_event, NULL);
+ gtk_signal_connect (GTK_OBJECT (drawing_area), "key_press_event",
+ (GtkSignalFunc) key_press_event, NULL);
gtk_signal_connect (GTK_OBJECT (drawing_area), "leave_notify_event",
(GtkSignalFunc) leave_notify_event, NULL);
@@ -347,6 +358,7 @@ main (int argc, char *argv[])
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
+ | GDK_KEY_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK
| GDK_PROXIMITY_OUT_MASK);
@@ -355,6 +367,8 @@ main (int argc, char *argv[])
events for the drawing area */
gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_ALL);
+ gtk_widget_grab_focus (drawing_area);
+
/* .. And create some buttons */
button = gtk_button_new_with_label ("Input Dialog");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
diff --git a/gtk/testselection.c b/gtk/testselection.c
index 0a1fd87f49..6f33be989d 100644
--- a/gtk/testselection.c
+++ b/gtk/testselection.c
@@ -319,6 +319,7 @@ selection_received (GtkWidget *widget, GtkSelectionData *data)
name?name:"<unknown>",
data->type);
position = data->length;
+ continue;
}
}
gtk_text_insert (GTK_TEXT (selection_text), NULL,
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 1a54d439f7..a1d5545dfe 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -2763,6 +2763,194 @@ create_gamma_curve ()
++count;
}
+static int scroll_test_pos = 0.0;
+static GdkGC *scroll_test_gc = NULL;
+
+static gint
+scroll_test_expose (GtkWidget *widget, GdkEventExpose *event,
+ GtkAdjustment *adj)
+{
+ gint i,j;
+ gint imin, imax, jmin, jmax;
+
+ imin = (event->area.x) / 10;
+ imax = (event->area.x + event->area.width + 9) / 10;
+
+ jmin = ((int)adj->value + event->area.y) / 10;
+ jmax = ((int)adj->value + event->area.y + event->area.height + 9) / 10;
+
+ gdk_window_clear_area (widget->window,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height);
+
+ for (i=imin; i<imax; i++)
+ for (j=jmin; j<jmax; j++)
+ if ((i+j) % 2)
+ gdk_draw_rectangle (widget->window,
+ widget->style->black_gc,
+ TRUE,
+ 10*i, 10*j - (int)adj->value, 1+i%10, 1+j%10);
+
+ return TRUE;
+}
+
+static void
+scroll_test_configure (GtkWidget *widget, GdkEventConfigure *event,
+ GtkAdjustment *adj)
+{
+ adj->page_increment = 0.9 * widget->allocation.height;
+ adj->page_size = widget->allocation.height;
+
+ gtk_signal_emit_by_name (GTK_OBJECT (adj), "changed");
+}
+
+static void
+scroll_test_adjustment_changed (GtkAdjustment *adj, GtkWidget *widget)
+{
+ gint source_min = (int)adj->value - scroll_test_pos;
+ gint source_max = source_min + widget->allocation.height;
+ gint dest_min = 0;
+ gint dest_max = widget->allocation.height;
+ GdkRectangle rect;
+ GdkEvent *event;
+
+ scroll_test_pos = adj->value;
+
+ if (!GTK_WIDGET_DRAWABLE (widget))
+ return;
+
+ if (source_min < 0)
+ {
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = widget->allocation.width;
+ rect.height = -source_min;
+ if (rect.height > widget->allocation.height)
+ rect.height = widget->allocation.height;
+
+ source_min = 0;
+ dest_min = rect.height;
+ }
+ else
+ {
+ rect.x = 0;
+ rect.y = 2*widget->allocation.height - source_max;
+ if (rect.y < 0)
+ rect.y = 0;
+ rect.width = widget->allocation.width;
+ rect.height = widget->allocation.height - rect.y;
+
+ source_max = widget->allocation.height;
+ dest_max = rect.y;
+ }
+
+ if (source_min != source_max)
+ {
+ if (scroll_test_gc == NULL)
+ {
+ scroll_test_gc = gdk_gc_new (widget->window);
+ gdk_gc_set_exposures (scroll_test_gc, TRUE);
+ }
+
+ gdk_draw_pixmap (widget->window,
+ scroll_test_gc,
+ widget->window,
+ 0, source_min,
+ 0, dest_min,
+ widget->allocation.width,
+ source_max - source_min);
+
+ /* Make sure graphics expose events are processed before scrolling
+ * again */
+
+ while ((event = gdk_event_get_graphics_expose (widget->window)) != NULL)
+ {
+ gtk_widget_event (widget, event);
+ if (event->expose.count == 0)
+ {
+ gdk_event_free (event);
+ break;
+ }
+ gdk_event_free (event);
+ }
+ }
+
+
+ if (rect.height != 0)
+ gtk_widget_draw (widget, &rect);
+}
+
+
+void
+create_scroll_test ()
+{
+ static GtkWidget *window = NULL;
+ GtkWidget *hbox;
+ GtkWidget *drawing_area;
+ GtkWidget *scrollbar;
+ GtkWidget *button;
+ GtkAdjustment *adj;
+
+ if (!window)
+ {
+ window = gtk_dialog_new ();
+
+ gtk_signal_connect (GTK_OBJECT (window), "destroy",
+ GTK_SIGNAL_FUNC(destroy_window),
+ &window);
+ gtk_signal_connect (GTK_OBJECT (window), "delete_event",
+ GTK_SIGNAL_FUNC(destroy_window),
+ &window);
+
+ gtk_window_set_title (GTK_WINDOW (window), "Scroll Test");
+ gtk_container_border_width (GTK_CONTAINER (window), 0);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox), hbox,
+ TRUE, TRUE, 0);
+ gtk_widget_show (hbox);
+
+ drawing_area = gtk_drawing_area_new ();
+ gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
+ gtk_box_pack_start (GTK_BOX (hbox), drawing_area, TRUE, TRUE, 0);
+ gtk_widget_show (drawing_area);
+
+ gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK);
+
+ adj = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 1000.0, 1.0, 180.0, 200.0));
+ scroll_test_pos = 0.0;
+
+ scrollbar = gtk_vscrollbar_new (adj);
+ gtk_box_pack_start (GTK_BOX (hbox), scrollbar, FALSE, FALSE, 0);
+ gtk_widget_show (scrollbar);
+
+ gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
+ GTK_SIGNAL_FUNC (scroll_test_expose), adj);
+ gtk_signal_connect (GTK_OBJECT (drawing_area), "configure_event",
+ GTK_SIGNAL_FUNC (scroll_test_configure), adj);
+
+
+ gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
+ GTK_SIGNAL_FUNC (scroll_test_adjustment_changed),
+ drawing_area);
+
+ /* .. And create some buttons */
+
+ button = gtk_button_new_with_label ("Quit");
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
+ button, TRUE, TRUE, 0);
+
+ gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (window));
+ gtk_widget_show (button);
+ }
+
+ if (!GTK_WIDGET_VISIBLE (window))
+ gtk_widget_show (window);
+ else
+ gtk_widget_destroy (window);
+}
/*
* Timeout Test
@@ -3069,6 +3257,7 @@ create_main_window ()
{ "preview color", create_color_preview },
{ "preview gray", create_gray_preview },
{ "gamma curve", create_gamma_curve },
+ { "test scrolling", create_scroll_test },
{ "test selection", create_selection_test },
{ "test timeout", create_timeout_test },
{ "test idle", create_idle_test },
diff --git a/tests/testinput.c b/tests/testinput.c
index 1c6dae0e1d..218e5ca769 100644
--- a/tests/testinput.c
+++ b/tests/testinput.c
@@ -96,9 +96,7 @@ static gint
configure_event (GtkWidget *widget, GdkEventConfigure *event)
{
if (pixmap)
- {
- gdk_pixmap_destroy(pixmap);
- }
+ gdk_pixmap_unref (pixmap);
pixmap = gdk_pixmap_new(widget->window,
widget->allocation.width,
widget->allocation.height,
@@ -187,6 +185,17 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
}
static gint
+key_press_event (GtkWidget *widget, GdkEventKey *event)
+{
+ if ((event->keyval >= 0x20) && (event->keyval <= 0xFF))
+ printf("I got a %c\n", event->keyval);
+ else
+ printf("I got some other key\n");
+
+ return TRUE;
+}
+
+static gint
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
{
GdkTimeCoord *coords;
@@ -338,6 +347,8 @@ main (int argc, char *argv[])
(GtkSignalFunc) motion_notify_event, NULL);
gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
(GtkSignalFunc) button_press_event, NULL);
+ gtk_signal_connect (GTK_OBJECT (drawing_area), "key_press_event",
+ (GtkSignalFunc) key_press_event, NULL);
gtk_signal_connect (GTK_OBJECT (drawing_area), "leave_notify_event",
(GtkSignalFunc) leave_notify_event, NULL);
@@ -347,6 +358,7 @@ main (int argc, char *argv[])
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
| GDK_LEAVE_NOTIFY_MASK
| GDK_BUTTON_PRESS_MASK
+ | GDK_KEY_PRESS_MASK
| GDK_POINTER_MOTION_MASK
| GDK_POINTER_MOTION_HINT_MASK
| GDK_PROXIMITY_OUT_MASK);
@@ -355,6 +367,8 @@ main (int argc, char *argv[])
events for the drawing area */
gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_ALL);
+ gtk_widget_grab_focus (drawing_area);
+
/* .. And create some buttons */
button = gtk_button_new_with_label ("Input Dialog");
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
diff --git a/tests/testselection.c b/tests/testselection.c
index 0a1fd87f49..6f33be989d 100644
--- a/tests/testselection.c
+++ b/tests/testselection.c
@@ -319,6 +319,7 @@ selection_received (GtkWidget *widget, GtkSelectionData *data)
name?name:"<unknown>",
data->type);
position = data->length;
+ continue;
}
}
gtk_text_insert (GTK_TEXT (selection_text), NULL,