Compare commits
347 Commits
dropdown-s
...
GTK_1_2_8
Author | SHA1 | Date | |
---|---|---|---|
|
52223d33df | ||
|
3a5d4e0087 | ||
|
b055c28254 | ||
|
21d6acdd59 | ||
|
71112bd2ea | ||
|
76014e2a5f | ||
|
5a4b3458f9 | ||
|
bb255d8d68 | ||
|
90e47067c4 | ||
|
42c524897f | ||
|
93fe7a1353 | ||
|
3d46b64e3d | ||
|
5d1c00802e | ||
|
eda7c00f58 | ||
|
ab364d726a | ||
|
7d622f5328 | ||
|
ee76654247 | ||
|
cc4ef5bcdf | ||
|
2e34ce303a | ||
|
44e72c4ac1 | ||
|
74bd7ec0a1 | ||
|
4078590376 | ||
|
388e9cc8b1 | ||
|
a24c0e61f6 | ||
|
877738b90a | ||
|
fcfaafd93e | ||
|
30cc40d29e | ||
|
86171eb551 | ||
|
8ae8964c9f | ||
|
5d4a62a69b | ||
|
572cec3f4c | ||
|
a53000aa95 | ||
|
ac67b09410 | ||
|
e57721e0ba | ||
|
fa77e9551f | ||
|
01ae7f9537 | ||
|
60aea982b0 | ||
|
5c478e3754 | ||
|
2853369686 | ||
|
a326074438 | ||
|
778cb9ab52 | ||
|
3f8d44d715 | ||
|
c39a5a1c6f | ||
|
319b25908b | ||
|
49bc9e0606 | ||
|
81cb919181 | ||
|
1f72a1fd70 | ||
|
5aa2275d8b | ||
|
ed581c7530 | ||
|
84591d622b | ||
|
d5c5dba8de | ||
|
b40cc444eb | ||
|
c299e5d963 | ||
|
7de47cc94b | ||
|
cec440f3e4 | ||
|
255369aecb | ||
|
c59f760824 | ||
|
06b6a0f70a | ||
|
dad7ab1fd6 | ||
|
bd39b10fc4 | ||
|
3dad840ffb | ||
|
ef642b7799 | ||
|
958d74e856 | ||
|
39246639a1 | ||
|
e5b7ec7e36 | ||
|
b269eb0874 | ||
|
9770128fb9 | ||
|
c1f4231af6 | ||
|
f86f2a2944 | ||
|
04d6ead184 | ||
|
4249864c0d | ||
|
cc7b995f66 | ||
|
03fc238e46 | ||
|
911ced17c2 | ||
|
67dbd575c2 | ||
|
c3bf3122da | ||
|
1175039476 | ||
|
373c75d574 | ||
|
fcd4498506 | ||
|
7c1abc5f73 | ||
|
25b47b88cd | ||
|
638080f28a | ||
|
087eed88f3 | ||
|
ecc7096f83 | ||
|
29edc1802f | ||
|
bd063a8f9a | ||
|
bc36a3cdb0 | ||
|
cb0c6a6943 | ||
|
ddd28f9d4c | ||
|
4ff91a04c0 | ||
|
1b1ea194a5 | ||
|
d74b6b56e6 | ||
|
822fab280f | ||
|
7b31d00ddf | ||
|
f6e398fa53 | ||
|
6eb684bebc | ||
|
d8ebd2d78a | ||
|
0d4c279b4b | ||
|
6c70ce7260 | ||
|
828b8b8600 | ||
|
bcb86b752f | ||
|
0a4ea40510 | ||
|
43f31b2e7d | ||
|
10b03b35c0 | ||
|
ab3a70ee16 | ||
|
b0e81d06c0 | ||
|
6ed6b20570 | ||
|
9230dc1470 | ||
|
47e15bdf5f | ||
|
e9c55bc8ce | ||
|
703f17ec05 | ||
|
3b3891191e | ||
|
ae1f478285 | ||
|
1e8e510300 | ||
|
d7e9880433 | ||
|
23c00ecebe | ||
|
6841c77b0c | ||
|
abfd8215f8 | ||
|
e69a498bd5 | ||
|
ad246fcf51 | ||
|
e322f322e2 | ||
|
d76955e34b | ||
|
003c5dccd0 | ||
|
95a5e5cd09 | ||
|
fe725cf7d9 | ||
|
4a50847abd | ||
|
83f3b1e8e3 | ||
|
fd37d2bdb0 | ||
|
3b8ecf24f6 | ||
|
91307e5e87 | ||
|
c2aaaf16f3 | ||
|
5bfdcc2c3e | ||
|
2dc5212004 | ||
|
4478fefd28 | ||
|
91da226af7 | ||
|
f8ca8253f9 | ||
|
9b98ede875 | ||
|
a97747dfc7 | ||
|
5739ca8f3b | ||
|
9cc3eb8c0d | ||
|
6b5d56e39c | ||
|
7a4bc2038f | ||
|
6b7f4bb036 | ||
|
51bae3f9cd | ||
|
60a7c53123 | ||
|
ee09d2e5da | ||
|
4eb1338d42 | ||
|
8e8ac56db5 | ||
|
54a90a6c61 | ||
|
fc0117177c | ||
|
8a7795d2db | ||
|
2a0a33bc35 | ||
|
cd1c6de2ea | ||
|
44a04ee211 | ||
|
b107653636 | ||
|
90d2cae68c | ||
|
369ea6013d | ||
|
175b04c33d | ||
|
389f174dad | ||
|
c98ffe744f | ||
|
661d0ad067 | ||
|
f04d58dd29 | ||
|
0ab9dddc34 | ||
|
7347cd702f | ||
|
531f44bbdc | ||
|
d807397177 | ||
|
8014d7db5e | ||
|
8cf06479ae | ||
|
123914048c | ||
|
91645584a5 | ||
|
6362c20b8b | ||
|
a88d8fff6d | ||
|
61f9087af4 | ||
|
2b2ee64b60 | ||
|
4767c40249 | ||
|
844cbfb1ba | ||
|
04d23ae07e | ||
|
59724766af | ||
|
2c331c9fdf | ||
|
df57d883b3 | ||
|
c9dec55549 | ||
|
22a15408bb | ||
|
3abc634152 | ||
|
ad9263ec39 | ||
|
501c87a65d | ||
|
f9c868233f | ||
|
0285d26804 | ||
|
189706f619 | ||
|
b4def251f8 | ||
|
ddc6217c32 | ||
|
80ed2661c5 | ||
|
088428655b | ||
|
be326a5a7c | ||
|
108d82e785 | ||
|
c431108d84 | ||
|
bd2194afb1 | ||
|
39fb4797ae | ||
|
10f1fff6ec | ||
|
becd87fbd4 | ||
|
55c0a94c2c | ||
|
c64f52a36c | ||
|
b2a084beb4 | ||
|
57485d9029 | ||
|
92671fe1f6 | ||
|
5e049110f3 | ||
|
d008fbb84d | ||
|
b7fa562427 | ||
|
5bfd32fd64 | ||
|
b977baed2b | ||
|
39024c05ae | ||
|
8ec53bf61b | ||
|
b6d42f7eb7 | ||
|
7a73d7bd4d | ||
|
083941009f | ||
|
eb0859b277 | ||
|
bb2b76689c | ||
|
65725a25ff | ||
|
bd91541a01 | ||
|
2e6baef994 | ||
|
6469f8473e | ||
|
40d855bb0c | ||
|
fb44e1b6df | ||
|
0ab658cd10 | ||
|
f5891aa3bf | ||
|
5568346aa2 | ||
|
0f8e13ca60 | ||
|
8830e211f8 | ||
|
a6c5f95bac | ||
|
bae298ea0e | ||
|
4139d6fc64 | ||
|
54b231b034 | ||
|
0c39d9a4f3 | ||
|
263a095543 | ||
|
fe3173bd1a | ||
|
6eb649146c | ||
|
b7b01fa9d3 | ||
|
4f490f626a | ||
|
66a7a593e2 | ||
|
bd7c5b22be | ||
|
32e24f9f32 | ||
|
f50fed4098 | ||
|
13aa12ea14 | ||
|
ca599d6060 | ||
|
029baff26a | ||
|
79e872c851 | ||
|
fa80ff6c59 | ||
|
58102a49f0 | ||
|
d38f1248d1 | ||
|
8e401114ef | ||
|
46144b1be4 | ||
|
af5243ab71 | ||
|
37ad5eb7c0 | ||
|
d97fede574 | ||
|
dc624c4dd8 | ||
|
43e80bc87a | ||
|
4c09ae6026 | ||
|
86e47a1efa | ||
|
b90f0c9ee7 | ||
|
e0bc92268b | ||
|
94ba2610fe | ||
|
b39b03d27d | ||
|
611e6e20e7 | ||
|
852baf9bfe | ||
|
2d19ab20f7 | ||
|
f9aee08d6e | ||
|
c084c71294 | ||
|
c288d2419e | ||
|
8d32617d16 | ||
|
651a662ba5 | ||
|
1c2bde024e | ||
|
3680b735d7 | ||
|
9d40a0cd27 | ||
|
dc9569756e | ||
|
0ef2295c53 | ||
|
519fed9991 | ||
|
5e52b31fd7 | ||
|
bbe8b7ba61 | ||
|
f187c3bb24 | ||
|
6227a115be | ||
|
2f80acc28e | ||
|
30d6a30b01 | ||
|
7f9cb3548b | ||
|
17c8d9cd74 | ||
|
197950e184 | ||
|
bbf7b3a60f | ||
|
498b5eca13 | ||
|
658f736af1 | ||
|
edf4aa4bcd | ||
|
3046ab9f0f | ||
|
a654f96831 | ||
|
ff01cccfb9 | ||
|
0c177d15d1 | ||
|
be0f11a4d2 | ||
|
ed0db4cd4f | ||
|
1cc01ceb59 | ||
|
caf95cd161 | ||
|
83c4021614 | ||
|
fdb8efb35a | ||
|
9ad66ac6e8 | ||
|
3834ea83c0 | ||
|
e3b8c8ba92 | ||
|
e6828ec4e4 | ||
|
7ee4ba7781 | ||
|
3a03678080 | ||
|
badd841246 | ||
|
ffafb164d9 | ||
|
8286bd2493 | ||
|
ceb0f66e51 | ||
|
3de957405f | ||
|
4361369939 | ||
|
0d353949e2 | ||
|
80c5ac85d4 | ||
|
b44c5d0f0c | ||
|
7ac92e74e8 | ||
|
eaa98e5cfc | ||
|
db496116d9 | ||
|
d32d93cc3c | ||
|
da74d5d843 | ||
|
44dd4a430d | ||
|
fcc38c19d8 | ||
|
737580cc57 | ||
|
db025ebfb0 | ||
|
0ae73a09dd | ||
|
2c659472e2 | ||
|
0720955e17 | ||
|
0c90498103 | ||
|
bab8d95583 | ||
|
3f2cd052fd | ||
|
0362058f6e | ||
|
b59eefd649 | ||
|
287624f406 | ||
|
d4ecce94c8 | ||
|
536673ad38 | ||
|
8b424288ba | ||
|
f880eba7cd | ||
|
ac8d845b3d | ||
|
b691a88e07 | ||
|
af138bc287 | ||
|
29ce61fcf3 | ||
|
69d2eba366 | ||
|
efb837bdb6 | ||
|
5db63aaa6d | ||
|
7e8d27f327 | ||
|
8556b64654 | ||
|
12d38df79e | ||
|
7699e34d83 | ||
|
14ff63b93d |
@@ -13,3 +13,5 @@ gtk-config
|
||||
config.cache
|
||||
ABOUT-NLS
|
||||
intl
|
||||
stamp-h.in
|
||||
gtk+.spec
|
||||
|
2580
ChangeLog.pre-2-0
2580
ChangeLog.pre-2-0
File diff suppressed because it is too large
Load Diff
2580
ChangeLog.pre-2-10
2580
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
2580
ChangeLog.pre-2-2
2580
ChangeLog.pre-2-2
File diff suppressed because it is too large
Load Diff
2580
ChangeLog.pre-2-4
2580
ChangeLog.pre-2-4
File diff suppressed because it is too large
Load Diff
2580
ChangeLog.pre-2-6
2580
ChangeLog.pre-2-6
File diff suppressed because it is too large
Load Diff
2580
ChangeLog.pre-2-8
2580
ChangeLog.pre-2-8
File diff suppressed because it is too large
Load Diff
53
INSTALL
53
INSTALL
@@ -7,12 +7,12 @@ you got this package.
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-1.2.0.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.2.0 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
% gzip -cd gtk+-1.2.8.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-1.2.8 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
% make install # install GTK
|
||||
% make install # install GTK
|
||||
|
||||
The Nitty-Gritty
|
||||
================
|
||||
@@ -43,6 +43,13 @@ which form of support to use:
|
||||
|
||||
For more information, follow the link from http://www.gtk.org
|
||||
|
||||
* --disable-nls do not use Native Language Support
|
||||
|
||||
If this flag is not specified, GTK+ will try to find
|
||||
and use the gettext() set of functions to provide translations
|
||||
of the strings in the standard dialogs into the
|
||||
user's native language.
|
||||
|
||||
* --enable-xim support XIM [default=yes]
|
||||
|
||||
Specifying --disable-xim will disable support for entering
|
||||
@@ -50,7 +57,7 @@ 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
|
||||
@@ -84,19 +91,43 @@ or,
|
||||
|
||||
setenv CFLAGS -O2 ; ./configure # csh and variants
|
||||
|
||||
Native-Language Support and gettext()
|
||||
=====================================
|
||||
|
||||
Using an uninstalled copy of GLIB
|
||||
=================================
|
||||
To provide native-language support (NLS) GTK+ uses the
|
||||
gettext() set of functions. These functions are found
|
||||
in the C library on many systems, such as the Solaris
|
||||
C library and the GNU C Library, version 2.
|
||||
|
||||
If your C library does not provide the necessary functionality,
|
||||
you may wish to install the GNU gettext package. You'll
|
||||
need version 0.10.35 or better. Version 0.10.35 is
|
||||
available from ftp://alpha.gnu.org/pub/gnu
|
||||
|
||||
Generally, GTK+ will properly detect what is installed
|
||||
on your system and enable or disable NLS as appropriate.
|
||||
However, in rare cases, it may be necessary to disable
|
||||
NLS manually to get GTK+ to compile. You can do this
|
||||
by specifying the --disable-nls flag when configuring
|
||||
GTK+.
|
||||
|
||||
Using an uninstalled copy of GLIB [ Unsupported ]
|
||||
=================================================
|
||||
|
||||
You can compile GTK+ against a copy of GLIB that you have not
|
||||
yet installed. To do this, give the --with-glib=DIR options
|
||||
to ./configure. For instance:
|
||||
|
||||
./configure --with-glib=../glib-1.2.0
|
||||
./configure --with-glib=../glib-1.2.8
|
||||
|
||||
This, however, will not work if you built GLIB with different
|
||||
source and build directories.
|
||||
|
||||
It is recommended that you install GLIB before compiling
|
||||
GTK+. The --with-glib option is not regularly tested
|
||||
and may not function correctly. In addition,
|
||||
inter-library dependencies won't be generated when
|
||||
using --with-glib=.
|
||||
|
||||
Installation directories
|
||||
========================
|
||||
@@ -126,7 +157,7 @@ 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
|
||||
* 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:
|
||||
|
||||
@@ -138,7 +169,7 @@ 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
|
||||
(In particular, this occurs with GNU libc 2.0 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.)
|
||||
|
187
INSTALL.in
Normal file
187
INSTALL.in
Normal file
@@ -0,0 +1,187 @@
|
||||
Prerequisites
|
||||
=============
|
||||
|
||||
GTK+ requires the GLIB library, available at the same location as
|
||||
you got this package.
|
||||
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-@GTK_VERSION@.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-@GTK_VERSION@ # 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
|
||||
|
||||
* --disable-nls do not use Native Language Support
|
||||
|
||||
If this flag is not specified, GTK+ will try to find
|
||||
and use the gettext() set of functions to provide translations
|
||||
of the strings in the standard dialogs into the
|
||||
user's native language.
|
||||
|
||||
* --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
|
||||
with older versions of X.
|
||||
|
||||
* --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.
|
||||
|
||||
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.
|
||||
|
||||
|
||||
Options can be given to the compiler and linker by setting
|
||||
environment variables before running configure. A few of the more
|
||||
important ones:
|
||||
|
||||
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
|
||||
|
||||
Native-Language Support and gettext()
|
||||
=====================================
|
||||
|
||||
To provide native-language support (NLS) GTK+ uses the
|
||||
gettext() set of functions. These functions are found
|
||||
in the C library on many systems, such as the Solaris
|
||||
C library and the GNU C Library, version 2.
|
||||
|
||||
If your C library does not provide the necessary functionality,
|
||||
you may wish to install the GNU gettext package. You'll
|
||||
need version 0.10.35 or better. Version 0.10.35 is
|
||||
available from ftp://alpha.gnu.org/pub/gnu
|
||||
|
||||
Generally, GTK+ will properly detect what is installed
|
||||
on your system and enable or disable NLS as appropriate.
|
||||
However, in rare cases, it may be necessary to disable
|
||||
NLS manually to get GTK+ to compile. You can do this
|
||||
by specifying the --disable-nls flag when configuring
|
||||
GTK+.
|
||||
|
||||
Using an uninstalled copy of GLIB [ Unsupported ]
|
||||
=================================================
|
||||
|
||||
You can compile GTK+ against a copy of GLIB that you have not
|
||||
yet installed. To do this, give the --with-glib=DIR options
|
||||
to ./configure. For instance:
|
||||
|
||||
./configure --with-glib=../glib-@GTK_VERSION@
|
||||
|
||||
This, however, will not work if you built GLIB with different
|
||||
source and build directories.
|
||||
|
||||
It is recommended that you install GLIB before compiling
|
||||
GTK+. The --with-glib option is not regularly tested
|
||||
and may not function correctly. In addition,
|
||||
inter-library dependencies won't be generated when
|
||||
using --with-glib=.
|
||||
|
||||
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 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.
|
||||
|
||||
|
1
MAINTAINERS
Normal file
1
MAINTAINERS
Normal file
@@ -0,0 +1 @@
|
||||
Email: gtk-bugs@gimp.org
|
17
Makefile.am
17
Makefile.am
@@ -1,10 +1,13 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
## Makefile.am for GTK+
|
||||
|
||||
SRC_SUBDIRS = gdk gtk
|
||||
SUBDIRS = po $(SRC_SUBDIRS) docs
|
||||
|
||||
bin_SCRIPTS = gtk-config
|
||||
|
||||
# require automake 1.4
|
||||
AUTOMAKE_OPTIONS = 1.4
|
||||
|
||||
EXTRA_DIST = \
|
||||
HACKING \
|
||||
gtk+.spec.in \
|
||||
@@ -28,7 +31,7 @@ EXTRA_DIST = \
|
||||
examples/buttons/buttons.c \
|
||||
examples/buttons/info.xpm \
|
||||
examples/calendar/Makefile \
|
||||
examples/calendar/gcalendar.c \
|
||||
examples/calendar/calendar.c \
|
||||
examples/clist/Makefile \
|
||||
examples/clist/clist.c \
|
||||
examples/entry/Makefile \
|
||||
@@ -97,8 +100,14 @@ EXTRA_DIST = \
|
||||
examples/spinbutton/Makefile \
|
||||
examples/find-examples.sh
|
||||
|
||||
dist-hook:
|
||||
cp gtk+.spec $(distdir)
|
||||
dist-hook: gtk+.spec
|
||||
if test -e $(srcdir)/INSTALL.in && test -e $(srcdir)/README.in ; then \
|
||||
CONFIG_FILES="INSTALL:$(srcdir)/INSTALL.in README:$(srcdir)/README.in" \
|
||||
CONFIG_HEADERS= \
|
||||
$(SHELL) config.status \
|
||||
&& cp INSTALL README $(distdir) ; \
|
||||
fi \
|
||||
&& cp gtk+.spec $(distdir)
|
||||
|
||||
m4datadir = $(datadir)/aclocal
|
||||
m4data_DATA = gtk.m4
|
||||
|
111
NEWS
111
NEWS
@@ -1,3 +1,114 @@
|
||||
Overview of Changes in GTK+ 1.2.8:
|
||||
|
||||
* GNU Make 3.79 bug workaround
|
||||
* FAQ and tutorial updates and improvements
|
||||
* Miscellaneous bug fixes: CList, Calendar, rc-files, FontSelection
|
||||
|
||||
Overview of Changes in GTK+ 1.2.7:
|
||||
|
||||
* More header cleanups.
|
||||
* Fixed activation bug for insensitive widgets.
|
||||
* Locale fixes to RC file parsing code.
|
||||
* Miscellaneous bugfixes for Item Factory, CList, CTree, X Selections,
|
||||
HScale, VScale, Pixmap, Viewport, OptionMenu, Entry and Notebook.
|
||||
* Upgrade to libtool 1.3.4.
|
||||
|
||||
Overview of Changes in GTK+ 1.2.6:
|
||||
|
||||
* container queue_resize fixes
|
||||
* gtk[vh]scale: minor fixups
|
||||
* rename idle to idle_id in testgtk to avoid conflicts with
|
||||
broken libs
|
||||
* More consistant naming of gtkrc files
|
||||
* Added language support: ro, uk
|
||||
|
||||
Overview of Changes in GTK+ 1.2.5:
|
||||
|
||||
* more GtkCTree and GtkWindow bug fixes.
|
||||
* more redraw/resize queue fixes, better expose event
|
||||
discarding code.
|
||||
* more miscellaneous bugs fixed
|
||||
* new configure.in option --disable-rebuilds to completely disable
|
||||
rebuilds of autogenerated sources.
|
||||
* check for 5.002 now, to avoid failing autogeneration build rules due
|
||||
to old perl versions.
|
||||
* fonts (and fontsets) are cached now.
|
||||
* more autogeneration make rules and dependancy fixups, we should be
|
||||
save with autogeneration up to make -j12 now ;)
|
||||
* new window position GTK_WIN_POS_CENTER_ALWAYS, which will recenter the
|
||||
GtkWindow on every size change.
|
||||
* major rework of window manager hints handling code, fixed a bunch of
|
||||
races with the new resizing code.
|
||||
* the new wm hints and resizing code is absolutely perfect and bug free now,
|
||||
it only lacks testing ;)
|
||||
* fixed up various rc style memory prolems.
|
||||
* gtk_widget_modify_style() now properly changes the style of realized widgets
|
||||
and references the style passed into it. if people worked around this bug,
|
||||
this will introduce a slight memory leak in their code.
|
||||
The code should typically look like:
|
||||
GtkRcStyle *rc_style = gtk_rc_style_new ();
|
||||
[...]
|
||||
gtk_widget_modify_style (widget, rc_style);
|
||||
gtk_rc_style_unref (rc_style);
|
||||
* fix problems with positioning menus offscreen.
|
||||
* GtkText fixes for some crashes and drawing errors.
|
||||
* Better handling for unexpected window destroys in GDK and GTK+.
|
||||
This should make it possible to use a GtkPlug and catch the
|
||||
case where its parent socket is randomly killed.
|
||||
* FAQ updates.
|
||||
* FileSelection i18n patches, RadioButton fixups.
|
||||
* many translation improvements.
|
||||
* miscellaneous other bugs fixed.
|
||||
|
||||
Overview of Changes in GTK+ 1.2.4:
|
||||
|
||||
* DnD improvements (drags can be canceled with Esc now).
|
||||
* suppressed configure event reordering in Gdk.
|
||||
* rewrite of Gtk's configure event handling.
|
||||
* major improvements for the object argument system (Elena Devdariani).
|
||||
* major bugfixes for threading, GtkNotebook, GtkItemFactory, GtkCList and
|
||||
GtkCTree.
|
||||
* tutorial/FAQ updates, new file generation.txt on autogenerated sources.
|
||||
* configure's --with-glib= is "officially" unsupported.
|
||||
* upgrade to libtool 1.3.3.
|
||||
* various buglets fixed.
|
||||
|
||||
Overview of Changes in GTK+ 1.2.3:
|
||||
|
||||
* Upgrade to libtool 1.3
|
||||
* Check for dgettext (for systems with old versions of GNU Gettext)
|
||||
* Many bug fixes (see ChangeLog for details)
|
||||
|
||||
Overview of Changes in GTK+ 1.2.2:
|
||||
|
||||
* Improved Dnd behaviour with Motif applications.
|
||||
* Bug fixes for the Gtk selection code.
|
||||
* Minor bug fixes to the Gdk Atom cache and Dnd code (with --display option).
|
||||
* Bug fixes and leak plugs for the Gdk IM code.
|
||||
* Added gtk_object_get() facility to retrive object arguments easily.
|
||||
The var args list expects ("arg-name", &value) pairs.
|
||||
* Fixed mapping for GdkInputCondition<->GIOCondition, this should fix
|
||||
problems where closed pipes were no longer signalling GDK_INPUT_READ on
|
||||
systems with a native poll().
|
||||
* Some cleanups to GtkLabel's memory allocation code (shouldn't leak memory
|
||||
anymore).
|
||||
* We don't attempt to lookup xpm color "None" anymore, this should prevent
|
||||
eXodus (commercial X windows server) from popping up a color dialog every
|
||||
time a transparent pixmap is created.
|
||||
* Fixed bug where Gtk timout/idle handlers would execute without the global
|
||||
Gdk lock being held.
|
||||
* Other minor bug fixes.
|
||||
|
||||
Overview of Changes in GTK+ 1.2.1:
|
||||
|
||||
* Many Bug fixes have been applied to the menu and accelerator code.
|
||||
* GtkItemFactory can "adopt" foreign menu items now and manage their
|
||||
accelerator installation. This is often required to get GtkItemFactory
|
||||
like accelerator propagation between different windows with the same
|
||||
menu heirarchy and for centralized parsing and saving of accelerators.
|
||||
* GtkCList/GtkCTree buttons should always display correctly now.
|
||||
* Miscellaneous other bug fixes.
|
||||
|
||||
What's New in GTK+ 1.2.0 (since 1.0.x):
|
||||
|
||||
* New widgets: GtkFontSelector, GtkPacker, GtkItemFactory, GtkCTree,
|
||||
|
8
README
8
README
@@ -1,7 +1,7 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 1.2.0. GTK+, which stands for the Gimp ToolKit,
|
||||
This is GTK+ version 1.2.8. 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.
|
||||
@@ -37,9 +37,9 @@ version number. This should be separated by a blank
|
||||
line from the actual headers.
|
||||
|
||||
Package: gtk+
|
||||
Version: 1.2.0
|
||||
Version: 1.2.8
|
||||
|
||||
[ Please substitute 1.2.0 with the version of GTK+ that
|
||||
[ Please substitute 1.2.8 with the version of GTK+ that
|
||||
you have installed ]
|
||||
|
||||
Then describe the bug. Include:
|
||||
@@ -82,7 +82,7 @@ From: yourname@your.address.org
|
||||
Subject: handlebox test in testgtk is misnamed.
|
||||
|
||||
Package: gtk+
|
||||
Version: 1.2.0
|
||||
Version: 1.2.8
|
||||
|
||||
When I run gtk/testgtk, the button "handle box"
|
||||
is misnamed. There are multiple handle boxes in
|
||||
|
101
README.in
Normal file
101
README.in
Normal file
@@ -0,0 +1,101 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version @GTK_VERSION@. 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.gtk.org/pub/gtk
|
||||
|
||||
The official web site is:
|
||||
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
|
||||
==================
|
||||
|
||||
Bugs should be reported to the GNOME bug tracking
|
||||
system. (http://bugs.gnome.org). To report a problem
|
||||
about GTK+, send mail to submit@bugs.gnome.org.
|
||||
|
||||
The subject of the mail should describe your problem.
|
||||
In the body of the mail, you should first include
|
||||
a "pseudo-header" that gives the package and
|
||||
version number. This should be separated by a blank
|
||||
line from the actual headers.
|
||||
|
||||
Package: gtk+
|
||||
Version: @GTK_VERSION@
|
||||
|
||||
[ Please substitute @GTK_VERSION@ with the version of GTK+ that
|
||||
you have installed ]
|
||||
|
||||
Then describe the bug. Include:
|
||||
|
||||
* 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.
|
||||
|
||||
An example of a bug report:
|
||||
|
||||
====
|
||||
To: submit@bugs.gnome.org
|
||||
From: yourname@your.address.org
|
||||
Subject: handlebox test in testgtk is misnamed.
|
||||
|
||||
Package: gtk+
|
||||
Version: @GTK_VERSION@
|
||||
|
||||
When I run gtk/testgtk, the button "handle box"
|
||||
is misnamed. There are multiple handle boxes in
|
||||
the demo, so it should be "handle boxes", to
|
||||
be like "buttons" or "check buttons".
|
||||
===
|
||||
|
||||
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".
|
18
TODO
18
TODO
@@ -12,21 +12,14 @@ Outstanding items:
|
||||
* Make all widget attributes configurable after the widget is created (timj).
|
||||
|
||||
* Radio buttons need to display CAN/HAS_DEFAULT correctly, if draw_inidicator
|
||||
is TRUE.
|
||||
is TRUE. (Radio buttons do not need to CAN_DEFAULT! OWT)
|
||||
|
||||
* gdk_expose_compress: ala-Xt, this would really help for opaque moves and
|
||||
such
|
||||
|
||||
* More dialogs: Print, GtkFontSelector, maybe others...
|
||||
* More dialogs: Print, maybe others...
|
||||
|
||||
* make the gtk_main callbacks consistent in their add/remove behaviour.
|
||||
|
||||
* Check return values on all calls to XIC[Get/Set]Values
|
||||
|
||||
* Rewrite the interface to the i18n stuff so GTK widgets don't need to
|
||||
retrieve X values, and so they don't have to know the value of the
|
||||
XNxxx character constants.
|
||||
|
||||
* The "--geometry" option should be supported
|
||||
|
||||
- Having gdk_init() parse the geometry option. (putting it into
|
||||
@@ -70,6 +63,11 @@ Outstanding items:
|
||||
cause confusing presses to be sent to containers that actually
|
||||
want to get events on themselves.
|
||||
|
||||
* The menu code should skip separators during keyboard navigation,
|
||||
whether they are sensitive or insensitive.
|
||||
|
||||
* OwnerButtonPressGrab needs to go!
|
||||
|
||||
Text/Edit widget:
|
||||
|
||||
Bugs:
|
||||
@@ -187,7 +185,7 @@ DND
|
||||
|
||||
- Use a cursor instead of an ICON when over Motif windows,
|
||||
to get rid of the current junk that Motif leaves because
|
||||
of it's XCopyArea stupidity for doing highlighting.
|
||||
of its XCopyArea stupidity for doing highlighting.
|
||||
|
||||
- Add a GTK_DRAG_VERIFY target flag and a "drag_data_verify"
|
||||
signal so that apps can easily check if a, say,
|
||||
|
@@ -29,8 +29,6 @@
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
#undef HAVE_XCONVERTCASE
|
||||
|
||||
#undef WITH_SYMBOL_UNDERSCORE
|
||||
|
||||
#undef NO_FD_SET
|
||||
|
||||
#undef RESOURCE_BASE
|
||||
|
563
acinclude.m4
563
acinclude.m4
@@ -1,6 +1,6 @@
|
||||
## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*-
|
||||
## Copyright (C) 1996-1998 Free Software Foundation, Inc.
|
||||
## Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
## Copyright (C) 1996-1999 Free Software Foundation, Inc.
|
||||
## Originally by 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
|
||||
@@ -21,35 +21,75 @@
|
||||
## configuration script generated by Autoconf, you may include it under
|
||||
## the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# serial 29 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AM_PROG_LD])dnl
|
||||
AC_REQUIRE([AM_PROG_NM])dnl
|
||||
AC_REQUIRE([AM_SYS_NM_PARSE])dnl
|
||||
AC_REQUIRE([AM_SYS_SYMBOL_UNDERSCORE])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
# serial 40 AC_PROG_LIBTOOL
|
||||
AC_DEFUN(AC_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
|
||||
|
||||
# Save cache, so that ltconfig can load it
|
||||
AC_CACHE_SAVE
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
|
||||
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Reload cache, that may have been modified by ltconfig
|
||||
AC_CACHE_LOAD
|
||||
|
||||
# This can be used to rebuild libtool when needed
|
||||
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
|
||||
|
||||
# Always use our own libtool.
|
||||
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
|
||||
AC_SUBST(LIBTOOL)dnl
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
AC_DEFUN(AC_LIBTOOL_SETUP,
|
||||
[AC_PREREQ(2.13)dnl
|
||||
AC_REQUIRE([AC_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AC_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AC_PROG_LD])dnl
|
||||
AC_REQUIRE([AC_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
|
||||
case "$target" in
|
||||
NONE) lt_target="$host" ;;
|
||||
*) lt_target="$target" ;;
|
||||
esac
|
||||
|
||||
# Check for any special flags to pass to ltconfig.
|
||||
libtool_flags=
|
||||
libtool_flags="--cache-file=$cache_file"
|
||||
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
|
||||
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
|
||||
test "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
|
||||
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
|
||||
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
|
||||
[libtool_flags="$libtool_flags --enable-dlopen"])
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[libtool_flags="$libtool_flags --enable-win32-dll"])
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock avoid locking (might break parallel builds)])
|
||||
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
|
||||
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
|
||||
|
||||
# Some flags need to be propagated to the compiler or linker for good
|
||||
# libtool support.
|
||||
case "$host" in
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
@@ -81,46 +121,31 @@ case "$host" in
|
||||
fi
|
||||
;;
|
||||
|
||||
*-*-cygwin32*)
|
||||
AM_SYS_LIBTOOL_CYGWIN32
|
||||
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
|
||||
[*-*-cygwin* | *-*-mingw*)
|
||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
AC_CHECK_TOOL(OBJDUMP, objdump, false)
|
||||
;;
|
||||
|
||||
])
|
||||
esac
|
||||
|
||||
# enable the --disable-libtool-lock switch
|
||||
|
||||
AC_ARG_ENABLE(libtool-lock,
|
||||
[ --disable-libtool-lock force libtool not to do file locking],
|
||||
need_locks=$enableval,
|
||||
need_locks=yes)
|
||||
|
||||
if test x"$need_locks" = xno; then
|
||||
libtool_flags="$libtool_flags --disable-lock"
|
||||
fi
|
||||
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
DLLTOOL="$DLLTOOL" AS="$AS" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
|
||||
# Redirect the config.log output again, so that the ltconfig log is not
|
||||
# clobbered by the next message.
|
||||
exec 5>>./config.log
|
||||
])
|
||||
|
||||
# AM_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
|
||||
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
|
||||
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
|
||||
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
|
||||
|
||||
# AC_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_SHARED,
|
||||
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_DEFUN(AC_ENABLE_SHARED, [dnl
|
||||
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(shared,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT],
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
@@ -138,26 +163,22 @@ no) enable_shared=no ;;
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AM_DISABLE_SHARED,
|
||||
[AM_ENABLE_SHARED(no)])
|
||||
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_SHARED(no)])
|
||||
|
||||
# AM_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AM_DISABLE_STATIC,
|
||||
[AM_ENABLE_STATIC(no)])
|
||||
|
||||
# AM_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
|
||||
# AC_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AM_ENABLE_STATIC,
|
||||
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_DEFUN(AC_ENABLE_STATIC, [dnl
|
||||
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(static,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT],
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
@@ -175,12 +196,49 @@ no) enable_static=no ;;
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
|
||||
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_STATIC(no)])
|
||||
|
||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AM_PROG_LD,
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
|
||||
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
|
||||
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
|
||||
# `yes'.
|
||||
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
|
||||
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
AC_ARG_ENABLE(fast-install,
|
||||
changequote(<<, >>)dnl
|
||||
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_fast_install=yes ;;
|
||||
no) enable_fast_install=no ;;
|
||||
*)
|
||||
enable_fast_install=no
|
||||
# Look at the argument we got. We use all the common list separators.
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
|
||||
for pkg in $enableval; do
|
||||
if test "X$pkg" = "X$p"; then
|
||||
enable_fast_install=yes
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
|
||||
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_ENABLE_FAST_INSTALL(no)])
|
||||
|
||||
# AC_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AC_PROG_LD,
|
||||
[AC_ARG_WITH(gnu-ld,
|
||||
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
|
||||
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
|
||||
@@ -195,47 +253,15 @@ if test "$ac_cv_prog_gcc" = yes; then
|
||||
case "$ac_prog" in
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
/* | [A-Za-z]:/*)
|
||||
# Canonicalize the path of ld
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
sub_uncdrive='s%^\([A-Za-z]\):/%//\1/%'
|
||||
changequote([,])dnl
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
case "$host_os" in
|
||||
cygwin*)
|
||||
# Convert to a UNC path for cygwin
|
||||
test -z "$LD" && LD=`echo X$ac_prog | sed -e "1s/^X//" -e "$sub_uncdrive"`
|
||||
;;
|
||||
*)
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
##
|
||||
## FIXME: The code fails later on if we try to use an $LD with
|
||||
## '\\' path separators.
|
||||
##
|
||||
changequote(,)dnl
|
||||
[A-Za-z]:[\\]*)
|
||||
# Canonicalize the path of ld
|
||||
re_direlt='\\[^\\][^\\]*\\\.\.\(\\\)'
|
||||
sub_uncdrive='s%^\([A-Za-z]\):\\%//\1/%'
|
||||
changequote([,])dnl
|
||||
sub_uncdir='s%\\%/%g'
|
||||
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
|
||||
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%\1%"`
|
||||
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
|
||||
done
|
||||
case "$host_os" in
|
||||
cygwin*)
|
||||
# Convert to a UNC path for cygwin
|
||||
test -z "$LD" && LD=`echo X$ac_prog | sed -e 's%^X%%' -e "$sub_uncdrive" -e "$sub_uncdir"`
|
||||
;;
|
||||
*)
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
esac
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
"")
|
||||
# If it fails, then pretend we aren't using GCC.
|
||||
@@ -253,10 +279,10 @@ else
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f "$ac_dir/$ac_prog"; then
|
||||
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
|
||||
ac_cv_path_LD="$ac_dir/$ac_prog"
|
||||
# Check to see if the program is GNU ld. I'd rather use --version,
|
||||
# but apparently some GNU ld's only accept -v.
|
||||
@@ -264,7 +290,7 @@ AC_CACHE_VAL(ac_cv_path_LD,
|
||||
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
test "$with_gnu_ld" != no && break
|
||||
else
|
||||
test "$with_gnu_ld" != yes && break
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@@ -279,11 +305,10 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AM_PROG_LD_GNU
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_PROG_LD_GNU,
|
||||
AC_DEFUN(AC_PROG_LD_GNU,
|
||||
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
|
||||
[# 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
|
||||
@@ -293,29 +318,31 @@ else
|
||||
fi])
|
||||
])
|
||||
|
||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AM_PROG_NM,
|
||||
# AC_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AC_PROG_NM,
|
||||
[AC_MSG_CHECKING([for BSD-compatible nm])
|
||||
AC_CACHE_VAL(ac_cv_path_NM,
|
||||
[if test -n "$NM"; then
|
||||
# Let the user override the test.
|
||||
ac_cv_path_NM="$NM"
|
||||
else
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
|
||||
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
|
||||
test -z "$ac_dir" && ac_dir=.
|
||||
if test -f $ac_dir/nm; then
|
||||
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
|
||||
# Check to see if the nm accepts a BSD-compat flag.
|
||||
# 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
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
ac_cv_path_NM="$ac_dir/nm -B"
|
||||
break
|
||||
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM="$ac_dir/nm"
|
||||
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
|
||||
continue # so that we can try to find one that supports BSD flags
|
||||
fi
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
@@ -323,224 +350,84 @@ else
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(NM)
|
||||
])
|
||||
|
||||
# AM_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed
|
||||
# by C symbol name from nm.
|
||||
AC_DEFUN(AM_SYS_NM_PARSE,
|
||||
# AC_CHECK_LIBM - check for math library
|
||||
AC_DEFUN(AC_CHECK_LIBM,
|
||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AM_PROG_NM])dnl
|
||||
# Check for command to grab the raw symbol name followed by C symbol from nm.
|
||||
AC_MSG_CHECKING([command to parse $NM output])
|
||||
AC_CACHE_VAL(ac_cv_sys_global_symbol_pipe,
|
||||
[# These are sane defaults that work on at least a few old systems.
|
||||
# {They come from Ultrix. What could be older than Ultrix?!! ;)}
|
||||
|
||||
changequote(,)dnl
|
||||
# Character class describing NM global symbol codes.
|
||||
ac_symcode='[BCDEGRSTU]'
|
||||
|
||||
# Regexp to match symbols that can be accessed directly from C.
|
||||
ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
|
||||
|
||||
# Transform the above into a raw symbol and a C symbol.
|
||||
ac_symxfrm='\1 \1'
|
||||
|
||||
# Define system-specific variables.
|
||||
case "$host_os" in
|
||||
aix*)
|
||||
ac_symcode='[BCDTU]'
|
||||
LIBM=
|
||||
case "$lt_target" in
|
||||
*-*-beos* | *-*-cygwin*)
|
||||
# These system don't have libm
|
||||
;;
|
||||
sunos* | cygwin32* | mingw32*)
|
||||
ac_sympat='_\([_A-Za-z][_A-Za-z0-9]*\)'
|
||||
ac_symxfrm='_\1 \1'
|
||||
*-ncr-sysv4.3*)
|
||||
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
|
||||
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
|
||||
;;
|
||||
irix*)
|
||||
# Cannot use undefined symbols on IRIX because inlined functions mess us up.
|
||||
ac_symcode='[BCDEGRST]'
|
||||
;;
|
||||
solaris*)
|
||||
ac_symcode='[BDTU]'
|
||||
*)
|
||||
AC_CHECK_LIB(m, main, LIBM="-lm")
|
||||
;;
|
||||
esac
|
||||
])
|
||||
|
||||
# If we're using GNU nm, then use its standard symbol codes.
|
||||
if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then
|
||||
ac_symcode='[ABCDGISTUW]'
|
||||
fi
|
||||
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl convenience library, adds --enable-ltdl-convenience to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
case "$enable_ltdl_convenience" in
|
||||
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
|
||||
"") enable_ltdl_convenience=yes
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
|
||||
esac
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
])
|
||||
|
||||
case "$host_os" in
|
||||
cygwin32* | mingw32*)
|
||||
# We do not want undefined symbols on cygwin32. The user must
|
||||
# arrange to define them via -l arguments.
|
||||
ac_symcode='[ABCDGISTW]'
|
||||
;;
|
||||
esac
|
||||
changequote([,])dnl
|
||||
|
||||
# Write the raw and C identifiers.
|
||||
ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.* $ac_symcode $ac_sympat$/$ac_symxfrm/p'"
|
||||
|
||||
# Check to see that the pipe works correctly.
|
||||
ac_pipe_works=no
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
char nm_test_var;
|
||||
void nm_test_func(){}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
int main(){nm_test_var='a';nm_test_func;return 0;}
|
||||
EOF
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
# Now try to grab the symbols.
|
||||
ac_nlist=conftest.nm
|
||||
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
|
||||
|
||||
# Try sorting and uniquifying the output.
|
||||
if sort "$ac_nlist" | uniq > "$ac_nlist"T; then
|
||||
mv -f "$ac_nlist"T "$ac_nlist"
|
||||
ac_wcout=`wc "$ac_nlist" 2>/dev/null`
|
||||
changequote(,)dnl
|
||||
ac_count=`echo "X$ac_wcout" | sed -e 's,^X,,' -e 's/^[ ]*\([0-9][0-9]*\).*$/\1/'`
|
||||
changequote([,])dnl
|
||||
(test "$ac_count" -ge 0) 2>/dev/null || ac_count=-1
|
||||
else
|
||||
rm -f "$ac_nlist"T
|
||||
ac_count=-1
|
||||
fi
|
||||
|
||||
# Make sure that we snagged all the symbols we need.
|
||||
if egrep ' nm_test_var$' "$ac_nlist" >/dev/null; then
|
||||
if egrep ' nm_test_func$' "$ac_nlist" >/dev/null; then
|
||||
cat <<EOF > conftest.c
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
EOF
|
||||
# Now generate the symbol file.
|
||||
sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c
|
||||
|
||||
cat <<EOF >> conftest.c
|
||||
#if defined (__STDC__) && __STDC__
|
||||
# define __ptr_t void *
|
||||
#else
|
||||
# define __ptr_t char *
|
||||
#endif
|
||||
|
||||
/* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
|
||||
int dld_preloaded_symbol_count = $ac_count;
|
||||
|
||||
/* The mapping between symbol names and symbols. */
|
||||
struct {
|
||||
char *name;
|
||||
__ptr_t address;
|
||||
}
|
||||
changequote(,)dnl
|
||||
dld_preloaded_symbols[] =
|
||||
changequote([,])dnl
|
||||
{
|
||||
EOF
|
||||
sed 's/^\(.*\) \(.*\)$/ {"\1", (__ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c
|
||||
cat <<\EOF >> conftest.c
|
||||
{0, (__ptr_t) 0}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
EOF
|
||||
# Now try linking the two files.
|
||||
mv conftest.$ac_objext conftestm.$ac_objext
|
||||
ac_save_LIBS="$LIBS"
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
LIBS="conftestm.$ac_objext"
|
||||
CFLAGS="$CFLAGS$no_builtin_flag"
|
||||
if AC_TRY_EVAL(ac_link) && test -s conftest; then
|
||||
ac_pipe_works=yes
|
||||
else
|
||||
echo "configure: failed program was:" >&AC_FD_CC
|
||||
cat conftest.c >&AC_FD_CC
|
||||
fi
|
||||
LIBS="$ac_save_LIBS"
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
else
|
||||
echo "cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
|
||||
fi
|
||||
else
|
||||
echo "cannot find nm_test_var in $ac_nlist" >&AC_FD_CC
|
||||
fi
|
||||
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
|
||||
# the libltdl installable library, and adds --enable-ltdl-install to
|
||||
# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor
|
||||
# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed
|
||||
# to be `${top_builddir}/libltdl'. Make sure you start DIR with
|
||||
# '${top_builddir}/' (note the single quotes!) if your package is not
|
||||
# flat, and, if you're not using automake, define top_builddir as
|
||||
# appropriate in the Makefiles.
|
||||
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
|
||||
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
|
||||
AC_CHECK_LIB(ltdl, main,
|
||||
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
|
||||
[if test x"$enable_ltdl_install" = xno; then
|
||||
AC_MSG_WARN([libltdl not installed, but installation disabled])
|
||||
else
|
||||
enable_ltdl_install=yes
|
||||
fi
|
||||
])
|
||||
if test x"$enable_ltdl_install" = x"yes"; then
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install"
|
||||
LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la
|
||||
INCLTDL=ifelse($#,1,-I$1,['-I${top_builddir}/libltdl'])
|
||||
else
|
||||
echo "cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
|
||||
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
|
||||
LIBLTDL="-lltdl"
|
||||
INCLTDL=
|
||||
fi
|
||||
else
|
||||
echo "$progname: failed program was:" >&AC_FD_CC
|
||||
cat conftest.c >&AC_FD_CC
|
||||
fi
|
||||
rm -rf conftest*
|
||||
|
||||
# Do not use the global_symbol_pipe unless it works.
|
||||
test "$ac_pipe_works" = yes || ac_cv_sys_global_symbol_pipe=
|
||||
])
|
||||
|
||||
ac_result=yes
|
||||
if test -z "$ac_cv_sys_global_symbol_pipe"; then
|
||||
ac_result=no
|
||||
fi
|
||||
AC_MSG_RESULT($ac_result)
|
||||
])
|
||||
dnl old names
|
||||
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
|
||||
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
|
||||
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
|
||||
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
|
||||
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
|
||||
|
||||
# AM_SYS_LIBTOOL_CYGWIN32 - find tools needed on cygwin32
|
||||
AC_DEFUN(AM_SYS_LIBTOOL_CYGWIN32,
|
||||
[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
|
||||
AC_CHECK_TOOL(AS, as, false)
|
||||
])
|
||||
|
||||
# AM_SYS_SYMBOL_UNDERSCORE - does the compiler prefix global symbols
|
||||
# with an underscore?
|
||||
AC_DEFUN(AM_SYS_SYMBOL_UNDERSCORE,
|
||||
[AC_REQUIRE([AM_PROG_NM])dnl
|
||||
AC_REQUIRE([AM_SYS_NM_PARSE])dnl
|
||||
AC_MSG_CHECKING([for _ prefix in compiled symbols])
|
||||
AC_CACHE_VAL(ac_cv_sys_symbol_underscore,
|
||||
[ac_cv_sys_symbol_underscore=no
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
void nm_test_func(){}
|
||||
int main(){nm_test_func;return 0;}
|
||||
EOF
|
||||
if AC_TRY_EVAL(ac_compile); then
|
||||
# Now try to grab the symbols.
|
||||
ac_nlist=conftest.nm
|
||||
if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then
|
||||
# See whether the symbols have a leading underscore.
|
||||
if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then
|
||||
ac_cv_sys_symbol_underscore=yes
|
||||
else
|
||||
if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then
|
||||
:
|
||||
else
|
||||
echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "configure: cannot run $ac_cv_sys_global_symbol_pipe" >&AC_FD_CC
|
||||
fi
|
||||
else
|
||||
echo "configure: failed program was:" >&AC_FD_CC
|
||||
cat conftest.c >&AC_FD_CC
|
||||
fi
|
||||
rm -rf conftest*
|
||||
])
|
||||
AC_MSG_RESULT($ac_cv_sys_symbol_underscore)
|
||||
if test x$ac_cv_sys_symbol_underscore = xyes; then
|
||||
AC_DEFINE(WITH_SYMBOL_UNDERSCORE,1,
|
||||
[define if compiled symbols have a leading underscore])
|
||||
fi
|
||||
])
|
||||
dnl This is just to silence aclocal about the macro not being used
|
||||
ifelse([AC_DISABLE_FAST_INSTALL])dnl
|
||||
|
||||
# Macro to add for using GNU gettext.
|
||||
# Ulrich Drepper <drepper@cygnus.com>, 1995.
|
||||
@@ -589,22 +476,26 @@ AC_DEFUN(AM_GTK_WITH_NLS,
|
||||
CATOBJEXT=NONE
|
||||
|
||||
AC_CHECK_HEADER(libintl.h,
|
||||
[AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")],
|
||||
gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)])
|
||||
[AC_CACHE_CHECK([for dgettext in libc], gt_cv_func_dgettext_libc,
|
||||
[AC_TRY_LINK([#include <libintl.h>], [return (int) dgettext ("","")],
|
||||
gt_cv_func_dgettext_libc=yes, gt_cv_func_dgettext_libc=no)])
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" != "yes"; then
|
||||
if test "$gt_cv_func_dgettext_libc" != "yes"; then
|
||||
AC_CHECK_LIB(intl, bindtextdomain,
|
||||
[AC_CACHE_CHECK([for gettext in libintl],
|
||||
gt_cv_func_gettext_libintl,
|
||||
[AC_CHECK_LIB(intl, gettext,
|
||||
gt_cv_func_gettext_libintl=yes,
|
||||
gt_cv_func_gettext_libintl=no)],
|
||||
gt_cv_func_gettext_libintl=no)])
|
||||
[AC_CACHE_CHECK([for dgettext in libintl],
|
||||
gt_cv_func_dgettext_libintl,
|
||||
[AC_CHECK_LIB(intl, dgettext,
|
||||
gt_cv_func_dgettext_libintl=yes,
|
||||
gt_cv_func_dgettext_libintl=no)],
|
||||
gt_cv_func_dgettext_libintl=no)])
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_gettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
if test "$gt_cv_func_dgettext_libintl" = "yes"; then
|
||||
LIBS="$LIBS -lintl";
|
||||
fi
|
||||
|
||||
if test "$gt_cv_func_dgettext_libc" = "yes" \
|
||||
|| test "$gt_cv_func_dgettext_libintl" = "yes"; then
|
||||
AC_DEFINE(HAVE_GETTEXT)
|
||||
AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
|
||||
[test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
|
||||
@@ -624,8 +515,8 @@ AC_DEFUN(AM_GTK_WITH_NLS,
|
||||
fi
|
||||
|
||||
# Added by Martin Baulig 12/15/98 for libc5 systems
|
||||
if test "$gt_cv_func_gettext_libc" != "yes" \
|
||||
&& test "$gt_cv_func_gettext_libintl" = "yes"; then
|
||||
if test "$gt_cv_func_dgettext_libc" != "yes" \
|
||||
&& test "$gt_cv_func_dgettext_libintl" = "yes"; then
|
||||
INTLLIBS=-lintl
|
||||
LIBS=`echo $LIBS | sed -e 's/-lintl//'`
|
||||
fi
|
||||
|
10
autogen.sh
10
autogen.sh
@@ -20,14 +20,6 @@ DIE=0
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile $PROJECT."
|
||||
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.2b.tar.gz"
|
||||
echo "(or a newer version if it is available)"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to compile $PROJECT."
|
||||
@@ -88,7 +80,7 @@ automake -a $am_opt
|
||||
autoconf
|
||||
cd $ORIGDIR
|
||||
|
||||
$srcdir/configure "$@"
|
||||
$srcdir/configure --enable-maintainer-mode "$@"
|
||||
|
||||
echo
|
||||
echo "Now type 'make' to compile $PROJECT."
|
||||
|
358
config.guess
vendored
358
config.guess
vendored
@@ -1,6 +1,7 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
@@ -23,6 +24,7 @@
|
||||
|
||||
# Written by Per Bothner <bothner@cygnus.com>.
|
||||
# The master version of this file is at the FSF in /home/gd/gnu/lib.
|
||||
# Please send patches to <autoconf-patches@gnu.org>.
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
@@ -35,6 +37,20 @@
|
||||
# (but try to keep the structure clean).
|
||||
#
|
||||
|
||||
# Use $HOST_CC if defined. $CC may point to a cross-compiler
|
||||
if test x"$CC_FOR_BUILD" = x; then
|
||||
if test x"$HOST_CC" != x; then
|
||||
CC_FOR_BUILD="$HOST_CC"
|
||||
else
|
||||
if test x"$CC" != x; then
|
||||
CC_FOR_BUILD="$CC"
|
||||
else
|
||||
CC_FOR_BUILD=cc
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
|
||||
# (ghazi@noc.rutgers.edu 8/24/94.)
|
||||
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
|
||||
@@ -46,7 +62,8 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15
|
||||
dummy=dummy-$$
|
||||
trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
@@ -59,7 +76,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# A Tn.n version is a released field test version.
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
cat <<EOF >dummy.s
|
||||
cat <<EOF >$dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
@@ -76,9 +93,9 @@ main:
|
||||
ret \$31,(\$26),1
|
||||
.end main
|
||||
EOF
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
./$dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
@@ -97,8 +114,14 @@ EOF
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]`
|
||||
rm -f $dummy.s $dummy
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
exit 0 ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||
# of the specific Alpha model?
|
||||
echo alpha-pc-interix
|
||||
exit 0 ;;
|
||||
21064:Windows_NT:50:3)
|
||||
echo alpha-dec-winnt3.5
|
||||
@@ -133,6 +156,9 @@ EOF
|
||||
wgrisc:OpenBSD:*:*)
|
||||
echo mipsel-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:OS/390:*:*)
|
||||
echo i370-ibm-openedition
|
||||
exit 0 ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit 0;;
|
||||
@@ -142,7 +168,7 @@ EOF
|
||||
SR2?01:HI-UX/MPP:*:*)
|
||||
echo hppa1.1-hitachi-hiuxmpp
|
||||
exit 0;;
|
||||
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*)
|
||||
Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
|
||||
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
|
||||
if test "`(/bin/universe) 2>/dev/null`" = att ; then
|
||||
echo pyramid-pyramid-sysv3
|
||||
@@ -150,7 +176,7 @@ EOF
|
||||
echo pyramid-pyramid-bsd
|
||||
fi
|
||||
exit 0 ;;
|
||||
NILE:*:*:dcosx)
|
||||
NILE*:*:*:dcosx)
|
||||
echo pyramid-pyramid-svr4
|
||||
exit 0 ;;
|
||||
sun4H:SunOS:5.*:*)
|
||||
@@ -201,6 +227,32 @@ EOF
|
||||
atari*:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
# The situation for MiNT is a little confusing. The machine name
|
||||
# can be virtually everything (everything which is not
|
||||
# "atarist" or "atariste" at least should have a processor
|
||||
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
|
||||
# to the lowercase version "mint" (or "freemint"). Finally
|
||||
# the system name "TOS" denotes a system which is actually not
|
||||
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||
# be no problem.
|
||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||
echo m68k-milan-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||
echo m68k-hades-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sun3*:NetBSD:*:*)
|
||||
echo m68k-sun-netbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
@@ -234,12 +286,16 @@ EOF
|
||||
VAX*:ULTRIX*:*:*)
|
||||
echo vax-dec-ultrix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
2020:CLIX:*:*)
|
||||
2020:CLIX:*:* | 2430:CLIX:*:*)
|
||||
echo clipper-intergraph-clix${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
mips:*:*:UMIPS | mips:*:*:RISCos)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
int main (argc, argv) int argc; char **argv; {
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __cplusplus
|
||||
int main (int argc, char *argv[]) {
|
||||
#else
|
||||
int main (argc, argv) int argc; char *argv[]; {
|
||||
#endif
|
||||
#if defined (host_mips) && defined (MIPSEB)
|
||||
#if defined (SYSTYPE_SYSV)
|
||||
printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
|
||||
@@ -254,10 +310,10 @@ EOF
|
||||
exit (-1);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy \
|
||||
&& ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy \
|
||||
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
|
||||
&& rm $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
echo mips-mips-riscos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Night_Hawk:Power_UNIX:*:*)
|
||||
@@ -275,15 +331,18 @@ EOF
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
|
||||
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then
|
||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110]
|
||||
then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||
[ ${TARGET_BINARY_INTERFACE}x = x ]
|
||||
then
|
||||
echo m88k-dg-dgux${UNAME_RELEASE}
|
||||
else
|
||||
else
|
||||
echo m88k-dg-dguxbcs${UNAME_RELEASE}
|
||||
fi
|
||||
else
|
||||
echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
else echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
@@ -309,7 +368,7 @@ EOF
|
||||
exit 0 ;;
|
||||
*:AIX:2:3)
|
||||
if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <sys/systemcfg.h>
|
||||
|
||||
main()
|
||||
@@ -320,8 +379,8 @@ EOF
|
||||
exit(0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
echo rs6000-ibm-aix3.2.5
|
||||
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
|
||||
echo rs6000-ibm-aix3.2.4
|
||||
@@ -368,25 +427,25 @@ EOF
|
||||
case "${UNAME_MACHINE}" in
|
||||
9000/31? ) HP_ARCH=m68000 ;;
|
||||
9000/[34]?? ) HP_ARCH=m68k ;;
|
||||
9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 )
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
9000/[678][0-9][0-9])
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
|
||||
switch (cpu)
|
||||
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
@@ -394,20 +453,20 @@ EOF
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy`
|
||||
rm -f dummy.c dummy
|
||||
(CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
|
||||
rm -f $dummy.c $dummy
|
||||
esac
|
||||
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
|
||||
echo ${HP_ARCH}-hp-hpux${HPUX_REV}
|
||||
exit 0 ;;
|
||||
3050*:HI-UX:*:*)
|
||||
sed 's/^ //' << EOF >dummy.c
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#include <unistd.h>
|
||||
int
|
||||
main ()
|
||||
@@ -432,8 +491,8 @@ EOF
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
echo unknown-hitachi-hiuxwe2
|
||||
exit 0 ;;
|
||||
9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
|
||||
@@ -442,6 +501,9 @@ EOF
|
||||
9000/8??:4.3bsd:*:*)
|
||||
echo hppa1.0-hp-bsd
|
||||
exit 0 ;;
|
||||
*9??*:MPE/iX:*:*)
|
||||
echo hppa1.0-hp-mpeix
|
||||
exit 0 ;;
|
||||
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
|
||||
echo hppa1.1-hp-osf
|
||||
exit 0 ;;
|
||||
@@ -458,6 +520,9 @@ EOF
|
||||
parisc*:Lites*:*:*)
|
||||
echo hppa1.1-hp-lites
|
||||
exit 0 ;;
|
||||
hppa*:OpenBSD:*:*)
|
||||
echo hppa-unknown-openbsd
|
||||
exit 0 ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit 0 ;;
|
||||
@@ -490,11 +555,14 @@ EOF
|
||||
CRAY*TS:*:*:*)
|
||||
echo t90-cray-unicos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY*T3E:*:*:*)
|
||||
echo alpha-cray-unicosmk${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
CRAY-2:*:*:*)
|
||||
echo cray2-cray-unicos
|
||||
exit 0 ;;
|
||||
F300:UNIX_System_V:*:*)
|
||||
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit 0 ;;
|
||||
@@ -507,29 +575,47 @@ EOF
|
||||
hp300:OpenBSD:*:*)
|
||||
echo m68k-unknown-openbsd${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
sparc*:BSD/OS:*:*)
|
||||
echo sparc-unknown-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
i?86:BSD/386:*:* | *:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
*:BSD/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:FreeBSD:*:*)
|
||||
if test -x /usr/bin/objformat; then
|
||||
if test "elf" = "`/usr/bin/objformat`"; then
|
||||
echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit 0 ;;
|
||||
*:NetBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
|
||||
exit 0 ;;
|
||||
*:OpenBSD:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
|
||||
exit 0 ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin32
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit 0 ;;
|
||||
i*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit 0 ;;
|
||||
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
|
||||
# UNAME_MACHINE based on the output of uname instead of i386?
|
||||
echo i386-pc-interix
|
||||
exit 0 ;;
|
||||
i*:UWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-uwin
|
||||
exit 0 ;;
|
||||
p*:CYGWIN*:*)
|
||||
echo powerpcle-unknown-cygwin32
|
||||
echo powerpcle-unknown-cygwin
|
||||
exit 0 ;;
|
||||
prep*:SunOS:5.*:*)
|
||||
echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
|
||||
@@ -538,15 +624,11 @@ EOF
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit 0 ;;
|
||||
*:Linux:*:*)
|
||||
# uname on the ARM produces all sorts of strangeness, and we need to
|
||||
# filter it out.
|
||||
case "$UNAME_MACHINE" in
|
||||
arm* | sa110*) UNAME_MACHINE="arm" ;;
|
||||
esac
|
||||
|
||||
# The BFD linker knows what the default object file format is, so
|
||||
# first see if it will tell us.
|
||||
ld_help_string=`ld --help 2>&1`
|
||||
# first see if it will tell us. cd to the root directory to prevent
|
||||
# problems with other programs or directories called `ld' in the path.
|
||||
ld_help_string=`cd /; ld --help 2>&1`
|
||||
ld_supported_emulations=`echo $ld_help_string \
|
||||
| sed -ne '/supported emulations:/!d
|
||||
s/[ ][ ]*/ /g
|
||||
@@ -554,16 +636,74 @@ EOF
|
||||
s/ .*//
|
||||
p'`
|
||||
case "$ld_supported_emulations" in
|
||||
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
|
||||
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
|
||||
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
|
||||
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;;
|
||||
*ia64)
|
||||
echo "${UNAME_MACHINE}-unknown-linux"
|
||||
exit 0
|
||||
;;
|
||||
i?86linux)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
i?86coff)
|
||||
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
|
||||
exit 0
|
||||
;;
|
||||
sparclinux)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
armlinux)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
elf32arm*)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu"
|
||||
exit 0
|
||||
;;
|
||||
armelf_linux*)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnu"
|
||||
exit 0
|
||||
;;
|
||||
m68klinux)
|
||||
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
|
||||
exit 0
|
||||
;;
|
||||
elf32ppc)
|
||||
# Determine Lib Version
|
||||
cat >$dummy.c <<EOF
|
||||
#include <features.h>
|
||||
#if defined(__GLIBC__)
|
||||
extern char __libc_version[];
|
||||
extern char __libc_release[];
|
||||
#endif
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#if defined(__GLIBC__)
|
||||
printf("%s %s\n", __libc_version, __libc_release);
|
||||
#else
|
||||
printf("unkown\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
LIBC=""
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./$dummy | grep 1\.99 > /dev/null
|
||||
if test "$?" = 0 ; then
|
||||
LIBC="libc1"
|
||||
fi
|
||||
fi
|
||||
rm -f $dummy.c $dummy
|
||||
echo powerpc-unknown-linux-gnu${LIBC}
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if test "${UNAME_MACHINE}" = "alpha" ; then
|
||||
sed 's/^ //' <<EOF >dummy.s
|
||||
sed 's/^ //' <<EOF >$dummy.s
|
||||
.globl main
|
||||
.ent main
|
||||
main:
|
||||
@@ -581,9 +721,9 @@ EOF
|
||||
.end main
|
||||
EOF
|
||||
LIBC=""
|
||||
${CC-cc} dummy.s -o dummy 2>/dev/null
|
||||
$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
|
||||
if test "$?" = 0 ; then
|
||||
./dummy
|
||||
./$dummy
|
||||
case "$?" in
|
||||
7)
|
||||
UNAME_MACHINE="alpha"
|
||||
@@ -600,22 +740,23 @@ EOF
|
||||
16)
|
||||
UNAME_MACHINE="alphaev6"
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
objdump --private-headers dummy | \
|
||||
objdump --private-headers $dummy | \
|
||||
grep ld.so.1 > /dev/null
|
||||
if test "$?" = 0 ; then
|
||||
LIBC="libc1"
|
||||
fi
|
||||
fi
|
||||
rm -f dummy.s dummy
|
||||
fi
|
||||
rm -f $dummy.s $dummy
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
|
||||
elif test "${UNAME_MACHINE}" = "mips" ; then
|
||||
cat >dummy.c <<EOF
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef __cplusplus
|
||||
int main (int argc, char *argv[]) {
|
||||
#else
|
||||
int main (argc, argv) int argc; char *argv[]; {
|
||||
#endif
|
||||
#ifdef __MIPSEB__
|
||||
printf ("%s-unknown-linux-gnu\n", argv[1]);
|
||||
#endif
|
||||
@@ -625,8 +766,8 @@ main(argc, argv)
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
else
|
||||
# Either a pre-BFD a.out linker (linux-gnuoldld)
|
||||
# or one that does not give us useful --help.
|
||||
@@ -645,12 +786,13 @@ EOF
|
||||
;;
|
||||
esac
|
||||
# Determine whether the default compiler is a.out or elf
|
||||
cat >dummy.c <<EOF
|
||||
cat >$dummy.c <<EOF
|
||||
#include <features.h>
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
#ifdef __cplusplus
|
||||
int main (int argc, char *argv[]) {
|
||||
#else
|
||||
int main (argc, argv) int argc; char *argv[]; {
|
||||
#endif
|
||||
#ifdef __ELF__
|
||||
# ifdef __GLIBC__
|
||||
# if __GLIBC__ >= 2
|
||||
@@ -667,8 +809,8 @@ main(argc, argv)
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
fi ;;
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
|
||||
# are messed up and put the nodename in both sysname and nodename.
|
||||
@@ -684,10 +826,20 @@ EOF
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
|
||||
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
|
||||
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
|
||||
echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:5:7*)
|
||||
# Fixed at (any) Pentium or better
|
||||
UNAME_MACHINE=i586
|
||||
if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
|
||||
echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:*:3.2:*)
|
||||
@@ -699,18 +851,15 @@ EOF
|
||||
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
|
||||
&& UNAME_MACHINE=i686
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
|
||||
&& UNAME_MACHINE=i686
|
||||
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
|
||||
else
|
||||
echo ${UNAME_MACHINE}-pc-sysv32
|
||||
fi
|
||||
exit 0 ;;
|
||||
i?86:UnixWare:*:*)
|
||||
if /bin/uname -X 2>/dev/null >/dev/null ; then
|
||||
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
|
||||
&& UNAME_MACHINE=i586
|
||||
fi
|
||||
echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
pc:*:*:*)
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i386.
|
||||
@@ -752,7 +901,7 @@ EOF
|
||||
mc68030:UNIX_System_V:4.*:*)
|
||||
echo m68k-atari-sysv4
|
||||
exit 0 ;;
|
||||
i?86:LynxOS:2.*:*)
|
||||
i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
|
||||
echo i386-unknown-lynxos${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
TSUNAMI:LynxOS:2.*:*)
|
||||
@@ -764,6 +913,9 @@ EOF
|
||||
SM[BE]S:UNIX_SV:*:*)
|
||||
echo mips-dde-sysv${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
RM*:ReliantUNIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
RM*:SINIX-*:*:*)
|
||||
echo mips-sni-sysv4
|
||||
exit 0 ;;
|
||||
@@ -794,7 +946,7 @@ EOF
|
||||
news*:NEWS-OS:*:6*)
|
||||
echo mips-sony-newsos6
|
||||
exit 0 ;;
|
||||
R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*)
|
||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
@@ -810,12 +962,27 @@ EOF
|
||||
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
|
||||
echo i586-pc-beos
|
||||
exit 0 ;;
|
||||
SX-4:SUPER-UX:*:*)
|
||||
echo sx4-nec-superux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
SX-5:SUPER-UX:*:*)
|
||||
echo sx5-nec-superux${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
Power*:Rhapsody:*:*)
|
||||
echo powerpc-apple-rhapsody${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:Rhapsody:*:*)
|
||||
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
|
||||
exit 0 ;;
|
||||
*:QNX:*:4*)
|
||||
echo i386-qnx-qnx${UNAME_VERSION}
|
||||
exit 0 ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
cat >dummy.c <<EOF
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
@@ -853,7 +1020,10 @@ main ()
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
if (version < 4)
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
else
|
||||
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
@@ -913,8 +1083,8 @@ main ()
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0
|
||||
rm -f dummy.c dummy
|
||||
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
|
||||
rm -f $dummy.c $dummy
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
|
335
config.sub
vendored
335
config.sub
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script, version 1.1.
|
||||
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
@@ -98,11 +98,21 @@ case $os in
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-scout)
|
||||
;;
|
||||
-wrs)
|
||||
os=-vxworks
|
||||
basic_machine=$1
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
-sco5)
|
||||
os=sco3.2v5
|
||||
os=-sco3.2v5
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-sco4)
|
||||
@@ -121,6 +131,9 @@ case $os in
|
||||
os=-sco3.2v2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-udk*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-isc)
|
||||
os=-isc2.2
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
@@ -143,22 +156,33 @@ case $os in
|
||||
-psos*)
|
||||
os=-psos
|
||||
;;
|
||||
-mint | -mint[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
esac
|
||||
|
||||
# Decode aliases for certain CPU-COMPANY combinations.
|
||||
case $basic_machine in
|
||||
# Recognize the basic CPU types without company name.
|
||||
# Some are omitted here because they have special meanings below.
|
||||
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
|
||||
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
|
||||
| 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \
|
||||
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \
|
||||
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \
|
||||
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \
|
||||
| mipstx39 | mipstx39el \
|
||||
| sparc | sparclet | sparclite | sparc64 | v850)
|
||||
| 580 | i960 | h8300 \
|
||||
| hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
|
||||
| alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
|
||||
| we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
|
||||
| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
|
||||
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
|
||||
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
|
||||
| mips64vr5000 | miprs64vr5000el | mcore \
|
||||
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
|
||||
| thumb | d10v | fr30)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
|
||||
;;
|
||||
|
||||
# We use `pc' rather than `unknown'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
@@ -171,27 +195,45 @@ case $basic_machine in
|
||||
exit 1
|
||||
;;
|
||||
# Recognize the basic CPU types with company name.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \
|
||||
# FIXME: clean up the formatting here.
|
||||
vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
|
||||
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
|
||||
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \
|
||||
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \
|
||||
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \
|
||||
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \
|
||||
| power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
|
||||
| xmp-* | ymp-* \
|
||||
| hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
|
||||
| alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
|
||||
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
|
||||
| clipper-* | orion-* \
|
||||
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
|
||||
| sparc64-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| f301-*)
|
||||
| sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
|
||||
| mips64el-* | mips64orion-* | mips64orionel-* \
|
||||
| mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
|
||||
| mipstx39-* | mipstx39el-* | mcore-* \
|
||||
| f301-* | armv*-* | t3e-* \
|
||||
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
|
||||
| thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* )
|
||||
;;
|
||||
# Recognize the various machine names and aliases which stand
|
||||
# for a CPU type and a company and sometimes even an OS.
|
||||
386bsd)
|
||||
basic_machine=i386-unknown
|
||||
os=-bsd
|
||||
;;
|
||||
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
|
||||
basic_machine=m68000-att
|
||||
;;
|
||||
3b*)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
a29khif)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
adobe68k)
|
||||
basic_machine=m68010-adobe
|
||||
os=-scout
|
||||
;;
|
||||
alliant | fx80)
|
||||
basic_machine=fx80-alliant
|
||||
;;
|
||||
@@ -221,6 +263,10 @@ case $basic_machine in
|
||||
basic_machine=m68k-apollo
|
||||
os=-sysv
|
||||
;;
|
||||
apollo68bsd)
|
||||
basic_machine=m68k-apollo
|
||||
os=-bsd
|
||||
;;
|
||||
aux)
|
||||
basic_machine=m68k-apple
|
||||
os=-aux
|
||||
@@ -297,6 +343,10 @@ case $basic_machine in
|
||||
encore | umax | mmax)
|
||||
basic_machine=ns32k-encore
|
||||
;;
|
||||
es1800 | OSE68k | ose68k | ose | OSE)
|
||||
basic_machine=m68k-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
fx2800)
|
||||
basic_machine=i860-alliant
|
||||
;;
|
||||
@@ -315,6 +365,14 @@ case $basic_machine in
|
||||
basic_machine=h8300-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
h8300xray)
|
||||
basic_machine=h8300-hitachi
|
||||
os=-xray
|
||||
;;
|
||||
h8500hms)
|
||||
basic_machine=h8500-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
harris)
|
||||
basic_machine=m88k-harris
|
||||
os=-sysv3
|
||||
@@ -330,13 +388,30 @@ case $basic_machine in
|
||||
basic_machine=m68k-hp
|
||||
os=-hpux
|
||||
;;
|
||||
hp3k9[0-9][0-9] | hp9[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k2[0-9][0-9] | hp9k31[0-9])
|
||||
basic_machine=m68000-hp
|
||||
;;
|
||||
hp9k3[2-9][0-9])
|
||||
basic_machine=m68k-hp
|
||||
;;
|
||||
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7)
|
||||
hp9k6[0-9][0-9] | hp6[0-9][0-9])
|
||||
basic_machine=hppa1.0-hp
|
||||
;;
|
||||
hp9k7[0-79][0-9] | hp7[0-79][0-9])
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k78[0-9] | hp78[0-9])
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
|
||||
# FIXME: really hppa2.0-hp
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][13679] | hp8[0-9][13679])
|
||||
basic_machine=hppa1.1-hp
|
||||
;;
|
||||
hp9k8[0-9][0-9] | hp8[0-9][0-9])
|
||||
@@ -345,9 +420,16 @@ case $basic_machine in
|
||||
hppa-next)
|
||||
os=-nextstep3
|
||||
;;
|
||||
hppaosf)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-osf
|
||||
;;
|
||||
hppro)
|
||||
basic_machine=hppa1.1-hp
|
||||
os=-proelf
|
||||
;;
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i[34567]86v32)
|
||||
@@ -366,6 +448,25 @@ case $basic_machine in
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-solaris2
|
||||
;;
|
||||
i386mach)
|
||||
basic_machine=i386-mach
|
||||
os=-mach
|
||||
;;
|
||||
i386-vsta | vsta)
|
||||
basic_machine=i386-unknown
|
||||
os=-vsta
|
||||
;;
|
||||
i386-go32 | go32)
|
||||
basic_machine=i386-unknown
|
||||
os=-go32
|
||||
;;
|
||||
i386-mingw32 | mingw32)
|
||||
basic_machine=i386-unknown
|
||||
os=-mingw32
|
||||
;;
|
||||
i386-qnx | qnx)
|
||||
basic_machine=i386-qnx
|
||||
;;
|
||||
iris | iris4d)
|
||||
basic_machine=mips-sgi
|
||||
case $os in
|
||||
@@ -394,6 +495,10 @@ case $basic_machine in
|
||||
miniframe)
|
||||
basic_machine=m68000-convergent
|
||||
;;
|
||||
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
|
||||
basic_machine=m68k-atari
|
||||
os=-mint
|
||||
;;
|
||||
mipsel*-linux*)
|
||||
basic_machine=mipsel-unknown
|
||||
os=-linux-gnu
|
||||
@@ -408,10 +513,30 @@ case $basic_machine in
|
||||
mips3*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
|
||||
;;
|
||||
monitor)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-unknown
|
||||
os=-msdos
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
;;
|
||||
netbsd386)
|
||||
basic_machine=i386-unknown
|
||||
os=-netbsd
|
||||
;;
|
||||
netwinder)
|
||||
basic_machine=armv4l-rebel
|
||||
os=-linux
|
||||
;;
|
||||
news | news700 | news800 | news900)
|
||||
basic_machine=m68k-sony
|
||||
os=-newsos
|
||||
@@ -424,6 +549,10 @@ case $basic_machine in
|
||||
basic_machine=mips-sony
|
||||
os=-newsos
|
||||
;;
|
||||
necv70)
|
||||
basic_machine=v70-nec
|
||||
os=-sysv
|
||||
;;
|
||||
next | m*-next )
|
||||
basic_machine=m68k-next
|
||||
case $os in
|
||||
@@ -449,9 +578,25 @@ case $basic_machine in
|
||||
basic_machine=i960-intel
|
||||
os=-nindy
|
||||
;;
|
||||
mon960)
|
||||
basic_machine=i960-intel
|
||||
os=-mon960
|
||||
;;
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
op50n-* | op60c-*)
|
||||
basic_machine=hppa1.1-oki
|
||||
os=-proelf
|
||||
;;
|
||||
OSE68000 | ose68000)
|
||||
basic_machine=m68000-ericsson
|
||||
os=-ose
|
||||
;;
|
||||
os68k)
|
||||
basic_machine=m68k-none
|
||||
os=-os68k
|
||||
;;
|
||||
pa-hitachi)
|
||||
basic_machine=hppa1.1-hitachi
|
||||
os=-hiuxwe2
|
||||
@@ -469,19 +614,19 @@ case $basic_machine in
|
||||
pc532 | pc532-*)
|
||||
basic_machine=ns32k-pc532
|
||||
;;
|
||||
pentium | p5 | k5 | nexen)
|
||||
pentium | p5 | k5 | k6 | nexen)
|
||||
basic_machine=i586-pc
|
||||
;;
|
||||
pentiumpro | p6 | k6 | 6x86)
|
||||
pentiumpro | p6 | 6x86)
|
||||
basic_machine=i686-pc
|
||||
;;
|
||||
pentiumii | pentium2)
|
||||
basic_machine=i786-pc
|
||||
;;
|
||||
pentium-* | p5-* | k5-* | nexen-*)
|
||||
pentium-* | p5-* | k5-* | k6-* | nexen-*)
|
||||
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumpro-* | p6-* | k6-* | 6x86-*)
|
||||
pentiumpro-* | p6-* | 6x86-*)
|
||||
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
pentiumii-* | pentium2-*)
|
||||
@@ -505,12 +650,20 @@ case $basic_machine in
|
||||
ps2)
|
||||
basic_machine=i386-ibm
|
||||
;;
|
||||
rom68k)
|
||||
basic_machine=m68k-rom68k
|
||||
os=-coff
|
||||
;;
|
||||
rm[46]00)
|
||||
basic_machine=mips-siemens
|
||||
;;
|
||||
rtpc | rtpc-*)
|
||||
basic_machine=romp-ibm
|
||||
;;
|
||||
sa29200)
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
sequent)
|
||||
basic_machine=i386-sequent
|
||||
;;
|
||||
@@ -518,6 +671,10 @@ case $basic_machine in
|
||||
basic_machine=sh-hitachi
|
||||
os=-hms
|
||||
;;
|
||||
sparclite-wrs)
|
||||
basic_machine=sparclite-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
sps7)
|
||||
basic_machine=m68k-bull
|
||||
os=-sysv2
|
||||
@@ -525,6 +682,13 @@ case $basic_machine in
|
||||
spur)
|
||||
basic_machine=spur-unknown
|
||||
;;
|
||||
st2000)
|
||||
basic_machine=m68k-tandem
|
||||
;;
|
||||
stratus)
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@@ -569,6 +733,10 @@ case $basic_machine in
|
||||
basic_machine=i386-sequent
|
||||
os=-dynix
|
||||
;;
|
||||
t3e)
|
||||
basic_machine=t3e-cray
|
||||
os=-unicos
|
||||
;;
|
||||
tx39)
|
||||
basic_machine=mipstx39-unknown
|
||||
;;
|
||||
@@ -586,6 +754,10 @@ case $basic_machine in
|
||||
basic_machine=a29k-nyu
|
||||
os=-sym1
|
||||
;;
|
||||
v810 | necv810)
|
||||
basic_machine=v810-nec
|
||||
os=-none
|
||||
;;
|
||||
vaxv)
|
||||
basic_machine=vax-dec
|
||||
os=-sysv
|
||||
@@ -609,6 +781,14 @@ case $basic_machine in
|
||||
basic_machine=a29k-wrs
|
||||
os=-vxworks
|
||||
;;
|
||||
w65*)
|
||||
basic_machine=w65-wdc
|
||||
os=-none
|
||||
;;
|
||||
w89k-*)
|
||||
basic_machine=hppa1.1-winbond
|
||||
os=-proelf
|
||||
;;
|
||||
xmp)
|
||||
basic_machine=xmp-cray
|
||||
os=-unicos
|
||||
@@ -616,6 +796,10 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
z8k-*-coff)
|
||||
basic_machine=z8k-unknown
|
||||
os=-sim
|
||||
;;
|
||||
none)
|
||||
basic_machine=none-none
|
||||
os=-none
|
||||
@@ -623,6 +807,15 @@ case $basic_machine in
|
||||
|
||||
# Here we handle the default manufacturer of certain CPU types. It is in
|
||||
# some cases the only manufacturer, in others, it is the most popular.
|
||||
w89k)
|
||||
basic_machine=hppa1.1-winbond
|
||||
;;
|
||||
op50n)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
op60c)
|
||||
basic_machine=hppa1.1-oki
|
||||
;;
|
||||
mips)
|
||||
if [ x$os = x-linux-gnu ]; then
|
||||
basic_machine=mips-unknown
|
||||
@@ -645,7 +838,7 @@ case $basic_machine in
|
||||
we32k)
|
||||
basic_machine=we32k-att
|
||||
;;
|
||||
sparc)
|
||||
sparc | sparcv9)
|
||||
basic_machine=sparc-sun
|
||||
;;
|
||||
cydra)
|
||||
@@ -657,6 +850,16 @@ case $basic_machine in
|
||||
orion105)
|
||||
basic_machine=clipper-highlevel
|
||||
;;
|
||||
mac | mpw | mac-mpw)
|
||||
basic_machine=m68k-apple
|
||||
;;
|
||||
pmac | pmac-mpw)
|
||||
basic_machine=powerpc-apple
|
||||
;;
|
||||
c4x*)
|
||||
basic_machine=c4x-none
|
||||
os=-coff
|
||||
;;
|
||||
*)
|
||||
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
|
||||
exit 1
|
||||
@@ -710,13 +913,21 @@ case $os in
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \
|
||||
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos*)
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
|
||||
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
|
||||
| -macos* | -mpw* | -magic* | -mon960* | -lnews*)
|
||||
;;
|
||||
-mac*)
|
||||
os=`echo $os | sed -e 's|mac|macos|'`
|
||||
;;
|
||||
-linux*)
|
||||
os=`echo $os | sed -e 's|linux|linux-gnu|'`
|
||||
;;
|
||||
@@ -726,6 +937,9 @@ case $os in
|
||||
-sunos6*)
|
||||
os=`echo $os | sed -e 's|sunos6|solaris3|'`
|
||||
;;
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-osfrose*)
|
||||
os=-osfrose
|
||||
;;
|
||||
@@ -741,6 +955,9 @@ case $os in
|
||||
-acis*)
|
||||
os=-aos
|
||||
;;
|
||||
-386bsd)
|
||||
os=-bsd
|
||||
;;
|
||||
-ctix* | -uts*)
|
||||
os=-sysv
|
||||
;;
|
||||
@@ -760,6 +977,9 @@ case $os in
|
||||
-oss*)
|
||||
os=-sysv3
|
||||
;;
|
||||
-qnx)
|
||||
os=-qnx4
|
||||
;;
|
||||
-svr4)
|
||||
os=-sysv4
|
||||
;;
|
||||
@@ -772,9 +992,18 @@ case $os in
|
||||
# This must come after -sysvr4.
|
||||
-sysv*)
|
||||
;;
|
||||
-ose*)
|
||||
os=-ose
|
||||
;;
|
||||
-es1800*)
|
||||
os=-ose
|
||||
;;
|
||||
-xenix)
|
||||
os=-xenix
|
||||
;;
|
||||
-*mint | -*MiNT)
|
||||
os=-mint
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@@ -800,6 +1029,9 @@ case $basic_machine in
|
||||
*-acorn)
|
||||
os=-riscix1.2
|
||||
;;
|
||||
arm*-rebel)
|
||||
os=-linux
|
||||
;;
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
@@ -821,6 +1053,15 @@ case $basic_machine in
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mips*-cisco)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-tti) # must be before sparc entry or we get the wrong os.
|
||||
os=-sysv3
|
||||
;;
|
||||
@@ -833,6 +1074,15 @@ case $basic_machine in
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-wec)
|
||||
os=-proelf
|
||||
;;
|
||||
*-winbond)
|
||||
os=-proelf
|
||||
;;
|
||||
*-oki)
|
||||
os=-proelf
|
||||
;;
|
||||
*-hp)
|
||||
os=-hpux
|
||||
;;
|
||||
@@ -896,6 +1146,18 @@ case $basic_machine in
|
||||
f301-fujitsu)
|
||||
os=-uxpv
|
||||
;;
|
||||
*-rom68k)
|
||||
os=-coff
|
||||
;;
|
||||
*-*bug)
|
||||
os=-coff
|
||||
;;
|
||||
*-apple)
|
||||
os=-macos
|
||||
;;
|
||||
*-atari*)
|
||||
os=-mint
|
||||
;;
|
||||
*)
|
||||
os=-none
|
||||
;;
|
||||
@@ -917,9 +1179,15 @@ case $basic_machine in
|
||||
-aix*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-beos*)
|
||||
vendor=be
|
||||
;;
|
||||
-hpux*)
|
||||
vendor=hp
|
||||
;;
|
||||
-mpeix*)
|
||||
vendor=hp
|
||||
;;
|
||||
-hiux*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
@@ -935,7 +1203,7 @@ case $basic_machine in
|
||||
-genix*)
|
||||
vendor=ns
|
||||
;;
|
||||
-mvs*)
|
||||
-mvs* | -opened*)
|
||||
vendor=ibm
|
||||
;;
|
||||
-ptx*)
|
||||
@@ -947,6 +1215,15 @@ case $basic_machine in
|
||||
-aux*)
|
||||
vendor=apple
|
||||
;;
|
||||
-hms*)
|
||||
vendor=hitachi
|
||||
;;
|
||||
-mpw* | -macos*)
|
||||
vendor=apple
|
||||
;;
|
||||
-*mint | -*MiNT)
|
||||
vendor=atari
|
||||
;;
|
||||
esac
|
||||
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
|
||||
;;
|
||||
|
80
configure.in
80
configure.in
@@ -15,7 +15,7 @@ AC_INIT(gdk/gdktypes.h)
|
||||
# Save this value here, since automake will set cflags later
|
||||
cflags_set=${CFLAGS+set}
|
||||
|
||||
dnl we to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
|
||||
dnl we need to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
|
||||
dnl are available for $ac_help expansion (don't we all *love* autoconf?)
|
||||
AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
|
||||
#
|
||||
@@ -29,9 +29,9 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
|
||||
#
|
||||
GTK_MAJOR_VERSION=1
|
||||
GTK_MINOR_VERSION=2
|
||||
GTK_MICRO_VERSION=0
|
||||
GTK_INTERFACE_AGE=0
|
||||
GTK_BINARY_AGE=0
|
||||
GTK_MICRO_VERSION=8
|
||||
GTK_INTERFACE_AGE=3
|
||||
GTK_BINARY_AGE=8
|
||||
GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
|
||||
dnl
|
||||
AC_DIVERT_POP()dnl
|
||||
@@ -95,6 +95,7 @@ AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
|
||||
, enable_xim="yes")
|
||||
AC_ARG_ENABLE(xim_inst, [ --disable-xim-inst does not use xim instantiate callback],
|
||||
, enable_xim_inst="maybe")
|
||||
AC_ARG_ENABLE(rebuilds, [ --disable-rebuilds disable all source autogeneration rules],,enable_rebuilds=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 ])
|
||||
@@ -143,6 +144,9 @@ if test "x$GCC" = "xyes"; then
|
||||
fi
|
||||
changequote([,])dnl
|
||||
|
||||
# Honor aclocal flags
|
||||
ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
|
||||
|
||||
# define a MAINT-like variable REBUILD which is set if Perl
|
||||
# and awk are found, so autogenerated sources can be rebuilt
|
||||
|
||||
@@ -153,20 +157,35 @@ AC_CHECK_PROGS(PERL, perl5 perl)
|
||||
AC_CHECK_PROG(INDENT, indent, indent)
|
||||
|
||||
REBUILD=\#
|
||||
if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
|
||||
if test -n "$AWK" ; then
|
||||
REBUILD=
|
||||
fi
|
||||
if test "x$enable_rebuilds" = "xyes" && \
|
||||
test -n "$PERL" && \
|
||||
$PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
|
||||
test -n "$AWK" ; then
|
||||
REBUILD=
|
||||
fi
|
||||
AC_SUBST(REBUILD)
|
||||
|
||||
AC_MSG_CHECKING(whether make is GNU Make)
|
||||
STRIP_BEGIN=
|
||||
STRIP_END=
|
||||
if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
|
||||
STRIP_BEGIN='$(strip $(STRIP_DUMMY)'
|
||||
STRIP_END=')'
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
dnl some Make 3.79 $(strip ) versions are broken and require an empty arg
|
||||
STRIP_DUMMY=
|
||||
AC_SUBST(STRIP_DUMMY)
|
||||
AC_SUBST(STRIP_BEGIN)
|
||||
AC_SUBST(STRIP_END)
|
||||
|
||||
# i18n stuff
|
||||
ALL_LINGUAS="cs de es fr hu it ja ko nl no pl pt ru sv"
|
||||
ALL_LINGUAS="ca cs da de el es et eu fi fr ga gl hr hu it ja ko lt nl no nn pl pt pt_BR ro ru sk sl sv uk wa zh_TW.Big5"
|
||||
AM_GTK_GNU_GETTEXT
|
||||
AC_CHECK_FUNC(gettext,
|
||||
,
|
||||
AC_CHECK_LIB(intl, gettext)
|
||||
)
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
|
||||
# AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
|
||||
# this is the directory where the *.{mo,gmo} files are installed
|
||||
gtklocaledir='${prefix}/${DATADIRNAME}/locale'
|
||||
@@ -189,8 +208,10 @@ AC_TRY_RUN([#include <math.h>
|
||||
AC_MSG_RESULT()
|
||||
CFLAGS=$gtk_save_CFLAGS
|
||||
AC_MSG_WARN(
|
||||
[No ANSI prototypes found in library. (-std1 didn't work.)])
|
||||
)
|
||||
[No ANSI prototypes found in library. (-std1 didn't work.)]),
|
||||
true
|
||||
),
|
||||
AC_MSG_RESULT(none needed)
|
||||
)
|
||||
LIBS=$gtk_save_LIBS
|
||||
|
||||
@@ -214,9 +235,9 @@ fi
|
||||
if test x$with_glib = x ; then
|
||||
# Look for separately installed glib
|
||||
|
||||
AM_PATH_GLIB(1.2.0,,
|
||||
AM_PATH_GLIB(1.2.8,,
|
||||
AC_MSG_ERROR([
|
||||
*** GLIB 1.2.0 or better is required. The latest version of GLIB
|
||||
*** GLIB 1.2.8 or better is required. The latest version of GLIB
|
||||
*** is always available from ftp://ftp.gtk.org/.]),
|
||||
gmodule gthread)
|
||||
|
||||
@@ -256,7 +277,7 @@ else
|
||||
esac
|
||||
|
||||
GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
|
||||
GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule.la"
|
||||
GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule/libgmodule.la"
|
||||
GLIB_DEPLIBS=
|
||||
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
@@ -412,11 +433,12 @@ main ()
|
||||
return setlocale (LC_ALL, "${with_locale}") == NULL;
|
||||
}],
|
||||
need_x_locale=no,
|
||||
need_x_locale=yes)
|
||||
need_x_locale=yes,
|
||||
need_x_locale=no)
|
||||
AC_MSG_RESULT($need_x_locale)
|
||||
|
||||
if test $need_x_locale = yes; then
|
||||
GTK_LOCALE_CFLAGS="-DX_LOCALE"
|
||||
GTK_LOCALE_FLAGS="-DX_LOCALE"
|
||||
fi
|
||||
|
||||
# Checks for header files.
|
||||
@@ -448,28 +470,18 @@ fi
|
||||
|
||||
# Duplicate `widechar' tests from `glib'.
|
||||
# Check for wchar.h
|
||||
if test x = y; then
|
||||
# will not be executed
|
||||
# hack so as not to update `acconfig.h'
|
||||
AC_CHECK_HEADERS(wchar.h wctype.h)
|
||||
AC_CHECK_FUNCS(broken_wctype)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(for wchar.h)
|
||||
AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
|
||||
if test $gtk_ok = yes; then
|
||||
ac_kludge=HAVE_WCHAR_H
|
||||
AC_DEFINE($ac_kludge)
|
||||
AC_DEFINE(HAVE_WCHAR_H,1,[Define if wchar.h exists])
|
||||
fi
|
||||
AC_MSG_RESULT($gtk_ok)
|
||||
|
||||
# Check for wctype.h (for iswalnum)
|
||||
|
||||
AC_MSG_CHECKING(for wctype.h)
|
||||
AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
|
||||
if test $gtk_ok = yes; then
|
||||
ac_kludge=HAVE_WCTYPE_H
|
||||
AC_DEFINE($ac_kludge)
|
||||
AC_DEFINE(HAVE_WCTYPE_H,1,[Define if wctype.h exists])
|
||||
fi
|
||||
AC_MSG_RESULT($gtk_ok)
|
||||
|
||||
@@ -498,8 +510,7 @@ iswalnum((wchar_t) 0);
|
||||
LIBS="$oLIBS"
|
||||
|
||||
if test $gtk_ok = no; then
|
||||
ac_kludge=HAVE_BROKEN_WCTYPE
|
||||
AC_DEFINE($ac_kludge)
|
||||
AC_DEFINE(HAVE_BROKEN_WCTYPE,1,[Define if the wctype function is broken])
|
||||
GDK_WLIBS=
|
||||
fi
|
||||
AC_MSG_RESULT($gtk_ok)
|
||||
@@ -511,6 +522,7 @@ AC_SUBST(GTK_LOCALE_FLAGS)
|
||||
|
||||
AC_OUTPUT([
|
||||
gtk+.spec
|
||||
docs/gtk-config.1
|
||||
Makefile
|
||||
gtk-config
|
||||
po/Makefile.in
|
||||
|
@@ -18,3 +18,4 @@ Makefile.in
|
||||
*.vrs
|
||||
html
|
||||
text
|
||||
gtk-config.1
|
||||
|
@@ -101,36 +101,7 @@ FAQ_FILES=html/gtkfaq.html \
|
||||
html/gtkfaq-7.html \
|
||||
text/gtkfaq.txt
|
||||
|
||||
EXTRA_DIST = \
|
||||
gtk-config.1 \
|
||||
texinfo.tex \
|
||||
macros.texi \
|
||||
gtkdocs_fix \
|
||||
gtkfaq.sgml \
|
||||
gtk-config.txt \
|
||||
gtk_tut.sgml \
|
||||
gtk_tut_it.sgml \
|
||||
gtk_tut_fr.sgml \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt \
|
||||
gtk_tut_packbox1.gif \
|
||||
gtk_tut_packbox2.gif \
|
||||
html/gtk_tut_table.gif \
|
||||
html/gtk_tut_packbox1.gif \
|
||||
html/gtk_tut_packbox2.gif \
|
||||
gtk_tut_table.gif \
|
||||
html/gdk.html \
|
||||
html/gdk_toc.html \
|
||||
html/gtk.html \
|
||||
html/gtk_toc.html \
|
||||
$(TUTORIAL_FILES) \
|
||||
$(TUTORIAL_FR_FILES) \
|
||||
$(TUTORIAL_IT_FILES) \
|
||||
$(FAQ_FILES)
|
||||
html/gtk_tut_table.gif: gdk.html gtk.html
|
||||
|
||||
.PHONY: html htmldir faq tutorial tutorial_it tutorial_fr files
|
||||
|
||||
@@ -195,3 +166,36 @@ files:
|
||||
@files=`ls $(DISTFILES) 2> /dev/null `; for p in $$files; do \
|
||||
echo $$p; \
|
||||
done
|
||||
|
||||
EXTRA_DIST += \
|
||||
Changes-1.2.txt \
|
||||
debugging.txt \
|
||||
developers.txt \
|
||||
refcounting.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
widget_system.txt \
|
||||
generation.txt \
|
||||
gtk-config.txt \
|
||||
gtk-config.1.in \
|
||||
texinfo.tex \
|
||||
macros.texi \
|
||||
gtkdocs_fix \
|
||||
gtkfaq.sgml \
|
||||
gtk_tut.sgml \
|
||||
gtk_tut_it.sgml \
|
||||
gtk_tut_fr.sgml \
|
||||
gtk_tut_packbox1.gif \
|
||||
gtk_tut_packbox2.gif \
|
||||
html/gtk_tut_table.gif \
|
||||
html/gtk_tut_packbox1.gif \
|
||||
html/gtk_tut_packbox2.gif \
|
||||
gtk_tut_table.gif \
|
||||
html/gdk.html \
|
||||
html/gdk_toc.html \
|
||||
html/gtk.html \
|
||||
html/gtk_toc.html \
|
||||
$(TUTORIAL_FILES) \
|
||||
$(TUTORIAL_FR_FILES) \
|
||||
$(TUTORIAL_IT_FILES) \
|
||||
$(FAQ_FILES)
|
||||
|
2492
docs/faq/gtkfaq.sgml
2492
docs/faq/gtkfaq.sgml
File diff suppressed because it is too large
Load Diff
177
docs/generation.txt
Normal file
177
docs/generation.txt
Normal file
@@ -0,0 +1,177 @@
|
||||
Overview:
|
||||
========
|
||||
|
||||
This file describes the way that autogeneration
|
||||
works within the GTK+ source code.
|
||||
|
||||
The following files in the gdk/ subdirectory
|
||||
are autogenerated:
|
||||
|
||||
gdkkeysyms.h
|
||||
gdkcursors.h
|
||||
|
||||
The following files in the gtk/ subdirectory
|
||||
are autogenerated:
|
||||
|
||||
gtk.defs
|
||||
Description of GTK+ types (and some functions) in a lisp-style
|
||||
format.
|
||||
gtktypebuiltins.h
|
||||
Header file including declarations for internal types
|
||||
gtktypebuiltins_vars.c
|
||||
Variables for type values for internal types.
|
||||
gtktypebuiltins_ids.c
|
||||
Arrays holding information about each internal type.
|
||||
gtktypebuiltins_evals.c
|
||||
Arrays holding mapping between enumeration values
|
||||
and strings.
|
||||
|
||||
gtkmarshal.c
|
||||
gtkmarshal.h
|
||||
Autogenerated signal marshallers
|
||||
|
||||
GDK
|
||||
===
|
||||
|
||||
gdkkeysyms.h and gdkcursors.h are generated from
|
||||
the corresponding header files
|
||||
|
||||
X11/cursorfont.h
|
||||
X11/keysymdef.h
|
||||
|
||||
by some simple sed scripts. These are not actually
|
||||
run automatically because we want all the keysyms
|
||||
even on systems with a limited set.
|
||||
So the Gdk rule to generate both files (X-derived-headers)
|
||||
only needs to be rerun for every new release of the X Window
|
||||
System.
|
||||
|
||||
GTK+ - type definitions
|
||||
=======================
|
||||
|
||||
The type definitions are generated from several sources:
|
||||
|
||||
gtk-boxed.defs - definitions for boxed types
|
||||
GTK+ header files
|
||||
GDK header files
|
||||
|
||||
The makeenums.pl script does a heuristic parse of
|
||||
the header files and extracts all enumerations declarations.
|
||||
It also recognizes a number of pseudo-comments in the
|
||||
header files:
|
||||
|
||||
Two of these apply to individual enumeration values:
|
||||
|
||||
/*< skip >*/
|
||||
|
||||
This enumeration value should be skipped.
|
||||
|
||||
/*< nick=NICK >*/
|
||||
|
||||
The nickname for this value should NICK instead of the
|
||||
normally guessed value. For instance:
|
||||
|
||||
typedef enum {
|
||||
GTK_TARGET_SAME_APP = 1 << 0, /*< nick=same-app >*/
|
||||
GTK_TARGET_SAME_WIDGET = 1 << 1 /*< nick=same-widget >*/
|
||||
} GtkTargetFlags;
|
||||
|
||||
makes the nicks "same-app" and "same-widget", instead of
|
||||
"app" and "widget" that would normally be used.
|
||||
|
||||
The other two apply to entire enumeration declarations.
|
||||
|
||||
/*< prefix=PREFIX >*/
|
||||
|
||||
Specifies the prefix to be removed from the enumeration
|
||||
values to generate nicknames.
|
||||
|
||||
/*< flags >*/
|
||||
|
||||
Specifies that this enumeration is used as a bitfield.
|
||||
(makenums.pl normally guesses this from the presence of values
|
||||
with << operators). For instance:
|
||||
|
||||
typedef enum /*< flags >*/
|
||||
{
|
||||
GDK_IM_PREEDIT_AREA = 0x0001,
|
||||
GDK_IM_PREEDIT_CALLBACKS = 0x0002,
|
||||
[ ... ]
|
||||
} GdkIMStyle;
|
||||
|
||||
makeenums.pl can be run into two modes:
|
||||
|
||||
1) Generate the gtktypebuiltins_eval.c file (this
|
||||
contains arrays holding the mapping of
|
||||
string <=> enumeration value)
|
||||
|
||||
2) Generate the enumeration portion of gtk.defs.
|
||||
|
||||
The enumearation portion is added to the boxed type
|
||||
declarations in gtk-boxed.defs to create gtk.defs.
|
||||
|
||||
The makeetypes.awk program takes the gtk.defs file, and
|
||||
from that generates various files depending on the
|
||||
third parameter passed to it:
|
||||
|
||||
macros: gtktypebuiltins.h
|
||||
variables: gtktypebuiltins_vars.c
|
||||
entries: gtktypebuiltins_ids.c
|
||||
|
||||
GTK+ - marshallers
|
||||
==================
|
||||
|
||||
The files gtkmarshal.c and gtkmarshal.h include declarations
|
||||
and definitions for the marshallers needed inside of
|
||||
GTK+. The marshallers to be generated are listed in
|
||||
the file gtkmashal.list, which is processed
|
||||
by genmarshal.pl.
|
||||
|
||||
The format of this file is a list of lines:
|
||||
|
||||
<retval-type>:<arg1-type>,<arg2-type>,<arg3-type>
|
||||
|
||||
e.g.:
|
||||
|
||||
BOOL:POINTER,STRING,STRING,POINTER
|
||||
|
||||
A marshaller is generated for each line in the file.
|
||||
The possible types are:
|
||||
|
||||
NONE
|
||||
BOOL
|
||||
CHAR
|
||||
INT
|
||||
UINT
|
||||
LONG
|
||||
ULONG
|
||||
FLOAT
|
||||
DOUBLE
|
||||
STRING
|
||||
ENUM
|
||||
FLAGS
|
||||
BOXED
|
||||
POINTER
|
||||
OBJECT
|
||||
FOREIGN (gpointer data, GtkDestroyNotify notify)
|
||||
C_CALLBACK (GtkFunction func, gpointer func_data)
|
||||
SIGNAL (GtkSignalFunc f, gpointer data)
|
||||
ARGS (gint n_args, GtkArg *args)
|
||||
CALLBACK (GtkCallBackMarshal marshall,
|
||||
gpointer data,
|
||||
GtkDestroyNotify Notify)
|
||||
|
||||
Some of these types map to multiple return values - these
|
||||
are marked above with the return types in parantheses.
|
||||
|
||||
NOTES
|
||||
=====
|
||||
|
||||
When autogenerating GTK+ files, the autogenerated
|
||||
files are often rebuild resulting in the same result.
|
||||
|
||||
To prevent unecessary rebuilds of the entire directory, some files
|
||||
that multiple other source files depend on are not actually written
|
||||
to directly. Instead, an intermediate file is written, which
|
||||
is then compared to the old file, and only if it is different
|
||||
is it copied into the final location.
|
@@ -1,4 +1,4 @@
|
||||
.TH GTK+ 1 "25 October 1998" Version 1.2.0
|
||||
.TH GTK+ 1 "25 October 1998" Version @VERSION@
|
||||
.SH NAME
|
||||
gtk-config - script to get information about the installed version of GTK+
|
||||
.SH SYNOPSIS
|
@@ -79,7 +79,7 @@ approved by Peter Mattis.
|
||||
This is edition @value{edition} of the GTK documentation,
|
||||
@w{@value{update-date}}.
|
||||
@end ifinfo
|
||||
@c FIXME: Do a introduction to the GTK?
|
||||
@c FIXME: Do an introduction to the GTK?
|
||||
|
||||
@menu
|
||||
* Copying:: Your rights.
|
||||
@@ -288,7 +288,7 @@ form that is easier to parse. Tools for generating bindings of Gtk to
|
||||
other languages can read these declarations and---because all the
|
||||
important details are defined---automatically generate the bulk of the
|
||||
needed glue code. It is also possible to feed these declarations into a
|
||||
running application (a interface builder, say) and thus make it aware of
|
||||
running application (an interface builder, say) and thus make it aware of
|
||||
new widgets and functions without recompiling anything.
|
||||
|
||||
The run-time side of the type system is also somewhat introspective.
|
||||
@@ -320,7 +320,7 @@ inherit these rules from their fundamental type. For example,
|
||||
derive from @samp{GtkObject} and so the rules for @samp{GtkObject} apply
|
||||
to all widgets as well.
|
||||
|
||||
This derivation defines a type hierachy, but this hierachy is not
|
||||
This derivation defines a type hierarchy, but this hierarchy is not
|
||||
completely general. You can't derive from @samp{int} for example, and
|
||||
you can only have one level of derivation from @samp{enum}. The
|
||||
fundamental type @samp{GtkObject}, however, is the basis for the large
|
||||
@@ -382,7 +382,7 @@ to a fundamental type and thus there is no name for it.
|
||||
|
||||
@deftp {Data type} GtkType
|
||||
The type @code{GtkType} holds the run-time representation of a type. It
|
||||
is a integer of a certain size. The follwing macros are defined to
|
||||
is an integer of a certain size. The follwing macros are defined to
|
||||
access the basic properties of a @code{GtkType}:
|
||||
|
||||
@deftypefn {Macro} {unsigned int} GTK_TYPE_SEQNO (GtkType type)
|
||||
@@ -461,7 +461,7 @@ always return @code{NULL}.
|
||||
@item
|
||||
The @code{class_init_func} and @code{base_class_init_func} fields are
|
||||
callbacks which are used by the type mechanism to initialize class
|
||||
specific fields. The single argument these function taks is a pointer to
|
||||
specific fields. The single argument these functions take is a pointer to
|
||||
a class structure. When you do not need one or both of them, set the
|
||||
corresponding field to @code{NULL}. The @code{class_init_func} will be
|
||||
called at most once, right after the class structure of size
|
||||
@@ -1109,7 +1109,7 @@ opaque.
|
||||
All widget creation routines in GTK return pointers to GtkWidget
|
||||
structures. In reality, all widget creation routines create structures
|
||||
that can be viewed as equivalent to the GtkWidget structure, but often
|
||||
have contain additional information. @xref{Object Implementation}
|
||||
have contain additional information. @xref{Object Implementation}.
|
||||
|
||||
The widgets available for use are implemented in a hierarchy. Several
|
||||
widgets exist solely as common bases for more specific widgets. For
|
||||
|
3221
docs/gtk_tut.sgml
3221
docs/gtk_tut.sgml
File diff suppressed because it is too large
Load Diff
2492
docs/gtkfaq.sgml
2492
docs/gtkfaq.sgml
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ functions that follow these conventions:
|
||||
GtkObjects also provide the following functions:
|
||||
|
||||
*_destroy: Render an object `unusable', but as long as there are
|
||||
references to it, it's allocated memory will not be freed.
|
||||
references to it, its allocated memory will not be freed.
|
||||
*_sink: Clear a GtkObjects `floating' state and decrement the
|
||||
reference count by 1.
|
||||
|
||||
@@ -240,7 +240,7 @@ Taking care of proper referencing
|
||||
---------------------------------
|
||||
|
||||
There are some cases where referencing of widgets from outside the toolkit
|
||||
(on the application side is needed).
|
||||
(on the application side) is needed.
|
||||
Once the application performes an operation on a widget that will cause
|
||||
its reference count to drop, if it wants to take further actions on the
|
||||
widget, it needs to hold a reference to it.
|
||||
@@ -248,7 +248,7 @@ widget, it needs to hold a reference to it.
|
||||
Example code sequences that require reference wraps:
|
||||
|
||||
/* gtk_container_remove() will unparent the child and therefore
|
||||
* cause it's reference count to be decremented by one.
|
||||
* cause its reference count to be decremented by one.
|
||||
*/
|
||||
gtk_widget_ref (widget);
|
||||
gtk_container_remove (container, widget);
|
||||
|
@@ -88,13 +88,13 @@ GtkWidget::style_set
|
||||
Flag indications:
|
||||
|
||||
!GTK_RC_STYLE && !GTK_USER_STYLE:
|
||||
The widget has it's default style set, no rc lookup has been
|
||||
The widget has its default style set, no rc lookup has been
|
||||
performed, the widget has not been size requested yet and is
|
||||
therefore not yet realized.
|
||||
|
||||
GTK_USER_STYLE:
|
||||
GTK_RC_STYLE is not set.
|
||||
The widget has a user style assigned, and it's default style has been
|
||||
The widget has a user style assigned, and its default style has been
|
||||
saved.
|
||||
|
||||
GTK_RC_STYLE:
|
||||
|
@@ -398,7 +398,7 @@ according the the tab continuation of the previous line.
|
||||
Exposure and drawing:
|
||||
|
||||
Exposure is handled from the EXPOSE_TEXT function. It assumes that
|
||||
the LINE_START_CACHE and all it's parameters are accurate and simply
|
||||
the LINE_START_CACHE and all its parameters are accurate and simply
|
||||
exposes any line which is in the exposure region. It calls the
|
||||
CLEAR_AREA function to clear the background and/or lay down a pixmap
|
||||
background. The text widget has a scrollable pixmap background, which
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,7 @@ SUBDIRS = arrow \
|
||||
rangewidgets \
|
||||
rulers \
|
||||
scribble-simple \
|
||||
scribble-xinput \
|
||||
scrolledwin \
|
||||
selection \
|
||||
spinbutton \
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *aspect_frame;
|
||||
|
@@ -3,12 +3,12 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Create a Button Box with the specified parameters */
|
||||
GtkWidget *create_bbox (gint horizontal,
|
||||
char* title,
|
||||
gint spacing,
|
||||
gint child_w,
|
||||
gint child_h,
|
||||
gint layout)
|
||||
GtkWidget *create_bbox( gint horizontal,
|
||||
char *title,
|
||||
gint spacing,
|
||||
gint child_w,
|
||||
gint child_h,
|
||||
gint layout )
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *bbox;
|
||||
|
@@ -75,7 +75,6 @@ int main( int argc,
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (gtk_exit), NULL);
|
||||
|
||||
|
||||
/* Sets the border width of the window. */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
|
||||
gtk_widget_realize(window);
|
||||
|
@@ -1,8 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
gcalendar: gcalendar.c
|
||||
$(CC) `gtk-config --cflags` gcalendar.c -o gcalendar `gtk-config --libs`
|
||||
calendar: calendar.c
|
||||
$(CC) `gtk-config --cflags` calendar.c -o calendar `gtk-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f gcalendar
|
||||
rm -f calendar
|
||||
|
@@ -1,5 +1,7 @@
|
||||
/* G Calendar
|
||||
/* example-start calendar calendar.c */
|
||||
/*
|
||||
* Copyright (C) 1998 Cesar Miquel, Shawn T. Amundson, Mattias Grönlund
|
||||
* Copyright (C) 2000 Tony Gale
|
||||
*
|
||||
* 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
|
||||
@@ -26,84 +28,18 @@
|
||||
|
||||
#define TM_YEAR_BASE 1900
|
||||
|
||||
|
||||
typedef struct _CalendarData {
|
||||
GtkWidget *flag_checkboxes[5];
|
||||
gboolean settings[5];
|
||||
gchar *font;
|
||||
GtkWidget *font_dialog;
|
||||
GtkWidget *window;
|
||||
GtkWidget *selected;
|
||||
GtkWidget *selected_double_click;
|
||||
GtkWidget *prev2_sig;
|
||||
GtkWidget *prev_sig;
|
||||
GtkWidget *last_sig;
|
||||
GtkWidget *month;
|
||||
} CalendarData;
|
||||
|
||||
void create_calendar();
|
||||
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data);
|
||||
void destroy (GtkWidget *widget, gpointer data);
|
||||
void day_selected_double_click (GtkWidget *widget, gpointer data);
|
||||
int main(int argc, char *argv[]);
|
||||
void calendar_month_changed (GtkWidget *widget, CalendarData *data);
|
||||
void calendar_day_selected (GtkWidget *widget, CalendarData *data);
|
||||
void calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data);
|
||||
|
||||
|
||||
void calendar_set_flags(CalendarData *calendar);
|
||||
void calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar);
|
||||
void calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar);
|
||||
void calendar_font_selection_destroy(GtkWidget * button, GtkWidget widget);
|
||||
void calendar_select_font(GtkWidget * button, CalendarData *calendar);
|
||||
void calendar_create_window_destroy(GtkWidget * ignore, CalendarData *calendar);
|
||||
void calendar_create_window(GtkWidget * ignored, CalendarData * calendar);
|
||||
void calendar_window_destroy(GtkWidget * ignore, CalendarData *calendar);
|
||||
void create_calendar();
|
||||
|
||||
/*
|
||||
* GtkCalendar
|
||||
*/
|
||||
|
||||
void
|
||||
calendar_month_changed (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->month), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_day_selected (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->selected), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_day_selected_double_click (GtkWidget *widget, CalendarData *data)
|
||||
{
|
||||
char buffer[256];
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window), &tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, 255, "%x", gmtime(&time));
|
||||
gtk_label_set (GTK_LABEL (data->selected_double_click), buffer);
|
||||
}
|
||||
|
||||
enum {
|
||||
calendar_show_header,
|
||||
calendar_show_days,
|
||||
@@ -112,8 +48,115 @@ enum {
|
||||
calendar_monday_first
|
||||
};
|
||||
|
||||
void
|
||||
calendar_set_flags(CalendarData *calendar)
|
||||
/*
|
||||
* GtkCalendar
|
||||
*/
|
||||
|
||||
void calendar_date_to_string( CalendarData *data,
|
||||
char *buffer,
|
||||
gint buff_len )
|
||||
{
|
||||
struct tm tm;
|
||||
time_t time;
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
time = mktime(&tm);
|
||||
strftime (buffer, buff_len-1, "%x", gmtime(&time));
|
||||
}
|
||||
|
||||
void calendar_set_signal_strings( char *sig_str,
|
||||
CalendarData *data)
|
||||
{
|
||||
gchar *prev_sig;
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig);
|
||||
|
||||
gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig);
|
||||
gtk_label_set (GTK_LABEL (data->last_sig), sig_str);
|
||||
}
|
||||
|
||||
void calendar_month_changed( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "month_changed: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+15, 256-15);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "day_selected: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+14, 256-14);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_day_selected_double_click( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
struct tm tm;
|
||||
char buffer[256] = "day_selected_double_click: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+27, 256-27);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
|
||||
memset (&tm, 0, sizeof (tm));
|
||||
gtk_calendar_get_date (GTK_CALENDAR(data->window),
|
||||
&tm.tm_year, &tm.tm_mon, &tm.tm_mday);
|
||||
tm.tm_year -= TM_YEAR_BASE;
|
||||
|
||||
if(GTK_CALENDAR(data->window)->marked_date[tm.tm_mday-1] == 0) {
|
||||
gtk_calendar_mark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
} else {
|
||||
gtk_calendar_unmark_day(GTK_CALENDAR(data->window),tm.tm_mday);
|
||||
}
|
||||
}
|
||||
|
||||
void calendar_prev_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_month( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_month: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+12, 256-12);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_prev_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "prev_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
void calendar_next_year( GtkWidget *widget,
|
||||
CalendarData *data )
|
||||
{
|
||||
char buffer[256] = "next_year: ";
|
||||
|
||||
calendar_date_to_string (data, buffer+11, 256-11);
|
||||
calendar_set_signal_strings (buffer, data);
|
||||
}
|
||||
|
||||
|
||||
void calendar_set_flags( CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint options=0;
|
||||
@@ -126,8 +169,8 @@ calendar_set_flags(CalendarData *calendar)
|
||||
gtk_calendar_display_options (GTK_CALENDAR (calendar->window), options);
|
||||
}
|
||||
|
||||
void
|
||||
calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar)
|
||||
void calendar_toggle_flag( GtkWidget *toggle,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
gint i;
|
||||
gint j;
|
||||
@@ -140,13 +183,15 @@ calendar_toggle_flag(GtkWidget * toggle, CalendarData *calendar)
|
||||
calendar_set_flags(calendar);
|
||||
|
||||
}
|
||||
void
|
||||
calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar)
|
||||
|
||||
void calendar_font_selection_ok( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
|
||||
calendar->font = gtk_font_selection_dialog_get_font_name (GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
|
||||
calendar->font = gtk_font_selection_dialog_get_font_name(
|
||||
GTK_FONT_SELECTION_DIALOG (calendar->font_dialog));
|
||||
if (calendar->window)
|
||||
{
|
||||
font = gtk_font_selection_dialog_get_font(GTK_FONT_SELECTION_DIALOG(calendar->font_dialog));
|
||||
@@ -161,8 +206,8 @@ calendar_font_selection_ok(GtkWidget * button, CalendarData *calendar)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
calendar_select_font(GtkWidget * button, CalendarData *calendar)
|
||||
void calendar_select_font( GtkWidget *button,
|
||||
CalendarData *calendar )
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
@@ -193,8 +238,7 @@ calendar_select_font(GtkWidget * button, CalendarData *calendar)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
create_calendar()
|
||||
void create_calendar()
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *vbox2, *vbox3;
|
||||
@@ -231,6 +275,7 @@ create_calendar()
|
||||
}
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title(GTK_WINDOW(window), "GtkCalendar Example");
|
||||
gtk_container_border_width (GTK_CONTAINER (window), 5);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
@@ -257,7 +302,7 @@ create_calendar()
|
||||
|
||||
/* Calendar widget */
|
||||
frame = gtk_frame_new("Calendar");
|
||||
gtk_box_pack_start(GTK_BOX(hbbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
gtk_box_pack_start(GTK_BOX(hbbox), frame, FALSE, TRUE, DEF_PAD);
|
||||
calendar=gtk_calendar_new();
|
||||
calendar_data.window = calendar;
|
||||
calendar_set_flags(&calendar_data);
|
||||
@@ -272,6 +317,18 @@ create_calendar()
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "day_selected_double_click",
|
||||
GTK_SIGNAL_FUNC (calendar_day_selected_double_click),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_month",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_month",
|
||||
GTK_SIGNAL_FUNC (calendar_next_month),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "prev_year",
|
||||
GTK_SIGNAL_FUNC (calendar_prev_year),
|
||||
&calendar_data);
|
||||
gtk_signal_connect (GTK_OBJECT (calendar), "next_year",
|
||||
GTK_SIGNAL_FUNC (calendar_next_year),
|
||||
&calendar_data);
|
||||
|
||||
|
||||
separator = gtk_vseparator_new ();
|
||||
@@ -311,30 +368,31 @@ create_calendar()
|
||||
|
||||
frame = gtk_frame_new("Signal events");
|
||||
gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, DEF_PAD);
|
||||
|
||||
vbox2 = gtk_vbox_new(TRUE, DEF_PAD_SMALL);
|
||||
gtk_container_add(GTK_CONTAINER(frame), vbox2);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Day selected:");
|
||||
label = gtk_label_new ("Signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.selected = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected, FALSE, TRUE, 0);
|
||||
calendar_data.last_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.last_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Day selected double click:");
|
||||
label = gtk_label_new ("Previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.selected_double_click = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.selected_double_click, FALSE, TRUE, 0);
|
||||
calendar_data.prev_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev_sig, FALSE, TRUE, 0);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
hbox = gtk_hbox_new (FALSE, 3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, TRUE, 0);
|
||||
label = gtk_label_new ("Month change:");
|
||||
label = gtk_label_new ("Second previous signal:");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
|
||||
calendar_data.month = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.month, FALSE, TRUE, 0);
|
||||
|
||||
calendar_data.prev2_sig = gtk_label_new ("");
|
||||
gtk_box_pack_start (GTK_BOX (hbox), calendar_data.prev2_sig, FALSE, TRUE, 0);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
|
||||
@@ -351,12 +409,16 @@ create_calendar()
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
gtk_set_locale ();
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
create_calendar();
|
||||
gtk_main ();
|
||||
return 0;
|
||||
|
||||
gtk_main();
|
||||
|
||||
return(0);
|
||||
}
|
||||
/* example-end */
|
@@ -83,7 +83,7 @@ int main( int argc,
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vbox, *hbox;
|
||||
GtkWidget *clist;
|
||||
GtkWidget *scrolled_window, *clist;
|
||||
GtkWidget *button_add, *button_clear, *button_hide_show;
|
||||
gchar *titles[2] = { "Ingredients", "Amount" };
|
||||
|
||||
@@ -103,7 +103,15 @@ int main( int argc,
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
/* Create the GtkCList. For this example we use 2 columns */
|
||||
/* Create a scrolled window to pack the CList widget into */
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), scrolled_window, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_window);
|
||||
|
||||
/* Create the CList. For this example we use 2 columns */
|
||||
clist = gtk_clist_new_with_titles( 2, titles);
|
||||
|
||||
/* When a selection is made, we want to know about it. The callback
|
||||
@@ -121,8 +129,8 @@ int main( int argc,
|
||||
*/
|
||||
gtk_clist_set_column_width (GTK_CLIST(clist), 0, 150);
|
||||
|
||||
/* Add the GtkCList widget to the vertical box and show it. */
|
||||
gtk_box_pack_start(GTK_BOX(vbox), clist, TRUE, TRUE, 0);
|
||||
/* Add the CList widget to the vertical box and show it. */
|
||||
gtk_container_add(GTK_CONTAINER(scrolled_window), clist);
|
||||
gtk_widget_show(clist);
|
||||
|
||||
/* Create the buttons and add them to the window. See the button
|
||||
|
@@ -2,28 +2,30 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void enter_callback(GtkWidget *widget, GtkWidget *entry)
|
||||
void enter_callback( GtkWidget *widget,
|
||||
GtkWidget *entry )
|
||||
{
|
||||
gchar *entry_text;
|
||||
entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
|
||||
printf("Entry contents: %s\n", entry_text);
|
||||
}
|
||||
|
||||
void entry_toggle_editable (GtkWidget *checkbutton,
|
||||
GtkWidget *entry)
|
||||
void entry_toggle_editable( GtkWidget *checkbutton,
|
||||
GtkWidget *entry )
|
||||
{
|
||||
gtk_entry_set_editable(GTK_ENTRY(entry),
|
||||
GTK_TOGGLE_BUTTON(checkbutton)->active);
|
||||
}
|
||||
|
||||
void entry_toggle_visibility (GtkWidget *checkbutton,
|
||||
GtkWidget *entry)
|
||||
void entry_toggle_visibility( GtkWidget *checkbutton,
|
||||
GtkWidget *entry )
|
||||
{
|
||||
gtk_entry_set_visibility(GTK_ENTRY(entry),
|
||||
GTK_TOGGLE_BUTTON(checkbutton)->active);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
|
||||
GtkWidget *window;
|
||||
|
@@ -2,8 +2,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *event_box;
|
||||
|
@@ -3,17 +3,20 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Get the selected filename and print it to the console */
|
||||
void file_ok_sel (GtkWidget *w, GtkFileSelection *fs)
|
||||
void file_ok_sel( GtkWidget *w,
|
||||
GtkFileSelection *fs )
|
||||
{
|
||||
g_print ("%s\n", gtk_file_selection_get_filename (GTK_FILE_SELECTION (fs)));
|
||||
}
|
||||
|
||||
void destroy (GtkWidget *widget, gpointer data)
|
||||
void destroy( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *filew;
|
||||
|
||||
@@ -29,7 +32,8 @@ int main (int argc, char *argv[])
|
||||
"clicked", (GtkSignalFunc) file_ok_sel, filew );
|
||||
|
||||
/* Connect the cancel_button to destroy the widget */
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (filew)->cancel_button),
|
||||
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION
|
||||
(filew)->cancel_button),
|
||||
"clicked", (GtkSignalFunc) gtk_widget_destroy,
|
||||
GTK_OBJECT (filew));
|
||||
|
||||
|
@@ -51,7 +51,7 @@ int main( int argc,
|
||||
button = gtk_button_new_with_label ("Press me");
|
||||
|
||||
/* When the button receives the "clicked" signal, it will call the
|
||||
* function move_button() passing it the Fixed Containter as its
|
||||
* function move_button() passing it the Fixed Container as its
|
||||
* argument. */
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (move_button), fixed);
|
||||
|
@@ -30,7 +30,7 @@ int main( int argc,
|
||||
frame = gtk_frame_new(NULL);
|
||||
gtk_container_add(GTK_CONTAINER(window), frame);
|
||||
|
||||
/* Set the frames label */
|
||||
/* Set the frame's label */
|
||||
gtk_frame_set_label( GTK_FRAME(frame), "GTK Frame Widget" );
|
||||
|
||||
/* Align the label at the right of the frame */
|
||||
|
@@ -275,12 +275,14 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
GtkDial *dial;
|
||||
GdkPoint points[3];
|
||||
GdkPoint points[6];
|
||||
gdouble s,c;
|
||||
gdouble theta;
|
||||
gdouble theta, last, increment;
|
||||
GtkStyle *blankstyle;
|
||||
gint xc, yc;
|
||||
gint upper, lower;
|
||||
gint tick_length;
|
||||
gint i;
|
||||
gint i, inc;
|
||||
|
||||
g_return_val_if_fail (widget != NULL, FALSE);
|
||||
g_return_val_if_fail (GTK_IS_DIAL (widget), FALSE);
|
||||
@@ -291,37 +293,22 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
|
||||
dial = GTK_DIAL (widget);
|
||||
|
||||
gdk_window_clear_area (widget->window,
|
||||
/* gdk_window_clear_area (widget->window,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
*/
|
||||
xc = widget->allocation.width/2;
|
||||
yc = widget->allocation.height/2;
|
||||
|
||||
/* Draw ticks */
|
||||
upper = dial->adjustment->upper;
|
||||
lower = dial->adjustment->lower;
|
||||
|
||||
for (i=0; i<25; i++)
|
||||
{
|
||||
theta = (i*M_PI/18. - M_PI/6.);
|
||||
s = sin(theta);
|
||||
c = cos(theta);
|
||||
|
||||
tick_length = (i%6 == 0) ? dial->pointer_width : dial->pointer_width/2;
|
||||
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->fg_gc[widget->state],
|
||||
xc + c*(dial->radius - tick_length),
|
||||
yc - s*(dial->radius - tick_length),
|
||||
xc + c*dial->radius,
|
||||
yc - s*dial->radius);
|
||||
}
|
||||
|
||||
/* Draw pointer */
|
||||
|
||||
s = sin(dial->angle);
|
||||
c = cos(dial->angle);
|
||||
/* Erase old pointer */
|
||||
|
||||
s = sin(dial->last_angle);
|
||||
c = cos(dial->last_angle);
|
||||
dial->last_angle = dial->angle;
|
||||
|
||||
points[0].x = xc + s*dial->pointer_width/2;
|
||||
points[0].y = yc + c*dial->pointer_width/2;
|
||||
@@ -329,14 +316,90 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
points[1].y = yc - s*dial->radius;
|
||||
points[2].x = xc - s*dial->pointer_width/2;
|
||||
points[2].y = yc - c*dial->pointer_width/2;
|
||||
points[3].x = xc - c*dial->radius/10;
|
||||
points[3].y = yc + s*dial->radius/10;
|
||||
points[4].x = points[0].x;
|
||||
points[4].y = points[0].y;
|
||||
|
||||
blankstyle = gtk_style_new ();
|
||||
blankstyle->bg_gc[GTK_STATE_NORMAL] =
|
||||
widget->style->bg_gc[GTK_STATE_NORMAL];
|
||||
blankstyle->dark_gc[GTK_STATE_NORMAL] =
|
||||
widget->style->bg_gc[GTK_STATE_NORMAL];
|
||||
blankstyle->light_gc[GTK_STATE_NORMAL] =
|
||||
widget->style->bg_gc[GTK_STATE_NORMAL];
|
||||
blankstyle->black_gc =
|
||||
widget->style->bg_gc[GTK_STATE_NORMAL];
|
||||
|
||||
gtk_draw_polygon (blankstyle,
|
||||
widget->window,
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_OUT,
|
||||
points, 5,
|
||||
FALSE);
|
||||
|
||||
gtk_style_unref(blankstyle);
|
||||
|
||||
|
||||
/* Draw ticks */
|
||||
|
||||
if ((upper - lower) == 0)
|
||||
return;
|
||||
|
||||
increment = (100*M_PI)/(dial->radius*dial->radius);
|
||||
|
||||
inc = (upper - lower);
|
||||
|
||||
while (inc < 100) inc *=10;
|
||||
while (inc >= 1000) inc /=10;
|
||||
last = -1;
|
||||
|
||||
for (i=0; i<=inc; i++)
|
||||
{
|
||||
theta = ((gfloat)i*M_PI/(18*inc/24.) - M_PI/6.);
|
||||
|
||||
if ((theta - last) < (increment))
|
||||
continue;
|
||||
last = theta;
|
||||
|
||||
s = sin(theta);
|
||||
c = cos(theta);
|
||||
|
||||
tick_length = (i%(inc/10) == 0) ? dial->pointer_width : dial->pointer_width/2;
|
||||
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->fg_gc[widget->state],
|
||||
xc + c*(dial->radius - tick_length),
|
||||
yc - s*(dial->radius - tick_length),
|
||||
xc + c*dial->radius,
|
||||
yc - s*dial->radius);
|
||||
}
|
||||
|
||||
/* Draw pointer */
|
||||
|
||||
s = sin(dial->angle);
|
||||
c = cos(dial->angle);
|
||||
dial->last_angle = dial->angle;
|
||||
|
||||
points[0].x = xc + s*dial->pointer_width/2;
|
||||
points[0].y = yc + c*dial->pointer_width/2;
|
||||
points[1].x = xc + c*dial->radius;
|
||||
points[1].y = yc - s*dial->radius;
|
||||
points[2].x = xc - s*dial->pointer_width/2;
|
||||
points[2].y = yc - c*dial->pointer_width/2;
|
||||
points[3].x = xc - c*dial->radius/10;
|
||||
points[3].y = yc + s*dial->radius/10;
|
||||
points[4].x = points[0].x;
|
||||
points[4].y = points[0].y;
|
||||
|
||||
|
||||
gtk_draw_polygon (widget->style,
|
||||
widget->window,
|
||||
GTK_STATE_NORMAL,
|
||||
GTK_SHADOW_OUT,
|
||||
points, 3,
|
||||
points, 5,
|
||||
TRUE);
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@@ -59,6 +59,7 @@ struct _GtkDial
|
||||
|
||||
/* Current angle */
|
||||
gfloat angle;
|
||||
gfloat last_angle;
|
||||
|
||||
/* Old values from adjustment stored so we know when something changes */
|
||||
gfloat old_value;
|
||||
|
@@ -50,7 +50,7 @@ int main( int argc,
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* When the window is given the "delete_event" signal (this is given
|
||||
* by the window manager, usually by the 'close' option, or on the
|
||||
* by the window manager, usually by the "close" option, or on the
|
||||
* titlebar), we ask it to call the delete_event () function
|
||||
* as defined above. The data passed to the callback
|
||||
* function is NULL and is ignored in the callback function. */
|
||||
@@ -59,7 +59,7 @@ int main( int argc,
|
||||
|
||||
/* Here we connect the "destroy" event to a signal handler.
|
||||
* This event occurs when we call gtk_widget_destroy() on the window,
|
||||
* or if we return 'FALSE' in the "delete_event" callback. */
|
||||
* or if we return FALSE in the "delete_event" callback. */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
|
@@ -11,11 +11,12 @@ void callback( GtkWidget *widget,
|
||||
}
|
||||
|
||||
/* another callback */
|
||||
void delete_event( GtkWidget *widget,
|
||||
gint delete_event( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit ();
|
||||
gtk_main_quit();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
int main( int argc,
|
||||
@@ -33,7 +34,7 @@ int main( int argc,
|
||||
/* Create a new window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* This is a new call, this just sets the title of our
|
||||
/* This is a new call, which just sets the title of our
|
||||
* new window to "Hello Buttons!" */
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Hello Buttons!");
|
||||
|
||||
|
@@ -72,7 +72,7 @@ int main( int argc,
|
||||
label = gtk_label_new ("This is an example of a line-wrapped, filled label. " \
|
||||
"It should be taking "\
|
||||
"up the entire width allocated to it. " \
|
||||
"Here is a seneance to prove "\
|
||||
"Here is a sentence to prove "\
|
||||
"my point. Here is another sentence. "\
|
||||
"Here comes the sun, do de do de do.\n"\
|
||||
" This is a new paragraph.\n"\
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* example-start list list.c */
|
||||
|
||||
/* Include the gtk+ header files
|
||||
/* Include the GTK header files
|
||||
* Include stdio.h, we need that for the printf() function
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
@@ -13,7 +13,7 @@ const gchar *list_item_data_key="list_item_data";
|
||||
|
||||
|
||||
/* prototypes for signal handler that we are going to connect
|
||||
* to the GtkList widget
|
||||
* to the List widget
|
||||
*/
|
||||
static void sigh_print_selection( GtkWidget *gtklist,
|
||||
gpointer func_data);
|
||||
@@ -25,8 +25,8 @@ static void sigh_button_event( GtkWidget *gtklist,
|
||||
|
||||
/* Main function to set up the user interface */
|
||||
|
||||
gint main (int argc,
|
||||
gchar *argv[])
|
||||
gint main( int argc,
|
||||
gchar *argv[] )
|
||||
{
|
||||
GtkWidget *separator;
|
||||
GtkWidget *window;
|
||||
@@ -41,7 +41,7 @@ gint main (int argc,
|
||||
gchar buffer[64];
|
||||
|
||||
|
||||
/* Initialize gtk+ (and subsequently gdk) */
|
||||
/* Initialize GTK (and subsequently GDK) */
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
@@ -65,15 +65,15 @@ gint main (int argc,
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
|
||||
/* This is the scrolled window to put the GtkList widget inside */
|
||||
/* This is the scrolled window to put the List widget inside */
|
||||
scrolled_window=gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_widget_set_usize(scrolled_window, 250, 150);
|
||||
gtk_container_add(GTK_CONTAINER(vbox), scrolled_window);
|
||||
gtk_widget_show(scrolled_window);
|
||||
|
||||
/* Create the GtkList widget.
|
||||
/* Create thekList widget.
|
||||
* Connect the sigh_print_selection() signal handler
|
||||
* function to the "selection_changed" signal of the GtkList
|
||||
* function to the "selection_changed" signal of the List
|
||||
* to print out the selected items each time the selection
|
||||
* has changed */
|
||||
gtklist=gtk_list_new();
|
||||
@@ -93,7 +93,7 @@ gint main (int argc,
|
||||
gtk_container_add(GTK_CONTAINER(vbox), frame);
|
||||
gtk_widget_show(frame);
|
||||
|
||||
/* Connect the sigh_button_event() signal handler to the GtkList
|
||||
/* Connect the sigh_button_event() signal handler to the List
|
||||
* which will handle the "arresting" of list items
|
||||
*/
|
||||
gtk_signal_connect(GTK_OBJECT(gtklist),
|
||||
@@ -106,7 +106,7 @@ gint main (int argc,
|
||||
gtk_container_add(GTK_CONTAINER(vbox), separator);
|
||||
gtk_widget_show(separator);
|
||||
|
||||
/* Finally create a button and connect it's "clicked" signal
|
||||
/* Finally create a button and connect its "clicked" signal
|
||||
* to the destruction of the window */
|
||||
button=gtk_button_new_with_label("Close");
|
||||
gtk_container_add(GTK_CONTAINER(vbox), button);
|
||||
@@ -117,8 +117,8 @@ gint main (int argc,
|
||||
GTK_OBJECT(window));
|
||||
|
||||
|
||||
/* Now we create 5 list items, each having it's own
|
||||
* label and add them to the GtkList using gtk_container_add()
|
||||
/* Now we create 5 list items, each having its own
|
||||
* label and add them to the List using gtk_container_add()
|
||||
* Also we query the text string from the label and
|
||||
* associate it with the list_item_data_key for each list item
|
||||
*/
|
||||
@@ -176,7 +176,7 @@ gint main (int argc,
|
||||
}
|
||||
|
||||
/* This is the signal handler that got connected to button
|
||||
* press/release events of the GtkList
|
||||
* press/release events of the List
|
||||
*/
|
||||
void sigh_button_event( GtkWidget *gtklist,
|
||||
GdkEventButton *event,
|
||||
@@ -218,7 +218,7 @@ void sigh_button_event( GtkWidget *gtklist,
|
||||
g_list_free(free_list);
|
||||
|
||||
/* If we have a new prisoner, remove him from the
|
||||
* GtkList and put him into the frame "Prison".
|
||||
* List and put him into the frame "Prison".
|
||||
* We need to unselect the item first.
|
||||
*/
|
||||
if (new_prisoner) {
|
||||
@@ -235,16 +235,16 @@ void sigh_button_event( GtkWidget *gtklist,
|
||||
}
|
||||
}
|
||||
|
||||
/* This is the signal handler that gets called if GtkList
|
||||
/* This is the signal handler that gets called if List
|
||||
* emits the "selection_changed" signal
|
||||
*/
|
||||
void sigh_print_selection( GtkWidget *gtklist,
|
||||
gpointer func_data)
|
||||
gpointer func_data )
|
||||
{
|
||||
GList *dlist;
|
||||
|
||||
/* Fetch the doubly linked list of selected items
|
||||
* of the GtkList, remember to treat this as read-only!
|
||||
* of the List, remember to treat this as read-only!
|
||||
*/
|
||||
dlist=GTK_LIST(gtklist)->selection;
|
||||
|
||||
|
@@ -4,8 +4,10 @@
|
||||
#include <strings.h>
|
||||
|
||||
/* Obligatory basic callback */
|
||||
static void print_hello(GtkWidget *w, gpointer data) {
|
||||
g_message("Hello, World!\n");
|
||||
static void print_hello( GtkWidget *w,
|
||||
gpointer data )
|
||||
{
|
||||
g_message ("Hello, World!\n");
|
||||
}
|
||||
|
||||
/* This is the GtkItemFactoryEntry structure used to generate new menus.
|
||||
@@ -27,31 +29,33 @@ static void print_hello(GtkWidget *w, gpointer data) {
|
||||
"<RadioItem>" -> create a radio item
|
||||
<path> -> path of a radio item to link against
|
||||
"<Separator>" -> create a separator
|
||||
"<Branch>" -> create an item to hold sub items
|
||||
"<Branch>" -> create an item to hold sub items (optional)
|
||||
"<LastBranch>" -> create a right justified branch
|
||||
*/
|
||||
|
||||
static GtkItemFactoryEntry menu_items[] = {
|
||||
{"/_File", NULL, NULL, 0, "<Branch>"},
|
||||
{"/File/_New", "<control>N", print_hello, 0, NULL},
|
||||
{"/File/_Open", "<control>O", print_hello, 0, NULL},
|
||||
{"/File/_Save", "<control>S", print_hello, 0, NULL},
|
||||
{"/File/Save _As", NULL, NULL, 0, NULL},
|
||||
{"/File/sep1", NULL, NULL, 0, "<Separator>"},
|
||||
{"/File/Quit", "<control>Q", gtk_main_quit, 0, NULL},
|
||||
{"/_Options", NULL, NULL, 0, "<Branch>"},
|
||||
{"/Options/Test", NULL, NULL, 0, NULL},
|
||||
{"/_Help", NULL, NULL, 0, "<LastBranch>"},
|
||||
{"/_Help/About", NULL, NULL, 0, NULL},
|
||||
{ "/_File", NULL, NULL, 0, "<Branch>" },
|
||||
{ "/File/_New", "<control>N", print_hello, 0, NULL },
|
||||
{ "/File/_Open", "<control>O", print_hello, 0, NULL },
|
||||
{ "/File/_Save", "<control>S", print_hello, 0, NULL },
|
||||
{ "/File/Save _As", NULL, NULL, 0, NULL },
|
||||
{ "/File/sep1", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/File/Quit", "<control>Q", gtk_main_quit, 0, NULL },
|
||||
{ "/_Options", NULL, NULL, 0, "<Branch>" },
|
||||
{ "/Options/Test", NULL, NULL, 0, NULL },
|
||||
{ "/_Help", NULL, NULL, 0, "<LastBranch>" },
|
||||
{ "/_Help/About", NULL, NULL, 0, NULL },
|
||||
};
|
||||
|
||||
|
||||
void get_main_menu(GtkWidget *window, GtkWidget ** menubar) {
|
||||
int nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]);
|
||||
void get_main_menu( GtkWidget *window,
|
||||
GtkWidget **menubar )
|
||||
{
|
||||
GtkItemFactory *item_factory;
|
||||
GtkAccelGroup *accel_group;
|
||||
gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
|
||||
|
||||
accel_group = gtk_accel_group_new();
|
||||
accel_group = gtk_accel_group_new ();
|
||||
|
||||
/* This function initializes the item factory.
|
||||
Param 1: The type of menu - can be GTK_TYPE_MENU_BAR, GTK_TYPE_MENU,
|
||||
@@ -61,47 +65,49 @@ void get_main_menu(GtkWidget *window, GtkWidget ** menubar) {
|
||||
the accelerator table while generating menus.
|
||||
*/
|
||||
|
||||
item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<main>",
|
||||
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>",
|
||||
accel_group);
|
||||
|
||||
/* This function generates the menu items. Pass the item factory,
|
||||
the number of items in the array, the array itself, and any
|
||||
callback data for the the menu items. */
|
||||
gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL);
|
||||
gtk_item_factory_create_items (item_factory, nmenu_items, menu_items, NULL);
|
||||
|
||||
/* Attach the new accelerator group to the window. */
|
||||
gtk_accel_group_attach (accel_group, GTK_OBJECT (window));
|
||||
gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
|
||||
|
||||
if (menubar)
|
||||
/* Finally, return the actual menu bar created by the item factory. */
|
||||
*menubar = gtk_item_factory_get_widget(item_factory, "<main>");
|
||||
*menubar = gtk_item_factory_get_widget (item_factory, "<main>");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *menubar;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect(GTK_OBJECT(window), "destroy",
|
||||
GTK_SIGNAL_FUNC(gtk_main_quit),
|
||||
"WM destroy");
|
||||
gtk_window_set_title(GTK_WINDOW(window), "Item Factory");
|
||||
gtk_widget_set_usize(GTK_WIDGET(window), 300, 200);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
"WM destroy");
|
||||
gtk_window_set_title (GTK_WINDOW(window), "Item Factory");
|
||||
gtk_widget_set_usize (GTK_WIDGET(window), 300, 200);
|
||||
|
||||
main_vbox = gtk_vbox_new(FALSE, 1);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
|
||||
gtk_container_add(GTK_CONTAINER(window), main_vbox);
|
||||
gtk_widget_show(main_vbox);
|
||||
main_vbox = gtk_vbox_new (FALSE, 1);
|
||||
gtk_container_border_width (GTK_CONTAINER (main_vbox), 1);
|
||||
gtk_container_add (GTK_CONTAINER (window), main_vbox);
|
||||
gtk_widget_show (main_vbox);
|
||||
|
||||
get_main_menu(window, &menubar);
|
||||
gtk_box_pack_start(GTK_BOX(main_vbox), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show(menubar);
|
||||
get_main_menu (window, &menubar);
|
||||
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
gtk_widget_show(window);
|
||||
gtk_main();
|
||||
gtk_widget_show (window);
|
||||
gtk_main ();
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
@@ -5,7 +5,8 @@
|
||||
static gint button_press (GtkWidget *, GdkEvent *);
|
||||
static void menuitem_response (gchar *);
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
|
||||
GtkWidget *window;
|
||||
@@ -21,17 +22,17 @@ int main (int argc, char *argv[])
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* create a new window */
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize( GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title(GTK_WINDOW (window), "GTK Menu Test");
|
||||
gtk_signal_connect(GTK_OBJECT (window), "delete_event",
|
||||
(GtkSignalFunc) gtk_main_quit, NULL);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_usize (GTK_WIDGET (window), 200, 100);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "GTK Menu Test");
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
(GtkSignalFunc) gtk_main_quit, NULL);
|
||||
|
||||
/* Init the menu-widget, and remember -- never
|
||||
* gtk_show_widget() the menu widget!!
|
||||
* This is the menu that holds the menu items, the one that
|
||||
* will pop up when you click on the "Root Menu" in the app */
|
||||
menu = gtk_menu_new();
|
||||
menu = gtk_menu_new ();
|
||||
|
||||
/* Next we make a little loop that makes three menu-entries for "test-menu".
|
||||
* Notice the call to gtk_menu_append. Here we are adding a list of
|
||||
@@ -39,64 +40,64 @@ int main (int argc, char *argv[])
|
||||
* signal on each of the menu items and setup a callback for it,
|
||||
* but it's omitted here to save space. */
|
||||
|
||||
for(i = 0; i < 3; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
/* Copy the names to the buf. */
|
||||
sprintf(buf, "Test-undermenu - %d", i);
|
||||
sprintf (buf, "Test-undermenu - %d", i);
|
||||
|
||||
/* Create a new menu-item with a name... */
|
||||
menu_items = gtk_menu_item_new_with_label(buf);
|
||||
menu_items = gtk_menu_item_new_with_label (buf);
|
||||
|
||||
/* ...and add it to the menu. */
|
||||
gtk_menu_append(GTK_MENU (menu), menu_items);
|
||||
gtk_menu_append (GTK_MENU (menu), menu_items);
|
||||
|
||||
/* Do something interesting when the menuitem is selected */
|
||||
gtk_signal_connect_object(GTK_OBJECT(menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC(menuitem_response), (gpointer) g_strdup(buf));
|
||||
gtk_signal_connect_object (GTK_OBJECT (menu_items), "activate",
|
||||
GTK_SIGNAL_FUNC (menuitem_response), (gpointer) g_strdup (buf));
|
||||
|
||||
/* Show the widget */
|
||||
gtk_widget_show(menu_items);
|
||||
gtk_widget_show (menu_items);
|
||||
}
|
||||
|
||||
/* This is the root menu, and will be the label
|
||||
* displayed on the menu bar. There won't be a signal handler attached,
|
||||
* as it only pops up the rest of the menu when pressed. */
|
||||
root_menu = gtk_menu_item_new_with_label("Root Menu");
|
||||
root_menu = gtk_menu_item_new_with_label ("Root Menu");
|
||||
|
||||
gtk_widget_show(root_menu);
|
||||
gtk_widget_show (root_menu);
|
||||
|
||||
/* Now we specify that we want our newly created "menu" to be the menu
|
||||
* for the "root menu" */
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM (root_menu), menu);
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (root_menu), menu);
|
||||
|
||||
/* A vbox to put a menu and a button in: */
|
||||
vbox = gtk_vbox_new(FALSE, 0);
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show(vbox);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
/* Create a menu-bar to hold the menus and add it to our main window */
|
||||
menu_bar = gtk_menu_bar_new();
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 2);
|
||||
gtk_widget_show(menu_bar);
|
||||
menu_bar = gtk_menu_bar_new ();
|
||||
gtk_box_pack_start (GTK_BOX (vbox), menu_bar, FALSE, FALSE, 2);
|
||||
gtk_widget_show (menu_bar);
|
||||
|
||||
/* Create a button to which to attach menu as a popup */
|
||||
button = gtk_button_new_with_label("press me");
|
||||
gtk_signal_connect_object(GTK_OBJECT(button), "event",
|
||||
GTK_SIGNAL_FUNC (button_press), GTK_OBJECT(menu));
|
||||
gtk_box_pack_end(GTK_BOX(vbox), button, TRUE, TRUE, 2);
|
||||
gtk_widget_show(button);
|
||||
button = gtk_button_new_with_label ("press me");
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "event",
|
||||
GTK_SIGNAL_FUNC (button_press), GTK_OBJECT (menu));
|
||||
gtk_box_pack_end (GTK_BOX (vbox), button, TRUE, TRUE, 2);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* And finally we append the menu-item to the menu-bar -- this is the
|
||||
* "root" menu-item I have been raving about =) */
|
||||
gtk_menu_bar_append(GTK_MENU_BAR (menu_bar), root_menu);
|
||||
gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), root_menu);
|
||||
|
||||
/* always display the window as the last step so it all splashes on
|
||||
* the screen at once. */
|
||||
gtk_widget_show(window);
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* Respond to a button-press by posting a menu passed in as widget.
|
||||
@@ -105,12 +106,13 @@ int main (int argc, char *argv[])
|
||||
* the button that was pressed.
|
||||
*/
|
||||
|
||||
static gint button_press (GtkWidget *widget, GdkEvent *event)
|
||||
static gint button_press( GtkWidget *widget,
|
||||
GdkEvent *event )
|
||||
{
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS) {
|
||||
GdkEventButton *bevent = (GdkEventButton *) event;
|
||||
gtk_menu_popup (GTK_MENU(widget), NULL, NULL, NULL, NULL,
|
||||
gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL,
|
||||
bevent->button, bevent->time);
|
||||
/* Tell calling code that we have handled this event; the buck
|
||||
* stops here. */
|
||||
@@ -124,8 +126,8 @@ static gint button_press (GtkWidget *widget, GdkEvent *event)
|
||||
|
||||
/* Print a string when a menu item is selected */
|
||||
|
||||
static void menuitem_response (gchar *string)
|
||||
static void menuitem_response( gchar *string )
|
||||
{
|
||||
printf("%s\n", string);
|
||||
printf ("%s\n", string);
|
||||
}
|
||||
/* example-end */
|
||||
|
@@ -3,13 +3,15 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* This function rotates the position of the tabs */
|
||||
void rotate_book (GtkButton *button, GtkNotebook *notebook)
|
||||
void rotate_book( GtkButton *button,
|
||||
GtkNotebook *notebook )
|
||||
{
|
||||
gtk_notebook_set_tab_pos (notebook, (notebook->tab_pos +1) %4);
|
||||
}
|
||||
|
||||
/* Add/Remove the page tabs and the borders */
|
||||
void tabsborder_book (GtkButton *button, GtkNotebook *notebook)
|
||||
void tabsborder_book( GtkButton *button,
|
||||
GtkNotebook *notebook )
|
||||
{
|
||||
gint tval = FALSE;
|
||||
gint bval = FALSE;
|
||||
@@ -23,7 +25,8 @@ void tabsborder_book (GtkButton *button, GtkNotebook *notebook)
|
||||
}
|
||||
|
||||
/* Remove a page from the notebook */
|
||||
void remove_book (GtkButton *button, GtkNotebook *notebook)
|
||||
void remove_book( GtkButton *button,
|
||||
GtkNotebook *notebook )
|
||||
{
|
||||
gint page;
|
||||
|
||||
@@ -34,12 +37,16 @@ void remove_book (GtkButton *button, GtkNotebook *notebook)
|
||||
gtk_widget_draw(GTK_WIDGET(notebook), NULL);
|
||||
}
|
||||
|
||||
void delete (GtkWidget *widget, GtkWidget *event, gpointer data)
|
||||
gint delete( GtkWidget *widget,
|
||||
GtkWidget *event,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit ();
|
||||
gtk_main_quit();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
@@ -70,7 +77,7 @@ int main (int argc, char *argv[])
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), notebook, 0,6,0,1);
|
||||
gtk_widget_show(notebook);
|
||||
|
||||
/* Lets append a bunch of pages to the notebook */
|
||||
/* Let's append a bunch of pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Append Frame %d", i+1);
|
||||
sprintf(bufferl, "Page %d", i+1);
|
||||
@@ -88,7 +95,7 @@ int main (int argc, char *argv[])
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame, label);
|
||||
}
|
||||
|
||||
/* Now lets add a page to a specific spot */
|
||||
/* Now let's add a page to a specific spot */
|
||||
checkbutton = gtk_check_button_new_with_label ("Check me please!");
|
||||
gtk_widget_set_usize(checkbutton, 100, 75);
|
||||
gtk_widget_show (checkbutton);
|
||||
@@ -96,7 +103,7 @@ int main (int argc, char *argv[])
|
||||
label = gtk_label_new ("Add page");
|
||||
gtk_notebook_insert_page (GTK_NOTEBOOK (notebook), checkbutton, label, 2);
|
||||
|
||||
/* Now finally lets prepend pages to the notebook */
|
||||
/* Now finally let's prepend pages to the notebook */
|
||||
for (i=0; i < 5; i++) {
|
||||
sprintf(bufferf, "Prepend Frame %d", i+1);
|
||||
sprintf(bufferl, "PPage %d", i+1);
|
||||
@@ -140,7 +147,8 @@ int main (int argc, char *argv[])
|
||||
|
||||
button = gtk_button_new_with_label ("tab position");
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) rotate_book, GTK_OBJECT(notebook));
|
||||
(GtkSignalFunc) rotate_book,
|
||||
GTK_OBJECT(notebook));
|
||||
gtk_table_attach_defaults(GTK_TABLE(table), button, 3,4,1,2);
|
||||
gtk_widget_show(button);
|
||||
|
||||
|
@@ -1,13 +1,15 @@
|
||||
/* example-start packbox packbox.c */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "gtk/gtk.h"
|
||||
|
||||
void delete_event( GtkWidget *widget,
|
||||
gint delete_event( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit ();
|
||||
gtk_main_quit();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/* Make a new hbox filled with button-labels. Arguments for the
|
||||
@@ -82,7 +84,7 @@ int main( int argc,
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf (stderr, "usage: packbox num, where num is 1, 2, or 3.\n");
|
||||
/* this just does cleanup in GTK, and exits with an exit status of 1. */
|
||||
/* This just does cleanup in GTK and exits with an exit status of 1. */
|
||||
gtk_exit (1);
|
||||
}
|
||||
|
||||
@@ -91,8 +93,8 @@ int main( int argc,
|
||||
/* Create our window */
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
/* You should always remember to connect the destroy signal to the
|
||||
* main window. This is very important for proper intuitive
|
||||
/* You should always remember to connect the delete_event signal
|
||||
* to the main window. This is very important for proper intuitive
|
||||
* behavior */
|
||||
gtk_signal_connect (GTK_OBJECT (window), "delete_event",
|
||||
GTK_SIGNAL_FUNC (delete_event), NULL);
|
||||
@@ -128,7 +130,7 @@ int main( int argc,
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* Call our make box function - homogeneous = FALSE, spacing = 0,
|
||||
* expand = FALSE, fill = FALSE, padding = 0 */
|
||||
* expand = TRUE, fill = FALSE, padding = 0 */
|
||||
box2 = make_box (FALSE, 0, TRUE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, FALSE, 0);
|
||||
gtk_widget_show (box2);
|
||||
@@ -142,8 +144,8 @@ int main( int argc,
|
||||
* but they are quite simple. */
|
||||
separator = gtk_hseparator_new ();
|
||||
|
||||
/* Cack the separator into the vbox. Remember each of these
|
||||
* widgets are being packed into a vbox, so they'll be stacked
|
||||
/* Pack the separator into the vbox. Remember each of these
|
||||
* widgets is being packed into a vbox, so they'll be stacked
|
||||
* vertically. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
@@ -166,7 +168,8 @@ int main( int argc,
|
||||
|
||||
/* Another new separator. */
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
/* The last 3 arguments to gtk_box_pack_start are:
|
||||
* expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
@@ -192,7 +195,8 @@ int main( int argc,
|
||||
gtk_widget_show (box2);
|
||||
|
||||
separator = gtk_hseparator_new ();
|
||||
/* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
/* The last 3 arguments to gtk_box_pack_start are:
|
||||
* expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 5);
|
||||
gtk_widget_show (separator);
|
||||
|
||||
@@ -255,14 +259,13 @@ int main( int argc,
|
||||
/* Our quit button. */
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
|
||||
/* Setup the signal to destroy the window. Remember that this will send
|
||||
* the "destroy" signal to the window which will be caught by our signal
|
||||
* handler as defined above. */
|
||||
/* Setup the signal to terminate the program when the button is clicked */
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit),
|
||||
GTK_OBJECT (window));
|
||||
/* Pack the button into the quitbox.
|
||||
* The last 3 arguments to gtk_box_pack_start are: expand, fill, padding. */
|
||||
* The last 3 arguments to gtk_box_pack_start are:
|
||||
* expand, fill, padding. */
|
||||
gtk_box_pack_start (GTK_BOX (quitbox), button, TRUE, FALSE, 0);
|
||||
/* pack the quitbox into the vbox (box1) */
|
||||
gtk_box_pack_start (GTK_BOX (box1), quitbox, FALSE, FALSE, 0);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
CC = gcc
|
||||
|
||||
packer: pack.c
|
||||
$(CC) `gtk-config --cflags` pack.c -o packer `gtk-config --libs`
|
||||
$(CC) -g `gtk-config --cflags` pack.c -o packer `gtk-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f *.o packer
|
||||
|
@@ -81,7 +81,7 @@ main (int argv, char **argc)
|
||||
|
||||
info = g_malloc(sizeof(Info));
|
||||
|
||||
window = gtk_window_new(GTK_TOPLEVEL);
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (destroy), NULL);
|
||||
|
||||
|
@@ -3,8 +3,7 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Create the list of "messages" */
|
||||
GtkWidget *
|
||||
create_list (void)
|
||||
GtkWidget *create_list( void )
|
||||
{
|
||||
|
||||
GtkWidget *scrolled_window;
|
||||
@@ -22,8 +21,8 @@ create_list (void)
|
||||
|
||||
/* Create a new list and put it in the scrolled window */
|
||||
list = gtk_list_new ();
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
list);
|
||||
gtk_scrolled_window_add_with_viewport (
|
||||
GTK_SCROLLED_WINDOW (scrolled_window), list);
|
||||
gtk_widget_show (list);
|
||||
|
||||
/* Add some messages to the window */
|
||||
@@ -44,8 +43,8 @@ when our window is realized. We could also force our window to be
|
||||
realized with gtk_widget_realize, but it would have to be part of
|
||||
a hierarchy first */
|
||||
|
||||
void
|
||||
realize_text (GtkWidget *text, gpointer data)
|
||||
void realize_text( GtkWidget *text,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_text_freeze (GTK_TEXT (text));
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
|
||||
@@ -62,8 +61,7 @@ realize_text (GtkWidget *text, gpointer data)
|
||||
}
|
||||
|
||||
/* Create a scrolled text area that displays a "message" */
|
||||
GtkWidget *
|
||||
create_text (void)
|
||||
GtkWidget *create_text( void )
|
||||
{
|
||||
GtkWidget *table;
|
||||
GtkWidget *text;
|
||||
@@ -100,8 +98,8 @@ create_text (void)
|
||||
return table;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *vpaned;
|
||||
|
@@ -29,18 +29,24 @@ static const char * xpm_data[] = {
|
||||
|
||||
/* when invoked (via signal delete_event), terminates the application.
|
||||
*/
|
||||
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) {
|
||||
gint close_application( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
/* is invoked when the button is clicked. It just prints a message.
|
||||
*/
|
||||
void button_clicked( GtkWidget *widget, gpointer data ) {
|
||||
printf( "button clicked\n" );
|
||||
void button_clicked( GtkWidget *widget,
|
||||
gpointer data ) {
|
||||
g_print( "button clicked\n" );
|
||||
}
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window, *pixmapwid, *button;
|
||||
|
@@ -115,7 +115,7 @@ int main( int argc,
|
||||
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, FALSE, 5);
|
||||
gtk_widget_show(align);
|
||||
|
||||
/* Create a GtkAdjusment object to hold the range of the
|
||||
/* Create a Adjusment object to hold the range of the
|
||||
* progress bar */
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (0, 1, 150, 0, 0, 0);
|
||||
|
||||
|
@@ -3,11 +3,12 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
|
||||
void close_application( GtkWidget *widget,
|
||||
gint close_application( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
int main( int argc,
|
||||
|
@@ -102,7 +102,7 @@ void create_range_controls( void )
|
||||
gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
/* calue, lower, upper, step_increment, page_increment, page_size */
|
||||
/* value, lower, upper, step_increment, page_increment, page_size */
|
||||
/* Note that the page_size value only makes a difference for
|
||||
* scrollbar widgets, and the highest value you'll get is actually
|
||||
* (upper - page_size). */
|
||||
@@ -218,7 +218,7 @@ void create_range_controls( void )
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
|
||||
/* A GtkHScale widget for adjusting the number of digits on the
|
||||
/* An HScale widget for adjusting the number of digits on the
|
||||
* sample scales. */
|
||||
label = gtk_label_new ("Scale Digits:");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
@@ -238,7 +238,7 @@ void create_range_controls( void )
|
||||
box2 = gtk_hbox_new (FALSE, 10);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
|
||||
|
||||
/* And, one last GtkHScale widget for adjusting the page size of the
|
||||
/* And, one last HScale widget for adjusting the page size of the
|
||||
* scrollbar. */
|
||||
label = gtk_label_new ("Scrollbar Page Size:");
|
||||
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0);
|
||||
|
@@ -8,12 +8,17 @@
|
||||
#define YSIZE 400
|
||||
|
||||
/* This routine gets control when the close button is clicked */
|
||||
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) {
|
||||
gint close_application( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
/* The main routine */
|
||||
int main( int argc, char *argv[] ) {
|
||||
int main( int argc,
|
||||
char *argv[] ) {
|
||||
GtkWidget *window, *table, *area, *hrule, *vrule;
|
||||
|
||||
/* Initialize GTK and create the main window */
|
||||
@@ -32,28 +37,33 @@ int main( int argc, char *argv[] ) {
|
||||
gtk_drawing_area_size( (GtkDrawingArea *)area, XSIZE, YSIZE );
|
||||
gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2,
|
||||
GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0 );
|
||||
gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK );
|
||||
gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK );
|
||||
|
||||
/* The horizontal ruler goes on top. As the mouse moves across the drawing area,
|
||||
* a motion_notify_event is passed to the appropriate event handler for the ruler. */
|
||||
/* The horizontal ruler goes on top. As the mouse moves across the
|
||||
* drawing area, a motion_notify_event is passed to the
|
||||
* appropriate event handler for the ruler. */
|
||||
hrule = gtk_hruler_new();
|
||||
gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS );
|
||||
gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 );
|
||||
gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
|
||||
(GtkSignalFunc)EVENT_METHOD(hrule, motion_notify_event),
|
||||
(GtkSignalFunc)EVENT_METHOD(hrule,
|
||||
motion_notify_event),
|
||||
GTK_OBJECT(hrule) );
|
||||
/* GTK_WIDGET_CLASS(GTK_OBJECT(hrule)->klass)->motion_notify_event, */
|
||||
gtk_table_attach( GTK_TABLE(table), hrule, 1, 2, 0, 1,
|
||||
GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0 );
|
||||
|
||||
/* The vertical ruler goes on the left. As the mouse moves across the drawing area,
|
||||
* a motion_notify_event is passed to the appropriate event handler for the ruler. */
|
||||
/* The vertical ruler goes on the left. As the mouse moves across
|
||||
* the drawing area, a motion_notify_event is passed to the
|
||||
* appropriate event handler for the ruler. */
|
||||
vrule = gtk_vruler_new();
|
||||
gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS );
|
||||
gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE );
|
||||
gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
|
||||
(GtkSignalFunc)
|
||||
GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)->motion_notify_event,
|
||||
GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)->
|
||||
motion_notify_event,
|
||||
GTK_OBJECT(vrule) );
|
||||
gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2,
|
||||
GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0 );
|
||||
|
@@ -25,8 +25,8 @@
|
||||
static GdkPixmap *pixmap = NULL;
|
||||
|
||||
/* Create a new backing pixmap of the appropriate size */
|
||||
static gint
|
||||
configure_event (GtkWidget *widget, GdkEventConfigure *event)
|
||||
static gint configure_event( GtkWidget *widget,
|
||||
GdkEventConfigure *event )
|
||||
{
|
||||
if (pixmap)
|
||||
gdk_pixmap_unref(pixmap);
|
||||
@@ -46,8 +46,8 @@ configure_event (GtkWidget *widget, GdkEventConfigure *event)
|
||||
}
|
||||
|
||||
/* Redraw the screen from the backing pixmap */
|
||||
static gint
|
||||
expose_event (GtkWidget *widget, GdkEventExpose *event)
|
||||
static gint expose_event( GtkWidget *widget,
|
||||
GdkEventExpose *event )
|
||||
{
|
||||
gdk_draw_pixmap(widget->window,
|
||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
||||
@@ -60,8 +60,9 @@ expose_event (GtkWidget *widget, GdkEventExpose *event)
|
||||
}
|
||||
|
||||
/* Draw a rectangle on the screen */
|
||||
static void
|
||||
draw_brush (GtkWidget *widget, gdouble x, gdouble y)
|
||||
static void draw_brush( GtkWidget *widget,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GdkRectangle update_rect;
|
||||
|
||||
@@ -77,8 +78,8 @@ draw_brush (GtkWidget *widget, gdouble x, gdouble y)
|
||||
gtk_widget_draw (widget, &update_rect);
|
||||
}
|
||||
|
||||
static gint
|
||||
button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||
static gint button_press_event( GtkWidget *widget,
|
||||
GdkEventButton *event )
|
||||
{
|
||||
if (event->button == 1 && pixmap != NULL)
|
||||
draw_brush (widget, event->x, event->y);
|
||||
@@ -86,8 +87,8 @@ button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
|
||||
static gint motion_notify_event( GtkWidget *widget,
|
||||
GdkEventMotion *event )
|
||||
{
|
||||
int x, y;
|
||||
GdkModifierType state;
|
||||
@@ -107,14 +108,13 @@ motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
quit ()
|
||||
void quit ()
|
||||
{
|
||||
gtk_exit (0);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *drawing_area;
|
||||
|
8
examples/scribble-xinput/Makefile
Normal file
8
examples/scribble-xinput/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
CC = gcc
|
||||
|
||||
scribble-xinput: scribble-xinput.c
|
||||
$(CC) `gtk-config --cflags` scribble-xinput.c -o scribble-xinput `gtk-config --libs`
|
||||
|
||||
clean:
|
||||
rm -f *.o scribble-xinput
|
270
examples/scribble-xinput/scribble-xinput.c
Normal file
270
examples/scribble-xinput/scribble-xinput.c
Normal file
@@ -0,0 +1,270 @@
|
||||
/* example-start scribble-xinput scribble-xinput.c */
|
||||
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Backing pixmap for drawing area */
|
||||
static GdkPixmap *pixmap = NULL;
|
||||
|
||||
/* Create a new backing pixmap of the appropriate size */
|
||||
static gint
|
||||
configure_event (GtkWidget *widget, GdkEventConfigure *event)
|
||||
{
|
||||
if (pixmap)
|
||||
gdk_pixmap_unref(pixmap);
|
||||
|
||||
pixmap = gdk_pixmap_new(widget->window,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height,
|
||||
-1);
|
||||
gdk_draw_rectangle (pixmap,
|
||||
widget->style->white_gc,
|
||||
TRUE,
|
||||
0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Redraw the screen from the backing pixmap */
|
||||
static gint
|
||||
expose_event (GtkWidget *widget, GdkEventExpose *event)
|
||||
{
|
||||
gdk_draw_pixmap(widget->window,
|
||||
widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
|
||||
pixmap,
|
||||
event->area.x, event->area.y,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Draw a rectangle on the screen, size depending on pressure,
|
||||
and color on the type of device */
|
||||
static void
|
||||
draw_brush (GtkWidget *widget, GdkInputSource source,
|
||||
gdouble x, gdouble y, gdouble pressure)
|
||||
{
|
||||
GdkGC *gc;
|
||||
GdkRectangle update_rect;
|
||||
|
||||
switch (source)
|
||||
{
|
||||
case GDK_SOURCE_MOUSE:
|
||||
gc = widget->style->dark_gc[GTK_WIDGET_STATE (widget)];
|
||||
break;
|
||||
case GDK_SOURCE_PEN:
|
||||
gc = widget->style->black_gc;
|
||||
break;
|
||||
case GDK_SOURCE_ERASER:
|
||||
gc = widget->style->white_gc;
|
||||
break;
|
||||
default:
|
||||
gc = widget->style->light_gc[GTK_WIDGET_STATE (widget)];
|
||||
}
|
||||
|
||||
update_rect.x = x - 10 * pressure;
|
||||
update_rect.y = y - 10 * pressure;
|
||||
update_rect.width = 20 * pressure;
|
||||
update_rect.height = 20 * pressure;
|
||||
gdk_draw_rectangle (pixmap, gc, TRUE,
|
||||
update_rect.x, update_rect.y,
|
||||
update_rect.width, update_rect.height);
|
||||
gtk_widget_draw (widget, &update_rect);
|
||||
}
|
||||
|
||||
static void
|
||||
print_button_press (guint32 deviceid)
|
||||
{
|
||||
GList *tmp_list;
|
||||
|
||||
/* gdk_input_list_devices returns an internal list, so we shouldn't
|
||||
free it afterwards */
|
||||
tmp_list = gdk_input_list_devices();
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
GdkDeviceInfo *info = (GdkDeviceInfo *)tmp_list->data;
|
||||
|
||||
if (info->deviceid == deviceid)
|
||||
{
|
||||
g_print("Button press on device '%s'\n", info->name);
|
||||
return;
|
||||
}
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
button_press_event (GtkWidget *widget, GdkEventButton *event)
|
||||
{
|
||||
print_button_press (event->deviceid);
|
||||
|
||||
if (event->button == 1 && pixmap != NULL)
|
||||
draw_brush (widget, event->source, event->x, event->y, event->pressure);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gint
|
||||
motion_notify_event (GtkWidget *widget, GdkEventMotion *event)
|
||||
{
|
||||
gdouble x, y;
|
||||
gdouble pressure;
|
||||
GdkModifierType state;
|
||||
|
||||
if (event->is_hint)
|
||||
gdk_input_window_get_pointer (event->window, event->deviceid,
|
||||
&x, &y, &pressure,
|
||||
NULL, NULL, &state);
|
||||
else
|
||||
{
|
||||
x = event->x;
|
||||
y = event->y;
|
||||
pressure = event->pressure;
|
||||
state = event->state;
|
||||
}
|
||||
|
||||
if (state & GDK_BUTTON1_MASK && pixmap != NULL)
|
||||
draw_brush (widget, event->source, x, y, pressure);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
input_dialog_destroy (GtkWidget *w, gpointer data)
|
||||
{
|
||||
*((GtkWidget **)data) = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
create_input_dialog ()
|
||||
{
|
||||
static GtkWidget *inputd = NULL;
|
||||
|
||||
if (!inputd)
|
||||
{
|
||||
inputd = gtk_input_dialog_new();
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT(inputd), "destroy",
|
||||
(GtkSignalFunc)input_dialog_destroy, &inputd);
|
||||
gtk_signal_connect_object (GTK_OBJECT(GTK_INPUT_DIALOG(inputd)->close_button),
|
||||
"clicked",
|
||||
(GtkSignalFunc)gtk_widget_hide,
|
||||
GTK_OBJECT(inputd));
|
||||
gtk_widget_hide ( GTK_INPUT_DIALOG(inputd)->save_button);
|
||||
|
||||
gtk_widget_show (inputd);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GTK_WIDGET_MAPPED(inputd))
|
||||
gtk_widget_show(inputd);
|
||||
else
|
||||
gdk_window_raise(inputd->window);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
quit ()
|
||||
{
|
||||
gtk_exit (0);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *drawing_area;
|
||||
GtkWidget *vbox;
|
||||
|
||||
GtkWidget *button;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_widget_set_name (window, "Test Input");
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (quit), NULL);
|
||||
|
||||
/* Create the drawing area */
|
||||
|
||||
drawing_area = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);
|
||||
|
||||
gtk_widget_show (drawing_area);
|
||||
|
||||
/* Signals used to handle backing pixmap */
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
|
||||
(GtkSignalFunc) expose_event, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
|
||||
(GtkSignalFunc) configure_event, NULL);
|
||||
|
||||
/* Event signals */
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
|
||||
(GtkSignalFunc) motion_notify_event, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
|
||||
(GtkSignalFunc) button_press_event, NULL);
|
||||
|
||||
gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
|
||||
| GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_BUTTON_PRESS_MASK
|
||||
| GDK_POINTER_MOTION_MASK
|
||||
| GDK_POINTER_MOTION_HINT_MASK);
|
||||
|
||||
/* The following call enables tracking and processing of extension
|
||||
events for the drawing area */
|
||||
gtk_widget_set_extension_events (drawing_area, GDK_EXTENSION_EVENTS_CURSOR);
|
||||
|
||||
/* .. And some buttons */
|
||||
button = gtk_button_new_with_label ("Input Dialog");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (create_input_dialog), NULL);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("Quit");
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroy),
|
||||
GTK_OBJECT (window));
|
||||
gtk_widget_show (button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* example-end */
|
@@ -2,12 +2,14 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void destroy(GtkWidget *widget, gpointer data)
|
||||
void destroy( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
static GtkWidget *window;
|
||||
GtkWidget *scrolled_window;
|
||||
@@ -19,9 +21,7 @@ int main (int argc, char *argv[])
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
/* Create a new dialog window for the scrolled window to be
|
||||
* packed into. A dialog is just like a normal window except it has a
|
||||
* vbox and a horizontal separator packed into it. It's just a shortcut
|
||||
* for creating dialogs */
|
||||
* packed into. */
|
||||
window = gtk_dialog_new ();
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
(GtkSignalFunc) destroy, NULL);
|
||||
@@ -54,8 +54,8 @@ int main (int argc, char *argv[])
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
|
||||
|
||||
/* pack the table into the scrolled window */
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
table);
|
||||
gtk_scrolled_window_add_with_viewport (
|
||||
GTK_SCROLLED_WINDOW (scrolled_window), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* this simply creates a grid of toggle buttons on the table
|
||||
|
@@ -2,13 +2,13 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
void selection_received (GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data);
|
||||
void selection_received( GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data );
|
||||
|
||||
/* Signal handler invoked when user clicks on the "Get Targets" button */
|
||||
void
|
||||
get_targets (GtkWidget *widget, gpointer data)
|
||||
void get_targets( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
static GdkAtom targets_atom = GDK_NONE;
|
||||
|
||||
@@ -22,9 +22,9 @@ get_targets (GtkWidget *widget, gpointer data)
|
||||
}
|
||||
|
||||
/* Signal handler called when the selections owner returns the data */
|
||||
void
|
||||
selection_received (GtkWidget *widget, GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
void selection_received( GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data )
|
||||
{
|
||||
GdkAtom *atoms;
|
||||
GList *item_list;
|
||||
@@ -60,8 +60,8 @@ selection_received (GtkWidget *widget, GtkSelectionData *selection_data,
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
|
@@ -4,8 +4,8 @@
|
||||
#include <time.h>
|
||||
|
||||
/* Callback when the user toggles the selection */
|
||||
void
|
||||
selection_toggled (GtkWidget *widget, gint *have_selection)
|
||||
void selection_toggled( GtkWidget *widget,
|
||||
gint *have_selection )
|
||||
{
|
||||
if (GTK_TOGGLE_BUTTON(widget)->active)
|
||||
{
|
||||
@@ -32,9 +32,9 @@ selection_toggled (GtkWidget *widget, gint *have_selection)
|
||||
}
|
||||
|
||||
/* Called when another application claims the selection */
|
||||
gint
|
||||
selection_clear (GtkWidget *widget, GdkEventSelection *event,
|
||||
gint *have_selection)
|
||||
gint selection_clear( GtkWidget *widget,
|
||||
GdkEventSelection *event,
|
||||
gint *have_selection )
|
||||
{
|
||||
*have_selection = FALSE;
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(widget), FALSE);
|
||||
@@ -43,15 +43,16 @@ selection_clear (GtkWidget *widget, GdkEventSelection *event,
|
||||
}
|
||||
|
||||
/* Supplies the current time as the selection. */
|
||||
void
|
||||
selection_handle (GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
gpointer data)
|
||||
void selection_handle( GtkWidget *widget,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time_stamp,
|
||||
gpointer data )
|
||||
{
|
||||
gchar *timestr;
|
||||
time_t current_time;
|
||||
|
||||
current_time = time (NULL);
|
||||
current_time = time(NULL);
|
||||
timestr = asctime (localtime(¤t_time));
|
||||
/* When we return a single string, it should not be null terminated.
|
||||
That will be done for us */
|
||||
@@ -60,11 +61,10 @@ selection_handle (GtkWidget *widget,
|
||||
8, timestr, strlen(timestr));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
GtkWidget *selection_button;
|
||||
|
||||
static int have_selection = FALSE;
|
||||
@@ -91,9 +91,12 @@ main (int argc, char *argv[])
|
||||
gtk_signal_connect (GTK_OBJECT(selection_button), "selection_clear_event",
|
||||
GTK_SIGNAL_FUNC (selection_clear), &have_selection);
|
||||
|
||||
gtk_selection_add_handler (selection_button, GDK_SELECTION_PRIMARY,
|
||||
GDK_SELECTION_TYPE_STRING,
|
||||
selection_handle, NULL);
|
||||
gtk_selection_add_target (selection_button,
|
||||
GDK_SELECTION_PRIMARY,
|
||||
GDK_SELECTION_TYPE_STRING,
|
||||
1);
|
||||
gtk_signal_connect (GTK_OBJECT(selection_button), "selection_get",
|
||||
GTK_SIGNAL_FUNC (selection_handle), &have_selection);
|
||||
|
||||
gtk_widget_show (selection_button);
|
||||
gtk_widget_show (window);
|
||||
|
@@ -5,7 +5,8 @@
|
||||
|
||||
GtkWidget *status_bar;
|
||||
|
||||
void push_item (GtkWidget *widget, gpointer data)
|
||||
void push_item( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
static int count = 1;
|
||||
char buff[20];
|
||||
@@ -16,13 +17,15 @@ void push_item (GtkWidget *widget, gpointer data)
|
||||
return;
|
||||
}
|
||||
|
||||
void pop_item (GtkWidget *widget, gpointer data)
|
||||
void pop_item( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_statusbar_pop( GTK_STATUSBAR(status_bar), GPOINTER_TO_INT(data) );
|
||||
return;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
|
||||
GtkWidget *window;
|
||||
@@ -48,7 +51,8 @@ int main (int argc, char *argv[])
|
||||
gtk_box_pack_start (GTK_BOX (vbox), status_bar, TRUE, TRUE, 0);
|
||||
gtk_widget_show (status_bar);
|
||||
|
||||
context_id = gtk_statusbar_get_context_id( GTK_STATUSBAR(status_bar), "Statusbar example");
|
||||
context_id = gtk_statusbar_get_context_id(
|
||||
GTK_STATUSBAR(status_bar), "Statusbar example");
|
||||
|
||||
button = gtk_button_new_with_label("push item");
|
||||
gtk_signal_connect(GTK_OBJECT(button), "clicked",
|
||||
|
@@ -11,11 +11,12 @@ void callback( GtkWidget *widget,
|
||||
}
|
||||
|
||||
/* This callback quits the program */
|
||||
void delete_event( GtkWidget *widget,
|
||||
gint delete_event( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit ();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
int main( int argc,
|
||||
|
@@ -19,12 +19,14 @@ void text_toggle_word_wrap (GtkWidget *checkbutton,
|
||||
GTK_TOGGLE_BUTTON(checkbutton)->active);
|
||||
}
|
||||
|
||||
void close_application( GtkWidget *widget, gpointer data )
|
||||
void close_application( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *box1;
|
||||
@@ -37,7 +39,7 @@ int main (int argc, char *argv[])
|
||||
GtkWidget *vscrollbar;
|
||||
GtkWidget *text;
|
||||
GdkColormap *cmap;
|
||||
GdkColor colour;
|
||||
GdkColor color;
|
||||
GdkFont *fixed_font;
|
||||
|
||||
FILE *infile;
|
||||
@@ -85,28 +87,29 @@ int main (int argc, char *argv[])
|
||||
GTK_FILL, GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
|
||||
gtk_widget_show (vscrollbar);
|
||||
|
||||
/* Get the system colour map and allocate the colour red */
|
||||
/* Get the system color map and allocate the color red */
|
||||
cmap = gdk_colormap_get_system();
|
||||
colour.red = 0xffff;
|
||||
colour.green = 0;
|
||||
colour.blue = 0;
|
||||
if (!gdk_color_alloc(cmap, &colour)) {
|
||||
g_error("couldn't allocate colour");
|
||||
color.red = 0xffff;
|
||||
color.green = 0;
|
||||
color.blue = 0;
|
||||
if (!gdk_color_alloc(cmap, &color)) {
|
||||
g_error("couldn't allocate color");
|
||||
}
|
||||
|
||||
/* Load a fixed font */
|
||||
fixed_font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-140-*-*-*-*-*-*");
|
||||
|
||||
/* Realizing a widget creates a window for it, ready for us to insert some text */
|
||||
/* Realizing a widget creates a window for it,
|
||||
* ready for us to insert some text */
|
||||
gtk_widget_realize (text);
|
||||
|
||||
/* Freeze the text widget, ready for multiple updates */
|
||||
gtk_text_freeze (GTK_TEXT (text));
|
||||
|
||||
/* Insert some coloured text */
|
||||
/* Insert some colored text */
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
|
||||
"Supports ", -1);
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &colour, NULL,
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &color, NULL,
|
||||
"colored ", -1);
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black, NULL,
|
||||
"text and different ", -1);
|
||||
|
@@ -68,8 +68,10 @@ tictactoe_class_init (TictactoeClass *class)
|
||||
tictactoe_signals[TICTACTOE_SIGNAL] = gtk_signal_new ("tictactoe",
|
||||
GTK_RUN_FIRST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (TictactoeClass, tictactoe),
|
||||
gtk_signal_default_marshaller, GTK_TYPE_NONE, 0);
|
||||
GTK_SIGNAL_OFFSET (TictactoeClass,
|
||||
tictactoe),
|
||||
gtk_signal_default_marshaller,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
|
||||
gtk_object_class_add_signals (object_class, tictactoe_signals, LAST_SIGNAL);
|
||||
|
@@ -3,15 +3,15 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "tictactoe.h"
|
||||
|
||||
void
|
||||
win (GtkWidget *widget, gpointer data)
|
||||
void win( GtkWidget *widget,
|
||||
gpointer data )
|
||||
{
|
||||
g_print ("Yay!\n");
|
||||
tictactoe_clear (TICTACTOE (widget));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *ttt;
|
||||
|
@@ -3,12 +3,13 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* for all the GtkItem:: and GtkTreeItem:: signals */
|
||||
static void cb_itemsignal (GtkWidget *item, gchar *signame)
|
||||
static void cb_itemsignal( GtkWidget *item,
|
||||
gchar *signame )
|
||||
{
|
||||
gchar *name;
|
||||
GtkLabel *label;
|
||||
|
||||
/* It's a GtkBin, so it has one child, which we know to be a
|
||||
/* It's a Bin, so it has one child, which we know to be a
|
||||
label, so get that */
|
||||
label = GTK_LABEL (GTK_BIN (item)->child);
|
||||
/* Get the text of the label */
|
||||
@@ -19,8 +20,9 @@ static void cb_itemsignal (GtkWidget *item, gchar *signame)
|
||||
}
|
||||
|
||||
/* Note that this is never called */
|
||||
static void cb_unselect_child (GtkWidget *root_tree, GtkWidget *child,
|
||||
GtkWidget *subtree)
|
||||
static void cb_unselect_child( GtkWidget *root_tree,
|
||||
GtkWidget *child,
|
||||
GtkWidget *subtree )
|
||||
{
|
||||
g_print ("unselect_child called for root tree %p, subtree %p, child %p\n",
|
||||
root_tree, subtree, child);
|
||||
@@ -35,7 +37,7 @@ static void cb_select_child (GtkWidget *root_tree, GtkWidget *child,
|
||||
root_tree, subtree, child);
|
||||
}
|
||||
|
||||
static void cb_selection_changed (GtkWidget *tree)
|
||||
static void cb_selection_changed( GtkWidget *tree )
|
||||
{
|
||||
GList *i;
|
||||
|
||||
@@ -58,7 +60,8 @@ static void cb_selection_changed (GtkWidget *tree)
|
||||
}
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
GtkWidget *window, *scrolled_win, *tree;
|
||||
static gchar *itemnames[] = {"Foo", "Bar", "Baz", "Quux",
|
||||
|
@@ -120,11 +120,16 @@ static char * WheelbarrowFull_xpm[] = {
|
||||
|
||||
|
||||
/* When invoked (via signal delete_event), terminates the application */
|
||||
void close_application( GtkWidget *widget, GdkEvent *event, gpointer data ) {
|
||||
gint close_application( GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data )
|
||||
{
|
||||
gtk_main_quit();
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
int main (int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
/* GtkWidget is the storage type for widgets */
|
||||
GtkWidget *window, *pixmap, *fixed;
|
||||
|
@@ -1,22 +0,0 @@
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libgdk-pixbuf.la \
|
||||
libpixbuf-png.la
|
||||
|
||||
#
|
||||
# The GdkPixBuf library
|
||||
#
|
||||
libgdk_pixbufincludedir = $(includedir)/gdk-pixbuf
|
||||
|
||||
libgdk_pixbuf_la_SOURCES = \
|
||||
gdk-pixbuf.c \
|
||||
gdk-pixbuf-io.c
|
||||
|
||||
libgdk_pixbufinclude_HEADERS = \
|
||||
gdk-pixbuf.h
|
||||
|
||||
#
|
||||
# The PNG plugin.
|
||||
#
|
||||
libpixbuf_png_la_SOURCES = \
|
||||
io-png.c
|
@@ -1,15 +0,0 @@
|
||||
#ifndef _GDK_PIXBUF_CACHE_H_
|
||||
#define _GDK_PIXBUF_CACHE_H_
|
||||
|
||||
/* The optional cache interface */
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} GdkPixBufCache;
|
||||
|
||||
GdkPixBufCache *gdk_pixbuf_cache_new (long image_cache_limit,
|
||||
long pixmap_bitmap_cache_limit);
|
||||
void gdk_pixbuf_cache_destroy (GdkPixBufCache *cache);
|
||||
|
||||
GdkPixBuf *gdk_pixbuf_cache_load_image (GdkPixBufCache *cache,
|
||||
const char *file);
|
||||
#endif
|
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* gdk-pixbuf-io.c: Code to load images into GdkPixBufs
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza (miguel@gnu.org)
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_png (unsigned char *buffer, int size)
|
||||
{
|
||||
if (size < 28)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] != 0x89 ||
|
||||
buffer [1] != 'P' ||
|
||||
buffer [2] != 'N' ||
|
||||
buffer [3] != 'G' ||
|
||||
buffer [4] != 0x0d ||
|
||||
buffer [5] != 0x0a ||
|
||||
buffer [6] != 0x1a ||
|
||||
buffer [7] != 0x0a)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_jpeg (unsigned char *buffer, int size)
|
||||
{
|
||||
if (size < 10)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] != 0xff || buffer [1] != 0xd8)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_tiff (unsigned char *buffer, int size)
|
||||
{
|
||||
if (size < 10)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] == 'M' && buffer [1] == 'M' && buffer [2] == 0 && buffer [3] == 0x2a)
|
||||
return TRUE;
|
||||
|
||||
if (buffer [0] == 'I' && buffer [1] == 'I' && buffer [2] == 0x2a && buffer [3] == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_gif (unsigned char *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (strncmp (buffer, "GIF8", 4) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_xpm (unsigned char *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (strncmp (buffer, "/* XPM */", 9) == 0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_bmp (unsigned char *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] != 'B' || buffer [1] != 'M')
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pixbuf_check_ppm (unsigned char *buffer, int size)
|
||||
{
|
||||
if (size < 20)
|
||||
return FALSE;
|
||||
|
||||
if (buffer [0] == 'P'){
|
||||
if (buffer [1] == '1' ||
|
||||
buffer [1] == '2' ||
|
||||
buffer [1] == '3' ||
|
||||
buffer [1] == '4' ||
|
||||
buffer [1] == '5' ||
|
||||
buffer [1] == '6')
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static struct {
|
||||
char *module_name;
|
||||
gboolean (*format_check)(unsigned char *buffer, int size);
|
||||
GModule *module;
|
||||
GdkPixBuf *(*load)(FILE *f)
|
||||
int (*save)(char *filename, ...);
|
||||
} file_formats [] = {
|
||||
{ "png", pixbuf_check_png, NULL, NULL, NULL },
|
||||
{ "jpeg", pixbuf_check_jpeg, NULL, NULL, NULL },
|
||||
{ "tiff", pixbuf_check_tiff, NULL, NULL, NULL },
|
||||
{ "gif", pixbuf_check_gif, NULL, NULL, NULL },
|
||||
{ "xpm", pixbuf_check_xpm, NULL, NULL, NULL }
|
||||
{ "bmp", pixbuf_check_bmp, NULL, NULL, NULL },
|
||||
{ "ppm", pixbuf_check_ppm, NULL, NULL, NULL },
|
||||
{ NULL, NULL, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static int
|
||||
image_file_format (const char *file)
|
||||
{
|
||||
FILE *f = fopen (file);
|
||||
|
||||
if (!f)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void
|
||||
image_handler_load (int idx)
|
||||
{
|
||||
char *module_name = g_strconcat ("pixbuf-", file_formats [idx].module_name, NULL);
|
||||
char *path;
|
||||
GModule *module;
|
||||
void *load_sym, *save_sym;
|
||||
|
||||
path = g_module_build_path (PIXBUF_LIBDIR, module_name);
|
||||
g_free (module_name);
|
||||
|
||||
module = g_module_open (path, G_MODULE_BIND_LAZY);
|
||||
if (!module)
|
||||
return;
|
||||
|
||||
file_formats [idx].module = module;
|
||||
|
||||
if (g_module_symbol (module, "image_load", &load_sym))
|
||||
file_formats [idx].load = load_sym;
|
||||
|
||||
if (g_module_symbol (module, "image_save", &save_sym))
|
||||
file_formats [idx].save = save_sym;
|
||||
}
|
||||
|
||||
GdkPixBuf *
|
||||
gdk_pixbuf_load_image (const char *file)
|
||||
{
|
||||
GdkPixBuf *pixbuf;
|
||||
FormatLoader format_loader;
|
||||
FILE *f;
|
||||
char buffer [128];
|
||||
|
||||
f = fopen (file);
|
||||
if (!f)
|
||||
return NULL;
|
||||
n = fread (&buffer, 1, sizeof (buffer), f);
|
||||
|
||||
if (n == 0){
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = 0; file_formats [i].module_name; i++){
|
||||
if ((*file_formats [i].format_check)(buffer, n)){
|
||||
if (!file_formats [i].load)
|
||||
image_handler_load (i);
|
||||
|
||||
if (!file_formats [i].load){
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rewind (f);
|
||||
pixbuf = (*file_formats [i].load)(f);
|
||||
fclose (f);
|
||||
return pixbuf;
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* gdk-pixbuf.c: Resource management.
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza (miguel@gnu.org)
|
||||
*/
|
||||
#include <config.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
|
||||
|
||||
static void
|
||||
gdk_pixbuf_destroy (GdkPixBuf *pixbuf)
|
||||
{
|
||||
art_pixbuf_free (pixbuf->art_pixbuf);
|
||||
g_free (pixbuf);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_pixbuf_ref (GdkPixBuf *pixbuf)
|
||||
{
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
|
||||
pixbuf->ref_count++;
|
||||
}
|
||||
|
||||
void
|
||||
gdk_pixbuf_unref (GdkPixBuf *pixbuf)
|
||||
{
|
||||
g_return_if_fail (pixbuf != NULL);
|
||||
g_return_if_fail (pixbuf->ref_count == 0);
|
||||
|
||||
pixbuf->ref_count--;
|
||||
if (pixbuf->ref_count)
|
||||
gdk_pixbuf_destroy (pixbuf);
|
||||
}
|
||||
|
@@ -1,19 +0,0 @@
|
||||
#ifndef _GDK_PIXBUF_H_
|
||||
#define _GDK_PIXBUF_H_
|
||||
|
||||
#include <libart_lgpl/art_misc.h>
|
||||
#include <libart_lgpl/art_pixbuf.h>
|
||||
|
||||
typedef struct {
|
||||
int ref_count;
|
||||
ArtPixBuf *art_pixbuf;
|
||||
void (*unref_func)(void *gdkpixbuf);
|
||||
} GdkPixBuf;
|
||||
|
||||
GdkPixBuf *gdk_pixbuf_load_image (const char *file);
|
||||
void gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
|
||||
void gdk_pixbuf_ref (GdkPixBuf *pixbuf);
|
||||
void gdk_pixbuf_unref (GdkPixBuf *pixbuf);
|
||||
GdkPixBuf gdk_pixbuf_duplicate (GdkPixBuf *pixbuf);
|
||||
|
||||
#endif /* _GDK_PIXBUF_H_ */
|
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* io-png.c: GdkPixBuf image loader for PNG files.
|
||||
*
|
||||
* Author:
|
||||
* Miguel de Icaza (miguel@gnu.org)
|
||||
*
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include "gdk-pixbuf.h"
|
||||
#include "gdk-pixbuf-io.h"
|
||||
#include <png.h>
|
||||
|
||||
/* Shared library entry point */
|
||||
GdkPixBuf *
|
||||
image_load (FILE *f);
|
||||
{
|
||||
png_structp png;
|
||||
png_infop info_ptr, end_info;
|
||||
int width, height, depth, color_type, interlace_type;
|
||||
int have_alpha, number_passes;
|
||||
art_u8 *data;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
|
||||
png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (png)
|
||||
return NULL;
|
||||
|
||||
info_ptr = png_create_info_struct (png);
|
||||
if (!info_ptr){
|
||||
png_destroy_read_struct (&png, NULL, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
end_info = png_create_info_struct (png);
|
||||
if (!end_info){
|
||||
png_destroy_read_struct (&png, &info_ptr, NULL);
|
||||
return NULL:
|
||||
}
|
||||
|
||||
if (setjmp (png->jmpbuf)){
|
||||
png_destroy_read_struct (&png, &info_ptr, &end_info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
png_init_io (pngptr, f);
|
||||
|
||||
png_read_info (png, info_ptr);
|
||||
png_get_IHDR (png, info_ptr, &width, &height, &depth, &color_type, &interlace_type, NULL, NULL);
|
||||
|
||||
if (color_type == color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
png_set_expand (png);
|
||||
|
||||
/*
|
||||
* Strip 16 bit information to 8 bit
|
||||
*/
|
||||
png_set_strip_16 (png);
|
||||
|
||||
/*
|
||||
* Extract multiple pixels with bit depths 1, 2 and 4 from a single
|
||||
* byte into separate bytes
|
||||
*/
|
||||
png_set_packing (png);
|
||||
|
||||
/*
|
||||
* Makes the PNG file to be rendered into RGB or RGBA
|
||||
* modes (no matter of the bit depth nor the image
|
||||
* mode
|
||||
*/
|
||||
png_set_expand (png);
|
||||
|
||||
/*
|
||||
* Simplify loading by always having 4 bytes
|
||||
*/
|
||||
png_set_filler (png, 0xff, PNG_FILLER_AFTER);
|
||||
|
||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
||||
have_alpha = 1
|
||||
else
|
||||
have_alpha = 0;
|
||||
|
||||
data = art_alloc (width * height * (3 + have_alpha));
|
||||
if (!data){
|
||||
png_destroy_read_struct (&png, &info_ptr, &end_info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
number_passes = png_set_interlace_handling (png);
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
#ifndef _GDK_PIXBUF_H_
|
||||
#define _GDK_PIXBUF_H_
|
||||
|
||||
#include <libart_lgpl/art_pixbuf.h>
|
||||
|
||||
typedef struct {
|
||||
int ref_count;
|
||||
ArtPixBuf *pixbuf;
|
||||
void (*unref_func)(void *gdkpixbuf);
|
||||
} GdkPixBuf;
|
||||
|
||||
GdkPixBuf *gdk_pixbuf_load_image (const char *file);
|
||||
void gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
|
||||
void gdk_pixbuf_ref (GdkPixBuf *pixbuf);
|
||||
void gdk_pixbuf_unref (GdkPixBuf *pixbuf);
|
||||
GdkPixBuf gdk_pixbuf_duplicate (GdkPixBuf *pixbuf);
|
||||
|
||||
#endif /* _GDK_PIXBUF_H_ */
|
504
gdk/COPYING
Normal file
504
gdk/COPYING
Normal file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
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.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
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
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
108
gdk/Makefile.am
108
gdk/Makefile.am
@@ -1,19 +1,47 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
## Makefile.am for gtk+/gdk
|
||||
|
||||
gdkincludedir = $(includedir)/gdk
|
||||
|
||||
lib_LTLIBRARIES = libgdk.la
|
||||
|
||||
INCLUDES = \
|
||||
INCLUDES = @STRIP_BEGIN@ \
|
||||
-DG_LOG_DOMAIN=\"Gdk\" \
|
||||
-I$(top_srcdir) \
|
||||
@GTK_DEBUG_FLAGS@ \
|
||||
@GTK_XIM_FLAGS@ \
|
||||
@GTK_LOCALE_FLAGS@ \
|
||||
@GLIB_CFLAGS@ \
|
||||
@x_cflags@
|
||||
@x_cflags@ \
|
||||
@STRIP_END@
|
||||
|
||||
libgdk_la_SOURCES = \
|
||||
#
|
||||
# libraries to compile and install
|
||||
#
|
||||
lib_LTLIBRARIES = libgdk.la
|
||||
|
||||
# libtool stuff: set version and export symbols for resolving
|
||||
libgdkincludedir = $(includedir)/gdk
|
||||
libgdk_la_LDFLAGS = @STRIP_BEGIN@ \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
|
||||
-release $(LT_RELEASE) \
|
||||
-export-dynamic \
|
||||
@GLIB_DEPLIBS@ \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
-lm \
|
||||
@STRIP_END@
|
||||
|
||||
#
|
||||
# setup source file variables
|
||||
#
|
||||
# GDK header files for public installation (non-generated)
|
||||
gdk_public_h_sources = @STRIP_BEGIN@ \
|
||||
gdk.h \
|
||||
gdkcursors.h \
|
||||
gdkrgb.h \
|
||||
gdki18n.h \
|
||||
gdkkeysyms.h \
|
||||
gdkprivate.h \
|
||||
gdktypes.h \
|
||||
gdkx.h \
|
||||
@STRIP_END@
|
||||
gdk_c_sources = @STRIP_BEGIN@ \
|
||||
gdk.c \
|
||||
gdkcc.c \
|
||||
gdkcolor.c \
|
||||
@@ -44,42 +72,23 @@ libgdk_la_SOURCES = \
|
||||
MwmUtil.h \
|
||||
gxid_lib.h \
|
||||
gxid_proto.h \
|
||||
gxid_lib.c
|
||||
## this last one is ifdef'd out unless XINPUT_GXI is defined
|
||||
## It's easier than trying to get automake to handle compiling
|
||||
## it conditionally
|
||||
gxid_lib.c \
|
||||
@STRIP_END@
|
||||
|
||||
gdkinclude_HEADERS = \
|
||||
gdk.h \
|
||||
gdkcursors.h \
|
||||
gdkrgb.h \
|
||||
gdki18n.h \
|
||||
gdkkeysyms.h \
|
||||
gdkprivate.h \
|
||||
gdktypes.h \
|
||||
gdkx.h
|
||||
|
||||
LDADDS = \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
@GLIB_LIBS@ \
|
||||
-lm
|
||||
|
||||
libgdk_la_LDFLAGS = \
|
||||
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -release $(LT_RELEASE) \
|
||||
@GLIB_DEPLIBS@ \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
-lm
|
||||
|
||||
EXTRA_PROGRAMS = gxid
|
||||
|
||||
bin_PROGRAMS = @xinput_progs@
|
||||
|
||||
gxid_SOURCES = gxid.c
|
||||
|
||||
gxid_LDADD = $(LDADDS)
|
||||
#
|
||||
# setup GDK sources and their dependancies
|
||||
#
|
||||
libgdkinclude_HEADERS = $(gdk_public_h_sources)
|
||||
libgdk_la_SOURCES = $(gdk_c_sources)
|
||||
MAINTAINERCLEANFILES +=
|
||||
EXTRA_HEADERS +=
|
||||
EXTRA_DIST +=
|
||||
EXTRA_DIST +=
|
||||
|
||||
#
|
||||
# rules to generate built sources
|
||||
#
|
||||
# we only need to remake these headers once a new X version is released
|
||||
X-derived-headers:
|
||||
sed -e 's/^#define[ ]*XC\([^ ]*\)[ ]*\([^ ]*\)[ ]*.*$$/GDK\1 = \2,/' \
|
||||
-e 'tb' -e 'd' -e ':b' \
|
||||
@@ -89,6 +98,21 @@ X-derived-headers:
|
||||
-e 'tb' -e 'd' -e ':b' -e 's/ 0X/ 0x/' \
|
||||
< @x_includes@/X11/keysymdef.h > gdkkeysyms.h
|
||||
|
||||
#
|
||||
# extra programs
|
||||
#
|
||||
EXTRA_PROGRAMS = gxid
|
||||
bin_PROGRAMS = @xinput_progs@
|
||||
LDADDS = @STRIP_BEGIN@ \
|
||||
@x_ldflags@ \
|
||||
@x_libs@ \
|
||||
@GLIB_LIBS@ \
|
||||
-lm \
|
||||
@STRIP_END@
|
||||
gxid_SOURCES = gxid.c
|
||||
gxid_LDADD = $(LDADDS)
|
||||
|
||||
|
||||
.PHONY: files
|
||||
|
||||
files:
|
||||
|
81
gdk/gdk.c
81
gdk/gdk.c
@@ -31,6 +31,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
@@ -41,13 +42,13 @@
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xmu/WinUtil.h>
|
||||
#include <X11/cursorfont.h>
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkinput.h"
|
||||
#include "gdkx.h"
|
||||
#include "gdki18n.h"
|
||||
#include "gdkkeysyms.h"
|
||||
|
||||
#ifndef X_GETTIMEOFDAY
|
||||
#define X_GETTIMEOFDAY(tv) gettimeofday (tv, NULL)
|
||||
@@ -333,6 +334,7 @@ gdk_init_check (int *argc,
|
||||
gdk_im_set_best_style (GDK_IM_PREEDIT_POSITION);
|
||||
else if (strcmp ("callbacks", (*argv)[i]) == 0)
|
||||
gdk_im_set_best_style (GDK_IM_PREEDIT_CALLBACKS);
|
||||
(*argv)[i] = NULL;
|
||||
}
|
||||
}
|
||||
else if (strcmp ("--xim-status", (*argv)[i]) == 0)
|
||||
@@ -348,6 +350,7 @@ gdk_init_check (int *argc,
|
||||
gdk_im_set_best_style (GDK_IM_STATUS_AREA);
|
||||
else if (strcmp ("callbacks", (*argv)[i]) == 0)
|
||||
gdk_im_set_best_style (GDK_IM_STATUS_CALLBACKS);
|
||||
(*argv)[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -406,9 +409,9 @@ gdk_init_check (int *argc,
|
||||
g_free(argv_orig[i]);
|
||||
g_free(argv_orig);
|
||||
|
||||
gdk_wm_delete_window = XInternAtom (gdk_display, "WM_DELETE_WINDOW", True);
|
||||
gdk_wm_take_focus = XInternAtom (gdk_display, "WM_TAKE_FOCUS", True);
|
||||
gdk_wm_protocols = XInternAtom (gdk_display, "WM_PROTOCOLS", True);
|
||||
gdk_wm_delete_window = XInternAtom (gdk_display, "WM_DELETE_WINDOW", False);
|
||||
gdk_wm_take_focus = XInternAtom (gdk_display, "WM_TAKE_FOCUS", False);
|
||||
gdk_wm_protocols = XInternAtom (gdk_display, "WM_PROTOCOLS", False);
|
||||
gdk_wm_window_protocols[0] = gdk_wm_delete_window;
|
||||
gdk_wm_window_protocols[1] = gdk_wm_take_focus;
|
||||
gdk_selection_property = XInternAtom (gdk_display, "GDK_SELECTION", False);
|
||||
@@ -476,12 +479,12 @@ gdk_exit (int errorcode)
|
||||
}
|
||||
|
||||
void
|
||||
gdk_set_use_xshm (gint use_xshm)
|
||||
gdk_set_use_xshm (gboolean use_xshm)
|
||||
{
|
||||
gdk_use_xshm = use_xshm;
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_get_use_xshm (void)
|
||||
{
|
||||
return gdk_use_xshm;
|
||||
@@ -731,7 +734,7 @@ gdk_pointer_ungrab (guint32 time)
|
||||
*--------------------------------------------------------------
|
||||
*/
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_pointer_is_grabbed (void)
|
||||
{
|
||||
return gdk_xgrab_window != NULL;
|
||||
@@ -1032,20 +1035,35 @@ static int
|
||||
gdk_x_error (Display *display,
|
||||
XErrorEvent *error)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
if (gdk_error_warnings)
|
||||
if (error->error_code)
|
||||
{
|
||||
XGetErrorText (display, error->error_code, buf, 63);
|
||||
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);
|
||||
if (gdk_error_warnings)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
XGetErrorText (display, error->error_code, buf, 63);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
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);
|
||||
#else /* !G_ENABLE_DEBUG */
|
||||
fprintf (stderr, "Gdk-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);
|
||||
|
||||
exit(1);
|
||||
#endif /* G_ENABLE_DEBUG */
|
||||
}
|
||||
gdk_error_code = error->error_code;
|
||||
}
|
||||
|
||||
gdk_error_code = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1071,8 +1089,27 @@ gdk_x_error (Display *display,
|
||||
static int
|
||||
gdk_x_io_error (Display *display)
|
||||
{
|
||||
g_error ("an x io error occurred");
|
||||
return 0;
|
||||
/* This is basically modelled after the code in XLib. We need
|
||||
* an explicit error handler here, so we can disable our atexit()
|
||||
* which would otherwise cause a nice segfault.
|
||||
* We fprintf(stderr, instead of g_warning() because g_warning()
|
||||
* could possibly be redirected to a dialog
|
||||
*/
|
||||
if (errno == EPIPE)
|
||||
{
|
||||
fprintf (stderr, "Gdk-ERROR **: X connection to %s broken (explicit kill or server shutdown).\n", gdk_display ? DisplayString (gdk_display) : gdk_get_display());
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Gdk-ERROR **: Fatal IO error %d (%s) on X server %s.\n",
|
||||
errno, g_strerror (errno),
|
||||
gdk_display ? DisplayString (gdk_display) : gdk_get_display());
|
||||
}
|
||||
|
||||
/* Disable the atexit shutdown for GDK */
|
||||
gdk_initialized = 0;
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gchar *
|
||||
@@ -1104,7 +1141,7 @@ gdk_error_trap_push (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
node = g_slist_alloc();
|
||||
node = g_slist_alloc ();
|
||||
node->data = g_new (GdkErrorTrap, 1);
|
||||
}
|
||||
|
||||
@@ -1166,7 +1203,7 @@ gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
|
||||
XSync (gdk_display, False);
|
||||
gdk_error_warnings = old_warnings;
|
||||
|
||||
return result && (gdk_error_code != -1);
|
||||
return result && !gdk_error_code;
|
||||
}
|
||||
|
||||
#ifndef HAVE_XCONVERTCASE
|
||||
|
293
gdk/gdk.h
293
gdk/gdk.h
@@ -66,11 +66,11 @@ void gdk_event_handler_set (GdkEventFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
void gdk_set_show_events (gint show_events);
|
||||
void gdk_set_use_xshm (gint use_xshm);
|
||||
void gdk_set_show_events (gboolean show_events);
|
||||
void gdk_set_use_xshm (gboolean use_xshm);
|
||||
|
||||
gint gdk_get_show_events (void);
|
||||
gint gdk_get_use_xshm (void);
|
||||
gboolean gdk_get_show_events (void);
|
||||
gboolean gdk_get_use_xshm (void);
|
||||
gchar* gdk_get_display (void);
|
||||
|
||||
guint32 gdk_time_get (void);
|
||||
@@ -90,20 +90,19 @@ gint gdk_input_add (gint source,
|
||||
gpointer data);
|
||||
void gdk_input_remove (gint tag);
|
||||
|
||||
gint gdk_pointer_grab (GdkWindow * window,
|
||||
gint owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow * confine_to,
|
||||
GdkCursor * cursor,
|
||||
guint32 time);
|
||||
void gdk_pointer_ungrab (guint32 time);
|
||||
gint gdk_pointer_grab (GdkWindow *window,
|
||||
gint owner_events,
|
||||
GdkEventMask event_mask,
|
||||
GdkWindow *confine_to,
|
||||
GdkCursor *cursor,
|
||||
guint32 time);
|
||||
void gdk_pointer_ungrab (guint32 time);
|
||||
gint gdk_keyboard_grab (GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
guint32 time);
|
||||
void gdk_keyboard_ungrab (guint32 time);
|
||||
gboolean gdk_pointer_is_grabbed (void);
|
||||
|
||||
gint gdk_keyboard_grab (GdkWindow * window,
|
||||
gint owner_events,
|
||||
guint32 time);
|
||||
void gdk_keyboard_ungrab (guint32 time);
|
||||
|
||||
gint gdk_pointer_is_grabbed (void);
|
||||
|
||||
gint gdk_screen_width (void);
|
||||
gint gdk_screen_height (void);
|
||||
@@ -300,8 +299,6 @@ void gdk_drag_drop (GdkDragContext *context,
|
||||
void gdk_drag_abort (GdkDragContext *context,
|
||||
guint32 time);
|
||||
|
||||
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
|
||||
|
||||
/* GdkWindow */
|
||||
|
||||
void gdk_window_set_hints (GdkWindow *window,
|
||||
@@ -328,7 +325,7 @@ void gdk_window_set_background (GdkWindow *window,
|
||||
GdkColor *color);
|
||||
void gdk_window_set_back_pixmap (GdkWindow *window,
|
||||
GdkPixmap *pixmap,
|
||||
gint parent_relative);
|
||||
gboolean parent_relative);
|
||||
void gdk_window_set_cursor (GdkWindow *window,
|
||||
GdkCursor *cursor);
|
||||
void gdk_window_set_colormap (GdkWindow *window,
|
||||
@@ -375,7 +372,7 @@ void gdk_window_set_icon (GdkWindow *window,
|
||||
GdkPixmap *pixmap,
|
||||
GdkBitmap *mask);
|
||||
void gdk_window_set_icon_name (GdkWindow *window,
|
||||
gchar *name);
|
||||
const gchar *name);
|
||||
void gdk_window_set_group (GdkWindow *window,
|
||||
GdkWindow *leader);
|
||||
void gdk_window_set_decorations (GdkWindow *window,
|
||||
@@ -444,7 +441,7 @@ void gdk_gc_set_clip_region (GdkGC *gc,
|
||||
void gdk_gc_set_subwindow (GdkGC *gc,
|
||||
GdkSubwindowMode mode);
|
||||
void gdk_gc_set_exposures (GdkGC *gc,
|
||||
gint exposures);
|
||||
gboolean exposures);
|
||||
void gdk_gc_set_line_attributes (GdkGC *gc,
|
||||
gint line_width,
|
||||
GdkLineStyle line_style,
|
||||
@@ -452,7 +449,7 @@ void gdk_gc_set_line_attributes (GdkGC *gc,
|
||||
GdkJoinStyle join_style);
|
||||
void gdk_gc_set_dashes (GdkGC *gc,
|
||||
gint dash_offset,
|
||||
gchar dash_list[],
|
||||
gint8 dash_list[],
|
||||
gint n);
|
||||
void gdk_gc_copy (GdkGC *dst_gc,
|
||||
GdkGC *src_gc);
|
||||
@@ -479,8 +476,8 @@ GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename);
|
||||
GdkPixmap* gdk_pixmap_colormap_create_from_xpm
|
||||
(GdkWindow *window,
|
||||
GdkPixmap* gdk_pixmap_colormap_create_from_xpm (
|
||||
GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
@@ -489,8 +486,8 @@ GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data);
|
||||
GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
|
||||
(GdkWindow *window,
|
||||
GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d (
|
||||
GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
@@ -529,77 +526,76 @@ void gdk_image_destroy (GdkImage *image);
|
||||
|
||||
/* Color
|
||||
*/
|
||||
GdkColormap* gdk_colormap_new (GdkVisual *visual,
|
||||
gint allocate);
|
||||
GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
|
||||
void gdk_colormap_unref (GdkColormap *cmap);
|
||||
GdkColormap* gdk_colormap_new (GdkVisual *visual,
|
||||
gboolean allocate);
|
||||
GdkColormap* gdk_colormap_ref (GdkColormap *cmap);
|
||||
void gdk_colormap_unref (GdkColormap *cmap);
|
||||
|
||||
GdkColormap* gdk_colormap_get_system (void);
|
||||
gint gdk_colormap_get_system_size (void);
|
||||
GdkColormap* gdk_colormap_get_system (void);
|
||||
gint gdk_colormap_get_system_size (void);
|
||||
|
||||
void gdk_colormap_change (GdkColormap *colormap,
|
||||
gint ncolors);
|
||||
void gdk_colormap_change (GdkColormap *colormap,
|
||||
gint ncolors);
|
||||
|
||||
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success);
|
||||
gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
gboolean writeable,
|
||||
gboolean best_match);
|
||||
void gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
|
||||
gint gdk_colormap_alloc_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors,
|
||||
gboolean writeable,
|
||||
gboolean best_match,
|
||||
gboolean *success);
|
||||
gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
GdkColor *color,
|
||||
gboolean writeable,
|
||||
gboolean best_match);
|
||||
void gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
GdkVisual* gdk_colormap_get_visual (GdkColormap *colormap);
|
||||
|
||||
GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
|
||||
|
||||
GdkColor *gdk_color_copy (GdkColor *color);
|
||||
void gdk_color_free (GdkColor *color);
|
||||
GdkColor* gdk_color_copy (const GdkColor *color);
|
||||
void gdk_color_free (GdkColor *color);
|
||||
|
||||
gint gdk_color_parse (const gchar *spec,
|
||||
GdkColor *color);
|
||||
guint gdk_color_hash (const GdkColor *colora,
|
||||
const GdkColor *colorb);
|
||||
gint gdk_color_equal (const GdkColor *colora,
|
||||
const GdkColor *colorb);
|
||||
gboolean gdk_color_parse (const gchar *spec,
|
||||
GdkColor *color);
|
||||
guint gdk_color_hash (const GdkColor *colora,
|
||||
const GdkColor *colorb);
|
||||
gboolean gdk_color_equal (const GdkColor *colora,
|
||||
const GdkColor *colorb);
|
||||
|
||||
|
||||
/* The following functions are deprecated */
|
||||
void gdk_colors_store (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
gint gdk_colors_alloc (GdkColormap *colormap,
|
||||
gint contiguous,
|
||||
gulong *planes,
|
||||
gint nplanes,
|
||||
gulong *pixels,
|
||||
gint npixels);
|
||||
void gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *pixels,
|
||||
gint npixels,
|
||||
gulong planes);
|
||||
gint gdk_color_white (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_black (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gint gdk_color_change (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
void gdk_colors_store (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors);
|
||||
gboolean gdk_colors_alloc (GdkColormap *colormap,
|
||||
gboolean contiguous,
|
||||
gulong *planes,
|
||||
gint nplanes,
|
||||
gulong *pixels,
|
||||
gint npixels);
|
||||
void gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *pixels,
|
||||
gint npixels,
|
||||
gulong planes);
|
||||
gboolean gdk_color_white (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gboolean gdk_color_black (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gboolean gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
gboolean gdk_color_change (GdkColormap *colormap,
|
||||
GdkColor *color);
|
||||
|
||||
|
||||
/* Fonts
|
||||
*/
|
||||
GdkFont* gdk_font_load (const gchar *font_name);
|
||||
GdkFont* gdk_fontset_load (gchar *fontset_name);
|
||||
GdkFont* gdk_fontset_load (const gchar *fontset_name);
|
||||
GdkFont* gdk_font_ref (GdkFont *font);
|
||||
void gdk_font_unref (GdkFont *font);
|
||||
gint gdk_font_id (const GdkFont *font);
|
||||
gint gdk_font_equal (const GdkFont *fonta,
|
||||
gboolean gdk_font_equal (const GdkFont *fonta,
|
||||
const GdkFont *fontb);
|
||||
gint gdk_string_width (GdkFont *font,
|
||||
const gchar *string);
|
||||
@@ -714,15 +710,6 @@ void gdk_draw_pixmap (GdkDrawable *drawable,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_bitmap (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkDrawable *src,
|
||||
gint xsrc,
|
||||
gint ysrc,
|
||||
gint xdest,
|
||||
gint ydest,
|
||||
gint width,
|
||||
gint height);
|
||||
void gdk_draw_image (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
GdkImage *image,
|
||||
@@ -750,7 +737,7 @@ void gdk_draw_lines (GdkDrawable *drawable,
|
||||
|
||||
/* Selections
|
||||
*/
|
||||
gint gdk_selection_owner_set (GdkWindow *owner,
|
||||
gboolean gdk_selection_owner_set (GdkWindow *owner,
|
||||
GdkAtom selection,
|
||||
guint32 time,
|
||||
gint send_event);
|
||||
@@ -759,7 +746,7 @@ void gdk_selection_convert (GdkWindow *requestor,
|
||||
GdkAtom selection,
|
||||
GdkAtom target,
|
||||
guint32 time);
|
||||
gint gdk_selection_property_get (GdkWindow *requestor,
|
||||
gboolean gdk_selection_property_get (GdkWindow *requestor,
|
||||
guchar **data,
|
||||
GdkAtom *prop_type,
|
||||
gint *prop_format);
|
||||
@@ -769,89 +756,87 @@ void gdk_selection_send_notify (guint32 requestor,
|
||||
GdkAtom property,
|
||||
guint32 time);
|
||||
|
||||
gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
|
||||
gint gdk_text_property_to_text_list (GdkAtom encoding, gint format,
|
||||
guchar *text, gint length,
|
||||
gchar ***list);
|
||||
void gdk_free_text_list (gchar **list);
|
||||
gint gdk_string_to_compound_text (gchar *str,
|
||||
gint gdk_string_to_compound_text (const gchar *str,
|
||||
GdkAtom *encoding, gint *format,
|
||||
guchar **ctext, gint *length);
|
||||
void gdk_free_compound_text (guchar *ctext);
|
||||
|
||||
/* Properties
|
||||
*/
|
||||
GdkAtom gdk_atom_intern (const gchar *atom_name,
|
||||
gint only_if_exists);
|
||||
gchar* gdk_atom_name (GdkAtom atom);
|
||||
gint gdk_property_get (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gulong offset,
|
||||
gulong length,
|
||||
gint pdelete,
|
||||
GdkAtom *actual_property_type,
|
||||
gint *actual_format,
|
||||
gint *actual_length,
|
||||
guchar **data);
|
||||
GdkAtom gdk_atom_intern (const gchar *atom_name,
|
||||
gint only_if_exists);
|
||||
gchar* gdk_atom_name (GdkAtom atom);
|
||||
gboolean gdk_property_get (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gulong offset,
|
||||
gulong length,
|
||||
gint pdelete,
|
||||
GdkAtom *actual_property_type,
|
||||
gint *actual_format,
|
||||
gint *actual_length,
|
||||
guchar **data);
|
||||
void gdk_property_change (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gint format,
|
||||
GdkPropMode mode,
|
||||
guchar *data,
|
||||
gint nelements);
|
||||
void gdk_property_delete (GdkWindow *window,
|
||||
GdkAtom property);
|
||||
|
||||
void gdk_property_change (GdkWindow *window,
|
||||
GdkAtom property,
|
||||
GdkAtom type,
|
||||
gint format,
|
||||
GdkPropMode mode,
|
||||
guchar *data,
|
||||
gint nelements);
|
||||
void gdk_property_delete (GdkWindow *window,
|
||||
GdkAtom property);
|
||||
|
||||
|
||||
/* Rectangle utilities
|
||||
*/
|
||||
gint gdk_rectangle_intersect (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest);
|
||||
void gdk_rectangle_union (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest);
|
||||
gboolean gdk_rectangle_intersect (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest);
|
||||
void gdk_rectangle_union (GdkRectangle *src1,
|
||||
GdkRectangle *src2,
|
||||
GdkRectangle *dest);
|
||||
|
||||
/* XInput support
|
||||
*/
|
||||
|
||||
void gdk_input_init (void);
|
||||
void gdk_input_exit (void);
|
||||
GList *gdk_input_list_devices (void);
|
||||
void gdk_input_set_extension_events (GdkWindow *window,
|
||||
gint mask,
|
||||
GdkExtensionMode mode);
|
||||
void gdk_input_set_source (guint32 deviceid,
|
||||
GdkInputSource source);
|
||||
gint gdk_input_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode);
|
||||
void gdk_input_set_axes (guint32 deviceid,
|
||||
GdkAxisUse *axes);
|
||||
void gdk_input_set_key (guint32 deviceid,
|
||||
guint index,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers);
|
||||
void gdk_input_window_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
|
||||
GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
guint32 start,
|
||||
guint32 stop,
|
||||
gint *nevents_return);
|
||||
void gdk_input_init (void);
|
||||
void gdk_input_exit (void);
|
||||
GList * gdk_input_list_devices (void);
|
||||
void gdk_input_set_extension_events (GdkWindow *window,
|
||||
gint mask,
|
||||
GdkExtensionMode mode);
|
||||
void gdk_input_set_source (guint32 deviceid,
|
||||
GdkInputSource source);
|
||||
gboolean gdk_input_set_mode (guint32 deviceid,
|
||||
GdkInputMode mode);
|
||||
void gdk_input_set_axes (guint32 deviceid,
|
||||
GdkAxisUse *axes);
|
||||
void gdk_input_set_key (guint32 deviceid,
|
||||
guint index,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers);
|
||||
void gdk_input_window_get_pointer (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
gdouble *x,
|
||||
gdouble *y,
|
||||
gdouble *pressure,
|
||||
gdouble *xtilt,
|
||||
gdouble *ytilt,
|
||||
GdkModifierType *mask);
|
||||
GdkTimeCoord *gdk_input_motion_events (GdkWindow *window,
|
||||
guint32 deviceid,
|
||||
guint32 start,
|
||||
guint32 stop,
|
||||
gint *nevents_return);
|
||||
|
||||
/* International Input Method Support Functions
|
||||
*/
|
||||
|
||||
gint gdk_im_ready (void);
|
||||
gboolean gdk_im_ready (void);
|
||||
|
||||
void gdk_im_begin (GdkIC *ic,
|
||||
GdkWindow *window);
|
||||
|
50
gdk/gdkcc.c
50
gdk/gdkcc.c
@@ -491,10 +491,11 @@ init_palette (GdkColorContext *cc)
|
||||
|
||||
if (cc->color_hash)
|
||||
{
|
||||
/* XXX: quick-and-dirty way to remove everything */
|
||||
|
||||
g_hash_table_foreach (cc->color_hash,
|
||||
free_hash_entry,
|
||||
NULL);
|
||||
g_hash_table_destroy (cc->color_hash);
|
||||
cc->color_hash = g_hash_table_new (hash_color, compare_colors);
|
||||
cc->color_hash = NULL;
|
||||
}
|
||||
|
||||
cc->palette = NULL;
|
||||
@@ -618,11 +619,6 @@ gdk_color_context_new (GdkVisual *visual,
|
||||
g_message ("gdk_color_context_new: screen depth is %i, no. of colors is %i\n",
|
||||
cc->visual->depth, cc->num_colors));
|
||||
|
||||
/* check if we need to initialize a hash table */
|
||||
|
||||
if ((cc->mode == GDK_CC_MODE_STD_CMAP) || (cc->mode == GDK_CC_MODE_UNDEFINED))
|
||||
cc->color_hash = g_hash_table_new (hash_color, compare_colors);
|
||||
|
||||
return (GdkColorContext *) cc;
|
||||
}
|
||||
|
||||
@@ -677,17 +673,9 @@ gdk_color_context_free (GdkColorContext *cc)
|
||||
gdk_colormap_unref (cc->colormap);
|
||||
|
||||
/* free any palette that has been associated with this GdkColorContext */
|
||||
|
||||
|
||||
init_palette (cc);
|
||||
|
||||
if (cc->color_hash)
|
||||
{
|
||||
g_hash_table_foreach (cc->color_hash,
|
||||
free_hash_entry,
|
||||
NULL);
|
||||
g_hash_table_destroy (cc->color_hash);
|
||||
}
|
||||
|
||||
g_free (cc);
|
||||
}
|
||||
|
||||
@@ -780,13 +768,14 @@ gdk_color_context_get_pixel (GdkColorContext *cc,
|
||||
default:
|
||||
{
|
||||
GdkColor color;
|
||||
GdkColor *result;
|
||||
GdkColor *result = NULL;
|
||||
|
||||
color.red = red;
|
||||
color.green = green;
|
||||
color.blue = blue;
|
||||
|
||||
result = g_hash_table_lookup (cc->color_hash, &color);
|
||||
|
||||
if (cc->color_hash)
|
||||
result = g_hash_table_lookup (cc->color_hash, &color);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -831,6 +820,9 @@ gdk_color_context_get_pixel (GdkColorContext *cc,
|
||||
|
||||
cnew = g_new (GdkColor, 1);
|
||||
*cnew = color;
|
||||
|
||||
if (!cc->color_hash)
|
||||
cc->color_hash = g_hash_table_new (hash_color, compare_colors);
|
||||
g_hash_table_insert (cc->color_hash, cnew, cnew);
|
||||
|
||||
cc->clut[cc->num_allocated] = color.pixel;
|
||||
@@ -1489,20 +1481,7 @@ gdk_color_context_add_palette (GdkColorContext *cc,
|
||||
/* restore previous mode if we aren't adding a new palette */
|
||||
|
||||
if (num_palette == 0)
|
||||
{
|
||||
/* GDK_CC_MODE_STD_CMAP uses a hash table, so we'd better initialize one */
|
||||
|
||||
/* XXX: here, the hash table is already initialized */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialize a hash table for this palette (we need one for allocating
|
||||
* the pixels in the palette using the current settings)
|
||||
*/
|
||||
|
||||
if (cc->color_hash == NULL)
|
||||
cc->color_hash = g_hash_table_new (hash_color, compare_colors);
|
||||
return 0;
|
||||
|
||||
/* copy incoming palette */
|
||||
|
||||
@@ -1549,6 +1528,9 @@ gdk_color_context_add_palette (GdkColorContext *cc,
|
||||
|
||||
if (cc->color_hash)
|
||||
{
|
||||
g_hash_table_foreach (cc->color_hash,
|
||||
free_hash_entry,
|
||||
NULL);
|
||||
g_hash_table_destroy (cc->color_hash);
|
||||
cc->color_hash = NULL;
|
||||
}
|
||||
|
214
gdk/gdkcolor.c
214
gdk/gdkcolor.c
@@ -46,7 +46,7 @@ static GHashTable *colormap_hash = NULL;
|
||||
|
||||
GdkColormap*
|
||||
gdk_colormap_new (GdkVisual *visual,
|
||||
gint private_cmap)
|
||||
gboolean private_cmap)
|
||||
{
|
||||
GdkColormap *colormap;
|
||||
GdkColormapPrivate *private;
|
||||
@@ -70,7 +70,7 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
xvisual = ((GdkVisualPrivate*) visual)->xvisual;
|
||||
|
||||
colormap->size = visual->colormap_size;
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
colormap->colors = NULL;
|
||||
|
||||
switch (visual->type)
|
||||
{
|
||||
@@ -117,6 +117,7 @@ gdk_colormap_new (GdkVisual *visual,
|
||||
private->private_val = TRUE;
|
||||
private->xcolormap = XCreateColormap (private->xdisplay, gdk_root_window,
|
||||
xvisual, AllocAll);
|
||||
colormap->colors = g_new (GdkColor, colormap->size);
|
||||
|
||||
size = 1 << visual->red_prec;
|
||||
for (i = 0; i < size; i++)
|
||||
@@ -403,7 +404,7 @@ gdk_colors_store (GdkColormap *colormap,
|
||||
|
||||
gboolean
|
||||
gdk_colors_alloc (GdkColormap *colormap,
|
||||
gint contiguous,
|
||||
gboolean contiguous,
|
||||
gulong *planes,
|
||||
gint nplanes,
|
||||
gulong *pixels,
|
||||
@@ -429,56 +430,7 @@ gdk_colors_alloc (GdkColormap *colormap,
|
||||
}
|
||||
}
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colormap_free_colors.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *in_pixels,
|
||||
gint in_npixels,
|
||||
gulong planes)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (in_pixels != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, in_npixels);
|
||||
|
||||
for (i=0; i<in_npixels; i++)
|
||||
{
|
||||
gulong pixel = in_pixels[i];
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colormap->colors[in_pixels[i]]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, planes);
|
||||
g_free (pixels);
|
||||
return return_val != 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -499,7 +451,7 @@ gdk_colors_free (GdkColormap *colormap,
|
||||
static GMemChunk *color_chunk;
|
||||
|
||||
GdkColor*
|
||||
gdk_color_copy (GdkColor *color)
|
||||
gdk_color_copy (const GdkColor *color)
|
||||
{
|
||||
GdkColor *new_color;
|
||||
|
||||
@@ -537,7 +489,7 @@ gdk_color_free (GdkColor *color)
|
||||
g_mem_chunk_free (color_chunk, color);
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_color_white (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
@@ -560,7 +512,7 @@ gdk_color_white (GdkColormap *colormap,
|
||||
return return_val;
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_color_black (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
{
|
||||
@@ -609,6 +561,104 @@ gdk_color_parse (const gchar *spec,
|
||||
return return_val;
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colormap_free_colors.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colors_free (GdkColormap *colormap,
|
||||
gulong *in_pixels,
|
||||
gint in_npixels,
|
||||
gulong planes)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (in_pixels != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, in_npixels);
|
||||
|
||||
for (i=0; i<in_npixels; i++)
|
||||
{
|
||||
gulong pixel = in_pixels[i];
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colormap->colors[pixel]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, planes);
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colors_free.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (colors != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, ncolors);
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
gulong pixel = colors[i].pixel;
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colormap->colors[pixel]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, 0);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
/********************
|
||||
* Color allocation *
|
||||
********************/
|
||||
@@ -649,6 +699,7 @@ gdk_colormap_alloc1 (GdkColormap *colormap,
|
||||
else
|
||||
{
|
||||
colormap->colors[ret->pixel] = *color;
|
||||
colormap->colors[ret->pixel].pixel = ret->pixel;
|
||||
private->info[ret->pixel].ref_count = 1;
|
||||
|
||||
g_hash_table_insert (private->hash,
|
||||
@@ -1026,55 +1077,6 @@ gdk_colormap_alloc_color (GdkColormap *colormap,
|
||||
return success;
|
||||
}
|
||||
|
||||
/* This is almost identical to gdk_colors_free.
|
||||
* Keep them in sync!
|
||||
*/
|
||||
void
|
||||
gdk_colormap_free_colors (GdkColormap *colormap,
|
||||
GdkColor *colors,
|
||||
gint ncolors)
|
||||
{
|
||||
GdkColormapPrivate *private;
|
||||
gulong *pixels;
|
||||
gint npixels = 0;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (colormap != NULL);
|
||||
g_return_if_fail (colors != NULL);
|
||||
|
||||
private = (GdkColormapPrivate*) colormap;
|
||||
|
||||
if ((private->visual->type != GDK_VISUAL_PSEUDO_COLOR) &&
|
||||
(private->visual->type != GDK_VISUAL_GRAYSCALE))
|
||||
return;
|
||||
|
||||
pixels = g_new (gulong, ncolors);
|
||||
|
||||
for (i=0; i<ncolors; i++)
|
||||
{
|
||||
gulong pixel = colors[i].pixel;
|
||||
|
||||
if (private->info[pixel].ref_count)
|
||||
{
|
||||
private->info[pixel].ref_count--;
|
||||
|
||||
if (private->info[pixel].ref_count == 0)
|
||||
{
|
||||
pixels[npixels++] = pixel;
|
||||
if (!(private->info[pixel].flags & GDK_COLOR_WRITEABLE))
|
||||
g_hash_table_remove (private->hash, &colors[i]);
|
||||
private->info[pixel].flags = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (npixels)
|
||||
XFreeColors (private->xdisplay, private->xcolormap,
|
||||
pixels, npixels, 0);
|
||||
|
||||
g_free (pixels);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_color_alloc (GdkColormap *colormap,
|
||||
GdkColor *color)
|
||||
@@ -1118,7 +1120,7 @@ gdk_color_hash (const GdkColor *colora,
|
||||
(colora->blue >> 6));
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_color_equal (const GdkColor *colora,
|
||||
const GdkColor *colorb)
|
||||
{
|
||||
|
132
gdk/gdkdnd.c
132
gdk/gdkdnd.c
@@ -31,8 +31,6 @@
|
||||
#include "gdk/gdkprivate.h"
|
||||
#include "gdk.h"
|
||||
|
||||
#define NEW_DRAGS
|
||||
|
||||
typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
|
||||
|
||||
typedef enum {
|
||||
@@ -70,7 +68,8 @@ struct _GdkDragContextPrivate {
|
||||
GdkDragAction old_actions; /* The last actions we sent to the source */
|
||||
GdkDragAction xdnd_actions; /* What is currently set in XdndActionList */
|
||||
|
||||
Window dest_xid;
|
||||
Window dest_xid; /* The last window we looked up */
|
||||
Window drop_xid; /* The (non-proxied) window that is receiving drops */
|
||||
guint xdnd_targets_set : 1; /* Whether we've already set XdndTypeList */
|
||||
guint xdnd_actions_set : 1; /* Whether we've already set XdndActionList */
|
||||
guint xdnd_have_actions : 1; /* Whether an XdndActionList was provided */
|
||||
@@ -151,6 +150,7 @@ gdk_drag_context_unref (GdkDragContext *context)
|
||||
GdkDragContextPrivate *private = (GdkDragContextPrivate *)context;
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
g_return_if_fail (private->ref_count > 0);
|
||||
|
||||
private->ref_count--;
|
||||
|
||||
@@ -196,8 +196,8 @@ gdk_drag_context_find (gboolean is_source,
|
||||
private = (GdkDragContextPrivate *)context;
|
||||
|
||||
context_dest_xid = context->dest_window ?
|
||||
(private->dest_xid ?
|
||||
private->dest_xid :
|
||||
(private->drop_xid ?
|
||||
private->drop_xid :
|
||||
GDK_WINDOW_XWINDOW (context->dest_window)) :
|
||||
None;
|
||||
|
||||
@@ -387,7 +387,7 @@ gdk_window_cache_new (void)
|
||||
xwa.x, xwa.y, xwa.width, xwa.height,
|
||||
xwa.map_state != IsUnmapped);
|
||||
|
||||
if (gdk_error_code != 0)
|
||||
if (gdk_error_code)
|
||||
gdk_error_code = 0;
|
||||
else
|
||||
{
|
||||
@@ -441,9 +441,10 @@ get_client_window_at_coords_recurse (Window win,
|
||||
wm_state_atom, 0, 0, False, AnyPropertyType,
|
||||
&type, &format, &nitems, &after, &data);
|
||||
|
||||
if (gdk_error_code != 0)
|
||||
if (gdk_error_code)
|
||||
{
|
||||
gdk_error_code = 0;
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -458,9 +459,10 @@ get_client_window_at_coords_recurse (Window win,
|
||||
XTranslateCoordinates (gdk_display, gdk_root_window, win,
|
||||
x_root, y_root, &dest_x, &dest_y, &child);
|
||||
|
||||
if (gdk_error_code != 0)
|
||||
if (gdk_error_code)
|
||||
{
|
||||
gdk_error_code = 0;
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -469,7 +471,7 @@ get_client_window_at_coords_recurse (Window win,
|
||||
&root, &tmp_parent, &children, &nchildren) == 0)
|
||||
return 0;
|
||||
|
||||
if (gdk_error_code == 0)
|
||||
if (!gdk_error_code)
|
||||
{
|
||||
for (i = nchildren - 1; (i >= 0) && (child == None); i--)
|
||||
{
|
||||
@@ -477,7 +479,7 @@ get_client_window_at_coords_recurse (Window win,
|
||||
|
||||
XGetWindowAttributes (gdk_display, children[i], &xwa);
|
||||
|
||||
if (gdk_error_code != 0)
|
||||
if (gdk_error_code)
|
||||
gdk_error_code = 0;
|
||||
else if ((xwa.map_state == IsViewable) && (xwa.class == InputOutput) &&
|
||||
(x >= xwa.x) && (x < xwa.x + (gint)xwa.width) &&
|
||||
@@ -566,9 +568,10 @@ get_client_window_at_coords_recurse (Window win,
|
||||
wm_state_atom, 0, 0, False, AnyPropertyType,
|
||||
&type, &format, &nitems, &after, &data);
|
||||
|
||||
if (gdk_error_code != 0)
|
||||
if (gdk_error_code)
|
||||
{
|
||||
gdk_error_code = 0;
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -581,9 +584,10 @@ get_client_window_at_coords_recurse (Window win,
|
||||
XTranslateCoordinates (gdk_display, gdk_root_window, win,
|
||||
x_root, y_root, &dest_x, &dest_y, &child);
|
||||
|
||||
if (gdk_error_code != 0)
|
||||
if (gdk_error_code)
|
||||
{
|
||||
gdk_error_code = 0;
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -620,7 +624,7 @@ get_client_window_at_coords (Window ignore,
|
||||
|
||||
XGetWindowAttributes (gdk_display, children[i], &xwa);
|
||||
|
||||
if (gdk_error_code != 0)
|
||||
if (gdk_error_code)
|
||||
gdk_error_code = 0;
|
||||
else if ((xwa.map_state == IsViewable) &&
|
||||
(x_root >= xwa.x) && (x_root < xwa.x + (gint)xwa.width) &&
|
||||
@@ -869,7 +873,7 @@ motif_find_drag_window (gboolean create)
|
||||
|
||||
Display *display;
|
||||
XSetWindowAttributes attr;
|
||||
display = XOpenDisplay (NULL);
|
||||
display = XOpenDisplay (gdk_display_name);
|
||||
XSetCloseDownMode (display, RetainPermanent);
|
||||
|
||||
XGrabServer (display);
|
||||
@@ -943,6 +947,7 @@ motif_read_target_table (void)
|
||||
guchar *p;
|
||||
gboolean success = FALSE;
|
||||
|
||||
gdk_error_trap_push ();
|
||||
XGetWindowProperty (gdk_display, motif_drag_window,
|
||||
motif_drag_targets_atom,
|
||||
0, (sizeof(MotifTargetTableHeader)+3)/4, FALSE,
|
||||
@@ -950,12 +955,13 @@ motif_read_target_table (void)
|
||||
&type, &format, &nitems, &bytes_after,
|
||||
(guchar **)&header);
|
||||
|
||||
if ((format != 8) || (nitems < sizeof (MotifTargetTableHeader)))
|
||||
if (gdk_error_trap_pop () || (format != 8) || (nitems < sizeof (MotifTargetTableHeader)))
|
||||
goto error;
|
||||
|
||||
header->n_lists = card16_to_host (header->n_lists, header->byte_order);
|
||||
header->total_size = card32_to_host (header->total_size, header->byte_order);
|
||||
|
||||
gdk_error_trap_push ();
|
||||
XGetWindowProperty (gdk_display, motif_drag_window, motif_drag_targets_atom,
|
||||
(sizeof(MotifTargetTableHeader)+3)/4,
|
||||
(header->total_size + 3)/4 - (sizeof(MotifTargetTableHeader) + 3)/4,
|
||||
@@ -963,7 +969,7 @@ motif_read_target_table (void)
|
||||
motif_drag_targets_atom, &type, &format, &nitems,
|
||||
&bytes_after, &target_bytes);
|
||||
|
||||
if ((format != 8) || (bytes_after != 0) ||
|
||||
if (gdk_error_trap_pop () || (format != 8) || (bytes_after != 0) ||
|
||||
(nitems != header->total_size - sizeof(MotifTargetTableHeader)))
|
||||
goto error;
|
||||
|
||||
@@ -1287,29 +1293,33 @@ motif_check_dest (Window win)
|
||||
if (!motif_drag_receiver_info_atom)
|
||||
motif_drag_receiver_info_atom = gdk_atom_intern ("_MOTIF_DRAG_RECEIVER_INFO", FALSE);
|
||||
|
||||
gdk_error_trap_push ();
|
||||
XGetWindowProperty (gdk_display, win,
|
||||
motif_drag_receiver_info_atom,
|
||||
0, (sizeof(*info)+3)/4, False, AnyPropertyType,
|
||||
&type, &format, &nitems, &after,
|
||||
(guchar **)&info);
|
||||
|
||||
if (type != None)
|
||||
{
|
||||
if ((format == 8) && (nitems == sizeof(*info)))
|
||||
{
|
||||
if ((info->protocol_version == 0) &&
|
||||
((info->protocol_style == XmDRAG_PREFER_PREREGISTER) ||
|
||||
(info->protocol_style == XmDRAG_PREFER_DYNAMIC) ||
|
||||
(info->protocol_style == XmDRAG_DYNAMIC)))
|
||||
retval = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_NOTE (DND,
|
||||
g_warning ("Invalid Motif drag receiver property on window %ld\n", win));
|
||||
}
|
||||
|
||||
XFree (info);
|
||||
if (gdk_error_trap_pop() == 0)
|
||||
{
|
||||
if (type != None)
|
||||
{
|
||||
if ((format == 8) && (nitems == sizeof(*info)))
|
||||
{
|
||||
if ((info->protocol_version == 0) &&
|
||||
((info->protocol_style == XmDRAG_PREFER_PREREGISTER) ||
|
||||
(info->protocol_style == XmDRAG_PREFER_DYNAMIC) ||
|
||||
(info->protocol_style == XmDRAG_DYNAMIC)))
|
||||
retval = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_NOTE (DND,
|
||||
g_warning ("Invalid Motif drag receiver property on window %ld\n", win));
|
||||
}
|
||||
|
||||
XFree (info);
|
||||
}
|
||||
}
|
||||
|
||||
return retval ? win : GDK_NONE;
|
||||
@@ -1468,13 +1478,14 @@ motif_read_initiator_info (Window source_window,
|
||||
if (!motif_drag_initiator_info)
|
||||
motif_drag_initiator_info = gdk_atom_intern ("_MOTIF_DRAG_INITIATOR_INFO", FALSE);
|
||||
|
||||
gdk_error_trap_push ();
|
||||
XGetWindowProperty (gdk_display, source_window, atom,
|
||||
0, sizeof(*initiator_info), FALSE,
|
||||
motif_drag_initiator_info,
|
||||
&type, &format, &nitems, &bytes_after,
|
||||
(guchar **)&initiator_info);
|
||||
|
||||
if ((format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0))
|
||||
if (gdk_error_trap_pop () || (format != 8) || (nitems != sizeof (MotifDragInitiatorInfo)) || (bytes_after != 0))
|
||||
{
|
||||
g_warning ("Error reading initiator info\n");
|
||||
return FALSE;
|
||||
@@ -2027,6 +2038,8 @@ xdnd_set_targets (GdkDragContext *context)
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(guchar *)atomlist, n_atoms);
|
||||
|
||||
g_free (atomlist);
|
||||
|
||||
private->xdnd_targets_set = 1;
|
||||
}
|
||||
|
||||
@@ -2073,6 +2086,8 @@ xdnd_set_actions (GdkDragContext *context)
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(guchar *)atomlist, n_atoms);
|
||||
|
||||
g_free (atomlist);
|
||||
|
||||
private->xdnd_actions_set = 1;
|
||||
private->xdnd_actions = context->actions;
|
||||
}
|
||||
@@ -2106,13 +2121,9 @@ xdnd_send_enter (GdkDragContext *context)
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.message_type = gdk_atom_intern ("XdndEnter", FALSE);
|
||||
xev.xclient.format = 32;
|
||||
#ifdef NEW_DRAGS
|
||||
xev.xclient.window = private->dest_xid ?
|
||||
private->dest_xid :
|
||||
xev.xclient.window = private->drop_xid ?
|
||||
private->drop_xid :
|
||||
GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#else
|
||||
xev.xclient.window = GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#endif
|
||||
xev.xclient.data.l[0] = GDK_WINDOW_XWINDOW (context->source_window);
|
||||
xev.xclient.data.l[1] = (3 << 24); /* version */
|
||||
xev.xclient.data.l[2] = 0;
|
||||
@@ -2162,13 +2173,9 @@ xdnd_send_leave (GdkDragContext *context)
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.message_type = gdk_atom_intern ("XdndLeave", FALSE);
|
||||
xev.xclient.format = 32;
|
||||
#ifdef NEW_DRAGS
|
||||
xev.xclient.window = private->dest_xid ?
|
||||
private->dest_xid :
|
||||
xev.xclient.window = private->drop_xid ?
|
||||
private->drop_xid :
|
||||
GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#else
|
||||
xev.xclient.window = GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#endif
|
||||
xev.xclient.data.l[0] = GDK_WINDOW_XWINDOW (context->source_window);
|
||||
xev.xclient.data.l[1] = 0;
|
||||
xev.xclient.data.l[2] = 0;
|
||||
@@ -2195,13 +2202,9 @@ xdnd_send_drop (GdkDragContext *context, guint32 time)
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.message_type = gdk_atom_intern ("XdndDrop", FALSE);
|
||||
xev.xclient.format = 32;
|
||||
#ifdef NEW_DRAGS
|
||||
xev.xclient.window = private->dest_xid ?
|
||||
private->dest_xid :
|
||||
xev.xclient.window = private->drop_xid ?
|
||||
private->drop_xid :
|
||||
GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#else
|
||||
xev.xclient.window = GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#endif
|
||||
xev.xclient.data.l[0] = GDK_WINDOW_XWINDOW (context->source_window);
|
||||
xev.xclient.data.l[1] = 0;
|
||||
xev.xclient.data.l[2] = time;
|
||||
@@ -2232,13 +2235,9 @@ xdnd_send_motion (GdkDragContext *context,
|
||||
xev.xclient.type = ClientMessage;
|
||||
xev.xclient.message_type = gdk_atom_intern ("XdndPosition", FALSE);
|
||||
xev.xclient.format = 32;
|
||||
#ifdef NEW_DRAGS
|
||||
xev.xclient.window = private->dest_xid ?
|
||||
private->dest_xid :
|
||||
xev.xclient.window = private->drop_xid ?
|
||||
private->drop_xid :
|
||||
GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#else
|
||||
xev.xclient.window = GDK_WINDOW_XWINDOW (context->dest_window);
|
||||
#endif
|
||||
xev.xclient.data.l[0] = GDK_WINDOW_XWINDOW (context->source_window);
|
||||
xev.xclient.data.l[1] = 0;
|
||||
xev.xclient.data.l[2] = (x_root << 16) | y_root;
|
||||
@@ -2313,7 +2312,7 @@ xdnd_check_dest (Window win)
|
||||
{
|
||||
if ((format == 32) && (nitems == 1))
|
||||
{
|
||||
if (*version == 3)
|
||||
if (*version >= 3)
|
||||
retval = TRUE;
|
||||
}
|
||||
else
|
||||
@@ -2517,13 +2516,14 @@ xdnd_enter_filter (GdkXEvent *xev,
|
||||
new_context->targets = NULL;
|
||||
if (get_types)
|
||||
{
|
||||
gdk_error_trap_push ();
|
||||
XGetWindowProperty (GDK_WINDOW_XDISPLAY (event->any.window),
|
||||
source_window,
|
||||
gdk_atom_intern ("XdndTypeList", FALSE), 0, 65536,
|
||||
False, XA_ATOM, &type, &format, &nitems,
|
||||
&after, (guchar **)&data);
|
||||
|
||||
if ((format != 32) || (type != XA_ATOM))
|
||||
if (gdk_error_trap_pop () || (format != 32) || (type != XA_ATOM))
|
||||
{
|
||||
gdk_drag_context_unref (new_context);
|
||||
return GDK_FILTER_REMOVE;
|
||||
@@ -2785,10 +2785,12 @@ gdk_drag_get_protocol (guint32 xid,
|
||||
if (xid == gdk_root_window)
|
||||
rootwin = TRUE;
|
||||
|
||||
gdk_error_warnings = 0;
|
||||
|
||||
if (!rootwin)
|
||||
{
|
||||
gdk_error_code = 0;
|
||||
|
||||
|
||||
XGetWindowProperty (gdk_display, xid,
|
||||
gdk_atom_intern ("ENLIGHTENMENT_DESKTOP", FALSE),
|
||||
0, 0, False, AnyPropertyType,
|
||||
@@ -2859,6 +2861,12 @@ gdk_drag_find_window (GdkDragContext *context,
|
||||
|
||||
/* Check if new destination accepts drags, and which protocol */
|
||||
|
||||
/* There is some ugliness here. We actually need to pass
|
||||
* _three_ pieces of information to drag_motion - dest_window,
|
||||
* protocol, and the XID of the unproxied window. The first
|
||||
* two are passed explicitely, the third implicitly through
|
||||
* protocol->dest_xid.
|
||||
*/
|
||||
if ((recipient = gdk_drag_get_protocol (dest, protocol)))
|
||||
{
|
||||
*dest_window = gdk_window_lookup (recipient);
|
||||
@@ -2917,6 +2925,7 @@ gdk_drag_motion (GdkDragContext *context,
|
||||
if (dest_window)
|
||||
{
|
||||
context->dest_window = dest_window;
|
||||
private->drop_xid = private->dest_xid;
|
||||
gdk_window_ref (context->dest_window);
|
||||
context->protocol = protocol;
|
||||
|
||||
@@ -2941,6 +2950,7 @@ gdk_drag_motion (GdkDragContext *context,
|
||||
else
|
||||
{
|
||||
context->dest_window = NULL;
|
||||
private->drop_xid = None;
|
||||
context->action = 0;
|
||||
}
|
||||
|
||||
|
@@ -501,12 +501,14 @@ gdk_draw_lines (GdkDrawable *drawable,
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
if (drawable_private->destroyed)
|
||||
return;
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
XDrawLines (drawable_private->xdisplay,
|
||||
drawable_private->xwindow,
|
||||
gc_private->xgc,
|
||||
(XPoint *) points,
|
||||
npoints,
|
||||
CoordModeOrigin);
|
||||
drawable_private->xwindow,
|
||||
gc_private->xgc,
|
||||
(XPoint *) points,
|
||||
npoints,
|
||||
CoordModeOrigin);
|
||||
}
|
||||
|
183
gdk/gdkevents.c
183
gdk/gdkevents.c
@@ -27,7 +27,6 @@
|
||||
#include "gdk.h"
|
||||
#include "gdkx.h"
|
||||
#include "gdkprivate.h"
|
||||
#include "gdkinput.h"
|
||||
#include "gdkkeysyms.h"
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
@@ -37,6 +36,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "gdkinput.h"
|
||||
|
||||
typedef struct _GdkIOClosure GdkIOClosure;
|
||||
typedef struct _GdkEventPrivate GdkEventPrivate;
|
||||
@@ -88,9 +88,11 @@ static GdkEvent* gdk_event_unqueue (void);
|
||||
|
||||
static gboolean gdk_event_prepare (gpointer source_data,
|
||||
GTimeVal *current_time,
|
||||
gint *timeout);
|
||||
gint *timeout,
|
||||
gpointer user_data);
|
||||
static gboolean gdk_event_check (gpointer source_data,
|
||||
GTimeVal *current_time);
|
||||
GTimeVal *current_time,
|
||||
gpointer user_data);
|
||||
static gboolean gdk_event_dispatch (gpointer source_data,
|
||||
GTimeVal *current_time,
|
||||
gpointer user_data);
|
||||
@@ -434,6 +436,10 @@ gdk_compress_exposures (XEvent *xevent,
|
||||
rect1.width = xevent->xexpose.width;
|
||||
rect1.height = xevent->xexpose.height;
|
||||
|
||||
event.any.type = GDK_EXPOSE;
|
||||
event.any.window = None;
|
||||
event.any.send_event = FALSE;
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (count == 0)
|
||||
@@ -449,6 +455,8 @@ gdk_compress_exposures (XEvent *xevent,
|
||||
&tmp_event,
|
||||
expose_predicate,
|
||||
(XPointer)&info);
|
||||
|
||||
event.any.window = window;
|
||||
|
||||
/* We apply filters here, and if it was filtered, completely
|
||||
* ignore the return
|
||||
@@ -824,7 +832,7 @@ gdk_event_get_time (GdkEvent *event)
|
||||
*/
|
||||
|
||||
void
|
||||
gdk_set_show_events (gint show_events)
|
||||
gdk_set_show_events (gboolean show_events)
|
||||
{
|
||||
if (show_events)
|
||||
gdk_debug_flags |= GDK_DEBUG_EVENTS;
|
||||
@@ -832,10 +840,10 @@ gdk_set_show_events (gint show_events)
|
||||
gdk_debug_flags &= ~GDK_DEBUG_EVENTS;
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_get_show_events (void)
|
||||
{
|
||||
return gdk_debug_flags & GDK_DEBUG_EVENTS;
|
||||
return (gdk_debug_flags & GDK_DEBUG_EVENTS) != 0;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -849,6 +857,12 @@ gdk_io_destroy (gpointer data)
|
||||
g_free (closure);
|
||||
}
|
||||
|
||||
/* What do we do with G_IO_NVAL?
|
||||
*/
|
||||
#define READ_CONDITION (G_IO_IN | G_IO_HUP | G_IO_ERR)
|
||||
#define WRITE_CONDITION (G_IO_OUT | G_IO_ERR)
|
||||
#define EXCEPTION_CONDITION (G_IO_PRI)
|
||||
|
||||
static gboolean
|
||||
gdk_io_invoke (GIOChannel *source,
|
||||
GIOCondition condition,
|
||||
@@ -857,11 +871,11 @@ gdk_io_invoke (GIOChannel *source,
|
||||
GdkIOClosure *closure = data;
|
||||
GdkInputCondition gdk_cond = 0;
|
||||
|
||||
if (condition & (G_IO_IN | G_IO_PRI))
|
||||
if (condition & READ_CONDITION)
|
||||
gdk_cond |= GDK_INPUT_READ;
|
||||
if (condition & G_IO_OUT)
|
||||
if (condition & WRITE_CONDITION)
|
||||
gdk_cond |= GDK_INPUT_WRITE;
|
||||
if (condition & (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
|
||||
if (condition & EXCEPTION_CONDITION)
|
||||
gdk_cond |= GDK_INPUT_EXCEPTION;
|
||||
|
||||
if (closure->condition & gdk_cond)
|
||||
@@ -888,11 +902,11 @@ gdk_input_add_full (gint source,
|
||||
closure->data = data;
|
||||
|
||||
if (condition & GDK_INPUT_READ)
|
||||
cond |= (G_IO_IN | G_IO_PRI);
|
||||
cond |= READ_CONDITION;
|
||||
if (condition & GDK_INPUT_WRITE)
|
||||
cond |= G_IO_OUT;
|
||||
cond |= WRITE_CONDITION;
|
||||
if (condition & GDK_INPUT_EXCEPTION)
|
||||
cond |= G_IO_ERR|G_IO_HUP|G_IO_NVAL;
|
||||
cond |= EXCEPTION_CONDITION;
|
||||
|
||||
channel = g_io_channel_unix_new (source);
|
||||
result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, cond,
|
||||
@@ -923,7 +937,6 @@ gdk_event_apply_filters (XEvent *xevent,
|
||||
GdkEvent *event,
|
||||
GList *filters)
|
||||
{
|
||||
GdkEventFilter *filter;
|
||||
GList *tmp_list;
|
||||
GdkFilterReturn result;
|
||||
|
||||
@@ -931,13 +944,12 @@ gdk_event_apply_filters (XEvent *xevent,
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
filter = (GdkEventFilter*) tmp_list->data;
|
||||
|
||||
result = (*filter->function) (xevent, event, filter->data);
|
||||
if (result != GDK_FILTER_CONTINUE)
|
||||
return result;
|
||||
GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
result = filter->function (xevent, event, filter->data);
|
||||
if (result != GDK_FILTER_CONTINUE)
|
||||
return result;
|
||||
}
|
||||
|
||||
return GDK_FILTER_CONTINUE;
|
||||
@@ -1002,7 +1014,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
gdk_window_ref (window);
|
||||
|
||||
event->any.window = window;
|
||||
event->any.send_event = xevent->xany.send_event;
|
||||
event->any.send_event = xevent->xany.send_event ? TRUE : FALSE;
|
||||
|
||||
if (window_private && window_private->destroyed)
|
||||
{
|
||||
@@ -1057,9 +1069,6 @@ gdk_event_translate (GdkEvent *event,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (window == NULL)
|
||||
g_message ("Got event for unknown window: %#lx\n", xevent->xany.window);
|
||||
|
||||
/* We do a "manual" conversion of the XEvent to a
|
||||
* GdkEvent. The structures are mostly the same so
|
||||
* the conversion is fairly straightforward. We also
|
||||
@@ -1513,10 +1522,11 @@ gdk_event_translate (GdkEvent *event,
|
||||
/* Print debugging info.
|
||||
*/
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d",
|
||||
g_message ("expose:\t\twindow: %ld %d x,y: %d %d w,h: %d %d%s",
|
||||
xevent->xexpose.window, xevent->xexpose.count,
|
||||
xevent->xexpose.x, xevent->xexpose.y,
|
||||
xevent->xexpose.width, xevent->xexpose.height));
|
||||
xevent->xexpose.width, xevent->xexpose.height,
|
||||
event->any.send_event ? " (send)" : ""));
|
||||
gdk_compress_exposures (xevent, window);
|
||||
|
||||
event->expose.type = GDK_EXPOSE;
|
||||
@@ -1601,7 +1611,17 @@ gdk_event_translate (GdkEvent *event,
|
||||
break;
|
||||
|
||||
case CreateNotify:
|
||||
/* Not currently handled */
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("create notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d parent: %ld ovr: %d",
|
||||
xevent->xcreatewindow.window,
|
||||
xevent->xcreatewindow.x,
|
||||
xevent->xcreatewindow.y,
|
||||
xevent->xcreatewindow.width,
|
||||
xevent->xcreatewindow.height,
|
||||
xevent->xcreatewindow.border_width,
|
||||
xevent->xcreatewindow.parent,
|
||||
xevent->xcreatewindow.override_redirect));
|
||||
/* not really handled */
|
||||
break;
|
||||
|
||||
case DestroyNotify:
|
||||
@@ -1616,7 +1636,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
return_val = window_private && !window_private->destroyed;
|
||||
|
||||
if(window && window_private->xwindow != GDK_ROOT_WINDOW())
|
||||
if (window && window_private->xwindow != GDK_ROOT_WINDOW())
|
||||
gdk_window_destroy_notify (window);
|
||||
break;
|
||||
|
||||
@@ -1651,8 +1671,12 @@ gdk_event_translate (GdkEvent *event,
|
||||
/* Print debugging info.
|
||||
*/
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("reparent notify:\twindow: %ld",
|
||||
xevent->xreparent.window));
|
||||
g_message ("reparent notify:\twindow: %ld x,y: %d %d parent: %ld ovr: %d",
|
||||
xevent->xreparent.window,
|
||||
xevent->xreparent.x,
|
||||
xevent->xreparent.y,
|
||||
xevent->xreparent.parent,
|
||||
xevent->xreparent.override_redirect));
|
||||
|
||||
/* Not currently handled */
|
||||
return_val = FALSE;
|
||||
@@ -1661,9 +1685,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
case ConfigureNotify:
|
||||
/* Print debugging info.
|
||||
*/
|
||||
while ((XPending (gdk_display) > 0) &&
|
||||
XCheckTypedWindowEvent(gdk_display, xevent->xany.window,
|
||||
ConfigureNotify, xevent))
|
||||
while (0 && /* don't reorder ConfigureNotify events at all */
|
||||
XPending (gdk_display) > 0 &&
|
||||
XCheckTypedWindowEvent (gdk_display, xevent->xany.window,
|
||||
ConfigureNotify, xevent))
|
||||
{
|
||||
GdkFilterReturn result;
|
||||
|
||||
@@ -1690,7 +1715,7 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d",
|
||||
g_message ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d%s",
|
||||
xevent->xconfigure.window,
|
||||
xevent->xconfigure.x,
|
||||
xevent->xconfigure.y,
|
||||
@@ -1698,14 +1723,19 @@ gdk_event_translate (GdkEvent *event,
|
||||
xevent->xconfigure.height,
|
||||
xevent->xconfigure.border_width,
|
||||
xevent->xconfigure.above,
|
||||
xevent->xconfigure.override_redirect));
|
||||
|
||||
if (!window_private->destroyed &&
|
||||
xevent->xconfigure.override_redirect,
|
||||
!window
|
||||
? " (discarding)"
|
||||
: window_private->window_type == GDK_WINDOW_CHILD
|
||||
? " (discarding child)"
|
||||
: ""));
|
||||
if (window &&
|
||||
!window_private->destroyed &&
|
||||
(window_private->extension_events != 0) &&
|
||||
gdk_input_vtable.configure_event)
|
||||
gdk_input_vtable.configure_event (&xevent->xconfigure, window);
|
||||
|
||||
if (window_private->window_type == GDK_WINDOW_CHILD)
|
||||
if (!window || window_private->window_type == GDK_WINDOW_CHILD)
|
||||
return_val = FALSE;
|
||||
else
|
||||
{
|
||||
@@ -1721,17 +1751,23 @@ gdk_event_translate (GdkEvent *event,
|
||||
gint tx = 0;
|
||||
gint ty = 0;
|
||||
Window child_window = 0;
|
||||
|
||||
if (!XTranslateCoordinates (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
gdk_root_window,
|
||||
0, 0,
|
||||
&tx, &ty,
|
||||
&child_window))
|
||||
g_warning ("GdkWindow %ld doesn't share root windows display?",
|
||||
window_private->xwindow);
|
||||
event->configure.x = tx;
|
||||
event->configure.y = ty;
|
||||
|
||||
gdk_error_trap_push ();
|
||||
if (XTranslateCoordinates (window_private->xdisplay,
|
||||
window_private->xwindow,
|
||||
gdk_root_window,
|
||||
0, 0,
|
||||
&tx, &ty,
|
||||
&child_window))
|
||||
{
|
||||
if (!gdk_error_trap_pop ())
|
||||
{
|
||||
event->configure.x = tx;
|
||||
event->configure.y = ty;
|
||||
}
|
||||
}
|
||||
else
|
||||
gdk_error_trap_pop ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1751,8 +1787,14 @@ gdk_event_translate (GdkEvent *event,
|
||||
/* Print debugging info.
|
||||
*/
|
||||
GDK_NOTE (EVENTS,
|
||||
g_message ("property notify:\twindow: %ld",
|
||||
xevent->xproperty.window));
|
||||
gchar *atom = gdk_atom_name (xevent->xproperty.atom);
|
||||
g_message ("property notify:\twindow: %ld, atom(%ld): %s%s%s",
|
||||
xevent->xproperty.window,
|
||||
xevent->xproperty.atom,
|
||||
atom ? "\"" : "",
|
||||
atom ? atom : "unknown",
|
||||
atom ? "\"" : "");
|
||||
);
|
||||
|
||||
event->property.type = GDK_PROPERTY_NOTIFY;
|
||||
event->property.window = window;
|
||||
@@ -1910,8 +1952,8 @@ gdk_event_translate (GdkEvent *event,
|
||||
|
||||
GdkFilterReturn
|
||||
gdk_wm_protocols_filter (GdkXEvent *xev,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
XEvent *xevent = (XEvent *)xev;
|
||||
|
||||
@@ -1993,8 +2035,7 @@ gdk_events_queue (void)
|
||||
|
||||
event->any.type = GDK_NOTHING;
|
||||
event->any.window = NULL;
|
||||
event->any.send_event = FALSE;
|
||||
event->any.send_event = xevent.xany.send_event;
|
||||
event->any.send_event = xevent.xany.send_event ? TRUE : FALSE;
|
||||
|
||||
((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING;
|
||||
|
||||
@@ -2017,7 +2058,8 @@ gdk_events_queue (void)
|
||||
static gboolean
|
||||
gdk_event_prepare (gpointer source_data,
|
||||
GTimeVal *current_time,
|
||||
gint *timeout)
|
||||
gint *timeout,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean retval;
|
||||
|
||||
@@ -2034,7 +2076,8 @@ gdk_event_prepare (gpointer source_data,
|
||||
|
||||
static gboolean
|
||||
gdk_event_check (gpointer source_data,
|
||||
GTimeVal *current_time)
|
||||
GTimeVal *current_time,
|
||||
gpointer user_data)
|
||||
{
|
||||
gboolean retval;
|
||||
|
||||
@@ -2133,29 +2176,29 @@ gdk_event_send_client_message_to_all_recurse (XEvent *xev,
|
||||
guint level)
|
||||
{
|
||||
static GdkAtom wm_state_atom = GDK_NONE;
|
||||
|
||||
Atom type = None;
|
||||
int format;
|
||||
unsigned long nitems, after;
|
||||
unsigned char *data;
|
||||
|
||||
Window *ret_children, ret_root, ret_parent;
|
||||
unsigned int ret_nchildren;
|
||||
int i;
|
||||
|
||||
gint old_warnings = gdk_error_warnings;
|
||||
gboolean send = FALSE;
|
||||
gboolean found = FALSE;
|
||||
int i;
|
||||
|
||||
if (!wm_state_atom)
|
||||
wm_state_atom = gdk_atom_intern ("WM_STATE", FALSE);
|
||||
|
||||
gdk_error_warnings = FALSE;
|
||||
gdk_error_code = 0;
|
||||
XGetWindowProperty (gdk_display, xid, wm_state_atom, 0, 0, False, AnyPropertyType,
|
||||
&type, &format, &nitems, &after, &data);
|
||||
|
||||
if (gdk_error_code)
|
||||
{
|
||||
gdk_error_code = 0;
|
||||
gdk_error_warnings = old_warnings;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -2167,18 +2210,20 @@ gdk_event_send_client_message_to_all_recurse (XEvent *xev,
|
||||
else
|
||||
{
|
||||
/* OK, we're all set, now let's find some windows to send this to */
|
||||
if (XQueryTree(gdk_display, xid, &ret_root, &ret_parent,
|
||||
&ret_children, &ret_nchildren) != True)
|
||||
return FALSE;
|
||||
|
||||
if (gdk_error_code)
|
||||
return FALSE;
|
||||
if (XQueryTree (gdk_display, xid, &ret_root, &ret_parent,
|
||||
&ret_children, &ret_nchildren) != True ||
|
||||
gdk_error_code)
|
||||
{
|
||||
gdk_error_warnings = old_warnings;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for(i = 0; i < ret_nchildren; i++)
|
||||
if (gdk_event_send_client_message_to_all_recurse(xev, ret_children[i], level + 1))
|
||||
if (gdk_event_send_client_message_to_all_recurse (xev, ret_children[i], level + 1))
|
||||
found = TRUE;
|
||||
|
||||
XFree(ret_children);
|
||||
XFree (ret_children);
|
||||
}
|
||||
|
||||
if (send || (!found && (level == 1)))
|
||||
@@ -2187,6 +2232,8 @@ gdk_event_send_client_message_to_all_recurse (XEvent *xev,
|
||||
gdk_send_xevent (xid, False, NoEventMask, xev);
|
||||
}
|
||||
|
||||
gdk_error_warnings = old_warnings;
|
||||
|
||||
return (send || found);
|
||||
}
|
||||
|
||||
|
143
gdk/gdkfont.c
143
gdk/gdkfont.c
@@ -29,38 +29,112 @@
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate.h"
|
||||
|
||||
static GHashTable *font_name_hash = NULL;
|
||||
static GHashTable *fontset_name_hash = NULL;
|
||||
|
||||
static void
|
||||
gdk_font_hash_insert (GdkFontType type, GdkFont *font, const gchar *font_name)
|
||||
{
|
||||
GdkFontPrivate *private = (GdkFontPrivate *)font;
|
||||
GHashTable **hashp = (type == GDK_FONT_FONT) ?
|
||||
&font_name_hash : &fontset_name_hash;
|
||||
|
||||
if (!*hashp)
|
||||
*hashp = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
private->names = g_slist_prepend (private->names, g_strdup (font_name));
|
||||
g_hash_table_insert (*hashp, private->names->data, font);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_font_hash_remove (GdkFontType type, GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *private = (GdkFontPrivate *)font;
|
||||
GSList *tmp_list;
|
||||
GHashTable *hash = (type == GDK_FONT_FONT) ?
|
||||
font_name_hash : fontset_name_hash;
|
||||
|
||||
tmp_list = private->names;
|
||||
while (tmp_list)
|
||||
{
|
||||
g_hash_table_remove (hash, tmp_list->data);
|
||||
g_free (tmp_list->data);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
g_slist_free (private->names);
|
||||
private->names = NULL;
|
||||
}
|
||||
|
||||
static GdkFont *
|
||||
gdk_font_hash_lookup (GdkFontType type, const gchar *font_name)
|
||||
{
|
||||
GdkFont *result;
|
||||
GHashTable *hash = (type == GDK_FONT_FONT) ?
|
||||
font_name_hash : fontset_name_hash;
|
||||
|
||||
if (!hash)
|
||||
return NULL;
|
||||
else
|
||||
{
|
||||
result = g_hash_table_lookup (hash, font_name);
|
||||
if (result)
|
||||
gdk_font_ref (result);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
GdkFont*
|
||||
gdk_font_load (const gchar *font_name)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkFontPrivate *private;
|
||||
XFontStruct *xfont;
|
||||
|
||||
private = g_new (GdkFontPrivate, 1);
|
||||
font = (GdkFont*) private;
|
||||
g_return_val_if_fail (font_name != NULL, NULL);
|
||||
|
||||
private->xdisplay = gdk_display;
|
||||
private->xfont = XLoadQueryFont (private->xdisplay, font_name);
|
||||
private->ref_count = 1;
|
||||
font = gdk_font_hash_lookup (GDK_FONT_FONT, font_name);
|
||||
if (font)
|
||||
return font;
|
||||
|
||||
if (!private->xfont)
|
||||
xfont = XLoadQueryFont (gdk_display, font_name);
|
||||
if (xfont == NULL)
|
||||
return NULL;
|
||||
|
||||
font = gdk_font_lookup (xfont->fid);
|
||||
if (font != NULL)
|
||||
{
|
||||
g_free (font);
|
||||
return NULL;
|
||||
private = (GdkFontPrivate *) font;
|
||||
if (xfont != private->xfont)
|
||||
XFreeFont (gdk_display, xfont);
|
||||
|
||||
gdk_font_ref (font);
|
||||
}
|
||||
else
|
||||
{
|
||||
private = g_new (GdkFontPrivate, 1);
|
||||
private->xdisplay = gdk_display;
|
||||
private->xfont = xfont;
|
||||
private->ref_count = 1;
|
||||
private->names = NULL;
|
||||
|
||||
font = (GdkFont*) private;
|
||||
font->type = GDK_FONT_FONT;
|
||||
font->ascent = ((XFontStruct *) private->xfont)->ascent;
|
||||
font->descent = ((XFontStruct *) private->xfont)->descent;
|
||||
font->ascent = xfont->ascent;
|
||||
font->descent = xfont->descent;
|
||||
|
||||
gdk_xid_table_insert (&xfont->fid, font);
|
||||
}
|
||||
|
||||
gdk_xid_table_insert (&((XFontStruct *) private->xfont)->fid, font);
|
||||
gdk_font_hash_insert (GDK_FONT_FONT, font, font_name);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
GdkFont*
|
||||
gdk_fontset_load (gchar *fontset_name)
|
||||
gdk_fontset_load (const gchar *fontset_name)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkFontPrivate *private;
|
||||
@@ -69,6 +143,10 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
gchar **missing_charset_list;
|
||||
gchar *def_string;
|
||||
|
||||
font = gdk_font_hash_lookup (GDK_FONT_FONTSET, fontset_name);
|
||||
if (font)
|
||||
return font;
|
||||
|
||||
private = g_new (GdkFontPrivate, 1);
|
||||
font = (GdkFont*) private;
|
||||
|
||||
@@ -111,8 +189,12 @@ gdk_fontset_load (gchar *fontset_name)
|
||||
font->ascent = MAX (font->ascent, font_structs[i]->ascent);
|
||||
font->descent = MAX (font->descent, font_structs[i]->descent);
|
||||
}
|
||||
|
||||
private->names = NULL;
|
||||
gdk_font_hash_insert (GDK_FONT_FONTSET, font, fontset_name);
|
||||
|
||||
return font;
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
GdkFont*
|
||||
@@ -131,14 +213,16 @@ void
|
||||
gdk_font_unref (GdkFont *font)
|
||||
{
|
||||
GdkFontPrivate *private;
|
||||
private = (GdkFontPrivate*) font;
|
||||
|
||||
g_return_if_fail (font != NULL);
|
||||
|
||||
private = (GdkFontPrivate*) font;
|
||||
g_return_if_fail (private->ref_count > 0);
|
||||
|
||||
private->ref_count -= 1;
|
||||
if (private->ref_count == 0)
|
||||
{
|
||||
gdk_font_hash_remove (font->type, font);
|
||||
|
||||
switch (font->type)
|
||||
{
|
||||
case GDK_FONT_FONT:
|
||||
@@ -175,7 +259,7 @@ gdk_font_id (const GdkFont *font)
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_font_equal (const GdkFont *fonta,
|
||||
const GdkFont *fontb)
|
||||
{
|
||||
@@ -195,12 +279,16 @@ gdk_font_equal (const GdkFont *fonta,
|
||||
}
|
||||
else if (fonta->type == GDK_FONT_FONTSET && fontb->type == GDK_FONT_FONTSET)
|
||||
{
|
||||
/* how to compare two fontsets ?? by basename or XFontSet ?? */
|
||||
return (((XFontSet) privatea->xfont) == ((XFontSet) privateb->xfont));
|
||||
gchar *namea, *nameb;
|
||||
|
||||
namea = XBaseFontNameListOfFontSet((XFontSet) privatea->xfont);
|
||||
nameb = XBaseFontNameListOfFontSet((XFontSet) privateb->xfont);
|
||||
|
||||
return (strcmp(namea, nameb) == 0);
|
||||
}
|
||||
else
|
||||
/* fontset != font */
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
@@ -568,7 +656,20 @@ gdk_text_extents_wc (GdkFont *font,
|
||||
}
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) private->xfont;
|
||||
XwcTextExtents (fontset, text, text_length, &ink, &logical);
|
||||
|
||||
if (sizeof(GdkWChar) == sizeof(wchar_t))
|
||||
XwcTextExtents (fontset, (wchar_t *)text, text_length, &ink, &logical);
|
||||
else
|
||||
{
|
||||
wchar_t *text_wchar;
|
||||
gint i;
|
||||
|
||||
text_wchar = g_new (wchar_t, text_length);
|
||||
for (i = 0; i < text_length; i++)
|
||||
text_wchar[i] = text[i];
|
||||
XwcTextExtents (fontset, text_wchar, text_length, &ink, &logical);
|
||||
g_free (text_wchar);
|
||||
}
|
||||
if (lbearing)
|
||||
*lbearing = ink.x;
|
||||
if (rbearing)
|
||||
@@ -642,7 +743,7 @@ gdk_text_measure (GdkFont *font,
|
||||
case GDK_FONT_FONTSET:
|
||||
fontset = (XFontSet) private->xfont;
|
||||
XmbTextExtents (fontset, text, text_length, &ink, &log);
|
||||
width = log.width;
|
||||
width = ink.x + ink.width;
|
||||
break;
|
||||
default:
|
||||
width = 0;
|
||||
|
13
gdk/gdkgc.c
13
gdk/gdkgc.c
@@ -286,6 +286,7 @@ gdk_gc_unref (GdkGC *gc)
|
||||
GdkGCPrivate *private = (GdkGCPrivate*) gc;
|
||||
|
||||
g_return_if_fail (gc != NULL);
|
||||
g_return_if_fail (private->ref_count > 0);
|
||||
|
||||
if (private->ref_count > 1)
|
||||
private->ref_count -= 1;
|
||||
@@ -738,8 +739,8 @@ gdk_gc_set_subwindow (GdkGC *gc,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gc_set_exposures (GdkGC *gc,
|
||||
gint exposures)
|
||||
gdk_gc_set_exposures (GdkGC *gc,
|
||||
gboolean exposures)
|
||||
{
|
||||
GdkGCPrivate *private;
|
||||
|
||||
@@ -819,10 +820,10 @@ gdk_gc_set_line_attributes (GdkGC *gc,
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gc_set_dashes (GdkGC *gc,
|
||||
gint dash_offset,
|
||||
gchar dash_list[],
|
||||
gint n)
|
||||
gdk_gc_set_dashes (GdkGC *gc,
|
||||
gint dash_offset,
|
||||
gint8 dash_list[],
|
||||
gint n)
|
||||
{
|
||||
GdkGCPrivate *private;
|
||||
|
||||
|
@@ -57,7 +57,7 @@ GdkDndGlobals gdk_dnd = {None,None,None,
|
||||
{0,0}, {0,0},
|
||||
{0,0,0,0}, NULL, None, 0};
|
||||
gchar *gdk_progclass = NULL;
|
||||
gint gdk_error_code;
|
||||
gint gdk_error_code = 0;
|
||||
gint gdk_error_warnings = TRUE;
|
||||
gint gdk_null_window_warnings = TRUE;
|
||||
GList *gdk_default_filters = NULL;
|
||||
|
@@ -46,6 +46,7 @@
|
||||
# define gdk_iswalnum(c) iswalnum(c)
|
||||
# define gdk_iswspace(c) iswspace(c)
|
||||
#else
|
||||
# include <ctype.h>
|
||||
# define gdk_iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
|
||||
# define gdk_iswspace(c) ((wchar_t)(c) <= 0xFF && isspace(c))
|
||||
#endif
|
||||
|
34
gdk/gdkim.c
34
gdk/gdkim.c
@@ -386,7 +386,7 @@ gdk_im_real_open (void)
|
||||
|
||||
destroy_cb.callback = gdk_im_destroy_cb;
|
||||
destroy_cb.client_data = NULL;
|
||||
if (NULL != XSetIMValues (xim_im, XNDestroyCallback, &destroy_cb, NULL))
|
||||
if (NULL != (void *) XSetIMValues (xim_im, XNDestroyCallback, &destroy_cb, NULL))
|
||||
GDK_NOTE (XIM, g_warning ("Could not set destroy callback to IM. Be careful to not destroy your input method."));
|
||||
#endif
|
||||
|
||||
@@ -442,7 +442,7 @@ gdk_im_close (void)
|
||||
}
|
||||
}
|
||||
|
||||
gint
|
||||
gboolean
|
||||
gdk_im_ready (void)
|
||||
{
|
||||
return (xim_im != NULL);
|
||||
@@ -469,7 +469,7 @@ gdk_ic_real_new (GdkIC *ic)
|
||||
mask |= GDK_IC_PREEDIT_AREA_REQ;
|
||||
|
||||
preedit_area.x = attr->preedit_area.x;
|
||||
preedit_area.y = attr->preedit_area.x;
|
||||
preedit_area.y = attr->preedit_area.y;
|
||||
preedit_area.width = attr->preedit_area.width;
|
||||
preedit_area.height = attr->preedit_area.height;
|
||||
|
||||
@@ -484,7 +484,7 @@ gdk_ic_real_new (GdkIC *ic)
|
||||
mask |= GDK_IC_PREEDIT_POSITION_REQ;
|
||||
|
||||
preedit_area.x = attr->preedit_area.x;
|
||||
preedit_area.y = attr->preedit_area.x;
|
||||
preedit_area.y = attr->preedit_area.y;
|
||||
preedit_area.width = attr->preedit_area.width;
|
||||
preedit_area.height = attr->preedit_area.height;
|
||||
|
||||
@@ -506,7 +506,7 @@ gdk_ic_real_new (GdkIC *ic)
|
||||
mask |= GDK_IC_STATUS_AREA_REQ;
|
||||
|
||||
status_area.x = attr->status_area.x;
|
||||
status_area.y = attr->status_area.x;
|
||||
status_area.y = attr->status_area.y;
|
||||
status_area.width = attr->status_area.width;
|
||||
status_area.height = attr->status_area.height;
|
||||
|
||||
@@ -518,6 +518,12 @@ gdk_ic_real_new (GdkIC *ic)
|
||||
break;
|
||||
}
|
||||
|
||||
/* We have to ensure that the client window is actually created on
|
||||
* the X server, or XCreateIC fails because the XIM server can't get
|
||||
* information about the client window.
|
||||
*/
|
||||
gdk_flush();
|
||||
|
||||
if (preedit_attr != NULL && status_attr != NULL)
|
||||
private->xic = XCreateIC (xim_im,
|
||||
XNInputStyle,
|
||||
@@ -871,7 +877,7 @@ gdk_ic_real_set_attr (GdkIC *ic,
|
||||
arg->name = XNFontSet;
|
||||
arg->value = (gpointer) GDK_FONT_XFONT(attr->status_fontset);
|
||||
|
||||
if (XSetICValues (xic, XNPreeditAttributes, arg, NULL))
|
||||
if (XSetICValues (xic, XNStatusAttributes, arg, NULL))
|
||||
error |= GDK_IC_STATUS_FONTSET;
|
||||
}
|
||||
|
||||
@@ -887,7 +893,7 @@ gdk_ic_real_set_attr (GdkIC *ic,
|
||||
arg->name = XNArea;
|
||||
arg->value = (gpointer) ▭
|
||||
|
||||
if (XSetICValues (xic, XNPreeditAttributes, arg, NULL))
|
||||
if (XSetICValues (xic, XNStatusAttributes, arg, NULL))
|
||||
error |= GDK_IC_STATUS_AREA;
|
||||
}
|
||||
|
||||
@@ -903,7 +909,7 @@ gdk_ic_real_set_attr (GdkIC *ic,
|
||||
arg->name = XNArea;
|
||||
arg->value = (gpointer) ▭
|
||||
|
||||
if (XSetICValues (xic, XNPreeditAttributes, arg, NULL))
|
||||
if (XSetICValues (xic, XNStatusAttributes, arg, NULL))
|
||||
error |= GDK_IC_STATUS_AREA_NEEDED;
|
||||
else
|
||||
private->mask &= ~GDK_IC_STATUS_AREA_NEEDED;
|
||||
@@ -914,7 +920,7 @@ gdk_ic_real_set_attr (GdkIC *ic,
|
||||
arg->name = XNForeground;
|
||||
arg->value = (gpointer) attr->status_foreground.pixel;
|
||||
|
||||
if (XSetICValues (xic, XNPreeditAttributes, arg, NULL))
|
||||
if (XSetICValues (xic, XNStatusAttributes, arg, NULL))
|
||||
error |= GDK_IC_STATUS_FOREGROUND;
|
||||
}
|
||||
|
||||
@@ -923,7 +929,7 @@ gdk_ic_real_set_attr (GdkIC *ic,
|
||||
arg->name = XNBackground;
|
||||
arg->value = (gpointer) attr->status_background.pixel;
|
||||
|
||||
if (XSetICValues (xic, XNPreeditAttributes, arg, NULL))
|
||||
if (XSetICValues (xic, XNStatusAttributes, arg, NULL))
|
||||
error |= GDK_IC_STATUS_BACKGROUND;
|
||||
}
|
||||
|
||||
@@ -932,7 +938,7 @@ gdk_ic_real_set_attr (GdkIC *ic,
|
||||
arg->name = XNBackgroundPixmap;
|
||||
arg->value = (gpointer) GDK_WINDOW_XWINDOW(attr->status_pixmap);
|
||||
|
||||
if (XSetICValues (xic, XNPreeditAttributes, arg, NULL))
|
||||
if (XSetICValues (xic, XNStatusAttributes, arg, NULL))
|
||||
error |= GDK_IC_STATUS_PIXMAP;
|
||||
}
|
||||
|
||||
@@ -941,7 +947,7 @@ gdk_ic_real_set_attr (GdkIC *ic,
|
||||
arg->name = XNColormap;
|
||||
arg->value = (gpointer) GDK_COLORMAP_XCOLORMAP(attr->status_colormap);
|
||||
|
||||
if (XSetICValues (xic, XNPreeditAttributes, arg, NULL))
|
||||
if (XSetICValues (xic, XNStatusAttributes, arg, NULL))
|
||||
error |= GDK_IC_STATUS_COLORMAP;
|
||||
}
|
||||
|
||||
@@ -1565,8 +1571,10 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
|
||||
!= Success)
|
||||
{
|
||||
/* InvalidChar */
|
||||
XFree(tpr.value);
|
||||
return -1;
|
||||
}
|
||||
XFree(tpr.value);
|
||||
if (num_wstrs == 0)
|
||||
return 0;
|
||||
wstr_src = wstrs[0];
|
||||
@@ -1580,7 +1588,7 @@ gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
|
||||
gint i;
|
||||
|
||||
for (i=0; i<dest_max && src[i]; i++)
|
||||
dest[i] = src[i];
|
||||
dest[i] = (guchar)src[i];
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@@ -251,14 +251,12 @@ gdk_image_new (GdkImageType type,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gdk_error_code = 0;
|
||||
gdk_error_warnings = 0;
|
||||
gdk_error_trap_push ();
|
||||
|
||||
XShmAttach (private->xdisplay, x_shm_info);
|
||||
XSync (private->xdisplay, False);
|
||||
|
||||
gdk_error_warnings = 1;
|
||||
if (gdk_error_code == -1)
|
||||
if (gdk_error_trap_pop ())
|
||||
{
|
||||
/* this is the common failure case so omit warning */
|
||||
XDestroyImage (private->ximage);
|
||||
@@ -269,6 +267,7 @@ gdk_image_new (GdkImageType type,
|
||||
g_free (image);
|
||||
|
||||
gdk_use_xshm = False;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -315,22 +314,7 @@ gdk_image_new (GdkImageType type,
|
||||
image->byte_order = private->ximage->byte_order;
|
||||
image->mem = private->ximage->data;
|
||||
image->bpl = private->ximage->bytes_per_line;
|
||||
|
||||
switch (private->ximage->bits_per_pixel)
|
||||
{
|
||||
case 8:
|
||||
image->bpp = 1;
|
||||
break;
|
||||
case 16:
|
||||
image->bpp = 2;
|
||||
break;
|
||||
case 24:
|
||||
image->bpp = 3;
|
||||
break;
|
||||
case 32:
|
||||
image->bpp = 4;
|
||||
break;
|
||||
}
|
||||
image->bpp = (private->ximage->bits_per_pixel + 7) / 8;
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user