mirror of
https://github.com/gryf/wmaker.git
synced 2026-03-11 12:05:48 +01:00
Compare commits
900 Commits
wm-0.20.1
...
release-0.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
a29175db52 | ||
|
|
2acc122e2c | ||
|
|
5730c765c3 | ||
|
|
b40d52edd6 | ||
|
|
046fe3f1ca | ||
|
|
ce9c88c0e8 | ||
|
|
cc5592f087 | ||
|
|
1dc1f56802 | ||
|
|
27b9c077a4 | ||
|
|
355fffe3c4 | ||
|
|
6d81ede842 | ||
|
|
24416415a6 | ||
|
|
c6498bebd8 | ||
|
|
f65c549814 | ||
|
|
15734b9147 | ||
|
|
137ce7e0f1 | ||
|
|
7bb187a3b3 | ||
|
|
fb51ee83b7 | ||
|
|
3d7cb106af | ||
|
|
03e14f363f | ||
|
|
d267d17621 | ||
|
|
9e45e85dc6 | ||
|
|
8219011758 | ||
|
|
2e154a404d | ||
|
|
a652f23c40 | ||
|
|
cd079b9d3c | ||
|
|
a4cd5b7c9a | ||
|
|
d82906b4b7 | ||
|
|
190cd648e1 | ||
|
|
f5177e67d5 | ||
|
|
6672180d77 | ||
|
|
20c8f4fd58 | ||
|
|
41bbee7f38 | ||
|
|
bdfd7788cf | ||
|
|
fb802f2d6e | ||
|
|
85ee588aa6 | ||
|
|
5bd797b066 | ||
|
|
62a929a231 | ||
|
|
e43e1fe2f7 | ||
|
|
c7fa92794b | ||
|
|
4587f126c0 | ||
|
|
f711e49c17 | ||
|
|
98f5c6ff36 | ||
|
|
3c5f5cba0e | ||
|
|
e9cb10749b | ||
|
|
956c167bbf | ||
|
|
1315875ee0 | ||
|
|
90ab2c15cb | ||
|
|
150432ff95 | ||
|
|
9915c4ab2a | ||
|
|
817f30a754 | ||
|
|
39314191ad | ||
|
|
3d20415b8e | ||
|
|
4932d4aef8 | ||
|
|
9685ae0815 | ||
|
|
d94626fd70 | ||
|
|
2f09891b60 | ||
|
|
db594a9b89 | ||
|
|
b8ec94f941 | ||
|
|
b974bd7e78 | ||
|
|
0f9aa277c1 | ||
|
|
6c8226a52f | ||
|
|
553539748d | ||
|
|
1dc5c1882c | ||
|
|
e9ee3765f9 | ||
|
|
37217ce180 | ||
|
|
93941b2c03 | ||
|
|
41334b84d5 | ||
|
|
d97997b5e9 | ||
|
|
225c60f2f9 | ||
|
|
6ec0f20d6a | ||
|
|
210dd8ce36 | ||
|
|
e27ac1e643 | ||
|
|
5a89cfae86 | ||
|
|
e8ecd3d559 | ||
|
|
e03f8e6847 | ||
|
|
0af2448349 | ||
|
|
f7fe1b2e94 | ||
|
|
2090f81b40 | ||
|
|
34c4040d91 | ||
|
|
fea35bfc99 | ||
|
|
65f5627d98 | ||
|
|
182ecaf0f6 | ||
|
|
0efd007607 | ||
|
|
13b197ff5b | ||
|
|
0e22fc0293 | ||
|
|
2f9eb0703b | ||
|
|
08e7220dfe | ||
|
|
ac38d149e0 | ||
|
|
754230a6b7 | ||
|
|
a0ebed9cb2 | ||
|
|
23c40b0540 | ||
|
|
c7e2b37083 | ||
|
|
5d5eaf33e4 | ||
|
|
d5c2da25c4 | ||
|
|
08b0a885d1 | ||
|
|
a2ae76e274 | ||
|
|
58ca0c2824 | ||
|
|
34cd5125e3 | ||
|
|
ae354fc758 | ||
|
|
9b10e8d034 | ||
|
|
3b374faadc | ||
|
|
a5cc413432 | ||
|
|
1e5a1d8c91 | ||
|
|
0780ab82fe | ||
|
|
ec5f3a294e | ||
|
|
0d1935e3d8 | ||
|
|
14939535b6 | ||
|
|
23c0cda243 | ||
|
|
e18cba4da9 | ||
|
|
b7296cff16 | ||
|
|
049a69a9bf | ||
|
|
8e872f4efd | ||
|
|
f316df83c9 | ||
|
|
18cbed4750 | ||
|
|
7df3e111bc | ||
|
|
dd1d08461c | ||
|
|
f9851d88f1 | ||
|
|
a30475fc0f | ||
|
|
f2de1c9dcf | ||
|
|
f10d928e0a | ||
|
|
808d4e7df0 | ||
|
|
c6bc1227de | ||
|
|
e474e18f23 | ||
|
|
9fe3f77559 | ||
|
|
eca1fc5e9f | ||
|
|
448b08de0b | ||
|
|
3a47d8430e | ||
|
|
ae22c4dc1d | ||
|
|
503c1e8864 | ||
|
|
d98f1fa645 | ||
|
|
dba6e4d2d0 | ||
|
|
d5f177fe66 | ||
|
|
8073c07601 | ||
|
|
96902f5b9d | ||
|
|
95e71d500a | ||
|
|
8eb0c79c54 | ||
|
|
087fc7c82c | ||
|
|
bf4c63d657 | ||
|
|
b33d6351e5 | ||
|
|
87368574a3 | ||
|
|
285dea0340 | ||
|
|
3c5a587313 | ||
|
|
534bb721a9 | ||
|
|
2472bd3c89 | ||
|
|
3f9b7858df | ||
|
|
e5a7a883eb | ||
|
|
c952eb84ae | ||
|
|
9c59becb31 | ||
|
|
d39bb888a0 | ||
|
|
03748f0fbe | ||
|
|
9e47eba187 | ||
|
|
adaa3e0aeb | ||
|
|
c4c42d9ff6 | ||
|
|
c2cbce6d84 | ||
|
|
bb75616aad | ||
|
|
4b69ea222e | ||
|
|
34c926186c | ||
|
|
8800cd0b67 | ||
|
|
3a8499143f | ||
|
|
ef42fce3e6 | ||
|
|
c914639b8c | ||
|
|
4313762bdb | ||
|
|
5e32d1cb4f | ||
|
|
d6fb042749 | ||
|
|
8b062b07c1 | ||
|
|
9eb9198bad | ||
|
|
1d56ad7615 | ||
|
|
06b390ca01 | ||
|
|
8cd13fe96e | ||
|
|
7698ba2f1c | ||
|
|
33b8c225e1 | ||
|
|
38807b65c7 | ||
|
|
eaba3dc788 | ||
|
|
24682a9471 | ||
|
|
1176559ef7 | ||
|
|
a1e552d988 | ||
|
|
7347ef3a2f | ||
|
|
aa27686912 | ||
|
|
90f1b587c4 | ||
|
|
d425538578 | ||
|
|
a5203640f6 | ||
|
|
8c09918339 | ||
|
|
94f4483dbd | ||
|
|
4e65111750 | ||
|
|
9c2026eb44 | ||
|
|
e4ac18c04d | ||
|
|
0ccb32dab9 | ||
|
|
8163b93a99 | ||
|
|
597b04f5f7 | ||
|
|
6dd37d5972 | ||
|
|
652caa1f93 | ||
|
|
0faaf3fa68 | ||
|
|
eb87c40967 | ||
|
|
914648cc2b | ||
|
|
471862a8b1 | ||
|
|
d4ebd574d2 | ||
|
|
b47c417b72 | ||
|
|
f7016a0be6 | ||
|
|
5385a02b33 | ||
|
|
08903ea9ea | ||
|
|
d6566ff6bd | ||
|
|
cce4ef3664 | ||
|
|
1c03cc4422 | ||
|
|
80fb09a74e | ||
|
|
3ac51d8e32 | ||
|
|
d66f23813b | ||
|
|
f51a301fb9 | ||
|
|
1401269ae4 | ||
|
|
28636cc873 | ||
|
|
c11f146ec0 | ||
|
|
d7937630b2 | ||
|
|
1c64c62b3b | ||
|
|
28f185d801 | ||
|
|
e82c30b205 | ||
|
|
e2dba622bf | ||
|
|
d527e845c5 | ||
|
|
b76072162d | ||
|
|
2064d9359c | ||
|
|
dbdb44a4db | ||
|
|
4545d536bd | ||
|
|
c8e0f4164d | ||
|
|
66972237a3 | ||
|
|
b703b7428d | ||
|
|
d220b22b81 | ||
|
|
845ceca24c | ||
|
|
d1ee3cadb3 | ||
|
|
9b34f23b50 | ||
|
|
0092ff64f0 | ||
|
|
c7bc663b55 | ||
|
|
6f28a38d4d | ||
|
|
a0d037e6fc | ||
|
|
fb0710d31a | ||
|
|
b28e491fd4 | ||
|
|
d5fbe62ddd | ||
|
|
54e241d2fc | ||
|
|
412b2a052e | ||
|
|
2525c5d1fa | ||
|
|
0a615406df | ||
|
|
a06f09c849 | ||
|
|
48bbd508e1 | ||
|
|
0764c169a4 | ||
|
|
fc1c86a87e | ||
|
|
5b9b715cc4 | ||
|
|
e7df5ed456 | ||
|
|
3aa1d977b7 | ||
|
|
057da64de7 | ||
|
|
81c2bf97c2 | ||
|
|
5c88136401 | ||
|
|
e230ca4245 | ||
|
|
5f4618e8e7 | ||
|
|
72ac523394 | ||
|
|
dfe360e5c0 | ||
|
|
c917f68883 | ||
|
|
0e263f7394 | ||
|
|
d565c36ef9 | ||
|
|
9908327a4f | ||
|
|
4dabd2ec8c | ||
|
|
ac64e68fcb | ||
|
|
a66bff850c | ||
|
|
b1554bcd80 | ||
|
|
85afb7a1b6 | ||
|
|
7c930d1e2a | ||
|
|
623106e922 | ||
|
|
8747093e64 | ||
|
|
ac4053478a | ||
|
|
3c04618278 | ||
|
|
052ab01c84 | ||
|
|
54c54401d4 | ||
|
|
b59afcffc7 | ||
|
|
c38079190a | ||
|
|
32f123d43d | ||
|
|
f2f71a1f09 | ||
|
|
d214a2ca98 | ||
|
|
65f617ad0c | ||
|
|
6f119bd0ab | ||
|
|
4384ccd5b0 | ||
|
|
dc0d9cff70 | ||
|
|
124822d720 | ||
|
|
b81ce0caa5 | ||
|
|
c15be3e163 | ||
|
|
5764aa41cd | ||
|
|
4468346353 | ||
|
|
14ab80511e | ||
|
|
6dbd586586 | ||
|
|
d7384c2e07 | ||
|
|
e0423a1276 | ||
|
|
5748c8502b | ||
|
|
824edac371 | ||
|
|
55f0f37a66 | ||
|
|
f6bd8f0b7a | ||
|
|
c865218351 | ||
|
|
6d90da02ef | ||
|
|
62240a0f26 | ||
|
|
caf8ffee27 | ||
|
|
bb50f8368b | ||
|
|
ced24f3182 | ||
|
|
7cc53d5134 | ||
|
|
fcc083e51b | ||
|
|
f1fff3180f | ||
|
|
b24129831d | ||
|
|
ec54fa3f38 | ||
|
|
d1ad96755c | ||
|
|
c3fca9a0a5 | ||
|
|
3385847632 | ||
|
|
83062312fd | ||
|
|
b9c1aba415 | ||
|
|
a10885b99d | ||
|
|
667e7de647 | ||
|
|
3c503eac88 | ||
|
|
2958e72f1a | ||
|
|
c5de384f71 | ||
|
|
ba5279276f | ||
|
|
76ad1726a0 | ||
|
|
7648e92c36 | ||
|
|
c2dee60f75 | ||
|
|
937f7f5b33 | ||
|
|
9099fe535e | ||
|
|
b208eb01b9 | ||
|
|
fb6e3c1386 | ||
|
|
838a627e0b | ||
|
|
cf4f0910b7 | ||
|
|
38bb25a732 | ||
|
|
7f36af4fdf | ||
|
|
81d1ec430f | ||
|
|
bb1a700aa9 | ||
|
|
7d7be49dae | ||
|
|
029695bcda | ||
|
|
7c9574b1ea | ||
|
|
2bff75f4f7 | ||
|
|
52e674c064 | ||
|
|
1c56fc397f | ||
|
|
c5353da48c | ||
|
|
f9a04a642f | ||
|
|
54927f007a | ||
|
|
3d5f435be7 | ||
|
|
a498d53fda | ||
|
|
fbd9035f3e | ||
|
|
c8cbc630c4 | ||
|
|
bdd18ccdf0 | ||
|
|
57b315f50c | ||
|
|
ed7a292482 | ||
|
|
5e4625dafe | ||
|
|
a43f369ec3 | ||
|
|
3b98adc9ae | ||
|
|
17c4c23f22 | ||
|
|
a3dd7dc748 | ||
|
|
f039a59a1b | ||
|
|
0ba7ae448f | ||
|
|
6e97e4cae5 | ||
|
|
df7998e9e1 | ||
|
|
01b5fe34cc | ||
|
|
adb74c688c | ||
|
|
ec9847d1a3 | ||
|
|
9ca84c07bb | ||
|
|
daaccf6fc9 | ||
|
|
66eeb83d05 | ||
|
|
2bce79404d | ||
|
|
17e920ac4d | ||
|
|
b3112e2b3c | ||
|
|
c28f3b2c5b | ||
|
|
3301950805 | ||
|
|
a5d0648ad5 | ||
|
|
4ba9b80c98 | ||
|
|
8fb8355a32 | ||
|
|
4df40ab8e0 | ||
|
|
5a7a706fc4 | ||
|
|
16a5105912 | ||
|
|
374143227a | ||
|
|
b4d4d52d49 | ||
|
|
35735b2f36 | ||
|
|
d9347ea4cf | ||
|
|
351b417f3b | ||
|
|
d40250728d | ||
|
|
d6f1c81924 | ||
|
|
37ba5a836f | ||
|
|
d95a0af324 | ||
|
|
aff8982859 | ||
|
|
07e83b45d0 | ||
|
|
b06fb162df | ||
|
|
237fa3ce01 | ||
|
|
64fcfedd48 | ||
|
|
bedc22384f | ||
|
|
59e1504fe7 | ||
|
|
905010ce1e | ||
|
|
86f9c4dd32 | ||
|
|
7a1de9dad9 | ||
|
|
7f6c4d1a73 | ||
|
|
0380d048b1 | ||
|
|
55d51e546d | ||
|
|
da36a4ee96 | ||
|
|
23aac1a87a | ||
|
|
3896e61326 | ||
|
|
3b68d85428 | ||
|
|
ff8138f584 | ||
|
|
12ff477910 | ||
|
|
87c48374b7 | ||
|
|
0607245378 | ||
|
|
55c9657253 | ||
|
|
6d74b96ce2 | ||
|
|
a5e14b4b30 | ||
|
|
dd2d71fc9b | ||
|
|
70a363de7b | ||
|
|
39513b9f35 | ||
|
|
a98624ab84 | ||
|
|
bb0228dae5 | ||
|
|
cec66c4e14 | ||
|
|
2f178db0b9 | ||
|
|
6fc9e2a2e5 | ||
|
|
0b851ffc3e | ||
|
|
f8918e85f7 | ||
|
|
37e669d1d8 | ||
|
|
b67fc5cad4 | ||
|
|
113955d0a8 | ||
|
|
590af69c0b | ||
|
|
714e2ef487 | ||
|
|
ef00e3316b | ||
|
|
1962d931d5 | ||
|
|
b7b8827769 | ||
|
|
94a873707c | ||
|
|
c2434e8925 | ||
|
|
cfef89e920 | ||
|
|
d36d6f9320 | ||
|
|
50e27d6315 | ||
|
|
daeb6d67e2 | ||
|
|
b13dba1183 | ||
|
|
99e67c8ed0 | ||
|
|
8f68cfd8cd | ||
|
|
d6f2dd663e | ||
|
|
e8ffdaf8e9 | ||
|
|
e50b7e9ca9 | ||
|
|
5a156f9131 | ||
|
|
aac9a006d0 | ||
|
|
76827c72d1 | ||
|
|
a205d1f5c2 | ||
|
|
d3609d3449 | ||
|
|
fe2e0156e0 | ||
|
|
98df61be32 | ||
|
|
d3f29988d0 | ||
|
|
2c1f4634e3 | ||
|
|
a0ebbef813 | ||
|
|
3d4b4e7a44 | ||
|
|
7f01849758 | ||
|
|
446c02aa5c | ||
|
|
5bdb028648 | ||
|
|
1bb45d3466 | ||
|
|
0614a8333b | ||
|
|
a8b7216c31 | ||
|
|
553c61ee3b | ||
|
|
0bebc5a792 | ||
|
|
a997825148 | ||
|
|
dfbc246a3f | ||
|
|
2a19d45517 | ||
|
|
cef3b29d94 | ||
|
|
da4fc6b3a8 | ||
|
|
5637e33524 | ||
|
|
070680f72e | ||
|
|
5391ce4c5d | ||
|
|
33fa831bb0 | ||
|
|
95d036c52e | ||
|
|
f8d963e036 | ||
|
|
c1e7875744 | ||
|
|
bc0b869ba9 | ||
|
|
df04a0a157 | ||
|
|
cf6fbf7e13 | ||
|
|
2b1dfb439d | ||
|
|
2effbfafde | ||
|
|
674eb20ec4 | ||
|
|
a28c4144ac | ||
|
|
b54a5f65e4 | ||
|
|
eb8adc46f5 | ||
|
|
9eb4f894d0 | ||
|
|
8bdc78fcd1 | ||
|
|
afcbe06363 | ||
|
|
b147e8f85c | ||
|
|
57f0f4b245 | ||
|
|
416f28248c | ||
|
|
5324ab3304 | ||
|
|
52917e53de | ||
|
|
6c22352007 | ||
|
|
4b609a4ddc | ||
|
|
c98f229d9c | ||
|
|
e96d9a99ee | ||
|
|
4cc21af228 | ||
|
|
fad6a286d8 | ||
|
|
ad6c5e0bd8 | ||
|
|
da91828129 | ||
|
|
3bf0fa92c9 | ||
|
|
072e3002e0 | ||
|
|
7e07b7b5b9 | ||
|
|
4a473b8ad7 | ||
|
|
9df0e16707 | ||
|
|
370c15ad2b | ||
|
|
a5500d5cf5 | ||
|
|
156501bcb8 | ||
|
|
4cd8da33a7 | ||
|
|
e1001cb0db | ||
|
|
5f8c82969b | ||
|
|
bd190c5739 | ||
|
|
ceb20ee1fd | ||
|
|
9acdde0042 | ||
|
|
e7532d1892 | ||
|
|
69340d517a | ||
|
|
dfac16f988 | ||
|
|
e75050c3f4 | ||
|
|
09f8126a38 | ||
|
|
f214ef92d2 | ||
|
|
1ba54a5199 | ||
|
|
9a3d1fef45 | ||
|
|
42b8948743 | ||
|
|
ea55bc5e3f | ||
|
|
67a008937f | ||
|
|
dad0e04829 | ||
|
|
d8c169c0a8 | ||
|
|
cd35b67a6b | ||
|
|
4eda694989 | ||
|
|
5298849122 | ||
|
|
6d7e5a338d | ||
|
|
0477777415 | ||
|
|
4b4e4cf56a | ||
|
|
d0166d199f | ||
|
|
7f9f88940d | ||
|
|
c56756dc73 | ||
|
|
ea5d3bcde3 | ||
|
|
1160cbdb9d | ||
|
|
cc81785b82 | ||
|
|
088c0ac230 | ||
|
|
60980735fe | ||
|
|
e7495baff7 | ||
|
|
931a37b124 | ||
|
|
d694d6fe1c | ||
|
|
75a7f74723 | ||
|
|
416e3a82be | ||
|
|
3aeb1eb052 | ||
|
|
00e3bec101 | ||
|
|
cb320b2fc3 | ||
|
|
a37bb3aed5 | ||
|
|
64d136789c | ||
|
|
b5e9c6f9ee | ||
|
|
0261c32636 | ||
|
|
16698efd45 | ||
|
|
abb778ab53 | ||
|
|
345d980be3 | ||
|
|
9007a6575d | ||
|
|
59eb947539 | ||
|
|
abde3e0c4e | ||
|
|
9af1c6c415 |
7
.cvsignore
Normal file
7
.cvsignore
Normal file
@@ -0,0 +1,7 @@
|
||||
Makefile Makefile.in
|
||||
aclocal.m4
|
||||
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
|
||||
98
AUTHORS
98
AUTHORS
@@ -2,7 +2,7 @@ Information about locale translators is at src/po/README and
|
||||
Library/WindowMaker/README
|
||||
|
||||
Many thanks to the following people who have contributed
|
||||
patches, bug fixes and other stuff for WindowMaker:
|
||||
patches, bug fixes and other stuff for Window Maker:
|
||||
|
||||
ABE Shige <sabe@ibm.net>
|
||||
I18N support, diagonal and vertical gradient, cosmetic additions to
|
||||
@@ -13,9 +13,12 @@ restart, dock bug fixes
|
||||
Andrea Arcangeli <arcangeli@mbox.queen.it>
|
||||
Fix for cascade window placement
|
||||
|
||||
Peter Bentley <peter.bentley@nomura.co.uk>
|
||||
Dmitry Astapov <adept@dimail.alpline.mao.kiev.ua>
|
||||
Fix and some additions on XKB lock language status.
|
||||
|
||||
Peter Bentley <pete@sorted.org>
|
||||
fixed WM_STATE handling bug, fixed some memory leaks, made application menus
|
||||
be mapped near the windows for non-click-to-focus modes.
|
||||
be mapped near the windows for non-click-to-focus modes, timer bug
|
||||
|
||||
Ulf Betlehem <flu@iki.fi>
|
||||
Window resize with Meta-Click3, fixed OpaqueMove to send only 1 synth.
|
||||
@@ -24,11 +27,20 @@ ConfigureNotify
|
||||
Olly Betts <olly@muscat.co.uk>
|
||||
shaded window indication in window list
|
||||
|
||||
Tudor Bosman <tudorb@caltech.edu>
|
||||
autoraise bugfix
|
||||
|
||||
Rob Clark <rclark@turing.cs.hmc.edu>
|
||||
Text input field, 15bpp support
|
||||
|
||||
George Clernon <clernong@tinet.ie>
|
||||
bug fix in browser widget
|
||||
|
||||
Omar Cornut / Zoop <cornut@capway.com>
|
||||
SteelBlueSilk theme
|
||||
|
||||
Sylvain CORRE <sylvain.corre@wanadoo.fr>
|
||||
bug fix for MkLinux/PPC, bug fix for cpixmap in wmsetbg
|
||||
bug fix for MkLinux/PPC
|
||||
|
||||
Frederic Devernay <devernay@istar.fr>
|
||||
dock fix for openwindows, made asclock be friendlier with colorcell impaired
|
||||
@@ -53,36 +65,51 @@ Documentation help, autoconf cleanup
|
||||
Mark 'segfault' Guzman <root@lsd.pbx.org>
|
||||
Various bugfixes
|
||||
|
||||
Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>
|
||||
Better detection of gfx libraries
|
||||
Ullrich Hafner <hafner@bigfoot.de>
|
||||
Better detection of gfx libraries, added IconTitleColor/IconTitleBack
|
||||
|
||||
Greg Hayes <sdc@choice.net>
|
||||
Twisted miniaturization animation
|
||||
|
||||
Alban Hertroys <dalroi@wit401310.student.utwente.nl>
|
||||
WINGs color panel
|
||||
|
||||
HIDEKI Fujimoto <hideki70@osk2.threewebnet.or.jp>
|
||||
FreeBSD portability, icon arrangement fixes, dock initialization bug fix,
|
||||
some I18N related fixes
|
||||
|
||||
Pascal Hofstee <daeron@wit401305.student.utwente.nl>
|
||||
WINGs bug fixes, WINGs color panel
|
||||
|
||||
Robert A. Holak <panthar@tradeservices.com>
|
||||
bug fix
|
||||
|
||||
Michael Hokenson <logan@dct.com>
|
||||
wkde2menu.pl script
|
||||
|
||||
IKARASHI Akira <ikarashi@itlb.te.noda.sut.ac.jp>
|
||||
Workspace change bug fix
|
||||
|
||||
Sudish Joseph <sj@eng.mindspring.net>
|
||||
Modifier binding fix and other bug fixes
|
||||
|
||||
Luke Kendall <luke@research.canon.com.au>
|
||||
menu format converter, various enhancements to wxcopy and wxpaste
|
||||
|
||||
Bradley M Keryan <keryan@andrew.cmu.edu>
|
||||
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
|
||||
misclellaneous bug fixes, definable cursors..
|
||||
|
||||
Alfredo K. Kojima <kojima@inf.ufrgs.br>
|
||||
The JED Text Editor <xjed@windowmaker.org>
|
||||
Project maintainer
|
||||
|
||||
Alfredo K. Kojima <kojima@windowmaker.org>
|
||||
The guy who types random keys to feed JED with the necessary entropy
|
||||
|
||||
Jay Kominek <jkominek@xtn.net>
|
||||
smart and random placement
|
||||
|
||||
@@ -92,20 +119,20 @@ Move/resize code fixes, button press/release fix
|
||||
Ryan Land <rland@bc1.com>
|
||||
workspace "layers"
|
||||
|
||||
Largo <largo@gnu.net>
|
||||
wm.gnu.net maintainer, FAQ maintainer
|
||||
Largo <largo@current.nu>
|
||||
wm.current.nu maintainer, FAQ co-maintainer
|
||||
|
||||
Stuart Luppescu <s-luppescu@uchicago.edu>
|
||||
Documentation help
|
||||
|
||||
Marcelo E. Magallon <mmagallo@efis.ucr.ac.cr>
|
||||
CPP search path improvement, man pages
|
||||
CPP search path improvement, man pages, bug fixes
|
||||
|
||||
Tim Malone <mrgone@eskimo.com>
|
||||
bug fix
|
||||
bug fix, jpeg bug fix
|
||||
|
||||
MANOME Tomonori <manome@itlb.te.noda.sut.ac.jp>
|
||||
I18N bug fixes and japanese locale
|
||||
I18N bug fixes and japanese locale, wsetfont script
|
||||
|
||||
Brian Alexander Martin <brian@goober.wireless.ucsc.edu>
|
||||
PIPE_MENU
|
||||
@@ -116,13 +143,13 @@ Andrea Mistrali <andre@ulmo.aleph.it>
|
||||
Jeff Meininger <jeffm@boxybutgood.com>
|
||||
Fix for unassociated alpha tiff
|
||||
|
||||
Dan Pascu <dan@services.iiruc.ro>
|
||||
Craig Nellist <crn@ozemail.com.au>
|
||||
selection in textfield
|
||||
|
||||
Dan Pascu <dan@windowmaker.org>
|
||||
dock ghost (superfluous mode) fix, enhancement for scrollable menus,
|
||||
clip, numerous other stuff, project maintainer
|
||||
|
||||
Kenneth W. Persinger Jr. <Kenn_Persinger@sector7.com>
|
||||
tcl/tk dockit
|
||||
|
||||
Biagio Pippa <1993s017@educ.disi.unige.it>
|
||||
fixed miniaturization with transient window
|
||||
|
||||
@@ -134,7 +161,11 @@ Initial code for clip's collapse feature.
|
||||
|
||||
Ture Pelsson <ture@lysator.liu.se>
|
||||
various portability fixes, replaced busy wait with select() in event
|
||||
handling code, fixed problem with some misbehaved kids after a fork().
|
||||
handling code, fixed problem with some misbehaved kids after a fork(),
|
||||
some other bug fixes, support for poll() in event handling code
|
||||
|
||||
Toby Sargeant <?>
|
||||
menu format converter
|
||||
|
||||
Carsten Schaar <nhadcasc@fs-maphy.uni-hannover.de>
|
||||
SCO portability, german locale, autoconf enhancements
|
||||
@@ -145,8 +176,14 @@ REDUCE_APPICON/single-icon
|
||||
Chong Shang Shan <chongsha@sps.nus.edu.sg>
|
||||
flipping iconification animation
|
||||
|
||||
Daniel Skarda <0rfelyus@atrey.karlin.mff.cuni.cz>
|
||||
SGI "black dialogs" bug fix
|
||||
|
||||
Paul D. Smith <psmith@BayNetworks.COM>
|
||||
SunOS portability, configure fixes
|
||||
|
||||
Phillip Smith <teknix@alloy.net>
|
||||
FTP and WWW site provider/maintainer
|
||||
FTP, WWW, mailing list site provider/maintainer (Net logistics)
|
||||
|
||||
Lauri Tarkkala <ltarkkal@cs.hut.fi>
|
||||
SIGHUP unblock bug fix
|
||||
@@ -155,10 +192,19 @@ Sam Varner <varner@nmr.physics.wm.edu>
|
||||
many fixes and enhancements for move, resize and window placement code.
|
||||
|
||||
Marco van Hylckama Vlieg <fatal@global.uibk.ac.at>
|
||||
house icon for WINGs file dialogs, defaullAppIcon and Clip xpm icon
|
||||
house icon for WINGs file dialogs, defaultAppIcon and Clip xpm tchX.tiff
|
||||
Plus the following icons:
|
||||
DefaultAppIcon.tiff GNUterm.tiff clip2.tiff defaultterm.tiff draw.tiff
|
||||
linuxterm.tiff mixer.tiff notepad.tiff pdf.tiff ps.tiff real.tiff sgiterm.tiff
|
||||
sound.tiff staroffice2.tiff timer.tiff wilber.tiff write.tiff xdvi.tiff
|
||||
xv.tiff
|
||||
|
||||
David Wang <dwang@cisco.com>
|
||||
edge resistance
|
||||
edge resistance, 8bpp balloon bug fix, other 8bpp related fixes
|
||||
|
||||
Franck Wolff <frawolff@club-internet.fr>
|
||||
various fixes/enhancements to WINGs
|
||||
|
||||
|
||||
Yoav Yerushalmi <yoav@mit.edu>
|
||||
Fixed -visualid for screens that can do multiple depths. Another fix in
|
||||
@@ -167,11 +213,17 @@ libproplist. Chooses best depth in screen.
|
||||
FRBall <frb@umr.edu>
|
||||
dgradient fix
|
||||
|
||||
"]d" <mhz@gpf.or.th>
|
||||
Window list menu miniaturized/hidden hints
|
||||
|
||||
"]d" <id@maliwan.org>
|
||||
Window list menu miniaturized/hidden hints, XDE support, XKB lock
|
||||
language status, WINGs enhancements, bug fixes, window commands menu
|
||||
enhancement, window move/resize by keyboard. GNUstepGlow.tiff icon,
|
||||
WINGs color panel, Appearance section icon(s)
|
||||
|
||||
|
||||
Trae Mc Combs <x@themes.org>
|
||||
BlueWaves.jpeg background image in BlueWaves theme.
|
||||
|
||||
And a special thanks to Martin Eskildsen for giving me his
|
||||
copy of NEXTSTEP :-)
|
||||
|
||||
|
||||
21
BUGFORM
21
BUGFORM
@@ -3,10 +3,12 @@
|
||||
---------------------------
|
||||
|
||||
|
||||
If you find a bug please fill this form and send it to
|
||||
developers@windowmaker.org
|
||||
You can also report a bug in the WWW bug tracker at
|
||||
http://windowmaker.org/cgi-bin/bugs
|
||||
If you find a bug please fill this form and send it to
|
||||
developers@windowmaker.org Please, USE THIS FORM!!!
|
||||
|
||||
You can also report a bug in the WWW bug tracker at
|
||||
http://windowmaker.org/cgi-bin/bugs or by sending this report
|
||||
to bugs@windowmaker.org
|
||||
|
||||
|
||||
0. Before reporting this bug I already:
|
||||
@@ -32,10 +34,11 @@ http://windowmaker.org/cgi-bin/bugs
|
||||
4. Configure time options you specified:
|
||||
[ ] --enable-kanji
|
||||
[ ] --disable-shape
|
||||
[ ] --disable-xpm
|
||||
[ ] --disable-tiff
|
||||
[ ] --disable-png
|
||||
[ ] --enable-single-icon
|
||||
[ ] --enable-kde
|
||||
[ ] --enable-gnome
|
||||
[ ] --enable-openlook
|
||||
[ ] --enable-modelock
|
||||
[ ] Others: .......................
|
||||
|
||||
|
||||
@@ -68,4 +71,8 @@ X Server Vendor: ...................... Color Depth: .................
|
||||
WindowMaker Version (run "wmaker -version"): .........................
|
||||
|
||||
|
||||
11. backtrace if the bug made Window Maker crash. PLEASE SEND THE
|
||||
BACKTRACE. Your bug report might be of not much use without one.
|
||||
strace/truss outputs are usually not usefull for crashes, so you can
|
||||
skip it. The README file has instructions to make one.
|
||||
|
||||
|
||||
26
BUGS
26
BUGS
@@ -1,10 +1,20 @@
|
||||
- the app menu does not update after a style/theme change without restart.
|
||||
- the animation of shade puts ImageMagick/display in a weird state
|
||||
- during startup, transient windows should be miniaturized with their owners
|
||||
not in their own icons
|
||||
- shaped windows don't resize very well
|
||||
- wmaker will not stop managing a screen even if another window manager
|
||||
requests that, through the ICCCM 2.0 manager selection stuff
|
||||
- stacking code is buggy (or XFree is buggy)
|
||||
- WINGs has problems in some platforms (SGI, Sun etc.) Anyone on these
|
||||
systems want to fix it?
|
||||
- after restart focus is losed or switched to another window. May be related
|
||||
to the one above.
|
||||
- save session doesnt work on some platforms (Alpha and Sparc)
|
||||
- GNUSTEP_WM_ATTR in WINGs has problems on Alpha boxes
|
||||
- texture pixmaps are being incorrectly freed somewhere. Either
|
||||
fix bug (to support broken MetroX servers) or remove all useless references
|
||||
to the Pixmap (to save memory and drop bug compatibility).
|
||||
- host information is not saved/honored by the dock or save session stuff.
|
||||
It should at least check if the host is the local machine and only save it
|
||||
in the session/allow docking it if yes.
|
||||
- the SHELL environment variable support in the apps menu was removed
|
||||
because of a problem with tcsh. If ~/.tcshrc contains "stty erase ^H",
|
||||
it will block and the cmd will not be executed.
|
||||
- mouse grab being done in client window (in wWindowResetMouseGrabs())
|
||||
instead of the frame window. If grab is done in frame, titlebar buttons
|
||||
dont work well
|
||||
|
||||
- mysterious mess in dock icons (specially netscape)
|
||||
|
||||
91
COPYING.OPL
Normal file
91
COPYING.OPL
Normal file
@@ -0,0 +1,91 @@
|
||||
|
||||
OpenContent License (OPL)
|
||||
Version 1.0, July 14, 1998.
|
||||
|
||||
This document outlines the principles underlying the OpenContent
|
||||
(OC) movement and may be redistributed provided it remains
|
||||
unaltered. For legal purposes, this document is the license under
|
||||
which OpenContent is made available for use.
|
||||
|
||||
The original version of this document may be found at
|
||||
http://www.opencontent.org/opl.shtml
|
||||
|
||||
LICENSE
|
||||
|
||||
Terms and Conditions for Copying, Distributing, and Modifying
|
||||
|
||||
Items other than copying, distributing, and modifying the Content
|
||||
with which this license was distributed (such as using, etc.) are
|
||||
outside the scope of this license.
|
||||
|
||||
1. You may copy and distribute exact replicas of the OpenContent
|
||||
(OC) as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any
|
||||
warranty; and give any other recipients of the OC a copy of this
|
||||
License along with the OC. You may at your option charge a fee for
|
||||
the media and/or handling involved in creating a unique copy of the
|
||||
OC for use offline, you may at your option offer instructional
|
||||
support for the OC in exchange for a fee, or you may at your option
|
||||
offer warranty in exchange for a fee. You may not charge a fee for
|
||||
the OC itself. You may not charge a fee for the sole service of
|
||||
providing access to and/or use of the OC via a network (e.g. the
|
||||
Internet), whether it be via the world wide web, FTP, or any other
|
||||
method.
|
||||
|
||||
2. You may modify your copy or copies of the OpenContent or any
|
||||
portion of it, thus forming works based on the Content, and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified content to carry prominent notices
|
||||
stating that you changed it, the exact nature and content of the
|
||||
changes, and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the OC or any part
|
||||
thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License, unless otherwise permitted
|
||||
under applicable Fair Use law.
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the OC, and
|
||||
can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work
|
||||
based on the OC, the distribution of the whole must be on the terms
|
||||
of this License, whose permissions for other licensees extend to
|
||||
the entire whole, and thus to each and every part regardless of who
|
||||
wrote it. Exceptions are made to this requirement to release
|
||||
modified works free of charge under this license only in compliance
|
||||
with Fair Use law where applicable.
|
||||
|
||||
3. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to copy,
|
||||
distribute or modify the OC. These actions are prohibited by law if
|
||||
you do not accept this License. Therefore, by distributing or
|
||||
translating the OC, or by deriving works herefrom, you indicate
|
||||
your acceptance of this License to do so, and all its terms and
|
||||
conditions for copying, distributing or translating the OC.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
4. BECAUSE THE OPENCONTENT (OC) IS LICENSED FREE OF CHARGE, THERE
|
||||
IS NO WARRANTY FOR THE OC, TO THE EXTENT PERMITTED BY APPLICABLE
|
||||
LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
|
||||
AND/OR OTHER PARTIES PROVIDE THE OC "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE. THE ENTIRE RISK OF USE OF THE OC IS WITH YOU.
|
||||
SHOULD THE OC PROVE FAULTY, INACCURATE, OR OTHERWISE UNACCEPTABLE
|
||||
YOU ASSUME THE COST OF ALL NECESSARY REPAIR OR CORRECTION.
|
||||
|
||||
5. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
|
||||
MIRROR AND/OR REDISTRIBUTE THE OC AS PERMITTED ABOVE, BE LIABLE TO
|
||||
YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
|
||||
THE OC, EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
45
COPYING.WTFPL
Normal file
45
COPYING.WTFPL
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
The following artwork were created by Banlu Kemiyatorn and
|
||||
are distributed through the license in this file:
|
||||
GNUstepGlow.tiff
|
||||
GNUstepGlow.xpm
|
||||
Magnify.tiff
|
||||
Magnify.xpm
|
||||
Terminal.tiff
|
||||
Terminal.xpm
|
||||
TerminalGNUstep.tiff
|
||||
TerminalGNUstep.xpm
|
||||
TerminalLinux.tiff
|
||||
TerminalLinux.xpm
|
||||
tiff/msty1.tiff
|
||||
tiff/msty2.tiff
|
||||
tiff/msty3.tiff
|
||||
xpm/msty1.xpm
|
||||
xpm/msty2.xpm
|
||||
xpm/msty3.xpm
|
||||
WPrefs.tiff
|
||||
WPrefs.xpm
|
||||
tiff/tdel.tiff
|
||||
tiff/tedit.tiff
|
||||
tiff/textr.tiff
|
||||
tiff/tnew.tiff
|
||||
xpm/tdel.xpm
|
||||
xpm/tedit.xpm
|
||||
xpm/textr.xpm
|
||||
xpm/tnew.xpm
|
||||
inside Resources/Images.tiff "the little house", "the trash can",
|
||||
"the folder", "the floppies"
|
||||
|
||||
|
||||
do What The Fuck you want to Public License
|
||||
|
||||
Version 1.0, March 2000
|
||||
Copyright (C) 2000 Banlu Kemiyatorn (]d).
|
||||
136 Nives 7 Jangwattana 14 Laksi Bangkok
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Ok, the purpose of this license is simple
|
||||
and you just
|
||||
|
||||
DO WHAT THE FUCK YOU WANT TO.
|
||||
588
ChangeLog
588
ChangeLog
@@ -1,3 +1,590 @@
|
||||
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:
|
||||
.............................
|
||||
|
||||
- fixed bug with menu editor in WPrefs placing cut/paste-ed entries in wrong
|
||||
positions.
|
||||
- removed "Keep Attracted Icons" option from Clip's menu. See NEWS.
|
||||
- fixed bug in Xdnd code to be able to work with QT. (This is QT's bug so
|
||||
it will change again in future)
|
||||
- replaced debugging output stuff with Nana
|
||||
- fixed problem with session restoring and dock autolaunch (Jacek Naglak
|
||||
<nag@promail.pl>)
|
||||
- put WorkspaceNamePosition in WPrefs
|
||||
- added a lock to docked icons
|
||||
- fixed crashing bug in WPrefs.app's Appearance section.
|
||||
- fixed sorting of names in icon chooser, and file browser.
|
||||
- fixed name completion problem in file browser.
|
||||
- added new sound events (from pascal)
|
||||
- fixed bug when moving/resizing internal windows
|
||||
- propagation of -noext for submenus (David Reviejo <dreviejo@arrakis.es>)
|
||||
- fixed problem with mouse sampling rate in SGIs
|
||||
- optimized frame drawing (Swivel <swivel@gnugeneration.com>)
|
||||
- removed broken optimized frame drawing patch
|
||||
- added Select Window button in attribute inspector
|
||||
- made icon images scale by a constant factor when changing icon size
|
||||
- added support for standard colormaps in PseudoColor visuals
|
||||
- changed geometry view for move/resize to a WINGs widget
|
||||
- removed DisplayFont option
|
||||
- added NoBorder attribute
|
||||
- changed semantics of GNUstep window attribute hints
|
||||
- added get-wings-flags and get-wutil-flags with the same purpose as
|
||||
get-wraster-flags, but for compiling and linking with WINGs/WUtil
|
||||
- fixed bug handling non-string values given to string valued options in
|
||||
defaults.c
|
||||
- fixed colormap_window crash bug (appears when launching some apps from dock,
|
||||
or removing apps from gnome panel etc)
|
||||
- added DONT_SCALE_ICONS #define
|
||||
- added --no-autolaunch patch (John Bafford <dshadow@zort.net>)
|
||||
- made Apply button work on window inspector for windows with no WM_CLASS
|
||||
- changed sound server code to be more efficient
|
||||
- fixed crash with broken apps that set mask size != pixmap size in icons
|
||||
- made wmsetbg accept relative paths for images that are not in PixmapPath
|
||||
- fixed windoze cycling
|
||||
- replaced XSync with XFlush in wUnshadeWindow()
|
||||
- added GNUstep window recognition through WM_CLASS->class == GNUstep
|
||||
- made window focusing not change titlebar color of GNUstep windows
|
||||
- disabled passive mouse grabbing in client area of GNUstep window
|
||||
when they are unfocused
|
||||
- added Jim Knoble <jmknoble@pobox.com>'s cursor thing patch
|
||||
- fixed lock of wmaker when clicking on menu multiple times
|
||||
- made transients appear near their owner
|
||||
- fixed crash bug with broken java implementations (Miguel Covarrubias
|
||||
<mcovarr@tigr.org>)
|
||||
- made Revert on attributes panel apply the reverted changes immediately
|
||||
to avoid inconsistent internal state
|
||||
- color dragging works correctly now
|
||||
- arbitrary stacking levels
|
||||
- save window shortcuts in state
|
||||
- changed license of Marco's icons to GPL
|
||||
- added --dont-restore cmd line option to not restore previous state
|
||||
- fixed focus bug when moving wmaker panel windows in focus-follow mouse
|
||||
|
||||
Changes since version 0.61.0:
|
||||
.............................
|
||||
|
||||
- fixed Xdnd by cropping filename with ""
|
||||
- fixed OPEN_MENU
|
||||
- fixed crash when moving a shaded window with keyboard
|
||||
- fixed problem with window shortcut assignment from the menu
|
||||
- fixed problem with fonts in WINGs (Masahide -mac- NODA
|
||||
<mac@flab.fujitsu.co.jp>)
|
||||
- fixed multihead bugs (Morten Bøgeskov" <mb@dbc.dk>)
|
||||
- fixed crashing bug when saving session information.
|
||||
- fixed crashing bug related to onmipresent icons in Clip
|
||||
- added _WINDOWMAKER_ICON_TILE and _WINDOWMAKER_ICON_SIZE hint in
|
||||
the noticeboard window
|
||||
|
||||
|
||||
Changes since version 0.60.0:
|
||||
.............................
|
||||
|
||||
- fixed bug in window attribute panel
|
||||
- SGI portability fix (Graham Whitted <gbw@sgrail.com>)
|
||||
- fixed compilation problem with --enable-singleicon
|
||||
- fixed compilation problem with WS_INDICATOR
|
||||
- fixed crash bug with SGI (defaults.c) (Graham Whitted <gbw@sgrail.com>)
|
||||
- fixed sloppyfocus problem in multihead dpys (Morten Bøgeskov
|
||||
<morten@bogeskov.dk>)
|
||||
- fixed WorkspaceSpecificBackground bug in wmsetbg
|
||||
- give preference to windows in window list when switching focus after
|
||||
workspace change (Richard Kilgore <rkilgore@ece.utexas.edu>)
|
||||
- brought back --locale cmd line option
|
||||
- fixed bug with WorkspaceNameDisplayPosition (Emanuele Caratti <wiz@iol.it>)
|
||||
- added missing kbd shortcut definitions for window shortcuts
|
||||
(Michael Smith <mjsmith@spirit.com.au>)
|
||||
- fixed floppy button layout in filepanel (Matthew Ashton <mrashton@home.com>)
|
||||
- fixed bug with documentedited close button (Felipe A. Rodriguez
|
||||
<farz@mindspring.com>)
|
||||
- fixed some buffer overflows
|
||||
- fixed some problem with the alpha
|
||||
- fixed some problems with non gcc compilers.
|
||||
- fixed problem with showing instance.class in the inspector window.
|
||||
- fixed crash when displaying workspace name in some positions.
|
||||
- fixed compilation problem when WS_INDICATOR was defined.
|
||||
- added edge attraction. See NEWS.
|
||||
- fixed buggy RSaveXPM() in wraster library. Its output was messed up, and
|
||||
caused crashes for icons with more than 1024 colors.
|
||||
- sinking windows (such as gmc icons) won't be calculated in edge resistance
|
||||
or attraction.
|
||||
- removed drop shadow for text on title bar code. (TITLE_TEXT_SHADOW)
|
||||
- text on title bar is now possible to be drawn by plugin. See NEWS.
|
||||
- WPrefs: added support for button4/5
|
||||
- fixed scrolling of menus outside screen (Vito Caputo
|
||||
<swivel@virtual-webworld.com)
|
||||
- added dialog window for menu commands that can't be executed
|
||||
- fixed crash when deiconifying windows when icons are disabled
|
||||
- better smart placement (Gabor Melis <gabor.melis@essnet.se>)
|
||||
- replaced old linkedlist code with WMBag
|
||||
- fixed wmsetbg to use right bg color with transparent background images
|
||||
- fixed crash with Assertion "bad_root_window" && 0' failed. on startup
|
||||
- fixed crash when more than 1 dockapp fails to launch on startup
|
||||
- added a different dock setup config for each screen size
|
||||
- fixed PPosition handling
|
||||
- New "Smart placement" mode. 'Smart' is no longer an alias to 'Auto' but
|
||||
a different mode of placing windows. 'Auto' keeps the old behavior.
|
||||
- added the dir where the menu is being read from to the search path
|
||||
given to cpp
|
||||
- doing a multiwindow selection shortcut and hitting the shortcut
|
||||
repeatedly will cycle through the selected windows
|
||||
- fixed crash when overwriting a string constant (default font specs) in WINGs
|
||||
|
||||
|
||||
Changes since version 0.53.0:
|
||||
.............................
|
||||
|
||||
- fixed a bug that caused icon overlaping in Clip, when icon was moved around.
|
||||
- this time really added libwmfun to distribution.
|
||||
- made deiconification not automatically focus window in sloppy focus
|
||||
- fixed crash with DisableMiniwindows and icon pixmap changes
|
||||
- fixed crash when changing icon of window without WM_CLASS
|
||||
- added hysteresys for offscreen menu scrollback
|
||||
- fixed bug with IgnoreFocusClick
|
||||
- fixed crash with windows with width == 1 (Alban Hertroys
|
||||
<dalroi@wit401310.student.utwente.nl>)
|
||||
- added SHEXEC command
|
||||
- fixed resizebarback for SHADOW_RESIZEBAR ( jim knoble jmknoble@pobox.com)
|
||||
- added balloon help everywhere
|
||||
- fixed bug with FullMaximize attribute
|
||||
- GNOME: button events not bound in wmaker are proxyized (to gmc)
|
||||
(Paul Warren <pdw@ferret.lmh.ox.ac.uk>)
|
||||
- fixed bug with restoration of maximized window after restart with
|
||||
--enable-kde
|
||||
- added high-quality filtered rescaling (smoothed rescaling) to wrlib/wmsetbg
|
||||
- added SmoothWorkspaceBack
|
||||
- fixed crash bug in Paths section of WPrefs
|
||||
- optimized image rendering for 15/16 bpp
|
||||
- user menus' paths were changed. See NEWS.
|
||||
- added a timeout for the workspace name fading
|
||||
- HP-UX compiler compatibility workarounds (Sebastien Bauer
|
||||
seb_bauer@bigfoot.com)
|
||||
- fixed crash with attributes panel
|
||||
- save state of all menus when exiting (Sebastien Bauer
|
||||
seb_bauer@bigfoot.com)
|
||||
- added GNUstep info panel (still needs beautification..)
|
||||
- made the paths selector in WPrefs.app use the open file panel
|
||||
- fixed crash bug with hiding apps without dock/clip
|
||||
- fixed a mem leak in superfluous mode caused by the ghost icon.
|
||||
- added possibility to set omnipresent icons in Clip. See NEWS.
|
||||
- fixed bug in WPrefs menu editor
|
||||
- fixed crash when moving internal window with kbd
|
||||
- fixed compilation problem on IRIX machines (Neil Muller
|
||||
<neil@octane.sun.ac.za>)
|
||||
- replace xde support drop on dock with xdnd.
|
||||
- added an (internal use) environment variable for telling WPrefs whats's
|
||||
the name of the wmaker binary being ran.
|
||||
- more elegant text entries in Clip's menu, regarding single/multiple
|
||||
selected icons.
|
||||
- fixed cosmetic bug in geom. dpy window for 8bpp
|
||||
- removed --enable-kanji and added MultiByteText option
|
||||
- rewrote font code to use WINGs
|
||||
- made autoraise only work for the active window
|
||||
- fixed compilation problem with OpenWindows and other non-X11R6 systems..
|
||||
- fixed crash bug when iconsize=24
|
||||
- fixed portability prob with raise() in SunOS
|
||||
- fixed icon placement bug (Markus Schoder <Markus.Schoder@online.de>)
|
||||
- added delete and floppy buttons in file panel.
|
||||
|
||||
|
||||
Changes since version 0.52.0:
|
||||
.............................
|
||||
|
||||
- patched wmsetbg to work with dynamically loadable texture renderer code
|
||||
- added libwmfun to distribution (forgot to do so in 0.52.0)
|
||||
- added MenuStyle option
|
||||
- changed configuration updating to use notifications
|
||||
- fixed window move through workspaces in nonopaquemove
|
||||
- added message to immediately reread configuration data
|
||||
- fixed some bug in XKB modelock toggling
|
||||
- fixed crash bug when hiding apps with appicon disabled
|
||||
- fixed wrong initial workspace # being shown on attributes panel
|
||||
- XSMP updates
|
||||
- update colorpanel
|
||||
- applied WMSound patch from "Quinn, Anthony" <Anthony.Quinn@usa.xerox.com>
|
||||
- fixed focus bug with unfocusable window (I swear I had fixed that before...)
|
||||
- applied windoze cycle patch from Paul Warren <pdw@ferret.lmh.ox.ac.uk>
|
||||
- changed initscript and exitscript execution from fork()/exec() to system()
|
||||
- added ResizebarBack and added appropriate backwards compat. hacks in setstyle
|
||||
- applied ]d's patch to allow DEMATERIALIZE_ICON over windows
|
||||
- made clip arrows gradiented
|
||||
- added a crashing dialog panel to select what to do on crashes.
|
||||
- fixed the problem with showing a window as focused in the window list menu
|
||||
while it was on another workspace.
|
||||
- show workspace name on screen when switching workspaces
|
||||
- made setstyle support WorkspaceSpecificBack
|
||||
- fixed getstyle prob with filenames with spaces (Pierre Phaneuf
|
||||
<pp@ludusdesign.com)
|
||||
- fixed crash with InfoPanel in multihead dpy
|
||||
- Fixed bug in WPrefs that added a new line at the end of autostart script
|
||||
at every save, growing it indefinitely.
|
||||
- fixed a memory leak in wrlib (Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>)
|
||||
- fixed crash during forced shutdown of X (Wolfram Gloger
|
||||
<wmglo@dent.med.uni-muenchen.de>)
|
||||
|
||||
|
||||
Changes since version 0.51.2:
|
||||
.............................
|
||||
|
||||
- made the Attributes panel be available for all windows, even
|
||||
for completely broken apps (although settings wont be saved for
|
||||
completely broken apps)
|
||||
- fixed compilation problems with compile time #defines
|
||||
- workaround for crash during startup related to hiding miniaturized windows
|
||||
from Matt Armstrong <matt_armstrong@bigfoot.com>
|
||||
- fixed focus problem with unfocusable windows
|
||||
- fixed bug in WPrefs that changed EXIT to SHUTDOWN
|
||||
- fixed menu title messup bug in WPrefs
|
||||
- added a dot to mark hidden applications (compile time) (id@windowmaker.org)
|
||||
- enhancements to the modelock patch (id@windowmaker.org)
|
||||
- show kbd mode for modelock (id@windowmaker.org)
|
||||
- enhanced positioning of transient windows
|
||||
- added dynamically loadable texture renderer code
|
||||
from Tobias Gloth <gloth@online.de>
|
||||
- added DisableMiniwindows option
|
||||
- kde: miniaturize animation will match the taskbar icon (KWM_WIN_ICON_GEOMETRY)
|
||||
- miniwindows show the title of the window if there is none set for it
|
||||
- fixed crash on kpanel restart
|
||||
- remember window shortcuts after restart
|
||||
- change edge resistance to account for panels and stuffs
|
||||
- narrower menus
|
||||
- fixed auto raise/lower behaviour of clip for docked applications that have
|
||||
their own window (applets).
|
||||
- cleaned up Clip's autocollapsing code, and made it to be similar to the
|
||||
auto raise/lower code (much cleaner).
|
||||
- fixed a race condition in Clip behavior when changing workspaces, if set to
|
||||
autocollapsing.
|
||||
|
||||
|
||||
Changes since version 0.51.1:
|
||||
.............................
|
||||
|
||||
- fixed bug with window that can get focus if both shaded and hidden.
|
||||
- maximize for full screen
|
||||
- fixed problem with frame drawing in non-opaque
|
||||
- fixed installation path prob [jmknoble@pobox.com]
|
||||
- fixed bug moving window when only one window is on screen
|
||||
- fixed bug with ignored GNUstep attributes
|
||||
- fixed WPrefs crash in Mouse Preferences
|
||||
- fixed crash bug in WINGs/wmaker startup
|
||||
- added workaround for kde pager crash bug
|
||||
- made %W in root menu and wmsetbg -w take numbers starting from 1
|
||||
- fixed crash bugs with kpanel
|
||||
|
||||
Changes since version 0.51.0:
|
||||
.............................
|
||||
|
||||
- put . to mark hidden apps
|
||||
- fixed dont set xset stuff option in WPrefs
|
||||
- fixed menu title messup in WPrefs
|
||||
- fixed WPrefs message dialogs for invalid menus
|
||||
- fixed workspace back setting in all screens
|
||||
- fixed WorkspaceSpecificBack / wmsetbg
|
||||
- added WindozeCycle patch (being rewritten)
|
||||
- cleaned up focus/unfocus state transitions
|
||||
- made WPrefs more robust
|
||||
- fixed locale file (po) installation stuff
|
||||
- fixed focus loss when dragging window across workspaces
|
||||
- fixed workspace baby boom with nextworkspacekey
|
||||
- removed ignore_next_unmap kluge
|
||||
- install defaults data in /usr/local/etc
|
||||
- added menu for miniwindow
|
||||
- fixed remove resizebar from shaded window
|
||||
- rewrote library/header search code in configure
|
||||
- rewrote window move/edge resistance code
|
||||
- added window border resistance
|
||||
- changed EdgeResistance option to only YES/NO
|
||||
- added workaround for glibc bug in sscanf("", bla, bla)
|
||||
- hopefully fixed WM_COLORMAP_WINDOWS crash bug
|
||||
- fixed searching of localized menus
|
||||
- fixed --help option
|
||||
- fixed handling of docked apps with . in their instance names
|
||||
- RSupportedFileFormats() in wrlib will now return a static buffer
|
||||
- fixed bug in StartHidden
|
||||
- a little faster startup
|
||||
- will rearrange icons after moving an icon if autoarrangeicons
|
||||
- fixed icon overlap bug
|
||||
- fixed crash with internal dialogs and multi-heads
|
||||
- added standard colormap support to wrlib (taken from libXmu sources)
|
||||
- fixed memory leak in attribute panel
|
||||
- fixed crash with CalendarManager deiconify
|
||||
- fixed heisencrash when mapping new windows
|
||||
- fixed totally buggy wmaker.inst ~/.xinitrc checker
|
||||
|
||||
Changes since version 0.50.2:
|
||||
.............................
|
||||
|
||||
- added some new icons made by Marco
|
||||
- kde: fixed stacking order reporting for modules
|
||||
- gnome: fixed state change request handling
|
||||
- fixed handling of file names with non-alphanum characters in wmsetbg
|
||||
- hopefully fixed timestamp problem that caused regeneration of configure
|
||||
- fixed a bug in the auto raise code
|
||||
- made SIGHUP exit wmaker and SIGUSR1 restart for GNOME compatibility
|
||||
- fixed %a() bug (now it really is fixed!)
|
||||
- fixed docking icons in last icon
|
||||
- fixed WMInsertPopUpButtonItem()
|
||||
- fixed bug that caused fonts of themes to be ignored
|
||||
- fixed bug in path handling in getstyle
|
||||
- stop icon explosion animation by clicking on root window
|
||||
- made SAVE_SESSION save the state of the dock
|
||||
- added command line option aliases that adhere to the GNU standards
|
||||
- fixed png gamma bug (actually unmade buggy fix)
|
||||
- fixed bug in property notify handling
|
||||
- removed KeepTransientsOnTop
|
||||
- fixed window focus when switching workspaces
|
||||
- fixed attribute inspector Apply for dont bind keys
|
||||
- fixed bad colormap bug (I hope)
|
||||
- added acceleration to keyboard window move
|
||||
- %W expand to current workspace #
|
||||
- fixed background pixmap color problem (cpixmap etc)
|
||||
- applied drop shadow patch
|
||||
- fixed crash on startup with xconsole and xdm
|
||||
- fixed portability prob with MkLinux/PPC
|
||||
- fixed portability prob with Alpha
|
||||
- added color panel to WINGs
|
||||
- added support for olwm/OPEN LOOK(tm) hints
|
||||
- added SaveYourself support
|
||||
- fixed bug in start maximized
|
||||
- added _WINDOWMAKER_NOTICEBOARD protocol
|
||||
- added docklib
|
||||
- updated utility parameter format to GNU standards
|
||||
- removed libPropList from distribution and merged with GNOME one
|
||||
|
||||
Changes since version 0.50.1:
|
||||
.............................
|
||||
|
||||
- fixed wmsetbg
|
||||
- fixed parsing of WorkspaceSpecificBack
|
||||
- fixed initial workspace for new windows
|
||||
- added the workspace button proxy thingy for GNOME
|
||||
- added more GNOME compatibility fixes
|
||||
- fixed bug in %a() macro in root menu
|
||||
|
||||
Changes since version 0.50.0:
|
||||
.............................
|
||||
|
||||
- fixed bug that allowed docking of icons to outside the screen
|
||||
- added extra code to handle kpager bug
|
||||
- fixed crash when opening appicon menu
|
||||
- fixed problem that caused Motif hints to be sometimes ignored
|
||||
- fixed bug in layer treatment of GNOME hints
|
||||
- fixed weirdness in initial window workspace
|
||||
- fixed problem with Sun compilers
|
||||
- fixed bug with () Workspace{Specific,}Back specs
|
||||
- added --disable-rpath option (from KDE) by request
|
||||
- maybe fixed bug with StarOffice
|
||||
- fixed pipe fd inheritance mess
|
||||
- fixed bug in kde workspace renaming
|
||||
- fixed installation problems
|
||||
|
||||
Changes since version 0.20.3:
|
||||
.............................
|
||||
|
||||
- window list is ordered by workspace
|
||||
- preliminary grid move mode
|
||||
- fixed prob with docked apps with the same name switching places (like wmmon
|
||||
and wmmon -s)
|
||||
- wrapping of workspace switching for 5button mice
|
||||
- added restart in fallback menu
|
||||
- fixed buglet in modifier error reporting
|
||||
- extra options in window command menu
|
||||
- changed select() used in wevent.c to poll()
|
||||
- fixed bug in SGI boxes (black dialogs)
|
||||
- added IconTitleBack, IconTitleColor
|
||||
- made error checking stricter
|
||||
- fixed crash when saving application supplied icons that have many colors
|
||||
- added move threshold to menus
|
||||
- added textured gradient textures
|
||||
- added -nofont flag for setstyle
|
||||
- added -p flag and theme pack support for getstyle
|
||||
- fixed crash bug when clicking on menu title opened with kbd
|
||||
- fixed bug that caused incorrect saving of icon configuration (the -name bug)
|
||||
- scale pixmap texture for workspaceback type will maintain aspect ratio
|
||||
- fixed memory leak in jpeg loader
|
||||
- started XStandardColormap support
|
||||
- added StartMaximized window flag
|
||||
- fixed bug of mixed up Unfocusable and StartMiniaturized flags
|
||||
- yet another try to switch to shared libraries
|
||||
- workspace specific background images
|
||||
- stack new windows to under focused window if autofocus is off (disabled)
|
||||
- added kde support
|
||||
- implemented the "GNOME Window Manager Compliance" stuff
|
||||
- window move/resize by keyboard
|
||||
- rewrote window attribute code to make it cleaner
|
||||
- added --enable-lite configure option
|
||||
- added support to change prompt in %a() for root menu
|
||||
- rewrote exit code
|
||||
- added KeepInsideScreen=YES; for scilab in default WMWindowAttributes
|
||||
- added an option to the Clip, to allow automatic Raise/Lower when the mouse
|
||||
cursor enter/leave the Clip.
|
||||
|
||||
|
||||
Changes since version 0.20.2:
|
||||
.............................
|
||||
|
||||
- hysteresis for menu item selection (delayed selection for selecting
|
||||
submenu items)
|
||||
- window shortcuts
|
||||
- removed Hide Others from window commands menu
|
||||
- window commands menu will close when the window for it is closed
|
||||
- made shade not set the Iconic state
|
||||
- fixed bug in miniaturizing atribute panel
|
||||
- made frame rectangles be more visible in PseudoColor (8bpp)
|
||||
- fixed bug for 64bit machines
|
||||
- added support for ICCCM 2.0 WM_COLORMAP_NOTIFY message
|
||||
- fixed bug for apps that put strings with . in WM_CLASS
|
||||
- added handling for reparented client windows
|
||||
- fixed bug with window positioning
|
||||
- fixed cascade window placement to account for dock
|
||||
- added modelock stuff
|
||||
- added X include path in gfx header when configure searches for headers
|
||||
- fixed bug in window positioning by clients
|
||||
- added run-time test for shared pixmap support on server
|
||||
- changed order of link flags in Makefiles
|
||||
- fixed problem with random window placement
|
||||
- fixed multiple window selection for multiheads
|
||||
- grayscale and 8bit jpeg support
|
||||
- fixed client restoration in restart/exit in multiheads
|
||||
- started session management code
|
||||
- fixed problem with docked programs that have names with spaces
|
||||
- updated WPrefs.app for iconificationstyle
|
||||
- added -static command line option
|
||||
- put redundant NoWindowOverDock
|
||||
- fixed overlapping clip icon bug
|
||||
- extended window level code
|
||||
- added KeepOnBottom hint
|
||||
- added iconification style to WPrefs.app
|
||||
- fixed crash with bad value in defaults file
|
||||
- changed icon stacking code
|
||||
- added primitive support for 5 button mouse (for switching workspaces)
|
||||
- fixed BadAccess and crash on programs that do XGrabButton
|
||||
- fixed bug with rootmenu Exec not working when stty is called from ~/.tcshrc
|
||||
- fixed bug with Move menu and sloppy focus
|
||||
- temporarily removed SHELL support in apps menu
|
||||
|
||||
Changes since version 0.20.1:
|
||||
.............................
|
||||
|
||||
- fixed timer bug
|
||||
- removed NoWindowUnderDock
|
||||
- error reporting mechanism has changed in wrlib. Instead of a writing
|
||||
the message in a string, it will place the error code in RErrorCode
|
||||
- smoother icon selection
|
||||
- persistent client supplied icon pixmaps
|
||||
- fixed yet another crash on emacs exit bug
|
||||
- fixed portability prob in wrlib shm code
|
||||
- fixed bug in DISPLAY variable setting in multiheads
|
||||
- fixed a few more portability problems related to storing struct properties
|
||||
- fixed damaged balloons on Suns/8bpp (I guess)
|
||||
- better "one of" type option handling
|
||||
- added a timeout for some animations
|
||||
- support for large binary files in wxcopy/wxpaste
|
||||
- fixed bug of losing focus when resizing/moving windows
|
||||
- fixed bug in libproplist
|
||||
- fixed focus with sloppy
|
||||
- changed permissions of shm segments to 0666. Now, if someone has a shm
|
||||
leak, we can know who it is.
|
||||
- faster titlebar texture update
|
||||
- faster icon kaboom
|
||||
- added different undocking animation
|
||||
- updated wmaker -version to output "Window Maker" instead of WindowMaker
|
||||
- fixed crash bug with transient windows (gimp etc)
|
||||
- fixed bug with popen()+wwarning() - problem opening cpp'ed menus
|
||||
- added test for header files in configure for gfx libraries
|
||||
- simplified building process, making libPropList be always built
|
||||
- fixed crash with bad mgradient color entry
|
||||
- docked appicons that are being edited/killed cant be moved (mutex fix)
|
||||
- more features in wxcopy/wxpaste
|
||||
- fixed bug with state file in multiheads
|
||||
- selection retrieval moved to WINGs
|
||||
- fixed workspacekey to switch workspaces in the current layer
|
||||
- fixed workspacekey to not switch to inexisting workspace unless
|
||||
AdvanceToNewWorkspace is YES
|
||||
- fixed bug with disappearing windows if a workspace switch is made on startup
|
||||
- fixed blocking of window creation/destroy events when opening menu with kbd
|
||||
- fixed aspect ratio setting bug
|
||||
- fixed crashing when miniaturized window is closed during animation
|
||||
- added XDE support
|
||||
- fixed stupid bug in shape stuff
|
||||
- raised threshold for removing docked icons
|
||||
- fixed HideOthers for windows with NoAppIcon=YES
|
||||
- if Cancel is pressed in dialog box of %a in menu cmd lines, the command
|
||||
will be canceled
|
||||
- slightly better dithering for 8bpp
|
||||
- apps menu will use $SHELL, instead of /bin/sh to run EXEC menu commands
|
||||
- cleaned up some code (GetNormalHints(), wManageWindow(),
|
||||
wGetWindowSavedState() et al, )
|
||||
|
||||
|
||||
Changes since version 0.20.0:
|
||||
.............................
|
||||
|
||||
@@ -36,7 +623,6 @@ Changes since version 0.19.3:
|
||||
- AIX bug compatibility in XmbTextEntents()
|
||||
- fixed jpeg loading bug
|
||||
|
||||
|
||||
Changes since version 0.19.2:
|
||||
.............................
|
||||
|
||||
|
||||
13
FAQ.I18N
13
FAQ.I18N
@@ -8,6 +8,13 @@ If I18N support does not work for you, check these:
|
||||
can check if your locale is supported by X's locale emulation.
|
||||
See "/usr/X11R6/lib/X11/locale/locale.alias"
|
||||
|
||||
- Check if you're using appropriate fonts for the locale you
|
||||
chose. If you're using a font set that has a different
|
||||
encoding than the one used by Xlib or libc, bad things can
|
||||
happen. Try specifically putting the encoding in the LANG
|
||||
variable, like ru_RU.KOI8-R. Again, see
|
||||
"/usr/X11R6/lib/X11/locale/locale.alias"
|
||||
|
||||
- if your OS doesn't support any locale or if your OS doesn't
|
||||
support a locale for your language, you can use X Window System's
|
||||
locale emulation feature instead of OS's locale. To use this
|
||||
@@ -25,9 +32,9 @@ If I18N support does not work for you, check these:
|
||||
here:
|
||||
ftp://ftp.linux.or.jp/pub/RPM/glibc
|
||||
|
||||
- if you'd like to display multibyte characters, wmaker have to
|
||||
be compiled with multibyte character support. Add this option
|
||||
to the configure, "--enable-kanji".
|
||||
- if you'd like to display multibyte characters, set the
|
||||
MultiByteText option to YES in ~/GNUstep/Defaults/WindowMaker
|
||||
and ~/GNUstep/Defaults/WMGLOBAL
|
||||
|
||||
- the fonts you're using support your locale. if your font
|
||||
setting on $HOME/GNUstep/Defaults/WindowMaker is like..
|
||||
|
||||
464
INSTALL
464
INSTALL
@@ -1,5 +1,5 @@
|
||||
|
||||
Installation Instructions for WindowMaker
|
||||
Installation Instructions for Window Maker
|
||||
|
||||
|
||||
|
||||
@@ -7,22 +7,37 @@ SUPPORTED PLATFORMS
|
||||
===================
|
||||
(ie: I've heard someone has compiled it on...)
|
||||
|
||||
- Intel/Linux RedHat 4.2 (primary platform)
|
||||
- Intel/Linux other distributions
|
||||
- Sparc/Linux RedHat 5.1
|
||||
- PowerPC/MkLinux
|
||||
- Alpha/Linux RedHat 5.1
|
||||
- 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
|
||||
- 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
|
||||
|
||||
Patches to make it work on other platforms are welcome.
|
||||
|
||||
@@ -30,32 +45,58 @@ Patches to make it work on other platforms are welcome.
|
||||
REQUIREMENTS:
|
||||
=============
|
||||
|
||||
The following software is required to use WindowMaker
|
||||
The following software is required to use Window Maker:
|
||||
|
||||
- X11R6.x
|
||||
WindowMaker can be compiled in older versions of X, like X11R5
|
||||
Window Maker can be compiled in older versions of X, like X11R5
|
||||
(Solaris) or X11R4 (OpenWindows) but it will not work 100% correctly.
|
||||
In such servers there will not be application icons and you'll have
|
||||
trouble using the dock.
|
||||
trouble using the dock. Upgrading the client libraries (Xlib, Xt etc)
|
||||
will help if you can't upgrade the server.
|
||||
|
||||
The following is required to build Window Maker:
|
||||
|
||||
If you will build WindowMaker, make sure you have gcc and the X header files
|
||||
installed. Specially for newbie Linux users: you must install all X development
|
||||
packages and the gcc suite. Otherwise you won't be able to build any X program,
|
||||
including WindowMaker.
|
||||
- Basic obvious stuff
|
||||
If you will build Window Maker, make sure you have gcc (or some
|
||||
other ANSI C compiler) and the X header files installed. Specially
|
||||
for newbie Linux users: you must install all X development packages
|
||||
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
|
||||
with exactly these versions:
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
If you have a different version, disable them by temporarily
|
||||
renaming them to something else or uninstalling them from your
|
||||
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:
|
||||
=========
|
||||
|
||||
These libraries are not required to make WindowMaker work, but they
|
||||
These libraries are not required to make Window Maker work, but they
|
||||
are supported in case you want to use them. Version numbers are those
|
||||
that I have (and therefore, guraranteed to work), but other versions
|
||||
might work too. Tell me if you made wmaker work with some library
|
||||
with a version older than the stated here.
|
||||
might work too.
|
||||
|
||||
|
||||
- libXPM 4.7
|
||||
- libXPM 4.7 or newer
|
||||
Older versions may not work!!!
|
||||
Available at ftp://sunsite.unc.edu/pub/Linux/libs/X/
|
||||
|
||||
@@ -64,142 +105,247 @@ with a version older than the stated here.
|
||||
|
||||
- libpng 0.96 or newer and zlib
|
||||
For PNG image support.
|
||||
http://www.cdrom.com/pub/png/
|
||||
|
||||
- libtiff 3.4 or newer
|
||||
For TIFF image support.
|
||||
You can get it at ftp://ftp.sgi.com/graphics/tiff
|
||||
|
||||
- libjpeg 6.0.1
|
||||
- libjpeg 6.0.1 or newer
|
||||
For JPEG image support
|
||||
http://www.ijg.org/
|
||||
|
||||
- libgif 2.2 or libungif
|
||||
For GIF image support
|
||||
ftp://prtr-13.ucsc.edu/pub/libungif/
|
||||
|
||||
- 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.
|
||||
Get the GNU version from ftp://prep.ai.mit.edu
|
||||
Get the GNU version from ftp://ftp.gnu.org
|
||||
|
||||
Most of these can be get from ftp.uu.net/pub/graphics
|
||||
|
||||
|
||||
CONFIGURE OPTIONS:
|
||||
==================
|
||||
|
||||
These options can be passed to the configure script to enable/disable
|
||||
some WindowMaker features. Example:
|
||||
some Window Maker features. Example:
|
||||
|
||||
./configure --enable-kanji
|
||||
./configure --enable-kde --enable-gnome
|
||||
|
||||
will configure WindowMaker with kanji characters support compiled in.
|
||||
will configure Window Maker with KDE and GNOME supported compiled in.
|
||||
|
||||
|
||||
--disable-xpm disables use of the XPM library even if it is available on
|
||||
your system.
|
||||
To get a list of other options, run ./configure --help
|
||||
|
||||
--disable-png disables use of PNG library
|
||||
--with-libs-from
|
||||
specify additional paths for libraries to be searched.
|
||||
The -L flag must precede each path, like:
|
||||
--with-libs-from="-L/opt/libs -L/usr/local/lib"
|
||||
|
||||
--disable-tiff disable use of TIFF library
|
||||
--with-incs-from
|
||||
specify additional paths for header files to be searched.
|
||||
The -I flag must precede each paths, like:
|
||||
--with-incs-from="-I/opt/headers -I/usr/local/include"
|
||||
|
||||
--disable-gif disable use of GIF library
|
||||
--enable-single-icon
|
||||
enables the collapsing of all appicons of the WM_CLASS+WM_INSTANCE
|
||||
into a single one. This feature is not supported at all by the
|
||||
developers. If you have some trouble with it, contact it's author:
|
||||
Christopher Seawood <cls@seawood.org>
|
||||
|
||||
--disable-jpeg disable use of JPEG library
|
||||
--disable-shm
|
||||
disable use of the MIT shared memory extension. This will slow down
|
||||
texture generation a little bit, but in some cases it seems to be
|
||||
necessary due to a bug that manifests as messed icons and textures.
|
||||
|
||||
--disable-shape disables shaped windows (for oclock, xeyes etc.)
|
||||
--disable-motif
|
||||
disable support for mwm window manager hints
|
||||
|
||||
--enable-debug adds extra debugging information. Do not use it
|
||||
unless you're debugging WindowMaker.
|
||||
--enable-openlook
|
||||
enable support for OPEN LOOK(tm) window manager hints
|
||||
|
||||
--enable-kanji support to display Kanji characters, Korean, Chinese
|
||||
and other languagues that require special characters.
|
||||
--enable-gnome
|
||||
enable support for GNOME window manager hints
|
||||
|
||||
--enable-single-icon enables the collapsing of all appicons of the
|
||||
WM_CLASS+WM_INSTANCE into a single one. This feature is not
|
||||
supported at all by the developers. If you have some trouble with it,
|
||||
contact it's author: Christopher Seawood <cls@seawood.org>
|
||||
--enable-kde
|
||||
enable support for kde/kwm window manager hints
|
||||
|
||||
--enable-lite
|
||||
remove things that are already supported in desktop environments,
|
||||
like KDE and GNOME. Disabled things are: window list, root
|
||||
applications menu, multiple window selection. Note that you will not
|
||||
be able to exit Window Maker from itself anymore; you will have to
|
||||
use kill with the SIGTERM signal or exit it from KDE. It is not
|
||||
advisable to enable it.
|
||||
|
||||
--enable-modelock
|
||||
XKB language status lock support. If you don't know what it is you
|
||||
probably don't need it.
|
||||
|
||||
--enable-sound
|
||||
enable support of sound effects module
|
||||
|
||||
--disable-xpm
|
||||
disables use of the XPM library even if it is available on your
|
||||
system.
|
||||
|
||||
--disable-png
|
||||
disables use of PNG library
|
||||
|
||||
--disable-tiff
|
||||
disable use of TIFF library
|
||||
|
||||
--disable-gif
|
||||
disable use of GIF library
|
||||
|
||||
--disable-jpeg
|
||||
disable use of JPEG library
|
||||
|
||||
--disable-shape
|
||||
disables shaped windows (for oclock, xeyes etc.)
|
||||
|
||||
|
||||
PLATFORM SPECIFIC NOTES:
|
||||
========================
|
||||
|
||||
- DEC/Alpha machines
|
||||
|
||||
#>>>>>>>>>>>
|
||||
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
|
||||
|
||||
- SunOS, Solaris
|
||||
If you have gcc installed, after running configure, edit
|
||||
src/config.h and change the #define CPP_PATH line to
|
||||
#define CPP_PATH "gcc -E -x c"
|
||||
Sun's cpp lacks some features needed by WindowMaker and it can
|
||||
If you have gcc installed, run configure as:
|
||||
CPP_PATH="gcc -E -x c" ./configure
|
||||
Sun's cpp lacks some features needed by Window Maker and it can
|
||||
cause problems when parsing the config files.
|
||||
You also might need to use the --with-libs-from and --with-incs-from
|
||||
to supply the directory where libtiff is located.
|
||||
Someone mailed me that you also must make /usr/local/lib be the
|
||||
first path in LD_LIBRARY_PATH to make it work.
|
||||
|
||||
If you have a Ultra Creator 3D or some other machine with high-end
|
||||
graphics, be sure to start the X server with the default visual
|
||||
set to 24bpp or you might experience problems with mangled colors.
|
||||
This is a wmaker bug and will be fixed.
|
||||
|
||||
- GNU/Linux in general
|
||||
Make sure you have /usr/local/lib in /etc/ld.so.conf and that you
|
||||
run ldconfig after installing.
|
||||
Uninstall any packaged version of Window Maker before installing a new
|
||||
version.
|
||||
|
||||
- RedHat GNU/Linux
|
||||
RedHat systems have several annoying problems. If you use it,
|
||||
be sure to follow the steps below or Window Maker will not work:
|
||||
|
||||
* if you installed the Window Maker that comes with RedHat, uninstall
|
||||
it before upgrading;
|
||||
|
||||
* make sure you don't have the LANG and LINGUAS environment variables
|
||||
set to en_RN;
|
||||
|
||||
* make sure you have /usr/local/bin in your PATH environment
|
||||
variable;
|
||||
|
||||
* make sure you have /usr/local/lib in /etc/ld.so.conf before running
|
||||
ldconfig;
|
||||
|
||||
* if you have problems that mention an error message with --no-reexec
|
||||
uninstall libtool-1.2b and install libtool-1.3 instead. libtool-1.3
|
||||
can be found in ftp.gnu.org Also read the TROUBLESHOOTING section;
|
||||
|
||||
* if you installed the Window Maker package from RedHat and are
|
||||
installing a new version of it by hand (compiling yourself), uninstall
|
||||
the package from RedHat before.
|
||||
|
||||
* make sure you have a symbolic link from /usr/include/X11 to
|
||||
/usr/X11R6/include/X11 (if not, type ln -s /usr/X11R6/include/X11
|
||||
/usr/include/X11 )
|
||||
|
||||
* make sure you have /lib/cpp pointing to the cpp program
|
||||
|
||||
If you have any doubts in doing any of the stuff above, please
|
||||
don't hesitate to contact the RedHat user support. They will
|
||||
kindly answer to all your questions regarding their system.
|
||||
They also know much more about their own system than us
|
||||
(we don't use RedHat).
|
||||
|
||||
- RedHat Linux
|
||||
Make sure you don't have the LANG and LINGUAS environment variables
|
||||
set to en_RN. Also, make sure you have /usr/local/bin in your
|
||||
PATH environment variable, as for some mysterious reason the folks
|
||||
at RedHat did not include it in the default configuration files
|
||||
in RH 5.{0,1}.
|
||||
|
||||
- PowerPC MkLinux
|
||||
You will need to have the latest version of Xpmac. Older versions
|
||||
seem to have bugs that cause the system to hang.
|
||||
|
||||
- Debian Linux
|
||||
- Debian GNU/Linux
|
||||
If you want JPEG and TIFF support, make sure you have libtiff-dev
|
||||
and libjpeg-dev installed.
|
||||
|
||||
- SuSE GNU/Linux
|
||||
If you installed the Window Maker package from SuSE,
|
||||
uninstall it before trying to compile wmaker or you
|
||||
might have problems.
|
||||
|
||||
- MetroX (unknown version)
|
||||
MetroX has a bug that corrupts pixmaps that are set as window
|
||||
backgrounds. If you use MetroX and has weird problems with
|
||||
textures, do not use textures in titlebars. Or use a different
|
||||
X server.
|
||||
|
||||
|
||||
INSTALLATION:
|
||||
=============
|
||||
|
||||
Unpack WindowMaker-data.tar.gz and move the pixmaps directory in it
|
||||
to /usr/local/share/pixmaps
|
||||
Unpack WindowMaker-extra-<version-number>.tar.gz in /usr/local/share
|
||||
|
||||
You can get the file at ftp://ftp.windowmaker.org. This file is not strictly
|
||||
necessary, but contains some additional nice icons and other things.
|
||||
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.
|
||||
|
||||
|
||||
autoconf and automake
|
||||
---------------------
|
||||
|
||||
autoconf and automake are not required, but if you have them installed,
|
||||
make sure you have autoconf 2.12 and automake 1.3 or newer. If you have
|
||||
an older version, disable them by temporarily renaming them to something
|
||||
else or uninstalling them from your system.
|
||||
|
||||
|
||||
Build libPropList
|
||||
-----------------
|
||||
|
||||
Note: You only need to build libPropList if you don't have it installed
|
||||
in your system.
|
||||
|
||||
libPropList is included with the distribution, so you don't
|
||||
need to download it anywhere (some people have asked me this...)
|
||||
But if you already have libPropList installed on you system you
|
||||
can skip this step, since configure will detect that and use the
|
||||
installed version first if available.
|
||||
|
||||
To build libPropList, simply type the following at the shell prompt:
|
||||
|
||||
gunzip -c libPropList.tar.gz | tar xf -
|
||||
cd libPropList
|
||||
./configure
|
||||
make
|
||||
|
||||
then, login as root and type:
|
||||
|
||||
make install
|
||||
|
||||
|
||||
Build WindowMaker
|
||||
-----------------
|
||||
If this is the first time you're building WindowMaker, you can
|
||||
simply type:
|
||||
Build Window Maker
|
||||
------------------
|
||||
For a quick start, type the following in your shell prompt:
|
||||
|
||||
./configure
|
||||
make
|
||||
@@ -207,13 +353,15 @@ simply type:
|
||||
then, login as root and type:
|
||||
|
||||
make install
|
||||
ldconfig
|
||||
|
||||
or if you want to strip the binaries from debugging symbols and make them
|
||||
or if you want to strip the debugging symbols from the binaries and make them
|
||||
smaller, you can instead type:
|
||||
|
||||
make install-strip
|
||||
ldconfig
|
||||
|
||||
This will build and install WindowMaker with default parameters.
|
||||
This will build and install Window Maker with default parameters.
|
||||
|
||||
If you want to customize some compile-time options, you can do the
|
||||
following.
|
||||
@@ -225,55 +373,46 @@ following.
|
||||
|
||||
to get a complete listing of other options that are available.
|
||||
|
||||
Note that the WPrefs.app installation path is configured
|
||||
in a different way. Look at WPrefs/README for information.
|
||||
|
||||
2. Run configure with the options you want. For example, if you
|
||||
want to use the --enable-kanji option, type:
|
||||
want to use the --enable-kde option, type:
|
||||
|
||||
./configure --enable-kanji
|
||||
./configure --enable-kde
|
||||
|
||||
3. (optional) Edit src/wconfig.h with your favorite text editor
|
||||
and browse through it for some options you might want to change.
|
||||
|
||||
4. Compile WindowMaker. Just type:
|
||||
4. Compile. Just type:
|
||||
|
||||
make
|
||||
|
||||
5. Login as root (if you can't do that, read the "I don't have the
|
||||
root password :-(" section) and install WindowMaker in your system.
|
||||
Again, type:
|
||||
root password :-(" section) and install Window Maker in your system:
|
||||
su root
|
||||
make install
|
||||
|
||||
|
||||
User specific configuration
|
||||
---------------------------
|
||||
|
||||
These instructions do not need to be followed when upgrading WindowMaker
|
||||
These instructions do not need to be followed when upgrading Window Maker
|
||||
from an older version, unless stated differently in the NEWS file.
|
||||
|
||||
Every user on your system that wishes to run WindowMaker must do the
|
||||
Every user on your system that wishes to run Window Maker must do the
|
||||
following:
|
||||
|
||||
1. Install WindowMaker configuration files in your home directory.
|
||||
1. Install Window Maker configuration files in your home directory.
|
||||
Type:
|
||||
wmaker.inst
|
||||
|
||||
wmaker.inst will install WindowMaker configuration files and will
|
||||
setup X to automatically launch WindowMaker at startup.
|
||||
wmaker.inst will install Window Maker configuration files and will
|
||||
setup X to automatically launch Window Maker at startup.
|
||||
|
||||
That's it! The configuration file where you can edit your preferences
|
||||
is $HOME/GNUstep/Defaults/WindowMaker.
|
||||
The $HOME/GNUstep/Defaults/WMWindowAttributes file is where you assign
|
||||
icons to applications and edit some other attributes for windows. This can
|
||||
be also edited from the "Attributes Panel". To access it, click the titlebar
|
||||
of the window with the Right mouse button and select "Attributes...".
|
||||
That's it!
|
||||
|
||||
The $HOME/GNUstep/Library/WindowMaker/menu file is the definition of
|
||||
the root menu. Edit it according to the applications you have installed.
|
||||
You can type "man wmaker" to get some general help for configuration
|
||||
and other stuff.
|
||||
|
||||
Read the User Guide for a more in depth explanation of WindowMaker.
|
||||
The User Guide is avaiable at http://windowmaker.org
|
||||
Read the User Guide for a more in-depth explanation of Window Maker.
|
||||
|
||||
You might want to take a look at the FAQ too.
|
||||
|
||||
@@ -283,26 +422,29 @@ I don't have the root password :(
|
||||
|
||||
If you can't get superuser privileges (can't be root) you can install
|
||||
wmaker in your own home directory. For that, supply the --prefix option
|
||||
when running configure in step 2 of building WindowMaker . Example:
|
||||
when running configure in step 2 of building Window Maker. You will
|
||||
also need to supply the --with-appspath option, to specify the path for
|
||||
WPrefs.app Example:
|
||||
|
||||
./configure --prefix=/home/jshmoe
|
||||
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Apps
|
||||
|
||||
If you use national language support, you must also supply the --with-nlsdir
|
||||
option, as:
|
||||
|
||||
./configure --prefix=/home/jshmoe --with-nlsdir=/home/jshmoe/lib/locale
|
||||
|
||||
Then make /home/jshmoe/bin be included in your search path and run
|
||||
Then make /home/jshmoe/bin be included in your search PATH, add
|
||||
/home/jshmoe/lib to your LD_LIBRARY_PATH environment variable and run
|
||||
bin/wmaker.inst
|
||||
|
||||
Of course, /home/jshmoe is supposed to be replaced with your actual home
|
||||
directory path.
|
||||
|
||||
|
||||
|
||||
UPGRADING
|
||||
=========
|
||||
|
||||
If you are upgrading from an older version of WindowMaker:
|
||||
If you are upgrading from an older version of Window Maker:
|
||||
|
||||
1. Configure and build WindowMaker as always
|
||||
2. Install WindowMaker (but do not run wmaker.inst)
|
||||
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.
|
||||
|
||||
@@ -314,36 +456,41 @@ like not being able to use a graphic format library you think you have
|
||||
installed, look at the config.log file for clues of the problem.
|
||||
|
||||
|
||||
== When I try to start X after installing wmaker, I get this:
|
||||
exec: wmaker: not found
|
||||
== Error with loading fonts, even if they exist.
|
||||
|
||||
You probably are using a brain-damaged distribution. Add /usr/local/bin
|
||||
into your path environment variable (editing .cshrc or .profile)
|
||||
Try rebuilding without NLS support.
|
||||
|
||||
== Error during build of libPropList
|
||||
== Error when configuring
|
||||
|
||||
make: *** No rule to make target `libPropList.a.c', needed by
|
||||
`libPropList.a.o'. Stop.
|
||||
ltconfig: unrecognized option `--no-reexec'
|
||||
Try `ltconfig --help' for more information.
|
||||
configure: error: libtool configure failed
|
||||
|
||||
Make sure the autoconf and automake versions you have installed are at
|
||||
least:
|
||||
autoconf 2.12
|
||||
automake 1.3
|
||||
remove the --no-reexec option from aclocal.m4 and libPropList/aclocal.m4
|
||||
and reconfigure
|
||||
Also make sure the autoconf and automake versions you have installed are:
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
|
||||
If you are using the RPM's that come with RedHat 4.x, don't use them.
|
||||
It is broken. Uninstall the RPM and reinstall a fresh package from
|
||||
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.
|
||||
|
||||
You can get them from ftp://prep.ai.mit.edu or any mirror.
|
||||
|
||||
== configure doesn't detect libtiff, or other graphic libraries.
|
||||
|
||||
Delete config.cache, then rerun configure adding the following options to
|
||||
configure (among the other options you use):
|
||||
--with-gfx-libs="-L/usr/local/lib"
|
||||
--with-gfx-incs="-I/usr/local/include -I/usr/local/include/tiff"
|
||||
--with-libs-from="-L/usr/local/lib"
|
||||
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
|
||||
Put the paths where your graphic libs and their corresponding header files are
|
||||
located. You can put multiple paths in any of these options, as the example
|
||||
of --with-gfx-incs shows. Just put a space between them.
|
||||
of --with-incs-from shows. Just put a space between them.
|
||||
|
||||
|
||||
== configure doesn't detect libXpm.
|
||||
@@ -367,17 +514,21 @@ If you're not sure, try renaming ~/GNUstep to ~/GNUtmp and then run wmaker.inst
|
||||
|
||||
== The root menu contains only 2 entries. ("XTerm" and "Exit...")
|
||||
|
||||
* WindowMaker is not finding cpp (the C preprocessor). If your cpp is
|
||||
* Window Maker is not finding cpp (the C preprocessor). If your cpp is
|
||||
not located in /lib/cpp, edit src/config.h and correct the path in
|
||||
CPP_PATH.
|
||||
|
||||
== checking lex output file root... configure: error: cannot find output from true; giving up
|
||||
|
||||
* Read the REQUIREMENTS section of this file.
|
||||
|
||||
|
||||
LOCALES/INTERNATIONALIZATION
|
||||
============================
|
||||
|
||||
WindowMaker has national language support.
|
||||
To enable national language support, you must compile
|
||||
WindowMaker with some additional parameters.
|
||||
Window Maker has national language support. To enable national language
|
||||
support, you must compile Window Maker with some additional parameters.
|
||||
|
||||
|
||||
0 - You must have the GNU gettext package installed. It can be
|
||||
obtained at ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
|
||||
@@ -403,9 +554,10 @@ Read po/README if you wish to translate and maintain locale files
|
||||
for other languages.
|
||||
|
||||
2 - Additionally, if your language uses multi-byte characters, such
|
||||
as Japanese or Korean, you must supply the --enable-kanji flag to configure.
|
||||
as Japanese or Korean, you must set the MultiByteText option to YES
|
||||
in ~/GNUstep/Defaults/WMGLOBAL
|
||||
|
||||
3 - Configure, build and install WindowMaker normally.
|
||||
3 - Configure, build and install Window Maker normally.
|
||||
|
||||
4 - To select a particular locale at runtime you must set the LANG
|
||||
environment variable to the locale you want. For example, if you want to set
|
||||
@@ -422,7 +574,7 @@ in Bourne sh and similars
|
||||
Note: If you have the LC_CTYPE environment variable set, you must
|
||||
unset it before running wmaker.
|
||||
|
||||
For menu definition files, WindowMaker searches for them in the
|
||||
For menu definition files, Window Maker searches for them in the
|
||||
following order (for brazilian portuguese, in this case):
|
||||
|
||||
menu.pt_BR
|
||||
@@ -434,9 +586,9 @@ menu
|
||||
configure the fonts appropriately. Read the manual page for XCreateFontSet
|
||||
to have more details about it. You must change the ~/G/D/WindowMaker file
|
||||
for fonts used in titlebars, menus and other things. For fonts used in
|
||||
dialog windows, change ~/G/D/WMGLOBAL. Note that at the moment you can only
|
||||
supply a single font in WMGLOBAL. The %d in the font names must not be
|
||||
removed.
|
||||
dialog windows, change ~/G/D/WMGLOBAL. The %d in the font names must not be
|
||||
removed. You can also use the supplied wsetfont script for the task.
|
||||
Read the script itself for instructions.
|
||||
|
||||
For example, you can specify the following in ~/G/D/WindowMaker:
|
||||
|
||||
@@ -452,4 +604,8 @@ and in ~/G/D/WMGLOBAL:
|
||||
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
|
||||
The above 2 fonts are only used by applications that use WINGs (WindowMaker
|
||||
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.
|
||||
|
||||
566
INSTALL.pt
Normal file
566
INSTALL.pt
Normal file
@@ -0,0 +1,566 @@
|
||||
Instruções de Instalação do Window Maker
|
||||
|
||||
|
||||
PLATAFORMAS SUPORTADAS
|
||||
======================
|
||||
(obs: fiquei sabendo que conseguiram compilar nesses sistemas...)
|
||||
|
||||
- Intel GNU/Linux Slackware 3.5 (plataforma primária)
|
||||
- outras distribuições do Intel GNU/Linux
|
||||
- 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 em MacOS
|
||||
- Amiga 3000 rodando RedHat Linux 5.1 (Rawhide)
|
||||
|
||||
Patches que possibilitem a execução em outras plataformas serão bem-vindos.
|
||||
|
||||
Se a última versão não funcionou para você, tente a 0.53.0,
|
||||
que é conhecida por ser bastante estável em várias plataformas.
|
||||
|
||||
|
||||
REQUERIMENTOS
|
||||
=============
|
||||
|
||||
Os softwares a seguir são necessários para o uso do Window Maker:
|
||||
|
||||
- X11R6.x
|
||||
O Window Maker pode ser compilado em versões mais antigas do X, como X11R5
|
||||
(Solaris) ou X11R4 (OpenWindows) mas não funcionará 100% corretamente. Em
|
||||
tais servidores não existirão ícones de aplicações e você terá problemas
|
||||
usando o dock. Fazer upgrades das bibliotecas (Xlib Xt etc) ajudará se você
|
||||
não pode fazer upgrade do servidor.
|
||||
|
||||
Para compilar o Window Maker você precisará do seguinte:
|
||||
|
||||
- Requerimentos básicos e óbvios
|
||||
Se você vai compilar o Window Maker, tenha certeza de que você possui o gcc
|
||||
(ou outro compilador ANSI) e os arquivos headers do X. Especialmente para
|
||||
os iniciantes em Linux: você deve instalar todos os pacotes de desenvolvimento
|
||||
do X e a suite gcc. Do contrário você não será capaz de compilar nenhum
|
||||
programa X, incluindo o Window Maker.
|
||||
|
||||
- libPropList
|
||||
Você pode achar esta biblioteca em ftp://ftp.windowmaker.org/pub/libs ou
|
||||
ftp://ftp.gnome.org/pub/libPropList. Você deve instalar corretamente
|
||||
esta biblioteca antes de instalar o Window Maker.
|
||||
|
||||
- autoconf, automake and libtool
|
||||
Estes pacotes não são necessários, mas se você tiver um ou mais deles instalados,
|
||||
verifique se todos eles são das seguintes versões:
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
Se você possui uma versão diferente, desative-os mudando os nomes dos arquivos
|
||||
para outra coisa ou removendo-os do seu sistema. Se você não desenvolve
|
||||
software você não precisa deles, logo, você pode desinstalá-los com segurança.
|
||||
|
||||
- lex (ou flex) e yacc (ou bison)
|
||||
São usados pelo libPropList. O lex não seria necessário, já que o seu
|
||||
arquivo de saída é incluído, mas como ou eu ou o automake é um pouco
|
||||
burro, o script de configuração para o libPropList simplesmente
|
||||
abortará sem motivo caso o lex não seja achado.
|
||||
|
||||
|
||||
OPCIONAL:
|
||||
=========
|
||||
Estas bibliotecas não são necessárias para que o Window Maker funcione, mas elas
|
||||
são suportadas caso você deseje usá-las. Os números das versões são os que eu
|
||||
possuo (e portanto quase certamente funcionarão), mas outras versões devem funcionar
|
||||
também.
|
||||
|
||||
|
||||
- libXPM 4.7 ou mais atual
|
||||
Versões antigas podem não funcionar.
|
||||
Disponível em ftp://sunsite.unc.edu/pub/Linux/libs/X/
|
||||
Há suporte nativo para arquivos XPM, mas ele não carregará imagens em
|
||||
algumas formatos incomuns.
|
||||
|
||||
- libpng 0.96 ou mais atual e zlib
|
||||
Para suporte a imagens PNG.
|
||||
|
||||
- libtiff 3.4 ou mais atual
|
||||
Para suporte a imagens TIFF. Você pode baixar o libtiff em
|
||||
ftp://ftp.sgi.com/graphics/tiff.
|
||||
|
||||
- libjpeg 6.0.1 ou mais atual
|
||||
Para suporte a imagens JPEG.
|
||||
|
||||
- libgif 2.2 ou libungif
|
||||
Para suporte a imagens tipo GIF.
|
||||
|
||||
- GNU xgettext
|
||||
Se você deseja usar mensagens traduzidas, será necessário o GNU gettext. Outras
|
||||
versões do gettext não são compatíveis e não funcionarão. Baixe a versão
|
||||
GNU através do site ftp://ftp.gnu.org
|
||||
|
||||
A maioria dos pacotes citados pode ser encontrado em ftp.uu.net/pub/graphics
|
||||
|
||||
|
||||
|
||||
OPÇÕES DE CONFIGURAÇÃO
|
||||
======================
|
||||
|
||||
Estas opções podem ser passadas ao script de configuração para ativar/desativar algumas
|
||||
opções do Window Maker. Exemplo:
|
||||
|
||||
./configure --enable-kde --enable-gnome
|
||||
|
||||
irá configurar o Window Maker para que seja compilado com suporte ao KDE e GNOME.
|
||||
|
||||
|
||||
Para obter uma lista com outras opcoes, execute ./configure --help:
|
||||
|
||||
--with-libs-from
|
||||
Especifica diretórios (paths) adicionais onde se deve achar as bibliotecas.
|
||||
A flag -L deve preceder cada caminho, tal como:
|
||||
--with-libs-from="-L/opt/libs -L/usr/local/lib"
|
||||
|
||||
--with-incs-from
|
||||
Especifica diretórios adicionais para os arquivos de cabeçalho (header files)
|
||||
que serão procurados. A flag -l deve preceder cada caminho descrito, tal como:
|
||||
--with-incs-from="-I/opt/headers -I/usr/local/include"
|
||||
|
||||
--enable-single-icon
|
||||
Permite o agrupamento de todas as aplicações com a mesma WM_CLASS+WM_INSTANCE em
|
||||
uma só. Esta opção não é suportada por todos os desenvolvedores. Se você tiver algum
|
||||
problema com essa opção, escreva para o seu autor: Christopher Seawood
|
||||
<cls@seawood.org>
|
||||
|
||||
--disable-shm
|
||||
Desativa o uso da extensão de memória compartilhada do MIT. Isto reduzirá
|
||||
um pouco a geração de texturas, mas em alguns casos se mostrará necessário
|
||||
em virtude de um bug que se manifesta quando manipulam-se ícones e texturas.
|
||||
|
||||
--disable-motif
|
||||
Desativa compatibilidade com gerenciador de janelas mwm.
|
||||
|
||||
--enable-openlook
|
||||
Ativa compatibilidade com gerenciador de janelas OPEN LOOK(tm).
|
||||
|
||||
--enable-gnome
|
||||
Ativa compatibilidade com gerenciador de janelas GNOME.
|
||||
|
||||
--enable-kde
|
||||
Ativa compatibilidade com gerenciador de janelas kde/kwm.
|
||||
|
||||
--enable-lite
|
||||
Remove coisas que já são suportadas em ambientes desktops como o KDE
|
||||
e o GNOME. As opções desativadas são: lista de janelas (window list), menu de
|
||||
aplicações root (root applications menu), seleção múltipla de janelas
|
||||
(multiple window selection). Note que não será mais possível sair do Window
|
||||
Maker de dentro; você terá que usar o kill com o sinal SIGTERM ou sair do KDE.
|
||||
Não é aconselhado ativar essa opção.
|
||||
|
||||
--enable-modelock
|
||||
Suporte ao bloqueio de status de linguagem do XKB. Se você não sabe o que
|
||||
é isto, você provavelmente não precisa.
|
||||
|
||||
--enable-sound
|
||||
Ativa o suporte ao módulo de efeitos sonoros.
|
||||
|
||||
--disable-xpm
|
||||
Desativa o uso da biblioteca XPM mesmo se esta estiver disponível no seu sistema.
|
||||
|
||||
--disable-png
|
||||
Desativa o uso da biblioteca PNG
|
||||
|
||||
--disable-tiff
|
||||
Desativa o uso da biblioteca TIFF
|
||||
|
||||
--disable-gif
|
||||
Desativa o uso da biblioteca GIF
|
||||
|
||||
--disable-jpeg
|
||||
Desativa o uso da biblioteca JPEG
|
||||
|
||||
--disable-shape
|
||||
Desativa o uso das shaped windows (para oclock, xeyes etc.).
|
||||
|
||||
--enable-debug
|
||||
Não use esta opção a não ser que saiba realmente o que está fazendo
|
||||
|
||||
|
||||
|
||||
NOTAS ESPECÍFICAS PARA AS PLATAFORMAS
|
||||
=====================================
|
||||
|
||||
- máquinas DEC/Alpha
|
||||
Você provavelmente precisará usar a flag --disable-shm para configurar,
|
||||
como ./configure --disable-shm
|
||||
|
||||
- SCO Unix - execute o configure tal como
|
||||
CFLAGS="-belf -DANSICPP" ./configure
|
||||
|
||||
- SunOS, Solaris
|
||||
Se você possui o gcc instalado, execute o configure como abaixo:
|
||||
CPP_PATH="gcc -E -x c" ./configure
|
||||
O cpp da Sun não possui agumas funções necessárias ao Window Maker e pode
|
||||
causar problemas quando analisados os arquivos de configuração.
|
||||
Você pode ainda precisar usar --with-libs-from e --with-incs-from
|
||||
para fornecer o diretório onde a libtiff está localizada.
|
||||
Alguem me mandou um email dizendo que você precisará deixar o /usr/local/lib
|
||||
como primeiro caminho (path) no LD_LIBRARY_PATH para que funcione.
|
||||
|
||||
Se você tem uma Ultra Creator 3D ou outra máquina com gráficos high-end,
|
||||
certifique-se de iniciar o servidor X com o visual padrão definido em 24bpp
|
||||
ou você poderá ter problemas com cores desfiguaradas. Isto é um bug do
|
||||
wmaker e será consertado.
|
||||
|
||||
- GNU/Linux em geral
|
||||
Confira se você possui /etc/local/lib no /etc/ld.so.conf e rode ldconfig
|
||||
após a instalação.
|
||||
Remova qualquer versão em pacote do Window Maker antes de instalar uma versão
|
||||
mais atual.
|
||||
|
||||
- RedHat GNU/Linux
|
||||
Os sistemas RedHat apresentam vários incômodos. Se você usa, certifique-se
|
||||
de seguir os passos abaixo ou o Window Maker não funcionará:
|
||||
|
||||
* se você instalou o Window Maker que vem junto com o Red Hat, desinstale-o
|
||||
antes de instalar uma versão mais atual.
|
||||
|
||||
* certifique-se de que você não possui as variáveis de ambiente LANG e LINGUAS
|
||||
configuradas como en_RN;
|
||||
|
||||
* certifique-se de que você possui /usr/local/bin na variável PATH;
|
||||
|
||||
* certifique-se de que você tem /usr/local/lib no /etc/ld.conf.so antes de
|
||||
executar o ldconfig;
|
||||
|
||||
* se você tiver problemas que mencionem uma mensagem de erro com o
|
||||
--no-reexec, remova a libtool-1.2b e instale a libtool-1.3. A libtool-1.3
|
||||
pode ser encontrada em ftp.gnu.org. Também leia a seção TROUBLESHOOTING;
|
||||
|
||||
* se você instalou o pacote Window Maker do RedHat e está instalando uma
|
||||
nova versão na mão (você mesmo está compilando), remova o pacote Window
|
||||
Maker do seu sistema RedHat antes.
|
||||
|
||||
* certifique-se de que você possua o vínculo simbólico do /usr/include/X11
|
||||
ao /usr/X11R6/include/X11 (se não, digite ln -s /usr/X11R6/include/X11
|
||||
/usr/include/X11)
|
||||
|
||||
* certifique-se de que você tem o /lib/cpp apontando para o programa cpp.
|
||||
|
||||
Se você possui alguma dúvida quanto a realizar qualquer uma das tarefas acima,
|
||||
por favor não hesite em contatar o suporte ao usuário RedHat. Eles gentilmente
|
||||
irão responder a todas as suas dúvidas relacionadas ao sistema. Eles sabem
|
||||
muito mais sobre o sistema deles do que nós (nós não usamos RedHat).
|
||||
|
||||
- PowerPC MkLinux
|
||||
Você terá que possuir a última versão do Xpmac. Versões mais antigas
|
||||
parecem ter bugs que fazem com que o sistema trave.
|
||||
|
||||
- Debian GNU/Linux
|
||||
Se você deseja suporte a JPEG e TIFF, certifique-se que no seu sistema estão
|
||||
instaladas as bibliotecas libtiff-dev e libjpeg-dev.
|
||||
|
||||
- SuSE GNU/Linux
|
||||
Se você instalou o pacote Window Maker do SuSE, certifique-se de
|
||||
removê-lo do seu sistema antes de compilar o wmaker ou você poderá
|
||||
ter problemas.
|
||||
|
||||
- MetroX (versão desconhecida)
|
||||
O MetroX possui uma falha que corrompe os pixmaps que são definidos
|
||||
como backgrounds de janelas. Se você usa MetroX e está tendo problemas
|
||||
estranhos com texturas, não use texturas nas titlebars. Ou use
|
||||
um servidor X diferente.
|
||||
|
||||
INSTALAÇÃO:
|
||||
===========
|
||||
|
||||
Desempacote o WindowMaker-extra-<numero-da-versao>.tar.gz no /usr/local/share.
|
||||
|
||||
Você pode pegar o arquivo no site ftp://ftp.windowmaker.org. Este arquivo
|
||||
é opcional e possui alguns ícones e temas. Procure pelo último <número-da-versão>
|
||||
disponível.
|
||||
Ainda há o WindowMaker-extra.readme para instruí-lo sobre onde o pacote deve ir.
|
||||
|
||||
|
||||
Compilando o Window Maker
|
||||
-------------------------
|
||||
Se você quer fazer de modo rápido e simples, digite o seguinte no seu prompt:
|
||||
|
||||
./configure
|
||||
make
|
||||
|
||||
depois entre como root e digite:
|
||||
|
||||
make install
|
||||
ldconfig
|
||||
|
||||
ou se você quiser remover os símbolos de depuração dos seus binários para
|
||||
que eles se tornem menores, você pode digitar:
|
||||
|
||||
make install-strip
|
||||
ldconfig
|
||||
|
||||
Estes comandos irão compilar e instalar o Window Maker com parâmetros padrões.
|
||||
|
||||
Se você deseja configurar algumas opções de compilação, você pode fazer o seguinte:
|
||||
|
||||
1.(opcional) Olhe na seção OPÇÕES DE CONFIGURAÇÃO acima para ver as
|
||||
opções disponíveis. Execute também:
|
||||
|
||||
./configure --help
|
||||
|
||||
para obter uma lista completa das outras opções.
|
||||
|
||||
2. Rode o configure com as opções que você deseja. Por exemplo, se
|
||||
deseja usar a opção --enable-kde, você deve digitar:
|
||||
|
||||
./configure --enable-kde
|
||||
|
||||
3. (opcional) Edite o arquivo src/wconfig.h com seu editor de texto
|
||||
preferido e procure por alguma opção que deseja mudar
|
||||
|
||||
4. Compile. Só digite:
|
||||
|
||||
make
|
||||
|
||||
5. Entre como root (se você não pode fazer isso, leia a seção "Eu não tenho a
|
||||
senha de root") e instale o Window Maker no seu sistema:
|
||||
|
||||
su root
|
||||
make install
|
||||
|
||||
|
||||
Configurações Específicas
|
||||
-------------------------
|
||||
|
||||
Estas instruções não precisam ser seguidas quando for feito o upgrade do
|
||||
Window Maker em cima de uma versão antiga, a menos que o arquivo NEWS diga
|
||||
algo diferente.
|
||||
|
||||
Todo usuário no seu sistema que desejar rodar o Window Maker deverá fazer o seguinte:
|
||||
|
||||
1. Instalar os arquivos de configuração do Window Maker no diretório home.
|
||||
Digite:
|
||||
wmaker.inst
|
||||
|
||||
wmaker.inst vai instalar os arquivos de configuração do Window Maker e fazer
|
||||
com que o X rode o Window Maker quando executado.
|
||||
|
||||
É isso!
|
||||
|
||||
Você pode digitar "man wmaker" para ver uma ajuda geral sobre configuração
|
||||
e outras coisas.
|
||||
|
||||
Leia o Manual do Usuário para explicações mais profundas sobre o Window Maker.
|
||||
|
||||
Você deve dar uma olhada no FAQ também.
|
||||
|
||||
|
||||
|
||||
Eu não tenho a senha de root
|
||||
----------------------------
|
||||
|
||||
Se você não pode obter privilégios de super-usuário (não pode ser root) você
|
||||
pode instalar o wmaker no seu diretório home. Para isso, forneça a opção
|
||||
--prefix quando for rodar o configure, como explicado no passo 2 da seção
|
||||
Compilando o Window Maker.
|
||||
Você ainda precisará fornecer a opção --with-appspath, para especificar o
|
||||
caminho do WPrefs.app. Exemplo:
|
||||
|
||||
./configure --prefix=/home/jshmoe --with-appspath=/home/jshmoe/GNUstep/Apps
|
||||
|
||||
Depois faça com que /home/jshome/bin seja incluído na variável PATH, adicione
|
||||
/home/jshome/lib na variável de ambiente LD_LIBRARY_PATH e rode bin/wmaker.inst
|
||||
|
||||
É claro, substitua /home/jshome com o seu diretório home.
|
||||
|
||||
|
||||
UPGRADE
|
||||
=======
|
||||
|
||||
Se você está fazendo um upgrade de uma versão antiga do Window maker:
|
||||
|
||||
1. Configure e compile o Window Maker como sempre
|
||||
2. Instale o Window Maker (mas não rode o wmaker.inst)
|
||||
3. Leia o arquivo NEWS e atualize seus arquivos de configuração,
|
||||
se necessário.
|
||||
|
||||
TROUBLESHOOTING
|
||||
===============
|
||||
|
||||
Quando você tiver problemas na configuração (enquanto roda o configure),
|
||||
tal como não conseguir usar uma biblioteca de gráficos que você acha que tem
|
||||
instalada, olhe no arquivo config.log para obter dicas sobre o que pode estar
|
||||
errado.
|
||||
|
||||
== Erro ao carregar as fontes, mesmo quando elas existem
|
||||
|
||||
Tente reconstruir sem suporte NLS.
|
||||
|
||||
== Erro ao configurar
|
||||
|
||||
ltconfig: unrecognized option `--no-reexec'
|
||||
Try `ltconfig --help' for more information.
|
||||
configure: error: libtool configure failed
|
||||
|
||||
remova a opção --no-reexec do aclocal.m4 e da libPropList/aclocal.m4
|
||||
e reconfigure.
|
||||
Também verifique se as versões do autoconf e do automake que você tem
|
||||
instaladas são:
|
||||
autoconf 2.13
|
||||
automake 1.4
|
||||
libtool 1.3
|
||||
|
||||
Note que não deve ser libtool 1.2b, deve ser libtool 1.3.
|
||||
|
||||
== Não acha a proplist.h ou libPropList.algumacoisa
|
||||
|
||||
Baixe e instale a libPropList dos sites já citados neste arquivo.
|
||||
|
||||
== o configure não detecta a libtiff, ou outras bibliotecas gráficas.
|
||||
|
||||
Delete o config.cache, depois rode de novo o configure adicionando as
|
||||
seguintes opções ao configure (e as outras opções que você usa):
|
||||
--with-libs-from="-L/usr/local/lib"
|
||||
--with-incs-from="-I/usr/local/include -I/usr/local/include/tiff"
|
||||
Substitua o caminho para onde estão localizadas as suas bibliotecas gráficas
|
||||
e os correspondentes arquivos de cabeçalho. Você pode colocar caminhos múltiplos
|
||||
em qualquer uma dessas opções, como no exemplo do --with-incs-from. Só ponha um
|
||||
espaço entre eles.
|
||||
|
||||
== o configure não detecta libXpm.
|
||||
|
||||
* Confira se você possui um vínculo simbólico da libXpm.so.4.9 para libXpm.so
|
||||
|
||||
|
||||
== Segmentation fault na inicialização
|
||||
|
||||
* Confira se a versão da libXPM é a 4.7 ou mais atual
|
||||
|
||||
* Confira se você tem uma versão atualizada do ~/GNUstep/Defaults/WindowMaker
|
||||
|
||||
Se você não tem certeza, tente renomear ~/GNUstep para ~/GNUtmp e depois rode
|
||||
o wmaker.inst
|
||||
|
||||
== "...: your machine is misconfigured. gethostname() returned (none)"
|
||||
|
||||
* o hostname da sua máquina está definido incorretamente. Execute um man hostname
|
||||
para obter informações de como resolver isto.
|
||||
|
||||
== O menu do root possui só 2 entradas. ("XTerm" e "Exit...")
|
||||
|
||||
* O Window Maker não está achando o cpp (o pré-processador C). Se o seu cpp
|
||||
não está localizado em /lib/cpp, edite src/config.h e corrija o caminho
|
||||
no CPP_PATH.
|
||||
|
||||
== checking lex output file root... configure: error: cannot find output from
|
||||
true; giving up
|
||||
|
||||
* Leia a seção REQUERIMENTOS deste arquivo.
|
||||
|
||||
|
||||
LOCALES/INTERNACIONALIZAÇÃO
|
||||
===========================
|
||||
|
||||
o Window Maker tem suporte a linguagem nacional. Para ativar esse suporte,
|
||||
você precisa compilar o Window Maker com parâmetros adicionais.
|
||||
|
||||
0 - Você deve Ter o pacote do GNU gettext instalado. Este pode ser obtido
|
||||
pelo ftp://prep.ai.mit.edu/pub/gnu/gettext-nnn.tar.gz
|
||||
|
||||
Os passos 1,2 e 3 podem ser pulados se você usa o script Install.
|
||||
|
||||
1 - Você deve selecionar as linguagens que deseja suportar. Defina a LINGUAS
|
||||
para a lista dos locales que você deseja. O Inglês é sempre suportado. Exemplo:
|
||||
|
||||
setenv LINGUAS "pt ja de"
|
||||
na csh
|
||||
|
||||
ou
|
||||
|
||||
export LINGUAS;LINGUAS="pt ja de"
|
||||
na sh
|
||||
|
||||
A lista dos locales suportados pode ser achado no arquivo po/README.
|
||||
O inglês é a língua oficial.
|
||||
|
||||
Leia o arquivo po/README se você deseja traduzir e manter os arquivos
|
||||
locales para outras linguagens.
|
||||
|
||||
2 - Adicionalmente, se a sua linguagem usa caracteres multi-bytes, tais
|
||||
como as línguas japonesas e koreanas, você deve definir a opção MultiByteText
|
||||
para YES nos arquivos ~/GNUstep/Defaults/WMGLOBAL e ~/GNUstep/Defaults/WindowMaker
|
||||
|
||||
3 - Configure, compile e instale o Window Maker normalmente.
|
||||
|
||||
4 - Para selecionar um locale particular você deve definir a variável de
|
||||
ambiente LANG para o locale que você quer. Por exemplo, se você quer definir o
|
||||
locale português, você deve rodar
|
||||
|
||||
setenv LANG pt
|
||||
|
||||
na csh ou
|
||||
|
||||
export LANG; LANG=pt
|
||||
|
||||
nas Bourne sh e similares
|
||||
|
||||
Nota: Se você tem a variável de ambiente LC_CTYPE definida, você deve
|
||||
indefiní-la antes de rodar o wmaker.
|
||||
|
||||
O Window Maker procura os arquivos de definições de menu na seguinte
|
||||
ordem (para o português brasileiro, neste caso):
|
||||
|
||||
menu.pt_BR
|
||||
menu.pt
|
||||
menu
|
||||
|
||||
|
||||
5 - Se você escolheu uma linguagem que usa caracteres multi-bytes, você
|
||||
deve configurar as fontes adequadamente. Leia a página de manual para o
|
||||
XcreateFontSet para obter mais detalhes sobre isto. Você deve mudar o arquivo
|
||||
~/G/D/WindowMaker para as fontes usadas nas barras de título, menus e
|
||||
outras coisas. Para as fontes usadas nas janelas de diálogo, mude o arquivo
|
||||
~/G/D/WMGLOBAL. O %d no font names não deve ser removido. Você pode ainda usar
|
||||
o wsetfont script para esta tarefa. Leia o próprio script para maiores instruções.
|
||||
|
||||
Por exemplo, você pode especificar o seguinte no ~/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-*";
|
||||
|
||||
e no ~/G/D/WMGLOBAL:
|
||||
|
||||
SystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
BoldSystemFont = "-*-*-medium-r-normal-*-%d-*-*-*-*-*-*-*";
|
||||
|
||||
|
||||
As duas fontes acima são usadas somente por aplicações que
|
||||
usem WINGs (o Window Maker e WPrefs.app)
|
||||
|
||||
O script wsetfont que é fornecido vai permitir com que você mude as
|
||||
definições de fonte do modo mais fácil. Dê uma olhada no script para maiores
|
||||
detalhes sobre o uso.
|
||||
|
||||
|
||||
|
||||
Traduzido por Ricardo Sartori <sartori@inf.ufsc.br>
|
||||
200
Install
200
Install
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# WindowMaker configuration and compilation script.
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Alfredo K. Kojima
|
||||
# Copyright (c) 1997, 1998, 1999 Alfredo K. Kojima
|
||||
#
|
||||
|
||||
export LINGUAS;LINGUAS=""
|
||||
@@ -10,6 +10,7 @@ if test "$NLSDIR" = ""; then
|
||||
export NLSDIR;NLSDIR="/usr/lib/locale"
|
||||
fi
|
||||
|
||||
|
||||
OPTIONS=""
|
||||
PREFIX="/usr/local"
|
||||
|
||||
@@ -19,21 +20,83 @@ perai() {
|
||||
}
|
||||
|
||||
|
||||
perform() {
|
||||
if ! $* ; then
|
||||
echo
|
||||
echo "Window Maker installation failed or aborted by user."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
trap "echo Window Maker installation aborted. ; exit 1" 2 3
|
||||
|
||||
echo
|
||||
echo "========================"
|
||||
echo "WindowMaker Installation"
|
||||
echo "========================"
|
||||
echo "========================="
|
||||
echo "Window Maker Installation"
|
||||
echo "========================="
|
||||
echo
|
||||
echo "NOTE: If this script fails, read the INSTALL file and"
|
||||
echo "install by hand."
|
||||
echo
|
||||
echo "Please read the README, INSTALL and FAQ files before e-mailing "
|
||||
echo "questions. We will IGNORE any questions that are already"
|
||||
echo "answered in the documentation."
|
||||
echo
|
||||
perai
|
||||
echo
|
||||
echo "Did you install libPropList? If not, please install it now."
|
||||
echo
|
||||
perai
|
||||
echo "Did you read the INSTALL file?"
|
||||
echo -n "<y/n> "
|
||||
read rtfm
|
||||
if [ "$rtfm" != y ]; then
|
||||
echo "Please read the INSTALL file before installing"
|
||||
exit
|
||||
fi
|
||||
echo "Are you sure?"
|
||||
echo -n "<y/n> "
|
||||
read rtfm
|
||||
if [ "$rtfm" != y ]; then
|
||||
echo "Please read the INSTALL file before installing"
|
||||
exit
|
||||
fi
|
||||
echo "Are you lying?"
|
||||
echo -n "<y/n> "
|
||||
read rtfm
|
||||
if [ "$rtfm" != n ]; then
|
||||
echo "What a shame!"
|
||||
echo "Please read the INSTALL file before installing"
|
||||
exit
|
||||
fi
|
||||
echo "Do you *swear* that you really read the INSTALL file?"
|
||||
echo -n "<y/n> "
|
||||
read rtfm
|
||||
if [ "$rtfm" != y ]; then
|
||||
echo "Please read the INSTALL file before installing"
|
||||
exit
|
||||
fi
|
||||
echo "Last chance. You will not get help if you have some problem"
|
||||
echo "because you didn't read that file. Even if your computer explodes."
|
||||
echo "Do you *really* read it?"
|
||||
echo -n "<y/n> "
|
||||
read rtfm
|
||||
if [ "$rtfm" != y ]; then
|
||||
echo "Please read the INSTALL file before installing"
|
||||
exit
|
||||
fi
|
||||
echo
|
||||
echo "Ok, you have been warned."
|
||||
echo
|
||||
echo "NOTE: If the installation procedure fails, read the INSTALL file and do"
|
||||
echo "the installation manually."
|
||||
perai
|
||||
|
||||
|
||||
if test "$USER" != "root"; then
|
||||
echo "Warning: you must run this script as the root user."
|
||||
perai
|
||||
echo
|
||||
echo "Be sure to specify an installation path where you have"
|
||||
echo "write persmission."
|
||||
echo "Warning: you must run this script as root to install"
|
||||
echo "Window Maker. Hit <Control>-<C> to quit this script."
|
||||
perai
|
||||
echo
|
||||
fi
|
||||
|
||||
@@ -42,17 +105,31 @@ echo
|
||||
echo "Option Selection"
|
||||
echo "================"
|
||||
|
||||
######################## Sound
|
||||
|
||||
######################## KDE
|
||||
echo
|
||||
echo "Do you want sound support? Note that you need a module distributed"
|
||||
echo "separately to make it work. You can get it at:"
|
||||
echo "http://www.frontiernet.net/~southgat/wmsound"
|
||||
echo -n "<y/n> [y] "
|
||||
read SFX
|
||||
echo "Do you want KDE support?"
|
||||
echo -n "<y/n> [n] "
|
||||
read kde
|
||||
if [ "$kde" = y -o "$kde" = Y ]; then
|
||||
OPTIONS="$OPTIONS --enable-kde"
|
||||
fi
|
||||
|
||||
if [ "x$SFX" = "x" -o "$SFX" = "y" -o "$SFX" = "Y" ]; then
|
||||
OPTIONS="$OPTIONS --enable-sound"
|
||||
######################## GNOME
|
||||
echo
|
||||
echo "Do you want GNOME support?"
|
||||
echo -n "<y/n> [n] "
|
||||
read gnome
|
||||
if [ "$gnome" = y -o "$gnome" = Y ]; then
|
||||
OPTIONS="$OPTIONS --enable-gnome"
|
||||
fi
|
||||
|
||||
######################## OLWM
|
||||
echo
|
||||
echo "Do you want OPEN LOOK(tm)/olwm support?"
|
||||
echo -n "<y/n> [n] "
|
||||
read olwm
|
||||
if [ "$olwm" = y -o "$olwm" = Y ]; then
|
||||
OPTIONS="$OPTIONS --enable-openlook"
|
||||
fi
|
||||
|
||||
######################## NLS
|
||||
@@ -73,10 +150,10 @@ if [ "$NLS" = "y" -o "$NLS" = "Y" ]; then
|
||||
ALL_LINGUAS="$ALL_LINGUAS $lcode"
|
||||
echo "$lcode $lname"
|
||||
done
|
||||
echo "Type in the locales you want [$ALL_LINGUAS]"
|
||||
echo "Type in the locales you want (all will install everything) [none]"
|
||||
read foo
|
||||
if test "x$foo" = "x"; then
|
||||
LINGUAS=$ALL_LINGUAS
|
||||
if test "$foo" = "all"; then
|
||||
LINGUAS="$ALL_LINGUAS"
|
||||
else
|
||||
LINGUAS="$foo"
|
||||
fi
|
||||
@@ -98,16 +175,6 @@ if [ "$NLS" = "y" -o "$NLS" = "Y" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "$MB" = "" -a "$i" = "ja" -o "$i" = "kr" ]; then
|
||||
echo
|
||||
echo "A language you selected needs multi-byte character support"
|
||||
echo "Do you want to enable it?"
|
||||
echo -n "<y/n> [n] "
|
||||
read MB
|
||||
if [ "$MB" = "y" -o "$MB" = "Y" ]; then
|
||||
OPTIONS="$OPTIONS --enable-kanji"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo
|
||||
echo "Where do you want to put the message files? [$NLSDIR]"
|
||||
@@ -122,17 +189,18 @@ fi
|
||||
done=0
|
||||
while [ $done = 0 ]; do
|
||||
echo
|
||||
echo "Where do you want to install WindowMaker? [$PREFIX]"
|
||||
echo "Where do you want to install Window Maker? [$PREFIX]"
|
||||
echo "Don't change it if you don't know what you're doing."
|
||||
echo "(The default path will install WindowMaker in "
|
||||
echo "$PREFIX/bin, $PREFIX/lib etc.)"
|
||||
if test "$USER" != "root"; then
|
||||
echo "Make sure to specify a path where you have write permission."
|
||||
fi
|
||||
echo "(The default will put Window Maker in $PREFIX/bin, $PREFIX/lib etc.)"
|
||||
echo -n "? "
|
||||
read foo
|
||||
|
||||
if test "x$foo" != "x"; then
|
||||
if [ "$foo" = "y" -o "$foo" = "n" ]; then
|
||||
echo
|
||||
echo "Hmm... I don't think you really want to install WindowMaker into \"$foo\""
|
||||
echo "Hmm... I don't think you really want to install Window Maker into \"$foo\""
|
||||
echo
|
||||
else
|
||||
done=1
|
||||
@@ -142,60 +210,52 @@ while [ $done = 0 ]; do
|
||||
done=1
|
||||
fi
|
||||
echo
|
||||
echo "$PREFIX/bin must be in the PATH environment variable of all users who use WindowMaker"
|
||||
echo " $PREFIX/bin must be in the PATH environment variable"
|
||||
echo "of all users who will use Window Maker"
|
||||
perai
|
||||
done
|
||||
|
||||
OPTIONS="$OPTIONS --prefix=$PREFIX"
|
||||
|
||||
|
||||
###################### Build libPropList
|
||||
|
||||
if [ ! -d libPropList ]; then
|
||||
gzip -d -c libPropList.tar.gz | tar xf -
|
||||
fi
|
||||
|
||||
echo "-----------------------"
|
||||
echo "Building libPropList..."
|
||||
echo "-----------------------"
|
||||
cd libPropList
|
||||
if [ ! -f config.status ]; then
|
||||
./configure
|
||||
fi
|
||||
make
|
||||
cd ..
|
||||
|
||||
if [ ! -f libPropList/libPropList.a ]; then
|
||||
echo "Build of libPropList was not successfull. "
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
##################### Configure
|
||||
echo "--------------------------"
|
||||
echo "Configuring WindowMaker..."
|
||||
echo "Configuring Window Maker..."
|
||||
echo "--------------------------"
|
||||
if [ `uname -s` = "SCO_SV" ]; then
|
||||
echo "CFLAGS=\"$CFLAGS -belf -DANSICPP\" ./configure $OPTIONS"
|
||||
CFLAGS="$CFLAGS -belf -DANSICPP" ./configure $OPTIONS
|
||||
|
||||
CFLAGS="$CFLAGS -belf -DANSICPP"
|
||||
|
||||
perform ./configure $OPTIONS
|
||||
else
|
||||
echo "CFLAGS=\"$CFLAGS $GCCFLAGS\" ./configure $OPTIONS"
|
||||
CFLAGS="$CFLAGS $GCCFLAGS" ./configure $OPTIONS
|
||||
|
||||
CFLAGS="$CFLAGS $GCCFLAGS"
|
||||
|
||||
perform ./configure $OPTIONS
|
||||
fi
|
||||
|
||||
|
||||
#################### Compile
|
||||
echo "------------------------"
|
||||
echo "Compiling WindowMaker..."
|
||||
echo "------------------------"
|
||||
(cd src; make clean)
|
||||
make
|
||||
|
||||
echo "-------------------------"
|
||||
echo "Installing WindowMaker..."
|
||||
echo "Compiling Window Maker..."
|
||||
echo "-------------------------"
|
||||
(cd src; perform make clean)
|
||||
perform make
|
||||
|
||||
make install
|
||||
echo "--------------------------"
|
||||
echo "Installing Window Maker..."
|
||||
echo "--------------------------"
|
||||
|
||||
perform make install
|
||||
|
||||
if [ `uname -s` = "Linux" ]; then
|
||||
echo
|
||||
echo " Make sure $PREFIX/lib is in the /etc/ld.so.conf file"
|
||||
/sbin/ldconfig
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Installation Finished!"
|
||||
|
||||
48
MIRRORS
48
MIRRORS
@@ -1,6 +1,6 @@
|
||||
|
||||
WindowMaker FTP Mirror Sites
|
||||
============================
|
||||
Window Maker FTP Mirror Sites
|
||||
=======-=====================
|
||||
|
||||
Official Site (USA):
|
||||
--------------------
|
||||
@@ -37,12 +37,27 @@ ftp://ftp.cybertrails.com/pub/windowmaker/
|
||||
Contact: Adam Jacob <adam@cybertrails.com>
|
||||
|
||||
|
||||
Provider: Ameth Technologies
|
||||
http://www.ameth.org/windowmaker/
|
||||
ftp://ftp.ameth.org/pub/mirrors/ftp.windowmaker.org/
|
||||
Contact: Chase Phillips <shepard@ameth.org>
|
||||
|
||||
Third Party WindowMaker Distribution Packages
|
||||
=============================================
|
||||
|
||||
RedHat/RPM
|
||||
----------
|
||||
Third Party Window Maker Distribution Packages
|
||||
==============================================
|
||||
|
||||
Debian GNU/Linux (deb)
|
||||
----------------------
|
||||
|
||||
Contact: Marcelo Magallon <mmagallo@efis.ucr.ac.cr>
|
||||
Sites:
|
||||
http://master.debian.org/~mmagallo/packages/wmaker/
|
||||
|
||||
|
||||
RedHat GNU/Linux (RPM)
|
||||
----------------------
|
||||
|
||||
For Intel:
|
||||
|
||||
Contact: Jim Knoble <jmknoble@pobox.com>
|
||||
Sites:
|
||||
@@ -50,5 +65,26 @@ ftp://ftp.windowmaker.org/pub/beta/compiled/linux/rpms/
|
||||
ftp://ftp.redhat.com/pub/contrib/SRPMS/
|
||||
ftp://ftp.redhat.com/pub/contrib/i386/
|
||||
|
||||
For Alpha:
|
||||
|
||||
Contact: Peter Petrakis <peterpan@wn.net>
|
||||
Site:
|
||||
http://math.stcc.mass.edu/petrakis/downloads/X11
|
||||
|
||||
|
||||
HP-UX
|
||||
-----
|
||||
|
||||
Sites:
|
||||
UK: http://hpux.csc.liv.ac.uk/
|
||||
Germany: http://hpux.ask.uni-karlsruhe.de/
|
||||
US (WI): http://hpux.cae.wisc.edu/
|
||||
France: http://hpux.cict.fr/
|
||||
Netherlands: http://hpux.tn.tudelft.nl/
|
||||
Canada: http://hpux.ee.ualberta.ca/
|
||||
Italy: http://hpux.dsi.unimi.it/
|
||||
South Africa: http://hpux.petech.ac.za/
|
||||
Japan: http://hpux.u-aizu.ac.jp/
|
||||
US (UT): http://hpux.cs.utah.edu/
|
||||
|
||||
|
||||
|
||||
28
Makefile.am
28
Makefile.am
@@ -1,14 +1,26 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
SUBDIRS = wrlib WINGs src util po WindowMaker wmlib test WPrefs.app doc
|
||||
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
|
||||
# libwmfun-0.0.3.tar.gz
|
||||
|
||||
EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N MIRRORS Install acconfig.h\
|
||||
libPropList.tar.gz mkpatch
|
||||
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
|
||||
|
||||
libPropList.tar.gz:
|
||||
-(cd libPropList; $(MAKE) distclean)
|
||||
-rm -f libPropList.tar.gz
|
||||
tar cf libPropList.tar libPropList
|
||||
gzip -9 libPropList.tar
|
||||
#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`
|
||||
|
||||
|
||||
322
Makefile.in
322
Makefile.in
@@ -1,322 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = .
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP_PATH = @CPP_PATH@
|
||||
DFLAGS = @DFLAGS@
|
||||
GFXFLAGS = @GFXFLAGS@
|
||||
GFXLIBS = @GFXLIBS@
|
||||
I18N = @I18N@
|
||||
I18N_MB = @I18N_MB@
|
||||
ICONEXT = @ICONEXT@
|
||||
INTLIBS = @INTLIBS@
|
||||
LIBPL_INC_PATH = @LIBPL_INC_PATH@
|
||||
LIBPL_LIBS = @LIBPL_LIBS@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MOFILES = @MOFILES@
|
||||
NLSDIR = @NLSDIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
REDUCE_APPICONS = @REDUCE_APPICONS@
|
||||
SHAPE = @SHAPE@
|
||||
SOUND = @SOUND@
|
||||
VERSION = @VERSION@
|
||||
WPMOFILES = @WPMOFILES@
|
||||
XCFLAGS = @XCFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XLFLAGS = @XLFLAGS@
|
||||
XLIBS = @XLIBS@
|
||||
XSHM = @XSHM@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LOCALE = @X_LOCALE@
|
||||
pixmapdir = @pixmapdir@
|
||||
wprefsdir = @wprefsdir@
|
||||
|
||||
SUBDIRS = wrlib WINGs src util po WindowMaker wmlib test WPrefs.app doc
|
||||
|
||||
EXTRA_DIST = TODO BUGS BUGFORM FAQ FAQ.I18N MIRRORS Install acconfig.h\
|
||||
libPropList.tar.gz mkpatch
|
||||
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 aclocal.m4 config.guess config.sub configure \
|
||||
configure.in install-sh missing mkinstalldirs
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
all: all-recursive all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL)
|
||||
|
||||
config.status: $(srcdir)/configure
|
||||
$(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; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
(cd $$subdir && $(MAKE) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$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) $(TAR) zxf $(distdir).tar.gz
|
||||
mkdir $(distdir)/=build
|
||||
mkdir $(distdir)/=inst
|
||||
dc_install_base=`cd $(distdir)/=inst && pwd`; \
|
||||
cd $(distdir)/=build \
|
||||
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
|
||||
&& $(MAKE) \
|
||||
&& $(MAKE) dvi \
|
||||
&& $(MAKE) check \
|
||||
&& $(MAKE) install \
|
||||
&& $(MAKE) installcheck \
|
||||
&& $(MAKE) dist
|
||||
-rm -rf $(distdir)
|
||||
@echo "========================"; \
|
||||
echo "$(distdir).tar.gz is ready for distribution"; \
|
||||
echo "========================"
|
||||
dist: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
dist-all: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
GZIP=$(GZIP) $(TAR) chozf $(distdir).tar.gz $(distdir)
|
||||
-rm -rf $(distdir)
|
||||
distdir: $(DISTFILES)
|
||||
-rm -rf $(distdir)
|
||||
mkdir $(distdir)
|
||||
-chmod 777 $(distdir)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
info: info-recursive
|
||||
dvi: dvi-recursive
|
||||
check: all-am
|
||||
$(MAKE) check-recursive
|
||||
installcheck: installcheck-recursive
|
||||
all-am: Makefile
|
||||
|
||||
install-exec: install-exec-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-tags mostlyclean-generic
|
||||
|
||||
clean-am: clean-tags clean-generic mostlyclean-am
|
||||
|
||||
distclean-am: distclean-tags distclean-generic clean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
|
||||
distclean-am
|
||||
|
||||
mostlyclean: mostlyclean-recursive mostlyclean-am
|
||||
|
||||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-rm -f config.status
|
||||
|
||||
.PHONY: install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck all-am install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
libPropList.tar.gz:
|
||||
-(cd libPropList; $(MAKE) distclean)
|
||||
-rm -f libPropList.tar.gz
|
||||
tar cf libPropList.tar libPropList
|
||||
gzip -9 libPropList.tar
|
||||
|
||||
# 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:
|
||||
844
NEWS
844
NEWS
@@ -1,13 +1,853 @@
|
||||
|
||||
NEWS for veteran WindowMaker users
|
||||
NEWS for veteran Window Maker users
|
||||
-----------------------------------
|
||||
|
||||
--- 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
|
||||
|
||||
|
||||
Optimizations!!
|
||||
---------------
|
||||
|
||||
Code for converting wrlib images into X Pixmaps was optimized in many ways,
|
||||
both in the original C code and in assembly for Pentium(tm) processors (with
|
||||
and without MMX(tm)). Depending on the bit depth/color mode and CPU model,
|
||||
performance increases can go up to 150%
|
||||
|
||||
|
||||
Weendoze Window Cycling (alt-tab)
|
||||
---------------------------------
|
||||
|
||||
Window cycling was changed to weendoze style.
|
||||
|
||||
|
||||
NoBorder Window Attribute
|
||||
--------------------------
|
||||
|
||||
The NoBorder window attribute (to be put in
|
||||
~/GNUstep/Defaults/WindowAttributes) was added and will remove the
|
||||
1 pixel border around windows.
|
||||
|
||||
|
||||
Removed "Keep Attracted Icons" option from Clip's menu
|
||||
------------------------------------------------------
|
||||
|
||||
Since this option brought more confusion than usefulness among users, and
|
||||
since it was usable only in a very limited context, being able to fill up
|
||||
the Clip very easily, it was removed.
|
||||
An alternative way of gaining the same functionality is to use the "Keep icon"
|
||||
entry in the Clip's main menu. Or select multiple icons before calling that
|
||||
entry, to make it apply to more than one icon.
|
||||
|
||||
Note: "Keep icon", as the obsoleted "Keep Attracted Icons" had nothing to do
|
||||
with holding icons in Clip, while the application is running. Once they
|
||||
are attracted, they are kept until the application close. Using
|
||||
"Keep icon", will only assure that the icon will be kept, even after the
|
||||
application is closed.
|
||||
|
||||
Please don't ask for this option back. It's error prone, and very unintuitive.
|
||||
Considering it's very restrictive usability, and it's very ambiguous topic, it
|
||||
does not need a special entry in the Clip's menu, taking in count that there
|
||||
are already better alternative ways of gaining the same functionality.
|
||||
|
||||
|
||||
Removed DisplayFont Option
|
||||
---------------------------
|
||||
|
||||
The font for the geometry size will be controlled by the default
|
||||
WINGs font (SystemFont in WMGLOBAL) now.
|
||||
|
||||
|
||||
Others
|
||||
------
|
||||
|
||||
- added DONT_SCALE_ICONS compile time option
|
||||
- added --dont-restore cmd line option. When passed to wmaker, it
|
||||
wont restore the state saved previously.
|
||||
|
||||
--- 0.61.1
|
||||
|
||||
New libPropList
|
||||
---------------
|
||||
|
||||
new libPropList-0.9.1 is REQUIRED to build Window Maker 0.61.1.
|
||||
go grab it and install it first.
|
||||
|
||||
|
||||
--- 0.60.1
|
||||
|
||||
|
||||
Window Edge Attraction
|
||||
----------------------
|
||||
|
||||
Window edge attraction was now added.
|
||||
|
||||
Attraction = YES/NO;
|
||||
|
||||
will enable/disable gravity to edge's boder.
|
||||
The strength of gravity can be controled by modify `EdgeResistance' value
|
||||
in WindowMaker configuration file.
|
||||
|
||||
|
||||
Titlebar Draw String Plugin
|
||||
---------------------------
|
||||
|
||||
FTitleColor, UTitleColor, PTitleColor, MenuTitleColor can be assigend with
|
||||
drawstring plugin instead of plain color. For example:
|
||||
|
||||
FTitleColor = (
|
||||
function,
|
||||
libwmfun.so,
|
||||
drawPlainString,
|
||||
gold,
|
||||
black,
|
||||
gray49
|
||||
);
|
||||
|
||||
will invoke function drawplainstring from libwmfun.so and pass 3 colors for
|
||||
arguments. To code new plugin, please see plugin.h for more informations.
|
||||
|
||||
|
||||
--- 0.60.0
|
||||
|
||||
|
||||
User Menu
|
||||
---------
|
||||
|
||||
The user menu is now a compile time option disabled by default.
|
||||
Supply --enable-usermenu to configure to enable it.
|
||||
|
||||
|
||||
root menu INCOMPATIBLE changes
|
||||
------------------------------
|
||||
|
||||
EXEC <program> will execute the named program
|
||||
|
||||
SHEXEC <command> will execute the shell command.
|
||||
|
||||
If you want to execute something like blabla > /dev/null, then use SHEXEC
|
||||
|
||||
Dont forget to update your menus.
|
||||
|
||||
|
||||
New Option For setstyle
|
||||
-----------------------
|
||||
|
||||
The --ignore flag will tell setstyle to not change the option that is
|
||||
specified, when modifying the Window Maker configurations. For example:
|
||||
|
||||
setstyle --ignore MenuStyle sometheme.themed will cause the MenuStyle
|
||||
option to not be changed.
|
||||
|
||||
setstyle --ignore FTitleBack --ignore UTitleBack --ignore PTitleBack bla.themed
|
||||
will load the theme, but keep the titlebar background related options as
|
||||
before.
|
||||
|
||||
|
||||
MultiByte Text Support Changes
|
||||
------------------------------
|
||||
|
||||
The --enable-kanji configure option is not needed anymore and was removed.
|
||||
To enable support for multibyte text, you must:
|
||||
- set the LANG environment variable to the appropriate value
|
||||
- change the font configurations to contain font sets in the appropriate
|
||||
encodings in both ~/G/D/WindowMaker and ~/G/D/WMGLOBAL (for WPrefs)
|
||||
- set the MultiByteText option to YES in both of the above files
|
||||
|
||||
|
||||
New Options
|
||||
-----------
|
||||
|
||||
WorkspaceNameDisplayPosition =
|
||||
none/center/top/bottom/topleft/topright/bottomleft/bottomright
|
||||
|
||||
|
||||
SmoothWorkspaceBack = YES/NO
|
||||
|
||||
will enable smoothing of scaled workspace background images.
|
||||
|
||||
|
||||
|
||||
Application User Menu Path Changes
|
||||
----------------------------------
|
||||
|
||||
Default configuration for user specific menus installed in
|
||||
/usr/local/share/WindowMaker/UserMenus or $(datadir)/WindowMaker/UserMenus
|
||||
and ~/GNUstep/Library/WindowMaker/UserMenus.
|
||||
|
||||
|
||||
Omnipresent icons in Clip
|
||||
-------------------------
|
||||
|
||||
Added ability to set icons docked in Clip to be omnipresent on all workspaces.
|
||||
To set/reset this flag use the clip menu.
|
||||
The Clip menu changed in the following way:
|
||||
- if you bring up the menu from the Clip's main icon, it will contain as
|
||||
before the "Rename Workspace" entry in the second position.
|
||||
- however, if you bring up the menu from any other icon in clip, the
|
||||
"Rename Workspace" menu entry is replaced by "Omnipresent" or
|
||||
"Toggle Omnipresent" depending on the context.
|
||||
|
||||
This entry will work in the following way, depending on the context:
|
||||
|
||||
1. If there is no icon selected in the clip, then the menu will contain the
|
||||
entry named "Omnipresent" which will be checked accordingly to the current
|
||||
state of the icon (omnipresent or not), and will let you change the
|
||||
omnipresent state of the icon you brought the menu from.
|
||||
2. If one or more icons are already selected when the Clip menu is called, the
|
||||
entry will be named "Toggle Omnipresent" and will apply to all selected
|
||||
icons trying to toggle their omnipresent state. The icons which will be
|
||||
succesfully changed to their new state as requested, will be unselected,
|
||||
while the ones that will fail for some reason to gain their new state,
|
||||
will remain selected.
|
||||
|
||||
In both cases if there is no success in setting what user requested a panel
|
||||
will inform user of the failure.
|
||||
(Note: trying to set an icon to not-omnipresent will never fail. Failures can
|
||||
be met only when trying to set omnipresent for an icon).
|
||||
|
||||
The icons set to omnipresent will be marked with a triangle in the upper left
|
||||
corner, having the color of the IconTitleColor.
|
||||
|
||||
An icon can be set to omnipresent, only if its position is free in all the
|
||||
workspaces, else you will be informed of the problem and asked to fix it first.
|
||||
Also when dragging an omnipresent icon around in Clip, all the icons docked in
|
||||
all the workspaces are shown while the dragging is done, to let one easily see
|
||||
where are free slots in all workspaces.
|
||||
|
||||
For advanced users, there is also a shortcut to set/reset the omnipresent
|
||||
state of an icon: just use "Shift+MiddleButton" (button2) on the icon you want
|
||||
to change.
|
||||
In this case only the mark in the upper left corner will appear in case of
|
||||
success, or nothing will happen if icon cannot be made omnipresent (advanced
|
||||
users are expected to know why the icon failed to be made omnipresent, so they
|
||||
don't need a panel to explain them why ;) ).
|
||||
|
||||
Now before you load your gun to start a flame war because this is against your
|
||||
principles you love so much, please sit down and think that this is a feature,
|
||||
which, if you don't use, the old behaviour of the Clip is totally preserved.
|
||||
It just adds some extra capabilities to the Clip for people who think that this
|
||||
is useful.
|
||||
|
||||
|
||||
XDND drop on dock support
|
||||
-------------------------
|
||||
|
||||
Support for XDE on dock is now replaced by XDND.
|
||||
To enable, edit src/wconfig.h
|
||||
|
||||
|
||||
|
||||
--- 0.53.0
|
||||
|
||||
New Options
|
||||
-----------
|
||||
|
||||
** MenuStyle
|
||||
|
||||
MenuStyle=<style>; will change the menu texture style.
|
||||
|
||||
<style> can be:
|
||||
normal (default): for the traditional one texture per item, with bevels in
|
||||
each
|
||||
|
||||
singleTexture: for a single texture that spans the whole menu, with bevels
|
||||
in each item
|
||||
|
||||
flat: singleTexture without the bevels
|
||||
|
||||
|
||||
** ResizebarBack
|
||||
|
||||
ResizebarBack=<texture>;
|
||||
|
||||
where <texture> is any of the textures you normally use in titlebars and
|
||||
other places.
|
||||
|
||||
If the style file/theme does not contain a ResizebarBack option, setstyle
|
||||
will automatically hack it so that wmaker will make the theme work like
|
||||
before.
|
||||
|
||||
|
||||
New crash dialog panel
|
||||
----------------------
|
||||
|
||||
From now on, whenever a fatal situation appears, Window Maker will display a
|
||||
dialog panel to the user and let him choose what to do.
|
||||
The options are:
|
||||
- Abort and leave a core file (usefull for debugging and getting backtraces)
|
||||
- Restart Window Maker (default behaviour)
|
||||
- Start alternate window manager (the one defined as fallback, or if not
|
||||
possible fvwm or twm in this order).
|
||||
|
||||
If it will not be able to restart or start the alternate window manager, it
|
||||
will abort and leave the core file.
|
||||
|
||||
|
||||
Application User Menu
|
||||
---------------------
|
||||
|
||||
Applications with an appicon can have a user defined menu.
|
||||
|
||||
This menu will emulate keyboard events, and will be sent to the applications'
|
||||
window(s), thus the application must accept key combinations (CTRL+N for
|
||||
instance).
|
||||
|
||||
To enable this feature, #define USER_MENU in src/wconfig.h and place menu
|
||||
files in ~/GNUstep/Defaults/UserMenus (/usr/local/etc/WindowMaker/UserMenus
|
||||
globally).
|
||||
|
||||
The user menu is in PropList format and the filename is in:
|
||||
<instance name>.<class name>.menu or application's main window.
|
||||
(Example: the menu for xcalc would be - xcalc.XCalc.menu)
|
||||
|
||||
Example user menu syntax:
|
||||
|
||||
(
|
||||
"Calculator",
|
||||
("Put 1", SHORTCUT, "2"),
|
||||
("Functions",
|
||||
("Put 2", SHORTCUT, "2"),
|
||||
("Put 3,4 and 5", SHORTCUT, (3,4,5))
|
||||
),
|
||||
("Exit", SHORTCUT, "Control+q")
|
||||
)
|
||||
|
||||
|
||||
|
||||
--- 0.52.0
|
||||
|
||||
|
||||
Appearance Editing in WPrefs
|
||||
----------------------------
|
||||
|
||||
Added Appearance/Texture editing capability in WPrefs. Workspace background
|
||||
selection is not yet finished.
|
||||
|
||||
|
||||
Themes
|
||||
------
|
||||
|
||||
Removed all themes from the source tree, and moved them in a separate package.
|
||||
You can download the new package from the same place as this package:
|
||||
ftp://ftp.windowmaker.org/pub/beta/srcs/
|
||||
Look after WindowMaker-extra-<version-number>.tar.gz
|
||||
Also WindowMaker-extra pack include the old WindowMaker-data.tar.gz which only
|
||||
contained icons.
|
||||
Look for the greatest version number when you download this package.
|
||||
|
||||
|
||||
get-wraster-flags script change
|
||||
-------------------------------
|
||||
|
||||
The name of the options passed to get-wraster-flags changed, to allow a better
|
||||
name compatibility with the naming conventions used by other software.
|
||||
The name change was as follows:
|
||||
--lflags was changed in --ldflags
|
||||
To allow backward compatibility, with already written software, the old
|
||||
--lflags option is still recognized, but you are encouraged to move the the
|
||||
new --ldflags.
|
||||
|
||||
|
||||
|
||||
--- 0.51.2
|
||||
|
||||
|
||||
New Themes
|
||||
----------
|
||||
|
||||
Added 2 new cool themes (actually I added in 0.51.1, but forgot
|
||||
to put it here...) from largo (LeetWM) and BadlandZ (STEP2000).
|
||||
|
||||
|
||||
Full Screen Maximization
|
||||
------------------------
|
||||
|
||||
The FullMaximize window attribute will allow the window to
|
||||
be maximized to the full size of the screen (ignoring anything
|
||||
like titlebar, resizebar, dock, panels etc). It should be usefull
|
||||
for programs that must use the whole screen, like games or things
|
||||
like presentation programs.
|
||||
|
||||
|
||||
--- 0.51.1
|
||||
|
||||
KDE Application Menu script
|
||||
---------------------------
|
||||
|
||||
wkdemenu.pl is a converter from KDE application menu structures to wmaker
|
||||
menu that can be used as a piped menu. Look wkdemenu.sh for how to use it.
|
||||
|
||||
|
||||
Window Edge Resistance
|
||||
----------------------
|
||||
|
||||
Window edge resistance was now added. No, feature freeze hasn't been
|
||||
removed. Its just part of the edge resistance rewrite ;)
|
||||
|
||||
|
||||
New Theme
|
||||
---------
|
||||
|
||||
Added SteelBlueSilk theme
|
||||
|
||||
Installation Path Changes
|
||||
-------------------------
|
||||
|
||||
Default configuration data installed in /usr/local/etc/WindowMaker
|
||||
or $(sysconfdir)/WindowMaker
|
||||
|
||||
|
||||
--- 0.51.0
|
||||
|
||||
Window Maker has become a GNU program (part of the GNU Project).
|
||||
|
||||
Title text drop shadow
|
||||
----------------------
|
||||
|
||||
drop shadow option added for titlebar text. This is a compile time
|
||||
option which needs to be defined in src/wconfig.h after you run
|
||||
configure and before you run make.
|
||||
|
||||
New options and syntax for your WindowMaker domain file are:
|
||||
|
||||
Shadow = yes/no;
|
||||
FShadowColor = <color>;
|
||||
PShadowColor = <color>;
|
||||
UShadowColor = <color>;
|
||||
MShadowColor = <color>;
|
||||
|
||||
The shadow option is dynamic (no need for a restart).
|
||||
MShadowColor is for the menu title text.
|
||||
|
||||
libPropList
|
||||
-----------
|
||||
|
||||
WARNING!!! libPropList was removed from the Window Maker distribution
|
||||
and is being distributed separately. If you dont have it installed yet,
|
||||
get it from ftp.windowmaker.org/pub/libs and install before building
|
||||
Window Maker.
|
||||
|
||||
|
||||
signal handling change
|
||||
----------------------
|
||||
SIGHUP will exit wmaker instead of restarting it!!! This is because
|
||||
GNOME expects the window manager to exit instead of restarting...
|
||||
Complaints should go to gnome people. SIGUSR1 will restart wmaker now.
|
||||
|
||||
|
||||
script change
|
||||
-------------
|
||||
WINGs-flags was removed, and replaced by get-wraster-flags.
|
||||
Please remove WINGs-flags from your system, since it was obsoloted by
|
||||
get-wraster-flags.
|
||||
Continuing to use WINGs-flags can lead to hazardous effects, since is no
|
||||
longer updated.
|
||||
|
||||
|
||||
docklib
|
||||
-------
|
||||
|
||||
docklib is a little library for making dock applets. It's in the
|
||||
docklib-0.0.tar.gz file. Unpack it and read the README file there.
|
||||
|
||||
|
||||
Option Changes
|
||||
--------------
|
||||
|
||||
Removed OnTopTransients option
|
||||
|
||||
Added OpenTransientOnOwnerWorkspace
|
||||
|
||||
|
||||
Olwm Hint Support
|
||||
-----------------
|
||||
|
||||
OPEN LOOK(tm)/olwm hints support was added.
|
||||
|
||||
Read the appropriate section in the README file.
|
||||
|
||||
|
||||
|
||||
--- 0.50.1
|
||||
|
||||
New option for WorkspaceBack. mpixmap is the same as spixmap, but
|
||||
it will scale the pixmap by keeping the aspect ratio (maximize or maxpect).
|
||||
The option only works for workspace backgrounds.
|
||||
|
||||
Also added IGNORE_PPOSITION compile time flag, which is equivalent
|
||||
to NoPPosition from fvwm.
|
||||
|
||||
|
||||
|
||||
|
||||
--- 0.50.0
|
||||
|
||||
|
||||
KDE and GNOME
|
||||
-------------
|
||||
|
||||
Added full support for GNOME and KWM hints.
|
||||
Read the INSTALL file to see how enable them.
|
||||
|
||||
Everything in the so called GNOME window manager bla bla bla pseudo-spec is
|
||||
implemented.
|
||||
|
||||
As for KDE stuff, it implements 90% of everything kwm does, adds some
|
||||
Window Maker specific extensions to it and still uses half of the memory
|
||||
kwm does, which should be enough to let you dump kwm ;) For details on what
|
||||
exactly is implemented, see comments in src/kwm.c Read the README.KDE file
|
||||
for more information.
|
||||
|
||||
|
||||
WARNING: Some KDE hints are badly designed, so doing things like using
|
||||
kpanel's desktop switcher/pager and Window Maker's internal workspace
|
||||
management functions to create, destroy and rename workspaces at the same
|
||||
time might cause unknown effects. To be on the safe side, only
|
||||
use either of them to manage workspaces. Switching workspaces is hopefully,
|
||||
safe, so you can switch workspaces from wherever you want.
|
||||
|
||||
|
||||
|
||||
Workspace Specific Background Images
|
||||
------------------------------------
|
||||
|
||||
Use the WorkspaceSpecificBack to set background images for specific
|
||||
workspaces. The WorkspaceBack is used as the default background image.
|
||||
|
||||
Example:
|
||||
|
||||
WorkspaceSpecificBack = ((solid, red), (cpixmap, ship.jpg, gray), (),
|
||||
(dgradient, red, blue))
|
||||
|
||||
This will set the background image of workspace 1 to (solid, 0),
|
||||
2 to ship.jpg and 4 to a gradient. Workspace 3 and other workspaces
|
||||
will have the image defined by WorkspaceBack.
|
||||
|
||||
Note that this uses quite some memory...
|
||||
|
||||
|
||||
setstyle/getstyle
|
||||
-----------------
|
||||
|
||||
setstyle now accepts the -nofonts flag, which will load the style
|
||||
file ignoring all font related options.
|
||||
|
||||
Example:
|
||||
|
||||
setstyle -nofonts Blabla.style
|
||||
|
||||
|
||||
getstyle can be used to create theme packs. See the usage in the
|
||||
WindowMaker/README.themes file.
|
||||
|
||||
|
||||
|
||||
New Texture Type
|
||||
----------------
|
||||
|
||||
Textured gradients will tile a texture pixmap and combine it with a gradient,
|
||||
using an arbitrary opaqueness.
|
||||
|
||||
Syntax is (thgradient, <file>, <opaqueness>, <color1>, <color2>)
|
||||
(tvgradient, <file>, <opaqueness>, <color1>, <color2>)
|
||||
(tdgradient, <file>, <opaqueness>, <color1>, <color2>)
|
||||
where:
|
||||
<color1> and <color2> are the colors for the gradient,
|
||||
<file> is the texture file and
|
||||
<opaqueness> is the opaqueness to merge the texture witht the gradient,
|
||||
ranging from 0 to 255.
|
||||
|
||||
Example:
|
||||
|
||||
(thgradient, "BlueImage.jpeg", 120, white, black)
|
||||
|
||||
The BlackTexture style and Checker theme are examples.
|
||||
|
||||
Hints:
|
||||
|
||||
You can use any type of pixmap file for this, but small (like 64x32)
|
||||
grayscale pixmap files should get the best results (fast and low memory
|
||||
usage). You can use color pixmaps, but it is harder to get the desired effect
|
||||
with them.
|
||||
|
||||
Be warned that this texture type is the slowest.
|
||||
|
||||
|
||||
|
||||
New Options
|
||||
-----------
|
||||
|
||||
IconTitleBack and IconTitleColor control the color of the
|
||||
miniwindow title. Both of them are colors.
|
||||
|
||||
Example:
|
||||
IconTitleColor=white;
|
||||
IconTitleBack=black;
|
||||
|
||||
|
||||
Since this introduces an incompatibility in themes and getting flamed by the
|
||||
themes ppl isn't the most pleasant thing ("Whaddafuk you're thinking!? You
|
||||
just broke 500 themes!!!" ;) the setstyle command was hacked so that it will
|
||||
make old themes work as before, by trying to automatically set the above
|
||||
options. Note that in some cases it will not have exactly the same results as
|
||||
before.
|
||||
|
||||
|
||||
StartMaximized window attribute. Will maximize the window when it
|
||||
is mapped.
|
||||
|
||||
|
||||
AutoRaiseLower option for the Clip. This allows automatic Raise/Lower of the
|
||||
Clip icons when the mouse pointer enter/leave the Clip. To avoid unwanted
|
||||
raising/lowering there is a time threshold before raising/lowering.
|
||||
The thresholds can be changed in wconfig.h by changing one or both of
|
||||
AUTO_LOWER_DELAY and AUTO_RAISE_DELAY (expressed in miliseconds).
|
||||
For example if you set AUTO_RAISE_DELAY to 0, then the Clip will be raised as
|
||||
soon as the mouse pointer enters it's area. Setting AUTO_RAISE_DELAY to a very
|
||||
big value, will make the Clip to practically do not auto raise unless clicked,
|
||||
but to be automatically lowered after AUTO_LOWER_DELAY (ms) when leaved.
|
||||
|
||||
|
||||
New ThemePack Format
|
||||
--------------------
|
||||
|
||||
Starting with this version, a new format of themes is being supported.
|
||||
Before you open pine and start composing your flame, rest assured that
|
||||
the old format is still supported. The new format is documented
|
||||
in the WindowMaker/README.themes file.
|
||||
|
||||
|
||||
Root Menu
|
||||
---------
|
||||
|
||||
The -noext option for OPEN_MENU will strip whatever is after the last .
|
||||
in file names that appear on the opened directory. So,
|
||||
|
||||
OPEN_MENU ~/bg WITH xv -root -quit
|
||||
|
||||
will create a menu with all the images in ~/bg without the extension.
|
||||
|
||||
|
||||
|
||||
--- 0.20.3
|
||||
|
||||
|
||||
Icon (miniwindow) stacking
|
||||
--------------------------
|
||||
|
||||
If you want miniwindows to reside under normal windows, edit
|
||||
wconfig.h and change WNormalLevel (just grep for it) to
|
||||
WDesktopLevel
|
||||
|
||||
|
||||
5 Button Mouse
|
||||
--------------
|
||||
|
||||
If you have a 5 button mouse and want to give some utility for
|
||||
the extra 2 buttons, edit the appropriate line in src/wconfig.h
|
||||
Clicking Button4 in the root window will switch you to the previous
|
||||
workspace and Button5 will do that for the next.
|
||||
|
||||
|
||||
Option Changes
|
||||
--------------
|
||||
|
||||
put NoWindowOverDock back
|
||||
|
||||
KeepOnBottom window attribute
|
||||
|
||||
|
||||
-static command line option
|
||||
---------------------------
|
||||
|
||||
wmaker -static will start Window Maker in static mode. This will
|
||||
prevent wmaker from checking or making any configuration changes.
|
||||
That makes it possible to run wmaker before running wmaker.inst
|
||||
|
||||
|
||||
Hysteresis for menu item selection
|
||||
----------------------------------
|
||||
|
||||
Hopefully it's intelligent enough, so you won't notice it.
|
||||
|
||||
In case you want to know what's it, it's equivalent to that
|
||||
(insanely long) 2 second delay present in that Windoze95 menu,
|
||||
but more usefull than annoying (I hope :). To see it, do the following
|
||||
with your current wmaker version and later with 0.20.3:
|
||||
|
||||
- open the apps menu and stick it
|
||||
- click in the item for the "Workspaces" submenu and hold
|
||||
- drag the mouse to the 4th or bigger entry (like "Workspace 4") in a
|
||||
straight line, trying to select the target item before the submenu
|
||||
is unmapped when you dragged over other items in the main menu
|
||||
|
||||
|
||||
|
||||
Window Shortcuts
|
||||
----------------
|
||||
|
||||
Window shortcuts are shortcuts to arbitrary windows. You can make up to 4
|
||||
shortcuts. To assign a previously bound shortcut to a window use the "Select
|
||||
Shortcut" submenu in the window commands menu. If the shortcut is not yet
|
||||
assigned for any window, you can hit the shortcut to assign it to the active
|
||||
window. The shortcut will do the same as clicking in an entry in the window
|
||||
list menu. The keys for the shortcuts are defined in the ~/G/D/WindowMaker
|
||||
file or in WPrefs.app
|
||||
|
||||
Option names are:
|
||||
|
||||
WindowShortcut1Key through WindowShortcut4Key
|
||||
|
||||
|
||||
--- 0.20.2
|
||||
|
||||
|
||||
The name of WindowMaker was changed to Window Maker.
|
||||
|
||||
Window creation animation disabled by default.
|
||||
|
||||
xdaliclock -shape
|
||||
-----------------
|
||||
|
||||
If you use it edit src/wconfig.h and #define OPTIMIZE_SHAPE or disable the
|
||||
titlebar and resizebar for the window. OPTIMIZE_SHAPE will remove the
|
||||
flickering for xdaliclock and other programs that change their shapes often,
|
||||
but will increase network traffic considerably. So, if you use xdaliclock
|
||||
from a remote machine it can get slow.
|
||||
|
||||
|
||||
Applications Menu
|
||||
-----------------
|
||||
|
||||
The applications menu will now use the shell in the SHELL environment
|
||||
variable to execute EXEC menu commands. If it is unset (I think it's always
|
||||
automatically set by the shell program) it will use /bin/sh
|
||||
|
||||
|
||||
Extra fancy icon kaboom :)
|
||||
--------------------------
|
||||
|
||||
Edit src/wconfig.h and #define ICON_KABOOM_EXTRA to get
|
||||
more effects for the icon undocking animation.
|
||||
|
||||
Options for superfluous stuff are even more superfluous, so this
|
||||
will not become runtime.
|
||||
|
||||
|
||||
XDE drag and drop support
|
||||
-------------------------
|
||||
|
||||
Support for XDE drag and drop was added (by "]d" <id@maliwan.org>).
|
||||
To enable, edit src/wconfig.h
|
||||
The support works with gtk 1.1.2
|
||||
|
||||
|
||||
libPropList
|
||||
-----------
|
||||
|
||||
libPropList will now be built automatically by wmaker. Wich means
|
||||
the (simplified) building process is now:
|
||||
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
instead of:
|
||||
|
||||
tar xzf libPropList.tar.gz
|
||||
(cd libPropList; make)
|
||||
make
|
||||
make install
|
||||
|
||||
You also don't need to worry about GNOME libPropList incompatibilities
|
||||
anymore.
|
||||
|
||||
|
||||
Bug with focus lost in sloppy focus fixed
|
||||
-----------------------------------------
|
||||
|
||||
The bug only occurs in sloppy or auto focus modes, with AutoFocus disabled
|
||||
and Superfluous enabled. There is no easy/clean way to fix this, so Window
|
||||
Maker will disable the animation of window creation if the focus mode is
|
||||
either sloppy or auto AND AutoFocus=NO.
|
||||
|
||||
If you want the animation, enable AutoFocus or use manual focus mode
|
||||
(prefered).
|
||||
|
||||
|
||||
The NoWindowUnderDock option was removed
|
||||
----------------------------------------
|
||||
To obtain the same result, use the "Keep Dock On Top" option in the dock menu.
|
||||
|
||||
|
||||
Persistent Program Suplied Icons
|
||||
--------------------------------
|
||||
|
||||
Application supplied icons are now stored, so that the dock will keep
|
||||
showing them after the app is exited. The icons are stored at
|
||||
~/GNUstep/.AppInfo/WindowMaker/
|
||||
|
||||
|
||||
Sound support
|
||||
-------------
|
||||
|
||||
Sound support is now on by default. Even if you don't use sound the overhead
|
||||
is very small, and has no impact on performance. If you still want to
|
||||
optimize it and remove a few hundred of bytes, then use --disable-sound or
|
||||
--enable-sound=no options when you configure Window Maker.
|
||||
|
||||
|
||||
--- 0.20.0
|
||||
|
||||
|
||||
Multihead support. wmaker will now manage all screens that are attached to the
|
||||
display.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
||||
It does so from a single process (instead of spawning a new process for each
|
||||
screen, like fvwm does). This keeps memory usage a lot lower than fvwm.
|
||||
|
||||
@@ -27,6 +867,7 @@ exitscript
|
||||
|
||||
~/G/L/W/exitscript will be called automatically when wmaker is exited.
|
||||
|
||||
|
||||
New runtime options
|
||||
-------------------
|
||||
|
||||
@@ -55,6 +896,7 @@ New theme
|
||||
A new theme named Night, is available in this distribution.
|
||||
|
||||
|
||||
|
||||
--- 0.19.3
|
||||
|
||||
GIF support was added. You will need libgif 2.2 to use it.
|
||||
|
||||
411
README
411
README
@@ -1,146 +1,263 @@
|
||||
|
||||
WindowMaker X11 Window Manager
|
||||
|
||||
|
||||
GNU Window Maker
|
||||
X11 Window Manager
|
||||
|
||||
<http://windowmaker.org>
|
||||
<ftp://ftp.windowmaker.org>
|
||||
|
||||
by
|
||||
|
||||
Alfredo K. Kojima
|
||||
<kojima@windowmaker.org>
|
||||
|
||||
Dan Pascu
|
||||
<dan@windowmaker.org>
|
||||
|
||||
Matthew Hawkins
|
||||
<matt@windowmaker.org>
|
||||
|
||||
]d
|
||||
|
||||
|
||||
Web/FTP Master
|
||||
|
||||
Phillip Smith
|
||||
|
||||
|
||||
|
||||
Congratulations! You have purchased an extremely fine
|
||||
device that would give you thousands of years of trouble-free
|
||||
service, except that you undoubtably will destroy it via some
|
||||
typical bonehead consumer maneuver. Which is why we ask you
|
||||
to PLEASE FOR GOD'S SAKE READ THIS OWNER'S MANUAL CAREFULLY
|
||||
BEFORE YOU UNPACK THE DEVICE. YOU ALREADY UNPACKED IT, DIDN'T
|
||||
YOU? YOU UNPACKED IT AND PLUGGED IT IN AND TURNED IT ON AND
|
||||
FIDDLED WITH THE KNOBS, AND NOW YOUR CHILD, THE SAME CHILD WHO
|
||||
ONCE SHOVED A POLISH SAUSAGE INTO YOUR VIDEOCASSETTE RECORDER
|
||||
AND SET IT ON "FAST FORWARD", THIS CHILD ALSO IS FIDDLING
|
||||
WITH THE KNOBS, RIGHT? AND YOU'RE JUST NOW STARTING TO READ
|
||||
THE INSTRUCTIONS, RIGHT??? WE MIGHT AS WELL JUST BREAK THESE
|
||||
DEVICES RIGHT AT THE FACTORY BEFORE WE SHIP THEM OUT, YOU
|
||||
KNOW THAT?
|
||||
-- Dave Barry, "Read This First!"
|
||||
|
||||
|
||||
Description
|
||||
===========
|
||||
|
||||
WindowMaker is a window manager designed to emulate the look and feel of
|
||||
part of the NEXTSTEP(tm) GUI. It's 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).
|
||||
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. It's
|
||||
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).
|
||||
|
||||
Window Maker was designed keeping integration with GNUstep in mind and is the
|
||||
"official" window manager for it. It is also part of the GNU project
|
||||
(www.gnu.org) Read more about GNUstep further on this file.
|
||||
|
||||
Hints (information given by applications to integrate well with the window
|
||||
manager) for Motif(tm), OPEN LOOK(tm), KDE and GNOME are also supported.
|
||||
So you can replace any of the window managers for these environments
|
||||
with Window Maker while keeping most, if not all, of the native window manager
|
||||
functionality.
|
||||
|
||||
Window Maker was previously called WindowMaker.
|
||||
|
||||
Window Maker has no connection with Windowmaker, the software for
|
||||
making windows and doors.
|
||||
|
||||
|
||||
User Guide
|
||||
==========
|
||||
Documentation
|
||||
=============
|
||||
|
||||
The WindowMaker User's Guide can be downloaded from the official ftp
|
||||
Read before asking.
|
||||
|
||||
* README files all over the source tree have info related to the stuff
|
||||
in the directories.
|
||||
|
||||
* INSTALL has installation instructions and some troubleshooting tips.
|
||||
You're meant to read it before installing. it was not written just to
|
||||
fill up space in the package...
|
||||
|
||||
* FAQ: Frequently Asked Questions. READ IT!!! FAQ.I18N is for
|
||||
internationalization related questions.
|
||||
|
||||
* NEWS: list user visible changes from the previous version. Read it if
|
||||
you are upgrading.
|
||||
|
||||
* MIRRORS: some alternative places where you can get Window Maker,
|
||||
including platform specific packages of Window Maker.
|
||||
|
||||
* BUGFORM: use it to send bug reports. Please do use it.
|
||||
|
||||
* 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
|
||||
|
||||
The Window Maker User's Guide can be downloaded from the official ftp
|
||||
or web sites.
|
||||
It can also be viewed in HTML format in:
|
||||
http://people.delphi.com/crc3419/WMUserGuide/index.htm
|
||||
|
||||
|
||||
Directories & Files
|
||||
===================
|
||||
|
||||
o INSTALL contains installation instructions and some troubleshooting tips.
|
||||
|
||||
o Install is a script for configuring and compiling WindowMaker in a easy
|
||||
way.
|
||||
|
||||
o ChangeLog contains the changes since the last version
|
||||
|
||||
o BUGS contains a list of the currently known bugs
|
||||
|
||||
o FAQ is a list of frequently asked questions. Read it. I won't answer
|
||||
questions answered in it.
|
||||
|
||||
o NEWS is a list of user visible changes since the last version. Read it if
|
||||
you are upgrading.
|
||||
|
||||
o wmlib/ contains the library necessary to write applications that use
|
||||
WindowMaker specific features, like application defined menus. This library
|
||||
will be merged into WINGs in the future.
|
||||
|
||||
o WINGs/ contain the WINGs (WINGs Is Not GNUstep) tiny widget library. It is
|
||||
used by wmaker, but can be used by standalone programs as well.
|
||||
|
||||
o test/ contains a simple test program that shows some of the things that can
|
||||
be done with WindowMaker and wmlib
|
||||
|
||||
o wrlib/ contains the library used to do image manipulation (loading,
|
||||
dithering etc.) in WindowMaker. It can be used in other applications.
|
||||
|
||||
o util/ contains various utility programs.
|
||||
|
||||
o WPrefs/ contains the source code for the WindowMaker Preferences utility.
|
||||
Read the WPrefs/README file before using it.
|
||||
|
||||
o Configuration options can be found in the ~/GNUstep/Defaults/* files
|
||||
(after installation). The menus can be configured in
|
||||
~/GNUstep/Library/WindowMaker/menu
|
||||
|
||||
o The default configuration files for the system are installed by default in
|
||||
/usr/local/share/WindowMaker, along with some other data files.
|
||||
|
||||
o src/wconfig.h contains various compile time options you can change to
|
||||
select some options/features and things like the path for configuration
|
||||
directory.
|
||||
|
||||
o BUGFORM is a form you should fill to send a bugreport. Please use the
|
||||
form. It makes things easier to me and ensures that you give me a reasonable
|
||||
amount of information. This form should be sent to developers@windowmaker.org
|
||||
The User Guide explains how to use Window Maker, the configuration files
|
||||
and options.
|
||||
|
||||
|
||||
Mailing List
|
||||
============
|
||||
*** man pages
|
||||
|
||||
There is a mailing list for discussing WindowMaker at
|
||||
wmaker@linuxcenter.com To subscribe to it, send a message containing:
|
||||
Type "man wmaker" in the shell prompt to get general help about Window Maker
|
||||
|
||||
|
||||
|
||||
Directories & Files in the Source Tree
|
||||
======================================
|
||||
|
||||
* Install is a script for configuring and compiling Window Maker in a easy
|
||||
way (not that the normal way is difficult, but...).
|
||||
|
||||
* AUTHORS: the credits
|
||||
|
||||
* TODO: plans for the future
|
||||
|
||||
* contrib/ has some contributed patches that are not supported by Window Maker
|
||||
because they conflict with design filosophies of the developers or some
|
||||
other reason.
|
||||
|
||||
* util/ has various utility programs.
|
||||
|
||||
* WPrefs.app/ is the configuration program.
|
||||
|
||||
* src/wconfig.h has compile time options you can change to select some
|
||||
options/features and other stuff.
|
||||
|
||||
* WINGs/ NEXTSTEP lookalike widget library
|
||||
|
||||
* wrlib/ image processing library
|
||||
|
||||
* po/ has message catalogs wich are the translated versions of the messages
|
||||
displayed by Window Maker.
|
||||
|
||||
* docklib-x.x.tar.gz a library for writing dockapps
|
||||
|
||||
|
||||
HELP ME!!!
|
||||
==========
|
||||
|
||||
There is a mailing list for discussing Window Maker at
|
||||
wm-user@windowmaker.org To subscribe to it, send a message containing:
|
||||
subscribe
|
||||
in the subject and the body of the message to wmaker-request@linuxcenter.com
|
||||
in the subject of the message to wm-user-request@windowmaker.org
|
||||
|
||||
If you have some problem installing or using wmaker, it would be advisable
|
||||
to ask in the mailing list, as the probability of at least one of the 500+
|
||||
users there having the same problem as you (and solving it) is bigger than
|
||||
the three of us. The developers are subscribed to the mailing list, so we
|
||||
will read your post anyway (no need for cc:). For bug reports, fill
|
||||
the BUGFORM and send it to developers@windowmaker.org You can also use
|
||||
the bug tracker page at http://windowmaker.org/cgi-bin/bugs
|
||||
If you got a problem, ask there (after reading the docs, of course). The
|
||||
people there is more likely to be able to answer your questions than we are.
|
||||
For bug reports use the BUGFORM.
|
||||
|
||||
Important note: when asking for help (in the mailing list or to the
|
||||
developerts, directly) always send information about the system you are
|
||||
using. You can use the system information section at the end of BUGFORM
|
||||
as a guideline. Another thing: please don't send HTML mail. You will
|
||||
be risking having your mail deleted before being read. Not everybody
|
||||
uses a browser to read email, wich makes your message an annoyance.
|
||||
There should be an option in your mail app to disable it.
|
||||
If you have a problem with a precompiled version of Window Maker
|
||||
(rpm, deb etc), first ask the person who made the package.
|
||||
|
||||
IMPORTANT NOTE: when asking for help (in the mailing list or to the
|
||||
developerts, directly) *always* send information about the system you are
|
||||
using. You can use the system information section at the end of BUGFORM as a
|
||||
guideline. Another thing: please don't send HTML mail.
|
||||
|
||||
|
||||
There is also a #windowmaker IRC channel at openprojects. To join there,
|
||||
connect your irc client to irc.openprojects.net, irc.linux.com or some other
|
||||
server of that network.
|
||||
|
||||
Running multiple instances of WindowMaker
|
||||
=========================================
|
||||
|
||||
It is not a good idea to run more than one instance of WindowMaker
|
||||
GNUstep
|
||||
=======
|
||||
|
||||
GNUstep 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.
|
||||
|
||||
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.
|
||||
|
||||
For more information on the GNUstep project, visit: http://www.gnustep.org
|
||||
and http://gnustep.current.nu
|
||||
|
||||
|
||||
Running multiple instances of Window Maker
|
||||
==========================================
|
||||
|
||||
It is not a good idea to run more than one instance of Window Maker
|
||||
from the same user (so that wmaker will use the same configuration
|
||||
files) at the same time. You might get unexpected behaviour when WindowMaker
|
||||
files) at the same time. You might get unexpected behaviour when Window Maker
|
||||
updates it's configuration files.
|
||||
|
||||
If you really desire to do this, try running Window Maker with the
|
||||
command line option --static so that it will not update or change
|
||||
any of the configuration files.
|
||||
|
||||
Sound support
|
||||
=============
|
||||
|
||||
Sound is supported for Linux and FreeBSD systems with the use of a
|
||||
separately distributed module. You can download it at:
|
||||
http://www.frontiernet.net/~southgat/wmsound
|
||||
separately distributed module called WSoundServer. There is also a graphical
|
||||
configuration tool for setting up your sounds called WSoundPrefs.
|
||||
You can download these at:
|
||||
http://shadowmere.student.utwente.nl/
|
||||
|
||||
Note that you must compile WindowMaker with the --enable-sound configure
|
||||
Note that you must compile Window Maker with the --enable-sound configure
|
||||
flag and set the DisableSound option to NO.
|
||||
|
||||
|
||||
OpenL**k support
|
||||
================
|
||||
|
||||
I guess many users, mainly from the academic world, have to use
|
||||
applications written using the OpenL**k toolkits, so having support
|
||||
for these apps must be of some use.
|
||||
|
||||
To enable, use --enable-openlook when doing the configure. Note that
|
||||
not everything is implemented.
|
||||
|
||||
Implemented stuff include decoration hints and the push-pin. Not implemented
|
||||
stuff include _SUN_WINDOW_STATE (the compose led state stuff), drag and drop
|
||||
interest stuff, header (not sure what's it) and footer strings.
|
||||
|
||||
Please give me feedback if something doesn't work. If the feature is
|
||||
already implemented, but is not working because of a bug, I'll try to
|
||||
have that fixed. If it's a non-implemented feature and you mention that
|
||||
it's important (ie: not just cosmetical), I'll consider implementing it.
|
||||
|
||||
The "out" state of the pushpin is emulated as a pushed-in close button.
|
||||
Just click on the button to make it pushed-out, which corresponds
|
||||
to the pinned-in state of the pushpin. If you push again in the pushed-out
|
||||
close button, it will act as a normal close button: it will close the window.
|
||||
|
||||
|
||||
Performance Tuning
|
||||
==================
|
||||
|
||||
If you want to diminish WindowMaker's memory usage and improve performance,
|
||||
If you want to diminish Window Maker's memory usage and improve performance,
|
||||
while keeping a nice appearance and good functionality, follow the items
|
||||
bellow:
|
||||
|
||||
- use solid textures for everything, mainly titlebars and menus. If you
|
||||
want a nice looking desktop, use the Traditional style.
|
||||
- turn NewStyle and Superfluous off
|
||||
- turn on DisableAnimations
|
||||
- do not bind many shortcuts in the menu and keep only the essential items
|
||||
in the menu
|
||||
- turn on DisableClip
|
||||
@@ -148,41 +265,133 @@ bellow:
|
||||
don't use anyway (keep in mind that some of the #defines might not
|
||||
work, as they are not fully supported). Make sure to always keep
|
||||
NumLock and ScrollLock turned off.
|
||||
- turn on DisableAnimations. You can also #undefine ANIMATIONS in wconfig.h
|
||||
- strip down the default IconPath and PixmapPath entries to contain only
|
||||
the paths that you really have in your system.
|
||||
- do not use large images in the root background
|
||||
- remove support for image formats you don't use
|
||||
- to reduce memory usage, disable the icon cache, by setting the RIMAGE_CACHE
|
||||
environment variable to 0. If you want to increase performance at the cost
|
||||
of memory usage, set it's value to a value like the number of different
|
||||
icons you use.
|
||||
|
||||
|
||||
Copyrights
|
||||
==========
|
||||
Keyboard Mouse Control
|
||||
======================
|
||||
|
||||
WindowMaker is copyrighted by Alfredo K. Kojima and is licensed through the
|
||||
Many people ask about adding keyboard control of mouse, like in fvwm,
|
||||
but Window Maker will not have such feature. The XKB extension supports
|
||||
mouse simulation from the keyboard, in a much more powerfull fashion than
|
||||
any simulation done by a window manager.
|
||||
|
||||
To enable it, hit the Control+Shift+NumLock or Shift+NumLock key combination.
|
||||
You should hear the speaker beeping. To disable it, do the same thing.
|
||||
|
||||
To control the mouse the numeric keypad is used as follows:
|
||||
- 4 (left arrow), 7 (Home), 8 (up arrow), 9 (PgUp), 6 (right arrow),
|
||||
3 (PgDn), 2 (down arrow) and 1 (End) move the mouse to the corresponding
|
||||
direction;
|
||||
- holding one of the above keys and then holding the 5 key will move the
|
||||
pointer faster;
|
||||
- / will select the first mouse button (left button);
|
||||
- * will select the second mouse button (middle button);
|
||||
- - will select the third mouse button (right button);
|
||||
- 5 will do a click with the currently selected mouse button;
|
||||
- + will do a double-click with the currently selected button;
|
||||
- 0 (Ins) will click and hold the currently selected button;
|
||||
- . (Del) will release the currently selected button that was previously
|
||||
clicked with the 0 (Ins) key.
|
||||
|
||||
|
||||
The above key values work in a XFree86 3.2 (X11R6.1) X server but your
|
||||
milleage may vary.
|
||||
|
||||
|
||||
How to make a gdb backtrace
|
||||
===========================
|
||||
|
||||
Backtraces can help us fix bugs that make Window Maker crash. If you
|
||||
find a bug that crashes Window Maker, please send a backtrace with your
|
||||
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.
|
||||
|
||||
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
|
||||
gdb .libs/wmaker path_to_the_core_file
|
||||
|
||||
Then, in the gdb prompt type "bt". Quit from gdb by typing "quit"
|
||||
and then, in the shell prompt, type "exit".
|
||||
|
||||
The file named typescript will contain the backtrace.
|
||||
|
||||
|
||||
|
||||
Copyrights & Disclaimers
|
||||
========================
|
||||
|
||||
Window Maker is copyrighted by Alfredo K. Kojima and is licensed through the
|
||||
GNU General Public License. Read the COPYING file for the complete license.
|
||||
|
||||
The icons that are distributed with this program and were made by Marco van
|
||||
Hylckama Vlieg, are licensed through the GNU General Public License. Read the
|
||||
COPYING file for the complete license.
|
||||
|
||||
The icons listed in COPYING.WTFPL and are distributed in this
|
||||
program and were made by Banlu Kemiyatorn (]d), are licensed through the
|
||||
"do What The Fuck you want to Public License". Read the COPYING.WTFPL
|
||||
file for the complete license.
|
||||
|
||||
NeXT, OpenStep and NEXTSTEP are a trademarks of NeXT Computer, Inc.
|
||||
All other trademarks are property of their respective owners.
|
||||
|
||||
The authors reserve the right to make changes in the software without prior
|
||||
notice.
|
||||
|
||||
|
||||
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
|
||||
FAQ, this file and INSTALL files) and about "cool" things you see in
|
||||
people's desktop screenshots.
|
||||
|
||||
|
||||
The AUTHORS file contains a list of the people who have contributed to the
|
||||
project. The name of people who have helped with localization (translation)
|
||||
can be found in po/README and WindowMaker/README
|
||||
can be found in po/README and Window Maker/README
|
||||
|
||||
If you have any comments, fixes and bug reports (filled BUGFORMs) send them
|
||||
to kojima@windowmaker.org
|
||||
to developers@windowmaker.org
|
||||
|
||||
|
||||
|
||||
|
||||
Musicware
|
||||
=========
|
||||
|
||||
If you use WindowMaker and *really* like it, please consider making my day
|
||||
by sending me a music CD (or a MiniDisc) 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.
|
||||
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:
|
||||
|
||||
|
||||
53
README.GNOME
Normal file
53
README.GNOME
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
Information on Using Window Maker with GNOME
|
||||
--------------------------------------------
|
||||
|
||||
|
||||
Status of GNOME support
|
||||
-----------------------
|
||||
|
||||
|
||||
GNOME window manager protocols seem to be a work in progress.
|
||||
Things still change fairly frequently, so, the stuff implemented
|
||||
may not reflect the latest protocol. If something doesn't work,
|
||||
that's probably because the protocols have changed again and I still
|
||||
didn't have time to reimplement everything or noticed that it
|
||||
changed. If that happens, please tell me exactly what doesn't work.
|
||||
|
||||
Other than that, the so called "GNOME Window Manager Compliance - How to
|
||||
write a GNOME compliant Window Manager" document, says this:
|
||||
|
||||
"There are currently a set of other hints available that are, at the
|
||||
current time, not essential and therefore not documented here. It is,
|
||||
however envisaged that they will be finalized and added to this
|
||||
document, but for now are not needed."
|
||||
|
||||
Since they are non-essential and undocumented they are not yet implemented.
|
||||
|
||||
|
||||
Implemented stuff:
|
||||
|
||||
- GNOME window manager hints
|
||||
- Motif window manager hints
|
||||
|
||||
On the works:
|
||||
|
||||
- R6 style session management
|
||||
|
||||
|
||||
Compilation/Installation
|
||||
------------------------
|
||||
|
||||
To compile Window Maker with GNOME support, just configure it as:
|
||||
./configure --enable-gnome
|
||||
|
||||
before compiling.
|
||||
|
||||
Also, do not disable mwm hints support (they are enabled by default).
|
||||
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
In WPrefs, go to the last section and toggle the "Disable miniwindows" option.
|
||||
|
||||
125
README.KDE
Normal file
125
README.KDE
Normal file
@@ -0,0 +1,125 @@
|
||||
|
||||
|
||||
Information on Using Window Maker with KDE
|
||||
------------------------------------------
|
||||
|
||||
|
||||
Window Maker supports almost all KDE/KWM specific client
|
||||
communication protocols, so you can simply replace kwm with
|
||||
Window Maker, if you think these advantages are worthy:
|
||||
|
||||
Window Maker KWM
|
||||
=============================================================================
|
||||
Looks NEXTSTEP(tm)/NEXTSTEP(tm) Original, but reminds
|
||||
enhanced Windows(tm)
|
||||
|
||||
Decoration solid, gradient, multi-color solid, vertical and
|
||||
Textures gradient, pixmaps, textured horizontal gradient,
|
||||
gradient - all gradients are pixmap
|
||||
supported in horizontal,
|
||||
vertical and diagonal
|
||||
directions
|
||||
|
||||
Configurable No Yes, but not totally
|
||||
Titlebar Buttons
|
||||
|
||||
Mini CLI Yes, but limited Yes
|
||||
|
||||
Window Specific Yes In KDE 1.1, yes.
|
||||
Configuration In KDE 1.0, no.
|
||||
|
||||
Quick Keyboard Yes In KDE 1.1, yes
|
||||
Navigation In KDE 1.0, no.
|
||||
|
||||
Pager KDE pagers will work as Yes
|
||||
well as GNOME pagers
|
||||
|
||||
Session Not yet supported, but Yes, old (pre-X11R6) style
|
||||
Management X11R6 style SM is being worked.
|
||||
|
||||
Dock kpanel, GNOME panel and Dock kpanel
|
||||
|
||||
Built-in Yes No
|
||||
krootbgwm
|
||||
|
||||
GNOME support Yes No
|
||||
|
||||
Memory Usage(1) 1.85Mb In KDE 1.0, 3.13Mb
|
||||
In KDE 1.1, probably more
|
||||
|
||||
|
||||
(1) Memory usage was tested by running wmaker and kwm at the same machine
|
||||
with the same windows, on the same screen and similar window texture
|
||||
configurations (at different times, of course). I looked in the output of
|
||||
ps -m, in the SIZE field, right after starting the window managers.
|
||||
|
||||
|
||||
|
||||
Enabling KDE Support
|
||||
--------------------
|
||||
|
||||
To enable KDE support in Window Maker, you must compile it after
|
||||
configuring it as follows:
|
||||
./configure --enable-kde
|
||||
|
||||
Then, just replace kwm with wmaker in your startkde script.
|
||||
If you are going to use Window Makers sound server, comment out
|
||||
kwmsound in startkde. Also if wmaker sets your root window
|
||||
background, comment out kbgndwm, kde's wallpaper setter.
|
||||
|
||||
Make sure to disable workspace background setting in KDE. If you
|
||||
wont be using Window Maker themes anyway, you can set
|
||||
WorkspaceBack = (none);
|
||||
|
||||
in ~/GNUstep/Defaults/WindowMaker
|
||||
|
||||
|
||||
Enhancing Integration
|
||||
---------------------
|
||||
|
||||
Window Maker adds some extensions to KDE's messaging stuff, so you can run
|
||||
Window Maker specific commands from places like kpanel, krootwm or even
|
||||
kwmcom. Recently KDE developers have kindly added support for these extensions
|
||||
in the more recent KDE versions from CVS. The added stuff are the following
|
||||
kwm like commands:
|
||||
|
||||
wm:wmaker - select Window Maker support mode
|
||||
wmaker:info - show info panel
|
||||
wmaker:legal - show legal panel
|
||||
wmaker:arrangeIcons - arrange icons
|
||||
wmaker:showAll - show all windows
|
||||
wmaker:hideOthers - hide others
|
||||
wmaker:restart - restart wmaker
|
||||
wmaker:exit - exit wmaker
|
||||
|
||||
You can test them with kwmcom, like:
|
||||
kwmcom wmaker:info
|
||||
|
||||
|
||||
Problems
|
||||
--------
|
||||
|
||||
* kpanel will not be kept always on top. That's because kpanel is an
|
||||
OverrideRedirect window, so Window Maker can't do anything about that.
|
||||
|
||||
Before requesting for a hack to work around that in Window Maker, please
|
||||
request the kpanel author to fix it.
|
||||
|
||||
* because the KDE protocol for letting the window manager know the usable
|
||||
window region is broken, you might find some problems with the window
|
||||
positioning/maximization code and kpanel's position.
|
||||
|
||||
* It seems kpanel (and maybe KDE in general) doesn't like dynamically
|
||||
changing the number of workspaces. So, don't create or destroy workspaces
|
||||
while running on KDE, unless you really need.
|
||||
|
||||
* If kpanel, kwmpager or kpager becomes confused about the number of
|
||||
windows present, restart them.
|
||||
|
||||
* Wmaker opens windows by default under/over the panel, when the panel is
|
||||
at top or left of screen. Use the GUI configuration tool WPrefs to change
|
||||
this.
|
||||
|
||||
* Some commands, such as cascade windows and rearrange windows are not
|
||||
yet implemented.
|
||||
|
||||
86
README.definable-cursor
Normal file
86
README.definable-cursor
Normal file
@@ -0,0 +1,86 @@
|
||||
# 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
|
||||
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|
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
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:
|
||||
|
||||
(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).
|
||||
|
||||
You can set the following cursor types (they're shown here with their
|
||||
defaults):
|
||||
|
||||
NormalCursor = (builtin, left_ptr);
|
||||
MoveCursor = (builtin, fleur);
|
||||
ResizeCursor = (builtin, sizing);
|
||||
WaitCursor = (builtin, watch);
|
||||
|
||||
______________________
|
||||
|O| Random Notes |X|
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Most X11 cursors are 16x16 bitmaps. Many X servers can actually handle
|
||||
larger cursors, though. To check, use:
|
||||
|
||||
xdpyinfo
|
||||
|
||||
and in the resulting output look for a line such as:
|
||||
|
||||
largest cursor: 64x64
|
||||
|
||||
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/>.
|
||||
|
||||
For an example
|
||||
|
||||
--jim
|
||||
|
||||
%%%%%%%%%%%%%%% jim knoble %%%%%%%% jmknoble@pobox.com %%%%%%%%%%%%%%%%%
|
||||
379
README.pt
Normal file
379
README.pt
Normal file
@@ -0,0 +1,379 @@
|
||||
|
||||
|
||||
GNU Window Maker
|
||||
Gerenciador de Janelas X11
|
||||
|
||||
<http://windowmaker.org>
|
||||
<ftp://ftp.windowmaker.org>
|
||||
|
||||
por
|
||||
|
||||
Alfredo K. Kojima
|
||||
|
||||
Dan Pascu
|
||||
|
||||
Matthew Hawkins
|
||||
|
||||
]d
|
||||
|
||||
|
||||
Web/FTP Master
|
||||
|
||||
Phillip Smith
|
||||
|
||||
|
||||
|
||||
Parabéns! Você acabou de adquirir um dispositivo muito
|
||||
bom que lhe proporcionaria milhares de anos de uso sem problemas,
|
||||
exceto por que, você, com vai certeza destruí-lo com algum procedimento
|
||||
idiota típico dos consumidores. Por isso nós pedimos POR FAVOR,
|
||||
PELO AMOR DE DEUS LEIA O MANUAL DO DONO COM MUITA ATENÇÃO ANTES
|
||||
DE DESEMBRULHAR O DISPOSITIVO. VOCÊ JÁ O DESEMPACOTOU, NÃO FOI?
|
||||
VOCÊ DESEMPACOTOU-O, CONECTOU-O, LIGOU-O E ENCHEU-O DE COISAS,
|
||||
E AGORA A SUA CRIANÇA, A MESMA CRIANÇA QUE UMA VEZ ENFIOU UMA
|
||||
SALSICHA NO SEU VIDEOCASSETE E APERTOU NO "FAST FORWARD", ESTA
|
||||
CRIANÇA ESTÁ BRINCANDO COM OS BOTÕES TAMBÉM CERTO? E SÓ AGORA VOCÊ
|
||||
ESTÁ COMEÇANDO A LER AS INSTRUÇÕES CERTO??? NÓS PODEMOS ENTÃO QUEBRAR
|
||||
ESTES DISPOSITIVOS NA FÁBRICA ANTES DE DESPACHÁ-LOS, VOCÊ
|
||||
SABIA DISSO?
|
||||
-- Dave Barry, "Read This First!"
|
||||
|
||||
|
||||
Descrição
|
||||
=========
|
||||
|
||||
O Window Maker é o gerenciador de janelas GNU para o X Window System. Ele foi
|
||||
desenvolvido para emular o visual e a sensação de parte da GUI NEXTSTEP(tm).
|
||||
Procura ser relativamente rápido e pequeno, rico em opções, fácil de
|
||||
configurar e usar, com uma aparência simples e elegante emprestada do
|
||||
NEXTSTEP(tm).
|
||||
|
||||
O Window Maker foi projetado tendo em mente a integração com o GNUStep e
|
||||
é o gerenciador de janelas "oficial" dele. É ainda parte do projeto GNU
|
||||
(www.gnu.org).
|
||||
Leia mais sobre o GNUstep neste arquivo.
|
||||
|
||||
Hints (informações dadas pelas aplicações para que se integrem bem com o
|
||||
gerenciador de janelas) para Motif(tm), OPEN LOOK(tm), KDE e GNOME também
|
||||
são suportados. Logo, você pode substituir os gerenciadores de janela desses
|
||||
ambientes pelo Window Maker e manter muito, senão toda a funcionalidade do
|
||||
gerenciador de janelas nativo.
|
||||
|
||||
O Window Maker antes se chamava WindowMaker.
|
||||
|
||||
O Window Maker não tem relação com o Windowmaker, o software para construção
|
||||
de janelas e portas.
|
||||
|
||||
|
||||
Documentação
|
||||
============
|
||||
|
||||
Leia antes de perguntar.
|
||||
|
||||
* Os arquivos README distribuídos por toda a árvore dos fontes contêm
|
||||
informações relacionadas ao conteúdo dos diretórios.
|
||||
|
||||
* O INSTALL possui instruções para instalação e algumas dicas quando há
|
||||
algum problema. Você deveria lê-lo antes da instalação. Ele não foi escrito
|
||||
somente para ocupar espaço no pacote...
|
||||
|
||||
* FAQ: Frequently Asked Questions. LEIA! O FAQ.I18N é sobre questões
|
||||
relacionadas à internacionalização.
|
||||
|
||||
* NEWS: lista as mudanças de uma versão para outra e que são visíveis ao
|
||||
usuário. Leia-o se você estiver fazendo uma atualização.
|
||||
|
||||
* MIRRORS: alguns locais alternativos onde você pode pegar o Window Maker,
|
||||
incluindo pacotes do Window Maker específicos para certas plataformas.
|
||||
|
||||
* BUGFORM: use-o para enviar relatos de bug. Use-o por favor.
|
||||
|
||||
* ChangeLog: o que foi mudado a partir da última versão?
|
||||
|
||||
* BUGS: lista dos bugs conhecidos
|
||||
|
||||
|
||||
*** Guia do Usuário
|
||||
|
||||
O Guia do Usuário Window Maker pode ser baixado do ftp oficial ou por
|
||||
sites web. Pode ser visto ainda no formato HTML no:
|
||||
http://people.delphi.com/crc3419/WMUserGuide/index.htm
|
||||
|
||||
O Guia do Usuário explica como usar o Window Maker, fala sobre os
|
||||
arquivos de configuração e as opções.
|
||||
|
||||
*** man pages
|
||||
|
||||
Digite "man wmaker" no prompt da shell para obter uma ajuda geral sobre
|
||||
o Window Maker.
|
||||
|
||||
|
||||
Diretórios & Arquivos na Árvore dos Fontes
|
||||
==========================================
|
||||
|
||||
* O Install é um script para configurar e compilar o Window Maker de
|
||||
um modo fácil (não que o modo normal seja difícil, mas...).
|
||||
|
||||
* AUTHORS: os créditos
|
||||
|
||||
* TODO: planos para o futuro
|
||||
|
||||
* O contrib/ possui alguns patches enviados e que não foram suportados
|
||||
pelo Window Maker por entrarem em conflito com a filosofia de projeto dos
|
||||
desenvolvedores ou por algum outro motivo.
|
||||
|
||||
* O util/ possui vários programas utilitários.
|
||||
|
||||
* O WPrefs.app/ é o programa de configuração.
|
||||
|
||||
* O src/wconfig.h possui opções de compilação que você pode mudar para
|
||||
selecionar algumas opções/aspectos e outras coisas mais.
|
||||
|
||||
* O WINGs/ é a biblioteca de widget NEXTSTEP lookalike
|
||||
|
||||
* A wrlib/ é a biblioteca de processamento de imagens
|
||||
|
||||
* O po/ possui catálogos de mensagens, que são versões traduzidas das
|
||||
mensagens mostradas pelo Window Maker
|
||||
|
||||
* A docklib-x.x.tar.gz é a biblioteca para desenvolvimento de dockapps
|
||||
|
||||
|
||||
SOCORRO!!!
|
||||
==========
|
||||
|
||||
Há uma lista de discussão para debate de questões sobre o Window Maker
|
||||
no wm-user@windowmaker.org. Para inscrever-se, mande uma mensagem
|
||||
contendo:
|
||||
subscribe
|
||||
no campo de assunto da mensagem para wm-user-request@windowmaker.org
|
||||
|
||||
Se você tiver algum problema, pergunte lá (somente depois de ter lido os
|
||||
documentos, é claro). As pessoas da lista estão mais preparadas para
|
||||
resolver o seu problema do que nós. Para relatar BUGS, use o BUGFORM.
|
||||
|
||||
Se você tiver problemas com uma versão pré-compilada do Window
|
||||
Maker (rpm, deb etc), primeiro questione a pessoa que criou o pacote.
|
||||
|
||||
NOTA IMPORTANTE: quando for pedir ajuda (seja na lista de discussão ou
|
||||
diretamente aos desenvolvedores) *sempre* envie informações sobre o sistema
|
||||
que você está usando. Você pode usar a seção system information no final
|
||||
do BUGFORM como guia. Outra coisa: não mande mensagens em HTML.
|
||||
|
||||
Há ainda o canal de IRC #windowmaker na EFNET. Para entrar lá, conecte
|
||||
seu cliente de irc no irc.concentric.net, irc.prison.net ou outro
|
||||
servidor dessa rede.
|
||||
|
||||
|
||||
GNUstep
|
||||
=======
|
||||
|
||||
O GNUstep é um completo sistema de desenvolvimento orientado a objetos,
|
||||
baseado na especificação OpenStep lançada pela NeXT(tm) (agora Apple(tm) e
|
||||
Sun(tm)). Ele irá fornecer tudo que é necessário para desenvolver aplicações
|
||||
orientadas a objetos, gráficas (e não gráficas), cross-platform; fornecendo,
|
||||
dentre outras coisas, bibliotecas bases do sistema, uma estrutura de alto
|
||||
nível para aplicações GUI que usa um modelo de imagens do tipo Display
|
||||
PostScript(tm), objetos para acesso a bancos de dados relacional, objetos
|
||||
distribuídos e um ambiente de desenvolvimento gráfico, com ferramentas como
|
||||
um modelador de interfaces, um projeto de gerenciamento de sistema (central
|
||||
de projetos) e outras ferramentas.
|
||||
|
||||
O sistema de desenvolvimento GNUstep será usado para criar um ambiente
|
||||
de usuário, com tudo necessário para uma interface gráfica, tais como
|
||||
visualizador de arquivos, editores de texto e outras aplicações. Note que o
|
||||
ambiente do usuário (ou "ambiente desktop") é somente uma pequena parte de
|
||||
todo o projeto GNUstep e não "compete" com projetos como o KDE e o GNOME,
|
||||
simplesmente por que eles são coisas completamente diferentes.
|
||||
|
||||
Para mais informação sobre o projeto GNUstep, visite http://www.gnustep.org
|
||||
e http://gnustep.current.nu
|
||||
|
||||
|
||||
Executando múltiplas instâncias do Window Maker
|
||||
===============================================
|
||||
|
||||
Não é uma boa idéia rodar mais de uma instância do Window Maker sob
|
||||
um mesmo usuário ao mesmo tempo (já que o wmaker usa os mesmos arquivos
|
||||
de configuração). Você pode obter comportamentos inesperados quando o
|
||||
Window Maker atualizar os seus arquivos de configuração.
|
||||
|
||||
|
||||
Suporte para som
|
||||
================
|
||||
|
||||
O Som é suportado nos sistemas Linux e FreeBSD com o uso de módulos
|
||||
distribuídos separadamente. Você pode baixá-los no:
|
||||
http://www.frontiernet.net/~southgat/wmsound
|
||||
|
||||
Observe que você deve compilar o Window Maker usando o configure com a
|
||||
flag --enable-sound e definindo a opção DisableSound para NO.
|
||||
|
||||
|
||||
Suporte ao OpenL**k
|
||||
===================
|
||||
|
||||
Acredito que muitos usuários, principalmente os do mundo acadêmico,
|
||||
tenham que usar aplicações escritas em toolkits OpenL**k, então o suporte
|
||||
para estes aplicativos deve ser de algum uso.
|
||||
|
||||
Para ativar, use o --enable-openlook quando rodar o configure. Note
|
||||
que nem tudo está implementado.
|
||||
|
||||
As opções implementadas incluem hints de decoração e o push-pin.
|
||||
Coisas não implementadas incluem _SUN_WINDOW_STATE (the compose led
|
||||
state stuff), coisas relacionadas ao "drag and drop", cabeçalho (não
|
||||
tenho certeza do que é) e o string footer.
|
||||
|
||||
Por favor me dêem retorno se algo não funcionar. Se a opção já está
|
||||
implementada, mas não está funcionando por causa de um bug, eu tentarei
|
||||
corrigí-la. Se é uma característica ainda não implementada e você mencionar
|
||||
que é importante (ie: não somente cosmética), eu considerarei a sua
|
||||
implementação.
|
||||
|
||||
O estado "out" do pushpin é emulado como um botão de fechar pressionado.
|
||||
Clique no botão para fazer com que ele fique despressionado, o que
|
||||
corresponde ao estado "pinned-in" do pushpin. Se você pressionar de novo
|
||||
o botão de fechar despressionado, ele vai agir como um botão de fechar
|
||||
normal: vai fechar a janela.
|
||||
|
||||
|
||||
Ajuste da Performance
|
||||
====================
|
||||
|
||||
Se você deseja diminuir o uso de memória pelo Window Maker, aumentar a
|
||||
performance, e ainda manter uma boa aparência e funcionalidade, siga os
|
||||
itens abaixo:
|
||||
|
||||
- use texturas sólidas para tudo, barras de títulos e menus. Se você quer
|
||||
um desktop com um belo visual, use o estilo "Traditional".
|
||||
- desligue o "NewStyle" e o "Superfluous"
|
||||
- não vincule muitos atalhos ao seu menu e guarde somente coisas essenciais
|
||||
no menu
|
||||
- ative o "DisableClip"
|
||||
- edite o wconfig.h e desative o NUMLOCK_HACK e as opções que você não
|
||||
usa mesmo (tenha em mente que alguns dos #defines podem não funcionar,
|
||||
já que eles não estão completamente suportados). Certifique-se de sempre
|
||||
manter o NumLock e o ScrollLock desligados.
|
||||
- ligue a opção "DisableAnimations". Você pode também usar o #undefine
|
||||
ANIMATIONS no arquivo config.h
|
||||
- verifique as entradas padrão "IconPath" e "PixmapPath" para que contenham
|
||||
somente os paths que você realmente possua no seu sistema.
|
||||
- não use imagens grandes no seu background root
|
||||
- remova o suporte para formatos de imagens que você não usa
|
||||
- para reduzir o uso de memória, desative o cache de ícones, definindo a
|
||||
variável de ambiente RIMAGE_CACHE para 0. Se você deseja melhorar o
|
||||
desempenho perdendo só um pouco de memória, defina essa variável para
|
||||
o valor correspondente ao número de ícones que você usa.
|
||||
|
||||
|
||||
Controle de Mouse pelo Teclado
|
||||
==============================
|
||||
|
||||
Muitas pessoas perguntam sobre adicionar o controle do mouse pelo teclado,
|
||||
como no fvwm, mas o Window Maker não possui tal opção. A extensão XKB
|
||||
suporta a simulação do mouse pelo teclado, de uma maneira muito mais
|
||||
poderosa do que qualquer outra simulação realizada por um gerenciador de
|
||||
janelas.
|
||||
|
||||
Para ativá-la, aperte a combinação Control+Shift+NumLock ou Shift+NumLock.
|
||||
Você deve então ouvir um beep. Para desativá-la, faça a mesma coisa.
|
||||
|
||||
Para controlar com o mouse, use as seguintes teclas do keypad:
|
||||
- 4 (seta esquerda), 7 (Home), 8 (seta para cima), 9 (PgUp), 6 (seta direita),
|
||||
3 (PgDn), 2 (seta para baixo) e 1 (End) move o mouse para as direções
|
||||
correspondentes;
|
||||
- segurar as teclas acima e depois segurar a tecla 5 vai fazer o ponteiro
|
||||
se mover mais rápido;
|
||||
- / vai selecionar o primeiro botão do mouse (botão esquerdo);
|
||||
- * vai selecionar o segundo botão do mouse (botão do meio);
|
||||
- - vai selecionar o terceiro botão do mouse (botão direito);
|
||||
- 5 vai fazer um clique com o botão do mouse que foi selecionado;
|
||||
- + vai fazer um duplo-clique com o botão do mouse que foi selecionado;
|
||||
- 0 (Ins) vai clicar e segurar o botão do mouse selecionado;
|
||||
- . (Del) vai liberar o botão do mouse selecionado que foi previamente
|
||||
clicado com a tecla 0 (Ins).
|
||||
|
||||
Os valores das teclas acima funcionam com um servidor X XFree86 3.2 (X11R6.1)
|
||||
mas nosso alcance pode variar.
|
||||
|
||||
|
||||
Como fazer um backtrace com o gdb
|
||||
=================================
|
||||
|
||||
Os backtraces nos ajudam a arrumar bugs que fazem com que o Window Maker
|
||||
trave. Se você achar um bug que trave o Window Maker, por favor envie o
|
||||
backtrace com o relato do bug.
|
||||
|
||||
Para fazer um backtrace útil, você precisa de um arquivo core
|
||||
com informações de depuração produzidas pelo Window Maker quando ele
|
||||
travar. O padrão do Window Maker é iniciar um outro gerenciador
|
||||
de janelas quando ele travar, o que não gerará um arquivo core. Você
|
||||
precisa editar o arquivo src/wconfig.h *depois* de ter rodado o configure
|
||||
e mudar a linha que se parece com o seguinte:
|
||||
|
||||
#undef NO_EMERGENCY_AUTORESTART
|
||||
|
||||
para:
|
||||
|
||||
#define NO_EMERGENCY_AUTORESTART
|
||||
|
||||
Depois, no diretório src, digite:
|
||||
make clean
|
||||
make CFLAGS=-g
|
||||
make install
|
||||
|
||||
e espere o Window Maker ser instalado.
|
||||
|
||||
Depois de instalado o Window Maker, inicie o X e reproduza o bug fazendo
|
||||
com que o Window Maker trave. Quando ele travar, vá até o diretório
|
||||
onde você compilou o wmaker e digite o seguinte comando na sua shell:
|
||||
|
||||
script
|
||||
cd src
|
||||
gdb .libs/wmaker path_ao_arquivo_core
|
||||
|
||||
Depois, no prompt do gdb, digite "bt". Saia do gdb digitando "quit"
|
||||
e depois no prompt da shell, digite "exit".
|
||||
|
||||
O arquivo chamado typescript conterá o backtrace.
|
||||
|
||||
|
||||
|
||||
Direitos Autorais & Disclaimers
|
||||
===============================
|
||||
|
||||
O Window Maker é registrado por Alfredo K. Kojima e é licenciado pela Licença
|
||||
Pública Geral GNU. Leia o arquivo COPYING para ler a licença completa.
|
||||
|
||||
Os ícones que são distribuídos com esse programa foram criados por Marco
|
||||
van Hylckama Vlieg são licenciados pela OpenContent License. Leia o
|
||||
arquivo COPYING.OPL para a licença completa.
|
||||
|
||||
NeXT, OpenStep e NEXTSTEP são marcas da NeXT Computer, Inc.
|
||||
Todas as outras marcas são propriedade dos respectivos donos.
|
||||
|
||||
Os autores se reservam no direito de fazer alterações no software sem
|
||||
qualquer aviso prévio.
|
||||
|
||||
|
||||
Autores
|
||||
=======
|
||||
|
||||
Alfredo K. Kojima <kojima@windowmaker.org>
|
||||
Dan Pascu <dan@windowmaker.org>
|
||||
]d <id@windowmaker.org>
|
||||
|
||||
Por favor não nos perguntem coisas antes de ler a documentação (o FAQ,
|
||||
este arquivo e os arquivos INSTALL), ou sobre coisas "legais" que você
|
||||
viu em screenshots de desktops.
|
||||
|
||||
O arquivo AUTHORS contem uma lista de pessoas que contribuíram com o projeto.
|
||||
O nome das pessoas que ajudaram com a tradução pode ser achado no po/README e
|
||||
Window Maker/README
|
||||
|
||||
Se você tem algum comentário, correção ou deseja relatar bugs (junto com
|
||||
o BUGFORM) mande-os para developers@windowmaker.org
|
||||
|
||||
|
||||
Traduzido por: Ricardo Sartori <sartori@inf.ufsc.br>
|
||||
56
TODO
56
TODO
@@ -1,50 +1,58 @@
|
||||
remake wrlib rule to not compile with -fomit-frame-pointer and stuff
|
||||
if its added to CFLAGS
|
||||
|
||||
Do ASAP:
|
||||
========
|
||||
- fix bestvisual selection code. Broken.
|
||||
- add a dialog to let user choose if we should restart, restart twm or continue crashing on crash. Do not forget to check if wmaker is already fully running.
|
||||
- fix stacking. buggy again
|
||||
+ ICCCM compliant stuff: find what is missing
|
||||
- WM_COLORMAP_NOTIFY clientmessage
|
||||
- fix RemakeStackList() to account for transient windows
|
||||
- change CommitStacking() on AddToStackingList() to more optimized thing
|
||||
- differential update of appmenu
|
||||
- make unhide app map windows in the same stacking order they were before
|
||||
hiding
|
||||
- blink border of clients with UrgencyHint set between red and black
|
||||
- finish session stuff
|
||||
- add multiline support for balloons
|
||||
- remove colors_per_channel stuff from wmaker after?
|
||||
|
||||
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
|
||||
- rewrite all redundant stuff to use WINGs
|
||||
- resizebartexture option
|
||||
- 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.
|
||||
- clickonclientarearaisewindow
|
||||
- edge resistance (with timer)
|
||||
- save client supplied icons in ~/GNUstep/.AppInfo/ClientIcons/ and
|
||||
use them by default
|
||||
- GNUstepWMAttributes update in propertynotify
|
||||
+ investigate memory leaks
|
||||
- make Docked apps with WM_CLIENT_MACHINE be launched from respective
|
||||
machines (also put a marking showing it's remote launched)
|
||||
- handle change of CLIENT_LEADER property
|
||||
- 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 wc?
|
||||
- -statefile cmd arg to specify path for WMState file (multiple instance
|
||||
support)
|
||||
- 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
|
||||
- fix the #define MIN(a,b) stuff. defined in too many places, and maybe
|
||||
replace with WMIN(a,b).
|
||||
|
||||
Maybe some day:
|
||||
===============
|
||||
- virtual desktop
|
||||
- virtual workspace
|
||||
- optimize for size
|
||||
- make dithering in 8bpp better
|
||||
|
||||
|
||||
Never: (so, dont even bother to ask)
|
||||
======
|
||||
- different themes for each workspace. Unless you give us a SGI/Power Onyx
|
||||
with 2 CPUs ;). Different workspacebacks for each workspace is being
|
||||
considered, but don't hold your breath.
|
||||
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...
|
||||
|
||||
|
||||
- ICCCM 2.0: ICCCM 2.0 (not 1.0, which is what everybody supports so so) is
|
||||
a relatively new standard and nobody, AFAIK, complies with it (not even
|
||||
twm as people tend to think). It has some neat things, but many of the new
|
||||
stuff is really weird and tricky to implement, not to say unworthy (read the
|
||||
specs and you'll see). This is not bad, since I think it is very unlikely
|
||||
that a client that requires it exists... Anyway, if we get an "official"
|
||||
sample implementation (twm?) it might be supported. Maybe dtwm supports
|
||||
it? I dont know...
|
||||
|
||||
|
||||
|
||||
5
WINGs/.cvsignore
Normal file
5
WINGs/.cvsignore
Normal file
@@ -0,0 +1,5 @@
|
||||
Makefile Makefile.in
|
||||
get-wings-flags get-wutil-flags
|
||||
.libs
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
3
WINGs/BUGS
Normal file
3
WINGs/BUGS
Normal file
@@ -0,0 +1,3 @@
|
||||
- filepanel does not reread / . If you add new files in / they will not be
|
||||
visible until the program is restarted. Closing and reopening the file
|
||||
panel does not help.
|
||||
359
WINGs/ChangeLog
359
WINGs/ChangeLog
@@ -1,3 +1,362 @@
|
||||
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 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:
|
||||
............................
|
||||
|
||||
- WARNING: semantic of bags has changed!
|
||||
An index assigned to an item will always keep that index unless
|
||||
you insert an item before it.
|
||||
|
||||
For example:
|
||||
bag = WMCreateBag();
|
||||
WMSetInBag(bag, 10, "bla");
|
||||
That code will put "bla" in index 10, instead of 0, as it used to be.
|
||||
- fixed WMInsertInBag(). It ignored index, and always put the new item at end.
|
||||
- added WMSaveUserDefaults().
|
||||
- rewrote WMPopUpButton to use WMMenuItem
|
||||
- added WMGetPopUpButtonMenuItem(WMPopUpButton *bPtr, int index)
|
||||
- WMSortListItemsWithComparer(WMList *lPtr, (int)(f)(const void*, const void*))
|
||||
- WMSortBrowserColumnWithComparer()
|
||||
- fixed bug with sorting list items.
|
||||
- fixed bug in handling keyboard input associated with selection and
|
||||
notification sending.
|
||||
- filepanel puts dirs on top of list (Wolff <wolff@cybercable.fr>)
|
||||
- added WMReplaceInBag (Wolff <wolff@cybercable.fr>)
|
||||
- added vertical views and multiple views in WMSplitView (Wolff <wolff@cybercable.fr>)
|
||||
- changed values of parameter values of WMSplitViewConstrainProc()
|
||||
- configurable default fontsize patch (Igor P. Roboul <igor@mordor.myip.org>)
|
||||
- fixed a bug that crashed the programm when a popup button was scrolled.
|
||||
- fixed a bug that caused incorrect drawing position of the popup indicator.
|
||||
- fixed a bug that prevented selecting no item (-1) in a popup button.
|
||||
- an assertion will be raised if the program tries to select a popup button
|
||||
item that is beyond the total number of items present in the popup button.
|
||||
- changed names of functions for SplitView to be consistent. Some contained
|
||||
SubView while other Subview. Now all have Subview.
|
||||
- fixed a bug in how input events were posted. Establishing 2 or more input
|
||||
handlers for the same file descriptor, handling different (read/write/except)
|
||||
events, caused wrong handlers to be called.
|
||||
- Reimplemented the input and idle handlers with WMBag to avoid a functional
|
||||
problem with them: inability to remove handlers next to the called one, from
|
||||
the called handler itself. Trying to do this with the old version caused the
|
||||
program to crash.
|
||||
- changed wrealloc behaviour to be like this: new = wrealloc(old, new_size);
|
||||
1. if old is NULL, return wmalloc(new_size).
|
||||
2. if new_size is 0, call wfree(old), and return NULL.
|
||||
3. if both old is a valid pointer and new_size>0, call realloc.
|
||||
- added wstrerror(int errnum) to return the string associated with errnum.
|
||||
- new wsyserrorwithcode(int error, const char* fmt, ...), similar to
|
||||
wsyserror(), but printing the message for the specified error code.
|
||||
- added 3 new classes: WMData, WMHost and WMConnection
|
||||
- fixed a big memory leak in the color panel code (from Pascal Hofstee).
|
||||
- added scrolling to tabview
|
||||
|
||||
changes since wmaker 0.61.0:
|
||||
............................
|
||||
|
||||
- added WMGetTextFieldFont()
|
||||
- escape key in panels (craig nellist <crn@ozemail.com.au>)
|
||||
- applied patch with fixes and enhancements to textfield
|
||||
(Franck Wolff <wolff@cybercable.fr>)
|
||||
- changed WMList to use WMBag internally, instead of a linked list
|
||||
- replaced WMAddSortedListItem() with WMSortListItems()
|
||||
- replaced WMAddSortedBrowserItem() with WMSortBrowserColumn()
|
||||
|
||||
changes since wmaker 0.60.0:
|
||||
............................
|
||||
|
||||
- added WMScreenWidth() and WMScreenHeight() functions.
|
||||
- fixed some problems when compiling with non gcc compilers.
|
||||
- added WMSetTextFieldFont()
|
||||
- added WMSetButtonImageDefault() (craig nellist <crn@ozemail.com.au>)
|
||||
- added WMBag (array/list)
|
||||
- added libWUtil, a library that is a subset of libWINGs. It contains utils
|
||||
that can be used in writing non-GUI programs. They include: hashes,
|
||||
notifications, input/idle/timer handlers, user defaults database handling,
|
||||
memory handling, application resource handling, etc.
|
||||
All the non-GUI stuff from libWINGs is present.
|
||||
Still linWINGs contain all this stuff so if you use libWINGs, you don't
|
||||
need to link against libWUtil too.
|
||||
One notable aspect of libWUtil is that it has a modified version of the
|
||||
event handling function. It is named WHandleEvents() and will handle all
|
||||
input/idle/timer events the app has.
|
||||
If your app has a permanent input handler (as for example a socket a server
|
||||
is listening on), then the main loop of the app can be:
|
||||
while(1) {
|
||||
WHandleEvents();
|
||||
}
|
||||
but if there is no permanent input handler, you need to add some delay to
|
||||
avoid a too high cpu load by your program:
|
||||
while(1) {
|
||||
WHandleEvents();
|
||||
wusleep(5000);
|
||||
}
|
||||
A permanent input handler is one that is established when the program starts
|
||||
and is present until the program exits.
|
||||
One that is deleted and later reinstalled, is not considered permanent.
|
||||
This difference is because if there is some input handler, the function will
|
||||
block until some event appears, while if there is no input handler the
|
||||
function will return almost immediately (after handling the timer/idle
|
||||
stuff).
|
||||
|
||||
Except the stuff declared in WUtil.h, the following functions declared in
|
||||
WINGs.h are also present in libWUtil (you will need to #include <WINGs.h>
|
||||
if you use one of these):
|
||||
WMInitializeApplication(char *applicationName, int *argc, char **argv);
|
||||
WMSetResourcePath(char *path);
|
||||
WMGetApplicationName();
|
||||
WMPathForResourceOfType(char *resource, char *ext);
|
||||
WMAddTimerHandler(int milliseconds, WMCallback *callback, void *cdata);
|
||||
WMDeleteTimerWithClientData(void *cdata);
|
||||
WMDeleteTimerHandler(WMHandlerID handlerID);
|
||||
WMAddIdleHandler(WMCallback *callback, void *cdata);
|
||||
WMDeleteIdleHandler(WMHandlerID handlerID);
|
||||
WMAddInputHandler(int fd, int condition, WMInputProc *proc,
|
||||
void *clientData);
|
||||
WMDeleteInputHandler(WMHandlerID handlerID);
|
||||
- added progress indicator widget
|
||||
- Changed WMSetWindowUPosition() and WMSetWindowUSize() to
|
||||
WMSetWindowInitialPosition() and WMSetWindowInitialSize() respectively,
|
||||
for better naming conventions.
|
||||
|
||||
|
||||
changes since wmaker 0.53.0:
|
||||
............................
|
||||
|
||||
- added balloon help
|
||||
- fixed a bug with setting initial path in browsers.
|
||||
- added WMSetButtonImageDimsWhenDisabled()
|
||||
- changed simple callback/notifications to delegate-like stuff. Affected
|
||||
widgets are:
|
||||
WMBrowser
|
||||
- WMSetBrowserFillProc() was replaced with WMSetBrowserDelegate
|
||||
- WMBrowserDidScrollNotification was replaced with a delegate callback
|
||||
|
||||
WMTextField (not completed yet)
|
||||
The notifications will still work, but using the delegate is preferable
|
||||
|
||||
How to convert old code to delegate callbacks:
|
||||
1 - create a variable (static or dynamic) of the type of the
|
||||
delegate for the widget type.
|
||||
2 - Replace the notification observers with the equivalent
|
||||
delegate callbacks.
|
||||
3 - Put pointers to the callbacks in the delegate variable.
|
||||
|
||||
Take a look in wfilepanel.c to see how it is used there.
|
||||
|
||||
- changed W_ViewProcedureTable to delegates
|
||||
This will only affect user created widgets. If you have a custom
|
||||
widget, you will need to update the callbacks and the declaration
|
||||
of the W_ViewProcedureTable variable to be a W_ViewDelegate,
|
||||
which is declared in WINGsP.h To setup the delegate, assign
|
||||
the delegate variable to view->delegate.
|
||||
|
||||
- WMTextField
|
||||
Removed all the didChange notifications that were sent when the text
|
||||
was changed programmatically. Only changes made by user interaction
|
||||
will be notified now. If you need the old behaviour, send notifications
|
||||
manually when you change the text.
|
||||
|
||||
- added WMTabView
|
||||
- added WMGetColorPanelColor(WMColorPanel *panel)
|
||||
- made WMGetUDStringForKey() to only return a reference to the string, not a
|
||||
wstrdup()'ed copy. DO NOT FREE IT ANYMORE!
|
||||
- added MultiByteText option to userdefaults file to control use of multibyte
|
||||
string drawing functions
|
||||
- renamed WMCreateFont() to WMCreateFontSet()
|
||||
- renamed WMCreateFontInDefaultEncoding() to WMCreateNormalFont()
|
||||
- added WMCreateFont() with different semantics
|
||||
|
||||
|
||||
changes since wmaker 0.52.0:
|
||||
............................
|
||||
|
||||
- added int WMGetBrowserMaxVisibleColumns(WMBrowser *bPtr);
|
||||
|
||||
|
||||
changes since wmaker 0.51.2:
|
||||
............................
|
||||
|
||||
- added WMColorWellDidChangeNotification
|
||||
- added wfindfileinarray()
|
||||
- fixed bug in window title setting
|
||||
(MANOME Tomonori <manome@itlb.te.noda.sut.ac.jp>)
|
||||
|
||||
changes since wmaker 0.51.1:
|
||||
............................
|
||||
|
||||
- wusergnusteppath() will return a statically allocated string now.
|
||||
DO NOT FREE IT ANYMORE!!
|
||||
|
||||
|
||||
|
||||
changes since wmaker 0.51.0:
|
||||
............................
|
||||
|
||||
- applied c++ compat header patch from Martynas Kunigelis <mkunigelis@alna.lt>
|
||||
- added WMSetTextFieldBeveled()
|
||||
- removed W_GC() : use WMColorGC() instead
|
||||
- added WMCreatePixmap()
|
||||
- changed WMSetTextFieldEnabled() to WMSetTextFieldEditable()
|
||||
|
||||
changes since wmaker 0.50.1:
|
||||
............................
|
||||
|
||||
- fixed various bugs
|
||||
- added patch from Franck Wolff <frawolff@club-internet.fr>, with
|
||||
many fixes and enhancements
|
||||
- added notification queues, asynchronous notifications etc.
|
||||
- added WMSetBrowserDoubleAction()
|
||||
- fixed list double click action
|
||||
|
||||
changes since wmaker 0.50.2:
|
||||
............................
|
||||
|
||||
- added wsetabort() - look WUtil.h
|
||||
- fixed bug in WMList resize
|
||||
- added notification sending when changing textfield programatically
|
||||
- removed WMHideWindow()
|
||||
- fixed bug in WMCloseWindow()
|
||||
- added textfield selection patch
|
||||
- added color panel code
|
||||
- added auto name completion for the file panel
|
||||
- added function to select text range, and to set cursor position in text
|
||||
fields programatically
|
||||
|
||||
changes since wmaker 0.20.3:
|
||||
............................
|
||||
|
||||
- added WMSetSliderImage(), WMSetSliderKnobThickness()
|
||||
- added WMGetListItemHeight()
|
||||
- added WMListDidScrollNotification
|
||||
- added WSetColorWellBordered()
|
||||
- added hacky color dragging in colorwell
|
||||
- added poll() support in WMNextEvent. WARNING: the stuff needed for
|
||||
WMAddInputHandler() is not yet implemented for the poll stuff
|
||||
- added WMSetFilePanelAccessoryView(), WMGetFilePanelAccessoryView()
|
||||
- added WMSetPopUpButtonEnabled()
|
||||
- added WMGetLabelImage()
|
||||
- autoscroll for popup button menus
|
||||
- added WMDrawPixmap()
|
||||
- WARNING: changed parameter list for WMListDrawProc
|
||||
|
||||
changes since wmaker 0.20.2:
|
||||
............................
|
||||
|
||||
- WMSetBrowserMaxVisibleColumns() - untested
|
||||
|
||||
|
||||
|
||||
changes since wmaker 0.20.0:
|
||||
............................
|
||||
|
||||
- added generic object field for WMListItem. This is for hanging generic
|
||||
clientdata
|
||||
|
||||
|
||||
changes since wmaker 0.20.0:
|
||||
............................
|
||||
|
||||
|
||||
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
|
||||
|
||||
47
WINGs/Documentation/README.connection
Normal file
47
WINGs/Documentation/README.connection
Normal file
@@ -0,0 +1,47 @@
|
||||
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 a bag, and destroy all
|
||||
the connections present in the bag, in your main loop, after you call the
|
||||
WHandleEvents()/WMHandleEvent(). Also closing the connection can be done
|
||||
before putting the connection in the bag, but is optional as noted above.
|
||||
In this case you need to make sure you don't put in the 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 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 fontl puzzle
|
||||
.libs
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
26
WINGs/Examples/Makefile.am
Normal file
26
WINGs/Examples/Makefile.am
Normal file
@@ -0,0 +1,26 @@
|
||||
## automake input file for WINGs - Examples
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
|
||||
noinst_PROGRAMS = connect fontl puzzle
|
||||
|
||||
|
||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
||||
@LIBPL@
|
||||
|
||||
|
||||
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@ @LIBPL@
|
||||
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/WINGs -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||
|
||||
|
||||
209
WINGs/Examples/connect.c
Normal file
209
WINGs/Examples/connect.c
Normal file
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* WINGs connect.c: example how to create a network client using WMConnection
|
||||
*
|
||||
* Copyright (c) 1999 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.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WINGs.h"
|
||||
|
||||
|
||||
|
||||
static int initialized = 0;
|
||||
|
||||
|
||||
|
||||
static void didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
static void connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
static void didInitialize(ConnectionDelegate *self, WMConnection *cPtr);
|
||||
|
||||
|
||||
|
||||
static ConnectionDelegate socketDelegate = {
|
||||
NULL, /* data */
|
||||
NULL, /* didCatchException */
|
||||
connectionDidDie, /* didDie */
|
||||
didInitialize, /* didInitialize */
|
||||
didReceiveInput, /* didReceiveInput */
|
||||
NULL /* didTimeout */
|
||||
};
|
||||
|
||||
|
||||
|
||||
void
|
||||
wAbort(Bool foo) /*FOLD00*/
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
static char*
|
||||
getMessage(WMConnection *cPtr)
|
||||
{
|
||||
char *buffer;
|
||||
WMData *aData;
|
||||
int length;
|
||||
|
||||
aData = WMGetConnectionAvailableData(cPtr);
|
||||
if (!aData)
|
||||
return NULL;
|
||||
if ((length=WMGetDataLength(aData))==0) {
|
||||
WMReleaseData(aData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buffer = (char*)wmalloc(length+1);
|
||||
WMGetDataBytes(aData, buffer);
|
||||
buffer[length]= '\0';
|
||||
WMReleaseData(aData);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
inputHandler(int fd, int mask, void *clientData)
|
||||
{
|
||||
WMConnection *cPtr = (WMConnection*)clientData;
|
||||
WMData *aData;
|
||||
char buf[4096];
|
||||
int n;
|
||||
|
||||
if (!initialized)
|
||||
return;
|
||||
|
||||
n = read(fd, buf, 4096);
|
||||
if (n>0) {
|
||||
aData = WMCreateDataWithBytes(buf, n);
|
||||
WMSendConnectionData(cPtr, aData);
|
||||
WMReleaseData(aData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
didReceiveInput(ConnectionDelegate *self, WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
char *buffer;
|
||||
|
||||
buffer = getMessage(cPtr);
|
||||
if (!buffer) {
|
||||
fprintf(stderr, "Connection closed by peer.\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
printf("%s", buffer);
|
||||
|
||||
wfree(buffer);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
connectionDidDie(ConnectionDelegate *self, WMConnection *cPtr) /*FOLD00*/
|
||||
{
|
||||
WMCloseConnection(cPtr);
|
||||
|
||||
fprintf(stderr, "Connection closed by peer.\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
didInitialize(ConnectionDelegate *self, WMConnection *cPtr)
|
||||
{
|
||||
int state = WMGetConnectionState(cPtr);
|
||||
WMHost *host;
|
||||
|
||||
if (state == WCConnected) {
|
||||
host = WMGetHostWithAddress(WMGetConnectionAddress(cPtr));
|
||||
fprintf(stderr, "connected to '%s:%s'\n",
|
||||
host?WMGetHostName(host):WMGetConnectionAddress(cPtr),
|
||||
WMGetConnectionService(cPtr));
|
||||
initialized = 1;
|
||||
if (host)
|
||||
WMReleaseHost(host);
|
||||
return;
|
||||
} else {
|
||||
wsyserrorwithcode(WCErrorCode, "Unable to connect");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv) /*FOLD00*/
|
||||
{
|
||||
char *ProgName, *host, *port;
|
||||
int i;
|
||||
WMConnection *sPtr;
|
||||
|
||||
wsetabort(wAbort);
|
||||
|
||||
WMInitializeApplication("connect", &argc, argv);
|
||||
|
||||
ProgName = strrchr(argv[0],'/');
|
||||
if (!ProgName)
|
||||
ProgName = argv[0];
|
||||
else
|
||||
ProgName++;
|
||||
|
||||
host = NULL;
|
||||
port = "7000";
|
||||
|
||||
if (argc>1) {
|
||||
for (i=1; i<argc; i++) {
|
||||
if (strcmp(argv[i], "--help")==0 || strcmp(argv[i], "-h")==0) {
|
||||
printf("usage: %s [host [port]]\n\n", ProgName);
|
||||
exit(0);
|
||||
} else {
|
||||
if (!host)
|
||||
host = argv[i];
|
||||
else
|
||||
port = argv[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("Trying to make connection to '%s:%s'\n",
|
||||
host?host:"localhost", port);
|
||||
|
||||
sPtr = WMCreateConnectionToAddressAndNotify(host, port, NULL);
|
||||
if (!sPtr) {
|
||||
wfatal("could not create connection. exiting");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
WMSetConnectionDelegate(sPtr, &socketDelegate);
|
||||
|
||||
/* watch what user types and send it over the connection */
|
||||
WMAddInputHandler(0, WIReadMask, inputHandler, sPtr);
|
||||
|
||||
while (1) {
|
||||
WHandleEvents();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
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.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;
|
||||
}
|
||||
3
WINGs/Extras/.cvsignore
Normal file
3
WINGs/Extras/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
Makefile Makefile.in
|
||||
.libs
|
||||
test
|
||||
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 \
|
||||
@LIBPL@
|
||||
|
||||
test_LDADD = wtableview.o wtabledelegates.o $(LDADD)
|
||||
|
||||
137
WINGs/Extras/test.c
Normal file
137
WINGs/Extras/test.c
Normal file
@@ -0,0 +1,137 @@
|
||||
|
||||
|
||||
#include <WINGs.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++) {
|
||||
col1[i] = "teste";
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
Display *dpy = XOpenDisplay("");
|
||||
WMScreen *scr;
|
||||
WMWindow *win;
|
||||
WMTableView *table;
|
||||
WMTableColumn *col;
|
||||
WMTableColumnDelegate *colDeleg;
|
||||
|
||||
WMInitializeApplication("test", &argc, argv);
|
||||
|
||||
|
||||
|
||||
dpy = XOpenDisplay("");
|
||||
if (!dpy) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
scr = WMCreateScreen(dpy, DefaultScreen(dpy));
|
||||
|
||||
|
||||
win = WMCreateWindow(scr, "eweq");
|
||||
WMResizeWidget(win, 400, 200);
|
||||
WMMapWidget(win);
|
||||
|
||||
table = WMCreateTableView(win);
|
||||
WMResizeWidget(table, 400, 200);
|
||||
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);
|
||||
|
||||
}
|
||||
626
WINGs/Extras/wtabledelegates.c
Normal file
626
WINGs/Extras/wtabledelegates.c
Normal file
@@ -0,0 +1,626 @@
|
||||
|
||||
|
||||
#include <WINGs.h>
|
||||
|
||||
#include "wtableview.h"
|
||||
|
||||
#include "wtabledelegates.h"
|
||||
|
||||
typedef struct {
|
||||
WMTableView *table;
|
||||
WMFont *font;
|
||||
GC gc;
|
||||
GC selGc;
|
||||
GC selTextGc;
|
||||
} StringData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMTableView *table;
|
||||
GC selGc;
|
||||
} PixmapData;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMTextField *widget;
|
||||
WMTableView *table;
|
||||
WMFont *font;
|
||||
GC gc;
|
||||
GC selGc;
|
||||
GC selTextGc;
|
||||
} StringEditorData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMPopUpButton *widget;
|
||||
WMTableView *table;
|
||||
WMFont *font;
|
||||
char **options;
|
||||
int count;
|
||||
GC gc;
|
||||
GC selGc;
|
||||
GC selTextGc;
|
||||
} EnumSelectorData;
|
||||
|
||||
|
||||
typedef struct {
|
||||
WMButton *widget;
|
||||
WMTableView *table;
|
||||
Bool state;
|
||||
GC gc;
|
||||
} 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) {
|
||||
XClearArea(dpy, d, rects[0].x, rects[0].y,
|
||||
rects[0].width, rects[0].height,
|
||||
False);
|
||||
|
||||
WMDrawString(scr, d, gc, 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,
|
||||
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) {
|
||||
XClearArea(dpy, d, rects[0].x, rects[0].y,
|
||||
rects[0].width, rects[0].height,
|
||||
False);
|
||||
|
||||
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, 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);
|
||||
}
|
||||
}
|
||||
|
||||
XSetClipMask(dpy, gc, None);
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
|
||||
static void SECellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
StringEditorData *strdata = (StringEditorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGc, strdata->selTextGc, strdata->font,
|
||||
WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedSECellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
StringEditorData *strdata = (StringEditorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGc, strdata->selTextGc, 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->selTextGc = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMBlackColor(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)
|
||||
{
|
||||
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
|
||||
stringDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGc, strdata->selTextGc, strdata->font,
|
||||
strdata->options[i],
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedESCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
EnumSelectorData *strdata = (EnumSelectorData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
|
||||
stringDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGc, strdata->selTextGc, 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->selTextGc = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMBlackColor(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)
|
||||
{
|
||||
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
|
||||
if (i) {
|
||||
pixmapDraw(scr, WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, WMGetSystemPixmap(scr, WSICheckMark),
|
||||
WMTableViewRectForCell(table, column, row), False);
|
||||
} else {
|
||||
pixmapDraw(scr, WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, NULL,
|
||||
WMTableViewRectForCell(table, column, row), False);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void selectedBSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
BooleanSwitchData *strdata = (BooleanSwitchData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
int i = (int)WMTableViewDataForCell(table, column, row);
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
|
||||
if (i) {
|
||||
pixmapDraw(scr, WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, WMGetSystemPixmap(scr, WSICheckMark),
|
||||
WMTableViewRectForCell(table, column, row), True);
|
||||
} else {
|
||||
pixmapDraw(scr, WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, 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(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)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGc, strdata->selTextGc, strdata->font,
|
||||
WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
stringDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGc, strdata->selTextGc, 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->selTextGc = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMBlackColor(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)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
pixmapDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->selGc,
|
||||
(WMPixmap*)WMTableViewDataForCell(table, column, row),
|
||||
WMTableViewRectForCell(table, column, row),
|
||||
False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedPCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
StringData *strdata = (StringData*)self->data;
|
||||
WMTableView *table = WMGetTableColumnTableView(column);
|
||||
|
||||
pixmapDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
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));
|
||||
|
||||
delegate->data = data;
|
||||
delegate->drawCell = PCellPainter;
|
||||
delegate->drawSelectedCell = selectedPCellPainter;
|
||||
delegate->beginCellEdit = NULL;
|
||||
delegate->endCellEdit = NULL;
|
||||
|
||||
return delegate;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
||||
static void drawPSCell(WMTableColumnDelegate *self,
|
||||
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->selGc, pix, rect,
|
||||
selected);
|
||||
|
||||
rect.pos.x += size.width-1;
|
||||
rect.size.width = owidth-size.width+1;
|
||||
}
|
||||
|
||||
stringDraw(WMWidgetScreen(table),
|
||||
WMViewXID(WMGetTableViewDocumentView(table)),
|
||||
strdata->gc, strdata->selGc, strdata->selTextGc, strdata->font,
|
||||
str, rect, selected);
|
||||
}
|
||||
|
||||
|
||||
static void PSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
drawPSCell(self, column, row, False);
|
||||
}
|
||||
|
||||
|
||||
static void selectedPSCellPainter(WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row)
|
||||
{
|
||||
drawPSCell(self, 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->selTextGc = WMColorGC(WMBlackColor(scr));
|
||||
data->gc = WMColorGC(WMBlackColor(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
|
||||
922
WINGs/Extras/wtableview.c
Normal file
922
WINGs/Extras/wtableview.c
Normal file
@@ -0,0 +1,922 @@
|
||||
|
||||
|
||||
#include <WINGsP.h>
|
||||
#include <X11/cursorfont.h>
|
||||
|
||||
#include "wtableview.h"
|
||||
|
||||
|
||||
const char *WMTableViewSelectionDidChangeNotification = "WMTableViewSelectionDidChangeNotification";
|
||||
|
||||
|
||||
struct W_TableColumn {
|
||||
WMTableView *table;
|
||||
WMWidget *titleW;
|
||||
char *title;
|
||||
int width;
|
||||
int minWidth;
|
||||
int maxWidth;
|
||||
|
||||
void *id;
|
||||
|
||||
WMTableColumnDelegate *delegate;
|
||||
|
||||
unsigned resizable:1;
|
||||
unsigned editable:1;
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void handleResize(W_ViewDelegate *self, WMView *view);
|
||||
|
||||
static void rearrangeHeader(WMTableView *table);
|
||||
|
||||
static WMRange rowsInRect(WMTableView *table, WMRect rect);
|
||||
|
||||
|
||||
WMTableColumn *WMCreateTableColumn(char *title)
|
||||
{
|
||||
WMTableColumn *col = wmalloc(sizeof(WMTableColumn));
|
||||
|
||||
col->table = NULL;
|
||||
col->titleW = NULL;
|
||||
col->width = 50;
|
||||
col->minWidth = 5;
|
||||
col->maxWidth = 0;
|
||||
|
||||
col->id = NULL;
|
||||
|
||||
col->title = wstrdup(title);
|
||||
|
||||
col->delegate = NULL;
|
||||
|
||||
col->resizable = 1;
|
||||
col->editable = 0;
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableColumnId(WMTableColumn *column, void *id)
|
||||
{
|
||||
column->id = id;
|
||||
}
|
||||
|
||||
|
||||
void *WMGetTableColumnId(WMTableColumn *column)
|
||||
{
|
||||
return column->id;
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableColumnWidth(WMTableColumn *column, unsigned width)
|
||||
{
|
||||
if (column->maxWidth == 0)
|
||||
column->width = WMAX(column->minWidth, width);
|
||||
else
|
||||
column->width = WMAX(column->minWidth, WMIN(column->maxWidth, width));
|
||||
|
||||
if (column->table) {
|
||||
rearrangeHeader(column->table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableColumnDelegate(WMTableColumn *column,
|
||||
WMTableColumnDelegate *delegate)
|
||||
{
|
||||
column->delegate = delegate;
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableColumnConstraints(WMTableColumn *column,
|
||||
unsigned minWidth, unsigned maxWidth)
|
||||
{
|
||||
wassertr(minWidth <= maxWidth);
|
||||
|
||||
column->minWidth = minWidth;
|
||||
column->maxWidth = maxWidth;
|
||||
|
||||
if (column->width < column->minWidth)
|
||||
WMSetTableColumnWidth(column, column->minWidth);
|
||||
else if (column->width > column->maxWidth || column->maxWidth == 0)
|
||||
WMSetTableColumnWidth(column, column->maxWidth);
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableColumnEditable(WMTableColumn *column, Bool flag)
|
||||
{
|
||||
column->editable = flag;
|
||||
}
|
||||
|
||||
|
||||
WMTableView *WMGetTableColumnTableView(WMTableColumn *column)
|
||||
{
|
||||
return column->table;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct W_TableView {
|
||||
W_Class widgetClass;
|
||||
WMView *view;
|
||||
|
||||
WMFrame *header;
|
||||
|
||||
WMLabel *corner;
|
||||
|
||||
WMScrollView *scrollView;
|
||||
WMView *tableView;
|
||||
|
||||
WMArray *columns;
|
||||
WMArray *splitters;
|
||||
|
||||
WMArray *selectedRows;
|
||||
|
||||
int tableWidth;
|
||||
|
||||
int rows;
|
||||
|
||||
GC gridGC;
|
||||
WMColor *gridColor;
|
||||
|
||||
Cursor splitterCursor;
|
||||
|
||||
void *dataSource;
|
||||
|
||||
WMTableViewDelegate *delegate;
|
||||
|
||||
WMAction *action;
|
||||
void *clientData;
|
||||
|
||||
void *clickedColumn;
|
||||
int clickedRow;
|
||||
|
||||
int editingRow;
|
||||
|
||||
unsigned headerHeight;
|
||||
|
||||
unsigned rowHeight;
|
||||
|
||||
unsigned dragging:1;
|
||||
unsigned drawsGrid:1;
|
||||
unsigned canSelectRow:1;
|
||||
unsigned canSelectMultiRows:1;
|
||||
unsigned canDeselectRow:1;
|
||||
};
|
||||
|
||||
static W_Class tableClass = 0;
|
||||
|
||||
|
||||
static W_ViewDelegate viewDelegate = {
|
||||
NULL,
|
||||
NULL,
|
||||
handleResize,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void handleEvents(XEvent *event, void *data);
|
||||
static void handleTableEvents(XEvent *event, void *data);
|
||||
|
||||
|
||||
static void scrollObserver(void *self, WMNotification *notif)
|
||||
{
|
||||
WMTableView *table = (WMTableView*)self;
|
||||
WMRect rect;
|
||||
int i, x;
|
||||
|
||||
rect = WMGetScrollViewVisibleRect(table->scrollView);
|
||||
|
||||
x = 0;
|
||||
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
|
||||
WMTableColumn *column;
|
||||
|
||||
column = WMGetFromArray(table->columns, i);
|
||||
|
||||
WMMoveWidget(column->titleW, x - rect.pos.x, 0);
|
||||
|
||||
if (i > 0) {
|
||||
WMView *splitter;
|
||||
|
||||
splitter = WMGetFromArray(table->splitters, i-1);
|
||||
W_MoveView(splitter, x - rect.pos.x - 1, 0);
|
||||
}
|
||||
|
||||
x += W_VIEW_WIDTH(WMWidgetView(column->titleW)) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void splitterHandler(XEvent *event, void *data)
|
||||
{
|
||||
WMTableView *table = (WMTableView*)data;
|
||||
int done = 0;
|
||||
|
||||
while (!done) {
|
||||
XEvent ev;
|
||||
|
||||
WMMaskEvent(event->xany.display, ButtonMotionMask|ButtonReleaseMask,
|
||||
&ev);
|
||||
|
||||
switch (event->type) {
|
||||
case MotionNotify:
|
||||
printf("%i\n", event->xmotion.x);
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
done = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMTableView *WMCreateTableView(WMWidget *parent)
|
||||
{
|
||||
WMTableView *table = wmalloc(sizeof(WMTableView));
|
||||
WMScreen *scr = WMWidgetScreen(parent);
|
||||
|
||||
memset(table, 0, sizeof(WMTableView));
|
||||
|
||||
if (!tableClass) {
|
||||
tableClass = W_RegisterUserWidget();
|
||||
}
|
||||
table->widgetClass = tableClass;
|
||||
|
||||
table->view = W_CreateView(W_VIEW(parent));
|
||||
if (!table->view)
|
||||
goto error;
|
||||
table->view->self = table;
|
||||
|
||||
table->view->delegate = &viewDelegate;
|
||||
|
||||
table->headerHeight = 20;
|
||||
|
||||
table->scrollView = WMCreateScrollView(table);
|
||||
if (!table->scrollView)
|
||||
goto error;
|
||||
WMResizeWidget(table->scrollView, 10, 10);
|
||||
WMSetScrollViewHasVerticalScroller(table->scrollView, True);
|
||||
WMSetScrollViewHasHorizontalScroller(table->scrollView, True);
|
||||
{
|
||||
WMScroller *scroller;
|
||||
scroller = WMGetScrollViewHorizontalScroller(table->scrollView);
|
||||
WMAddNotificationObserver(scrollObserver, table,
|
||||
WMScrollerDidScrollNotification,
|
||||
scroller);
|
||||
}
|
||||
WMMoveWidget(table->scrollView, 1, 2+table->headerHeight);
|
||||
WMMapWidget(table->scrollView);
|
||||
|
||||
table->header = WMCreateFrame(table);
|
||||
WMMoveWidget(table->header, 22, 2);
|
||||
WMMapWidget(table->header);
|
||||
WMSetFrameRelief(table->header, WRFlat);
|
||||
|
||||
table->corner = WMCreateLabel(table);
|
||||
WMResizeWidget(table->corner, 20, table->headerHeight);
|
||||
WMMoveWidget(table->corner, 2, 2);
|
||||
WMMapWidget(table->corner);
|
||||
WMSetLabelRelief(table->corner, WRRaised);
|
||||
WMSetWidgetBackgroundColor(table->corner, scr->darkGray);
|
||||
|
||||
|
||||
table->tableView = W_CreateView(W_VIEW(parent));
|
||||
if (!table->tableView)
|
||||
goto error;
|
||||
table->tableView->self = table;
|
||||
W_ResizeView(table->tableView, 100, 1000);
|
||||
W_MapView(table->tableView);
|
||||
|
||||
WMSetScrollViewContentView(table->scrollView, table->tableView);
|
||||
|
||||
table->tableView->flags.dontCompressExpose = 1;
|
||||
|
||||
table->gridColor = WMCreateNamedColor(scr, "#cccccc", False);
|
||||
/* table->gridColor = WMGrayColor(scr);*/
|
||||
|
||||
{
|
||||
XGCValues gcv;
|
||||
|
||||
gcv.foreground = WMColorPixel(table->gridColor);
|
||||
gcv.dashes = 1;
|
||||
gcv.line_style = LineOnOffDash;
|
||||
table->gridGC = XCreateGC(WMScreenDisplay(scr), W_DRAWABLE(scr),
|
||||
GCForeground, &gcv);
|
||||
}
|
||||
|
||||
table->editingRow = -1;
|
||||
table->clickedRow = -1;
|
||||
|
||||
table->drawsGrid = 1;
|
||||
table->rowHeight = 16;
|
||||
|
||||
WMSetScrollViewLineScroll(table->scrollView, table->rowHeight);
|
||||
|
||||
table->tableWidth = 1;
|
||||
|
||||
table->columns = WMCreateArray(4);
|
||||
table->splitters = WMCreateArray(4);
|
||||
|
||||
table->selectedRows = WMCreateArray(16);
|
||||
|
||||
table->splitterCursor = XCreateFontCursor(WMScreenDisplay(scr),
|
||||
XC_sb_h_double_arrow);
|
||||
|
||||
table->canSelectRow = 1;
|
||||
|
||||
WMCreateEventHandler(table->view, ExposureMask|StructureNotifyMask,
|
||||
handleEvents, table);
|
||||
|
||||
WMCreateEventHandler(table->tableView, ExposureMask|ButtonPressMask|
|
||||
ButtonReleaseMask|ButtonMotionMask,
|
||||
handleTableEvents, table);
|
||||
|
||||
return table;
|
||||
|
||||
error:
|
||||
if (table->scrollView)
|
||||
WMDestroyWidget(table->scrollView);
|
||||
if (table->tableView)
|
||||
W_DestroyView(table->tableView);
|
||||
if (table->view)
|
||||
W_DestroyView(table->view);
|
||||
wfree(table);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void WMAddTableViewColumn(WMTableView *table, WMTableColumn *column)
|
||||
{
|
||||
int width;
|
||||
int i;
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
int count;
|
||||
|
||||
column->table = table;
|
||||
|
||||
WMAddToArray(table->columns, column);
|
||||
|
||||
if (!column->titleW) {
|
||||
column->titleW = WMCreateLabel(table);
|
||||
WMSetLabelRelief(column->titleW, WRRaised);
|
||||
WMSetLabelFont(column->titleW, scr->boldFont);
|
||||
WMSetLabelTextColor(column->titleW, scr->white);
|
||||
WMSetWidgetBackgroundColor(column->titleW, scr->darkGray);
|
||||
WMSetLabelText(column->titleW, column->title);
|
||||
W_ReparentView(WMWidgetView(column->titleW),
|
||||
WMWidgetView(table->header), 0, 0);
|
||||
if (W_VIEW_REALIZED(table->view))
|
||||
WMRealizeWidget(column->titleW);
|
||||
WMMapWidget(column->titleW);
|
||||
}
|
||||
|
||||
if (WMGetArrayItemCount(table->columns) > 1) {
|
||||
WMView *splitter = W_CreateView(WMWidgetView(table->header));
|
||||
|
||||
W_SetViewBackgroundColor(splitter, WMWhiteColor(scr));
|
||||
|
||||
if (W_VIEW_REALIZED(table->view))
|
||||
W_RealizeView(splitter);
|
||||
|
||||
W_ResizeView(splitter, 2, table->headerHeight-1);
|
||||
W_MapView(splitter);
|
||||
|
||||
W_SetViewCursor(splitter, table->splitterCursor);
|
||||
WMCreateEventHandler(splitter, ButtonPressMask,
|
||||
splitterHandler, table);
|
||||
|
||||
WMAddToArray(table->splitters, splitter);
|
||||
}
|
||||
|
||||
rearrangeHeader(table);
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableViewHeaderHeight(WMTableView *table, unsigned height)
|
||||
{
|
||||
table->headerHeight = height;
|
||||
|
||||
handleResize(NULL, table->view);
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableViewDelegate(WMTableView *table, WMTableViewDelegate *delegate)
|
||||
{
|
||||
table->delegate = delegate;
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableViewAction(WMTableView *table, WMAction *action, void *clientData)
|
||||
{
|
||||
table->action = action;
|
||||
|
||||
table->clientData = clientData;
|
||||
}
|
||||
|
||||
|
||||
void *WMGetTableViewClickedColumn(WMTableView *table)
|
||||
{
|
||||
return table->clickedColumn;
|
||||
}
|
||||
|
||||
|
||||
int WMGetTableViewClickedRow(WMTableView *table)
|
||||
{
|
||||
return table->clickedRow;
|
||||
}
|
||||
|
||||
|
||||
WMView *WMGetTableViewDocumentView(WMTableView *table)
|
||||
{
|
||||
return table->tableView;
|
||||
}
|
||||
|
||||
|
||||
void *WMTableViewDataForCell(WMTableView *table, WMTableColumn *column,
|
||||
int row)
|
||||
{
|
||||
return (*table->delegate->valueForCell)(table->delegate, column, row);
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableViewDataForCell(WMTableView *table, WMTableColumn *column,
|
||||
int row, void *data)
|
||||
{
|
||||
(*table->delegate->setValueForCell)(table->delegate, column, row, data);
|
||||
}
|
||||
|
||||
|
||||
WMRect WMTableViewRectForCell(WMTableView *table, WMTableColumn *column,
|
||||
int row)
|
||||
{
|
||||
WMRect rect;
|
||||
int i;
|
||||
|
||||
rect.pos.x = 0;
|
||||
rect.pos.y = row * table->rowHeight;
|
||||
rect.size.height = table->rowHeight;
|
||||
|
||||
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
|
||||
WMTableColumn *col;
|
||||
col = WMGetFromArray(table->columns, i);
|
||||
|
||||
if (col == column) {
|
||||
rect.size.width = col->width;
|
||||
break;
|
||||
}
|
||||
|
||||
rect.pos.x += col->width;
|
||||
}
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableViewDataSource(WMTableView *table, void *source)
|
||||
{
|
||||
table->dataSource = source;
|
||||
}
|
||||
|
||||
|
||||
void *WMGetTableViewDataSource(WMTableView *table)
|
||||
{
|
||||
return table->dataSource;
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableViewBackgroundColor(WMTableView *table, WMColor *color)
|
||||
{
|
||||
W_SetViewBackgroundColor(table->tableView, color);
|
||||
}
|
||||
|
||||
|
||||
void WMSetTableViewGridColor(WMTableView *table, WMColor *color)
|
||||
{
|
||||
WMReleaseColor(table->gridColor);
|
||||
table->gridColor = WMRetainColor(color);
|
||||
XSetForeground(WMScreenDisplay(WMWidgetScreen(table)), table->gridGC,
|
||||
WMColorPixel(color));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WMSetTableViewRowHeight(WMTableView *table, int height)
|
||||
{
|
||||
table->rowHeight = height;
|
||||
|
||||
WMRedisplayWidget(table);
|
||||
}
|
||||
|
||||
|
||||
void WMScrollTableViewRowToVisible(WMTableView *table, int row)
|
||||
{
|
||||
WMScroller *scroller;
|
||||
WMRange range;
|
||||
WMRect rect;
|
||||
int newY, tmp;
|
||||
|
||||
rect = WMGetScrollViewVisibleRect(table->scrollView);
|
||||
range = rowsInRect(table, rect);
|
||||
|
||||
scroller = WMGetScrollViewVerticalScroller(table->scrollView);
|
||||
|
||||
if (row < range.position) {
|
||||
newY = row * table->rowHeight - rect.size.height / 2;
|
||||
} else if (row >= range.position + range.count) {
|
||||
newY = row * table->rowHeight - rect.size.height / 2;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
tmp = table->rows*table->rowHeight - rect.size.height;
|
||||
newY = WMAX(0, WMIN(newY, tmp));
|
||||
WMScrollViewScrollPoint(table->scrollView, rect.pos.x, newY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void drawGrid(WMTableView *table, WMRect rect)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
int i;
|
||||
int y1, y2;
|
||||
int x1, x2;
|
||||
int xx;
|
||||
Drawable d = W_VIEW_DRAWABLE(table->tableView);
|
||||
GC gc = table->gridGC;
|
||||
|
||||
#if 0
|
||||
char dashl[1] = {1};
|
||||
|
||||
XSetDashes(dpy, gc, 0, dashl, 1);
|
||||
|
||||
y1 = (rect.pos.y/table->rowHeight - 1)*table->rowHeight;
|
||||
y2 = y1 + (rect.size.height/table->rowHeight+2)*table->rowHeight;
|
||||
#endif
|
||||
y1 = 0;
|
||||
y2 = W_VIEW_HEIGHT(table->tableView);
|
||||
|
||||
xx = 0;
|
||||
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
|
||||
WMTableColumn *column;
|
||||
|
||||
if (xx >= rect.pos.x && xx <= rect.pos.x+rect.size.width) {
|
||||
XDrawLine(dpy, d, gc, xx, y1, xx, y2);
|
||||
}
|
||||
column = WMGetFromArray(table->columns, i);
|
||||
xx += column->width;
|
||||
}
|
||||
XDrawLine(dpy, d, gc, xx, y1, xx, y2);
|
||||
|
||||
|
||||
x1 = rect.pos.x;
|
||||
x2 = WMIN(x1 + rect.size.width, xx);
|
||||
|
||||
if (x2 <= x1)
|
||||
return;
|
||||
#if 0
|
||||
XSetDashes(dpy, gc, (rect.pos.x&1), dashl, 1);
|
||||
#endif
|
||||
|
||||
y1 = rect.pos.y - rect.pos.y%table->rowHeight;
|
||||
y2 = y1 + rect.size.height + table->rowHeight;
|
||||
|
||||
for (i = y1; i <= y2; i += table->rowHeight) {
|
||||
XDrawLine(dpy, d, gc, x1, i, x2, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static WMRange columnsInRect(WMTableView *table, WMRect rect)
|
||||
{
|
||||
WMTableColumn *column;
|
||||
int width;
|
||||
int i , j;
|
||||
int totalColumns = WMGetArrayItemCount(table->columns);
|
||||
WMRange range;
|
||||
|
||||
j = 0;
|
||||
width = 0;
|
||||
for (i = 0; i < totalColumns; i++) {
|
||||
column = WMGetFromArray(table->columns, i);
|
||||
if (j == 0) {
|
||||
if (width <= rect.pos.x && width + column->width > rect.pos.x) {
|
||||
range.position = i;
|
||||
j = 1;
|
||||
}
|
||||
} else {
|
||||
if (width > rect.pos.x + rect.size.width) {
|
||||
range.count = i - range.position;
|
||||
break;
|
||||
}
|
||||
}
|
||||
width += column->width;
|
||||
}
|
||||
|
||||
range.count = WMAX(1, WMIN(range.count, totalColumns - range.position));
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
|
||||
static WMRange rowsInRect(WMTableView *table, WMRect rect)
|
||||
{
|
||||
WMRange range;
|
||||
int rh = table->rowHeight;
|
||||
int dif;
|
||||
|
||||
dif = rect.pos.y % rh;
|
||||
|
||||
range.position = WMAX(0, (rect.pos.y - dif) / rh);
|
||||
range.count = WMAX(1, WMIN((rect.size.height + dif) / rh, table->rows));
|
||||
|
||||
return range;
|
||||
}
|
||||
|
||||
|
||||
static void drawRow(WMTableView *table, int row, WMRect clipRect)
|
||||
{
|
||||
int i;
|
||||
WMRange cols = columnsInRect(table, clipRect);
|
||||
WMTableColumn *column;
|
||||
|
||||
for (i = cols.position; i < cols.position+cols.count; i++) {
|
||||
column = WMGetFromArray(table->columns, i);
|
||||
|
||||
wassertr(column->delegate && column->delegate->drawCell);
|
||||
|
||||
if (WMFindInArray(table->selectedRows, NULL, (void*)row) != WANotFound)
|
||||
(*column->delegate->drawSelectedCell)(column->delegate, column, row);
|
||||
else
|
||||
(*column->delegate->drawCell)(column->delegate, column, row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void drawFullRow(WMTableView *table, int row)
|
||||
{
|
||||
int i;
|
||||
WMTableColumn *column;
|
||||
|
||||
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
|
||||
column = WMGetFromArray(table->columns, i);
|
||||
|
||||
wassertr(column->delegate && column->delegate->drawCell);
|
||||
|
||||
if (WMFindInArray(table->selectedRows, NULL, (void*)row) != WANotFound)
|
||||
(*column->delegate->drawSelectedCell)(column->delegate, column, row);
|
||||
else
|
||||
(*column->delegate->drawCell)(column->delegate, column, row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void setRowSelected(WMTableView *table, unsigned row, Bool flag)
|
||||
{
|
||||
int repaint = 0;
|
||||
|
||||
|
||||
if (WMFindInArray(table->selectedRows, NULL, (void*)row) != WANotFound) {
|
||||
if (!flag) {
|
||||
WMRemoveFromArray(table->selectedRows, (void*)row);
|
||||
repaint = 1;
|
||||
}
|
||||
} else {
|
||||
if (flag) {
|
||||
WMAddToArray(table->selectedRows, (void*)row);
|
||||
repaint = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (repaint) {
|
||||
drawFullRow(table, row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void repaintTable(WMTableView *table, int x, int y,
|
||||
int width, int height)
|
||||
{
|
||||
WMRect rect;
|
||||
WMRange rows;
|
||||
int i;
|
||||
|
||||
wassertr(table->delegate && table->delegate->numberOfRows);
|
||||
i = (*table->delegate->numberOfRows)(table->delegate, table);
|
||||
|
||||
if (i != table->rows) {
|
||||
table->rows = i;
|
||||
W_ResizeView(table->tableView, table->tableWidth,
|
||||
table->rows * table->rowHeight + 1);
|
||||
}
|
||||
|
||||
|
||||
rect.pos = wmkpoint(x,y);
|
||||
rect.size = wmksize(width, height);
|
||||
|
||||
if (table->drawsGrid) {
|
||||
drawGrid(table, rect);
|
||||
}
|
||||
|
||||
rows = rowsInRect(table, rect);
|
||||
for (i = rows.position;
|
||||
i < WMIN(rows.position+rows.count + 1, table->rows);
|
||||
i++) {
|
||||
drawRow(table, i, rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void stopRowEdit(WMTableView *table, int row)
|
||||
{
|
||||
int i;
|
||||
WMTableColumn *column;
|
||||
|
||||
table->editingRow = -1;
|
||||
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
|
||||
column = WMGetFromArray(table->columns, i);
|
||||
|
||||
if (column->delegate && column->delegate->endCellEdit)
|
||||
(*column->delegate->endCellEdit)(column->delegate, column, row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WMEditTableViewRow(WMTableView *table, int row)
|
||||
{
|
||||
int i;
|
||||
WMTableColumn *column;
|
||||
|
||||
if (table->editingRow >= 0) {
|
||||
stopRowEdit(table, table->editingRow);
|
||||
}
|
||||
|
||||
table->editingRow = row;
|
||||
for (i = 0; i < WMGetArrayItemCount(table->columns); i++) {
|
||||
column = WMGetFromArray(table->columns, i);
|
||||
|
||||
if (column->delegate && column->delegate->beginCellEdit)
|
||||
(*column->delegate->beginCellEdit)(column->delegate, column, row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void WMSelectTableViewRow(WMTableView *table, int row)
|
||||
{
|
||||
if (table->clickedRow >= 0)
|
||||
setRowSelected(table, table->clickedRow, False);
|
||||
setRowSelected(table, row, True);
|
||||
table->clickedRow = row;
|
||||
|
||||
if (table->action)
|
||||
(*table->action)(table, table->clientData);
|
||||
WMPostNotificationName(WMTableViewSelectionDidChangeNotification,
|
||||
table, NULL);
|
||||
}
|
||||
|
||||
|
||||
void WMReloadTableView(WMTableView *table)
|
||||
{
|
||||
WMRect rect = WMGetScrollViewVisibleRect(table->scrollView);
|
||||
|
||||
repaintTable(table, 0, 0,
|
||||
W_VIEW_WIDTH(table->tableView), rect.size.height);
|
||||
}
|
||||
|
||||
|
||||
void WMNoteTableViewNumberOfRowsChanged(WMTableView *table)
|
||||
{
|
||||
WMReloadTableView(table);
|
||||
}
|
||||
|
||||
|
||||
static void handleTableEvents(XEvent *event, void *data)
|
||||
{
|
||||
WMTableView *table = (WMTableView*)data;
|
||||
int row;
|
||||
|
||||
switch (event->type) {
|
||||
case ButtonPress:
|
||||
if (event->xbutton.button == Button1) {
|
||||
row = event->xbutton.y/table->rowHeight;
|
||||
if (row != table->clickedRow) {
|
||||
setRowSelected(table, table->clickedRow, False);
|
||||
setRowSelected(table, row, True);
|
||||
table->clickedRow = row;
|
||||
table->dragging = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case MotionNotify:
|
||||
if (table->dragging && event->xmotion.y >= 0) {
|
||||
row = event->xmotion.y/table->rowHeight;
|
||||
if (table->clickedRow != row && row >= 0) {
|
||||
setRowSelected(table, table->clickedRow, False);
|
||||
setRowSelected(table, row, True);
|
||||
table->clickedRow = row;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ButtonRelease:
|
||||
if (event->xbutton.button == Button1) {
|
||||
if (table->action)
|
||||
(*table->action)(table, table->clientData);
|
||||
WMPostNotificationName(WMTableViewSelectionDidChangeNotification,
|
||||
table, NULL);
|
||||
table->dragging = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case Expose:
|
||||
repaintTable(table, event->xexpose.x, event->xexpose.y,
|
||||
event->xexpose.width, event->xexpose.height);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void handleEvents(XEvent *event, void *data)
|
||||
{
|
||||
WMTableView *table = (WMTableView*)data;
|
||||
WMScreen *scr = WMWidgetScreen(table);
|
||||
|
||||
switch (event->type) {
|
||||
case Expose:
|
||||
W_DrawRelief(scr, W_VIEW_DRAWABLE(table->view), 0, 0,
|
||||
W_VIEW_WIDTH(table->view), W_VIEW_HEIGHT(table->view),
|
||||
WRSunken);
|
||||
|
||||
if (event->xexpose.serial == 0) {
|
||||
WMRect rect = WMGetScrollViewVisibleRect(table->scrollView);
|
||||
|
||||
repaintTable(table, rect.pos.x, rect.pos.y,
|
||||
rect.size.width, rect.size.height);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void handleResize(W_ViewDelegate *self, WMView *view)
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
WMTableView *table = view->self;
|
||||
|
||||
width = W_VIEW_WIDTH(view) - 2;
|
||||
height = W_VIEW_HEIGHT(view) - 3;
|
||||
|
||||
height -= table->headerHeight; /* table header */
|
||||
|
||||
if (table->corner)
|
||||
WMResizeWidget(table->corner, 20, table->headerHeight);
|
||||
|
||||
if (table->scrollView) {
|
||||
WMMoveWidget(table->scrollView, 1, table->headerHeight + 2);
|
||||
WMResizeWidget(table->scrollView, width, height);
|
||||
}
|
||||
if (table->header)
|
||||
WMResizeWidget(table->header, width - 21, table->headerHeight);
|
||||
}
|
||||
|
||||
|
||||
static void rearrangeHeader(WMTableView *table)
|
||||
{
|
||||
int width;
|
||||
int count;
|
||||
int i;
|
||||
width = 0;
|
||||
|
||||
count = WMGetArrayItemCount(table->columns);
|
||||
for (i = 0; i < count; i++) {
|
||||
WMTableColumn *column = WMGetFromArray(table->columns, i);
|
||||
|
||||
WMMoveWidget(column->titleW, width, 0);
|
||||
WMResizeWidget(column->titleW, column->width-1, table->headerHeight);
|
||||
|
||||
if (i > 0) {
|
||||
WMView *splitter = WMGetFromArray(table->splitters, i-1);
|
||||
|
||||
W_MoveView(splitter, width-1, 0);
|
||||
}
|
||||
width += column->width;
|
||||
}
|
||||
|
||||
wassertr(table->delegate && table->delegate->numberOfRows);
|
||||
|
||||
table->rows = table->delegate->numberOfRows(table->delegate, table);
|
||||
|
||||
W_ResizeView(table->tableView, width+1,
|
||||
table->rows * table->rowHeight + 1);
|
||||
|
||||
table->tableWidth = width + 1;
|
||||
}
|
||||
111
WINGs/Extras/wtableview.h
Normal file
111
WINGs/Extras/wtableview.h
Normal file
@@ -0,0 +1,111 @@
|
||||
|
||||
|
||||
|
||||
#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);
|
||||
void (*drawSelectedCell)(struct WMTableColumnDelegate *self,
|
||||
WMTableColumn *column, int row);
|
||||
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 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);
|
||||
|
||||
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,58 +2,57 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
SUBDIRS = Resources
|
||||
SUBDIRS = . Documentation Resources Examples Extras Tests
|
||||
|
||||
|
||||
LIBLIST= -L$(top_builddir)/wrlib -lwraster @XLFLAGS@ @GFXLIBS@ @XLIBS@ \
|
||||
-lm @LIBPL_LIBS@
|
||||
|
||||
#libWINGs_la_LDFLAGS = -version-info 1:1:0
|
||||
|
||||
lib_LIBRARIES = libWINGs.a
|
||||
# is this a kluge? if so, how should i do it?
|
||||
includedir = @includedir@/WINGs
|
||||
|
||||
include_HEADERS = WINGs.h WUtil.h WINGsP.h
|
||||
|
||||
noinst_PROGRAMS = wtest wmquery wmfile fontl testmywidget
|
||||
bin_SCRIPTS = get-wings-flags get-wutil-flags
|
||||
|
||||
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
|
||||
|
||||
testmywidget_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
fontl_SOURCES = fontl.c
|
||||
|
||||
fontl_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
wtest_SOURCES = wtest.c
|
||||
|
||||
wtest_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
wtest_DEPENDENCIES = libWINGs.a
|
||||
|
||||
wmfile_SOURCES = wmfile.c
|
||||
|
||||
wmfile_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
lib_LIBRARIES = libWINGs.a libWUtil.a
|
||||
|
||||
|
||||
wmquery_SOURCES = wmquery.c
|
||||
|
||||
wmquery_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
LDADD= libWINGs.a $(top_builddir)/wrlib/libwraster.la @LIBPL@
|
||||
|
||||
|
||||
EXTRA_DIST = logo.xpm
|
||||
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 \
|
||||
hashtable.c \
|
||||
host.c \
|
||||
international.c \
|
||||
memory.c \
|
||||
notification.c \
|
||||
selection.c \
|
||||
string.c \
|
||||
userdefaults.c \
|
||||
usleep.c \
|
||||
wapplication.c \
|
||||
wappresource.c \
|
||||
wballoon.c \
|
||||
wbox.c \
|
||||
wbrowser.c \
|
||||
wbutton.c \
|
||||
wcolor.c \
|
||||
wcolorpanel.c \
|
||||
wcolorwell.c \
|
||||
wevent.c \
|
||||
wfilepanel.c \
|
||||
@@ -63,28 +62,48 @@ libWINGs_a_SOURCES = \
|
||||
widgets.c \
|
||||
wlabel.c \
|
||||
wlist.c \
|
||||
wmenuitem.c \
|
||||
wmisc.c \
|
||||
wpanel.c \
|
||||
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 \
|
||||
wwindow.c
|
||||
|
||||
|
||||
libWUtil_a_SOURCES = \
|
||||
WINGs.h \
|
||||
WINGsP.h \
|
||||
array.c \
|
||||
bagtree.c \
|
||||
connection.c \
|
||||
data.c \
|
||||
error.c \
|
||||
findfile.c \
|
||||
hashtable.c \
|
||||
host.c \
|
||||
international.c \
|
||||
memory.c \
|
||||
usleep.c
|
||||
notification.c \
|
||||
string.c \
|
||||
userdefaults.c \
|
||||
usleep.c \
|
||||
wapplication.c \
|
||||
wutil.c
|
||||
|
||||
##
|
||||
## Find a better way than $(GFXFLAGS) to inform widgets.c wich of
|
||||
## tiff or xpm images should be used
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/src @XCFLAGS@ \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" $(GFXFLAGS) -DDEBUG \
|
||||
@LIBPL_INC_PATH@
|
||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/src \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" @HEADER_SEARCH_PATH@ -DDEBUG
|
||||
|
||||
|
||||
wcolorpanel.o: wcolorpanel.c
|
||||
$(COMPILE) -c -DRGBTXT="\"@X_LIBRARY_PATH@/X11/rgb.txt\"" $<
|
||||
|
||||
@@ -1,513 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP_PATH = @CPP_PATH@
|
||||
DFLAGS = @DFLAGS@
|
||||
GFXFLAGS = @GFXFLAGS@
|
||||
GFXLIBS = @GFXLIBS@
|
||||
I18N = @I18N@
|
||||
I18N_MB = @I18N_MB@
|
||||
ICONEXT = @ICONEXT@
|
||||
INTLIBS = @INTLIBS@
|
||||
LIBPL_INC_PATH = @LIBPL_INC_PATH@
|
||||
LIBPL_LIBS = @LIBPL_LIBS@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MOFILES = @MOFILES@
|
||||
NLSDIR = @NLSDIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
REDUCE_APPICONS = @REDUCE_APPICONS@
|
||||
SHAPE = @SHAPE@
|
||||
SOUND = @SOUND@
|
||||
VERSION = @VERSION@
|
||||
WPMOFILES = @WPMOFILES@
|
||||
XCFLAGS = @XCFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XLFLAGS = @XLFLAGS@
|
||||
XLIBS = @XLIBS@
|
||||
XSHM = @XSHM@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LOCALE = @X_LOCALE@
|
||||
pixmapdir = @pixmapdir@
|
||||
wprefsdir = @wprefsdir@
|
||||
|
||||
AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
SUBDIRS = Resources
|
||||
|
||||
LIBLIST= -L$(top_builddir)/wrlib -lwraster @XLFLAGS@ @GFXLIBS@ @XLIBS@ \
|
||||
-lm @LIBPL_LIBS@
|
||||
|
||||
lib_LIBRARIES = libWINGs.a
|
||||
|
||||
include_HEADERS = WINGs.h WUtil.h WINGsP.h
|
||||
|
||||
noinst_PROGRAMS = wtest wmquery wmfile fontl testmywidget
|
||||
|
||||
testmywidget_SOURCES = testmywidget.c mywidget.c mywidget.h
|
||||
|
||||
testmywidget_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
fontl_SOURCES = fontl.c
|
||||
|
||||
fontl_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
wtest_SOURCES = wtest.c
|
||||
|
||||
wtest_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
wtest_DEPENDENCIES = libWINGs.a
|
||||
|
||||
wmfile_SOURCES = wmfile.c
|
||||
|
||||
wmfile_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
wmquery_SOURCES = wmquery.c
|
||||
|
||||
wmquery_LDADD = -L. -lWINGs $(LIBLIST)
|
||||
|
||||
EXTRA_DIST = logo.xpm
|
||||
|
||||
# wbutton.c
|
||||
libWINGs_a_SOURCES = \
|
||||
WINGs.h \
|
||||
WINGsP.h \
|
||||
configuration.c \
|
||||
international.c \
|
||||
notification.c \
|
||||
selection.c \
|
||||
userdefaults.c \
|
||||
wapplication.c \
|
||||
wbrowser.c \
|
||||
wbutton.c \
|
||||
wcolor.c \
|
||||
wcolorwell.c \
|
||||
wevent.c \
|
||||
wfilepanel.c \
|
||||
wframe.c \
|
||||
wfont.c \
|
||||
wfontpanel.c \
|
||||
widgets.c \
|
||||
wlabel.c \
|
||||
wlist.c \
|
||||
wmisc.c \
|
||||
wpanel.c \
|
||||
wpixmap.c \
|
||||
wpopupbutton.c \
|
||||
wscroller.c \
|
||||
wscrollview.c \
|
||||
wslider.c \
|
||||
wsplitview.c \
|
||||
wtextfield.c \
|
||||
wwindow.c \
|
||||
wview.c \
|
||||
error.c \
|
||||
findfile.c \
|
||||
hashtable.c \
|
||||
memory.c \
|
||||
usleep.c
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/src @XCFLAGS@ \
|
||||
-DRESOURCE_PATH=\"$(datadir)/WINGs\" $(GFXFLAGS) -DDEBUG \
|
||||
@LIBPL_INC_PATH@
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_HEADER = ../src/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
LIBRARIES = $(lib_LIBRARIES)
|
||||
|
||||
|
||||
DEFS = @DEFS@ -I. -I$(srcdir) -I../src
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
X_CFLAGS = @X_CFLAGS@
|
||||
X_LIBS = @X_LIBS@
|
||||
X_PRE_LIBS = @X_PRE_LIBS@
|
||||
libWINGs_a_LIBADD =
|
||||
libWINGs_a_OBJECTS = configuration.o international.o notification.o \
|
||||
selection.o userdefaults.o wapplication.o wbrowser.o wbutton.o wcolor.o \
|
||||
wcolorwell.o wevent.o wfilepanel.o wframe.o wfont.o wfontpanel.o \
|
||||
widgets.o wlabel.o wlist.o wmisc.o wpanel.o wpixmap.o wpopupbutton.o \
|
||||
wscroller.o wscrollview.o wslider.o wsplitview.o wtextfield.o wwindow.o \
|
||||
wview.o error.o findfile.o hashtable.o memory.o usleep.o
|
||||
AR = ar
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
|
||||
wtest_OBJECTS = wtest.o
|
||||
wtest_LDFLAGS =
|
||||
wmquery_OBJECTS = wmquery.o
|
||||
wmquery_DEPENDENCIES =
|
||||
wmquery_LDFLAGS =
|
||||
wmfile_OBJECTS = wmfile.o
|
||||
wmfile_DEPENDENCIES =
|
||||
wmfile_LDFLAGS =
|
||||
fontl_OBJECTS = fontl.o
|
||||
fontl_DEPENDENCIES =
|
||||
fontl_LDFLAGS =
|
||||
testmywidget_OBJECTS = testmywidget.o mywidget.o
|
||||
testmywidget_DEPENDENCIES =
|
||||
testmywidget_LDFLAGS =
|
||||
CFLAGS = @CFLAGS@
|
||||
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
||||
LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
|
||||
HEADERS = $(include_HEADERS)
|
||||
|
||||
DIST_COMMON = README ChangeLog Makefile.am Makefile.in TODO
|
||||
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
SOURCES = $(libWINGs_a_SOURCES) $(wtest_SOURCES) $(wmquery_SOURCES) $(wmfile_SOURCES) $(fontl_SOURCES) $(testmywidget_SOURCES)
|
||||
OBJECTS = $(libWINGs_a_OBJECTS) $(wtest_OBJECTS) $(wmquery_OBJECTS) $(wmfile_OBJECTS) $(fontl_OBJECTS) $(testmywidget_OBJECTS)
|
||||
|
||||
all: all-recursive all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .o .s
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu WINGs/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
|
||||
mostlyclean-libLIBRARIES:
|
||||
|
||||
clean-libLIBRARIES:
|
||||
-test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
|
||||
|
||||
distclean-libLIBRARIES:
|
||||
|
||||
maintainer-clean-libLIBRARIES:
|
||||
|
||||
install-libLIBRARIES: $(lib_LIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(libdir)
|
||||
list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
echo " $(RANLIB) $(DESTDIR)$(libdir)/$$p"; \
|
||||
$(RANLIB) $(DESTDIR)$(libdir)/$$p; \
|
||||
else :; fi; \
|
||||
done
|
||||
|
||||
uninstall-libLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(lib_LIBRARIES)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(libdir)/$$p; \
|
||||
done
|
||||
|
||||
.c.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.s.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
.S.o:
|
||||
$(COMPILE) -c $<
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.o core *.core
|
||||
|
||||
clean-compile:
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
maintainer-clean-compile:
|
||||
|
||||
libWINGs.a: $(libWINGs_a_OBJECTS) $(libWINGs_a_DEPENDENCIES)
|
||||
-rm -f libWINGs.a
|
||||
$(AR) cru libWINGs.a $(libWINGs_a_OBJECTS) $(libWINGs_a_LIBADD)
|
||||
$(RANLIB) libWINGs.a
|
||||
|
||||
mostlyclean-noinstPROGRAMS:
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
|
||||
distclean-noinstPROGRAMS:
|
||||
|
||||
maintainer-clean-noinstPROGRAMS:
|
||||
|
||||
wtest: $(wtest_OBJECTS) $(wtest_DEPENDENCIES)
|
||||
@rm -f wtest
|
||||
$(LINK) $(wtest_LDFLAGS) $(wtest_OBJECTS) $(wtest_LDADD) $(LIBS)
|
||||
|
||||
wmquery: $(wmquery_OBJECTS) $(wmquery_DEPENDENCIES)
|
||||
@rm -f wmquery
|
||||
$(LINK) $(wmquery_LDFLAGS) $(wmquery_OBJECTS) $(wmquery_LDADD) $(LIBS)
|
||||
|
||||
wmfile: $(wmfile_OBJECTS) $(wmfile_DEPENDENCIES)
|
||||
@rm -f wmfile
|
||||
$(LINK) $(wmfile_LDFLAGS) $(wmfile_OBJECTS) $(wmfile_LDADD) $(LIBS)
|
||||
|
||||
fontl: $(fontl_OBJECTS) $(fontl_DEPENDENCIES)
|
||||
@rm -f fontl
|
||||
$(LINK) $(fontl_LDFLAGS) $(fontl_OBJECTS) $(fontl_LDADD) $(LIBS)
|
||||
|
||||
testmywidget: $(testmywidget_OBJECTS) $(testmywidget_DEPENDENCIES)
|
||||
@rm -f testmywidget
|
||||
$(LINK) $(testmywidget_LDFLAGS) $(testmywidget_OBJECTS) $(testmywidget_LDADD) $(LIBS)
|
||||
|
||||
install-includeHEADERS: $(include_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(DESTDIR)$(includedir)
|
||||
@list='$(include_HEADERS)'; for p in $$list; do \
|
||||
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
|
||||
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
|
||||
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
uninstall-includeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(include_HEADERS)'; for p in $$list; do \
|
||||
rm -f $(DESTDIR)$(includedir)/$$p; \
|
||||
done
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
all-recursive install-data-recursive install-exec-recursive \
|
||||
installdirs-recursive install-recursive uninstall-recursive \
|
||||
check-recursive installcheck-recursive info-recursive dvi-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
|
||||
mostlyclean-recursive clean-recursive distclean-recursive \
|
||||
maintainer-clean-recursive:
|
||||
@set fnord $(MAKEFLAGS); amf=$$2; \
|
||||
rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
rev="$$subdir $$rev"; \
|
||||
done; \
|
||||
for subdir in $$rev; do \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
(cd $$subdir && $(MAKE) $$target) \
|
||||
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
(cd $$subdir && $(MAKE) tags); \
|
||||
done
|
||||
|
||||
tags: TAGS
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||
here=`pwd` && cd $(srcdir) \
|
||||
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||
tags=; \
|
||||
here=`pwd`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS)'; \
|
||||
unique=`for i in $$list; do echo $$i; done | \
|
||||
awk ' { files[$$0] = 1; } \
|
||||
END { for (i in files) print i; }'`; \
|
||||
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||
|
||||
mostlyclean-tags:
|
||||
|
||||
clean-tags:
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID
|
||||
|
||||
maintainer-clean-tags:
|
||||
|
||||
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||
|
||||
subdir = WINGs
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
for subdir in $(SUBDIRS); do \
|
||||
test -d $(distdir)/$$subdir \
|
||||
|| mkdir $(distdir)/$$subdir \
|
||||
|| exit 1; \
|
||||
chmod 777 $(distdir)/$$subdir; \
|
||||
(cd $$subdir && $(MAKE) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \
|
||||
|| exit 1; \
|
||||
done
|
||||
info: info-recursive
|
||||
dvi: dvi-recursive
|
||||
check: all-am
|
||||
$(MAKE) check-recursive
|
||||
installcheck: installcheck-recursive
|
||||
all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(HEADERS)
|
||||
|
||||
install-exec-am: install-libLIBRARIES
|
||||
|
||||
install-data-am: install-includeHEADERS
|
||||
|
||||
uninstall-am: uninstall-libLIBRARIES uninstall-includeHEADERS
|
||||
|
||||
install-exec: install-exec-recursive install-exec-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-data-recursive install-data-am
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-recursive install-exec-am install-data-am
|
||||
@:
|
||||
|
||||
uninstall: uninstall-recursive uninstall-am
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs: installdirs-recursive
|
||||
$(mkinstalldirs) $(DATADIR)$(libdir) $(DATADIR)$(includedir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean-am: mostlyclean-libLIBRARIES mostlyclean-compile \
|
||||
mostlyclean-noinstPROGRAMS mostlyclean-tags \
|
||||
mostlyclean-generic
|
||||
|
||||
clean-am: clean-libLIBRARIES clean-compile clean-noinstPROGRAMS \
|
||||
clean-tags clean-generic mostlyclean-am
|
||||
|
||||
distclean-am: distclean-libLIBRARIES distclean-compile \
|
||||
distclean-noinstPROGRAMS distclean-tags \
|
||||
distclean-generic clean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-libLIBRARIES \
|
||||
maintainer-clean-compile \
|
||||
maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
|
||||
maintainer-clean-generic distclean-am
|
||||
|
||||
mostlyclean: mostlyclean-recursive mostlyclean-am
|
||||
|
||||
clean: clean-recursive clean-am
|
||||
|
||||
distclean: distclean-recursive distclean-am
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive maintainer-clean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: mostlyclean-libLIBRARIES distclean-libLIBRARIES \
|
||||
clean-libLIBRARIES maintainer-clean-libLIBRARIES uninstall-libLIBRARIES \
|
||||
install-libLIBRARIES mostlyclean-compile distclean-compile \
|
||||
clean-compile maintainer-clean-compile mostlyclean-noinstPROGRAMS \
|
||||
distclean-noinstPROGRAMS clean-noinstPROGRAMS \
|
||||
maintainer-clean-noinstPROGRAMS uninstall-includeHEADERS \
|
||||
install-includeHEADERS install-data-recursive uninstall-data-recursive \
|
||||
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
|
||||
uninstalldirs-recursive all-recursive check-recursive \
|
||||
installcheck-recursive info-recursive dvi-recursive \
|
||||
mostlyclean-recursive distclean-recursive clean-recursive \
|
||||
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
|
||||
distclean-tags clean-tags maintainer-clean-tags distdir info dvi \
|
||||
installcheck all-am install-exec-am install-data-am uninstall-am \
|
||||
install-exec install-data install uninstall all installdirs \
|
||||
mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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:
|
||||
29
WINGs/README
29
WINGs/README
@@ -25,9 +25,9 @@ and faster than say, Motif or even Athena. Knowing Xlib will help you to
|
||||
workaround some of it's limitations, although you'll probably be able to
|
||||
write something like a trivial tic-tac-toe game without knowing much Xlib.
|
||||
|
||||
Some of it's functions are designed to support the WindowMaker window
|
||||
Some of it's functions are designed to support the Window Maker window
|
||||
manager (see http://windowmaker.org) In fact, it's primary role is to
|
||||
support WindowMaker. All other uses of it are just an added bonus.
|
||||
support Window Maker. All other uses of it are just an added bonus.
|
||||
|
||||
It will help you to understand the API if you read the ApplicationKit
|
||||
reference manual, distributed as a PDF by Apple. The function names,
|
||||
@@ -37,9 +37,8 @@ structs and most of the intrinsics are very close to OpenStep classes.
|
||||
Internationalization:
|
||||
---------------------
|
||||
|
||||
WINGs supports display of multibyte characters (kanji etc) without the
|
||||
to specify any flags (ie: there is no way to disable i18n support).
|
||||
Change ~/GNUstep/Defaults/WMGLOBAL to set the desired font set.
|
||||
Change ~/GNUstep/Defaults/WMGLOBAL to set the desired font set and
|
||||
set MultiByteText = YES; to enable support for multibyte text.
|
||||
|
||||
|
||||
Widgets provided by WINGs:
|
||||
@@ -57,24 +56,22 @@ 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
|
||||
|
||||
Planned:
|
||||
--------
|
||||
|
||||
- selection (pasteboard like)
|
||||
- drag&drop
|
||||
- font panel
|
||||
|
||||
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.
|
||||
|
||||
- color panel
|
||||
- font panel (the UI part is done. Might require a rewrite of the font list
|
||||
retrievel code. Might also require a WMFontManager)
|
||||
- input method support (XIM). I have no idea of how to code it. People who use
|
||||
different characters than ASCII will have trouble editing menus without it...
|
||||
|
||||
@@ -84,9 +81,7 @@ 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 file panel, open/save
|
||||
- finish other wigets
|
||||
- optimize list scrolling (XCopyArea() the area that's already drawn)
|
||||
- InterfaceMaker?
|
||||
|
||||
3
WINGs/Resources/.cvsignore
Normal file
3
WINGs/Resources/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
Makefile Makefile.in
|
||||
.psrc .inslog2 tca.map tca.log
|
||||
*.rpt
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -1,210 +0,0 @@
|
||||
# Makefile.in generated automatically by automake 1.3 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
|
||||
bindir = @bindir@
|
||||
sbindir = @sbindir@
|
||||
libexecdir = @libexecdir@
|
||||
datadir = @datadir@
|
||||
sysconfdir = @sysconfdir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
localstatedir = @localstatedir@
|
||||
libdir = @libdir@
|
||||
infodir = @infodir@
|
||||
mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DISTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
top_builddir = ../..
|
||||
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
host_alias = @host_alias@
|
||||
host_triplet = @host@
|
||||
CC = @CC@
|
||||
CPP_PATH = @CPP_PATH@
|
||||
DFLAGS = @DFLAGS@
|
||||
GFXFLAGS = @GFXFLAGS@
|
||||
GFXLIBS = @GFXLIBS@
|
||||
I18N = @I18N@
|
||||
I18N_MB = @I18N_MB@
|
||||
ICONEXT = @ICONEXT@
|
||||
INTLIBS = @INTLIBS@
|
||||
LIBPL_INC_PATH = @LIBPL_INC_PATH@
|
||||
LIBPL_LIBS = @LIBPL_LIBS@
|
||||
LN_S = @LN_S@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MOFILES = @MOFILES@
|
||||
NLSDIR = @NLSDIR@
|
||||
PACKAGE = @PACKAGE@
|
||||
RANLIB = @RANLIB@
|
||||
REDUCE_APPICONS = @REDUCE_APPICONS@
|
||||
SHAPE = @SHAPE@
|
||||
SOUND = @SOUND@
|
||||
VERSION = @VERSION@
|
||||
WPMOFILES = @WPMOFILES@
|
||||
XCFLAGS = @XCFLAGS@
|
||||
XGETTEXT = @XGETTEXT@
|
||||
XLFLAGS = @XLFLAGS@
|
||||
XLIBS = @XLIBS@
|
||||
XSHM = @XSHM@
|
||||
X_EXTRA_LIBS = @X_EXTRA_LIBS@
|
||||
X_LOCALE = @X_LOCALE@
|
||||
pixmapdir = @pixmapdir@
|
||||
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 = tar
|
||||
GZIP = --best
|
||||
all: Makefile $(DATA)
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps WINGs/Resources/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
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)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
done
|
||||
info:
|
||||
dvi:
|
||||
check: all
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install-data: install-resdataDATA
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall: uninstall-resdataDATA
|
||||
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
installdirs:
|
||||
$(mkinstalldirs) $(DATADIR)$(resdatadir)
|
||||
|
||||
|
||||
mostlyclean-generic:
|
||||
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-generic
|
||||
|
||||
clean: clean-generic mostlyclean
|
||||
|
||||
distclean: distclean-generic clean
|
||||
-rm -f config.status
|
||||
|
||||
maintainer-clean: maintainer-clean-generic distclean
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: uninstall-resdataDATA install-resdataDATA tags distdir info dvi \
|
||||
installcheck install-exec install-data install uninstall all \
|
||||
installdirs mostlyclean-generic distclean-generic clean-generic \
|
||||
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
# 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 testcolorpanel
|
||||
|
||||
LDADD= $(top_builddir)/WINGs/libWINGs.a $(top_builddir)/wrlib/libwraster.la \
|
||||
@LIBPL@
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* Demo user widget for WINGs.
|
||||
* Demo user widget for WINGs
|
||||
*
|
||||
* Author: Alfredo K. Kojima
|
||||
*
|
||||
* This file is in the public domain.
|
||||
*
|
||||
* Copyright (c) 1998 Alfredo K. Kojima
|
||||
*/
|
||||
|
||||
|
||||
@@ -48,12 +50,13 @@ static void handleActionEvents(XEvent *event, void *data);
|
||||
|
||||
|
||||
/*
|
||||
* Some procedures you might want to override. Don't forget to call
|
||||
* the equivalent view procedure after (or before) doing your stuff.
|
||||
* Delegates
|
||||
* See the source for the other widgets to see how to use.
|
||||
* You won't need to use this most of the time.
|
||||
*/
|
||||
static W_ViewProcedureTable _MyWidgetViewProcedures = {
|
||||
static W_ViewDelegate _MyWidgetDelegate = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
@@ -73,7 +76,7 @@ InitMyWidget(WMScreen *scr)
|
||||
{
|
||||
/* register our widget with WINGs and get our widget class ID */
|
||||
if (!myWidgetClass) {
|
||||
myWidgetClass = W_RegisterUserWidget(&_MyWidgetViewProcedures);
|
||||
myWidgetClass = W_RegisterUserWidget();
|
||||
}
|
||||
|
||||
return myWidgetClass;
|
||||
@@ -105,12 +108,15 @@ CreateMyWidget(WMWidget *parent)
|
||||
*/
|
||||
mPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!mPtr->view) {
|
||||
free(mPtr);
|
||||
wfree(mPtr);
|
||||
return NULL;
|
||||
}
|
||||
/* always do this */
|
||||
mPtr->view->self = mPtr;
|
||||
|
||||
/* setup the delegates for the view */
|
||||
mPtr->view->delegate = &_MyWidgetDelegate;
|
||||
|
||||
/*
|
||||
* Intercept some events for our widget, so that we can handle them.
|
||||
*/
|
||||
@@ -144,7 +150,7 @@ paintMyWidget(_MyWidget *mPtr)
|
||||
color = WMWhiteColor(scr);
|
||||
|
||||
W_PaintText(mPtr->view, mPtr->view->window, scr->normalFont, 0, 0,
|
||||
mPtr->view->size.width, WACenter, W_GC(color),
|
||||
mPtr->view->size.width, WACenter, WMColorGC(color),
|
||||
False, mPtr->text, strlen(mPtr->text));
|
||||
|
||||
WMReleaseColor(color);
|
||||
@@ -194,7 +200,7 @@ SetMyWidgetText(MyWidget *mPtr, char *text)
|
||||
CHECK_CLASS(mPtr, myWidgetClass);
|
||||
|
||||
if (mPtr->text)
|
||||
free(mPtr->text);
|
||||
wfree(mPtr->text);
|
||||
|
||||
mPtr->text = wstrdup(text);
|
||||
|
||||
@@ -213,9 +219,9 @@ destroyMyWidget(_MyWidget *mPtr)
|
||||
*/
|
||||
|
||||
if (mPtr->text)
|
||||
free(mPtr->text);
|
||||
wfree(mPtr->text);
|
||||
|
||||
free(mPtr);
|
||||
wfree(mPtr);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
/*
|
||||
* Header foy demo widget.
|
||||
* Header for demo widget.
|
||||
*
|
||||
*/
|
||||
|
||||
81
WINGs/Tests/testcolorpanel.c
Normal file
81
WINGs/Tests/testcolorpanel.c
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
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. It's
|
||||
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 |
123
WINGs/Tests/wmfile.c
Normal file
123
WINGs/Tests/wmfile.c
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Author: Len Trigg <trigg@cs.waikato.ac.nz>
|
||||
*/
|
||||
|
||||
/*
|
||||
Update: Franck Wolff <frawolff@club-internet.fr>
|
||||
-----------------------------------------------------------------------
|
||||
List of updated functions :
|
||||
- main :
|
||||
add -s option for a save panel...
|
||||
-----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "WINGs.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "logo.xpm"
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
wAbort()
|
||||
{
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char *ProgName;
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage:\n"
|
||||
"\t%s [-options]\n"
|
||||
"\n"
|
||||
"options:\n"
|
||||
" -s\t\tSave panel (default open panel)\n"
|
||||
" -i <str>\tInitial directory (default /)\n"
|
||||
" -t <str>\tQuery window title (default none)\n"
|
||||
"\n"
|
||||
"information:\n"
|
||||
"\t%s pops up a WindowMaker style file selection panel.\n"
|
||||
"\n"
|
||||
"version:\n"
|
||||
"\t%s\n"
|
||||
,ProgName,ProgName,__DATE__
|
||||
);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
#define OPEN_PANEL_TYPE 0
|
||||
#define SAVE_PANEL_TYPE 1
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Display *dpy = XOpenDisplay("");
|
||||
WMScreen *scr;
|
||||
WMPixmap *pixmap;
|
||||
WMOpenPanel *oPanel;
|
||||
WMSavePanel *sPanel;
|
||||
/* RImage *image;*/
|
||||
char *title = NULL;
|
||||
char *initial = "/";
|
||||
int ch;
|
||||
int panelType = OPEN_PANEL_TYPE;
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
|
||||
WMInitializeApplication("WMFile", &argc, argv);
|
||||
|
||||
ProgName = argv[0];
|
||||
|
||||
if (!dpy) {
|
||||
puts("could not open display");
|
||||
exit(1);
|
||||
}
|
||||
while((ch = getopt(argc, argv, "si:ht:")) != -1)
|
||||
switch(ch)
|
||||
{
|
||||
case 's':
|
||||
panelType = SAVE_PANEL_TYPE;
|
||||
break;
|
||||
case 'i':
|
||||
initial = optarg;
|
||||
break;
|
||||
case 't':
|
||||
title = optarg;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
|
||||
for(; optind <argc; optind++)
|
||||
usage();
|
||||
|
||||
scr = WMCreateSimpleApplicationScreen(dpy);
|
||||
|
||||
|
||||
|
||||
pixmap = WMCreatePixmapFromXPMData(scr, GNUSTEP_XPM);
|
||||
WMSetApplicationIconImage(scr, pixmap);
|
||||
WMReleasePixmap(pixmap);
|
||||
if (panelType == SAVE_PANEL_TYPE) {
|
||||
sPanel = WMGetSavePanel(scr);
|
||||
if (WMRunModalFilePanelForDirectory(sPanel, NULL, initial,
|
||||
/*title*/ NULL, NULL) == True)
|
||||
printf("%s\n", WMGetFilePanelFileName(sPanel));
|
||||
else
|
||||
printf("\n");
|
||||
} else {
|
||||
oPanel = WMGetOpenPanel(scr);
|
||||
if (WMRunModalFilePanelForDirectory(oPanel, NULL, initial,
|
||||
/*title*/ NULL, NULL) == True)
|
||||
printf("%s\n", WMGetFilePanelFileName(oPanel));
|
||||
else
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
1319
WINGs/Tests/wtest.c
Normal file
1319
WINGs/Tests/wtest.c
Normal file
File diff suppressed because it is too large
Load Diff
840
WINGs/WINGs.h
840
WINGs/WINGs.h
File diff suppressed because it is too large
Load Diff
208
WINGs/WINGsP.h
208
WINGs/WINGsP.h
@@ -1,12 +1,14 @@
|
||||
#ifndef _WINGSP_H_
|
||||
#define _WINGSP_H_
|
||||
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
|
||||
#include "WINGs.h"
|
||||
#include "WUtil.h"
|
||||
|
||||
#if WINGS_H_VERSION < 980922
|
||||
#if WINGS_H_VERSION < 20000521
|
||||
#error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
|
||||
#endif
|
||||
|
||||
@@ -16,6 +18,10 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define DOUBLE_BUFFER
|
||||
|
||||
|
||||
@@ -26,20 +32,17 @@
|
||||
|
||||
#define SCROLLER_WIDTH 20
|
||||
|
||||
/* internal messages */
|
||||
#define WM_UPDATE_COLORWELL 130
|
||||
|
||||
|
||||
#define WM_USER_MESSAGE 1024
|
||||
#define XDND_VERSION 4
|
||||
|
||||
|
||||
#define SETUP_INTERNAL_MESSAGE(event, scrPtr) \
|
||||
event.xclient.type=ClientMessage;\
|
||||
event.xclient.display=scrPtr->display;\
|
||||
event.xclient.send_event=False;\
|
||||
event.xclient.serial=0;\
|
||||
event.xclient.format=32;\
|
||||
event.xclient.message_type=scrPtr->internalMessage;
|
||||
typedef struct W_Application {
|
||||
char *applicationName;
|
||||
int argc;
|
||||
char **argv;
|
||||
char *resourcePath;
|
||||
} W_Application;
|
||||
|
||||
|
||||
typedef struct W_Font {
|
||||
@@ -52,6 +55,7 @@ typedef struct W_Font {
|
||||
short height;
|
||||
short y;
|
||||
short refCount;
|
||||
char *name;
|
||||
unsigned int notFontSet:1;
|
||||
} W_Font;
|
||||
|
||||
@@ -85,6 +89,32 @@ typedef struct W_FocusInfo {
|
||||
struct W_FocusInfo *next;
|
||||
} W_FocusInfo;
|
||||
|
||||
|
||||
|
||||
struct W_DraggingInfo {
|
||||
Window destinationWindow;
|
||||
Window sourceWindow;
|
||||
|
||||
WMPoint location;
|
||||
|
||||
unsigned sourceOperation;
|
||||
WMPixmap *image;
|
||||
WMPoint imageLocation;
|
||||
|
||||
char **types;
|
||||
|
||||
Time timestamp;
|
||||
|
||||
int protocolVersion;
|
||||
|
||||
/* should be treated as internal data */
|
||||
WMView *sourceView;
|
||||
WMView *destView;
|
||||
WMSize mouseOffset;
|
||||
unsigned finished:1;
|
||||
};
|
||||
|
||||
|
||||
typedef struct W_Screen {
|
||||
Display *display;
|
||||
int screen;
|
||||
@@ -107,6 +137,7 @@ typedef struct W_Screen {
|
||||
W_FocusInfo *focusInfo;
|
||||
|
||||
struct W_Pixmap *applicationIcon;
|
||||
Window applicationIconWindow;
|
||||
|
||||
struct W_Window *windowList; /* list of windows in the app */
|
||||
|
||||
@@ -127,6 +158,11 @@ typedef struct W_Screen {
|
||||
|
||||
struct W_ColorPanel *sharedColorPanel;
|
||||
|
||||
Pixmap stipple;
|
||||
|
||||
struct W_View *dragSourceView;
|
||||
struct W_DraggingInfo dragInfo;
|
||||
|
||||
/* colors */
|
||||
W_Color *white;
|
||||
W_Color *black;
|
||||
@@ -150,6 +186,13 @@ typedef struct W_Screen {
|
||||
|
||||
W_Font *boldFont;
|
||||
|
||||
WMHashTable *fontCache;
|
||||
|
||||
Bool useMultiByte;
|
||||
|
||||
struct W_Balloon *balloon;
|
||||
|
||||
|
||||
struct W_Pixmap *checkButtonImageOn;
|
||||
struct W_Pixmap *checkButtonImageOff;
|
||||
|
||||
@@ -174,7 +217,31 @@ typedef struct W_Screen {
|
||||
struct W_Pixmap *pullDownIndicator;
|
||||
struct W_Pixmap *popUpIndicator;
|
||||
|
||||
struct W_Pixmap *checkMark;
|
||||
|
||||
struct W_Pixmap *homeIcon;
|
||||
struct W_Pixmap *altHomeIcon;
|
||||
|
||||
struct W_Pixmap *trashcanIcon;
|
||||
struct W_Pixmap *altTrashcanIcon;
|
||||
|
||||
struct W_Pixmap *createDirIcon;
|
||||
struct W_Pixmap *altCreateDirIcon;
|
||||
|
||||
struct W_Pixmap *disketteIcon;
|
||||
struct W_Pixmap *altDisketteIcon;
|
||||
struct W_Pixmap *unmountIcon;
|
||||
struct W_Pixmap *altUnmountIcon;
|
||||
|
||||
struct W_Pixmap *magnifyIcon;
|
||||
/* struct W_Pixmap *altMagnifyIcon;*/
|
||||
struct W_Pixmap *wheelIcon;
|
||||
struct W_Pixmap *grayIcon;
|
||||
struct W_Pixmap *rgbIcon;
|
||||
struct W_Pixmap *cmykIcon;
|
||||
struct W_Pixmap *hsbIcon;
|
||||
struct W_Pixmap *customPaletteIcon;
|
||||
struct W_Pixmap *colorListIcon;
|
||||
|
||||
struct W_Pixmap *defaultObjectIcon;
|
||||
|
||||
@@ -182,7 +249,7 @@ typedef struct W_Screen {
|
||||
|
||||
Cursor textCursor;
|
||||
|
||||
Atom internalMessage; /* for ClientMessage */
|
||||
Cursor invisibleCursor;
|
||||
|
||||
Atom attribsAtom; /* GNUstepWindowAttributes */
|
||||
|
||||
@@ -192,6 +259,25 @@ typedef struct W_Screen {
|
||||
|
||||
Atom clipboardAtom; /* CLIPBOARD */
|
||||
|
||||
Atom xdndAwareAtom; /* XdndAware */
|
||||
Atom xdndSelectionAtom;
|
||||
Atom xdndEnterAtom;
|
||||
Atom xdndLeaveAtom;
|
||||
Atom xdndPositionAtom;
|
||||
Atom xdndDropAtom;
|
||||
Atom xdndFinishedAtom;
|
||||
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 */
|
||||
Time lastClickTime; /* time of last mousedown event */
|
||||
@@ -204,12 +290,29 @@ typedef struct W_Screen {
|
||||
|
||||
|
||||
|
||||
typedef struct W_ViewDelegate {
|
||||
void *data;
|
||||
|
||||
void (*didMove)(struct W_ViewDelegate*, WMView*);
|
||||
|
||||
void (*didResize)(struct W_ViewDelegate*, WMView*);
|
||||
|
||||
void (*willMove)(struct W_ViewDelegate*, WMView*, int*, int*);
|
||||
|
||||
void (*willResize)(struct W_ViewDelegate*, WMView*,
|
||||
unsigned int*, unsigned int*);
|
||||
} W_ViewDelegate;
|
||||
|
||||
|
||||
|
||||
typedef struct W_View {
|
||||
struct W_Screen *screen;
|
||||
|
||||
WMWidget *self; /* must point to the widget the
|
||||
* view belongs to */
|
||||
|
||||
W_ViewDelegate *delegate;
|
||||
|
||||
Window window;
|
||||
|
||||
WMSize size;
|
||||
@@ -225,18 +328,23 @@ typedef struct W_View {
|
||||
|
||||
struct W_View *nextSister; /* next on parent's children list */
|
||||
|
||||
struct W_EventHandler *handlerList;/* list of event handlers for this window */
|
||||
WMBag *eventHandlers; /* event handlers for this window */
|
||||
|
||||
unsigned long attribFlags;
|
||||
XSetWindowAttributes attribs;
|
||||
|
||||
void *hangedData; /* data holder for user program */
|
||||
#if 0
|
||||
|
||||
WMColor *backColor;
|
||||
|
||||
Cursor cursor;
|
||||
|
||||
Atom *droppableTypes;
|
||||
struct W_DragSourceProcs *dragSourceProcs;
|
||||
struct W_DragDestinationProcs *dragDestinationProcs;
|
||||
#endif
|
||||
int helpContext;
|
||||
|
||||
|
||||
struct {
|
||||
unsigned int realized:1;
|
||||
unsigned int mapped:1;
|
||||
@@ -258,6 +366,7 @@ typedef struct W_View {
|
||||
unsigned int pendingRelease3:1;
|
||||
unsigned int pendingRelease4:1;
|
||||
unsigned int pendingRelease5:1;
|
||||
unsigned int xdndHintSet:1;
|
||||
} flags;
|
||||
|
||||
int refCount;
|
||||
@@ -270,27 +379,23 @@ typedef struct W_EventHandler {
|
||||
WMEventProc *proc;
|
||||
|
||||
void *clientData;
|
||||
|
||||
struct W_EventHandler *nextHandler;
|
||||
} W_EventHandler;
|
||||
|
||||
|
||||
|
||||
typedef struct W_ViewProcedureTable {
|
||||
void (*setBackgroundColor)(WMWidget*, WMColor *color);
|
||||
void (*resize)(WMWidget*, unsigned int, unsigned int);
|
||||
void (*move)(WMWidget*, int, int);
|
||||
} W_ViewProcedureTable;
|
||||
|
||||
|
||||
|
||||
typedef struct _WINGsConfiguration {
|
||||
char *systemFont;
|
||||
char *boldSystemFont;
|
||||
int defaultFontSize;
|
||||
Bool useMultiByte;
|
||||
char *floppyPath;
|
||||
unsigned doubleClickDelay;
|
||||
unsigned mouseWheelUp;
|
||||
unsigned mouseWheelDown;
|
||||
} _WINGsConfiguration;
|
||||
|
||||
_WINGsConfiguration WINGsConfiguration;
|
||||
extern _WINGsConfiguration WINGsConfiguration;
|
||||
|
||||
|
||||
|
||||
@@ -303,12 +408,20 @@ _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
|
||||
|
||||
#define W_VIEW_WIDTH(view) (view)->size.width
|
||||
#define W_VIEW_HEIGHT(view) (view)->size.height
|
||||
|
||||
|
||||
#define W_PIXEL(c) (c)->color.pixel
|
||||
#define W_GC(c) (c)->gc
|
||||
|
||||
#define W_FONTID(f) (f)->font->fid
|
||||
|
||||
#define W_DRAWABLE(scr) (scr)->rootWin
|
||||
#define W_DRAWABLE(scr) (scr)->rcontext->drawable
|
||||
|
||||
|
||||
|
||||
W_View *W_GetViewForXWindow(Display *display, Window window);
|
||||
@@ -317,6 +430,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);
|
||||
|
||||
@@ -324,7 +439,12 @@ void W_DestroyView(W_View *view);
|
||||
|
||||
void W_RealizeView(W_View *view);
|
||||
|
||||
void W_ReparentView(W_View *view, W_View *newParent);
|
||||
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);
|
||||
|
||||
@@ -342,9 +462,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_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_CleanUpEvents(W_View *view);
|
||||
|
||||
@@ -369,8 +495,6 @@ void W_BroadcastMessage(W_View *targetParent, XEvent *event);
|
||||
|
||||
void W_DispatchMessage(W_View *target, XEvent *event);
|
||||
|
||||
Bool W_CheckInternalMessage(W_Screen *scr, XClientMessageEvent *cev, int event);
|
||||
|
||||
void W_SetFocusOfToplevel(W_View *toplevel, W_View *view);
|
||||
|
||||
W_View *W_FocusedViewOfToplevel(W_View *view);
|
||||
@@ -385,10 +509,28 @@ void W_InitApplication(WMScreen *scr);
|
||||
|
||||
void W_InitNotificationCenter(void);
|
||||
|
||||
W_Class W_RegisterUserWidget(W_ViewProcedureTable *procTable);
|
||||
W_Class W_RegisterUserWidget(void);
|
||||
|
||||
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_FlushIdleNotificationQueue();
|
||||
|
||||
struct W_Balloon *W_CreateBalloon(WMScreen *scr);
|
||||
|
||||
void W_BalloonHandleEnterView(WMView *view);
|
||||
|
||||
void W_BalloonHandleLeaveView(WMView *view);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _WINGSP_H_ */
|
||||
|
||||
660
WINGs/WUtil.h
660
WINGs/WUtil.h
@@ -2,9 +2,14 @@
|
||||
#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
|
||||
@@ -22,6 +27,53 @@
|
||||
#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,
|
||||
@@ -37,12 +89,61 @@ typedef enum {
|
||||
} WMNotificationCoalescing;
|
||||
|
||||
|
||||
/* The possible states for connections */
|
||||
typedef enum {
|
||||
WCNotConnected=0,
|
||||
WCListening,
|
||||
WCInProgress,
|
||||
WCFailed,
|
||||
WCConnected,
|
||||
WCTimedOut,
|
||||
WCDied,
|
||||
WCClosed
|
||||
} WMConnectionState;
|
||||
|
||||
|
||||
/* The possible states for connection timeouts */
|
||||
typedef enum {
|
||||
WCTNone=0,
|
||||
WCTWhileOpening,
|
||||
WCTWhileSending
|
||||
} WMConnectionTimeoutState;
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
WBNotFound = INT_MIN, /* element was not found in WMBag */
|
||||
WANotFound = -1 /* element was not found in WMArray */
|
||||
};
|
||||
|
||||
|
||||
typedef struct W_Array WMArray;
|
||||
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 int WMCompareDataProc(const void *item1, const void *item2);
|
||||
|
||||
typedef void WMFreeDataProc(void *data);
|
||||
|
||||
/* Used by WMBag or WMArray for matching data */
|
||||
typedef int WMMatchDataProc(void *item, void *cdata);
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
int position;
|
||||
int count;
|
||||
} WMRange;
|
||||
|
||||
|
||||
|
||||
/* DO NOT ACCESS THE CONTENTS OF THIS STRUCT */
|
||||
@@ -65,8 +166,34 @@ typedef struct {
|
||||
} WMHashTableCallbacks;
|
||||
|
||||
|
||||
typedef void *WMBagIterator;
|
||||
|
||||
|
||||
#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);
|
||||
@@ -75,57 +202,110 @@ typedef void WMNotificationObserverAction(void *observerData,
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
typedef void (waborthandler)(int);
|
||||
|
||||
void wfatal(const char *msg, ...);
|
||||
void wwarning(const char *msg, ...);
|
||||
void wsyserror(const char *msg, ...);
|
||||
waborthandler* wsetabort(waborthandler*);
|
||||
|
||||
char *wfindfile(char *paths, char *file);
|
||||
|
||||
char *wfindfileinlist(char **path_list, char *file);
|
||||
|
||||
char *wexpandpath(char *path);
|
||||
|
||||
/* don't free the returned string */
|
||||
char *wgethomedir();
|
||||
char* wstrerror(int errnum);
|
||||
|
||||
void wmessage(const char *msg, ...);
|
||||
void wwarning(const char *msg, ...);
|
||||
void wfatal(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 *wmalloc(size_t size);
|
||||
void *wrealloc(void *ptr, size_t newsize);
|
||||
|
||||
void wrelease(void *ptr);
|
||||
void *wretain(void *ptr);
|
||||
void* wretain(void *ptr);
|
||||
|
||||
char *wstrdup(char *str);
|
||||
char* wstrdup(char *str);
|
||||
|
||||
char *wstrappend(char *dst, char *src);
|
||||
/* Concatenate str1 with str2 and return that in a newly malloc'ed string.
|
||||
* str1 and str2 can be any strings including static and constant strings.
|
||||
* str1 and str2 will not be modified.
|
||||
* Free the returned string when you're done with it. */
|
||||
char* wstrconcat(char *str1, char *str2);
|
||||
|
||||
char *wusergnusteppath();
|
||||
/* This will append src to dst, and return dst. dst MUST be either NULL
|
||||
* or a string that was a result of a dynamic allocation (malloc, realloc
|
||||
* wmalloc, wrealloc, ...). dst CANNOT be a static or a constant string!
|
||||
* Modifies dst (no new string is created except if dst==NULL in which case
|
||||
* it is equivalent to calling wstrdup(src) ).
|
||||
* The returned address may be different from the original address of dst,
|
||||
* so always assign the returned address to avoid dangling pointers. */
|
||||
char* wstrappend(char *dst, char *src);
|
||||
|
||||
char *wdefaultspathfordomain(char *domain);
|
||||
|
||||
void wtokensplit(char *command, char ***argv, int *argc);
|
||||
|
||||
char* wtokennext(char *word, char **next);
|
||||
|
||||
char* wtokenjoin(char **list, int count);
|
||||
|
||||
void wtokenfree(char **tokens, int count);
|
||||
|
||||
char* wtrimspace(char *s);
|
||||
|
||||
|
||||
|
||||
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);
|
||||
WMHashTable* WMCreateHashTable(WMHashTableCallbacks callbacks);
|
||||
|
||||
void WMFreeHashTable(WMHashTable *table);
|
||||
|
||||
void WMResetHashTable(WMHashTable *table);
|
||||
|
||||
void *WMHashGet(WMHashTable *table, const void *key);
|
||||
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* WMHashInsert(WMHashTable *table, const void *key, const 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);
|
||||
void* WMNextHashEnumeratorItem(WMHashEnumerator *enumerator);
|
||||
|
||||
unsigned WMCountHashTable(WMHashTable *table);
|
||||
|
||||
@@ -139,45 +319,293 @@ extern const WMHashTableCallbacks WMIntHashCallbacks;
|
||||
|
||||
extern const WMHashTableCallbacks WMStringHashCallbacks;
|
||||
/* keys are strings. Strings will be copied with wstrdup()
|
||||
* and freed with free() */
|
||||
* and freed with wfree() */
|
||||
|
||||
extern const WMHashTableCallbacks WMStringPointerHashCallbacks;
|
||||
/* keys are strings, bug they are not copied */
|
||||
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
WMNotification *WMCreateNotification(char *name, void *object, void *clientData);
|
||||
/*
|
||||
* WMArray use an array to store the elements.
|
||||
* Item indexes may be only positive integer numbers.
|
||||
* The array cannot contain holes in it.
|
||||
*
|
||||
* Pros:
|
||||
* Fast [O(1)] access to elements
|
||||
* Fast [O(1)] push/pop
|
||||
*
|
||||
* Cons:
|
||||
* A little slower [O(n)] for insertion/deletion of elements that
|
||||
* aren't in the end
|
||||
*/
|
||||
|
||||
WMArray* WMCreateArray(int initialSize);
|
||||
|
||||
WMArray* WMCreateArrayWithDestructor(int initialSize, WMFreeDataProc *destructor);
|
||||
|
||||
WMArray* WMCreateArrayWithArray(WMArray *array);
|
||||
|
||||
#define WMDuplicateArray(array) WMCreateArrayWithArray(array)
|
||||
|
||||
void WMEmptyArray(WMArray *array);
|
||||
|
||||
void WMFreeArray(WMArray *array);
|
||||
|
||||
int WMGetArrayItemCount(WMArray *array);
|
||||
|
||||
/* appends other to array. other remains unchanged */
|
||||
void WMAppendArray(WMArray *array, WMArray *other);
|
||||
|
||||
/* add will place the element at the end of the array */
|
||||
void WMAddToArray(WMArray *array, void *item);
|
||||
|
||||
#define WMPushInArray(array, item) WMAddToArray(array, item)
|
||||
|
||||
/* insert will increment the index of elements after it by 1 */
|
||||
void WMInsertInArray(WMArray *array, int index, void *item);
|
||||
|
||||
/* replace and set will return the old item WITHOUT calling the
|
||||
* destructor on it even if its available. Free the returned item yourself.
|
||||
*/
|
||||
void* WMReplaceInArray(WMArray *array, int index, void *item);
|
||||
|
||||
#define WMSetInArray(array, index, item) WMReplaceInArray(array, index, item)
|
||||
|
||||
/* delete and remove will remove the elements and cause the elements
|
||||
* after them to decrement their indexes by 1. Also will call the
|
||||
* destructor on the deleted element if there's one available.
|
||||
*/
|
||||
int WMDeleteFromArray(WMArray *array, int index);
|
||||
|
||||
int WMRemoveFromArray(WMArray *array, void *item);
|
||||
|
||||
void* WMGetFromArray(WMArray *array, int index);
|
||||
|
||||
#define WMGetFirstInArray(array, item) WMFindInArray(array, NULL, item)
|
||||
|
||||
/* pop will return the last element from the array, also removing it
|
||||
* from the array. The destructor is NOT called, even if available.
|
||||
* Free the returned element if needed by yourself
|
||||
*/
|
||||
void* WMPopFromArray(WMArray *array);
|
||||
|
||||
int WMFindInArray(WMArray *array, WMMatchDataProc *match, void *cdata);
|
||||
|
||||
int WMCountInArray(WMArray *array, void *item);
|
||||
|
||||
/* comparer must return:
|
||||
* < 0 if a < b
|
||||
* > 0 if a > b
|
||||
* = 0 if a = b
|
||||
*/
|
||||
void WMSortArray(WMArray *array, WMCompareDataProc *comparer);
|
||||
|
||||
void WMMapArray(WMArray *array, void (*function)(void*, void*), void *data);
|
||||
|
||||
WMArray* WMGetSubarrayWithRange(WMArray* array, WMRange aRange);
|
||||
|
||||
|
||||
/*..........................................................................*/
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define WMCreateBag(size) WMCreateTreeBag()
|
||||
|
||||
#define WMCreateBagWithDestructor(size, d) WMCreateTreeBagWithDestructor(d)
|
||||
|
||||
WMBag* WMCreateTreeBag(void);
|
||||
|
||||
WMBag* WMCreateTreeBagWithDestructor(WMFreeDataProc *destructor);
|
||||
|
||||
int WMGetBagItemCount(WMBag *bag);
|
||||
|
||||
void WMAppendBag(WMBag *bag, WMBag *other);
|
||||
|
||||
void WMPutInBag(WMBag *bag, void *item);
|
||||
|
||||
/* insert will increment the index of elements after it by 1 */
|
||||
void WMInsertInBag(WMBag *bag, int index, void *item);
|
||||
|
||||
/* this is slow */
|
||||
/* erase will remove the element from the bag,
|
||||
* but will keep the index of the other elements unchanged */
|
||||
int WMEraseFromBag(WMBag *bag, int index);
|
||||
|
||||
/* delete and remove will remove the elements and cause the elements
|
||||
* after them to decrement their indexes by 1 */
|
||||
int WMDeleteFromBag(WMBag *bag, int index);
|
||||
|
||||
int WMRemoveFromBag(WMBag *bag, void *item);
|
||||
|
||||
void* WMGetFromBag(WMBag *bag, int index);
|
||||
|
||||
void* WMReplaceInBag(WMBag *bag, int index, void *item);
|
||||
|
||||
#define WMSetInBag(bag, index, item) WMReplaceInBag(bag, index, item)
|
||||
|
||||
/* comparer must return:
|
||||
* < 0 if a < b
|
||||
* > 0 if a > b
|
||||
* = 0 if a = b
|
||||
*/
|
||||
void WMSortBag(WMBag *bag, WMCompareDataProc *comparer);
|
||||
|
||||
void WMEmptyBag(WMBag *bag);
|
||||
|
||||
void WMFreeBag(WMBag *bag);
|
||||
|
||||
void WMMapBag(WMBag *bag, void (*function)(void*, void*), void *data);
|
||||
|
||||
int WMGetFirstInBag(WMBag *bag, void *item);
|
||||
|
||||
int WMCountInBag(WMBag *bag, void *item);
|
||||
|
||||
int WMFindInBag(WMBag *bag, WMMatchDataProc *match, void *cdata);
|
||||
|
||||
void* WMBagFirst(WMBag *bag, WMBagIterator *ptr);
|
||||
|
||||
void* WMBagLast(WMBag *bag, WMBagIterator *ptr);
|
||||
|
||||
void* WMBagNext(WMBag *bag, WMBagIterator *ptr);
|
||||
|
||||
void* WMBagPrevious(WMBag *bag, WMBagIterator *ptr);
|
||||
|
||||
void* WMBagIteratorAtIndex(WMBag *bag, int index, WMBagIterator *ptr);
|
||||
|
||||
int WMBagIndexForIterator(WMBag *bag, WMBagIterator 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);
|
||||
|
||||
/* destructor is a function called to free the data when releasing the data
|
||||
* object, or NULL if no freeing of data is necesary. */
|
||||
WMData* WMCreateDataWithBytesNoCopy(void *bytes, unsigned length,
|
||||
WMFreeDataProc *destructor);
|
||||
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
|
||||
|
||||
void WMSetDataFormat(WMData *aData, unsigned format);
|
||||
|
||||
unsigned WMGetDataFormat(WMData *aData);
|
||||
/* Storing data */
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
WMNotification* WMCreateNotification(const char *name, void *object, void *clientData);
|
||||
|
||||
void WMReleaseNotification(WMNotification *notification);
|
||||
|
||||
WMNotification *WMRetainNotification(WMNotification *notification);
|
||||
WMNotification* WMRetainNotification(WMNotification *notification);
|
||||
|
||||
void *WMGetNotificationClientData(WMNotification *notification);
|
||||
void* WMGetNotificationClientData(WMNotification *notification);
|
||||
|
||||
void *WMGetNotificationObject(WMNotification *notification);
|
||||
void* WMGetNotificationObject(WMNotification *notification);
|
||||
|
||||
char *WMGetNotificationName(WMNotification *notification);
|
||||
const char* WMGetNotificationName(WMNotification *notification);
|
||||
|
||||
|
||||
void WMAddNotificationObserver(WMNotificationObserverAction *observerAction,
|
||||
void *observer, char *name, void *object);
|
||||
void *observer, const char *name, void *object);
|
||||
|
||||
void WMPostNotification(WMNotification *notification);
|
||||
|
||||
void WMRemoveNotificationObserver(void *observer);
|
||||
|
||||
void WMRemoveNotificationObserverWithName(void *observer, char *name,
|
||||
void WMRemoveNotificationObserverWithName(void *observer, const char *name,
|
||||
void *object);
|
||||
|
||||
void WMPostNotificationName(char *name, void *object, void *clientData);
|
||||
void WMPostNotificationName(const char *name, void *object, void *clientData);
|
||||
|
||||
WMNotificationQueue *WMGetDefaultNotificationQueue(void);
|
||||
WMNotificationQueue* WMGetDefaultNotificationQueue(void);
|
||||
|
||||
WMNotificationQueue *WMCreateNotificationQueue(void);
|
||||
WMNotificationQueue* WMCreateNotificationQueue(void);
|
||||
|
||||
void WMDequeueNotificationMatching(WMNotificationQueue *queue, unsigned mask);
|
||||
void WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
||||
WMNotification *notification,
|
||||
unsigned mask);
|
||||
|
||||
void WMEnqueueNotification(WMNotificationQueue *queue, WMNotification *notification,
|
||||
void WMEnqueueNotification(WMNotificationQueue *queue,
|
||||
WMNotification *notification,
|
||||
WMPostingStyle postingStyle);
|
||||
|
||||
void WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
|
||||
@@ -188,7 +616,20 @@ void WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
|
||||
|
||||
/*......................................................................*/
|
||||
|
||||
WMUserDefaults *WMGetStandardUserDefaults(void);
|
||||
WMUserDefaults* WMGetStandardUserDefaults(void);
|
||||
|
||||
WMUserDefaults* WMGetDefaultsFromPath(char *path);
|
||||
|
||||
void WMSynchronizeUserDefaults(WMUserDefaults *database);
|
||||
|
||||
void WMSaveUserDefaults(WMUserDefaults *database);
|
||||
|
||||
void WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable);
|
||||
|
||||
/* Returns a PLArray with all keys in the user defaults database.
|
||||
* Free the returned array with PLRelease() when no longer needed,
|
||||
* but do not free the elements of the array! They're just references. */
|
||||
proplist_t WMGetUDAllKeys(WMUserDefaults *database);
|
||||
|
||||
proplist_t WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
@@ -197,12 +638,11 @@ void WMSetUDObjectForKey(WMUserDefaults *database, proplist_t object,
|
||||
|
||||
void WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
/* you can free the returned string */
|
||||
char *WMGetUDStringForKey(WMUserDefaults *database, char *defaultName);
|
||||
char* WMGetUDStringForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
int WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
int WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName);
|
||||
float WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
Bool WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName);
|
||||
|
||||
@@ -222,6 +662,150 @@ 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 WMArray with all the names of the host.
|
||||
*/
|
||||
char* WMGetHostName(WMHost* hPtr);
|
||||
|
||||
/* The returned array is R/O. Do not modify it, and do not free it! */
|
||||
WMArray* 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 WMArray with all addresses of the host.
|
||||
*/
|
||||
char* WMGetHostAddress(WMHost* hPtr);
|
||||
|
||||
/* The returned array is R/O. Do not modify it, and do not free it! */
|
||||
WMArray* 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);
|
||||
|
||||
Bool WMSetConnectionNonBlocking(WMConnection *cPtr, Bool flag);
|
||||
|
||||
Bool WMSetConnectionCloseOnExec(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);
|
||||
|
||||
WMConnectionTimeoutState WMGetConnectionTimeoutState(WMConnection *cPtr);
|
||||
|
||||
WMArray* WMGetConnectionUnsentData(WMConnection *cPtr);
|
||||
|
||||
#define WMGetConnectionQueuedData(cPtr) WMGetConnectionUnsentData(cPtr)
|
||||
|
||||
|
||||
/*
|
||||
* Passing timeout==0 in the SetTimeout functions below, will reset that
|
||||
* timeout to its default value.
|
||||
*/
|
||||
|
||||
/* The default timeout inherited by all WMConnection operations, if none set */
|
||||
void WMSetConnectionDefaultTimeout(unsigned int timeout);
|
||||
|
||||
/* Global timeout for all WMConnection objects, for opening a new connection */
|
||||
void WMSetConnectionOpenTimeout(unsigned int timeout);
|
||||
|
||||
/* Connection specific timeout for sending out data */
|
||||
void WMSetConnectionSendTimeout(WMConnection *cPtr, unsigned int timeout);
|
||||
|
||||
|
||||
/* Global variables */
|
||||
|
||||
extern int WCErrorCode;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
306
WINGs/array.c
Normal file
306
WINGs/array.c
Normal file
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
* 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
|
||||
WMRemoveFromArray(WMArray *array, void *item)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < array->itemCount; i++) {
|
||||
if (array->items[i] == item) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
868
WINGs/bagtree.c
Normal file
868
WINGs/bagtree.c
Normal file
@@ -0,0 +1,868 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
|
||||
typedef struct W_Node {
|
||||
struct W_Node *parent;
|
||||
struct W_Node *left;
|
||||
struct W_Node *right;
|
||||
int color;
|
||||
|
||||
void *data;
|
||||
int index;
|
||||
} W_Node;
|
||||
|
||||
|
||||
typedef struct W_Bag {
|
||||
W_Node *root;
|
||||
|
||||
W_Node *nil; /* sentinel */
|
||||
|
||||
int count;
|
||||
|
||||
void (*destructor)(void *item);
|
||||
} W_Bag;
|
||||
|
||||
|
||||
|
||||
#define IS_LEFT(node) (node == node->parent->left)
|
||||
#define IS_RIGHT(node) (node == node->parent->right)
|
||||
|
||||
|
||||
|
||||
static void
|
||||
leftRotate(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *node2;
|
||||
|
||||
node2 = node->right;
|
||||
node->right = node2->left;
|
||||
|
||||
node2->left->parent = node;
|
||||
|
||||
node2->parent = node->parent;
|
||||
|
||||
if (node->parent == tree->nil) {
|
||||
tree->root = node2;
|
||||
} else {
|
||||
if (IS_LEFT(node)) {
|
||||
node->parent->left = node2;
|
||||
} else {
|
||||
node->parent->right = node2;
|
||||
}
|
||||
}
|
||||
node2->left = node;
|
||||
node->parent = node2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
rightRotate(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *node2;
|
||||
|
||||
node2 = node->left;
|
||||
node->left = node2->right;
|
||||
|
||||
node2->right->parent = node;
|
||||
|
||||
node2->parent = node->parent;
|
||||
|
||||
if (node->parent == tree->nil) {
|
||||
tree->root = node2;
|
||||
} else {
|
||||
if (IS_LEFT(node)) {
|
||||
node->parent->left = node2;
|
||||
} else {
|
||||
node->parent->right = node2;
|
||||
}
|
||||
}
|
||||
node2->right = node;
|
||||
node->parent = node2;
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
x = x->left;
|
||||
else
|
||||
x = x->right;
|
||||
}
|
||||
node->parent = y;
|
||||
if (y == tree->nil)
|
||||
tree->root = node;
|
||||
else if (node->index <= y->index)
|
||||
y->left = node;
|
||||
else
|
||||
y->right = node;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rbTreeInsert(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *y;
|
||||
|
||||
treeInsert(tree, node);
|
||||
|
||||
node->color = 'R';
|
||||
|
||||
while (node != tree->root && node->parent->color == 'R') {
|
||||
if (IS_LEFT(node->parent)) {
|
||||
y = node->parent->parent->right;
|
||||
|
||||
if (y->color == 'R') {
|
||||
|
||||
node->parent->color = 'B';
|
||||
y->color = 'B';
|
||||
node->parent->parent->color = 'R';
|
||||
node = node->parent->parent;
|
||||
|
||||
} else {
|
||||
if (IS_RIGHT(node)) {
|
||||
node = node->parent;
|
||||
leftRotate(tree, node);
|
||||
}
|
||||
node->parent->color = 'B';
|
||||
node->parent->parent->color = 'R';
|
||||
rightRotate(tree, node->parent->parent);
|
||||
}
|
||||
} else {
|
||||
y = node->parent->parent->left;
|
||||
|
||||
if (y->color == 'R') {
|
||||
|
||||
node->parent->color = 'B';
|
||||
y->color = 'B';
|
||||
node->parent->parent->color = 'R';
|
||||
node = node->parent->parent;
|
||||
|
||||
} else {
|
||||
if (IS_LEFT(node)) {
|
||||
node = node->parent;
|
||||
rightRotate(tree, node);
|
||||
}
|
||||
node->parent->color = 'B';
|
||||
node->parent->parent->color = 'R';
|
||||
leftRotate(tree, node->parent->parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
tree->root->color = 'B';
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rbDeleteFixup(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *w;
|
||||
|
||||
while (node != tree->root && node->color == 'B') {
|
||||
if (IS_LEFT(node)) {
|
||||
w = node->parent->right;
|
||||
if (w->color == 'R') {
|
||||
w->color = 'B';
|
||||
node->parent->color = 'R';
|
||||
leftRotate(tree, node->parent);
|
||||
w = node->parent->right;
|
||||
}
|
||||
if (w->left->color == 'B' && w->right->color == 'B') {
|
||||
w->color = 'R';
|
||||
node = node->parent;
|
||||
} else {
|
||||
if (w->right->color == 'B') {
|
||||
w->left->color = 'B';
|
||||
w->color = 'R';
|
||||
rightRotate(tree, w);
|
||||
w = node->parent->right;
|
||||
}
|
||||
w->color = node->parent->color;
|
||||
node->parent->color = 'B';
|
||||
w->right->color = 'B';
|
||||
leftRotate(tree, node->parent);
|
||||
node = tree->root;
|
||||
}
|
||||
} else {
|
||||
w = node->parent->left;
|
||||
if (w->color == 'R') {
|
||||
w->color = 'B';
|
||||
node->parent->color = 'R';
|
||||
rightRotate(tree, node->parent);
|
||||
w = node->parent->left;
|
||||
}
|
||||
if (w->left->color == 'B' && w->right->color == 'B') {
|
||||
w->color = 'R';
|
||||
node = node->parent;
|
||||
} else {
|
||||
if (w->left->color == 'B') {
|
||||
w->right->color = 'B';
|
||||
w->color = 'R';
|
||||
leftRotate(tree, w);
|
||||
w = node->parent->left;
|
||||
}
|
||||
w->color = node->parent->color;
|
||||
node->parent->color = 'B';
|
||||
w->left->color = 'B';
|
||||
rightRotate(tree, node->parent);
|
||||
node = tree->root;
|
||||
}
|
||||
}
|
||||
}
|
||||
node->color = 'B';
|
||||
|
||||
}
|
||||
|
||||
|
||||
static W_Node*
|
||||
treeMinimum(W_Node *node, W_Node *nil)
|
||||
{
|
||||
while (node->left != nil)
|
||||
node = node->left;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
static W_Node*
|
||||
treeMaximum(W_Node *node, W_Node *nil)
|
||||
{
|
||||
while (node->right != nil)
|
||||
node = node->right;
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
static W_Node*
|
||||
treeSuccessor(W_Node *node, W_Node *nil)
|
||||
{
|
||||
W_Node *y;
|
||||
|
||||
if (node->right != nil) {
|
||||
return treeMinimum(node->right, nil);
|
||||
}
|
||||
y = node->parent;
|
||||
while (y != nil && node == y->right) {
|
||||
node = y;
|
||||
y = y->parent;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
static W_Node*
|
||||
treePredecessor(W_Node *node, W_Node *nil)
|
||||
{
|
||||
W_Node *y;
|
||||
|
||||
if (node->left != nil) {
|
||||
return treeMaximum(node->left, nil);
|
||||
}
|
||||
y = node->parent;
|
||||
while (y != nil && node == y->left) {
|
||||
node = y;
|
||||
y = y->parent;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
static W_Node*
|
||||
rbTreeDelete(W_Bag *tree, W_Node *node)
|
||||
{
|
||||
W_Node *nil = tree->nil;
|
||||
W_Node *x, *y;
|
||||
|
||||
if (node->left == nil || node->right == nil) {
|
||||
y = node;
|
||||
} else {
|
||||
y = treeSuccessor(node, nil);
|
||||
}
|
||||
|
||||
if (y->left != nil) {
|
||||
x = y->left;
|
||||
} else {
|
||||
x = y->right;
|
||||
}
|
||||
|
||||
x->parent = y->parent;
|
||||
|
||||
if (y->parent == nil) {
|
||||
tree->root = x;
|
||||
} else {
|
||||
if (IS_LEFT(y)) {
|
||||
y->parent->left = x;
|
||||
} else {
|
||||
y->parent->right = x;
|
||||
}
|
||||
}
|
||||
if (y != node) {
|
||||
node->index = y->index;
|
||||
node->data = y->data;
|
||||
}
|
||||
if (y->color == 'B') {
|
||||
rbDeleteFixup(tree, x);
|
||||
}
|
||||
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
static W_Node*
|
||||
treeSearch(W_Node *root, W_Node *nil, int index)
|
||||
{
|
||||
if (root == nil || root->index == index) {
|
||||
return root;
|
||||
}
|
||||
|
||||
if (index < root->index) {
|
||||
return treeSearch(root->left, nil, index);
|
||||
} else {
|
||||
return treeSearch(root->right, nil, index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static W_Node*
|
||||
treeFind(W_Node *root, W_Node *nil, void *data)
|
||||
{
|
||||
W_Node *tmp;
|
||||
|
||||
if (root == nil || root->data == data)
|
||||
return root;
|
||||
|
||||
tmp = treeFind(root->left, nil, data);
|
||||
if (tmp != nil)
|
||||
return tmp;
|
||||
|
||||
tmp = treeFind(root->right, nil, data);
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
static char buf[512];
|
||||
|
||||
static void
|
||||
printNodes(W_Node *node, W_Node *nil, int depth)
|
||||
{
|
||||
if (node == nil) {
|
||||
return;
|
||||
}
|
||||
|
||||
printNodes(node->left, nil, depth+1);
|
||||
|
||||
memset(buf, ' ', depth*2);
|
||||
buf[depth*2] = 0;
|
||||
if (IS_LEFT(node))
|
||||
printf("%s/(%2i\n", buf, node->index);
|
||||
else
|
||||
printf("%s\\(%2i\n", buf, node->index);
|
||||
|
||||
printNodes(node->right, nil, depth+1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PrintTree(WMBag *bag)
|
||||
{
|
||||
W_TreeBag *tree = (W_TreeBag*)bag->data;
|
||||
|
||||
printNodes(tree->root, tree->nil, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
WMBag*
|
||||
WMCreateTreeBag(void)
|
||||
{
|
||||
return WMCreateTreeBagWithDestructor(NULL);
|
||||
}
|
||||
|
||||
|
||||
WMBag*
|
||||
WMCreateTreeBagWithDestructor(WMFreeDataProc *destructor)
|
||||
{
|
||||
WMBag *bag;
|
||||
|
||||
bag = wmalloc(sizeof(WMBag));
|
||||
|
||||
memset(bag, 0, sizeof(WMBag));
|
||||
|
||||
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;
|
||||
|
||||
bag->root = bag->nil;
|
||||
|
||||
bag->destructor = destructor;
|
||||
|
||||
return bag;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetBagItemCount(WMBag *self)
|
||||
{
|
||||
return self->count;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMAppendBag(WMBag *self, WMBag *bag)
|
||||
{
|
||||
WMBagIterator ptr;
|
||||
void *data;
|
||||
|
||||
for (data = WMBagFirst(bag, &ptr); data != NULL; data = WMBagNext(bag, &ptr)) {
|
||||
WMPutInBag(self, data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
|
||||
rbTreeInsert(self, ptr);
|
||||
|
||||
self->count++;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMInsertInBag(WMBag *self, int index, void *item)
|
||||
{
|
||||
W_Node *ptr;
|
||||
|
||||
ptr = wmalloc(sizeof(W_Node));
|
||||
|
||||
ptr->data = item;
|
||||
ptr->index = index;
|
||||
ptr->left = self->nil;
|
||||
ptr->right = self->nil;
|
||||
ptr->parent = self->nil;
|
||||
|
||||
rbTreeInsert(self, ptr);
|
||||
|
||||
while ((ptr = treeSuccessor(ptr, self->nil)) != self->nil) {
|
||||
ptr->index++;
|
||||
}
|
||||
|
||||
|
||||
self->count++;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMRemoveFromBag(WMBag *self, void *item)
|
||||
{
|
||||
W_Node *ptr = treeFind(self->root, self->nil, item);
|
||||
|
||||
if (ptr != self->nil) {
|
||||
W_Node *tmp;
|
||||
|
||||
self->count--;
|
||||
|
||||
tmp = treeSuccessor(ptr, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
tmp->index--;
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
ptr = rbTreeDelete(self, ptr);
|
||||
if (self->destructor)
|
||||
self->destructor(ptr->data);
|
||||
wfree(ptr);
|
||||
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMEraseFromBag(WMBag *self, int index)
|
||||
{
|
||||
W_Node *ptr = treeSearch(self->root, self->nil, index);
|
||||
|
||||
if (ptr != self->nil) {
|
||||
|
||||
self->count--;
|
||||
|
||||
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 {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMDeleteFromBag(WMBag *self, int index)
|
||||
{
|
||||
W_Node *ptr = treeSearch(self->root, self->nil, index);
|
||||
|
||||
if (ptr != self->nil) {
|
||||
W_Node *tmp;
|
||||
|
||||
self->count--;
|
||||
|
||||
tmp = treeSuccessor(ptr, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
tmp->index--;
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
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 {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMGetFromBag(WMBag *self, int index)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeSearch(self->root, self->nil, index);
|
||||
if (node != self->nil)
|
||||
return node->data;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMGetFirstInBag(WMBag *self, void *item)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeFind(self->root, self->nil, item);
|
||||
if (node != self->nil)
|
||||
return node->index;
|
||||
else
|
||||
return WBNotFound;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int
|
||||
treeCount(W_Node *root, W_Node *nil, void *item)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (root == nil)
|
||||
return 0;
|
||||
|
||||
if (root->data == item)
|
||||
count++;
|
||||
|
||||
if (root->left != nil)
|
||||
count += treeCount(root->left, nil, item);
|
||||
|
||||
if (root->right != nil)
|
||||
count += treeCount(root->right, nil, item);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
WMCountInBag(WMBag *self, void *item)
|
||||
{
|
||||
return treeCount(self->root, self->nil, item);
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMReplaceInBag(WMBag *self, int index, void *item)
|
||||
{
|
||||
W_Node *ptr = treeSearch(self->root, self->nil, index);
|
||||
void *old = NULL;
|
||||
|
||||
if (item == NULL) {
|
||||
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 {
|
||||
W_Node *ptr;
|
||||
|
||||
ptr = wmalloc(sizeof(W_Node));
|
||||
|
||||
ptr->data = item;
|
||||
ptr->index = index;
|
||||
ptr->left = self->nil;
|
||||
ptr->right = self->nil;
|
||||
ptr->parent = self->nil;
|
||||
|
||||
rbTreeInsert(self, ptr);
|
||||
|
||||
self->count++;
|
||||
}
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSortBag(WMBag *self, WMCompareDataProc *comparer)
|
||||
{
|
||||
void **items;
|
||||
W_Node *tmp;
|
||||
int i;
|
||||
|
||||
if (self->count == 0)
|
||||
return;
|
||||
|
||||
items = wmalloc(sizeof(void*)*self->count);
|
||||
i = 0;
|
||||
|
||||
tmp = treeMinimum(self->root, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
items[i++] = tmp->data;
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
qsort(&items[0], self->count, sizeof(void*), comparer);
|
||||
|
||||
i = 0;
|
||||
tmp = treeMinimum(self->root, self->nil);
|
||||
while (tmp != self->nil) {
|
||||
tmp->index = i;
|
||||
tmp->data = items[i++];
|
||||
tmp = treeSuccessor(tmp, self->nil);
|
||||
}
|
||||
|
||||
wfree(items);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
deleteTree(WMBag *self, W_Node *node)
|
||||
{
|
||||
if (node == self->nil)
|
||||
return;
|
||||
|
||||
deleteTree(self, node->left);
|
||||
|
||||
if (self->destructor)
|
||||
self->destructor(node->data);
|
||||
|
||||
deleteTree(self, node->right);
|
||||
|
||||
wfree(node);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMEmptyBag(WMBag *self)
|
||||
{
|
||||
deleteTree(self, self->root);
|
||||
self->root = self->nil;
|
||||
self->count = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMFreeBag(WMBag *self)
|
||||
{
|
||||
WMEmptyBag(self);
|
||||
wfree(self->nil);
|
||||
wfree(self);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
mapTree(W_Bag *tree, W_Node *node, void (*function)(void*, void*), void *data)
|
||||
{
|
||||
if (node == tree->nil)
|
||||
return;
|
||||
|
||||
mapTree(tree, node->left, function, data);
|
||||
|
||||
(*function)(node->data, data);
|
||||
|
||||
mapTree(tree, node->right, function, data);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMMapBag(WMBag *self, void (*function)(void*, void*), void *data)
|
||||
{
|
||||
mapTree(self, self->root, function, data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
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, cdata);
|
||||
if (index != WBNotFound)
|
||||
return index;
|
||||
|
||||
if ((*function)(node->data, cdata)) {
|
||||
return node->index;
|
||||
}
|
||||
|
||||
return findInTree(tree, node->right, function, cdata);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMFindInBag(WMBag *self, WMMatchDataProc *match, void *cdata)
|
||||
{
|
||||
return findInTree(self, self->root, match, cdata);
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMBagFirst(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeMinimum(self->root, self->nil);
|
||||
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMBagLast(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
|
||||
W_Node *node;
|
||||
|
||||
node = treeMaximum(self->root, self->nil);
|
||||
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMBagNext(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
if (*ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
node = treeSuccessor(*ptr, self->nil);
|
||||
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMBagPrevious(WMBag *self, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
if (*ptr == NULL)
|
||||
return NULL;
|
||||
|
||||
node = treePredecessor(*ptr, self->nil);
|
||||
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void*
|
||||
WMBagIteratorAtIndex(WMBag *self, int index, WMBagIterator *ptr)
|
||||
{
|
||||
W_Node *node;
|
||||
|
||||
node = treeSearch(self->root, self->nil, index);
|
||||
|
||||
if (node == self->nil) {
|
||||
*ptr = NULL;
|
||||
return NULL;
|
||||
} else {
|
||||
*ptr = node;
|
||||
return node->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMBagIndexForIterator(WMBag *bag, WMBagIterator ptr)
|
||||
{
|
||||
return ((W_Node*)ptr)->index;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include <X11/Xlocale.h>
|
||||
|
||||
#include <proplist.h>
|
||||
|
||||
|
||||
@@ -9,11 +11,35 @@ _WINGsConfiguration WINGsConfiguration;
|
||||
|
||||
|
||||
|
||||
#define SYSTEM_FONT "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*"
|
||||
#define SYSTEM_FONT "-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*,-*-*-medium-r-*-*-%d-*-*-*-*-*-*-*"
|
||||
|
||||
#define BOLD_SYSTEM_FONT "-*-helvetica-bold-r-normal-*-%d-*-*-*-*-*-*-*"
|
||||
#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
|
||||
@@ -26,15 +52,70 @@ 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 = 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");
|
||||
}
|
||||
|
||||
|
||||
if (!WINGsConfiguration.systemFont) {
|
||||
WINGsConfiguration.systemFont = SYSTEM_FONT;
|
||||
@@ -42,8 +123,21 @@ 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
1009
WINGs/connection.c
Normal file
1009
WINGs/connection.c
Normal file
File diff suppressed because it is too large
Load Diff
350
WINGs/data.c
Normal file
350
WINGs/data.c
Normal file
@@ -0,0 +1,350 @@
|
||||
/*
|
||||
* WINGs WMData function library
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#include "WUtil.h"
|
||||
|
||||
|
||||
typedef struct W_Data {
|
||||
unsigned length; /* How many bytes we have */
|
||||
unsigned capacity; /* How many bytes it can hold */
|
||||
unsigned growth; /* How much to grow */
|
||||
void *bytes; /* Actual data */
|
||||
unsigned retainCount;
|
||||
WMFreeDataProc *destructor;
|
||||
int format; /* 0, 8, 16 or 32 */
|
||||
} W_Data;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Creating and destroying data objects */
|
||||
|
||||
WMData*
|
||||
WMCreateDataWithCapacity(unsigned capacity) /*FOLD00*/
|
||||
{
|
||||
WMData *aData;
|
||||
|
||||
aData = (WMData*)wmalloc(sizeof(WMData));
|
||||
|
||||
if (capacity>0)
|
||||
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->format = 0;
|
||||
aData->destructor = wfree;
|
||||
|
||||
return aData;
|
||||
}
|
||||
|
||||
|
||||
WMData*
|
||||
WMCreateDataWithLength(unsigned length) /*FOLD00*/
|
||||
{
|
||||
WMData *aData;
|
||||
|
||||
aData = WMCreateDataWithCapacity(length);
|
||||
if (length>0) {
|
||||
memset(aData->bytes, 0, length);
|
||||
aData->length = length;
|
||||
}
|
||||
|
||||
return aData;
|
||||
}
|
||||
|
||||
|
||||
WMData*
|
||||
WMCreateDataWithBytes(void *bytes, unsigned length) /*FOLD00*/
|
||||
{
|
||||
WMData *aData;
|
||||
|
||||
aData = WMCreateDataWithCapacity(length);
|
||||
aData->length = length;
|
||||
memcpy(aData->bytes, bytes, length);
|
||||
|
||||
return aData;
|
||||
}
|
||||
|
||||
|
||||
WMData*
|
||||
WMCreateDataWithBytesNoCopy(void *bytes, unsigned length, /*FOLD00*/
|
||||
WMFreeDataProc *destructor)
|
||||
{
|
||||
WMData *aData;
|
||||
|
||||
aData = (WMData*)wmalloc(sizeof(WMData));
|
||||
aData->length = length;
|
||||
aData->capacity = length;
|
||||
aData->growth = length/2 > 0 ? length/2 : 1;
|
||||
aData->bytes = bytes;
|
||||
aData->retainCount = 1;
|
||||
aData->format = 0;
|
||||
aData->destructor = destructor;
|
||||
|
||||
return aData;
|
||||
}
|
||||
|
||||
|
||||
WMData*
|
||||
WMCreateDataWithData(WMData *aData) /*FOLD00*/
|
||||
{
|
||||
WMData *newData;
|
||||
|
||||
if (aData->length > 0) {
|
||||
newData = WMCreateDataWithBytes(aData->bytes, aData->length);
|
||||
} else {
|
||||
newData = WMCreateDataWithCapacity(0);
|
||||
}
|
||||
newData->format = aData->format;
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
||||
WMData*
|
||||
WMRetainData(WMData *aData) /*FOLD00*/
|
||||
{
|
||||
aData->retainCount++;
|
||||
return aData;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMReleaseData(WMData *aData) /*FOLD00*/
|
||||
{
|
||||
aData->retainCount--;
|
||||
if (aData->retainCount > 0)
|
||||
return;
|
||||
if (aData->bytes!=NULL && aData->destructor!=NULL) {
|
||||
aData->destructor(aData->bytes);
|
||||
}
|
||||
wfree(aData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Adjusting capacity */
|
||||
|
||||
void
|
||||
WMSetDataCapacity(WMData *aData, unsigned capacity) /*FOLD00*/
|
||||
{
|
||||
if (aData->capacity != capacity) {
|
||||
aData->bytes = wrealloc(aData->bytes, capacity);
|
||||
aData->capacity = capacity;
|
||||
aData->growth = capacity/2 > 0 ? capacity/2 : 1;
|
||||
}
|
||||
if (aData->length > capacity) {
|
||||
aData->length = capacity;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetDataLength(WMData *aData, unsigned length) /*FOLD00*/
|
||||
{
|
||||
if (length > aData->capacity) {
|
||||
WMSetDataCapacity(aData, length);
|
||||
}
|
||||
if (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*/
|
||||
{
|
||||
WMSetDataLength(aData, aData->length + extraLength);
|
||||
}
|
||||
|
||||
|
||||
/* Accessing data */
|
||||
|
||||
const void*
|
||||
WMDataBytes(WMData *aData) /*FOLD00*/
|
||||
{
|
||||
return aData->bytes;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMGetDataBytes(WMData *aData, void *buffer) /*FOLD00*/
|
||||
{
|
||||
wassertr(aData->length > 0);
|
||||
|
||||
memcpy(buffer, aData->bytes, aData->length);
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
WMGetDataFormat(WMData *aData)
|
||||
{
|
||||
return aData->format;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMGetDataBytesWithLength(WMData *aData, void *buffer, unsigned length) /*FOLD00*/
|
||||
{
|
||||
wassertr(aData->length > 0);
|
||||
wassertr(length <= aData->length);
|
||||
|
||||
memcpy(buffer, aData->bytes, length);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMGetDataBytesWithRange(WMData *aData, void *buffer, WMRange aRange) /*FOLD00*/
|
||||
{
|
||||
wassertr(aRange.position < aData->length);
|
||||
wassertr(aRange.count <= aData->length-aRange.position);
|
||||
|
||||
memcpy(buffer, (unsigned char*)aData->bytes + aRange.position,
|
||||
aRange.count);
|
||||
}
|
||||
|
||||
|
||||
WMData*
|
||||
WMGetSubdataWithRange(WMData *aData, WMRange aRange) /*FOLD00*/
|
||||
{
|
||||
void *buffer;
|
||||
WMData *newData;
|
||||
|
||||
if (aRange.count <= 0)
|
||||
return WMCreateDataWithCapacity(0);
|
||||
|
||||
buffer = wmalloc(aRange.count);
|
||||
WMGetDataBytesWithRange(aData, buffer, aRange);
|
||||
newData = WMCreateDataWithBytesNoCopy(buffer, aRange.count, wfree);
|
||||
newData->format = aData->format;
|
||||
|
||||
return newData;
|
||||
}
|
||||
|
||||
|
||||
/* Testing data */
|
||||
|
||||
Bool
|
||||
WMIsDataEqualToData(WMData *aData, WMData *anotherData) /*FOLD00*/
|
||||
{
|
||||
if (aData->length != anotherData->length)
|
||||
return False;
|
||||
else if (!aData->bytes && !anotherData->bytes) /* both are empty */
|
||||
return True;
|
||||
else if (!aData->bytes || !anotherData->bytes) /* one of them is empty */
|
||||
return False;
|
||||
return (memcmp(aData->bytes, anotherData->bytes, aData->length)==0);
|
||||
}
|
||||
|
||||
|
||||
unsigned
|
||||
WMGetDataLength(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;
|
||||
|
||||
if (newLength > aData->capacity) {
|
||||
unsigned nextCapacity = aData->capacity + aData->growth;
|
||||
unsigned nextGrowth = aData->capacity ? aData->capacity : 1;
|
||||
|
||||
while (nextCapacity < newLength) {
|
||||
unsigned tmp = nextCapacity + nextGrowth;
|
||||
|
||||
nextGrowth = nextCapacity;
|
||||
nextCapacity = tmp;
|
||||
}
|
||||
WMSetDataCapacity(aData, nextCapacity);
|
||||
aData->growth = nextGrowth;
|
||||
}
|
||||
memcpy((unsigned char*)aData->bytes + oldLength, bytes, length);
|
||||
aData->length = newLength;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMAppendData(WMData *aData, WMData *anotherData) /*FOLD00*/
|
||||
{
|
||||
if (anotherData->length > 0)
|
||||
WMAppendDataBytes(aData, anotherData->bytes, anotherData->length);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Modifying data */
|
||||
|
||||
void
|
||||
WMReplaceDataBytesInRange(WMData *aData, WMRange aRange, void *bytes) /*FOLD00*/
|
||||
{
|
||||
wassertr(aRange.position < aData->length);
|
||||
wassertr(aRange.count <= aData->length-aRange.position);
|
||||
|
||||
memcpy((unsigned char*)aData->bytes + aRange.position, bytes, aRange.count);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMResetDataBytesInRange(WMData *aData, WMRange aRange) /*FOLD00*/
|
||||
{
|
||||
wassertr(aRange.position < aData->length);
|
||||
wassertr(aRange.count <= aData->length-aRange.position);
|
||||
|
||||
memset((unsigned char*)aData->bytes + aRange.position, 0, aRange.count);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetData(WMData *aData, WMData *anotherData) /*FOLD00*/
|
||||
{
|
||||
unsigned length = anotherData->length;
|
||||
|
||||
WMSetDataCapacity(aData, length);
|
||||
if (length > 0)
|
||||
memcpy(aData->bytes, anotherData->bytes, length);
|
||||
aData->length = length;
|
||||
}
|
||||
|
||||
|
||||
/* Storing data */
|
||||
|
||||
|
||||
215
WINGs/dragdestination.c
Normal file
215
WINGs/dragdestination.c
Normal file
@@ -0,0 +1,215 @@
|
||||
|
||||
|
||||
#include <X11/Xatom.h>
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
|
||||
/* dropping */
|
||||
|
||||
typedef struct W_DNDTargetInfo {
|
||||
/* data types accepted for drops */
|
||||
Atom *dropTypes;
|
||||
int dropTypeCount;
|
||||
|
||||
|
||||
} DNDTargetInfo;
|
||||
|
||||
|
||||
static Atom XDNDversion = XDND_VERSION;
|
||||
|
||||
|
||||
static void
|
||||
realizedObserver(void *self, WMNotification *notif)
|
||||
{
|
||||
WMView *view = (WMView*)WMGetNotificationObject(notif);
|
||||
|
||||
XChangeProperty(W_VIEW_SCREEN(view)->display, W_VIEW_DRAWABLE(view),
|
||||
W_VIEW_SCREEN(view)->xdndAwareAtom,
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char*)&XDNDversion, 1);
|
||||
|
||||
WMRemoveNotificationObserver(self);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
W_SetXdndAwareProperty(WMScreen *scr, WMView *view, Atom *types, int typeCount)
|
||||
{
|
||||
Display *dpy = scr->display;
|
||||
|
||||
view = W_TopLevelOfView(view);
|
||||
|
||||
if (!view->flags.xdndHintSet) {
|
||||
view->flags.xdndHintSet = 1;
|
||||
|
||||
if (view->flags.realized) {
|
||||
XChangeProperty(dpy, W_VIEW_DRAWABLE(view), scr->xdndAwareAtom,
|
||||
XA_ATOM, 32, PropModeReplace,
|
||||
(unsigned char*)&XDNDversion, 1);
|
||||
} else {
|
||||
WMAddNotificationObserver(realizedObserver,
|
||||
/* just use as an id */
|
||||
&view->dragDestinationProcs,
|
||||
WMViewRealizedNotification,
|
||||
view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMRegisterViewForDraggedTypes(WMView *view, char *acceptedTypes[])
|
||||
{
|
||||
Atom *types;
|
||||
int typeCount;
|
||||
int i;
|
||||
|
||||
typeCount = 0;
|
||||
while (acceptedTypes[typeCount++]);
|
||||
|
||||
types = wmalloc(sizeof(Atom)*(typeCount+1));
|
||||
|
||||
for (i = 0; i < typeCount; i++) {
|
||||
types[i] = XInternAtom(W_VIEW_SCREEN(view)->display,
|
||||
acceptedTypes[i], False);
|
||||
}
|
||||
types[i] = 0;
|
||||
|
||||
view->droppableTypes = types;
|
||||
|
||||
W_SetXdndAwareProperty(W_VIEW_SCREEN(view), view, types, typeCount);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMUnregisterViewDraggedTypes(WMView *view)
|
||||
{
|
||||
if (view->droppableTypes != NULL)
|
||||
wfree(view->droppableTypes);
|
||||
view->droppableTypes = NULL;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
|
||||
|
||||
static unsigned defDraggingEntered(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return WDOperationNone;
|
||||
}
|
||||
|
||||
static unsigned defDraggingUpdated(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return WDOperationNone;
|
||||
}
|
||||
|
||||
static void defDraggingExited(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
}
|
||||
|
||||
static Bool defPrepareForDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
static Bool defPerformDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
return False;
|
||||
}
|
||||
|
||||
static void defConcludeDragOperation(WMView *self, WMDraggingInfo *info)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMSetViewDragDestinationProcs(WMView *view, WMDragDestinationProcs *procs)
|
||||
{
|
||||
if (view->dragDestinationProcs == NULL) {
|
||||
wfree(view->dragDestinationProcs);
|
||||
view->dragDestinationProcs = wmalloc(sizeof(WMDragDestinationProcs));
|
||||
}
|
||||
*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)
|
||||
{
|
||||
WMScreen *scr = W_VIEW_SCREEN(view);
|
||||
#if 0
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
1331
WINGs/dragsource.c
Normal file
1331
WINGs/dragsource.c
Normal file
File diff suppressed because it is too large
Load Diff
128
WINGs/error.c
128
WINGs/error.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* WindowMaker miscelaneous function library
|
||||
* Window Maker miscelaneous function library
|
||||
*
|
||||
* Copyright (c) 1997 Alfredo K. Kojima
|
||||
*
|
||||
@@ -27,33 +27,63 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
||||
extern char *_WINGS_progname;
|
||||
|
||||
|
||||
#define MAXLINE 1024
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Prints a fatal error message with variable arguments and terminates
|
||||
/*********************************************************************
|
||||
* Returns the system error message associated with error code 'errnum'
|
||||
*********************************************************************/
|
||||
char*
|
||||
wstrerror(int errnum)
|
||||
{
|
||||
#if defined(HAVE_STRERROR)
|
||||
return strerror(errnum);
|
||||
#elif !defined(HAVE_STRERROR) && defined(BSD)
|
||||
extern int errno, sys_nerr;
|
||||
# ifndef __DECC
|
||||
extern char *sys_errlist[];
|
||||
# endif
|
||||
static char buf[] = "Unknown error 12345678901234567890";
|
||||
|
||||
if (errno < sys_nerr)
|
||||
return sys_errlist[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);
|
||||
return buf;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* 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(": ",stderr);
|
||||
fputs(buf, stderr);
|
||||
fflush(NULL);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
@@ -73,13 +103,41 @@ 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(buf, stderr);
|
||||
fflush(NULL);
|
||||
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, stderr);
|
||||
fputs(" fatal error: ",stderr);
|
||||
fputs(buf, stderr);
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
@@ -96,23 +154,49 @@ wsyserror(const char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[MAXLINE];
|
||||
#ifdef HAVE_STRERROR
|
||||
int error=errno;
|
||||
#endif
|
||||
|
||||
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, ": ");
|
||||
#ifdef HAVE_STRERROR
|
||||
strcat(buf, strerror(error));
|
||||
strcat(buf,"\n");
|
||||
fputs(buf, stderr);
|
||||
fflush(NULL);
|
||||
#else
|
||||
perror(buf);
|
||||
#endif
|
||||
fputs(": ", stderr);
|
||||
fputs(wstrerror(error), stderr);
|
||||
fputs("\n", stderr);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* Prints a system error message with variable arguments, being given
|
||||
* the error code.
|
||||
*
|
||||
* error - the error code foe which to print the message
|
||||
* msg - message to print with optional formatting
|
||||
* ... - arguments to use on formatting
|
||||
*********************************************************************/
|
||||
void
|
||||
wsyserrorwithcode(int error, const char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
char buf[MAXLINE];
|
||||
|
||||
va_start(args, msg);
|
||||
vsnprintf(buf, MAXLINE-3, msg, args);
|
||||
fflush(stdout);
|
||||
fputs(_WINGS_progname, stderr);
|
||||
fputs(" error: ", stderr);
|
||||
fputs(buf, stderr);
|
||||
fputs(": ", stderr);
|
||||
fputs(wstrerror(error), stderr);
|
||||
fputs("\n", stderr);
|
||||
fflush(stderr);
|
||||
fflush(stdout);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* WindowMaker miscelaneous function library
|
||||
* Window Maker miscelaneous function library
|
||||
*
|
||||
* Copyright (c) 1997 Alfredo K. Kojima
|
||||
*
|
||||
@@ -189,13 +189,13 @@ wfindfile(char *paths, char *file)
|
||||
return NULL;
|
||||
|
||||
if (*file=='/' || *file=='~' || *file=='$' || !paths) {
|
||||
if (access(file, R_OK)<0) {
|
||||
if (access(file, F_OK)<0) {
|
||||
fullpath = wexpandpath(file);
|
||||
if (!fullpath)
|
||||
return NULL;
|
||||
|
||||
if (access(fullpath, R_OK)<0) {
|
||||
free(fullpath);
|
||||
if (access(fullpath, F_OK)<0) {
|
||||
wfree(fullpath);
|
||||
return NULL;
|
||||
} else {
|
||||
return fullpath;
|
||||
@@ -217,12 +217,12 @@ wfindfile(char *paths, char *file)
|
||||
strcat(path, "/");
|
||||
strcat(path, file);
|
||||
fullpath = wexpandpath(path);
|
||||
free(path);
|
||||
wfree(path);
|
||||
if (fullpath) {
|
||||
if (access(fullpath, R_OK)==0) {
|
||||
if (access(fullpath, F_OK)==0) {
|
||||
return fullpath;
|
||||
}
|
||||
free(fullpath);
|
||||
wfree(fullpath);
|
||||
}
|
||||
tmp=&(tmp[len+1]);
|
||||
if (*tmp==0) break;
|
||||
@@ -243,13 +243,13 @@ wfindfileinlist(char **path_list, char *file)
|
||||
return NULL;
|
||||
|
||||
if (*file=='/' || *file=='~' || !path_list) {
|
||||
if (access(file, R_OK)<0) {
|
||||
if (access(file, F_OK)<0) {
|
||||
fullpath = wexpandpath(file);
|
||||
if (!fullpath)
|
||||
return NULL;
|
||||
|
||||
if (access(fullpath, R_OK)<0) {
|
||||
free(fullpath);
|
||||
if (access(fullpath, F_OK)<0) {
|
||||
wfree(fullpath);
|
||||
return NULL;
|
||||
} else {
|
||||
return fullpath;
|
||||
@@ -269,13 +269,13 @@ wfindfileinlist(char **path_list, char *file)
|
||||
strcat(path, file);
|
||||
/* expand tilde */
|
||||
fullpath = wexpandpath(path);
|
||||
free(path);
|
||||
wfree(path);
|
||||
if (fullpath) {
|
||||
/* check if file is readable */
|
||||
if (access(fullpath, R_OK)==0) {
|
||||
/* check if file exists */
|
||||
if (access(fullpath, F_OK)==0) {
|
||||
return fullpath;
|
||||
}
|
||||
free(fullpath);
|
||||
wfree(fullpath);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -283,3 +283,64 @@ wfindfileinlist(char **path_list, char *file)
|
||||
|
||||
|
||||
|
||||
char*
|
||||
wfindfileinarray(proplist_t array, char *file)
|
||||
{
|
||||
int i;
|
||||
char *path;
|
||||
int len, flen;
|
||||
char *fullpath;
|
||||
|
||||
if (!file)
|
||||
return NULL;
|
||||
|
||||
if (*file=='/' || *file=='~' || !array) {
|
||||
if (access(file, F_OK)<0) {
|
||||
fullpath = wexpandpath(file);
|
||||
if (!fullpath)
|
||||
return NULL;
|
||||
|
||||
if (access(fullpath, F_OK)<0) {
|
||||
wfree(fullpath);
|
||||
return NULL;
|
||||
} else {
|
||||
return fullpath;
|
||||
}
|
||||
} else {
|
||||
return wstrdup(file);
|
||||
}
|
||||
}
|
||||
|
||||
flen = strlen(file);
|
||||
for (i=0; i<PLGetNumberOfElements(array); i++) {
|
||||
proplist_t prop;
|
||||
char *p;
|
||||
|
||||
prop = PLGetArrayElement(array, i);
|
||||
if (!prop)
|
||||
continue;
|
||||
p = PLGetString(prop);
|
||||
|
||||
len = strlen(p);
|
||||
path = wmalloc(len+flen+2);
|
||||
path = memcpy(path, p, len);
|
||||
path[len]=0;
|
||||
strcat(path, "/");
|
||||
strcat(path, file);
|
||||
/* expand tilde */
|
||||
fullpath = wexpandpath(path);
|
||||
wfree(path);
|
||||
if (fullpath) {
|
||||
/* check if file exists */
|
||||
if (access(fullpath, F_OK)==0) {
|
||||
return fullpath;
|
||||
}
|
||||
wfree(fullpath);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
|
||||
typedef struct HashItem {
|
||||
void *key;
|
||||
void *data;
|
||||
const void *key;
|
||||
const void *data;
|
||||
|
||||
struct HashItem *next; /* collided item list */
|
||||
} HashItem;
|
||||
@@ -114,7 +114,7 @@ rebuildTable(WMHashTable *table)
|
||||
oldArray[i] = next;
|
||||
}
|
||||
}
|
||||
free(oldArray);
|
||||
wfree(oldArray);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ WMResetHashTable(WMHashTable *table)
|
||||
while (item) {
|
||||
tmp = item->next;
|
||||
RELKEY(table, item);
|
||||
free(item);
|
||||
wfree(item);
|
||||
item = tmp;
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ WMResetHashTable(WMHashTable *table)
|
||||
table->itemCount = 0;
|
||||
|
||||
if (table->size > INITIAL_CAPACITY) {
|
||||
free(table->table);
|
||||
wfree(table->table);
|
||||
table->size = INITIAL_CAPACITY;
|
||||
table->table = wmalloc(sizeof(HashItem*)*table->size);
|
||||
}
|
||||
@@ -175,13 +175,13 @@ WMFreeHashTable(WMHashTable *table)
|
||||
item = table->table[i];
|
||||
while (item) {
|
||||
tmp = item->next;
|
||||
RELKEY(table, item);
|
||||
free(item);
|
||||
RELKEY(table, item->key);
|
||||
wfree(item);
|
||||
item = tmp;
|
||||
}
|
||||
}
|
||||
free(table->table);
|
||||
free(table);
|
||||
wfree(table->table);
|
||||
wfree(table);
|
||||
}
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ WMHashGet(WMHashTable *table, const void *key)
|
||||
}
|
||||
}
|
||||
if (item)
|
||||
return item->data;
|
||||
return (void*)item->data;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ WMHashGet(WMHashTable *table, const void *key)
|
||||
|
||||
|
||||
void*
|
||||
WMHashInsert(WMHashTable *table, void *key, void *data)
|
||||
WMHashInsert(WMHashTable *table, const void *key, const void *data)
|
||||
{
|
||||
unsigned h;
|
||||
HashItem *item;
|
||||
@@ -247,14 +247,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;
|
||||
|
||||
@@ -296,7 +296,7 @@ deleteFromList(HashTable *table, HashItem *item, const void *key)
|
||||
|
||||
next = item->next;
|
||||
RELKEY(table, item->key);
|
||||
free(item);
|
||||
wfree(item);
|
||||
|
||||
table->itemCount--;
|
||||
|
||||
@@ -337,7 +337,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,7 +357,7 @@ WMNextHashEnumeratorItem(WMHashEnumerator *enumerator)
|
||||
enumerator->nextItem = ((HashItem*)enumerator->nextItem)->next;
|
||||
}
|
||||
|
||||
return data;
|
||||
return (void*)data;
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ const WMHashTableCallbacks WMStringHashCallbacks = {
|
||||
(hashFunc)hashString,
|
||||
(isEqualFunc)compareStrings,
|
||||
(retainFunc)wstrdup,
|
||||
(releaseFunc)free
|
||||
(releaseFunc)wfree
|
||||
};
|
||||
|
||||
|
||||
|
||||
307
WINGs/host.c
Normal file
307
WINGs/host.c
Normal file
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* WINGs WMHost function library
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include "../src/config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
|
||||
/* 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;
|
||||
|
||||
WMArray *names;
|
||||
WMArray *addresses;
|
||||
|
||||
int refCount;
|
||||
} W_Host;
|
||||
|
||||
|
||||
static WMHashTable *hostCache = NULL;
|
||||
|
||||
static Bool hostCacheEnabled = True;
|
||||
|
||||
|
||||
|
||||
static WMHost*
|
||||
getHostFromCache(char *name)
|
||||
{
|
||||
if (!hostCache)
|
||||
return NULL;
|
||||
|
||||
return WMHashGet(hostCache, name);
|
||||
}
|
||||
|
||||
|
||||
static WMHost*
|
||||
getHostWithHostEntry(struct hostent *host, char *name)
|
||||
{
|
||||
WMHost *hPtr;
|
||||
struct in_addr in;
|
||||
int i;
|
||||
|
||||
hPtr = (WMHost*)wmalloc(sizeof(WMHost));
|
||||
memset(hPtr, 0, sizeof(WMHost));
|
||||
|
||||
hPtr->names = WMCreateArrayWithDestructor(1, wfree);
|
||||
hPtr->addresses = WMCreateArrayWithDestructor(1, wfree);
|
||||
|
||||
WMAddToArray(hPtr->names, wstrdup(host->h_name));
|
||||
|
||||
for (i=0; host->h_aliases[i]!=NULL; 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);
|
||||
WMAddToArray(hPtr->addresses, wstrdup(inet_ntoa(in)));
|
||||
}
|
||||
|
||||
hPtr->refCount = 1;
|
||||
|
||||
if (hostCacheEnabled) {
|
||||
if (!hostCache)
|
||||
hostCache = WMCreateHashTable(WMStringPointerHashCallbacks);
|
||||
hPtr->name = wstrdup(name);
|
||||
wassertr(WMHashInsert(hostCache, hPtr->name, hPtr)==NULL);
|
||||
hPtr->refCount++;
|
||||
}
|
||||
|
||||
return hPtr;
|
||||
}
|
||||
|
||||
|
||||
WMHost*
|
||||
WMGetCurrentHost()
|
||||
{
|
||||
char name[W_MAXHOSTNAMELEN+1];
|
||||
|
||||
if (gethostname(name, W_MAXHOSTNAMELEN) < 0) {
|
||||
wsyserror("Cannot get current host name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
name[W_MAXHOSTNAMELEN] = 0;
|
||||
|
||||
return WMGetHostWithName(name);
|
||||
}
|
||||
|
||||
|
||||
WMHost*
|
||||
WMGetHostWithName(char *name)
|
||||
{
|
||||
struct hostent *host;
|
||||
WMHost *hPtr;
|
||||
|
||||
wassertrv(name!=NULL, NULL);
|
||||
|
||||
if (hostCacheEnabled) {
|
||||
if ((hPtr = getHostFromCache(name)) != NULL) {
|
||||
WMRetainHost(hPtr);
|
||||
return hPtr;
|
||||
}
|
||||
}
|
||||
|
||||
host = gethostbyname(name);
|
||||
if (host == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hPtr = getHostWithHostEntry(host, name);
|
||||
|
||||
return hPtr;
|
||||
}
|
||||
|
||||
|
||||
WMHost*
|
||||
WMGetHostWithAddress(char *address)
|
||||
{
|
||||
struct hostent *host;
|
||||
struct in_addr in;
|
||||
WMHost *hPtr;
|
||||
|
||||
wassertrv(address!=NULL, NULL);
|
||||
|
||||
if (hostCacheEnabled) {
|
||||
if ((hPtr = getHostFromCache(address)) != NULL) {
|
||||
WMRetainHost(hPtr);
|
||||
return hPtr;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef HAVE_INET_ATON
|
||||
if ((in.s_addr = inet_addr(address)) == INADDR_NONE)
|
||||
return NULL;
|
||||
#else
|
||||
if (inet_aton(address, &in) == 0)
|
||||
return NULL;
|
||||
#endif
|
||||
|
||||
host = gethostbyaddr((char*)&in, sizeof(in), AF_INET);
|
||||
if (host == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hPtr = getHostWithHostEntry(host, address);
|
||||
|
||||
return hPtr;
|
||||
}
|
||||
|
||||
|
||||
WMHost*
|
||||
WMRetainHost(WMHost *hPtr)
|
||||
{
|
||||
hPtr->refCount++;
|
||||
return hPtr;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMReleaseHost(WMHost *hPtr)
|
||||
{
|
||||
int i;
|
||||
|
||||
hPtr->refCount--;
|
||||
|
||||
if (hPtr->refCount > 0)
|
||||
return;
|
||||
|
||||
WMFreeArray(hPtr->names);
|
||||
WMFreeArray(hPtr->addresses);
|
||||
|
||||
if (hPtr->name) {
|
||||
WMHashRemove(hostCache, hPtr->name);
|
||||
wfree(hPtr->name);
|
||||
}
|
||||
|
||||
wfree(hPtr);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetHostCacheEnabled(Bool flag)
|
||||
{
|
||||
hostCacheEnabled = flag;
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMIsHostCacheEnabled()
|
||||
{
|
||||
return hostCacheEnabled;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMFlushHostCache()
|
||||
{
|
||||
if (hostCache && WMCountHashTable(hostCache)>0) {
|
||||
WMArray *hostArray = WMCreateArray(WMCountHashTable(hostCache));
|
||||
WMHashEnumerator enumer = WMEnumerateHashTable(hostCache);
|
||||
WMHost *hPtr;
|
||||
int i;
|
||||
|
||||
while ((hPtr = WMNextHashEnumeratorItem(&enumer))) {
|
||||
/* we can't release the host here, because we can't change the
|
||||
* hash while using the enumerator functions. */
|
||||
WMAddToArray(hostArray, hPtr);
|
||||
}
|
||||
for (i=0; i<WMGetArrayItemCount(hostArray); i++)
|
||||
WMReleaseHost(WMGetFromArray(hostArray, i));
|
||||
WMFreeArray(hostArray);
|
||||
WMResetHashTable(hostCache);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMIsHostEqualToHost(WMHost* hPtr, WMHost* aPtr)
|
||||
{
|
||||
int i, j;
|
||||
char *adr1, *adr2;
|
||||
|
||||
wassertrv(hPtr!=NULL && aPtr!=NULL, False);
|
||||
|
||||
if (hPtr == aPtr)
|
||||
return True;
|
||||
|
||||
for (i=0; i<WMGetArrayItemCount(aPtr->addresses); i++) {
|
||||
adr1 = WMGetFromArray(aPtr->addresses, i);
|
||||
for (j=0; j<WMGetArrayItemCount(hPtr->addresses); j++) {
|
||||
adr2 = WMGetFromArray(hPtr->addresses, j);
|
||||
if (strcmp(adr1, adr2)==0)
|
||||
return True;
|
||||
}
|
||||
}
|
||||
|
||||
return False;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
WMGetHostName(WMHost *hPtr)
|
||||
{
|
||||
return (WMGetArrayItemCount(hPtr->names) > 0 ?
|
||||
WMGetFromArray(hPtr->names, 0) : NULL);
|
||||
/*return WMGetFromArray(hPtr->names, 0);*/
|
||||
}
|
||||
|
||||
|
||||
WMArray*
|
||||
WMGetHostNames(WMHost *hPtr)
|
||||
{
|
||||
return hPtr->names;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
WMGetHostAddress(WMHost *hPtr)
|
||||
{
|
||||
return (WMGetArrayItemCount(hPtr->addresses) > 0 ?
|
||||
WMGetFromArray(hPtr->addresses, 0) : NULL);
|
||||
}
|
||||
|
||||
|
||||
WMArray*
|
||||
WMGetHostAddresses(WMHost *hPtr)
|
||||
{
|
||||
return hPtr->addresses;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
135
WINGs/memory.c
135
WINGs/memory.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* WindowMaker miscelaneous function library
|
||||
* Window Maker miscelaneous function library
|
||||
*
|
||||
* Copyright (c) 1997 Alfredo K. Kojima
|
||||
*
|
||||
@@ -29,6 +29,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef TEST_WITH_GC
|
||||
#include <gc/gc.h>
|
||||
#endif
|
||||
|
||||
#ifndef False
|
||||
# define False 0
|
||||
@@ -37,7 +42,33 @@
|
||||
# define True 1
|
||||
#endif
|
||||
|
||||
extern void wAbort(int);
|
||||
|
||||
static void
|
||||
defaultHandler(int bla)
|
||||
{
|
||||
if (bla)
|
||||
kill(getpid(), SIGABRT);
|
||||
else
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
static waborthandler *aborthandler = (waborthandler*)defaultHandler;
|
||||
|
||||
#define wAbort(a) (*aborthandler)(a)
|
||||
|
||||
|
||||
waborthandler*
|
||||
wsetabort(waborthandler *handler)
|
||||
{
|
||||
waborthandler *old = aborthandler;
|
||||
|
||||
aborthandler = handler;
|
||||
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int Aborting=0; /* if we're in the middle of an emergency exit */
|
||||
|
||||
@@ -45,18 +76,29 @@ 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
|
||||
tmp = malloc(size);
|
||||
#endif
|
||||
if (tmp == NULL) {
|
||||
wwarning("malloc() failed. Retrying after 2s.");
|
||||
sleep(2);
|
||||
#ifdef TEST_WITH_GC
|
||||
tmp = GC_malloc(size);
|
||||
#else
|
||||
tmp = malloc(size);
|
||||
#endif
|
||||
if (tmp == NULL) {
|
||||
if (Aborting) {
|
||||
puts("Real Bad Error: recursive malloc() failure.");
|
||||
fputs("Really Bad Error: recursive malloc() failure.", stderr);
|
||||
exit(-1);
|
||||
} else {
|
||||
wfatal("virtual memory exhausted");
|
||||
@@ -69,18 +111,42 @@ void *wmalloc(size_t size)
|
||||
}
|
||||
|
||||
|
||||
void *wrealloc(void *ptr, size_t newsize)
|
||||
void*
|
||||
wrealloc(void *ptr, size_t newsize)
|
||||
{
|
||||
void *nptr;
|
||||
|
||||
if (!ptr) {
|
||||
nptr = malloc(newsize);
|
||||
nptr = wmalloc(newsize);
|
||||
} else if (newsize==0) {
|
||||
wfree(ptr);
|
||||
nptr = NULL;
|
||||
} else {
|
||||
nptr=realloc(ptr, newsize);
|
||||
}
|
||||
#ifdef TEST_WITH_GC
|
||||
nptr = GC_realloc(ptr, newsize);
|
||||
#else
|
||||
nptr = realloc(ptr, newsize);
|
||||
#endif
|
||||
if (nptr==NULL) {
|
||||
printf("Could not do realloc");
|
||||
return NULL;
|
||||
wwarning("realloc() failed. Retrying after 2s.");
|
||||
sleep(2);
|
||||
#ifdef TEST_WITH_GC
|
||||
nptr = GC_realloc(ptr, newsize);
|
||||
#else
|
||||
nptr = realloc(ptr, newsize);
|
||||
#endif
|
||||
if (nptr == NULL) {
|
||||
if (Aborting) {
|
||||
fputs("Really Bad Error: recursive realloc() failure.",
|
||||
stderr);
|
||||
exit(-1);
|
||||
} else {
|
||||
wfatal("virtual memory exhausted");
|
||||
Aborting=1;
|
||||
wAbort(False);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nptr;
|
||||
}
|
||||
@@ -114,6 +180,19 @@ wretain(void *ptr)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
wfree(void *ptr)
|
||||
{
|
||||
#ifdef TEST_WITH_GC
|
||||
GC_free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
wrelease(void *ptr)
|
||||
{
|
||||
@@ -129,8 +208,8 @@ wrelease(void *ptr)
|
||||
printf("RELEASING %p\n", ptr);
|
||||
#endif
|
||||
WMHashRemove(table, ptr);
|
||||
free(refcount);
|
||||
free(ptr);
|
||||
wfree(refcount);
|
||||
wfree(ptr);
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
else {
|
||||
@@ -151,19 +230,35 @@ wstrdup(char *str)
|
||||
|
||||
|
||||
char*
|
||||
wstrappend(char *dst, char *src)
|
||||
wstrconcat(char *str1, char *str2)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (!dst)
|
||||
return wstrdup(src);
|
||||
else if (!src)
|
||||
return wstrdup(dst);
|
||||
if (!str1)
|
||||
return wstrdup(str2);
|
||||
else if (!str2)
|
||||
return wstrdup(str1);
|
||||
|
||||
str = wmalloc(strlen(dst)+strlen(src)+1);
|
||||
strcpy(str, dst);
|
||||
strcat(str, src);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -8,15 +8,17 @@
|
||||
|
||||
|
||||
typedef struct W_Notification {
|
||||
char *name;
|
||||
const char *name;
|
||||
void *object;
|
||||
void *clientData;
|
||||
int refCount;
|
||||
} Notification;
|
||||
|
||||
|
||||
extern void W_FlushASAPNotificationQueue();
|
||||
|
||||
char*
|
||||
|
||||
const char*
|
||||
WMGetNotificationName(WMNotification *notification)
|
||||
{
|
||||
return notification->name;
|
||||
@@ -38,7 +40,7 @@ WMGetNotificationClientData(WMNotification *notification)
|
||||
|
||||
|
||||
WMNotification*
|
||||
WMCreateNotification(char *name, void *object, void *clientData)
|
||||
WMCreateNotification(const char *name, void *object, void *clientData)
|
||||
{
|
||||
Notification *nPtr;
|
||||
|
||||
@@ -60,7 +62,7 @@ WMReleaseNotification(WMNotification *notification)
|
||||
notification->refCount--;
|
||||
|
||||
if (notification->refCount < 1) {
|
||||
free(notification);
|
||||
wfree(notification);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +82,7 @@ typedef struct NotificationObserver {
|
||||
WMNotificationObserverAction *observerAction;
|
||||
void *observer;
|
||||
|
||||
char *name;
|
||||
const char *name;
|
||||
void *object;
|
||||
|
||||
struct NotificationObserver *prev; /* for tables */
|
||||
@@ -117,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;
|
||||
|
||||
@@ -131,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 */
|
||||
@@ -149,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;
|
||||
@@ -173,12 +178,14 @@ 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;
|
||||
|
||||
if (!orec->object || orec->object == notification->object) {
|
||||
if (!orec->object || !notification->object
|
||||
|| orec->object == notification->object) {
|
||||
/* tell the observer */
|
||||
if (orec->observerAction) {
|
||||
(*orec->observerAction)(orec->observer, notification);
|
||||
@@ -189,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;
|
||||
@@ -217,16 +225,14 @@ WMPostNotification(WMNotification *notification)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
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) {
|
||||
@@ -272,7 +280,7 @@ WMRemoveNotificationObserver(void *observer)
|
||||
if (orec->next)
|
||||
orec->next->prev = orec->prev;
|
||||
|
||||
free(orec);
|
||||
wfree(orec);
|
||||
|
||||
orec = tmp;
|
||||
}
|
||||
@@ -282,12 +290,17 @@ 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);
|
||||
|
||||
/* rebuild the list of actions for the observer */
|
||||
|
||||
while (orec) {
|
||||
tmp = orec->nextAction;
|
||||
@@ -296,57 +309,66 @@ 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 */
|
||||
if (orec->next) {
|
||||
WMHashInsert(notificationCenter->objectTable, orec->object,
|
||||
orec->next);
|
||||
WMHashInsert(notificationCenter->objectTable,
|
||||
orec->object, orec->next);
|
||||
} else {
|
||||
WMHashRemove(notificationCenter->objectTable,
|
||||
orec->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 */
|
||||
if (orec->next) {
|
||||
WMHashInsert(notificationCenter->nameTable, orec->name,
|
||||
orec->next);
|
||||
WMHashInsert(notificationCenter->nameTable,
|
||||
orec->name, orec->next);
|
||||
} else {
|
||||
WMHashRemove(notificationCenter->nameTable, orec->name);
|
||||
WMHashRemove(notificationCenter->nameTable,
|
||||
orec->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* update the action list for the observer */
|
||||
rec = WMHashGet(notificationCenter->observerTable, observer);
|
||||
|
||||
if (rec == orec) {
|
||||
if (orec->nextAction) {
|
||||
WMHashInsert(notificationCenter->nameTable, observer,
|
||||
orec->nextAction);
|
||||
} else {
|
||||
WMHashRemove(notificationCenter->nameTable, observer);
|
||||
}
|
||||
}
|
||||
|
||||
if (orec->prev)
|
||||
orec->prev->next = orec->next;
|
||||
if (orec->next)
|
||||
orec->next->prev = orec->prev;
|
||||
free(orec);
|
||||
wfree(orec);
|
||||
} else {
|
||||
/* append this action in the new action list */
|
||||
orec->nextAction = NULL;
|
||||
if (!newList) {
|
||||
newList = orec;
|
||||
} else {
|
||||
NotificationObserver *p;
|
||||
|
||||
p = newList;
|
||||
while (p->nextAction) {
|
||||
p = p->nextAction;
|
||||
}
|
||||
p->nextAction = orec;
|
||||
}
|
||||
}
|
||||
orec = tmp;
|
||||
}
|
||||
|
||||
/* reinsert the list to the table */
|
||||
if (newList) {
|
||||
WMHashInsert(notificationCenter->observerTable, observer, newList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMPostNotificationName(char *name, void *object, void *clientData)
|
||||
WMPostNotificationName(const char *name, void *object, void *clientData)
|
||||
{
|
||||
WMNotification *notification;
|
||||
|
||||
@@ -363,18 +385,25 @@ WMPostNotificationName(char *name, void *object, void *clientData)
|
||||
|
||||
|
||||
typedef struct W_NotificationQueue {
|
||||
NotificationCenter *center;
|
||||
void *asapQueue;
|
||||
void *idleQueue;
|
||||
WMBag *asapQueue;
|
||||
WMBag *idleQueue;
|
||||
|
||||
struct W_NotificationQueue *next;
|
||||
} NotificationQueue;
|
||||
|
||||
|
||||
static WMNotificationQueue *notificationQueueList = NULL;
|
||||
|
||||
/* default queue */
|
||||
static WMNotificationQueue *notificationQueue = NULL;
|
||||
|
||||
|
||||
WMNotificationQueue*
|
||||
WMGetDefaultNotificationQueue(void)
|
||||
{
|
||||
if (!notificationQueue)
|
||||
notificationQueue = WMCreateNotificationQueue();
|
||||
|
||||
return notificationQueue;
|
||||
}
|
||||
|
||||
@@ -382,20 +411,86 @@ WMGetDefaultNotificationQueue(void)
|
||||
WMNotificationQueue*
|
||||
WMCreateNotificationQueue(void)
|
||||
{
|
||||
return NULL;
|
||||
NotificationQueue *queue;
|
||||
|
||||
queue = wmalloc(sizeof(NotificationQueue));
|
||||
|
||||
queue->asapQueue = WMCreateBag(8);
|
||||
queue->idleQueue = WMCreateBag(8);
|
||||
queue->next = notificationQueueList;
|
||||
|
||||
notificationQueueList = queue;
|
||||
|
||||
return queue;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMDequeueNotificationMatching(WMNotificationQueue *queue, unsigned mask)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMEnqueueNotification(WMNotificationQueue *queue, WMNotification *notification,
|
||||
WMPostingStyle postingStyle)
|
||||
{
|
||||
WMEnqueueCoalesceNotification(queue, notification, postingStyle,
|
||||
WNCOnName|WNCOnSender);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDequeueNotificationMatching(WMNotificationQueue *queue,
|
||||
WMNotification *notification, unsigned mask)
|
||||
{
|
||||
WMBagIterator i;
|
||||
WMNotification *tmp;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -405,10 +500,60 @@ WMEnqueueCoalesceNotification(WMNotificationQueue *queue,
|
||||
WMPostingStyle postingStyle,
|
||||
unsigned coalesceMask)
|
||||
{
|
||||
if (coalesceMask != WNCNone)
|
||||
WMDequeueNotificationMatching(queue, notification, coalesceMask);
|
||||
|
||||
switch (postingStyle) {
|
||||
case WMPostNow:
|
||||
WMPostNotification(notification);
|
||||
WMReleaseNotification(notification);
|
||||
break;
|
||||
|
||||
case WMPostASAP:
|
||||
WMPutInBag(queue->asapQueue, notification);
|
||||
break;
|
||||
|
||||
case WMPostWhenIdle:
|
||||
WMPutInBag(queue->idleQueue, notification);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
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);
|
||||
}
|
||||
|
||||
queue = queue->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
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);
|
||||
}
|
||||
|
||||
queue = queue->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -6,288 +6,455 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#if 0
|
||||
#define MAX_PROPERTY_SIZE 8*1024
|
||||
|
||||
typedef struct W_SelectionHandler {
|
||||
WMWidget *widget;
|
||||
|
||||
typedef struct SelectionHandler {
|
||||
WMView *view;
|
||||
Atom selection;
|
||||
void *clientData;
|
||||
WMSelectionProc *proc;
|
||||
WMHandlerID timerID;
|
||||
W_SelectionHandler *next;
|
||||
W_SelectionHandler *prev;
|
||||
} W_SelectionHandler;
|
||||
#endif
|
||||
|
||||
#define SELECTION_TIMEOUT 2000
|
||||
#define MAX_PROPERTY_SIZE 10*1024
|
||||
#if 0
|
||||
|
||||
|
||||
void
|
||||
WMWriteSelectionToClipboard(WMSelection *selection)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
WMSelection*
|
||||
WMCreateSelectionWithData(WMData *data, Atom type)
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
#define MAX_PROPERTY_SIZE 100*1024
|
||||
|
||||
|
||||
static void
|
||||
handleSelectionEvent(XEvent *event, void *data)
|
||||
{
|
||||
W_SelectionHandler *handler = (W_SelectionHandler*)data;
|
||||
char *data = NULL;
|
||||
Atom type;
|
||||
int format, result;
|
||||
unsigned long numItems, bytesAfter;
|
||||
WMScreen *scr = WMWidgetScreen(handler->widget);
|
||||
|
||||
WMDeleteTimerHandler(handler->timerID);
|
||||
|
||||
if (handler->next)
|
||||
handler->next->prev = handler->prev;
|
||||
if (handler->prev)
|
||||
handler->prev->next = handler->next;
|
||||
if (handler == WMWidgetScreen(handler->widget)->selectionHandlerList)
|
||||
WMWidgetScreen(handler->widget)->selectionHandlerList = handler->next;
|
||||
|
||||
if (event->xselection.property == None) {
|
||||
char *name = XGetAtomName(event->xselection.display,
|
||||
handler->selection);
|
||||
char *form = XGetAtomName(event->xselection.display, handler->type);
|
||||
wwarning("error retrieving selection %s with form %s\n", name, form);
|
||||
if (name)
|
||||
XFree(name);
|
||||
if (form)
|
||||
XFree(form);
|
||||
free(handler);
|
||||
return;
|
||||
}
|
||||
|
||||
if (XGetWindowProperty(event->xselection.display,
|
||||
event->xselection.requestor, handler->property,
|
||||
0, MAX_PROPERTY_SIZE, False, AnyPropertyType,
|
||||
&type, &format, &numItems, &bytesAfter,
|
||||
&data) != Success || type == None) {
|
||||
if (data)
|
||||
XFree(data);
|
||||
free(handler);
|
||||
return;
|
||||
}
|
||||
if (bytesAfter!=0) {
|
||||
wwarning("data in selection is too large");
|
||||
if (data)
|
||||
XFree(data);
|
||||
free(handler);
|
||||
return;
|
||||
}
|
||||
if (type == XA_STRING || type == scr->compoundTextAtom) {
|
||||
if (format!=8) {
|
||||
wwarning("string in selection has format %i, which is invalid",
|
||||
format);
|
||||
if (data)
|
||||
XFree(data);
|
||||
free(handler);
|
||||
return;
|
||||
}
|
||||
(*handler->proc)();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
timeoutHandler(void *data)
|
||||
{
|
||||
W_SelectionHandler *handler = (W_SelectionHandler*)data;
|
||||
|
||||
wwarning("selection timed out");
|
||||
WMDeleteEventHandler(WMWidgetView(handler->widget), SelectionNotifyMask,
|
||||
handleSelectionEvent, data);
|
||||
if (handler->next)
|
||||
handler->next->prev = handler->prev;
|
||||
if (handler->prev)
|
||||
handler->prev->next = handler->next;
|
||||
if (handler == WMWidgetScreen(handler->widget)->selectionHandlerList)
|
||||
WMWidgetScreen(handler->widget)->selectionHandlerList = handler->next;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMGetSelection(WMWidget *widget, Atom selection, Atom type, Atom property,
|
||||
WMSelectionProc *proc, void *clientData, Time time)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(widget);
|
||||
Time timestamp;
|
||||
WMSelectionProcs procs;
|
||||
void *data;
|
||||
Atom rtype;
|
||||
int bits;
|
||||
unsigned long len, bytes;
|
||||
unsigned char *data;
|
||||
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;
|
||||
struct {
|
||||
unsigned delete_pending:1;
|
||||
unsigned done_pending:1;
|
||||
} flags;
|
||||
} SelectionHandler;
|
||||
|
||||
|
||||
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;
|
||||
|
||||
|
||||
WMBag *selCallbacks = NULL;
|
||||
|
||||
WMBag *selHandlers = NULL;
|
||||
|
||||
|
||||
void
|
||||
WMDeleteSelectionHandler(WMView *view, Atom selection, Time timestamp)
|
||||
{
|
||||
SelectionHandler *handler;
|
||||
Display *dpy = W_VIEW_SCREEN(view)->display;
|
||||
Window win = W_VIEW_DRAWABLE(view);
|
||||
WMBagIterator iter;
|
||||
|
||||
if (!selHandlers)
|
||||
return;
|
||||
|
||||
|
||||
WM_ITERATE_BAG(selHandlers, handler, iter) {
|
||||
if (handler->view == view
|
||||
&& (handler->selection == selection || selection == None)
|
||||
&& (handler->timestamp == timestamp || timestamp == CurrentTime)) {
|
||||
|
||||
if (handler->flags.done_pending) {
|
||||
handler->flags.delete_pending = 1;
|
||||
return;
|
||||
}
|
||||
WMRemoveFromBag(selHandlers, handler);
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
if (buffer >= 0) {
|
||||
char *data;
|
||||
int size;
|
||||
}
|
||||
|
||||
data = XFetchBuffer(scr->display, &size, buffer);
|
||||
XGrabServer(dpy);
|
||||
if (XGetSelectionOwner(dpy, selection) == win) {
|
||||
XSetSelectionOwner(dpy, selection, None, timestamp);
|
||||
}
|
||||
XUngrabServer(dpy);
|
||||
}
|
||||
|
||||
} else {
|
||||
W_SelectionHandler *handler;
|
||||
|
||||
XDeleteProperty(scr->display, WMWidgetXID(widget), selection);
|
||||
XConvertSelection(scr->display, selection, type, property,
|
||||
WMWidgetXID(widget), time);
|
||||
|
||||
handler = wmalloc(sizeof(W_SelectionHandler));
|
||||
handler->widget = widget;
|
||||
handler->selection = selection;
|
||||
handler->type = type;
|
||||
handler->property = property;
|
||||
handler->clientData = clientData;
|
||||
handler->proc = proc;
|
||||
handler->timerID = WMAddTimerHandler(SELECTION_TIMEOUT,
|
||||
timeoutHandler, handler);
|
||||
void
|
||||
WMDeleteSelectionCallback(WMView *view, Atom selection, Time timestamp)
|
||||
{
|
||||
SelectionCallback *handler;
|
||||
WMBagIterator iter;
|
||||
|
||||
handler->next = scr->selectionHandlerList;
|
||||
handler->prev = NULL;
|
||||
if (scr->selectionHandlerList)
|
||||
scr->selectionHandlerList->prev = handler;
|
||||
scr->selectionHandlerList = handler;
|
||||
if (!selCallbacks)
|
||||
return;
|
||||
|
||||
WMCreateEventHandler(WMWidgetView(widget), SelectionNotifyMask,
|
||||
handleSelectionEvent, handler);
|
||||
WM_ITERATE_BAG(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;
|
||||
}
|
||||
WMRemoveFromBag(selCallbacks, handler);
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Bool gotError = 0;
|
||||
/*
|
||||
static int
|
||||
errorHandler(XErrorEvent *error)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
static Bool
|
||||
writeSelection(Display *dpy, Window requestor, Atom property, Atom type,
|
||||
WMData *data)
|
||||
{
|
||||
int format;
|
||||
|
||||
format = WMGetDataFormat(data);
|
||||
if (format == 0)
|
||||
format = 8;
|
||||
|
||||
/*
|
||||
printf("write to %x: %s\n", requestor, XGetAtomName(dpy, property));
|
||||
*/
|
||||
gotError = False;
|
||||
|
||||
#ifndef __sgi
|
||||
if (!XChangeProperty(dpy, requestor, property, type, format,
|
||||
PropModeReplace, WMDataBytes(data),
|
||||
WMGetDataLength(data)))
|
||||
return False;
|
||||
#else
|
||||
/* in sgi seems this seems to return void */
|
||||
XChangeProperty(dpy, requestor, property, type, format,
|
||||
PropModeReplace, WMDataBytes(data), WMGetDataLength(data));
|
||||
#endif
|
||||
|
||||
XFlush(dpy);
|
||||
|
||||
return !gotError;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
notifySelection(XEvent *event, Atom prop)
|
||||
{
|
||||
XEvent ev;
|
||||
/*
|
||||
printf("envent to %x\n", event->xselectionrequest.requestor);
|
||||
*/
|
||||
ev.xselection.type = SelectionNotify;
|
||||
ev.xselection.serial = 0;
|
||||
ev.xselection.send_event = True;
|
||||
ev.xselection.display = event->xselectionrequest.display;
|
||||
ev.xselection.requestor = event->xselectionrequest.requestor;
|
||||
ev.xselection.target = event->xselectionrequest.target;
|
||||
ev.xselection.selection = event->xselectionrequest.selection;
|
||||
ev.xselection.property = prop;
|
||||
ev.xselection.time = event->xselectionrequest.time;
|
||||
|
||||
XSendEvent(event->xany.display, event->xselectionrequest.requestor,
|
||||
False, 0, &ev);
|
||||
XFlush(event->xany.display);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
timeoutHandler(void *data)
|
||||
deleteHandlers(WMBagIterator iter)
|
||||
{
|
||||
*(int*)data = 1;
|
||||
SelectionHandler *handler;
|
||||
|
||||
if (iter == NULL)
|
||||
handler = WMBagFirst(selHandlers, &iter);
|
||||
else
|
||||
handler = WMBagNext(selHandlers, &iter);
|
||||
|
||||
if (handler == NULL)
|
||||
return;
|
||||
|
||||
deleteHandlers(iter);
|
||||
|
||||
if (handler->flags.delete_pending) {
|
||||
WMDeleteSelectionHandler(handler->view, handler->selection,
|
||||
handler->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
W_GetTextSelection(WMScreen *scr, Atom selection)
|
||||
|
||||
static void
|
||||
handleRequestEvent(XEvent *event)
|
||||
{
|
||||
int buffer = -1;
|
||||
SelectionHandler *handler;
|
||||
WMBagIterator iter;
|
||||
Bool handledRequest = False;
|
||||
|
||||
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;
|
||||
WM_ITERATE_BAG(selHandlers, handler, iter) {
|
||||
|
||||
switch (event->type) {
|
||||
case SelectionClear:
|
||||
if (W_VIEW_DRAWABLE(handler->view)
|
||||
!= event->xselectionclear.window) {
|
||||
break;
|
||||
}
|
||||
if (buffer >= 0) {
|
||||
char *data;
|
||||
int size;
|
||||
|
||||
data = XFetchBuffer(scr->display, &size, buffer);
|
||||
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;
|
||||
|
||||
return data;
|
||||
} else {
|
||||
case SelectionRequest:
|
||||
if (W_VIEW_DRAWABLE(handler->view)
|
||||
!= event->xselectionrequest.owner) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (handler->procs.convertSelection != NULL
|
||||
&& handler->selection == event->xselectionrequest.selection) {
|
||||
Atom atom;
|
||||
WMData *data;
|
||||
Atom prop;
|
||||
|
||||
/* they're requesting for something old.. maybe another handler
|
||||
* can handle it */
|
||||
if (event->xselectionrequest.time < handler->timestamp
|
||||
&& event->xselectionrequest.time != CurrentTime) {
|
||||
break;
|
||||
}
|
||||
|
||||
handler->flags.done_pending = 1;
|
||||
|
||||
data = handler->procs.convertSelection(handler->view,
|
||||
handler->selection,
|
||||
event->xselectionrequest.target,
|
||||
handler->data,
|
||||
&atom);
|
||||
if (data == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
handledRequest = True;
|
||||
|
||||
|
||||
prop = event->xselectionrequest.property;
|
||||
/* obsolete clients that don't set the property field */
|
||||
if (prop == None)
|
||||
prop = event->xselectionrequest.target;
|
||||
|
||||
if (!writeSelection(event->xselectionrequest.display,
|
||||
event->xselectionrequest.requestor,
|
||||
prop, atom, data)) {
|
||||
WMReleaseData(data);
|
||||
notifySelection(event, None);
|
||||
break;
|
||||
}
|
||||
WMReleaseData(data);
|
||||
|
||||
notifySelection(event, prop);
|
||||
|
||||
if (handler->procs.selectionDone != NULL) {
|
||||
handler->procs.selectionDone(handler->view,
|
||||
handler->selection,
|
||||
event->xselectionrequest.target,
|
||||
handler->data);
|
||||
}
|
||||
|
||||
handler->flags.done_pending = 0;
|
||||
|
||||
if (!handledRequest) {
|
||||
notifySelection(event, None);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
deleteHandlers(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
deleteCallbacks(WMBagIterator iter)
|
||||
{
|
||||
SelectionCallback *handler;
|
||||
|
||||
if (iter == NULL)
|
||||
handler = WMBagFirst(selCallbacks, &iter);
|
||||
else
|
||||
handler = WMBagNext(selCallbacks, &iter);
|
||||
|
||||
if (handler == NULL)
|
||||
return;
|
||||
|
||||
deleteCallbacks(iter);
|
||||
|
||||
if (handler->flags.delete_pending) {
|
||||
WMDeleteSelectionCallback(handler->view, handler->selection,
|
||||
handler->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static WMData*
|
||||
getSelectionData(Display *dpy, Window win, Atom where)
|
||||
{
|
||||
WMData *wdata;
|
||||
unsigned char *data;
|
||||
int bits;
|
||||
Atom rtype;
|
||||
unsigned bits;
|
||||
unsigned long len, bytes;
|
||||
WMHandlerID timer;
|
||||
int timeout = 0;
|
||||
XEvent ev;
|
||||
|
||||
XDeleteProperty(scr->display, scr->groupLeader, scr->clipboardAtom);
|
||||
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 */
|
||||
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,
|
||||
if (XGetWindowProperty(dpy, win, where, 0, MAX_PROPERTY_SIZE,
|
||||
False, AnyPropertyType, &rtype, &bits, &len,
|
||||
&bytes, &data)!=Success) {
|
||||
return NULL;
|
||||
}
|
||||
if (rtype!=XA_STRING || bits!=8) {
|
||||
wwarning("invalid data in text selection");
|
||||
if (data)
|
||||
XFree(data);
|
||||
|
||||
wdata = WMCreateDataWithBytesNoCopy(data, len, (WMFreeDataProc*)XFree);
|
||||
if (wdata == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return data;
|
||||
WMSetDataFormat(wdata, bits);
|
||||
|
||||
return wdata;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleNotifyEvent(XEvent *event)
|
||||
{
|
||||
SelectionCallback *handler;
|
||||
WMBagIterator iter;
|
||||
WMData *data;
|
||||
|
||||
WM_ITERATE_BAG(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;
|
||||
}
|
||||
deleteCallbacks(NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
W_HandleSelectionEvent(XEvent *event)
|
||||
{
|
||||
if (event->type == SelectionNotify) {
|
||||
handleNotifyEvent(event);
|
||||
} else {
|
||||
handleRequestEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Bool
|
||||
WMCreateSelectionHandler(WMView *view, Atom selection, Time timestamp,
|
||||
WMSelectionProcs *procs, void *cdata)
|
||||
{
|
||||
SelectionHandler *handler;
|
||||
Display *dpy = W_VIEW_SCREEN(view)->display;
|
||||
|
||||
XSetSelectionOwner(dpy, selection, W_VIEW_DRAWABLE(view), timestamp);
|
||||
if (XGetSelectionOwner(dpy, selection) != W_VIEW_DRAWABLE(view))
|
||||
return False;
|
||||
|
||||
handler = malloc(sizeof(SelectionHandler));
|
||||
if (handler == NULL)
|
||||
return False;
|
||||
|
||||
handler->view = view;
|
||||
handler->selection = selection;
|
||||
handler->timestamp = timestamp;
|
||||
handler->procs = *procs;
|
||||
handler->data = cdata;
|
||||
memset(&handler->flags, 0, sizeof(handler->flags));
|
||||
|
||||
if (selHandlers == NULL) {
|
||||
selHandlers = WMCreateTreeBag();
|
||||
}
|
||||
|
||||
WMPutInBag(selHandlers, handler);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Bool
|
||||
WMRequestSelection(WMView *view, Atom selection, Atom target, Time timestamp,
|
||||
WMSelectionCallback *callback, void *cdata)
|
||||
{
|
||||
SelectionCallback *handler;
|
||||
|
||||
if (XGetSelectionOwner(W_VIEW_SCREEN(view)->display, selection) == None)
|
||||
return False;
|
||||
|
||||
handler = wmalloc(sizeof(SelectionCallback));
|
||||
|
||||
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 = WMCreateTreeBag();
|
||||
}
|
||||
|
||||
WMPutInBag(selCallbacks, handler);
|
||||
|
||||
if (!XConvertSelection(W_VIEW_SCREEN(view)->display, selection, target,
|
||||
W_VIEW_SCREEN(view)->clipboardAtom,
|
||||
W_VIEW_DRAWABLE(view), timestamp)) {
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
|
||||
178
WINGs/string.c
Normal file
178
WINGs/string.c
Normal file
@@ -0,0 +1,178 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "WUtil.h"
|
||||
|
||||
#include "../src/config.h"
|
||||
|
||||
#include "WINGs.h"
|
||||
|
||||
#include <proplist.h>
|
||||
|
||||
@@ -19,36 +24,53 @@ typedef struct W_UserDefaults {
|
||||
|
||||
char dirty;
|
||||
|
||||
char dontSync;
|
||||
|
||||
char *path; /* where is db located */
|
||||
|
||||
time_t timestamp; /* last modification time */
|
||||
|
||||
struct W_UserDefaults *next;
|
||||
|
||||
} UserDefaults;
|
||||
|
||||
|
||||
static UserDefaults *sharedUserDefaults = NULL;
|
||||
|
||||
char *WMUserDefaultsDidChangeNotification = "WMUserDefaultsDidChangeNotification";
|
||||
|
||||
|
||||
|
||||
extern char *WMGetApplicationName();
|
||||
|
||||
#define DEFAULTS_DIR "/Defaults"
|
||||
|
||||
#define UD_SYNC_INTERVAL 2000
|
||||
|
||||
|
||||
|
||||
char*
|
||||
wusergnusteppath()
|
||||
{
|
||||
char *path;
|
||||
static char *path = NULL;
|
||||
char *gspath;
|
||||
int pathlen;
|
||||
|
||||
if (!path) {
|
||||
gspath = getenv("GNUSTEP_USER_ROOT");
|
||||
if (gspath) {
|
||||
gspath = wexpandpath(gspath);
|
||||
pathlen = strlen(gspath) + 4;
|
||||
path = wmalloc(pathlen);
|
||||
strcpy(path, gspath);
|
||||
free(gspath);
|
||||
wfree(gspath);
|
||||
} else {
|
||||
pathlen = strlen(wgethomedir()) + 10;
|
||||
path = wmalloc(pathlen);
|
||||
strcpy(path, wgethomedir());
|
||||
strcat(path, "/GNUstep");
|
||||
}
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -63,7 +85,6 @@ wdefaultspathfordomain(char *domain)
|
||||
gspath = wusergnusteppath();
|
||||
path = wmalloc(strlen(gspath)+strlen(DEFAULTS_DIR)+strlen(domain)+4);
|
||||
strcpy(path, gspath);
|
||||
free(gspath);
|
||||
strcat(path, DEFAULTS_DIR);
|
||||
strcat(path, "/");
|
||||
strcat(path, domain);
|
||||
@@ -73,10 +94,129 @@ wdefaultspathfordomain(char *domain)
|
||||
|
||||
|
||||
static void
|
||||
#ifndef HAVE_ATEXIT
|
||||
saveDefaultsChanges(int foo, void *bar)
|
||||
#else
|
||||
saveDefaultsChanges(void)
|
||||
#endif
|
||||
{
|
||||
if (sharedUserDefaults && sharedUserDefaults->dirty) {
|
||||
PLSave(sharedUserDefaults->appDomain, YES);
|
||||
/* save the user defaults databases */
|
||||
UserDefaults *tmp = sharedUserDefaults;
|
||||
|
||||
while (tmp) {
|
||||
WMSynchronizeUserDefaults(tmp);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* set to save changes in defaults when program is exited */
|
||||
static void
|
||||
registerSaveOnExit(void)
|
||||
{
|
||||
static Bool registeredSaveOnExit = False;
|
||||
|
||||
if (!registeredSaveOnExit) {
|
||||
#ifndef HAVE_ATEXIT
|
||||
on_exit(saveDefaultsChanges, (void*)NULL);
|
||||
#else
|
||||
atexit(saveDefaultsChanges);
|
||||
#endif
|
||||
registeredSaveOnExit = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
synchronizeUserDefaults(void *foo)
|
||||
{
|
||||
UserDefaults *database = sharedUserDefaults;
|
||||
|
||||
while (database) {
|
||||
if (!database->dontSync)
|
||||
WMSynchronizeUserDefaults(database);
|
||||
database = database->next;
|
||||
}
|
||||
WMAddTimerHandler(UD_SYNC_INTERVAL, synchronizeUserDefaults, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
addSynchronizeTimerHandler(void)
|
||||
{
|
||||
static Bool initialized = False;
|
||||
|
||||
if (!initialized) {
|
||||
WMAddTimerHandler(UD_SYNC_INTERVAL, synchronizeUserDefaults, NULL);
|
||||
initialized = True;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMEnableUDPeriodicSynchronization(WMUserDefaults *database, Bool enable)
|
||||
{
|
||||
database->dontSync = !enable;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSynchronizeUserDefaults(WMUserDefaults *database)
|
||||
{
|
||||
Bool fileIsNewer = False, release = False;
|
||||
char *path;
|
||||
struct stat stbuf;
|
||||
|
||||
if (!database->path) {
|
||||
path = wdefaultspathfordomain(WMGetApplicationName());
|
||||
release = True;
|
||||
} else {
|
||||
path = database->path;
|
||||
}
|
||||
|
||||
if (stat(path, &stbuf) >= 0 && stbuf.st_mtime > database->timestamp)
|
||||
fileIsNewer = True;
|
||||
|
||||
if (database->appDomain && (database->dirty || fileIsNewer)) {
|
||||
|
||||
/*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) {
|
||||
WMPostNotificationName(WMUserDefaultsDidChangeNotification,
|
||||
database, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (release)
|
||||
wfree(path);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSaveUserDefaults(WMUserDefaults *database)
|
||||
{
|
||||
if (database->appDomain) {
|
||||
struct stat stbuf;
|
||||
char *path;
|
||||
Bool release = False;
|
||||
|
||||
PLSave(database->appDomain, YES);
|
||||
database->dirty = 0;
|
||||
if (!database->path) {
|
||||
path = wdefaultspathfordomain(WMGetApplicationName());
|
||||
release = True;
|
||||
} else {
|
||||
path = database->path;
|
||||
}
|
||||
if (stat(path, &stbuf) >= 0)
|
||||
database->timestamp = stbuf.st_mtime;
|
||||
if (release)
|
||||
wfree(path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,14 +224,24 @@ saveDefaultsChanges(void)
|
||||
WMUserDefaults*
|
||||
WMGetStandardUserDefaults(void)
|
||||
{
|
||||
if (!sharedUserDefaults) {
|
||||
WMUserDefaults *defaults;
|
||||
|
||||
proplist_t domain;
|
||||
proplist_t key;
|
||||
struct stat stbuf;
|
||||
char *path;
|
||||
int i;
|
||||
|
||||
if (sharedUserDefaults) {
|
||||
defaults = sharedUserDefaults;
|
||||
while (defaults) {
|
||||
/* Trick, path == NULL only for StandardUserDefaults db */
|
||||
if (defaults->path == NULL)
|
||||
return defaults;
|
||||
defaults = defaults->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* we didn't found the database we are looking for. Go read it. */
|
||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||
memset(defaults, 0, sizeof(WMUserDefaults));
|
||||
|
||||
@@ -110,6 +260,9 @@ WMGetStandardUserDefaults(void)
|
||||
} else {
|
||||
path = wdefaultspathfordomain(PLGetString(key));
|
||||
|
||||
if (stat(path, &stbuf) >= 0)
|
||||
defaults->timestamp = stbuf.st_mtime;
|
||||
|
||||
domain = PLGetProplistWithPath(path);
|
||||
}
|
||||
if (!domain) {
|
||||
@@ -123,7 +276,7 @@ WMGetStandardUserDefaults(void)
|
||||
}
|
||||
}
|
||||
if (path)
|
||||
free(path);
|
||||
wfree(path);
|
||||
|
||||
defaults->appDomain = domain;
|
||||
|
||||
@@ -140,7 +293,7 @@ WMGetStandardUserDefaults(void)
|
||||
|
||||
domain = PLGetProplistWithPath(path);
|
||||
|
||||
free(path);
|
||||
wfree(path);
|
||||
|
||||
if (!domain)
|
||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
@@ -153,8 +306,7 @@ WMGetStandardUserDefaults(void)
|
||||
/* terminate list */
|
||||
defaults->searchList[2] = NULL;
|
||||
|
||||
defaults->searchListArray=PLMakeArrayFromElements(NULL,NULL);
|
||||
|
||||
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
|
||||
|
||||
i = 0;
|
||||
while (defaults->searchList[i]) {
|
||||
@@ -163,16 +315,111 @@ WMGetStandardUserDefaults(void)
|
||||
i++;
|
||||
}
|
||||
|
||||
if (sharedUserDefaults)
|
||||
defaults->next = sharedUserDefaults;
|
||||
sharedUserDefaults = defaults;
|
||||
|
||||
/* set to save changes in defaults when program is exited */
|
||||
atexit(saveDefaultsChanges);
|
||||
}
|
||||
addSynchronizeTimerHandler();
|
||||
registerSaveOnExit();
|
||||
|
||||
return sharedUserDefaults;
|
||||
return defaults;
|
||||
}
|
||||
|
||||
|
||||
WMUserDefaults*
|
||||
WMGetDefaultsFromPath(char *path)
|
||||
{
|
||||
WMUserDefaults *defaults;
|
||||
proplist_t domain;
|
||||
proplist_t key;
|
||||
struct stat stbuf;
|
||||
char *name;
|
||||
int i;
|
||||
|
||||
assert(path != NULL);
|
||||
|
||||
if (sharedUserDefaults) {
|
||||
defaults = sharedUserDefaults;
|
||||
while (defaults) {
|
||||
if (defaults->path && strcmp(defaults->path, path) == 0)
|
||||
return defaults;
|
||||
defaults = defaults->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* we didn't found the database we are looking for. Go read it. */
|
||||
defaults = wmalloc(sizeof(WMUserDefaults));
|
||||
memset(defaults, 0, sizeof(WMUserDefaults));
|
||||
|
||||
defaults->defaults = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
|
||||
defaults->searchList = wmalloc(sizeof(proplist_t)*2);
|
||||
|
||||
/* the domain we want, go in the first position */
|
||||
name = strrchr(path, '/');
|
||||
if (!name)
|
||||
name = path;
|
||||
else
|
||||
name++;
|
||||
|
||||
key = PLMakeString(name);
|
||||
defaults->searchList[0] = key;
|
||||
|
||||
if (stat(path, &stbuf) >= 0)
|
||||
defaults->timestamp = stbuf.st_mtime;
|
||||
|
||||
domain = PLGetProplistWithPath(path);
|
||||
|
||||
if (!domain) {
|
||||
proplist_t p;
|
||||
|
||||
domain = PLMakeDictionaryFromEntries(NULL, NULL, NULL);
|
||||
p = PLMakeString(path);
|
||||
PLSetFilename(domain, p);
|
||||
PLRelease(p);
|
||||
}
|
||||
|
||||
defaults->path = wstrdup(path);
|
||||
|
||||
defaults->appDomain = domain;
|
||||
|
||||
if (domain)
|
||||
PLInsertDictionaryEntry(defaults->defaults, key, domain);
|
||||
|
||||
PLRelease(key);
|
||||
|
||||
/* terminate list */
|
||||
defaults->searchList[1] = NULL;
|
||||
|
||||
defaults->searchListArray = PLMakeArrayFromElements(NULL,NULL);
|
||||
|
||||
i = 0;
|
||||
while (defaults->searchList[i]) {
|
||||
PLAppendArrayElement(defaults->searchListArray,
|
||||
defaults->searchList[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (sharedUserDefaults)
|
||||
defaults->next = sharedUserDefaults;
|
||||
sharedUserDefaults = defaults;
|
||||
|
||||
addSynchronizeTimerHandler();
|
||||
registerSaveOnExit();
|
||||
|
||||
return defaults;
|
||||
}
|
||||
|
||||
|
||||
/* Returns a PLArray with all keys in the user defaults database.
|
||||
* Free the returned array with PLRelease() when no longer needed,
|
||||
* but do not free the elements of the array! They're just references. */
|
||||
proplist_t
|
||||
WMGetUDAllKeys(WMUserDefaults *database)
|
||||
{
|
||||
return PLGetAllDictionaryKeys(database->appDomain);
|
||||
}
|
||||
|
||||
|
||||
proplist_t
|
||||
WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName)
|
||||
@@ -235,7 +482,7 @@ WMGetUDStringForKey(WMUserDefaults *database, char *defaultName)
|
||||
if (!PLIsString(val))
|
||||
return NULL;
|
||||
|
||||
return wstrdup(PLGetString(val));
|
||||
return PLGetString(val);
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +513,7 @@ WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName)
|
||||
|
||||
|
||||
|
||||
int
|
||||
float
|
||||
WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
|
||||
{
|
||||
proplist_t val;
|
||||
@@ -275,14 +522,10 @@ WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName)
|
||||
|
||||
val = WMGetUDObjectForKey(database, defaultName);
|
||||
|
||||
if (!val)
|
||||
if (!val || !PLIsString(val))
|
||||
return 0.0;
|
||||
|
||||
if (!PLIsString(val))
|
||||
return 0.0;
|
||||
|
||||
str = PLGetString(val);
|
||||
if (!str)
|
||||
if (!(str = PLGetString(val)))
|
||||
return 0.0;
|
||||
|
||||
if (sscanf(str, "%f", &value)!=1)
|
||||
@@ -401,7 +644,7 @@ WMSetUDSearchList(WMUserDefaults *database, proplist_t list)
|
||||
PLRelease(database->searchList[i]);
|
||||
i++;
|
||||
}
|
||||
free(database->searchList);
|
||||
wfree(database->searchList);
|
||||
}
|
||||
if (database->searchListArray) {
|
||||
PLRelease(database->searchListArray);
|
||||
|
||||
@@ -7,17 +7,19 @@
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef _AIX
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(HAVE_SELECT)
|
||||
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
void
|
||||
wusleep(unsigned int microsecs)
|
||||
|
||||
@@ -4,38 +4,10 @@
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#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 void W_ReadConfigurations(void);
|
||||
|
||||
extern void W_InitNotificationCenter(void);
|
||||
|
||||
|
||||
typedef struct W_Application {
|
||||
char *applicationName;
|
||||
int argc;
|
||||
char **argv;
|
||||
char *resourcePath;
|
||||
} W_Application;
|
||||
|
||||
|
||||
struct W_Application WMApplication;
|
||||
|
||||
|
||||
@@ -72,9 +44,6 @@ WMInitializeApplication(char *applicationName, int *argc, char **argv)
|
||||
|
||||
/* initialize notification center */
|
||||
W_InitNotificationCenter();
|
||||
|
||||
/* read general configuration data for WINGs */
|
||||
W_ReadConfigurations();
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +51,7 @@ void
|
||||
WMSetResourcePath(char *path)
|
||||
{
|
||||
if (WMApplication.resourcePath)
|
||||
free(WMApplication.resourcePath);
|
||||
wfree(WMApplication.resourcePath);
|
||||
WMApplication.resourcePath = wstrdup(path);
|
||||
}
|
||||
|
||||
@@ -115,7 +84,7 @@ checkFile(char *path, char *folder, char *ext, char *resource)
|
||||
strcat(ret, resource);
|
||||
|
||||
if (access(ret, F_OK)!=0) {
|
||||
free(ret);
|
||||
wfree(ret);
|
||||
ret = NULL;
|
||||
}
|
||||
|
||||
@@ -159,18 +128,18 @@ WMPathForResourceOfType(char *resource, char *ext)
|
||||
} else {
|
||||
path = NULL;
|
||||
}
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
if (path)
|
||||
return path;
|
||||
}
|
||||
|
||||
appdir = wmalloc(strlen(WMApplication.applicationName)+8);
|
||||
appdir = wmalloc(strlen(WMApplication.applicationName)+10);
|
||||
sprintf(appdir, "Apps/%s.app", WMApplication.applicationName);
|
||||
|
||||
if (getenv("GNUSTEP_USER_ROOT")) {
|
||||
path = checkFile(getenv("GNUSTEP_USER_ROOT"), appdir, ext, resource);
|
||||
if (path) {
|
||||
free(appdir);
|
||||
wfree(appdir);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
@@ -178,9 +147,8 @@ WMPathForResourceOfType(char *resource, char *ext)
|
||||
tmp = wusergnusteppath();
|
||||
if (tmp) {
|
||||
path = checkFile(tmp, appdir, ext, resource);
|
||||
free(tmp);
|
||||
if (path) {
|
||||
free(appdir);
|
||||
wfree(appdir);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
@@ -188,14 +156,14 @@ WMPathForResourceOfType(char *resource, char *ext)
|
||||
if (getenv("GNUSTEP_LOCAL_ROOT")) {
|
||||
path = checkFile(getenv("GNUSTEP_LOCAL_ROOT"), appdir, ext, resource);
|
||||
if (path) {
|
||||
free(appdir);
|
||||
wfree(appdir);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
path = checkFile("/usr/local/GNUstep", appdir, ext, resource);
|
||||
if (path) {
|
||||
free(appdir);
|
||||
wfree(appdir);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -203,14 +171,14 @@ WMPathForResourceOfType(char *resource, char *ext)
|
||||
if (getenv("GNUSTEP_SYSTEM_ROOT")) {
|
||||
path = checkFile(getenv("GNUSTEP_SYSTEM_ROOT"), appdir, ext, resource);
|
||||
if (path) {
|
||||
free(appdir);
|
||||
wfree(appdir);
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
path = checkFile("/usr/GNUstep", appdir, ext, resource);
|
||||
if (path) {
|
||||
free(appdir);
|
||||
wfree(appdir);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -218,84 +186,3 @@ WMPathForResourceOfType(char *resource, char *ext)
|
||||
}
|
||||
|
||||
|
||||
/********************* WMScreen related stuff ********************/
|
||||
|
||||
|
||||
void
|
||||
WMSetApplicationIconImage(WMScreen *scr, WMPixmap *icon)
|
||||
{
|
||||
if (scr->applicationIcon)
|
||||
WMReleasePixmap(scr->applicationIcon);
|
||||
|
||||
scr->applicationIcon = 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;
|
||||
|
||||
XSetWMHints(scr->display, scr->groupLeader, hints);
|
||||
XFree(hints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WMPixmap*
|
||||
WMGetApplicationIconImage(WMScreen *scr)
|
||||
{
|
||||
return scr->applicationIcon;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag)
|
||||
{
|
||||
scr->aflags.hasAppIcon = flag;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
W_InitApplication(WMScreen *scr)
|
||||
{
|
||||
Window leader;
|
||||
XClassHint *classHint;
|
||||
XWMHints *hints;
|
||||
|
||||
leader = XCreateSimpleWindow(scr->display, scr->rootWin, -1, -1,
|
||||
1, 1, 0, 0, 0);
|
||||
|
||||
if (!scr->aflags.simpleApplication) {
|
||||
classHint = XAllocClassHint();
|
||||
classHint->res_name = "groupLeader";
|
||||
classHint->res_class = WMApplication.applicationName;
|
||||
XSetClassHint(scr->display, leader, classHint);
|
||||
XFree(classHint);
|
||||
|
||||
XSetCommand(scr->display, leader, WMApplication.argv,
|
||||
WMApplication.argc);
|
||||
|
||||
hints = XAllocWMHints();
|
||||
|
||||
hints->flags = WindowGroupHint;
|
||||
hints->window_group = leader;
|
||||
|
||||
if (scr->applicationIcon) {
|
||||
hints->flags |= IconPixmapHint;
|
||||
hints->icon_pixmap = scr->applicationIcon->pixmap;
|
||||
if (scr->applicationIcon->mask) {
|
||||
hints->flags |= IconMaskHint;
|
||||
hints->icon_mask = scr->applicationIcon->mask;
|
||||
}
|
||||
}
|
||||
|
||||
XSetWMHints(scr->display, leader, hints);
|
||||
|
||||
XFree(hints);
|
||||
}
|
||||
scr->groupLeader = leader;
|
||||
}
|
||||
|
||||
|
||||
|
||||
123
WINGs/wappresource.c
Normal file
123
WINGs/wappresource.c
Normal file
@@ -0,0 +1,123 @@
|
||||
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#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
|
||||
WMSetApplicationIconWindow(WMScreen *scr, Window window)
|
||||
{
|
||||
scr->applicationIconWindow = window;
|
||||
|
||||
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, WMPixmap *icon)
|
||||
{
|
||||
if (scr->applicationIcon)
|
||||
WMReleasePixmap(scr->applicationIcon);
|
||||
|
||||
scr->applicationIcon = 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;
|
||||
|
||||
XSetWMHints(scr->display, scr->groupLeader, hints);
|
||||
XFree(hints);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WMPixmap*
|
||||
WMGetApplicationIconImage(WMScreen *scr)
|
||||
{
|
||||
return scr->applicationIcon;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetApplicationHasAppIcon(WMScreen *scr, Bool flag)
|
||||
{
|
||||
scr->aflags.hasAppIcon = flag;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
W_InitApplication(WMScreen *scr)
|
||||
{
|
||||
Window leader;
|
||||
XClassHint *classHint;
|
||||
XWMHints *hints;
|
||||
|
||||
leader = XCreateSimpleWindow(scr->display, scr->rootWin, -1, -1,
|
||||
1, 1, 0, 0, 0);
|
||||
|
||||
if (!scr->aflags.simpleApplication) {
|
||||
classHint = XAllocClassHint();
|
||||
classHint->res_name = "groupLeader";
|
||||
classHint->res_class = WMApplication.applicationName;
|
||||
XSetClassHint(scr->display, leader, classHint);
|
||||
XFree(classHint);
|
||||
|
||||
XSetCommand(scr->display, leader, WMApplication.argv,
|
||||
WMApplication.argc);
|
||||
|
||||
hints = XAllocWMHints();
|
||||
|
||||
hints->flags = WindowGroupHint;
|
||||
hints->window_group = leader;
|
||||
|
||||
if (scr->applicationIcon) {
|
||||
hints->flags |= IconPixmapHint;
|
||||
hints->icon_pixmap = scr->applicationIcon->pixmap;
|
||||
if (scr->applicationIcon->mask) {
|
||||
hints->flags |= IconMaskHint;
|
||||
hints->icon_mask = scr->applicationIcon->mask;
|
||||
}
|
||||
}
|
||||
|
||||
XSetWMHints(scr->display, leader, hints);
|
||||
|
||||
XFree(hints);
|
||||
}
|
||||
scr->groupLeader = leader;
|
||||
}
|
||||
|
||||
|
||||
481
WINGs/wballoon.c
Normal file
481
WINGs/wballoon.c
Normal file
@@ -0,0 +1,481 @@
|
||||
|
||||
|
||||
|
||||
#include "../src/config.h"
|
||||
#include "WINGsP.h"
|
||||
|
||||
#ifdef SHAPE
|
||||
#include <X11/extensions/shape.h>
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct W_Balloon {
|
||||
W_View *view;
|
||||
|
||||
WMHashTable *table; /* Table from view ptr to text */
|
||||
|
||||
WMColor *backColor;
|
||||
WMColor *textColor;
|
||||
WMFont *font;
|
||||
|
||||
WMHandlerID timer; /* timer for showing balloon */
|
||||
|
||||
WMHandlerID noDelayTimer;
|
||||
|
||||
int delay;
|
||||
|
||||
Window forWindow; /* window for which the balloon
|
||||
* is being show in the moment */
|
||||
|
||||
struct {
|
||||
WMAlignment alignment:2;
|
||||
unsigned enabled:1;
|
||||
|
||||
unsigned noDelay:1;
|
||||
} flags;
|
||||
} Balloon;
|
||||
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 60
|
||||
#define DEFAULT_HEIGHT 14
|
||||
#define DEFAULT_ALIGNMENT WALeft
|
||||
#define DEFAULT_DELAY 500
|
||||
|
||||
#define NO_DELAY_DELAY 150
|
||||
|
||||
|
||||
static void destroyBalloon(Balloon *bPtr);
|
||||
|
||||
|
||||
static void handleEvents(XEvent *event, void *data);
|
||||
|
||||
static void showText(Balloon *bPtr, int x, int y, int w, int h, char *text);
|
||||
|
||||
|
||||
struct W_Balloon*
|
||||
W_CreateBalloon(WMScreen *scr)
|
||||
{
|
||||
Balloon *bPtr;
|
||||
|
||||
bPtr = wmalloc(sizeof(Balloon));
|
||||
memset(bPtr, 0, sizeof(Balloon));
|
||||
|
||||
bPtr->view = W_CreateUnmanagedTopView(scr);
|
||||
if (!bPtr->view) {
|
||||
wfree(bPtr);
|
||||
return NULL;
|
||||
}
|
||||
bPtr->view->self = bPtr;
|
||||
|
||||
bPtr->textColor = WMRetainColor(bPtr->view->screen->black);
|
||||
|
||||
WMCreateEventHandler(bPtr->view, StructureNotifyMask, handleEvents, bPtr);
|
||||
|
||||
W_ResizeView(bPtr->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
bPtr->flags.alignment = DEFAULT_ALIGNMENT;
|
||||
|
||||
bPtr->table = WMCreateHashTable(WMIntHashCallbacks);
|
||||
|
||||
bPtr->delay = DEFAULT_DELAY;
|
||||
|
||||
bPtr->flags.enabled = 1;
|
||||
|
||||
return bPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMSetBalloonTextAlignment(WMScreen *scr, WMAlignment alignment)
|
||||
{
|
||||
scr->balloon->flags.alignment = alignment;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBalloonTextForView(char *text, WMView *view)
|
||||
{
|
||||
char *oldText = NULL;
|
||||
WMScreen *scr = view->screen;
|
||||
|
||||
if (text) {
|
||||
oldText = WMHashInsert(scr->balloon->table, view, wstrdup(text));
|
||||
} else {
|
||||
oldText = WMHashGet(scr->balloon->table, view);
|
||||
|
||||
WMHashRemove(scr->balloon->table, view);
|
||||
}
|
||||
|
||||
if (oldText) {
|
||||
wfree(oldText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBalloonFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
Balloon *bPtr = scr->balloon;
|
||||
|
||||
if (bPtr->font!=NULL)
|
||||
WMReleaseFont(bPtr->font);
|
||||
|
||||
if (font)
|
||||
bPtr->font = WMRetainFont(font);
|
||||
else
|
||||
bPtr->font = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBalloonTextColor(WMScreen *scr, WMColor *color)
|
||||
{
|
||||
Balloon *bPtr = scr->balloon;
|
||||
|
||||
if (bPtr->textColor)
|
||||
WMReleaseColor(bPtr->textColor);
|
||||
|
||||
bPtr->textColor = WMRetainColor(color);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBalloonDelay(WMScreen *scr, int delay)
|
||||
{
|
||||
scr->balloon->delay = delay;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetBalloonEnabled(WMScreen *scr, Bool flag)
|
||||
{
|
||||
scr->balloon->flags.enabled = flag;
|
||||
|
||||
W_UnmapView(scr->balloon->view);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
clearNoDelay(void *data)
|
||||
{
|
||||
Balloon *bPtr = (Balloon*)data;
|
||||
|
||||
bPtr->flags.noDelay = 0;
|
||||
bPtr->noDelayTimer = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
W_BalloonHandleLeaveView(WMView *view)
|
||||
{
|
||||
Balloon *bPtr = view->screen->balloon;
|
||||
|
||||
if (bPtr->forWindow == view->window) {
|
||||
if (bPtr->view->flags.mapped) {
|
||||
W_UnmapView(bPtr->view);
|
||||
bPtr->noDelayTimer = WMAddTimerHandler(NO_DELAY_DELAY,
|
||||
clearNoDelay, bPtr);
|
||||
}
|
||||
if (bPtr->timer)
|
||||
WMDeleteTimerHandler(bPtr->timer);
|
||||
|
||||
bPtr->timer = NULL;
|
||||
|
||||
bPtr->forWindow = None;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* botar balao perto do cursor
|
||||
* so mapear balao se o mouse ficar parado pelo delay
|
||||
*
|
||||
*/
|
||||
|
||||
static void
|
||||
showBalloon(void *data)
|
||||
{
|
||||
char *text;
|
||||
WMView *view = (WMView*)data;
|
||||
Balloon *bPtr = view->screen->balloon;
|
||||
int x, y;
|
||||
Window foo;
|
||||
|
||||
bPtr->timer = NULL;
|
||||
|
||||
text = WMHashGet(bPtr->table, view);
|
||||
if (!text)
|
||||
return;
|
||||
|
||||
XTranslateCoordinates(view->screen->display, view->window,
|
||||
view->screen->rootWin, 0, 0, &x, &y, &foo);
|
||||
|
||||
if (!bPtr->view->flags.realized)
|
||||
W_RealizeView(bPtr->view);
|
||||
|
||||
showText(bPtr, x, y, view->size.width, view->size.height, text);
|
||||
|
||||
bPtr->flags.noDelay = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
W_BalloonHandleEnterView(WMView *view)
|
||||
{
|
||||
Balloon *bPtr = view->screen->balloon;
|
||||
char *text;
|
||||
|
||||
if (!bPtr->flags.enabled)
|
||||
return;
|
||||
|
||||
text = WMHashGet(bPtr->table, view);
|
||||
if (!text) {
|
||||
if (bPtr->view->flags.realized)
|
||||
W_UnmapView(bPtr->view);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (bPtr->timer)
|
||||
WMDeleteTimerHandler(bPtr->timer);
|
||||
bPtr->timer = NULL;
|
||||
|
||||
if (bPtr->noDelayTimer)
|
||||
WMDeleteTimerHandler(bPtr->noDelayTimer);
|
||||
bPtr->noDelayTimer = NULL;
|
||||
|
||||
bPtr->forWindow = view->window;
|
||||
|
||||
if (bPtr->flags.noDelay) {
|
||||
bPtr->timer = NULL;
|
||||
|
||||
showBalloon(view);
|
||||
} else {
|
||||
bPtr->timer = WMAddTimerHandler(bPtr->delay, showBalloon, view);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define TOP 0
|
||||
#define BOTTOM 1
|
||||
#define LEFT 0
|
||||
#define RIGHT 2
|
||||
|
||||
#define TLEFT (TOP|LEFT)
|
||||
#define TRIGHT (TOP|RIGHT)
|
||||
#define BLEFT (BOTTOM|LEFT)
|
||||
#define BRIGHT (BOTTOM|RIGHT)
|
||||
|
||||
|
||||
|
||||
#define SPACE 12
|
||||
|
||||
|
||||
static void
|
||||
drawBalloon(Display *dpy, Pixmap pix, GC gc, int x, int y, int w, int h,
|
||||
int side)
|
||||
{
|
||||
int rad = h*3/10;
|
||||
XPoint pt[3];
|
||||
|
||||
XFillArc(dpy, pix, gc, x, y, rad, rad, 90*64, 90*64);
|
||||
XFillArc(dpy, pix, gc, x, y+h-1-rad, rad, rad, 180*64, 90*64);
|
||||
|
||||
XFillArc(dpy, pix, gc, x+w-1-rad, y, rad, rad, 0*64, 90*64);
|
||||
XFillArc(dpy, pix, gc, x+w-1-rad, y+h-1-rad, rad, rad, 270*64, 90*64);
|
||||
|
||||
XFillRectangle(dpy, pix, gc, x, y+rad/2, w, h-rad);
|
||||
XFillRectangle(dpy, pix, gc, x+rad/2, y, w-rad, h);
|
||||
|
||||
if (side & BOTTOM) {
|
||||
pt[0].y = y+h-1;
|
||||
pt[1].y = y+h-1+SPACE;
|
||||
pt[2].y = y+h-1;
|
||||
} else {
|
||||
pt[0].y = y;
|
||||
pt[1].y = y-SPACE;
|
||||
pt[2].y = y;
|
||||
}
|
||||
if (side & RIGHT) {
|
||||
pt[0].x = x+w-h+2*h/16;
|
||||
pt[1].x = x+w-h+11*h/16;
|
||||
pt[2].x = x+w-h+7*h/16;
|
||||
} else {
|
||||
pt[0].x = x+h-2*h/16;
|
||||
pt[1].x = x+h-11*h/16;
|
||||
pt[2].x = x+h-7*h/16;
|
||||
}
|
||||
XFillPolygon(dpy, pix, gc, pt, 3, Convex, CoordModeOrigin);
|
||||
}
|
||||
|
||||
|
||||
static Pixmap
|
||||
makePixmap(WMScreen *scr, int width, int height, int side, Pixmap *mask)
|
||||
{
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
Pixmap bitmap;
|
||||
Pixmap pixmap;
|
||||
int x, y;
|
||||
WMColor *black = WMBlackColor(scr);
|
||||
WMColor *white = WMWhiteColor(scr);
|
||||
|
||||
bitmap = XCreatePixmap(dpy, scr->rootWin, width+SPACE, height+SPACE, 1);
|
||||
|
||||
XSetForeground(dpy, scr->monoGC, 0);
|
||||
XFillRectangle(dpy, bitmap, scr->monoGC, 0, 0, width+SPACE, height+SPACE);
|
||||
|
||||
pixmap = XCreatePixmap(dpy, scr->rootWin, width+SPACE, height+SPACE,
|
||||
scr->depth);
|
||||
|
||||
XFillRectangle(dpy, pixmap, WMColorGC(black), 0, 0,
|
||||
width+SPACE, height+SPACE);
|
||||
|
||||
if (side & BOTTOM) {
|
||||
y = 0;
|
||||
} else {
|
||||
y = SPACE;
|
||||
}
|
||||
x = 0;
|
||||
|
||||
XSetForeground(dpy, scr->monoGC, 1);
|
||||
drawBalloon(dpy, bitmap, scr->monoGC, x, y, width, height, side);
|
||||
drawBalloon(dpy, pixmap, WMColorGC(white), x+1, y+1, width-2, height-2,
|
||||
side);
|
||||
|
||||
*mask = bitmap;
|
||||
|
||||
WMReleaseColor(black);
|
||||
WMReleaseColor(white);
|
||||
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showText(Balloon *bPtr, int x, int y, int h, int w, char *text)
|
||||
{
|
||||
WMScreen *scr = bPtr->view->screen;
|
||||
Display *dpy = WMScreenDisplay(scr);
|
||||
int width;
|
||||
int height;
|
||||
Pixmap pixmap;
|
||||
Pixmap mask;
|
||||
WMFont *font = bPtr->font ? bPtr->font : scr->normalFont;
|
||||
int textHeight;
|
||||
int side = 0;
|
||||
int ty;
|
||||
int bx, by;
|
||||
|
||||
{
|
||||
int w;
|
||||
char *ptr, *ptr2;
|
||||
|
||||
ptr2 = ptr = text;
|
||||
width = 0;
|
||||
while (ptr && ptr2) {
|
||||
ptr2 = strchr(ptr, '\n');
|
||||
if (ptr2) {
|
||||
w = WMWidthOfString(font, ptr, ptr2 - ptr);
|
||||
} else {
|
||||
w = WMWidthOfString(font, ptr, strlen(ptr));
|
||||
}
|
||||
if (w > width)
|
||||
width = w;
|
||||
ptr = ptr2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
width += 16;
|
||||
|
||||
textHeight = W_GetTextHeight(font, text, width, False);
|
||||
|
||||
height = textHeight + 4;
|
||||
|
||||
if (height < 16)
|
||||
height = 16;
|
||||
if (width < height)
|
||||
width = height;
|
||||
|
||||
if (x + width > scr->rootView->size.width) {
|
||||
side = RIGHT;
|
||||
bx = x - width + w/2;
|
||||
if (bx < 0)
|
||||
bx = 0;
|
||||
} else {
|
||||
side = LEFT;
|
||||
bx = x + w/2;
|
||||
}
|
||||
if (bx + width > scr->rootView->size.width)
|
||||
bx = scr->rootView->size.width - width;
|
||||
|
||||
if (y - (height + SPACE) < 0) {
|
||||
side |= TOP;
|
||||
by = y+h-1;
|
||||
ty = SPACE;
|
||||
} else {
|
||||
side |= BOTTOM;
|
||||
by = y - (height + SPACE);
|
||||
ty = 0;
|
||||
}
|
||||
pixmap = makePixmap(scr, width, height, side, &mask);
|
||||
|
||||
W_PaintText(bPtr->view, pixmap, font, 8, ty + (height - textHeight)/2,
|
||||
width, bPtr->flags.alignment,
|
||||
WMColorGC(bPtr->textColor ? bPtr->textColor : scr->black),
|
||||
False, text, strlen(text));
|
||||
|
||||
XSetWindowBackgroundPixmap(dpy, bPtr->view->window, pixmap);
|
||||
|
||||
W_ResizeView(bPtr->view, width, height+SPACE);
|
||||
|
||||
XFreePixmap(dpy, pixmap);
|
||||
|
||||
#ifdef SHAPE
|
||||
XShapeCombineMask(dpy, bPtr->view->window, ShapeBounding, 0, 0, mask,
|
||||
ShapeSet);
|
||||
#endif
|
||||
XFreePixmap(dpy, mask);
|
||||
|
||||
W_MoveView(bPtr->view, bx, by);
|
||||
|
||||
W_MapView(bPtr->view);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleEvents(XEvent *event, void *data)
|
||||
{
|
||||
Balloon *bPtr = (Balloon*)data;
|
||||
|
||||
switch (event->type) {
|
||||
case DestroyNotify:
|
||||
destroyBalloon(bPtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
destroyBalloon(Balloon *bPtr)
|
||||
{
|
||||
WMHashEnumerator e;
|
||||
char *str;
|
||||
|
||||
e = WMEnumerateHashTable(bPtr->table);
|
||||
|
||||
while ((str = WMNextHashEnumeratorItem(&e))) {
|
||||
wfree(str);
|
||||
}
|
||||
WMFreeHashTable(bPtr->table);
|
||||
|
||||
if (bPtr->textColor)
|
||||
WMReleaseColor(bPtr->textColor);
|
||||
|
||||
if (bPtr->font)
|
||||
WMReleaseFont(bPtr->font);
|
||||
|
||||
wfree(bPtr);
|
||||
}
|
||||
245
WINGs/wbox.c
Normal file
245
WINGs/wbox.c
Normal file
@@ -0,0 +1,245 @@
|
||||
|
||||
|
||||
#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)
|
||||
{
|
||||
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
|
||||
WMSetBoxHorizontal(WMBox *box, Bool flag)
|
||||
{
|
||||
box->horizontal = flag;
|
||||
rearrange(box);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
destroyBox(Box *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;
|
||||
}
|
||||
}
|
||||
659
WINGs/wbrowser.c
659
WINGs/wbrowser.c
File diff suppressed because it is too large
Load Diff
195
WINGs/wbutton.c
195
WINGs/wbutton.c
@@ -14,9 +14,15 @@ typedef struct W_Button {
|
||||
|
||||
WMFont *font;
|
||||
|
||||
WMColor *textColor;
|
||||
WMColor *altTextColor;
|
||||
WMColor *disTextColor;
|
||||
|
||||
W_Pixmap *image;
|
||||
W_Pixmap *altImage;
|
||||
|
||||
W_Pixmap *dimage;
|
||||
|
||||
void *clientData;
|
||||
WMAction *action;
|
||||
|
||||
@@ -97,13 +103,6 @@ static void handleEvents(XEvent *event, void *data);
|
||||
static void handleActionEvents(XEvent *event, void *data);
|
||||
|
||||
|
||||
W_ViewProcedureTable _ButtonViewProcedures = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static char *WMPushedRadioNotification="WMPushedRadioNotification";
|
||||
|
||||
|
||||
@@ -122,7 +121,7 @@ WMCreateCustomButton(WMWidget *parent, int behaviourMask)
|
||||
|
||||
bPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!bPtr->view) {
|
||||
free(bPtr);
|
||||
wfree(bPtr);
|
||||
return NULL;
|
||||
}
|
||||
bPtr->view->self = bPtr;
|
||||
@@ -231,6 +230,50 @@ WMCreateButton(WMWidget *parent, WMButtonType type)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
updateDisabledMask(WMButton *bPtr)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(bPtr);
|
||||
Display *dpy = scr->display;
|
||||
|
||||
if (bPtr->image) {
|
||||
XGCValues gcv;
|
||||
|
||||
bPtr->dimage->mask = XCreatePixmap(dpy, scr->stipple,
|
||||
bPtr->dimage->width,
|
||||
bPtr->dimage->height, 1);
|
||||
|
||||
XSetForeground(dpy, scr->monoGC, 0);
|
||||
XFillRectangle(dpy, bPtr->dimage->mask, scr->monoGC, 0, 0,
|
||||
bPtr->dimage->width, bPtr->dimage->height);
|
||||
|
||||
gcv.foreground = 1;
|
||||
gcv.background = 0;
|
||||
gcv.stipple = scr->stipple;
|
||||
gcv.fill_style = FillStippled;
|
||||
gcv.clip_mask = bPtr->image->mask;
|
||||
gcv.clip_x_origin = 0;
|
||||
gcv.clip_y_origin = 0;
|
||||
|
||||
XChangeGC(dpy, scr->monoGC, GCForeground|GCBackground|GCStipple
|
||||
|GCFillStyle|GCClipMask|GCClipXOrigin|GCClipYOrigin, &gcv);
|
||||
|
||||
XFillRectangle(dpy, bPtr->dimage->mask, scr->monoGC, 0, 0,
|
||||
bPtr->dimage->width, bPtr->dimage->height);
|
||||
|
||||
gcv.fill_style = FillSolid;
|
||||
gcv.clip_mask = None;
|
||||
XChangeGC(dpy, scr->monoGC, GCFillStyle|GCClipMask, &gcv);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WMSetButtonImageDefault(WMButton *bPtr)
|
||||
{
|
||||
WMSetButtonImage (bPtr, WMWidgetScreen(bPtr)->buttonArrow);
|
||||
WMSetButtonAltImage (bPtr, WMWidgetScreen(bPtr)->pushedButtonArrow);
|
||||
}
|
||||
|
||||
void
|
||||
WMSetButtonImage(WMButton *bPtr, WMPixmap *image)
|
||||
{
|
||||
@@ -238,6 +281,19 @@ WMSetButtonImage(WMButton *bPtr, WMPixmap *image)
|
||||
WMReleasePixmap(bPtr->image);
|
||||
bPtr->image = WMRetainPixmap(image);
|
||||
|
||||
if (bPtr->dimage) {
|
||||
bPtr->dimage->pixmap = None;
|
||||
WMReleasePixmap(bPtr->dimage);
|
||||
bPtr->dimage = NULL;
|
||||
}
|
||||
|
||||
if (image) {
|
||||
bPtr->dimage = WMCreatePixmapFromXPixmaps(WMWidgetScreen(bPtr),
|
||||
image->pixmap, None,
|
||||
image->width, image->height,
|
||||
image->depth);
|
||||
updateDisabledMask(bPtr);
|
||||
}
|
||||
|
||||
if (bPtr->view->flags.realized) {
|
||||
paintButton(bPtr);
|
||||
@@ -288,7 +344,7 @@ void
|
||||
WMSetButtonText(WMButton *bPtr, char *text)
|
||||
{
|
||||
if (bPtr->caption)
|
||||
free(bPtr->caption);
|
||||
wfree(bPtr->caption);
|
||||
|
||||
if (text!=NULL) {
|
||||
bPtr->caption = wstrdup(text);
|
||||
@@ -307,7 +363,7 @@ void
|
||||
WMSetButtonAltText(WMButton *bPtr, char *text)
|
||||
{
|
||||
if (bPtr->altCaption)
|
||||
free(bPtr->altCaption);
|
||||
wfree(bPtr->altCaption);
|
||||
|
||||
if (text!=NULL) {
|
||||
bPtr->altCaption = wstrdup(text);
|
||||
@@ -321,6 +377,36 @@ WMSetButtonAltText(WMButton *bPtr, char *text)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetButtonTextColor(WMButton *bPtr, WMColor *color)
|
||||
{
|
||||
if (bPtr->textColor)
|
||||
WMReleaseColor(bPtr->textColor);
|
||||
|
||||
bPtr->textColor = WMRetainColor(color);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetButtonAltTextColor(WMButton *bPtr, WMColor *color)
|
||||
{
|
||||
if (bPtr->altTextColor)
|
||||
WMReleaseColor(bPtr->altTextColor);
|
||||
|
||||
bPtr->altTextColor = WMRetainColor(color);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetButtonDisabledTextColor(WMButton *bPtr, WMColor *color)
|
||||
{
|
||||
if (bPtr->disTextColor)
|
||||
WMReleaseColor(bPtr->disTextColor);
|
||||
|
||||
bPtr->disTextColor = WMRetainColor(color);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetButtonSelected(WMButton *bPtr, int isSelected)
|
||||
{
|
||||
@@ -329,6 +415,8 @@ WMSetButtonSelected(WMButton *bPtr, int isSelected)
|
||||
if (bPtr->view->flags.realized) {
|
||||
paintButton(bPtr);
|
||||
}
|
||||
if (bPtr->groupIndex > 0)
|
||||
WMPostNotificationName(WMPushedRadioNotification, bPtr, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -398,15 +486,15 @@ WMPerformButtonClick(WMButton *bPtr)
|
||||
wusleep(20000);
|
||||
}
|
||||
|
||||
if (bPtr->groupIndex>0) {
|
||||
bPtr->flags.pushed = 0;
|
||||
|
||||
if (bPtr->groupIndex > 0) {
|
||||
WMPostNotificationName(WMPushedRadioNotification, bPtr, NULL);
|
||||
}
|
||||
|
||||
if (bPtr->action)
|
||||
(*bPtr->action)(bPtr, bPtr->clientData);
|
||||
|
||||
bPtr->flags.pushed = 0;
|
||||
|
||||
if (bPtr->view->flags.mapped)
|
||||
paintButton(bPtr);
|
||||
}
|
||||
@@ -493,16 +581,28 @@ static void
|
||||
paintButton(Button *bPtr)
|
||||
{
|
||||
W_Screen *scrPtr = bPtr->view->screen;
|
||||
GC gc;
|
||||
WMReliefType relief;
|
||||
int offset;
|
||||
char *caption;
|
||||
WMPixmap *image;
|
||||
GC textGC;
|
||||
WMColor *textColor;
|
||||
GC gc;
|
||||
|
||||
gc = NULL;
|
||||
caption = bPtr->caption;
|
||||
|
||||
if (bPtr->flags.enabled) {
|
||||
textColor = (bPtr->textColor!=NULL
|
||||
? bPtr->textColor : scrPtr->black);
|
||||
} else {
|
||||
textColor = (bPtr->disTextColor!=NULL
|
||||
? bPtr->disTextColor : scrPtr->darkGray);
|
||||
}
|
||||
|
||||
if (bPtr->flags.enabled || !bPtr->dimage)
|
||||
image = bPtr->image;
|
||||
else
|
||||
image = bPtr->dimage;
|
||||
offset = 0;
|
||||
if (bPtr->flags.bordered)
|
||||
relief = WRRaised;
|
||||
@@ -510,15 +610,18 @@ paintButton(Button *bPtr)
|
||||
relief = WRFlat;
|
||||
|
||||
if (bPtr->flags.selected) {
|
||||
if (bPtr->flags.stateLight)
|
||||
gc = W_GC(scrPtr->white);
|
||||
if (bPtr->flags.stateLight) {
|
||||
gc = WMColorGC(scrPtr->white);
|
||||
textColor = scrPtr->black;
|
||||
}
|
||||
|
||||
if (bPtr->flags.stateChange) {
|
||||
if (bPtr->altCaption) {
|
||||
if (bPtr->altCaption)
|
||||
caption = bPtr->altCaption;
|
||||
}
|
||||
if (bPtr->altImage)
|
||||
image = bPtr->altImage;
|
||||
if (bPtr->altTextColor)
|
||||
textColor = bPtr->altTextColor;
|
||||
}
|
||||
|
||||
if (bPtr->flags.statePush && bPtr->flags.bordered) {
|
||||
@@ -532,25 +635,22 @@ paintButton(Button *bPtr)
|
||||
relief = WRPushed;
|
||||
offset = 1;
|
||||
}
|
||||
if (bPtr->flags.pushLight)
|
||||
gc = W_GC(scrPtr->white);
|
||||
if (bPtr->flags.pushLight) {
|
||||
gc = WMColorGC(scrPtr->white);
|
||||
textColor = scrPtr->black;
|
||||
}
|
||||
|
||||
if (bPtr->flags.pushChange) {
|
||||
if (bPtr->altCaption) {
|
||||
if (bPtr->altCaption)
|
||||
caption = bPtr->altCaption;
|
||||
}
|
||||
if (bPtr->altImage)
|
||||
image = bPtr->altImage;
|
||||
if (bPtr->altTextColor)
|
||||
textColor = bPtr->altTextColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (bPtr->flags.enabled)
|
||||
textGC = W_GC(scrPtr->black);
|
||||
else
|
||||
textGC = W_GC(scrPtr->darkGray);
|
||||
|
||||
W_PaintTextAndImage(bPtr->view, True, textGC,
|
||||
W_PaintTextAndImage(bPtr->view, False, WMColorGC(textColor),
|
||||
(bPtr->font!=NULL ? bPtr->font : scrPtr->normalFont),
|
||||
relief, caption, bPtr->flags.alignment, image,
|
||||
bPtr->flags.imagePosition, gc, offset);
|
||||
@@ -628,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;
|
||||
|
||||
@@ -652,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) {
|
||||
@@ -672,7 +770,7 @@ handleActionEvents(XEvent *event, void *data)
|
||||
paintButton(bPtr);
|
||||
|
||||
if (doclick) {
|
||||
if (bPtr->flags.selected && bPtr->groupIndex>0) {
|
||||
if (bPtr->flags.selected && bPtr->groupIndex > 0) {
|
||||
WMPostNotificationName(WMPushedRadioNotification, bPtr, NULL);
|
||||
}
|
||||
|
||||
@@ -697,18 +795,33 @@ destroyButton(Button *bPtr)
|
||||
WMReleaseFont(bPtr->font);
|
||||
|
||||
if (bPtr->caption)
|
||||
free(bPtr->caption);
|
||||
wfree(bPtr->caption);
|
||||
|
||||
if (bPtr->altCaption)
|
||||
free(bPtr->altCaption);
|
||||
wfree(bPtr->altCaption);
|
||||
|
||||
if (bPtr->textColor)
|
||||
WMReleaseColor(bPtr->textColor);
|
||||
|
||||
if (bPtr->altTextColor)
|
||||
WMReleaseColor(bPtr->altTextColor);
|
||||
|
||||
if (bPtr->disTextColor)
|
||||
WMReleaseColor(bPtr->disTextColor);
|
||||
|
||||
if (bPtr->image)
|
||||
WMReleasePixmap(bPtr->image);
|
||||
|
||||
if (bPtr->dimage) {
|
||||
/* yuck.. kluge */
|
||||
bPtr->dimage->pixmap = None;
|
||||
|
||||
WMReleasePixmap(bPtr->dimage);
|
||||
}
|
||||
if (bPtr->altImage)
|
||||
WMReleasePixmap(bPtr->altImage);
|
||||
|
||||
free(bPtr);
|
||||
wfree(bPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ findCloseColor(WMScreen *scr, unsigned short red, unsigned short green,
|
||||
WMColor *color;
|
||||
XColor xcolor;
|
||||
RColor rcolor;
|
||||
XGCValues gcv;
|
||||
|
||||
rcolor.red = red>>8;
|
||||
rcolor.green = green>>8;
|
||||
@@ -49,11 +48,7 @@ findCloseColor(WMScreen *scr, unsigned short red, unsigned short green,
|
||||
color->refCount = 1;
|
||||
color->color = xcolor;
|
||||
color->flags.exact = 1;
|
||||
|
||||
gcv.foreground = color->color.pixel;
|
||||
gcv.graphics_exposures = False;
|
||||
color->gc = XCreateGC(scr->display, scr->rcontext->drawable,
|
||||
GCForeground|GCGraphicsExposures, &gcv);
|
||||
color->gc = NULL;
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -65,7 +60,6 @@ createRGBColor(WMScreen *scr, unsigned short red, unsigned short green,
|
||||
unsigned short blue)
|
||||
{
|
||||
WMColor *color;
|
||||
XGCValues gcv;
|
||||
XColor xcolor;
|
||||
|
||||
xcolor.red = red;
|
||||
@@ -81,11 +75,7 @@ createRGBColor(WMScreen *scr, unsigned short red, unsigned short green,
|
||||
color->refCount = 1;
|
||||
color->color = xcolor;
|
||||
color->flags.exact = 1;
|
||||
|
||||
gcv.foreground = color->color.pixel;
|
||||
gcv.graphics_exposures = False;
|
||||
color->gc = XCreateGC(scr->display, scr->rcontext->drawable,
|
||||
GCForeground|GCGraphicsExposures, &gcv);
|
||||
color->gc = NULL;
|
||||
|
||||
return color;
|
||||
}
|
||||
@@ -117,6 +107,8 @@ WMCreateNamedColor(WMScreen *scr, char *name, Bool exact)
|
||||
if (!XParseColor(scr->display, scr->colormap, name, &xcolor))
|
||||
return NULL;
|
||||
|
||||
if (scr->visual->class == TrueColor)
|
||||
exact = True;
|
||||
|
||||
if (!exact || !(color=createRGBColor(scr, xcolor.red, xcolor.green,
|
||||
xcolor.blue))) {
|
||||
@@ -146,8 +138,9 @@ WMReleaseColor(WMColor *color)
|
||||
if (color->refCount < 1) {
|
||||
XFreeColors(color->screen->display, color->screen->colormap,
|
||||
&(color->color.pixel), 1, 0);
|
||||
if (color->gc)
|
||||
XFreeGC(color->screen->display, color->gc);
|
||||
free(color);
|
||||
wfree(color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +149,8 @@ void
|
||||
WMPaintColorSwatch(WMColor *color, Drawable d, int x, int y,
|
||||
unsigned int width, unsigned int height)
|
||||
{
|
||||
XFillRectangle(color->screen->display, d, color->gc, x, y, width, height);
|
||||
XFillRectangle(color->screen->display, d, WMColorGC(color),
|
||||
x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
@@ -170,6 +164,16 @@ WMColorPixel(WMColor *color)
|
||||
GC
|
||||
WMColorGC(WMColor *color)
|
||||
{
|
||||
if (!color->gc) {
|
||||
XGCValues gcv;
|
||||
WMScreen *scr = color->screen;
|
||||
|
||||
gcv.foreground = color->color.pixel;
|
||||
gcv.graphics_exposures = False;
|
||||
color->gc = XCreateGC(scr->display, scr->rcontext->drawable,
|
||||
GCForeground|GCGraphicsExposures, &gcv);
|
||||
}
|
||||
|
||||
return color->gc;
|
||||
}
|
||||
|
||||
@@ -226,7 +230,6 @@ WMGrayColor(WMScreen *scr)
|
||||
LIGHT_STIPPLE_HEIGHT);
|
||||
|
||||
color = createRGBColor(scr, 0xffff, 0xffff, 0xffff);
|
||||
XFreeGC(scr->display, color->gc);
|
||||
|
||||
gcv.foreground = white->color.pixel;
|
||||
gcv.background = black->color.pixel;
|
||||
@@ -268,7 +271,6 @@ WMDarkGrayColor(WMScreen *scr)
|
||||
DARK_STIPPLE_HEIGHT);
|
||||
|
||||
color = createRGBColor(scr, 0, 0, 0);
|
||||
XFreeGC(scr->display, color->gc);
|
||||
|
||||
gcv.foreground = white->color.pixel;
|
||||
gcv.background = black->color.pixel;
|
||||
@@ -318,8 +320,8 @@ WMGetColorRGBDescription(WMColor *color)
|
||||
{
|
||||
char *str = wmalloc(32);
|
||||
|
||||
sprintf(str, "rgb:%4x/%4x/%4x", color->color.red, color->color.green,
|
||||
color->color.blue);
|
||||
sprintf(str, "#%02x%02x%02x", color->color.red>>8, color->color.green>>8,
|
||||
color->color.blue>>8);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
3788
WINGs/wcolorpanel.c
Normal file
3788
WINGs/wcolorpanel.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,9 @@
|
||||
#include "WINGsP.h"
|
||||
|
||||
|
||||
char *WMColorWellDidChangeNotification = "WMColorWellDidChangeNotification";
|
||||
|
||||
|
||||
typedef struct W_ColorWell {
|
||||
W_Class widgetClass;
|
||||
WMView *view;
|
||||
@@ -24,30 +27,61 @@ typedef struct W_ColorWell {
|
||||
} flags;
|
||||
} ColorWell;
|
||||
|
||||
static char *_ColorWellActivatedNotification = "_ColorWellActivatedNotification";
|
||||
|
||||
|
||||
|
||||
static void destroyColorWell(ColorWell *cPtr);
|
||||
static void paintColorWell(ColorWell *cPtr);
|
||||
|
||||
static void handleEvents(XEvent *event, void *data);
|
||||
#if 0
|
||||
|
||||
static void handleDragEvents(XEvent *event, void *data);
|
||||
#endif
|
||||
|
||||
static void handleActionEvents(XEvent *event, void *data);
|
||||
|
||||
static void resizeColorWell();
|
||||
static void willResizeColorWell();
|
||||
|
||||
W_ViewProcedureTable _ColorWellViewProcedures = {
|
||||
|
||||
|
||||
W_ViewDelegate _ColorWellViewDelegate = {
|
||||
NULL,
|
||||
resizeColorWell,
|
||||
NULL
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
willResizeColorWell
|
||||
};
|
||||
|
||||
|
||||
#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
|
||||
@@ -58,6 +92,55 @@ static WMDragSourceProcs dragProcs = {
|
||||
|
||||
|
||||
|
||||
static void
|
||||
colorChangedObserver(void *data, WMNotification *notification)
|
||||
{
|
||||
WMColorPanel *panel = (WMColorPanel*)WMGetNotificationObject(notification);
|
||||
WMColorWell *cPtr = (WMColorWell*)data;
|
||||
WMColor *color;
|
||||
|
||||
if (!cPtr->flags.active)
|
||||
return;
|
||||
|
||||
color = WMGetColorPanelColor(panel);
|
||||
|
||||
WMSetColorWellColor(cPtr, color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
updateColorCallback(void *self, void *data)
|
||||
{
|
||||
WMColorPanel *panel = (WMColorPanel*)self;
|
||||
WMColorWell *cPtr = (ColorWell*)data;
|
||||
WMColor *color;
|
||||
|
||||
color = WMGetColorPanelColor(panel);
|
||||
WMSetColorWellColor(cPtr, color);
|
||||
WMPostNotificationName(WMColorWellDidChangeNotification, cPtr, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
activatedObserver(void *data, WMNotification *notification)
|
||||
{
|
||||
/*
|
||||
WMColorWell *cPtr = (WMColorWell*)data;
|
||||
|
||||
if (!cPtr->flags.active || WMGetNotificationObject(notification) == cPtr)
|
||||
return;
|
||||
|
||||
W_SetViewBackgroundColor(cPtr->view, WMWidgetScreen(cPtr)->gray);
|
||||
paintColorWell(cPtr);
|
||||
|
||||
cPtr->flags.active = 0;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMColorWell*
|
||||
WMCreateColorWell(WMWidget *parent)
|
||||
{
|
||||
@@ -70,31 +153,54 @@ WMCreateColorWell(WMWidget *parent)
|
||||
|
||||
cPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!cPtr->view) {
|
||||
free(cPtr);
|
||||
wfree(cPtr);
|
||||
return NULL;
|
||||
}
|
||||
cPtr->view->self = cPtr;
|
||||
|
||||
cPtr->view->delegate = &_ColorWellViewDelegate;
|
||||
|
||||
cPtr->colorView = W_CreateView(cPtr->view);
|
||||
if (!cPtr->colorView) {
|
||||
W_DestroyView(cPtr->view);
|
||||
free(cPtr);
|
||||
wfree(cPtr);
|
||||
return NULL;
|
||||
}
|
||||
cPtr->colorView->self = cPtr;
|
||||
|
||||
WMCreateEventHandler(cPtr->view, ExposureMask|StructureNotifyMask
|
||||
|ClientMessageMask, handleEvents, cPtr);
|
||||
|
||||
WMCreateEventHandler(cPtr->colorView, ExposureMask, handleEvents, cPtr);
|
||||
#if 0
|
||||
WMCreateEventHandler(cPtr->colorView, ButtonPressMask|Button1MotionMask,
|
||||
handleDragEvents, cPtr);
|
||||
#endif
|
||||
|
||||
WMCreateEventHandler(cPtr->colorView, ButtonPressMask|ButtonMotionMask
|
||||
|EnterWindowMask, handleDragEvents, cPtr);
|
||||
|
||||
WMCreateEventHandler(cPtr->view, ButtonPressMask, handleActionEvents,
|
||||
cPtr);
|
||||
|
||||
cPtr->colorView->flags.mapWhenRealized = 1;
|
||||
|
||||
resizeColorWell(cPtr, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
cPtr->flags.bordered = 1;
|
||||
|
||||
W_ResizeView(cPtr->view, DEFAULT_WIDTH, DEFAULT_HEIGHT);
|
||||
|
||||
WMAddNotificationObserver(activatedObserver, cPtr,
|
||||
_ColorWellActivatedNotification, NULL);
|
||||
|
||||
cPtr->color = WMBlackColor(WMWidgetScreen(cPtr));
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -119,26 +225,44 @@ WMGetColorWellColor(WMColorWell *cPtr)
|
||||
return cPtr->color;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WSetColorWellBordered(WMColorWell *cPtr, Bool flag)
|
||||
{
|
||||
if (cPtr->flags.bordered != flag) {
|
||||
cPtr->flags.bordered = flag;
|
||||
W_ResizeView(cPtr->view, cPtr->view->size.width, cPtr->view->size.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define MIN(a,b) ((a) > (b) ? (b) : (a))
|
||||
|
||||
static void
|
||||
resizeColorWell(WMColorWell *cPtr, unsigned int width, unsigned int height)
|
||||
willResizeColorWell(W_ViewDelegate *self, WMView *view,
|
||||
unsigned int *width, unsigned int *height)
|
||||
{
|
||||
WMColorWell *cPtr = (WMColorWell*)view->self;
|
||||
int bw;
|
||||
|
||||
if (width < MIN_WIDTH)
|
||||
width = MIN_WIDTH;
|
||||
if (height < MIN_HEIGHT)
|
||||
height = MIN_HEIGHT;
|
||||
if (cPtr->flags.bordered) {
|
||||
|
||||
bw = (int)((float)MIN(width, height)*0.24);
|
||||
if (*width < MIN_WIDTH)
|
||||
*width = MIN_WIDTH;
|
||||
if (*height < MIN_HEIGHT)
|
||||
*height = MIN_HEIGHT;
|
||||
|
||||
W_ResizeView(cPtr->view, width, height);
|
||||
bw = (int)((float)MIN(*width, *height)*0.24);
|
||||
|
||||
W_ResizeView(cPtr->colorView, width-2*bw, height-2*bw);
|
||||
W_ResizeView(cPtr->colorView, *width-2*bw, *height-2*bw);
|
||||
|
||||
if (cPtr->colorView->pos.x!=bw || cPtr->colorView->pos.y!=bw)
|
||||
W_MoveView(cPtr->colorView, bw, bw);
|
||||
} else {
|
||||
W_ResizeView(cPtr->colorView, *width, *height);
|
||||
|
||||
W_MoveView(cPtr->colorView, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +308,28 @@ handleEvents(XEvent *event, void *data)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -201,7 +346,6 @@ makeDragPixmap(WMColorWell *cPtr)
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
handleDragEvents(XEvent *event, void *data)
|
||||
{
|
||||
@@ -221,37 +365,112 @@ 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);
|
||||
|
||||
|
||||
WMReleasePixmap(pixmap);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
handleActionEvents(XEvent *event, void *data)
|
||||
{
|
||||
/* WMColorWell *cPtr = (ColorWell*)data;*/
|
||||
WMColorWell *cPtr = (ColorWell*)data;
|
||||
WMScreen *scr = WMWidgetScreen(cPtr);
|
||||
WMColorPanel *cpanel;
|
||||
|
||||
if (cPtr->flags.active)
|
||||
W_SetViewBackgroundColor(cPtr->view, scr->gray);
|
||||
else
|
||||
W_SetViewBackgroundColor(cPtr->view, scr->white);
|
||||
paintColorWell(cPtr);
|
||||
|
||||
cPtr->flags.active ^= 1;
|
||||
|
||||
if (cPtr->flags.active) {
|
||||
WMPostNotificationName(_ColorWellActivatedNotification, cPtr, NULL);
|
||||
}
|
||||
cpanel = WMGetColorPanel(scr);
|
||||
|
||||
WMSetColorPanelAction(cpanel, updateColorCallback, cPtr);
|
||||
|
||||
if (cPtr->color)
|
||||
WMSetColorPanelColor(cpanel, cPtr->color);
|
||||
WMShowColorPanel(cpanel);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
destroyColorWell(ColorWell *cPtr)
|
||||
{
|
||||
WMRemoveNotificationObserver(cPtr);
|
||||
|
||||
if (cPtr->color)
|
||||
WMReleaseColor(cPtr->color);
|
||||
|
||||
free(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)
|
||||
{
|
||||
}
|
||||
|
||||
505
WINGs/wevent.c
505
WINGs/wevent.c
@@ -1,7 +1,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* This event handling stuff was based on Tk.
|
||||
* This event handling stuff was inspired on Tk.
|
||||
*/
|
||||
|
||||
#include "WINGsP.h"
|
||||
@@ -11,27 +11,31 @@
|
||||
#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
|
||||
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
# include <sys/time.h>
|
||||
# ifdef TIME_WITH_SYS_TIME
|
||||
# include <time.h>
|
||||
# endif
|
||||
#else /* ! HAVE_GETTIMEOFDAY */
|
||||
# include <time.h>
|
||||
#endif /* ! HAVE_GETTIMEOFDAY */
|
||||
#include <time.h>
|
||||
|
||||
#ifndef X_GETTIMEOFDAY
|
||||
#define X_GETTIMEOFDAY(t) gettimeofday(t, (struct timezone*)0)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
extern _WINGsConfiguration WINGsConfiguration;
|
||||
|
||||
|
||||
|
||||
typedef struct TimerHandler {
|
||||
WMCallback *callback; /* procedure to call */
|
||||
unsigned long msec; /* when to call the callback */
|
||||
struct timeval when; /* when to call the callback */
|
||||
void *clientData;
|
||||
struct TimerHandler *next;
|
||||
} TimerHandler;
|
||||
@@ -40,7 +44,6 @@ typedef struct TimerHandler {
|
||||
typedef struct IdleHandler {
|
||||
WMCallback *callback;
|
||||
void *clientData;
|
||||
struct IdleHandler *next;
|
||||
} IdleHandler;
|
||||
|
||||
|
||||
@@ -49,7 +52,6 @@ typedef struct InputHandler {
|
||||
void *clientData;
|
||||
int fd;
|
||||
int mask;
|
||||
struct InputHandler *next;
|
||||
} InputHandler;
|
||||
|
||||
|
||||
@@ -100,9 +102,9 @@ static unsigned long eventMasks[] = {
|
||||
/* queue of timer event handlers */
|
||||
static TimerHandler *timerHandler=NULL;
|
||||
|
||||
static IdleHandler *idleHandler=NULL;
|
||||
static WMBag *idleHandler=NULL;
|
||||
|
||||
static InputHandler *inputHandler=NULL;
|
||||
static WMBag *inputHandler=NULL;
|
||||
|
||||
/* hook for other toolkits or wmaker process their events */
|
||||
static WMEventHook *extraEventHandler=NULL;
|
||||
@@ -111,23 +113,27 @@ static WMEventHook *extraEventHandler=NULL;
|
||||
|
||||
#define timerPending() (timerHandler)
|
||||
|
||||
#define idlePending() (idleHandler)
|
||||
|
||||
|
||||
|
||||
/* return current time in milliseconds */
|
||||
#ifdef HAVE_GETTIMEOFDAY
|
||||
static unsigned long
|
||||
rightNow(void) {
|
||||
struct timeval tv;
|
||||
|
||||
gettimeofday(&tv, NULL);
|
||||
|
||||
return 1000L*(unsigned long)tv.tv_sec + (unsigned long)tv.tv_usec/1000L;
|
||||
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;
|
||||
}
|
||||
#else /* !HAVE_GETTIMEOFDAY */
|
||||
# define rightNow() (1000*(unsigned long)time(NULL))
|
||||
#endif /* !HAVE_GETTIMEOFDAY */
|
||||
|
||||
|
||||
WMHandlerID
|
||||
@@ -139,17 +145,18 @@ WMAddTimerHandler(int milliseconds, WMCallback *callback, void *cdata)
|
||||
if (!handler)
|
||||
return NULL;
|
||||
|
||||
handler->msec = rightNow()+milliseconds;
|
||||
rightNow(&handler->when);
|
||||
addmillisecs(&handler->when, milliseconds);
|
||||
handler->callback = callback;
|
||||
handler->clientData = cdata;
|
||||
/* insert callback in queue, sorted by time left */
|
||||
if (!timerHandler || timerHandler->msec >= handler->msec) {
|
||||
if (!timerHandler || !IS_AFTER(handler->when, timerHandler->when)) {
|
||||
/* first in the queue */
|
||||
handler->next = timerHandler;
|
||||
timerHandler = handler;
|
||||
} else {
|
||||
tmp = timerHandler;
|
||||
while (tmp->next && tmp->next->msec < handler->msec) {
|
||||
while (tmp->next && IS_AFTER(handler->when, tmp->next->when)) {
|
||||
tmp = tmp->next;
|
||||
}
|
||||
handler->next = tmp->next;
|
||||
@@ -171,13 +178,13 @@ WMDeleteTimerWithClientData(void *cdata)
|
||||
tmp = timerHandler;
|
||||
if (tmp->clientData==cdata) {
|
||||
timerHandler = tmp->next;
|
||||
free(tmp);
|
||||
wfree(tmp);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next->clientData==cdata) {
|
||||
handler = tmp->next;
|
||||
tmp->next = handler->next;
|
||||
free(handler);
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
@@ -198,12 +205,12 @@ WMDeleteTimerHandler(WMHandlerID handlerID)
|
||||
tmp = timerHandler;
|
||||
if (tmp==handler) {
|
||||
timerHandler = handler->next;
|
||||
free(handler);
|
||||
wfree(handler);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next==handler) {
|
||||
tmp->next=handler->next;
|
||||
free(handler);
|
||||
wfree(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
@@ -216,7 +223,7 @@ WMDeleteTimerHandler(WMHandlerID handlerID)
|
||||
WMHandlerID
|
||||
WMAddIdleHandler(WMCallback *callback, void *cdata)
|
||||
{
|
||||
IdleHandler *handler, *tmp;
|
||||
IdleHandler *handler;
|
||||
|
||||
handler = malloc(sizeof(IdleHandler));
|
||||
if (!handler)
|
||||
@@ -224,17 +231,11 @@ WMAddIdleHandler(WMCallback *callback, void *cdata)
|
||||
|
||||
handler->callback = callback;
|
||||
handler->clientData = cdata;
|
||||
handler->next = NULL;
|
||||
/* add callback at end of queue */
|
||||
/* add handler at end of queue */
|
||||
if (!idleHandler) {
|
||||
idleHandler = handler;
|
||||
} else {
|
||||
tmp = idleHandler;
|
||||
while (tmp->next) {
|
||||
tmp = tmp->next;
|
||||
}
|
||||
tmp->next = handler;
|
||||
idleHandler = WMCreateBag(16);
|
||||
}
|
||||
WMPutInBag(idleHandler, handler);
|
||||
|
||||
return handler;
|
||||
}
|
||||
@@ -244,24 +245,16 @@ WMAddIdleHandler(WMCallback *callback, void *cdata)
|
||||
void
|
||||
WMDeleteIdleHandler(WMHandlerID handlerID)
|
||||
{
|
||||
IdleHandler *tmp, *handler = (IdleHandler*)handlerID;
|
||||
IdleHandler *handler = (IdleHandler*)handlerID;
|
||||
int pos;
|
||||
|
||||
if (!handler || !idleHandler)
|
||||
return;
|
||||
|
||||
tmp = idleHandler;
|
||||
if (tmp == handler) {
|
||||
idleHandler = handler->next;
|
||||
free(handler);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next == handler) {
|
||||
tmp->next = handler->next;
|
||||
free(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
pos = WMGetFirstInBag(idleHandler, handler);
|
||||
if (pos != WBNotFound) {
|
||||
wfree(handler);
|
||||
WMDeleteFromBag(idleHandler, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,60 +272,66 @@ WMAddInputHandler(int fd, int condition, WMInputProc *proc, void *clientData)
|
||||
handler->callback = proc;
|
||||
handler->clientData = clientData;
|
||||
|
||||
handler->next = inputHandler;
|
||||
|
||||
inputHandler = handler;
|
||||
if (!inputHandler)
|
||||
inputHandler = WMCreateBag(16);
|
||||
WMPutInBag(inputHandler, handler);
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMDeleteInputHandler(WMHandlerID handlerID)
|
||||
{
|
||||
InputHandler *tmp, *handler = (InputHandler*)handlerID;
|
||||
InputHandler *handler = (InputHandler*)handlerID;
|
||||
int pos;
|
||||
|
||||
if (!handler || !inputHandler)
|
||||
return;
|
||||
|
||||
tmp = inputHandler;
|
||||
if (tmp == handler) {
|
||||
inputHandler = handler->next;
|
||||
free(handler);
|
||||
} else {
|
||||
while (tmp->next) {
|
||||
if (tmp->next == handler) {
|
||||
tmp->next = handler->next;
|
||||
free(handler);
|
||||
break;
|
||||
}
|
||||
tmp = tmp->next;
|
||||
}
|
||||
pos = WMGetFirstInBag(inputHandler, handler);
|
||||
if (pos != WBNotFound) {
|
||||
wfree(handler);
|
||||
WMDeleteFromBag(inputHandler, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
|
||||
static Bool
|
||||
checkIdleHandlers()
|
||||
{
|
||||
IdleHandler *handler, *tmp;
|
||||
IdleHandler *handler;
|
||||
WMBag *handlerCopy;
|
||||
WMBagIterator iter;
|
||||
|
||||
if (!idleHandler)
|
||||
return;
|
||||
|
||||
handler = idleHandler;
|
||||
|
||||
/* we will process all idleHandlers so, empty the handler list */
|
||||
idleHandler = NULL;
|
||||
|
||||
while (handler) {
|
||||
tmp = handler->next;
|
||||
(*handler->callback)(handler->clientData);
|
||||
/* remove the handler */
|
||||
free(handler);
|
||||
|
||||
handler = tmp;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -341,38 +340,52 @@ static void
|
||||
checkTimerHandlers()
|
||||
{
|
||||
TimerHandler *handler;
|
||||
unsigned long now = rightNow();
|
||||
struct timeval now;
|
||||
|
||||
if (!timerHandler || (timerHandler->msec > now))
|
||||
if (!timerHandler) {
|
||||
W_FlushASAPNotificationQueue();
|
||||
return;
|
||||
}
|
||||
|
||||
while (timerHandler && timerHandler->msec <= now) {
|
||||
rightNow(&now);
|
||||
|
||||
while (timerHandler && IS_AFTER(now, timerHandler->when)) {
|
||||
handler = timerHandler;
|
||||
timerHandler = timerHandler->next;
|
||||
handler->next = NULL;
|
||||
(*handler->callback)(handler->clientData);
|
||||
free(handler);
|
||||
wfree(handler);
|
||||
}
|
||||
|
||||
W_FlushASAPNotificationQueue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static unsigned long
|
||||
msToNextTimerEvent()
|
||||
static void
|
||||
delayUntilNextTimerEvent(struct timeval *delay)
|
||||
{
|
||||
unsigned long now;
|
||||
struct timeval now;
|
||||
|
||||
if (!timerHandler) {
|
||||
/* The return value of this function is only valid if there _are_
|
||||
timers active. */
|
||||
return 0;
|
||||
delay->tv_sec = 0;
|
||||
delay->tv_usec = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
now = rightNow();
|
||||
if (timerHandler->msec < now) {
|
||||
return 0;
|
||||
rightNow(&now);
|
||||
if (IS_AFTER(now, timerHandler->when)) {
|
||||
delay->tv_sec = 0;
|
||||
delay->tv_usec = 0;
|
||||
} else {
|
||||
return timerHandler->msec - now;
|
||||
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--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,38 +403,27 @@ 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;
|
||||
WMBagIterator 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_BAG(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;
|
||||
}
|
||||
}
|
||||
|
||||
WMPutInBag(view->eventHandlers, handler);
|
||||
}
|
||||
/* select events for window */
|
||||
handler->eventMask = mask;
|
||||
handler->eventMask = eventMask;
|
||||
handler->proc = eventProc;
|
||||
handler->clientData = clientData;
|
||||
}
|
||||
@@ -437,32 +439,25 @@ void
|
||||
WMDeleteEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||
void *clientData)
|
||||
{
|
||||
W_EventHandler *handler, *ptr, *pptr;
|
||||
|
||||
ptr = view->handlerList;
|
||||
W_EventHandler *handler, *ptr;
|
||||
WMBagIterator iter;
|
||||
|
||||
handler = NULL;
|
||||
pptr = NULL;
|
||||
|
||||
while (ptr!=NULL) {
|
||||
WM_ITERATE_BAG(view->eventHandlers, ptr, iter) {
|
||||
if (ptr->eventMask == mask && ptr->proc == eventProc
|
||||
&& ptr->clientData == clientData) {
|
||||
handler = ptr;
|
||||
break;
|
||||
}
|
||||
pptr = ptr;
|
||||
ptr = ptr->nextHandler;
|
||||
}
|
||||
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
if (!pptr) {
|
||||
view->handlerList = handler->nextHandler;
|
||||
} else {
|
||||
pptr->nextHandler = handler->nextHandler;
|
||||
}
|
||||
free(handler);
|
||||
WMRemoveFromBag(view->eventHandlers, handler);
|
||||
|
||||
wfree(handler);
|
||||
}
|
||||
|
||||
|
||||
@@ -470,14 +465,11 @@ WMDeleteEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
|
||||
void
|
||||
W_CleanUpEvents(WMView *view)
|
||||
{
|
||||
W_EventHandler *ptr, *nptr;
|
||||
W_EventHandler *ptr;
|
||||
WMBagIterator iter;
|
||||
|
||||
ptr = view->handlerList;
|
||||
|
||||
while (ptr!=NULL) {
|
||||
nptr = ptr->nextHandler;
|
||||
free(ptr);
|
||||
ptr = nptr;
|
||||
WM_ITERATE_BAG(view->eventHandlers, ptr, iter) {
|
||||
wfree(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,18 +508,17 @@ void
|
||||
W_CallDestroyHandlers(W_View *view)
|
||||
{
|
||||
XEvent event;
|
||||
WMBagIterator 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_BAG(view->eventHandlers, hPtr, iter) {
|
||||
if (hPtr->eventMask & StructureNotifyMask) {
|
||||
(*hPtr->proc)(&event, hPtr->clientData);
|
||||
}
|
||||
|
||||
hPtr = hPtr->nextHandler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -539,6 +530,7 @@ WMHandleEvent(XEvent *event)
|
||||
W_View *view, *vPtr, *toplevel;
|
||||
unsigned long mask;
|
||||
Window window;
|
||||
WMBagIterator iter;
|
||||
|
||||
if (event->type == MappingNotify) {
|
||||
XRefreshKeyboardMapping(&event->xmapping);
|
||||
@@ -557,6 +549,7 @@ WMHandleEvent(XEvent *event)
|
||||
}
|
||||
}
|
||||
view = W_GetViewForXWindow(event->xany.display, window);
|
||||
|
||||
if (!view) {
|
||||
if (extraEventHandler)
|
||||
(extraEventHandler)(event);
|
||||
@@ -568,6 +561,16 @@ WMHandleEvent(XEvent *event)
|
||||
|
||||
toplevel = W_TopLevelOfView(view);
|
||||
|
||||
if (event->type == SelectionNotify || event->type == SelectionClear
|
||||
|| event->type == SelectionRequest) {
|
||||
/* handle selection related events */
|
||||
W_HandleSelectionEvent(event);
|
||||
|
||||
} else if (event->type == ClientMessage) {
|
||||
|
||||
W_HandleDNDClientMessage(toplevel, &event->xclient);
|
||||
}
|
||||
|
||||
/* if it's a key event, redispatch it to the focused control */
|
||||
if (mask & (KeyPressMask|KeyReleaseMask)) {
|
||||
W_View *focused = W_FocusedViewOfToplevel(toplevel);
|
||||
@@ -608,39 +611,34 @@ WMHandleEvent(XEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
/* do balloon stuffs */
|
||||
if (event->type == EnterNotify)
|
||||
W_BalloonHandleEnterView(view);
|
||||
else if (event->type == LeaveNotify)
|
||||
W_BalloonHandleLeaveView(view);
|
||||
|
||||
/* This is a hack. It will make the panel be secure while
|
||||
* the event handlers are handled, as some event handler
|
||||
* might destroy the widget. */
|
||||
W_RetainView(toplevel);
|
||||
|
||||
hPtr = view->handlerList;
|
||||
|
||||
while (hPtr!=NULL) {
|
||||
W_EventHandler *tmp;
|
||||
|
||||
tmp = hPtr->nextHandler;
|
||||
|
||||
WM_ITERATE_BAG(view->eventHandlers, hPtr, iter) {
|
||||
if ((hPtr->eventMask & mask)) {
|
||||
(*hPtr->proc)(event, hPtr->clientData);
|
||||
}
|
||||
|
||||
hPtr = tmp;
|
||||
}
|
||||
|
||||
/* pass the event to the top level window of the widget */
|
||||
if (view->parent!=NULL) {
|
||||
/* TODO: change this to a responder chain */
|
||||
if (view->parent != NULL) {
|
||||
vPtr = view;
|
||||
while (vPtr->parent!=NULL)
|
||||
while (vPtr->parent != NULL)
|
||||
vPtr = vPtr->parent;
|
||||
|
||||
hPtr = vPtr->handlerList;
|
||||
|
||||
while (hPtr!=NULL) {
|
||||
|
||||
WM_ITERATE_BAG(vPtr->eventHandlers, hPtr, iter) {
|
||||
if (hPtr->eventMask & mask) {
|
||||
(*hPtr->proc)(event, hPtr->clientData);
|
||||
}
|
||||
hPtr = hPtr->nextHandler;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -690,16 +688,113 @@ WMIsDoubleClick(XEvent *event)
|
||||
Bool
|
||||
W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
||||
{
|
||||
#ifndef HAVE_SELECT
|
||||
#error This_system_does_not_have_select(2)_and_is_not_supported
|
||||
#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
|
||||
unsigned long milliseconds;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
int maxfd, nfds, i;
|
||||
int count;
|
||||
InputHandler *handler = inputHandler;
|
||||
InputHandler *handler;
|
||||
|
||||
FD_ZERO(&rset);
|
||||
FD_ZERO(&wset);
|
||||
@@ -708,7 +803,13 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
||||
FD_SET(ConnectionNumber(dpy), &rset);
|
||||
maxfd = ConnectionNumber(dpy);
|
||||
|
||||
while (handler) {
|
||||
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);
|
||||
|
||||
@@ -720,8 +821,6 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
||||
|
||||
if (maxfd < handler->fd)
|
||||
maxfd = handler->fd;
|
||||
|
||||
handler = handler->next;
|
||||
}
|
||||
|
||||
|
||||
@@ -730,9 +829,7 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
||||
* next timer expires.
|
||||
*/
|
||||
if (timerPending()) {
|
||||
milliseconds = msToNextTimerEvent();
|
||||
timeout.tv_sec = milliseconds / 1000;
|
||||
timeout.tv_usec = (milliseconds % 1000) * 1000;
|
||||
delayUntilNextTimerEvent(&timeout);
|
||||
timeoutPtr = &timeout;
|
||||
} else {
|
||||
timeoutPtr = (struct timeval*)0;
|
||||
@@ -749,56 +846,64 @@ W_WaitForEvent(Display *dpy, unsigned long xeventmask)
|
||||
return True;
|
||||
}
|
||||
}
|
||||
/* TODO: port to poll() */
|
||||
|
||||
count = select(1 + maxfd, &rset, &wset, &eset, timeoutPtr);
|
||||
|
||||
if (count > 0) {
|
||||
handler = inputHandler;
|
||||
if (count>0 && nfds>0) {
|
||||
WMBag *handlerCopy = WMCreateBag(nfds);
|
||||
|
||||
while (handler) {
|
||||
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 (FD_ISSET(handler->fd, &rset))
|
||||
if ((handler->mask & WIReadMask) && FD_ISSET(handler->fd, &rset))
|
||||
mask |= WIReadMask;
|
||||
|
||||
if (FD_ISSET(handler->fd, &wset))
|
||||
if ((handler->mask & WIWriteMask) && FD_ISSET(handler->fd, &wset))
|
||||
mask |= WIWriteMask;
|
||||
|
||||
if (FD_ISSET(handler->fd, &eset))
|
||||
if ((handler->mask & WIExceptMask) && FD_ISSET(handler->fd, &eset))
|
||||
mask |= WIExceptMask;
|
||||
|
||||
if (mask!=0 && handler->callback) {
|
||||
(*handler->callback)(handler->fd, mask,
|
||||
handler->clientData);
|
||||
}
|
||||
}
|
||||
|
||||
handler = handler->next;
|
||||
}
|
||||
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 */
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMNextEvent(Display *dpy, XEvent *event)
|
||||
{
|
||||
/* Check any expired timers */
|
||||
if (timerPending()) {
|
||||
checkTimerHandlers();
|
||||
}
|
||||
|
||||
while (XPending(dpy) == 0) {
|
||||
/* Do idle stuff */
|
||||
/* Do idle and timer stuff while there are no timer or X events */
|
||||
while (!XPending(dpy) && idlePending()) {
|
||||
if (idlePending())
|
||||
checkIdleHandlers();
|
||||
while (!XPending(dpy) && checkIdleHandlers()) {
|
||||
/* dispatch timer events */
|
||||
if (timerPending())
|
||||
checkTimerHandlers();
|
||||
}
|
||||
|
||||
@@ -811,10 +916,8 @@ WMNextEvent(Display *dpy, XEvent *event)
|
||||
W_WaitForEvent(dpy, 0);
|
||||
|
||||
/* Check any expired timers */
|
||||
if (timerPending()) {
|
||||
checkTimerHandlers();
|
||||
}
|
||||
}
|
||||
|
||||
XNextEvent(dpy, event);
|
||||
}
|
||||
@@ -830,8 +933,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||
|
||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||
/* Do idle stuff while there are no timer or X events */
|
||||
while (idlePending()) {
|
||||
checkIdleHandlers();
|
||||
while (checkIdleHandlers()) {
|
||||
if (XCheckMaskEvent(dpy, mask, event))
|
||||
return;
|
||||
}
|
||||
@@ -841,9 +943,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||
* next timer expires.
|
||||
*/
|
||||
if (timerPending()) {
|
||||
milliseconds = msToNextTimerEvent();
|
||||
timeout.tv_sec = milliseconds / 1000;
|
||||
timeout.tv_usec = (milliseconds % 1000) * 1000;
|
||||
delayUntilNextTimerEvent(&timeout);
|
||||
timeoutOrInfty = &timeout;
|
||||
} else {
|
||||
timeoutOrInfty = (struct timeval*)0;
|
||||
@@ -859,10 +959,8 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||
timeoutOrInfty);
|
||||
|
||||
/* Check any expired timers */
|
||||
if (timerPending()) {
|
||||
checkTimerHandlers();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 1
|
||||
@@ -878,8 +976,7 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||
{
|
||||
while (!XCheckMaskEvent(dpy, mask, event)) {
|
||||
/* Do idle stuff while there are no timer or X events */
|
||||
while (idlePending()) {
|
||||
checkIdleHandlers();
|
||||
while (checkIdleHandlers()) {
|
||||
if (XCheckMaskEvent(dpy, mask, event))
|
||||
return;
|
||||
}
|
||||
@@ -888,10 +985,8 @@ WMMaskEvent(Display *dpy, long mask, XEvent *event)
|
||||
W_WaitForEvent(dpy, mask);
|
||||
|
||||
/* Check any expired timers */
|
||||
if (timerPending()) {
|
||||
checkTimerHandlers();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#include "WINGsP.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -9,11 +6,13 @@
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 1024
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct W_FilePanel {
|
||||
WMWindow *win;
|
||||
|
||||
@@ -29,6 +28,12 @@ typedef struct W_FilePanel {
|
||||
WMButton *cancelButton;
|
||||
|
||||
WMButton *homeButton;
|
||||
WMButton *trashcanButton;
|
||||
WMButton *createDirButton;
|
||||
WMButton *disketteButton;
|
||||
WMButton *unmountButton;
|
||||
|
||||
WMView *accessoryView;
|
||||
|
||||
WMTextField *fileField;
|
||||
|
||||
@@ -41,44 +46,75 @@ typedef struct W_FilePanel {
|
||||
unsigned int filtered:1;
|
||||
unsigned int canChooseFiles:1;
|
||||
unsigned int canChooseDirectories:1;
|
||||
unsigned int autoCompletion:1;
|
||||
unsigned int showAllFiles:1;
|
||||
unsigned int canFreeFileTypes:1;
|
||||
unsigned int fileMustExist:1;
|
||||
unsigned int panelType:1;
|
||||
} flags;
|
||||
} W_FilePanel;
|
||||
|
||||
|
||||
#define PWIDTH 320
|
||||
/* Type of panel */
|
||||
#define WP_OPEN 0
|
||||
#define WP_SAVE 1
|
||||
|
||||
#define PWIDTH 330
|
||||
#define PHEIGHT 360
|
||||
|
||||
static void listDirectoryOnColumn(WMFilePanel *panel, int column, char *path);
|
||||
static void browserClick();
|
||||
static void browserDClick();
|
||||
|
||||
static void fillColumn(WMBrowser *bPtr, int column);
|
||||
static void fillColumn(WMBrowserDelegate *self, WMBrowser *bPtr, int column,
|
||||
WMList *list);
|
||||
|
||||
static void deleteFile();
|
||||
|
||||
static void createDir();
|
||||
|
||||
static void goHome();
|
||||
|
||||
static void goFloppy();
|
||||
|
||||
static void goUnmount();
|
||||
|
||||
static void buttonClick();
|
||||
|
||||
static char *getCurrentFileName(WMFilePanel *panel);
|
||||
|
||||
static void handleEvents(XEvent *event, void *data);
|
||||
|
||||
|
||||
|
||||
static WMBrowserDelegate browserDelegate = {
|
||||
NULL, /* data */
|
||||
fillColumn, /* createRowsForColumn */
|
||||
NULL, /* titleOfColumn */
|
||||
NULL, /* didScroll */
|
||||
NULL /* willScroll */
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
closestListItem(WMList *list, char *text)
|
||||
closestListItem(WMList *list, char *text, Bool exact)
|
||||
{
|
||||
WMListItem *item = WMGetListItem(list, 0);
|
||||
int i = 0;
|
||||
int len = strlen(text);
|
||||
WMListItem *item;
|
||||
WMArray *items = WMGetListItems(list);
|
||||
int i, len = strlen(text);
|
||||
|
||||
if (len==0)
|
||||
return -1;
|
||||
|
||||
while (item) {
|
||||
if (strlen(item->text) >= len && strncmp(item->text, text, len)==0) {
|
||||
for(i=0; i<WMGetArrayItemCount(items); i++) {
|
||||
item = WMGetFromArray(items, i);
|
||||
if (strlen(item->text) >= len &&
|
||||
((exact && strcmp(item->text, text)==0) ||
|
||||
(!exact && strncmp(item->text, text, len)==0))) {
|
||||
return i;
|
||||
}
|
||||
item = item->nextPtr;
|
||||
i++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -90,19 +126,40 @@ textChangedObserver(void *observerData, WMNotification *notification)
|
||||
char *text;
|
||||
WMList *list;
|
||||
int col = WMGetBrowserNumberOfColumns(panel->browser) - 1;
|
||||
int i;
|
||||
int i, textEvent;
|
||||
|
||||
list = WMGetBrowserListInColumn(panel->browser, col);
|
||||
if (!list)
|
||||
if (!(list = WMGetBrowserListInColumn(panel->browser, col)))
|
||||
return;
|
||||
|
||||
text = WMGetTextFieldText(panel->fileField);
|
||||
textEvent = (int)WMGetNotificationClientData(notification);
|
||||
|
||||
if (panel->flags.autoCompletion && textEvent!=WMDeleteTextEvent)
|
||||
i = closestListItem(list, text, False);
|
||||
else
|
||||
i = closestListItem(list, text, True);
|
||||
|
||||
i = closestListItem(list, text);
|
||||
WMSelectListItem(list, i);
|
||||
if (i>=0)
|
||||
WMSetListPosition(list, i);
|
||||
if (i>=0 && panel->flags.autoCompletion) {
|
||||
WMListItem *item = WMGetListItem(list, i);
|
||||
int textLen = strlen(text), itemTextLen = strlen(item->text);
|
||||
int visibleItems = WMWidgetHeight(list)/WMGetListItemHeight(list);
|
||||
|
||||
free(text);
|
||||
WMSetListPosition(list, i - visibleItems/2);
|
||||
|
||||
if (textEvent!=WMDeleteTextEvent) {
|
||||
WMRange range;
|
||||
|
||||
WMInsertTextFieldText(panel->fileField, &item->text[textLen],
|
||||
textLen);
|
||||
range.position = textLen;
|
||||
range.count = itemTextLen - textLen;
|
||||
WMSelectTextFieldRange(panel->fileField, range);
|
||||
/*WMSetTextFieldCursorPosition(panel->fileField, itemTextLen);*/
|
||||
}
|
||||
}
|
||||
|
||||
wfree(text);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +189,11 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
|
||||
WMResizeWidget(fPtr->win, PWIDTH, PHEIGHT);
|
||||
WMSetWindowTitle(fPtr->win, "");
|
||||
|
||||
WMCreateEventHandler(WMWidgetView(fPtr->win), StructureNotifyMask,
|
||||
handleEvents, fPtr);
|
||||
WMSetWindowMinSize(fPtr->win, PWIDTH, PHEIGHT);
|
||||
|
||||
|
||||
fPtr->iconLabel = WMCreateLabel(fPtr->win);
|
||||
WMResizeWidget(fPtr->iconLabel, 64, 64);
|
||||
WMMoveWidget(fPtr->iconLabel, 0, 0);
|
||||
@@ -152,9 +214,12 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
|
||||
WMSetFrameRelief(fPtr->line, WRGroove);
|
||||
|
||||
fPtr->browser = WMCreateBrowser(fPtr->win);
|
||||
WMSetBrowserFillColumnProc(fPtr->browser, fillColumn);
|
||||
WMSetBrowserAllowEmptySelection(fPtr->browser, True);
|
||||
WMSetBrowserDelegate(fPtr->browser, &browserDelegate);
|
||||
WMSetBrowserAction(fPtr->browser, browserClick, fPtr);
|
||||
WMSetBrowserDoubleAction(fPtr->browser, browserDClick, fPtr);
|
||||
WMMoveWidget(fPtr->browser, 7, 72);
|
||||
WMResizeWidget(fPtr->browser, PWIDTH-14,200);
|
||||
WMHangData(fPtr->browser, fPtr);
|
||||
|
||||
fPtr->nameLabel = WMCreateLabel(fPtr->win);
|
||||
@@ -173,8 +238,8 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
|
||||
fPtr->fileField);
|
||||
|
||||
fPtr->okButton = WMCreateCommandButton(fPtr->win);
|
||||
WMMoveWidget(fPtr->okButton, 230, 325);
|
||||
WMResizeWidget(fPtr->okButton, 80, 28);
|
||||
WMMoveWidget(fPtr->okButton, 245, 325);
|
||||
WMResizeWidget(fPtr->okButton, 75, 28);
|
||||
WMSetButtonText(fPtr->okButton, "OK");
|
||||
WMSetButtonImage(fPtr->okButton, scrPtr->buttonArrow);
|
||||
WMSetButtonAltImage(fPtr->okButton, scrPtr->pushedButtonArrow);
|
||||
@@ -182,25 +247,68 @@ makeFilePanel(WMScreen *scrPtr, char *name, char *title)
|
||||
WMSetButtonAction(fPtr->okButton, buttonClick, fPtr);
|
||||
|
||||
fPtr->cancelButton = WMCreateCommandButton(fPtr->win);
|
||||
WMMoveWidget(fPtr->cancelButton, 140, 325);
|
||||
WMResizeWidget(fPtr->cancelButton, 80, 28);
|
||||
WMMoveWidget(fPtr->cancelButton, 165, 325);
|
||||
WMResizeWidget(fPtr->cancelButton, 75, 28);
|
||||
WMSetButtonText(fPtr->cancelButton, "Cancel");
|
||||
WMSetButtonAction(fPtr->cancelButton, buttonClick, fPtr);
|
||||
|
||||
fPtr->trashcanButton = WMCreateCommandButton(fPtr->win);
|
||||
WMMoveWidget(fPtr->trashcanButton, 7, 325);
|
||||
WMResizeWidget(fPtr->trashcanButton, 28, 28);
|
||||
WMSetButtonImagePosition(fPtr->trashcanButton, WIPImageOnly);
|
||||
WMSetButtonImage(fPtr->trashcanButton, scrPtr->trashcanIcon);
|
||||
WMSetButtonAltImage(fPtr->trashcanButton, scrPtr->altTrashcanIcon);
|
||||
WMSetButtonAction(fPtr->trashcanButton, deleteFile, fPtr);
|
||||
|
||||
fPtr->createDirButton = WMCreateCommandButton(fPtr->win);
|
||||
WMMoveWidget(fPtr->createDirButton, 37, 325);
|
||||
WMResizeWidget(fPtr->createDirButton, 28, 28);
|
||||
WMSetButtonImagePosition(fPtr->createDirButton, WIPImageOnly);
|
||||
WMSetButtonImage(fPtr->createDirButton, scrPtr->createDirIcon);
|
||||
WMSetButtonAltImage(fPtr->createDirButton, scrPtr->altCreateDirIcon);
|
||||
WMSetButtonAction(fPtr->createDirButton, createDir, fPtr);
|
||||
|
||||
fPtr->homeButton = WMCreateCommandButton(fPtr->win);
|
||||
WMMoveWidget(fPtr->homeButton, 55, 325);
|
||||
WMMoveWidget(fPtr->homeButton, 67, 325);
|
||||
WMResizeWidget(fPtr->homeButton, 28, 28);
|
||||
WMSetButtonImagePosition(fPtr->homeButton, WIPImageOnly);
|
||||
WMSetButtonImage(fPtr->homeButton, scrPtr->homeIcon);
|
||||
WMSetButtonAltImage(fPtr->homeButton, scrPtr->altHomeIcon);
|
||||
WMSetButtonAction(fPtr->homeButton, goHome, fPtr);
|
||||
|
||||
fPtr->disketteButton = WMCreateCommandButton(fPtr->win);
|
||||
WMMoveWidget(fPtr->disketteButton, 97, 325);
|
||||
WMResizeWidget(fPtr->disketteButton, 28, 28);
|
||||
WMSetButtonImagePosition(fPtr->disketteButton, WIPImageOnly);
|
||||
WMSetButtonImage(fPtr->disketteButton, scrPtr->disketteIcon);
|
||||
WMSetButtonAltImage(fPtr->disketteButton, scrPtr->altDisketteIcon);
|
||||
WMSetButtonAction(fPtr->disketteButton, goFloppy, fPtr);
|
||||
|
||||
fPtr->unmountButton = WMCreateCommandButton(fPtr->win);
|
||||
WMMoveWidget(fPtr->unmountButton, 127, 325);
|
||||
WMResizeWidget(fPtr->unmountButton, 28, 28);
|
||||
WMSetButtonImagePosition(fPtr->unmountButton, WIPImageOnly);
|
||||
WMSetButtonImage(fPtr->unmountButton, scrPtr->unmountIcon);
|
||||
WMSetButtonAltImage(fPtr->unmountButton, scrPtr->altUnmountIcon);
|
||||
WMSetButtonAction(fPtr->unmountButton, goUnmount, fPtr);
|
||||
WMSetButtonEnabled(fPtr->unmountButton, False);
|
||||
|
||||
|
||||
WMRealizeWidget(fPtr->win);
|
||||
WMMapSubwidgets(fPtr->win);
|
||||
|
||||
WMSetFocusToWidget(fPtr->fileField);
|
||||
WMSetTextFieldCursorPosition(fPtr->fileField, 0);
|
||||
|
||||
WMLoadBrowserColumnZero(fPtr->browser);
|
||||
|
||||
WMSetWindowInitialPosition(fPtr->win,
|
||||
(scrPtr->rootView->size.width - WMWidgetWidth(fPtr->win))/2,
|
||||
(scrPtr->rootView->size.height - WMWidgetHeight(fPtr->win))/2);
|
||||
|
||||
fPtr->flags.canChooseFiles = 1;
|
||||
fPtr->flags.canChooseDirectories = 1;
|
||||
fPtr->flags.autoCompletion = 1;
|
||||
|
||||
return fPtr;
|
||||
}
|
||||
@@ -216,6 +324,7 @@ WMGetOpenPanel(WMScreen *scrPtr)
|
||||
|
||||
panel = makeFilePanel(scrPtr, "openFilePanel", "Open");
|
||||
panel->flags.fileMustExist = 1;
|
||||
panel->flags.panelType = WP_OPEN;
|
||||
|
||||
scrPtr->sharedOpenPanel = panel;
|
||||
|
||||
@@ -233,6 +342,7 @@ WMGetSavePanel(WMScreen *scrPtr)
|
||||
|
||||
panel = makeFilePanel(scrPtr, "saveFilePanel", "Save");
|
||||
panel->flags.fileMustExist = 0;
|
||||
panel->flags.panelType = WP_SAVE;
|
||||
|
||||
scrPtr->sharedSavePanel = panel;
|
||||
|
||||
@@ -243,111 +353,122 @@ WMGetSavePanel(WMScreen *scrPtr)
|
||||
void
|
||||
WMFreeFilePanel(WMFilePanel *panel)
|
||||
{
|
||||
if (panel == WMWidgetScreen(panel->win)->sharedSavePanel) {
|
||||
WMWidgetScreen(panel->win)->sharedSavePanel = NULL;
|
||||
}
|
||||
if (panel == WMWidgetScreen(panel->win)->sharedOpenPanel) {
|
||||
WMWidgetScreen(panel->win)->sharedOpenPanel = NULL;
|
||||
}
|
||||
WMRemoveNotificationObserver(panel);
|
||||
WMUnmapWidget(panel->win);
|
||||
WMDestroyWidget(panel->win);
|
||||
free(panel);
|
||||
wfree(panel);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMRunModalSavePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
|
||||
char *path, char *name)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||
XEvent event;
|
||||
|
||||
WMChangePanelOwner(panel->win, owner);
|
||||
|
||||
WMSetFilePanelDirectory(panel, path);
|
||||
|
||||
panel->flags.done = 0;
|
||||
panel->fileTypes = NULL;
|
||||
|
||||
panel->flags.filtered = 0;
|
||||
|
||||
WMMapWidget(panel->win);
|
||||
|
||||
while (!panel->flags.done) {
|
||||
WMNextEvent(scr->display, &event);
|
||||
WMHandleEvent(&event);
|
||||
}
|
||||
|
||||
WMCloseWindow(panel->win);
|
||||
|
||||
return (panel->flags.canceled ? False : True);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int
|
||||
WMRunModalOpenPanelForDirectory(WMFilePanel *panel, WMWindow *owner,
|
||||
WMRunModalFilePanelForDirectory(WMFilePanel *panel, WMWindow *owner,
|
||||
char *path, char *name, char **fileTypes)
|
||||
{
|
||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||
XEvent event;
|
||||
|
||||
if (name && !owner) {
|
||||
WMSetWindowTitle(panel->win, name);
|
||||
}
|
||||
|
||||
WMChangePanelOwner(panel->win, owner);
|
||||
|
||||
WMSetFilePanelDirectory(panel, path);
|
||||
|
||||
panel->flags.done = 0;
|
||||
|
||||
switch(panel->flags.panelType) {
|
||||
case WP_OPEN:
|
||||
if (fileTypes)
|
||||
panel->flags.filtered = 1;
|
||||
panel->fileTypes = fileTypes;
|
||||
if (name == NULL)
|
||||
name = "Open";
|
||||
break;
|
||||
case WP_SAVE:
|
||||
panel->fileTypes = NULL;
|
||||
panel->flags.filtered = 0;
|
||||
if (name == NULL)
|
||||
name = "Save";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
WMSetLabelText(panel->titleLabel, name);
|
||||
|
||||
scr->modalView = W_VIEW(panel->win);
|
||||
WMMapWidget(panel->win);
|
||||
|
||||
scr->modal = 1;
|
||||
while (!panel->flags.done) {
|
||||
WMNextEvent(scr->display, &event);
|
||||
WMHandleEvent(&event);
|
||||
}
|
||||
scr->modal = 0;
|
||||
|
||||
/* Must withdraw window because the next time we map
|
||||
* it, it might have a different transient owner.
|
||||
*/
|
||||
WMCloseWindow(panel->win);
|
||||
|
||||
return (panel->flags.canceled ? False : True);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMSetFilePanelDirectory(WMFilePanel *panel, char *path)
|
||||
{
|
||||
WMList *list;
|
||||
WMListItem *item;
|
||||
int col;
|
||||
char *rest;
|
||||
|
||||
WMSetBrowserPath(panel->browser, path);
|
||||
col = WMGetBrowserNumberOfColumns(panel->browser) - 1;
|
||||
rest = WMSetBrowserPath(panel->browser, path);
|
||||
if (strcmp(path, "/")==0)
|
||||
rest = NULL;
|
||||
|
||||
col = WMGetBrowserSelectedColumn(panel->browser);
|
||||
list = WMGetBrowserListInColumn(panel->browser, col);
|
||||
if (list && (item = WMGetListSelectedItem(list))) {
|
||||
if (item->isBranch) {
|
||||
WMSetTextFieldText(panel->fileField, NULL);
|
||||
WMSetTextFieldText(panel->fileField, rest);
|
||||
} else {
|
||||
WMSetTextFieldText(panel->fileField, item->text);
|
||||
}
|
||||
} else {
|
||||
WMSetTextFieldText(panel->fileField, path);
|
||||
WMSetTextFieldText(panel->fileField, rest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetFilePanelCanChooseDirectories(WMFilePanel *panel, int flag)
|
||||
WMSetFilePanelCanChooseDirectories(WMFilePanel *panel, Bool flag)
|
||||
{
|
||||
panel->flags.canChooseDirectories = flag;
|
||||
}
|
||||
|
||||
void
|
||||
WMSetFilePanelCanChooseFiles(WMFilePanel *panel, int flag)
|
||||
WMSetFilePanelCanChooseFiles(WMFilePanel *panel, Bool flag)
|
||||
{
|
||||
panel->flags.canChooseFiles = flag;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetFilePanelAutoCompletion(WMFilePanel *panel, Bool flag)
|
||||
{
|
||||
panel->flags.autoCompletion = flag;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
WMGetFilePanelFileName(WMFilePanel *panel)
|
||||
{
|
||||
@@ -355,6 +476,28 @@ WMGetFilePanelFileName(WMFilePanel *panel)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetFilePanelAccessoryView(WMFilePanel *panel, WMView *view)
|
||||
{
|
||||
WMView *v;
|
||||
|
||||
panel->accessoryView = view;
|
||||
|
||||
v = WMWidgetView(panel->win);
|
||||
|
||||
W_ReparentView(view, v, 0, 0);
|
||||
|
||||
W_MoveView(view, (v->size.width - v->size.width)/2, 300);
|
||||
}
|
||||
|
||||
|
||||
WMView*
|
||||
WMGetFilePanelAccessoryView(WMFilePanel *panel)
|
||||
{
|
||||
return panel->accessoryView;
|
||||
}
|
||||
|
||||
|
||||
static char*
|
||||
get_name_from_path(char *path)
|
||||
{
|
||||
@@ -385,6 +528,19 @@ filterFileName(WMFilePanel *panel, char *file, Bool isDirectory)
|
||||
}
|
||||
|
||||
|
||||
#define CAST(item) (*((WMListItem**)item))
|
||||
static int
|
||||
comparer(const void *a, const void *b)
|
||||
{
|
||||
if (CAST(a)->isBranch == CAST(b)->isBranch)
|
||||
return (strcmp(CAST(a)->text, CAST(b)->text));
|
||||
if (CAST(a)->isBranch)
|
||||
return (-1);
|
||||
return (1);
|
||||
}
|
||||
#undef CAST
|
||||
|
||||
|
||||
static void
|
||||
listDirectoryOnColumn(WMFilePanel *panel, int column, char *path)
|
||||
{
|
||||
@@ -431,17 +587,17 @@ listDirectoryOnColumn(WMFilePanel *panel, int column, char *path)
|
||||
isDirectory = S_ISDIR(stat_buf.st_mode);
|
||||
|
||||
if (filterFileName(panel, dentry->d_name, isDirectory))
|
||||
WMAddSortedBrowserItem(bPtr, column, dentry->d_name,
|
||||
isDirectory);
|
||||
WMInsertBrowserItem(bPtr, column, -1, dentry->d_name, isDirectory);
|
||||
}
|
||||
}
|
||||
WMSortBrowserColumnWithComparer(bPtr, column, comparer);
|
||||
|
||||
closedir(dir);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fillColumn(WMBrowser *bPtr, int column)
|
||||
fillColumn(WMBrowserDelegate *self, WMBrowser *bPtr, int column, WMList *list)
|
||||
{
|
||||
char *path;
|
||||
WMFilePanel *panel;
|
||||
@@ -454,10 +610,15 @@ fillColumn(WMBrowser *bPtr, int column)
|
||||
|
||||
panel = WMGetHangedData(bPtr);
|
||||
listDirectoryOnColumn(panel, column, path);
|
||||
free(path);
|
||||
wfree(path);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
browserDClick(WMBrowser *bPtr, WMFilePanel *panel)
|
||||
{
|
||||
WMPerformButtonClick(panel->okButton);
|
||||
}
|
||||
|
||||
static void
|
||||
browserClick(WMBrowser *bPtr, WMFilePanel *panel)
|
||||
@@ -473,6 +634,233 @@ browserClick(WMBrowser *bPtr, WMFilePanel *panel)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
showError(WMScreen *scr, WMWindow *owner, char *s, char *file)
|
||||
{
|
||||
char *errStr;
|
||||
|
||||
if (file) {
|
||||
errStr = wmalloc(strlen(file)+strlen(s));
|
||||
sprintf(errStr, s, file);
|
||||
} else {
|
||||
errStr = wstrdup(s);
|
||||
}
|
||||
WMRunAlertPanel(scr, owner, "Error", errStr, "OK", NULL, NULL);
|
||||
wfree(errStr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
createDir(WMButton *bPre, WMFilePanel *panel)
|
||||
{
|
||||
char *directory_name;
|
||||
char *directory;
|
||||
char *file;
|
||||
char *s;
|
||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||
WMInputPanel *_panel;
|
||||
|
||||
_panel = WMCreateInputPanel(scr, panel->win,
|
||||
"Create Directory", "Enter directory name", "", "OK", "Cancel");
|
||||
scr->modalView = W_VIEW(_panel->win);
|
||||
WMMapWidget(_panel->win);
|
||||
scr->modal = 1;
|
||||
while (!_panel->done || WMScreenPending(scr)) {
|
||||
XEvent event;
|
||||
WMNextEvent(scr->display, &event);
|
||||
WMHandleEvent(&event);
|
||||
}
|
||||
scr->modal = 0;
|
||||
|
||||
if (_panel->result == WAPRDefault)
|
||||
directory_name = WMGetTextFieldText(_panel->text);
|
||||
else {
|
||||
WMDestroyInputPanel(_panel);
|
||||
return;
|
||||
}
|
||||
|
||||
WMDestroyInputPanel(_panel);
|
||||
|
||||
directory = getCurrentFileName(panel);
|
||||
{
|
||||
char *s = strrchr(directory,'/');
|
||||
if (s) s[1] = 0;
|
||||
}
|
||||
|
||||
if (directory_name[0] == '/') {
|
||||
directory[0] = 0;
|
||||
} else {
|
||||
while ((s = strstr(directory,"//"))) {
|
||||
int i;
|
||||
for (i = 2;s[i] == '/';i++);
|
||||
strcpy(s, &s[i-1]);
|
||||
}
|
||||
if ((s = strrchr(directory, '/')) && !s[1]) s[0] = 0;
|
||||
}
|
||||
while ((s = strstr(directory_name,"//"))) {
|
||||
int i;
|
||||
for (i = 2;s[i] == '/';i++);
|
||||
strcpy(s, &s[i-1]);
|
||||
}
|
||||
if ((s = strrchr(directory_name, '/')) && !s[1]) s[0] = 0;
|
||||
|
||||
file = wmalloc(strlen(directory_name)+strlen(directory)+1);
|
||||
sprintf(file, "%s/%s", directory, directory_name);
|
||||
while ((s = strstr(file,"//"))) {
|
||||
int i;
|
||||
for (i = 2;s[i] == '/';i++);
|
||||
strcpy(s, &s[i-1]);
|
||||
}
|
||||
|
||||
if (mkdir(file,0xfff) != 0) {
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
showError(scr, panel->win, "Permission denied.", NULL);
|
||||
break;
|
||||
case EEXIST:
|
||||
showError(scr, panel->win, "'%s' already existes.", file);
|
||||
break;
|
||||
case ENOENT:
|
||||
showError(scr, panel->win, "Path does not exist.", NULL);
|
||||
}
|
||||
}
|
||||
else WMSetFilePanelDirectory(panel, file);
|
||||
|
||||
wfree(directory_name);
|
||||
wfree(directory);
|
||||
wfree(file);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
deleteFile(WMButton *bPre, WMFilePanel *panel)
|
||||
{
|
||||
char *file;
|
||||
char *buffer, *s;
|
||||
struct stat filestat;
|
||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||
|
||||
file = getCurrentFileName(panel);
|
||||
|
||||
while ((s = strstr(file,"//"))) {
|
||||
int i;
|
||||
for (i = 2;s[i] == '/';i++);
|
||||
strcpy(s, &s[i-1]);
|
||||
}
|
||||
if (strlen(file) > 1 && (s = strrchr(file, '/')) && !s[1]) s[0] = 0;
|
||||
|
||||
if (stat(file,&filestat)) {
|
||||
switch (errno) {
|
||||
case ENOENT:
|
||||
showError(scr, panel->win, "'%s' does not exist.", file);
|
||||
break;
|
||||
case EACCES:
|
||||
showError(scr, panel->win, "Permission denied.", NULL);
|
||||
break;
|
||||
case ENOMEM:
|
||||
showError(scr, panel->win,
|
||||
"Insufficient memory available.", NULL);
|
||||
break;
|
||||
case EROFS:
|
||||
showError(scr, panel->win,
|
||||
"'%s' is on a read-only filesystem.", file);
|
||||
break;
|
||||
default:
|
||||
showError(scr, panel->win, "Can not delete '%s'.", file);
|
||||
}
|
||||
wfree(file);
|
||||
return;
|
||||
} else if (S_ISDIR(filestat.st_mode)) {
|
||||
buffer = wmalloc(strlen(file)+20);
|
||||
sprintf(buffer,"Delete directory %s ?",file);
|
||||
} else {
|
||||
buffer = wmalloc(strlen(file)+15);
|
||||
sprintf(buffer,"Delete file %s ?",file);
|
||||
}
|
||||
|
||||
if (!WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,
|
||||
"Warning", buffer, "OK", "Cancel", NULL)) {
|
||||
if (S_ISDIR(filestat.st_mode)) {
|
||||
if (rmdir(file) != 0) {
|
||||
switch (errno) {
|
||||
case EACCES:
|
||||
showError(scr, panel->win, "Permission denied.", NULL);
|
||||
break;
|
||||
case ENOENT:
|
||||
showError(scr, panel->win, "Directory '%s' does not exist.", file);
|
||||
break;
|
||||
case ENOTEMPTY:
|
||||
showError(scr, panel->win, "Directory '%s' is not empty.", file);
|
||||
break;
|
||||
case EBUSY:
|
||||
showError(scr, panel->win, "Directory '%s' is busy.", file);
|
||||
break;
|
||||
default:
|
||||
showError(scr, panel->win, "Can not delete '%s'.", file);
|
||||
}
|
||||
} else {
|
||||
char *s = strrchr(file,'/');
|
||||
if (s) s[0] = 0;
|
||||
WMSetFilePanelDirectory(panel, file);
|
||||
}
|
||||
} else if (remove(file) != 0) {
|
||||
switch (errno) {
|
||||
case EISDIR:
|
||||
showError(scr, panel->win, "'%s' is a directory.", file);
|
||||
break;
|
||||
case ENOENT:
|
||||
showError(scr, panel->win, "'%s' does not exist.", file);
|
||||
break;
|
||||
case EACCES:
|
||||
showError(scr, panel->win, "Permission denied.", NULL);
|
||||
break;
|
||||
case ENOMEM:
|
||||
showError(scr, panel->win,
|
||||
"Insufficient memory available.", NULL);
|
||||
break;
|
||||
case EROFS:
|
||||
showError(scr, panel->win,
|
||||
"'%s' is on a read-only filesystem.", file);
|
||||
break;
|
||||
default:
|
||||
showError(scr, panel->win, "Can not delete '%s'.", file);
|
||||
}
|
||||
} else {
|
||||
char *s = strrchr(file,'/');
|
||||
if (s) s[1] = 0;
|
||||
WMSetFilePanelDirectory(panel, file);
|
||||
}
|
||||
}
|
||||
wfree(buffer);
|
||||
wfree(file);
|
||||
}
|
||||
|
||||
static void
|
||||
goUnmount(WMButton *bPtr, WMFilePanel *panel)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
goFloppy(WMButton *bPtr, WMFilePanel *panel)
|
||||
{
|
||||
struct stat filestat;
|
||||
WMScreen *scr = WMWidgetScreen(panel->win);
|
||||
|
||||
if (stat(WINGsConfiguration.floppyPath, &filestat)) {
|
||||
showError(scr, panel->win, "An error occured browsing '%s'.",
|
||||
WINGsConfiguration.floppyPath);
|
||||
return;
|
||||
} else if (!S_ISDIR(filestat.st_mode)) {
|
||||
showError(scr, panel->win, "'%s' is not a directory.",
|
||||
WINGsConfiguration.floppyPath);
|
||||
return;
|
||||
}
|
||||
|
||||
WMSetFilePanelDirectory(panel, WINGsConfiguration.floppyPath);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
goHome(WMButton *bPtr, WMFilePanel *panel)
|
||||
{
|
||||
@@ -487,6 +875,44 @@ goHome(WMButton *bPtr, WMFilePanel *panel)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
handleEvents(XEvent *event, void *data)
|
||||
{
|
||||
W_FilePanel *pPtr = (W_FilePanel*)data;
|
||||
W_View *view = WMWidgetView(pPtr->win);
|
||||
|
||||
if (event->type == ConfigureNotify) {
|
||||
if (event->xconfigure.width != view->size.width
|
||||
|| event->xconfigure.height != view->size.height) {
|
||||
unsigned int newWidth = event->xconfigure.width;
|
||||
unsigned int newHeight = event->xconfigure.height;
|
||||
int newColumnCount;
|
||||
|
||||
W_ResizeView(view, newWidth, newHeight);
|
||||
WMResizeWidget(pPtr->line, newWidth, 2);
|
||||
WMResizeWidget(pPtr->browser, newWidth-14,
|
||||
newHeight-(PHEIGHT-200));
|
||||
WMResizeWidget(pPtr->fileField, newWidth-60-10, 24);
|
||||
WMMoveWidget(pPtr->nameLabel, 7, newHeight-(PHEIGHT-282));
|
||||
WMMoveWidget(pPtr->fileField, 60, newHeight-(PHEIGHT-278));
|
||||
WMMoveWidget(pPtr->okButton, newWidth-(PWIDTH-245),
|
||||
newHeight-(PHEIGHT-325));
|
||||
WMMoveWidget(pPtr->cancelButton, newWidth-(PWIDTH-165),
|
||||
newHeight-(PHEIGHT-325));
|
||||
|
||||
WMMoveWidget(pPtr->trashcanButton, 7, newHeight-(PHEIGHT-325));
|
||||
WMMoveWidget(pPtr->createDirButton, 37, newHeight-(PHEIGHT-325));
|
||||
WMMoveWidget(pPtr->homeButton, 67, newHeight-(PHEIGHT-325));
|
||||
WMMoveWidget(pPtr->disketteButton, 97, newHeight-(PHEIGHT-325));
|
||||
WMMoveWidget(pPtr->unmountButton, 127, newHeight-(PHEIGHT-325));
|
||||
|
||||
newColumnCount = (newWidth - 14) / 140;
|
||||
WMSetBrowserMaxVisibleColumns(pPtr->browser, newColumnCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static char*
|
||||
getCurrentFileName(WMFilePanel *panel)
|
||||
{
|
||||
@@ -501,10 +927,14 @@ getCurrentFileName(WMFilePanel *panel)
|
||||
if (path[len-1]=='/') {
|
||||
file = WMGetTextFieldText(panel->fileField);
|
||||
tmp = wmalloc(strlen(path)+strlen(file)+8);
|
||||
if (file[0]!='/') {
|
||||
strcpy(tmp, path);
|
||||
strcat(tmp, file);
|
||||
free(file);
|
||||
free(path);
|
||||
} else
|
||||
strcpy(tmp, file);
|
||||
|
||||
wfree(file);
|
||||
wfree(path);
|
||||
return tmp;
|
||||
} else {
|
||||
return path;
|
||||
@@ -517,15 +947,28 @@ static Bool
|
||||
validOpenFile(WMFilePanel *panel)
|
||||
{
|
||||
WMListItem *item;
|
||||
int col;
|
||||
int col, haveFile = 0;
|
||||
char *file = WMGetTextFieldText(panel->fileField);
|
||||
|
||||
if (file[0] != '\0')
|
||||
haveFile = 1;
|
||||
wfree(file);
|
||||
|
||||
col = WMGetBrowserSelectedColumn(panel->browser);
|
||||
item = WMGetBrowserSelectedItemInColumn(panel->browser, col);
|
||||
if (item) {
|
||||
if (item->isBranch && !panel->flags.canChooseDirectories)
|
||||
if (item->isBranch && !panel->flags.canChooseDirectories && !haveFile)
|
||||
return False;
|
||||
else if (!item->isBranch && !panel->flags.canChooseFiles)
|
||||
return False;
|
||||
else
|
||||
return True;
|
||||
} else {
|
||||
/* we compute for / here */
|
||||
if (!panel->flags.canChooseDirectories && !haveFile)
|
||||
return False;
|
||||
else
|
||||
return True;
|
||||
}
|
||||
return True;
|
||||
}
|
||||
@@ -535,25 +978,31 @@ validOpenFile(WMFilePanel *panel)
|
||||
static void
|
||||
buttonClick(WMButton *bPtr, WMFilePanel *panel)
|
||||
{
|
||||
WMRange range;
|
||||
|
||||
if (bPtr == panel->okButton) {
|
||||
if (panel->flags.fileMustExist) {
|
||||
char *file;
|
||||
if (!validOpenFile(panel))
|
||||
return;
|
||||
if (panel->flags.fileMustExist) {
|
||||
char *file;
|
||||
|
||||
file = getCurrentFileName(panel);
|
||||
if (access(file, F_OK)!=0) {
|
||||
WMRunAlertPanel(WMWidgetScreen(panel->win), panel->win,
|
||||
"Error", "File does not exist.",
|
||||
"Ok", NULL, NULL);
|
||||
free(file);
|
||||
wfree(file);
|
||||
return;
|
||||
}
|
||||
free(file);
|
||||
wfree(file);
|
||||
}
|
||||
panel->flags.canceled = 0;
|
||||
} else
|
||||
panel->flags.canceled = 1;
|
||||
|
||||
range.count = range.position = 0;
|
||||
WMSelectTextFieldRange(panel->fileField, range);
|
||||
panel->flags.done = 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
394
WINGs/wfont.c
394
WINGs/wfont.c
@@ -4,12 +4,99 @@
|
||||
|
||||
#include <wraster.h>
|
||||
#include <assert.h>
|
||||
#include <X11/Xlocale.h>
|
||||
|
||||
static char *makeFontSetOfSize(char *fontset, int size);
|
||||
|
||||
|
||||
|
||||
/* XLFD pattern matching */
|
||||
static char*
|
||||
xlfd_get_element (const char *xlfd, int index)
|
||||
{
|
||||
const char *p = xlfd;
|
||||
while (*p != 0) {
|
||||
if (*p == '-' && --index == 0) {
|
||||
const char *end = strchr(p + 1, '-');
|
||||
char *buf;
|
||||
size_t len;
|
||||
if (end == 0) end = p + strlen(p);
|
||||
len = end - (p + 1);
|
||||
buf = wmalloc(len);
|
||||
memcpy(buf, p + 1, len);
|
||||
buf[len] = 0;
|
||||
return buf;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return strdup("*");
|
||||
}
|
||||
|
||||
/* XLFD pattern matching */
|
||||
static char*
|
||||
generalize_xlfd (const char *xlfd)
|
||||
{
|
||||
char *buf;
|
||||
int len;
|
||||
char *weight = xlfd_get_element(xlfd, 3);
|
||||
char *slant = xlfd_get_element(xlfd, 4);
|
||||
char *pxlsz = xlfd_get_element(xlfd, 7);
|
||||
|
||||
len = snprintf(NULL, 0, "%s,-*-*-%s-%s-*-*-%s-*-*-*-*-*-*-*,"
|
||||
"-*-*-*-*-*-*-%s-*-*-*-*-*-*-*,*",
|
||||
xlfd, weight, slant, pxlsz, pxlsz);
|
||||
buf = wmalloc(len + 1);
|
||||
snprintf(buf, len + 1, "%s,-*-*-%s-%s-*-*-%s-*-*-*-*-*-*-*,"
|
||||
"-*-*-*-*-*-*-%s-*-*-*-*-*-*-*,*",
|
||||
xlfd, weight, slant, pxlsz, pxlsz);
|
||||
|
||||
wfree(pxlsz);
|
||||
wfree(slant);
|
||||
wfree(weight);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* XLFD pattern matching */
|
||||
static XFontSet
|
||||
W_CreateFontSetWithGuess(Display *dpy, char *xlfd, char ***missing,
|
||||
int *nmissing, char **def_string)
|
||||
{
|
||||
XFontSet fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
||||
|
||||
if (fs != NULL && *nmissing == 0) return fs;
|
||||
|
||||
/* for non-iso8859-1 language and iso8859-1 specification
|
||||
(this fontset is only for pattern analysis) */
|
||||
if (fs == NULL) {
|
||||
char *old_locale = setlocale(LC_CTYPE, NULL);
|
||||
if (*nmissing != 0) XFreeStringList(*missing);
|
||||
setlocale(LC_CTYPE, "C");
|
||||
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
||||
setlocale(LC_CTYPE, old_locale);
|
||||
}
|
||||
|
||||
/* make XLFD font name for pattern analysis */
|
||||
if (fs != NULL) {
|
||||
XFontStruct **fontstructs;
|
||||
char **fontnames;
|
||||
if (XFontsOfFontSet(fs, &fontstructs, &fontnames) > 0)
|
||||
xlfd = fontnames[0];
|
||||
}
|
||||
|
||||
xlfd = generalize_xlfd (xlfd);
|
||||
|
||||
if (*nmissing != 0) XFreeStringList(*missing);
|
||||
if (fs != 0) XFreeFontSet(dpy, fs);
|
||||
|
||||
fs = XCreateFontSet(dpy, xlfd, missing, nmissing, def_string);
|
||||
|
||||
wfree(xlfd);
|
||||
return fs;
|
||||
}
|
||||
|
||||
WMFont*
|
||||
WMCreateFont(WMScreen *scrPtr, char *fontName)
|
||||
WMCreateFontSet(WMScreen *scrPtr, char *fontName)
|
||||
{
|
||||
WMFont *font;
|
||||
Display *display = scrPtr->display;
|
||||
@@ -18,16 +105,23 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
|
||||
char *defaultString;
|
||||
XFontSetExtents *extents;
|
||||
|
||||
font = WMHashGet(scrPtr->fontCache, fontName);
|
||||
if (font) {
|
||||
WMRetainFont(font);
|
||||
return font;
|
||||
}
|
||||
|
||||
font = malloc(sizeof(WMFont));
|
||||
if (!font)
|
||||
return NULL;
|
||||
memset(font, 0, sizeof(WMFont));
|
||||
|
||||
font->notFontSet = 0;
|
||||
|
||||
font->screen = scrPtr;
|
||||
|
||||
font->font.set = XCreateFontSet(display, fontName, &missing, &nmissing,
|
||||
&defaultString);
|
||||
font->font.set = W_CreateFontSetWithGuess(display, fontName, &missing,
|
||||
&nmissing, &defaultString);
|
||||
if (nmissing > 0 && font->font.set) {
|
||||
int i;
|
||||
|
||||
@@ -42,7 +136,7 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
|
||||
defaultString);
|
||||
}
|
||||
if (!font->font.set) {
|
||||
free(font);
|
||||
wfree(font);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -53,28 +147,51 @@ WMCreateFont(WMScreen *scrPtr, char *fontName)
|
||||
|
||||
font->refCount = 1;
|
||||
|
||||
font->name = wstrdup(fontName);
|
||||
|
||||
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMFont*
|
||||
WMCreateFontInDefaultEncoding(WMScreen *scrPtr, char *fontName)
|
||||
WMCreateNormalFont(WMScreen *scrPtr, char *fontName)
|
||||
{
|
||||
WMFont *font;
|
||||
Display *display = scrPtr->display;
|
||||
char *fname, *ptr;
|
||||
|
||||
if ((ptr = strchr(fontName, ','))) {
|
||||
fname = wmalloc(ptr - fontName + 1);
|
||||
strncpy(fname, fontName, ptr - fontName);
|
||||
fname[ptr - fontName] = 0;
|
||||
} else {
|
||||
fname = wstrdup(fontName);
|
||||
}
|
||||
|
||||
font = WMHashGet(scrPtr->fontCache, fname);
|
||||
if (font) {
|
||||
WMRetainFont(font);
|
||||
wfree(fname);
|
||||
return font;
|
||||
}
|
||||
|
||||
font = malloc(sizeof(WMFont));
|
||||
if (!font)
|
||||
if (!font) {
|
||||
wfree(fname);
|
||||
return NULL;
|
||||
}
|
||||
memset(font, 0, sizeof(WMFont));
|
||||
|
||||
font->notFontSet = 1;
|
||||
|
||||
font->screen = scrPtr;
|
||||
|
||||
font->font.normal = XLoadQueryFont(display, fontName);
|
||||
font->font.normal = XLoadQueryFont(display, fname);
|
||||
if (!font->font.normal) {
|
||||
free(font);
|
||||
wfree(font);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -83,15 +200,30 @@ WMCreateFontInDefaultEncoding(WMScreen *scrPtr, char *fontName)
|
||||
|
||||
font->refCount = 1;
|
||||
|
||||
font->name = fname;
|
||||
|
||||
assert(WMHashInsert(scrPtr->fontCache, font->name, font)==NULL);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMFont*
|
||||
WMCreateFont(WMScreen *scrPtr, char *fontName)
|
||||
{
|
||||
if (scrPtr->useMultiByte)
|
||||
return WMCreateFontSet(scrPtr, fontName);
|
||||
else
|
||||
return WMCreateNormalFont(scrPtr, fontName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
WMFont*
|
||||
WMRetainFont(WMFont *font)
|
||||
{
|
||||
assert(font!=NULL);
|
||||
wassertrv(font!=NULL, NULL);
|
||||
|
||||
font->refCount++;
|
||||
|
||||
@@ -102,14 +234,20 @@ WMRetainFont(WMFont *font)
|
||||
void
|
||||
WMReleaseFont(WMFont *font)
|
||||
{
|
||||
assert(font!=NULL);
|
||||
wassertr(font!=NULL);
|
||||
|
||||
font->refCount--;
|
||||
if (font->refCount < 1) {
|
||||
if (font->notFontSet)
|
||||
XFreeFont(font->screen->display, font->font.normal);
|
||||
else
|
||||
else {
|
||||
XFreeFontSet(font->screen->display, font->font.set);
|
||||
free(font);
|
||||
}
|
||||
if (font->name) {
|
||||
WMHashRemove(font->screen->fontCache, font->name);
|
||||
wfree(font->name);
|
||||
}
|
||||
wfree(font);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,14 +256,13 @@ WMReleaseFont(WMFont *font)
|
||||
unsigned int
|
||||
WMFontHeight(WMFont *font)
|
||||
{
|
||||
assert(font!=NULL);
|
||||
wassertrv(font!=NULL, 0);
|
||||
|
||||
return font->height;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
WMFont*
|
||||
WMSystemFontOfSize(WMScreen *scrPtr, int size)
|
||||
{
|
||||
@@ -134,18 +271,29 @@ WMSystemFontOfSize(WMScreen *scrPtr, int size)
|
||||
|
||||
fontSpec = makeFontSetOfSize(WINGsConfiguration.systemFont, size);
|
||||
|
||||
font = WMCreateFont(scrPtr, fontSpec);
|
||||
if (scrPtr->useMultiByte)
|
||||
font = WMCreateFontSet(scrPtr, fontSpec);
|
||||
else
|
||||
font = WMCreateNormalFont(scrPtr, fontSpec);
|
||||
|
||||
if (!font) {
|
||||
if (scrPtr->useMultiByte) {
|
||||
wwarning("could not load font set %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFont(scrPtr, "fixed");
|
||||
font = WMCreateFontSet(scrPtr, "fixed");
|
||||
if (!font) {
|
||||
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
|
||||
}
|
||||
} else {
|
||||
wwarning("could not load font %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateNormalFont(scrPtr, "fixed");
|
||||
}
|
||||
if (!font) {
|
||||
wwarning("could not load fixed font!");
|
||||
free(fontSpec);
|
||||
wfree(fontSpec);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
free(fontSpec);
|
||||
wfree(fontSpec);
|
||||
|
||||
return font;
|
||||
}
|
||||
@@ -159,18 +307,29 @@ WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
|
||||
|
||||
fontSpec = makeFontSetOfSize(WINGsConfiguration.boldSystemFont, size);
|
||||
|
||||
font = WMCreateFont(scrPtr, fontSpec);
|
||||
if (scrPtr->useMultiByte)
|
||||
font = WMCreateFontSet(scrPtr, fontSpec);
|
||||
else
|
||||
font = WMCreateNormalFont(scrPtr, fontSpec);
|
||||
|
||||
if (!font) {
|
||||
if (scrPtr->useMultiByte) {
|
||||
wwarning("could not load font set %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateFont(scrPtr, "fixed");
|
||||
font = WMCreateFontSet(scrPtr, "fixed");
|
||||
if (!font) {
|
||||
font = WMCreateFontSet(scrPtr, "-*-fixed-medium-r-normal-*-14-*-*-*-*-*-*-*");
|
||||
}
|
||||
} else {
|
||||
wwarning("could not load font %s. Trying fixed.", fontSpec);
|
||||
font = WMCreateNormalFont(scrPtr, "fixed");
|
||||
}
|
||||
if (!font) {
|
||||
wwarning("could not load fixed font!");
|
||||
free(fontSpec);
|
||||
wfree(fontSpec);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
free(fontSpec);
|
||||
wfree(fontSpec);
|
||||
|
||||
return font;
|
||||
}
|
||||
@@ -179,6 +338,8 @@ WMBoldSystemFontOfSize(WMScreen *scrPtr, int size)
|
||||
XFontSet
|
||||
WMGetFontFontSet(WMFont *font)
|
||||
{
|
||||
wassertrv(font!=NULL, NULL);
|
||||
|
||||
if (font->notFontSet)
|
||||
return NULL;
|
||||
else
|
||||
@@ -189,8 +350,8 @@ WMGetFontFontSet(WMFont *font)
|
||||
int
|
||||
WMWidthOfString(WMFont *font, char *text, int length)
|
||||
{
|
||||
assert(font!=NULL);
|
||||
assert(text!=NULL);
|
||||
wassertrv(font!=NULL, 0);
|
||||
wassertrv(text!=NULL, 0);
|
||||
|
||||
if (font->notFontSet)
|
||||
return XTextWidth(font->font.normal, text, length);
|
||||
@@ -210,6 +371,8 @@ void
|
||||
WMDrawString(WMScreen *scr, Drawable d, GC gc, WMFont *font, int x, int y,
|
||||
char *text, int length)
|
||||
{
|
||||
wassertr(font!=NULL);
|
||||
|
||||
if (font->notFontSet) {
|
||||
XSetFont(scr->display, gc, font->font.normal->fid);
|
||||
XDrawString(scr->display, d, gc, x, y + font->y, text, length);
|
||||
@@ -224,6 +387,8 @@ void
|
||||
WMDrawImageString(WMScreen *scr, Drawable d, GC gc, WMFont *font, int x, int y,
|
||||
char *text, int length)
|
||||
{
|
||||
wassertr(font != NULL);
|
||||
|
||||
if (font->notFontSet) {
|
||||
XSetFont(scr->display, gc, font->font.normal->fid);
|
||||
XDrawImageString(scr->display, d, gc, x, y + font->y, text, length);
|
||||
@@ -239,34 +404,187 @@ WMDrawImageString(WMScreen *scr, Drawable d, GC gc, WMFont *font, int x, int y,
|
||||
static char*
|
||||
makeFontSetOfSize(char *fontset, int size)
|
||||
{
|
||||
char font[300];
|
||||
char font[300], *f;
|
||||
char *newfs = NULL;
|
||||
char *ptr;
|
||||
char *tmp;
|
||||
|
||||
do {
|
||||
int hold = ' ';
|
||||
char *tmp;
|
||||
int end;
|
||||
|
||||
|
||||
f = fontset;
|
||||
ptr = strchr(fontset, ',');
|
||||
if (ptr) {
|
||||
hold = *(ptr+1);
|
||||
*(ptr+1) = 0;
|
||||
}
|
||||
if (strlen(fontset)>255) {
|
||||
int count = ptr-fontset;
|
||||
|
||||
if (count > 255) {
|
||||
wwarning("font description %s is too large.", fontset);
|
||||
} else {
|
||||
sprintf(font, fontset, size);
|
||||
tmp = wstrappend(newfs, font);
|
||||
memcpy(font, fontset, count);
|
||||
font[count] = 0;
|
||||
f = (char*)font;
|
||||
}
|
||||
}
|
||||
|
||||
if (newfs)
|
||||
free(newfs);
|
||||
end = strlen(newfs);
|
||||
else
|
||||
end = 0;
|
||||
|
||||
tmp = wmalloc(end + strlen(f) + 8);
|
||||
if (end != 0) {
|
||||
sprintf(tmp, "%s,", newfs);
|
||||
sprintf(tmp + end + 1, f, size);
|
||||
} else {
|
||||
sprintf(tmp + end, f, size);
|
||||
}
|
||||
|
||||
if (newfs)
|
||||
wfree(newfs);
|
||||
newfs = tmp;
|
||||
}
|
||||
if (ptr) {
|
||||
*(ptr+1) = hold;
|
||||
}
|
||||
|
||||
fontset = ptr+1;
|
||||
} while (ptr!=NULL);
|
||||
|
||||
return newfs;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
changeFontProp(char *fname, char *newprop, int which)
|
||||
{
|
||||
char before[128], prop[128], after[128];
|
||||
char *ptr, *bptr;
|
||||
int part=0;
|
||||
|
||||
if(!fname || !prop)
|
||||
return;
|
||||
|
||||
ptr = fname;
|
||||
bptr = before;
|
||||
while (*ptr) {
|
||||
if(*ptr == '-') {
|
||||
*bptr = 0;
|
||||
if(part==which) bptr = prop;
|
||||
else if(part==which+1) bptr = after;
|
||||
*bptr++ = *ptr;
|
||||
part++;
|
||||
} else {
|
||||
*bptr++ = *ptr;
|
||||
} ptr++;
|
||||
}*bptr = 0;
|
||||
snprintf(fname, 255, "%s-%s%s", before, newprop, after);
|
||||
}
|
||||
|
||||
|
||||
WMFont *
|
||||
WMNormalizeFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
WMFont *newfont=NULL;
|
||||
char fname[256];
|
||||
|
||||
if(!scr || !font)
|
||||
return NULL;
|
||||
|
||||
snprintf(fname, 255, font->name);
|
||||
changeFontProp(fname, "medium", 2);
|
||||
changeFontProp(fname, "r", 3);
|
||||
newfont = WMCreateNormalFont(scr, fname);
|
||||
|
||||
if(!newfont)
|
||||
return NULL;
|
||||
|
||||
return newfont;
|
||||
}
|
||||
|
||||
|
||||
WMFont *
|
||||
WMStrengthenFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
WMFont *newfont=NULL;
|
||||
char fname[256];
|
||||
|
||||
if(!scr || !font)
|
||||
return NULL;
|
||||
|
||||
snprintf(fname, 255, font->name);
|
||||
changeFontProp(fname, "bold", 2);
|
||||
newfont = WMCreateNormalFont(scr, fname);
|
||||
|
||||
if(!newfont)
|
||||
return NULL;
|
||||
|
||||
return newfont;
|
||||
}
|
||||
|
||||
|
||||
WMFont *
|
||||
WMUnstrengthenFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
WMFont *newfont=NULL;
|
||||
char fname[256];
|
||||
|
||||
if(!scr || !font)
|
||||
return NULL;
|
||||
|
||||
snprintf(fname, 255, font->name);
|
||||
changeFontProp(fname, "medium", 2);
|
||||
newfont = WMCreateNormalFont(scr, fname);
|
||||
|
||||
if(!newfont)
|
||||
return NULL;
|
||||
|
||||
return newfont;
|
||||
}
|
||||
|
||||
|
||||
WMFont *
|
||||
WMEmphasizeFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
WMFont *newfont=NULL;
|
||||
char fname[256];
|
||||
|
||||
if(!scr || !font)
|
||||
return NULL;
|
||||
|
||||
snprintf(fname, 255, font->name);
|
||||
changeFontProp(fname, "o", 3);
|
||||
newfont = WMCreateNormalFont(scr, fname);
|
||||
|
||||
if(!newfont)
|
||||
return NULL;
|
||||
|
||||
return newfont;
|
||||
}
|
||||
|
||||
|
||||
WMFont *
|
||||
WMUnemphasizeFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
WMFont *newfont=NULL;
|
||||
char fname[256];
|
||||
|
||||
if(!scr || !font)
|
||||
return NULL;
|
||||
|
||||
snprintf(fname, 255, font->name);
|
||||
changeFontProp(fname, "r", 3);
|
||||
newfont = WMCreateNormalFont(scr, fname);
|
||||
|
||||
if(!newfont)
|
||||
return NULL;
|
||||
|
||||
return newfont;
|
||||
}
|
||||
|
||||
WMFont *
|
||||
WMGetFontOfSize(WMScreen *scr, WMFont *font, int size)
|
||||
{
|
||||
if(!scr || !font || size<1)
|
||||
return NULL;
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
106
WINGs/wframe.c
106
WINGs/wframe.c
@@ -10,20 +10,12 @@ typedef struct W_Frame {
|
||||
|
||||
|
||||
struct {
|
||||
WMReliefType relief:3;
|
||||
WMTitlePosition titlePosition:3;
|
||||
WMReliefType relief:4;
|
||||
WMTitlePosition titlePosition:4;
|
||||
} flags;
|
||||
} Frame;
|
||||
|
||||
|
||||
|
||||
struct W_ViewProcedureTable _FrameViewProcedures = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
#define DEFAULT_RELIEF WRGroove
|
||||
#define DEFAULT_TITLE_POSITION WTPAtTop
|
||||
#define DEFAULT_WIDTH 40
|
||||
@@ -32,6 +24,7 @@ struct W_ViewProcedureTable _FrameViewProcedures = {
|
||||
|
||||
static void destroyFrame(Frame *fPtr);
|
||||
static void paintFrame(Frame *fPtr);
|
||||
static void repaintFrame(Frame *fPtr);
|
||||
|
||||
|
||||
|
||||
@@ -41,7 +34,7 @@ WMSetFrameTitlePosition(WMFrame *fPtr, WMTitlePosition position)
|
||||
fPtr->flags.titlePosition = position;
|
||||
|
||||
if (fPtr->view->flags.realized) {
|
||||
paintFrame(fPtr);
|
||||
repaintFrame(fPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +45,7 @@ WMSetFrameRelief(WMFrame *fPtr, WMReliefType relief)
|
||||
fPtr->flags.relief = relief;
|
||||
|
||||
if (fPtr->view->flags.realized) {
|
||||
paintFrame(fPtr);
|
||||
repaintFrame(fPtr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,18 +54,29 @@ void
|
||||
WMSetFrameTitle(WMFrame *fPtr, char *title)
|
||||
{
|
||||
if (fPtr->caption)
|
||||
free(fPtr->caption);
|
||||
wfree(fPtr->caption);
|
||||
if (title)
|
||||
fPtr->caption = wstrdup(title);
|
||||
else
|
||||
fPtr->caption = NULL;
|
||||
|
||||
if (fPtr->view->flags.realized) {
|
||||
paintFrame(fPtr);
|
||||
repaintFrame(fPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
repaintFrame(Frame *fPtr)
|
||||
{
|
||||
W_View *view = fPtr->view;
|
||||
W_Screen *scrPtr = view->screen;
|
||||
|
||||
XClearWindow(scrPtr->display, view->window);
|
||||
paintFrame(fPtr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
paintFrame(Frame *fPtr)
|
||||
{
|
||||
@@ -80,9 +84,10 @@ paintFrame(Frame *fPtr)
|
||||
W_Screen *scrPtr = view->screen;
|
||||
int tx, ty, tw, th;
|
||||
int fy, fh;
|
||||
Bool drawTitle;
|
||||
|
||||
if (fPtr->caption!=NULL)
|
||||
th = scrPtr->normalFont->height;
|
||||
th = WMFontHeight(scrPtr->normalFont);
|
||||
else {
|
||||
th = 0;
|
||||
}
|
||||
@@ -132,27 +137,63 @@ paintFrame(Frame *fPtr)
|
||||
fy = 0;
|
||||
fh = view->size.height;
|
||||
}
|
||||
/*
|
||||
XClearArea(scrPtr->display, view->window, fy+2, 2, fh-4, view->size.width-4,
|
||||
False);
|
||||
*/
|
||||
XClearWindow(scrPtr->display, view->window);
|
||||
|
||||
W_DrawRelief(scrPtr, view->window, 0, fy, view->size.width, fh,
|
||||
fPtr->flags.relief);
|
||||
|
||||
if (fPtr->caption!=NULL && fPtr->flags.titlePosition!=WTPNoTitle) {
|
||||
|
||||
|
||||
tw = WMWidthOfString(scrPtr->normalFont, fPtr->caption,
|
||||
strlen(fPtr->caption));
|
||||
|
||||
tx = (view->size.width - tw) / 2;
|
||||
|
||||
XFillRectangle(scrPtr->display, view->window, W_GC(scrPtr->gray),
|
||||
tx, ty, tw, th);
|
||||
drawTitle = True;
|
||||
} else {
|
||||
drawTitle = False;
|
||||
}
|
||||
|
||||
WMDrawString(scrPtr, view->window, W_GC(scrPtr->black),
|
||||
{
|
||||
XRectangle rect;
|
||||
Region region, tmp;
|
||||
GC gc[4];
|
||||
int i;
|
||||
|
||||
region = XCreateRegion();
|
||||
|
||||
if (drawTitle) {
|
||||
tmp = XCreateRegion();
|
||||
rect.x = tx;
|
||||
rect.y = ty;
|
||||
rect.width = tw;
|
||||
rect.height = th;
|
||||
XUnionRectWithRegion(&rect, tmp, tmp);
|
||||
}
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.width = view->size.width;
|
||||
rect.height = view->size.height;
|
||||
XUnionRectWithRegion(&rect, region, region);
|
||||
if (drawTitle) {
|
||||
XSubtractRegion(region, tmp, region);
|
||||
XDestroyRegion(tmp);
|
||||
}
|
||||
gc[0] = WMColorGC(scrPtr->black);
|
||||
gc[1] = WMColorGC(scrPtr->darkGray);
|
||||
gc[2] = WMColorGC(scrPtr->gray);
|
||||
gc[3] = WMColorGC(scrPtr->white);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
XSetRegion(scrPtr->display, gc[i], region);
|
||||
}
|
||||
XDestroyRegion(region);
|
||||
|
||||
W_DrawReliefWithGC(scrPtr, view->window, 0, fy, view->size.width, fh,
|
||||
fPtr->flags.relief, gc[0], gc[1], gc[2], gc[3]);
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
XSetClipMask(scrPtr->display, gc[i], None);
|
||||
}
|
||||
}
|
||||
|
||||
if (drawTitle) {
|
||||
WMDrawString(scrPtr, view->window, WMColorGC(scrPtr->black),
|
||||
scrPtr->normalFont, tx, ty, fPtr->caption,
|
||||
strlen(fPtr->caption));
|
||||
}
|
||||
@@ -171,8 +212,7 @@ handleEvents(XEvent *event, void *data)
|
||||
|
||||
switch (event->type) {
|
||||
case Expose:
|
||||
if (event->xexpose.count!=0)
|
||||
break;
|
||||
if (event->xexpose.count == 0)
|
||||
paintFrame(fPtr);
|
||||
break;
|
||||
|
||||
@@ -195,7 +235,7 @@ WMCreateFrame(WMWidget *parent)
|
||||
|
||||
fPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!fPtr->view) {
|
||||
free(fPtr);
|
||||
wfree(fPtr);
|
||||
return NULL;
|
||||
}
|
||||
fPtr->view->self = fPtr;
|
||||
@@ -217,7 +257,7 @@ static void
|
||||
destroyFrame(Frame *fPtr)
|
||||
{
|
||||
if (fPtr->caption)
|
||||
free(fPtr->caption);
|
||||
wfree(fPtr->caption);
|
||||
|
||||
free(fPtr);
|
||||
wfree(fPtr);
|
||||
}
|
||||
|
||||
433
WINGs/widgets.c
433
WINGs/widgets.c
@@ -281,74 +281,53 @@ static char *PULLDOWN_INDICATOR[] = {
|
||||
#define PULLDOWN_INDICATOR_HEIGHT 7
|
||||
|
||||
|
||||
#define CHECK_MARK_WIDTH 8
|
||||
#define CHECK_MARK_HEIGHT 10
|
||||
|
||||
static char *CHECK_MARK[] = {
|
||||
"======== ",
|
||||
"======= #",
|
||||
"====== #%",
|
||||
"===== #%=",
|
||||
" #== #%==",
|
||||
" #% #%===",
|
||||
" % #%====",
|
||||
" #%=====",
|
||||
" #%======",
|
||||
"#%======="};
|
||||
|
||||
|
||||
#define STIPPLE_WIDTH 8
|
||||
#define STIPPLE_HEIGHT 8
|
||||
static unsigned char STIPPLE_BITS[] = {
|
||||
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa};
|
||||
0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa
|
||||
};
|
||||
|
||||
|
||||
|
||||
extern W_ViewProcedureTable _WindowViewProcedures;
|
||||
extern W_ViewProcedureTable _FrameViewProcedures;
|
||||
extern W_ViewProcedureTable _LabelViewProcedures;
|
||||
extern W_ViewProcedureTable _ButtonViewProcedures;
|
||||
extern W_ViewProcedureTable _TextFieldViewProcedures;
|
||||
extern W_ViewProcedureTable _ScrollerViewProcedures;
|
||||
extern W_ViewProcedureTable _ScrollViewProcedures;
|
||||
extern W_ViewProcedureTable _ListViewProcedures;
|
||||
extern W_ViewProcedureTable _BrowserViewProcedures;
|
||||
extern W_ViewProcedureTable _PopUpButtonViewProcedures;
|
||||
extern W_ViewProcedureTable _ColorWellViewProcedures;
|
||||
extern W_ViewProcedureTable _ScrollViewViewProcedures;
|
||||
extern W_ViewProcedureTable _SliderViewProcedures;
|
||||
extern W_ViewProcedureTable _SplitViewViewProcedures;
|
||||
|
||||
/*
|
||||
* All widget classes defined must have an entry here.
|
||||
*/
|
||||
static W_ViewProcedureTable *procedureTables[16];
|
||||
extern void W_ReadConfigurations(void);
|
||||
|
||||
|
||||
static W_ViewProcedureTable **userProcedureTable = NULL;
|
||||
static int userWidgetCount=0;
|
||||
|
||||
|
||||
/***** end data ******/
|
||||
|
||||
|
||||
|
||||
static void
|
||||
initProcedureTable()
|
||||
{
|
||||
procedureTables[WC_Window] = &_WindowViewProcedures;
|
||||
procedureTables[WC_Frame] = &_FrameViewProcedures;
|
||||
procedureTables[WC_Label] = &_LabelViewProcedures;
|
||||
procedureTables[WC_Button] = &_ButtonViewProcedures;
|
||||
procedureTables[WC_TextField] = &_TextFieldViewProcedures;
|
||||
procedureTables[WC_Scroller] = &_ScrollerViewProcedures;
|
||||
procedureTables[WC_List] = &_ListViewProcedures;
|
||||
procedureTables[WC_Browser] = &_BrowserViewProcedures;
|
||||
procedureTables[WC_PopUpButton] = &_PopUpButtonViewProcedures;
|
||||
procedureTables[WC_ColorWell] = &_ColorWellViewProcedures;
|
||||
procedureTables[WC_ScrollView] = &_ScrollViewViewProcedures;
|
||||
procedureTables[WC_Slider] = &_SliderViewProcedures;
|
||||
procedureTables[WC_SplitView] = &_SplitViewViewProcedures;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
renderPixmap(W_Screen *screen, Pixmap d, Pixmap mask, char **data,
|
||||
int width, int height)
|
||||
{
|
||||
int x, y;
|
||||
GC whiteGC = W_GC(screen->white);
|
||||
GC blackGC = W_GC(screen->black);
|
||||
GC lightGC = W_GC(screen->gray);
|
||||
GC darkGC = W_GC(screen->darkGray);
|
||||
GC whiteGC = WMColorGC(screen->white);
|
||||
GC blackGC = WMColorGC(screen->black);
|
||||
GC lightGC = WMColorGC(screen->gray);
|
||||
GC darkGC = WMColorGC(screen->darkGray);
|
||||
|
||||
|
||||
if (mask)
|
||||
XSetForeground(screen->display, screen->monoGC,
|
||||
W_PIXEL(screen->black));
|
||||
XSetForeground(screen->display, screen->monoGC, 0);
|
||||
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++) {
|
||||
@@ -394,7 +373,7 @@ makePixmap(W_Screen *sPtr, char **data, int width, int height, int masked)
|
||||
|
||||
if (masked) {
|
||||
mask = XCreatePixmap(sPtr->display, W_DRAWABLE(sPtr), width, height, 1);
|
||||
XSetForeground(sPtr->display, sPtr->monoGC, W_PIXEL(sPtr->white));
|
||||
XSetForeground(sPtr->display, sPtr->monoGC, 1);
|
||||
XFillRectangle(sPtr->display, mask, sPtr->monoGC, 0, 0, width, height);
|
||||
}
|
||||
|
||||
@@ -404,44 +383,129 @@ makePixmap(W_Screen *sPtr, char **data, int width, int height, int masked)
|
||||
sPtr->depth);
|
||||
}
|
||||
|
||||
#ifdef USE_TIFF
|
||||
#define WINGS_IMAGES_FILE RESOURCE_PATH"/Images.tiff"
|
||||
#define DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.tiff"
|
||||
#else
|
||||
#define WINGS_IMAGES_FILE RESOURCE_PATH"/Images.xpm"
|
||||
#define DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.xpm"
|
||||
#endif
|
||||
|
||||
#define T_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.tiff"
|
||||
#define T_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.tiff"
|
||||
|
||||
#define X_WINGS_IMAGES_FILE RESOURCE_PATH"/Images.xpm"
|
||||
#define X_DEFAULT_OBJECT_ICON_FILE RESOURCE_PATH"/defaultIcon.xpm"
|
||||
|
||||
|
||||
static Bool
|
||||
loadPixmaps(WMScreen *scr)
|
||||
{
|
||||
RImage *image, *tmp;
|
||||
Pixmap pixmap;
|
||||
RColor gray;
|
||||
RColor white;
|
||||
|
||||
image = RLoadImage(scr->rcontext, WINGS_IMAGES_FILE, 0);
|
||||
if (!image) {
|
||||
wwarning("WINGs: could not load widget images file: %s", RErrorString);
|
||||
return False;
|
||||
}
|
||||
/* make it have a gray background */
|
||||
gray.red = 0xae;
|
||||
gray.green = 0xaa;
|
||||
gray.blue = 0xae;
|
||||
RCombineImageWithColor(image, &gray);
|
||||
tmp = RGetSubImage(image, 0, 0, 24, 24);
|
||||
if (!RConvertImage(scr->rcontext, tmp, &pixmap)) {
|
||||
scr->homeIcon = NULL;
|
||||
} else {
|
||||
scr->homeIcon = WMCreatePixmapFromXPixmaps(scr, pixmap, None, 24, 24,
|
||||
scr->depth);
|
||||
|
||||
white.red = 0xff;
|
||||
white.green = 0xff;
|
||||
white.blue = 0xff;
|
||||
|
||||
image = RLoadImage(scr->rcontext, T_WINGS_IMAGES_FILE, 0);
|
||||
if (!image)
|
||||
image = RLoadImage(scr->rcontext, X_WINGS_IMAGES_FILE, 0);
|
||||
if (!image) {
|
||||
wwarning("WINGs: could not load widget images file: %s",
|
||||
RMessageForError(RErrorCode));
|
||||
return False;
|
||||
}
|
||||
/* home icon */
|
||||
/* make it have a gray background */
|
||||
tmp = RGetSubImage(image, 0, 0, 24, 24);
|
||||
RCombineImageWithColor(tmp, &gray);
|
||||
scr->homeIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* make it have a white background */
|
||||
tmp = RGetSubImage(image, 0, 0, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->altHomeIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
|
||||
/* trash can */
|
||||
tmp = RGetSubImage(image, 104, 0, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->trashcanIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
tmp = RGetSubImage(image, 104, 0, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->altTrashcanIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* create dir */
|
||||
tmp = RGetSubImage(image, 104, 24, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->createDirIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
tmp = RGetSubImage(image, 104, 24, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->altCreateDirIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* diskettes */
|
||||
tmp = RGetSubImage(image, 24, 80, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->disketteIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
tmp = RGetSubImage(image, 24, 80, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->altDisketteIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* unmount */
|
||||
tmp = RGetSubImage(image, 0, 80, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->unmountIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
tmp = RGetSubImage(image, 0, 80, 24, 24);
|
||||
RCombineImageWithColor(tmp, &white);
|
||||
scr->altUnmountIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
|
||||
/* Magnifying Glass Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 24, 0, 40, 32);
|
||||
RCombineImageWithColor(tmp, &gray);
|
||||
scr->magnifyIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* ColorWheel Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 0, 25, 24, 24);
|
||||
scr->wheelIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* GrayScale Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 65, 0, 40, 24);
|
||||
scr->grayIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* RGB Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 25, 33, 40, 24);
|
||||
scr->rgbIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* CMYK Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 65, 25, 40, 24);
|
||||
scr->cmykIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* HSB Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 0, 57, 40, 24);
|
||||
scr->hsbIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* CustomColorPalette Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 81, 57, 40, 24);
|
||||
scr->customPaletteIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
/* ColorList Icon for ColorPanel */
|
||||
tmp = RGetSubImage(image, 41, 57, 40, 24);
|
||||
scr->colorListIcon = WMCreatePixmapFromRImage(scr, tmp, 128);
|
||||
RDestroyImage(tmp);
|
||||
|
||||
RDestroyImage(image);
|
||||
|
||||
#if 0
|
||||
scr->defaultObjectIcon =
|
||||
WMCreatePixmapFromFile(scr, DEFAULT_OBJECT_ICON_FILE);
|
||||
WMCreatePixmapFromFile(scr, T_DEFAULT_OBJECT_ICON_FILE);
|
||||
if (!scr->defaultObjectIcon) {
|
||||
scr->defaultObjectIcon =
|
||||
WMCreatePixmapFromFile(scr, X_DEFAULT_OBJECT_ICON_FILE);
|
||||
}
|
||||
if (!scr->defaultObjectIcon) {
|
||||
wwarning("WINGs: could not load default icon file");
|
||||
return False;
|
||||
@@ -482,12 +546,36 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
XGCValues gcv;
|
||||
Pixmap stipple;
|
||||
static int initialized = 0;
|
||||
static char *atomNames[] = {
|
||||
"_GNUSTEP_WM_ATTR",
|
||||
"WM_DELETE_WINDOW",
|
||||
"WM_PROTOCOLS",
|
||||
"CLIPBOARD",
|
||||
"XdndAware",
|
||||
"XdndSelection",
|
||||
"XdndEnter",
|
||||
"XdndLeave",
|
||||
"XdndPosition",
|
||||
"XdndDrop",
|
||||
"XdndFinished",
|
||||
"XdndTypeList",
|
||||
"XdndActionCopy",
|
||||
"XdndActionMove",
|
||||
"XdndActionLink",
|
||||
"XdndActionAsk",
|
||||
"XdndActionPrivate",
|
||||
"XdndStatus",
|
||||
"_WINGS_DND_MOUSE_OFFSET",
|
||||
"WM_STATE"
|
||||
};
|
||||
Atom atoms[sizeof(atomNames)/sizeof(char*)];
|
||||
int i = 0;
|
||||
|
||||
if (!initialized) {
|
||||
|
||||
initialized = 1;
|
||||
|
||||
initProcedureTable();
|
||||
W_ReadConfigurations();
|
||||
|
||||
assert(W_ApplicationInitialized());
|
||||
}
|
||||
@@ -512,6 +600,7 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
|
||||
scrPtr->rootWin = RootWindow(display, screen);
|
||||
|
||||
scrPtr->fontCache = WMCreateHashTable(WMStringPointerHashCallbacks);
|
||||
|
||||
/* initially allocate some colors */
|
||||
WMWhiteColor(scrPtr);
|
||||
@@ -523,6 +612,7 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
|
||||
gcv.function = GXxor;
|
||||
gcv.foreground = W_PIXEL(scrPtr->white);
|
||||
if (gcv.foreground == 0) gcv.foreground = 1;
|
||||
scrPtr->xorGC = XCreateGC(display, W_DRAWABLE(scrPtr), GCFunction
|
||||
|GCGraphicsExposures|GCForeground, &gcv);
|
||||
|
||||
@@ -559,12 +649,25 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
/* we need a 1bpp drawable for the monoGC, so borrow this one */
|
||||
scrPtr->monoGC = XCreateGC(display, stipple, 0, NULL);
|
||||
|
||||
XFreePixmap(display, stipple);
|
||||
scrPtr->stipple = stipple;
|
||||
|
||||
scrPtr->useMultiByte = WINGsConfiguration.useMultiByte;
|
||||
|
||||
scrPtr->normalFont = WMSystemFontOfSize(scrPtr, 12);
|
||||
scrPtr->normalFont = WMSystemFontOfSize(scrPtr,
|
||||
WINGsConfiguration.defaultFontSize);
|
||||
|
||||
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr, 12);
|
||||
scrPtr->boldFont = WMBoldSystemFontOfSize(scrPtr,
|
||||
WINGsConfiguration.defaultFontSize);
|
||||
|
||||
if (!scrPtr->boldFont)
|
||||
scrPtr->boldFont = scrPtr->normalFont;
|
||||
|
||||
if (!scrPtr->normalFont) {
|
||||
wwarning("could not load any fonts. Make sure your font installation"
|
||||
"and locale settings are correct.");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scrPtr->checkButtonImageOn = makePixmap(scrPtr, CHECK_BUTTON_ON,
|
||||
CHECK_BUTTON_ON_WIDTH,
|
||||
@@ -635,28 +738,101 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context)
|
||||
scrPtr->pullDownIndicator = makePixmap(scrPtr, PULLDOWN_INDICATOR,
|
||||
PULLDOWN_INDICATOR_WIDTH,
|
||||
PULLDOWN_INDICATOR_HEIGHT, True);
|
||||
|
||||
scrPtr->checkMark = makePixmap(scrPtr, CHECK_MARK,
|
||||
CHECK_MARK_WIDTH,
|
||||
CHECK_MARK_HEIGHT, True);
|
||||
|
||||
loadPixmaps(scrPtr);
|
||||
|
||||
scrPtr->defaultCursor = XCreateFontCursor(display, XC_left_ptr);
|
||||
|
||||
scrPtr->textCursor = XCreateFontCursor(display, XC_xterm);
|
||||
|
||||
scrPtr->internalMessage = XInternAtom(display, "_WINGS_MESSAGE", False);
|
||||
{
|
||||
XColor bla;
|
||||
Pixmap blank;
|
||||
|
||||
scrPtr->attribsAtom = XInternAtom(display, "_GNUSTEP_WM_ATTR", False);
|
||||
blank = XCreatePixmap(display, scrPtr->stipple, 1, 1, 1);
|
||||
XSetForeground(display, scrPtr->monoGC, 0);
|
||||
XFillRectangle(display, blank, scrPtr->monoGC, 0, 0, 1, 1);
|
||||
|
||||
scrPtr->deleteWindowAtom = XInternAtom(display, "WM_DELETE_WINDOW", False);
|
||||
scrPtr->invisibleCursor = XCreatePixmapCursor(display, blank, blank,
|
||||
&bla, &bla, 0, 0);
|
||||
XFreePixmap(display, blank);
|
||||
}
|
||||
|
||||
scrPtr->protocolsAtom = XInternAtom(display, "WM_PROTOCOLS", False);
|
||||
#ifdef HAVE_XINTERNATOMS
|
||||
XInternAtoms(display, atomNames, sizeof(atomNames)/sizeof(char*), False,
|
||||
atoms);
|
||||
#else
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < sizeof(atomNames)/sizeof(char*); i++) {
|
||||
atoms[i] = XInternAtom(display, atomNames[i], False);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
scrPtr->clipboardAtom = XInternAtom(display, "CLIPBOARD", False);
|
||||
i = 0;
|
||||
scrPtr->attribsAtom = atoms[i++];
|
||||
|
||||
scrPtr->deleteWindowAtom = atoms[i++];
|
||||
|
||||
scrPtr->protocolsAtom = atoms[i++];
|
||||
|
||||
scrPtr->clipboardAtom = atoms[i++];
|
||||
|
||||
scrPtr->xdndAwareAtom = atoms[i++];
|
||||
scrPtr->xdndSelectionAtom = atoms[i++];
|
||||
scrPtr->xdndEnterAtom = atoms[i++];
|
||||
scrPtr->xdndLeaveAtom = atoms[i++];
|
||||
scrPtr->xdndPositionAtom = atoms[i++];
|
||||
scrPtr->xdndDropAtom = atoms[i++];
|
||||
scrPtr->xdndFinishedAtom = atoms[i++];
|
||||
scrPtr->xdndTypeListAtom = atoms[i++];
|
||||
scrPtr->xdndStatusAtom = atoms[i++];
|
||||
|
||||
scrPtr->xdndActionCopy = atoms[i++];
|
||||
scrPtr->xdndActionMove = atoms[i++];
|
||||
scrPtr->xdndActionLink = atoms[i++];
|
||||
scrPtr->xdndActionAsk = atoms[i++];
|
||||
scrPtr->xdndActionPrivate = atoms[i++];
|
||||
|
||||
scrPtr->wmIconDragOffsetAtom = atoms[i++];
|
||||
|
||||
scrPtr->wmStateAtom = atoms[i++];
|
||||
|
||||
scrPtr->rootView = W_CreateRootView(scrPtr);
|
||||
|
||||
|
||||
scrPtr->balloon = W_CreateBalloon(scrPtr);
|
||||
|
||||
|
||||
W_InitApplication(scrPtr);
|
||||
|
||||
return scrPtr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMSetWidgetDefaultFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
WMReleaseFont(scr->normalFont);
|
||||
scr->normalFont = WMRetainFont(font);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetWidgetDefaultBoldFont(WMScreen *scr, WMFont *font)
|
||||
{
|
||||
WMReleaseFont(scr->boldFont);
|
||||
scr->boldFont = WMRetainFont(font);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
WMHangData(WMWidget *widget, void *data)
|
||||
{
|
||||
@@ -675,6 +851,7 @@ WMGetHangedData(WMWidget *widget)
|
||||
void
|
||||
WMDestroyWidget(WMWidget *widget)
|
||||
{
|
||||
W_UnmapView(W_VIEW(widget));
|
||||
W_DestroyView(W_VIEW(widget));
|
||||
}
|
||||
|
||||
@@ -704,6 +881,13 @@ WMMapWidget(WMWidget *w)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMReparentWidget(WMWidget *w, WMWidget *newParent, int x, int y)
|
||||
{
|
||||
W_ReparentView(W_VIEW(w), newParent, x, y);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
makeChildrenAutomap(W_View *view, int flag)
|
||||
{
|
||||
@@ -750,79 +934,55 @@ WMUnmapWidget(WMWidget *w)
|
||||
}
|
||||
|
||||
|
||||
Bool
|
||||
WMWidgetIsMapped(WMWidget *w)
|
||||
{
|
||||
return W_VIEW(w)->flags.mapped;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetWidgetBackgroundColor(WMWidget *w, WMColor *color)
|
||||
{
|
||||
if (W_CLASS(w) < WC_UserWidget
|
||||
&& procedureTables[W_CLASS(w)]->setBackgroundColor) {
|
||||
|
||||
(*procedureTables[W_CLASS(w)]->setBackgroundColor)(w, color);
|
||||
|
||||
} else if (W_CLASS(w) >= WC_UserWidget
|
||||
&& userProcedureTable[W_CLASS(w)-WC_UserWidget]->setBackgroundColor) {
|
||||
|
||||
(*userProcedureTable[W_CLASS(w)-WC_UserWidget]->setBackgroundColor)(w, color);
|
||||
|
||||
} else {
|
||||
W_SetViewBackgroundColor(W_VIEW(w), color);
|
||||
}
|
||||
if (W_VIEW(w)->flags.mapped)
|
||||
WMRedisplayWidget(w);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMRaiseWidget(WMWidget *w)
|
||||
{
|
||||
W_RaiseView(W_VIEW(w));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMLowerWidget(WMWidget *w)
|
||||
{
|
||||
W_LowerView(W_VIEW(w));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMMoveWidget(WMWidget *w, int x, int y)
|
||||
{
|
||||
if (W_CLASS(w) < WC_UserWidget
|
||||
&& procedureTables[W_CLASS(w)]->move) {
|
||||
|
||||
(*procedureTables[W_CLASS(w)]->move)(w, x, y);
|
||||
|
||||
} else if (W_CLASS(w) >= WC_UserWidget
|
||||
&& userProcedureTable[W_CLASS(w)-WC_UserWidget]->move) {
|
||||
|
||||
(*userProcedureTable[W_CLASS(w)-WC_UserWidget]->move)(w, x, y);
|
||||
|
||||
} else {
|
||||
W_MoveView(W_VIEW(w), x, y);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMResizeWidget(WMWidget *w, unsigned int width, unsigned int height)
|
||||
{
|
||||
if (W_CLASS(w) < WC_UserWidget
|
||||
&& procedureTables[W_CLASS(w)]->resize) {
|
||||
|
||||
(*procedureTables[W_CLASS(w)]->resize)(w, width, height);
|
||||
|
||||
} else if (W_CLASS(w) >= WC_UserWidget
|
||||
&& userProcedureTable[W_CLASS(w)-WC_UserWidget]->resize) {
|
||||
|
||||
(*userProcedureTable[W_CLASS(w)-WC_UserWidget]->resize)(w, width, height);
|
||||
|
||||
} else {
|
||||
W_ResizeView(W_VIEW(w), width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
W_Class
|
||||
W_RegisterUserWidget(W_ViewProcedureTable *procTable)
|
||||
W_RegisterUserWidget(void)
|
||||
{
|
||||
W_ViewProcedureTable **newTable;
|
||||
|
||||
userWidgetCount++;
|
||||
newTable = wmalloc(sizeof(W_ViewProcedureTable*)*userWidgetCount);
|
||||
memcpy(newTable, userProcedureTable,
|
||||
sizeof(W_ViewProcedureTable*)*(userWidgetCount-1));
|
||||
|
||||
newTable[userWidgetCount-1] = procTable;
|
||||
|
||||
free(userProcedureTable);
|
||||
|
||||
userProcedureTable = newTable;
|
||||
|
||||
return userWidgetCount + WC_UserWidget - 1;
|
||||
}
|
||||
@@ -886,6 +1046,27 @@ WMScreenDisplay(WMScreen *scr)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
WMScreenDepth(WMScreen *scr)
|
||||
{
|
||||
return scr->depth;
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
WMScreenWidth(WMScreen *scr)
|
||||
{
|
||||
return scr->rootView->size.width;
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
WMScreenHeight(WMScreen *scr)
|
||||
{
|
||||
return scr->rootView->size.height;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMRedisplayWidget(WMWidget *w)
|
||||
{
|
||||
|
||||
@@ -29,14 +29,6 @@ typedef struct W_Label {
|
||||
} Label;
|
||||
|
||||
|
||||
|
||||
W_ViewProcedureTable _LabelViewProcedures = {
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 60
|
||||
#define DEFAULT_HEIGHT 14
|
||||
#define DEFAULT_ALIGNMENT WALeft
|
||||
@@ -63,7 +55,7 @@ WMCreateLabel(WMWidget *parent)
|
||||
|
||||
lPtr->view = W_CreateView(W_VIEW(parent));
|
||||
if (!lPtr->view) {
|
||||
free(lPtr);
|
||||
wfree(lPtr);
|
||||
return NULL;
|
||||
}
|
||||
lPtr->view->self = lPtr;
|
||||
@@ -77,6 +69,7 @@ WMCreateLabel(WMWidget *parent)
|
||||
lPtr->flags.alignment = DEFAULT_ALIGNMENT;
|
||||
lPtr->flags.relief = DEFAULT_RELIEF;
|
||||
lPtr->flags.imagePosition = DEFAULT_IMAGE_POSITION;
|
||||
lPtr->flags.noWrap = 1;
|
||||
|
||||
return lPtr;
|
||||
}
|
||||
@@ -99,6 +92,20 @@ WMSetLabelImage(WMLabel *lPtr, WMPixmap *image)
|
||||
}
|
||||
|
||||
|
||||
WMPixmap*
|
||||
WMGetLabelImage(WMLabel *lPtr)
|
||||
{
|
||||
return lPtr->image;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
WMGetLabelText(WMLabel *lPtr)
|
||||
{
|
||||
return lPtr->caption;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
WMSetLabelImagePosition(WMLabel *lPtr, WMImagePosition position)
|
||||
{
|
||||
@@ -133,7 +140,7 @@ void
|
||||
WMSetLabelText(WMLabel *lPtr, char *text)
|
||||
{
|
||||
if (lPtr->caption)
|
||||
free(lPtr->caption);
|
||||
wfree(lPtr->caption);
|
||||
|
||||
if (text!=NULL) {
|
||||
lPtr->caption = wstrdup(text);
|
||||
@@ -168,6 +175,10 @@ WMSetLabelTextColor(WMLabel *lPtr, WMColor *color)
|
||||
if (lPtr->textColor)
|
||||
WMReleaseColor(lPtr->textColor);
|
||||
lPtr->textColor = WMRetainColor(color);
|
||||
|
||||
if (lPtr->view->flags.realized) {
|
||||
paintLabel(lPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -189,9 +200,9 @@ paintLabel(Label *lPtr)
|
||||
GC gc;
|
||||
|
||||
if (lPtr->textColor)
|
||||
gc = W_GC(lPtr->textColor);
|
||||
gc = WMColorGC(lPtr->textColor);
|
||||
else
|
||||
gc = W_GC(scrPtr->black);
|
||||
gc = WMColorGC(scrPtr->black);
|
||||
|
||||
W_PaintTextAndImage(lPtr->view, !lPtr->flags.noWrap, gc,
|
||||
(lPtr->font!=NULL ? lPtr->font : scrPtr->normalFont),
|
||||
@@ -231,7 +242,7 @@ destroyLabel(Label *lPtr)
|
||||
WMReleaseColor(lPtr->textColor);
|
||||
|
||||
if (lPtr->caption)
|
||||
free(lPtr->caption);
|
||||
wfree(lPtr->caption);
|
||||
|
||||
if (lPtr->font)
|
||||
WMReleaseFont(lPtr->font);
|
||||
@@ -239,5 +250,5 @@ destroyLabel(Label *lPtr)
|
||||
if (lPtr->image)
|
||||
WMReleasePixmap(lPtr->image);
|
||||
|
||||
free(lPtr);
|
||||
wfree(lPtr);
|
||||
}
|
||||
|
||||
1056
WINGs/wlist.c
1056
WINGs/wlist.c
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user