mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-11 12:05:48 +01:00
Compare commits
630 Commits
release-0.
...
release-0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03befcf729 | ||
|
|
beb83f52fe | ||
|
|
99a5f0da0f | ||
|
|
520a6cd0e4 | ||
|
|
f968d88070 | ||
|
|
e1ed96951b | ||
|
|
41996df786 | ||
|
|
932fcd1f37 | ||
|
|
cefdc204ba | ||
|
|
6f28d987a8 | ||
|
|
c8b3933c19 | ||
|
|
4140e6051f | ||
|
|
f0664d1344 | ||
|
|
f4ef34b814 | ||
|
|
90c77b1a45 | ||
|
|
672c42cc48 | ||
|
|
739fd1a567 | ||
|
|
363290d919 | ||
|
|
235b4c6d25 | ||
|
|
bbc87bded6 | ||
|
|
81a1f98ca5 | ||
|
|
06b48596f5 | ||
|
|
0c4dc1c24a | ||
|
|
af287fb8eb | ||
|
|
7688a9f626 | ||
|
|
9f62c660d7 | ||
|
|
cc9abd6e7e | ||
|
|
72150b1da7 | ||
|
|
b1565d01c4 | ||
|
|
3b1961d40d | ||
|
|
d7ffd46d89 | ||
|
|
8cb297a671 | ||
|
|
4be9abcdbc | ||
|
|
75f790160b | ||
|
|
4350cf540c | ||
|
|
dc9b99fe47 | ||
|
|
1dcb477fde | ||
|
|
7213271249 | ||
|
|
727f3e0529 | ||
|
|
0321fad531 | ||
|
|
33cc542e85 | ||
|
|
8bb50a6320 | ||
|
|
558d0fbd14 | ||
|
|
2d6f757114 | ||
|
|
0bf92703da | ||
|
|
0c365cfb9b | ||
|
|
aedbe70f63 | ||
|
|
e0f7284142 | ||
|
|
abc09951e1 | ||
|
|
e9ce423d8c | ||
|
|
aae7c8b73a | ||
|
|
1cd42480bf | ||
|
|
e848fb0d74 | ||
|
|
680b9d7731 | ||
|
|
49e59ab367 | ||
|
|
5ef342d905 | ||
|
|
86f3e2fdb1 | ||
|
|
e44cc81a03 | ||
|
|
2d5a062064 | ||
|
|
44363ce805 | ||
|
|
acdc0e3d6b | ||
|
|
dd9e7d6816 | ||
|
|
5e6b9009a0 | ||
|
|
761f193b0a | ||
|
|
80fefd29e4 | ||
|
|
eecf75029f | ||
|
|
f3e53e8a67 | ||
|
|
9bfdc31051 | ||
|
|
554f2a6842 | ||
|
|
4a2ed2f09f | ||
|
|
0ee6312164 | ||
|
|
717392246a | ||
|
|
6b75506e52 | ||
|
|
92232f3a78 | ||
|
|
64b168083f | ||
|
|
fa994f627e | ||
|
|
0e2ac9dd16 | ||
|
|
0ee684f718 | ||
|
|
e825f57f20 | ||
|
|
a5f92da05c | ||
|
|
41d939e32f | ||
|
|
c1f19bc9f7 | ||
|
|
d052b5a90c | ||
|
|
5908962cac | ||
|
|
a1a6e2531d | ||
|
|
86c059db3b | ||
|
|
46e12bffb6 | ||
|
|
6c494f1a2e | ||
|
|
c28d3d3ff9 | ||
|
|
882b9a8e1c | ||
|
|
0931e14a5a | ||
|
|
c687b42960 | ||
|
|
d4097e11c9 | ||
|
|
8a6afcdcf6 | ||
|
|
3b00e8acaa | ||
|
|
271de3c9de | ||
|
|
d6feaa1c75 | ||
|
|
eb0e33e0f5 | ||
|
|
7e1f0e1e48 | ||
|
|
adfe32ea1f | ||
|
|
058079bb19 | ||
|
|
0156c6f92e | ||
|
|
3ab16b3e40 | ||
|
|
f955b4b61d | ||
|
|
3fcfc9bc16 | ||
|
|
128403b487 | ||
|
|
60611fbd47 | ||
|
|
7d64e19f5a | ||
|
|
a4486f0cd9 | ||
|
|
22ae4f5a3c | ||
|
|
bcf7358072 | ||
|
|
b444894d88 | ||
|
|
205b3f35b9 | ||
|
|
ab61c599f9 | ||
|
|
430c12e2b2 | ||
|
|
3208e193d7 | ||
|
|
7848a2d03f | ||
|
|
962d9407c1 | ||
|
|
cf9975125d | ||
|
|
28793346ab | ||
|
|
19b49b3fc1 | ||
|
|
ff5680d010 | ||
|
|
309a9163bd | ||
|
|
ddde229665 | ||
|
|
19ad865f49 | ||
|
|
41c0e64eac | ||
|
|
e826a4122e | ||
|
|
0616167b0f | ||
|
|
3bde6495a3 | ||
|
|
649a7ac82c | ||
|
|
86154ba01d | ||
|
|
2eb1f26644 | ||
|
|
4fb6cd1b1e | ||
|
|
36e46831e0 | ||
|
|
eb11184ef0 | ||
|
|
656a1c17e4 | ||
|
|
b061bf9832 | ||
|
|
ee49804d93 | ||
|
|
6a1c354d3f | ||
|
|
1ca5543ecb | ||
|
|
79def3b196 | ||
|
|
1e5ca9ae9f | ||
|
|
c03f50530d | ||
|
|
010ce93e92 | ||
|
|
6df4a38a50 | ||
|
|
fd4937cd97 | ||
|
|
648d75c299 | ||
|
|
03824d5324 | ||
|
|
829e9d30fe | ||
|
|
4341224f6e | ||
|
|
c3d2a890d7 | ||
|
|
10e7985961 | ||
|
|
9d1306bf01 | ||
|
|
5c37df521e | ||
|
|
79b17caa73 | ||
|
|
3300f79501 | ||
|
|
046403dbbb | ||
|
|
a41b8993e5 | ||
|
|
09f4b0d409 | ||
|
|
81ccbdc743 | ||
|
|
e0235bb61b | ||
|
|
9035122c5f | ||
|
|
6bbe6f2b9d | ||
|
|
7e8bff904f | ||
|
|
1a3fd2f795 | ||
|
|
80fb289fc9 | ||
|
|
5045cdbe60 | ||
|
|
726ba653cf | ||
|
|
1cdc0e4c06 | ||
|
|
8564f5e409 | ||
|
|
a719eb98f1 | ||
|
|
a8da38c431 | ||
|
|
bc3b44acaa | ||
|
|
f5dcab0663 | ||
|
|
dd9fd9f12a | ||
|
|
f91e2693f9 | ||
|
|
7f8d51555b | ||
|
|
c1840e943d | ||
|
|
3b7b2ef6b7 | ||
|
|
eab5ea31ea | ||
|
|
51b1bf34b9 | ||
|
|
b85df20ba2 | ||
|
|
ab641e7320 | ||
|
|
e3decb34cb | ||
|
|
f8e94406df | ||
|
|
77e1b7038b | ||
|
|
6dafb928fe | ||
|
|
34c2bb0f0e | ||
|
|
a00fb1b2cf | ||
|
|
607bbb7e3a | ||
|
|
012d995ab1 | ||
|
|
99defe80a5 | ||
|
|
1a1775bae0 | ||
|
|
c720860ed3 | ||
|
|
64defd4d22 | ||
|
|
054d7cc006 | ||
|
|
c7f5318a41 | ||
|
|
fc38d1ca16 | ||
|
|
9451aae632 | ||
|
|
ae9e955f10 | ||
|
|
f6a889910a | ||
|
|
ae52b2a437 | ||
|
|
d5ebb27e2d | ||
|
|
10972f2666 | ||
|
|
affcc3babd | ||
|
|
4521852297 | ||
|
|
58ed9abf8d | ||
|
|
6684492033 | ||
|
|
26799953c9 | ||
|
|
36ebcf1949 | ||
|
|
8d988e5eae | ||
|
|
e926227b3e | ||
|
|
315136991d | ||
|
|
57bc9c54f3 | ||
|
|
b04c4ea500 | ||
|
|
50e85f57f2 | ||
|
|
d9249dd99a | ||
|
|
870252297a | ||
|
|
07c9bb7d8d | ||
|
|
2172a4478e | ||
|
|
8f0d2f9e4b | ||
|
|
bc7d29d46e | ||
|
|
d06532cb3e | ||
|
|
61933ceaa4 | ||
|
|
7a491db6c1 | ||
|
|
0fae7d3e77 | ||
|
|
0667b39554 | ||
|
|
de7f00d474 | ||
|
|
14f2db1eb2 | ||
|
|
e4ce88e7f1 | ||
|
|
21ab029532 | ||
|
|
543a46659b | ||
|
|
05f2a74ef5 | ||
|
|
4d8e691608 | ||
|
|
40386e1d40 | ||
|
|
a1fb870fe8 | ||
|
|
9d88b14f59 | ||
|
|
f91f2eb173 | ||
|
|
15b720046b | ||
|
|
0502a80dc7 | ||
|
|
17ae285f37 | ||
|
|
4637c09d19 | ||
|
|
8b7930f6c9 | ||
|
|
25b82b5b8c | ||
|
|
2cf8c125a5 | ||
|
|
ff5afa20f2 | ||
|
|
617525a573 | ||
|
|
c4f147ef01 | ||
|
|
14e5cc8357 | ||
|
|
b21ad7ad2d | ||
|
|
8493be9734 | ||
|
|
070645e329 | ||
|
|
0bbbdcb92f | ||
|
|
714db5cb3a | ||
|
|
e0fbdaa15e | ||
|
|
f9778df784 | ||
|
|
a20aebdef2 | ||
|
|
6a3b06e609 | ||
|
|
bb886be82e | ||
|
|
1b587b01ee | ||
|
|
b4851afbb7 | ||
|
|
fea4c4c84e | ||
|
|
5c62197542 | ||
|
|
017f3e5e4f | ||
|
|
7d88519c75 | ||
|
|
a7ec9dab95 | ||
|
|
9a43af3d83 | ||
|
|
b6f543df77 | ||
|
|
61675a7e19 | ||
|
|
1b41d56ad0 | ||
|
|
bc25a31733 | ||
|
|
22eb14c9d5 | ||
|
|
35c5908565 | ||
|
|
8ed773a437 | ||
|
|
efb4aa5b74 | ||
|
|
85e601eabc | ||
|
|
2b9ffb0bdb | ||
|
|
2a67a96d86 | ||
|
|
7ab70f692f | ||
|
|
c6199adc29 | ||
|
|
e314838447 | ||
|
|
bb7314ddac | ||
|
|
ddf5fe3abe | ||
|
|
8fb5a4c7fe | ||
|
|
142db0ae2a | ||
|
|
2954c53d67 | ||
|
|
5475530205 | ||
|
|
a7d22c48b4 | ||
|
|
c6c0954767 | ||
|
|
8f1781cd4e | ||
|
|
0b9cfd7c8e | ||
|
|
1ac8c2a6ce | ||
|
|
3874f848c1 | ||
|
|
d9540f37bf | ||
|
|
f8c8382b1e | ||
|
|
068c5a94b1 | ||
|
|
83979b5f4c | ||
|
|
b08e5b1006 | ||
|
|
f1e5fdcf69 | ||
|
|
0d7b4d633b | ||
|
|
e99511b08c | ||
|
|
e3577222a7 | ||
|
|
abc1ef4ed9 | ||
|
|
9093cde817 | ||
|
|
a8ab51747d | ||
|
|
1876b4683a | ||
|
|
e78741ee4c | ||
|
|
c8da381337 | ||
|
|
f81d0f30de | ||
|
|
45869c37e0 | ||
|
|
ad4fd02247 | ||
|
|
4c60cd5ba4 | ||
|
|
f912d9f38d | ||
|
|
5e1e94efd6 | ||
|
|
37f811de3e | ||
|
|
210ff264b9 | ||
|
|
163e70bdae | ||
|
|
e541b9433b | ||
|
|
bc494d2c7b | ||
|
|
ecefdc6171 | ||
|
|
c11653f438 | ||
|
|
327d58346f | ||
|
|
14f471815d | ||
|
|
8ca4a67a24 | ||
|
|
2d063d279e | ||
|
|
57d9e81c2d | ||
|
|
0e34a7ae28 | ||
|
|
6ff939eb6e | ||
|
|
2574e2e56a | ||
|
|
f47f148f10 | ||
|
|
4e4f6f44e1 | ||
|
|
e186e99789 | ||
|
|
d8d9cc4b0f | ||
|
|
518fcb7cb9 | ||
|
|
aa280f3925 | ||
|
|
756ab2c019 | ||
|
|
83824dbcc3 | ||
|
|
5d0157cf7b | ||
|
|
762d37f1fb | ||
|
|
eac0eff3ba | ||
|
|
3a52326385 | ||
|
|
3fdb6a6f27 | ||
|
|
edcfd4a321 | ||
|
|
5e5730389f | ||
|
|
fa5af19285 | ||
|
|
d361ee2cc0 | ||
|
|
7aadc1ef00 | ||
|
|
932cfc1bd4 | ||
|
|
9b2ca26ce8 | ||
|
|
de969c0b5e | ||
|
|
1752587a4a | ||
|
|
867ed95485 | ||
|
|
331e85fd85 | ||
|
|
211ccf79f4 | ||
|
|
bb6182f4f7 | ||
|
|
1a754844bb | ||
|
|
4ec9827c4e | ||
|
|
1f22c07051 | ||
|
|
4eb26a0bd3 | ||
|
|
ad95610321 | ||
|
|
a9b75e03e2 | ||
|
|
80d5d196c1 | ||
|
|
9d44d6c177 | ||
|
|
527bbcf271 | ||
|
|
9a4037ebf1 | ||
|
|
6aafaaa63c | ||
|
|
8055698df0 | ||
|
|
9d98d884ae | ||
|
|
972620c7cd | ||
|
|
b0506c3737 | ||
|
|
9bd00e5cd2 | ||
|
|
816ce22875 | ||
|
|
899226207d | ||
|
|
2d20abd00e | ||
|
|
e4dbd1fe0d | ||
|
|
d7f924c5e7 | ||
|
|
2c5809c383 | ||
|
|
fad7c5d3ec | ||
|
|
b74fad4bd6 | ||
|
|
dc67e81437 | ||
|
|
29ceeb870d | ||
|
|
52308a0abc | ||
|
|
4d41658e1a | ||
|
|
bb9a2e7445 | ||
|
|
cd57646835 | ||
|
|
7d463ca48d | ||
|
|
b0dbbb3536 | ||
|
|
336e2c3678 | ||
|
|
d9d5a52200 | ||
|
|
1863d60e3a | ||
|
|
6bb9c58de1 | ||
|
|
47e4e31ba0 | ||
|
|
19160e8dfd | ||
|
|
366bf50d3c | ||
|
|
debd7ef5e8 | ||
|
|
77670119a1 | ||
|
|
e7ce6468fc | ||
|
|
f7b4e85525 | ||
|
|
d2decce5e7 | ||
|
|
a1dc24bab1 | ||
|
|
d00e72bc45 | ||
|
|
731656cbed | ||
|
|
857b56c502 | ||
|
|
902e985a53 | ||
|
|
fae5a42f65 | ||
|
|
3ad4bf5ad8 | ||
|
|
54a46fa513 | ||
|
|
decf2571a8 | ||
|
|
5f746a3efa | ||
|
|
a81a0685ef | ||
|
|
2bd2b72af9 | ||
|
|
1a8c578a1c | ||
|
|
d40425c388 | ||
|
|
84ba62ba6b | ||
|
|
a20c49b80f | ||
|
|
497e34b6b8 | ||
|
|
581ab58f70 | ||
|
|
9903bf9ca8 | ||
|
|
af5e3da105 | ||
|
|
b1baf21532 | ||
|
|
99ce8b2d85 | ||
|
|
e215328d81 | ||
|
|
172da48a60 | ||
|
|
9b0e0c6c54 | ||
|
|
2bc40c47eb | ||
|
|
275a2a3782 | ||
|
|
bdaacb6daa | ||
|
|
88ed406e08 | ||
|
|
6fd8101b73 | ||
|
|
bba6dd1670 | ||
|
|
ed39c92de0 | ||
|
|
b24b51b514 | ||
|
|
eeda795db1 | ||
|
|
c7a0cd924e | ||
|
|
399439d338 | ||
|
|
7cf93ae49d | ||
|
|
de99155948 | ||
|
|
b2478b634f | ||
|
|
6de1c41865 | ||
|
|
e4d59476c7 | ||
|
|
56ff625a5c | ||
|
|
dae28629bb | ||
|
|
8ae0b5cc1d | ||
|
|
7350f7826d | ||
|
|
d892cd0ea1 | ||
|
|
1d0a374bd4 | ||
|
|
dde0b00fe5 | ||
|
|
4fd5e0cad1 | ||
|
|
cd6639ccc7 | ||
|
|
e3fa161340 | ||
|
|
12c26a1cc5 | ||
|
|
94b17e2d15 | ||
|
|
81f5124cec | ||
|
|
770c3507ed | ||
|
|
67642b7c20 | ||
|
|
358e3346c3 | ||
|
|
aee58cbd36 | ||
|
|
539fb32795 | ||
|
|
60a01b0f58 | ||
|
|
bb8065ebc9 | ||
|
|
44fd05f1c3 | ||
|
|
8382063736 | ||
|
|
6973f07f30 | ||
|
|
df357ae1de | ||
|
|
3de3009cee | ||
|
|
ce8b816c5d | ||
|
|
4193d2265d | ||
|
|
7b3c10b07d | ||
|
|
edc57cf7a1 | ||
|
|
8cbe55ade1 | ||
|
|
4acd090c54 | ||
|
|
9c9f7e6c0c | ||
|
|
53a65d5bf8 | ||
|
|
82168fcc3b | ||
|
|
065d86f9c5 | ||
|
|
7f74ea8081 | ||
|
|
23ac6cc088 | ||
|
|
3b9b020c5c | ||
|
|
ccbb6e8e15 | ||
|
|
41ff127444 | ||
|
|
18b7dcc2b0 | ||
|
|
6760c39881 | ||
|
|
7e3f885aa4 | ||
|
|
40e67dfce0 | ||
|
|
ac4997e739 | ||
|
|
a3cd52ba05 | ||
|
|
c1a77f233f | ||
|
|
468f578345 | ||
|
|
85702115f3 | ||
|
|
3be86a5778 | ||
|
|
9f98db6791 | ||
|
|
e01ef57d4b | ||
|
|
595d2b060b | ||
|
|
446e260186 | ||
|
|
275aacc237 | ||
|
|
7832b2a4cf | ||
|
|
4ad4480c55 | ||
|
|
01332a48c6 | ||
|
|
d412240200 | ||
|
|
cc3bbcaf4c | ||
|
|
f813ff12d4 | ||
|
|
d157320dfb | ||
|
|
8c35d57144 | ||
|
|
5652f7b7cd | ||
|
|
07a7632a96 | ||
|
|
c79c8aa74d | ||
|
|
70f8f029b1 | ||
|
|
ab7c77b07d | ||
|
|
dbbddf95e2 | ||
|
|
ec6dce9c42 | ||
|
|
6ec980095a | ||
|
|
1a7c397d57 | ||
|
|
ca837d793f | ||
|
|
c08d8df66e | ||
|
|
ce7db48e25 | ||
|
|
ee0fa6ec7d | ||
|
|
802493b7e6 | ||
|
|
2f68b51290 | ||
|
|
6f0d835bdb | ||
|
|
9a89e6cc18 | ||
|
|
dcd44b17b1 | ||
|
|
2dd7218dfa | ||
|
|
b3dee733bb | ||
|
|
bb6acdad3c | ||
|
|
6d5f1817d3 | ||
|
|
12f03e5ac4 | ||
|
|
d3d0304107 | ||
|
|
1027573bd7 | ||
|
|
e958044d00 | ||
|
|
e29fce43b1 | ||
|
|
4cb5649545 | ||
|
|
fcab535c38 | ||
|
|
b50d6e566c | ||
|
|
19a92de3e6 | ||
|
|
72538ed380 | ||
|
|
f0921472a8 | ||
|
|
165b96f30f | ||
|
|
9d4dae947b | ||
|
|
c87c53fbe5 | ||
|
|
4f3c453c12 | ||
|
|
6de30498da | ||
|
|
6f912eded3 | ||
|
|
738c72324b | ||
|
|
ab801f3141 | ||
|
|
4905ab1986 | ||
|
|
c49ad9cac8 | ||
|
|
e410e1862b | ||
|
|
4b2b2bcac3 | ||
|
|
61b169f497 | ||
|
|
ebf002b8d5 | ||
|
|
983e154118 | ||
|
|
15f9713a84 | ||
|
|
d869445950 | ||
|
|
9e7242abe5 | ||
|
|
56cacb9336 | ||
|
|
3e0c6920a9 | ||
|
|
d4c23fba79 | ||
|
|
05339d0d63 | ||
|
|
e44130b51a | ||
|
|
58b36ec1b3 | ||
|
|
79ae37a35c | ||
|
|
6947fd7b64 | ||
|
|
1e351cb59b | ||
|
|
71f735069a | ||
|
|
e7771be157 | ||
|
|
16949246ee | ||
|
|
cdb148df48 | ||
|
|
0ae1ecc05f | ||
|
|
139b34c7af | ||
|
|
27838589a5 | ||
|
|
886e65f83e | ||
|
|
1e519308d3 | ||
|
|
5852c7506f | ||
|
|
f3ed042f0c | ||
|
|
3b28027dce | ||
|
|
badfd68aef | ||
|
|
cf3bb1fd0e | ||
|
|
74bbc24da2 | ||
|
|
a6e19eed31 | ||
|
|
fbc2c75c8a | ||
|
|
5c76167098 | ||
|
|
b188d55bbe | ||
|
|
e222ba21bc | ||
|
|
c5f05b2815 | ||
|
|
51a638e821 | ||
|
|
ccd419500f | ||
|
|
5d855a167a | ||
|
|
b5c565d21b | ||
|
|
9aa1d138a6 | ||
|
|
c08022a088 | ||
|
|
779cdb0dd4 | ||
|
|
27e161cea4 | ||
|
|
b37b0fd9f1 | ||
|
|
0fd531df43 | ||
|
|
b8ca9e2b64 | ||
|
|
0b87b7fab9 | ||
|
|
bdd5d5342b | ||
|
|
3e7eb14a22 | ||
|
|
fa9bfc9794 | ||
|
|
caa86529a9 | ||
|
|
6b93946309 | ||
|
|
af3f33ecb9 | ||
|
|
11bf9c8038 | ||
|
|
8ccb875468 | ||
|
|
760c552584 | ||
|
|
2c0fdba09e | ||
|
|
2905590520 | ||
|
|
d912ddd743 | ||
|
|
567e53c67c | ||
|
|
60a247f271 | ||
|
|
a5f7e65111 | ||
|
|
cc22ef1f20 | ||
|
|
97afbce72e | ||
|
|
47e33ab485 | ||
|
|
2c16005643 | ||
|
|
ee21c5bea6 | ||
|
|
fc2a87c645 | ||
|
|
379df781b2 | ||
|
|
449a5fde76 | ||
|
|
ead4f5d3e1 | ||
|
|
8c69765725 | ||
|
|
0c010ba778 | ||
|
|
32160ff66f | ||
|
|
e7f7030e1b | ||
|
|
5b05c9607c | ||
|
|
036086daa4 | ||
|
|
7ab059a165 | ||
|
|
e3b9e3917a | ||
|
|
58e0b92fe2 | ||
|
|
cf65d791ab |
@@ -4,3 +4,4 @@ configure config.log config.cache config.guess config.status config.sub
|
||||
libtool ltconfig ltmain.sh
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
update update-autoconf
|
||||
|
||||
6
.cvsnotify
Normal file
6
.cvsnotify
Normal file
@@ -0,0 +1,6 @@
|
||||
#
|
||||
# You can add here extra email addresses (one per line) where notifications
|
||||
# should be sent on cvs commit.
|
||||
# This is easier than to modify CVSROOT/loginfo to add extra addresses there.
|
||||
# Lines that start with # or empty lines are ignored.
|
||||
#
|
||||
10
AUTHORS
10
AUTHORS
@@ -68,6 +68,9 @@ Various bugfixes
|
||||
Ullrich Hafner <hafner@bigfoot.de>
|
||||
Better detection of gfx libraries, added IconTitleColor/IconTitleBack
|
||||
|
||||
Matthew Hawkins <matt@mh.dropbear.id.au>
|
||||
former temporary project maintainer
|
||||
|
||||
Greg Hayes <sdc@choice.net>
|
||||
Twisted miniaturization animation
|
||||
|
||||
@@ -102,10 +105,13 @@ EMACS/keypad like cursor movement for WINGs textfield
|
||||
Jim Knoble <jmknoble@pobox.com>
|
||||
made autoarrange icons a runtime option, SHADOW_RESIZEBAR c-time option,
|
||||
no workspace switch to the same workspace, dashed icon selection,
|
||||
misclellaneous bug fixes, definable cursors..
|
||||
misclellaneous bug fixes, definable cursors, --no-polling command line option.
|
||||
|
||||
The JED Text Editor <xjed@windowmaker.org>
|
||||
Project maintainer
|
||||
|
||||
Alfredo K. Kojima <kojima@windowmaker.org>
|
||||
Project maintainer
|
||||
The guy who types random keys to feed JED with the necessary entropy
|
||||
|
||||
Jay Kominek <jkominek@xtn.net>
|
||||
smart and random placement
|
||||
|
||||
265
ChangeLog
265
ChangeLog
@@ -1,3 +1,268 @@
|
||||
Changes since version 0.70.0:
|
||||
.............................
|
||||
|
||||
- Disabled window birth animation by default (while it was ok with normal
|
||||
windows, it was very annoying with menus editing in WPrefs.app)
|
||||
- Added ability to shade/unshade a window using the mouse wheel.
|
||||
- Fixed compilation for systems that required -lintl for WINGs
|
||||
(Jim Knoble <jmknoble@pobox.com>)
|
||||
- Removed redundant include/lib paths from the get-*-flags scripts
|
||||
- Updated slovak .po files (Jan Tomka <judas@linux.sk>)
|
||||
- Added "Save workspace state" switch button on the exit confirmation panel
|
||||
(based on a patch sent by Jan Tomka <judas@linux.sk>)
|
||||
- Fixed WPrefs crash when clicking on the menu editor to keep the current menu
|
||||
(Alexey Voinov <voins@voins.program.ru>)
|
||||
- Added patch to fix some gnome issues (Les Schaffer <schaffer@optonline.net>)
|
||||
- SIGTERM is now handled and saves the internal state before exiting (like
|
||||
SIGHUP and SIGINT already do). Now a "kill wmaker_pid" will exit cleanly
|
||||
saving dock/clip/session information on exit.
|
||||
- Added an internal strcasecmp() to WINGs (only on systems where's not present)
|
||||
- Deminiaturizing a window that is also shaded, will perform an unshade too.
|
||||
(Note that this only applies to deminiaturizing shaded windows. Unhiding
|
||||
an application will keep the shaded/unshaded state of windows.)
|
||||
- Removed compile time option for definable cursors and made them available by
|
||||
default.
|
||||
- Mapping a new window that belongs to a running application that is hidden,
|
||||
will unhide the application.
|
||||
- Removed the collapse appicons thing.
|
||||
- Added real appicon sharing (apps of the same kind will have a single shared
|
||||
appicon).
|
||||
- Fixed user and global defaults domain merging to preserve values present in
|
||||
global but not in user, in sub-dictionaries.
|
||||
- Made dock/clip steal appicons of applications that were started from a
|
||||
shell/xterm or from the main menu, if there is a docked appicon of that
|
||||
class that is not running at the time the app is launched.
|
||||
- Added animation to show that the appicon was stolen by the dock (the way
|
||||
NEXTSTEP did - map an appicon as it normally would have been, then slide it
|
||||
to the position the docked appicon is).
|
||||
- Updated the animation constants for scrolling/sliding/shading to better
|
||||
adapt to newer/faster machines. Also used wusleep(10) when the delay was 0
|
||||
to get rid of the jerky animation when there was no delay.
|
||||
- Fixed bug with Unhide mapping windows from other workspaces.
|
||||
- Saving a domain file will first strip all entries that are also present in
|
||||
the global domain as well and are exactly the same. This fixes a bug where
|
||||
settings from the global domain file were merged in the user domain file
|
||||
and further changes in the global domain file for those merged values was
|
||||
ignored making a system admin unable to set global defaults for all users
|
||||
using the global domains.
|
||||
- Fixed bug with improper setting of root/titlebar cursor (definable cursors).
|
||||
|
||||
|
||||
Changes since version 0.65.1:
|
||||
.............................
|
||||
|
||||
- fixed crash when saving empty menu item in WPrefs
|
||||
- Fixed some more bash specific constructs in wsetfont.
|
||||
(Marcelo E. Magallon <marcelo.magallon@bigfoot.com>)
|
||||
- fixed crash with broken apps that set null WM_CLASS
|
||||
- fixed crash when with gnome panel and multi-screens, some menu
|
||||
updates and applied various other patches from
|
||||
(Crutcher Dunnavant <crutcher@redhat.com>)
|
||||
- po file fixes (Crutcher Dunnavant <crutcher@redhat.com>)
|
||||
- replaced I18N_MB with I18N in one place in src/wconfig.h.in
|
||||
- fixed default clip title font in WindowMaker.in
|
||||
- fixed some locale related problems (Yukihiro Nakai <ynakai@redhat.com>)
|
||||
- fixed a bug in RCombineAreaWithOpaqueness() (Brad <lists@anomie.yi.org>)
|
||||
- added spanish INSTALL file (Efrain Maximiliano Palermo <max_drake2001@yahoo.com.ar>)
|
||||
- updated Finnish pots (Tomi Kajala <tomi@iki.fi>)
|
||||
- copy/paste launching in Dock
|
||||
- fixed bug in positioning of window list menu when opened by kbd
|
||||
- internal code clean-up with notifications for window state change and other
|
||||
stuff
|
||||
- added snprintf implementation for systems that don't have this function
|
||||
- removed the libPropList dependancy by adding property list handling
|
||||
code to WINGs. This code is not only better integrated with the other
|
||||
WINGs data structures, but it's also more robust. Also a backward
|
||||
compatibility header file is provided which maps old libPropList
|
||||
function names to the new WINGs based proplist names allowing old code
|
||||
to be linked to WINGs with minimal changes. For details on how to use
|
||||
the compat mode, read the comments on top of WINGs/WINGs/proplist-compat.h
|
||||
More details about this can be found in WINGs/ChangeLog and WINGs/NEWS.
|
||||
Say bye, bye libPropList =)
|
||||
- rewrote all Window Maker code to use the new WINGs based proplist functions.
|
||||
- fixed a few compilation warnings and a problem caused by an uninitialized
|
||||
variable.
|
||||
|
||||
|
||||
Changes since version 0.65.0:
|
||||
.............................
|
||||
|
||||
- removed FocusFollowMouse from wmaker and WPrefs
|
||||
- fixed problem with alpha images showing a blue tint on big endian machines
|
||||
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
|
||||
related error when text was selected in a textfiled (including WPrefs.app
|
||||
and Window Maker itself).
|
||||
- fixed bug with maximization of windows with fixed resize increments
|
||||
- added None geometry display type
|
||||
- fixed window enumeration bug
|
||||
- removed GNUisms from wsetfont (Marcelo E. Magallon <marcelo.magallon@bigfoot.com>, Masahide -mac- NODA <mac@clave.gr.jp>)
|
||||
- added slovakian translations from (tomka@oalevice.sk)
|
||||
- added WINGs i18n patch from tomka@oalevice.sk
|
||||
- fixed wmsetbg.c to work in servers capable of multiple depths (overlay)
|
||||
- added HMaximizeKey (Ruda Moura <ruda@conectiva.com.br>)
|
||||
- fixed bad SIGPIPE handling setup across forks (Philippe Troin <phil@fifi.org>)
|
||||
- added workaround for bug in locale handling on font set creation (Seiichi SATO <sato@cvs-net.co.jp>)
|
||||
- Fixed some non-portable shell constructs used in installed scripts
|
||||
(Johnny C. Lam <lamj@stat.cmu.edu>)
|
||||
- Fixed crash with long titles in the window list menu (buffer overflow)
|
||||
(Alban Hertroys <dalroi@wit401310.student.utwente.nl>, reported by
|
||||
Robert Marshall <robert@chezmarshall.freeserve.co.uk>)
|
||||
- Replaced almost all sprintf() calls with snprintf()
|
||||
- fixed crash when removing menu entry for Window List or Workspace submenu
|
||||
- added WINDOW_BIRTH_ZOOM2 (Éric Tremblay <delt@razorback.yi.org>)
|
||||
|
||||
Changes since version 0.64.0:
|
||||
.............................
|
||||
- fix with gnome hints stuff, related to tasklist/bar
|
||||
- ripped off single appicon stuff
|
||||
- added better appicon handling of apps of the same type
|
||||
- applied patch for wkdemenu (Malcolm Cowe <malk@bruhaha.co.uk>)
|
||||
- added WINDOWS_MENU submenu type for root menu (Bastien Nocera <hadess@hadess.net>)
|
||||
- added kbd shortcuts for icon chooser
|
||||
- use Hermes in wrlib
|
||||
- removed MOUSE_WS_WHEEL #defines
|
||||
- fixed bug with multibyte text on libc5 systems (Osamu Ajiki <osam-a@astroarts.co.jp>)
|
||||
- fixed race conditions on signal handlers
|
||||
- SIGINT will gently exit, SIGTERM will not be handled
|
||||
- When Window Maker calls wmsetbg to set the background, it will consider the
|
||||
value of the DisableDithering option and pass the right switch to wmsetbg.
|
||||
- fixed a memleak in the dialog panels.
|
||||
- made "Keep on Top" in the dock/clip menu a checked menu entry. It's _much_
|
||||
easier to work with it this way.
|
||||
- Fixed problem with GNOME apps that have windows which need to stay on the
|
||||
desktop level.
|
||||
- Fixed incorrect parsing of display and screen number from $DISPLAY.
|
||||
- Organized the inspector panel a bit better.
|
||||
- Replaced bags with arrays wherever appropriate. This will improve
|
||||
performance a bit.
|
||||
- Made the Gnome tasklist skip the windows with the "Skip window list" flag
|
||||
enabled. (Bastien Nocera <hadess@hadess.net>)
|
||||
- Fixed crashing bug when name and class were empty for a docked app.
|
||||
- Removed MIN() and MAX() macros and replaced them with WMIN() and WMAX() from
|
||||
WINGs.
|
||||
- Added a hint that Window Maker crashed, to allow windows to be placed
|
||||
correctly after a crash situation.
|
||||
- Added a hint that Window Maker crashed, to allow windows to be placed
|
||||
in their correct previous positions after a crash situation and also to
|
||||
preserve their state before the crash (minimized, shaded, hidden, ...)
|
||||
- Fixed wrong mapping position of the "Docked Applications Panel" for some
|
||||
icons.
|
||||
- Smoother animation for the smiley =)
|
||||
- Added retain/release mechanism for RImages. RDestroyImage() has become
|
||||
obsolete. More about this can be found in wrlib/Changelog and wrlib/NEWS.
|
||||
- Small API change in WINGs to allow images with alpha blending set as the
|
||||
application icons be shown correctly. More about this in WINGs/Changelog
|
||||
and WINGs/NEWS.
|
||||
- Made images with alpha blending be shown correctly in the panels and the
|
||||
icon chooser.
|
||||
- The icon image set to be shown in panels ("Logo.WMPanel") will be
|
||||
automatically updated if its entry in WMWindowAttributes changes (without
|
||||
a need to restart as until now).
|
||||
- Fixed a bug in the icon chooser dialog that made the selected icon look
|
||||
wrong if it had alpha blending.
|
||||
- Removed the following 3 options from configuration: SelectWindowsMouseButton,
|
||||
WindowListMouseButton and ApplicationMenuMouseButton.
|
||||
- Added 4 options to the configuration file for binding workspace actions to
|
||||
mouse buttons: MouseLeftButtonAction, MouseMiddleButtonAction,
|
||||
MouseRightButtonAction and MouseWheelAction. They replace the above 3
|
||||
removed options, but use a different semantic. More in NEWS.
|
||||
- client supplied icons that were saved by Window Maker in the directory
|
||||
~/GNUstep/.AppInfo/WindowMaker/ will be recreated if missing when the
|
||||
application starts.
|
||||
- fixed a small memleak when the client supplied icon was extracted and saved.
|
||||
|
||||
|
||||
Changes since version 0.63.1:
|
||||
.............................
|
||||
- fixed messup in get-{wings,wutil,wraster}-flags
|
||||
- fixed #wmdatadir# substitution in wmaker.inst
|
||||
(Seiichi SATO <sato@cvs-net.co.jp>)
|
||||
- Removed spurious focus disabling for GNUstep applications - but retain
|
||||
code that lets GNUstep apps control their window titlebar.
|
||||
(Richard Frith-Macdonald <rfm@gnu.org>)
|
||||
- Fixed broken panels.
|
||||
- Renamed se.po to sv.po
|
||||
- New version of wkdemenu.pl (from Malcolm Cowe <malk@bruhaha.co.uk>)
|
||||
- new updated Slovak translations (Jan Tomka/judas@hell <tomka@oalevice.sk>)
|
||||
- integrated the 'no polling' patch from Jim Knoble <jmknoble@jmknoble.cx>.
|
||||
- new wsetfont script (Anton Zinoviev <zinoviev@debian.org>)
|
||||
- lots of i18n fixes (Jan Tomka/judas@hell <tomka@oalevice.sk>)
|
||||
- window levels changed to match GNUstep <rfm@gnu.org> ... src/GNUstep.h
|
||||
src/WindowMaker.h src/window.c wmlib/WMaker.h WINGs/WINGs/WINGs.h
|
||||
|
||||
|
||||
Changes since version 0.63.0:
|
||||
.............................
|
||||
- fixed compile prob with SGI compiler
|
||||
- decreased nice() value in wmsetbg
|
||||
- applied gnome panel not-covering patch from (Bastien Nocera <hadess@hadess.net>)
|
||||
- added item copy to WPrefs menu editor
|
||||
- added locale selection code for menu in wmaker.inst (Eliphas Levy Theodoro <eliphas@conectiva.com.br>)
|
||||
- fixed bug in built-in xpm support (Alessandro Strada <a.strada@libero.it>)
|
||||
- removed plugin support
|
||||
- fixed a crash bug in WPrefs menu editor
|
||||
- added es and pt potfiles from conectiva/eliphas
|
||||
- added updated galician potfile (Jesus Bravo Alvarez <jba@pobox.com>)
|
||||
- added update hungarian potfiles (HORVATH Szabolcs <horvaths@inf.elte.hu>)
|
||||
- added updated single-click patch from John Morrissey <jwm@horde.net>
|
||||
- added updated danish translations (Birger Langkjer <birger.langkjer@image.dk>)
|
||||
- fixed WindozeCycling config in WPrefs
|
||||
- fixed circulate raise withour WindozeCycling
|
||||
|
||||
|
||||
Changes since version 0.62.1:
|
||||
.............................
|
||||
- added blackbox style igradient (interwoven)
|
||||
- added wmagnify utility
|
||||
- changed behaviour of control/shift double click on titlebar for maximize
|
||||
- updated getstyle to account for extendspace options
|
||||
- fixed weird color bug in jpeg loader
|
||||
(Alban Hertroys <dalroi@wit401310.student.utwente.nl>)
|
||||
- improved and simplified fonts configuration for multibyte languages
|
||||
(Tomohiro KUBOTA <kubota@debian.or.jp>)
|
||||
- cleaned ParseCommand() and renamed to TokenizeString()
|
||||
- rewrote menu editor in WPrefs
|
||||
- added definable workspace border (0..5 pixels). See NEWS.
|
||||
- fixed circulateraise on non-windoze cycling mode
|
||||
- fixed bug in RCombineAreaWithOpaqueness (Tim Malone <tmalone3@uswest.net>)
|
||||
- fixed bug with hangling of WM_COMMAND update in client.c (Andrew M. Langmead <aml@world.std.com>)
|
||||
- fixed bug with incorrect reading of ppm files (Adam Fedor <fedor@gnu.org>)
|
||||
- fixed bug with incorrect window placement using automatic placement, while
|
||||
there were shaded windows on other workspaces
|
||||
- fixed some buffer overflow issues in WINGs
|
||||
- fixed bug with WPrefs.app not selecting the menu appearance options after
|
||||
startup.
|
||||
- replaced free() with wfree() wherever appropriate
|
||||
- fixed some memory leaks generated by wstrappend()
|
||||
- fixed code that was dependant on the order of evaluation in wrlib. This
|
||||
fixed a number of problems, like greyscale jpegs that showed up in red
|
||||
and possibly the problems with pseudocolor displays.
|
||||
- made clicks on unfocused windows be effective on focus follow mouse/sloppy
|
||||
|
||||
|
||||
Changes since version 0.62.0:
|
||||
.............................
|
||||
- made shortcuts available during alt+tab
|
||||
- save lowered state of menus
|
||||
- fixed portability bugs for old X servers
|
||||
- added check for XInternAtoms in configure and replacement code
|
||||
- fixed window cycling with single key shortcut
|
||||
- fixed WPrefs crash on menu editor
|
||||
- install only needed icons for WPrefs.app
|
||||
- updated Finnish translations
|
||||
- fixed user-whining-windoze-cycling bug
|
||||
- added option for f'n windoze cycling..
|
||||
- added --create-stdcmap and made std colormap creation off by default
|
||||
- updated get/setstyle to account for new options
|
||||
- fixed crash on restart bug
|
||||
- made GNOME wm hints take precedence over KDE.. KDE hint will only be read
|
||||
if GNOME hints dont exist
|
||||
- updated kwm hint support (maximize hint)
|
||||
- added memory usage in info panel
|
||||
- fixed sticky hint handling in GNOME
|
||||
- fixed saving of maximized state for restart
|
||||
|
||||
|
||||
Changes since version 0.61.1:
|
||||
.............................
|
||||
|
||||
|
||||
11
FAQ
11
FAQ
@@ -234,14 +234,11 @@ inside the WindowMaker directory.
|
||||
Installation:
|
||||
-=-=-=-=-=-=-
|
||||
|
||||
2.1 Where can I get proplist.h?
|
||||
-------------------------------
|
||||
You didn't read the INSTALL file, did you? Please read that now.
|
||||
libPropList is downloaded seperately and you need to install it _before_
|
||||
attempting to configure Window Maker.
|
||||
2.1 Where can I get libPropList/proplist.h?
|
||||
-------------------------------------------
|
||||
starting with Window Maker 0.70.0, libPropList is no longer needed.
|
||||
It was obsoleted by adding property list handling code to the WINGs library.
|
||||
|
||||
You can find a gzipped tar archive of libPropList at
|
||||
ftp://ftp.windowmaker.org/pub/libs/
|
||||
|
||||
|
||||
2.2 Why do no icons show up after installing Window Maker >= 0.15.x
|
||||
|
||||
61
FAQ.I18N.sk
Normal file
61
FAQ.I18N.sk
Normal file
@@ -0,0 +1,61 @@
|
||||
(Toto je len preklad dosť starého súboru! Ak by ste mali skutočne problémy
|
||||
s Window Makerom a slovenčinou a v tomto súbore by ste nenašli pomoc,
|
||||
pošlite popis problému na adresu <judas@linux.sk>.)
|
||||
|
||||
Ak vám nefunguje podpora miestnych nastavení, skontrolujte nasledujúce:
|
||||
|
||||
- premenná LANG je nastavená na vaše miestne nastavenia a tieto
|
||||
sú podporované vašim OS alebo X emuláciou. Zoznam podporovaných
|
||||
miestnych nastavení získate príkazom "locale -a". Zoznam
|
||||
miestnych nastvení podporovaných X emuláciou sa nachádza v
|
||||
súbore "/usr/X11R6/lib/X11/locale/locale.alias".
|
||||
|
||||
- používate správne fonty pre svoje miestne nastavenia. Ak
|
||||
používate font s odlišným kódovaním ako je nastavené v Xlib
|
||||
alebo libc, môžu sa diať čudné veci. Skúste explicitne zadať
|
||||
kókovanie do premennej LANG, teda sk_SK.ISO-8859-2. Znovu,
|
||||
pozrite si súbor "/usr/X11R6/lib/X11/locale/locale.aliax".
|
||||
|
||||
- ak váš OS nepodporuje žiadne miestne nastavenia alebo váš OS
|
||||
nepodporuje vaše miestne nastavenia, môžete použiť emuláciu
|
||||
podpory miestnych nastavení X Window Systému. To urobíte
|
||||
voľbou "--with-x-locale" skriptu configure. Ak používate
|
||||
komerčný OS ako Solaris, IRIX, AIX, ..., pravdepodobne
|
||||
nepotrebujete použiť X emuláciu miestnych nastavení. Ale ak
|
||||
je váš OS Linux alebo NetBSD alebo ..., je možné, že vaše
|
||||
miestne nastavenia ešte nie sú podporované. Vtedy použite
|
||||
"--with-x-locale".
|
||||
|
||||
Pozor: aby ste mohli používať X emuláciu miestnych nastvení,
|
||||
vaša Xlib musí byť skompilovaná s touto podporou.
|
||||
Xlib v Linux RedHat5.0 tak skompilovaná nie je.
|
||||
(RH4.x je v poriadku). Prekompilovaná Xlib pre
|
||||
RH5.0 s podporou emulácie miestnych nastavení je
|
||||
dostupná na adrese
|
||||
|
||||
ftp://ftp.linux.or.jp/pub/RPM/glibc
|
||||
|
||||
- ak chcete zobrazovať multibyte znaky, nastavte možnosť
|
||||
MultiByteText YES v ~/GNUstep/Defaults/WindowMaker a
|
||||
~/GNUstep/Defaults/WMGLOBAL
|
||||
|
||||
- fonty, ktoré používate, podporujú vaše miesne nastavenia.
|
||||
Ak vaše nastavenia fontov v ~/GNUstep/Defaults/WindowMaker
|
||||
vyzerajú takto:
|
||||
|
||||
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*";
|
||||
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*-*-*-*-*-*-*";
|
||||
......................................................
|
||||
|
||||
potom nemôžete zobrazovať znaky iné ako iso8859-x vo fonte
|
||||
helvetica. Jednoduchý spôsob ako zobrazovať znaky rôznych
|
||||
jazykov je nastaviť všetky fonty takto:
|
||||
|
||||
"-*-*-medium-r-normal-*-14-*-*-*-*-*-*-*"
|
||||
|
||||
a tiež potrebujete zmeniť nastavenia fontov v súboroch štýlov
|
||||
v adresári ~/Library/WindowMaker/Style.
|
||||
|
||||
- premenná LC_CTYPE nie je nastavená alebo má správnu hodnotu. Ak
|
||||
si nie ste istí, nenastavujte ju.
|
||||
|
||||
114
INSTALL
114
INSTALL
@@ -7,7 +7,9 @@ SUPPORTED PLATFORMS
|
||||
===================
|
||||
(ie: I've heard someone has compiled it on...)
|
||||
|
||||
- Intel GNU/Linux Slackware 3.5 (primary platform)
|
||||
- Intel GNU/Linux Conectiva 5.9 (beta)
|
||||
- Intel GNU/Linux Slackware
|
||||
- Intel GNU/Linux Debian
|
||||
- Intel GNU/Linux other distributions
|
||||
- Sparc GNU/Linux RedHat 5.1
|
||||
- PowerPC GNU/MkLinux
|
||||
@@ -19,6 +21,7 @@ SUPPORTED PLATFORMS
|
||||
- Solaris 2.5.1, 2.5.2
|
||||
- Solaris 2.6.0
|
||||
- Solaris 2.7beta
|
||||
- Solaris 2.8 on Ultra Sparc 10 and E450
|
||||
- SCO Unix
|
||||
- SGI Irix 5.x, 6.5
|
||||
- OSF/1
|
||||
@@ -34,12 +37,16 @@ SUPPORTED PLATFORMS
|
||||
- SunOS 4.x
|
||||
- PowerMac / Power MachTen 4.1.1 over MacOS
|
||||
- Amiga 3000 running RedHat Linux 5.1 (Rawhide)
|
||||
- IBM S/390 running Linux
|
||||
- IBM S/390 running Conectiva Linux (experimental)
|
||||
- iBook running Darwin
|
||||
- Windows NT with Cygwin/XFree86
|
||||
- Sony PlayStation2 running Linux
|
||||
|
||||
All registered trademarks are registered by their owners. (duh)
|
||||
|
||||
Patches to make it work on other platforms are welcome.
|
||||
|
||||
If the latest version doesn't work for you, try 0.19.3,
|
||||
which is known to be pretty stable on many platforms.
|
||||
|
||||
|
||||
REQUIREMENTS:
|
||||
=============
|
||||
@@ -62,11 +69,6 @@ The following is required to build Window Maker:
|
||||
and the gcc suite. Otherwise you won't be able to build any X
|
||||
program, including Window Maker.
|
||||
|
||||
- libPropList
|
||||
This library can be found in ftp://ftp.windowmaker.org/pub/libs
|
||||
or in ftp://ftp.gnome.org/pub/libPropList
|
||||
Install it before building Window Maker.
|
||||
|
||||
- autoconf, automake and libtool
|
||||
These tools are NOT needed, but IF you have one or
|
||||
more of them installed, make sure you have ALL of the following
|
||||
@@ -79,12 +81,6 @@ The following is required to build Window Maker:
|
||||
system. If you don't develop software you don't need them,
|
||||
so you can safely uninstall.
|
||||
|
||||
- lex (or flex) and yacc (or bison)
|
||||
These are used by libPropList. lex is actually not needed since
|
||||
it's output file is included, but either me or automake is stupid,
|
||||
causing the configure script for libPropList to simply abort for no
|
||||
convincent reason if lex is not found.
|
||||
|
||||
|
||||
OPTIONAL:
|
||||
=========
|
||||
@@ -118,6 +114,11 @@ might work too.
|
||||
For GIF image support
|
||||
ftp://prtr-13.ucsc.edu/pub/libungif/
|
||||
|
||||
- libHermes 1.3.2 or newer
|
||||
For faster pixel conversion in the wraster library
|
||||
(its used only in some conversions - for TrueColor visuals)
|
||||
http://www.clanlib.org/hermes/
|
||||
|
||||
- GNU xgettext
|
||||
If you want to use translated messages, you will need GNU gettext.
|
||||
Other versions of gettext are not compatible and will not work.
|
||||
@@ -205,16 +206,50 @@ To get a list of other options, run ./configure --help
|
||||
--disable-shape
|
||||
disables shaped windows (for oclock, xeyes etc.)
|
||||
|
||||
--enable-debug
|
||||
Do not use it unless you know what you're doing.
|
||||
|
||||
|
||||
PLATFORM SPECIFIC NOTES:
|
||||
========================
|
||||
|
||||
- DEC/Alpha machines
|
||||
You might need to pass the --disable-shm flag to configure, like
|
||||
./configure --disable-shm
|
||||
|
||||
#>>>>>>>>>>>
|
||||
From: Anton Ivanov <aivanov@eu.level3.net>
|
||||
To: Marcelo E. Magallon <mmagallo@debian.org>
|
||||
Subject: Re: Is the WindowMaker package working ok on Alpha?
|
||||
|
||||
> Hi,
|
||||
>
|
||||
> I was reading some docs on the WindowMaker tarball, and found this:
|
||||
>
|
||||
> | - DEC/Alpha machines
|
||||
> | You might need to pass the --disable-shm flag to configure,
|
||||
> | like ./configure --disable-shm
|
||||
>
|
||||
> is anyone having problems with WindowMaker on Alpha? Can someone
|
||||
> please test this? Should the flag be passed when building on Alpha?
|
||||
|
||||
Disclaimer: alphas under my command have never run X and are least likely to
|
||||
suddenly start running it anytime soon.
|
||||
|
||||
Alpha used to have some ridiculously low amount of shared memory
|
||||
configured.
|
||||
So quite a lot of apps used to barf. Namely - cdrecord, mysql server, etc.
|
||||
|
||||
Check where is yours at the moment and raise it to a more appropriate
|
||||
value by either catting to the appropriate /proc entry or changing the
|
||||
/usr/src/linux/include/asm/shmparam.h.
|
||||
|
||||
Otherwise the shared memory on alpha should be fully functional and I
|
||||
see no reason to disable it. Mine are bumped up to 32 or more on most
|
||||
machines.
|
||||
|
||||
And If I recall correctly the comments in that file are actually
|
||||
wrong. Value is not bytes, but in machine size word. For alpha *8.
|
||||
|
||||
As I said - I do not run X on them so all #include "stdisclaimer.h"
|
||||
apply.
|
||||
#<<<<<<<<<<<<
|
||||
|
||||
|
||||
- SCO Unix - run configure like
|
||||
CFLAGS="-belf -DANSICPP" ./configure
|
||||
@@ -299,15 +334,6 @@ PLATFORM SPECIFIC NOTES:
|
||||
INSTALLATION:
|
||||
=============
|
||||
|
||||
Unpack WindowMaker-extra-<version-number>.tar.gz in /usr/local/share
|
||||
|
||||
You can get the file at ftp://ftp.windowmaker.org. This file is optional
|
||||
and only have a few icons, and themes. Look for the latest <version-number>
|
||||
available.
|
||||
Also there is a WindowMaker-extra.readme to instruct you where that package
|
||||
should go.
|
||||
|
||||
|
||||
Build Window Maker
|
||||
------------------
|
||||
For a quick start, type the following in your shell prompt:
|
||||
@@ -382,6 +408,20 @@ Read the User Guide for a more in-depth explanation of Window Maker.
|
||||
You might want to take a look at the FAQ too.
|
||||
|
||||
|
||||
|
||||
Installing the extras package
|
||||
-----------------------------
|
||||
|
||||
Unpack WindowMaker-extra-<version-number>.tar.gz in /usr/local/share
|
||||
|
||||
You can get the file at ftp://ftp.windowmaker.org. This file is optional
|
||||
and only have a few icons, and themes. Look for the latest <version-number>
|
||||
available.
|
||||
Also there is a WindowMaker-extra.readme to instruct you where that package
|
||||
should go.
|
||||
|
||||
|
||||
|
||||
I don't have the root password :(
|
||||
---------------------------------
|
||||
|
||||
@@ -410,8 +450,8 @@ If you are upgrading from an older version of Window Maker:
|
||||
|
||||
1. Configure and build Window Maker as always
|
||||
2. Install Window Maker (but do not run wmaker.inst)
|
||||
3. Read the NEWS file and update your configuration files,
|
||||
if necessary.
|
||||
3. Read the NEWS file and update your configuration files if necessary.
|
||||
|
||||
|
||||
TROUBLESHOOTING
|
||||
===============
|
||||
@@ -431,8 +471,7 @@ ltconfig: unrecognized option `--no-reexec'
|
||||
Try `ltconfig --help' for more information.
|
||||
configure: error: libtool configure failed
|
||||
|
||||
remove the --no-reexec option from aclocal.m4 and libPropList/aclocal.m4
|
||||
and reconfigure
|
||||
remove the --no-reexec option from aclocal.m4 and reconfigure
|
||||
Also make sure the autoconf and automake versions you have installed are:
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
@@ -441,12 +480,6 @@ libtool 1.3
|
||||
Note that it must not be libtool 1.2b, it must be libtool 1.3,
|
||||
from the GNU sites.
|
||||
|
||||
== Cant find proplist.h or libPropList.something
|
||||
|
||||
Download and install libPropList from the places pointed to
|
||||
somewhere else in this file.
|
||||
|
||||
|
||||
== configure doesn't detect libtiff, or other graphic libraries.
|
||||
|
||||
Delete config.cache, then rerun configure adding the following options to
|
||||
@@ -520,7 +553,7 @@ for other languages.
|
||||
|
||||
2 - Additionally, if your language uses multi-byte characters, such
|
||||
as Japanese or Korean, you must set the MultiByteText option to YES
|
||||
in ~/GNUstep/Defaults/WMGLOBAL and ~/GNUstep/Defaults/WindowMaker
|
||||
in ~/GNUstep/Defaults/WMGLOBAL
|
||||
|
||||
3 - Configure, build and install Window Maker normally.
|
||||
|
||||
@@ -574,3 +607,4 @@ and WPrefs.app)
|
||||
|
||||
The wsetfont script that's supplied will allow you to change the font
|
||||
settings in a easier way. Take a look in the script for details on usage.
|
||||
|
||||
|
||||
608
INSTALL.es
Normal file
608
INSTALL.es
Normal file
@@ -0,0 +1,608 @@
|
||||
|
||||
Instrucciones de Instalación para Window Maker
|
||||
|
||||
|
||||
|
||||
PLATAFORMAS SOPORTADAS
|
||||
======================
|
||||
(obs: Alguien me mencionó que lo compiló en...)
|
||||
|
||||
- Intel GNU/Linux Conectiva 5.9 (beta)
|
||||
- Intel GNU/Linux Slackware
|
||||
- Intel GNU/Linux Debian
|
||||
- Intel GNU/Linux other distributions
|
||||
- Sparc GNU/Linux RedHat 5.1
|
||||
- PowerPC GNU/MkLinux
|
||||
- Alpha GNU/Linux RedHat 5.1
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- OpenBSD
|
||||
- BSDI 4.0
|
||||
- Solaris 2.5.1, 2.5.2
|
||||
- Solaris 2.6.0
|
||||
- Solaris 2.7beta
|
||||
- SCO Unix
|
||||
- SGI Irix 5.x, 6.5
|
||||
- OSF/1
|
||||
- HP-UX
|
||||
- AIX 3.2.5
|
||||
- AIX 4.1.4 / IBM PowerPC
|
||||
- AIX 4.3.1 / IBM CC compiler
|
||||
- AIX 4.3.2 / IBM PowerPC
|
||||
- AIX 5.3
|
||||
- DEC Alpha/Digital UNIX 4.x
|
||||
- XFree86 / OS/2
|
||||
- Corel NetWinder
|
||||
- SunOS 4.x
|
||||
- PowerMac / Power MachTen 4.1.1 over MacOS
|
||||
- Amiga 3000 running RedHat Linux 5.1 (Rawhide)
|
||||
- IBM S/390 running Linux
|
||||
- iBook running Darwin
|
||||
- Windows NT with Cygwin/XFree86
|
||||
- Sony PlayStation2 running Linux
|
||||
|
||||
Todas las marcas registradas están registradas por sus dueños. (duh)
|
||||
|
||||
Los parches que lo hagan funcionar en otras plataformas son bienvenidos.
|
||||
|
||||
|
||||
REQUERIMIENTOS:
|
||||
==============
|
||||
|
||||
El siguiente software se necesita para usar Window Maker:
|
||||
|
||||
- X11R6.x
|
||||
Window Maker puede ser compilado en versiones más antiguas de X,
|
||||
como X11R5 (Solaris) o X11R4 (OpenWindows) pero no funcionará 100%
|
||||
correctamente.
|
||||
En tales servidores no habrá íconos de aplicación y tendrá problemas
|
||||
usando el dock. Actualizar las bibliotecas cliente (Xlib, Xt, etc)
|
||||
ayudará si no puede actualizar el servidor.
|
||||
|
||||
Lo siguiente se necesita para compilar Window Maker:
|
||||
|
||||
- Requerimientos básicos y obvios
|
||||
Si compila Window Maker, asegúrese de tener gcc (u algún otro
|
||||
compilador ANSI C) y los archivos header de X instalados. Especialmente
|
||||
para los usuarios de Linux principiantes: debe instalar todos los paquetes
|
||||
de desarrollo de X y la suite gcc. De lo contrario no será capaz de
|
||||
compilar ningún programa X, incluyendo Window Maker.
|
||||
|
||||
- libPropList
|
||||
Esta biblioteca se puede encontrar en ftp://ftp.windowmaker.org/pub/libs
|
||||
o en ftp://ftp.gnome.org/pub/libPropList
|
||||
Instálela antes de compilar Window Maker.
|
||||
|
||||
- autoconf, automake y libtool
|
||||
Estas herramientas NO son necesarias, pero SI tiene una o más de ellas
|
||||
instaladas, asegúrese de tener TODO lo siguiente con estas versiones
|
||||
exactas:
|
||||
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
|
||||
Si tiene una versión distinta, desactívelas temporalemte renombrándolas
|
||||
a otras cosa o desinstalándolas desde su sistema. Si no desarrolla
|
||||
software no las necesita, así que puede desinstalarla sin peligro.
|
||||
|
||||
- lex (o flex) y yacc (o bison)
|
||||
Estas son usadas por libPropList. lex en realidad no se necesita ya que
|
||||
su archivo de salida está incluido, pero o yo o automake es tonto,
|
||||
causando que el script configure para libPropList simplemente
|
||||
aborte sin ningún motivo si lex no es encontrado.
|
||||
|
||||
OPCIONAL:
|
||||
=========
|
||||
Estas bibliotecas no son necesarias para hacer que Window Maker funcione,
|
||||
pero están soportadas en caso de que quiera usarlas. Los números de versión
|
||||
son aquellos que yo tengo (y por lo tanto, garantizo que funciona), pero
|
||||
otras versiones podría funcionar también.
|
||||
|
||||
- libXPM 4.7 o más actual.
|
||||
Versiones antiguas pueden no funcionar!!!
|
||||
Disponible en ftp://sunsite.unc.edu/pub/Linux/libs/X/
|
||||
|
||||
Hay soporte nativo para archivos XPM, pero no cargará imagenes de
|
||||
algunos formatos poco comunes.
|
||||
|
||||
-libpng 0.96 o más actual y zlib
|
||||
Para soporte de imágenes PNG.
|
||||
http://www.cdrom.com/pub/png/
|
||||
|
||||
- libtiff 3.4 o más actual.
|
||||
Para soporte de imaen TIFF.
|
||||
Puede obtenerla en ftp://ftp.sgi.com/graphics/tiff
|
||||
|
||||
- libjpeg 6.0.1 o más actual
|
||||
Para soporte de imagen JPEG
|
||||
http://www.ijg.org/
|
||||
|
||||
- libgif 2.2 o libungif
|
||||
Para soporte de imagen GIF.
|
||||
ftp://prtr-13.ucsc.edu/pub/libungif/
|
||||
|
||||
- libHermes 1.3.2 o más actual
|
||||
Para conversión a pixel más rápida en la biblioteca wraster.
|
||||
(se usa solo en algunas conversiones - para visuales Color Verdadero)
|
||||
http://www.clanlib.org/hermes/
|
||||
|
||||
- GNU xgettext
|
||||
Si quiere usar mensajes traducidos, necesitará GNU gettext.
|
||||
Otras versiones de gettext no son compatibles y no funcionarán.
|
||||
Obtenga la versión GNU desde ftp://ftp.gnu.org
|
||||
|
||||
OPCIONES DE CONFIGURACIÓN:
|
||||
=========================
|
||||
Estas opciones pueden ser pasadas al script configure para activar/desactivar
|
||||
algunas opciones de Window Maker. Ejemplo:
|
||||
|
||||
./configure --enable-kde --enable-gnome
|
||||
|
||||
configurará Window Maker para que sea compilado con soporte para KDE y GNOME.
|
||||
|
||||
Para obtener una lista de otras opciones, ejecute ./configure --help
|
||||
|
||||
--with-libs-from
|
||||
especifica rutas adicionales por donde se debe buscar bibliotecas.
|
||||
El -L flag debe preceder a cada ruta, tal como:
|
||||
|
||||
--with-libs-from="-L/opt/libs -L/usr/local/lib"
|
||||
|
||||
--with-incs-from
|
||||
especifica rutas adicionales para la búsqueda de archivos header.
|
||||
El parámetro -I debe preceder a cada ruta, tal como:
|
||||
|
||||
--with-incs-from="-I/opt/headers -I/usr/local/include"
|
||||
|
||||
--enable-single-icon
|
||||
activa el agrupamiento de todos los appicons (iconos de aplicaciones)
|
||||
del WM_CLASS+WM_INSTANCE en uno solo. Esta característica no es soportada
|
||||
por todos los desarrolladores. Si tiene algún problema con ella, contacte
|
||||
a su autor: Christopher Seawood <cls@seawood.org>
|
||||
|
||||
--disable-shm
|
||||
desactiva el uso de la extensión MIT de memoria compartida. Esto
|
||||
ralentizará la generación de texturas un poco, pero en algunos casos
|
||||
parecerá necesario debido a un error que se manifiesta como íconos y
|
||||
texturas desordenadas.
|
||||
|
||||
--disable-motif
|
||||
desactiva el soporte para el gestor de ventanas mwm.
|
||||
|
||||
--enable-openlook
|
||||
activa el soporte para el gestor de ventanas OPEN LOOK(tm)
|
||||
|
||||
--enable-gnome
|
||||
activa el soporte para el gestor de ventanas GNOME.
|
||||
|
||||
--enable-kde
|
||||
activa el soporte para el gestor de ventanas kde/kwm.
|
||||
|
||||
--enable-lite
|
||||
quita cosas que ya están soportadas en los entornos de escritorio,
|
||||
tal como KDE y Gnome. Desactiva cosas como: lista de ventanas,
|
||||
menú de aplicaciones raíz, selección de ventanas múltiple. Note
|
||||
que no podrá salir más desde dentro de Window Maker; tendrá que usar
|
||||
kill con la señal SIGTERM o salir de KDE. No aconsejo activarlo.
|
||||
|
||||
--enable-modelock
|
||||
Soporte para bloqueo de estado de lenguaje XKB. Si no sabe que es esto
|
||||
probablemente no lo necesite.
|
||||
|
||||
--enable-sound
|
||||
activa el soporte del módulo para efectos sonoros.
|
||||
|
||||
--disable-xpm
|
||||
desactiva el uso de la biblioteca XPM aunque este disponible en su
|
||||
sistema.
|
||||
|
||||
--disable-png
|
||||
desactiva el uso de la biblioteca PNG.
|
||||
|
||||
--disable-tiff
|
||||
desactiva el uso de la biblioteca TIFF.
|
||||
|
||||
--disable-gif
|
||||
desactiva el uso de la biblioteca GIF.
|
||||
|
||||
--disable-jpeg
|
||||
desactiva el uso de la biblioteca JPEG.
|
||||
|
||||
--disable-shape
|
||||
desactiva la forma de ventanas (para oclock, xeyes etc.)
|
||||
|
||||
NOTAS ESPECÍFICAS A LA PLATAFORMA:
|
||||
=================================
|
||||
|
||||
- máquinas DEC/Alpha
|
||||
|
||||
#>>>>>>>>>>>
|
||||
From: Anton Ivanov <aivanov@eu.level3.net>
|
||||
To: Marcelo E. Magallon <mmagallo@debian.org>
|
||||
Subject: Re: El paquete WindowMaker funciona bien en Alpha?
|
||||
|
||||
> Hola,
|
||||
>
|
||||
> Estuve leyendo algunos documentos en el tarball de WindowMaker,
|
||||
> y encontré esto:
|
||||
>
|
||||
> | - máquinas DEC/Alpha
|
||||
> | podría necesitar pasar el parámetro --disable-shm a configure,
|
||||
> | así ./configure --disable-shm
|
||||
>
|
||||
> alguien está teniendo problemas con WindowMaker en Alpha? Puede alguien
|
||||
> por favor probar esto? Debería el parámetro ser pasado al compilar
|
||||
> en Alpha?
|
||||
|
||||
Descargo de responsabilidad: alphas bajo mi mando nunca han ejecutado X y are
|
||||
least likely to suddenly start running it anytime soon.
|
||||
|
||||
Alpha suele tener alguna ridícula poca cantidad de memoria compartida
|
||||
configurada.
|
||||
|
||||
Así que muchísimas aplicaciones suelen to barf. Concretamente - cdrecord, mysql server, etc.
|
||||
|
||||
Verifique donde está el suyo en este momento y súbalo a un valor más adecuado catting la entrada
|
||||
adecuada de /proc o cambiando el /usr/src/linux/include/asm/shmparam.h.
|
||||
|
||||
De lo contrario la memoria compartida en alpha debiera ser completamente funcional y no veo razón
|
||||
para desactivarla. Las mías están aumentadas a 32 o más en muchas máquinas.
|
||||
|
||||
Y si recuerdo correctamente los comentarios en aquél archivo están en realidad mal.
|
||||
El valor no está en bytes, pero si en palabra de tamaño máquina. Para alpha *8.
|
||||
|
||||
Como dije - no ejecuto X en ellas asi que apliqué a todas #include "stdisclaimer.h".
|
||||
#<<<<<<<<<<<<
|
||||
|
||||
- SCO Unix - ejecute configure así
|
||||
CFLAGS="-belf -DANSICPP" ./configure
|
||||
|
||||
-SunOS, Solaris
|
||||
Si tiene gcc instalado, ejecute configure como:
|
||||
CPP_PATH="gcc -E -x c" ./configure
|
||||
Sun cpp le falta algunas características que necesita Window Maker y
|
||||
puede causarle problemas al analizar sintacticamente los archivos config.
|
||||
También podría necesitar usar el --with-libs-from y --with-incs-from para
|
||||
suministrarle el directorio donde libtiff se aloja.
|
||||
Alguien me envió un mensaje diciéndome que también debe hacer que /usr/local/lib
|
||||
sea la primera ruta en LD_LIBRARY_PATH para que funcione.
|
||||
|
||||
Si tiene un Ultra Creator 3D o alguna otra máquina con gráficos high-end,
|
||||
asegúrese de iniciar el servidor X con el valor visual por defecto a 24bpp o
|
||||
podría experimentar problemas con colores destrozados.
|
||||
Este es un error de wmaker y será reparado.
|
||||
|
||||
- GNU/Linux en general
|
||||
Asegúrese de tener /usr/local/lib en /etc/ld.so.conf y de ejecutar
|
||||
ldconfig después de instalar.
|
||||
Desinstale cualquier versión empaquetada de Window Maker antes de
|
||||
instalar una nueva versión.
|
||||
|
||||
- RedHat GNU/Linux
|
||||
Los sistemas RedHat tienen varios problemas molestos. Si lo usa,
|
||||
asegúrese de seguir los pasos de más abajo o Window Maker no funcionará:
|
||||
|
||||
* si instaló el Window Maker que viene con RedHat, desinstálelo antes de
|
||||
actualizar;
|
||||
|
||||
*asegúrese que no tiene las variables de entorno LANG y LINGUAS establecidas a
|
||||
en_RN;
|
||||
|
||||
*asegúrese de tener /usr/local/bin en su variable de entorno PATH;
|
||||
|
||||
* asegúrese de tener /usr/local/lib en /etc/ld.so.conf antes de ejecutar
|
||||
ldconfig;
|
||||
|
||||
*si tiene problemas que mencionan un menaje de error con --no-reexec
|
||||
desinstale libtool-1.2b e instale libtool-1.3 en su lugar. libtool-1.3
|
||||
se puede encontrar en ftp.gnu.org. También lea la sección TROUBLESHOOTING
|
||||
(PROBLEMAS);
|
||||
|
||||
* si instaló el paquete Window Maker desde RedHat y está instalando una
|
||||
nueva versión de WM a mano (compilandolo usted mismo), desinstale antes el
|
||||
paquete desde RedHat.
|
||||
|
||||
*asegúrese de tener un enlace simbólico desde /usr/include/X11 hacia
|
||||
/usr/X11R6/include/X11 (si no, tipee ln -s /usr/X11R6/include/X11 /usr/include/X11)
|
||||
|
||||
* asegúrese de tener /lib/cpp apuntando al programa cpp.
|
||||
|
||||
Si tiene alguna duda en cuanto a hacer algunas de las cosas de arriba,
|
||||
por favor no dude en contactar el soporte para usuarios de RedHat. Ellos
|
||||
responderán amablemente a todas sus preguntas en lo que respecta a su sistema.
|
||||
Ellos también conocen mucho más acerca de su propio sistema que nosotros
|
||||
(nosotros no usamos RedHat).
|
||||
|
||||
- PowerPC MkLinux
|
||||
Necesitará tener la última version de Xpmac. Las versiones más antiguas
|
||||
parecen tener errores que producen el cuelgue del sistema.
|
||||
|
||||
- Debian GNU/Linux
|
||||
Si quiere soporte JPEG y TIFF, asegúrese de tener libtiff-dev y
|
||||
libjpeg-dev instalados.
|
||||
|
||||
- SuSE GNU/Linux
|
||||
Si instaló el paquete Window Maker desde SuSE,
|
||||
desinstálelo antes de instentar compilar wmaker o podría
|
||||
tener problemas.
|
||||
|
||||
|
||||
- MetroX (version desconocida)
|
||||
MetroX tiene un error que corrompe pixmaps que se establecen como
|
||||
fondos de ventana. Si usa MetroX y tuvo problemas raros con texturas, no use
|
||||
texturas en las barras de títulos. O use un servidor X distinto.
|
||||
|
||||
INSTALACIÓN:
|
||||
=============
|
||||
|
||||
Compilando Window Maker
|
||||
------------------
|
||||
Para un comienzo rápido, tipee lo siguiente en el prompt del shell:
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
luego, regístrese como root y tipee:
|
||||
|
||||
make install
|
||||
ldconfig
|
||||
|
||||
o si quiere remover los símbolos de depuración desde los binarios y hacerlos más
|
||||
pequeños, puede tipear:
|
||||
|
||||
make install-strip
|
||||
ldconfig
|
||||
|
||||
Esto compilará e instalará Window Maker con los parámetros por defecto.
|
||||
|
||||
Si quiere personalizar algunas opciones de compilación, puede hacer lo siguiente.
|
||||
|
||||
1. (opcional)Mire en la sección OPCIONES DE CONFIGURACIÓN para ver las
|
||||
opciones disponibles. También ejecute:
|
||||
|
||||
./configure --help
|
||||
|
||||
para obtener un listado completo de otras opciones que están disponibles.
|
||||
|
||||
2. Ejecute configure con las opciones que quiera. Por ejemplo, si quiere
|
||||
usar la opción --enable-kde, tipee:
|
||||
|
||||
./configure --enable-kde
|
||||
|
||||
3. (opcional) Edite src/wconfig.h con su editor de texto favorito y
|
||||
echele un vistazo por algunas opciones que podría querer cambiar.
|
||||
|
||||
4. Compile. Solo tipee:
|
||||
|
||||
make
|
||||
|
||||
5. Regístrese como root (si no puede hacerlo, lea la sección "No tengo la contraseña de root" :-()
|
||||
e instale Window Maker en su sistema:
|
||||
su root
|
||||
make install
|
||||
|
||||
|
||||
Configuración específica del usuario
|
||||
------------------------------------
|
||||
|
||||
Estas instrucciones no necesitan ser seguidas al actualizar Window Maker
|
||||
desde una versión más antigua, a menos que se indique de otra forma en el archivo
|
||||
NEWS.
|
||||
|
||||
Todo usuario en su sistema que desee ejecutar Window Maker debe hacer lo siguiente:
|
||||
|
||||
1. Instale los archivos de configuración de Window Maker en su directorio home.
|
||||
Tipee:
|
||||
wmaker.inst
|
||||
|
||||
wmaker.inst instalará los archivos de configuración de Window Maker y
|
||||
configurará X para que automáticamente lance Window Maker al inicio.
|
||||
|
||||
Eso es todo!
|
||||
|
||||
Puede tipear "man wmaker" para obtener algo de ayuda general para la
|
||||
configuración y otras cosas.
|
||||
Lea la Guia de Usuario para una explicación más a fondo de Window Maker.
|
||||
|
||||
Podría querer dar una mirada a la FAQ también.
|
||||
|
||||
Instalando el paquete extras
|
||||
----------------------------
|
||||
|
||||
Desempaquete WindowMaker-extra-<número-de-versión>.tar.gz en /usr/local/share
|
||||
|
||||
Puede obtener el archivo en ftp://ftp.windowmmaker.org. Este archivo es optativo
|
||||
y solo tiene unos pocos íconos, y temas. Busque el último <número-de-versión>
|
||||
disponible.
|
||||
También hay un WindowMaker-extra.readme que le enseña donde vería ir ese paquete.
|
||||
|
||||
|
||||
No tengo la contraseña de root :(
|
||||
--------------------------------
|
||||
|
||||
Si no puede obtener privilegios de superusuario (no puede ser root) puede
|
||||
instalar wmaker en su propio directorio home. Para esto, proporcione la
|
||||
opción --prefix al ejecutar configure en el paso 2 de compilando Window Maker.
|
||||
También necesitará proporcionar la opción --with-appspath, para especificar la ruta
|
||||
para WPrefs.app. Ejemplo:
|
||||
|
||||
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Apps
|
||||
|
||||
Luego haga /home/jshmoe/bin para que se lo incluya en su ruta de búsqueda, agregue
|
||||
/home/jshmoe/lib a su variable de entorno LD_LIBRARY_PATH y ejecute bin/wmaker.inst
|
||||
|
||||
Por supuesto, /home/jshmoe se supone que va a ser reemplazado con la ruta a su
|
||||
directorio home real.
|
||||
|
||||
|
||||
ACTUALIZANDO
|
||||
============
|
||||
Si está actualizando desde una versión antigua de Window Maker:
|
||||
|
||||
1. Configure y compile Window Maker como siempre.
|
||||
2. Instale Window Maker (pero no ejecute wmaker.inst)
|
||||
3. Lea el archivo NEWS y actualice sus archivos de configuración,
|
||||
si es necesario.
|
||||
|
||||
PROBLEMAS
|
||||
=========
|
||||
|
||||
Cuando tenga alguno problemas durante la configuración (al ejecutar configure),
|
||||
tal como no poder usar una biblioteca de formato gráfico que piensa tener instalada,
|
||||
mire en el archivo config.log para obtener ideas sobre el problema.
|
||||
|
||||
== Error al cargar las fuentes, siempre que existan.
|
||||
|
||||
Intente recompilar sin el soporte NLS.
|
||||
|
||||
== Error al configurar
|
||||
|
||||
ltconfig: unrecognized option `--no-reexec'
|
||||
Try `ltconfig --help' for more information.
|
||||
configure: error: libtool configure failed
|
||||
|
||||
quite la opción --no-reexec desde aclocal.m4 y libPropList/aclocal.m4 y
|
||||
reconfigure.
|
||||
También asegúrese que las versiones de autoconf y automake que tenga instaladas son:
|
||||
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
|
||||
Note que ella no debe ser libtool 1.2b, debe ser libtool 1.3,
|
||||
desde los sitios GNU.
|
||||
|
||||
== No puedo encontrar proplist.h o libPropList.something
|
||||
|
||||
Baje e instale libPropList desde los lugares ya citados en algún lugar
|
||||
de este archivo.
|
||||
|
||||
== configure no detecta libtiff, u otras bibliotecas gráficas.
|
||||
|
||||
Elimine config.cache, luego vuelva a ejecutar configure añadiendo las siguientes
|
||||
opciones a configure (entre sus otras opciones):
|
||||
|
||||
--with-libs-from="-L/usr/local/lib"
|
||||
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
|
||||
|
||||
Sustituya las rutas donde están localizadas sus bibliotecas gráficas y sus
|
||||
correspondientes archivos header. Puede colocar rutas múltiples en cualquiera de
|
||||
estas opciones, como se muestra en el ejemplo de --with-incs-from . Solo coloque
|
||||
un espacio entre ellas.
|
||||
|
||||
== configure no detecta libXpm.
|
||||
|
||||
* Verifique si tiene un enlace simbólico desde libXpm.so.4.9 a libXpm.so
|
||||
|
||||
== Segmentation fault al inicio.
|
||||
|
||||
* Verifique si la versión de libXPM que tiene es por lo menos la 4.7
|
||||
|
||||
* Verifique si tiene una versión actualizada de ~/GNUstep/Defaults/WindowMaker
|
||||
|
||||
Si no está seguro, intente renombrar ~/GNUstep a ~/GNUtmp y luego ejecute wmaker.inst
|
||||
|
||||
== "...: your machine is misconfigured. gethostname() returned (none)"
|
||||
|
||||
* el hostname de su máquina está definido a algo inválido, como comenzar con
|
||||
un paréntesis. Haga un man hostname para obtener información acerca de como definirlo.
|
||||
|
||||
|
||||
== El menú raíz contiene solo 2 entradas. ("XTerm" y "Exit...")
|
||||
|
||||
* Window Maker no está encontrando cpp (el preprocesador de C). Si su
|
||||
cpp no está ubicado en /lib/cpp, edite src/config.h y corrija la ruta en
|
||||
CPP_PATH.
|
||||
|
||||
== checking lex output file root... configure: error: cannot find output from true; giving up
|
||||
|
||||
* Lea la sección REQUERIMIENTOS de este archivo.
|
||||
|
||||
|
||||
LOCALES/INTERNACIONALIZACIÓN
|
||||
============================
|
||||
|
||||
Window Maker tiene soporte de idioma nacional. Para activar este soporte,
|
||||
debe compilar Window Maker con algunos parámetros adicionales.
|
||||
|
||||
0 - Debe tener el paquete GNU gettext instalado. Puede obtenerse en
|
||||
ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
|
||||
|
||||
Los pasos 1 al 3 pueden saltearse si usa el script Install.
|
||||
|
||||
1 - Debe seleccionar los idiomas que quiere soportar. Defina el
|
||||
LINGUAS a la lista de locales que quiera. El Inglés siempre está
|
||||
soportado. Ejemplo:
|
||||
|
||||
setenv LINGUAS "pt ja de"
|
||||
en csh
|
||||
|
||||
o
|
||||
|
||||
export LINGUAS;LINGUAS="pt ja de"
|
||||
en sh
|
||||
|
||||
La lista de locales soportados se pueden encontrar en po/README.
|
||||
El Inglés es el idioma pr defecto.
|
||||
|
||||
Lea po/README si desea traducir y mantener archivos locale para otros
|
||||
idiomas.
|
||||
|
||||
2 - Adicionalmente, si su idioma usa caracteres multi-byte, tal como
|
||||
Japonés o Coreano, debe definir la opción MultiByteText a YES
|
||||
en ~/GNUstep/Defaults/WMGLOBAL
|
||||
|
||||
3 - Configure, compile e instale Window Maker normalmente.
|
||||
|
||||
4 - Para seleccionar un locale particular en tiempo de ejecución debe definir la
|
||||
variable de entorno LANG al locale que quiera. Por ejemplo, si quiere definir
|
||||
el locale portugués, debe ejecutar
|
||||
|
||||
setenv LANG pt
|
||||
|
||||
en csh o
|
||||
|
||||
export LANG; LANG=pt
|
||||
|
||||
en Bourne sh y similares
|
||||
|
||||
Nota: Si tiene definida la variable de entorno LC_CTYPE, debe
|
||||
indefinirla antes de ejecutar wmaker.
|
||||
|
||||
Window Maker busca los archivos de definición de menú en el siguiente orden:
|
||||
(para portugués brasileño, en este caso):
|
||||
|
||||
menu.pt_BR
|
||||
menu.pt
|
||||
menu
|
||||
|
||||
5 - Si elige un idioma que usa caracteres multi-byte, debe configurar
|
||||
las fuentes adecuadamente. Lea la página del manual para XCreateFontSet
|
||||
para obtener más detalles sobre esto. Debe cambiar el archivo ~/G/D/Windowmaker
|
||||
para las fuentes usadas en barras de título, menús y otras cosas. Para las fuentes
|
||||
usadas en ventanas de diálogo, cambie ~/G/D/WMGLOBAL. El %d en los nombres de las
|
||||
fuentes no debe ser quitado. Puede también usar el script wsetfont proporcionado para
|
||||
esta tarea. Lea el mismo script para obtener instrucciones.
|
||||
|
||||
Por ejemplo, puede especificar lo siguiente en ~/G/D/WindowMaker:
|
||||
|
||||
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
|
||||
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
|
||||
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
|
||||
|
||||
y en ~/G/D/WMGLOBAL:
|
||||
|
||||
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
|
||||
Las 2 fuentes de arriba son usadas únicamente por aplicaciones que usan WINGs
|
||||
(WindowMaker y WPrefs.app)
|
||||
|
||||
El script wsetfont que se proporciona le permitirá cambiar las definiciones de fuentes
|
||||
de una manera fácil. De una mirada al script para detalles de uso.
|
||||
|
||||
traducido por Efraín Maximiliano Palermo <max_drake2001@yahoo.com.ar>
|
||||
651
INSTALL.fr
Normal file
651
INSTALL.fr
Normal file
@@ -0,0 +1,651 @@
|
||||
|
||||
Instructions pour l'installation de Window Maker
|
||||
|
||||
|
||||
|
||||
PLATEFORMES SUPPORTEES
|
||||
======================
|
||||
(c.a.d : j'ai entendu dire que la compilation a été réalisée avec succès sur..)
|
||||
|
||||
- Intel GNU/Linux Conectiva 5.9 (beta)
|
||||
- Intel GNU/Linux Slackware
|
||||
- Intel GNU/Linux Debian
|
||||
- Intel GNU/Linux (autres)
|
||||
- Sparc GNU/Linux RedHat 5.1
|
||||
- PowerPC GNU/MkLinux
|
||||
- Alpha GNU/Linux RedHat 5.1
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- OpenBSD
|
||||
- BSDI 4.0
|
||||
- Solaris 2.5.1, 2.5.2
|
||||
- Solaris 2.6.0
|
||||
- Solaris 2.7beta
|
||||
- Solaris 2.8 sur Ultra Sparc 10 et E450
|
||||
- SCO Unix
|
||||
- SGI Irix 5.x, 6.5
|
||||
- OSF/1
|
||||
- HP-UX
|
||||
- AIX 3.2.5
|
||||
- AIX 4.1.4 / IBM PowerPC
|
||||
- AIX 4.3.1 / IBM CC compiler
|
||||
- AIX 4.3.2 / IBM PowerPC
|
||||
- AIX 5.3
|
||||
- DEC Alpha/Digital UNIX 4.x
|
||||
- XFree86 / OS/2
|
||||
- Corel NetWinder
|
||||
- SunOS 4.x
|
||||
- PowerMac / Power MachTen 4.1.1 sous MacOS
|
||||
- Amiga 3000 sous RedHat Linux 5.1 (Rawhide)
|
||||
- IBM S/390 sous Linux
|
||||
- IBM S/390 sous Conectiva Linux (experimental)
|
||||
- iBook sous Darwin
|
||||
- Windows NT sous Cygwin/XFree86
|
||||
- Sony PlayStation2 sous Linux
|
||||
|
||||
Toutes les marques déposées sont la propriété de leur propriétaire.
|
||||
|
||||
Tout patch qui pourrait faciliter l'adaptation à d'autres plateformes
|
||||
est le bienvenu.
|
||||
|
||||
|
||||
PRE-REQUIS
|
||||
==========
|
||||
|
||||
Les logiciels suivants sont nécessaires à l'utilisation de Window Maker :
|
||||
|
||||
- X11R6.x
|
||||
Window Maker peut être compilé avec des versions plus anciennes de X,
|
||||
comme X11R5 (Solaris) ou X11R4 (OpenWindows), mais il ne fonctionnera
|
||||
pas correctement à 100%.
|
||||
Avec ces serveurs X, les icônes des applications n'apparaîtrons pas,
|
||||
et vous aurez des problèmes à l'utilisation du dock. La mise à jour
|
||||
des librairies côté client (Xlib, Xt, etc.) pourront améliorer les
|
||||
choses si vous ne pouvez pas mettre à jour le serveur.
|
||||
|
||||
Les éléments suivants sont nécessaires à la compilation de Window Maker :
|
||||
|
||||
- pré-requis de base
|
||||
Pour compiler Window Maker, assurez-vous que gcc (ou tout autre
|
||||
compilateur de C ANSI) ainsi que les fichiers d'en-têtes de X sont
|
||||
installés. Débutants sous Linux : vous devez installer les paquetages
|
||||
de développement de X ainsi que ceux de la suite gcc. Le cas contraire,
|
||||
vous ne pourrez jamais compiler aucun programme prévu pour X, y compris
|
||||
Window Maker.
|
||||
|
||||
- autoconf, automake et libtool
|
||||
Ces outils ne sont pas indispensables, mais si au moins l'un d'eux
|
||||
est installé sur votre système, assurez-vous que TOUS le sont, et
|
||||
que les versions de ces outils sont exactement :
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
Si les versions installées sur votre système différent, désactivez-les
|
||||
provisoirement, par exemple en les renommant, ou en les désinstallant
|
||||
de votre système. Si vous ne développez ni de compilez de logiciels,
|
||||
vous n'en avez pas besoin et leur désinstallation n'est donc pas un
|
||||
problème.
|
||||
|
||||
|
||||
OPTIONNEL
|
||||
=========
|
||||
|
||||
Ces librairies ne sont pas nécessaires pour utiliser Window Maker, mais
|
||||
elles sont supportées, au cas où vous souhaiteriez les utiliser. Les
|
||||
versions ci-dessous sont celles dont je dispose (et du coup, il est
|
||||
garanti qu'elles fonctionnent), mais des versions différentes peuvent
|
||||
fonctionner aussi bien.
|
||||
|
||||
|
||||
- libXPM 4.7 ou plus récent
|
||||
Les versions plus anciennes peuvent ne pas fonctionner !!!
|
||||
Disponible sur ftp://sunsite.unc.edu/pub/Linux/libs/X/
|
||||
|
||||
Le support des fichiers XPM est intégré, mais il ne prendra
|
||||
pas en compte les images dont le format est exotique.
|
||||
|
||||
- libpng 0.96 ou plus récent, et zlib
|
||||
Pour pouvoir utiliser les images au format PNG.
|
||||
http://www.cdrom.com/pub/png/
|
||||
|
||||
- libtiff 3.4 ou plus récent
|
||||
Pour pouvoir utiliser les images au format TIFF.
|
||||
Vous trouverez ça ici : ftp://ftp.sgi.com/graphics/tiff
|
||||
|
||||
- libjpeg 6.0.1 ou plus récent
|
||||
Pour pouvoir utiliser les images au format JPEG.
|
||||
http://www.ijg.org/
|
||||
|
||||
- libgif 2.2 ou libungif
|
||||
Pour pouvoir utiliser les images au format GIF.
|
||||
ftp://prtr-13.ucsc.edu/pub/libungif/
|
||||
|
||||
- libHermes 1.3.2 ou plus récent
|
||||
Pour une conversion de pixels plus rapide dans la librairie wraster.
|
||||
(utilisé uniquement pour des conversions spécifiques dont les modes
|
||||
vidéo TrueColor)
|
||||
http://www.clanlib.org/hermes/
|
||||
|
||||
- GNU xgettext
|
||||
Si vous voulez disposer des traductions en d'autres langues, GNU gettext
|
||||
est nécessaire. Les autres versions de gettext sont incompatibles et ne
|
||||
fonctionneront pas.
|
||||
If you want to use translated messages, you will need GNU gettext.
|
||||
Other versions of gettext are not compatible and will not work.
|
||||
Vous trouverez la version GNU sur ftp://ftp.gnu.org
|
||||
|
||||
|
||||
OPTIONS DE CONFIGURATION
|
||||
========================
|
||||
|
||||
Ces options peuvent être passées au script de configuration afin d'activer
|
||||
ou désactiver des fonctionnalités de Window Maker. Par exemple :
|
||||
|
||||
./configure --enable-kde --enable-gnome
|
||||
|
||||
configurera Window Maker avec le support intégré pour KDE et GNOME.
|
||||
|
||||
|
||||
Afin d'obtenir la liste des autres options, exécutez ./configure --help
|
||||
|
||||
--with-libs-from
|
||||
ajoute des chemins d"accès pour la recherche des librairies.
|
||||
L'option -L doit précéder chaque chemin d'accès, comme suit :
|
||||
--with-libs-from="-L/opt/libs -L/usr/local/lib"
|
||||
|
||||
--with-incs-from
|
||||
ajoute des chemins d"accès pour la recherche des fichiers d'en-tête.
|
||||
L'option -I doit précéder chaque chemin d'accès, comme suit :
|
||||
--with-incs-from="-I/opt/headers -I/usr/local/include"
|
||||
|
||||
--enable-single-icon
|
||||
active le regroupement des toutes les appicons des WM_CLASS et WM_INSTANCE
|
||||
en une seule icône. Aucun support n'est offert par les développeurs pour
|
||||
cette fonctionnalité. Si vous avez des problèmes avec celle-ci, contactez
|
||||
son auteur :
|
||||
Christopher Seawood <cls@seawood.org>
|
||||
|
||||
--disable-shm
|
||||
désactive l'utilisation de l'extension "MIT shared memory". Cela ralentira
|
||||
un petit peu la génération des textures, mais il semble que cela soit
|
||||
nécessaire dans certains cas pour éviter un bogue se manifestant au niveau
|
||||
des icônes et des textures.
|
||||
|
||||
--disable-motif
|
||||
désactive le support pour les fonctionnalités en rapport avec le gestionnaire
|
||||
de fenêtres mwm.
|
||||
|
||||
--enable-openlook
|
||||
désactive le support pour les fonctionnalités en rapport avec le gestionnaire
|
||||
de fenêtres OPEN LOOK(tm).
|
||||
|
||||
--enable-gnome
|
||||
désactive le support pour les fonctionnalités en rapport avec le gestionnaire
|
||||
de fenêtres GNOME.
|
||||
|
||||
--enable-kde
|
||||
désactive le support pour les fonctionnalités en rapport avec le gestionnaire
|
||||
de fenêtres kde/kwm.
|
||||
|
||||
--enable-lite
|
||||
désactive des fonctionnalités déjà prises en compte par les gestionnaires de
|
||||
bureau tels que KDE et GNOME. Celà concerne : la liste de fenêtres, le menu
|
||||
des applications, la sélection multiple de fenêtres. Attention : vous ne
|
||||
pourrez plus sortir de Window Maker autrement qu'en utilisant kill avec le
|
||||
signal SIGTERM ou en quittant à l'aide de KDE. Il n'est pas conseillé
|
||||
d'utiliser cette option.
|
||||
|
||||
--enable-modelock
|
||||
active le support pour le verrouillage du "XKB language status". Si vous ne
|
||||
savez pas de quoi il retourne, c'est probablement que vous n'en avez pas
|
||||
utilité.
|
||||
|
||||
--enable-sound
|
||||
active le support pour le module de gestion des effets sonores.
|
||||
|
||||
--disable-xpm
|
||||
désactive l'utilisation de la librairie XPM même si elle est présente
|
||||
sur votre système.
|
||||
|
||||
--disable-png
|
||||
désactive l'utilisation de la librairie PNG.
|
||||
|
||||
--disable-tiff
|
||||
désactive l'utilisation de la librairie TIFF.
|
||||
|
||||
--disable-gif
|
||||
désactive l'utilisation de la librairie GIF.
|
||||
|
||||
--disable-jpeg
|
||||
désactive l'utilisation de la librairie JPEG.
|
||||
|
||||
--disable-shape
|
||||
désactive l'utilisation de "shaped windows" (pour oclock, xeyes, etc.).
|
||||
|
||||
|
||||
NOTES SPECIFIQUES AUX PLATEFORMES
|
||||
=================================
|
||||
|
||||
- machines DEC/Alpha
|
||||
|
||||
#>>>>>>>>>>>
|
||||
De : Anton Ivanov <aivanov@eu.level3.net>
|
||||
A : Marcelo E. Magallon <mmagallo@debian.org>
|
||||
Sujet : Re : Est-ce que le paquetage WindowMaker fonctionne correctement sur Alpha?
|
||||
|
||||
> Salut,
|
||||
>
|
||||
> Je lisais la doc contenue dans l'archive de WindowMaker, quand je suis
|
||||
> tombé sur ça :
|
||||
>
|
||||
> | - machines DEC/Alpha
|
||||
> | Il est possible que vous deviez utiliser l'option --disable-shm pour
|
||||
> | configurer la compilation, comme suit :
|
||||
> | ./configure --disable-shm
|
||||
>
|
||||
> est-ce que quelqu'un a eu des problèmes avec WindowMaker sur Alpha? Est-ce
|
||||
> que quelqu'un peut tester cela? Doit-on vraiment utiliser cette option
|
||||
> pour compiler sur Alpha?
|
||||
|
||||
Notez bien : les Alphas dont je me sers ne sont jamais sous X et ne sont pas près
|
||||
de le faire.
|
||||
|
||||
Bien souvent, la configuration des Alphas n'inclut qu'un volume ridiculement
|
||||
petit de mémoire partagée. Aussi il n'est pas étonnant qu'un grand nombre
|
||||
d'applications comme cdrecord ou mysql server plantent carrément.
|
||||
|
||||
Vérifiez ces réglages sur votre système et modifiez-les en conséquent :
|
||||
pour cela, manipulez l'entrée appropriée dans /proc ou modifiez le fichier
|
||||
/usr/src/linux/include/asm/shmparam.h.
|
||||
|
||||
En dehors de ce cas, la mémoire partagée sous Alpha est sensée ne pas
|
||||
poser de problème et je ne vois aucune raison de la désactiver.
|
||||
Pour ma part, elle est à 32 ou plus sur la pluspart des machines.
|
||||
|
||||
De plus, si ma mémoire est exacte, les commentaires dans ce fichier
|
||||
sont tout à fait inexacts. La valeur n'est pas exprimée en octets, mais en
|
||||
mots, dépendant de la machine. Pour les Alphas, c'est donc *8.
|
||||
|
||||
Je rappelle que je n'utilise pas X sur ces machines, donc ce que j'indique
|
||||
est soumis à toutes les réserves habituelles. (#include "standard_disclaimer.h")
|
||||
#<<<<<<<<<<<<
|
||||
|
||||
|
||||
- SCO Unix
|
||||
Lancez configure comme suit :
|
||||
CFLAGS="-belf -DANSICPP" ./configure
|
||||
|
||||
- SunOS, Solaris
|
||||
Si gcc est installé, lancez configure comme suit :
|
||||
CPP_PATH="gcc -E -x c" ./configure
|
||||
Le cpp de Sun ne dispose pas de certaines fonctionnalités nécessaire pour
|
||||
Window Maker et cela peut occasionner des problèmes avec l'utilisation des
|
||||
fichiers de configuration.
|
||||
Il peut être aussi nécessaire d'indiquer le chemin d'accès à la librairie
|
||||
libtiff en utilisant les options --with-libs-from et --with-incs-from
|
||||
avec configure.
|
||||
Quelqu'un m'a rapporté qu'il est nécessaire de faire figurer /usr/local/lib
|
||||
en premier dans la variable d'environnement LD_LIBRARY_PATH.
|
||||
|
||||
Si vous utilisez un Ultra Creator 3D ou une autre machine graphique
|
||||
de haut niveau, faites en sorte de démarrer le serveur X avec le mode
|
||||
graphique par défaut à 24bpp sinon vous pourriez constaer des problèmes
|
||||
au niveau des couleurs.
|
||||
C'est une bogue répertorié au niveau de Window Maker, il sera corrigé.
|
||||
|
||||
- GNU/Linux en général
|
||||
Assurez-vous que /usr/local/lib figure dans /etc/ld.so.conf et que vous
|
||||
avez lancé ldconfig après l'installation.
|
||||
Désinstallez tout précédent paquetage de Window Maker avant d'installer
|
||||
une nouvelle version.
|
||||
|
||||
- RedHat GNU/Linux
|
||||
Il peut y avoir plusieurs problèmes ennuyeux sur les systèmes RedHat.
|
||||
Voici la marche à suivre sous peine de ne pouvoir utiliser Window Maker
|
||||
sur ces systèmes :
|
||||
|
||||
* si la version de Window Maker livrée avec RedHat est installée,
|
||||
désinstallez-la avant de mettre à jour votre système;
|
||||
|
||||
* assurez-vous que ni la variable d'environnement LANG ni LINGUAS ne
|
||||
contiennent "en_RN";
|
||||
|
||||
* vérifiez que /usr/local/bin est présent dans votre variable d'environnement
|
||||
PATH;
|
||||
|
||||
* il faut que /usr/local/lib soit dans /etc/ld.so.conf avant de lancer
|
||||
ldconfig;
|
||||
|
||||
* si vous rencontrez des messages d'erreur en rapport avec "--no-reexec",
|
||||
désinstallez libtool-1.2b et installez libtool-1.3.
|
||||
libtool-1.3 peut être trouvé sur ftp.gnu.org.
|
||||
Consultez aussi la section PROBLEMES;
|
||||
|
||||
* si vous aviez auparavant installé le paquetage de Window Maker livré
|
||||
avec RedHat et que vous voulez installer maintenant manuellement une nouvelle
|
||||
version, vous devez au préalable désinstaller le paquetage provenant de la
|
||||
RedHat;
|
||||
|
||||
* assurez-vous qu'il existe un lien symbolique de from /usr/include/X11 vers
|
||||
/usr/X11R6/include/X11 (le cas échéant, lancez cette commande :
|
||||
ln -s /usr/X11R6/include/X11 /usr/include/X11);
|
||||
|
||||
* assurez-vous que /lib/cpp pointe bien vers le programme cpp
|
||||
|
||||
Si vous avez un doute concernant quoi que ce soit de relatif à l'installation
|
||||
de Window Maker sur une RedHat, n'hésitez pas à contacter le support
|
||||
utilisateur de RedHat. Ils vous renseigneront toujours et tenteront de vous
|
||||
dépanner dans l'utilisation et la configuration de votre système RedHat.
|
||||
D'un autre côté, ils sont plus au fait que nous pour tout ce qui est relatif
|
||||
aux RedHat (nous n'en utilisons pas).
|
||||
|
||||
- PowerPC MkLinux
|
||||
Installez la version la plus récente de Xpmac. Les versions plus
|
||||
anciennes semblent contenir un bogue qui est susceptible de bloquer
|
||||
le système.
|
||||
|
||||
- Debian GNU/Linux
|
||||
Si vous voulez bénéficier du support des fichier JPEG et TIFF,
|
||||
assurez-vous que les paquetages libtiff-dev et libjpeg-dev sont installés.
|
||||
|
||||
- SuSE GNU/Linux
|
||||
Désinstallez tout précédent paquetage de Window Maker avant d'installer
|
||||
une nouvelle version. Le cas échéant, vous pourriez rencontrer des
|
||||
problèmes.
|
||||
|
||||
- MetroX (version indéterminée)
|
||||
MetroX contient un bogue qui corrompt les pixmaps utilisées en fond
|
||||
de fenêtres. Si vous utilisez MetroX et rencontrer des problèmes
|
||||
avec les textures, n'utilisez pas les textures dans les barres de titre,
|
||||
ou bien utilisez un autre serveur X.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
============
|
||||
|
||||
Compiler Window Maker
|
||||
---------------------
|
||||
Pour aller vite, tapez ce qui suit sous un prompt shell :
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
puis, loguez-vous en tant que root and tapez :
|
||||
|
||||
make install
|
||||
ldconfig
|
||||
|
||||
ou, si vous voulez ôter les infos de débogage des exécutables et les
|
||||
rendre plus petits, tapez plutôt :
|
||||
|
||||
make install-strip
|
||||
ldconfig
|
||||
|
||||
Tout ceci compile et installe Window Maker avec les réglages par défaut.
|
||||
|
||||
Maintenant, si vous voulez personnaliser des options de compilation, vous
|
||||
pouvez faire :
|
||||
|
||||
1. (optionnel) Consulter la section OPTIONS DE CONFIGURATION
|
||||
dans ce même fichier. Exécutez aussi :
|
||||
|
||||
./configure --help
|
||||
|
||||
pour avoir la liste des autres options disponibles.
|
||||
|
||||
2. Lancez configure avec les options choisies. Par exemple, si vous voulez
|
||||
utiliser l'option --enable-kde, tapez :
|
||||
|
||||
./configure --enable-kde
|
||||
|
||||
3. (optionnel) Editez src/wconfig.h avec votre editeur de texte favori et
|
||||
et modifiez sont contenu à votre guise.
|
||||
|
||||
4. Compilez. Il faut juste taper :
|
||||
|
||||
make
|
||||
|
||||
5. Loguez-vous en tant que root (si vous ne pouvez pas le faire, lisez le
|
||||
paragraphe "Je n'ai pas le mot de passe de root :-(") et installez
|
||||
Window Maker sur votre système :
|
||||
su root
|
||||
make install
|
||||
|
||||
|
||||
Réglages pour un utilisateur
|
||||
----------------------------
|
||||
|
||||
Ces instructions suivantes ne sont pas nécessaires si vous mettez à jour
|
||||
Window Maker à partir d'une version plus ancienne, à moins que ce soit
|
||||
précisé dans le fichier NEWS.
|
||||
|
||||
Chaque utilisateur qui veut utiliser Window Maker sur votre système doit
|
||||
faire ce qui suit :
|
||||
|
||||
1. Installer les fichiers de configuration de Window Maker dans son
|
||||
répertoire personnel.
|
||||
|
||||
Pour ceci, il doit taper :
|
||||
wmaker.inst
|
||||
|
||||
wmaker.inst installera les fichiers de configuration de Window Maker
|
||||
pour l'utilisateur et configurera ses paramètres de X de façon à ce que
|
||||
Window Maker soit automatiquement lancé au démarrage de X.
|
||||
|
||||
C'est tout!
|
||||
|
||||
Vous pouvez aussi taper "man wmaker" afin d'obtenir plus de renseignements
|
||||
sur la configuration et d'autres sujets.
|
||||
|
||||
Consultez le Guide de l'utilisateur afin d'obtenir des informationss plus
|
||||
en détail sur Window Maker.
|
||||
|
||||
Pourquoi ne pas aussi jeter un oeil aux FAQs..
|
||||
|
||||
|
||||
|
||||
Installation du paquetage additionnel
|
||||
-------------------------------------
|
||||
|
||||
Décompressez WindowMaker-extra-<version-number>.tar.gz dans /usr/local/share
|
||||
|
||||
Vous trouverez le fichier sur ftp://ftp.windowmaker.org. Ce paquetage est optionnel,
|
||||
il contient des icônes et des thèmes supplémentaires. Vérifiez que vous avez
|
||||
bien la derniere version de ce paquetage.
|
||||
Il y a aussi un fichier WindowMaker-extra.readme qui indique comment procéder à
|
||||
l'installation de ce paquetage.
|
||||
|
||||
|
||||
|
||||
Je n'ai pas le mot de passe de root :-(
|
||||
---------------------------------------
|
||||
|
||||
Si vous n'avez pas acc-s aux privilèges du super-utilisateur (root), vous pouvez
|
||||
installer Window Maker dans votre répertoire personnel. Pour ce faire, ajoutez
|
||||
l'option --prefix correctement renseignée au moment de l'exécution de ./configure
|
||||
(étape 2 de la compilation de Window Maker).
|
||||
Il est aussi nécessaire d'utiliser l'option --with-appspath, afin de préciser
|
||||
le chemin d'accès à WPrefs.app. Par exemple :
|
||||
|
||||
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Apps
|
||||
|
||||
|
||||
Puis, faites en sorte que /home/jshmoe/bin soit inclus dans votre PATH, ajoutez
|
||||
/home/jshmoe/lib à votre variable d'environnement LD_LIBRARY_PATH puis lancez
|
||||
bin/wmaker.inst
|
||||
|
||||
Bien sûr, /home/jshmoe est supposé être remplacé par votre répertoire personnel.
|
||||
|
||||
|
||||
MISE A JOUR
|
||||
===========
|
||||
|
||||
Si vous mettez à jour une version plus ancienne de Window Maker :
|
||||
|
||||
1. Configurez et compilez Window Maker comme d'habitude
|
||||
2. Installez Window Maker (mais n'exécutez pas wmaker.inst)
|
||||
3. Consultez le fichier NEWS et mettez à jour vos fichiers de configuration
|
||||
si nécessaire.
|
||||
|
||||
|
||||
PROBLEMES
|
||||
=========
|
||||
|
||||
Si vous rencontrez des problèmes pendant la phase de configuration, comme par
|
||||
exemple l'impossibilité d'utiliser une librairie de manipulation de format
|
||||
graphique alors que vous pensez qu'elle est installée, jetez un oeil au contenu
|
||||
du fichier config.log, vous y trouverez peut-être des indices pour résoudre
|
||||
ce problème.
|
||||
|
||||
|
||||
== erreur de chargement de polices, même si elles existent
|
||||
|
||||
Essayez de recompiler sans le support pour le NLS.
|
||||
|
||||
|
||||
== erreur à la configuration
|
||||
|
||||
ltconfig: unrecognized option `--no-reexec'
|
||||
Try `ltconfig --help' for more information.
|
||||
configure: error: libtool configure failed
|
||||
|
||||
Otez l'option --no-reexec du fichier aclocal.m4 et relancer la configuration.
|
||||
Assurez vous aussi que les versions d'autoconf et d'automake correspondent bien
|
||||
aux pré-requis :
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
|
||||
Notez bien que ce ne doit PAS être libtool 1.2b, mais libtool bien 1.3,
|
||||
disponible sur les sites GNU.
|
||||
|
||||
|
||||
== configure ne trouve pas libtiff ou une autre librairie graphique
|
||||
|
||||
Effacez le fichier config.cache, et exécutez à nouveau configure avec les options
|
||||
suivantes (en plus des options que vous utilisiez déjà) :
|
||||
--with-libs-from="-L/usr/local/lib"
|
||||
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
|
||||
Insérez les chemins d'accès aux librairies graphiques et à leurs fichiers d'en-tête.
|
||||
Plusieurs chemins d'accès peuvent être ajoutés pour chacune de ces options,
|
||||
comme montré pour --with-incs-from. Séparez-les juste par un espace.
|
||||
|
||||
|
||||
== configure ne trouve pas libXpm
|
||||
|
||||
* Vérifiez que vous avez un lien sympbolique de libXpm.so.4.9 vers libXpm.so
|
||||
|
||||
|
||||
== segmentation fault au démarrage
|
||||
|
||||
* Vérifiez que la version de libXPM qui est installée est au moins 4.7.
|
||||
|
||||
* Vérifiez que votre fichier ~/GNUstep/Defaults/WindowMaker est à jour.
|
||||
|
||||
Si vous n'en êtes pas sûr, renommez ~/GNUstep en ~/GNUtmp et lancez wmaker.inst.
|
||||
|
||||
|
||||
== "...: your machine is misconfigured. gethostname() returned (none)"
|
||||
|
||||
* Le nom d'hôte de votre machine n'est pas indiqué ou est invalide (il commence
|
||||
par une parenthèse par exemple). Consultez les pages du manuel (man hostname) pour
|
||||
savoir comment le positionner correctement.
|
||||
|
||||
|
||||
== Le menu des applications ne contient que 2 entrées ("XTerm" et "Exit...")
|
||||
|
||||
* Window Maker ne trouve pas cpp (le preprocesseur de C). Si votre cpp n'est pas situé
|
||||
dans /lib/cpp, editez src/config.h et modifiez le chemin d'accès dans CPP_PATH en conséquent.
|
||||
|
||||
== checking lex output file root... configure: error: cannot find output from true; giving up
|
||||
|
||||
* Consultez la section PRE-REQUIS dans ce même fichier.
|
||||
|
||||
|
||||
LOCALES/INTERNATIONALISATION
|
||||
============================
|
||||
|
||||
Window Maker supporte les langues étrangères. Pour activer cette fonctionalité,
|
||||
vous devez compiler Window Maker avec des paramètres supplémentaires.
|
||||
|
||||
|
||||
0 - GNU gettext doit être installé. Il peut être trouvé ici :
|
||||
ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
|
||||
|
||||
Vous pouvez passer à l'étape 4 si vous utilisez le script Install.
|
||||
|
||||
1 - Il vous faut choisir les langues que vous voulez rendre disponible. Modifiez
|
||||
pour cela la liste des codes de nationalité dans LINGUAS. L'anglais est inclus
|
||||
de façon implicite dans cette liste. Par exemple :
|
||||
|
||||
setenv LINGUAS "pt ja de"
|
||||
sous csh
|
||||
|
||||
ou
|
||||
|
||||
export LINGUAS;LINGUAS="pt ja de"
|
||||
sous sh
|
||||
|
||||
La liste de tous les codes de nationalité peut être trouvée dans po/README.
|
||||
L'anglais est la langue par défault.
|
||||
|
||||
Lisez po/README si vous souhaitez traduire ou maintenir les fichiers propres
|
||||
à d'autres adaptations nationales.
|
||||
|
||||
2 - De plus, si votre langue utilise des caractères multi-octets, comme
|
||||
le japonais ou le coréen, vous devez vous assurer que l'option MultiByteText est à YES
|
||||
dans ~/GNUstep/Defaults/WMGLOBAL.
|
||||
|
||||
3 - Configurez, compilez et installez Window Maker normalement.
|
||||
|
||||
4 - Pour choisir une langue particulière à l'exécution, vous devez positionner la variable
|
||||
d'environnement LANG avec la valeur correspondant au code de nationalité adéquat.
|
||||
Par exemple, si vous voulez utiliser le portugais, vous devez faire :
|
||||
|
||||
setenv LANG pt
|
||||
|
||||
sous csh ou
|
||||
|
||||
export LANG; LANG=pt
|
||||
|
||||
sous Bourne sh et apparentés
|
||||
|
||||
Note : si la variable d'environnement LC_CTYPE est positionnée, vous devez l'ôter de
|
||||
l'environnement (unset LC_CTYPE), avant d'exécuter Window Maker.
|
||||
|
||||
En ce qui concerne les fichiers de configuration des menus, Window Maker procède
|
||||
à une recherche suivant cet ordre (pour le portugais brésilien, dans ce cas) :
|
||||
|
||||
menu.pt_BR
|
||||
menu.pt
|
||||
menu
|
||||
|
||||
|
||||
5 - Si vous choisissez une langue qui utilise les caractères multi-octets, vous
|
||||
devez configurer les polices de façon adéquate. Consultez pour cela les pages
|
||||
de manuel de XCreateFontSet. Vous devez modifier dans votre fichier ~/G/D/WindowMaker
|
||||
les polices utilisées dans les titres, menus et autres. En ce qui concerne les polices
|
||||
utilisées dans les boîte de dialogue, modifiez ~/G/D/WMGLOBAL.
|
||||
Le %d dans la définition des polices ne doit PAS être enlevé. Vous pouvez aussi utiliser
|
||||
le script wsetfont, fourni à ces fins.
|
||||
Consultez le script lui-même pour en connaître les instructions.
|
||||
|
||||
Par exemple, vous pouvez mettre ceci dans ~/G/D/WindowMaker :
|
||||
|
||||
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
|
||||
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
|
||||
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
|
||||
|
||||
et dans ~/G/D/WMGLOBAL :
|
||||
|
||||
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
|
||||
Les 2 polices ci-dessus sont uniquement utilisées par les applications qui utilisent
|
||||
WINGs (Window Maker et WPrefs.app).
|
||||
|
||||
Le script wsetfont inclus vous permettra de changer les réglages des polices de
|
||||
façon plus aisée. Consultez-le afin d'obtenir plus d'informations.
|
||||
610
INSTALL.sk
Normal file
610
INSTALL.sk
Normal file
@@ -0,0 +1,610 @@
|
||||
|
||||
In¹trukcie pre in¹taláciu Window Makera
|
||||
|
||||
|
||||
|
||||
PODPOROVANÉ PLATFORMY
|
||||
=====================
|
||||
(tzn: vraj to na tom niekto skompiloval...)
|
||||
|
||||
- Intel GNU/Linux Conectiva 5.9 (beta)
|
||||
- Intel GNU/Linux Slackware
|
||||
- Intel GNU/Linux Debian
|
||||
- Intel GNU/Linux other distributions
|
||||
- Sparc GNU/Linux RedHat 5.1
|
||||
- PowerPC GNU/MkLinux
|
||||
- Alpha GNU/Linux RedHat 5.1
|
||||
- FreeBSD
|
||||
- NetBSD
|
||||
- OpenBSD
|
||||
- BSDI 4.0
|
||||
- Solaris 2.5.1, 2.5.2
|
||||
- Solaris 2.6.0
|
||||
- Solaris 2.7beta
|
||||
- SCO Unix
|
||||
- SGI Irix 5.x, 6.5
|
||||
- OSF/1
|
||||
- HP-UX
|
||||
- AIX 3.2.5
|
||||
- AIX 4.1.4 / IBM PowerPC
|
||||
- AIX 4.3.1 / IBM CC compiler
|
||||
- AIX 4.3.2 / IBM PowerPC
|
||||
- AIX 5.3
|
||||
- DEC Alpha/Digital UNIX 4.x
|
||||
- XFree86 / OS/2
|
||||
- Corel NetWinder
|
||||
- SunOS 4.x
|
||||
- PowerMac / Power MachTen 4.1.1 over MacOS
|
||||
- Amiga 3000 running RedHat Linux 5.1 (Rawhide)
|
||||
- IBM S/390 running Linux
|
||||
- iBook running Darwin
|
||||
|
||||
Patche na rozbehanie na iných platformách sú vítané.
|
||||
|
||||
|
||||
PO®IADAVKY:
|
||||
===========
|
||||
|
||||
Nasledovný softvér je potrebný pre beh Window Makera:
|
||||
|
||||
- X11R6.x
|
||||
Window Maker mô¾e by» skompilovaný na star¹ích verziách X, ako
|
||||
X11R5 (Solaris) alebo X11R4 (OpenWindows) ale nebude pracova»
|
||||
100% korektne. Na takých serveroch nebudú ikony aplikácií a budete
|
||||
ma» problémy s pou¾ívaním doku. Upgrade klientských kni¾níc (Xlib,
|
||||
Xt, atï.) pomô¾e, ak u¾ nemô¾ete spravi» upgrade servera.
|
||||
|
||||
Nasledovné je potrebné k skompilovaniu Window Makera:
|
||||
|
||||
- Základné be¾né veci
|
||||
Ak chcete kompilova» Window Maker, uistite sa, ¾e máte gcc (alebo
|
||||
iný ANSI C kompilátor) a hlavièkové súbory iXov. Hlavne pre zaèia-
|
||||
toèníkov v Linuxe: musíte nain¹talova» v¹etky X-devel balíky a gcc.
|
||||
Inak nebudete schopní skompilova» ¾iadny program pre X, teda ani
|
||||
Window Maker.
|
||||
|
||||
- libPropList
|
||||
Túto kni¾nicu mo¾no nájs» na ftp://ftp.windowmaker.org/pub/libs alebo
|
||||
ftp://ftp.gnome.org/pub/libPropList. Nain¹talujte ju pred kompiláciou
|
||||
Window Makera.
|
||||
|
||||
- autoconf, automake a libtool
|
||||
Tieto nástroje NIE sú potrebné, ale ak máte niektoré z nich nain¹talo-
|
||||
vané, uistite sa, ¾e V©ETKY sú presne nasledovné verzie:
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
Ak máte odli¹né verzie, odin¹talujte ich alebo ich doèasne premenujte.
|
||||
Ak neprogramujete, nebudete ich potrebova» a teda ich mô¾ete
|
||||
odin¹talova».
|
||||
|
||||
- lex (alebo flex) a yacc (alebo bison)
|
||||
Tieto sú vyu¾ívané z libPropList. Lex v skutoènosti nie je nutný,
|
||||
lebo jeho výstupný súbor je prítomný, ale buï ja alebo automake je
|
||||
hlupák, lebo configuraèný skript pre libPropList sa jednoducho
|
||||
ukonèí z neznámych dôvodov ak lex nie je prítomný.
|
||||
|
||||
|
||||
|
||||
NEPOVINNÉ:
|
||||
==========
|
||||
|
||||
Tieto kni¾nice nie sú nutné pre beh Window Makera, ale sú podporované
|
||||
v prípade, ¾e ich chcete pou¾íva». Èísla verzií sú tie, ktoré som pou¾il
|
||||
ja (teda urèite fungujú), ale aj iné verzie mô¾u pracova» správne.
|
||||
|
||||
|
||||
- libXPM 4.7 alebo nov¹ia
|
||||
Star¹ie verzie nemusia fungova»!!!
|
||||
Dostupné na ftp://sunsite.unc.edu/pub/Linux/libs/X/
|
||||
|
||||
Podpora XPM je aj vstavaná, ale nenaèíta obrázky v
|
||||
ne¹tandardných kódovaniach.
|
||||
|
||||
- libpng 0.96 alebo nov¹ia a zlib
|
||||
Pre podporu obrázkov PNG.
|
||||
http://www.cdrom.com/pub/png/
|
||||
|
||||
- libtiff 3.4 alebo nov¹ia
|
||||
Pre podporu obrázkov TIFF.
|
||||
ftp://ftp.sgi.com/graphics/tiff
|
||||
|
||||
- libjpeg 6.0.1 alebo nov¹ia
|
||||
Pre podporu obrázkov JPEG.
|
||||
http://www.ijg.org/
|
||||
|
||||
- libgif 2.2 alebo libungif
|
||||
Pre podporu obrázkov GIF.
|
||||
ftp://prtr-13.ucsc.edu/pub/libungif/
|
||||
|
||||
- GNU xgettext
|
||||
Ak chcete pou¾íva» prelo¾ené hlásenia, potrebujete GNU gettext.
|
||||
Iné verzie gettext nie sú kompatibilné a nebudú fungova».
|
||||
Stiahnite si GNU verziu z ftp://ftp.gnu.org
|
||||
|
||||
|
||||
|
||||
MO®NOSTI CONFIGURE:
|
||||
===================
|
||||
|
||||
Tieto mo¾nosti mô¾u by» dané skriptu configure ako argumenty za úèelom
|
||||
povolenia/zakázania urèitých vlastností Window Makera. Príklad:
|
||||
|
||||
./configure --enable-kde --enable-gnome
|
||||
|
||||
nakonfiguruje Window Maker s podporou KDE a GNOME.
|
||||
|
||||
|
||||
Zoznam v¹etkých mo¾ností vypí¹e príkaz ./configure --help
|
||||
|
||||
--with-libs-from
|
||||
cesty, kde sa majú hµada» kni¾nice. Re»azec -L musí predchádza»
|
||||
ka¾dú cestu, napr.:
|
||||
--with-libs-from="-L/opt/libs -L/usr/local/lib"
|
||||
|
||||
--with-incs-from
|
||||
cesty, kde sa majú hµada» hlavièkové súbory. Re»azec -I musí
|
||||
predchádza» ka¾dú cestu, napr.:
|
||||
--with-incs-from="-I/opt/headers -I/usr/local/include"
|
||||
|
||||
--enable-single-icon
|
||||
umo¾òuje zrolovanie v¹etký ikon aplikácií WM_CLASS+WM_INSTANCE do
|
||||
jedinej. Táto vlastnos» nie je podporovaná zo strany vývojárov.
|
||||
V prípade problémov s òou, kontaktujte autora:
|
||||
Christopher Seawood <cls@seawood.org>
|
||||
|
||||
--disable-shm
|
||||
zaká¾e pou¾itie roz¹írenia zdieµanej pamäte MIT. Toto trochu spomalí
|
||||
generovanie textúr, ale v niektorých prípadoch je táto voµba potrebná
|
||||
kvôli chybe, ktorá spôsobuje nesprávne zobrazovanie ikon a textúr.
|
||||
|
||||
--disable-motif
|
||||
zaká¾e podporu pre pokyny mana¾éra okien wmw
|
||||
|
||||
--enable-openlook
|
||||
povolí podporu pre pokyny mana¾éra okien OPEN LOOK(tm)
|
||||
|
||||
--enable-gnome
|
||||
povolí podporu pre pokyny mana¾éra okien GNOME
|
||||
|
||||
--enable-kde
|
||||
povolí podporu pre pokyny mana¾éra okien kde/kwm
|
||||
|
||||
--enable-lite
|
||||
odstráni veci, ktoré sa u¾ nachádzajú v desktopových prostrediach
|
||||
ako KDE a GNOME. Odstránené veci sú: zoznam okien, menu aplikácií,
|
||||
výber viacerých okien. Vedzte, ¾e u¾ nebudete schopní ukonèi»
|
||||
Window Maker; budete ho musie» zabi» pou¾itím signálu SIGTERM alebo
|
||||
ho ukonèi» z KDE. Neodporúèa sa povoli» túto vlastnos».
|
||||
|
||||
--enable-modelock
|
||||
podpora pre XKB nastavenie jazyka. Ak neviete, èo to je, pravdepo-
|
||||
dobne to nepotrebujete. (Slú¾i to na prepínanie rozlo¾enia kláves
|
||||
pomocou nového tlaèidla na hornom paneli okien.)
|
||||
|
||||
--enable-sound
|
||||
povolí podporu pre modul zvukových efektov
|
||||
|
||||
--disable-xpm
|
||||
zaká¾e podporu pre kni¾nicu XPM aj keï je dostupná na va¹om systéme.
|
||||
|
||||
--disable-png
|
||||
zaká¾e pou¾itie kni¾nice PNG
|
||||
|
||||
--disable-tiff
|
||||
zaká¾e pou¾itie kni¾nice TIFF
|
||||
|
||||
--disable-gif
|
||||
zaká¾e pou¾itie kni¾nice GIF
|
||||
|
||||
--disable-jpeg
|
||||
zaká¾e pou¾itie kni¾nice JPEG
|
||||
|
||||
--disable-shape
|
||||
zaká¾e tvarované okná (pre oclock, xeyes atï.)
|
||||
|
||||
|
||||
POZNÁMKY PRE ©PECIFICKÉ PLATFORMY:
|
||||
==================================
|
||||
|
||||
- DEC/Alpha
|
||||
|
||||
Nasledovný mail nie je prelo¾ený, ale hovorí sa v òom, ¾e
|
||||
_pravdepodobne_ nie je nutné konfigurova» Window Maker na
|
||||
Alphe s voµbou --disable-shm.
|
||||
|
||||
#>>>>>>>>>>>
|
||||
From: Anton Ivanov <aivanov@eu.level3.net>
|
||||
To: Marcelo E. Magallon <mmagallo@debian.org>
|
||||
Subject: Re: Is the WindowMaker package working ok on Alpha?
|
||||
|
||||
> Hi,
|
||||
>
|
||||
> I was reading some docs on the WindowMaker tarball, and found this:
|
||||
>
|
||||
> | - DEC/Alpha machines
|
||||
> | You might need to pass the --disable-shm flag to configure,
|
||||
> | like ./configure --disable-shm
|
||||
>
|
||||
> is anyone having problems with WindowMaker on Alpha? Can someone
|
||||
> please test this? Should the flag be passed when building on Alpha?
|
||||
|
||||
Disclaimer: alphas under my command have never run X and are least likely to
|
||||
suddenly start running it anytime soon.
|
||||
|
||||
Alpha used to have some ridiculously low amount of shared memory
|
||||
configured.
|
||||
So quite a lot of apps used to barf. Namely - cdrecord, mysql server, etc.
|
||||
|
||||
Check where is yours at the moment and raise it to a more appropriate
|
||||
value by either catting to the appropriate /proc entry or changing the
|
||||
/usr/src/linux/include/asm/shmparam.h.
|
||||
|
||||
Otherwise the shared memory on alpha should be fully functional and I
|
||||
see no reason to disable it. Mine are bumped up to 32 or more on most
|
||||
machines.
|
||||
|
||||
And If I recall correctly the comments in that file are actually
|
||||
wrong. Value is not bytes, but in machine size word. For alpha *8.
|
||||
|
||||
As I said - I do not run X on them so all #include "stdisclaimer.h"
|
||||
apply.
|
||||
#<<<<<<<<<<<<
|
||||
|
||||
|
||||
- SCO Unix - spustite configure takto
|
||||
CFLAGS="-belf -DANSICPP" ./configure
|
||||
|
||||
- SunOS, Solaris
|
||||
Ak máte nain¹alované gcc, spustite configure takto:
|
||||
CPP_PATH="gcc -E -x c" ./configure
|
||||
Cpp od Sunu chýbajú niektoré vlastnosti, ktoré Window Maker potrebuje,
|
||||
a to mô¾e spôsobi» problémy pri parsovaní konfiguraèných súborov.
|
||||
Je tie¾ mo¾né, ¾e budete musie» pou¾i» --with-libs-from a
|
||||
--with-incs-from na urèenie ciest k libtiff.
|
||||
Niekto mi mailoval, ¾e tie¾ /usr/local/lib musí by» prvá cesta v
|
||||
premennej LD_LIBRARY_PATH, aby to fungovalo.
|
||||
Ak máte Ultra Creator 3D alebo iný stroj s high-end grafikou,
|
||||
uistite sa, ¾e spú¹»ate iXy s 24-bitovou farebnou håbkou alebo
|
||||
mô¾ete ma» problémy s pomie¹anými farbami. Toto je chyba wmakera
|
||||
a bude opravená.
|
||||
|
||||
- GNU/Linux vo v¹eobecnosti
|
||||
Uistite sa, ¾e máte /usr/local/lib v /etc/ld.so.conf a ¾e ste
|
||||
po in¹talácii spustili ldconfig.
|
||||
Odin¹talujte v¹etky balíkované verzie Window Makera pred in¹talovaním
|
||||
novej verzie.
|
||||
|
||||
- RedHat GNU/Linux
|
||||
Systémy RedHat majú niekoµko nepríjemných problémov. Ak ich pou¾ívate,
|
||||
dodr¾ujte nasledovné kroky, alebo vám Window Maker nebude fungova»:
|
||||
|
||||
* ak máte nain¹alovaný Window Maker, ktorý je dodaný s RedHatom,
|
||||
pred upgadom ho odin¹talujte;
|
||||
|
||||
* uistite sa, ¾e nemáte premenné LANG a LINGUAS nastavené na en_RN;
|
||||
|
||||
* uistite sa, ¾e máte /usr/local/bin v premennej PATH;
|
||||
|
||||
* uistite sa, ¾e máte /usr/local/lib v /etc/ld.so.conf pred
|
||||
spustením ldconfig;
|
||||
|
||||
* ak máte problémy, v ktorých sa spomína chyba s --no-reexec,
|
||||
odin¹talujte libtool-1.2b a nain¹talujte libtool-1.3. libtool-1.3
|
||||
nájdete na ftp.gnu.org. Tie¾ si preèítajte èas» RIE©ENIE PROBLÉMOV.
|
||||
|
||||
|
||||
* uistite sa, ¾e máte symbolický odkaz z /usr/include/X11 na
|
||||
/usr/X11R6/include/X11 (ak nie, zadajte ln -s /usr/X11R6/include/X11
|
||||
/usr/include/X11 )
|
||||
|
||||
* uistite sa, ¾e /lib/cpp odkazuje na program cpp
|
||||
|
||||
Ak máte akékoµvek pochybnosti, prosím, neotáµajte a spojte sa
|
||||
s u¾ívateµskou podporou RedHatu. Radi vám odpovedia na v¹etky
|
||||
va¹e otázky týkajúce sa ich systému. Vedia toho o svojom
|
||||
systéme viac ako my (nepou¾ívame RedHat).
|
||||
|
||||
|
||||
- PowerPC MkLinux
|
||||
Musíte ma» poslednú verziu Xpmac. Star¹ie verzie majú asi chyby,
|
||||
ktoré spôsobujú zmrznutie celého systému.
|
||||
|
||||
- Debian GNU/Linux
|
||||
Ak chcete podporu JPEG a TIFF, uistite sa, ¾e máte nain¹talované
|
||||
libiff-dev a libjpeg-dev.
|
||||
|
||||
- SuSE GNU/Linux
|
||||
Ak ste si nain¹talovali balík Window Makera od SuSE, odin¹talujte
|
||||
ho pred pokusmi o skompilovanie wmakera, alebo mô¾ete ma» problémy.
|
||||
|
||||
- MetroX (neznáma verzia)
|
||||
MetroX má chybu, ktorá kazí obrázky, ktoré sú nastavené ako pozadie
|
||||
okien. Ak pou¾ívate MetroX a máte èudné problémy s textúrami,
|
||||
nepou¾ívajte textúry v horných li¹tách. Alebo pou¾ite iný X server.
|
||||
|
||||
|
||||
IN©TALÁCIA:
|
||||
===========
|
||||
|
||||
Kompilácia Window Makera
|
||||
------------------------
|
||||
Pre rýchly ¹tart, zadajte nasledovné príkazy v shelly:
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
potom sa prihláste ako root a zadajte:
|
||||
|
||||
make install
|
||||
ldconfig
|
||||
|
||||
alebo ak chcete z binárnych súborov odstráni» symboly pre debugger a urobi»
|
||||
ich men¹ie, napí¹te miesto toho
|
||||
|
||||
make install-strip
|
||||
ldconfig
|
||||
|
||||
Toto skompiluje a nain¹taluje Window Maker so ¹tandardnými parametrami.
|
||||
|
||||
Ak si chcete prispôsobi» nastavenia kompilácie, mo¾ete to urobi» nasledovne:
|
||||
|
||||
1. (voliteµne) Pozrite sa na èas» MO®NOSTI CONFIGURE, kde sú
|
||||
uvedené mo¾nosti. Tie¾ spustite:
|
||||
|
||||
./configure --help
|
||||
|
||||
ktorý vám vypí¹e kompletný zoznam ostatných mo¾ných nastavení.
|
||||
|
||||
2. Spustite configure s nastaveniami, ktoré chcete. Napríklad,
|
||||
ak chcete pou¾íva» podporu pre KDE, zadajte:
|
||||
|
||||
./configure --enable-kde
|
||||
|
||||
3. (voliteµne) Otvorte si súbor src/wconfig.h vo svojom obµúbenom
|
||||
textovom editore a prejdite si ho, èi nenájdete nejaké nastavenia,
|
||||
ktoré chcete zmeni».
|
||||
|
||||
4. Kompilácia. Zadajte len:
|
||||
|
||||
make
|
||||
|
||||
5. Prihláste sa ako root (ak to nie je mo¾né, èítajte èas» "Nemám
|
||||
rootove heslo :-( ") a nain¹talujte Window Maker:
|
||||
|
||||
su root
|
||||
make install
|
||||
|
||||
|
||||
Nastavenia ¹pecifické pre u¾ívateµov
|
||||
------------------------------------
|
||||
|
||||
Nemusíte sa dr¾a» týchto in¹trukcií, ak robíte upgrade Window Makera zo
|
||||
star¹ej verzie, pokiaµ to nie je uvedené v súbore NEWS.
|
||||
|
||||
Ka¾dý u¾ívateµ na va¹om systéme, ktorý chce pou¾íva» Window Maker, musí
|
||||
urobi» nasledovné:
|
||||
|
||||
1. Nain¹talova» konfiguraèné súbory Window Makera do svojho
|
||||
domovského adresára:
|
||||
|
||||
wmaker.inst
|
||||
|
||||
wmaker.inst nain¹taluje konfiguraèné súbory Window Makera a nastaví
|
||||
iXy aby sa pri ¹tarte automaticky spustil Window Maker.
|
||||
|
||||
To je v¹etko!
|
||||
|
||||
Základné informácie o konfigurácii a iných veciach vám poskytne
|
||||
"man wmaker".
|
||||
|
||||
Pre hlb¹í úvod do Window Makera si preèítajte si U¾ívateµký manuál.
|
||||
|
||||
Tie¾ sa mô¾te pozrie» na FAQ.
|
||||
|
||||
|
||||
|
||||
Installing the extras package
|
||||
-----------------------------
|
||||
|
||||
Unpack WindowMaker-extra-<version-number>.tar.gz in /usr/local/share
|
||||
|
||||
You can get the file at ftp://ftp.windowmaker.org. This file is optional
|
||||
and only have a few icons, and themes. Look for the latest <version-number>
|
||||
available.
|
||||
Also there is a WindowMaker-extra.readme to instruct you where that package
|
||||
should go.
|
||||
|
||||
|
||||
|
||||
Nemám rootove heslo :(
|
||||
----------------------
|
||||
|
||||
Ak nemáte práva roota, mô¾ete si nain¹talova» Window Maker do svojho
|
||||
domovského adresára. Na to musíte pou¾i» voµbu --prefix pre configure
|
||||
v druhom kroku kompilácie Window Makera. Tie¾ musíte pou¾i» voµbu
|
||||
--with-appspath, pomocou ktorej ¹pecifikujete cestu pre WPrefs.app.
|
||||
Príklad:
|
||||
|
||||
./configure --prefix=/home/jshome --with-appspath=/home/jshome/GNUstep/Apps
|
||||
|
||||
Poto pridajte adresár /home/jshome/bin do premennej PATH, /home/jshome/lib
|
||||
do premennej LD_LIBRARY_PATH a spustite bin/wmaker.inst
|
||||
|
||||
Samozrejme, predpokladá sa, ¾e /home/jshome nahradíte va¹im skutoèným
|
||||
domovským adresárom.
|
||||
|
||||
|
||||
UPGRADE
|
||||
=======
|
||||
|
||||
Ak robíte upgrade zo star¹ej verzie Window Makera:
|
||||
|
||||
1. Skofigurujte a skompilujte Window Maker ako v¾dy
|
||||
2. Nain¹talujte Window Maker (ale nespustite wmaker.inst)
|
||||
3. Preèítajte si súbor NEWS a ak je to potrebné, upravte
|
||||
svoje konfiguraèné súbory.
|
||||
|
||||
|
||||
RIE©ENIA PROBLÉMOV
|
||||
==================
|
||||
|
||||
Ak máte problémy poèas konfigurácie (spú¹»ania configure), napríklad
|
||||
nemo¾nos» pou¾i» grafickú kni¾nicu, o ktorej viete, ¾e ju máte nain¹talovanú,
|
||||
v súbore config.log nájdete príèinu problému.
|
||||
|
||||
== Error with loading fonts, even if they exist.
|
||||
|
||||
Skúste kompiláciu bez podpory NLS.
|
||||
|
||||
== Error when configuring
|
||||
|
||||
ltconfig: unrecognized option `--no-reexec'
|
||||
Try `ltconfig --help' for more information.
|
||||
configure: error: libtool configure failed
|
||||
|
||||
Odstáòte voµbu --no-reexec zo súborov aclocal.m4 a libPropList/aclocal.m4
|
||||
a spustite configure.
|
||||
Tie¾ sa uistite, ¾e autoconf a automake, ktoré máte nain¹talované, sú v
|
||||
týchto verziách:
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
|
||||
Nesmie to by» libtool 1.2b, ale libtool 1.3, zo stránok GNU.
|
||||
|
||||
== Cant find proplist.h or libPropList.something
|
||||
|
||||
Stiahnite a nain¹talujte si libPropList zo stránok uvedených
|
||||
niekde v tomto súbore.
|
||||
|
||||
|
||||
== configure doesn't detect libtiff, or other graphic libraries.
|
||||
|
||||
Odstráòte config.cache, spustite configure s pridanými nasledovnými voµbami
|
||||
(okrem iných, ktoré pou¾ívate):
|
||||
--with-libs-from="-L/usr/local/lib"
|
||||
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
|
||||
Vlo¾te cesty k va¹im grafickým kni¾niciam a zodpovedajúcim hlavièkovým
|
||||
súborom. Mô¾ete vlo¾i» viac ciest do ka¾dej z týchto volieb, ako je to
|
||||
uvedené v príklade --with-incs-from. Len ich oddeµte medzerou.
|
||||
|
||||
|
||||
== configure doesn't detect libXpm.
|
||||
|
||||
* Skontrolujte, èi máte symbolický odkaz z libXpm.so.4.9 na libXpm.so
|
||||
|
||||
|
||||
== Segmentation fault on startup
|
||||
|
||||
* Skontrolujte verziu libXpm, musíte ma» aspoò 4.7
|
||||
|
||||
* Skontrolujte, èi máte upravenú verziu ~/GNUstep/Defaults/WindowMaker
|
||||
|
||||
Ak si nie ste istí, skúste premenova» ~/GNUstep na ~/GNUtmp a spustite
|
||||
wmaker.inst
|
||||
|
||||
|
||||
== "...: your machine is misconfigured. gethostname() returned (none)"
|
||||
|
||||
* Meno va¹eho poèítaèa je nastavené na nieèo nesprávne, èo zaèína
|
||||
úvodzovkami. Preèítajte si man hostname a dozviete sa, ako to nastavi».
|
||||
|
||||
|
||||
== The root menu contains only 2 entries. ("XTerm" and "Exit...")
|
||||
|
||||
* Window Maker nevie nájs» cpp (C preprocesor). Ak sa vá¹ cpp nenachádza
|
||||
v /lib/cpp, upravte src/config.h a vlo¾te správnu cestu do CPP_PATH.
|
||||
|
||||
|
||||
== checking lex output file root... configure: error: cannot find output from true; giving up
|
||||
|
||||
* Preèítajte si èas» PO®IADAVKY v tomto súbore.
|
||||
|
||||
|
||||
MIESTNE NASTAVENIA/INTERNACIONALIZÁCIA
|
||||
======================================
|
||||
|
||||
Window Maker má podporu pre národné jazyky. Aby ste ju povolili, musíte
|
||||
skompilova» Window Maker s niekoµkými prídavnými parametrami.
|
||||
|
||||
|
||||
0 - Musíte ma» nain¹talovaný balík GNU gettext. Mô¾ete ho nájs» na
|
||||
adrese ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
|
||||
|
||||
Kroky 1 a¾ 3 mô¾ete vynecha», ak pou¾ívate skript Install
|
||||
|
||||
1 - Musíte urèi» jazyky, pre ktoré chcete podporu. Nastavte premennú
|
||||
LINGUAS na zoznam miestnych nastavení, ktoré chcete. Angliètina je
|
||||
podporovaná v¾dy. Príklad:
|
||||
|
||||
setenv LINGUAS "pt ja de"
|
||||
(csh)
|
||||
|
||||
alebo
|
||||
|
||||
export LINGUAS;LINGUAS="pt ja de"
|
||||
(sh)
|
||||
|
||||
Zoznam podporovaných miestnych nastavení nájdete v súbore po/README.
|
||||
Angliètina je implicitným jazykom.
|
||||
|
||||
Ak chcete preklada» a udr¾iava» súbory s miestnymi nastaveniami, preèítajte
|
||||
si súbor po/README.
|
||||
|
||||
2 - Naviac, ak vá¹ jazyk pou¾íva multi-byte znaky, napríklad Japonèina
|
||||
alebo Kórejèina, musíte nastaveniu MultiByteText priradi» YES v súbore
|
||||
~/GNUstep/Defaults/WMGLOBAL
|
||||
|
||||
3 - Konfigurujte, kompilujte a in¹talujte Window Maker ako zvyèajne.
|
||||
|
||||
4 - Urèité miesne nastavenia si zvolíte nastavením premennej LANG na
|
||||
to, ktoré chcete. Napríklad, ak chcete nastavi» slovenské miestne
|
||||
nastavenia, musíte spusti»
|
||||
|
||||
setenv LANG pt
|
||||
|
||||
(csh)
|
||||
|
||||
export LANG; LANG=pt
|
||||
|
||||
(Bourne sh a podobné)
|
||||
|
||||
Pozor: Ak máte nastavenú premennú LC_CTYPE, musíte ju zru¹i» pred
|
||||
spustením wmaker.
|
||||
|
||||
Window Maker hµadá súbory s definíciou menu v nasledovnom poradí
|
||||
(v tomto prípade pre brazílsku portugalèinu):
|
||||
|
||||
menu.pt_BR
|
||||
menu.pt
|
||||
menu
|
||||
|
||||
|
||||
5 - Ak si zvolíte jazyk, ktorý pou¾íva multi-byte znaky, musíte poriadne
|
||||
nastavi» svoje fonty. Preèítajte si manuálovú stránku k XCreateFontSet,
|
||||
kde nájdete viac detailov. Musíte v súbore ~/G/D/WindowMaker upravi» fonty
|
||||
pre horné li¹ty, menu a iné veci. Pre fonty pou¾ité v dialógových oknách
|
||||
upravte súbor ~/G/D/WMGLOBAL. Re»azce %d v menách fontov nesmú by»
|
||||
odstránené. Tie¾ mô¾ete pou¾i» skript wsetfont, ktorý to urobí za vás.
|
||||
|
||||
Napríklad mô¾e zada» v súbore ~/G/D/WindowMaker nasledovné:
|
||||
|
||||
WindowTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
MenuTitleFont = "-*-helvetica-bold-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
MenuTextFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-14-*";
|
||||
IconTitleFont = "-*-helvetica-medium-r-normal-*-8-*,-*-*-medium-r-normal-*-12-*";
|
||||
ClipTitleFont = "-*-helvetica-bold-r-normal-*-10-*,-*-*-medium-r-normal-*-12-*";
|
||||
DisplayFont = "-*-helvetica-medium-r-normal-*-12-*,-*-*-medium-r-normal-*-12-*";
|
||||
|
||||
a v ~/G/D/WMGLOBAL:
|
||||
|
||||
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
|
||||
Tieto dva fonty sa pou¾ijú len v aplikáciách, ktoré pou¾ívajú WINGs
|
||||
(Window Maker a WPrefs.app)
|
||||
|
||||
Skript wsetfont vám umo¾ní nastavi» fonty jednoduch¹ím spôsobom. Pozrite
|
||||
sa priamo do jeho súboru pre bli¾¹ie informácie.
|
||||
|
||||
42
Install
42
Install
@@ -28,6 +28,29 @@ perform() {
|
||||
fi
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "Usage: $(basename $0) <switch>"
|
||||
echo "Where switches are:"
|
||||
echo " -s --quiet make silent build"
|
||||
echo " -h --help show this message"
|
||||
echo ""
|
||||
exit $1
|
||||
}
|
||||
|
||||
|
||||
OPTIONS=""
|
||||
MAKE_OPTIONS=""
|
||||
while [ -n "$1" ]
|
||||
do
|
||||
case "$1" in
|
||||
"-s"|"--quiet") OPTIONS="--quiet"
|
||||
MAKE_OPTIONS="-s";;
|
||||
"-h"|"--help") help 0;;
|
||||
*) echo "bad command-line parameter $1"
|
||||
help 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
trap "echo Window Maker installation aborted. ; exit 1" 2 3
|
||||
|
||||
@@ -144,7 +167,7 @@ if [ "$NLS" = "y" -o "$NLS" = "Y" ]; then
|
||||
ling=` (cd po; /bin/ls *.po) `
|
||||
ALL_LINGUAS=""
|
||||
for l in $ling; do
|
||||
lname=`(cd po; grep Language-Team $l|cut -f 2 -d: |cut -f 2 -d\ )`
|
||||
lname=`(cd po; grep Language-Team $l|cut -f2- -d:|cut -f1 -d\\\\|cut -f1 -d\<)`
|
||||
lname=`echo $lname`
|
||||
lcode=`basename $l .po`
|
||||
ALL_LINGUAS="$ALL_LINGUAS $lcode"
|
||||
@@ -218,6 +241,17 @@ done
|
||||
OPTIONS="$OPTIONS --prefix=$PREFIX"
|
||||
|
||||
|
||||
##################### Install stripped binaries?
|
||||
|
||||
INSTALL="install"
|
||||
echo "Do you want stripped binaries to be installed?"
|
||||
echo "Installed binaries will be smaller (with debug info removed)."
|
||||
echo -n "<y/n> [n] "
|
||||
read foo
|
||||
if [ "$foo" = y -o "$foo" = Y ]; then
|
||||
INSTALL="install-strip"
|
||||
fi
|
||||
|
||||
|
||||
##################### Configure
|
||||
echo "--------------------------"
|
||||
@@ -242,14 +276,14 @@ fi
|
||||
echo "-------------------------"
|
||||
echo "Compiling Window Maker..."
|
||||
echo "-------------------------"
|
||||
(cd src; perform make clean)
|
||||
perform make
|
||||
(cd src; perform make $MAKE_OPTIONS clean)
|
||||
perform make $MAKE_OPTIONS
|
||||
|
||||
echo "--------------------------"
|
||||
echo "Installing Window Maker..."
|
||||
echo "--------------------------"
|
||||
|
||||
perform make install
|
||||
perform make $MAKE_OPTIONS $INSTALL
|
||||
|
||||
if [ `uname -s` = "Linux" ]; then
|
||||
echo
|
||||
|
||||
@@ -7,7 +7,8 @@ EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N MIRRORS COPYING.WTFPL \
|
||||
Install acconfig.h INSTALL.pt README.pt\
|
||||
mkpatch README.KDE README.GNOME WindowMaker.lsm.in\
|
||||
README.definable-cursor \
|
||||
libwmfun-0.0.2.tar.gz
|
||||
FAQ.I18N.sk INSTALL.sk INSTALL.es INSTALL.fr
|
||||
# libwmfun-0.0.3.tar.gz
|
||||
|
||||
WindowMaker.lsm: WindowMaker.lsm.in
|
||||
size=`wc -c $(distdir).tar.gz|cut -d\ -f1`;\
|
||||
|
||||
374
Makefile.in
374
Makefile.in
@@ -1,374 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
CPP_PATH = @CPP_PATH@
|
||||
DFLAGS = @DFLAGS@
|
||||
DLLIBS = @DLLIBS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
GFXLIBS = @GFXLIBS@
|
||||
HEADER_SEARCH_PATH = @HEADER_SEARCH_PATH@
|
||||
ICONEXT = @ICONEXT@
|
||||
INTLIBS = @INTLIBS@
|
||||
LD = @LD@
|
||||
LIBPL = @LIBPL@
|
||||
LIBRARY_SEARCH_PATH = @LIBRARY_SEARCH_PATH@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LITE = @LITE@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MOFILES = @MOFILES@
|
||||
NETLIBS = @NETLIBS@
|
||||
NLSDIR = @NLSDIR@
|
||||
NM = @NM@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
WPMOFILES = @WPMOFILES@
|
||||
XCFLAGS = @XCFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XLFLAGS = @XLFLAGS@
|
||||
XLIBS = @XLIBS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBRARY_PATH = @X_LIBRARY_PATH@
|
||||
supported_locales = @supported_locales@
|
||||
wprefsdir = @wprefsdir@
|
||||
|
||||
SUBDIRS = wrlib WINGs src util po WindowMaker wmlib test WPrefs.app doc contrib
|
||||
|
||||
|
||||
EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N MIRRORS COPYING.WTFPL Install acconfig.h INSTALL.pt README.pt mkpatch README.KDE README.GNOME WindowMaker.lsm.in README.definable-cursor docklib-0.2.tar.gz libwmfun-0.0.2.tar.gz
|
||||
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ./src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
|
||||
Makefile.in NEWS TODO acinclude.m4 aclocal.m4 config.guess config.sub \
|
||||
configure configure.in install-sh ltconfig ltmain.sh missing \
|
||||
mkinstalldirs
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): configure.in acinclude.m4
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
dot_seen=no; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
test "$$subdir" = "." && dot_seen=yes; \
|
||||
done; \
|
||||
test "$$dot_seen" = "no" && rev=". $$rev"; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $$unique $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
-rm -rf $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist
|
||||
-rm -rf $(distdir)
|
||||
@banner="$(distdir).tar.gz is ready for distribution"; \
|
||||
dashes=`echo "$$banner" | sed s/./=/g`; \
|
||||
echo "$$dashes"; \
|
||||
echo "$$banner"; \
|
||||
echo "$$dashes"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-recursive
|
||||
dvi-am:
|
||||
dvi: dvi-recursive
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
installcheck-am:
|
||||
installcheck: installcheck-recursive
|
||||
install-exec-am:
|
||||
install-exec: install-exec-recursive
|
||||
|
||||
install-data-am:
|
||||
install-data: install-data-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-recursive
|
||||
uninstall-am:
|
||||
uninstall: uninstall-recursive
|
||||
all-am: Makefile
|
||||
all-redirect: all-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-tags mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
clean-am: clean-tags clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-recursive
|
||||
|
||||
distclean-am: distclean-tags distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
|
||||
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
|
||||
install-exec install-data-am install-data install-am install \
|
||||
uninstall-am uninstall all-redirect all-am all installdirs-am \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
WindowMaker.lsm: WindowMaker.lsm.in
|
||||
size=`wc -c $(distdir).tar.gz|cut -d\ -f1`;\
|
||||
size=`echo scale=2\;$$size/1048576|bc`;\
|
||||
sed -e "s/VERSION/"$(VERSION)"/" \
|
||||
-e "s/DATE/`date +%d%b%Y|tr a-z A-Z`/"\
|
||||
-e "s/SIZE/$$size M/"\
|
||||
WindowMaker.lsm.in > WindowMaker-$(VERSION).lsm
|
||||
|
||||
#dist-hook:
|
||||
# touch `find -name configure.in -print`
|
||||
# touch `find -name aclocal.m4 -print`
|
||||
# touch `find -name Makefile.am -print`
|
||||
# touch `find -name Makefile.in -print`
|
||||
# touch `find -name configure -print`
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
272
NEWS
272
NEWS
@@ -2,6 +2,278 @@
|
||||
NEWS for veteran Window Maker users
|
||||
-----------------------------------
|
||||
|
||||
--- 0.80.0
|
||||
|
||||
Shading/Unshading windows using mouse wheel on their titlebar
|
||||
---------------------------------------------------------
|
||||
|
||||
In addition to the known methods of shading/unshading a window, one can now
|
||||
do this by using the mouse wheel on the window's titlebar. The mouse events
|
||||
are interpreted via a mapping in the global WINGs configuration file,
|
||||
WMGLOBAL, by the MouseWheelUp and MouseWheelDown directives which will do
|
||||
shading and unshading respectfully.
|
||||
|
||||
However, to avoid unwanted triggers of shading/unshading the window, two
|
||||
consecutive mouse wheel events in the same direction are required. The
|
||||
trigger won't occur if the events are separated by more than a double-click's
|
||||
worth of time, which is technically speaking like making a double-click with
|
||||
the button that corresponds to the mouse wheel direction.
|
||||
|
||||
Practically speaking, this means that you have to move the mouse wheel up
|
||||
or down quickly, like when you want to quickly scroll over something big.
|
||||
|
||||
|
||||
Shared application icons
|
||||
------------------------
|
||||
|
||||
Real application icon sharing was implemented in place of the collapse
|
||||
appicon thing. With this applications of the same instance.class will
|
||||
have a single shared application icon and hiding will hide all windows
|
||||
of the aplications attached to that appicon as if there is a single
|
||||
application. This feature is enabled by default for all applications in
|
||||
the global WMWindowAttributes defaults domain using:
|
||||
|
||||
"*" = {SharedAppIcon = Yes;};
|
||||
|
||||
If you're not satisfied with this or want the old behaviour back you
|
||||
can revert this (either in the global domain for all users or in your
|
||||
personal WMWindowAttibutes domain) using SharedAppIcon = No; for "*"
|
||||
It can also be enabled/disabled for individual applications as needed.
|
||||
|
||||
Setting this option can be done using the window's inspector panel in the
|
||||
"Application Specific" section. You can set/unset it for all applications by
|
||||
using the "Defaults for all windows" in the "Window Specification" section
|
||||
|
||||
Basically using this can have 2 major scenarios:
|
||||
1. Leave it on by default, but disable it for the few specific
|
||||
applications that do not behave well with it. (default)
|
||||
2. Leave it off by default, and enable it for all applications for
|
||||
which you want it enabled.
|
||||
|
||||
At this point all applications we tested work ok, some of them even
|
||||
work better with this feature turned on: for example xmms and Corel's
|
||||
WorkPerfect8 now only have 1 appicon (they used to have 2 without this
|
||||
feature).
|
||||
|
||||
This feature is turned off by default for the following applications
|
||||
because it's incompatible with them:
|
||||
1. all GNUstep applications
|
||||
2. applications with an application menu (wterm, Aileron, etc)
|
||||
3. all applications with withdrawn windows only (this means all dockapps)
|
||||
|
||||
As a side note: wterm can use the shared appicon feature as long as it
|
||||
doesn't use the appmenu (will do this by default). If you start it
|
||||
using the appmenu (wterm -wm) it will disable the shared appicon
|
||||
feature because apps with appmenus are incompatible with this feature.
|
||||
|
||||
If an application is a GNUstep application or if it has an appmenu, it's
|
||||
detected automatically and the shared appicon is disabled automatically
|
||||
without any user intervention or need to configure anything.
|
||||
|
||||
|
||||
Dock/Clip stealing appicons
|
||||
---------------------------
|
||||
|
||||
This feature is different form the Clip's "Autoattract Icons" feature
|
||||
as it won't attach any new icon to the dock/clip.
|
||||
What it does, is when you start an application by other means than
|
||||
dock/clip, like for example using the main menu or a terminal, it will
|
||||
search the dock/clips for the presence of an appicon for that
|
||||
application, that is not already running at that moment and will attach
|
||||
the started application to that appicon in the dock/clip if available,
|
||||
making it look like the dock/clip just stole the appicon for the started
|
||||
application. There is an animation for this to offer visual feedback
|
||||
that this happened.
|
||||
|
||||
|
||||
|
||||
--- 0.70.0
|
||||
|
||||
New dock option
|
||||
---------------
|
||||
|
||||
Copy/paste launch in dock. For example, put
|
||||
netscape %s in the Docked icon for Netscape,
|
||||
select an url somewhere and then middle-click the icon.
|
||||
The command will be launched with the "pasted" string.
|
||||
|
||||
|
||||
Less dependancies
|
||||
-----------------
|
||||
|
||||
starting with 0.70.0 libPropList is no longer required to build Window
|
||||
Maker. PropList handling code was added to WINGs being now better
|
||||
integrated with all the rest. For more details check the Changelog and the
|
||||
following files:
|
||||
./WINGs/ChangeLog
|
||||
./WINGs/NEWS
|
||||
./WINGs/WINGs/WUtil.h
|
||||
./WINGs/WINGs/proplist-compat.h
|
||||
|
||||
|
||||
|
||||
--- 0.65.1
|
||||
|
||||
Removed FocusFollowMouse option, only SloppyFocus present now.
|
||||
|
||||
Added None option to MoveDisplay and ResizeDisplay
|
||||
|
||||
|
||||
|
||||
--- 0.65.0
|
||||
|
||||
Single AppIcon
|
||||
--------------
|
||||
|
||||
Removed --single-appicon patch and replaced it with a application
|
||||
specific collapsing option. Check inspector panel and appicon menu.
|
||||
|
||||
New options to configure the workspace mouse actions
|
||||
----------------------------------------------------
|
||||
|
||||
The following options were removed from the WindowMaker defaults configuration
|
||||
file:
|
||||
|
||||
SelectWindowsMouseButton, WindowListMouseButton and ApplicationMenuMouseButton.
|
||||
|
||||
They were replaced with the following 3+1:
|
||||
|
||||
MouseLeftButtonAction, MouseMiddleButtonAction and MouseRightButtonAction plus
|
||||
MouseWheelAction
|
||||
|
||||
In the old way because all gravitated around the workspace actions to which
|
||||
specific mouse buttons could have been bound, it allowed one to specify in
|
||||
the configuration file settings which would have led to weird situations
|
||||
that also had undesirable results.
|
||||
For example the same mouse button (for example left) could have been
|
||||
assigned to all workspace actions: 'select windows', 'show window list menu'
|
||||
and 'show applications menu' which of course were not only impossible to
|
||||
accomplish while still having a properly working workspace, but they also
|
||||
allowed one to specify some settings in the configuration file that were
|
||||
never in fact translatable to proper workspace actions.
|
||||
|
||||
To void this kind of user interface inconsistency, the new options now
|
||||
gravitate around the physical device (the mouse and its buttons) to which
|
||||
specific workspace actions can be bound. This way, even if one assigns the
|
||||
same action to all mouse buttons, that situation while gives redundant and
|
||||
unpractical settings it will still translatable to proper workspace actions:
|
||||
all buttons will execute the same action, but a button will execute only one
|
||||
action at a time.
|
||||
|
||||
The new options take the following values:
|
||||
all Mouse...ButtonAction can have one of the following values:
|
||||
|
||||
None, SelectWindows, OpenApplicationsMenu or OpenWindowListMenu
|
||||
|
||||
MouseWheelAction can be one of None or SwitchWorkspaces
|
||||
|
||||
If you had the default actions bound to mouse buttons before, then it will
|
||||
work for you without any intervention in the configuration files.
|
||||
Else you need to use WPrefs.app to bind the actions to the mouse buttons
|
||||
again to your old settings. Also if you want to change the mouse wheel
|
||||
behavior regarding workspaces you can now (use WPrefs.app to do this).
|
||||
|
||||
Client supplied icons
|
||||
---------------------
|
||||
|
||||
Window Maker saves the client supplied icons in ~/GNUstep/.AppInfo/WindowMaker
|
||||
in XPM format for later use when the app is no longer running (to have the
|
||||
image to display for docked icons for example).
|
||||
|
||||
Until recently the XPM images saved by Window Maker were incorrect, but a
|
||||
recent fix in the code to save XPM's fixed them. But with this fix, all
|
||||
previously saved XPM's in that directory are no longer readable (they give
|
||||
wrong images on screen or fail to load).
|
||||
|
||||
To avoid the need for the user to fix this by hand editing WMWindowAttributes
|
||||
and removing all references to icons in ~/GNUstep/.AppInfo/WindowMaker which
|
||||
can be annoying, new code was added to Window Maker to permit the regeneration
|
||||
of images in ~/GNUstep/.AppInfo/WindowMaker if they are missing.
|
||||
|
||||
With this addition, all you need to do to fix your old broken images, is to
|
||||
delete all *.xpm files from ~/GNUstep/.AppInfo/WindowMaker. Next time the
|
||||
application that is supplying an icon image will start the icon will be
|
||||
recreated if missing, but this time it will be saved with the new XPM save
|
||||
code which produces good XPM images.
|
||||
All the rest of the process is transparent to the user.
|
||||
|
||||
Hermes library support
|
||||
----------------------
|
||||
|
||||
If configure finds hermes library (an optimized pixel format conversion
|
||||
library) installed it will use it to do the pixel format conversion in
|
||||
the wraster library for some cases (TrueColor visuals without dithering).
|
||||
Currently the hermes routines cannot convert to an indexed destination,
|
||||
so we can't use hermes for PseudoColor, GrayScale and StaticGray visuals.
|
||||
Also hermes only does dithering for just 2 combinations of source/destination
|
||||
bits/masks none of them useful to out needs so for dithering we still
|
||||
use out routines.
|
||||
|
||||
The Hermes library is completely optional, you can build Window Maker
|
||||
without having it, it just speeds up the things a little for some
|
||||
situations.
|
||||
|
||||
hermes library is available here: http://www.clanlib.org/hermes/
|
||||
|
||||
|
||||
--- 0.64.0
|
||||
|
||||
No Polling of Configuration Files
|
||||
---------------------------------
|
||||
|
||||
Running Window Maker with one of -nopolling or --no-polling command line
|
||||
options will make it not to poll every 3 seconds for changes in its
|
||||
configuration files (good for laptops to let them spin disks down when idle).
|
||||
|
||||
Note:
|
||||
For the ones used with Jim Knoble's 'no polling' patch, this is the same,
|
||||
except that the need to #define ENABLE_NO_POLLING in wconfig.h was removed
|
||||
and the behaviour is always available if you use the command line option.
|
||||
|
||||
|
||||
--- 0.63.0
|
||||
|
||||
|
||||
Interwoven Gradient
|
||||
-------------------
|
||||
|
||||
interwoven gradients rip^Winspired on blackbox. Will render a texture that
|
||||
interweaves 2 different ones.
|
||||
|
||||
(igradient, from1, to1, thickness1, from2, to2, thickness2)
|
||||
|
||||
Will render a interwoven texture with the 2 specified gradients,
|
||||
with each section having the specified thickness.
|
||||
|
||||
wmagnify
|
||||
--------
|
||||
|
||||
The wmagnify utility will magnify the area on teh screen where
|
||||
your mouse pointer is located, updating it in real-time.
|
||||
|
||||
tip: maximize it horizontally, make it Omnipresent and Always at Bottom.
|
||||
Then leave it in the bottom of the screen.
|
||||
|
||||
workspace border
|
||||
----------------
|
||||
|
||||
2 options (WorkspaceBorder and WorkspaceBorderSize) were added to allow one to
|
||||
set a small (0..5 pixels) border for the workspace. This border will not be
|
||||
covered by windows when maximizing, allowing one to easily access the clip
|
||||
or map a menu using the mouse in the border area, even when there are
|
||||
windows maximized in both horizontal and vertical directions.
|
||||
WorkspaceBorder can be one of (None, LeftRight, TopBottom, AllDirections)
|
||||
while WorkspaceBorderSize is the size in pixles of the border not to be
|
||||
covered by windows when maximizing (usually a small amount 0..5 pixles).
|
||||
|
||||
Both options can be set using WPrefs.app in the "Miscelaneous Ergonomic
|
||||
Preferences" section. WPrefs will always limit WorkspaceBorderSize in the
|
||||
(0..5) range.
|
||||
|
||||
Note that if "full screen maximization" option is set for a window, that
|
||||
window will ignore this border area, maximizing to full screen.
|
||||
|
||||
|
||||
--- 0.62.0
|
||||
|
||||
|
||||
|
||||
44
README
44
README
@@ -13,8 +13,6 @@
|
||||
|
||||
Dan Pascu
|
||||
|
||||
Matthew Hawkins
|
||||
|
||||
]d
|
||||
|
||||
|
||||
@@ -90,8 +88,15 @@ including platform specific packages of Window Maker.
|
||||
|
||||
* ChangeLog: what changed from the previous version?
|
||||
|
||||
|
||||
* BUGS: list of known bugs
|
||||
|
||||
*** Tutorial
|
||||
|
||||
There's a tutorial maintained by Georges Tarbouriech at:
|
||||
|
||||
http://www.linuxfocus.org/~georges.t/
|
||||
|
||||
|
||||
*** User Guide
|
||||
|
||||
@@ -309,9 +314,15 @@ bug report.
|
||||
|
||||
To make a usefull backtrace, you need a core file with debugging
|
||||
information produced by Window Maker when it crashes. It should
|
||||
have been installed without stripping too. If you
|
||||
get the dialog window telling you that wmaker crashed and asks you
|
||||
what to do, tell it to "Abort and leave a core file".
|
||||
have been installed without stripping too.
|
||||
|
||||
To compile wmaker with debugging information:
|
||||
|
||||
./configure
|
||||
make CFLAGS=-g
|
||||
|
||||
If you get the dialog window telling you that wmaker crashed and
|
||||
asks you what to do, tell it to "Abort and leave a core file".
|
||||
|
||||
script
|
||||
cd src
|
||||
@@ -351,7 +362,6 @@ Authors
|
||||
|
||||
Alfredo K. Kojima <kojima@windowmaker.org>
|
||||
Dan Pascu <dan@windowmaker.org>
|
||||
Matt Hawkins <matt@windowmaker.org>
|
||||
]d <id@windowmaker.org>
|
||||
|
||||
Please don't ask us questions before reading the documentation (esp. the
|
||||
@@ -366,25 +376,3 @@ can be found in po/README and Window Maker/README
|
||||
If you have any comments, fixes and bug reports (filled BUGFORMs) send them
|
||||
to developers@windowmaker.org
|
||||
|
||||
|
||||
|
||||
|
||||
Musicware
|
||||
=========
|
||||
|
||||
If you use Window Maker and *really* like it, please consider making my day
|
||||
by sending me a music CD (or a MiniDisc or even a MP3 CDR) of your favorite
|
||||
band, singer, instrumentist, composer or whatever :^). I like listening to
|
||||
music and would love to get new CDs, especially from other parts of the
|
||||
world. I like almost any kind of music, from Ozzy Osbourne to Bach (mas não
|
||||
pagode e sertanejo pelamordideus :), so I will be happy to receive just about
|
||||
anything.
|
||||
|
||||
Snail mail address:
|
||||
|
||||
Alfredo Kengi Kojima
|
||||
Rua Firmino O. Bimbi, 255/25B
|
||||
Porto Alegre - RS
|
||||
CEP 91751-330
|
||||
Brazil
|
||||
|
||||
|
||||
@@ -1,67 +1,78 @@
|
||||
# README.definable-cursor: How to use definable-cursor patch for Window Maker
|
||||
# created 1999-Apr-24 14:53 jmk
|
||||
# autodate: 1999-Apr-24 16:29
|
||||
|
||||
__________________________________________________
|
||||
|O| Definable Mouse Cursors for Window Maker |X|
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
The definable-cursor patch for Window Maker
|
||||
<http://www.windowmaker.org/> allows user-definable mouse cursors; the
|
||||
Definable Mouse Cursors for Window Maker
|
||||
----------------------------------------
|
||||
|
||||
The definable-cursor feature allows user-definable mouse cursors; the
|
||||
cursors can either be the built-in ones from the X11 cursor font, or
|
||||
they can be bitmap (XBM) files. User-definable cursors can be useful
|
||||
for theme-builders, lefthanders, and the visually impaired.
|
||||
|
||||
This README describes how to apply the patch to Window Maker and how to
|
||||
use the features it enables.
|
||||
|
||||
____________________________
|
||||
|O| Applying the Patch |X|
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
Defining Your Own Cursors
|
||||
-------------------------
|
||||
|
||||
The definable-cursor patch is available from
|
||||
<http://www.pobox.com/~jmknoble/WindowMaker/patches/>.
|
||||
|
||||
To apply the patch, do the following (where `XX' is the version of
|
||||
Window Maker you're patching):
|
||||
|
||||
(0) gzip -dc WindowMaker-XX.tar.gz | tar -xvf -
|
||||
|
||||
(1) cd ./WindowMaker-XX
|
||||
|
||||
(2) patch </wherever/you/put/WindowMaker-XX-definable-cursor.patch
|
||||
|
||||
(3) Build Window Maker according to the instructions in the
|
||||
accompanying `INSTALL' file.
|
||||
|
||||
___________________________________
|
||||
|O| Defining Your Own Cursors |X|
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
A cursor specification is one of:
|
||||
A cursor specification takes one of the following forms in the
|
||||
~/GNUstep/Defaults/WindowMaker file:
|
||||
|
||||
(none)
|
||||
(builtin, <cursor-name>)
|
||||
(bitmap, <bitmap-filename>, <mask-filename>)
|
||||
|
||||
where <cursor-name> uses the same syntax as for `xsetroot -cursor_name',
|
||||
and <bitmap-filename> and <mask-filename> are the same as for
|
||||
`xsetroot -cursor'; <bitmap-filename> and <mask-filename> are searched
|
||||
for along WM's PixmapPath. If you use `(none)', the cursor will be
|
||||
inherited from the parent window (which often ends up being the root
|
||||
window).
|
||||
They have the following meanings:
|
||||
|
||||
none The cursor is inherited from the parent window (often,
|
||||
this means the root window).
|
||||
|
||||
builtin Use the cursor named <cursor-name> from X11's set of
|
||||
built-in cursors. The names are the same as you use
|
||||
with 'xsetroot -cursor_name'. See the xsetroot(1) man
|
||||
page for more information.
|
||||
|
||||
bitmap Use the bitmap in <bitmap-filename> as the foreground
|
||||
cursor bitmap, and the one in <mask-filename> as the
|
||||
background (mask) bitmap. This is pretty much the same
|
||||
as 'xsetroot -cursor', except that Window Maker searches
|
||||
for the bitmaps along its PixmapPath.
|
||||
|
||||
You can set the following cursor types (they're shown here with their
|
||||
defaults):
|
||||
|
||||
NormalCursor = (builtin, left_ptr);
|
||||
ArrowCursor = (builtin, top_left_arrow);
|
||||
MoveCursor = (builtin, fleur);
|
||||
ResizeCursor = (builtin, sizing);
|
||||
TopLeftResizeCursor = (builtin, top_left_corner);
|
||||
TopRightResizeCursor = (builtin, top_right_corner);
|
||||
BottomLeftResizeCursor = (builtin, bottom_left_corner);
|
||||
BottomRightResizeCursor = (builtin, bottom_right_corner);
|
||||
VerticalResizeCursor = (builtin, sb_v_double_arrow);
|
||||
HorizontalResizeCursor = (builtin, sb_h_double_arrow);
|
||||
WaitCursor = (builtin, watch);
|
||||
QuestionCursor = (builtin, question_arrow);
|
||||
TextCursor = (builtin, xterm);
|
||||
SelectCursor = (builtin, cross);
|
||||
|
||||
______________________
|
||||
|O| Random Notes |X|
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
The following cursor types are allowed, but they're deprecated (Window
|
||||
Maker used them in the past, but doesn't use them anymore):
|
||||
|
||||
ResizeCursor = (builtin, sizing);
|
||||
|
||||
|
||||
Using Cursors with 'getstyle' and 'setstyle'
|
||||
--------------------------------------------
|
||||
|
||||
The 'getstyle' and 'setstyle' style/theme-management utilities can
|
||||
handle user-definable cursors. By default, 'getstyle' ignores cursor
|
||||
definitions; using 'getstyle -t' to get theme-related settings will
|
||||
also include any cursors you've defined in the resulting stylefile.
|
||||
|
||||
However, by default, 'setstyle' does NOT ignore cursor settings. If
|
||||
you wish to set a style or theme without installing cursor settings,
|
||||
you can use 'setstyle --no-cursors' to ignore the cursor definitions.
|
||||
|
||||
|
||||
Random Notes
|
||||
------------
|
||||
|
||||
Most X11 cursors are 16x16 bitmaps. Many X servers can actually handle
|
||||
larger cursors, though. To check, use:
|
||||
@@ -75,12 +86,7 @@ and in the resulting output look for a line such as:
|
||||
The example above indicates that my X server can handle cursors up to
|
||||
64 pixels wide by 64 pixels high.
|
||||
|
||||
You can create your own bitmap cursors using the `bitmap' program that
|
||||
accompanies most X11 distributions. For example bitmap cursors, see
|
||||
<http://www.pobox.com/~jmknoble/WindowMaker/cursors/>.
|
||||
You can create your own bitmap cursors using the 'bitmap' program that
|
||||
accompanies most X11 distributions. For example bitmap cursors and
|
||||
masks, see <http://www.pobox.com/~jmknoble/WindowMaker/cursors/>.
|
||||
|
||||
For an example
|
||||
|
||||
--jim
|
||||
|
||||
%%%%%%%%%%%%%%% jim knoble %%%%%%%% jmknoble@pobox.com %%%%%%%%%%%%%%%%%
|
||||
|
||||
11
TODO
11
TODO
@@ -12,9 +12,7 @@ Do ASAP:
|
||||
|
||||
Need to do:
|
||||
===========
|
||||
- put a "Do not save workspace state" in the exit confirmation dialog
|
||||
- allow user to select/restore default root menu from wprefs
|
||||
- fix windoze cycle window patch
|
||||
- support for X11R6.4 extension for getting extra visual info in wrlib's
|
||||
automatic best context guessing
|
||||
- docklet to control AccessX (keyboard accessibility) functions
|
||||
@@ -22,12 +20,17 @@ Need to do:
|
||||
- add function to directly make a thumbnail of an image, using the
|
||||
functionality provided by the image libraries to load a minimal
|
||||
amount of data.
|
||||
+ investigate memory leaks
|
||||
- rewrite defaults/wdefaults stuff to use WINGs UD stuff. Search list:
|
||||
~/G/D/WindowMaker /u/l/s/W/D/WindowMaker built-in-defaults
|
||||
- remake internal string processing to use wchar? unicode?
|
||||
- add new file for stuff like default commands and dnd commands for
|
||||
docked apps, balloons for the dock etc
|
||||
- check whether apps with name.class set to empty strings should be treated
|
||||
like if name.class is NULL.NULL
|
||||
- review the defaults handling code (not to reread after we update a
|
||||
domain if possible, check WINGs apps updating WMWindowAttributes after
|
||||
start making screen to flash on update)
|
||||
|
||||
|
||||
Maybe some day:
|
||||
===============
|
||||
@@ -41,7 +44,7 @@ Never: (so, dont even bother to ask)
|
||||
with 2 CPUs ;).
|
||||
- anything that requires the mouse pointer to be jumped by WindowMaker to
|
||||
somewhere. This is *terrible* behaviour. And it's not just IMO.
|
||||
- rewrite to use Gtk... I wont even explain why...
|
||||
- rewrite to use Gtk... I wont even bother to explain why...
|
||||
|
||||
|
||||
- ICCCM 2.0: ICCCM 2.0 (not 1.0, which is what everybody supports so so) is
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
Makefile Makefile.in
|
||||
fontl testcolorpanel testmywidget testnot wmfile wtest wmquery connect
|
||||
get-wings-flags get-wutil-flags
|
||||
.libs
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
|
||||
203
WINGs/ChangeLog
203
WINGs/ChangeLog
@@ -1,3 +1,206 @@
|
||||
Changes since wmaker 0.70.0:
|
||||
............................
|
||||
|
||||
- added an internal strcasecmp() (only on systems where is not present)
|
||||
- removed some redundant includes of ../src/config.h when wconfig.h is
|
||||
included too
|
||||
- removed a wsyserror() message when reading a property list from file
|
||||
(the programmer should decide if to give that message or just ignore).
|
||||
- added a 'Bool recursive' flag to WMMergePLDictionaries()
|
||||
- added WMSubtractPLDictionaries()
|
||||
|
||||
|
||||
Changes since wmaker 0.65.0:
|
||||
............................
|
||||
|
||||
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
|
||||
related error when text was selected in a textfiled.
|
||||
- moved wstrdup(), wstrconcat() and wstrappend() from memory.c to string.c
|
||||
- added property list handling code making libPropList unnecessary and
|
||||
obsolete. Backward compatibility is provided through the
|
||||
WINGs/proplist-compat.h header file which has #defines from old libPropList
|
||||
function names to new function names with minimal changes. Read this
|
||||
header file and the NEWS file for more details about this subject.
|
||||
- Renamed WMGetUDAllKeys() to WMGetUDKeys()
|
||||
|
||||
|
||||
Changes since wmaker 0.64.0:
|
||||
............................
|
||||
|
||||
- made programmatic scroller changes send notifications
|
||||
- replaced WMSetBoxExpandsToParent with WMSetViewExpands...
|
||||
- added WMGetLabelFont()
|
||||
- added WMAddPersistentTimerHandler()
|
||||
- Moved all internal handlers (timer, idle and input) to handlers.c
|
||||
- simplified wevent.c and wutil.c.
|
||||
- fixed handling of input with poll (was broken)
|
||||
- fixed mem leak that occured when input handling was done with poll
|
||||
- simpler and more straightforward event handling for timer, idle, input
|
||||
and X events (also fixed some problems the old handling logic had)
|
||||
- moved timer, idle and input handler definitions and prototypes from
|
||||
WINGs.h to WUtil.h because they're not GUI related.
|
||||
- better and more robust handling of events (timer, idle, input, X) in
|
||||
WMMaskEvent(). Also fixed a bug where input and timer events were not
|
||||
treated for undefined periods of time under some circumstances.
|
||||
- fixed secure textfields not to allow text selection, to avoid compromising
|
||||
sensitive information by pasting it to a terminal.
|
||||
- replaced wmkrange(), wmkpoint() and wmksize() functions with macros.
|
||||
- added WMRemoveFromArrayMatching(array, match, cdata), which will remove the
|
||||
first element in the array that is matched by match(item, cdata)==True.
|
||||
- added WMArrayFirst(), WMArrayLast(), WMArrayNext() and WMArrayPrevious()
|
||||
functions and also WM_ITERATE_ARRAY() and WM_ETARETI_ARRAY() macros, to make
|
||||
interfaces to WMBag and WMArray similar and to make life a little simpler
|
||||
when iterating through all elements of an array.
|
||||
- replaced bags with arrays wherever appropriate. This will improve
|
||||
performance a bit.
|
||||
- replaced some recursive code with iterative code in selection.c
|
||||
- added WMCreateBlendedPixmapFromRImage()
|
||||
- small API change:
|
||||
1. Renamed WMSetApplicationIconImage(), WMGetApplicationIconImage() and
|
||||
WMSetWindowMiniwindowImage() to respectively WMSetApplicationIconPixmap(),
|
||||
WMGetApplicationIconPixmap() and WMSetWindowMiniwindowPixmap()
|
||||
They operate on a WMPixmap which is practically an X Pixmap with no alpha
|
||||
channel information and the new name is more suggestive and also leaves
|
||||
room for the new functions added for operating on images with alpha info.
|
||||
2. Added WMSetApplicationIconImage() and WMGetApplicationIconImage() which
|
||||
operate on an RImage and store alpha information too.
|
||||
3. Added WMCreateApplicationIconBlendedPixmap() which will take the image
|
||||
set by WMSetApplicationIconImage() and will combine it with a color.
|
||||
If color is NULL it will blend using the default panel color (#aeaaae)
|
||||
All these changes will allow WINGs to handle images with alpha blending
|
||||
correctly in panels and wherever else needed. More about in NEWS.
|
||||
- updated panels to use the newly available RImages if present and fallback
|
||||
to old WMPixmaps if not, to properly show alpha blended images.
|
||||
- replaced some still left malloc's with wmalloc's.
|
||||
- fixed a bug in WMReparentWidget()
|
||||
- added WMReparentWidget() to WINGs.h
|
||||
- fixed a bug that made the scroller knob jump backwards when dragged (this
|
||||
bug had no relation with the behavior that #define STRICT_NEXT_BEHAVIOUR
|
||||
attempts to accomplish).
|
||||
- fixed scrolling direction with mouse wheel for horizontal scroller.
|
||||
|
||||
|
||||
changes since wmaker 0.63.1:
|
||||
............................
|
||||
- added WMRunModalLoop() and WMBreakModalLoop()
|
||||
- added WMSetBoxExpandsToParent()
|
||||
- added WMRemoveBoxSubview()
|
||||
- moved WINGs headers in a WINGs subdirectory when installed.
|
||||
use #include <WINGs/header_file_name> in your application from now on.
|
||||
Also updated get-{wings|wutil}-flags.
|
||||
- Fixed a mem leak in WMList.
|
||||
- Fixed a bug that caused sigsegv for a WMList with more than 32767 items.
|
||||
- Added an example of how to create a server type program with WMConnection.
|
||||
- added WMOpenScreen()
|
||||
|
||||
|
||||
changes since wmaker 0.62.1:
|
||||
............................
|
||||
- added WRuler widget
|
||||
- added WText widget (rtf multiline text widget)
|
||||
Nwanua Elumeze <nwanua@colorado.edu>
|
||||
- added a new AUTO option for the UseMultiByte option
|
||||
- added WMRaiseWidget()/WMLowerWidget()
|
||||
- added missing EscapeTextMovement to textfield delegate/notification
|
||||
- added WMGetLabelText()
|
||||
- added WMReparentWidget()
|
||||
- added WMCreateTabViewItem()
|
||||
- added W_CreateUnmanagedTopView()
|
||||
- added wtokenjoin(), wtokensplit(), wtokenfree(), wtrimspace()
|
||||
- added WMWidgetIsMapped()
|
||||
- added WMSetApplicationIconWindow()
|
||||
- restructured the directory tree. Added Documentation, Examples and Tests
|
||||
subdirectories
|
||||
- removed WMArrayBag and reorganized WMTreeBag to be WMBag.
|
||||
- added WMArray class.
|
||||
- added WMSetWindowUserPosition()
|
||||
- added WMGetListSelectedItems()
|
||||
- added WMSetListAllowMultipleSelection(), WMListAllowsMultipleSelection().
|
||||
- added WMSetListAllowEmptySelection(), WMListAllowsEmptySelection().
|
||||
- WMListSelectionDidChangeNotification passes NULL as the notification
|
||||
client data (previously passed the selected item row).
|
||||
- added WMUnselectListItem(), WMSelectAllListItems(), WMUnselectAllListItems()
|
||||
- better behavior of wheel mices in WMList. Simple mouse wheel events
|
||||
will scroll by 1/3 of the WMList height. Using Shift as a modifier will
|
||||
scroll line by line, while using Control as a modifier will scroll page
|
||||
by page.
|
||||
- better behavior of WMScroller regarding mouse wheel events. 'Shift' modifier
|
||||
will scroll line by line, while 'Control' modifier will scroll page by page.
|
||||
- fixed some buffer overflow allowing bugs.
|
||||
- added WSDecrementWheel and WSIncrementWheel for handling mouse wheel in
|
||||
scrollers and scrolled widgets. This should be treated like the WSxxxPage
|
||||
counterparts, except it should scroll by page_size/3 instead of one full page
|
||||
- added WMSetBrowserAllowMultipleSelection(), WMSetBrowserAllowEmptySelection()
|
||||
WMBrowserAllowsMultipleSelection() and WMBrowserAllowsEmptySelection()
|
||||
- WMBrowser now allows multiple selections.
|
||||
- Added WMGetBrowserPaths() to retrieve the paths for browsers that allow
|
||||
multiple selections.
|
||||
- WMDestroyWidget() now calls WMUnmapWidget() first
|
||||
- added WMScrollerDidScrollNotification to scroller
|
||||
- added WMGetScrollViewVisibleRect()
|
||||
- fixed a mem leak in the browser code.
|
||||
- renamed wstrappend() to wstrconcat(). wstrconcat(str1, str2) concatenates
|
||||
str1 with str2 and returns that in a newly malloc'ed string.
|
||||
Be sure to rename wstrappend with wstrconcat in your code too, else
|
||||
hazardous things can happen!
|
||||
- implemented a new wstrappend() function. wstrappend(dst, src) will append
|
||||
src to dst modifing dst and returning a pointer to it. No new string is
|
||||
generated, except if dst is NULL, in which case its the same as calling
|
||||
wstrdup(src).
|
||||
dst can ONLY be NULL or a dynamically allocated string (obtained from a
|
||||
call to malloc, realloc, wmalloc, wrealloc, ...). dst CANNOT be a static
|
||||
or a constant string!
|
||||
- added wmessage() for printing a variable formatted string to stderr, with
|
||||
the program name prepended to it. Similar to wwarning(), except that it
|
||||
doesn't add "warning:" in the output message.
|
||||
- added WMBox widget
|
||||
- added WMAddTabViewItemWithView()
|
||||
- added W_SetViewCursor()
|
||||
- made Extra widgets library
|
||||
- added table widget in Extras library
|
||||
- added WMGetConnectionUnsentData() (WMGetConnectionQueuedData() too as an
|
||||
alias).
|
||||
- added WMSetConnectionCloseOnExec() to specify if the socket associated
|
||||
with a connection survives an exec* call or not. When a new connection is
|
||||
created using the WMCreate... or WMAcceptConnection() calls, it has the
|
||||
close on exec flag set automatically to 'True' by the library. Unless
|
||||
you want to let the socket of some connection to survive across an exec*
|
||||
call, you need not to call this function.
|
||||
- removed all the wsyserror() and wwarning() calls from host.c and
|
||||
connection.c and replaced where appropriate with assertions. If a function
|
||||
returns some invalid result, you can still get the system error message if
|
||||
you need, by calling wsyserrorwithcode() and passing WCErrorCode, if
|
||||
WCErrorCode > 0. If WCErrorCode==0, that is not a system error, and
|
||||
wsyserrorwithcode() should not be called in this case.
|
||||
- added WMNextHashEnumeratorKey() to retrieve all keys in some hash enumerator
|
||||
one by one.
|
||||
- fixed a bug with mouse wheels scrolling in scrollers even with the widget
|
||||
fully visible.
|
||||
- Fixed a memory leak (the destroy function for a view was never called and
|
||||
as a result the shaded windows didn't go away when closed. The non-shaded
|
||||
windows were unmapped on close but not destroyed either so they only
|
||||
apparently went away, but continued to use memory).
|
||||
|
||||
|
||||
|
||||
changes since wmaker 0.62.0:
|
||||
............................
|
||||
- added WMSetWidgetDefaultFont(), WMSetWidgetDefaultBoldFont()
|
||||
|
||||
|
||||
|
||||
changes since wmaker 0.62.0:
|
||||
............................
|
||||
- added WM{S,G}etDataFormat()
|
||||
- added drag and drop
|
||||
- changed selection code
|
||||
- added clientdata to WMFindInBag
|
||||
- removed SetWindowInitialSize()
|
||||
- added SetWindowAspectRatio()
|
||||
- added initial timeout when establishing a connection.
|
||||
- added WMSetConnectionDefaultTimeout() and WMSetConnectionOpenTimeout();
|
||||
- added WMGetConnectionTimeoutState()
|
||||
|
||||
changes since wmaker 0.61.1:
|
||||
............................
|
||||
|
||||
|
||||
3
WINGs/Documentation/.cvsignore
Normal file
3
WINGs/Documentation/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
Makefile Makefile.in
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
6
WINGs/Documentation/Makefile.am
Normal file
6
WINGs/Documentation/Makefile.am
Normal file
@@ -0,0 +1,6 @@
|
||||
## automake input file for WINGs - Documentation
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
EXTRA_DIST = README.connection
|
||||
|
||||
51
WINGs/Documentation/README.connection
Normal file
51
WINGs/Documentation/README.connection
Normal file
@@ -0,0 +1,51 @@
|
||||
Methods of handling WMConnectionDidDieNotification notification events
|
||||
(same for WMConnectionDidTimeoutNotification)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Once your program got this notification (you need to install an observer for
|
||||
it), there are some ways to handle it:
|
||||
|
||||
1. Make your observer enqueue a new notification in the ASAP queue, and the
|
||||
observer for this new notification (it can be the same function if you
|
||||
arrange to distinguish between the two cases), should remove the connection.
|
||||
You can also close the connection before enqueuing the new notification to
|
||||
the ASAP queue, but is not strictly necessarily, since it will be closed
|
||||
when the observer for the new enqueued notification will be called and you
|
||||
will call the close/remove function there. This is just to make sure your
|
||||
connection will be silent, and won't generate new events until you reach
|
||||
that point.
|
||||
This is by far the best method, since it will assure you that if you
|
||||
enqueue more than one notification to remove the same connection, they will
|
||||
be coalesced, and called only once.
|
||||
|
||||
2. In your observer, put the died/closed connection in an array or bag, and
|
||||
destroy all the connections present in the array/bag, in your main loop,
|
||||
after you call the WHandleEvents()/WMHandleEvent(). Also closing the
|
||||
connection can be done before putting the connection in the array/bag, but
|
||||
is optional as noted above. In this case you need to make sure you don't
|
||||
put in the array/bag the same connection more than once, in case the
|
||||
DieNotification is sent more that once to you. This is automagically solved
|
||||
by method 1.
|
||||
|
||||
3. In case it's your only connection, and you plan to exit if it was closed or
|
||||
died, then you can safely close/remove it, and exit. As long as you no
|
||||
longer access it, there is no problem.
|
||||
|
||||
4. Make you observer remove the connection. Then make sure that after that
|
||||
point your code no longer tries to access that connection (this usually
|
||||
means until your code gets back to the main loop). This is almost always
|
||||
very hard to achive and subject to hidden errors. I do not recommend this
|
||||
way of handling the died notification. It is ugly and very complicated to
|
||||
handle if the program is in a very deeply nested function when it finds out
|
||||
that the connection died. If you use it and get plenty of SIGSEGVs then you
|
||||
know why. This method was not presented here to be used, but to show what
|
||||
should be avoided in dealing with the died notification, in case someone
|
||||
gets the idea to try it this way.
|
||||
|
||||
|
||||
Note: read/write operations means to use our read/write functions (like
|
||||
WMGetMessage()/WMSendMessage()), not the C library ones read()/write().
|
||||
Note2: removing a connection is done by WMDestroyConnection(), while
|
||||
WMCloseConnection() only closes the socket, and removed any pending
|
||||
queues and timers on the connection.
|
||||
|
||||
5
WINGs/Examples/.cvsignore
Normal file
5
WINGs/Examples/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
Makefile Makefile.in
|
||||
connect server fontl puzzle UserTime.plist
|
||||
.libs
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
31
WINGs/Examples/Makefile.am
Normal file
31
WINGs/Examples/Makefile.am
Normal file
@@ -0,0 +1,31 @@
|
||||
## automake input file for WINGs - Examples
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
|
||||
noinst_PROGRAMS = connect server fontl puzzle
|
||||
|
||||
|
||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
||||
@INTLIBS@
|
||||
|
||||
|
||||
fontl_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
||||
|
||||
puzzle_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
||||
|
||||
connect_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
|
||||
|
||||
connect_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
|
||||
@NETLIBS@ @INTLIBS@
|
||||
|
||||
server_DEPENDENCIES = $(top_builddir)/WINGs/libWUtil.a
|
||||
|
||||
server_LDADD = $(top_builddir)/WINGs/libWUtil.a @LIBRARY_SEARCH_PATH@ \
|
||||
@NETLIBS@ @INTLIBS@
|
||||
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||
|
||||
|
||||
19
WINGs/Examples/README
Normal file
19
WINGs/Examples/README
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
Files:
|
||||
-----
|
||||
|
||||
server - server example of using WMConnection. It keeps a database of
|
||||
timeouts for a group of users, allowing one to add/remove
|
||||
users and update the timeouts associated with them.
|
||||
|
||||
connect - client example of using WMConnection. Works with the server
|
||||
program above. Just start both without any parameter and
|
||||
type help in the client to find out how to operate them.
|
||||
Rest is self explanatory.
|
||||
|
||||
puzzle - a nice zuPzel =)
|
||||
|
||||
fontl - a map of all characters with their corresponding ascii,
|
||||
hex, decimal and octal representations.
|
||||
|
||||
@@ -1,21 +1,8 @@
|
||||
/*
|
||||
* WINGs connect.c: example how to create a network client using WMConnection
|
||||
*
|
||||
* Copyright (c) 1999 Dan Pascu
|
||||
* Copyright (c) 1999-2001 Dan Pascu
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
@@ -23,7 +10,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WINGs.h"
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
|
||||
|
||||
@@ -168,7 +155,7 @@ main(int argc, char **argv) /*FOLD00*/
|
||||
ProgName++;
|
||||
|
||||
host = NULL;
|
||||
port = "7000";
|
||||
port = "34567";
|
||||
|
||||
if (argc>1) {
|
||||
for (i=1; i<argc; i++) {
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "WINGs.h"
|
||||
#include "WUtil.h"
|
||||
#include <WINGs/WINGs.h>
|
||||
#include <WINGs/WUtil.h>
|
||||
|
||||
void
|
||||
wAbort()
|
||||
241
WINGs/Examples/puzzle.c
Normal file
241
WINGs/Examples/puzzle.c
Normal file
@@ -0,0 +1,241 @@
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
|
||||
|
||||
#define MAX_SIZE 10*10
|
||||
|
||||
|
||||
WMWindow *win;
|
||||
WMButton *Button[MAX_SIZE];
|
||||
char Map[MAX_SIZE];
|
||||
int Size = 4;
|
||||
int MoveCount;
|
||||
|
||||
#define MAP(x,y) Map[(x)+(y)*Size]
|
||||
|
||||
int WinSize = 120;
|
||||
|
||||
|
||||
Bool CheckWin(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Size*Size-1; i++) {
|
||||
if (Map[i] != i)
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
void MoveButton(int button, int x, int y)
|
||||
{
|
||||
WMMoveWidget(Button[button], x*(WinSize/Size), y*(WinSize/Size));
|
||||
}
|
||||
|
||||
|
||||
Bool SlideButton(int button)
|
||||
{
|
||||
int x, y, done = 0;
|
||||
|
||||
/* locate the button */
|
||||
for (y = 0; y < Size; y++) {
|
||||
for (x = 0; x < Size; x++) {
|
||||
if (MAP(x,y) == button) {
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
|
||||
if (x > 0 && MAP(x-1, y) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x-1, y);
|
||||
MAP(x-1,y) = button;
|
||||
} else if (x < Size-1 && MAP(x+1, y) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x+1, y);
|
||||
MAP(x+1,y) = button;
|
||||
} else if (y > 0 && MAP(x, y-1) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x, y-1);
|
||||
MAP(x,y-1) = button;
|
||||
} else if (y < Size-1 && MAP(x, y+1) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x, y+1);
|
||||
MAP(x,y+1) = button;
|
||||
} else {
|
||||
return False;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
#define SWAP(a,b) {int tmp; tmp=a; a=b; b=tmp;}
|
||||
|
||||
void ResetGame(void)
|
||||
{
|
||||
int i, x, y, ox, oy;
|
||||
|
||||
|
||||
MoveCount = 0;
|
||||
|
||||
for (i = 0; i < Size*Size-1; i++) {
|
||||
Map[i] = i;
|
||||
}
|
||||
Map[i] = -1;
|
||||
ox = x = Size-1;
|
||||
oy = y = Size-1;
|
||||
for (i = 0; i < 1000; i++) {
|
||||
int ok;
|
||||
ok = 1;
|
||||
switch (rand()%4) {
|
||||
case 0:
|
||||
if (x > 0) x--; else ok = 0;
|
||||
break;
|
||||
case 2:
|
||||
if (x < Size-1) x++; else ok = 0;
|
||||
break;
|
||||
case 1:
|
||||
if (y > 0) y--; else ok = 0;
|
||||
break;
|
||||
case 3:
|
||||
if (y < Size-1) y++; else ok = 0;
|
||||
break;
|
||||
}
|
||||
if (ok) {
|
||||
MoveButton(MAP(x,y), ox, oy);
|
||||
|
||||
SWAP(MAP(ox, oy), MAP(x, y));
|
||||
|
||||
while (XPending(WMScreenDisplay(WMWidgetScreen(win)))) {
|
||||
XEvent ev;
|
||||
WMNextEvent(WMScreenDisplay(WMWidgetScreen(win)), &ev);
|
||||
WMHandleEvent(&ev);
|
||||
}
|
||||
ox = x;
|
||||
oy = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void buttonClick(WMWidget *w, void *ptr)
|
||||
{
|
||||
char buffer[300];
|
||||
|
||||
if (SlideButton((int)ptr)) {
|
||||
MoveCount++;
|
||||
|
||||
if (CheckWin()) {
|
||||
sprintf(buffer, "You finished the game in %i moves.", MoveCount);
|
||||
|
||||
if (WMRunAlertPanel(WMWidgetScreen(w), win, "You Won!", buffer,
|
||||
"Wee!", "Gah! Lemme retry!", NULL) == WAPRDefault) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ResetGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void resizeObserver(void *self, WMNotification *notif)
|
||||
{
|
||||
WMSize size = WMGetViewSize(WMWidgetView(win));
|
||||
int x, y;
|
||||
|
||||
WinSize = size.width;
|
||||
for (y = 0; y < Size; y++) {
|
||||
for (x = 0; x < Size; x++) {
|
||||
if (MAP(x,y) >= 0) {
|
||||
WMResizeWidget(Button[(int)MAP(x,y)],
|
||||
WinSize/Size, WinSize/Size);
|
||||
WMMoveWidget(Button[(int)MAP(x,y)],
|
||||
x*(WinSize/Size), y*(WinSize/Size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Display *dpy;
|
||||
WMScreen *scr;
|
||||
int x, y, i;
|
||||
|
||||
WMInitializeApplication("Puzzle", &argc, argv);
|
||||
|
||||
|
||||
dpy = XOpenDisplay("");
|
||||
if (!dpy) {
|
||||
printf("could not open display\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
|
||||
|
||||
win = WMCreateWindow(scr, "puzzle");
|
||||
WMResizeWidget(win, WinSize, WinSize);
|
||||
WMSetWindowTitle(win, "zuPzel");
|
||||
WMSetWindowMinSize(win, 80, 80);
|
||||
WMSetWindowAspectRatio(win, 2, 2, 2, 2);
|
||||
WMSetWindowResizeIncrements(win, Size, Size);
|
||||
WMSetViewNotifySizeChanges(WMWidgetView(win), True);
|
||||
WMAddNotificationObserver(resizeObserver, NULL,
|
||||
WMViewSizeDidChangeNotification,
|
||||
WMWidgetView(win));
|
||||
|
||||
|
||||
|
||||
for (i = y = 0; y < Size && i < Size*Size-1; y++) {
|
||||
for (x = 0; x < Size && i < Size*Size-1; x++) {
|
||||
char buf[32];
|
||||
WMColor *color;
|
||||
RColor col;
|
||||
RHSVColor hsv;
|
||||
|
||||
hsv.hue = i*360/(Size*Size-1);
|
||||
hsv.saturation = 120;
|
||||
hsv.value = 200;
|
||||
|
||||
RHSVtoRGB(&hsv, &col);
|
||||
|
||||
color = WMCreateRGBColor(scr, col.red<<8, col.green<<8,
|
||||
col.blue<<8, False);
|
||||
|
||||
MAP(x,y) = i;
|
||||
Button[i] = WMCreateButton(win, WBTMomentaryLight);
|
||||
WMSetWidgetBackgroundColor(Button[i], color);
|
||||
WMReleaseColor(color);
|
||||
WMSetButtonAction(Button[i], buttonClick, (void*)i);
|
||||
WMResizeWidget(Button[i], WinSize/Size, WinSize/Size);
|
||||
WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size));
|
||||
sprintf(buf, "%i", i+1);
|
||||
WMSetButtonText(Button[i], buf);
|
||||
WMSetButtonTextAlignment(Button[i], WACenter);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
WMRealizeWidget(win);
|
||||
|
||||
ResetGame();
|
||||
|
||||
WMScreenMainLoop(scr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
738
WINGs/Examples/server.c
Normal file
738
WINGs/Examples/server.c
Normal file
@@ -0,0 +1,738 @@
|
||||
/*
|
||||
* WINGs server.c: example how to create a network server using WMConnection
|
||||
*
|
||||
* Copyright (c) 2001 Dan Pascu
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
|
||||
#define _(P) P
|
||||
#define MAXCMD_SIZE 512
|
||||
|
||||
|
||||
char *SEConnectionShouldBeRemovedNotification = "SEConnectionShouldBeRemovedNotification";
|
||||
|
||||
|
||||
|
||||
|
||||
static void didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
static void connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
static void connectionDidTimeout(ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
|
||||
extern char *SEConnectionShouldBeRemovedNotification;
|
||||
|
||||
static WMUserDefaults *timeDB = NULL;
|
||||
static char *ServerAddress = NULL;
|
||||
static char *ServerPort = NULL;
|
||||
static WMArray *allowedHostList = NULL;
|
||||
static WMArray *clientConnections = NULL;
|
||||
static WMConnection *serverPtr = NULL;
|
||||
|
||||
|
||||
|
||||
static ConnectionDelegate socketDelegate = {
|
||||
NULL, /* client data */
|
||||
NULL, /* didCatchException */
|
||||
connectionDidDie, /* didDie */
|
||||
NULL, /* didInitialize */
|
||||
didReceiveInput, /* didReceiveInput */
|
||||
connectionDidTimeout /* didTimeout */
|
||||
};
|
||||
|
||||
|
||||
|
||||
void
|
||||
wAbort(Bool foo) /*FOLD00*/
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
printHelp(char *progname) /*FOLD00*/
|
||||
{
|
||||
printf(_("usage: %s [options]\n\n"), progname);
|
||||
puts(_(" --help print this message"));
|
||||
puts(_(" --listen [address:]port only listen on the specified address/port"));
|
||||
puts(_(" --allow host1[,host2...] only allow connections from listed hosts\n"));
|
||||
puts(_(" By default server listens on all interfaces and port 34567, unless"
|
||||
" something\nelse is specified with the --listen option. If address is"
|
||||
" omitted or the keyword\n'Any' is used, it will listen on all interfaces else"
|
||||
" only on the specified one.\n\nFor example --listen localhost: will"
|
||||
" listen on the default port 34567, but only\non connections comming"
|
||||
" in through the loopback interface.\n\n Also by default the server"
|
||||
" listens to incoming connections from any host,\nunless a list of"
|
||||
" hosts is given with the --allow option, in which case it will\nreject"
|
||||
" connections not comming from those hosts.\nThe list of hosts is comma"
|
||||
" separated and should NOT contain ANY spaces."));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
enqueueConnectionForRemoval(WMConnection *cPtr)
|
||||
{
|
||||
WMNotification *notif;
|
||||
|
||||
/*don't release notif here. it will be released by queue after processing */
|
||||
notif = WMCreateNotification(SEConnectionShouldBeRemovedNotification,
|
||||
cPtr, NULL);
|
||||
WMEnqueueNotification(WMGetDefaultNotificationQueue(), notif, WMPostASAP);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sendMessage(WMConnection *cPtr, char *message)
|
||||
{
|
||||
WMData *aData;
|
||||
int res;
|
||||
|
||||
if (WMGetConnectionState(cPtr)!=WCConnected)
|
||||
return -1;
|
||||
|
||||
aData = WMCreateDataWithBytes(message, strlen(message));
|
||||
res = WMSendConnectionData(cPtr, aData);
|
||||
WMReleaseData(aData);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
enqueueMessage(WMConnection *cPtr, char *message)
|
||||
{
|
||||
WMData *aData;
|
||||
Bool res;
|
||||
|
||||
if (WMGetConnectionState(cPtr)!=WCConnected)
|
||||
return False;
|
||||
|
||||
aData = WMCreateDataWithBytes(message, strlen(message));
|
||||
res = WMEnqueueConnectionData(cPtr, aData);
|
||||
WMReleaseData(aData);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static unsigned char*
|
||||
findDelimiter(unsigned char *data, unsigned const char *endPtr)
|
||||
{
|
||||
wassertrv(data < endPtr, NULL);
|
||||
|
||||
while (data<endPtr && *data!='\n' && *data!='\r' && *data!=';' && *data!='\0')
|
||||
data++;
|
||||
|
||||
if (data < endPtr)
|
||||
return data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
static WMArray*
|
||||
getAvailableMessages(WMConnection *cPtr)
|
||||
{
|
||||
char *ptr, *crtPos, *buffer;
|
||||
const char *bytes, *endPtr;
|
||||
WMData *aData, *receivedData, *holdData;
|
||||
WMRange range;
|
||||
WMArray *messages;
|
||||
int length;
|
||||
|
||||
receivedData = WMGetConnectionAvailableData(cPtr);
|
||||
if (!receivedData)
|
||||
return NULL;
|
||||
if ((length=WMGetDataLength(receivedData))==0) {
|
||||
WMReleaseData(receivedData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
holdData = (WMData*)WMGetConnectionClientData(cPtr);
|
||||
if (holdData) {
|
||||
WMAppendData(holdData, receivedData);
|
||||
WMReleaseData(receivedData);
|
||||
WMSetConnectionClientData(cPtr, NULL);
|
||||
aData = holdData;
|
||||
} else {
|
||||
aData = receivedData;
|
||||
}
|
||||
|
||||
length = WMGetDataLength(aData);
|
||||
bytes = (char*)WMDataBytes(aData);
|
||||
endPtr = bytes + length;
|
||||
|
||||
messages = WMCreateArrayWithDestructor(1, wfree);
|
||||
crtPos = (char*)bytes;
|
||||
while (crtPos<endPtr && (ptr = findDelimiter(crtPos, endPtr))!=NULL) {
|
||||
range.position = (crtPos - bytes);
|
||||
range.count = (ptr - crtPos);
|
||||
if (range.count > MAXCMD_SIZE) {
|
||||
/* Hmmm... The message is too long. Possibly that someone is
|
||||
* flooding us, or there is a dumb client which do not know
|
||||
* who is talking to. */
|
||||
sendMessage(cPtr, "Command too long\n\r");
|
||||
WMFreeArray(messages);
|
||||
WMReleaseData(aData);
|
||||
WMCloseConnection(cPtr);
|
||||
enqueueConnectionForRemoval(cPtr);
|
||||
return NULL;
|
||||
}
|
||||
buffer = wmalloc(range.count+1);
|
||||
WMGetDataBytesWithRange(aData, buffer, range);
|
||||
buffer[range.count] = '\0';
|
||||
WMAddToArray(messages, buffer);
|
||||
crtPos = ptr;
|
||||
while (crtPos<endPtr && (*crtPos=='\n' || *crtPos=='\r' ||
|
||||
*crtPos=='\t' || *crtPos=='\0' ||
|
||||
*crtPos==';' || *crtPos==' ')) {
|
||||
crtPos++;
|
||||
}
|
||||
}
|
||||
|
||||
if (crtPos<endPtr) {
|
||||
range.position = (crtPos - bytes);
|
||||
range.count = (endPtr - crtPos);
|
||||
if (range.count > MAXCMD_SIZE) {
|
||||
/* Flooooooding!!!! */
|
||||
sendMessage(cPtr, "Message too long\n\r");
|
||||
WMFreeArray(messages);
|
||||
WMReleaseData(aData);
|
||||
WMCloseConnection(cPtr);
|
||||
enqueueConnectionForRemoval(cPtr);
|
||||
return NULL;
|
||||
}
|
||||
holdData = WMGetSubdataWithRange(aData, range);
|
||||
WMSetConnectionClientData(cPtr, holdData);
|
||||
}
|
||||
WMReleaseData(aData);
|
||||
|
||||
if (WMGetArrayItemCount(messages)==0) {
|
||||
WMFreeArray(messages);
|
||||
messages = NULL;
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
complainAboutBadArgs(WMConnection *cPtr, char *cmdName, char *badArgs) /*FOLD00*/
|
||||
{
|
||||
char *buf = wmalloc(strlen(cmdName) + strlen(badArgs) + 100);
|
||||
|
||||
sprintf(buf, _("Invalid parameters '%s' for command %s. Use HELP for"
|
||||
" a list of commands.\n"), badArgs, cmdName);
|
||||
sendMessage(cPtr, buf);
|
||||
wfree(buf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sendUpdateMessage(WMConnection *cPtr, char *id, int time) /*FOLD00*/
|
||||
{
|
||||
char *buf = wmalloc(strlen(id) + 100);
|
||||
|
||||
sprintf(buf, "%s has %i minutes left\n", id, time);
|
||||
sendMessage(cPtr, buf);
|
||||
wfree(buf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showId(WMConnection *cPtr)
|
||||
{
|
||||
sendMessage(cPtr, "Server example based on WMConnection\n");
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showHelp(WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
char *buf = wmalloc(strlen(WMGetApplicationName()) + 16);
|
||||
|
||||
sprintf(buf, _("%s commands:\n\n"), WMGetApplicationName());
|
||||
|
||||
enqueueMessage(cPtr, _("\n"));
|
||||
enqueueMessage(cPtr, buf);
|
||||
enqueueMessage(cPtr, _("GET <id>\t- return time left (in minutes) "
|
||||
"for user with id <id>\n"));
|
||||
enqueueMessage(cPtr, _("SET <id> <time>\t- set time limit to <time> "
|
||||
"minutes for user with id <id>\n"));
|
||||
enqueueMessage(cPtr, _("ADD <id> <time>\t- add <time> minutes "
|
||||
"for user with id <id>\n"));
|
||||
enqueueMessage(cPtr, _("SUB <id> <time>\t- subtract <time> minutes "
|
||||
"for user with id <id>\n"));
|
||||
enqueueMessage(cPtr, _("REMOVE <id>\t- remove time limitations for "
|
||||
"user with id <id>\n"));
|
||||
enqueueMessage(cPtr, _("LIST\t\t- list all users and their "
|
||||
"corresponding time limit\n"));
|
||||
enqueueMessage(cPtr, _("ID\t\t- returns the Time Manager "
|
||||
"identification string\n"));
|
||||
enqueueMessage(cPtr, _("EXIT\t\t- exits session\n"));
|
||||
enqueueMessage(cPtr, _("QUIT\t\t- exits session\n"));
|
||||
enqueueMessage(cPtr, _("HELP\t\t- show this message\n\n"));
|
||||
/* Just flush the queue we made before */
|
||||
WMFlushConnection(cPtr);
|
||||
wfree(buf);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
listUsers(WMConnection *cPtr)
|
||||
{
|
||||
WMPropList *userList;
|
||||
char *id;
|
||||
int i, time;
|
||||
|
||||
userList = WMGetUDKeys(timeDB);
|
||||
|
||||
for (i=0; i<WMGetPropListItemCount(userList); i++) {
|
||||
id = WMGetFromPLString(WMGetFromPLArray(userList, i));
|
||||
time = WMGetUDIntegerForKey(timeDB, id);
|
||||
sendUpdateMessage(cPtr, id, time);
|
||||
}
|
||||
|
||||
WMReleasePropList(userList);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
setTimeForUser(WMConnection *cPtr, char *cmdArgs) /*FOLD00*/
|
||||
{
|
||||
char *id;
|
||||
int i, time;
|
||||
|
||||
id = wmalloc(strlen(cmdArgs));
|
||||
if (sscanf(cmdArgs, "%s %d", id, &time)!=2) {
|
||||
complainAboutBadArgs(cPtr, "SET", cmdArgs);
|
||||
wfree(id);
|
||||
return;
|
||||
}
|
||||
if (time<0)
|
||||
time = 0;
|
||||
|
||||
WMSetUDIntegerForKey(timeDB, time, id);
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
|
||||
cPtr = WMGetFromArray(clientConnections, i);
|
||||
sendUpdateMessage(cPtr, id, time);
|
||||
}
|
||||
wfree(id);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
addTimeToUser(WMConnection *cPtr, char *cmdArgs) /*FOLD00*/
|
||||
{
|
||||
char *id;
|
||||
int i, time, newTime;
|
||||
|
||||
id = wmalloc(strlen(cmdArgs));
|
||||
if (sscanf(cmdArgs, "%s %d", id, &time)!=2) {
|
||||
complainAboutBadArgs(cPtr, "ADD", cmdArgs);
|
||||
wfree(id);
|
||||
return;
|
||||
}
|
||||
|
||||
newTime = WMGetUDIntegerForKey(timeDB, id) + time;
|
||||
if (newTime<0)
|
||||
newTime = 0;
|
||||
|
||||
WMSetUDIntegerForKey(timeDB, newTime, id);
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
|
||||
cPtr = WMGetFromArray(clientConnections, i);
|
||||
sendUpdateMessage(cPtr, id, newTime);
|
||||
}
|
||||
wfree(id);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
subTimeFromUser(WMConnection *cPtr, char *cmdArgs) /*FOLD00*/
|
||||
{
|
||||
char *id;
|
||||
int i, time, newTime;
|
||||
|
||||
id = wmalloc(strlen(cmdArgs));
|
||||
if (sscanf(cmdArgs, "%s %d", id, &time)!=2) {
|
||||
complainAboutBadArgs(cPtr, "SUB", cmdArgs);
|
||||
wfree(id);
|
||||
return;
|
||||
}
|
||||
|
||||
newTime = WMGetUDIntegerForKey(timeDB, id) - time;
|
||||
if (newTime<0)
|
||||
newTime = 0;
|
||||
|
||||
WMSetUDIntegerForKey(timeDB, newTime, id);
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
|
||||
cPtr = WMGetFromArray(clientConnections, i);
|
||||
sendUpdateMessage(cPtr, id, newTime);
|
||||
}
|
||||
wfree(id);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
removeTimeForUser(WMConnection *cPtr, char *cmdArgs) /*FOLD00*/
|
||||
{
|
||||
char *ptr;
|
||||
int i;
|
||||
|
||||
if (cmdArgs[0]=='\0') {
|
||||
sendMessage(cPtr, _("Missing parameter for command REMOVE."
|
||||
" Use HELP for a list of commands.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = cmdArgs;
|
||||
while (*ptr && *ptr!=' ' && *ptr!='\t')
|
||||
ptr++;
|
||||
*ptr = '\0';
|
||||
|
||||
WMRemoveUDObjectForKey(timeDB, cmdArgs);
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(clientConnections); i++) {
|
||||
cPtr = WMGetFromArray(clientConnections, i);
|
||||
sendUpdateMessage(cPtr, cmdArgs, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
getTimeForUser(WMConnection *cPtr, char *cmdArgs) /*FOLD00*/
|
||||
{
|
||||
char *ptr;
|
||||
int time;
|
||||
|
||||
if (cmdArgs[0]=='\0') {
|
||||
sendMessage(cPtr, _("Missing parameter for command GET."
|
||||
" Use HELP for a list of commands.\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
ptr = cmdArgs;
|
||||
while (*ptr && *ptr!=' ' && *ptr!='\t')
|
||||
ptr++;
|
||||
*ptr = '\0';
|
||||
|
||||
if (WMGetUDObjectForKey(timeDB, cmdArgs)!=NULL)
|
||||
time = WMGetUDIntegerForKey(timeDB, cmdArgs);
|
||||
else
|
||||
time = -1;
|
||||
|
||||
sendUpdateMessage(cPtr, cmdArgs, time);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleConnection(WMConnection *cPtr)
|
||||
{
|
||||
char *command, *ptr, *cmdArgs, *buffer;
|
||||
WMArray *commands;
|
||||
int i;
|
||||
|
||||
commands = getAvailableMessages(cPtr);
|
||||
if (!commands)
|
||||
return;
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(commands); i++) {
|
||||
command = WMGetFromArray(commands, i);
|
||||
while (*command && (*command==' ' || *command=='\t'))
|
||||
command++;
|
||||
ptr = command;
|
||||
while(*ptr && *ptr!=' ' && *ptr!='\t')
|
||||
ptr++;
|
||||
if (*ptr) {
|
||||
*ptr = '\0';
|
||||
ptr++;
|
||||
}
|
||||
while (*ptr && (*ptr==' ' || *ptr=='\t'))
|
||||
ptr++;
|
||||
|
||||
cmdArgs = ptr;
|
||||
|
||||
fprintf(stderr, "Command: '%s', args: '%s'\n", command, cmdArgs);
|
||||
|
||||
if (strcasecmp(command, "quit")==0 || strcasecmp(command, "exit")==0) {
|
||||
sendMessage(cPtr, "Bye\n");
|
||||
WMCloseConnection(cPtr);
|
||||
enqueueConnectionForRemoval(cPtr);
|
||||
WMFreeArray(commands);
|
||||
return;
|
||||
} else if (strcasecmp(command, "id")==0) {
|
||||
showId(cPtr);
|
||||
} else if (strcasecmp(command, "help")==0) {
|
||||
showHelp(cPtr);
|
||||
} else if (strcasecmp(command, "list")==0) {
|
||||
listUsers(cPtr);
|
||||
} else if (strcasecmp(command, "set")==0) {
|
||||
setTimeForUser(cPtr, cmdArgs);
|
||||
} else if (strcasecmp(command, "add")==0) {
|
||||
addTimeToUser(cPtr, cmdArgs);
|
||||
} else if (strcasecmp(command, "sub")==0) {
|
||||
subTimeFromUser(cPtr, cmdArgs);
|
||||
} else if (strcasecmp(command, "remove")==0) {
|
||||
removeTimeForUser(cPtr, cmdArgs);
|
||||
} else if (strcasecmp(command, "get")==0) {
|
||||
getTimeForUser(cPtr, cmdArgs);
|
||||
} else {
|
||||
buffer = wmalloc(strlen(command) + 100);
|
||||
sprintf(buffer, _("Unknown command '%s'. Try HELP for"
|
||||
" a list of commands.\n"), command);
|
||||
sendMessage(cPtr, buffer);
|
||||
wfree(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
WMFreeArray(commands);
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
isAllowedToConnect(WMConnection *cPtr)
|
||||
{
|
||||
WMHost *hPtr;
|
||||
int i;
|
||||
|
||||
if (allowedHostList == NULL)
|
||||
return True; /* No list. Allow all by default */
|
||||
|
||||
hPtr = WMGetHostWithAddress(WMGetConnectionAddress(cPtr));
|
||||
for (i=0; i<WMGetArrayItemCount(allowedHostList); i++) {
|
||||
if (WMIsHostEqualToHost(hPtr, WMGetFromArray(allowedHostList, i))) {
|
||||
WMReleaseHost(hPtr);
|
||||
return True;
|
||||
}
|
||||
}
|
||||
|
||||
WMReleaseHost(hPtr);
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
if (cPtr == serverPtr) {
|
||||
WMConnection *newPtr = WMAcceptConnection(cPtr);
|
||||
|
||||
if (newPtr) {
|
||||
if (isAllowedToConnect(newPtr)) {
|
||||
WMSetConnectionDelegate(newPtr, &socketDelegate);
|
||||
WMSetConnectionSendTimeout(newPtr, 120);
|
||||
WMAddToArray(clientConnections, newPtr);
|
||||
} else {
|
||||
sendMessage(newPtr, "Sorry, you are not allowed to connect.\n");
|
||||
WMDestroyConnection(newPtr);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Data arriving on an already-connected socket */
|
||||
handleConnection(cPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
connectionDidTimeout(ConnectionDelegate *self, WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
WMHost *hPtr;
|
||||
|
||||
if (cPtr == serverPtr) {
|
||||
wfatal(_("The server listening socket did timeout. Exiting."));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
hPtr = WMGetHostWithAddress(WMGetConnectionAddress(cPtr));
|
||||
wwarning(_("Connection with %s did timeout. Closing connection."),
|
||||
WMGetHostName(hPtr));
|
||||
WMReleaseHost(hPtr);
|
||||
|
||||
enqueueConnectionForRemoval(cPtr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr)
|
||||
{
|
||||
if (cPtr == serverPtr) {
|
||||
/* trouble. server listening port itself died!!! */
|
||||
wfatal(_("The server listening socket died. Exiting."));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
enqueueConnectionForRemoval(cPtr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
removeConnection(void *observer, WMNotification *notification)
|
||||
{
|
||||
WMConnection *cPtr = (WMConnection*)WMGetNotificationObject(notification);
|
||||
WMData *data;
|
||||
|
||||
WMRemoveFromArray(clientConnections, cPtr);
|
||||
if ((data = (WMData*)WMGetConnectionClientData(cPtr))!=NULL)
|
||||
WMReleaseData(data);
|
||||
WMDestroyConnection(cPtr);
|
||||
}
|
||||
|
||||
static void
|
||||
updatedDomain(void *observer, WMNotification *notification)
|
||||
{
|
||||
wmessage("defaults domain file changed on disk. synchronizing.");
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static Bool
|
||||
isDifferent(char *str1, char *str2) /*FOLD00*/
|
||||
{
|
||||
if ((!str1 && !str2) || (str1 && str2 && strcmp(str1, str2)==0))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv) /*FOLD00*/
|
||||
{
|
||||
int i;
|
||||
|
||||
wsetabort(wAbort);
|
||||
|
||||
WMInitializeApplication("server", &argc, argv);
|
||||
|
||||
if (argc>1) {
|
||||
for (i=1; i<argc; i++) {
|
||||
if (strcmp(argv[i], "--help")==0) {
|
||||
printHelp(argv[0]);
|
||||
exit(0);
|
||||
} else if (strcmp(argv[i], "--listen")==0) {
|
||||
char *p;
|
||||
|
||||
if ((p = strchr(argv[++i], ':')) != NULL) {
|
||||
*p = 0;
|
||||
ServerAddress = wstrdup(argv[i]);
|
||||
ServerPort = wstrdup(p+1);
|
||||
*p = ':';
|
||||
if (ServerAddress[0] == 0) {
|
||||
wfree(ServerAddress);
|
||||
ServerAddress = NULL;
|
||||
}
|
||||
if (ServerPort[0] == 0) {
|
||||
wfree(ServerPort);
|
||||
ServerPort = "34567";
|
||||
}
|
||||
} else if (argv[i][0]!=0) {
|
||||
ServerPort = argv[i];
|
||||
}
|
||||
} else if (strcmp(argv[i], "--allow")==0) {
|
||||
char *p, *ptr;
|
||||
int done;
|
||||
WMHost *hPtr;
|
||||
|
||||
ptr = argv[++i];
|
||||
done = 0;
|
||||
while (!done) {
|
||||
if ((p = strchr(ptr, ',')) != NULL) {
|
||||
*p = 0;
|
||||
}
|
||||
if (*ptr != 0) {
|
||||
hPtr = WMGetHostWithName(ptr);
|
||||
if (hPtr) {
|
||||
if (!allowedHostList)
|
||||
allowedHostList = WMCreateArray(4);
|
||||
WMAddToArray(allowedHostList, hPtr);
|
||||
} else {
|
||||
wwarning(_("Unknown host '%s'. Ignored."), ptr);
|
||||
}
|
||||
}
|
||||
|
||||
if (p!=NULL) {
|
||||
*p = ',';
|
||||
ptr = p+1;
|
||||
} else {
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf(_("%s: invalid argument '%s'\n"), argv[0], argv[i]);
|
||||
printf(_("Try '%s --help' for more information\n"), argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
timeDB = WMGetDefaultsFromPath("./UserTime.plist");
|
||||
WMAddNotificationObserver(updatedDomain, NULL,
|
||||
WMUserDefaultsDidChangeNotification, NULL);
|
||||
|
||||
clientConnections = WMCreateArray(4);
|
||||
|
||||
/* A NULL ServerAddress means to listen on any address the host has.
|
||||
* Else if ServerAddress points to a specific address (like "localhost",
|
||||
* "host.domain.com" or "192.168.1.1"), then it will only listen on that
|
||||
* interface and ignore incoming connections on the others. */
|
||||
if (ServerAddress && strcasecmp(ServerAddress, "Any")==0)
|
||||
ServerAddress = NULL;
|
||||
if (ServerPort==NULL)
|
||||
ServerPort = "34567";
|
||||
|
||||
printf("Server will listen on '%s:%s'\n", ServerAddress?ServerAddress:"Any",
|
||||
ServerPort);
|
||||
printf("This server will allow connections from:");
|
||||
if (allowedHostList) {
|
||||
int i;
|
||||
char *hName;
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(allowedHostList); i++) {
|
||||
hName = WMGetHostName(WMGetFromArray(allowedHostList, i));
|
||||
printf("%s'%s'", i==0?" ":", ", hName);
|
||||
}
|
||||
printf(".\n");
|
||||
} else {
|
||||
printf(" any host.\n");
|
||||
}
|
||||
|
||||
serverPtr = WMCreateConnectionAsServerAtAddress(ServerAddress, ServerPort,
|
||||
NULL);
|
||||
|
||||
if (!serverPtr) {
|
||||
wfatal("could not create server on `%s:%s`. Exiting.",
|
||||
ServerAddress ? ServerAddress : "localhost", ServerPort);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
WMSetConnectionDelegate(serverPtr, &socketDelegate);
|
||||
|
||||
WMAddNotificationObserver(removeConnection, NULL,
|
||||
SEConnectionShouldBeRemovedNotification, NULL);
|
||||
|
||||
while (1) {
|
||||
/* The ASAP notification queue is called at the end of WHandleEvents()
|
||||
* There's where died connections we get while running through
|
||||
* WHandleEvents() get removed. */
|
||||
WHandleEvents();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
5
WINGs/Extras/.cvsignore
Normal file
5
WINGs/Extras/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
Makefile Makefile.in
|
||||
.libs
|
||||
test
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
33
WINGs/Extras/Makefile.am
Normal file
33
WINGs/Extras/Makefile.am
Normal file
@@ -0,0 +1,33 @@
|
||||
## automake input file for WINGs
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
|
||||
|
||||
# is this a kluge? if so, how should i do it?
|
||||
includedir = @includedir@/WINGs
|
||||
|
||||
include_HEADERS = wtableview.h wtabledelegates.h
|
||||
|
||||
|
||||
lib_LIBRARIES = libExtraWINGs.a
|
||||
|
||||
noinst_PROGRAMS = test
|
||||
|
||||
EXTRA_DIST =
|
||||
|
||||
libExtraWINGs_a_SOURCES = \
|
||||
wtableview.c \
|
||||
wtabledelegates.c \
|
||||
wtableview.h \
|
||||
wtabledelegates.h
|
||||
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||
|
||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
||||
@INTLIBS@
|
||||
|
||||
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)
|
||||
|
||||
134
WINGs/Extras/test.c
Normal file
134
WINGs/Extras/test.c
Normal file
@@ -0,0 +1,134 @@
|
||||
|
||||
|
||||
#include <WINGs/WINGs.h>
|
||||
#include <stdio.h>
|
||||
#include "wtableview.h"
|
||||
#include "wtabledelegates.h"
|
||||
|
||||
|
||||
static char *col1[20] = {0};
|
||||
static int col2[20];
|
||||
|
||||
|
||||
static char *options[] = {
|
||||
"Option1",
|
||||
"Option2",
|
||||
"Option3",
|
||||
"Option4",
|
||||
"Option5"
|
||||
};
|
||||
|
||||
|
||||
int numberOfRows(WMTableViewDelegate *self, WMTableView *table)
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
|
||||
void *valueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row)
|
||||
{
|
||||
/*WMTableView *table = (WMTableView*)WMGetTableColumnTableView(column);*/
|
||||
int i;
|
||||
if (col1[0] == 0) {
|
||||
for (i = 0; i < 20; i++) {
|
||||
char buf[128];
|
||||
|
||||
sprintf(buf, "Test row %i", i);
|
||||
|
||||
col1[i] = wstrdup(buf);
|
||||
col2[i] = 0;
|
||||
}
|
||||
}
|
||||
if ((int)WMGetTableColumnId(column) == 1)
|
||||
return col1[row];
|
||||
else
|
||||
return (void*)col2[row];
|
||||
}
|
||||
|
||||
|
||||
void setValueForCell(WMTableViewDelegate *self, WMTableColumn *column, int row,
|
||||
void *data)
|
||||
{
|
||||
if ((int)WMGetTableColumnId(column) == 1)
|
||||
col1[row] = data;
|
||||
else
|
||||
col2[row] = (int)data;
|
||||
}
|
||||
|
||||
|
||||
static WMTableViewDelegate delegate = {
|
||||
NULL,
|
||||
numberOfRows,
|
||||
valueForCell,
|
||||
setValueForCell
|
||||
};
|
||||
|
||||
|
||||
|
||||
void clickedTable(WMWidget *w, void *self)
|
||||
{
|
||||
int row = WMGetTableViewClickedRow((WMTableView*)self);
|
||||
|
||||
WMEditTableViewRow(self, row);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
WMScreen *scr;
|
||||
WMWindow *win;
|
||||
WMTableView *table;
|
||||
WMTableColumn *col;
|
||||
WMTableColumnDelegate *colDeleg;
|
||||
|
||||
WMInitializeApplication("test", &argc, argv);
|
||||
|
||||
scr = WMOpenScreen(NULL);
|
||||
|
||||
XSynchronize(WMScreenDisplay(scr), 1);
|
||||
|
||||
win = WMCreateWindow(scr, "eweq");
|
||||
WMResizeWidget(win, 400, 200);
|
||||
WMMapWidget(win);
|
||||
|
||||
table = WMCreateTableView(win);
|
||||
WMSetViewExpandsToParent(WMWidgetView(table), 10, 10, 10, 10);
|
||||
WMSetTableViewBackgroundColor(table, WMWhiteColor(scr));
|
||||
/*WMSetTableViewGridColor(table, WMGrayColor(scr));*/
|
||||
WMSetTableViewHeaderHeight(table, 20);
|
||||
WMSetTableViewDelegate(table, &delegate);
|
||||
WMSetTableViewAction(table, clickedTable, table);
|
||||
|
||||
colDeleg = WTCreateStringEditorDelegate(table);
|
||||
|
||||
col = WMCreateTableColumn("Group");
|
||||
WMSetTableColumnWidth(col, 180);
|
||||
WMAddTableViewColumn(table, col);
|
||||
WMSetTableColumnDelegate(col, colDeleg);
|
||||
WMSetTableColumnId(col, (void*)1);
|
||||
|
||||
colDeleg = WTCreateEnumSelectorDelegate(table);
|
||||
WTSetEnumSelectorOptions(colDeleg, options, 5);
|
||||
|
||||
col = WMCreateTableColumn("Package");
|
||||
WMSetTableColumnWidth(col, 140);
|
||||
WMAddTableViewColumn(table, col);
|
||||
WMSetTableColumnDelegate(col, colDeleg);
|
||||
WMSetTableColumnId(col, (void*)2);
|
||||
|
||||
colDeleg = WTCreateBooleanSwitchDelegate(table);
|
||||
|
||||
col = WMCreateTableColumn("Bool");
|
||||
WMSetTableColumnWidth(col, 50);
|
||||
WMAddTableViewColumn(table, col);
|
||||
WMSetTableColumnDelegate(col, colDeleg);
|
||||
WMSetTableColumnId(col, (void*)2);
|
||||
|
||||
WMMapWidget(table);
|
||||
WMRealizeWidget(win);
|
||||
WMScreenMainLoop(scr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
616
WINGs/Extras/wtabledelegates.c
Normal file
616
WINGs/Extras/wtabledelegates.c
Normal file
@@ -0,0 +1,616 @@
|
||||
|
||||
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
#include "wtableview.h"
|
||||
|
||||
#include "wtabledelegates.h"
|
||||
|
||||
typedef struct {
|
||||
WMTableView *table;
|
||||
WMFont *font;
|
||||
GC gc;
|
||||
GC selGC;
|
||||
GC textGC;
|
||||
} StringData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMTableView *table;
|
||||
GC selGc;
|
||||
} PixmapData;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMTextField *widget;
|
||||
WMTableView *table;
|
||||
WMFont *font;
|
||||
GC gc;
|
||||
GC selGC;
|
||||
GC textGC;
|
||||
} StringEditorData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMPopUpButton *widget;
|
||||
WMTableView *table;
|
||||
WMFont *font;
|
||||
char **options;
|
||||
int count;
|
||||
GC gc;
|
||||
GC selGC;
|
||||
GC textGC;
|
||||
} EnumSelectorData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMButton *widget;
|
||||
WMTableView *table;
|
||||
Bool state;
|
||||
GC gc;
|
||||
GC selGC;
|
||||
} BooleanSwitchData;
|
||||
|
||||
|
||||
static char *SelectionColor = "#bbbbcc";
|
||||
|
||||
|
||||
|
||||
static void stringDraw(WMScreen *scr, Drawable d, GC gc,
|
||||
GC sgc, GC stgc, WMFont *font, void *data,
|
||||
WMRect rect, Bool selected)
|
||||
{
|
||||
int x, y;
|
||||
XRectangle rects[1];
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
|
||||
x = rect.pos.x + 5;
|
||||
y = rect.pos.y + (rect.size.height - WMFontHeight(font))/2;
|
||||
|
||||
rects[0].x = rect.pos.x+1;
|
||||
rects[0].y = rect.pos.y+1;
|
||||
rects[0].width = rect.size.width-1;
|
||||
rects[0].height = rect.size.height-1;
|
||||
XSetClipRectangles(dpy, gc, 0, 0, rects, 1, YXSorted);
|
||||
|
||||
if (!selected) {
|
||||
XFillRectangles(dpy, d, gc, rects, 1);
|
||||
|
||||
WMDrawString(scr, d, stgc, font, x, y,
|
||||
data, strlen(data));
|
||||
} else {
|
||||
XFillRectangles(dpy, d, sgc, rects, 1);
|
||||
|
||||
WMDrawString(scr, d, stgc, font, x, y,
|
||||
data, strlen(data));
|
||||
}
|
||||
|
||||
XSetClipMask(dpy, gc, None);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void pixmapDraw(WMScreen *scr, Drawable d, GC gc, GC sgc,
|
||||
WMPixmap *pixmap, WMRect rect, Bool selected)
|
||||
{
|
||||
int x, y;
|
||||
XRectangle rects[1];
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
WMSize size;
|
||||
|
||||
rects[0].x = rect.pos.x+1;
|
||||
rects[0].y = rect.pos.y+1;
|
||||
rects[0].width = rect.size.width-1;
|
||||
rects[0].height = rect.size.height-1;
|
||||
XSetClipRectangles(dpy, gc, 0, 0, rects, 1, YXSorted);
|
||||
|
||||
if (!selected) {
|
||||
XFillRectangles(dpy, d, gc, rects, 1);
|
||||
|
||||
if (pixmap) {
|
||||
size = WMGetPixmapSize(pixmap);
|
||||
x = rect.pos.x + (rect.size.width - size.width) / 2;
|
||||
y = rect.pos.y + (rect.size.height - size.height) / 2;
|
||||
|
||||
WMDrawPixmap(pixmap, d, x, y);
|
||||
}
|
||||
} else {
|
||||
XFillRectangles(dpy, d, sgc, rects, 1);
|
||||
|
||||
if (pixmap) {
|
||||
size = WMGetPixmapSize(pixmap);
|
||||
x = rect.pos.x + (rect.size.width - size.width) / 2;
|
||||
y = rect.pos.y + (rect.size.height - size.height) / 2;
|
||||
|
||||
WMDrawPixmap(pixmap, d, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
XSetClipMask(dpy, gc, None);
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
static void SECellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
StringEditorData *strdata = (StringEditorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC, strdata->textGC, strdata->font,
|
||||
WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedSECellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
StringEditorData *strdata = (StringEditorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC, strdata->textGC, strdata->font,
|
||||
WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
True);
|
||||
}
|
||||
|
||||
|
||||
static void beginSECellEdit(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
StringEditorData *strdata = (StringEditorData*)self->data;
|
||||
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
|
||||
void *data = WMTableViewDataForCell(strdata->table, column, row);
|
||||
|
||||
WMSetTextFieldText(strdata->widget, (char*)data);
|
||||
WMMoveWidget(strdata->widget, rect.pos.x, rect.pos.y);
|
||||
WMResizeWidget(strdata->widget, rect.size.width+1, rect.size.height+1);
|
||||
|
||||
WMMapWidget(strdata->widget);
|
||||
}
|
||||
|
||||
|
||||
static void endSECellEdit(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
StringEditorData *strdata = (StringEditorData*)self->data;
|
||||
char *text;
|
||||
|
||||
WMUnmapWidget(strdata->widget);
|
||||
|
||||
text = WMGetTextFieldText(strdata->widget);
|
||||
WMSetTableViewDataForCell(strdata->table, column, row, (void*)text);
|
||||
}
|
||||
|
||||
|
||||
WMTableColumnDelegate *WTCreateStringEditorDelegate(WMTableView *parent)
|
||||
{
|
||||
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
|
||||
WMScreen *scr = WMWidgetScreen(parent);
|
||||
StringEditorData *data = wmalloc(sizeof(StringEditorData));
|
||||
|
||||
data->widget = WMCreateTextField(parent);
|
||||
W_ReparentView(WMWidgetView(data->widget),
|
||||
WMGetTableViewDocumentView(parent),
|
||||
0, 0);
|
||||
data->table = parent;
|
||||
data->font = WMSystemFontOfSize(scr, 12);
|
||||
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
|
||||
data->textGC = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMWhiteColor(scr));
|
||||
|
||||
delegate->data = data;
|
||||
delegate->drawCell = SECellPainter;
|
||||
delegate->drawSelectedCell = selectedSECellPainter;
|
||||
delegate->beginCellEdit = beginSECellEdit;
|
||||
delegate->endCellEdit = endSECellEdit;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
static void ESCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
|
||||
stringDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC, strdata->textGC, strdata->font,
|
||||
strdata->options[i],
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedESCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
|
||||
stringDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC, strdata->textGC, strdata->font,
|
||||
strdata->options[i],
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
True);
|
||||
}
|
||||
|
||||
|
||||
static void beginESCellEdit(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
|
||||
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
|
||||
int data = (int)WMTableViewDataForCell(strdata->table, column, row);
|
||||
|
||||
wassertr(data < strdata->count);
|
||||
|
||||
WMSetPopUpButtonSelectedItem(strdata->widget, data);
|
||||
|
||||
WMMoveWidget(strdata->widget, rect.pos.x, rect.pos.y);
|
||||
WMResizeWidget(strdata->widget, rect.size.width, rect.size.height+1);
|
||||
|
||||
WMMapWidget(strdata->widget);
|
||||
}
|
||||
|
||||
|
||||
static void endESCellEdit(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
|
||||
int option;
|
||||
|
||||
WMUnmapWidget(strdata->widget);
|
||||
|
||||
option = WMGetPopUpButtonSelectedItem(strdata->widget);
|
||||
WMSetTableViewDataForCell(strdata->table, column, row, (void*)option);
|
||||
}
|
||||
|
||||
|
||||
WMTableColumnDelegate *WTCreateEnumSelectorDelegate(WMTableView *parent)
|
||||
{
|
||||
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
|
||||
WMScreen *scr = WMWidgetScreen(parent);
|
||||
EnumSelectorData *data = wmalloc(sizeof(EnumSelectorData));
|
||||
|
||||
data->widget = WMCreatePopUpButton(parent);
|
||||
W_ReparentView(WMWidgetView(data->widget),
|
||||
WMGetTableViewDocumentView(parent),
|
||||
0, 0);
|
||||
data->table = parent;
|
||||
data->font = WMSystemFontOfSize(scr, 12);
|
||||
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
|
||||
data->textGC = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMWhiteColor(scr));
|
||||
data->count = 0;
|
||||
data->options = NULL;
|
||||
|
||||
delegate->data = data;
|
||||
delegate->drawCell = ESCellPainter;
|
||||
delegate->drawSelectedCell = selectedESCellPainter;
|
||||
delegate->beginCellEdit = beginESCellEdit;
|
||||
delegate->endCellEdit = endESCellEdit;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
void WTSetEnumSelectorOptions(WMTableColumnDelegate *delegate,
|
||||
char **options, int count)
|
||||
{
|
||||
EnumSelectorData *data = (EnumSelectorData*)delegate->data;
|
||||
int i;
|
||||
|
||||
for (i = 0;
|
||||
i < WMGetPopUpButtonNumberOfItems(data->widget);
|
||||
i++) {
|
||||
WMRemovePopUpButtonItem(data->widget, 0);
|
||||
}
|
||||
|
||||
data->options = options;
|
||||
data->count = count;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
WMAddPopUpButtonItem(data->widget, options[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
static void BSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
|
||||
if (i) {
|
||||
pixmapDraw(scr, d,
|
||||
strdata->gc, strdata->selGC, WMGetSystemPixmap(scr, WSICheckMark),
|
||||
WMTableViewRectForCell(table, column, row), False);
|
||||
} else {
|
||||
pixmapDraw(scr, d,
|
||||
strdata->gc, strdata->selGC, NULL,
|
||||
WMTableViewRectForCell(table, column, row), False);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void selectedBSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
|
||||
if (i) {
|
||||
pixmapDraw(scr, d,
|
||||
strdata->gc, strdata->selGC, WMGetSystemPixmap(scr, WSICheckMark),
|
||||
WMTableViewRectForCell(table, column, row), True);
|
||||
} else {
|
||||
pixmapDraw(scr, d,
|
||||
strdata->gc, strdata->selGC, NULL,
|
||||
WMTableViewRectForCell(table, column, row), True);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void beginBSCellEdit(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
|
||||
WMRect rect = WMTableViewRectForCell(strdata->table, column, row);
|
||||
int data = (int)WMTableViewDataForCell(strdata->table, column, row);
|
||||
|
||||
WMSetButtonSelected(strdata->widget, data);
|
||||
WMMoveWidget(strdata->widget, rect.pos.x+1, rect.pos.y+1);
|
||||
WMResizeWidget(strdata->widget, rect.size.width-1, rect.size.height-1);
|
||||
|
||||
WMMapWidget(strdata->widget);
|
||||
}
|
||||
|
||||
|
||||
static void endBSCellEdit(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
|
||||
int value;
|
||||
|
||||
value = WMGetButtonSelected(strdata->widget);
|
||||
WMSetTableViewDataForCell(strdata->table, column, row, (void*)value);
|
||||
WMUnmapWidget(strdata->widget);
|
||||
}
|
||||
|
||||
|
||||
WMTableColumnDelegate *WTCreateBooleanSwitchDelegate(WMTableView *parent)
|
||||
{
|
||||
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
|
||||
WMScreen *scr = WMWidgetScreen(parent);
|
||||
BooleanSwitchData *data = wmalloc(sizeof(BooleanSwitchData));
|
||||
WMColor *color;
|
||||
|
||||
data->widget = WMCreateSwitchButton(parent);
|
||||
W_ReparentView(WMWidgetView(data->widget),
|
||||
WMGetTableViewDocumentView(parent),
|
||||
0, 0);
|
||||
WMSetButtonText(data->widget, NULL);
|
||||
WMSetButtonImagePosition(data->widget, WIPImageOnly);
|
||||
WMSetButtonImage(data->widget, NULL);
|
||||
WMSetButtonAltImage(data->widget, WMGetSystemPixmap(scr, WSICheckMark));
|
||||
|
||||
data->table = parent;
|
||||
color = WMCreateNamedColor(scr, SelectionColor, False);
|
||||
WMSetWidgetBackgroundColor(data->widget, color);
|
||||
data->gc = WMColorGC(WMWhiteColor(scr));
|
||||
data->selGC = WMColorGC(color);
|
||||
|
||||
delegate->data = data;
|
||||
delegate->drawCell = BSCellPainter;
|
||||
delegate->drawSelectedCell = selectedBSCellPainter;
|
||||
delegate->beginCellEdit = beginBSCellEdit;
|
||||
delegate->endCellEdit = endBSCellEdit;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
static void SCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC, strdata->textGC, strdata->font,
|
||||
WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC, strdata->textGC, strdata->font,
|
||||
WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
True);
|
||||
}
|
||||
|
||||
|
||||
WMTableColumnDelegate *WTCreateStringDelegate(WMTableView *parent)
|
||||
{
|
||||
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
|
||||
WMScreen *scr = WMWidgetScreen(parent);
|
||||
StringData *data = wmalloc(sizeof(StringData));
|
||||
|
||||
data->table = parent;
|
||||
data->font = WMSystemFontOfSize(scr, 12);
|
||||
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
|
||||
data->textGC = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMWhiteColor(scr));
|
||||
|
||||
delegate->data = data;
|
||||
delegate->drawCell = SCellPainter;
|
||||
delegate->drawSelectedCell = selectedSCellPainter;
|
||||
delegate->beginCellEdit = NULL;
|
||||
delegate->endCellEdit = NULL;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
static void PCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
pixmapDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC,
|
||||
(WMPixmap*)WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedPCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
pixmapDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC,
|
||||
(WMPixmap*)WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
True);
|
||||
}
|
||||
|
||||
|
||||
WMTableColumnDelegate *WTCreatePixmapDelegate(WMTableView *table)
|
||||
{
|
||||
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
StringData *data = wmalloc(sizeof(StringData));
|
||||
|
||||
data->table = table;
|
||||
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
|
||||
data->gc = WMColorGC(WMWhiteColor(scr));
|
||||
|
||||
delegate->data = data;
|
||||
delegate->drawCell = PCellPainter;
|
||||
delegate->drawSelectedCell = selectedPCellPainter;
|
||||
delegate->beginCellEdit = NULL;
|
||||
delegate->endCellEdit = NULL;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
static void drawPSCell(WMTableColumnDelegate *self, Drawable d,
|
||||
WMTableColumn *column, int row, Bool selected)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
void **data;
|
||||
WMPixmap *pix;
|
||||
char *str;
|
||||
WMRect rect;
|
||||
WMSize size;
|
||||
|
||||
data = WMTableViewDataForCell(table, column, row);
|
||||
|
||||
str = (char*)data[0];
|
||||
pix = (WMPixmap*)data[1];
|
||||
|
||||
rect = WMTableViewRectForCell(table, column, row);
|
||||
|
||||
if (pix) {
|
||||
int owidth = rect.size.width;
|
||||
|
||||
size = WMGetPixmapSize(pix);
|
||||
rect.size.width = size.width;
|
||||
|
||||
pixmapDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGC, pix, rect,
|
||||
selected);
|
||||
|
||||
rect.pos.x += size.width-1;
|
||||
rect.size.width = owidth-size.width+1;
|
||||
}
|
||||
|
||||
stringDraw(WMWidgetScreen(table), d,
|
||||
strdata->gc, strdata->selGC, strdata->textGC, strdata->font,
|
||||
str, rect, selected);
|
||||
}
|
||||
|
||||
|
||||
static void PSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
drawPSCell(self, d, column, row, False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedPSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d)
|
||||
{
|
||||
drawPSCell(self, d, column, row, True);
|
||||
}
|
||||
|
||||
|
||||
WMTableColumnDelegate *WTCreatePixmapStringDelegate(WMTableView *parent)
|
||||
{
|
||||
WMTableColumnDelegate *delegate = wmalloc(sizeof(WMTableColumnDelegate));
|
||||
WMScreen *scr = WMWidgetScreen(parent);
|
||||
StringData *data = wmalloc(sizeof(StringData));
|
||||
|
||||
data->table = parent;
|
||||
data->font = WMSystemFontOfSize(scr, 12);
|
||||
data->selGC = WMColorGC(WMCreateNamedColor(scr, SelectionColor, False));
|
||||
data->textGC = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMWhiteColor(scr));
|
||||
|
||||
delegate->data = data;
|
||||
delegate->drawCell = PSCellPainter;
|
||||
delegate->drawSelectedCell = selectedPSCellPainter;
|
||||
delegate->beginCellEdit = NULL;
|
||||
delegate->endCellEdit = NULL;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
25
WINGs/Extras/wtabledelegates.h
Normal file
25
WINGs/Extras/wtabledelegates.h
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
#ifndef _TABLEDELEGATES_H_
|
||||
#define _TABLEDELEGATES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
WMTableColumnDelegate *WTCreatePixmapDelegate(WMTableView *table);
|
||||
WMTableColumnDelegate *WTCreateStringDelegate(WMTableView *table);
|
||||
WMTableColumnDelegate *WTCreatePixmapStringDelegate(WMTableView *parent);
|
||||
|
||||
WMTableColumnDelegate *WTCreateStringEditorDelegate(WMTableView *table);
|
||||
|
||||
WMTableColumnDelegate *WTCreateEnumSelectorDelegate(WMTableView *table);
|
||||
void WTSetEnumSelectorOptions(WMTableColumnDelegate *delegate,
|
||||
char **options, int count);
|
||||
|
||||
WMTableColumnDelegate *WTCreateBooleanSwitchDelegate(WMTableView *parent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1233
WINGs/Extras/wtableview.c
Normal file
1233
WINGs/Extras/wtableview.c
Normal file
File diff suppressed because it is too large
Load Diff
117
WINGs/Extras/wtableview.h
Normal file
117
WINGs/Extras/wtableview.h
Normal file
@@ -0,0 +1,117 @@
|
||||
|
||||
|
||||
|
||||
#ifndef _WTABLEVIEW_H_
|
||||
#define _WTABLEVIEW_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct W_TableColumn WMTableColumn;
|
||||
typedef struct W_TableView WMTableView;
|
||||
|
||||
|
||||
extern const char *WMTableViewSelectionDidChangeNotification;
|
||||
|
||||
|
||||
typedef struct WMTableColumnDelegate {
|
||||
void *data;
|
||||
void (*drawCell)(struct WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d);
|
||||
void (*drawSelectedCell)(struct WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row, Drawable d);
|
||||
|
||||
void (*beginCellEdit)(struct WMTableColumnDelegate *self, WMTableColumn *column,
|
||||
int row);
|
||||
void (*endCellEdit)(struct WMTableColumnDelegate *self, WMTableColumn *column,
|
||||
int row);
|
||||
} WMTableColumnDelegate;
|
||||
|
||||
|
||||
typedef struct W_TableViewDelegate {
|
||||
void *data;
|
||||
int (*numberOfRows)(struct W_TableViewDelegate *self,
|
||||
WMTableView *table);
|
||||
void *(*valueForCell)(struct W_TableViewDelegate *self,
|
||||
WMTableColumn *column, int row);
|
||||
void (*setValueForCell)(struct W_TableViewDelegate *self,
|
||||
WMTableColumn *column, int row, void *value);
|
||||
} WMTableViewDelegate;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WMTableColumn *WMCreateTableColumn(char *title);
|
||||
|
||||
void WMSetTableColumnWidth(WMTableColumn *column, unsigned width);
|
||||
|
||||
void WMSetTableColumnConstraints(WMTableColumn *column,
|
||||
unsigned minWidth, unsigned maxWidth);
|
||||
|
||||
void WMSetTableColumnDelegate(WMTableColumn *column,
|
||||
WMTableColumnDelegate *delegate);
|
||||
|
||||
|
||||
WMTableView *WMGetTableColumnTableView(WMTableColumn *column);
|
||||
|
||||
void WMSetTableColumnId(WMTableColumn *column, void *id);
|
||||
|
||||
void *WMGetTableColumnId(WMTableColumn *column);
|
||||
|
||||
|
||||
WMTableView *WMCreateTableView(WMWidget *parent);
|
||||
|
||||
|
||||
void WMSetTableViewDataSource(WMTableView *table, void *source);
|
||||
|
||||
void *WMGetTableViewDataSource(WMTableView *table);
|
||||
|
||||
void WMSetTableViewHeaderHeight(WMTableView *table, unsigned height);
|
||||
|
||||
void WMAddTableViewColumn(WMTableView *table, WMTableColumn *column);
|
||||
|
||||
void WMSetTableViewDelegate(WMTableView *table, WMTableViewDelegate *delegate);
|
||||
|
||||
void WMSetTableViewAction(WMTableView *table, WMAction *action,
|
||||
void *clientData);
|
||||
|
||||
void *WMGetTableViewClickedColumn(WMTableView *table);
|
||||
|
||||
int WMGetTableViewClickedRow(WMTableView *table);
|
||||
|
||||
WMArray *WMGetTableViewSelectedRows(WMTableView *table);
|
||||
|
||||
WMView *WMGetTableViewDocumentView(WMTableView *table);
|
||||
|
||||
void WMEditTableViewRow(WMTableView *table, int row);
|
||||
|
||||
void WMSelectTableViewRow(WMTableView *table, int row);
|
||||
|
||||
void *WMTableViewDataForCell(WMTableView *table, WMTableColumn *column,
|
||||
int row);
|
||||
|
||||
void WMSetTableViewDataForCell(WMTableView *table, WMTableColumn *column,
|
||||
int row, void *data);
|
||||
|
||||
WMRect WMTableViewRectForCell(WMTableView *table, WMTableColumn *column,
|
||||
int row);
|
||||
|
||||
void WMSetTableViewBackgroundColor(WMTableView *table, WMColor *color);
|
||||
|
||||
void WMSetTableViewGridColor(WMTableView *table, WMColor *color);
|
||||
|
||||
void WMSetTableViewRowHeight(WMTableView *table, int height);
|
||||
|
||||
void WMReloadTableView(WMTableView *table);
|
||||
|
||||
void WMNoteTableViewNumberOfRowsChanged(WMTableView *table);
|
||||
|
||||
void WMScrollTableViewRowToVisible(WMTableView *table, int row);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,84 +2,64 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
SUBDIRS = Resources
|
||||
SUBDIRS = WINGs . po Documentation Resources Examples Extras Tests
|
||||
|
||||
|
||||
LIBLIST= $(top_builddir)/wrlib/libwraster.la\
|
||||
@LIBRARY_SEARCH_PATH@ @GFXLIBS@ @XLIBS@ \
|
||||
-lm @LIBPL@
|
||||
|
||||
|
||||
#lib_LTLIBRARIES = libWINGs.la
|
||||
|
||||
lib_LIBRARIES = libWINGs.a libWUtil.a
|
||||
|
||||
#libWINGs_la_LDFLAGS = -version-info 1:1:0
|
||||
|
||||
include_HEADERS = WINGs.h WUtil.h WINGsP.h
|
||||
|
||||
bin_SCRIPTS = get-wings-flags get-wutil-flags
|
||||
|
||||
noinst_PROGRAMS = wtest wmquery wmfile fontl testmywidget testcolorpanel connect
|
||||
|
||||
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
|
||||
|
||||
testmywidget_LDADD = libWINGs.a $(LIBLIST)
|
||||
|
||||
fontl_SOURCES = fontl.c
|
||||
|
||||
fontl_LDADD = libWINGs.a $(LIBLIST)
|
||||
|
||||
wtest_SOURCES = wtest.c
|
||||
|
||||
wtest_LDADD = libWINGs.a $(LIBLIST)
|
||||
|
||||
wtest_DEPENDENCIES = libWINGs.a
|
||||
|
||||
wmfile_SOURCES = wmfile.c
|
||||
|
||||
wmfile_LDADD = libWINGs.a $(LIBLIST)
|
||||
|
||||
testcolorpanel_SOURCES = testcolorpanel.c
|
||||
|
||||
testcolorpanel_LDADD = libWINGs.a $(LIBLIST)
|
||||
|
||||
wmquery_SOURCES = wmquery.c
|
||||
|
||||
wmquery_LDADD = libWINGs.a $(LIBLIST)
|
||||
|
||||
connect_SOURCES = connect.c
|
||||
|
||||
connect_LDADD = libWUtil.a @LIBRARY_SEARCH_PATH@ @NETLIBS@ @LIBPL@
|
||||
lib_LIBRARIES = libWINGs.a libWUtil.a
|
||||
|
||||
|
||||
EXTRA_DIST = logo.xpm BUGS
|
||||
LDADD= libWINGs.a $(top_builddir)/wrlib/libwraster.la @INTLIBS@
|
||||
|
||||
|
||||
EXTRA_DIST = BUGS
|
||||
|
||||
# wbutton.c
|
||||
libWINGs_a_SOURCES = \
|
||||
WINGs.h \
|
||||
WINGsP.h \
|
||||
array.c \
|
||||
bagtree.c \
|
||||
configuration.c \
|
||||
connection.c \
|
||||
data.c \
|
||||
dragdestination.c \
|
||||
dragsource.c \
|
||||
error.c \
|
||||
findfile.c \
|
||||
handlers.c \
|
||||
hashtable.c \
|
||||
host.c \
|
||||
international.c \
|
||||
memory.c \
|
||||
misc.c \
|
||||
notification.c \
|
||||
proplist.c \
|
||||
selection.c \
|
||||
snprintf.c \
|
||||
string.c \
|
||||
tree.c \
|
||||
userdefaults.c \
|
||||
usleep.c \
|
||||
wapplication.c \
|
||||
wappresource.c \
|
||||
wballoon.c \
|
||||
wbox.c \
|
||||
wbrowser.c \
|
||||
wbutton.c \
|
||||
wcolor.c \
|
||||
wcolorpanel.c \
|
||||
wcolorwell.c \
|
||||
wconfig.h \
|
||||
wevent.c \
|
||||
wfilepanel.c \
|
||||
wframe.c \
|
||||
wfont.c \
|
||||
wfontpanel.c \
|
||||
widgets.c \
|
||||
winputmethod.c \
|
||||
wlabel.c \
|
||||
wlist.c \
|
||||
wmenuitem.c \
|
||||
@@ -88,47 +68,46 @@ libWINGs_a_SOURCES = \
|
||||
wpixmap.c \
|
||||
wpopupbutton.c \
|
||||
wprogressindicator.c \
|
||||
wruler.c \
|
||||
wscroller.c \
|
||||
wscrollview.c \
|
||||
wslider.c \
|
||||
wsplitview.c \
|
||||
wtabview.c \
|
||||
wtext.c \
|
||||
wtextfield.c \
|
||||
wwindow.c \
|
||||
wview.c \
|
||||
error.c \
|
||||
findfile.c \
|
||||
bagarray.c \
|
||||
bagtree.c \
|
||||
connection.c \
|
||||
data.c \
|
||||
hashtable.c \
|
||||
host.c \
|
||||
memory.c \
|
||||
usleep.c
|
||||
wwindow.c
|
||||
|
||||
|
||||
libWUtil_a_SOURCES = \
|
||||
WINGs.h \
|
||||
WINGsP.h \
|
||||
bagarray.c \
|
||||
array.c \
|
||||
bagtree.c \
|
||||
connection.c \
|
||||
data.c \
|
||||
host.c \
|
||||
international.c \
|
||||
notification.c \
|
||||
userdefaults.c \
|
||||
wapplication.c \
|
||||
wutil.c \
|
||||
error.c \
|
||||
findfile.c \
|
||||
handlers.c \
|
||||
hashtable.c \
|
||||
host.c \
|
||||
international.c \
|
||||
memory.c \
|
||||
usleep.c
|
||||
misc.c \
|
||||
notification.c \
|
||||
proplist.c \
|
||||
snprintf.c \
|
||||
string.c \
|
||||
tree.c \
|
||||
userdefaults.c \
|
||||
usleep.c \
|
||||
wapplication.c \
|
||||
wconfig.h \
|
||||
wutil.c
|
||||
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||
CPPFLAGS = @CPPFLAGS@ -DLOCALEDIR=\"$(NLSDIR)\"
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/WINGs/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||
|
||||
|
||||
|
||||
129
WINGs/NEWS
Normal file
129
WINGs/NEWS
Normal file
@@ -0,0 +1,129 @@
|
||||
|
||||
*** Thu Oct 04 06:00:09 EEST 2001 -Dan
|
||||
|
||||
Property lists handling code
|
||||
----------------------------
|
||||
|
||||
Code to handle property lists was added to WINGs. It is more robust
|
||||
than the libPropList code, mostly because some conflicting concepts
|
||||
borrowed from UserDefaults (which libPropList use) are no longer used in
|
||||
the WINGs property lists code. These borrowed concepts conflicted with the
|
||||
retain/release mechanism of property lists and could lead in certain cases
|
||||
to segmentation faults when executing libPropList based code. But the worse
|
||||
part was that these libPropList problems were practically unsolvable without
|
||||
removing one of those conflicting concepts and without a complete redesign.
|
||||
The new WINGs property lists code is also better integrated with the other
|
||||
data types from WINGs and is actively maintained.
|
||||
|
||||
Practically the things that were removed from the WINGs property list
|
||||
implementation compared to the old libPropList implementation, are exactly
|
||||
the UserDefaults borrowed concepts that conflict with the retain/release
|
||||
mechanism:
|
||||
- The container of a proplist object and the associated functions are gone.
|
||||
- The filename associated with a proplist object and the corresponding
|
||||
functions are gone. Now the saving function needs the filename as a
|
||||
parameter.
|
||||
- The synchronization functions are no longer supported. They are part of
|
||||
the UserDefaults and are implemented there.
|
||||
- No functions related to domains/registering were implemented in the WINGs
|
||||
property lists code, because they are also not part of property lists.
|
||||
They are more in connection with UserDefaults and a central point of access
|
||||
for domains.
|
||||
|
||||
The above 2 concepts: container and filename were added to libPropList just
|
||||
to let it support synchronization which was borrowed from UserDefaults.
|
||||
Property lists as defined in the openstep specification are just complex
|
||||
data structures composed of strings, data, arrays, dictionaries and a mix of
|
||||
them and are not associated with any file in particular. UserDefaults on the
|
||||
other hand are property lists read from a specific file and they associate
|
||||
that property list with that file and allow them to be synchronized.
|
||||
|
||||
Old libPropList based code can still be used by linking against the WINGs
|
||||
library containing the new proplist code with minimal changes which are
|
||||
described in detail in the comments at the top of the WINGs/proplist-compat.h
|
||||
header file (the same file carries the #defines for mapping old libPropList
|
||||
functions to the new WINGs proplist functions).
|
||||
Our recommendation is to move to the new functions WINGs provide because
|
||||
they better integrate with other function naming conventions in WINGs.
|
||||
The proplist-compat.h header file is just a way to have old code up and
|
||||
running with minimal changes so that we can remove the old and unmaintained
|
||||
libPropList from systems while keeping to use old libPropList based code
|
||||
without rewriting it and it should not be used for other purposes.
|
||||
|
||||
|
||||
*** Sat Apr 21 09:12:09 EEST 2001 -Dan
|
||||
|
||||
API change
|
||||
----------
|
||||
|
||||
To allow a correct display of icon images with alpha blending in panels and
|
||||
other places where a WINGs based application may use them the following
|
||||
changes took place:
|
||||
|
||||
1. The following functions were renamed:
|
||||
- WMSetApplicationIconImage() --> WMSetApplicationIconPixmap()
|
||||
- WMGetApplicationIconImage() --> WMGetApplicationIconPixmap()
|
||||
- WMSetWindowMiniwindowImage() --> WMSetWindowMiniwindowPixmap()
|
||||
2. The following functions were added:
|
||||
- WMSetApplicationIconImage(WMScreen *scr, RImage *image)
|
||||
- RImage* WMGetApplicationIconImage(WMScreen *scr)
|
||||
- WMPixmap* WMCreateApplicationIconBlendedPixmap(WMScreen *scr, RColor *col)
|
||||
|
||||
As you can see the old functions that operated on WMPixmap images (which are
|
||||
basically X Pixmaps that lack alpha information) were renamed to ...Pixmap()
|
||||
to make them more suggestive about what they do and to make room for the
|
||||
new functions that operate on RImages (that hold alpha information).
|
||||
|
||||
Since the corresponding WMGet... functions only retrieve the stored
|
||||
image/pixmap from the application, I'll outline how the WMSet...
|
||||
functions operate:
|
||||
|
||||
All WM...IconPixmap() functions operate on WMPixmaps
|
||||
All WM...IconImage() functions operate on RImages
|
||||
|
||||
|
||||
- WMSetApplicationIconImage() will set the RImage to be used in panels
|
||||
and will also convert the RImage to a WMPixmap with a threshold of 128
|
||||
and will use that pixmap for the appicon image. If that doesn't satisfy
|
||||
you, you can make a call to WMSetApplicationIconPixmap() on your own to
|
||||
set whatever WMPixmap you see fit for the appicon.
|
||||
|
||||
- WMSetApplicationIconPixmap() will set the WMPixmap to be used for the
|
||||
appicon and for the panels
|
||||
|
||||
|
||||
If you use only one of the above functions, the corresponding image/pixmap
|
||||
will be used everywhere where needed (panels and appicon), but the pixmap
|
||||
version will not be able to handle alpha blending correctly.
|
||||
|
||||
If you use both WMSetApplicationIconImage() and WMSetApplicationIconPixmap()
|
||||
then the RImage will have priority in panels, and the WMPixmap will only be
|
||||
used for the appicon. This allows you to better control what icon is
|
||||
displayed in the appicon, in case the default conversion of the RImage to a
|
||||
pixmap with a threshold of 128 is not good enough, or in case you want a
|
||||
different icon to be shown in the appicon than in panels.
|
||||
|
||||
|
||||
Also this new function was added:
|
||||
|
||||
- WMCreateApplicationIconBlendedPixmap() will use the RImage set with
|
||||
WMSetApplicationIconImage() if available and will blend it with the color
|
||||
you passed. This will make the image show well on a background of that
|
||||
color. If the RImage was not set it will return NULL. You need to call
|
||||
WMReleasePixmap() on it after you finish with it. Passing a NULL pointer
|
||||
instead of a color will make the RImage be blended with the default color
|
||||
of the WINGs widgets: '#aeaaae' making it suitable to be assigned to any
|
||||
WINGs widget.
|
||||
|
||||
|
||||
To make your existing code work as before all you need to do is to rename
|
||||
the following functions:
|
||||
|
||||
- WMSetApplicationIconImage() --> WMSetApplicationIconPixmap()
|
||||
- WMGetApplicationIconImage() --> WMGetApplicationIconPixmap()
|
||||
- WMSetWindowMiniwindowImage() --> WMSetWindowMiniwindowPixmap()
|
||||
|
||||
But if you want to take advantage of the new abilities to show alpha
|
||||
blended images you need to start using the new functions.
|
||||
|
||||
|
||||
12
WINGs/README
12
WINGs/README
@@ -56,22 +56,19 @@ Widgets provided by WINGs:
|
||||
- slider
|
||||
- scrollable view
|
||||
- color well
|
||||
- split view (only 2 subviews)
|
||||
- split view
|
||||
- tabbed view
|
||||
- progress indicator
|
||||
|
||||
- selection (make pasteboard like?)
|
||||
- drag&drop
|
||||
|
||||
- input box
|
||||
- file panel
|
||||
- color panel
|
||||
- alert panel
|
||||
- font panel
|
||||
|
||||
Planned:
|
||||
--------
|
||||
|
||||
- selection (pasteboard like)
|
||||
- drag&drop
|
||||
|
||||
If you think you can code the following, please do. They are needed by
|
||||
WPrefs.app, but the number of other things I have to do is huge.
|
||||
|
||||
@@ -84,7 +81,6 @@ Wish list: (I don't have the know-how or time to do them)
|
||||
|
||||
- text (with support for RTF)
|
||||
- matrix (like NSMatrix)
|
||||
- splitviews with more than 2 subviews
|
||||
- font manager (like NSFontManager)
|
||||
- finish other wigets
|
||||
- optimize list scrolling (XCopyArea() the area that's already drawn)
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = @SHELL@
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
AS = @AS@
|
||||
CC = @CC@
|
||||
CPP_PATH = @CPP_PATH@
|
||||
DFLAGS = @DFLAGS@
|
||||
DLLIBS = @DLLIBS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
GFXLIBS = @GFXLIBS@
|
||||
HEADER_SEARCH_PATH = @HEADER_SEARCH_PATH@
|
||||
ICONEXT = @ICONEXT@
|
||||
INTLIBS = @INTLIBS@
|
||||
LD = @LD@
|
||||
LIBPL = @LIBPL@
|
||||
LIBRARY_SEARCH_PATH = @LIBRARY_SEARCH_PATH@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LITE = @LITE@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MOFILES = @MOFILES@
|
||||
NETLIBS = @NETLIBS@
|
||||
NLSDIR = @NLSDIR@
|
||||
NM = @NM@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
VERSION = @VERSION@
|
||||
WPMOFILES = @WPMOFILES@
|
||||
XCFLAGS = @XCFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XLFLAGS = @XLFLAGS@
|
||||
XLIBS = @XLIBS@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LIBRARY_PATH = @X_LIBRARY_PATH@
|
||||
supported_locales = @supported_locales@
|
||||
wprefsdir = @wprefsdir@
|
||||
|
||||
resdatadir = $(datadir)/WINGs
|
||||
|
||||
resdata_DATA = Images.tiff Images.xpm defaultIcon.tiff defaultIcon.xpm
|
||||
|
||||
EXTRA_DIST = $(resdata_DATA) Images.xcf
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../../src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
DATA = $(resdata_DATA)
|
||||
|
||||
DIST_COMMON = Makefile.am Makefile.in
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu WINGs/Resources/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
install-resdataDATA: $(resdata_DATA)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(resdatadir)
|
||||
@list='$(resdata_DATA)'; for p in $$list; do \
|
||||
if test -f $(srcdir)/$$p; then \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(resdatadir)/$$p"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(resdatadir)/$$p; \
|
||||
else if test -f $$p; then \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(resdatadir)/$$p"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(resdatadir)/$$p; \
|
||||
fi; fi; \
|
||||
done
|
||||
|
||||
uninstall-resdataDATA:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(resdata_DATA)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(resdatadir)/$$p; \
|
||||
done
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = WINGs/Resources
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
here=`cd $(top_builddir) && pwd`; \
|
||||
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||
distdir=`cd $(distdir) && pwd`; \
|
||||
cd $(top_srcdir) \
|
||||
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu WINGs/Resources/Makefile
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
info-am:
|
||||
info: info-am
|
||||
dvi-am:
|
||||
dvi: dvi-am
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data-am: install-resdataDATA
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am: uninstall-resdataDATA
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile $(DATA)
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DESTDIR)$(resdatadir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
|
||||
maintainer-clean-generic:
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-generic distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: uninstall-resdataDATA install-resdataDATA tags distdir info-am \
|
||||
info dvi-am dvi check check-am installcheck-am installcheck \
|
||||
install-exec-am install-exec install-data-am install-data install-am \
|
||||
install uninstall-am uninstall all-redirect all-am all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
@@ -1,4 +1,10 @@
|
||||
- move paint to idle handlers
|
||||
- check if its useful to add some WMBrowserSelectionDidChangeNotification
|
||||
(actually a pass-through for WMListSelectionDidChangeNotification).
|
||||
Or a delegate to be called when the list selection change.
|
||||
- add some way to modify speed when scrolling WMList, depending on how
|
||||
far the mouse is moved outside of the list.
|
||||
|
||||
|
||||
- optimize color allocation for repeated colors
|
||||
- make it work in 8bpp
|
||||
|
||||
5
WINGs/Tests/.cvsignore
Normal file
5
WINGs/Tests/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
Makefile Makefile.in
|
||||
testtext testcolorpanel testmywidget wmfile wmquery wtest
|
||||
.libs
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
21
WINGs/Tests/Makefile.am
Normal file
21
WINGs/Tests/Makefile.am
Normal file
@@ -0,0 +1,21 @@
|
||||
## automake input file for WINGs - Tests
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
noinst_PROGRAMS = wtest wmquery wmfile testmywidget
|
||||
|
||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
||||
@INTLIBS@
|
||||
|
||||
|
||||
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
|
||||
|
||||
wtest_DEPENDENCIES = $(top_builddir)/WINGs/libWINGs.a
|
||||
|
||||
|
||||
EXTRA_DIST = logo.xpm upbtn.xpm wm.html wm.png
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*
|
||||
*
|
||||
*/
|
||||
#include "WINGsP.h"
|
||||
#include <WINGs/WINGsP.h>
|
||||
|
||||
/*
|
||||
* Our public header.
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
|
||||
#include <WINGs.h>
|
||||
#include <WUtil.h>
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
#include "mywidget.h"
|
||||
|
||||
57
WINGs/Tests/upbtn.xpm
Normal file
57
WINGs/Tests/upbtn.xpm
Normal file
@@ -0,0 +1,57 @@
|
||||
/* XPM */
|
||||
static char * upbtn_xpm[] = {
|
||||
"20 22 32 1",
|
||||
" c None",
|
||||
". c #000000",
|
||||
"+ c #FFFFFF",
|
||||
"@ c #4A485A",
|
||||
"# c #524052",
|
||||
"$ c #4A595A",
|
||||
"% c #5A596A",
|
||||
"& c #4A486A",
|
||||
"* c #5A595A",
|
||||
"= c #52556A",
|
||||
"- c #52406A",
|
||||
"; c #6A556A",
|
||||
"> c #5A6D6A",
|
||||
", c #5A597B",
|
||||
"' c #5A6D7B",
|
||||
") c #6A557B",
|
||||
"! c #6A6D7B",
|
||||
"~ c #6A697B",
|
||||
"{ c #6A698B",
|
||||
"] c #7B797B",
|
||||
"^ c #C5C2C5",
|
||||
"/ c #6A818B",
|
||||
"( c #6A7D7B",
|
||||
"_ c #7B698B",
|
||||
": c #6A798B",
|
||||
"< c #7B799C",
|
||||
"[ c #7B798B",
|
||||
"} c #7B8D94",
|
||||
"| c #7B81A4",
|
||||
"1 c #8B85A4",
|
||||
"2 c #73899C",
|
||||
"3 c #7B89A4",
|
||||
" ",
|
||||
" .+ ",
|
||||
" .@#+ ",
|
||||
" .$%$&+ ",
|
||||
" .*=*-*-+ ",
|
||||
" .%%%%%%$%+ ",
|
||||
" .%=%;%=*=*-+ ",
|
||||
" .>%>,''>,>%=%+ ",
|
||||
" .%)>)!~>)>)>=*#+ ",
|
||||
" .>~'~'{'{'~',>%$@+ ",
|
||||
" ]+++^{!{!~!)>+++++ ",
|
||||
" ./{/{({'~+ ",
|
||||
" ._:_:_!~>+ ",
|
||||
" ./</</{'~+ ",
|
||||
" .<<<[_({!+ ",
|
||||
" .}|}</{(~+ ",
|
||||
" .12<[_:{'+ ",
|
||||
" .31}</{'~+ ",
|
||||
" .12<[_!~>+ ",
|
||||
" .2</</{''+ ",
|
||||
" ]+++++++++ ",
|
||||
" "};
|
||||
37
WINGs/Tests/wm.html
Normal file
37
WINGs/Tests/wm.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<HTML><font size=-1>
|
||||
<center>
|
||||
<Img src=wm.png></b><p>
|
||||
<b>GNU Window Maker</B><br>
|
||||
<i>X11 Window Manager</i><p>
|
||||
<u>http://windowmaker.org<br>
|
||||
ftp.windowmaker.org</u></font><Br>
|
||||
</center>
|
||||
|
||||
<b><i>Window Maker</b>
|
||||
<Img src=upbtn.xpm></i>is the GNU window manager
|
||||
for the X Window System. It was
|
||||
designed to emulate the look and feel of part of the NEXTSTEP(tm) GUI. Its
|
||||
supposed to be relatively fast and small, feature rich, easy to configure and
|
||||
easy to use, with a simple and elegant appearance borrowed from NEXTSTEP(tm).
|
||||
<p>
|
||||
<b>Window Maker</b> was designed keeping integration with GNUstep in
|
||||
mind and is the
|
||||
"official" window manager for it. It is also part of the GNU project
|
||||
(<u>www.gnu.org</u>)
|
||||
|
||||
<p>
|
||||
<b>What is <i>GNUstep?</i></b><p>
|
||||
<i><b>G</i>NU</b>step is a complete object-oriented development system, based on the
|
||||
OpenStep specification released by NeXT(tm) (now Apple(tm)) and Sun(tm). It will provide everything one needs to produce cross-platform, object-oriented, graphical (and non-graphical) applications; providing among other things, base system libraries, a high-level GUI application framework that uses a Display PostScript(tm)-like imaging model (DGS), objects for accessing relational databases, distributed objects and a graphical development environment, with tools like interface modeller, a project management system
|
||||
(project center) and other tools.
|
||||
<p>
|
||||
The GNUstep development system will be used to create a user environment,
|
||||
with everything needed for a complete graphical user interface, such as a
|
||||
file viewer, text editors and other applications. Note that the user
|
||||
environment (or "desktop environment") is only a small part of the whole
|
||||
GNUstep project and therefore it does not "compete" with other projects like
|
||||
KDE or GNOME, simply because they are completely different things.
|
||||
<p>
|
||||
For more information on the GNUstep project, visit:
|
||||
<u>http://www.gnustep.org</u> and <u>http://gnustep.current.nu</u>
|
||||
</HTML>
|
||||
BIN
WINGs/Tests/wm.png
Normal file
BIN
WINGs/Tests/wm.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
|
||||
#include "WINGs.h"
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
|
||||
|
||||
|
||||
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
|
||||
WMSetApplicationIconImage(scr, pixmap);
|
||||
WMSetApplicationIconPixmap(scr, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
if (panelType == SAVE_PANEL_TYPE) {
|
||||
sPanel = WMGetSavePanel(scr);
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "WINGs.h"
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
@@ -89,7 +89,7 @@ int main(int argc, char **argv)
|
||||
|
||||
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
|
||||
|
||||
WMSetApplicationIconImage(scr, pixmap); WMReleasePixmap(pixmap);
|
||||
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
|
||||
|
||||
if ((result = WMRunInputPanel(scr, NULL, title, prompt, initial, "OK", "Cancel")) != NULL)
|
||||
printf("%s\n", result);
|
||||
@@ -2,7 +2,7 @@
|
||||
* WINGs test application
|
||||
*/
|
||||
|
||||
#include "WINGs.h"
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -31,6 +31,7 @@ closeAction(WMWidget *self, void *data)
|
||||
{
|
||||
WMDestroyWidget(self);
|
||||
windowCount--;
|
||||
printf("window closed, window count = %d\n", windowCount);
|
||||
if (windowCount < 1)
|
||||
exit(0);
|
||||
}
|
||||
@@ -41,7 +42,7 @@ testOpenFilePanel(WMScreen *scr)
|
||||
{
|
||||
WMOpenPanel *panel;
|
||||
|
||||
windowCount++;
|
||||
/* windowCount++; */
|
||||
|
||||
/* get the shared Open File panel */
|
||||
panel = WMGetOpenPanel(scr);
|
||||
@@ -58,7 +59,7 @@ testFontPanel(WMScreen *scr)
|
||||
{
|
||||
WMFontPanel *panel;
|
||||
|
||||
windowCount++;
|
||||
/*windowCount++;*/
|
||||
|
||||
panel = WMGetFontPanel(scr);
|
||||
|
||||
@@ -69,30 +70,259 @@ testFontPanel(WMScreen *scr)
|
||||
|
||||
|
||||
|
||||
void
|
||||
testFrame(WMScreen *scr)
|
||||
{
|
||||
WMWindow *win;
|
||||
WMFrame *frame;
|
||||
int i;
|
||||
static char* titles[] = {
|
||||
"AboveTop",
|
||||
"AtTop",
|
||||
"BelowTop",
|
||||
"AboveBottom",
|
||||
"AtBottom",
|
||||
"BelowBottom"
|
||||
};
|
||||
static WMTitlePosition pos[] = {
|
||||
WTPAboveTop,
|
||||
WTPAtTop,
|
||||
WTPBelowTop,
|
||||
WTPAboveBottom,
|
||||
WTPAtBottom,
|
||||
WTPBelowBottom
|
||||
};
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "testFrame");
|
||||
WMSetWindowTitle(win, "Frame");
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
WMResizeWidget(win, 400, 300);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
frame = WMCreateFrame(win);
|
||||
WMMoveWidget(frame, 8+(i%3)*130, 8+(i/3)*130);
|
||||
WMResizeWidget(frame, 120, 120);
|
||||
WMSetFrameTitle(frame, titles[i]);
|
||||
WMSetFrameTitlePosition(frame, pos[i]);
|
||||
}
|
||||
|
||||
WMRealizeWidget(win);
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
resizedWindow(void *self, WMNotification *notif)
|
||||
{
|
||||
WMView *view = (WMView*)WMGetNotificationObject(notif);
|
||||
WMSize size = WMGetViewSize(view);
|
||||
|
||||
WMResizeWidget((WMWidget*)self, size.width, size.height);
|
||||
}
|
||||
|
||||
void
|
||||
testBox(WMScreen *scr)
|
||||
{
|
||||
WMWindow *win;
|
||||
WMBox *box, *hbox;
|
||||
WMButton *btn;
|
||||
WMPopUpButton *pop;
|
||||
int i;
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "testBox");
|
||||
WMSetWindowTitle(win, "Box");
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
|
||||
WMSetViewNotifySizeChanges(WMWidgetView(win), True);
|
||||
|
||||
box = WMCreateBox(win);
|
||||
WMSetBoxBorderWidth(box, 5);
|
||||
|
||||
WMAddNotificationObserver(resizedWindow, box,
|
||||
WMViewSizeDidChangeNotification,
|
||||
WMWidgetView(win));
|
||||
WMResizeWidget(win, 400, 300);
|
||||
|
||||
|
||||
/* WMSetBoxHorizontal(box, True); */
|
||||
for (i = 0; i < 4; i++) {
|
||||
btn = WMCreateCommandButton(box);
|
||||
WMSetButtonText(btn, "bla");
|
||||
WMMapWidget(btn);
|
||||
WMAddBoxSubview(box, WMWidgetView(btn), i&1, True, 20, 0, 5);
|
||||
}
|
||||
|
||||
pop = WMCreatePopUpButton(box);
|
||||
WMAddPopUpButtonItem(pop, "ewqeq");
|
||||
WMAddPopUpButtonItem(pop, "ewqeqrewrw");
|
||||
WMAddBoxSubview(box, WMWidgetView(pop), False, True, 20, 0, 5);
|
||||
WMMapWidget(pop);
|
||||
|
||||
hbox = WMCreateBox(box);
|
||||
WMSetBoxHorizontal(hbox, True);
|
||||
WMAddBoxSubview(box, WMWidgetView(hbox), False, True, 24, 0, 0);
|
||||
WMMapWidget(hbox);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
btn = WMCreateCommandButton(hbox);
|
||||
WMSetButtonText(btn, "bla");
|
||||
WMMapWidget(btn);
|
||||
WMAddBoxSubview(hbox, WMWidgetView(btn), 1, True, 60, 0, i<3?5:0);
|
||||
}
|
||||
|
||||
|
||||
WMRealizeWidget(win);
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
singleClick(WMWidget *self, void *data)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
doubleClick(WMWidget *self, void *data)
|
||||
{
|
||||
WMSelectAllListItems((WMList*)self);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
listSelectionObserver(void *observer, WMNotification *notification)
|
||||
{
|
||||
WMLabel *label = (WMLabel*)observer;
|
||||
WMList *lPtr = (WMList*)WMGetNotificationObject(notification);
|
||||
char buf[255];
|
||||
|
||||
sprintf(buf, "Selected items: %d",
|
||||
WMGetArrayItemCount(WMGetListSelectedItems(lPtr)));
|
||||
WMSetLabelText(label, buf);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
testList(WMScreen *scr)
|
||||
{
|
||||
WMWindow *win;
|
||||
WMList *list;
|
||||
WMList *mlist;
|
||||
WMLabel *label;
|
||||
WMLabel *mlabel;
|
||||
WMLabel *title;
|
||||
WMLabel *mtitle;
|
||||
char text[100];
|
||||
int i;
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "testList");
|
||||
WMResizeWidget(win, 370, 250);
|
||||
WMSetWindowTitle(win, "List");
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
|
||||
title = WMCreateLabel(win);
|
||||
WMResizeWidget(title, 150, 20);
|
||||
WMMoveWidget(title, 10, 10);
|
||||
WMSetLabelRelief(title, WRRidge);
|
||||
WMSetLabelText(title, "Single selection list");
|
||||
|
||||
mtitle = WMCreateLabel(win);
|
||||
WMResizeWidget(mtitle, 150, 20);
|
||||
WMMoveWidget(mtitle, 210, 10);
|
||||
WMSetLabelRelief(mtitle, WRRidge);
|
||||
WMSetLabelText(mtitle, "Multiple selection list");
|
||||
|
||||
list = WMCreateList(win);
|
||||
/*WMSetListAllowEmptySelection(list, True);*/
|
||||
WMMoveWidget(list, 10, 40);
|
||||
for (i=0; i<50; i++) {
|
||||
sprintf(text, "Item %i", i);
|
||||
WMAddListItem(list, text);
|
||||
}
|
||||
mlist = WMCreateList(win);
|
||||
WMSetListAllowMultipleSelection(mlist, True);
|
||||
/*WMSetListAllowEmptySelection(mlist, True);*/
|
||||
WMMoveWidget(mlist, 210, 40);
|
||||
for (i=0; i<135; i++) {
|
||||
sprintf(text, "Item %i", i);
|
||||
WMAddListItem(mlist, text);
|
||||
}
|
||||
|
||||
label = WMCreateLabel(win);
|
||||
WMResizeWidget(label, 150, 40);
|
||||
WMMoveWidget(label, 10, 200);
|
||||
WMSetLabelRelief(label, WRRidge);
|
||||
WMSetLabelText(label, "Selected items: 0");
|
||||
|
||||
mlabel = WMCreateLabel(win);
|
||||
WMResizeWidget(mlabel, 150, 40);
|
||||
WMMoveWidget(mlabel, 210, 200);
|
||||
WMSetLabelRelief(mlabel, WRRidge);
|
||||
WMSetLabelText(mlabel, "Selected items: 0");
|
||||
|
||||
WMSetListAction(list, singleClick, label);
|
||||
WMSetListDoubleAction(list, doubleClick, label);
|
||||
WMSetListAction(mlist, singleClick, mlabel);
|
||||
WMSetListDoubleAction(mlist, doubleClick, mlabel);
|
||||
|
||||
WMAddNotificationObserver(listSelectionObserver, label,
|
||||
WMListSelectionDidChangeNotification, list);
|
||||
WMAddNotificationObserver(listSelectionObserver, mlabel,
|
||||
WMListSelectionDidChangeNotification, mlist);
|
||||
|
||||
|
||||
WMRealizeWidget(win);
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
testButton(WMScreen *scr)
|
||||
{
|
||||
WMWindow *win;
|
||||
int i;
|
||||
char *types[] = {
|
||||
"MomentaryPush",
|
||||
"PushOnPushOff",
|
||||
"Toggle",
|
||||
"Switch",
|
||||
"Radio",
|
||||
"MomentaryChange",
|
||||
"OnOff",
|
||||
"MomentaryLigh"
|
||||
};
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "testButton");
|
||||
WMResizeWidget(win, 300, 300);
|
||||
WMSetWindowTitle(win, "Buttons");
|
||||
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
|
||||
for (i = 1; i < 9; i++) {
|
||||
WMButton *b;
|
||||
b = WMCreateButton(win, i);
|
||||
WMResizeWidget(b, 150, 24);
|
||||
WMMoveWidget(b, 20, i*30);
|
||||
WMSetButtonText(b, types[i-1]);
|
||||
}
|
||||
|
||||
WMRealizeWidget(win);
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
}
|
||||
|
||||
|
||||
@@ -127,12 +357,12 @@ testGradientButtons(WMScreen *scr)
|
||||
back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
|
||||
RBevelImage(back, RBEV_RAISED2);
|
||||
pix1 = WMCreatePixmapFromRImage(scr, back, 0);
|
||||
RDestroyImage(back);
|
||||
RReleaseImage(back);
|
||||
|
||||
back = RRenderGradient(60, 24, &dark, &light, RGRD_DIAGONAL);
|
||||
RBevelImage(back, RBEV_SUNKEN);
|
||||
pix2 = WMCreatePixmapFromRImage(scr, back, 0);
|
||||
RDestroyImage(back);
|
||||
RReleaseImage(back);
|
||||
|
||||
color = WMWhiteColor(scr);
|
||||
altColor = WMCreateNamedColor(scr, "red", True);
|
||||
@@ -258,7 +488,6 @@ testColorWell(WMScreen *scr)
|
||||
|
||||
win = WMCreateWindow(scr, "testColor");
|
||||
WMResizeWidget(win, 300, 300);
|
||||
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
|
||||
well1 = WMCreateColorWell(win);
|
||||
@@ -275,10 +504,25 @@ testColorWell(WMScreen *scr)
|
||||
WMMapWidget(win);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
testColorPanel(WMScreen *scr)
|
||||
{
|
||||
WMColorPanel *panel = WMGetColorPanel(scr);
|
||||
|
||||
/*if (colorname) {
|
||||
startcolor = WMCreateNamedColor(scr, colorname, False);
|
||||
WMSetColorPanelColor(panel, startcolor);
|
||||
WMReleaseColor(startcolor);
|
||||
}*/
|
||||
|
||||
WMShowColorPanel(panel);
|
||||
}
|
||||
|
||||
void
|
||||
sliderCallback(WMWidget *w, void *data)
|
||||
{
|
||||
printf("SLIEDER == %i\n", WMGetSliderValue(w));
|
||||
printf("SLIDER == %i\n", WMGetSliderValue(w));
|
||||
}
|
||||
|
||||
|
||||
@@ -322,7 +566,7 @@ testTextField(WMScreen *scr)
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "testText");
|
||||
win = WMCreateWindow(scr, "testTextField");
|
||||
WMResizeWidget(win, 400, 300);
|
||||
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
@@ -343,6 +587,51 @@ testTextField(WMScreen *scr)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
testText(WMScreen *scr)
|
||||
{
|
||||
WMWindow *win;
|
||||
WMText *text;
|
||||
FILE *file = fopen("wm.html", "r");
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "testText");
|
||||
WMResizeWidget(win, 500, 300);
|
||||
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
|
||||
text = WMCreateText(win);
|
||||
WMResizeWidget(text, 480, 280);
|
||||
WMMoveWidget(text, 10, 10);
|
||||
WMSetTextHasVerticalScroller(text, True);
|
||||
WMSetTextEditable(text, False);
|
||||
|
||||
if(file) {
|
||||
char buf[1024];
|
||||
|
||||
WMFreezeText(text);
|
||||
while(fgets(buf, 1023, file))
|
||||
WMAppendTextStream(text, buf);
|
||||
|
||||
fclose(file);
|
||||
WMThawText(text);
|
||||
} else {
|
||||
WMAppendTextStream(text,
|
||||
"Window Maker is the GNU window manager for the "
|
||||
"X Window System. It was designed to emulate the "
|
||||
"look and feel of part of the NEXTSTEP(tm) GUI. Its "
|
||||
"supposed to be relatively fast and small, feature "
|
||||
"rich, easy to configure and easy to use, with a simple "
|
||||
"and elegant appearance borrowed from NEXTSTEP(tm).");
|
||||
}
|
||||
|
||||
WMRealizeWidget(win);
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
testProgressIndicator(WMScreen *scr)
|
||||
{
|
||||
@@ -667,18 +956,302 @@ testSplitView(WMScreen *scr)
|
||||
WMMapWidget(win);
|
||||
}
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
Bool mouseDown;
|
||||
char *filename;
|
||||
} DNDStuff;
|
||||
|
||||
WMPixmap*
|
||||
getImage(WMScreen *scr, char *file)
|
||||
{
|
||||
char buffer[1000];
|
||||
WMPixmap *pix;
|
||||
|
||||
sprintf(buffer, "../../WindowMaker/Icons/%s", file);
|
||||
pix = WMCreatePixmapFromFile(scr, buffer);
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
||||
static void
|
||||
iconMouseStuff(XEvent *event, void *cdata)
|
||||
{
|
||||
WMLabel *label = (WMLabel*)cdata;
|
||||
DNDStuff *stuff = WMGetHangedData(label);
|
||||
WMPoint where;
|
||||
|
||||
switch (event->type) {
|
||||
case ButtonPress:
|
||||
stuff->x = event->xbutton.x;
|
||||
stuff->y = event->xbutton.y;
|
||||
stuff->mouseDown = True;
|
||||
break;
|
||||
case ButtonRelease:
|
||||
stuff->mouseDown = False;
|
||||
break;
|
||||
case MotionNotify:
|
||||
if (!stuff->mouseDown)
|
||||
break;
|
||||
|
||||
if (abs(stuff->x - event->xmotion.x)>4
|
||||
|| abs(stuff->y - event->xmotion.y)>4) {
|
||||
|
||||
where = WMGetViewScreenPosition(WMWidgetView(label));
|
||||
|
||||
WMDragImageFromView(WMWidgetView(label),
|
||||
WMGetLabelImage(label),
|
||||
NULL, /* XXX */
|
||||
where,
|
||||
wmksize(stuff->x, stuff->y),
|
||||
event, True);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
endedDragImage(WMView *self, WMPixmap *image, WMPoint point, Bool deposited)
|
||||
{
|
||||
DNDStuff *stuff = WMGetHangedData(WMWidgetOfView(self));
|
||||
|
||||
if (deposited) {
|
||||
WMDestroyWidget(WMWidgetOfView(self));
|
||||
}
|
||||
|
||||
stuff->mouseDown = False;
|
||||
}
|
||||
|
||||
|
||||
static WMData*
|
||||
fetchDragData(WMView *self, char *type)
|
||||
{
|
||||
DNDStuff *stuff = WMGetHangedData(WMWidgetOfView(self));
|
||||
|
||||
return WMCreateDataWithBytes(stuff->filename, strlen(stuff->filename)+1);
|
||||
}
|
||||
|
||||
|
||||
WMDragSourceProcs dragSourceProcs = {
|
||||
NULL,
|
||||
NULL,
|
||||
endedDragImage,
|
||||
fetchDragData
|
||||
};
|
||||
|
||||
|
||||
/************************/
|
||||
|
||||
|
||||
unsigned
|
||||
draggingEntered(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return WDOperationCopy;
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
draggingUpdated(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return WDOperationCopy;
|
||||
}
|
||||
|
||||
/*
|
||||
void (*draggingExited)(WMView *self, WMDraggingInfo *info);
|
||||
*/
|
||||
char*
|
||||
prepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return "application/X-WINGs-Bla";
|
||||
}
|
||||
|
||||
|
||||
WMLabel* makeDraggableLabel(WMWidget *w, char *file, int x, int y);
|
||||
|
||||
Bool
|
||||
performDragOperation(WMView *self, WMDraggingInfo *info, WMData *data)
|
||||
{
|
||||
char *file = (char*)WMDataBytes(data);
|
||||
WMPoint pos;
|
||||
|
||||
pos = WMGetDraggingInfoImageLocation(info);
|
||||
|
||||
if (file!=NULL) {
|
||||
WMLabel *label;
|
||||
WMPoint pos2 = WMGetViewScreenPosition(self);
|
||||
|
||||
|
||||
label = makeDraggableLabel(WMWidgetOfView(self), file,
|
||||
pos.x-pos2.x, pos.y-pos2.y);
|
||||
WMRealizeWidget(label);
|
||||
WMMapWidget(label);
|
||||
}
|
||||
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
concludeDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMDragDestinationProcs dragDestProcs = {
|
||||
draggingEntered,
|
||||
draggingUpdated,
|
||||
NULL,
|
||||
prepareForDragOperation,
|
||||
performDragOperation,
|
||||
concludeDragOperation
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
WMLabel*
|
||||
makeDraggableLabel(WMWidget *w, char *file, int x, int y)
|
||||
{
|
||||
DNDStuff *stuff;
|
||||
WMLabel *label;
|
||||
WMPixmap *image = getImage(WMWidgetScreen(w), file);
|
||||
|
||||
stuff = wmalloc(sizeof(DNDStuff));
|
||||
stuff->mouseDown = False;
|
||||
|
||||
stuff->filename = wstrdup(file);
|
||||
|
||||
label = WMCreateLabel(w);
|
||||
WMResizeWidget(label, 48, 48);
|
||||
WMMoveWidget(label, x, y);
|
||||
|
||||
WMSetViewDragSourceProcs(WMWidgetView(label), &dragSourceProcs);
|
||||
|
||||
WMHangData(label, stuff);
|
||||
|
||||
WMCreateEventHandler(WMWidgetView(label),
|
||||
ButtonPressMask|ButtonReleaseMask|ButtonMotionMask,
|
||||
iconMouseStuff, label);
|
||||
|
||||
|
||||
if (image != NULL) {
|
||||
WMSetLabelImagePosition(label, WIPImageOnly);
|
||||
WMSetLabelImage(label, image);
|
||||
WMReleasePixmap(image);
|
||||
} else puts(file);
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
testDragAndDrop(WMScreen *scr)
|
||||
{
|
||||
WMWindow *win;
|
||||
WMFrame *frame;
|
||||
WMLabel *label;
|
||||
int i, j;
|
||||
DIR *dir;
|
||||
struct dirent *ent;
|
||||
char *types[] = {
|
||||
"application/X-WINGs-Bla",
|
||||
NULL
|
||||
};
|
||||
|
||||
windowCount++;
|
||||
|
||||
win = WMCreateWindow(scr, "dragDrop");
|
||||
WMResizeWidget(win, 300, 300);
|
||||
WMSetWindowCloseAction(win, closeAction, NULL);
|
||||
WMSetWindowTitle(win, "Drag and Drop");
|
||||
|
||||
|
||||
frame = WMCreateFrame(win);
|
||||
WMSetFrameRelief(frame, WRSunken);
|
||||
WMResizeWidget(frame, 250, 250);
|
||||
WMMoveWidget(frame, 25, 25);
|
||||
|
||||
WMRegisterViewForDraggedTypes(WMWidgetView(frame), types);
|
||||
WMSetViewDragDestinationProcs(WMWidgetView(frame), &dragDestProcs);
|
||||
|
||||
dir = opendir("../../WindowMaker/Icons");
|
||||
if (!dir) {
|
||||
perror("../../WindowMaker/Icons");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0, j=0; j < 8; i++) {
|
||||
ent = readdir(dir);
|
||||
if (!ent)
|
||||
break;
|
||||
|
||||
if (strstr(ent->d_name, ".xpm")==NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
label = makeDraggableLabel(frame, ent->d_name,4+(j/4)*64, 4+(j%4)*64);
|
||||
|
||||
j++;
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
WMMapSubwidgets(frame);
|
||||
|
||||
WMMapSubwidgets(win);
|
||||
WMRealizeWidget(win);
|
||||
WMMapWidget(win);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
|
||||
|
||||
void
|
||||
testUD()
|
||||
{
|
||||
WMUserDefaults *defs;
|
||||
char str[32];
|
||||
|
||||
defs = WMGetStandardUserDefaults();
|
||||
|
||||
sprintf(str, "TEST DATA");
|
||||
puts(str);
|
||||
WMSetUDStringForKey(defs, str, "testKey");
|
||||
puts(str);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
WMScreen *scr;
|
||||
WMPixmap *pixmap;
|
||||
|
||||
|
||||
/* Initialize the application */
|
||||
WMInitializeApplication("Test", &argc, argv);
|
||||
WMInitializeApplication("Test@eqweq_ewq$eqw", &argc, argv);
|
||||
|
||||
testUD();
|
||||
|
||||
/*
|
||||
* Open connection to the X display.
|
||||
@@ -694,7 +1267,7 @@ int main(int argc, char **argv)
|
||||
* Do NOT use it unless when debugging. It will cause a major
|
||||
* slowdown in your application
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
#if 1
|
||||
XSynchronize(dpy, True);
|
||||
#endif
|
||||
/*
|
||||
@@ -710,7 +1283,7 @@ int main(int argc, char **argv)
|
||||
/*
|
||||
* Makes the logo be used in standard dialog panels.
|
||||
*/
|
||||
WMSetApplicationIconImage(scr, pixmap); WMReleasePixmap(pixmap);
|
||||
WMSetApplicationIconPixmap(scr, pixmap); WMReleasePixmap(pixmap);
|
||||
|
||||
/*
|
||||
* Do some test stuff.
|
||||
@@ -719,23 +1292,40 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
|
||||
|
||||
testColorWell(scr);
|
||||
#if 0
|
||||
testTabView(scr);
|
||||
|
||||
testDragAndDrop(scr);
|
||||
testText(scr);
|
||||
#if 0
|
||||
testColorPanel(scr);
|
||||
testScrollView(scr);
|
||||
testTabView(scr);
|
||||
testBox(scr);
|
||||
testText(scr);
|
||||
testList(scr);
|
||||
|
||||
testProgressIndicator(scr);
|
||||
|
||||
testColorWell(scr);
|
||||
|
||||
testTextField(scr);
|
||||
|
||||
testDragAndDrop(scr);
|
||||
testFontPanel(scr);
|
||||
|
||||
testButton(scr);
|
||||
|
||||
testFrame(scr);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
testSplitView(scr);
|
||||
|
||||
testGradientButtons(scr);
|
||||
testProgressIndicator(scr);
|
||||
|
||||
testTextField(scr);
|
||||
|
||||
testOpenFilePanel(scr);
|
||||
testList(scr);
|
||||
testScrollView(scr);
|
||||
|
||||
|
||||
testSlider(scr);
|
||||
testPullDown(scr);
|
||||
1
WINGs/WINGs/.cvsignore
Normal file
1
WINGs/WINGs/.cvsignore
Normal file
@@ -0,0 +1 @@
|
||||
Makefile Makefile.in
|
||||
9
WINGs/WINGs/Makefile.am
Normal file
9
WINGs/WINGs/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
## automake input file for WINGs - Headers subdir
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
# is this a kluge? if so, how should i do it?
|
||||
includedir = @includedir@/WINGs
|
||||
|
||||
include_HEADERS = WINGs.h WUtil.h WINGsP.h proplist-compat.h
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#define _WINGS_H_
|
||||
|
||||
#include <wraster.h>
|
||||
#include <WUtil.h>
|
||||
#include <WINGs/WUtil.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
#define WINGS_H_VERSION 991003
|
||||
#define WINGS_H_VERSION 20010117
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -37,28 +37,49 @@ typedef struct {
|
||||
} WMRect;
|
||||
|
||||
|
||||
/* WMRange was moved in WUtil.h */
|
||||
|
||||
|
||||
|
||||
#define ClientMessageMask (1L<<30)
|
||||
|
||||
|
||||
/* window stacking level */
|
||||
#ifndef _DEFINED_GNUSTEP_WINDOW_INFO
|
||||
#define _DEFINED_GNUSTEP_WINDOW_INFO
|
||||
/*
|
||||
* Window levels are taken from GNUstep (gui/AppKit/NSWindow.h)
|
||||
* NSDesktopWindowLevel intended to be the level at which things
|
||||
* on the desktop sit ... so you should be able
|
||||
* to put a desktop background just below it.
|
||||
*
|
||||
* Applications are actually permitted to use any value in the
|
||||
* range INT_MIN+1 to INT_MAX
|
||||
*/
|
||||
enum {
|
||||
WMDesktopWindowLevel = -1000, /* GNUstep addition */
|
||||
WMNormalWindowLevel = 0,
|
||||
WMFloatingWindowLevel = 3,
|
||||
WMDockWindowLevel = 5,
|
||||
WMSubmenuWindowLevel = 10,
|
||||
WMMainMenuWindowLevel = 20
|
||||
WMSubmenuWindowLevel = 3,
|
||||
WMTornOffMenuWindowLevel = 3,
|
||||
WMMainMenuWindowLevel = 20,
|
||||
WMDockWindowLevel = 21, /* Deprecated - use NSStatusWindowLevel */
|
||||
WMStatusWindowLevel = 21,
|
||||
WMModalPanelWindowLevel = 100,
|
||||
WMPopUpMenuWindowLevel = 101,
|
||||
WMScreenSaverWindowLevel = 1000
|
||||
};
|
||||
|
||||
|
||||
/* window attributes */
|
||||
enum {
|
||||
WMBorderlessWindowMask = 0,
|
||||
WMTitledWindowMask = 1,
|
||||
WMClosableWindowMask = 2,
|
||||
WMMiniaturizableWindowMask = 4,
|
||||
WMResizableWindowMask = 8
|
||||
WMResizableWindowMask = 8,
|
||||
WMIconWindowMask = 64,
|
||||
WMMiniWindowMask = 128
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
/* button types */
|
||||
@@ -145,6 +166,8 @@ typedef enum {
|
||||
WSIncrementPage,
|
||||
WSDecrementLine,
|
||||
WSIncrementLine,
|
||||
WSDecrementWheel,
|
||||
WSIncrementWheel,
|
||||
WSKnob,
|
||||
WSKnobSlot
|
||||
} WMScrollerPart;
|
||||
@@ -170,7 +193,7 @@ typedef enum {
|
||||
WTNoTabsBevelBorder,
|
||||
WTNoTabsLineBorder,
|
||||
WTNoTabsNoBorder
|
||||
} WMTabViewTypes;
|
||||
} WMTabViewType;
|
||||
|
||||
|
||||
/* text movement types */
|
||||
@@ -192,6 +215,23 @@ enum {
|
||||
WMDeleteTextEvent
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
WLNotFound = -1 /* element was not found in WMList */
|
||||
};
|
||||
|
||||
|
||||
/* drag operations */
|
||||
typedef enum {
|
||||
WDOperationNone,
|
||||
WDOperationCopy,
|
||||
WDOperationMove,
|
||||
WDOperationLink,
|
||||
WDOperationAsk,
|
||||
WDOperationPrivate
|
||||
} WMDragOperationType;
|
||||
|
||||
|
||||
typedef enum {
|
||||
WMGrayModeColorPanel = 1,
|
||||
WMRGBModeColorPanel = 2,
|
||||
@@ -263,7 +303,10 @@ enum {
|
||||
WC_SplitView = 13,
|
||||
WC_TabView = 14,
|
||||
WC_ProgressIndicator = 15,
|
||||
WC_MenuView = 16
|
||||
WC_MenuView = 16,
|
||||
WC_Ruler = 17,
|
||||
WC_Text = 18,
|
||||
WC_Box = 19
|
||||
};
|
||||
|
||||
/* All widgets must start with the following structure
|
||||
@@ -307,6 +350,10 @@ typedef struct W_Slider WMSlider;
|
||||
typedef struct W_Matrix WMMatrix; /* not ready */
|
||||
typedef struct W_SplitView WMSplitView;
|
||||
typedef struct W_TabView WMTabView;
|
||||
typedef struct W_Ruler WMRuler;
|
||||
typedef struct W_Text WMText;
|
||||
typedef struct W_Box WMBox;
|
||||
|
||||
|
||||
/* not widgets */
|
||||
typedef struct W_TabViewItem WMTabViewItem;
|
||||
@@ -337,6 +384,8 @@ typedef struct WMListItem {
|
||||
/* struct for message panel */
|
||||
typedef struct WMAlertPanel {
|
||||
WMWindow *win; /* window */
|
||||
WMBox *vbox;
|
||||
WMBox *hbox;
|
||||
WMButton *defBtn; /* default button */
|
||||
WMButton *altBtn; /* alternative button */
|
||||
WMButton *othBtn; /* other button */
|
||||
@@ -345,13 +394,30 @@ typedef struct WMAlertPanel {
|
||||
WMLabel *mLbl; /* message label */
|
||||
WMFrame *line; /* separator */
|
||||
short result; /* button that was pushed */
|
||||
short done;
|
||||
|
||||
KeyCode retKey;
|
||||
KeyCode escKey;
|
||||
} WMAlertPanel;
|
||||
|
||||
|
||||
typedef struct WMGenericPanel {
|
||||
WMWindow *win;
|
||||
WMBox *vbox;
|
||||
|
||||
WMLabel *iLbl;
|
||||
WMLabel *tLbl;
|
||||
|
||||
WMFrame *line;
|
||||
|
||||
WMFrame *content;
|
||||
|
||||
WMBox *buttonBox;
|
||||
WMButton *defBtn;
|
||||
WMButton *altBtn;
|
||||
|
||||
short result;
|
||||
} WMGenericPanel;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct WMInputPanel {
|
||||
WMWindow *win; /* window */
|
||||
WMButton *defBtn; /* default button */
|
||||
@@ -360,22 +426,21 @@ typedef struct WMInputPanel {
|
||||
WMLabel *mLbl; /* message label */
|
||||
WMTextField *text; /* text field */
|
||||
short result; /* button that was pushed */
|
||||
short done;
|
||||
|
||||
KeyCode retKey;
|
||||
KeyCode escKey;
|
||||
} WMInputPanel;
|
||||
|
||||
|
||||
/* WMRuler: */
|
||||
typedef struct {
|
||||
WMArray *tabs; /* a growable array of tabstops */
|
||||
unsigned short left; /* left margin marker */
|
||||
unsigned short right; /* right margin marker */
|
||||
unsigned short first; /* indentation marker for first line only */
|
||||
unsigned short body; /* body indentation marker */
|
||||
unsigned short retainCount;
|
||||
} WMRulerMargins;
|
||||
/* All indentation and tab markers are _relative_ to the left margin marker */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef void *WMHandlerID;
|
||||
|
||||
typedef void WMInputProc(int fd, int mask, void *clientData);
|
||||
|
||||
typedef void WMEventProc(XEvent *event, void *clientData);
|
||||
|
||||
typedef void WMEventHook(XEvent *event);
|
||||
@@ -388,12 +453,9 @@ typedef void WMAction(WMWidget *self, void *clientData);
|
||||
typedef void WMAction2(void *self, void *clientData);
|
||||
|
||||
|
||||
typedef void WMCallback(void *data);
|
||||
|
||||
typedef void WMDropDataCallback(WMView *view, WMData *data);
|
||||
|
||||
/* delegate method like stuff */
|
||||
typedef void WMFreeDataProc(void *data);
|
||||
|
||||
typedef void WMListDrawProc(WMList *lPtr, int index, Drawable d, char *text,
|
||||
int state, WMRect *rect);
|
||||
|
||||
@@ -409,15 +471,6 @@ typedef void WMSplitViewConstrainProc(WMSplitView *sPtr, int dividerIndex,
|
||||
typedef WMWidget* WMMatrixCreateCellProc(WMMatrix *mPtr);
|
||||
|
||||
|
||||
typedef Bool WMConvertSelectionProc(WMWidget *w, Atom selection, Atom target,
|
||||
Atom *type, void **value, unsigned *length,
|
||||
int *format);
|
||||
|
||||
typedef void WMLoseSelectionProc(WMWidget *w, Atom selection);
|
||||
|
||||
typedef void WMSelectionDoneProc(WMWidget *w, Atom selection, Atom target);
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct WMBrowserDelegate {
|
||||
@@ -455,6 +508,15 @@ typedef struct WMTextFieldDelegate {
|
||||
} WMTextFieldDelegate;
|
||||
|
||||
|
||||
typedef struct WMTextDelegate {
|
||||
void *data;
|
||||
|
||||
Bool (*didDoubleClickOnPicture)(struct WMTextDelegate *self,
|
||||
void *description);
|
||||
|
||||
} WMTextDelegate;
|
||||
|
||||
|
||||
|
||||
typedef struct WMTabViewDelegate {
|
||||
void *data;
|
||||
@@ -474,6 +536,20 @@ typedef struct WMTabViewDelegate {
|
||||
|
||||
|
||||
|
||||
|
||||
typedef void WMSelectionCallback(WMView *view, Atom selection, Atom target,
|
||||
Time timestamp, void *cdata, WMData *data);
|
||||
|
||||
|
||||
typedef struct WMSelectionProcs {
|
||||
WMData* (*convertSelection)(WMView *view, Atom selection, Atom target,
|
||||
void *cdata, Atom *type);
|
||||
void (*selectionLost)(WMView *view, Atom selection, void *cdata);
|
||||
void (*selectionDone)(WMView *view, Atom selection, Atom target,
|
||||
void *cdata);
|
||||
} WMSelectionProcs;
|
||||
|
||||
|
||||
typedef struct W_DraggingInfo WMDraggingInfo;
|
||||
|
||||
|
||||
@@ -482,7 +558,7 @@ typedef struct W_DragSourceProcs {
|
||||
void (*beganDragImage)(WMView *self, WMPixmap *image, WMPoint point);
|
||||
void (*endedDragImage)(WMView *self, WMPixmap *image, WMPoint point,
|
||||
Bool deposited);
|
||||
WMData* (*fetchDragData)(WMView *self, char *type, Bool local);
|
||||
WMData* (*fetchDragData)(WMView *self, char *type);
|
||||
/* Bool (*ignoreModifierKeysWhileDragging)(WMView *view);*/
|
||||
} WMDragSourceProcs;
|
||||
|
||||
@@ -502,12 +578,14 @@ typedef struct W_DragDestinationProcs {
|
||||
/* ...................................................................... */
|
||||
|
||||
|
||||
WMRange wmkrange(int start, int count);
|
||||
|
||||
WMPoint wmkpoint(int x, int y);
|
||||
|
||||
WMSize wmksize(unsigned int width, unsigned int height);
|
||||
|
||||
#ifdef ANSI_C_DOESNT_LIKE_IT_THIS_WAY
|
||||
#define wmksize(width, height) (WMSize){(width), (height)}
|
||||
#define wmkpoint(x, y) (WMPoint){(x), (y)}
|
||||
#endif
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
@@ -523,6 +601,9 @@ char *WMGetApplicationName();
|
||||
/* Try to locate resource file. ext may be NULL */
|
||||
char* WMPathForResourceOfType(char *resource, char *ext);
|
||||
|
||||
|
||||
WMScreen* WMOpenScreen(const char *display);
|
||||
|
||||
WMScreen* WMCreateScreenWithRContext(Display *display, int screen,
|
||||
RContext *context);
|
||||
|
||||
@@ -532,6 +613,9 @@ WMScreen *WMCreateSimpleApplicationScreen(Display *display);
|
||||
|
||||
void WMScreenMainLoop(WMScreen *scr);
|
||||
|
||||
void WMBreakModalLoop(WMScreen *scr);
|
||||
|
||||
void WMRunModalLoop(WMScreen *scr, WMView *view);
|
||||
|
||||
RContext* WMScreenRContext(WMScreen *scr);
|
||||
|
||||
@@ -541,9 +625,18 @@ int WMScreenDepth(WMScreen *scr);
|
||||
|
||||
|
||||
|
||||
void WMSetApplicationIconImage(WMScreen *app, WMPixmap *icon);
|
||||
void WMSetApplicationIconImage(WMScreen *app, RImage *image);
|
||||
|
||||
WMPixmap *WMGetApplicationIconImage(WMScreen *app);
|
||||
RImage* WMGetApplicationIconImage(WMScreen *app);
|
||||
|
||||
void WMSetApplicationIconPixmap(WMScreen *app, WMPixmap *icon);
|
||||
|
||||
WMPixmap* WMGetApplicationIconPixmap(WMScreen *app);
|
||||
|
||||
/* If color==NULL it will use the default color for panels: ae/aa/ae */
|
||||
WMPixmap* WMCreateApplicationIconBlendedPixmap(WMScreen *scr, RColor *color);
|
||||
|
||||
void WMSetApplicationIconWindow(WMScreen *scr, Window window);
|
||||
|
||||
void WMSetFocusToWidget(WMWidget *widget);
|
||||
|
||||
@@ -561,40 +654,39 @@ void WMDeleteEventHandler(WMView *view, unsigned long mask,
|
||||
|
||||
int WMIsDoubleClick(XEvent *event);
|
||||
|
||||
int WMIsTripleClick(XEvent *event);
|
||||
|
||||
void WMNextEvent(Display *dpy, XEvent *event);
|
||||
|
||||
void WMMaskEvent(Display *dpy, long mask, XEvent *event);
|
||||
|
||||
WMHandlerID WMAddTimerHandler(int milliseconds, WMCallback *callback,
|
||||
|
||||
Bool WMCreateSelectionHandler(WMView *view, Atom selection, Time timestamp,
|
||||
WMSelectionProcs *procs, void *cdata);
|
||||
|
||||
void WMDeleteSelectionHandler(WMView *view, Atom selection, Time timestamp);
|
||||
|
||||
Bool WMRequestSelection(WMView *view, Atom selection, Atom target,
|
||||
Time timestamp, WMSelectionCallback *callback,
|
||||
void *cdata);
|
||||
|
||||
void WMDeleteTimerWithClientData(void *cdata);
|
||||
|
||||
void WMDeleteTimerHandler(WMHandlerID handlerID);
|
||||
|
||||
WMHandlerID WMAddIdleHandler(WMCallback *callback, void *cdata);
|
||||
|
||||
void WMDeleteIdleHandler(WMHandlerID handlerID);
|
||||
|
||||
WMHandlerID WMAddInputHandler(int fd, int condition, WMInputProc *proc,
|
||||
void *clientData);
|
||||
|
||||
void WMDeleteInputHandler(WMHandlerID handlerID);
|
||||
|
||||
Bool WMCreateSelectionHandler(WMWidget *w, Atom selection, Time timestamp,
|
||||
WMConvertSelectionProc *convProc,
|
||||
WMLoseSelectionProc *loseProc,
|
||||
WMSelectionDoneProc *doneProc);
|
||||
|
||||
void WMDeleteSelectionHandler(WMWidget *widget, Atom selection);
|
||||
|
||||
|
||||
/* ....................................................................... */
|
||||
/*
|
||||
void WMDragImageFromView(WMView *view, WMPixmap *image, WMPoint atLocation,
|
||||
WMSize mouseOffset, XEvent *event, Bool slideBack);
|
||||
|
||||
*/
|
||||
void WMSetViewDragSourceProcs(WMView *view, WMDragSourceProcs *procs);
|
||||
|
||||
void WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
WMPoint atLocation, WMSize mouseOffset, XEvent *event,
|
||||
Bool slideBack);
|
||||
|
||||
void WMRegisterViewForDraggedTypes(WMView *view, char *acceptedTypes[]);
|
||||
|
||||
void WMUnregisterViewDraggedTypes(WMView *view);
|
||||
|
||||
void WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs);
|
||||
|
||||
|
||||
WMPoint WMGetDraggingInfoImageLocation(WMDraggingInfo *info);
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
@@ -616,12 +708,29 @@ WMFont *WMUserFontOfSize(WMScreen *scrPtr, int size);
|
||||
WMFont* WMUserFixedPitchFontOfSize(WMScreen *scrPtr, int size);
|
||||
*/
|
||||
|
||||
|
||||
void WMSetWidgetDefaultFont(WMScreen *scr, WMFont *font);
|
||||
|
||||
void WMSetWidgetDefaultBoldFont(WMScreen *scr, WMFont *font);
|
||||
|
||||
WMFont* WMSystemFontOfSize(WMScreen *scrPtr, int size);
|
||||
|
||||
WMFont* WMBoldSystemFontOfSize(WMScreen *scrPtr, int size);
|
||||
|
||||
XFontSet WMGetFontFontSet(WMFont *font);
|
||||
|
||||
WMFont* WMNormalizeFont(WMScreen *scr, WMFont *font);
|
||||
|
||||
WMFont* WMStrengthenFont(WMScreen *scr, WMFont *font);
|
||||
|
||||
WMFont* WMUnstrengthenFont(WMScreen *scr, WMFont *font);
|
||||
|
||||
WMFont* WMEmphasizeFont(WMScreen *scr, WMFont *font);
|
||||
|
||||
WMFont* WMUnemphasizeFont(WMScreen *scr, WMFont *font);
|
||||
|
||||
WMFont* WMGetFontOfSize(WMScreen *scr, WMFont *font, int size);
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
WMPixmap* WMRetainPixmap(WMPixmap *pixmap);
|
||||
@@ -644,6 +753,9 @@ WMSize WMGetPixmapSize(WMPixmap *pixmap);
|
||||
|
||||
WMPixmap* WMCreatePixmapFromFile(WMScreen *scrPtr, char *fileName);
|
||||
|
||||
WMPixmap* WMCreateBlendedPixmapFromRImage(WMScreen *scrPtr, RImage *image,
|
||||
RColor *color);
|
||||
|
||||
WMPixmap* WMCreateBlendedPixmapFromFile(WMScreen *scrPtr, char *fileName,
|
||||
RColor *color);
|
||||
|
||||
@@ -718,6 +830,12 @@ void WMUnmapWidget(WMWidget *w);
|
||||
|
||||
void WMMapWidget(WMWidget *w);
|
||||
|
||||
Bool WMWidgetIsMapped(WMWidget *w);
|
||||
|
||||
void WMRaiseWidget(WMWidget *w);
|
||||
|
||||
void WMLowerWidget(WMWidget *w);
|
||||
|
||||
void WMMoveWidget(WMWidget *w, int x, int y);
|
||||
|
||||
void WMResizeWidget(WMWidget *w, unsigned int width, unsigned int height);
|
||||
@@ -730,6 +848,8 @@ void WMUnmapSubwidgets(WMWidget *w);
|
||||
|
||||
void WMRealizeWidget(WMWidget *w);
|
||||
|
||||
void WMReparentWidget(WMWidget *w, WMWidget *newParent, int x, int y);
|
||||
|
||||
void WMDestroyWidget(WMWidget *widget);
|
||||
|
||||
void WMHangData(WMWidget *widget, void *data);
|
||||
@@ -748,6 +868,9 @@ void WMRedisplayWidget(WMWidget *w);
|
||||
|
||||
void WMSetViewNotifySizeChanges(WMView *view, Bool flag);
|
||||
|
||||
void WMSetViewExpandsToParent(WMView *view, int topOffs, int leftOffs,
|
||||
int rightOffs, int bottomOffs);
|
||||
|
||||
WMSize WMGetViewSize(WMView *view);
|
||||
|
||||
WMPoint WMGetViewPosition(WMView *view);
|
||||
@@ -756,11 +879,17 @@ WMPoint WMGetViewScreenPosition(WMView *view);
|
||||
|
||||
WMWidget* WMWidgetOfView(WMView *view);
|
||||
|
||||
void WMSetViewNextResponder(WMView *view, WMView *responder);
|
||||
|
||||
void WMRelayToNextResponder(WMView *view, XEvent *event);
|
||||
|
||||
/* notifications */
|
||||
extern char *WMViewSizeDidChangeNotification;
|
||||
|
||||
extern char *WMViewRealizedNotification;
|
||||
|
||||
extern char *WMFontPanelDidChangeNotification;
|
||||
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
@@ -794,13 +923,16 @@ void WMSetWindowTitle(WMWindow *wPtr, char *title);
|
||||
|
||||
void WMSetWindowMiniwindowTitle(WMWindow *win, char *title);
|
||||
|
||||
void WMSetWindowMiniwindowImage(WMWindow *win, WMPixmap *pixmap);
|
||||
void WMSetWindowMiniwindowPixmap(WMWindow *win, WMPixmap *pixmap);
|
||||
|
||||
void WMSetWindowCloseAction(WMWindow *win, WMAction *action, void *clientData);
|
||||
|
||||
void WMSetWindowInitialPosition(WMWindow *win, int x, int y);
|
||||
|
||||
void WMSetWindowInitialSize(WMWindow *win, unsigned width, unsigned height);
|
||||
void WMSetWindowUserPosition(WMWindow *win, int x, int y);
|
||||
|
||||
void WMSetWindowAspectRatio(WMWindow *win, int minX, int minY,
|
||||
int maxX, int maxY);
|
||||
|
||||
void WMSetWindowMaxSize(WMWindow *win, unsigned width, unsigned height);
|
||||
|
||||
@@ -888,6 +1020,8 @@ void WMSetLabelImage(WMLabel *lPtr, WMPixmap *image);
|
||||
|
||||
WMPixmap* WMGetLabelImage(WMLabel *lPtr);
|
||||
|
||||
char* WMGetLabelText(WMLabel *lPtr);
|
||||
|
||||
void WMSetLabelImagePosition(WMLabel *lPtr, WMImagePosition position);
|
||||
|
||||
void WMSetLabelTextAlignment(WMLabel *lPtr, WMAlignment alignment);
|
||||
@@ -896,6 +1030,8 @@ void WMSetLabelRelief(WMLabel *lPtr, WMReliefType relief);
|
||||
|
||||
void WMSetLabelText(WMLabel *lPtr, char *text);
|
||||
|
||||
WMFont* WMGetLabelFont(WMLabel *lPtr);
|
||||
|
||||
void WMSetLabelFont(WMLabel *lPtr, WMFont *font);
|
||||
|
||||
void WMSetLabelTextColor(WMLabel *lPtr, WMColor *color);
|
||||
@@ -972,36 +1108,61 @@ void WMSetScrollerAction(WMScroller *sPtr, WMAction *action, void *clientData);
|
||||
void WMSetScrollerArrowsPosition(WMScroller *sPtr,
|
||||
WMScrollArrowPosition position);
|
||||
|
||||
extern char *WMScrollerDidScrollNotification;
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
WMList* WMCreateList(WMWidget *parent);
|
||||
|
||||
void WMSetListAllowMultipleSelection(WMList *lPtr, Bool flag);
|
||||
|
||||
void WMSetListAllowEmptySelection(WMList *lPtr, Bool flag);
|
||||
|
||||
#define WMAddListItem(lPtr, text) WMInsertListItem((lPtr), -1, (text))
|
||||
|
||||
WMListItem* WMInsertListItem(WMList *lPtr, int row, char *text);
|
||||
|
||||
void WMSortListItems(WMList *lPtr);
|
||||
|
||||
void WMSortListItemsWithComparer(WMList *lPtr,
|
||||
int (f)(const void*, const void*));
|
||||
void WMSortListItemsWithComparer(WMList *lPtr, WMCompareDataProc *func);
|
||||
|
||||
int WMFindRowOfListItemWithTitle(WMList *lPtr, char *title);
|
||||
|
||||
WMListItem* WMGetListItem(WMList *lPtr, int row);
|
||||
|
||||
WMBag *WMGetListItems(WMList *lPtr);
|
||||
|
||||
WMArray* WMGetListItems(WMList *lPtr);
|
||||
|
||||
void WMRemoveListItem(WMList *lPtr, int row);
|
||||
|
||||
void WMSelectListItem(WMList *lPtr, int row);
|
||||
|
||||
void WMUnselectListItem(WMList *lPtr, int row);
|
||||
|
||||
/* This will select all items in range, and deselect all the others */
|
||||
void WMSetListSelectionToRange(WMList *lPtr, WMRange range);
|
||||
|
||||
/* This will select all items in range, leaving the others as they are */
|
||||
void WMSelectListItemsInRange(WMList *lPtr, WMRange range);
|
||||
|
||||
void WMSelectAllListItems(WMList *lPtr);
|
||||
|
||||
void WMUnselectAllListItems(WMList *lPtr);
|
||||
|
||||
void WMSetListUserDrawProc(WMList *lPtr, WMListDrawProc *proc);
|
||||
|
||||
void WMSetListUserDrawItemHeight(WMList *lPtr, unsigned short height);
|
||||
|
||||
int WMGetListItemHeight(WMList *lPtr);
|
||||
|
||||
/* don't free the returned data */
|
||||
WMArray* WMGetListSelectedItems(WMList *lPtr);
|
||||
|
||||
/*
|
||||
* For the following 2 functions, in case WMList allows multiple selection,
|
||||
* the first item in the list of selected items, respective its row number,
|
||||
* will be returned.
|
||||
*/
|
||||
|
||||
/* don't free the returned data */
|
||||
WMListItem* WMGetListSelectedItem(WMList *lPtr);
|
||||
|
||||
@@ -1021,6 +1182,11 @@ void WMSetListBottomPosition(WMList *lPtr, int row);
|
||||
|
||||
int WMGetListPosition(WMList *lPtr);
|
||||
|
||||
Bool WMListAllowsMultipleSelection(WMList *lPtr);
|
||||
|
||||
Bool WMListAllowsEmptySelection(WMList *lPtr);
|
||||
|
||||
|
||||
extern char *WMListDidScrollNotification;
|
||||
extern char *WMListSelectionDidChangeNotification;
|
||||
|
||||
@@ -1028,6 +1194,10 @@ extern char *WMListSelectionDidChangeNotification;
|
||||
|
||||
WMBrowser* WMCreateBrowser(WMWidget *parent);
|
||||
|
||||
void WMSetBrowserAllowMultipleSelection(WMBrowser *bPtr, Bool flag);
|
||||
|
||||
void WMSetBrowserAllowEmptySelection(WMBrowser *bPtr, Bool flag);
|
||||
|
||||
void WMSetBrowserPathSeparator(WMBrowser *bPtr, char *separator);
|
||||
|
||||
void WMSetBrowserTitled(WMBrowser *bPtr, Bool flag);
|
||||
@@ -1047,16 +1217,20 @@ WMListItem *WMInsertBrowserItem(WMBrowser *bPtr, int column, int row, char *text
|
||||
void WMSortBrowserColumn(WMBrowser *bPtr, int column);
|
||||
|
||||
void WMSortBrowserColumnWithComparer(WMBrowser *bPtr, int column,
|
||||
int (f)(const void*, const void*));
|
||||
WMCompareDataProc *func);
|
||||
|
||||
/* Don't free the returned string. */
|
||||
char* WMSetBrowserPath(WMBrowser *bPtr, char *path);
|
||||
|
||||
/* you can free the returned string */
|
||||
/* free the returned string */
|
||||
char* WMGetBrowserPath(WMBrowser *bPtr);
|
||||
/* you can free the returned string */
|
||||
|
||||
/* free the returned string */
|
||||
char* WMGetBrowserPathToColumn(WMBrowser *bPtr, int column);
|
||||
|
||||
/* free the returned array */
|
||||
WMArray* WMGetBrowserPaths(WMBrowser *bPtr);
|
||||
|
||||
void WMSetBrowserAction(WMBrowser *bPtr, WMAction *action, void *clientData);
|
||||
|
||||
void WMSetBrowserDoubleAction(WMBrowser *bPtr, WMAction *action,
|
||||
@@ -1078,6 +1252,12 @@ WMList *WMGetBrowserListInColumn(WMBrowser *bPtr, int column);
|
||||
|
||||
void WMSetBrowserDelegate(WMBrowser *bPtr, WMBrowserDelegate *delegate);
|
||||
|
||||
Bool WMBrowserAllowsMultipleSelection(WMBrowser *bPtr);
|
||||
|
||||
Bool WMBrowserAllowsEmptySelection(WMBrowser *bPtr);
|
||||
|
||||
void WMSetBrowserHasScroller(WMBrowser *bPtr, int hasScroller);
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
|
||||
@@ -1247,6 +1427,8 @@ void WMSetScrollViewRelief(WMScrollView *sPtr, WMReliefType type);
|
||||
|
||||
void WMSetScrollViewContentView(WMScrollView *sPtr, WMView *view);
|
||||
|
||||
WMRect WMGetScrollViewVisibleRect(WMScrollView *sPtr);
|
||||
|
||||
WMScroller* WMGetScrollViewHorizontalScroller(WMScrollView *sPtr);
|
||||
|
||||
WMScroller* WMGetScrollViewVerticalScroller(WMScrollView *sPtr);
|
||||
@@ -1283,7 +1465,9 @@ void WMSetSliderImage(WMSlider *sPtr, WMPixmap *pixmap);
|
||||
|
||||
|
||||
WMSplitView* WMCreateSplitView(WMWidget *parent);
|
||||
|
||||
Bool WMGetSplitViewVertical(WMSplitView *sPtr);
|
||||
|
||||
void WMSetSplitViewVertical(WMSplitView *sPtr, Bool flag);
|
||||
|
||||
int WMGetSplitViewSubviewsCount(WMSplitView *sPtr); /* ??? remove ??? */
|
||||
@@ -1310,12 +1494,176 @@ void WMSetSplitViewResizeSubviewsProc(WMSplitView *sPtr,
|
||||
|
||||
int WMGetSplitViewDividerThickness(WMSplitView *sPtr);
|
||||
|
||||
/* ...................................................................... */
|
||||
|
||||
WMRuler* WMCreateRuler (WMWidget *parent);
|
||||
|
||||
WMRulerMargins* WMGetRulerMargins(WMRuler *rPtr);
|
||||
|
||||
void WMSetRulerMargins(WMRuler *rPtr, WMRulerMargins margins);
|
||||
|
||||
Bool WMIsMarginEqualToMargin(WMRulerMargins *aMargin, WMRulerMargins *anotherMargin);
|
||||
|
||||
int WMGetGrabbedRulerMargin(WMRuler *rPtr);
|
||||
|
||||
int WMGetReleasedRulerMargin(WMRuler *rPtr);
|
||||
|
||||
int WMGetRulerOffset(WMRuler *rPtr);
|
||||
|
||||
void WMSetRulerOffset(WMRuler *rPtr, int pixels);
|
||||
|
||||
void WMSetRulerMoveAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
||||
|
||||
void WMSetRulerReleaseAction(WMRuler *rPtr, WMAction *action, void *clientData);
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
|
||||
#define WMCreateText(parent) WMCreateTextForDocumentType \
|
||||
((parent), (NULL), (NULL))
|
||||
|
||||
WMText* WMCreateTextForDocumentType(WMWidget *parent, WMAction *parser,
|
||||
WMAction *writer);
|
||||
|
||||
void WMSetTextDelegate(WMText *tPtr, WMTextDelegate *delegate);
|
||||
|
||||
void WMFreezeText(WMText *tPtr);
|
||||
|
||||
#define WMRefreshText(tPtr) WMThawText((tPtr))
|
||||
|
||||
void WMThawText(WMText *tPtr);
|
||||
|
||||
int WMScrollText(WMText *tPtr, int amount);
|
||||
|
||||
int WMPageText(WMText *tPtr, Bool direction);
|
||||
|
||||
void WMSetTextHasHorizontalScroller(WMText *tPtr, Bool shouldhave);
|
||||
|
||||
void WMSetTextHasVerticalScroller(WMText *tPtr, Bool shouldhave);
|
||||
|
||||
void WMSetTextHasRuler(WMText *tPtr, Bool shouldhave);
|
||||
|
||||
void WMShowTextRuler(WMText *tPtr, Bool show);
|
||||
|
||||
int WMGetTextRulerShown(WMText *tPtr);
|
||||
|
||||
void WMSetTextEditable(WMText *tPtr, Bool editable);
|
||||
|
||||
int WMGetTextEditable(WMText *tPtr);
|
||||
|
||||
void WMSetTextUsesMonoFont(WMText *tPtr, Bool mono);
|
||||
|
||||
int WMGetTextUsesMonoFont(WMText *tPtr);
|
||||
|
||||
void WMSetTextIndentNewLines(WMText *tPtr, Bool indent);
|
||||
|
||||
void WMSetTextIgnoresNewline(WMText *tPtr, Bool ignore);
|
||||
|
||||
int WMGetTextIgnoresNewline(WMText *tPtr);
|
||||
|
||||
void WMSetTextDefaultFont(WMText *tPtr, WMFont *font);
|
||||
|
||||
WMFont* WMGetTextDefaultFont(WMText *tPtr);
|
||||
|
||||
void WMSetTextDefaultColor(WMText *tPtr, WMColor *color);
|
||||
|
||||
WMColor* WMGetTextDefaultColor(WMText *tPtr);
|
||||
|
||||
void WMSetTextRelief(WMText *tPtr, WMReliefType relief);
|
||||
|
||||
void WMSetTextForegroundColor(WMText *tPtr, WMColor *color);
|
||||
|
||||
void WMSetTextBackgroundColor(WMText *tPtr, WMColor *color);
|
||||
|
||||
void WMSetTextBackgroundPixmap(WMText *tPtr, WMPixmap *pixmap);
|
||||
|
||||
void WMPrependTextStream(WMText *tPtr, char *text);
|
||||
|
||||
void WMAppendTextStream(WMText *tPtr, char *text);
|
||||
|
||||
#define WMClearText(tPtr) WMAppendTextStream \
|
||||
((tPtr), (NULL))
|
||||
|
||||
/* free the text */
|
||||
char* WMGetTextStream(WMText *tPtr);
|
||||
|
||||
/* free the text */
|
||||
char* WMGetTextSelectedStream(WMText *tPtr);
|
||||
|
||||
/* destroy the array */
|
||||
WMArray* WMGetTextObjects(WMText *tPtr);
|
||||
|
||||
/* destroy the array */
|
||||
WMArray* WMGetTextSelectedObjects(WMText *tPtr);
|
||||
|
||||
void WMSetTextSelectionColor(WMText *tPtr, WMColor *color);
|
||||
|
||||
WMColor* WMGetTextSelectionColor(WMText *tPtr);
|
||||
|
||||
void WMSetTextSelectionFont(WMText *tPtr, WMFont *font);
|
||||
|
||||
WMFont* WMGetTextSelectionFont(WMText *tPtr);
|
||||
|
||||
void WMSetTextSelectionUnderlined(WMText *tPtr, int underlined);
|
||||
|
||||
int WMGetTextSelectionUnderlined(WMText *tPtr);
|
||||
|
||||
void WMSetTextAlignment(WMText *tPtr, WMAlignment alignment);
|
||||
|
||||
Bool WMFindInTextStream(WMText *tPtr, char *needle, Bool direction,
|
||||
Bool caseSensitive);
|
||||
|
||||
Bool WMReplaceTextSelection(WMText *tPtr, char *replacement);
|
||||
|
||||
|
||||
/* parser related stuff... use only if implementing a new parser */
|
||||
|
||||
void* WMCreateTextBlockWithObject(WMText *tPtr, WMWidget *w, char *description,
|
||||
WMColor *color, unsigned short first,
|
||||
unsigned short extraInfo);
|
||||
|
||||
void* WMCreateTextBlockWithPixmap(WMText *tPtr, WMPixmap *p, char *description,
|
||||
WMColor *color, unsigned short first,
|
||||
unsigned short extraInfo);
|
||||
|
||||
void* WMCreateTextBlockWithText(WMText *tPtr, char *text, WMFont *font,
|
||||
WMColor *color, unsigned short first,
|
||||
unsigned short length);
|
||||
|
||||
void WMSetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int first,
|
||||
unsigned int kanji, unsigned int underlined,
|
||||
int script, WMRulerMargins *margins);
|
||||
|
||||
/* do NOT free the margins */
|
||||
void WMGetTextBlockProperties(WMText *tPtr, void *vtb, unsigned int *first,
|
||||
unsigned int *kanji, unsigned int *underlined,
|
||||
int *script, WMRulerMargins *margins);
|
||||
|
||||
int WMGetTextInsertType(WMText *tPtr);
|
||||
|
||||
int WMGetTextBlocks(WMText *tPtr);
|
||||
|
||||
void WMSetCurrentTextBlock(WMText *tPtr, int current);
|
||||
|
||||
int WMGetCurrentTextBlock(WMText *tPtr);
|
||||
|
||||
void WMPrependTextBlock(WMText *tPtr, void *vtb);
|
||||
|
||||
void WMAppendTextBlock(WMText *tPtr, void *vtb);
|
||||
|
||||
void* WMRemoveTextBlock(WMText *tPtr);
|
||||
|
||||
void WMDestroyTextBlock(WMText *tPtr, void *vtb);
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
|
||||
WMTabView* WMCreateTabView(WMWidget *parent);
|
||||
|
||||
void WMSetTabViewType(WMTabView *tPtr, WMTabViewType type);
|
||||
|
||||
void WMSetTabViewEnabled(WMTabView *tPtr, Bool flag);
|
||||
|
||||
void WMSetTabViewFont(WMTabView *tPtr, WMFont *font);
|
||||
|
||||
void WMAddItemInTabView(WMTabView *tPtr, WMTabViewItem *item);
|
||||
@@ -1324,6 +1672,9 @@ void WMInsertItemInTabView(WMTabView *tPtr, int index, WMTabViewItem *item);
|
||||
|
||||
void WMRemoveTabViewItem(WMTabView *tPtr, WMTabViewItem *item);
|
||||
|
||||
WMTabViewItem* WMAddTabViewItemWithView(WMTabView *tPtr, WMView *view,
|
||||
int identifier, char *label);
|
||||
|
||||
WMTabViewItem* WMTabViewItemAtPoint(WMTabView *tPtr, int x, int y);
|
||||
|
||||
void WMSelectFirstTabViewItem(WMTabView *tPtr);
|
||||
@@ -1357,6 +1708,23 @@ WMView *WMGetTabViewItemView(WMTabViewItem *item);
|
||||
|
||||
void WMDestroyTabViewItem(WMTabViewItem *item);
|
||||
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
WMBox* WMCreateBox(WMWidget *parent);
|
||||
|
||||
void WMSetBoxBorderWidth(WMBox *box, unsigned width);
|
||||
|
||||
void WMAddBoxSubview(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
||||
int minSize, int maxSize, int space);
|
||||
|
||||
void WMAddBoxSubviewAtEnd(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
||||
int minSize, int maxSize, int space);
|
||||
|
||||
void WMRemoveBoxSubview(WMBox *bPtr, WMView *view);
|
||||
|
||||
void WMSetBoxHorizontal(WMBox *box, Bool flag);
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
int WMRunAlertPanel(WMScreen *app, WMWindow *owner, char *title, char *msg,
|
||||
@@ -1375,10 +1743,17 @@ WMInputPanel *WMCreateInputPanel(WMScreen *app, WMWindow *owner, char *title,
|
||||
char *msg, char *defaultText, char *okButton,
|
||||
char *cancelButton);
|
||||
|
||||
|
||||
WMGenericPanel* WMCreateGenericPanel(WMScreen *scrPtr, WMWindow *owner,
|
||||
char *title, char *defaultButton,
|
||||
char *alternateButton);
|
||||
|
||||
void WMDestroyAlertPanel(WMAlertPanel *panel);
|
||||
|
||||
void WMDestroyInputPanel(WMInputPanel *panel);
|
||||
|
||||
void WMDestroyGenericPanel(WMGenericPanel *panel);
|
||||
|
||||
/* ....................................................................... */
|
||||
|
||||
/* only 1 instance per WMScreen */
|
||||
@@ -6,9 +6,9 @@
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
|
||||
#include "WINGs.h"
|
||||
#include <WINGs/WINGs.h>
|
||||
|
||||
#if WINGS_H_VERSION < 991003
|
||||
#if WINGS_H_VERSION < 20010117
|
||||
#error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
|
||||
#endif
|
||||
|
||||
@@ -101,15 +101,17 @@ struct W_DraggingInfo {
|
||||
WMPixmap *image;
|
||||
WMPoint imageLocation;
|
||||
|
||||
char **types;
|
||||
|
||||
Time timestamp;
|
||||
|
||||
int protocolVersion;
|
||||
|
||||
/* should be treated as internal data */
|
||||
WMView *sourceView;
|
||||
WMView *destView;
|
||||
|
||||
/* only valid if in the same app.. should be treated as internal data */
|
||||
// WMView *destination;
|
||||
// WMView *source;
|
||||
WMSize mouseOffset;
|
||||
unsigned finished:1;
|
||||
};
|
||||
|
||||
|
||||
@@ -130,11 +132,15 @@ typedef struct W_Screen {
|
||||
|
||||
RContext *rcontext;
|
||||
|
||||
struct W_IMContext *imctx;
|
||||
|
||||
/* application related */
|
||||
|
||||
W_FocusInfo *focusInfo;
|
||||
|
||||
struct W_Pixmap *applicationIcon;
|
||||
RImage *applicationIconImage; /* image (can have alpha channel) */
|
||||
struct W_Pixmap *applicationIconPixmap; /* pixmap - no alpha channel */
|
||||
Window applicationIconWindow;
|
||||
|
||||
struct W_Window *windowList; /* list of windows in the app */
|
||||
|
||||
@@ -157,6 +163,7 @@ typedef struct W_Screen {
|
||||
|
||||
Pixmap stipple;
|
||||
|
||||
struct W_View *dragSourceView;
|
||||
struct W_DraggingInfo dragInfo;
|
||||
|
||||
/* colors */
|
||||
@@ -186,6 +193,8 @@ typedef struct W_Screen {
|
||||
|
||||
Bool useMultiByte;
|
||||
|
||||
unsigned int ignoredModifierMask; /* modifiers to ignore when typing txt */
|
||||
|
||||
struct W_Balloon *balloon;
|
||||
|
||||
|
||||
@@ -265,6 +274,14 @@ typedef struct W_Screen {
|
||||
Atom xdndTypeListAtom;
|
||||
Atom xdndStatusAtom;
|
||||
|
||||
Atom xdndActionCopy;
|
||||
Atom xdndActionMove;
|
||||
Atom xdndActionLink;
|
||||
Atom xdndActionAsk;
|
||||
Atom xdndActionPrivate;
|
||||
|
||||
Atom wmIconDragOffsetAtom;
|
||||
|
||||
Atom wmStateAtom; /* WM_STATE */
|
||||
|
||||
/* stuff for detecting double-clicks */
|
||||
@@ -272,7 +289,7 @@ typedef struct W_Screen {
|
||||
Window lastClickWindow; /* window of the last mousedown */
|
||||
|
||||
struct W_View *modalView;
|
||||
unsigned modal:1;
|
||||
unsigned modalLoop:1;
|
||||
unsigned ignoreNextDoubleClick:1;
|
||||
} W_Screen;
|
||||
|
||||
@@ -305,18 +322,25 @@ typedef struct W_View {
|
||||
|
||||
WMSize size;
|
||||
|
||||
short topOffs;
|
||||
short leftOffs;
|
||||
short bottomOffs;
|
||||
short rightOffs;
|
||||
|
||||
WMPoint pos;
|
||||
|
||||
struct W_View *nextFocusChain; /* next/prev in focus chain */
|
||||
struct W_View *prevFocusChain;
|
||||
|
||||
struct W_View *nextResponder; /* next to receive keyboard events */
|
||||
|
||||
struct W_View *parent; /* parent WMView */
|
||||
|
||||
struct W_View *childrenList; /* first in list of child windows */
|
||||
|
||||
struct W_View *nextSister; /* next on parent's children list */
|
||||
|
||||
struct W_EventHandler *handlerList;/* list of event handlers for this window */
|
||||
WMArray *eventHandlers; /* event handlers for this window */
|
||||
|
||||
unsigned long attribFlags;
|
||||
XSetWindowAttributes attribs;
|
||||
@@ -325,6 +349,7 @@ typedef struct W_View {
|
||||
|
||||
WMColor *backColor;
|
||||
|
||||
Cursor cursor;
|
||||
|
||||
Atom *droppableTypes;
|
||||
struct W_DragSourceProcs *dragSourceProcs;
|
||||
@@ -366,8 +391,6 @@ typedef struct W_EventHandler {
|
||||
WMEventProc *proc;
|
||||
|
||||
void *clientData;
|
||||
|
||||
struct W_EventHandler *nextHandler;
|
||||
} W_EventHandler;
|
||||
|
||||
|
||||
@@ -378,7 +401,10 @@ typedef struct _WINGsConfiguration {
|
||||
char *boldSystemFont;
|
||||
int defaultFontSize;
|
||||
Bool useMultiByte;
|
||||
char *floppyPath;
|
||||
unsigned doubleClickDelay;
|
||||
unsigned mouseWheelUp;
|
||||
unsigned mouseWheelDown;
|
||||
} _WINGsConfiguration;
|
||||
|
||||
extern _WINGsConfiguration WINGsConfiguration;
|
||||
@@ -394,6 +420,7 @@ extern _WINGsConfiguration WINGsConfiguration;
|
||||
#define W_VIEW_REALIZED(view) (view)->flags.realized
|
||||
#define W_VIEW_MAPPED(view) (view)->flags.mapped
|
||||
|
||||
#define W_VIEW_DISPLAY(view) (view)->screen->display
|
||||
#define W_VIEW_SCREEN(view) (view)->screen
|
||||
#define W_VIEW_DRAWABLE(view) (view)->window
|
||||
|
||||
@@ -415,6 +442,8 @@ W_View *W_CreateView(W_View *parent);
|
||||
|
||||
W_View *W_CreateTopView(W_Screen *screen);
|
||||
|
||||
W_View *W_CreateUnmanagedTopView(W_Screen *screen);
|
||||
|
||||
|
||||
W_View *W_CreateRootView(W_Screen *screen);
|
||||
|
||||
@@ -424,6 +453,11 @@ void W_RealizeView(W_View *view);
|
||||
|
||||
void W_ReparentView(W_View *view, W_View *newParent, int x, int y);
|
||||
|
||||
void W_RaiseView(W_View *view);
|
||||
|
||||
void W_LowerView(W_View *view);
|
||||
|
||||
|
||||
void W_MapView(W_View *view);
|
||||
|
||||
void W_MapSubviews(W_View *view);
|
||||
@@ -440,11 +474,15 @@ void W_ResizeView(W_View *view, unsigned int width, unsigned int height);
|
||||
|
||||
void W_SetViewBackgroundColor(W_View *view, WMColor *color);
|
||||
|
||||
void W_SetViewCursor(W_View *view, Cursor cursor);
|
||||
|
||||
void W_DrawRelief(W_Screen *scr, Drawable d, int x, int y, unsigned int width,
|
||||
unsigned int height, WMReliefType relief);
|
||||
|
||||
|
||||
void W_CleanUpEvents(W_View *view);
|
||||
void W_DrawReliefWithGC(W_Screen *scr, Drawable d, int x, int y,
|
||||
unsigned int width, unsigned int height,
|
||||
WMReliefType relief,
|
||||
GC black, GC dark, GC light, GC white);
|
||||
|
||||
void W_CallDestroyHandlers(W_View *view);
|
||||
|
||||
@@ -487,15 +525,13 @@ void W_RedisplayView(WMView *view);
|
||||
|
||||
Bool W_ApplicationInitialized(void);
|
||||
|
||||
char *W_GetTextSelection(WMScreen *scr, Atom selection);
|
||||
|
||||
void W_HandleSelectionEvent(XEvent *event);
|
||||
|
||||
void W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event);
|
||||
|
||||
void W_FlushASAPNotificationQueue();
|
||||
void W_FlushASAPNotificationQueue(void);
|
||||
|
||||
void W_FlushIdleNotificationQueue();
|
||||
void W_FlushIdleNotificationQueue(void);
|
||||
|
||||
struct W_Balloon *W_CreateBalloon(WMScreen *scr);
|
||||
|
||||
@@ -503,6 +539,12 @@ void W_BalloonHandleEnterView(WMView *view);
|
||||
|
||||
void W_BalloonHandleLeaveView(WMView *view);
|
||||
|
||||
Bool W_CheckIdleHandlers(void);
|
||||
|
||||
void W_CheckTimerHandlers(void);
|
||||
|
||||
Bool W_HandleInputEvents(Bool waitForInput, int inputfd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
1028
WINGs/WINGs/WUtil.h
Normal file
1028
WINGs/WINGs/WUtil.h
Normal file
File diff suppressed because it is too large
Load Diff
138
WINGs/WINGs/proplist-compat.h
Normal file
138
WINGs/WINGs/proplist-compat.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* This header file is provided for old libPropList compatibility.
|
||||
* DO _NOT_ USE this except for letting your old libPropList-based code to
|
||||
* work with the new property list code from WINGs, with minimal changes.
|
||||
*
|
||||
* All code written with old libPropList functions should work, given
|
||||
* that the following changes are made:
|
||||
*
|
||||
* 1. Replace all
|
||||
* #include <proplist.h>
|
||||
* with
|
||||
* #include <WINGs/proplist-compat.h>
|
||||
* in your code.
|
||||
*
|
||||
* 2. Change all calls to PLSave() to have the extra filename parameter like:
|
||||
* PLSave(proplist_t proplist, char* filename, Bool atomically)
|
||||
*
|
||||
* 3. The PLSetStringCmpHook() function is no longer available. There is a
|
||||
* similar but simpler function provided which is enough for practical
|
||||
* purposes:
|
||||
* PLSetCaseSensitive(Bool caseSensitive)
|
||||
*
|
||||
* 4. The following functions do no longer exist. They were removed because
|
||||
* they were based on concepts borrowed from UserDefaults which conflict
|
||||
* with the retain/release mechanism:
|
||||
* PLSynchronize(), PLDeepSynchronize(), PLShallowSynchronize()
|
||||
* PLSetFilename(), PLGetFilename()
|
||||
* PLGetContainer()
|
||||
* You should change your code to not use them anymore.
|
||||
*
|
||||
* 5. The following functions are no longer available. They were removed
|
||||
* because they also used borrowed concepts which have no place in a
|
||||
* property list as defined in the OpenStep specifications. Also these
|
||||
* functions were hardly ever used in programs to our knowledge.
|
||||
* PLGetDomainNames(), PLGetDomain(), PLSetDomain(), PLDeleteDomain()
|
||||
* PLRegister(), PLUnregister()
|
||||
* You should also change your code to not use them anymore (in case you
|
||||
* ever used them anyway ;-) ).
|
||||
*
|
||||
* 6. Link your program with libWINGs or libWUtil instead of libPropList.
|
||||
* (libWINGs should be used for GUI apps, while libWUtil for non-GUI apps)
|
||||
*
|
||||
*
|
||||
* Our recommandation is to rewrite your code to use the new functions and
|
||||
* link against libWINGs/libWUtil. We do not recommend you to keep using old
|
||||
* libPropList function names. This file is provided just to allow existing
|
||||
* libropList based applications to run with minimal changes with the new
|
||||
* proplist code from WINGs before their authors get the time to rewrite
|
||||
* them. New proplist code from WINGs provide a better integration with the
|
||||
* other data types from WINGs, not to mention that the proplist code in WINGs
|
||||
* is actively maintained while the old libPropList is dead.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _PROPLIST_COMPAT_H_
|
||||
#define _PROPLIST_COMPAT_H_
|
||||
|
||||
#include <WINGs/WUtil.h>
|
||||
|
||||
|
||||
typedef WMPropList* proplist_t;
|
||||
|
||||
|
||||
#ifndef YES
|
||||
#define YES True
|
||||
#endif
|
||||
|
||||
#ifndef NO
|
||||
#define NO False
|
||||
#endif
|
||||
|
||||
|
||||
#define PLSetCaseSensitive(c) WMPLSetCaseSensitive(c)
|
||||
|
||||
#define PLMakeString(bytes) WMCreatePLString(bytes)
|
||||
#define PLMakeData(bytes, length) WMCreatePLDataWithBytes(bytes, length)
|
||||
#define PLMakeArrayFromElements WMCreatePLArray
|
||||
#define PLMakeDictionaryFromEntries WMCreatePLDictionary
|
||||
|
||||
#define PLRetain(pl) WMRetainPropList(pl)
|
||||
#define PLRelease(pl) WMReleasePropList(pl)
|
||||
|
||||
#define PLInsertArrayElement(array, pl, pos) WMInsertInPLArray(array, pos, pl)
|
||||
#define PLAppendArrayElement(array, pl) WMAddToPLArray(array, pl)
|
||||
#define PLRemoveArrayElement(array, pos) WMDeleteFromPLArray(array, pos)
|
||||
#define PLInsertDictionaryEntry(dict, key, value) WMPutInPLDictionary(dict, key, value)
|
||||
#define PLRemoveDictionaryEntry(dict, key) WMRemoveFromPLDictionary(dict, key)
|
||||
#define PLMergeDictionaries(dest, source) WMMergePLDictionaries(dest, source, False)
|
||||
|
||||
#define PLGetNumberOfElements(pl) WMGetPropListItemCount(pl)
|
||||
|
||||
#define PLIsString(pl) WMIsPLString(pl)
|
||||
#define PLIsData(pl) WMIsPLData(pl)
|
||||
#define PLIsArray(pl) WMIsPLArray(pl)
|
||||
#define PLIsDictionary(pl) WMIsPLDictionary(pl)
|
||||
#define PLIsSimple(pl) (WMIsPLString(pl) || WMIsPLData(pl))
|
||||
#define PLIsCompound(pl) (WMIsPLArray(pl) || WMIsPLDictionary(pl))
|
||||
#define PLIsEqual(pl1, pl2) WMIsPropListEqualTo(pl1, pl2)
|
||||
|
||||
#define PLGetString(pl) WMGetFromPLString(pl)
|
||||
#define PLGetDataBytes(pl) WMGetPLDataBytes(pl)
|
||||
#define PLGetDataLength(pl) WMGetPLDataLength(pl)
|
||||
#define PLGetArrayElement(pl, index) WMGetFromPLArray(pl, index)
|
||||
#define PLGetDictionaryEntry(pl, key) WMGetFromPLDictionary(pl, key)
|
||||
#define PLGetAllDictionaryKeys(pl) WMGetPLDictionaryKeys(pl)
|
||||
|
||||
#define PLShallowCopy(pl) WMShallowCopyPropList(pl)
|
||||
#define PLDeepCopy(pl) WMDeepCopyPropList(pl)
|
||||
|
||||
#define PLGetProplistWithDescription(desc) WMCreatePropListFromDescription(desc)
|
||||
#define PLGetDescriptionIndent(pl, level) WMGetPropListDescription(pl, True)
|
||||
#define PLGetDescription(pl) WMGetPropListDescription(pl, False)
|
||||
#define PLGetStringDescription(pl) WMGetPropListDescription(pl, False)
|
||||
#define PLGetDataDescription(pl) WMGetPropListDescription(pl, False)
|
||||
|
||||
#define PLGetProplistWithPath(file) WMReadPropListFromFile(file)
|
||||
#define PLSave(pl, file, atm) WMWritePropListToFile(pl, file, atm)
|
||||
|
||||
|
||||
/* Unsupported functions. Do not ask for them. They're evil :P */
|
||||
#define PLSetStringCmpHook(fn) error_PLSetStringCmpHook_is_not_supported
|
||||
#define PLDeepSynchronize(pl) error_PLDeepSynchronize_is_not_supported
|
||||
#define PLSynchronize(pl) error_PLSynchronize_is_not_supported
|
||||
#define PLShallowSynchronize(pl) error_PLShallowSynchronize_is_not_supported
|
||||
#define PLSetFilename(pl, filename) error_PLSetFilename_is_not_supported
|
||||
#define PLGetFilename(pl, filename) error_PLGetFilename_is_not_supported
|
||||
#define PLGetContainer(pl) error_PLGetContainer_is_not_supported
|
||||
|
||||
#define PLGetDomainNames error_PLGetDomainNames_is_not_supported
|
||||
#define PLGetDomain(name) error_PLGetDomain_is_not_supported
|
||||
#define PLSetDomain(name, value, kickme) error_PLSetDomain_is_not_supported
|
||||
#define PLDeleteDomain(name, kickme) error_PLDeleteDomain_is_not_supported
|
||||
#define PLRegister(name, callback) error_PLRegister_is_not_supported
|
||||
#define PLUnregister(name) error_PLUnregister_is_not_supported
|
||||
|
||||
|
||||
#endif
|
||||
707
WINGs/WUtil.h
707
WINGs/WUtil.h
@@ -1,707 +0,0 @@
|
||||
#ifndef _WUTIL_H_
|
||||
#define _WUTIL_H_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* SunOS 4.x Blargh.... */
|
||||
#ifndef NULL
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Warning: proplist.h #defines BOOL which will clash with the
|
||||
* typedef BOOL in Xmd.h
|
||||
* proplist.h should use Bool (which is a #define in Xlib.h) instead.
|
||||
*
|
||||
*/
|
||||
#include <proplist.h>
|
||||
|
||||
|
||||
#ifndef WMAX
|
||||
# define WMAX(a,b) ((a)>(b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef WMIN
|
||||
# define WMIN(a,b) ((a)<(b) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
#if (!defined (__GNUC__) || __GNUC__ < 2 || \
|
||||
__GNUC_MINOR__ < (defined (__cplusplus) ? 6 : 4))
|
||||
#define __ASSERT_FUNCTION ((char *) 0)
|
||||
#else
|
||||
#define __ASSERT_FUNCTION __PRETTY_FUNCTION__
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NDEBUG
|
||||
|
||||
#define wassertr(expr) {}
|
||||
#define wassertrv(expr, val) {}
|
||||
|
||||
#else /* !NDEBUG */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define wassertr(expr) assert(expr)
|
||||
|
||||
#define wassertrv(expr, val) assert(expr)
|
||||
|
||||
#else /* !DEBUG */
|
||||
|
||||
#define wassertr(expr) \
|
||||
if (!(expr)) { \
|
||||
wwarning("%s line %i (%s): assertion %s failed",\
|
||||
__FILE__, __LINE__, __ASSERT_FUNCTION, #expr);\
|
||||
return;\
|
||||
}
|
||||
|
||||
#define wassertrv(expr, val) \
|
||||
if (!(expr)) { \
|
||||
wwarning("%s line %i (%s): assertion %s failed",\
|
||||
__FILE__, __LINE__, __ASSERT_FUNCTION, #expr);\
|
||||
return (val);\
|
||||
}
|
||||
#endif /* !DEBUG */
|
||||
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
typedef enum {
|
||||
WMPostWhenIdle = 1,
|
||||
WMPostASAP = 2,
|
||||
WMPostNow = 3
|
||||
} WMPostingStyle;
|
||||
|
||||
|
||||
typedef enum {
|
||||
WNCNone = 0,
|
||||
WNCOnName = 1,
|
||||
WNCOnSender = 2
|
||||
} WMNotificationCoalescing;
|
||||
|
||||
|
||||
/* The possible states for connections */
|
||||
typedef enum {
|
||||
WCNotConnected=0,
|
||||
WCListening,
|
||||
WCInProgress,
|
||||
WCFailed,
|
||||
WCConnected,
|
||||
WCDied,
|
||||
WCClosed
|
||||
} WMConnectionState;
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
WBNotFound = INT_MIN /* element was not found in bag */
|
||||
};
|
||||
|
||||
|
||||
typedef struct W_Bag WMBag;
|
||||
typedef struct W_Data WMData;
|
||||
typedef struct W_HashTable WMHashTable;
|
||||
typedef struct W_UserDefaults WMUserDefaults;
|
||||
typedef struct W_Notification WMNotification;
|
||||
typedef struct W_NotificationQueue WMNotificationQueue;
|
||||
typedef struct W_Host WMHost;
|
||||
typedef struct W_Connection WMConnection;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
int position;
|
||||
int count;
|
||||
} WMRange;
|
||||
|
||||
|
||||
|
||||
/* DO NOT ACCESS THE CONTENTS OF THIS STRUCT */
|
||||
typedef struct {
|
||||
void *table;
|
||||
void *nextItem;
|
||||
int index;
|
||||
} WMHashEnumerator;
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* NULL is pointer hash */
|
||||
unsigned (*hash)(const void *);
|
||||
/* NULL is pointer compare */
|
||||
Bool (*keyIsEqual)(const void *, const void *);
|
||||
/* NULL does nothing */
|
||||
void* (*retainKey)(const void *);
|
||||
/* NULL does nothing */
|
||||
void (*releaseKey)(const void *);
|
||||
} WMHashTableCallbacks;
|
||||
|
||||
|
||||
typedef void *WMBagIterator;
|
||||
|
||||
typedef struct W_BagFunctions {
|
||||
int (*getItemCount)(WMBag *self);
|
||||
int (*appendBag)(WMBag *self, WMBag *bag);
|
||||
int (*putInBag)(WMBag *self, void *item);
|
||||
int (*insertInBag)(WMBag *self, int index, void *item);
|
||||
int (*removeFromBag)(WMBag *bag, void *item);
|
||||
int (*eraseFromBag)(WMBag *bag, int index);
|
||||
int (*deleteFromBag)(WMBag *bag, int index);
|
||||
void *(*getFromBag)(WMBag *bag, int index);
|
||||
int (*firstInBag)(WMBag *bag, void *item);
|
||||
int (*countInBag)(WMBag *bag, void *item);
|
||||
void *(*replaceInBag)(WMBag *bag, int index, void *item);
|
||||
int (*sortBag)(WMBag *bag, int (*comparer)(const void*, const void*));
|
||||
void (*emptyBag)(WMBag *bag);
|
||||
void (*freeBag)(WMBag *bag);
|
||||
void (*mapBag)(WMBag *bag, void (*function)(void*, void*), void *data);
|
||||
int (*findInBag)(WMBag *bag, int (*match)(void*));
|
||||
void *(*first)(WMBag *bag, WMBagIterator *ptr);
|
||||
void *(*last)(WMBag *bag, WMBagIterator *ptr);
|
||||
void *(*next)(WMBag *bag, WMBagIterator *ptr);
|
||||
void *(*previous)(WMBag *bag, WMBagIterator *ptr);
|
||||
void *(*iteratorAtIndex)(WMBag *bag, int index, WMBagIterator *ptr);
|
||||
int (*indexForIterator)(WMBag *bag, WMBagIterator ptr);
|
||||
} W_BagFunctions;
|
||||
|
||||
|
||||
struct W_Bag {
|
||||
void *data;
|
||||
|
||||
void (*destructor)(void *item);
|
||||
|
||||
W_BagFunctions func;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
typedef struct {
|
||||
char character; /* the escape character */
|
||||
char *value; /* value to place */
|
||||
} WMSEscapes;
|
||||
#endif
|
||||
|
||||
|
||||
/* The connection callbacks */
|
||||
typedef struct ConnectionDelegate {
|
||||
void *data;
|
||||
|
||||
void (*didCatchException)(struct ConnectionDelegate *self,
|
||||
WMConnection *cPtr);
|
||||
|
||||
void (*didDie)(struct ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
void (*didInitialize)(struct ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
void (*didReceiveInput)(struct ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
void (*didTimeout)(struct ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
} ConnectionDelegate;
|
||||
|
||||
|
||||
typedef void WMNotificationObserverAction(void *observerData,
|
||||
WMNotification *notification);
|
||||
|
||||
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
typedef void (waborthandler)(int);
|
||||
|
||||
waborthandler *wsetabort(waborthandler*);
|
||||
|
||||
|
||||
/* don't free the returned string */
|
||||
char *wstrerror(int errnum);
|
||||
|
||||
void wfatal(const char *msg, ...);
|
||||
void wwarning(const char *msg, ...);
|
||||
void wsyserror(const char *msg, ...);
|
||||
void wsyserrorwithcode(int error, const char *msg, ...);
|
||||
|
||||
char *wfindfile(char *paths, char *file);
|
||||
|
||||
char *wfindfileinlist(char **path_list, char *file);
|
||||
|
||||
char *wfindfileinarray(proplist_t array, char *file);
|
||||
|
||||
char *wexpandpath(char *path);
|
||||
|
||||
/* don't free the returned string */
|
||||
char *wgethomedir();
|
||||
|
||||
void *wmalloc(size_t size);
|
||||
void *wrealloc(void *ptr, size_t newsize);
|
||||
void wfree(void *ptr);
|
||||
|
||||
|
||||
void wrelease(void *ptr);
|
||||
void *wretain(void *ptr);
|
||||
|
||||
char *wstrdup(char *str);
|
||||
|
||||
char *wstrappend(char *dst, char *src);
|
||||
|
||||
char *wusergnusteppath();
|
||||
|
||||
char *wdefaultspathfordomain(char *domain);
|
||||
|
||||
void wusleep(unsigned int microsec);
|
||||
|
||||
#if 0
|
||||
int wsprintesc(char *buffer, int length, char *format, WMSEscapes **escapes,
|
||||
int count);
|
||||
#endif
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
/* This function is used _only_ if you create a NON-GUI program.
|
||||
* For GUI based programs use WMNextEvent()/WMHandleEvent() instead.
|
||||
* This function will handle all input/timer/idle events, then return.
|
||||
*/
|
||||
|
||||
void WHandleEvents();
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
|
||||
WMHashTable *WMCreateHashTable(WMHashTableCallbacks callbacks);
|
||||
|
||||
void WMFreeHashTable(WMHashTable *table);
|
||||
|
||||
void WMResetHashTable(WMHashTable *table);
|
||||
|
||||
void *WMHashGet(WMHashTable *table, const void *key);
|
||||
|
||||
/* put data in table, replacing already existing data and returning
|
||||
* the old value */
|
||||
void *WMHashInsert(WMHashTable *table, void *key, void *data);
|
||||
|
||||
void WMHashRemove(WMHashTable *table, const void *key);
|
||||
|
||||
/* warning: do not manipulate the table while using these functions */
|
||||
WMHashEnumerator WMEnumerateHashTable(WMHashTable *table);
|
||||
|
||||
void *WMNextHashEnumeratorItem(WMHashEnumerator *enumerator);
|
||||
|
||||
unsigned WMCountHashTable(WMHashTable *table);
|
||||
|
||||
|
||||
|
||||
|
||||
/* some predefined callback sets */
|
||||
|
||||
extern const WMHashTableCallbacks WMIntHashCallbacks;
|
||||
/* sizeof(keys) are <= sizeof(void*) */
|
||||
|
||||
extern const WMHashTableCallbacks WMStringHashCallbacks;
|
||||
/* keys are strings. Strings will be copied with wstrdup()
|
||||
* and freed with free() */
|
||||
|
||||
extern const WMHashTableCallbacks WMStringPointerHashCallbacks;
|
||||
/* keys are strings, bug they are not copied */
|
||||
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
|
||||
/*
|
||||
* Array bags use an array to store the elements.
|
||||
* Item indexes may be any integer number.
|
||||
*
|
||||
* Pros:
|
||||
* Fast [O(1)] access to elements
|
||||
* Fast [O(1)] push/pop
|
||||
*
|
||||
* Cons:
|
||||
* A little slower [O(n)] for insertion/deletion of elements that
|
||||
* arent in the end
|
||||
* Element indexes with large difference will cause large holes
|
||||
*/
|
||||
#if 0
|
||||
WMBag* WMCreateArrayBag(int initialSize);
|
||||
WMBag* WMCreateArrayBagWithDestructor(int initialSize,
|
||||
void (*destructor)(void*));
|
||||
#endif
|
||||
/*
|
||||
* Tree bags use a red-black tree for storage.
|
||||
* Item indexes may be any integer number.
|
||||
*
|
||||
* Pros:
|
||||
* O(lg n) insertion/deletion/search
|
||||
* Good for large numbers of elements with sparse indexes
|
||||
*
|
||||
* Cons:
|
||||
* O(lg n) insertion/deletion/search
|
||||
* Slow for storing small numbers of elements
|
||||
*/
|
||||
WMBag *WMCreateTreeBag(void);
|
||||
WMBag *WMCreateTreeBagWithDestructor(void (*destructor)(void*));
|
||||
|
||||
|
||||
#define WMCreateArrayBag(a) WMCreateTreeBag()
|
||||
#define WMCreateArrayBagWithDestructor(a,d) WMCreateTreeBagWithDestructor(d)
|
||||
|
||||
#define WMCreateBag(size) WMCreateTreeBag()
|
||||
|
||||
#define WMGetBagItemCount(bag) bag->func.getItemCount(bag)
|
||||
|
||||
#define WMAppendBag(bag, other) bag->func.appendBag(bag, other)
|
||||
|
||||
#define WMPutInBag(bag, item) bag->func.putInBag(bag, item)
|
||||
|
||||
/* insert will increment the index of elements after it by 1 */
|
||||
#define WMInsertInBag(bag, index, item) bag->func.insertInBag(bag, index, item)
|
||||
|
||||
/* this is slow */
|
||||
/* erase will remove the element from the bag,
|
||||
* but will keep the index of the other elements unchanged */
|
||||
#define WMEraseFromBag(bag, index) bag->func.deleteFromBag(bag, index)
|
||||
|
||||
/* delete and remove will remove the elements and cause the elements
|
||||
* after them to decrement their indexes by 1 */
|
||||
#define WMRemoveFromBag(bag, item) bag->func.removeFromBag(bag, item)
|
||||
|
||||
#define WMDeleteFromBag(bag, index) bag->func.deleteFromBag(bag, index)
|
||||
|
||||
#define WMGetFromBag(bag, index) bag->func.getFromBag(bag, index)
|
||||
|
||||
#define WMCountInBag(bag, item) bag->func.countInBag(bag, item)
|
||||
|
||||
#define WMReplaceInBag(bag, index, item) bag->func.replaceInBag(bag, index, item)
|
||||
#define WMSetInBag(bag, index, item) bag->func.replaceInBag(bag, index, item)
|
||||
|
||||
/* comparer must return:
|
||||
* < 0 if a < b
|
||||
* > 0 if a > b
|
||||
* = 0 if a = b
|
||||
*/
|
||||
#define WMSortBag(bag, comparer) bag->func.sortBag(bag, comparer)
|
||||
|
||||
#define WMEmptyBag(bag) bag->func.emptyBag(bag)
|
||||
|
||||
#define WMFreeBag(bag) bag->func.freeBag(bag)
|
||||
|
||||
#define WMMapBag(bag, function, cdata) bag->func.mapBag(bag, function, cdata)
|
||||
|
||||
#define WMGetFirstInBag(bag, item) bag->func.firstInBag(bag, item)
|
||||
|
||||
#define WMCountInBag(bag, item) bag->func.countInBag(bag, item)
|
||||
|
||||
#define WMFindInBag(bag, match) bag->func.findInBag(bag, match)
|
||||
|
||||
#define WMBagFirst(bag, ptr) bag->func.first(bag, ptr)
|
||||
|
||||
#define WMBagLast(bag, ptr) bag->func.last(bag, ptr)
|
||||
|
||||
#define WMBagNext(bag, ptr) bag->func.next(bag, ptr)
|
||||
|
||||
#define WMBagPrevious(bag, ptr) bag->func.previous(bag, ptr)
|
||||
|
||||
#define WMBagIteratorAtIndex(bag, index, ptr) bag->func.iteratorAtIndex(bag, index, ptr)
|
||||
|
||||
#define WMBagIndexForIterator(bag, ptr) bag->func.indexForIterator(bag, ptr)
|
||||
|
||||
|
||||
|
||||
#define WM_ITERATE_BAG(bag, var, i) \
|
||||
for (var = WMBagFirst(bag, &(i)); (i) != NULL; \
|
||||
var = WMBagNext(bag, &(i)))
|
||||
|
||||
#define WM_ETARETI_BAG(bag, var, i) \
|
||||
for (var = WMBagLast(bag, &(i)); (i) != NULL; \
|
||||
var = WMBagPrevious(bag, &(i)))
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* WMData handling */
|
||||
|
||||
/* Creating/destroying data */
|
||||
|
||||
WMData* WMCreateDataWithCapacity(unsigned capacity);
|
||||
|
||||
WMData* WMCreateDataWithLength(unsigned length);
|
||||
|
||||
WMData* WMCreateDataWithBytes(void *bytes, unsigned length);
|
||||
|
||||
WMData* WMCreateDataWithBytesNoCopy(void *bytes, unsigned length);
|
||||
|
||||
WMData* WMCreateDataWithData(WMData *aData);
|
||||
|
||||
WMData* WMRetainData(WMData *aData);
|
||||
|
||||
void WMReleaseData(WMData *aData);
|
||||
|
||||
/* Adjusting capacity */
|
||||
|
||||
void WMSetDataCapacity(WMData *aData, unsigned capacity);
|
||||
|
||||
void WMSetDataLength(WMData *aData, unsigned length);
|
||||
|
||||
void WMIncreaseDataLengthBy(WMData *aData, unsigned extraLength);
|
||||
|
||||
/* Accessing data */
|
||||
|
||||
const void* WMDataBytes(WMData *aData);
|
||||
|
||||
void WMGetDataBytes(WMData *aData, void *buffer);
|
||||
|
||||
void WMGetDataBytesWithLength(WMData *aData, void *buffer, unsigned length);
|
||||
|
||||
void WMGetDataBytesWithRange(WMData *aData, void *buffer, WMRange aRange);
|
||||
|
||||
WMData* WMGetSubdataWithRange(WMData *aData, WMRange aRange);
|
||||
|
||||
/* Testing data */
|
||||
|
||||
Bool WMIsDataEqualToData(WMData *aData, WMData *anotherData);
|
||||
|
||||
unsigned WMGetDataLength(WMData *aData);
|
||||
|
||||
unsigned WMGetDataHash(WMData *aData);
|
||||
|
||||
/* Adding data */
|
||||
|
||||
void WMAppendDataBytes(WMData *aData, void *bytes, unsigned length);
|
||||
|
||||
void WMAppendData(WMData *aData, WMData *anotherData);
|
||||
|
||||
/* Modifying data */
|
||||
|
||||
void WMReplaceDataBytesInRange(WMData *aData, WMRange aRange, void *bytes);
|
||||
|
||||
void WMResetDataBytesInRange(WMData *aData, WMRange aRange);
|
||||
|
||||
void WMSetData(WMData *aData, WMData *anotherData);
|
||||
|
||||
/* Storing data */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
WMNotification *WMCreateNotification(char *name, void *object, void *clientData);
|
||||
|
||||
void WMReleaseNotification(WMNotification *notification);
|
||||
|
||||
WMNotification *WMRetainNotification(WMNotification *notification);
|
||||
|
||||
void *WMGetNotificationClientData(WMNotification *notification);
|
||||
|
||||
void *WMGetNotificationObject(WMNotification *notification);
|
||||
|
||||
char *WMGetNotificationName(WMNotification *notification);
|
||||
|
||||
|
||||
void WMAddNotificationObserver(WMNotificationObserverAction *observerAction,
|
||||
void *observer, char *name, void *object);
|
||||
|
||||
void WMPostNotification(WMNotification *notification);
|
||||
|
||||
void WMRemoveNotificationObserver(void *observer);
|
||||
|
||||
void WMRemoveNotificationObserverWithName(void *observer, char *name,
|
||||
void *object);
|
||||
|
||||
void WMPostNotificationName(char *name, void *object, void *clientData);
|
||||
|
||||
WMNotificationQueue *WMGetDefaultNotificationQueue(void);
|
||||
|
||||
WMNotificationQueue *WMCreateNotificationQueue(void);
|
||||
|
||||
void WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
||||
WMNotification *notification,
|
||||
unsigned mask);
|
||||
|
||||
void WMEnqueueNotification(WMNotificationQueue *queue,
|
||||
WMNotification *notification,
|
||||
WMPostingStyle postingStyle);
|
||||
|
||||
void WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
|
||||
WMNotification *notification,
|
||||
WMPostingStyle postingStyle,
|
||||
unsigned coalesceMask);
|
||||
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
WMUserDefaults *WMGetStandardUserDefaults(void);
|
||||
|
||||
WMUserDefaults *WMGetDefaultsFromPath(char *path);
|
||||
|
||||
void WMSynchronizeUserDefaults(WMUserDefaults *database);
|
||||
|
||||
void WMSaveUserDefaults(WMUserDefaults *database);
|
||||
|
||||
void WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable);
|
||||
|
||||
proplist_t WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
void WMSetUDObjectForKey(WMUserDefaults *database, proplist_t object,
|
||||
char *defaultName);
|
||||
|
||||
void WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
/* you can free the returned string */
|
||||
char *WMGetUDStringForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
int WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
float WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
Bool WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
void WMSetUDStringForKey(WMUserDefaults *database, char *value,
|
||||
char *defaultName);
|
||||
|
||||
void WMSetUDIntegerForKey(WMUserDefaults *database, int value,
|
||||
char *defaultName);
|
||||
|
||||
void WMSetUDFloatForKey(WMUserDefaults *database, float value,
|
||||
char *defaultName);
|
||||
|
||||
void WMSetUDBoolForKey(WMUserDefaults *database, Bool value,
|
||||
char *defaultName);
|
||||
|
||||
proplist_t WMGetUDSearchList(WMUserDefaults *database);
|
||||
|
||||
void WMSetUDSearchList(WMUserDefaults *database, proplist_t list);
|
||||
|
||||
extern char *WMUserDefaultsDidChangeNotification;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* WMHost: host handling */
|
||||
|
||||
WMHost* WMGetCurrentHost();
|
||||
|
||||
WMHost* WMGetHostWithName(char* name);
|
||||
|
||||
WMHost* WMGetHostWithAddress(char* address);
|
||||
|
||||
WMHost* WMRetainHost(WMHost *hPtr);
|
||||
|
||||
void WMReleaseHost(WMHost *hPtr);
|
||||
|
||||
/*
|
||||
* Host cache management
|
||||
* If enabled, only one object representing each host will be created, and
|
||||
* a shared instance will be returned by all methods that return a host.
|
||||
* Enabled by default.
|
||||
*/
|
||||
void WMSetHostCacheEnabled(Bool flag);
|
||||
|
||||
Bool WMIsHostCacheEnabled();
|
||||
|
||||
void WMFlushHostCache();
|
||||
|
||||
/*
|
||||
* Compare hosts: Hosts are equal if they share at least one address
|
||||
*/
|
||||
Bool WMIsHostEqualToHost(WMHost* hPtr, WMHost* anotherHost);
|
||||
|
||||
/*
|
||||
* Host names.
|
||||
* WMGetHostName() will return first name (official) if a host has several.
|
||||
* WMGetHostNames() will return a R/O WMBag with all the names of the host.
|
||||
*/
|
||||
char* WMGetHostName(WMHost* hPtr);
|
||||
|
||||
/* The returned bag is R/O. Do not modify it, and do not free it! */
|
||||
WMBag* WMGetHostNames(WMHost* hPtr);
|
||||
|
||||
/*
|
||||
* Host addresses.
|
||||
* Addresses are represented as "Dotted Decimal" strings, e.g. "192.42.172.1"
|
||||
* WMGetHostAddress() will return an arbitrary address if a host has several.
|
||||
* WMGetHostAddresses() will return a R/O WMBag with all addresses of the host.
|
||||
*/
|
||||
char* WMGetHostAddress(WMHost* hPtr);
|
||||
|
||||
/* The returned bag is R/O. Do not modify it, and do not free it! */
|
||||
WMBag* WMGetHostAddresses(WMHost* hPtr);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
/* WMConnection functions */
|
||||
|
||||
WMConnection* WMCreateConnectionAsServerAtAddress(char *host, char *service,
|
||||
char *protocol);
|
||||
|
||||
WMConnection* WMCreateConnectionToAddress(char *host, char *service,
|
||||
char *protocol);
|
||||
|
||||
WMConnection* WMCreateConnectionToAddressAndNotify(char *host, char *service,
|
||||
char *protocol);
|
||||
|
||||
void WMCloseConnection(WMConnection *cPtr);
|
||||
|
||||
void WMDestroyConnection(WMConnection *cPtr);
|
||||
|
||||
WMConnection* WMAcceptConnection(WMConnection *listener);
|
||||
|
||||
/* Release the returned data! */
|
||||
WMData* WMGetConnectionAvailableData(WMConnection *cPtr);
|
||||
|
||||
int WMSendConnectionData(WMConnection *cPtr, WMData *data);
|
||||
|
||||
Bool WMEnqueueConnectionData(WMConnection *cPtr, WMData *data);
|
||||
|
||||
#define WMFlushConnection(cPtr) WMSendConnectionData((cPtr), NULL)
|
||||
|
||||
void WMSetConnectionDelegate(WMConnection *cPtr, ConnectionDelegate *delegate);
|
||||
|
||||
/* Connection info */
|
||||
|
||||
char* WMGetConnectionAddress(WMConnection *cPtr);
|
||||
|
||||
char* WMGetConnectionService(WMConnection *cPtr);
|
||||
|
||||
char* WMGetConnectionProtocol(WMConnection *cPtr);
|
||||
|
||||
void WMSetConnectionNonBlocking(WMConnection *cPtr, Bool flag);
|
||||
|
||||
void* WMGetConnectionClientData(WMConnection *cPtr);
|
||||
|
||||
void WMSetConnectionClientData(WMConnection *cPtr, void *data);
|
||||
|
||||
unsigned int WMGetConnectionFlags(WMConnection *cPtr);
|
||||
|
||||
void WMSetConnectionFlags(WMConnection *cPtr, unsigned int flags);
|
||||
|
||||
int WMGetConnectionSocket(WMConnection *cPtr);
|
||||
|
||||
WMConnectionState WMGetConnectionState(WMConnection *cPtr);
|
||||
|
||||
void WMSetConnectionSendTimeout(WMConnection *cPtr, unsigned int timeout);
|
||||
|
||||
|
||||
/* Global variables */
|
||||
|
||||
extern int WCErrorCode;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
366
WINGs/array.c
Normal file
366
WINGs/array.c
Normal file
@@ -0,0 +1,366 @@
|
||||
/*
|
||||
* Dynamically Resized Array
|
||||
*
|
||||
* Authors: Alfredo K. Kojima <kojima@windowmaker.org>
|
||||
* Dan Pascu <dan@windowmaker.org>
|
||||
*
|
||||
* This code is released to the Public Domain, but
|
||||
* proper credit is always appreciated :)
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
|
||||
#define INITIAL_SIZE 8
|
||||
#define RESIZE_INCREMENT 8
|
||||
|
||||
|
||||
typedef struct W_Array {
|
||||
void **items; /* the array data */
|
||||
int itemCount; /* # of items in array */
|
||||
int allocSize; /* allocated size of array */
|
||||
WMFreeDataProc *destructor; /* the destructor to free elements */
|
||||
} W_Array;
|
||||
|
||||
|
||||
WMArray*
|
||||
WMCreateArray(int initialSize)
|
||||
{
|
||||
return WMCreateArrayWithDestructor(initialSize, NULL);
|
||||
}
|
||||
|
||||
|
||||
WMArray*
|
||||
WMCreateArrayWithDestructor(int initialSize, WMFreeDataProc *destructor)
|
||||
{
|
||||
WMArray *array;
|
||||
|
||||
array = wmalloc(sizeof(WMArray));
|
||||
|
||||
if (initialSize <= 0) {
|
||||
initialSize = INITIAL_SIZE;
|
||||
}
|
||||
|
||||
array->items = wmalloc(sizeof(void*) * initialSize);
|
||||
|
||||
array->itemCount = 0;
|
||||
array->allocSize = initialSize;
|
||||
array->destructor = destructor;
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
WMArray*
|
||||
WMCreateArrayWithArray(WMArray *array)
|
||||
{
|
||||
WMArray *newArray;
|
||||
|
||||
newArray = wmalloc(sizeof(WMArray));
|
||||
|
||||
newArray->items = wmalloc(sizeof(void*) * array->allocSize);
|
||||
memcpy(newArray->items, array->items, sizeof(void*)*array->itemCount);
|
||||
|
||||
newArray->itemCount = array->itemCount;
|
||||
newArray->allocSize = array->allocSize;
|
||||
newArray->destructor = NULL;
|
||||
|
||||
return newArray;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMEmptyArray(WMArray *array)
|
||||
{
|
||||
if (array->destructor) {
|
||||
while (array->itemCount > 0) {
|
||||
array->itemCount--;
|
||||
array->destructor(array->items[array->itemCount]);
|
||||
}
|
||||
}
|
||||
/*memset(array->items, 0, array->itemCount * sizeof(void*));*/
|
||||
array->itemCount = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMFreeArray(WMArray *array)
|
||||
{
|
||||
WMEmptyArray(array);
|
||||
wfree(array->items);
|
||||
wfree(array);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetArrayItemCount(WMArray *array)
|
||||
{
|
||||
return array->itemCount;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMAppendArray(WMArray *array, WMArray *other)
|
||||
{
|
||||
if (other->itemCount == 0)
|
||||
return;
|
||||
|
||||
if (array->itemCount + other->itemCount > array->allocSize) {
|
||||
array->allocSize += other->allocSize;
|
||||
array->items = wrealloc(array->items, sizeof(void*)*array->allocSize);
|
||||
}
|
||||
|
||||
memcpy(array->items+array->itemCount, other->items,
|
||||
sizeof(void*)*other->itemCount);
|
||||
array->itemCount += other->itemCount;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMAddToArray(WMArray *array, void *item)
|
||||
{
|
||||
if (array->itemCount >= array->allocSize) {
|
||||
array->allocSize += RESIZE_INCREMENT;
|
||||
array->items = wrealloc(array->items, sizeof(void*)*array->allocSize);
|
||||
}
|
||||
array->items[array->itemCount] = item;
|
||||
|
||||
array->itemCount++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMInsertInArray(WMArray *array, int index, void *item)
|
||||
{
|
||||
wassertr(index >= 0 && index <= array->itemCount);
|
||||
|
||||
if (array->itemCount >= array->allocSize) {
|
||||
array->allocSize += RESIZE_INCREMENT;
|
||||
array->items = wrealloc(array->items, sizeof(void*)*array->allocSize);
|
||||
}
|
||||
if (index < array->itemCount) {
|
||||
memmove(array->items+index+1, array->items+index,
|
||||
sizeof(void*)*(array->itemCount-index));
|
||||
}
|
||||
array->items[index] = item;
|
||||
|
||||
array->itemCount++;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMReplaceInArray(WMArray *array, int index, void *item)
|
||||
{
|
||||
void *old;
|
||||
|
||||
wassertrv(index >= 0 && index <= array->itemCount, NULL);
|
||||
|
||||
/* is it really useful to perform append if index == array->itemCount ? -Dan */
|
||||
if (index == array->itemCount) {
|
||||
WMAddToArray(array, item);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
old = array->items[index];
|
||||
array->items[index] = item;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMDeleteFromArray(WMArray *array, int index)
|
||||
{
|
||||
wassertrv(index >= 0 && index < array->itemCount, 0);
|
||||
|
||||
if (array->destructor) {
|
||||
array->destructor(array->items[index]);
|
||||
}
|
||||
|
||||
if (index < array->itemCount-1) {
|
||||
memmove(array->items+index, array->items+index+1,
|
||||
sizeof(void*)*(array->itemCount-index-1));
|
||||
}
|
||||
|
||||
array->itemCount--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMRemoveFromArrayMatching(WMArray *array, WMMatchDataProc *match, void *cdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (match != NULL) {
|
||||
for (i = 0; i < array->itemCount; i++) {
|
||||
if ((*match)(array->items[i], cdata)) {
|
||||
WMDeleteFromArray(array, i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < array->itemCount; i++) {
|
||||
if (array->items[i] == cdata) {
|
||||
WMDeleteFromArray(array, i);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMGetFromArray(WMArray *array, int index)
|
||||
{
|
||||
if (index < 0 || index >= array->itemCount)
|
||||
return NULL;
|
||||
|
||||
return array->items[index];
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMPopFromArray(WMArray *array)
|
||||
{
|
||||
array->itemCount--;
|
||||
|
||||
return array->items[array->itemCount];
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMFindInArray(WMArray *array, WMMatchDataProc *match, void *cdata)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (match!=NULL) {
|
||||
for (i = 0; i < array->itemCount; i++) {
|
||||
if ((*match)(array->items[i], cdata))
|
||||
return i;
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < array->itemCount; i++) {
|
||||
if (array->items[i] == cdata)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return WANotFound;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMCountInArray(WMArray *array, void *item)
|
||||
{
|
||||
int i, count;
|
||||
|
||||
for (i=0, count=0; i<array->itemCount; i++) {
|
||||
if (array->items[i] == item)
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSortArray(WMArray *array, WMCompareDataProc *comparer)
|
||||
{
|
||||
qsort(array->items, array->itemCount, sizeof(void*), comparer);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMMapArray(WMArray *array, void (*function)(void*, void*), void *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0; i<array->itemCount; i++) {
|
||||
(*function)(array->items[i], data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WMArray*
|
||||
WMGetSubarrayWithRange(WMArray* array, WMRange aRange)
|
||||
{
|
||||
WMArray *newArray;
|
||||
|
||||
if (aRange.count <= 0)
|
||||
return WMCreateArray(0);
|
||||
|
||||
if (aRange.position < 0)
|
||||
aRange.position = 0;
|
||||
if (aRange.position >= array->itemCount)
|
||||
aRange.position = array->itemCount - 1;
|
||||
if (aRange.position + aRange.count > array->itemCount)
|
||||
aRange.count = array->itemCount - aRange.position;
|
||||
|
||||
newArray = WMCreateArray(aRange.count);
|
||||
memcpy(newArray->items, array->items+aRange.position,
|
||||
sizeof(void*)*aRange.count);
|
||||
newArray->itemCount = aRange.count;
|
||||
|
||||
return newArray;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMArrayFirst(WMArray *array, WMArrayIterator *iter)
|
||||
{
|
||||
if (array->itemCount == 0) {
|
||||
*iter = WANotFound;
|
||||
return NULL;
|
||||
} else {
|
||||
*iter = 0;
|
||||
return array->items[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMArrayLast(WMArray *array, WMArrayIterator *iter)
|
||||
{
|
||||
if (array->itemCount == 0) {
|
||||
*iter = WANotFound;
|
||||
return NULL;
|
||||
} else {
|
||||
*iter = array->itemCount-1;
|
||||
return array->items[*iter];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMArrayNext(WMArray *array, WMArrayIterator *iter)
|
||||
{
|
||||
if (*iter >= 0 && *iter < array->itemCount-1) {
|
||||
return array->items[++(*iter)];
|
||||
} else {
|
||||
*iter = WANotFound;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMArrayPrevious(WMArray *array, WMArrayIterator *iter)
|
||||
{
|
||||
if (*iter > 0 && *iter < array->itemCount) {
|
||||
return array->items[--(*iter)];
|
||||
} else {
|
||||
*iter = WANotFound;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
419
WINGs/bagarray.c
419
WINGs/bagarray.c
@@ -1,419 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
#if 0
|
||||
|
||||
typedef struct W_ArrayBag {
|
||||
void **items;
|
||||
int size;
|
||||
int count;
|
||||
|
||||
int base;
|
||||
int first;
|
||||
int last;
|
||||
} W_ArrayBag;
|
||||
|
||||
|
||||
static int getItemCount(WMBag *bag);
|
||||
static int appendBag(WMBag *bag, WMBag *appendedBag);
|
||||
static int putInBag(WMBag *bag, void *item);
|
||||
static int insertInBag(WMBag *bag, int index, void *item);
|
||||
static int removeFromBag(WMBag *bag, void *item);
|
||||
static int deleteFromBag(WMBag *bag, int index);
|
||||
static void* getFromBag(WMBag *bag, int index);
|
||||
static int firstInBag(WMBag *bag, void *item);
|
||||
static int countInBag(WMBag *bag, void *item);
|
||||
static void* replaceInBag(WMBag *bag, int index, void *item);
|
||||
static int sortBag(WMBag *bag, int (*comparer)(const void*, const void*));
|
||||
static void emptyBag(WMBag *bag);
|
||||
static void freeBag(WMBag *bag);
|
||||
static void mapBag(WMBag *bag, void (*function)(void*, void*), void *data);
|
||||
static int findInBag(WMBag *bag, int (*match)(void*));
|
||||
static void* first(WMBag *bag, void **ptr);
|
||||
static void* last(WMBag *bag, void **ptr);
|
||||
static void* next(WMBag *bag, void **ptr);
|
||||
static void* previous(WMBag *bag, void **ptr);
|
||||
static void* iteratorAtIndex(WMBag *bag, int index, WMBagIterator *ptr);
|
||||
static int indexForIterator(WMBag *bag, WMBagIterator ptr);
|
||||
|
||||
|
||||
static W_BagFunctions arrayFunctions = {
|
||||
getItemCount,
|
||||
appendBag,
|
||||
putInBag,
|
||||
insertInBag,
|
||||
removeFromBag,
|
||||
deleteFromBag,
|
||||
deleteFromBag,
|
||||
getFromBag,
|
||||
firstInBag,
|
||||
countInBag,
|
||||
replaceInBag,
|
||||
sortBag,
|
||||
emptyBag,
|
||||
freeBag,
|
||||
mapBag,
|
||||
findInBag,
|
||||
first,
|
||||
last,
|
||||
next,
|
||||
previous,
|
||||
iteratorAtIndex,
|
||||
indexForIterator
|
||||
};
|
||||
|
||||
|
||||
#define ARRAY ((W_ArrayBag*)bag->data)
|
||||
|
||||
|
||||
#define I2O(a, i) ((a)->base + i)
|
||||
|
||||
|
||||
WMBag*
|
||||
WMCreateArrayBagWithDestructor(int initialSize, void (*destructor)(void*))
|
||||
{
|
||||
WMBag *bag;
|
||||
W_ArrayBag *array;
|
||||
int size;
|
||||
|
||||
assert(0&&"array bag is not working");
|
||||
bag = wmalloc(sizeof(WMBag));
|
||||
|
||||
array = wmalloc(sizeof(W_ArrayBag));
|
||||
|
||||
bag->data = array;
|
||||
|
||||
array->items = wmalloc(sizeof(void*) * size);
|
||||
array->size = size;
|
||||
array->count = 0;
|
||||
array->first = 0;
|
||||
array->last = 0;
|
||||
array->base = 0;
|
||||
|
||||
bag->func = arrayFunctions;
|
||||
|
||||
bag->destructor = destructor;
|
||||
|
||||
return bag;
|
||||
}
|
||||
|
||||
|
||||
WMBag*
|
||||
WMCreateArrayBag(int initialSize)
|
||||
{
|
||||
return WMCreateArrayBagWithDestructor(initialSize, NULL);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
getItemCount(WMBag *bag)
|
||||
{
|
||||
return ARRAY->count;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
appendBag(WMBag *bag, WMBag *appendedBag)
|
||||
{
|
||||
W_ArrayBag *array = (W_ArrayBag*)appendedBag->data;
|
||||
int ok;
|
||||
int i;
|
||||
|
||||
for (i = array->first; i <= array->last; i++) {
|
||||
if (array->items[array->base+i]) {
|
||||
ok = putInBag(bag, array->items[array->base+i]);
|
||||
if (!ok)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
putInBag(WMBag *bag, void *item)
|
||||
{
|
||||
return insertInBag(bag, ARRAY->last+1, item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
insertInBag(WMBag *bag, int index, void *item)
|
||||
{
|
||||
W_ArrayBag *array = ARRAY;
|
||||
|
||||
if (I2O(array, index) >= array->size) {
|
||||
array->size = WMAX(array->size + 16, I2O(array, index));
|
||||
array->items = wrealloc(array->items, sizeof(void*) * array->size);
|
||||
memset(array->items + I2O(array, array->last), 0,
|
||||
sizeof(void*) * (array->size - I2O(array, array->last)));
|
||||
}
|
||||
|
||||
if (index > array->last) {
|
||||
array->last = index;
|
||||
} else if (index >= array->first) {
|
||||
memmove(array->items + I2O(array, index),
|
||||
array->items + (I2O(array, index) + 1), sizeof(void*));
|
||||
array->last++;
|
||||
} else {
|
||||
memmove(array->items,
|
||||
array->items + (abs(index) - array->base),
|
||||
sizeof(void*) * (abs(index) - array->base));
|
||||
memset(array->items, 0, sizeof(void*) * (abs(index) - array->base));
|
||||
array->first = index;
|
||||
array->base = abs(index);
|
||||
}
|
||||
|
||||
array->items[array->base + index] = item;
|
||||
array->count++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
removeFromBag(WMBag *bag, void *item)
|
||||
{
|
||||
int i;
|
||||
W_ArrayBag *array = ARRAY;
|
||||
|
||||
for (i = 0; i < array->count; i++) {
|
||||
if (array->items[i] == item) {
|
||||
if (bag->destructor)
|
||||
bag->destructor(array->items[i]);
|
||||
|
||||
memmove(&array->items[i], &array->items[i + 1],
|
||||
(array->count - i - 1) * sizeof(void*));
|
||||
array->count--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
deleteFromBag(WMBag *bag, int index)
|
||||
{
|
||||
W_ArrayBag *array = ARRAY;
|
||||
|
||||
if (index < 0 || index >= array->count)
|
||||
return 0;
|
||||
|
||||
if (index < array->count-1) {
|
||||
if (bag->destructor)
|
||||
bag->destructor(array->items[index]);
|
||||
|
||||
memmove(&array->items[index], &array->items[index + 1],
|
||||
(array->count - index - 1) * sizeof(void*));
|
||||
}
|
||||
array->count--;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
getFromBag(WMBag *bag, int index)
|
||||
{
|
||||
if (index < 0 || index >= ARRAY->count)
|
||||
return NULL;
|
||||
|
||||
return ARRAY->items[index];
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
firstInBag(WMBag *bag, void *item)
|
||||
{
|
||||
int j;
|
||||
int count = ARRAY->count;
|
||||
W_ArrayBag *array = ARRAY;
|
||||
|
||||
for (j = 0; j < count; j++) {
|
||||
if (array->items[j] == item)
|
||||
return j;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int
|
||||
countInBag(WMBag *bag, void *item)
|
||||
{
|
||||
int i, j;
|
||||
int count = ARRAY->count;
|
||||
W_ArrayBag *array = ARRAY;
|
||||
|
||||
for (j = 0, i = 0; j < count; j++) {
|
||||
if (array->items[j] == item)
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
replaceInBag(WMBag *bag, int index, void *item)
|
||||
{
|
||||
void *old;
|
||||
|
||||
if (index < 0 || index >= ARRAY->count)
|
||||
return NULL;
|
||||
|
||||
old = ARRAY->items[index];
|
||||
|
||||
ARRAY->items[index] = item;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sortBag(WMBag *bag, int (*comparer)(const void*, const void*))
|
||||
{
|
||||
qsort(ARRAY->items, ARRAY->count, sizeof(void*), comparer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
emptyBag(WMBag *bag)
|
||||
{
|
||||
W_ArrayBag *array = ARRAY;
|
||||
|
||||
if (bag->destructor) {
|
||||
while (--array->count) {
|
||||
bag->destructor(array->items[array->count]);
|
||||
}
|
||||
}
|
||||
ARRAY->count=0;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
freeBag(WMBag *bag)
|
||||
{
|
||||
emptyBag(bag);
|
||||
|
||||
wfree(ARRAY->items);
|
||||
wfree(ARRAY);
|
||||
wfree(bag);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapBag(WMBag *bag, void (*function)(void *, void *), void *clientData)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY->last; i++) {
|
||||
if (ARRAY->items[i])
|
||||
(*function)(ARRAY->items[i], clientData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
findInBag(WMBag *bag, int (*match)(void*))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ARRAY->last; i++) {
|
||||
if ((*match)(ARRAY->items[i]))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
first(WMBag *bag, void **ptr)
|
||||
{
|
||||
*ptr = NULL;
|
||||
|
||||
if (ARRAY->count == 0)
|
||||
return NULL;
|
||||
|
||||
*(int**)ptr = 0;
|
||||
return ARRAY->items[0];
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
last(WMBag *bag, void **ptr)
|
||||
{
|
||||
*ptr = NULL;
|
||||
|
||||
if (ARRAY->count == 0)
|
||||
return NULL;
|
||||
|
||||
*(int*)ptr = ARRAY->count-1;
|
||||
|
||||
return ARRAY->items[ARRAY->count-1];
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
next(WMBag *bag, void **ptr)
|
||||
{
|
||||
if (!*ptr)
|
||||
return NULL;
|
||||
|
||||
(*(int*)ptr)++;
|
||||
if (*(int*)ptr >= ARRAY->count) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ARRAY->items[*(int*)ptr];
|
||||
}
|
||||
|
||||
|
||||
static void*
|
||||
previous(WMBag *bag, void **ptr)
|
||||
{
|
||||
if (!*ptr)
|
||||
return NULL;
|
||||
|
||||
(*(int*)ptr)--;
|
||||
if (*(int*)ptr < 0) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ARRAY->items[*(int*)ptr];
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void*
|
||||
iteratorAtIndex(WMBag *bag, int index, WMBagIterator *ptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
indexForIterator(WMBag *bag, WMBagIterator ptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
431
WINGs/bagtree.c
431
WINGs/bagtree.c
@@ -19,65 +19,15 @@ typedef struct W_Node {
|
||||
} W_Node;
|
||||
|
||||
|
||||
typedef struct W_TreeBag {
|
||||
typedef struct W_Bag {
|
||||
W_Node *root;
|
||||
|
||||
W_Node *nil; /* sentinel */
|
||||
|
||||
int count;
|
||||
} W_TreeBag;
|
||||
|
||||
|
||||
|
||||
static int getItemCount(WMBag *self);
|
||||
static int appendBag(WMBag *self, WMBag *bag);
|
||||
static int putInBag(WMBag *self, void *item);
|
||||
static int insertInBag(WMBag *self, int index, void *item);
|
||||
static int removeFromBag(WMBag *bag, void *item);
|
||||
static int eraseFromBag(WMBag *bag, int index);
|
||||
static int deleteFromBag(WMBag *bag, int index);
|
||||
static void *getFromBag(WMBag *bag, int index);
|
||||
static int countInBag(WMBag *bag, void *item);
|
||||
static int firstInBag(WMBag *bag, void *item);
|
||||
static void *replaceInBag(WMBag *bag, int index, void *item);
|
||||
static int sortBag(WMBag *bag, int (*comparer)(const void*, const void*));
|
||||
static void emptyBag(WMBag *bag);
|
||||
static void freeBag(WMBag *bag);
|
||||
static void mapBag(WMBag *bag, void (*function)(void*, void*), void *data);
|
||||
static int findInBag(WMBag *bag, int (*match)(void*));;
|
||||
static void *first(WMBag *bag, WMBagIterator *ptr);
|
||||
static void *last(WMBag *bag, WMBagIterator *ptr);
|
||||
static void *next(WMBag *bag, WMBagIterator *ptr);
|
||||
static void *previous(WMBag *bag, WMBagIterator *ptr);
|
||||
static void *iteratorAtIndex(WMBag *bag, int index, WMBagIterator *ptr);
|
||||
static int indexForIterator(WMBag *bag, WMBagIterator ptr);
|
||||
|
||||
|
||||
static W_BagFunctions bagFunctions = {
|
||||
getItemCount,
|
||||
appendBag,
|
||||
putInBag,
|
||||
insertInBag,
|
||||
removeFromBag,
|
||||
eraseFromBag,
|
||||
deleteFromBag,
|
||||
getFromBag,
|
||||
firstInBag,
|
||||
countInBag,
|
||||
replaceInBag,
|
||||
sortBag,
|
||||
emptyBag,
|
||||
freeBag,
|
||||
mapBag,
|
||||
findInBag,
|
||||
first,
|
||||
last,
|
||||
next,
|
||||
previous,
|
||||
iteratorAtIndex,
|
||||
indexForIterator
|
||||
};
|
||||
|
||||
void (*destructor)(void *item);
|
||||
} W_Bag;
|
||||
|
||||
|
||||
|
||||
@@ -86,7 +36,8 @@ static W_BagFunctions bagFunctions = {
|
||||
|
||||
|
||||
|
||||
static void leftRotate(W_TreeBag *tree, W_Node *node)
|
||||
static void
|
||||
leftRotate(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *node2;
|
||||
|
||||
@@ -112,7 +63,8 @@ static void leftRotate(W_TreeBag *tree, W_Node *node)
|
||||
|
||||
|
||||
|
||||
static void rightRotate(W_TreeBag *tree, W_Node *node)
|
||||
static void
|
||||
rightRotate(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *node2;
|
||||
|
||||
@@ -137,15 +89,15 @@ static void rightRotate(W_TreeBag *tree, W_Node *node)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void treeInsert(W_TreeBag *tree, W_Node *node)
|
||||
static void
|
||||
treeInsert(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *y = tree->nil;
|
||||
W_Node *x = tree->root;
|
||||
|
||||
while (x != tree->nil) {
|
||||
y = x;
|
||||
if (node->index < x->index)
|
||||
if (node->index <= x->index)
|
||||
x = x->left;
|
||||
else
|
||||
x = x->right;
|
||||
@@ -153,14 +105,15 @@ static void treeInsert(W_TreeBag *tree, W_Node *node)
|
||||
node->parent = y;
|
||||
if (y == tree->nil)
|
||||
tree->root = node;
|
||||
else if (node->index < y->index)
|
||||
else if (node->index <= y->index)
|
||||
y->left = node;
|
||||
else
|
||||
y->right = node;
|
||||
}
|
||||
|
||||
|
||||
static void rbTreeInsert(W_TreeBag *tree, W_Node *node)
|
||||
static void
|
||||
rbTreeInsert(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *y;
|
||||
|
||||
@@ -213,8 +166,8 @@ static void rbTreeInsert(W_TreeBag *tree, W_Node *node)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void rbDeleteFixup(W_TreeBag *tree, W_Node *node)
|
||||
static void
|
||||
rbDeleteFixup(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *w;
|
||||
|
||||
@@ -248,7 +201,7 @@ static void rbDeleteFixup(W_TreeBag *tree, W_Node *node)
|
||||
if (w->color == 'R') {
|
||||
w->color = 'B';
|
||||
node->parent->color = 'R';
|
||||
leftRotate(tree, node->parent);
|
||||
rightRotate(tree, node->parent);
|
||||
w = node->parent->left;
|
||||
}
|
||||
if (w->left->color == 'B' && w->right->color == 'B') {
|
||||
@@ -258,22 +211,24 @@ static void rbDeleteFixup(W_TreeBag *tree, W_Node *node)
|
||||
if (w->left->color == 'B') {
|
||||
w->right->color = 'B';
|
||||
w->color = 'R';
|
||||
rightRotate(tree, w);
|
||||
leftRotate(tree, w);
|
||||
w = node->parent->left;
|
||||
}
|
||||
w->color = node->parent->color;
|
||||
node->parent->color = 'B';
|
||||
w->left->color = 'B';
|
||||
leftRotate(tree, node->parent);
|
||||
rightRotate(tree, node->parent);
|
||||
node = tree->root;
|
||||
}
|
||||
}
|
||||
}
|
||||
node->color = 'B';
|
||||
|
||||
}
|
||||
|
||||
|
||||
static W_Node *treeMinimum(W_Node *node, W_Node *nil)
|
||||
static W_Node*
|
||||
treeMinimum(W_Node *node, W_Node *nil)
|
||||
{
|
||||
while (node->left != nil)
|
||||
node = node->left;
|
||||
@@ -281,7 +236,8 @@ static W_Node *treeMinimum(W_Node *node, W_Node *nil)
|
||||
}
|
||||
|
||||
|
||||
static W_Node *treeMaximum(W_Node *node, W_Node *nil)
|
||||
static W_Node*
|
||||
treeMaximum(W_Node *node, W_Node *nil)
|
||||
{
|
||||
while (node->right != nil)
|
||||
node = node->right;
|
||||
@@ -289,7 +245,8 @@ static W_Node *treeMaximum(W_Node *node, W_Node *nil)
|
||||
}
|
||||
|
||||
|
||||
static W_Node *treeSuccessor(W_Node *node, W_Node *nil)
|
||||
static W_Node*
|
||||
treeSuccessor(W_Node *node, W_Node *nil)
|
||||
{
|
||||
W_Node *y;
|
||||
|
||||
@@ -305,7 +262,8 @@ static W_Node *treeSuccessor(W_Node *node, W_Node *nil)
|
||||
}
|
||||
|
||||
|
||||
static W_Node *treePredecessor(W_Node *node, W_Node *nil)
|
||||
static W_Node*
|
||||
treePredecessor(W_Node *node, W_Node *nil)
|
||||
{
|
||||
W_Node *y;
|
||||
|
||||
@@ -321,7 +279,8 @@ static W_Node *treePredecessor(W_Node *node, W_Node *nil)
|
||||
}
|
||||
|
||||
|
||||
static W_Node *rbTreeDelete(W_TreeBag *tree, W_Node *node)
|
||||
static W_Node*
|
||||
rbTreeDelete(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *nil = tree->nil;
|
||||
W_Node *x, *y;
|
||||
@@ -361,8 +320,8 @@ static W_Node *rbTreeDelete(W_TreeBag *tree, W_Node *node)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static W_Node *treeSearch(W_Node *root, W_Node *nil, int index)
|
||||
static W_Node*
|
||||
treeSearch(W_Node *root, W_Node *nil, int index)
|
||||
{
|
||||
if (root == nil || root->index == index) {
|
||||
return root;
|
||||
@@ -376,7 +335,8 @@ static W_Node *treeSearch(W_Node *root, W_Node *nil, int index)
|
||||
}
|
||||
|
||||
|
||||
static W_Node *treeFind(W_Node *root, W_Node *nil, void *data)
|
||||
static W_Node*
|
||||
treeFind(W_Node *root, W_Node *nil, void *data)
|
||||
{
|
||||
W_Node *tmp;
|
||||
|
||||
@@ -394,12 +354,11 @@ static W_Node *treeFind(W_Node *root, W_Node *nil, void *data)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
static char buf[512];
|
||||
|
||||
static void printNodes(W_Node *node, W_Node *nil, int depth)
|
||||
static void
|
||||
printNodes(W_Node *node, W_Node *nil, int depth)
|
||||
{
|
||||
if (node == nil) {
|
||||
return;
|
||||
@@ -418,7 +377,8 @@ static void printNodes(W_Node *node, W_Node *nil, int depth)
|
||||
}
|
||||
|
||||
|
||||
void PrintTree(WMBag *bag)
|
||||
void
|
||||
PrintTree(WMBag *bag)
|
||||
{
|
||||
W_TreeBag *tree = (W_TreeBag*)bag->data;
|
||||
|
||||
@@ -427,82 +387,75 @@ void PrintTree(WMBag *bag)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#define SELF ((W_TreeBag*)self->data)
|
||||
|
||||
WMBag *WMCreateTreeBag(void)
|
||||
WMBag*
|
||||
WMCreateTreeBag(void)
|
||||
{
|
||||
return WMCreateTreeBagWithDestructor(NULL);
|
||||
}
|
||||
|
||||
|
||||
WMBag *WMCreateTreeBagWithDestructor(void (*destructor)(void*))
|
||||
WMBag*
|
||||
WMCreateTreeBagWithDestructor(WMFreeDataProc *destructor)
|
||||
{
|
||||
WMBag *bag;
|
||||
W_TreeBag *tree;
|
||||
|
||||
bag = wmalloc(sizeof(WMBag));
|
||||
|
||||
bag->data = tree = wmalloc(sizeof(W_TreeBag));
|
||||
memset(tree, 0, sizeof(W_TreeBag));
|
||||
memset(bag, 0, sizeof(WMBag));
|
||||
|
||||
tree->nil = wmalloc(sizeof(W_Node));
|
||||
memset(tree->nil, 0, sizeof(W_Node));
|
||||
tree->nil->left = tree->nil->right = tree->nil->parent = tree->nil;
|
||||
tree->nil->index = WBNotFound;
|
||||
bag->nil = wmalloc(sizeof(W_Node));
|
||||
memset(bag->nil, 0, sizeof(W_Node));
|
||||
bag->nil->left = bag->nil->right = bag->nil->parent = bag->nil;
|
||||
bag->nil->index = WBNotFound;
|
||||
|
||||
tree->root = tree->nil;
|
||||
bag->root = bag->nil;
|
||||
|
||||
bag->destructor = destructor;
|
||||
|
||||
bag->func = bagFunctions;
|
||||
|
||||
return bag;
|
||||
}
|
||||
|
||||
|
||||
static int getItemCount(WMBag *self)
|
||||
int
|
||||
WMGetBagItemCount(WMBag *self)
|
||||
{
|
||||
return SELF->count;
|
||||
return self->count;
|
||||
}
|
||||
|
||||
|
||||
static int appendBag(WMBag *self, WMBag *bag)
|
||||
void
|
||||
WMAppendBag(WMBag *self, WMBag *bag)
|
||||
{
|
||||
WMBagIterator ptr;
|
||||
void *data;
|
||||
|
||||
for (data = first(bag, &ptr); data != NULL; data = next(bag, &ptr)) {
|
||||
if (!putInBag(self, data))
|
||||
return 0;
|
||||
for (data = WMBagFirst(bag, &ptr); data != NULL; data = WMBagNext(bag, &ptr)) {
|
||||
WMPutInBag(self, data);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static int putInBag(WMBag *self, void *item)
|
||||
void
|
||||
WMPutInBag(WMBag *self, void *item)
|
||||
{
|
||||
W_Node *ptr;
|
||||
|
||||
ptr = wmalloc(sizeof(W_Node));
|
||||
|
||||
ptr->data = item;
|
||||
ptr->index = SELF->count;
|
||||
ptr->left = SELF->nil;
|
||||
ptr->right = SELF->nil;
|
||||
ptr->parent = SELF->nil;
|
||||
ptr->index = self->count;
|
||||
ptr->left = self->nil;
|
||||
ptr->right = self->nil;
|
||||
ptr->parent = self->nil;
|
||||
|
||||
rbTreeInsert(SELF, ptr);
|
||||
rbTreeInsert(self, ptr);
|
||||
|
||||
SELF->count++;
|
||||
|
||||
return 1;
|
||||
self->count++;
|
||||
}
|
||||
|
||||
|
||||
static int insertInBag(WMBag *self, int index, void *item)
|
||||
void
|
||||
WMInsertInBag(WMBag *self, int index, void *item)
|
||||
{
|
||||
W_Node *ptr;
|
||||
|
||||
@@ -510,41 +463,41 @@ static int insertInBag(WMBag *self, int index, void *item)
|
||||
|
||||
ptr->data = item;
|
||||
ptr->index = index;
|
||||
ptr->left = SELF->nil;
|
||||
ptr->right = SELF->nil;
|
||||
ptr->parent = SELF->nil;
|
||||
ptr->left = self->nil;
|
||||
ptr->right = self->nil;
|
||||
ptr->parent = self->nil;
|
||||
|
||||
rbTreeInsert(SELF, ptr);
|
||||
rbTreeInsert(self, ptr);
|
||||
|
||||
while ((ptr = treeSuccessor(ptr, SELF->nil)) != SELF->nil) {
|
||||
while ((ptr = treeSuccessor(ptr, self->nil)) != self->nil) {
|
||||
ptr->index++;
|
||||
}
|
||||
|
||||
|
||||
SELF->count++;
|
||||
|
||||
return 1;
|
||||
self->count++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int removeFromBag(WMBag *self, void *item)
|
||||
int
|
||||
WMRemoveFromBag(WMBag *self, void *item)
|
||||
{
|
||||
W_Node *ptr = treeFind(SELF->root, SELF->nil, item);
|
||||
W_Node *ptr = treeFind(self->root, self->nil, item);
|
||||
|
||||
if (ptr != SELF->nil) {
|
||||
if (ptr != self->nil) {
|
||||
W_Node *tmp;
|
||||
|
||||
SELF->count--;
|
||||
self->count--;
|
||||
|
||||
tmp = treeSuccessor(ptr, SELF->nil);
|
||||
while (tmp != SELF->nil) {
|
||||
tmp = treeSuccessor(ptr, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
tmp->index--;
|
||||
tmp = treeSuccessor(tmp, SELF->nil);
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
ptr = rbTreeDelete(SELF, ptr);
|
||||
free(ptr);
|
||||
ptr = rbTreeDelete(self, ptr);
|
||||
if (self->destructor)
|
||||
self->destructor(ptr->data);
|
||||
wfree(ptr);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
@@ -553,17 +506,21 @@ static int removeFromBag(WMBag *self, void *item)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int eraseFromBag(WMBag *self, int index)
|
||||
int
|
||||
WMEraseFromBag(WMBag *self, int index)
|
||||
{
|
||||
W_Node *ptr = treeSearch(SELF->root, SELF->nil, index);
|
||||
W_Node *ptr = treeSearch(self->root, self->nil, index);
|
||||
|
||||
if (ptr != SELF->nil) {
|
||||
if (ptr != self->nil) {
|
||||
|
||||
SELF->count--;
|
||||
self->count--;
|
||||
|
||||
ptr = rbTreeDelete(SELF, ptr);
|
||||
free(ptr);
|
||||
ptr = rbTreeDelete(self, ptr);
|
||||
if (self->destructor)
|
||||
self->destructor(ptr->data);
|
||||
wfree(ptr);
|
||||
|
||||
wassertrv(self->count == 0||self->root->index >= 0, 1);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
@@ -572,23 +529,28 @@ static int eraseFromBag(WMBag *self, int index)
|
||||
}
|
||||
|
||||
|
||||
static int deleteFromBag(WMBag *self, int index)
|
||||
int
|
||||
WMDeleteFromBag(WMBag *self, int index)
|
||||
{
|
||||
W_Node *ptr = treeSearch(SELF->root, SELF->nil, index);
|
||||
W_Node *ptr = treeSearch(self->root, self->nil, index);
|
||||
|
||||
if (ptr != SELF->nil) {
|
||||
if (ptr != self->nil) {
|
||||
W_Node *tmp;
|
||||
|
||||
SELF->count--;
|
||||
self->count--;
|
||||
|
||||
tmp = treeSuccessor(ptr, SELF->nil);
|
||||
while (tmp != SELF->nil) {
|
||||
tmp = treeSuccessor(ptr, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
tmp->index--;
|
||||
tmp = treeSuccessor(tmp, SELF->nil);
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
ptr = rbTreeDelete(SELF, ptr);
|
||||
free(ptr);
|
||||
ptr = rbTreeDelete(self, ptr);
|
||||
if (self->destructor)
|
||||
self->destructor(ptr->data);
|
||||
wfree(ptr);
|
||||
|
||||
wassertrv(self->count == 0||self->root->index >= 0, 1);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
@@ -597,25 +559,26 @@ static int deleteFromBag(WMBag *self, int index)
|
||||
}
|
||||
|
||||
|
||||
static void *getFromBag(WMBag *self, int index)
|
||||
void*
|
||||
WMGetFromBag(WMBag *self, int index)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeSearch(SELF->root, SELF->nil, index);
|
||||
if (node != SELF->nil)
|
||||
node = treeSearch(self->root, self->nil, index);
|
||||
if (node != self->nil)
|
||||
return node->data;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int firstInBag(WMBag *self, void *item)
|
||||
int
|
||||
WMGetFirstInBag(WMBag *self, void *item)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeFind(SELF->root, SELF->nil, item);
|
||||
if (node != SELF->nil)
|
||||
node = treeFind(self->root, self->nil, item);
|
||||
if (node != self->nil)
|
||||
return node->index;
|
||||
else
|
||||
return WBNotFound;
|
||||
@@ -623,7 +586,8 @@ static int firstInBag(WMBag *self, void *item)
|
||||
|
||||
|
||||
|
||||
static int treeCount(W_Node *root, W_Node *nil, void *item)
|
||||
static int
|
||||
treeCount(W_Node *root, W_Node *nil, void *item)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
@@ -644,23 +608,26 @@ static int treeCount(W_Node *root, W_Node *nil, void *item)
|
||||
|
||||
|
||||
|
||||
static int countInBag(WMBag *self, void *item)
|
||||
int
|
||||
WMCountInBag(WMBag *self, void *item)
|
||||
{
|
||||
return treeCount(SELF->root, SELF->nil, item);
|
||||
return treeCount(self->root, self->nil, item);
|
||||
}
|
||||
|
||||
|
||||
static void *replaceInBag(WMBag *self, int index, void *item)
|
||||
void*
|
||||
WMReplaceInBag(WMBag *self, int index, void *item)
|
||||
{
|
||||
W_Node *ptr = treeSearch(SELF->root, SELF->nil, index);
|
||||
W_Node *ptr = treeSearch(self->root, self->nil, index);
|
||||
void *old = NULL;
|
||||
|
||||
if (item == NULL) {
|
||||
SELF->count--;
|
||||
|
||||
ptr = rbTreeDelete(SELF, ptr);
|
||||
free(ptr);
|
||||
} else if (ptr != SELF->nil) {
|
||||
self->count--;
|
||||
ptr = rbTreeDelete(self, ptr);
|
||||
if (self->destructor)
|
||||
self->destructor(ptr->data);
|
||||
wfree(ptr);
|
||||
} else if (ptr != self->nil) {
|
||||
old = ptr->data;
|
||||
ptr->data = item;
|
||||
} else {
|
||||
@@ -670,58 +637,56 @@ static void *replaceInBag(WMBag *self, int index, void *item)
|
||||
|
||||
ptr->data = item;
|
||||
ptr->index = index;
|
||||
ptr->left = SELF->nil;
|
||||
ptr->right = SELF->nil;
|
||||
ptr->parent = SELF->nil;
|
||||
ptr->left = self->nil;
|
||||
ptr->right = self->nil;
|
||||
ptr->parent = self->nil;
|
||||
|
||||
rbTreeInsert(SELF, ptr);
|
||||
rbTreeInsert(self, ptr);
|
||||
|
||||
SELF->count++;
|
||||
self->count++;
|
||||
}
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static int sortBag(WMBag *self, int (*comparer)(const void*, const void*))
|
||||
void
|
||||
WMSortBag(WMBag *self, WMCompareDataProc *comparer)
|
||||
{
|
||||
void **items;
|
||||
W_Node *tmp;
|
||||
int i;
|
||||
|
||||
if (self->count == 0)
|
||||
return;
|
||||
|
||||
items = wmalloc(sizeof(void*)*SELF->count);
|
||||
items = wmalloc(sizeof(void*)*self->count);
|
||||
i = 0;
|
||||
|
||||
tmp = treeMinimum(SELF->root, SELF->nil);
|
||||
while (tmp != SELF->nil) {
|
||||
tmp = treeMinimum(self->root, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
items[i++] = tmp->data;
|
||||
tmp = treeSuccessor(tmp, SELF->nil);
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
qsort(&items[0], SELF->count, sizeof(void*), comparer);
|
||||
qsort(&items[0], self->count, sizeof(void*), comparer);
|
||||
|
||||
i = 0;
|
||||
tmp = treeMinimum(SELF->root, SELF->nil);
|
||||
while (tmp != SELF->nil) {
|
||||
tmp = treeMinimum(self->root, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
tmp->index = i;
|
||||
tmp->data = items[i++];
|
||||
tmp = treeSuccessor(tmp, SELF->nil);
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
wfree(items);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void deleteTree(WMBag *self, W_Node *node)
|
||||
static void
|
||||
deleteTree(WMBag *self, W_Node *node)
|
||||
{
|
||||
if (node == SELF->nil)
|
||||
if (node == self->nil)
|
||||
return;
|
||||
|
||||
deleteTree(self, node->left);
|
||||
@@ -731,29 +696,30 @@ static void deleteTree(WMBag *self, W_Node *node)
|
||||
|
||||
deleteTree(self, node->right);
|
||||
|
||||
free(node);
|
||||
wfree(node);
|
||||
}
|
||||
|
||||
|
||||
static void emptyBag(WMBag *self)
|
||||
void
|
||||
WMEmptyBag(WMBag *self)
|
||||
{
|
||||
deleteTree(self, SELF->root);
|
||||
SELF->root = SELF->nil;
|
||||
SELF->count = 0;
|
||||
deleteTree(self, self->root);
|
||||
self->root = self->nil;
|
||||
self->count = 0;
|
||||
}
|
||||
|
||||
|
||||
static void freeBag(WMBag *self)
|
||||
void
|
||||
WMFreeBag(WMBag *self)
|
||||
{
|
||||
emptyBag(self);
|
||||
|
||||
free(self);
|
||||
WMEmptyBag(self);
|
||||
wfree(self->nil);
|
||||
wfree(self);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void mapTree(W_TreeBag *tree, W_Node *node,
|
||||
void (*function)(void*, void*), void *data)
|
||||
static void
|
||||
mapTree(W_Bag *tree, W_Node *node, void (*function)(void*, void*), void *data)
|
||||
{
|
||||
if (node == tree->nil)
|
||||
return;
|
||||
@@ -766,131 +732,124 @@ static void mapTree(W_TreeBag *tree, W_Node *node,
|
||||
}
|
||||
|
||||
|
||||
static void mapBag(WMBag *self, void (*function)(void*, void*), void *data)
|
||||
void
|
||||
WMMapBag(WMBag *self, void (*function)(void*, void*), void *data)
|
||||
{
|
||||
mapTree(SELF, SELF->root, function, data);
|
||||
mapTree(self, self->root, function, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int findInTree(W_TreeBag *tree, W_Node *node, int (*function)(void*))
|
||||
static int
|
||||
findInTree(W_Bag *tree, W_Node *node, WMMatchDataProc *function, void *cdata)
|
||||
{
|
||||
int index;
|
||||
|
||||
if (node == tree->nil)
|
||||
return WBNotFound;
|
||||
|
||||
index = findInTree(tree, node->left, function);
|
||||
index = findInTree(tree, node->left, function, cdata);
|
||||
if (index != WBNotFound)
|
||||
return index;
|
||||
|
||||
if ((*function)(node->data)) {
|
||||
if ((*function)(node->data, cdata)) {
|
||||
return node->index;
|
||||
}
|
||||
|
||||
return findInTree(tree, node->right, function);
|
||||
return findInTree(tree, node->right, function, cdata);
|
||||
}
|
||||
|
||||
|
||||
static int findInBag(WMBag *self, int (*match)(void*))
|
||||
int
|
||||
WMFindInBag(WMBag *self, WMMatchDataProc *match, void *cdata)
|
||||
{
|
||||
return findInTree(SELF, SELF->root, match);
|
||||
return findInTree(self, self->root, match, cdata);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void *first(WMBag *self, WMBagIterator *ptr)
|
||||
void*
|
||||
WMBagFirst(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeMinimum(SELF->root, SELF->nil);
|
||||
node = treeMinimum(self->root, self->nil);
|
||||
|
||||
if (node == SELF->nil) {
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void *last(WMBag *self, WMBagIterator *ptr)
|
||||
void*
|
||||
WMBagLast(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
|
||||
W_Node *node;
|
||||
|
||||
node = treeMaximum(SELF->root, SELF->nil);
|
||||
node = treeMaximum(self->root, self->nil);
|
||||
|
||||
if (node == SELF->nil) {
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void *next(WMBag *self, WMBagIterator *ptr)
|
||||
void*
|
||||
WMBagNext(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
if (*ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
node = treeSuccessor(*ptr, SELF->nil);
|
||||
node = treeSuccessor(*ptr, self->nil);
|
||||
|
||||
if (node == SELF->nil) {
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void *previous(WMBag *self, WMBagIterator *ptr)
|
||||
void*
|
||||
WMBagPrevious(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
if (*ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
node = treePredecessor(*ptr, SELF->nil);
|
||||
node = treePredecessor(*ptr, self->nil);
|
||||
|
||||
|
||||
if (node == SELF->nil) {
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void *iteratorAtIndex(WMBag *self, int index, WMBagIterator *ptr)
|
||||
void*
|
||||
WMBagIteratorAtIndex(WMBag *self, int index, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeSearch(SELF->root, SELF->nil, index);
|
||||
node = treeSearch(self->root, self->nil, index);
|
||||
|
||||
if (node == SELF->nil) {
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
} else {
|
||||
@@ -900,8 +859,10 @@ static void *iteratorAtIndex(WMBag *self, int index, WMBagIterator *ptr)
|
||||
}
|
||||
|
||||
|
||||
static int indexForIterator(WMBag *bag, WMBagIterator ptr)
|
||||
int
|
||||
WMBagIndexForIterator(WMBag *bag, WMBagIterator ptr)
|
||||
{
|
||||
return ((W_Node*)ptr)->index;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include <proplist.h>
|
||||
#include <X11/Xlocale.h>
|
||||
|
||||
|
||||
_WINGsConfiguration WINGsConfiguration;
|
||||
@@ -13,8 +13,31 @@ _WINGsConfiguration WINGsConfiguration;
|
||||
|
||||
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-bold-r-*-*-%d-*-*-*-*-*-*-*"
|
||||
|
||||
#define FLOPPY_PATH "/floppy"
|
||||
|
||||
|
||||
static unsigned
|
||||
getButtonWithName(const char *name, unsigned defaultButton)
|
||||
{
|
||||
if (strncmp(name, "Button", 6)==0 && strlen(name)==7) {
|
||||
switch (name[6]) {
|
||||
case '1':
|
||||
return Button1;
|
||||
case '2':
|
||||
return Button2;
|
||||
case '3':
|
||||
return Button3;
|
||||
case '4':
|
||||
return Button4;
|
||||
case '5':
|
||||
return Button5;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultButton;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
@@ -27,18 +50,66 @@ W_ReadConfigurations(void)
|
||||
defaults = WMGetStandardUserDefaults();
|
||||
|
||||
if (defaults) {
|
||||
char *buttonName;
|
||||
unsigned button;
|
||||
char *str;
|
||||
|
||||
WINGsConfiguration.systemFont =
|
||||
WMGetUDStringForKey(defaults, "SystemFont");
|
||||
|
||||
WINGsConfiguration.boldSystemFont =
|
||||
WMGetUDStringForKey(defaults, "BoldSystemFont");
|
||||
|
||||
WINGsConfiguration.useMultiByte =
|
||||
WMGetUDBoolForKey(defaults, "MultiByteText");
|
||||
WINGsConfiguration.useMultiByte = False;
|
||||
str = WMGetUDStringForKey(defaults, "MultiByteText");
|
||||
if (str) {
|
||||
if (strcasecmp(str, "YES") == 0) {
|
||||
WINGsConfiguration.useMultiByte = True;
|
||||
} else if (strcasecmp(str, "AUTO") == 0) {
|
||||
char *locale;
|
||||
|
||||
/* if it's a multibyte language (japanese, chinese or korean)
|
||||
* then set it to True */
|
||||
locale = setlocale(LC_CTYPE, NULL);
|
||||
if (locale != NULL
|
||||
&& (strncmp(locale, "ja", 2) == 0
|
||||
|| strncmp(locale, "zh", 2) == 0
|
||||
|| strncmp(locale, "ko", 2) == 0)) {
|
||||
|
||||
WINGsConfiguration.useMultiByte = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WINGsConfiguration.doubleClickDelay =
|
||||
WMGetUDIntegerForKey(defaults, "DoubleClickTime");
|
||||
|
||||
WINGsConfiguration.floppyPath =
|
||||
WMGetUDStringForKey(defaults, "FloppyPath");
|
||||
|
||||
buttonName = WMGetUDStringForKey(defaults, "MouseWheelUp");
|
||||
if (buttonName) {
|
||||
button = getButtonWithName(buttonName, Button4);
|
||||
wfree(buttonName);
|
||||
} else {
|
||||
button = Button4;
|
||||
}
|
||||
WINGsConfiguration.mouseWheelUp = button;
|
||||
|
||||
buttonName = WMGetUDStringForKey(defaults, "MouseWheelDown");
|
||||
if (buttonName) {
|
||||
button = getButtonWithName(buttonName, Button5);
|
||||
wfree(buttonName);
|
||||
} else {
|
||||
button = Button5;
|
||||
}
|
||||
WINGsConfiguration.mouseWheelDown = button;
|
||||
|
||||
if (WINGsConfiguration.mouseWheelDown==WINGsConfiguration.mouseWheelUp) {
|
||||
WINGsConfiguration.mouseWheelUp = Button4;
|
||||
WINGsConfiguration.mouseWheelDown = Button5;
|
||||
}
|
||||
|
||||
WINGsConfiguration.defaultFontSize =
|
||||
WMGetUDIntegerForKey(defaults, "DefaultFontSize");
|
||||
}
|
||||
@@ -50,9 +121,18 @@ W_ReadConfigurations(void)
|
||||
if (!WINGsConfiguration.boldSystemFont) {
|
||||
WINGsConfiguration.boldSystemFont = BOLD_SYSTEM_FONT;
|
||||
}
|
||||
if (!WINGsConfiguration.floppyPath) {
|
||||
WINGsConfiguration.floppyPath = FLOPPY_PATH;
|
||||
}
|
||||
if (WINGsConfiguration.doubleClickDelay == 0) {
|
||||
WINGsConfiguration.doubleClickDelay = 250;
|
||||
}
|
||||
if (WINGsConfiguration.mouseWheelUp == 0) {
|
||||
WINGsConfiguration.mouseWheelUp = Button4;
|
||||
}
|
||||
if (WINGsConfiguration.mouseWheelDown == 0) {
|
||||
WINGsConfiguration.mouseWheelDown = Button5;
|
||||
}
|
||||
if (WINGsConfiguration.defaultFontSize == 0) {
|
||||
WINGsConfiguration.defaultFontSize = 12;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* WINGs WMConnection function library
|
||||
*
|
||||
* Copyright (c) 1999 Dan Pascu
|
||||
* Copyright (c) 1999-2000 Dan Pascu
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -23,11 +23,12 @@
|
||||
* TODO:
|
||||
* - decide if we want to support connections with external sockets, else
|
||||
* clean up the structure of the unneeded members.
|
||||
* - decide what to do with all wwarning() calls that are still there.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "../src/config.h"
|
||||
#include "wconfig.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@@ -53,11 +54,16 @@
|
||||
# define SHUT_RDWR 2
|
||||
#endif
|
||||
|
||||
/* for SunOS */
|
||||
/* For SunOS */
|
||||
#ifndef SA_RESTART
|
||||
# define SA_RESTART 0
|
||||
#endif
|
||||
|
||||
/* For Solaris */
|
||||
#ifndef INADDR_NONE
|
||||
# define INADDR_NONE -1
|
||||
#endif
|
||||
|
||||
/* Stuff for setting the sockets into non-blocking mode. */
|
||||
/*#ifdef __POSIX_SOURCE
|
||||
# define NONBLOCK_OPT O_NONBLOCK
|
||||
@@ -67,19 +73,19 @@
|
||||
|
||||
#define NONBLOCK_OPT O_NONBLOCK
|
||||
|
||||
|
||||
#define NETBUF_SIZE 4096
|
||||
|
||||
|
||||
#define DEF_TIMEOUT 600 /* 600 seconds == 10 minutes */
|
||||
|
||||
|
||||
|
||||
int WCErrorCode = 0;
|
||||
|
||||
|
||||
|
||||
static Bool SigInitialized = False;
|
||||
|
||||
static unsigned int DefaultTimeout = DEF_TIMEOUT;
|
||||
static unsigned int OpenTimeout = DEF_TIMEOUT;
|
||||
|
||||
|
||||
|
||||
typedef struct TimeoutData {
|
||||
@@ -88,7 +94,6 @@ typedef struct TimeoutData {
|
||||
} TimeoutData;
|
||||
|
||||
|
||||
|
||||
typedef struct W_Connection {
|
||||
int sock; /* the socket we speak through */
|
||||
|
||||
@@ -102,12 +107,14 @@ typedef struct W_Connection {
|
||||
void *clientData; /* client data */
|
||||
unsigned int uflags; /* flags for the client */
|
||||
|
||||
WMBag *outputQueue;
|
||||
WMArray *outputQueue;
|
||||
unsigned bufPos;
|
||||
|
||||
TimeoutData sendTimeout;
|
||||
TimeoutData openTimeout;
|
||||
|
||||
WMConnectionState state;
|
||||
WMConnectionTimeoutState timeoutState;
|
||||
|
||||
char *address;
|
||||
char *service;
|
||||
@@ -121,18 +128,34 @@ typedef struct W_Connection {
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
clearOutputQueue(WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
int i;
|
||||
|
||||
cPtr->bufPos = 0;
|
||||
WMEmptyArray(cPtr->outputQueue);
|
||||
}
|
||||
|
||||
for (i=0; i<WMGetBagItemCount(cPtr->outputQueue); i++)
|
||||
WMReleaseData(WMGetFromBag(cPtr->outputQueue, i));
|
||||
|
||||
WMEmptyBag(cPtr->outputQueue);
|
||||
static void
|
||||
openTimeout(void *cdata) /*FOLD00*/
|
||||
{
|
||||
WMConnection *cPtr = (WMConnection*) cdata;
|
||||
|
||||
cPtr->openTimeout.handler = NULL;
|
||||
if (cPtr->handler.write) {
|
||||
WMDeleteInputHandler(cPtr->handler.write);
|
||||
cPtr->handler.write = NULL;
|
||||
}
|
||||
if (cPtr->state != WCConnected) {
|
||||
cPtr->state = WCTimedOut;
|
||||
cPtr->timeoutState = WCTWhileOpening;
|
||||
if (cPtr->delegate && cPtr->delegate->didTimeout) {
|
||||
(*cPtr->delegate->didTimeout)(cPtr->delegate, cPtr);
|
||||
} else {
|
||||
WMCloseConnection(cPtr);
|
||||
cPtr->state = WCTimedOut; /* the above set state to WCClosed */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,17 +163,22 @@ static void
|
||||
sendTimeout(void *cdata) /*FOLD00*/
|
||||
{
|
||||
WMConnection *cPtr = (WMConnection*) cdata;
|
||||
TimeoutData *tPtr = &cPtr->sendTimeout;
|
||||
|
||||
tPtr->handler = NULL;
|
||||
cPtr->sendTimeout.handler = NULL;
|
||||
if (cPtr->handler.write) {
|
||||
WMDeleteInputHandler(cPtr->handler.write);
|
||||
cPtr->handler.write = NULL;
|
||||
}
|
||||
if (WMGetBagItemCount(cPtr->outputQueue)>0) {
|
||||
if (WMGetArrayItemCount(cPtr->outputQueue)>0) {
|
||||
clearOutputQueue(cPtr);
|
||||
if (cPtr->delegate && cPtr->delegate->didTimeout)
|
||||
cPtr->state = WCTimedOut;
|
||||
cPtr->timeoutState = WCTWhileSending;
|
||||
if (cPtr->delegate && cPtr->delegate->didTimeout) {
|
||||
(*cPtr->delegate->didTimeout)(cPtr->delegate, cPtr);
|
||||
} else {
|
||||
WMCloseConnection(cPtr);
|
||||
cPtr->state = WCTimedOut; /* the above set state to WCClosed */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,16 +193,20 @@ inputHandler(int fd, int mask, void *clientData) /*FOLD00*/
|
||||
|
||||
if ((mask & WIWriteMask)) {
|
||||
if (cPtr->state == WCInProgress) {
|
||||
Bool failed;
|
||||
int result;
|
||||
int len = sizeof(result);
|
||||
|
||||
WCErrorCode = 0;
|
||||
if (getsockopt(cPtr->sock, SOL_SOCKET, SO_ERROR,
|
||||
(void*)&result, &len) == 0 && result != 0) {
|
||||
cPtr->state = WCFailed;
|
||||
WCErrorCode = result;
|
||||
failed = True;
|
||||
/* should call wsyserrorwithcode(result, ...) here? */
|
||||
} else {
|
||||
cPtr->state = WCConnected;
|
||||
failed = False;
|
||||
}
|
||||
|
||||
if (cPtr->handler.write) {
|
||||
@@ -182,10 +214,18 @@ inputHandler(int fd, int mask, void *clientData) /*FOLD00*/
|
||||
cPtr->handler.write = NULL;
|
||||
}
|
||||
|
||||
if (cPtr->openTimeout.handler) {
|
||||
WMDeleteTimerHandler(cPtr->openTimeout.handler);
|
||||
cPtr->openTimeout.handler = NULL;
|
||||
}
|
||||
|
||||
if (cPtr->delegate && cPtr->delegate->didInitialize)
|
||||
(*cPtr->delegate->didInitialize)(cPtr->delegate, cPtr);
|
||||
|
||||
if (cPtr->state == WCFailed)
|
||||
/* we use failed and not cPtr->state here, because cPtr may be
|
||||
* destroyed by the delegate called above if the connection failed
|
||||
*/
|
||||
if (failed)
|
||||
return;
|
||||
} else if (cPtr->state == WCConnected) {
|
||||
WMFlushConnection(cPtr);
|
||||
@@ -217,7 +257,7 @@ setSocketNonBlocking(int sock, Bool flag) /*FOLD00*/
|
||||
state = fcntl(sock, F_GETFL, 0);
|
||||
|
||||
if (state < 0) {
|
||||
wsyserror("Failed to get socket flags with fcntl.");
|
||||
/* set WCErrorCode here? -Dan*/
|
||||
return False;
|
||||
}
|
||||
|
||||
@@ -234,7 +274,7 @@ setSocketNonBlocking(int sock, Bool flag) /*FOLD00*/
|
||||
}
|
||||
|
||||
if (fcntl(sock, F_SETFL, state) < 0) {
|
||||
wsyserror("Failed to set socket flags with fcntl.");
|
||||
/* set WCErrorCode here? -Dan*/
|
||||
return False;
|
||||
}
|
||||
|
||||
@@ -260,7 +300,7 @@ getSocketAddress(char* name, char* service, char* protocol) /*FOLD00*/
|
||||
static struct sockaddr_in socketaddr;
|
||||
struct servent *sp;
|
||||
|
||||
if (!protocol || protocol[0]=='\0')
|
||||
if (!protocol || protocol[0]==0)
|
||||
protocol = "tcp";
|
||||
|
||||
memset(&socketaddr, 0, sizeof(struct sockaddr_in));
|
||||
@@ -271,7 +311,7 @@ getSocketAddress(char* name, char* service, char* protocol) /*FOLD00*/
|
||||
* Otherwise we expect the given name to be an address unless it is
|
||||
* NULL (any address).
|
||||
*/
|
||||
if (name && name[0]!='\0') {
|
||||
if (name && name[0]!=0) {
|
||||
WMHost *host = WMGetHostWithName(name);
|
||||
|
||||
if (!host)
|
||||
@@ -291,7 +331,7 @@ getSocketAddress(char* name, char* service, char* protocol) /*FOLD00*/
|
||||
socketaddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
}
|
||||
|
||||
if (!service || service[0]=='\0') {
|
||||
if (!service || service[0]==0) {
|
||||
socketaddr.sin_port = 0;
|
||||
} else if ((sp = getservbyname(service, protocol))==0) {
|
||||
char *endptr;
|
||||
@@ -299,7 +339,7 @@ getSocketAddress(char* name, char* service, char* protocol) /*FOLD00*/
|
||||
|
||||
portNumber = strtoul(service, &endptr, 10);
|
||||
|
||||
if (service[0]!='\0' && *endptr=='\0' && portNumber<65536) {
|
||||
if (service[0]!=0 && *endptr==0 && portNumber<65536) {
|
||||
socketaddr.sin_port = htons(portNumber);
|
||||
} else {
|
||||
return NULL;
|
||||
@@ -312,6 +352,12 @@ getSocketAddress(char* name, char* service, char* protocol) /*FOLD00*/
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dummyHandler(int signum)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static WMConnection*
|
||||
createConnectionWithSocket(int sock, Bool closeOnRelease) /*FOLD00*/
|
||||
{
|
||||
@@ -322,16 +368,26 @@ createConnectionWithSocket(int sock, Bool closeOnRelease) /*FOLD00*/
|
||||
wretain(cPtr);
|
||||
memset(cPtr, 0, sizeof(WMConnection));
|
||||
|
||||
fcntl(sock, F_SETFD, FD_CLOEXEC); /* by default close on exec */
|
||||
|
||||
cPtr->sock = sock;
|
||||
cPtr->sendTimeout.timeout = DEF_TIMEOUT;
|
||||
cPtr->openTimeout.timeout = OpenTimeout;
|
||||
cPtr->openTimeout.handler = NULL;
|
||||
cPtr->sendTimeout.timeout = DefaultTimeout;
|
||||
cPtr->sendTimeout.handler = NULL;
|
||||
cPtr->closeOnRelease = closeOnRelease;
|
||||
cPtr->outputQueue = WMCreateBag(16);
|
||||
cPtr->outputQueue =
|
||||
WMCreateArrayWithDestructor(16, (WMFreeDataProc*)WMReleaseData);
|
||||
cPtr->state = WCNotConnected;
|
||||
cPtr->timeoutState = WCTNone;
|
||||
|
||||
/* ignore dead pipe */
|
||||
if (!SigInitialized) {
|
||||
sig_action.sa_handler = SIG_IGN;
|
||||
/* Because POSIX mandates that only signal with handlers are reset
|
||||
* accross an exec*(), we do not want to propagate ignoring SIGPIPEs
|
||||
* to children. Hence the dummy handler. Philippe Troin <phil@fifi.org>
|
||||
*/
|
||||
sig_action.sa_handler = &dummyHandler;
|
||||
sig_action.sa_flags = SA_RESTART;
|
||||
sigaction(SIGPIPE, &sig_action, NULL);
|
||||
SigInitialized = True;
|
||||
@@ -347,7 +403,8 @@ WMCreateConnectionWithSocket(int sock, Bool closeOnRelease) /*FOLD00*/
|
||||
{
|
||||
WMConnection *cPtr;
|
||||
struct sockaddr_in clientname;
|
||||
int size, n;
|
||||
int size;
|
||||
int n;
|
||||
|
||||
cPtr = createConnectionWithSocket(sock, closeOnRelease);
|
||||
cPtr->wasNonBlocking = WMIsConnectionNonBlocking(cPtr);
|
||||
@@ -395,11 +452,13 @@ WMCreateConnectionAsServerAtAddress(char *host, char *service, char *protocol) /
|
||||
{
|
||||
WMConnection *cPtr;
|
||||
struct sockaddr_in *socketaddr;
|
||||
int sock, size, on;
|
||||
int sock, on;
|
||||
int size;
|
||||
|
||||
WCErrorCode = 0;
|
||||
|
||||
if ((socketaddr = getSocketAddress(host, service, protocol)) == NULL) {
|
||||
WCErrorCode = 0;
|
||||
wwarning("Bad address-service-protocol combination");
|
||||
wwarning(_("Bad address-service-protocol combination"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -407,7 +466,6 @@ WMCreateConnectionAsServerAtAddress(char *host, char *service, char *protocol) /
|
||||
sock = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (sock<0) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to create socket");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -421,17 +479,12 @@ WMCreateConnectionAsServerAtAddress(char *host, char *service, char *protocol) /
|
||||
|
||||
if (bind(sock, (struct sockaddr *)socketaddr, sizeof(*socketaddr)) < 0) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to bind to address '%s:%hu'",
|
||||
inet_ntoa(socketaddr->sin_addr),
|
||||
ntohs(socketaddr->sin_port));
|
||||
close(sock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (listen(sock, 10) < 0) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to listen on port '%hu'",
|
||||
ntohs(socketaddr->sin_port));
|
||||
close(sock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -441,7 +494,6 @@ WMCreateConnectionAsServerAtAddress(char *host, char *service, char *protocol) /
|
||||
size = sizeof(*socketaddr);
|
||||
if (getsockname(sock, (struct sockaddr*)socketaddr, &size) < 0) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to get socket address");
|
||||
close(sock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -463,18 +515,15 @@ WMCreateConnectionToAddress(char *host, char *service, char *protocol) /*FOLD00*
|
||||
struct sockaddr_in *socketaddr;
|
||||
int sock;
|
||||
|
||||
if (service==NULL || service[0]=='\0') {
|
||||
WCErrorCode = 0;
|
||||
wwarning("Bad argument - service is not specified");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (host==NULL || host[0]=='\0')
|
||||
wassertrv(service!=NULL && service[0]!=0, NULL);
|
||||
|
||||
if (host==NULL || host[0]==0)
|
||||
host = "localhost";
|
||||
|
||||
if ((socketaddr = getSocketAddress(host, service, protocol)) == NULL) {
|
||||
WCErrorCode = 0;
|
||||
wwarning("Bad address-service-protocol combination");
|
||||
wwarning(_("Bad address-service-protocol combination"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -482,16 +531,12 @@ WMCreateConnectionToAddress(char *host, char *service, char *protocol) /*FOLD00*
|
||||
sock = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (sock<0) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to create socket");
|
||||
return NULL;
|
||||
}
|
||||
/* make socket blocking while we connect. */
|
||||
setSocketNonBlocking(sock, False);
|
||||
if (connect(sock, (struct sockaddr*)socketaddr, sizeof(*socketaddr)) < 0) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to make connection to address '%s:%hu'",
|
||||
inet_ntoa(socketaddr->sin_addr),
|
||||
ntohs(socketaddr->sin_port));
|
||||
close(sock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -509,23 +554,19 @@ WMConnection*
|
||||
WMCreateConnectionToAddressAndNotify(char *host, char *service, char *protocol) /*FOLD00*/
|
||||
{
|
||||
WMConnection *cPtr;
|
||||
/*TimeoutData *tPtr;*/
|
||||
struct sockaddr_in *socketaddr;
|
||||
int sock;
|
||||
Bool isNonBlocking;
|
||||
|
||||
if (service==NULL || service[0]=='\0') {
|
||||
WCErrorCode = 0;
|
||||
wwarning("Bad argument - service is not specified");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (host==NULL || host[0]=='\0')
|
||||
wassertrv(service!=NULL && service[0]!=0, NULL);
|
||||
|
||||
if (host==NULL || host[0]==0)
|
||||
host = "localhost";
|
||||
|
||||
if ((socketaddr = getSocketAddress(host, service, protocol)) == NULL) {
|
||||
WCErrorCode = 0;
|
||||
wwarning("Bad address-service-protocol combination");
|
||||
wwarning(_("Bad address-service-protocol combination"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -533,16 +574,12 @@ WMCreateConnectionToAddressAndNotify(char *host, char *service, char *protocol)
|
||||
sock = socket(PF_INET, SOCK_STREAM, 0);
|
||||
if (sock<0) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to create socket");
|
||||
return NULL;
|
||||
}
|
||||
isNonBlocking = setSocketNonBlocking(sock, True);
|
||||
if (connect(sock, (struct sockaddr*)socketaddr, sizeof(*socketaddr)) < 0) {
|
||||
if (errno!=EINPROGRESS) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Unable to make connection to address '%s:%hu'",
|
||||
inet_ntoa(socketaddr->sin_addr),
|
||||
ntohs(socketaddr->sin_port));
|
||||
close(sock);
|
||||
return NULL;
|
||||
}
|
||||
@@ -552,12 +589,12 @@ WMCreateConnectionToAddressAndNotify(char *host, char *service, char *protocol)
|
||||
cPtr->state = WCInProgress;
|
||||
cPtr->isNonBlocking = isNonBlocking;
|
||||
|
||||
/*tPtr = &cPtr->sendTimeout;
|
||||
tPtr->handler = WMAddTimerHandler(tPtr->timeout*1000, connectTimeout, cPtr);
|
||||
*/
|
||||
cPtr->handler.write = WMAddInputHandler(cPtr->sock, WIWriteMask,
|
||||
inputHandler, cPtr);
|
||||
|
||||
cPtr->openTimeout.handler =
|
||||
WMAddTimerHandler(cPtr->openTimeout.timeout*1000, openTimeout, cPtr);
|
||||
|
||||
setConnectionAddress(cPtr, socketaddr);
|
||||
|
||||
return cPtr;
|
||||
@@ -573,12 +610,15 @@ removeAllHandlers(WMConnection *cPtr) /*FOLD00*/
|
||||
WMDeleteInputHandler(cPtr->handler.write);
|
||||
if (cPtr->handler.exception)
|
||||
WMDeleteInputHandler(cPtr->handler.exception);
|
||||
if (cPtr->openTimeout.handler)
|
||||
WMDeleteTimerHandler(cPtr->openTimeout.handler);
|
||||
if (cPtr->sendTimeout.handler)
|
||||
WMDeleteTimerHandler(cPtr->sendTimeout.handler);
|
||||
|
||||
cPtr->handler.read = NULL;
|
||||
cPtr->handler.write = NULL;
|
||||
cPtr->handler.exception = NULL;
|
||||
cPtr->openTimeout.handler = NULL;
|
||||
cPtr->sendTimeout.handler = NULL;
|
||||
}
|
||||
|
||||
@@ -592,8 +632,7 @@ WMDestroyConnection(WMConnection *cPtr) /*FOLD00*/
|
||||
}
|
||||
|
||||
removeAllHandlers(cPtr);
|
||||
clearOutputQueue(cPtr);
|
||||
WMFreeBag(cPtr->outputQueue);
|
||||
WMFreeArray(cPtr->outputQueue); /* will also free the items with the destructor */
|
||||
|
||||
if (cPtr->address) {
|
||||
wfree(cPtr->address);
|
||||
@@ -629,21 +668,13 @@ WMAcceptConnection(WMConnection *listener) /*FOLD00*/
|
||||
int newSock;
|
||||
WMConnection *newConnection;
|
||||
|
||||
if (listener->state!=WCListening) {
|
||||
wwarning("Called 'WMAcceptConnection()' on a non-listening connection");
|
||||
WCErrorCode = 0;
|
||||
return NULL;
|
||||
}
|
||||
wassertrv(listener && listener->state==WCListening, NULL);
|
||||
|
||||
size = sizeof(clientname);
|
||||
newSock = accept(listener->sock, (struct sockaddr*) &clientname, &size);
|
||||
if (newSock<0) {
|
||||
if (errno!=EAGAIN && errno!=EWOULDBLOCK) {
|
||||
WCErrorCode = errno;
|
||||
wsyserror("Could not accept connection");
|
||||
} else {
|
||||
WCErrorCode = 0;
|
||||
}
|
||||
WCErrorCode = ((errno!=EAGAIN && errno!=EWOULDBLOCK) ? errno : 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -671,7 +702,7 @@ WMGetConnectionService(WMConnection *cPtr) /*FOLD00*/
|
||||
|
||||
|
||||
char*
|
||||
WMGetConnectionProtocol(WMConnection *cPtr)
|
||||
WMGetConnectionProtocol(WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
return cPtr->protocol;
|
||||
}
|
||||
@@ -691,6 +722,13 @@ WMGetConnectionState(WMConnection *cPtr) /*FOLD00*/
|
||||
}
|
||||
|
||||
|
||||
WMConnectionTimeoutState
|
||||
WMGetConnectionTimeoutState(WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
return cPtr->timeoutState;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMEnqueueConnectionData(WMConnection *cPtr, WMData *data) /*FOLD00*/
|
||||
{
|
||||
@@ -700,7 +738,7 @@ WMEnqueueConnectionData(WMConnection *cPtr, WMData *data) /*FOLD00*/
|
||||
if (cPtr->state!=WCConnected)
|
||||
return False;
|
||||
|
||||
WMPutInBag(cPtr->outputQueue, WMRetainData(data));
|
||||
WMAddToArray(cPtr->outputQueue, WMRetainData(data));
|
||||
return True;
|
||||
}
|
||||
|
||||
@@ -720,19 +758,19 @@ WMSendConnectionData(WMConnection *cPtr, WMData *data) /*FOLD00*/
|
||||
|
||||
/* If we have no data just flush the queue, else try to send data */
|
||||
if (data && WMGetDataLength(data)>0) {
|
||||
WMPutInBag(cPtr->outputQueue, WMRetainData(data));
|
||||
WMAddToArray(cPtr->outputQueue, WMRetainData(data));
|
||||
/* If there already was something in queue, and also a write input
|
||||
* handler is established, it means we were unable to send, so
|
||||
* return and let the write handler notify us when we can send.
|
||||
*/
|
||||
if (WMGetBagItemCount(cPtr->outputQueue)>1 && cPtr->handler.write)
|
||||
if (WMGetArrayItemCount(cPtr->outputQueue)>1 && cPtr->handler.write)
|
||||
return 0;
|
||||
}
|
||||
|
||||
totalTransfer = 0;
|
||||
|
||||
while (WMGetBagItemCount(cPtr->outputQueue) > 0) {
|
||||
data = WMGetFromBag(cPtr->outputQueue, 0);
|
||||
while (WMGetArrayItemCount(cPtr->outputQueue) > 0) {
|
||||
data = WMGetFromArray(cPtr->outputQueue, 0);
|
||||
dataBytes = (const unsigned char *)WMDataBytes(data);
|
||||
len = WMGetDataLength(data);
|
||||
pos = cPtr->bufPos; /* where we're left last time */
|
||||
@@ -759,7 +797,6 @@ WMSendConnectionData(WMConnection *cPtr, WMData *data) /*FOLD00*/
|
||||
default:
|
||||
WCErrorCode = errno;
|
||||
cPtr->state = WCDied;
|
||||
/*clearOutputQueue(cPtr);*/
|
||||
removeAllHandlers(cPtr);
|
||||
if (cPtr->delegate && cPtr->delegate->didDie)
|
||||
(*cPtr->delegate->didDie)(cPtr->delegate, cPtr);
|
||||
@@ -769,8 +806,7 @@ WMSendConnectionData(WMConnection *cPtr, WMData *data) /*FOLD00*/
|
||||
pos += bytes;
|
||||
totalTransfer += bytes;
|
||||
}
|
||||
WMReleaseData(data);
|
||||
WMDeleteFromBag(cPtr->outputQueue, 0);
|
||||
WMDeleteFromArray(cPtr->outputQueue, 0);
|
||||
cPtr->bufPos = 0;
|
||||
if (tPtr->handler) {
|
||||
WMDeleteTimerHandler(tPtr->handler);
|
||||
@@ -870,7 +906,6 @@ WMIsConnectionNonBlocking(WMConnection *cPtr) /*FOLD00*/
|
||||
state = fcntl(cPtr->sock, F_GETFL, 0);
|
||||
|
||||
if (state < 0) {
|
||||
wsyserror("Failed to get socket flags with fcntl.");
|
||||
/* If we can't use fcntl on socket, this probably also means we could
|
||||
* not use fcntl to set non-blocking mode, and since a socket defaults
|
||||
* to blocking when created, return False as the best assumption */
|
||||
@@ -885,17 +920,33 @@ WMIsConnectionNonBlocking(WMConnection *cPtr) /*FOLD00*/
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
Bool
|
||||
WMSetConnectionNonBlocking(WMConnection *cPtr, Bool flag) /*FOLD00*/
|
||||
{
|
||||
if (cPtr->sock < 0)
|
||||
return;
|
||||
wassertrv(cPtr!=NULL && cPtr->sock>=0, False);
|
||||
|
||||
if (cPtr->isNonBlocking == flag)
|
||||
return;
|
||||
return True;
|
||||
|
||||
if (setSocketNonBlocking(cPtr->sock, flag)==True)
|
||||
if (setSocketNonBlocking(cPtr->sock, flag)==True) {
|
||||
cPtr->isNonBlocking = flag;
|
||||
return True;
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMSetConnectionCloseOnExec(WMConnection *cPtr, Bool flag)
|
||||
{
|
||||
wassertrv(cPtr!=NULL && cPtr->sock>=0, False);
|
||||
|
||||
if (fcntl(cPtr->sock, F_SETFD, (flag ? FD_CLOEXEC : 0)) < 0) {
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
@@ -927,13 +978,43 @@ WMSetConnectionFlags(WMConnection *cPtr, unsigned int flags) /*FOLD00*/
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetConnectionSendTimeout(WMConnection *cPtr, unsigned int timeout) /*FOLD00*/
|
||||
WMArray*
|
||||
WMGetConnectionUnsentData(WMConnection *cPtr)
|
||||
{
|
||||
if (timeout == 0)
|
||||
timeout = DEF_TIMEOUT;
|
||||
|
||||
cPtr->sendTimeout.timeout = timeout;
|
||||
return cPtr->outputQueue;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetConnectionDefaultTimeout(unsigned int timeout) /*FOLD00*/
|
||||
{
|
||||
if (timeout == 0) {
|
||||
DefaultTimeout = DEF_TIMEOUT;
|
||||
} else {
|
||||
DefaultTimeout = timeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetConnectionOpenTimeout(unsigned int timeout) /*FOLD00*/
|
||||
{
|
||||
if (timeout == 0) {
|
||||
OpenTimeout = DefaultTimeout;
|
||||
} else {
|
||||
OpenTimeout = timeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetConnectionSendTimeout(WMConnection *cPtr, unsigned int timeout) /*FOLD00*/
|
||||
{
|
||||
if (timeout == 0) {
|
||||
cPtr->sendTimeout.timeout = DefaultTimeout;
|
||||
} else {
|
||||
cPtr->sendTimeout.timeout = timeout;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
86
WINGs/data.c
86
WINGs/data.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* WINGs WMData function library
|
||||
*
|
||||
* Copyright (c) 1999 Dan Pascu
|
||||
* Copyright (c) 1999-2000 Dan Pascu
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -30,7 +30,8 @@ typedef struct W_Data {
|
||||
unsigned growth; /* How much to grow */
|
||||
void *bytes; /* Actual data */
|
||||
unsigned retainCount;
|
||||
unsigned freeData:1; /* whether the data should be released */
|
||||
WMFreeDataProc *destructor;
|
||||
int format; /* 0, 8, 16 or 32 */
|
||||
} W_Data;
|
||||
|
||||
|
||||
@@ -49,11 +50,13 @@ WMCreateDataWithCapacity(unsigned capacity) /*FOLD00*/
|
||||
aData->bytes = wmalloc(capacity);
|
||||
else
|
||||
aData->bytes = NULL;
|
||||
|
||||
aData->capacity = capacity;
|
||||
aData->growth = capacity/2 > 0 ? capacity/2 : 1;
|
||||
aData->length = 0;
|
||||
aData->retainCount = 1;
|
||||
aData->freeData = 1;
|
||||
aData->format = 0;
|
||||
aData->destructor = wfree;
|
||||
|
||||
return aData;
|
||||
}
|
||||
@@ -88,7 +91,8 @@ WMCreateDataWithBytes(void *bytes, unsigned length) /*FOLD00*/
|
||||
|
||||
|
||||
WMData*
|
||||
WMCreateDataWithBytesNoCopy(void *bytes, unsigned length) /*FOLD00*/
|
||||
WMCreateDataWithBytesNoCopy(void *bytes, unsigned length, /*FOLD00*/
|
||||
WMFreeDataProc *destructor)
|
||||
{
|
||||
WMData *aData;
|
||||
|
||||
@@ -98,7 +102,8 @@ WMCreateDataWithBytesNoCopy(void *bytes, unsigned length) /*FOLD00*/
|
||||
aData->growth = length/2 > 0 ? length/2 : 1;
|
||||
aData->bytes = bytes;
|
||||
aData->retainCount = 1;
|
||||
aData->freeData = 0;
|
||||
aData->format = 0;
|
||||
aData->destructor = destructor;
|
||||
|
||||
return aData;
|
||||
}
|
||||
@@ -107,10 +112,16 @@ WMCreateDataWithBytesNoCopy(void *bytes, unsigned length) /*FOLD00*/
|
||||
WMData*
|
||||
WMCreateDataWithData(WMData *aData) /*FOLD00*/
|
||||
{
|
||||
if (aData->length > 0)
|
||||
return WMCreateDataWithBytes(aData->bytes, aData->length);
|
||||
else
|
||||
return WMCreateDataWithCapacity(0);
|
||||
WMData *newData;
|
||||
|
||||
if (aData->length > 0) {
|
||||
newData = WMCreateDataWithBytes(aData->bytes, aData->length);
|
||||
} else {
|
||||
newData = WMCreateDataWithCapacity(0);
|
||||
}
|
||||
newData->format = aData->format;
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +139,9 @@ WMReleaseData(WMData *aData) /*FOLD00*/
|
||||
aData->retainCount--;
|
||||
if (aData->retainCount > 0)
|
||||
return;
|
||||
if (aData->bytes && aData->freeData)
|
||||
wfree(aData->bytes);
|
||||
if (aData->bytes!=NULL && aData->destructor!=NULL) {
|
||||
aData->destructor(aData->bytes);
|
||||
}
|
||||
wfree(aData);
|
||||
}
|
||||
|
||||
@@ -158,14 +170,20 @@ WMSetDataLength(WMData *aData, unsigned length) /*FOLD00*/
|
||||
WMSetDataCapacity(aData, length);
|
||||
}
|
||||
if (length > aData->length) {
|
||||
unsigned char *dataBytes = (unsigned char *)aData->bytes;
|
||||
|
||||
memset(dataBytes + aData->length, 0, length - aData->length);
|
||||
memset((unsigned char*)aData->bytes + aData->length, 0,
|
||||
length - aData->length);
|
||||
}
|
||||
aData->length = length;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetDataFormat(WMData *aData, unsigned format)
|
||||
{
|
||||
aData->format = format;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMIncreaseDataLengthBy(WMData *aData, unsigned extraLength) /*FOLD00*/
|
||||
{
|
||||
@@ -191,6 +209,13 @@ WMGetDataBytes(WMData *aData, void *buffer) /*FOLD00*/
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
WMGetDataFormat(WMData *aData)
|
||||
{
|
||||
return aData->format;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMGetDataBytesWithLength(WMData *aData, void *buffer, unsigned length) /*FOLD00*/
|
||||
{
|
||||
@@ -204,12 +229,11 @@ WMGetDataBytesWithLength(WMData *aData, void *buffer, unsigned length) /*FOLD00*
|
||||
void
|
||||
WMGetDataBytesWithRange(WMData *aData, void *buffer, WMRange aRange) /*FOLD00*/
|
||||
{
|
||||
unsigned char *dataBytes = (unsigned char *)aData->bytes;
|
||||
|
||||
wassertr(aRange.position < aData->length);
|
||||
wassertr(aRange.count <= aData->length-aRange.position);
|
||||
|
||||
memcpy(buffer,dataBytes + aRange.position, aRange.count);
|
||||
memcpy(buffer, (unsigned char*)aData->bytes + aRange.position,
|
||||
aRange.count);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,13 +241,17 @@ WMData*
|
||||
WMGetSubdataWithRange(WMData *aData, WMRange aRange) /*FOLD00*/
|
||||
{
|
||||
void *buffer;
|
||||
WMData *newData;
|
||||
|
||||
/* return an empty subdata instead if aRange.count is 0 ? */
|
||||
wassertrv(aRange.count > 0, NULL);
|
||||
if (aRange.count <= 0)
|
||||
return WMCreateDataWithCapacity(0);
|
||||
|
||||
buffer = wmalloc(aRange.count);
|
||||
WMGetDataBytesWithRange(aData, buffer, aRange);
|
||||
return WMCreateDataWithBytesNoCopy(buffer, aRange.count);
|
||||
newData = WMCreateDataWithBytesNoCopy(buffer, aRange.count, wfree);
|
||||
newData->format = aData->format;
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
||||
@@ -249,20 +277,12 @@ WMGetDataLength(WMData *aData) /*FOLD00*/
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
WMGetDataHash(WMData *aData) /*FOLD00*/
|
||||
{
|
||||
return aData->length;
|
||||
}
|
||||
|
||||
|
||||
/* Adding data */
|
||||
void
|
||||
WMAppendDataBytes(WMData *aData, void *bytes, unsigned length) /*FOLD00*/
|
||||
{
|
||||
unsigned oldLength = aData->length;
|
||||
unsigned newLength = oldLength + length;
|
||||
unsigned char *dataBytes = (unsigned char *)aData->bytes;
|
||||
|
||||
if (newLength > aData->capacity) {
|
||||
unsigned nextCapacity = aData->capacity + aData->growth;
|
||||
@@ -277,7 +297,7 @@ WMAppendDataBytes(WMData *aData, void *bytes, unsigned length) /*FOLD00*/
|
||||
WMSetDataCapacity(aData, nextCapacity);
|
||||
aData->growth = nextGrowth;
|
||||
}
|
||||
memcpy(dataBytes + oldLength, bytes, length);
|
||||
memcpy((unsigned char*)aData->bytes + oldLength, bytes, length);
|
||||
aData->length = newLength;
|
||||
}
|
||||
|
||||
@@ -296,24 +316,20 @@ WMAppendData(WMData *aData, WMData *anotherData) /*FOLD00*/
|
||||
void
|
||||
WMReplaceDataBytesInRange(WMData *aData, WMRange aRange, void *bytes) /*FOLD00*/
|
||||
{
|
||||
unsigned char *dataBytes = (unsigned char *)aData->bytes;
|
||||
|
||||
wassertr(aRange.position < aData->length);
|
||||
wassertr(aRange.count <= aData->length-aRange.position);
|
||||
|
||||
memcpy(dataBytes + aRange.position, bytes, aRange.count);
|
||||
memcpy((unsigned char*)aData->bytes + aRange.position, bytes, aRange.count);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMResetDataBytesInRange(WMData *aData, WMRange aRange) /*FOLD00*/
|
||||
{
|
||||
unsigned char *dataBytes = (unsigned char *)aData->bytes;
|
||||
|
||||
wassertr(aRange.position < aData->length);
|
||||
wassertr(aRange.count <= aData->length-aRange.position);
|
||||
|
||||
memset(dataBytes + aRange.position, 0, aRange.count);
|
||||
memset((unsigned char*)aData->bytes + aRange.position, 0, aRange.count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -48,24 +48,17 @@ W_SetXdndAwareProperty(WMScreen *scr, WMView *view, Atom *types, int typeCount)
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char*)&XDNDversion, 1);
|
||||
} else {
|
||||
WMAddNotificationObserver(realizedObserver, view,
|
||||
WMViewRealizedNotification,
|
||||
WMAddNotificationObserver(realizedObserver,
|
||||
/* just use as an id */
|
||||
view->dragDestinationProcs);
|
||||
&view->dragDestinationProcs,
|
||||
WMViewRealizedNotification,
|
||||
view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WMData*
|
||||
WMGetDroppedData(WMView *view, WMDraggingInfo *info)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMRegisterViewForDraggedTypes(WMView *view, char *acceptedTypes[])
|
||||
{
|
||||
@@ -94,25 +87,136 @@ void
|
||||
WMUnregisterViewDraggedTypes(WMView *view)
|
||||
{
|
||||
if (view->droppableTypes != NULL)
|
||||
free(view->droppableTypes);
|
||||
wfree(view->droppableTypes);
|
||||
view->droppableTypes = NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
static unsigned defDraggingEntered(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
printf("%x drag entered\n", W_VIEW_DRAWABLE(self));
|
||||
return WDOperationNone;
|
||||
}
|
||||
|
||||
static unsigned defDraggingUpdated(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
printf("%x drag updat\n", W_VIEW_DRAWABLE(self));
|
||||
return WDOperationNone;
|
||||
}
|
||||
|
||||
static void defDraggingExited(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
printf("%x drag exit\n", W_VIEW_DRAWABLE(self));
|
||||
}
|
||||
|
||||
static Bool defPrepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
printf("%x drag prep\n", W_VIEW_DRAWABLE(self));
|
||||
return False;
|
||||
}
|
||||
|
||||
static Bool defPerformDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
printf("%x drag perf\n", W_VIEW_DRAWABLE(self));
|
||||
return False;
|
||||
}
|
||||
|
||||
static void defConcludeDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
printf("%x drag concl\n", W_VIEW_DRAWABLE(self));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs)
|
||||
{
|
||||
if (view->dragDestinationProcs == NULL) {
|
||||
free(view->dragDestinationProcs);
|
||||
view->dragDestinationProcs = wmalloc(sizeof(WMDragDestinationProcs));
|
||||
} else {
|
||||
free(view->dragDestinationProcs);
|
||||
}
|
||||
*view->dragDestinationProcs = *procs;
|
||||
|
||||
/*XXX fill in non-implemented stuffs */
|
||||
if (procs->draggingEntered == NULL) {
|
||||
view->dragDestinationProcs->draggingEntered = defDraggingEntered;
|
||||
}
|
||||
if (procs->draggingUpdated == NULL) {
|
||||
view->dragDestinationProcs->draggingUpdated = defDraggingUpdated;
|
||||
}
|
||||
if (procs->draggingExited == NULL) {
|
||||
view->dragDestinationProcs->draggingExited = defDraggingExited;
|
||||
}
|
||||
if (procs->prepareForDragOperation == NULL) {
|
||||
view->dragDestinationProcs->prepareForDragOperation =
|
||||
defPrepareForDragOperation;
|
||||
}
|
||||
if (procs->performDragOperation == NULL) {
|
||||
view->dragDestinationProcs->performDragOperation =
|
||||
defPerformDragOperation;
|
||||
}
|
||||
if (procs->concludeDragOperation == NULL) {
|
||||
view->dragDestinationProcs->concludeDragOperation =
|
||||
defConcludeDragOperation;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
WMPoint WMGetDraggingInfoImageLocation(WMDraggingInfo *info)
|
||||
{
|
||||
return info->imageLocation;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
receivedData(WMView *view, Atom selection, Atom target, Time timestamp,
|
||||
void *cdata, WMData *data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bool WMRequestDroppedData(WMView *view, WMDraggingInfo *info, char *type,
|
||||
WMDropDataCallback *callback)
|
||||
{
|
||||
#if 0
|
||||
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||
if (info->finished) {
|
||||
return False;
|
||||
}
|
||||
|
||||
if (type != NULL) {
|
||||
if (!WMRequestSelection(scr->dragInfo.destView,
|
||||
scr->xdndSelectionAtom,
|
||||
XInternAtom(scr->display, type, False),
|
||||
scr->dragInfo.timestamp,
|
||||
receivedData, &scr->dragInfo)) {
|
||||
wwarning("could not request data for dropped data");
|
||||
|
||||
/* send finished message */
|
||||
sendClientMessage(scr->display, source,
|
||||
scr->xdndFinishedAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
} else {
|
||||
/* send finished message */
|
||||
sendClientMessage(scr->display, source,
|
||||
scr->xdndFinishedAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
0, 0, 0, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,35 +1,79 @@
|
||||
|
||||
#include "../src/config.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#ifdef SHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
|
||||
|
||||
|
||||
#define SPIT(a) puts(a)
|
||||
#define SPIT(a)
|
||||
|
||||
|
||||
#define IS_DROPPABLE(view) (view!=NULL && view->droppableTypes!=NULL && \
|
||||
view->dragDestinationProcs!=NULL)
|
||||
|
||||
|
||||
static Atom operationToAction(WMScreen *scr, WMDragOperationType operation);
|
||||
static WMDragOperationType actionToOperation(WMScreen *scr, Atom action);
|
||||
|
||||
static Bool _XErrorOccured = False;
|
||||
|
||||
|
||||
|
||||
static unsigned defDraggingSourceOperation(WMView *self, Bool local)
|
||||
{
|
||||
return WDOperationCopy;
|
||||
}
|
||||
|
||||
|
||||
static void defBeganDragImage(WMView *self, WMPixmap *image, WMPoint point)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void defEndedDragImage(WMView *self, WMPixmap *image, WMPoint point,
|
||||
Bool deposited)
|
||||
{
|
||||
}
|
||||
|
||||
static WMData* defFetchDragData(WMView *self, char *type)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetViewDragSourceProcs(WMView *view, WMDragSourceProcs *procs)
|
||||
{
|
||||
if (view->dragSourceProcs)
|
||||
free(view->dragSourceProcs);
|
||||
wfree(view->dragSourceProcs);
|
||||
view->dragSourceProcs = wmalloc(sizeof(WMDragSourceProcs));
|
||||
|
||||
*view->dragSourceProcs = *procs;
|
||||
|
||||
/* XXX fill in non-implemented stuffs */
|
||||
if (procs->draggingSourceOperation == NULL) {
|
||||
view->dragSourceProcs->draggingSourceOperation = defDraggingSourceOperation;
|
||||
}
|
||||
if (procs->beganDragImage == NULL) {
|
||||
view->dragSourceProcs->beganDragImage = defBeganDragImage;
|
||||
}
|
||||
if (procs->endedDragImage == NULL) {
|
||||
view->dragSourceProcs->endedDragImage = defEndedDragImage;
|
||||
}
|
||||
if (procs->fetchDragData == NULL) {
|
||||
view->dragSourceProcs->fetchDragData = defFetchDragData;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +131,7 @@ makeDragIcon(WMScreen *scr, WMPixmap *pixmap)
|
||||
|
||||
#ifdef SHAPE
|
||||
if (mask) {
|
||||
XShapeCombineMask(dpy, scr->balloon->window, ShapeBounding, 0, 0, mask,
|
||||
XShapeCombineMask(scr->display, window, ShapeBounding, 0, 0, mask,
|
||||
ShapeSet);
|
||||
}
|
||||
#endif
|
||||
@@ -144,15 +188,16 @@ findChildInWindow(Display *dpy, Window toplevel, int x, int y)
|
||||
&& attr.map_state == IsViewable
|
||||
&& x >= attr.x && y >= attr.y
|
||||
&& x < attr.x + attr.width && y < attr.y + attr.height) {
|
||||
Window child;
|
||||
Window child, tmp;
|
||||
|
||||
child = findChildInWindow(dpy, children[i],
|
||||
x - attr.x, y - attr.y);
|
||||
tmp = children[i];
|
||||
|
||||
child = findChildInWindow(dpy, tmp, x - attr.x, y - attr.y);
|
||||
|
||||
XFree(children);
|
||||
|
||||
if (child == None)
|
||||
return toplevel;
|
||||
return tmp;
|
||||
else
|
||||
return child;
|
||||
}
|
||||
@@ -170,11 +215,12 @@ findViewInToplevel(Display *dpy, Window toplevel, int x, int y)
|
||||
|
||||
child = findChildInWindow(dpy, toplevel, x, y);
|
||||
|
||||
if (child != None)
|
||||
if (child != None) {
|
||||
return W_GetViewForXWindow(dpy, child);
|
||||
else
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -215,8 +261,6 @@ lookForToplevel(WMScreen *scr, Window window, Bool *isAware)
|
||||
}
|
||||
|
||||
XFree(children);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return toplevel;
|
||||
@@ -317,13 +361,7 @@ sendClientMessage(Display *dpy, Window win, Atom message,
|
||||
static unsigned
|
||||
notifyPosition(WMScreen *scr, WMDraggingInfo *info)
|
||||
{
|
||||
unsigned operation;
|
||||
|
||||
switch (info->sourceOperation) {
|
||||
default:
|
||||
operation = None;
|
||||
break;
|
||||
}
|
||||
Atom action = operationToAction(scr, info->sourceOperation);
|
||||
|
||||
sendClientMessage(scr->display, info->destinationWindow,
|
||||
scr->xdndPositionAtom,
|
||||
@@ -331,7 +369,7 @@ notifyPosition(WMScreen *scr, WMDraggingInfo *info)
|
||||
0, /* reserved */
|
||||
info->location.x<<16|info->location.y,
|
||||
info->timestamp,
|
||||
operation/* operation */);
|
||||
action/* operation */);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -388,29 +426,26 @@ translateCoordinates(WMScreen *scr, Window target, int fromX, int fromY,
|
||||
|
||||
|
||||
static void
|
||||
updateDraggingInfo(WMScreen *scr, WMDraggingInfo *info,
|
||||
updateDraggingInfo(WMScreen *scr, WMDraggingInfo *info, WMSize offset,
|
||||
XEvent *event, Window iconWindow)
|
||||
{
|
||||
Window toplevel;
|
||||
WMSize size;
|
||||
|
||||
size = WMGetPixmapSize(info->image);
|
||||
|
||||
if (event->type == MotionNotify) {
|
||||
info->imageLocation.x = event->xmotion.x_root-(int)size.width/2;
|
||||
info->imageLocation.y = event->xmotion.y_root-(int)size.height/2;
|
||||
info->imageLocation.x = event->xmotion.x_root-offset.width;
|
||||
info->imageLocation.y = event->xmotion.y_root-offset.height;
|
||||
|
||||
info->location.x = event->xmotion.x_root;
|
||||
info->location.y = event->xmotion.y_root;
|
||||
info->timestamp = event->xmotion.time;
|
||||
/* info->timestamp = event->xmotion.time;*/
|
||||
|
||||
} else if (event->type == ButtonRelease) {
|
||||
info->imageLocation.x = event->xbutton.x_root-(int)size.width/2;
|
||||
info->imageLocation.y = event->xbutton.y_root-(int)size.height/2;
|
||||
info->imageLocation.x = event->xbutton.x_root-offset.width;
|
||||
info->imageLocation.y = event->xbutton.y_root-offset.height;
|
||||
|
||||
info->location.x = event->xbutton.x_root;
|
||||
info->location.y = event->xbutton.y_root;
|
||||
info->timestamp = event->xbutton.time;
|
||||
/* info->timestamp = event->xbutton.time;*/
|
||||
}
|
||||
|
||||
toplevel = findToplevelUnderDragPointer(scr,
|
||||
@@ -418,34 +453,6 @@ updateDraggingInfo(WMScreen *scr, WMDraggingInfo *info,
|
||||
info->location.y,
|
||||
iconWindow);
|
||||
info->destinationWindow = toplevel;
|
||||
/*
|
||||
if (toplevel == None) {
|
||||
info->destinationWindow = None;
|
||||
} else if (toplevel == scr->rootWin) {
|
||||
info->destinationWindow = scr->rootWin;
|
||||
} else {
|
||||
Window child;
|
||||
int x, y;
|
||||
|
||||
XTranslateCoordinates(scr->display, scr->rootWin, toplevel,
|
||||
info->location.x, info->location.y,
|
||||
&x, &y, &child);
|
||||
|
||||
child = findChildInWindow(scr->display, toplevel, x, y);
|
||||
|
||||
if (child != None) {
|
||||
info->destination = W_GetViewForXWindow(scr->display, child);
|
||||
if (info->destination->droppableTypes == NULL) {
|
||||
info->destination = NULL;
|
||||
} else if (info->destination->dragDestinationProcs == NULL) {
|
||||
info->destination = NULL;
|
||||
}
|
||||
} else {
|
||||
info->destination = NULL;
|
||||
}
|
||||
info->destinationWindow = toplevel;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -503,36 +510,105 @@ processMotion(WMScreen *scr, WMDraggingInfo *info, WMDraggingInfo *oldInfo,
|
||||
rect->size.width = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* little trick to simulate XdndStatus for local dnd */
|
||||
/*
|
||||
if (bla && action != currentAction) {
|
||||
XEvent ev;
|
||||
|
||||
ev.type = ClientMessage;
|
||||
ev.xclient.display = scr->display;
|
||||
ev.xclient.message_type = scr->xdndStatusAtom;
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.window = info->destinationWindow;
|
||||
ev.xclient.data.l[0] = info->sourceWindow;
|
||||
ev.xclient.data.l[1] = (action ? 1 : 0);
|
||||
ev.xclient.data.l[2] = 0;
|
||||
ev.xclient.data.l[3] = 0;
|
||||
ev.xclient.data.l[4] = action;
|
||||
|
||||
XPutBackEvent(scr->display, &ev);
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
static WMData*
|
||||
convertSelection(WMView *view, Atom selection, Atom target,
|
||||
void *cdata, Atom *type)
|
||||
{
|
||||
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||
WMData *data;
|
||||
char *typeName = XGetAtomName(scr->display, target);
|
||||
|
||||
*type = target;
|
||||
|
||||
data = view->dragSourceProcs->fetchDragData(view, typeName);
|
||||
|
||||
if (typeName != NULL)
|
||||
XFree(typeName);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
selectionLost(WMView *view, Atom selection, void *cdata)
|
||||
{
|
||||
if (W_VIEW_SCREEN(view)->dragSourceView == view) {
|
||||
wwarning("DND selection lost during drag operation...");
|
||||
W_VIEW_SCREEN(view)->dragSourceView = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
selectionDone(WMView *view, Atom selection, Atom target, void *cdata)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
setMouseOffsetHint(WMView *view, WMSize mouseOffset)
|
||||
{
|
||||
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||
long hint[2];
|
||||
|
||||
/*
|
||||
* Tell the offset from the topleft corner of the icon being
|
||||
* dragged. Not from XDND, but it's backwards compatible.
|
||||
*/
|
||||
|
||||
hint[0] = mouseOffset.width;
|
||||
hint[1] = mouseOffset.height;
|
||||
|
||||
XChangeProperty(scr->display, W_VIEW_DRAWABLE(view),
|
||||
scr->wmIconDragOffsetAtom, XA_INTEGER, 32,
|
||||
PropModeReplace, (unsigned char*)hint, 2);
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
getMouseOffsetHint(WMScreen *scr, Window source, WMSize *mouseOffset)
|
||||
{
|
||||
long *hint;
|
||||
Atom type_ret;
|
||||
int fmt_ret;
|
||||
unsigned long nitems_ret, bytes_after_ret;
|
||||
Bool ok = False;
|
||||
|
||||
|
||||
hint = NULL;
|
||||
|
||||
XGetWindowProperty(scr->display, source,
|
||||
scr->wmIconDragOffsetAtom, 0, 2, False, XA_INTEGER,
|
||||
&type_ret, &fmt_ret, &nitems_ret, &bytes_after_ret,
|
||||
(unsigned char **)&hint);
|
||||
|
||||
if (hint && nitems_ret == 2) {
|
||||
mouseOffset->width = hint[0];
|
||||
mouseOffset->height = hint[1];
|
||||
ok = True;
|
||||
}
|
||||
if (hint)
|
||||
XFree(hint);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
timeoutCallback(void *data)
|
||||
{
|
||||
wwarning("drag & drop timed out while waiting for response from 0x%x\n",
|
||||
(unsigned)data);
|
||||
_XErrorOccured = 1;
|
||||
_XErrorOccured = 2;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -581,9 +657,9 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
{
|
||||
WMScreen *scr = view->screen;
|
||||
Display *dpy = scr->display;
|
||||
WMView *toplevel = W_TopLevelOfView(view);
|
||||
Window icon;
|
||||
XEvent ev;
|
||||
WMSize size;
|
||||
WMRect rect = {{0,0},{0,0}};
|
||||
int ostate = -1;
|
||||
int state;
|
||||
@@ -594,9 +670,16 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
WMDraggingInfo dragInfo;
|
||||
WMDraggingInfo oldDragInfo;
|
||||
WMHandlerID timer = NULL;
|
||||
WMData *draggedData = NULL;
|
||||
static WMSelectionProcs handler = {
|
||||
convertSelection,
|
||||
selectionLost,
|
||||
selectionDone
|
||||
};
|
||||
|
||||
|
||||
if (scr->dragSourceView != NULL)
|
||||
return;
|
||||
|
||||
wassertr(view->dragSourceProcs != NULL);
|
||||
|
||||
|
||||
@@ -604,40 +687,48 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
if (image == NULL)
|
||||
image = scr->defaultObjectIcon;
|
||||
|
||||
size = WMGetPixmapSize(image);
|
||||
|
||||
icon = makeDragIcon(scr, image);
|
||||
|
||||
XMoveWindow(dpy, icon, event->xmotion.x_root-(int)size.width/2,
|
||||
event->xmotion.y_root-(int)size.height/2);
|
||||
XMoveWindow(dpy, icon, atLocation.x, atLocation.y);
|
||||
XMapRaised(dpy, icon);
|
||||
|
||||
|
||||
/* init dragging info */
|
||||
|
||||
scr->dragSourceView = view;
|
||||
|
||||
memset(&dragInfo, 0, sizeof(WMDraggingInfo));
|
||||
memset(&oldDragInfo, 0, sizeof(WMDraggingInfo));
|
||||
dragInfo.image = image;
|
||||
dragInfo.sourceWindow = W_VIEW_DRAWABLE(W_TopLevelOfView(view));
|
||||
dragInfo.sourceView = view;
|
||||
dragInfo.sourceWindow = W_VIEW_DRAWABLE(toplevel);
|
||||
|
||||
dragInfo.destinationWindow = dragInfo.sourceWindow;
|
||||
|
||||
dragInfo.location.x = event->xmotion.x_root;
|
||||
dragInfo.location.y = event->xmotion.y_root;
|
||||
dragInfo.location.x = atLocation.x + mouseOffset.width;
|
||||
dragInfo.location.y = atLocation.y + mouseOffset.height;
|
||||
dragInfo.imageLocation = atLocation;
|
||||
|
||||
|
||||
/* start pointer grab */
|
||||
XGrabPointer(dpy, scr->rootWin, False,
|
||||
ButtonPressMask|ButtonReleaseMask|ButtonMotionMask,
|
||||
GrabModeSync, GrabModeAsync, None, scr->defaultCursor,
|
||||
GrabModeAsync, GrabModeAsync, None, scr->defaultCursor,
|
||||
CurrentTime);
|
||||
|
||||
XFlush(dpy);
|
||||
|
||||
_XErrorOccured = False;
|
||||
|
||||
/* XXX: take ownership of XdndSelection */
|
||||
/* take ownership of XdndSelection */
|
||||
if (!WMCreateSelectionHandler(view, scr->xdndSelectionAtom,
|
||||
event->xmotion.time,
|
||||
&handler, NULL)) {
|
||||
wwarning("could not get ownership or DND selection");
|
||||
return;
|
||||
}
|
||||
|
||||
setMouseOffsetHint(toplevel, mouseOffset);
|
||||
|
||||
if (view->dragSourceProcs->beganDragImage != NULL) {
|
||||
view->dragSourceProcs->beganDragImage(view, image, atLocation);
|
||||
@@ -648,7 +739,6 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
state = 1;
|
||||
|
||||
while (state != 6 && state != 0 && !_XErrorOccured) {
|
||||
XAllowEvents(dpy, SyncPointer, CurrentTime);
|
||||
WMNextEvent(dpy, &ev);
|
||||
|
||||
switch (ev.type) {
|
||||
@@ -660,14 +750,13 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
|
||||
oldDragInfo = dragInfo;
|
||||
|
||||
updateDraggingInfo(scr, &dragInfo, &ev, icon);
|
||||
updateDraggingInfo(scr, &dragInfo, mouseOffset, &ev, icon);
|
||||
|
||||
XMoveWindow(dpy, icon, dragInfo.imageLocation.x,
|
||||
dragInfo.imageLocation.y);
|
||||
|
||||
if (state != 2) {
|
||||
processMotion(scr, &dragInfo, &oldDragInfo, &rect, action);
|
||||
}
|
||||
|
||||
protectBlock(False);
|
||||
|
||||
/* XXXif entered a different destination, check the operation */
|
||||
@@ -675,6 +764,7 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
switch (state) {
|
||||
case 1:
|
||||
if (oldDragInfo.destinationWindow != None
|
||||
&& oldDragInfo.destinationWindow != scr->rootWin
|
||||
&& (dragInfo.destinationWindow == None
|
||||
|| dragInfo.destinationWindow == scr->rootWin)) {
|
||||
/* left the droppable window */
|
||||
@@ -684,7 +774,9 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (dragInfo.destinationWindow != None) {
|
||||
if (dragInfo.destinationWindow != None
|
||||
&& dragInfo.destinationWindow != scr->rootWin) {
|
||||
|
||||
state = 1;
|
||||
action = -1;
|
||||
}
|
||||
@@ -693,6 +785,7 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
case 3:
|
||||
case 4:
|
||||
if (oldDragInfo.destinationWindow != None
|
||||
&& oldDragInfo.destinationWindow != scr->rootWin
|
||||
&& (dragInfo.destinationWindow == None
|
||||
|| dragInfo.destinationWindow == scr->rootWin)) {
|
||||
/* left the droppable window */
|
||||
@@ -712,13 +805,18 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
|
||||
oldDragInfo = dragInfo;
|
||||
|
||||
updateDraggingInfo(scr, &dragInfo, &ev, icon);
|
||||
updateDraggingInfo(scr, &dragInfo, mouseOffset, &ev, icon);
|
||||
|
||||
XMoveWindow(dpy, icon, dragInfo.imageLocation.x,
|
||||
dragInfo.imageLocation.y);
|
||||
|
||||
processMotion(scr, &dragInfo, &oldDragInfo, &rect,
|
||||
action);
|
||||
if (state == 4 || state == 1) {
|
||||
dragInfo.destinationWindow = None;
|
||||
dragInfo.destView = NULL;
|
||||
}
|
||||
processMotion(scr, &dragInfo, &oldDragInfo, &rect, action);
|
||||
|
||||
dragInfo.timestamp = ev.xbutton.time;
|
||||
|
||||
protectBlock(False);
|
||||
|
||||
@@ -741,20 +839,13 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case SelectionRequest:
|
||||
|
||||
draggedData = NULL;
|
||||
|
||||
break;
|
||||
|
||||
case ClientMessage:
|
||||
if ((state == 1 || state == 3 || state == 4 || state == 5)
|
||||
&& ev.xclient.message_type == scr->xdndStatusAtom
|
||||
&& ev.xclient.window == dragInfo.destinationWindow) {
|
||||
&& ev.xclient.data.l[0] == dragInfo.destinationWindow) {
|
||||
|
||||
if (ev.xclient.data.l[1] & 1) {
|
||||
puts("got accept msg");
|
||||
SPIT("got accept msg");
|
||||
/* will accept drop */
|
||||
switch (state) {
|
||||
case 1:
|
||||
@@ -770,13 +861,9 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
state = 6;
|
||||
break;
|
||||
}
|
||||
if (ev.xclient.data.l[4] == None) {
|
||||
action = 0;
|
||||
action = actionToOperation(scr, ev.xclient.data.l[4]);
|
||||
} else {
|
||||
action = ev.xclient.data.l[4];/*XXX*/
|
||||
}
|
||||
} else {
|
||||
puts("got reject msg");
|
||||
SPIT("got reject msg");
|
||||
switch (state) {
|
||||
case 1:
|
||||
case 3:
|
||||
@@ -825,7 +912,6 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
}
|
||||
|
||||
if (ostate != state) {
|
||||
printf("state changed to %i\n", state);
|
||||
if (state == 3) {
|
||||
XRecolorCursor(dpy, scr->defaultCursor, &green, &back);
|
||||
} else if (ostate == 3) {
|
||||
@@ -838,6 +924,9 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
if (timer) {
|
||||
WMDeleteTimerHandler(timer);
|
||||
timer = NULL;
|
||||
} else if (_XErrorOccured) {
|
||||
/* got a timeout, send leave */
|
||||
notifyDragLeave(scr, &dragInfo);
|
||||
}
|
||||
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
@@ -859,22 +948,17 @@ WMDragImageFromView(WMView *view, WMPixmap *image, char *dataTypes[],
|
||||
|
||||
|
||||
SPIT("dropped");
|
||||
/* wait for Finished message and SelectionRequest if not a local drop */
|
||||
|
||||
|
||||
|
||||
XDestroyWindow(dpy, icon);
|
||||
if (view->dragSourceProcs->endedDragImage != NULL) {
|
||||
view->dragSourceProcs->endedDragImage(view, image,
|
||||
dragInfo.imageLocation,
|
||||
True);
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
cancelled:
|
||||
if (draggedData) {
|
||||
WMReleaseData(draggedData);
|
||||
}
|
||||
scr->dragSourceView = NULL;
|
||||
|
||||
WMDeleteSelectionHandler(view, scr->xdndSelectionAtom,
|
||||
event->xmotion.time);
|
||||
|
||||
if (slideBack) {
|
||||
slideWindow(dpy, icon,
|
||||
@@ -900,6 +984,65 @@ cancelled:
|
||||
|
||||
|
||||
|
||||
static Atom
|
||||
operationToAction(WMScreen *scr, WMDragOperationType operation)
|
||||
{
|
||||
switch (operation) {
|
||||
case WDOperationNone:
|
||||
return None;
|
||||
|
||||
case WDOperationCopy:
|
||||
return scr->xdndActionCopy;
|
||||
|
||||
case WDOperationMove:
|
||||
return scr->xdndActionMove;
|
||||
|
||||
case WDOperationLink:
|
||||
return scr->xdndActionLink;
|
||||
|
||||
case WDOperationAsk:
|
||||
return scr->xdndActionAsk;
|
||||
|
||||
case WDOperationPrivate:
|
||||
return scr->xdndActionPrivate;
|
||||
|
||||
default:
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static WMDragOperationType
|
||||
actionToOperation(WMScreen *scr, Atom action)
|
||||
{
|
||||
if (action == scr->xdndActionCopy) {
|
||||
return WDOperationCopy;
|
||||
|
||||
} else if (action == scr->xdndActionMove) {
|
||||
return WDOperationMove;
|
||||
|
||||
} else if (action == scr->xdndActionLink) {
|
||||
return WDOperationLink;
|
||||
|
||||
} else if (action == scr->xdndActionAsk) {
|
||||
return WDOperationAsk;
|
||||
|
||||
} else if (action == scr->xdndActionPrivate) {
|
||||
return WDOperationPrivate;
|
||||
|
||||
} else if (action == None) {
|
||||
|
||||
return WDOperationCopy;
|
||||
} else {
|
||||
char *tmp = XGetAtomName(scr->display, action);
|
||||
|
||||
wwarning("unknown XDND action %s from 0x%x", tmp,
|
||||
(unsigned)scr->dragInfo.sourceWindow);
|
||||
XFree(tmp);
|
||||
|
||||
return WDOperationCopy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -934,20 +1077,84 @@ getTypeList(Window window, XClientMessageEvent *event)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define DISPATCH(view, func, info) (view)->dragDestinationProcs->func(view, info)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
receivedData(WMView *view, Atom selection, Atom target,
|
||||
Time timestamp, void *cdata, WMData *data)
|
||||
{
|
||||
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||
WMDraggingInfo *info = (WMDraggingInfo*)cdata;
|
||||
Bool res;
|
||||
|
||||
res = view->dragDestinationProcs->performDragOperation(view, info);
|
||||
|
||||
if (res) {
|
||||
DISPATCH(view, concludeDragOperation, info);
|
||||
}
|
||||
|
||||
/* send finished message */
|
||||
sendClientMessage(scr->display, info->sourceWindow,
|
||||
scr->xdndFinishedAtom,
|
||||
info->destinationWindow,
|
||||
0, 0, 0, 0);
|
||||
|
||||
memset(&scr->dragInfo, 0, sizeof(WMDraggingInfo));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
||||
{
|
||||
#if 0
|
||||
WMScreen *scr = W_VIEW_SCREEN(toplevel);
|
||||
WMView *oldView = NULL, *newView = NULL;
|
||||
WMView *oldView = NULL;
|
||||
WMView *newView = NULL;
|
||||
unsigned operation = 0;
|
||||
int x, y;
|
||||
enum {
|
||||
WNothing,
|
||||
WEnter,
|
||||
WLeave,
|
||||
WCross, /* leave one and enter another */
|
||||
WUpdate,
|
||||
WDrop
|
||||
};
|
||||
Window source;
|
||||
int what = WNothing;
|
||||
Bool sendStatus = False;
|
||||
|
||||
|
||||
source = scr->dragInfo.sourceWindow;
|
||||
oldView = scr->dragInfo.destView;
|
||||
|
||||
if (event->message_type == scr->xdndFinishedAtom) {
|
||||
WMView *view = scr->dragSourceView;
|
||||
|
||||
WMDeleteSelectionHandler(view, scr->xdndSelectionAtom,
|
||||
scr->dragInfo.timestamp);
|
||||
|
||||
if (view->dragSourceProcs->endedDragImage != NULL) {
|
||||
view->dragSourceProcs->endedDragImage(view,
|
||||
scr->dragInfo.image,
|
||||
scr->dragInfo.imageLocation,
|
||||
True);
|
||||
}
|
||||
|
||||
scr->dragSourceView = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (event->message_type == scr->xdndEnterAtom) {
|
||||
Window foo, bar;
|
||||
int bla;
|
||||
unsigned ble;
|
||||
puts("entered");
|
||||
|
||||
if (scr->dragInfo.sourceWindow != None) {
|
||||
puts("received Enter event in bad order");
|
||||
@@ -956,16 +1163,18 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
||||
memset(&scr->dragInfo, 0, sizeof(WMDraggingInfo));
|
||||
|
||||
|
||||
if ((event->data.l[0] >> 24) > XDND_VERSION) {
|
||||
if ((event->data.l[1] >> 24) > XDND_VERSION) {
|
||||
wwarning("received drag & drop request with unsupported version %i",
|
||||
(event->data.l[0] >> 24));
|
||||
(event->data.l[1] >> 24));
|
||||
return;
|
||||
}
|
||||
|
||||
scr->dragInfo.protocolVersion = event->data.l[1] >> 24;
|
||||
scr->dragInfo.sourceWindow = event->data.l[0];
|
||||
scr->dragInfo.sourceWindow = source = event->data.l[0];
|
||||
scr->dragInfo.destinationWindow = event->window;
|
||||
|
||||
getMouseOffsetHint(scr, source, &scr->dragInfo.mouseOffset);
|
||||
|
||||
/* XXX */
|
||||
scr->dragInfo.image = NULL;
|
||||
|
||||
@@ -973,6 +1182,10 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
||||
&scr->dragInfo.location.x, &scr->dragInfo.location.y,
|
||||
&bla, &bla, &ble);
|
||||
|
||||
scr->dragInfo.imageLocation = scr->dragInfo.location;
|
||||
scr->dragInfo.imageLocation.x -= scr->dragInfo.mouseOffset.width;
|
||||
scr->dragInfo.imageLocation.y -= scr->dragInfo.mouseOffset.height;
|
||||
|
||||
translateCoordinates(scr, scr->dragInfo.destinationWindow,
|
||||
scr->dragInfo.location.x,
|
||||
scr->dragInfo.location.y, &x, &y);
|
||||
@@ -982,102 +1195,137 @@ W_HandleDNDClientMessage(WMView *toplevel, XClientMessageEvent *event)
|
||||
scr->dragInfo.destinationWindow,
|
||||
x, y);
|
||||
|
||||
if (IS_DROPPABLE(view)) {
|
||||
|
||||
scr->dragInfo.destinationView = view;
|
||||
|
||||
operation =
|
||||
view->dragDestinationProcs->draggingEntered(view,
|
||||
&scr->dragInfo);
|
||||
}
|
||||
if (operation > 0) {
|
||||
Atom action;
|
||||
|
||||
switch (operation) {
|
||||
default:
|
||||
action = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
sendClientMessage(scr->display, scr->dragInfo.sourceWindow,
|
||||
scr->xdndStatusAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
1, 0, 0, action);
|
||||
}
|
||||
|
||||
} else if (event->message_type == scr->xdndPositionAtom
|
||||
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
||||
|
||||
scr->dragInfo.location.x = event->data.l[2] >> 16;
|
||||
scr->dragInfo.location.y = event->data.l[2] & 0xffff;
|
||||
|
||||
scr->dragInfo.imageLocation = scr->dragInfo.location;
|
||||
scr->dragInfo.imageLocation.x -= scr->dragInfo.mouseOffset.width;
|
||||
scr->dragInfo.imageLocation.y -= scr->dragInfo.mouseOffset.height;
|
||||
|
||||
if (scr->dragInfo.protocolVersion >= 1) {
|
||||
scr->dragInfo.timestamp = event->data.l[3];
|
||||
scr->dragInfo.sourceOperation = event->data.l[4];
|
||||
scr->dragInfo.sourceOperation = actionToOperation(scr,
|
||||
event->data.l[4]);
|
||||
|
||||
} else {
|
||||
scr->dragInfo.timestamp = CurrentTime;
|
||||
scr->dragInfo.sourceOperation = 0; /*XXX*/
|
||||
scr->dragInfo.sourceOperation = WDOperationCopy;
|
||||
}
|
||||
|
||||
translateCoordinates(scr, scr->dragInfo.destinationWindow,
|
||||
scr->dragInfo.location.x,
|
||||
scr->dragInfo.location.y, &x, &y);
|
||||
|
||||
view = findViewInToplevel(scr->display,
|
||||
newView = findViewInToplevel(scr->display,
|
||||
scr->dragInfo.destinationWindow,
|
||||
x, y);
|
||||
|
||||
if (scr->dragInfo.destinationView != view) {
|
||||
WMView *oldVIew = scr->dragInfo.destinationView;
|
||||
|
||||
oldView->dragDestinationProcs->draggingExited(oldView,
|
||||
&scr->dragInfo);
|
||||
|
||||
scr->dragInfo.destinationView = NULL;
|
||||
}
|
||||
|
||||
|
||||
if (IS_DROPPABLE(view)) {
|
||||
|
||||
|
||||
operation =
|
||||
view->dragDestinationProcs->draggingUpdated(view,
|
||||
&scr->dragInfo);
|
||||
}
|
||||
|
||||
if (operation == 0) {
|
||||
sendClientMessage(scr->display, scr->dragInfo.sourceWindow,
|
||||
scr->xdndStatusAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
0, 0, 0, None);
|
||||
} else {
|
||||
Atom action;
|
||||
|
||||
switch (operation) {
|
||||
default:
|
||||
action = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
sendClientMessage(scr->display, scr->dragInfo.sourceWindow,
|
||||
scr->xdndStatusAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
1, 0, 0, action);
|
||||
}
|
||||
|
||||
} else if (event->message_type == scr->xdndLeaveAtom
|
||||
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
||||
|
||||
void (*draggingExited)(WMView *self, WMDraggingInfo *info);
|
||||
memset(&scr->dragInfo, 0, sizeof(WMDraggingInfo));
|
||||
|
||||
puts("leave");
|
||||
} else if (event->message_type == scr->xdndDropAtom
|
||||
&& scr->dragInfo.sourceWindow == event->data.l[0]) {
|
||||
|
||||
/* drop */
|
||||
if (oldView != NULL)
|
||||
what = WDrop;
|
||||
|
||||
|
||||
puts("drop");
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Now map the XDND events to WINGs events.
|
||||
*/
|
||||
|
||||
if (what == WNothing) {
|
||||
if (IS_DROPPABLE(newView)) {
|
||||
if (!IS_DROPPABLE(oldView)) { /* entered */
|
||||
what = WEnter;
|
||||
} else if (oldView == newView) { /* updated */
|
||||
what = WUpdate;
|
||||
} else {
|
||||
what = WCross;
|
||||
}
|
||||
} else {
|
||||
if (IS_DROPPABLE(oldView)) {
|
||||
what = WLeave;
|
||||
} else {
|
||||
/* just send rejection msg */
|
||||
sendStatus = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
switch (what) {
|
||||
|
||||
case WEnter:
|
||||
scr->dragInfo.destView = newView;
|
||||
operation = DISPATCH(newView, draggingEntered, &scr->dragInfo);
|
||||
sendStatus = True;
|
||||
break;
|
||||
|
||||
case WLeave:
|
||||
scr->dragInfo.destView = NULL;
|
||||
DISPATCH(oldView, draggingExited, &scr->dragInfo);
|
||||
sendStatus = True;
|
||||
operation = WDOperationNone;
|
||||
break;
|
||||
|
||||
case WCross:
|
||||
DISPATCH(oldView, draggingExited, &scr->dragInfo);
|
||||
scr->dragInfo.destView = newView;
|
||||
operation = DISPATCH(newView, draggingEntered, &scr->dragInfo);
|
||||
sendStatus = True;
|
||||
break;
|
||||
|
||||
case WUpdate:
|
||||
operation = DISPATCH(oldView, draggingUpdated, &scr->dragInfo);
|
||||
sendStatus = True;
|
||||
break;
|
||||
|
||||
case WDrop:
|
||||
{
|
||||
Bool res;
|
||||
|
||||
res = DISPATCH(oldView, prepareForDragOperation, &scr->dragInfo);
|
||||
|
||||
if (res) {
|
||||
res = DISPATCH(oldView, performDragOperation, &scr->dragInfo);
|
||||
}
|
||||
|
||||
if (res) {
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (sendStatus) {
|
||||
Atom action;
|
||||
|
||||
action = operationToAction(scr, operation);
|
||||
|
||||
sendClientMessage(scr->display, source,
|
||||
scr->xdndStatusAtom,
|
||||
scr->dragInfo.destinationWindow,
|
||||
action != None ? 1 : 0, 0, 0, action);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "../src/config.h"
|
||||
#include "wconfig.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -51,36 +51,36 @@ wstrerror(int errnum)
|
||||
if (errno < sys_nerr)
|
||||
return sys_errlist[errnum];
|
||||
|
||||
sprintf (buf, "Unknown error %d", errnum);
|
||||
sprintf (buf, _("Unknown error %d"), errnum);
|
||||
return buf;
|
||||
#else /* no strerror() and no sys_errlist[] */
|
||||
static char buf[] = "Error 12345678901234567890";
|
||||
|
||||
sprintf(buf, "Error %d", errnum);
|
||||
sprintf(buf, _("Error %d"), errnum);
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Prints a fatal error message with variable arguments and terminates
|
||||
/*********************************************************************
|
||||
* Prints a message with variable arguments
|
||||
*
|
||||
* msg - message to print with optional formatting
|
||||
* ... - arguments to use on formatting
|
||||
**************************************************************************/
|
||||
*********************************************************************/
|
||||
void
|
||||
wfatal(const char *msg, ...)
|
||||
wmessage(const char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[MAXLINE];
|
||||
|
||||
va_start(args, msg);
|
||||
|
||||
vsprintf(buf, msg, args);
|
||||
vsnprintf(buf, MAXLINE-3, msg, args);
|
||||
strcat(buf,"\n");
|
||||
fflush(stdout);
|
||||
fputs(_WINGS_progname, stderr);
|
||||
fputs(" fatal error: ",stderr);
|
||||
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
|
||||
fputs(": ",stderr);
|
||||
fputs(buf, stderr);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
@@ -103,11 +103,38 @@ wwarning(const char *msg, ...)
|
||||
|
||||
va_start(args, msg);
|
||||
|
||||
vsprintf(buf, msg, args);
|
||||
vsnprintf(buf, MAXLINE-3, msg, args);
|
||||
strcat(buf,"\n");
|
||||
fflush(stdout);
|
||||
fputs(_WINGS_progname, stderr);
|
||||
fputs(" warning: ",stderr);
|
||||
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
|
||||
fputs(_(" warning: "),stderr);
|
||||
fputs(buf, stderr);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Prints a fatal error message with variable arguments and terminates
|
||||
*
|
||||
* msg - message to print with optional formatting
|
||||
* ... - arguments to use on formatting
|
||||
**************************************************************************/
|
||||
void
|
||||
wfatal(const char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[MAXLINE];
|
||||
|
||||
va_start(args, msg);
|
||||
|
||||
vsnprintf(buf, MAXLINE-3, msg, args);
|
||||
strcat(buf,"\n");
|
||||
fflush(stdout);
|
||||
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
|
||||
fputs(_(" fatal error: "),stderr);
|
||||
fputs(buf, stderr);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
@@ -130,14 +157,14 @@ wsyserror(const char *msg, ...)
|
||||
int error=errno;
|
||||
|
||||
va_start(args, msg);
|
||||
vsprintf(buf, msg, args);
|
||||
vsnprintf(buf, MAXLINE-3, msg, args);
|
||||
fflush(stdout);
|
||||
fputs(_WINGS_progname, stderr);
|
||||
fputs(" error: ", stderr);
|
||||
strcat(buf, ": ");
|
||||
strcat(buf, wstrerror(error));
|
||||
strcat(buf,"\n");
|
||||
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
|
||||
fputs(_(" error: "), stderr);
|
||||
fputs(buf, stderr);
|
||||
fputs(": ", stderr);
|
||||
fputs(wstrerror(error), stderr);
|
||||
fputs("\n", stderr);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
va_end(args);
|
||||
@@ -159,14 +186,14 @@ wsyserrorwithcode(int error, const char *msg, ...)
|
||||
char buf[MAXLINE];
|
||||
|
||||
va_start(args, msg);
|
||||
vsprintf(buf, msg, args);
|
||||
vsnprintf(buf, MAXLINE-3, msg, args);
|
||||
fflush(stdout);
|
||||
fputs(_WINGS_progname, stderr);
|
||||
fputs(" error: ", stderr);
|
||||
strcat(buf, ": ");
|
||||
strcat(buf, wstrerror(error));
|
||||
strcat(buf,"\n");
|
||||
fputs(_WINGS_progname ? _WINGS_progname : "WINGs", stderr);
|
||||
fputs(_(" error: "), stderr);
|
||||
fputs(buf, stderr);
|
||||
fputs(": ", stderr);
|
||||
fputs(wstrerror(error), stderr);
|
||||
fputs("\n", stderr);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
va_end(args);
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "../src/config.h"
|
||||
#include "wconfig.h"
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
@@ -45,7 +45,7 @@ wgethomedir()
|
||||
|
||||
user = getpwuid(getuid());
|
||||
if (!user) {
|
||||
wsyserror("could not get password entry for UID %i", getuid());
|
||||
wsyserror(_("could not get password entry for UID %i"), getuid());
|
||||
return "/";
|
||||
}
|
||||
if (!user->pw_dir) {
|
||||
@@ -63,7 +63,7 @@ getuserhomedir(char *username)
|
||||
|
||||
user = getpwnam(username);
|
||||
if (!user) {
|
||||
wsyserror("could not get password entry for user %s", username);
|
||||
wsyserror(_("could not get password entry for user %s"), username);
|
||||
return NULL;
|
||||
}
|
||||
if (!user->pw_dir) {
|
||||
@@ -284,7 +284,7 @@ wfindfileinlist(char **path_list, char *file)
|
||||
|
||||
|
||||
char*
|
||||
wfindfileinarray(proplist_t array, char *file)
|
||||
wfindfileinarray(WMPropList *array, char *file)
|
||||
{
|
||||
int i;
|
||||
char *path;
|
||||
@@ -312,14 +312,14 @@ wfindfileinarray(proplist_t array, char *file)
|
||||
}
|
||||
|
||||
flen = strlen(file);
|
||||
for (i=0; i<PLGetNumberOfElements(array); i++) {
|
||||
proplist_t prop;
|
||||
for (i=0; i<WMGetPropListItemCount(array); i++) {
|
||||
WMPropList *prop;
|
||||
char *p;
|
||||
|
||||
prop = PLGetArrayElement(array, i);
|
||||
prop = WMGetFromPLArray(array, i);
|
||||
if (!prop)
|
||||
continue;
|
||||
p = PLGetString(prop);
|
||||
p = WMGetFromPLString(prop);
|
||||
|
||||
len = strlen(p);
|
||||
path = wmalloc(len+flen+2);
|
||||
|
||||
614
WINGs/handlers.c
Normal file
614
WINGs/handlers.c
Normal file
@@ -0,0 +1,614 @@
|
||||
|
||||
/*
|
||||
* WINGs internal handlers: timer, idle and input handlers
|
||||
*/
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include "../src/config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <X11/Xos.h>
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifndef X_GETTIMEOFDAY
|
||||
#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct TimerHandler {
|
||||
WMCallback *callback; /* procedure to call */
|
||||
struct timeval when; /* when to call the callback */
|
||||
void *clientData;
|
||||
struct TimerHandler *next;
|
||||
int nextDelay; /* 0 if it's one-shot */
|
||||
} TimerHandler;
|
||||
|
||||
|
||||
typedef struct IdleHandler {
|
||||
WMCallback *callback;
|
||||
void *clientData;
|
||||
} IdleHandler;
|
||||
|
||||
|
||||
typedef struct InputHandler {
|
||||
WMInputProc *callback;
|
||||
void *clientData;
|
||||
int fd;
|
||||
int mask;
|
||||
} InputHandler;
|
||||
|
||||
|
||||
/* queue of timer event handlers */
|
||||
static TimerHandler *timerHandler=NULL;
|
||||
|
||||
static WMArray *idleHandler=NULL;
|
||||
|
||||
static WMArray *inputHandler=NULL;
|
||||
|
||||
#define timerPending() (timerHandler)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
rightNow(struct timeval *tv) {
|
||||
X_GETTIMEOFDAY(tv);
|
||||
}
|
||||
|
||||
/* is t1 after t2 ? */
|
||||
#define IS_AFTER(t1, t2) (((t1).tv_sec > (t2).tv_sec) || \
|
||||
(((t1).tv_sec == (t2).tv_sec) \
|
||||
&& ((t1).tv_usec > (t2).tv_usec)))
|
||||
|
||||
#define IS_ZERO(tv) (tv.tv_sec == 0 && tv.tv_usec == 0)
|
||||
|
||||
#define SET_ZERO(tv) tv.tv_sec = 0, tv.tv_usec = 0
|
||||
|
||||
static void
|
||||
addmillisecs(struct timeval *tv, int milliseconds)
|
||||
{
|
||||
tv->tv_usec += milliseconds*1000;
|
||||
|
||||
tv->tv_sec += tv->tv_usec/1000000;
|
||||
tv->tv_usec = tv->tv_usec%1000000;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
enqueueTimerHandler(TimerHandler *handler)
|
||||
{
|
||||
TimerHandler *tmp;
|
||||
|
||||
/* insert callback in queue, sorted by time left */
|
||||
if (!timerHandler || !IS_AFTER(handler->when, timerHandler->when)) {
|
||||
/* first in the queue */
|
||||
handler->next = timerHandler;
|
||||
timerHandler = handler;
|
||||
} else {
|
||||
tmp = timerHandler;
|
||||
while (tmp->next && IS_AFTER(handler->when, tmp->next->when)) {
|
||||
tmp = tmp->next;
|
||||
}
|
||||
handler->next = tmp->next;
|
||||
tmp->next = handler;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
delayUntilNextTimerEvent(struct timeval *delay)
|
||||
{
|
||||
struct timeval now;
|
||||
TimerHandler *handler;
|
||||
|
||||
handler = timerHandler;
|
||||
while (handler && IS_ZERO(handler->when)) handler = handler->next;
|
||||
|
||||
if (!handler) {
|
||||
/* The return value of this function is only valid if there _are_
|
||||
timers active. */
|
||||
delay->tv_sec = 0;
|
||||
delay->tv_usec = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
rightNow(&now);
|
||||
if (IS_AFTER(now, handler->when)) {
|
||||
delay->tv_sec = 0;
|
||||
delay->tv_usec = 0;
|
||||
} else {
|
||||
delay->tv_sec = handler->when.tv_sec - now.tv_sec;
|
||||
delay->tv_usec = handler->when.tv_usec - now.tv_usec;
|
||||
if (delay->tv_usec < 0) {
|
||||
delay->tv_usec += 1000000;
|
||||
delay->tv_sec--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WMHandlerID
|
||||
WMAddTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
|
||||
{
|
||||
TimerHandler *handler;
|
||||
|
||||
handler = malloc(sizeof(TimerHandler));
|
||||
if (!handler)
|
||||
return NULL;
|
||||
|
||||
rightNow(&handler->when);
|
||||
addmillisecs(&handler->when, milliseconds);
|
||||
handler->callback = callback;
|
||||
handler->clientData = cdata;
|
||||
handler->nextDelay = 0;
|
||||
|
||||
enqueueTimerHandler(handler);
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
WMHandlerID
|
||||
WMAddPersistentTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
|
||||
{
|
||||
TimerHandler *handler = WMAddTimerHandler(milliseconds, callback, cdata);
|
||||
|
||||
if (handler != NULL)
|
||||
handler->nextDelay = milliseconds;
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteTimerWithClientData(void *cdata)
|
||||
{
|
||||
TimerHandler *handler, *tmp;
|
||||
|
||||
if (!cdata || !timerHandler)
|
||||
return;
|
||||
|
||||
tmp = timerHandler;
|
||||
if (tmp->clientData==cdata) {
|
||||
tmp->nextDelay = 0;
|
||||
if (!IS_ZERO(tmp->when)) {
|
||||
timerHandler = tmp->next;
|
||||
wfree(tmp);
|
||||
}
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next->clientData==cdata) {
|
||||
handler = tmp->next;
|
||||
handler->nextDelay = 0;
|
||||
if (IS_ZERO(handler->when))
|
||||
break;
|
||||
tmp->next = handler->next;
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteTimerHandler(WMHandlerID handlerID)
|
||||
{
|
||||
TimerHandler *tmp, *handler=(TimerHandler*)handlerID;
|
||||
|
||||
if (!handler || !timerHandler)
|
||||
return;
|
||||
|
||||
tmp = timerHandler;
|
||||
|
||||
handler->nextDelay = 0;
|
||||
|
||||
if (IS_ZERO(handler->when))
|
||||
return;
|
||||
|
||||
if (tmp==handler) {
|
||||
timerHandler = handler->next;
|
||||
wfree(handler);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next==handler) {
|
||||
tmp->next=handler->next;
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMHandlerID
|
||||
WMAddIdleHandler(WMCallback *callback, void *cdata)
|
||||
{
|
||||
IdleHandler *handler;
|
||||
|
||||
handler = malloc(sizeof(IdleHandler));
|
||||
if (!handler)
|
||||
return NULL;
|
||||
|
||||
handler->callback = callback;
|
||||
handler->clientData = cdata;
|
||||
/* add handler at end of queue */
|
||||
if (!idleHandler) {
|
||||
idleHandler = WMCreateArrayWithDestructor(16, wfree);
|
||||
}
|
||||
WMAddToArray(idleHandler, handler);
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMDeleteIdleHandler(WMHandlerID handlerID)
|
||||
{
|
||||
IdleHandler *handler = (IdleHandler*)handlerID;
|
||||
|
||||
if (!handler || !idleHandler)
|
||||
return;
|
||||
|
||||
WMRemoveFromArray(idleHandler, handler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMHandlerID
|
||||
WMAddInputHandler(int fd, int condition, WMInputProc *proc, void *clientData)
|
||||
{
|
||||
InputHandler *handler;
|
||||
|
||||
handler = wmalloc(sizeof(InputHandler));
|
||||
|
||||
handler->fd = fd;
|
||||
handler->mask = condition;
|
||||
handler->callback = proc;
|
||||
handler->clientData = clientData;
|
||||
|
||||
if (!inputHandler)
|
||||
inputHandler = WMCreateArrayWithDestructor(16, wfree);
|
||||
WMAddToArray(inputHandler, handler);
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteInputHandler(WMHandlerID handlerID)
|
||||
{
|
||||
InputHandler *handler = (InputHandler*)handlerID;
|
||||
|
||||
if (!handler || !inputHandler)
|
||||
return;
|
||||
|
||||
WMRemoveFromArray(inputHandler, handler);
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
W_CheckIdleHandlers(void)
|
||||
{
|
||||
IdleHandler *handler;
|
||||
WMArray *handlerCopy;
|
||||
WMArrayIterator iter;
|
||||
|
||||
if (!idleHandler || WMGetArrayItemCount(idleHandler)==0) {
|
||||
W_FlushIdleNotificationQueue();
|
||||
/* make sure an observer in queue didn't added an idle handler */
|
||||
return (idleHandler!=NULL && WMGetArrayItemCount(idleHandler)>0);
|
||||
}
|
||||
|
||||
handlerCopy = WMDuplicateArray(idleHandler);
|
||||
|
||||
WM_ITERATE_ARRAY(handlerCopy, handler, iter) {
|
||||
/* check if the handler still exist or was removed by a callback */
|
||||
if (WMGetFirstInArray(idleHandler, handler) == WANotFound)
|
||||
continue;
|
||||
|
||||
(*handler->callback)(handler->clientData);
|
||||
WMDeleteIdleHandler(handler);
|
||||
}
|
||||
|
||||
WMFreeArray(handlerCopy);
|
||||
|
||||
W_FlushIdleNotificationQueue();
|
||||
|
||||
/* this is not necesarrily False, because one handler can re-add itself */
|
||||
return (WMGetArrayItemCount(idleHandler)>0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
W_CheckTimerHandlers(void)
|
||||
{
|
||||
TimerHandler *handler;
|
||||
struct timeval now;
|
||||
|
||||
if (!timerHandler) {
|
||||
W_FlushASAPNotificationQueue();
|
||||
return;
|
||||
}
|
||||
|
||||
rightNow(&now);
|
||||
|
||||
handler = timerHandler;
|
||||
while (handler && IS_AFTER(now, handler->when)) {
|
||||
if (!IS_ZERO(handler->when)) {
|
||||
SET_ZERO(handler->when);
|
||||
(*handler->callback)(handler->clientData);
|
||||
}
|
||||
handler = handler->next;
|
||||
}
|
||||
|
||||
while (timerHandler && IS_ZERO(timerHandler->when)) {
|
||||
handler = timerHandler;
|
||||
timerHandler = timerHandler->next;
|
||||
|
||||
if (handler->nextDelay > 0) {
|
||||
handler->when = now;
|
||||
addmillisecs(&handler->when, handler->nextDelay);
|
||||
enqueueTimerHandler(handler);
|
||||
} else {
|
||||
wfree(handler);
|
||||
}
|
||||
}
|
||||
|
||||
W_FlushASAPNotificationQueue();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This functions will handle input events on all registered file descriptors.
|
||||
* Input:
|
||||
* - waitForInput - True if we want the function to wait until an event
|
||||
* appears on a file descriptor we watch, False if we
|
||||
* want the function to immediately return if there is
|
||||
* no data available on the file descriptors we watch.
|
||||
* - inputfd - Extra input file descriptor to watch for input.
|
||||
* This is only used when called from wevent.c to watch
|
||||
* on ConnectionNumber(dpy) to avoid blocking of X events
|
||||
* if we wait for input from other file handlers.
|
||||
* Output:
|
||||
* if waitForInput is False, the function will return False if there are no
|
||||
* input handlers registered, or if there is no data
|
||||
* available on the registered ones, and will return True
|
||||
* if there is at least one input handler that has data
|
||||
* available.
|
||||
* if waitForInput is True, the function will return False if there are no
|
||||
* input handlers registered, else it will block until an
|
||||
* event appears on one of the file descriptors it watches
|
||||
* and then it will return True.
|
||||
*
|
||||
* If the retured value is True, the input handlers for the corresponding file
|
||||
* descriptors are also called.
|
||||
*
|
||||
* Parametersshould be passed like this:
|
||||
* - from wevent.c:
|
||||
* waitForInput - apropriate value passed by the function who called us
|
||||
* inputfd = ConnectionNumber(dpy)
|
||||
* - from wutil.c:
|
||||
* waitForInput - apropriate value passed by the function who called us
|
||||
* inputfd = -1
|
||||
*
|
||||
*/
|
||||
Bool
|
||||
W_HandleInputEvents(Bool waitForInput, int inputfd)
|
||||
{
|
||||
#if defined(HAVE_POLL) && defined(HAVE_POLL_H) && !defined(HAVE_SELECT)
|
||||
struct poll fd *fds;
|
||||
InputHandler *handler;
|
||||
int count, timeout, nfds, i, extrafd;
|
||||
|
||||
extrafd = (inputfd < 0) ? 0 : 1;
|
||||
|
||||
if (inputHandler)
|
||||
nfds = WMGetArrayItemCount(inputHandler);
|
||||
else
|
||||
nfds = 0;
|
||||
|
||||
if (!extrafd && nfds==0) {
|
||||
W_FlushASAPNotificationQueue();
|
||||
return False;
|
||||
}
|
||||
|
||||
fds = wmalloc((nfds+extrafd) * sizeof(struct pollfd));
|
||||
if (extrafd) {
|
||||
/* put this to the end of array to avoid using ranges from 1 to nfds+1 */
|
||||
fds[nfds].fd = inputfd;
|
||||
fds[nfds].events = POLLIN;
|
||||
}
|
||||
|
||||
/* use WM_ITERATE_ARRAY() here */
|
||||
for (i = 0; i<nfds; i++) {
|
||||
handler = WMGetFromArray(inputHandler, i);
|
||||
fds[i].fd = handler->fd;
|
||||
fds[i].events = 0;
|
||||
if (handler->mask & WIReadMask)
|
||||
fds[i].events |= POLLIN;
|
||||
|
||||
if (handler->mask & WIWriteMask)
|
||||
fds[i].events |= POLLOUT;
|
||||
|
||||
#if 0 /* FIXME */
|
||||
if (handler->mask & WIExceptMask)
|
||||
FD_SET(handler->fd, &eset);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the timeout to the estimated time until the
|
||||
* next timer expires.
|
||||
*/
|
||||
if (!waitForInput) {
|
||||
timeout = 0;
|
||||
} else if (timerPending()) {
|
||||
struct timeval tv;
|
||||
delayUntilNextTimerEvent(&tv);
|
||||
timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
} else {
|
||||
timeout = -1;
|
||||
}
|
||||
|
||||
count = poll(fds, nfds+extrafd, timeout);
|
||||
|
||||
if (count>0 && nfds>0) {
|
||||
WMArray *handlerCopy = WMDuplicateArray(inputHandler);
|
||||
int mask;
|
||||
|
||||
/* use WM_ITERATE_ARRAY() here */
|
||||
for (i=0; i<nfds; i++) {
|
||||
handler = WMGetFromArray(handlerCopy, i);
|
||||
/* check if the handler still exist or was removed by a callback */
|
||||
if (WMGetFirstInArray(inputHandler, handler) == WANotFound)
|
||||
continue;
|
||||
|
||||
mask = 0;
|
||||
|
||||
if ((handler->mask & WIReadMask) &&
|
||||
(fds[i].revents & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI)))
|
||||
mask |= WIReadMask;
|
||||
|
||||
if ((handler->mask & WIWriteMask) &&
|
||||
(fds[i].revents & (POLLOUT | POLLWRBAND)))
|
||||
mask |= WIWriteMask;
|
||||
|
||||
if ((handler->mask & WIExceptMask) &&
|
||||
(fds[i].revents & (POLLHUP | POLLNVAL | POLLERR)))
|
||||
mask |= WIExceptMask;
|
||||
|
||||
if (mask!=0 && handler->callback) {
|
||||
(*handler->callback)(handler->fd, mask,
|
||||
handler->clientData);
|
||||
}
|
||||
}
|
||||
|
||||
WMFreeArray(handlerCopy);
|
||||
}
|
||||
|
||||
wfree(fds);
|
||||
|
||||
W_FlushASAPNotificationQueue();
|
||||
|
||||
return (count > 0);
|
||||
#else
|
||||
#ifdef HAVE_SELECT
|
||||
struct timeval timeout;
|
||||
struct timeval *timeoutPtr;
|
||||
fd_set rset, wset, eset;
|
||||
int maxfd, nfds, i;
|
||||
int count;
|
||||
InputHandler *handler;
|
||||
|
||||
if (inputHandler)
|
||||
nfds = WMGetArrayItemCount(inputHandler);
|
||||
else
|
||||
nfds = 0;
|
||||
|
||||
if (inputfd<0 && nfds==0) {
|
||||
W_FlushASAPNotificationQueue();
|
||||
return False;
|
||||
}
|
||||
|
||||
FD_ZERO(&rset);
|
||||
FD_ZERO(&wset);
|
||||
FD_ZERO(&eset);
|
||||
|
||||
if (inputfd < 0) {
|
||||
maxfd = 0;
|
||||
} else {
|
||||
FD_SET(inputfd, &rset);
|
||||
maxfd = inputfd;
|
||||
}
|
||||
|
||||
/* use WM_ITERATE_ARRAY() here */
|
||||
for (i=0; i<nfds; i++) {
|
||||
handler = WMGetFromArray(inputHandler, i);
|
||||
if (handler->mask & WIReadMask)
|
||||
FD_SET(handler->fd, &rset);
|
||||
|
||||
if (handler->mask & WIWriteMask)
|
||||
FD_SET(handler->fd, &wset);
|
||||
|
||||
if (handler->mask & WIExceptMask)
|
||||
FD_SET(handler->fd, &eset);
|
||||
|
||||
if (maxfd < handler->fd)
|
||||
maxfd = handler->fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the timeout to the estimated time until the
|
||||
* next timer expires.
|
||||
*/
|
||||
if (!waitForInput) {
|
||||
SET_ZERO(timeout);
|
||||
timeoutPtr = &timeout;
|
||||
} else if (timerPending()) {
|
||||
delayUntilNextTimerEvent(&timeout);
|
||||
timeoutPtr = &timeout;
|
||||
} else {
|
||||
timeoutPtr = (struct timeval*)0;
|
||||
}
|
||||
|
||||
count = select(1 + maxfd, &rset, &wset, &eset, timeoutPtr);
|
||||
|
||||
if (count>0 && nfds>0) {
|
||||
WMArray *handlerCopy = WMDuplicateArray(inputHandler);
|
||||
int mask;
|
||||
|
||||
/* use WM_ITERATE_ARRAY() here */
|
||||
for (i=0; i<nfds; i++) {
|
||||
handler = WMGetFromArray(handlerCopy, i);
|
||||
/* check if the handler still exist or was removed by a callback */
|
||||
if (WMGetFirstInArray(inputHandler, handler) == WANotFound)
|
||||
continue;
|
||||
|
||||
mask = 0;
|
||||
|
||||
if ((handler->mask & WIReadMask) && FD_ISSET(handler->fd, &rset))
|
||||
mask |= WIReadMask;
|
||||
|
||||
if ((handler->mask & WIWriteMask) && FD_ISSET(handler->fd, &wset))
|
||||
mask |= WIWriteMask;
|
||||
|
||||
if ((handler->mask & WIExceptMask) && FD_ISSET(handler->fd, &eset))
|
||||
mask |= WIExceptMask;
|
||||
|
||||
if (mask!=0 && handler->callback) {
|
||||
(*handler->callback)(handler->fd, mask,
|
||||
handler->clientData);
|
||||
}
|
||||
}
|
||||
|
||||
WMFreeArray(handlerCopy);
|
||||
}
|
||||
|
||||
W_FlushASAPNotificationQueue();
|
||||
|
||||
/* --oldway-- return ((inputfd < 0) ? (count > 0) : FD_ISSET(inputfd, &rset));*/
|
||||
return (count > 0);
|
||||
#else /* not HAVE_SELECT, not HAVE_POLL */
|
||||
Neither select nor poll. You lose.
|
||||
#endif /* HAVE_SELECT */
|
||||
#endif /* HAVE_POLL */
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
|
||||
typedef struct HashItem {
|
||||
void *key;
|
||||
void *data;
|
||||
const void *key;
|
||||
const void *data;
|
||||
|
||||
struct HashItem *next; /* collided item list */
|
||||
} HashItem;
|
||||
@@ -185,6 +185,12 @@ WMFreeHashTable(WMHashTable *table)
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
WMCountHashTable(WMHashTable *table)
|
||||
{
|
||||
return table->itemCount;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMHashGet(WMHashTable *table, const void *key)
|
||||
@@ -211,15 +217,52 @@ WMHashGet(WMHashTable *table, const void *key)
|
||||
}
|
||||
}
|
||||
if (item)
|
||||
return item->data;
|
||||
return (void*)item->data;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMHashGetItemAndKey(WMHashTable *table, const void *key,
|
||||
void **retItem, void **retKey)
|
||||
{
|
||||
unsigned h;
|
||||
HashItem *item;
|
||||
|
||||
h = HASH(table, key);
|
||||
item = table->table[h];
|
||||
|
||||
if (table->callbacks.keyIsEqual) {
|
||||
while (item) {
|
||||
if ((*table->callbacks.keyIsEqual)(key, item->key)) {
|
||||
break;
|
||||
}
|
||||
item = item->next;
|
||||
}
|
||||
} else {
|
||||
while (item) {
|
||||
if (key == item->key) {
|
||||
break;
|
||||
}
|
||||
item = item->next;
|
||||
}
|
||||
}
|
||||
if (item) {
|
||||
if (retKey)
|
||||
*retKey = (void*)item->key;
|
||||
if (retItem)
|
||||
*retItem = (void*)item->data;
|
||||
return True;
|
||||
} else {
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void*
|
||||
WMHashInsert(WMHashTable *table, void *key, void *data)
|
||||
WMHashInsert(WMHashTable *table, const void *key, const void *data)
|
||||
{
|
||||
unsigned h;
|
||||
HashItem *item;
|
||||
@@ -247,14 +290,14 @@ WMHashInsert(WMHashTable *table, void *key, void *data)
|
||||
}
|
||||
|
||||
if (replacing) {
|
||||
void *old;
|
||||
const void *old;
|
||||
|
||||
old = item->data;
|
||||
item->data = data;
|
||||
RELKEY(table, item->key);
|
||||
item->key = DUPKEY(table, key);
|
||||
|
||||
return old;
|
||||
return (void*)old;
|
||||
} else {
|
||||
HashItem *nitem;
|
||||
|
||||
@@ -337,7 +380,7 @@ WMEnumerateHashTable(WMHashTable *table)
|
||||
void*
|
||||
WMNextHashEnumeratorItem(WMHashEnumerator *enumerator)
|
||||
{
|
||||
void *data = NULL;
|
||||
const void *data = NULL;
|
||||
|
||||
/* this assumes the table doesn't change between
|
||||
* WMEnumerateHashTable() and WMNextHashEnumeratorItem() calls */
|
||||
@@ -357,14 +400,65 @@ WMNextHashEnumeratorItem(WMHashEnumerator *enumerator)
|
||||
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
|
||||
}
|
||||
|
||||
return data;
|
||||
return (void*)data;
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
WMCountHashTable(WMHashTable *table)
|
||||
void*
|
||||
WMNextHashEnumeratorKey(WMHashEnumerator *enumerator)
|
||||
{
|
||||
return table->itemCount;
|
||||
const void *key = NULL;
|
||||
|
||||
/* this assumes the table doesn't change between
|
||||
* WMEnumerateHashTable() and WMNextHashEnumeratorKey() calls */
|
||||
|
||||
if (enumerator->nextItem==NULL) {
|
||||
HashTable *table = enumerator->table;
|
||||
while (++enumerator->index < table->size) {
|
||||
if (table->table[enumerator->index]!=NULL) {
|
||||
enumerator->nextItem = table->table[enumerator->index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enumerator->nextItem) {
|
||||
key = ((HashItem*)enumerator->nextItem)->key;
|
||||
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
|
||||
}
|
||||
|
||||
return (void*)key;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMNextHashEnumeratorItemAndKey(WMHashEnumerator *enumerator,
|
||||
void **item, void **key)
|
||||
{
|
||||
/* this assumes the table doesn't change between
|
||||
* WMEnumerateHashTable() and WMNextHashEnumeratorItemAndKey() calls */
|
||||
|
||||
if (enumerator->nextItem==NULL) {
|
||||
HashTable *table = enumerator->table;
|
||||
while (++enumerator->index < table->size) {
|
||||
if (table->table[enumerator->index]!=NULL) {
|
||||
enumerator->nextItem = table->table[enumerator->index];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (enumerator->nextItem) {
|
||||
if (item)
|
||||
*item = (void*)((HashItem*)enumerator->nextItem)->data;
|
||||
if (key)
|
||||
*key = (void*)((HashItem*)enumerator->nextItem)->key;
|
||||
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +486,7 @@ const WMHashTableCallbacks WMStringHashCallbacks = {
|
||||
(hashFunc)hashString,
|
||||
(isEqualFunc)compareStrings,
|
||||
(retainFunc)wstrdup,
|
||||
(releaseFunc)free
|
||||
(releaseFunc)wfree
|
||||
};
|
||||
|
||||
|
||||
|
||||
96
WINGs/host.c
96
WINGs/host.c
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* WINGs WMHost function library
|
||||
*
|
||||
* Copyright (c) 1999-2000 Dan Pascu
|
||||
* Copyright (c) 1999-2001 Dan Pascu
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
@@ -30,29 +31,30 @@
|
||||
#include "WUtil.h"
|
||||
|
||||
|
||||
/* Tell stupid Solaris what's going on */
|
||||
/* For Solaris */
|
||||
#ifndef INADDR_NONE
|
||||
# define INADDR_NONE (-1)
|
||||
#endif
|
||||
|
||||
/* Max hostname length (RFC 1123) */
|
||||
#define W_MAXHOSTNAMELEN 255
|
||||
|
||||
|
||||
typedef struct W_Host {
|
||||
char *name;
|
||||
|
||||
WMBag *names;
|
||||
WMBag *addresses;
|
||||
WMArray *names;
|
||||
WMArray *addresses;
|
||||
|
||||
int refCount;
|
||||
} W_Host;
|
||||
|
||||
|
||||
static WMHashTable *hostCache = NULL;
|
||||
|
||||
static Bool hostCacheEnabled = True;
|
||||
|
||||
|
||||
/* Max hostname length (RFC 1123) */
|
||||
#define W_MAXHOSTNAMELEN 255
|
||||
|
||||
|
||||
static WMHost*
|
||||
getHostFromCache(char *name)
|
||||
@@ -74,19 +76,19 @@ getHostWithHostEntry(struct hostent *host, char *name)
|
||||
hPtr = (WMHost*)wmalloc(sizeof(WMHost));
|
||||
memset(hPtr, 0, sizeof(WMHost));
|
||||
|
||||
hPtr->names = WMCreateBag(1);
|
||||
hPtr->addresses = WMCreateBag(1);
|
||||
hPtr->names = WMCreateArrayWithDestructor(1, wfree);
|
||||
hPtr->addresses = WMCreateArrayWithDestructor(1, wfree);
|
||||
|
||||
WMPutInBag(hPtr->names, wstrdup(host->h_name));
|
||||
WMAddToArray(hPtr->names, wstrdup(host->h_name));
|
||||
|
||||
for (i=0; host->h_aliases[i]!=NULL; i++) {
|
||||
WMPutInBag(hPtr->names, wstrdup(host->h_aliases[i]));
|
||||
WMAddToArray(hPtr->names, wstrdup(host->h_aliases[i]));
|
||||
}
|
||||
|
||||
for (i=0; host->h_addr_list[i]!=NULL; i++) {
|
||||
memcpy((void*)&in.s_addr, (const void*)host->h_addr_list[i],
|
||||
host->h_length);
|
||||
WMPutInBag(hPtr->addresses, wstrdup(inet_ntoa(in)));
|
||||
WMAddToArray(hPtr->addresses, wstrdup(inet_ntoa(in)));
|
||||
}
|
||||
|
||||
hPtr->refCount = 1;
|
||||
@@ -109,11 +111,11 @@ WMGetCurrentHost()
|
||||
char name[W_MAXHOSTNAMELEN+1];
|
||||
|
||||
if (gethostname(name, W_MAXHOSTNAMELEN) < 0) {
|
||||
wsyserror("Cannot get current host name");
|
||||
wsyserror(_("Cannot get current host name"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name[W_MAXHOSTNAMELEN] = '\0';
|
||||
name[W_MAXHOSTNAMELEN] = 0;
|
||||
|
||||
return WMGetHostWithName(name);
|
||||
}
|
||||
@@ -125,10 +127,7 @@ WMGetHostWithName(char* name)
|
||||
struct hostent *host;
|
||||
WMHost *hPtr;
|
||||
|
||||
if (name == NULL) {
|
||||
wwarning("NULL host name in 'WMGetHostWithName()'");
|
||||
return NULL;
|
||||
}
|
||||
wassertrv(name!=NULL, NULL);
|
||||
|
||||
if (hostCacheEnabled) {
|
||||
if ((hPtr = getHostFromCache(name)) != NULL) {
|
||||
@@ -155,10 +154,7 @@ WMGetHostWithAddress(char* address)
|
||||
struct in_addr in;
|
||||
WMHost *hPtr;
|
||||
|
||||
if (address == NULL) {
|
||||
wwarning("NULL address in 'WMGetHostWithAddress()'");
|
||||
return NULL;
|
||||
}
|
||||
wassertrv(address!=NULL, NULL);
|
||||
|
||||
if (hostCacheEnabled) {
|
||||
if ((hPtr = getHostFromCache(address)) != NULL) {
|
||||
@@ -171,7 +167,7 @@ WMGetHostWithAddress(char* address)
|
||||
if ((in.s_addr = inet_addr(address)) == INADDR_NONE)
|
||||
return NULL;
|
||||
#else
|
||||
if (inet_aton(address, &in.s_addr) == 0)
|
||||
if (inet_aton(address, &in) == 0)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
@@ -197,20 +193,13 @@ WMRetainHost(WMHost *hPtr)
|
||||
void
|
||||
WMReleaseHost(WMHost *hPtr)
|
||||
{
|
||||
int i;
|
||||
|
||||
hPtr->refCount--;
|
||||
|
||||
if (hPtr->refCount > 0)
|
||||
return;
|
||||
|
||||
for (i=0; i<WMGetBagItemCount(hPtr->names); i++)
|
||||
wfree(WMGetFromBag(hPtr->names, i));
|
||||
for (i=0; i<WMGetBagItemCount(hPtr->addresses); i++)
|
||||
wfree(WMGetFromBag(hPtr->addresses, i));
|
||||
|
||||
WMFreeBag(hPtr->names);
|
||||
WMFreeBag(hPtr->addresses);
|
||||
WMFreeArray(hPtr->names);
|
||||
WMFreeArray(hPtr->addresses);
|
||||
|
||||
if (hPtr->name) {
|
||||
WMHashRemove(hostCache, hPtr->name);
|
||||
@@ -239,7 +228,7 @@ void
|
||||
WMFlushHostCache()
|
||||
{
|
||||
if (hostCache && WMCountHashTable(hostCache)>0) {
|
||||
WMBag *hostBag = WMCreateBag(WMCountHashTable(hostCache));
|
||||
WMArray *hostArray = WMCreateArray(WMCountHashTable(hostCache));
|
||||
WMHashEnumerator enumer = WMEnumerateHashTable(hostCache);
|
||||
WMHost *hPtr;
|
||||
int i;
|
||||
@@ -247,32 +236,37 @@ WMFlushHostCache()
|
||||
while ((hPtr = WMNextHashEnumeratorItem(&enumer))) {
|
||||
/* we can't release the host here, because we can't change the
|
||||
* hash while using the enumerator functions. */
|
||||
WMPutInBag(hostBag, hPtr);
|
||||
WMAddToArray(hostArray, hPtr);
|
||||
}
|
||||
for (i=0; i<WMGetBagItemCount(hostBag); i++)
|
||||
WMReleaseHost(WMGetFromBag(hostBag, i));
|
||||
WMFreeBag(hostBag);
|
||||
for (i=0; i<WMGetArrayItemCount(hostArray); i++)
|
||||
WMReleaseHost(WMGetFromArray(hostArray, i));
|
||||
WMFreeArray(hostArray);
|
||||
WMResetHashTable(hostCache);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
matchAddress(void *item, void *cdata)
|
||||
{
|
||||
return (strcmp((char*) item, (char*) cdata)==0);
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMIsHostEqualToHost(WMHost* hPtr, WMHost* aPtr)
|
||||
{
|
||||
int i, j;
|
||||
char *adr1, *adr2;
|
||||
char *adr;
|
||||
int i;
|
||||
|
||||
wassertrv(hPtr!=NULL && aPtr!=NULL, False);
|
||||
|
||||
if (hPtr == aPtr)
|
||||
return True;
|
||||
|
||||
for (i=0; i<WMGetBagItemCount(aPtr->addresses); i++) {
|
||||
adr1 = WMGetFromBag(aPtr->addresses, i);
|
||||
for (j=0; j<WMGetBagItemCount(hPtr->addresses); j++) {
|
||||
adr2 = WMGetFromBag(hPtr->addresses, j);
|
||||
if (strcmp(adr1, adr2)==0)
|
||||
for (i=0; i<WMGetArrayItemCount(aPtr->addresses); i++) {
|
||||
adr = WMGetFromArray(aPtr->addresses, i);
|
||||
if (WMFindInArray(hPtr->addresses, matchAddress, adr) != WANotFound) {
|
||||
return True;
|
||||
}
|
||||
}
|
||||
@@ -284,13 +278,13 @@ WMIsHostEqualToHost(WMHost* hPtr, WMHost* aPtr)
|
||||
char*
|
||||
WMGetHostName(WMHost *hPtr)
|
||||
{
|
||||
return (WMGetBagItemCount(hPtr->names) > 0 ?
|
||||
WMGetFromBag(hPtr->names, 0) : NULL);
|
||||
/*return WMGetFromBag(hPtr->names, 0);*/
|
||||
return (WMGetArrayItemCount(hPtr->names) > 0 ?
|
||||
WMGetFromArray(hPtr->names, 0) : NULL);
|
||||
/*return WMGetFromArray(hPtr->names, 0);*/
|
||||
}
|
||||
|
||||
|
||||
WMBag*
|
||||
WMArray*
|
||||
WMGetHostNames(WMHost *hPtr)
|
||||
{
|
||||
return hPtr->names;
|
||||
@@ -300,12 +294,12 @@ WMGetHostNames(WMHost *hPtr)
|
||||
char*
|
||||
WMGetHostAddress(WMHost *hPtr)
|
||||
{
|
||||
return (WMGetBagItemCount(hPtr->addresses) > 0 ?
|
||||
WMGetFromBag(hPtr->addresses, 0) : NULL);
|
||||
return (WMGetArrayItemCount(hPtr->addresses) > 0 ?
|
||||
WMGetFromArray(hPtr->addresses, 0) : NULL);
|
||||
}
|
||||
|
||||
|
||||
WMBag*
|
||||
WMArray*
|
||||
WMGetHostAddresses(WMHost *hPtr)
|
||||
{
|
||||
return hPtr->addresses;
|
||||
|
||||
@@ -76,10 +76,13 @@ static int Aborting=0; /* if we're in the middle of an emergency exit */
|
||||
static WMHashTable *table = NULL;
|
||||
|
||||
|
||||
void *wmalloc(size_t size)
|
||||
void*
|
||||
wmalloc(size_t size)
|
||||
{
|
||||
void *tmp;
|
||||
|
||||
assert(size > 0);
|
||||
|
||||
#ifdef TEST_WITH_GC
|
||||
tmp = GC_malloc(size);
|
||||
#else
|
||||
@@ -108,7 +111,8 @@ void *wmalloc(size_t size)
|
||||
}
|
||||
|
||||
|
||||
void *wrealloc(void *ptr, size_t newsize)
|
||||
void*
|
||||
wrealloc(void *ptr, size_t newsize)
|
||||
{
|
||||
void *nptr;
|
||||
|
||||
@@ -216,29 +220,3 @@ wrelease(void *ptr)
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
wstrdup(char *str)
|
||||
{
|
||||
assert(str!=NULL);
|
||||
|
||||
return strcpy(wmalloc(strlen(str)+1), str);
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
wstrappend(char *dst, char *src)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (!dst)
|
||||
return wstrdup(src);
|
||||
else if (!src)
|
||||
return wstrdup(dst);
|
||||
|
||||
str = wmalloc(strlen(dst)+strlen(src)+1);
|
||||
strcpy(str, dst);
|
||||
strcat(str, src);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
18
WINGs/misc.c
Normal file
18
WINGs/misc.c
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
/* Miscelaneous helper functions */
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
|
||||
WMRange
|
||||
wmkrange(int start, int count)
|
||||
{
|
||||
WMRange range;
|
||||
|
||||
range.position = start;
|
||||
range.count = count;
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
typedef struct W_Notification {
|
||||
char *name;
|
||||
const char *name;
|
||||
void *object;
|
||||
void *clientData;
|
||||
int refCount;
|
||||
@@ -18,7 +18,7 @@ typedef struct W_Notification {
|
||||
extern void W_FlushASAPNotificationQueue();
|
||||
|
||||
|
||||
char*
|
||||
const char*
|
||||
WMGetNotificationName(WMNotification *notification)
|
||||
{
|
||||
return notification->name;
|
||||
@@ -40,7 +40,7 @@ WMGetNotificationClientData(WMNotification *notification)
|
||||
|
||||
|
||||
WMNotification*
|
||||
WMCreateNotification(char *name, void *object, void *clientData)
|
||||
WMCreateNotification(const char *name, void *object, void *clientData)
|
||||
{
|
||||
Notification *nPtr;
|
||||
|
||||
@@ -82,7 +82,7 @@ typedef struct NotificationObserver {
|
||||
WMNotificationObserverAction *observerAction;
|
||||
void *observer;
|
||||
|
||||
char *name;
|
||||
const char *name;
|
||||
void *object;
|
||||
|
||||
struct NotificationObserver *prev; /* for tables */
|
||||
@@ -119,7 +119,7 @@ W_InitNotificationCenter(void)
|
||||
|
||||
void
|
||||
WMAddNotificationObserver(WMNotificationObserverAction *observerAction,
|
||||
void *observer, char *name, void *object)
|
||||
void *observer, const char *name, void *object)
|
||||
{
|
||||
NotificationObserver *oRec, *rec;
|
||||
|
||||
@@ -133,7 +133,8 @@ WMAddNotificationObserver(WMNotificationObserverAction *observerAction,
|
||||
|
||||
|
||||
/* put this action in the list of actions for this observer */
|
||||
rec = WMHashInsert(notificationCenter->observerTable, observer, oRec);
|
||||
rec = (NotificationObserver*)WMHashInsert(notificationCenter->observerTable,
|
||||
observer, oRec);
|
||||
|
||||
if (rec) {
|
||||
/* if this is not the first action for the observer */
|
||||
@@ -151,14 +152,16 @@ WMAddNotificationObserver(WMNotificationObserverAction *observerAction,
|
||||
notificationCenter->nilList = oRec;
|
||||
} else if (!name) {
|
||||
/* any message coming from object */
|
||||
rec = WMHashInsert(notificationCenter->objectTable, object, oRec);
|
||||
rec = (NotificationObserver*)WMHashInsert(notificationCenter->objectTable,
|
||||
object, oRec);
|
||||
oRec->next = rec;
|
||||
if (rec) {
|
||||
rec->prev = oRec;
|
||||
}
|
||||
} else {
|
||||
/* name && (object || !object) */
|
||||
rec = WMHashInsert(notificationCenter->nameTable, name, oRec);
|
||||
rec = (NotificationObserver*)WMHashInsert(notificationCenter->nameTable,
|
||||
name, oRec);
|
||||
oRec->next = rec;
|
||||
if (rec) {
|
||||
rec->prev = oRec;
|
||||
@@ -175,7 +178,8 @@ WMPostNotification(WMNotification *notification)
|
||||
WMRetainNotification(notification);
|
||||
|
||||
/* tell the observers that want to know about a particular message */
|
||||
orec = WMHashGet(notificationCenter->nameTable, notification->name);
|
||||
orec = (NotificationObserver*)WMHashGet(notificationCenter->nameTable,
|
||||
notification->name);
|
||||
|
||||
while (orec) {
|
||||
tmp = orec->next;
|
||||
@@ -192,7 +196,8 @@ WMPostNotification(WMNotification *notification)
|
||||
}
|
||||
|
||||
/* tell the observers that want to know about an object */
|
||||
orec = WMHashGet(notificationCenter->objectTable, notification->object);
|
||||
orec = (NotificationObserver*)WMHashGet(notificationCenter->objectTable,
|
||||
notification->object);
|
||||
|
||||
while (orec) {
|
||||
tmp = orec->next;
|
||||
@@ -226,7 +231,8 @@ WMRemoveNotificationObserver(void *observer)
|
||||
NotificationObserver *orec, *tmp, *rec;
|
||||
|
||||
/* get the list of actions the observer is doing */
|
||||
orec = WMHashGet(notificationCenter->observerTable, observer);
|
||||
orec = (NotificationObserver*)WMHashGet(notificationCenter->observerTable,
|
||||
observer);
|
||||
|
||||
/*
|
||||
* FOREACH orec IN actionlist for observer
|
||||
@@ -244,7 +250,8 @@ WMRemoveNotificationObserver(void *observer)
|
||||
notificationCenter->nilList = orec->next;
|
||||
} else if (!orec->name) {
|
||||
/* any message coming from object */
|
||||
rec = WMHashGet(notificationCenter->objectTable, orec->object);
|
||||
rec = (NotificationObserver*)WMHashGet(notificationCenter->objectTable,
|
||||
orec->object);
|
||||
if (rec==orec) {
|
||||
/* replace table entry */
|
||||
if (orec->next) {
|
||||
@@ -256,7 +263,8 @@ WMRemoveNotificationObserver(void *observer)
|
||||
}
|
||||
} else {
|
||||
/* name && (object || !object) */
|
||||
rec = WMHashGet(notificationCenter->nameTable, orec->name);
|
||||
rec = (NotificationObserver*)WMHashGet(notificationCenter->nameTable,
|
||||
orec->name);
|
||||
if (rec==orec) {
|
||||
/* replace table entry */
|
||||
if (orec->next) {
|
||||
@@ -282,13 +290,13 @@ WMRemoveNotificationObserver(void *observer)
|
||||
|
||||
|
||||
void
|
||||
WMRemoveNotificationObserverWithName(void *observer, char *name, void *object)
|
||||
WMRemoveNotificationObserverWithName(void *observer, const char *name, void *object)
|
||||
{
|
||||
NotificationObserver *orec, *tmp, *rec;
|
||||
NotificationObserver *newList = NULL;
|
||||
|
||||
/* get the list of actions the observer is doing */
|
||||
orec = WMHashGet(notificationCenter->observerTable, observer);
|
||||
orec = (NotificationObserver*)WMHashGet(notificationCenter->observerTable, observer);
|
||||
|
||||
WMHashRemove(notificationCenter->observerTable, observer);
|
||||
|
||||
@@ -301,7 +309,7 @@ WMRemoveNotificationObserverWithName(void *observer, char *name, void *object)
|
||||
if (notificationCenter->nilList == orec)
|
||||
notificationCenter->nilList = orec->next;
|
||||
} else if (!name) {
|
||||
rec = WMHashGet(notificationCenter->objectTable, orec->object);
|
||||
rec = (NotificationObserver*)WMHashGet(notificationCenter->objectTable, orec->object);
|
||||
if (rec==orec) {
|
||||
assert(rec->prev==NULL);
|
||||
/* replace table entry */
|
||||
@@ -314,7 +322,8 @@ WMRemoveNotificationObserverWithName(void *observer, char *name, void *object)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rec = WMHashGet(notificationCenter->nameTable, orec->name);
|
||||
rec = (NotificationObserver*)WMHashGet(notificationCenter->nameTable,
|
||||
orec->name);
|
||||
if (rec==orec) {
|
||||
assert(rec->prev==NULL);
|
||||
/* replace table entry */
|
||||
@@ -359,7 +368,7 @@ WMRemoveNotificationObserverWithName(void *observer, char *name, void *object)
|
||||
|
||||
|
||||
void
|
||||
WMPostNotificationName(char *name, void *object, void *clientData)
|
||||
WMPostNotificationName(const char *name, void *object, void *clientData)
|
||||
{
|
||||
WMNotification *notification;
|
||||
|
||||
@@ -376,8 +385,8 @@ WMPostNotificationName(char *name, void *object, void *clientData)
|
||||
|
||||
|
||||
typedef struct W_NotificationQueue {
|
||||
WMBag *asapQueue;
|
||||
WMBag *idleQueue;
|
||||
WMArray *asapQueue;
|
||||
WMArray *idleQueue;
|
||||
|
||||
struct W_NotificationQueue *next;
|
||||
} NotificationQueue;
|
||||
@@ -406,8 +415,10 @@ WMCreateNotificationQueue(void)
|
||||
|
||||
queue = wmalloc(sizeof(NotificationQueue));
|
||||
|
||||
queue->asapQueue = WMCreateBag(8);
|
||||
queue->idleQueue = WMCreateBag(8);
|
||||
queue->asapQueue =
|
||||
WMCreateArrayWithDestructor(8, (WMFreeDataProc*)WMReleaseNotification);
|
||||
queue->idleQueue =
|
||||
WMCreateArrayWithDestructor(8, (WMFreeDataProc*)WMReleaseNotification);
|
||||
queue->next = notificationQueueList;
|
||||
|
||||
notificationQueueList = queue;
|
||||
@@ -426,62 +437,50 @@ WMEnqueueNotification(WMNotificationQueue *queue, WMNotification *notification,
|
||||
}
|
||||
|
||||
|
||||
#define NOTIF ((WMNotification*)cdata)
|
||||
#define ITEM ((WMNotification*)item)
|
||||
|
||||
static int
|
||||
matchSenderAndName(void *item, void *cdata)
|
||||
{
|
||||
return (NOTIF->object==ITEM->object && strcmp(NOTIF->name, ITEM->name)==0);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
matchSender(void *item, void *cdata)
|
||||
{
|
||||
return (NOTIF->object == ITEM->object);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
matchName(void *item, void *cdata)
|
||||
{
|
||||
return (strcmp(NOTIF->name, ITEM->name)==0);
|
||||
}
|
||||
|
||||
#undef NOTIF
|
||||
#undef ITEM
|
||||
|
||||
|
||||
void
|
||||
WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
||||
WMNotification *notification, unsigned mask)
|
||||
{
|
||||
WMBagIterator i;
|
||||
WMNotification *tmp;
|
||||
WMMatchDataProc *matchFunc;
|
||||
|
||||
if ((mask & WNCOnName) && (mask & WNCOnSender)) {
|
||||
WM_ITERATE_BAG(queue->asapQueue, tmp, i) {
|
||||
if (notification->object == tmp->object &&
|
||||
strcmp(notification->name, tmp->name) == 0) {
|
||||
WMRemoveFromBag(queue->asapQueue, tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
WM_ITERATE_BAG(queue->idleQueue, tmp, i) {
|
||||
if (notification->object == tmp->object &&
|
||||
strcmp(notification->name, tmp->name) == 0) {
|
||||
WMRemoveFromBag(queue->idleQueue, tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mask & WNCOnName) {
|
||||
WM_ITERATE_BAG(queue->asapQueue, tmp, i) {
|
||||
if (strcmp(notification->name, tmp->name) == 0) {
|
||||
WMRemoveFromBag(queue->asapQueue, tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
WM_ITERATE_BAG(queue->idleQueue, tmp, i) {
|
||||
if (strcmp(notification->name, tmp->name) == 0) {
|
||||
WMRemoveFromBag(queue->idleQueue, tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (mask & WNCOnSender) {
|
||||
WM_ITERATE_BAG(queue->asapQueue, tmp, i) {
|
||||
if (notification->object == tmp->object) {
|
||||
WMRemoveFromBag(queue->asapQueue, tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
WM_ITERATE_BAG(queue->idleQueue, tmp, i) {
|
||||
if (notification->object == tmp->object) {
|
||||
WMRemoveFromBag(queue->idleQueue, tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((mask & WNCOnName) && (mask & WNCOnSender))
|
||||
matchFunc = matchSenderAndName;
|
||||
else if (mask & WNCOnName)
|
||||
matchFunc = matchName;
|
||||
else if (mask & WNCOnSender)
|
||||
matchFunc = matchSender;
|
||||
else
|
||||
return;
|
||||
|
||||
WMRemoveFromArrayMatching(queue->asapQueue, matchFunc, notification);
|
||||
WMRemoveFromArrayMatching(queue->idleQueue, matchFunc, notification);
|
||||
}
|
||||
|
||||
|
||||
@@ -501,11 +500,11 @@ WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
|
||||
break;
|
||||
|
||||
case WMPostASAP:
|
||||
WMPutInBag(queue->asapQueue, notification);
|
||||
WMAddToArray(queue->asapQueue, notification);
|
||||
break;
|
||||
|
||||
case WMPostWhenIdle:
|
||||
WMPutInBag(queue->idleQueue, notification);
|
||||
WMAddToArray(queue->idleQueue, notification);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -517,12 +516,9 @@ W_FlushASAPNotificationQueue()
|
||||
WMNotificationQueue *queue = notificationQueueList;
|
||||
|
||||
while (queue) {
|
||||
while (WMGetBagItemCount(queue->asapQueue)) {
|
||||
WMNotification *tmp = WMGetFromBag(queue->asapQueue, 0);
|
||||
|
||||
WMPostNotification(tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
WMDeleteFromBag(queue->asapQueue, 0);
|
||||
while (WMGetArrayItemCount(queue->asapQueue)) {
|
||||
WMPostNotification(WMGetFromArray(queue->asapQueue, 0));
|
||||
WMDeleteFromArray(queue->asapQueue, 0);
|
||||
}
|
||||
|
||||
queue = queue->next;
|
||||
@@ -536,12 +532,9 @@ W_FlushIdleNotificationQueue()
|
||||
WMNotificationQueue *queue = notificationQueueList;
|
||||
|
||||
while (queue) {
|
||||
while (WMGetBagItemCount(queue->idleQueue)) {
|
||||
WMNotification *tmp = WMGetFromBag(queue->idleQueue, 0);
|
||||
|
||||
WMPostNotification(tmp);
|
||||
WMReleaseNotification(tmp);
|
||||
WMDeleteFromBag(queue->idleQueue, 0);
|
||||
while (WMGetArrayItemCount(queue->idleQueue)) {
|
||||
WMPostNotification(WMGetFromArray(queue->idleQueue, 0));
|
||||
WMDeleteFromArray(queue->idleQueue, 0);
|
||||
}
|
||||
|
||||
queue = queue->next;
|
||||
|
||||
3
WINGs/po/.cvsignore
Normal file
3
WINGs/po/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
Makefile Makefile.in
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
50
WINGs/po/Makefile.am
Normal file
50
WINGs/po/Makefile.am
Normal file
@@ -0,0 +1,50 @@
|
||||
nlsdir = $(NLSDIR)
|
||||
|
||||
CATALOGS = @WINGSMOFILES@
|
||||
|
||||
CLEANFILES = $(CATALOGS) WINGs.pot
|
||||
|
||||
EXTRA_DIST = cs.po sk.po
|
||||
|
||||
POTFILES = \
|
||||
$(top_builddir)/WINGs/connection.c \
|
||||
$(top_builddir)/WINGs/error.c \
|
||||
$(top_builddir)/WINGs/findfile.c \
|
||||
$(top_builddir)/WINGs/host.c \
|
||||
$(top_builddir)/WINGs/proplist.c \
|
||||
$(top_builddir)/WINGs/userdefaults.c \
|
||||
$(top_builddir)/WINGs/wcolor.c \
|
||||
$(top_builddir)/WINGs/wcolorpanel.c \
|
||||
$(top_builddir)/WINGs/wfilepanel.c \
|
||||
$(top_builddir)/WINGs/wfont.c \
|
||||
$(top_builddir)/WINGs/wfontpanel.c \
|
||||
$(top_builddir)/WINGs/widgets.c \
|
||||
$(top_builddir)/WINGs/wruler.c
|
||||
|
||||
SUFFIXES = .po .mo
|
||||
|
||||
.po.mo:
|
||||
msgfmt -o $@ $<
|
||||
|
||||
|
||||
WINGs.pot: $(POTFILES)
|
||||
xgettext --default-domain=WINGs \
|
||||
--add-comments --keyword=_ $(POTFILES)
|
||||
if cmp -s WINGs.po WINGs.pot; then \
|
||||
rm -f WINGs.po; \
|
||||
else \
|
||||
mv -f WINGs.po WINGs.pot; \
|
||||
fi
|
||||
|
||||
install-data-local: $(CATALOGS)
|
||||
$(mkinstalldirs) $(DESTDIR)$(nlsdir)
|
||||
chmod 755 $(DESTDIR)$(nlsdir)
|
||||
for n in $(CATALOGS) __DuMmY ; do \
|
||||
if test "$$n" -a "$$n" != "__DuMmY" ; then \
|
||||
l=`basename $$n .mo`; \
|
||||
$(mkinstalldirs) $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \
|
||||
chmod 755 $(DESTDIR)$(nlsdir)/$$l; \
|
||||
chmod 755 $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES; \
|
||||
$(INSTALL_DATA) -m 644 $$n $(DESTDIR)$(nlsdir)/$$l/LC_MESSAGES/WINGs.mo; \
|
||||
fi; \
|
||||
done
|
||||
14
WINGs/po/README
Normal file
14
WINGs/po/README
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
Instructions for translating po files can be found in the po/README directory
|
||||
in the top of the WindowMaker source tree.
|
||||
|
||||
File Language Note Current Maintainer
|
||||
------------------------------------------------------------------------------
|
||||
cs.po Czech 1 Jiri Hnidek <Jiri.Hnidek@vslib.cz
|
||||
sk.po Slovak 1 Jan 'judas' Tomka <judas@linux.sk>
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
1. Uses iso8859-2 character set.
|
||||
|
||||
663
WINGs/po/cs.po
Normal file
663
WINGs/po/cs.po
Normal file
@@ -0,0 +1,663 @@
|
||||
# Czech messages for WINGs
|
||||
# (C) 2001 Jiøí Hnídek
|
||||
# Special thanks to Jan "judas" Tomka
|
||||
#
|
||||
# Original translation by Jiøí Hnídek on Oct 11 2001
|
||||
# Currently maintained by Jiøí Hnídek <jiri.hnidek@vslib.cz>
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WINGs 0.70.0\n"
|
||||
"POT-Creation-Date: 2001-10-11 19:10+0100\n"
|
||||
"PO-Revision-Date: 2001-10-11 22:00+0100\n"
|
||||
"Last-Translator: Jiøí Hnídek <jiri.hnidek@vslib.cz>\n"
|
||||
"Language-Team: Czech <cz@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-2\n"
|
||||
"Content-Transfer-Encoding: unknown\n"
|
||||
|
||||
#: ../../WINGs/connection.c:451 ../../WINGs/connection.c:516
|
||||
#: ../../WINGs/connection.c:559
|
||||
msgid "Bad address-service-protocol combination"
|
||||
msgstr "Nesprávná kombinace adresa-slu¾ba-protokol"
|
||||
|
||||
#: ../../WINGs/dragsource.c:541
|
||||
msgid "DND selection lost during drag operation..."
|
||||
msgstr "DND výbìr se ztratil bìhem opere táhnutí..."
|
||||
|
||||
#: ../../WINGs/dragsource.c:610
|
||||
#, c-format
|
||||
msgid "drag & drop timed out while waiting for response from 0x%x\n"
|
||||
msgstr "èas pro drag & drop vypr¹el bìhem èekání na odpoveï z 0x%x\n"
|
||||
|
||||
#: ../../WINGs/dragsource.c:728
|
||||
msgid "could not get ownership or DND selection"
|
||||
msgstr "nemo¾né získat vlastnictví nebo DND výbìr"
|
||||
|
||||
#: ../../WINGs/dragsource.c:898
|
||||
#, c-format
|
||||
msgid "drag source received unexpected XdndFinished message from %x"
|
||||
msgstr "zdroj tahání pøijal neoèekávanou zprávu XdndFinished z %x"
|
||||
|
||||
#: ../../WINGs/dragsource.c:1040
|
||||
#, c-format
|
||||
msgid "unknown XDND action %s from 0x%x"
|
||||
msgstr "neznámá XDND akce %s z 0x%x"
|
||||
|
||||
#: ../../WINGs/dragsource.c:1073
|
||||
msgid "received invalid drag & drop type list"
|
||||
msgstr "pøijatý nesprávný seznam typù drag & drop"
|
||||
|
||||
#: ../../WINGs/dragsource.c:1161
|
||||
msgid "received Enter event in bad order"
|
||||
msgstr "pøijatá událost Enter v nesprávném poøadí"
|
||||
|
||||
#: ../../WINGs/dragsource.c:1168
|
||||
#, c-format
|
||||
msgid "received drag & drop request with unsupported version %i"
|
||||
msgstr "pøijatý po¾adavek drag & drop s nepodporovanou verzí %i"
|
||||
|
||||
#: ../../WINGs/error.c:56
|
||||
#, c-format
|
||||
msgid "Unknown error %d"
|
||||
msgstr "Neznámá chyba %d"
|
||||
|
||||
#: ../../WINGs/error.c:61
|
||||
#, c-format
|
||||
msgid "Error %d"
|
||||
msgstr "Chyba %d"
|
||||
|
||||
#: ../../WINGs/error.c:112
|
||||
msgid " warning: "
|
||||
msgstr " varovíní: "
|
||||
|
||||
#: ../../WINGs/error.c:139
|
||||
msgid " fatal error: "
|
||||
msgstr " fatální chyba: "
|
||||
|
||||
#: ../../WINGs/error.c:165 ../../WINGs/error.c:194
|
||||
msgid " error: "
|
||||
msgstr " chyba: "
|
||||
|
||||
#: ../../WINGs/findfile.c:50
|
||||
#, c-format
|
||||
msgid "could not get password entry for UID %i"
|
||||
msgstr "nemo¾né zjistit informaci o UID %i"
|
||||
|
||||
#: ../../WINGs/findfile.c:68
|
||||
#, c-format
|
||||
msgid "could not get password entry for user %s"
|
||||
msgstr "nemo¾né zjistit informaci o u¾ivatelovi %s"
|
||||
|
||||
#: ../../WINGs/hashtable.c:275
|
||||
msgid "rebuilding hash table...\n"
|
||||
msgstr "pøepis tabulky hashovských funkcí...\n"
|
||||
|
||||
#: ../../WINGs/hashtable.c:279
|
||||
msgid "finished rebuild.\n"
|
||||
msgstr "konec pøepisu.\n"
|
||||
|
||||
#: ../../WINGs/host.c:116
|
||||
msgid "Cannot get current host name"
|
||||
msgstr "Nemo¾né zjistit aktuální jméno poèítaèe"
|
||||
|
||||
#: ../../WINGs/memory.c:94
|
||||
msgid "malloc() failed. Retrying after 2s."
|
||||
msgstr "chyba malloc(). Nový pokus o 2s."
|
||||
|
||||
#: ../../WINGs/memory.c:103
|
||||
msgid "Really Bad Error: recursive malloc() failure."
|
||||
msgstr "Skuteènì o¹klivá chyba: rekurzivní chyba malloc()."
|
||||
|
||||
#: ../../WINGs/memory.c:106 ../../WINGs/memory.c:146
|
||||
msgid "virtual memory exhausted"
|
||||
msgstr "virtuální pamì» vyèerpaná"
|
||||
|
||||
#: ../../WINGs/memory.c:133
|
||||
msgid "realloc() failed. Retrying after 2s."
|
||||
msgstr "chyba realloc(). Nový pokus o 2s."
|
||||
|
||||
#: ../../WINGs/memory.c:142
|
||||
msgid "Really Bad Error: recursive realloc() failure."
|
||||
msgstr "Skuteènì o¹klivá chyba: rekurzivní chyba realloc()."
|
||||
|
||||
#: ../../WINGs/memory.c:205
|
||||
#, c-format
|
||||
msgid "trying to release unexisting data %p"
|
||||
msgstr "pokus uvolnit neexistujícá data %p"
|
||||
|
||||
#: ../../WINGs/memory.c:210
|
||||
#, c-format
|
||||
msgid "RELEASING %p\n"
|
||||
msgstr "UVOLNÌNÍ %p\n"
|
||||
|
||||
#: ../../WINGs/wcolor.c:198 ../../WINGs/wcolor.c:211 ../../WINGs/wcolor.c:250
|
||||
#: ../../WINGs/wcolor.c:291
|
||||
#, c-format
|
||||
msgid "could not allocate %s color"
|
||||
msgstr "nemo¾né alokovat %s barvu"
|
||||
|
||||
#: ../../WINGs/wcolor.c:198
|
||||
msgid "white"
|
||||
msgstr "bílou"
|
||||
|
||||
#: ../../WINGs/wcolor.c:211
|
||||
msgid "black"
|
||||
msgstr "èernou"
|
||||
|
||||
#: ../../WINGs/wcolor.c:250
|
||||
msgid "gray"
|
||||
msgstr "¹edou"
|
||||
|
||||
#: ../../WINGs/wcolor.c:291
|
||||
msgid "dark gray"
|
||||
msgstr "tmavì ¹edou"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:410
|
||||
msgid "Colors"
|
||||
msgstr "Barvy"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:600 ../../WINGs/wcolorpanel.c:2819
|
||||
msgid "Brightness"
|
||||
msgstr "Svìtlost"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:602 ../../WINGs/wcolorpanel.c:678
|
||||
#: ../../WINGs/wcolorpanel.c:711 ../../WINGs/wcolorpanel.c:745
|
||||
#: ../../WINGs/wcolorpanel.c:805 ../../WINGs/wcolorpanel.c:839
|
||||
#: ../../WINGs/wcolorpanel.c:873 ../../WINGs/wcolorpanel.c:908
|
||||
#: ../../WINGs/wcolorpanel.c:2159 ../../WINGs/wcolorpanel.c:2821
|
||||
#: ../../WINGs/wcolorpanel.c:2857 ../../WINGs/wcolorpanel.c:2893
|
||||
#: ../../WINGs/wcolorpanel.c:3741
|
||||
msgid "Color Panel: Could not allocate memory"
|
||||
msgstr "Panel barev: Nemo¾né alokovat pamì»"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:675 ../../WINGs/wcolorpanel.c:676
|
||||
msgid "Red"
|
||||
msgstr "Èervená"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:708 ../../WINGs/wcolorpanel.c:709
|
||||
msgid "Green"
|
||||
msgstr "Zelená"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:742 ../../WINGs/wcolorpanel.c:743
|
||||
msgid "Blue"
|
||||
msgstr "Modrá"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:802 ../../WINGs/wcolorpanel.c:803
|
||||
msgid "Cyan"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:836 ../../WINGs/wcolorpanel.c:837
|
||||
msgid "Magenta"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:870 ../../WINGs/wcolorpanel.c:871
|
||||
msgid "Yellow"
|
||||
msgstr "®lutá"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:905 ../../WINGs/wcolorpanel.c:906
|
||||
msgid "Black"
|
||||
msgstr "Èerná"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:986
|
||||
msgid "Spectrum"
|
||||
msgstr "Spektrum"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1016
|
||||
msgid "Palette"
|
||||
msgstr "Paleta"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1022
|
||||
msgid "New from File..."
|
||||
msgstr "Nová ze souboru..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1023 ../../WINGs/wcolorpanel.c:1071
|
||||
#: ../../WINGs/wcolorpanel.c:1088
|
||||
msgid "Rename..."
|
||||
msgstr "Pøejmenovat..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1024 ../../WINGs/wcolorpanel.c:1072
|
||||
#: ../../WINGs/wcolorpanel.c:1089 ../../WINGs/wcolorpanel.c:3316
|
||||
msgid "Remove"
|
||||
msgstr "Odstranit"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1025
|
||||
msgid "Copy"
|
||||
msgstr "Kopírovat"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1026
|
||||
msgid "New from Clipboard"
|
||||
msgstr "Nová ze schránky"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1047
|
||||
msgid "X11-Colors"
|
||||
msgstr "Barvy X11"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1064
|
||||
msgid "Color"
|
||||
msgstr "Barva"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1070
|
||||
msgid "Add..."
|
||||
msgstr "Pøidat..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1080
|
||||
msgid "List"
|
||||
msgstr "Seznam"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1087
|
||||
msgid "New..."
|
||||
msgstr "Nový..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1226
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Color Panel: Could not create directory %s needed to store configurations"
|
||||
msgstr ""
|
||||
"Panel barev: Nemo¾né vytvoøit adresáø %s potøebný k ulo¾ení nastavení"
|
||||
|
||||
#. Delete the file, it doesn't belong here
|
||||
#: ../../WINGs/wcolorpanel.c:1232 ../../WINGs/wcolorpanel.c:3202
|
||||
#: ../../WINGs/wcolorpanel.c:3206
|
||||
msgid "File Error"
|
||||
msgstr "Chyba souboru"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1233
|
||||
msgid "Could not create ColorPanel configuration directory"
|
||||
msgstr "Nemo¾né vytvoøit konfiguraèní adresáø panelu barev"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1234 ../../WINGs/wcolorpanel.c:3203
|
||||
#: ../../WINGs/wcolorpanel.c:3208 ../../WINGs/wcolorpanel.c:3235
|
||||
#: ../../WINGs/wfilepanel.c:243 ../../WINGs/wfilepanel.c:641
|
||||
#: ../../WINGs/wfilepanel.c:653 ../../WINGs/wfilepanel.c:752
|
||||
#: ../../WINGs/wfilepanel.c:963 ../../WINGs/wfontpanel.c:717
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1240 ../../WINGs/wcolorpanel.c:1276
|
||||
#: ../../WINGs/wcolorpanel.c:1294
|
||||
msgid "Color Panel: Could not find file"
|
||||
msgstr "Panel barev: Nemo¾né nalézt soubor"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1481 ../../WINGs/wcolorpanel.c:1546
|
||||
#: ../../WINGs/wcolorpanel.c:1610
|
||||
msgid "Color Panel: X failed request"
|
||||
msgstr "Panel barev: chyba po¾adavku X"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:2855
|
||||
msgid "Saturation"
|
||||
msgstr "Saturace"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:2891
|
||||
msgid "Hue"
|
||||
msgstr "Odteï"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3141
|
||||
msgid "Open Palette"
|
||||
msgstr "Otevøít paletu"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3203
|
||||
msgid "Invalid file format !"
|
||||
msgstr "Nesprávný souborový formát!"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3205
|
||||
#, c-format
|
||||
msgid "can't remove file %s"
|
||||
msgstr "nemo¾né odstranit soubor %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3207
|
||||
msgid "Couldn't remove file from Configuration Directory !"
|
||||
msgstr "Nemo¾né odstranit soubor z konfiguraèního adresáøe!"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3234
|
||||
msgid "Rename"
|
||||
msgstr "Pøejmenovat"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3234
|
||||
msgid "Rename palette to:"
|
||||
msgstr "Pøejmenovat paletu:"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3235 ../../WINGs/wfilepanel.c:252
|
||||
#: ../../WINGs/wfilepanel.c:653 ../../WINGs/wfilepanel.c:752
|
||||
msgid "Cancel"
|
||||
msgstr "Zru¹it"
|
||||
|
||||
#. Careful, this palette exists already
|
||||
#: ../../WINGs/wcolorpanel.c:3251 ../../WINGs/wfilepanel.c:752
|
||||
msgid "Warning"
|
||||
msgstr "Varování"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3252
|
||||
msgid ""
|
||||
"Palette already exists !\n"
|
||||
"\n"
|
||||
"Overwrite ?"
|
||||
msgstr ""
|
||||
"Paleta u¾ existuje!\n"
|
||||
"\n"
|
||||
"Pøepsat?"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3252 ../../WINGs/wcolorpanel.c:3316
|
||||
msgid "No"
|
||||
msgstr "Ne"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3252 ../../WINGs/wcolorpanel.c:3316
|
||||
msgid "Yes"
|
||||
msgstr "Ano"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3284
|
||||
#, c-format
|
||||
msgid "Couldn't rename palette %s to %s\n"
|
||||
msgstr "Nemo¾né pøejmenovat paletu %s na %s\n"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3310
|
||||
msgid "This will permanently remove the palette "
|
||||
msgstr "Paleta bude natrvalo smazaná"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3313
|
||||
msgid ""
|
||||
".\n"
|
||||
"\n"
|
||||
"Are you sure you want to remove this palette ?"
|
||||
msgstr ""
|
||||
".\n"
|
||||
"\n"
|
||||
"Jste si jisti, ¾e chcete odstranit tuto paletu?"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3338
|
||||
#, c-format
|
||||
msgid "Couldn't remove palette %s\n"
|
||||
msgstr "Nemo¾né odstranit paletu %s\n"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3643
|
||||
#, c-format
|
||||
msgid "Could not open %s"
|
||||
msgstr "Nemo¾né otevøít %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3650
|
||||
#, c-format
|
||||
msgid "Could not create %s"
|
||||
msgstr "Nemo¾né vytvoøit %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3661
|
||||
#, c-format
|
||||
msgid "Write error on file %s"
|
||||
msgstr "Chyba pøi zápisu do souboru %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3706
|
||||
msgid "Color Panel: Color unspecified"
|
||||
msgstr "Panel barev: Nespecifikovaná barva"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:228
|
||||
msgid "Name:"
|
||||
msgstr "Jméno:"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:325 ../../WINGs/wfilepanel.c:390
|
||||
msgid "Open"
|
||||
msgstr "Otevøít"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:343 ../../WINGs/wfilepanel.c:396
|
||||
msgid "Save"
|
||||
msgstr "Ulo¾it"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:556
|
||||
#, c-format
|
||||
msgid "WINGs: could not open directory %s\n"
|
||||
msgstr "WINGs: nemo¾né otevøít adresáø %s\n"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:574
|
||||
#, c-format
|
||||
msgid "WINGs: could not stat %s\n"
|
||||
msgstr "WINGs: nemo¾né zjistit informace o %s\n"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:641 ../../WINGs/wfilepanel.c:962
|
||||
#: ../../WINGs/wfontpanel.c:716
|
||||
msgid "Error"
|
||||
msgstr "Chyba"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:652
|
||||
msgid "Create Directory"
|
||||
msgstr "Vytvoøit adresáø"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:653
|
||||
msgid "Enter directory name"
|
||||
msgstr "Jméno adresáøe"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:689 ../../WINGs/wfilepanel.c:728
|
||||
#: ../../WINGs/wfilepanel.c:757 ../../WINGs/wfilepanel.c:785
|
||||
msgid "Permission denied."
|
||||
msgstr "Pøístup odmítnut."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:692
|
||||
#, c-format
|
||||
msgid "'%s' already exists."
|
||||
msgstr "'%s' u¾ existuje"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:695
|
||||
msgid "Path does not exist."
|
||||
msgstr "Cesta neexistuje."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:725 ../../WINGs/wfilepanel.c:782
|
||||
#, c-format
|
||||
msgid "'%s' does not exist."
|
||||
msgstr "'%s' neexistuje."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:732 ../../WINGs/wfilepanel.c:789
|
||||
msgid "Insufficient memory available."
|
||||
msgstr "Nedostatek pamìti."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:736 ../../WINGs/wfilepanel.c:793
|
||||
#, c-format
|
||||
msgid "'%s' is on a read-only filesystem."
|
||||
msgstr "'%s' je na souborovém systému jen pro ètení."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:739 ../../WINGs/wfilepanel.c:769
|
||||
#: ../../WINGs/wfilepanel.c:796
|
||||
#, c-format
|
||||
msgid "Can not delete '%s'."
|
||||
msgstr "Nemo¾né odstranit '%s'."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:745
|
||||
#, c-format
|
||||
msgid "Delete directory %s ?"
|
||||
msgstr "Odstranit adresáø %s?"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:748
|
||||
#, c-format
|
||||
msgid "Delete file %s ?"
|
||||
msgstr "Odstranit soubor %s?"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:760
|
||||
#, c-format
|
||||
msgid "Directory '%s' does not exist."
|
||||
msgstr "Adresáø '%s' neexistuje."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:763
|
||||
#, c-format
|
||||
msgid "Directory '%s' is not empty."
|
||||
msgstr "Adresáø '%s' není prázdný."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:766
|
||||
#, c-format
|
||||
msgid "Directory '%s' is busy."
|
||||
msgstr "Adresáø '%s' je pou¾ívaný."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:779
|
||||
#, c-format
|
||||
msgid "'%s' is a directory."
|
||||
msgstr "'%s' je adresáø."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:821
|
||||
#, c-format
|
||||
msgid "An error occured browsing '%s'."
|
||||
msgstr "Pøi prohlí¾ení '%s' nastala chyba."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:825
|
||||
#, c-format
|
||||
msgid "'%s' is not a directory."
|
||||
msgstr "'%s' není adresáø."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:962
|
||||
msgid "File does not exist."
|
||||
msgstr "Soubor neexistuje."
|
||||
|
||||
#: ../../WINGs/wfont.c:129
|
||||
#, c-format
|
||||
msgid "the following character sets are missing in %s:"
|
||||
msgstr "nasledující sady znakù chybí v %s:"
|
||||
|
||||
#: ../../WINGs/wfont.c:136
|
||||
#, c-format
|
||||
msgid ""
|
||||
"the string \"%s\" will be used in place of any characters from those sets."
|
||||
msgstr ""
|
||||
"øetìzec \"%s\" bude pou¾itý namísto znakù z tìchto sad."
|
||||
|
||||
#: ../../WINGs/wfont.c:282 ../../WINGs/wfont.c:318
|
||||
#, c-format
|
||||
msgid "could not load font set %s. Trying fixed."
|
||||
msgstr "nemo¾né naèíst font %s. Zkou¹í se naèíst fixed."
|
||||
|
||||
#: ../../WINGs/wfont.c:288 ../../WINGs/wfont.c:324
|
||||
#, c-format
|
||||
msgid "could not load font %s. Trying fixed."
|
||||
msgstr "nemo¾no naèíst font %s. Zko¹í se naèíst fixed."
|
||||
|
||||
#: ../../WINGs/wfont.c:292 ../../WINGs/wfont.c:328
|
||||
msgid "could not load fixed font!"
|
||||
msgstr "nemo¾né naèíst font fixed!"
|
||||
|
||||
#: ../../WINGs/wfont.c:423
|
||||
#, c-format
|
||||
msgid "font description %s is too large."
|
||||
msgstr "popis fontu %s je pøíli¹ velký."
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:205
|
||||
msgid "Test!!!"
|
||||
msgstr "Zkou¹ka!!!"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:211
|
||||
msgid "Family"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:222
|
||||
msgid "Typeface"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:233
|
||||
msgid "Size"
|
||||
msgstr "Velikost"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:252
|
||||
msgid "Set"
|
||||
msgstr "Sada"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:257
|
||||
msgid "Revert"
|
||||
msgstr "Zpìt"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:717
|
||||
msgid "Could not retrieve font list"
|
||||
msgstr "Nemo¾né obdr¾et seznam fontù"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:729
|
||||
#, c-format
|
||||
msgid "font name %s is longer than 256, which is invalid."
|
||||
msgstr "jméno fontu %s je del¹í ne¾ 256, co¾ je ¹patnì."
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:880
|
||||
msgid "Roman"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:883
|
||||
msgid "Italic"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:885
|
||||
msgid "Oblique"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:887
|
||||
msgid "Rev Italic"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:889
|
||||
msgid "Rev Oblique"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:895
|
||||
msgid "Normal"
|
||||
msgstr "Normílní"
|
||||
|
||||
#: ../../WINGs/widgets.c:414
|
||||
#, c-format
|
||||
msgid "WINGs: could not load widget images file: %s"
|
||||
msgstr "WINGs: nemo¾né naèíst soubor s obrázky pro widgety: %s"
|
||||
|
||||
#: ../../WINGs/widgets.c:525
|
||||
#, c-format
|
||||
msgid "WINGs: could not open display %s"
|
||||
msgstr "WINGs: nemo¾né otevøít display %s"
|
||||
|
||||
#: ../../WINGs/widgets.c:717
|
||||
msgid ""
|
||||
"could not load any fonts. Make sure your font installationand locale "
|
||||
"settings are correct."
|
||||
msgstr ""
|
||||
"nemo¾né naèíst ¾ádný font. Ubezpeète se, ¾e instalace fontù a místního "
|
||||
"nastavení jsou v poøádku."
|
||||
|
||||
#: ../../WINGs/wruler.c:189
|
||||
msgid "0 inches"
|
||||
msgstr "0 palcù"
|
||||
|
||||
#: ../../WINGs/wtext.c:1212
|
||||
msgid "...for this app will surely crash :-)\n"
|
||||
msgstr "...pro tuto aplikaci to urèitì spadne :-)\n"
|
||||
|
||||
#: ../../WINGs/wtext.c:2084
|
||||
msgid "didn't get it\n"
|
||||
msgstr "nedosa¾eno\n"
|
||||
|
||||
#: ../../WINGs/wtext.c:2726
|
||||
#, c-format
|
||||
msgid "type is [%s]\n"
|
||||
msgstr "typ je [%s]\n"
|
||||
|
||||
#: ../../WINGs/wtext.c:2797
|
||||
msgid "could not request data for dropped data"
|
||||
msgstr "nemohou být vy¾ádána data pro polo¾ená data"
|
||||
|
||||
#: ../../WINGs/wtext.c:2995
|
||||
msgid "could not create text's view\n"
|
||||
msgstr "nemo¾né zobrazit text\n"
|
||||
|
||||
#: ../../WINGs/wview.c:219
|
||||
msgid "trying to realize widget of unrealized parent"
|
||||
msgstr "snaha vytvoøit widget neexistujícího rodièe objektu"
|
||||
|
||||
#: ../../WINGs/wview.c:267
|
||||
msgid "trying to reparent realized view to unrealized parent"
|
||||
msgstr ""
|
||||
|
||||
#: ../../WINGs/wtextfield.c:490
|
||||
msgid "only left alignment is supported in textfields"
|
||||
msgstr "pro textové pole je povolené jen levé zarovnání"
|
||||
|
||||
#pozor, co je STRING?
|
||||
#: ../../WINGs/wwindow.c:222
|
||||
msgid "window title conversion error... using STRING encoding"
|
||||
msgstr "chyba konverze titulku okna... pou¾ije se kódovaní STRING"
|
||||
|
||||
#: ../../WINGs/wwindow.c:313
|
||||
msgid "could not allocate memory for window size hints"
|
||||
msgstr "nemo¾né alokovat pamì» pro pokyny velikosti okna"
|
||||
|
||||
#: ../../WINGs/wwindow.c:586
|
||||
msgid "could not allocate memory for WM hints"
|
||||
msgstr "nemo¾né alokovat pamì» pro pokyny WM"
|
||||
|
||||
#: ../../WINGs/wwindow.c:627
|
||||
msgid "icon title conversion error..using STRING encoding"
|
||||
msgstr "chyba konverze titulku ikony... pou¾ije se kódovaní STRING"
|
||||
|
||||
668
WINGs/po/sk.po
Normal file
668
WINGs/po/sk.po
Normal file
@@ -0,0 +1,668 @@
|
||||
# Slovak messages for WINGs
|
||||
# (C) 2001 Jan "judas" Tomka
|
||||
#
|
||||
# Original translation by Jan "judas" Tomka on Feb 25 2001
|
||||
# Currently maintained by Jan "judas" Tomka <judas@linux.sk>
|
||||
#
|
||||
# Version history:
|
||||
# WM-ver author email date
|
||||
# 0.65.1 Jan "judas" Tomka <judas@linux.sk> Aug 08 2001
|
||||
# 0.70.0 Jan "judas" Tomka <judas@linux.sk> Oct 15 2001
|
||||
# 0.70.1 Jan "judas" Tomka <judas@linux.sk> Nov 02 2001
|
||||
# 0.80.0 Jan "judas" Tomka <judas@linux.sk> Dec 20 2001
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WINGs 0.80.0\n"
|
||||
"POT-Creation-Date: 2001-12-20 03:50+0100\n"
|
||||
"PO-Revision-Date: 2001-12-20 04:00+0100\n"
|
||||
"Last-Translator: Jan \"judas\" Tomka <judas@linux.sk>\n"
|
||||
"Language-Team: Slovak <sk@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../../WINGs/connection.c:461 ../../WINGs/connection.c:526
|
||||
#: ../../WINGs/connection.c:569
|
||||
msgid "Bad address-service-protocol combination"
|
||||
msgstr "Nesprávna kombinácia adresa-slu¾ba-protokol"
|
||||
|
||||
#: ../../WINGs/error.c:54
|
||||
#, c-format
|
||||
msgid "Unknown error %d"
|
||||
msgstr "Nezmána chyba %d"
|
||||
|
||||
#: ../../WINGs/error.c:59
|
||||
#, c-format
|
||||
msgid "Error %d"
|
||||
msgstr "Chyba %d"
|
||||
|
||||
#: ../../WINGs/error.c:110
|
||||
msgid " warning: "
|
||||
msgstr " varovanie: "
|
||||
|
||||
#: ../../WINGs/error.c:137
|
||||
msgid " fatal error: "
|
||||
msgstr " fatálna chyba: "
|
||||
|
||||
#: ../../WINGs/error.c:163 ../../WINGs/error.c:192
|
||||
msgid " error: "
|
||||
msgstr " chyba: "
|
||||
|
||||
#: ../../WINGs/findfile.c:48
|
||||
#, c-format
|
||||
msgid "could not get password entry for UID %i"
|
||||
msgstr "nemo¾no zisti» informácie o UID %i"
|
||||
|
||||
#: ../../WINGs/findfile.c:66
|
||||
#, c-format
|
||||
msgid "could not get password entry for user %s"
|
||||
msgstr "nemo¾no zisti» informácie o u¾ívateµovi %s"
|
||||
|
||||
#: ../../WINGs/host.c:114
|
||||
msgid "Cannot get current host name"
|
||||
msgstr "Nemo¾no zisti» aktuálne meno poèítaèa"
|
||||
|
||||
#: ../../WINGs/proplist.c:150
|
||||
msgid "Only string or data is supported for a proplist dictionary key"
|
||||
msgstr "Pre kµúè slovníka proplist je podporovaný len re»azec alebo dáta"
|
||||
|
||||
#: ../../WINGs/proplist.c:184 ../../WINGs/proplist.c:236
|
||||
#: ../../WINGs/proplist.c:394 ../../WINGs/proplist.c:474
|
||||
#: ../../WINGs/proplist.c:1071 ../../WINGs/proplist.c:1123
|
||||
#: ../../WINGs/proplist.c:1251 ../../WINGs/proplist.c:1330
|
||||
#: ../../WINGs/proplist.c:1451 ../../WINGs/proplist.c:1498
|
||||
msgid "Used proplist functions on non-WMPropLists objects"
|
||||
msgstr "Pou¾itá proplist funkcia na iných ako WMPropLists objektoch"
|
||||
|
||||
#: ../../WINGs/proplist.c:630
|
||||
msgid "unterminated PropList string"
|
||||
msgstr "neukonèený PropList re»azec"
|
||||
|
||||
#: ../../WINGs/proplist.c:670
|
||||
msgid "unterminated PropList data"
|
||||
msgstr "neukonèené PropList dáta"
|
||||
|
||||
#: ../../WINGs/proplist.c:678
|
||||
msgid "unterminated PropList data (missing hexdigit)"
|
||||
msgstr "neukonèené PropList dáta (chýbajúca hex èíslica)"
|
||||
|
||||
#: ../../WINGs/proplist.c:690
|
||||
msgid "non hexdigit character in PropList data"
|
||||
msgstr "v PropList dátach je znak, ktorý nie je hex èíslicou"
|
||||
|
||||
#: ../../WINGs/proplist.c:725
|
||||
msgid "unterminated PropList array"
|
||||
msgstr "neukonèené PropList pole"
|
||||
|
||||
#: ../../WINGs/proplist.c:733
|
||||
msgid "missing or unterminated PropList array"
|
||||
msgstr "chýbajúce alebo neukonèené PropList pole"
|
||||
|
||||
#: ../../WINGs/proplist.c:743
|
||||
msgid "could not get PropList array element"
|
||||
msgstr "nemo¾no zisti» prvok PropList poµa"
|
||||
|
||||
#: ../../WINGs/proplist.c:772
|
||||
msgid "unterminated PropList dictionary"
|
||||
msgstr "neukonèený PropList slovník"
|
||||
|
||||
#: ../../WINGs/proplist.c:789
|
||||
msgid "missing PropList dictionary key"
|
||||
msgstr "chýbajúci kµúè PropList slovníka"
|
||||
|
||||
#: ../../WINGs/proplist.c:791
|
||||
msgid "missing PropList dictionary entry key or unterminated dictionary"
|
||||
msgstr "chýbajúci kµúè polo¾ky PropList slovníka alebo neukonèený slovník"
|
||||
|
||||
#: ../../WINGs/proplist.c:799
|
||||
msgid "error parsing PropList dictionary key"
|
||||
msgstr "chyba pri parsovaní kµúèa PropList slovníka"
|
||||
|
||||
#: ../../WINGs/proplist.c:807
|
||||
msgid "missing = in PropList dictionary entry"
|
||||
msgstr "chýbajúce = v polo¾ke PropList slovníka"
|
||||
|
||||
#: ../../WINGs/proplist.c:815
|
||||
msgid "error parsing PropList dictionary entry value"
|
||||
msgstr "chyba pri parsovaní hodnoty polo¾ky PropList slovníka"
|
||||
|
||||
#: ../../WINGs/proplist.c:823
|
||||
msgid "missing ; in PropList dictionary entry"
|
||||
msgstr "chýbajúca ; v polo¾ke PropList slovníka"
|
||||
|
||||
#: ../../WINGs/proplist.c:884
|
||||
msgid ""
|
||||
"was expecting a string, data, array or dictionary. If it's a string, try "
|
||||
"enclosing it with \"."
|
||||
msgstr ""
|
||||
"oèakávaný bol re»azec, dáta, pole alebo slovník. Ak je to re»azec, skúste ho "
|
||||
"uzavrie» medzi \"."
|
||||
|
||||
#: ../../WINGs/proplist.c:888
|
||||
msgid "Comments are not allowed inside WindowMaker owned domain files."
|
||||
msgstr "Komentáre v doménových súboroch Window Makera nie sú povolené."
|
||||
|
||||
#: ../../WINGs/proplist.c:1521 ../../WINGs/proplist.c:1586
|
||||
msgid "extra data after end of property list"
|
||||
msgstr "prebytoèné dáta na konci property listu"
|
||||
|
||||
#: ../../WINGs/proplist.c:1564
|
||||
#, c-format
|
||||
msgid "could not get size for file '%s'"
|
||||
msgstr "nemo¾no zisti» veµkos» súboru '%s'"
|
||||
|
||||
#: ../../WINGs/proplist.c:1576
|
||||
#, c-format
|
||||
msgid "error reading from file '%s'"
|
||||
msgstr "chyba pri èítaní zo súboru '%s'"
|
||||
|
||||
#: ../../WINGs/proplist.c:1627
|
||||
#, c-format
|
||||
msgid "mkstemp (%s) failed"
|
||||
msgstr "chyba mkstemp (%s)"
|
||||
|
||||
#: ../../WINGs/proplist.c:1638
|
||||
#, c-format
|
||||
msgid "mktemp (%s) failed"
|
||||
msgstr "chyba mktemp(%s)"
|
||||
|
||||
#: ../../WINGs/proplist.c:1649
|
||||
#, c-format
|
||||
msgid "open (%s) failed"
|
||||
msgstr "chyba pri otváraní (%s)"
|
||||
|
||||
#: ../../WINGs/proplist.c:1656
|
||||
#, c-format
|
||||
msgid "writing to file: %s failed"
|
||||
msgstr "chyba pri zápise do súboru: %s"
|
||||
|
||||
#: ../../WINGs/proplist.c:1664
|
||||
#, c-format
|
||||
msgid "fclose (%s) failed"
|
||||
msgstr "chyba fclose (%s)"
|
||||
|
||||
#: ../../WINGs/proplist.c:1673
|
||||
#, c-format
|
||||
msgid "rename ('%s' to '%s') failed"
|
||||
msgstr "chyba rename ('%s' na '%s')"
|
||||
|
||||
#. something happened with the file. just overwrite it
|
||||
#: ../../WINGs/userdefaults.c:192 ../../WINGs/userdefaults.c:208
|
||||
#, c-format
|
||||
msgid "cannot read domain from file '%s' when syncing"
|
||||
msgstr "nemo¾no èíta» doménu zo súboru '%s' pri synchronizácii"
|
||||
|
||||
#: ../../WINGs/wcolor.c:198 ../../WINGs/wcolor.c:211 ../../WINGs/wcolor.c:250
|
||||
#: ../../WINGs/wcolor.c:291
|
||||
#, c-format
|
||||
msgid "could not allocate %s color"
|
||||
msgstr "nemo¾no alokova» %s farbu"
|
||||
|
||||
#: ../../WINGs/wcolor.c:198
|
||||
msgid "white"
|
||||
msgstr "bielu"
|
||||
|
||||
#: ../../WINGs/wcolor.c:211
|
||||
msgid "black"
|
||||
msgstr "èiernu"
|
||||
|
||||
#: ../../WINGs/wcolor.c:250
|
||||
msgid "gray"
|
||||
msgstr "¹edú"
|
||||
|
||||
#: ../../WINGs/wcolor.c:291
|
||||
msgid "dark gray"
|
||||
msgstr "tmavo¹edú"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:415
|
||||
msgid "Colors"
|
||||
msgstr "Farby"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:605 ../../WINGs/wcolorpanel.c:2824
|
||||
msgid "Brightness"
|
||||
msgstr "Svetlos»"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:607 ../../WINGs/wcolorpanel.c:683
|
||||
#: ../../WINGs/wcolorpanel.c:716 ../../WINGs/wcolorpanel.c:750
|
||||
#: ../../WINGs/wcolorpanel.c:810 ../../WINGs/wcolorpanel.c:844
|
||||
#: ../../WINGs/wcolorpanel.c:878 ../../WINGs/wcolorpanel.c:913
|
||||
#: ../../WINGs/wcolorpanel.c:2164 ../../WINGs/wcolorpanel.c:2826
|
||||
#: ../../WINGs/wcolorpanel.c:2862 ../../WINGs/wcolorpanel.c:2898
|
||||
#: ../../WINGs/wcolorpanel.c:3746
|
||||
msgid "Color Panel: Could not allocate memory"
|
||||
msgstr "Panel farieb: Nemo¾no alokova» pamä»"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:680 ../../WINGs/wcolorpanel.c:681
|
||||
msgid "Red"
|
||||
msgstr "Èervená"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:713 ../../WINGs/wcolorpanel.c:714
|
||||
msgid "Green"
|
||||
msgstr "Zelená"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:747 ../../WINGs/wcolorpanel.c:748
|
||||
msgid "Blue"
|
||||
msgstr "Modrá"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:807 ../../WINGs/wcolorpanel.c:808
|
||||
msgid "Cyan"
|
||||
msgstr "Azúrová"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:841 ../../WINGs/wcolorpanel.c:842
|
||||
msgid "Magenta"
|
||||
msgstr "Purpurová"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:875 ../../WINGs/wcolorpanel.c:876
|
||||
msgid "Yellow"
|
||||
msgstr "®ltá"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:910 ../../WINGs/wcolorpanel.c:911
|
||||
msgid "Black"
|
||||
msgstr "Èierna"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:991
|
||||
msgid "Spectrum"
|
||||
msgstr "Spektrum"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1021
|
||||
msgid "Palette"
|
||||
msgstr "Paleta"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1027
|
||||
msgid "New from File..."
|
||||
msgstr "Nová zo súboru..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1028 ../../WINGs/wcolorpanel.c:1076
|
||||
#: ../../WINGs/wcolorpanel.c:1093
|
||||
msgid "Rename..."
|
||||
msgstr "Premenova»..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1029 ../../WINGs/wcolorpanel.c:1077
|
||||
#: ../../WINGs/wcolorpanel.c:1094 ../../WINGs/wcolorpanel.c:3321
|
||||
msgid "Remove"
|
||||
msgstr "Odstráni»"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1030
|
||||
msgid "Copy"
|
||||
msgstr "Kopírova»"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1031
|
||||
msgid "New from Clipboard"
|
||||
msgstr "Nová z nástenky"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1052
|
||||
msgid "X11-Colors"
|
||||
msgstr "Farby X11"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1069
|
||||
msgid "Color"
|
||||
msgstr "Farba"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1075
|
||||
msgid "Add..."
|
||||
msgstr "Prida»..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1085
|
||||
msgid "List"
|
||||
msgstr "Zoznam"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1092
|
||||
msgid "New..."
|
||||
msgstr "Nový..."
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1231
|
||||
#, c-format
|
||||
msgid ""
|
||||
"Color Panel: Could not create directory %s needed to store configurations"
|
||||
msgstr ""
|
||||
"Panel farieb: Nemo¾no vytvori» adresár %s potrebný na ulo¾enie nastavení"
|
||||
|
||||
#. Delete the file, it doesn't belong here
|
||||
#: ../../WINGs/wcolorpanel.c:1237 ../../WINGs/wcolorpanel.c:3207
|
||||
#: ../../WINGs/wcolorpanel.c:3211
|
||||
msgid "File Error"
|
||||
msgstr "Chyba súboru"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1238
|
||||
msgid "Could not create ColorPanel configuration directory"
|
||||
msgstr "Nemo¾no vytvori» konfiguraèný adresár panelu farieb"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1239 ../../WINGs/wcolorpanel.c:3208
|
||||
#: ../../WINGs/wcolorpanel.c:3213 ../../WINGs/wcolorpanel.c:3240
|
||||
#: ../../WINGs/wfilepanel.c:250 ../../WINGs/wfilepanel.c:647
|
||||
#: ../../WINGs/wfilepanel.c:659 ../../WINGs/wfilepanel.c:760
|
||||
#: ../../WINGs/wfilepanel.c:971 ../../WINGs/wfontpanel.c:709
|
||||
msgid "OK"
|
||||
msgstr "OK"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1245 ../../WINGs/wcolorpanel.c:1281
|
||||
#: ../../WINGs/wcolorpanel.c:1299
|
||||
msgid "Color Panel: Could not find file"
|
||||
msgstr "Panel farieb: Nemo¾no nájs» súbor"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:1486 ../../WINGs/wcolorpanel.c:1551
|
||||
#: ../../WINGs/wcolorpanel.c:1615
|
||||
msgid "Color Panel: X failed request"
|
||||
msgstr "Panel farieb: chyba po¾iadavky X"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:2860
|
||||
msgid "Saturation"
|
||||
msgstr "Saturácia"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:2896
|
||||
msgid "Hue"
|
||||
msgstr "Odtieò"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3146
|
||||
msgid "Open Palette"
|
||||
msgstr "Otvori» paletu"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3208
|
||||
msgid "Invalid file format !"
|
||||
msgstr "Nesprávny súborový formát!"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3210
|
||||
#, c-format
|
||||
msgid "can't remove file %s"
|
||||
msgstr "namo¾no odstráni» súbor %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3212
|
||||
msgid "Couldn't remove file from Configuration Directory !"
|
||||
msgstr "Nemo¾no odstráni» súbor z konfiguraèného adresára!"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3239
|
||||
msgid "Rename"
|
||||
msgstr "Premenova»"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3239
|
||||
msgid "Rename palette to:"
|
||||
msgstr "Premenova» paletu:"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3240 ../../WINGs/wfilepanel.c:259
|
||||
#: ../../WINGs/wfilepanel.c:659 ../../WINGs/wfilepanel.c:760
|
||||
msgid "Cancel"
|
||||
msgstr "Zru¹i»"
|
||||
|
||||
#. Careful, this palette exists already
|
||||
#: ../../WINGs/wcolorpanel.c:3256 ../../WINGs/wfilepanel.c:760
|
||||
msgid "Warning"
|
||||
msgstr "Varovanie"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3257
|
||||
msgid ""
|
||||
"Palette already exists !\n"
|
||||
"\n"
|
||||
"Overwrite ?"
|
||||
msgstr ""
|
||||
"Paleta u¾ existuje!\n"
|
||||
"\n"
|
||||
"Prepísa»?"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3257 ../../WINGs/wcolorpanel.c:3321
|
||||
msgid "No"
|
||||
msgstr "Nie"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3257 ../../WINGs/wcolorpanel.c:3321
|
||||
msgid "Yes"
|
||||
msgstr "Áno"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3289
|
||||
#, c-format
|
||||
msgid "Couldn't rename palette %s to %s\n"
|
||||
msgstr "Nemo¾no premenova» paletu %s na %s\n"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3315
|
||||
msgid "This will permanently remove the palette "
|
||||
msgstr "Paleta bude natrvalo zmazaná"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3318
|
||||
msgid ""
|
||||
".\n"
|
||||
"\n"
|
||||
"Are you sure you want to remove this palette ?"
|
||||
msgstr ""
|
||||
".\n"
|
||||
"\n"
|
||||
"Ste si istý, ¾e chcete odstráni» túto paletu?"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3343
|
||||
#, c-format
|
||||
msgid "Couldn't remove palette %s\n"
|
||||
msgstr "Nemo¾no odstráni» paletu %s\n"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3648
|
||||
#, c-format
|
||||
msgid "Could not open %s"
|
||||
msgstr "Nemo¾no otvori» %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3655
|
||||
#, c-format
|
||||
msgid "Could not create %s"
|
||||
msgstr "Nemo¾no vytvori» %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3666
|
||||
#, c-format
|
||||
msgid "Write error on file %s"
|
||||
msgstr "Chyba zápisu do súboru %s"
|
||||
|
||||
#: ../../WINGs/wcolorpanel.c:3711
|
||||
msgid "Color Panel: Color unspecified"
|
||||
msgstr "Panel farieb: Ne¹pecifikovaná farba"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:235
|
||||
msgid "Name:"
|
||||
msgstr "Meno:"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:332 ../../WINGs/wfilepanel.c:396
|
||||
msgid "Open"
|
||||
msgstr "Otvori»"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:350 ../../WINGs/wfilepanel.c:402
|
||||
msgid "Save"
|
||||
msgstr "Ulo¾i»"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:562
|
||||
#, c-format
|
||||
msgid "WINGs: could not open directory %s\n"
|
||||
msgstr "WINGs: nemo¾no otvori» adresár %s\n"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:580
|
||||
#, c-format
|
||||
msgid "WINGs: could not stat %s\n"
|
||||
msgstr "WINGs: nemo¾no zisti» informácie o %s\n"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:647 ../../WINGs/wfilepanel.c:970
|
||||
#: ../../WINGs/wfontpanel.c:708
|
||||
msgid "Error"
|
||||
msgstr "Chyba"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:658
|
||||
msgid "Create Directory"
|
||||
msgstr "Vytvori» adresár"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:659
|
||||
msgid "Enter directory name"
|
||||
msgstr "Meno adresára"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:695 ../../WINGs/wfilepanel.c:734
|
||||
#: ../../WINGs/wfilepanel.c:765 ../../WINGs/wfilepanel.c:793
|
||||
msgid "Permission denied."
|
||||
msgstr "Prístup zamietnutý."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:698
|
||||
#, c-format
|
||||
msgid "'%s' already exists."
|
||||
msgstr "'%s' u¾ existuje"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:701
|
||||
msgid "Path does not exist."
|
||||
msgstr "Cesta neexistuje."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:731 ../../WINGs/wfilepanel.c:790
|
||||
#, c-format
|
||||
msgid "'%s' does not exist."
|
||||
msgstr "'%s' neexistuje."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:738 ../../WINGs/wfilepanel.c:797
|
||||
msgid "Insufficient memory available."
|
||||
msgstr "Nedostatok pamäti."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:742 ../../WINGs/wfilepanel.c:801
|
||||
#, c-format
|
||||
msgid "'%s' is on a read-only filesystem."
|
||||
msgstr "'%s' je na súborovom systéme len pre èítanie."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:745 ../../WINGs/wfilepanel.c:777
|
||||
#: ../../WINGs/wfilepanel.c:804
|
||||
#, c-format
|
||||
msgid "Can not delete '%s'."
|
||||
msgstr "Nemo¾no odstráni» '%s'."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:752
|
||||
#, c-format
|
||||
msgid "Delete directory %s ?"
|
||||
msgstr "Odstráni» adresár %s?"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:756
|
||||
#, c-format
|
||||
msgid "Delete file %s ?"
|
||||
msgstr "Odstráni» súbor %s?"
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:768
|
||||
#, c-format
|
||||
msgid "Directory '%s' does not exist."
|
||||
msgstr "Adresár '%s' neexistuje."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:771
|
||||
#, c-format
|
||||
msgid "Directory '%s' is not empty."
|
||||
msgstr "Adresár '%s' nie je prázdny."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:774
|
||||
#, c-format
|
||||
msgid "Directory '%s' is busy."
|
||||
msgstr "Adresár '%s' je pou¾ívaný."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:787
|
||||
#, c-format
|
||||
msgid "'%s' is a directory."
|
||||
msgstr "'%s' je adresár."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:829
|
||||
#, c-format
|
||||
msgid "An error occured browsing '%s'."
|
||||
msgstr "Pri prehliadaní '%s' nastala chyba."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:833
|
||||
#, c-format
|
||||
msgid "'%s' is not a directory."
|
||||
msgstr "'%s' nie je adresár."
|
||||
|
||||
#: ../../WINGs/wfilepanel.c:970
|
||||
msgid "File does not exist."
|
||||
msgstr "Súbor neexistuje."
|
||||
|
||||
#: ../../WINGs/wfont.c:129
|
||||
#, c-format
|
||||
msgid "the following character sets are missing in %s:"
|
||||
msgstr "nasledujúce sady znakov chýbajú v %s:"
|
||||
|
||||
#: ../../WINGs/wfont.c:136
|
||||
#, c-format
|
||||
msgid ""
|
||||
"the string \"%s\" will be used in place of any characters from those sets."
|
||||
msgstr "re»azec \"%s\" bude pou¾itý namiesto znakov z týchto sád."
|
||||
|
||||
#: ../../WINGs/wfont.c:282 ../../WINGs/wfont.c:318
|
||||
#, c-format
|
||||
msgid "could not load font set %s. Trying fixed."
|
||||
msgstr "nemo¾no naèíta» font %s. Skú¹a sa naèíta» fixed."
|
||||
|
||||
#: ../../WINGs/wfont.c:288 ../../WINGs/wfont.c:324
|
||||
#, c-format
|
||||
msgid "could not load font %s. Trying fixed."
|
||||
msgstr "nemo¾no naèíta» font %s. Skú¹a sa naèíta» fixed."
|
||||
|
||||
#: ../../WINGs/wfont.c:292 ../../WINGs/wfont.c:328
|
||||
msgid "could not load fixed font!"
|
||||
msgstr "nemo¾no naèíta» font fixed!"
|
||||
|
||||
#: ../../WINGs/wfont.c:423
|
||||
#, c-format
|
||||
msgid "font description %s is too large."
|
||||
msgstr "popis fontu %s je príli¹ veµký."
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:205
|
||||
msgid "Test!!!"
|
||||
msgstr "Skú¹ka!!!"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:211
|
||||
msgid "Family"
|
||||
msgstr "Rodina"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:222
|
||||
msgid "Typeface"
|
||||
msgstr "Vzhµad"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:233
|
||||
msgid "Size"
|
||||
msgstr "Veµkos»"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:252
|
||||
msgid "Set"
|
||||
msgstr "Sada"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:257
|
||||
msgid "Revert"
|
||||
msgstr "Obráti»"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:709
|
||||
msgid "Could not retrieve font list"
|
||||
msgstr "Nemo¾no obdr¾a» zoznam fontov"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:721
|
||||
#, c-format
|
||||
msgid "font name %s is longer than 256, which is invalid."
|
||||
msgstr "meno fontu %s je dlh¹ie ako 256, èo je nesprávne."
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:868
|
||||
msgid "Roman"
|
||||
msgstr "roman"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:871
|
||||
msgid "Italic"
|
||||
msgstr "kurzíva"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:873
|
||||
msgid "Oblique"
|
||||
msgstr "¹ikmé"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:875
|
||||
msgid "Rev Italic"
|
||||
msgstr "obr. kurzíva"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:877
|
||||
msgid "Rev Oblique"
|
||||
msgstr "obr. ¹ikmé"
|
||||
|
||||
#: ../../WINGs/wfontpanel.c:883
|
||||
msgid "Normal"
|
||||
msgstr "normálne"
|
||||
|
||||
#: ../../WINGs/widgets.c:415
|
||||
#, c-format
|
||||
msgid "WINGs: could not load widget images file: %s"
|
||||
msgstr "WINGs: nemo¾no naèíta» súbor s obrázkami pre widgety: %s"
|
||||
|
||||
#: ../../WINGs/widgets.c:761
|
||||
msgid ""
|
||||
"could not load any fonts. Make sure your font installationand locale "
|
||||
"settings are correct."
|
||||
msgstr ""
|
||||
"nemo¾no naèíta» ¾iadny font. Ubezpeète sa, ¾e in¹talácia fontov a miestne "
|
||||
"nastavenia sú v poriadku."
|
||||
|
||||
#: ../../WINGs/wruler.c:189
|
||||
msgid "0 inches"
|
||||
msgstr "0 palcov"
|
||||
1728
WINGs/proplist.c
Normal file
1728
WINGs/proplist.c
Normal file
File diff suppressed because it is too large
Load Diff
241
WINGs/puzzle.c
Normal file
241
WINGs/puzzle.c
Normal file
@@ -0,0 +1,241 @@
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <WINGs.h>
|
||||
|
||||
|
||||
|
||||
#define MAX_SIZE 10*10
|
||||
|
||||
|
||||
WMWindow *win;
|
||||
WMButton *Button[MAX_SIZE];
|
||||
char Map[MAX_SIZE];
|
||||
int Size = 4;
|
||||
int MoveCount;
|
||||
|
||||
#define MAP(x,y) Map[(x)+(y)*Size]
|
||||
|
||||
int WinSize = 120;
|
||||
|
||||
|
||||
Bool CheckWin(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < Size*Size-1; i++) {
|
||||
if (Map[i] != i)
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
void MoveButton(int button, int x, int y)
|
||||
{
|
||||
WMMoveWidget(Button[button], x*(WinSize/Size), y*(WinSize/Size));
|
||||
}
|
||||
|
||||
|
||||
Bool SlideButton(int button)
|
||||
{
|
||||
int x, y, done = 0;
|
||||
|
||||
/* locate the button */
|
||||
for (y = 0; y < Size; y++) {
|
||||
for (x = 0; x < Size; x++) {
|
||||
if (MAP(x,y) == button) {
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
|
||||
if (x > 0 && MAP(x-1, y) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x-1, y);
|
||||
MAP(x-1,y) = button;
|
||||
} else if (x < Size-1 && MAP(x+1, y) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x+1, y);
|
||||
MAP(x+1,y) = button;
|
||||
} else if (y > 0 && MAP(x, y-1) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x, y-1);
|
||||
MAP(x,y-1) = button;
|
||||
} else if (y < Size-1 && MAP(x, y+1) < 0) {
|
||||
MAP(x,y) = -1;
|
||||
MoveButton(button, x, y+1);
|
||||
MAP(x,y+1) = button;
|
||||
} else {
|
||||
return False;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
#define SWAP(a,b) {int tmp; tmp=a; a=b; b=tmp;}
|
||||
|
||||
void ResetGame(void)
|
||||
{
|
||||
int i, x, y, ox, oy;
|
||||
|
||||
|
||||
MoveCount = 0;
|
||||
|
||||
for (i = 0; i < Size*Size-1; i++) {
|
||||
Map[i] = i;
|
||||
}
|
||||
Map[i] = -1;
|
||||
ox = x = Size-1;
|
||||
oy = y = Size-1;
|
||||
for (i = 0; i < 5; i++) {
|
||||
int ok;
|
||||
ok = 1;
|
||||
switch (rand()%4) {
|
||||
case 0:
|
||||
if (x > 0) x--; else ok = 0;
|
||||
break;
|
||||
case 2:
|
||||
if (x < Size-1) x++; else ok = 0;
|
||||
break;
|
||||
case 1:
|
||||
if (y > 0) y--; else ok = 0;
|
||||
break;
|
||||
case 3:
|
||||
if (y < Size-1) y++; else ok = 0;
|
||||
break;
|
||||
}
|
||||
if (ok) {
|
||||
MoveButton(MAP(x,y), ox, oy);
|
||||
|
||||
SWAP(MAP(ox, oy), MAP(x, y));
|
||||
|
||||
while (XPending(WMScreenDisplay(WMWidgetScreen(win)))) {
|
||||
XEvent ev;
|
||||
WMNextEvent(WMScreenDisplay(WMWidgetScreen(win)), &ev);
|
||||
WMHandleEvent(&ev);
|
||||
}
|
||||
ox = x;
|
||||
oy = y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void buttonClick(WMWidget *w, void *ptr)
|
||||
{
|
||||
char buffer[300];
|
||||
|
||||
if (SlideButton((int)ptr)) {
|
||||
MoveCount++;
|
||||
|
||||
if (CheckWin()) {
|
||||
sprintf(buffer, "You finished the game in %i moves.", MoveCount);
|
||||
|
||||
if (WMRunAlertPanel(WMWidgetScreen(w), win, "You Won!", buffer,
|
||||
"Wee!", "Gah! Lemme retry!", NULL) == WAPRDefault) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
ResetGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void resizeObserver(void *self, WMNotification *notif)
|
||||
{
|
||||
WMSize size = WMGetViewSize(WMWidgetView(win));
|
||||
int x, y;
|
||||
|
||||
WinSize = size.width;
|
||||
for (y = 0; y < Size; y++) {
|
||||
for (x = 0; x < Size; x++) {
|
||||
if (MAP(x,y) >= 0) {
|
||||
WMResizeWidget(Button[(int)MAP(x,y)],
|
||||
WinSize/Size, WinSize/Size);
|
||||
WMMoveWidget(Button[(int)MAP(x,y)],
|
||||
x*(WinSize/Size), y*(WinSize/Size));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Display *dpy;
|
||||
WMScreen *scr;
|
||||
int x, y, i;
|
||||
|
||||
WMInitializeApplication("Puzzle", &argc, argv);
|
||||
|
||||
|
||||
dpy = XOpenDisplay("");
|
||||
if (!dpy) {
|
||||
printf("could not open display\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
|
||||
|
||||
win = WMCreateWindow(scr, "puzzle");
|
||||
WMResizeWidget(win, WinSize, WinSize);
|
||||
WMSetWindowTitle(win, "zuPzel");
|
||||
WMSetWindowMinSize(win, 80, 80);
|
||||
WMSetWindowAspectRatio(win, 2, 2, 2, 2);
|
||||
WMSetWindowResizeIncrements(win, Size, Size);
|
||||
WMSetViewNotifySizeChanges(WMWidgetView(win), True);
|
||||
WMAddNotificationObserver(resizeObserver, NULL,
|
||||
WMViewSizeDidChangeNotification,
|
||||
WMWidgetView(win));
|
||||
|
||||
|
||||
|
||||
for (i = y = 0; y < Size && i < Size*Size-1; y++) {
|
||||
for (x = 0; x < Size && i < Size*Size-1; x++) {
|
||||
char buf[32];
|
||||
WMColor *color;
|
||||
RColor col;
|
||||
RHSVColor hsv;
|
||||
|
||||
hsv.hue = i*360/(Size*Size-1);
|
||||
hsv.saturation = 120;
|
||||
hsv.value = 200;
|
||||
|
||||
RHSVtoRGB(&hsv, &col);
|
||||
|
||||
color = WMCreateRGBColor(scr, col.red<<8, col.green<<8,
|
||||
col.blue<<8, False);
|
||||
|
||||
MAP(x,y) = i;
|
||||
Button[i] = WMCreateButton(win, WBTMomentaryLight);
|
||||
WMSetWidgetBackgroundColor(Button[i], color);
|
||||
WMReleaseColor(color);
|
||||
WMSetButtonAction(Button[i], buttonClick, (void*)i);
|
||||
WMResizeWidget(Button[i], WinSize/Size, WinSize/Size);
|
||||
WMMoveWidget(Button[i], x*(WinSize/Size), y*(WinSize/Size));
|
||||
sprintf(buf, "%i", i+1);
|
||||
WMSetButtonText(Button[i], buf);
|
||||
WMSetButtonTextAlignment(Button[i], WACenter);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
WMMapSubwidgets(win);
|
||||
WMMapWidget(win);
|
||||
WMRealizeWidget(win);
|
||||
|
||||
ResetGame();
|
||||
|
||||
WMScreenMainLoop(scr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -10,63 +10,63 @@
|
||||
|
||||
|
||||
typedef struct SelectionHandler {
|
||||
WMWidget *widget;
|
||||
WMView *view;
|
||||
Atom selection;
|
||||
Time timestamp;
|
||||
WMConvertSelectionProc *convProc;
|
||||
WMLoseSelectionProc *loseProc;
|
||||
WMSelectionDoneProc *doneProc;
|
||||
WMSelectionProcs procs;
|
||||
void *data;
|
||||
|
||||
struct {
|
||||
unsigned delete_pending:1;
|
||||
unsigned done_pending:1;
|
||||
} flags;
|
||||
|
||||
struct SelectionHandler *next;
|
||||
} SelectionHandler;
|
||||
|
||||
|
||||
static SelectionHandler *selHandlers = NULL;
|
||||
typedef struct SelectionCallback {
|
||||
WMView *view;
|
||||
Atom selection;
|
||||
Atom target;
|
||||
Time timestamp;
|
||||
WMSelectionCallback *callback;
|
||||
void *data;
|
||||
|
||||
struct {
|
||||
unsigned delete_pending:1;
|
||||
unsigned done_pending:1;
|
||||
} flags;
|
||||
} SelectionCallback;
|
||||
|
||||
|
||||
WMArray *selCallbacks = NULL;
|
||||
|
||||
WMArray *selHandlers = NULL;
|
||||
|
||||
|
||||
void
|
||||
WMDeleteSelectionHandler(WMWidget *widget, Atom selection)
|
||||
WMDeleteSelectionHandler(WMView *view, Atom selection, Time timestamp)
|
||||
{
|
||||
SelectionHandler *handler, *tmp;
|
||||
Display *dpy = WMWidgetScreen(widget)->display;
|
||||
Window win = WMWidgetXID(widget);
|
||||
Time timestamp;
|
||||
SelectionHandler *handler;
|
||||
Display *dpy = W_VIEW_SCREEN(view)->display;
|
||||
Window win = W_VIEW_DRAWABLE(view);
|
||||
WMArrayIterator iter;
|
||||
|
||||
if (!selHandlers)
|
||||
return;
|
||||
|
||||
tmp = selHandlers;
|
||||
|
||||
if (tmp->widget == widget) {
|
||||
WM_ITERATE_ARRAY(selHandlers, handler, iter) {
|
||||
if (handler->view == view
|
||||
&& (handler->selection == selection || selection == None)
|
||||
&& (handler->timestamp == timestamp || timestamp == CurrentTime)) {
|
||||
|
||||
if (tmp->flags.done_pending) {
|
||||
tmp->flags.delete_pending = 1;
|
||||
if (handler->flags.done_pending) {
|
||||
handler->flags.delete_pending = 1;
|
||||
return;
|
||||
}
|
||||
selHandlers = tmp->next;
|
||||
timestamp = tmp->timestamp;
|
||||
wfree(tmp);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next->widget == widget) {
|
||||
|
||||
if (tmp->next->flags.done_pending) {
|
||||
tmp->next->flags.delete_pending = 1;
|
||||
return;
|
||||
}
|
||||
handler = tmp->next;
|
||||
tmp->next = handler->next;
|
||||
timestamp = handler->timestamp;
|
||||
wfree(handler);
|
||||
WMRemoveFromArray(selHandlers, handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
|
||||
XGrabServer(dpy);
|
||||
@@ -77,6 +77,33 @@ WMDeleteSelectionHandler(WMWidget *widget, Atom selection)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteSelectionCallback(WMView *view, Atom selection, Time timestamp)
|
||||
{
|
||||
SelectionCallback *handler;
|
||||
WMArrayIterator iter;
|
||||
|
||||
if (!selCallbacks)
|
||||
return;
|
||||
|
||||
WM_ITERATE_ARRAY(selCallbacks, handler, iter) {
|
||||
if (handler->view == view
|
||||
&& (handler->selection == selection || selection == 0)
|
||||
&& (handler->timestamp == timestamp || timestamp == CurrentTime)) {
|
||||
|
||||
if (handler->flags.done_pending) {
|
||||
handler->flags.delete_pending = 1;
|
||||
return;
|
||||
}
|
||||
WMRemoveFromArray(selCallbacks, handler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Bool gotError = 0;
|
||||
/*
|
||||
static int
|
||||
@@ -88,8 +115,14 @@ errorHandler(XErrorEvent *error)
|
||||
|
||||
static Bool
|
||||
writeSelection(Display *dpy, Window requestor, Atom property, Atom type,
|
||||
void *value, long length, int format)
|
||||
WMData *data)
|
||||
{
|
||||
int format;
|
||||
|
||||
format = WMGetDataFormat(data);
|
||||
if (format == 0)
|
||||
format = 8;
|
||||
|
||||
/*
|
||||
printf("write to %x: %s\n", requestor, XGetAtomName(dpy, property));
|
||||
*/
|
||||
@@ -97,12 +130,13 @@ writeSelection(Display *dpy, Window requestor, Atom property, Atom type,
|
||||
|
||||
#ifndef __sgi
|
||||
if (!XChangeProperty(dpy, requestor, property, type, format,
|
||||
PropModeReplace, value, length))
|
||||
PropModeReplace, WMDataBytes(data),
|
||||
WMGetDataLength(data)))
|
||||
return False;
|
||||
#else
|
||||
/* in sgi seems this seems to return void */
|
||||
XChangeProperty(dpy, requestor, property, type, format,
|
||||
PropModeReplace, value, length);
|
||||
PropModeReplace, WMDataBytes(data), WMGetDataLength(data));
|
||||
#endif
|
||||
|
||||
XFlush(dpy);
|
||||
@@ -134,50 +168,64 @@ notifySelection(XEvent *event, Atom prop)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
W_HandleSelectionEvent(XEvent *event)
|
||||
static void
|
||||
handleRequestEvent(XEvent *event)
|
||||
{
|
||||
SelectionHandler *handler;
|
||||
WMArrayIterator iter;
|
||||
WMArray *copy;
|
||||
Bool handledRequest = False;
|
||||
|
||||
handler = selHandlers;
|
||||
|
||||
while (handler) {
|
||||
if (WMWidgetXID(handler->widget)==event->xany.window
|
||||
/* && handler->selection == event->selection*/) {
|
||||
WM_ITERATE_ARRAY(selHandlers, handler, iter) {
|
||||
|
||||
switch (event->type) {
|
||||
case SelectionClear:
|
||||
if (handler->loseProc)
|
||||
(*handler->loseProc)(handler->widget, handler->selection);
|
||||
if (W_VIEW_DRAWABLE(handler->view)
|
||||
!= event->xselectionclear.window) {
|
||||
break;
|
||||
}
|
||||
|
||||
handler->flags.done_pending = 1;
|
||||
if (handler->procs.selectionLost)
|
||||
handler->procs.selectionLost(handler->view,
|
||||
handler->selection,
|
||||
handler->data);
|
||||
handler->flags.done_pending = 0;
|
||||
handler->flags.delete_pending = 1;
|
||||
break;
|
||||
|
||||
case SelectionRequest:
|
||||
if (handler->convProc) {
|
||||
if (W_VIEW_DRAWABLE(handler->view)
|
||||
!= event->xselectionrequest.owner) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (handler->procs.convertSelection != NULL
|
||||
&& handler->selection == event->xselectionrequest.selection) {
|
||||
Atom atom;
|
||||
void *data;
|
||||
unsigned length;
|
||||
int format;
|
||||
WMData *data;
|
||||
Atom prop;
|
||||
|
||||
/* they're requesting for something old */
|
||||
/* they're requesting for something old.. maybe another handler
|
||||
* can handle it */
|
||||
if (event->xselectionrequest.time < handler->timestamp
|
||||
&& event->xselectionrequest.time != CurrentTime) {
|
||||
|
||||
notifySelection(event, None);
|
||||
break;
|
||||
}
|
||||
|
||||
handler->flags.done_pending = 1;
|
||||
|
||||
if (!(*handler->convProc)(handler->widget,
|
||||
data = handler->procs.convertSelection(handler->view,
|
||||
handler->selection,
|
||||
event->xselectionrequest.target,
|
||||
&atom, &data, &length, &format)) {
|
||||
|
||||
notifySelection(event, None);
|
||||
handler->data,
|
||||
&atom);
|
||||
if (data == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
handledRequest = True;
|
||||
|
||||
|
||||
prop = event->xselectionrequest.property;
|
||||
/* obsolete clients that don't set the property field */
|
||||
@@ -186,40 +234,125 @@ W_HandleSelectionEvent(XEvent *event)
|
||||
|
||||
if (!writeSelection(event->xselectionrequest.display,
|
||||
event->xselectionrequest.requestor,
|
||||
prop, atom, data, length, format)) {
|
||||
|
||||
wfree(data);
|
||||
prop, atom, data)) {
|
||||
WMReleaseData(data);
|
||||
notifySelection(event, None);
|
||||
break;
|
||||
}
|
||||
wfree(data);
|
||||
WMReleaseData(data);
|
||||
|
||||
notifySelection(event, prop);
|
||||
|
||||
if (handler->doneProc) {
|
||||
(*handler->doneProc)(handler->widget,
|
||||
if (handler->procs.selectionDone != NULL) {
|
||||
handler->procs.selectionDone(handler->view,
|
||||
handler->selection,
|
||||
event->xselectionrequest.target);
|
||||
event->xselectionrequest.target,
|
||||
handler->data);
|
||||
}
|
||||
|
||||
handler->flags.done_pending = 0;
|
||||
|
||||
/* in case the handler was deleted from some
|
||||
* callback */
|
||||
if (handler->flags.delete_pending) {
|
||||
WMDeleteSelectionHandler(handler->widget,
|
||||
handler->selection);
|
||||
if (!handledRequest) {
|
||||
notifySelection(event, None);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SelectionNotify:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
handler = handler->next;
|
||||
/* delete handlers */
|
||||
copy = WMDuplicateArray(selHandlers);
|
||||
WM_ITERATE_ARRAY(copy, handler, iter) {
|
||||
if (handler && handler->flags.delete_pending) {
|
||||
WMDeleteSelectionHandler(handler->view, handler->selection,
|
||||
handler->timestamp);
|
||||
}
|
||||
}
|
||||
WMFreeArray(copy);
|
||||
}
|
||||
|
||||
|
||||
static WMData*
|
||||
getSelectionData(Display *dpy, Window win, Atom where)
|
||||
{
|
||||
WMData *wdata;
|
||||
unsigned char *data;
|
||||
Atom rtype;
|
||||
unsigned bits;
|
||||
unsigned long len, bytes;
|
||||
|
||||
|
||||
if (XGetWindowProperty(dpy, win, where, 0, MAX_PROPERTY_SIZE,
|
||||
False, AnyPropertyType, &rtype, &bits, &len,
|
||||
&bytes, &data)!=Success) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wdata = WMCreateDataWithBytesNoCopy(data, len, (WMFreeDataProc*)XFree);
|
||||
if (wdata == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
WMSetDataFormat(wdata, bits);
|
||||
|
||||
return wdata;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleNotifyEvent(XEvent *event)
|
||||
{
|
||||
SelectionCallback *handler;
|
||||
WMArrayIterator iter;
|
||||
WMArray *copy;
|
||||
WMData *data;
|
||||
|
||||
WM_ITERATE_ARRAY(selCallbacks, handler, iter) {
|
||||
|
||||
if (W_VIEW_DRAWABLE(handler->view) != event->xselection.requestor
|
||||
&& handler->selection == event->xselection.selection) {
|
||||
continue;
|
||||
}
|
||||
handler->flags.done_pending = 1;
|
||||
|
||||
if (event->xselection.property == None) {
|
||||
data = NULL;
|
||||
} else {
|
||||
data = getSelectionData(event->xselection.display,
|
||||
event->xselection.requestor,
|
||||
event->xselection.property);
|
||||
}
|
||||
|
||||
(*handler->callback)(handler->view, handler->selection,
|
||||
handler->target, handler->timestamp,
|
||||
handler->data, data);
|
||||
|
||||
if (data != NULL) {
|
||||
WMReleaseData(data);
|
||||
}
|
||||
handler->flags.done_pending = 0;
|
||||
handler->flags.delete_pending = 1;
|
||||
}
|
||||
|
||||
/* delete callbacks */
|
||||
copy = WMDuplicateArray(selCallbacks);
|
||||
WM_ITERATE_ARRAY(copy, handler, iter) {
|
||||
if (handler && handler->flags.delete_pending) {
|
||||
WMDeleteSelectionCallback(handler->view, handler->selection,
|
||||
handler->timestamp);
|
||||
}
|
||||
}
|
||||
WMFreeArray(copy);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
W_HandleSelectionEvent(XEvent *event)
|
||||
{
|
||||
if (event->type == SelectionNotify) {
|
||||
handleNotifyEvent(event);
|
||||
} else {
|
||||
handleRequestEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,196 +360,69 @@ W_HandleSelectionEvent(XEvent *event)
|
||||
|
||||
|
||||
Bool
|
||||
WMCreateSelectionHandler(WMWidget *w, Atom selection, Time timestamp,
|
||||
WMConvertSelectionProc *convProc,
|
||||
WMLoseSelectionProc *loseProc,
|
||||
WMSelectionDoneProc *doneProc)
|
||||
WMCreateSelectionHandler(WMView *view, Atom selection, Time timestamp,
|
||||
WMSelectionProcs *procs, void *cdata)
|
||||
{
|
||||
SelectionHandler *handler, *tmp;
|
||||
Display *dpy = WMWidgetScreen(w)->display;
|
||||
SelectionHandler *handler;
|
||||
Display *dpy = W_VIEW_SCREEN(view)->display;
|
||||
|
||||
XSetSelectionOwner(dpy, selection, WMWidgetXID(w), timestamp);
|
||||
if (XGetSelectionOwner(dpy, selection) != WMWidgetXID(w))
|
||||
XSetSelectionOwner(dpy, selection, W_VIEW_DRAWABLE(view), timestamp);
|
||||
if (XGetSelectionOwner(dpy, selection) != W_VIEW_DRAWABLE(view))
|
||||
return False;
|
||||
|
||||
handler = malloc(sizeof(SelectionHandler));
|
||||
if (!handler)
|
||||
if (handler == NULL)
|
||||
return False;
|
||||
|
||||
handler->widget = w;
|
||||
handler->view = view;
|
||||
handler->selection = selection;
|
||||
handler->timestamp = timestamp;
|
||||
handler->convProc = convProc;
|
||||
handler->loseProc = loseProc;
|
||||
handler->doneProc = doneProc;
|
||||
handler->procs = *procs;
|
||||
handler->data = cdata;
|
||||
memset(&handler->flags, 0, sizeof(handler->flags));
|
||||
|
||||
if (!selHandlers) {
|
||||
/* first in the queue */
|
||||
handler->next = selHandlers;
|
||||
selHandlers = handler;
|
||||
} else {
|
||||
tmp = selHandlers;
|
||||
while (tmp->next) {
|
||||
tmp = tmp->next;
|
||||
}
|
||||
handler->next = tmp->next;
|
||||
tmp->next = handler;
|
||||
if (selHandlers == NULL) {
|
||||
selHandlers = WMCreateArrayWithDestructor(4, wfree);
|
||||
}
|
||||
|
||||
WMAddToArray(selHandlers, handler);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
timeoutHandler(void *data)
|
||||
Bool
|
||||
WMRequestSelection(WMView *view, Atom selection, Atom target, Time timestamp,
|
||||
WMSelectionCallback *callback, void *cdata)
|
||||
{
|
||||
*(int*)data = 1;
|
||||
}
|
||||
SelectionCallback *handler;
|
||||
|
||||
|
||||
static Bool
|
||||
getInternalSelection(WMScreen *scr, Atom selection, Atom target,
|
||||
void **data, unsigned *length)
|
||||
{
|
||||
Window owner;
|
||||
SelectionHandler *handler;
|
||||
|
||||
/*
|
||||
* Check if the selection is owned by this application and if so,
|
||||
* do the conversion directly.
|
||||
*/
|
||||
|
||||
*data = NULL;
|
||||
|
||||
owner = XGetSelectionOwner(scr->display, selection);
|
||||
if (!owner)
|
||||
if (XGetSelectionOwner(W_VIEW_SCREEN(view)->display, selection) == None)
|
||||
return False;
|
||||
|
||||
handler = selHandlers;
|
||||
handler = wmalloc(sizeof(SelectionCallback));
|
||||
|
||||
while (handler) {
|
||||
if (WMWidgetXID(handler->widget) == owner
|
||||
/* && handler->selection == event->selection*/) {
|
||||
break;
|
||||
}
|
||||
handler = handler->next;
|
||||
handler->view = view;
|
||||
handler->selection = selection;
|
||||
handler->target = target;
|
||||
handler->timestamp = timestamp;
|
||||
handler->callback = callback;
|
||||
handler->data = cdata;
|
||||
memset(&handler->flags, 0, sizeof(handler->flags));
|
||||
|
||||
if (selCallbacks == NULL) {
|
||||
selCallbacks = WMCreateArrayWithDestructor(4, wfree);
|
||||
}
|
||||
|
||||
if (!handler)
|
||||
WMAddToArray(selCallbacks, handler);
|
||||
|
||||
if (!XConvertSelection(W_VIEW_SCREEN(view)->display, selection, target,
|
||||
W_VIEW_SCREEN(view)->clipboardAtom,
|
||||
W_VIEW_DRAWABLE(view), timestamp)) {
|
||||
return False;
|
||||
|
||||
if (handler->convProc) {
|
||||
Atom atom;
|
||||
int format;
|
||||
|
||||
if (!(*handler->convProc)(handler->widget, handler->selection,
|
||||
target, &atom, data, length, &format)) {
|
||||
return True;
|
||||
}
|
||||
|
||||
if (handler->doneProc) {
|
||||
(*handler->doneProc)(handler->widget, handler->selection, target);
|
||||
}
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
W_GetTextSelection(WMScreen *scr, Atom selection)
|
||||
{
|
||||
int buffer = -1;
|
||||
|
||||
switch (selection) {
|
||||
case XA_CUT_BUFFER0:
|
||||
buffer = 0;
|
||||
break;
|
||||
case XA_CUT_BUFFER1:
|
||||
buffer = 1;
|
||||
break;
|
||||
case XA_CUT_BUFFER2:
|
||||
buffer = 2;
|
||||
break;
|
||||
case XA_CUT_BUFFER3:
|
||||
buffer = 3;
|
||||
break;
|
||||
case XA_CUT_BUFFER4:
|
||||
buffer = 4;
|
||||
break;
|
||||
case XA_CUT_BUFFER5:
|
||||
buffer = 5;
|
||||
break;
|
||||
case XA_CUT_BUFFER6:
|
||||
buffer = 6;
|
||||
break;
|
||||
case XA_CUT_BUFFER7:
|
||||
buffer = 7;
|
||||
break;
|
||||
}
|
||||
if (buffer >= 0) {
|
||||
char *data;
|
||||
int size;
|
||||
|
||||
data = XFetchBuffer(scr->display, &size, buffer);
|
||||
|
||||
return data;
|
||||
} else {
|
||||
char *data;
|
||||
int bits;
|
||||
Atom rtype;
|
||||
unsigned long len, bytes;
|
||||
WMHandlerID timer;
|
||||
int timeout = 0;
|
||||
XEvent ev;
|
||||
unsigned length;
|
||||
|
||||
XDeleteProperty(scr->display, scr->groupLeader, scr->clipboardAtom);
|
||||
|
||||
if (getInternalSelection(scr, selection, XA_STRING, (void**)&data,
|
||||
&length)) {
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
XConvertSelection(scr->display, selection, XA_STRING,
|
||||
scr->clipboardAtom, scr->groupLeader,
|
||||
scr->lastEventTime);
|
||||
|
||||
timer = WMAddTimerHandler(1000, timeoutHandler, &timeout);
|
||||
|
||||
while (!XCheckTypedWindowEvent(scr->display, scr->groupLeader,
|
||||
SelectionNotify, &ev) && !timeout);
|
||||
|
||||
if (!timeout) {
|
||||
WMDeleteTimerHandler(timer);
|
||||
} else {
|
||||
wwarning("selection retrieval timed out");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* nobody owns the selection or the current owner has
|
||||
* nothing to do with what we need */
|
||||
if (ev.xselection.property == None) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (XGetWindowProperty(scr->display, scr->groupLeader,
|
||||
scr->clipboardAtom, 0, MAX_PROPERTY_SIZE,
|
||||
False, XA_STRING, &rtype, &bits, &len,
|
||||
&bytes, (unsigned char**)&data)!=Success) {
|
||||
return NULL;
|
||||
}
|
||||
if (rtype!=XA_STRING || bits!=8) {
|
||||
wwarning("invalid data in text selection");
|
||||
if (data)
|
||||
XFree(data);
|
||||
return NULL;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
937
WINGs/snprintf.c
Normal file
937
WINGs/snprintf.c
Normal file
@@ -0,0 +1,937 @@
|
||||
/*
|
||||
* Copyright Patrick Powell 1995
|
||||
* This code is based on code written by Patrick Powell (papowell@astart.com)
|
||||
* It may be used for any purpose as long as this notice remains intact
|
||||
* on all source code distributions
|
||||
*/
|
||||
|
||||
/**************************************************************
|
||||
* Original:
|
||||
* Patrick Powell Tue Apr 11 09:48:21 PDT 1995
|
||||
* A bombproof version of doprnt (dopr) included.
|
||||
* Sigh. This sort of thing is always nasty do deal with. Note that
|
||||
* the version here does not include floating point...
|
||||
*
|
||||
* snprintf() is used instead of sprintf() as it does limit checks
|
||||
* for string length. This covers a nasty loophole.
|
||||
*
|
||||
* The other functions are there to prevent NULL pointers from
|
||||
* causing nast effects.
|
||||
*
|
||||
* More Recently:
|
||||
* Brandon Long <blong@fiction.net> 9/15/96 for mutt 0.43
|
||||
* This was ugly. It is still ugly. I opted out of floating point
|
||||
* numbers, but the formatter understands just about everything
|
||||
* from the normal C string format, at least as far as I can tell from
|
||||
* the Solaris 2.5 printf(3S) man page.
|
||||
*
|
||||
* Brandon Long <blong@fiction.net> 10/22/97 for mutt 0.87.1
|
||||
* Ok, added some minimal floating point support, which means this
|
||||
* probably requires libm on most operating systems. Don't yet
|
||||
* support the exponent (e,E) and sigfig (g,G). Also, fmtint()
|
||||
* was pretty badly broken, it just wasn't being exercised in ways
|
||||
* which showed it, so that's been fixed. Also, formated the code
|
||||
* to mutt conventions, and removed dead code left over from the
|
||||
* original. Also, there is now a builtin-test, just compile with:
|
||||
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
||||
* and run snprintf for results.
|
||||
*
|
||||
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
|
||||
* The PGP code was using unsigned hexadecimal formats.
|
||||
* Unfortunately, unsigned formats simply didn't work.
|
||||
*
|
||||
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
|
||||
* The original code assumed that both snprintf() and vsnprintf() were
|
||||
* missing. Some systems only have snprintf() but not vsnprintf(), so
|
||||
* the code is now broken down under HAVE_SNPRINTF and HAVE_VSNPRINTF.
|
||||
*
|
||||
* Andrew Tridgell (tridge@samba.org) Oct 1998
|
||||
* fixed handling of %.0f
|
||||
* added test for HAVE_LONG_DOUBLE
|
||||
*
|
||||
* tridge@samba.org, idra@samba.org, April 2001
|
||||
* got rid of fcvt code (twas buggy and made testing harder)
|
||||
* added C99 semantics
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
#ifndef NO_CONFIG_H /* for some tests */
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_SNPRINTF) && defined(HAVE_VSNPRINTF) && defined(HAVE_C99_VSNPRINTF)
|
||||
/* only include stdio.h if we are not re-defining snprintf or vsnprintf */
|
||||
#include <stdio.h>
|
||||
/* make the compiler happy with an empty file */
|
||||
void dummy_snprintf(void) {}
|
||||
#else
|
||||
|
||||
#ifdef HAVE_LONG_DOUBLE
|
||||
#define LDOUBLE long double
|
||||
#else
|
||||
#define LDOUBLE double
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LONG_LONG
|
||||
#define LLONG long long
|
||||
#else
|
||||
#define LLONG long
|
||||
#endif
|
||||
|
||||
static size_t dopr(char *buffer, size_t maxlen, const char *format,
|
||||
va_list args);
|
||||
static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
||||
char *value, int flags, int min, int max);
|
||||
static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||
long value, int base, int min, int max, int flags);
|
||||
static void fmtfp(char *buffer, size_t *currlen, size_t maxlen,
|
||||
LDOUBLE fvalue, int min, int max, int flags);
|
||||
static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
|
||||
|
||||
/*
|
||||
* dopr(): poor man's version of doprintf
|
||||
*/
|
||||
|
||||
/* format read states */
|
||||
#define DP_S_DEFAULT 0
|
||||
#define DP_S_FLAGS 1
|
||||
#define DP_S_MIN 2
|
||||
#define DP_S_DOT 3
|
||||
#define DP_S_MAX 4
|
||||
#define DP_S_MOD 5
|
||||
#define DP_S_CONV 6
|
||||
#define DP_S_DONE 7
|
||||
|
||||
/* format flags - Bits */
|
||||
#define DP_F_MINUS (1 << 0)
|
||||
#define DP_F_PLUS (1 << 1)
|
||||
#define DP_F_SPACE (1 << 2)
|
||||
#define DP_F_NUM (1 << 3)
|
||||
#define DP_F_ZERO (1 << 4)
|
||||
#define DP_F_UP (1 << 5)
|
||||
#define DP_F_UNSIGNED (1 << 6)
|
||||
|
||||
/* Conversion Flags */
|
||||
#define DP_C_SHORT 1
|
||||
#define DP_C_LONG 2
|
||||
#define DP_C_LDOUBLE 3
|
||||
#define DP_C_LLONG 4
|
||||
|
||||
#define char_to_int(p) ((p)- '0')
|
||||
#ifndef MAX
|
||||
#define MAX(p,q) (((p) >= (q)) ? (p) : (q))
|
||||
#endif
|
||||
|
||||
static size_t dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||
{
|
||||
char ch;
|
||||
LLONG value;
|
||||
LDOUBLE fvalue;
|
||||
char *strvalue;
|
||||
int min;
|
||||
int max;
|
||||
int state;
|
||||
int flags;
|
||||
int cflags;
|
||||
size_t currlen;
|
||||
|
||||
state = DP_S_DEFAULT;
|
||||
currlen = flags = cflags = min = 0;
|
||||
max = -1;
|
||||
ch = *format++;
|
||||
|
||||
while (state != DP_S_DONE) {
|
||||
if (ch == '\0')
|
||||
state = DP_S_DONE;
|
||||
|
||||
switch(state) {
|
||||
case DP_S_DEFAULT:
|
||||
if (ch == '%')
|
||||
state = DP_S_FLAGS;
|
||||
else
|
||||
dopr_outch (buffer, &currlen, maxlen, ch);
|
||||
ch = *format++;
|
||||
break;
|
||||
case DP_S_FLAGS:
|
||||
switch (ch) {
|
||||
case '-':
|
||||
flags |= DP_F_MINUS;
|
||||
ch = *format++;
|
||||
break;
|
||||
case '+':
|
||||
flags |= DP_F_PLUS;
|
||||
ch = *format++;
|
||||
break;
|
||||
case ' ':
|
||||
flags |= DP_F_SPACE;
|
||||
ch = *format++;
|
||||
break;
|
||||
case '#':
|
||||
flags |= DP_F_NUM;
|
||||
ch = *format++;
|
||||
break;
|
||||
case '0':
|
||||
flags |= DP_F_ZERO;
|
||||
ch = *format++;
|
||||
break;
|
||||
default:
|
||||
state = DP_S_MIN;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DP_S_MIN:
|
||||
if (isdigit((unsigned char)ch)) {
|
||||
min = 10*min + char_to_int (ch);
|
||||
ch = *format++;
|
||||
} else if (ch == '*') {
|
||||
min = va_arg (args, int);
|
||||
ch = *format++;
|
||||
state = DP_S_DOT;
|
||||
} else {
|
||||
state = DP_S_DOT;
|
||||
}
|
||||
break;
|
||||
case DP_S_DOT:
|
||||
if (ch == '.') {
|
||||
state = DP_S_MAX;
|
||||
ch = *format++;
|
||||
} else {
|
||||
state = DP_S_MOD;
|
||||
}
|
||||
break;
|
||||
case DP_S_MAX:
|
||||
if (isdigit((unsigned char)ch)) {
|
||||
if (max < 0)
|
||||
max = 0;
|
||||
max = 10*max + char_to_int (ch);
|
||||
ch = *format++;
|
||||
} else if (ch == '*') {
|
||||
max = va_arg (args, int);
|
||||
ch = *format++;
|
||||
state = DP_S_MOD;
|
||||
} else {
|
||||
state = DP_S_MOD;
|
||||
}
|
||||
break;
|
||||
case DP_S_MOD:
|
||||
switch (ch) {
|
||||
case 'h':
|
||||
cflags = DP_C_SHORT;
|
||||
ch = *format++;
|
||||
break;
|
||||
case 'l':
|
||||
cflags = DP_C_LONG;
|
||||
ch = *format++;
|
||||
if (ch == 'l') { /* It's a long long */
|
||||
cflags = DP_C_LLONG;
|
||||
ch = *format++;
|
||||
}
|
||||
break;
|
||||
case 'L':
|
||||
cflags = DP_C_LDOUBLE;
|
||||
ch = *format++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
state = DP_S_CONV;
|
||||
break;
|
||||
case DP_S_CONV:
|
||||
switch (ch) {
|
||||
case 'd':
|
||||
case 'i':
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = va_arg (args, long int);
|
||||
else if (cflags == DP_C_LLONG)
|
||||
value = va_arg (args, LLONG);
|
||||
else
|
||||
value = va_arg (args, int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
|
||||
break;
|
||||
case 'o':
|
||||
flags |= DP_F_UNSIGNED;
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, unsigned int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = (long)va_arg (args, unsigned long int);
|
||||
else if (cflags == DP_C_LLONG)
|
||||
value = (long)va_arg (args, unsigned LLONG);
|
||||
else
|
||||
value = (long)va_arg (args, unsigned int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags);
|
||||
break;
|
||||
case 'u':
|
||||
flags |= DP_F_UNSIGNED;
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, unsigned int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = (long)va_arg (args, unsigned long int);
|
||||
else if (cflags == DP_C_LLONG)
|
||||
value = (LLONG)va_arg (args, unsigned LLONG);
|
||||
else
|
||||
value = (long)va_arg (args, unsigned int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags);
|
||||
break;
|
||||
case 'X':
|
||||
flags |= DP_F_UP;
|
||||
case 'x':
|
||||
flags |= DP_F_UNSIGNED;
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg (args, unsigned int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = (long)va_arg (args, unsigned long int);
|
||||
else if (cflags == DP_C_LLONG)
|
||||
value = (LLONG)va_arg (args, unsigned LLONG);
|
||||
else
|
||||
value = (long)va_arg (args, unsigned int);
|
||||
fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags);
|
||||
break;
|
||||
case 'f':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg (args, LDOUBLE);
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
/* um, floating point? */
|
||||
fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags);
|
||||
break;
|
||||
case 'E':
|
||||
flags |= DP_F_UP;
|
||||
case 'e':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg (args, LDOUBLE);
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
break;
|
||||
case 'G':
|
||||
flags |= DP_F_UP;
|
||||
case 'g':
|
||||
if (cflags == DP_C_LDOUBLE)
|
||||
fvalue = va_arg (args, LDOUBLE);
|
||||
else
|
||||
fvalue = va_arg (args, double);
|
||||
break;
|
||||
case 'c':
|
||||
dopr_outch (buffer, &currlen, maxlen, va_arg (args, int));
|
||||
break;
|
||||
case 's':
|
||||
strvalue = va_arg (args, char *);
|
||||
if (max == -1) {
|
||||
max = strlen(strvalue);
|
||||
}
|
||||
if (min > 0 && max >= 0 && min > max) max = min;
|
||||
fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max);
|
||||
break;
|
||||
case 'p':
|
||||
strvalue = va_arg (args, void *);
|
||||
fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags);
|
||||
break;
|
||||
case 'n':
|
||||
if (cflags == DP_C_SHORT) {
|
||||
short int *num;
|
||||
num = va_arg (args, short int *);
|
||||
*num = currlen;
|
||||
} else if (cflags == DP_C_LONG) {
|
||||
long int *num;
|
||||
num = va_arg (args, long int *);
|
||||
*num = (long int)currlen;
|
||||
} else if (cflags == DP_C_LLONG) {
|
||||
LLONG *num;
|
||||
num = va_arg (args, LLONG *);
|
||||
*num = (LLONG)currlen;
|
||||
} else {
|
||||
int *num;
|
||||
num = va_arg (args, int *);
|
||||
*num = currlen;
|
||||
}
|
||||
break;
|
||||
case '%':
|
||||
dopr_outch (buffer, &currlen, maxlen, ch);
|
||||
break;
|
||||
case 'w':
|
||||
/* not supported yet, treat as next char */
|
||||
ch = *format++;
|
||||
break;
|
||||
default:
|
||||
/* Unknown, skip */
|
||||
break;
|
||||
}
|
||||
ch = *format++;
|
||||
state = DP_S_DEFAULT;
|
||||
flags = cflags = min = 0;
|
||||
max = -1;
|
||||
break;
|
||||
case DP_S_DONE:
|
||||
break;
|
||||
default:
|
||||
/* hmm? */
|
||||
break; /* some picky compilers need this */
|
||||
}
|
||||
}
|
||||
if (maxlen != 0) {
|
||||
if (currlen < maxlen - 1)
|
||||
buffer[currlen] = '\0';
|
||||
else if (maxlen > 0)
|
||||
buffer[maxlen - 1] = '\0';
|
||||
}
|
||||
|
||||
return currlen;
|
||||
}
|
||||
|
||||
static void fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
||||
char *value, int flags, int min, int max)
|
||||
{
|
||||
int padlen, strln; /* amount to pad */
|
||||
int cnt = 0;
|
||||
|
||||
#ifdef DEBUG_SNPRINTF
|
||||
printf("fmtstr min=%d max=%d s=[%s]\n", min, max, value);
|
||||
#endif
|
||||
if (value == 0) {
|
||||
value = "<NULL>";
|
||||
}
|
||||
|
||||
for (strln = 0; value[strln]; ++strln); /* strlen */
|
||||
padlen = min - strln;
|
||||
if (padlen < 0)
|
||||
padlen = 0;
|
||||
if (flags & DP_F_MINUS)
|
||||
padlen = -padlen; /* Left Justify */
|
||||
|
||||
while ((padlen > 0) && (cnt < max)) {
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
--padlen;
|
||||
++cnt;
|
||||
}
|
||||
while (*value && (cnt < max)) {
|
||||
dopr_outch (buffer, currlen, maxlen, *value++);
|
||||
++cnt;
|
||||
}
|
||||
while ((padlen < 0) && (cnt < max)) {
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
++padlen;
|
||||
++cnt;
|
||||
}
|
||||
}
|
||||
|
||||
/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
|
||||
|
||||
static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||
long value, int base, int min, int max, int flags)
|
||||
{
|
||||
int signvalue = 0;
|
||||
unsigned long uvalue;
|
||||
char convert[20];
|
||||
int place = 0;
|
||||
int spadlen = 0; /* amount to space pad */
|
||||
int zpadlen = 0; /* amount to zero pad */
|
||||
int caps = 0;
|
||||
|
||||
if (max < 0)
|
||||
max = 0;
|
||||
|
||||
uvalue = value;
|
||||
|
||||
if(!(flags & DP_F_UNSIGNED)) {
|
||||
if( value < 0 ) {
|
||||
signvalue = '-';
|
||||
uvalue = -value;
|
||||
} else {
|
||||
if (flags & DP_F_PLUS) /* Do a sign (+/i) */
|
||||
signvalue = '+';
|
||||
else if (flags & DP_F_SPACE)
|
||||
signvalue = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
|
||||
|
||||
do {
|
||||
convert[place++] =
|
||||
(caps? "0123456789ABCDEF":"0123456789abcdef")
|
||||
[uvalue % (unsigned)base ];
|
||||
uvalue = (uvalue / (unsigned)base );
|
||||
} while(uvalue && (place < 20));
|
||||
if (place == 20) place--;
|
||||
convert[place] = 0;
|
||||
|
||||
zpadlen = max - place;
|
||||
spadlen = min - MAX (max, place) - (signvalue ? 1 : 0);
|
||||
if (zpadlen < 0) zpadlen = 0;
|
||||
if (spadlen < 0) spadlen = 0;
|
||||
if (flags & DP_F_ZERO) {
|
||||
zpadlen = MAX(zpadlen, spadlen);
|
||||
spadlen = 0;
|
||||
}
|
||||
if (flags & DP_F_MINUS)
|
||||
spadlen = -spadlen; /* Left Justifty */
|
||||
|
||||
#ifdef DEBUG_SNPRINTF
|
||||
printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n",
|
||||
zpadlen, spadlen, min, max, place);
|
||||
#endif
|
||||
|
||||
/* Spaces */
|
||||
while (spadlen > 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
--spadlen;
|
||||
}
|
||||
|
||||
/* Sign */
|
||||
if (signvalue)
|
||||
dopr_outch (buffer, currlen, maxlen, signvalue);
|
||||
|
||||
/* Zeros */
|
||||
if (zpadlen > 0) {
|
||||
while (zpadlen > 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, '0');
|
||||
--zpadlen;
|
||||
}
|
||||
}
|
||||
|
||||
/* Digits */
|
||||
while (place > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, convert[--place]);
|
||||
|
||||
/* Left Justified spaces */
|
||||
while (spadlen < 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
++spadlen;
|
||||
}
|
||||
}
|
||||
|
||||
static LDOUBLE abs_val(LDOUBLE value)
|
||||
{
|
||||
LDOUBLE result = value;
|
||||
|
||||
if (value < 0)
|
||||
result = -value;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static LDOUBLE POW10(int exp)
|
||||
{
|
||||
LDOUBLE result = 1;
|
||||
|
||||
while (exp) {
|
||||
result *= 10;
|
||||
exp--;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static LLONG ROUND(LDOUBLE value)
|
||||
{
|
||||
LLONG intpart;
|
||||
|
||||
intpart = (LLONG)value;
|
||||
value = value - intpart;
|
||||
if (value >= 0.5) intpart++;
|
||||
|
||||
return intpart;
|
||||
}
|
||||
|
||||
/* a replacement for modf that doesn't need the math library. Should
|
||||
be portable, but slow */
|
||||
static double my_modf(double x0, double *iptr)
|
||||
{
|
||||
int i;
|
||||
long l;
|
||||
double x = x0;
|
||||
double f = 1.0;
|
||||
|
||||
for (i=0;i<100;i++) {
|
||||
l = (long)x;
|
||||
if (l <= (x+1) && l >= (x-1)) break;
|
||||
x *= 0.1;
|
||||
f *= 10.0;
|
||||
}
|
||||
|
||||
if (i == 100) {
|
||||
/* yikes! the number is beyond what we can handle. What do we do? */
|
||||
(*iptr) = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (i != 0) {
|
||||
double i2;
|
||||
double ret;
|
||||
|
||||
ret = my_modf(x0-l*f, &i2);
|
||||
(*iptr) = l*f + i2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
(*iptr) = l;
|
||||
return x - (*iptr);
|
||||
}
|
||||
|
||||
|
||||
static void fmtfp (char *buffer, size_t *currlen, size_t maxlen,
|
||||
LDOUBLE fvalue, int min, int max, int flags)
|
||||
{
|
||||
int signvalue = 0;
|
||||
double ufvalue;
|
||||
char iconvert[311];
|
||||
char fconvert[311];
|
||||
int iplace = 0;
|
||||
int fplace = 0;
|
||||
int padlen = 0; /* amount to pad */
|
||||
int zpadlen = 0;
|
||||
int caps = 0;
|
||||
int index;
|
||||
double intpart;
|
||||
double fracpart;
|
||||
double temp;
|
||||
|
||||
/*
|
||||
* AIX manpage says the default is 0, but Solaris says the default
|
||||
* is 6, and sprintf on AIX defaults to 6
|
||||
*/
|
||||
if (max < 0)
|
||||
max = 6;
|
||||
|
||||
ufvalue = abs_val (fvalue);
|
||||
|
||||
if (fvalue < 0) {
|
||||
signvalue = '-';
|
||||
} else {
|
||||
if (flags & DP_F_PLUS) { /* Do a sign (+/i) */
|
||||
signvalue = '+';
|
||||
} else {
|
||||
if (flags & DP_F_SPACE)
|
||||
signvalue = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (max == 0) ufvalue += 0.5; /* if max = 0 we must round */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Sorry, we only support 16 digits past the decimal because of our
|
||||
* conversion method
|
||||
*/
|
||||
if (max > 16)
|
||||
max = 16;
|
||||
|
||||
/* We "cheat" by converting the fractional part to integer by
|
||||
* multiplying by a factor of 10
|
||||
*/
|
||||
|
||||
temp = ufvalue;
|
||||
my_modf(temp, &intpart);
|
||||
|
||||
fracpart = ROUND((POW10(max)) * (ufvalue - intpart));
|
||||
|
||||
if (fracpart >= POW10(max)) {
|
||||
intpart++;
|
||||
fracpart -= POW10(max);
|
||||
}
|
||||
|
||||
|
||||
/* Convert integer part */
|
||||
do {
|
||||
temp = intpart;
|
||||
my_modf(intpart*0.1, &intpart);
|
||||
temp = temp*0.1;
|
||||
index = (int) ((temp -intpart +0.05)* 10.0);
|
||||
/* index = (int) (((double)(temp*0.1) -intpart +0.05) *10.0); */
|
||||
/* printf ("%llf, %f, %x\n", temp, intpart, index); */
|
||||
iconvert[iplace++] =
|
||||
(caps? "0123456789ABCDEF":"0123456789abcdef")[index];
|
||||
} while (intpart && (iplace < 311));
|
||||
if (iplace == 311) iplace--;
|
||||
iconvert[iplace] = 0;
|
||||
|
||||
/* Convert fractional part */
|
||||
if (fracpart)
|
||||
{
|
||||
do {
|
||||
temp = fracpart;
|
||||
my_modf(fracpart*0.1, &fracpart);
|
||||
temp = temp*0.1;
|
||||
index = (int) ((temp -fracpart +0.05)* 10.0);
|
||||
/* index = (int) ((((temp/10) -fracpart) +0.05) *10); */
|
||||
/* printf ("%lf, %lf, %ld\n", temp, fracpart, index); */
|
||||
fconvert[fplace++] =
|
||||
(caps? "0123456789ABCDEF":"0123456789abcdef")[index];
|
||||
} while(fracpart && (fplace < 311));
|
||||
if (fplace == 311) fplace--;
|
||||
}
|
||||
fconvert[fplace] = 0;
|
||||
|
||||
/* -1 for decimal point, another -1 if we are printing a sign */
|
||||
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
||||
zpadlen = max - fplace;
|
||||
if (zpadlen < 0) zpadlen = 0;
|
||||
if (padlen < 0)
|
||||
padlen = 0;
|
||||
if (flags & DP_F_MINUS)
|
||||
padlen = -padlen; /* Left Justifty */
|
||||
|
||||
if ((flags & DP_F_ZERO) && (padlen > 0)) {
|
||||
if (signvalue) {
|
||||
dopr_outch (buffer, currlen, maxlen, signvalue);
|
||||
--padlen;
|
||||
signvalue = 0;
|
||||
}
|
||||
while (padlen > 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, '0');
|
||||
--padlen;
|
||||
}
|
||||
}
|
||||
while (padlen > 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
--padlen;
|
||||
}
|
||||
if (signvalue)
|
||||
dopr_outch (buffer, currlen, maxlen, signvalue);
|
||||
|
||||
while (iplace > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]);
|
||||
|
||||
#ifdef DEBUG_SNPRINTF
|
||||
printf("fmtfp: fplace=%d zpadlen=%d\n", fplace, zpadlen);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decimal point. This should probably use locale to find the correct
|
||||
* char to print out.
|
||||
*/
|
||||
if (max > 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, '.');
|
||||
|
||||
while (fplace > 0)
|
||||
dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]);
|
||||
}
|
||||
|
||||
while (zpadlen > 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, '0');
|
||||
--zpadlen;
|
||||
}
|
||||
|
||||
while (padlen < 0) {
|
||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||
++padlen;
|
||||
}
|
||||
}
|
||||
|
||||
static void dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
|
||||
{
|
||||
if (*currlen < maxlen) {
|
||||
buffer[(*currlen)] = c;
|
||||
}
|
||||
(*currlen)++;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
|
||||
int vsnprintf (char *str, size_t count, const char *fmt, va_list args)
|
||||
{
|
||||
return dopr(str, count, fmt, args);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_C99_VSNPRINTF)
|
||||
int snprintf(char *str,size_t count,const char *fmt,...)
|
||||
{
|
||||
size_t ret;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
ret = vsnprintf(str, count, fmt, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
int vasprintf(char **ptr, const char *format, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = vsnprintf(NULL, 0, format, ap);
|
||||
if (ret <= 0) return ret;
|
||||
|
||||
(*ptr) = (char *)malloc(ret+1);
|
||||
if (!*ptr) return -1;
|
||||
ret = vsnprintf(*ptr, ret+1, format, ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
int asprintf(char **ptr, const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
int ret;
|
||||
|
||||
va_start(ap, format);
|
||||
ret = vasprintf(ptr, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TEST_SNPRINTF
|
||||
|
||||
int sprintf(char *str,const char *fmt,...);
|
||||
|
||||
int main (void)
|
||||
{
|
||||
char buf1[1024];
|
||||
char buf2[1024];
|
||||
char *fp_fmt[] = {
|
||||
"%1.1f",
|
||||
"%-1.5f",
|
||||
"%1.5f",
|
||||
"%123.9f",
|
||||
"%10.5f",
|
||||
"% 10.5f",
|
||||
"%+22.9f",
|
||||
"%+4.9f",
|
||||
"%01.3f",
|
||||
"%4f",
|
||||
"%3.1f",
|
||||
"%3.2f",
|
||||
"%.0f",
|
||||
"%f",
|
||||
"-16.16f",
|
||||
NULL
|
||||
};
|
||||
double fp_nums[] = { 6442452944.1234, -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996,
|
||||
0.9996, 1.996, 4.136, 0};
|
||||
char *int_fmt[] = {
|
||||
"%-1.5d",
|
||||
"%1.5d",
|
||||
"%123.9d",
|
||||
"%5.5d",
|
||||
"%10.5d",
|
||||
"% 10.5d",
|
||||
"%+22.33d",
|
||||
"%01.3d",
|
||||
"%4d",
|
||||
"%d",
|
||||
NULL
|
||||
};
|
||||
long int_nums[] = { -1, 134, 91340, 341, 0203, 0};
|
||||
char *str_fmt[] = {
|
||||
"10.5s",
|
||||
"5.10s",
|
||||
"10.1s",
|
||||
"0.10s",
|
||||
"10.0s",
|
||||
"1.10s",
|
||||
"%s",
|
||||
"%.1s",
|
||||
"%.10s",
|
||||
"%10s",
|
||||
NULL
|
||||
};
|
||||
char *str_vals[] = {"hello", "a", "", "a longer string", NULL};
|
||||
int x, y;
|
||||
int fail = 0;
|
||||
int num = 0;
|
||||
|
||||
printf ("Testing snprintf format codes against system sprintf...\n");
|
||||
|
||||
for (x = 0; fp_fmt[x] ; x++) {
|
||||
for (y = 0; fp_nums[y] != 0 ; y++) {
|
||||
int l1 = snprintf(NULL, 0, fp_fmt[x], fp_nums[y]);
|
||||
int l2 = snprintf(buf1, sizeof(buf1), fp_fmt[x], fp_nums[y]);
|
||||
sprintf (buf2, fp_fmt[x], fp_nums[y]);
|
||||
if (strcmp (buf1, buf2)) {
|
||||
printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n",
|
||||
fp_fmt[x], buf1, buf2);
|
||||
fail++;
|
||||
}
|
||||
if (l1 != l2) {
|
||||
printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, fp_fmt[x]);
|
||||
fail++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
for (x = 0; int_fmt[x] ; x++) {
|
||||
for (y = 0; int_nums[y] != 0 ; y++) {
|
||||
int l1 = snprintf(NULL, 0, int_fmt[x], int_nums[y]);
|
||||
int l2 = snprintf(buf1, sizeof(buf1), int_fmt[x], int_nums[y]);
|
||||
sprintf (buf2, int_fmt[x], int_nums[y]);
|
||||
if (strcmp (buf1, buf2)) {
|
||||
printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n",
|
||||
int_fmt[x], buf1, buf2);
|
||||
fail++;
|
||||
}
|
||||
if (l1 != l2) {
|
||||
printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, int_fmt[x]);
|
||||
fail++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
for (x = 0; str_fmt[x] ; x++) {
|
||||
for (y = 0; str_vals[y] != 0 ; y++) {
|
||||
int l1 = snprintf(NULL, 0, str_fmt[x], str_vals[y]);
|
||||
int l2 = snprintf(buf1, sizeof(buf1), str_fmt[x], str_vals[y]);
|
||||
sprintf (buf2, str_fmt[x], str_vals[y]);
|
||||
if (strcmp (buf1, buf2)) {
|
||||
printf("snprintf doesn't match Format: %s\n\tsnprintf = [%s]\n\t sprintf = [%s]\n",
|
||||
str_fmt[x], buf1, buf2);
|
||||
fail++;
|
||||
}
|
||||
if (l1 != l2) {
|
||||
printf("snprintf l1 != l2 (%d %d) %s\n", l1, l2, str_fmt[x]);
|
||||
fail++;
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
printf ("%d tests failed out of %d.\n", fail, num);
|
||||
|
||||
printf("seeing how many digits we support\n");
|
||||
{
|
||||
double v0 = 0.12345678901234567890123456789012345678901;
|
||||
for (x=0; x<100; x++) {
|
||||
snprintf(buf1, sizeof(buf1), "%1.1f", v0*pow(10, x));
|
||||
sprintf(buf2, "%1.1f", v0*pow(10, x));
|
||||
if (strcmp(buf1, buf2)) {
|
||||
printf("we seem to support %d digits\n", x-1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* SNPRINTF_TEST */
|
||||
235
WINGs/string.c
Normal file
235
WINGs/string.c
Normal file
@@ -0,0 +1,235 @@
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
|
||||
|
||||
#define PRC_ALPHA 0
|
||||
#define PRC_BLANK 1
|
||||
#define PRC_ESCAPE 2
|
||||
#define PRC_DQUOTE 3
|
||||
#define PRC_EOS 4
|
||||
#define PRC_SQUOTE 5
|
||||
|
||||
typedef struct {
|
||||
short nstate;
|
||||
short output;
|
||||
} DFA;
|
||||
|
||||
|
||||
static DFA mtable[9][6] = {
|
||||
{{3,1},{0,0},{4,0},{1,0},{8,0},{6,0}},
|
||||
{{1,1},{1,1},{2,0},{3,0},{5,0},{1,1}},
|
||||
{{1,1},{1,1},{1,1},{1,1},{5,0},{1,1}},
|
||||
{{3,1},{5,0},{4,0},{1,0},{5,0},{6,0}},
|
||||
{{3,1},{3,1},{3,1},{3,1},{5,0},{3,1}},
|
||||
{{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
|
||||
{{6,1},{6,1},{7,0},{6,1},{5,0},{3,0}},
|
||||
{{6,1},{6,1},{6,1},{6,1},{5,0},{6,1}},
|
||||
{{-1,-1},{0,0},{0,0},{0,0},{0,0},{0,0}}, /* final state */
|
||||
};
|
||||
|
||||
char*
|
||||
wtokennext(char *word, char **next)
|
||||
{
|
||||
char *ptr;
|
||||
char *ret, *t;
|
||||
int state, ctype;
|
||||
|
||||
t = ret = wmalloc(strlen(word)+1);
|
||||
ptr = word;
|
||||
|
||||
state = 0;
|
||||
*t = 0;
|
||||
while (1) {
|
||||
if (*ptr==0)
|
||||
ctype = PRC_EOS;
|
||||
else if (*ptr=='\\')
|
||||
ctype = PRC_ESCAPE;
|
||||
else if (*ptr=='"')
|
||||
ctype = PRC_DQUOTE;
|
||||
else if (*ptr=='\'')
|
||||
ctype = PRC_SQUOTE;
|
||||
else if (*ptr==' ' || *ptr=='\t')
|
||||
ctype = PRC_BLANK;
|
||||
else
|
||||
ctype = PRC_ALPHA;
|
||||
|
||||
if (mtable[state][ctype].output) {
|
||||
*t = *ptr; t++;
|
||||
*t = 0;
|
||||
}
|
||||
state = mtable[state][ctype].nstate;
|
||||
ptr++;
|
||||
if (mtable[state][0].output<0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (*ret==0)
|
||||
t = NULL;
|
||||
else
|
||||
t = wstrdup(ret);
|
||||
|
||||
wfree(ret);
|
||||
|
||||
if (ctype==PRC_EOS)
|
||||
*next = NULL;
|
||||
else
|
||||
*next = ptr;
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
/* separate a string in tokens, taking " and ' into account */
|
||||
void
|
||||
wtokensplit(char *command, char ***argv, int *argc)
|
||||
{
|
||||
char *token, *line;
|
||||
int count;
|
||||
|
||||
count = 0;
|
||||
line = command;
|
||||
do {
|
||||
token = wtokennext(line, &line);
|
||||
if (token) {
|
||||
if (count == 0)
|
||||
*argv = wmalloc(sizeof(char**));
|
||||
else
|
||||
*argv = wrealloc(*argv, (count+1)*sizeof(char**));
|
||||
(*argv)[count++] = token;
|
||||
}
|
||||
} while (token!=NULL && line!=NULL);
|
||||
|
||||
*argc = count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
char*
|
||||
wtokenjoin(char **list, int count)
|
||||
{
|
||||
int i, j;
|
||||
char *flat_string, *wspace;
|
||||
|
||||
j = 0;
|
||||
for (i=0; i<count; i++) {
|
||||
if (list[i]!=NULL && list[i][0]!=0) {
|
||||
j += strlen(list[i]);
|
||||
if (strpbrk(list[i], " \t"))
|
||||
j += 2;
|
||||
}
|
||||
}
|
||||
|
||||
flat_string = wmalloc(j+count+1);
|
||||
|
||||
*flat_string = 0;
|
||||
for (i=0; i<count; i++) {
|
||||
if (list[i]!=NULL && list[i][0]!=0) {
|
||||
if (i>0)
|
||||
strcat(flat_string, " ");
|
||||
wspace = strpbrk(list[i], " \t");
|
||||
if (wspace)
|
||||
strcat(flat_string, "\"");
|
||||
strcat(flat_string, list[i]);
|
||||
if (wspace)
|
||||
strcat(flat_string, "\"");
|
||||
}
|
||||
}
|
||||
|
||||
return flat_string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
wtokenfree(char **tokens, int count)
|
||||
{
|
||||
while (--count) wfree(tokens[count]);
|
||||
wfree(tokens);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
wtrimspace(char *s)
|
||||
{
|
||||
char *t;
|
||||
char *c;
|
||||
|
||||
while (isspace(*s) && *s) s++;
|
||||
t = s+strlen(s)-1;
|
||||
while (t > s && isspace(*t)) t--;
|
||||
|
||||
c = wmalloc(t-s+2);
|
||||
memcpy(c, s, t-s+1);
|
||||
c[t-s+1] = 0;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
wstrdup(char *str)
|
||||
{
|
||||
assert(str!=NULL);
|
||||
|
||||
return strcpy(wmalloc(strlen(str)+1), str);
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
wstrconcat(char *str1, char *str2)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (!str1)
|
||||
return wstrdup(str2);
|
||||
else if (!str2)
|
||||
return wstrdup(str1);
|
||||
|
||||
str = wmalloc(strlen(str1)+strlen(str2)+1);
|
||||
strcpy(str, str1);
|
||||
strcat(str, str2);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
wstrappend(char *dst, char *src)
|
||||
{
|
||||
if (!dst)
|
||||
return wstrdup(src);
|
||||
else if (!src || *src==0)
|
||||
return dst;
|
||||
|
||||
dst = wrealloc(dst, strlen(dst)+strlen(src)+1);
|
||||
strcat(dst, src);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
#ifndef HAVE_STRCASECMP
|
||||
int
|
||||
strcasecmp(const char *s1, const char *s2)
|
||||
{
|
||||
while (*s1 && *s2 && (tolower(*s1)==tolower(*s2))) {
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (tolower(*s1) - tolower(*s2));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Author: Pascal Hofstee <daeron@shadowmere.student.utwente.nl>
|
||||
*/
|
||||
|
||||
|
||||
#include "WINGs.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "logo.xpm"
|
||||
|
||||
void
|
||||
wAbort()
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *ProgName;
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Display *dpy = XOpenDisplay("");
|
||||
WMScreen *scr;
|
||||
WMPixmap *pixmap;
|
||||
WMColorPanel *panel;
|
||||
WMColor *startcolor;
|
||||
char *colorname = NULL;
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
XSynchronize(dpy, True);
|
||||
fprintf(stderr, "...Running Synchronous...\n");
|
||||
#endif
|
||||
|
||||
WMInitializeApplication("WMColorPicker", &argc, argv);
|
||||
|
||||
ProgName = argv[0];
|
||||
|
||||
if (!dpy) {
|
||||
puts("could not open display");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "-h")==0 || strcmp(argv[i], "--help")==0) {
|
||||
printf("testcolorpanel [-h] [--help] [-c <color>]"
|
||||
"[--color <color>]\n");
|
||||
exit(0);
|
||||
}
|
||||
if (strcmp(argv[i], "-c")==0 || strcmp(argv[i], "--color")==0) {
|
||||
i++;
|
||||
if (i >= argc) {
|
||||
printf("%s: missing argument for option '%s'\n",
|
||||
argv[0], argv[i-1]);
|
||||
exit(1);
|
||||
}
|
||||
colorname = argv[i];
|
||||
}
|
||||
}
|
||||
|
||||
scr = WMCreateSimpleApplicationScreen(dpy);
|
||||
|
||||
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
|
||||
WMSetApplicationIconImage(scr, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
|
||||
panel = WMGetColorPanel(scr);
|
||||
|
||||
if (colorname) {
|
||||
startcolor = WMCreateNamedColor(scr, colorname, False);
|
||||
WMSetColorPanelColor(panel, startcolor);
|
||||
WMReleaseColor(startcolor);
|
||||
}
|
||||
|
||||
WMShowColorPanel(panel);
|
||||
|
||||
WMScreenMainLoop(scr);
|
||||
return 0;
|
||||
}
|
||||
279
WINGs/tree.c
Normal file
279
WINGs/tree.c
Normal file
@@ -0,0 +1,279 @@
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
|
||||
typedef struct W_TreeNode {
|
||||
void *data;
|
||||
|
||||
/*unsigned int uflags:16;*/
|
||||
|
||||
WMArray *leaves;
|
||||
|
||||
int depth;
|
||||
|
||||
struct W_TreeNode *parent;
|
||||
|
||||
WMFreeDataProc *destructor;
|
||||
} W_TreeNode;
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
destroyNode(void *data)
|
||||
{
|
||||
WMTreeNode *aNode = (WMTreeNode*) data;
|
||||
|
||||
if (aNode->destructor) {
|
||||
(*aNode->destructor)(aNode->data);
|
||||
}
|
||||
if (aNode->leaves) {
|
||||
WMFreeArray(aNode->leaves);
|
||||
}
|
||||
wfree(aNode);
|
||||
}
|
||||
|
||||
|
||||
WMTreeNode*
|
||||
WMCreateTreeNode(void *data)
|
||||
{
|
||||
return WMCreateTreeNodeWithDestructor(data, NULL);
|
||||
}
|
||||
|
||||
|
||||
WMTreeNode*
|
||||
WMCreateTreeNodeWithDestructor(void *data, WMFreeDataProc *destructor)
|
||||
{
|
||||
WMTreeNode *aNode;
|
||||
|
||||
aNode = (WMTreeNode*) wmalloc(sizeof(W_TreeNode));
|
||||
memset(aNode, 0, sizeof(W_TreeNode));
|
||||
|
||||
aNode->destructor = destructor;
|
||||
|
||||
aNode->data = data;
|
||||
aNode->parent = NULL;
|
||||
aNode->depth = 0;
|
||||
aNode->leaves = NULL;
|
||||
/*aNode->leaves = WMCreateArrayWithDestructor(1, destroyNode);*/
|
||||
|
||||
return aNode;
|
||||
}
|
||||
|
||||
|
||||
WMTreeNode*
|
||||
WMInsertItemInTree(WMTreeNode *parent, int index, void *item)
|
||||
{
|
||||
WMTreeNode *aNode;
|
||||
|
||||
wassertrv(parent!=NULL, NULL);
|
||||
|
||||
aNode = WMCreateTreeNodeWithDestructor(item, parent->destructor);
|
||||
aNode->parent = parent;
|
||||
aNode->depth = parent->depth+1;
|
||||
if (!parent->leaves) {
|
||||
parent->leaves = WMCreateArrayWithDestructor(1, destroyNode);
|
||||
}
|
||||
if (index < 0) {
|
||||
WMAddToArray(parent->leaves, aNode);
|
||||
} else {
|
||||
WMInsertInArray(parent->leaves, index, aNode);
|
||||
}
|
||||
|
||||
return aNode;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
updateNodeDepth(WMTreeNode *aNode, int depth)
|
||||
{
|
||||
int i;
|
||||
|
||||
aNode->depth = depth;
|
||||
|
||||
if (aNode->leaves) {
|
||||
for (i=0; i<WMGetArrayItemCount(aNode->leaves); i++) {
|
||||
updateNodeDepth(WMGetFromArray(aNode->leaves, i), depth+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WMTreeNode*
|
||||
WMInsertNodeInTree(WMTreeNode *parent, int index, WMTreeNode *aNode)
|
||||
{
|
||||
wassertrv(parent!=NULL, NULL);
|
||||
wassertrv(aNode!=NULL, NULL);
|
||||
|
||||
aNode->parent = parent;
|
||||
updateNodeDepth(aNode, parent->depth+1);
|
||||
if (!parent->leaves) {
|
||||
parent->leaves = WMCreateArrayWithDestructor(1, destroyNode);
|
||||
}
|
||||
if (index < 0) {
|
||||
WMAddToArray(parent->leaves, aNode);
|
||||
} else {
|
||||
WMInsertInArray(parent->leaves, index, aNode);
|
||||
}
|
||||
|
||||
return aNode;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMDestroyTreeNode(WMTreeNode *aNode)
|
||||
{
|
||||
wassertr(aNode!=NULL);
|
||||
|
||||
if (aNode->parent && aNode->parent->leaves) {
|
||||
WMRemoveFromArray(aNode->parent->leaves, aNode);
|
||||
} else {
|
||||
destroyNode(aNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMDeleteLeafForTreeNode(WMTreeNode *aNode, int index)
|
||||
{
|
||||
wassertr(aNode!=NULL);
|
||||
wassertr(aNode->leaves!=NULL);
|
||||
|
||||
WMDeleteFromArray(aNode->leaves, index);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sameData(void *item, void *data)
|
||||
{
|
||||
return (((WMTreeNode*)item)->data == data);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMRemoveLeafForTreeNode(WMTreeNode *aNode, void *leaf)
|
||||
{
|
||||
int index;
|
||||
|
||||
wassertr(aNode!=NULL);
|
||||
wassertr(aNode->leaves!=NULL);
|
||||
|
||||
index = WMFindInArray(aNode->leaves, sameData, leaf);
|
||||
if (index != WANotFound) {
|
||||
WMDeleteFromArray(aNode->leaves, index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMReplaceDataForTreeNode(WMTreeNode *aNode, void *newData)
|
||||
{
|
||||
void *old;
|
||||
|
||||
wassertrv(aNode!=NULL, NULL);
|
||||
|
||||
old = aNode->data;
|
||||
aNode->data = newData;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMGetDataForTreeNode(WMTreeNode *aNode)
|
||||
{
|
||||
return aNode->data;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetTreeNodeDepth(WMTreeNode *aNode)
|
||||
{
|
||||
return aNode->depth;
|
||||
}
|
||||
|
||||
|
||||
WMTreeNode*
|
||||
WMGetParentForTreeNode(WMTreeNode *aNode)
|
||||
{
|
||||
return aNode->parent;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSortLeavesForTreeNode(WMTreeNode *aNode, WMCompareDataProc *comparer)
|
||||
{
|
||||
wassertr(aNode!=NULL);
|
||||
|
||||
if (aNode->leaves) {
|
||||
WMSortArray(aNode->leaves, comparer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sortLeavesForNode(WMTreeNode *aNode, WMCompareDataProc *comparer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!aNode->leaves)
|
||||
return;
|
||||
|
||||
WMSortArray(aNode->leaves, comparer);
|
||||
for (i=0; i<WMGetArrayItemCount(aNode->leaves); i++) {
|
||||
sortLeavesForNode(WMGetFromArray(aNode->leaves, i), comparer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSortTree(WMTreeNode *aNode, WMCompareDataProc *comparer)
|
||||
{
|
||||
wassertr(aNode!=NULL);
|
||||
|
||||
sortLeavesForNode(aNode, comparer);
|
||||
}
|
||||
|
||||
|
||||
static WMTreeNode*
|
||||
findNodeInTree(WMTreeNode *aNode, WMMatchDataProc *match, void *cdata)
|
||||
{
|
||||
if (match==NULL) {
|
||||
if (aNode->data == cdata) {
|
||||
return aNode;
|
||||
}
|
||||
} else {
|
||||
if ((*match)(aNode->data, cdata)) {
|
||||
return aNode;
|
||||
}
|
||||
}
|
||||
|
||||
if (aNode->leaves) {
|
||||
WMTreeNode *leaf;
|
||||
int i;
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(aNode->leaves); i++) {
|
||||
leaf = findNodeInTree(WMGetFromArray(aNode->leaves, i), match, cdata);
|
||||
if (leaf) {
|
||||
return leaf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
WMTreeNode*
|
||||
WMFindInTree(WMTreeNode *aTree, WMMatchDataProc *match, void *cdata)
|
||||
{
|
||||
wassertrv(aTree!=NULL, NULL);
|
||||
|
||||
return findNodeInTree(aTree, match, cdata);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,20 +7,19 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
#include "../src/config.h"
|
||||
#include "wconfig.h"
|
||||
|
||||
#include "WINGs.h"
|
||||
|
||||
#include <proplist.h>
|
||||
|
||||
|
||||
typedef struct W_UserDefaults {
|
||||
proplist_t defaults;
|
||||
WMPropList *defaults;
|
||||
|
||||
proplist_t appDomain;
|
||||
WMPropList *appDomain;
|
||||
|
||||
proplist_t searchListArray;
|
||||
proplist_t *searchList; /* cache for searchListArray */
|
||||
WMPropList *searchListArray;
|
||||
WMPropList **searchList; /* cache for searchListArray */
|
||||
|
||||
char dirty;
|
||||
|
||||
@@ -163,7 +162,8 @@ WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable)
|
||||
void
|
||||
WMSynchronizeUserDefaults(WMUserDefaults *database)
|
||||
{
|
||||
Bool fileIsNewer = False, release = False;
|
||||
Bool fileIsNewer = False, release = False, notify = False;
|
||||
WMPropList *plF, *key;
|
||||
char *path;
|
||||
struct stat stbuf;
|
||||
|
||||
@@ -178,14 +178,45 @@ WMSynchronizeUserDefaults(WMUserDefaults *database)
|
||||
fileIsNewer = True;
|
||||
|
||||
if (database->appDomain && (database->dirty || fileIsNewer)) {
|
||||
if (database->dirty && fileIsNewer) {
|
||||
plF = WMReadPropListFromFile(path);
|
||||
if (plF) {
|
||||
plF = WMMergePLDictionaries(plF, database->appDomain, False);
|
||||
WMReleasePropList(database->appDomain);
|
||||
database->appDomain = plF;
|
||||
key = database->searchList[0];
|
||||
WMPutInPLDictionary(database->defaults, key, plF);
|
||||
notify = True;
|
||||
} else {
|
||||
/* something happened with the file. just overwrite it */
|
||||
wwarning(_("cannot read domain from file '%s' when syncing"),
|
||||
path);
|
||||
WMWritePropListToFile(database->appDomain, path, True);
|
||||
}
|
||||
} else if (database->dirty) {
|
||||
WMWritePropListToFile(database->appDomain, path, True);
|
||||
} else if (fileIsNewer) {
|
||||
plF = WMReadPropListFromFile(path);
|
||||
if (plF) {
|
||||
WMReleasePropList(database->appDomain);
|
||||
database->appDomain = plF;
|
||||
key = database->searchList[0];
|
||||
WMPutInPLDictionary(database->defaults, key, plF);
|
||||
notify = True;
|
||||
} else {
|
||||
/* something happened with the file. just overwrite it */
|
||||
wwarning(_("cannot read domain from file '%s' when syncing"),
|
||||
path);
|
||||
WMWritePropListToFile(database->appDomain, path, True);
|
||||
}
|
||||
}
|
||||
|
||||
/*fprintf(stderr, "syncing: %s %d %d\n", path, database->dirty, fileIsNewer);*/
|
||||
|
||||
PLShallowSynchronize(database->appDomain);
|
||||
database->dirty = 0;
|
||||
|
||||
if (stat(path, &stbuf) >= 0)
|
||||
database->timestamp = stbuf.st_mtime;
|
||||
if (fileIsNewer) {
|
||||
|
||||
if (notify) {
|
||||
WMPostNotificationName(WMUserDefaultsDidChangeNotification,
|
||||
database, NULL);
|
||||
}
|
||||
@@ -205,14 +236,14 @@ WMSaveUserDefaults(WMUserDefaults *database)
|
||||
char *path;
|
||||
Bool release = False;
|
||||
|
||||
PLSave(database->appDomain, YES);
|
||||
database->dirty = 0;
|
||||
if (!database->path) {
|
||||
path = wdefaultspathfordomain(WMGetApplicationName());
|
||||
release = True;
|
||||
} else {
|
||||
path = database->path;
|
||||
}
|
||||
WMWritePropListToFile(database->appDomain, path, True);
|
||||
database->dirty = 0;
|
||||
if (stat(path, &stbuf) >= 0)
|
||||
database->timestamp = stbuf.st_mtime;
|
||||
if (release)
|
||||
@@ -225,8 +256,8 @@ WMUserDefaults*
|
||||
WMGetStandardUserDefaults(void)
|
||||
{
|
||||
WMUserDefaults *defaults;
|
||||
proplist_t domain;
|
||||
proplist_t key;
|
||||
WMPropList *domain;
|
||||
WMPropList *key;
|
||||
struct stat stbuf;
|
||||
char *path;
|
||||
int i;
|
||||
@@ -245,12 +276,12 @@ WMGetStandardUserDefaults(void)
|
||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||
memset(defaults, 0, sizeof(WMUserDefaults));
|
||||
|
||||
defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||
|
||||
defaults->searchList = wmalloc(sizeof(proplist_t)*3);
|
||||
defaults->searchList = wmalloc(sizeof(WMPropList*)*3);
|
||||
|
||||
/* application domain */
|
||||
key = PLMakeString(WMGetApplicationName());
|
||||
key = WMCreatePLString(WMGetApplicationName());
|
||||
defaults->searchList[0] = key;
|
||||
|
||||
/* temporary kluge */
|
||||
@@ -258,59 +289,49 @@ WMGetStandardUserDefaults(void)
|
||||
domain = NULL;
|
||||
path = NULL;
|
||||
} else {
|
||||
path = wdefaultspathfordomain(PLGetString(key));
|
||||
path = wdefaultspathfordomain(WMGetFromPLString(key));
|
||||
|
||||
if (stat(path, &stbuf) >= 0)
|
||||
defaults->timestamp = stbuf.st_mtime;
|
||||
|
||||
domain = PLGetProplistWithPath(path);
|
||||
domain = WMReadPropListFromFile(path);
|
||||
}
|
||||
if (!domain) {
|
||||
proplist_t p;
|
||||
|
||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
if (path) {
|
||||
p = PLMakeString(path);
|
||||
PLSetFilename(domain, p);
|
||||
PLRelease(p);
|
||||
}
|
||||
}
|
||||
if (!domain)
|
||||
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||
|
||||
if (path)
|
||||
wfree(path);
|
||||
|
||||
defaults->appDomain = domain;
|
||||
|
||||
if (domain)
|
||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
||||
|
||||
PLRelease(key);
|
||||
WMPutInPLDictionary(defaults->defaults, key, domain);
|
||||
|
||||
/* global domain */
|
||||
key = PLMakeString("WMGLOBAL");
|
||||
key = WMCreatePLString("WMGLOBAL");
|
||||
defaults->searchList[1] = key;
|
||||
|
||||
path = wdefaultspathfordomain(PLGetString(key));
|
||||
path = wdefaultspathfordomain(WMGetFromPLString(key));
|
||||
|
||||
domain = PLGetProplistWithPath(path);
|
||||
domain = WMReadPropListFromFile(path);
|
||||
|
||||
wfree(path);
|
||||
|
||||
if (!domain)
|
||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||
|
||||
if (domain)
|
||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
||||
|
||||
PLRelease(key);
|
||||
WMPutInPLDictionary(defaults->defaults, key, domain);
|
||||
|
||||
/* terminate list */
|
||||
defaults->searchList[2] = NULL;
|
||||
|
||||
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
|
||||
defaults->searchListArray = WMCreatePLArray(NULL,NULL);
|
||||
|
||||
i = 0;
|
||||
while (defaults->searchList[i]) {
|
||||
PLAppendArrayElement(defaults->searchListArray,
|
||||
WMAddToPLArray(defaults->searchListArray,
|
||||
defaults->searchList[i]);
|
||||
i++;
|
||||
}
|
||||
@@ -330,8 +351,8 @@ WMUserDefaults*
|
||||
WMGetDefaultsFromPath(char *path)
|
||||
{
|
||||
WMUserDefaults *defaults;
|
||||
proplist_t domain;
|
||||
proplist_t key;
|
||||
WMPropList *domain;
|
||||
WMPropList *key;
|
||||
struct stat stbuf;
|
||||
char *name;
|
||||
int i;
|
||||
@@ -351,9 +372,9 @@ WMGetDefaultsFromPath(char *path)
|
||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||
memset(defaults, 0, sizeof(WMUserDefaults));
|
||||
|
||||
defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
defaults->defaults = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||
|
||||
defaults->searchList = wmalloc(sizeof(proplist_t)*2);
|
||||
defaults->searchList = wmalloc(sizeof(WMPropList*)*2);
|
||||
|
||||
/* the domain we want, go in the first position */
|
||||
name = strrchr(path, '/');
|
||||
@@ -362,40 +383,32 @@ WMGetDefaultsFromPath(char *path)
|
||||
else
|
||||
name++;
|
||||
|
||||
key = PLMakeString(name);
|
||||
key = WMCreatePLString(name);
|
||||
defaults->searchList[0] = key;
|
||||
|
||||
if (stat(path, &stbuf) >= 0)
|
||||
defaults->timestamp = stbuf.st_mtime;
|
||||
|
||||
domain = PLGetProplistWithPath(path);
|
||||
domain = WMReadPropListFromFile(path);
|
||||
|
||||
if (!domain) {
|
||||
proplist_t p;
|
||||
|
||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
p = PLMakeString(path);
|
||||
PLSetFilename(domain, p);
|
||||
PLRelease(p);
|
||||
}
|
||||
if (!domain)
|
||||
domain = WMCreatePLDictionary(NULL, NULL, NULL);
|
||||
|
||||
defaults->path = wstrdup(path);
|
||||
|
||||
defaults->appDomain = domain;
|
||||
|
||||
if (domain)
|
||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
||||
|
||||
PLRelease(key);
|
||||
WMPutInPLDictionary(defaults->defaults, key, domain);
|
||||
|
||||
/* terminate list */
|
||||
defaults->searchList[1] = NULL;
|
||||
|
||||
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
|
||||
defaults->searchListArray = WMCreatePLArray(NULL,NULL);
|
||||
|
||||
i = 0;
|
||||
while (defaults->searchList[i]) {
|
||||
PLAppendArrayElement(defaults->searchListArray,
|
||||
WMAddToPLArray(defaults->searchListArray,
|
||||
defaults->searchList[i]);
|
||||
i++;
|
||||
}
|
||||
@@ -411,75 +424,85 @@ WMGetDefaultsFromPath(char *path)
|
||||
}
|
||||
|
||||
|
||||
proplist_t
|
||||
/* Returns a WMPropList array with all keys in the user defaults database.
|
||||
* Free the array with WMReleasePropList() when no longer needed,
|
||||
* but do not free the elements of the array! They're just references. */
|
||||
WMPropList*
|
||||
WMGetUDKeys(WMUserDefaults *database)
|
||||
{
|
||||
return WMGetPLDictionaryKeys(database->appDomain);
|
||||
}
|
||||
|
||||
|
||||
WMPropList*
|
||||
WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
||||
{
|
||||
proplist_t domainName, domain;
|
||||
proplist_t object = NULL;
|
||||
proplist_t key = PLMakeString(defaultName);
|
||||
WMPropList *domainName, *domain;
|
||||
WMPropList *object = NULL;
|
||||
WMPropList *key = WMCreatePLString(defaultName);
|
||||
int i = 0;
|
||||
|
||||
while (database->searchList[i] && !object) {
|
||||
domainName = database->searchList[i];
|
||||
domain = PLGetDictionaryEntry(database->defaults, domainName);
|
||||
domain = WMGetFromPLDictionary(database->defaults, domainName);
|
||||
if (domain) {
|
||||
object = PLGetDictionaryEntry(domain, key);
|
||||
object = WMGetFromPLDictionary(domain, key);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
PLRelease(key);
|
||||
WMReleasePropList(key);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetUDObjectForKey(WMUserDefaults *database, proplist_t object,
|
||||
WMSetUDObjectForKey(WMUserDefaults *database, WMPropList *object,
|
||||
char *defaultName)
|
||||
{
|
||||
proplist_t key = PLMakeString(defaultName);
|
||||
WMPropList *key = WMCreatePLString(defaultName);
|
||||
|
||||
database->dirty = 1;
|
||||
|
||||
PLInsertDictionaryEntry(database->appDomain, key, object);
|
||||
PLRelease(key);
|
||||
WMPutInPLDictionary(database->appDomain, key, object);
|
||||
WMReleasePropList(key);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
||||
{
|
||||
proplist_t key = PLMakeString(defaultName);
|
||||
WMPropList *key = WMCreatePLString(defaultName);
|
||||
|
||||
database->dirty = 1;
|
||||
|
||||
PLRemoveDictionaryEntry(database->appDomain, key);
|
||||
WMRemoveFromPLDictionary(database->appDomain, key);
|
||||
|
||||
PLRelease(key);
|
||||
WMReleasePropList(key);
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
WMGetUDStringForKey(WMUserDefaults *database, char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
|
||||
val = WMGetUDObjectForKey(database, defaultName);
|
||||
|
||||
if (!val)
|
||||
return NULL;
|
||||
|
||||
if (!PLIsString(val))
|
||||
if (!WMIsPLString(val))
|
||||
return NULL;
|
||||
|
||||
return PLGetString(val);
|
||||
return WMGetFromPLString(val);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
char *str;
|
||||
int value;
|
||||
|
||||
@@ -488,10 +511,10 @@ WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
||||
if (!val)
|
||||
return 0;
|
||||
|
||||
if (!PLIsString(val))
|
||||
if (!WMIsPLString(val))
|
||||
return 0;
|
||||
|
||||
str = PLGetString(val);
|
||||
str = WMGetFromPLString(val);
|
||||
if (!str)
|
||||
return 0;
|
||||
|
||||
@@ -506,16 +529,16 @@ WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
||||
float
|
||||
WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
char *str;
|
||||
float value;
|
||||
|
||||
val = WMGetUDObjectForKey(database, defaultName);
|
||||
|
||||
if (!val || !PLIsString(val))
|
||||
if (!val || !WMIsPLString(val))
|
||||
return 0.0;
|
||||
|
||||
if (!(str = PLGetString(val)))
|
||||
if (!(str = WMGetFromPLString(val)))
|
||||
return 0.0;
|
||||
|
||||
if (sscanf(str, "%f", &value)!=1)
|
||||
@@ -529,7 +552,7 @@ WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
|
||||
Bool
|
||||
WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
WMPropList *val;
|
||||
int value;
|
||||
char *str;
|
||||
|
||||
@@ -538,10 +561,10 @@ WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
|
||||
if (!val)
|
||||
return False;
|
||||
|
||||
if (!PLIsString(val))
|
||||
if (!WMIsPLString(val))
|
||||
return False;
|
||||
|
||||
str = PLGetString(val);
|
||||
str = WMGetFromPLString(val);
|
||||
if (!str)
|
||||
return False;
|
||||
|
||||
@@ -561,14 +584,14 @@ WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName)
|
||||
void
|
||||
WMSetUDIntegerForKey(WMUserDefaults *database, int value, char *defaultName)
|
||||
{
|
||||
proplist_t object;
|
||||
WMPropList *object;
|
||||
char buffer[128];
|
||||
|
||||
sprintf(buffer, "%i", value);
|
||||
object = PLMakeString(buffer);
|
||||
object = WMCreatePLString(buffer);
|
||||
|
||||
WMSetUDObjectForKey(database, object, defaultName);
|
||||
PLRelease(object);
|
||||
WMReleasePropList(object);
|
||||
}
|
||||
|
||||
|
||||
@@ -577,12 +600,12 @@ WMSetUDIntegerForKey(WMUserDefaults *database, int value, char *defaultName)
|
||||
void
|
||||
WMSetUDStringForKey(WMUserDefaults *database, char *value, char *defaultName)
|
||||
{
|
||||
proplist_t object;
|
||||
WMPropList *object;
|
||||
|
||||
object = PLMakeString(value);
|
||||
object = WMCreatePLString(value);
|
||||
|
||||
WMSetUDObjectForKey(database, object, defaultName);
|
||||
PLRelease(object);
|
||||
WMReleasePropList(object);
|
||||
}
|
||||
|
||||
|
||||
@@ -590,14 +613,14 @@ WMSetUDStringForKey(WMUserDefaults *database, char *value, char *defaultName)
|
||||
void
|
||||
WMSetUDFloatForKey(WMUserDefaults *database, float value, char *defaultName)
|
||||
{
|
||||
proplist_t object;
|
||||
WMPropList *object;
|
||||
char buffer[128];
|
||||
|
||||
sprintf(buffer, "%f", value);
|
||||
object = PLMakeString(buffer);
|
||||
object = WMCreatePLString(buffer);
|
||||
|
||||
WMSetUDObjectForKey(database, object, defaultName);
|
||||
PLRelease(object);
|
||||
WMReleasePropList(object);
|
||||
}
|
||||
|
||||
|
||||
@@ -605,18 +628,18 @@ WMSetUDFloatForKey(WMUserDefaults *database, float value, char *defaultName)
|
||||
void
|
||||
WMSetUDBoolForKey(WMUserDefaults *database, Bool value, char *defaultName)
|
||||
{
|
||||
static proplist_t yes = NULL, no = NULL;
|
||||
static WMPropList *yes = NULL, *no = NULL;
|
||||
|
||||
if (!yes) {
|
||||
yes = PLMakeString("YES");
|
||||
no = PLMakeString("NO");
|
||||
yes = WMCreatePLString("YES");
|
||||
no = WMCreatePLString("NO");
|
||||
}
|
||||
|
||||
WMSetUDObjectForKey(database, value ? yes : no, defaultName);
|
||||
}
|
||||
|
||||
|
||||
proplist_t
|
||||
WMPropList*
|
||||
WMGetUDSearchList(WMUserDefaults *database)
|
||||
{
|
||||
return database->searchListArray;
|
||||
@@ -624,30 +647,30 @@ WMGetUDSearchList(WMUserDefaults *database)
|
||||
|
||||
|
||||
void
|
||||
WMSetUDSearchList(WMUserDefaults *database, proplist_t list)
|
||||
WMSetUDSearchList(WMUserDefaults *database, WMPropList *list)
|
||||
{
|
||||
int i, c;
|
||||
|
||||
if (database->searchList) {
|
||||
i = 0;
|
||||
while (database->searchList[i]) {
|
||||
PLRelease(database->searchList[i]);
|
||||
WMReleasePropList(database->searchList[i]);
|
||||
i++;
|
||||
}
|
||||
wfree(database->searchList);
|
||||
}
|
||||
if (database->searchListArray) {
|
||||
PLRelease(database->searchListArray);
|
||||
WMReleasePropList(database->searchListArray);
|
||||
}
|
||||
|
||||
c = PLGetNumberOfElements(list);
|
||||
database->searchList = wmalloc(sizeof(proplist_t)*(c+1));
|
||||
c = WMGetPropListItemCount(list);
|
||||
database->searchList = wmalloc(sizeof(WMPropList*)*(c+1));
|
||||
|
||||
for (i=0; i<c; i++) {
|
||||
database->searchList[i] = PLGetArrayElement(list, i);
|
||||
database->searchList[i] = WMGetFromPLArray(list, i);
|
||||
}
|
||||
|
||||
database->searchListArray = PLDeepCopy(list);
|
||||
database->searchListArray = WMDeepCopyPropList(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
#include "X11/Xlocale.h"
|
||||
|
||||
|
||||
extern void W_InitNotificationCenter(void);
|
||||
|
||||
@@ -31,6 +35,16 @@ WMInitializeApplication(char *applicationName, int *argc, char **argv)
|
||||
assert(argv!=NULL);
|
||||
assert(applicationName!=NULL);
|
||||
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
#ifdef I18N
|
||||
if (getenv("NLSPATH"))
|
||||
bindtextdomain("WINGs", getenv("NLSPATH"));
|
||||
else
|
||||
bindtextdomain("WINGs", LOCALEDIR);
|
||||
#endif
|
||||
|
||||
_WINGS_progname = argv[0];
|
||||
|
||||
WMApplication.applicationName = wstrdup(applicationName);
|
||||
|
||||
@@ -6,40 +6,77 @@
|
||||
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
/* Xmd.h which is indirectly included by GNUstep.h defines BOOL,
|
||||
* but libPropList also defines it. So we do this kluge to get rid of BOOL
|
||||
* temporarily */
|
||||
#ifdef BOOL
|
||||
# define WINGS_BOOL
|
||||
# undef BOOL
|
||||
#endif
|
||||
|
||||
#include "GNUstep.h"
|
||||
|
||||
#ifdef WINGS_BOOL
|
||||
# define BOOL
|
||||
# undef WINGS_BOOL
|
||||
#endif
|
||||
|
||||
|
||||
extern struct W_Application WMApplication;
|
||||
|
||||
|
||||
void
|
||||
WMSetApplicationIconImage(WMScreen *scr, WMPixmap *icon)
|
||||
WMSetApplicationIconWindow(WMScreen *scr, Window window)
|
||||
{
|
||||
if (scr->applicationIcon)
|
||||
WMReleasePixmap(scr->applicationIcon);
|
||||
scr->applicationIconWindow = window;
|
||||
|
||||
scr->applicationIcon = WMRetainPixmap(icon);
|
||||
if (scr->groupLeader) {
|
||||
XWMHints *hints;
|
||||
|
||||
hints = XGetWMHints(scr->display, scr->groupLeader);
|
||||
hints->flags |= IconWindowHint;
|
||||
hints->icon_window = window;
|
||||
|
||||
XSetWMHints(scr->display, scr->groupLeader, hints);
|
||||
XFree(hints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetApplicationIconImage(WMScreen *scr, RImage *image)
|
||||
{
|
||||
WMPixmap *icon;
|
||||
|
||||
if (scr->applicationIconImage == image)
|
||||
return;
|
||||
|
||||
if (scr->applicationIconImage)
|
||||
RReleaseImage(scr->applicationIconImage);
|
||||
|
||||
scr->applicationIconImage = RRetainImage(image);
|
||||
|
||||
/* TODO: check whether we should set the pixmap only if there's none yet */
|
||||
if (image!=NULL && (icon=WMCreatePixmapFromRImage(scr, image, 128))!=NULL) {
|
||||
WMSetApplicationIconPixmap(scr, icon);
|
||||
WMReleasePixmap(icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
RImage*
|
||||
WMGetApplicationIconImage(WMScreen *scr)
|
||||
{
|
||||
return scr->applicationIconImage;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetApplicationIconPixmap(WMScreen *scr, WMPixmap *icon)
|
||||
{
|
||||
if (scr->applicationIconPixmap == icon)
|
||||
return;
|
||||
|
||||
if (scr->applicationIconPixmap)
|
||||
WMReleasePixmap(scr->applicationIconPixmap);
|
||||
|
||||
scr->applicationIconPixmap = WMRetainPixmap(icon);
|
||||
|
||||
if (scr->groupLeader) {
|
||||
XWMHints *hints;
|
||||
|
||||
hints = XGetWMHints(scr->display, scr->groupLeader);
|
||||
hints->flags |= IconPixmapHint|IconMaskHint;
|
||||
hints->icon_pixmap = icon->pixmap;
|
||||
hints->icon_mask = icon->mask;
|
||||
hints->icon_pixmap = (icon!=NULL ? icon->pixmap : None);
|
||||
hints->icon_mask = (icon!=NULL ? icon->mask : None);
|
||||
|
||||
XSetWMHints(scr->display, scr->groupLeader, hints);
|
||||
XFree(hints);
|
||||
@@ -48,9 +85,35 @@ WMSetApplicationIconImage(WMScreen *scr, WMPixmap *icon)
|
||||
|
||||
|
||||
WMPixmap*
|
||||
WMGetApplicationIconImage(WMScreen *scr)
|
||||
WMGetApplicationIconPixmap(WMScreen *scr)
|
||||
{
|
||||
return scr->applicationIcon;
|
||||
return scr->applicationIconPixmap;
|
||||
}
|
||||
|
||||
|
||||
WMPixmap*
|
||||
WMCreateApplicationIconBlendedPixmap(WMScreen *scr, RColor *color)
|
||||
{
|
||||
WMPixmap *pix;
|
||||
|
||||
if (scr->applicationIconImage) {
|
||||
RColor gray;
|
||||
|
||||
gray.red = 0xae;
|
||||
gray.green = 0xaa;
|
||||
gray.blue = 0xae;
|
||||
gray.alpha = 0;
|
||||
|
||||
if (!color)
|
||||
color = &gray;
|
||||
|
||||
pix = WMCreateBlendedPixmapFromRImage(scr, scr->applicationIconImage,
|
||||
color);
|
||||
} else {
|
||||
pix = NULL;
|
||||
}
|
||||
|
||||
return pix;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,12 +149,17 @@ W_InitApplication(WMScreen *scr)
|
||||
hints->flags = WindowGroupHint;
|
||||
hints->window_group = leader;
|
||||
|
||||
if (scr->applicationIcon) {
|
||||
/* This code will never actually be reached, because to have
|
||||
* scr->applicationIconPixmap set we need to have a screen first,
|
||||
* but this function is called in the screen creation process.
|
||||
* -Dan
|
||||
*/
|
||||
if (scr->applicationIconPixmap) {
|
||||
hints->flags |= IconPixmapHint;
|
||||
hints->icon_pixmap = scr->applicationIcon->pixmap;
|
||||
if (scr->applicationIcon->mask) {
|
||||
hints->icon_pixmap = scr->applicationIconPixmap->pixmap;
|
||||
if (scr->applicationIconPixmap->mask) {
|
||||
hints->flags |= IconMaskHint;
|
||||
hints->icon_mask = scr->applicationIcon->mask;
|
||||
hints->icon_mask = scr->applicationIconPixmap->mask;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,16 +61,13 @@ W_CreateBalloon(WMScreen *scr)
|
||||
bPtr = wmalloc(sizeof(Balloon));
|
||||
memset(bPtr, 0, sizeof(Balloon));
|
||||
|
||||
bPtr->view = W_CreateTopView(scr);
|
||||
bPtr->view = W_CreateUnmanagedTopView(scr);
|
||||
if (!bPtr->view) {
|
||||
wfree(bPtr);
|
||||
return NULL;
|
||||
}
|
||||
bPtr->view->self = bPtr;
|
||||
|
||||
bPtr->view->attribFlags |= CWOverrideRedirect;
|
||||
bPtr->view->attribs.override_redirect = True;
|
||||
|
||||
bPtr->textColor = WMRetainColor(bPtr->view->screen->black);
|
||||
|
||||
WMCreateEventHandler(bPtr->view, StructureNotifyMask, handleEvents, bPtr);
|
||||
|
||||
272
WINGs/wbox.c
Normal file
272
WINGs/wbox.c
Normal file
@@ -0,0 +1,272 @@
|
||||
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMView *view;
|
||||
int minSize;
|
||||
int maxSize;
|
||||
int space;
|
||||
unsigned expand:1;
|
||||
unsigned fill:1;
|
||||
unsigned end:1;
|
||||
} SubviewItem;
|
||||
|
||||
|
||||
typedef struct W_Box {
|
||||
W_Class widgetClass;
|
||||
W_View *view;
|
||||
|
||||
SubviewItem *subviews;
|
||||
int subviewCount;
|
||||
|
||||
short borderWidth;
|
||||
|
||||
unsigned horizontal:1;
|
||||
} Box;
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 40
|
||||
#define DEFAULT_HEIGHT 40
|
||||
|
||||
|
||||
|
||||
static void destroyBox(Box *bPtr);
|
||||
|
||||
static void handleEvents(XEvent *event, void *data);
|
||||
|
||||
static void didResize(struct W_ViewDelegate*, WMView*);
|
||||
|
||||
static W_ViewDelegate delegate = {
|
||||
NULL,
|
||||
NULL,
|
||||
didResize,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
WMBox*
|
||||
WMCreateBox(WMWidget *parent)
|
||||
{
|
||||
Box *bPtr;
|
||||
|
||||
bPtr = wmalloc(sizeof(Box));
|
||||
memset(bPtr, 0, sizeof(Box));
|
||||
|
||||
bPtr->widgetClass = WC_Box;
|
||||
|
||||
bPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!bPtr->view) {
|
||||
wfree(bPtr);
|
||||
return NULL;
|
||||
}
|
||||
bPtr->view->self = bPtr;
|
||||
|
||||
bPtr->view->delegate = &delegate;
|
||||
|
||||
WMCreateEventHandler(bPtr->view, StructureNotifyMask,
|
||||
handleEvents, bPtr);
|
||||
|
||||
WMResizeWidget(bPtr, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
|
||||
bPtr->subviews = NULL;
|
||||
bPtr->subviewCount = 0;
|
||||
|
||||
return bPtr;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rearrange(WMBox *box)
|
||||
{
|
||||
int i;
|
||||
int x, y;
|
||||
int xe, ye;
|
||||
int w = 1, h = 1;
|
||||
int total;
|
||||
int expands = 0;
|
||||
|
||||
x = box->borderWidth;
|
||||
y = box->borderWidth;
|
||||
|
||||
if (box->horizontal) {
|
||||
ye = box->borderWidth;
|
||||
xe = WMWidgetWidth(box) - box->borderWidth;
|
||||
h = WMWidgetHeight(box) - 2 * box->borderWidth;
|
||||
total = WMWidgetWidth(box) - 2 * box->borderWidth;
|
||||
} else {
|
||||
xe = box->borderWidth;
|
||||
ye = WMWidgetHeight(box) - box->borderWidth;
|
||||
w = WMWidgetWidth(box) - 2 * box->borderWidth;
|
||||
total = WMWidgetHeight(box) - 2 * box->borderWidth;
|
||||
}
|
||||
|
||||
if (w <= 0 || h <= 0 || total <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < box->subviewCount; i++) {
|
||||
total -= box->subviews[i].minSize;
|
||||
total -= box->subviews[i].space;
|
||||
if (box->subviews[i].expand) {
|
||||
expands++;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < box->subviewCount; i++) {
|
||||
if (box->horizontal) {
|
||||
w = box->subviews[i].minSize;
|
||||
if (box->subviews[i].expand)
|
||||
w += total/expands;
|
||||
} else {
|
||||
h = box->subviews[i].minSize;
|
||||
if (box->subviews[i].expand)
|
||||
h += total/expands;
|
||||
}
|
||||
if (!box->subviews[i].end) {
|
||||
W_MoveView(box->subviews[i].view, x, y);
|
||||
}
|
||||
W_ResizeView(box->subviews[i].view, w, h);
|
||||
if (box->horizontal) {
|
||||
if (box->subviews[i].end)
|
||||
xe -= w + box->subviews[i].space;
|
||||
else
|
||||
x += w + box->subviews[i].space;
|
||||
} else {
|
||||
if (box->subviews[i].end)
|
||||
ye -= h + box->subviews[i].space;
|
||||
else
|
||||
y += h + box->subviews[i].space;
|
||||
}
|
||||
if (box->subviews[i].end) {
|
||||
W_MoveView(box->subviews[i].view, xe, ye);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBoxBorderWidth(WMBox *box, unsigned width)
|
||||
{
|
||||
if (box->borderWidth != width) {
|
||||
box->borderWidth = width;
|
||||
rearrange(box);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMAddBoxSubview(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
||||
int minSize, int maxSize, int space)
|
||||
{
|
||||
int i = bPtr->subviewCount;
|
||||
|
||||
bPtr->subviewCount++;
|
||||
if (!bPtr->subviews)
|
||||
bPtr->subviews = wmalloc(sizeof(SubviewItem));
|
||||
else
|
||||
bPtr->subviews = wrealloc(bPtr->subviews,
|
||||
bPtr->subviewCount*sizeof(SubviewItem));
|
||||
bPtr->subviews[i].view = view;
|
||||
bPtr->subviews[i].minSize = minSize;
|
||||
bPtr->subviews[i].maxSize = maxSize;
|
||||
bPtr->subviews[i].expand = expand;
|
||||
bPtr->subviews[i].fill = fill;
|
||||
bPtr->subviews[i].space = space;
|
||||
bPtr->subviews[i].end = 0;
|
||||
|
||||
rearrange(bPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMAddBoxSubviewAtEnd(WMBox *bPtr, WMView *view, Bool expand, Bool fill,
|
||||
int minSize, int maxSize, int space)
|
||||
{
|
||||
int i = bPtr->subviewCount;
|
||||
|
||||
bPtr->subviewCount++;
|
||||
if (!bPtr->subviews)
|
||||
bPtr->subviews = wmalloc(sizeof(SubviewItem));
|
||||
else
|
||||
bPtr->subviews = wrealloc(bPtr->subviews,
|
||||
bPtr->subviewCount*sizeof(SubviewItem));
|
||||
bPtr->subviews[i].view = view;
|
||||
bPtr->subviews[i].minSize = minSize;
|
||||
bPtr->subviews[i].maxSize = maxSize;
|
||||
bPtr->subviews[i].expand = expand;
|
||||
bPtr->subviews[i].fill = fill;
|
||||
bPtr->subviews[i].space = space;
|
||||
bPtr->subviews[i].end = 1;
|
||||
|
||||
rearrange(bPtr);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMRemoveBoxSubview(WMBox *bPtr, WMView *view)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < bPtr->subviewCount; i++) {
|
||||
if (bPtr->subviews[i].view == view) {
|
||||
memmove(&bPtr->subviews[i], &bPtr->subviews[i+1],
|
||||
(bPtr->subviewCount - i - 1) * sizeof(void*));
|
||||
bPtr->subviewCount--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rearrange(bPtr);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBoxHorizontal(WMBox *box, Bool flag)
|
||||
{
|
||||
/* make sure flag is either 0 or 1 no matter what true value was passed */
|
||||
flag = ((flag==0) ? 0 : 1);
|
||||
if (box->horizontal != flag) {
|
||||
box->horizontal = flag;
|
||||
rearrange(box);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
destroyBox(Box *bPtr)
|
||||
{
|
||||
WMRemoveNotificationObserver(bPtr);
|
||||
wfree(bPtr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
didResize(struct W_ViewDelegate *delegate, WMView *view)
|
||||
{
|
||||
rearrange(view->self);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleEvents(XEvent *event, void *data)
|
||||
{
|
||||
Box *bPtr = (Box*)data;
|
||||
|
||||
CHECK_CLASS(data, WC_Box);
|
||||
|
||||
switch (event->type) {
|
||||
case DestroyNotify:
|
||||
destroyBox(bPtr);
|
||||
break;
|
||||
|
||||
case ConfigureNotify:
|
||||
rearrange(bPtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
139
WINGs/wbrowser.c
139
WINGs/wbrowser.c
@@ -42,6 +42,7 @@ typedef struct W_Browser {
|
||||
struct {
|
||||
unsigned int isTitled:1;
|
||||
unsigned int allowMultipleSelection:1;
|
||||
unsigned int allowEmptySelection:1;
|
||||
unsigned int hasScroller:1;
|
||||
|
||||
/* */
|
||||
@@ -84,8 +85,8 @@ static void loadColumn(WMBrowser *bPtr, int column);
|
||||
|
||||
static void removeColumn(WMBrowser *bPtr, int column);
|
||||
|
||||
static char*
|
||||
createTruncatedString(WMFont *font, char *text, int *textLen, int width);
|
||||
static char* createTruncatedString(WMFont *font, char *text, int *textLen,
|
||||
int width);
|
||||
|
||||
static void willResizeBrowser(W_ViewDelegate*, WMView*,
|
||||
unsigned int*, unsigned int*);
|
||||
@@ -150,6 +151,30 @@ WMCreateBrowser(WMWidget *parent)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBrowserAllowMultipleSelection(WMBrowser *bPtr, Bool flag)
|
||||
{
|
||||
int i;
|
||||
|
||||
bPtr->flags.allowMultipleSelection = flag ? 1 : 0;
|
||||
for (i=0; i<bPtr->columnCount; i++) {
|
||||
WMSetListAllowMultipleSelection(bPtr->columns[i], flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBrowserAllowEmptySelection(WMBrowser *bPtr, Bool flag)
|
||||
{
|
||||
int i;
|
||||
|
||||
bPtr->flags.allowEmptySelection = flag ? 1 : 0;
|
||||
for (i=0; i<bPtr->columnCount; i++) {
|
||||
WMSetListAllowEmptySelection(bPtr->columns[i], flag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetBrowserMaxVisibleColumns(WMBrowser *bPtr)
|
||||
{
|
||||
@@ -257,7 +282,7 @@ drawTitleOfColumn(WMBrowser *bPtr, int column)
|
||||
(bPtr->titleHeight-WMFontHeight(scr->boldFont))/2,
|
||||
bPtr->columnSize.width, WACenter, WMColorGC(scr->white),
|
||||
False, titleBuf, titleLen);
|
||||
free (titleBuf);
|
||||
wfree (titleBuf);
|
||||
} else {
|
||||
W_PaintText(bPtr->view, bPtr->view->window, scr->boldFont, x,
|
||||
(bPtr->titleHeight-WMFontHeight(scr->boldFont))/2,
|
||||
@@ -442,9 +467,9 @@ WMSortBrowserColumn(WMBrowser *bPtr, int column)
|
||||
|
||||
void
|
||||
WMSortBrowserColumnWithComparer(WMBrowser *bPtr, int column,
|
||||
int (f)(const void*, const void*))
|
||||
WMCompareDataProc *func)
|
||||
{
|
||||
WMSortListItemsWithComparer(bPtr->columns[column], f);
|
||||
WMSortListItemsWithComparer(bPtr->columns[column], func);
|
||||
}
|
||||
|
||||
|
||||
@@ -578,6 +603,7 @@ scrollCallback(WMWidget *scroller, void *self)
|
||||
break;
|
||||
|
||||
case WSDecrementPage:
|
||||
case WSDecrementWheel:
|
||||
if (bPtr->firstVisibleColumn > 0) {
|
||||
newFirst = bPtr->firstVisibleColumn - bPtr->maxVisibleColumns;
|
||||
|
||||
@@ -593,6 +619,7 @@ scrollCallback(WMWidget *scroller, void *self)
|
||||
break;
|
||||
|
||||
case WSIncrementPage:
|
||||
case WSIncrementWheel:
|
||||
if (LAST_VISIBLE_COLUMN < bPtr->usedColumnCount) {
|
||||
newFirst = bPtr->firstVisibleColumn + bPtr->maxVisibleColumns;
|
||||
|
||||
@@ -675,12 +702,11 @@ WMSetBrowserHasScroller(WMBrowser *bPtr, int hasScroller)
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
WMSetBrowserPath(WMBrowser *bPtr, char *path)
|
||||
{
|
||||
int i;
|
||||
char *str = wstrdup(path);
|
||||
char *str;
|
||||
char *tmp, *retPtr = NULL;
|
||||
int item;
|
||||
WMListItem *listItem;
|
||||
@@ -696,6 +722,7 @@ WMSetBrowserPath(WMBrowser *bPtr, char *path)
|
||||
WMSetListPosition(bPtr->columns[0], 0);
|
||||
|
||||
i = 0;
|
||||
str = wstrdup(path);
|
||||
tmp = strtok(str, bPtr->pathSeparator);
|
||||
while (tmp) {
|
||||
/* select it in the column */
|
||||
@@ -721,6 +748,7 @@ WMSetBrowserPath(WMBrowser *bPtr, char *path)
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
wfree(str);
|
||||
|
||||
for (i = bPtr->usedColumnCount - 1;
|
||||
@@ -752,7 +780,6 @@ WMGetBrowserPath(WMBrowser *bPtr)
|
||||
}
|
||||
|
||||
|
||||
|
||||
char*
|
||||
WMGetBrowserPathToColumn(WMBrowser *bPtr, int column)
|
||||
{
|
||||
@@ -792,6 +819,80 @@ WMGetBrowserPathToColumn(WMBrowser *bPtr, int column)
|
||||
}
|
||||
|
||||
|
||||
WMArray*
|
||||
WMGetBrowserPaths(WMBrowser *bPtr)
|
||||
{
|
||||
int column, i, k, size, selNo;
|
||||
char *path;
|
||||
WMListItem *item, *lastItem;
|
||||
WMArray *paths, *items;
|
||||
|
||||
column = bPtr->usedColumnCount-1;
|
||||
|
||||
if (column < 0) {
|
||||
paths = WMCreateArrayWithDestructor(1, wfree);
|
||||
WMAddToArray(paths, wstrdup(bPtr->pathSeparator));
|
||||
return paths;
|
||||
}
|
||||
|
||||
items = WMGetListSelectedItems(bPtr->columns[column]);
|
||||
selNo = WMGetArrayItemCount(items);
|
||||
paths = WMCreateArrayWithDestructor(selNo, wfree);
|
||||
|
||||
if (selNo <= 1) {
|
||||
WMAddToArray(paths, WMGetBrowserPath(bPtr));
|
||||
return paths;
|
||||
}
|
||||
|
||||
/* calculate size of buffer */
|
||||
size = 0;
|
||||
for (i=0; i<column; i++) {
|
||||
item = WMGetListSelectedItem(bPtr->columns[i]);
|
||||
if (!item)
|
||||
break;
|
||||
size += strlen(item->text);
|
||||
}
|
||||
|
||||
size += (column+1)*strlen(bPtr->pathSeparator)+1;
|
||||
|
||||
for (k=0; k<selNo; k++) {
|
||||
/* get the path */
|
||||
lastItem = WMGetFromArray(items, k);
|
||||
path = wmalloc(size + (lastItem!=NULL ? strlen(lastItem->text) : 0));
|
||||
/* ignore first / */
|
||||
*path = 0;
|
||||
for (i=0; i<=column; i++) {
|
||||
strcat(path, bPtr->pathSeparator);
|
||||
if (i == column) {
|
||||
item = lastItem;
|
||||
} else {
|
||||
item = WMGetListSelectedItem(bPtr->columns[i]);
|
||||
}
|
||||
if (!item)
|
||||
break;
|
||||
strcat(path, item->text);
|
||||
}
|
||||
WMAddToArray(paths, path);
|
||||
}
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMBrowserAllowsMultipleSelection(WMBrowser *bPtr)
|
||||
{
|
||||
return bPtr->flags.allowMultipleSelection;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMBrowserAllowsEmptySelection(WMBrowser *bPtr)
|
||||
{
|
||||
return bPtr->flags.allowEmptySelection;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
loadColumn(WMBrowser *bPtr, int column)
|
||||
{
|
||||
@@ -925,16 +1026,14 @@ listCallback(void *self, void *clientData)
|
||||
WMBrowser *bPtr = (WMBrowser*)clientData;
|
||||
WMList *lPtr = (WMList*)self;
|
||||
WMListItem *item;
|
||||
int i, selNo;
|
||||
static WMListItem *oldItem = NULL;
|
||||
int i;
|
||||
static int oldSelNo = 0;
|
||||
|
||||
item = WMGetListSelectedItem(lPtr);
|
||||
if (!item) {
|
||||
oldItem = item;
|
||||
return;
|
||||
}
|
||||
selNo = WMGetArrayItemCount(WMGetListSelectedItems(lPtr));
|
||||
|
||||
if (oldItem != item) {
|
||||
if (oldItem==NULL || oldItem!=item || oldSelNo!=selNo) {
|
||||
for (i=0; i<bPtr->columnCount; i++) {
|
||||
if (lPtr == bPtr->columns[i])
|
||||
break;
|
||||
@@ -946,7 +1045,7 @@ listCallback(void *self, void *clientData)
|
||||
/* columns at right must be cleared */
|
||||
removeColumn(bPtr, i+1);
|
||||
/* open directory */
|
||||
if (item->isBranch) {
|
||||
if (item && item->isBranch && selNo==1) {
|
||||
WMAddBrowserColumn(bPtr);
|
||||
}
|
||||
if (bPtr->usedColumnCount < bPtr->maxVisibleColumns)
|
||||
@@ -954,17 +1053,17 @@ listCallback(void *self, void *clientData)
|
||||
else
|
||||
i = bPtr->usedColumnCount-bPtr->maxVisibleColumns;
|
||||
scrollToColumn(bPtr, i, True);
|
||||
if (item->isBranch) {
|
||||
if (item && item->isBranch && selNo==1) {
|
||||
loadColumn(bPtr, bPtr->usedColumnCount-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* call callback for click */
|
||||
if (bPtr->action)
|
||||
(*bPtr->action)(bPtr, bPtr->clientData);
|
||||
|
||||
oldItem = item;
|
||||
oldSelNo = selNo;
|
||||
}
|
||||
|
||||
|
||||
@@ -1030,7 +1129,7 @@ static void
|
||||
listSelectionObserver(void *observerData, WMNotification *notification)
|
||||
{
|
||||
WMBrowser *bPtr = (WMBrowser*)observerData;
|
||||
int column, item = (int)WMGetNotificationClientData(notification);
|
||||
int column;
|
||||
WMList *lPtr = (WMList*)WMGetNotificationObject(notification);
|
||||
|
||||
for (column = 0; column < bPtr->usedColumnCount; column++)
|
||||
@@ -1043,7 +1142,7 @@ listSelectionObserver(void *observerData, WMNotification *notification)
|
||||
return;
|
||||
}
|
||||
|
||||
if (item < 0)
|
||||
if (WMGetArrayItemCount(WMGetListSelectedItems(lPtr)) == 0)
|
||||
column--;
|
||||
|
||||
bPtr->selectedColumn = column;
|
||||
@@ -1088,6 +1187,8 @@ WMAddBrowserColumn(WMBrowser *bPtr)
|
||||
bPtr->titles[index] = NULL;
|
||||
|
||||
list = WMCreateList(bPtr);
|
||||
WMSetListAllowMultipleSelection(list, bPtr->flags.allowMultipleSelection);
|
||||
WMSetListAllowEmptySelection(list, bPtr->flags.allowEmptySelection);
|
||||
WMSetListAction(list, listCallback, bPtr);
|
||||
WMSetListDoubleAction(list, listDoubleCallback, bPtr);
|
||||
WMSetListUserDrawProc(list, paintItem);
|
||||
|
||||
@@ -412,11 +412,11 @@ WMSetButtonSelected(WMButton *bPtr, int isSelected)
|
||||
{
|
||||
bPtr->flags.selected = isSelected;
|
||||
|
||||
WMPostNotificationName(WMPushedRadioNotification, bPtr, NULL);
|
||||
|
||||
if (bPtr->view->flags.realized) {
|
||||
paintButton(bPtr);
|
||||
}
|
||||
if (bPtr->groupIndex > 0)
|
||||
WMPostNotificationName(WMPushedRadioNotification, bPtr, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -486,6 +486,8 @@ WMPerformButtonClick(WMButton *bPtr)
|
||||
wusleep(20000);
|
||||
}
|
||||
|
||||
bPtr->flags.pushed = 0;
|
||||
|
||||
if (bPtr->groupIndex > 0) {
|
||||
WMPostNotificationName(WMPushedRadioNotification, bPtr, NULL);
|
||||
}
|
||||
@@ -493,8 +495,6 @@ WMPerformButtonClick(WMButton *bPtr)
|
||||
if (bPtr->action)
|
||||
(*bPtr->action)(bPtr, bPtr->clientData);
|
||||
|
||||
bPtr->flags.pushed = 0;
|
||||
|
||||
if (bPtr->view->flags.mapped)
|
||||
paintButton(bPtr);
|
||||
}
|
||||
@@ -728,17 +728,14 @@ handleActionEvents(XEvent *event, void *data)
|
||||
|
||||
case ButtonPress:
|
||||
if (event->xbutton.button == Button1) {
|
||||
if (bPtr->groupIndex>0) {
|
||||
if (!bPtr->flags.selected)
|
||||
doclick = 1;
|
||||
bPtr->flags.prevSelected = bPtr->flags.selected;
|
||||
bPtr->flags.wasPushed = 0;
|
||||
bPtr->flags.pushed = 1;
|
||||
if (bPtr->groupIndex>0) {
|
||||
bPtr->flags.selected = 1;
|
||||
dopaint = 1;
|
||||
break;
|
||||
}
|
||||
bPtr->flags.wasPushed = 0;
|
||||
bPtr->flags.pushed = 1;
|
||||
bPtr->flags.prevSelected = bPtr->flags.selected;
|
||||
bPtr->flags.selected = !bPtr->flags.selected;
|
||||
dopaint = 1;
|
||||
|
||||
@@ -752,7 +749,8 @@ handleActionEvents(XEvent *event, void *data)
|
||||
case ButtonRelease:
|
||||
if (event->xbutton.button == Button1) {
|
||||
if (bPtr->flags.pushed) {
|
||||
if (bPtr->groupIndex==0)
|
||||
if (bPtr->groupIndex==0 ||
|
||||
(bPtr->flags.selected && bPtr->groupIndex > 0))
|
||||
doclick = 1;
|
||||
dopaint = 1;
|
||||
if (bPtr->flags.springLoaded) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include "wconfig.h"
|
||||
|
||||
#include <wraster.h>
|
||||
|
||||
#define LIGHT_STIPPLE_WIDTH 4
|
||||
@@ -193,7 +195,7 @@ WMWhiteColor(WMScreen *scr)
|
||||
if (!scr->white) {
|
||||
scr->white = WMCreateRGBColor(scr, 0xffff, 0xffff, 0xffff, True);
|
||||
if (!scr->white->flags.exact)
|
||||
wwarning("could not allocate %s color", "white");
|
||||
wwarning(_("could not allocate %s color"), _("white"));
|
||||
}
|
||||
return WMRetainColor(scr->white);
|
||||
}
|
||||
@@ -206,7 +208,7 @@ WMBlackColor(WMScreen *scr)
|
||||
if (!scr->black) {
|
||||
scr->black = WMCreateRGBColor(scr, 0, 0, 0, True);
|
||||
if (!scr->black->flags.exact)
|
||||
wwarning("could not allocate %s color", "black");
|
||||
wwarning(_("could not allocate %s color"), _("black"));
|
||||
}
|
||||
return WMRetainColor(scr->black);
|
||||
}
|
||||
@@ -245,7 +247,7 @@ WMGrayColor(WMScreen *scr)
|
||||
} else {
|
||||
color = WMCreateRGBColor(scr, 0xaeba, 0xaaaa, 0xaeba, True);
|
||||
if (!color->flags.exact)
|
||||
wwarning("could not allocate %s color", "gray");
|
||||
wwarning(_("could not allocate %s color"), _("gray"));
|
||||
}
|
||||
scr->gray = color;
|
||||
}
|
||||
@@ -286,7 +288,7 @@ WMDarkGrayColor(WMScreen *scr)
|
||||
} else {
|
||||
color = WMCreateRGBColor(scr, 0x5144, 0x5555, 0x5144, True);
|
||||
if (!color->flags.exact)
|
||||
wwarning("could not allocate %s color", "dark gray");
|
||||
wwarning(_("could not allocate %s color"), _("dark gray"));
|
||||
}
|
||||
scr->darkGray = color;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
* - Resizing
|
||||
*/
|
||||
|
||||
#include "../src/config.h"
|
||||
#include "wconfig.h"
|
||||
#include "WINGsP.h"
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
@@ -56,13 +56,6 @@
|
||||
|
||||
char *WMColorPanelColorChangedNotification = "WMColorPanelColorChangedNotification";
|
||||
|
||||
/*
|
||||
* Error Messages
|
||||
*/
|
||||
#define NO_MEMORY_ERR "Color Panel: Could not allocate memory"
|
||||
#define NO_FILE_ERR "Color Panel: Could not find file"
|
||||
#define X_ERR "Color Panel: X failed request"
|
||||
|
||||
|
||||
/*
|
||||
* Bitmaps for magnifying glass cursor
|
||||
@@ -284,6 +277,12 @@ enum {
|
||||
|
||||
#define MAX_LENGTH 1024
|
||||
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
|
||||
static int fetchFile(char* toPath, char *imageSrcFile,
|
||||
char *imageDestFileName);
|
||||
char *generateNewFilename(char *curName);
|
||||
@@ -413,7 +412,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
panel->win = WMCreateWindowWithStyle(scrPtr, name,
|
||||
WMTitledWindowMask | WMClosableWindowMask | WMResizableWindowMask);
|
||||
WMResizeWidget(panel->win, PWIDTH, PHEIGHT);
|
||||
WMSetWindowTitle(panel->win, "Colors");
|
||||
WMSetWindowTitle(panel->win, _("Colors"));
|
||||
WMSetWindowCloseAction(panel->win, closeWindowCallback, panel);
|
||||
|
||||
|
||||
@@ -421,7 +420,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
panel->mode = WMWheelModeColorPanel;
|
||||
panel->lastChanged = 0;
|
||||
panel->slidersmode = WMRGBModeColorPanel;
|
||||
panel->configurationPath = wstrappend(wusergnusteppath(),
|
||||
panel->configurationPath = wstrconcat(wusergnusteppath(),
|
||||
"/Library/Colors/");
|
||||
|
||||
/* Some General Purpose Widgets */
|
||||
@@ -598,14 +597,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->grayBrightnessS), pixmap->pixmap,
|
||||
panel->font12, 2, 0, 100, WALeft, WMColorGC(scrPtr->white),
|
||||
False, "Brightness", strlen("Brightness"));
|
||||
False, _("Brightness"), strlen(_("Brightness")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->grayBrightnessS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -674,14 +673,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->rgbRedS), pixmap->pixmap, panel->font12,
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Red",
|
||||
strlen("Red"));
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, _("Red"),
|
||||
strlen(_("Red")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->rgbRedS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -707,14 +706,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->rgbGreenS), pixmap->pixmap, panel->font12,
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Green",
|
||||
strlen("Green"));
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, _("Green"),
|
||||
strlen(_("Green")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->rgbGreenS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -741,14 +740,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->rgbBlueS), pixmap->pixmap, panel->font12,
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, "Blue",
|
||||
strlen("Blue"));
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->white), False, _("Blue"),
|
||||
strlen(_("Blue")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->rgbBlueS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -801,14 +800,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykCyanS), pixmap->pixmap, panel->font12,
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Cyan",
|
||||
strlen("Cyan"));
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Cyan"),
|
||||
strlen(_("Cyan")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->cmykCyanS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -835,14 +834,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykMagentaS), pixmap->pixmap, panel->font12,
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Magenta",
|
||||
strlen("Magenta"));
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Magenta"),
|
||||
strlen(_("Magenta")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->cmykMagentaS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -869,14 +868,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykYellowS), pixmap->pixmap, panel->font12,
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Yellow",
|
||||
strlen("Yellow"));
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Yellow"),
|
||||
strlen(_("Yellow")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->cmykYellowS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -904,14 +903,14 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
image = RRenderGradient(141, 16, &from, &to, RGRD_HORIZONTAL);
|
||||
pixmap = WMCreatePixmapFromRImage(scrPtr, image, 0);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
if (pixmap)
|
||||
W_PaintText(W_VIEW(panel->cmykBlackS), pixmap->pixmap, panel->font12,
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, "Black",
|
||||
strlen("Black"));
|
||||
2, 0, 100, WALeft, WMColorGC(scrPtr->black), False, _("Black"),
|
||||
strlen(_("Black")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->cmykBlackS, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
@@ -989,7 +988,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
panel->customPaletteHistoryBtn = WMCreatePopUpButton(
|
||||
panel->customPaletteFrm);
|
||||
WMAddPopUpButtonItem(panel->customPaletteHistoryBtn, "Spectrum");
|
||||
WMAddPopUpButtonItem(panel->customPaletteHistoryBtn, _("Spectrum"));
|
||||
WMSetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn,
|
||||
WMGetPopUpButtonNumberOfItems(panel->customPaletteHistoryBtn)-1);
|
||||
WMSetPopUpButtonAction(panel->customPaletteHistoryBtn,
|
||||
@@ -1019,17 +1018,17 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
panel->customPaletteMenuBtn = WMCreatePopUpButton(panel->customPaletteFrm);
|
||||
WMSetPopUpButtonPullsDown(panel->customPaletteMenuBtn, 1);
|
||||
WMSetPopUpButtonText(panel->customPaletteMenuBtn, "Palette");
|
||||
WMSetPopUpButtonText(panel->customPaletteMenuBtn, _("Palette"));
|
||||
WMSetPopUpButtonAction(panel->customPaletteMenuBtn,
|
||||
customPaletteMenuCallback, panel);
|
||||
WMResizeWidget(panel->customPaletteMenuBtn, PWIDTH - 8, 20);
|
||||
WMMoveWidget(panel->customPaletteMenuBtn, 0, PHEIGHT - 130);
|
||||
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "New from File...");
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Rename...");
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Remove");
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "Copy");
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, "New from Clipboard");
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("New from File..."));
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("Rename..."));
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("Remove"));
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("Copy"));
|
||||
WMAddPopUpButtonItem(panel->customPaletteMenuBtn, _("New from Clipboard"));
|
||||
|
||||
WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRename, 0);
|
||||
WMSetPopUpButtonItemEnabled(panel->customPaletteMenuBtn, CPmenuRemove, 0);
|
||||
@@ -1050,7 +1049,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
WMMoveWidget(panel->colorListFrm, 5, 80);
|
||||
|
||||
panel->colorListHistoryBtn = WMCreatePopUpButton(panel->colorListFrm);
|
||||
WMAddPopUpButtonItem(panel->colorListHistoryBtn, "X11-Colors");
|
||||
WMAddPopUpButtonItem(panel->colorListHistoryBtn, _("X11-Colors"));
|
||||
WMSetPopUpButtonSelectedItem(panel->colorListHistoryBtn,
|
||||
WMGetPopUpButtonNumberOfItems(panel->colorListHistoryBtn)-1);
|
||||
/* WMSetPopUpButtonAction(panel->colorListHistoryBtn,
|
||||
@@ -1067,15 +1066,15 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
panel->colorListColorMenuBtn = WMCreatePopUpButton(panel->colorListFrm);
|
||||
WMSetPopUpButtonPullsDown(panel->colorListColorMenuBtn, 1);
|
||||
WMSetPopUpButtonText(panel->colorListColorMenuBtn, "Color");
|
||||
WMSetPopUpButtonText(panel->colorListColorMenuBtn, _("Color"));
|
||||
WMSetPopUpButtonAction(panel->colorListColorMenuBtn,
|
||||
colorListColorMenuCallback, panel);
|
||||
WMResizeWidget(panel->colorListColorMenuBtn, (PWIDTH - 16)/2, 20);
|
||||
WMMoveWidget(panel->colorListColorMenuBtn, 0, PHEIGHT - 130);
|
||||
|
||||
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Add...");
|
||||
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Rename...");
|
||||
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, "Remove");
|
||||
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Add..."));
|
||||
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Rename..."));
|
||||
WMAddPopUpButtonItem(panel->colorListColorMenuBtn, _("Remove"));
|
||||
|
||||
WMSetPopUpButtonItemEnabled(panel->colorListColorMenuBtn, CLmenuAdd, 0);
|
||||
WMSetPopUpButtonItemEnabled(panel->colorListColorMenuBtn, CLmenuRename, 0);
|
||||
@@ -1083,16 +1082,16 @@ makeColorPanel(WMScreen *scrPtr, char *name)
|
||||
|
||||
panel->colorListListMenuBtn = WMCreatePopUpButton(panel->colorListFrm);
|
||||
WMSetPopUpButtonPullsDown(panel->colorListListMenuBtn, 1);
|
||||
WMSetPopUpButtonText(panel->colorListListMenuBtn, "List");
|
||||
WMSetPopUpButtonText(panel->colorListListMenuBtn, _("List"));
|
||||
WMSetPopUpButtonAction(panel->colorListListMenuBtn,
|
||||
colorListListMenuCallback, panel);
|
||||
WMResizeWidget(panel->colorListListMenuBtn, (PWIDTH - 16)/2, 20);
|
||||
WMMoveWidget(panel->colorListListMenuBtn, (PWIDTH - 16)/2 + 8,
|
||||
PHEIGHT - 130);
|
||||
|
||||
WMAddPopUpButtonItem(panel->colorListListMenuBtn, "New...");
|
||||
WMAddPopUpButtonItem(panel->colorListListMenuBtn, "Rename...");
|
||||
WMAddPopUpButtonItem(panel->colorListListMenuBtn, "Remove");
|
||||
WMAddPopUpButtonItem(panel->colorListListMenuBtn, _("New..."));
|
||||
WMAddPopUpButtonItem(panel->colorListListMenuBtn, _("Rename..."));
|
||||
WMAddPopUpButtonItem(panel->colorListListMenuBtn, _("Remove"));
|
||||
|
||||
WMSetPopUpButtonItemEnabled(panel->colorListListMenuBtn, CLmenuAdd, 0);
|
||||
WMSetPopUpButtonItemEnabled(panel->colorListListMenuBtn, CLmenuRename, 0);
|
||||
@@ -1169,7 +1168,7 @@ WMFreeColorPanel(WMColorPanel *panel)
|
||||
XFreePixmap(scr->display, panel->selectionImg);
|
||||
if (panel->selectionBackImg)
|
||||
XFreePixmap(scr->display, panel->selectionBackImg);
|
||||
RDestroyImage(panel->customPaletteImg);
|
||||
RReleaseImage(panel->customPaletteImg);
|
||||
|
||||
/* structs */
|
||||
if (panel->lastBrowseDir)
|
||||
@@ -1229,27 +1228,27 @@ readConfiguration(W_ColorPanel *panel)
|
||||
if (stat(panel->configurationPath, &stat_buf)!=0) {
|
||||
if (mkdir(panel->configurationPath,
|
||||
S_IRWXU|S_IRGRP|S_IROTH|S_IXGRP|S_IXOTH)!=0) {
|
||||
wsyserror("Color Panel: Could not create directory %s needed"
|
||||
" to store configurations", panel->configurationPath);
|
||||
wsyserror(_("Color Panel: Could not create directory %s needed"
|
||||
" to store configurations"), panel->configurationPath);
|
||||
WMSetPopUpButtonEnabled(panel->customPaletteMenuBtn, False);
|
||||
WMSetPopUpButtonEnabled(panel->colorListColorMenuBtn, False);
|
||||
WMSetPopUpButtonEnabled(panel->colorListListMenuBtn, False);
|
||||
WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,
|
||||
"File Error",
|
||||
"Could not create ColorPanel configuration directory",
|
||||
"OK", NULL, NULL);
|
||||
_("File Error"),
|
||||
_("Could not create ColorPanel configuration directory"),
|
||||
_("OK"), NULL, NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(dPtr = opendir(panel->configurationPath))) {
|
||||
wwarning(NO_FILE_ERR, "%s", panel->configurationPath);
|
||||
wwarning(_("Color Panel: Could not find file"), "%s", panel->configurationPath);
|
||||
return;
|
||||
}
|
||||
|
||||
while ((dp = readdir(dPtr)) != NULL) {
|
||||
unsigned int perm_mask;
|
||||
char *path = wstrappend(panel->configurationPath,
|
||||
char *path = wstrconcat(panel->configurationPath,
|
||||
dp->d_name);
|
||||
|
||||
if (dp->d_name[0] != '.') {
|
||||
@@ -1261,7 +1260,7 @@ readConfiguration(W_ColorPanel *panel)
|
||||
WMSetPopUpButtonItemEnabled(panel->customPaletteHistoryBtn,
|
||||
item, perm_mask);
|
||||
}
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
(void)closedir(dPtr);
|
||||
}
|
||||
@@ -1279,7 +1278,7 @@ readXColors(W_ColorPanel *panel)
|
||||
WMListItem *item;
|
||||
|
||||
if (stat(RGBTXT, &stat_buf) != 0) {
|
||||
wsyserror(NO_FILE_ERR, " %s", RGBTXT);
|
||||
wsyserror(_("Color Panel: Could not find file"), " %s", RGBTXT);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -1297,7 +1296,7 @@ readXColors(W_ColorPanel *panel)
|
||||
fclose(rgbtxt);
|
||||
}
|
||||
else {
|
||||
wsyserror(NO_FILE_ERR, "%s", RGBTXT);
|
||||
wsyserror(_("Color Panel: Could not find file"), "%s", RGBTXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1484,7 +1483,7 @@ magnifyGetImage(WMScreen *scr, XImage *image, int x, int y, int w, int h)
|
||||
x - Cursor_x_hot,
|
||||
y - Cursor_y_hot,
|
||||
w, h, AllPlanes, ZPixmap)))
|
||||
wwarning(X_ERR);
|
||||
wwarning(_("Color Panel: X failed request"));
|
||||
|
||||
return image;
|
||||
}
|
||||
@@ -1549,7 +1548,7 @@ magnifyGetImage(WMScreen *scr, XImage *image, int x, int y, int w, int h)
|
||||
y - Cursor_y_hot + y0,
|
||||
w0, h0, AllPlanes, ZPixmap,
|
||||
image, x0, y0))
|
||||
wwarning(X_ERR);
|
||||
wwarning(_("Color Panel: X failed request"));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -1613,7 +1612,7 @@ magnifyGetImageStored(WMColorPanel *panel, int x1, int y1, int x2, int y2)
|
||||
panel->magnifyGlass->dirtyRect =
|
||||
XSubImage(panel->magnifyGlass->image, xa, ya, width, height);
|
||||
if (!panel->magnifyGlass->dirtyRect) {
|
||||
wwarning(X_ERR);
|
||||
wwarning(_("Color Panel: X failed request"));
|
||||
return; /* X returned a NULL from XSubImage */
|
||||
}
|
||||
}
|
||||
@@ -2158,11 +2157,11 @@ wheelRender(W_ColorPanel *panel)
|
||||
unsigned char *ptr;
|
||||
RColor gray;
|
||||
unsigned long ofs = 0;
|
||||
unsigned char shift = getShift(sizeof(unsigned char));
|
||||
/*unsigned char shift = getShift(sizeof(unsigned char));*/
|
||||
|
||||
image = RCreateImage(colorWheelSize+4, colorWheelSize+4, True);
|
||||
if (!image) {
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2196,7 +2195,7 @@ wheelRender(W_ColorPanel *panel)
|
||||
XFreePixmap(scr->display, panel->wheelImg);
|
||||
|
||||
RConvertImage(scr->rcontext, image, &panel->wheelImg);
|
||||
RDestroyImage(image);
|
||||
RReleaseImage(image);
|
||||
|
||||
/* Check if backimage exists. If it doesn't, allocate and fill it */
|
||||
if (!panel->selectionBackImg) {
|
||||
@@ -2471,7 +2470,7 @@ wheelUpdateBrightnessGradient(W_ColorPanel *panel, CPColor topColor)
|
||||
sliderImg = RRenderGradient(16, 153, &(topColor.rgb), &to, RGRD_VERTICAL);
|
||||
sliderPxmp = WMCreatePixmapFromRImage(WMWidgetScreen(panel->win),
|
||||
sliderImg, 0);
|
||||
RDestroyImage(sliderImg);
|
||||
RReleaseImage(sliderImg);
|
||||
WMSetSliderImage(panel->wheelBrightnessS, sliderPxmp);
|
||||
WMReleasePixmap(sliderPxmp);
|
||||
}
|
||||
@@ -2817,14 +2816,14 @@ hsbUpdateBrightnessGradient(W_ColorPanel *panel)
|
||||
|
||||
sliderImg = RRenderGradient(141, 16, &from, &(to.rgb), RGRD_HORIZONTAL);
|
||||
sliderPxmp = WMCreatePixmapFromRImage(scr, sliderImg, 0);
|
||||
RDestroyImage(sliderImg);
|
||||
RReleaseImage(sliderImg);
|
||||
|
||||
if (sliderPxmp)
|
||||
W_PaintText(W_VIEW(panel->hsbBrightnessS), sliderPxmp->pixmap,
|
||||
panel->font12, 2, 0, 100, WALeft, WMColorGC(scr->white),
|
||||
False, "Brightness", strlen("Brightness"));
|
||||
False, _("Brightness"), strlen(_("Brightness")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->hsbBrightnessS, sliderPxmp);
|
||||
WMReleasePixmap(sliderPxmp);
|
||||
@@ -2852,15 +2851,15 @@ hsbUpdateSaturationGradient(W_ColorPanel *panel)
|
||||
sliderImg = RRenderGradient(141, 16, &(from.rgb), &(to.rgb),
|
||||
RGRD_HORIZONTAL);
|
||||
sliderPxmp = WMCreatePixmapFromRImage(scr, sliderImg, 0);
|
||||
RDestroyImage(sliderImg);
|
||||
RReleaseImage(sliderImg);
|
||||
|
||||
if (sliderPxmp)
|
||||
W_PaintText(W_VIEW(panel->hsbSaturationS), sliderPxmp->pixmap,
|
||||
panel->font12, 2, 0, 100, WALeft,
|
||||
WMColorGC(from.hsv.value < 128 ? scr->white : scr->black), False,
|
||||
"Saturation", strlen("Saturation"));
|
||||
_("Saturation"), strlen(_("Saturation")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->hsbSaturationS, sliderPxmp);
|
||||
WMReleasePixmap(sliderPxmp);
|
||||
@@ -2888,15 +2887,15 @@ hsbUpdateHueGradient(W_ColorPanel *panel)
|
||||
|
||||
sliderImg = RRenderMultiGradient(141, 16, colors, RGRD_HORIZONTAL);
|
||||
sliderPxmp = WMCreatePixmapFromRImage(scr, sliderImg, 0);
|
||||
RDestroyImage(sliderImg);
|
||||
RReleaseImage(sliderImg);
|
||||
|
||||
if (sliderPxmp)
|
||||
W_PaintText(W_VIEW(panel->hsbHueS), sliderPxmp->pixmap,
|
||||
panel->font12, 2, 0, 100, WALeft,
|
||||
WMColorGC(hsvcolor.value < 128 ? scr->white : scr->black), False,
|
||||
"Hue", strlen("Hue"));
|
||||
_("Hue"), strlen(_("Hue")));
|
||||
else
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
|
||||
WMSetSliderImage(panel->hsbHueS, sliderPxmp);
|
||||
WMReleasePixmap(sliderPxmp);
|
||||
@@ -2942,7 +2941,7 @@ customRenderSpectrum(W_ColorPanel *panel)
|
||||
}
|
||||
}
|
||||
if (panel->customPaletteImg) {
|
||||
RDestroyImage(panel->customPaletteImg);
|
||||
RReleaseImage(panel->customPaletteImg);
|
||||
panel->customPaletteImg = NULL;
|
||||
}
|
||||
panel->customPaletteImg = spectrum;
|
||||
@@ -2963,7 +2962,7 @@ customSetPalette(W_ColorPanel *panel)
|
||||
scaledImg = RScaleImage(panel->customPaletteImg, customPaletteWidth,
|
||||
customPaletteHeight);
|
||||
RConvertImage(scr->rcontext, scaledImg, &image);
|
||||
RDestroyImage(scaledImg);
|
||||
RReleaseImage(scaledImg);
|
||||
|
||||
XCopyArea(scr->display, image, panel->customPaletteContentView->window,
|
||||
scr->copyGC, 0, 0, customPaletteWidth, customPaletteHeight, 0, 0);
|
||||
@@ -3144,7 +3143,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
|
||||
|
||||
/* Get a filename */
|
||||
if (WMRunModalFilePanelForDirectory(browseP, panel->win, spath,
|
||||
"Open Palette", RSupportedFileFormats()) ) {
|
||||
_("Open Palette"), RSupportedFileFormats()) ) {
|
||||
filepath = WMGetFilePanelFileName(browseP);
|
||||
|
||||
/* Get seperation position between path and filename */
|
||||
@@ -3163,7 +3162,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
|
||||
filename = wstrdup(filepath + i);
|
||||
|
||||
/* Check for duplicate files, and rename it if there are any */
|
||||
tmp = wstrappend(panel->configurationPath, filename);
|
||||
tmp = wstrconcat(panel->configurationPath, filename);
|
||||
while (access (tmp, F_OK) == 0) {
|
||||
char *newName;
|
||||
|
||||
@@ -3173,7 +3172,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
|
||||
wfree(filename);
|
||||
filename = newName;
|
||||
|
||||
tmp = wstrappend(panel->configurationPath, filename);
|
||||
tmp = wstrconcat(panel->configurationPath, filename);
|
||||
}
|
||||
wfree(tmp);
|
||||
|
||||
@@ -3183,13 +3182,13 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
|
||||
|
||||
/* filepath is a "local" path now the file has been copied */
|
||||
wfree(filepath);
|
||||
filepath = wstrappend(panel->configurationPath, filename);
|
||||
filepath = wstrconcat(panel->configurationPath, filename);
|
||||
|
||||
/* load the image & add menu entries */
|
||||
tmpImg = RLoadImage(scr->rcontext, filepath, 0);
|
||||
if (tmpImg) {
|
||||
if (panel->customPaletteImg)
|
||||
RDestroyImage(panel->customPaletteImg);
|
||||
RReleaseImage(panel->customPaletteImg);
|
||||
panel->customPaletteImg = tmpImg;
|
||||
|
||||
customSetPalette(panel);
|
||||
@@ -3202,16 +3201,16 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
|
||||
panel->currentPalette);
|
||||
}
|
||||
} else {
|
||||
tmp = wstrappend(panel->configurationPath, filename);
|
||||
tmp = wstrconcat(panel->configurationPath, filename);
|
||||
|
||||
i = remove(tmp); /* Delete the file, it doesn't belong here */
|
||||
WMRunAlertPanel(scr, panel->win, "File Error",
|
||||
"Invalid file format !", "OK", NULL, NULL);
|
||||
WMRunAlertPanel(scr, panel->win, _("File Error"),
|
||||
_("Invalid file format !"), _("OK"), NULL, NULL);
|
||||
if (i != 0) {
|
||||
wsyserror("can't remove file %s", tmp);
|
||||
WMRunAlertPanel(scr, panel->win, "File Error",
|
||||
"Couldn't remove file from Configuration Directory !",
|
||||
"OK", NULL, NULL);
|
||||
wsyserror(_("can't remove file %s"), tmp);
|
||||
WMRunAlertPanel(scr, panel->win, _("File Error"),
|
||||
_("Couldn't remove file from Configuration Directory !"),
|
||||
_("OK"), NULL, NULL);
|
||||
}
|
||||
wfree(tmp);
|
||||
}
|
||||
@@ -3237,8 +3236,8 @@ customPaletteMenuRename(W_ColorPanel *panel)
|
||||
item = WMGetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn);
|
||||
fromName = WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item);
|
||||
|
||||
toName = WMRunInputPanel(scr, panel->win, "Rename", "Rename palette to:",
|
||||
fromName, "OK", "Cancel");
|
||||
toName = WMRunInputPanel(scr, panel->win, _("Rename"), _("Rename palette to:"),
|
||||
fromName, _("OK"), _("Cancel"));
|
||||
|
||||
if (toName) {
|
||||
|
||||
@@ -3249,13 +3248,13 @@ customPaletteMenuRename(W_ColorPanel *panel)
|
||||
}
|
||||
|
||||
/* For normal people */
|
||||
fromPath = wstrappend(panel->configurationPath, fromName);
|
||||
toPath = wstrappend(panel->configurationPath, toName);
|
||||
fromPath = wstrconcat(panel->configurationPath, fromName);
|
||||
toPath = wstrconcat(panel->configurationPath, toName);
|
||||
|
||||
if (access (toPath, F_OK) == 0) {
|
||||
/* Careful, this palette exists already */
|
||||
if (WMRunAlertPanel(scr, panel->win, "Warning",
|
||||
"Palette already exists !\n\nOverwrite ?", "No", "Yes",
|
||||
if (WMRunAlertPanel(scr, panel->win, _("Warning"),
|
||||
_("Palette already exists !\n\nOverwrite ?"), _("No"), _("Yes"),
|
||||
NULL) == 1) {
|
||||
/* "No" = 0, "Yes" = 1 */
|
||||
int items = WMGetPopUpButtonNumberOfItems(
|
||||
@@ -3287,7 +3286,7 @@ customPaletteMenuRename(W_ColorPanel *panel)
|
||||
}
|
||||
|
||||
if ( rename(fromPath, toPath) != 0)
|
||||
wsyserror("Couldn't rename palette %s to %s\n", fromName, toName);
|
||||
wsyserror(_("Couldn't rename palette %s to %s\n"), fromName, toName);
|
||||
else {
|
||||
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
|
||||
WMInsertPopUpButtonItem(panel->customPaletteHistoryBtn, item,
|
||||
@@ -3313,20 +3312,20 @@ customPaletteMenuRemove(W_ColorPanel *panel)
|
||||
|
||||
item = WMGetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn);
|
||||
|
||||
tmp = wstrappend( "This will permanently remove the palette ",
|
||||
tmp = wstrconcat( _("This will permanently remove the palette "),
|
||||
WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item ));
|
||||
text = wstrappend( tmp,
|
||||
".\n\nAre you sure you want to remove this palette ?");
|
||||
text = wstrconcat( tmp,
|
||||
_(".\n\nAre you sure you want to remove this palette ?"));
|
||||
wfree(tmp);
|
||||
|
||||
choice = WMRunAlertPanel(scr, panel->win, "Remove", text, "Yes", "No",
|
||||
choice = WMRunAlertPanel(scr, panel->win, _("Remove"), text, _("Yes"), _("No"),
|
||||
NULL);
|
||||
/* returns 0 (= "Yes") or 1 (="No") */
|
||||
wfree(text);
|
||||
|
||||
if (choice == 0) {
|
||||
|
||||
tmp = wstrappend(panel->configurationPath,
|
||||
tmp = wstrconcat(panel->configurationPath,
|
||||
WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item ));
|
||||
|
||||
if ( remove(tmp) == 0) {
|
||||
@@ -3340,8 +3339,9 @@ customPaletteMenuRemove(W_ColorPanel *panel)
|
||||
|
||||
WMRemovePopUpButtonItem(panel->customPaletteHistoryBtn, item);
|
||||
|
||||
} else
|
||||
wsyserror("Couldn't remove palette %s\n", tmp);
|
||||
} else {
|
||||
wsyserror(_("Couldn't remove palette %s\n"), tmp);
|
||||
}
|
||||
|
||||
wfree(tmp);
|
||||
}
|
||||
@@ -3371,7 +3371,7 @@ customPaletteHistoryCallback(WMWidget *w, void *data)
|
||||
False );
|
||||
} else {
|
||||
/* Load file from configpath */
|
||||
filename = wstrappend( panel->configurationPath,
|
||||
filename = wstrconcat( panel->configurationPath,
|
||||
WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item) );
|
||||
|
||||
/* If the file corresponding to the item does not exist,
|
||||
@@ -3392,7 +3392,7 @@ customPaletteHistoryCallback(WMWidget *w, void *data)
|
||||
tmp = RLoadImage(scr->rcontext, filename, 0);
|
||||
if (tmp) {
|
||||
if (panel->customPaletteImg) {
|
||||
RDestroyImage(panel->customPaletteImg);
|
||||
RReleaseImage(panel->customPaletteImg);
|
||||
panel->customPaletteImg = NULL;
|
||||
}
|
||||
panel->customPaletteImg = tmp;
|
||||
@@ -3645,14 +3645,14 @@ fetchFile(char *toPath, char *srcFile, char *destFile)
|
||||
char buf[BUFSIZE];
|
||||
|
||||
if ((src = open(srcFile, O_RDONLY)) == 0) {
|
||||
wsyserror("Could not open %s", srcFile);
|
||||
wsyserror(_("Could not open %s"), srcFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tmp = wstrappend(toPath, destFile);
|
||||
tmp = wstrconcat(toPath, destFile);
|
||||
if ((dest = open( tmp, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))
|
||||
== 0) {
|
||||
wsyserror("Could not create %s", tmp);
|
||||
wsyserror(_("Could not create %s"), tmp);
|
||||
wfree(tmp);
|
||||
return -1;
|
||||
}
|
||||
@@ -3663,7 +3663,7 @@ fetchFile(char *toPath, char *srcFile, char *destFile)
|
||||
while ((n = read(src, buf, BUFSIZE)) > 0)
|
||||
{
|
||||
if (write (dest, buf, n) != n) {
|
||||
wsyserror("Write error on file %s", destFile);
|
||||
wsyserror(_("Write error on file %s"), destFile);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -3686,11 +3686,8 @@ generateNewFilename(char *curName)
|
||||
|
||||
ptr = curName;
|
||||
|
||||
if (
|
||||
((ptr = strrchr(ptr, '{')) == 0) ||
|
||||
sscanf(ptr, "{%i}%c", &n, &c) != 1
|
||||
)
|
||||
return wstrappend(curName, " {1}");
|
||||
if (((ptr = strrchr(ptr, '{'))==0) || sscanf(ptr, "{%i}%c", &n, &c)!=1)
|
||||
return wstrconcat(curName, " {1}");
|
||||
|
||||
baseLen = ptr - curName -1;
|
||||
|
||||
@@ -3711,7 +3708,7 @@ convertCPColor(CPColor *color)
|
||||
|
||||
switch (color->set) {
|
||||
case cpNone:
|
||||
wwarning("Color Panel: Color unspecified");
|
||||
wwarning(_("Color Panel: Color unspecified"));
|
||||
return;
|
||||
case cpRGB:
|
||||
old_hue = color->hsv.hue;
|
||||
@@ -3746,7 +3743,7 @@ ulongToRColor(WMScreen *scr, unsigned long value)
|
||||
XColor *xcolor = NULL;
|
||||
|
||||
if (!(xcolor = wmalloc(sizeof(XColor)) )) {
|
||||
wwarning(NO_MEMORY_ERR);
|
||||
wwarning(_("Color Panel: Could not allocate memory"));
|
||||
color.red = 0;
|
||||
color.green = 0;
|
||||
color.blue = 0;
|
||||
@@ -3760,7 +3757,7 @@ ulongToRColor(WMScreen *scr, unsigned long value)
|
||||
color.green = xcolor->green >> 8;
|
||||
color.blue = xcolor->blue >> 8;
|
||||
|
||||
free(xcolor);
|
||||
wfree(xcolor);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,35 @@ W_ViewDelegate _ColorWellViewDelegate = {
|
||||
};
|
||||
|
||||
|
||||
#if 0
|
||||
static WMDragSourceProcs dragProcs = {
|
||||
static unsigned draggingSourceOperation(WMView *self, Bool local);
|
||||
|
||||
static WMData* fetchDragData(WMView *self, char *type);
|
||||
|
||||
static WMDragSourceProcs _DragSourceProcs = {
|
||||
draggingSourceOperation,
|
||||
NULL,
|
||||
NULL,
|
||||
fetchDragData
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
static unsigned draggingEntered(WMView *self, WMDraggingInfo *info);
|
||||
static unsigned draggingUpdated(WMView *self, WMDraggingInfo *info);
|
||||
static void draggingExited(WMView *self, WMDraggingInfo *info);
|
||||
static char *prepareForDragOperation(WMView *self, WMDraggingInfo *info);
|
||||
static Bool performDragOperation(WMView *self, WMDraggingInfo *info,
|
||||
WMData *data);
|
||||
static void concludeDragOperation(WMView *self, WMDraggingInfo *info);
|
||||
|
||||
static WMDragDestinationProcs _DragDestinationProcs = {
|
||||
draggingEntered,
|
||||
draggingUpdated,
|
||||
draggingExited,
|
||||
prepareForDragOperation,
|
||||
performDragOperation,
|
||||
concludeDragOperation
|
||||
};
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 60
|
||||
#define DEFAULT_HEIGHT 30
|
||||
@@ -169,6 +193,15 @@ WMCreateColorWell(WMWidget *parent)
|
||||
WMAddNotificationObserver(colorChangedObserver, cPtr,
|
||||
WMColorPanelColorChangedNotification, NULL);
|
||||
|
||||
WMSetViewDragSourceProcs(cPtr->view, &_DragSourceProcs);
|
||||
WMSetViewDragDestinationProcs(cPtr->view, &_DragDestinationProcs);
|
||||
|
||||
{
|
||||
char *types[2] = {"application/X-color", NULL};
|
||||
|
||||
WMRegisterViewForDraggedTypes(cPtr->view, types);
|
||||
}
|
||||
|
||||
return cPtr;
|
||||
}
|
||||
|
||||
@@ -203,8 +236,6 @@ WSetColorWellBordered(WMColorWell *cPtr, Bool flag)
|
||||
}
|
||||
|
||||
|
||||
#define MIN(a,b) ((a) > (b) ? (b) : (a))
|
||||
|
||||
static void
|
||||
willResizeColorWell(W_ViewDelegate *self, WMView *view,
|
||||
unsigned int *width, unsigned int *height)
|
||||
@@ -219,7 +250,7 @@ willResizeColorWell(W_ViewDelegate *self, WMView *view,
|
||||
if (*height < MIN_HEIGHT)
|
||||
*height = MIN_HEIGHT;
|
||||
|
||||
bw = (int)((float)MIN(*width, *height)*0.24);
|
||||
bw = (int)((float)WMIN(*width, *height)*0.24);
|
||||
|
||||
W_ResizeView(cPtr->colorView, *width-2*bw, *height-2*bw);
|
||||
|
||||
@@ -276,6 +307,27 @@ handleEvents(XEvent *event, void *data)
|
||||
}
|
||||
|
||||
|
||||
static unsigned
|
||||
draggingSourceOperation(WMView *self, Bool local)
|
||||
{
|
||||
return WDOperationCopy;
|
||||
}
|
||||
|
||||
|
||||
static WMData*
|
||||
fetchDragData(WMView *self, char *type)
|
||||
{
|
||||
char *color = WMGetColorRGBDescription(((WMColorWell*)self->self)->color);
|
||||
WMData *data;
|
||||
|
||||
data = WMCreateDataWithBytes(color, strlen(color)+1);
|
||||
|
||||
wfree(color);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
static WMPixmap*
|
||||
makeDragPixmap(WMColorWell *cPtr)
|
||||
{
|
||||
@@ -292,221 +344,6 @@ makeDragPixmap(WMColorWell *cPtr)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
slideView(WMView *view, int srcX, int srcY, int dstX, int dstY)
|
||||
{
|
||||
double x, y, dx, dy;
|
||||
int i;
|
||||
|
||||
srcX -= 8;
|
||||
srcY -= 8;
|
||||
dstX -= 8;
|
||||
dstY -= 8;
|
||||
|
||||
x = srcX;
|
||||
y = srcY;
|
||||
|
||||
dx = (double)(dstX-srcX)/20.0;
|
||||
dy = (double)(dstY-srcY)/20.0;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
W_MoveView(view, x, y);
|
||||
XFlush(view->screen->display);
|
||||
|
||||
x += dx;
|
||||
y += dy;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Window
|
||||
findChildInWindow(Display *dpy, Window toplevel, int x, int y)
|
||||
{
|
||||
Window foo, bar;
|
||||
Window *children;
|
||||
unsigned nchildren;
|
||||
int i;
|
||||
|
||||
if (!XQueryTree(dpy, toplevel, &foo, &bar,
|
||||
&children, &nchildren) || children == NULL) {
|
||||
return None;
|
||||
}
|
||||
|
||||
/* first window that contains the point is the one */
|
||||
for (i = nchildren-1; i >= 0; i--) {
|
||||
XWindowAttributes attr;
|
||||
|
||||
if (XGetWindowAttributes(dpy, children[i], &attr)
|
||||
&& attr.map_state == IsViewable
|
||||
&& x >= attr.x && y >= attr.y
|
||||
&& x < attr.x + attr.width && y < attr.y + attr.height) {
|
||||
Window child;
|
||||
|
||||
child = findChildInWindow(dpy, children[i],
|
||||
x - attr.x, y - attr.y);
|
||||
|
||||
XFree(children);
|
||||
|
||||
if (!child)
|
||||
return toplevel;
|
||||
else
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(children);
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
static Window
|
||||
findWindowUnderDragPointer(WMScreen *scr, int x, int y, Window iconWindow)
|
||||
{
|
||||
Window foo, bar;
|
||||
Window *children;
|
||||
unsigned nchildren;
|
||||
int i;
|
||||
|
||||
if (!XQueryTree(scr->display, scr->rootWin, &foo, &bar,
|
||||
&children, &nchildren) || children == NULL) {
|
||||
return None;
|
||||
}
|
||||
|
||||
/* try to find the window below the iconWindow by traversing
|
||||
* the whole window list */
|
||||
|
||||
/* first find the position of the iconWindow */
|
||||
for (i = nchildren-1; i >= 0; i--) {
|
||||
if (children[i] == iconWindow) {
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i <= 0) {
|
||||
XFree(children);
|
||||
return scr->rootWin;
|
||||
}
|
||||
|
||||
/* first window that contains the point is the one */
|
||||
for (; i >= 0; i--) {
|
||||
XWindowAttributes attr;
|
||||
Window child;
|
||||
|
||||
if (XGetWindowAttributes(scr->display, children[i], &attr)
|
||||
&& attr.map_state == IsViewable
|
||||
&& x >= attr.x && y >= attr.y
|
||||
&& x < attr.x + attr.width && y < attr.y + attr.height
|
||||
&& (child = findChildInWindow(scr->display, children[i],
|
||||
x - attr.x, y - attr.y))) {
|
||||
XFree(children);
|
||||
return child;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(children);
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
dragColor(ColorWell *cPtr, XEvent *event, WMPixmap *image)
|
||||
{
|
||||
WMView *dragView;
|
||||
WMScreen *scr = cPtr->view->screen;
|
||||
Display *dpy = scr->display;
|
||||
XColor black = {0, 0,0,0, DoRed|DoGreen|DoBlue};
|
||||
XColor green = {0x0045b045, 0x4500,0xb000,0x4500, DoRed|DoGreen|DoBlue};
|
||||
XColor back = {0, 0xffff,0xffff,0xffff, DoRed|DoGreen|DoBlue};
|
||||
Bool done = False;
|
||||
WMColorWell *activeWell = NULL;
|
||||
|
||||
dragView = W_CreateTopView(scr);
|
||||
|
||||
W_ResizeView(dragView, 16, 16);
|
||||
dragView->attribFlags |= CWOverrideRedirect | CWSaveUnder;
|
||||
dragView->attribs.event_mask = StructureNotifyMask;
|
||||
dragView->attribs.override_redirect = True;
|
||||
dragView->attribs.save_under = True;
|
||||
|
||||
W_MoveView(dragView, event->xmotion.x_root-8, event->xmotion.y_root-8);
|
||||
|
||||
W_RealizeView(dragView);
|
||||
|
||||
W_MapView(dragView);
|
||||
|
||||
XSetWindowBackgroundPixmap(dpy, dragView->window, WMGetPixmapXID(image));
|
||||
XClearWindow(dpy, dragView->window);
|
||||
|
||||
|
||||
XGrabPointer(dpy, scr->rootWin, True,
|
||||
ButtonMotionMask|ButtonReleaseMask,
|
||||
GrabModeSync, GrabModeAsync,
|
||||
scr->rootWin, scr->defaultCursor, CurrentTime);
|
||||
|
||||
while (!done) {
|
||||
XEvent ev;
|
||||
WMView *view;
|
||||
Window win;
|
||||
|
||||
XAllowEvents(dpy, SyncPointer, CurrentTime);
|
||||
WMNextEvent(dpy, &ev);
|
||||
|
||||
switch (ev.type) {
|
||||
case ButtonRelease:
|
||||
if (activeWell != NULL) {
|
||||
WMSetColorWellColor(activeWell, cPtr->color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification,
|
||||
activeWell, NULL);
|
||||
} else {
|
||||
slideView(dragView, ev.xbutton.x_root, ev.xbutton.y_root,
|
||||
event->xmotion.x_root, event->xmotion.y_root);
|
||||
}
|
||||
|
||||
done = True;
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
while (XCheckTypedEvent(dpy, MotionNotify, &ev)) ;
|
||||
|
||||
W_MoveView(dragView, ev.xmotion.x_root-8, ev.xmotion.y_root-8);
|
||||
|
||||
win = findWindowUnderDragPointer(scr, ev.xmotion.x_root,
|
||||
ev.xmotion.y_root,
|
||||
dragView->window);
|
||||
|
||||
if (win != None && win != scr->rootWin) {
|
||||
view = W_GetViewForXWindow(dpy, win);
|
||||
} else {
|
||||
view = NULL;
|
||||
}
|
||||
|
||||
if (view && view->self && W_CLASS(view->self) == WC_ColorWell
|
||||
&& view->self != activeWell && view->self != cPtr) {
|
||||
|
||||
activeWell = view->self;
|
||||
XRecolorCursor(dpy, scr->defaultCursor, &green, &back);
|
||||
|
||||
} else if (!view || view->self != activeWell) {
|
||||
|
||||
XRecolorCursor(dpy, scr->defaultCursor, &black, &back);
|
||||
activeWell = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
WMHandleEvent(&ev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
XUngrabPointer(dpy, CurrentTime);
|
||||
XRecolorCursor(dpy, scr->defaultCursor, &black, &back);
|
||||
|
||||
W_DestroyView(dragView);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleDragEvents(XEvent *event, void *data)
|
||||
{
|
||||
@@ -526,17 +363,17 @@ handleDragEvents(XEvent *event, void *data)
|
||||
|| abs(cPtr->ipoint.y - event->xmotion.y) > 4) {
|
||||
WMSize offs;
|
||||
WMPixmap *pixmap;
|
||||
char *types[2] = {"application/X-color", NULL};
|
||||
|
||||
offs.width = 2;
|
||||
offs.height = 2;
|
||||
pixmap = makeDragPixmap(cPtr);
|
||||
|
||||
/*
|
||||
WMDragImageFromView(cPtr->view, pixmap, cPtr->view->pos,
|
||||
WMDragImageFromView(cPtr->view, pixmap, types,
|
||||
wmkpoint(event->xmotion.x_root,
|
||||
event->xmotion.y_root),
|
||||
offs, event, True);
|
||||
* */
|
||||
|
||||
dragColor(cPtr, event, pixmap);
|
||||
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
@@ -585,3 +422,53 @@ destroyColorWell(ColorWell *cPtr)
|
||||
wfree(cPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned
|
||||
draggingEntered(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return WDOperationCopy;
|
||||
}
|
||||
|
||||
|
||||
static unsigned
|
||||
draggingUpdated(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return WDOperationCopy;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
draggingExited(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
static char*
|
||||
prepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return "application/X-color";
|
||||
}
|
||||
|
||||
|
||||
static Bool
|
||||
performDragOperation(WMView *self, WMDraggingInfo *info, WMData *data)
|
||||
{
|
||||
char *colorName = (char*)WMDataBytes(data);
|
||||
WMColor *color;
|
||||
|
||||
color = WMCreateNamedColor(W_VIEW_SCREEN(self), colorName, True);
|
||||
|
||||
WMSetColorWellColor(self->self, color);
|
||||
|
||||
WMReleaseColor(color);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
concludeDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
}
|
||||
|
||||
23
WINGs/wconfig.h
Normal file
23
WINGs/wconfig.h
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
#ifndef WINGS_CONFIG_H_
|
||||
#define WINGS_CONFIG_H_
|
||||
|
||||
#include "../src/config.h"
|
||||
|
||||
#if defined(HAVE_LIBINTL_H) && defined(I18N)
|
||||
# include <libintl.h>
|
||||
# define _(text) dgettext("WINGs", text)
|
||||
#else
|
||||
# define _(text) (text)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
# define INLINE inline
|
||||
#else
|
||||
# define INLINE
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* WINGS_CONFIG_H_ */
|
||||
|
||||
770
WINGs/wevent.c
770
WINGs/wevent.c
@@ -1,59 +1,11 @@
|
||||
|
||||
|
||||
/*
|
||||
* This event handling stuff was based on Tk.
|
||||
* This event handling stuff was inspired on Tk.
|
||||
*/
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include "../src/config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <X11/Xos.h>
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#ifndef X_GETTIMEOFDAY
|
||||
#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct TimerHandler {
|
||||
WMCallback *callback; /* procedure to call */
|
||||
struct timeval when; /* when to call the callback */
|
||||
void *clientData;
|
||||
struct TimerHandler *next;
|
||||
} TimerHandler;
|
||||
|
||||
|
||||
typedef struct IdleHandler {
|
||||
WMCallback *callback;
|
||||
void *clientData;
|
||||
} IdleHandler;
|
||||
|
||||
|
||||
typedef struct InputHandler {
|
||||
WMInputProc *callback;
|
||||
void *clientData;
|
||||
int fd;
|
||||
int mask;
|
||||
} InputHandler;
|
||||
|
||||
|
||||
/* table to map event types to event masks */
|
||||
static unsigned long eventMasks[] = {
|
||||
@@ -99,297 +51,11 @@ static unsigned long eventMasks[] = {
|
||||
|
||||
|
||||
|
||||
/* queue of timer event handlers */
|
||||
static TimerHandler *timerHandler=NULL;
|
||||
|
||||
static WMBag *idleHandler=NULL;
|
||||
|
||||
static WMBag *inputHandler=NULL;
|
||||
|
||||
/* hook for other toolkits or wmaker process their events */
|
||||
static WMEventHook *extraEventHandler=NULL;
|
||||
|
||||
|
||||
|
||||
#define timerPending() (timerHandler)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
rightNow(struct timeval *tv) {
|
||||
X_GETTIMEOFDAY(tv);
|
||||
}
|
||||
|
||||
/* is t1 after t2 ? */
|
||||
#define IS_AFTER(t1, t2) (((t1).tv_sec > (t2).tv_sec) || \
|
||||
(((t1).tv_sec == (t2).tv_sec) \
|
||||
&& ((t1).tv_usec > (t2).tv_usec)))
|
||||
|
||||
|
||||
static void
|
||||
addmillisecs(struct timeval *tv, int milliseconds)
|
||||
{
|
||||
tv->tv_usec += milliseconds*1000;
|
||||
|
||||
tv->tv_sec += tv->tv_usec/1000000;
|
||||
tv->tv_usec = tv->tv_usec%1000000;
|
||||
}
|
||||
|
||||
|
||||
WMHandlerID
|
||||
WMAddTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
|
||||
{
|
||||
TimerHandler *handler, *tmp;
|
||||
|
||||
handler = malloc(sizeof(TimerHandler));
|
||||
if (!handler)
|
||||
return NULL;
|
||||
|
||||
rightNow(&handler->when);
|
||||
addmillisecs(&handler->when, milliseconds);
|
||||
handler->callback = callback;
|
||||
handler->clientData = cdata;
|
||||
/* insert callback in queue, sorted by time left */
|
||||
if (!timerHandler || !IS_AFTER(handler->when, timerHandler->when)) {
|
||||
/* first in the queue */
|
||||
handler->next = timerHandler;
|
||||
timerHandler = handler;
|
||||
} else {
|
||||
tmp = timerHandler;
|
||||
while (tmp->next && IS_AFTER(handler->when, tmp->next->when)) {
|
||||
tmp = tmp->next;
|
||||
}
|
||||
handler->next = tmp->next;
|
||||
tmp->next = handler;
|
||||
}
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteTimerWithClientData(void *cdata)
|
||||
{
|
||||
TimerHandler *handler, *tmp;
|
||||
|
||||
if (!cdata || !timerHandler)
|
||||
return;
|
||||
|
||||
tmp = timerHandler;
|
||||
if (tmp->clientData==cdata) {
|
||||
timerHandler = tmp->next;
|
||||
wfree(tmp);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next->clientData==cdata) {
|
||||
handler = tmp->next;
|
||||
tmp->next = handler->next;
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteTimerHandler(WMHandlerID handlerID)
|
||||
{
|
||||
TimerHandler *tmp, *handler=(TimerHandler*)handlerID;
|
||||
|
||||
if (!handler || !timerHandler)
|
||||
return;
|
||||
|
||||
tmp = timerHandler;
|
||||
if (tmp==handler) {
|
||||
timerHandler = handler->next;
|
||||
wfree(handler);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next==handler) {
|
||||
tmp->next=handler->next;
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMHandlerID
|
||||
WMAddIdleHandler(WMCallback *callback, void *cdata)
|
||||
{
|
||||
IdleHandler *handler;
|
||||
|
||||
handler = malloc(sizeof(IdleHandler));
|
||||
if (!handler)
|
||||
return NULL;
|
||||
|
||||
handler->callback = callback;
|
||||
handler->clientData = cdata;
|
||||
/* add handler at end of queue */
|
||||
if (!idleHandler) {
|
||||
idleHandler = WMCreateBag(16);
|
||||
}
|
||||
WMPutInBag(idleHandler, handler);
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteIdleHandler(WMHandlerID handlerID)
|
||||
{
|
||||
IdleHandler *handler = (IdleHandler*)handlerID;
|
||||
int pos;
|
||||
|
||||
if (!handler || !idleHandler)
|
||||
return;
|
||||
|
||||
pos = WMGetFirstInBag(idleHandler, handler);
|
||||
if (pos != WBNotFound) {
|
||||
wfree(handler);
|
||||
WMDeleteFromBag(idleHandler, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMHandlerID
|
||||
WMAddInputHandler(int fd, int condition, WMInputProc *proc, void *clientData)
|
||||
{
|
||||
InputHandler *handler;
|
||||
|
||||
handler = wmalloc(sizeof(InputHandler));
|
||||
|
||||
handler->fd = fd;
|
||||
handler->mask = condition;
|
||||
handler->callback = proc;
|
||||
handler->clientData = clientData;
|
||||
|
||||
if (!inputHandler)
|
||||
inputHandler = WMCreateBag(16);
|
||||
WMPutInBag(inputHandler, handler);
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteInputHandler(WMHandlerID handlerID)
|
||||
{
|
||||
InputHandler *handler = (InputHandler*)handlerID;
|
||||
int pos;
|
||||
|
||||
if (!handler || !inputHandler)
|
||||
return;
|
||||
|
||||
pos = WMGetFirstInBag(inputHandler, handler);
|
||||
if (pos != WBNotFound) {
|
||||
wfree(handler);
|
||||
WMDeleteFromBag(inputHandler, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Bool
|
||||
checkIdleHandlers()
|
||||
{
|
||||
IdleHandler *handler;
|
||||
WMBag *handlerCopy;
|
||||
WMBagIterator iter;
|
||||
|
||||
if (!idleHandler || WMGetBagItemCount(idleHandler)==0) {
|
||||
W_FlushIdleNotificationQueue();
|
||||
/* make sure an observer in queue didn't added an idle handler */
|
||||
return (idleHandler!=NULL && WMGetBagItemCount(idleHandler)>0);
|
||||
}
|
||||
|
||||
handlerCopy = WMCreateBag(WMGetBagItemCount(idleHandler));
|
||||
WMAppendBag(handlerCopy, idleHandler);
|
||||
|
||||
for (handler = WMBagFirst(handlerCopy, &iter);
|
||||
iter != NULL;
|
||||
handler = WMBagNext(handlerCopy, &iter)) {
|
||||
/* check if the handler still exist or was removed by a callback */
|
||||
if (WMGetFirstInBag(idleHandler, handler) == WBNotFound)
|
||||
continue;
|
||||
|
||||
(*handler->callback)(handler->clientData);
|
||||
WMDeleteIdleHandler(handler);
|
||||
}
|
||||
|
||||
WMFreeBag(handlerCopy);
|
||||
|
||||
W_FlushIdleNotificationQueue();
|
||||
|
||||
/* this is not necesarrily False, because one handler can re-add itself */
|
||||
return (WMGetBagItemCount(idleHandler)>0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
checkTimerHandlers()
|
||||
{
|
||||
TimerHandler *handler;
|
||||
struct timeval now;
|
||||
|
||||
if (!timerHandler) {
|
||||
W_FlushASAPNotificationQueue();
|
||||
return;
|
||||
}
|
||||
|
||||
rightNow(&now);
|
||||
|
||||
while (timerHandler && IS_AFTER(now, timerHandler->when)) {
|
||||
handler = timerHandler;
|
||||
timerHandler = timerHandler->next;
|
||||
handler->next = NULL;
|
||||
(*handler->callback)(handler->clientData);
|
||||
wfree(handler);
|
||||
}
|
||||
|
||||
W_FlushASAPNotificationQueue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
delayUntilNextTimerEvent(struct timeval *delay)
|
||||
{
|
||||
struct timeval now;
|
||||
|
||||
if (!timerHandler) {
|
||||
/* The return value of this function is only valid if there _are_
|
||||
timers active. */
|
||||
delay->tv_sec = 0;
|
||||
delay->tv_usec = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
rightNow(&now);
|
||||
if (IS_AFTER(now, timerHandler->when)) {
|
||||
delay->tv_sec = 0;
|
||||
delay->tv_usec = 0;
|
||||
} else {
|
||||
delay->tv_sec = timerHandler->when.tv_sec - now.tv_sec;
|
||||
delay->tv_usec = timerHandler->when.tv_usec - now.tv_usec;
|
||||
if (delay->tv_usec < 0) {
|
||||
delay->tv_usec += 1000000;
|
||||
delay->tv_sec--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -403,43 +69,43 @@ void
|
||||
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||
void *clientData)
|
||||
{
|
||||
W_EventHandler *handler;
|
||||
W_EventHandler *ptr = view->handlerList;
|
||||
W_EventHandler *handler, *ptr;
|
||||
unsigned long eventMask;
|
||||
WMArrayIterator iter;
|
||||
|
||||
if (ptr==NULL) {
|
||||
handler = wmalloc(sizeof(W_EventHandler));
|
||||
|
||||
handler->nextHandler = NULL;
|
||||
|
||||
view->handlerList = handler;
|
||||
|
||||
eventMask = mask;
|
||||
} else {
|
||||
handler = NULL;
|
||||
eventMask = mask;
|
||||
while (ptr != NULL) {
|
||||
|
||||
WM_ITERATE_ARRAY(view->eventHandlers, ptr, iter) {
|
||||
if (ptr->clientData == clientData && ptr->proc == eventProc) {
|
||||
handler = ptr;
|
||||
}
|
||||
eventMask |= ptr->eventMask;
|
||||
|
||||
ptr = ptr->nextHandler;
|
||||
}
|
||||
}
|
||||
if (!handler) {
|
||||
handler = wmalloc(sizeof(W_EventHandler));
|
||||
handler->nextHandler = view->handlerList;
|
||||
view->handlerList = handler;
|
||||
}
|
||||
}
|
||||
|
||||
WMAddToArray(view->eventHandlers, handler);
|
||||
}
|
||||
/* select events for window */
|
||||
handler->eventMask = mask;
|
||||
handler->eventMask = eventMask;
|
||||
handler->proc = eventProc;
|
||||
handler->clientData = clientData;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
matchHandler(void *item, void *cdata)
|
||||
{
|
||||
#define H1 ((W_EventHandler*)item)
|
||||
#define H2 ((W_EventHandler*)cdata)
|
||||
|
||||
return (H1->eventMask==H2->eventMask && H1->proc==H2->proc &&
|
||||
H1->clientData==H2->clientData);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* WMDeleteEventHandler--
|
||||
* Delete event handler matching arguments from windows
|
||||
@@ -450,50 +116,13 @@ void
|
||||
WMDeleteEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||
void *clientData)
|
||||
{
|
||||
W_EventHandler *handler, *ptr, *pptr;
|
||||
W_EventHandler tmp;
|
||||
|
||||
ptr = view->handlerList;
|
||||
|
||||
handler = NULL;
|
||||
pptr = NULL;
|
||||
|
||||
while (ptr!=NULL) {
|
||||
if (ptr->eventMask == mask && ptr->proc == eventProc
|
||||
&& ptr->clientData == clientData) {
|
||||
handler = ptr;
|
||||
break;
|
||||
tmp.eventMask = mask;
|
||||
tmp.proc = eventProc;
|
||||
tmp.clientData = clientData;
|
||||
WMRemoveFromArrayMatching(view->eventHandlers, matchHandler, (void*)&tmp);
|
||||
}
|
||||
pptr = ptr;
|
||||
ptr = ptr->nextHandler;
|
||||
}
|
||||
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
if (!pptr) {
|
||||
view->handlerList = handler->nextHandler;
|
||||
} else {
|
||||
pptr->nextHandler = handler->nextHandler;
|
||||
}
|
||||
wfree(handler);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
W_CleanUpEvents(WMView *view)
|
||||
{
|
||||
W_EventHandler *ptr, *nptr;
|
||||
|
||||
ptr = view->handlerList;
|
||||
|
||||
while (ptr!=NULL) {
|
||||
nptr = ptr->nextHandler;
|
||||
wfree(ptr);
|
||||
ptr = nptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Time
|
||||
@@ -529,18 +158,48 @@ void
|
||||
W_CallDestroyHandlers(W_View *view)
|
||||
{
|
||||
XEvent event;
|
||||
WMArrayIterator iter;
|
||||
W_EventHandler *hPtr;
|
||||
|
||||
|
||||
event.type = DestroyNotify;
|
||||
event.xdestroywindow.window = view->window;
|
||||
event.xdestroywindow.event = view->window;
|
||||
hPtr = view->handlerList;
|
||||
while (hPtr!=NULL) {
|
||||
|
||||
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
||||
if (hPtr->eventMask & StructureNotifyMask) {
|
||||
(*hPtr->proc)(&event, hPtr->clientData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hPtr = hPtr->nextHandler;
|
||||
|
||||
|
||||
void
|
||||
WMSetViewNextResponder(WMView *view, WMView *responder)
|
||||
{
|
||||
/* set the widget to receive keyboard events that aren't handled
|
||||
* by this widget */
|
||||
|
||||
view->nextResponder = responder;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMRelayToNextResponder(WMView *view, XEvent *event)
|
||||
{
|
||||
unsigned long mask = eventMasks[event->xany.type];
|
||||
|
||||
if (view->nextResponder) {
|
||||
WMView *next = view->nextResponder;
|
||||
W_EventHandler *hPtr;
|
||||
WMArrayIterator iter;
|
||||
|
||||
WM_ITERATE_ARRAY(next->eventHandlers, hPtr, iter) {
|
||||
if ((hPtr->eventMask & mask)) {
|
||||
(*hPtr->proc)(event, hPtr->clientData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,9 +208,10 @@ int
|
||||
WMHandleEvent(XEvent *event)
|
||||
{
|
||||
W_EventHandler *hPtr;
|
||||
W_View *view, *vPtr, *toplevel;
|
||||
W_View *view, *toplevel;
|
||||
unsigned long mask;
|
||||
Window window;
|
||||
WMArrayIterator iter;
|
||||
|
||||
if (event->type == MappingNotify) {
|
||||
XRefreshKeyboardMapping(&event->xmapping);
|
||||
@@ -570,6 +230,7 @@ WMHandleEvent(XEvent *event)
|
||||
}
|
||||
}
|
||||
view = W_GetViewForXWindow(event->xany.display, window);
|
||||
|
||||
if (!view) {
|
||||
if (extraEventHandler)
|
||||
(extraEventHandler)(event);
|
||||
@@ -621,7 +282,7 @@ WMHandleEvent(XEvent *event)
|
||||
}
|
||||
|
||||
|
||||
if (view->screen->modal && toplevel!=view->screen->modalView
|
||||
if (view->screen->modalLoop && toplevel!=view->screen->modalView
|
||||
&& !toplevel->flags.worksWhenModal) {
|
||||
if (event->type == KeyPress || event->type == KeyRelease
|
||||
|| event->type == MotionNotify || event->type == ButtonPress
|
||||
@@ -642,37 +303,26 @@ WMHandleEvent(XEvent *event)
|
||||
* might destroy the widget. */
|
||||
W_RetainView(toplevel);
|
||||
|
||||
hPtr = view->handlerList;
|
||||
|
||||
while (hPtr!=NULL) {
|
||||
W_EventHandler *tmp;
|
||||
|
||||
tmp = hPtr->nextHandler;
|
||||
|
||||
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
|
||||
if ((hPtr->eventMask & mask)) {
|
||||
(*hPtr->proc)(event, hPtr->clientData);
|
||||
}
|
||||
|
||||
hPtr = tmp;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* pass the event to the top level window of the widget */
|
||||
/* TODO: change this to a responder chain */
|
||||
if (view->parent != NULL) {
|
||||
vPtr = view;
|
||||
while (vPtr->parent != NULL)
|
||||
vPtr = vPtr->parent;
|
||||
|
||||
hPtr = vPtr->handlerList;
|
||||
|
||||
while (hPtr != NULL) {
|
||||
|
||||
WM_ITERATE_ARRAY(vPtr->eventHandlers, hPtr, iter) {
|
||||
if (hPtr->eventMask & mask) {
|
||||
(*hPtr->proc)(event, hPtr->clientData);
|
||||
}
|
||||
hPtr = hPtr->nextHandler;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/* save button click info to track double-clicks */
|
||||
if (view->screen->ignoreNextDoubleClick) {
|
||||
view->screen->ignoreNextDoubleClick = 0;
|
||||
@@ -716,156 +366,24 @@ WMIsDoubleClick(XEvent *event)
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
||||
/*
|
||||
* Check for X and input events. If X events are present input events will
|
||||
* not be checked.
|
||||
*
|
||||
* Return value: True if a X event is available or any input event was
|
||||
* processed, false otherwise (including return because of
|
||||
* some timer handler expired).
|
||||
*
|
||||
* If waitForInput is False, it will just peek for available input and return
|
||||
* without processing. Return vaue will be True if input is available.
|
||||
*
|
||||
* If waitForInput is True, it will wait until an input event arrives on the
|
||||
* registered input handlers and ConnectionNumber(dpy), or will return when
|
||||
* a timer handler expires if no input event arrived until then.
|
||||
*/
|
||||
static Bool
|
||||
waitForEvent(Display *dpy, unsigned long xeventmask, Bool waitForInput)
|
||||
{
|
||||
#if defined(HAVE_POLL) && defined(HAVE_POLL_H) && !defined(HAVE_SELECT)
|
||||
struct pollfd *fds;
|
||||
InputHandler *handler;
|
||||
int count, timeout, nfds, i, retval;
|
||||
|
||||
if (inputHandler)
|
||||
nfds = WMGetBagItemCount(inputHandler);
|
||||
else
|
||||
nfds = 0;
|
||||
|
||||
fds = wmalloc(nfds+1 * sizeof(struct pollfd));
|
||||
/* put this to the end of array to avoid using ranges from 1 to nfds+1 */
|
||||
fds[nfds].fd = ConnectionNumber(dpy);
|
||||
fds[nfds].events = POLLIN;
|
||||
|
||||
for (i = 0; i<nfds; i++) {
|
||||
handler = WMGetFromBag(inputHandler, i);
|
||||
fds[i].fd = handler->fd;
|
||||
fds[i].events = 0;
|
||||
if (handler->mask & WIReadMask)
|
||||
fds[i].events |= POLLIN;
|
||||
|
||||
if (handler->mask & WIWriteMask)
|
||||
fds[i].events |= POLLOUT;
|
||||
|
||||
#if 0 /* FIXME */
|
||||
if (handler->mask & WIExceptMask)
|
||||
FD_SET(handler->fd, &eset);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the select() timeout to the estimated time until the
|
||||
* next timer expires.
|
||||
*/
|
||||
if (timerPending()) {
|
||||
struct timeval tv;
|
||||
delayUntilNextTimerEvent(&tv);
|
||||
timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
} else {
|
||||
timeout = -1;
|
||||
}
|
||||
|
||||
if (xeventmask==0) {
|
||||
if (XPending(dpy))
|
||||
return True;
|
||||
} else {
|
||||
XEvent ev;
|
||||
if (XCheckMaskEvent(dpy, xeventmask, &ev)) {
|
||||
XPutBackEvent(dpy, &ev);
|
||||
return True;
|
||||
}
|
||||
}
|
||||
|
||||
count = poll(fds, nfds, timeout);
|
||||
|
||||
if (count>0 && nfds>0) {
|
||||
WMBag *handlerCopy = WMCreateBag(nfds);
|
||||
|
||||
for (i=0; i<nfds; i++)
|
||||
WMPutInBag(handlerCopy, WMGetFromBag(inputHandler, i));
|
||||
|
||||
for (i=0; i<nfds; i++) {
|
||||
int mask;
|
||||
|
||||
handler = WMGetFromBag(handlerCopy, i);
|
||||
/* check if the handler still exist or was removed by a callback */
|
||||
if (WMGetFirstInBag(inputHandler, handler) == WBNotFound)
|
||||
continue;
|
||||
|
||||
mask = 0;
|
||||
|
||||
if ((handler->mask & WIReadMask) &&
|
||||
(fds[i].revents & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI)))
|
||||
mask |= WIReadMask;
|
||||
|
||||
if ((handler->mask & WIWriteMask) &&
|
||||
(fds[i].revents & (POLLOUT | POLLWRBAND)))
|
||||
mask |= WIWriteMask;
|
||||
|
||||
if ((handler->mask & WIExceptMask) &&
|
||||
(fds[i].revents & (POLLHUP | POLLNVAL | POLLERR)))
|
||||
mask |= WIExceptMask;
|
||||
|
||||
if (mask!=0 && handler->callback) {
|
||||
(*handler->callback)(handler->fd, mask,
|
||||
handler->clientData);
|
||||
}
|
||||
}
|
||||
|
||||
WMFreeBag(handlerCopy);
|
||||
}
|
||||
|
||||
retval = fds[nfds].revents & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI);
|
||||
wfree(fds);
|
||||
|
||||
W_FlushASAPNotificationQueue();
|
||||
|
||||
return retval;
|
||||
#else /* not HAVE_POLL */
|
||||
#ifdef HAVE_SELECT
|
||||
struct timeval timeout;
|
||||
struct timeval *timeoutPtr;
|
||||
fd_set rset, wset, eset;
|
||||
int maxfd, nfds, i;
|
||||
int count;
|
||||
InputHandler *handler;
|
||||
|
||||
FD_ZERO(&rset);
|
||||
FD_ZERO(&wset);
|
||||
FD_ZERO(&eset);
|
||||
|
||||
FD_SET(ConnectionNumber(dpy), &rset);
|
||||
maxfd = ConnectionNumber(dpy);
|
||||
|
||||
if (inputHandler)
|
||||
nfds = WMGetBagItemCount(inputHandler);
|
||||
else
|
||||
nfds = 0;
|
||||
|
||||
for (i=0; i<nfds; i++) {
|
||||
handler = WMGetFromBag(inputHandler, i);
|
||||
if (handler->mask & WIReadMask)
|
||||
FD_SET(handler->fd, &rset);
|
||||
|
||||
if (handler->mask & WIWriteMask)
|
||||
FD_SET(handler->fd, &wset);
|
||||
|
||||
if (handler->mask & WIExceptMask)
|
||||
FD_SET(handler->fd, &eset);
|
||||
|
||||
if (maxfd < handler->fd)
|
||||
maxfd = handler->fd;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Setup the select() timeout to the estimated time until the
|
||||
* next timer expires.
|
||||
*/
|
||||
if (timerPending()) {
|
||||
delayUntilNextTimerEvent(&timeout);
|
||||
timeoutPtr = &timeout;
|
||||
} else {
|
||||
timeoutPtr = (struct timeval*)0;
|
||||
}
|
||||
|
||||
XSync(dpy, False);
|
||||
if (xeventmask==0) {
|
||||
if (XPending(dpy))
|
||||
@@ -878,49 +396,7 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
||||
}
|
||||
}
|
||||
|
||||
count = select(1 + maxfd, &rset, &wset, &eset, timeoutPtr);
|
||||
|
||||
if (count>0 && nfds>0) {
|
||||
WMBag *handlerCopy = WMCreateBag(nfds);
|
||||
|
||||
for (i=0; i<nfds; i++)
|
||||
WMPutInBag(handlerCopy, WMGetFromBag(inputHandler, i));
|
||||
|
||||
for (i=0; i<nfds; i++) {
|
||||
int mask;
|
||||
|
||||
handler = WMGetFromBag(handlerCopy, i);
|
||||
/* check if the handler still exist or was removed by a callback */
|
||||
if (WMGetFirstInBag(inputHandler, handler) == WBNotFound)
|
||||
continue;
|
||||
|
||||
mask = 0;
|
||||
|
||||
if ((handler->mask & WIReadMask) && FD_ISSET(handler->fd, &rset))
|
||||
mask |= WIReadMask;
|
||||
|
||||
if ((handler->mask & WIWriteMask) && FD_ISSET(handler->fd, &wset))
|
||||
mask |= WIWriteMask;
|
||||
|
||||
if ((handler->mask & WIExceptMask) && FD_ISSET(handler->fd, &eset))
|
||||
mask |= WIExceptMask;
|
||||
|
||||
if (mask!=0 && handler->callback) {
|
||||
(*handler->callback)(handler->fd, mask,
|
||||
handler->clientData);
|
||||
}
|
||||
}
|
||||
|
||||
WMFreeBag(handlerCopy);
|
||||
}
|
||||
|
||||
W_FlushASAPNotificationQueue();
|
||||
|
||||
return FD_ISSET(ConnectionNumber(dpy), &rset);
|
||||
#else /* not HAVE_SELECT, not HAVE_POLL */
|
||||
Neither select nor poll. You lose.
|
||||
#endif /* HAVE_SELECT */
|
||||
#endif /* HAVE_POLL */
|
||||
return W_HandleInputEvents(waitForInput, ConnectionNumber(dpy));
|
||||
}
|
||||
|
||||
|
||||
@@ -928,14 +404,13 @@ void
|
||||
WMNextEvent(Display *dpy, XEvent *event)
|
||||
{
|
||||
/* Check any expired timers */
|
||||
checkTimerHandlers();
|
||||
W_CheckTimerHandlers();
|
||||
|
||||
while (XPending(dpy) == 0) {
|
||||
/* Do idle stuff */
|
||||
/* Do idle and timer stuff while there are no timer or X events */
|
||||
while (!XPending(dpy) && checkIdleHandlers()) {
|
||||
/* Do idle and timer stuff while there are no input or X events */
|
||||
while (!waitForEvent(dpy, 0, False) && W_CheckIdleHandlers()) {
|
||||
/* dispatch timer events */
|
||||
checkTimerHandlers();
|
||||
W_CheckTimerHandlers();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -943,83 +418,40 @@ WMNextEvent(Display *dpy, XEvent *event)
|
||||
* timer/idle stuff. Or we might block forever waiting for
|
||||
* an event that already arrived.
|
||||
*/
|
||||
/* wait to something happen */
|
||||
W_WaitForEvent(dpy, 0);
|
||||
/* wait for something to happen or a timer to expire */
|
||||
waitForEvent(dpy, 0, True);
|
||||
|
||||
/* Check any expired timers */
|
||||
checkTimerHandlers();
|
||||
W_CheckTimerHandlers();
|
||||
}
|
||||
|
||||
XNextEvent(dpy, event);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
void
|
||||
WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||
{
|
||||
unsigned long milliseconds;
|
||||
struct timeval timeout;
|
||||
struct timeval *timeoutOrInfty;
|
||||
fd_set readset;
|
||||
/* Check any expired timers */
|
||||
W_CheckTimerHandlers();
|
||||
|
||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||
/* Do idle stuff while there are no timer or X events */
|
||||
while (checkIdleHandlers()) {
|
||||
if (XCheckMaskEvent(dpy, mask, event))
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the select() timeout to the estimated time until the
|
||||
* next timer expires.
|
||||
*/
|
||||
if (timerPending()) {
|
||||
delayUntilNextTimerEvent(&timeout);
|
||||
timeoutOrInfty = &timeout;
|
||||
} else {
|
||||
timeoutOrInfty = (struct timeval*)0;
|
||||
/* Do idle and timer stuff while there are no input or X events */
|
||||
while (!waitForEvent(dpy, mask, False) && W_CheckIdleHandlers()) {
|
||||
W_CheckTimerHandlers();
|
||||
}
|
||||
|
||||
if (XCheckMaskEvent(dpy, mask, event))
|
||||
return;
|
||||
|
||||
/* Wait for input on the X connection socket */
|
||||
FD_ZERO(&readset);
|
||||
FD_SET(ConnectionNumber(dpy), &readset);
|
||||
select(1 + ConnectionNumber(dpy), &readset, (fd_set*)0, (fd_set*)0,
|
||||
timeoutOrInfty);
|
||||
/* Wait for input on the X connection socket or another input handler */
|
||||
waitForEvent(dpy, mask, True);
|
||||
|
||||
/* Check any expired timers */
|
||||
checkTimerHandlers();
|
||||
W_CheckTimerHandlers();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
/*
|
||||
* Cant use this because XPending() will make W_WaitForEvent
|
||||
* return even if the event in the queue is not what we want,
|
||||
* and if we block until some new event arrives from the
|
||||
* server, other events already in the queue (like Expose)
|
||||
* will be deferred.
|
||||
*/
|
||||
void
|
||||
WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||
{
|
||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||
/* Do idle stuff while there are no timer or X events */
|
||||
while (checkIdleHandlers()) {
|
||||
if (XCheckMaskEvent(dpy, mask, event))
|
||||
return;
|
||||
}
|
||||
|
||||
/* Wait for input on the X connection socket */
|
||||
W_WaitForEvent(dpy, mask);
|
||||
|
||||
/* Check any expired timers */
|
||||
checkTimerHandlers();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Bool
|
||||
WMScreenPending(WMScreen *scr)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user