Compare commits
10 Commits
css-variab
...
themes
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4389781ea1 | ||
|
|
0da6bdc330 | ||
|
|
64305ff2c9 | ||
|
|
d0661e26d9 | ||
|
|
15df1156be | ||
|
|
ae2431bfac | ||
|
|
a6a6d436d5 | ||
|
|
e024922934 | ||
|
|
7e99878898 | ||
|
|
cf31df990b |
28
AUTHORS
28
AUTHORS
@@ -1,3 +1,25 @@
|
||||
Peter Mattis (petm@xcf.berkeley.edu)
|
||||
Spencer Kimball (spencer@xcf.berkeley.edu)
|
||||
Josh MacDonald (jmacd@xcf.berkeley.edu)
|
||||
Original Authors
|
||||
----------------
|
||||
Peter Mattis <petm@xcf.berkeley.edu>
|
||||
Spencer Kimball <spencer@xcf.berkeley.edu>
|
||||
Josh MacDonald <jmacd@xcf.berkeley.edu>
|
||||
|
||||
|
||||
The GTK+ Team (in alphabetical order)
|
||||
-------------------------------------
|
||||
Shawn T. Amundson <amundson@gtk.org>
|
||||
Jerome Bolliet <bolliet@in2p3.fr>
|
||||
Tony Gale <gale@gtk.org>
|
||||
Lars Hamann <hamann@braunschweig.netsurf.de>
|
||||
Tim Janik <timj@gtk.org>
|
||||
Stefan Jeske <jeske@braunschweig.netsurf.de>
|
||||
Elliot Lee <sopwith@gtk.org>
|
||||
Ian Main <imain@gtk.org>
|
||||
Fedrerico Mena <quartic@gtk.org>
|
||||
Paolo Molaro <lupus@lettere.unipd.it>
|
||||
Jay Painter <jpaint@gtk.org>
|
||||
Manish Singh <manish@gtk.org>
|
||||
Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
There are many others who have contributed patches; we thank them,
|
||||
GTK+ is much better because of them.
|
||||
|
||||
9
COPYING
9
COPYING
@@ -2,7 +2,7 @@
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||
675 Mass Ave, Cambridge, MA 02139, USA
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
@@ -436,7 +436,7 @@ DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
Appendix: How to Apply These Terms to Your New Libraries
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
@@ -463,8 +463,9 @@ convey the exclusion of warranty; and each file should have at least the
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
License along with this library; if not, write to the
|
||||
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
|
||||
1321
ChangeLog.pre-2-0
1321
ChangeLog.pre-2-0
File diff suppressed because it is too large
Load Diff
1321
ChangeLog.pre-2-10
1321
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
1321
ChangeLog.pre-2-2
1321
ChangeLog.pre-2-2
File diff suppressed because it is too large
Load Diff
1321
ChangeLog.pre-2-4
1321
ChangeLog.pre-2-4
File diff suppressed because it is too large
Load Diff
1321
ChangeLog.pre-2-6
1321
ChangeLog.pre-2-6
File diff suppressed because it is too large
Load Diff
1321
ChangeLog.pre-2-8
1321
ChangeLog.pre-2-8
File diff suppressed because it is too large
Load Diff
9
HACKING
9
HACKING
@@ -2,12 +2,11 @@ If you want to hack on the Gtk+ project, it will make you life easier
|
||||
to have the following packages installed:
|
||||
|
||||
- GNU autoconf 2.12
|
||||
- GNU automake 1.2d
|
||||
Available in ftp://ftp.cygnus.com/pub/tromey
|
||||
- GNU libtool 1.0h
|
||||
Available in ftp://alpha.gnu.org/gnu/
|
||||
- GNU automake 1.3
|
||||
(Beta releases are at ftp://ftp.cygnus.com/pub/tromey)
|
||||
- GNU libtool 1.2
|
||||
|
||||
These should be available by ftp from prep.ai.mit.edu or any of the
|
||||
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
|
||||
|
||||
139
INSTALL
139
INSTALL
@@ -1,36 +1,137 @@
|
||||
The 'configure' script can be given a number of options to
|
||||
enable and disable various features. For a complete list,
|
||||
type:
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-1.0.0.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.0.0 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
% make install # install GTK
|
||||
|
||||
The Nitty-Gritty
|
||||
================
|
||||
|
||||
The 'configure' script can be given a number of options to enable
|
||||
and disable various features. For a complete list, type:
|
||||
|
||||
./configure --help
|
||||
|
||||
A few of the more important ones:
|
||||
|
||||
* --prefix=PREFIX install architecture-independent files in PREFIX
|
||||
[ Defaults to /usr/local ]
|
||||
|
||||
* --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
|
||||
[ Defaults to the value given to --prefix ]
|
||||
|
||||
* --with-xinput=[no/gxi/xfree] support XInput [default=no]
|
||||
|
||||
The --with-xinput flag specifies whether to compile with support
|
||||
for the XInput extension (mainly used for graphics tablets), and
|
||||
which form of support to use:
|
||||
|
||||
no : no support
|
||||
gxi : Use generic XInput support
|
||||
xfree : Use special features in the Wacom drivers in XFree86 3.3.1
|
||||
and later.
|
||||
|
||||
For more information, follow the link from http://www.gtk.org
|
||||
|
||||
* --enable-xim support XIM [default=yes]
|
||||
|
||||
Specifying --disable-xim will disable support for entering
|
||||
internationalized text using X Input Methods. This will give
|
||||
some slight savings in speed and memory use and might be necessary
|
||||
internationalized text using X Input Methods. This will give some
|
||||
slight savings in speed and memory use and might be necessary
|
||||
with older versions of X.
|
||||
|
||||
* --with-locale=LOCALE locale name you want to use
|
||||
* --with-locale=LOCALE locale name you want to use
|
||||
|
||||
The --with-locale options is used to determine if your operating
|
||||
system has support for the locale you will be using. If not, X's built
|
||||
in locale support will be used.
|
||||
system has support for the locale you will be using. If not, X's
|
||||
built in locale support will be used.
|
||||
|
||||
Because of bugs in autoconf, it is necessary to specify this option
|
||||
even if your LANG environment variable is correctly set.
|
||||
Because of bugs in autoconf, it is necessary to specify this
|
||||
option even if your LANG environment variable is correctly set.
|
||||
|
||||
This option does not determine which locale GTK will use at
|
||||
runtime. That will be determined from the usual environment variables.
|
||||
If you will be using multiple locales with GTK, specify the one
|
||||
for which your operating system has the worst support for the
|
||||
--with-locale option.
|
||||
runtime. That will be determined from the usual environment
|
||||
variables. If you will be using multiple locales with GTK,
|
||||
specify the one for which your operating system has the worst
|
||||
support for the --with-locale option.
|
||||
|
||||
|
||||
Note for using XIM support with kinput2
|
||||
---------------------------------------
|
||||
Options can be given to the compiler and linker by setting
|
||||
environment variables before running configure. A few of the more
|
||||
important ones:
|
||||
|
||||
There is a bug in older versions of kinput2 that will cause
|
||||
GTK to hang when destroying a text entry. The latest versions
|
||||
of kinput is available from:
|
||||
CC : The C compiler to use
|
||||
CPPFLAGS : Flags for the C preprocesser such as -I and -D
|
||||
CFLAGS : C compiler flags
|
||||
|
||||
The most important use of this is to set the
|
||||
optimization/debugging flags. For instance, to compile with no
|
||||
debugging information at all, run configure as:
|
||||
|
||||
CFLAGS=-O2 ./configure # Bourne compatible shells (sh/bash/zsh)
|
||||
|
||||
or,
|
||||
|
||||
setenv CFLAGS -O2 ; ./configure # csh and variants
|
||||
|
||||
|
||||
Installation directories
|
||||
========================
|
||||
|
||||
The location of the installed files is determined by the --prefix
|
||||
and --exec-prefix options given to configure. There are also more
|
||||
detailed flags to control individual directories. However, the
|
||||
use of these flags is not tested.
|
||||
|
||||
One particular detail to note, is that the architecture-dependent
|
||||
include file glibconfig.h is installed in:
|
||||
|
||||
$exec_pref/lib/glib/include/
|
||||
|
||||
if you have a version in $prefix/include, this is out of date
|
||||
and should be deleted.
|
||||
|
||||
A shell script gtk-config is created during the configure
|
||||
process, and installed in the bin/ directory
|
||||
($exec_prefix/bin). This is used to determine the location of GTK
|
||||
when building applications. If you move GTK after installation,
|
||||
it will be necessary to edit this file.
|
||||
|
||||
For complete details, see the file docs/gtk-config.txt
|
||||
|
||||
|
||||
Notes for using XIM support for Japanese input
|
||||
==============================================
|
||||
|
||||
* There is a bug in older versions of kinput2 that will cause GTK
|
||||
to hang when destroying a text entry. The latest versions of
|
||||
kinput is available from:
|
||||
|
||||
ftp://ftp.sra.co.jp/pub/x11/kinput2
|
||||
|
||||
* The locale information file for the ja_JP EUC locale
|
||||
distributed with some recent versions of X11 specifies to use the
|
||||
C library multibyte functions. Unless your C library has support
|
||||
for Japanese locales, this is incorrect, and will cause problems
|
||||
for GTK's internationalization.
|
||||
|
||||
(In particular, this occurs with GNU libc 2.0 and 2.1, in which
|
||||
the multibyte functions always translate to and from UTF-8; but
|
||||
the problem may occur for other C libraries, and other operating
|
||||
systems as well.)
|
||||
|
||||
To fix this, change the line:
|
||||
|
||||
use_stdc_env True
|
||||
|
||||
to
|
||||
|
||||
use_stdc_env False
|
||||
|
||||
in the file /usr/X11R6/lib/X11/locale/ja_JP/XLC_LOCALE.
|
||||
|
||||
|
||||
|
||||
72
Makefile.am
72
Makefile.am
@@ -3,10 +3,78 @@
|
||||
SRC_SUBDIRS = glib gdk gtk
|
||||
SUBDIRS = $(SRC_SUBDIRS) docs
|
||||
|
||||
bin_SCRIPTS = gtk-config
|
||||
|
||||
EXTRA_DIST = \
|
||||
gtk+.prj \
|
||||
gtk+.spec \
|
||||
gtk.m4 \
|
||||
makecopyright \
|
||||
TODO
|
||||
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
|
||||
|
||||
.PHONY: files populate checkin release
|
||||
|
||||
|
||||
353
Makefile.in
353
Makefile.in
@@ -1,353 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 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
|
||||
|
||||
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 = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
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
|
||||
|
||||
EXTRA_DIST = gtk+.prj makecopyright TODO REFCOUNTING BUGS
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES = gtk+.xconfig
|
||||
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+.xconfig.in install-sh ltconfig \
|
||||
ltmain.sh missing mkinstalldirs stamp-h.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
|
||||
.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+.xconfig: $(top_builddir)/config.status gtk+.xconfig.in
|
||||
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
|
||||
|
||||
# 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; \
|
||||
for subdir in $(SUBDIRS); 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=''; for subdir in $(SUBDIRS); 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)
|
||||
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
test -z "$(ETAGS_ARGS)config.h.in$(SOURCES)$(HEADERS)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $(SOURCES) $(HEADERS) -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
|
||||
@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 config.h
|
||||
|
||||
install-exec: install-exec-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
all: all-recursive-am all-am
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
|
||||
|
||||
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: default mostlyclean-hdr distclean-hdr clean-hdr \
|
||||
maintainer-clean-hdr 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 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 @@
|
||||
|
||||
Overview of Changes in GTK+ 1.0.0:
|
||||
|
||||
* A few bug fixes.
|
||||
|
||||
Overview of Changes in GTK+ 0.99.10:
|
||||
|
||||
* Lots of bug fixes
|
||||
* Documentation improvements
|
||||
* Better looking handlebox
|
||||
* A few convenience functions
|
||||
|
||||
Overview of Changes in GTK+ 0.99.9:
|
||||
|
||||
* Added examples directory, even more examples soon
|
||||
* Added optional word wrap to gtktext
|
||||
* Changes to gtkhandlebox
|
||||
* Lots of bug fixes
|
||||
|
||||
Overview of Changes in GTK+ 0.99.8:
|
||||
|
||||
* Compilation and configuration fixes
|
||||
* DND Fixes
|
||||
* New test in testgtk: cursors
|
||||
* Tutorial updates/additions
|
||||
* Few more FAQ additions
|
||||
* More prep for 1.0
|
||||
|
||||
Overview of Changes in GTK+ 0.99.7:
|
||||
|
||||
* This release is mainly because 0.99.6 did not compile completely
|
||||
due to a missing file.
|
||||
* Fixes to Gtk's quit handlers.
|
||||
|
||||
Overview of Changes in GTK+ 0.99.6:
|
||||
|
||||
* Intermediate release to become 1.0.
|
||||
* More signedness corrections for handler functions in gtkmain.h.
|
||||
* Semantics of GtkWidget::delete_event changed.
|
||||
* Documentation updates.
|
||||
* Inclusion of Gtk tutorial.
|
||||
* Implementation of a new shutdown method for GtkObject's executed prior to
|
||||
actual destruction. WARNING: this breaks binary compatibility, programs using
|
||||
Gtk need to be recompiled.
|
||||
* Clean ups due to compiler warnings.
|
||||
* Various widget fixes.
|
||||
|
||||
Overview of Fixes in GTK+ 0.99.5:
|
||||
|
||||
* Signal signedness and naming corrections
|
||||
|
||||
71
README
71
README
@@ -1,18 +1,75 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 0.99.5. GTK, which stands for the Gimp ToolKit,
|
||||
is a library for creating graphical user interfaces.
|
||||
This is GTK+ version 1.0.0. 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.
|
||||
|
||||
The official ftp site is:
|
||||
ftp://ftp.gimp.org/pub/gtk
|
||||
ftp://ftp.gtk.org/pub/gtk
|
||||
|
||||
The official web site is:
|
||||
http://www.gimp.org/gtk
|
||||
|
||||
Patches can be uploaded to:
|
||||
ftp://ftp.gimp.org/incoming
|
||||
http://www.gtk.org/
|
||||
|
||||
A mailing list is located at:
|
||||
gtk-list@redhat.com
|
||||
|
||||
To subscribe: mail -s subscribe gtk-list-request@redhat.com < /dev/null
|
||||
(Send mail to gtk-list-request@redhat.com with the subject "subscribe")
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
See the file 'INSTALL'
|
||||
|
||||
How to report bugs
|
||||
==================
|
||||
|
||||
To report a bug, send mail either to gtk-list, as mentioned
|
||||
above, or to gtk-bugs@gtk.org. If you send mail to gtk-list, you
|
||||
must be subscribed yourself.
|
||||
|
||||
In the mail include:
|
||||
|
||||
* The version of GTK
|
||||
|
||||
* Information about your system. For instance:
|
||||
|
||||
- What operating system and version
|
||||
- What version of X
|
||||
- For Linux, what version of the C library
|
||||
|
||||
And anything else you think is relevant.
|
||||
|
||||
* How to reproduce the bug.
|
||||
|
||||
If you can reproduce it with the testgtk program that is built
|
||||
in the gtk/ subdirectory, that will be most convenient. Otherwise,
|
||||
please include a short test program that exhibits the behavior.
|
||||
As a last resort, you can also provide a pointer to a larger piece
|
||||
of software that can be downloaded.
|
||||
|
||||
(Bugs that can be reproduced within the GIMP are almost as good
|
||||
as bugs that can be reproduced in testgtk. If you are reporting a
|
||||
bug found with the GIMP, please include the version number of the GIMP
|
||||
you are using)
|
||||
|
||||
* If the bug was a crash, the exact text that was printed out
|
||||
when the crash occured.
|
||||
|
||||
* Further information such as stack traces may be useful, but
|
||||
is not necessary. If you do send a stack trace, and the error
|
||||
is an X error, it will be more useful if the stacktrace
|
||||
is produced running the test program with the --sync command
|
||||
line option.
|
||||
|
||||
Patches
|
||||
=======
|
||||
|
||||
Patches can be uploaded to the incoming/ directory on
|
||||
ftp.gtk.org. Please follow the instructions there, and include
|
||||
your name and email address in the README file.
|
||||
|
||||
If the patch fixes a bug, it is usually a good idea to include
|
||||
all the information described in "How to Report Bugs".
|
||||
|
||||
169
TODO
169
TODO
@@ -1,34 +1,11 @@
|
||||
TODO BEFORE GTK 1.0
|
||||
-------------------
|
||||
|
||||
Bugs:
|
||||
* pasting into a GtkEntry that already has a very long string,
|
||||
causes the app to hang.
|
||||
|
||||
* Vertical scrollbar: the expose event looks hosed and is causing
|
||||
quite a bit of flickering
|
||||
Actually this affects both scrollbar implementation, you can best
|
||||
tell if you run the application with --sync (timj)
|
||||
|
||||
* signal parameters don't seem to get refreshed on recursive invokations
|
||||
of GTK_NO_RECURSE signals, which causes the restarted emissions to loose
|
||||
their actual point, i.e. parameter changes on the restarted emission,
|
||||
needs further investigation.
|
||||
* Scrolled windows (GtkList?) get cought in an endless reallocation loop
|
||||
under certain (rare) circumstances.
|
||||
|
||||
* Widget redrawing when the window resizes sometimes messes up.
|
||||
GtkLabels sometimes redraw without clearing up the underlying background on
|
||||
window resizes.
|
||||
|
||||
* Are there still some GtkCList changes outstanding? (Jay Painter)
|
||||
GtkCList is derived from GtkContainer but doesn't implement the
|
||||
need_resize, focus, add and remove methods from containers.
|
||||
it should at least issue a warning upon invokation of not supported
|
||||
member functions.
|
||||
|
||||
* GtkTree and GtkList should express in their *_add implementations,
|
||||
that they expect GtkListItems/GtkTreeItems as children. Similar
|
||||
things might apply to other containers.
|
||||
|
||||
* 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?
|
||||
@@ -57,14 +34,11 @@ Bugs:
|
||||
segfault in malloc
|
||||
-timj
|
||||
|
||||
* Change bitfields to guints from enums for C++ ?
|
||||
* Change bitfields to guints from enums, or vice versa?
|
||||
|
||||
* Force paned window handle to be kept on screen
|
||||
* Expose events aren't being generated correctly for DND demo
|
||||
|
||||
Additions:
|
||||
* widgets which are redrawn because of a gtk_widget_draw(,NULL) should
|
||||
be removed from the redraw queue.
|
||||
|
||||
* GScanner: it might be good to ues stdio and getch() instead of 1-character
|
||||
reads. so one can take advantage of buffering. Currently each read() takes
|
||||
a separate syscall.
|
||||
@@ -89,13 +63,19 @@ Additions:
|
||||
void gtk_rc_string_export (const gchar *rc_additions,
|
||||
gboolean override_rc_styles);
|
||||
|
||||
* Configure events for windows that no longer exist fail in
|
||||
XTranslateCoordinates
|
||||
* Should release grab before activating menu item (and remove
|
||||
menu from screen?)
|
||||
|
||||
TODO AFTER GTK 1.0
|
||||
------------------
|
||||
|
||||
* Make all widget attributes configurable after the widget is created (timj).
|
||||
|
||||
* Widgets dervied from GtkButton need to be able to override
|
||||
GtkButtonClass.paint. e.g. redrawing of GtkToggleButton with CAN_DEFAULT
|
||||
is messed up otheriwse. This does in fact not only apply to (toggle)buttons,
|
||||
we should introduce a common paint member for the GtkWidgetClass.
|
||||
|
||||
* Radio buttons need to display CAN/HAS_DEFAULT correctly.
|
||||
|
||||
* GtkCList improvements. (Jay Painter)
|
||||
|
||||
* Seperate GtkObject and signaling system from Gdk dependancies?
|
||||
|
||||
@@ -113,6 +93,9 @@ TODO AFTER GTK 1.0
|
||||
* Entry should have a password mode (and it should show stars
|
||||
for user feedback).
|
||||
|
||||
* Entry should allow set_usize to work better, and should compute
|
||||
a different width when a maximum length is used.
|
||||
|
||||
* More dialogs: Print, GtkFontSelector, maybe others...
|
||||
|
||||
* Multiple document interface (MDI)?
|
||||
@@ -155,11 +138,80 @@ TODO AFTER GTK 1.0
|
||||
( You'd have to extend gdk_window_set_hints to accept the
|
||||
window gravity option to get it right. )
|
||||
|
||||
* Text/Edit widget: (some of these might be bugs that should be fixed now)
|
||||
? Allow moving the separator for paned widgets by dragging
|
||||
it directly instead of using the handle.
|
||||
|
||||
? Mark public use of gtk_tree_remove_item as deprecated - it should be used
|
||||
as:
|
||||
gtk_container_remove (GTK_CONTAINER(tree), widget);
|
||||
|
||||
* Standardize that all strings should be passed as gchar *, not
|
||||
guchar *. But what about non-string data? (gdk_property_change,
|
||||
gtk_selection_data_set) X makes these sort of things guchar...
|
||||
|
||||
* Check into XAddConnectionWatch - is this needed for XIM?
|
||||
|
||||
* Places where a _full variant is needed:
|
||||
|
||||
gtk_clist_set_row_data
|
||||
gtk_init_add
|
||||
gtk_menu_popup
|
||||
gtk_toolbar_prepend_element
|
||||
gtk_toolbar_insert_element
|
||||
gtk_widget_dnd_data_set (should be guchar * with a copy?
|
||||
shouldn't be there at all...)
|
||||
??? GtkDrawingarea.draw_data
|
||||
|
||||
* gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
|
||||
styles are broken for bg pixmaps, and RC styles only hack around
|
||||
that.
|
||||
|
||||
* Try to rationally deal with someone else deleting one of our
|
||||
windows??? This would mean keeping track of our window heirarchy
|
||||
ourselves, for one thing, and will never be safe, because of
|
||||
race conditions.
|
||||
|
||||
* --g-fatal-warnings flag that does
|
||||
g_set_warning_handler ((GWarningHandler)g_error);
|
||||
|
||||
* If a window spontaneously resizes itself N times before any
|
||||
ConfigureNotify events are received, then due to the interaction
|
||||
of the ConfigureNotify compression code in GDK and the resize
|
||||
count used for the window, the window will be size_allocated
|
||||
the next N-1 times it is moved.
|
||||
|
||||
Fix: Only send GDK_EVENT_CONFIGURE when the window is resized,
|
||||
create a new event type for toplevel motion. (GDK_EVENT_REPOSITION?)
|
||||
and eliminate the resize count in GtkWindow.
|
||||
|
||||
* Generic ScrolledWindow interface, which provide automatic scrollbar
|
||||
capability to Viewport, Text, and CList widgets.
|
||||
|
||||
GTK_POLICY_NEVER for scrolled windows.
|
||||
|
||||
* Consider caching more state in GdkWindowPrivate. Currently,
|
||||
every widget realization involves a XGetGeometry and a
|
||||
XGetWindowAttributes. And every GdkWindow destruction
|
||||
involves a XQueryTree.
|
||||
|
||||
* Scrolled windows need to be smarter about when they size-request/allocate
|
||||
their children. In particular, we should not be queuing the resizes
|
||||
on the toplevel window, but on the Viewport.
|
||||
|
||||
* Should all the default handlers really return FALSE? This can
|
||||
cause confusing presses to be sent to containers that actually
|
||||
want to get events on themselves.
|
||||
|
||||
* Fix block_resize, disable_resize.
|
||||
|
||||
* Buttons's should derive from Bin's. (GTK 2.0 change, breaks
|
||||
lots of stuff)
|
||||
|
||||
Text/Edit widget:
|
||||
|
||||
Bugs:
|
||||
|
||||
- Who knows?
|
||||
- Really big font (150 pt), plus lots of editing caused segfault
|
||||
|
||||
Improvements:
|
||||
|
||||
@@ -200,30 +252,29 @@ TODO AFTER GTK 1.0
|
||||
appearance on exposes. But this would require using another
|
||||
window to get the origins.
|
||||
|
||||
? Allow moving the separator for paned widgets by dragging
|
||||
it directly instead of using the handle.
|
||||
- In word wrap mode, break:
|
||||
|
||||
? Mark public use of gtk_tree_remove_item as deprecated - it should be used
|
||||
as:
|
||||
gtk_container_remove (GTK_CONTAINER(tree), widget);
|
||||
aaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
|
||||
* Standardize that all strings should be passed as gchar *, not
|
||||
guchar *. But what about non-string data? (gdk_property_change,
|
||||
gtk_selection_data_set) X makes these sort of things guchar...
|
||||
as:
|
||||
| Maximum column
|
||||
aaaaaaaaaaa bbbbbbbbbbb|
|
||||
bbbbbbbbbbbbbbbbbbbbbbb|
|
||||
bbbbbbbbb |
|
||||
|
||||
* Check into XAddConnectionWatch - is this needed for XIM?
|
||||
Instead of:
|
||||
|
|
||||
aaaaaaaaaaa |
|
||||
bbbbbbbbbbbbbbbbbbbbbbb|
|
||||
bbbbbbbbbbbbbbbbbbbb |
|
||||
|
||||
* Places where a _full variant is needed:
|
||||
- Blinking cursor
|
||||
|
||||
- API's : gtk_text_clear, gtk_text_delete_lines (gint start, gint end),
|
||||
gtk_text_append/prepend, gtk_text_insert_at (gint row, gint column),
|
||||
some function to get the row/column from the x/y-coordinates of a
|
||||
mouse click, some function to get the word/line under the mouse pointer
|
||||
[ From: Stefan Jeske <jeske@braunschweig.netsurf.de> ]
|
||||
|
||||
- "changed" emitted when doing deletes on empty Text widget.
|
||||
|
||||
gtk_clist_set_row_data
|
||||
gtk_init_add
|
||||
gtk_menu_popup
|
||||
gtk_toolbar_prepend_element
|
||||
gtk_toolbar_insert_element
|
||||
gtk_widget_dnd_data_set (should be guchar * with a copy?
|
||||
shouldn't be there at all...)
|
||||
??? GtkDrawingarea.draw_data
|
||||
|
||||
* gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
|
||||
styles are broken for bg pixmaps, and RC styles only hack around
|
||||
that.
|
||||
|
||||
17
config.h.in
17
config.h.in
@@ -6,9 +6,6 @@
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
@@ -21,25 +18,27 @@
|
||||
/* Other stuff */
|
||||
#undef HAVE_IPC_H
|
||||
#undef HAVE_SHM_H
|
||||
#undef HAVE_XPM
|
||||
#undef HAVE_XSHM_H
|
||||
#undef HAVE_SHAPE_EXT
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* some systems do not allow to ipcrm pages prior to
|
||||
* actual usage, namely: OSF1 V3.2, SunOS 4.1.1, 5.5, 5.5.1, 5.6,
|
||||
* IRIX 5.2 and 6.2.
|
||||
*/
|
||||
#undef IPC_RMID_DEFERRED_RELEASE
|
||||
|
||||
#undef NO_FD_SET
|
||||
|
||||
#undef RESOURCE_BASE
|
||||
|
||||
/* Define to enable POSIX threading awareness */
|
||||
#undef USE_PTHREADS
|
||||
|
||||
#undef XINPUT_NONE
|
||||
#undef XINPUT_GXI
|
||||
#undef XINPUT_XFREE
|
||||
|
||||
#undef GTK_MAJOR_VERSION
|
||||
#undef GTK_MINOR_VERSION
|
||||
#undef GTK_MICRO_VERSION
|
||||
#undef GTK_VERSION
|
||||
|
||||
/* Define as the return type of signal handlers (int or void). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
|
||||
94
configure.in
94
configure.in
@@ -4,10 +4,35 @@ AC_INIT(gdk/gdktypes.h)
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
GTK_MAJOR_VERSION=0
|
||||
GTK_MINOR_VERSION=99
|
||||
GTK_MICRO_VERSION=5
|
||||
# Making releases:
|
||||
# GTK_MICRO_VERSION += 1;
|
||||
# GTK_INTERFACE_AGE += 1;
|
||||
# GTK_BINARY_AGE += 1;
|
||||
# if any functions have been added, set GTK_INTERFACE_AGE to 0.
|
||||
# if backwards compatibility has been broken,
|
||||
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
|
||||
#
|
||||
GTK_MAJOR_VERSION=1
|
||||
GTK_MINOR_VERSION=1
|
||||
GTK_MICRO_VERSION=0
|
||||
GTK_INTERFACE_AGE=0
|
||||
GTK_BINARY_AGE=0
|
||||
GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
|
||||
AC_SUBST(GTK_MAJOR_VERSION)
|
||||
AC_SUBST(GTK_MINOR_VERSION)
|
||||
AC_SUBST(GTK_MICRO_VERSION)
|
||||
AC_SUBST(GTK_VERSION)
|
||||
|
||||
# libtool versioning
|
||||
LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
|
||||
LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
|
||||
LT_REVISION=$GTK_INTERFACE_AGE
|
||||
LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
|
||||
AC_SUBST(LT_RELEASE)
|
||||
AC_SUBST(LT_CURRENT)
|
||||
AC_SUBST(LT_REVISION)
|
||||
AC_SUBST(LT_AGE)
|
||||
|
||||
|
||||
# For automake.
|
||||
VERSION=$GTK_VERSION
|
||||
@@ -43,9 +68,10 @@ AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
|
||||
AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
|
||||
|
||||
AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
|
||||
AC_ARG_WITH(threads, [ --with-threads=[posix] support threading ])
|
||||
|
||||
if test "x$enable_debug" = "xyes"; then
|
||||
test "$cflags_set" = set || CFLAGS="-g"
|
||||
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
|
||||
CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
|
||||
else
|
||||
if test "x$enable_debug" = "xno"; then
|
||||
@@ -80,15 +106,29 @@ if test "x$GCC" = "xyes"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([For extra flags to get ANSI library prototypes])
|
||||
gtk_save_LDFLAGS=$LDFLAGS
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([#include <math.h>
|
||||
int main (void) { return (log(1) != log(1.)); }],
|
||||
AC_MSG_RESULT(none needed),
|
||||
gtk_save_CFLAGS=$CFLAGS
|
||||
CFLAGS="$CFLAGS -std1"
|
||||
AC_TRY_RUN([#include <math.h>
|
||||
int main (void) { return (log(1) != log(1.)); }],
|
||||
AC_MSG_RESULT(-std1),
|
||||
AC_MSG_RESULT()
|
||||
CFLAGS=$gtk_save_CFLAGS
|
||||
AC_MSG_WARN(
|
||||
[No ANSI prototypes found in library. (-std1 didn't work.)])
|
||||
)
|
||||
)
|
||||
LIBS=$gtk_save_LIBS
|
||||
|
||||
if test "x$enable_xim" = "xyes"; then
|
||||
CFLAGS="$CFLAGS -DUSE_XIM"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(GTK_MAJOR_VERSION, $GTK_MAJOR_VERSION)
|
||||
AC_DEFINE_UNQUOTED(GTK_MINOR_VERSION, $GTK_MINOR_VERSION)
|
||||
AC_DEFINE_UNQUOTED(GTK_MICRO_VERSION, $GTK_MICRO_VERSION)
|
||||
AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
|
||||
|
||||
# Find the X11 include and library directories
|
||||
AC_PATH_X
|
||||
AC_PATH_XTRA
|
||||
@@ -109,9 +149,25 @@ AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X
|
||||
|
||||
if test "x$enable_shm" = "xyes"; then
|
||||
# Check for the Xext library (needed for XShm extention)
|
||||
AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
|
||||
AC_CHECK_LIB(Xext, XShmAttach,
|
||||
x_libs="-lXext $x_libs",
|
||||
# On AIX, it is in XextSam instead, but we still need -lXext
|
||||
AC_CHECK_LIB(XextSam, XShmAttach,
|
||||
x_libs="-lXextSam -lXext $x_libs",
|
||||
no_xext_lib=yes, $x_libs),
|
||||
$x_libs)
|
||||
fi
|
||||
|
||||
# Check for shaped window extension
|
||||
|
||||
AC_CHECK_LIB(Xext, XShapeCombineMask,
|
||||
if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
|
||||
$x_libs="-lXext $x_libs"
|
||||
fi
|
||||
AC_DEFINE(HAVE_SHAPE_EXT),
|
||||
,
|
||||
$x_libs)
|
||||
|
||||
x_cflags="$X_CFLAGS"
|
||||
x_ldflags="$X_LDFLAGS $X_LIBS"
|
||||
|
||||
@@ -128,6 +184,14 @@ else
|
||||
AC_DEFINE(XINPUT_NONE)
|
||||
fi
|
||||
|
||||
# Threads
|
||||
|
||||
if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
|
||||
AC_CHECK_LIB(pthread, pthread_create,
|
||||
AC_DEFINE(USE_PTHREADS)
|
||||
x_libs="$x_libs -lpthread"
|
||||
CFLAGS="$CFLAGS -D_REENTRANT")
|
||||
fi
|
||||
|
||||
AC_SUBST(x_cflags)
|
||||
AC_SUBST(x_includes)
|
||||
@@ -238,7 +302,6 @@ AC_HEADER_STDC
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
|
||||
# Checks for library functions.
|
||||
AC_TYPE_SIGNAL
|
||||
@@ -260,4 +323,11 @@ if test $gtk_ok = no; then
|
||||
AC_DEFINE(NO_FD_SET)
|
||||
fi
|
||||
|
||||
AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
gtk-config
|
||||
docs/Makefile
|
||||
gdk/Makefile
|
||||
gtk/Makefile
|
||||
gtk/gtkfeatures.h
|
||||
], [chmod +x gtk-config])
|
||||
|
||||
294
docs/Makefile.in
294
docs/Makefile.in
@@ -1,294 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 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
|
||||
|
||||
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 = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
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
|
||||
|
||||
EXTRA_DIST = texinfo.tex macros.texi Makefile.gtkfaq gtkfaq.sgml gtkfaq_fix
|
||||
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
|
||||
DVIS = gdk.dvi gtk.dvi
|
||||
TEXINFOS = gdk.texi gtk.texi
|
||||
DIST_COMMON = Makefile.am Makefile.in texinfo.tex
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo
|
||||
$(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
|
||||
|
||||
|
||||
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) $<
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(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 $(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(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=$(infodir) $(infodir)/$$file";\
|
||||
install-info --info-dir=$(infodir) $(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=$(infodir) --remove $$file; \
|
||||
done
|
||||
$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(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
|
||||
|
||||
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
|
||||
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
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-info
|
||||
|
||||
all: Makefile $(INFO_DEPS)
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(infodir)
|
||||
|
||||
|
||||
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: default install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo 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:
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
gdkincludedir = $(includedir)/gdk
|
||||
|
||||
lib_LTLIBRARIES = libgdk.la
|
||||
lib_LTLIBRARIES = libgdk-1.1.la
|
||||
|
||||
libgdk_la_SOURCES = \
|
||||
libgdk_1_1_la_SOURCES = \
|
||||
gdk.c \
|
||||
gdkcc.c \
|
||||
gdkcolor.c \
|
||||
@@ -26,6 +26,7 @@ libgdk_la_SOURCES = \
|
||||
gdkrectangle.c \
|
||||
gdkregion.c \
|
||||
gdkselection.c \
|
||||
gdkthreads.c \
|
||||
gdkvisual.c \
|
||||
gdkwindow.c \
|
||||
gdkxid.c \
|
||||
@@ -46,10 +47,11 @@ gdkinclude_HEADERS = \
|
||||
gdktypes.h \
|
||||
gdkx.h
|
||||
|
||||
libgdk_la_LDFLAGS = -version-info 1:0:0 \
|
||||
libgdk_1_1_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||
@x_ldflags@ @x_libs@
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -I../glib @x_cflags@
|
||||
INCLUDES = -I$(top_srcdir) -I../glib -I$(top_srcdir)/glib @x_cflags@
|
||||
|
||||
EXTRA_PROGRAMS = gxid
|
||||
|
||||
@@ -78,5 +80,3 @@ files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
|
||||
$(DEP_FILES) : $(BUILT_SOURCES)
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
406
gdk/gdk.c
406
gdk/gdk.c
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "../config.h"
|
||||
|
||||
@@ -50,8 +51,8 @@
|
||||
#include "gdkinput.h"
|
||||
#ifdef USE_XIM
|
||||
#include "gdkx.h"
|
||||
#include "gdkkeysyms.h"
|
||||
#endif
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdki18n.h"
|
||||
|
||||
#ifndef X_GETTIMEOFDAY
|
||||
@@ -146,12 +147,17 @@ static RETSIGTYPE gdk_signal (int signum);
|
||||
|
||||
|
||||
#ifdef USE_XIM
|
||||
static guint gdk_im_va_count (va_list list);
|
||||
static XVaNestedList gdk_im_va_to_nested (va_list list,
|
||||
guint count);
|
||||
|
||||
static GdkIM gdk_im_get (void);
|
||||
static gint gdk_im_open (XrmDatabase db,
|
||||
gchar* res_name,
|
||||
gchar* rec_class);
|
||||
static void gdk_im_close (void);
|
||||
static void gdk_ic_cleanup (void);
|
||||
|
||||
#endif /* USE_XIM */
|
||||
|
||||
/* Private variable declarations
|
||||
@@ -217,9 +223,6 @@ static GList* xim_ic_list;
|
||||
|
||||
#endif
|
||||
|
||||
#define OTHER_XEVENT_BUFSIZE 4
|
||||
static XEvent other_xevent[OTHER_XEVENT_BUFSIZE]; /* XEvents passed along to user */
|
||||
static int other_xevent_i = 0;
|
||||
static GList *putback_events = NULL;
|
||||
|
||||
static gulong base_id;
|
||||
@@ -307,45 +310,66 @@ gdk_init (int *argc,
|
||||
if (argc && argv)
|
||||
{
|
||||
if (*argc > 0)
|
||||
gdk_progname = (*argv)[0];
|
||||
{
|
||||
gchar *d;
|
||||
|
||||
d = strrchr((*argv)[0],'/');
|
||||
if (d != NULL)
|
||||
gdk_progname = g_strdup (d + 1);
|
||||
else
|
||||
gdk_progname = g_strdup ((*argv)[0]);
|
||||
GDK_NOTE (MISC,
|
||||
g_print ("Gdk: progname: \"%s\"\n", gdk_progname));
|
||||
}
|
||||
|
||||
for (i = 1; i < *argc;)
|
||||
{
|
||||
if ((*argv)[i] == NULL)
|
||||
{
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (strcmp ("--gdk-debug", (*argv)[i]) == 0)
|
||||
if ((strcmp ("--gdk-debug", (*argv)[i]) == 0) ||
|
||||
(strncmp ("--gdk-debug=", (*argv)[i], 12) == 0))
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
gchar *equal_pos = strchr ((*argv)[i], '=');
|
||||
|
||||
if (equal_pos != NULL)
|
||||
{
|
||||
gdk_debug_flags |= g_parse_debug_string (equal_pos+1,
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
}
|
||||
else if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
(*argv)[i] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
else if (strcmp ("--gdk-no-debug", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
}
|
||||
else if ((strcmp ("--gdk-no-debug", (*argv)[i]) == 0) ||
|
||||
(strncmp ("--gdk-no-debug=", (*argv)[i], 15) == 0))
|
||||
{
|
||||
gchar *equal_pos = strchr ((*argv)[i], '=');
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
if (equal_pos != NULL)
|
||||
{
|
||||
gdk_debug_flags &= ~g_parse_debug_string (equal_pos+1,
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
}
|
||||
else if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
(*argv)[i] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
(*argv)[i] = NULL;
|
||||
}
|
||||
else
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
else if (strcmp ("--display", (*argv)[i]) == 0)
|
||||
if (strcmp ("--display", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
|
||||
@@ -479,7 +503,7 @@ gdk_init (int *argc,
|
||||
|
||||
connection_number = ConnectionNumber (gdk_display);
|
||||
GDK_NOTE (MISC,
|
||||
g_print ("connection number: %d\n", connection_number));
|
||||
g_print ("Gdk: connection number: %d\n", connection_number));
|
||||
|
||||
if (synchronize)
|
||||
XSynchronize (gdk_display, True);
|
||||
@@ -601,7 +625,7 @@ gdk_exit (int errorcode)
|
||||
*/
|
||||
|
||||
gchar*
|
||||
gdk_set_locale ()
|
||||
gdk_set_locale (void)
|
||||
{
|
||||
if (!setlocale (LC_ALL,""))
|
||||
g_print ("locale not supported by C library\n");
|
||||
@@ -639,7 +663,7 @@ gdk_set_locale ()
|
||||
*/
|
||||
|
||||
gint
|
||||
gdk_events_pending ()
|
||||
gdk_events_pending (void)
|
||||
{
|
||||
gint result;
|
||||
GList *tmp_list;
|
||||
@@ -999,13 +1023,13 @@ gdk_set_use_xshm (gint use_xshm)
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_get_show_events ()
|
||||
gdk_get_show_events (void)
|
||||
{
|
||||
return gdk_debug_flags & GDK_DEBUG_EVENTS;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_get_use_xshm ()
|
||||
gdk_get_use_xshm (void)
|
||||
{
|
||||
return gdk_use_xshm;
|
||||
}
|
||||
@@ -1031,7 +1055,7 @@ gdk_get_use_xshm ()
|
||||
*/
|
||||
|
||||
guint32
|
||||
gdk_time_get ()
|
||||
gdk_time_get (void)
|
||||
{
|
||||
struct timeval end;
|
||||
struct timeval elapsed;
|
||||
@@ -1070,7 +1094,7 @@ gdk_time_get ()
|
||||
*/
|
||||
|
||||
guint32
|
||||
gdk_timer_get ()
|
||||
gdk_timer_get (void)
|
||||
{
|
||||
return timer_val;
|
||||
}
|
||||
@@ -1105,13 +1129,13 @@ gdk_timer_set (guint32 milliseconds)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_timer_enable ()
|
||||
gdk_timer_enable (void)
|
||||
{
|
||||
timerp = &timer;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_timer_disable ()
|
||||
gdk_timer_disable (void)
|
||||
{
|
||||
timerp = NULL;
|
||||
}
|
||||
@@ -1439,7 +1463,7 @@ gdk_keyboard_ungrab (guint32 time)
|
||||
*/
|
||||
|
||||
gint
|
||||
gdk_screen_width ()
|
||||
gdk_screen_width (void)
|
||||
{
|
||||
gint return_val;
|
||||
|
||||
@@ -1464,7 +1488,7 @@ gdk_screen_width ()
|
||||
*/
|
||||
|
||||
gint
|
||||
gdk_screen_height ()
|
||||
gdk_screen_height (void)
|
||||
{
|
||||
gint return_val;
|
||||
|
||||
@@ -1474,13 +1498,13 @@ gdk_screen_height ()
|
||||
}
|
||||
|
||||
void
|
||||
gdk_key_repeat_disable ()
|
||||
gdk_key_repeat_disable (void)
|
||||
{
|
||||
XAutoRepeatOff (gdk_display);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_key_repeat_restore ()
|
||||
gdk_key_repeat_restore (void)
|
||||
{
|
||||
if (autorepeat)
|
||||
XAutoRepeatOn (gdk_display);
|
||||
@@ -1507,14 +1531,14 @@ gdk_key_repeat_restore ()
|
||||
*--------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void gdk_flush ()
|
||||
void gdk_flush (void)
|
||||
{
|
||||
XSync (gdk_display, False);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gdk_beep ()
|
||||
gdk_beep (void)
|
||||
{
|
||||
XBell(gdk_display, 100);
|
||||
}
|
||||
@@ -1538,7 +1562,7 @@ gdk_beep ()
|
||||
*/
|
||||
|
||||
static gint
|
||||
gdk_event_wait ()
|
||||
gdk_event_wait (void)
|
||||
{
|
||||
GList *list;
|
||||
GdkInput *input;
|
||||
@@ -1582,8 +1606,31 @@ gdk_event_wait ()
|
||||
max_input = MAX (max_input, input->source);
|
||||
}
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
if (gdk_using_threads)
|
||||
{
|
||||
gdk_select_waiting = TRUE;
|
||||
|
||||
FD_SET (gdk_threads_pipe[0], &readfds);
|
||||
max_input = MAX (max_input, gdk_threads_pipe[0]);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
#endif
|
||||
|
||||
nfd = select (max_input+1, &readfds, &writefds, &exceptfds, timerp);
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
if (gdk_using_threads)
|
||||
{
|
||||
gchar c;
|
||||
gdk_threads_enter ();
|
||||
gdk_select_waiting = FALSE;
|
||||
|
||||
if (FD_ISSET (gdk_threads_pipe[0], &readfds))
|
||||
read (gdk_threads_pipe[0], &c, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
timerp = NULL;
|
||||
timer_val = 0;
|
||||
|
||||
@@ -1661,7 +1708,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *window_private;
|
||||
XComposeStatus compose;
|
||||
static XComposeStatus compose;
|
||||
KeySym keysym;
|
||||
int charcount;
|
||||
#ifdef USE_XIM
|
||||
static gchar* buf = NULL;
|
||||
@@ -1671,10 +1719,12 @@ gdk_event_translate (GdkEvent *event,
|
||||
#endif
|
||||
gint return_val;
|
||||
|
||||
/* Are static variables used for this purpose thread-safe? */
|
||||
|
||||
return_val = FALSE;
|
||||
|
||||
/* We need to play catch-up with the dnd motion events */
|
||||
if(gdk_dnd.drag_really && xevent->type == MotionNotify)
|
||||
while (XCheckTypedEvent(xevent->xany.display,MotionNotify,xevent));
|
||||
|
||||
/* Find the GdkWindow that this event occurred in.
|
||||
* All events occur in some GdkWindow (otherwise, why
|
||||
* would we be receiving them). It really is an error
|
||||
@@ -1741,16 +1791,16 @@ gdk_event_translate (GdkEvent *event,
|
||||
buf_len = 128;
|
||||
buf = g_new (gchar, buf_len);
|
||||
}
|
||||
keysym = GDK_VoidSymbol;
|
||||
|
||||
if (xim_using == TRUE && xim_ic)
|
||||
{
|
||||
Status status;
|
||||
|
||||
/* Clear keyval. Depending on status, may not be set */
|
||||
event->key.keyval = GDK_VoidSymbol;
|
||||
charcount = XmbLookupString(xim_ic->xic,
|
||||
&xevent->xkey, buf, buf_len-1,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&status);
|
||||
&keysym, &status);
|
||||
if (status == XBufferOverflow)
|
||||
{ /* retry */
|
||||
/* alloc adequate size of buffer */
|
||||
@@ -1763,8 +1813,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
charcount = XmbLookupString (xim_ic->xic,
|
||||
&xevent->xkey, buf, buf_len-1,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&status);
|
||||
&keysym, &status);
|
||||
}
|
||||
if (status == XLookupNone)
|
||||
{
|
||||
@@ -1774,13 +1823,13 @@ gdk_event_translate (GdkEvent *event,
|
||||
}
|
||||
else
|
||||
charcount = XLookupString (&xevent->xkey, buf, buf_len,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&compose);
|
||||
&keysym, &compose);
|
||||
#else
|
||||
charcount = XLookupString (&xevent->xkey, buf, 16,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&compose);
|
||||
&keysym, &compose);
|
||||
#endif
|
||||
event->key.keyval = keysym;
|
||||
|
||||
if (charcount > 0 && buf[charcount-1] == '\0')
|
||||
charcount --;
|
||||
else
|
||||
@@ -1818,9 +1867,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
case KeyRelease:
|
||||
/* Lookup the string corresponding to the given keysym.
|
||||
*/
|
||||
keysym = GDK_VoidSymbol;
|
||||
charcount = XLookupString (&xevent->xkey, buf, 16,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&compose);
|
||||
&keysym, &compose);
|
||||
event->key.keyval = keysym;
|
||||
|
||||
/* Print debugging info.
|
||||
*/
|
||||
@@ -1937,8 +1987,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
window_private->dnd_drag_savedeventmask = dnd_winattr.your_event_mask;
|
||||
dnd_setwinattr.event_mask =
|
||||
window_private->dnd_drag_eventmask = ButtonMotionMask |
|
||||
EnterWindowMask | LeaveWindowMask;
|
||||
window_private->dnd_drag_eventmask = ButtonMotionMask | ButtonPressMask | ButtonReleaseMask |
|
||||
EnterWindowMask | LeaveWindowMask | ExposureMask;
|
||||
XChangeWindowAttributes(gdk_display, window_private->xwindow,
|
||||
CWEventMask, &dnd_setwinattr);
|
||||
}
|
||||
@@ -2069,7 +2119,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
/* XXX there has to be a better way to do this, perhaps with
|
||||
XTranslateCoordinates or XQueryTree - I don't know how,
|
||||
and this sort of works */
|
||||
static Window lastwin = None, curwin = None, twin;
|
||||
static Window lastwin = None, curwin = None;
|
||||
#if 0
|
||||
Window twin;
|
||||
#endif
|
||||
Window childwin = gdk_root_window;
|
||||
int x, y, ox, oy;
|
||||
|
||||
@@ -2083,6 +2136,13 @@ gdk_event_translate (GdkEvent *event,
|
||||
curwin = gdk_root_window;
|
||||
ox = x = xevent->xmotion.x_root;
|
||||
oy = y = xevent->xmotion.y_root;
|
||||
#if 1
|
||||
curwin = gdk_window_xid_at_coords(xevent->xmotion.x_root,
|
||||
xevent->xmotion.y_root,
|
||||
gdk_dnd.c->xids,TRUE);
|
||||
XTranslateCoordinates(gdk_display, gdk_root_window, curwin,
|
||||
x, y, &x, &y, &childwin);
|
||||
#else
|
||||
while(childwin != None)
|
||||
{
|
||||
ox = x; oy = y;
|
||||
@@ -2095,6 +2155,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
x, y, &x, &y, &twin);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
GDK_NOTE (DND,
|
||||
g_print("Drag is now in window %#lx, lastwin was %#lx, ddc = %#lx\n",
|
||||
curwin, lastwin, gdk_dnd.dnd_drag_curwin));
|
||||
@@ -2296,7 +2357,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
ButtonMotionMask | PointerMotionMask |
|
||||
/* PointerMotionHintMask | */ /* HINTME */
|
||||
ButtonPressMask | ButtonReleaseMask,
|
||||
GrabModeAsync, GrabModeAsync, gdk_root_window,
|
||||
GrabModeAsync, GrabModeAsync, None,
|
||||
None, CurrentTime);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GDK_NOTE(DND, g_print("xgpret = %d\n", xgpret));
|
||||
@@ -2506,7 +2567,30 @@ gdk_event_translate (GdkEvent *event,
|
||||
while ((XPending (gdk_display) > 0) &&
|
||||
XCheckTypedWindowEvent(gdk_display, xevent->xany.window,
|
||||
ConfigureNotify, xevent))
|
||||
/*XSync (gdk_display, 0)*/;
|
||||
{
|
||||
GdkFilterReturn result;
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("configure notify discarded:\twindow: %ld\n",
|
||||
xevent->xconfigure.window - base_id));
|
||||
|
||||
result = gdk_event_apply_filters (xevent, event,
|
||||
window_private
|
||||
?window_private->filters
|
||||
:gdk_default_filters);
|
||||
|
||||
/* If the result is GDK_FILTER_REMOVE, there will be
|
||||
* trouble, but anybody who filtering the Configure events
|
||||
* better know what they are doing
|
||||
*/
|
||||
if (result != GDK_FILTER_CONTINUE)
|
||||
{
|
||||
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/*XSync (gdk_display, 0);*/
|
||||
}
|
||||
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d\n",
|
||||
@@ -2533,7 +2617,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
event->configure.height = xevent->xconfigure.height;
|
||||
|
||||
if (!xevent->xconfigure.x &&
|
||||
!xevent->xconfigure.y)
|
||||
!xevent->xconfigure.y &&
|
||||
!window_private->destroyed)
|
||||
{
|
||||
gint tx = 0;
|
||||
gint ty = 0;
|
||||
@@ -2887,19 +2972,9 @@ gdk_event_translate (GdkEvent *event,
|
||||
gdk_input_vtable.other_event)
|
||||
return_val = gdk_input_vtable.other_event(event, xevent, window);
|
||||
else
|
||||
return_val = -1;
|
||||
return_val = FALSE;
|
||||
|
||||
if (return_val < 0) /* not an XInput event, convert */
|
||||
{
|
||||
event->other.type = GDK_OTHER_EVENT;
|
||||
event->other.window = window;
|
||||
event->other.xevent = (GdkXEvent *)&other_xevent[other_xevent_i];
|
||||
memcpy (&other_xevent[other_xevent_i], xevent, sizeof (XEvent));
|
||||
other_xevent_i = (other_xevent_i+1) % OTHER_XEVENT_BUFSIZE;
|
||||
return_val = TRUE;
|
||||
}
|
||||
else
|
||||
return_val = return_val && !window_private->destroyed;
|
||||
return_val = return_val && !window_private->destroyed;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -2977,7 +3052,7 @@ gdk_synthesize_click (GdkEvent *event,
|
||||
*/
|
||||
|
||||
static void
|
||||
gdk_exit_func ()
|
||||
gdk_exit_func (void)
|
||||
{
|
||||
static gboolean in_gdk_exit_func = FALSE;
|
||||
|
||||
@@ -3035,7 +3110,12 @@ gdk_x_error (Display *display,
|
||||
if (gdk_error_warnings)
|
||||
{
|
||||
XGetErrorText (display, error->error_code, buf, 63);
|
||||
g_error ("%s", buf);
|
||||
g_error ("%s\n serial %ld error_code %d request_code %d minor_code %d\n",
|
||||
buf,
|
||||
error->serial,
|
||||
error->error_code,
|
||||
error->request_code,
|
||||
error->minor_code);
|
||||
}
|
||||
|
||||
gdk_error_code = -1;
|
||||
@@ -3138,13 +3218,16 @@ gdk_signal (int sig_num)
|
||||
static void
|
||||
gdk_dnd_drag_begin (GdkWindow *initial_window)
|
||||
{
|
||||
GdkEventDragBegin tev;
|
||||
tev.type = GDK_DRAG_BEGIN;
|
||||
tev.window = initial_window;
|
||||
tev.u.allflags = 0;
|
||||
tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
GdkEvent tev;
|
||||
|
||||
gdk_event_put ((GdkEvent *) &tev);
|
||||
GDK_NOTE(DND, g_print("------- STARTING DRAG from %p\n", initial_window));
|
||||
|
||||
tev.type = GDK_DRAG_BEGIN;
|
||||
tev.dragbegin.window = initial_window;
|
||||
tev.dragbegin.u.allflags = 0;
|
||||
tev.dragbegin.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
|
||||
gdk_event_put (&tev);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3184,7 +3267,7 @@ gdk_dnd_drag_enter (Window dest)
|
||||
}
|
||||
else
|
||||
sev.xclient.data.l[3] = sev.xclient.data.l[4] = None;
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
if (!gdk_send_xevent (dest, False, StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeEnter to %#lx failed\n",
|
||||
dest));
|
||||
}
|
||||
@@ -3195,6 +3278,84 @@ gdk_dnd_drag_enter (Window dest)
|
||||
|
||||
#ifdef USE_XIM
|
||||
|
||||
/* The following routines duplicate functionality in Xlib to
|
||||
* translate from varargs to X's internal opaque XVaNestedList.
|
||||
*
|
||||
* If all vendors have stuck close to the reference implementation,
|
||||
* then we should hopefully be OK.
|
||||
*/
|
||||
|
||||
/* This needs to match XIMArg as defined in Xlcint.h exactly */
|
||||
|
||||
typedef struct {
|
||||
gchar *name;
|
||||
gpointer value;
|
||||
} GdkImArg;
|
||||
|
||||
/*************************************************************
|
||||
* gdk_im_va_count:
|
||||
* Counts the number of name/value pairs in the vararg list
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*************************************************************/
|
||||
|
||||
static guint
|
||||
gdk_im_va_count (va_list list)
|
||||
{
|
||||
gint count = 0;
|
||||
gchar *name;
|
||||
|
||||
name = va_arg (list, gchar *);
|
||||
while (name)
|
||||
{
|
||||
count++;
|
||||
(void)va_arg (list, gpointer);
|
||||
name = va_arg (list, gchar *);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* gdk_im_va_to_nested:
|
||||
* Given a varargs list and the result of gdk_im_va_count,
|
||||
* create a XVaNestedList.
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*************************************************************/
|
||||
|
||||
static XVaNestedList
|
||||
gdk_im_va_to_nested (va_list list, guint count)
|
||||
{
|
||||
GdkImArg *result;
|
||||
GdkImArg *arg;
|
||||
|
||||
gchar *name;
|
||||
|
||||
if (count == 0)
|
||||
return NULL;
|
||||
|
||||
result = g_new (GdkImArg, count+1);
|
||||
arg = result;
|
||||
|
||||
name = va_arg (list, gchar *);
|
||||
while (name)
|
||||
{
|
||||
arg->name = name;
|
||||
arg->value = va_arg (list, gpointer);
|
||||
arg++;
|
||||
name = va_arg (list, gchar *);
|
||||
}
|
||||
|
||||
arg->name = NULL;
|
||||
|
||||
return (XVaNestedList)result;
|
||||
}
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------
|
||||
* gdk_im_begin
|
||||
@@ -3413,7 +3574,8 @@ gdk_ic_new (GdkWindow* client_window,
|
||||
{
|
||||
va_list list;
|
||||
GdkICPrivate *private;
|
||||
XVaNestedList preedit_attr;
|
||||
XVaNestedList preedit_attr = NULL;
|
||||
guint count;
|
||||
|
||||
g_return_val_if_fail (client_window != NULL, NULL);
|
||||
g_return_val_if_fail (focus_window != NULL, NULL);
|
||||
@@ -3422,9 +3584,13 @@ gdk_ic_new (GdkWindow* client_window,
|
||||
private = g_new (GdkICPrivate, 1);
|
||||
|
||||
va_start (list, style);
|
||||
preedit_attr = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, style);
|
||||
preedit_attr = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
private->style = gdk_im_decide_style (style);
|
||||
if (private->style != style)
|
||||
{
|
||||
@@ -3439,6 +3605,9 @@ gdk_ic_new (GdkWindow* client_window,
|
||||
XNFocusWindow, GDK_WINDOW_XWINDOW (focus_window),
|
||||
preedit_attr? XNPreeditAttributes : NULL, preedit_attr,
|
||||
NULL);
|
||||
|
||||
g_free (preedit_attr);
|
||||
|
||||
if (!private->xic)
|
||||
{
|
||||
g_free (private);
|
||||
@@ -3484,16 +3653,23 @@ gdk_ic_set_values (GdkIC ic, ...)
|
||||
va_list list;
|
||||
XVaNestedList args;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, ic);
|
||||
args = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, ic);
|
||||
args = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XSetICValues (private->xic, XNVaNestedList, args, NULL);
|
||||
|
||||
g_free (args);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3502,16 +3678,23 @@ gdk_ic_get_values (GdkIC ic, ...)
|
||||
va_list list;
|
||||
XVaNestedList args;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, ic);
|
||||
args = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, ic);
|
||||
args = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XGetICValues (private->xic, XNVaNestedList, args, NULL);
|
||||
|
||||
g_free (args);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3520,6 +3703,7 @@ gdk_ic_set_attr (GdkIC ic, const char *target, ...)
|
||||
va_list list;
|
||||
XVaNestedList attr;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
g_return_if_fail (target != NULL);
|
||||
@@ -3527,10 +3711,16 @@ gdk_ic_set_attr (GdkIC ic, const char *target, ...)
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, target);
|
||||
attr = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, target);
|
||||
attr = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XSetICValues (private->xic, target, attr, NULL);
|
||||
|
||||
g_free (attr);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3539,6 +3729,7 @@ gdk_ic_get_attr (GdkIC ic, const char *target, ...)
|
||||
va_list list;
|
||||
XVaNestedList attr;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
g_return_if_fail (target != NULL);
|
||||
@@ -3546,10 +3737,16 @@ gdk_ic_get_attr (GdkIC ic, const char *target, ...)
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, target);
|
||||
attr = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, target);
|
||||
attr = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XGetICValues (private->xic, target, attr, NULL);
|
||||
|
||||
g_free (attr);
|
||||
}
|
||||
|
||||
GdkEventMask
|
||||
@@ -3705,6 +3902,9 @@ _g_mbtowc (wchar_t *wstr, const char *str, size_t len)
|
||||
wcs[0] = (wchar_t) NULL;
|
||||
mbs[0] = '\0';
|
||||
|
||||
/* The last argument isn't a mistake. The X locale code trims
|
||||
* the input string to the length of the output string!
|
||||
*/
|
||||
len = _Xmbstowcs (wcs, str, (len<MB_CUR_MAX)? len:MB_CUR_MAX);
|
||||
if (len < 1)
|
||||
return len;
|
||||
@@ -3742,7 +3942,7 @@ gdk_dnd_drag_leave (Window dest)
|
||||
{
|
||||
wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
|
||||
sev.xclient.data.l[0] = wp->xwindow;
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
if (!gdk_send_xevent (dest, False, StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeLeave to %#lx failed\n",
|
||||
dest));
|
||||
wp->dnd_drag_accepted = 0;
|
||||
@@ -3759,28 +3959,28 @@ gdk_dnd_drag_end (Window dest,
|
||||
GdkPoint coords)
|
||||
{
|
||||
GdkWindowPrivate *wp;
|
||||
GdkEventDragRequest tev;
|
||||
GdkEvent tev;
|
||||
int i;
|
||||
|
||||
tev.type = GDK_DRAG_REQUEST;
|
||||
tev.drop_coords = coords;
|
||||
tev.requestor = dest;
|
||||
tev.u.allflags = 0;
|
||||
tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
tev.isdrop = 1;
|
||||
tev.dragrequest.type = GDK_DRAG_REQUEST;
|
||||
tev.dragrequest.drop_coords = coords;
|
||||
tev.dragrequest.requestor = dest;
|
||||
tev.dragrequest.u.allflags = 0;
|
||||
tev.dragrequest.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
tev.dragrequest.isdrop = 1;
|
||||
|
||||
for (i = 0; i < gdk_dnd.drag_numwindows; i++)
|
||||
{
|
||||
wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
|
||||
if (wp->dnd_drag_accepted)
|
||||
{
|
||||
tev.window = (GdkWindow *) wp;
|
||||
tev.u.flags.delete_data = wp->dnd_drag_destructive_op;
|
||||
tev.timestamp = gdk_dnd.last_drop_time;
|
||||
tev.data_type =
|
||||
tev.dragrequest.window = (GdkWindow *) wp;
|
||||
tev.dragrequest.u.flags.delete_data = wp->dnd_drag_destructive_op;
|
||||
tev.dragrequest.timestamp = gdk_dnd.last_drop_time;
|
||||
tev.dragrequest.data_type =
|
||||
gdk_atom_name(wp->dnd_drag_data_type);
|
||||
|
||||
gdk_event_put((GdkEvent *) &tev);
|
||||
gdk_event_put(&tev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3828,8 +4028,8 @@ gdk_dnd_check_types (GdkWindow *window,
|
||||
|
||||
if (realfmt != (sizeof(Atom) * 8))
|
||||
{
|
||||
g_warning("XdeTypelist property had format of %d instead of the expected %d, on window %#lx\n",
|
||||
realfmt, sizeof(Atom) * 8, xevent->xclient.data.l[0]);
|
||||
g_warning("XdeTypelist property had format of %d instead of the expected %ld, on window %#lx\n",
|
||||
realfmt, (glong)sizeof(Atom) * 8, xevent->xclient.data.l[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4005,7 +4205,7 @@ gdk_event_send_clientmessage_toall(GdkEvent *event)
|
||||
curwin = gdk_get_client_window(gdk_display, ret_children[i]);
|
||||
sev.xclient.window = curwin;
|
||||
if (!gdk_send_xevent (curwin, False, NoEventMask, &sev))
|
||||
GDK_NOTE (MISC, g_print("Sending client message %ld to %#lx failed\n",
|
||||
GDK_NOTE (MISC, g_print("Gdk: Sending client message %ld to %#lx failed\n",
|
||||
event->client.message_type, curwin));
|
||||
}
|
||||
|
||||
|
||||
29
gdk/gdk.h
29
gdk/gdk.h
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GDK_H__
|
||||
#define __GDK_H__
|
||||
@@ -111,8 +112,8 @@ void gdk_query_depths (gint **depths,
|
||||
gint *count);
|
||||
void gdk_query_visual_types (GdkVisualType **visual_types,
|
||||
gint *count);
|
||||
void gdk_query_visuals (GdkVisual **visuals,
|
||||
gint *count);
|
||||
|
||||
GList* gdk_list_visuals (void);
|
||||
|
||||
|
||||
/* Windows
|
||||
@@ -298,6 +299,8 @@ void gdk_window_set_decorations (GdkWindow *window,
|
||||
GdkWMDecoration decorations);
|
||||
void gdk_window_set_functions (GdkWindow *window,
|
||||
GdkWMFunction functions);
|
||||
GList * gdk_window_get_toplevels (void);
|
||||
|
||||
|
||||
/* Cursors
|
||||
*/
|
||||
@@ -357,6 +360,10 @@ void gdk_gc_set_line_attributes (GdkGC *gc,
|
||||
GdkLineStyle line_style,
|
||||
GdkCapStyle cap_style,
|
||||
GdkJoinStyle join_style);
|
||||
void gdk_gc_set_dashes (GdkGC *gc,
|
||||
gint dash_offset,
|
||||
gchar dash_list[],
|
||||
gint n);
|
||||
void gdk_gc_copy (GdkGC *dst_gc,
|
||||
GdkGC *src_gc);
|
||||
|
||||
@@ -770,7 +777,11 @@ gboolean gdk_region_point_in (GdkRegion *region,
|
||||
int x,
|
||||
int y);
|
||||
GdkOverlapType gdk_region_rect_in (GdkRegion *region,
|
||||
GdkRectangle *rect);
|
||||
GdkRectangle *rect);
|
||||
|
||||
GdkRegion* gdk_region_polygon (GdkPoint *points,
|
||||
gint npoints,
|
||||
GdkFillRule fill_rule);
|
||||
|
||||
void gdk_region_offset (GdkRegion *region,
|
||||
gint dx,
|
||||
@@ -790,6 +801,14 @@ GdkRegion* gdk_regions_subtract (GdkRegion *source1,
|
||||
GdkRegion* gdk_regions_xor (GdkRegion *source1,
|
||||
GdkRegion *source2);
|
||||
|
||||
gboolean gdk_threads_init (void);
|
||||
void gdk_threads_enter (void);
|
||||
void gdk_threads_leave (void);
|
||||
|
||||
/* If the mainloop thread is in its select, wake it up.
|
||||
* For GTK's idle handling
|
||||
*/
|
||||
void gdk_threads_wake (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
26
gdk/gdkcc.c
26
gdk/gdkcc.c
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Color Context module
|
||||
@@ -851,8 +852,9 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
gint bad_alloc = FALSE;
|
||||
gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
|
||||
GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
|
||||
|
||||
#endif
|
||||
g_assert (cc != NULL);
|
||||
g_assert (reds != NULL);
|
||||
g_assert (greens != NULL);
|
||||
@@ -934,7 +936,7 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
exact_col = ncols;
|
||||
#endif
|
||||
|
||||
@@ -1012,7 +1014,7 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
defs[i] = cmap[close];
|
||||
defs[i].pixel = colors[i];
|
||||
allocated[ncols++] = colors[i];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
close_col++;
|
||||
#endif
|
||||
} else
|
||||
@@ -1086,14 +1088,14 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
|
||||
defs[i].pixel = cc->black_pixel;
|
||||
defs[i].red = defs[i].green = defs[i].blue = 0;
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
black_col++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
defs[i] = defs[close];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
subst_col++;
|
||||
#endif
|
||||
}
|
||||
@@ -1123,7 +1125,9 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
gint bad_alloc = FALSE;
|
||||
gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
|
||||
GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
|
||||
#endif
|
||||
|
||||
g_assert (cc != NULL);
|
||||
g_assert (reds != NULL);
|
||||
@@ -1204,7 +1208,7 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
exact_col = ncols;
|
||||
#endif
|
||||
|
||||
@@ -1276,7 +1280,7 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
defs[i] = cmap[close];
|
||||
defs[i].pixel = colors[i];
|
||||
allocated[ncols++] = colors[i];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
close_col++;
|
||||
#endif
|
||||
}
|
||||
@@ -1348,14 +1352,14 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
|
||||
defs[i].pixel = cc->black_pixel;
|
||||
defs[i].red = defs[i].green = defs[i].blue = 0;
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
black_col++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
defs[i] = defs[close];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
subst_col++;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdk.h"
|
||||
@@ -40,7 +41,6 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
GdkColormap *colormap;
|
||||
GdkColormapPrivate *private;
|
||||
Visual *xvisual;
|
||||
XColor default_colors[256];
|
||||
int size;
|
||||
int i;
|
||||
|
||||
@@ -55,6 +55,9 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
private->ref_count = 1;
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
colormap->size = visual->colormap_size;
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
switch (visual->type)
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
@@ -65,14 +68,18 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
|
||||
if (private_cmap)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
XColor *default_colors;
|
||||
|
||||
default_colors = g_new (XColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
default_colors[i].pixel = i;
|
||||
|
||||
XQueryColors (private->xdisplay,
|
||||
DefaultColormap (private->xdisplay, gdk_screen),
|
||||
default_colors, visual->colormap_size);
|
||||
default_colors, colormap->size);
|
||||
|
||||
for (i = 0; i < visual->colormap_size; i++)
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = default_colors[i].pixel;
|
||||
colormap->colors[i].red = default_colors[i].red;
|
||||
@@ -80,7 +87,9 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
colormap->colors[i].blue = default_colors[i].blue;
|
||||
}
|
||||
|
||||
gdk_colormap_change (colormap, visual->colormap_size);
|
||||
gdk_colormap_change (colormap, colormap->size);
|
||||
|
||||
g_free (default_colors);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -101,7 +110,7 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
for (i = 0; i < size; i++)
|
||||
colormap->colors[i].blue = i * 65535 / (size - 1);
|
||||
|
||||
gdk_colormap_change (colormap, visual->colormap_size);
|
||||
gdk_colormap_change (colormap, colormap->size);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_STATIC_GRAY:
|
||||
@@ -130,6 +139,7 @@ gdk_colormap_real_destroy (GdkColormap *colormap)
|
||||
|
||||
gdk_colormap_remove (colormap);
|
||||
XFreeColormap (private->xdisplay, private->xcolormap);
|
||||
g_free (colormap->colors);
|
||||
g_free (colormap);
|
||||
}
|
||||
|
||||
@@ -159,7 +169,7 @@ gdk_colormap_get_system (void)
|
||||
{
|
||||
static GdkColormap *colormap = NULL;
|
||||
GdkColormapPrivate *private;
|
||||
XColor xpalette[256];
|
||||
XColor *xpalette;
|
||||
gint i;
|
||||
|
||||
if (!colormap)
|
||||
@@ -174,10 +184,15 @@ gdk_colormap_get_system (void)
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
|
||||
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))
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
xpalette = g_new (XColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
xpalette[i].red = 0;
|
||||
@@ -186,15 +201,17 @@ gdk_colormap_get_system (void)
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette,
|
||||
MIN (private->visual->colormap_size, 256));
|
||||
colormap->size);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
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;
|
||||
}
|
||||
|
||||
g_free (xpalette);
|
||||
}
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
@@ -215,7 +232,7 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor palette[256];
|
||||
XColor *palette;
|
||||
gint shift;
|
||||
int max_colors;
|
||||
int size;
|
||||
@@ -223,6 +240,8 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
palette = g_new (XColor, ncolors);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
switch (private->visual->type)
|
||||
{
|
||||
@@ -287,6 +306,8 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (palette);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -423,8 +444,7 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor xcolor;
|
||||
gchar available[256];
|
||||
gint available_init;
|
||||
gchar *available = NULL;
|
||||
gint return_val;
|
||||
gint i, index;
|
||||
|
||||
@@ -446,9 +466,10 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
if (private->private_val)
|
||||
{
|
||||
if (private->next_color > 255)
|
||||
if (private->next_color >= colormap->size)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
@@ -465,7 +486,7 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
}
|
||||
else
|
||||
{
|
||||
xcolor.pixel = 255 - private->next_color;
|
||||
xcolor.pixel = colormap->size - 1 -private->next_color;
|
||||
color->pixel = xcolor.pixel;
|
||||
private->next_color += 1;
|
||||
|
||||
@@ -475,8 +496,6 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
}
|
||||
else
|
||||
{
|
||||
available_init = 1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
@@ -486,17 +505,18 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
color->green = xcolor.green;
|
||||
color->blue = xcolor.blue;
|
||||
|
||||
colormap->colors[color->pixel] = *color;
|
||||
if (color->pixel < colormap->size)
|
||||
colormap->colors[color->pixel] = *color;
|
||||
|
||||
return_val = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (available_init)
|
||||
if (available == NULL)
|
||||
{
|
||||
available_init = 0;
|
||||
for (i = 0; i < 256; i++)
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
}
|
||||
|
||||
@@ -540,6 +560,9 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
break;
|
||||
}
|
||||
|
||||
if (available)
|
||||
g_free (available);
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
@@ -582,8 +605,6 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
GdkColormapPrivate *private;
|
||||
XColor xpalette[256];
|
||||
gint i;
|
||||
|
||||
colormap = gdk_colormap_lookup (xcolormap);
|
||||
if (colormap)
|
||||
@@ -601,6 +622,12 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
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
|
||||
* X doesn't allow this
|
||||
*/
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
@@ -618,6 +645,10 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
colormap->colors[i].green = xpalette[i].green;
|
||||
colormap->colors[i].blue = xpalette[i].blue;
|
||||
}
|
||||
#endif
|
||||
|
||||
colormap->colors = NULL;
|
||||
colormap->size = 0;
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
|
||||
@@ -642,7 +673,7 @@ gdk_colormap_match_color (GdkColormap *cmap,
|
||||
max = 3 * (65536);
|
||||
index = -1;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
for (i = 0; i < cmap->size; i++)
|
||||
{
|
||||
if ((!available) || (available && available[i]))
|
||||
{
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* 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,
|
||||
|
||||
29
gdk/gdkdnd.c
29
gdk/gdkdnd.c
@@ -26,6 +26,8 @@ gdk_dnd_set_drag_cursors(GdkCursor *default_cursor, GdkCursor *goahead_cursor)
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_ok);
|
||||
}
|
||||
gdk_dnd.c->drag_pm_default = gdk_dnd.c->drag_pm_ok = NULL;
|
||||
g_list_free(gdk_dnd.c->xids);
|
||||
gdk_dnd.c->xids = NULL;
|
||||
}
|
||||
gdk_dnd_display_drag_cursor(-1, -1,
|
||||
gdk_dnd.dnd_drag_target?TRUE:FALSE,
|
||||
@@ -41,19 +43,28 @@ gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
|
||||
{
|
||||
g_return_if_fail(default_pixmapwin != NULL);
|
||||
|
||||
g_list_free(gdk_dnd.c->xids); gdk_dnd.c->xids = NULL;
|
||||
if(gdk_dnd.c->drag_pm_default)
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_default);
|
||||
{
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_default);
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_default);
|
||||
}
|
||||
if(gdk_dnd.c->drag_pm_ok)
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_ok);
|
||||
{
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_ok);
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_ok);
|
||||
}
|
||||
|
||||
gdk_dnd.c->drag_pm_ok = NULL;
|
||||
|
||||
gdk_window_ref(default_pixmapwin);
|
||||
gdk_dnd.c->drag_pm_default = default_pixmapwin;
|
||||
gdk_dnd.c->default_hotspot = *default_hotspot;
|
||||
gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, GUINT_TO_POINTER (((GdkWindowPrivate *)default_pixmapwin)->xwindow));
|
||||
if(goahead_pixmapwin)
|
||||
{
|
||||
gdk_window_ref(goahead_pixmapwin);
|
||||
gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, GUINT_TO_POINTER (((GdkWindowPrivate *)goahead_pixmapwin)->xwindow));
|
||||
gdk_dnd.c->drag_pm_ok = goahead_pixmapwin;
|
||||
gdk_dnd.c->ok_hotspot = *goahead_hotspot;
|
||||
}
|
||||
@@ -93,32 +104,40 @@ gdk_dnd_display_drag_cursor(gint x, gint y, gboolean drag_ok,
|
||||
{
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_ok);
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_default);
|
||||
GDK_NOTE(DND, g_print("Hiding both drag cursors\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(x == -1 && y == -1) /* We're supposed to find it out for ourselves */
|
||||
XQueryPointer(gdk_display, gdk_root_window,
|
||||
&wtmp, &wtmp, &x, &y, &itmp, &itmp, &masktmp);
|
||||
|
||||
|
||||
if(drag_ok)
|
||||
{
|
||||
GDK_NOTE(DND, g_print("Switching to drag_ok cursor\n"));
|
||||
mypix = gdk_dnd.c->drag_pm_ok;
|
||||
opix = gdk_dnd.c->drag_pm_default;
|
||||
myhotspot = &gdk_dnd.c->ok_hotspot;
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_NOTE(DND, g_print("Switching to drag_default cursor\n"));
|
||||
mypix = gdk_dnd.c->drag_pm_default;
|
||||
opix = gdk_dnd.c->drag_pm_ok;
|
||||
myhotspot = &gdk_dnd.c->default_hotspot;
|
||||
}
|
||||
gdk_window_move(mypix, x - myhotspot->x, y - myhotspot->y);
|
||||
if(change_made)
|
||||
{
|
||||
GDK_NOTE(DND, g_print("Cursors switched, hide & show\n"));
|
||||
gdk_window_hide(opix);
|
||||
gdk_window_show(mypix); /* There ought to be a way to know if
|
||||
a window is already mapped etc. */
|
||||
}
|
||||
gdk_window_move(mypix, x - myhotspot->x, y - myhotspot->y);
|
||||
if (change_made)
|
||||
{
|
||||
gdk_window_show(mypix); /* There ought to be a way to know if
|
||||
a window is already mapped etc. */
|
||||
}
|
||||
}
|
||||
else if(change_made)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
@@ -70,7 +71,10 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
|
||||
if (missing_charset_count)
|
||||
{
|
||||
g_print ("Missing charsets in FontSet creation");
|
||||
gint i;
|
||||
g_print ("Missing charsets in FontSet creation\n");
|
||||
for (i=0;i<missing_charset_count;i++)
|
||||
g_print (" %s\n", missing_charset_list[i]);
|
||||
XFreeStringList (missing_charset_list);
|
||||
}
|
||||
|
||||
@@ -83,13 +87,22 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
XFontSetExtents *extent = XExtentsOfFontSet(fontset);
|
||||
|
||||
gint num_fonts;
|
||||
gint i;
|
||||
XFontStruct **font_structs;
|
||||
gchar **font_names;
|
||||
|
||||
private->xfont = fontset;
|
||||
font->type = GDK_FONT_FONTSET;
|
||||
/* how to define ascent and descent for fontset ??? */
|
||||
font->ascent = extent->max_logical_extent.height;
|
||||
font->descent = font->ascent / 4 ;
|
||||
num_fonts = XFontsOfFontSet (fontset, &font_structs, &font_names);
|
||||
|
||||
font->ascent = font->descent = 0;
|
||||
|
||||
for (i = 0; i < num_fonts; i++)
|
||||
{
|
||||
font->ascent = MAX (font->ascent, font_structs[i]->ascent);
|
||||
font->descent = MAX (font->descent, font_structs[i]->descent);
|
||||
}
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
35
gdk/gdkgc.c
35
gdk/gdkgc.c
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <X11/Xlib.h>
|
||||
@@ -87,6 +88,18 @@ gdk_gc_new_with_values (GdkWindow *window,
|
||||
case GDK_XOR:
|
||||
xvalues.function = GXxor;
|
||||
break;
|
||||
case GDK_OR:
|
||||
xvalues.function = GXor;
|
||||
break;
|
||||
case GDK_AND:
|
||||
xvalues.function = GXand;
|
||||
break;
|
||||
case GDK_NOR:
|
||||
xvalues.function = GXnor;
|
||||
break;
|
||||
case GDK_NAND:
|
||||
xvalues.function = GXnand;
|
||||
break;
|
||||
}
|
||||
xvalues_mask |= GCFunction;
|
||||
}
|
||||
@@ -430,7 +443,7 @@ gdk_gc_set_function (GdkGC *gc,
|
||||
XSetFunction (private->xdisplay, private->xgc, GXinvert);
|
||||
break;
|
||||
case GDK_XOR:
|
||||
XSetFunction (private->xdisplay, private->xgc, GXor);
|
||||
XSetFunction (private->xdisplay, private->xgc, GXxor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -701,6 +714,22 @@ gdk_gc_set_line_attributes (GdkGC *gc,
|
||||
xline_style, xcap_style, xjoin_style);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gc_set_dashes (GdkGC *gc,
|
||||
gint dash_offset,
|
||||
gchar dash_list[],
|
||||
gint n)
|
||||
{
|
||||
GdkGCPrivate *private;
|
||||
|
||||
g_return_if_fail (gc != NULL);
|
||||
g_return_if_fail (dash_list != NULL);
|
||||
|
||||
private = (GdkGCPrivate*) gc;
|
||||
|
||||
XSetDashes (private->xdisplay, private->xgc, dash_offset, dash_list, n);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc)
|
||||
{
|
||||
|
||||
@@ -12,13 +12,15 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdktypes.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "../config.h"
|
||||
|
||||
guint gdk_debug_flags = 0;
|
||||
gint gdk_use_xshm = TRUE;
|
||||
@@ -34,7 +36,7 @@ Atom gdk_wm_protocols;
|
||||
Atom gdk_wm_window_protocols[2];
|
||||
Atom gdk_selection_property;
|
||||
GdkDndCursorInfo gdk_dnd_cursorinfo = {None, None, NULL, NULL,
|
||||
{0,0}, {0,0}};
|
||||
{0,0}, {0,0}, NULL};
|
||||
GdkDndGlobals gdk_dnd = {None,None,None,
|
||||
None,None,None,
|
||||
None,
|
||||
@@ -52,3 +54,13 @@ gint gdk_error_code;
|
||||
gint gdk_error_warnings = TRUE;
|
||||
gint gdk_null_window_warnings = TRUE;
|
||||
GList *gdk_default_filters = NULL;
|
||||
|
||||
gboolean gdk_using_threads = FALSE;
|
||||
|
||||
/* Used to signal the mainloop thread from its select() */
|
||||
#ifdef USE_PTHREADS
|
||||
gint gdk_threads_pipe[2];
|
||||
gboolean gdk_select_waiting = FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_I18N_H__
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "../config.h"
|
||||
|
||||
@@ -63,7 +64,7 @@ static GList *image_list = NULL;
|
||||
|
||||
|
||||
void
|
||||
gdk_image_exit ()
|
||||
gdk_image_exit (void)
|
||||
{
|
||||
GdkImage *image;
|
||||
|
||||
@@ -130,7 +131,7 @@ gdk_image_check_xshm(Display *display)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_image_init ()
|
||||
gdk_image_init (void)
|
||||
{
|
||||
if (gdk_use_xshm)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
@@ -69,7 +70,7 @@ static GList *gdk_input_windows;
|
||||
#include "gdkinputgxi.h"
|
||||
|
||||
GList *
|
||||
gdk_input_list_devices ()
|
||||
gdk_input_list_devices (void)
|
||||
{
|
||||
return gdk_input_devices;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_INPUT_H__
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if defined(XINPUT_GXI) || defined(XINPUT_XFREE)
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef XINPUT_GXI
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef XINPUT_NONE
|
||||
@@ -28,7 +29,7 @@ static void gdk_input_none_get_pointer (GdkWindow *window,
|
||||
GdkModifierType *mask);
|
||||
|
||||
void
|
||||
gdk_input_init ()
|
||||
gdk_input_init (void)
|
||||
{
|
||||
gdk_input_vtable.set_mode = NULL;
|
||||
gdk_input_vtable.set_axes = NULL;
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef XINPUT_XFREE
|
||||
@@ -21,7 +22,7 @@
|
||||
/* forward declarations */
|
||||
|
||||
static gint gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode);
|
||||
static void gdk_input_check_proximity();
|
||||
static void gdk_input_check_proximity (void);
|
||||
static void gdk_input_xfree_configure_event (XConfigureEvent *xevent,
|
||||
GdkWindow *window);
|
||||
static void gdk_input_xfree_enter_event (XCrossingEvent *xevent,
|
||||
@@ -114,7 +115,7 @@ gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_check_proximity()
|
||||
gdk_input_check_proximity (void)
|
||||
{
|
||||
gint new_proximity = 0;
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
|
||||
@@ -1,20 +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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#define GDK_VoidSymbol 0xFFFFFF
|
||||
#define GDK_BackSpace 0xFF08
|
||||
#define GDK_Tab 0xFF09
|
||||
@@ -27,6 +10,9 @@
|
||||
#define GDK_Escape 0xFF1B
|
||||
#define GDK_Delete 0xFFFF
|
||||
#define GDK_Multi_key 0xFF20
|
||||
#define GDK_SingleCandidate 0xFF3C
|
||||
#define GDK_MultipleCandidate 0xFF3D
|
||||
#define GDK_PreviousCandidate 0xFF3E
|
||||
#define GDK_Kanji 0xFF21
|
||||
#define GDK_Muhenkan 0xFF22
|
||||
#define GDK_Henkan_Mode 0xFF23
|
||||
@@ -44,6 +30,8 @@
|
||||
#define GDK_Kana_Shift 0xFF2E
|
||||
#define GDK_Eisu_Shift 0xFF2F
|
||||
#define GDK_Eisu_toggle 0xFF30
|
||||
#define GDK_Zen_Koho 0xFF3D
|
||||
#define GDK_Mae_Koho 0xFF3E
|
||||
#define GDK_Home 0xFF50
|
||||
#define GDK_Left 0xFF51
|
||||
#define GDK_Up 0xFF52
|
||||
@@ -233,11 +221,23 @@
|
||||
#define GDK_dead_iota 0xFE5D
|
||||
#define GDK_dead_voiced_sound 0xFE5E
|
||||
#define GDK_dead_semivoiced_sound 0xFE5F
|
||||
#define GDK_dead_belowdot 0xFE60
|
||||
#define GDK_First_Virtual_Screen 0xFED0
|
||||
#define GDK_Prev_Virtual_Screen 0xFED1
|
||||
#define GDK_Next_Virtual_Screen 0xFED2
|
||||
#define GDK_Last_Virtual_Screen 0xFED4
|
||||
#define GDK_Terminate_Server 0xFED5
|
||||
#define GDK_AccessX_Enable 0xFE70
|
||||
#define GDK_AccessX_Feedback_Enable 0xFE71
|
||||
#define GDK_RepeatKeys_Enable 0xFE72
|
||||
#define GDK_SlowKeys_Enable 0xFE73
|
||||
#define GDK_BounceKeys_Enable 0xFE74
|
||||
#define GDK_StickyKeys_Enable 0xFE75
|
||||
#define GDK_MouseKeys_Enable 0xFE76
|
||||
#define GDK_MouseKeys_Accel_Enable 0xFE77
|
||||
#define GDK_Overlay1_Enable 0xFE78
|
||||
#define GDK_Overlay2_Enable 0xFE79
|
||||
#define GDK_AudibleBell_Enable 0xFE7A
|
||||
#define GDK_Pointer_Left 0xFEE0
|
||||
#define GDK_Pointer_Right 0xFEE1
|
||||
#define GDK_Pointer_Up 0xFEE2
|
||||
@@ -263,6 +263,7 @@
|
||||
#define GDK_Pointer_Drag2 0xFEF6
|
||||
#define GDK_Pointer_Drag3 0xFEF7
|
||||
#define GDK_Pointer_Drag4 0xFEF8
|
||||
#define GDK_Pointer_Drag5 0xFEFD
|
||||
#define GDK_Pointer_EnableKeys 0xFEF9
|
||||
#define GDK_Pointer_Accelerate 0xFEFA
|
||||
#define GDK_Pointer_DfltBtnNext 0xFEFB
|
||||
|
||||
702
gdk/gdkpixmap.c
702
gdk/gdkpixmap.c
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "../config.h"
|
||||
#include <stdlib.h>
|
||||
@@ -44,6 +45,7 @@ gdk_pixmap_new (GdkWindow *window,
|
||||
GdkWindowPrivate *window_private;
|
||||
|
||||
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
|
||||
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
||||
|
||||
if (!window)
|
||||
window = (GdkWindow*) &gdk_root_parent;
|
||||
@@ -53,7 +55,7 @@ gdk_pixmap_new (GdkWindow *window,
|
||||
return NULL;
|
||||
|
||||
if (depth == -1)
|
||||
gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
|
||||
depth = gdk_window_get_visual (window)->depth;
|
||||
|
||||
private = g_new (GdkWindowPrivate, 1);
|
||||
pixmap = (GdkPixmap*) private;
|
||||
@@ -62,6 +64,7 @@ gdk_pixmap_new (GdkWindow *window,
|
||||
private->window_type = GDK_WINDOW_PIXMAP;
|
||||
private->xwindow = XCreatePixmap (private->xdisplay, window_private->xwindow,
|
||||
width, height, depth);
|
||||
private->colormap = NULL;
|
||||
private->parent = NULL;
|
||||
private->x = 0;
|
||||
private->y = 0;
|
||||
@@ -87,6 +90,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
|
||||
GdkWindowPrivate *window_private;
|
||||
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
||||
|
||||
if (!window)
|
||||
window = (GdkWindow*) &gdk_root_parent;
|
||||
@@ -135,6 +139,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
|
||||
g_return_val_if_fail (fg != NULL, NULL);
|
||||
g_return_val_if_fail (bg != NULL, NULL);
|
||||
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
|
||||
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
||||
|
||||
if (!window)
|
||||
window = (GdkWindow*) &gdk_root_parent;
|
||||
@@ -144,7 +149,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
|
||||
return NULL;
|
||||
|
||||
if (depth == -1)
|
||||
gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
|
||||
depth = gdk_window_get_visual (window)->depth;
|
||||
|
||||
private = g_new (GdkWindowPrivate, 1);
|
||||
pixmap = (GdkPixmap*) private;
|
||||
@@ -179,13 +184,13 @@ gdk_pixmap_seek_string (FILE *infile,
|
||||
|
||||
while (!feof (infile))
|
||||
{
|
||||
fscanf (infile, "%s", instr);
|
||||
fscanf (infile, "%1023s", instr);
|
||||
if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
|
||||
{
|
||||
fscanf (infile, "%s", instr);
|
||||
fscanf (infile, "%1023s", instr);
|
||||
while (!feof (infile) && strcmp (instr, "*/") != 0)
|
||||
fscanf (infile, "%s", instr);
|
||||
fscanf(infile, "%s", instr);
|
||||
fscanf (infile, "%1023s", instr);
|
||||
fscanf(infile, "%1023s", instr);
|
||||
}
|
||||
if (strcmp (instr, str)==0)
|
||||
return TRUE;
|
||||
@@ -198,29 +203,31 @@ gint
|
||||
gdk_pixmap_seek_char (FILE *infile,
|
||||
gchar c)
|
||||
{
|
||||
gchar b, oldb;
|
||||
gint b, oldb;
|
||||
|
||||
while (!feof (infile))
|
||||
while ((b = getc(infile)) != EOF)
|
||||
{
|
||||
fscanf(infile, "%c", &b);
|
||||
if (c != b && b == '/')
|
||||
{
|
||||
fscanf (infile, "%c", &b);
|
||||
if (b == '*')
|
||||
{
|
||||
oldb = b;
|
||||
while (!feof (infile) && !(oldb == '*' && b == '/'))
|
||||
{
|
||||
oldb = b;
|
||||
fscanf (infile, "%c", &b);
|
||||
}
|
||||
fscanf (infile, "%c", &b);
|
||||
}
|
||||
{
|
||||
b = getc (infile);
|
||||
if (b == EOF)
|
||||
return FALSE;
|
||||
else if (b == '*') /* we have a comment */
|
||||
{
|
||||
b = -1;
|
||||
do
|
||||
{
|
||||
oldb = b;
|
||||
b = getc (infile);
|
||||
if (b == EOF)
|
||||
return FALSE;
|
||||
}
|
||||
while (!(oldb == '*' && b == '/'));
|
||||
}
|
||||
}
|
||||
if (c == b)
|
||||
return TRUE;
|
||||
else if (c == b)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -229,42 +236,54 @@ gdk_pixmap_read_string (FILE *infile,
|
||||
gchar **buffer,
|
||||
guint *buffer_size)
|
||||
{
|
||||
gchar c;
|
||||
guint cnt = 0;
|
||||
gint c;
|
||||
guint cnt = 0, bufsiz, ret = FALSE;
|
||||
gchar *buf;
|
||||
|
||||
if ((*buffer) == NULL)
|
||||
buf = *buffer;
|
||||
bufsiz = *buffer_size;
|
||||
if (buf == NULL)
|
||||
{
|
||||
(*buffer_size) = 10 * sizeof (gchar);
|
||||
(*buffer) = (gchar *) malloc (*buffer_size);
|
||||
bufsiz = 10 * sizeof (gchar);
|
||||
buf = g_new(gchar, bufsiz);
|
||||
}
|
||||
|
||||
do
|
||||
fscanf (infile, "%c", &c);
|
||||
while (!feof (infile) && c != '"');
|
||||
c = getc (infile);
|
||||
while (c != EOF && c != '"');
|
||||
|
||||
if (c != '"')
|
||||
return FALSE;
|
||||
goto out;
|
||||
|
||||
while (!feof (infile))
|
||||
while ((c = getc(infile)) != EOF)
|
||||
{
|
||||
fscanf (infile, "%c", &c);
|
||||
|
||||
if (cnt == (*buffer_size))
|
||||
if (cnt == bufsiz)
|
||||
{
|
||||
(*buffer_size) *= 2;
|
||||
(*buffer) = (gchar *) realloc ((*buffer), *buffer_size);
|
||||
guint new_size = bufsiz * 2;
|
||||
if (new_size > bufsiz)
|
||||
bufsiz = new_size;
|
||||
else
|
||||
goto out;
|
||||
|
||||
buf = (gchar *) g_realloc (buf, bufsiz);
|
||||
buf[bufsiz-1] = '\0';
|
||||
}
|
||||
|
||||
if (c != '"')
|
||||
(*buffer)[cnt++] = c;
|
||||
buf[cnt++] = c;
|
||||
else
|
||||
{
|
||||
(*buffer)[cnt++] = 0;
|
||||
return TRUE;
|
||||
buf[cnt] = 0;
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
out:
|
||||
buf[bufsiz-1] = '\0'; /* ensure null termination for errors */
|
||||
*buffer = buf;
|
||||
*buffer_size = bufsiz;
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar*
|
||||
@@ -289,12 +308,16 @@ gdk_pixmap_skip_string (gchar *buffer)
|
||||
return &buffer[index];
|
||||
}
|
||||
|
||||
/* Xlib crashed ince at a color name lengths around 125 */
|
||||
#define MAX_COLOR_LEN 120
|
||||
|
||||
gchar*
|
||||
gdk_pixmap_extract_color (gchar *buffer)
|
||||
{
|
||||
gint counter, finished = FALSE, numnames;
|
||||
gint counter, numnames;
|
||||
gchar *ptr = NULL, ch, temp[128];
|
||||
gchar color[128], *retcol;
|
||||
gchar color[MAX_COLOR_LEN], *retcol;
|
||||
gint space;
|
||||
|
||||
counter = 0;
|
||||
while (ptr == NULL)
|
||||
@@ -311,9 +334,6 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
counter++;
|
||||
}
|
||||
|
||||
if (ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
ptr = gdk_pixmap_skip_whitespaces (ptr);
|
||||
|
||||
if (ptr[0] == 0)
|
||||
@@ -327,18 +347,26 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
color[0] = 0;
|
||||
numnames = 0;
|
||||
|
||||
while (finished == FALSE)
|
||||
space = MAX_COLOR_LEN - 1;
|
||||
while (space > 0)
|
||||
{
|
||||
sscanf (ptr, "%s", temp);
|
||||
sscanf (ptr, "%127s", temp);
|
||||
|
||||
if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
|
||||
strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)
|
||||
finished = TRUE;
|
||||
if (((gint)ptr[0] == 0) ||
|
||||
(strcmp ("s", temp) == 0) || (strcmp ("m", temp) == 0) ||
|
||||
(strcmp ("g", temp) == 0) || (strcmp ("g4", temp) == 0))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (numnames > 0)
|
||||
strcat (color, " ");
|
||||
strcat (color, temp);
|
||||
{
|
||||
space -= 1;
|
||||
strcat (color, " ");
|
||||
}
|
||||
strncat (color, temp, space);
|
||||
space -= MIN (space, strlen (temp));
|
||||
ptr = gdk_pixmap_skip_string (ptr);
|
||||
ptr = gdk_pixmap_skip_whitespaces (ptr);
|
||||
numnames++;
|
||||
@@ -349,6 +377,229 @@ 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
|
||||
{
|
||||
op_header,
|
||||
op_cmap,
|
||||
op_body
|
||||
};
|
||||
|
||||
|
||||
static GdkPixmap *
|
||||
_gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar * (*get_buf) (enum buffer_op op,
|
||||
gpointer handle),
|
||||
gpointer handle)
|
||||
{
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc = NULL;
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, n, ns, cnt, xcnt, ycnt, wbytes;
|
||||
gchar *buffer, pixel_str[32];
|
||||
_GdkPixmapColor *color = NULL, *fallbackcolor = NULL;
|
||||
gulong index;
|
||||
GHashTable *colors = NULL;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
buffer = (*get_buf) (op_header, handle);
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
||||
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
|
||||
if (cpp >= 32)
|
||||
{
|
||||
g_warning ("Pixmap has more than 31 characters per color\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
colors = 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 (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
|
||||
buffer = (*get_buf) (op_cmap, handle);
|
||||
if (buffer == NULL)
|
||||
goto error;
|
||||
|
||||
color = g_new (_GdkPixmapColor, 1);
|
||||
color->color_string = g_new (gchar, cpp + 1);
|
||||
strncpy (color->color_string, buffer, cpp);
|
||||
color->color_string[cpp] = 0;
|
||||
buffer += strlen (color->color_string);
|
||||
color->transparent = FALSE;
|
||||
|
||||
color_name = gdk_pixmap_extract_color (buffer);
|
||||
|
||||
if (color_name == NULL ||
|
||||
gdk_color_parse (color_name, &color->color) == FALSE)
|
||||
{
|
||||
color->color = *transparent_color;
|
||||
color->transparent = TRUE;
|
||||
}
|
||||
|
||||
g_free (color_name);
|
||||
|
||||
/* 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 (cnt == 0)
|
||||
fallbackcolor = color;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
|
||||
|
||||
if (mask)
|
||||
{
|
||||
/* The pixmap mask is just a bits pattern.
|
||||
* Color 0 is used for background and 1 for foreground.
|
||||
* We don't care about the colormap, we just need 0 and 1.
|
||||
*/
|
||||
GdkColor mask_pattern;
|
||||
|
||||
*mask = gdk_pixmap_new (window, width, height, 1);
|
||||
gc = gdk_gc_new (*mask);
|
||||
|
||||
mask_pattern.pixel = 0;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
|
||||
|
||||
mask_pattern.pixel = 1;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
}
|
||||
|
||||
wbytes = width * cpp;
|
||||
for (ycnt = 0; ycnt < height; ycnt++)
|
||||
{
|
||||
buffer = (*get_buf) (op_body, handle);
|
||||
|
||||
/* FIXME: this slows things down a little - it could be
|
||||
* integrated into the strncpy below, perhaps. OTOH, strlen
|
||||
* is fast.
|
||||
*/
|
||||
if ((buffer == NULL) || strlen (buffer) < wbytes)
|
||||
continue;
|
||||
|
||||
for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++)
|
||||
{
|
||||
strncpy (pixel_str, &buffer[n], cpp);
|
||||
pixel_str[cpp] = 0;
|
||||
ns = 0;
|
||||
|
||||
color = g_hash_table_lookup (colors, pixel_str);
|
||||
|
||||
if (!color) /* screwed up XPM file */
|
||||
color = fallbackcolor;
|
||||
|
||||
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
|
||||
|
||||
if (mask && color->transparent)
|
||||
{
|
||||
if (cnt < xcnt)
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
cnt = xcnt + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask && (cnt < xcnt))
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
}
|
||||
|
||||
error:
|
||||
|
||||
if (mask)
|
||||
gdk_gc_destroy (gc);
|
||||
|
||||
if (image != NULL)
|
||||
{
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
}
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
g_hash_table_foreach (colors, free_color, 0);
|
||||
g_hash_table_destroy (colors);
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
struct file_handle
|
||||
{
|
||||
FILE *infile;
|
||||
gchar *buffer;
|
||||
guint buffer_size;
|
||||
};
|
||||
|
||||
|
||||
static gchar *
|
||||
file_buffer (enum buffer_op op, gpointer handle)
|
||||
{
|
||||
struct file_handle *h = handle;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case op_header:
|
||||
if (gdk_pixmap_seek_string (h->infile, "XPM", FALSE) != TRUE)
|
||||
break;
|
||||
|
||||
if (gdk_pixmap_seek_char (h->infile,'{') != TRUE)
|
||||
break;
|
||||
/* Fall through to the next gdk_pixmap_seek_char. */
|
||||
|
||||
case op_cmap:
|
||||
gdk_pixmap_seek_char (h->infile, '"');
|
||||
fseek (h->infile, -1, SEEK_CUR);
|
||||
/* Fall through to the gdk_pixmap_read_string. */
|
||||
|
||||
case op_body:
|
||||
gdk_pixmap_read_string (h->infile, &h->buffer, &h->buffer_size);
|
||||
return h->buffer;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
|
||||
@@ -357,166 +608,18 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
FILE *infile = NULL;
|
||||
struct file_handle h;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt;
|
||||
gchar *buffer = NULL, pixel_str[32];
|
||||
guint buffer_size = 0;
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
memset (&h, 0, sizeof (h));
|
||||
h.infile = fopen (filename, "rb");
|
||||
if (h.infile != NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
infile = fopen (filename, "rb");
|
||||
if (infile != NULL)
|
||||
{
|
||||
if (gdk_pixmap_seek_string (infile, "XPM", FALSE) == TRUE)
|
||||
{
|
||||
if (gdk_pixmap_seek_char (infile,'{') == TRUE)
|
||||
{
|
||||
gdk_pixmap_seek_char (infile, '"');
|
||||
fseek (infile, -1, SEEK_CUR);
|
||||
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
|
||||
|
||||
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
transparent_color = &tmp_color;
|
||||
}
|
||||
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
|
||||
gdk_pixmap_seek_char (infile, '"');
|
||||
fseek (infile, -1, SEEK_CUR);
|
||||
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
|
||||
|
||||
colors[cnt].color_string = g_new(gchar, cpp + 1);
|
||||
for (n = 0; n < cpp; n++)
|
||||
colors[cnt].color_string[n] = buffer[n];
|
||||
colors[cnt].color_string[n] = 0;
|
||||
colors[cnt].transparent = FALSE;
|
||||
|
||||
color_name = gdk_pixmap_extract_color (&buffer[cpp]);
|
||||
|
||||
if (color_name != NULL)
|
||||
{
|
||||
if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
|
||||
g_free (color_name);
|
||||
|
||||
gdk_color_alloc (colormap, &colors[cnt].color);
|
||||
}
|
||||
|
||||
index = 0;
|
||||
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
|
||||
|
||||
gc = NULL;
|
||||
if (mask)
|
||||
{
|
||||
/* The pixmap mask is just a bits pattern.
|
||||
* Color 0 is used for background and 1 for foreground.
|
||||
* We don't care about the colormap, we just need 0 and 1.
|
||||
*/
|
||||
GdkColor mask_pattern;
|
||||
|
||||
*mask = gdk_pixmap_new (window, width, height, 1);
|
||||
gc = gdk_gc_new (*mask);
|
||||
|
||||
mask_pattern.pixel = 0;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
|
||||
|
||||
mask_pattern.pixel = 1;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
}
|
||||
|
||||
for (ycnt = 0; ycnt < height; ycnt++)
|
||||
{
|
||||
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
|
||||
|
||||
for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
|
||||
{
|
||||
strncpy (pixel_str, &buffer[n], cpp);
|
||||
pixel_str[cpp] = 0;
|
||||
color = NULL;
|
||||
ns = 0;
|
||||
|
||||
while (color == NULL)
|
||||
{
|
||||
if (strcmp (pixel_str, colors[ns].color_string) == 0)
|
||||
color = &colors[ns];
|
||||
else
|
||||
ns++;
|
||||
}
|
||||
|
||||
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
|
||||
|
||||
if (mask && color->transparent)
|
||||
{
|
||||
if (cnt < xcnt)
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
cnt = xcnt + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask && (cnt < xcnt))
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
gdk_gc_destroy (gc);
|
||||
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
}
|
||||
}
|
||||
|
||||
fclose (infile);
|
||||
free (buffer);
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
g_free (colors[cnt].color_string);
|
||||
g_free (colors);
|
||||
}
|
||||
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
|
||||
transparent_color,
|
||||
file_buffer, &h);
|
||||
fclose (h.infile);
|
||||
g_free (h.buffer);
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
@@ -528,11 +631,34 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
|
||||
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
|
||||
transparent_color, filename);
|
||||
}
|
||||
|
||||
|
||||
struct mem_handle
|
||||
{
|
||||
gchar **data;
|
||||
int offset;
|
||||
};
|
||||
|
||||
|
||||
static gchar *
|
||||
mem_buffer (enum buffer_op op, gpointer handle)
|
||||
{
|
||||
struct mem_handle *h = handle;
|
||||
switch (op)
|
||||
{
|
||||
case op_header:
|
||||
case op_cmap:
|
||||
case op_body:
|
||||
if (h->data[h->offset])
|
||||
return h->data[h->offset ++];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
@@ -540,152 +666,18 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
{
|
||||
struct mem_handle h;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i;
|
||||
gchar *buffer, pixel_str[32];
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
i = 0;
|
||||
buffer = data[i++];
|
||||
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
transparent_color = &tmp_color;
|
||||
}
|
||||
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
|
||||
buffer = data[i++];
|
||||
|
||||
colors[cnt].color_string = g_new(gchar, cpp + 1);
|
||||
for (n = 0; n < cpp; n++)
|
||||
colors[cnt].color_string[n] = buffer[n];
|
||||
colors[cnt].color_string[n] = 0;
|
||||
colors[cnt].transparent = FALSE;
|
||||
|
||||
color_name = gdk_pixmap_extract_color (&buffer[cpp]);
|
||||
|
||||
if (color_name != NULL)
|
||||
{
|
||||
if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
|
||||
g_free (color_name);
|
||||
|
||||
gdk_color_alloc (colormap, &colors[cnt].color);
|
||||
}
|
||||
|
||||
index = 0;
|
||||
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
|
||||
|
||||
gc = NULL;
|
||||
if (mask)
|
||||
{
|
||||
/* The pixmap mask is just a bits pattern.
|
||||
* Color 0 is used for background and 1 for foreground.
|
||||
* We don't care about the colormap, we just need 0 and 1.
|
||||
*/
|
||||
GdkColor mask_pattern;
|
||||
|
||||
*mask = gdk_pixmap_new (window, width, height, 1);
|
||||
gc = gdk_gc_new (*mask);
|
||||
|
||||
mask_pattern.pixel = 0;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
|
||||
|
||||
mask_pattern.pixel = 1;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
}
|
||||
|
||||
for (ycnt = 0; ycnt < height; ycnt++)
|
||||
{
|
||||
buffer = data[i++];
|
||||
|
||||
for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
|
||||
{
|
||||
strncpy (pixel_str, &buffer[n], cpp);
|
||||
pixel_str[cpp] = 0;
|
||||
color = NULL;
|
||||
ns = 0;
|
||||
|
||||
while (color == NULL)
|
||||
{
|
||||
if (strcmp (pixel_str, colors[ns].color_string) == 0)
|
||||
color = &colors[ns];
|
||||
else
|
||||
ns++;
|
||||
}
|
||||
|
||||
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
|
||||
|
||||
if (mask && color->transparent)
|
||||
{
|
||||
if (cnt < xcnt)
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
cnt = xcnt + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask && (cnt < xcnt))
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
gdk_gc_destroy (gc);
|
||||
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
g_free (colors[cnt].color_string);
|
||||
g_free (colors);
|
||||
}
|
||||
|
||||
memset (&h, 0, sizeof (h));
|
||||
h.data = data;
|
||||
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
|
||||
transparent_color,
|
||||
mem_buffer, &h);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GDK_PRIVATE_H__
|
||||
#define __GDK_PRIVATE_H__
|
||||
@@ -80,6 +81,8 @@ struct _GdkWindowPrivate
|
||||
gint extension_events;
|
||||
|
||||
GList *filters;
|
||||
GdkColormap *colormap;
|
||||
GList *children;
|
||||
};
|
||||
|
||||
struct _GdkImagePrivate
|
||||
@@ -146,6 +149,7 @@ struct _GdkDndCursorInfo {
|
||||
Cursor gdk_cursor_dragdefault, gdk_cursor_dragok;
|
||||
GdkWindow *drag_pm_default, *drag_pm_ok;
|
||||
GdkPoint default_hotspot, ok_hotspot;
|
||||
GList *xids;
|
||||
};
|
||||
typedef struct _GdkDndCursorInfo GdkDndCursorInfo;
|
||||
|
||||
@@ -238,8 +242,8 @@ void gdk_dnd_display_drag_cursor(gint x,
|
||||
gboolean change_made);
|
||||
|
||||
/* Please see gdkwindow.c for comments on how to use */
|
||||
Window gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y);
|
||||
Window gdk_window_xid_at_coords(gint x, gint y, GList *excludes);
|
||||
Window gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y, GList *excludes, gboolean excl_child);
|
||||
Window gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child);
|
||||
|
||||
extern gint gdk_debug_level;
|
||||
extern gint gdk_show_events;
|
||||
@@ -264,6 +268,13 @@ extern gint gdk_error_code;
|
||||
extern gint gdk_error_warnings;
|
||||
extern gint gdk_null_window_warnings;
|
||||
extern GList *gdk_default_filters;
|
||||
extern gboolean gdk_using_threads;
|
||||
|
||||
/* Threading stuff */
|
||||
#ifdef USE_PTHREADS
|
||||
extern gint gdk_threads_pipe[2];
|
||||
extern gboolean gdk_select_waiting;
|
||||
#endif
|
||||
|
||||
/* Debugging support */
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "gdk.h"
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
@@ -118,6 +119,39 @@ gdk_region_rect_in (GdkRegion *region,
|
||||
return GDK_OVERLAP_RECTANGLE_OUT; /*what else ? */
|
||||
}
|
||||
|
||||
GdkRegion *
|
||||
gdk_region_polygon (GdkPoint *points,
|
||||
gint npoints,
|
||||
GdkFillRule fill_rule)
|
||||
{
|
||||
GdkRegionPrivate *private;
|
||||
GdkRegion *region;
|
||||
Region xregion;
|
||||
gint xfill_rule = EvenOddRule;
|
||||
|
||||
g_return_val_if_fail (points != NULL, NULL);
|
||||
g_return_val_if_fail (npoints != 0, NULL); /* maybe we should check for at least three points */
|
||||
|
||||
switch (fill_rule)
|
||||
{
|
||||
case GDK_EVEN_ODD_RULE:
|
||||
xfill_rule = EvenOddRule;
|
||||
break;
|
||||
|
||||
case GDK_WINDING_RULE:
|
||||
xfill_rule = WindingRule;
|
||||
break;
|
||||
}
|
||||
|
||||
xregion = XPolygonRegion ((XPoint *) points, npoints, xfill_rule);
|
||||
private = g_new (GdkRegionPrivate, 1);
|
||||
private->xregion = xregion;
|
||||
region = (GdkRegion *) private;
|
||||
region->user_data = NULL;
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_region_offset (GdkRegion *region,
|
||||
gint dx,
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GDK_TYPES_H__
|
||||
#define __GDK_TYPES_H__
|
||||
@@ -110,6 +111,7 @@ typedef void* GdkIM;
|
||||
* and pixmaps transparently. (ie. You shouldn't pass a
|
||||
* pixmap to any procedure which accepts a window with the
|
||||
* exception of the drawing functions).
|
||||
* Foreign: A window that actually belongs to another application
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
@@ -118,7 +120,8 @@ typedef enum
|
||||
GDK_WINDOW_CHILD,
|
||||
GDK_WINDOW_DIALOG,
|
||||
GDK_WINDOW_TEMP,
|
||||
GDK_WINDOW_PIXMAP
|
||||
GDK_WINDOW_PIXMAP,
|
||||
GDK_WINDOW_FOREIGN
|
||||
} GdkWindowType;
|
||||
|
||||
/* Classes of windows.
|
||||
@@ -217,9 +220,13 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_COPY,
|
||||
GDK_INVERT,
|
||||
GDK_XOR
|
||||
GDK_COPY,
|
||||
GDK_INVERT,
|
||||
GDK_XOR,
|
||||
GDK_OR,
|
||||
GDK_AND,
|
||||
GDK_NOR,
|
||||
GDK_NAND
|
||||
} GdkFunction;
|
||||
|
||||
/* GC fill types.
|
||||
@@ -236,6 +243,16 @@ typedef enum
|
||||
GDK_OPAQUE_STIPPLED
|
||||
} GdkFill;
|
||||
|
||||
/* GC fill rule for polygons
|
||||
* EvenOddRule
|
||||
* WindingRule
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_EVEN_ODD_RULE,
|
||||
GDK_WINDING_RULE
|
||||
} GdkFillRule;
|
||||
|
||||
/* GC line styles
|
||||
* Solid:
|
||||
* OnOffDash:
|
||||
@@ -670,7 +687,8 @@ struct _GdkColor
|
||||
*/
|
||||
struct _GdkColormap
|
||||
{
|
||||
GdkColor colors[256];
|
||||
gint size;
|
||||
GdkColor *colors;
|
||||
};
|
||||
|
||||
/* The visual type.
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
@@ -40,7 +41,9 @@ static gint navailable_depths;
|
||||
static GdkVisualType available_types[6];
|
||||
static gint navailable_types;
|
||||
|
||||
static char* visual_names[] =
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static gchar* visual_names[] =
|
||||
{
|
||||
"static gray",
|
||||
"grayscale",
|
||||
@@ -50,10 +53,12 @@ static char* visual_names[] =
|
||||
"direct color",
|
||||
};
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
static GHashTable *visual_hash = NULL;
|
||||
|
||||
void
|
||||
gdk_visual_init ()
|
||||
gdk_visual_init (void)
|
||||
{
|
||||
static gint possible_depths[6] = { 32, 24, 16, 15, 8, 1 };
|
||||
static GdkVisualType possible_types[6] =
|
||||
@@ -204,7 +209,7 @@ gdk_visual_init ()
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_debug_flags & GDK_DEBUG_MISC)
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
g_print ("visual: %s: %d\n",
|
||||
g_print ("Gdk: visual: %s: %d\n",
|
||||
visual_names[visuals[i].visual.type],
|
||||
visuals[i].visual.depth);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
@@ -258,25 +263,25 @@ gdk_visual_unref (GdkVisual *visual)
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_visual_get_best_depth ()
|
||||
gdk_visual_get_best_depth (void)
|
||||
{
|
||||
return available_depths[0];
|
||||
}
|
||||
|
||||
GdkVisualType
|
||||
gdk_visual_get_best_type ()
|
||||
gdk_visual_get_best_type (void)
|
||||
{
|
||||
return available_types[0];
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_system ()
|
||||
gdk_visual_get_system (void)
|
||||
{
|
||||
return ((GdkVisual*) system_visual);
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best ()
|
||||
gdk_visual_get_best (void)
|
||||
{
|
||||
return ((GdkVisual*) &(visuals[0]));
|
||||
}
|
||||
@@ -350,12 +355,17 @@ gdk_query_visual_types (GdkVisualType **visual_types,
|
||||
*visual_types = available_types;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_query_visuals (GdkVisual **visual_return,
|
||||
gint *count)
|
||||
GList*
|
||||
gdk_list_visuals (void)
|
||||
{
|
||||
*count = nvisuals;
|
||||
*visual_return = (GdkVisual*) visuals;
|
||||
GList *list;
|
||||
guint i;
|
||||
|
||||
list = NULL;
|
||||
for (i = 0; i < nvisuals; ++i)
|
||||
list = g_list_append (list, (gpointer) &visuals[i]);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
406
gdk/gdkwindow.c
406
gdk/gdkwindow.c
@@ -12,13 +12,14 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <netinet/in.h>
|
||||
#include "gdk.h"
|
||||
#include "../config.h"
|
||||
@@ -28,6 +29,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
int nevent_masks = 17;
|
||||
int event_mask_table[19] =
|
||||
{
|
||||
@@ -55,14 +60,17 @@ int event_mask_table[19] =
|
||||
|
||||
/* internal function created for and used by gdk_window_xid_at_coords */
|
||||
Window
|
||||
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
|
||||
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y,
|
||||
GList *excludes, gboolean excl_child)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *private;
|
||||
Display *disp;
|
||||
Window *list=NULL;
|
||||
Window child=0,parent_win=0,root_win=0;
|
||||
unsigned int num,i,ww,wh,wb,wd;
|
||||
|
||||
int i;
|
||||
unsigned int ww, wh, wb, wd, num;
|
||||
int wx,wy;
|
||||
|
||||
window=(GdkWindow*)&gdk_root_parent;
|
||||
@@ -71,22 +79,27 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
|
||||
if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd))
|
||||
return 0;
|
||||
wx+=bx;wy+=by;
|
||||
if (!((x>=wx)&&(y>=wy)&&(x<(wx+ww))&&(y<(wy+wh))))
|
||||
if (!((x>=wx)&&(y>=wy)&&(x<(int)(wx+ww))&&(y<(int)(wy+wh))))
|
||||
return 0;
|
||||
if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
|
||||
return base;
|
||||
if (list)
|
||||
{
|
||||
for (i=num-1;i>=0;i--)
|
||||
for (i=num-1;;i--)
|
||||
{
|
||||
if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0)
|
||||
if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i])))
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
if ((child=gdk_window_xid_at(list[i],wx,wy,x,y,excludes,excl_child))!=0)
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
if (!i) break;
|
||||
}
|
||||
XFree(list);
|
||||
}
|
||||
return 0;
|
||||
return base;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -103,48 +116,66 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
|
||||
* those X,Y co-ordinates.
|
||||
*/
|
||||
Window
|
||||
gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
|
||||
gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *private;
|
||||
Display *disp;
|
||||
Window *list=NULL;
|
||||
Window root,child=0,parent_win=0,root_win=0;
|
||||
unsigned int num,i;
|
||||
unsigned int num;
|
||||
int i;
|
||||
|
||||
window=(GdkWindow*)&gdk_root_parent;
|
||||
private=(GdkWindowPrivate*)window;
|
||||
disp=private->xdisplay;
|
||||
root=private->xwindow;
|
||||
XGrabServer(disp);
|
||||
num=g_list_length(excludes);
|
||||
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
|
||||
return root;
|
||||
return root;
|
||||
if (list)
|
||||
{
|
||||
for (i=num-1;i>=0;i--)
|
||||
{
|
||||
if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0)
|
||||
{
|
||||
if (excludes)
|
||||
{
|
||||
if (!g_list_find(excludes,(gpointer)child))
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = num - 1;
|
||||
do
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
|
||||
XGetWindowAttributes (disp, list [i], &xwa);
|
||||
|
||||
if (xwa.map_state != IsViewable)
|
||||
continue;
|
||||
|
||||
if (excl_child && g_list_find(excludes,(gpointer *)list[i]))
|
||||
continue;
|
||||
|
||||
if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0)
|
||||
continue;
|
||||
|
||||
if (excludes)
|
||||
{
|
||||
if (!g_list_find(excludes,(gpointer *)child))
|
||||
{
|
||||
XFree(list);
|
||||
XUngrabServer(disp);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XFree(list);
|
||||
XUngrabServer(disp);
|
||||
return child;
|
||||
}
|
||||
} while (--i > 0);
|
||||
XFree(list);
|
||||
}
|
||||
XUngrabServer(disp);
|
||||
return root;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_init ()
|
||||
gdk_window_init (void)
|
||||
{
|
||||
XWindowAttributes xattributes;
|
||||
unsigned int width;
|
||||
@@ -163,6 +194,8 @@ gdk_window_init ()
|
||||
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;
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
@@ -174,7 +207,6 @@ gdk_window_new (GdkWindow *parent,
|
||||
GdkWindowPrivate *private;
|
||||
GdkWindowPrivate *parent_private;
|
||||
GdkVisual *visual;
|
||||
GdkColormap *colormap;
|
||||
Display *parent_display;
|
||||
Window xparent;
|
||||
Visual *xvisual;
|
||||
@@ -204,6 +236,10 @@ gdk_window_new (GdkWindow *parent,
|
||||
window = (GdkWindow*) private;
|
||||
|
||||
private->parent = parent;
|
||||
|
||||
if (parent_private)
|
||||
parent_private->children = g_list_prepend (parent_private->children, window);
|
||||
|
||||
private->xdisplay = parent_display;
|
||||
private->destroyed = FALSE;
|
||||
private->resize_count = 0;
|
||||
@@ -236,6 +272,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
|
||||
|
||||
private->filters = NULL;
|
||||
private->children = NULL;
|
||||
|
||||
window->user_data = NULL;
|
||||
|
||||
@@ -268,9 +305,9 @@ gdk_window_new (GdkWindow *parent,
|
||||
depth = visual->depth;
|
||||
|
||||
if (attributes_mask & GDK_WA_COLORMAP)
|
||||
colormap = attributes->colormap;
|
||||
private->colormap = attributes->colormap;
|
||||
else
|
||||
colormap = gdk_colormap_get_system ();
|
||||
private->colormap = gdk_colormap_get_system ();
|
||||
|
||||
xattributes.background_pixel = BlackPixel (gdk_display, gdk_screen);
|
||||
xattributes.border_pixel = BlackPixel (gdk_display, gdk_screen);
|
||||
@@ -279,26 +316,26 @@ gdk_window_new (GdkWindow *parent,
|
||||
switch (private->window_type)
|
||||
{
|
||||
case GDK_WINDOW_TOPLEVEL:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
|
||||
xparent = gdk_root_window;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_CHILD:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_DIALOG:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
|
||||
xparent = gdk_root_window;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_TEMP:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
|
||||
xparent = gdk_root_window;
|
||||
@@ -320,7 +357,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
{
|
||||
depth = 0;
|
||||
class = InputOnly;
|
||||
colormap = NULL;
|
||||
private->colormap = NULL;
|
||||
}
|
||||
|
||||
private->xwindow = XCreateWindow (private->xdisplay, xparent,
|
||||
@@ -330,6 +367,13 @@ gdk_window_new (GdkWindow *parent,
|
||||
gdk_window_ref (window);
|
||||
gdk_xid_table_insert (&private->xwindow, window);
|
||||
|
||||
if (private->colormap)
|
||||
gdk_colormap_ref (private->colormap);
|
||||
|
||||
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
|
||||
(attributes->cursor) :
|
||||
NULL));
|
||||
|
||||
switch (private->window_type)
|
||||
{
|
||||
case GDK_WINDOW_DIALOG:
|
||||
@@ -340,29 +384,34 @@ gdk_window_new (GdkWindow *parent,
|
||||
break;
|
||||
case GDK_WINDOW_CHILD:
|
||||
if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
|
||||
(colormap != gdk_colormap_get_system ()) &&
|
||||
(colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
|
||||
(private->colormap != gdk_colormap_get_system ()) &&
|
||||
(private->colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
|
||||
{
|
||||
g_print ("adding colormap window\n");
|
||||
GDK_NOTE (MISC, g_print ("adding colormap window\n"));
|
||||
gdk_window_add_colormap_windows (window);
|
||||
}
|
||||
break;
|
||||
|
||||
return window;
|
||||
default:
|
||||
break;
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
size_hints.flags = PSize | PBaseSize;
|
||||
size_hints.flags = PSize;
|
||||
size_hints.width = private->width;
|
||||
size_hints.height = private->height;
|
||||
size_hints.base_width = private->width;
|
||||
size_hints.base_height = private->height;
|
||||
|
||||
wm_hints.flags = InputHint | StateHint | WindowGroupHint;
|
||||
wm_hints.window_group = gdk_leader_window;
|
||||
wm_hints.input = True;
|
||||
wm_hints.initial_state = NormalState;
|
||||
|
||||
/* FIXME: Is there any point in doing this? Do any WM's pay
|
||||
* attention to PSize, and even if they do, is this the
|
||||
* correct value???
|
||||
*/
|
||||
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
|
||||
|
||||
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
|
||||
|
||||
if (attributes_mask & GDK_WA_TITLE)
|
||||
@@ -384,9 +433,6 @@ gdk_window_new (GdkWindow *parent,
|
||||
XFree (class_hint);
|
||||
}
|
||||
|
||||
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
|
||||
(attributes->cursor) :
|
||||
NULL));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -396,14 +442,28 @@ gdk_window_foreign_new (guint32 anid)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *private;
|
||||
GdkWindowPrivate *parent_private;
|
||||
XWindowAttributes attrs;
|
||||
Window root, parent;
|
||||
Window *children;
|
||||
guint nchildren;
|
||||
|
||||
private = g_new (GdkWindowPrivate, 1);
|
||||
window = (GdkWindow*) private;
|
||||
|
||||
XGetWindowAttributes (gdk_display, anid, &attrs);
|
||||
|
||||
private->parent = NULL;
|
||||
/* FIXME: This is pretty expensive. Maybe the caller should supply
|
||||
* the parent */
|
||||
XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren);
|
||||
XFree (children);
|
||||
private->parent = gdk_xid_table_lookup (parent);
|
||||
|
||||
parent_private = (GdkWindowPrivate *)private->parent;
|
||||
|
||||
if (parent_private)
|
||||
parent_private->children = g_list_prepend (parent_private->children, window);
|
||||
|
||||
private->xwindow = anid;
|
||||
private->xdisplay = gdk_display;
|
||||
private->x = attrs.x;
|
||||
@@ -412,16 +472,23 @@ gdk_window_foreign_new (guint32 anid)
|
||||
private->height = attrs.height;
|
||||
private->resize_count = 0;
|
||||
private->ref_count = 1;
|
||||
if (anid == attrs.root)
|
||||
private->window_type = GDK_WINDOW_ROOT;
|
||||
else
|
||||
private->window_type = GDK_WINDOW_TOPLEVEL;
|
||||
/* the above is probably wrong, but it may not be worth the extra
|
||||
X call to get it right */
|
||||
|
||||
private->window_type = GDK_WINDOW_FOREIGN;
|
||||
private->destroyed = FALSE;
|
||||
private->extension_events = 0;
|
||||
|
||||
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;
|
||||
|
||||
window->user_data = NULL;
|
||||
|
||||
@@ -438,7 +505,8 @@ gdk_window_foreign_new (guint32 anid)
|
||||
window. */
|
||||
|
||||
static void
|
||||
gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
gdk_window_internal_destroy (GdkWindow *window, gboolean xdestroy,
|
||||
gboolean our_destroy)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
GdkWindowPrivate *temp_private;
|
||||
@@ -456,22 +524,34 @@ gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
case GDK_WINDOW_CHILD:
|
||||
case GDK_WINDOW_DIALOG:
|
||||
case GDK_WINDOW_TEMP:
|
||||
case GDK_WINDOW_FOREIGN:
|
||||
if (!private->destroyed)
|
||||
{
|
||||
children = gdk_window_get_children (window);
|
||||
tmp = children;
|
||||
|
||||
while (tmp)
|
||||
if (private->parent)
|
||||
{
|
||||
temp_window = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
temp_private = (GdkWindowPrivate*) temp_window;
|
||||
if (temp_private)
|
||||
gdk_window_internal_destroy (temp_window, FALSE);
|
||||
GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;
|
||||
if (parent_private->children)
|
||||
parent_private->children = g_list_remove (parent_private->children, window);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
if (private->window_type != GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
children = tmp = private->children;
|
||||
private->children = NULL;
|
||||
|
||||
while (tmp)
|
||||
{
|
||||
temp_window = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
temp_private = (GdkWindowPrivate*) temp_window;
|
||||
if (temp_private)
|
||||
gdk_window_internal_destroy (temp_window, FALSE,
|
||||
our_destroy);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
if (private->extension_events != 0)
|
||||
gdk_input_window_destroy (window);
|
||||
@@ -487,8 +567,50 @@ gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
private->dnd_drop_data_typesavail = NULL;
|
||||
}
|
||||
|
||||
if (xdestroy)
|
||||
if (private->filters)
|
||||
{
|
||||
tmp = private->filters;
|
||||
|
||||
while (tmp)
|
||||
{
|
||||
g_free (tmp->data);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
g_list_free (private->filters);
|
||||
private->filters = NULL;
|
||||
}
|
||||
|
||||
if (private->window_type == GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
if (our_destroy && (private->parent != NULL))
|
||||
{
|
||||
/* It's somebody elses window, but in our heirarchy,
|
||||
* so reparent it to the root window, and then send
|
||||
* it a delete event, as if we were a WM
|
||||
*/
|
||||
XClientMessageEvent xevent;
|
||||
|
||||
gdk_window_hide (window);
|
||||
gdk_window_reparent (window, NULL, 0, 0);
|
||||
|
||||
xevent.type = ClientMessage;
|
||||
xevent.window = private->xwindow;
|
||||
xevent.message_type = gdk_wm_protocols;
|
||||
xevent.format = 32;
|
||||
xevent.data.l[0] = gdk_wm_delete_window;
|
||||
xevent.data.l[1] = CurrentTime;
|
||||
|
||||
XSendEvent (private->xdisplay, private->xwindow,
|
||||
False, 0, (XEvent *)&xevent);
|
||||
}
|
||||
}
|
||||
else if (xdestroy)
|
||||
XDestroyWindow (private->xdisplay, private->xwindow);
|
||||
|
||||
if (private->colormap)
|
||||
gdk_colormap_unref (private->colormap);
|
||||
|
||||
private->destroyed = TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -509,7 +631,7 @@ gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
void
|
||||
gdk_window_destroy (GdkWindow *window)
|
||||
{
|
||||
gdk_window_internal_destroy (window, TRUE);
|
||||
gdk_window_internal_destroy (window, TRUE, TRUE);
|
||||
gdk_window_unref (window);
|
||||
}
|
||||
|
||||
@@ -524,6 +646,14 @@ gdk_window_destroy_notify (GdkWindow *window)
|
||||
|
||||
private = (GdkWindowPrivate*) window;
|
||||
|
||||
if (!private->destroyed)
|
||||
{
|
||||
if (private->window_type == GDK_WINDOW_FOREIGN)
|
||||
gdk_window_internal_destroy (window, FALSE, FALSE);
|
||||
else
|
||||
g_warning ("GdkWindow %#lx unexpectedly destroyed", private->xwindow);
|
||||
}
|
||||
|
||||
gdk_xid_table_remove (private->xwindow);
|
||||
gdk_window_unref (window);
|
||||
}
|
||||
@@ -959,6 +1089,11 @@ gdk_window_set_colormap (GdkWindow *window,
|
||||
XSetWindowColormap (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
colormap_private->xcolormap);
|
||||
|
||||
if (window_private->colormap)
|
||||
gdk_colormap_unref (window_private->colormap);
|
||||
window_private->colormap = colormap;
|
||||
gdk_colormap_ref (window_private->colormap);
|
||||
|
||||
if (window_private->window_type != GDK_WINDOW_TOPLEVEL)
|
||||
gdk_window_add_colormap_windows (window);
|
||||
@@ -1053,20 +1188,27 @@ gdk_window_get_visual (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
XWindowAttributes window_attributes;
|
||||
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
|
||||
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
/* Huh? ->parent is never set for a pixmap. We should just return
|
||||
* null immeditately
|
||||
*/
|
||||
while (window_private && (window_private->window_type == GDK_WINDOW_PIXMAP))
|
||||
window_private = (GdkWindowPrivate*) window_private->parent;
|
||||
|
||||
if (window_private && !window_private->destroyed)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
|
||||
return gdk_visual_lookup (window_attributes.visual);
|
||||
if (window_private->colormap == NULL)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
return gdk_visual_lookup (window_attributes.visual);
|
||||
}
|
||||
else
|
||||
return ((GdkColormapPrivate *)window_private->colormap)->visual;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1079,16 +1221,20 @@ gdk_window_get_colormap (GdkWindow *window)
|
||||
XWindowAttributes window_attributes;
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
|
||||
|
||||
g_return_val_if_fail (window_private->window_type != GDK_WINDOW_PIXMAP, NULL);
|
||||
if (!window_private->destroyed)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
|
||||
return gdk_colormap_lookup (window_attributes.colormap);
|
||||
if (window_private->colormap == NULL)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
return gdk_colormap_lookup (window_attributes.colormap);
|
||||
}
|
||||
else
|
||||
return window_private->colormap;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1336,8 +1482,7 @@ gdk_window_add_colormap_windows (GdkWindow *window)
|
||||
|
||||
/*
|
||||
* This needs the X11 shape extension.
|
||||
* If not available, simply remove the call to
|
||||
* XShapeCombineMask. Shaped windows will look
|
||||
* If not available, shaped windows will look
|
||||
* ugly, but programs still work. Stefan Wille
|
||||
*/
|
||||
void
|
||||
@@ -1345,35 +1490,53 @@ 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);
|
||||
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (mask)
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
if (have_shape == UNKNOWN)
|
||||
{
|
||||
GdkWindowPrivate *pixmap_private;
|
||||
|
||||
pixmap_private = (GdkWindowPrivate*) mask;
|
||||
pixmap = (Pixmap) pixmap_private->xwindow;
|
||||
int ignore;
|
||||
if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
|
||||
have_shape = YES;
|
||||
else
|
||||
have_shape = NO;
|
||||
}
|
||||
else
|
||||
|
||||
if (have_shape == YES)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
pixmap = None;
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (mask)
|
||||
{
|
||||
GdkWindowPrivate *pixmap_private;
|
||||
|
||||
pixmap_private = (GdkWindowPrivate*) mask;
|
||||
pixmap = (Pixmap) pixmap_private->xwindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
pixmap = None;
|
||||
}
|
||||
|
||||
XShapeCombineMask (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
ShapeBounding,
|
||||
x, y,
|
||||
pixmap,
|
||||
ShapeSet);
|
||||
}
|
||||
|
||||
XShapeCombineMask (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
ShapeBounding,
|
||||
x, y,
|
||||
pixmap,
|
||||
ShapeSet);
|
||||
#endif /* HAVE_SHAPE_EXT */
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1553,7 +1716,7 @@ gdk_window_dnd_data_set (GdkWindow *window,
|
||||
sev.xclient.data.l[4] = event->dragrequest.timestamp;
|
||||
|
||||
if (!gdk_send_xevent (event->dragrequest.requestor, False,
|
||||
NoEventMask, &sev))
|
||||
StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
|
||||
event->dragrequest.requestor));
|
||||
|
||||
@@ -1732,7 +1895,7 @@ gdk_window_set_group (GdkWindow *window,
|
||||
return;
|
||||
|
||||
private = (GdkWindowPrivate *)leader;
|
||||
wm_hints.flags |= WindowGroupHint;
|
||||
wm_hints.flags = WindowGroupHint;
|
||||
wm_hints.window_group = private->xwindow;
|
||||
|
||||
XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
|
||||
@@ -1812,3 +1975,20 @@ gdk_window_set_functions (GdkWindow *window,
|
||||
|
||||
gdk_window_set_mwm_hints (window, &hints);
|
||||
}
|
||||
|
||||
GList *
|
||||
gdk_window_get_toplevels (void)
|
||||
{
|
||||
GList *new_list = NULL;
|
||||
GList *tmp_list;
|
||||
|
||||
tmp_list = gdk_root_parent.children;
|
||||
while (tmp_list)
|
||||
{
|
||||
new_list = g_list_prepend (new_list, tmp_list->data);
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
return new_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GDK_X_H__
|
||||
#define __GDK_X_H__
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "gdkprivate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
47
gdk/gxid.c
47
gdk/gxid.c
@@ -61,7 +61,7 @@ handler(int signal)
|
||||
}
|
||||
|
||||
void
|
||||
init_socket()
|
||||
init_socket(void)
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
|
||||
@@ -130,7 +130,7 @@ enable_device(GxidDevice *dev)
|
||||
/* switch the core pointer from whatever it is now to something else,
|
||||
return true on success, false otherwise */
|
||||
static int
|
||||
switch_core_pointer()
|
||||
switch_core_pointer(void)
|
||||
{
|
||||
GxidDevice *old_pointer = 0;
|
||||
GxidDevice *new_pointer = 0;
|
||||
@@ -222,7 +222,7 @@ init_device(XDeviceInfo *xdevice)
|
||||
}
|
||||
|
||||
void
|
||||
init_xinput()
|
||||
init_xinput(void)
|
||||
{
|
||||
char **extensions;
|
||||
XDeviceInfo *xdevices;
|
||||
@@ -279,12 +279,22 @@ int
|
||||
handle_claim_device(GxidClaimDevice *msg)
|
||||
{
|
||||
int i,j;
|
||||
XID devid = ntohl(msg->device);
|
||||
XID winid = ntohl(msg->window);
|
||||
int exclusive = ntohl(msg->exclusive);
|
||||
XID devid;
|
||||
XID winid;
|
||||
int exclusive;
|
||||
GxidDevice *device = NULL;
|
||||
GxidWindow *window = NULL;
|
||||
|
||||
if (msg->length != sizeof(GxidClaimDevice))
|
||||
{
|
||||
fprintf(stderr,"Bad length for ClaimDevice message\n");
|
||||
return GXID_RETURN_ERROR;
|
||||
}
|
||||
|
||||
devid = ntohl(msg->device);
|
||||
winid = ntohl(msg->window);
|
||||
exclusive = ntohl(msg->exclusive);
|
||||
|
||||
#ifdef DEBUG_CLIENTS
|
||||
fprintf(stderr,"device %ld claimed (window 0x%lx)\n",devid,winid);
|
||||
#endif
|
||||
@@ -397,11 +407,20 @@ int
|
||||
handle_release_device(GxidReleaseDevice *msg)
|
||||
{
|
||||
int i,j;
|
||||
XID devid = ntohl(msg->device);
|
||||
XID winid = ntohl(msg->window);
|
||||
XID devid;
|
||||
XID winid;
|
||||
|
||||
GxidDevice *device = NULL;
|
||||
|
||||
if (msg->length != sizeof(GxidReleaseDevice))
|
||||
{
|
||||
fprintf(stderr,"Bad length for ReleaseDevice message\n");
|
||||
return GXID_RETURN_ERROR;
|
||||
}
|
||||
|
||||
devid = ntohl(msg->device);
|
||||
winid = ntohl(msg->window);
|
||||
|
||||
#ifdef DEBUG_CLIENTS
|
||||
fprintf(stderr,"device %ld released (window 0x%lx)\n",devid,winid);
|
||||
#endif
|
||||
@@ -460,11 +479,11 @@ handle_release_device(GxidReleaseDevice *msg)
|
||||
}
|
||||
|
||||
void
|
||||
handle_connection()
|
||||
handle_connection (void)
|
||||
{
|
||||
GxidMessage msg;
|
||||
GxidU32 type;
|
||||
int length;
|
||||
GxidU32 length;
|
||||
GxidI32 retval;
|
||||
|
||||
int conn_fd;
|
||||
@@ -496,7 +515,7 @@ handle_connection()
|
||||
|
||||
/* read rest of message */
|
||||
|
||||
if (length > sizeof(GxidMessage))
|
||||
if ((length > sizeof(GxidMessage)) || (length < 2*sizeof(GxidU32)))
|
||||
{
|
||||
fprintf(stderr,"%s: Bad message length\n",
|
||||
program_name);
|
||||
@@ -689,7 +708,7 @@ handle_destroy_notify(XDestroyWindowEvent *event)
|
||||
}
|
||||
|
||||
void
|
||||
handle_xevent()
|
||||
handle_xevent(void)
|
||||
{
|
||||
int i;
|
||||
XEvent event;
|
||||
@@ -743,7 +762,7 @@ handle_xevent()
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,"Usage: %s [-d display] [-p --gxid-port port]\n",
|
||||
program_name);
|
||||
@@ -833,7 +852,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (FD_ISSET(socket_fd,&readfds))
|
||||
handle_connection(socket_fd);
|
||||
handle_connection();
|
||||
|
||||
while (XPending(dpy))
|
||||
handle_xevent();
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
**/
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* Color Context module
|
||||
@@ -851,8 +852,9 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
gint bad_alloc = FALSE;
|
||||
gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
|
||||
GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
|
||||
|
||||
#endif
|
||||
g_assert (cc != NULL);
|
||||
g_assert (reds != NULL);
|
||||
g_assert (greens != NULL);
|
||||
@@ -934,7 +936,7 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
exact_col = ncols;
|
||||
#endif
|
||||
|
||||
@@ -1012,7 +1014,7 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
defs[i] = cmap[close];
|
||||
defs[i].pixel = colors[i];
|
||||
allocated[ncols++] = colors[i];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
close_col++;
|
||||
#endif
|
||||
} else
|
||||
@@ -1086,14 +1088,14 @@ gdk_color_context_get_pixels (GdkColorContext *cc,
|
||||
|
||||
defs[i].pixel = cc->black_pixel;
|
||||
defs[i].red = defs[i].green = defs[i].blue = 0;
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
black_col++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
defs[i] = defs[close];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
subst_col++;
|
||||
#endif
|
||||
}
|
||||
@@ -1123,7 +1125,9 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
gint bad_alloc = FALSE;
|
||||
gint failed[MAX_IMAGE_COLORS], allocated[MAX_IMAGE_COLORS];
|
||||
GdkColor defs[MAX_IMAGE_COLORS], cmap[MAX_IMAGE_COLORS];
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
gint exact_col = 0, subst_col = 0, close_col = 0, black_col = 0;
|
||||
#endif
|
||||
|
||||
g_assert (cc != NULL);
|
||||
g_assert (reds != NULL);
|
||||
@@ -1204,7 +1208,7 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
exact_col = ncols;
|
||||
#endif
|
||||
|
||||
@@ -1276,7 +1280,7 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
defs[i] = cmap[close];
|
||||
defs[i].pixel = colors[i];
|
||||
allocated[ncols++] = colors[i];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
close_col++;
|
||||
#endif
|
||||
}
|
||||
@@ -1348,14 +1352,14 @@ gdk_color_context_get_pixels_incremental (GdkColorContext *cc,
|
||||
|
||||
defs[i].pixel = cc->black_pixel;
|
||||
defs[i].red = defs[i].green = defs[i].blue = 0;
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
black_col++;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
defs[i] = defs[close];
|
||||
#ifdef DEBUG
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
subst_col++;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdk.h"
|
||||
@@ -40,7 +41,6 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
GdkColormap *colormap;
|
||||
GdkColormapPrivate *private;
|
||||
Visual *xvisual;
|
||||
XColor default_colors[256];
|
||||
int size;
|
||||
int i;
|
||||
|
||||
@@ -55,6 +55,9 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
private->ref_count = 1;
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
colormap->size = visual->colormap_size;
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
switch (visual->type)
|
||||
{
|
||||
case GDK_VISUAL_GRAYSCALE:
|
||||
@@ -65,14 +68,18 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
|
||||
if (private_cmap)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
XColor *default_colors;
|
||||
|
||||
default_colors = g_new (XColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
default_colors[i].pixel = i;
|
||||
|
||||
XQueryColors (private->xdisplay,
|
||||
DefaultColormap (private->xdisplay, gdk_screen),
|
||||
default_colors, visual->colormap_size);
|
||||
default_colors, colormap->size);
|
||||
|
||||
for (i = 0; i < visual->colormap_size; i++)
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
colormap->colors[i].pixel = default_colors[i].pixel;
|
||||
colormap->colors[i].red = default_colors[i].red;
|
||||
@@ -80,7 +87,9 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
colormap->colors[i].blue = default_colors[i].blue;
|
||||
}
|
||||
|
||||
gdk_colormap_change (colormap, visual->colormap_size);
|
||||
gdk_colormap_change (colormap, colormap->size);
|
||||
|
||||
g_free (default_colors);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -101,7 +110,7 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
for (i = 0; i < size; i++)
|
||||
colormap->colors[i].blue = i * 65535 / (size - 1);
|
||||
|
||||
gdk_colormap_change (colormap, visual->colormap_size);
|
||||
gdk_colormap_change (colormap, colormap->size);
|
||||
break;
|
||||
|
||||
case GDK_VISUAL_STATIC_GRAY:
|
||||
@@ -130,6 +139,7 @@ gdk_colormap_real_destroy (GdkColormap *colormap)
|
||||
|
||||
gdk_colormap_remove (colormap);
|
||||
XFreeColormap (private->xdisplay, private->xcolormap);
|
||||
g_free (colormap->colors);
|
||||
g_free (colormap);
|
||||
}
|
||||
|
||||
@@ -159,7 +169,7 @@ gdk_colormap_get_system (void)
|
||||
{
|
||||
static GdkColormap *colormap = NULL;
|
||||
GdkColormapPrivate *private;
|
||||
XColor xpalette[256];
|
||||
XColor *xpalette;
|
||||
gint i;
|
||||
|
||||
if (!colormap)
|
||||
@@ -174,10 +184,15 @@ gdk_colormap_get_system (void)
|
||||
private->next_color = 0;
|
||||
private->ref_count = 1;
|
||||
|
||||
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))
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
xpalette = g_new (XColor, colormap->size);
|
||||
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
xpalette[i].red = 0;
|
||||
@@ -186,15 +201,17 @@ gdk_colormap_get_system (void)
|
||||
}
|
||||
|
||||
XQueryColors (gdk_display, private->xcolormap, xpalette,
|
||||
MIN (private->visual->colormap_size, 256));
|
||||
colormap->size);
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
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;
|
||||
}
|
||||
|
||||
g_free (xpalette);
|
||||
}
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
@@ -215,7 +232,7 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor palette[256];
|
||||
XColor *palette;
|
||||
gint shift;
|
||||
int max_colors;
|
||||
int size;
|
||||
@@ -223,6 +240,8 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
|
||||
palette = g_new (XColor, ncolors);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
switch (private->visual->type)
|
||||
{
|
||||
@@ -287,6 +306,8 @@ gdk_colormap_change (GdkColormap *colormap,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (palette);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -423,8 +444,7 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColormapPrivate *private;
|
||||
GdkVisual *visual;
|
||||
XColor xcolor;
|
||||
gchar available[256];
|
||||
gint available_init;
|
||||
gchar *available = NULL;
|
||||
gint return_val;
|
||||
gint i, index;
|
||||
|
||||
@@ -446,9 +466,10 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
case GDK_VISUAL_PSEUDO_COLOR:
|
||||
if (private->private_val)
|
||||
{
|
||||
if (private->next_color > 255)
|
||||
if (private->next_color >= colormap->size)
|
||||
{
|
||||
for (i = 0; i < 256; i++)
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
|
||||
index = gdk_colormap_match_color (colormap, color, available);
|
||||
@@ -465,7 +486,7 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
}
|
||||
else
|
||||
{
|
||||
xcolor.pixel = 255 - private->next_color;
|
||||
xcolor.pixel = colormap->size - 1 -private->next_color;
|
||||
color->pixel = xcolor.pixel;
|
||||
private->next_color += 1;
|
||||
|
||||
@@ -475,8 +496,6 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
}
|
||||
else
|
||||
{
|
||||
available_init = 1;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (XAllocColor (private->xdisplay, private->xcolormap, &xcolor))
|
||||
@@ -486,17 +505,18 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
color->green = xcolor.green;
|
||||
color->blue = xcolor.blue;
|
||||
|
||||
colormap->colors[color->pixel] = *color;
|
||||
if (color->pixel < colormap->size)
|
||||
colormap->colors[color->pixel] = *color;
|
||||
|
||||
return_val = TRUE;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (available_init)
|
||||
if (available == NULL)
|
||||
{
|
||||
available_init = 0;
|
||||
for (i = 0; i < 256; i++)
|
||||
available = g_new (gchar, colormap->size);
|
||||
for (i = 0; i < colormap->size; i++)
|
||||
available[i] = TRUE;
|
||||
}
|
||||
|
||||
@@ -540,6 +560,9 @@ gdk_color_alloc (GdkColormap *colormap,
|
||||
break;
|
||||
}
|
||||
|
||||
if (available)
|
||||
g_free (available);
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
@@ -582,8 +605,6 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
GdkColormapPrivate *private;
|
||||
XColor xpalette[256];
|
||||
gint i;
|
||||
|
||||
colormap = gdk_colormap_lookup (xcolormap);
|
||||
if (colormap)
|
||||
@@ -601,6 +622,12 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
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
|
||||
* X doesn't allow this
|
||||
*/
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
xpalette[i].pixel = i;
|
||||
@@ -618,6 +645,10 @@ gdkx_colormap_get (Colormap xcolormap)
|
||||
colormap->colors[i].green = xpalette[i].green;
|
||||
colormap->colors[i].blue = xpalette[i].blue;
|
||||
}
|
||||
#endif
|
||||
|
||||
colormap->colors = NULL;
|
||||
colormap->size = 0;
|
||||
|
||||
gdk_colormap_add (colormap);
|
||||
|
||||
@@ -642,7 +673,7 @@ gdk_colormap_match_color (GdkColormap *cmap,
|
||||
max = 3 * (65536);
|
||||
index = -1;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
for (i = 0; i < cmap->size; i++)
|
||||
{
|
||||
if ((!available) || (available && available[i]))
|
||||
{
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
@@ -26,6 +26,8 @@ gdk_dnd_set_drag_cursors(GdkCursor *default_cursor, GdkCursor *goahead_cursor)
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_ok);
|
||||
}
|
||||
gdk_dnd.c->drag_pm_default = gdk_dnd.c->drag_pm_ok = NULL;
|
||||
g_list_free(gdk_dnd.c->xids);
|
||||
gdk_dnd.c->xids = NULL;
|
||||
}
|
||||
gdk_dnd_display_drag_cursor(-1, -1,
|
||||
gdk_dnd.dnd_drag_target?TRUE:FALSE,
|
||||
@@ -41,19 +43,28 @@ gdk_dnd_set_drag_shape(GdkWindow *default_pixmapwin,
|
||||
{
|
||||
g_return_if_fail(default_pixmapwin != NULL);
|
||||
|
||||
g_list_free(gdk_dnd.c->xids); gdk_dnd.c->xids = NULL;
|
||||
if(gdk_dnd.c->drag_pm_default)
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_default);
|
||||
{
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_default);
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_default);
|
||||
}
|
||||
if(gdk_dnd.c->drag_pm_ok)
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_ok);
|
||||
{
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_ok);
|
||||
gdk_window_unref(gdk_dnd.c->drag_pm_ok);
|
||||
}
|
||||
|
||||
gdk_dnd.c->drag_pm_ok = NULL;
|
||||
|
||||
gdk_window_ref(default_pixmapwin);
|
||||
gdk_dnd.c->drag_pm_default = default_pixmapwin;
|
||||
gdk_dnd.c->default_hotspot = *default_hotspot;
|
||||
gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, GUINT_TO_POINTER (((GdkWindowPrivate *)default_pixmapwin)->xwindow));
|
||||
if(goahead_pixmapwin)
|
||||
{
|
||||
gdk_window_ref(goahead_pixmapwin);
|
||||
gdk_dnd.c->xids = g_list_append(gdk_dnd.c->xids, GUINT_TO_POINTER (((GdkWindowPrivate *)goahead_pixmapwin)->xwindow));
|
||||
gdk_dnd.c->drag_pm_ok = goahead_pixmapwin;
|
||||
gdk_dnd.c->ok_hotspot = *goahead_hotspot;
|
||||
}
|
||||
@@ -93,32 +104,40 @@ gdk_dnd_display_drag_cursor(gint x, gint y, gboolean drag_ok,
|
||||
{
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_ok);
|
||||
gdk_window_hide(gdk_dnd.c->drag_pm_default);
|
||||
GDK_NOTE(DND, g_print("Hiding both drag cursors\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(x == -1 && y == -1) /* We're supposed to find it out for ourselves */
|
||||
XQueryPointer(gdk_display, gdk_root_window,
|
||||
&wtmp, &wtmp, &x, &y, &itmp, &itmp, &masktmp);
|
||||
|
||||
|
||||
if(drag_ok)
|
||||
{
|
||||
GDK_NOTE(DND, g_print("Switching to drag_ok cursor\n"));
|
||||
mypix = gdk_dnd.c->drag_pm_ok;
|
||||
opix = gdk_dnd.c->drag_pm_default;
|
||||
myhotspot = &gdk_dnd.c->ok_hotspot;
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_NOTE(DND, g_print("Switching to drag_default cursor\n"));
|
||||
mypix = gdk_dnd.c->drag_pm_default;
|
||||
opix = gdk_dnd.c->drag_pm_ok;
|
||||
myhotspot = &gdk_dnd.c->default_hotspot;
|
||||
}
|
||||
gdk_window_move(mypix, x - myhotspot->x, y - myhotspot->y);
|
||||
if(change_made)
|
||||
{
|
||||
GDK_NOTE(DND, g_print("Cursors switched, hide & show\n"));
|
||||
gdk_window_hide(opix);
|
||||
gdk_window_show(mypix); /* There ought to be a way to know if
|
||||
a window is already mapped etc. */
|
||||
}
|
||||
gdk_window_move(mypix, x - myhotspot->x, y - myhotspot->y);
|
||||
if (change_made)
|
||||
{
|
||||
gdk_window_show(mypix); /* There ought to be a way to know if
|
||||
a window is already mapped etc. */
|
||||
}
|
||||
}
|
||||
else if(change_made)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
@@ -70,7 +71,10 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
|
||||
if (missing_charset_count)
|
||||
{
|
||||
g_print ("Missing charsets in FontSet creation");
|
||||
gint i;
|
||||
g_print ("Missing charsets in FontSet creation\n");
|
||||
for (i=0;i<missing_charset_count;i++)
|
||||
g_print (" %s\n", missing_charset_list[i]);
|
||||
XFreeStringList (missing_charset_list);
|
||||
}
|
||||
|
||||
@@ -83,13 +87,22 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
}
|
||||
else
|
||||
{
|
||||
XFontSetExtents *extent = XExtentsOfFontSet(fontset);
|
||||
|
||||
gint num_fonts;
|
||||
gint i;
|
||||
XFontStruct **font_structs;
|
||||
gchar **font_names;
|
||||
|
||||
private->xfont = fontset;
|
||||
font->type = GDK_FONT_FONTSET;
|
||||
/* how to define ascent and descent for fontset ??? */
|
||||
font->ascent = extent->max_logical_extent.height;
|
||||
font->descent = font->ascent / 4 ;
|
||||
num_fonts = XFontsOfFontSet (fontset, &font_structs, &font_names);
|
||||
|
||||
font->ascent = font->descent = 0;
|
||||
|
||||
for (i = 0; i < num_fonts; i++)
|
||||
{
|
||||
font->ascent = MAX (font->ascent, font_structs[i]->ascent);
|
||||
font->descent = MAX (font->descent, font_structs[i]->descent);
|
||||
}
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
@@ -12,13 +12,15 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include "gdktypes.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "../config.h"
|
||||
|
||||
guint gdk_debug_flags = 0;
|
||||
gint gdk_use_xshm = TRUE;
|
||||
@@ -34,7 +36,7 @@ Atom gdk_wm_protocols;
|
||||
Atom gdk_wm_window_protocols[2];
|
||||
Atom gdk_selection_property;
|
||||
GdkDndCursorInfo gdk_dnd_cursorinfo = {None, None, NULL, NULL,
|
||||
{0,0}, {0,0}};
|
||||
{0,0}, {0,0}, NULL};
|
||||
GdkDndGlobals gdk_dnd = {None,None,None,
|
||||
None,None,None,
|
||||
None,
|
||||
@@ -52,3 +54,13 @@ gint gdk_error_code;
|
||||
gint gdk_error_warnings = TRUE;
|
||||
gint gdk_null_window_warnings = TRUE;
|
||||
GList *gdk_default_filters = NULL;
|
||||
|
||||
gboolean gdk_using_threads = FALSE;
|
||||
|
||||
/* Used to signal the mainloop thread from its select() */
|
||||
#ifdef USE_PTHREADS
|
||||
gint gdk_threads_pipe[2];
|
||||
gboolean gdk_select_waiting = FALSE;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "../config.h"
|
||||
|
||||
@@ -63,7 +64,7 @@ static GList *image_list = NULL;
|
||||
|
||||
|
||||
void
|
||||
gdk_image_exit ()
|
||||
gdk_image_exit (void)
|
||||
{
|
||||
GdkImage *image;
|
||||
|
||||
@@ -130,7 +131,7 @@ gdk_image_check_xshm(Display *display)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_image_init ()
|
||||
gdk_image_init (void)
|
||||
{
|
||||
if (gdk_use_xshm)
|
||||
{
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef XINPUT_GXI
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef XINPUT_NONE
|
||||
@@ -28,7 +29,7 @@ static void gdk_input_none_get_pointer (GdkWindow *window,
|
||||
GdkModifierType *mask);
|
||||
|
||||
void
|
||||
gdk_input_init ()
|
||||
gdk_input_init (void)
|
||||
{
|
||||
gdk_input_vtable.set_mode = NULL;
|
||||
gdk_input_vtable.set_axes = NULL;
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#if defined(XINPUT_GXI) || defined(XINPUT_XFREE)
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifdef XINPUT_XFREE
|
||||
@@ -21,7 +22,7 @@
|
||||
/* forward declarations */
|
||||
|
||||
static gint gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode);
|
||||
static void gdk_input_check_proximity();
|
||||
static void gdk_input_check_proximity (void);
|
||||
static void gdk_input_xfree_configure_event (XConfigureEvent *xevent,
|
||||
GdkWindow *window);
|
||||
static void gdk_input_xfree_enter_event (XCrossingEvent *xevent,
|
||||
@@ -114,7 +115,7 @@ gdk_input_xfree_set_mode (guint32 deviceid, GdkInputMode mode)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_input_check_proximity()
|
||||
gdk_input_check_proximity (void)
|
||||
{
|
||||
gint new_proximity = 0;
|
||||
GList *tmp_list = gdk_input_devices;
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <X11/Xlib.h>
|
||||
@@ -69,7 +70,7 @@ static GList *gdk_input_windows;
|
||||
#include "gdkinputgxi.h"
|
||||
|
||||
GList *
|
||||
gdk_input_list_devices ()
|
||||
gdk_input_list_devices (void)
|
||||
{
|
||||
return gdk_input_devices;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "../config.h"
|
||||
|
||||
@@ -50,8 +51,8 @@
|
||||
#include "gdkinput.h"
|
||||
#ifdef USE_XIM
|
||||
#include "gdkx.h"
|
||||
#include "gdkkeysyms.h"
|
||||
#endif
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdki18n.h"
|
||||
|
||||
#ifndef X_GETTIMEOFDAY
|
||||
@@ -146,12 +147,17 @@ static RETSIGTYPE gdk_signal (int signum);
|
||||
|
||||
|
||||
#ifdef USE_XIM
|
||||
static guint gdk_im_va_count (va_list list);
|
||||
static XVaNestedList gdk_im_va_to_nested (va_list list,
|
||||
guint count);
|
||||
|
||||
static GdkIM gdk_im_get (void);
|
||||
static gint gdk_im_open (XrmDatabase db,
|
||||
gchar* res_name,
|
||||
gchar* rec_class);
|
||||
static void gdk_im_close (void);
|
||||
static void gdk_ic_cleanup (void);
|
||||
|
||||
#endif /* USE_XIM */
|
||||
|
||||
/* Private variable declarations
|
||||
@@ -217,9 +223,6 @@ static GList* xim_ic_list;
|
||||
|
||||
#endif
|
||||
|
||||
#define OTHER_XEVENT_BUFSIZE 4
|
||||
static XEvent other_xevent[OTHER_XEVENT_BUFSIZE]; /* XEvents passed along to user */
|
||||
static int other_xevent_i = 0;
|
||||
static GList *putback_events = NULL;
|
||||
|
||||
static gulong base_id;
|
||||
@@ -307,45 +310,66 @@ gdk_init (int *argc,
|
||||
if (argc && argv)
|
||||
{
|
||||
if (*argc > 0)
|
||||
gdk_progname = (*argv)[0];
|
||||
{
|
||||
gchar *d;
|
||||
|
||||
d = strrchr((*argv)[0],'/');
|
||||
if (d != NULL)
|
||||
gdk_progname = g_strdup (d + 1);
|
||||
else
|
||||
gdk_progname = g_strdup ((*argv)[0]);
|
||||
GDK_NOTE (MISC,
|
||||
g_print ("Gdk: progname: \"%s\"\n", gdk_progname));
|
||||
}
|
||||
|
||||
for (i = 1; i < *argc;)
|
||||
{
|
||||
if ((*argv)[i] == NULL)
|
||||
{
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (strcmp ("--gdk-debug", (*argv)[i]) == 0)
|
||||
if ((strcmp ("--gdk-debug", (*argv)[i]) == 0) ||
|
||||
(strncmp ("--gdk-debug=", (*argv)[i], 12) == 0))
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
gchar *equal_pos = strchr ((*argv)[i], '=');
|
||||
|
||||
if (equal_pos != NULL)
|
||||
{
|
||||
gdk_debug_flags |= g_parse_debug_string (equal_pos+1,
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
}
|
||||
else if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags |= g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
(*argv)[i] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
else if (strcmp ("--gdk-no-debug", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
}
|
||||
else if ((strcmp ("--gdk-no-debug", (*argv)[i]) == 0) ||
|
||||
(strncmp ("--gdk-no-debug=", (*argv)[i], 15) == 0))
|
||||
{
|
||||
gchar *equal_pos = strchr ((*argv)[i], '=');
|
||||
|
||||
if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
if (equal_pos != NULL)
|
||||
{
|
||||
gdk_debug_flags &= ~g_parse_debug_string (equal_pos+1,
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
}
|
||||
else if ((i + 1) < *argc && (*argv)[i + 1])
|
||||
{
|
||||
gdk_debug_flags &= ~g_parse_debug_string ((*argv)[i+1],
|
||||
gdk_debug_keys,
|
||||
gdk_ndebug_keys);
|
||||
(*argv)[i + 1] = NULL;
|
||||
(*argv)[i] = NULL;
|
||||
i += 1;
|
||||
}
|
||||
(*argv)[i] = NULL;
|
||||
}
|
||||
else
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
else if (strcmp ("--display", (*argv)[i]) == 0)
|
||||
if (strcmp ("--display", (*argv)[i]) == 0)
|
||||
{
|
||||
(*argv)[i] = NULL;
|
||||
|
||||
@@ -479,7 +503,7 @@ gdk_init (int *argc,
|
||||
|
||||
connection_number = ConnectionNumber (gdk_display);
|
||||
GDK_NOTE (MISC,
|
||||
g_print ("connection number: %d\n", connection_number));
|
||||
g_print ("Gdk: connection number: %d\n", connection_number));
|
||||
|
||||
if (synchronize)
|
||||
XSynchronize (gdk_display, True);
|
||||
@@ -601,7 +625,7 @@ gdk_exit (int errorcode)
|
||||
*/
|
||||
|
||||
gchar*
|
||||
gdk_set_locale ()
|
||||
gdk_set_locale (void)
|
||||
{
|
||||
if (!setlocale (LC_ALL,""))
|
||||
g_print ("locale not supported by C library\n");
|
||||
@@ -639,7 +663,7 @@ gdk_set_locale ()
|
||||
*/
|
||||
|
||||
gint
|
||||
gdk_events_pending ()
|
||||
gdk_events_pending (void)
|
||||
{
|
||||
gint result;
|
||||
GList *tmp_list;
|
||||
@@ -999,13 +1023,13 @@ gdk_set_use_xshm (gint use_xshm)
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_get_show_events ()
|
||||
gdk_get_show_events (void)
|
||||
{
|
||||
return gdk_debug_flags & GDK_DEBUG_EVENTS;
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_get_use_xshm ()
|
||||
gdk_get_use_xshm (void)
|
||||
{
|
||||
return gdk_use_xshm;
|
||||
}
|
||||
@@ -1031,7 +1055,7 @@ gdk_get_use_xshm ()
|
||||
*/
|
||||
|
||||
guint32
|
||||
gdk_time_get ()
|
||||
gdk_time_get (void)
|
||||
{
|
||||
struct timeval end;
|
||||
struct timeval elapsed;
|
||||
@@ -1070,7 +1094,7 @@ gdk_time_get ()
|
||||
*/
|
||||
|
||||
guint32
|
||||
gdk_timer_get ()
|
||||
gdk_timer_get (void)
|
||||
{
|
||||
return timer_val;
|
||||
}
|
||||
@@ -1105,13 +1129,13 @@ gdk_timer_set (guint32 milliseconds)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_timer_enable ()
|
||||
gdk_timer_enable (void)
|
||||
{
|
||||
timerp = &timer;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_timer_disable ()
|
||||
gdk_timer_disable (void)
|
||||
{
|
||||
timerp = NULL;
|
||||
}
|
||||
@@ -1439,7 +1463,7 @@ gdk_keyboard_ungrab (guint32 time)
|
||||
*/
|
||||
|
||||
gint
|
||||
gdk_screen_width ()
|
||||
gdk_screen_width (void)
|
||||
{
|
||||
gint return_val;
|
||||
|
||||
@@ -1464,7 +1488,7 @@ gdk_screen_width ()
|
||||
*/
|
||||
|
||||
gint
|
||||
gdk_screen_height ()
|
||||
gdk_screen_height (void)
|
||||
{
|
||||
gint return_val;
|
||||
|
||||
@@ -1474,13 +1498,13 @@ gdk_screen_height ()
|
||||
}
|
||||
|
||||
void
|
||||
gdk_key_repeat_disable ()
|
||||
gdk_key_repeat_disable (void)
|
||||
{
|
||||
XAutoRepeatOff (gdk_display);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_key_repeat_restore ()
|
||||
gdk_key_repeat_restore (void)
|
||||
{
|
||||
if (autorepeat)
|
||||
XAutoRepeatOn (gdk_display);
|
||||
@@ -1507,14 +1531,14 @@ gdk_key_repeat_restore ()
|
||||
*--------------------------------------------------------------
|
||||
*/
|
||||
|
||||
void gdk_flush ()
|
||||
void gdk_flush (void)
|
||||
{
|
||||
XSync (gdk_display, False);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gdk_beep ()
|
||||
gdk_beep (void)
|
||||
{
|
||||
XBell(gdk_display, 100);
|
||||
}
|
||||
@@ -1538,7 +1562,7 @@ gdk_beep ()
|
||||
*/
|
||||
|
||||
static gint
|
||||
gdk_event_wait ()
|
||||
gdk_event_wait (void)
|
||||
{
|
||||
GList *list;
|
||||
GdkInput *input;
|
||||
@@ -1582,8 +1606,31 @@ gdk_event_wait ()
|
||||
max_input = MAX (max_input, input->source);
|
||||
}
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
if (gdk_using_threads)
|
||||
{
|
||||
gdk_select_waiting = TRUE;
|
||||
|
||||
FD_SET (gdk_threads_pipe[0], &readfds);
|
||||
max_input = MAX (max_input, gdk_threads_pipe[0]);
|
||||
gdk_threads_leave ();
|
||||
}
|
||||
#endif
|
||||
|
||||
nfd = select (max_input+1, &readfds, &writefds, &exceptfds, timerp);
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
if (gdk_using_threads)
|
||||
{
|
||||
gchar c;
|
||||
gdk_threads_enter ();
|
||||
gdk_select_waiting = FALSE;
|
||||
|
||||
if (FD_ISSET (gdk_threads_pipe[0], &readfds))
|
||||
read (gdk_threads_pipe[0], &c, 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
timerp = NULL;
|
||||
timer_val = 0;
|
||||
|
||||
@@ -1661,7 +1708,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *window_private;
|
||||
XComposeStatus compose;
|
||||
static XComposeStatus compose;
|
||||
KeySym keysym;
|
||||
int charcount;
|
||||
#ifdef USE_XIM
|
||||
static gchar* buf = NULL;
|
||||
@@ -1671,10 +1719,12 @@ gdk_event_translate (GdkEvent *event,
|
||||
#endif
|
||||
gint return_val;
|
||||
|
||||
/* Are static variables used for this purpose thread-safe? */
|
||||
|
||||
return_val = FALSE;
|
||||
|
||||
/* We need to play catch-up with the dnd motion events */
|
||||
if(gdk_dnd.drag_really && xevent->type == MotionNotify)
|
||||
while (XCheckTypedEvent(xevent->xany.display,MotionNotify,xevent));
|
||||
|
||||
/* Find the GdkWindow that this event occurred in.
|
||||
* All events occur in some GdkWindow (otherwise, why
|
||||
* would we be receiving them). It really is an error
|
||||
@@ -1741,16 +1791,16 @@ gdk_event_translate (GdkEvent *event,
|
||||
buf_len = 128;
|
||||
buf = g_new (gchar, buf_len);
|
||||
}
|
||||
keysym = GDK_VoidSymbol;
|
||||
|
||||
if (xim_using == TRUE && xim_ic)
|
||||
{
|
||||
Status status;
|
||||
|
||||
/* Clear keyval. Depending on status, may not be set */
|
||||
event->key.keyval = GDK_VoidSymbol;
|
||||
charcount = XmbLookupString(xim_ic->xic,
|
||||
&xevent->xkey, buf, buf_len-1,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&status);
|
||||
&keysym, &status);
|
||||
if (status == XBufferOverflow)
|
||||
{ /* retry */
|
||||
/* alloc adequate size of buffer */
|
||||
@@ -1763,8 +1813,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
charcount = XmbLookupString (xim_ic->xic,
|
||||
&xevent->xkey, buf, buf_len-1,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&status);
|
||||
&keysym, &status);
|
||||
}
|
||||
if (status == XLookupNone)
|
||||
{
|
||||
@@ -1774,13 +1823,13 @@ gdk_event_translate (GdkEvent *event,
|
||||
}
|
||||
else
|
||||
charcount = XLookupString (&xevent->xkey, buf, buf_len,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&compose);
|
||||
&keysym, &compose);
|
||||
#else
|
||||
charcount = XLookupString (&xevent->xkey, buf, 16,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&compose);
|
||||
&keysym, &compose);
|
||||
#endif
|
||||
event->key.keyval = keysym;
|
||||
|
||||
if (charcount > 0 && buf[charcount-1] == '\0')
|
||||
charcount --;
|
||||
else
|
||||
@@ -1818,9 +1867,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
case KeyRelease:
|
||||
/* Lookup the string corresponding to the given keysym.
|
||||
*/
|
||||
keysym = GDK_VoidSymbol;
|
||||
charcount = XLookupString (&xevent->xkey, buf, 16,
|
||||
(KeySym*) &event->key.keyval,
|
||||
&compose);
|
||||
&keysym, &compose);
|
||||
event->key.keyval = keysym;
|
||||
|
||||
/* Print debugging info.
|
||||
*/
|
||||
@@ -1937,8 +1987,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
window_private->dnd_drag_savedeventmask = dnd_winattr.your_event_mask;
|
||||
dnd_setwinattr.event_mask =
|
||||
window_private->dnd_drag_eventmask = ButtonMotionMask |
|
||||
EnterWindowMask | LeaveWindowMask;
|
||||
window_private->dnd_drag_eventmask = ButtonMotionMask | ButtonPressMask | ButtonReleaseMask |
|
||||
EnterWindowMask | LeaveWindowMask | ExposureMask;
|
||||
XChangeWindowAttributes(gdk_display, window_private->xwindow,
|
||||
CWEventMask, &dnd_setwinattr);
|
||||
}
|
||||
@@ -2069,7 +2119,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
/* XXX there has to be a better way to do this, perhaps with
|
||||
XTranslateCoordinates or XQueryTree - I don't know how,
|
||||
and this sort of works */
|
||||
static Window lastwin = None, curwin = None, twin;
|
||||
static Window lastwin = None, curwin = None;
|
||||
#if 0
|
||||
Window twin;
|
||||
#endif
|
||||
Window childwin = gdk_root_window;
|
||||
int x, y, ox, oy;
|
||||
|
||||
@@ -2083,6 +2136,13 @@ gdk_event_translate (GdkEvent *event,
|
||||
curwin = gdk_root_window;
|
||||
ox = x = xevent->xmotion.x_root;
|
||||
oy = y = xevent->xmotion.y_root;
|
||||
#if 1
|
||||
curwin = gdk_window_xid_at_coords(xevent->xmotion.x_root,
|
||||
xevent->xmotion.y_root,
|
||||
gdk_dnd.c->xids,TRUE);
|
||||
XTranslateCoordinates(gdk_display, gdk_root_window, curwin,
|
||||
x, y, &x, &y, &childwin);
|
||||
#else
|
||||
while(childwin != None)
|
||||
{
|
||||
ox = x; oy = y;
|
||||
@@ -2095,6 +2155,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
x, y, &x, &y, &twin);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
GDK_NOTE (DND,
|
||||
g_print("Drag is now in window %#lx, lastwin was %#lx, ddc = %#lx\n",
|
||||
curwin, lastwin, gdk_dnd.dnd_drag_curwin));
|
||||
@@ -2296,7 +2357,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
ButtonMotionMask | PointerMotionMask |
|
||||
/* PointerMotionHintMask | */ /* HINTME */
|
||||
ButtonPressMask | ButtonReleaseMask,
|
||||
GrabModeAsync, GrabModeAsync, gdk_root_window,
|
||||
GrabModeAsync, GrabModeAsync, None,
|
||||
None, CurrentTime);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GDK_NOTE(DND, g_print("xgpret = %d\n", xgpret));
|
||||
@@ -2506,7 +2567,30 @@ gdk_event_translate (GdkEvent *event,
|
||||
while ((XPending (gdk_display) > 0) &&
|
||||
XCheckTypedWindowEvent(gdk_display, xevent->xany.window,
|
||||
ConfigureNotify, xevent))
|
||||
/*XSync (gdk_display, 0)*/;
|
||||
{
|
||||
GdkFilterReturn result;
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("configure notify discarded:\twindow: %ld\n",
|
||||
xevent->xconfigure.window - base_id));
|
||||
|
||||
result = gdk_event_apply_filters (xevent, event,
|
||||
window_private
|
||||
?window_private->filters
|
||||
:gdk_default_filters);
|
||||
|
||||
/* If the result is GDK_FILTER_REMOVE, there will be
|
||||
* trouble, but anybody who filtering the Configure events
|
||||
* better know what they are doing
|
||||
*/
|
||||
if (result != GDK_FILTER_CONTINUE)
|
||||
{
|
||||
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/*XSync (gdk_display, 0);*/
|
||||
}
|
||||
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_print ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d\n",
|
||||
@@ -2533,7 +2617,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
event->configure.height = xevent->xconfigure.height;
|
||||
|
||||
if (!xevent->xconfigure.x &&
|
||||
!xevent->xconfigure.y)
|
||||
!xevent->xconfigure.y &&
|
||||
!window_private->destroyed)
|
||||
{
|
||||
gint tx = 0;
|
||||
gint ty = 0;
|
||||
@@ -2887,19 +2972,9 @@ gdk_event_translate (GdkEvent *event,
|
||||
gdk_input_vtable.other_event)
|
||||
return_val = gdk_input_vtable.other_event(event, xevent, window);
|
||||
else
|
||||
return_val = -1;
|
||||
return_val = FALSE;
|
||||
|
||||
if (return_val < 0) /* not an XInput event, convert */
|
||||
{
|
||||
event->other.type = GDK_OTHER_EVENT;
|
||||
event->other.window = window;
|
||||
event->other.xevent = (GdkXEvent *)&other_xevent[other_xevent_i];
|
||||
memcpy (&other_xevent[other_xevent_i], xevent, sizeof (XEvent));
|
||||
other_xevent_i = (other_xevent_i+1) % OTHER_XEVENT_BUFSIZE;
|
||||
return_val = TRUE;
|
||||
}
|
||||
else
|
||||
return_val = return_val && !window_private->destroyed;
|
||||
return_val = return_val && !window_private->destroyed;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -2977,7 +3052,7 @@ gdk_synthesize_click (GdkEvent *event,
|
||||
*/
|
||||
|
||||
static void
|
||||
gdk_exit_func ()
|
||||
gdk_exit_func (void)
|
||||
{
|
||||
static gboolean in_gdk_exit_func = FALSE;
|
||||
|
||||
@@ -3035,7 +3110,12 @@ gdk_x_error (Display *display,
|
||||
if (gdk_error_warnings)
|
||||
{
|
||||
XGetErrorText (display, error->error_code, buf, 63);
|
||||
g_error ("%s", buf);
|
||||
g_error ("%s\n serial %ld error_code %d request_code %d minor_code %d\n",
|
||||
buf,
|
||||
error->serial,
|
||||
error->error_code,
|
||||
error->request_code,
|
||||
error->minor_code);
|
||||
}
|
||||
|
||||
gdk_error_code = -1;
|
||||
@@ -3138,13 +3218,16 @@ gdk_signal (int sig_num)
|
||||
static void
|
||||
gdk_dnd_drag_begin (GdkWindow *initial_window)
|
||||
{
|
||||
GdkEventDragBegin tev;
|
||||
tev.type = GDK_DRAG_BEGIN;
|
||||
tev.window = initial_window;
|
||||
tev.u.allflags = 0;
|
||||
tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
GdkEvent tev;
|
||||
|
||||
gdk_event_put ((GdkEvent *) &tev);
|
||||
GDK_NOTE(DND, g_print("------- STARTING DRAG from %p\n", initial_window));
|
||||
|
||||
tev.type = GDK_DRAG_BEGIN;
|
||||
tev.dragbegin.window = initial_window;
|
||||
tev.dragbegin.u.allflags = 0;
|
||||
tev.dragbegin.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
|
||||
gdk_event_put (&tev);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -3184,7 +3267,7 @@ gdk_dnd_drag_enter (Window dest)
|
||||
}
|
||||
else
|
||||
sev.xclient.data.l[3] = sev.xclient.data.l[4] = None;
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
if (!gdk_send_xevent (dest, False, StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeEnter to %#lx failed\n",
|
||||
dest));
|
||||
}
|
||||
@@ -3195,6 +3278,84 @@ gdk_dnd_drag_enter (Window dest)
|
||||
|
||||
#ifdef USE_XIM
|
||||
|
||||
/* The following routines duplicate functionality in Xlib to
|
||||
* translate from varargs to X's internal opaque XVaNestedList.
|
||||
*
|
||||
* If all vendors have stuck close to the reference implementation,
|
||||
* then we should hopefully be OK.
|
||||
*/
|
||||
|
||||
/* This needs to match XIMArg as defined in Xlcint.h exactly */
|
||||
|
||||
typedef struct {
|
||||
gchar *name;
|
||||
gpointer value;
|
||||
} GdkImArg;
|
||||
|
||||
/*************************************************************
|
||||
* gdk_im_va_count:
|
||||
* Counts the number of name/value pairs in the vararg list
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*************************************************************/
|
||||
|
||||
static guint
|
||||
gdk_im_va_count (va_list list)
|
||||
{
|
||||
gint count = 0;
|
||||
gchar *name;
|
||||
|
||||
name = va_arg (list, gchar *);
|
||||
while (name)
|
||||
{
|
||||
count++;
|
||||
(void)va_arg (list, gpointer);
|
||||
name = va_arg (list, gchar *);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
/*************************************************************
|
||||
* gdk_im_va_to_nested:
|
||||
* Given a varargs list and the result of gdk_im_va_count,
|
||||
* create a XVaNestedList.
|
||||
*
|
||||
* arguments:
|
||||
*
|
||||
* results:
|
||||
*************************************************************/
|
||||
|
||||
static XVaNestedList
|
||||
gdk_im_va_to_nested (va_list list, guint count)
|
||||
{
|
||||
GdkImArg *result;
|
||||
GdkImArg *arg;
|
||||
|
||||
gchar *name;
|
||||
|
||||
if (count == 0)
|
||||
return NULL;
|
||||
|
||||
result = g_new (GdkImArg, count+1);
|
||||
arg = result;
|
||||
|
||||
name = va_arg (list, gchar *);
|
||||
while (name)
|
||||
{
|
||||
arg->name = name;
|
||||
arg->value = va_arg (list, gpointer);
|
||||
arg++;
|
||||
name = va_arg (list, gchar *);
|
||||
}
|
||||
|
||||
arg->name = NULL;
|
||||
|
||||
return (XVaNestedList)result;
|
||||
}
|
||||
|
||||
/*
|
||||
*--------------------------------------------------------------
|
||||
* gdk_im_begin
|
||||
@@ -3413,7 +3574,8 @@ gdk_ic_new (GdkWindow* client_window,
|
||||
{
|
||||
va_list list;
|
||||
GdkICPrivate *private;
|
||||
XVaNestedList preedit_attr;
|
||||
XVaNestedList preedit_attr = NULL;
|
||||
guint count;
|
||||
|
||||
g_return_val_if_fail (client_window != NULL, NULL);
|
||||
g_return_val_if_fail (focus_window != NULL, NULL);
|
||||
@@ -3422,9 +3584,13 @@ gdk_ic_new (GdkWindow* client_window,
|
||||
private = g_new (GdkICPrivate, 1);
|
||||
|
||||
va_start (list, style);
|
||||
preedit_attr = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, style);
|
||||
preedit_attr = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
private->style = gdk_im_decide_style (style);
|
||||
if (private->style != style)
|
||||
{
|
||||
@@ -3439,6 +3605,9 @@ gdk_ic_new (GdkWindow* client_window,
|
||||
XNFocusWindow, GDK_WINDOW_XWINDOW (focus_window),
|
||||
preedit_attr? XNPreeditAttributes : NULL, preedit_attr,
|
||||
NULL);
|
||||
|
||||
g_free (preedit_attr);
|
||||
|
||||
if (!private->xic)
|
||||
{
|
||||
g_free (private);
|
||||
@@ -3484,16 +3653,23 @@ gdk_ic_set_values (GdkIC ic, ...)
|
||||
va_list list;
|
||||
XVaNestedList args;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, ic);
|
||||
args = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, ic);
|
||||
args = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XSetICValues (private->xic, XNVaNestedList, args, NULL);
|
||||
|
||||
g_free (args);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3502,16 +3678,23 @@ gdk_ic_get_values (GdkIC ic, ...)
|
||||
va_list list;
|
||||
XVaNestedList args;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, ic);
|
||||
args = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, ic);
|
||||
args = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XGetICValues (private->xic, XNVaNestedList, args, NULL);
|
||||
|
||||
g_free (args);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3520,6 +3703,7 @@ gdk_ic_set_attr (GdkIC ic, const char *target, ...)
|
||||
va_list list;
|
||||
XVaNestedList attr;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
g_return_if_fail (target != NULL);
|
||||
@@ -3527,10 +3711,16 @@ gdk_ic_set_attr (GdkIC ic, const char *target, ...)
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, target);
|
||||
attr = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, target);
|
||||
attr = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XSetICValues (private->xic, target, attr, NULL);
|
||||
|
||||
g_free (attr);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3539,6 +3729,7 @@ gdk_ic_get_attr (GdkIC ic, const char *target, ...)
|
||||
va_list list;
|
||||
XVaNestedList attr;
|
||||
GdkICPrivate *private;
|
||||
guint count;
|
||||
|
||||
g_return_if_fail (ic != NULL);
|
||||
g_return_if_fail (target != NULL);
|
||||
@@ -3546,10 +3737,16 @@ gdk_ic_get_attr (GdkIC ic, const char *target, ...)
|
||||
private = (GdkICPrivate *) ic;
|
||||
|
||||
va_start (list, target);
|
||||
attr = (XVaNestedList) & (va_arg (list, void *));
|
||||
count = gdk_im_va_count (list);
|
||||
va_end (list);
|
||||
|
||||
va_start (list, target);
|
||||
attr = gdk_im_va_to_nested (list, count);
|
||||
va_end (list);
|
||||
|
||||
XGetICValues (private->xic, target, attr, NULL);
|
||||
|
||||
g_free (attr);
|
||||
}
|
||||
|
||||
GdkEventMask
|
||||
@@ -3705,6 +3902,9 @@ _g_mbtowc (wchar_t *wstr, const char *str, size_t len)
|
||||
wcs[0] = (wchar_t) NULL;
|
||||
mbs[0] = '\0';
|
||||
|
||||
/* The last argument isn't a mistake. The X locale code trims
|
||||
* the input string to the length of the output string!
|
||||
*/
|
||||
len = _Xmbstowcs (wcs, str, (len<MB_CUR_MAX)? len:MB_CUR_MAX);
|
||||
if (len < 1)
|
||||
return len;
|
||||
@@ -3742,7 +3942,7 @@ gdk_dnd_drag_leave (Window dest)
|
||||
{
|
||||
wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
|
||||
sev.xclient.data.l[0] = wp->xwindow;
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
if (!gdk_send_xevent (dest, False, StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeLeave to %#lx failed\n",
|
||||
dest));
|
||||
wp->dnd_drag_accepted = 0;
|
||||
@@ -3759,28 +3959,28 @@ gdk_dnd_drag_end (Window dest,
|
||||
GdkPoint coords)
|
||||
{
|
||||
GdkWindowPrivate *wp;
|
||||
GdkEventDragRequest tev;
|
||||
GdkEvent tev;
|
||||
int i;
|
||||
|
||||
tev.type = GDK_DRAG_REQUEST;
|
||||
tev.drop_coords = coords;
|
||||
tev.requestor = dest;
|
||||
tev.u.allflags = 0;
|
||||
tev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
tev.isdrop = 1;
|
||||
tev.dragrequest.type = GDK_DRAG_REQUEST;
|
||||
tev.dragrequest.drop_coords = coords;
|
||||
tev.dragrequest.requestor = dest;
|
||||
tev.dragrequest.u.allflags = 0;
|
||||
tev.dragrequest.u.flags.protocol_version = DND_PROTOCOL_VERSION;
|
||||
tev.dragrequest.isdrop = 1;
|
||||
|
||||
for (i = 0; i < gdk_dnd.drag_numwindows; i++)
|
||||
{
|
||||
wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
|
||||
if (wp->dnd_drag_accepted)
|
||||
{
|
||||
tev.window = (GdkWindow *) wp;
|
||||
tev.u.flags.delete_data = wp->dnd_drag_destructive_op;
|
||||
tev.timestamp = gdk_dnd.last_drop_time;
|
||||
tev.data_type =
|
||||
tev.dragrequest.window = (GdkWindow *) wp;
|
||||
tev.dragrequest.u.flags.delete_data = wp->dnd_drag_destructive_op;
|
||||
tev.dragrequest.timestamp = gdk_dnd.last_drop_time;
|
||||
tev.dragrequest.data_type =
|
||||
gdk_atom_name(wp->dnd_drag_data_type);
|
||||
|
||||
gdk_event_put((GdkEvent *) &tev);
|
||||
gdk_event_put(&tev);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3828,8 +4028,8 @@ gdk_dnd_check_types (GdkWindow *window,
|
||||
|
||||
if (realfmt != (sizeof(Atom) * 8))
|
||||
{
|
||||
g_warning("XdeTypelist property had format of %d instead of the expected %d, on window %#lx\n",
|
||||
realfmt, sizeof(Atom) * 8, xevent->xclient.data.l[0]);
|
||||
g_warning("XdeTypelist property had format of %d instead of the expected %ld, on window %#lx\n",
|
||||
realfmt, (glong)sizeof(Atom) * 8, xevent->xclient.data.l[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4005,7 +4205,7 @@ gdk_event_send_clientmessage_toall(GdkEvent *event)
|
||||
curwin = gdk_get_client_window(gdk_display, ret_children[i]);
|
||||
sev.xclient.window = curwin;
|
||||
if (!gdk_send_xevent (curwin, False, NoEventMask, &sev))
|
||||
GDK_NOTE (MISC, g_print("Sending client message %ld to %#lx failed\n",
|
||||
GDK_NOTE (MISC, g_print("Gdk: Sending client message %ld to %#lx failed\n",
|
||||
event->client.message_type, curwin));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "../config.h"
|
||||
#include <stdlib.h>
|
||||
@@ -44,6 +45,7 @@ gdk_pixmap_new (GdkWindow *window,
|
||||
GdkWindowPrivate *window_private;
|
||||
|
||||
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
|
||||
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
||||
|
||||
if (!window)
|
||||
window = (GdkWindow*) &gdk_root_parent;
|
||||
@@ -53,7 +55,7 @@ gdk_pixmap_new (GdkWindow *window,
|
||||
return NULL;
|
||||
|
||||
if (depth == -1)
|
||||
gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
|
||||
depth = gdk_window_get_visual (window)->depth;
|
||||
|
||||
private = g_new (GdkWindowPrivate, 1);
|
||||
pixmap = (GdkPixmap*) private;
|
||||
@@ -62,6 +64,7 @@ gdk_pixmap_new (GdkWindow *window,
|
||||
private->window_type = GDK_WINDOW_PIXMAP;
|
||||
private->xwindow = XCreatePixmap (private->xdisplay, window_private->xwindow,
|
||||
width, height, depth);
|
||||
private->colormap = NULL;
|
||||
private->parent = NULL;
|
||||
private->x = 0;
|
||||
private->y = 0;
|
||||
@@ -87,6 +90,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
|
||||
GdkWindowPrivate *window_private;
|
||||
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
||||
|
||||
if (!window)
|
||||
window = (GdkWindow*) &gdk_root_parent;
|
||||
@@ -135,6 +139,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
|
||||
g_return_val_if_fail (fg != NULL, NULL);
|
||||
g_return_val_if_fail (bg != NULL, NULL);
|
||||
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
|
||||
g_return_val_if_fail ((width != 0) && (height != 0), NULL);
|
||||
|
||||
if (!window)
|
||||
window = (GdkWindow*) &gdk_root_parent;
|
||||
@@ -144,7 +149,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
|
||||
return NULL;
|
||||
|
||||
if (depth == -1)
|
||||
gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
|
||||
depth = gdk_window_get_visual (window)->depth;
|
||||
|
||||
private = g_new (GdkWindowPrivate, 1);
|
||||
pixmap = (GdkPixmap*) private;
|
||||
@@ -179,13 +184,13 @@ gdk_pixmap_seek_string (FILE *infile,
|
||||
|
||||
while (!feof (infile))
|
||||
{
|
||||
fscanf (infile, "%s", instr);
|
||||
fscanf (infile, "%1023s", instr);
|
||||
if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
|
||||
{
|
||||
fscanf (infile, "%s", instr);
|
||||
fscanf (infile, "%1023s", instr);
|
||||
while (!feof (infile) && strcmp (instr, "*/") != 0)
|
||||
fscanf (infile, "%s", instr);
|
||||
fscanf(infile, "%s", instr);
|
||||
fscanf (infile, "%1023s", instr);
|
||||
fscanf(infile, "%1023s", instr);
|
||||
}
|
||||
if (strcmp (instr, str)==0)
|
||||
return TRUE;
|
||||
@@ -198,29 +203,31 @@ gint
|
||||
gdk_pixmap_seek_char (FILE *infile,
|
||||
gchar c)
|
||||
{
|
||||
gchar b, oldb;
|
||||
gint b, oldb;
|
||||
|
||||
while (!feof (infile))
|
||||
while ((b = getc(infile)) != EOF)
|
||||
{
|
||||
fscanf(infile, "%c", &b);
|
||||
if (c != b && b == '/')
|
||||
{
|
||||
fscanf (infile, "%c", &b);
|
||||
if (b == '*')
|
||||
{
|
||||
oldb = b;
|
||||
while (!feof (infile) && !(oldb == '*' && b == '/'))
|
||||
{
|
||||
oldb = b;
|
||||
fscanf (infile, "%c", &b);
|
||||
}
|
||||
fscanf (infile, "%c", &b);
|
||||
}
|
||||
{
|
||||
b = getc (infile);
|
||||
if (b == EOF)
|
||||
return FALSE;
|
||||
else if (b == '*') /* we have a comment */
|
||||
{
|
||||
b = -1;
|
||||
do
|
||||
{
|
||||
oldb = b;
|
||||
b = getc (infile);
|
||||
if (b == EOF)
|
||||
return FALSE;
|
||||
}
|
||||
while (!(oldb == '*' && b == '/'));
|
||||
}
|
||||
}
|
||||
if (c == b)
|
||||
return TRUE;
|
||||
else if (c == b)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -229,42 +236,54 @@ gdk_pixmap_read_string (FILE *infile,
|
||||
gchar **buffer,
|
||||
guint *buffer_size)
|
||||
{
|
||||
gchar c;
|
||||
guint cnt = 0;
|
||||
gint c;
|
||||
guint cnt = 0, bufsiz, ret = FALSE;
|
||||
gchar *buf;
|
||||
|
||||
if ((*buffer) == NULL)
|
||||
buf = *buffer;
|
||||
bufsiz = *buffer_size;
|
||||
if (buf == NULL)
|
||||
{
|
||||
(*buffer_size) = 10 * sizeof (gchar);
|
||||
(*buffer) = (gchar *) malloc (*buffer_size);
|
||||
bufsiz = 10 * sizeof (gchar);
|
||||
buf = g_new(gchar, bufsiz);
|
||||
}
|
||||
|
||||
do
|
||||
fscanf (infile, "%c", &c);
|
||||
while (!feof (infile) && c != '"');
|
||||
c = getc (infile);
|
||||
while (c != EOF && c != '"');
|
||||
|
||||
if (c != '"')
|
||||
return FALSE;
|
||||
goto out;
|
||||
|
||||
while (!feof (infile))
|
||||
while ((c = getc(infile)) != EOF)
|
||||
{
|
||||
fscanf (infile, "%c", &c);
|
||||
|
||||
if (cnt == (*buffer_size))
|
||||
if (cnt == bufsiz)
|
||||
{
|
||||
(*buffer_size) *= 2;
|
||||
(*buffer) = (gchar *) realloc ((*buffer), *buffer_size);
|
||||
guint new_size = bufsiz * 2;
|
||||
if (new_size > bufsiz)
|
||||
bufsiz = new_size;
|
||||
else
|
||||
goto out;
|
||||
|
||||
buf = (gchar *) g_realloc (buf, bufsiz);
|
||||
buf[bufsiz-1] = '\0';
|
||||
}
|
||||
|
||||
if (c != '"')
|
||||
(*buffer)[cnt++] = c;
|
||||
buf[cnt++] = c;
|
||||
else
|
||||
{
|
||||
(*buffer)[cnt++] = 0;
|
||||
return TRUE;
|
||||
buf[cnt] = 0;
|
||||
ret = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
out:
|
||||
buf[bufsiz-1] = '\0'; /* ensure null termination for errors */
|
||||
*buffer = buf;
|
||||
*buffer_size = bufsiz;
|
||||
return ret;
|
||||
}
|
||||
|
||||
gchar*
|
||||
@@ -289,12 +308,16 @@ gdk_pixmap_skip_string (gchar *buffer)
|
||||
return &buffer[index];
|
||||
}
|
||||
|
||||
/* Xlib crashed ince at a color name lengths around 125 */
|
||||
#define MAX_COLOR_LEN 120
|
||||
|
||||
gchar*
|
||||
gdk_pixmap_extract_color (gchar *buffer)
|
||||
{
|
||||
gint counter, finished = FALSE, numnames;
|
||||
gint counter, numnames;
|
||||
gchar *ptr = NULL, ch, temp[128];
|
||||
gchar color[128], *retcol;
|
||||
gchar color[MAX_COLOR_LEN], *retcol;
|
||||
gint space;
|
||||
|
||||
counter = 0;
|
||||
while (ptr == NULL)
|
||||
@@ -311,9 +334,6 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
counter++;
|
||||
}
|
||||
|
||||
if (ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
ptr = gdk_pixmap_skip_whitespaces (ptr);
|
||||
|
||||
if (ptr[0] == 0)
|
||||
@@ -327,18 +347,26 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
color[0] = 0;
|
||||
numnames = 0;
|
||||
|
||||
while (finished == FALSE)
|
||||
space = MAX_COLOR_LEN - 1;
|
||||
while (space > 0)
|
||||
{
|
||||
sscanf (ptr, "%s", temp);
|
||||
sscanf (ptr, "%127s", temp);
|
||||
|
||||
if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
|
||||
strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)
|
||||
finished = TRUE;
|
||||
if (((gint)ptr[0] == 0) ||
|
||||
(strcmp ("s", temp) == 0) || (strcmp ("m", temp) == 0) ||
|
||||
(strcmp ("g", temp) == 0) || (strcmp ("g4", temp) == 0))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (numnames > 0)
|
||||
strcat (color, " ");
|
||||
strcat (color, temp);
|
||||
{
|
||||
space -= 1;
|
||||
strcat (color, " ");
|
||||
}
|
||||
strncat (color, temp, space);
|
||||
space -= MIN (space, strlen (temp));
|
||||
ptr = gdk_pixmap_skip_string (ptr);
|
||||
ptr = gdk_pixmap_skip_whitespaces (ptr);
|
||||
numnames++;
|
||||
@@ -349,6 +377,229 @@ 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
|
||||
{
|
||||
op_header,
|
||||
op_cmap,
|
||||
op_body
|
||||
};
|
||||
|
||||
|
||||
static GdkPixmap *
|
||||
_gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar * (*get_buf) (enum buffer_op op,
|
||||
gpointer handle),
|
||||
gpointer handle)
|
||||
{
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc = NULL;
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, n, ns, cnt, xcnt, ycnt, wbytes;
|
||||
gchar *buffer, pixel_str[32];
|
||||
_GdkPixmapColor *color = NULL, *fallbackcolor = NULL;
|
||||
gulong index;
|
||||
GHashTable *colors = NULL;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
buffer = (*get_buf) (op_header, handle);
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
|
||||
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
|
||||
if (cpp >= 32)
|
||||
{
|
||||
g_warning ("Pixmap has more than 31 characters per color\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
colors = 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 (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
|
||||
buffer = (*get_buf) (op_cmap, handle);
|
||||
if (buffer == NULL)
|
||||
goto error;
|
||||
|
||||
color = g_new (_GdkPixmapColor, 1);
|
||||
color->color_string = g_new (gchar, cpp + 1);
|
||||
strncpy (color->color_string, buffer, cpp);
|
||||
color->color_string[cpp] = 0;
|
||||
buffer += strlen (color->color_string);
|
||||
color->transparent = FALSE;
|
||||
|
||||
color_name = gdk_pixmap_extract_color (buffer);
|
||||
|
||||
if (color_name == NULL ||
|
||||
gdk_color_parse (color_name, &color->color) == FALSE)
|
||||
{
|
||||
color->color = *transparent_color;
|
||||
color->transparent = TRUE;
|
||||
}
|
||||
|
||||
g_free (color_name);
|
||||
|
||||
/* 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 (cnt == 0)
|
||||
fallbackcolor = color;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
|
||||
|
||||
if (mask)
|
||||
{
|
||||
/* The pixmap mask is just a bits pattern.
|
||||
* Color 0 is used for background and 1 for foreground.
|
||||
* We don't care about the colormap, we just need 0 and 1.
|
||||
*/
|
||||
GdkColor mask_pattern;
|
||||
|
||||
*mask = gdk_pixmap_new (window, width, height, 1);
|
||||
gc = gdk_gc_new (*mask);
|
||||
|
||||
mask_pattern.pixel = 0;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
|
||||
|
||||
mask_pattern.pixel = 1;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
}
|
||||
|
||||
wbytes = width * cpp;
|
||||
for (ycnt = 0; ycnt < height; ycnt++)
|
||||
{
|
||||
buffer = (*get_buf) (op_body, handle);
|
||||
|
||||
/* FIXME: this slows things down a little - it could be
|
||||
* integrated into the strncpy below, perhaps. OTOH, strlen
|
||||
* is fast.
|
||||
*/
|
||||
if ((buffer == NULL) || strlen (buffer) < wbytes)
|
||||
continue;
|
||||
|
||||
for (n = 0, cnt = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++)
|
||||
{
|
||||
strncpy (pixel_str, &buffer[n], cpp);
|
||||
pixel_str[cpp] = 0;
|
||||
ns = 0;
|
||||
|
||||
color = g_hash_table_lookup (colors, pixel_str);
|
||||
|
||||
if (!color) /* screwed up XPM file */
|
||||
color = fallbackcolor;
|
||||
|
||||
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
|
||||
|
||||
if (mask && color->transparent)
|
||||
{
|
||||
if (cnt < xcnt)
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
cnt = xcnt + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask && (cnt < xcnt))
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
}
|
||||
|
||||
error:
|
||||
|
||||
if (mask)
|
||||
gdk_gc_destroy (gc);
|
||||
|
||||
if (image != NULL)
|
||||
{
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
}
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
g_hash_table_foreach (colors, free_color, 0);
|
||||
g_hash_table_destroy (colors);
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
struct file_handle
|
||||
{
|
||||
FILE *infile;
|
||||
gchar *buffer;
|
||||
guint buffer_size;
|
||||
};
|
||||
|
||||
|
||||
static gchar *
|
||||
file_buffer (enum buffer_op op, gpointer handle)
|
||||
{
|
||||
struct file_handle *h = handle;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
case op_header:
|
||||
if (gdk_pixmap_seek_string (h->infile, "XPM", FALSE) != TRUE)
|
||||
break;
|
||||
|
||||
if (gdk_pixmap_seek_char (h->infile,'{') != TRUE)
|
||||
break;
|
||||
/* Fall through to the next gdk_pixmap_seek_char. */
|
||||
|
||||
case op_cmap:
|
||||
gdk_pixmap_seek_char (h->infile, '"');
|
||||
fseek (h->infile, -1, SEEK_CUR);
|
||||
/* Fall through to the gdk_pixmap_read_string. */
|
||||
|
||||
case op_body:
|
||||
gdk_pixmap_read_string (h->infile, &h->buffer, &h->buffer_size);
|
||||
return h->buffer;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
|
||||
@@ -357,166 +608,18 @@ gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
FILE *infile = NULL;
|
||||
struct file_handle h;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt;
|
||||
gchar *buffer = NULL, pixel_str[32];
|
||||
guint buffer_size = 0;
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
memset (&h, 0, sizeof (h));
|
||||
h.infile = fopen (filename, "rb");
|
||||
if (h.infile != NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
infile = fopen (filename, "rb");
|
||||
if (infile != NULL)
|
||||
{
|
||||
if (gdk_pixmap_seek_string (infile, "XPM", FALSE) == TRUE)
|
||||
{
|
||||
if (gdk_pixmap_seek_char (infile,'{') == TRUE)
|
||||
{
|
||||
gdk_pixmap_seek_char (infile, '"');
|
||||
fseek (infile, -1, SEEK_CUR);
|
||||
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
|
||||
|
||||
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
transparent_color = &tmp_color;
|
||||
}
|
||||
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
|
||||
gdk_pixmap_seek_char (infile, '"');
|
||||
fseek (infile, -1, SEEK_CUR);
|
||||
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
|
||||
|
||||
colors[cnt].color_string = g_new(gchar, cpp + 1);
|
||||
for (n = 0; n < cpp; n++)
|
||||
colors[cnt].color_string[n] = buffer[n];
|
||||
colors[cnt].color_string[n] = 0;
|
||||
colors[cnt].transparent = FALSE;
|
||||
|
||||
color_name = gdk_pixmap_extract_color (&buffer[cpp]);
|
||||
|
||||
if (color_name != NULL)
|
||||
{
|
||||
if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
|
||||
g_free (color_name);
|
||||
|
||||
gdk_color_alloc (colormap, &colors[cnt].color);
|
||||
}
|
||||
|
||||
index = 0;
|
||||
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
|
||||
|
||||
gc = NULL;
|
||||
if (mask)
|
||||
{
|
||||
/* The pixmap mask is just a bits pattern.
|
||||
* Color 0 is used for background and 1 for foreground.
|
||||
* We don't care about the colormap, we just need 0 and 1.
|
||||
*/
|
||||
GdkColor mask_pattern;
|
||||
|
||||
*mask = gdk_pixmap_new (window, width, height, 1);
|
||||
gc = gdk_gc_new (*mask);
|
||||
|
||||
mask_pattern.pixel = 0;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
|
||||
|
||||
mask_pattern.pixel = 1;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
}
|
||||
|
||||
for (ycnt = 0; ycnt < height; ycnt++)
|
||||
{
|
||||
gdk_pixmap_read_string (infile, &buffer, &buffer_size);
|
||||
|
||||
for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
|
||||
{
|
||||
strncpy (pixel_str, &buffer[n], cpp);
|
||||
pixel_str[cpp] = 0;
|
||||
color = NULL;
|
||||
ns = 0;
|
||||
|
||||
while (color == NULL)
|
||||
{
|
||||
if (strcmp (pixel_str, colors[ns].color_string) == 0)
|
||||
color = &colors[ns];
|
||||
else
|
||||
ns++;
|
||||
}
|
||||
|
||||
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
|
||||
|
||||
if (mask && color->transparent)
|
||||
{
|
||||
if (cnt < xcnt)
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
cnt = xcnt + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask && (cnt < xcnt))
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
gdk_gc_destroy (gc);
|
||||
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
}
|
||||
}
|
||||
|
||||
fclose (infile);
|
||||
free (buffer);
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
g_free (colors[cnt].color_string);
|
||||
g_free (colors);
|
||||
}
|
||||
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
|
||||
transparent_color,
|
||||
file_buffer, &h);
|
||||
fclose (h.infile);
|
||||
g_free (h.buffer);
|
||||
}
|
||||
|
||||
return pixmap;
|
||||
@@ -528,11 +631,34 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
|
||||
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
|
||||
transparent_color, filename);
|
||||
}
|
||||
|
||||
|
||||
struct mem_handle
|
||||
{
|
||||
gchar **data;
|
||||
int offset;
|
||||
};
|
||||
|
||||
|
||||
static gchar *
|
||||
mem_buffer (enum buffer_op op, gpointer handle)
|
||||
{
|
||||
struct mem_handle *h = handle;
|
||||
switch (op)
|
||||
{
|
||||
case op_header:
|
||||
case op_cmap:
|
||||
case op_body:
|
||||
if (h->data[h->offset])
|
||||
return h->data[h->offset ++];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
@@ -540,152 +666,18 @@ gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
{
|
||||
struct mem_handle h;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
gint width, height, num_cols, cpp, cnt, n, ns, xcnt, ycnt, i;
|
||||
gchar *buffer, pixel_str[32];
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
i = 0;
|
||||
buffer = data[i++];
|
||||
sscanf (buffer,"%d %d %d %d", &width, &height, &num_cols, &cpp);
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
transparent_color = &tmp_color;
|
||||
}
|
||||
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
{
|
||||
gchar *color_name;
|
||||
|
||||
buffer = data[i++];
|
||||
|
||||
colors[cnt].color_string = g_new(gchar, cpp + 1);
|
||||
for (n = 0; n < cpp; n++)
|
||||
colors[cnt].color_string[n] = buffer[n];
|
||||
colors[cnt].color_string[n] = 0;
|
||||
colors[cnt].transparent = FALSE;
|
||||
|
||||
color_name = gdk_pixmap_extract_color (&buffer[cpp]);
|
||||
|
||||
if (color_name != NULL)
|
||||
{
|
||||
if (gdk_color_parse (color_name, &colors[cnt].color) == FALSE)
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
colors[cnt].color = *transparent_color;
|
||||
colors[cnt].transparent = TRUE;
|
||||
}
|
||||
|
||||
g_free (color_name);
|
||||
|
||||
gdk_color_alloc (colormap, &colors[cnt].color);
|
||||
}
|
||||
|
||||
index = 0;
|
||||
image = gdk_image_new (GDK_IMAGE_FASTEST, visual, width, height);
|
||||
|
||||
gc = NULL;
|
||||
if (mask)
|
||||
{
|
||||
/* The pixmap mask is just a bits pattern.
|
||||
* Color 0 is used for background and 1 for foreground.
|
||||
* We don't care about the colormap, we just need 0 and 1.
|
||||
*/
|
||||
GdkColor mask_pattern;
|
||||
|
||||
*mask = gdk_pixmap_new (window, width, height, 1);
|
||||
gc = gdk_gc_new (*mask);
|
||||
|
||||
mask_pattern.pixel = 0;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
gdk_draw_rectangle (*mask, gc, TRUE, 0, 0, -1, -1);
|
||||
|
||||
mask_pattern.pixel = 1;
|
||||
gdk_gc_set_foreground (gc, &mask_pattern);
|
||||
}
|
||||
|
||||
for (ycnt = 0; ycnt < height; ycnt++)
|
||||
{
|
||||
buffer = data[i++];
|
||||
|
||||
for (n = 0, cnt = 0, xcnt = 0; n < (width * cpp); n += cpp, xcnt++)
|
||||
{
|
||||
strncpy (pixel_str, &buffer[n], cpp);
|
||||
pixel_str[cpp] = 0;
|
||||
color = NULL;
|
||||
ns = 0;
|
||||
|
||||
while (color == NULL)
|
||||
{
|
||||
if (strcmp (pixel_str, colors[ns].color_string) == 0)
|
||||
color = &colors[ns];
|
||||
else
|
||||
ns++;
|
||||
}
|
||||
|
||||
gdk_image_put_pixel (image, xcnt, ycnt, color->color.pixel);
|
||||
|
||||
if (mask && color->transparent)
|
||||
{
|
||||
if (cnt < xcnt)
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
cnt = xcnt + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (mask && (cnt < xcnt))
|
||||
gdk_draw_line (*mask, gc, cnt, ycnt, xcnt - 1, ycnt);
|
||||
}
|
||||
|
||||
if (mask)
|
||||
gdk_gc_destroy (gc);
|
||||
|
||||
pixmap = gdk_pixmap_new (window, width, height, visual->depth);
|
||||
|
||||
gc = gdk_gc_new (pixmap);
|
||||
gdk_gc_set_foreground (gc, transparent_color);
|
||||
gdk_draw_image (pixmap, gc, image, 0, 0, 0, 0, image->width, image->height);
|
||||
gdk_gc_destroy (gc);
|
||||
gdk_image_destroy (image);
|
||||
|
||||
if (colors != NULL)
|
||||
{
|
||||
for (cnt = 0; cnt < num_cols; cnt++)
|
||||
g_free (colors[cnt].color_string);
|
||||
g_free (colors);
|
||||
}
|
||||
|
||||
memset (&h, 0, sizeof (h));
|
||||
h.data = data;
|
||||
pixmap = _gdk_pixmap_create_from_xpm (window, colormap, mask,
|
||||
transparent_color,
|
||||
mem_buffer, &h);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
@@ -118,6 +119,39 @@ gdk_region_rect_in (GdkRegion *region,
|
||||
return GDK_OVERLAP_RECTANGLE_OUT; /*what else ? */
|
||||
}
|
||||
|
||||
GdkRegion *
|
||||
gdk_region_polygon (GdkPoint *points,
|
||||
gint npoints,
|
||||
GdkFillRule fill_rule)
|
||||
{
|
||||
GdkRegionPrivate *private;
|
||||
GdkRegion *region;
|
||||
Region xregion;
|
||||
gint xfill_rule = EvenOddRule;
|
||||
|
||||
g_return_val_if_fail (points != NULL, NULL);
|
||||
g_return_val_if_fail (npoints != 0, NULL); /* maybe we should check for at least three points */
|
||||
|
||||
switch (fill_rule)
|
||||
{
|
||||
case GDK_EVEN_ODD_RULE:
|
||||
xfill_rule = EvenOddRule;
|
||||
break;
|
||||
|
||||
case GDK_WINDING_RULE:
|
||||
xfill_rule = WindingRule;
|
||||
break;
|
||||
}
|
||||
|
||||
xregion = XPolygonRegion ((XPoint *) points, npoints, xfill_rule);
|
||||
private = g_new (GdkRegionPrivate, 1);
|
||||
private->xregion = xregion;
|
||||
region = (GdkRegion *) private;
|
||||
region->user_data = NULL;
|
||||
|
||||
return region;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_region_offset (GdkRegion *region,
|
||||
gint dx,
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
@@ -40,7 +41,9 @@ static gint navailable_depths;
|
||||
static GdkVisualType available_types[6];
|
||||
static gint navailable_types;
|
||||
|
||||
static char* visual_names[] =
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
static gchar* visual_names[] =
|
||||
{
|
||||
"static gray",
|
||||
"grayscale",
|
||||
@@ -50,10 +53,12 @@ static char* visual_names[] =
|
||||
"direct color",
|
||||
};
|
||||
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
|
||||
static GHashTable *visual_hash = NULL;
|
||||
|
||||
void
|
||||
gdk_visual_init ()
|
||||
gdk_visual_init (void)
|
||||
{
|
||||
static gint possible_depths[6] = { 32, 24, 16, 15, 8, 1 };
|
||||
static GdkVisualType possible_types[6] =
|
||||
@@ -204,7 +209,7 @@ gdk_visual_init ()
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (gdk_debug_flags & GDK_DEBUG_MISC)
|
||||
for (i = 0; i < nvisuals; i++)
|
||||
g_print ("visual: %s: %d\n",
|
||||
g_print ("Gdk: visual: %s: %d\n",
|
||||
visual_names[visuals[i].visual.type],
|
||||
visuals[i].visual.depth);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
@@ -258,25 +263,25 @@ gdk_visual_unref (GdkVisual *visual)
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_visual_get_best_depth ()
|
||||
gdk_visual_get_best_depth (void)
|
||||
{
|
||||
return available_depths[0];
|
||||
}
|
||||
|
||||
GdkVisualType
|
||||
gdk_visual_get_best_type ()
|
||||
gdk_visual_get_best_type (void)
|
||||
{
|
||||
return available_types[0];
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_system ()
|
||||
gdk_visual_get_system (void)
|
||||
{
|
||||
return ((GdkVisual*) system_visual);
|
||||
}
|
||||
|
||||
GdkVisual*
|
||||
gdk_visual_get_best ()
|
||||
gdk_visual_get_best (void)
|
||||
{
|
||||
return ((GdkVisual*) &(visuals[0]));
|
||||
}
|
||||
@@ -350,12 +355,17 @@ gdk_query_visual_types (GdkVisualType **visual_types,
|
||||
*visual_types = available_types;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_query_visuals (GdkVisual **visual_return,
|
||||
gint *count)
|
||||
GList*
|
||||
gdk_list_visuals (void)
|
||||
{
|
||||
*count = nvisuals;
|
||||
*visual_return = (GdkVisual*) visuals;
|
||||
GList *list;
|
||||
guint i;
|
||||
|
||||
list = NULL;
|
||||
for (i = 0; i < nvisuals; ++i)
|
||||
list = g_list_append (list, (gpointer) &visuals[i]);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,13 +12,14 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <netinet/in.h>
|
||||
#include "gdk.h"
|
||||
#include "../config.h"
|
||||
@@ -28,6 +29,10 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
int nevent_masks = 17;
|
||||
int event_mask_table[19] =
|
||||
{
|
||||
@@ -55,14 +60,17 @@ int event_mask_table[19] =
|
||||
|
||||
/* internal function created for and used by gdk_window_xid_at_coords */
|
||||
Window
|
||||
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
|
||||
gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y,
|
||||
GList *excludes, gboolean excl_child)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *private;
|
||||
Display *disp;
|
||||
Window *list=NULL;
|
||||
Window child=0,parent_win=0,root_win=0;
|
||||
unsigned int num,i,ww,wh,wb,wd;
|
||||
|
||||
int i;
|
||||
unsigned int ww, wh, wb, wd, num;
|
||||
int wx,wy;
|
||||
|
||||
window=(GdkWindow*)&gdk_root_parent;
|
||||
@@ -71,22 +79,27 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
|
||||
if (!XGetGeometry(disp,base,&root_win,&wx,&wy,&ww,&wh,&wb,&wd))
|
||||
return 0;
|
||||
wx+=bx;wy+=by;
|
||||
if (!((x>=wx)&&(y>=wy)&&(x<(wx+ww))&&(y<(wy+wh))))
|
||||
if (!((x>=wx)&&(y>=wy)&&(x<(int)(wx+ww))&&(y<(int)(wy+wh))))
|
||||
return 0;
|
||||
if (!XQueryTree(disp,base,&root_win,&parent_win,&list,&num))
|
||||
return base;
|
||||
if (list)
|
||||
{
|
||||
for (i=num-1;i>=0;i--)
|
||||
for (i=num-1;;i--)
|
||||
{
|
||||
if ((child=gdk_window_xid_at(list[i],wx,wy,x,y))!=0)
|
||||
if ((!excl_child)||(!g_list_find(excludes,(gpointer *)list[i])))
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
if ((child=gdk_window_xid_at(list[i],wx,wy,x,y,excludes,excl_child))!=0)
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
if (!i) break;
|
||||
}
|
||||
XFree(list);
|
||||
}
|
||||
return 0;
|
||||
return base;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -103,48 +116,66 @@ gdk_window_xid_at(Window base, gint bx, gint by, gint x, gint y)
|
||||
* those X,Y co-ordinates.
|
||||
*/
|
||||
Window
|
||||
gdk_window_xid_at_coords(gint x, gint y, GList *excludes)
|
||||
gdk_window_xid_at_coords(gint x, gint y, GList *excludes, gboolean excl_child)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *private;
|
||||
Display *disp;
|
||||
Window *list=NULL;
|
||||
Window root,child=0,parent_win=0,root_win=0;
|
||||
unsigned int num,i;
|
||||
unsigned int num;
|
||||
int i;
|
||||
|
||||
window=(GdkWindow*)&gdk_root_parent;
|
||||
private=(GdkWindowPrivate*)window;
|
||||
disp=private->xdisplay;
|
||||
root=private->xwindow;
|
||||
XGrabServer(disp);
|
||||
num=g_list_length(excludes);
|
||||
if (!XQueryTree(disp,root,&root_win,&parent_win,&list,&num))
|
||||
return root;
|
||||
return root;
|
||||
if (list)
|
||||
{
|
||||
for (i=num-1;i>=0;i--)
|
||||
{
|
||||
if ((child=gdk_window_xid_at(list[i],0,0,x,y))!=0)
|
||||
{
|
||||
if (excludes)
|
||||
{
|
||||
if (!g_list_find(excludes,(gpointer)child))
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XFree(list);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
i = num - 1;
|
||||
do
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
|
||||
XGetWindowAttributes (disp, list [i], &xwa);
|
||||
|
||||
if (xwa.map_state != IsViewable)
|
||||
continue;
|
||||
|
||||
if (excl_child && g_list_find(excludes,(gpointer *)list[i]))
|
||||
continue;
|
||||
|
||||
if ((child = gdk_window_xid_at (list[i], 0, 0, x, y, excludes, excl_child)) == 0)
|
||||
continue;
|
||||
|
||||
if (excludes)
|
||||
{
|
||||
if (!g_list_find(excludes,(gpointer *)child))
|
||||
{
|
||||
XFree(list);
|
||||
XUngrabServer(disp);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
XFree(list);
|
||||
XUngrabServer(disp);
|
||||
return child;
|
||||
}
|
||||
} while (--i > 0);
|
||||
XFree(list);
|
||||
}
|
||||
XUngrabServer(disp);
|
||||
return root;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_window_init ()
|
||||
gdk_window_init (void)
|
||||
{
|
||||
XWindowAttributes xattributes;
|
||||
unsigned int width;
|
||||
@@ -163,6 +194,8 @@ gdk_window_init ()
|
||||
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;
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
@@ -174,7 +207,6 @@ gdk_window_new (GdkWindow *parent,
|
||||
GdkWindowPrivate *private;
|
||||
GdkWindowPrivate *parent_private;
|
||||
GdkVisual *visual;
|
||||
GdkColormap *colormap;
|
||||
Display *parent_display;
|
||||
Window xparent;
|
||||
Visual *xvisual;
|
||||
@@ -204,6 +236,10 @@ gdk_window_new (GdkWindow *parent,
|
||||
window = (GdkWindow*) private;
|
||||
|
||||
private->parent = parent;
|
||||
|
||||
if (parent_private)
|
||||
parent_private->children = g_list_prepend (parent_private->children, window);
|
||||
|
||||
private->xdisplay = parent_display;
|
||||
private->destroyed = FALSE;
|
||||
private->resize_count = 0;
|
||||
@@ -236,6 +272,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
private->dnd_drag_eventmask = private->dnd_drag_savedeventmask = 0;
|
||||
|
||||
private->filters = NULL;
|
||||
private->children = NULL;
|
||||
|
||||
window->user_data = NULL;
|
||||
|
||||
@@ -268,9 +305,9 @@ gdk_window_new (GdkWindow *parent,
|
||||
depth = visual->depth;
|
||||
|
||||
if (attributes_mask & GDK_WA_COLORMAP)
|
||||
colormap = attributes->colormap;
|
||||
private->colormap = attributes->colormap;
|
||||
else
|
||||
colormap = gdk_colormap_get_system ();
|
||||
private->colormap = gdk_colormap_get_system ();
|
||||
|
||||
xattributes.background_pixel = BlackPixel (gdk_display, gdk_screen);
|
||||
xattributes.border_pixel = BlackPixel (gdk_display, gdk_screen);
|
||||
@@ -279,26 +316,26 @@ gdk_window_new (GdkWindow *parent,
|
||||
switch (private->window_type)
|
||||
{
|
||||
case GDK_WINDOW_TOPLEVEL:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
|
||||
xparent = gdk_root_window;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_CHILD:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_DIALOG:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
|
||||
xparent = gdk_root_window;
|
||||
break;
|
||||
|
||||
case GDK_WINDOW_TEMP:
|
||||
xattributes.colormap = ((GdkColormapPrivate*) colormap)->xcolormap;
|
||||
xattributes.colormap = ((GdkColormapPrivate*) private->colormap)->xcolormap;
|
||||
xattributes_mask |= CWColormap;
|
||||
|
||||
xparent = gdk_root_window;
|
||||
@@ -320,7 +357,7 @@ gdk_window_new (GdkWindow *parent,
|
||||
{
|
||||
depth = 0;
|
||||
class = InputOnly;
|
||||
colormap = NULL;
|
||||
private->colormap = NULL;
|
||||
}
|
||||
|
||||
private->xwindow = XCreateWindow (private->xdisplay, xparent,
|
||||
@@ -330,6 +367,13 @@ gdk_window_new (GdkWindow *parent,
|
||||
gdk_window_ref (window);
|
||||
gdk_xid_table_insert (&private->xwindow, window);
|
||||
|
||||
if (private->colormap)
|
||||
gdk_colormap_ref (private->colormap);
|
||||
|
||||
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
|
||||
(attributes->cursor) :
|
||||
NULL));
|
||||
|
||||
switch (private->window_type)
|
||||
{
|
||||
case GDK_WINDOW_DIALOG:
|
||||
@@ -340,29 +384,34 @@ gdk_window_new (GdkWindow *parent,
|
||||
break;
|
||||
case GDK_WINDOW_CHILD:
|
||||
if ((attributes->wclass == GDK_INPUT_OUTPUT) &&
|
||||
(colormap != gdk_colormap_get_system ()) &&
|
||||
(colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
|
||||
(private->colormap != gdk_colormap_get_system ()) &&
|
||||
(private->colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
|
||||
{
|
||||
g_print ("adding colormap window\n");
|
||||
GDK_NOTE (MISC, g_print ("adding colormap window\n"));
|
||||
gdk_window_add_colormap_windows (window);
|
||||
}
|
||||
break;
|
||||
|
||||
return window;
|
||||
default:
|
||||
break;
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
size_hints.flags = PSize | PBaseSize;
|
||||
size_hints.flags = PSize;
|
||||
size_hints.width = private->width;
|
||||
size_hints.height = private->height;
|
||||
size_hints.base_width = private->width;
|
||||
size_hints.base_height = private->height;
|
||||
|
||||
wm_hints.flags = InputHint | StateHint | WindowGroupHint;
|
||||
wm_hints.window_group = gdk_leader_window;
|
||||
wm_hints.input = True;
|
||||
wm_hints.initial_state = NormalState;
|
||||
|
||||
/* FIXME: Is there any point in doing this? Do any WM's pay
|
||||
* attention to PSize, and even if they do, is this the
|
||||
* correct value???
|
||||
*/
|
||||
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
|
||||
|
||||
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
|
||||
|
||||
if (attributes_mask & GDK_WA_TITLE)
|
||||
@@ -384,9 +433,6 @@ gdk_window_new (GdkWindow *parent,
|
||||
XFree (class_hint);
|
||||
}
|
||||
|
||||
gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
|
||||
(attributes->cursor) :
|
||||
NULL));
|
||||
|
||||
return window;
|
||||
}
|
||||
@@ -396,14 +442,28 @@ gdk_window_foreign_new (guint32 anid)
|
||||
{
|
||||
GdkWindow *window;
|
||||
GdkWindowPrivate *private;
|
||||
GdkWindowPrivate *parent_private;
|
||||
XWindowAttributes attrs;
|
||||
Window root, parent;
|
||||
Window *children;
|
||||
guint nchildren;
|
||||
|
||||
private = g_new (GdkWindowPrivate, 1);
|
||||
window = (GdkWindow*) private;
|
||||
|
||||
XGetWindowAttributes (gdk_display, anid, &attrs);
|
||||
|
||||
private->parent = NULL;
|
||||
/* FIXME: This is pretty expensive. Maybe the caller should supply
|
||||
* the parent */
|
||||
XQueryTree (gdk_display, anid, &root, &parent, &children, &nchildren);
|
||||
XFree (children);
|
||||
private->parent = gdk_xid_table_lookup (parent);
|
||||
|
||||
parent_private = (GdkWindowPrivate *)private->parent;
|
||||
|
||||
if (parent_private)
|
||||
parent_private->children = g_list_prepend (parent_private->children, window);
|
||||
|
||||
private->xwindow = anid;
|
||||
private->xdisplay = gdk_display;
|
||||
private->x = attrs.x;
|
||||
@@ -412,16 +472,23 @@ gdk_window_foreign_new (guint32 anid)
|
||||
private->height = attrs.height;
|
||||
private->resize_count = 0;
|
||||
private->ref_count = 1;
|
||||
if (anid == attrs.root)
|
||||
private->window_type = GDK_WINDOW_ROOT;
|
||||
else
|
||||
private->window_type = GDK_WINDOW_TOPLEVEL;
|
||||
/* the above is probably wrong, but it may not be worth the extra
|
||||
X call to get it right */
|
||||
|
||||
private->window_type = GDK_WINDOW_FOREIGN;
|
||||
private->destroyed = FALSE;
|
||||
private->extension_events = 0;
|
||||
|
||||
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;
|
||||
|
||||
window->user_data = NULL;
|
||||
|
||||
@@ -438,7 +505,8 @@ gdk_window_foreign_new (guint32 anid)
|
||||
window. */
|
||||
|
||||
static void
|
||||
gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
gdk_window_internal_destroy (GdkWindow *window, gboolean xdestroy,
|
||||
gboolean our_destroy)
|
||||
{
|
||||
GdkWindowPrivate *private;
|
||||
GdkWindowPrivate *temp_private;
|
||||
@@ -456,22 +524,34 @@ gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
case GDK_WINDOW_CHILD:
|
||||
case GDK_WINDOW_DIALOG:
|
||||
case GDK_WINDOW_TEMP:
|
||||
case GDK_WINDOW_FOREIGN:
|
||||
if (!private->destroyed)
|
||||
{
|
||||
children = gdk_window_get_children (window);
|
||||
tmp = children;
|
||||
|
||||
while (tmp)
|
||||
if (private->parent)
|
||||
{
|
||||
temp_window = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
temp_private = (GdkWindowPrivate*) temp_window;
|
||||
if (temp_private)
|
||||
gdk_window_internal_destroy (temp_window, FALSE);
|
||||
GdkWindowPrivate *parent_private = (GdkWindowPrivate *)private->parent;
|
||||
if (parent_private->children)
|
||||
parent_private->children = g_list_remove (parent_private->children, window);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
if (private->window_type != GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
children = tmp = private->children;
|
||||
private->children = NULL;
|
||||
|
||||
while (tmp)
|
||||
{
|
||||
temp_window = tmp->data;
|
||||
tmp = tmp->next;
|
||||
|
||||
temp_private = (GdkWindowPrivate*) temp_window;
|
||||
if (temp_private)
|
||||
gdk_window_internal_destroy (temp_window, FALSE,
|
||||
our_destroy);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
if (private->extension_events != 0)
|
||||
gdk_input_window_destroy (window);
|
||||
@@ -487,8 +567,50 @@ gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
private->dnd_drop_data_typesavail = NULL;
|
||||
}
|
||||
|
||||
if (xdestroy)
|
||||
if (private->filters)
|
||||
{
|
||||
tmp = private->filters;
|
||||
|
||||
while (tmp)
|
||||
{
|
||||
g_free (tmp->data);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
g_list_free (private->filters);
|
||||
private->filters = NULL;
|
||||
}
|
||||
|
||||
if (private->window_type == GDK_WINDOW_FOREIGN)
|
||||
{
|
||||
if (our_destroy && (private->parent != NULL))
|
||||
{
|
||||
/* It's somebody elses window, but in our heirarchy,
|
||||
* so reparent it to the root window, and then send
|
||||
* it a delete event, as if we were a WM
|
||||
*/
|
||||
XClientMessageEvent xevent;
|
||||
|
||||
gdk_window_hide (window);
|
||||
gdk_window_reparent (window, NULL, 0, 0);
|
||||
|
||||
xevent.type = ClientMessage;
|
||||
xevent.window = private->xwindow;
|
||||
xevent.message_type = gdk_wm_protocols;
|
||||
xevent.format = 32;
|
||||
xevent.data.l[0] = gdk_wm_delete_window;
|
||||
xevent.data.l[1] = CurrentTime;
|
||||
|
||||
XSendEvent (private->xdisplay, private->xwindow,
|
||||
False, 0, (XEvent *)&xevent);
|
||||
}
|
||||
}
|
||||
else if (xdestroy)
|
||||
XDestroyWindow (private->xdisplay, private->xwindow);
|
||||
|
||||
if (private->colormap)
|
||||
gdk_colormap_unref (private->colormap);
|
||||
|
||||
private->destroyed = TRUE;
|
||||
}
|
||||
break;
|
||||
@@ -509,7 +631,7 @@ gdk_window_internal_destroy (GdkWindow *window, int xdestroy)
|
||||
void
|
||||
gdk_window_destroy (GdkWindow *window)
|
||||
{
|
||||
gdk_window_internal_destroy (window, TRUE);
|
||||
gdk_window_internal_destroy (window, TRUE, TRUE);
|
||||
gdk_window_unref (window);
|
||||
}
|
||||
|
||||
@@ -524,6 +646,14 @@ gdk_window_destroy_notify (GdkWindow *window)
|
||||
|
||||
private = (GdkWindowPrivate*) window;
|
||||
|
||||
if (!private->destroyed)
|
||||
{
|
||||
if (private->window_type == GDK_WINDOW_FOREIGN)
|
||||
gdk_window_internal_destroy (window, FALSE, FALSE);
|
||||
else
|
||||
g_warning ("GdkWindow %#lx unexpectedly destroyed", private->xwindow);
|
||||
}
|
||||
|
||||
gdk_xid_table_remove (private->xwindow);
|
||||
gdk_window_unref (window);
|
||||
}
|
||||
@@ -959,6 +1089,11 @@ gdk_window_set_colormap (GdkWindow *window,
|
||||
XSetWindowColormap (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
colormap_private->xcolormap);
|
||||
|
||||
if (window_private->colormap)
|
||||
gdk_colormap_unref (window_private->colormap);
|
||||
window_private->colormap = colormap;
|
||||
gdk_colormap_ref (window_private->colormap);
|
||||
|
||||
if (window_private->window_type != GDK_WINDOW_TOPLEVEL)
|
||||
gdk_window_add_colormap_windows (window);
|
||||
@@ -1053,20 +1188,27 @@ gdk_window_get_visual (GdkWindow *window)
|
||||
{
|
||||
GdkWindowPrivate *window_private;
|
||||
XWindowAttributes window_attributes;
|
||||
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
|
||||
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
/* Huh? ->parent is never set for a pixmap. We should just return
|
||||
* null immeditately
|
||||
*/
|
||||
while (window_private && (window_private->window_type == GDK_WINDOW_PIXMAP))
|
||||
window_private = (GdkWindowPrivate*) window_private->parent;
|
||||
|
||||
if (window_private && !window_private->destroyed)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
|
||||
return gdk_visual_lookup (window_attributes.visual);
|
||||
if (window_private->colormap == NULL)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
return gdk_visual_lookup (window_attributes.visual);
|
||||
}
|
||||
else
|
||||
return ((GdkColormapPrivate *)window_private->colormap)->visual;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1079,16 +1221,20 @@ gdk_window_get_colormap (GdkWindow *window)
|
||||
XWindowAttributes window_attributes;
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
|
||||
|
||||
g_return_val_if_fail (window_private->window_type != GDK_WINDOW_PIXMAP, NULL);
|
||||
if (!window_private->destroyed)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
|
||||
return gdk_colormap_lookup (window_attributes.colormap);
|
||||
if (window_private->colormap == NULL)
|
||||
{
|
||||
XGetWindowAttributes (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
&window_attributes);
|
||||
return gdk_colormap_lookup (window_attributes.colormap);
|
||||
}
|
||||
else
|
||||
return window_private->colormap;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -1336,8 +1482,7 @@ gdk_window_add_colormap_windows (GdkWindow *window)
|
||||
|
||||
/*
|
||||
* This needs the X11 shape extension.
|
||||
* If not available, simply remove the call to
|
||||
* XShapeCombineMask. Shaped windows will look
|
||||
* If not available, shaped windows will look
|
||||
* ugly, but programs still work. Stefan Wille
|
||||
*/
|
||||
void
|
||||
@@ -1345,35 +1490,53 @@ 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);
|
||||
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (mask)
|
||||
#ifdef HAVE_SHAPE_EXT
|
||||
if (have_shape == UNKNOWN)
|
||||
{
|
||||
GdkWindowPrivate *pixmap_private;
|
||||
|
||||
pixmap_private = (GdkWindowPrivate*) mask;
|
||||
pixmap = (Pixmap) pixmap_private->xwindow;
|
||||
int ignore;
|
||||
if (XQueryExtension(gdk_display, "SHAPE", &ignore, &ignore, &ignore))
|
||||
have_shape = YES;
|
||||
else
|
||||
have_shape = NO;
|
||||
}
|
||||
else
|
||||
|
||||
if (have_shape == YES)
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
pixmap = None;
|
||||
window_private = (GdkWindowPrivate*) window;
|
||||
if (window_private->destroyed)
|
||||
return;
|
||||
|
||||
if (mask)
|
||||
{
|
||||
GdkWindowPrivate *pixmap_private;
|
||||
|
||||
pixmap_private = (GdkWindowPrivate*) mask;
|
||||
pixmap = (Pixmap) pixmap_private->xwindow;
|
||||
}
|
||||
else
|
||||
{
|
||||
x = 0;
|
||||
y = 0;
|
||||
pixmap = None;
|
||||
}
|
||||
|
||||
XShapeCombineMask (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
ShapeBounding,
|
||||
x, y,
|
||||
pixmap,
|
||||
ShapeSet);
|
||||
}
|
||||
|
||||
XShapeCombineMask (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
ShapeBounding,
|
||||
x, y,
|
||||
pixmap,
|
||||
ShapeSet);
|
||||
#endif /* HAVE_SHAPE_EXT */
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1553,7 +1716,7 @@ gdk_window_dnd_data_set (GdkWindow *window,
|
||||
sev.xclient.data.l[4] = event->dragrequest.timestamp;
|
||||
|
||||
if (!gdk_send_xevent (event->dragrequest.requestor, False,
|
||||
NoEventMask, &sev))
|
||||
StructureNotifyMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
|
||||
event->dragrequest.requestor));
|
||||
|
||||
@@ -1732,7 +1895,7 @@ gdk_window_set_group (GdkWindow *window,
|
||||
return;
|
||||
|
||||
private = (GdkWindowPrivate *)leader;
|
||||
wm_hints.flags |= WindowGroupHint;
|
||||
wm_hints.flags = WindowGroupHint;
|
||||
wm_hints.window_group = private->xwindow;
|
||||
|
||||
XSetWMHints (window_private->xdisplay, window_private->xwindow, &wm_hints);
|
||||
@@ -1812,3 +1975,20 @@ gdk_window_set_functions (GdkWindow *window,
|
||||
|
||||
gdk_window_set_mwm_hints (window, &hints);
|
||||
}
|
||||
|
||||
GList *
|
||||
gdk_window_get_toplevels (void)
|
||||
{
|
||||
GList *new_list = NULL;
|
||||
GList *tmp_list;
|
||||
|
||||
tmp_list = gdk_root_parent.children;
|
||||
while (tmp_list)
|
||||
{
|
||||
new_list = g_list_prepend (new_list, tmp_list->data);
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
return new_list;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __GDK_X_H__
|
||||
#define __GDK_X_H__
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "gdkprivate.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -61,7 +61,7 @@ handler(int signal)
|
||||
}
|
||||
|
||||
void
|
||||
init_socket()
|
||||
init_socket(void)
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
|
||||
@@ -130,7 +130,7 @@ enable_device(GxidDevice *dev)
|
||||
/* switch the core pointer from whatever it is now to something else,
|
||||
return true on success, false otherwise */
|
||||
static int
|
||||
switch_core_pointer()
|
||||
switch_core_pointer(void)
|
||||
{
|
||||
GxidDevice *old_pointer = 0;
|
||||
GxidDevice *new_pointer = 0;
|
||||
@@ -222,7 +222,7 @@ init_device(XDeviceInfo *xdevice)
|
||||
}
|
||||
|
||||
void
|
||||
init_xinput()
|
||||
init_xinput(void)
|
||||
{
|
||||
char **extensions;
|
||||
XDeviceInfo *xdevices;
|
||||
@@ -279,12 +279,22 @@ int
|
||||
handle_claim_device(GxidClaimDevice *msg)
|
||||
{
|
||||
int i,j;
|
||||
XID devid = ntohl(msg->device);
|
||||
XID winid = ntohl(msg->window);
|
||||
int exclusive = ntohl(msg->exclusive);
|
||||
XID devid;
|
||||
XID winid;
|
||||
int exclusive;
|
||||
GxidDevice *device = NULL;
|
||||
GxidWindow *window = NULL;
|
||||
|
||||
if (msg->length != sizeof(GxidClaimDevice))
|
||||
{
|
||||
fprintf(stderr,"Bad length for ClaimDevice message\n");
|
||||
return GXID_RETURN_ERROR;
|
||||
}
|
||||
|
||||
devid = ntohl(msg->device);
|
||||
winid = ntohl(msg->window);
|
||||
exclusive = ntohl(msg->exclusive);
|
||||
|
||||
#ifdef DEBUG_CLIENTS
|
||||
fprintf(stderr,"device %ld claimed (window 0x%lx)\n",devid,winid);
|
||||
#endif
|
||||
@@ -397,11 +407,20 @@ int
|
||||
handle_release_device(GxidReleaseDevice *msg)
|
||||
{
|
||||
int i,j;
|
||||
XID devid = ntohl(msg->device);
|
||||
XID winid = ntohl(msg->window);
|
||||
XID devid;
|
||||
XID winid;
|
||||
|
||||
GxidDevice *device = NULL;
|
||||
|
||||
if (msg->length != sizeof(GxidReleaseDevice))
|
||||
{
|
||||
fprintf(stderr,"Bad length for ReleaseDevice message\n");
|
||||
return GXID_RETURN_ERROR;
|
||||
}
|
||||
|
||||
devid = ntohl(msg->device);
|
||||
winid = ntohl(msg->window);
|
||||
|
||||
#ifdef DEBUG_CLIENTS
|
||||
fprintf(stderr,"device %ld released (window 0x%lx)\n",devid,winid);
|
||||
#endif
|
||||
@@ -460,11 +479,11 @@ handle_release_device(GxidReleaseDevice *msg)
|
||||
}
|
||||
|
||||
void
|
||||
handle_connection()
|
||||
handle_connection (void)
|
||||
{
|
||||
GxidMessage msg;
|
||||
GxidU32 type;
|
||||
int length;
|
||||
GxidU32 length;
|
||||
GxidI32 retval;
|
||||
|
||||
int conn_fd;
|
||||
@@ -496,7 +515,7 @@ handle_connection()
|
||||
|
||||
/* read rest of message */
|
||||
|
||||
if (length > sizeof(GxidMessage))
|
||||
if ((length > sizeof(GxidMessage)) || (length < 2*sizeof(GxidU32)))
|
||||
{
|
||||
fprintf(stderr,"%s: Bad message length\n",
|
||||
program_name);
|
||||
@@ -689,7 +708,7 @@ handle_destroy_notify(XDestroyWindowEvent *event)
|
||||
}
|
||||
|
||||
void
|
||||
handle_xevent()
|
||||
handle_xevent(void)
|
||||
{
|
||||
int i;
|
||||
XEvent event;
|
||||
@@ -743,7 +762,7 @@ handle_xevent()
|
||||
}
|
||||
|
||||
void
|
||||
usage()
|
||||
usage(void)
|
||||
{
|
||||
fprintf(stderr,"Usage: %s [-d display] [-p --gxid-port port]\n",
|
||||
program_name);
|
||||
@@ -833,7 +852,7 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (FD_ISSET(socket_fd,&readfds))
|
||||
handle_connection(socket_fd);
|
||||
handle_connection();
|
||||
|
||||
while (XPending(dpy))
|
||||
handle_xevent();
|
||||
|
||||
203
glib/ChangeLog
203
glib/ChangeLog
@@ -1,3 +1,206 @@
|
||||
Sun May 17 10:48:27 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gscanner.c (g_scanner_unexp_token): provide usefull default
|
||||
specifications for identifier_spec and symbol_spec.
|
||||
|
||||
* glib.h: new functions g_slist_nth_data and g_list_nth_data to return
|
||||
the data of the nth element in the list.
|
||||
|
||||
Fri May 15 22:31:49 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gscanner.c (g_scanner_unexp_token): removed spurious va_end(args)
|
||||
that for some reason didn't produce a compiler wrning on my machine
|
||||
(is va_end undefined for i386?).
|
||||
|
||||
Fri May 15 12:32:08 1998 rodo <doulik@karlin.mff.cuni.cz>
|
||||
|
||||
* gscanner.c: replaced some snprintf with g_snprintf
|
||||
|
||||
Fri May 15 00:56:59 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib.h: further support for gcc function attributes: G_GNUC_FORMAT,
|
||||
G_GNUC_NORETURN and G_GNUC_CONST.
|
||||
|
||||
* gscanner.c (g_scanner_stat_mode): changed stat() to lstat().
|
||||
(g_scanner_msg_handler): "\n" at end of line!
|
||||
(g_scanner_foreach_symbol): new function to iterate over the symbol
|
||||
table (GScanner does value-wrapping).
|
||||
|
||||
Thu May 14 04:14:12 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib.h: typedef gint gboolean;
|
||||
this is needed to provide portability with big-endian platforms (e.g.
|
||||
try sizeof(bool) for c++ on big-endians - it's 4).
|
||||
this is also needed to maintain some_union.d_gint==some_union.d_gboolean.
|
||||
plus, gint to gboolean casts and vice versa need to be possible without
|
||||
loss.
|
||||
|
||||
Tue May 12 19:22:58 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* glib/glib.h: Added macros G[U]INT_TO_POINTER() and
|
||||
GPOINTER_TO_[U]INT for storing small integers integers
|
||||
inside pointers.
|
||||
|
||||
* glib/testglib.c: Print sizeof() results
|
||||
as g_print("%ld", (glong)sizeof(foo)), to deal with
|
||||
size_t being long on Alpha's.
|
||||
|
||||
Tue May 12 16:54:15 1998 Owen Taylor <otaylor@gtk.org>
|
||||
(James A <jamesa@demon.net> : gtk-jamesa-980511-4.patch)
|
||||
|
||||
* glib.h gstring.c gmessages.c: Added some missing
|
||||
const to arguments.
|
||||
|
||||
* gutils.c (g_strsignal.c): Added missing return statements.
|
||||
|
||||
Mon May 11 21:11:54 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gutils.c gmessages.c: Moved g_error, g_warning, g_message and
|
||||
g_print from gutils.c to new file gmessages.c, to avoid having to
|
||||
include <unistd.h> in gutils.c which was causing problems for the
|
||||
g_strsignal implementation on FreeBSD boxes.
|
||||
|
||||
Mon May 11 09:53:43 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* configure.in: preserve automake CFLAGS.
|
||||
|
||||
* Makefile.am: fully rename the created library to libglib-1.1.la.
|
||||
this means we need to change certain portions of the Makefile.am on
|
||||
major/minor version bumps.
|
||||
|
||||
* ltmain.sh: the -release option is not required anymore.
|
||||
|
||||
* glib.h: provide G_GNUC_FUNCTION and G_GNUC_PRETTY_FUNCTION to
|
||||
avoid conditionals. unconditionally define NULL, TRUE, FALSE, MAX,
|
||||
MIN, ABS and CLAMP, these macros might be screwed from other headers.
|
||||
|
||||
Mon May 11 01:44:10 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gdataset.c: new file, gdatasets implement the object data
|
||||
mechanism from GtkObject. a generic data pointer is associated with
|
||||
a certain location and a key id.
|
||||
|
||||
Sat May 9 20:08:12 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* glib/gmem.c: Experimentally restore GMemChunk
|
||||
to its primeval state - where mem areas are
|
||||
freed incrementally instead of searching the tree
|
||||
every time a mem area is completely empty. Also,
|
||||
always keep one mem chunk around. (Reduced calls
|
||||
to malloc() a lot, but doesn't really improve
|
||||
performance significiantly)
|
||||
|
||||
Thu May 7 08:17:28 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* glib.h (G_GNUC_PRINTF):
|
||||
(G_GNUC_SCANF): macros to facilitate the printf/scanf format argument
|
||||
checking of gcc.
|
||||
|
||||
* gstring.c: const corrections, string!=NULL checks at function entry.
|
||||
(g_string_down): new function for tolower(3) conversion.
|
||||
(g_string_up): new function for toupper(3) conversion.
|
||||
|
||||
* gutils.c: const corrections.
|
||||
(g_strdown): g_string_down() counterpart.
|
||||
(g_strup): g_string_up() counterpart.
|
||||
|
||||
* gscanner.c (g_scanner_unexp_token):
|
||||
(g_scanner_error):
|
||||
(g_scanner_warn): new functions to let a scanner put out warnings
|
||||
or errors, especially to react on unexpected tokens.
|
||||
|
||||
* gslist.c:
|
||||
(g_slist_index): find out about about the position of a
|
||||
certain data pointer.
|
||||
(g_slist_position): find out about about the position of a
|
||||
certain node.
|
||||
|
||||
* glist.c:
|
||||
(g_list_index): find out about about the position of a
|
||||
certain data pointer.
|
||||
|
||||
Thu May 7 05:14:19 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* ltmain.sh: added a new commandline flag -postfix similar to -release,
|
||||
but will immediately change the library name.
|
||||
|
||||
* Makefile.am: specify -postfix and -version-info
|
||||
|
||||
* configure.in: version bump to 1.1.0. added GLIB_INTERFACE_AGE and
|
||||
GLIB_BINARY_AGE. calculate LT_* variables for libtool.
|
||||
|
||||
Fri May 1 16:36:08 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gutils.c: (g_strcasecmp). Check for isupper before
|
||||
taking tolower, and account for macroized tolower.
|
||||
|
||||
* gutils.c (g_error): Check for recursion.
|
||||
|
||||
1998-04-27 Elliot Lee <sopwith@cuc.ml.org>
|
||||
|
||||
* glist.c (g_list_position): New function to find the position of
|
||||
a link in a list - should be the inverse of g_list_nth(), but
|
||||
haven't tested it so poof.
|
||||
|
||||
Thu Apr 30 21:41:30 1998 Owen Taylor <otaylor@gtk.org>
|
||||
|
||||
* gstring.c : Check arguments more carefully,
|
||||
(gtk-draco-980423-1.patch; ramsey@rhrk.uni-kl.de)
|
||||
|
||||
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gutils.c (g_direct_compare): Removed, because that's what
|
||||
a NULL comparison function means. And it wasn't 64 bit safe.
|
||||
|
||||
Mon Apr 6 18:43:25 1998 Tim Janik <timj@gtk.org>
|
||||
|
||||
* gscanner.c (g_scanner_get_token_ll): fixed a bug that caused floats
|
||||
of the format ".xxx" to be parsed as "xxx".
|
||||
|
||||
Fri Apr 3 20:36:35 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gutils.c (g_parse_debug_string): Make debug string
|
||||
parsine case-insensitive
|
||||
|
||||
Fri Apr 3 17:03:18 PST 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* gstring.c: corrected possible overrun when inserting into
|
||||
GStrings (thanks Elrond)
|
||||
|
||||
Fri Apr 3 18:05:45 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* testglib.c: Removed literal german from strings
|
||||
to appease SGI compiler.
|
||||
|
||||
Thu Mar 26 20:47:21 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* configure.in glib glibconfig.h.in: Add test for atexit/on_exit -
|
||||
use on_exit if atexit not found in definition of ATEXIT.
|
||||
|
||||
Wed Mar 25 15:23:37 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* Makefile.am: Switched glibconfig.h rule from HEADERS
|
||||
to DATA, so that it is not added to DISTFILES
|
||||
|
||||
Wed Mar 18 22:27:08 PST 1998 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* garray.c: g_rarray_truncate length done correctly
|
||||
|
||||
Sun Mar 15 07:13:34 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gutils.c: changed *_handler variables to be named glib_*_handler,
|
||||
so you can easily access them from gdb.
|
||||
|
||||
Sat Mar 14 17:47:43 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* Makefile.am: Don't refer to current directory as $(top_builddir)
|
||||
to avoid confusing non-gmakes
|
||||
|
||||
Sat Mar 14 01:37:35 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* Makefile.am (configincludedir): Moved glibconfig.h to
|
||||
$(pkglibdir)/include
|
||||
|
||||
Tue Mar 10 02:03:12 1998 Tim Janik <timj@gimp.org>
|
||||
|
||||
* gscanner.c (g_scanner_destroy_symbol_table_entry): new function to
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
lib_LTLIBRARIES = libglib.la
|
||||
configincludedir = $(pkglibdir)/include
|
||||
|
||||
libglib_la_SOURCES = \
|
||||
lib_LTLIBRARIES = libglib-1.1.la
|
||||
|
||||
libglib_1_1_la_SOURCES = \
|
||||
garray.c \
|
||||
gcache.c \
|
||||
gdataset.c \
|
||||
gerror.c \
|
||||
ghash.c \
|
||||
glist.c \
|
||||
gmem.c \
|
||||
gmessages.c \
|
||||
gprimes.c \
|
||||
gslist.c \
|
||||
gtimer.c \
|
||||
@@ -18,15 +22,17 @@ libglib_la_SOURCES = \
|
||||
gutils.c
|
||||
|
||||
include_HEADERS = \
|
||||
glib.h \
|
||||
glib.h
|
||||
|
||||
configinclude_DATA = \
|
||||
glibconfig.h
|
||||
|
||||
libglib_la_LDFLAGS = -version-info 1:0:0
|
||||
libglib_1_1_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)
|
||||
|
||||
noinst_PROGRAMS = testglib
|
||||
testglib_LDADD = $(top_builddir)/libglib.la
|
||||
testglib_LDADD = libglib-@LT_RELEASE@.la
|
||||
|
||||
.PHONY: files release
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
/* acconfig.h
|
||||
This file is in the public domain.
|
||||
|
||||
@@ -4,8 +4,36 @@ AC_INIT(glist.c)
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
dnl Initialize automake stuff
|
||||
AM_INIT_AUTOMAKE(glib, 0.99.5)
|
||||
# Making releases:
|
||||
# GLIB_MICRO_VERSION += 1;
|
||||
# GLIB_INTERFACE_AGE += 1;
|
||||
# GLIB_BINARY_AGE += 1;
|
||||
# if any functions have been added, set GLIB_INTERFACE_AGE to 0.
|
||||
# if backwards compatibility has been broken,
|
||||
# set GLIB_BINARY_AGE and GLIB_INTERFACE_AGE to 0.
|
||||
#
|
||||
GLIB_MAJOR_VERSION=1
|
||||
GLIB_MINOR_VERSION=1
|
||||
GLIB_MICRO_VERSION=0
|
||||
GLIB_INTERFACE_AGE=0
|
||||
GLIB_BINARY_AGE=0
|
||||
GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
|
||||
AC_SUBST(GLIB_VERSION)
|
||||
|
||||
# libtool versioning
|
||||
LT_RELEASE=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION
|
||||
LT_CURRENT=`expr $GLIB_MICRO_VERSION - $GLIB_INTERFACE_AGE`
|
||||
LT_REVISION=$GLIB_INTERFACE_AGE
|
||||
LT_AGE=`expr $GLIB_BINARY_AGE - $GLIB_INTERFACE_AGE`
|
||||
AC_SUBST(LT_RELEASE)
|
||||
AC_SUBST(LT_CURRENT)
|
||||
AC_SUBST(LT_REVISION)
|
||||
AC_SUBST(LT_AGE)
|
||||
|
||||
VERSION=$GLIB_VERSION
|
||||
PACKAGE=glib
|
||||
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
|
||||
|
||||
# Specify a configuration file
|
||||
AM_CONFIG_HEADER(glibconfig.h)
|
||||
@@ -24,7 +52,7 @@ AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]]
|
||||
, enable_ansi=no)
|
||||
|
||||
if test "x$enable_debug" = "xyes"; then
|
||||
test "$cflags_set" = set || CFLAGS="-g"
|
||||
test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
|
||||
CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
|
||||
else
|
||||
if test "x$enable_debug" = "xno"; then
|
||||
@@ -61,6 +89,8 @@ AC_HEADER_STDC
|
||||
# Checks for library functions.
|
||||
AC_FUNC_VPRINTF
|
||||
|
||||
AC_CHECK_FUNCS(atexit on_exit)
|
||||
|
||||
AC_CHECK_SIZEOF(char)
|
||||
AC_CHECK_SIZEOF(short)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include "glib.h"
|
||||
@@ -107,7 +108,7 @@ g_rarray_truncate (GArray *array,
|
||||
{
|
||||
if (array->data)
|
||||
memset (array->data + length * size, 0, size);
|
||||
array->len = length;
|
||||
array->len = length * size;
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "glib.h"
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
@@ -54,7 +55,7 @@
|
||||
|
||||
|
||||
static int do_query (char *prompt);
|
||||
static void debug (char *progname, int method);
|
||||
static void debug (const gchar *progname, int method);
|
||||
static void stack_trace (char **);
|
||||
static void stack_trace_sigchld (int);
|
||||
|
||||
@@ -62,7 +63,7 @@ static void stack_trace_sigchld (int);
|
||||
static int stack_trace_done;
|
||||
|
||||
void
|
||||
g_debug (char *progname)
|
||||
g_debug (const gchar *progname)
|
||||
{
|
||||
char buf[32];
|
||||
|
||||
@@ -81,14 +82,16 @@ g_debug (char *progname)
|
||||
}
|
||||
|
||||
void
|
||||
g_attach_process (char *progname, int query)
|
||||
g_attach_process (const gchar *progname,
|
||||
int query)
|
||||
{
|
||||
if (!query || do_query ("attach to process"))
|
||||
debug (progname, INTERACTIVE);
|
||||
}
|
||||
|
||||
void
|
||||
g_stack_trace (char *progname, int query)
|
||||
g_stack_trace (const gchar *progname,
|
||||
int query)
|
||||
{
|
||||
if (!query || do_query ("print stack trace"))
|
||||
debug (progname, STACK_TRACE);
|
||||
@@ -113,7 +116,7 @@ do_query (char *prompt)
|
||||
}
|
||||
|
||||
static void
|
||||
debug (char *progname,
|
||||
debug (const char *progname,
|
||||
int method)
|
||||
{
|
||||
pid_t pid;
|
||||
@@ -123,7 +126,7 @@ debug (char *progname,
|
||||
|
||||
sprintf (buf, "%d", (int) getpid ());
|
||||
|
||||
args[1] = progname;
|
||||
args[1] = (gchar*) progname;
|
||||
args[2] = buf;
|
||||
|
||||
switch (method)
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "glib.h"
|
||||
|
||||
|
||||
404
glib/glib.h
404
glib/glib.h
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef __G_LIB_H__
|
||||
#define __G_LIB_H__
|
||||
@@ -88,41 +89,92 @@
|
||||
|
||||
|
||||
/* Provide definitions for some commonly used macros.
|
||||
* These are only provided if they haven't already
|
||||
* been defined. It is assumed that if they are already
|
||||
* defined then the current definition is correct.
|
||||
*/
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif /* FALSE */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif /* TRUE */
|
||||
|
||||
#ifndef NULL
|
||||
#undef NULL
|
||||
#define NULL ((void*) 0)
|
||||
#endif /* NULL */
|
||||
|
||||
#ifndef MAX
|
||||
#undef FALSE
|
||||
#define FALSE 0
|
||||
|
||||
#undef TRUE
|
||||
#define TRUE 1
|
||||
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
#endif /* MAX */
|
||||
|
||||
#ifndef MIN
|
||||
#undef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
#endif /* MIN */
|
||||
|
||||
#ifndef ABS
|
||||
#undef ABS
|
||||
#define ABS(a) (((a) < 0) ? -(a) : (a))
|
||||
#endif /* ABS */
|
||||
|
||||
#ifndef CLAMP
|
||||
#undef CLAMP
|
||||
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
|
||||
#endif /* CLAMP */
|
||||
|
||||
/* Provide simple macro statement wrappers (adapted from Pearl):
|
||||
* G_STMT_START { statements; } G_STMT_END;
|
||||
* can be used as a single statement, as in
|
||||
* if (x) G_STMT_START { ... } G_STMT_END; else ...
|
||||
*
|
||||
* For gcc we will wrap the statements within `({' and `})' braces.
|
||||
* For SunOS they will be wrapped within `if (1)' and `else (void)0',
|
||||
* and otherwise within `do' and `while (0)'.
|
||||
*/
|
||||
#if !(defined (G_STMT_START) && defined (G_STMT_END))
|
||||
# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
|
||||
# define G_STMT_START (void)(
|
||||
# define G_STMT_END )
|
||||
# else
|
||||
# if (defined (sun) || defined (__sun__))
|
||||
# define G_STMT_START if (1)
|
||||
# define G_STMT_END else (void)0
|
||||
# else
|
||||
# define G_STMT_START do
|
||||
# define G_STMT_END while (0)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Provide macros to feature GCC function attributes.
|
||||
*/
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx ) \
|
||||
__attribute__((format (printf, format_idx, arg_idx)))
|
||||
#define G_GNUC_SCANF( format_idx, arg_idx ) \
|
||||
__attribute__((format (scanf, format_idx, arg_idx)))
|
||||
#define G_GNUC_FORMAT( arg_idx ) \
|
||||
__attribute__((format_arg (arg_idx)))
|
||||
#define G_GNUC_NORETURN \
|
||||
__attribute__((noreturn))
|
||||
#define G_GNUC_CONST \
|
||||
__attribute__((const))
|
||||
#else /* !__GNUC__ */
|
||||
#define G_GNUC_PRINTF( format_idx, arg_idx )
|
||||
#define G_GNUC_SCANF( format_idx, arg_idx )
|
||||
#define G_GNUC_FORMAT( arg_idx )
|
||||
#define G_GNUC_NORETURN
|
||||
#define G_GNUC_CONST
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/* Wrap the __PRETTY_FUNCTION__ and __FUNCTION__ variables with macros,
|
||||
* so we can refer to them as strings unconditionally.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
#define G_GNUC_FUNCTION (__FUNCTION__)
|
||||
#define G_GNUC_PRETTY_FUNCTION (__PRETTY_FUNCTION__)
|
||||
#else /* !__GNUC__ */
|
||||
#define G_GNUC_FUNCTION ("")
|
||||
#define G_GNUC_PRETTY_FUNCTION ("")
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
|
||||
#ifndef ATEXIT
|
||||
#define ATEXIT(proc) (atexit (proc))
|
||||
# ifdef HAVE_ATEXIT
|
||||
# define ATEXIT(proc) (atexit (proc))
|
||||
# elif defined (HAVE_ON_EXIT)
|
||||
# define ATEXIT(proc) (on_exit ((void (*)(int, void *))(proc), NULL))
|
||||
# endif
|
||||
#endif /* ATEXIT */
|
||||
|
||||
|
||||
@@ -151,29 +203,6 @@
|
||||
#define g_string(x) #x
|
||||
|
||||
|
||||
/* Provide simple macro statement wrappers (adapted from Pearl):
|
||||
* G_STMT_START { statements; } G_STMT_END;
|
||||
* can be used as a single statement, as in
|
||||
* if (x) G_STMT_START { ... } G_STMT_END; else ...
|
||||
*
|
||||
* For gcc we will wrap the statements within `({' and `})' braces.
|
||||
* For SunOS they will be wrapped within `if (1)' and `else (void)0',
|
||||
* and otherwise within `do' and `while (0)'.
|
||||
*/
|
||||
#if !(defined (G_STMT_START) && defined (G_STMT_END))
|
||||
# if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus)
|
||||
# define G_STMT_START (void)(
|
||||
# define G_STMT_END )
|
||||
# else
|
||||
# if (defined (sun) || defined (__sun__))
|
||||
# define G_STMT_START if (1)
|
||||
# define G_STMT_END else (void)0
|
||||
# else
|
||||
# define G_STMT_START do
|
||||
# define G_STMT_END while (0)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Provide macros for error handling. The "assert" macros will
|
||||
@@ -280,8 +309,11 @@
|
||||
|
||||
#endif /* G_DISABLE_CHECKS */
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#pragma }
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Provide type definitions for commonly used types.
|
||||
@@ -295,7 +327,7 @@ typedef char gchar;
|
||||
typedef short gshort;
|
||||
typedef long glong;
|
||||
typedef int gint;
|
||||
typedef char gboolean;
|
||||
typedef gint gboolean;
|
||||
|
||||
typedef unsigned char guchar;
|
||||
typedef unsigned short gushort;
|
||||
@@ -338,35 +370,69 @@ typedef signed long gint32;
|
||||
typedef unsigned long guint32;
|
||||
#endif /* SIZEOF_INT */
|
||||
|
||||
/* Define macros for storing integers inside pointers */
|
||||
|
||||
typedef struct _GList GList;
|
||||
typedef struct _GSList GSList;
|
||||
typedef struct _GHashTable GHashTable;
|
||||
typedef struct _GCache GCache;
|
||||
typedef struct _GTree GTree;
|
||||
typedef struct _GTimer GTimer;
|
||||
typedef struct _GMemChunk GMemChunk;
|
||||
typedef struct _GListAllocator GListAllocator;
|
||||
typedef struct _GStringChunk GStringChunk;
|
||||
typedef struct _GString GString;
|
||||
typedef struct _GArray GArray;
|
||||
typedef struct _GDebugKey GDebugKey;
|
||||
#if (SIZEOF_INT == SIZEOF_VOID_P)
|
||||
|
||||
typedef void (*GFunc) (gpointer data, gpointer user_data);
|
||||
typedef void (*GHFunc) (gpointer key, gpointer value, gpointer user_data);
|
||||
typedef guint (*GHashFunc) (gpointer key);
|
||||
typedef gint (*GCompareFunc) (gpointer a, gpointer b);
|
||||
typedef gpointer (*GCacheNewFunc) (gpointer key);
|
||||
typedef gpointer (*GCacheDupFunc) (gpointer value);
|
||||
typedef void (*GCacheDestroyFunc) (gpointer value);
|
||||
typedef gint (*GTraverseFunc) (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data);
|
||||
typedef gint (*GSearchFunc) (gpointer key,
|
||||
gpointer data);
|
||||
typedef void (*GErrorFunc) (gchar *str);
|
||||
typedef void (*GWarningFunc) (gchar *str);
|
||||
typedef void (*GPrintFunc) (gchar *str);
|
||||
#define GPOINTER_TO_INT(p) ((gint)(p))
|
||||
#define GPOINTER_TO_UINT(p) ((guint)(p))
|
||||
|
||||
#define GINT_TO_POINTER(i) ((gpointer)(i))
|
||||
#define GUINT_TO_POINTER(u) ((gpointer)(u))
|
||||
|
||||
#elif (SIZEOF_LONG == SIZEOF_VOID_P)
|
||||
|
||||
#define GPOINTER_TO_INT(p) ((gint)(glong)(p))
|
||||
#define GPOINTER_TO_UINT(p) ((guint)(gulong)(p))
|
||||
|
||||
#define GINT_TO_POINTER(i) ((gpointer)(glong)(i))
|
||||
#define GUINT_TO_POINTER(u) ((gpointer)(gulong)(u))
|
||||
|
||||
#else
|
||||
#error "No integer type of the same size as a pointer"
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _GList GList;
|
||||
typedef struct _GSList GSList;
|
||||
typedef struct _GHashTable GHashTable;
|
||||
typedef struct _GCache GCache;
|
||||
typedef struct _GTree GTree;
|
||||
typedef struct _GTimer GTimer;
|
||||
typedef struct _GMemChunk GMemChunk;
|
||||
typedef struct _GListAllocator GListAllocator;
|
||||
typedef struct _GStringChunk GStringChunk;
|
||||
typedef struct _GString GString;
|
||||
typedef struct _GArray GArray;
|
||||
typedef struct _GDebugKey GDebugKey;
|
||||
typedef struct _GScannerConfig GScannerConfig;
|
||||
typedef struct _GScanner GScanner;
|
||||
typedef union _GValue GValue;
|
||||
|
||||
|
||||
typedef void (*GFunc) (gpointer data,
|
||||
gpointer user_data);
|
||||
typedef void (*GHFunc) (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data);
|
||||
typedef guint (*GHashFunc) (gpointer key);
|
||||
typedef gint (*GCompareFunc) (gpointer a,
|
||||
gpointer b);
|
||||
typedef gpointer (*GCacheNewFunc) (gpointer key);
|
||||
typedef gpointer (*GCacheDupFunc) (gpointer value);
|
||||
typedef void (*GCacheDestroyFunc) (gpointer value);
|
||||
typedef gint (*GTraverseFunc) (gpointer key,
|
||||
gpointer value,
|
||||
gpointer data);
|
||||
typedef gint (*GSearchFunc) (gpointer key,
|
||||
gpointer data);
|
||||
typedef void (*GErrorFunc) (gchar *str);
|
||||
typedef void (*GWarningFunc) (gchar *str);
|
||||
typedef void (*GPrintFunc) (gchar *str);
|
||||
typedef void (*GScannerMsgFunc) (GScanner *scanner,
|
||||
gchar *message,
|
||||
gint error);
|
||||
typedef void (*GDestroyNotify) (gpointer data);
|
||||
|
||||
|
||||
struct _GList
|
||||
@@ -442,12 +508,18 @@ GList* g_list_nth (GList *list,
|
||||
guint n);
|
||||
GList* g_list_find (GList *list,
|
||||
gpointer data);
|
||||
gint g_list_position (GList *list,
|
||||
GList *link);
|
||||
gint g_list_index (GList *list,
|
||||
gpointer data);
|
||||
GList* g_list_last (GList *list);
|
||||
GList* g_list_first (GList *list);
|
||||
guint g_list_length (GList *list);
|
||||
void g_list_foreach (GList *list,
|
||||
GFunc func,
|
||||
gpointer user_data);
|
||||
gpointer g_list_nth_data (GList *list,
|
||||
guint n);
|
||||
|
||||
#define g_list_previous(list) ((list) ? (((GList *)list)->prev) : NULL)
|
||||
#define g_list_next(list) ((list) ? (((GList *)list)->next) : NULL)
|
||||
@@ -479,11 +551,17 @@ GSList* g_slist_nth (GSList *list,
|
||||
guint n);
|
||||
GSList* g_slist_find (GSList *list,
|
||||
gpointer data);
|
||||
gint g_slist_position (GSList *list,
|
||||
GSList *link);
|
||||
gint g_slist_index (GSList *list,
|
||||
gpointer data);
|
||||
GSList* g_slist_last (GSList *list);
|
||||
guint g_slist_length (GSList *list);
|
||||
void g_slist_foreach (GSList *list,
|
||||
GFunc func,
|
||||
gpointer user_data);
|
||||
gpointer g_slist_nth_data (GSList *list,
|
||||
guint n);
|
||||
|
||||
#define g_slist_next(list) ((list) ? (((GSList *)list)->next) : NULL)
|
||||
|
||||
@@ -641,28 +719,35 @@ gdouble g_timer_elapsed (GTimer *timer,
|
||||
|
||||
/* Output
|
||||
*/
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
|
||||
void g_error (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void g_warning (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void g_message (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void g_print (gchar *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
#else
|
||||
void g_error (gchar *format, ...);
|
||||
void g_warning (gchar *format, ...);
|
||||
void g_message (gchar *format, ...);
|
||||
void g_print (gchar *format, ...);
|
||||
#endif
|
||||
void g_error (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
|
||||
void g_warning (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
|
||||
void g_message (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
|
||||
void g_print (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
|
||||
|
||||
/* Utility functions
|
||||
*/
|
||||
gchar* g_strdup (const gchar *str);
|
||||
gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */
|
||||
gdouble g_strtod (const gchar *nptr, gchar **endptr);
|
||||
gchar* g_strerror (gint errnum);
|
||||
gchar* g_strsignal (gint signum);
|
||||
gint g_strcasecmp (const gchar *s1, const gchar *s2);
|
||||
gint g_snprintf (gchar *str, gulong n, gchar const *fmt, ...);
|
||||
|
||||
#define G_STR_DELIMITERS "_-|> <."
|
||||
void g_strdelimit (gchar *string,
|
||||
const gchar *delimiters,
|
||||
gchar new_delimiter);
|
||||
gchar* g_strdup (const gchar *str);
|
||||
gchar* g_strconcat (const gchar *string1,
|
||||
...); /* NULL terminated */
|
||||
gdouble g_strtod (const gchar *nptr,
|
||||
gchar **endptr);
|
||||
gchar* g_strerror (gint errnum);
|
||||
gchar* g_strsignal (gint signum);
|
||||
gint g_strcasecmp (const gchar *s1,
|
||||
const gchar *s2);
|
||||
void g_strdown (gchar *string);
|
||||
void g_strup (gchar *string);
|
||||
guint g_parse_debug_string (const gchar *string,
|
||||
GDebugKey *keys,
|
||||
guint nkeys);
|
||||
gint g_snprintf (gchar *string,
|
||||
gulong n,
|
||||
gchar const *format,
|
||||
...) G_GNUC_PRINTF (3, 4);
|
||||
|
||||
/* We make the assumption that if memmove isn't available, then
|
||||
* bcopy will do the job. This isn't safe everywhere. (bcopy can't
|
||||
@@ -680,13 +765,11 @@ GWarningFunc g_set_warning_handler (GWarningFunc func);
|
||||
GPrintFunc g_set_message_handler (GPrintFunc func);
|
||||
GPrintFunc g_set_print_handler (GPrintFunc func);
|
||||
|
||||
guint g_parse_debug_string (const gchar *string,
|
||||
GDebugKey *keys,
|
||||
guint nkeys);
|
||||
|
||||
void g_debug (char *progname);
|
||||
void g_attach_process (char *progname, int query);
|
||||
void g_stack_trace (char *progname, int query);
|
||||
void g_debug (const gchar *progname);
|
||||
void g_attach_process (const gchar *progname,
|
||||
gint query);
|
||||
void g_stack_trace (const gchar *progname,
|
||||
gint query);
|
||||
|
||||
|
||||
/* String Chunks
|
||||
@@ -694,42 +777,44 @@ void g_stack_trace (char *progname, int query);
|
||||
GStringChunk* g_string_chunk_new (gint size);
|
||||
void g_string_chunk_free (GStringChunk *chunk);
|
||||
gchar* g_string_chunk_insert (GStringChunk *chunk,
|
||||
gchar* string);
|
||||
const gchar *string);
|
||||
gchar* g_string_chunk_insert_const (GStringChunk *chunk,
|
||||
gchar* string);
|
||||
const gchar *string);
|
||||
|
||||
/* Strings
|
||||
*/
|
||||
GString* g_string_new (gchar *init);
|
||||
void g_string_free (GString *string,
|
||||
gint free_segment);
|
||||
GString* g_string_assign (GString *lval,
|
||||
gchar *rval);
|
||||
GString* g_string_truncate (GString *string,
|
||||
gint len);
|
||||
GString* g_string_append (GString *string,
|
||||
gchar *val);
|
||||
GString* g_string_append_c (GString *string,
|
||||
gchar c);
|
||||
GString* g_string_prepend (GString *string,
|
||||
gchar *val);
|
||||
GString* g_string_prepend_c (GString *string,
|
||||
gchar c);
|
||||
GString* g_string_insert (GString *fstring,
|
||||
gint pos,
|
||||
gchar *val);
|
||||
GString* g_string_insert_c (GString *fstring,
|
||||
gint pos,
|
||||
gchar c);
|
||||
GString* g_string_erase (GString *fstring,
|
||||
gint pos,
|
||||
gint len);
|
||||
void g_string_sprintf (GString *string,
|
||||
gchar *fmt,
|
||||
...);
|
||||
void g_string_sprintfa (GString *string,
|
||||
gchar *fmt,
|
||||
...);
|
||||
GString* g_string_new (const gchar *init);
|
||||
void g_string_free (GString *string,
|
||||
gint free_segment);
|
||||
GString* g_string_assign (GString *lval,
|
||||
const gchar *rval);
|
||||
GString* g_string_truncate (GString *string,
|
||||
gint len);
|
||||
GString* g_string_append (GString *string,
|
||||
const gchar *val);
|
||||
GString* g_string_append_c (GString *string,
|
||||
gchar c);
|
||||
GString* g_string_prepend (GString *string,
|
||||
const gchar *val);
|
||||
GString* g_string_prepend_c (GString *string,
|
||||
gchar c);
|
||||
GString* g_string_insert (GString *string,
|
||||
gint pos,
|
||||
const gchar *val);
|
||||
GString* g_string_insert_c (GString *string,
|
||||
gint pos,
|
||||
gchar c);
|
||||
GString* g_string_erase (GString *string,
|
||||
gint pos,
|
||||
gint len);
|
||||
GString* g_string_down (GString *string);
|
||||
GString* g_string_up (GString *string);
|
||||
void g_string_sprintf (GString *string,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
void g_string_sprintfa (GString *string,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF (2, 3);
|
||||
|
||||
/* Resizable arrays
|
||||
*/
|
||||
@@ -765,10 +850,38 @@ gint g_str_equal (const gpointer v,
|
||||
const gpointer v2);
|
||||
guint g_str_hash (const gpointer v);
|
||||
|
||||
/* This "hash" function will just return the key's adress as an
|
||||
* unsigned integer. Useful for hashing on plain adresses or
|
||||
* simple integer values.
|
||||
*/
|
||||
guint g_direct_hash (gpointer key);
|
||||
|
||||
|
||||
/* Associated Data
|
||||
*/
|
||||
void g_dataset_destroy (const gpointer dataset_location);
|
||||
guint g_dataset_try_key (const gchar *key);
|
||||
guint g_dataset_force_id (const gchar *key);
|
||||
gpointer g_dataset_id_get_data (const gpointer dataset_location,
|
||||
guint key_id);
|
||||
void g_dataset_id_set_data_full (const gpointer dataset_location,
|
||||
guint key_id,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy_func);
|
||||
void g_dataset_id_set_destroy (const gpointer dataset_location,
|
||||
guint key_id,
|
||||
GDestroyNotify destroy_func);
|
||||
|
||||
#define g_dataset_id_set_data(l,k,d) G_STMT_START{g_dataset_id_set_data_full((l),(k),(d),NULL);}G_STMT_END
|
||||
#define g_dataset_id_remove_data(l,k) G_STMT_START{g_dataset_id_set_data((l),(k),NULL);}G_STMT_END
|
||||
#define g_dataset_get_data(l,k) (g_dataset_id_get_data((l),g_dataset_try_key(k)))
|
||||
#define g_dataset_set_data_full(l,k,d,f) G_STMT_START{g_dataset_id_set_data_full((l),g_dataset_force_id(k),(d),(f));}G_STMT_END
|
||||
#define g_dataset_set_destroy(l,k,f) G_STMT_START{g_dataset_id_set_destroy((l),g_dataset_force_id(k),(f));}G_STMT_END
|
||||
#define g_dataset_set_data(l,k,d) G_STMT_START{g_dataset_set_data_full((l),(k),(d),NULL);}G_STMT_END
|
||||
#define g_dataset_remove_data(l,k) G_STMT_START{g_dataset_set_data((l),(k),NULL);}G_STMT_END
|
||||
|
||||
|
||||
/* GScanner: Flexible lexical scanner for general purpose.
|
||||
* Copyright (C) 1997 Tim Janik
|
||||
*/
|
||||
|
||||
/* Character sets */
|
||||
@@ -783,10 +896,6 @@ guint g_str_hash (const gpointer v);
|
||||
"\361\362\363\364\365\366"\
|
||||
"\370\371\372\373\374\375\376\377"
|
||||
|
||||
typedef union _GValue GValue;
|
||||
typedef struct _GScannerConfig GScannerConfig;
|
||||
typedef struct _GScanner GScanner;
|
||||
|
||||
/* Error types */
|
||||
typedef enum
|
||||
{
|
||||
@@ -912,6 +1021,8 @@ struct _GScanner
|
||||
guint text_len;
|
||||
gint input_fd;
|
||||
gint peeked_char;
|
||||
|
||||
GScannerMsgFunc msg_handler;
|
||||
};
|
||||
|
||||
GScanner* g_scanner_new (GScannerConfig *config_templ);
|
||||
@@ -933,8 +1044,25 @@ void g_scanner_add_symbol (GScanner *scanner,
|
||||
gpointer value);
|
||||
gpointer g_scanner_lookup_symbol (GScanner *scanner,
|
||||
const gchar *symbol);
|
||||
void g_scanner_foreach_symbol (GScanner *scanner,
|
||||
GHFunc func,
|
||||
gpointer func_data);
|
||||
void g_scanner_remove_symbol (GScanner *scanner,
|
||||
const gchar *symbol);
|
||||
void g_scanner_unexp_token (GScanner *scanner,
|
||||
GTokenType expected_token,
|
||||
const gchar *identifier_spec,
|
||||
const gchar *symbol_spec,
|
||||
const gchar *symbol_name,
|
||||
const gchar *message,
|
||||
gint is_error);
|
||||
void g_scanner_error (GScanner *scanner,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF (2,3);
|
||||
void g_scanner_warn (GScanner *scanner,
|
||||
const gchar *format,
|
||||
...) G_GNUC_PRINTF (2,3);
|
||||
gint g_scanner_stat_mode (const gchar *filename);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,6 @@
|
||||
#undef NO_SYS_ERRLIST
|
||||
#undef NO_SYS_SIGLIST
|
||||
|
||||
/* #undef PACKAGE */
|
||||
/* #undef VERSION */
|
||||
|
||||
/* The number of bytes in a char. */
|
||||
#undef SIZEOF_CHAR
|
||||
|
||||
@@ -53,9 +50,15 @@
|
||||
/* The number of bytes in a void *. */
|
||||
#undef SIZEOF_VOID_P
|
||||
|
||||
/* Define if you have the atexit function. */
|
||||
#undef HAVE_ATEXIT
|
||||
|
||||
/* Define if you have the memmove function. */
|
||||
#undef HAVE_MEMMOVE
|
||||
|
||||
/* Define if you have the on_exit function. */
|
||||
#undef HAVE_ON_EXIT
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
|
||||
55
glib/glist.c
55
glib/glist.c
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "glib.h"
|
||||
|
||||
@@ -32,7 +33,7 @@ static GRealListAllocator *current_allocator = NULL;
|
||||
|
||||
|
||||
GListAllocator*
|
||||
g_list_allocator_new ()
|
||||
g_list_allocator_new (void)
|
||||
{
|
||||
GRealListAllocator* allocator = g_new (GRealListAllocator, 1);
|
||||
|
||||
@@ -79,7 +80,7 @@ g_list_set_allocator (GListAllocator* fallocator)
|
||||
|
||||
|
||||
GList*
|
||||
g_list_alloc ()
|
||||
g_list_alloc (void)
|
||||
{
|
||||
GList *new_list;
|
||||
|
||||
@@ -299,6 +300,16 @@ g_list_nth (GList *list,
|
||||
return list;
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_list_nth_data (GList *list,
|
||||
guint n)
|
||||
{
|
||||
while ((n-- > 0) && list)
|
||||
list = list->next;
|
||||
|
||||
return list ? list->data : NULL;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_find (GList *list,
|
||||
gpointer data)
|
||||
@@ -313,6 +324,42 @@ g_list_find (GList *list,
|
||||
return list;
|
||||
}
|
||||
|
||||
gint
|
||||
g_list_position (GList *list,
|
||||
GList *link)
|
||||
{
|
||||
gint i;
|
||||
|
||||
i = 0;
|
||||
while (list)
|
||||
{
|
||||
if (list == link)
|
||||
return i;
|
||||
i++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
gint
|
||||
g_list_index (GList *list,
|
||||
gpointer data)
|
||||
{
|
||||
gint i;
|
||||
|
||||
i = 0;
|
||||
while (list)
|
||||
{
|
||||
if (list->data == data)
|
||||
return i;
|
||||
i++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
GList*
|
||||
g_list_last (GList *list)
|
||||
{
|
||||
|
||||
38
glib/gmem.c
38
glib/gmem.c
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -325,7 +326,7 @@ g_free (gpointer mem)
|
||||
|
||||
|
||||
void
|
||||
g_mem_profile ()
|
||||
g_mem_profile (void)
|
||||
{
|
||||
#ifdef MEM_PROFILE
|
||||
gint i;
|
||||
@@ -497,7 +498,6 @@ g_mem_chunk_alloc (GMemChunk *mem_chunk)
|
||||
if (rmem_chunk->free_mem_area)
|
||||
{
|
||||
rmem_chunk->num_mem_areas -= 1;
|
||||
rmem_chunk->num_marked_areas -= 1;
|
||||
|
||||
if (temp_area->next)
|
||||
temp_area->next->prev = temp_area->prev;
|
||||
@@ -505,13 +505,15 @@ g_mem_chunk_alloc (GMemChunk *mem_chunk)
|
||||
temp_area->prev->next = temp_area->next;
|
||||
if (temp_area == rmem_chunk->mem_areas)
|
||||
rmem_chunk->mem_areas = rmem_chunk->mem_areas->next;
|
||||
if (temp_area == rmem_chunk->mem_area)
|
||||
rmem_chunk->mem_area = NULL;
|
||||
|
||||
if (rmem_chunk->type == G_ALLOC_AND_FREE)
|
||||
g_tree_remove (rmem_chunk->mem_tree, temp_area);
|
||||
g_free (temp_area);
|
||||
}
|
||||
else
|
||||
rmem_chunk->free_mem_area = temp_area;
|
||||
|
||||
rmem_chunk->num_marked_areas -= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -561,23 +563,6 @@ g_mem_chunk_alloc (GMemChunk *mem_chunk)
|
||||
rmem_chunk->mem_area->allocated = 0;
|
||||
rmem_chunk->mem_area->mark = 0;
|
||||
}
|
||||
else if (rmem_chunk->free_mem_area)
|
||||
{
|
||||
rmem_chunk->num_mem_areas -= 1;
|
||||
|
||||
if (rmem_chunk->free_mem_area->next)
|
||||
rmem_chunk->free_mem_area->next->prev = rmem_chunk->free_mem_area->prev;
|
||||
if (rmem_chunk->free_mem_area->prev)
|
||||
rmem_chunk->free_mem_area->prev->next = rmem_chunk->free_mem_area->next;
|
||||
if (rmem_chunk->free_mem_area == rmem_chunk->mem_areas)
|
||||
rmem_chunk->mem_areas = rmem_chunk->mem_areas->next;
|
||||
|
||||
if (rmem_chunk->type == G_ALLOC_AND_FREE)
|
||||
g_tree_remove (rmem_chunk->mem_tree, rmem_chunk->free_mem_area);
|
||||
|
||||
g_free (rmem_chunk->free_mem_area);
|
||||
rmem_chunk->free_mem_area = NULL;
|
||||
}
|
||||
|
||||
/* Get the memory and modify the state variables appropriately.
|
||||
*/
|
||||
@@ -623,12 +608,11 @@ g_mem_chunk_free (GMemChunk *mem_chunk,
|
||||
{
|
||||
temp_area->mark = 1;
|
||||
rmem_chunk->num_marked_areas += 1;
|
||||
|
||||
g_mem_chunk_clean (mem_chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* This doesn't free the free_area if there is one */
|
||||
void
|
||||
g_mem_chunk_clean (GMemChunk *mem_chunk)
|
||||
{
|
||||
@@ -748,7 +732,7 @@ g_mem_chunk_print (GMemChunk *mem_chunk)
|
||||
}
|
||||
|
||||
void
|
||||
g_mem_chunk_info ()
|
||||
g_mem_chunk_info (void)
|
||||
{
|
||||
GRealMemChunk *mem_chunk;
|
||||
gint count;
|
||||
@@ -772,7 +756,7 @@ g_mem_chunk_info ()
|
||||
}
|
||||
|
||||
void
|
||||
g_blow_chunks ()
|
||||
g_blow_chunks (void)
|
||||
{
|
||||
GRealMemChunk *mem_chunk;
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "glib.h"
|
||||
|
||||
|
||||
403
glib/gscanner.c
403
glib/gscanner.c
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* GScanner: Flexible lexical scanner for general purpose.
|
||||
* Copyright (C) 1997 Tim Janik
|
||||
* Copyright (C) 1997, 1998 Tim Janik
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
@@ -15,15 +15,20 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#define __gscanner_c__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h> /* needed for sys/stat.h */
|
||||
#include <sys/stat.h>
|
||||
#include "glib.h"
|
||||
|
||||
|
||||
@@ -31,9 +36,9 @@
|
||||
/* --- defines --- */
|
||||
#define to_lower(c) ( \
|
||||
(guchar) ( \
|
||||
( (((guchar)(c))>='A' && ((guchar)(c))<='Z') * ('a'-'A') ) + \
|
||||
( (((guchar)(c))>=192 && ((guchar)(c))<=214) * (224-192) ) + \
|
||||
( (((guchar)(c))>=216 && ((guchar)(c))<=222) * (248-216) ) + \
|
||||
( (((guchar)(c))>='A' && ((guchar)(c))<='Z') * ('a'-'A') ) | \
|
||||
( (((guchar)(c))>=192 && ((guchar)(c))<=214) * (224-192) ) | \
|
||||
( (((guchar)(c))>=216 && ((guchar)(c))<=222) * (248-216) ) | \
|
||||
((guchar)(c)) \
|
||||
) \
|
||||
)
|
||||
@@ -95,6 +100,7 @@ static GScannerConfig g_scanner_config_template =
|
||||
|
||||
|
||||
/* --- prototypes --- */
|
||||
extern char* g_vsprintf (gchar *fmt, va_list *args, va_list *args2);
|
||||
static GScannerHashVal* g_scanner_lookup_internal (GScanner *scanner,
|
||||
const gchar *symbol);
|
||||
static void g_scanner_get_token_ll (GScanner *scanner,
|
||||
@@ -117,6 +123,9 @@ static guchar g_scanner_peek_next_char(GScanner *scanner);
|
||||
static guchar g_scanner_get_char (GScanner *scanner,
|
||||
guint *line_p,
|
||||
guint *position_p);
|
||||
static void g_scanner_msg_handler (GScanner *scanner,
|
||||
gchar *message,
|
||||
gint is_error);
|
||||
|
||||
|
||||
/* --- functions --- */
|
||||
@@ -196,6 +205,8 @@ g_scanner_new (GScannerConfig *config_templ)
|
||||
scanner->text_len = 0;
|
||||
scanner->input_fd = -1;
|
||||
scanner->peeked_char = -1;
|
||||
|
||||
scanner->msg_handler = g_scanner_msg_handler;
|
||||
|
||||
return scanner;
|
||||
}
|
||||
@@ -223,6 +234,75 @@ g_scanner_destroy (GScanner *scanner)
|
||||
g_free (scanner);
|
||||
}
|
||||
|
||||
static void
|
||||
g_scanner_msg_handler (GScanner *scanner,
|
||||
gchar *message,
|
||||
gint is_error)
|
||||
{
|
||||
g_return_if_fail (scanner != NULL);
|
||||
|
||||
fprintf (stdout, "%s:%d: ", scanner->input_name, scanner->line);
|
||||
if (is_error)
|
||||
fprintf (stdout, "error: ");
|
||||
fprintf (stdout, "%s\n", message);
|
||||
}
|
||||
|
||||
void
|
||||
g_scanner_error (GScanner *scanner,
|
||||
const gchar *format,
|
||||
...)
|
||||
{
|
||||
g_return_if_fail (scanner != NULL);
|
||||
g_return_if_fail (format != NULL);
|
||||
|
||||
scanner->parse_errors++;
|
||||
|
||||
if (scanner->msg_handler)
|
||||
{
|
||||
va_list args, args2;
|
||||
gchar *string;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
string = g_vsprintf ((gchar*) format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
string = g_strdup (string);
|
||||
|
||||
scanner->msg_handler (scanner, string, TRUE);
|
||||
|
||||
g_free (string);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_scanner_warn (GScanner *scanner,
|
||||
const gchar *format,
|
||||
...)
|
||||
{
|
||||
g_return_if_fail (scanner != NULL);
|
||||
g_return_if_fail (format != NULL);
|
||||
|
||||
if (scanner->msg_handler)
|
||||
{
|
||||
va_list args, args2;
|
||||
gchar *string;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
string = g_vsprintf ((gchar*) format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
string = g_strdup (string);
|
||||
|
||||
scanner->msg_handler (scanner, string, FALSE);
|
||||
|
||||
g_free (string);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_scanner_input_file (GScanner *scanner,
|
||||
gint input_fd)
|
||||
@@ -244,7 +324,7 @@ g_scanner_input_file (GScanner *scanner,
|
||||
void
|
||||
g_scanner_input_text (GScanner *scanner,
|
||||
const gchar *text,
|
||||
guint text_len)
|
||||
guint text_len)
|
||||
{
|
||||
g_return_if_fail (text != NULL);
|
||||
|
||||
@@ -310,6 +390,39 @@ g_scanner_lookup_symbol (GScanner *scanner,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
g_scanner_foreach_internal (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
register GScannerHashVal *hash_val;
|
||||
register GHFunc func;
|
||||
register gpointer func_data;
|
||||
register gpointer *d;
|
||||
|
||||
d = user_data;
|
||||
func = d[0];
|
||||
func_data = d[1];
|
||||
hash_val = value;
|
||||
|
||||
func (key, hash_val->value, func_data);
|
||||
}
|
||||
|
||||
void
|
||||
g_scanner_foreach_symbol (GScanner *scanner,
|
||||
GHFunc func,
|
||||
gpointer func_data)
|
||||
{
|
||||
gpointer d[2];
|
||||
|
||||
g_return_if_fail (scanner != NULL);
|
||||
|
||||
d[0] = func;
|
||||
d[1] = func_data;
|
||||
|
||||
g_hash_table_foreach (scanner->symbol_table, g_scanner_foreach_internal, d);
|
||||
}
|
||||
|
||||
void
|
||||
g_scanner_remove_symbol (GScanner *scanner,
|
||||
const gchar *symbol)
|
||||
@@ -529,6 +642,277 @@ g_scanner_get_char (GScanner *scanner,
|
||||
return fchar;
|
||||
}
|
||||
|
||||
void
|
||||
g_scanner_unexp_token (GScanner *scanner,
|
||||
GTokenType expected_token,
|
||||
const gchar *identifier_spec,
|
||||
const gchar *symbol_spec,
|
||||
const gchar *symbol_name,
|
||||
const gchar *message,
|
||||
gint is_error)
|
||||
{
|
||||
register gchar *token_string;
|
||||
register guint token_string_len;
|
||||
register gchar *expected_string;
|
||||
register guint expected_string_len;
|
||||
register gchar *message_prefix;
|
||||
register gboolean print_unexp;
|
||||
void (*msg_handler) (GScanner*, const gchar*, ...);
|
||||
|
||||
g_return_if_fail (scanner != NULL);
|
||||
|
||||
if (is_error)
|
||||
msg_handler = g_scanner_error;
|
||||
else
|
||||
msg_handler = g_scanner_warn;
|
||||
|
||||
if (!identifier_spec)
|
||||
identifier_spec = "identifier";
|
||||
if (!symbol_spec)
|
||||
symbol_spec = "symbol";
|
||||
|
||||
token_string_len = 56;
|
||||
token_string = g_new (gchar, token_string_len + 1);
|
||||
expected_string_len = 64;
|
||||
expected_string = g_new (gchar, expected_string_len + 1);
|
||||
print_unexp = TRUE;
|
||||
|
||||
switch (scanner->token)
|
||||
{
|
||||
|
||||
case G_TOKEN_EOF:
|
||||
g_snprintf (token_string, token_string_len, "end of file");
|
||||
break;
|
||||
|
||||
default: /* 1 ... 255 */
|
||||
if (scanner->token >= 1 && scanner->token <= 255)
|
||||
{
|
||||
if ((scanner->token >= ' ' && scanner->token <= '~') ||
|
||||
strchr (scanner->config->cset_identifier_first, scanner->token) ||
|
||||
strchr (scanner->config->cset_identifier_nth, scanner->token))
|
||||
g_snprintf (token_string, expected_string_len, "character `%c'", scanner->token);
|
||||
else
|
||||
g_snprintf (token_string, expected_string_len, "character `\\%o'", scanner->token);
|
||||
}
|
||||
else
|
||||
g_snprintf (token_string, token_string_len, "(unknown) token <%d>", scanner->token);
|
||||
break;
|
||||
|
||||
case G_TOKEN_ERROR:
|
||||
print_unexp = FALSE;
|
||||
expected_token = G_TOKEN_NONE;
|
||||
switch (scanner->value.v_error)
|
||||
{
|
||||
case G_ERR_UNEXP_EOF:
|
||||
g_snprintf (token_string, token_string_len, "scanner: unexpected end of file");
|
||||
break;
|
||||
|
||||
case G_ERR_UNEXP_EOF_IN_STRING:
|
||||
g_snprintf (token_string, token_string_len, "scanner: unterminated string constant");
|
||||
break;
|
||||
|
||||
case G_ERR_UNEXP_EOF_IN_COMMENT:
|
||||
g_snprintf (token_string, token_string_len, "scanner: unterminated comment");
|
||||
break;
|
||||
|
||||
case G_ERR_NON_DIGIT_IN_CONST:
|
||||
g_snprintf (token_string, token_string_len, "scanner: non digit in constant");
|
||||
break;
|
||||
|
||||
case G_ERR_FLOAT_RADIX:
|
||||
g_snprintf (token_string, token_string_len, "scanner: invalid radix for floating constant");
|
||||
break;
|
||||
|
||||
case G_ERR_FLOAT_MALFORMED:
|
||||
g_snprintf (token_string, token_string_len, "scanner: malformed floating constant");
|
||||
break;
|
||||
|
||||
case G_ERR_DIGIT_RADIX:
|
||||
g_snprintf (token_string, token_string_len, "scanner: digit is beyond radix");
|
||||
break;
|
||||
|
||||
case G_ERR_UNKNOWN:
|
||||
default:
|
||||
g_snprintf (token_string, token_string_len, "scanner: unknown error");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case G_TOKEN_CHAR:
|
||||
g_snprintf (token_string, token_string_len, "character `%c'", scanner->value.v_char);
|
||||
break;
|
||||
|
||||
case G_TOKEN_SYMBOL:
|
||||
if (expected_token == G_TOKEN_SYMBOL)
|
||||
print_unexp = FALSE;
|
||||
if (symbol_name)
|
||||
g_snprintf (token_string,
|
||||
token_string_len,
|
||||
"%s%s `%s'",
|
||||
print_unexp ? "" : "invalid ",
|
||||
symbol_spec,
|
||||
symbol_name);
|
||||
else
|
||||
g_snprintf (token_string,
|
||||
token_string_len,
|
||||
"%s%s",
|
||||
print_unexp ? "" : "invalid ",
|
||||
symbol_spec);
|
||||
break;
|
||||
|
||||
case G_TOKEN_IDENTIFIER:
|
||||
if (expected_token == G_TOKEN_IDENTIFIER)
|
||||
print_unexp = FALSE;
|
||||
g_snprintf (token_string,
|
||||
token_string_len,
|
||||
"%s%s `%s'",
|
||||
print_unexp ? "" : "invalid ",
|
||||
identifier_spec,
|
||||
scanner->value.v_string);
|
||||
break;
|
||||
|
||||
case G_TOKEN_BINARY:
|
||||
case G_TOKEN_OCTAL:
|
||||
case G_TOKEN_INT:
|
||||
case G_TOKEN_HEX:
|
||||
g_snprintf (token_string, token_string_len, "number `%ld'", scanner->value.v_int);
|
||||
break;
|
||||
|
||||
case G_TOKEN_FLOAT:
|
||||
g_snprintf (token_string, token_string_len, "number `%.3f'", scanner->value.v_float);
|
||||
break;
|
||||
|
||||
case G_TOKEN_STRING:
|
||||
g_snprintf (token_string,
|
||||
token_string_len,
|
||||
"%sstring constant \"%s\"",
|
||||
scanner->value.v_string[0] == 0 ? "empty " : "",
|
||||
scanner->value.v_string);
|
||||
token_string[token_string_len - 2] = '"';
|
||||
token_string[token_string_len - 1] = 0;
|
||||
break;
|
||||
|
||||
case G_TOKEN_COMMENT_SINGLE:
|
||||
case G_TOKEN_COMMENT_MULTI:
|
||||
g_snprintf (token_string, token_string_len, "comment");
|
||||
break;
|
||||
|
||||
case G_TOKEN_NONE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
switch (expected_token)
|
||||
{
|
||||
default: /* 1 ... 255 */
|
||||
if (expected_token >= 1 && expected_token <= 255)
|
||||
{
|
||||
if ((expected_token >= ' ' && expected_token <= '~') ||
|
||||
strchr (scanner->config->cset_identifier_first, expected_token) ||
|
||||
strchr (scanner->config->cset_identifier_nth, expected_token))
|
||||
g_snprintf (expected_string, expected_string_len, "character `%c'", expected_token);
|
||||
else
|
||||
g_snprintf (expected_string, expected_string_len, "character `\\%o'", expected_token);
|
||||
}
|
||||
else
|
||||
g_snprintf (expected_string, expected_string_len, "(unknown) token <%d>", expected_token);
|
||||
break;
|
||||
|
||||
case G_TOKEN_INT:
|
||||
g_snprintf (expected_string, expected_string_len, "number (integer)");
|
||||
break;
|
||||
|
||||
case G_TOKEN_FLOAT:
|
||||
g_snprintf (expected_string, expected_string_len, "number (float)");
|
||||
break;
|
||||
|
||||
case G_TOKEN_STRING:
|
||||
g_snprintf (expected_string, expected_string_len, "string constant");
|
||||
break;
|
||||
|
||||
case G_TOKEN_SYMBOL:
|
||||
g_snprintf (expected_string,
|
||||
expected_string_len,
|
||||
"%s%s",
|
||||
scanner->token == G_TOKEN_SYMBOL ? "valid " : "",
|
||||
symbol_spec);
|
||||
break;
|
||||
|
||||
case G_TOKEN_IDENTIFIER:
|
||||
g_snprintf (expected_string,
|
||||
expected_string_len,
|
||||
"%s%s",
|
||||
scanner->token == G_TOKEN_IDENTIFIER ? "valid " : "",
|
||||
identifier_spec);
|
||||
break;
|
||||
|
||||
case G_TOKEN_NONE:
|
||||
break;
|
||||
}
|
||||
|
||||
if (message && message[0] != 0)
|
||||
message_prefix = " - ";
|
||||
else
|
||||
{
|
||||
message_prefix = "";
|
||||
message = "";
|
||||
}
|
||||
|
||||
if (expected_token != G_TOKEN_NONE)
|
||||
{
|
||||
if (print_unexp)
|
||||
msg_handler (scanner,
|
||||
"unexpected %s, expected %s%s%s",
|
||||
token_string,
|
||||
expected_string,
|
||||
message_prefix,
|
||||
message);
|
||||
else
|
||||
msg_handler (scanner,
|
||||
"%s, expected %s%s%s",
|
||||
token_string,
|
||||
expected_string,
|
||||
message_prefix,
|
||||
message);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (print_unexp)
|
||||
msg_handler (scanner,
|
||||
"unexpected %s%s%s",
|
||||
token_string,
|
||||
message_prefix,
|
||||
message);
|
||||
else
|
||||
msg_handler (scanner,
|
||||
"%s%s%s",
|
||||
token_string,
|
||||
message_prefix,
|
||||
message);
|
||||
}
|
||||
|
||||
g_free (token_string);
|
||||
g_free (expected_string);
|
||||
}
|
||||
|
||||
gint
|
||||
g_scanner_stat_mode (const gchar *filename)
|
||||
{
|
||||
struct stat *stat_buf;
|
||||
gint st_mode;
|
||||
|
||||
stat_buf = g_new0 (struct stat, 1);
|
||||
|
||||
lstat (filename, stat_buf);
|
||||
|
||||
st_mode = stat_buf->st_mode;
|
||||
|
||||
g_free (stat_buf);
|
||||
|
||||
return st_mode;
|
||||
}
|
||||
|
||||
static void
|
||||
g_scanner_free_value (GTokenType *token_p,
|
||||
GValue *value_p)
|
||||
@@ -641,6 +1025,8 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
|
||||
do
|
||||
{
|
||||
register gboolean dotted_float = FALSE;
|
||||
|
||||
ch = g_scanner_get_char (scanner, line_p, position_p);
|
||||
|
||||
value.v_int = 0;
|
||||
@@ -796,6 +1182,7 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
if (!config->scan_float)
|
||||
goto default_case;
|
||||
token = G_TOKEN_FLOAT;
|
||||
dotted_float = TRUE;
|
||||
ch = g_scanner_get_char (scanner, line_p, position_p);
|
||||
goto number_parsing;
|
||||
|
||||
@@ -868,7 +1255,7 @@ g_scanner_get_token_ll (GScanner *scanner,
|
||||
if (token == G_TOKEN_NONE)
|
||||
token = G_TOKEN_INT;
|
||||
|
||||
gstring = g_string_new ("");
|
||||
gstring = g_string_new (dotted_float ? "0." : "");
|
||||
gstring = g_string_append_c (gstring, ch);
|
||||
in_number = TRUE;
|
||||
while (in_number)
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "glib.h"
|
||||
|
||||
@@ -56,7 +57,7 @@ g_slist_set_allocator (GListAllocator* fallocator)
|
||||
|
||||
|
||||
GSList*
|
||||
g_slist_alloc ()
|
||||
g_slist_alloc (void)
|
||||
{
|
||||
GSList *new_list;
|
||||
|
||||
@@ -288,6 +289,16 @@ g_slist_nth (GSList *list,
|
||||
return list;
|
||||
}
|
||||
|
||||
gpointer
|
||||
g_slist_nth_data (GSList *list,
|
||||
guint n)
|
||||
{
|
||||
while ((n-- > 0) && list)
|
||||
list = list->next;
|
||||
|
||||
return list ? list->data : NULL;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_find (GSList *list,
|
||||
gpointer data)
|
||||
@@ -302,6 +313,42 @@ g_slist_find (GSList *list,
|
||||
return list;
|
||||
}
|
||||
|
||||
gint
|
||||
g_slist_position (GSList *list,
|
||||
GSList *link)
|
||||
{
|
||||
gint i;
|
||||
|
||||
i = 0;
|
||||
while (list)
|
||||
{
|
||||
if (list == link)
|
||||
return i;
|
||||
i++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
gint
|
||||
g_slist_index (GSList *list,
|
||||
gpointer data)
|
||||
{
|
||||
gint i;
|
||||
|
||||
i = 0;
|
||||
while (list)
|
||||
{
|
||||
if (list->data == data)
|
||||
return i;
|
||||
i++;
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
GSList*
|
||||
g_slist_last (GSList *list)
|
||||
{
|
||||
|
||||
139
glib/gstring.c
139
glib/gstring.c
@@ -12,14 +12,16 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <glib.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
typedef struct _GRealStringChunk GRealStringChunk;
|
||||
@@ -100,6 +102,8 @@ g_string_chunk_free (GStringChunk *fchunk)
|
||||
GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
|
||||
GSList *tmp_list;
|
||||
|
||||
g_return_if_fail (chunk != NULL);
|
||||
|
||||
if (chunk->storage_list)
|
||||
{
|
||||
GListAllocator *tmp_allocator = g_slist_set_allocator (NULL);
|
||||
@@ -120,12 +124,14 @@ g_string_chunk_free (GStringChunk *fchunk)
|
||||
|
||||
gchar*
|
||||
g_string_chunk_insert (GStringChunk *fchunk,
|
||||
gchar* string)
|
||||
const gchar *string)
|
||||
{
|
||||
GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
|
||||
gint len = strlen (string);
|
||||
char* pos;
|
||||
|
||||
g_return_val_if_fail (chunk != NULL, NULL);
|
||||
|
||||
if ((chunk->storage_next + len + 1) > chunk->this_size)
|
||||
{
|
||||
GListAllocator *tmp_allocator = g_slist_set_allocator (NULL);
|
||||
@@ -154,15 +160,17 @@ g_string_chunk_insert (GStringChunk *fchunk,
|
||||
|
||||
gchar*
|
||||
g_string_chunk_insert_const (GStringChunk *fchunk,
|
||||
gchar* string)
|
||||
const gchar *string)
|
||||
{
|
||||
GRealStringChunk *chunk = (GRealStringChunk*) fchunk;
|
||||
char* lookup;
|
||||
|
||||
g_return_val_if_fail (chunk != NULL, NULL);
|
||||
|
||||
if (!chunk->const_table)
|
||||
chunk->const_table = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
lookup = (char*) g_hash_table_lookup (chunk->const_table, string);
|
||||
lookup = (char*) g_hash_table_lookup (chunk->const_table, (gchar *)string);
|
||||
|
||||
if (!lookup)
|
||||
{
|
||||
@@ -197,7 +205,7 @@ g_string_maybe_expand (GRealString* string, gint len)
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_new (gchar *init)
|
||||
g_string_new (const gchar *init)
|
||||
{
|
||||
GRealString *string;
|
||||
|
||||
@@ -219,8 +227,11 @@ g_string_new (gchar *init)
|
||||
}
|
||||
|
||||
void
|
||||
g_string_free (GString *string, gint free_segment)
|
||||
g_string_free (GString *string,
|
||||
gint free_segment)
|
||||
{
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
if (free_segment)
|
||||
g_free (string->str);
|
||||
|
||||
@@ -229,7 +240,7 @@ g_string_free (GString *string, gint free_segment)
|
||||
|
||||
GString*
|
||||
g_string_assign (GString *lval,
|
||||
char *rval)
|
||||
const gchar *rval)
|
||||
{
|
||||
g_string_truncate (lval, 0);
|
||||
g_string_append (lval, rval);
|
||||
@@ -238,10 +249,13 @@ g_string_assign (GString *lval,
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_truncate (GString* fstring, gint len)
|
||||
g_string_truncate (GString* fstring,
|
||||
gint len)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
string->len = len;
|
||||
|
||||
string->str[len] = 0;
|
||||
@@ -250,11 +264,16 @@ g_string_truncate (GString* fstring, gint len)
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_append (GString *fstring, gchar *val)
|
||||
g_string_append (GString *fstring,
|
||||
const gchar *val)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
int len = strlen (val);
|
||||
int len;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
g_return_val_if_fail (val != NULL, fstring);
|
||||
|
||||
len = strlen (val);
|
||||
g_string_maybe_expand (string, len);
|
||||
|
||||
strcpy (string->str + string->len, val);
|
||||
@@ -265,10 +284,12 @@ g_string_append (GString *fstring, gchar *val)
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_append_c (GString *fstring, char c)
|
||||
g_string_append_c (GString *fstring,
|
||||
gchar c)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
g_string_maybe_expand (string, 1);
|
||||
|
||||
string->str[string->len++] = c;
|
||||
@@ -278,11 +299,16 @@ g_string_append_c (GString *fstring, char c)
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_prepend (GString *fstring, gchar *val)
|
||||
g_string_prepend (GString *fstring,
|
||||
const gchar *val)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
gint len = strlen (val);
|
||||
gint len;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
g_return_val_if_fail (val != NULL, fstring);
|
||||
|
||||
len = strlen (val);
|
||||
g_string_maybe_expand (string, len);
|
||||
|
||||
g_memmove (string->str + len, string->str, string->len);
|
||||
@@ -297,10 +323,12 @@ g_string_prepend (GString *fstring, gchar *val)
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_prepend_c (GString *fstring, char c)
|
||||
g_string_prepend_c (GString *fstring,
|
||||
gchar c)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
g_string_maybe_expand (string, 1);
|
||||
|
||||
g_memmove (string->str + 1, string->str, string->len);
|
||||
@@ -314,17 +342,23 @@ g_string_prepend_c (GString *fstring, char c)
|
||||
return fstring;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_insert (GString *fstring, gint pos, gchar *val)
|
||||
GString*
|
||||
g_string_insert (GString *fstring,
|
||||
gint pos,
|
||||
const gchar *val)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
gint len = strlen (val);
|
||||
gint len;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
g_return_val_if_fail (val != NULL, fstring);
|
||||
g_return_val_if_fail (pos >= 0, fstring);
|
||||
g_return_val_if_fail (pos <= string->len, fstring);
|
||||
|
||||
len = strlen (val);
|
||||
g_string_maybe_expand (string, len);
|
||||
|
||||
g_memmove (string->str + pos + len, string->str + pos, string->len);
|
||||
g_memmove (string->str + pos + len, string->str + pos, string->len - pos);
|
||||
|
||||
strncpy (string->str + pos, val, len);
|
||||
|
||||
@@ -336,15 +370,18 @@ g_string_insert (GString *fstring, gint pos, gchar *val)
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_insert_c (GString *fstring, gint pos, gchar c)
|
||||
g_string_insert_c (GString *fstring,
|
||||
gint pos,
|
||||
gchar c)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
g_return_val_if_fail (pos <= string->len, fstring);
|
||||
|
||||
g_string_maybe_expand (string, 1);
|
||||
|
||||
g_memmove (string->str + pos + 1, string->str + pos, string->len);
|
||||
g_memmove (string->str + pos + 1, string->str + pos, string->len - pos);
|
||||
|
||||
string->str[pos] = c;
|
||||
|
||||
@@ -355,15 +392,21 @@ g_string_insert_c (GString *fstring, gint pos, gchar c)
|
||||
return fstring;
|
||||
}
|
||||
|
||||
GString *
|
||||
g_string_erase (GString *fstring, gint pos, gint len)
|
||||
GString*
|
||||
g_string_erase (GString *fstring,
|
||||
gint pos,
|
||||
gint len)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
g_return_val_if_fail (len >= 0, fstring);
|
||||
g_return_val_if_fail (pos >= 0, fstring);
|
||||
g_return_val_if_fail (pos <= string->len, fstring);
|
||||
g_return_val_if_fail (pos + len <= string->len, fstring);
|
||||
|
||||
g_memmove (string->str + pos, string->str + pos + len, string->len - (pos + len));
|
||||
if (pos + len < string->len)
|
||||
g_memmove (string->str + pos, string->str + pos + len, string->len - (pos + len));
|
||||
|
||||
string->len -= len;
|
||||
|
||||
@@ -372,6 +415,44 @@ g_string_erase (GString *fstring, gint pos, gint len)
|
||||
return fstring;
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_down (GString *fstring)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
gchar *s;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
s = string->str;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
*s = tolower (*s);
|
||||
s++;
|
||||
}
|
||||
|
||||
return fstring;
|
||||
}
|
||||
|
||||
GString*
|
||||
g_string_up (GString *fstring)
|
||||
{
|
||||
GRealString *string = (GRealString*)fstring;
|
||||
gchar *s;
|
||||
|
||||
g_return_val_if_fail (string != NULL, NULL);
|
||||
|
||||
s = string->str;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
*s = toupper (*s);
|
||||
s++;
|
||||
}
|
||||
|
||||
return fstring;
|
||||
}
|
||||
|
||||
static int
|
||||
get_length_upper_bound (const gchar* fmt, va_list *args)
|
||||
{
|
||||
@@ -511,7 +592,7 @@ g_vsprintf (const gchar *fmt,
|
||||
|
||||
static void
|
||||
g_string_sprintfa_int (GString *string,
|
||||
gchar *fmt,
|
||||
const gchar *fmt,
|
||||
va_list *args,
|
||||
va_list *args2)
|
||||
{
|
||||
@@ -519,7 +600,9 @@ g_string_sprintfa_int (GString *string,
|
||||
}
|
||||
|
||||
void
|
||||
g_string_sprintf (GString *string, gchar *fmt, ...)
|
||||
g_string_sprintf (GString *string,
|
||||
const gchar *fmt,
|
||||
...)
|
||||
{
|
||||
va_list args, args2;
|
||||
|
||||
@@ -535,7 +618,9 @@ g_string_sprintf (GString *string, gchar *fmt, ...)
|
||||
}
|
||||
|
||||
void
|
||||
g_string_sprintfa (GString *string, gchar *fmt, ...)
|
||||
g_string_sprintfa (GString *string,
|
||||
const gchar *fmt,
|
||||
...)
|
||||
{
|
||||
va_list args, args2;
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
@@ -31,7 +32,7 @@ struct _GRealTimer
|
||||
|
||||
|
||||
GTimer*
|
||||
g_timer_new ()
|
||||
g_timer_new (void)
|
||||
{
|
||||
GRealTimer *timer;
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "glib.h"
|
||||
|
||||
|
||||
279
glib/gutils.c
279
glib/gutils.c
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@@ -24,13 +25,6 @@
|
||||
#include "glib.h"
|
||||
|
||||
|
||||
static GErrorFunc error_func = NULL;
|
||||
static GWarningFunc warning_func = NULL;
|
||||
static GPrintFunc message_func = NULL;
|
||||
static GPrintFunc print_func = NULL;
|
||||
|
||||
extern char* g_vsprintf (const gchar *fmt, va_list *args, va_list *args2);
|
||||
|
||||
gchar*
|
||||
g_strdup (const gchar *str)
|
||||
{
|
||||
@@ -576,85 +570,85 @@ g_strsignal (gint signum)
|
||||
case SIGQUIT: return "Quit";
|
||||
#endif
|
||||
#ifdef SIGILL
|
||||
case SIGILL: "Illegal instruction";
|
||||
case SIGILL: return "Illegal instruction";
|
||||
#endif
|
||||
#ifdef SIGTRAP
|
||||
case SIGTRAP: "Trace/breakpoint trap";
|
||||
case SIGTRAP: return "Trace/breakpoint trap";
|
||||
#endif
|
||||
#ifdef SIGABRT
|
||||
case SIGABRT: "IOT trap/Abort";
|
||||
case SIGABRT: return "IOT trap/Abort";
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
case SIGBUS: "Bus error";
|
||||
case SIGBUS: return "Bus error";
|
||||
#endif
|
||||
#ifdef SIGFPE
|
||||
case SIGFPE: "Floating point exception";
|
||||
case SIGFPE: return "Floating point exception";
|
||||
#endif
|
||||
#ifdef SIGKILL
|
||||
case SIGKILL: "Killed";
|
||||
case SIGKILL: return "Killed";
|
||||
#endif
|
||||
#ifdef SIGUSR1
|
||||
case SIGUSR1: "User defined signal 1";
|
||||
case SIGUSR1: return "User defined signal 1";
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
case SIGSEGV: "Segmentation fault";
|
||||
case SIGSEGV: return "Segmentation fault";
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
case SIGUSR2: "User defined signal 2";
|
||||
case SIGUSR2: return "User defined signal 2";
|
||||
#endif
|
||||
#ifdef SIGPIPE
|
||||
case SIGPIPE: "Broken pipe";
|
||||
case SIGPIPE: return "Broken pipe";
|
||||
#endif
|
||||
#ifdef SIGALRM
|
||||
case SIGALRM: "Alarm clock";
|
||||
case SIGALRM: return "Alarm clock";
|
||||
#endif
|
||||
#ifdef SIGTERM
|
||||
case SIGTERM: "Terminated";
|
||||
case SIGTERM: return "Terminated";
|
||||
#endif
|
||||
#ifdef SIGSTKFLT
|
||||
case SIGSTKFLT: "Stack fault";
|
||||
case SIGSTKFLT: return "Stack fault";
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
case SIGCHLD: "Child exited";
|
||||
case SIGCHLD: return "Child exited";
|
||||
#endif
|
||||
#ifdef SIGCONT
|
||||
case SIGCONT: "Continued";
|
||||
case SIGCONT: return "Continued";
|
||||
#endif
|
||||
#ifdef SIGSTOP
|
||||
case SIGSTOP: "Stopped (signal)";
|
||||
case SIGSTOP: return "Stopped (signal)";
|
||||
#endif
|
||||
#ifdef SIGTSTP
|
||||
case SIGTSTP: "Stopped";
|
||||
case SIGTSTP: return "Stopped";
|
||||
#endif
|
||||
#ifdef SIGTTIN
|
||||
case SIGTTIN: "Stopped (tty input)";
|
||||
case SIGTTIN: return "Stopped (tty input)";
|
||||
#endif
|
||||
#ifdef SIGTTOU
|
||||
case SIGTTOU: "Stopped (tty output)";
|
||||
case SIGTTOU: return "Stopped (tty output)";
|
||||
#endif
|
||||
#ifdef SIGURG
|
||||
case SIGURG: "Urgent condition";
|
||||
case SIGURG: return "Urgent condition";
|
||||
#endif
|
||||
#ifdef SIGXCPU
|
||||
case SIGXCPU: "CPU time limit exceeded";
|
||||
case SIGXCPU: return "CPU time limit exceeded";
|
||||
#endif
|
||||
#ifdef SIGXFSZ
|
||||
case SIGXFSZ: "File size limit exceeded";
|
||||
case SIGXFSZ: return "File size limit exceeded";
|
||||
#endif
|
||||
#ifdef SIGVTALRM
|
||||
case SIGVTALRM: "Virtual time alarm";
|
||||
case SIGVTALRM: return "Virtual time alarm";
|
||||
#endif
|
||||
#ifdef SIGPROF
|
||||
case SIGPROF: "Profile signal";
|
||||
case SIGPROF: return "Profile signal";
|
||||
#endif
|
||||
#ifdef SIGWINCH
|
||||
case SIGWINCH: "Window size changed";
|
||||
case SIGWINCH: return "Window size changed";
|
||||
#endif
|
||||
#ifdef SIGIO
|
||||
case SIGIO: "Possible I/O";
|
||||
case SIGIO: return "Possible I/O";
|
||||
#endif
|
||||
#ifdef SIGPWR
|
||||
case SIGPWR: "Power failure";
|
||||
case SIGPWR: return "Power failure";
|
||||
#endif
|
||||
#ifdef SIGUNUSED
|
||||
case SIGUNUSED: return "Unused signal";
|
||||
@@ -669,146 +663,6 @@ g_strsignal (gint signum)
|
||||
return msg;
|
||||
}
|
||||
|
||||
void
|
||||
g_error (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (error_func)
|
||||
{
|
||||
(* error_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs ("\n** ERROR **: ", stderr);
|
||||
fputs (buf, stderr);
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
|
||||
abort ();
|
||||
}
|
||||
|
||||
void
|
||||
g_warning (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (warning_func)
|
||||
{
|
||||
(* warning_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs ("\n** WARNING **: ", stderr);
|
||||
fputs (buf, stderr);
|
||||
fputc ('\n', stderr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_message (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (message_func)
|
||||
{
|
||||
(* message_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs ("message: ", stdout);
|
||||
fputs (buf, stdout);
|
||||
fputc ('\n', stdout);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_print (gchar *format, ...)
|
||||
{
|
||||
va_list args, args2;
|
||||
char *buf;
|
||||
|
||||
va_start (args, format);
|
||||
va_start (args2, format);
|
||||
buf = g_vsprintf (format, &args, &args2);
|
||||
va_end (args);
|
||||
va_end (args2);
|
||||
|
||||
if (print_func)
|
||||
{
|
||||
(* print_func) (buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs (buf, stdout);
|
||||
}
|
||||
}
|
||||
|
||||
GErrorFunc
|
||||
g_set_error_handler (GErrorFunc func)
|
||||
{
|
||||
GErrorFunc old_error_func;
|
||||
|
||||
old_error_func = error_func;
|
||||
error_func = func;
|
||||
|
||||
return old_error_func;
|
||||
}
|
||||
|
||||
GWarningFunc
|
||||
g_set_warning_handler (GWarningFunc func)
|
||||
{
|
||||
GWarningFunc old_warning_func;
|
||||
|
||||
old_warning_func = warning_func;
|
||||
warning_func = func;
|
||||
|
||||
return old_warning_func;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_message_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old_message_func;
|
||||
|
||||
old_message_func = message_func;
|
||||
message_func = func;
|
||||
|
||||
return old_message_func;
|
||||
}
|
||||
|
||||
GPrintFunc
|
||||
g_set_print_handler (GPrintFunc func)
|
||||
{
|
||||
GPrintFunc old_print_func;
|
||||
|
||||
old_print_func = print_func;
|
||||
print_func = func;
|
||||
|
||||
return old_print_func;
|
||||
}
|
||||
|
||||
gint
|
||||
g_snprintf (gchar *str,
|
||||
gulong n,
|
||||
@@ -844,25 +698,82 @@ g_snprintf (gchar *str,
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
g_strdown (gchar *string)
|
||||
{
|
||||
register gchar *s;
|
||||
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
s = string;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
*s = tolower (*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
g_strup (gchar *string)
|
||||
{
|
||||
register gchar *s;
|
||||
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
s = string;
|
||||
|
||||
while (*s)
|
||||
{
|
||||
*s = toupper (*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
g_strcasecmp (const gchar *s1, const gchar *s2)
|
||||
g_strcasecmp (const gchar *s1,
|
||||
const gchar *s2)
|
||||
{
|
||||
#ifdef HAVE_STRCASECMP
|
||||
return strcasecmp(s1, s2);
|
||||
return strcasecmp (s1, s2);
|
||||
#else
|
||||
gint c1, c2;
|
||||
|
||||
while (*s1 && *s2)
|
||||
{
|
||||
c1 = tolower((guchar)(*s1++)); c2 = tolower((guchar)(*s2++));
|
||||
/* According to A. Cox, some platforms have islower's that
|
||||
* don't work right on non-uppercase
|
||||
*/
|
||||
c1 = isupper ((guchar)*s1) ? tolower ((guchar)*s1) : *s1;
|
||||
c2 = isupper ((guchar)*s2) ? tolower ((guchar)*s2) : *s2;
|
||||
if (c1 != c2)
|
||||
return (c1 - c2);
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (((gint)(guchar) *s1) - ((gint)(guchar) *s2));
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
g_strdelimit (gchar *string,
|
||||
const gchar *delimiters,
|
||||
gchar new_delim)
|
||||
{
|
||||
register gchar *c;
|
||||
|
||||
g_return_if_fail (string != NULL);
|
||||
|
||||
if (!delimiters)
|
||||
delimiters = G_STR_DELIMITERS;
|
||||
|
||||
for (c = string; *c; c++)
|
||||
{
|
||||
if (strchr (delimiters, *c))
|
||||
*c = new_delim;
|
||||
}
|
||||
}
|
||||
|
||||
guint
|
||||
g_parse_debug_string (const gchar *string,
|
||||
GDebugKey *keys,
|
||||
@@ -873,7 +784,7 @@ g_parse_debug_string (const gchar *string,
|
||||
|
||||
g_return_val_if_fail (string != NULL, 0);
|
||||
|
||||
if (!strcmp (string, "ALL"))
|
||||
if (!g_strcasecmp (string, "all"))
|
||||
{
|
||||
for (i=0; i<nkeys; i++)
|
||||
result |= keys[i].value;
|
||||
@@ -897,7 +808,7 @@ g_parse_debug_string (const gchar *string,
|
||||
*q = 0;
|
||||
|
||||
for (i=0; i<nkeys; i++)
|
||||
if (!strcmp(keys[i].key, p))
|
||||
if (!g_strcasecmp(keys[i].key, p))
|
||||
result |= keys[i].value;
|
||||
|
||||
p = q+1;
|
||||
@@ -909,3 +820,9 @@ g_parse_debug_string (const gchar *string,
|
||||
return result;
|
||||
}
|
||||
|
||||
guint
|
||||
g_direct_hash(gpointer key)
|
||||
{
|
||||
return GPOINTER_TO_UINT (key);
|
||||
}
|
||||
|
||||
|
||||
457
glib/ltconfig
457
glib/ltconfig
@@ -1,8 +1,7 @@
|
||||
#! /bin/sh
|
||||
|
||||
# ltconfig - Create a system-specific libtool.
|
||||
# Generated automatically from ltconfig.in by configure.
|
||||
# Copyright (C) 1996, 1997, Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-1998 Free Software Foundation, Inc.
|
||||
# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
@@ -26,26 +25,74 @@
|
||||
|
||||
# A lot of this script is taken from autoconf-2.10.
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
|
||||
|
||||
echo=echo
|
||||
if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then :
|
||||
else
|
||||
# The Solaris, AIX, and Digital Unix default echo programs unquote
|
||||
# backslashes. This makes it impossible to quote backslashes using
|
||||
# echo "$something" | sed 's/\\/\\\\/g'
|
||||
#
|
||||
# So, first we look for a working echo in the user's PATH.
|
||||
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for dir in $PATH /usr/ucb; do
|
||||
if test -f $dir/echo && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo="$dir/echo"
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
|
||||
if test "X$echo" = Xecho; then
|
||||
# We didn't find a better echo, so look for alternatives.
|
||||
if test "X`(print -r '\t') 2>/dev/null`" = 'X\t'; then
|
||||
# This shell has a builtin print -r that does the trick.
|
||||
echo='print -r'
|
||||
#
|
||||
# The following is from libtool-1.2a, won't work with this patched
|
||||
# libtool-1.2
|
||||
#
|
||||
# elif test -f /bin/ksh && test "X$CONFIG_SHELL" != X/bin/ksh; then
|
||||
# # If we have ksh, try running ltconfig again with it.
|
||||
# CONFIG_SHELL=/bin/ksh
|
||||
# export CONFIG_SHELL
|
||||
# exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
|
||||
else
|
||||
# Try using printf.
|
||||
echo='printf %s\n'
|
||||
if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then :
|
||||
else
|
||||
# Oops. We lost completely, so just stick with echo.
|
||||
echo=echo
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Sed substitution that helps us do robust quoting. It backslashifies
|
||||
# metacharacters that are still active within double-quoted strings.
|
||||
Xsed='sed -e s/^X//'
|
||||
sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
|
||||
|
||||
# Same as above, but do not quote variable references.
|
||||
double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
|
||||
|
||||
# The name of this program.
|
||||
progname=`echo "$0" | sed 's%^.*/%%'`
|
||||
progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'`
|
||||
|
||||
# Constants:
|
||||
PROGRAM=ltconfig
|
||||
PACKAGE=libtool
|
||||
VERSION=1.0f
|
||||
VERSION=1.2
|
||||
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.c 1>&5'
|
||||
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.c $LIBS 1>&5'
|
||||
rm="rm -f"
|
||||
|
||||
help="Try \`$progname --help' for more information."
|
||||
|
||||
# Sed substitution that helps us do robust quoting. It backslashifies
|
||||
# metacharacters that are still active within double-quoted strings.
|
||||
sed_quote_subst='s/\([\\"$\\\\]\)/\\\1/g'
|
||||
|
||||
# Same as above, but don't quote variable references.
|
||||
double_quote_subst='s/\([\\"\\\\]\)/\\\1/g'
|
||||
|
||||
# Global variables:
|
||||
can_build_shared=yes
|
||||
enable_shared=yes
|
||||
@@ -99,7 +146,7 @@ Generate a system-specific libtool script.
|
||||
--help display this help and exit
|
||||
--no-verify do not verify that HOST is a valid host type
|
||||
--quiet same as \`--silent'
|
||||
--silent don't print informational messages
|
||||
--silent do not print informational messages
|
||||
--srcdir=DIR find \`config.guess' in DIR
|
||||
--version output version information and exit
|
||||
--with-gcc assume that the GNU C compiler will be used
|
||||
@@ -139,7 +186,7 @@ EOM
|
||||
if test -z "$ltmain"; then
|
||||
ltmain="$option"
|
||||
elif test -z "$host"; then
|
||||
# FIXME This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
|
||||
# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1
|
||||
# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then
|
||||
# echo "$progname: warning \`$option' is not a valid host type" 1>&2
|
||||
# fi
|
||||
@@ -160,7 +207,9 @@ fi
|
||||
|
||||
if test -f "$ltmain"; then :
|
||||
else
|
||||
echo "$progname: warning: \`$ltmain' does not exist" 1>&2
|
||||
echo "$progname: \`$ltmain' does not exist" 1>&2
|
||||
echo "$help" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Quote any args containing shell metacharacters.
|
||||
@@ -212,7 +261,7 @@ fi
|
||||
|
||||
if test -z "$srcdir"; then
|
||||
# Assume the source directory is the same one as the path to ltmain.sh.
|
||||
srcdir=`echo "$ltmain" | sed 's%/[^/]*$%%'`
|
||||
srcdir=`$echo "$ltmain" | $Xsed -e 's%/[^/]*$%%'`
|
||||
test "$srcdir" = "$ltmain" && srcdir=.
|
||||
fi
|
||||
|
||||
@@ -268,10 +317,10 @@ else
|
||||
host_alias=$host
|
||||
fi
|
||||
|
||||
# Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
|
||||
case "$host" in
|
||||
*-*-linux-gnu*) ;;
|
||||
*-*-linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
|
||||
# Transform linux* to *-*-linux-gnu*, to support old configure scripts.
|
||||
case "$host_os" in
|
||||
linux-gnu*) ;;
|
||||
linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
|
||||
esac
|
||||
|
||||
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
@@ -279,7 +328,7 @@ host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
aix3*)
|
||||
# AIX sometimes has problems with the GCC collect2 program. For some
|
||||
# reason, if we set the COLLECT_NAMES environment variable, the problems
|
||||
# vanish in a puff of smoke.
|
||||
@@ -293,6 +342,7 @@ esac
|
||||
# Determine commands to create old-style static archives.
|
||||
old_archive_cmds='$AR cru $oldlib$oldobjs'
|
||||
old_postinstall_cmds='chmod 644 $oldlib'
|
||||
old_postuninstall_cmds=
|
||||
|
||||
# Set a sane default for `AR'.
|
||||
test -z "$AR" && AR=ar
|
||||
@@ -318,7 +368,7 @@ fi
|
||||
|
||||
if test -n "$RANLIB"; then
|
||||
old_archive_cmds="$old_archive_cmds;\$RANLIB \$oldlib"
|
||||
old_postinstall_cmds="$old_postinstall_cmds;\$RANLIB \$oldlib"
|
||||
old_postinstall_cmds="\$RANLIB \$oldlib;$old_postinstall_cmds"
|
||||
fi
|
||||
|
||||
# Check to see if we are using GCC.
|
||||
@@ -391,7 +441,7 @@ if test "$with_gcc" != yes || test -z "$CC"; then
|
||||
# Now see if the compiler is really GCC.
|
||||
with_gcc=no
|
||||
echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6
|
||||
echo "$progname:394: checking whether we are using GNU C" >&5
|
||||
echo "$progname:444: checking whether we are using GNU C" >&5
|
||||
|
||||
$rm conftest.c
|
||||
cat > conftest.c <<EOF
|
||||
@@ -399,7 +449,7 @@ if test "$with_gcc" != yes || test -z "$CC"; then
|
||||
yes;
|
||||
#endif
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
if { ac_try='${CC-cc} -E conftest.c'; { (eval echo $progname:452: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
|
||||
with_gcc=yes
|
||||
fi
|
||||
$rm conftest.c
|
||||
@@ -412,14 +462,12 @@ compiler="$2"
|
||||
|
||||
echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6
|
||||
pic_flag=
|
||||
profile_flag_pattern=
|
||||
special_shlib_compile_flags=
|
||||
wl=
|
||||
link_static_flag=
|
||||
no_builtin_flag=
|
||||
|
||||
if test "$with_gcc" = yes; then
|
||||
profile_flag_pattern='-pg?'
|
||||
wl='-Wl,'
|
||||
link_static_flag='-static'
|
||||
no_builtin_flag=' -fno-builtin'
|
||||
@@ -431,6 +479,12 @@ if test "$with_gcc" = yes; then
|
||||
os2*)
|
||||
# We can build DLLs from non-PIC.
|
||||
;;
|
||||
amigaos*)
|
||||
# FIXME: we need at least 68020 code to build shared libraries, but
|
||||
# adding the `-m68020' flag to GCC prevents building anything better,
|
||||
# like `-m68040'.
|
||||
pic_flag='-m68020 -resident32 -malways-restore-a4'
|
||||
;;
|
||||
*)
|
||||
pic_flag='-fPIC'
|
||||
;;
|
||||
@@ -446,7 +500,7 @@ else
|
||||
hpux9* | hpux10*)
|
||||
# Is there a better link_static_flag that works with the bundled CC?
|
||||
wl='-Wl,'
|
||||
link_static_flag='${wl}-a ${wl}archive'
|
||||
link_static_flag="${wl}-a ${wl}archive"
|
||||
pic_flag='+Z'
|
||||
;;
|
||||
|
||||
@@ -484,6 +538,12 @@ else
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
|
||||
sysv4.2uw2*)
|
||||
pic_flag='-KPIC'
|
||||
link_static_flag='-Bstatic'
|
||||
wl='-Wl,'
|
||||
;;
|
||||
|
||||
uts4*)
|
||||
pic_flag='-pic'
|
||||
link_static_flag='-Bstatic'
|
||||
@@ -504,14 +564,15 @@ if test -n "$pic_flag"; then
|
||||
echo > conftest.c
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $pic_flag -DPIC"
|
||||
echo "$progname:507: checking if $compiler PIC flag $pic_flag works" >&5
|
||||
if { (eval echo $progname:508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
|
||||
# Append any errors to the config.log.
|
||||
echo "$progname:567: checking if $compiler PIC flag $pic_flag works" >&5
|
||||
if { (eval echo $progname:568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then
|
||||
# Append any warnings to the config.log.
|
||||
cat conftest.err 1>&5
|
||||
|
||||
# On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also
|
||||
# reports no error. So, we need to grep stderr for (Bundled).
|
||||
if grep '(Bundled)' conftest.err >/dev/null; then
|
||||
# On HP-UX, both CC and GCC only warn that PIC is supported... then they
|
||||
# create non-PIC objects. So, if there were any warnings, we assume that
|
||||
# PIC is not supported.
|
||||
if test -s conftest.err; then
|
||||
echo "$ac_t"no 1>&6
|
||||
can_build_shared=no
|
||||
pic_flag=
|
||||
@@ -547,8 +608,8 @@ $rm conftest*
|
||||
echo 'main(){return(0);}' > conftest.c
|
||||
save_LDFLAGS="$LDFLAGS"
|
||||
LDFLAGS="$LDFLAGS $link_static_flag"
|
||||
echo "$progname:550: checking if $compiler static flag $link_static_flag works" >&5
|
||||
if { (eval echo $progname:551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
echo "$progname:611: checking if $compiler static flag $link_static_flag works" >&5
|
||||
if { (eval echo $progname:612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
echo "$ac_t$link_static_flag" 1>&6
|
||||
else
|
||||
echo "$ac_t"none 1>&6
|
||||
@@ -580,15 +641,15 @@ if test -z "$LD"; then
|
||||
if test "$with_gcc" = yes; then
|
||||
# Check if gcc -print-prog-name=ld gives a path.
|
||||
echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6
|
||||
echo "$progname:583: checking for ld used by GCC" >&5
|
||||
echo "$progname:644: checking for ld used by GCC" >&5
|
||||
ac_prog=`($CC -print-prog-name=ld) 2>&5`
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
/*)
|
||||
/* | [A-Za-z]:\\*)
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
# If it fails, then pretend we are not using GCC.
|
||||
ac_prog=ld
|
||||
;;
|
||||
*)
|
||||
@@ -598,10 +659,10 @@ if test -z "$LD"; then
|
||||
esac
|
||||
elif test "$with_gnu_ld" = yes; then
|
||||
echo $ac_n "checking for GNU ld... $ac_c" 1>&6
|
||||
echo "$progname:601: checking for GNU ld" >&5
|
||||
echo "$progname:662: checking for GNU ld" >&5
|
||||
else
|
||||
echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6
|
||||
echo "$progname:604: checking for non-GNU ld" >&5
|
||||
echo "$progname:665: checking for non-GNU ld" >&5
|
||||
fi
|
||||
|
||||
if test -z "$LD"; then
|
||||
@@ -635,7 +696,7 @@ if test -z "$LD"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check to see if it really is or isn't GNU ld.
|
||||
# Check to see if it really is or is not GNU ld.
|
||||
echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6
|
||||
# I'd rather use --version here, but apparently some GNU ld's only accept -v.
|
||||
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
|
||||
@@ -649,6 +710,7 @@ echo "$ac_t$with_gnu_ld" 1>&6
|
||||
echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
|
||||
|
||||
allow_undefined_flag=
|
||||
no_undefined_flag=
|
||||
archive_cmds=
|
||||
old_archive_from_new_cmds=
|
||||
export_dynamic_flag_spec=
|
||||
@@ -656,43 +718,41 @@ hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
hardcode_runpath_var=no
|
||||
hardcode_shlibpath_var=unsupported
|
||||
runpath_var=
|
||||
|
||||
case "$host_os" in
|
||||
amigaos* | sunos4*)
|
||||
# On these operating systems, we should treat GNU ld like the system ld.
|
||||
gnu_ld_acts_native=yes
|
||||
;;
|
||||
*)
|
||||
gnu_ld_acts_native=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
if test "$with_gnu_ld" = yes && test "$gnu_ld_acts_native" != yes; then
|
||||
|
||||
# See if GNU ld supports shared libraries.
|
||||
|
||||
case "$host_os" in
|
||||
sunos4*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs'
|
||||
runpath_var=LD_RUN_PATH
|
||||
ld_shlibs=yes
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
|
||||
runpath_var=LD_RUN_PATH
|
||||
hardcode_runpath_var=yes
|
||||
ld_shlibs=yes
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
|
||||
if test "$ld_shlibs" = yes; then
|
||||
archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
|
||||
hardcode_libdir_flag_spec='${wl}-rpath $wl$libdir'
|
||||
export_dynamic_flag_spec='${wl}-export-dynamic'
|
||||
hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
|
||||
export_dynamic_flag_spec='${wl}--export-dynamic'
|
||||
fi
|
||||
else
|
||||
# PORTME fill in a description of your system's linker (not GNU ld)
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE$deplibs;$AR cru $lib $objdir/$soname'
|
||||
archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE;$AR cru $lib $objdir/$soname'
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
@@ -705,25 +765,32 @@ else
|
||||
|
||||
aix4*)
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '"'s/.* //'"' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry$deplibs;$AR cru $lib $objdir/$soname'
|
||||
archive_cmds='$NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;$CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
archive_cmds='$rm $objdir/a2ixlibrary.data;$echo "#define NAME $libname" > $objdir/a2ixlibrary.data;$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data;$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data;$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data;$AR cru $lib$libobjs;$RANLIB $lib;(cd $objdir && a2ixlibrary -32)'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
|
||||
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
|
||||
# support. Future versions do this automatically, but an explicit c++rt0.o
|
||||
# doesn't break anything, and helps significantly (at the cost of a little
|
||||
# does not break anything, and helps significantly (at the cost of a little
|
||||
# extra space).
|
||||
freebsd2.2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o'
|
||||
archive_cmds='$LD -Bshareable -o $lib$libobjs /usr/lib/c++rt0.o'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
# Unfortunately, older versions of FreeBSD 2 don't have this feature.
|
||||
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
|
||||
freebsd2*)
|
||||
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
|
||||
archive_cmds='$LD -Bshareable -o $lib$libobjs'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
@@ -731,7 +798,7 @@ else
|
||||
|
||||
# FreeBSD 3, at last, uses gcc -shared to do shared libraries.
|
||||
freebsd3*)
|
||||
archive_cmds='$CC -shared -o $lib$libobjs$deplibs'
|
||||
archive_cmds='$CC -shared -o $lib$libobjs'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
@@ -739,21 +806,23 @@ else
|
||||
;;
|
||||
|
||||
hpux9*)
|
||||
archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;mv $objdir/$soname $lib'
|
||||
archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs;mv $objdir/$soname $lib'
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
export_dynamic_flag_spec='${wl}-E'
|
||||
;;
|
||||
|
||||
hpux10*)
|
||||
archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs'
|
||||
archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs'
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
export_dynamic_flag_spec='${wl}-E'
|
||||
;;
|
||||
|
||||
irix5* | irix6*)
|
||||
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs$deplibs'
|
||||
archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs'
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
;;
|
||||
|
||||
@@ -766,7 +835,7 @@ else
|
||||
;;
|
||||
|
||||
openbsd*)
|
||||
archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
|
||||
archive_cmds='$LD -Bshareable -o $lib$libobjs'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_shlibpath_var=no
|
||||
@@ -776,7 +845,7 @@ else
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
allow_undefined_flag=unsupported
|
||||
archive_cmds='echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;echo DATA >> $objdir/$libname.def;echo " SINGLE NONSHARED" >> $objdir/$libname.def;echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def'
|
||||
archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;$echo DATA >> $objdir/$libname.def;$echo " SINGLE NONSHARED" >> $objdir/$libname.def;$echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def'
|
||||
old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
|
||||
;;
|
||||
|
||||
@@ -788,31 +857,47 @@ else
|
||||
;;
|
||||
|
||||
sco3.2v5*)
|
||||
archive_cmds='$LD -G -o $lib$libobjs$deplibs'
|
||||
archive_cmds='$LD -G -o $lib$libobjs'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
|
||||
solaris2*)
|
||||
archive_cmds='$LD -G -z text -h $soname -o $lib$libobjs$deplibs'
|
||||
no_undefined_flag=' -z text'
|
||||
archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs'
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_shlibpath_var=no
|
||||
|
||||
# Solaris 2 before 2.5 hardcodes -L paths.
|
||||
case "$host_os" in
|
||||
solaris2.[0-4]*)
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
|
||||
if test "$with_gcc" = yes; then
|
||||
archive_cmds='$CC -shared -o $lib$libobjs'
|
||||
else
|
||||
archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
|
||||
fi
|
||||
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
export_dynamic_flag_spec='${wl}-export-dynamic'
|
||||
fi
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
uts4*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
uts4*)
|
||||
archive_cmds='$LD -G -h $soname -o $lib$libobjs'
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
hardcode_shlibpath_var=no
|
||||
;;
|
||||
|
||||
*)
|
||||
ld_shlibs=no
|
||||
@@ -825,16 +910,18 @@ echo "$ac_t$ld_shlibs" 1>&6
|
||||
if test -z "$NM"; then
|
||||
echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6
|
||||
case "$NM" in
|
||||
/*) ;; # Let the user override the test with a path.
|
||||
/* | [A-Za-z]:\\*) ;; # Let the user override the test with a path.
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb $PATH /bin; do
|
||||
test -z "$ac_dir" && dir=.
|
||||
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
if ($ac_dir/nm -B /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
|
||||
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
|
||||
# nm: unknown option "B" ignored
|
||||
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
NM="$ac_dir/nm -B"
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1; exit 0) | grep /dev/null >/dev/null; then
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
NM="$ac_dir/nm -p"
|
||||
else
|
||||
NM="$ac_dir/nm"
|
||||
@@ -869,6 +956,10 @@ case "$host_os" in
|
||||
aix*)
|
||||
symcode='[BCDTU]'
|
||||
;;
|
||||
irix*)
|
||||
# Cannot use undefined symbols on IRIX because inlined functions mess us up.
|
||||
symcode='[BCDEGRST]'
|
||||
;;
|
||||
solaris2*)
|
||||
symcode='[BDTU]'
|
||||
;;
|
||||
@@ -897,17 +988,17 @@ void nm_test_func(){}
|
||||
main(){nm_test_var='a';nm_test_func();return(0);}
|
||||
EOF
|
||||
|
||||
echo "$progname:900: checking if global_symbol_pipe works" >&5
|
||||
if { (eval echo $progname:901: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
|
||||
echo "$progname:991: checking if global_symbol_pipe works" >&5
|
||||
if { (eval echo $progname:992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then
|
||||
# Now try to grab the symbols.
|
||||
nlist=conftest.nm
|
||||
if { echo "$progname:904: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
|
||||
if { echo "$progname:995: eval \"$NM conftest.o | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.o | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then
|
||||
|
||||
# Try sorting and uniquifying the output.
|
||||
if sort "$nlist" | uniq > "$nlist"T; then
|
||||
mv -f "$nlist"T "$nlist"
|
||||
wcout=`wc "$nlist" 2>/dev/null`
|
||||
count=`echo "$wcout" | sed 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
|
||||
count=`$echo "X$wcout" | $Xsed -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
|
||||
(test "$count" -ge 0) 2>/dev/null || count=-1
|
||||
else
|
||||
rm -f "$nlist"T
|
||||
@@ -944,9 +1035,9 @@ struct {
|
||||
dld_preloaded_symbols[] =
|
||||
{
|
||||
EOF
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", \&\2},/' < "$nlist" >> conftest.c
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$nlist" >> conftest.c
|
||||
cat <<\EOF >> conftest.c
|
||||
{0},
|
||||
{0, (__ptr_t) 0}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -959,7 +1050,7 @@ EOF
|
||||
save_CFLAGS="$CFLAGS"
|
||||
LIBS='conftestm.o'
|
||||
CFLAGS="$CFLAGS$no_builtin_flag"
|
||||
if { (eval echo $progname:962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
if { (eval echo $progname:1053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
|
||||
pipe_works=yes
|
||||
else
|
||||
echo "$progname: failed program was:" >&5
|
||||
@@ -981,7 +1072,7 @@ else
|
||||
fi
|
||||
$rm conftest*
|
||||
|
||||
# Don't use the global_symbol_pipe unless it works.
|
||||
# Do not use the global_symbol_pipe unless it works.
|
||||
echo "$ac_t$pipe_works" 1>&6
|
||||
test "$pipe_works" = yes || global_symbol_pipe=
|
||||
|
||||
@@ -989,7 +1080,7 @@ test "$pipe_works" = yes || global_symbol_pipe=
|
||||
echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6
|
||||
hardcode_action=
|
||||
if test -n "$hardcode_libdir_flag_spec" || \
|
||||
test "$hardcode_runpath_var" = yes; then
|
||||
test -n "$runpath_var"; then
|
||||
|
||||
# We can hardcode non-existant directories.
|
||||
if test "$hardcode_direct" != no && \
|
||||
@@ -1005,7 +1096,7 @@ if test -n "$hardcode_libdir_flag_spec" || \
|
||||
elif test "$hardcode_direct" != yes && \
|
||||
test "$hardcode_minus_L" != yes && \
|
||||
test "$hardcode_shlibpath_var" != yes; then
|
||||
# We can't hardcode anything.
|
||||
# We cannot hardcode anything.
|
||||
hardcode_action=unsupported
|
||||
else
|
||||
# We can only hardcode existing directories.
|
||||
@@ -1028,7 +1119,9 @@ library_names_spec=
|
||||
libname_spec='lib$name'
|
||||
soname_spec=
|
||||
postinstall_cmds=
|
||||
postuninstall_cmds=
|
||||
finish_cmds=
|
||||
finish_eval=
|
||||
shlibpath_var=
|
||||
version_type=none
|
||||
dynamic_linker="$host_os ld.so"
|
||||
@@ -1037,23 +1130,29 @@ echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
|
||||
case "$host_os" in
|
||||
aix3* | aix4*)
|
||||
version_type=linux
|
||||
library_names_spec='$libname.so.$versuffix $libname.a'
|
||||
library_names_spec='${libname}${release}.so.$versuffix $libname.a'
|
||||
shlibpath_var=LIBPATH
|
||||
|
||||
# AIX has no versioning support, so we append a major version to the name.
|
||||
soname_spec='$libname.so.$major'
|
||||
soname_spec='${libname}${release}.so.$major'
|
||||
;;
|
||||
|
||||
amigaos*)
|
||||
library_names_spec='$libname.ixlibrary $libname.a'
|
||||
# Create ${libname}_ixlibrary.a entries in /sys/libs.
|
||||
finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
|
||||
;;
|
||||
|
||||
freebsd2* | freebsd3*)
|
||||
version_type=sunos
|
||||
library_names_spec='$libname.so.$versuffix $libname.so'
|
||||
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
|
||||
library_names_spec='${libname}${release}.so.$versuffix $libname.so'
|
||||
finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
gnu*)
|
||||
version_type=sunos
|
||||
library_names_spec='$libname.so.$versuffix'
|
||||
library_names_spec='${libname}${release}.so.$versuffix'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
@@ -1063,16 +1162,16 @@ hpux9* | hpux10*)
|
||||
dynamic_linker="$host_os dld.sl"
|
||||
version_type=sunos
|
||||
shlibpath_var=SHLIB_PATH
|
||||
library_names_spec='$libname.sl.$versuffix $libname.sl.$major $libname.sl'
|
||||
soname_spec='$libname.sl.$major'
|
||||
library_names_spec='${libname}${release}.sl.$versuffix ${libname}${release}.sl.$major $libname.sl'
|
||||
soname_spec='${libname}${release}.sl.$major'
|
||||
# HP-UX runs *really* slowly unless shared libraries are mode 555.
|
||||
postinstall_cmds='chmod 555 $lib'
|
||||
;;
|
||||
|
||||
irix5* | irix6*)
|
||||
version_type=osf
|
||||
soname_spec='$libname.so'
|
||||
library_names_spec='$libname.so.$versuffix $libname.so'
|
||||
soname_spec='${libname}${release}.so'
|
||||
library_names_spec='${libname}${release}.so.$versuffix $libname.so'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
@@ -1084,9 +1183,9 @@ linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
|
||||
# This must be Linux ELF.
|
||||
linux-gnu*)
|
||||
version_type=linux
|
||||
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
|
||||
soname_spec='$libname.so.$major'
|
||||
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
|
||||
library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
|
||||
soname_spec='${libname}${release}.so.$major'
|
||||
finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
|
||||
if test -f /lib/ld.so.1; then
|
||||
@@ -1102,13 +1201,12 @@ linux-gnu*)
|
||||
|
||||
netbsd* | openbsd*)
|
||||
version_type=sunos
|
||||
library_names_spec='$libname.so.$versuffix'
|
||||
finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
|
||||
library_names_spec='${libname}${release}.so.$versuffix'
|
||||
finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
os2*)
|
||||
version_type=none
|
||||
libname_spec='$name'
|
||||
library_names_spec='$libname.dll $libname.a'
|
||||
dynamic_linker='OS/2 ld.exe'
|
||||
@@ -1117,36 +1215,43 @@ os2*)
|
||||
|
||||
osf3* | osf4*)
|
||||
version_type=osf
|
||||
soname_spec='$libname.so'
|
||||
library_names_spec='$libname.so.$versuffix $libname.so'
|
||||
soname_spec='${libname}${release}.so'
|
||||
library_names_spec='${libname}${release}.so.$versuffix $libname.so'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
sco3.2v5*)
|
||||
version_type=osf
|
||||
soname_spec='$libname.so.$major'
|
||||
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
|
||||
soname_spec='${libname}${release}.so.$major'
|
||||
library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
solaris2*)
|
||||
version_type=linux
|
||||
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
|
||||
soname_spec='$libname.so.$major'
|
||||
library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
|
||||
soname_spec='${libname}${release}.so.$major'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
sunos4*)
|
||||
version_type=sunos
|
||||
library_names_spec='$libname.so.$versuffix'
|
||||
finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
|
||||
library_names_spec='${libname}${release}.so.$versuffix'
|
||||
finish_cmds='PATH="$PATH:/usr/etc" ldconfig $libdir'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
sysv4.2uw2*)
|
||||
version_type=linux
|
||||
library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
|
||||
soname_spec='${libname}${release}.so.$major'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
uts4*)
|
||||
version_type=linux
|
||||
library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so'
|
||||
soname_spec='$libname.so.$major'
|
||||
library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so'
|
||||
soname_spec='${libname}${release}.so.$major'
|
||||
shlibpath_var=LD_LIBRARY_PATH
|
||||
;;
|
||||
|
||||
@@ -1157,12 +1262,6 @@ esac
|
||||
echo "$ac_t$dynamic_linker"
|
||||
test "$dynamic_linker" = no && can_build_shared=no
|
||||
|
||||
# FIXME add checks for striplib and old_striplib here.
|
||||
# strip -x works for most platforms, though not for static libraries on NetBSD
|
||||
# HP-UX requires "-r" for library stripping
|
||||
striplib=
|
||||
old_striplib=
|
||||
|
||||
# Report the final consequences.
|
||||
echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6
|
||||
|
||||
@@ -1200,25 +1299,30 @@ fi
|
||||
rmdir .libs 2>/dev/null
|
||||
echo "$ac_t$objdir" 1>&6
|
||||
|
||||
# Copy echo and quote the copy, instead of the original, because it is
|
||||
# used later.
|
||||
ltecho="$echo"
|
||||
|
||||
# Now quote all the things that may contain metacharacters.
|
||||
for var in old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
|
||||
for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \
|
||||
old_LN_S AR CC LD LN_S NM reload_flag reload_cmds wl pic_flag \
|
||||
link_static_flag no_builtin_flag export_dynamic_flag_spec \
|
||||
profile_flag_pattern libname_spec library_names_spec soname_spec RANLIB \
|
||||
libname_spec library_names_spec soname_spec RANLIB \
|
||||
old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
|
||||
archive_cmds postinstall_cmds \
|
||||
allow_undefined_flag finish_cmds global_symbol_pipe \
|
||||
striplib old_striplib \
|
||||
old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \
|
||||
allow_undefined_flag no_undefined_flag \
|
||||
finish_cmds finish_eval global_symbol_pipe \
|
||||
hardcode_libdir_flag_spec hardcode_libdir_separator; do
|
||||
|
||||
case "$var" in
|
||||
reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \
|
||||
old_postinstall_cmds | archive_cmds | postinstall_cmds | finish_cmds)
|
||||
old_postinstall_cmds | old_postuninstall_cmds | archive_cmds | \
|
||||
postinstall_cmds | postuninstall_cmds | finish_cmds)
|
||||
# Double-quote double-evaled strings.
|
||||
eval "$var=\`echo \"\$$var\" | sed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`"
|
||||
eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\"\`"
|
||||
;;
|
||||
*)
|
||||
eval "$var=\`echo \"\$$var\" | sed \"\$sed_quote_subst\"\`"
|
||||
eval "$var=\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
@@ -1231,8 +1335,31 @@ cat <<EOF > $ofile
|
||||
#! /bin/sh
|
||||
|
||||
# libtool - Provide generalized library-building support services.
|
||||
#
|
||||
# Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION
|
||||
# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh.
|
||||
#
|
||||
# Copyright (C) 1996-1998 Free Software Foundation, Inc.
|
||||
# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This program was configured as follows,
|
||||
# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
|
||||
#
|
||||
@@ -1243,6 +1370,16 @@ cat <<EOF > $ofile
|
||||
# Compiler and other test output produced by $progname, useful for
|
||||
# debugging $progname, is in ./config.log if it exists.
|
||||
|
||||
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
|
||||
Xsed="sed -e s/^X//"
|
||||
|
||||
# The HP-UX ksh and POSIX shell print the target directory to stdout
|
||||
# if CDPATH is set.
|
||||
if test "\${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
|
||||
|
||||
# An echo program that does not interpret backslashes.
|
||||
echo="$ltecho"
|
||||
|
||||
# The version of $progname that generated this script.
|
||||
LTCONFIG_VERSION="$VERSION"
|
||||
|
||||
@@ -1296,9 +1433,6 @@ no_builtin_flag="$no_builtin_flag"
|
||||
# Compiler flag to allow reflexive dlopens.
|
||||
export_dynamic_flag_spec="$export_dynamic_flag_spec"
|
||||
|
||||
# Pattern to match compiler flags for creating libNAME_p libraries:
|
||||
profile_flag_pattern="$profile_flag_pattern"
|
||||
|
||||
# Library versioning type.
|
||||
version_type=$version_type
|
||||
|
||||
@@ -1316,6 +1450,7 @@ soname_spec="$soname_spec"
|
||||
RANLIB="$RANLIB"
|
||||
old_archive_cmds="$old_archive_cmds"
|
||||
old_postinstall_cmds="$old_postinstall_cmds"
|
||||
old_postuninstall_cmds="$old_postuninstall_cmds"
|
||||
|
||||
# Create an old-style archive from a shared archive.
|
||||
old_archive_from_new_cmds="$old_archive_from_new_cmds"
|
||||
@@ -1323,20 +1458,23 @@ old_archive_from_new_cmds="$old_archive_from_new_cmds"
|
||||
# Commands used to build and install a shared archive.
|
||||
archive_cmds="$archive_cmds"
|
||||
postinstall_cmds="$postinstall_cmds"
|
||||
postuninstall_cmds="$postuninstall_cmds"
|
||||
|
||||
# Flag that allows shared libraries with undefined symbols to be built.
|
||||
allow_undefined_flag="$allow_undefined_flag"
|
||||
|
||||
# Flag that forces no undefined symbols.
|
||||
no_undefined_flag="$no_undefined_flag"
|
||||
|
||||
# Commands used to finish a libtool library installation in a directory.
|
||||
finish_cmds="$finish_cmds"
|
||||
|
||||
# Same as above, but a single script fragment to be evaled but not shown.
|
||||
finish_eval="$finish_eval"
|
||||
|
||||
# Take the output of nm and produce a listing of raw symbols and C names.
|
||||
global_symbol_pipe="$global_symbol_pipe"
|
||||
|
||||
# How to strip a library file.
|
||||
striplib="$striplib"
|
||||
old_striplib="$old_striplib"
|
||||
|
||||
# This is the shared library runtime path variable.
|
||||
runpath_var=$runpath_var
|
||||
|
||||
@@ -1361,10 +1499,6 @@ hardcode_direct=$hardcode_direct
|
||||
# resulting binary.
|
||||
hardcode_minus_L=$hardcode_minus_L
|
||||
|
||||
# Set to yes if using RUNPATH_VAR=DIR during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_runpath_var=$hardcode_runpath_var
|
||||
|
||||
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
|
||||
# the resulting binary.
|
||||
hardcode_shlibpath_var=$hardcode_shlibpath_var
|
||||
@@ -1372,7 +1506,7 @@ hardcode_shlibpath_var=$hardcode_shlibpath_var
|
||||
EOF
|
||||
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
aix3*)
|
||||
cat <<\EOF >> $ofile
|
||||
# AIX sometimes has problems with the GCC collect2 program. For some
|
||||
# reason, if we set the COLLECT_NAMES environment variable, the problems
|
||||
@@ -1386,25 +1520,8 @@ EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
# Detect if we are using a relative or absolute path to ltmain.sh.
|
||||
case "$ltmain" in
|
||||
/*) cat <<EOF >> $ofile
|
||||
# Execute the libtool backend.
|
||||
. $ltmain
|
||||
EOF
|
||||
;;
|
||||
*) cat <<EOF >> $ofile
|
||||
# Find the path to this script.
|
||||
thisdir=\`echo "\$0" | sed -e 's%/[^/]*\$%%'\`
|
||||
test "X\$0" = "X\$thisdir" && thisdir=.
|
||||
|
||||
# Execute the libtool backend.
|
||||
. \$thisdir/$ltmain
|
||||
EOF
|
||||
;;
|
||||
esac
|
||||
|
||||
echo 'exit 1' >> $ofile
|
||||
# Append the ltmain.sh script.
|
||||
cat "$ltmain" >> $ofile || (rm -f $ofile; exit 1)
|
||||
|
||||
chmod +x $ofile
|
||||
exit 0
|
||||
|
||||
856
glib/ltmain.sh
856
glib/ltmain.sh
File diff suppressed because it is too large
Load Diff
@@ -12,8 +12,9 @@
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -87,14 +88,6 @@ my_traverse (gpointer key,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
print_compare (gchar *a,
|
||||
gchar *b)
|
||||
{
|
||||
g_print ("%s <=> %s : %d\n", a, b, g_strcasecmp(a,b));
|
||||
g_print ("%s <=> %s : %d\n", b, a, g_strcasecmp(b,a));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@@ -115,9 +108,9 @@ main (int argc,
|
||||
GTree *tree;
|
||||
char chars[62];
|
||||
|
||||
g_print ("checking size of gint8...%d (should be 1)\n", sizeof (gint8));
|
||||
g_print ("checking size of gint16...%d (should be 2)\n", sizeof (gint16));
|
||||
g_print ("checking size of gint32...%d (should be 4)\n", sizeof (gint32));
|
||||
g_print ("checking size of gint8...%ld (should be 1)\n", (glong)sizeof (gint8));
|
||||
g_print ("checking size of gint16...%ld (should be 2)\n", (glong)sizeof (gint16));
|
||||
g_print ("checking size of gint32...%ld (should be 4)\n", (glong)sizeof (gint32));
|
||||
|
||||
g_print ("checking doubly linked lists...");
|
||||
|
||||
@@ -133,6 +126,10 @@ main (int argc,
|
||||
g_error ("Regular insert failed");
|
||||
}
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
if(g_list_position(list, g_list_nth (list, i)) != i)
|
||||
g_error("g_list_position does not seem to be the inverse of g_list_nth\n");
|
||||
|
||||
g_list_free (list);
|
||||
list = NULL;
|
||||
|
||||
@@ -396,8 +393,6 @@ main (int argc,
|
||||
g_print ("ok\n");
|
||||
|
||||
g_print ("checking g_strcasecmp...\n");
|
||||
print_compare ("Schlo<EFBFBD>ß", "Schlo");
|
||||
print_compare ("<EFBFBD>Äffchen", "<EFBFBD>Öfchen");
|
||||
|
||||
/* g_debug (argv[0]); */
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
gtkincludedir = $(includedir)/gtk
|
||||
|
||||
lib_LTLIBRARIES = libgtk.la
|
||||
lib_LTLIBRARIES = libgtk-1.1.la
|
||||
|
||||
libgtk_la_SOURCES = \
|
||||
libgtk_1_1_la_SOURCES = \
|
||||
gtkaccelerator.c \
|
||||
gtkadjustment.c \
|
||||
gtkaspectframe.c \
|
||||
@@ -93,6 +93,7 @@ libgtk_la_SOURCES = \
|
||||
gtkvseparator.c \
|
||||
gtkwidget.c \
|
||||
gtkwindow.c \
|
||||
gtkthemes.c \
|
||||
fnmatch.c \
|
||||
fnmatch.h
|
||||
|
||||
@@ -122,6 +123,7 @@ gtkinclude_HEADERS = \
|
||||
gtkentry.h \
|
||||
gtkenums.h \
|
||||
gtkeventbox.h \
|
||||
gtkfeatures.h \
|
||||
gtkfilesel.h \
|
||||
gtkfixed.h \
|
||||
gtkframe.h \
|
||||
@@ -191,19 +193,21 @@ gtkinclude_HEADERS = \
|
||||
gtkwindow.h \
|
||||
gtktypebuiltins.h
|
||||
|
||||
../gtk/gtktypebuiltins.h: gtk.defs gentypeinfo.el
|
||||
$(srcdir)/gtktypebuiltins.h: @MAINT@ $(srcdir)/gtk.defs $(srcdir)/gentypeinfo.el
|
||||
$(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el idmac $< $@
|
||||
|
||||
gtktypebuiltins.c: gtk.defs gentypeinfo.el
|
||||
$(srcdir)/gtktypebuiltins.c: @MAINT@ $(srcdir)/gtk.defs $(srcdir)/gentypeinfo.el
|
||||
$(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el id $< $@
|
||||
|
||||
libgtk_la_LDFLAGS = -version-info 1:0:0
|
||||
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 \
|
||||
@@ -218,52 +222,36 @@ EXTRA_DIST = \
|
||||
tree_minus.xbm \
|
||||
circles.xbm
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib -I../glib @x_cflags@
|
||||
INCLUDES = -I$(top_srcdir) -I../glib -I$(top_srcdir)/glib @x_cflags@
|
||||
|
||||
noinst_PROGRAMS = testgtk testinput testselection simple
|
||||
testgtk_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
testinput_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
# FIXME, we currently rely on linking against libglib-1.1
|
||||
|
||||
testselection_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
simple_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
DEPS = \
|
||||
$(top_builddir)/gtk/libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
$(top_builddir)/glib/libglib.la
|
||||
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 -ldl -lgdk_imlib -ljpeg -ltiff -lgif -lpng -lz -lm
|
||||
|
||||
testgtk_DEPENDENCIES = $(DEPS)
|
||||
testinput_DEPENDENCIES = $(DEPS)
|
||||
testselection_DEPENDENCIES = $(DEPS)
|
||||
simple_DEPENDENCIES = $(DEPS)
|
||||
|
||||
.PHONY: files
|
||||
testgtk_LDADD = $(LDADDS)
|
||||
testinput_LDADD = $(LDADDS)
|
||||
testselection_LDADD = $(LDADDS)
|
||||
simple_LDADD = $(LDADDS)
|
||||
|
||||
|
||||
.PHONY: files test test-debug
|
||||
|
||||
files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
@@ -271,7 +259,11 @@ files:
|
||||
done
|
||||
|
||||
test: testgtk
|
||||
( CWD=`pwd` ; cd $(srcdir) ; $$CWD/testgtk )
|
||||
builddir=`pwd`; cd $(top_builddir); top_builddir=`pwd`; \
|
||||
cd $$builddir; cd $(srcdir); \
|
||||
$(SHELL) $$top_builddir/libtool --mode=execute $$builddir/testgtk
|
||||
|
||||
test-debug: testgtk
|
||||
( CWD=`pwd` ; cd $(srcdir) ; gdb $$CWD/testgtk )
|
||||
builddir=`pwd`; cd $(top_builddir); top_builddir=`pwd`; \
|
||||
cd $$builddir; cd $(srcdir); \
|
||||
$(SHELL) $$top_builddir/libtool --mode=execute gdb $$builddir/testgtk
|
||||
|
||||
690
gtk/Makefile.in
690
gtk/Makefile.in
@@ -1,690 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.2c from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997 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
|
||||
|
||||
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 = true
|
||||
PRE_INSTALL = true
|
||||
POST_INSTALL = true
|
||||
NORMAL_UNINSTALL = true
|
||||
PRE_UNINSTALL = true
|
||||
POST_UNINSTALL = true
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP = @CPP@
|
||||
LD = @LD@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
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.la
|
||||
|
||||
libgtk_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 \
|
||||
gtkcurve.c \
|
||||
gtkdata.c \
|
||||
gtkdialog.c \
|
||||
gtkdrawingarea.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 \
|
||||
gtkstyle.c \
|
||||
gtkstatusbar.c \
|
||||
gtktable.c \
|
||||
gtktext.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 \
|
||||
gtkcurve.h \
|
||||
gtkdata.h \
|
||||
gtkdialog.h \
|
||||
gtkdrawingarea.h \
|
||||
gtkentry.h \
|
||||
gtkenums.h \
|
||||
gtkeventbox.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 \
|
||||
gtkprogressbar.h \
|
||||
gtkradiobutton.h \
|
||||
gtkradiomenuitem.h \
|
||||
gtkrange.h \
|
||||
gtkrc.h \
|
||||
gtkruler.h \
|
||||
gtkscale.h \
|
||||
gtkscrollbar.h \
|
||||
gtkscrolledwindow.h \
|
||||
gtkselection.h \
|
||||
gtkseparator.h \
|
||||
gtksignal.h \
|
||||
gtkstyle.h \
|
||||
gtkstatusbar.h \
|
||||
gtktable.h \
|
||||
gtktext.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_la_LDFLAGS = -version-info 1:0:0
|
||||
|
||||
EXTRA_DIST = \
|
||||
line-arrow.xbm \
|
||||
line-wrap.xbm \
|
||||
testgtkrc \
|
||||
gtk.defs \
|
||||
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
|
||||
|
||||
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/glib @x_cflags@
|
||||
|
||||
noinst_PROGRAMS = testgtk testinput testselection simple testtree
|
||||
testgtk_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
testinput_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
testselection_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
simple_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
testtree_LDADD = \
|
||||
libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
$(top_builddir)/glib/libglib.la \
|
||||
-lm
|
||||
|
||||
DEPS = \
|
||||
$(top_builddir)/gtk/libgtk.la \
|
||||
$(top_builddir)/gdk/libgdk.la \
|
||||
$(top_builddir)/glib/libglib.la
|
||||
|
||||
testgtk_DEPENDENCIES = $(DEPS)
|
||||
testinput_DEPENDENCIES = $(DEPS)
|
||||
testselection_DEPENDENCIES = $(DEPS)
|
||||
simple_DEPENDENCIES = $(DEPS)
|
||||
testtree_DEPENDENCIES = $(DEPS)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
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_la_LIBADD =
|
||||
libgtk_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 gtkcurve.lo \
|
||||
gtkdata.lo gtkdialog.lo gtkdrawingarea.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 gtkstyle.lo gtkstatusbar.lo gtktable.lo \
|
||||
gtktext.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 =
|
||||
simple_SOURCES = simple.c
|
||||
simple_OBJECTS = simple.o
|
||||
simple_LDFLAGS =
|
||||
testtree_SOURCES = testtree.c
|
||||
testtree_OBJECTS = testtree.o
|
||||
testtree_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
|
||||
|
||||
|
||||
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/gtkcurve.P .deps/gtkdata.P .deps/gtkdialog.P \
|
||||
.deps/gtkdrawingarea.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/gtkstatusbar.P .deps/gtkstyle.P \
|
||||
.deps/gtktable.P .deps/gtktext.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/testtree.P
|
||||
SOURCES = $(libgtk_la_SOURCES) testgtk.c testinput.c testselection.c simple.c testtree.c
|
||||
OBJECTS = $(libgtk_la_OBJECTS) testgtk.o testinput.o testselection.o simple.o testtree.o
|
||||
|
||||
default: all
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o
|
||||
$(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
|
||||
|
||||
|
||||
mostlyclean-libLTLIBRARIES:
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
|
||||
distclean-libLTLIBRARIES:
|
||||
|
||||
maintainer-clean-libLTLIBRARIES:
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(libdir)
|
||||
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo "$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p"; \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
|
||||
$(LIBTOOL) --mode=uninstall rm -f $(libdir)/$$p; \
|
||||
done
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
.c.lo:
|
||||
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs
|
||||
|
||||
distclean-libtool:
|
||||
|
||||
maintainer-clean-libtool:
|
||||
|
||||
libgtk.la: $(libgtk_la_OBJECTS) $(libgtk_la_DEPENDENCIES)
|
||||
$(LINK) -rpath $(libdir) $(libgtk_la_LDFLAGS) $(libgtk_la_OBJECTS) $(libgtk_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)
|
||||
|
||||
simple: $(simple_OBJECTS) $(simple_DEPENDENCIES)
|
||||
@rm -f simple
|
||||
$(LINK) $(simple_LDFLAGS) $(simple_OBJECTS) $(simple_LDADD) $(LIBS)
|
||||
|
||||
testtree: $(testtree_OBJECTS) $(testtree_DEPENDENCIES)
|
||||
@rm -f testtree
|
||||
$(LINK) $(testtree_LDFLAGS) $(testtree_OBJECTS) $(testtree_LDADD) $(LIBS)
|
||||
|
||||
install-gtkincludeHEADERS: $(gtkinclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(gtkincludedir)
|
||||
@list='$(gtkinclude_HEADERS)'; for p in $$list; do \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(gtkincludedir)/$$p"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(gtkincludedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-gtkincludeHEADERS:
|
||||
$(NORMAL_UNINSTALL)
|
||||
list='$(gtkinclude_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(gtkincludedir)/$$p; \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES)
|
||||
here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -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
|
||||
|
||||
MKDEP = $(CC) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
|
||||
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||
-include .deps/.P
|
||||
.deps/.P: $(BUILT_SOURCES)
|
||||
echo > $@
|
||||
|
||||
-include $(DEP_FILES)
|
||||
|
||||
mostlyclean-depend:
|
||||
|
||||
clean-depend:
|
||||
|
||||
distclean-depend:
|
||||
|
||||
maintainer-clean-depend:
|
||||
-rm -rf .deps
|
||||
|
||||
.deps/%.P: %.c
|
||||
@echo "Computing dependencies for $<..."
|
||||
@o='o'; \
|
||||
test -n "$o" && o='$$o'; \
|
||||
$(MKDEP) $< >$@.tmp \
|
||||
&& sed "s,^\(.*\)\.o:,\1.$$o \1.l$$o $@:," < $@.tmp > $@ \
|
||||
&& rm -f $@.tmp
|
||||
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
|
||||
|
||||
all: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(libdir) $(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: default 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
|
||||
|
||||
|
||||
../gtk/gtktypebuiltins.h: gtk.defs gentypeinfo.el
|
||||
$(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el idmac $< $@
|
||||
|
||||
gtktypebuiltins.c: gtk.defs gentypeinfo.el
|
||||
$(SHELL) $(srcdir)/runelisp $(srcdir)/gentypeinfo.el id $< $@
|
||||
|
||||
.PHONY: files
|
||||
|
||||
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:
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user