Compare commits
85 Commits
test-conte
...
themes-2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
093032a4c1 | ||
|
|
4b0e615fc5 | ||
|
|
97d42326ac | ||
|
|
0a5b61a4da | ||
|
|
33dc032aa2 | ||
|
|
f1bad6c4fe | ||
|
|
f310b7625e | ||
|
|
452eddb0e9 | ||
|
|
7733977e00 | ||
|
|
15431456d0 | ||
|
|
960e195d6c | ||
|
|
78d7b416bf | ||
|
|
bd10681b95 | ||
|
|
a2eed4c206 | ||
|
|
137cb68380 | ||
|
|
1995cdf3ff | ||
|
|
f88651ba08 | ||
|
|
6114b7943a | ||
|
|
bcdb4d3368 | ||
|
|
7a78b7fcc8 | ||
|
|
347d0bf76a | ||
|
|
b20db730ea | ||
|
|
55f17ae647 | ||
|
|
46bc8c89a6 | ||
|
|
1c20239548 | ||
|
|
bf9d172707 | ||
|
|
18f4510ef7 | ||
|
|
ec576b8f55 | ||
|
|
8aa4520763 | ||
|
|
32139f5020 | ||
|
|
e9c260180c | ||
|
|
9d4587fc54 | ||
|
|
6014dbc289 | ||
|
|
fb3d48b7b9 | ||
|
|
283cc5a0ce | ||
|
|
b6449d3dce | ||
|
|
d213168f12 | ||
|
|
69746cb4d5 | ||
|
|
dfccba3826 | ||
|
|
4d24cab4f9 | ||
|
|
b3f01550bc | ||
|
|
4ccce42527 | ||
|
|
7839d25a17 | ||
|
|
2b547db814 | ||
|
|
375eea1317 | ||
|
|
82765c7aa4 | ||
|
|
66bbad7838 | ||
|
|
6c29fb342b | ||
|
|
4d675735b0 | ||
|
|
d9e68d7ac3 | ||
|
|
f54298e6dc | ||
|
|
2660911fd7 | ||
|
|
d7022170c7 | ||
|
|
ec42a2fd24 | ||
|
|
2d4bb49ed2 | ||
|
|
13e1213e9a | ||
|
|
89f7a5a848 | ||
|
|
b163129911 | ||
|
|
976849f090 | ||
|
|
e1722f3d15 | ||
|
|
a1a5ef5800 | ||
|
|
8654cf632e | ||
|
|
607f7ddde9 | ||
|
|
257ef68381 | ||
|
|
798e25b6f7 | ||
|
|
8f3e4424bf | ||
|
|
f22d8e2248 | ||
|
|
ea278eb5bb | ||
|
|
bef62ec152 | ||
|
|
38c30244bb | ||
|
|
e439315d93 | ||
|
|
1b1aa9d98d | ||
|
|
70b7979df8 | ||
|
|
ac4aaf0def | ||
|
|
8461f6e3eb | ||
|
|
798d7ca2da | ||
|
|
8fc624c81b | ||
|
|
513de4171a | ||
|
|
842d668599 | ||
|
|
79ba0b2aed | ||
|
|
d0f68a5c1f | ||
|
|
b01d52b537 | ||
|
|
78a42b742e | ||
|
|
742c12580d | ||
|
|
b6c34a8190 |
@@ -10,4 +10,3 @@ aclocal.m4
|
||||
configure
|
||||
gtk-config
|
||||
config.cache
|
||||
|
||||
|
||||
1
AUTHORS
1
AUTHORS
@@ -14,6 +14,7 @@ Lars Hamann <lars@gtk.org>
|
||||
Tim Janik <timj@gtk.org>
|
||||
Stefan Jeske <stefan@gtk.org>
|
||||
Elliot Lee <sopwith@gtk.org>
|
||||
Raph Levien <raph@gtk.org>
|
||||
Ian Main <imain@gtk.org>
|
||||
Fedrerico Mena <quartic@gtk.org>
|
||||
Paolo Molaro <lupus@lettere.unipd.it>
|
||||
|
||||
2044
ChangeLog.pre-2-0
2044
ChangeLog.pre-2-0
File diff suppressed because it is too large
Load Diff
2044
ChangeLog.pre-2-10
2044
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
2044
ChangeLog.pre-2-2
2044
ChangeLog.pre-2-2
File diff suppressed because it is too large
Load Diff
2044
ChangeLog.pre-2-4
2044
ChangeLog.pre-2-4
File diff suppressed because it is too large
Load Diff
2044
ChangeLog.pre-2-6
2044
ChangeLog.pre-2-6
File diff suppressed because it is too large
Load Diff
2044
ChangeLog.pre-2-8
2044
ChangeLog.pre-2-8
File diff suppressed because it is too large
Load Diff
21
HACKING
21
HACKING
@@ -4,26 +4,30 @@ to have the following packages installed:
|
||||
- GNU autoconf 2.12
|
||||
- GNU automake 1.3
|
||||
(Beta releases are at ftp://ftp.cygnus.com/pub/tromey)
|
||||
- GNU libtool 1.2
|
||||
- GNU libtool 1.2b
|
||||
- indent (GNU indent 1.9.1 is known good)
|
||||
|
||||
These should be available by ftp from ftp.gnu.org or any of the
|
||||
fine GNU mirrors. Beta software can be found at alpha.gnu.org.
|
||||
|
||||
If you are accessing gtk+ via CVS, then you will need to take several
|
||||
steps to get it to compile. You can do all these steps at once
|
||||
by running:
|
||||
In order to get CVS gtk+ installed on your system, you need to have
|
||||
the most recent CVS version of glib installed as well.
|
||||
The installation process of glib is similar to that of gtk+, but
|
||||
needs to be fulfilled prior to installation of gtk+.
|
||||
|
||||
To compile a CVS version of gtk+ on your system, you will need to take
|
||||
several steps to setup the tree for compilation. You can do all these
|
||||
steps at once by running:
|
||||
|
||||
cvsroot/gtk+# ./autogen.sh
|
||||
|
||||
Basically this does the following for you:
|
||||
|
||||
cvsroot/gtk+# aclocal; automake; autoconf
|
||||
cvsroot/gtk+/glib# aclocal; automake; autoconf
|
||||
|
||||
The above commands create the "configure" script. Now you
|
||||
can run the configure script in cvsroot/gtk+ to create all
|
||||
the Makefiles. You only need to call "configure" in cvsroot/gtk+
|
||||
as the one in glib will be invoked automatically.
|
||||
the Makefiles.
|
||||
|
||||
Before running autogen.sh or configure, make sure you have libtool
|
||||
in your path.
|
||||
@@ -33,11 +37,12 @@ options like --prefix=/usr to configure you can give those options
|
||||
to autogen.sh and they will be passed on to configure.
|
||||
|
||||
If at all possible, please use CVS to get the latest development version of
|
||||
gtk+. You can do the following to get gtk+ from cvs:
|
||||
gtk+ and glib. You can do the following to get glib and gtk+ from cvs:
|
||||
|
||||
$ export CVSROOT=':pserver:anonymous@cvs.gimp.org:/debian/home/gnomecvs'
|
||||
$ cvs login
|
||||
(there is no password, just hit return)
|
||||
$ cvs -z9 checkout glib
|
||||
$ cvs -z9 checkout gtk+
|
||||
|
||||
Please submit patches to the gtk-list@redhat.com mailing list (you must
|
||||
|
||||
6
INSTALL
6
INSTALL
@@ -7,8 +7,8 @@ you got this package.
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-1.1.0.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.1.0 # change to the toplevel directory
|
||||
% gzip -cd gtk+-1.1.3.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.1.3 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
@@ -92,7 +92,7 @@ You can compile GTK+ against a copy of GLIB that you have not
|
||||
yet installed. To do this, give the --with-glib=DIR options
|
||||
to ./configure. For instance:
|
||||
|
||||
./configure --with-glib=../glib-1.1.0
|
||||
./configure --with-glib=../glib-1.1.4
|
||||
|
||||
This, however, will not work if you built GLIB with different
|
||||
source and build directories.
|
||||
|
||||
@@ -13,6 +13,7 @@ EXTRA_DIST = \
|
||||
TODO \
|
||||
NEWS.pre-1-0 \
|
||||
ChangeLog.pre-1-0 \
|
||||
README.cvs-commits \
|
||||
examples/README.1ST \
|
||||
examples/extract.awk \
|
||||
examples/extract.sh \
|
||||
|
||||
501
Makefile.in
501
Makefile.in
@@ -1,501 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
GTK_MAJOR_VERSION = @GTK_MAJOR_VERSION@
|
||||
GTK_MICRO_VERSION = @GTK_MICRO_VERSION@
|
||||
GTK_MINOR_VERSION = @GTK_MINOR_VERSION@
|
||||
GTK_VERSION = @GTK_VERSION@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LT_AGE = @LT_AGE@
|
||||
LT_CURRENT = @LT_CURRENT@
|
||||
LT_RELEASE = @LT_RELEASE@
|
||||
LT_REVISION = @LT_REVISION@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
x_cflags = @x_cflags@
|
||||
x_includes = @x_includes@
|
||||
x_ldflags = @x_ldflags@
|
||||
x_libs = @x_libs@
|
||||
xinput_progs = @xinput_progs@
|
||||
|
||||
SRC_SUBDIRS = glib gdk gtk
|
||||
SUBDIRS = $(SRC_SUBDIRS) docs
|
||||
|
||||
bin_SCRIPTS = gtk-config
|
||||
|
||||
EXTRA_DIST = \
|
||||
gtk+.spec \
|
||||
gtk.m4 \
|
||||
makecopyright \
|
||||
TODO \
|
||||
NEWS.pre-1-0 \
|
||||
ChangeLog.pre-1-0 \
|
||||
examples/aspectframe/Makefile \
|
||||
examples/aspectframe/aspectframe.c \
|
||||
examples/buttons/Makefile \
|
||||
examples/buttons/buttons.c \
|
||||
examples/buttons/info.xpm \
|
||||
examples/entry/Makefile \
|
||||
examples/entry/entry.c \
|
||||
examples/eventbox/Makefile \
|
||||
examples/eventbox/eventbox.c \
|
||||
examples/filesel/Makefile \
|
||||
examples/filesel/filesel.c \
|
||||
examples/gtkdial/Makefile \
|
||||
examples/gtkdial/dial_test.c \
|
||||
examples/gtkdial/gtkdial.c \
|
||||
examples/gtkdial/gtkdial.h \
|
||||
examples/helloworld/Makefile \
|
||||
examples/helloworld/helloworld.c \
|
||||
examples/helloworld2/Makefile \
|
||||
examples/helloworld2/helloworld2.c \
|
||||
examples/list/Makefile \
|
||||
examples/list/list.c \
|
||||
examples/menu/Makefile \
|
||||
examples/menu/menu.c \
|
||||
examples/menu/menufactory.c \
|
||||
examples/menu/menufactory.h \
|
||||
examples/menu/mfmain.c \
|
||||
examples/menu/mfmain.h \
|
||||
examples/notebook/Makefile \
|
||||
examples/notebook/notebook.c \
|
||||
examples/packbox/Makefile \
|
||||
examples/packbox/packbox.c \
|
||||
examples/paned/Makefile \
|
||||
examples/paned/paned.c \
|
||||
examples/pixmap/Makefile \
|
||||
examples/pixmap/pixmap.c \
|
||||
examples/progressbar/Makefile \
|
||||
examples/progressbar/progressbar.c \
|
||||
examples/radiobuttons/Makefile \
|
||||
examples/radiobuttons/radiobuttons.c \
|
||||
examples/rulers/Makefile \
|
||||
examples/rulers/rulers.c \
|
||||
examples/scribble-simple/Makefile \
|
||||
examples/scribble-simple/scribble-simple.c \
|
||||
examples/scrolledwin/Makefile \
|
||||
examples/scrolledwin/scrolledwin.c \
|
||||
examples/selection/Makefile \
|
||||
examples/selection/gettargets.c \
|
||||
examples/selection/setselection.c \
|
||||
examples/statusbar/Makefile \
|
||||
examples/statusbar/statusbar.c \
|
||||
examples/table/Makefile \
|
||||
examples/table/table.c \
|
||||
examples/tictactoe/Makefile \
|
||||
examples/tictactoe/tictactoe.c \
|
||||
examples/tictactoe/tictactoe.h \
|
||||
examples/tictactoe/ttt_test.c \
|
||||
examples/wheelbarrow/Makefile \
|
||||
examples/wheelbarrow/wheelbarrow.c \
|
||||
examples/find-examples.sh
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = gtk.m4
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = gtk-config
|
||||
SCRIPTS = $(bin_SCRIPTS)
|
||||
|
||||
DATA = $(m4data_DATA)
|
||||
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS TODO acconfig.h aclocal.m4 config.guess config.h.in \
|
||||
config.sub configure configure.in gtk-config.in install-sh ltconfig \
|
||||
ltmain.sh missing mkinstalldirs stamp-h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: all-recursive-am all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): @MAINT@ configure.in
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: @MAINT@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
config.h: stamp-h
|
||||
@:
|
||||
stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES= CONFIG_HEADERS=config.h \
|
||||
$(SHELL) ./config.status
|
||||
@echo timestamp > stamp-h
|
||||
$(srcdir)/config.h.in: @MAINT@$(srcdir)/stamp-h.in
|
||||
$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
|
||||
cd $(top_srcdir) && $(AUTOHEADER)
|
||||
@echo timestamp > $(srcdir)/stamp-h.in
|
||||
|
||||
mostlyclean-hdr:
|
||||
|
||||
clean-hdr:
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h
|
||||
|
||||
maintainer-clean-hdr:
|
||||
gtk-config: $(top_builddir)/config.status gtk-config.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
|
||||
|
||||
install-binSCRIPTS: $(bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
@list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
else :; fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(bin_SCRIPTS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||
done
|
||||
|
||||
install-m4dataDATA: $(m4data_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(m4datadir)
|
||||
@list='$(m4data_DATA)'; for p in $$list; do \
|
||||
if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4datadir)/$$p"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(m4datadir)/$$p; \
|
||||
else if test -f $$p; then \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(m4datadir)/$$p"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(m4datadir)/$$p; \
|
||||
fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-m4dataDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(m4data_DATA)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(m4datadir)/$$p; \
|
||||
done
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
(cd $$subdir && $(MAKE) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
&& $(MAKE) install \
|
||||
&& $(MAKE) installcheck \
|
||||
&& $(MAKE) dist
|
||||
-rm -rf $(distdir)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
|
||||
$(mkinstalldirs) $(distdir)/examples $(distdir)/examples/aspectframe \
|
||||
$(distdir)/examples/buttons $(distdir)/examples/entry \
|
||||
$(distdir)/examples/eventbox $(distdir)/examples/filesel \
|
||||
$(distdir)/examples/gtkdial $(distdir)/examples/helloworld \
|
||||
$(distdir)/examples/helloworld2 $(distdir)/examples/list \
|
||||
$(distdir)/examples/menu $(distdir)/examples/notebook \
|
||||
$(distdir)/examples/packbox $(distdir)/examples/paned \
|
||||
$(distdir)/examples/pixmap $(distdir)/examples/progressbar \
|
||||
$(distdir)/examples/radiobuttons $(distdir)/examples/rulers \
|
||||
$(distdir)/examples/scribble-simple \
|
||||
$(distdir)/examples/scrolledwin \
|
||||
$(distdir)/examples/selection $(distdir)/examples/statusbar \
|
||||
$(distdir)/examples/table $(distdir)/examples/tictactoe \
|
||||
$(distdir)/examples/wheelbarrow
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
info: info-recursive
|
||||
dvi: dvi-recursive
|
||||
check: all-am
|
||||
$(MAKE) check-recursive
|
||||
installcheck: installcheck-recursive
|
||||
all-recursive-am: config.h
|
||||
$(MAKE) all-recursive
|
||||
|
||||
all-am: Makefile $(SCRIPTS) $(DATA) config.h
|
||||
|
||||
install-exec-am: install-binSCRIPTS
|
||||
|
||||
install-data-am: install-m4dataDATA
|
||||
|
||||
uninstall-am: uninstall-binSCRIPTS uninstall-m4dataDATA
|
||||
|
||||
install-exec: install-exec-recursive install-exec-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive install-data-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive install-exec-am install-data-am
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive uninstall-am
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
$(mkinstalldirs) $(DATADIR)$(bindir) $(DATADIR)$(m4datadir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-hdr mostlyclean-tags mostlyclean-generic
|
||||
|
||||
clean-am: clean-hdr clean-tags clean-generic mostlyclean-am
|
||||
|
||||
distclean-am: distclean-hdr distclean-tags distclean-generic clean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-hdr maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
|
||||
mostlyclean: mostlyclean-recursive mostlyclean-am
|
||||
|
||||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
|
||||
uninstall-binSCRIPTS install-binSCRIPTS uninstall-m4dataDATA \
|
||||
install-m4dataDATA install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck all-recursive-am all-am install-exec-am install-data-am \
|
||||
uninstall-am install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
.PHONY: files populate checkin release
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
@for subdir in $(SUBDIRS); do \
|
||||
files=`cd $$subdir; $(MAKE) files | grep -v "make\[[1-9]\]"`; \
|
||||
for file in $$files; do \
|
||||
echo $$subdir/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
populate:
|
||||
@echo "populating project"
|
||||
@files=`$(MAKE) files | grep -v "make\[[1-9]\]"`; prcs populate -d gtk+.prj $$files
|
||||
|
||||
checkin: populate
|
||||
@echo "checking in project"
|
||||
@prcs checkin
|
||||
|
||||
release:
|
||||
$(MAKE) dist distdir=$(PACKAGE)`date +"%y%m%d"`
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
47
NEWS
47
NEWS
@@ -1,3 +1,50 @@
|
||||
What is new in GTK+ 1.1.2:
|
||||
|
||||
* Gtk+ is now featuring runtime loading of dynamic modules via the
|
||||
--gtk-modules= command line switch. such modules have to export a
|
||||
G_MODULE_EXPORT void gtk_module_init (gint *argc, gchar ***argv);
|
||||
function which will be invoked to initialize the module. since such
|
||||
modules may create new widget types, they are always resident.
|
||||
* The tutorial has been updated again.
|
||||
* Changes to menus including tearoff menus and accelerators.
|
||||
* Better support for modal dialogs.
|
||||
* Removed CAN_FOCUS by default from scrollbars and button children of toolbar.
|
||||
* More improvements and fixes for GtkCList and GtkCTree (i.e. row sorting).
|
||||
* GtkCTree rows can be unselectable now.
|
||||
* The GtkCTree API has undergone major renames (see ChangeLog entry from Lars
|
||||
Hamann on Tue Aug 18 00:29:13 1998).
|
||||
* A bunch of varargs functions changed to get va_lists working on systems that
|
||||
implement va_lists as arrays.
|
||||
* Improvements to the gdkrgb code.
|
||||
* Improvements to Gdk color handling so we greatly reduce server traffic and
|
||||
don't leak colors anymore.
|
||||
* Improved internal widget tree iterators (the GtkContainer::foreach signal
|
||||
vanished because of this).
|
||||
* Option menus can have the keyboard focus now.
|
||||
* More fixups to the text widget.
|
||||
* GtkFileSelection should behave much more nicely in combination with AFS now.
|
||||
* Support for label underlining.
|
||||
* Support for GLib 1.1.3 log domains.
|
||||
* Documentation improvements.
|
||||
* Configuration fixes on various platforms.
|
||||
* Miscellaneous fixes to XInput support.
|
||||
* Build with shared library dependencies on Linux
|
||||
* Fix for a major bug in the type systems memory allocation code that could
|
||||
cause random crashes.
|
||||
* Libtool update to version 1.2b.
|
||||
* Lots of bugfixes and cleanups again ;)
|
||||
|
||||
|
||||
What is new in GTK+ 1.1.1:
|
||||
|
||||
* Tutorial updates and additions.
|
||||
* Key binding support for GtkListItems and GtkList.
|
||||
* Extended selection mode and autoscrolling for GtkLists.
|
||||
* A GtkCtree now operates on GtkCTreeNode* structures rather than GList*.
|
||||
* GtkCTreeNodes can now be created from GNode trees.
|
||||
* Bug fixes for GtkNotebook, GtkCList, GtkCombo and GdkWindow reparentation.
|
||||
|
||||
|
||||
What is new in GTK+ 1.1.0:
|
||||
|
||||
* New widget GtkFontSelector.
|
||||
|
||||
2
README
2
README
@@ -1,7 +1,7 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 1.1.0. GTK+, which stands for the Gimp ToolKit,
|
||||
This is GTK+ version 1.1.2. GTK+, which stands for the Gimp ToolKit,
|
||||
is a library for creating graphical user interfaces for the X Window
|
||||
System. It is designed to be small, efficient, and flexible. GTK+ is
|
||||
written in C with a very object-oriented approach.
|
||||
|
||||
52
README.cvs-commits
Normal file
52
README.cvs-commits
Normal file
@@ -0,0 +1,52 @@
|
||||
GTK+ is part of the GNOME CVS repository. At the current time, any
|
||||
person with write access to the GNOME repository, can make changes to
|
||||
GTK+. This is a good thing, in that it encourages many people to work
|
||||
on GTK+, and progress can be made quickly. However, GTK+ is a fairly
|
||||
large and complicated package that many other things depend on, so to
|
||||
avoid unnecessary breakage, and to take advantage of the knowledge
|
||||
about GTK+ that has been built up over the last 18 months, we'd like
|
||||
to ask people commiting to GTK+ to follow a few rules:
|
||||
|
||||
0) Ask first. If your changes are major, or could possibly break existing
|
||||
code, you should always ask. If your change is minor and you've
|
||||
been working on GTK+ for a while it probably isn't necessary
|
||||
to ask. But when in doubt, ask. Even if your change is correct,
|
||||
somebody may know a better way to do things.
|
||||
|
||||
If you are making changes to GTK+, you should be subscribed
|
||||
to gtk-devel-list@redhat.com. (Subscription address:
|
||||
gtk-devel-list-request@redhat.com.) This is a good place to ask
|
||||
about intended changes.
|
||||
|
||||
If you just want to make a trivial change, and don't want to subscribe,
|
||||
you can also mail gtk-bugs@gtk.org. Or, alternatively, you can look in
|
||||
the ChangeLog for somebody who has been making changes to the file
|
||||
you want to change and email them.
|
||||
|
||||
#gimp on byxnet (irc.gimp.org, irc2.gimp.org, irc3.gimp.org,
|
||||
irc.germany.gimp.org...)s also a good place to find GTK+ developers to
|
||||
discuss changes with, however, email to gtk-devel-list is the most
|
||||
certain and preferred method.
|
||||
|
||||
1) Ask _first_.
|
||||
|
||||
2) There must be a ChangeLog for every commit. (If you discover that
|
||||
you only committed half the files you meant to and need to fix that
|
||||
up, or something, you don't need a new ChangeLog entry. But in general,
|
||||
ChangeLog entries are mandatory.) Changes with out ChangeLog entries
|
||||
will be reverted.
|
||||
|
||||
3) There _must_ be a ChangeLog for every commit.
|
||||
|
||||
Notes:
|
||||
|
||||
* If you are going to be changing many files in an experimental fashion,
|
||||
it probably is a good idea to create a separate branch for your changes.
|
||||
|
||||
Owen Taylor
|
||||
13 Aug 1998
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
107
TODO
107
TODO
@@ -1,49 +1,22 @@
|
||||
For 1.1.0 release:
|
||||
|
||||
For 1.2.0 release:
|
||||
- remove deprecated functions from *.[hc] files, especially the
|
||||
non-functional ones.
|
||||
|
||||
Bugs:
|
||||
* Widget redrawing when the window resizes sometimes messes up.
|
||||
GtkLabels sometimes redraw without clearing up the underlying background on
|
||||
window resizes.
|
||||
|
||||
* delay dnd settings to take effect once a widget is realized, this is
|
||||
to avoid force realizations. i think this goes along with owens dnd
|
||||
changes?
|
||||
-timj
|
||||
The way DND data types are set in GtkWidget really needs to be fixed.
|
||||
This is pretty high on my priority list, and I'll get to it as soon as
|
||||
the column list widget is done. The correct way dnd data needs to be set
|
||||
is to have a additional keyed data type with GtkWidget, which is applied to
|
||||
the widget's window upon realize.
|
||||
There also needs to be a way to set dnd-data on widget windows which are
|
||||
not the main window (for widgets that create more than one window).
|
||||
-Jay Painter
|
||||
DnD seems to work for me, but yes, there needs to be some sort of
|
||||
gtk_widget layer that makes it easier... Also, adding support for drop
|
||||
zones might be nice.
|
||||
-Elliot
|
||||
This one is reproducabel for me:
|
||||
testgtk --sync
|
||||
popup colorselection
|
||||
drag/drop works
|
||||
start up preview color
|
||||
drag works but not dropping
|
||||
end preview color
|
||||
drag/drop works
|
||||
start up prewiev color
|
||||
segfault in malloc
|
||||
-timj
|
||||
|
||||
* Change bitfields to guints from enums, or vice versa?
|
||||
|
||||
* Expose events aren't being generated correctly for DND demo
|
||||
* MappingNotify events produce warnings.
|
||||
|
||||
* gtk_widget_set_uposition can't handle negative x,y coordinates!
|
||||
|
||||
* the type system (gtktypeutils.c) has to handle creations of fundamental
|
||||
types seperatedly from derived types, so we don't screw foreign
|
||||
fundamental types with an already extensively increased seqno.
|
||||
|
||||
* A filter function which destroys the GDK window it is filtering
|
||||
events on is bad news.
|
||||
|
||||
Additions:
|
||||
* implement keyboard navigation in menus
|
||||
|
||||
* focus handling for GtkOptionMenu (needs the previous)
|
||||
|
||||
* GScanner: it might be good to ues stdio and getch() instead of 1-character
|
||||
@@ -273,3 +246,63 @@ Text/Edit widget:
|
||||
[ From: Stefan Jeske <jeske@braunschweig.netsurf.de> ]
|
||||
|
||||
- "changed" emitted when doing deletes on empty Text widget.
|
||||
|
||||
- Delete IC in editable->unrealize, not editable->finalize?
|
||||
|
||||
Themes
|
||||
======
|
||||
|
||||
- When a scale gets shown/hidden only queue a redraw on the
|
||||
non-window portion, not the whole area.
|
||||
|
||||
- In various places, to avoid shaping windows excessively,
|
||||
we set parent relative backgrounds. This is an ugly
|
||||
hack and needs a better solution. Plus, I don't think
|
||||
these parent-relative backgrounds always persist to
|
||||
when they are actually needed.
|
||||
|
||||
Such calls exist in: GtkButton, GtkHandeBox, GtkItem,
|
||||
GtkListItem, GtkMenu, GtkMenuItem, GtkMisc,
|
||||
GtkNoteBook, GtkOptionMenu, GtkPaned, GtkPreview,
|
||||
GtkSpinButton and GtkTreeItem.
|
||||
|
||||
- For menus and for GtkWindow's, the realize() function
|
||||
calls paint(), so that background pixmaps can be set
|
||||
ahead of time, and prevent flashing when the window is
|
||||
shown. This is an ugly hack and needs a better solution.
|
||||
|
||||
=======
|
||||
|
||||
Calendar Widget:
|
||||
|
||||
- The widget should be nicely resizeable vertical too.
|
||||
|
||||
- CALENDAR_MARGIN should be removed, uses INNER_BORDER and
|
||||
style->class->[xy]thickness insted.
|
||||
|
||||
- Flag to choose between using standard three letter abbreviated
|
||||
weekday name or just the first character from it. It looks like
|
||||
that is what most other calendar-widgets do.
|
||||
|
||||
- Arrows should resize with the header-font.
|
||||
|
||||
- The keyboard support has to be finished.
|
||||
|
||||
DND
|
||||
===
|
||||
|
||||
- Use a cursor instead of an ICON when over Motif windows,
|
||||
to get rid of the current junk that Motif leaves because
|
||||
of it's XCopyArea stupidity for doing highlighting.
|
||||
|
||||
- Add a GTK_DRAG_VERIFY target flag and a "drag_data_verify"
|
||||
signal so that apps can easily check if a, say,
|
||||
text/uri-list URL looks OK during the drop.
|
||||
|
||||
- Check more for memory leaks.
|
||||
|
||||
- Drag and drop for Entry and Text widgets.
|
||||
|
||||
- Send synthetic motion events on structure changes so
|
||||
drag_enter/leave get sent properly. (See the popup
|
||||
in testdnd)
|
||||
|
||||
29
autogen.sh
29
autogen.sh
@@ -1,11 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
PROJECT=Gtk+
|
||||
TEST_TYPE=-d
|
||||
FILE=gdk
|
||||
|
||||
DIE=0
|
||||
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile GTK+."
|
||||
echo "You must have autoconf installed to compile $PROJECT."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
@@ -13,15 +17,15 @@ DIE=0
|
||||
|
||||
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile GTK+."
|
||||
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.0h.tar.gz"
|
||||
echo "You must have libtool installed to compile $PROJECT."
|
||||
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.2b.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to compile GTK+."
|
||||
echo "You must have automake installed to compile $PROJECT."
|
||||
echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
@@ -31,8 +35,8 @@ if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
test -d gtk || {
|
||||
echo "You must run this script in the top-level GTK+ directory"
|
||||
test $TEST_TYPE $FILE || {
|
||||
echo "You must run this script in the top-level $PROJECT directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -41,10 +45,19 @@ if test -z "$*"; then
|
||||
echo "to pass any to it, please specify them on the $0 command line."
|
||||
fi
|
||||
|
||||
case $CC in
|
||||
*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;;
|
||||
esac
|
||||
|
||||
aclocal $ACLOCAL_FLAGS
|
||||
automake
|
||||
|
||||
# optionally feature autoheader
|
||||
(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader
|
||||
|
||||
automake $am_opt
|
||||
autoconf
|
||||
|
||||
./configure "$@"
|
||||
|
||||
echo
|
||||
echo "Now type 'make' to compile GTK+."
|
||||
echo "Now type 'make' to compile $PROJECT."
|
||||
|
||||
13
config.guess
vendored
13
config.guess
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -478,10 +478,10 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo i386-pc-cygwin32
|
||||
echo ${UNAME_MACHINE}-pc-cygwin32
|
||||
exit 0 ;;
|
||||
i*:MINGW*:*)
|
||||
echo i386-pc-mingw32
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
@@ -493,6 +493,12 @@ EOF
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# uname on the ARM produces all sorts of strangeness, and we need to
|
||||
# filter it out.
|
||||
case "$UNAME_MACHINE" in
|
||||
arm* | sa110*) UNAME_MACHINE="arm" ;;
|
||||
esac
|
||||
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
@@ -506,6 +512,7 @@ EOF
|
||||
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
|
||||
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
|
||||
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
|
||||
esac
|
||||
|
||||
14
config.h.in
14
config.h.in
@@ -12,10 +12,6 @@
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if your processor stores words with the most significant
|
||||
byte first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#undef WORDS_BIGENDIAN
|
||||
|
||||
/* Define if the X Window System is missing or not being used. */
|
||||
#undef X_DISPLAY_MISSING
|
||||
|
||||
@@ -23,6 +19,7 @@
|
||||
#undef GTK_COMPILED_WITH_DEBUGGING
|
||||
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_LIBDL
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SHAPE_EXT
|
||||
@@ -49,8 +46,17 @@
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define if you have the broken_wctype function. */
|
||||
#undef HAVE_BROKEN_WCTYPE
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Define if you have the <wctype.h> header file. */
|
||||
#undef HAVE_WCTYPE_H
|
||||
|
||||
38
config.sub
vendored
38
config.sub
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
@@ -162,7 +162,7 @@ case $basic_machine in
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
i[3456]86)
|
||||
i[34567]86)
|
||||
basic_machine=$basic_machine-pc
|
||||
;;
|
||||
# Object if more than one company name word.
|
||||
@@ -171,7 +171,7 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[3456]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
@@ -350,19 +350,19 @@ case $basic_machine in
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[3456]86v32)
|
||||
i[34567]86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
;;
|
||||
i[3456]86v4*)
|
||||
i[34567]86v4*)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv4
|
||||
;;
|
||||
i[3456]86v)
|
||||
i[34567]86v)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv
|
||||
;;
|
||||
i[3456]86sol2)
|
||||
i[34567]86sol2)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
@@ -469,25 +469,23 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5)
|
||||
basic_machine=i586-intel
|
||||
pentium | p5 | k5 | nexen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6)
|
||||
basic_machine=i686-intel
|
||||
pentiumpro | p6 | k6 | 6x86)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentium-* | p5-*)
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | nexen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-*)
|
||||
pentiumpro-* | p6-* | k6-* | 6x86-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
k5)
|
||||
# We don't have specific support for AMD's K5 yet, so just call it a Pentium
|
||||
basic_machine=i586-amd
|
||||
;;
|
||||
nexen)
|
||||
# We don't have specific support for Nexgen yet, so just call it a Pentium
|
||||
basic_machine=i586-nexgen
|
||||
pentiumii-* | pentium2-*)
|
||||
basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pn)
|
||||
basic_machine=pn-gould
|
||||
|
||||
154
configure.in
154
configure.in
@@ -14,7 +14,7 @@ cflags_set=${CFLAGS+set}
|
||||
#
|
||||
GTK_MAJOR_VERSION=1
|
||||
GTK_MINOR_VERSION=1
|
||||
GTK_MICRO_VERSION=0
|
||||
GTK_MICRO_VERSION=3
|
||||
GTK_INTERFACE_AGE=0
|
||||
GTK_BINARY_AGE=0
|
||||
GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
|
||||
@@ -91,24 +91,49 @@ AM_PROG_CC_STDC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
changequote(,)dnl
|
||||
if test "x$GCC" = "xyes"; then
|
||||
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
fi
|
||||
case " $CFLAGS " in
|
||||
*[\ \ ]-Wall[\ \ ]*) ;;
|
||||
*) CFLAGS="$CFLAGS -Wall" ;;
|
||||
esac
|
||||
|
||||
if test "x$enable_ansi" = "xyes"; then
|
||||
if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -ansi"
|
||||
fi
|
||||
case " $CFLAGS " in
|
||||
*[\ \ ]-ansi[\ \ ]*) ;;
|
||||
*) CFLAGS="$CFLAGS -ansi" ;;
|
||||
esac
|
||||
|
||||
if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
|
||||
CFLAGS="$CFLAGS -pedantic"
|
||||
fi
|
||||
case " $CFLAGS " in
|
||||
*[\ \ ]-pedantic[\ \ ]*) ;;
|
||||
*) CFLAGS="$CFLAGS -pedantic" ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
changequote([,])dnl
|
||||
|
||||
AC_MSG_CHECKING([For extra flags to get ANSI library prototypes])
|
||||
gtk_save_LDFLAGS=$LDFLAGS
|
||||
# define a MAINT-like variable REBUILD which is set if Perl
|
||||
# and awk are found, so autogenerated sources can be rebuilt
|
||||
|
||||
AC_PROG_AWK
|
||||
AC_CHECK_PROGS(PERL, perl5 perl)
|
||||
|
||||
# We would like indent, but don't require it.
|
||||
AC_CHECK_PROG(INDENT, indent, indent)
|
||||
|
||||
REBUILD=\#
|
||||
if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
|
||||
if test -n "$AWK" ; then
|
||||
REBUILD=
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(REBUILD)
|
||||
|
||||
dnl The DU4 header files don't provide library prototypes unless
|
||||
dnl -std1 is given to the native cc.
|
||||
AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
|
||||
|
||||
gtk_save_LIBS=$LIBS
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([#include <math.h>
|
||||
int main (void) { return (log(1) != log(1.)); }],
|
||||
@@ -126,6 +151,18 @@ AC_TRY_RUN([#include <math.h>
|
||||
)
|
||||
LIBS=$gtk_save_LIBS
|
||||
|
||||
dnl NeXTStep cc seems to need this
|
||||
AC_MSG_CHECKING([for extra flags for POSIX compliance])
|
||||
AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
|
||||
AC_MSG_RESULT(none needed),
|
||||
gtk_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS -posix"
|
||||
AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
|
||||
AC_MSG_RESULT(-posix),
|
||||
AC_MSG_RESULT()
|
||||
CFLAGS=$gtk_save_CFLAGS
|
||||
AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
|
||||
|
||||
if test "x$enable_xim" = "xyes"; then
|
||||
CFLAGS="$CFLAGS -DUSE_XIM"
|
||||
fi
|
||||
@@ -138,27 +175,29 @@ fi
|
||||
if test x$with_glib = x ; then
|
||||
# Look for separately installed glib
|
||||
|
||||
AM_PATH_GLIB(1.1.0,,
|
||||
AM_PATH_GLIB(1.1.4,,
|
||||
AC_MSG_ERROR([
|
||||
*** GLIB 1.1.0 or better is required. The latest version of GLIB
|
||||
*** is always available from ftp://ftp.gtk.org.]))
|
||||
*** GLIB 1.1.4 or better is required. The latest version of GLIB
|
||||
*** is always available from ftp://ftp.gtk.org.]),
|
||||
gmodule)
|
||||
|
||||
glib_cflags=$GLIB_CFLAGS
|
||||
glib_libs=$GLIB_LIBS
|
||||
else
|
||||
# Use uninstalled glib (assume they got the version right)
|
||||
|
||||
if test -x $with_glib/glib-config ; then
|
||||
GLIB_CONFIG=$with_glib/glib-config
|
||||
if test -x $GLIB_CONFIG ; then
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
|
||||
fi
|
||||
|
||||
# For use in gtk-config
|
||||
glib_cflags=`$with_glib/glib-config --cflags`
|
||||
glib_libs=`$with_glib/glib-config --libs`
|
||||
glib_cflags=`$GLIB_CONFIG --cflags`
|
||||
glib_libs=`$GLIB_CONFIG --libs`
|
||||
|
||||
glib_release=`$with_glib/glib-config --version | sed 's%\\.[[0-9]]*$%%'`
|
||||
glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
|
||||
|
||||
# canonicalize relative paths
|
||||
case $with_glib in
|
||||
@@ -252,11 +291,19 @@ fi
|
||||
|
||||
# Threads
|
||||
|
||||
CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
|
||||
AC_CHECK_LIB(pthread, pthread_attr_init,
|
||||
AC_DEFINE(USE_PTHREADS)
|
||||
[AC_DEFINE(USE_PTHREADS)
|
||||
x_libs="$x_libs -lpthread"
|
||||
CFLAGS="$CFLAGS -D_REENTRANT")
|
||||
CFLAGS="$CFLAGS -D_REENTRANT"],
|
||||
# AIX has libpthreads, cause they're special. Special friends (TM)
|
||||
AC_CHECK_LIB(pthreads, pthread_attr_init,
|
||||
[AC_DEFINE(USE_PTHREADS)
|
||||
x_libs="$x_libs -lpthreads"
|
||||
CFLAGS="$CFLAGS -D_REENTRANT -D_THREAD_SAFE"]))
|
||||
fi
|
||||
|
||||
AC_SUBST(x_cflags)
|
||||
@@ -265,9 +312,6 @@ AC_SUBST(x_ldflags)
|
||||
AC_SUBST(x_libs)
|
||||
AC_SUBST(xinput_progs)
|
||||
|
||||
CFLAGS="$saved_cflags"
|
||||
LDFLAGS="$saved_ldflags"
|
||||
|
||||
if test "x$enable_shm" = "xyes"; then
|
||||
# Check for shared memory
|
||||
AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
|
||||
@@ -369,9 +413,6 @@ AC_HEADER_STDC
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
# Checks for endianness (needed by GdkRgb).
|
||||
AC_C_BIGENDIAN
|
||||
|
||||
# Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_MMAP
|
||||
@@ -393,6 +434,65 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
# Duplicate `widechar' tests from `glib'.
|
||||
# Check for wchar.h
|
||||
if test x = y; then
|
||||
# will not be executed
|
||||
# hack so as not to update `acconfig.h'
|
||||
AC_CHECK_HEADERS(wchar.h wctype.h)
|
||||
AC_CHECK_FUNCS(broken_wctype)
|
||||
fi
|
||||
|
||||
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_kludge=HAVE_WCHAR_H
|
||||
AC_DEFINE($ac_kludge)
|
||||
fi
|
||||
AC_MSG_RESULT($gtk_ok)
|
||||
|
||||
# Check for wctype.h (for iswalnum)
|
||||
|
||||
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_kludge=HAVE_WCTYPE_H
|
||||
AC_DEFINE($ac_kludge)
|
||||
fi
|
||||
AC_MSG_RESULT($gtk_ok)
|
||||
|
||||
# in Solaris 2.5, `iswalnum' is in -lw
|
||||
GDK_WLIBS=
|
||||
AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
|
||||
|
||||
# The following is necessary for Linux libc-5.4.38
|
||||
oLIBS="$LIBS"
|
||||
LIBS="$LIBS $GDK_WLIBS"
|
||||
AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
|
||||
AC_TRY_LINK([#include <stdlib.h>],[
|
||||
#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
|
||||
# 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
|
||||
iswalnum((wchar_t) 0);
|
||||
], gtk_ok=yes, gtk_ok=no)
|
||||
LIBS="$oLIBS"
|
||||
|
||||
if test $gtk_ok = no; then
|
||||
ac_kludge=HAVE_BROKEN_WCTYPE
|
||||
AC_DEFINE($ac_kludge)
|
||||
GDK_WLIBS=
|
||||
fi
|
||||
AC_MSG_RESULT($gtk_ok)
|
||||
AC_SUBST(GDK_WLIBS)
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
gtk-config
|
||||
|
||||
64
docs/Changes-1.2.txt
Normal file
64
docs/Changes-1.2.txt
Normal file
@@ -0,0 +1,64 @@
|
||||
Incompatible Changes from GTK+-1.0 to GTK+-1.2:
|
||||
|
||||
* GtkAcceleratorTable has been replaced with GtkAccelGroup
|
||||
|
||||
* GtkMenuFactory has been replaced with GtkItemFactory, although
|
||||
a version of GtkMenuFactory is provided to ease compatibility.
|
||||
|
||||
* GtkButton has been changed to derive from GtkBin.
|
||||
|
||||
To access a button's child, use GTK_BIN (button)->child, instead
|
||||
of the old GTK_BUTTON (button)->child.
|
||||
|
||||
* The selection API has been slightly modified:
|
||||
|
||||
gtk_selection_add_handler() and gtk_selection_add_handler_full()
|
||||
have been removed. To supply the selection, one now register
|
||||
the targets one is interested in with:
|
||||
|
||||
void gtk_selection_add_target (GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint info);
|
||||
|
||||
or:
|
||||
|
||||
void gtk_selection_add_targets (GtkWidget *widget,
|
||||
GdkAtom selection,
|
||||
GtkTargetEntry *targets,
|
||||
guint ntargets);
|
||||
|
||||
When a request for a selection is received, the new "selection_get"
|
||||
signal will be called:
|
||||
|
||||
void "selection_get" (GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time);
|
||||
|
||||
A "time" parameter has also been added to the "selection_received"
|
||||
signal.
|
||||
|
||||
void "selection_received" (GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
guint time);
|
||||
|
||||
* The old drag and drop API has been completely removed and replaced.
|
||||
See the reference documentation for details on the new API.
|
||||
|
||||
* Support for Themes has been added. In general, this does
|
||||
not affect application code, however, a few new rules should
|
||||
be observed:
|
||||
|
||||
- To set a shape for a window, you must use
|
||||
gtk_widget_shape_combine_mask() instead of
|
||||
gdk_window_shape_combine_mask(), or the shape will be
|
||||
reset when switching themes.
|
||||
|
||||
- It is no longer permissable to draw directly on an arbitrary
|
||||
widget, or to set an arbitrary widget's background pixmap.
|
||||
If you need to do that, use a GtkDrawingArea or (for a
|
||||
toplevel) the new GtkDrawWindow widget.
|
||||
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ EXTRA_DIST = \
|
||||
gtk-config.txt \
|
||||
gtk_tut.sgml \
|
||||
gtk_tut_it.sgml \
|
||||
gtk_tut_fr.sgml \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
|
||||
387
docs/Makefile.in
387
docs/Makefile.in
@@ -1,387 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
GTK_MAJOR_VERSION = @GTK_MAJOR_VERSION@
|
||||
GTK_MICRO_VERSION = @GTK_MICRO_VERSION@
|
||||
GTK_MINOR_VERSION = @GTK_MINOR_VERSION@
|
||||
GTK_VERSION = @GTK_VERSION@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LT_AGE = @LT_AGE@
|
||||
LT_CURRENT = @LT_CURRENT@
|
||||
LT_RELEASE = @LT_RELEASE@
|
||||
LT_REVISION = @LT_REVISION@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
x_cflags = @x_cflags@
|
||||
x_includes = @x_includes@
|
||||
x_ldflags = @x_ldflags@
|
||||
x_libs = @x_libs@
|
||||
xinput_progs = @xinput_progs@
|
||||
|
||||
info_TEXINFOS = gdk.texi gtk.texi glib.texi
|
||||
|
||||
man_MANS = gtk-config.1
|
||||
|
||||
EXTRA_DIST = \
|
||||
texinfo.tex \
|
||||
macros.texi \
|
||||
Makefile.sgml \
|
||||
gtkdocs_fix \
|
||||
gtkfaq.sgml \
|
||||
gtk-config.txt \
|
||||
gtk_tut.sgml \
|
||||
gtk_tut_it.sgml \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt \
|
||||
gtk_tut_packbox1.gif \
|
||||
gtk_tut_packbox2.gif \
|
||||
gtk_tut_table.gif \
|
||||
gtk-config.1
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
TEXI2DVI = texi2dvi
|
||||
TEXINFO_TEX = $(srcdir)/texinfo.tex
|
||||
INFO_DEPS = gdk.info gtk.info glib.info
|
||||
DVIS = gdk.dvi gtk.dvi glib.dvi
|
||||
TEXINFOS = gdk.texi gtk.texi glib.texi
|
||||
man1dir = $(mandir)/man1
|
||||
MANS = $(man_MANS)
|
||||
|
||||
NROFF = nroff
|
||||
DIST_COMMON = Makefile.am Makefile.in texinfo.tex
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: Makefile $(INFO_DEPS) $(MANS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
gdk.info: gdk.texi
|
||||
gdk.dvi: gdk.texi
|
||||
|
||||
|
||||
gtk.info: gtk.texi
|
||||
gtk.dvi: gtk.texi
|
||||
|
||||
|
||||
glib.info: glib.texi
|
||||
glib.dvi: glib.texi
|
||||
|
||||
|
||||
DVIPS = dvips
|
||||
|
||||
.texi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi.info:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
|
||||
.txi.dvi:
|
||||
TEXINPUTS=$(srcdir):$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi:
|
||||
@cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
cd $(srcdir) \
|
||||
&& $(MAKEINFO) `echo $< | sed 's,.*/,,'`
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
@for file in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
for file in $(INFO_DEPS); do \
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
uninstall-info:
|
||||
$(PRE_UNINSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
ii=yes; \
|
||||
else ii=; fi; \
|
||||
for file in $(INFO_DEPS); do \
|
||||
test -z "$ii" \
|
||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||
done
|
||||
@$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
for base in $(INFO_DEPS); do \
|
||||
d=$(srcdir); \
|
||||
for file in `cd $$d && eval echo $$base*`; do \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done; \
|
||||
done
|
||||
|
||||
mostlyclean-aminfo:
|
||||
-rm -f gdk.aux gdk.cp gdk.cps gdk.dvi gdk.fn gdk.fns gdk.ky gdk.kys \
|
||||
gdk.ps gdk.log gdk.pg gdk.toc gdk.tp gdk.tps gdk.vr gdk.vrs \
|
||||
gdk.op gdk.tr gdk.cv gdk.cn gtk.aux gtk.cp gtk.cps gtk.dvi \
|
||||
gtk.fn gtk.fns gtk.ky gtk.kys gtk.ps gtk.log gtk.pg gtk.toc \
|
||||
gtk.tp gtk.tps gtk.vr gtk.vrs gtk.op gtk.tr gtk.cv gtk.cn \
|
||||
glib.aux glib.cp glib.cps glib.dvi glib.fn glib.fns glib.ky \
|
||||
glib.kys glib.ps glib.log glib.pg glib.toc glib.tp glib.tps \
|
||||
glib.vr glib.vrs glib.op glib.tr glib.cv glib.cn
|
||||
|
||||
clean-aminfo:
|
||||
|
||||
distclean-aminfo:
|
||||
|
||||
maintainer-clean-aminfo:
|
||||
for i in $(INFO_DEPS); do \
|
||||
rm -f $$i; \
|
||||
if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \
|
||||
rm -f $$i-[0-9]*; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
install-man1:
|
||||
$(mkinstalldirs) $(DESTDIR)$(man1dir)
|
||||
@list='$(man1_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
||||
else file=$$i; fi; \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
$(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
|
||||
uninstall-man1:
|
||||
@list='$(man1_MANS)'; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do \
|
||||
case "$$i" in \
|
||||
*.1*) list="$$list $$i" ;; \
|
||||
esac; \
|
||||
done; \
|
||||
for i in $$list; do \
|
||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
||||
echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
|
||||
rm -f $(DESTDIR)$(man1dir)/$$inst; \
|
||||
done
|
||||
install-man: $(MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) install-man1
|
||||
uninstall-man:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
$(MAKE) uninstall-man1
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = docs
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu docs/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info: $(INFO_DEPS)
|
||||
dvi: $(DVIS)
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-info-am install-man
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-info uninstall-man
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(mandir)/man1
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-aminfo mostlyclean-generic
|
||||
|
||||
clean: clean-aminfo clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-aminfo distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-aminfo maintainer-clean-generic \
|
||||
distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo install-man1 \
|
||||
uninstall-man1 install-man uninstall-man tags distdir info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
210
docs/dnd_internals.txt
Normal file
210
docs/dnd_internals.txt
Normal file
@@ -0,0 +1,210 @@
|
||||
This document describes some of the internals of the DND handling
|
||||
code.
|
||||
|
||||
Organization
|
||||
============
|
||||
|
||||
The DND code is split between a lowlevel part - gdkdnd.c and a
|
||||
highlevel part - gtkdnd.c. To put it simply, gdkdnd.c contain the
|
||||
portions of DND code that are easiest to do in raw X, while gtkdnd.c
|
||||
contains the portions of DND that are easiest to do with an event loop
|
||||
and high level selection handling.
|
||||
|
||||
Except for a few details of selection handling, most of the
|
||||
dependencies on the DND protocol are confined to gdkdnd.c.
|
||||
There are two or three supported protocols - Motif DND,
|
||||
Xdnd and a pseudo-protocol ROOTWIN, which is used for drops
|
||||
on root windows that aren't really accepting drops.
|
||||
gdkdnd.c divides into 4 pieces:
|
||||
|
||||
1) Utility functions (finding client windows)
|
||||
2) Motif specific code (the biggest chunk)
|
||||
3) Xdnd specific code
|
||||
4) The public interfaces
|
||||
|
||||
The code in gtkdnd.c roughly consists of three parts
|
||||
|
||||
1) General utility functions
|
||||
2) Destination side code
|
||||
3) Source side code.
|
||||
|
||||
Both on the source and dest side, there is some division
|
||||
between the low level layers and the default handlers,
|
||||
though they are rather mixed in many cases.
|
||||
|
||||
Structures and Memory Management
|
||||
================================
|
||||
|
||||
Information about source sites and drop sites is stored
|
||||
in the structures GtkSourceSite and GtkDestSite.
|
||||
|
||||
Information about in-progress drags and drops is stored
|
||||
in the structures GtkSourceInfo and GtkDestInfo.
|
||||
|
||||
The GtkSourceInfo structure is created when the drag
|
||||
begins, and persists until the drag either completes
|
||||
or times out. A pointer to it is stored in
|
||||
dataset-data for the GdkDragContext, however there
|
||||
is no ownership. If the SourceInfo is destroyed
|
||||
before the context, the field is simply cleared.
|
||||
|
||||
A GtkDestInfo is attached to each GdkDragContext
|
||||
that is received for an incoming drag. In contrast
|
||||
to the SourceInfo the DestInfo is "owned" by the
|
||||
context, and when the context is destroyed, destroyed.
|
||||
|
||||
The GDK API
|
||||
===========
|
||||
|
||||
It is expect that the GDK DND API will never be
|
||||
used by anything other than the DND code in GTK+.
|
||||
|
||||
/* Drag and Drop */
|
||||
|
||||
GdkDragContext * gdk_drag_context_new (void);
|
||||
void gdk_drag_context_ref (GdkDragContext *context);
|
||||
void gdk_drag_context_unref (GdkDragContext *context);
|
||||
|
||||
These create and refcount GdkDragContexts in a
|
||||
straightforward manner.
|
||||
|
||||
/* Destination side */
|
||||
|
||||
void gdk_drag_status (GdkDragContext *context,
|
||||
GdkDragAction action,
|
||||
guint32 time);
|
||||
void gdk_drop_reply (GdkDragContext *context,
|
||||
gboolean ok,
|
||||
guint32 time);
|
||||
void gdk_drop_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time);
|
||||
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
|
||||
|
||||
/* Source side */
|
||||
|
||||
GdkDragContext * gdk_drag_begin (GdkWindow *window,
|
||||
GList *targets,
|
||||
GdkDragAction actions);
|
||||
gboolean gdk_drag_get_protocol (guint32 xid,
|
||||
GdkDragProtocol *protocol);
|
||||
void gdk_drag_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkWindow **dest_window,
|
||||
GdkDragProtocol *protocol);
|
||||
gboolean gdk_drag_motion (GdkDragContext *context,
|
||||
GdkWindow *dest_window,
|
||||
GdkDragProtocol protocol,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragAction action,
|
||||
guint32 time);
|
||||
void gdk_drag_drop (GdkDragContext *context,
|
||||
guint32 time);
|
||||
void gdk_drag_abort (GdkDragContext *context,
|
||||
guint32 time);
|
||||
|
||||
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
|
||||
|
||||
Retrieves the selection that will be used to communicate
|
||||
the data for the drag context (valid on both source
|
||||
and dest sides)
|
||||
|
||||
Cursors and window heirarchies
|
||||
==============================
|
||||
|
||||
The DND code, when possible (and it isn't possible over
|
||||
Motif window) uses a shaped window as a drag icon.
|
||||
Because the cursor may fall inside this window during the
|
||||
drag, we actually have to figure out which window
|
||||
the cursor is in _ourselves_ so we can ignore the
|
||||
drag icon properly. (Oh for OutputOnly windows!)
|
||||
|
||||
To avoid obscene amounts of server traffic (which are only
|
||||
slighly observerable locally, but would really kill a
|
||||
session over a slow link), the code in GDK does
|
||||
XGetWindowAttributes for every child of the root window at
|
||||
the beginning of the drag, then selects with
|
||||
SubstructureNotifyMask on the root window, so that
|
||||
it can update this list.
|
||||
|
||||
It probably would be easier to just reread the entire
|
||||
list when one of these events occurs, instead of
|
||||
incrementally updating, but updating the list in
|
||||
sync was sort of fun code, so I did it that way ;-)
|
||||
|
||||
There is also a problem of trying to follow the
|
||||
mouse cursor as well as possible. Currently, the
|
||||
code uses PointerMotionHint, and an XQueryPointer
|
||||
on MotionNotify events. This results in pretty
|
||||
good syncing, but may result in somewhat poor
|
||||
accuracy for drops. (Because the coordinates of
|
||||
the drop are the coordinates when the server receives
|
||||
the button press, which might actually be before
|
||||
the XQueryPointer for the previous MotionNotify
|
||||
event is done.)
|
||||
|
||||
Probably better is doing MotionNotify compression
|
||||
and discarding MotionNotify events when there
|
||||
are more on the queue before the next ButtonPress/Release.
|
||||
|
||||
Proxying
|
||||
========
|
||||
|
||||
A perhaps rather unusual feature of GTK's DND is proxying. A
|
||||
dest site can be specified as a proxy drop site for another
|
||||
window. This is most needed for the plug-socket code - the
|
||||
socket needs to pass on drags to the plug since the original
|
||||
source only sees toplevel windows. However, it can also be
|
||||
used as a user visible proxy - i.e., dragging to buttons on
|
||||
the taskbar.
|
||||
|
||||
Internally, when the outer drag enters a proxy dest site, a
|
||||
new source drag is created, with SourceInfo and
|
||||
GdkDragContext. From the GDK side, it looks much like a
|
||||
normal source drag; on the GTK+ side, most of the code is
|
||||
disjoint. The need to pass in a specific target window
|
||||
is the reason why the GDK DND API splits
|
||||
gdk_drag_find_window() and gdk_drag_motion().
|
||||
|
||||
For proxy drags, the GtkDestInfo and GtkSourceInfo for the
|
||||
drag point at each other.
|
||||
|
||||
Because the abstraction of the drag protocol is at the GDK
|
||||
level, a proxy drag from Motif to Xdnd or vice versa happens
|
||||
pretty much automatically during the drag, though the
|
||||
drop can get complicated. For Xdnd <-> Motif,
|
||||
Motif <-> Xdnd, or Motif <-> Motif drags, it is necessary to
|
||||
for the Proxy to retrieve the data and pass it on to
|
||||
the true destination, since either the selection names
|
||||
differ or (Motif<->Motif), the proxy needs to know
|
||||
about the XmDRAG_SUCCESS/FAILURE selection targets.
|
||||
|
||||
Further Reading:
|
||||
================
|
||||
|
||||
Xdnd:
|
||||
|
||||
The spec is at:
|
||||
|
||||
http://www.cco.caltech.edu/~jafl/xdnd/
|
||||
|
||||
Motif:
|
||||
|
||||
The Motif DND protocol is best described in the
|
||||
Hungry Programmers _Inside Lesstif_ book, available
|
||||
from:
|
||||
|
||||
http://www.igpm.rwth-aachen.de/~albrecht/hungry.html
|
||||
|
||||
Harald Albrecht and Mitch Miers have done a far
|
||||
better job at documenting the DND protocol then
|
||||
anything the OpenGroup has produced.
|
||||
|
||||
|
||||
|
||||
Owen Taylor
|
||||
otaylor@redhat.com
|
||||
Oct 18, 1998
|
||||
@@ -40,7 +40,7 @@ and \-\-libs options. This option must be specified before any
|
||||
.BR gimp (1),
|
||||
.BR gimptool (1)
|
||||
.SH COPYRIGHT
|
||||
Copyright \(co 1995 Spencer Kimball and Peter Mattis
|
||||
Copyright \(co 1998 Owen Taylor
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
|
||||
605
docs/gtk.texi
605
docs/gtk.texi
@@ -1,5 +1,6 @@
|
||||
\input texinfo @c -*-texinfo-*-
|
||||
@c Copyright (C) 1996 by Peter Mattis. All rights reserved.
|
||||
@c Portions Copyright (C) 1998 Marius Vollmer
|
||||
@c
|
||||
@c %**start of header
|
||||
@setfilename gtk.info
|
||||
@@ -9,8 +10,8 @@
|
||||
@c %**end of header
|
||||
|
||||
@set edition 1.0
|
||||
@set update-date 29 January 1998
|
||||
@set update-month January 1998
|
||||
@set update-date 23 August 1998
|
||||
@set update-month August 1998
|
||||
|
||||
@ifinfo
|
||||
This file documents GTK, the GIMP Toolkit
|
||||
@@ -44,7 +45,7 @@ approved by Peter Mattis.
|
||||
@title The GIMP Toolkit
|
||||
@subtitle Version @value{edition}
|
||||
@subtitle @value{update-month}
|
||||
@author by Peter Mattis
|
||||
@author by Peter Mattis and the GTK+ team
|
||||
|
||||
@page
|
||||
@vskip 0pt plus 1filll
|
||||
@@ -83,7 +84,8 @@ This is edition @value{edition} of the GTK documentation,
|
||||
@menu
|
||||
* Copying:: Your rights.
|
||||
* Overview:: What is GTK?
|
||||
* Objects:: Object overview.
|
||||
* Types::
|
||||
* Objects::
|
||||
* Signals:: Signals overview.
|
||||
* Widgets:: Widget overview.
|
||||
* Other Objects:: Utility objects.
|
||||
@@ -120,17 +122,17 @@ copies of GTK, you must give the recipients all the rights that you
|
||||
have. You must make sure that they, too, receive or can get the source
|
||||
code. And you must tell them their rights.
|
||||
|
||||
Also, for my own protection, we must make certain that everyone finds
|
||||
Also, for our own protection, we must make certain that everyone finds
|
||||
out that there is no warranty for GTK. If GTK is modified by someone
|
||||
else and passed on, we want their recipients to know that what they have
|
||||
is not what we distributed, so that any problems introduced by others
|
||||
will no reflect on our reputation.
|
||||
|
||||
The precise conditions of the licenses for GTK are found in the General
|
||||
Public Licenses that accompanies it.
|
||||
Public Licenses that accompany it.
|
||||
|
||||
|
||||
@node Overview, Objects, Copying, Top
|
||||
@node Overview, Types, Copying, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter What is GTK?
|
||||
@cindex Overview
|
||||
@@ -151,26 +153,261 @@ label. However, the child widget can also be a pixmap, image or any
|
||||
combination possible the programmer desires. This flexibility is adhered
|
||||
to throughout the library.
|
||||
|
||||
@c I think the next paragraph takes unproportionally much space for
|
||||
@c the thing it wants to say (compared to the rest of this overview).
|
||||
@c So Somebody please extend this overview with more generally interesting
|
||||
@c stuff. - mvo
|
||||
|
||||
@node Objects, Signals, Overview, Top
|
||||
To make life easier for you, GTK presents this flexibility in a uniform
|
||||
framework. Specifically, it implements its own support for object
|
||||
oriented programming that is well adapted to the purposes of a user
|
||||
interface toolkit and it aims at providing a reasonable sane and
|
||||
disciplined programming interface. This uniformity and discipline is
|
||||
intended to make it easy and reliable to access GTK from languages other
|
||||
than C. Especially more dynamic languages like Perl, Python or Scheme
|
||||
will find amble support, and in fact, bindings to these languages
|
||||
already exist.
|
||||
|
||||
@node Types, Objects, Overview, Top
|
||||
@comment node-name, next, previous, up
|
||||
@chapter Object Overview
|
||||
@cindex Objects
|
||||
@chapter Types
|
||||
@cindex type
|
||||
@cindex type system
|
||||
@cindex class
|
||||
|
||||
GTK implements a semi-simple class mechanism and an associated class
|
||||
hierarchy for widgets and several other useful objects. The GtkObject
|
||||
type is the root of the class hierarchy. It provides a few items needed
|
||||
by all classes, the foundation for the signal (@pxref{Signals})
|
||||
mechanism and the ``destroy'' method.
|
||||
@flushright
|
||||
Other kid's games are all such a bore!
|
||||
They've gotta have rules and they gotta keep score!
|
||||
@*
|
||||
-- Calvin about CalvinBall(tm)
|
||||
@end flushright
|
||||
|
||||
The class hierarchy is defined by a type hierarchy. This hierarchy
|
||||
allows queries to be made in regards to a type. The basic query that can
|
||||
be performed is asking whether a given type has an ``is a'' relation
|
||||
with another type. For instance, it is common to ask whether a general
|
||||
widget pointer is a type of specific widget so that runtime sanity
|
||||
checks can be made.
|
||||
GTK implements a semi-simple type system with an associated class
|
||||
mechanism for widgets and several other useful objects. This type
|
||||
system is intended to be general enough to allow both a smooth binding
|
||||
of dynamically typed languages to Gtk, as well as to serve for a
|
||||
rigorous and formalistic definition of the larger part of the Gtk API.
|
||||
|
||||
@section Type utility functions
|
||||
@c The GtkObject
|
||||
@c type is the root of the class hierarchy. It provides a few items needed
|
||||
@c by all classes, the foundation for the signal (@pxref{Signals})
|
||||
@c mechanism and the ``destroy'' method.
|
||||
|
||||
The classes for the individual widgets are by far the most important
|
||||
part of this type system, but before we get to them, we describe the
|
||||
basics of the type system itself. This is mostly of interest for widget
|
||||
writers and language binders, so you might want to skip ahead to the
|
||||
next chapter, which talks about the object oriented stuff.
|
||||
|
||||
@menu
|
||||
* Type introduction::
|
||||
* Basics::
|
||||
* Simple types::
|
||||
* Enumerations and flags::
|
||||
* Strings::
|
||||
* Boxed types::
|
||||
* Callbacks::
|
||||
* Composite types::
|
||||
@end menu
|
||||
|
||||
@node Type introduction, Basics, Types, Types
|
||||
@section Introduction to the Type System
|
||||
|
||||
Gtk defines its own system of types, much like a computer language
|
||||
defines what types it supports. Of course, the Gtk type system is build
|
||||
on top of the types that C provides, so it includes members like
|
||||
@samp{int}, @samp{long} and @samp{float}. But, compared to C, it allows
|
||||
only few carefully selected types and specifies a lot of restrictions on
|
||||
the way you can use values of these types. For example, there is no
|
||||
general facility for specifying @emph{pointer to X}. Instead, we take a
|
||||
more higher level approach and define such things as @samp{string},
|
||||
which is just like a @code{char*} but with additional rules about how to
|
||||
manage the memory that it points to.
|
||||
|
||||
The type system has two purposes: to define a formal system with which
|
||||
to describe the various exported features of Gtk; and to implement this
|
||||
system at run-time so that we get sound and flexible @dfn{dynamic} types
|
||||
for the dynamic languages that want to interface with Gtk.
|
||||
|
||||
Let me restate this with different words, because I think it is
|
||||
important to understand this idea. We will see in a moment that the
|
||||
type system is indeed well defined and all this detail is implemented
|
||||
with functions and data structures in Gtk. For example, every type (and
|
||||
there can be any number of them) can be represented with a unique
|
||||
integer and Gtk has support for the necessary bookkeeping for this.
|
||||
Every type also has a name and there are functions for converting
|
||||
between the name of a type and its unique number. Maybe more useful,
|
||||
there is a big discriminated union that can be used to pass around a
|
||||
value of any representable type, together with its precise type.
|
||||
|
||||
This is the run-time or dynamic side of the type system. Mostly, you do
|
||||
not need to use it when you don't want to. The compile-time or static
|
||||
side of the type system can is used to statically define the programming
|
||||
interface of Gtk. For example, suppose there is function @code{gtk_foo}
|
||||
in the Gtk API that has a prototype
|
||||
|
||||
@example
|
||||
char *gtk_foo (char *);
|
||||
@end example
|
||||
|
||||
This looks like it does something with strings. But what does it do
|
||||
with the memory of the string that has been passed in, and what are we
|
||||
supposed or allowed to do with the memory that the returned pointer
|
||||
points to? The more restricted type @samp{string} from the Gtk type
|
||||
system can be used to be more precise. In fact, the definition of
|
||||
@samp{string} below includes the rule that when a @samp{string} is
|
||||
passed to a function, that function is not allowed to retain a pointer
|
||||
into the string beyond the life time of that function call. So we are
|
||||
safe to deallocate it or override it when the function has returned.
|
||||
Likewise, the definition specifies that the memory of a @samp{string}
|
||||
that is returned from a function becomes the sole property of the
|
||||
calling function. The calling function is responsible for deallocating
|
||||
it eventually and it can be sure that nobody else scribbles in it. When
|
||||
@samp{gtk_foo} really obeys these rules, we can say that it takes one
|
||||
argument, which is a @samp{string}, and it returns a @samp{string}.
|
||||
|
||||
Now we can understand why it makes sense to have a more restrictive type
|
||||
system than that of C. With it, it is possible to be more precise and
|
||||
we actually have a framework where we can be sure that as long as we
|
||||
stay inside this framework we are not gratuitously causing trouble for
|
||||
languages that are more disciplined than C. Of course, you are not
|
||||
restricted to making all your interfaces expressible within the
|
||||
framework. There are valid reasons for breaking it, for performance or
|
||||
simply for convenience. But please try to provide all the functionality
|
||||
of your module in such a way that it can be described with this type
|
||||
system and treat the non-conforming functions as additional goodies that
|
||||
are nice to have but not essential. The reward is an instant
|
||||
accessibility of your code from a huge number of scripting and extension
|
||||
languages such as Perl, Python, and Guile.
|
||||
|
||||
These formal specifications of the Gtk interface are contained in
|
||||
special declarations in the header files of Gtk. They are ignored by
|
||||
the C compiler, but can be used by other language processors. For extra
|
||||
convenience, these declarations are also available in a more condensed
|
||||
form that is easier to parse. Tools for generating bindings of Gtk to
|
||||
other languages can read these declarations and---because all the
|
||||
important details are defined---automatically generate the bulk of the
|
||||
needed glue code. It is also possible to feed these declarations into a
|
||||
running application (a interface builder, say) and thus make it aware of
|
||||
new widgets and functions without recompiling anything.
|
||||
|
||||
The run-time side of the type system is also somewhat introspective.
|
||||
This means that you can query Gtk about all the members of an
|
||||
enumeration for example. Gtk provides tools that help you provide this
|
||||
introspection for your definitions also.
|
||||
|
||||
Types are not enough to completely specify an interface, so GTK also has
|
||||
@dfn{modes}. A mode specifies what happens to a value when it crosses a
|
||||
module boundary; it can be @samp{in}, @samp{out}, or @samp{inout}. Most
|
||||
fundamental types (and their derived types) support only mode @samp{in}.
|
||||
The modes @samp{out} and @samp{inout} can only be used with the
|
||||
composite types: lists and vectors. When argument of these types are
|
||||
marked as @samp{out} or @samp{inout} it means that the called module is
|
||||
allowed to change the contents of the composite value and that these
|
||||
changes need to be propagated back to the originator of the value. Mode
|
||||
@samp{out} means that the argument has no meaningful value at the
|
||||
beginning and should not be read. Mode @samp{in} specifies that the
|
||||
called module is not allowed to change the value in any way.
|
||||
|
||||
The type system allows for an unbounded number of types. Every widget
|
||||
is a type for example and you can add new widget types at any time
|
||||
without confusing the run-time implementation of the type system.
|
||||
Nevertheless, all types are derived from a certain @dfn{fundamental}
|
||||
type, and there are only a small and finite number of fundamental types.
|
||||
We only specify rules for the fundamental types and all other types
|
||||
inherit these rules from their fundamental type. For example,
|
||||
@samp{int} is a fundamental type, as is @samp{GtkObject}. All widgets
|
||||
derive from @samp{GtkObject} and so the rules for @samp{GtkObject} apply
|
||||
to all widgets as well.
|
||||
|
||||
This derivation defines a type hierachy, but this hierachy is not
|
||||
completely general. You can't derive from @samp{int} for example, and
|
||||
you can only have one level of derivation from @samp{enum}. The
|
||||
fundamental type @samp{GtkObject}, however, is the basis for the large
|
||||
and deep hierarchy of widget types.
|
||||
|
||||
The individual fundamental types are defined and explained in the
|
||||
following sections. Here is a complete list of them:
|
||||
|
||||
@table @samp
|
||||
@item none
|
||||
The not-a-value type, similar to @samp{void}.
|
||||
@item char
|
||||
A character. Internationalization issues are still undecided.
|
||||
@item bool
|
||||
True or false.
|
||||
@item byte, ubyte, int, uint, long, ulong, float, double
|
||||
The usual assortment of scalar types.
|
||||
@item string
|
||||
A string. Internationalization issues are still undecided.
|
||||
@item enum, flags
|
||||
Enumerations with a fixed set of literals. Either used to express a
|
||||
single choice from this set or to individually turn on and off several
|
||||
flags.
|
||||
@item boxed
|
||||
A pointer to an opaque structure that can be copied and destroyed.
|
||||
@item callback
|
||||
A pointer to a function with enough extra information so that it can
|
||||
also be used for functions written in languages completely different
|
||||
from C.
|
||||
@item GtkObject
|
||||
A pointer to a GtkObject or derived type. The fun starts here.
|
||||
@item args, slist, dlist, cvec, tvec
|
||||
An assortment of composite types like linked lists and counted or
|
||||
zero-terminated arrays.
|
||||
@item pointer, signal, c_callback
|
||||
Obsolete types.
|
||||
@end table
|
||||
|
||||
@node Basics, Simple types, Type introduction, Types
|
||||
@section Basic Concepts
|
||||
|
||||
The basis for the type system are the fundamental types. At run-time,
|
||||
they are represented by members of the @code{GtkFundamentalType}
|
||||
enumeration. For the static declarations, they are identified with a
|
||||
unique name.
|
||||
|
||||
@deftp {Enumeration} GtkFundamentalType
|
||||
This enumeration contains a member for each defined fundamental type.
|
||||
Most members are listed along with the description of their semantics,
|
||||
but one is listed here:
|
||||
|
||||
@table @code
|
||||
@item GTK_TYPE_INVALID
|
||||
No valid type is derived from this. Use @code{GTK_TYPE_INVALID} to
|
||||
express exceptional situations. This member does not really correspond
|
||||
to a fundamental type and thus there is no name for it.
|
||||
@end table
|
||||
@end deftp
|
||||
|
||||
@deftp {Data type} GtkType
|
||||
The type @code{GtkType} holds the run-time representation of a type. It
|
||||
is a integer of a certain size. The follwing macros are defined to
|
||||
access the basic properties of a @code{GtkType}:
|
||||
|
||||
@deftypefn {Macro} {unsigned int} GTK_TYPE_SEQNO (GtkType type)
|
||||
Returns the sequence number of @var{type}. The sequence numbers are
|
||||
guaranteed to be dense, i.e., you can use them to index a table and the
|
||||
table need not be much larger than the number of different GtkTypes that
|
||||
you might encounter.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {Macro} GtkFundamentalType GTK_FUNDAMENTAL_TYPE (GtkType type)
|
||||
Returns the fundamental type of @var{type}.
|
||||
@end deftypefn
|
||||
|
||||
Both macros simply access different bit-fields of a @code{GtkType}, so
|
||||
they are very efficient.
|
||||
@end deftp
|
||||
|
||||
New types are registered with the @code{gtk_type_unique} function. Any
|
||||
kind oftype can be registered with @code{gtk_type_unique} but there are
|
||||
convenience functions for most fundamental types. Each fundamental type
|
||||
has its own interpretation of the rules below and these convenience
|
||||
functions should be used to automatically get the type registration
|
||||
right. So, don't be put off by the apparent complexity of the interface
|
||||
to @code{gtk_type_unique}. You will be using it only for new widgets,
|
||||
and there the rules are simple.
|
||||
|
||||
The @code{GtkTypeInfo} structure is used to communicate information to
|
||||
@code{gtk_type_unique} as opposed to passing in large numbers of
|
||||
@@ -186,123 +423,257 @@ struct _GtkTypeInfo
|
||||
guint class_size;
|
||||
GtkClassInitFunc class_init_func;
|
||||
GtkObjectInitFunc object_init_func;
|
||||
GtkArgSetFunc arg_set_func;
|
||||
GtkArgGetFunc arg_get_func;
|
||||
gpointer reserved_1;
|
||||
gpointer reserved_2;
|
||||
GtkClassInitFunc base_class_init_func;
|
||||
@}
|
||||
@end example
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
The @code{type_name} field refers to the name of the type. It is
|
||||
convention for the type name to be the same as the C structure type. For
|
||||
example, the type name of the @code{GtkObject} structure is
|
||||
``GtkObject''.
|
||||
The @code{type_name} field refers to the name of the type. This is the
|
||||
same name that is used in the static definitions. It is convention for
|
||||
the type name to be closely related to the name of the underlying C
|
||||
type. For example, the type name of the @code{GtkObject} structure is
|
||||
``GtkObject'', and the name of the @code{GtkWindowType} enumeration is
|
||||
``GtkWindowType''. Note that the C type corresponding to ``GtkObject''
|
||||
is really a pointer to a @code{GtkObject} struct, but the name has no
|
||||
``*'' in it.
|
||||
|
||||
@item
|
||||
The @code{object_size} field refers to the size in bytes of the C
|
||||
structure. The easiest (and portable) means of computing this size is by
|
||||
using the C @code{sizeof} operator. For instance, the sizeof of the
|
||||
@code{GtkObject} structure is computed by doing @code{sizeof
|
||||
(GtkObject)}.
|
||||
structure for types that have such a structure. The easiest (and
|
||||
portable) means of computing this size is by using the C @code{sizeof}
|
||||
operator. For instance, the sizeof of the @code{GtkObject} structure is
|
||||
computed by doing @code{sizeof (GtkObject)}. When the type has no
|
||||
associated structure or when you do not want to support the
|
||||
@code{gtk_type_new} function for the new type, set @code{object_size} to
|
||||
0. Only types derived from GTK_TYPE_OBJECT can be handled by
|
||||
@code{gtk_type_new}, anyway.
|
||||
|
||||
@item
|
||||
The @code{class_size} field refers to the size in bytes of the C
|
||||
structure for the class. Again, the @code{sizeof} operator should be
|
||||
used to compute this value.
|
||||
structure for the class. Again, the @code{sizeof} operator should be
|
||||
used to compute this value. If you don't want to have a class structure
|
||||
for this type, set the field to 0. @code{gtk_type_class} will then
|
||||
always return @code{NULL}.
|
||||
|
||||
@item
|
||||
The @code{class_init_func} field is a callback which is used by the type
|
||||
mechanism to initialize class specific fields. The single argument this
|
||||
function takes is a pointer to a class structure.
|
||||
The @code{class_init_func} and @code{base_class_init_func} fields are
|
||||
callbacks which are used by the type mechanism to initialize class
|
||||
specific fields. The single argument these function taks is a pointer to
|
||||
a class structure. When you do not need one or both of them, set the
|
||||
corresponding field to @code{NULL}. The @code{class_init_func} will be
|
||||
called at most once, right after the class structure of size
|
||||
@code{class_size} has been allocated. The interaction between
|
||||
@code{class_init_func} and @code{base_class_init_func} is only really
|
||||
useful for the full-fledged object system. It is described there
|
||||
@pxref{Objects}.
|
||||
|
||||
@item
|
||||
The @code{object_init_func} field is a callback which is used by the
|
||||
type mechanism to initialize object specific fields. The single argument
|
||||
this functions takes is a pointer to an object structure.
|
||||
|
||||
@c FIXME!! Document the arg_set_func and arg_get_func..
|
||||
type mechanism to initialize object specific fields for structures that
|
||||
have been allocated via @code{gtk_type_new}. The single argument this
|
||||
functions takes is a pointer to an object structure. If you do not want
|
||||
any special object initialization to take place, set this to
|
||||
@code{NULL}. All object initialization functions for all types that are
|
||||
part of the inheritance chain are called, starting with the most basic
|
||||
type.
|
||||
|
||||
@end itemize
|
||||
|
||||
@deftypefun guint gtk_type_unique (guint @var{parent_type}, GtkTypeInfo *@var{type_info})
|
||||
The @var{parent_type} is simply the value of the new types parent
|
||||
type. If @var{parent_type} is 0, then the new type is the root of the
|
||||
type hierarchy. @var{type_info} is a pointer to a structure which
|
||||
contains necessary information for construction of the new
|
||||
type. Specifically, the @code{type_name}, @code{object_size} and
|
||||
@code{class_size} fields are required. The @code{class_init_func},
|
||||
@code{object_init_func} and @code{value_init_func} fields may be NULL.
|
||||
@deftypefun guint gtk_type_unique (GtkType @var{parent_type}, GtkTypeInfo *@var{type_info})
|
||||
The @var{parent_type} is simply the new types parent type. If
|
||||
@var{parent_type} is GTK_TYPE_INVALID, then the new type is a new
|
||||
fundamental type. You should @b{never} register new fundamental types.
|
||||
@var{type_info} is a pointer to a structure which contains necessary
|
||||
information for construction of the new type.
|
||||
|
||||
You can only register a specific name once.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gchar* gtk_type_name (guint @var{type})
|
||||
@deftypefun gchar* gtk_type_name (GtkType @var{type})
|
||||
The returned string is the name of @var{type} as specified to
|
||||
@code{gtk_type_unique}.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun guint gtk_type_from_name (guchar *@var{name})
|
||||
@deftypefun GtkType gtk_type_from_name (guchar *@var{name})
|
||||
Return the type associated with @var{name}. If there is no type
|
||||
associated with @var{name}, then 0 will be returned.
|
||||
associated with @var{name}, then GTK_TYPE_INVALID will be returned.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun guint gtk_type_parent (guint @var{type})
|
||||
Returns the parent type of @var{type} or 0 if @var{type} is the root of
|
||||
the type hierarchy.
|
||||
@deftypefun GtkType gtk_type_parent (GtkType @var{type})
|
||||
Returns the parent type of @var{type} or GTK_TYPE_INVALID if @var{type}
|
||||
is a fundamental type.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer gtk_type_class (guint @var{type})
|
||||
@deftypefun gpointer gtk_type_class (GtkType @var{type})
|
||||
Returns the initialized class structure for @var{type}. The class
|
||||
structure is actually created and initialized the first time it is
|
||||
needed. If creation and initialization occurs, the @code{class_size}
|
||||
field of the @code{GtkTypeInfo} structure used to initialize this type
|
||||
is used to determine how large the class structure is. The
|
||||
@code{class_init_func} field from the @code{GtkTypeInfo} structure is
|
||||
called for all the members in the types ancestry, including the
|
||||
type. The order of this invocation proceeds from the root on down. For
|
||||
example, the @code{GtkWidgetClass} is first initialized as an
|
||||
@code{GtkObjectClass} by the object class initialization routine and
|
||||
then by the widget class initialization routine. This allows the widget
|
||||
class initialization routine to override values set by the object class
|
||||
initialization routine. The returned structure is shared by all objects
|
||||
of @var{type} and, as such, should not be modified.
|
||||
needed. Refer to @pxref{Objects} for details on how this initialization works for GTK_TYPE_OBJECT derived types.
|
||||
|
||||
@c If creation and initialization occurs, the @code{class_size}
|
||||
@c field of the @code{GtkTypeInfo} structure used to initialize this type
|
||||
@c is used to determine how large the class structure is. The
|
||||
@c @code{class_init_func} field from the @code{GtkTypeInfo} structure is
|
||||
@c called for all the members in the types ancestry, including the
|
||||
@c type. The order of this invocation proceeds from the root on down. For
|
||||
@c example, the @code{GtkWidgetClass} is first initialized as an
|
||||
@c @code{GtkObjectClass} by the object class initialization routine and
|
||||
@c then by the widget class initialization routine. This allows the widget
|
||||
@c class initialization routine to override values set by the object class
|
||||
@c initialization routine.
|
||||
|
||||
The returned structure is shared by all objects of @var{type} and, as
|
||||
such, should not be modified.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gpointer gtk_type_new (guint @var{type})
|
||||
Returns a new instance of an @var{type} object. The object structure is
|
||||
created and initialized similarly to the class structure (as described
|
||||
above). The @code{object_size} and @code{object_init_func} fields of the
|
||||
@code{GtkTypeInfo} structure are used to determine the objects allocated
|
||||
size and the object specific initialization routine. Similarly to the
|
||||
class initialization, all the object initialization routines from the
|
||||
root on down to the particular type being created are invoked.
|
||||
@deftypefun gpointer gtk_type_new (GtkType @var{type})
|
||||
Returns a new instance of an @var{type} object. This works only for GTK_TYPE_OBJECT derived types. Please see @pxref{Objects}.
|
||||
@c The @code{object_size}
|
||||
@c and @code{object_init_func} fields of the @code{GtkTypeInfo} structure
|
||||
@c are used to determine the objects allocated size and the object specific
|
||||
@c initialization routine. Similarly to the class initialization, all the
|
||||
@c object initialization routines from the root on down to the particular
|
||||
@c type being created are invoked.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gtk_type_describe_heritage (guint @var{type})
|
||||
@deftypefun void gtk_type_describe_heritage (GtkType @var{type})
|
||||
Prints the type heritage for @var{type}. The heritage for a type
|
||||
includes the type and all its parent types up the type tree.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gtk_type_describe_tree (guint @var{type}, gint @var{show_size})
|
||||
@deftypefun void gtk_type_describe_tree (GtkType @var{type}, gboolean @var{show_size})
|
||||
Prints the type tree which starts at @var{type}. @var{show_size} is a
|
||||
boolean which determines whether type sizes are printed.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun gint gtk_type_is_a (guint @var{type}, guint @var{is_a_type})
|
||||
@deftypefun gboolean gtk_type_is_a (GtkType @var{type}, GtkType @var{is_a_type})
|
||||
A predicate function which determines whether the relation @var{type}
|
||||
is_a @var{is_a_type} is true.
|
||||
@end deftypefun
|
||||
|
||||
@deftypefun void gtk_type_get_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
|
||||
@end deftypefun
|
||||
@c @deftypefun void gtk_type_get_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
|
||||
@c @end deftypefun
|
||||
|
||||
@c @deftypefun void gtk_type_set_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
|
||||
@c @end deftypefun
|
||||
|
||||
Values of all types can be handled uniformly by storing them into a
|
||||
@code{GtkArg} structure. The @code{GtkArg} has the following fields:
|
||||
|
||||
@table @code
|
||||
@item gchar *name
|
||||
This can be used to give the value represented by this @code{GtkArg}
|
||||
structure a name. It is not used much.
|
||||
|
||||
@item GtkType type
|
||||
The type of this value.
|
||||
|
||||
@item union d
|
||||
A big union that has (at least conceptually) one member for each
|
||||
fundamental type. You should not access these members directly.
|
||||
Rather, use the @code{GTK_VALUE_*} macros. There is one macro for each
|
||||
fundamental type, and its name is derived from the name of the
|
||||
GtkFundamentalType enumeration members simply by replacing ``Gtk_TYPE''
|
||||
with ``GTK_VALUE''. All @code{GTK_VALUE_*} macros take a @code{GtkArg}
|
||||
structure as their only parameter (@emph{not} a pointer) and evaluate to
|
||||
a lvalue.
|
||||
@end table
|
||||
|
||||
For example, the accessor for the fundamental type GTK_TYPE_INT is
|
||||
called GTK_VALUE_INT and you could use it like this:
|
||||
|
||||
@example
|
||||
GtkArg value;
|
||||
|
||||
value.name = NULL;
|
||||
value.type = GTK_TYPE_INT;
|
||||
GTK_VALUE_INT(value) = 7;
|
||||
@end example
|
||||
|
||||
@node Simple types, Enumerations and flags, Basics, Types
|
||||
@section Simple Types
|
||||
|
||||
The Gtk type system has a full set of the usual simple types: integers,
|
||||
floating point numbers, but also boolean and character. You can not
|
||||
derive new types from these.
|
||||
|
||||
@multitable {GTK_TYPE_POINTER} {"gpointer"} {xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}
|
||||
@item Enum @tab Name @tab Description
|
||||
@item GTK_TYPE_NONE @tab "void"
|
||||
@tab A type without value.
|
||||
@item GTK_TYPE_CHAR @tab "char"
|
||||
@tab A 8-bit unsigned number representing a character. Numbers
|
||||
between 0 and 127 are ASCII, the rest is undefined.
|
||||
@item GTK_TYPE_BOOL @tab "gboolean"
|
||||
@tab The boolean type. It is some small integer where the number 0
|
||||
represents false and 1 is true. No other values are allowed.
|
||||
@item GTK_TYPE_INT @tab "gint"
|
||||
@tab A signed integer with at least 32 bits.
|
||||
@item GTK_TYPE_UINT @tab "guint"
|
||||
@tab A unsigned integer with at least 32 bits.
|
||||
@item GTK_TYPE_LONG @tab "glong"
|
||||
@tab A signed integer with at least 32 bits.
|
||||
@item GTK_TYPE_ULONG @tab "gulong"
|
||||
@tab A unsigned integer with at least 32 bits. This is large enough to
|
||||
hold a coerced pointer.
|
||||
@item GTK_TYPE_FLOAT @tab "gfloat"
|
||||
@tab A single precision floating point number.
|
||||
@item GTK_TYPE_DOUBLE @tab "gfloat"
|
||||
@tab A souble precision floating point number.
|
||||
@item GTK_TYPE_POINTER @tab "gpointer"
|
||||
@tab A untyped pointer. Do not use this if you can avoid it.
|
||||
@end multitable
|
||||
|
||||
The values of these types are all represented `directly' with the C
|
||||
types that are indicated in the `name' column above. @pxref{Boxed
|
||||
types} for a discussion of this.
|
||||
|
||||
@node Enumerations and flags, Strings, Simple types, Types
|
||||
@section Enumerations and Flags
|
||||
|
||||
@node Strings, Boxed types, Enumerations and flags, Types
|
||||
@section Strings
|
||||
|
||||
@node Boxed types, Callbacks, Strings, Types
|
||||
@section Boxed Types
|
||||
|
||||
@node Callbacks, Composite types, Boxed types, Types
|
||||
@section Callbacks
|
||||
|
||||
@node Composite types, , Callbacks, Types
|
||||
@section Composite Types
|
||||
|
||||
@node Objects, Signals, Types, Top
|
||||
@chapter Objects
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@deftypefun void gtk_type_set_arg (GtkObject *@var{object}, GtkType @var{type}, GtkArg *@var{arg}, guint @var{arg_id})
|
||||
@end deftypefun
|
||||
|
||||
@section Object functions
|
||||
|
||||
The GtkObject type is the root of the type hierarchy used by GTK. It
|
||||
provides a minimal set of fields used to implement the actual
|
||||
object, class and signal mechanisms, as well as several utility routines
|
||||
which make dealing with objects easier.
|
||||
provides a minimal set of fields used to implement the actual object,
|
||||
class and signal mechanisms, as well as several utility routines which
|
||||
make dealing with objects easier.
|
||||
|
||||
For the adventurous, see @ref{Object Implementation}.
|
||||
|
||||
@@ -751,37 +1122,37 @@ The available widgets (in alphabetical order):
|
||||
@menu
|
||||
* GtkAlignment:: The alignment widget.
|
||||
* GtkArrow:: The arrow widget.
|
||||
* GtkAspectFrame:: The aspect frame widget.
|
||||
* GtkAspectFrame:: The aspect frame widget.
|
||||
* GtkBin:: The bin widget.
|
||||
* GtkBox:: The box widget.
|
||||
* GtkButtonBox:: The button box widget.
|
||||
* GtkButtonBox:: The button box widget.
|
||||
* GtkButton:: The button widget.
|
||||
* GtkCheckButton:: The check button widget.
|
||||
* GtkCheckMenuItem:: The check menu item widget.
|
||||
* GtkCList:: The compound list widget.
|
||||
* GtkColorSelection:: The color selector widget.
|
||||
* GtkCombo:: The combo box widget.
|
||||
* GtkCList:: The compound list widget.
|
||||
* GtkColorSelection:: The color selector widget.
|
||||
* GtkCombo:: The combo box widget.
|
||||
* GtkContainer:: The container widget.
|
||||
* GtkCTree:: The multi-column tree widget.
|
||||
* GtkCurve:: The curve widget.
|
||||
* GtkGammaCurve:: The gamma curve widget.
|
||||
* GtkCurve:: The curve widget.
|
||||
* GtkGammaCurve:: The gamma curve widget.
|
||||
* GtkDialog:: The dialog widget.
|
||||
* GtkDrawingArea:: The drawing area widget.
|
||||
* GtkEntry:: The entry widget.
|
||||
* GtkEventBox:: The event box widget.
|
||||
* GtkEventBox:: The event box widget.
|
||||
* GtkFileSelection:: The file selection dialog widget.
|
||||
* GtkFixed:: The fixed widget.
|
||||
* GtkFixed:: The fixed widget.
|
||||
* GtkFrame:: The frame widget.
|
||||
* GtkGamma:: The gamma widget.
|
||||
* GtkGamma:: The gamma widget.
|
||||
* GtkHBox:: The horizontal box widget.
|
||||
* GtkHButtonBox:: The horizontal button box widget.
|
||||
* GtkHPaned:: The horizontal paned widget.
|
||||
* GtkHButtonBox:: The horizontal button box widget.
|
||||
* GtkHPaned:: The horizontal paned widget.
|
||||
* GtkHRuler:: The horizontal ruler widget.
|
||||
* GtkHScale:: The horizontal scale widget.
|
||||
* GtkHScrollbar:: The horizontal scrollbar widget.
|
||||
* GtkHSeparator:: The horizontal separator widget.
|
||||
* GtkImage:: The image widget.
|
||||
* GtkInputDialog:: The input dialog widget.
|
||||
* GtkInputDialog:: The input dialog widget.
|
||||
* GtkItem:: The item widget.
|
||||
* GtkLabel:: The label widget.
|
||||
* GtkList:: The list widget.
|
||||
@@ -793,7 +1164,7 @@ The available widgets (in alphabetical order):
|
||||
* GtkMisc:: The misc widget.
|
||||
* GtkNotebook:: The notebook widget.
|
||||
* GtkOptionMenu:: The option menu widget.
|
||||
* GtkPaned:: The paned widget.
|
||||
* GtkPaned:: The paned widget.
|
||||
* GtkPixmap:: The pixmap widget.
|
||||
* GtkPreview:: The preview widget.
|
||||
* GtkProgressBar:: The progress bar widget.
|
||||
@@ -805,18 +1176,18 @@ The available widgets (in alphabetical order):
|
||||
* GtkScrollbar:: The scrollbar widget.
|
||||
* GtkScrolledWindow:: The scrolled window widget.
|
||||
* GtkSeparator:: The separator widget.
|
||||
* GtkStatusbar:: The statusbar widget.
|
||||
* GtkStatusbar:: The statusbar widget.
|
||||
* GtkTable:: The table widget.
|
||||
* GtkText:: The text widget.
|
||||
* GtkToggleButton:: The toggle button widget.
|
||||
* GtkToolbar:: The tool bar widget.
|
||||
* GtkTooltips:: The tool tips widget.
|
||||
* GtkToolbar:: The tool bar widget.
|
||||
* GtkTooltips:: The tool tips widget.
|
||||
* GtkTree:: The tree widget.
|
||||
* GtkTreeItem:: The tree item widget.
|
||||
* GtkVBox:: The vertical box widget.
|
||||
* GtkVButtonBox:: The vertical button box widget.
|
||||
* GtkVButtonBox:: The vertical button box widget.
|
||||
* GtkViewport:: The viewport widget.
|
||||
* GtkVPaned:: The vertical paned widget.
|
||||
* GtkVPaned:: The vertical paned widget.
|
||||
* GtkVRuler:: The vertical ruler widget.
|
||||
* GtkVScale:: The vertical scale widget.
|
||||
* GtkVScrollbar:: The vertical scrollbar widget.
|
||||
@@ -1434,7 +1805,7 @@ values @var{label}. The new widget is returned as a pointer to a
|
||||
@gtkstdmacros{CheckButton, CHECK_BUTTON}
|
||||
|
||||
@page
|
||||
@node GtkCheckMenuItem, GtkCList, GtkCheckButton, Widgets,
|
||||
@node GtkCheckMenuItem, GtkCList, GtkCheckButton, Widgets
|
||||
@comment node-name, next, previous, up
|
||||
@section The check menu item widget
|
||||
|
||||
@@ -4528,7 +4899,7 @@ Returns the @code{GtkWidget} type identifier.
|
||||
|
||||
|
||||
@page
|
||||
@node GtkWindow, , GtkWidget, Widgets
|
||||
@node GtkWindow, , GtkWidget, Widgets
|
||||
@comment node-name, next, previous, up
|
||||
@section The window widget
|
||||
|
||||
@@ -4677,11 +5048,11 @@ above.
|
||||
|
||||
|
||||
@menu
|
||||
* GtkAcceleratorTable:: The accelerator table object.
|
||||
* GtkAcceleratorTable:: The accelerator table object.
|
||||
* GtkAdjustment:: The adjustment object.
|
||||
* GtkGC:: The GC object.
|
||||
* GtkGC:: The GC object.
|
||||
* GtkData:: The data object.
|
||||
* GtkStyle:: The style object.
|
||||
* GtkStyle:: The style object.
|
||||
@end menu
|
||||
|
||||
|
||||
@@ -4764,7 +5135,7 @@ Returns the @code{GtkData} type identifier.
|
||||
|
||||
@gtkstdmacros{Data, DATA}
|
||||
@page
|
||||
@node GtkStyle, ,GtkData, Other Objects
|
||||
@node GtkStyle, , GtkData, Other Objects
|
||||
@section The style object
|
||||
|
||||
@subsection Description
|
||||
@@ -4779,7 +5150,7 @@ Returns the @code{GtkData} type identifier.
|
||||
|
||||
@menu
|
||||
* Initialization and exit:: Initializing and exiting GTK.
|
||||
* Customization:: Customizing the library.
|
||||
* Customization:: Customizing the library.
|
||||
* Menu Factories:: Simplified menu creation.
|
||||
* Tree Factories:: Simplified tree creation.
|
||||
* Tool Tips:: Pop up help mechanism.
|
||||
@@ -4889,7 +5260,7 @@ you.
|
||||
@section Resource Files
|
||||
|
||||
@page
|
||||
@node Standard Macros, , Resource Files, Miscellaneous
|
||||
@node Standard Macros, , Resource Files, Miscellaneous
|
||||
@comment node-name, next, previous, up
|
||||
@section Macros defined by all objects
|
||||
|
||||
@@ -4919,7 +5290,7 @@ Cast a generic pointer to @code{Gtk<ObjectType>Class*}. Like
|
||||
@deftypefun gint GTK_IS_<ObjectType> (gpointer @var{obj})
|
||||
Determine if a generic pointer refers to a @code{Gtk<ObjectType>}
|
||||
object. This function is, in reality, a macro wrapper around the
|
||||
@code{gtk_type_is_a} function (@pxref{Objects}).
|
||||
@code{gtk_type_is_a} function (@pxref{Types}).
|
||||
@end deftypefun
|
||||
|
||||
|
||||
@@ -5075,7 +5446,7 @@ main (int argc, char *argv[])
|
||||
@end example
|
||||
|
||||
|
||||
@node Hello World III, , Hello World II, Examples
|
||||
@node Hello World III, , Hello World II, Examples
|
||||
@comment node-name, next, previous, up
|
||||
@section Making Hello World II robust
|
||||
|
||||
@@ -5263,7 +5634,7 @@ array instead of a linked list. This would shrink the overhead of the
|
||||
@printindex fn
|
||||
|
||||
|
||||
@node Concept Index, , Function Index, Top
|
||||
@node Concept Index, , Function Index, Top
|
||||
@comment node-name, next, previous, up
|
||||
@unnumbered Concept Index
|
||||
|
||||
@@ -5273,3 +5644,5 @@ array instead of a linked list. This would shrink the overhead of the
|
||||
@summarycontents
|
||||
@contents
|
||||
@bye
|
||||
|
||||
@c LocalWords: Gtk API formalistic
|
||||
|
||||
2792
docs/gtk_tut.sgml
2792
docs/gtk_tut.sgml
File diff suppressed because it is too large
Load Diff
8600
docs/gtk_tut_fr.sgml
Normal file
8600
docs/gtk_tut_fr.sgml
Normal file
File diff suppressed because it is too large
Load Diff
242
docs/man/gtk_button.pod
Normal file
242
docs/man/gtk_button.pod
Normal file
@@ -0,0 +1,242 @@
|
||||
|
||||
=head1 NAME
|
||||
|
||||
gtk_button - GTK+ push button widget
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <gtk/gtkbutton.h>
|
||||
|
||||
GtkType gtk_button_get_type (void);
|
||||
GtkWidget* gtk_button_new (void);
|
||||
GtkWidget* gtk_button_new_with_label (const gchar *label);
|
||||
void gtk_button_pressed (GtkButton *button);
|
||||
void gtk_button_released (GtkButton *button);
|
||||
void gtk_button_clicked (GtkButton *button);
|
||||
void gtk_button_enter (GtkButton *button);
|
||||
void gtk_button_leave (GtkButton *button);
|
||||
void gtk_button_set_relief (GtkButton *button,
|
||||
GtkReliefStyle style);
|
||||
GtkReliefStyle gtk_button_get_relief (GtkButton *button);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This widget is a standard push button widget. Push button widgets
|
||||
are generally used for allowing the user to click on them to initiate
|
||||
a command.
|
||||
|
||||
This widget is a container widget which contains one child.
|
||||
|
||||
=head1 OBJECT HIERARCHY
|
||||
|
||||
gtk_object
|
||||
gtk_widget
|
||||
gtk_container
|
||||
gtk_button
|
||||
|
||||
=head1 SIGNAL PROTOTYPES
|
||||
|
||||
"clicked" void user_function (GtkWidget *widget, gpointer data);
|
||||
"pressed" void user_function (GtkWidget *widget, gpointer data);
|
||||
"released" void user_function (GtkWidget *widget, gpointer data);
|
||||
"enter" void user_function (GtkWidget *widget, gpointer data);
|
||||
"leave" void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
=head2 Creation
|
||||
|
||||
The most common way to create a button is with a label in it, which
|
||||
contains text for the user to read. The child of the button will then
|
||||
be a L<gtk_label(3)> widget with the text you passwd in. You can
|
||||
do this in one command:
|
||||
|
||||
GtkWidget *button;
|
||||
button = gtk_button_new_with_label ("This is a button");
|
||||
|
||||
To create a gtk_button widget which does not already have a child,
|
||||
use gtk_button_new():
|
||||
|
||||
GtkWidget *button;
|
||||
button = gtk_button_new ();
|
||||
|
||||
After you have created a button you can then add a widget to the
|
||||
button (such as a label or pixmap) using gtk_container_add(). See
|
||||
L<gtk_container(3)> for more information on adding widgets to
|
||||
containers.
|
||||
|
||||
=head2 Creating a pixmap in a button in a window
|
||||
|
||||
After we have an empty gtk_button, such as above, and we have a gtk_pixmap,
|
||||
we can simply add the gtk_pixmap to the gtk_button with gtk_container_add().
|
||||
|
||||
The following code will open the file "gimp.xpm" and place it in a
|
||||
button.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *pixmap;
|
||||
GtkStyle *style;
|
||||
GdkPixmap *gdkpixmap;
|
||||
GdkBitmap *mask;
|
||||
char *filename = "gimp.xpm";
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), button);
|
||||
|
||||
/* The button is realized now, which creates button->window
|
||||
used below to create the pixmap. */
|
||||
gtk_widget_realize (button);
|
||||
|
||||
style = gtk_widget_get_style (button);
|
||||
gdkpixmap = gdk_pixmap_create_from_xpm (button->window, &mask,
|
||||
&style->bg[GTK_STATE_NORMAL],
|
||||
filename);
|
||||
pixmap = gtk_pixmap_new (gdkpixmap, mask);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (button), pixmap);
|
||||
|
||||
gtk_widget_show (pixmap);
|
||||
gtk_widget_show (button);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
=head2 Different reliefs
|
||||
|
||||
Reliefs affect how the shadowing of the button is drawn. The different
|
||||
types of relief styles are:
|
||||
|
||||
GTK_RELIEF_NORMAL
|
||||
GTK_RELIEF_HALF
|
||||
GTK_RELIEF_NONE
|
||||
|
||||
When set to a normal relief, the widget looks and acts like a normal
|
||||
button. When half or none relief is used, shadowing is only drawn when the
|
||||
mouse cursor is over the widget.
|
||||
|
||||
To set the relief, use gtk_button_set_relief(), like:
|
||||
|
||||
gtk_button_set_relief (button, GTK_RELIEF_HALF);
|
||||
|
||||
To get the current relief of a button, use gtk_button_get_relief():
|
||||
|
||||
GtkReliefStyle relief;
|
||||
relief = gtk_button_get_relief (GTK_BUTTON (button));
|
||||
|
||||
=head2 Executing a command when the button is pressed
|
||||
|
||||
To execute a function when a button is pressed, use
|
||||
gtk_signal_connect() to connect to the "clicked" signal.
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (user_function),
|
||||
NULL);
|
||||
|
||||
user_function is a user defined function, like the following:
|
||||
|
||||
void user_function (GtkWidget *button, gpointer data)
|
||||
{
|
||||
printf("clicked\n");
|
||||
}
|
||||
|
||||
=head1 FUNCTIONS
|
||||
|
||||
GtkType gtk_button_get_type (void);
|
||||
|
||||
This function returns the GtkType which is assigned to the
|
||||
object class for gtk_button.
|
||||
|
||||
GtkWidget* gtk_button_new (void);
|
||||
|
||||
This functions returns a new button widget which can then be
|
||||
used as a container for another widget.
|
||||
|
||||
GtkWidget* gtk_button_new_with_label (const gchar *label);
|
||||
|
||||
This function returns a new button widget with a label widget
|
||||
as a child. The label widget will have the text passed into
|
||||
the commant.
|
||||
|
||||
void gtk_button_pressed (GtkButton *button);
|
||||
|
||||
This function sends a "pressed" signal to the button.
|
||||
|
||||
void gtk_button_released (GtkButton *button);
|
||||
|
||||
This function sends a "released" signal to the button.
|
||||
|
||||
void gtk_button_clicked (GtkButton *button);
|
||||
|
||||
This function sends a "clicked" signal to the button.
|
||||
|
||||
void gtk_button_enter (GtkButton *button);
|
||||
|
||||
This function sends a "enter" signal to the button.
|
||||
|
||||
void gtk_button_leave (GtkButton *button);
|
||||
|
||||
This function sends a "leave" signal to the button.
|
||||
|
||||
void gtk_button_set_relief (GtkButton *button, GtkReliefStyle style);
|
||||
|
||||
This function is sets the GtkReliefStyle of the button. The
|
||||
relief style is one of: GTK_RELIEF_NORMAL, GTK_RELIEF_HALF,
|
||||
or GTK_RELIEF_NONE. The relief determines when the shadow of
|
||||
the button is drawn.
|
||||
|
||||
GtkReliefStyle gtk_button_get_relief (GtkButton *button);
|
||||
|
||||
This function returns the current relief of the button.
|
||||
|
||||
=head1 SIGNALS
|
||||
|
||||
"clicked"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the button is clicked. A click is
|
||||
a press and release of the button when the cursor is
|
||||
inside the button on release.
|
||||
|
||||
"pressed"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the left mouse button is pressed.
|
||||
|
||||
"released"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Gets emitted when the left mouse button is released and
|
||||
the widget was previously pressed.
|
||||
|
||||
"enter"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Emitted when the mouse cursor enters the button.
|
||||
|
||||
"leave"
|
||||
|
||||
void user_function (GtkWidget *widget, gpointer data);
|
||||
|
||||
Emitted when the mouse cursor leaves the button.
|
||||
|
||||
=head1 AUTHORS
|
||||
|
||||
The author of this man page is Shawn T. Amundson E<lt>amundson@gtk.orgE<gt>.
|
||||
For the authors of GTK+, see the AUTHORS file in the GTK+ distribution.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
8600
docs/tutorial/gtk_tut_fr.sgml
Normal file
8600
docs/tutorial/gtk_tut_fr.sgml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -391,7 +391,7 @@ When a widget receives the unmap signal, it must:
|
||||
2) If the widget does not have a window, unmap all child widgets
|
||||
3) Do any other functions related to taking the widget offscreen
|
||||
(for instance, removing popup windows...)
|
||||
3) Unset GTK_MAPPED
|
||||
4) Unset GTK_MAPPED
|
||||
|
||||
|
||||
The Unrealize signal
|
||||
|
||||
8
examples/calendar/Makefile
Normal file
8
examples/calendar/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
gcalendar: gcalendar.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` gcalendar.c -o gcalendar
|
||||
|
||||
clean:
|
||||
rm -f gcalendar
|
||||
362
examples/calendar/gcalendar.c
Normal file
362
examples/calendar/gcalendar.c
Normal file
@@ -0,0 +1,362 @@
|
||||
/* G Calendar
|
||||
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#define DEF_PAD 10
|
||||
#define DEF_PAD_SMALL 5
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
|
||||
typedef struct _CalendarData {
|
||||
GtkWidget *flag_checkboxes[5];
|
||||
gboolean settings[5];
|
||||
gchar *font;
|
||||
GtkWidget *font_dialog;
|
||||
GtkWidget *window;
|
||||
GtkWidget *selected;
|
||||
GtkWidget *selected_double_click;
|
||||
GtkWidget *month;
|
||||
} CalendarData;
|
||||
|
||||
void create_calendar();
|
||||
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data);
|
||||
void destroy (GtkWidget *widget, gpointer data);
|
||||
void day_selected_double_click (GtkWidget *widget, gpointer data);
|
||||
int main(int argc, char *argv[]);
|
||||
void calendar_month_changed (GtkWidget *widget, CalendarData *data);
|
||||
void calendar_day_selected (GtkWidget *widget, CalendarData *data);
|
||||
void calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data);
|
||||
|
||||
|
||||
void calendar_set_flags(CalendarData *calendar);
|
||||
void calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar);
|
||||
void calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar);
|
||||
void calendar_font_selection_destroy(GtkWidget * button, GtkWidget widget);
|
||||
void calendar_select_font(GtkWidget * button, CalendarData *calendar);
|
||||
void calendar_create_window_destroy(GtkWidget * ignore, CalendarData *calendar);
|
||||
void calendar_create_window(GtkWidget * ignored, CalendarData * calendar);
|
||||
void calendar_window_destroy(GtkWidget * ignore, CalendarData *calendar);
|
||||
void create_calendar();
|
||||
|
||||
/*
|
||||
* GtkCalendar
|
||||
*/
|
||||
|
||||
void
|
||||
calendar_month_changed (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->month), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_day_selected (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->selected), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->selected_double_click), buffer);
|
||||
}
|
||||
|
||||
enum {
|
||||
calendar_show_header,
|
||||
calendar_show_days,
|
||||
calendar_month_change,
|
||||
calendar_show_week,
|
||||
calendar_monday_first
|
||||
};
|
||||
|
||||
void
|
||||
calendar_set_flags(CalendarData *calendar)
|
||||
{
|
||||
gint i;
|
||||
gint options=0;
|
||||
for (i=0;i<5;i++)
|
||||
if (calendar->settings[i])
|
||||
{
|
||||
options=options + (1<<i);
|
||||
}
|
||||
if (calendar->window)
|
||||
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar)
|
||||
{
|
||||
gint i;
|
||||
gint j;
|
||||
j=0;
|
||||
for (i=0; i<5; i++)
|
||||
if (calendar->flag_checkboxes[i] == toggle)
|
||||
j = i;
|
||||
|
||||
calendar->settings[j]=!calendar->settings[j];
|
||||
calendar_set_flags(calendar);
|
||||
|
||||
}
|
||||
void
|
||||
calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
|
||||
calendar->font = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
|
||||
if (calendar->window)
|
||||
{
|
||||
font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog));
|
||||
if (font)
|
||||
{
|
||||
style = gtk_style_copy (gtk_widget_get_style (calendar->window));
|
||||
gdk_font_unref (style->font);
|
||||
style->font = font;
|
||||
gdk_font_ref (style->font);
|
||||
gtk_widget_set_style (calendar->window, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
calendar_select_font(GtkWidget * button, CalendarData *calendar)
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
if (!calendar->font_dialog) {
|
||||
window = gtk_font_selection_dialog_new ("Font Selection Dialog");
|
||||
g_return_if_fail(GTK_IS_FONT_SELECTION_DIALOG(window));
|
||||
calendar->font_dialog = window;
|
||||
|
||||
gtk_window_position (GTK_WINDOW (window), GTK_WIN_POS_MOUSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&calendar->font_dialog);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button),
|
||||
"clicked", GTK_SIGNAL_FUNC(calendar_font_selection_ok),
|
||||
calendar);
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (calendar->font_dialog));
|
||||
}
|
||||
window=calendar->font_dialog;
|
||||
if (!GTK_WIDGET_VISIBLE (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
create_calendar()
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *vbox2, *vbox3;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *hbbox;
|
||||
GtkWidget *calendar;
|
||||
GtkWidget *toggle;
|
||||
GtkWidget *button;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *label;
|
||||
GtkWidget *bbox;
|
||||
static CalendarData calendar_data;
|
||||
gint i;
|
||||
|
||||
struct {
|
||||
char *label;
|
||||
} flags[] =
|
||||
{
|
||||
{ "Show Heading" },
|
||||
{ "Show Day Names" },
|
||||
{ "No Month Change" },
|
||||
{ "Show Week Numbers" },
|
||||
{ "Week Start Monday" }
|
||||
};
|
||||
|
||||
|
||||
calendar_data.window = NULL;
|
||||
calendar_data.font = NULL;
|
||||
calendar_data.font_dialog = NULL;
|
||||
|
||||
for (i=0; i<5; i++) {
|
||||
calendar_data.settings[i]=0;
|
||||
}
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 5);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "delete-event",
|
||||
GTK_SIGNAL_FUNC(gtk_false),
|
||||
NULL);
|
||||
|
||||
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, TRUE);
|
||||
|
||||
vbox = gtk_vbox_new(FALSE, DEF_PAD);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
|
||||
/*
|
||||
* The top part of the window, Calendar, flags and fontsel.
|
||||
*/
|
||||
|
||||
hbox = gtk_hbox_new(FALSE, DEF_PAD);
|
||||
gtk_box_pack_start (GTK_BOX(vbox), hbox, TRUE, TRUE, DEF_PAD);
|
||||
hbbox = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(hbox), hbbox, FALSE, FALSE, DEF_PAD);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox), GTK_BUTTONBOX_SPREAD);
|
||||
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbbox), 5);
|
||||
|
||||
/* Calendar widget */
|
||||
frame = gtk_frame_new("Calendar");
|
||||
gtk_box_pack_start(GTK_BOX(hbbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
calendar=gtk_calendar_new();
|
||||
calendar_data.window = calendar;
|
||||
calendar_set_flags(&calendar_data);
|
||||
gtk_calendar_mark_day ( GTK_CALENDAR(calendar), 19);
|
||||
gtk_container_add( GTK_CONTAINER( frame), calendar);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "month_changed",
|
||||
GTK_SIGNAL_FUNC (calendar_month_changed),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
|
||||
&calendar_data);
|
||||
|
||||
|
||||
separator = gtk_vseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), separator, FALSE, TRUE, 0);
|
||||
|
||||
vbox2 = gtk_vbox_new(FALSE, DEF_PAD);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, DEF_PAD);
|
||||
|
||||
/* Build the Right frame with the flags in */
|
||||
|
||||
frame = gtk_frame_new("Flags");
|
||||
gtk_box_pack_start(GTK_BOX(vbox2), frame, TRUE, TRUE, DEF_PAD);
|
||||
vbox3 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox3);
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
toggle = gtk_check_button_new_with_label(flags[i].label);
|
||||
gtk_signal_connect (GTK_OBJECT (toggle),
|
||||
"toggled",
|
||||
GTK_SIGNAL_FUNC(calendar_toggle_flag),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox3), toggle, TRUE, TRUE, 0);
|
||||
calendar_data.flag_checkboxes[i]=toggle;
|
||||
}
|
||||
/* Build the right font-button */
|
||||
button = gtk_button_new_with_label("Font...");
|
||||
gtk_signal_connect (GTK_OBJECT (button),
|
||||
"clicked",
|
||||
GTK_SIGNAL_FUNC(calendar_select_font),
|
||||
&calendar_data);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||
|
||||
/*
|
||||
* Build the Signal-event part.
|
||||
*/
|
||||
|
||||
frame = gtk_frame_new("Signal events");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Day selected:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.selected = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Day selected double click:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.selected_double_click = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected_double_click, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Month change:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.month = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.month, FALSE, TRUE, 0);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
|
||||
gtk_widget_show_all(window);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
gtk_set_locale ();
|
||||
gtk_init (&argc, &argv);
|
||||
create_calendar();
|
||||
gtk_main ();
|
||||
return 0;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
filesel: filesel.c
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* menufactory.c */
|
||||
/* example-start menu menufactory.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <strings.h>
|
||||
|
||||
#include "mfmain.h"
|
||||
|
||||
|
||||
static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * path);
|
||||
static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar key, gchar modifiers, gchar * path);
|
||||
void menus_init(void);
|
||||
void menus_create(GtkMenuEntry * entries, int nmenu_entries);
|
||||
static void print_hello(GtkWidget *widget, gpointer data);
|
||||
|
||||
|
||||
/* this is the GtkMenuEntry structure used to create new menus. The
|
||||
@@ -24,128 +18,37 @@ void menus_create(GtkMenuEntry * entries, int nmenu_entries);
|
||||
|
||||
static GtkMenuEntry menu_items[] =
|
||||
{
|
||||
{"<Main>/File/New", "<control>N", NULL, NULL},
|
||||
{"<Main>/File/Open", "<control>O", NULL, NULL},
|
||||
{"<Main>/File/Save", "<control>S", NULL, NULL},
|
||||
{"<Main>/File/Save as", NULL, NULL, NULL},
|
||||
{"<Main>/File/<separator>", NULL, NULL, NULL},
|
||||
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
|
||||
{"<Main>/Options/Test", NULL, NULL, NULL}
|
||||
{"<Main>/File/New", "<control>N", print_hello, NULL},
|
||||
{"<Main>/File/Open", "<control>O", print_hello, NULL},
|
||||
{"<Main>/File/Save", "<control>S", print_hello, NULL},
|
||||
{"<Main>/File/Save as", NULL, NULL, NULL},
|
||||
{"<Main>/File/<separator>", NULL, NULL, NULL},
|
||||
{"<Main>/File/Quit", "<control>Q", file_quit_cmd_callback, "OK, I'll quit"},
|
||||
{"<Main>/Options/Test", NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
/* calculate the number of menu_item's */
|
||||
static int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
|
||||
|
||||
static int initialize = TRUE;
|
||||
static GtkMenuFactory *factory = NULL;
|
||||
static GtkMenuFactory *subfactory[1];
|
||||
static GHashTable *entry_ht = NULL;
|
||||
|
||||
void get_main_menu(GtkWidget ** menubar, GtkAcceleratorTable ** table)
|
||||
static void
|
||||
print_hello(GtkWidget *widget, gpointer data)
|
||||
{
|
||||
if (initialize)
|
||||
menus_init();
|
||||
printf("hello!\n");
|
||||
}
|
||||
|
||||
void get_main_menu(GtkWidget *window, GtkWidget ** menubar)
|
||||
{
|
||||
int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
|
||||
GtkMenuFactory *factory;
|
||||
GtkMenuFactory *subfactory;
|
||||
|
||||
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
subfactory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
|
||||
gtk_menu_factory_add_subfactory(factory, subfactory, "<Main>");
|
||||
gtk_menu_factory_add_entries(factory, menu_items, nmenu_items);
|
||||
gtk_window_add_accelerator_table(GTK_WINDOW(window), subfactory->table);
|
||||
|
||||
if (menubar)
|
||||
*menubar = subfactory[0]->widget;
|
||||
if (table)
|
||||
*table = subfactory[0]->table;
|
||||
*menubar = subfactory->widget;
|
||||
}
|
||||
|
||||
void menus_init(void)
|
||||
{
|
||||
if (initialize) {
|
||||
initialize = FALSE;
|
||||
|
||||
factory = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
subfactory[0] = gtk_menu_factory_new(GTK_MENU_FACTORY_MENU_BAR);
|
||||
|
||||
gtk_menu_factory_add_subfactory(factory, subfactory[0], "<Main>");
|
||||
menus_create(menu_items, nmenu_items);
|
||||
}
|
||||
}
|
||||
|
||||
void menus_create(GtkMenuEntry * entries, int nmenu_entries)
|
||||
{
|
||||
char *accelerator;
|
||||
int i;
|
||||
|
||||
if (initialize)
|
||||
menus_init();
|
||||
|
||||
if (entry_ht)
|
||||
for (i = 0; i < nmenu_entries; i++) {
|
||||
accelerator = g_hash_table_lookup(entry_ht, entries[i].path);
|
||||
if (accelerator) {
|
||||
if (accelerator[0] == '\0')
|
||||
entries[i].accelerator = NULL;
|
||||
else
|
||||
entries[i].accelerator = accelerator;
|
||||
}
|
||||
}
|
||||
gtk_menu_factory_add_entries(factory, entries, nmenu_entries);
|
||||
|
||||
for (i = 0; i < nmenu_entries; i++)
|
||||
if (entries[i].widget) {
|
||||
gtk_signal_connect(GTK_OBJECT(entries[i].widget), "install_accelerator",
|
||||
(GtkSignalFunc) menus_install_accel,
|
||||
entries[i].path);
|
||||
gtk_signal_connect(GTK_OBJECT(entries[i].widget), "remove_accelerator",
|
||||
(GtkSignalFunc) menus_remove_accel,
|
||||
entries[i].path);
|
||||
}
|
||||
}
|
||||
|
||||
static gint menus_install_accel(GtkWidget * widget, gchar * signal_name, gchar key, gchar modifiers, gchar * path)
|
||||
{
|
||||
char accel[64];
|
||||
char *t1, t2[2];
|
||||
|
||||
accel[0] = '\0';
|
||||
if (modifiers & GDK_CONTROL_MASK)
|
||||
strcat(accel, "<control>");
|
||||
if (modifiers & GDK_SHIFT_MASK)
|
||||
strcat(accel, "<shift>");
|
||||
if (modifiers & GDK_MOD1_MASK)
|
||||
strcat(accel, "<alt>");
|
||||
|
||||
t2[0] = key;
|
||||
t2[1] = '\0';
|
||||
strcat(accel, t2);
|
||||
|
||||
if (entry_ht) {
|
||||
t1 = g_hash_table_lookup(entry_ht, path);
|
||||
g_free(t1);
|
||||
} else
|
||||
entry_ht = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
|
||||
g_hash_table_insert(entry_ht, path, g_strdup(accel));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void menus_remove_accel(GtkWidget * widget, gchar * signal_name, gchar * path)
|
||||
{
|
||||
char *t;
|
||||
|
||||
if (entry_ht) {
|
||||
t = g_hash_table_lookup(entry_ht, path);
|
||||
g_free(t);
|
||||
|
||||
g_hash_table_insert(entry_ht, path, g_strdup(""));
|
||||
}
|
||||
}
|
||||
|
||||
void menus_set_sensitive(char *path, int sensitive)
|
||||
{
|
||||
GtkMenuPath *menu_path;
|
||||
|
||||
if (initialize)
|
||||
menus_init();
|
||||
|
||||
menu_path = gtk_menu_factory_find(factory, path);
|
||||
if (menu_path)
|
||||
gtk_widget_set_sensitive(menu_path->widget, sensitive);
|
||||
else
|
||||
g_warning("Unable to set sensitivity for menu which doesn't exist: %s", path);
|
||||
}
|
||||
/* example-end */
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* menufactory.h */
|
||||
/* example-start menu menufactory.h */
|
||||
|
||||
#ifndef __MENUFACTORY_H__
|
||||
#define __MENUFACTORY_H__
|
||||
@@ -9,11 +7,12 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void get_main_menu (GtkWidget **menubar, GtkAcceleratorTable **table);
|
||||
void menus_create(GtkMenuEntry *entries, int nmenu_entries);
|
||||
void get_main_menu (GtkWidget *, GtkWidget **menubar);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MENUFACTORY_H__ */
|
||||
|
||||
/* example-end */
|
||||
|
||||
@@ -1,21 +1,16 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* mfmain.c */
|
||||
/* example-start menu mfmain.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "mfmain.h"
|
||||
#include "menufactory.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *menubar;
|
||||
|
||||
GtkAcceleratorTable *accel;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
@@ -30,8 +25,7 @@ int main(int argc, char *argv[])
|
||||
gtk_container_add(GTK_CONTAINER(window), main_vbox);
|
||||
gtk_widget_show(main_vbox);
|
||||
|
||||
get_main_menu(&menubar, &accel);
|
||||
gtk_window_add_accelerator_table(GTK_WINDOW(window), accel);
|
||||
get_main_menu(window, &menubar);
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show(menubar);
|
||||
|
||||
@@ -50,3 +44,5 @@ void file_quit_cmd_callback (GtkWidget *widget, gpointer data)
|
||||
g_print ("%s\n", (char *) data);
|
||||
gtk_exit(0);
|
||||
}
|
||||
|
||||
/* example-end */
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/* This file extracted from the GTK tutorial. */
|
||||
|
||||
/* mfmain.h */
|
||||
/* example-start menu mfmain.h */
|
||||
|
||||
#ifndef __MFMAIN_H__
|
||||
#define __MFMAIN_H__
|
||||
@@ -17,3 +15,5 @@ void file_quit_cmd_callback(GtkWidget *widget, gpointer data);
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MFMAIN_H__ */
|
||||
|
||||
/* example-end */
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
/* packbox.c */
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
#include <stdio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
delete_event (GtkWidget *widget, GdkEvent *event, gpointer data)
|
||||
|
||||
8
examples/rangewidgets/Makefile
Normal file
8
examples/rangewidgets/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
rangewidgets: rangewidgets.c
|
||||
$(CC) `gtk-config --cflags` `gtk-config --libs` rangewidgets.c -o rangewidgets
|
||||
|
||||
clean:
|
||||
rm -f *.o rangewidgets
|
||||
287
examples/rangewidgets/rangewidgets.c
Normal file
287
examples/rangewidgets/rangewidgets.c
Normal file
@@ -0,0 +1,287 @@
|
||||
/* example-start rangewidgets rangewidgets.c */
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
GtkWidget *hscale, *vscale;
|
||||
|
||||
void cb_pos_menu_select (GtkWidget *item, GtkPositionType pos)
|
||||
{
|
||||
/* set the value position on both scale widgets */
|
||||
gtk_scale_set_value_pos (GTK_SCALE (hscale), pos);
|
||||
gtk_scale_set_value_pos (GTK_SCALE (vscale), pos);
|
||||
}
|
||||
|
||||
void cb_update_menu_select (GtkWidget *item, GtkUpdateType policy)
|
||||
{
|
||||
/* set the update policy for both scale widgets */
|
||||
gtk_range_set_update_policy (GTK_RANGE (hscale), policy);
|
||||
gtk_range_set_update_policy (GTK_RANGE (vscale), policy);
|
||||
}
|
||||
|
||||
void cb_digits_scale (GtkAdjustment *adj)
|
||||
{
|
||||
/* set the number of decimal places to which adj->vaule is rounded
|
||||
*/
|
||||
gtk_scale_set_digits (GTK_SCALE (hscale), (gint) adj->value);
|
||||
gtk_scale_set_digits (GTK_SCALE (vscale), (gint) adj->value);
|
||||
}
|
||||
|
||||
void cb_page_size (GtkAdjustment *get, GtkAdjustment *set)
|
||||
{
|
||||
/* set the page size and page increment size of the sample
|
||||
adjustment to the value specified by the "Page Size" scale */
|
||||
set->page_size = get->value;
|
||||
set->page_increment = get->value;
|
||||
/* now emit the "changed" signal to reconfigure all the widgets that
|
||||
are attached to this adjustment */
|
||||
gtk_signal_emit_by_name (GTK_OBJECT (set), "changed");
|
||||
}
|
||||
|
||||
void cb_draw_value (GtkToggleButton *button)
|
||||
{
|
||||
/* turn the value display on the scale widgets off or on depending
|
||||
on the state of the checkbutton */
|
||||
gtk_scale_set_draw_value (GTK_SCALE (hscale), button->active);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (vscale), button->active);
|
||||
}
|
||||
|
||||
/* convenience functions */
|
||||
|
||||
GtkWidget *make_menu_item (gchar *name, GtkSignalFunc callback,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *item;
|
||||
|
||||
item = gtk_menu_item_new_with_label (name);
|
||||
gtk_signal_connect (GTK_OBJECT (item), "activate",
|
||||
callback, data);
|
||||
gtk_widget_show (item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void scale_set_default_values (GtkScale *scale)
|
||||
{
|
||||
gtk_range_set_update_policy (GTK_RANGE (scale),
|
||||
GTK_UPDATE_CONTINUOUS);
|
||||
gtk_scale_set_digits (scale, 1);
|
||||
gtk_scale_set_value_pos (scale, GTK_POS_TOP);
|
||||
gtk_scale_set_draw_value (scale, TRUE);
|
||||
}
|
||||
|
||||
/* makes the sample window */
|
||||
|
||||
void create_range_controls (void)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *box1, *box2, *box3;
|
||||
GtkWidget *button;
|
||||
GtkWidget *scrollbar;
|
||||
GtkWidget *separator;
|
||||
GtkWidget *opt, *menu, *item;
|
||||
GtkWidget *label;
|
||||
GtkWidget *scale;
|
||||
GtkObject *adj1, *adj2;
|
||||
|
||||
/* standard window-creating stuff */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "range controls");
|
||||
|
||||
box1 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box1);
|
||||
gtk_widget_show (box1);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* value, lower, upper, step_increment, page_increment, page_size */
|
||||
/* note that the page_size value only makes a difference for
|
||||
scrollbar widgets, and the highest value you'll get is actually
|
||||
(upper - page_size). */
|
||||
adj1 = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
|
||||
|
||||
vscale = gtk_vscale_new (GTK_ADJUSTMENT (adj1));
|
||||
scale_set_default_values (GTK_SCALE (vscale));
|
||||
gtk_box_pack_start (GTK_BOX (box2), vscale, TRUE, TRUE, 0);
|
||||
gtk_widget_show (vscale);
|
||||
|
||||
box3 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_box_pack_start (GTK_BOX (box2), box3, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box3);
|
||||
|
||||
/* reuse the same adjustment */
|
||||
hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj1));
|
||||
gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 30);
|
||||
scale_set_default_values (GTK_SCALE (hscale));
|
||||
gtk_box_pack_start (GTK_BOX (box3), hscale, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hscale);
|
||||
|
||||
/* reuse the same adjustment again */
|
||||
scrollbar = gtk_hscrollbar_new (GTK_ADJUSTMENT (adj1));
|
||||
/* notice how this causes the scales to always be updated
|
||||
continuously when the scrollbar is moved */
|
||||
gtk_range_set_update_policy (GTK_RANGE (scrollbar),
|
||||
GTK_UPDATE_CONTINUOUS);
|
||||
gtk_box_pack_start (GTK_BOX (box3), scrollbar, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrollbar);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* a checkbutton to control whether the value is displayed or not */
|
||||
button = gtk_check_button_new_with_label
|
||||
("Display value on scale widgets");
|
||||
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled", GTK_SIGNAL_FUNC
|
||||
(cb_draw_value), NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
|
||||
/* an option menu to change the position of the value */
|
||||
label = gtk_label_new ("Scale Value Position:");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
opt = gtk_option_menu_new();
|
||||
menu = gtk_menu_new();
|
||||
|
||||
item = make_menu_item ("Top", GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_TOP));
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
|
||||
item = make_menu_item ("Bottom", GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_BOTTOM));
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
|
||||
item = make_menu_item ("Left", GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_LEFT));
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
|
||||
item = make_menu_item ("Right", GTK_SIGNAL_FUNC (cb_pos_menu_select),
|
||||
GINT_TO_POINTER (GTK_POS_RIGHT));
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu);
|
||||
gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0);
|
||||
gtk_widget_show (opt);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
|
||||
/* yet another option menu, this time for the update policy of the
|
||||
scale widgets */
|
||||
label = gtk_label_new ("Scale Update Policy:");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
opt = gtk_option_menu_new();
|
||||
menu = gtk_menu_new();
|
||||
|
||||
item = make_menu_item ("Continuous",
|
||||
GTK_SIGNAL_FUNC (cb_update_menu_select),
|
||||
GINT_TO_POINTER (GTK_UPDATE_CONTINUOUS));
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
|
||||
item = make_menu_item ("Discontinuous",
|
||||
GTK_SIGNAL_FUNC (cb_update_menu_select),
|
||||
GINT_TO_POINTER (GTK_UPDATE_DISCONTINUOUS));
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
|
||||
item = make_menu_item ("Delayed",
|
||||
GTK_SIGNAL_FUNC (cb_update_menu_select),
|
||||
GINT_TO_POINTER (GTK_UPDATE_DELAYED));
|
||||
gtk_menu_append (GTK_MENU (menu), item);
|
||||
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (opt), menu);
|
||||
gtk_box_pack_start (GTK_BOX (box2), opt, TRUE, TRUE, 0);
|
||||
gtk_widget_show (opt);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
|
||||
/* a GtkHScale widget for adjusting the number of digits on the
|
||||
sample scales. */
|
||||
label = gtk_label_new ("Scale Digits:");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj2 = gtk_adjustment_new (1.0, 0.0, 5.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adj2), "value_changed",
|
||||
GTK_SIGNAL_FUNC (cb_digits_scale), NULL);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
|
||||
/* And, one last GtkHScale widget for adjusting the page size of the
|
||||
scrollbar. */
|
||||
label = gtk_label_new ("Scrollbar Page Size:");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj2 = gtk_adjustment_new (1.0, 1.0, 101.0, 1.0, 1.0, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (adj2), "value_changed",
|
||||
GTK_SIGNAL_FUNC (cb_page_size), adj1);
|
||||
scale = gtk_hscale_new (GTK_ADJUSTMENT (adj2));
|
||||
gtk_scale_set_digits (GTK_SCALE (scale), 0);
|
||||
gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scale);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
box2 = gtk_vbox_new (FALSE, 10);
|
||||
gtk_container_border_width (GTK_CONTAINER (box2), 10);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
NULL);
|
||||
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
create_range_controls();
|
||||
|
||||
gtk_main();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* example-end */
|
||||
@@ -7,3 +7,4 @@ _libs
|
||||
libgdk-1.1.la
|
||||
gdkcursors.h
|
||||
gdkkeysyms.h
|
||||
libgdk.la
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
|
||||
gdkincludedir = $(includedir)/gdk
|
||||
|
||||
lib_LTLIBRARIES = libgdk-1.1.la
|
||||
lib_LTLIBRARIES = libgdk.la
|
||||
DEFS += -DG_LOG_DOMAIN=\"Gdk\"
|
||||
|
||||
libgdk_1_1_la_SOURCES = \
|
||||
libgdk_la_SOURCES = \
|
||||
gdk.c \
|
||||
gdkcc.c \
|
||||
gdkcolor.c \
|
||||
@@ -49,9 +50,9 @@ gdkinclude_HEADERS = \
|
||||
gdktypes.h \
|
||||
gdkx.h
|
||||
|
||||
libgdk_1_1_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||
@x_ldflags@ @x_libs@
|
||||
libgdk_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) \
|
||||
@x_ldflags@ @x_libs@
|
||||
|
||||
INCLUDES = -I$(top_srcdir) @GLIB_CFLAGS@ @x_cflags@
|
||||
|
||||
@@ -66,15 +67,14 @@ gxid_LDADD = \
|
||||
@x_libs@ \
|
||||
-lm
|
||||
|
||||
BUILT_SOURCES = gdkcursors.h gdkkeysyms.h
|
||||
|
||||
EXTRA_DIST = makecursors.awk makekeysyms.awk
|
||||
|
||||
gdkcursors.h:
|
||||
awk -f $(srcdir)/makecursors.awk @x_includes@/X11/cursorfont.h > $@
|
||||
|
||||
gdkkeysyms.h:
|
||||
awk -f $(srcdir)/makekeysyms.awk @x_includes@/X11/keysymdef.h > $@
|
||||
X-derived-headers:
|
||||
sed -e 's/^#define[ ]*XC\([^ ]*\)[ ]*\([^ ]*\)[ ]*.*$$/GDK\1 = \2,/' \
|
||||
-e 'tb' -e 'd' -e ':b' \
|
||||
-e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
|
||||
< @x_includes@/X11/cursorfont.h > gdkcursors.h ; \
|
||||
sed -e 's/^#define[ ]*XK\([^ ]*\)[ ]*\([^ ]*\)[ ]*.*$$/#define GDK\1 \2/' \
|
||||
-e 'tb' -e 'd' -e ':b' -e 's/ 0X/ 0x/' \
|
||||
< @x_includes@/X11/keysymdef.h > gdkkeysyms.h
|
||||
|
||||
.PHONY: files
|
||||
|
||||
|
||||
225
gdk/gdk.h
225
gdk/gdk.h
@@ -25,7 +25,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
@@ -41,8 +40,9 @@ 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);
|
||||
void gdk_event_free (GdkEvent *event);
|
||||
GdkEvent *gdk_event_copy (GdkEvent *event);
|
||||
void gdk_event_free (GdkEvent *event);
|
||||
guint32 gdk_event_get_time (GdkEvent *event);
|
||||
|
||||
void gdk_set_show_events (gint show_events);
|
||||
void gdk_set_use_xshm (gint use_xshm);
|
||||
@@ -196,52 +196,79 @@ void gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
GdkBitmap *shape_mask,
|
||||
gint offset_x,
|
||||
gint offset_y);
|
||||
|
||||
/*
|
||||
* Drag & Drop
|
||||
* Algorithm (drop source):
|
||||
* A window being dragged will be sent a GDK_DRAG_BEGIN message.
|
||||
* It will then do gdk_dnd_drag_addwindow() for any other windows that are to be
|
||||
* dragged.
|
||||
* When we get a DROP_ENTER incoming, we send it on to the window in question.
|
||||
* That window needs to use gdk_dnd_drop_enter_reply() to indicate the state of
|
||||
* things (it must call that even if it's not going to accept the drop)
|
||||
*
|
||||
* These two turn on/off drag or drop, and if enabling it also
|
||||
* sets the list of types supported. The list of types passed in
|
||||
* should be in order of decreasing preference.
|
||||
/*
|
||||
* This routine allows you to quickly take the shapes of all the child windows
|
||||
* of a window and use their shapes as the shape mask for this window - useful
|
||||
* for container windows that dont want to look like a big box
|
||||
*
|
||||
* - Raster
|
||||
*/
|
||||
void gdk_window_dnd_drag_set (GdkWindow *window,
|
||||
guint8 drag_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes);
|
||||
void gdk_window_set_child_shapes (GdkWindow *window);
|
||||
|
||||
/*
|
||||
*XXX todo: add a GDK_DROP_ENTER which can look at actual data
|
||||
/*
|
||||
* This routine allows you to merge (ie ADD) child shapes to your
|
||||
* own window's shape keeping its current shape and ADDING the shild
|
||||
* shapes to it.
|
||||
*
|
||||
* - Raster
|
||||
*/
|
||||
void gdk_window_dnd_drop_set (GdkWindow *window,
|
||||
guint8 drop_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes,
|
||||
guint8 destructive_op);
|
||||
void gdk_window_merge_child_shapes (GdkWindow *window);
|
||||
|
||||
/*
|
||||
* This is used by the GDK_DRAG_BEGIN handler. An example of usage would be a
|
||||
* file manager where multiple icons were selected and the drag began.
|
||||
* The icon that the drag actually began on would gdk_dnd_drag_addwindow
|
||||
* for all the other icons that were being dragged...
|
||||
/*
|
||||
* The following function adds a global filter for all client
|
||||
* messages of type message_type
|
||||
*/
|
||||
void gdk_dnd_drag_addwindow (GdkWindow *window);
|
||||
void gdk_window_dnd_data_set (GdkWindow *window,
|
||||
GdkEvent *event,
|
||||
gpointer data,
|
||||
gulong data_numbytes);
|
||||
void gdk_dnd_set_drag_cursors(GdkCursor *default_cursor,
|
||||
GdkCursor *goahead_cursor);
|
||||
void gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
|
||||
GdkPoint *default_hotspot,
|
||||
GdkWindow *goahead_pixmapwin,
|
||||
GdkPoint *goahead_hotspot);
|
||||
void gdk_add_client_message_filter (GdkAtom message_type,
|
||||
GdkFilterFunc func,
|
||||
gpointer data);
|
||||
|
||||
/* Drag and Drop */
|
||||
|
||||
GdkDragContext * gdk_drag_context_new (void);
|
||||
void gdk_drag_context_ref (GdkDragContext *context);
|
||||
void gdk_drag_context_unref (GdkDragContext *context);
|
||||
|
||||
/* Destination side */
|
||||
|
||||
void gdk_drag_status (GdkDragContext *context,
|
||||
GdkDragAction action,
|
||||
guint32 time);
|
||||
void gdk_drop_reply (GdkDragContext *context,
|
||||
gboolean ok,
|
||||
guint32 time);
|
||||
void gdk_drop_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time);
|
||||
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
|
||||
|
||||
/* Source side */
|
||||
|
||||
GdkDragContext * gdk_drag_begin (GdkWindow *window,
|
||||
GList *targets,
|
||||
GdkDragAction actions);
|
||||
gboolean gdk_drag_get_protocol (guint32 xid,
|
||||
GdkDragProtocol *protocol);
|
||||
void gdk_drag_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkWindow **dest_window,
|
||||
GdkDragProtocol *protocol);
|
||||
gboolean gdk_drag_motion (GdkDragContext *context,
|
||||
GdkWindow *dest_window,
|
||||
GdkDragProtocol protocol,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragAction action,
|
||||
guint32 time);
|
||||
void gdk_drag_drop (GdkDragContext *context,
|
||||
guint32 time);
|
||||
void gdk_drag_abort (GdkDragContext *context,
|
||||
guint32 time);
|
||||
|
||||
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
|
||||
|
||||
/* GdkWindow */
|
||||
|
||||
void gdk_window_set_hints (GdkWindow *window,
|
||||
gint x,
|
||||
@@ -282,6 +309,9 @@ GdkWindowType gdk_window_get_type (GdkWindow *window);
|
||||
gint gdk_window_get_origin (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void gdk_window_get_root_origin (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y);
|
||||
GdkWindow* gdk_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
@@ -307,6 +337,13 @@ void gdk_window_set_functions (GdkWindow *window,
|
||||
GdkWMFunction functions);
|
||||
GList * gdk_window_get_toplevels (void);
|
||||
|
||||
void gdk_window_register_dnd (GdkWindow *window);
|
||||
|
||||
void gdk_drawable_set_data (GdkDrawable *drawable,
|
||||
const gchar *key,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy_func);
|
||||
|
||||
|
||||
/* Cursors
|
||||
*/
|
||||
@@ -420,10 +457,10 @@ void gdk_bitmap_unref (GdkBitmap *pixmap);
|
||||
|
||||
/* Images
|
||||
*/
|
||||
GdkImage* gdk_image_new_bitmap(GdkVisual *,
|
||||
gpointer,
|
||||
gint,
|
||||
gint);
|
||||
GdkImage* gdk_image_new_bitmap(GdkVisual *visual,
|
||||
gpointer data,
|
||||
gint width,
|
||||
gint height);
|
||||
GdkImage* gdk_image_new (GdkImageType type,
|
||||
GdkVisual *visual,
|
||||
gint width,
|
||||
@@ -455,13 +492,39 @@ gint gdk_colormap_get_system_size (void);
|
||||
|
||||
void gdk_colormap_change (GdkColormap *colormap,
|
||||
gint ncolors);
|
||||
void gdk_colors_store (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
|
||||
|
||||
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success);
|
||||
gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
gboolean writeable,
|
||||
gboolean best_match);
|
||||
void gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
|
||||
GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
|
||||
|
||||
GdkColor *gdk_color_copy (GdkColor *color);
|
||||
void gdk_color_free (GdkColor *color);
|
||||
|
||||
gint gdk_color_parse (const gchar *spec,
|
||||
GdkColor *color);
|
||||
guint gdk_color_hash (const GdkColor *colora,
|
||||
const GdkColor *colorb);
|
||||
gint gdk_color_equal (const GdkColor *colora,
|
||||
const GdkColor *colorb);
|
||||
|
||||
|
||||
/* The following functions are deprecated */
|
||||
void gdk_colors_store (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
gint gdk_colors_alloc (GdkColormap *colormap,
|
||||
gint contiguous,
|
||||
gulong *planes,
|
||||
@@ -476,14 +539,10 @@ gint gdk_color_white (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_black (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_parse (const gchar *spec,
|
||||
GdkColor *color);
|
||||
gint gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_change (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_equal (GdkColor *colora,
|
||||
GdkColor *colorb);
|
||||
|
||||
|
||||
/* Fonts
|
||||
@@ -517,6 +576,21 @@ gint gdk_text_height (GdkFont *font,
|
||||
gint gdk_char_height (GdkFont *font,
|
||||
gchar character);
|
||||
|
||||
void gdk_text_extents (GdkFont *font,
|
||||
const gchar *text,
|
||||
gint text_length,
|
||||
gint *lbearing,
|
||||
gint *rbearing,
|
||||
gint *width,
|
||||
gint *ascent,
|
||||
gint *descent);
|
||||
void gdk_string_extents (GdkFont *font,
|
||||
const gchar *string,
|
||||
gint *lbearing,
|
||||
gint *rbearing,
|
||||
gint *width,
|
||||
gint *ascent,
|
||||
gint *descent);
|
||||
|
||||
/* Drawing
|
||||
*/
|
||||
@@ -669,6 +743,9 @@ void gdk_property_delete (GdkWindow *window,
|
||||
gint gdk_rectangle_intersect (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest);
|
||||
void gdk_rectangle_union (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest);
|
||||
|
||||
/* XInput support
|
||||
*/
|
||||
@@ -707,22 +784,27 @@ GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
|
||||
/* International Input Method Support Functions
|
||||
*/
|
||||
|
||||
gint gdk_im_ready (void);
|
||||
gint gdk_im_ready (void);
|
||||
|
||||
void gdk_im_begin (GdkIC ic, GdkWindow* window);
|
||||
void gdk_im_end (void);
|
||||
GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
|
||||
GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
|
||||
GdkIC gdk_ic_new (GdkWindow* client_window,
|
||||
GdkWindow* focus_window,
|
||||
GdkIMStyle style, ...);
|
||||
void gdk_ic_destroy (GdkIC ic);
|
||||
GdkIMStyle gdk_ic_get_style (GdkIC ic);
|
||||
void gdk_ic_set_values (GdkIC ic, ...);
|
||||
void gdk_ic_get_values (GdkIC ic, ...);
|
||||
void gdk_ic_set_attr (GdkIC ic, const char *target, ...);
|
||||
void gdk_ic_get_attr (GdkIC ic, const char *target, ...);
|
||||
GdkEventMask gdk_ic_get_events (GdkIC ic);
|
||||
void gdk_im_begin (GdkIC ic,
|
||||
GdkWindow* window);
|
||||
void gdk_im_end (void);
|
||||
GdkIMStyle gdk_im_decide_style (GdkIMStyle supported_style);
|
||||
GdkIMStyle gdk_im_set_best_style (GdkIMStyle best_allowed_style);
|
||||
GdkIC gdk_ic_new (GdkWindow* client_window,
|
||||
GdkWindow* focus_window,
|
||||
GdkIMStyle style, ...);
|
||||
void gdk_ic_destroy (GdkIC ic);
|
||||
GdkIMStyle gdk_ic_get_style (GdkIC ic);
|
||||
void gdk_ic_set_values (GdkIC ic,
|
||||
...);
|
||||
void gdk_ic_get_values (GdkIC ic,
|
||||
...);
|
||||
void gdk_ic_set_attr (GdkIC ic,
|
||||
const char *target, ...);
|
||||
void gdk_ic_get_attr (GdkIC ic,
|
||||
const char *target, ...);
|
||||
GdkEventMask gdk_ic_get_events (GdkIC ic);
|
||||
|
||||
/* Color Context */
|
||||
|
||||
@@ -832,6 +914,8 @@ void gdk_threads_wake (void);
|
||||
|
||||
/* Miscellaneous */
|
||||
void gdk_event_send_clientmessage_toall (GdkEvent *event);
|
||||
gboolean gdk_event_send_client_message (GdkEvent *event,
|
||||
guint32 xid);
|
||||
|
||||
/* Key values
|
||||
*/
|
||||
@@ -842,6 +926,7 @@ guint gdk_keyval_to_lower (guint keyval);
|
||||
gboolean gdk_keyval_is_upper (guint keyval);
|
||||
gboolean gdk_keyval_is_lower (guint keyval);
|
||||
|
||||
|
||||
#include <gdk/gdkrgb.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
954
gdk/gdkcc.c
954
gdk/gdkcc.c
File diff suppressed because it is too large
Load Diff
695
gdk/gdkcolor.c
695
gdk/gdkcolor.c
@@ -16,9 +16,11 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <time.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkx.h"
|
||||
|
||||
|
||||
static gint gdk_colormap_match_color (GdkColormap *cmap,
|
||||
@@ -51,8 +53,12 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
private->visual = visual;
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
|
||||
private->hash = NULL;
|
||||
private->last_sync_time = 0;
|
||||
private->info = NULL;
|
||||
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
colormap->size = visual->colormap_size;
|
||||
@@ -62,6 +68,12 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
private->info = g_new0 (GdkColorInfo, colormap->size);
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
|
||||
(GCompareFunc) gdk_color_equal);
|
||||
|
||||
private->private_val = private_cmap;
|
||||
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
|
||||
xvisual, (private_cmap) ? (AllocAll) : (AllocNone));
|
||||
@@ -133,12 +145,15 @@ gdk_colormap_real_destroy (GdkColormap *colormap)
|
||||
GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
if (private->ref_count > 0)
|
||||
return;
|
||||
g_return_if_fail (private->ref_count > 0);
|
||||
|
||||
gdk_colormap_remove (colormap);
|
||||
XFreeColormap (private->xdisplay, private->xcolormap);
|
||||
|
||||
if (private->hash)
|
||||
g_hash_table_destroy (private->hash);
|
||||
|
||||
g_free (private->info);
|
||||
g_free (colormap->colors);
|
||||
g_free (colormap);
|
||||
}
|
||||
@@ -164,13 +179,73 @@ gdk_colormap_unref (GdkColormap *cmap)
|
||||
gdk_colormap_real_destroy (cmap);
|
||||
}
|
||||
|
||||
GdkVisual *
|
||||
gdk_colormap_get_visual (GdkColormap *colormap)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, NULL);
|
||||
|
||||
private = (GdkColormapPrivate *)colormap;
|
||||
|
||||
return private->visual;
|
||||
}
|
||||
|
||||
#define MIN_SYNC_TIME 2
|
||||
|
||||
void
|
||||
gdk_colormap_sync (GdkColormap *colormap,
|
||||
gboolean force)
|
||||
{
|
||||
time_t current_time;
|
||||
GdkColormapPrivate *private = (GdkColormapPrivate *)colormap;
|
||||
XColor *xpalette;
|
||||
gint nlookup;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
current_time = time (NULL);
|
||||
if (!force && ((current_time - private->last_sync_time) < MIN_SYNC_TIME))
|
||||
return;
|
||||
|
||||
private->last_sync_time = current_time;
|
||||
|
||||
nlookup = 0;
|
||||
xpalette = g_new (XColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
if (private->info[i].ref_count == 0)
|
||||
{
|
||||
xpalette[nlookup].pixel = i;
|
||||
xpalette[nlookup].red = 0;
|
||||
xpalette[nlookup].green = 0;
|
||||
xpalette[nlookup].blue = 0;
|
||||
nlookup++;
|
||||
}
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette, nlookup);
|
||||
|
||||
for (i = 0; i < nlookup; i++)
|
||||
{
|
||||
gulong pixel = xpalette[i].pixel;
|
||||
colormap->colors[pixel].pixel = pixel;
|
||||
colormap->colors[pixel].red = xpalette[i].red;
|
||||
colormap->colors[pixel].green = xpalette[i].green;
|
||||
colormap->colors[pixel].blue = xpalette[i].blue;
|
||||
}
|
||||
|
||||
g_free (xpalette);
|
||||
}
|
||||
|
||||
|
||||
GdkColormap*
|
||||
gdk_colormap_get_system (void)
|
||||
{
|
||||
static GdkColormap *colormap = NULL;
|
||||
GdkColormapPrivate *private;
|
||||
XColor *xpalette;
|
||||
gint i;
|
||||
|
||||
if (!colormap)
|
||||
{
|
||||
@@ -181,37 +256,25 @@ gdk_colormap_get_system (void)
|
||||
private->xcolormap = DefaultColormap (gdk_display, gdk_screen);
|
||||
private->visual = gdk_visual_get_system ();
|
||||
private->private_val = FALSE;
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
|
||||
private->hash = NULL;
|
||||
private->last_sync_time = 0;
|
||||
private->info = NULL;
|
||||
|
||||
colormap->colors = NULL;
|
||||
colormap->size = private->visual->colormap_size;
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
if ((private->visual->type == GDK_VISUAL_GRAYSCALE) ||
|
||||
(private->visual->type == GDK_VISUAL_PSEUDO_COLOR))
|
||||
{
|
||||
xpalette = g_new (XColor, colormap->size);
|
||||
private->info = g_new0 (GdkColorInfo, colormap->size);
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
xpalette[i].red = 0;
|
||||
xpalette[i].green = 0;
|
||||
xpalette[i].blue = 0;
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette,
|
||||
colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = xpalette[i].pixel;
|
||||
colormap->colors[i].red = xpalette[i].red;
|
||||
colormap->colors[i].green = xpalette[i].green;
|
||||
colormap->colors[i].blue = xpalette[i].blue;
|
||||
}
|
||||
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
|
||||
(GCompareFunc) gdk_color_equal);
|
||||
|
||||
g_free (xpalette);
|
||||
gdk_colormap_sync (colormap, TRUE);
|
||||
}
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
@@ -257,7 +320,6 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, palette, ncolors);
|
||||
private->next_color = MAX (private->next_color, ncolors);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_DIRECT_COLOR:
|
||||
@@ -338,6 +400,7 @@ gdk_colors_alloc (GdkColormap *colormap,
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gint return_val;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, 0);
|
||||
|
||||
@@ -346,23 +409,65 @@ gdk_colors_alloc (GdkColormap *colormap,
|
||||
return_val = XAllocColorCells (private->xdisplay, private->xcolormap,
|
||||
contiguous, planes, nplanes, pixels, npixels);
|
||||
|
||||
if (return_val)
|
||||
{
|
||||
for (i=0; i<npixels; i++)
|
||||
{
|
||||
private->info[pixels[i]].ref_count++;
|
||||
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
|
||||
}
|
||||
}
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colormap_free_colors.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *pixels,
|
||||
gint npixels,
|
||||
gulong *in_pixels,
|
||||
gint in_npixels,
|
||||
gulong planes)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (in_pixels != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, planes);
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, in_npixels);
|
||||
|
||||
for (i=0; i<in_npixels; i++)
|
||||
{
|
||||
gulong pixel = in_pixels[i];
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colormap->colors[in_pixels[i]]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, planes);
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -493,19 +598,22 @@ gdk_color_parse (const gchar *spec,
|
||||
return return_val;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
/********************
|
||||
* Color allocation *
|
||||
********************/
|
||||
|
||||
/* Try to allocate a single color using XAllocColor. If it succeeds,
|
||||
* cache the result in our colormap, and store in ret.
|
||||
*/
|
||||
static gboolean
|
||||
gdk_colormap_alloc1 (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
GdkColor *ret)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor xcolor;
|
||||
gchar *available = NULL;
|
||||
gboolean return_val;
|
||||
gint i, index;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
xcolor.red = color->red;
|
||||
xcolor.green = color->green;
|
||||
@@ -513,113 +621,458 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
xcolor.pixel = color->pixel;
|
||||
xcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
return_val = FALSE;
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
switch (private->visual->type)
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
if (private->private_val)
|
||||
ret->pixel = xcolor.pixel;
|
||||
ret->red = xcolor.red;
|
||||
ret->green = xcolor.green;
|
||||
ret->blue = xcolor.blue;
|
||||
|
||||
if (ret->pixel < colormap->size)
|
||||
{
|
||||
if (private->next_color >= colormap->size)
|
||||
if (private->info[ret->pixel].ref_count) /* got a duplicate */
|
||||
{
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
if (index != -1)
|
||||
{
|
||||
available[index] = FALSE;
|
||||
*color = colormap->colors[index];
|
||||
return_val = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_val = FALSE;
|
||||
}
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
&ret->pixel, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
xcolor.pixel = colormap->size - 1 -private->next_color;
|
||||
color->pixel = xcolor.pixel;
|
||||
private->next_color += 1;
|
||||
colormap->colors[ret->pixel] = *color;
|
||||
private->info[ret->pixel].ref_count = 1;
|
||||
|
||||
XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
|
||||
return_val = TRUE;
|
||||
g_hash_table_insert (private->hash,
|
||||
&colormap->colors[ret->pixel],
|
||||
&colormap->colors[ret->pixel]);
|
||||
}
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_writeable (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
Status status;
|
||||
gint i, index;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if (private->private_val)
|
||||
{
|
||||
index = 0;
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
while (1)
|
||||
while ((index < colormap->size) && (private->info[index].ref_count != 0))
|
||||
index++;
|
||||
|
||||
if (index < colormap->size)
|
||||
{
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
colors[i].pixel = index;
|
||||
success[i] = TRUE;
|
||||
private->info[index].ref_count++;
|
||||
private->info[i].flags |= GDK_COLOR_WRITEABLE;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixels = g_new (gulong, ncolors);
|
||||
/* Allocation of a writeable color cells */
|
||||
|
||||
status = XAllocColorCells (private->xdisplay, private->xcolormap,
|
||||
FALSE, NULL, 0, pixels, ncolors);
|
||||
if (status)
|
||||
{
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
colors[i].pixel = pixels[i];
|
||||
private->info[pixels[i]].ref_count++;
|
||||
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (pixels);
|
||||
|
||||
return status ? ncolors : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_private (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gint i, index;
|
||||
XColor *store = g_new (XColor, ncolors);
|
||||
gint nstore = 0;
|
||||
gint nremaining = 0;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
index = -1;
|
||||
|
||||
/* First, store the colors we have room for */
|
||||
|
||||
index = 0;
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
while ((index < colormap->size) && (private->info[index].ref_count != 0))
|
||||
index++;
|
||||
|
||||
if (index < colormap->size)
|
||||
{
|
||||
store[nstore].red = colors[i].red;
|
||||
store[nstore].blue = colors[i].blue;
|
||||
store[nstore].green = colors[i].green;
|
||||
store[nstore].pixel = index;
|
||||
nstore++;
|
||||
|
||||
success[i] = TRUE;
|
||||
|
||||
colors[i].pixel = index;
|
||||
private->info[index].ref_count++;
|
||||
}
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, store, nstore);
|
||||
g_free (store);
|
||||
|
||||
if (nremaining > 0 && best_match)
|
||||
{
|
||||
/* Get best matches for remaining colors */
|
||||
|
||||
gchar *available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
index = gdk_colormap_match_color (colormap,
|
||||
&colors[i],
|
||||
available);
|
||||
if (index != -1)
|
||||
{
|
||||
color->pixel = xcolor.pixel;
|
||||
color->red = xcolor.red;
|
||||
color->green = xcolor.green;
|
||||
color->blue = xcolor.blue;
|
||||
colors[i] = colormap->colors[index];
|
||||
private->info[index].ref_count++;
|
||||
|
||||
if (color->pixel < colormap->size)
|
||||
colormap->colors[color->pixel] = *color;
|
||||
|
||||
return_val = TRUE;
|
||||
break;
|
||||
success[i] = TRUE;
|
||||
nremaining--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (available == NULL)
|
||||
{
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free (available);
|
||||
}
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
return (ncolors - nremaining);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gint i, index;
|
||||
gint nremaining = 0;
|
||||
gint nfailed = 0;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
index = -1;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
if (gdk_colormap_alloc1 (colormap, &colors[i], &colors[i]))
|
||||
success[i] = TRUE;
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nremaining > 0 && best_match)
|
||||
{
|
||||
gchar *available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = ((private->info[i].ref_count == 0) ||
|
||||
!(private->info[i].flags && GDK_COLOR_WRITEABLE));
|
||||
gdk_colormap_sync (colormap, FALSE);
|
||||
|
||||
while (nremaining > 0)
|
||||
{
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
index = gdk_colormap_match_color (colormap, &colors[i], available);
|
||||
if (index != -1)
|
||||
{
|
||||
available[index] = FALSE;
|
||||
xcolor.red = colormap->colors[index].red;
|
||||
xcolor.green = colormap->colors[index].green;
|
||||
xcolor.blue = colormap->colors[index].blue;
|
||||
if (private->info[index].ref_count)
|
||||
{
|
||||
private->info[index].ref_count++;
|
||||
colors[i] = colormap->colors[index];
|
||||
success[i] = TRUE;
|
||||
nremaining--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gdk_colormap_alloc1 (colormap,
|
||||
&colormap->colors[index],
|
||||
&colors[i]))
|
||||
{
|
||||
success[i] = TRUE;
|
||||
nremaining--;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
available[index] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
nfailed++;
|
||||
nremaining--;
|
||||
success[i] = 2; /* flag as permanent failure */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free (available);
|
||||
}
|
||||
|
||||
/* Change back the values we flagged as permanent failures */
|
||||
if (nfailed > 0)
|
||||
{
|
||||
for (i=0; i<ncolors; i++)
|
||||
if (success[i] == 2)
|
||||
success[i] = FALSE;
|
||||
nremaining = nfailed;
|
||||
}
|
||||
|
||||
return (ncolors - nremaining);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_pseudocolor (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkColor *lookup_color;
|
||||
gint i;
|
||||
gint nremaining = 0;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
/* Check for an exact match among previously allocated colors */
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
lookup_color = g_hash_table_lookup (private->hash, &colors[i]);
|
||||
if (lookup_color)
|
||||
{
|
||||
private->info[lookup_color->pixel].ref_count++;
|
||||
colors[i].pixel = lookup_color->pixel;
|
||||
success[i] = TRUE;
|
||||
}
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
}
|
||||
|
||||
/* If that failed, we try to allocate a new color, or approxmiate
|
||||
* with what we can get if best_match is TRUE.
|
||||
*/
|
||||
if (nremaining > 0)
|
||||
{
|
||||
if (private->private_val)
|
||||
return gdk_colormap_alloc_colors_private (colormap, colors, ncolors, writeable, best_match, success);
|
||||
else
|
||||
return gdk_colormap_alloc_colors_shared (colormap, colors, ncolors, writeable, best_match, success);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
gint i;
|
||||
gint nremaining = 0;
|
||||
XColor xcolor;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
g_return_val_if_fail (colors != NULL, FALSE);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
success[i] = FALSE;
|
||||
}
|
||||
|
||||
switch (private->visual->type)
|
||||
{
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
if (writeable)
|
||||
return gdk_colormap_alloc_colors_writeable (colormap, colors, ncolors,
|
||||
writeable, best_match, success);
|
||||
else
|
||||
return gdk_colormap_alloc_colors_pseudocolor (colormap, colors, ncolors,
|
||||
writeable, best_match, success);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_DIRECT_COLOR:
|
||||
case GDK_VISUAL_TRUE_COLOR:
|
||||
visual = private->visual;
|
||||
xcolor.pixel = (((xcolor.red >> (16 - visual->red_prec)) << visual->red_shift) +
|
||||
((xcolor.green >> (16 - visual->green_prec)) << visual->green_shift) +
|
||||
((xcolor.blue >> (16 - visual->blue_prec)) << visual->blue_shift));
|
||||
color->pixel = xcolor.pixel;
|
||||
return_val = TRUE;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
|
||||
((colors[i].green >> (16 - visual->green_prec)) << visual->green_shift) +
|
||||
((colors[i].blue >> (16 - visual->blue_prec)) << visual->blue_shift));
|
||||
success[i] = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_STATIC_GRAY:
|
||||
case GDK_VISUAL_STATIC_COLOR:
|
||||
case GDK_VISUAL_TRUE_COLOR:
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
color->pixel = xcolor.pixel;
|
||||
return_val = TRUE;
|
||||
xcolor.red = colors[i].red;
|
||||
xcolor.green = colors[i].green;
|
||||
xcolor.blue = colors[i].blue;
|
||||
xcolor.pixel = colors[i].pixel;
|
||||
xcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
{
|
||||
colors[i].pixel = xcolor.pixel;
|
||||
success[i] = TRUE;
|
||||
}
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
else
|
||||
return_val = FALSE;
|
||||
break;
|
||||
}
|
||||
return nremaining;
|
||||
}
|
||||
|
||||
if (available)
|
||||
g_free (available);
|
||||
|
||||
return return_val;
|
||||
gboolean
|
||||
gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
gboolean writeable,
|
||||
gboolean best_match)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
gdk_colormap_alloc_colors (colormap, color, 1, writeable, best_match,
|
||||
&success);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colors_free.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (colors != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, ncolors);
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
gulong pixel = colors[i].pixel;
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colors[i]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, 0);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
gdk_colormap_alloc_colors (colormap, color, 1, FALSE, TRUE, &success);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -644,9 +1097,19 @@ gdk_color_change (GdkColormap *colormap,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
guint
|
||||
gdk_color_hash (const GdkColor *colora,
|
||||
const GdkColor *colorb)
|
||||
{
|
||||
return ((colora->red) +
|
||||
(colora->green << 11) +
|
||||
(colora->blue << 22) +
|
||||
(colora->blue >> 6));
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_equal (GdkColor *colora,
|
||||
GdkColor *colorb)
|
||||
gdk_color_equal (const GdkColor *colora,
|
||||
const GdkColor *colorb)
|
||||
{
|
||||
g_return_val_if_fail (colora != NULL, FALSE);
|
||||
g_return_val_if_fail (colorb != NULL, FALSE);
|
||||
@@ -656,6 +1119,9 @@ gdk_color_equal (GdkColor *colora,
|
||||
(colora->blue == colorb->blue));
|
||||
}
|
||||
|
||||
/* XXX: Do not use this function until it is fixed. An X Colormap
|
||||
* is useless unless we also have the visual.
|
||||
*/
|
||||
GdkColormap*
|
||||
gdkx_colormap_get (Colormap xcolormap)
|
||||
{
|
||||
@@ -676,7 +1142,6 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
private->xcolormap = xcolormap;
|
||||
private->visual = NULL;
|
||||
private->private_val = TRUE;
|
||||
private->next_color = 0;
|
||||
|
||||
/* To do the following safely, we would have to have some way of finding
|
||||
* out what the size or visual of the given colormap is. It seems
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
GDK_NUM_GLYPHS = 154,
|
||||
GDK_X_CURSOR = 0,
|
||||
GDK_ARROW = 2,
|
||||
|
||||
3007
gdk/gdkdnd.c
3007
gdk/gdkdnd.c
File diff suppressed because it is too large
Load Diff
@@ -72,9 +72,9 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
if (missing_charset_count)
|
||||
{
|
||||
gint i;
|
||||
g_print ("Missing charsets in FontSet creation\n");
|
||||
g_message ("Missing charsets in FontSet creation\n");
|
||||
for (i=0;i<missing_charset_count;i++)
|
||||
g_print (" %s\n", missing_charset_list[i]);
|
||||
g_message (" %s\n", missing_charset_list[i]);
|
||||
XFreeStringList (missing_charset_list);
|
||||
}
|
||||
|
||||
@@ -328,6 +328,92 @@ gdk_string_measure (GdkFont *font,
|
||||
return gdk_text_measure (font, string, strlen (string));
|
||||
}
|
||||
|
||||
void
|
||||
gdk_text_extents (GdkFont *font,
|
||||
const gchar *text,
|
||||
gint text_length,
|
||||
gint *lbearing,
|
||||
gint *rbearing,
|
||||
gint *width,
|
||||
gint *ascent,
|
||||
gint *descent)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
XCharStruct overall;
|
||||
XFontStruct *xfont;
|
||||
XFontSet fontset;
|
||||
XRectangle ink, logical;
|
||||
int direction;
|
||||
int font_ascent;
|
||||
int font_descent;
|
||||
|
||||
g_return_if_fail (font != NULL);
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
xfont = (XFontStruct *) private->xfont;
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
XTextExtents (xfont, text, text_length,
|
||||
&direction, &font_ascent, &font_descent,
|
||||
&overall);
|
||||
}
|
||||
else
|
||||
{
|
||||
XTextExtents16 (xfont, (XChar2b *) text, text_length / 2,
|
||||
&direction, &font_ascent, &font_descent,
|
||||
&overall);
|
||||
}
|
||||
if (lbearing)
|
||||
*lbearing = overall.lbearing;
|
||||
if (rbearing)
|
||||
*rbearing = overall.rbearing;
|
||||
if (width)
|
||||
*width = overall.width;
|
||||
if (ascent)
|
||||
*ascent = overall.ascent;
|
||||
if (descent)
|
||||
*descent = overall.descent;
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) private->xfont;
|
||||
XmbTextExtents (fontset, text, text_length, &ink, &logical);
|
||||
if (lbearing)
|
||||
*lbearing = -ink.x;
|
||||
if (rbearing)
|
||||
*rbearing = ink.y;
|
||||
if (width)
|
||||
*width = logical.width;
|
||||
if (ascent)
|
||||
*ascent = ink.height;
|
||||
if (descent)
|
||||
*descent = -ink.y;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gdk_string_extents (GdkFont *font,
|
||||
const gchar *string,
|
||||
gint *lbearing,
|
||||
gint *rbearing,
|
||||
gint *width,
|
||||
gint *ascent,
|
||||
gint *descent)
|
||||
{
|
||||
g_return_if_fail (font != NULL);
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
gdk_text_extents (font, string, strlen (string),
|
||||
lbearing, rbearing, width, ascent, descent);
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
gdk_text_measure (GdkFont *font,
|
||||
const gchar *text,
|
||||
|
||||
110
gdk/gdkgc.c
110
gdk/gdkgc.c
@@ -88,6 +88,42 @@ gdk_gc_new_with_values (GdkWindow *window,
|
||||
case GDK_XOR:
|
||||
xvalues.function = GXxor;
|
||||
break;
|
||||
case GDK_CLEAR:
|
||||
xvalues.function = GXclear;
|
||||
break;
|
||||
case GDK_AND:
|
||||
xvalues.function = GXand;
|
||||
break;
|
||||
case GDK_AND_REVERSE:
|
||||
xvalues.function = GXandReverse;
|
||||
break;
|
||||
case GDK_AND_INVERT:
|
||||
xvalues.function = GXandInverted;
|
||||
break;
|
||||
case GDK_NOOP:
|
||||
xvalues.function = GXnoop;
|
||||
break;
|
||||
case GDK_OR:
|
||||
xvalues.function = GXor;
|
||||
break;
|
||||
case GDK_EQUIV:
|
||||
xvalues.function = GXequiv;
|
||||
break;
|
||||
case GDK_OR_REVERSE:
|
||||
xvalues.function = GXorReverse;
|
||||
break;
|
||||
case GDK_COPY_INVERT:
|
||||
xvalues.function = GXcopyInverted;
|
||||
break;
|
||||
case GDK_OR_INVERT:
|
||||
xvalues.function = GXorInverted;
|
||||
break;
|
||||
case GDK_NAND:
|
||||
xvalues.function = GXnand;
|
||||
break;
|
||||
case GDK_SET:
|
||||
xvalues.function = GXset;
|
||||
break;
|
||||
}
|
||||
xvalues_mask |= GCFunction;
|
||||
}
|
||||
@@ -289,6 +325,42 @@ gdk_gc_get_values (GdkGC *gc,
|
||||
case GXxor:
|
||||
values->function = GDK_XOR;
|
||||
break;
|
||||
case GXclear:
|
||||
values->function = GDK_CLEAR;
|
||||
break;
|
||||
case GXand:
|
||||
values->function = GDK_AND;
|
||||
break;
|
||||
case GXandReverse:
|
||||
values->function = GDK_AND_REVERSE;
|
||||
break;
|
||||
case GXandInverted:
|
||||
values->function = GDK_AND_INVERT;
|
||||
break;
|
||||
case GXnoop:
|
||||
values->function = GDK_NOOP;
|
||||
break;
|
||||
case GXor:
|
||||
values->function = GDK_OR;
|
||||
break;
|
||||
case GXequiv:
|
||||
values->function = GDK_EQUIV;
|
||||
break;
|
||||
case GXorReverse:
|
||||
values->function = GDK_OR_REVERSE;
|
||||
break;
|
||||
case GXcopyInverted:
|
||||
values->function =GDK_COPY_INVERT;
|
||||
break;
|
||||
case GXorInverted:
|
||||
values->function = GDK_OR_INVERT;
|
||||
break;
|
||||
case GXnand:
|
||||
values->function = GDK_NAND;
|
||||
break;
|
||||
case GXset:
|
||||
values->function = GDK_SET;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (xvalues.fill_style)
|
||||
@@ -433,6 +505,42 @@ gdk_gc_set_function (GdkGC *gc,
|
||||
case GDK_XOR:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXxor);
|
||||
break;
|
||||
case GDK_CLEAR:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXclear);
|
||||
break;
|
||||
case GDK_AND:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXand);
|
||||
break;
|
||||
case GDK_AND_REVERSE:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXandReverse);
|
||||
break;
|
||||
case GDK_AND_INVERT:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXandInverted);
|
||||
break;
|
||||
case GDK_NOOP:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXnoop);
|
||||
break;
|
||||
case GDK_OR:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXor);
|
||||
break;
|
||||
case GDK_EQUIV:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXequiv);
|
||||
break;
|
||||
case GDK_OR_REVERSE:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXorReverse);
|
||||
break;
|
||||
case GDK_COPY_INVERT:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXcopyInverted);
|
||||
break;
|
||||
case GDK_OR_INVERT:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXorInverted);
|
||||
break;
|
||||
case GDK_NAND:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXnand);
|
||||
break;
|
||||
case GDK_SET:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -568,7 +676,7 @@ gdk_gc_set_clip_rectangle (GdkGC *gc,
|
||||
{
|
||||
GdkGCPrivate *private;
|
||||
XRectangle xrectangle;
|
||||
|
||||
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
private = (GdkGCPrivate*) gc;
|
||||
|
||||
@@ -29,7 +29,7 @@ Display *gdk_display = NULL;
|
||||
gint gdk_screen;
|
||||
Window gdk_root_window;
|
||||
Window gdk_leader_window;
|
||||
GdkWindowPrivate gdk_root_parent;
|
||||
GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, };
|
||||
Atom gdk_wm_delete_window;
|
||||
Atom gdk_wm_take_focus;
|
||||
Atom gdk_wm_protocols;
|
||||
@@ -48,7 +48,6 @@ GdkDndGlobals gdk_dnd = {None,None,None,
|
||||
{0,0},
|
||||
{0,0}, {0,0},
|
||||
{0,0,0,0}, NULL, None, 0};
|
||||
gchar *gdk_progname = NULL;
|
||||
gchar *gdk_progclass = NULL;
|
||||
gint gdk_error_code;
|
||||
gint gdk_error_warnings = TRUE;
|
||||
|
||||
@@ -146,11 +146,11 @@ extern int _g_mbtowc (wchar_t *wstr, const char *str, size_t len);
|
||||
|
||||
#endif /* X_LOCALE */
|
||||
|
||||
#if !defined(HAVE_BROKEN_WCTYPE) && (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H)) && !defined(X_LOCALE)
|
||||
# ifdef HAVE_WCTYPE_H
|
||||
#if !defined(G_HAVE_BROKEN_WCTYPE) && (defined(G_HAVE_WCTYPE_H) || defined(G_HAVE_WCHAR_H)) && !defined(X_LOCALE)
|
||||
# ifdef G_HAVE_WCTYPE_H
|
||||
# include <wctype.h>
|
||||
# else
|
||||
# ifdef HAVE_WCHAR_H
|
||||
# ifdef G_HAVE_WCHAR_H
|
||||
# include <wchar.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#include "../config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
|
||||
@@ -279,7 +280,10 @@ gdk_image_new (GdkImageType type,
|
||||
private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
|
||||
ZPixmap, 0, 0, width, height, 32, 0);
|
||||
|
||||
private->ximage->data = g_new (char, private->ximage->bytes_per_line *
|
||||
/* Use malloc, not g_malloc here, because X will call free()
|
||||
* on this data
|
||||
*/
|
||||
private->ximage->data = malloc (private->ximage->bytes_per_line *
|
||||
private->ximage->height);
|
||||
break;
|
||||
|
||||
@@ -349,7 +353,8 @@ gdk_image_get (GdkWindow *window,
|
||||
|
||||
image->mem = private->ximage->data;
|
||||
image->bpl = private->ximage->bytes_per_line;
|
||||
image->bpp = 1;
|
||||
image->bpp = private->ximage->bits_per_pixel;
|
||||
image->byte_order = private->ximage->byte_order;
|
||||
|
||||
return image;
|
||||
}
|
||||
@@ -405,6 +410,8 @@ gdk_image_destroy (GdkImage *image)
|
||||
|
||||
case GDK_IMAGE_SHARED:
|
||||
#ifdef USE_SHM
|
||||
gdk_flush();
|
||||
|
||||
XShmDetach (private->xdisplay, private->x_shm_info);
|
||||
XDestroyImage (private->ximage);
|
||||
|
||||
|
||||
@@ -591,23 +591,35 @@ gdk_input_gxi_grab_pointer (GdkWindow * window,
|
||||
GdkWindow * confine_to,
|
||||
guint32 time)
|
||||
{
|
||||
GdkInputWindow *input_window, *new_window;
|
||||
GList *tmp_list;
|
||||
GdkInputWindow *input_window;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
while (tmp_list)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (input_window->grabbed)
|
||||
return AlreadyGrabbed;
|
||||
|
||||
if (input_window->window == window)
|
||||
new_window = input_window;
|
||||
input_window->grabbed = TRUE;
|
||||
else if (input_window->grabbed)
|
||||
input_window->grabbed = FALSE;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
|
||||
gdkdev->xdevice &&
|
||||
(gdkdev->button_state != 0))
|
||||
gdkdev->button_state = 0;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
new_window->grabbed = TRUE;
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ gdk_input_xfree_configure_event (XConfigureEvent *xevent, GdkWindow *window)
|
||||
|
||||
static void
|
||||
gdk_input_xfree_enter_event (XCrossingEvent *xevent,
|
||||
GdkWindow *window)
|
||||
GdkWindow *window)
|
||||
{
|
||||
GdkInputWindow *input_window;
|
||||
gint root_x, root_y;
|
||||
@@ -257,6 +257,7 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
|
||||
guint32 time)
|
||||
{
|
||||
GdkInputWindow *input_window, *new_window;
|
||||
gboolean need_ungrab;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GList *tmp_list;
|
||||
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
|
||||
@@ -265,47 +266,70 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
new_window = NULL;
|
||||
need_ungrab = FALSE;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (input_window->grabbed)
|
||||
return AlreadyGrabbed;
|
||||
|
||||
if (input_window->window == window)
|
||||
new_window = input_window;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
|
||||
|
||||
new_window->grabbed = TRUE;
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
|
||||
gdkdev->xdevice)
|
||||
else if (input_window->grabbed)
|
||||
{
|
||||
gdk_input_common_find_events (window, gdkdev,
|
||||
event_mask,
|
||||
event_classes, &num_classes);
|
||||
|
||||
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;
|
||||
input_window->grabbed = FALSE;
|
||||
need_ungrab = TRUE;
|
||||
}
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
|
||||
if (new_window)
|
||||
{
|
||||
new_window->grabbed = TRUE;
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
|
||||
gdkdev->xdevice)
|
||||
{
|
||||
gdk_input_common_find_events (window, gdkdev,
|
||||
event_mask,
|
||||
event_classes, &num_classes);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice &&
|
||||
((gdkdev->button_state != 0) || need_ungrab))
|
||||
{
|
||||
XUngrabDevice( gdk_display, gdkdev->xdevice, time);
|
||||
gdkdev->button_state = 0;
|
||||
}
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
100
gdk/gdkpixmap.c
100
gdk/gdkpixmap.c
@@ -34,6 +34,13 @@ typedef struct
|
||||
gint transparent;
|
||||
} _GdkPixmapColor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint ncolors;
|
||||
GdkColormap *colormap;
|
||||
gulong pixels[1];
|
||||
} _GdkPixmapInfo;
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_new (GdkWindow *window,
|
||||
gint width,
|
||||
@@ -175,7 +182,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
gint
|
||||
static gint
|
||||
gdk_pixmap_seek_string (FILE *infile,
|
||||
const gchar *str,
|
||||
gint skip_comments)
|
||||
@@ -199,7 +206,7 @@ gdk_pixmap_seek_string (FILE *infile,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
static gint
|
||||
gdk_pixmap_seek_char (FILE *infile,
|
||||
gchar c)
|
||||
{
|
||||
@@ -231,7 +238,7 @@ gdk_pixmap_seek_char (FILE *infile,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
static gint
|
||||
gdk_pixmap_read_string (FILE *infile,
|
||||
gchar **buffer,
|
||||
guint *buffer_size)
|
||||
@@ -286,7 +293,7 @@ gdk_pixmap_read_string (FILE *infile,
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar*
|
||||
static gchar*
|
||||
gdk_pixmap_skip_whitespaces (gchar *buffer)
|
||||
{
|
||||
gint32 index = 0;
|
||||
@@ -297,7 +304,7 @@ gdk_pixmap_skip_whitespaces (gchar *buffer)
|
||||
return &buffer[index];
|
||||
}
|
||||
|
||||
gchar*
|
||||
static gchar*
|
||||
gdk_pixmap_skip_string (gchar *buffer)
|
||||
{
|
||||
gint32 index = 0;
|
||||
@@ -311,7 +318,7 @@ gdk_pixmap_skip_string (gchar *buffer)
|
||||
/* Xlib crashed ince at a color name lengths around 125 */
|
||||
#define MAX_COLOR_LEN 120
|
||||
|
||||
gchar*
|
||||
static gchar*
|
||||
gdk_pixmap_extract_color (gchar *buffer)
|
||||
{
|
||||
gint counter, numnames;
|
||||
@@ -388,13 +395,6 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
return retcol;
|
||||
}
|
||||
|
||||
static void
|
||||
free_color (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
g_free (key);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
|
||||
enum buffer_op
|
||||
{
|
||||
@@ -403,6 +403,23 @@ enum buffer_op
|
||||
op_body
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
gdk_xpm_destroy_notify (gpointer data)
|
||||
{
|
||||
_GdkPixmapInfo *info = (_GdkPixmapInfo *)data;
|
||||
GdkColor color;
|
||||
int i;
|
||||
|
||||
for (i=0; i<info->ncolors; i++)
|
||||
{
|
||||
color.pixel = info->pixels[i];
|
||||
gdk_colormap_free_colors (info->colormap, &color, 1);
|
||||
}
|
||||
|
||||
gdk_colormap_unref (info->colormap);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static GdkPixmap *
|
||||
_gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
@@ -420,9 +437,12 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, n, ns, cnt, xcnt, ycnt, wbytes;
|
||||
gchar *buffer, pixel_str[32];
|
||||
gchar *name_buf;
|
||||
_GdkPixmapColor *color = NULL, *fallbackcolor = NULL;
|
||||
_GdkPixmapColor *colors = NULL;
|
||||
gulong index;
|
||||
GHashTable *colors = NULL;
|
||||
GHashTable *color_hash = NULL;
|
||||
_GdkPixmapInfo *color_info = NULL;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
@@ -449,14 +469,30 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
colors = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
color_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
transparent_color = &tmp_color;
|
||||
}
|
||||
|
||||
|
||||
/* For pseudo-color and grayscale visuals, we have to remember
|
||||
* the colors we allocated, so we can free them later.
|
||||
*/
|
||||
if ((visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
|
||||
(visual->type == GDK_VISUAL_GRAYSCALE))
|
||||
{
|
||||
color_info = g_malloc (sizeof (_GdkPixmapInfo) +
|
||||
sizeof(gulong) * (num_cols - 1));
|
||||
color_info->ncolors = num_cols;
|
||||
color_info->colormap = colormap;
|
||||
gdk_colormap_ref (colormap);
|
||||
}
|
||||
|
||||
name_buf = g_new (gchar, num_cols * (cpp+1));
|
||||
colors = g_new (_GdkPixmapColor, num_cols);
|
||||
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
@@ -465,8 +501,8 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
if (buffer == NULL)
|
||||
goto error;
|
||||
|
||||
color = g_new (_GdkPixmapColor, 1);
|
||||
color->color_string = g_new (gchar, cpp + 1);
|
||||
color = &colors[cnt];
|
||||
color->color_string = &name_buf [cnt * (cpp + 1)];
|
||||
strncpy (color->color_string, buffer, cpp);
|
||||
color->color_string[cpp] = 0;
|
||||
buffer += strlen (color->color_string);
|
||||
@@ -486,7 +522,11 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
/* FIXME: The remaining slowness appears to happen in this
|
||||
function. */
|
||||
gdk_color_alloc (colormap, &color->color);
|
||||
g_hash_table_insert (colors, color->color_string, color);
|
||||
|
||||
if (color_info)
|
||||
color_info->pixels[cnt] = color->color.pixel;
|
||||
|
||||
g_hash_table_insert (color_hash, color->color_string, color);
|
||||
if (cnt == 0)
|
||||
fallbackcolor = color;
|
||||
}
|
||||
@@ -531,7 +571,7 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
pixel_str[cpp] = 0;
|
||||
ns = 0;
|
||||
|
||||
color = g_hash_table_lookup (colors, pixel_str);
|
||||
color = g_hash_table_lookup (color_hash, pixel_str);
|
||||
|
||||
if (!color) /* screwed up XPM file */
|
||||
color = fallbackcolor;
|
||||
@@ -558,6 +598,10 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
if (image != NULL)
|
||||
{
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
if (color_info)
|
||||
gdk_drawable_set_data (pixmap, "gdk-xpm", color_info,
|
||||
gdk_xpm_destroy_notify);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
@@ -565,13 +609,18 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
}
|
||||
else if (color_info)
|
||||
gdk_xpm_destroy_notify (color_info);
|
||||
|
||||
if (color_hash != NULL)
|
||||
g_hash_table_destroy (color_hash);
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
g_hash_table_foreach (colors, free_color, 0);
|
||||
g_hash_table_destroy (colors);
|
||||
}
|
||||
|
||||
g_free (colors);
|
||||
|
||||
if (name_buf != NULL)
|
||||
g_free (name_buf);
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
@@ -720,6 +769,7 @@ gdk_pixmap_unref (GdkPixmap *pixmap)
|
||||
{
|
||||
XFreePixmap (private->xdisplay, private->xwindow);
|
||||
gdk_xid_table_remove (private->xwindow);
|
||||
g_dataset_destroy (private);
|
||||
g_free (private);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
#define DND_PROTOCOL_VERSION 0
|
||||
|
||||
#define gdk_window_lookup(xid) ((GdkWindow*) gdk_xid_table_lookup (xid))
|
||||
#define gdk_pixmap_lookup(xid) ((GdkPixmap*) gdk_xid_table_lookup (xid))
|
||||
#define gdk_font_lookup(xid) ((GdkFont*) gdk_xid_table_lookup (xid))
|
||||
@@ -41,10 +39,12 @@ typedef struct _GdkWindowPrivate GdkPixmapPrivate;
|
||||
typedef struct _GdkImagePrivate GdkImagePrivate;
|
||||
typedef struct _GdkGCPrivate GdkGCPrivate;
|
||||
typedef struct _GdkColormapPrivate GdkColormapPrivate;
|
||||
typedef struct _GdkColorInfo GdkColorInfo;
|
||||
typedef struct _GdkVisualPrivate GdkVisualPrivate;
|
||||
typedef struct _GdkFontPrivate GdkFontPrivate;
|
||||
typedef struct _GdkCursorPrivate GdkCursorPrivate;
|
||||
typedef struct _GdkEventFilter GdkEventFilter;
|
||||
typedef struct _GdkClientFilter GdkClientFilter;
|
||||
typedef struct _GdkColorContextPrivate GdkColorContextPrivate;
|
||||
typedef struct _GdkRegionPrivate GdkRegionPrivate;
|
||||
|
||||
@@ -63,20 +63,6 @@ struct _GdkWindowPrivate
|
||||
guint8 window_type;
|
||||
guint ref_count;
|
||||
guint destroyed : 2;
|
||||
guint dnd_drag_enabled : 1,
|
||||
dnd_drag_datashow : 1,
|
||||
dnd_drag_destructive_op : 1,
|
||||
dnd_drag_accepted : 1,
|
||||
dnd_drop_enabled : 1,
|
||||
dnd_drop_destructive_op : 1;
|
||||
GdkAtom dnd_drag_data_type, *dnd_drag_data_typesavail;
|
||||
guint dnd_drag_data_numtypesavail;
|
||||
/* We have to turn on MotionMask/EnterWindowMask/LeaveWindowMask
|
||||
during drags, then set it back to what it was after */
|
||||
glong dnd_drag_savedeventmask, dnd_drag_eventmask;
|
||||
GdkAtom *dnd_drop_data_typesavail;
|
||||
guint dnd_drop_data_numtypesavail;
|
||||
/* need to allow custom drag/drop cursors */
|
||||
|
||||
gint extension_events;
|
||||
|
||||
@@ -111,6 +97,16 @@ struct _GdkGCPrivate
|
||||
guint ref_count;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
GDK_COLOR_WRITEABLE = 1 << 0
|
||||
} GdkColorInfoFlags;
|
||||
|
||||
struct _GdkColorInfo
|
||||
{
|
||||
GdkColorInfoFlags flags;
|
||||
guint ref_count;
|
||||
};
|
||||
|
||||
struct _GdkColormapPrivate
|
||||
{
|
||||
GdkColormap colormap;
|
||||
@@ -118,7 +114,11 @@ struct _GdkColormapPrivate
|
||||
Display *xdisplay;
|
||||
GdkVisual *visual;
|
||||
gint private_val;
|
||||
gint next_color;
|
||||
|
||||
GHashTable *hash;
|
||||
GdkColorInfo *info;
|
||||
time_t last_sync_time;
|
||||
|
||||
guint ref_count;
|
||||
};
|
||||
|
||||
@@ -178,6 +178,12 @@ struct _GdkEventFilter {
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
struct _GdkClientFilter {
|
||||
GdkAtom type;
|
||||
GdkFilterFunc function;
|
||||
gpointer data;
|
||||
};
|
||||
|
||||
#ifdef USE_XIM
|
||||
|
||||
struct _GdkICPrivate
|
||||
@@ -213,6 +219,7 @@ typedef enum {
|
||||
|
||||
void gdk_window_init (void);
|
||||
void gdk_visual_init (void);
|
||||
void gdk_dnd_init (void);
|
||||
|
||||
void gdk_image_init (void);
|
||||
void gdk_image_exit (void);
|
||||
@@ -262,7 +269,6 @@ extern Atom gdk_wm_window_protocols[];
|
||||
extern Atom gdk_selection_property;
|
||||
extern GdkDndGlobals gdk_dnd;
|
||||
extern GdkWindow *selection_owner[];
|
||||
extern gchar *gdk_progname;
|
||||
extern gchar *gdk_progclass;
|
||||
extern gint gdk_error_code;
|
||||
extern gint gdk_error_warnings;
|
||||
|
||||
@@ -22,12 +22,21 @@
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
|
||||
GdkAtom
|
||||
gdk_atom_intern (const gchar *atom_name,
|
||||
gint only_if_exists)
|
||||
{
|
||||
return XInternAtom (gdk_display, atom_name, only_if_exists);
|
||||
GdkAtom retval;
|
||||
static GHashTable *atom_hash = NULL;
|
||||
|
||||
if (!atom_hash)
|
||||
atom_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
|
||||
if (!retval)
|
||||
retval = XInternAtom (gdk_display, atom_name, only_if_exists);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
gchar *
|
||||
@@ -35,14 +44,16 @@ gdk_atom_name (GdkAtom atom)
|
||||
{
|
||||
gchar *t;
|
||||
gchar *name;
|
||||
gint old_error_warnings;
|
||||
|
||||
/* If this atom doesn't exist, we'll die with an X error unless
|
||||
we take precautions */
|
||||
|
||||
old_error_warnings = gdk_error_warnings;
|
||||
gdk_error_warnings = 0;
|
||||
gdk_error_code = 0;
|
||||
t = XGetAtomName (gdk_display, atom);
|
||||
gdk_error_warnings = 1;
|
||||
gdk_error_warnings = old_error_warnings;
|
||||
|
||||
if (gdk_error_code == -1)
|
||||
{
|
||||
@@ -115,7 +126,7 @@ gdk_property_get (GdkWindow *window,
|
||||
if (actual_format_type)
|
||||
*actual_format_type = ret_format;
|
||||
|
||||
if (ret_prop_type != type)
|
||||
if ((type != AnyPropertyType) && (ret_prop_type != type))
|
||||
{
|
||||
gchar *rn, *pn;
|
||||
|
||||
|
||||
@@ -19,6 +19,20 @@
|
||||
#include "gdk.h"
|
||||
|
||||
|
||||
|
||||
void
|
||||
gdk_rectangle_union (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest)
|
||||
{
|
||||
dest->x = MIN (src1->x, src2->x);
|
||||
dest->y = MIN (src1->y, src2->y);
|
||||
dest->width =
|
||||
MAX (src1->x + src1->width, src2->x + src2->width) - dest->x;
|
||||
dest->height =
|
||||
MAX (src1->y + src1->height, src2->y + src2->height) - dest->y;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_rectangle_intersect (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
|
||||
833
gdk/gdkrgb.c
833
gdk/gdkrgb.c
File diff suppressed because it is too large
Load Diff
13
gdk/gdkrgb.h
13
gdk/gdkrgb.h
@@ -60,6 +60,19 @@ gdk_draw_rgb_image (GdkDrawable *drawable,
|
||||
guchar *rgb_buf,
|
||||
gint rowstride);
|
||||
|
||||
void
|
||||
gdk_draw_rgb_image_dithalign (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GdkRgbDither dith,
|
||||
guchar *rgb_buf,
|
||||
gint rowstride,
|
||||
gint xdith,
|
||||
gint ydith);
|
||||
|
||||
void
|
||||
gdk_draw_rgb_32_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
|
||||
250
gdk/gdktypes.h
250
gdk/gdktypes.h
@@ -60,6 +60,7 @@ typedef struct _GdkFont GdkFont;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
typedef struct _GdkColorContextDither GdkColorContextDither;
|
||||
typedef struct _GdkColorContext GdkColorContext;
|
||||
typedef struct _GdkDragContext GdkDragContext;
|
||||
|
||||
typedef struct _GdkEventAny GdkEventAny;
|
||||
typedef struct _GdkEventExpose GdkEventExpose;
|
||||
@@ -74,14 +75,12 @@ typedef struct _GdkEventConfigure GdkEventConfigure;
|
||||
typedef struct _GdkEventProperty GdkEventProperty;
|
||||
typedef struct _GdkEventSelection GdkEventSelection;
|
||||
typedef struct _GdkEventProximity GdkEventProximity;
|
||||
typedef struct _GdkEventOther GdkEventOther;
|
||||
typedef struct _GdkEventDragBegin GdkEventDragBegin;
|
||||
typedef struct _GdkEventDragRequest GdkEventDragRequest;
|
||||
typedef struct _GdkEventDropEnter GdkEventDropEnter;
|
||||
typedef struct _GdkEventDropDataAvailable GdkEventDropDataAvailable;
|
||||
typedef struct _GdkEventDropLeave GdkEventDropLeave;
|
||||
typedef struct _GdkEventClient GdkEventClient;
|
||||
|
||||
typedef struct _GdkEventDND GdkEventDND;
|
||||
|
||||
typedef union _GdkEvent GdkEvent;
|
||||
|
||||
typedef struct _GdkDeviceKey GdkDeviceKey;
|
||||
typedef struct _GdkDeviceInfo GdkDeviceInfo;
|
||||
typedef struct _GdkTimeCoord GdkTimeCoord;
|
||||
@@ -217,12 +216,37 @@ typedef enum
|
||||
* Copy: Overwrites destination pixels with the source pixels.
|
||||
* Invert: Inverts the destination pixels.
|
||||
* Xor: Xor's the destination pixels with the source pixels.
|
||||
* Clear: set pixels to 0
|
||||
* And: source AND destination
|
||||
* And Reverse: source AND (NOT destination)
|
||||
* And Invert: (NOT source) AND destination
|
||||
* Noop: destination
|
||||
* Or: source OR destination
|
||||
* Nor: (NOT source) AND (NOT destination)
|
||||
* Equiv: (NOT source) XOR destination
|
||||
* Xor Reverse: source OR (NOT destination)
|
||||
* Copy Inverted: NOT source
|
||||
* Xor Inverted: (NOT source) OR destination
|
||||
* Nand: (NOT source) OR (NOT destination)
|
||||
* Set: set pixels to 1
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_COPY,
|
||||
GDK_INVERT,
|
||||
GDK_XOR
|
||||
GDK_XOR,
|
||||
GDK_CLEAR,
|
||||
GDK_AND,
|
||||
GDK_AND_REVERSE,
|
||||
GDK_AND_INVERT,
|
||||
GDK_NOOP,
|
||||
GDK_OR,
|
||||
GDK_EQUIV,
|
||||
GDK_OR_REVERSE,
|
||||
GDK_COPY_INVERT,
|
||||
GDK_OR_INVERT,
|
||||
GDK_NAND,
|
||||
GDK_SET
|
||||
} GdkFunction;
|
||||
|
||||
/* GC fill types.
|
||||
@@ -355,15 +379,15 @@ typedef enum
|
||||
GDK_SELECTION_NOTIFY = 19,
|
||||
GDK_PROXIMITY_IN = 20,
|
||||
GDK_PROXIMITY_OUT = 21,
|
||||
GDK_DRAG_BEGIN = 22,
|
||||
GDK_DRAG_REQUEST = 23,
|
||||
GDK_DROP_ENTER = 24,
|
||||
GDK_DROP_LEAVE = 25,
|
||||
GDK_DROP_DATA_AVAIL = 26,
|
||||
GDK_CLIENT_EVENT = 27,
|
||||
GDK_VISIBILITY_NOTIFY = 28,
|
||||
GDK_NO_EXPOSE = 29,
|
||||
GDK_OTHER_EVENT = 9999 /* Deprecated, use filters instead */
|
||||
GDK_DRAG_ENTER = 22,
|
||||
GDK_DRAG_LEAVE = 23,
|
||||
GDK_DRAG_MOTION = 24,
|
||||
GDK_DRAG_STATUS = 25,
|
||||
GDK_DROP_START = 26,
|
||||
GDK_DROP_FINISHED = 27,
|
||||
GDK_CLIENT_EVENT = 28,
|
||||
GDK_VISIBILITY_NOTIFY = 29,
|
||||
GDK_NO_EXPOSE = 30
|
||||
} GdkEventType;
|
||||
|
||||
/* Event masks. (Used to select what types of events a window
|
||||
@@ -514,24 +538,6 @@ typedef enum
|
||||
GDK_PROP_MODE_APPEND
|
||||
} GdkPropMode;
|
||||
|
||||
/* These definitions are for version 1 of the OffiX D&D protocol,
|
||||
taken from <OffiX/DragAndDropTypes.h> */
|
||||
typedef enum
|
||||
{
|
||||
GDK_DNDTYPE_NOTDND = -1,
|
||||
GDK_DNDTYPE_UNKNOWN = 0,
|
||||
GDK_DNDTYPE_RAWDATA = 1,
|
||||
GDK_DNDTYPE_FILE = 2,
|
||||
GDK_DNDTYPE_FILES = 3,
|
||||
GDK_DNDTYPE_TEXT = 4,
|
||||
GDK_DNDTYPE_DIR = 5,
|
||||
GDK_DNDTYPE_LINK = 6,
|
||||
GDK_DNDTYPE_EXE = 7,
|
||||
GDK_DNDTYPE_URL = 8,
|
||||
GDK_DNDTYPE_MIME = 9,
|
||||
GDK_DNDTYPE_END = 10
|
||||
} GdkDndType;
|
||||
|
||||
/* Enums for XInput support */
|
||||
|
||||
typedef enum
|
||||
@@ -593,15 +599,18 @@ typedef enum
|
||||
|
||||
typedef enum /*< flags >*/
|
||||
{
|
||||
GdkIMPreeditArea = 0x0001L, /*< nick=preedit-area >*/
|
||||
GdkIMPreeditCallbacks = 0x0002L, /*< nick=preedit-callbacks >*/
|
||||
GdkIMPreeditPosition = 0x0004L, /*< nick=preedit-position >*/
|
||||
GdkIMPreeditNothing = 0x0008L, /*< nick=preedit-nothing >*/
|
||||
GdkIMPreeditNone = 0x0010L, /*< nick=preedit-none >*/
|
||||
GdkIMStatusArea = 0x0100L, /*< nick=status-area >*/
|
||||
GdkIMStatusCallbacks = 0x0200L, /*< nick=status-callbacks >*/
|
||||
GdkIMStatusNothing = 0x0400L, /*< nick=status-nothing >*/
|
||||
GdkIMStatusNone = 0x0800L /*< nick=status-none >*/
|
||||
GDK_IM_PREEDIT_AREA = 0x0001,
|
||||
GDK_IM_PREEDIT_CALLBACKS = 0x0002,
|
||||
GDK_IM_PREEDIT_POSITION = 0x0004,
|
||||
GDK_IM_PREEDIT_NOTHING = 0x0008,
|
||||
GDK_IM_PREEDIT_NONE = 0x0010,
|
||||
GDK_IM_PREEDIT_MASK = 0x001f,
|
||||
|
||||
GDK_IM_STATUS_AREA = 0x0100,
|
||||
GDK_IM_STATUS_CALLBACKS = 0x0200,
|
||||
GDK_IM_STATUS_NOTHING = 0x0400,
|
||||
GDK_IM_STATUS_NONE = 0x0800,
|
||||
GDK_IM_STATUS_MASK = 0x0f00
|
||||
} GdkIMStyle;
|
||||
|
||||
/* The next two enumeration values current match the
|
||||
@@ -630,15 +639,6 @@ typedef enum
|
||||
GDK_FUNC_CLOSE = 1 << 5
|
||||
} GdkWMFunction;
|
||||
|
||||
#define GdkIMPreeditMask \
|
||||
( GdkIMPreeditArea | GdkIMPreeditCallbacks | \
|
||||
GdkIMPreeditPosition | GdkIMPreeditNothing | \
|
||||
GdkIMPreeditNone )
|
||||
|
||||
#define GdkIMStatusMask \
|
||||
( GdkIMStatusArea | GdkIMStatusCallbacks | \
|
||||
GdkIMStatusNothing | GdkIMStatusNone )
|
||||
|
||||
typedef void (*GdkInputFunction) (gpointer data,
|
||||
gint source,
|
||||
GdkInputCondition condition);
|
||||
@@ -678,6 +678,22 @@ typedef enum
|
||||
GDK_OVERLAP_RECTANGLE_PART
|
||||
} GdkOverlapType;
|
||||
|
||||
typedef enum {
|
||||
GDK_ACTION_DEFAULT = 1 << 0,
|
||||
GDK_ACTION_COPY = 1 << 1,
|
||||
GDK_ACTION_MOVE = 1 << 2,
|
||||
GDK_ACTION_LINK = 1 << 3,
|
||||
GDK_ACTION_PRIVATE = 1 << 4,
|
||||
GDK_ACTION_ASK = 1 << 5
|
||||
} GdkDragAction;
|
||||
|
||||
typedef enum {
|
||||
GDK_DRAG_PROTO_MOTIF,
|
||||
GDK_DRAG_PROTO_XDND,
|
||||
GDK_DRAG_PROTO_ROOTWIN /* A root window with nobody claiming
|
||||
* drags */
|
||||
} GdkDragProtocol;
|
||||
|
||||
/* 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
|
||||
@@ -919,6 +935,25 @@ struct _GdkTimeCoord
|
||||
gdouble ytilt;
|
||||
};
|
||||
|
||||
/* Structure that holds information about a drag in progress.
|
||||
* this is used on both source and destination sides.
|
||||
*/
|
||||
struct _GdkDragContext {
|
||||
GdkDragProtocol protocol;
|
||||
|
||||
gboolean is_source;
|
||||
|
||||
GdkWindow *source_window;
|
||||
GdkWindow *dest_window;
|
||||
|
||||
GList *targets;
|
||||
GdkDragAction actions;
|
||||
GdkDragAction suggested_action;
|
||||
GdkDragAction action;
|
||||
|
||||
guint32 start_time;
|
||||
};
|
||||
|
||||
/* Event filtering */
|
||||
|
||||
typedef void GdkXEvent; /* Can be cast to XEvent */
|
||||
@@ -1077,100 +1112,6 @@ struct _GdkEventProximity
|
||||
guint32 deviceid;
|
||||
};
|
||||
|
||||
struct _GdkEventDragRequest
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
guint32 requestor;
|
||||
union {
|
||||
struct {
|
||||
guint protocol_version:4;
|
||||
guint sendreply:1;
|
||||
guint willaccept:1;
|
||||
guint delete_data:1; /* Do *not* delete if link is sent, only
|
||||
if data is sent */
|
||||
guint senddata:1;
|
||||
guint reserved:22;
|
||||
} flags;
|
||||
glong allflags;
|
||||
} u;
|
||||
guint8 isdrop; /* This gdk event can be generated by a couple of
|
||||
X events - this lets the app know whether the
|
||||
drop really occurred or we just set the data */
|
||||
|
||||
GdkPoint drop_coords;
|
||||
gchar *data_type;
|
||||
guint32 timestamp;
|
||||
};
|
||||
|
||||
struct _GdkEventDragBegin
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
union {
|
||||
struct {
|
||||
guint protocol_version:4;
|
||||
guint reserved:28;
|
||||
} flags;
|
||||
glong allflags;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct _GdkEventDropEnter
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
guint32 requestor;
|
||||
union {
|
||||
struct {
|
||||
guint protocol_version:4;
|
||||
guint sendreply:1;
|
||||
guint extended_typelist:1;
|
||||
guint reserved:26;
|
||||
} flags;
|
||||
glong allflags;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct _GdkEventDropLeave
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
guint32 requestor;
|
||||
union {
|
||||
struct {
|
||||
guint protocol_version:4;
|
||||
guint reserved:28;
|
||||
} flags;
|
||||
glong allflags;
|
||||
} u;
|
||||
};
|
||||
|
||||
struct _GdkEventDropDataAvailable
|
||||
{
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
guint32 requestor;
|
||||
union {
|
||||
struct {
|
||||
guint protocol_version:4;
|
||||
guint isdrop:1;
|
||||
guint reserved:25;
|
||||
} flags;
|
||||
glong allflags;
|
||||
} u;
|
||||
gchar *data_type; /* MIME type */
|
||||
gulong data_numbytes;
|
||||
gpointer data;
|
||||
guint32 timestamp;
|
||||
GdkPoint coords;
|
||||
};
|
||||
|
||||
struct _GdkEventClient
|
||||
{
|
||||
GdkEventType type;
|
||||
@@ -1185,12 +1126,16 @@ struct _GdkEventClient
|
||||
} data;
|
||||
};
|
||||
|
||||
struct _GdkEventOther
|
||||
{
|
||||
/* Event types for DND */
|
||||
|
||||
struct _GdkEventDND {
|
||||
GdkEventType type;
|
||||
GdkWindow *window;
|
||||
gint8 send_event;
|
||||
GdkXEvent *xevent;
|
||||
GdkDragContext *context;
|
||||
|
||||
guint32 time;
|
||||
gshort x_root, y_root;
|
||||
};
|
||||
|
||||
union _GdkEvent
|
||||
@@ -1209,13 +1154,8 @@ union _GdkEvent
|
||||
GdkEventProperty property;
|
||||
GdkEventSelection selection;
|
||||
GdkEventProximity proximity;
|
||||
GdkEventDragBegin dragbegin;
|
||||
GdkEventDragRequest dragrequest;
|
||||
GdkEventDropEnter dropenter;
|
||||
GdkEventDropLeave dropleave;
|
||||
GdkEventDropDataAvailable dropdataavailable;
|
||||
GdkEventClient client;
|
||||
GdkEventOther other;
|
||||
GdkEventDND dnd;
|
||||
};
|
||||
|
||||
struct _GdkRegion
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkx.h"
|
||||
|
||||
|
||||
static void gdk_visual_add (GdkVisual *visual);
|
||||
@@ -210,9 +211,9 @@ gdk_visual_init (void)
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_debug_flags & GDK_DEBUG_MISC)
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
g_print ("Gdk: visual: %s: %d\n",
|
||||
visual_names[visuals[i].visual.type],
|
||||
visuals[i].visual.depth);
|
||||
g_message ("visual: %s: %d",
|
||||
visual_names[visuals[i].visual.type],
|
||||
visuals[i].visual.depth);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
navailable_depths = 0;
|
||||
|
||||
681
gdk/gdkwindow.c
681
gdk/gdkwindow.c
@@ -58,6 +58,7 @@ int event_mask_table[20] =
|
||||
SubstructureNotifyMask
|
||||
};
|
||||
|
||||
static gboolean gdk_window_have_shape_ext (void);
|
||||
|
||||
/* internal function created for and used by gdk_window_xid_at_coords */
|
||||
Window
|
||||
@@ -208,14 +209,17 @@ gdk_window_init (void)
|
||||
&x, &y, &width, &height, &border_width, &depth);
|
||||
XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
|
||||
|
||||
gdk_root_parent.xdisplay = gdk_display;
|
||||
gdk_root_parent.xwindow = gdk_root_window;
|
||||
gdk_root_parent.xdisplay = gdk_display;
|
||||
gdk_root_parent.window_type = GDK_WINDOW_ROOT;
|
||||
gdk_root_parent.window.user_data = NULL;
|
||||
gdk_root_parent.width = width;
|
||||
gdk_root_parent.height = height;
|
||||
gdk_root_parent.children = NULL;
|
||||
gdk_root_parent.colormap = NULL;
|
||||
gdk_root_parent.ref_count = 1;
|
||||
|
||||
gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
@@ -282,14 +286,6 @@ gdk_window_new (GdkWindow *parent,
|
||||
private->height = (attributes->height > 1) ? (attributes->height) : (1);
|
||||
private->window_type = attributes->window_type;
|
||||
private->extension_events = FALSE;
|
||||
private->dnd_drag_data_type = None;
|
||||
private->dnd_drag_data_typesavail =
|
||||
private->dnd_drop_data_typesavail = NULL;
|
||||
private->dnd_drop_enabled = private->dnd_drag_enabled =
|
||||
private->dnd_drag_accepted = private->dnd_drag_datashow =
|
||||
private->dnd_drop_data_numtypesavail =
|
||||
private->dnd_drag_data_numtypesavail = 0;
|
||||
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
|
||||
|
||||
private->filters = NULL;
|
||||
private->children = NULL;
|
||||
@@ -407,7 +403,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
(private->colormap != gdk_colormap_get_system ()) &&
|
||||
(private->colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
|
||||
{
|
||||
GDK_NOTE (MISC, g_print ("adding colormap window\n"));
|
||||
GDK_NOTE (MISC, g_message ("adding colormap window\n"));
|
||||
gdk_window_add_colormap_windows (window);
|
||||
}
|
||||
|
||||
@@ -437,7 +433,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
if (attributes_mask & GDK_WA_TITLE)
|
||||
title = attributes->title;
|
||||
else
|
||||
title = gdk_progname;
|
||||
title = g_get_prgname ();
|
||||
|
||||
XmbSetWMProperties (private->xdisplay, private->xwindow,
|
||||
title, title,
|
||||
@@ -503,15 +499,6 @@ gdk_window_foreign_new (guint32 anid)
|
||||
|
||||
private->colormap = NULL;
|
||||
|
||||
private->dnd_drag_data_type = None;
|
||||
private->dnd_drag_data_typesavail =
|
||||
private->dnd_drop_data_typesavail = NULL;
|
||||
private->dnd_drop_enabled = private->dnd_drag_enabled =
|
||||
private->dnd_drag_accepted = private->dnd_drag_datashow =
|
||||
private->dnd_drop_data_numtypesavail =
|
||||
private->dnd_drag_data_numtypesavail = 0;
|
||||
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
|
||||
|
||||
private->filters = NULL;
|
||||
private->children = NULL;
|
||||
|
||||
@@ -581,17 +568,6 @@ gdk_window_internal_destroy (GdkWindow *window, gboolean xdestroy,
|
||||
if (private->extension_events != 0)
|
||||
gdk_input_window_destroy (window);
|
||||
|
||||
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 (private->filters)
|
||||
{
|
||||
tmp = private->filters;
|
||||
@@ -703,7 +679,13 @@ gdk_window_unref (GdkWindow *window)
|
||||
if (private->ref_count == 0)
|
||||
{
|
||||
if (!private->destroyed)
|
||||
g_warning ("losing last reference to undestroyed window\n");
|
||||
{
|
||||
if (private->window_type == GDK_WINDOW_FOREIGN)
|
||||
gdk_xid_table_remove (private->xwindow);
|
||||
else
|
||||
g_warning ("losing last reference to undestroyed window\n");
|
||||
}
|
||||
g_dataset_destroy (window);
|
||||
g_free (window);
|
||||
}
|
||||
}
|
||||
@@ -857,6 +839,8 @@ gdk_window_reparent (GdkWindow *window,
|
||||
parent_private->xwindow,
|
||||
x, y);
|
||||
|
||||
window_private->parent = new_parent;
|
||||
|
||||
if (old_parent_private)
|
||||
old_parent_private->children = g_list_remove (old_parent_private->children, window);
|
||||
parent_private->children = g_list_prepend (parent_private->children, window);
|
||||
@@ -1318,6 +1302,62 @@ gdk_window_get_origin (GdkWindow *window,
|
||||
return return_val;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_get_root_origin (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
Window xwindow;
|
||||
Window xparent;
|
||||
Window root;
|
||||
Window *children;
|
||||
unsigned int nchildren;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
private = (GdkWindowPrivate*) window;
|
||||
if (x)
|
||||
*x = 0;
|
||||
if (y)
|
||||
*y = 0;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
|
||||
private = (GdkWindowPrivate*) private->parent;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
xparent = private->xwindow;
|
||||
do
|
||||
{
|
||||
xwindow = xparent;
|
||||
if (!XQueryTree (private->xdisplay, xwindow,
|
||||
&root, &xparent,
|
||||
&children, &nchildren))
|
||||
return;
|
||||
|
||||
if (children)
|
||||
XFree (children);
|
||||
}
|
||||
while (xparent != root);
|
||||
|
||||
if (xparent == root)
|
||||
{
|
||||
unsigned int ww, wh, wb, wd;
|
||||
int wx, wy;
|
||||
|
||||
if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
|
||||
{
|
||||
if (x)
|
||||
*x = wx;
|
||||
if (y)
|
||||
*y = wy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
gdk_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
@@ -1562,6 +1602,24 @@ gdk_window_add_colormap_windows (GdkWindow *window)
|
||||
XFree (old_windows);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_have_shape_ext (void)
|
||||
{
|
||||
enum { UNKNOWN, NO, YES };
|
||||
static gint have_shape = UNKNOWN;
|
||||
|
||||
if (have_shape == UNKNOWN)
|
||||
{
|
||||
int ignore;
|
||||
if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
|
||||
have_shape = YES;
|
||||
else
|
||||
have_shape = NO;
|
||||
}
|
||||
|
||||
return (have_shape == YES);
|
||||
}
|
||||
|
||||
/*
|
||||
* This needs the X11 shape extension.
|
||||
* If not available, shaped windows will look
|
||||
@@ -1572,31 +1630,18 @@ gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
GdkBitmap *mask,
|
||||
gint x, gint y)
|
||||
{
|
||||
enum { UNKNOWN, NO, YES };
|
||||
|
||||
static gint have_shape = UNKNOWN;
|
||||
|
||||
GdkWindowPrivate *window_private;
|
||||
Pixmap pixmap;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
if (have_shape == UNKNOWN)
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (gdk_window_have_shape_ext())
|
||||
{
|
||||
int ignore;
|
||||
if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
|
||||
have_shape = YES;
|
||||
else
|
||||
have_shape = NO;
|
||||
}
|
||||
|
||||
if (have_shape == YES)
|
||||
{
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (mask)
|
||||
{
|
||||
GdkWindowPrivate *pixmap_private;
|
||||
@@ -1621,189 +1666,6 @@ gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
#endif /* HAVE_SHAPE_EXT */
|
||||
}
|
||||
|
||||
void
|
||||
gdk_dnd_drag_addwindow (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (window_private->dnd_drag_enabled == 1 && gdk_dnd.drag_really == 0)
|
||||
{
|
||||
gdk_dnd.drag_numwindows++;
|
||||
gdk_dnd.drag_startwindows = g_realloc (gdk_dnd.drag_startwindows,
|
||||
gdk_dnd.drag_numwindows
|
||||
* sizeof(GdkWindow *));
|
||||
gdk_dnd.drag_startwindows[gdk_dnd.drag_numwindows - 1] = window;
|
||||
window_private->dnd_drag_accepted = 0;
|
||||
}
|
||||
else
|
||||
g_warning ("dnd_really is 1 or drag is not enabled! can't addwindow\n");
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_dnd_drag_set (GdkWindow *window,
|
||||
guint8 drag_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
int i, wasset = 0;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
window_private->dnd_drag_enabled = drag_enable ? 1 : 0;
|
||||
|
||||
if (drag_enable)
|
||||
{
|
||||
g_return_if_fail(typelist != NULL);
|
||||
|
||||
if (window_private->dnd_drag_data_numtypesavail > 3)
|
||||
wasset = 1;
|
||||
window_private->dnd_drag_data_numtypesavail = numtypes;
|
||||
|
||||
window_private->dnd_drag_data_typesavail =
|
||||
g_realloc (window_private->dnd_drag_data_typesavail,
|
||||
(numtypes + 1) * sizeof (GdkAtom));
|
||||
|
||||
for (i = 0; i < numtypes; i++)
|
||||
{
|
||||
/* Allow blanket use of ALL to get anything... */
|
||||
if (strcmp (typelist[i], "ALL"))
|
||||
window_private->dnd_drag_data_typesavail[i] =
|
||||
gdk_atom_intern (typelist[i], FALSE);
|
||||
else
|
||||
window_private->dnd_drag_data_typesavail[i] = None;
|
||||
}
|
||||
|
||||
/*
|
||||
* set our extended type list if we need to
|
||||
*/
|
||||
if (numtypes > 3)
|
||||
gdk_property_change(window, gdk_dnd.gdk_XdeTypelist,
|
||||
XA_PRIMARY, 32, GDK_PROP_MODE_REPLACE,
|
||||
(guchar *)(window_private->dnd_drag_data_typesavail
|
||||
+ (sizeof(GdkAtom) * 3)),
|
||||
(numtypes - 3) * sizeof(GdkAtom));
|
||||
else if (wasset)
|
||||
gdk_property_delete (window, gdk_dnd.gdk_XdeTypelist);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (window_private->dnd_drag_data_typesavail);
|
||||
window_private->dnd_drag_data_typesavail = NULL;
|
||||
window_private->dnd_drag_data_numtypesavail = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_dnd_drop_set (GdkWindow *window,
|
||||
guint8 drop_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes,
|
||||
guint8 destructive_op)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
int i;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
window_private->dnd_drop_enabled = drop_enable ? 1 : 0;
|
||||
if (drop_enable)
|
||||
{
|
||||
g_return_if_fail(typelist != NULL);
|
||||
|
||||
window_private->dnd_drop_data_numtypesavail = numtypes;
|
||||
|
||||
window_private->dnd_drop_data_typesavail =
|
||||
g_realloc (window_private->dnd_drop_data_typesavail,
|
||||
(numtypes + 1) * sizeof (GdkAtom));
|
||||
|
||||
for (i = 0; i < numtypes; i++)
|
||||
window_private->dnd_drop_data_typesavail[i] =
|
||||
gdk_atom_intern (typelist[i], FALSE);
|
||||
|
||||
window_private->dnd_drop_destructive_op = destructive_op;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is used to reply to a GDK_DRAG_REQUEST event
|
||||
* (which may be generated by XdeRequest or a confirmed drop...
|
||||
*/
|
||||
void
|
||||
gdk_window_dnd_data_set (GdkWindow *window,
|
||||
GdkEvent *event,
|
||||
gpointer data,
|
||||
gulong data_numbytes)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
XEvent sev;
|
||||
GdkEventDropDataAvailable tmp_ev;
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (event != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (data_numbytes > 0);
|
||||
g_return_if_fail (event->type == GDK_DRAG_REQUEST);
|
||||
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
g_return_if_fail (window_private->dnd_drag_accepted != 0);
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
/* We set the property on our window... */
|
||||
gdk_property_change (window, window_private->dnd_drag_data_type,
|
||||
XA_PRIMARY, 8, GDK_PROP_MODE_REPLACE, data,
|
||||
data_numbytes);
|
||||
tmp = gdk_atom_name(window_private->dnd_drag_data_type);
|
||||
#ifdef DEBUG_DND
|
||||
g_print("DnD type %s on window %ld\n", tmp, window_private->xwindow);
|
||||
#endif
|
||||
g_free(tmp);
|
||||
|
||||
/*
|
||||
* Then we send the event to tell the receiving window that the
|
||||
* drop has happened
|
||||
*/
|
||||
tmp_ev.u.allflags = 0;
|
||||
tmp_ev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
tmp_ev.u.flags.isdrop = event->dragrequest.isdrop;
|
||||
|
||||
sev.xclient.type = ClientMessage;
|
||||
sev.xclient.format = 32;
|
||||
sev.xclient.window = event->dragrequest.requestor;
|
||||
sev.xclient.message_type = gdk_dnd.gdk_XdeDataAvailable;
|
||||
sev.xclient.data.l[0] = window_private->xwindow;
|
||||
sev.xclient.data.l[1] = tmp_ev.u.allflags;
|
||||
sev.xclient.data.l[2] = window_private->dnd_drag_data_type;
|
||||
|
||||
if (event->dragrequest.isdrop)
|
||||
sev.xclient.data.l[3] = event->dragrequest.drop_coords.x +
|
||||
(event->dragrequest.drop_coords.y << 16);
|
||||
else
|
||||
sev.xclient.data.l[3] = 0;
|
||||
|
||||
sev.xclient.data.l[4] = event->dragrequest.timestamp;
|
||||
|
||||
if (!gdk_send_xevent (event->dragrequest.requestor, False,
|
||||
StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
|
||||
event->dragrequest.requestor));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_add_filter (GdkWindow *window,
|
||||
GdkFilterFunc function,
|
||||
@@ -1846,7 +1708,7 @@ gdk_window_remove_filter (GdkWindow *window,
|
||||
gpointer data)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
GList *tmp_list;
|
||||
GList *tmp_list, *node;
|
||||
GdkEventFilter *filter;
|
||||
|
||||
private = (GdkWindowPrivate*) window;
|
||||
@@ -1859,15 +1721,16 @@ gdk_window_remove_filter (GdkWindow *window,
|
||||
while (tmp_list)
|
||||
{
|
||||
filter = (GdkEventFilter *)tmp_list->data;
|
||||
node = tmp_list;
|
||||
tmp_list = tmp_list->next;
|
||||
|
||||
if ((filter->function == function) && (filter->data == data))
|
||||
{
|
||||
if(private)
|
||||
private->filters = g_list_remove_link (private->filters, tmp_list);
|
||||
private->filters = g_list_remove_link (private->filters, node);
|
||||
else
|
||||
gdk_default_filters = g_list_remove_link (gdk_default_filters, tmp_list);
|
||||
g_list_free_1 (tmp_list);
|
||||
g_list_free_1 (node);
|
||||
g_free (filter);
|
||||
|
||||
return;
|
||||
@@ -2075,3 +1938,349 @@ gdk_window_get_toplevels (void)
|
||||
return new_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* propagate the shapes from all child windows of a GDK window to the parent
|
||||
* window. Shamelessly ripped from Enlightenment's code
|
||||
*
|
||||
* - Raster
|
||||
*/
|
||||
|
||||
struct _gdk_span
|
||||
{
|
||||
gint start;
|
||||
gint end;
|
||||
struct _gdk_span *next;
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_add_to_span(struct _gdk_span **s, int x, int xx)
|
||||
{
|
||||
struct _gdk_span *ptr1, *ptr2, *noo, *ss;
|
||||
gchar spanning;
|
||||
|
||||
ptr2 = NULL;
|
||||
ptr1 = *s;
|
||||
spanning = 0;
|
||||
ss = NULL;
|
||||
/* scan the spans for this line */
|
||||
while (ptr1)
|
||||
{
|
||||
/* -- -> new span */
|
||||
/* == -> existing span */
|
||||
/* ## -> spans intersect */
|
||||
/* if we are in the middle of spanning the span into the line */
|
||||
if (spanning)
|
||||
{
|
||||
/* case: ---- ==== */
|
||||
if (xx < ptr1->start - 1)
|
||||
{
|
||||
/* ends before next span - extend to here */
|
||||
ss->end = xx;
|
||||
return;
|
||||
}
|
||||
/* case: ----##=== */
|
||||
else if (xx <= ptr1->end)
|
||||
{
|
||||
/* crosses into next span - delete next span and append */
|
||||
ss->end = ptr1->end;
|
||||
ss->next = ptr1->next;
|
||||
g_free(ptr1);
|
||||
return;
|
||||
}
|
||||
/* case: ---###--- */
|
||||
else
|
||||
{
|
||||
/* overlaps next span - delete and keep checking */
|
||||
ss->next = ptr1->next;
|
||||
g_free(ptr1);
|
||||
ptr1 = ss;
|
||||
}
|
||||
}
|
||||
/* otherwise havent started spanning it in yet */
|
||||
else
|
||||
{
|
||||
/* case: ---- ==== */
|
||||
if (xx < ptr1->start - 1)
|
||||
{
|
||||
/* insert span here in list */
|
||||
noo = g_malloc(sizeof(struct _gdk_span));
|
||||
|
||||
if (noo)
|
||||
{
|
||||
noo->start = x;
|
||||
noo->end = xx;
|
||||
noo->next = ptr1;
|
||||
if (ptr2)
|
||||
ptr2->next = noo;
|
||||
else
|
||||
*s = noo;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* case: ----##=== */
|
||||
else if ((x < ptr1->start) && (xx <= ptr1->end))
|
||||
{
|
||||
/* expand this span to the left point of the new one */
|
||||
ptr1->start = x;
|
||||
return;
|
||||
}
|
||||
/* case: ===###=== */
|
||||
else if ((x >= ptr1->start) && (xx <= ptr1->end))
|
||||
{
|
||||
/* throw the span away */
|
||||
return;
|
||||
}
|
||||
/* case: ---###--- */
|
||||
else if ((x < ptr1->start) && (xx > ptr1->end))
|
||||
{
|
||||
ss = ptr1;
|
||||
spanning = 1;
|
||||
ptr1->start = x;
|
||||
ptr1->end = xx;
|
||||
}
|
||||
/* case: ===##---- */
|
||||
else if ((x >= ptr1->start) && (x <= ptr1->end + 1) && (xx > ptr1->end))
|
||||
{
|
||||
ss = ptr1;
|
||||
spanning = 1;
|
||||
ptr1->end = xx;
|
||||
}
|
||||
/* case: ==== ---- */
|
||||
/* case handled by next loop iteration - first case */
|
||||
}
|
||||
ptr2 = ptr1;
|
||||
ptr1 = ptr1->next;
|
||||
}
|
||||
/* it started in the middle but spans beyond your current list */
|
||||
if (spanning)
|
||||
{
|
||||
ptr2->end = xx;
|
||||
return;
|
||||
}
|
||||
/* it does not start inside a span or in the middle, so add it to the end */
|
||||
noo = g_malloc(sizeof(struct _gdk_span));
|
||||
|
||||
if (noo)
|
||||
{
|
||||
noo->start = x;
|
||||
noo->end = xx;
|
||||
if (ptr2)
|
||||
{
|
||||
noo->next = ptr2->next;
|
||||
ptr2->next = noo;
|
||||
}
|
||||
else
|
||||
{
|
||||
noo->next = NULL;
|
||||
*s = noo;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_add_rectangles (Display *disp, Window win, struct _gdk_span **spans,
|
||||
gint basew, gint baseh, gint x, gint y)
|
||||
{
|
||||
gint a, k;
|
||||
gint x1, y1, x2, y2;
|
||||
gint rn, ord;
|
||||
XRectangle *rl;
|
||||
|
||||
rl = XShapeGetRectangles(disp, win, ShapeBounding, &rn, &ord);
|
||||
if (rl)
|
||||
{
|
||||
/* go through all clip rects in this window's shape */
|
||||
for (k = 0; k < rn; k++)
|
||||
{
|
||||
/* for each clip rect, add it to each line's spans */
|
||||
x1 = x + rl[k].x;
|
||||
x2 = x + rl[k].x + (rl[k].width - 1);
|
||||
y1 = y + rl[k].y;
|
||||
y2 = y + rl[k].y + (rl[k].height - 1);
|
||||
if (x1 < 0)
|
||||
x1 = 0;
|
||||
if (y1 < 0)
|
||||
y1 = 0;
|
||||
if (x2 >= basew)
|
||||
x2 = basew - 1;
|
||||
if (y2 >= baseh)
|
||||
y2 = baseh - 1;
|
||||
for (a = y1; a <= y2; a++)
|
||||
{
|
||||
if ((x2 - x1) >= 0)
|
||||
gdk_add_to_span(&spans[a], x1, x2);
|
||||
}
|
||||
}
|
||||
XFree(rl);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_propagate_shapes(Display *disp, Window win, gboolean merge)
|
||||
{
|
||||
Window rt, par, *list = NULL;
|
||||
gint i, j, num = 0, num_rects = 0;
|
||||
gint x, y, contig;
|
||||
guint w, h, d;
|
||||
gint baseh, basew;
|
||||
XRectangle *rects = NULL;
|
||||
struct _gdk_span **spans = NULL, *ptr1, *ptr2, *ptr3;
|
||||
XWindowAttributes xatt;
|
||||
|
||||
XGetGeometry(disp, win, &rt, &x, &y, &w, &h, &d, &d);
|
||||
if (h <= 0)
|
||||
return;
|
||||
basew = w;
|
||||
baseh = h;
|
||||
spans = g_malloc(sizeof(struct _gdk_span *) * h);
|
||||
|
||||
for (i = 0; i < h; i++)
|
||||
spans[i] = NULL;
|
||||
XQueryTree(disp, win, &rt, &par, &list, (unsigned int *)&num);
|
||||
if (list)
|
||||
{
|
||||
/* go through all child windows and create/insert spans */
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (XGetWindowAttributes(disp, list[i], &xatt) && (xatt.map_state != IsUnmapped))
|
||||
if (XGetGeometry(disp, list[i], &rt, &x, &y, &w, &h, &d, &d))
|
||||
gdk_add_rectangles (disp, list[i], spans, basew, baseh, x, y);
|
||||
}
|
||||
if (merge)
|
||||
gdk_add_rectangles (disp, win, spans, basew, baseh, x, y);
|
||||
|
||||
/* go through the spans list and build a list of rects */
|
||||
rects = g_malloc(sizeof(XRectangle) * 256);
|
||||
num_rects = 0;
|
||||
for (i = 0; i < baseh; i++)
|
||||
{
|
||||
ptr1 = spans[i];
|
||||
/* go through the line for all spans */
|
||||
while (ptr1)
|
||||
{
|
||||
rects[num_rects].x = ptr1->start;
|
||||
rects[num_rects].y = i;
|
||||
rects[num_rects].width = ptr1->end - ptr1->start + 1;
|
||||
rects[num_rects].height = 1;
|
||||
j = i + 1;
|
||||
/* if there are more lines */
|
||||
contig = 1;
|
||||
/* while contigous rects (same start/end coords) exist */
|
||||
while ((contig) && (j < baseh))
|
||||
{
|
||||
/* search next line for spans matching this one */
|
||||
contig = 0;
|
||||
ptr2 = spans[j];
|
||||
ptr3 = NULL;
|
||||
while (ptr2)
|
||||
{
|
||||
/* if we have an exact span match set contig */
|
||||
if ((ptr2->start == ptr1->start) &&
|
||||
(ptr2->end == ptr1->end))
|
||||
{
|
||||
contig = 1;
|
||||
/* remove the span - not needed */
|
||||
if (ptr3)
|
||||
{
|
||||
ptr3->next = ptr2->next;
|
||||
g_free(ptr2);
|
||||
ptr2 = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
spans[j] = ptr2->next;
|
||||
g_free(ptr2);
|
||||
ptr2 = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* gone past the span point no point looking */
|
||||
else if (ptr2->start < ptr1->start)
|
||||
break;
|
||||
if (ptr2)
|
||||
{
|
||||
ptr3 = ptr2;
|
||||
ptr2 = ptr2->next;
|
||||
}
|
||||
}
|
||||
/* if a contiguous span was found increase the rect h */
|
||||
if (contig)
|
||||
{
|
||||
rects[num_rects].height++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
/* up the rect count */
|
||||
num_rects++;
|
||||
/* every 256 new rects increase the rect array */
|
||||
if ((num_rects % 256) == 0)
|
||||
rects = g_realloc(rects, sizeof(XRectangle) * (num_rects + 256));
|
||||
ptr1 = ptr1->next;
|
||||
}
|
||||
}
|
||||
/* set the rects as the shape mask */
|
||||
if (rects)
|
||||
{
|
||||
XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, rects, num_rects,
|
||||
ShapeSet, YXSorted);
|
||||
g_free(rects);
|
||||
}
|
||||
XFree(list);
|
||||
}
|
||||
/* free up all the spans we made */
|
||||
for (i = 0; i < baseh; i++)
|
||||
{
|
||||
ptr1 = spans[i];
|
||||
while (ptr1)
|
||||
{
|
||||
ptr2 = ptr1;
|
||||
ptr1 = ptr1->next;
|
||||
g_free(ptr2);
|
||||
}
|
||||
}
|
||||
g_free(spans);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_set_child_shapes (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
private = (GdkWindowPrivate*) window;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
if (gdk_window_have_shape_ext())
|
||||
gdk_propagate_shapes (private->xdisplay, private->xwindow, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_merge_child_shapes (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
private = (GdkWindowPrivate*) window;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
if (gdk_window_have_shape_ext())
|
||||
gdk_propagate_shapes (private->xdisplay, private->xwindow, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drawable_set_data (GdkDrawable *drawable,
|
||||
const gchar *key,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy_func)
|
||||
{
|
||||
g_dataset_set_data_full (drawable, key, data, destroy_func);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
|
||||
GdkVisual* gdkx_visual_get (VisualID xvisualid);
|
||||
/* XXX: Do not use this function until it is fixed. An X Colormap
|
||||
* is useless unless we also have the visual. */
|
||||
GdkColormap* gdkx_colormap_get (Colormap xcolormap);
|
||||
/* Utility function in gdk.c - not sure where it belongs, but it's
|
||||
needed in more than one place, so make it public */
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright 1997 Owen Taylor <owt1@cornell.edu>
|
||||
*/
|
||||
#undef G_LOG_DOMAIN
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
$1 == "#define" && NF >= 3 {
|
||||
sub(/^XC/,"GDK",$2)
|
||||
printf("%s = %s,\n",toupper($2),$3)
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
$1 == "#define" && NF >= 3 {
|
||||
sub(/^XK/,"GDK",$2)
|
||||
sub(/0X/,"0x",$3)
|
||||
print $1,$2,$3
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -16,9 +16,11 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <time.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkx.h"
|
||||
|
||||
|
||||
static gint gdk_colormap_match_color (GdkColormap *cmap,
|
||||
@@ -51,8 +53,12 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
private->visual = visual;
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
|
||||
private->hash = NULL;
|
||||
private->last_sync_time = 0;
|
||||
private->info = NULL;
|
||||
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
colormap->size = visual->colormap_size;
|
||||
@@ -62,6 +68,12 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
private->info = g_new0 (GdkColorInfo, colormap->size);
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
|
||||
(GCompareFunc) gdk_color_equal);
|
||||
|
||||
private->private_val = private_cmap;
|
||||
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
|
||||
xvisual, (private_cmap) ? (AllocAll) : (AllocNone));
|
||||
@@ -133,12 +145,15 @@ gdk_colormap_real_destroy (GdkColormap *colormap)
|
||||
GdkColormapPrivate *private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
if (private->ref_count > 0)
|
||||
return;
|
||||
g_return_if_fail (private->ref_count > 0);
|
||||
|
||||
gdk_colormap_remove (colormap);
|
||||
XFreeColormap (private->xdisplay, private->xcolormap);
|
||||
|
||||
if (private->hash)
|
||||
g_hash_table_destroy (private->hash);
|
||||
|
||||
g_free (private->info);
|
||||
g_free (colormap->colors);
|
||||
g_free (colormap);
|
||||
}
|
||||
@@ -164,13 +179,73 @@ gdk_colormap_unref (GdkColormap *cmap)
|
||||
gdk_colormap_real_destroy (cmap);
|
||||
}
|
||||
|
||||
GdkVisual *
|
||||
gdk_colormap_get_visual (GdkColormap *colormap)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, NULL);
|
||||
|
||||
private = (GdkColormapPrivate *)colormap;
|
||||
|
||||
return private->visual;
|
||||
}
|
||||
|
||||
#define MIN_SYNC_TIME 2
|
||||
|
||||
void
|
||||
gdk_colormap_sync (GdkColormap *colormap,
|
||||
gboolean force)
|
||||
{
|
||||
time_t current_time;
|
||||
GdkColormapPrivate *private = (GdkColormapPrivate *)colormap;
|
||||
XColor *xpalette;
|
||||
gint nlookup;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
current_time = time (NULL);
|
||||
if (!force && ((current_time - private->last_sync_time) < MIN_SYNC_TIME))
|
||||
return;
|
||||
|
||||
private->last_sync_time = current_time;
|
||||
|
||||
nlookup = 0;
|
||||
xpalette = g_new (XColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
if (private->info[i].ref_count == 0)
|
||||
{
|
||||
xpalette[nlookup].pixel = i;
|
||||
xpalette[nlookup].red = 0;
|
||||
xpalette[nlookup].green = 0;
|
||||
xpalette[nlookup].blue = 0;
|
||||
nlookup++;
|
||||
}
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette, nlookup);
|
||||
|
||||
for (i = 0; i < nlookup; i++)
|
||||
{
|
||||
gulong pixel = xpalette[i].pixel;
|
||||
colormap->colors[pixel].pixel = pixel;
|
||||
colormap->colors[pixel].red = xpalette[i].red;
|
||||
colormap->colors[pixel].green = xpalette[i].green;
|
||||
colormap->colors[pixel].blue = xpalette[i].blue;
|
||||
}
|
||||
|
||||
g_free (xpalette);
|
||||
}
|
||||
|
||||
|
||||
GdkColormap*
|
||||
gdk_colormap_get_system (void)
|
||||
{
|
||||
static GdkColormap *colormap = NULL;
|
||||
GdkColormapPrivate *private;
|
||||
XColor *xpalette;
|
||||
gint i;
|
||||
|
||||
if (!colormap)
|
||||
{
|
||||
@@ -181,37 +256,25 @@ gdk_colormap_get_system (void)
|
||||
private->xcolormap = DefaultColormap (gdk_display, gdk_screen);
|
||||
private->visual = gdk_visual_get_system ();
|
||||
private->private_val = FALSE;
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
|
||||
private->hash = NULL;
|
||||
private->last_sync_time = 0;
|
||||
private->info = NULL;
|
||||
|
||||
colormap->colors = NULL;
|
||||
colormap->size = private->visual->colormap_size;
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
if ((private->visual->type == GDK_VISUAL_GRAYSCALE) ||
|
||||
(private->visual->type == GDK_VISUAL_PSEUDO_COLOR))
|
||||
{
|
||||
xpalette = g_new (XColor, colormap->size);
|
||||
private->info = g_new0 (GdkColorInfo, colormap->size);
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
xpalette[i].red = 0;
|
||||
xpalette[i].green = 0;
|
||||
xpalette[i].blue = 0;
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette,
|
||||
colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = xpalette[i].pixel;
|
||||
colormap->colors[i].red = xpalette[i].red;
|
||||
colormap->colors[i].green = xpalette[i].green;
|
||||
colormap->colors[i].blue = xpalette[i].blue;
|
||||
}
|
||||
private->hash = g_hash_table_new ((GHashFunc) gdk_color_hash,
|
||||
(GCompareFunc) gdk_color_equal);
|
||||
|
||||
g_free (xpalette);
|
||||
gdk_colormap_sync (colormap, TRUE);
|
||||
}
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
@@ -257,7 +320,6 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, palette, ncolors);
|
||||
private->next_color = MAX (private->next_color, ncolors);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_DIRECT_COLOR:
|
||||
@@ -338,6 +400,7 @@ gdk_colors_alloc (GdkColormap *colormap,
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gint return_val;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, 0);
|
||||
|
||||
@@ -346,23 +409,65 @@ gdk_colors_alloc (GdkColormap *colormap,
|
||||
return_val = XAllocColorCells (private->xdisplay, private->xcolormap,
|
||||
contiguous, planes, nplanes, pixels, npixels);
|
||||
|
||||
if (return_val)
|
||||
{
|
||||
for (i=0; i<npixels; i++)
|
||||
{
|
||||
private->info[pixels[i]].ref_count++;
|
||||
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
|
||||
}
|
||||
}
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colormap_free_colors.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *pixels,
|
||||
gint npixels,
|
||||
gulong *in_pixels,
|
||||
gint in_npixels,
|
||||
gulong planes)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (in_pixels != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, planes);
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, in_npixels);
|
||||
|
||||
for (i=0; i<in_npixels; i++)
|
||||
{
|
||||
gulong pixel = in_pixels[i];
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colormap->colors[in_pixels[i]]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, planes);
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -493,19 +598,22 @@ gdk_color_parse (const gchar *spec,
|
||||
return return_val;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
/********************
|
||||
* Color allocation *
|
||||
********************/
|
||||
|
||||
/* Try to allocate a single color using XAllocColor. If it succeeds,
|
||||
* cache the result in our colormap, and store in ret.
|
||||
*/
|
||||
static gboolean
|
||||
gdk_colormap_alloc1 (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
GdkColor *ret)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor xcolor;
|
||||
gchar *available = NULL;
|
||||
gboolean return_val;
|
||||
gint i, index;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
g_return_val_if_fail (color != NULL, FALSE);
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
xcolor.red = color->red;
|
||||
xcolor.green = color->green;
|
||||
@@ -513,113 +621,458 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
xcolor.pixel = color->pixel;
|
||||
xcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
return_val = FALSE;
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
switch (private->visual->type)
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
if (private->private_val)
|
||||
ret->pixel = xcolor.pixel;
|
||||
ret->red = xcolor.red;
|
||||
ret->green = xcolor.green;
|
||||
ret->blue = xcolor.blue;
|
||||
|
||||
if (ret->pixel < colormap->size)
|
||||
{
|
||||
if (private->next_color >= colormap->size)
|
||||
if (private->info[ret->pixel].ref_count) /* got a duplicate */
|
||||
{
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
if (index != -1)
|
||||
{
|
||||
available[index] = FALSE;
|
||||
*color = colormap->colors[index];
|
||||
return_val = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return_val = FALSE;
|
||||
}
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
&ret->pixel, 1, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
xcolor.pixel = colormap->size - 1 -private->next_color;
|
||||
color->pixel = xcolor.pixel;
|
||||
private->next_color += 1;
|
||||
colormap->colors[ret->pixel] = *color;
|
||||
private->info[ret->pixel].ref_count = 1;
|
||||
|
||||
XStoreColor (private->xdisplay, private->xcolormap, &xcolor);
|
||||
return_val = TRUE;
|
||||
g_hash_table_insert (private->hash,
|
||||
&colormap->colors[ret->pixel],
|
||||
&colormap->colors[ret->pixel]);
|
||||
}
|
||||
}
|
||||
else
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_writeable (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
Status status;
|
||||
gint i, index;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if (private->private_val)
|
||||
{
|
||||
index = 0;
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
while (1)
|
||||
while ((index < colormap->size) && (private->info[index].ref_count != 0))
|
||||
index++;
|
||||
|
||||
if (index < colormap->size)
|
||||
{
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
colors[i].pixel = index;
|
||||
success[i] = TRUE;
|
||||
private->info[index].ref_count++;
|
||||
private->info[i].flags |= GDK_COLOR_WRITEABLE;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixels = g_new (gulong, ncolors);
|
||||
/* Allocation of a writeable color cells */
|
||||
|
||||
status = XAllocColorCells (private->xdisplay, private->xcolormap,
|
||||
FALSE, NULL, 0, pixels, ncolors);
|
||||
if (status)
|
||||
{
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
colors[i].pixel = pixels[i];
|
||||
private->info[pixels[i]].ref_count++;
|
||||
private->info[pixels[i]].flags |= GDK_COLOR_WRITEABLE;
|
||||
}
|
||||
}
|
||||
|
||||
g_free (pixels);
|
||||
|
||||
return status ? ncolors : 0;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_private (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gint i, index;
|
||||
XColor *store = g_new (XColor, ncolors);
|
||||
gint nstore = 0;
|
||||
gint nremaining = 0;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
index = -1;
|
||||
|
||||
/* First, store the colors we have room for */
|
||||
|
||||
index = 0;
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
while ((index < colormap->size) && (private->info[index].ref_count != 0))
|
||||
index++;
|
||||
|
||||
if (index < colormap->size)
|
||||
{
|
||||
store[nstore].red = colors[i].red;
|
||||
store[nstore].blue = colors[i].blue;
|
||||
store[nstore].green = colors[i].green;
|
||||
store[nstore].pixel = index;
|
||||
nstore++;
|
||||
|
||||
success[i] = TRUE;
|
||||
|
||||
colors[i].pixel = index;
|
||||
private->info[index].ref_count++;
|
||||
}
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
}
|
||||
|
||||
XStoreColors (private->xdisplay, private->xcolormap, store, nstore);
|
||||
g_free (store);
|
||||
|
||||
if (nremaining > 0 && best_match)
|
||||
{
|
||||
/* Get best matches for remaining colors */
|
||||
|
||||
gchar *available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
index = gdk_colormap_match_color (colormap,
|
||||
&colors[i],
|
||||
available);
|
||||
if (index != -1)
|
||||
{
|
||||
color->pixel = xcolor.pixel;
|
||||
color->red = xcolor.red;
|
||||
color->green = xcolor.green;
|
||||
color->blue = xcolor.blue;
|
||||
colors[i] = colormap->colors[index];
|
||||
private->info[index].ref_count++;
|
||||
|
||||
if (color->pixel < colormap->size)
|
||||
colormap->colors[color->pixel] = *color;
|
||||
|
||||
return_val = TRUE;
|
||||
break;
|
||||
success[i] = TRUE;
|
||||
nremaining--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (available == NULL)
|
||||
{
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free (available);
|
||||
}
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
return (ncolors - nremaining);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_shared (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gint i, index;
|
||||
gint nremaining = 0;
|
||||
gint nfailed = 0;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
index = -1;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
if (gdk_colormap_alloc1 (colormap, &colors[i], &colors[i]))
|
||||
success[i] = TRUE;
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nremaining > 0 && best_match)
|
||||
{
|
||||
gchar *available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = ((private->info[i].ref_count == 0) ||
|
||||
!(private->info[i].flags && GDK_COLOR_WRITEABLE));
|
||||
gdk_colormap_sync (colormap, FALSE);
|
||||
|
||||
while (nremaining > 0)
|
||||
{
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
index = gdk_colormap_match_color (colormap, &colors[i], available);
|
||||
if (index != -1)
|
||||
{
|
||||
available[index] = FALSE;
|
||||
xcolor.red = colormap->colors[index].red;
|
||||
xcolor.green = colormap->colors[index].green;
|
||||
xcolor.blue = colormap->colors[index].blue;
|
||||
if (private->info[index].ref_count)
|
||||
{
|
||||
private->info[index].ref_count++;
|
||||
colors[i] = colormap->colors[index];
|
||||
success[i] = TRUE;
|
||||
nremaining--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gdk_colormap_alloc1 (colormap,
|
||||
&colormap->colors[index],
|
||||
&colors[i]))
|
||||
{
|
||||
success[i] = TRUE;
|
||||
nremaining--;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
available[index] = FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return_val = FALSE;
|
||||
break;
|
||||
nfailed++;
|
||||
nremaining--;
|
||||
success[i] = 2; /* flag as permanent failure */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
g_free (available);
|
||||
}
|
||||
|
||||
/* Change back the values we flagged as permanent failures */
|
||||
if (nfailed > 0)
|
||||
{
|
||||
for (i=0; i<ncolors; i++)
|
||||
if (success[i] == 2)
|
||||
success[i] = FALSE;
|
||||
nremaining = nfailed;
|
||||
}
|
||||
|
||||
return (ncolors - nremaining);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_colormap_alloc_colors_pseudocolor (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkColor *lookup_color;
|
||||
gint i;
|
||||
gint nremaining = 0;
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
/* Check for an exact match among previously allocated colors */
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
if (!success[i])
|
||||
{
|
||||
lookup_color = g_hash_table_lookup (private->hash, &colors[i]);
|
||||
if (lookup_color)
|
||||
{
|
||||
private->info[lookup_color->pixel].ref_count++;
|
||||
colors[i].pixel = lookup_color->pixel;
|
||||
success[i] = TRUE;
|
||||
}
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
}
|
||||
|
||||
/* If that failed, we try to allocate a new color, or approxmiate
|
||||
* with what we can get if best_match is TRUE.
|
||||
*/
|
||||
if (nremaining > 0)
|
||||
{
|
||||
if (private->private_val)
|
||||
return gdk_colormap_alloc_colors_private (colormap, colors, ncolors, writeable, best_match, success);
|
||||
else
|
||||
return gdk_colormap_alloc_colors_shared (colormap, colors, ncolors, writeable, best_match, success);
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
gint i;
|
||||
gint nremaining = 0;
|
||||
XColor xcolor;
|
||||
|
||||
g_return_val_if_fail (colormap != NULL, FALSE);
|
||||
g_return_val_if_fail (colors != NULL, FALSE);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
success[i] = FALSE;
|
||||
}
|
||||
|
||||
switch (private->visual->type)
|
||||
{
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
if (writeable)
|
||||
return gdk_colormap_alloc_colors_writeable (colormap, colors, ncolors,
|
||||
writeable, best_match, success);
|
||||
else
|
||||
return gdk_colormap_alloc_colors_pseudocolor (colormap, colors, ncolors,
|
||||
writeable, best_match, success);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_DIRECT_COLOR:
|
||||
case GDK_VISUAL_TRUE_COLOR:
|
||||
visual = private->visual;
|
||||
xcolor.pixel = (((xcolor.red >> (16 - visual->red_prec)) << visual->red_shift) +
|
||||
((xcolor.green >> (16 - visual->green_prec)) << visual->green_shift) +
|
||||
((xcolor.blue >> (16 - visual->blue_prec)) << visual->blue_shift));
|
||||
color->pixel = xcolor.pixel;
|
||||
return_val = TRUE;
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
colors[i].pixel = (((colors[i].red >> (16 - visual->red_prec)) << visual->red_shift) +
|
||||
((colors[i].green >> (16 - visual->green_prec)) << visual->green_shift) +
|
||||
((colors[i].blue >> (16 - visual->blue_prec)) << visual->blue_shift));
|
||||
success[i] = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_STATIC_GRAY:
|
||||
case GDK_VISUAL_STATIC_COLOR:
|
||||
case GDK_VISUAL_TRUE_COLOR:
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
color->pixel = xcolor.pixel;
|
||||
return_val = TRUE;
|
||||
xcolor.red = colors[i].red;
|
||||
xcolor.green = colors[i].green;
|
||||
xcolor.blue = colors[i].blue;
|
||||
xcolor.pixel = colors[i].pixel;
|
||||
xcolor.flags = DoRed | DoGreen | DoBlue;
|
||||
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
{
|
||||
colors[i].pixel = xcolor.pixel;
|
||||
success[i] = TRUE;
|
||||
}
|
||||
else
|
||||
nremaining++;
|
||||
}
|
||||
else
|
||||
return_val = FALSE;
|
||||
break;
|
||||
}
|
||||
return nremaining;
|
||||
}
|
||||
|
||||
if (available)
|
||||
g_free (available);
|
||||
|
||||
return return_val;
|
||||
gboolean
|
||||
gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
gboolean writeable,
|
||||
gboolean best_match)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
gdk_colormap_alloc_colors (colormap, color, 1, writeable, best_match,
|
||||
&success);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colors_free.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (colors != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, ncolors);
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
gulong pixel = colors[i].pixel;
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colors[i]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, 0);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
gboolean success;
|
||||
|
||||
gdk_colormap_alloc_colors (colormap, color, 1, FALSE, TRUE, &success);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@@ -644,9 +1097,19 @@ gdk_color_change (GdkColormap *colormap,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
guint
|
||||
gdk_color_hash (const GdkColor *colora,
|
||||
const GdkColor *colorb)
|
||||
{
|
||||
return ((colora->red) +
|
||||
(colora->green << 11) +
|
||||
(colora->blue << 22) +
|
||||
(colora->blue >> 6));
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_color_equal (GdkColor *colora,
|
||||
GdkColor *colorb)
|
||||
gdk_color_equal (const GdkColor *colora,
|
||||
const GdkColor *colorb)
|
||||
{
|
||||
g_return_val_if_fail (colora != NULL, FALSE);
|
||||
g_return_val_if_fail (colorb != NULL, FALSE);
|
||||
@@ -656,6 +1119,9 @@ gdk_color_equal (GdkColor *colora,
|
||||
(colora->blue == colorb->blue));
|
||||
}
|
||||
|
||||
/* XXX: Do not use this function until it is fixed. An X Colormap
|
||||
* is useless unless we also have the visual.
|
||||
*/
|
||||
GdkColormap*
|
||||
gdkx_colormap_get (Colormap xcolormap)
|
||||
{
|
||||
@@ -676,7 +1142,6 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
private->xcolormap = xcolormap;
|
||||
private->visual = NULL;
|
||||
private->private_val = TRUE;
|
||||
private->next_color = 0;
|
||||
|
||||
/* To do the following safely, we would have to have some way of finding
|
||||
* out what the size or visual of the given colormap is. It seems
|
||||
|
||||
3007
gdk/x11/gdkdnd-x11.c
3007
gdk/x11/gdkdnd-x11.c
File diff suppressed because it is too large
Load Diff
@@ -72,9 +72,9 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
if (missing_charset_count)
|
||||
{
|
||||
gint i;
|
||||
g_print ("Missing charsets in FontSet creation\n");
|
||||
g_message ("Missing charsets in FontSet creation\n");
|
||||
for (i=0;i<missing_charset_count;i++)
|
||||
g_print (" %s\n", missing_charset_list[i]);
|
||||
g_message (" %s\n", missing_charset_list[i]);
|
||||
XFreeStringList (missing_charset_list);
|
||||
}
|
||||
|
||||
@@ -328,6 +328,92 @@ gdk_string_measure (GdkFont *font,
|
||||
return gdk_text_measure (font, string, strlen (string));
|
||||
}
|
||||
|
||||
void
|
||||
gdk_text_extents (GdkFont *font,
|
||||
const gchar *text,
|
||||
gint text_length,
|
||||
gint *lbearing,
|
||||
gint *rbearing,
|
||||
gint *width,
|
||||
gint *ascent,
|
||||
gint *descent)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
XCharStruct overall;
|
||||
XFontStruct *xfont;
|
||||
XFontSet fontset;
|
||||
XRectangle ink, logical;
|
||||
int direction;
|
||||
int font_ascent;
|
||||
int font_descent;
|
||||
|
||||
g_return_if_fail (font != NULL);
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
xfont = (XFontStruct *) private->xfont;
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
{
|
||||
XTextExtents (xfont, text, text_length,
|
||||
&direction, &font_ascent, &font_descent,
|
||||
&overall);
|
||||
}
|
||||
else
|
||||
{
|
||||
XTextExtents16 (xfont, (XChar2b *) text, text_length / 2,
|
||||
&direction, &font_ascent, &font_descent,
|
||||
&overall);
|
||||
}
|
||||
if (lbearing)
|
||||
*lbearing = overall.lbearing;
|
||||
if (rbearing)
|
||||
*rbearing = overall.rbearing;
|
||||
if (width)
|
||||
*width = overall.width;
|
||||
if (ascent)
|
||||
*ascent = overall.ascent;
|
||||
if (descent)
|
||||
*descent = overall.descent;
|
||||
break;
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) private->xfont;
|
||||
XmbTextExtents (fontset, text, text_length, &ink, &logical);
|
||||
if (lbearing)
|
||||
*lbearing = -ink.x;
|
||||
if (rbearing)
|
||||
*rbearing = ink.y;
|
||||
if (width)
|
||||
*width = logical.width;
|
||||
if (ascent)
|
||||
*ascent = ink.height;
|
||||
if (descent)
|
||||
*descent = -ink.y;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gdk_string_extents (GdkFont *font,
|
||||
const gchar *string,
|
||||
gint *lbearing,
|
||||
gint *rbearing,
|
||||
gint *width,
|
||||
gint *ascent,
|
||||
gint *descent)
|
||||
{
|
||||
g_return_if_fail (font != NULL);
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
gdk_text_extents (font, string, strlen (string),
|
||||
lbearing, rbearing, width, ascent, descent);
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
gdk_text_measure (GdkFont *font,
|
||||
const gchar *text,
|
||||
|
||||
@@ -29,7 +29,7 @@ Display *gdk_display = NULL;
|
||||
gint gdk_screen;
|
||||
Window gdk_root_window;
|
||||
Window gdk_leader_window;
|
||||
GdkWindowPrivate gdk_root_parent;
|
||||
GdkWindowPrivate gdk_root_parent = { { NULL, }, NULL, };
|
||||
Atom gdk_wm_delete_window;
|
||||
Atom gdk_wm_take_focus;
|
||||
Atom gdk_wm_protocols;
|
||||
@@ -48,7 +48,6 @@ GdkDndGlobals gdk_dnd = {None,None,None,
|
||||
{0,0},
|
||||
{0,0}, {0,0},
|
||||
{0,0,0,0}, NULL, None, 0};
|
||||
gchar *gdk_progname = NULL;
|
||||
gchar *gdk_progclass = NULL;
|
||||
gint gdk_error_code;
|
||||
gint gdk_error_warnings = TRUE;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
#include "../config.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
|
||||
@@ -279,7 +280,10 @@ gdk_image_new (GdkImageType type,
|
||||
private->ximage = XCreateImage (private->xdisplay, xvisual, visual->depth,
|
||||
ZPixmap, 0, 0, width, height, 32, 0);
|
||||
|
||||
private->ximage->data = g_new (char, private->ximage->bytes_per_line *
|
||||
/* Use malloc, not g_malloc here, because X will call free()
|
||||
* on this data
|
||||
*/
|
||||
private->ximage->data = malloc (private->ximage->bytes_per_line *
|
||||
private->ximage->height);
|
||||
break;
|
||||
|
||||
@@ -349,7 +353,8 @@ gdk_image_get (GdkWindow *window,
|
||||
|
||||
image->mem = private->ximage->data;
|
||||
image->bpl = private->ximage->bytes_per_line;
|
||||
image->bpp = 1;
|
||||
image->bpp = private->ximage->bits_per_pixel;
|
||||
image->byte_order = private->ximage->byte_order;
|
||||
|
||||
return image;
|
||||
}
|
||||
@@ -405,6 +410,8 @@ gdk_image_destroy (GdkImage *image)
|
||||
|
||||
case GDK_IMAGE_SHARED:
|
||||
#ifdef USE_SHM
|
||||
gdk_flush();
|
||||
|
||||
XShmDetach (private->xdisplay, private->x_shm_info);
|
||||
XDestroyImage (private->ximage);
|
||||
|
||||
|
||||
@@ -591,23 +591,35 @@ gdk_input_gxi_grab_pointer (GdkWindow * window,
|
||||
GdkWindow * confine_to,
|
||||
guint32 time)
|
||||
{
|
||||
GdkInputWindow *input_window, *new_window;
|
||||
GList *tmp_list;
|
||||
GdkInputWindow *input_window;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
while (tmp_list)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (input_window->grabbed)
|
||||
return AlreadyGrabbed;
|
||||
|
||||
if (input_window->window == window)
|
||||
new_window = input_window;
|
||||
input_window->grabbed = TRUE;
|
||||
else if (input_window->grabbed)
|
||||
input_window->grabbed = FALSE;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
|
||||
gdkdev->xdevice &&
|
||||
(gdkdev->button_state != 0))
|
||||
gdkdev->button_state = 0;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
new_window->grabbed = TRUE;
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ gdk_input_xfree_configure_event (XConfigureEvent *xevent, GdkWindow *window)
|
||||
|
||||
static void
|
||||
gdk_input_xfree_enter_event (XCrossingEvent *xevent,
|
||||
GdkWindow *window)
|
||||
GdkWindow *window)
|
||||
{
|
||||
GdkInputWindow *input_window;
|
||||
gint root_x, root_y;
|
||||
@@ -257,6 +257,7 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
|
||||
guint32 time)
|
||||
{
|
||||
GdkInputWindow *input_window, *new_window;
|
||||
gboolean need_ungrab;
|
||||
GdkDevicePrivate *gdkdev;
|
||||
GList *tmp_list;
|
||||
XEventClass event_classes[GDK_MAX_DEVICE_CLASSES];
|
||||
@@ -265,47 +266,70 @@ gdk_input_xfree_grab_pointer (GdkWindow * window,
|
||||
|
||||
tmp_list = gdk_input_windows;
|
||||
new_window = NULL;
|
||||
need_ungrab = FALSE;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
input_window = (GdkInputWindow *)tmp_list->data;
|
||||
if (input_window->grabbed)
|
||||
return AlreadyGrabbed;
|
||||
|
||||
if (input_window->window == window)
|
||||
new_window = input_window;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_return_val_if_fail (new_window != NULL, Success); /* shouldn't happen */
|
||||
|
||||
new_window->grabbed = TRUE;
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
|
||||
gdkdev->xdevice)
|
||||
else if (input_window->grabbed)
|
||||
{
|
||||
gdk_input_common_find_events (window, gdkdev,
|
||||
event_mask,
|
||||
event_classes, &num_classes);
|
||||
|
||||
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;
|
||||
input_window->grabbed = FALSE;
|
||||
need_ungrab = TRUE;
|
||||
}
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
|
||||
if (new_window)
|
||||
{
|
||||
new_window->grabbed = TRUE;
|
||||
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER &&
|
||||
gdkdev->xdevice)
|
||||
{
|
||||
gdk_input_common_find_events (window, gdkdev,
|
||||
event_mask,
|
||||
event_classes, &num_classes);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tmp_list = gdk_input_devices;
|
||||
while (tmp_list)
|
||||
{
|
||||
gdkdev = (GdkDevicePrivate *)tmp_list->data;
|
||||
if (gdkdev->info.deviceid != GDK_CORE_POINTER && gdkdev->xdevice &&
|
||||
((gdkdev->button_state != 0) || need_ungrab))
|
||||
{
|
||||
XUngrabDevice( gdk_display, gdkdev->xdevice, time);
|
||||
gdkdev->button_state = 0;
|
||||
}
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
}
|
||||
|
||||
return Success;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,13 @@ typedef struct
|
||||
gint transparent;
|
||||
} _GdkPixmapColor;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
guint ncolors;
|
||||
GdkColormap *colormap;
|
||||
gulong pixels[1];
|
||||
} _GdkPixmapInfo;
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_new (GdkWindow *window,
|
||||
gint width,
|
||||
@@ -175,7 +182,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
gint
|
||||
static gint
|
||||
gdk_pixmap_seek_string (FILE *infile,
|
||||
const gchar *str,
|
||||
gint skip_comments)
|
||||
@@ -199,7 +206,7 @@ gdk_pixmap_seek_string (FILE *infile,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
static gint
|
||||
gdk_pixmap_seek_char (FILE *infile,
|
||||
gchar c)
|
||||
{
|
||||
@@ -231,7 +238,7 @@ gdk_pixmap_seek_char (FILE *infile,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
static gint
|
||||
gdk_pixmap_read_string (FILE *infile,
|
||||
gchar **buffer,
|
||||
guint *buffer_size)
|
||||
@@ -286,7 +293,7 @@ gdk_pixmap_read_string (FILE *infile,
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar*
|
||||
static gchar*
|
||||
gdk_pixmap_skip_whitespaces (gchar *buffer)
|
||||
{
|
||||
gint32 index = 0;
|
||||
@@ -297,7 +304,7 @@ gdk_pixmap_skip_whitespaces (gchar *buffer)
|
||||
return &buffer[index];
|
||||
}
|
||||
|
||||
gchar*
|
||||
static gchar*
|
||||
gdk_pixmap_skip_string (gchar *buffer)
|
||||
{
|
||||
gint32 index = 0;
|
||||
@@ -311,7 +318,7 @@ gdk_pixmap_skip_string (gchar *buffer)
|
||||
/* Xlib crashed ince at a color name lengths around 125 */
|
||||
#define MAX_COLOR_LEN 120
|
||||
|
||||
gchar*
|
||||
static gchar*
|
||||
gdk_pixmap_extract_color (gchar *buffer)
|
||||
{
|
||||
gint counter, numnames;
|
||||
@@ -388,13 +395,6 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
return retcol;
|
||||
}
|
||||
|
||||
static void
|
||||
free_color (gpointer key, gpointer value, gpointer user_data)
|
||||
{
|
||||
g_free (key);
|
||||
g_free (value);
|
||||
}
|
||||
|
||||
|
||||
enum buffer_op
|
||||
{
|
||||
@@ -403,6 +403,23 @@ enum buffer_op
|
||||
op_body
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
gdk_xpm_destroy_notify (gpointer data)
|
||||
{
|
||||
_GdkPixmapInfo *info = (_GdkPixmapInfo *)data;
|
||||
GdkColor color;
|
||||
int i;
|
||||
|
||||
for (i=0; i<info->ncolors; i++)
|
||||
{
|
||||
color.pixel = info->pixels[i];
|
||||
gdk_colormap_free_colors (info->colormap, &color, 1);
|
||||
}
|
||||
|
||||
gdk_colormap_unref (info->colormap);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static GdkPixmap *
|
||||
_gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
@@ -420,9 +437,12 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, n, ns, cnt, xcnt, ycnt, wbytes;
|
||||
gchar *buffer, pixel_str[32];
|
||||
gchar *name_buf;
|
||||
_GdkPixmapColor *color = NULL, *fallbackcolor = NULL;
|
||||
_GdkPixmapColor *colors = NULL;
|
||||
gulong index;
|
||||
GHashTable *colors = NULL;
|
||||
GHashTable *color_hash = NULL;
|
||||
_GdkPixmapInfo *color_info = NULL;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
@@ -449,14 +469,30 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
colors = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
color_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
transparent_color = &tmp_color;
|
||||
}
|
||||
|
||||
|
||||
/* For pseudo-color and grayscale visuals, we have to remember
|
||||
* the colors we allocated, so we can free them later.
|
||||
*/
|
||||
if ((visual->type == GDK_VISUAL_PSEUDO_COLOR) ||
|
||||
(visual->type == GDK_VISUAL_GRAYSCALE))
|
||||
{
|
||||
color_info = g_malloc (sizeof (_GdkPixmapInfo) +
|
||||
sizeof(gulong) * (num_cols - 1));
|
||||
color_info->ncolors = num_cols;
|
||||
color_info->colormap = colormap;
|
||||
gdk_colormap_ref (colormap);
|
||||
}
|
||||
|
||||
name_buf = g_new (gchar, num_cols * (cpp+1));
|
||||
colors = g_new (_GdkPixmapColor, num_cols);
|
||||
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
@@ -465,8 +501,8 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
if (buffer == NULL)
|
||||
goto error;
|
||||
|
||||
color = g_new (_GdkPixmapColor, 1);
|
||||
color->color_string = g_new (gchar, cpp + 1);
|
||||
color = &colors[cnt];
|
||||
color->color_string = &name_buf [cnt * (cpp + 1)];
|
||||
strncpy (color->color_string, buffer, cpp);
|
||||
color->color_string[cpp] = 0;
|
||||
buffer += strlen (color->color_string);
|
||||
@@ -486,7 +522,11 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
/* FIXME: The remaining slowness appears to happen in this
|
||||
function. */
|
||||
gdk_color_alloc (colormap, &color->color);
|
||||
g_hash_table_insert (colors, color->color_string, color);
|
||||
|
||||
if (color_info)
|
||||
color_info->pixels[cnt] = color->color.pixel;
|
||||
|
||||
g_hash_table_insert (color_hash, color->color_string, color);
|
||||
if (cnt == 0)
|
||||
fallbackcolor = color;
|
||||
}
|
||||
@@ -531,7 +571,7 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
pixel_str[cpp] = 0;
|
||||
ns = 0;
|
||||
|
||||
color = g_hash_table_lookup (colors, pixel_str);
|
||||
color = g_hash_table_lookup (color_hash, pixel_str);
|
||||
|
||||
if (!color) /* screwed up XPM file */
|
||||
color = fallbackcolor;
|
||||
@@ -558,6 +598,10 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
if (image != NULL)
|
||||
{
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
if (color_info)
|
||||
gdk_drawable_set_data (pixmap, "gdk-xpm", color_info,
|
||||
gdk_xpm_destroy_notify);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
@@ -565,13 +609,18 @@ _gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
}
|
||||
else if (color_info)
|
||||
gdk_xpm_destroy_notify (color_info);
|
||||
|
||||
if (color_hash != NULL)
|
||||
g_hash_table_destroy (color_hash);
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
g_hash_table_foreach (colors, free_color, 0);
|
||||
g_hash_table_destroy (colors);
|
||||
}
|
||||
|
||||
g_free (colors);
|
||||
|
||||
if (name_buf != NULL)
|
||||
g_free (name_buf);
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
@@ -720,6 +769,7 @@ gdk_pixmap_unref (GdkPixmap *pixmap)
|
||||
{
|
||||
XFreePixmap (private->xdisplay, private->xwindow);
|
||||
gdk_xid_table_remove (private->xwindow);
|
||||
g_dataset_destroy (private);
|
||||
g_free (private);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,21 @@
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
|
||||
GdkAtom
|
||||
gdk_atom_intern (const gchar *atom_name,
|
||||
gint only_if_exists)
|
||||
{
|
||||
return XInternAtom (gdk_display, atom_name, only_if_exists);
|
||||
GdkAtom retval;
|
||||
static GHashTable *atom_hash = NULL;
|
||||
|
||||
if (!atom_hash)
|
||||
atom_hash = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
retval = GPOINTER_TO_UINT (g_hash_table_lookup (atom_hash, atom_name));
|
||||
if (!retval)
|
||||
retval = XInternAtom (gdk_display, atom_name, only_if_exists);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
gchar *
|
||||
@@ -35,14 +44,16 @@ gdk_atom_name (GdkAtom atom)
|
||||
{
|
||||
gchar *t;
|
||||
gchar *name;
|
||||
gint old_error_warnings;
|
||||
|
||||
/* If this atom doesn't exist, we'll die with an X error unless
|
||||
we take precautions */
|
||||
|
||||
old_error_warnings = gdk_error_warnings;
|
||||
gdk_error_warnings = 0;
|
||||
gdk_error_code = 0;
|
||||
t = XGetAtomName (gdk_display, atom);
|
||||
gdk_error_warnings = 1;
|
||||
gdk_error_warnings = old_error_warnings;
|
||||
|
||||
if (gdk_error_code == -1)
|
||||
{
|
||||
@@ -115,7 +126,7 @@ gdk_property_get (GdkWindow *window,
|
||||
if (actual_format_type)
|
||||
*actual_format_type = ret_format;
|
||||
|
||||
if (ret_prop_type != type)
|
||||
if ((type != AnyPropertyType) && (ret_prop_type != type))
|
||||
{
|
||||
gchar *rn, *pn;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <X11/Xutil.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkx.h"
|
||||
|
||||
|
||||
static void gdk_visual_add (GdkVisual *visual);
|
||||
@@ -210,9 +211,9 @@ gdk_visual_init (void)
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_debug_flags & GDK_DEBUG_MISC)
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
g_print ("Gdk: visual: %s: %d\n",
|
||||
visual_names[visuals[i].visual.type],
|
||||
visuals[i].visual.depth);
|
||||
g_message ("visual: %s: %d",
|
||||
visual_names[visuals[i].visual.type],
|
||||
visuals[i].visual.depth);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
navailable_depths = 0;
|
||||
|
||||
@@ -58,6 +58,7 @@ int event_mask_table[20] =
|
||||
SubstructureNotifyMask
|
||||
};
|
||||
|
||||
static gboolean gdk_window_have_shape_ext (void);
|
||||
|
||||
/* internal function created for and used by gdk_window_xid_at_coords */
|
||||
Window
|
||||
@@ -208,14 +209,17 @@ gdk_window_init (void)
|
||||
&x, &y, &width, &height, &border_width, &depth);
|
||||
XGetWindowAttributes (gdk_display, gdk_root_window, &xattributes);
|
||||
|
||||
gdk_root_parent.xdisplay = gdk_display;
|
||||
gdk_root_parent.xwindow = gdk_root_window;
|
||||
gdk_root_parent.xdisplay = gdk_display;
|
||||
gdk_root_parent.window_type = GDK_WINDOW_ROOT;
|
||||
gdk_root_parent.window.user_data = NULL;
|
||||
gdk_root_parent.width = width;
|
||||
gdk_root_parent.height = height;
|
||||
gdk_root_parent.children = NULL;
|
||||
gdk_root_parent.colormap = NULL;
|
||||
gdk_root_parent.ref_count = 1;
|
||||
|
||||
gdk_xid_table_insert (&gdk_root_window, &gdk_root_parent);
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
@@ -282,14 +286,6 @@ gdk_window_new (GdkWindow *parent,
|
||||
private->height = (attributes->height > 1) ? (attributes->height) : (1);
|
||||
private->window_type = attributes->window_type;
|
||||
private->extension_events = FALSE;
|
||||
private->dnd_drag_data_type = None;
|
||||
private->dnd_drag_data_typesavail =
|
||||
private->dnd_drop_data_typesavail = NULL;
|
||||
private->dnd_drop_enabled = private->dnd_drag_enabled =
|
||||
private->dnd_drag_accepted = private->dnd_drag_datashow =
|
||||
private->dnd_drop_data_numtypesavail =
|
||||
private->dnd_drag_data_numtypesavail = 0;
|
||||
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
|
||||
|
||||
private->filters = NULL;
|
||||
private->children = NULL;
|
||||
@@ -407,7 +403,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
(private->colormap != gdk_colormap_get_system ()) &&
|
||||
(private->colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
|
||||
{
|
||||
GDK_NOTE (MISC, g_print ("adding colormap window\n"));
|
||||
GDK_NOTE (MISC, g_message ("adding colormap window\n"));
|
||||
gdk_window_add_colormap_windows (window);
|
||||
}
|
||||
|
||||
@@ -437,7 +433,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
if (attributes_mask & GDK_WA_TITLE)
|
||||
title = attributes->title;
|
||||
else
|
||||
title = gdk_progname;
|
||||
title = g_get_prgname ();
|
||||
|
||||
XmbSetWMProperties (private->xdisplay, private->xwindow,
|
||||
title, title,
|
||||
@@ -503,15 +499,6 @@ gdk_window_foreign_new (guint32 anid)
|
||||
|
||||
private->colormap = NULL;
|
||||
|
||||
private->dnd_drag_data_type = None;
|
||||
private->dnd_drag_data_typesavail =
|
||||
private->dnd_drop_data_typesavail = NULL;
|
||||
private->dnd_drop_enabled = private->dnd_drag_enabled =
|
||||
private->dnd_drag_accepted = private->dnd_drag_datashow =
|
||||
private->dnd_drop_data_numtypesavail =
|
||||
private->dnd_drag_data_numtypesavail = 0;
|
||||
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
|
||||
|
||||
private->filters = NULL;
|
||||
private->children = NULL;
|
||||
|
||||
@@ -581,17 +568,6 @@ gdk_window_internal_destroy (GdkWindow *window, gboolean xdestroy,
|
||||
if (private->extension_events != 0)
|
||||
gdk_input_window_destroy (window);
|
||||
|
||||
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 (private->filters)
|
||||
{
|
||||
tmp = private->filters;
|
||||
@@ -703,7 +679,13 @@ gdk_window_unref (GdkWindow *window)
|
||||
if (private->ref_count == 0)
|
||||
{
|
||||
if (!private->destroyed)
|
||||
g_warning ("losing last reference to undestroyed window\n");
|
||||
{
|
||||
if (private->window_type == GDK_WINDOW_FOREIGN)
|
||||
gdk_xid_table_remove (private->xwindow);
|
||||
else
|
||||
g_warning ("losing last reference to undestroyed window\n");
|
||||
}
|
||||
g_dataset_destroy (window);
|
||||
g_free (window);
|
||||
}
|
||||
}
|
||||
@@ -857,6 +839,8 @@ gdk_window_reparent (GdkWindow *window,
|
||||
parent_private->xwindow,
|
||||
x, y);
|
||||
|
||||
window_private->parent = new_parent;
|
||||
|
||||
if (old_parent_private)
|
||||
old_parent_private->children = g_list_remove (old_parent_private->children, window);
|
||||
parent_private->children = g_list_prepend (parent_private->children, window);
|
||||
@@ -1318,6 +1302,62 @@ gdk_window_get_origin (GdkWindow *window,
|
||||
return return_val;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_get_root_origin (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
Window xwindow;
|
||||
Window xparent;
|
||||
Window root;
|
||||
Window *children;
|
||||
unsigned int nchildren;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
private = (GdkWindowPrivate*) window;
|
||||
if (x)
|
||||
*x = 0;
|
||||
if (y)
|
||||
*y = 0;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
while (private->parent && ((GdkWindowPrivate*) private->parent)->parent)
|
||||
private = (GdkWindowPrivate*) private->parent;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
xparent = private->xwindow;
|
||||
do
|
||||
{
|
||||
xwindow = xparent;
|
||||
if (!XQueryTree (private->xdisplay, xwindow,
|
||||
&root, &xparent,
|
||||
&children, &nchildren))
|
||||
return;
|
||||
|
||||
if (children)
|
||||
XFree (children);
|
||||
}
|
||||
while (xparent != root);
|
||||
|
||||
if (xparent == root)
|
||||
{
|
||||
unsigned int ww, wh, wb, wd;
|
||||
int wx, wy;
|
||||
|
||||
if (XGetGeometry (private->xdisplay, xwindow, &root, &wx, &wy, &ww, &wh, &wb, &wd))
|
||||
{
|
||||
if (x)
|
||||
*x = wx;
|
||||
if (y)
|
||||
*y = wy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
gdk_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
@@ -1562,6 +1602,24 @@ gdk_window_add_colormap_windows (GdkWindow *window)
|
||||
XFree (old_windows);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_window_have_shape_ext (void)
|
||||
{
|
||||
enum { UNKNOWN, NO, YES };
|
||||
static gint have_shape = UNKNOWN;
|
||||
|
||||
if (have_shape == UNKNOWN)
|
||||
{
|
||||
int ignore;
|
||||
if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
|
||||
have_shape = YES;
|
||||
else
|
||||
have_shape = NO;
|
||||
}
|
||||
|
||||
return (have_shape == YES);
|
||||
}
|
||||
|
||||
/*
|
||||
* This needs the X11 shape extension.
|
||||
* If not available, shaped windows will look
|
||||
@@ -1572,31 +1630,18 @@ gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
GdkBitmap *mask,
|
||||
gint x, gint y)
|
||||
{
|
||||
enum { UNKNOWN, NO, YES };
|
||||
|
||||
static gint have_shape = UNKNOWN;
|
||||
|
||||
GdkWindowPrivate *window_private;
|
||||
Pixmap pixmap;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
if (have_shape == UNKNOWN)
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (gdk_window_have_shape_ext())
|
||||
{
|
||||
int ignore;
|
||||
if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
|
||||
have_shape = YES;
|
||||
else
|
||||
have_shape = NO;
|
||||
}
|
||||
|
||||
if (have_shape == YES)
|
||||
{
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (mask)
|
||||
{
|
||||
GdkWindowPrivate *pixmap_private;
|
||||
@@ -1621,189 +1666,6 @@ gdk_window_shape_combine_mask (GdkWindow *window,
|
||||
#endif /* HAVE_SHAPE_EXT */
|
||||
}
|
||||
|
||||
void
|
||||
gdk_dnd_drag_addwindow (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (window_private->dnd_drag_enabled == 1 && gdk_dnd.drag_really == 0)
|
||||
{
|
||||
gdk_dnd.drag_numwindows++;
|
||||
gdk_dnd.drag_startwindows = g_realloc (gdk_dnd.drag_startwindows,
|
||||
gdk_dnd.drag_numwindows
|
||||
* sizeof(GdkWindow *));
|
||||
gdk_dnd.drag_startwindows[gdk_dnd.drag_numwindows - 1] = window;
|
||||
window_private->dnd_drag_accepted = 0;
|
||||
}
|
||||
else
|
||||
g_warning ("dnd_really is 1 or drag is not enabled! can't addwindow\n");
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_dnd_drag_set (GdkWindow *window,
|
||||
guint8 drag_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
int i, wasset = 0;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
window_private->dnd_drag_enabled = drag_enable ? 1 : 0;
|
||||
|
||||
if (drag_enable)
|
||||
{
|
||||
g_return_if_fail(typelist != NULL);
|
||||
|
||||
if (window_private->dnd_drag_data_numtypesavail > 3)
|
||||
wasset = 1;
|
||||
window_private->dnd_drag_data_numtypesavail = numtypes;
|
||||
|
||||
window_private->dnd_drag_data_typesavail =
|
||||
g_realloc (window_private->dnd_drag_data_typesavail,
|
||||
(numtypes + 1) * sizeof (GdkAtom));
|
||||
|
||||
for (i = 0; i < numtypes; i++)
|
||||
{
|
||||
/* Allow blanket use of ALL to get anything... */
|
||||
if (strcmp (typelist[i], "ALL"))
|
||||
window_private->dnd_drag_data_typesavail[i] =
|
||||
gdk_atom_intern (typelist[i], FALSE);
|
||||
else
|
||||
window_private->dnd_drag_data_typesavail[i] = None;
|
||||
}
|
||||
|
||||
/*
|
||||
* set our extended type list if we need to
|
||||
*/
|
||||
if (numtypes > 3)
|
||||
gdk_property_change(window, gdk_dnd.gdk_XdeTypelist,
|
||||
XA_PRIMARY, 32, GDK_PROP_MODE_REPLACE,
|
||||
(guchar *)(window_private->dnd_drag_data_typesavail
|
||||
+ (sizeof(GdkAtom) * 3)),
|
||||
(numtypes - 3) * sizeof(GdkAtom));
|
||||
else if (wasset)
|
||||
gdk_property_delete (window, gdk_dnd.gdk_XdeTypelist);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_free (window_private->dnd_drag_data_typesavail);
|
||||
window_private->dnd_drag_data_typesavail = NULL;
|
||||
window_private->dnd_drag_data_numtypesavail = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_dnd_drop_set (GdkWindow *window,
|
||||
guint8 drop_enable,
|
||||
gchar **typelist,
|
||||
guint numtypes,
|
||||
guint8 destructive_op)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
int i;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
window_private->dnd_drop_enabled = drop_enable ? 1 : 0;
|
||||
if (drop_enable)
|
||||
{
|
||||
g_return_if_fail(typelist != NULL);
|
||||
|
||||
window_private->dnd_drop_data_numtypesavail = numtypes;
|
||||
|
||||
window_private->dnd_drop_data_typesavail =
|
||||
g_realloc (window_private->dnd_drop_data_typesavail,
|
||||
(numtypes + 1) * sizeof (GdkAtom));
|
||||
|
||||
for (i = 0; i < numtypes; i++)
|
||||
window_private->dnd_drop_data_typesavail[i] =
|
||||
gdk_atom_intern (typelist[i], FALSE);
|
||||
|
||||
window_private->dnd_drop_destructive_op = destructive_op;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is used to reply to a GDK_DRAG_REQUEST event
|
||||
* (which may be generated by XdeRequest or a confirmed drop...
|
||||
*/
|
||||
void
|
||||
gdk_window_dnd_data_set (GdkWindow *window,
|
||||
GdkEvent *event,
|
||||
gpointer data,
|
||||
gulong data_numbytes)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
XEvent sev;
|
||||
GdkEventDropDataAvailable tmp_ev;
|
||||
gchar *tmp;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
g_return_if_fail (event != NULL);
|
||||
g_return_if_fail (data != NULL);
|
||||
g_return_if_fail (data_numbytes > 0);
|
||||
g_return_if_fail (event->type == GDK_DRAG_REQUEST);
|
||||
|
||||
window_private = (GdkWindowPrivate *) window;
|
||||
g_return_if_fail (window_private->dnd_drag_accepted != 0);
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
/* We set the property on our window... */
|
||||
gdk_property_change (window, window_private->dnd_drag_data_type,
|
||||
XA_PRIMARY, 8, GDK_PROP_MODE_REPLACE, data,
|
||||
data_numbytes);
|
||||
tmp = gdk_atom_name(window_private->dnd_drag_data_type);
|
||||
#ifdef DEBUG_DND
|
||||
g_print("DnD type %s on window %ld\n", tmp, window_private->xwindow);
|
||||
#endif
|
||||
g_free(tmp);
|
||||
|
||||
/*
|
||||
* Then we send the event to tell the receiving window that the
|
||||
* drop has happened
|
||||
*/
|
||||
tmp_ev.u.allflags = 0;
|
||||
tmp_ev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
tmp_ev.u.flags.isdrop = event->dragrequest.isdrop;
|
||||
|
||||
sev.xclient.type = ClientMessage;
|
||||
sev.xclient.format = 32;
|
||||
sev.xclient.window = event->dragrequest.requestor;
|
||||
sev.xclient.message_type = gdk_dnd.gdk_XdeDataAvailable;
|
||||
sev.xclient.data.l[0] = window_private->xwindow;
|
||||
sev.xclient.data.l[1] = tmp_ev.u.allflags;
|
||||
sev.xclient.data.l[2] = window_private->dnd_drag_data_type;
|
||||
|
||||
if (event->dragrequest.isdrop)
|
||||
sev.xclient.data.l[3] = event->dragrequest.drop_coords.x +
|
||||
(event->dragrequest.drop_coords.y << 16);
|
||||
else
|
||||
sev.xclient.data.l[3] = 0;
|
||||
|
||||
sev.xclient.data.l[4] = event->dragrequest.timestamp;
|
||||
|
||||
if (!gdk_send_xevent (event->dragrequest.requestor, False,
|
||||
StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
|
||||
event->dragrequest.requestor));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_add_filter (GdkWindow *window,
|
||||
GdkFilterFunc function,
|
||||
@@ -1846,7 +1708,7 @@ gdk_window_remove_filter (GdkWindow *window,
|
||||
gpointer data)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
GList *tmp_list;
|
||||
GList *tmp_list, *node;
|
||||
GdkEventFilter *filter;
|
||||
|
||||
private = (GdkWindowPrivate*) window;
|
||||
@@ -1859,15 +1721,16 @@ gdk_window_remove_filter (GdkWindow *window,
|
||||
while (tmp_list)
|
||||
{
|
||||
filter = (GdkEventFilter *)tmp_list->data;
|
||||
node = tmp_list;
|
||||
tmp_list = tmp_list->next;
|
||||
|
||||
if ((filter->function == function) && (filter->data == data))
|
||||
{
|
||||
if(private)
|
||||
private->filters = g_list_remove_link (private->filters, tmp_list);
|
||||
private->filters = g_list_remove_link (private->filters, node);
|
||||
else
|
||||
gdk_default_filters = g_list_remove_link (gdk_default_filters, tmp_list);
|
||||
g_list_free_1 (tmp_list);
|
||||
g_list_free_1 (node);
|
||||
g_free (filter);
|
||||
|
||||
return;
|
||||
@@ -2075,3 +1938,349 @@ gdk_window_get_toplevels (void)
|
||||
return new_list;
|
||||
}
|
||||
|
||||
/*
|
||||
* propagate the shapes from all child windows of a GDK window to the parent
|
||||
* window. Shamelessly ripped from Enlightenment's code
|
||||
*
|
||||
* - Raster
|
||||
*/
|
||||
|
||||
struct _gdk_span
|
||||
{
|
||||
gint start;
|
||||
gint end;
|
||||
struct _gdk_span *next;
|
||||
};
|
||||
|
||||
static void
|
||||
gdk_add_to_span(struct _gdk_span **s, int x, int xx)
|
||||
{
|
||||
struct _gdk_span *ptr1, *ptr2, *noo, *ss;
|
||||
gchar spanning;
|
||||
|
||||
ptr2 = NULL;
|
||||
ptr1 = *s;
|
||||
spanning = 0;
|
||||
ss = NULL;
|
||||
/* scan the spans for this line */
|
||||
while (ptr1)
|
||||
{
|
||||
/* -- -> new span */
|
||||
/* == -> existing span */
|
||||
/* ## -> spans intersect */
|
||||
/* if we are in the middle of spanning the span into the line */
|
||||
if (spanning)
|
||||
{
|
||||
/* case: ---- ==== */
|
||||
if (xx < ptr1->start - 1)
|
||||
{
|
||||
/* ends before next span - extend to here */
|
||||
ss->end = xx;
|
||||
return;
|
||||
}
|
||||
/* case: ----##=== */
|
||||
else if (xx <= ptr1->end)
|
||||
{
|
||||
/* crosses into next span - delete next span and append */
|
||||
ss->end = ptr1->end;
|
||||
ss->next = ptr1->next;
|
||||
g_free(ptr1);
|
||||
return;
|
||||
}
|
||||
/* case: ---###--- */
|
||||
else
|
||||
{
|
||||
/* overlaps next span - delete and keep checking */
|
||||
ss->next = ptr1->next;
|
||||
g_free(ptr1);
|
||||
ptr1 = ss;
|
||||
}
|
||||
}
|
||||
/* otherwise havent started spanning it in yet */
|
||||
else
|
||||
{
|
||||
/* case: ---- ==== */
|
||||
if (xx < ptr1->start - 1)
|
||||
{
|
||||
/* insert span here in list */
|
||||
noo = g_malloc(sizeof(struct _gdk_span));
|
||||
|
||||
if (noo)
|
||||
{
|
||||
noo->start = x;
|
||||
noo->end = xx;
|
||||
noo->next = ptr1;
|
||||
if (ptr2)
|
||||
ptr2->next = noo;
|
||||
else
|
||||
*s = noo;
|
||||
}
|
||||
return;
|
||||
}
|
||||
/* case: ----##=== */
|
||||
else if ((x < ptr1->start) && (xx <= ptr1->end))
|
||||
{
|
||||
/* expand this span to the left point of the new one */
|
||||
ptr1->start = x;
|
||||
return;
|
||||
}
|
||||
/* case: ===###=== */
|
||||
else if ((x >= ptr1->start) && (xx <= ptr1->end))
|
||||
{
|
||||
/* throw the span away */
|
||||
return;
|
||||
}
|
||||
/* case: ---###--- */
|
||||
else if ((x < ptr1->start) && (xx > ptr1->end))
|
||||
{
|
||||
ss = ptr1;
|
||||
spanning = 1;
|
||||
ptr1->start = x;
|
||||
ptr1->end = xx;
|
||||
}
|
||||
/* case: ===##---- */
|
||||
else if ((x >= ptr1->start) && (x <= ptr1->end + 1) && (xx > ptr1->end))
|
||||
{
|
||||
ss = ptr1;
|
||||
spanning = 1;
|
||||
ptr1->end = xx;
|
||||
}
|
||||
/* case: ==== ---- */
|
||||
/* case handled by next loop iteration - first case */
|
||||
}
|
||||
ptr2 = ptr1;
|
||||
ptr1 = ptr1->next;
|
||||
}
|
||||
/* it started in the middle but spans beyond your current list */
|
||||
if (spanning)
|
||||
{
|
||||
ptr2->end = xx;
|
||||
return;
|
||||
}
|
||||
/* it does not start inside a span or in the middle, so add it to the end */
|
||||
noo = g_malloc(sizeof(struct _gdk_span));
|
||||
|
||||
if (noo)
|
||||
{
|
||||
noo->start = x;
|
||||
noo->end = xx;
|
||||
if (ptr2)
|
||||
{
|
||||
noo->next = ptr2->next;
|
||||
ptr2->next = noo;
|
||||
}
|
||||
else
|
||||
{
|
||||
noo->next = NULL;
|
||||
*s = noo;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_add_rectangles (Display *disp, Window win, struct _gdk_span **spans,
|
||||
gint basew, gint baseh, gint x, gint y)
|
||||
{
|
||||
gint a, k;
|
||||
gint x1, y1, x2, y2;
|
||||
gint rn, ord;
|
||||
XRectangle *rl;
|
||||
|
||||
rl = XShapeGetRectangles(disp, win, ShapeBounding, &rn, &ord);
|
||||
if (rl)
|
||||
{
|
||||
/* go through all clip rects in this window's shape */
|
||||
for (k = 0; k < rn; k++)
|
||||
{
|
||||
/* for each clip rect, add it to each line's spans */
|
||||
x1 = x + rl[k].x;
|
||||
x2 = x + rl[k].x + (rl[k].width - 1);
|
||||
y1 = y + rl[k].y;
|
||||
y2 = y + rl[k].y + (rl[k].height - 1);
|
||||
if (x1 < 0)
|
||||
x1 = 0;
|
||||
if (y1 < 0)
|
||||
y1 = 0;
|
||||
if (x2 >= basew)
|
||||
x2 = basew - 1;
|
||||
if (y2 >= baseh)
|
||||
y2 = baseh - 1;
|
||||
for (a = y1; a <= y2; a++)
|
||||
{
|
||||
if ((x2 - x1) >= 0)
|
||||
gdk_add_to_span(&spans[a], x1, x2);
|
||||
}
|
||||
}
|
||||
XFree(rl);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_propagate_shapes(Display *disp, Window win, gboolean merge)
|
||||
{
|
||||
Window rt, par, *list = NULL;
|
||||
gint i, j, num = 0, num_rects = 0;
|
||||
gint x, y, contig;
|
||||
guint w, h, d;
|
||||
gint baseh, basew;
|
||||
XRectangle *rects = NULL;
|
||||
struct _gdk_span **spans = NULL, *ptr1, *ptr2, *ptr3;
|
||||
XWindowAttributes xatt;
|
||||
|
||||
XGetGeometry(disp, win, &rt, &x, &y, &w, &h, &d, &d);
|
||||
if (h <= 0)
|
||||
return;
|
||||
basew = w;
|
||||
baseh = h;
|
||||
spans = g_malloc(sizeof(struct _gdk_span *) * h);
|
||||
|
||||
for (i = 0; i < h; i++)
|
||||
spans[i] = NULL;
|
||||
XQueryTree(disp, win, &rt, &par, &list, (unsigned int *)&num);
|
||||
if (list)
|
||||
{
|
||||
/* go through all child windows and create/insert spans */
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (XGetWindowAttributes(disp, list[i], &xatt) && (xatt.map_state != IsUnmapped))
|
||||
if (XGetGeometry(disp, list[i], &rt, &x, &y, &w, &h, &d, &d))
|
||||
gdk_add_rectangles (disp, list[i], spans, basew, baseh, x, y);
|
||||
}
|
||||
if (merge)
|
||||
gdk_add_rectangles (disp, win, spans, basew, baseh, x, y);
|
||||
|
||||
/* go through the spans list and build a list of rects */
|
||||
rects = g_malloc(sizeof(XRectangle) * 256);
|
||||
num_rects = 0;
|
||||
for (i = 0; i < baseh; i++)
|
||||
{
|
||||
ptr1 = spans[i];
|
||||
/* go through the line for all spans */
|
||||
while (ptr1)
|
||||
{
|
||||
rects[num_rects].x = ptr1->start;
|
||||
rects[num_rects].y = i;
|
||||
rects[num_rects].width = ptr1->end - ptr1->start + 1;
|
||||
rects[num_rects].height = 1;
|
||||
j = i + 1;
|
||||
/* if there are more lines */
|
||||
contig = 1;
|
||||
/* while contigous rects (same start/end coords) exist */
|
||||
while ((contig) && (j < baseh))
|
||||
{
|
||||
/* search next line for spans matching this one */
|
||||
contig = 0;
|
||||
ptr2 = spans[j];
|
||||
ptr3 = NULL;
|
||||
while (ptr2)
|
||||
{
|
||||
/* if we have an exact span match set contig */
|
||||
if ((ptr2->start == ptr1->start) &&
|
||||
(ptr2->end == ptr1->end))
|
||||
{
|
||||
contig = 1;
|
||||
/* remove the span - not needed */
|
||||
if (ptr3)
|
||||
{
|
||||
ptr3->next = ptr2->next;
|
||||
g_free(ptr2);
|
||||
ptr2 = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
spans[j] = ptr2->next;
|
||||
g_free(ptr2);
|
||||
ptr2 = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* gone past the span point no point looking */
|
||||
else if (ptr2->start < ptr1->start)
|
||||
break;
|
||||
if (ptr2)
|
||||
{
|
||||
ptr3 = ptr2;
|
||||
ptr2 = ptr2->next;
|
||||
}
|
||||
}
|
||||
/* if a contiguous span was found increase the rect h */
|
||||
if (contig)
|
||||
{
|
||||
rects[num_rects].height++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
/* up the rect count */
|
||||
num_rects++;
|
||||
/* every 256 new rects increase the rect array */
|
||||
if ((num_rects % 256) == 0)
|
||||
rects = g_realloc(rects, sizeof(XRectangle) * (num_rects + 256));
|
||||
ptr1 = ptr1->next;
|
||||
}
|
||||
}
|
||||
/* set the rects as the shape mask */
|
||||
if (rects)
|
||||
{
|
||||
XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, rects, num_rects,
|
||||
ShapeSet, YXSorted);
|
||||
g_free(rects);
|
||||
}
|
||||
XFree(list);
|
||||
}
|
||||
/* free up all the spans we made */
|
||||
for (i = 0; i < baseh; i++)
|
||||
{
|
||||
ptr1 = spans[i];
|
||||
while (ptr1)
|
||||
{
|
||||
ptr2 = ptr1;
|
||||
ptr1 = ptr1->next;
|
||||
g_free(ptr2);
|
||||
}
|
||||
}
|
||||
g_free(spans);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_set_child_shapes (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
private = (GdkWindowPrivate*) window;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
if (gdk_window_have_shape_ext())
|
||||
gdk_propagate_shapes (private->xdisplay, private->xwindow, FALSE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_merge_child_shapes (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
|
||||
g_return_if_fail (window != NULL);
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
private = (GdkWindowPrivate*) window;
|
||||
if (private->destroyed)
|
||||
return;
|
||||
|
||||
if (gdk_window_have_shape_ext())
|
||||
gdk_propagate_shapes (private->xdisplay, private->xwindow, TRUE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
gdk_drawable_set_data (GdkDrawable *drawable,
|
||||
const gchar *key,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy_func)
|
||||
{
|
||||
g_dataset_set_data_full (drawable, key, data, destroy_func);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
|
||||
|
||||
GdkVisual* gdkx_visual_get (VisualID xvisualid);
|
||||
/* XXX: Do not use this function until it is fixed. An X Colormap
|
||||
* is useless unless we also have the visual. */
|
||||
GdkColormap* gdkx_colormap_get (Colormap xcolormap);
|
||||
/* Utility function in gdk.c - not sure where it belongs, but it's
|
||||
needed in more than one place, so make it public */
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* Copyright 1997 Owen Taylor <owt1@cornell.edu>
|
||||
*/
|
||||
#undef G_LOG_DOMAIN
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Note that this is NOT a relocatable package
|
||||
%define ver 1.1.0
|
||||
%define ver 1.1.3
|
||||
%define rel SNAP
|
||||
%define prefix /usr
|
||||
|
||||
@@ -38,6 +38,10 @@ and GTK is a widget set for creating user interfaces.
|
||||
|
||||
%changelog
|
||||
|
||||
* Tue Aug 04 1998 Michael Fulbright <msf@redhat.com>
|
||||
|
||||
- change %postun to %preun
|
||||
|
||||
* Mon Jun 27 1998 Shawn T. Amundson
|
||||
|
||||
- Changed version to 1.1.0
|
||||
@@ -128,7 +132,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/sbin/install-info %{prefix}/info/gdk.info.gz %{prefix}/info/dir
|
||||
/sbin/install-info %{prefix}/info/gtk.info.gz %{prefix}/info/dir
|
||||
|
||||
%postun devel
|
||||
%preun devel
|
||||
if [ $1 = 0 ]; then
|
||||
/sbin/install-info --delete %{prefix}/info/gdk.info.gz %{prefix}/info/dir
|
||||
/sbin/install-info --delete %{prefix}/info/gtk.info.gz %{prefix}/info/dir
|
||||
|
||||
@@ -64,7 +64,7 @@ while test $# -gt 0; do
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo $libdirs @x_ldflags@ -lgtk-@LT_RELEASE@ -lgdk-@LT_RELEASE@ $my_glib_libs @x_libs@ -lm
|
||||
echo $libdirs @x_ldflags@ -lgtk -lgdk $my_glib_libs @x_libs@ @GDK_WLIBS@ -lm
|
||||
;;
|
||||
*)
|
||||
echo "${usage}" 1>&2
|
||||
|
||||
2
gtk.m4
2
gtk.m4
@@ -89,6 +89,7 @@ main ()
|
||||
printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
|
||||
printf("*** before re-running configure\n");
|
||||
}
|
||||
#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
|
||||
else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
|
||||
(gtk_minor_version != GTK_MINOR_VERSION) ||
|
||||
(gtk_micro_version != GTK_MICRO_VERSION))
|
||||
@@ -98,6 +99,7 @@ main ()
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
gtk_major_version, gtk_minor_version, gtk_micro_version);
|
||||
}
|
||||
#endif /* defined (GTK_MAJOR_VERSION) ... */
|
||||
else
|
||||
{
|
||||
if ((gtk_major_version > major) ||
|
||||
|
||||
@@ -8,7 +8,17 @@ libgtk-1.1.la
|
||||
testgtk
|
||||
testinput
|
||||
testselection
|
||||
testrgb
|
||||
simple
|
||||
testtree
|
||||
gtkfeatures.h
|
||||
testthreads
|
||||
libgtk.la
|
||||
gtkmarshal.h
|
||||
gtktypebuiltins.h
|
||||
gtkmarshal.c
|
||||
gtktypebuiltins_ids.c
|
||||
gtktypebuiltins_vars.c
|
||||
gtktypebuiltins_evals.c
|
||||
gtk.defs
|
||||
testdnd
|
||||
|
||||
134
gtk/Makefile.am
134
gtk/Makefile.am
@@ -1,10 +1,11 @@
|
||||
### Process this file with automake to produce Makefile.in
|
||||
|
||||
gtkincludedir = $(includedir)/gtk
|
||||
DEFS += -DG_LOG_DOMAIN=\"Gtk\"
|
||||
|
||||
lib_LTLIBRARIES = libgtk-1.1.la
|
||||
lib_LTLIBRARIES = libgtk.la
|
||||
|
||||
libgtk_1_1_la_SOURCES = \
|
||||
static_sources = \
|
||||
gtkaccelgroup.c \
|
||||
gtkaccellabel.c \
|
||||
gtkadjustment.c \
|
||||
@@ -17,6 +18,7 @@ libgtk_1_1_la_SOURCES = \
|
||||
gtkbbox.c \
|
||||
gtkbox.c \
|
||||
gtkbutton.c \
|
||||
gtkcalendar.c \
|
||||
gtkcheckbutton.c \
|
||||
gtkcheckmenuitem.c \
|
||||
gtkclist.c \
|
||||
@@ -27,7 +29,9 @@ libgtk_1_1_la_SOURCES = \
|
||||
gtkcurve.c \
|
||||
gtkdata.c \
|
||||
gtkdialog.c \
|
||||
gtkdnd.c \
|
||||
gtkdrawingarea.c \
|
||||
gtkdrawwindow.c \
|
||||
gtkeditable.c \
|
||||
gtkentry.c \
|
||||
gtkeventbox.c \
|
||||
@@ -47,13 +51,13 @@ libgtk_1_1_la_SOURCES = \
|
||||
gtkhseparator.c \
|
||||
gtkimage.c \
|
||||
gtkinputdialog.c \
|
||||
gtkinvisible.c \
|
||||
gtkitem.c \
|
||||
gtkitemfactory.c \
|
||||
gtklabel.c \
|
||||
gtklist.c \
|
||||
gtklistitem.c \
|
||||
gtkmain.c \
|
||||
gtkmarshal.c \
|
||||
gtkmenu.c \
|
||||
gtkmenubar.c \
|
||||
gtkmenufactory.c \
|
||||
@@ -84,7 +88,9 @@ libgtk_1_1_la_SOURCES = \
|
||||
gtkstyle.c \
|
||||
gtkstatusbar.c \
|
||||
gtktable.c \
|
||||
gtktearoffmenuitem.c \
|
||||
gtktext.c \
|
||||
gtkthemes.c \
|
||||
gtktipsquery.c \
|
||||
gtktogglebutton.c \
|
||||
gtktoolbar.c \
|
||||
@@ -105,7 +111,12 @@ libgtk_1_1_la_SOURCES = \
|
||||
fnmatch.c \
|
||||
fnmatch.h
|
||||
|
||||
gtkinclude_HEADERS = \
|
||||
libgtk_la_SOURCES = \
|
||||
$(static_sources) \
|
||||
gtkmarshal.c
|
||||
|
||||
# Source headers are are non-autogenerated headers
|
||||
source_headers = \
|
||||
gtk.h \
|
||||
gtkaccelgroup.h \
|
||||
gtkaccellabel.h \
|
||||
@@ -119,6 +130,7 @@ gtkinclude_HEADERS = \
|
||||
gtkbbox.h \
|
||||
gtkbox.h \
|
||||
gtkbutton.h \
|
||||
gtkcalendar.h \
|
||||
gtkcheckbutton.h \
|
||||
gtkcheckmenuitem.h \
|
||||
gtkclist.h \
|
||||
@@ -130,12 +142,13 @@ gtkinclude_HEADERS = \
|
||||
gtkdata.h \
|
||||
gtkdebug.h \
|
||||
gtkdialog.h \
|
||||
gtkdnd.h \
|
||||
gtkdrawingarea.h \
|
||||
gtkdrawwindow.h \
|
||||
gtkeditable.h \
|
||||
gtkentry.h \
|
||||
gtkenums.h \
|
||||
gtkeventbox.h \
|
||||
gtkfeatures.h \
|
||||
gtkfilesel.h \
|
||||
gtkfixed.h \
|
||||
gtkfontsel.h \
|
||||
@@ -152,13 +165,13 @@ gtkinclude_HEADERS = \
|
||||
gtkhseparator.h \
|
||||
gtkimage.h \
|
||||
gtkinputdialog.h \
|
||||
gtkinvisible.h \
|
||||
gtkitem.h \
|
||||
gtkitemfactory.h \
|
||||
gtklabel.h \
|
||||
gtklist.h \
|
||||
gtklistitem.h \
|
||||
gtkmain.h \
|
||||
gtkmarshal.h \
|
||||
gtkmenu.h \
|
||||
gtkmenubar.h \
|
||||
gtkmenufactory.h \
|
||||
@@ -190,7 +203,9 @@ gtkinclude_HEADERS = \
|
||||
gtkstyle.h \
|
||||
gtkstatusbar.h \
|
||||
gtktable.h \
|
||||
gtktearoffmenuitem.h \
|
||||
gtktext.h \
|
||||
gtkthemes.h \
|
||||
gtktipsquery.h \
|
||||
gtktogglebutton.h \
|
||||
gtktoolbar.h \
|
||||
@@ -207,61 +222,67 @@ gtkinclude_HEADERS = \
|
||||
gtkvscrollbar.h \
|
||||
gtkvseparator.h \
|
||||
gtkwidget.h \
|
||||
gtkwindow.h \
|
||||
gtkwindow.h
|
||||
|
||||
gtkinclude_HEADERS = \
|
||||
$(source_headers) \
|
||||
gtkfeatures.h \
|
||||
gtkmarshal.h \
|
||||
gtktypebuiltins.h
|
||||
|
||||
.PHONY: auto-files auto-files-1
|
||||
auto-files:
|
||||
rm -f $(srcdir)/gtk.defs
|
||||
$(MAKE) auto-files-1
|
||||
BUILT_SOURCES = \
|
||||
gtktypebuiltins.h \
|
||||
gtktypebuiltins_evals.c \
|
||||
gtktypebuiltins_ids.c \
|
||||
gtktypebuiltins_vars.c \
|
||||
gtkmarshal.c \
|
||||
gtkmarshal.h
|
||||
|
||||
auto-files-1: gtk.defs
|
||||
auto-files-1: gtktypebuiltins_evals.c gtktypebuiltins_ids.c
|
||||
auto-files-1: gtktypebuiltins_vars.c gtktypebuiltins.h
|
||||
# cause the built sources to be rebuild when possible, even with --include-deps
|
||||
$(static_sources): $(BUILT_SOURCES)
|
||||
|
||||
# More headers to use when autogenerating.
|
||||
gdk_headers = \
|
||||
../gdk/gdktypes.h \
|
||||
../gdk/gdkrgb.h
|
||||
|
||||
# generate gtk.defs file from gtk-boxed.defs and *.h
|
||||
gtk.defs: @MAINT@ makeenums.pl gtk-boxed.defs
|
||||
srcdir=$(srcdir) \
|
||||
perl $(srcdir)/makeenums.pl defs $(srcdir)/gtk*.h \
|
||||
$(top_srcdir)/gdk/gdk*.h > gd.tmp
|
||||
cat $(srcdir)/gtk-boxed.defs >> gd.tmp
|
||||
cp gd.tmp $(srcdir)/gtk.defs
|
||||
rm -f gd.tmp
|
||||
gtk.defs: @REBUILD@ makeenums.pl gtk-boxed.defs $(source_headers) $(gdk_headers)
|
||||
cd $(srcdir) \
|
||||
&& $(PERL) makeenums.pl defs $(source_headers) $(gdk_headers) > s-gd \
|
||||
&& cat gtk-boxed.defs >> s-gd \
|
||||
&& mv s-gd gtk.defs
|
||||
|
||||
# generate type identifier header (GTK_TYPE_WIDGET_FLAGS)
|
||||
gtktypebuiltins.h: @MAINT@ gtk.defs maketypes.awk
|
||||
awk -f $(srcdir)/maketypes.awk $(srcdir)/gtk.defs macros > gtb.tmp
|
||||
cp gtb.tmp $(srcdir)/gtktypebuiltins.h
|
||||
rm -f gtb.tmp
|
||||
gtktypebuiltins.h: @REBUILD@ gtk.defs maketypes.awk
|
||||
cd $(srcdir) \
|
||||
&& $(AWK) -f maketypes.awk gtk.defs macros > s-gtb \
|
||||
&& mv s-gtb gtktypebuiltins.h
|
||||
|
||||
# generate type identifier variables (GTK_TYPE_WIDGET_FLAGS)
|
||||
gtktypebuiltins_vars.c: @MAINT@ gtk.defs maketypes.awk
|
||||
awk -f $(srcdir)/maketypes.awk $(srcdir)/gtk.defs variables > gtbv.tmp
|
||||
cp gtbv.tmp $(srcdir)/gtktypebuiltins_vars.c
|
||||
rm -f gtbv.tmp
|
||||
gtktypebuiltins_vars.c: @REBUILD@ gtk.defs maketypes.awk
|
||||
cd $(srcdir) \
|
||||
&& $(AWK) -f maketypes.awk gtk.defs variables > s-gtbv \
|
||||
&& mv s-gtbv gtktypebuiltins_vars.c
|
||||
|
||||
# generate type entries for type-id registration
|
||||
gtktypebuiltins_ids.c: @MAINT@ gtk.defs maketypes.awk
|
||||
awk -f $(srcdir)/maketypes.awk $(srcdir)/gtk.defs entries > gtbi.tmp
|
||||
cp gtbi.tmp $(srcdir)/gtktypebuiltins_ids.c
|
||||
rm -f gtbi.tmp
|
||||
gtktypebuiltins_ids.c: @REBUILD@ gtk.defs maketypes.awk
|
||||
cd $(srcdir) \
|
||||
&& $(AWK) -f maketypes.awk gtk.defs entries > s-gtbi \
|
||||
&& mv s-gtbi gtktypebuiltins_ids.c
|
||||
|
||||
# generate enum value arrays
|
||||
gtktypebuiltins_evals.c: @MAINT@ makeenums.pl gtk.defs
|
||||
srcdir=$(srcdir) \
|
||||
perl $(srcdir)/makeenums.pl arrays $(srcdir)/gtk*.h \
|
||||
$(top_srcdir)/gdk/gdk*.h > gtbe.tmp
|
||||
cp gtbe.tmp $(srcdir)/gtktypebuiltins_evals.c
|
||||
rm -f gtbe.tmp
|
||||
gtktypebuiltins_evals.c: @REBUILD@ makeenums.pl gtk.defs
|
||||
cd $(srcdir) \
|
||||
&& $(PERL) makeenums.pl arrays $(source_headers) $(gdk_headers) > \
|
||||
s-gtbe \
|
||||
&& mv s-gtbe gtktypebuiltins_evals.c
|
||||
|
||||
gtkmarshal.c gtkmarshal.h: @MAINT@ gtkmarshal.list genmarshal.pl
|
||||
srcdir=$(srcdir) perl $(srcdir)/genmarshal.pl
|
||||
gtkmarshal.c gtkmarshal.h: @REBUILD@ gtkmarshal.list genmarshal.pl
|
||||
srcdir=$(srcdir) INDENT=$(INDENT) $(PERL) $(srcdir)/genmarshal.pl
|
||||
|
||||
# ???
|
||||
# special remake rules
|
||||
makeenums.h: @MAINT@ gtk.h gtkprivate.h
|
||||
|
||||
libgtk_1_1_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
libgtk_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE)
|
||||
|
||||
EXTRA_DIST = \
|
||||
line-arrow.xbm \
|
||||
@@ -293,19 +314,20 @@ EXTRA_DIST = \
|
||||
tree_minus.xbm \
|
||||
circles.xbm
|
||||
|
||||
INCLUDES = -I$(top_srcdir) @GLIB_CFLAGS@ @x_cflags@
|
||||
INCLUDES = \
|
||||
-DGTK_EXE_PREFIX=\"$(exec_prefix)\" \
|
||||
-DGTK_DATA_PREFIX=\"$(prefix)\" \
|
||||
-I$(top_srcdir) @GLIB_CFLAGS@ @x_cflags@
|
||||
|
||||
noinst_PROGRAMS = testgtk testinput testselection testthreads simple
|
||||
|
||||
# FIXME, we currently rely on linking against libglib-1.1
|
||||
noinst_PROGRAMS = testgtk testinput testselection testthreads testrgb testdnd simple
|
||||
|
||||
DEPS = \
|
||||
libgtk-@LT_RELEASE@.la \
|
||||
$(top_builddir)/gdk/libgdk-@LT_RELEASE@.la
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la
|
||||
|
||||
LDADDS = \
|
||||
libgtk-@LT_RELEASE@.la \
|
||||
$(top_builddir)/gdk/libgdk-@LT_RELEASE@.la \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
@GLIB_LIBS@ \
|
||||
@@ -315,12 +337,16 @@ testgtk_DEPENDENCIES = $(DEPS)
|
||||
testinput_DEPENDENCIES = $(DEPS)
|
||||
testthreads_DEPENDENCIES = $(DEPS)
|
||||
testselection_DEPENDENCIES = $(DEPS)
|
||||
testrgb_DEPENDENCIES = $(DEPS)
|
||||
testdnd_DEPENDENCIES = $(DEPS)
|
||||
simple_DEPENDENCIES = $(DEPS)
|
||||
|
||||
testgtk_LDADD = $(LDADDS)
|
||||
testinput_LDADD = $(LDADDS)
|
||||
testthreads_LDADD = $(LDADDS)
|
||||
testselection_LDADD = $(LDADDS)
|
||||
testrgb_LDADD = $(LDADDS)
|
||||
testdnd_LDADD = $(LDADDS)
|
||||
simple_LDADD = $(LDADDS)
|
||||
|
||||
.PHONY: files test test-debug
|
||||
|
||||
712
gtk/Makefile.in
712
gtk/Makefile.in
@@ -1,712 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
GTK_MAJOR_VERSION = @GTK_MAJOR_VERSION@
|
||||
GTK_MICRO_VERSION = @GTK_MICRO_VERSION@
|
||||
GTK_MINOR_VERSION = @GTK_MINOR_VERSION@
|
||||
GTK_VERSION = @GTK_VERSION@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
LT_AGE = @LT_AGE@
|
||||
LT_CURRENT = @LT_CURRENT@
|
||||
LT_RELEASE = @LT_RELEASE@
|
||||
LT_REVISION = @LT_REVISION@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
x_cflags = @x_cflags@
|
||||
x_includes = @x_includes@
|
||||
x_ldflags = @x_ldflags@
|
||||
x_libs = @x_libs@
|
||||
xinput_progs = @xinput_progs@
|
||||
|
||||
gtkincludedir = $(includedir)/gtk
|
||||
|
||||
lib_LTLIBRARIES = libgtk-1.1.la
|
||||
|
||||
libgtk_1_1_la_SOURCES = \
|
||||
gtkaccelerator.c \
|
||||
gtkadjustment.c \
|
||||
gtkaspectframe.c \
|
||||
gtkalignment.c \
|
||||
gtkarrow.c \
|
||||
gtkbin.c \
|
||||
gtkbbox.c \
|
||||
gtkbox.c \
|
||||
gtkbutton.c \
|
||||
gtkcheckbutton.c \
|
||||
gtkcheckmenuitem.c \
|
||||
gtkclist.c \
|
||||
gtkcolorsel.c \
|
||||
gtkcombo.c \
|
||||
gtkcontainer.c \
|
||||
gtkctree.c \
|
||||
gtkcurve.c \
|
||||
gtkdata.c \
|
||||
gtkdialog.c \
|
||||
gtkdrawingarea.c \
|
||||
gtkeditable.c \
|
||||
gtkentry.c \
|
||||
gtkeventbox.c \
|
||||
gtkfilesel.c \
|
||||
gtkfixed.c \
|
||||
gtkframe.c \
|
||||
gtkgamma.c \
|
||||
gtkgc.c \
|
||||
gtkhandlebox.c \
|
||||
gtkhbbox.c \
|
||||
gtkhbox.c \
|
||||
gtkhpaned.c \
|
||||
gtkhruler.c \
|
||||
gtkhscale.c \
|
||||
gtkhscrollbar.c \
|
||||
gtkhseparator.c \
|
||||
gtkimage.c \
|
||||
gtkinputdialog.c \
|
||||
gtkitem.c \
|
||||
gtklabel.c \
|
||||
gtklist.c \
|
||||
gtklistitem.c \
|
||||
gtkmain.c \
|
||||
gtkmenu.c \
|
||||
gtkmenubar.c \
|
||||
gtkmenufactory.c \
|
||||
gtkmenuitem.c \
|
||||
gtkmenushell.c \
|
||||
gtkmisc.c \
|
||||
gtknotebook.c \
|
||||
gtkobject.c \
|
||||
gtkoptionmenu.c \
|
||||
gtkpaned.c \
|
||||
gtkpixmap.c \
|
||||
gtkpreview.c \
|
||||
gtkprogressbar.c \
|
||||
gtkradiobutton.c \
|
||||
gtkradiomenuitem.c \
|
||||
gtkrange.c \
|
||||
gtkrc.c \
|
||||
gtkruler.c \
|
||||
gtkscale.c \
|
||||
gtkscrollbar.c \
|
||||
gtkscrolledwindow.c \
|
||||
gtkselection.c \
|
||||
gtkseparator.c \
|
||||
gtksignal.c \
|
||||
gtkspinbutton.c \
|
||||
gtkstyle.c \
|
||||
gtkstatusbar.c \
|
||||
gtktable.c \
|
||||
gtktext.c \
|
||||
gtktipsquery.c \
|
||||
gtktogglebutton.c \
|
||||
gtktoolbar.c \
|
||||
gtktooltips.c \
|
||||
gtktree.c \
|
||||
gtktreeitem.c \
|
||||
gtktypeutils.c \
|
||||
gtkvbbox.c \
|
||||
gtkvbox.c \
|
||||
gtkviewport.c \
|
||||
gtkvpaned.c \
|
||||
gtkvruler.c \
|
||||
gtkvscale.c \
|
||||
gtkvscrollbar.c \
|
||||
gtkvseparator.c \
|
||||
gtkwidget.c \
|
||||
gtkwindow.c \
|
||||
fnmatch.c \
|
||||
fnmatch.h
|
||||
|
||||
gtkinclude_HEADERS = \
|
||||
gtk.h \
|
||||
gtkaccelerator.h \
|
||||
gtkadjustment.h \
|
||||
gtkaspectframe.h \
|
||||
gtkalignment.h \
|
||||
gtkarrow.h \
|
||||
gtkbin.h \
|
||||
gtkbbox.h \
|
||||
gtkbox.h \
|
||||
gtkbutton.h \
|
||||
gtkcheckbutton.h \
|
||||
gtkcheckmenuitem.h \
|
||||
gtkclist.h \
|
||||
gtkcolorsel.h \
|
||||
gtkcombo.h \
|
||||
gtkcontainer.h \
|
||||
gtkctree.h \
|
||||
gtkcurve.h \
|
||||
gtkdata.h \
|
||||
gtkdebug.h \
|
||||
gtkdialog.h \
|
||||
gtkdrawingarea.h \
|
||||
gtkeditable.h \
|
||||
gtkentry.h \
|
||||
gtkenums.h \
|
||||
gtkeventbox.h \
|
||||
gtkfeatures.h \
|
||||
gtkfilesel.h \
|
||||
gtkfixed.h \
|
||||
gtkframe.h \
|
||||
gtkgamma.h \
|
||||
gtkgc.h \
|
||||
gtkhandlebox.h \
|
||||
gtkhbbox.h \
|
||||
gtkhbox.h \
|
||||
gtkhpaned.h \
|
||||
gtkhruler.h \
|
||||
gtkhscale.h \
|
||||
gtkhscrollbar.h \
|
||||
gtkhseparator.h \
|
||||
gtkimage.h \
|
||||
gtkinputdialog.h \
|
||||
gtkitem.h \
|
||||
gtklabel.h \
|
||||
gtklist.h \
|
||||
gtklistitem.h \
|
||||
gtkmain.h \
|
||||
gtkmenu.h \
|
||||
gtkmenubar.h \
|
||||
gtkmenufactory.h \
|
||||
gtkmenuitem.h \
|
||||
gtkmenushell.h \
|
||||
gtkmisc.h \
|
||||
gtknotebook.h \
|
||||
gtkobject.h \
|
||||
gtkoptionmenu.h \
|
||||
gtkpaned.h \
|
||||
gtkpixmap.h \
|
||||
gtkpreview.h \
|
||||
gtkprivate.h \
|
||||
gtkprogressbar.h \
|
||||
gtkradiobutton.h \
|
||||
gtkradiomenuitem.h \
|
||||
gtkrange.h \
|
||||
gtkrc.h \
|
||||
gtkruler.h \
|
||||
gtkscale.h \
|
||||
gtkscrollbar.h \
|
||||
gtkscrolledwindow.h \
|
||||
gtkselection.h \
|
||||
gtkseparator.h \
|
||||
gtksignal.h \
|
||||
gtkspinbutton.h \
|
||||
gtkstyle.h \
|
||||
gtkstatusbar.h \
|
||||
gtktable.h \
|
||||
gtktext.h \
|
||||
gtktipsquery.h \
|
||||
gtktogglebutton.h \
|
||||
gtktoolbar.h \
|
||||
gtktooltips.h \
|
||||
gtktree.h \
|
||||
gtktreeitem.h \
|
||||
gtktypeutils.h \
|
||||
gtkvbbox.h \
|
||||
gtkvbox.h \
|
||||
gtkviewport.h \
|
||||
gtkvpaned.h \
|
||||
gtkvruler.h \
|
||||
gtkvscale.h \
|
||||
gtkvscrollbar.h \
|
||||
gtkvseparator.h \
|
||||
gtkwidget.h \
|
||||
gtkwindow.h \
|
||||
gtktypebuiltins.h
|
||||
|
||||
libgtk_1_1_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
|
||||
EXTRA_DIST = \
|
||||
line-arrow.xbm \
|
||||
line-wrap.xbm \
|
||||
testgtkrc \
|
||||
testgtkrc2 \
|
||||
gtk.defs \
|
||||
gtkfeatures.h.in \
|
||||
runelisp \
|
||||
gentypeinfo.el \
|
||||
gtktypebuiltins.c \
|
||||
test.xpm \
|
||||
marble.xpm \
|
||||
3DRings.xpm \
|
||||
FilesQueue.xpm \
|
||||
Modeller.xpm \
|
||||
tree_plus.xpm \
|
||||
tree_minus.xpm \
|
||||
tree_plus.xbm \
|
||||
tree_minus.xbm \
|
||||
circles.xbm
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I../glib -I$(top_srcdir)/glib @x_cflags@
|
||||
|
||||
noinst_PROGRAMS = testgtk testinput testselection testthreads simple
|
||||
|
||||
# FIXME, we currently rely on linking against libglib-1.1
|
||||
|
||||
DEPS = \
|
||||
libgtk-@LT_RELEASE@.la \
|
||||
$(top_builddir)/gdk/libgdk-@LT_RELEASE@.la \
|
||||
$(top_builddir)/glib/libglib-1.1.la
|
||||
LDADDS = \
|
||||
libgtk-@LT_RELEASE@.la \
|
||||
$(top_builddir)/gdk/libgdk-@LT_RELEASE@.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib-1.1.la \
|
||||
-lm
|
||||
|
||||
testgtk_DEPENDENCIES = $(DEPS)
|
||||
testinput_DEPENDENCIES = $(DEPS)
|
||||
testthreads_DEPENDENCIES = $(DEPS)
|
||||
testselection_DEPENDENCIES = $(DEPS)
|
||||
simple_DEPENDENCIES = $(DEPS)
|
||||
|
||||
testgtk_LDADD = $(LDADDS)
|
||||
testinput_LDADD = $(LDADDS)
|
||||
testthreads_LDADD = $(LDADDS)
|
||||
testselection_LDADD = $(LDADDS)
|
||||
simple_LDADD = $(LDADDS)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES = gtkfeatures.h
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I..
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
libgtk_1_1_la_LIBADD =
|
||||
libgtk_1_1_la_OBJECTS = gtkaccelerator.lo gtkadjustment.lo \
|
||||
gtkaspectframe.lo gtkalignment.lo gtkarrow.lo gtkbin.lo gtkbbox.lo \
|
||||
gtkbox.lo gtkbutton.lo gtkcheckbutton.lo gtkcheckmenuitem.lo \
|
||||
gtkclist.lo gtkcolorsel.lo gtkcombo.lo gtkcontainer.lo gtkctree.lo \
|
||||
gtkcurve.lo gtkdata.lo gtkdialog.lo gtkdrawingarea.lo gtkeditable.lo \
|
||||
gtkentry.lo gtkeventbox.lo gtkfilesel.lo gtkfixed.lo gtkframe.lo \
|
||||
gtkgamma.lo gtkgc.lo gtkhandlebox.lo gtkhbbox.lo gtkhbox.lo \
|
||||
gtkhpaned.lo gtkhruler.lo gtkhscale.lo gtkhscrollbar.lo \
|
||||
gtkhseparator.lo gtkimage.lo gtkinputdialog.lo gtkitem.lo gtklabel.lo \
|
||||
gtklist.lo gtklistitem.lo gtkmain.lo gtkmenu.lo gtkmenubar.lo \
|
||||
gtkmenufactory.lo gtkmenuitem.lo gtkmenushell.lo gtkmisc.lo \
|
||||
gtknotebook.lo gtkobject.lo gtkoptionmenu.lo gtkpaned.lo gtkpixmap.lo \
|
||||
gtkpreview.lo gtkprogressbar.lo gtkradiobutton.lo gtkradiomenuitem.lo \
|
||||
gtkrange.lo gtkrc.lo gtkruler.lo gtkscale.lo gtkscrollbar.lo \
|
||||
gtkscrolledwindow.lo gtkselection.lo gtkseparator.lo gtksignal.lo \
|
||||
gtkspinbutton.lo gtkstyle.lo gtkstatusbar.lo gtktable.lo gtktext.lo \
|
||||
gtktipsquery.lo gtktogglebutton.lo gtktoolbar.lo gtktooltips.lo \
|
||||
gtktree.lo gtktreeitem.lo gtktypeutils.lo gtkvbbox.lo gtkvbox.lo \
|
||||
gtkviewport.lo gtkvpaned.lo gtkvruler.lo gtkvscale.lo gtkvscrollbar.lo \
|
||||
gtkvseparator.lo gtkwidget.lo gtkwindow.lo fnmatch.lo
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
testgtk_SOURCES = testgtk.c
|
||||
testgtk_OBJECTS = testgtk.o
|
||||
testgtk_LDFLAGS =
|
||||
testinput_SOURCES = testinput.c
|
||||
testinput_OBJECTS = testinput.o
|
||||
testinput_LDFLAGS =
|
||||
testselection_SOURCES = testselection.c
|
||||
testselection_OBJECTS = testselection.o
|
||||
testselection_LDFLAGS =
|
||||
testthreads_SOURCES = testthreads.c
|
||||
testthreads_OBJECTS = testthreads.o
|
||||
testthreads_LDFLAGS =
|
||||
simple_SOURCES = simple.c
|
||||
simple_OBJECTS = simple.o
|
||||
simple_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(gtkinclude_HEADERS)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in gtkfeatures.h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
DEP_FILES = .deps/fnmatch.P .deps/gtkaccelerator.P \
|
||||
.deps/gtkadjustment.P .deps/gtkalignment.P .deps/gtkarrow.P \
|
||||
.deps/gtkaspectframe.P .deps/gtkbbox.P .deps/gtkbin.P .deps/gtkbox.P \
|
||||
.deps/gtkbutton.P .deps/gtkcheckbutton.P .deps/gtkcheckmenuitem.P \
|
||||
.deps/gtkclist.P .deps/gtkcolorsel.P .deps/gtkcombo.P \
|
||||
.deps/gtkcontainer.P .deps/gtkctree.P .deps/gtkcurve.P .deps/gtkdata.P \
|
||||
.deps/gtkdialog.P .deps/gtkdrawingarea.P .deps/gtkeditable.P \
|
||||
.deps/gtkentry.P .deps/gtkeventbox.P .deps/gtkfilesel.P \
|
||||
.deps/gtkfixed.P .deps/gtkframe.P .deps/gtkgamma.P .deps/gtkgc.P \
|
||||
.deps/gtkhandlebox.P .deps/gtkhbbox.P .deps/gtkhbox.P .deps/gtkhpaned.P \
|
||||
.deps/gtkhruler.P .deps/gtkhscale.P .deps/gtkhscrollbar.P \
|
||||
.deps/gtkhseparator.P .deps/gtkimage.P .deps/gtkinputdialog.P \
|
||||
.deps/gtkitem.P .deps/gtklabel.P .deps/gtklist.P .deps/gtklistitem.P \
|
||||
.deps/gtkmain.P .deps/gtkmenu.P .deps/gtkmenubar.P \
|
||||
.deps/gtkmenufactory.P .deps/gtkmenuitem.P .deps/gtkmenushell.P \
|
||||
.deps/gtkmisc.P .deps/gtknotebook.P .deps/gtkobject.P \
|
||||
.deps/gtkoptionmenu.P .deps/gtkpaned.P .deps/gtkpixmap.P \
|
||||
.deps/gtkpreview.P .deps/gtkprogressbar.P .deps/gtkradiobutton.P \
|
||||
.deps/gtkradiomenuitem.P .deps/gtkrange.P .deps/gtkrc.P \
|
||||
.deps/gtkruler.P .deps/gtkscale.P .deps/gtkscrollbar.P \
|
||||
.deps/gtkscrolledwindow.P .deps/gtkselection.P .deps/gtkseparator.P \
|
||||
.deps/gtksignal.P .deps/gtkspinbutton.P .deps/gtkstatusbar.P \
|
||||
.deps/gtkstyle.P .deps/gtktable.P .deps/gtktext.P .deps/gtktipsquery.P \
|
||||
.deps/gtktogglebutton.P .deps/gtktoolbar.P .deps/gtktooltips.P \
|
||||
.deps/gtktree.P .deps/gtktreeitem.P .deps/gtktypeutils.P \
|
||||
.deps/gtkvbbox.P .deps/gtkvbox.P .deps/gtkviewport.P .deps/gtkvpaned.P \
|
||||
.deps/gtkvruler.P .deps/gtkvscale.P .deps/gtkvscrollbar.P \
|
||||
.deps/gtkvseparator.P .deps/gtkwidget.P .deps/gtkwindow.P \
|
||||
.deps/simple.P .deps/testgtk.P .deps/testinput.P .deps/testselection.P \
|
||||
.deps/testthreads.P
|
||||
SOURCES = $(libgtk_1_1_la_SOURCES) testgtk.c testinput.c testselection.c testthreads.c simple.c
|
||||
OBJECTS = $(libgtk_1_1_la_OBJECTS) testgtk.o testinput.o testselection.o testthreads.o simple.o
|
||||
|
||||
all: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .lo .o .s
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu gtk/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
gtkfeatures.h: $(top_builddir)/config.status gtkfeatures.h.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.s.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
.S.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libgtk-1.1.la: $(libgtk_1_1_la_OBJECTS) $(libgtk_1_1_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libgtk_1_1_la_LDFLAGS) $(libgtk_1_1_la_OBJECTS) $(libgtk_1_1_la_LIBADD) $(LIBS)
|
||||
|
||||
mostlyclean-noinstPROGRAMS:
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
|
||||
distclean-noinstPROGRAMS:
|
||||
|
||||
maintainer-clean-noinstPROGRAMS:
|
||||
|
||||
testgtk: $(testgtk_OBJECTS) $(testgtk_DEPENDENCIES)
|
||||
@rm -f testgtk
|
||||
$(LINK) $(testgtk_LDFLAGS) $(testgtk_OBJECTS) $(testgtk_LDADD) $(LIBS)
|
||||
|
||||
testinput: $(testinput_OBJECTS) $(testinput_DEPENDENCIES)
|
||||
@rm -f testinput
|
||||
$(LINK) $(testinput_LDFLAGS) $(testinput_OBJECTS) $(testinput_LDADD) $(LIBS)
|
||||
|
||||
testselection: $(testselection_OBJECTS) $(testselection_DEPENDENCIES)
|
||||
@rm -f testselection
|
||||
$(LINK) $(testselection_LDFLAGS) $(testselection_OBJECTS) $(testselection_LDADD) $(LIBS)
|
||||
|
||||
testthreads: $(testthreads_OBJECTS) $(testthreads_DEPENDENCIES)
|
||||
@rm -f testthreads
|
||||
$(LINK) $(testthreads_LDFLAGS) $(testthreads_OBJECTS) $(testthreads_LDADD) $(LIBS)
|
||||
|
||||
simple: $(simple_OBJECTS) $(simple_DEPENDENCIES)
|
||||
@rm -f simple
|
||||
$(LINK) $(simple_LDFLAGS) $(simple_OBJECTS) $(simple_LDADD) $(LIBS)
|
||||
|
||||
install-gtkincludeHEADERS: $(gtkinclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(gtkincludedir)
|
||||
@list='$(gtkinclude_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(gtkincludedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(gtkincludedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-gtkincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(gtkinclude_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(gtkincludedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = gtk
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu gtk/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
|
||||
maintainer-clean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
%.o: %.c
|
||||
@echo '$(COMPILE) -c $<'; \
|
||||
$(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
|
||||
|
||||
%.lo: %.c
|
||||
@echo '$(LTCOMPILE) -c $<'; \
|
||||
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
|
||||
@-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
|
||||
< .deps/$(*F).p > .deps/$(*F).P
|
||||
@-rm -f .deps/$(*F).p
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec: install-libLTLIBRARIES
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-gtkincludeHEADERS
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-libLTLIBRARIES uninstall-gtkincludeHEADERS
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(gtkincludedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-libLTLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-libtool mostlyclean-noinstPROGRAMS \
|
||||
mostlyclean-tags mostlyclean-depend mostlyclean-generic
|
||||
|
||||
clean: clean-libLTLIBRARIES clean-compile clean-libtool \
|
||||
clean-noinstPROGRAMS clean-tags clean-depend \
|
||||
clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-libLTLIBRARIES distclean-compile distclean-libtool \
|
||||
distclean-noinstPROGRAMS distclean-tags \
|
||||
distclean-depend distclean-generic clean
|
||||
-rm -f config.status
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-libLTLIBRARIES \
|
||||
maintainer-clean-compile maintainer-clean-libtool \
|
||||
maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
|
||||
maintainer-clean-depend maintainer-clean-generic \
|
||||
distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
|
||||
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
|
||||
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
|
||||
distclean-compile clean-compile maintainer-clean-compile \
|
||||
mostlyclean-libtool distclean-libtool clean-libtool \
|
||||
maintainer-clean-libtool mostlyclean-noinstPROGRAMS \
|
||||
distclean-noinstPROGRAMS clean-noinstPROGRAMS \
|
||||
maintainer-clean-noinstPROGRAMS uninstall-gtkincludeHEADERS \
|
||||
install-gtkincludeHEADERS tags mostlyclean-tags distclean-tags \
|
||||
clean-tags maintainer-clean-tags distdir mostlyclean-depend \
|
||||
distclean-depend clean-depend maintainer-clean-depend info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(srcdir)/gtktypebuiltins.h: @MAINT@ $(srcdir)/gtk.defs $(srcdir)/gentypeinfo.el
|
||||
$(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el idmac $< $@
|
||||
|
||||
$(srcdir)/gtktypebuiltins.c: @MAINT@ $(srcdir)/gtk.defs $(srcdir)/gentypeinfo.el
|
||||
$(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el id $< $@
|
||||
|
||||
.PHONY: files test test-debug
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
|
||||
test: testgtk
|
||||
builddir=`pwd`; cd $(top_builddir); top_builddir=`pwd`; \
|
||||
cd $$builddir; cd $(srcdir); \
|
||||
$(SHELL) $$top_builddir/libtool --mode=execute $$builddir/testgtk
|
||||
|
||||
test-debug: testgtk
|
||||
builddir=`pwd`; cd $(top_builddir); top_builddir=`pwd`; \
|
||||
cd $$builddir; cd $(srcdir); \
|
||||
$(SHELL) $$top_builddir/libtool --mode=execute gdb $$builddir/testgtk
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -21,10 +21,20 @@
|
||||
);
|
||||
|
||||
$srcdir = $ENV{'srcdir'} || '.';
|
||||
$indent = $ENV{'INDENT'};
|
||||
|
||||
sub indent {
|
||||
my $filename = shift;
|
||||
if (defined($indent) && $indent ne "") {
|
||||
system($indent, $filename);
|
||||
# we try the most likely names for backup files
|
||||
system("rm", "-f", "$filename.bak", "$filename~");
|
||||
}
|
||||
}
|
||||
|
||||
open(IL, "<$srcdir/gtkmarshal.list") || die("Open failed: $!");
|
||||
open(OH, "|indent > $srcdir/gtkmarshal.h") || die("Open failed: $!");
|
||||
open(OS, "|indent > $srcdir/gtkmarshal.c") || die("Open failed: $!");
|
||||
open(OH, ">$srcdir/gtkmarshal.h") || die("Open failed: $!");
|
||||
open(OS, ">$srcdir/gtkmarshal.c") || die("Open failed: $!");
|
||||
|
||||
print OH <<EOT;
|
||||
#ifndef __GTKMARSHAL_H__
|
||||
@@ -35,7 +45,6 @@ print OH <<EOT;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define gtk_signal_default_marshaller gtk_marshal_NONE__NONE
|
||||
@@ -44,7 +53,8 @@ EOT
|
||||
|
||||
print OS qq(#include "gtkmarshal.h"\n\n);
|
||||
|
||||
while(chomp($aline = <IL>)) {
|
||||
while (defined($aline = <IL>)) {
|
||||
chomp $aline;
|
||||
($retval, $paramlist) = split(/:/, $aline, 2);
|
||||
@params = split(/\s*,\s*/, $paramlist);
|
||||
|
||||
@@ -190,3 +200,6 @@ print OH <<EOT;
|
||||
EOT
|
||||
|
||||
close(IL); close(OH); close(OS);
|
||||
|
||||
indent("$srcdir/gtkmarshal.h");
|
||||
indent("$srcdir/gtkmarshal.c");
|
||||
|
||||
@@ -42,6 +42,9 @@
|
||||
gdk_window_ref
|
||||
gdk_window_unref)
|
||||
|
||||
(define-boxed GdkDragContext
|
||||
gdk_drag_context_ref
|
||||
gdk_drag_context_unref)
|
||||
(define-boxed GdkEvent
|
||||
gdk_event_copy
|
||||
gdk_event_free
|
||||
|
||||
2347
gtk/gtk.defs
2347
gtk/gtk.defs
File diff suppressed because it is too large
Load Diff
@@ -33,6 +33,7 @@
|
||||
#include <gtk/gtkbox.h>
|
||||
#include <gtk/gtkbbox.h>
|
||||
#include <gtk/gtkbutton.h>
|
||||
#include <gtk/gtkcalendar.h>
|
||||
#include <gtk/gtkcheckbutton.h>
|
||||
#include <gtk/gtkcheckmenuitem.h>
|
||||
#include <gtk/gtkclist.h>
|
||||
@@ -43,7 +44,9 @@
|
||||
#include <gtk/gtkcurve.h>
|
||||
#include <gtk/gtkdata.h>
|
||||
#include <gtk/gtkdialog.h>
|
||||
#include <gtk/gtkdnd.h>
|
||||
#include <gtk/gtkdrawingarea.h>
|
||||
#include <gtk/gtkdrawwindow.h>
|
||||
#include <gtk/gtkeditable.h>
|
||||
#include <gtk/gtkentry.h>
|
||||
#include <gtk/gtkenums.h>
|
||||
@@ -101,7 +104,9 @@
|
||||
#include <gtk/gtkstyle.h>
|
||||
#include <gtk/gtkstatusbar.h>
|
||||
#include <gtk/gtktable.h>
|
||||
#include <gtk/gtktearoffmenuitem.h>
|
||||
#include <gtk/gtktext.h>
|
||||
#include <gtk/gtkthemes.h>
|
||||
#include <gtk/gtktipsquery.h>
|
||||
#include <gtk/gtktogglebutton.h>
|
||||
#include <gtk/gtktoolbar.h>
|
||||
|
||||
@@ -376,9 +376,13 @@ gtk_accel_group_add (GtkAccelGroup *accel_group,
|
||||
"cannot be used as accelerator signal",
|
||||
accel_signal,
|
||||
gtk_type_name (GTK_OBJECT_TYPE (object)));
|
||||
if (query)
|
||||
g_free (query);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_free (query);
|
||||
|
||||
/* prematurely abort if the group/entry is already locked
|
||||
*/
|
||||
if (accel_group->lock_count > 0)
|
||||
@@ -696,7 +700,7 @@ gtk_accel_group_entries_from_object (GtkObject *object)
|
||||
|
||||
gboolean
|
||||
gtk_accelerator_valid (guint keyval,
|
||||
guint modifiers)
|
||||
GdkModifierType modifiers)
|
||||
{
|
||||
guint invalid_accelerator_vals[] = {
|
||||
GDK_BackSpace, GDK_Delete, GDK_KP_Delete,
|
||||
@@ -1016,7 +1020,7 @@ gtk_accelerator_name (guint accelerator_key,
|
||||
}
|
||||
|
||||
void
|
||||
gtk_accelerator_set_default_mod_mask (guint default_mod_mask)
|
||||
gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask)
|
||||
{
|
||||
default_accel_mod_mask = default_mod_mask & GDK_MODIFIER_MASK;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
enum {
|
||||
ARG_0,
|
||||
ARG_ACCEL_WIDGET,
|
||||
ARG_ACCEL_WIDGET
|
||||
};
|
||||
|
||||
static void gtk_accel_label_class_init (GtkAccelLabelClass *klass);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user