Compare commits
514 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e90d1cdb52 | ||
|
|
c3eea233c3 | ||
|
|
38d974d6a1 | ||
|
|
f6646427bb | ||
|
|
7bf4c0ba2e | ||
|
|
0d61cf7cf0 | ||
|
|
e86529966a | ||
|
|
4b01f3de88 | ||
|
|
89b3194a02 | ||
|
|
aa43d03026 | ||
|
|
29a2f31f23 | ||
|
|
eee5fc14c2 | ||
|
|
ff9cbaa98a | ||
|
|
2094238a33 | ||
|
|
2da6e732ac | ||
|
|
048c7d2076 | ||
|
|
870fcf659e | ||
|
|
0a8b3b9b9f | ||
|
|
50e7636b99 | ||
|
|
d821f519de | ||
|
|
50083c8640 | ||
|
|
810d86396d | ||
|
|
fe2d7cb957 | ||
|
|
6fc502b1c0 | ||
|
|
630ec8d2c7 | ||
|
|
0fd6188b1c | ||
|
|
a16bbd60f7 | ||
|
|
c567c77741 | ||
|
|
23ee4993bc | ||
|
|
d46d14b7b4 | ||
|
|
0eeba3331a | ||
|
|
6731a077b4 | ||
|
|
27173a3c33 | ||
|
|
8ae6e8e755 | ||
|
|
214a6e2cc4 | ||
|
|
b79e367d73 | ||
|
|
c996a1fe24 | ||
|
|
ee96e9c5d8 | ||
|
|
d8cefed261 | ||
|
|
86936714ce | ||
|
|
3e74e28178 | ||
|
|
f17bdf3c87 | ||
|
|
c7a71edba6 | ||
|
|
5e575f2326 | ||
|
|
ae1ecbdf7f | ||
|
|
2e214dacdf | ||
|
|
dc2d6f8123 | ||
|
|
c64d6ea25e | ||
|
|
df3ba742ae | ||
|
|
19429f6089 | ||
|
|
bceb2d7556 | ||
|
|
0dd6cabee7 | ||
|
|
9483fb4580 | ||
|
|
7b60e68252 | ||
|
|
d26d035c09 | ||
|
|
f57ecb8e58 | ||
|
|
fceee37166 | ||
|
|
f25de682d4 | ||
|
|
7c5c24853f | ||
|
|
46d888d5eb | ||
|
|
f7be88be29 | ||
|
|
c7c5b16de9 | ||
|
|
36b9b4f9b6 | ||
|
|
da92bd8a08 | ||
|
|
b9f11a98c2 | ||
|
|
1ac08122ff | ||
|
|
accfa25c03 | ||
|
|
2773340992 | ||
|
|
e1ad4246e6 | ||
|
|
629f2635f0 | ||
|
|
b8946315a6 | ||
|
|
eef0d8f74e | ||
|
|
0a7b22a072 | ||
|
|
1dcb5791cd | ||
|
|
3c837134fc | ||
|
|
33555599be | ||
|
|
66ec9b11f9 | ||
|
|
ef280dd878 | ||
|
|
4ca00eb0be | ||
|
|
ae4dda7ed5 | ||
|
|
7e3ec40e11 | ||
|
|
1b50bc7a31 | ||
|
|
d8004f46e5 | ||
|
|
dbbdd05829 | ||
|
|
b6759d3c65 | ||
|
|
4e5aa197dd | ||
|
|
de559c3738 | ||
|
|
58008637f7 | ||
|
|
48dc9f70e6 | ||
|
|
6050d92c52 | ||
|
|
eab1d2cc80 | ||
|
|
e44247efc3 | ||
|
|
31a2c5e719 | ||
|
|
a494c4c9aa | ||
|
|
0a1b69bdc3 | ||
|
|
392d3fc73c | ||
|
|
3b2ead388f | ||
|
|
16e5a5bf38 | ||
|
|
52f1b7d8da | ||
|
|
1366647ef5 | ||
|
|
e5a631523d | ||
|
|
53efbc7dcf | ||
|
|
6320c153b9 | ||
|
|
091b2f3e27 | ||
|
|
3c27d7123f | ||
|
|
e62ab37a57 | ||
|
|
bd4752f2e2 | ||
|
|
293baedf04 | ||
|
|
9388838e76 | ||
|
|
a6d3979dcd | ||
|
|
a2276ce34a | ||
|
|
8e031aa1b1 | ||
|
|
2feefda667 | ||
|
|
dcce877c0c | ||
|
|
f44d05681e | ||
|
|
646dc07acc | ||
|
|
eea77710d0 | ||
|
|
9931a13807 | ||
|
|
d7ac77bfaf | ||
|
|
1d5fde03d6 | ||
|
|
9f20a359a5 | ||
|
|
0542ed1007 | ||
|
|
4ad7e949a4 | ||
|
|
5d39f00c26 | ||
|
|
87ddd3a19f | ||
|
|
fe3913dfeb | ||
|
|
2ded88af08 | ||
|
|
58bad83bdd | ||
|
|
841a146aba | ||
|
|
5b55bd3049 | ||
|
|
cc7efbd9b9 | ||
|
|
b77795d2c9 | ||
|
|
dd2137f2ed | ||
|
|
531a062dbe | ||
|
|
66985cacdb | ||
|
|
0a48879baf | ||
|
|
a2078f22ae | ||
|
|
4f82fe1099 | ||
|
|
ec70ae2787 | ||
|
|
13addcbb8d | ||
|
|
07ca5f46e8 | ||
|
|
aaec534ee1 | ||
|
|
4a0eef051b | ||
|
|
f4aa453807 | ||
|
|
0152c8a683 | ||
|
|
c8efaf5080 | ||
|
|
623c0df59a | ||
|
|
ed0e281458 | ||
|
|
0036dbe074 | ||
|
|
f57f8754dc | ||
|
|
cf50cd6f05 | ||
|
|
be52e56056 | ||
|
|
45309925bf | ||
|
|
8b87d5d2cc | ||
|
|
483030a00a | ||
|
|
76b486a693 | ||
|
|
2a6a7264ea | ||
|
|
52ae247d3b | ||
|
|
48c7f012a6 | ||
|
|
ba73a942d5 | ||
|
|
0adc2163cf | ||
|
|
6ec2e6900c | ||
|
|
e894766438 | ||
|
|
9d31483838 | ||
|
|
83bda553c0 | ||
|
|
e881862b46 | ||
|
|
d095c0adf8 | ||
|
|
6fc20daf55 | ||
|
|
12a6a3a71d | ||
|
|
87eb5ee053 | ||
|
|
6f61f5b224 | ||
|
|
a6dbe33829 | ||
|
|
35620befe6 | ||
|
|
19b9ecbb61 | ||
|
|
83f40bace7 | ||
|
|
49dfeb8e2d | ||
|
|
7bba376dd0 | ||
|
|
e0e39b1cc8 | ||
|
|
d1f64a8efa | ||
|
|
68a294d37d | ||
|
|
0b92a0ff5e | ||
|
|
ec45f056d0 | ||
|
|
0b4349a1bf | ||
|
|
fc2068e314 | ||
|
|
4867aedf79 | ||
|
|
5c0c274d81 | ||
|
|
02c32756ef | ||
|
|
7ac4f264a7 | ||
|
|
378a7488fb | ||
|
|
500bca8af3 | ||
|
|
f1bcb52ccb | ||
|
|
6a422f88bc | ||
|
|
995098e65e | ||
|
|
afa7fb3730 | ||
|
|
9ec02189ad | ||
|
|
58877f347b | ||
|
|
f1ac2debf5 | ||
|
|
108ab31b50 | ||
|
|
cd47f2bcef | ||
|
|
8af31223af | ||
|
|
81cde9d6cb | ||
|
|
5213be07e0 | ||
|
|
7db52619ba | ||
|
|
69881e62ca | ||
|
|
ee4333f91e | ||
|
|
5ee5ee3f6a | ||
|
|
03d2e8be66 | ||
|
|
3bb07953e6 | ||
|
|
b07b60261c | ||
|
|
2866fc45f4 | ||
|
|
ba6e0c4c63 | ||
|
|
83202df4d2 | ||
|
|
90b8285dda | ||
|
|
7f93523dd5 | ||
|
|
f5397b4d79 | ||
|
|
d55fe6c466 | ||
|
|
4e93f24b89 | ||
|
|
f856e7a5a2 | ||
|
|
03baed131e | ||
|
|
62f6e1b8c0 | ||
|
|
c5f5550f3c | ||
|
|
c42aa348c1 | ||
|
|
0fb6bcbf96 | ||
|
|
6520b9b607 | ||
|
|
c311d5092e | ||
|
|
541c59df2b | ||
|
|
f79c3a2434 | ||
|
|
6e260ca284 | ||
|
|
16e1a7e5f0 | ||
|
|
8cbf4cec97 | ||
|
|
8bc79c100d | ||
|
|
ce3fc77ad8 | ||
|
|
7e1a54df8b | ||
|
|
edf71ecbfe | ||
|
|
9108c09a0c | ||
|
|
d87e3afe12 | ||
|
|
892034a7c0 | ||
|
|
5087bb771a | ||
|
|
ff585a1bbe | ||
|
|
5614108365 | ||
|
|
52cf94a376 | ||
|
|
d8be69ef4c | ||
|
|
00dfe44873 | ||
|
|
39fc17f19a | ||
|
|
3932f96618 | ||
|
|
1eb3a99535 | ||
|
|
e9598560eb | ||
|
|
ba3dec7e39 | ||
|
|
60bada5f3a | ||
|
|
e6a5873929 | ||
|
|
ca973340c0 | ||
|
|
b4046f7c40 | ||
|
|
a0c3fd29df | ||
|
|
d4a787f2e1 | ||
|
|
2ab81b8093 | ||
|
|
4dfc635844 | ||
|
|
6a60f3a6b8 | ||
|
|
8d97bc30c9 | ||
|
|
0ed62104fe | ||
|
|
1a866a56a4 | ||
|
|
bec6497cca | ||
|
|
321c717741 | ||
|
|
8169f009fe | ||
|
|
9579817d6d | ||
|
|
539579842d | ||
|
|
0df1bbcddf | ||
|
|
cc02e55884 | ||
|
|
3d5517fe1d | ||
|
|
8770b66c61 | ||
|
|
9c8be35b4d | ||
|
|
019bac19a9 | ||
|
|
f3af493c21 | ||
|
|
b0ed6224db | ||
|
|
f576f5c347 | ||
|
|
5f3ce6afb8 | ||
|
|
2775064ab9 | ||
|
|
43bb83247c | ||
|
|
6fcc8afa85 | ||
|
|
26c2ef7525 | ||
|
|
e2fd1e2e12 | ||
|
|
02c952be3b | ||
|
|
726ab80ef8 | ||
|
|
2bd2eb857a | ||
|
|
7c1ea2572d | ||
|
|
a0c6c59e99 | ||
|
|
4482f32ba3 | ||
|
|
29dd4ce719 | ||
|
|
5ff77be3b8 | ||
|
|
69c9e13238 | ||
|
|
a5a4baf9f2 | ||
|
|
1b5ca9a190 | ||
|
|
1d2bf8a0c2 | ||
|
|
b86a2d2081 | ||
|
|
a2581917fe | ||
|
|
efddc90261 | ||
|
|
c71076d867 | ||
|
|
03410cd372 | ||
|
|
11a1a8a9fa | ||
|
|
de7ab66507 | ||
|
|
980dfbd7f7 | ||
|
|
1c8652ca31 | ||
|
|
b607f4bfc2 | ||
|
|
fdade41dc6 | ||
|
|
a6e7fe0e89 | ||
|
|
b398a85b23 | ||
|
|
4542e6540b | ||
|
|
3f4dbc8e4e | ||
|
|
784ce6172a | ||
|
|
ceb0100826 | ||
|
|
88fab9d287 | ||
|
|
99746d0055 | ||
|
|
bb527c2735 | ||
|
|
2bd7e4fc18 | ||
|
|
a5e86bd040 | ||
|
|
93436df139 | ||
|
|
ace5e01e0b | ||
|
|
51d83aa47a | ||
|
|
3958a82a34 | ||
|
|
42b4c8eb25 | ||
|
|
5c3af4861b | ||
|
|
93ccf6b68d | ||
|
|
dc7b32f61d | ||
|
|
9ad8ce84a8 | ||
|
|
2ad38a256d | ||
|
|
c3f1c61dbe | ||
|
|
227089828d | ||
|
|
ae9279670d | ||
|
|
d2e38059ae | ||
|
|
674abdaffc | ||
|
|
b200136fcc | ||
|
|
d17502a3e6 | ||
|
|
c5a4f595a3 | ||
|
|
6b92fe3b91 | ||
|
|
ff0cfb41aa | ||
|
|
04e870ec3e | ||
|
|
8dbab57eea | ||
|
|
fb6020965e | ||
|
|
6e75060586 | ||
|
|
3799561d29 | ||
|
|
bdf8146460 | ||
|
|
ad2398fdb1 | ||
|
|
1ca748d939 | ||
|
|
6cdff52aea | ||
|
|
abf0c05b30 | ||
|
|
4e3be2565d | ||
|
|
336912e2d4 | ||
|
|
2ce2e1ae81 | ||
|
|
a44b4fc401 | ||
|
|
1ac718dc29 | ||
|
|
49ec780bf6 | ||
|
|
1dfc733639 | ||
|
|
2470cdfb9e | ||
|
|
b28585cdc3 | ||
|
|
298f6d6b26 | ||
|
|
04f4e45e3e | ||
|
|
b4ee5eb756 | ||
|
|
abb203785f | ||
|
|
1c874acf8e | ||
|
|
22d5e6810a | ||
|
|
0f05a797f7 | ||
|
|
c16d0688db | ||
|
|
fe57bdd25b | ||
|
|
0b4b76ccef | ||
|
|
6308577b27 | ||
|
|
e4639db608 | ||
|
|
9a03f0a699 | ||
|
|
3c0467684a | ||
|
|
bac86f2f41 | ||
|
|
1a887b84e1 | ||
|
|
1a3e754aee | ||
|
|
8193e914cd | ||
|
|
101169bbba | ||
|
|
1f6aa5cea0 | ||
|
|
e4ca8e5c7c | ||
|
|
2c15776323 | ||
|
|
c6b0234335 | ||
|
|
dce4d33e87 | ||
|
|
f939818579 | ||
|
|
07a15aa307 | ||
|
|
77e7300a4e | ||
|
|
a4a82906b9 | ||
|
|
8b0a09438f | ||
|
|
26dfa43f87 | ||
|
|
5fbdd480c0 | ||
|
|
2f44686915 | ||
|
|
01059ca925 | ||
|
|
1de5e09f78 | ||
|
|
c6ba891676 | ||
|
|
62fbfc2f50 | ||
|
|
6a02a78342 | ||
|
|
c43bf5f692 | ||
|
|
79d52607b2 | ||
|
|
18fb6bc786 | ||
|
|
4be242e03c | ||
|
|
629b9c3241 | ||
|
|
cc82e4fb09 | ||
|
|
85953f9bf9 | ||
|
|
45b99c1223 | ||
|
|
af76072dbd | ||
|
|
3b7ca9fdba | ||
|
|
2e58f2eb4b | ||
|
|
ea243d2ea9 | ||
|
|
4cd9b035c7 | ||
|
|
a9773cd5f6 | ||
|
|
bb0a15ea85 | ||
|
|
a5fce9f76b | ||
|
|
09d376434e | ||
|
|
6351823847 | ||
|
|
d76994c16c | ||
|
|
693d39cf9c | ||
|
|
52e625e6a8 | ||
|
|
6ddca5edab | ||
|
|
0babe29777 | ||
|
|
fcf6f344bb | ||
|
|
f71d4457e0 | ||
|
|
3698534cb6 | ||
|
|
6ee90b280f | ||
|
|
d71067c57a | ||
|
|
f2955b204a | ||
|
|
0eca9ef242 | ||
|
|
f15893e1bd | ||
|
|
ba55a05b73 | ||
|
|
c687d2c7a4 | ||
|
|
f117e39e0d | ||
|
|
e4e126ce70 | ||
|
|
5054c1cab4 | ||
|
|
bb27defe19 | ||
|
|
ad891783f2 | ||
|
|
bd8e4ec9c7 | ||
|
|
56bf242952 | ||
|
|
b05973ad54 | ||
|
|
eb6822c2ca | ||
|
|
69e5d23af7 | ||
|
|
94d641664a | ||
|
|
b11de91341 | ||
|
|
f1a895f5cf | ||
|
|
d7fc46eb8a | ||
|
|
b5ebedc782 | ||
|
|
c012d1fe9e | ||
|
|
b92af6e16b | ||
|
|
43de9ea350 | ||
|
|
9bc1460bca | ||
|
|
acd43b3ee6 | ||
|
|
0745fd5c6c | ||
|
|
592df75970 | ||
|
|
545ef43527 | ||
|
|
fee332c6dc | ||
|
|
6ab8762032 | ||
|
|
704fd74f2b | ||
|
|
d23d7f9916 | ||
|
|
f1f9bf8a38 | ||
|
|
b0e495309d | ||
|
|
1e11759ffd | ||
|
|
30a9e56179 | ||
|
|
a3883873ce | ||
|
|
9c99f64bda | ||
|
|
d87fb4cab8 | ||
|
|
1f1e466e88 | ||
|
|
715f735051 | ||
|
|
4184031fab | ||
|
|
9ef77ef39c | ||
|
|
7e12070078 | ||
|
|
a5c0d28e10 | ||
|
|
e0c849739d | ||
|
|
a0f421f6eb | ||
|
|
d703d86055 | ||
|
|
58ee037434 | ||
|
|
6d006849aa | ||
|
|
8fcedda777 | ||
|
|
45e801df00 | ||
|
|
02dbda7fac | ||
|
|
15f799d645 | ||
|
|
365bd26d3c | ||
|
|
e344b9e864 | ||
|
|
a4f1d8e6ea | ||
|
|
1657870198 | ||
|
|
d90f3e1479 | ||
|
|
32caaf841d | ||
|
|
c84b10e5bb | ||
|
|
f4504ac5a2 | ||
|
|
e578482657 | ||
|
|
d941e11496 | ||
|
|
2db9f4acbe | ||
|
|
4a9a6598f0 | ||
|
|
2ec3761ee7 | ||
|
|
ad7a7fac4b | ||
|
|
2b09353851 | ||
|
|
7710e3111d | ||
|
|
0a35750777 | ||
|
|
6b6dfd7fe6 | ||
|
|
2a5cb4e974 | ||
|
|
2159b143c4 | ||
|
|
df954de178 | ||
|
|
cbf87cfed9 | ||
|
|
c50b328eb9 | ||
|
|
2183d21b12 | ||
|
|
ca8a6763ea | ||
|
|
c2d9c765ab | ||
|
|
95c4b5228d | ||
|
|
b60c0b2967 | ||
|
|
6ea8fe462a | ||
|
|
a329c83c0a | ||
|
|
41210aa925 | ||
|
|
c1b968cf65 | ||
|
|
9efbd84d74 | ||
|
|
261cd8ea9b | ||
|
|
5261ce807f | ||
|
|
c1bc2621fa | ||
|
|
9e291b8477 | ||
|
|
ff619c2925 | ||
|
|
1f99d840af | ||
|
|
e8c775e330 | ||
|
|
631b0ab956 | ||
|
|
f3779ad3bd |
2392
ChangeLog.pre-2-10
2392
ChangeLog.pre-2-10
File diff suppressed because it is too large
Load Diff
2392
ChangeLog.pre-2-4
2392
ChangeLog.pre-2-4
File diff suppressed because it is too large
Load Diff
2392
ChangeLog.pre-2-6
2392
ChangeLog.pre-2-6
File diff suppressed because it is too large
Load Diff
2392
ChangeLog.pre-2-8
2392
ChangeLog.pre-2-8
File diff suppressed because it is too large
Load Diff
4
INSTALL
4
INSTALL
@@ -22,8 +22,8 @@ GTK+ requires the following packages:
|
||||
Simple install procedure
|
||||
========================
|
||||
|
||||
% gzip -cd gtk+-2.2.0.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-2.2.0 # change to the toplevel directory
|
||||
% gzip -cd gtk+-2.2.3.tar.gz | tar xvf - # unpack the sources
|
||||
% cd gtk+-2.2.3 # change to the toplevel directory
|
||||
% ./configure # run the `configure' script
|
||||
% make # build GTK
|
||||
[ Become root if necessary ]
|
||||
|
||||
175
NEWS
175
NEWS
@@ -1,3 +1,178 @@
|
||||
Overview of Changes in GTK+ 2.2.3
|
||||
=================================
|
||||
* GdkPixbuf [Matthias Clasen]
|
||||
- Fix some problems with overflows when scaling down [Tomas Ögren]
|
||||
- Many GIF bug fixes [Matthias, Federico Mena Quintero]
|
||||
- Prefer 32-bpp ICOs, fix bugs with them
|
||||
- Fix problem with absolute filenames and gdk-pixbuf-query-loaders
|
||||
[Jens Elker]
|
||||
- Make gdk-pixbuf-csource include alignment magic [Brian Cameron]
|
||||
* Win32 [Tor Lillqvist]
|
||||
- Add multiple monitor support
|
||||
- Major event and key handling rewrite, including IME fixes
|
||||
- Fix handling of toplevel window positions
|
||||
- Add support for all window geometry hints (gridded geometry, etc.)
|
||||
- Fix DND to ignore drag window [Tony M Brown, Herman Bloggs]
|
||||
- Fix GdkImage memory leak [J. Ali Harlow]
|
||||
- Remove leftover OwnerGrabButtonMask emulation (fixes lots)
|
||||
- Misc bug fixes [Many from Hans Breuer, Tim Evans]
|
||||
- Build fixes and improvements [Peter Zelezny]
|
||||
* X11
|
||||
- Fix extremely common crash where we interpreted the timestamp
|
||||
field of a XKB event as a window ID and found a pixmap that matched.
|
||||
[Owen Taylor, with essential backtrace from Kjartan Maraas]
|
||||
- Fix CapsLock and NumLock for non-XKB [Robert Basch]
|
||||
- Fix problems with, eg. Ctrl-Alt-Backspace hiding Cntrl-Backspace [Owen]
|
||||
- Workaround Xinerama servers reporting wrong depths [Owen]
|
||||
* GtkTreeView [Kristian Rietveld]
|
||||
- Fix scrolling once more [Pedro Gimeno, Michael Natterer, Timo Sirainen]
|
||||
- Don't get confused by the Control key when handling selection
|
||||
from an accelerator like <Control>B [Michael Natterer]
|
||||
- Many misc fixes [Matthias, Marco Pesenti Gritti, Tim Janik, Alex Larsson,
|
||||
Tim-Philipp Müller, Michael Natterer, Josh Parsons, Yann Rouillard,
|
||||
Rene Seindel, Owen Taylor, Alp Toker, Morten Welinder]
|
||||
* Input methods
|
||||
- Handle input methods exiting and starting while the
|
||||
app is running [Hidetoshi Tajima]
|
||||
- Fix infinite loop when closing input methods [Owen,
|
||||
Takuro Ashie, Hidetoshi]
|
||||
- Add a 'cedilla' input method with c+acute => cedilla and use
|
||||
as the default for languages that use cedilla. [Gustavo De Nardin,
|
||||
Owen, Fco. Javier F. Serrador]
|
||||
- Fix status window for multihead [Owen, James Su]
|
||||
- Remember imcontext attributes when switching methods [Owen,
|
||||
Botond Botyanszki]
|
||||
* GtkFileSelection [Owen]
|
||||
- Fix selection of "UntitledN" on initial map [Mark Finlay]
|
||||
- Fix an annoying bug with cursor positioning on failed completion
|
||||
- Misc Fixes [Owen, Tor]
|
||||
* Other widgets
|
||||
- Fix problem with GtkOptionMenus coming up in the wrong place [Kristian]
|
||||
- Fix problem with spinbuttons not getting enough space [Morten Welinder,
|
||||
Kristian]
|
||||
- Fix an infinite loop when resizing GtkTextView [Owen, Frederic Crozat]
|
||||
- Don't include menu labels in gtk_notebook_forall [Owen]
|
||||
- Fix problem with XEMBED (GtkPlug) clients that don't take focus stealing
|
||||
focus [Owen]
|
||||
- Accept color drops with wrong format from KDE [Matthias]
|
||||
* Fix problem from gnome-theme-manager playing tricks and
|
||||
making event->window a pixmap. [Anders Carlsson]
|
||||
* Ignore Caps-lock when matching accelerators
|
||||
* Fix 5-year-old bug where toplevels didn't fully refresh properly
|
||||
on theme change [Owen, Rajkumar Siva]
|
||||
* Don't require precompiled gdk-pixbuf-csource when cross-compiling
|
||||
from a tarball [Owen]
|
||||
* Documentation improvements [Matthias, Noah Levitt, Tor, Doug Quale,
|
||||
Morten Welinder]
|
||||
* Misc bug fixes [Keith Bissett, Botond Botyanszki, Damien Carbery,
|
||||
Arno Charlet, Felipe Heidrich, Charles Kerr, George Lebl, Noah, Tor,
|
||||
Callum McKenzie, Michael Meeks, Denis Mikhalkin, Thomas Mirlacher,
|
||||
Kristian, Masahiro Sakai, Soeren Sandmann, Benedikt Spranger, Owen,
|
||||
Luis Villa]
|
||||
* New and updated translations (ar,az,cs,cy,be,de,es,fi,fr,he,hi,hu,id,is,it,
|
||||
ko,lt,ml,mn,nl,ne,no,pl,pt,pt_BR,ru,sk,sr,sr@Latn,ta,wa,zh_TW,zh_CN)
|
||||
|
||||
Overview of Changes in GTK+ 2.2.2
|
||||
=================================
|
||||
|
||||
* GdkPixbuf [Matthias Clasen]
|
||||
- Fix animation of slow-loading progressive GIFS
|
||||
- Fix long-standing animated GIF display bug with transparency
|
||||
- Misc bug and portability fixes [Rick Jones, Tim Mooney, Marijn Ross]
|
||||
* GDK [Owen Taylor]
|
||||
- Draw continuous underlines between Pango layout runs when
|
||||
possible [Kang Jeong-Hee]
|
||||
- Fix gdk_pixbuf_from_drawable() for big endian [Christian Petig]
|
||||
Major rewrite of 16-bit handling for pixbuf_from_drawable()
|
||||
* X11 backend [Owen]
|
||||
- Fix build on X11R5 [Albert Chin]
|
||||
- Fix switching keyboard layouts while running [Egmont Koblinger]
|
||||
- Work around RENDER extension bugs on certain Sun X servers [Morten Welinder]
|
||||
- Zero unused fields in client messages we send Lubos Lunak]
|
||||
- Fix occasional segfault when drawing pixbufs [Hans Petter Jansson]
|
||||
- Fix wrong initializaiton that was keeping XShm from being used.
|
||||
* Win32 backend [Tor Lillqvist]
|
||||
- Tweak line drawing
|
||||
- Mouse/cursor fixes [Allin Cottrell]
|
||||
- Better handling of floppy drives in GtkFileSelection
|
||||
- Misc fixes [Arnaud Charlet, Cedric Gustin, Martyn Russell]
|
||||
* Input methods [Hidetoshi Tajima]
|
||||
- Add rules for Greek accents to GtkIMContextSimple [Vasilis Vasaitis]
|
||||
- Fix sorting of rules in GtkIMContextSimple [Vasilis]
|
||||
- Miscellaneous GtkIMContextXIM fixes
|
||||
- Fix translation of input context names
|
||||
* Fix keyboard accelerators/bindings on Numeric Keypad [Owen, Olivier Ripoll]
|
||||
* Add Delete to GtkEntry context menu, Delete/Select All
|
||||
to GtkTextView context menu [Matthias]
|
||||
* Keynav tweaks in GtkFileSelection, GtkColorSel [Matthias]
|
||||
* Add C-A-PgUp/Down as alternative notebook page switching keys [Matthias]
|
||||
* GtkTextView
|
||||
- Fix redrawing on color-only changes [Owen, Gustavo Giráldez]
|
||||
- Don't scroll to cursor on focus in [Paolo Maggi]
|
||||
- Fix spot location reported to input method [Owen, TOKUNAGA Hiroyuki,
|
||||
Yao Zhang]
|
||||
- Miscellaneous bug fixes [Torbjörn Andersson, Matthias, Manual Clos,
|
||||
Padraig O'Briain, Owen]
|
||||
* GtkTreeView [Kristian Rietveld]
|
||||
- Fix prelighting [Sven Neumann]
|
||||
- Set drag cursor earlier to allow apps to override [Daniel Elstner]
|
||||
- Speed up insertions into GtkTreeModelSort [Owen, Jonathan Blandford]
|
||||
- Get background/cell area handling right in GtkTreeViewColumn [Vasco
|
||||
Alexandre da Silva Costa]
|
||||
- Bug fixes [Benjamin Bayart, Jonathan Blandford, Peter Bloomfield,
|
||||
Dave Cook, Felipe Heidrich, Richard Hult, Markus Lausser, Michael Natterer,
|
||||
Mariano Suarez-Alvarez, Owen]
|
||||
* Fix handling of border width for GtkToolbar [Rodney Dawes]
|
||||
* Rewrite adjustment handling of GtkViewport, fixing many bugs
|
||||
[Owen, Thomas Leonard, Michael]
|
||||
* Misc bug fixes [Dennis Björklund, Jonathan, Dave Bordoley, Rich Burridge,
|
||||
Anders Carlsson, Arnaud, Matthias, Vasco Alexandre da Silva Costa,
|
||||
Tim Evans, Larry Ewing, John Finlay, Jeff Franks, Jody Goldberg,
|
||||
Jason D. Hildebrand, Charles Kerr, Alex Larsson, Noah Levitt, Xan Lopez,
|
||||
Loban Rahman, Richard Reich, Soeren Sandmann, Charles Schmidt,
|
||||
Rajkumar Siva, Owen, Sergey V. Udaltsov, Morten Welinder, Michael Zucchi]
|
||||
* Code cleanups [Matthias, Glynn Foster, Britton Kerin, Sven Neumann,
|
||||
Doug Quale, Manish Singh, Morten Welinder]
|
||||
* Switch to using libtool-1.5
|
||||
* Build fixes [Matthias, J. Ali Harlow, Rich Kinder, Jon Nall, Sven,
|
||||
Christian Rose]
|
||||
* Documentation improvements [Matthias, Noah Levitt, Sven Neumann]
|
||||
* New and updated translations (am,az,be,ca,cs,cy,da,de,el,es,fa,fi,fr,id,
|
||||
it,ko,li,ml,mn,ms,nl,no,pl,pt,sr,sr@Latn,sv,ta,uk,yi,zh_TW)
|
||||
|
||||
Overview of Changes in GTK+ 2.2.1
|
||||
=================================
|
||||
* Win32 [Tor Lillqvist]
|
||||
- Improve setting of window position / decorations
|
||||
- Implement gdk_pixmap_foreign_new() [Naofumi Yasufuku]
|
||||
- Fix various file selection bugs
|
||||
- Improve scheme for locating pixbuf loader modules
|
||||
- Miscellaneous fixes [Alex Shaduri, Kenichi SUTO, Ed Woods]
|
||||
* GtkTreeView [Kristian Rietveld]
|
||||
- made GtkTreeSortable work as the documentation advertises [Jarek Dukat]
|
||||
- fixed gtk_tree_view_set_sort_column_id so you can disable sorting [Soeren
|
||||
Sandmann, Jarek Dukat]
|
||||
- TreeView search now works on all values transformable by GValue and not
|
||||
just strings [Muktha Narayan]
|
||||
- _move/_swap fixage in the Stores [Matthew Tuck, Paolo Maggi]
|
||||
- a lot of misc bug fixes [Alex Duggan, Carlos Garnacho Parro, Hans Petter
|
||||
Jansson, Kjartan Maraas, Soeren, Dave Camp, Murray Cumming, Dave Cook,
|
||||
Gaël Le Mignot, Vasco Alexandre da Silva Costa]
|
||||
* GtkTextView [Matthias Clasen]
|
||||
- Fix keynav with invisible cursor
|
||||
- Fix misdrawing of cursor [Owen Taylor] and selection
|
||||
- Many miscellaneous fixes [Narayana Pattipati, Daniel Elstner]
|
||||
* Fix problem with accidental inclusion of a main() [Matthias]
|
||||
* Documentation improvements [Matthias, Havoc Pennington]
|
||||
* Fix problem with GtkColorsel and pixmap themes [Daniel]
|
||||
* Fix race condition with GdkRGB in PseudoColor [Shivaram Upadhyayula]
|
||||
* Warning fixes [Manish Singh]
|
||||
* configure fixes [Akira Tagoh]
|
||||
* New and updated translations (ca,de,es,et,ko,mn,pl,pt,vi,zh_CN)
|
||||
* Miscellaneous bug fixes [Matthias, Daniel, Martin Gansser, Louis Garcia,
|
||||
Tommi Komulainen, Thomas Leonard, Ian Peters, Arvind Samptur,
|
||||
Soeren Sandmann, Hidetoshi Tajima, Owen]
|
||||
|
||||
Overview of Changes in GTK+ 2.2.0
|
||||
=================================
|
||||
* Fix problem with the DND code and event filters [Bolian Yin, Owen Taylor]
|
||||
|
||||
2
README
2
README
@@ -1,7 +1,7 @@
|
||||
General Information
|
||||
===================
|
||||
|
||||
This is GTK+ version 2.2.0. GTK+ is a multi-platform toolkit for
|
||||
This is GTK+ version 2.2.3. GTK+ is a multi-platform toolkit for
|
||||
creating graphical user interfaces. Offering a complete set of widgets,
|
||||
GTK+ is suitable for projects ranging from small one-off projects to
|
||||
complete application suites.
|
||||
|
||||
23
README.win32
23
README.win32
@@ -67,13 +67,22 @@ references to the wntab32x library from the makefile before building.
|
||||
Libintl
|
||||
=======
|
||||
|
||||
GTK wants to be built with the GNU "intl" library for
|
||||
internationalisation (i18n). Get the version ported to Win32 (not a
|
||||
very big deal) from the web site mentioned above. The "intl" library
|
||||
as gets built as a DLL called libintl-1.dll. If you don't want any
|
||||
i18n stuff, undefine ENABLE_NLS, HAVE_GETTEXT and HAVE_LIBINTL in the
|
||||
config.h.win32 file, and remove references to the intl library from
|
||||
the makefiles.
|
||||
Before building GTK+ you must also have GNU gettext. Get prebuilt
|
||||
binaries of gettext-runtime (0.12.1 or newer) from your nearest GNU
|
||||
ftp mirror. If you use gcc, you will also have to edit the libintl.h
|
||||
file from gettext a tiny bit: Change the
|
||||
|
||||
# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined __cplusplus)
|
||||
|
||||
line to
|
||||
|
||||
# if __GNUC__ >= 2 && !defined __APPLE_CC__ && !defined __MINGW32__ && (defined __STDC__ || defined __cplusplus)
|
||||
|
||||
around line 102.
|
||||
|
||||
If you use libtool, you will also have to copy intl.lib to libintl.a
|
||||
so that libtool will find them. Alternatively, use pexports and
|
||||
dlltool to generate a gcc import library.
|
||||
|
||||
ActiveIMM
|
||||
=========
|
||||
|
||||
@@ -13,10 +13,10 @@ FILE=gdk
|
||||
DIE=0
|
||||
|
||||
have_libtool=false
|
||||
if libtool --version < /dev/null > /dev/null 2>&1 ; then
|
||||
libtool_version=`libtoolize --version | libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
|
||||
if libtoolize --version < /dev/null > /dev/null 2>&1 ; then
|
||||
libtool_version=`libtoolize --version | sed 's/^[^0-9]*\([0-9.][0-9.]*\).*/\1/'`
|
||||
case $libtool_version in
|
||||
1.4*)
|
||||
1.4*|1.5*)
|
||||
have_libtool=true
|
||||
;;
|
||||
esac
|
||||
@@ -109,4 +109,4 @@ if test -z "$AUTOGEN_SUBDIR_MODE"; then
|
||||
|
||||
echo
|
||||
echo "Now type 'make' to compile $PROJECT."
|
||||
fi
|
||||
fi
|
||||
|
||||
109
configure.in
109
configure.in
@@ -20,7 +20,6 @@ cflags_set=${CFLAGS+set}
|
||||
|
||||
dnl we 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?)
|
||||
GLIB_AC_DIVERT_BEFORE_HELP([
|
||||
#
|
||||
# Making releases:
|
||||
# GTK_MICRO_VERSION += 1;
|
||||
@@ -30,15 +29,29 @@ GLIB_AC_DIVERT_BEFORE_HELP([
|
||||
# if backwards compatibility has been broken,
|
||||
# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
|
||||
#
|
||||
GTK_MAJOR_VERSION=2
|
||||
GTK_MINOR_VERSION=2
|
||||
GTK_MICRO_VERSION=0
|
||||
GTK_INTERFACE_AGE=0
|
||||
GTK_BINARY_AGE=200
|
||||
m4_define([gtk_major_version], [2])
|
||||
m4_define([gtk_minor_version], [2])
|
||||
m4_define([gtk_micro_version], [3])
|
||||
m4_define([gtk_interface_age], [3])
|
||||
|
||||
# if the minor version number is odd, then we want debugging. Otherwise
|
||||
# we only want minimal debugging support.
|
||||
m4_define([gtk_debug_default],
|
||||
[m4_if(m4_eval(gtk_minor_version % 2), [1], [yes], [minimum])])dnl
|
||||
|
||||
GTK_MAJOR_VERSION=gtk_major_version
|
||||
GTK_MINOR_VERSION=gtk_minor_version
|
||||
GTK_MICRO_VERSION=gtk_micro_version
|
||||
GTK_INTERFACE_AGE=gtk_interface_age
|
||||
GTK_BINARY_AGE=`expr 100 '*' $GTK_MINOR_VERSION + $GTK_MICRO_VERSION`
|
||||
GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
|
||||
dnl This is the X.Y used in -lgtk-FOO-X.Y
|
||||
GTK_API_VERSION=2.0
|
||||
])dnl
|
||||
|
||||
# if the minor version number is odd, then we want debugging. Otherwise
|
||||
# we only want minimal debugging support.
|
||||
m4_define([glib_debug_default],
|
||||
[m4_if(m4_eval(glib_minor_version % 2), [1], [yes], [minimum])])dnl
|
||||
|
||||
AC_SUBST(GTK_MAJOR_VERSION)
|
||||
AC_SUBST(GTK_MINOR_VERSION)
|
||||
@@ -162,24 +175,12 @@ if test "$os_win32" = "yes"; then
|
||||
fi
|
||||
AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
|
||||
|
||||
dnl figure debugging default, prior to $ac_help setup
|
||||
dnl
|
||||
GLIB_AC_DIVERT_BEFORE_HELP([
|
||||
if test `expr $GTK_MINOR_VERSION \% 2` = 1 ; then
|
||||
debug_default=yes
|
||||
else
|
||||
debug_default=minimum
|
||||
fi
|
||||
])dnl
|
||||
|
||||
dnl declare --enable-* args and collect ac_help strings
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
|
||||
AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging @<:@default=gtk_debug_default@:>@],,enable_debug=gtk_debug_default)
|
||||
AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
|
||||
echo $enable_shm, enable_shm="yes")
|
||||
AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
|
||||
, enable_ansi=no)
|
||||
AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
|
||||
, enable_xim="yes")
|
||||
AC_ARG_ENABLE(xkb, [ --enable-xkb support XKB [default=maybe]],
|
||||
, enable_xkb="maybe")
|
||||
AC_ARG_ENABLE(rebuilds, [ --disable-rebuilds disable all source autogeneration rules],,enable_rebuilds=yes)
|
||||
@@ -389,7 +390,7 @@ AC_SUBST(STRIP_BEGIN)
|
||||
AC_SUBST(STRIP_END)
|
||||
|
||||
# i18n stuff
|
||||
ALL_LINGUAS="az be bg ca cs cy da de el en_GB es et eu fa fi fr ga gl he hi hr hu ia id it ja ko lt lv ml mn ms nl nn no pl pt pt_BR ro ru sk sl sp sr sv tr uk vi wa yi zh_TW zh_CN"
|
||||
ALL_LINGUAS="am ar az be bg ca cs cy da de el en_GB es et eu fa fi fr ga gl he hi hr hu ia id is it ja ko lt lv mk ml mn ms ne nl nn no pl pt pt_BR ro ru sk sl sr sr@Latn sv ta tr uk vi wa yi zh_TW zh_CN"
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
LIBS="$LIBS $INTLLIBS"
|
||||
|
||||
@@ -778,12 +779,6 @@ dnl Test for libpng
|
||||
*** from CVS.])
|
||||
fi
|
||||
|
||||
REBUILD_PNGS=\#
|
||||
if test -z "$LIBPNG"; then
|
||||
REBUILD_PNGS=
|
||||
fi
|
||||
AC_SUBST(REBUILD_PNGS)
|
||||
|
||||
AC_SUBST(LIBTIFF)
|
||||
AC_SUBST(LIBJPEG)
|
||||
AC_SUBST(LIBPNG)
|
||||
@@ -898,6 +893,11 @@ fi
|
||||
|
||||
AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
|
||||
|
||||
REBUILD_PNGS=
|
||||
if test -z "$LIBPNG"; then
|
||||
REBUILD_PNGS=#
|
||||
fi
|
||||
|
||||
dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
|
||||
|
||||
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
|
||||
@@ -905,10 +905,20 @@ AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
|
||||
if test $cross_compiling = yes; then
|
||||
AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
|
||||
if test x$GDK_PIXBUF_CSOURCE = xno; then
|
||||
AC_MSG_ERROR(Could not find a gdk-pixbuf-csource in your PATH)
|
||||
REBUILD_PNGS=#
|
||||
fi
|
||||
fi
|
||||
|
||||
if test ! -f $srcdir/gtk/stock-icons/gtkstockpixbufs.h &&
|
||||
test "x$REBUILD_PNGS" = "x#" ; then
|
||||
AC_MSG_ERROR([
|
||||
*** gtkstockpixbufs.h is not in the tree, and cannot be built
|
||||
*** because you don't have libpng, or (when cross-compiling) you
|
||||
*** don't have a prebuilt gdk-pixbuf-csource on the host system.])
|
||||
fi
|
||||
|
||||
AC_SUBST(REBUILD_PNGS)
|
||||
|
||||
GDK_PIXBUF_PACKAGES="gmodule-2.0 gobject-2.0"
|
||||
GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB"
|
||||
GDK_PIXBUF_EXTRA_CFLAGS=
|
||||
@@ -928,6 +938,7 @@ AC_SUBST(GDK_PIXBUF_DEP_CFLAGS)
|
||||
|
||||
GDK_EXTRA_LIBS=$GDK_WLIBS
|
||||
GDK_EXTRA_CFLAGS=
|
||||
GTK_DEP_LIBS_FOR_X=
|
||||
|
||||
FREETYPE_LIBS=
|
||||
FREETYPE_CFLAGS=
|
||||
@@ -993,8 +1004,10 @@ if test "x$gdktarget" = "xx11"; then
|
||||
|
||||
AM_CONDITIONAL(HAVE_XFT, $have_xft)
|
||||
|
||||
if $PKG_CONFIG --exists xft ; then
|
||||
AC_DEFINE(HAVE_XFT2, 1, [Define if we have Xft, version 2])
|
||||
if $have_xft; then
|
||||
if $PKG_CONFIG --exists xft ; then
|
||||
AC_DEFINE(HAVE_XFT2, 1, [Define if we have Xft, version 2])
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
@@ -1012,13 +1025,12 @@ if test "x$gdktarget" = "xx11"; then
|
||||
x_cflags="`$PKG_CONFIG --cflags $PANGO_PACKAGES`"
|
||||
x_extra_libs=
|
||||
|
||||
AC_PATH_XTRA
|
||||
if test x$no_x = xyes ; then
|
||||
AC_MSG_ERROR([X development libraries not found])
|
||||
fi
|
||||
|
||||
if test $pango_omitted_x_deps = yes ; then
|
||||
AC_PATH_XTRA
|
||||
|
||||
if test x$no_x = xyes ; then
|
||||
AC_MSG_ERROR([X development libraries not found])
|
||||
fi
|
||||
|
||||
x_libs="$X_LIBS -lX11 $X_EXTRA_LIBS"
|
||||
|
||||
#
|
||||
@@ -1091,6 +1103,11 @@ if test "x$gdktarget" = "xx11"; then
|
||||
# Don't ever pull in the pangoxft libraries for gdk-pixbuf-x11
|
||||
GDK_PIXBUF_XLIB_EXTRA_LIBS="$x_extra_libs $x_libs"
|
||||
|
||||
# GTK+ uses some X calls, so needs to link against X directly
|
||||
if test $enable_explicit_deps != yes ; then
|
||||
GTK_DEP_LIBS_FOR_X="$X_LIBS -lX11 $X_EXTRA_LIBS"
|
||||
fi
|
||||
|
||||
# Check for Xinerama extension (Solaris impl or Xfree impl)
|
||||
|
||||
gtk_save_cppflags="$CPPFLAGS"
|
||||
@@ -1151,11 +1168,20 @@ if test "x$gdktarget" = "xx11"; then
|
||||
,
|
||||
$x_libs_for_checks)
|
||||
|
||||
# Check for XIM support.
|
||||
# Generic X11R6 check needed for XIM support; we could
|
||||
# probably use this to replace the above, but we'll
|
||||
# leave the separate XConvertCase check for clarity
|
||||
|
||||
if test "x$enable_xim" = "xyes"; then
|
||||
GTK_XIM_FLAGS="-DUSE_XIM"
|
||||
have_x11r6=false
|
||||
AC_CHECK_LIB(X11, XAddConnectionWatch,
|
||||
have_x11r6=true,
|
||||
,
|
||||
$x_libs_for_checks)
|
||||
|
||||
if $have_x11r6; then
|
||||
AC_DEFINE(HAVE_X11R6,1,[Define if we have X11R6])
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_X11R6, $have_x11r6)
|
||||
|
||||
# Check for XKB support.
|
||||
|
||||
@@ -1242,6 +1268,7 @@ else
|
||||
AM_CONDITIONAL(HAVE_XFT, false)
|
||||
AM_CONDITIONAL(XINPUT_XFREE, false)
|
||||
AM_CONDITIONAL(USE_X11, false)
|
||||
AM_CONDITIONAL(HAVE_X11R6, false)
|
||||
fi
|
||||
|
||||
if test "x$gdktarget" = "xwin32"; then
|
||||
@@ -1367,7 +1394,7 @@ GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PAC
|
||||
|
||||
#
|
||||
# If we aren't writing explicit dependencies, then don't put the extra libraries we need
|
||||
# into the pkg-config files
|
||||
a# into the pkg-config files
|
||||
#
|
||||
if test $enable_explicit_deps != yes ; then
|
||||
GDK_EXTRA_LIBS=
|
||||
@@ -1412,7 +1439,7 @@ fi
|
||||
GTK_PACKAGES=atk
|
||||
GTK_EXTRA_LIBS=
|
||||
GTK_EXTRA_CFLAGS=
|
||||
GTK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
|
||||
GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
|
||||
GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
|
||||
|
||||
AC_SUBST(GTK_PACKAGES)
|
||||
|
||||
@@ -34,11 +34,13 @@ noinst_PROGRAMS = \
|
||||
|
||||
if CROSS_COMPILING
|
||||
pixbuf_csource=$(GDK_PIXBUF_CSOURCE)
|
||||
pixbuf_csource_deps=
|
||||
else
|
||||
pixbuf_csource=GDK_PIXBUF_MODULE_FILE=$$topdir/gdk-pixbuf/gdk-pixbuf.loaders $$topdir/gdk-pixbuf/gdk-pixbuf-csource
|
||||
pixbuf_csource_deps=$(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource $(top_builddir)/gdk-pixbuf/gdk-pixbuf.loaders
|
||||
endif
|
||||
|
||||
test-inline-pixbufs.h: $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource $(top_builddir)/gdk-pixbuf/gdk-pixbuf.loaders apple-red.png gnome-foot.png
|
||||
test-inline-pixbufs.h: $(pixbuf_csource_deps) apple-red.png gnome-foot.png
|
||||
(topdir=`cd $(top_builddir) && pwd` ; curdir=`pwd` ; \
|
||||
cd $(srcdir) && \
|
||||
$(pixbuf_csource) --build-list \
|
||||
|
||||
@@ -52,11 +52,10 @@ bin_PROGRAMS = gtk-demo
|
||||
BUILT_SOURCES = demos.h
|
||||
|
||||
EXTRA_DIST = \
|
||||
geninclude.pl \
|
||||
$(IMAGEFILES)
|
||||
|
||||
demos.h: $(demos) geninclude.pl
|
||||
(cd $(srcdir) && $(PERL) ./geninclude.pl $(demos) > demos.h)
|
||||
(cwd=`pwd` && cd $(srcdir) && $(PERL) $$cwd/geninclude.pl $(demos) > demos.h)
|
||||
|
||||
gtk_demo_SOURCES = \
|
||||
$(demos) \
|
||||
|
||||
@@ -152,13 +152,11 @@ cell_edited (GtkCellRendererText *cell,
|
||||
GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
|
||||
GtkTreeIter iter;
|
||||
|
||||
gint *column;
|
||||
|
||||
column = g_object_get_data (G_OBJECT (cell), "column");
|
||||
gint column = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "column"));
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
|
||||
switch (GPOINTER_TO_INT (column))
|
||||
switch (column)
|
||||
{
|
||||
case COLUMN_NUMBER:
|
||||
{
|
||||
|
||||
@@ -1,163 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
print <<EOT;
|
||||
typedef GtkWidget *(*GDoDemoFunc) (void);
|
||||
|
||||
typedef struct _Demo Demo;
|
||||
|
||||
struct _Demo
|
||||
{
|
||||
gchar *title;
|
||||
gchar *filename;
|
||||
GDoDemoFunc func;
|
||||
Demo *children;
|
||||
};
|
||||
|
||||
EOT
|
||||
|
||||
for $file (@ARGV) {
|
||||
my %demo;
|
||||
|
||||
($basename = $file) =~ s/\.c$//;
|
||||
|
||||
open INFO_FILE, $file or die "Cannot open '$file'\n";
|
||||
$title = <INFO_FILE>;
|
||||
$title =~ s@^\s*/\*\s*@@;
|
||||
$title =~ s@\s*$@@;
|
||||
|
||||
close INFO_FILE;
|
||||
|
||||
print "GtkWidget *do_$basename (void);\n";
|
||||
|
||||
push @demos, {"title" => $title, "file" => $file,
|
||||
"func" => "do_$basename"};
|
||||
}
|
||||
|
||||
# generate a list of 'parent names'
|
||||
foreach $href (@demos) {
|
||||
if ($href->{"title"} =~ m|^([\w\s]+)/[\w\s]+$|) {
|
||||
my $parent_name = $1;
|
||||
my $do_next = 0;
|
||||
|
||||
# parent detected
|
||||
if (defined @parents) {
|
||||
foreach $foo (@parents) {
|
||||
if ($foo eq $parent_name) {
|
||||
$do_next = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ($do_next) {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
push @parents, $parent_name;
|
||||
|
||||
$tmp = (defined @child_arrays)?($#child_arrays + 1):0;
|
||||
push @child_arrays, "child$tmp";
|
||||
|
||||
push @demos, {"title" => $parent_name, "file" => "NULL",
|
||||
"func" => "NULL"};
|
||||
}
|
||||
}
|
||||
|
||||
if (defined @parents) {
|
||||
$i = 0;
|
||||
for ($i = 0; $i <= $#parents; $i++) {
|
||||
$first = 1;
|
||||
|
||||
print "\nDemo ", $child_arrays[$i], "[] = {\n";
|
||||
|
||||
$j = 0;
|
||||
for ($j = 0; $j <= $#demos; $j++) {
|
||||
$href = $demos[$j];
|
||||
|
||||
if (!defined $demos[$j]) {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($demos[$j]{"title"} =~ m|^$parents[$i]/([\w\s]+)$|) {
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
print ",\n";
|
||||
}
|
||||
|
||||
print qq ( { "$1", "$demos[$j]{file}", $demos[$j]{func}, NULL });
|
||||
|
||||
# hack ... ugly
|
||||
$demos[$j]{"title"} = "foo";
|
||||
}
|
||||
}
|
||||
|
||||
print ",\n";
|
||||
print qq ( { NULL } );
|
||||
print "\n};\n";
|
||||
}
|
||||
}
|
||||
|
||||
# sort @demos
|
||||
@demos_old = @demos;
|
||||
|
||||
@demos = sort {
|
||||
$a->{"title"} cmp $b->{"title"};
|
||||
} @demos_old;
|
||||
|
||||
# sort the child arrays
|
||||
if (defined @child_arrays) {
|
||||
for ($i = 0; $i <= $#child_arrays; $i++) {
|
||||
@foo_old = @{$child_arrays[$i]};
|
||||
|
||||
@{$child_arrays[$i]} = sort {
|
||||
$a->{"title"} cmp $b->{"title"};
|
||||
} @foo_old;
|
||||
}
|
||||
}
|
||||
|
||||
# toplevel
|
||||
print "\nDemo testgtk_demos[] = {\n";
|
||||
|
||||
$first = 1;
|
||||
foreach $href (@demos) {
|
||||
$handled = 0;
|
||||
|
||||
# ugly evil hack
|
||||
if ($href->{title} eq "foo") {
|
||||
next;
|
||||
}
|
||||
|
||||
if ($first) {
|
||||
$first = 0;
|
||||
} else {
|
||||
print ", \n";
|
||||
}
|
||||
|
||||
if (defined @parents) {
|
||||
for ($i = 0; $i <= $#parents; $i++) {
|
||||
if ($parents[$i] eq $href->{title}) {
|
||||
|
||||
if ($href->{file} eq 'NULL') {
|
||||
print qq ( { "$href->{title}", NULL, $href->{func}, $child_arrays[$i] });
|
||||
} else {
|
||||
print qq ( { "$href->{title}", "$href->{file}", $href->{func}, $child_arrays[$i] });
|
||||
}
|
||||
|
||||
$handled = 1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($handled) {
|
||||
next;
|
||||
}
|
||||
|
||||
print qq ( { "$href->{title}", "$href->{file}", $href->{func}, NULL });
|
||||
}
|
||||
|
||||
print ",\n";
|
||||
print qq ( { NULL } );
|
||||
print "\n};\n";
|
||||
|
||||
exit 0;
|
||||
@@ -45,7 +45,8 @@ demo_find_file (const char *base,
|
||||
{
|
||||
g_return_val_if_fail (err == NULL || *err == NULL, NULL);
|
||||
|
||||
if (g_file_test (base, G_FILE_TEST_EXISTS))
|
||||
if (g_file_test ("gtk-logo-rgb.gif", G_FILE_TEST_EXISTS) &&
|
||||
g_file_test (base, G_FILE_TEST_EXISTS))
|
||||
return g_strdup (base);
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,392 +0,0 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <demos.h>
|
||||
|
||||
static GtkTextBuffer *info_buffer;
|
||||
static GtkTextBuffer *source_buffer;
|
||||
|
||||
static gchar *current_file = NULL;
|
||||
|
||||
enum {
|
||||
TITLE_COLUMN,
|
||||
FILENAME_COLUMN,
|
||||
FUNC_COLUMN,
|
||||
ITALIC_COLUMN,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
gboolean
|
||||
read_line (FILE *stream, GString *str)
|
||||
{
|
||||
int n_read = 0;
|
||||
|
||||
flockfile (stream);
|
||||
|
||||
g_string_truncate (str, 0);
|
||||
|
||||
while (1)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = getc_unlocked (stream);
|
||||
|
||||
if (c == EOF)
|
||||
goto done;
|
||||
else
|
||||
n_read++;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '\r':
|
||||
case '\n':
|
||||
{
|
||||
int next_c = getc_unlocked (stream);
|
||||
|
||||
if (!(next_c == EOF ||
|
||||
(c == '\r' && next_c == '\n') ||
|
||||
(c == '\n' && next_c == '\r')))
|
||||
ungetc (next_c, stream);
|
||||
|
||||
goto done;
|
||||
}
|
||||
default:
|
||||
g_string_append_c (str, c);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
funlockfile (stream);
|
||||
|
||||
return n_read > 0;
|
||||
}
|
||||
|
||||
void
|
||||
load_file (const gchar *filename)
|
||||
{
|
||||
FILE *file;
|
||||
GtkTextIter start, end;
|
||||
GString *buffer = g_string_new (NULL);
|
||||
int state = 0;
|
||||
gboolean in_para = 0;
|
||||
|
||||
if (current_file && !strcmp (current_file, filename))
|
||||
return;
|
||||
|
||||
g_free (current_file);
|
||||
current_file = g_strdup (filename);
|
||||
|
||||
gtk_text_buffer_get_bounds (info_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (info_buffer, &start, &end);
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_delete (source_buffer, &start, &end);
|
||||
|
||||
file = fopen (filename, "r");
|
||||
if (!file)
|
||||
{
|
||||
g_warning ("Cannot open %s: %s\n", filename, g_strerror (errno));
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (info_buffer, &start, 0);
|
||||
while (read_line (file, buffer))
|
||||
{
|
||||
gchar *p = buffer->str;
|
||||
gchar *q;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case 0:
|
||||
/* Reading title */
|
||||
while (*p == '/' || *p == '*' || isspace (*p))
|
||||
p++;
|
||||
q = p + strlen (p);
|
||||
while (q > p && isspace (*(q - 1)))
|
||||
q--;
|
||||
|
||||
if (q > p)
|
||||
{
|
||||
int len_chars = g_utf8_pointer_to_offset (p, q);
|
||||
|
||||
end = start;
|
||||
|
||||
g_assert (strlen (p) >= q - p);
|
||||
gtk_text_buffer_insert (info_buffer, &end, p, q - p);
|
||||
start = end;
|
||||
|
||||
gtk_text_iter_backward_chars (&start, len_chars);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "title", &start, &end);
|
||||
|
||||
start = end;
|
||||
|
||||
state++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* Reading body of info section */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p == '*' && *(p + 1) == '/')
|
||||
{
|
||||
gtk_text_buffer_get_iter_at_offset (source_buffer, &start, 0);
|
||||
state++;
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
|
||||
while (*p == '*' || isspace (*p))
|
||||
p++;
|
||||
|
||||
len = strlen (p);
|
||||
while (isspace (*(p + len - 1)))
|
||||
len--;
|
||||
|
||||
if (len > 0)
|
||||
{
|
||||
if (in_para)
|
||||
gtk_text_buffer_insert (info_buffer, &start, " ", 1);
|
||||
|
||||
g_assert (strlen (p) >= len);
|
||||
gtk_text_buffer_insert (info_buffer, &start, p, len);
|
||||
in_para = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
in_para = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* Skipping blank lines */
|
||||
while (isspace (*p))
|
||||
p++;
|
||||
if (*p)
|
||||
{
|
||||
p = buffer->str;
|
||||
state++;
|
||||
/* Fall through */
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* Reading program body */
|
||||
gtk_text_buffer_insert (source_buffer, &start, p, -1);
|
||||
gtk_text_buffer_insert (info_buffer, &start, "\n", 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_bounds (source_buffer, &start, &end);
|
||||
gtk_text_buffer_apply_tag_by_name (info_buffer, "source", &start, &end);
|
||||
}
|
||||
|
||||
gboolean
|
||||
button_press_event_cb (GtkTreeView *tree_view,
|
||||
GdkEventButton *event,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
if (event->type == GDK_2BUTTON_PRESS)
|
||||
{
|
||||
GtkTreePath *path = NULL;
|
||||
|
||||
gtk_tree_view_get_path_at_pos (tree_view,
|
||||
event->window,
|
||||
event->x,
|
||||
event->y,
|
||||
&path,
|
||||
NULL);
|
||||
|
||||
if (path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean italic;
|
||||
GVoidFunc func;
|
||||
|
||||
gtk_tree_model_get_iter (model, &iter, path);
|
||||
gtk_tree_store_get (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
FUNC_COLUMN, &func,
|
||||
ITALIC_COLUMN, &italic,
|
||||
-1);
|
||||
(func) ();
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
ITALIC_COLUMN, !italic,
|
||||
-1);
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT (tree_view),
|
||||
"button_press_event");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
selection_cb (GtkTreeSelection *selection,
|
||||
GtkTreeModel *model)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GValue value = {0, };
|
||||
|
||||
if (! gtk_tree_selection_get_selected (selection, NULL, &iter))
|
||||
return;
|
||||
|
||||
gtk_tree_model_get_value (model, &iter,
|
||||
FILENAME_COLUMN,
|
||||
&value);
|
||||
load_file (g_value_get_string (&value));
|
||||
g_value_unset (&value);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_text (GtkTextBuffer **buffer,
|
||||
gboolean is_source)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
PangoFontDescription *font_desc;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_SHADOW_IN);
|
||||
|
||||
text_view = gtk_text_view_new ();
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
||||
|
||||
*buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), *buffer);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
font_desc = pango_font_description_from_string ("Courier 10");
|
||||
gtk_widget_modify_font (text_view, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
}
|
||||
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), !is_source);
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
/* Technically a list, but if we do go to 80 demos, we may want to move to a tree */
|
||||
static GtkWidget *
|
||||
create_tree (void)
|
||||
{
|
||||
GtkTreeSelection *selection;
|
||||
GtkCellRenderer *cell;
|
||||
GtkWidget *tree_view;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkTreeStore *model;
|
||||
GtkTreeIter iter;
|
||||
gint i;
|
||||
|
||||
model = gtk_tree_store_new_with_types (NUM_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_BOOLEAN);
|
||||
tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (model));
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
|
||||
|
||||
gtk_tree_selection_set_type (GTK_TREE_SELECTION (selection),
|
||||
GTK_TREE_SELECTION_SINGLE);
|
||||
gtk_widget_set_usize (tree_view, 200, -1);
|
||||
|
||||
for (i=0; i < G_N_ELEMENTS (testgtk_demos); i++)
|
||||
{
|
||||
gtk_tree_store_append (GTK_TREE_STORE (model), &iter, NULL);
|
||||
|
||||
gtk_tree_store_set (GTK_TREE_STORE (model),
|
||||
&iter,
|
||||
TITLE_COLUMN, testgtk_demos[i].title,
|
||||
FILENAME_COLUMN, testgtk_demos[i].filename,
|
||||
FUNC_COLUMN, testgtk_demos[i].func,
|
||||
ITALIC_COLUMN, FALSE,
|
||||
-1);
|
||||
}
|
||||
|
||||
cell = gtk_cell_renderer_text_new ();
|
||||
column = gtk_tree_view_column_new_with_attributes ("Widget",
|
||||
cell,
|
||||
"text", TITLE_COLUMN,
|
||||
"italic", ITALIC_COLUMN,
|
||||
NULL);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view),
|
||||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (selection), "selection_changed", selection_cb, model);
|
||||
gtk_signal_connect (GTK_OBJECT (tree_view), "button_press_event", GTK_SIGNAL_FUNC (button_press_event_cb), model);
|
||||
|
||||
return tree_view;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *notebook;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *tree;
|
||||
GtkTextTag *tag;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_signal_connect (GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), hbox);
|
||||
|
||||
tree = create_tree ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), tree, FALSE, FALSE, 0);
|
||||
|
||||
notebook = gtk_notebook_new ();
|
||||
gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&info_buffer, FALSE),
|
||||
gtk_label_new ("Info"));
|
||||
|
||||
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
|
||||
create_text (&source_buffer, TRUE),
|
||||
gtk_label_new ("Source"));
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "title");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Sans 18",
|
||||
NULL);
|
||||
|
||||
tag = gtk_text_buffer_create_tag (info_buffer, "source");
|
||||
gtk_object_set (GTK_OBJECT (tag),
|
||||
"font", "Courier 10",
|
||||
"pixels_above_lines", 0,
|
||||
"pixels_below_lines", 0,
|
||||
NULL);
|
||||
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
gtk_widget_show_all (window);
|
||||
|
||||
|
||||
load_file (testgtk_demos[0].filename);
|
||||
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -11,7 +11,6 @@ EXTRA_DIST = \
|
||||
sizing-test.txt \
|
||||
styles.txt \
|
||||
text_widget.txt \
|
||||
text_widget_internals.txt \
|
||||
tree-column-sizing.txt \
|
||||
widget_geometry.txt \
|
||||
widget_system.txt \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<book>
|
||||
|
||||
<bookinfo>
|
||||
<date>January 23rd 2003</date>
|
||||
<date>June 25th 2003</date>
|
||||
<title>GTK+ FAQ</title>
|
||||
<authorgroup>
|
||||
<author>
|
||||
@@ -22,6 +22,8 @@
|
||||
<para> This document is intended to answer questions that are
|
||||
likely to be frequently asked by programmers using GTK+ or
|
||||
people who are just looking at using GTK+. </para>
|
||||
<para><emphasis>Note: </emphasis> This FAQ mainly covers GTK+ 1.2.
|
||||
Where the text covers GTK+ 2.x this will be indicated</para>
|
||||
</abstract>
|
||||
</bookinfo>
|
||||
|
||||
@@ -33,6 +35,16 @@
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>Note: This FAQ mainly covers GTK+ 1.2</title>
|
||||
<para>This FAQ mainly covers GTK+ 1.2.
|
||||
Where the text covers GTK+ 2.x this will be indicated by prefixing the
|
||||
text with: <emphasis>[GTK+ 2.x]</emphasis>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>Before anything else: the greetings</title>
|
||||
<para>The FAQ authors want to thank:</para>
|
||||
@@ -444,26 +456,24 @@ generated Makefiles.</para>
|
||||
|
||||
<sect1>
|
||||
<title>I've compiled and installed GTK+, but I can't get any
|
||||
programs to link with it!</title>
|
||||
programs to link with it! <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>This problem is most often encountered when the GTK+
|
||||
libraries can't be found or are the wrong version. Generally,
|
||||
the compiler will complain about an 'unresolved symbol'.
|
||||
There are two things you need to check:</para>
|
||||
the compiler will complain about an 'unresolved symbol'.</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><simpara>Make sure that the libraries can be
|
||||
<para>Make sure that the libraries can be
|
||||
found. You want to edit <filename>/etc/ld.so.conf</filename> to
|
||||
include the directories which contain the GTK libraries,
|
||||
so it looks something like:</simpara>
|
||||
so it looks something like:</para>
|
||||
|
||||
<para><literallayout><literal>/usr/X11R6/lib</literal>
|
||||
<literal>/usr/local/lib</literal></literallayout></para>
|
||||
|
||||
<para>Then you need to run /sbin/ldconfig as root. You can
|
||||
find what directory GTK is in using</para>
|
||||
find what libraries GTK requires using</para>
|
||||
|
||||
<para><literallayout><literal>gtk-config --libs</literal>
|
||||
<para><literallayout><literal>pkg-config gtk+-2.0 --libs</literal>
|
||||
</literallayout></para>
|
||||
|
||||
<para>If your system doesn't use ld.so to find libraries
|
||||
@@ -482,91 +492,29 @@ your GTK libraries are in /usr/local/lib):</para>
|
||||
<literal>setenv LD_LIBRARY_PATH /usr/local/lib</literal>
|
||||
</literallayout></para>
|
||||
|
||||
</listitem>
|
||||
<listitem><simpara>Make sure the linker is finding the
|
||||
correct set of libraries. If you have a Linux distribution that
|
||||
installs GTK+ (e.g. RedHat 5.0) then this older version may be
|
||||
used. Now (assuming you have a RedHat system), issue the
|
||||
command</simpara>
|
||||
|
||||
<para><literallayout>
|
||||
<literal>rpm -e gtk gtk-devel</literal>
|
||||
</literallayout></para>
|
||||
|
||||
<para>You may also want to remove the packages that depend
|
||||
on gtk (rpm will tell you which ones they are). If you don't have a
|
||||
RedHat Linux system, check to make sure that neither
|
||||
<filename>/usr/lib</filename> or <filename>/usr/local/lib</filename>
|
||||
contain any of the libraries libgtk, libgdk, libglib, or libgck. If
|
||||
they do exist, remove them (and any gtk include files, such as
|
||||
<filename>/usr/include/gtk</filename> and
|
||||
<filename>/usr/include/gdk</filename>) and reinstall gtk+.</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
</sect1>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>When compiling programs with GTK+, I get compiler error
|
||||
messages about not being able to find
|
||||
<literal>glibconfig.h</literal>.</title>
|
||||
|
||||
<para>The header file "glibconfig.h" was moved to the
|
||||
directory $exec_prefix/lib/glib/include/. $exec_prefix is the
|
||||
directory that was specified by giving the --exec-prefix flags
|
||||
to ./configure when compiling GTK+. It defaults to $prefix,
|
||||
(specified with --prefix), which in turn defaults to /usr/local/.</para>
|
||||
|
||||
<para>This was done because "glibconfig.h" includes
|
||||
architecture dependent information, and the rest of the
|
||||
include files are put in $prefix/include, which can be shared
|
||||
between different architectures.</para>
|
||||
|
||||
<para>GTK+ includes a shell script, <literal>/gtk-config/</literal>,
|
||||
that makes it easy to find out the correct include paths. The GTK+
|
||||
Tutorial includes an example of using <literal>/gtk-config/</literal>
|
||||
for simple compilation from the command line. For information about more
|
||||
complicated configuration, see the file docs/gtk-config.txt in the GTK+
|
||||
distribution.</para>
|
||||
|
||||
<para>If you are trying to compile an old program, you may be
|
||||
able to work around the problem by configuring it with a
|
||||
command line like:</para>
|
||||
|
||||
<para><literallayout>
|
||||
<literal>setenv CPPFLAGS "-I/usr/local/include/glib/include"</literal>
|
||||
<literal>./configure</literal>
|
||||
</literallayout></para>
|
||||
|
||||
<para>(Substitute the appropriate value of $exec_prefix for
|
||||
/usr/local.)</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>When installing a GTK+ application, configure reports
|
||||
that it can't find GTK.</title>
|
||||
that it can't find GTK. <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>There are several common reasons for this:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><simpara>You have an old version of GTK installed
|
||||
somewhere. RedHat 5.0, for example, installs an older copy of GTK that
|
||||
may not work with the latest applications. You should remove this old
|
||||
copy, but note that in the case of RedHat 5.0 this will
|
||||
break the <literal>control-panel</literal> applications.</simpara>
|
||||
somewhere. You should remove this old copy, but note that
|
||||
this may break applications that have been compiled against
|
||||
the old version.</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem><simpara><literal>gtk-config</literal> (or another
|
||||
<listitem><simpara><literal>pkg-config</literal> (or another
|
||||
component of GTK) isn't in your path, or there is an old
|
||||
version on your system. Type:</simpara>
|
||||
|
||||
<para><literallayout>
|
||||
<literal>gtk-config --version</literal>
|
||||
<literal>pkg-config gtk+-2.0 --version</literal>
|
||||
</literallayout></para>
|
||||
|
||||
<para>to check for both of these. If it returns a value
|
||||
@@ -747,25 +695,23 @@ presents a list of GTK+ bindings.</para>
|
||||
<listitem><simpara>There are several C++ wrappers for GTK+.</simpara>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><simpara>the gtk-- package, which is a very small wrapper for
|
||||
<listitem><simpara>the gtkmm package, which is a wrapper for
|
||||
GTK+. You can find the home page at <ulink
|
||||
url="http://www.cs.tut.fi/~p150650/gtk/gtk--.html">
|
||||
http://www.cs.tut.fi/~p150650/gtk/gtk--.html</ulink>. The FTP site is
|
||||
<ulink url="ftp://ftp.gtk.org/pub/gtk/gtk--">
|
||||
ftp://ftp.gtk.org/pub/gtk/gtk--</ulink>.</simpara>
|
||||
url="http://www.gtkmm.org">
|
||||
http://www.gtkmm.org/</ulink>.</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem><simpara>the VDK package, which was built as
|
||||
the base package of a GTK+ application Borland-like
|
||||
builder. The home page can be found at <ulink
|
||||
url="http://www.guest.net/homepages/mmotta/VDKHome">
|
||||
http://www.guest.net/homepages/mmotta/VDKHome</ulink>.</simpara>
|
||||
url="http://vdkbuilder.sourceforge.net/">
|
||||
http://vdkbuilder.sourceforge.net/</ulink>.</simpara>
|
||||
</listitem>
|
||||
|
||||
<listitem><simpara>The wxWindows/Gtk package, a free C++ library for
|
||||
cross-platform GUI development. The home page of this package is
|
||||
<ulink url="http://www.freiburg.linux.de/~wxxt/">
|
||||
http://www.freiburg.linux.de/~wxxt/</ulink>.</simpara>
|
||||
<ulink url="http://www.wxwindows.org/">
|
||||
http://www.wxwindows.org/</ulink>.</simpara>
|
||||
</listitem>
|
||||
|
||||
</itemizedlist>
|
||||
@@ -883,6 +829,32 @@ grounding on what the widgets can do.</para>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>How do I use the Glade GUI builder with GTK+? <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>There are two ways to use Glade. The first way is to use
|
||||
Glade's facilities for generating code; the second
|
||||
way is to use the libglade library which directly loads
|
||||
the XML user interface description files that Glade
|
||||
generates into a running program.</para>
|
||||
|
||||
Experienced GTK+ programmers generally strongly recommend
|
||||
using libglade; you don't have to worry about the interaction
|
||||
between Glade generating the source and you editing it,
|
||||
and its been shown to be a method that works better
|
||||
for large projects, so there is a lot of example code
|
||||
out there you can look at.</para>
|
||||
|
||||
<para>An introduction to using libglade can be found in the
|
||||
libglade API docs
|
||||
(<ulink url="http://developer.gnome.org/doc/API/2.0/libglade/libglade-notes.html#libglade-basics">
|
||||
http://developer.gnome.org/doc/API/2.0/libglade/libglade-notes.html#libglade-basics</ulink>)
|
||||
.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>How do I write security sensitive/SUID/SGID programs with GTK+?
|
||||
Is GTK+ secure? What's this GTK_MODULES security hole I heard about?</title>
|
||||
@@ -900,26 +872,26 @@ url="http://www.gtk.org/setuid.html">http://www.gtk.org/setuid.html</ulink>.</pa
|
||||
|
||||
<sect1>
|
||||
<title>I tried to compile a small <command>Hello World</command> of mine,
|
||||
but it failed. Any clue?</title>
|
||||
but it failed. Any clue? <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>Since you are good at coding, we will not deal with
|
||||
compile time error here :)</para>
|
||||
|
||||
<para>The classic command line to compile a GTK+ based program is</para>
|
||||
<para><literallayout>
|
||||
<literal>gcc -o myprog [c files] `gtk-config --cflags --libs`</literal>
|
||||
<literal>gcc -o myprog [c files] `pkg-config gtk+-2.0 --cflags --libs`</literal>
|
||||
</literallayout></para>
|
||||
|
||||
<para>You should notice the backquote character which is used
|
||||
in this command line. A common mistake when you start a GTK+
|
||||
based development is to use quote instead of backquotes. If
|
||||
you do so, the compiler will complain about an unknown file
|
||||
called <filename>gtk-config --cflags --libs</filename>. The
|
||||
called <filename>pkg-config gtk+-2.0 --cflags --libs</filename>. The
|
||||
text in backquotes is an instruction to your shell to
|
||||
substitute the output of executing this text into the
|
||||
substitute the output of executing this command into the
|
||||
commandline.</para>
|
||||
|
||||
<para>The command line above ensure that:</para>
|
||||
<para>The command line above ensures that:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><simpara>the correct C compiler flags will be used
|
||||
@@ -938,7 +910,7 @@ needed libraries.</simpara>
|
||||
|
||||
<sect1>
|
||||
<title>What about using the <command>make</command>
|
||||
utility?</title>
|
||||
utility? <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>This is a sample makefile which compile a GTK+ based
|
||||
program:</para>
|
||||
@@ -947,8 +919,8 @@ program:</para>
|
||||
# basic GTK+ app makefile
|
||||
SOURCES = myprg.c foo.c bar.c
|
||||
OBJS = ${SOURCES:.c=.o}
|
||||
CFLAGS = `gtk-config --cflags`
|
||||
LDADD = `gtk-config --libs`
|
||||
CFLAGS = `pkg-config gtk+-2.0 --cflags`
|
||||
LDADD = `pkg-config gtk+-2.0 --libs`
|
||||
CC = gcc
|
||||
PACKAGE = myprg
|
||||
|
||||
@@ -1089,6 +1061,17 @@ port is also great for debugging X programs. Old vt100/vt220
|
||||
terminals are dirt cheap but a bit hard to get (here in The
|
||||
Netherlands, YMMV).</quote></para>
|
||||
|
||||
<para>
|
||||
Another option is to run your application on Xnest. Xnest is an X server
|
||||
which displays its root window in a regular window of another X server.
|
||||
A pointer grab on the Xnest display will not affect the GUI of your debugger
|
||||
running on your regular X server.
|
||||
<programlisting>
|
||||
Xnest :1
|
||||
twm -display :1
|
||||
myapp --display=:1
|
||||
</programlisting>
|
||||
</para>
|
||||
</sect1>
|
||||
</chapter>
|
||||
|
||||
@@ -1192,7 +1175,7 @@ Netherlands, YMMV).</quote></para>
|
||||
|
||||
<sect1>
|
||||
<title>Is GTK+ thread safe? How do I write multi-threaded GTK+
|
||||
applications?</title>
|
||||
applications? <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>The GLib library can be used in a thread-safe mode by
|
||||
calling g_thread_init() before making any other GLib
|
||||
@@ -1204,11 +1187,12 @@ simultaneously. If two different threads need to access the
|
||||
same hash table, the application is responsible for locking
|
||||
itself.</para>
|
||||
|
||||
<para>When GLib is intialized to be thread-safe, GTK+ is
|
||||
<emphasis>thread aware</emphasis>. There is a single global
|
||||
<para>In order to make GDK thread aware, you also need to
|
||||
call gdk_threads_init() in conjunction with the above call.
|
||||
There is a single global
|
||||
lock that you must acquire with gdk_threads_enter() before
|
||||
making any GDK calls, and release with gdk_threads_leave()
|
||||
afterwards.</para>
|
||||
afterwards throughout your code.</para>
|
||||
|
||||
<para>A minimal main program for a threaded GTK+ application
|
||||
looks like:</para>
|
||||
@@ -1219,7 +1203,11 @@ main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
|
||||
/* init threads */
|
||||
g_thread_init(NULL);
|
||||
gdk_threads_init();
|
||||
|
||||
/* init gtk */
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
window = create_window();
|
||||
@@ -1229,7 +1217,7 @@ main (int argc, char *argv[])
|
||||
gtk_main();
|
||||
gdk_threads_leave();
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
@@ -1246,36 +1234,30 @@ illustrate how to use threads within GTK+ programs.</para>
|
||||
<programlisting role="C">
|
||||
/*-------------------------------------------------------------------------
|
||||
* Filename: gtk-thread.c
|
||||
* Version: 0.99.1
|
||||
* Version: 1.99.1
|
||||
* Copyright: Copyright (C) 1999, Erik Mouw
|
||||
* Author: Erik Mouw <J.A.K.Mouw@its.tudelft.nl>
|
||||
* Description: GTK threads example.
|
||||
* Description: GTK threads example.
|
||||
* Created at: Sun Oct 17 21:27:09 1999
|
||||
* Modified by: Erik Mouw <J.A.K.Mouw@its.tudelft.nl>
|
||||
* Modified at: Sun Oct 24 17:21:41 1999
|
||||
* Modified by: Owen Taylor <otaylor@gtk.org>
|
||||
* Modified at: Wed May 28 10:43:00 2003
|
||||
*-----------------------------------------------------------------------*/
|
||||
/*
|
||||
* Compile with:
|
||||
*
|
||||
* cc -o gtk-thread gtk-thread.c `gtk-config --cflags --libs gthread`
|
||||
* cc -o gtk-thread gtk-thread.c `pkg-config --cflags --libs gtk+-2.0 gthread`
|
||||
*
|
||||
* Thanks to Sebastian Wilhelmi and Owen Taylor for pointing out some
|
||||
* bugs.
|
||||
* Thanks to Sebastian Wilhelmi for pointing out some bugs in earlier versions.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#define YES_IT_IS (1)
|
||||
#define NO_IT_IS_NOT (0)
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *label;
|
||||
int what;
|
||||
@@ -1297,7 +1279,7 @@ void *argument_thread(void *args)
|
||||
for(;;)
|
||||
{
|
||||
/* sleep a while */
|
||||
sleep(rand() / (RAND_MAX / 3) + 1);
|
||||
sleep(g_random_int_range (1, 4));
|
||||
|
||||
/* lock the yes_or_no_variable */
|
||||
G_LOCK(yes_or_no);
|
||||
@@ -1325,42 +1307,46 @@ void *argument_thread(void *args)
|
||||
else
|
||||
gtk_label_set_text(GTK_LABEL(data->label), "O no, it isn't!");
|
||||
|
||||
/* Make sure all X commands are sent to the X server; not strictly
|
||||
* necessary here, but always a good idea when you do anything
|
||||
* from a thread other than the one where the main loop is running.
|
||||
*/
|
||||
gdk_flush ();
|
||||
|
||||
/* release GTK thread lock */
|
||||
gdk_threads_leave();
|
||||
}
|
||||
}
|
||||
|
||||
return(NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *label;
|
||||
GError *error = NULL;
|
||||
yes_or_no_args yes_args, no_args;
|
||||
pthread_t no_tid, yes_tid;
|
||||
|
||||
/* init threads */
|
||||
g_thread_init(NULL);
|
||||
gdk_threads_init();
|
||||
|
||||
/* init gtk */
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
/* init random number generator */
|
||||
srand((unsigned int)time(NULL));
|
||||
|
||||
/* create a window */
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT (window), "destroy",
|
||||
GTK_SIGNAL_FUNC(destroy), NULL);
|
||||
g_signal_connect(window, "destroy",
|
||||
G_CALLBACK(destroy), NULL);
|
||||
|
||||
gtk_container_set_border_width(GTK_CONTAINER (window), 10);
|
||||
|
||||
/* create a label */
|
||||
label = gtk_label_new("And now for something completely different ...");
|
||||
gtk_container_add(GTK_CONTAINER(window), label);
|
||||
|
||||
|
||||
/* show everything */
|
||||
gtk_widget_show(label);
|
||||
gtk_widget_show (window);
|
||||
@@ -1368,24 +1354,100 @@ int main(int argc, char *argv[])
|
||||
/* create the threads */
|
||||
yes_args.label = label;
|
||||
yes_args.what = YES_IT_IS;
|
||||
pthread_create(&yes_tid, NULL, argument_thread, &yes_args);
|
||||
if (!g_thread_create(argument_thread, &yes_args, FALSE, &error))
|
||||
{
|
||||
g_printerr ("Failed to create YES thread: %s\n", error->message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
no_args.label = label;
|
||||
no_args.what = NO_IT_IS_NOT;
|
||||
pthread_create(&no_tid, NULL, argument_thread, &no_args);
|
||||
if (!g_thread_create(argument_thread, &no_args, FALSE, &error))
|
||||
{
|
||||
g_printerr ("Failed to create NO thread: %s\n", error->message);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* enter the GTK main loop */
|
||||
gdk_threads_enter();
|
||||
gtk_main();
|
||||
gdk_threads_leave();
|
||||
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
</programlisting>
|
||||
</sect1>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>I'm doing some stuff with GTK+ in a separate thread, and
|
||||
properly locking with gdk_threads_enter/gdk_threads_leave()
|
||||
but the display doesn't update properly. <emphasis>[GTK 2.x]</emphasis>
|
||||
</title>
|
||||
|
||||
<para>For efficiency, the X window system batches up commands
|
||||
and sends them to the X server in batches instead of sending
|
||||
out immediately.</para>
|
||||
|
||||
<para>In a non-multithreaded program, you don't have to worry about
|
||||
this, since the first thing that happens when control returns
|
||||
to the main loop is that any outstanding X requests are
|
||||
sent to the X server.</para>
|
||||
|
||||
<para>However, if you are making GTK+ calls from a thread other
|
||||
than the main loop, then GTK+ doesn't know when to send batched
|
||||
commands out. For that reason, after making GTK+ calls
|
||||
in a separate thread, it is usually a good idea to call
|
||||
gdk_flush() before gdk_thread_leave().</para>
|
||||
|
||||
<para>Actually, gdk_flush() is more expensive than is necessary here,
|
||||
since it waits for the X server to finish outstanding commands
|
||||
as well; if performance is an issue, you may want to call
|
||||
XFlush() directly:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
void my_flush_commands (void)
|
||||
{
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
XFlush (GDK_DISPLAY_XDISPLAY (display);
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
</sect1>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>What's an easy way to run a function in the thread with
|
||||
the main loop? <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>Sometimes the simplest way to set up a threaded program
|
||||
is to make all the GTK+ calls in a single thread. In such
|
||||
a program, you should still call g_threads_init(), but
|
||||
don't need to call gdk_threads_init(), gkd_threads_enter(),
|
||||
and gdk_threads_leave().</para>
|
||||
|
||||
<para>If you set your program up this way, how then do you get
|
||||
the thread making GTK+ calls and running the main loop
|
||||
to do something in response to another thread?</para>
|
||||
|
||||
<para>An easy way to do it is to take advantage of the fact that
|
||||
the GLib main loop functions are all thread safe, and can
|
||||
be called from any thread by adding an idle function
|
||||
with g_idle_add(). The function provided will be called
|
||||
at the next opportunity by the main thread. If you want
|
||||
your function to take priority over event handling and
|
||||
drawing, you can instead use g_idle_add_full() and pass
|
||||
in a priority of G_PRIORITY_HIGH.</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>Why does this strange 'x io error' occur when I
|
||||
<literal>fork()</literal> in my GTK+ app?</title>
|
||||
@@ -1420,7 +1482,7 @@ illustrate handling fork() and exit().</para>
|
||||
/*
|
||||
* Compile with:
|
||||
*
|
||||
* cc -o gtk-fork gtk-fork.c `gtk-config --cflags --libs`
|
||||
* cc -o gtk-fork gtk-fork.c `pkg-config gtk+-2.0 --cflags --libs`
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1612,7 +1674,7 @@ ancestor?</title>
|
||||
|
||||
<para>There are a couple of ways to find the top level parent
|
||||
of a widget. The easier way is to call the
|
||||
<literal>gtk_widget_top_level()</literal> function that
|
||||
<literal>gtk_widget_get_toplevel()</literal> function that
|
||||
returns pointer to a GtkWidget that is the top level
|
||||
window.</para>
|
||||
|
||||
@@ -1923,7 +1985,8 @@ and high priority idle functions, then return immediately
|
||||
<!-- ----------------------------------------------------------------- -->
|
||||
|
||||
<sect1>
|
||||
<title>How do I attach data to some GTK+ object/widget?</title>
|
||||
<title>How do I attach data to some GTK+ object/widget?
|
||||
<emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>First of all, the attached data is stored in the
|
||||
object_data field of a GtkObject. The type of this field is
|
||||
@@ -1932,15 +1995,15 @@ gdataset.c file in your glib source directory very
|
||||
carefully.</para>
|
||||
|
||||
<para>There are two (easy) ways to attach some data to a gtk
|
||||
object. Using <literal>gtk_object_set_data()</literal> and
|
||||
<literal>gtk_object_get_data()</literal> seems to be the most
|
||||
object. Using <literal>g_object_set_data()</literal> and
|
||||
<literal>g_object_get_data()</literal> seems to be the most
|
||||
common way to do this, as it provides a powerful interface to
|
||||
connect objects and data.</para>
|
||||
|
||||
<programlisting role="C">
|
||||
void gtk_object_set_data(GtkObject *object, const gchar *key, gpointer data);
|
||||
void g_object_set_data(GObject *object, const gchar *key, gpointer data);
|
||||
|
||||
gpointer gtk_object_get_data(GtkObject *object, const gchar *key);
|
||||
gpointer g_object_get_data(GObject *object, const gchar *key);
|
||||
</programlisting>
|
||||
|
||||
<para>Since a short example is better than any lengthy speech:</para>
|
||||
@@ -1949,10 +2012,10 @@ gpointer gtk_object_get_data(GtkObject *object, const gchar *key);
|
||||
struct my_struct p1,p2,*result;
|
||||
GtkWidget *w;
|
||||
|
||||
gtk_object_set_data(GTK_OBJECT(w),"p1 data",(gpointer)&p1);
|
||||
gtk_object_set_data(GTK_OBJECT(w),"p2 data",(gpointer)&p2);
|
||||
g_object_set_data(G_OBJECT(w),"p1 data",(gpointer)&p1);
|
||||
g_object_set_data(G_OBJECT(w),"p2 data",(gpointer)&p2);
|
||||
|
||||
result = gtk_object_get_data(GTK_OBJECT(w),"p1 data");
|
||||
result = g_object_get_data(G_OBJECT(w),"p1 data");
|
||||
</programlisting>
|
||||
|
||||
<para>The <literal>gtk_object_set_user_data()</literal> and
|
||||
@@ -2075,62 +2138,24 @@ windows.</para>
|
||||
|
||||
<sect1>
|
||||
<title>How do I set the size of a widget/window? How do I
|
||||
prevent the user resizing my window?</title>
|
||||
prevent the user resizing my window? <emphasis>[GTK 2.x]</emphasis></title>
|
||||
|
||||
<para>The <literal>gtk_widget_set_uposition()</literal>
|
||||
function is used to set the position of any widget.</para>
|
||||
<para>The <literal>gtk_widget_set_size_request()</literal> function
|
||||
is used to set the size of a widget to a specific size.
|
||||
|
||||
<para>The <literal>gtk_widget_set_usize()</literal> function
|
||||
is used to set the size of a widget. In order to use all the
|
||||
features that are provided by this function when it acts on a
|
||||
window, you may want to use the
|
||||
<literal>gtk_window_set_policy</literal> function. The
|
||||
The function
|
||||
<literal>gtk_window_set_resizable()</literal> function sets whether
|
||||
the user can resize a window, which they can by default. The
|
||||
definition of these functions are:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
void gtk_widget_set_usize (GtkWidget *widget,
|
||||
gint width,
|
||||
gint height);
|
||||
void gtk_widget_set_size_request (GtkWidget *widget,
|
||||
gint width,
|
||||
gint height);
|
||||
|
||||
void gtk_window_set_policy (GtkWindow *window,
|
||||
gint allow_shrink,
|
||||
gint allow_grow,
|
||||
gint auto_shrink);
|
||||
</programlisting>
|
||||
void gtk_window_set_resizable (GtkWindow *window,
|
||||
gboolean resizable);
|
||||
|
||||
<para><literal>auto_shrink</literal> will automatically shrink
|
||||
the window when the requested size of the child widgets goes
|
||||
below the current size of the
|
||||
window. <literal>allow_shrink</literal> will give the user the
|
||||
authorisation to make the window smaller that it should
|
||||
normally be. <literal>allow_grow</literal> gives the user
|
||||
the ability to make the window bigger. The default
|
||||
values for these parameters are:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
allow_shrink = FALSE
|
||||
allow_grow = TRUE
|
||||
auto_shrink = FALSE
|
||||
</programlisting>
|
||||
|
||||
<para>The <literal>gtk_widget_set_usize()</literal> functions
|
||||
is not the easiest way to set a window size since you cannot
|
||||
decrease this window size with another call to this function
|
||||
unless you call it twice, as in:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
gtk_widget_set_usize(your_widget, -1, -1);
|
||||
gtk_widget_set_usize(your_widget, new_x_size, new_y_size);
|
||||
</programlisting>
|
||||
|
||||
<para>Another way to set the size of and/or move a window is to use
|
||||
the <literal>gdk_window_move_resize()</literal> function which
|
||||
uses to work fine both to grow or to shrink the window:</para>
|
||||
|
||||
<programlisting role="C">
|
||||
gdk_window_move_resize(window->window,
|
||||
x_pos, y_pos,
|
||||
x_size, y_size);
|
||||
</programlisting>
|
||||
|
||||
</sect1>
|
||||
|
||||
@@ -1,6 +1,109 @@
|
||||
2003-03-04 Matthias Clasen <maclas@gmx.de>
|
||||
2003-08-11 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkobject.sgml: Add deprecation notes.
|
||||
* gtk/tmpl/gtkwidget.sgml: Document public GtkWidget members. (#119463)
|
||||
|
||||
2003-08-08 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-docs.sgml:
|
||||
* gdk-pixbuf/gdk-pixbuf.sgml:
|
||||
* gdk/gdk-docs.sgml: Add indices.
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-sections.txt: Add GdkPixbufLoaderClass.
|
||||
|
||||
* gdk/gdk-sections.txt: Add GdkScreenClass and GdkDisplayClass.
|
||||
|
||||
2003-08-03 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixbuf/tmpl/gdk-pixbuf.sgml: Clarify misleading explanation of rowstride. (#119000)
|
||||
|
||||
2003-07-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* gdk/tmpl/pixmaps.sgml: Resurrected documentation that got lost
|
||||
when the window parameter was renamed to drawable.
|
||||
|
||||
2003-07-21 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtktreemodel.sgml: Fix example. (#117972, Akira Tagoh)
|
||||
|
||||
* gtk/tmpl/gtkdnd.sgml: It is GTK_DEST_DEFAULT_DROP, not
|
||||
GTK_DRAG_DEFAULT_DROP. (#117917, Tim-Philipp Müller)
|
||||
|
||||
2003-07-08 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkfilesel.sgml: Fix the example. (#116575)
|
||||
|
||||
2003-06-22 Matthias Clasen <matthias@localhost.localdomain>
|
||||
|
||||
* gdk-pixbuf/tmpl/gdk-pixbuf.sgml: Fix a typo.
|
||||
|
||||
2003-06-19 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/question_index.sgml: Add a question about changing
|
||||
fonts. And one about "Getting Started". (#114747, #108015)
|
||||
|
||||
2003-06-11 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkdnd.sgml: Fix some typos.
|
||||
|
||||
2003-06-05 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/question_index.sgml: Add a couple of questions.
|
||||
|
||||
2003-06-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixbuf/tmpl/gdk-pixbuf.sgml:
|
||||
* gdk-pixbuf/tmpl/animation.sgml: Remove manually inserted
|
||||
anchors, gtk-doc emits anchors for all objects since Dec 2002.
|
||||
|
||||
2003-05-27 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkadjustment.sgml: Document allowed values for
|
||||
adjustments which are used in scrollbars. (#108448, Ernst Lippe)
|
||||
|
||||
* gtk/tmpl/gtkradiomenuitem.sgml: Fix example. (#113604,
|
||||
Julien Moutte)
|
||||
|
||||
2003-05-19 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixbuf/gdk-pixbuf-sections.txt:
|
||||
* gdk/gdk-sections.txt: Add some unused symbols to private sections.
|
||||
|
||||
2003-05-17 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-sections.txt: Add gtk_tree_row_reference_get_type.
|
||||
|
||||
2003-05-05 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-docs.sgml:
|
||||
* gtk/tmpl/gtksocket.sgml: Improve the docs about cross-process
|
||||
embedding a bit. (#112101, #112006)
|
||||
|
||||
2003-04-13 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-sections.txt: Add gtk_tree_view_column_cell_get_position().
|
||||
|
||||
2003-04-07 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkenums.sgml, gtk/tmpl/gtkmain.sgml,
|
||||
gtk/tmpl/gtkpaned.sgml, gtk/tmpl/gtkradiobutton.sgml,
|
||||
gtk/tmpl/gtkspinbutton.sgml, gtk/tmpl/gtkstatusbar.sgml,
|
||||
gtk/tmpl/gtktext.sgml, gtk/tmpl/gtktogglebuttons.sgml,
|
||||
gtk/tmpl/gtktreeviewcolumn.sgml, gtk/tmpl/gtktypeutils.sgml: Fix
|
||||
numerous misspellings of possessive "its". (#110027, Doug Quale)
|
||||
|
||||
2003-04-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkmessagedialog.sgml: Fix formatting of examples.
|
||||
|
||||
* gtk/tmpl/gtkfilesel.sgml: Fix the example. (#109563)
|
||||
|
||||
2003-03-22 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* gtk/Makefile.am: copy stock_color_picker_25.png, don't copy
|
||||
stock_save_24.png twice.
|
||||
|
||||
* gtk/tmpl/gtkstock.sgml: use it for GTK_STOCK_COLOR_PICKER
|
||||
instead of stock_colorselector_24.png.
|
||||
|
||||
2003-02-24 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
@@ -12,50 +115,10 @@
|
||||
* gtk/tmpl/gtkrc.sgml: Document that font and fontset declarations
|
||||
are ignored.
|
||||
|
||||
2003-02-02 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-docs.sgml:
|
||||
* gtk/question_index.sgml: # doesn't work here, add links
|
||||
manually. (#104991)
|
||||
|
||||
2003-02-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/compiling.sgml: Mention xxx_DISABLE_DEPRECATED and
|
||||
GDK_MULTIHEAD_SAFE.
|
||||
|
||||
2003-01-31 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkmain.sgml: Deprecate the gtk_timeout_*, gtk_idle_*
|
||||
and gtk_input_* functions. (#71596)
|
||||
|
||||
2003-01-30 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/running.sgml: s/overwrite/override/g (#104627, Brian Cameron)
|
||||
|
||||
2003-01-21 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkrc.sgml: Fix integer color range. (#103992)
|
||||
|
||||
2003-01-14 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/gtk-sections.txt: Add new GtkTextIter functions.
|
||||
|
||||
2003-01-13 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixbuf/tmpl/gdk-pixbuf.sgml:
|
||||
* gdk-pixbuf/tmpl/animation.sgml: Remove ids which are now
|
||||
generated by gtk-doc.
|
||||
|
||||
2003-01-03 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkrc.sgml: Update description of priorities for styles
|
||||
and bindings. (#98054)
|
||||
|
||||
2002-12-31 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gtk/tmpl/gtkrc.sgml: Add a note about gtkrc-2.0 being parsed by
|
||||
all 2.x versions.
|
||||
|
||||
Fri Dec 20 13:10:06 2002 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/building.sgml: Update directories in download
|
||||
|
||||
@@ -9,6 +9,7 @@ gdk-pixbuf.hierarchy
|
||||
gdk-pixbuf.interfaces
|
||||
gdk-pixbuf.prerequisites
|
||||
gdk-pixbuf.signals
|
||||
deprecated
|
||||
html
|
||||
xml
|
||||
*.stamp
|
||||
|
||||
@@ -164,6 +164,7 @@ GDK_IS_PIXBUF_LOADER
|
||||
GDK_PIXBUF_LOADER_CLASS
|
||||
GDK_IS_PIXBUF_LOADER_CLASS
|
||||
<SUBSECTION Private>
|
||||
GdkPixbufLoaderClass
|
||||
gdk_pixbuf_loader_get_type
|
||||
</SECTION>
|
||||
|
||||
|
||||
@@ -113,6 +113,8 @@
|
||||
&gdk-pixbuf-gdk-pixbuf-xlib-from-drawables;
|
||||
&gdk-pixbuf-gdk-pixbuf-xlib-rgb;
|
||||
</reference>
|
||||
|
||||
<index/>
|
||||
|
||||
&Porting-From-Imlib;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ information on error domains and error codes.
|
||||
<para>
|
||||
These values can be passed to
|
||||
gdk_pixbuf_render_to_drawable_alpha() to control how the alpha
|
||||
chanel of an image should be handled. This function can create a
|
||||
channel of an image should be handled. This function can create a
|
||||
bilevel clipping mask (black and white) and use it while painting
|
||||
the image. In the future, when the X Window System gets an alpha
|
||||
channel extension, it will be possible to do full alpha
|
||||
@@ -71,7 +71,8 @@ In the future it will do full alpha compositing.
|
||||
This is the main structure in the &gdk-pixbuf; library. It is
|
||||
used to represent images. It contains information about the
|
||||
image's pixel data, its color space, bits per sample, width and
|
||||
height, and the rowstride or number of bytes between rows.
|
||||
height, and the rowstride (the number of bytes between the start of
|
||||
one row and the start of the next).
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ gdk.hierarchy
|
||||
gdk.interfaces
|
||||
gdk.prerequisites
|
||||
gdk.signals
|
||||
deprecated
|
||||
html
|
||||
xml
|
||||
*.stamp
|
||||
|
||||
@@ -84,4 +84,7 @@
|
||||
|
||||
&gdk-X-Window-System-Interaction;
|
||||
</reference>
|
||||
|
||||
<index/>
|
||||
|
||||
</book>
|
||||
|
||||
@@ -149,6 +149,7 @@ GDK_IS_DISPLAY_CLASS
|
||||
GDK_DISPLAY_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GdkDisplayClass
|
||||
gdk_display_open_default_libgtk_only
|
||||
</SECTION>
|
||||
|
||||
@@ -203,10 +204,13 @@ gdk_screen_get_setting
|
||||
GDK_SCREEN
|
||||
GDK_IS_SCREEN
|
||||
GDK_TYPE_SCREEN
|
||||
gdk_screen_get_type
|
||||
GDK_SCREEN_CLASS
|
||||
GDK_IS_SCREEN_CLASS
|
||||
GDK_SCREEN_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
GdkScreenClass
|
||||
gdk_screen_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
|
||||
@@ -33,16 +33,14 @@ these types.
|
||||
Create a new pixmap with a given size and depth.
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@drawable: A #GdkDrawable, used to determine default values
|
||||
for the new pixmap. Can be %NULL if @depth is specified,
|
||||
@width: The width of the new pixmap in pixels.
|
||||
@height: The height of the new pixmap in pixels.
|
||||
@depth: The depth (number of bits per pixel) of the new pixmap.
|
||||
If -1, and @window is not %NULL, the depth of the new
|
||||
pixmap will be equal to that of @window.
|
||||
If -1, and @drawable is not %NULL, the depth of the new
|
||||
pixmap will be equal to that of @drawable.
|
||||
@Returns: the #GdkPixmap
|
||||
<!-- # Unused Parameters # -->
|
||||
@window: a #GdkWindow, used to determine default values for the
|
||||
new pixmap. Can be %NULL if @depth is specified,
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_bitmap_create_from_data ##### -->
|
||||
@@ -50,15 +48,13 @@ Create a new pixmap with a given size and depth.
|
||||
Creates a new bitmap from data in XBM format.
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@drawable: a #GdkDrawable, used to determine default values
|
||||
for the new pixmap. Can be %NULL, in which case the root
|
||||
window is used.
|
||||
@data: a pointer to the XBM data.
|
||||
@width: the width of the new pixmap in pixels.
|
||||
@height: the height of the new pixmap in pixels.
|
||||
@Returns: the #GdkBitmap
|
||||
<!-- # Unused Parameters # -->
|
||||
@window: a #GdkWindow, used to determine default values for the
|
||||
new pixmap. Can be %NULL, in which case the root window is
|
||||
used.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixmap_create_from_data ##### -->
|
||||
@@ -66,7 +62,8 @@ Creates a new bitmap from data in XBM format.
|
||||
Create a two-color pixmap from data in XBM data.
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@drawable: a #GdkDrawable, used to determine default values
|
||||
for the new pixmap. Can be %NULL, if the depth is given.
|
||||
@data: a pointer to the data.
|
||||
@width: the width of the new pixmap in pixels.
|
||||
@height: the height of the new pixmap in pixels.
|
||||
@@ -74,9 +71,6 @@ Create a two-color pixmap from data in XBM data.
|
||||
@fg: the foreground color.
|
||||
@bg: the background color.
|
||||
@Returns: the #GdkPixmap
|
||||
<!-- # Unused Parameters # -->
|
||||
@window: a #GdkWindow, used to determine default values for the
|
||||
new pixmap. Can be %NULL, if the depth is given.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixmap_create_from_xpm ##### -->
|
||||
@@ -84,7 +78,8 @@ Create a two-color pixmap from data in XBM data.
|
||||
Create a pixmap from a XPM file.
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@drawable: a #GdkDrawable, used to determine default values
|
||||
for the new pixmap.
|
||||
@mask: a pointer to a place to store a bitmap representing
|
||||
the transparency mask of the XPM file. Can be %NULL,
|
||||
in which case transparency will be ignored.
|
||||
@@ -93,9 +88,6 @@ that are transparent in the input file. Can be %NULL,
|
||||
in which case a default color will be used.
|
||||
@filename: the filename of a file containing XPM data.
|
||||
@Returns: the #GdkPixmap
|
||||
<!-- # Unused Parameters # -->
|
||||
@window: a #GdkWindow, used to determine default values for the
|
||||
new pixmap.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixmap_colormap_create_from_xpm ##### -->
|
||||
@@ -103,7 +95,8 @@ in which case a default color will be used.
|
||||
Create a pixmap from a XPM file using a particular colormap.
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@drawable: a #GdkDrawable, used to determine default values
|
||||
for the new pixmap. Can be %NULL if @colormap is given.
|
||||
@colormap: the #GdkColormap that the new pixmap will be use.
|
||||
If omitted, the colormap for @window will be used.
|
||||
@mask: a pointer to a place to store a bitmap representing
|
||||
@@ -114,9 +107,6 @@ that are transparent in the input file. Can be %NULL,
|
||||
in which case a default color will be used.
|
||||
@filename: the filename of a file containing XPM data.
|
||||
@Returns: the #GdkPixmap.
|
||||
<!-- # Unused Parameters # -->
|
||||
@window: a #GdkWindow, used to determine default values for the
|
||||
new pixmap. Can be %NULL if @colormap is given.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixmap_create_from_xpm_d ##### -->
|
||||
@@ -124,7 +114,8 @@ in which case a default color will be used.
|
||||
Create a pixmap from data in XPM format.
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@drawable: a #GdkDrawable, used to determine default values
|
||||
for the new pixmap.
|
||||
@mask: Pointer to a place to store a bitmap representing
|
||||
the transparency mask of the XPM file. Can be %NULL,
|
||||
in which case transparency will be ignored.
|
||||
@@ -133,9 +124,6 @@ that are transparent in the input file. Can be %NULL
|
||||
in which case a default color will be used.
|
||||
@data: Pointer to a string containing the XPM data.
|
||||
@Returns: the #GdkPixmap
|
||||
<!-- # Unused Parameters # -->
|
||||
@window: a #GdkWindow, used to determine default values for the
|
||||
new pixmap.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_pixmap_colormap_create_from_xpm_d ##### -->
|
||||
@@ -144,7 +132,8 @@ Create a pixmap from data in XPM format using a particular
|
||||
colormap.
|
||||
</para>
|
||||
|
||||
@drawable:
|
||||
@drawable: a #GdkDrawable, used to determine default values
|
||||
for the new pixmap. Can be %NULL if @colormap is given.
|
||||
@colormap: the #GdkColormap that the new pixmap will be use.
|
||||
If omitted, the colormap for @window will be used.
|
||||
@mask: a pointer to a place to store a bitmap representing
|
||||
@@ -155,9 +144,6 @@ that are transparent in the input file. Can be %NULL,
|
||||
in which case a default color will be used.
|
||||
@data: Pointer to a string containing the XPM data.
|
||||
@Returns: the #GdkPixmap.
|
||||
<!-- # Unused Parameters # -->
|
||||
@window: a #GdkWindow, used to determine default values for the
|
||||
new pixmap. Can be %NULL if @colormap is given.
|
||||
|
||||
|
||||
<!-- ##### MACRO gdk_pixmap_ref ##### -->
|
||||
@@ -166,8 +152,6 @@ Deprecated equivalent of g_object_ref().
|
||||
</para>
|
||||
|
||||
@Returns: @pixmap
|
||||
<!-- # Unused Parameters # -->
|
||||
@pixmap: a #GdkPixmap
|
||||
|
||||
|
||||
<!-- ##### MACRO gdk_pixmap_unref ##### -->
|
||||
@@ -175,8 +159,6 @@ Deprecated equivalent of g_object_ref().
|
||||
Deprecated equivalent of g_object_unref().
|
||||
</para>
|
||||
|
||||
<!-- # Unused Parameters # -->
|
||||
@pixmap: a #GdkPixmap
|
||||
|
||||
|
||||
<!-- ##### STRUCT GdkBitmap ##### -->
|
||||
@@ -195,8 +177,6 @@ Deprecated equivalent of g_object_ref().
|
||||
</para>
|
||||
|
||||
@Returns: @pixmap
|
||||
<!-- # Unused Parameters # -->
|
||||
@pixmap: a #GdkBitmap
|
||||
|
||||
|
||||
<!-- ##### MACRO gdk_bitmap_unref ##### -->
|
||||
@@ -204,7 +184,5 @@ Deprecated equivalent of g_object_ref().
|
||||
Deprecated equivalent of g_object_unref().
|
||||
</para>
|
||||
|
||||
<!-- # Unused Parameters # -->
|
||||
@pixmap: a #GdkBitmap
|
||||
|
||||
|
||||
|
||||
@@ -746,8 +746,15 @@ Registers a window as a potential drop destination.
|
||||
<!-- ##### USER_FUNCTION GdkFilterFunc ##### -->
|
||||
<para>
|
||||
Specifies the type of function used to filter native events before they are
|
||||
converted to GDK events. A filter may translate the native event to a GDK
|
||||
event or handle it without translation.
|
||||
converted to GDK events.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When a filter is called, @event is unpopulated, except for
|
||||
<literal>event->window</literal>. The filter may translate the native
|
||||
event to a GDK event and store the result in @event, or handle it without
|
||||
translation. If the filter translates the event and processing should
|
||||
continue, it should return <literal>GDK_FILTER_TRANSLATE</literal>.
|
||||
</para>
|
||||
|
||||
@xevent: the native event to filter.
|
||||
@@ -762,7 +769,8 @@ Specifies the result of applying a #GdkFilterFunc to a native event.
|
||||
</para>
|
||||
|
||||
@GDK_FILTER_CONTINUE: event not handled, continue processing.
|
||||
@GDK_FILTER_TRANSLATE: translated event stored.
|
||||
@GDK_FILTER_TRANSLATE: native event translated into a GDK event and stored
|
||||
in the <literal>event</literal> structure that was passed in.
|
||||
@GDK_FILTER_REMOVE: event handled, terminate processing.
|
||||
|
||||
<!-- ##### TYPEDEF GdkXEvent ##### -->
|
||||
|
||||
@@ -10,6 +10,7 @@ gtk.hierarchy
|
||||
gtk.interfaces
|
||||
gtk.prerequisites
|
||||
gtk.signals
|
||||
deprecated
|
||||
html
|
||||
xml
|
||||
*.stamp
|
||||
|
||||
@@ -49,6 +49,7 @@ IGNORE_HFILES= \
|
||||
gtktexttypes.h \
|
||||
gtktextutil.h \
|
||||
gtktypebuiltins.h \
|
||||
gtkxembed.h \
|
||||
xembed.h
|
||||
|
||||
# Images to copy into HTML directory
|
||||
@@ -73,7 +74,6 @@ HTML_IMAGES = \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_exec_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_search_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_search_replace_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_save_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_bottom_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_first_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_last_24.png \
|
||||
@@ -109,6 +109,7 @@ HTML_IMAGES = \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_save_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_save_as_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_colorselector_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_color_picker_25.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_font_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_sort_ascending_24.png \
|
||||
$(top_srcdir)/gtk/stock-icons/stock_sort_descending_24.png \
|
||||
@@ -296,12 +297,3 @@ dist-hook: dist-check-gtkdoc dist-hook-local
|
||||
-cp $(srcdir)/html/* $(distdir)/html
|
||||
|
||||
.PHONY : dist-hook-local
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,25 +49,6 @@ $ cc `pkg-config --cflags --libs gtk+-linux-fb-2.0` hello.c -o hello
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you want to make sure that your program doesn't use any deprecated
|
||||
functions, you can define the preprocessor symbol GTK_DISABLE_DEPRECATED
|
||||
by using the command line option <literal>-DGTK_DISABLE_DEPRECATED=1</literal>.
|
||||
There are similar symbols GDK_DISABLE_DEPRECATED,
|
||||
GDK_PIXBUF_DISABLE_DEPRECATED and G_DISABLE_DEPRECATED for GDK, GdkPixbuf and
|
||||
GLib.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you want to make sure that your program doesn't use any functions which
|
||||
may be problematic in a multihead setting, you can define the preprocessor
|
||||
symbol GDK_MULTIHEAD_SAFE by using the command line option
|
||||
<literal>-DGTK_MULTIHEAD_SAFE=1</literal>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -142,7 +142,6 @@
|
||||
<!ENTITY gtk-Settings SYSTEM "xml/gtksettings.xml">
|
||||
|
||||
<!ENTITY index-Object-Tree SYSTEM "xml/tree_index.sgml">
|
||||
<!ENTITY graphic-tree SYSTEM "xml/tree_map.sgml">
|
||||
|
||||
<!ENTITY index-Objects-Grouped SYSTEM "objects_grouped.sgml">
|
||||
<!ENTITY gtk-TextWidget SYSTEM "text_widget.sgml">
|
||||
@@ -196,11 +195,8 @@ string utilities, file utilities, a main loop abstraction, and so on.
|
||||
<listitem><para>
|
||||
|
||||
Pango is a library for internationalized text handling. It centers
|
||||
around the <link linkend="PangoLayout">PangoLayout</link> object, representing
|
||||
a paragraph of text.
|
||||
Pango provides the engine for <link linkend="GtkTextView">GtkTextView</link>,
|
||||
<link linkend="GtkLabel">GtkLabel</link>,
|
||||
<link linkend="GtkEntry">GtkEntry</link>, and
|
||||
around the #PangoLayout object, representing a paragraph of text.
|
||||
Pango provides the engine for #GtkTextView, #GtkLabel, #GtkEntry, and
|
||||
other widgets that display text.
|
||||
|
||||
</para></listitem>
|
||||
@@ -223,9 +219,9 @@ framework.
|
||||
<varlistentry>
|
||||
<term>GdkPixbuf</term>
|
||||
<listitem><para>
|
||||
This is a small library which allows you to create <link linkend="GdkPixbuf">GdkPixbuf</link>
|
||||
This is a small library which allows you to create #GdkPixbuf
|
||||
("pixel buffer") objects from image data or image files.
|
||||
Use a <link linkend="GdkPixbuf">GdkPixbuf</link> in combination with <link linkend="GtkImage">GtkImage</link> to display images.
|
||||
Use a #GdkPixbuf in combination with #GtkImage to display images.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -243,15 +239,13 @@ on X11, Windows, and the Linux framebuffer device.
|
||||
<listitem><para>
|
||||
|
||||
The GTK+ library itself contains <firstterm>widgets</firstterm>,
|
||||
that is, GUI components such as <link linkend="GtkButton">GtkButton</link> or
|
||||
<link linkend="GtkTextView">GtkTextView</link>.
|
||||
that is, GUI components such as #GtkButton or #GtkTextView.
|
||||
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</partintro>
|
||||
&graphic-tree;
|
||||
>k-Building;
|
||||
>k-Compiling;
|
||||
>k-Running;
|
||||
@@ -300,7 +294,6 @@ that is, GUI components such as <link linkend="GtkButton">GtkButton</link> or
|
||||
&GtkDialog;
|
||||
&GtkInvisible;
|
||||
&GtkMessageDialog;
|
||||
&GtkPlug;
|
||||
&GtkWindow;
|
||||
&GtkWindowGroup;
|
||||
</chapter>
|
||||
@@ -453,6 +446,7 @@ that is, GUI components such as <link linkend="GtkButton">GtkButton</link> or
|
||||
|
||||
<chapter id="PlugSocket">
|
||||
<title>Cross-process Embedding</title>
|
||||
&GtkPlug;
|
||||
&GtkSocket;
|
||||
</chapter>
|
||||
|
||||
@@ -483,4 +477,6 @@ that is, GUI components such as <link linkend="GtkButton">GtkButton</link> or
|
||||
|
||||
</part>
|
||||
|
||||
<index/>
|
||||
|
||||
</book>
|
||||
|
||||
@@ -2463,14 +2463,6 @@ gtk_text_iter_backward_sentence_start
|
||||
gtk_text_iter_backward_sentence_starts
|
||||
gtk_text_iter_forward_sentence_end
|
||||
gtk_text_iter_forward_sentence_ends
|
||||
gtk_text_iter_forward_visible_word_ends
|
||||
gtk_text_iter_backward_visible_word_starts
|
||||
gtk_text_iter_forward_visible_word_end
|
||||
gtk_text_iter_backward_visible_word_start
|
||||
gtk_text_iter_forward_visible_cursor_position
|
||||
gtk_text_iter_backward_visible_cursor_position
|
||||
gtk_text_iter_forward_visible_cursor_positions
|
||||
gtk_text_iter_backward_visible_cursor_positions
|
||||
gtk_text_iter_set_offset
|
||||
gtk_text_iter_set_line
|
||||
gtk_text_iter_set_line_offset
|
||||
@@ -2904,6 +2896,7 @@ GTK_TYPE_TREE_ROW_REFERENCE
|
||||
gtk_tree_model_get_type
|
||||
gtk_tree_iter_get_type
|
||||
gtk_tree_path_get_type
|
||||
gtk_tree_row_reference_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -3101,6 +3094,7 @@ gtk_tree_view_column_set_sort_order
|
||||
gtk_tree_view_column_get_sort_order
|
||||
gtk_tree_view_column_cell_set_cell_data
|
||||
gtk_tree_view_column_cell_get_size
|
||||
gtk_tree_view_column_cell_get_position
|
||||
gtk_tree_view_column_cell_is_visible
|
||||
gtk_tree_view_column_focus_cell
|
||||
<SUBSECTION Standard>
|
||||
|
||||
@@ -25,6 +25,22 @@ the question you have, this list is a good place to start.
|
||||
|
||||
<qandadiv><title>General</title>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How do I get started with GTK+?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
The GTK+ <ulink url="http://www.gtk.org">website</ulink> offers a
|
||||
<ulink url="http://www.gtk.org/tutorial">tutorial</ulink> and a
|
||||
<ulink url="http://www.gtk.org/faq">FAQ</ulink>. More documentation ranging
|
||||
from whitepapers to online books can be found at the
|
||||
<ulink url="http://developer.gnome.org/doc">GNOME developer's site</ulink>.
|
||||
After studying these materials you should be well prepared to come back to
|
||||
this reference manual for details.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
Where can I get help with GTK+, submit a bug report, or make a feature
|
||||
@@ -197,6 +213,114 @@ can be defined as:
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>
|
||||
How do I use non-ASCII characters in GTK+ programs ?
|
||||
</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
GTK+ uses <ulink url="http://www.unicode.org">Unicode</ulink> (more exactly
|
||||
UTF-8) for all text. UTF-8 encodes each Unicode codepoint as a
|
||||
sequence of one to six bytes and has a number of nice
|
||||
properties which make it a good choice for working with Unicode
|
||||
text in C programs:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
ASCII characters are encoded by their familiar ASCII codepoints.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
ASCII characters never appear as part of any other character.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
The zero byte doesn't occur as part of a character, so that UTF-8 strings can
|
||||
be manipulated with the usual C library functions for
|
||||
handling zero-terminated strings.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
More information about Unicode and UTF-8 can be found in the
|
||||
<ulink url="http://www.cl.cam.ac.uk/~mgk25/unicode.html">UTF-8 and Unicode FAQ for Unix/Linux</ulink>.
|
||||
GLib provides functions for converting strings between UTF-8 and other
|
||||
encodings, see
|
||||
<link linkend="g-locale-to-utf8">g_locale_to_utf8()</link> and <link
|
||||
linkend="g-convert">g_convert()</link>.
|
||||
</para>
|
||||
<para>
|
||||
Text coming from external sources (e.g. files or user input), has to be
|
||||
converted to UTF-8 before being handed over to GTK+. The
|
||||
following example writes the content of a IS0-8859-1 encoded text
|
||||
file to <literal>stdout</literal>:
|
||||
<informalexample><programlisting>
|
||||
gchar *text, *utf8_text;
|
||||
gsize length;
|
||||
GError *error = NULL;
|
||||
|
||||
if (g_file_get_contents (filename, &text, &length, NULL))
|
||||
{
|
||||
utf8_text = g_convert (text, length, "UTF-8", "ISO-8859-1",
|
||||
NULL, NULL, &error);
|
||||
if (error != NULL)
|
||||
{
|
||||
fprintf ("Couldn't convert file %s to UTF-8\n", filename);
|
||||
g_error_free (error);
|
||||
}
|
||||
else
|
||||
g_print (utf8_text);
|
||||
}
|
||||
else
|
||||
fprintf (stderr, "Unable to read file %s\n", filename);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
<para>
|
||||
For string literals in the source code, there are several alternatives for
|
||||
handling non-ASCII content:
|
||||
<variablelist>
|
||||
<varlistentry><term>direct UTF-8</term>
|
||||
<listitem><para>
|
||||
If your editor and compiler are capable of handling UTF-8 encoded sources,
|
||||
it is very convenient to simply use UTF-8 for string literals, since it allows
|
||||
you to edit the strings in "wysiwyg". Note that choosing this option may
|
||||
reduce the portability of your code.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term>escaped UTF-8</term>
|
||||
<listitem><para>
|
||||
Even if your toolchain can't handle UTF-8 directly, you can still encode string
|
||||
literals in UTF-8 by using octal or hexadecimal escapes like
|
||||
<literal>\212</literal> or <literal>\xa8</literal> to
|
||||
encode each byte. This is portable, but modifying the escaped strings is not
|
||||
very convenient. Be careful when mixing hexadecimal escapes with ordinary text;
|
||||
<literal>"\xa8abcd"</literal> is a string of length 1 !
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry><term>runtime conversion</term>
|
||||
<listitem><para>
|
||||
If the string literals can be represented in an encoding which your toolchain
|
||||
can handle (e.g. IS0-8859-1), you can write your source files in that encoding
|
||||
and use <link linkend="g-convert">g_convert()</link> to convert the strings to
|
||||
UTF-8 at runtime. Note that this has some runtime overhead, so you may want to
|
||||
move the conversion out of inner loops.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
Here is an example showing the three approaches using the copyright sign
|
||||
© which has Unicode and ISO-8859-1 codepoint 169 and is represented in
|
||||
UTF-8 by the two bytes 194, 169:
|
||||
<informalexample><programlisting>
|
||||
g_print ("direct UTF-8: ©");
|
||||
g_print ("escaped UTF-8: \302\251");
|
||||
text = g_convert ("runtime conversion: ©", -1, "ISO-8859-1", "UTF-8", NULL, NULL, NULL);
|
||||
g_print(text);
|
||||
g_free (text);
|
||||
</programlisting></informalexample>
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How do I use GTK+ with C++?
|
||||
@@ -290,7 +414,100 @@ To load an image or animation file asynchronously (without blocking), use
|
||||
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How do I draw text ?
|
||||
</para></question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
To draw a piece of text, use a Pango layout and
|
||||
<link linkend="gdk-draw-layout">gdk_draw_layout()</link>,
|
||||
using code like the following:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
layout = gtk_widget_create_pango_layout (widget, text);
|
||||
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
|
||||
pango_layout_set_font_description (layout, fontdesc);
|
||||
gdk_draw_layout (..., layout);
|
||||
pango_font_description_free (fontdesc);
|
||||
g_object_unref (layout);
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
Do not use the deprecated <link linkend="GdkFont">GdkFont</link> and <link linkend="gdk-draw-text">gdk_draw_text()</link>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also the "Text Handling in GTK 2" section of
|
||||
<ulink url="http://developer.gnome.org/dotplan/porting/">Porting applications
|
||||
to the GNOME 2.0 platform</ulink>.
|
||||
</para>
|
||||
</answer>
|
||||
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>
|
||||
How do I measure the size of a piece of text ?
|
||||
</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
To obtain the size of a piece of text, use a Pango layout and
|
||||
<link
|
||||
linkend="pango-layout-get-pixel-size">pango_layout_get_pixel_size()</link>,
|
||||
using code like the following:
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
layout = gtk_widget_create_pango_layout (widget, text);
|
||||
fontdesc = pango_font_description_from_string ("Luxi Mono 12");
|
||||
pango_layout_set_font_description (layout, fontdesc);
|
||||
pango_layout_get_pixel_size (layout, &width, &height);
|
||||
pango_font_description_free (fontdesc);
|
||||
g_object_unref (layout);
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
Do not use the deprecated function <link linkend="gdk-text-width">gdk_text_width()</link>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also the "Text Handling in GTK 2" section of
|
||||
<ulink url="http://developer.gnome.org/dotplan/porting/">Porting applications
|
||||
to the GNOME 2.0 platform</ulink>.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question>
|
||||
<para>
|
||||
How do I make a text view scroll to the end of the buffer automatically ?
|
||||
</para>
|
||||
</question>
|
||||
|
||||
<answer>
|
||||
<para>
|
||||
The "insert" <link linkend="GtkTextMark">mark</link> marks the insertion point
|
||||
where <link linkend="gtk-text-buffer-insert">gtk_text_buffer_insert()</link>
|
||||
inserts new text into the buffer. The text is inserted
|
||||
<emphasis>before</emphasis> the "insert" mark, so that it generally stays
|
||||
at the end of the buffer. If it gets explicitly moved to some other position,
|
||||
e.g. when the user selects some text,
|
||||
use <link linkend="gtk-text-buffer-move-mark">gtk_text_buffer_move_mark()</link>
|
||||
to set it to the desired location before inserting more text.
|
||||
The "insert" mark of a buffer can be obtained with <link
|
||||
linkend="gtk-text-buffer-get-insert">gtk_text_buffer_get_insert()</link>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To ensure that the end of the buffer remains visible, use
|
||||
<link
|
||||
linkend="gtk-text-view-scroll-to-mark">gtk_text_view_scroll_to_mark()</link> to scroll to the "insert" mark after inserting new text.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
</qandadiv>
|
||||
|
||||
<qandadiv><title>Which widget should I use...</title>
|
||||
@@ -414,6 +631,48 @@ background of the event box.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How do I change the font of a widget?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
This has several possible answers, depending on what exactly you want to
|
||||
achieve. One option is <link
|
||||
linkend="gtk-widget-modify-font">gtk_widget_modify_font()</link>. Note that this function can be used to change only the font size, as in the following example:
|
||||
<programlisting>
|
||||
PangoFontDesc *font_desc = pango_font_description_new ();
|
||||
pango_font_description_set_size (font_desc, 40);
|
||||
gtk_widget_modify_font (widget, font);
|
||||
pango_font_description_free (font_desc);
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
If you want to make the text of a label larger, you can use <link
|
||||
linkend="gtk-label-set-markup">gtk_label_set_markup()</link>:
|
||||
<programlisting>
|
||||
gtk_label_set_markup (label, "<big>big text</big>");
|
||||
</programlisting>
|
||||
This is preferred for many apps because it's a relative size to the
|
||||
user's chosen font size. See <link
|
||||
linkend="g-markup-escape-text">g_markup_escape_text()</link>
|
||||
if you are constructing such strings on the fly.
|
||||
</para>
|
||||
<para>
|
||||
You can also change the font of a widget by putting
|
||||
<programlisting>
|
||||
gtk-font-name = "Sans 30"
|
||||
</programlisting>
|
||||
in a resource file and parsing it with <link
|
||||
linkend="gtk-rc-add-default-file">gtk_rc_add_default_file()</link>.
|
||||
The advantage of a resource file is that users can then override the
|
||||
font you've chosen. See
|
||||
<link linkend="gtk-Resource-Files">GTK+ resource files</link> for more
|
||||
discussion.
|
||||
</para>
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How do I disable/ghost/desensitize a widget?
|
||||
@@ -459,6 +718,20 @@ or <link
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How do I make a text widget display its complete contents in a specific font?
|
||||
</para></question>
|
||||
|
||||
<answer><para>
|
||||
If you use <link
|
||||
linkend="gtk-text-buffer-insert-with-tags">gtk_text_buffer_insert_with_tags()</link> with appropriate tags to select the font, the inserted text will have the desired appearance, but text typed in by the user before or after the tagged block will appear in the default style.
|
||||
</para>
|
||||
<para>
|
||||
To ensure that all text has the desired appearance, use <link
|
||||
linkend="gtk-widget-modify-font">gtk_widget_modify_font()</link> to change the default font for the widget.
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
</qandadiv>
|
||||
|
||||
|
||||
@@ -543,6 +816,88 @@ linkend="gtk-tree-model-get">gtk_tree_model_get()</link>.
|
||||
</answer>
|
||||
</qandaentry>
|
||||
|
||||
<qandaentry>
|
||||
<question><para>
|
||||
How do I change the way that numbers are formatted by <link linkend="GtkTreeView">GtkTreeView</link>?
|
||||
</para></question>
|
||||
<answer><para>
|
||||
Use <link linkend="gtk-tree-view-insert-column-with-data-func">gtk_tree_view_insert_column_with_data_func()</link>
|
||||
or <link linkend="gtk-tree-view-column-set-cell-data-func">gtk_tree_view_column_set_cell_data_func()</link>
|
||||
and do the conversion from number to string yourself (with, say,
|
||||
<link linkend="g-strdup-printf">g_strdup_printf()</link>).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following example demonstrates this:
|
||||
<informalexample><programlisting>
|
||||
enum
|
||||
{
|
||||
DOUBLE_COLUMN,
|
||||
N_COLUMNS
|
||||
};
|
||||
|
||||
GtkListStore *mycolumns;
|
||||
GtkTreeView *treeview;
|
||||
|
||||
void
|
||||
my_cell_double_to_text (GtkTreeViewColumn *tree_column,
|
||||
GtkCellRenderer *cell,
|
||||
GtkTreeModel *tree_model,
|
||||
GtkTreeIter *iter,
|
||||
gpointer data)
|
||||
{
|
||||
GtkCellRendererText *cell_text = (GtkCellRendererText *)cell;
|
||||
gdouble d;
|
||||
gchar *text;
|
||||
|
||||
/* Get the double value from the model. */
|
||||
gtk_tree_model_get (tree_model, iter, (gint)data, &d, -1);
|
||||
/* Now we can format the value ourselves. */
|
||||
text = g_strdup_printf ("%.2f", d);
|
||||
g_object_set (cell, "text", text, NULL);
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
void
|
||||
set_up_new_columns (GtkTreeView *myview)
|
||||
{
|
||||
GtkCellRendererText *renderer;
|
||||
GtkTreeViewColumn *column;
|
||||
GtkListStore *mycolumns;
|
||||
|
||||
/* Create the data model and associate it with the given TreeView */
|
||||
mycolumns = gtk_list_store_new (N_COLUMNS, G_TYPE_DOUBLE);
|
||||
gtk_tree_view_set_model (myview, GTK_TREE_MODEL (mycolumns));
|
||||
|
||||
/* Create a GtkCellRendererText */
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
|
||||
/* Create a new column that has a title ("Example column"),
|
||||
* uses the above created renderer that will render the double
|
||||
* value into text from the associated model's rows.
|
||||
*/
|
||||
column = gtk_tree_view_column_new ();
|
||||
gtk_tree_view_column_set_title (column, "Example column");
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
gtk_tree_view_column_pack_start (column, renderer, TRUE);
|
||||
|
||||
/* Append the new column after the GtkTreeView's previous columns. */
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (myview), column);
|
||||
/* Since we created the column by hand, we can set it up for our
|
||||
* needs, e.g. set its minimum and maximum width, etc.
|
||||
*/
|
||||
/* Set up a custom function that will be called when the column content
|
||||
* is rendered. We use the func_data pointer as an index into our
|
||||
* model. This is convenient when using multi column lists.
|
||||
*/
|
||||
gtk_tree_view_column_set_cell_data_func (column, renderer,
|
||||
my_cell_double_to_text,
|
||||
(gpointer)DOUBLE_COLUMN, NULL);
|
||||
}
|
||||
</programlisting></informalexample>
|
||||
</para></answer>
|
||||
</qandaentry>
|
||||
|
||||
</qandadiv>
|
||||
|
||||
|
||||
|
||||
@@ -104,7 +104,14 @@ Creates a new #GtkAdjustment.
|
||||
|
||||
<!-- ##### FUNCTION gtk_adjustment_set_value ##### -->
|
||||
<para>
|
||||
Sets the #GtkAdjustment value.
|
||||
Sets the #GtkAdjustment value. The value is clamped to lie between
|
||||
<literal>adjustment->lower</literal> and
|
||||
<literal>adjustment->upper</literal>.
|
||||
</para>
|
||||
<para>
|
||||
Note that for adjustments which are used in a #GtkScrollbar, the effective
|
||||
range of allowed values goes from <literal>adjustment->lower</literal> to
|
||||
<literal>adjustment->upper - adjustment->page_size</literal>.
|
||||
</para>
|
||||
|
||||
@adjustment: a #GtkAdjustment.
|
||||
|
||||
@@ -35,7 +35,7 @@ of the user for a drag destination site.
|
||||
If set for a widget, GTK+, during a drag over this
|
||||
widget will check if the drag matches this widget's
|
||||
list of possible targets and actions.
|
||||
GTK+ will then call gtk_drag_status() as appropriate.
|
||||
GTK+ will then call gdk_drag_status() as appropriate.
|
||||
@GTK_DEST_DEFAULT_HIGHLIGHT:
|
||||
If set for a widget, GTK+ will draw a highlight on
|
||||
this widget as long as a drag is over this widget
|
||||
@@ -44,7 +44,7 @@ of the user for a drag destination site.
|
||||
If set for a widget, when a drop occurs, GTK+ will
|
||||
will check if the drag matches this widget's
|
||||
list of possible targets and actions. If so,
|
||||
GTK+ will call gtk_drag_data_get() on behalf
|
||||
GTK+ will call gtk_drag_get_data() on behalf
|
||||
of the widget. Whether or not the drop is successful,
|
||||
GTK+ will call gtk_drag_finish(). If the action
|
||||
was a move, then if the drag was successful, then
|
||||
@@ -63,10 +63,9 @@ constraints on an entry in a #GtkTargetTable.
|
||||
@GTK_TARGET_SAME_APP:
|
||||
If this is set, the target will only be selected
|
||||
for drags within a single application.
|
||||
@GTK_TARGET_SAME_WIDGET:
|
||||
@GTK_TARGET_SAME_WIDGET:
|
||||
If this is set, the target will only be selected
|
||||
for drags within a single widget.
|
||||
@GTK_TARGET_SAME_WIDGET:
|
||||
|
||||
<!-- ##### FUNCTION gtk_drag_dest_set ##### -->
|
||||
<para>
|
||||
@@ -94,7 +93,7 @@ Sets this widget as a proxy for drops to another window.
|
||||
@proxy_window: the window to which to forward drag events
|
||||
@protocol: the drag protocol which the @proxy_window accepts
|
||||
(You can use gdk_drag_get_protocol() to determine this)
|
||||
@use_coordinates: If true, send the same coordinates to the
|
||||
@use_coordinates: If %TRUE, send the same coordinates to the
|
||||
destination, because it is an embedded
|
||||
subwindow.
|
||||
|
||||
@@ -158,7 +157,7 @@ is received or the retrieval fails, GTK+ will emit a
|
||||
"drag_data_received" signal. Failure of the retrieval
|
||||
is indicated by the length field of the @selection_data
|
||||
signal parameter being negative. However, when gtk_drag_get_data()
|
||||
is called implicitely because the %GTK_DRAG_DEFAULT_DROP was set,
|
||||
is called implicitely because the %GTK_DEST_DEFAULT_DROP was set,
|
||||
then the widget will not receive notification of failed
|
||||
drops.
|
||||
</para>
|
||||
|
||||
@@ -58,7 +58,7 @@ Used to indicate the direction in which a #GtkArrow should point.
|
||||
|
||||
<!-- ##### ENUM GtkAttachOptions ##### -->
|
||||
<para>
|
||||
Denotes the expansion properties that a widget will have when it (or it's
|
||||
Denotes the expansion properties that a widget will have when it (or its
|
||||
parent) is resized.
|
||||
</para>
|
||||
|
||||
@@ -204,7 +204,6 @@ Used for justifying the text inside a #GtkLabel widget. (See also
|
||||
@GTK_MOVEMENT_PARAGRAPH_ENDS:
|
||||
@GTK_MOVEMENT_PAGES:
|
||||
@GTK_MOVEMENT_BUFFER_ENDS:
|
||||
@GTK_MOVEMENT_HORIZONTAL_PAGES:
|
||||
|
||||
<!-- ##### ENUM GtkOrientation ##### -->
|
||||
<para>
|
||||
|
||||
@@ -34,11 +34,12 @@ Simple file operations; create directory, delete file, and rename file, are avai
|
||||
|
||||
/* The file selection widget and the string to store the chosen filename */
|
||||
|
||||
void store_filename (GtkFileSelection *file_selector, gpointer user_data) {
|
||||
void store_filename (GtkWidget *widget, gpointer user_data) {
|
||||
GtkWidget *file_selector = (GtkWidget *)user_data;
|
||||
const gchar *selected_filename;
|
||||
|
||||
selected_filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selector));
|
||||
g_print ("Selected filename: %s\n", selected_filename);
|
||||
g_print ("Selected filename: %s\n", selected_filename);
|
||||
}
|
||||
|
||||
void create_file_selection (void) {
|
||||
@@ -52,7 +53,7 @@ void create_file_selection (void) {
|
||||
g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
|
||||
"clicked",
|
||||
G_CALLBACK (store_filename),
|
||||
NULL);
|
||||
(gpointer) file_selector);
|
||||
|
||||
/* Ensure that the dialog box is destroyed when the user clicks a button. */
|
||||
|
||||
|
||||
@@ -428,7 +428,7 @@ used by GTK+ wrappers for languages other than C.
|
||||
|
||||
<!-- ##### FUNCTION gtk_quit_remove ##### -->
|
||||
<para>
|
||||
Removes a quit handler by it's identifier.
|
||||
Removes a quit handler by its identifier.
|
||||
</para>
|
||||
|
||||
@quit_handler_id: Identifier for the handler returned when installing it.
|
||||
@@ -436,7 +436,7 @@ Removes a quit handler by it's identifier.
|
||||
|
||||
<!-- ##### FUNCTION gtk_quit_remove_by_data ##### -->
|
||||
<para>
|
||||
Removes a quit handler identified by it's @data field.
|
||||
Removes a quit handler identified by its @data field.
|
||||
</para>
|
||||
|
||||
@data: The pointer passed as @data to gtk_quit_add() or gtk_quit_add_full().
|
||||
@@ -456,7 +456,6 @@ point the timeout is destroyed and will not be called again.
|
||||
@data: The data to pass to the function.
|
||||
@destroy: Function to call when the timeout is destroyed or %NULL.
|
||||
@Returns: A unique id for the event source.
|
||||
@Deprecated: Use g_timeout_add_full() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_timeout_add ##### -->
|
||||
@@ -471,7 +470,6 @@ point the timeout is destroyed and will not be called again.
|
||||
@function: The function to call periodically.
|
||||
@data: The data to pass to the function.
|
||||
@Returns: A unique id for the event source.
|
||||
@Deprecated: Use g_timeout_add() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_timeout_remove ##### -->
|
||||
@@ -480,7 +478,6 @@ Removes the given timeout destroying all information about it.
|
||||
</para>
|
||||
|
||||
@timeout_handler_id: The identifier returned when installing the timeout.
|
||||
@Deprecated: Use g_source_remove() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_add ##### -->
|
||||
@@ -493,7 +490,6 @@ higher priority are to be processed. The default priority is
|
||||
@function: The function to call.
|
||||
@data: The information to pass to the function.
|
||||
@Returns: a unique handle for this registration.
|
||||
@Deprecated: Use g_idle_add() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_add_priority ##### -->
|
||||
@@ -509,7 +505,6 @@ Note that you will interfere with GTK+ if you use a priority above
|
||||
@function: The function to call.
|
||||
@data: Data to pass to that function.
|
||||
@Returns: A unique id for the event source.
|
||||
@Deprecated: Use g_idle_add_full() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_add_full ##### -->
|
||||
@@ -527,7 +522,6 @@ Note that you will interfere with GTK+ if you use a priority above
|
||||
@data: Data to pass to that function.
|
||||
@destroy: Function to call when the timeout is destroyed or %NULL.
|
||||
@Returns: A unique id for the event source.
|
||||
@Deprecated: Use g_idle_add_full() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_remove ##### -->
|
||||
@@ -536,7 +530,6 @@ Removes the idle function with the given id.
|
||||
</para>
|
||||
|
||||
@idle_handler_id: Identifies the idle function to remove.
|
||||
@Deprecated: Use g_source_remove() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_idle_remove_by_data ##### -->
|
||||
@@ -545,7 +538,6 @@ Removes the idle function identified by the user data.
|
||||
</para>
|
||||
|
||||
@data: remove the idle function which was registered with this user data.
|
||||
@Deprecated: Use g_idle_remove_by_data() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_input_add_full ##### -->
|
||||
@@ -562,7 +554,6 @@ on a file descriptor.
|
||||
@destroy: callback function to call with @data when the input
|
||||
handler is removed, or %NULL.
|
||||
@Returns: A unique id for the event source; to be used with gtk_input_remove().
|
||||
@Deprecated: Use g_io_watch_full() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_input_remove ##### -->
|
||||
@@ -571,7 +562,6 @@ Removes the function with the given id.
|
||||
</para>
|
||||
|
||||
@input_handler_id: Identifies the function to remove.
|
||||
@Deprecated: Use g_source_remove() instead.
|
||||
|
||||
|
||||
<!-- ##### MACRO GTK_PRIORITY_REDRAW ##### -->
|
||||
|
||||
@@ -25,7 +25,7 @@ returns when any dialog button is clicked.
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Error loading file '%s': %s",
|
||||
"Error loading file '%s': %s",
|
||||
filename, g_strerror (errno));
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
@@ -42,7 +42,7 @@ You might do a non-modal #GtkMessageDialog as follows:
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_ERROR,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
"Error loading file '%s': %s",
|
||||
"Error loading file '%s': %s",
|
||||
filename, g_strerror (errno));
|
||||
|
||||
/* Destroy the dialog when the user responds to it (e.g. clicks a button) */
|
||||
|
||||
@@ -165,7 +165,7 @@ each child. Used by #GtkContainer.
|
||||
<!-- ##### FUNCTION gtk_object_new ##### -->
|
||||
<para>
|
||||
Constructs an object given its arguments, enumerated in the call to the
|
||||
function.
|
||||
function. Deprecated in favor of g_object_new().
|
||||
</para>
|
||||
|
||||
@type: the type identifying this object. Returned by gtk_type_unique()
|
||||
@@ -176,7 +176,6 @@ a #GTK_TYPE_FOO macro.)
|
||||
@Varargs: the first argument's value, followed by any number of
|
||||
name/argument-value pairs, terminated with %NULL.
|
||||
@Returns: the new #GtkObject.
|
||||
@Deprecated: Use g_object_new() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_sink ##### -->
|
||||
@@ -192,26 +191,27 @@ the top of the page.
|
||||
<!-- ##### FUNCTION gtk_object_ref ##### -->
|
||||
<para>
|
||||
Increases the reference count of the object.
|
||||
Deprecated in favor of g_object_ref().
|
||||
</para>
|
||||
|
||||
@object: the object to reference.
|
||||
@Returns: @object.
|
||||
@Deprecated: Use g_object_ref() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_unref ##### -->
|
||||
<para>
|
||||
Decreases the reference count of an object. When its reference count drops
|
||||
to 0, the object is finalized (i.e. its memory is freed).
|
||||
to 0, the object is finalized (i.e. its memory is freed). Deprecated in
|
||||
favor of g_object_unref().
|
||||
</para>
|
||||
|
||||
@object: the object to dereference.
|
||||
@Deprecated: Use g_object_unref() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_weakref ##### -->
|
||||
<para>
|
||||
Adds a weak reference callback to an object. Weak references are used for notification when an object is
|
||||
Adds a weak reference callback to an object. Deprecated in favor of
|
||||
g_object_weak_ref(). Weak references are used for notification when an object is
|
||||
finalized. They are called "weak references" because they allow you to safely
|
||||
hold a pointer to an object without calling g_object_ref() (g_object_ref() adds
|
||||
a strong reference, that is, forces the object to stay alive).
|
||||
@@ -220,7 +220,6 @@ a strong reference, that is, forces the object to stay alive).
|
||||
@object: object to weakly reference.
|
||||
@notify: callback to invoke before the object is freed.
|
||||
@data: extra data to pass to #notify.
|
||||
@Deprecated: Use g_object_weak_ref() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_weakunref ##### -->
|
||||
@@ -231,7 +230,6 @@ Removes a weak reference callback to an object.
|
||||
@object: object stop weakly referencing.
|
||||
@notify: callback to search for.
|
||||
@data: data to search for.
|
||||
@Deprecated: Use g_object_weak_unref() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_destroy ##### -->
|
||||
@@ -251,18 +249,17 @@ reference holders to release their references, it does not free the object.
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_get ##### -->
|
||||
<para>
|
||||
Gets properties of an object.
|
||||
Gets properties of an object. Deprecated in favor of g_object_get().
|
||||
</para>
|
||||
|
||||
@object: a #GtkObject.
|
||||
@first_property_name: name of first property to get the value for.
|
||||
@Varargs: %NULL-terminated list of name-return location pairs.
|
||||
@Deprecated: Use g_object_get() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_set ##### -->
|
||||
<para>
|
||||
Sets properties on an object.
|
||||
Sets properties on an object. Deprecated in favor of g_object_set().
|
||||
</para>
|
||||
<para>
|
||||
<informalexample>
|
||||
@@ -281,11 +278,11 @@ void set_box_properties (GtkBox* box)
|
||||
@first_property_name: name of the first property to set
|
||||
@Varargs: the value of the first argument, followed optionally
|
||||
by more name/value pairs, followed by %NULL.
|
||||
@Deprecated: Use g_object_set() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_set_data ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_set_data().
|
||||
Each object carries around a table of associations from
|
||||
strings to pointers. This function lets you set an association.
|
||||
</para>
|
||||
@@ -297,11 +294,11 @@ the old association will be destroyed.
|
||||
@object: object containing the associations.
|
||||
@key: name of the key.
|
||||
@data: data to associate with that key.
|
||||
@Deprecated: Use g_object_set_data() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_set_data_full ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_set_data_full().
|
||||
Like gtk_object_set_data() except it adds notification
|
||||
for when the association is destroyed, either by
|
||||
gtk_object_remove_data() or when the object is destroyed.
|
||||
@@ -311,11 +308,11 @@ gtk_object_remove_data() or when the object is destroyed.
|
||||
@key: name of the key.
|
||||
@data: data to associate with that key.
|
||||
@destroy: function to call when the association is destroyed.
|
||||
@Deprecated: Use g_object_set_data_full() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_remove_data ##### -->
|
||||
<para>
|
||||
Deprecated in favor of setting object data to %NULL using g_object_set_data().
|
||||
Removes a specified datum from the object's data associations (the object_data).
|
||||
Subsequent calls to gtk_object_get_data() will return %NULL.
|
||||
</para>
|
||||
@@ -326,22 +323,22 @@ it will be invoked.
|
||||
|
||||
@object: the object maintaining the association.
|
||||
@key: name of the key for that association.
|
||||
@Deprecated: Use g_object_set_data() to set the object data to %NULL instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_get_data ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_get_data().
|
||||
Get a named field from the object's table of associations (the object_data).
|
||||
</para>
|
||||
|
||||
@object: the object maintaining the associations.
|
||||
@key: name of the key for that association.
|
||||
@Returns: the data if found, or %NULL if no such data exists.
|
||||
@Deprecated: Use g_object_get_data() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_remove_no_notify ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_steal_data().
|
||||
Remove a specified datum from the object's data associations (the object_data),
|
||||
without invoking the association's destroy handler.
|
||||
</para>
|
||||
@@ -353,11 +350,11 @@ Therefore this only affects data set using gtk_object_set_data_full().
|
||||
|
||||
@object: the object maintaining the association.
|
||||
@key: name of the key for that association.
|
||||
@Deprecated: Use g_object_steal_data() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_set_user_data ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_set_data().
|
||||
For convenience, every object offers a generic user data
|
||||
pointer. This function sets it.
|
||||
</para>
|
||||
@@ -368,11 +365,11 @@ This function is equivalent to
|
||||
|
||||
@object: the object whose user data should be set.
|
||||
@data: the new value for the user data.
|
||||
@Deprecated: Use g_object_set_data() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_get_user_data ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_get_data().
|
||||
Get the object's user data pointer.
|
||||
</para>
|
||||
<para>
|
||||
@@ -382,7 +379,6 @@ writing applications.
|
||||
|
||||
@object: the object.
|
||||
@Returns: the user data field for object.
|
||||
@Deprecated: Use g_object_get_data() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_add_arg_type ##### -->
|
||||
@@ -402,6 +398,7 @@ settable or gettable, whether it is set when the object is constructed.)
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_set_data_by_id ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_set_qdata().
|
||||
Just like gtk_object_set_data() except that it takes
|
||||
a #GQuark instead of a string, so it is slightly faster.
|
||||
</para>
|
||||
@@ -413,11 +410,11 @@ to get an id from a string.
|
||||
@object: object containing the associations.
|
||||
@data_id: quark of the key.
|
||||
@data: data to associate with that key.
|
||||
@Deprecated: Use g_object_set_qdata() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_set_data_by_id_full ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_set_qdata_full().
|
||||
Just like gtk_object_set_data_full() except that it takes
|
||||
a #GQuark instead of a string, so it is slightly faster.
|
||||
</para>
|
||||
@@ -430,11 +427,11 @@ to get an id from a string.
|
||||
@data_id: quark of the key.
|
||||
@data: data to associate with that key.
|
||||
@destroy: function to call when the association is destroyed.
|
||||
@Deprecated: Use g_object_set_qdata_full() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_get_data_by_id ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_get_qdata().
|
||||
Just like gtk_object_get_data() except that it takes
|
||||
a #GQuark instead of a string, so it is slightly faster.
|
||||
</para>
|
||||
@@ -446,11 +443,11 @@ to get an id from a string.
|
||||
@object: object containing the associations.
|
||||
@data_id: quark of the key.
|
||||
@Returns: the data if found, or %NULL if no such data exists.
|
||||
@Deprecated: Use g_object_get_qdata() instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_remove_data_by_id ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_set_qdata() called with data of %NULL.
|
||||
Just like gtk_object_remove_data() except that it takes
|
||||
a #GQuark instead of a string, so it is slightly faster.
|
||||
</para>
|
||||
@@ -465,11 +462,11 @@ to get an id from a string.
|
||||
|
||||
@object: object containing the associations.
|
||||
@data_id: quark of the key.
|
||||
@Deprecated: Use g_object_set_qdata() with data of %NULL instead.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_object_remove_no_notify_by_id ##### -->
|
||||
<para>
|
||||
Deprecated in favor of g_object_steal_qdata().
|
||||
Just like gtk_object_remove_no_notify() except that it takes
|
||||
a #GQuark instead of a string, so it is slightly faster.
|
||||
</para>
|
||||
@@ -480,7 +477,8 @@ to get an id from a string.
|
||||
|
||||
@object: object containing the associations.
|
||||
@key_id: quark of the key.
|
||||
@Deprecated: Use g_object_steal_qdata() instead.
|
||||
<!-- # Unused Parameters # -->
|
||||
@data_id:
|
||||
|
||||
|
||||
<!-- ##### MACRO gtk_object_data_try_key ##### -->
|
||||
|
||||
@@ -32,7 +32,7 @@ Each child has two options that can be set,
|
||||
#GtkPaned is resized, that child will expand
|
||||
or shrink along with the paned widget. If @shrink
|
||||
is true, then when that child can be made smaller
|
||||
than it's requisition by the user. Setting @shrink
|
||||
than its requisition by the user. Setting @shrink
|
||||
to %FALSE allows the application to set a minimum
|
||||
size. If @resize is false for both children, then
|
||||
this is treated as if @resize is true for both
|
||||
|
||||
@@ -7,7 +7,7 @@ A choice from multiple check buttons.
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A single radio button performs the same basic function as a #GtkCheckButton,
|
||||
as it's position in the object hierarchy reflects. It is only when multiple
|
||||
as its position in the object hierarchy reflects. It is only when multiple
|
||||
radio buttons are grouped together that they become a different user
|
||||
interface component in their own right.</para>
|
||||
<para>
|
||||
|
||||
@@ -20,7 +20,7 @@ this:
|
||||
<example>
|
||||
<title>How to create a group of radio menu items.</title>
|
||||
<programlisting>
|
||||
GList *group = NULL;
|
||||
GSList *group = NULL;
|
||||
GtkWidget *item;
|
||||
gint i;
|
||||
|
||||
|
||||
@@ -22,8 +22,7 @@ and <filename>.gtkrc-2.0</filename> in the users home directory.
|
||||
(<filename><SYSCONFDIR></filename> defaults to
|
||||
<filename>/usr/local/etc</filename>. It can be changed with the
|
||||
<option>--prefix</option> or <option>--sysconfdir</option> options when
|
||||
configuring GTK+.) Note that although the filenames contain the version
|
||||
number 2.0, all 2.x versions of GTK+ look for these files.
|
||||
configuring GTK+.)
|
||||
</para>
|
||||
<para>
|
||||
The set of these <firstterm>default</firstterm> files
|
||||
@@ -95,28 +94,6 @@ but also #GtkToggleButton and
|
||||
#GtkCheckButton widgets, since
|
||||
those classes derive from #GtkButton.
|
||||
</para>
|
||||
<para>
|
||||
Additionally, a priority can be specified for each pattern, and styles
|
||||
override other styles first by priority, then by pattern type and then
|
||||
by order of specification (later overrides earlier). The priorities
|
||||
that can be specified are (highest to lowest):
|
||||
<simplelist>
|
||||
<member><literal>highest</literal></member>
|
||||
<member><literal>rc</literal></member>
|
||||
<member><literal>theme</literal></member>
|
||||
<member><literal>application</literal></member>
|
||||
<member><literal>gtk</literal></member>
|
||||
<member><literal>lowest</literal></member>
|
||||
</simplelist>
|
||||
<literal>rc</literal> is the default for styles
|
||||
read from an RC file, <literal>theme</literal>
|
||||
is the default for styles read from theme RC files,
|
||||
<literal>application</literal>
|
||||
should be used for styles an application sets
|
||||
up, and <literal>gtk</literal> is used for styles
|
||||
that GTK+ creates internally.
|
||||
</para>
|
||||
|
||||
</refsect2>
|
||||
|
||||
<refsect2><title>Toplevel declarations</title>
|
||||
@@ -140,7 +117,7 @@ The possible toplevel declarations are:
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>class <replaceable>pattern</replaceable>
|
||||
[ style | binding ][ : <replaceable>priority</replaceable> ]
|
||||
[ style | binding [ : <replaceable>priority</replaceable> ]]
|
||||
<replaceable>name</replaceable></literal></term>
|
||||
<listitem>
|
||||
<para>Specifies a style or binding set for a particular
|
||||
@@ -185,7 +162,7 @@ The possible toplevel declarations are:
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>widget <replaceable>pattern</replaceable>
|
||||
[ style | binding ][ : <replaceable>priority</replaceable> ]
|
||||
[ style | binding [ : <replaceable>priority</replaceable> ]]
|
||||
<replaceable>name</replaceable></literal></term>
|
||||
<listitem>
|
||||
<para>Specifies a style or binding set for a particular
|
||||
@@ -194,7 +171,7 @@ The possible toplevel declarations are:
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>widget_class <replaceable>pattern</replaceable>
|
||||
[ style | binding ][ : <replaceable>priority</replaceable> ]
|
||||
[ style | binding [ : <replaceable>priority</replaceable> ]]
|
||||
<replaceable>name</replaceable></literal></term>
|
||||
<listitem>
|
||||
<para>Specifies a style or binding set for a particular
|
||||
@@ -404,7 +381,7 @@ hex digits, or they can be specified as a triplet
|
||||
<literal>{ <replaceable>r</replaceable>, <replaceable>g</replaceable>,
|
||||
<replaceable>b</replaceable>}</literal>, where <literal>r</literal>,
|
||||
<literal>g</literal> and <literal>b</literal> are either integers in
|
||||
the range 0-65535 or floats in the range 0.0-1.0.
|
||||
the range 0-65635 or floats in the range 0.0-1.0.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -522,11 +499,29 @@ parameters of the signal.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Binding sets are connected to widgets in the same manner as styles,
|
||||
with one difference: Binding sets override other binding sets first
|
||||
by pattern type, then by priority and then by order of specification.
|
||||
The priorities that can be specified and their default values are the
|
||||
same as for styles.
|
||||
Binding sets are connected to widgets in the
|
||||
same manner as styles, with one addition.
|
||||
A priority can be specified for each pattern,
|
||||
and within each type of pattern, binding sets
|
||||
override other binding sets first by priority,
|
||||
and only then by order of specification. (Later
|
||||
overrides earlier). The priorities that can
|
||||
be specified are (highest to lowest):
|
||||
<simplelist>
|
||||
<member><literal>highest</literal></member>
|
||||
<member><literal>rc</literal></member>
|
||||
<member><literal>theme</literal></member>
|
||||
<member><literal>application</literal></member>
|
||||
<member><literal>gtk</literal></member>
|
||||
<member><literal>lowest</literal></member>
|
||||
</simplelist>
|
||||
<literal>rc</literal> is the default for bindings
|
||||
read from an RC file, <literal>theme</literal>
|
||||
is the default for bindings read from theme RC files,
|
||||
<literal>application</literal>
|
||||
should be used for bindings an application sets
|
||||
up, and <literal>gtk</literal> is used for bindings
|
||||
that GTK+ creates internally.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
|
||||
@@ -137,7 +137,8 @@ never be set by an application.)
|
||||
|
||||
<!-- ##### SIGNAL GtkSocket::plug-added ##### -->
|
||||
<para>
|
||||
|
||||
This signal is emitted when a client is successfully
|
||||
added to the socket.
|
||||
</para>
|
||||
|
||||
@socket: the object which received the signal.
|
||||
@@ -146,7 +147,9 @@ never be set by an application.)
|
||||
|
||||
<!-- ##### SIGNAL GtkSocket::plug-removed ##### -->
|
||||
<para>
|
||||
|
||||
This signal is emitted when a client is removed from the socket. The
|
||||
default action is to destroy the #GtkSocket widget, so if you want to
|
||||
reuse it you must add a signal handler that returns %TRUE.
|
||||
</para>
|
||||
|
||||
@socket: the object which received the signal.
|
||||
|
||||
@@ -140,7 +140,7 @@ GTK_SPIN_PAGE_BACKWARD</entry>
|
||||
<row>
|
||||
<entry>GTK_SPIN_HOME,
|
||||
GTK_SPIN_END</entry>
|
||||
<entry>These set the spin button's value to the minimum or maxmimum possible values, (set by it's #GtkAdjustment), respectively.</entry>
|
||||
<entry>These set the spin button's value to the minimum or maxmimum possible values, (set by its #GtkAdjustment), respectively.</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry>GTK_SPIN_USER_DEFINED</entry>
|
||||
|
||||
@@ -33,7 +33,7 @@ Status bars are created using gtk_statusbar_new().
|
||||
Messages are added to the bar's stack with gtk_statusbar_push().
|
||||
</para>
|
||||
<para>
|
||||
The message at the top of the stack can be removed using gtk_statusbar_pop(). A message can be removed from anywhere in the stack if it's message_id was recorded at the time it was added. This is done using gtk_statusbar_remove().
|
||||
The message at the top of the stack can be removed using gtk_statusbar_pop(). A message can be removed from anywhere in the stack if its message_id was recorded at the time it was added. This is done using gtk_statusbar_remove().
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
|
||||
@@ -154,7 +154,7 @@ The "Close" item.
|
||||
<!-- ##### MACRO GTK_STOCK_COLOR_PICKER ##### -->
|
||||
<para>
|
||||
The "Color Picker" item.
|
||||
<inlinegraphic fileref="stock_colorselector_24.png" format="PNG"></inlinegraphic>
|
||||
<inlinegraphic fileref="stock_color_picker_25.png" format="PNG"></inlinegraphic>
|
||||
</para>
|
||||
|
||||
@Since: 2.2
|
||||
|
||||
@@ -52,7 +52,7 @@ Internal #GtkText data type. Should not be accessed directly.
|
||||
Creates a new #GtkText widget, initialized with the given pointers to
|
||||
#GtkAdjustments. These pointers can be used to track the viewing position
|
||||
of the #GtkText widget. Passing %NULL to either or both of them will make
|
||||
the #GtkText create it's own. You can set these later with the function
|
||||
the #GtkText create its own. You can set these later with the function
|
||||
gtk_text_set_adjustment().
|
||||
</para>
|
||||
|
||||
@@ -213,7 +213,7 @@ Returns the character at the given index within the #GtkText widget.
|
||||
|
||||
<!-- ##### ARG GtkText:hadjustment ##### -->
|
||||
<para>
|
||||
Used by the #GtkText widget to keep track of the size of it's horizontal
|
||||
Used by the #GtkText widget to keep track of the size of its horizontal
|
||||
text.
|
||||
</para>
|
||||
|
||||
@@ -224,7 +224,7 @@ Boolean value indicating whether line wrap is enabled or not.
|
||||
|
||||
<!-- ##### ARG GtkText:vadjustment ##### -->
|
||||
<para>
|
||||
Used by the #GtkText widget to keep track of the size of it's vertical
|
||||
Used by the #GtkText widget to keep track of the size of its vertical
|
||||
text.
|
||||
</para>
|
||||
|
||||
|
||||
@@ -587,82 +587,6 @@ types related to the text widget and how they work together.
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_forward_visible_word_ends ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@count:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_backward_visible_word_starts ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@count:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_forward_visible_word_end ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_backward_visible_word_start ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_forward_visible_cursor_position ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_backward_visible_cursor_position ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_forward_visible_cursor_positions ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@count:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_backward_visible_cursor_positions ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@iter:
|
||||
@count:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_text_iter_set_offset ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@@ -669,6 +669,14 @@ in an idle job in the background.
|
||||
@textview: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkTextView::select-all ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@textview: the object which received the signal.
|
||||
@arg1:
|
||||
|
||||
<!-- ##### SIGNAL GtkTextView::set-anchor ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ create buttons which retain their state.
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
A #GtkToggleButton is a #GtkButton which will remain 'pressed-in' when
|
||||
clicked. Clicking again will cause the toggle button to return to it's
|
||||
clicked. Clicking again will cause the toggle button to return to its
|
||||
normal state.
|
||||
</para>
|
||||
<para>
|
||||
@@ -141,7 +141,7 @@ application ever to call this function.
|
||||
|
||||
<!-- ##### FUNCTION gtk_toggle_button_get_active ##### -->
|
||||
<para>
|
||||
Queries a #GtkToggleButton and returns it's current state. Returns %TRUE if
|
||||
Queries a #GtkToggleButton and returns its current state. Returns %TRUE if
|
||||
the toggle button is pressed in and %FALSE if it is raised.
|
||||
</para>
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ enum
|
||||
populate_model (list_store);
|
||||
|
||||
/* Get the first iter in the list */
|
||||
valid = gtk_tree_model_get_iter_first (list_store, &iter);
|
||||
valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
|
||||
while (valid)
|
||||
{
|
||||
@@ -180,8 +180,8 @@ enum
|
||||
g_print ("Row %d: (%s,%d)\n", row_count, str_data, int_data);
|
||||
g_free (str_data);
|
||||
|
||||
row_count ++;
|
||||
valid = gtk_tree_model_iter_next (list_store, &iter);
|
||||
row_count++;
|
||||
valid = gtk_tree_model_iter_next (model, &iter);
|
||||
}
|
||||
}
|
||||
</programlisting>
|
||||
|
||||
@@ -18,7 +18,7 @@ widget. It determines the geometry, type
|
||||
|
||||
<!-- ##### ENUM GtkTreeViewColumnSizing ##### -->
|
||||
<para>
|
||||
The sizing method the column uses to determine it's width. Please note
|
||||
The sizing method the column uses to determine its width. Please note
|
||||
that @GTK_TREE_VIEW_COLUMN_AUTOSIZE are inefficient for large views, and
|
||||
can make columns appear choppy.
|
||||
</para>
|
||||
@@ -462,6 +462,18 @@ calling gtk_tree_view_column_set_cell_data_func()
|
||||
@height:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_cell_get_position ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
@tree_column:
|
||||
@cell_renderer:
|
||||
@start_pos:
|
||||
@width:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gtk_tree_view_column_cell_is_visible ##### -->
|
||||
<para>
|
||||
|
||||
@@ -497,11 +509,6 @@ calling gtk_tree_view_column_set_cell_data_func()
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:expand ##### -->
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<!-- ##### ARG GtkTreeViewColumn:fixed-width ##### -->
|
||||
<para>
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ The base structure for a GTK+ type. Every type inherits this as a base structure
|
||||
|
||||
<!-- ##### TYPEDEF GtkEnumValue ##### -->
|
||||
<para>
|
||||
A structure which contains a single enum value, and its name, and it's
|
||||
A structure which contains a single enum value, and its name, and its
|
||||
nickname.
|
||||
</para>
|
||||
|
||||
|
||||
@@ -32,6 +32,14 @@ gtk_widget_style_get_valist() to obtain the value of a style property.
|
||||
|
||||
</para>
|
||||
|
||||
@style: The style for the widget. The style contains the colors the widget should be
|
||||
drawn in for each state along with graphics contexts used to draw with and the font
|
||||
to use for text.
|
||||
@requisition: The widgets desired size.
|
||||
@allocation: The widgets allocated size.
|
||||
@window: The widgets window or its parent window if it does not have a window. (Which
|
||||
will be indicated by the #GTK_NO_WINDOW flag being set).
|
||||
@parent:
|
||||
|
||||
<!-- ##### STRUCT GtkWidgetClass ##### -->
|
||||
<para>
|
||||
|
||||
@@ -1,338 +0,0 @@
|
||||
This file documents how GtkTextView works, at least partially. You
|
||||
probably want to read the text widget overview in the reference manual
|
||||
to get an application programmer overview of the public API before
|
||||
reading this. The overview in the reference manual documents
|
||||
GtkTextBuffer, GtkTextView, GtkTextMark, etc. from a public API
|
||||
standpoint.
|
||||
|
||||
The BTree
|
||||
===
|
||||
|
||||
The heart of the text widget is a data structure called GtkTextBTree,
|
||||
which implements all the hard work of the public GtkTextBuffer object.
|
||||
The purpose of the btree is to make most operations at least O(log N),
|
||||
so application programmers can just use whatever API is convenient
|
||||
without worrying about O(N) performance pitfalls.
|
||||
|
||||
The BTree is a tree of paragraphs (newline-terminated lines). The
|
||||
leaves of the tree are paragraphs, represented by a GtkTextLine. The
|
||||
nodes of the tree above the leaves are represented by
|
||||
GtkTextBTreeNode. The nodes are used to store aggregate data counts,
|
||||
so we can for example skip 100 paragraphs or 100 characters, without
|
||||
having to traverse 100 nodes in a list.
|
||||
|
||||
You might guess from this that many operations are O(N) where N is the
|
||||
number of bytes in a paragraph, and you would be right. The text
|
||||
widget is efficient for huge numbers of paragraphs, but will choke on
|
||||
extremely long blocks of text without intervening newlines.
|
||||
|
||||
("newline" is a slight lie, we also honor \r, \r\n, and some funky
|
||||
Unicode characters for paragraph breaks. So this means annoyingly that
|
||||
the paragraph break char may be more than one byte.)
|
||||
|
||||
The idea of the btree is something like:
|
||||
|
||||
|
||||
------ Node (lines = 6)
|
||||
/ Line 0
|
||||
/ Line 1
|
||||
/ Line 2
|
||||
/ Line 3
|
||||
/ Line 4
|
||||
/ Line 5
|
||||
Node (lines = 12)
|
||||
\
|
||||
\---------- Node (lines = 6)
|
||||
Line 6
|
||||
Line 7
|
||||
Line 8
|
||||
Line 9
|
||||
Line 10
|
||||
Line 11
|
||||
|
||||
|
||||
In addition to keeping aggregate line counts at each node, we count
|
||||
characters, and information about the tag toggles appearing below each
|
||||
node.
|
||||
|
||||
Structure of a GtkTextLine
|
||||
===
|
||||
|
||||
A GtkTextLine contains a single paragraph of text. It should probably
|
||||
be renamed GtkTextPara someday but ah well. GtkTextLine is used for
|
||||
the leaf nodes of the BTree.
|
||||
|
||||
A line is a list of GtkTextLineSegment. Line segments contain the
|
||||
actual data found in the text buffer.
|
||||
|
||||
Here are the types of line segment (see gtktextsegment.h,
|
||||
gtktextchild.h, etc.):
|
||||
|
||||
Character: contains a block of UTF-8 text.
|
||||
|
||||
Mark: marks a position in the buffer, such as a cursor.
|
||||
|
||||
Tag toggle: indicates that a tag is toggled on or toggled off at
|
||||
this point. when you apply a tag to a range of
|
||||
text, we add a toggle on at the start of the
|
||||
range, and a toggle off at the end. (and do any
|
||||
necessary merging with existing toggles, so we
|
||||
always have the minimum number possible)
|
||||
|
||||
Child widget: stores a child widget that behaves as a single
|
||||
Unicode character from an editing perspective.
|
||||
(well, stores a list of child widgets, one per
|
||||
GtkTextView displaying the buffer)
|
||||
|
||||
Image: stores a GdkPixbuf that behaves as a single
|
||||
character from an editing perspective.
|
||||
|
||||
|
||||
Each line segment has a "class" which identifies its type, and also
|
||||
provides some virtual functions for handling that segment.
|
||||
The functions in the class are:
|
||||
|
||||
- SplitFunc, divides the segment so another segment can be inserted.
|
||||
|
||||
- DeleteFunc, finalizes the segment
|
||||
|
||||
- CleanupFunc, after modifying a line by adding/removing segments,
|
||||
this function is used to try merging segments that can be merged,
|
||||
e.g. two adjacent character segments with no marks or toggles
|
||||
in between.
|
||||
|
||||
- LineChangeFunc, called when a segment moves to a different line;
|
||||
according to comments in the code this function may not be needed
|
||||
anymore.
|
||||
|
||||
- SegCheckFunc, does sanity-checking when debugging is enabled.
|
||||
Basically equivalent to assert(segment is not broken).
|
||||
|
||||
The segment class also contains two data fields:
|
||||
|
||||
- the name of the segment type, used for debugging
|
||||
|
||||
- a boolean flag for whether the segment has right or left
|
||||
gravity. A segment with right gravity ends up on the right of a
|
||||
newly-inserted segment that's placed at the same character offset,
|
||||
and a segment with left gravity ends up on the left of a
|
||||
newly-inserted segment. For example the insertion cursor
|
||||
has right gravity, because as you type new text is inserted,
|
||||
and the cursor ends up on the right.
|
||||
|
||||
The segment itself contains contains a header, plus some
|
||||
variable-length data that depends on the type of the segment.
|
||||
The header contains the length of the segment in characters and in
|
||||
bytes. Some segments have a length of zero. Segments with nonzero
|
||||
length are referred to as "indexable" and would generally be
|
||||
user-visible; indexable segments include text, images, and widgets.
|
||||
Segments with zero length occupy positions between characters, and
|
||||
include marks and tag toggles.
|
||||
|
||||
The GtkText*Body structs are the type-specific portions of
|
||||
GtkTextSegment.
|
||||
|
||||
Character segments have the actual character data allocated in the
|
||||
same malloc() block as the GtkTextSegment, to save both malloc()
|
||||
overhead and the overhead of a pointer to the character data.
|
||||
|
||||
Storing and tracking tags in the BTree
|
||||
===
|
||||
|
||||
A GtkTextTag is an object representing some text attributes. A tag
|
||||
can affect zero attributes (for example one used only for internal
|
||||
application bookkeeping), a single attribute such as "bold", or any
|
||||
number of attributes (such as large and bold and centered for a
|
||||
"header" tag).
|
||||
|
||||
The tags that can be applied to a given buffer are stored in the
|
||||
GtkTextTagTable for that buffer. The tag table is just a collection of
|
||||
tags.
|
||||
|
||||
The real work of applying/removing tags happens in the function
|
||||
_gtk_text_btree_tag(). Essentially we remove all tag toggle segments
|
||||
that affect the tag being applied or removed from the given range;
|
||||
then we add a toggle-on and a toggle-off segment at either end of the
|
||||
range; then for any lines we modified, we call the CleanupFunc
|
||||
routines for the segments, to merge segments that can be merged.
|
||||
|
||||
This is complicated somewhat because we keep information about the tag
|
||||
toggles in the btree, allowing us to locate tagged regions or
|
||||
add/remove tags in O(log N) instead of O(N) time. Tag information is
|
||||
stored in "struct Summary" (that's a bad name, it could probably use
|
||||
renaming). Each BTreeNode has a list of Summary hanging off of it, one
|
||||
for each tag that's toggled somewhere below the node. The Summary
|
||||
simply contains a count of tag toggle segments found below the node.
|
||||
|
||||
|
||||
Views of the BTree (GtkTextLayout)
|
||||
===
|
||||
|
||||
Each BTree has one or more views that display the tree. Originally
|
||||
there was some idea that a view could be any object, so there are some
|
||||
"gpointer view_id" left in the code. However, at some point we decided
|
||||
that all views had to be a GtkTextLayout and so the btree does assume
|
||||
that from time to time.
|
||||
|
||||
The BTree maintains some per-line and per-node data that is specific
|
||||
to each view. The per-line data is in GtkTextLineData and the per-node
|
||||
data is in another badly-named struct called NodeData (should be
|
||||
PerViewNodeData or something). The purpose of these is to store:
|
||||
|
||||
- aggregate height, so we can calculate the Y position of each
|
||||
paragraph in O(log N) time, and can get the full height
|
||||
of the buffer in O(1) time. The height is per-view since
|
||||
each GtkTextView may have a different size allocation.
|
||||
|
||||
- maximum width (the longest line), so we can calculate the width of
|
||||
the entire buffer in O(1) time in order to properly set up the
|
||||
horizontal scrollbar.
|
||||
|
||||
- a flag for whether the line is "valid" - valid lines have not been
|
||||
modified since we last computed their width and height. Invalid
|
||||
lines need to have their width and height recomputed.
|
||||
|
||||
At all times, we have a width and height for each view that can be
|
||||
used. This starts out as 0x0. Lines can be incrementally revalidated,
|
||||
which causes the width and height of the buffer to grow. So if you
|
||||
open a new text widget with a lot of text in it, you can watch the
|
||||
scrollbar adjust as the height is computed in an idle handler. Lines
|
||||
whose height has never been computed are taken to have a height of 0.
|
||||
|
||||
Iterators (GtkTextIter)
|
||||
===
|
||||
|
||||
Iterators are fairly complex in order to avoid re-traversing the btree
|
||||
or a line in the btree each time the iterator is used. That is, they
|
||||
save a bunch of pointers - to the current segment, the current line,
|
||||
etc.
|
||||
|
||||
Two "validity stamps" are kept in the btree that are used to detect
|
||||
and handle possibly-invalid pointers in iterators. The
|
||||
"chars_changed_stamp" is incremented whenever a segment with
|
||||
char_count > 0 (an indexable segment) is added or removed. It is an
|
||||
application bug if the application uses an iterator with a
|
||||
chars_changed_stamp different from the current stamp of the BTree.
|
||||
That is, you can't use an iterator after adding/removing characters.
|
||||
|
||||
The "segments_changed_stamp" is incremented any time we change any
|
||||
segments, and tells outstanding iterators that any pointers to
|
||||
GtkTextSegment that they may be holding are now invalid. For example,
|
||||
if you are iterating over a character segment, and insert a mark in
|
||||
the middle of the segment, the character segment will be split in half
|
||||
and the original segment will be freed. This increments
|
||||
segments_changed_stamp, causing your iterator to drop its current
|
||||
segment pointer and count from the beginning of the line again to find
|
||||
the new segment.
|
||||
|
||||
Iterators also cache some random information such as the current line
|
||||
number, just because it's free to do so.
|
||||
|
||||
GtkTextLayout
|
||||
===
|
||||
|
||||
If you think of GtkTextBTree as the backend for GtkTextBuffer,
|
||||
GtkTextLayout is the backend for GtkTextView. GtkTextLayout was also
|
||||
used for a canvas item at one point, which is why its methods are not
|
||||
underscore-prefixed and the header gets installed. But GtkTextLayout
|
||||
is really intended to be private.
|
||||
|
||||
The main task of GtkTextLayout is to validate lines (compute their
|
||||
width and height) by converting the lines to a PangoLayout and using
|
||||
Pango functions. GtkTextLayout is also used for visual iteration, and
|
||||
mapping visual locations to logical buffer positions.
|
||||
|
||||
Validating a line involves creating the GtkTextLineDisplay for that
|
||||
line. To save memory, GtkTextLineDisplay objects are always created
|
||||
transiently, we don't keep them around.
|
||||
|
||||
The layout has three signals:
|
||||
|
||||
- "invalidated" means some line was changed, so GtkTextView
|
||||
needs to install idle handlers to revalidate.
|
||||
|
||||
- "changed" means some lines were validated, so the aggregate
|
||||
width/height of the BTree is now different.
|
||||
|
||||
- "allocate_child" means we need to size allocate a
|
||||
child widget
|
||||
|
||||
gtk_text_layout_get_line_display() is sort of the "heart" of
|
||||
GtkTextLayout. This function validates a line.
|
||||
|
||||
Line validation involves:
|
||||
|
||||
- convert any GtkTextTag on the line to PangoAttrList
|
||||
|
||||
- add the preedit string
|
||||
|
||||
- keep track of "visible marks" (the cursor)
|
||||
|
||||
A given set of tags is composited to a GtkTextAttributes. (In the Tk
|
||||
code this was called a "style" and there are still relics of this in
|
||||
the code, such as "invalidate_cached_style()", that should be cleaned
|
||||
up.)
|
||||
|
||||
There's a single-GtkTextAttributes cache, "layout->one_style_cache",
|
||||
which is used to avoid recomputing the mapping from tags to attributes
|
||||
for every segment. The one_style_cache is stored in the GtkTextLayout
|
||||
instead of just a local variable in gtk_text_layout_get_line_display()
|
||||
so we can use it across multiple lines. Any time we see a segment that
|
||||
may change the current style (such as a tag toggle), the cache has to
|
||||
be dropped.
|
||||
|
||||
To compute a GtkTextAttributes from the GtkTextTag that apply to a
|
||||
given segment, the function is _gtk_text_attributes_fill_from_tags().
|
||||
This "mashes" a list of tags into a single set of text attributes.
|
||||
If no tags affect a given attribute, a default set of attributes are
|
||||
used. These defaults sometimes come from widget->style on the
|
||||
GtkTextView, and sometimes come from a property of the GtkTextView
|
||||
such as "pixels_above_lines"
|
||||
|
||||
GtkTextView
|
||||
===
|
||||
|
||||
Once you get GtkTextLayout and GtkTextBTree the actual GtkTextView
|
||||
widget is not that complicated.
|
||||
|
||||
The main complexity is the interaction between scrolling and line
|
||||
validation, which is documented with a long comment in gtktextview.c.
|
||||
|
||||
The other thing to know about is just that the text view has "border
|
||||
windows" on the sides, used to draw line numbers and such; these
|
||||
scroll along with the main window.
|
||||
|
||||
Invisible text
|
||||
===
|
||||
|
||||
Invisible text doesn't work yet. It is a property that can be set by a
|
||||
GtkTextTag; so you determine whether text is invisible using the same
|
||||
mechanism you would use to check whether the text is bold, or orange.
|
||||
|
||||
The intended behavior of invisible text is that it should vanish
|
||||
completely, as if it did not exist. The use-case we were thinking of
|
||||
was a code editor with function folding, where you can hide all
|
||||
function bodies. That could be implemented by creating a
|
||||
"function_body" GtkTextTag and toggling its "invisible" attribute to
|
||||
hide/show the function bodies.
|
||||
|
||||
Lines are normally validated in an idle handler, but as an exception,
|
||||
lines that are onscreen are always validated synchronously. Thus
|
||||
invisible text raises the danger that we might have a huge number of
|
||||
invisible lines "onscreen" - this needs to be handled efficiently.
|
||||
|
||||
At one point we were considering making "invisible" a per-paragraph
|
||||
attribute (meaning the invisibility state of the first character in
|
||||
the paragraph makes the whole paragraph visible or not
|
||||
visible). Several existing tag attributes work this way, such as the
|
||||
margin width. I don't remember why we were going to do this, but it
|
||||
may have been due to some implementation difficulty that will become
|
||||
clear if you try implementing invisible text. ;-)
|
||||
|
||||
To finish invisible text support, all the cursor navigation
|
||||
etc. functions (the _display_lines() stuff) will need to skip
|
||||
invisible text. Also, various functions with _visible in the name,
|
||||
such as gtk_text_iter_get_visible_text(), have to be audited to be
|
||||
sure they don't get invisible text. And user operations such as
|
||||
cut-and-paste need to copy only visible text.
|
||||
|
||||
@@ -8936,7 +8936,6 @@ section.</para>
|
||||
<!-- example-start menu itemfactory.c -->
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <strings.h>
|
||||
|
||||
/* Obligatory basic callback */
|
||||
static void print_hello( GtkWidget *w,
|
||||
|
||||
@@ -43,7 +43,7 @@ GtkWidget *create_bbox( gint horizontal,
|
||||
int main( int argc,
|
||||
char *argv[] )
|
||||
{
|
||||
static GtkWidget* window = NULL;
|
||||
GtkWidget *window;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
|
||||
@@ -146,7 +146,7 @@ gtk_dial_destroy (GtkObject *object)
|
||||
|
||||
dial = GTK_DIAL (object);
|
||||
|
||||
if (dial->adjustment)
|
||||
if (dial->adjustment)
|
||||
{
|
||||
g_object_unref (GTK_OBJECT (dial->adjustment));
|
||||
dial->adjustment = NULL;
|
||||
@@ -353,7 +353,7 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
if ((upper - lower) == 0)
|
||||
return FALSE;
|
||||
|
||||
increment = (100*M_PI) / (dial->radius*dial->radius);
|
||||
increment = (100*G_PI) / (dial->radius*dial->radius);
|
||||
|
||||
inc = (upper - lower);
|
||||
|
||||
@@ -363,7 +363,7 @@ gtk_dial_expose (GtkWidget *widget,
|
||||
|
||||
for (i = 0; i <= inc; i++)
|
||||
{
|
||||
theta = ((gfloat)i*M_PI / (18*inc/24.) - M_PI/6.);
|
||||
theta = ((gfloat)i*G_PI / (18*inc/24.) - G_PI/6.);
|
||||
|
||||
if ((theta - last) < (increment))
|
||||
continue;
|
||||
@@ -558,17 +558,17 @@ gtk_dial_update_mouse (GtkDial *dial, gint x, gint y)
|
||||
old_value = dial->adjustment->value;
|
||||
dial->angle = atan2(yc-y, x-xc);
|
||||
|
||||
if (dial->angle < -M_PI/2.)
|
||||
dial->angle += 2*M_PI;
|
||||
if (dial->angle < -G_PI/2.)
|
||||
dial->angle += 2*G_PI;
|
||||
|
||||
if (dial->angle < -M_PI/6)
|
||||
dial->angle = -M_PI/6;
|
||||
if (dial->angle < -G_PI/6)
|
||||
dial->angle = -G_PI/6;
|
||||
|
||||
if (dial->angle > 7.*M_PI/6.)
|
||||
dial->angle = 7.*M_PI/6.;
|
||||
if (dial->angle > 7.*G_PI/6.)
|
||||
dial->angle = 7.*G_PI/6.;
|
||||
|
||||
dial->adjustment->value = dial->adjustment->lower + (7.*M_PI/6 - dial->angle) *
|
||||
(dial->adjustment->upper - dial->adjustment->lower) / (4.*M_PI/3.);
|
||||
dial->adjustment->value = dial->adjustment->lower + (7.*G_PI/6 - dial->angle) *
|
||||
(dial->adjustment->upper - dial->adjustment->lower) / (4.*G_PI/3.);
|
||||
|
||||
if (dial->adjustment->value != old_value)
|
||||
{
|
||||
@@ -615,7 +615,7 @@ gtk_dial_update (GtkDial *dial)
|
||||
g_signal_emit_by_name (GTK_OBJECT (dial->adjustment), "value_changed");
|
||||
}
|
||||
|
||||
dial->angle = 7.*M_PI/6. - (new_value - dial->adjustment->lower) * 4.*M_PI/3. /
|
||||
dial->angle = 7.*G_PI/6. - (new_value - dial->adjustment->lower) * 4.*G_PI/3. /
|
||||
(dial->adjustment->upper - dial->adjustment->lower);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (dial));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <strings.h>
|
||||
|
||||
/* Obligatory basic callback */
|
||||
static void print_hello( GtkWidget *w,
|
||||
@@ -30,12 +29,12 @@ static void print_selected(gpointer callback_data,
|
||||
/* Our menu, an array of GtkItemFactoryEntry structures that defines each menu item */
|
||||
static GtkItemFactoryEntry menu_items[] = {
|
||||
{ "/_File", NULL, NULL, 0, "<Branch>" },
|
||||
{ "/File/_New", "<control>N", print_hello, 0, "<StockItem>", GTK_STOCK_NEW },
|
||||
{ "/File/_Open", "<control>O", print_hello, 0, "<StockItem>", GTK_STOCK_OPEN },
|
||||
{ "/File/_Save", "<control>S", print_hello, 0, "<StockItem>", GTK_STOCK_SAVE },
|
||||
{ "/File/_New", "<control>N", print_hello, 0, "<Item>" },
|
||||
{ "/File/_Open", "<control>O", print_hello, 0, "<Item>" },
|
||||
{ "/File/_Save", "<control>S", print_hello, 0, "<Item>" },
|
||||
{ "/File/Save _As", NULL, NULL, 0, "<Item>" },
|
||||
{ "/File/sep1", NULL, NULL, 0, "<Separator>" },
|
||||
{ "/File/_Quit", "<CTRL>Q", gtk_main_quit, 0, "<StockItem>", GTK_STOCK_QUIT },
|
||||
{ "/File/Quit", "<control>Q", gtk_main_quit, 0, "<Item>" },
|
||||
{ "/_Options", NULL, NULL, 0, "<Branch>" },
|
||||
{ "/Options/tear", NULL, NULL, 0, "<Tearoff>" },
|
||||
{ "/Options/Check", NULL, print_toggle, 1, "<CheckItem>" },
|
||||
|
||||
@@ -39,7 +39,6 @@ void cb_page_size( GtkAdjustment *get,
|
||||
gtk_adjustment_set_value (set, CLAMP (set->value,
|
||||
set->lower,
|
||||
(set->upper - set->page_size)));
|
||||
g_signal_emit_by_name(G_OBJECT(set), "changed");
|
||||
}
|
||||
|
||||
void cb_draw_value( GtkToggleButton *button )
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <gtk/gtktable.h>
|
||||
#include <gtk/gtktogglebutton.h>
|
||||
#include "gtk/gtksignal.h"
|
||||
#include "gtk/gtktable.h"
|
||||
#include "gtk/gtktogglebutton.h"
|
||||
#include "tictactoe.h"
|
||||
|
||||
enum {
|
||||
@@ -34,7 +34,7 @@ static void tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt);
|
||||
static gint tictactoe_signals[LAST_SIGNAL] = { 0 };
|
||||
|
||||
GType
|
||||
tictactoe_get_type (void)
|
||||
tictactoe_get_type ()
|
||||
{
|
||||
static GType ttt_type = 0;
|
||||
|
||||
@@ -43,50 +43,57 @@ tictactoe_get_type (void)
|
||||
static const GTypeInfo ttt_info =
|
||||
{
|
||||
sizeof (TictactoeClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
NULL,
|
||||
NULL,
|
||||
(GClassInitFunc) tictactoe_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
NULL,
|
||||
NULL,
|
||||
sizeof (Tictactoe),
|
||||
0,
|
||||
(GInstanceInitFunc) tictactoe_init,
|
||||
};
|
||||
|
||||
ttt_type = g_type_register_static (GTK_TYPE_TABLE, "Tictactoe", &ttt_info, 0);
|
||||
ttt_type = g_type_register_static (GTK_TYPE_VBOX, "Tictactoe", &ttt_info, 0);
|
||||
}
|
||||
|
||||
return ttt_type;
|
||||
}
|
||||
|
||||
static void
|
||||
tictactoe_class_init (TictactoeClass *klass)
|
||||
tictactoe_class_init (TictactoeClass *class)
|
||||
{
|
||||
GtkObjectClass *object_class;
|
||||
|
||||
object_class = (GtkObjectClass*) class;
|
||||
|
||||
tictactoe_signals[TICTACTOE_SIGNAL] = g_signal_new ("tictactoe",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
|
||||
G_STRUCT_OFFSET (TictactoeClass, tictactoe),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
G_TYPE_NONE, 0, NULL);
|
||||
|
||||
|
||||
class->tictactoe = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
tictactoe_init (Tictactoe *ttt)
|
||||
{
|
||||
GtkWidget *table;
|
||||
gint i,j;
|
||||
|
||||
gtk_table_resize (GTK_TABLE (ttt), 3, 3);
|
||||
gtk_table_set_homogeneous (GTK_TABLE (ttt), TRUE);
|
||||
table = gtk_table_new (3, 3, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (ttt), table);
|
||||
gtk_widget_show (table);
|
||||
|
||||
for (i=0;i<3; i++)
|
||||
for (j=0;j<3; j++) {
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
ttt->buttons[i][j] = gtk_toggle_button_new ();
|
||||
gtk_table_attach_defaults (GTK_TABLE (ttt), ttt->buttons[i][j],
|
||||
gtk_table_attach_defaults (GTK_TABLE (table), ttt->buttons[i][j],
|
||||
i, i+1, j, j+1);
|
||||
g_signal_connect (G_OBJECT (ttt->buttons[i][j]), "toggled",
|
||||
G_CALLBACK (tictactoe_toggle), (gpointer) ttt);
|
||||
@@ -106,17 +113,15 @@ tictactoe_clear (Tictactoe *ttt)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
for (i = 0; i<3; i++)
|
||||
for (j = 0; j<3; j++)
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
g_signal_handlers_block_matched (G_OBJECT (ttt->buttons[i][j]),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, ttt);
|
||||
g_signal_handlers_block_by_func (G_OBJECT (ttt->buttons[i][j]),
|
||||
NULL, ttt);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ttt->buttons[i][j]),
|
||||
FALSE);
|
||||
g_signal_handlers_unblock_matched (G_OBJECT (ttt->buttons[i][j]),
|
||||
G_SIGNAL_MATCH_DATA,
|
||||
0, 0, NULL, NULL, ttt);
|
||||
g_signal_handlers_unblock_by_func (G_OBJECT (ttt->buttons[i][j]),
|
||||
NULL, ttt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,12 +139,12 @@ tictactoe_toggle (GtkWidget *widget, Tictactoe *ttt)
|
||||
|
||||
int success, found;
|
||||
|
||||
for (k = 0; k<8; k++)
|
||||
for (k = 0; k < 8; k++)
|
||||
{
|
||||
success = TRUE;
|
||||
found = FALSE;
|
||||
|
||||
for (i = 0; i<3; i++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
success = success &&
|
||||
GTK_TOGGLE_BUTTON (ttt->buttons[rwins[k][i]][cwins[k][i]])->active;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
@@ -20,18 +21,17 @@
|
||||
#define __TICTACTOE_H__
|
||||
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <gtk/gtktable.h>
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkvbox.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define TICTACTOE_TYPE (tictactoe_get_type ())
|
||||
#define TICTACTOE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TICTACTOE_TYPE, Tictactoe))
|
||||
#define TICTACTOE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TICTACTOE_TYPE, TictactoeClass))
|
||||
#define IS_TICTACTOE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TICTACTOE_TYPE))
|
||||
#define IS_TICTACTOE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TICTACTOE_TYPE))
|
||||
#define TICTACTOE(obj) GTK_CHECK_CAST (obj, tictactoe_get_type (), Tictactoe)
|
||||
#define TICTACTOE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, tictactoe_get_type (), TictactoeClass)
|
||||
#define IS_TICTACTOE(obj) GTK_CHECK_TYPE (obj, tictactoe_get_type ())
|
||||
|
||||
|
||||
typedef struct _Tictactoe Tictactoe;
|
||||
@@ -39,23 +39,25 @@ typedef struct _TictactoeClass TictactoeClass;
|
||||
|
||||
struct _Tictactoe
|
||||
{
|
||||
GtkTable table;
|
||||
GtkVBox vbox;
|
||||
|
||||
GtkWidget *buttons[3][3];
|
||||
};
|
||||
|
||||
struct _TictactoeClass
|
||||
{
|
||||
GtkTableClass parent_class;
|
||||
GtkVBoxClass parent_class;
|
||||
|
||||
void (* tictactoe) (Tictactoe *ttt);
|
||||
};
|
||||
|
||||
GType tictactoe_get_type (void);
|
||||
GtkType tictactoe_get_type (void);
|
||||
GtkWidget* tictactoe_new (void);
|
||||
void tictactoe_clear (Tictactoe *ttt);
|
||||
|
||||
G_END_DECLS
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __TICTACTOE_H__ */
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ int main( int argc,
|
||||
gtk_container_add (GTK_CONTAINER (window), ttt);
|
||||
gtk_widget_show (ttt);
|
||||
|
||||
/* And attach to its "tictactoe" signal */
|
||||
g_signal_connect (G_OBJECT (ttt), "tictactoe",
|
||||
G_CALLBACK (win), NULL);
|
||||
|
||||
|
||||
@@ -1,3 +1,107 @@
|
||||
Mon Aug 18 10:25:29 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk-pixdata.c (gdk_pixdata_to_csource): Add the correct
|
||||
alignment magic for Sun compiler and for GCC to get
|
||||
the strings aligned. (Patch from Brian Cameron, #117217)
|
||||
|
||||
2003-08-14 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixdata.c (gdk_pixdata_to_csource): Improve doc comment
|
||||
wording. (#119754, Doug Quale)
|
||||
|
||||
2003-08-03 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixbuf.c (gdk_pixbuf_get_rowstride):
|
||||
* gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Clarify misleading explanation of
|
||||
rowstride. (#119000)
|
||||
|
||||
2003-07-18 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* pixops/pixops.c (correct_total): Split correction into multiple pieces if no single weight is large
|
||||
enough to apply the unsplit correction. (#117431, problem reported by Tomas Ögren)
|
||||
|
||||
2003-07-11 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* queryloaders.c (query_module): Handle absolute filenames properly. (#117170, Jens Elkner)
|
||||
|
||||
2003-06-28 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-ico.c (DecodeHeader): Stop discriminating against 32bpp ICOs a): Use the byte
|
||||
size of the image as a heuristic when selecting the bitmap to load - this lets us
|
||||
select 32bpp bitmaps which come after a 8bpp bitmap.
|
||||
(OneLineTransp): Stop discriminating against 32bpp ICOs b): Don't overwrite the
|
||||
alpha channel of 32bpp ICOs.
|
||||
(gdk_pixbuf__ico_image_load_increment): Stop decoding the header unnecessarily.
|
||||
|
||||
2003-06-23 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-gif.c (gif_get_frame_info): Remove the pointless refusal to load images with dubious
|
||||
disposal mode on the first frame. Just ignore it, as everybody else does.
|
||||
|
||||
2003-06-22 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-gif.c (gif_get_extension): Reset block_count to 0 for all application extensions, otherwise the data blocks
|
||||
of unknown extensions are not propertly skipped.
|
||||
|
||||
2003-06-21 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-gif.c (gif_get_frame_info): Don't stop on empty frames.
|
||||
(gif_get_lzw): Handle empty frames as 1x1 transparent
|
||||
pixbufs. (#106962, Federico Mena Quintero)
|
||||
|
||||
2003-06-21 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-gif.c (gif_get_lzw): Correct the calls to update_func() to
|
||||
consistently specify animation-relative data.
|
||||
(gif_get_frame_info): When debugging, also dump whether the
|
||||
frame is interlaced.
|
||||
|
||||
2003-06-03 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixdata.c (gdk_pixbuf_new_from_inline): Document
|
||||
data_length == -1, add an example. (#97290)
|
||||
|
||||
2003-06-01 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixdata.h (struct _GdkPixdata): Fix misleading documentation
|
||||
of rowstride. (#113924, Noah Levitt)
|
||||
|
||||
2003-05-27 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-wbmp.c: Remove dubious bitfields of
|
||||
unspecified signedness. (#112919, Morten Welinder)
|
||||
|
||||
* gdk-pixdata.c (gdk_pixdata_to_csource): Replace all occurances
|
||||
of g_string_new ("") by g_string_new (NULL). (#106975, Morten Welinder)
|
||||
|
||||
2003-05-19 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
Improve progressive loading from slow sources: (#107368)
|
||||
|
||||
* io-gif-animation.c (gdk_pixbuf_gif_anim_get_iter): Initialize
|
||||
first_loop_slowness.
|
||||
(gdk_pixbuf_gif_anim_iter_advance): Don't wrap during loading if
|
||||
the datasource falls behind the speed of the display.
|
||||
|
||||
* io-gif-animation.h: Add a loading flag to GdkPixbufGifAnim and
|
||||
first_loop_slowness to GdkPixbufGifAnimIter.
|
||||
|
||||
Wed May 14 18:24:50 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gdk-pixdata.c (gdk_pixdata_deserialize): Add a
|
||||
(gint32 *) => (guint32 *) cast. (#108615, Rick Jones)
|
||||
|
||||
2003-04-24 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixbuf-loader.c (gdk_pixbuf_loader_write):
|
||||
(gdk_pixbuf_loader_new_with_type):
|
||||
(gdk_pixbuf_loader_close):
|
||||
* gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
|
||||
(gdk_pixbuf_save):
|
||||
(gdk_pixbuf_savev):
|
||||
* gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
|
||||
Add sanity checks for GError handling. (#108345)
|
||||
|
||||
2003-03-21 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* gdk-pixbuf-animation.c (gdk_pixbuf_non_anim_get_type): Add
|
||||
@@ -7,7 +111,7 @@
|
||||
* io-ico.c (gdk_pixbuf__ico_image_stop_load): Add missing static
|
||||
qualifiers apparently causing problems on some platforms. (#108617)
|
||||
|
||||
2003-03-11 Matthias Clasen <maclas@gmx.de>
|
||||
2003-03-12 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-ico.c (DecodeHeader): Calculate LineWidth for 16bpp from
|
||||
width, like for the other depths. (noticed by Marijn Ros)
|
||||
@@ -30,32 +134,6 @@
|
||||
transparent pixels, no matter whether the frame has transparency
|
||||
or not. (#55502)
|
||||
|
||||
2003-02-18 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-tga.c (pixbuf_flip_row):
|
||||
(pixbuf_flip_vertically): Auxiliary functions used to implement
|
||||
support for arbitrary origins.
|
||||
(parse_data_for_row_pseudocolor):
|
||||
(parse_data_for_row_truecolor):
|
||||
(parse_data_for_row_grayscale):
|
||||
(parse_data_for_row):
|
||||
(fill_in_context): Remove the check for upper-left origin.
|
||||
(parse_rle_data): Support arbitrary origins. (#105912)
|
||||
|
||||
* io-tga.c (fread_check):
|
||||
(fseek_check):
|
||||
(get_header_from_file):
|
||||
(get_colormap_from_file):
|
||||
(get_image_pseudocolor):
|
||||
(swap_channels_pixbuf):
|
||||
(get_image_truecolor):
|
||||
(get_image_grayscale):
|
||||
(gdk_pixbuf__tga_load): Remove the non-incremental load
|
||||
implementation, since we have generic_image_load () now.
|
||||
|
||||
(gdk_pixbuf__tga_stop_load): Fix a potential crash discovered by
|
||||
pixbuf-lowmem.
|
||||
|
||||
2003-02-14 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* io-tga.c (try_preload):
|
||||
@@ -68,16 +146,40 @@
|
||||
module_open() fails. (#105349, Tim Mooney)
|
||||
|
||||
Mon Jan 27 17:10:30 2003 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* Makefile.am (gdk-pixbuf.loaders): Rewrite to run
|
||||
on the .la files rather than looking for .so files.
|
||||
(#102142, Martin Gansser)
|
||||
|
||||
* Makefile.am: Don't build gdk-pixbuf.loaders when
|
||||
cross-compiling.
|
||||
|
||||
|
||||
* Makefile.am (gdk-pixbuf.loaders): Rewrite to run
|
||||
on the .la files rather than looking for .so files.
|
||||
(#102142, Martin Gansser)
|
||||
|
||||
* Makefile.am: Don't build gdk-pixbuf.loaders when
|
||||
cross-compiling.
|
||||
|
||||
2003-01-12 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* gdk_pixbuf.def: Add some missing entries. Thanks to Kenichi SUTO.
|
||||
|
||||
2003-01-09 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
Changes for run-time lookup of installation location on Win32:
|
||||
|
||||
* Makefile.am (INCLUDES): Define PREFIX as $(prefix).
|
||||
|
||||
* gdk-pixbuf-io.c (get_sysconfdir): New function, look up
|
||||
installation location at runtime and deduce GTK_SYSCONFDIR
|
||||
from it.
|
||||
(get_toplevel): Similar, for the top-level installation directory.
|
||||
(correct_prefix): Replace compile-time prefix with run-time
|
||||
prefix.
|
||||
(get_libdir): Remove, not used any longer.
|
||||
(gdk_pixbuf_io_init): Call correct_prefix().
|
||||
|
||||
2003-01-05 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* queryloaders.c (query_module): [Win32] Change backslahses into
|
||||
slashes in path.
|
||||
|
||||
2003-01-04 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* Makefile.am (gdk-pixbuf.loaders): Use @SOEXT@ in the find command.
|
||||
|
||||
* gdk_pixbuf.def: Add gdk_pixbuf_loader_set_size.
|
||||
|
||||
@@ -248,6 +248,7 @@ INCLUDES = @STRIP_BEGIN@ \
|
||||
-DGTK_BINARY_VERSION=\"@GTK_BINARY_VERSION@\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_PIXBUF_DISABLE_DEPRECATED \
|
||||
-DPREFIX=\"$(prefix)\" \
|
||||
@INCLUDED_LOADER_DEFINE@ \
|
||||
@GTK_DEBUG_FLAGS@ \
|
||||
@GDK_PIXBUF_DEP_CFLAGS@ \
|
||||
|
||||
@@ -137,6 +137,7 @@ gdk_pixbuf_animation_new_from_file (const char *filename,
|
||||
GdkPixbufModule *image_module;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
f = fopen (filename, "rb");
|
||||
if (!f) {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* @bits_per_sample: Number of bits per sample.
|
||||
* @width: Width of the image in pixels.
|
||||
* @height: Height of the image in pixels.
|
||||
* @rowstride: Distance in bytes between rows.
|
||||
* @rowstride: Distance in bytes between row starts.
|
||||
* @destroy_fn: Function used to free the data when the pixbuf's reference count
|
||||
* drops to zero, or %NULL if the data should not be freed.
|
||||
* @destroy_fn_data: Closure data to pass to the destroy notification function.
|
||||
|
||||
@@ -165,6 +165,59 @@ skip_space (const char **pos)
|
||||
return !(*p == '\0');
|
||||
}
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
/* DllMain function needed to tuck away the gdk-pixbuf DLL name */
|
||||
G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
|
||||
|
||||
static char *
|
||||
get_toplevel (void)
|
||||
{
|
||||
static char *toplevel = NULL;
|
||||
|
||||
if (toplevel == NULL)
|
||||
toplevel = g_win32_get_package_installation_subdirectory
|
||||
(GETTEXT_PACKAGE, dll_name, "");
|
||||
|
||||
return toplevel;
|
||||
}
|
||||
|
||||
static char *
|
||||
get_sysconfdir (void)
|
||||
{
|
||||
static char *sysconfdir = NULL;
|
||||
|
||||
if (sysconfdir == NULL)
|
||||
sysconfdir = g_win32_get_package_installation_subdirectory
|
||||
(GETTEXT_PACKAGE, dll_name, "etc");
|
||||
|
||||
return sysconfdir;
|
||||
}
|
||||
|
||||
#undef GTK_SYSCONFDIR
|
||||
#define GTK_SYSCONFDIR get_sysconfdir()
|
||||
|
||||
static void
|
||||
correct_prefix (gchar **path)
|
||||
{
|
||||
if (strncmp (*path, PREFIX "/", strlen (PREFIX "/")) == 0 ||
|
||||
strncmp (*path, PREFIX "\\", strlen (PREFIX "\\")) == 0)
|
||||
{
|
||||
/* This is an entry put there by gdk-pixbuf-query-loaders on the
|
||||
* packager's system. On Windows a prebuilt GTK+ package can be
|
||||
* installed in a random location. The gdk-pixbuf.loaders file
|
||||
* distributed in such a package contains paths from the package
|
||||
* builder's machine. Replace the build-time prefix with the
|
||||
* installation prefix on this machine.
|
||||
*/
|
||||
gchar *tem = *path;
|
||||
*path = g_strconcat (get_toplevel (), tem + strlen (PREFIX), NULL);
|
||||
g_free (tem);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static gchar *
|
||||
gdk_pixbuf_get_module_file (void)
|
||||
{
|
||||
@@ -209,6 +262,9 @@ gdk_pixbuf_io_init ()
|
||||
/* Blank line marking the end of a module
|
||||
*/
|
||||
if (module && *p != '#') {
|
||||
#ifdef G_OS_WIN32
|
||||
correct_prefix (&module->module_path);
|
||||
#endif
|
||||
file_formats = g_slist_prepend (file_formats, module);
|
||||
module = NULL;
|
||||
}
|
||||
@@ -331,29 +387,6 @@ gdk_pixbuf_io_init ()
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
|
||||
/* DllMain function needed to tuck away the gdk-pixbuf DLL name */
|
||||
|
||||
G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name)
|
||||
|
||||
static char *
|
||||
get_libdir (void)
|
||||
{
|
||||
static char *libdir = NULL;
|
||||
|
||||
if (libdir == NULL)
|
||||
libdir = g_win32_get_package_installation_subdirectory
|
||||
(GETTEXT_PACKAGE, dll_name, "lib\\gtk-2.0\\" GTK_BINARY_VERSION "\\loaders");
|
||||
|
||||
return libdir;
|
||||
}
|
||||
|
||||
#undef PIXBUF_LIBDIR
|
||||
#define PIXBUF_LIBDIR get_libdir ()
|
||||
|
||||
#endif
|
||||
|
||||
/* actually load the image handler - gdk_pixbuf_get_module only get a */
|
||||
/* reference to the module to load, it doesn't actually load it */
|
||||
/* perhaps these actions should be combined in one function */
|
||||
@@ -694,6 +727,7 @@ gdk_pixbuf_new_from_file (const char *filename,
|
||||
GdkPixbufModule *image_module;
|
||||
|
||||
g_return_val_if_fail (filename != NULL, NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
f = fopen (filename, "rb");
|
||||
if (!f) {
|
||||
@@ -915,6 +949,8 @@ gdk_pixbuf_save (GdkPixbuf *pixbuf,
|
||||
va_list args;
|
||||
gboolean result;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
va_start (args, error);
|
||||
|
||||
collect_save_options (args, &keys, &values);
|
||||
@@ -961,6 +997,7 @@ gdk_pixbuf_savev (GdkPixbuf *pixbuf,
|
||||
|
||||
g_return_val_if_fail (filename != NULL, FALSE);
|
||||
g_return_val_if_fail (type != NULL, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
f = fopen (filename, "wb");
|
||||
|
||||
|
||||
@@ -423,6 +423,7 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
|
||||
|
||||
g_return_val_if_fail (buf != NULL, FALSE);
|
||||
g_return_val_if_fail (count >= 0, FALSE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
||||
priv = loader->priv;
|
||||
|
||||
@@ -499,11 +500,12 @@ gdk_pixbuf_loader_new_with_type (const char *image_type,
|
||||
{
|
||||
GdkPixbufLoader *retval;
|
||||
GError *tmp;
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
retval = g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL);
|
||||
|
||||
tmp = NULL;
|
||||
gdk_pixbuf_loader_load_module(retval, image_type, &tmp);
|
||||
gdk_pixbuf_loader_load_module (retval, image_type, &tmp);
|
||||
if (tmp != NULL)
|
||||
{
|
||||
g_propagate_error (error, tmp);
|
||||
@@ -602,6 +604,7 @@ gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
|
||||
|
||||
g_return_val_if_fail (loader != NULL, TRUE);
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), TRUE);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, TRUE);
|
||||
|
||||
priv = loader->priv;
|
||||
|
||||
|
||||
@@ -395,9 +395,10 @@ gdk_pixbuf_get_height (const GdkPixbuf *pixbuf)
|
||||
* gdk_pixbuf_get_rowstride:
|
||||
* @pixbuf: A pixbuf.
|
||||
*
|
||||
* Queries the rowstride of a pixbuf, which is the number of bytes between rows.
|
||||
* Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row
|
||||
* and the start of the next row.
|
||||
*
|
||||
* Return value: Number of bytes between rows.
|
||||
* Return value: Distance between row starts.
|
||||
**/
|
||||
int
|
||||
gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf)
|
||||
|
||||
@@ -197,7 +197,7 @@ gdk_pixdata_deserialize (GdkPixdata *pixdata,
|
||||
|
||||
/* deserialize header */
|
||||
stream = get_uint32 (stream, &pixdata->magic);
|
||||
stream = get_uint32 (stream, &pixdata->length);
|
||||
stream = get_uint32 (stream, (guint32 *)&pixdata->length);
|
||||
if (pixdata->magic != GDK_PIXBUF_MAGIC_NUMBER || pixdata->length < GDK_PIXDATA_HEADER_LENGTH)
|
||||
return_header_corrupt (error);
|
||||
stream = get_uint32 (stream, &pixdata->pixdata_type);
|
||||
@@ -578,7 +578,7 @@ save_rle_decoder (GString *gstring,
|
||||
* into programs.
|
||||
*
|
||||
* GTK+ ships with a program called <command>gdk-pixbuf-csource</command>
|
||||
* which offers a cmdline interface to this functions.
|
||||
* which offers a command line interface to this function.
|
||||
*
|
||||
* Returns: a newly-allocated string containing the C source form
|
||||
* of @pixdata.
|
||||
@@ -635,7 +635,7 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
|
||||
cdata.dump_rle_decoder = (dump_type & GDK_PIXDATA_DUMP_RLE_DECODER) > 0;
|
||||
cdata.static_prefix = (dump_type & GDK_PIXDATA_DUMP_STATIC) ? "static " : "";
|
||||
cdata.const_prefix = (dump_type & GDK_PIXDATA_DUMP_CONST) ? "const " : "";
|
||||
gstring = g_string_new ("");
|
||||
gstring = g_string_new (NULL);
|
||||
cdata.gstring = gstring;
|
||||
|
||||
if (!cdata.dump_macros && cdata.dump_gtypes)
|
||||
@@ -727,10 +727,22 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
|
||||
img_buffer = stream;
|
||||
img_buffer_end = stream + stream_length;
|
||||
|
||||
APPEND (gstring, "#ifdef __SUNPRO_C\n");
|
||||
APPEND (gstring, "#pragma align 4 (%s)\n", name);
|
||||
APPEND (gstring, "#endif\n");
|
||||
|
||||
APPEND (gstring, "#ifdef __GNUC__\n");
|
||||
APPEND (gstring, "%s%s%s %s[] __attribute__ ((__aligned__ (4))) = \n",
|
||||
cdata.static_prefix, cdata.const_prefix,
|
||||
cdata.dump_gtypes ? "guint8" : "unsigned char",
|
||||
name);
|
||||
APPEND (gstring, "#else\n");
|
||||
APPEND (gstring, "%s%s%s %s[] = \n",
|
||||
cdata.static_prefix, cdata.const_prefix,
|
||||
cdata.dump_gtypes ? "guint8" : "unsigned char",
|
||||
name);
|
||||
APPEND (gstring, "#endif\n");
|
||||
|
||||
APPEND (gstring, "{ \"\"\n /* Pixbuf magic (0x%x) */\n \"",
|
||||
GDK_PIXBUF_MAGIC_NUMBER);
|
||||
cdata.pos = 3;
|
||||
@@ -819,7 +831,8 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
|
||||
|
||||
/**
|
||||
* gdk_pixbuf_new_from_inline:
|
||||
* @data_length: Length in bytes of the @data argument
|
||||
* @data_length: Length in bytes of the @data argument or -1 to
|
||||
* disable length checks
|
||||
* @data: Byte data containing a serialized #GdkPixdata structure
|
||||
* @copy_pixels: Whether to copy the pixel data, or use direct pointers
|
||||
* @data for the resulting pixbuf
|
||||
@@ -847,13 +860,18 @@ gdk_pixdata_to_csource (GdkPixdata *pixdata,
|
||||
* generally a bad idea.)
|
||||
*
|
||||
* If you create a pixbuf from const inline data compiled into your
|
||||
* program, it's probably safe to ignore errors, since things will
|
||||
* always succeed. For non-const inline data, you could get out of
|
||||
* memory. For untrusted inline data located at runtime, you could
|
||||
* have corrupt inline data in addition.
|
||||
* program, it's probably safe to ignore errors and disable length checks,
|
||||
* since things will always succeed:
|
||||
* <informalexample><programlisting>
|
||||
* pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, NULL);
|
||||
* </programlisting></informalexample>
|
||||
*
|
||||
* For non-const inline data, you could get out of memory. For untrusted
|
||||
* inline data located at runtime, you could have corrupt inline data in
|
||||
* addition.
|
||||
*
|
||||
* Return value: A newly-created #GdkPixbuf structure with a reference,
|
||||
* count of 1, or %NULL if error is set.
|
||||
* count of 1, or %NULL if an error occurred.
|
||||
**/
|
||||
GdkPixbuf*
|
||||
gdk_pixbuf_new_from_inline (gint data_length,
|
||||
|
||||
@@ -73,9 +73,9 @@ typedef enum
|
||||
* #GDK_PIXDATA_HEADER_LENGTH + length of @pixel_data.
|
||||
* @pixdata_type: information about colorspace, sample width and
|
||||
* encoding, in a #GdkPixdataType.
|
||||
* @rowstride: padding used in @pixel_data or 0 to indicate no padding.
|
||||
* @width: the width.
|
||||
* @height: the height.
|
||||
* @rowstride: Distance in bytes between rows.
|
||||
* @width: Width of the image in pixels.
|
||||
* @height: Height of the image in pixels.
|
||||
* @pixel_data: @width x @height pixels, encoded according to @pixdata_type
|
||||
* and @rowstride.
|
||||
*
|
||||
@@ -90,7 +90,7 @@ struct _GdkPixdata
|
||||
* GDK_PIXDATA_HEADER_LENGTH + pixel_data length
|
||||
*/
|
||||
guint32 pixdata_type; /* GdkPixdataType */
|
||||
guint32 rowstride; /* maybe 0 to indicate non-padded data */
|
||||
guint32 rowstride;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint8 *pixel_data;
|
||||
|
||||
@@ -25,9 +25,15 @@ EXPORTS
|
||||
gdk_pixbuf_error_get_type
|
||||
gdk_pixbuf_error_quark
|
||||
gdk_pixbuf_fill
|
||||
gdk_pixbuf_format_get_description
|
||||
gdk_pixbuf_format_get_extensions
|
||||
gdk_pixbuf_format_get_mime_types
|
||||
gdk_pixbuf_format_get_name
|
||||
gdk_pixbuf_format_is_writable
|
||||
gdk_pixbuf_from_pixdata
|
||||
gdk_pixbuf_get_bits_per_sample
|
||||
gdk_pixbuf_get_colorspace
|
||||
gdk_pixbuf_get_formats
|
||||
gdk_pixbuf_get_has_alpha
|
||||
gdk_pixbuf_get_height
|
||||
gdk_pixbuf_get_n_channels
|
||||
@@ -38,6 +44,7 @@ EXPORTS
|
||||
gdk_pixbuf_get_width
|
||||
gdk_pixbuf_loader_close
|
||||
gdk_pixbuf_loader_get_animation
|
||||
gdk_pixbuf_loader_get_format
|
||||
gdk_pixbuf_loader_get_pixbuf
|
||||
gdk_pixbuf_loader_get_type
|
||||
gdk_pixbuf_loader_new
|
||||
|
||||
@@ -180,6 +180,7 @@ gdk_pixbuf_gif_anim_get_iter (GdkPixbufAnimation *anim,
|
||||
|
||||
iter->start_time = *start_time;
|
||||
iter->current_time = *start_time;
|
||||
iter->first_loop_slowness = 0;
|
||||
|
||||
return GDK_PIXBUF_ANIMATION_ITER (iter);
|
||||
}
|
||||
@@ -287,8 +288,21 @@ gdk_pixbuf_gif_anim_iter_advance (GdkPixbufAnimationIter *anim_iter,
|
||||
* and subtract time for that.
|
||||
*/
|
||||
|
||||
loop = elapsed / iter->gif_anim->total_time;
|
||||
elapsed = elapsed % iter->gif_anim->total_time;
|
||||
if (iter->gif_anim->loading)
|
||||
loop = 0;
|
||||
else {
|
||||
/* If current_frame is NULL at this point, we have loaded the
|
||||
* animation from a source which fell behind the speed of the
|
||||
* display. We remember how much slower the first loop was due
|
||||
* to this and correct the position calculation in order to not
|
||||
* jump in the middle of the second loop.
|
||||
*/
|
||||
if (iter->current_frame == NULL)
|
||||
iter->first_loop_slowness = MAX(0, elapsed - iter->gif_anim->total_time);
|
||||
|
||||
loop = (elapsed - iter->first_loop_slowness) / iter->gif_anim->total_time;
|
||||
elapsed = (elapsed - iter->first_loop_slowness) % iter->gif_anim->total_time;
|
||||
}
|
||||
|
||||
iter->position = elapsed;
|
||||
|
||||
@@ -334,9 +348,8 @@ gdk_pixbuf_gif_anim_iter_get_delay_time (GdkPixbufAnimationIter *anim_iter)
|
||||
#endif
|
||||
|
||||
return frame->delay_time - (iter->position - frame->elapsed);
|
||||
} else {
|
||||
} else
|
||||
return -1; /* show last frame forever */
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -78,6 +78,7 @@ struct _GdkPixbufGifAnim {
|
||||
guchar bg_blue;
|
||||
|
||||
int loop;
|
||||
gboolean loading;
|
||||
};
|
||||
|
||||
struct _GdkPixbufGifAnimClass {
|
||||
@@ -113,6 +114,8 @@ struct _GdkPixbufGifAnimIter {
|
||||
gint position;
|
||||
|
||||
GList *current_frame;
|
||||
|
||||
gint first_loop_slowness;
|
||||
};
|
||||
|
||||
struct _GdkPixbufGifAnimIterClass {
|
||||
|
||||
@@ -63,7 +63,8 @@
|
||||
|
||||
|
||||
|
||||
#undef DUMP_IMAGE_DETAILS
|
||||
#undef DUMP_IMAGE_DETAILS
|
||||
#undef IO_GIFDEBUG
|
||||
|
||||
#define MAXCOLORMAPSIZE 256
|
||||
#define MAX_LZW_BITS 12
|
||||
@@ -409,8 +410,8 @@ gif_get_extension (GifContext *context)
|
||||
if (!strncmp (context->block_buf, "NETSCAPE2.0", 11) ||
|
||||
!strncmp (context->block_buf, "ANIMEXTS1.0", 11)) {
|
||||
context->in_loop_extension = TRUE;
|
||||
context->block_count = 0;
|
||||
}
|
||||
context->block_count = 0;
|
||||
}
|
||||
if (context->in_loop_extension) {
|
||||
do {
|
||||
@@ -792,12 +793,31 @@ gif_get_lzw (GifContext *context)
|
||||
context->frame->composited = NULL;
|
||||
context->frame->revert = NULL;
|
||||
|
||||
context->frame->pixbuf =
|
||||
gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
TRUE,
|
||||
8,
|
||||
context->frame_len,
|
||||
context->frame_height);
|
||||
if (context->frame_len == 0 || context->frame_height == 0) {
|
||||
/* An empty frame, we just output a single transparent
|
||||
* pixel at (0, 0).
|
||||
*/
|
||||
context->x_offset = 0;
|
||||
context->y_offset = 0;
|
||||
context->frame_len = 1;
|
||||
context->frame_height = 1;
|
||||
context->frame->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
|
||||
if (context->frame->pixbuf) {
|
||||
guchar *pixels;
|
||||
|
||||
pixels = gdk_pixbuf_get_pixels (context->frame->pixbuf);
|
||||
pixels[0] = 0;
|
||||
pixels[1] = 0;
|
||||
pixels[2] = 0;
|
||||
pixels[3] = 0;
|
||||
}
|
||||
} else
|
||||
context->frame->pixbuf =
|
||||
gdk_pixbuf_new (GDK_COLORSPACE_RGB,
|
||||
TRUE,
|
||||
8,
|
||||
context->frame_len,
|
||||
context->frame_height);
|
||||
if (!context->frame->pixbuf) {
|
||||
g_free (context->frame);
|
||||
g_set_error (context->error,
|
||||
@@ -987,7 +1007,8 @@ gif_get_lzw (GifContext *context)
|
||||
if (lower_bound <= upper_bound && first_pass == context->draw_pass) {
|
||||
(* context->update_func)
|
||||
(context->frame->pixbuf,
|
||||
0, lower_bound,
|
||||
context->frame->x_offset,
|
||||
context->frame->y_offset + lower_bound,
|
||||
gdk_pixbuf_get_width (context->frame->pixbuf),
|
||||
upper_bound - lower_bound,
|
||||
context->user_data);
|
||||
@@ -1011,9 +1032,9 @@ gif_get_lzw (GifContext *context)
|
||||
(* context->update_func)
|
||||
(context->frame->pixbuf,
|
||||
context->frame->x_offset,
|
||||
lower_bound + context->frame->y_offset,
|
||||
context->frame->y_offset + lower_bound,
|
||||
gdk_pixbuf_get_width (context->frame->pixbuf),
|
||||
gdk_pixbuf_get_height (context->frame->pixbuf),
|
||||
gdk_pixbuf_get_height (context->frame->pixbuf) - lower_bound,
|
||||
context->user_data);
|
||||
}
|
||||
}
|
||||
@@ -1179,17 +1200,6 @@ gif_get_frame_info (GifContext *context)
|
||||
context->x_offset = LM_to_uint (buf[0], buf[1]);
|
||||
context->y_offset = LM_to_uint (buf[2], buf[3]);
|
||||
|
||||
if ((context->frame_height == 0) || (context->frame_len == 0)) {
|
||||
context->state = GIF_DONE;
|
||||
|
||||
g_set_error (context->error,
|
||||
GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
||||
_("GIF image contained a frame with height or width 0."));
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (((context->frame_height + context->y_offset) > context->height) ||
|
||||
((context->frame_len + context->x_offset) > context->width)) {
|
||||
/* All frames must fit in the image bounds */
|
||||
@@ -1206,26 +1216,19 @@ gif_get_frame_info (GifContext *context)
|
||||
if (context->animation->frames == NULL &&
|
||||
context->gif89.disposal == 3) {
|
||||
/* First frame can't have "revert to previous" as its
|
||||
* dispose mode.
|
||||
* dispose mode. Silently use "retain" instead.
|
||||
*/
|
||||
|
||||
context->state = GIF_DONE;
|
||||
|
||||
g_set_error (context->error,
|
||||
GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
||||
_("First frame of GIF image had 'revert to previous' as its disposal mode."));
|
||||
|
||||
return -2;
|
||||
context->gif89.disposal = 0;
|
||||
}
|
||||
|
||||
context->frame_interlace = BitSet (buf[8], INTERLACE);
|
||||
|
||||
#ifdef DUMP_IMAGE_DETAILS
|
||||
g_print (">width: %d height: %d xoffset: %d yoffset: %d disposal: %d delay: %d transparent: %d\n",
|
||||
g_print (">width: %d height: %d xoffset: %d yoffset: %d disposal: %d delay: %d transparent: %d interlace: %d\n",
|
||||
context->frame_len, context->frame_height, context->x_offset, context->y_offset,
|
||||
context->gif89.disposal, context->gif89.delay_time, context->gif89.transparent);
|
||||
context->gif89.disposal, context->gif89.delay_time, context->gif89.transparent, context->frame_interlace);
|
||||
#endif
|
||||
|
||||
context->frame_interlace = BitSet (buf[8], INTERLACE);
|
||||
if (BitSet (buf[8], LOCALCOLORMAP)) {
|
||||
|
||||
#ifdef DUMP_IMAGE_DETAILS
|
||||
|
||||
@@ -191,9 +191,8 @@ static void DecodeHeader(guchar *Data, gint Bytes,
|
||||
GError **error)
|
||||
{
|
||||
/* For ICO's we have to be very clever. There are multiple images possible
|
||||
in an .ICO. For now, we select (in order of priority):
|
||||
1) The one with the highest number of colors
|
||||
2) The largest one
|
||||
in an .ICO. As a simple heuristic, we select the image which occupies the
|
||||
largest number of bytes.
|
||||
*/
|
||||
|
||||
gint IconCount = 0; /* The number of icon-versions in the file */
|
||||
@@ -231,18 +230,11 @@ static void DecodeHeader(guchar *Data, gint Bytes,
|
||||
State->DIBoffset = 0;
|
||||
Ptr = Data + 6;
|
||||
for (I=0;I<IconCount;I++) {
|
||||
int ThisWidth, ThisHeight,ThisColors;
|
||||
int ThisScore;
|
||||
|
||||
ThisWidth = Ptr[0];
|
||||
ThisHeight = Ptr[1];
|
||||
ThisColors = (Ptr[2]);
|
||||
if (ThisColors==0)
|
||||
ThisColors=256; /* Yes, this is in the spec, ugh */
|
||||
|
||||
ThisScore = ThisColors*1024+ThisWidth*ThisHeight;
|
||||
ThisScore = (Ptr[11] << 24) + (Ptr[10] << 16) + (Ptr[9] << 8) + (Ptr[8]);
|
||||
|
||||
if (ThisScore>State->ImageScore) {
|
||||
if (ThisScore>=State->ImageScore) {
|
||||
State->ImageScore = ThisScore;
|
||||
State->x_hot = (Ptr[5] << 8) + Ptr[4];
|
||||
State->y_hot = (Ptr[7] << 8) + Ptr[6];
|
||||
@@ -492,8 +484,8 @@ gdk_pixbuf__ico_image_begin_load(GdkPixbufModuleSizeFunc size_func,
|
||||
* free context, unref gdk_pixbuf
|
||||
*/
|
||||
static gboolean
|
||||
gdk_pixbuf__ico_image_stop_load(gpointer data,
|
||||
GError **error)
|
||||
gdk_pixbuf__ico_image_stop_load (gpointer data,
|
||||
GError **error)
|
||||
{
|
||||
struct ico_progressive_state *context =
|
||||
(struct ico_progressive_state *) data;
|
||||
@@ -691,6 +683,10 @@ static void OneLineTransp(struct ico_progressive_state *context)
|
||||
gint X;
|
||||
guchar *Pixels;
|
||||
|
||||
/* Ignore the XOR mask for XP style 32-bpp icons with alpha */
|
||||
if (context->Header.depth == 32)
|
||||
return;
|
||||
|
||||
X = 0;
|
||||
if (context->Header.Negative == 0)
|
||||
Pixels = (context->pixbuf->pixels +
|
||||
@@ -827,7 +823,7 @@ gdk_pixbuf__ico_image_load_increment(gpointer data,
|
||||
|
||||
}
|
||||
|
||||
if (context->HeaderDone >= 6) {
|
||||
if (context->HeaderDone >= 6 && context->pixbuf == NULL) {
|
||||
GError *decode_err = NULL;
|
||||
DecodeHeader(context->HeaderBuf,
|
||||
context->HeaderDone, context, &decode_err);
|
||||
|
||||
@@ -272,43 +272,26 @@ static GdkPixbuf *get_contiguous_pixbuf (guint width,
|
||||
width, height, rowstride, free_buffer, NULL);
|
||||
}
|
||||
|
||||
static void pixbuf_flip_row (GdkPixbuf *pixbuf, guchar *ph)
|
||||
static gboolean fread_check(gpointer dest,
|
||||
size_t size, size_t count,
|
||||
FILE *f, GError **err)
|
||||
{
|
||||
guchar *p, *s;
|
||||
guchar tmp;
|
||||
gint count;
|
||||
|
||||
p = ph;
|
||||
s = p + pixbuf->n_channels * (pixbuf->width - 1);
|
||||
while (p < s) {
|
||||
for (count = pixbuf->n_channels; count > 0; count--, p++, s++) {
|
||||
tmp = *p;
|
||||
*p = *s;
|
||||
*s = tmp;
|
||||
}
|
||||
s -= 2 * pixbuf->n_channels;
|
||||
}
|
||||
if (fread(dest, size, count, f) != count) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
|
||||
_("fread() failed -- premature end-of-file probably encountered"));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void pixbuf_flip_vertically (GdkPixbuf *pixbuf)
|
||||
static gboolean fseek_check(FILE *f, glong offset, gint whence, GError **err)
|
||||
{
|
||||
guchar *ph, *sh, *p, *s;
|
||||
guchar tmp;
|
||||
gint count;
|
||||
|
||||
ph = pixbuf->pixels;
|
||||
sh = pixbuf->pixels + pixbuf->height*pixbuf->rowstride;
|
||||
while (ph < sh - pixbuf->rowstride) {
|
||||
p = ph;
|
||||
s = sh - pixbuf->rowstride;
|
||||
for (count = pixbuf->n_channels * pixbuf->width; count > 0; count--, p++, s++) {
|
||||
tmp = *p;
|
||||
*p = *s;
|
||||
*s = tmp;
|
||||
}
|
||||
sh -= pixbuf->rowstride;
|
||||
ph += pixbuf->rowstride;
|
||||
if (fseek(f, offset, whence) != 0) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
|
||||
_("fseek() failed -- premature end-of-file probably encountered"));
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean fill_in_context(TGAContext *ctx, GError **err)
|
||||
@@ -343,10 +326,7 @@ static gboolean fill_in_context(TGAContext *ctx, GError **err)
|
||||
}
|
||||
|
||||
ctx->pbuf_bytes = ctx->pbuf->rowstride * ctx->pbuf->height;
|
||||
if (ctx->hdr->flags & TGA_ORIGIN_UPPER || ctx->run_length_encoded)
|
||||
ctx->pptr = ctx->pbuf->pixels;
|
||||
else
|
||||
ctx->pptr = ctx->pbuf->pixels + (ctx->pbuf->height - 1)*ctx->pbuf->rowstride;
|
||||
ctx->pptr = ctx->pbuf->pixels;
|
||||
|
||||
if (ctx->hdr->type == TGA_TYPE_PSEUDOCOLOR)
|
||||
ctx->rowstride = ctx->pbuf->width;
|
||||
@@ -372,6 +352,10 @@ static void parse_data_for_row_pseudocolor(TGAContext *ctx)
|
||||
if (ctx->hdr->cmap_bpp == 32)
|
||||
*p++ = ctx->cmap->cols[*s].a;
|
||||
}
|
||||
ctx->pptr += ctx->pbuf->rowstride;
|
||||
ctx->pbuf_bytes_done += ctx->pbuf->rowstride;
|
||||
if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
|
||||
ctx->done = TRUE;
|
||||
}
|
||||
|
||||
static void swap_channels(TGAContext *ctx)
|
||||
@@ -391,6 +375,10 @@ static void parse_data_for_row_truecolor(TGAContext *ctx)
|
||||
{
|
||||
g_memmove(ctx->pptr, ctx->in->data, ctx->pbuf->rowstride);
|
||||
swap_channels(ctx);
|
||||
ctx->pptr += ctx->pbuf->rowstride;
|
||||
ctx->pbuf_bytes_done += ctx->pbuf->rowstride;
|
||||
if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
|
||||
ctx->done = TRUE;
|
||||
}
|
||||
|
||||
static void parse_data_for_row_grayscale(TGAContext *ctx)
|
||||
@@ -405,35 +393,26 @@ static void parse_data_for_row_grayscale(TGAContext *ctx)
|
||||
p[3] = *s++;
|
||||
p += ctx->pbuf->n_channels;
|
||||
}
|
||||
ctx->pptr += ctx->pbuf->rowstride;
|
||||
ctx->pbuf_bytes_done += ctx->pbuf->rowstride;
|
||||
if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
|
||||
ctx->done = TRUE;
|
||||
}
|
||||
|
||||
static gboolean parse_data_for_row(TGAContext *ctx, GError **err)
|
||||
{
|
||||
guint row;
|
||||
|
||||
if (ctx->hdr->type == TGA_TYPE_PSEUDOCOLOR)
|
||||
parse_data_for_row_pseudocolor(ctx);
|
||||
else if (ctx->hdr->type == TGA_TYPE_TRUECOLOR)
|
||||
parse_data_for_row_truecolor(ctx);
|
||||
else if (ctx->hdr->type == TGA_TYPE_GRAYSCALE)
|
||||
parse_data_for_row_grayscale(ctx);
|
||||
|
||||
if (ctx->hdr->flags & TGA_ORIGIN_RIGHT)
|
||||
pixbuf_flip_row (ctx->pbuf, ctx->pptr);
|
||||
if (ctx->hdr->flags & TGA_ORIGIN_UPPER)
|
||||
ctx->pptr += ctx->pbuf->rowstride;
|
||||
else
|
||||
ctx->pptr -= ctx->pbuf->rowstride;
|
||||
ctx->pbuf_bytes_done += ctx->pbuf->rowstride;
|
||||
if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
|
||||
ctx->done = TRUE;
|
||||
|
||||
ctx->in = io_buffer_free_segment(ctx->in, ctx->rowstride, err);
|
||||
if (!ctx->in)
|
||||
return FALSE;
|
||||
row = (ctx->pptr - ctx->pbuf->pixels) / ctx->pbuf->rowstride - 1;
|
||||
if (ctx->ufunc)
|
||||
(*ctx->ufunc) (ctx->pbuf, 0, row, ctx->pbuf->width, 1, ctx->udata);
|
||||
(*ctx->ufunc) (ctx->pbuf, 0,
|
||||
(ctx->pbuf_bytes_done / ctx->pbuf->rowstride) - 1,
|
||||
ctx->pbuf->width, 1, ctx->udata);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -625,7 +604,6 @@ static gboolean parse_rle_data(TGAContext *ctx, GError **err)
|
||||
{
|
||||
guint count = 0;
|
||||
guint pbuf_count = 0;
|
||||
guint bytes_done_before = ctx->pbuf_bytes_done;
|
||||
if (ctx->hdr->type == TGA_TYPE_RLE_PSEUDOCOLOR) {
|
||||
count = parse_rle_data_pseudocolor(ctx);
|
||||
pbuf_count = count * ctx->pbuf->n_channels;
|
||||
@@ -636,33 +614,12 @@ static gboolean parse_rle_data(TGAContext *ctx, GError **err)
|
||||
count = parse_rle_data_grayscale(ctx);
|
||||
pbuf_count = count * (ctx->pbuf->n_channels == 4 ? 2 : 3);
|
||||
}
|
||||
|
||||
if (ctx->hdr->flags & TGA_ORIGIN_RIGHT) {
|
||||
guchar *row = ctx->pbuf->pixels + (bytes_done_before / ctx->pbuf->rowstride) * ctx->pbuf->rowstride;
|
||||
guchar *row_after = ctx->pbuf->pixels + (ctx->pbuf_bytes_done / ctx->pbuf->rowstride) * ctx->pbuf->rowstride;
|
||||
for (; row < row_after; row += ctx->pbuf->rowstride)
|
||||
pixbuf_flip_row (ctx->pbuf, row);
|
||||
}
|
||||
|
||||
ctx->in = io_buffer_free_segment(ctx->in, count, err);
|
||||
if (!ctx->in)
|
||||
return FALSE;
|
||||
|
||||
if (ctx->done) {
|
||||
/* FIXME doing the vertical flipping afterwards is not
|
||||
* perfect, but doing it during the rle decoding in place
|
||||
* is considerably more work.
|
||||
*/
|
||||
if (!(ctx->hdr->flags & TGA_ORIGIN_UPPER))
|
||||
pixbuf_flip_vertically (ctx->pbuf);
|
||||
}
|
||||
|
||||
if (ctx->ufunc)
|
||||
(*ctx->ufunc) (ctx->pbuf, 0, ctx->pbuf_bytes_done / ctx->pbuf->rowstride,
|
||||
ctx->pbuf->width, pbuf_count / ctx->pbuf->rowstride,
|
||||
ctx->udata);
|
||||
|
||||
|
||||
(*ctx->ufunc) (ctx->pbuf, 0, ctx->pbuf_bytes_done / ctx->pbuf->rowstride,
|
||||
ctx->pbuf->width, pbuf_count / ctx->pbuf->rowstride,
|
||||
ctx->udata);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -766,7 +723,10 @@ static gboolean try_preload(TGAContext *ctx, GError **err)
|
||||
_("TGA image comment length is too long"));
|
||||
return FALSE;
|
||||
}
|
||||
if ((ctx->hdr->flags & TGA_INTERLEAVE_MASK) != TGA_INTERLEAVE_NONE) {
|
||||
if ((ctx->hdr->flags & TGA_INTERLEAVE_MASK) !=
|
||||
TGA_INTERLEAVE_NONE ||
|
||||
(ctx->hdr->flags & TGA_ORIGIN_RIGHT) ||
|
||||
!(ctx->hdr->flags & TGA_ORIGIN_UPPER)) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
||||
_("TGA image type not supported"));
|
||||
@@ -833,8 +793,7 @@ static gboolean try_preload(TGAContext *ctx, GError **err)
|
||||
}
|
||||
}
|
||||
if (!ctx->prepared) {
|
||||
if (ctx->pfunc)
|
||||
(*ctx->pfunc) (ctx->pbuf, NULL, ctx->udata);
|
||||
(*ctx->pfunc) (ctx->pbuf, NULL, ctx->udata);
|
||||
ctx->prepared = TRUE;
|
||||
}
|
||||
/* We shouldn't get here anyway. */
|
||||
@@ -942,7 +901,7 @@ static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err)
|
||||
}
|
||||
if (ctx->pbuf)
|
||||
g_object_unref (ctx->pbuf);
|
||||
if (ctx->in && ctx->in->size)
|
||||
if (ctx->in->size)
|
||||
ctx->in = io_buffer_free_segment (ctx->in, ctx->in->size, err);
|
||||
if (!ctx->in) {
|
||||
g_free (ctx);
|
||||
@@ -953,9 +912,430 @@ static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static TGAHeader *get_header_from_file(FILE *f, GError **err)
|
||||
{
|
||||
TGAHeader *hdr;
|
||||
|
||||
if (!fseek_check(f, 0, SEEK_SET, err))
|
||||
return NULL;
|
||||
if (!(hdr = g_try_malloc(sizeof(TGAHeader)))) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
_("Can't allocate memory for TGA header"));
|
||||
return NULL;
|
||||
}
|
||||
if (!fread_check(hdr, sizeof(TGAHeader), 1, f, err)) {
|
||||
g_free(hdr);
|
||||
return NULL;
|
||||
}
|
||||
if (hdr->infolen > 255) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
||||
_("Too big value in the infolen field of TGA header."));
|
||||
g_free(hdr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return hdr;
|
||||
}
|
||||
|
||||
static TGAColormap *get_colormap_from_file(FILE *f,
|
||||
TGAHeader *hdr,
|
||||
GError **err)
|
||||
{
|
||||
TGAColormap *cmap;
|
||||
guchar *pal_buf, *p;
|
||||
guint n, pal_size;
|
||||
|
||||
if (!fseek_check(f, sizeof(TGAHeader) + hdr->infolen, SEEK_SET, err))
|
||||
return NULL;
|
||||
|
||||
pal_size = LE16(hdr->cmap_n_colors) * ((hdr->cmap_bpp + 7) >> 3);
|
||||
pal_buf = g_try_malloc(pal_size);
|
||||
if (!pal_buf) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
_("Can't allocate memory for TGA cmap temporary buffer"));
|
||||
return NULL;
|
||||
}
|
||||
if (!fread_check(pal_buf, pal_size, 1, f, err)) {
|
||||
g_free(pal_buf);
|
||||
return NULL;
|
||||
}
|
||||
p = pal_buf;
|
||||
|
||||
if (!(cmap = g_try_malloc(sizeof(TGAColormap)))) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
_("Can't allocate memory for TGA colormap struct"));
|
||||
g_free(pal_buf);
|
||||
return NULL;
|
||||
}
|
||||
cmap->size = LE16(hdr->cmap_n_colors);
|
||||
cmap->cols = g_try_malloc(sizeof(TGAColor) * cmap->size);
|
||||
if (!cmap->cols) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
_("Can't allocate memory for TGA colormap entries"));
|
||||
g_free(pal_buf);
|
||||
g_free(cmap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (hdr->cmap_bpp != 15 && hdr->cmap_bpp != 16 &&
|
||||
hdr->cmap_bpp != 24 && hdr->cmap_bpp != 32) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
||||
_("Unexpected bitdepth for TGA colormap"));
|
||||
g_free(pal_buf);
|
||||
g_free(cmap->cols);
|
||||
g_free(cmap);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (n = 0; n < cmap->size; n++) {
|
||||
if ((hdr->cmap_bpp == 15) || (hdr->cmap_bpp == 16)) {
|
||||
guint16 col = p[0] + (p[1] << 8);
|
||||
p += 2;
|
||||
cmap->cols[n].b = (col >> 7) & 0xf8;
|
||||
cmap->cols[n].g = (col >> 2) & 0xf8;
|
||||
cmap->cols[n].r = col << 3;
|
||||
} else if ((hdr->cmap_bpp == 24) || (hdr->cmap_bpp == 32)) {
|
||||
cmap->cols[n].b = *p++;
|
||||
cmap->cols[n].g = *p++;
|
||||
cmap->cols[n].r = *p++;
|
||||
if (hdr->cmap_bpp == 32)
|
||||
cmap->cols[n].a = *p++;
|
||||
}
|
||||
}
|
||||
|
||||
g_free(pal_buf);
|
||||
return cmap;
|
||||
}
|
||||
|
||||
static GdkPixbuf *get_image_pseudocolor(FILE *f, TGAHeader *hdr,
|
||||
TGAColormap *cmap, gboolean rle,
|
||||
GError **err)
|
||||
{
|
||||
GdkPixbuf *pbuf;
|
||||
guchar *p, color, tag;
|
||||
glong n, image_offset;
|
||||
guint count, w, h;
|
||||
gboolean alpha;
|
||||
|
||||
image_offset = sizeof(TGAHeader) + hdr->infolen;
|
||||
if (!hdr->has_cmap) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
|
||||
_("Pseudo-Color image without colormap"));
|
||||
return NULL;
|
||||
} else {
|
||||
image_offset += cmap->size * ((hdr->cmap_bpp + 7) >> 3);
|
||||
}
|
||||
if (!fseek_check(f, image_offset, SEEK_SET, err)) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
|
||||
_("Can't seek to image offset -- end-of-file probably encountered"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
w = LE16(hdr->width);
|
||||
h = LE16(hdr->height);
|
||||
|
||||
alpha = (hdr->cmap_bpp == 32);
|
||||
|
||||
pbuf = get_contiguous_pixbuf (w, h, alpha);
|
||||
|
||||
if (!pbuf) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
_("Can't allocate pixbuf"));
|
||||
return NULL;
|
||||
}
|
||||
pbuf->destroy_fn = free_buffer;
|
||||
pbuf->destroy_fn_data = NULL;
|
||||
p = pbuf->pixels;
|
||||
|
||||
if (rle) {
|
||||
n = count = 0;
|
||||
for (; n < pbuf->width * pbuf->height;) {
|
||||
if (!fread_check(&tag, 1, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
if (tag & 0x80) {
|
||||
count = (tag & 0x7f) + 1;
|
||||
n += count;
|
||||
if (!fread_check(&color, 1, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
for (; count; count--) {
|
||||
*p++ = cmap->cols[color].r;
|
||||
*p++ = cmap->cols[color].g;
|
||||
*p++ = cmap->cols[color].b;
|
||||
if (hdr->cmap_bpp == 32)
|
||||
*p++ = cmap->cols[color].a;
|
||||
}
|
||||
} else {
|
||||
count = tag + 1;
|
||||
n += count;
|
||||
for (; count; count--) {
|
||||
if (!fread_check(&color, 1, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
*p++ = cmap->cols[color].r;
|
||||
*p++ = cmap->cols[color].g;
|
||||
*p++ = cmap->cols[color].b;
|
||||
if (hdr->cmap_bpp == 32)
|
||||
*p++ = cmap->cols[color].a;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (n = 0; n < pbuf->width * pbuf->height; n++) {
|
||||
if (!fread_check(&color, 1, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
*p++ = cmap->cols[color].r;
|
||||
*p++ = cmap->cols[color].g;
|
||||
*p++ = cmap->cols[color].b;
|
||||
if (hdr->cmap_bpp == 32)
|
||||
*p++ = cmap->cols[color].a;
|
||||
}
|
||||
}
|
||||
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
static void swap_channels_pixbuf(GdkPixbuf *pbuf)
|
||||
{
|
||||
guchar *p, swap;
|
||||
glong n;
|
||||
|
||||
p = pbuf->pixels;
|
||||
for (n = 0; n < pbuf->width * pbuf->height; n++) {
|
||||
swap = p[0];
|
||||
p[0] = p[2];
|
||||
p[2] = swap;
|
||||
p += pbuf->n_channels;
|
||||
}
|
||||
}
|
||||
|
||||
static GdkPixbuf *get_image_truecolor(FILE *f, TGAHeader *hdr,
|
||||
gboolean rle, GError **err)
|
||||
{
|
||||
GdkPixbuf *pbuf;
|
||||
guchar *p, tag;
|
||||
glong n, image_offset;
|
||||
guint32 pixel;
|
||||
guint count, w, h;
|
||||
gboolean alpha;
|
||||
|
||||
image_offset = sizeof(TGAHeader) + hdr->infolen;
|
||||
/* A truecolor image shouldn't actually have a colormap. */
|
||||
if (hdr->has_cmap)
|
||||
image_offset += LE16(hdr->cmap_n_colors) * ((hdr->cmap_bpp + 7) >> 3);
|
||||
if (!fseek_check(f, image_offset, SEEK_SET, err))
|
||||
return NULL;
|
||||
|
||||
w = LE16(hdr->width);
|
||||
h = LE16(hdr->height);
|
||||
|
||||
alpha = (hdr->bpp == 32);
|
||||
|
||||
pbuf = get_contiguous_pixbuf (w, h, alpha);
|
||||
|
||||
if (!pbuf) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
_("Can't allocate pixbuf"));
|
||||
return NULL;
|
||||
}
|
||||
p = pbuf->pixels;
|
||||
|
||||
if (rle) {
|
||||
n = count = 0;
|
||||
for (; n < pbuf->width * pbuf->height;) {
|
||||
if (!fread_check(&tag, 1, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
if (tag & 0x80) {
|
||||
count = (tag & 0x7f) + 1;
|
||||
n += count;
|
||||
if (!fread_check(&pixel, pbuf->n_channels, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
for (; count; count--) {
|
||||
g_memmove(p, &pixel, pbuf->n_channels);
|
||||
p += pbuf->n_channels;
|
||||
}
|
||||
} else {
|
||||
count = tag + 1;
|
||||
n += count;
|
||||
if (!fread_check(p, pbuf->n_channels * count, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
p += pbuf->n_channels * count;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!fread_check(p, pbuf->rowstride * pbuf->height, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
swap_channels_pixbuf(pbuf);
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf *get_image_grayscale(FILE *f, TGAHeader *hdr,
|
||||
gboolean rle, GError **err)
|
||||
{
|
||||
GdkPixbuf *pbuf;
|
||||
glong n, image_offset;
|
||||
guchar *p, color[2], tag;
|
||||
guint count, w, h;
|
||||
gboolean alpha;
|
||||
|
||||
image_offset = sizeof(TGAHeader) + hdr->infolen;
|
||||
/* A grayscale image shouldn't actually have a colormap. */
|
||||
if (hdr->has_cmap)
|
||||
image_offset += LE16(hdr->cmap_n_colors) * ((hdr->cmap_bpp + 7) >> 3);
|
||||
if (!fseek_check(f, image_offset, SEEK_SET, err))
|
||||
return NULL;
|
||||
|
||||
w = LE16(hdr->width);
|
||||
h = LE16(hdr->height);
|
||||
|
||||
alpha = (hdr->bpp == 16);
|
||||
|
||||
pbuf = get_contiguous_pixbuf (w, h, alpha);
|
||||
|
||||
if (!pbuf) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
|
||||
_("Can't allocate pixbuf"));
|
||||
return NULL;
|
||||
}
|
||||
p = pbuf->pixels;
|
||||
|
||||
if (rle) {
|
||||
n = count = 0;
|
||||
for (; n < pbuf->width * pbuf->height;) {
|
||||
if (!fread_check(&tag, 1, 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
if (tag & 0x80) {
|
||||
count = (tag & 0x7f) + 1;
|
||||
n += count;
|
||||
if (!fread_check(color, (alpha ? 2 : 1), 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
for (; count; count--) {
|
||||
p[0] = p[1] = p[2] = color[0];
|
||||
if (alpha)
|
||||
p[3] = color[1];
|
||||
p += pbuf->n_channels;
|
||||
}
|
||||
} else {
|
||||
count = tag + 1;
|
||||
n += count;
|
||||
for (; count; count--) {
|
||||
if (!fread_check(color, (alpha ? 2 : 1), 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
p[0] = p[1] = p[2] = color[0];
|
||||
if (alpha)
|
||||
p[3] = color[1];
|
||||
p += pbuf->n_channels;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (n = 0; n < pbuf->width * pbuf->height; n++) {
|
||||
if (!fread_check(color, (alpha ? 2 : 1), 1, f, err)) {
|
||||
g_object_unref(pbuf);
|
||||
return NULL;
|
||||
}
|
||||
p[0] = p[1] = p[2] = color[0];
|
||||
if (alpha)
|
||||
p[3] = color[1];
|
||||
p += pbuf->n_channels;
|
||||
}
|
||||
}
|
||||
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
static GdkPixbuf *gdk_pixbuf__tga_load(FILE *f, GError **err)
|
||||
{
|
||||
TGAHeader *hdr;
|
||||
TGAColormap *cmap;
|
||||
GdkPixbuf *pbuf;
|
||||
|
||||
cmap = NULL;
|
||||
hdr = get_header_from_file(f, err);
|
||||
if (!hdr)
|
||||
return NULL;
|
||||
if ((hdr->flags & TGA_INTERLEAVE_MASK) != TGA_INTERLEAVE_NONE ||
|
||||
(hdr->flags & TGA_ORIGIN_RIGHT) || !(hdr->flags & TGA_ORIGIN_UPPER)) {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
||||
_("Unsupported TGA image type"));
|
||||
g_free(hdr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (hdr->has_cmap && ((hdr->type == TGA_TYPE_PSEUDOCOLOR) ||
|
||||
(hdr->type == TGA_TYPE_RLE_PSEUDOCOLOR))) {
|
||||
cmap = get_colormap_from_file(f, hdr, err);
|
||||
if (!cmap) {
|
||||
g_free(hdr);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (hdr->type == TGA_TYPE_PSEUDOCOLOR)
|
||||
pbuf = get_image_pseudocolor(f, hdr, cmap, FALSE, err);
|
||||
else if (hdr->type == TGA_TYPE_RLE_PSEUDOCOLOR)
|
||||
pbuf = get_image_pseudocolor(f, hdr, cmap, TRUE, err);
|
||||
else if (hdr->type == TGA_TYPE_TRUECOLOR)
|
||||
pbuf = get_image_truecolor(f, hdr, FALSE, err);
|
||||
else if (hdr->type == TGA_TYPE_RLE_TRUECOLOR)
|
||||
pbuf = get_image_truecolor(f, hdr, TRUE, err);
|
||||
else if (hdr->type == TGA_TYPE_GRAYSCALE)
|
||||
pbuf = get_image_grayscale(f, hdr, FALSE, err);
|
||||
else if (hdr->type == TGA_TYPE_RLE_GRAYSCALE)
|
||||
pbuf = get_image_grayscale(f, hdr, TRUE, err);
|
||||
else {
|
||||
g_set_error(err, GDK_PIXBUF_ERROR,
|
||||
GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
|
||||
_("Unsupported TGA image type"));
|
||||
pbuf = NULL;
|
||||
}
|
||||
|
||||
if (cmap) {
|
||||
g_free(cmap->cols);
|
||||
g_free(cmap);
|
||||
}
|
||||
g_free(hdr);
|
||||
|
||||
return pbuf;
|
||||
}
|
||||
|
||||
void
|
||||
MODULE_ENTRY (tga, fill_vtable) (GdkPixbufModule *module)
|
||||
{
|
||||
module->load = gdk_pixbuf__tga_load;
|
||||
module->begin_load = gdk_pixbuf__tga_begin_load;
|
||||
module->stop_load = gdk_pixbuf__tga_stop_load;
|
||||
module->load_increment = gdk_pixbuf__tga_load_increment;
|
||||
|
||||
@@ -47,12 +47,12 @@ struct wbmp_progressive_state {
|
||||
GdkPixbufModuleUpdatedFunc updated_func;
|
||||
gpointer user_data;
|
||||
|
||||
gboolean need_type : 1;
|
||||
gboolean need_header : 1;
|
||||
gboolean need_width : 1;
|
||||
gboolean need_height : 1;
|
||||
gboolean needmore : 1;
|
||||
gboolean call_progressive_updates : 1;
|
||||
guint need_type : 1;
|
||||
guint need_header : 1;
|
||||
guint need_width : 1;
|
||||
guint need_height : 1;
|
||||
guint needmore : 1;
|
||||
guint call_progressive_updates : 1;
|
||||
|
||||
guchar last_buf[16]; /* Just needs to be big enough to hold the largest datum requestable via 'getin' */
|
||||
guint last_len;
|
||||
|
||||
@@ -1078,22 +1078,29 @@ pixops_process (guchar *dest_buf,
|
||||
|
||||
static void
|
||||
correct_total (int *weights,
|
||||
int n_x,
|
||||
int n_y,
|
||||
int total,
|
||||
double overall_alpha)
|
||||
int n_x,
|
||||
int n_y,
|
||||
int total,
|
||||
double overall_alpha)
|
||||
{
|
||||
int correction = (int)(0.5 + 65536 * overall_alpha) - total;
|
||||
int i;
|
||||
for (i = n_x * n_y - 1; i >= 0; i--)
|
||||
int remaining, c, d, i;
|
||||
|
||||
if (correction != 0)
|
||||
{
|
||||
if (*(weights + i) + correction >= 0)
|
||||
{
|
||||
*(weights + i) += correction;
|
||||
break;
|
||||
}
|
||||
remaining = correction;
|
||||
for (d = 1, c = correction; c != 0 && remaining != 0; d++, c = correction / d)
|
||||
for (i = n_x * n_y - 1; i >= 0 && c != 0 && remaining != 0; i--)
|
||||
if (*(weights + i) + c >= 0)
|
||||
{
|
||||
*(weights + i) += c;
|
||||
remaining -= c;
|
||||
if ((0 < remaining && remaining < c) ||
|
||||
(0 > remaining && remaining > c))
|
||||
c = remaining;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
tile_make_weights (PixopsFilter *filter, double x_scale, double y_scale, double overall_alpha)
|
||||
|
||||
@@ -64,20 +64,29 @@ query_module (const char *dir, const char *file)
|
||||
char **ext;
|
||||
const GdkPixbufModulePattern *pattern;
|
||||
|
||||
if (g_path_is_absolute (dir))
|
||||
if (g_path_is_absolute (file))
|
||||
path = g_strdup (file);
|
||||
else
|
||||
path = g_build_filename (dir, file, NULL);
|
||||
else {
|
||||
char *cwd = g_get_current_dir ();
|
||||
path = g_build_filename (cwd, dir, file, NULL);
|
||||
g_free (cwd);
|
||||
}
|
||||
|
||||
|
||||
module = g_module_open (path, 0);
|
||||
if (module &&
|
||||
g_module_symbol (module, "fill_info", (gpointer *) &fill_info) &&
|
||||
g_module_symbol (module, "fill_vtable", (gpointer *) &fill_vtable)) {
|
||||
GdkPixbufFormat *info;
|
||||
#ifdef G_OS_WIN32
|
||||
/* Replace backslashes in path with forward slashes, so that
|
||||
* it reads in without problems.
|
||||
*/
|
||||
{
|
||||
char *p = path;
|
||||
while (*p) {
|
||||
if (*p == '\\')
|
||||
*p = '/';
|
||||
p++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
g_printf("\"%s\"\n", path);
|
||||
info = g_new0 (GdkPixbufFormat, 1);
|
||||
(*fill_info) (info);
|
||||
|
||||
@@ -179,7 +179,7 @@ libgdk_linux_fb_2_0_la_LIBADD = linux-fb/libgdk-linux-fb.la @GDK_DEP_LIBS@
|
||||
libgdk_win32_2_0_la_LIBADD = \
|
||||
win32/libgdk-win32.la $(wintab_lib) $(ie55uuid_lib) \
|
||||
@GDK_DEP_LIBS@
|
||||
libgdk_win32_2_0_la_DEPENDENCIES = gdk.def
|
||||
libgdk_win32_2_0_la_DEPENDENCIES = win32/libgdk-win32.la gdk.def
|
||||
|
||||
lib_LTLIBRARIES = $(gdktargetlib)
|
||||
|
||||
|
||||
24
gdk/gdk.c
24
gdk/gdk.c
@@ -103,14 +103,13 @@ gdk_arg_context_parse (GdkArgContext *context, gint *argc, gchar ***argv)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
/* Save a copy of the original argc and argv */
|
||||
if (argc && argv)
|
||||
{
|
||||
for (i = 1; i < *argc; i++)
|
||||
{
|
||||
char *arg;
|
||||
|
||||
if (!(*argv)[i][0] == '-' && (*argv)[i][1] == '-')
|
||||
if (!((*argv)[i][0] == '-' && (*argv)[i][1] == '-'))
|
||||
continue;
|
||||
|
||||
arg = (*argv)[i] + 2;
|
||||
@@ -294,6 +293,7 @@ gdk_parse_args (int *argc,
|
||||
|
||||
gdk_initialized = TRUE;
|
||||
|
||||
/* Save a copy of the original argc and argv */
|
||||
if (argc && argv)
|
||||
{
|
||||
gdk_argc = *argc;
|
||||
@@ -302,17 +302,17 @@ gdk_parse_args (int *argc,
|
||||
for (i = 0; i < gdk_argc; i++)
|
||||
gdk_argv[i] = g_strdup ((*argv)[i]);
|
||||
gdk_argv[gdk_argc] = NULL;
|
||||
}
|
||||
|
||||
if (*argc > 0)
|
||||
{
|
||||
gchar *d;
|
||||
|
||||
d = strrchr((*argv)[0], G_DIR_SEPARATOR);
|
||||
if (d != NULL)
|
||||
g_set_prgname (d + 1);
|
||||
else
|
||||
g_set_prgname ((*argv)[0]);
|
||||
}
|
||||
if (argc && argv && *argc > 0)
|
||||
{
|
||||
gchar *d;
|
||||
|
||||
d = strrchr((*argv)[0], G_DIR_SEPARATOR);
|
||||
if (d != NULL)
|
||||
g_set_prgname (d + 1);
|
||||
else
|
||||
g_set_prgname ((*argv)[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -186,6 +186,7 @@ EXPORTS
|
||||
gdk_font_type_get_type
|
||||
gdk_font_unref
|
||||
gdk_fontset_load
|
||||
gdk_fontset_load_for_display
|
||||
gdk_free_compound_text
|
||||
gdk_free_text_list
|
||||
gdk_function_get_type
|
||||
@@ -401,6 +402,7 @@ EXPORTS
|
||||
gdk_string_height
|
||||
gdk_string_measure
|
||||
gdk_string_to_compound_text
|
||||
gdk_string_to_compound_text_for_display
|
||||
gdk_string_width
|
||||
gdk_subwindow_mode_get_type
|
||||
gdk_synthesize_window_state
|
||||
|
||||
@@ -149,12 +149,10 @@ GType gdk_rectangle_get_type (void);
|
||||
|
||||
/* Conversion functions between wide char and multibyte strings.
|
||||
*/
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
gchar *gdk_wcstombs (const GdkWChar *src);
|
||||
gint gdk_mbstowcs (GdkWChar *dest,
|
||||
const gchar *src,
|
||||
gint dest_max);
|
||||
#endif
|
||||
|
||||
/* Miscellaneous */
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
|
||||
@@ -494,15 +494,18 @@ gdk_display_get_window_at_pointer (GdkDisplay *display,
|
||||
gint *win_y)
|
||||
{
|
||||
gint tmp_x, tmp_y;
|
||||
GdkWindow *window;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||
|
||||
return display->pointer_hooks->window_at_pointer (display, &tmp_x, &tmp_y);
|
||||
|
||||
window = display->pointer_hooks->window_at_pointer (display, &tmp_x, &tmp_y);
|
||||
|
||||
if (win_x)
|
||||
*win_x = tmp_x;
|
||||
if (win_y)
|
||||
*win_y = tmp_y;
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -363,7 +363,6 @@ gdk_event_is_allocated (GdkEvent *event)
|
||||
GdkEvent*
|
||||
gdk_event_copy (GdkEvent *event)
|
||||
{
|
||||
GdkEventPrivate *private;
|
||||
GdkEventPrivate *new_private;
|
||||
GdkEvent *new_event;
|
||||
|
||||
@@ -372,13 +371,16 @@ gdk_event_copy (GdkEvent *event)
|
||||
new_event = gdk_event_new (GDK_NOTHING);
|
||||
new_private = (GdkEventPrivate *)new_event;
|
||||
|
||||
private = (GdkEventPrivate *)event;
|
||||
|
||||
*new_event = *event;
|
||||
if (new_event->any.window)
|
||||
g_object_ref (new_event->any.window);
|
||||
|
||||
new_private->screen = private->screen;
|
||||
if (gdk_event_is_allocated (event))
|
||||
{
|
||||
GdkEventPrivate *private = (GdkEventPrivate *)event;
|
||||
|
||||
new_private->screen = private->screen;
|
||||
}
|
||||
|
||||
switch (event->any.type)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,9 @@ typedef void GdkXEvent; /* Can be cast to window system specific
|
||||
|
||||
typedef enum {
|
||||
GDK_FILTER_CONTINUE, /* Event not handled, continue processesing */
|
||||
GDK_FILTER_TRANSLATE, /* Translated event stored */
|
||||
GDK_FILTER_TRANSLATE, /* Native event translated into a GDK event and
|
||||
stored in the "event" structure that was
|
||||
passed in */
|
||||
GDK_FILTER_REMOVE /* Terminate processing, removing event */
|
||||
} GdkFilterReturn;
|
||||
|
||||
|
||||
146
gdk/gdkpango.c
146
gdk/gdkpango.c
@@ -163,6 +163,37 @@ gdk_pango_context_set_colormap (PangoContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
draw_underline (GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
PangoUnderline uline,
|
||||
int baseline_y,
|
||||
int low_y,
|
||||
int start_x,
|
||||
int end_x)
|
||||
{
|
||||
switch (uline)
|
||||
{
|
||||
case PANGO_UNDERLINE_NONE:
|
||||
break;
|
||||
case PANGO_UNDERLINE_DOUBLE:
|
||||
gdk_draw_line (drawable, gc,
|
||||
start_x, baseline_y + 3,
|
||||
end_x, baseline_y + 3);
|
||||
/* Fall through */
|
||||
case PANGO_UNDERLINE_SINGLE:
|
||||
gdk_draw_line (drawable, gc,
|
||||
start_x, baseline_y + 1,
|
||||
end_x, baseline_y + 1);
|
||||
break;
|
||||
case PANGO_UNDERLINE_LOW:
|
||||
gdk_draw_line (drawable, gc,
|
||||
start_x, low_y + 1,
|
||||
end_x, low_y + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_draw_layout_line_with_colors:
|
||||
* @drawable: the drawable on which to draw the line
|
||||
@@ -195,6 +226,15 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
|
||||
gint rise = 0;
|
||||
gboolean embossed;
|
||||
GdkBitmap *stipple;
|
||||
PangoUnderline last_uline = PANGO_UNDERLINE_NONE;
|
||||
gint uline_start_x = 0;
|
||||
gint uline_end_x = 0;
|
||||
gint uline_end_x_extended = 0;
|
||||
gint last_risen_y = 0;
|
||||
gint low_y = G_MININT;
|
||||
GdkGC *last_fg_gc = NULL;
|
||||
gboolean last_fg_set = FALSE;
|
||||
PangoColor last_fg_color;
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (GDK_IS_GC (gc));
|
||||
@@ -206,7 +246,7 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
PangoUnderline uline = PANGO_UNDERLINE_NONE;
|
||||
PangoUnderline this_uline = PANGO_UNDERLINE_NONE;
|
||||
PangoLayoutRun *run = tmp_list->data;
|
||||
PangoColor fg_color, bg_color;
|
||||
gboolean strike, fg_set, bg_set, shape_set;
|
||||
@@ -215,7 +255,7 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
|
||||
gdk_pango_get_item_properties (run->item, &uline,
|
||||
gdk_pango_get_item_properties (run->item, &this_uline,
|
||||
&strike,
|
||||
&rise,
|
||||
&fg_color, &fg_set,
|
||||
@@ -231,7 +271,7 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
|
||||
|
||||
if (!shape_set)
|
||||
{
|
||||
if (uline == PANGO_UNDERLINE_NONE)
|
||||
if (this_uline == PANGO_UNDERLINE_NONE)
|
||||
pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
|
||||
NULL, &logical_rect);
|
||||
else
|
||||
@@ -281,7 +321,7 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
|
||||
}
|
||||
else
|
||||
fg_gc = gc;
|
||||
|
||||
|
||||
if (!shape_set)
|
||||
{
|
||||
gint gx, gy;
|
||||
@@ -304,36 +344,58 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
|
||||
gx, gy,
|
||||
run->glyphs);
|
||||
}
|
||||
|
||||
switch (uline)
|
||||
|
||||
if (this_uline != last_uline ||
|
||||
risen_y != last_risen_y ||
|
||||
fg_set != last_fg_set ||
|
||||
(fg_set && (last_fg_color.red != fg_color.red ||
|
||||
last_fg_color.green != fg_color.green ||
|
||||
last_fg_color.blue != fg_color.blue)))
|
||||
{
|
||||
case PANGO_UNDERLINE_NONE:
|
||||
break;
|
||||
case PANGO_UNDERLINE_DOUBLE:
|
||||
gdk_draw_line (drawable, fg_gc,
|
||||
x + (x_off + ink_rect.x) / PANGO_SCALE - 1,
|
||||
risen_y + 3,
|
||||
x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE,
|
||||
risen_y + 3);
|
||||
/* Fall through */
|
||||
case PANGO_UNDERLINE_SINGLE:
|
||||
gdk_draw_line (drawable, fg_gc,
|
||||
x + (x_off + ink_rect.x) / PANGO_SCALE - 1,
|
||||
risen_y + 1,
|
||||
x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE,
|
||||
risen_y + 1);
|
||||
break;
|
||||
case PANGO_UNDERLINE_LOW:
|
||||
gdk_draw_line (drawable, fg_gc,
|
||||
x + (x_off + ink_rect.x) / PANGO_SCALE - 1,
|
||||
risen_y + (ink_rect.y + ink_rect.height) / PANGO_SCALE + 1,
|
||||
x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE,
|
||||
risen_y + (ink_rect.y + ink_rect.height) / PANGO_SCALE + 1);
|
||||
break;
|
||||
/* If only color changes, the underlines extend to the edge
|
||||
* of the logical rectangle so they join up; otherwise they
|
||||
* go 1 pixel beyond the ink rectangle. This doesn't work
|
||||
* for low underlines (they will be at a different y anyways),
|
||||
* so they follow the normal path.
|
||||
*/
|
||||
gboolean extend_uline = (this_uline == last_uline &&
|
||||
this_uline != PANGO_UNDERLINE_LOW &&
|
||||
risen_y == last_risen_y);
|
||||
|
||||
/* Starting a new underline run
|
||||
*/
|
||||
if (last_uline != PANGO_UNDERLINE_NONE)
|
||||
{
|
||||
draw_underline (drawable, last_fg_gc, last_uline,
|
||||
last_risen_y, low_y,
|
||||
uline_start_x,
|
||||
extend_uline ? uline_end_x_extended : uline_end_x);
|
||||
}
|
||||
|
||||
if (this_uline != PANGO_UNDERLINE_NONE)
|
||||
{
|
||||
if (extend_uline)
|
||||
uline_start_x = x + x_off / PANGO_SCALE;
|
||||
else
|
||||
uline_start_x = x + (x_off + ink_rect.x) / PANGO_SCALE - 1;
|
||||
|
||||
low_y = G_MININT;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update current underline segment information
|
||||
*/
|
||||
if (this_uline != PANGO_UNDERLINE_NONE)
|
||||
{
|
||||
uline_end_x = x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE;
|
||||
uline_end_x_extended = x + (x_off + logical_rect.x + logical_rect.width) / PANGO_SCALE - 1;
|
||||
}
|
||||
|
||||
if (this_uline == PANGO_UNDERLINE_LOW)
|
||||
low_y = MAX (low_y, risen_y + (ink_rect.y + ink_rect.height) / PANGO_SCALE);
|
||||
|
||||
if (strike)
|
||||
{
|
||||
{
|
||||
int centerline = logical_rect.y + logical_rect.height / 2;
|
||||
|
||||
gdk_draw_line (drawable, fg_gc,
|
||||
@@ -341,13 +403,29 @@ gdk_draw_layout_line_with_colors (GdkDrawable *drawable,
|
||||
risen_y + centerline / PANGO_SCALE,
|
||||
x + (x_off + logical_rect.x + logical_rect.width) / PANGO_SCALE + 1,
|
||||
risen_y + centerline / PANGO_SCALE);
|
||||
}
|
||||
|
||||
if (fg_gc != gc)
|
||||
gdk_pango_free_gc (context, fg_gc);
|
||||
}
|
||||
|
||||
if (last_fg_gc != gc && last_fg_gc)
|
||||
gdk_pango_free_gc (context, last_fg_gc);
|
||||
|
||||
last_risen_y = risen_y;
|
||||
last_uline = this_uline;
|
||||
last_fg_gc = fg_gc;
|
||||
last_fg_set = fg_set;
|
||||
if (fg_set)
|
||||
last_fg_color = fg_color;
|
||||
|
||||
x_off += logical_rect.width;
|
||||
}
|
||||
|
||||
/* Finish off any remaining underlines
|
||||
*/
|
||||
if (last_uline != PANGO_UNDERLINE_NONE)
|
||||
draw_underline (drawable, last_fg_gc, last_uline, last_risen_y, low_y,
|
||||
uline_start_x, uline_end_x);
|
||||
|
||||
if (last_fg_gc != gc && last_fg_gc)
|
||||
gdk_pango_free_gc (context, last_fg_gc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,11 +34,19 @@
|
||||
#include "gdk-pixbuf-private.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
/* Some convenient names
|
||||
*/
|
||||
#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
|
||||
#define LITTLE
|
||||
#undef BIG
|
||||
#else
|
||||
#define BIG
|
||||
#undef LITTLE
|
||||
#endif
|
||||
#define d(x)
|
||||
|
||||
#define SWAP16(d) GUINT16_SWAP_LE_BE(d)
|
||||
|
||||
|
||||
|
||||
static guint32 mask_table[] = {
|
||||
@@ -363,6 +371,39 @@ rgb8a (GdkImage *image,
|
||||
}
|
||||
}
|
||||
|
||||
/* Bit shifting for 565 and 555 conversion routines
|
||||
*
|
||||
* RGB565 == rrrr rggg gggb bbbb, 16 bit native endian
|
||||
* RGB555 == xrrr rrgg gggb bbbb
|
||||
* ABGR8888: ARGB, 32-bit native endian
|
||||
* RGBA8888: RGBA, 32-bit native endian
|
||||
*/
|
||||
#define R8fromRGB565(d) ((((d) >> 8) & 0xf8) | (((d) >> 13) & 0x7))
|
||||
#define G8fromRGB565(d) ((((d) >> 3) & 0xfc) | (((d) >> 9) & 0x3))
|
||||
#define B8fromRGB565(d) ((((d) << 3) & 0xf8) | (((d) >> 2) & 0x7))
|
||||
|
||||
#define ABGR8888fromRGB565(d) ( ((d) & 0xf800) >> 8 | ((d) & 0xe000) >> 13 \
|
||||
| ((d) & 0x07e0) << 5 | ((d) & 0x0600) >> 1 \
|
||||
| ((d) & 0x001f) << 19 | ((d) & 0x001c) << 14 \
|
||||
| 0xff000000)
|
||||
#define RGBA8888fromRGB565(d) ( ((d) & 0xf800) << 16 | ((d) & 0xe000) << 11 \
|
||||
| ((d) & 0x07e0) << 13 | ((d) & 0x0600) << 7 \
|
||||
| ((d) & 0x001f) << 11 | ((d) & 0x001c) << 6 \
|
||||
| 0xff)
|
||||
|
||||
#define R8fromRGB555(d) (((d) & 0x7c00) >> 7 | ((d) & 0x7000) >> 12)
|
||||
#define G8fromRGB555(d) (((d) & 0x03e0) >> 2 | ((d) & 0x0380) >> 7)
|
||||
#define B8fromRGB555(d) (((d) & 0x001f) << 3 | ((d) & 0x001c) >> 2)
|
||||
|
||||
#define ABGR8888fromRGB555(d) ( ((d) & 0x7c00) >> 7 | ((d) & 0x7000) >> 12 \
|
||||
| ((d) & 0x03e0) << 6 | ((d) & 0x0380) << 1 \
|
||||
| ((d) & 0x001f) << 19 | ((d) & 0x001c) << 14 \
|
||||
| 0xff000000)
|
||||
#define RGBA8888fromRGB555(d) ( ((d) & 0x7c00) << 17 | ((d) & 0x7000) << 12 \
|
||||
| ((d) & 0x03e0) << 14 | ((d) & 0x0380) << 9 \
|
||||
| ((d) & 0x001f) << 11 | ((d) & 0x001c) << 6 \
|
||||
| 0xff)
|
||||
|
||||
/*
|
||||
* convert 16 bits/pixel data
|
||||
* no alpha
|
||||
@@ -372,95 +413,35 @@ static void
|
||||
rgb565lsb (GdkImage *image,
|
||||
guchar *pixels,
|
||||
int rowstride,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
int x1,
|
||||
int y1,
|
||||
int x2,
|
||||
int y2,
|
||||
GdkColormap *colormap)
|
||||
{
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint32 *s; /* read 2 pixels at once */
|
||||
#else
|
||||
register guint8 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
register guint16 *s;
|
||||
register guint8 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
|
||||
|
||||
bpl = image->bpl;
|
||||
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
s = (guint32 *) srow;
|
||||
#else
|
||||
s = srow;
|
||||
#endif
|
||||
o = (guint16 *) orow;
|
||||
|
||||
/* check for first pixel odd */
|
||||
xx = x1;
|
||||
if (xx & 1)
|
||||
s = (guint16 *) srow;
|
||||
o = (guint8 *) orow;
|
||||
for (xx = x1; xx < x2; xx ++)
|
||||
{
|
||||
register guint16 data;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#endif
|
||||
((char *) o)[0] = ((data >> 8) & 0xf8) | ((data >> 13) & 0x7);
|
||||
((char *) o)[1] = ((data >> 3) & 0xfc) | ((data >> 9) & 0x3);
|
||||
((char *) o)[2] = ((data << 3) & 0xf8) | ((data >> 2) & 0x7);
|
||||
o = (guint16 *) (((char *) o) + 3);
|
||||
++xx;
|
||||
}
|
||||
|
||||
g_assert (!(xx & 1));
|
||||
|
||||
/* if x2 is even, then the -1 does nothing to number of
|
||||
* loop iterations, if x2 is odd then the -1 reduces
|
||||
* iterations by one
|
||||
*/
|
||||
for (; xx < (x2 - 1); xx += 2)
|
||||
{
|
||||
register guint32 data;
|
||||
#ifdef LITTLE
|
||||
data = *s++;
|
||||
*o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
|
||||
| (data & 0x7e0) << 5 | (data & 0x600) >> 1;
|
||||
*o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
|
||||
| (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21;
|
||||
*o++ = (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25
|
||||
| (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
|
||||
#else
|
||||
/* swap endianness first */
|
||||
data = s[1] << 24 | s[0] << 16 | s[3] << 8 | s[2];
|
||||
s += 4;
|
||||
|
||||
*o++ = (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21
|
||||
| (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25;
|
||||
*o++ = (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10
|
||||
| (data & 0xf800) >> 8 | (data & 0xe000) >> 13;
|
||||
*o++ = (data & 0x7e0) << 5 | (data & 0x600) >> 1
|
||||
| (data & 0x1f) << 3 | (data & 0x1c) >> 2;
|
||||
#endif
|
||||
}
|
||||
/* check for last remaining pixel */
|
||||
if (x2 & 1)
|
||||
{
|
||||
register guint16 data;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#endif
|
||||
((char *) o)[0] = ((data >> 8) & 0xf8) | ((data >> 13) & 0x7);
|
||||
((char *) o)[1] = ((data >> 3) & 0xfc) | ((data >> 9) & 0x3);
|
||||
((char *) o)[2] = ((data << 3) & 0xf8) | ((data >> 2) & 0x7);
|
||||
register guint32 data = *s++;
|
||||
#ifdef BIG
|
||||
data = SWAP16 (data);
|
||||
#endif
|
||||
*o++ = R8fromRGB565 (data);
|
||||
*o++ = G8fromRGB565 (data);
|
||||
*o++ = B8fromRGB565 (data);
|
||||
}
|
||||
srow += bpl;
|
||||
orow += rowstride;
|
||||
@@ -485,87 +466,26 @@ rgb565msb (GdkImage *image,
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint8 *s; /* need to swap data order */
|
||||
#else
|
||||
register guint32 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
register guint16 *s;
|
||||
register guint8 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
|
||||
bpl = image->bpl;
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
s = srow;
|
||||
#else
|
||||
s = (guint32 *) srow;
|
||||
#endif
|
||||
o = (guint16 *) orow;
|
||||
|
||||
xx = x1;
|
||||
|
||||
/* check for first pixel odd */
|
||||
if (xx & 1)
|
||||
s = (guint16 *) srow;
|
||||
o = (guint8 *) orow;
|
||||
for (xx = x1; xx < x2; xx ++)
|
||||
{
|
||||
register guint16 data;
|
||||
register guint32 data = *s++;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
#endif
|
||||
((char *) o)[0] = ((data >> 8) & 0xf8) | ((data >> 13) & 0x7);
|
||||
((char *) o)[1] = ((data >> 3) & 0xfc) | ((data >> 9) & 0x3);
|
||||
((char *) o)[2] = ((data << 3) & 0xf8) | ((data >> 2) & 0x7);
|
||||
|
||||
o = (guint16 *) (((char *) o) + 3);
|
||||
++xx;
|
||||
}
|
||||
|
||||
g_assert (!(xx & 1));
|
||||
|
||||
/* if x2 is even, then the -1 does nothing to number of
|
||||
* loop iterations, if x2 is odd then the -1 reduces
|
||||
* iterations by one
|
||||
*/
|
||||
for (; xx < (x2 - 1); xx += 2)
|
||||
{
|
||||
register guint32 data;
|
||||
#ifdef LITTLE
|
||||
/* swap endianness first */
|
||||
data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
|
||||
s += 4;
|
||||
*o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
|
||||
| (data & 0x7e0) << 5 | (data & 0x600) >> 1;
|
||||
*o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
|
||||
| (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21;
|
||||
*o++ = (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25
|
||||
| (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
|
||||
#else
|
||||
data = *s++;
|
||||
*o++ = (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21
|
||||
| (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25;
|
||||
*o++ = (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10
|
||||
| (data & 0xf800) >> 8 | (data & 0xe000) >> 13;
|
||||
*o++ = (data & 0x7e0) << 5 | (data & 0x600) >> 1
|
||||
| (data & 0x1f) << 3 | (data & 0x1c) >> 2;
|
||||
#endif
|
||||
}
|
||||
/* check for last remaining pixel */
|
||||
if (x2 & 1)
|
||||
{
|
||||
register guint16 data;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
#endif
|
||||
((char *) o)[0] = ((data >> 8) & 0xf8) | ((data >> 13) & 0x7);
|
||||
((char *) o)[1] = ((data >> 3) & 0xfc) | ((data >> 9) & 0x3);
|
||||
((char *) o)[2] = ((data << 3) & 0xf8) | ((data >> 2) & 0x7);
|
||||
data = SWAP16 (data);
|
||||
#endif
|
||||
*o++ = R8fromRGB565 (data);
|
||||
*o++ = G8fromRGB565 (data);
|
||||
*o++ = B8fromRGB565 (data);
|
||||
}
|
||||
srow += bpl;
|
||||
orow += rowstride;
|
||||
@@ -590,11 +510,7 @@ rgb565alsb (GdkImage *image,
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint16 *s; /* read 1 pixels at once */
|
||||
#else
|
||||
register guint8 *s;
|
||||
#endif
|
||||
register guint16 *s;
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
@@ -603,31 +519,16 @@ rgb565alsb (GdkImage *image,
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
s = (guint16 *) srow;
|
||||
#else
|
||||
s = (guint8 *) srow;
|
||||
#endif
|
||||
o = (guint32 *) orow;
|
||||
for (xx = x1; xx < x2; xx ++)
|
||||
{
|
||||
register guint32 data;
|
||||
/* rrrrrggg gggbbbbb -> rrrrrRRR ggggggGG bbbbbBBB aaaaaaaa */
|
||||
/* little endian: aaaaaaaa bbbbbBBB ggggggGG rrrrrRRR */
|
||||
register guint32 data = *s++;
|
||||
#ifdef LITTLE
|
||||
data = *s++;
|
||||
*o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
|
||||
| (data & 0x7e0) << 5 | (data & 0x600) >> 1
|
||||
| (data & 0x1f) << 19 | (data & 0x1c) << 14
|
||||
| 0xff000000;
|
||||
*o++ = ABGR8888fromRGB565 (data);
|
||||
#else
|
||||
/* swap endianness first */
|
||||
data = s[0] | s[1] << 8;
|
||||
s += 2;
|
||||
*o++ = (data & 0xf800) << 16 | (data & 0xe000) << 11
|
||||
| (data & 0x7e0) << 13 | (data & 0x600) << 7
|
||||
| (data & 0x1f) << 11 | (data & 0x1c) << 6
|
||||
| 0xff;
|
||||
data = SWAP16 (data);
|
||||
*o++ = RGBA8888fromRGB565 (data);
|
||||
#endif
|
||||
}
|
||||
srow += bpl;
|
||||
@@ -653,11 +554,7 @@ rgb565amsb (GdkImage *image,
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint8 *s;
|
||||
#else
|
||||
register guint16 *s; /* read 1 pixels at once */
|
||||
#endif
|
||||
register guint16 *s;
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
@@ -666,27 +563,16 @@ rgb565amsb (GdkImage *image,
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
s = srow;
|
||||
s = (guint16 *) srow;
|
||||
o = (guint32 *) orow;
|
||||
for (xx = x1; xx < x2; xx ++)
|
||||
{
|
||||
register guint32 data;
|
||||
/* rrrrrggg gggbbbbb -> rrrrrRRR gggggg00 bbbbbBBB aaaaaaaa */
|
||||
/* little endian: aaaaaaaa bbbbbBBB gggggg00 rrrrrRRR */
|
||||
register guint32 data = *s++;
|
||||
#ifdef LITTLE
|
||||
/* swap endianness first */
|
||||
data = s[0] | s[1] << 8;
|
||||
s += 2;
|
||||
*o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
|
||||
| (data & 0x7e0) << 5 | (data & 0x600) >> 1
|
||||
| (data & 0x1f) << 19 | (data & 0x1c) << 14
|
||||
| 0xff000000;
|
||||
data = SWAP16 (data);
|
||||
*o++ = ABGR8888fromRGB565 (data);
|
||||
#else
|
||||
data = *s++;
|
||||
*o++ = (data & 0xf800) << 16 | (data & 0xe000) << 11
|
||||
| (data & 0x7e0) << 13 | (data & 0x600) << 7
|
||||
| (data & 0x1f) << 11 | (data & 0x1c) << 6
|
||||
| 0xff;
|
||||
*o++ = RGBA8888fromRGB565 (data);
|
||||
#endif
|
||||
}
|
||||
srow += bpl;
|
||||
@@ -712,86 +598,26 @@ rgb555lsb (GdkImage *image,
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint32 *s; /* read 2 pixels at once */
|
||||
#else
|
||||
register guint8 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
register guint16 *s;
|
||||
register guint8 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
|
||||
bpl = image->bpl;
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
s = (guint32 *) srow;
|
||||
#else
|
||||
s = srow;
|
||||
#endif
|
||||
o = (guint16 *) orow;
|
||||
|
||||
xx = x1;
|
||||
|
||||
/* check for first odd pixel */
|
||||
if (xx & 1)
|
||||
s = (guint16 *) srow;
|
||||
o = (guint8 *) orow;
|
||||
for (xx = x1; xx < x2; xx ++)
|
||||
{
|
||||
register guint16 data;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#endif
|
||||
((char *) o)[0] = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12;
|
||||
((char *) o)[1] = (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
|
||||
((char *) o)[2] = (data & 0x1f) << 3 | (data & 0x1c) >> 2;
|
||||
o = (guint16 *) (((char *) o) + 3);
|
||||
++xx;
|
||||
}
|
||||
|
||||
g_assert (!(xx & 1));
|
||||
|
||||
/* if x2 is even, then the -1 does nothing to number of
|
||||
* loop iterations, if x2 is odd then the -1 reduces
|
||||
* iterations by one
|
||||
*/
|
||||
for (; xx < (x2 - 1); xx += 2)
|
||||
{
|
||||
register guint32 data;
|
||||
#ifdef LITTLE
|
||||
data = *s++;
|
||||
*o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
|
||||
| (data & 0x3e0) << 6 | (data & 0x380) << 1;
|
||||
*o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
|
||||
| (data & 0x7c000000) >> 15 | (data & 0x70000000) >> 20;
|
||||
*o++ = (data & 0x3e00000) >> 18 | (data & 0x3800000) >> 23
|
||||
| (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
|
||||
#else
|
||||
/* swap endianness first */
|
||||
data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
|
||||
s += 4;
|
||||
*o++ = (data & 0x7c00) << 1 | (data & 0x7000) >> 4
|
||||
| (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
|
||||
*o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
|
||||
| (data & 0x7c000000) >> 23 | (data & 0x70000000) >> 28;
|
||||
*o++ = (data & 0x3e00000) >> 10 | (data & 0x3800000) >> 15
|
||||
| (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
|
||||
#endif
|
||||
}
|
||||
/* check for last remaining pixel */
|
||||
if (x2 & 1)
|
||||
{
|
||||
register guint16 data;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#endif
|
||||
((char *) o)[0] = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12;
|
||||
((char *) o)[1] = (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
|
||||
((char *) o)[2] = (data & 0x1f) << 3 | (data & 0x1c) >> 2;
|
||||
register guint32 data = *s++;
|
||||
#ifdef BIG
|
||||
data = SWAP16 (data);
|
||||
#endif
|
||||
*o++ = R8fromRGB555 (data);
|
||||
*o++ = G8fromRGB555 (data);
|
||||
*o++ = B8fromRGB555 (data);
|
||||
}
|
||||
srow += bpl;
|
||||
orow += rowstride;
|
||||
@@ -816,82 +642,26 @@ rgb555msb (GdkImage *image,
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint8 *s; /* read 2 pixels at once */
|
||||
#else
|
||||
register guint32 *s; /* read 2 pixels at once */
|
||||
#endif
|
||||
register guint16 *o;
|
||||
register guint16 *s;
|
||||
register guint8 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
|
||||
bpl = image->bpl;
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
s = srow;
|
||||
o = (guint16 *) orow;
|
||||
|
||||
xx = x1;
|
||||
/* See if first pixel is odd */
|
||||
if (xx & 1)
|
||||
s = (guint16 *) srow;
|
||||
o = (guint8 *) orow;
|
||||
for (xx = x1; xx < x2; xx ++)
|
||||
{
|
||||
register guint16 data;
|
||||
register guint32 data = *s++;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
#endif
|
||||
((char *) o)[0] = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12;
|
||||
((char *) o)[1] = (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
|
||||
((char *) o)[2] = (data & 0x1f) << 3 | (data & 0x1c) >> 2;
|
||||
|
||||
o = (guint16 *) (((char *) o) + 3);
|
||||
++xx;
|
||||
}
|
||||
|
||||
g_assert (!(xx & 1));
|
||||
|
||||
/* if x2 is even, then the -1 does nothing to number of
|
||||
* loop iterations, if x2 is odd then the -1 reduces
|
||||
* iterations by one
|
||||
*/
|
||||
for (; xx < (x2 - 1); xx += 2)
|
||||
{
|
||||
register guint32 data;
|
||||
#ifdef LITTLE
|
||||
/* swap endianness first */
|
||||
data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
|
||||
s += 4;
|
||||
*o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
|
||||
| (data & 0x3e0) << 6 | (data & 0x380) << 1;
|
||||
*o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
|
||||
| (data & 0x7c000000) >> 15 | (data & 0x70000000) >> 20;
|
||||
*o++ = (data & 0x3e00000) >> 18 | (data & 0x3800000) >> 23
|
||||
| (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
|
||||
#else
|
||||
data = *s++;
|
||||
*o++ = (data & 0x7c00) << 1 | (data & 0x7000) >> 4
|
||||
| (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
|
||||
*o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
|
||||
| (data & 0x7c000000) >> 23 | (data & 0x70000000) >> 28;
|
||||
*o++ = (data & 0x3e00000) >> 10 | (data & 0x3800000) >> 15
|
||||
| (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
|
||||
#endif
|
||||
}
|
||||
/* check for last remaining pixel */
|
||||
if (x2 & 1)
|
||||
{
|
||||
register guint16 data;
|
||||
#ifdef LITTLE
|
||||
data = *((short *) s);
|
||||
data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
|
||||
#else
|
||||
data = *((short *) s);
|
||||
#endif
|
||||
((char *) o)[0] = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12;
|
||||
((char *) o)[1] = (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
|
||||
((char *) o)[2] = (data & 0x1f) << 3 | (data & 0x1c) >> 2;
|
||||
data = SWAP16 (data);
|
||||
#endif
|
||||
*o++ = R8fromRGB555 (data);
|
||||
*o++ = G8fromRGB555 (data);
|
||||
*o++ = B8fromRGB555 (data);
|
||||
}
|
||||
srow += bpl;
|
||||
orow += rowstride;
|
||||
@@ -916,11 +686,7 @@ rgb555alsb (GdkImage *image,
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint16 *s; /* read 1 pixels at once */
|
||||
#else
|
||||
register guint8 *s;
|
||||
#endif
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
@@ -929,31 +695,16 @@ rgb555alsb (GdkImage *image,
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
s = (guint16 *) srow;
|
||||
#else
|
||||
s = srow;
|
||||
#endif
|
||||
o = (guint32 *) orow;
|
||||
for (xx = x1; xx < x2; xx++)
|
||||
{
|
||||
register guint32 data;
|
||||
/* rrrrrggg gggbbbbb -> rrrrrRRR gggggGGG bbbbbBBB aaaaaaaa */
|
||||
/* little endian: aaaaaaaa bbbbbBBB gggggGGG rrrrrRRR */
|
||||
register guint32 data = *s++;
|
||||
#ifdef LITTLE
|
||||
data = *s++;
|
||||
*o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
|
||||
| (data & 0x3e0) << 6 | (data & 0x380) << 1
|
||||
| (data & 0x1f) << 19 | (data & 0x1c) << 14
|
||||
| 0xff000000;
|
||||
*o++ = ABGR8888fromRGB555 (data);
|
||||
#else
|
||||
/* swap endianness first */
|
||||
data = s[0] | s[1] << 8;
|
||||
s += 2;
|
||||
*o++ = (data & 0x7c00) << 17 | (data & 0x7000) << 12
|
||||
| (data & 0x3e0) << 14 | (data & 0x380) << 9
|
||||
| (data & 0x1f) << 11 | (data & 0x1c) << 6
|
||||
| 0xff;
|
||||
data = SWAP16 (data);
|
||||
*o++ = RGBA8888fromRGB555 (data);
|
||||
#endif
|
||||
}
|
||||
srow += bpl;
|
||||
@@ -979,11 +730,7 @@ rgb555amsb (GdkImage *image,
|
||||
int xx, yy;
|
||||
int bpl;
|
||||
|
||||
#ifdef LITTLE
|
||||
register guint16 *s; /* read 1 pixels at once */
|
||||
#else
|
||||
register guint8 *s;
|
||||
#endif
|
||||
register guint16 *s;
|
||||
register guint32 *o;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
@@ -992,31 +739,16 @@ rgb555amsb (GdkImage *image,
|
||||
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
s = (guint16 *) srow;
|
||||
#else
|
||||
s = srow;
|
||||
#endif
|
||||
o = (guint32 *) orow;
|
||||
for (xx = x1; xx < x2; xx++)
|
||||
{
|
||||
register guint32 data;
|
||||
/* rrrrrggg gggbbbbb -> rrrrrRRR gggggGGG bbbbbBBB aaaaaaaa */
|
||||
/* little endian: aaaaaaaa bbbbbBBB gggggGGG rrrrrRRR */
|
||||
register guint32 data = *s++;
|
||||
#ifdef LITTLE
|
||||
/* swap endianness first */
|
||||
data = s[0] | s[1] << 8;
|
||||
s += 2;
|
||||
*o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
|
||||
| (data & 0x3e0) << 6 | (data & 0x380) << 1
|
||||
| (data & 0x1f) << 19 | (data & 0x1c) << 14
|
||||
| 0xff000000;
|
||||
data = SWAP16 (data);
|
||||
*o++ = ABGR8888fromRGB555 (data);
|
||||
#else
|
||||
data = *s++;
|
||||
*o++ = (data & 0x7c00) << 17 | (data & 0x7000) << 12
|
||||
| (data & 0x3e0) << 14 | (data & 0x380) << 9
|
||||
| (data & 0x1f) << 11 | (data & 0x1c) << 6
|
||||
| 0xff;
|
||||
*o++ = RGBA8888fromRGB555 (data);
|
||||
#endif
|
||||
}
|
||||
srow += bpl;
|
||||
@@ -1114,13 +846,8 @@ rgb888amsb (GdkImage *image,
|
||||
int bpl;
|
||||
|
||||
guint8 *srow = (guint8*)image->mem + y1 * image->bpl + x1 * image->bpp, *orow = pixels;
|
||||
#ifdef LITTLE
|
||||
guint32 *o;
|
||||
guint32 *s;
|
||||
#else
|
||||
guint8 *s; /* for byte order swapping */
|
||||
guint8 *o;
|
||||
#endif
|
||||
|
||||
d (printf ("32 bit, msb, with alpha\n"));
|
||||
|
||||
@@ -1129,24 +856,14 @@ rgb888amsb (GdkImage *image,
|
||||
/* msb data */
|
||||
for (yy = y1; yy < y2; yy++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
s = (guint32 *) srow;
|
||||
o = (guint32 *) orow;
|
||||
#else
|
||||
s = srow;
|
||||
o = orow;
|
||||
#endif
|
||||
for (xx = x1; xx < x2; xx++)
|
||||
{
|
||||
#ifdef LITTLE
|
||||
*o++ = s[1];
|
||||
*o++ = s[2];
|
||||
*o++ = s[3];
|
||||
*o++ = 0xff;
|
||||
s += 4;
|
||||
*o++ = (*s++ >> 8) | 0xff000000;
|
||||
#else
|
||||
*o++ = (*s << 8) | 0xff; /* untested */
|
||||
s++;
|
||||
*o++ = (*s++ << 8) | 0xff;
|
||||
#endif
|
||||
}
|
||||
srow += bpl;
|
||||
|
||||
@@ -164,7 +164,7 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
|
||||
* for consistent visual results. If you do not have any of these cases, the
|
||||
* dither offsets can be both zero.
|
||||
*
|
||||
* Deprecated: This function is obsolete. Use gdk_draw_pixbuf() instead.
|
||||
* This function is obsolete. Use gdk_draw_pixbuf() instead.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
|
||||
@@ -207,7 +207,7 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
|
||||
* On older X servers, rendering pixbufs with an alpha channel involves round trips
|
||||
* to the X server, and may be somewhat slow.
|
||||
*
|
||||
* Deprecated: This function is obsolete. Use gdk_draw_pixbuf() instead.
|
||||
* This function is obsolete. Use gdk_draw_pixbuf() instead.
|
||||
**/
|
||||
void
|
||||
gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
|
||||
@@ -238,7 +238,8 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
|
||||
* and @mask_return arguments, respectively, and renders a pixbuf and its
|
||||
* corresponding thresholded alpha mask to them. This is merely a convenience
|
||||
* function; applications that need to render pixbufs with dither offsets or to
|
||||
* given drawables should use gdk_draw_pixbuf() and gdk_pixbuf_render_threshold_alpha().
|
||||
* given drawables should use gdk_pixbuf_render_to_drawable_alpha() or
|
||||
* gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha().
|
||||
*
|
||||
* The pixmap that is created is created for the colormap returned
|
||||
* by gdk_rgb_get_colormap(). You normally will want to instead use
|
||||
@@ -274,7 +275,8 @@ gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
|
||||
* and @mask_return arguments, respectively, and renders a pixbuf and its
|
||||
* corresponding tresholded alpha mask to them. This is merely a convenience
|
||||
* function; applications that need to render pixbufs with dither offsets or to
|
||||
* given drawables should use gdk_draw_pixbuf(), and gdk_pixbuf_render_threshold_alpha().
|
||||
* given drawables should use gdk_pixbuf_render_to_drawable_alpha() or
|
||||
* gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha().
|
||||
*
|
||||
* The pixmap that is created uses the #GdkColormap specified by @colormap.
|
||||
* This colormap must match the colormap of the window where the pixmap
|
||||
@@ -306,11 +308,11 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
|
||||
|
||||
gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return), colormap);
|
||||
gc = gdk_gc_new (*pixmap_return);
|
||||
gdk_draw_pixbuf (*pixmap_return, gc, pixbuf,
|
||||
0, 0, 0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
gdk_pixbuf_render_to_drawable (pixbuf, *pixmap_return, gc,
|
||||
0, 0, 0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf),
|
||||
GDK_RGB_DITHER_NORMAL,
|
||||
0, 0);
|
||||
g_object_unref (gc);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
|
||||
int width,
|
||||
int height,
|
||||
int alpha_threshold);
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
|
||||
GdkDrawable *drawable,
|
||||
GdkGC *gc,
|
||||
@@ -46,7 +45,7 @@ void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
|
||||
GdkRgbDither dither,
|
||||
int x_dither,
|
||||
int y_dither);
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
|
||||
void gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
|
||||
GdkColormap *colormap,
|
||||
GdkPixmap **pixmap_return,
|
||||
|
||||
@@ -1715,10 +1715,6 @@ gdk_region_spans_intersect_foreach (GdkRegion *region,
|
||||
if ((!region->numRects) || (n_spans == 0))
|
||||
return;
|
||||
|
||||
y = span->y;
|
||||
left = span->x;
|
||||
right = span->x + span->width; /* right is not in the span! */
|
||||
|
||||
/* The main method here is to step along the
|
||||
* sorted rectangles and spans in lock step, and
|
||||
* clipping the spans that are in the current
|
||||
|
||||
@@ -217,7 +217,6 @@ gdk_rgb_try_colormap (GdkRgbInfo *image_info, gboolean force,
|
||||
GdkColormap *cmap;
|
||||
GdkColor color;
|
||||
gulong pixels[256];
|
||||
gulong junk[256];
|
||||
gint i;
|
||||
gint d2;
|
||||
gint colors_needed;
|
||||
|
||||
@@ -354,6 +354,7 @@ _gdk_window_destroy_hierarchy (GdkWindow *window,
|
||||
}
|
||||
|
||||
_gdk_windowing_window_destroy (window, recursing, foreign_destroy);
|
||||
private->parent = NULL;
|
||||
private->destroyed = TRUE;
|
||||
|
||||
if (private->filters)
|
||||
@@ -780,17 +781,20 @@ gboolean
|
||||
gdk_window_is_viewable (GdkWindow *window)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
GdkScreen *screen = gdk_drawable_get_screen (window);
|
||||
GdkWindow *root_window = gdk_screen_get_root_window (screen);
|
||||
GdkScreen *screen;
|
||||
GdkWindow *root_window;
|
||||
|
||||
g_return_val_if_fail (window != NULL, FALSE);
|
||||
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
||||
|
||||
screen = gdk_drawable_get_screen (window);
|
||||
root_window = gdk_screen_get_root_window (screen);
|
||||
|
||||
while (private &&
|
||||
(private != (GdkWindowObject *)root_window) &&
|
||||
(GDK_WINDOW_TYPE (private) != GDK_WINDOW_FOREIGN))
|
||||
{
|
||||
if (!GDK_WINDOW_IS_MAPPED (window))
|
||||
if (GDK_WINDOW_DESTROYED (window) || !GDK_WINDOW_IS_MAPPED (window))
|
||||
return FALSE;
|
||||
|
||||
private = (GdkWindowObject *)private->parent;
|
||||
@@ -1417,7 +1421,7 @@ gdk_window_draw_text_wc (GdkDrawable *drawable,
|
||||
}
|
||||
|
||||
static GdkDrawable*
|
||||
gdk_window_get_composite_drawable (GdkDrawable *window,
|
||||
gdk_window_get_composite_drawable (GdkDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
@@ -1425,7 +1429,7 @@ gdk_window_get_composite_drawable (GdkDrawable *window,
|
||||
gint *composite_x_offset,
|
||||
gint *composite_y_offset)
|
||||
{
|
||||
GdkWindowObject *private = (GdkWindowObject *)window;
|
||||
GdkWindowObject *private = (GdkWindowObject *)drawable;
|
||||
GdkWindowPaint *paint;
|
||||
GdkRegion *buffered_region;
|
||||
GSList *tmp_list;
|
||||
@@ -1437,14 +1441,15 @@ gdk_window_get_composite_drawable (GdkDrawable *window,
|
||||
gint windowing_x_offset, windowing_y_offset;
|
||||
gint buffer_x_offset, buffer_y_offset;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window) || private->paint_stack == NULL)
|
||||
if ((GDK_IS_WINDOW (drawable) && GDK_WINDOW_DESTROYED (drawable))
|
||||
|| private->paint_stack == NULL)
|
||||
{
|
||||
/* No backing store */
|
||||
_gdk_windowing_window_get_offsets (window,
|
||||
_gdk_windowing_window_get_offsets (drawable,
|
||||
composite_x_offset,
|
||||
composite_y_offset);
|
||||
|
||||
return g_object_ref (window);
|
||||
return g_object_ref (drawable);
|
||||
}
|
||||
|
||||
buffered_region = NULL;
|
||||
@@ -1490,20 +1495,20 @@ gdk_window_get_composite_drawable (GdkDrawable *window,
|
||||
{
|
||||
gdk_region_destroy (buffered_region);
|
||||
|
||||
_gdk_windowing_window_get_offsets (window,
|
||||
_gdk_windowing_window_get_offsets (drawable,
|
||||
composite_x_offset,
|
||||
composite_y_offset);
|
||||
|
||||
return g_object_ref (window);
|
||||
return g_object_ref (drawable);
|
||||
}
|
||||
|
||||
tmp_pixmap = gdk_pixmap_new (window,
|
||||
tmp_pixmap = gdk_pixmap_new (drawable,
|
||||
width, height,
|
||||
-1);
|
||||
|
||||
tmp_gc = gdk_gc_new (tmp_pixmap);
|
||||
|
||||
_gdk_windowing_window_get_offsets (window,
|
||||
_gdk_windowing_window_get_offsets (drawable,
|
||||
&windowing_x_offset,
|
||||
&windowing_y_offset);
|
||||
|
||||
@@ -2661,7 +2666,7 @@ gdk_window_constrain_size (GdkGeometry *geometry,
|
||||
|
||||
if (geometry->min_aspect * height > width)
|
||||
{
|
||||
delta = FLOOR (height - width * geometry->min_aspect, yinc);
|
||||
delta = FLOOR (height - width / geometry->min_aspect, yinc);
|
||||
if (height - delta >= min_height)
|
||||
height -= delta;
|
||||
else
|
||||
|
||||
@@ -40,7 +40,7 @@ struct _GdkFBKeyboard {
|
||||
gint io_tag;
|
||||
|
||||
guint modifier_state;
|
||||
gboolean caps_lock : 1;
|
||||
guint caps_lock : 1;
|
||||
|
||||
gint group;
|
||||
gint level;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user