Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch keysym-unicode Excluding Merge-Ins
This is equivalent to a diff from 32a9cba0 to 2c5f7ee6
2020-11-16
| ||
08:45 | Implement TIP #588: Unicode for (X11) keysyms check-in: 56b8997e user: jan.nijtmans tags: trunk, main | |
2020-11-05
| ||
10:15 | Merge trunk Closed-Leaf check-in: 2c5f7ee6 user: jan.nijtmans tags: keysym-unicode | |
2020-11-04
| ||
16:03 | Merge 8.6 check-in: 6ed077cb user: jan.nijtmans tags: trunk, main | |
2020-10-28
| ||
14:56 | Merge 8.7 check-in: 550de7ca user: jan.nijtmans tags: keysym-unicode | |
2020-10-27
| ||
07:08 | Rename "trunk" to "main". Add "trunk" propagating tag for backwards compatibility check-in: 0f77b70d user: jan.nijtmans tags: trunk, main | |
01:25 | Merge 8.6 Closed-Leaf check-in: 32a9cba0 user: marc_culler tags: trunk | |
2020-10-26
| ||
08:58 | Merge 8.6 check-in: 88e0ce57 user: jan.nijtmans tags: trunk | |
2020-10-25
| ||
20:11 | Adjustment for Sierra. Closed-Leaf check-in: 77a51c32 user: culler tags: bug-5cc72e002c | |
Changes to .travis.yml.
︙ | ︙ | |||
177 178 179 180 181 182 183 | - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - name: "macOS/Clang++/Xcode 12/Shared" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib CC=clang++ --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-D__private_extern__=extern" | < < < < < < < < < < < < < < < < | | | | | | < < < < < < < < < < < < | 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include" - name: "macOS/Clang++/Xcode 12/Shared" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib CC=clang++ --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-D__private_extern__=extern" - name: "macOS/Xcode 12/Static" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --disable-shared CFLAGS=-I/usr/local/opt/tcl-tk/include" - name: "macOS/Xcode 12/Debug" os: osx osx_image: xcode12 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua --enable-symbols CFLAGS=-I/usr/local/opt/tcl-tk/include" # - name: "macOS/Xcode 12/Shared/XQuartz" # os: osx # osx_image: xcode12 # env: # - BUILD_DIR=unix # - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --disable-corefoundation --x-includes=/opt/X11/include --x-libraries=/opt/X11/lib CFLAGS=-I/usr/local/opt/tcl-tk/include" # Older MacOS versions - name: "macOS/Xcode 11/Shared" os: osx osx_image: xcode11.7 env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" - name: "macOS/Xcode 10/Shared" os: osx osx_image: xcode10.3 addons: homebrew: packages: - tcl-tk update: true env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.14" - name: "macOS/Xcode 9/Shared" os: osx osx_image: xcode9.4 addons: homebrew: packages: - tcl-tk update: true env: - BUILD_DIR=unix - CFGOPT="--with-tcl=/usr/local/opt/tcl-tk/lib --enable-aqua CFLAGS=-I/usr/local/opt/tcl-tk/include CPPFLAGS=-mmacosx-version-min=10.13" # Test on Windows with MSVC native # - name: "Windows/MSVC/Shared" # os: windows # compiler: cl # env: &vcenv # - BUILD_DIR=win # - VCDIR="/C/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Auxiliary/Build" |
︙ | ︙ |
Changes to doc/keysyms.n.
︙ | ︙ | |||
8 9 10 11 12 13 14 | '\" Note: do not modify the .SH NAME line immediately below! .SH NAME keysyms \- keysyms recognized by Tk .BE .SH DESCRIPTION .PP Tk recognizes many keysyms when specifying key bindings (e.g., | | | > > | | | | < | | | | | < | | > | < | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | '\" Note: do not modify the .SH NAME line immediately below! .SH NAME keysyms \- keysyms recognized by Tk .BE .SH DESCRIPTION .PP Tk recognizes many keysyms when specifying key bindings (e.g., .QW "\fBbind\fR \fB. <\fR\fIkeysym\fR\fB>\fR" ). The following list enumerates the keysyms that will be recognized by Tk. Note that not all keysyms will be valid on all platforms, and some keysyms are also available on platforms that have a different native name for that key. For example, on Unix systems, the presence of a particular keysym is dependent on the configuration of the keyboard modifier map. This list shows keysyms along with their decimal and hexadecimal values. .PP .CS space 32 0x20 ! (exclam) 33 0x21 quotedbl 34 0x22 numbersign 35 0x23 dollar 36 0x24 % (percent) 37 0x25 & (ampersand) 38 0x26 ' (apostrophe) 39 0x27 ( (parenleft) 40 0x28 ) (parenright) 41 0x29 * (asterisk) 42 0x2A + (plus) 43 0x2B , (comma) 44 0x2C minus 45 0x2D . (period) 46 0x2E / (slash) 47 0x2F 0 48 0x30 1 49 0x31 2 50 0x32 3 51 0x33 4 52 0x34 5 53 0x35 6 54 0x36 7 55 0x37 8 56 0x38 9 57 0x39 : (colon) 58 0x3A semicolon 59 0x3B less 60 0x3C = (equal) 61 0x3D greater 62 0x3E ? (question) 63 0x3F @ (at) 64 0x40 A 65 0x41 B 66 0x42 C 67 0x43 D 68 0x44 E 69 0x45 F 70 0x46 G 71 0x47 |
︙ | ︙ | |||
81 82 83 84 85 86 87 | W 87 0x57 X 88 0x58 Y 89 0x59 Z 90 0x5A bracketleft 91 0x5B backslash 92 0x5C bracketright 93 0x5D | | > | < | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | W 87 0x57 X 88 0x58 Y 89 0x59 Z 90 0x5A bracketleft 91 0x5B backslash 92 0x5C bracketright 93 0x5D ^ (asciicircum) 94 0x5E _ (underscore) 95 0x5F ` (grave) 96 0x60 a 97 0x61 b 98 0x62 c 99 0x63 d 100 0x64 e 101 0x65 f 102 0x66 g 103 0x67 |
︙ | ︙ | |||
111 112 113 114 115 116 117 | u 117 0x75 v 118 0x76 w 119 0x77 x 120 0x78 y 121 0x79 z 122 0x7A braceleft 123 0x7B | | | < | | | < < | | | | | > | > > < | | < | | | | | < | | > | > | | > | | > | | < < | | | | | | < | | | | | | | | | | | | > | > < | | < | | < | | | | | | | | | > | | | | > > < | < < | | | | | | | | > | | | | | | > | | | > | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | u 117 0x75 v 118 0x76 w 119 0x77 x 120 0x78 y 121 0x79 z 122 0x7A braceleft 123 0x7B | (bar) 124 0x7C braceright 125 0x7D ~ (asciitilde) 126 0x7E nobreakspace 160 0xA0 \[r!] (exclamdown) 161 0xA1 \[ct] (cent) 162 0xA2 \[Po] (sterling) 163 0xA3 \[Cs] (currency) 164 0xA4 \[Ye] (yen) 165 0xA5 \[bb] (brokenbar) 166 0xA6 \[sc] (section) 167 0xA7 \[ad] (diaeresis) 168 0xA8 \[co] (copyright) 169 0xA9 \[Of] (ordfeminine) 170 0xAA \[Fo] (guillemotleft) 171 0xAB \[no] (notsign) 172 0xAC hyphen 173 0xAD \[rg] (registered) 174 0xAE \[a-] (macron) 175 0xAF \[de] (degree) 176 0xB0 \[+-] (plusminus) 177 0xB1 [S2] (twosuperior) 178 0xB2 \[S3] (threesuperior) 179 0xB3 \[aa] (acute) 180 0xB4 \[mc] (mu) 181 0xB5 \[ps] (paragraph) 182 0xB6 \[pc] (periodcentered) 183 0xB7 \[ac] (cedilla) 184 0xB8 \[S1] (onesuperior) 185 0xB9 \[Om] (masculine) 186 0xBA \[Fc] (guillemotright) 187 0xBB \[14] (onequarter) 188 0xBC \[12] (onehalf) 189 0xBD \[34] (threequarters) 190 0xBE \[r?] (questiondown) 191 0xBF \[`A] (Agrave) 192 0xC0 \['A] (Aacute) 193 0xC1 \[^A] (Acircumflex) 194 0xC2 \[~A] (Atilde) 195 0xC3 \[:A] (Adiaeresis) 196 0xC4 \[oA] (Aring) 197 0xC5 \[AE] (AE) 198 0xC6 \[,C] (Ccedilla) 199 0xC7 \[`E] (Egrave) 200 0xC8 \['E] (Eacute) 201 0xC9 \[^E] (Ecircumflex) 202 0xCA \[:E] (Ediaeresis) 203 0xCB \[`I] (Igrave) 204 0xCC \['I] (Iacute) 205 0xCD \[^I] (Icircumflex) 206 0xCE \[:I] (Idiaeresis) 207 0xCF \[-D] (ETH) 208 0xD0 \[~N] (Ntilde) 209 0xD1 \[`O] (Ograve) 210 0xD2 \['O] (Oacute) 211 0xD3 \[^O] (Ocircumflex) 212 0xD4 \[~O] (Otilde) 213 0xD5 \[:O] (Odiaeresis) 214 0xD6 \[mu] (multiply) 215 0xD7 \[/O] (Oslash) 216 0xD8 \[`U] (Ugrave) 217 0xD9 \['U] (Uacute) 218 0xDA \[^U] (Ucircumflex) 219 0xDB \[:U] (Udiaeresis) 220 0xDC \['Y] (Yacute) 221 0xDD \[TP] (THORN) 222 0xDE \[ss] (ssharp) 223 0xDF \[`a] (agrave) 224 0xE0 \['a] (aacute) 225 0xE1 \[^a] (acircumflex) 226 0xE2 \[~a] (atilde) 227 0xE3 \[:a] (adiaeresis) 228 0xE4 \[oa] (aring) 229 0xE5 \[ae] (ae) 230 0xE6 \[,c] (ccedilla) 231 0xE7 \[`e] (egrave) 232 0xE8 \['e] (eacute) 233 0xE9 \[^e] (ecircumflex) 234 0xEA \[:e] (ediaeresis) 235 0xEB \[`i] (igrave) 236 0xEC \['i] (iacute) 237 0xED \[^i] (icircumflex) 238 0xEE \[:i] (idiaeresis) 239 0xEF \[Sd] (eth) 240 0xF0 \[~n] (ntilde) 241 0xF1 \[`o] (ograve) 242 0xF2 \['o] (oacute) 243 0xF3 \[^o] (ocircumflex) 244 0xF4 \[~o] (otilde) 245 0xF5 \[:o] (odiaeresis) 246 0xF6 \[di] (division) 247 0xF7 \[/o] (oslash) 248 0xF8 \[`u] (ugrave) 249 0xF9 \['u] (uacute) 250 0xFA \[^u] (ucircumflex) 251 0xFB \[:u] (udiaeresis) 252 0xFC \['y] (yacute) 253 0xFD \[Tp] (thorn) 254 0xFE \[:y] (ydiaeresis) 255 0xFF Aogonek 417 0x1A1 breve 418 0x1A2 Lstroke 419 0x1A3 Lcaron 421 0x1A5 Sacute 422 0x1A6 Scaron 425 0x1A9 Scedilla 426 0x1AA |
︙ | ︙ | |||
990 991 992 993 994 995 996 | Hangul_J_PanSios 3832 0xEF8 Hangul_J_KkogjiDalrinIeung 3833 0xEF9 Hangul_J_YeorinHieuh 3834 0xEFA Korean_Won 3839 0xEFF OE 5052 0x13BC oe 5053 0x13BD Ydiaeresis 5054 0x13BE | | | 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 | Hangul_J_PanSios 3832 0xEF8 Hangul_J_KkogjiDalrinIeung 3833 0xEF9 Hangul_J_YeorinHieuh 3834 0xEFA Korean_Won 3839 0xEFF OE 5052 0x13BC oe 5053 0x13BD Ydiaeresis 5054 0x13BE € (EuroSign) 8364 0x20AC 3270_Duplicate 64769 0xFD01 3270_FieldMark 64770 0xFD02 3270_Right2 64771 0xFD03 3270_Left2 64772 0xFD04 3270_BackTab 64773 0xFD05 3270_EraseEOF 64774 0xFD06 3270_EraseInput 64775 0xFD07 |
︙ | ︙ | |||
1324 1325 1326 1327 1328 1329 1330 | braille_dot_5 65525 0xFFF5 braille_dot_6 65526 0xFFF6 braille_dot_7 65527 0xFFF7 braille_dot_8 65528 0xFFF8 braille_dot_9 65529 0xFFF9 braille_dot_10 65530 0xFFFA Delete 65535 0xFFFF | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 | braille_dot_5 65525 0xFFF5 braille_dot_6 65526 0xFFF6 braille_dot_7 65527 0xFFF7 braille_dot_8 65528 0xFFF8 braille_dot_9 65529 0xFFF9 braille_dot_10 65530 0xFFFA Delete 65535 0xFFFF SunFA_Grave 268828416 0x1005FF00 SunFA_Circum 268828417 0x1005FF01 SunFA_Tilde 268828418 0x1005FF02 SunFA_Acute 268828419 0x1005FF03 SunFA_Diaeresis 268828420 0x1005FF04 SunFA_Cedilla 268828421 0x1005FF05 SunF36 268828432 0x1005FF10 |
︙ | ︙ |
Changes to doc/listbox.n.
︙ | ︙ | |||
559 560 561 562 563 564 565 | extend the selection to the active element just as if button 1 had been pressed with the Shift key down. .IP [16] In \fBextended\fR mode, the Escape key cancels the most recent selection and restores all the elements in the selected range to their previous selection state. .IP [17] | | | 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | extend the selection to the active element just as if button 1 had been pressed with the Shift key down. .IP [16] In \fBextended\fR mode, the Escape key cancels the most recent selection and restores all the elements in the selected range to their previous selection state. .IP [17] Control-/ selects everything in the widget, except in \fBsingle\fR and \fBbrowse\fR modes, in which case it selects the active element and deselects everything else. .IP [18] Control-backslash deselects everything in the widget, except in \fBbrowse\fR mode where it has no effect. .IP [19] The F16 key (labelled Copy on many Sun workstations) or Meta-w |
︙ | ︙ |
Changes to generic/ks_names.h.
︙ | ︙ | |||
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | { "3270_ChangeScreen", 0xFD19 }, { "3270_DeleteWord", 0xFD1A }, { "3270_ExSelect", 0xFD1B }, { "3270_CursorSelect", 0xFD1C }, { "3270_PrintScreen", 0xFD1D }, { "3270_Enter", 0xFD1E }, { "space", 0x20 }, { "exclam", 0x21 }, { "quotedbl", 0x22 }, { "numbersign", 0x23 }, { "dollar", 0x24 }, { "percent", 0x25 }, { "ampersand", 0x26 }, { "apostrophe", 0x27 }, { "quoteright", 0x27 }, { "parenleft", 0x28 }, { "parenright", 0x29 }, { "asterisk", 0x2A }, { "plus", 0x2B }, { "comma", 0x2C }, { "minus", 0x2D }, { "period", 0x2E }, { "slash", 0x2F }, { "0", 0x30 }, { "1", 0x31 }, { "2", 0x32 }, { "3", 0x33 }, { "4", 0x34 }, { "5", 0x35 }, { "6", 0x36 }, { "7", 0x37 }, { "8", 0x38 }, { "9", 0x39 }, { "colon", 0x3A }, { "semicolon", 0x3B }, { "less", 0x3C }, { "equal", 0x3D }, { "greater", 0x3E }, { "question", 0x3F }, { "at", 0x40 }, { "A", 0x41 }, { "B", 0x42 }, { "C", 0x43 }, { "D", 0x44 }, { "E", 0x45 }, | > > > > > > > > > | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | { "3270_ChangeScreen", 0xFD19 }, { "3270_DeleteWord", 0xFD1A }, { "3270_ExSelect", 0xFD1B }, { "3270_CursorSelect", 0xFD1C }, { "3270_PrintScreen", 0xFD1D }, { "3270_Enter", 0xFD1E }, { "space", 0x20 }, #ifndef TK_NO_DEPRECATED { "exclam", 0x21 }, #endif { "quotedbl", 0x22 }, { "numbersign", 0x23 }, { "dollar", 0x24 }, #ifndef TK_NO_DEPRECATED { "percent", 0x25 }, { "ampersand", 0x26 }, { "apostrophe", 0x27 }, { "quoteright", 0x27 }, { "parenleft", 0x28 }, { "parenright", 0x29 }, { "asterisk", 0x2A }, { "plus", 0x2B }, { "comma", 0x2C }, #endif { "minus", 0x2D }, #ifndef TK_NO_DEPRECATED { "period", 0x2E }, { "slash", 0x2F }, { "0", 0x30 }, { "1", 0x31 }, { "2", 0x32 }, { "3", 0x33 }, { "4", 0x34 }, { "5", 0x35 }, { "6", 0x36 }, { "7", 0x37 }, { "8", 0x38 }, { "9", 0x39 }, { "colon", 0x3A }, #endif { "semicolon", 0x3B }, { "less", 0x3C }, #ifndef TK_NO_DEPRECATED { "equal", 0x3D }, #endif { "greater", 0x3E }, #ifndef TK_NO_DEPRECATED { "question", 0x3F }, { "at", 0x40 }, { "A", 0x41 }, { "B", 0x42 }, { "C", 0x43 }, { "D", 0x44 }, { "E", 0x45 }, |
︙ | ︙ | |||
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | { "T", 0x54 }, { "U", 0x55 }, { "V", 0x56 }, { "W", 0x57 }, { "X", 0x58 }, { "Y", 0x59 }, { "Z", 0x5A }, { "bracketleft", 0x5B }, { "backslash", 0x5C }, { "bracketright", 0x5D }, { "asciicircum", 0x5E }, { "underscore", 0x5F }, { "grave", 0x60 }, { "quoteleft", 0x60 }, { "a", 0x61 }, { "b", 0x62 }, { "c", 0x63 }, | > > | 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | { "T", 0x54 }, { "U", 0x55 }, { "V", 0x56 }, { "W", 0x57 }, { "X", 0x58 }, { "Y", 0x59 }, { "Z", 0x5A }, #endif { "bracketleft", 0x5B }, { "backslash", 0x5C }, { "bracketright", 0x5D }, #ifndef TK_NO_DEPRECATED { "asciicircum", 0x5E }, { "underscore", 0x5F }, { "grave", 0x60 }, { "quoteleft", 0x60 }, { "a", 0x61 }, { "b", 0x62 }, { "c", 0x63 }, |
︙ | ︙ | |||
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 | { "t", 0x74 }, { "u", 0x75 }, { "v", 0x76 }, { "w", 0x77 }, { "x", 0x78 }, { "y", 0x79 }, { "z", 0x7A }, { "braceleft", 0x7B }, { "bar", 0x7C }, { "braceright", 0x7D }, { "asciitilde", 0x7E }, { "nobreakspace", 0xA0 }, { "exclamdown", 0xA1 }, { "cent", 0xA2 }, { "sterling", 0xA3 }, { "currency", 0xA4 }, { "yen", 0xA5 }, { "brokenbar", 0xA6 }, { "section", 0xA7 }, | > > > > > > | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | { "t", 0x74 }, { "u", 0x75 }, { "v", 0x76 }, { "w", 0x77 }, { "x", 0x78 }, { "y", 0x79 }, { "z", 0x7A }, #endif { "braceleft", 0x7B }, #ifndef TK_NO_DEPRECATED { "bar", 0x7C }, #endif { "braceright", 0x7D }, #ifndef TK_NO_DEPRECATED { "asciitilde", 0x7E }, #endif { "nobreakspace", 0xA0 }, #ifndef TK_NO_DEPRECATED { "exclamdown", 0xA1 }, { "cent", 0xA2 }, { "sterling", 0xA3 }, { "currency", 0xA4 }, { "yen", 0xA5 }, { "brokenbar", 0xA6 }, { "section", 0xA7 }, |
︙ | ︙ | |||
556 557 558 559 560 561 562 563 564 565 566 567 568 569 | { "ugrave", 0xF9 }, { "uacute", 0xFA }, { "ucircumflex", 0xFB }, { "udiaeresis", 0xFC }, { "yacute", 0xFD }, { "thorn", 0xFE }, { "ydiaeresis", 0xFF }, { "Aogonek", 0x1A1 }, { "breve", 0x1A2 }, { "Lstroke", 0x1A3 }, { "Lcaron", 0x1A5 }, { "Sacute", 0x1A6 }, { "Scaron", 0x1A9 }, { "Scedilla", 0x1AA }, | > | 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 | { "ugrave", 0xF9 }, { "uacute", 0xFA }, { "ucircumflex", 0xFB }, { "udiaeresis", 0xFC }, { "yacute", 0xFD }, { "thorn", 0xFE }, { "ydiaeresis", 0xFF }, #endif /* TK_NO_DEPRECATED */ { "Aogonek", 0x1A1 }, { "breve", 0x1A2 }, { "Lstroke", 0x1A3 }, { "Lcaron", 0x1A5 }, { "Sacute", 0x1A6 }, { "Scaron", 0x1A9 }, { "Scedilla", 0x1AA }, |
︙ | ︙ | |||
676 677 678 679 680 681 682 | { "imacron", 0x3EF }, { "ncedilla", 0x3F1 }, { "omacron", 0x3F2 }, { "kcedilla", 0x3F3 }, { "uogonek", 0x3F9 }, { "utilde", 0x3FD }, { "umacron", 0x3FE }, | < < < < < < < < < < < < < < < < < < < < < < < < < < | 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | { "imacron", 0x3EF }, { "ncedilla", 0x3F1 }, { "omacron", 0x3F2 }, { "kcedilla", 0x3F3 }, { "uogonek", 0x3F9 }, { "utilde", 0x3FD }, { "umacron", 0x3FE }, { "OE", 0x13BC }, { "oe", 0x13BD }, { "Ydiaeresis", 0x13BE }, { "overline", 0x47E }, { "kana_fullstop", 0x4A1 }, { "kana_openingbracket", 0x4A2 }, { "kana_closingbracket", 0x4A3 }, |
︙ | ︙ | |||
785 786 787 788 789 790 791 | { "kana_RE", 0x4DA }, { "kana_RO", 0x4DB }, { "kana_WA", 0x4DC }, { "kana_N", 0x4DD }, { "voicedsound", 0x4DE }, { "semivoicedsound", 0x4DF }, { "kana_switch", 0xFF7E }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 777 778 779 780 781 782 783 784 785 786 787 788 789 790 | { "kana_RE", 0x4DA }, { "kana_RO", 0x4DB }, { "kana_WA", 0x4DC }, { "kana_N", 0x4DD }, { "voicedsound", 0x4DE }, { "semivoicedsound", 0x4DF }, { "kana_switch", 0xFF7E }, { "Arabic_semicolon", 0x5BB }, { "Arabic_question_mark", 0x5BF }, { "Arabic_hamza", 0x5C1 }, { "Arabic_maddaonalef", 0x5C2 }, { "Arabic_hamzaonalef", 0x5C3 }, { "Arabic_hamzaonwaw", 0x5C4 }, { "Arabic_hamzaunderalef", 0x5C5 }, |
︙ | ︙ | |||
864 865 866 867 868 869 870 | { "Arabic_dammatan", 0x5EC }, { "Arabic_kasratan", 0x5ED }, { "Arabic_fatha", 0x5EE }, { "Arabic_damma", 0x5EF }, { "Arabic_kasra", 0x5F0 }, { "Arabic_shadda", 0x5F1 }, { "Arabic_sukun", 0x5F2 }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 827 828 829 830 831 832 833 834 835 836 837 838 839 840 | { "Arabic_dammatan", 0x5EC }, { "Arabic_kasratan", 0x5ED }, { "Arabic_fatha", 0x5EE }, { "Arabic_damma", 0x5EF }, { "Arabic_kasra", 0x5F0 }, { "Arabic_shadda", 0x5F1 }, { "Arabic_sukun", 0x5F2 }, { "Serbian_dje", 0x6A1 }, { "Macedonia_gje", 0x6A2 }, { "Cyrillic_io", 0x6A3 }, { "Ukrainian_ie", 0x6A4 }, #ifndef TK_NO_DEPRECATED { "Ukranian_je", 0x6A4 }, #endif |
︙ | ︙ | |||
1551 1552 1553 1554 1555 1556 1557 | { "Hangul_YeorinHieuh", 0xEF5 }, { "Hangul_AraeA", 0xEF6 }, { "Hangul_AraeAE", 0xEF7 }, { "Hangul_J_PanSios", 0xEF8 }, { "Hangul_J_KkogjiDalrinIeung", 0xEF9 }, { "Hangul_J_YeorinHieuh", 0xEFA }, { "Korean_Won", 0xEFF }, | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 | { "Hangul_YeorinHieuh", 0xEF5 }, { "Hangul_AraeA", 0xEF6 }, { "Hangul_AraeAE", 0xEF7 }, { "Hangul_J_PanSios", 0xEF8 }, { "Hangul_J_KkogjiDalrinIeung", 0xEF9 }, { "Hangul_J_YeorinHieuh", 0xEFA }, { "Korean_Won", 0xEFF }, { "braille_dot_1", 0xFFF1 }, { "braille_dot_2", 0xFFF2 }, { "braille_dot_3", 0xFFF3 }, { "braille_dot_4", 0xFFF4 }, { "braille_dot_5", 0xFFF5 }, { "braille_dot_6", 0xFFF6 }, { "braille_dot_7", 0xFFF7 }, { "braille_dot_8", 0xFFF8 }, { "braille_dot_9", 0xFFF9 }, { "braille_dot_10", 0xFFFA }, { "XF86ModeLock", 0x1008FF01 }, { "XF86MonBrightnessUp", 0x1008FF02 }, { "XF86MonBrightnessDown", 0x1008FF03 }, { "XF86KbdLightOnOff", 0x1008FF04 }, { "XF86KbdBrightnessUp", 0x1008FF05 }, { "XF86KbdBrightnessDown", 0x1008FF06 }, { "XF86MonBrightnessCycle", 0x1008FF07 }, |
︙ | ︙ |
Changes to generic/nanosvg.h.
︙ | ︙ | |||
29 30 31 32 33 34 35 | #ifndef NANOSVG_H #define NANOSVG_H #ifdef __cplusplus extern "C" { #endif | | < > | < > | < > | | < > | | < > | | < > | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #ifndef NANOSVG_H #define NANOSVG_H #ifdef __cplusplus extern "C" { #endif /* NanoSVG is a simple stupid single-header-file SVG parse. The output of the parser is a list of cubic bezier shapes. * * The library suits well for anything from rendering scalable icons in your editor application to prototyping a game. * * NanoSVG supports a wide range of SVG features, but something may be missing, feel free to create a pull request! * * The shapes in the SVG images are transformed by the viewBox and converted to specified units. * That is, you should get the same looking data as your designed in your favorite app. * * NanoSVG can return the paths in few different units. For example if you want to render an image, you may choose * to get the paths in pixels, or if you are feeding the data into a CNC-cutter, you may want to use millimeters. * * The units passed to NanoSVG should be one of: 'px', 'pt', 'pc' 'mm', 'cm', or 'in'. * DPI (dots-per-inch) controls how the unit conversion is done. * * If you don't know or care about the units stuff, "px" and 96 should get you going. */ /* Example Usage: // Load SVG NSVGimage* image; image = nsvgParseFromFile("test.svg", "px", 96); printf("size: %f x %f\n", image->width, image->height); |
︙ | ︙ | |||
81 82 83 84 85 86 87 | #define NANOSVG_realloc realloc #endif #ifndef NANOSVG_free #define NANOSVG_free free #endif | | | | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | #define NANOSVG_realloc realloc #endif #ifndef NANOSVG_free #define NANOSVG_free free #endif /* float emulation for MS VC6++ compiler */ #if defined(_MSC_VER) && (_MSC_VER == 1200) #define tanf(a) (float)tan(a) #define cosf(a) (float)cos(a) #define sinf(a) (float)sin(a) #define sqrtf(a) (float)sqrt(a) #define fabsf(a) (float)fabs(a) #define acosf(a) (float)acos(a) #define atan2f(a,b) (float)atan2(a,b) #define ceilf(a) (float)ceil(a) #define fmodf(a,b) (float)fmod(a,b) #define floorf(a) (float)floor(a) #endif /* float emulation for MS VC8++ compiler */ #if defined(_MSC_VER) && (_MSC_VER == 1400) #define fabsf(a) (float)fabs(a) #endif enum NSVGpaintType { NSVG_PAINT_NONE = 0, NSVG_PAINT_COLOR = 1, |
︙ | ︙ | |||
156 157 158 159 160 161 162 | unsigned int color; NSVGgradient* gradient; }; } NSVGpaint; typedef struct NSVGpath { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 | unsigned int color; NSVGgradient* gradient; }; } NSVGpaint; typedef struct NSVGpath { float* pts; /* Cubic bezier points: x0,y0, [cpx1,cpx1,cpx2,cpy2,x1,y1], ... */ int npts; /* Total number of bezier points. */ char closed; /* Flag indicating if shapes should be treated as closed. */ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */ struct NSVGpath* next; /* Pointer to next path, or NULL if last element. */ } NSVGpath; typedef struct NSVGshape { char id[64]; /* Optional 'id' attr of the shape or its group */ NSVGpaint fill; /* Fill paint */ NSVGpaint stroke; /* Stroke paint */ float opacity; /* Opacity of the shape. */ float strokeWidth; /* Stroke width (scaled). */ float strokeDashOffset; /* Stroke dash offset (scaled). */ float strokeDashArray[8]; /* Stroke dash array (scaled). */ char strokeDashCount; /* Number of dash values in dash array. */ char strokeLineJoin; /* Stroke join type. */ char strokeLineCap; /* Stroke cap type. */ float miterLimit; /* Miter limit */ char fillRule; /* Fill rule, see NSVGfillRule. */ unsigned char flags; /* Logical or of NSVG_FLAGS_* flags */ float bounds[4]; /* Tight bounding box of the shape [minx,miny,maxx,maxy]. */ NSVGpath* paths; /* Linked list of paths in the image. */ struct NSVGshape* next; /* Pointer to next shape, or NULL if last element. */ } NSVGshape; typedef struct NSVGimage { float width; /* Width of the image. */ float height; /* Height of the image. */ NSVGshape* shapes; /* Linked list of shapes in the image. */ } NSVGimage; /* Parses SVG file from a file, returns SVG image as paths. */ NANOSVG_SCOPE NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi); /* Parses SVG file from a null terminated string, returns SVG image as paths. */ /* Important note: changes the string. */ NANOSVG_SCOPE NSVGimage* nsvgParse(char* input, const char* units, float dpi); /* Deletes list of paths. */ NANOSVG_SCOPE void nsvgDelete(NSVGimage* image); #ifdef __cplusplus } #endif #endif /* NANOSVG_H */ #ifdef NANOSVG_IMPLEMENTATION #include <string.h> #include <stdlib.h> #include <math.h> #define NSVG_PI (3.14159265358979323846264338327f) #define NSVG_KAPPA90 (0.5522847493f) /* Length proportional to radius of a cubic bezier handle for 90deg arcs. */ #define NSVG_ALIGN_MIN 0 #define NSVG_ALIGN_MID 1 #define NSVG_ALIGN_MAX 2 #define NSVG_ALIGN_NONE 0 #define NSVG_ALIGN_MEET 1 #define NSVG_ALIGN_SLICE 2 #define NSVG_NOTUSED(v) do { (void)(1 ? (void)0 : ( (void)(v) ) ); } while(0) #define NSVG_RGB(r, g, b) (((unsigned int)r) | ((unsigned int)g << 8) | ((unsigned int)b << 16)) #ifdef _MSC_VER #pragma warning (disable: 4996) /* Switch off security warnings */ #pragma warning (disable: 4100) /* Switch off unreferenced formal parameter warnings */ #ifdef __cplusplus #define NSVG_INLINE inline #else #define NSVG_INLINE #endif #if !defined(strtoll) /* old MSVC versions do not have strtoll() */ #define strtoll _strtoi64 #endif #else #define NSVG_INLINE inline #endif |
︙ | ︙ | |||
255 256 257 258 259 260 261 | return c >= '0' && c <= '9'; } static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; } static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; } | | | | | | | | | | | | | | | | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | return c >= '0' && c <= '9'; } static NSVG_INLINE float nsvg__minf(float a, float b) { return a < b ? a : b; } static NSVG_INLINE float nsvg__maxf(float a, float b) { return a > b ? a : b; } /* Simple XML parser */ #define NSVG_XML_TAG 1 #define NSVG_XML_CONTENT 2 #define NSVG_XML_MAX_ATTRIBS 256 static void nsvg__parseContent(char* s, void (*contentCb)(void* ud, const char* s), void* ud) { /* Trim start white spaces */ while (*s && nsvg__isspace(*s)) s++; if (!*s) return; if (contentCb) (*contentCb)(ud, s); } static void nsvg__parseElement(char* s, void (*startelCb)(void* ud, const char* el, const char** attr), void (*endelCb)(void* ud, const char* el), void* ud) { const char* attr[NSVG_XML_MAX_ATTRIBS]; int nattr = 0; char* cbname; int start = 0; int end = 0; char quote; /* Skip white space after the '<' */ while (*s && nsvg__isspace(*s)) s++; /* Check if the tag is end tag */ if (*s == '/') { s++; end = 1; } else { start = 1; } /* Skip comments, data and preprocessor stuff. */ if (!*s || *s == '?' || *s == '!') return; /* Get tag name */ cbname = s; while (*s && !nsvg__isspace(*s)) s++; if (*s) { *s++ = '\0'; } /* Get attribs */ while (!end && *s && nattr < NSVG_XML_MAX_ATTRIBS-3) { char* name = NULL; char* value = NULL; /* Skip white space before the attrib name */ while (*s && nsvg__isspace(*s)) s++; if (!*s) break; if (*s == '/') { end = 1; break; } name = s; /* Find end of the attrib name. */ while (*s && !nsvg__isspace(*s) && *s != '=') s++; if (*s) { *s++ = '\0'; } /* Skip until the beginning of the value. */ while (*s && *s != '\"' && *s != '\'') s++; if (!*s) break; quote = *s; s++; /* Store value and find the end of it. */ value = s; while (*s && *s != quote) s++; if (*s) { *s++ = '\0'; } /* Store only well formed attributes */ if (name && value) { attr[nattr++] = name; attr[nattr++] = value; } } /* List terminator */ attr[nattr++] = 0; attr[nattr++] = 0; /* Call callbacks. */ if (start && startelCb) (*startelCb)(ud, cbname, attr); if (end && endelCb) (*endelCb)(ud, cbname); } NANOSVG_SCOPE int nsvg__parseXML(char* input, void (*startelCb)(void* ud, const char* el, const char** attr), void (*endelCb)(void* ud, const char* el), void (*contentCb)(void* ud, const char* s), void* ud) { char* s = input; char* mark = s; int state = NSVG_XML_CONTENT; while (*s) { if (*s == '<' && state == NSVG_XML_CONTENT) { /* Start of a tag */ *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); mark = s; state = NSVG_XML_TAG; } else if (*s == '>' && state == NSVG_XML_TAG) { /* Start of a content or new tag. */ *s++ = '\0'; nsvg__parseContent(mark, contentCb, ud); nsvg__parseElement(mark, startelCb, endelCb, ud); mark = s; state = NSVG_XML_CONTENT; } else { s++; |
︙ | ︙ | |||
611 612 613 614 615 616 617 | int i, j, count; double roots[2], a, b, c, b2ac, t, v; float* v0 = &curve[0]; float* v1 = &curve[2]; float* v2 = &curve[4]; float* v3 = &curve[6]; | | | | | | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 | int i, j, count; double roots[2], a, b, c, b2ac, t, v; float* v0 = &curve[0]; float* v1 = &curve[2]; float* v2 = &curve[4]; float* v3 = &curve[6]; /* Start the bounding box by end points */ bounds[0] = nsvg__minf(v0[0], v3[0]); bounds[1] = nsvg__minf(v0[1], v3[1]); bounds[2] = nsvg__maxf(v0[0], v3[0]); bounds[3] = nsvg__maxf(v0[1], v3[1]); /* Bezier curve fits inside the convex hull of it's control points. */ /* If control points are inside the bounds, we're done. */ if (nsvg__ptInBounds(v1, bounds) && nsvg__ptInBounds(v2, bounds)) return; /* Add bezier curve inflection points in X and Y. */ for (i = 0; i < 2; i++) { a = -3.0 * v0[i] + 9.0 * v1[i] - 9.0 * v2[i] + 3.0 * v3[i]; b = 6.0 * v0[i] - 12.0 * v1[i] + 6.0 * v2[i]; c = 3.0 * v1[i] - 3.0 * v0[i]; count = 0; if (fabs(a) < NSVG_EPSILON) { if (fabs(b) > NSVG_EPSILON) { |
︙ | ︙ | |||
664 665 666 667 668 669 670 | if (p == NULL) goto error; memset(p, 0, sizeof(NSVGparser)); p->image = (NSVGimage*)NANOSVG_malloc(sizeof(NSVGimage)); if (p->image == NULL) goto error; memset(p->image, 0, sizeof(NSVGimage)); | | | 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 | if (p == NULL) goto error; memset(p, 0, sizeof(NSVGparser)); p->image = (NSVGimage*)NANOSVG_malloc(sizeof(NSVGimage)); if (p->image == NULL) goto error; memset(p->image, 0, sizeof(NSVGimage)); /* Init style */ nsvg__xformIdentity(p->attr[0].xform); memset(p->attr[0].id, 0, sizeof p->attr[0].id); p->attr[0].fillColor = NSVG_RGB(0,0,0); p->attr[0].strokeColor = NSVG_RGB(0,0,0); p->attr[0].opacity = 1; p->attr[0].fillOpacity = 1; p->attr[0].strokeOpacity = 1; |
︙ | ︙ | |||
850 851 852 853 854 855 856 | case NSVG_UNITS_PX: return c.value; case NSVG_UNITS_PT: return c.value / 72.0f * p->dpi; case NSVG_UNITS_PC: return c.value / 6.0f * p->dpi; case NSVG_UNITS_MM: return c.value / 25.4f * p->dpi; case NSVG_UNITS_CM: return c.value / 2.54f * p->dpi; case NSVG_UNITS_IN: return c.value * p->dpi; case NSVG_UNITS_EM: return c.value * attr->fontSize; | | | 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 | case NSVG_UNITS_PX: return c.value; case NSVG_UNITS_PT: return c.value / 72.0f * p->dpi; case NSVG_UNITS_PC: return c.value / 6.0f * p->dpi; case NSVG_UNITS_MM: return c.value / 25.4f * p->dpi; case NSVG_UNITS_CM: return c.value / 2.54f * p->dpi; case NSVG_UNITS_IN: return c.value * p->dpi; case NSVG_UNITS_EM: return c.value * attr->fontSize; case NSVG_UNITS_EX: return c.value * attr->fontSize * 0.52f; /* x-height of Helvetica. */ case NSVG_UNITS_PERCENT: return orig + c.value / 100.0f * length; default: return c.value; } return c.value; } static NSVGgradientData* nsvg__findGradientData(NSVGparser* p, const char* id) |
︙ | ︙ | |||
884 885 886 887 888 889 890 | float ox, oy, sw, sh, sl; int nstops = 0; int refIter; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; | | | | | | | | 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 | float ox, oy, sw, sh, sl; int nstops = 0; int refIter; data = nsvg__findGradientData(p, id); if (data == NULL) return NULL; /* TODO: use ref to fill in all unset values too. */ ref = data; refIter = 0; while (ref != NULL) { NSVGgradientData* nextRef = NULL; if (stops == NULL && ref->stops != NULL) { stops = ref->stops; nstops = ref->nstops; break; } nextRef = nsvg__findGradientData(p, ref->ref); if (nextRef == ref) break; /* prevent infite loops on malformed data */ ref = nextRef; refIter++; if (refIter > 32) break; /* prevent infite loops on malformed data */ } if (stops == NULL) return NULL; grad = (NSVGgradient*)NANOSVG_malloc(sizeof(NSVGgradient) + sizeof(NSVGgradientStop)*(nstops-1)); if (grad == NULL) return NULL; /* The shape width and height. */ if (data->units == NSVG_OBJECT_SPACE) { ox = localBounds[0]; oy = localBounds[1]; sw = localBounds[2] - localBounds[0]; sh = localBounds[3] - localBounds[1]; } else { ox = nsvg__actualOrigX(p); oy = nsvg__actualOrigY(p); sw = nsvg__actualWidth(p); sh = nsvg__actualHeight(p); } sl = sqrtf(sw*sw + sh*sh) / sqrtf(2.0f); if (data->type == NSVG_PAINT_LINEAR_GRADIENT) { float x1, y1, x2, y2, dx, dy; x1 = nsvg__convertToPixels(p, data->linear.x1, ox, sw); y1 = nsvg__convertToPixels(p, data->linear.y1, oy, sh); x2 = nsvg__convertToPixels(p, data->linear.x2, ox, sw); y2 = nsvg__convertToPixels(p, data->linear.y2, oy, sh); /* Calculate transform aligned to the line */ dx = x2 - x1; dy = y2 - y1; grad->xform[0] = dy; grad->xform[1] = -dx; grad->xform[2] = dx; grad->xform[3] = dy; grad->xform[4] = x1; grad->xform[5] = y1; } else { float cx, cy, fx, fy, r; cx = nsvg__convertToPixels(p, data->radial.cx, ox, sw); cy = nsvg__convertToPixels(p, data->radial.cy, oy, sh); fx = nsvg__convertToPixels(p, data->radial.fx, ox, sw); fy = nsvg__convertToPixels(p, data->radial.fy, oy, sh); r = nsvg__convertToPixels(p, data->radial.r, 0, sl); /* Calculate transform aligned to the circle */ grad->xform[0] = r; grad->xform[1] = 0; grad->xform[2] = 0; grad->xform[3] = r; grad->xform[4] = cx; grad->xform[5] = cy; grad->fx = fx / r; grad->fy = fy / r; } |
︙ | ︙ | |||
1026 1027 1028 1029 1030 1031 1032 | shape->miterLimit = attr->miterLimit; shape->fillRule = attr->fillRule; shape->opacity = attr->opacity; shape->paths = p->plist; p->plist = NULL; | | | | | | | 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | shape->miterLimit = attr->miterLimit; shape->fillRule = attr->fillRule; shape->opacity = attr->opacity; shape->paths = p->plist; p->plist = NULL; /* Calculate shape bounds */ shape->bounds[0] = shape->paths->bounds[0]; shape->bounds[1] = shape->paths->bounds[1]; shape->bounds[2] = shape->paths->bounds[2]; shape->bounds[3] = shape->paths->bounds[3]; for (path = shape->paths->next; path != NULL; path = path->next) { shape->bounds[0] = nsvg__minf(shape->bounds[0], path->bounds[0]); shape->bounds[1] = nsvg__minf(shape->bounds[1], path->bounds[1]); shape->bounds[2] = nsvg__maxf(shape->bounds[2], path->bounds[2]); shape->bounds[3] = nsvg__maxf(shape->bounds[3], path->bounds[3]); } /* Set fill */ if (attr->hasFill == 0) { shape->fill.type = NSVG_PAINT_NONE; } else if (attr->hasFill == 1) { shape->fill.type = NSVG_PAINT_COLOR; shape->fill.color = attr->fillColor; shape->fill.color |= (unsigned int)(attr->fillOpacity*255) << 24; } else if (attr->hasFill == 2) { float inv[6], localBounds[4]; nsvg__xformInverse(inv, attr->xform); nsvg__getLocalBounds(localBounds, shape, inv); shape->fill.gradient = nsvg__createGradient(p, attr->fillGradient, localBounds, &shape->fill.type); if (shape->fill.gradient == NULL) { shape->fill.type = NSVG_PAINT_NONE; } } /* Set stroke */ if (attr->hasStroke == 0) { shape->stroke.type = NSVG_PAINT_NONE; } else if (attr->hasStroke == 1) { shape->stroke.type = NSVG_PAINT_COLOR; shape->stroke.color = attr->strokeColor; shape->stroke.color |= (unsigned int)(attr->strokeOpacity*255) << 24; } else if (attr->hasStroke == 2) { float inv[6], localBounds[4]; nsvg__xformInverse(inv, attr->xform); nsvg__getLocalBounds(localBounds, shape, inv); shape->stroke.gradient = nsvg__createGradient(p, attr->strokeGradient, localBounds, &shape->stroke.type); if (shape->stroke.gradient == NULL) shape->stroke.type = NSVG_PAINT_NONE; } /* Set flags */ shape->flags = ((attr->visible & NSVG_VIS_DISPLAY) && (attr->visible & NSVG_VIS_VISIBLE) ? NSVG_FLAGS_VISIBLE : 0x00); /* Add to tail */ if (p->image->shapes == NULL) p->image->shapes = shape; else p->shapesTail->next = shape; p->shapesTail = shape; return; |
︙ | ︙ | |||
1101 1102 1103 1104 1105 1106 1107 | if (p->npts < 4) return; if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); | | | | | 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | if (p->npts < 4) return; if (closed) nsvg__lineTo(p, p->pts[0], p->pts[1]); /* Expect 1 + N*3 points (N = number of cubic bezier segments). */ if ((p->npts % 3) != 1) return; path = (NSVGpath*)NANOSVG_malloc(sizeof(NSVGpath)); if (path == NULL) goto error; memset(path, 0, sizeof(NSVGpath)); path->pts = (float*)NANOSVG_malloc(p->npts*2*sizeof(float)); if (path->pts == NULL) goto error; path->closed = closed; path->npts = p->npts; /* Transform path. */ for (i = 0; i < p->npts; ++i) nsvg__xformPoint(&path->pts[i*2], &path->pts[i*2+1], p->pts[i*2], p->pts[i*2+1], attr->xform); /* Find bounds */ for (i = 0; i < path->npts-1; i += 3) { curve = &path->pts[i*2]; nsvg__curveBounds(bounds, curve); if (i == 0) { path->bounds[0] = bounds[0]; path->bounds[1] = bounds[1]; path->bounds[2] = bounds[2]; |
︙ | ︙ | |||
1147 1148 1149 1150 1151 1152 1153 | error: if (path != NULL) { if (path->pts != NULL) NANOSVG_free(path->pts); NANOSVG_free(path); } } | | | | | | | | | | | | | | | | | | | | | | 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 | error: if (path != NULL) { if (path->pts != NULL) NANOSVG_free(path->pts); NANOSVG_free(path); } } /* We roll our own string to float because the std library one uses locale and messes things up. */ static double nsvg__atof(const char* s) { char* cur = (char*)s; char* end = NULL; double res = 0.0, sign = 1.0; #if defined(_MSC_VER) && (_MSC_VER == 1200) __int64 intPart = 0, fracPart = 0; #else long long intPart = 0, fracPart = 0; #endif char hasIntPart = 0, hasFracPart = 0; /* Parse optional sign */ if (*cur == '+') { cur++; } else if (*cur == '-') { sign = -1; cur++; } /* Parse integer part */ if (nsvg__isdigit(*cur)) { /* Parse digit sequence */ #if defined(_MSC_VER) && (_MSC_VER == 1200) intPart = strtol(cur, &end, 10); #else intPart = strtoll(cur, &end, 10); #endif if (cur != end) { res = (double)intPart; hasIntPart = 1; cur = end; } } /* Parse fractional part. */ if (*cur == '.') { cur++; /* Skip '.' */ if (nsvg__isdigit(*cur)) { /* Parse digit sequence */ #if defined(_MSC_VER) && (_MSC_VER == 1200) fracPart = strtol(cur, &end, 10); #else fracPart = strtoll(cur, &end, 10); #endif if (cur != end) { res += (double)fracPart / pow(10.0, (double)(end - cur)); hasFracPart = 1; cur = end; } } } /* A valid number should have integer or fractional part. */ if (!hasIntPart && !hasFracPart) return 0.0; /* Parse optional exponent */ if (*cur == 'e' || *cur == 'E') { int expPart = 0; cur++; /* skip 'E' */ expPart = strtol(cur, &end, 10); /* Parse digit sequence with sign */ if (cur != end) { res *= pow(10.0, (double)expPart); } } return res * sign; } static const char* nsvg__parseNumber(const char* s, char* it, const int size) { const int last = size-1; int i = 0; /* sign */ if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; s++; } /* integer part */ while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } if (*s == '.') { /* decimal point */ if (i < last) it[i++] = *s; s++; /* fraction part */ while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } } /* exponent */ if (*s == 'e' || *s == 'E') { if (i < last) it[i++] = *s; s++; if (*s == '-' || *s == '+') { if (i < last) it[i++] = *s; s++; } while (*s && nsvg__isdigit(*s)) { if (i < last) it[i++] = *s; s++; } } it[i] = '\0'; return s; } static const char* nsvg__getNextPathItem(const char* s, char* it) { it[0] = '\0'; /* Skip white spaces and commas */ while (*s && (nsvg__isspace(*s) || *s == ',')) s++; if (!*s) return s; if (*s == '-' || *s == '+' || *s == '.' || nsvg__isdigit(*s)) { s = nsvg__parseNumber(s, it, 64); } else { /* Parse command */ it[0] = *s++; it[1] = '\0'; return s; } return s; } static unsigned int nsvg__parseColorHex(const char* str) { unsigned int c = 0, r = 0, g = 0, b = 0; int n = 0; str++; /* skip # */ /* Calculate number of characters. */ while(str[n] && !nsvg__isspace(str[n])) n++; if (n == 6) { sscanf(str, "%x", &c); } else if (n == 3) { sscanf(str, "%x", &c); c = (c&0xf) | ((c&0xf0) << 4) | ((c&0xf00) << 8); |
︙ | ︙ | |||
1539 1540 1541 1542 1543 1544 1545 | else if (units[0] == 'e' && units[1] == 'x') return NSVG_UNITS_EX; return NSVG_UNITS_USER; } static int nsvg__isCoordinate(const char* s) { | | | | 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 | else if (units[0] == 'e' && units[1] == 'x') return NSVG_UNITS_EX; return NSVG_UNITS_USER; } static int nsvg__isCoordinate(const char* s) { /* optional sign */ if (*s == '-' || *s == '+') s++; /* must have at least one digit */ return nsvg__isdigit(*s); } static NSVGcoordinate nsvg__parseCoordinateRaw(const char* str) { NSVGcoordinate coord = {0, NSVG_UNITS_USER}; char units[32]=""; |
︙ | ︙ | |||
1719 1720 1721 1722 1723 1724 1725 | nsvg__xformPremultiply(xform, t); } } static void nsvg__parseUrl(char* id, const char* str) { int i = 0; | | | | | | | | | | 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 | nsvg__xformPremultiply(xform, t); } } static void nsvg__parseUrl(char* id, const char* str) { int i = 0; str += 4; /* "url("; */ if (*str == '#') str++; while (i < 63 && *str != ')') { id[i] = *str++; i++; } id[i] = '\0'; } static char nsvg__parseLineCap(const char* str) { if (strcmp(str, "butt") == 0) return NSVG_CAP_BUTT; else if (strcmp(str, "round") == 0) return NSVG_CAP_ROUND; else if (strcmp(str, "square") == 0) return NSVG_CAP_SQUARE; /* TODO: handle inherit. */ return NSVG_CAP_BUTT; } static char nsvg__parseLineJoin(const char* str) { if (strcmp(str, "miter") == 0) return NSVG_JOIN_MITER; else if (strcmp(str, "round") == 0) return NSVG_JOIN_ROUND; else if (strcmp(str, "bevel") == 0) return NSVG_JOIN_BEVEL; /* TODO: handle inherit. */ return NSVG_JOIN_MITER; } static char nsvg__parseFillRule(const char* str) { if (strcmp(str, "nonzero") == 0) return NSVG_FILLRULE_NONZERO; else if (strcmp(str, "evenodd") == 0) return NSVG_FILLRULE_EVENODD; /* TODO: handle inherit. */ return NSVG_FILLRULE_NONZERO; } static const char* nsvg__getNextDashItem(const char* s, char* it) { int n = 0; it[0] = '\0'; /* Skip white spaces and commas */ while (*s && (nsvg__isspace(*s) || *s == ',')) s++; /* Advance until whitespace, comma or end. */ while (*s && (!nsvg__isspace(*s) && *s != ',')) { if (n < 63) it[n++] = *s; s++; } it[n++] = '\0'; return s; } static int nsvg__parseStrokeDashArray(NSVGparser* p, const char* str, float* strokeDashArray) { char item[64]; int count = 0, i; float sum = 0.0f; /* Handle "none" */ if (str[0] == 'n') return 0; /* Parse dashes */ while (*str) { str = nsvg__getNextDashItem(str, item); if (!*item) break; if (count < NSVG_MAX_DASHES) strokeDashArray[count++] = fabsf(nsvg__parseCoordinate(p, item, 0.0f, nsvg__actualLength(p))); } |
︙ | ︙ | |||
1818 1819 1820 1821 1822 1823 1824 | if (!attr) return 0; if (strcmp(name, "style") == 0) { nsvg__parseStyle(p, value); } else if (strcmp(name, "display") == 0) { if (strcmp(value, "none") == 0) attr->visible &= ~NSVG_VIS_DISPLAY; | | | 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 | if (!attr) return 0; if (strcmp(name, "style") == 0) { nsvg__parseStyle(p, value); } else if (strcmp(name, "display") == 0) { if (strcmp(value, "none") == 0) attr->visible &= ~NSVG_VIS_DISPLAY; /* Don't reset ->visible on display:inline, one display:none hides the whole subtree */ } else if (strcmp(name, "visibility") == 0) { if (strcmp(value, "hidden") == 0) { attr->visible &= ~NSVG_VIS_VISIBLE; } else if (strcmp(value, "visible") == 0) { attr->visible |= NSVG_VIS_VISIBLE; } |
︙ | ︙ | |||
1910 1911 1912 1913 1914 1915 1916 | int n; str = start; while (str < end && *str != ':') ++str; val = str; | | | 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 | int n; str = start; while (str < end && *str != ':') ++str; val = str; /* Right Trim */ while (str > start && (*str == ':' || nsvg__isspace(*str))) --str; ++str; n = (int)(str - start); if (n > 511) n = 511; if (n) memcpy(name, start, n); name[n] = 0; |
︙ | ︙ | |||
1935 1936 1937 1938 1939 1940 1941 | static void nsvg__parseStyle(NSVGparser* p, const char* str) { const char* start; const char* end; while (*str) { | | | | 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 | static void nsvg__parseStyle(NSVGparser* p, const char* str) { const char* start; const char* end; while (*str) { /* Left Trim */ while(*str && nsvg__isspace(*str)) ++str; start = str; while(*str && *str != ';') ++str; end = str; /* Right Trim */ while (end > start && (*end == ';' || nsvg__isspace(*end))) --end; ++end; nsvg__parseNameValue(p, start, end); if (*str) ++str; } } |
︙ | ︙ | |||
2116 2117 2118 2119 2120 2121 2122 | } else { cx = args[0]; cy = args[1]; x2 = args[2]; y2 = args[3]; } | | | 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 | } else { cx = args[0]; cy = args[1]; x2 = args[2]; y2 = args[3]; } /* Convert to cubic bezier */ cx1 = x1 + 2.0f/3.0f*(cx - x1); cy1 = y1 + 2.0f/3.0f*(cy - y1); cx2 = x2 + 2.0f/3.0f*(cx - x2); cy2 = y2 + 2.0f/3.0f*(cy - y2); nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); |
︙ | ︙ | |||
2149 2150 2151 2152 2153 2154 2155 | x2 = args[0]; y2 = args[1]; } cx = 2*x1 - *cpx2; cy = 2*y1 - *cpy2; | | | 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 | x2 = args[0]; y2 = args[1]; } cx = 2*x1 - *cpx2; cy = 2*y1 - *cpy2; /* Convert to cubix bezier */ cx1 = x1 + 2.0f/3.0f*(cx - x1); cy1 = y1 + 2.0f/3.0f*(cy - y1); cx2 = x2 + 2.0f/3.0f*(cx - x2); cy2 = y2 + 2.0f/3.0f*(cy - y2); nsvg__cubicBezTo(p, cx1,cy1, cx2,cy2, x2,y2); |
︙ | ︙ | |||
2181 2182 2183 2184 2185 2186 2187 | if (r < -1.0f) r = -1.0f; if (r > 1.0f) r = 1.0f; return ((ux*vy < uy*vx) ? -1.0f : 1.0f) * acosf(r); } static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { | | | | | | | | | | | | | | | | | | | | | | | | | | 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 | if (r < -1.0f) r = -1.0f; if (r > 1.0f) r = 1.0f; return ((ux*vy < uy*vx) ? -1.0f : 1.0f) * acosf(r); } static void nsvg__pathArcTo(NSVGparser* p, float* cpx, float* cpy, float* args, int rel) { /* Ported from canvg (https://code.google.com/p/canvg/) */ float rx, ry, rotx; float x1, y1, x2, y2, cx, cy, dx, dy, d; float x1p, y1p, cxp, cyp, s, sa, sb; float ux, uy, vx, vy, a1, da; float x, y, tanx, tany, a, px = 0, py = 0, ptanx = 0, ptany = 0, t[6]; float sinrx, cosrx; int fa, fs; int i, ndivs; float hda, kappa; rx = fabsf(args[0]); /* y radius */ ry = fabsf(args[1]); /* x radius */ rotx = args[2] / 180.0f * NSVG_PI; /* x rotation angle */ fa = fabsf(args[3]) > 1e-6 ? 1 : 0; /* Large arc */ fs = fabsf(args[4]) > 1e-6 ? 1 : 0; /* Sweep direction */ x1 = *cpx; /* start point */ y1 = *cpy; if (rel) { /* end point */ x2 = *cpx + args[5]; y2 = *cpy + args[6]; } else { x2 = args[5]; y2 = args[6]; } dx = x1 - x2; dy = y1 - y2; d = sqrtf(dx*dx + dy*dy); if (d < 1e-6f || rx < 1e-6f || ry < 1e-6f) { /* The arc degenerates to a line */ nsvg__lineTo(p, x2, y2); *cpx = x2; *cpy = y2; return; } sinrx = sinf(rotx); cosrx = cosf(rotx); /* Convert to center point parameterization. */ /* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes */ /* 1) Compute x1', y1' */ x1p = cosrx * dx / 2.0f + sinrx * dy / 2.0f; y1p = -sinrx * dx / 2.0f + cosrx * dy / 2.0f; d = nsvg__sqr(x1p)/nsvg__sqr(rx) + nsvg__sqr(y1p)/nsvg__sqr(ry); if (d > 1) { d = sqrtf(d); rx *= d; ry *= d; } /* 2) Compute cx', cy' */ s = 0.0f; sa = nsvg__sqr(rx)*nsvg__sqr(ry) - nsvg__sqr(rx)*nsvg__sqr(y1p) - nsvg__sqr(ry)*nsvg__sqr(x1p); sb = nsvg__sqr(rx)*nsvg__sqr(y1p) + nsvg__sqr(ry)*nsvg__sqr(x1p); if (sa < 0.0f) sa = 0.0f; if (sb > 0.0f) s = sqrtf(sa / sb); if (fa == fs) s = -s; cxp = s * rx * y1p / ry; cyp = s * -ry * x1p / rx; /* 3) Compute cx,cy from cx',cy' */ cx = (x1 + x2)/2.0f + cosrx*cxp - sinrx*cyp; cy = (y1 + y2)/2.0f + sinrx*cxp + cosrx*cyp; /* 4) Calculate theta1, and delta theta. */ ux = (x1p - cxp) / rx; uy = (y1p - cyp) / ry; vx = (-x1p - cxp) / rx; vy = (-y1p - cyp) / ry; a1 = nsvg__vecang(1.0f,0.0f, ux,uy); /* Initial angle */ da = nsvg__vecang(ux,uy, vx,vy); /* Delta angle */ /* if (vecrat(ux,uy,vx,vy) <= -1.0f) da = NSVG_PI; */ /* if (vecrat(ux,uy,vx,vy) >= 1.0f) da = 0; */ if (fs == 0 && da > 0) da -= 2 * NSVG_PI; else if (fs == 1 && da < 0) da += 2 * NSVG_PI; /* Approximate the arc using cubic spline segments. */ t[0] = cosrx; t[1] = sinrx; t[2] = -sinrx; t[3] = cosrx; t[4] = cx; t[5] = cy; /* Split arc into max 90 degree segments. */ /* The loop assumes an iteration per end point (including start and end), this +1. */ ndivs = (int)(fabsf(da) / (NSVG_PI*0.5f) + 1.0f); hda = (da / (float)ndivs) / 2.0f; kappa = fabsf(4.0f / 3.0f * (1.0f - cosf(hda)) / sinf(hda)); if (da < 0.0f) kappa = -kappa; for (i = 0; i <= ndivs; i++) { a = a1 + da * ((float)i/(float)ndivs); dx = cosf(a); dy = sinf(a); nsvg__xformPoint(&x, &y, dx*rx, dy*ry, t); /* position */ nsvg__xformVec(&tanx, &tany, -dy*rx * kappa, dx*ry * kappa, t); /* tangent */ if (i > 0) nsvg__cubicBezTo(p, px+ptanx,py+ptany, x-tanx, y-tany, x, y); px = x; py = y; ptanx = tanx; ptany = tany; } |
︙ | ︙ | |||
2340 2341 2342 2343 2344 2345 2346 | if (nargs < 10) args[nargs++] = (float)nsvg__atof(item); if (nargs >= rargs) { switch (cmd) { case 'm': case 'M': nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0); | | | | 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 | if (nargs < 10) args[nargs++] = (float)nsvg__atof(item); if (nargs >= rargs) { switch (cmd) { case 'm': case 'M': nsvg__pathMoveTo(p, &cpx, &cpy, args, cmd == 'm' ? 1 : 0); /* Moveto can be followed by multiple coordinate pairs, */ /* which should be treated as linetos. */ cmd = (cmd == 'm') ? 'l' : 'L'; rargs = nsvg__getArgsPerElement(cmd); cpx2 = cpx; cpy2 = cpy; initPoint = 1; break; case 'l': case 'L': |
︙ | ︙ | |||
2396 2397 2398 2399 2400 2401 2402 | break; } nargs = 0; } } else { cmd = item[0]; if (cmd == 'M' || cmd == 'm') { | | | | | | | | | | | 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 | break; } nargs = 0; } } else { cmd = item[0]; if (cmd == 'M' || cmd == 'm') { /* Commit path. */ if (p->npts > 0) nsvg__addPath(p, closedFlag); /* Start new subpath. */ nsvg__resetPath(p); closedFlag = 0; nargs = 0; } else if (initPoint == 0) { /* Do not allow other commands until initial point has been set (moveTo called once). */ cmd = '\0'; } if (cmd == 'Z' || cmd == 'z') { closedFlag = 1; /* Commit path. */ if (p->npts > 0) { /* Move current point to first point */ cpx = p->pts[0]; cpy = p->pts[1]; cpx2 = cpx; cpy2 = cpy; nsvg__addPath(p, closedFlag); } /* Start new subpath. */ nsvg__resetPath(p); nsvg__moveTo(p, cpx, cpy); closedFlag = 0; nargs = 0; } rargs = nsvg__getArgsPerElement(cmd); if (rargs == -1) { /* Command not recognized */ cmd = '\0'; rargs = 0; } } } /* Commit path. */ if (p->npts) nsvg__addPath(p, closedFlag); } nsvg__addShape(p); } static void nsvg__parseRect(NSVGparser* p, const char** attr) { float x = 0.0f; float y = 0.0f; float w = 0.0f; float h = 0.0f; float rx = -1.0f; /* marks not set */ float ry = -1.0f; int i; for (i = 0; attr[i]; i += 2) { if (!nsvg__parseAttr(p, attr[i], attr[i + 1])) { if (strcmp(attr[i], "x") == 0) x = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigX(p), nsvg__actualWidth(p)); if (strcmp(attr[i], "y") == 0) y = nsvg__parseCoordinate(p, attr[i+1], nsvg__actualOrigY(p), nsvg__actualHeight(p)); |
︙ | ︙ | |||
2476 2477 2478 2479 2480 2481 2482 | if (rx < 0.00001f || ry < 0.0001f) { nsvg__moveTo(p, x, y); nsvg__lineTo(p, x+w, y); nsvg__lineTo(p, x+w, y+h); nsvg__lineTo(p, x, y+h); } else { | | | 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 | if (rx < 0.00001f || ry < 0.0001f) { nsvg__moveTo(p, x, y); nsvg__lineTo(p, x+w, y); nsvg__lineTo(p, x+w, y+h); nsvg__lineTo(p, x, y+h); } else { /* Rounded rectangle */ nsvg__moveTo(p, x+rx, y); nsvg__lineTo(p, x+w-rx, y); nsvg__cubicBezTo(p, x+w-rx*(1-NSVG_KAPPA90), y, x+w, y+ry*(1-NSVG_KAPPA90), x+w, y+ry); nsvg__lineTo(p, x+w, y+h-ry); nsvg__cubicBezTo(p, x+w, y+h-ry*(1-NSVG_KAPPA90), x+w-rx*(1-NSVG_KAPPA90), y+h, x+w-rx, y+h); nsvg__lineTo(p, x+rx, y+h); nsvg__cubicBezTo(p, x+rx*(1-NSVG_KAPPA90), y+h, x, y+h-ry*(1-NSVG_KAPPA90), x, y+h-ry); |
︙ | ︙ | |||
2633 2634 2635 2636 2637 2638 2639 | p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "height") == 0) { p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "viewBox") == 0) { sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight); } else if (strcmp(attr[i], "preserveAspectRatio") == 0) { if (strstr(attr[i + 1], "none") != 0) { | | | | | | 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 | p->image->width = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "height") == 0) { p->image->height = nsvg__parseCoordinate(p, attr[i + 1], 0.0f, 0.0f); } else if (strcmp(attr[i], "viewBox") == 0) { sscanf(attr[i + 1], "%f%*[%%, \t]%f%*[%%, \t]%f%*[%%, \t]%f", &p->viewMinx, &p->viewMiny, &p->viewWidth, &p->viewHeight); } else if (strcmp(attr[i], "preserveAspectRatio") == 0) { if (strstr(attr[i + 1], "none") != 0) { /* No uniform scaling */ p->alignType = NSVG_ALIGN_NONE; } else { /* Parse X align */ if (strstr(attr[i + 1], "xMin") != 0) p->alignX = NSVG_ALIGN_MIN; else if (strstr(attr[i + 1], "xMid") != 0) p->alignX = NSVG_ALIGN_MID; else if (strstr(attr[i + 1], "xMax") != 0) p->alignX = NSVG_ALIGN_MAX; /* Parse X align */ if (strstr(attr[i + 1], "yMin") != 0) p->alignY = NSVG_ALIGN_MIN; else if (strstr(attr[i + 1], "yMid") != 0) p->alignY = NSVG_ALIGN_MID; else if (strstr(attr[i + 1], "yMax") != 0) p->alignY = NSVG_ALIGN_MAX; /* Parse meet/slice */ p->alignType = NSVG_ALIGN_MEET; if (strstr(attr[i + 1], "slice") != 0) p->alignType = NSVG_ALIGN_SLICE; } } } } |
︙ | ︙ | |||
2745 2746 2747 2748 2749 2750 2751 | curAttr->stopColor = 0; curAttr->stopOpacity = 1.0f; for (i = 0; attr[i]; i += 2) { nsvg__parseAttr(p, attr[i], attr[i + 1]); } | | | | 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 | curAttr->stopColor = 0; curAttr->stopOpacity = 1.0f; for (i = 0; attr[i]; i += 2) { nsvg__parseAttr(p, attr[i], attr[i + 1]); } /* Add stop to the last gradient. */ grad = p->gradients; if (grad == NULL) return; grad->nstops++; grad->stops = (NSVGgradientStop*)NANOSVG_realloc(grad->stops, sizeof(NSVGgradientStop)*grad->nstops); if (grad->stops == NULL) return; /* Insert */ idx = grad->nstops-1; for (i = 0; i < grad->nstops-1; i++) { if (curAttr->stopOffset < grad->stops[i].offset) { idx = i; break; } } |
︙ | ︙ | |||
2777 2778 2779 2780 2781 2782 2783 | } static void nsvg__startElement(void* ud, const char* el, const char** attr) { NSVGparser* p = (NSVGparser*)ud; if (p->defsFlag) { | | | | 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 | } static void nsvg__startElement(void* ud, const char* el, const char** attr) { NSVGparser* p = (NSVGparser*)ud; if (p->defsFlag) { /* Skip everything but gradients in defs */ if (strcmp(el, "linearGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_LINEAR_GRADIENT); } else if (strcmp(el, "radialGradient") == 0) { nsvg__parseGradient(p, attr, NSVG_PAINT_RADIAL_GRADIENT); } else if (strcmp(el, "stop") == 0) { nsvg__parseGradientStop(p, attr); } return; } if (strcmp(el, "g") == 0) { nsvg__pushAttr(p); nsvg__parseAttribs(p, attr); } else if (strcmp(el, "path") == 0) { if (p->pathFlag) /* Do not allow nested paths. */ return; nsvg__pushAttr(p); nsvg__parsePath(p, attr); nsvg__popAttr(p); } else if (strcmp(el, "rect") == 0) { nsvg__pushAttr(p); nsvg__parseRect(p, attr); |
︙ | ︙ | |||
2945 2946 2947 2948 2949 2950 2951 | static float nsvg__viewAlign(float content, float container, int type) { if (type == NSVG_ALIGN_MIN) return 0; else if (type == NSVG_ALIGN_MAX) return container - content; | | | 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 | static float nsvg__viewAlign(float content, float container, int type) { if (type == NSVG_ALIGN_MIN) return 0; else if (type == NSVG_ALIGN_MAX) return container - content; /* mid */ return (container - content) * 0.5f; } static void nsvg__scaleGradient(NSVGgradient* grad, float tx, float ty, float sx, float sy) { float t[6]; nsvg__xformSetTranslation(t, tx, ty); |
︙ | ︙ | |||
2967 2968 2969 2970 2971 2972 2973 | { NSVGshape* shape; NSVGpath* path; float tx, ty, sx, sy, us, bounds[4], t[6], avgs; int i; float* pt; | | | 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 | { NSVGshape* shape; NSVGpath* path; float tx, ty, sx, sy, us, bounds[4], t[6], avgs; int i; float* pt; /* Guess image size if not set completely. */ nsvg__imageBounds(p, bounds); if (p->viewWidth == 0) { if (p->image->width > 0) { p->viewWidth = p->image->width; } else { p->viewMinx = bounds[0]; |
︙ | ︙ | |||
2995 2996 2997 2998 2999 3000 3001 | if (p->image->height == 0) p->image->height = p->viewHeight; tx = -p->viewMinx; ty = -p->viewMiny; sx = p->viewWidth > 0 ? p->image->width / p->viewWidth : 0; sy = p->viewHeight > 0 ? p->image->height / p->viewHeight : 0; | | | | | | | 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 | if (p->image->height == 0) p->image->height = p->viewHeight; tx = -p->viewMinx; ty = -p->viewMiny; sx = p->viewWidth > 0 ? p->image->width / p->viewWidth : 0; sy = p->viewHeight > 0 ? p->image->height / p->viewHeight : 0; /* Unit scaling */ us = 1.0f / nsvg__convertToPixels(p, nsvg__coord(1.0f, nsvg__parseUnits(units)), 0.0f, 1.0f); /* Fix aspect ratio */ if (p->alignType == NSVG_ALIGN_MEET) { /* fit whole image into viewbox */ sx = sy = nsvg__minf(sx, sy); tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx; ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy; } else if (p->alignType == NSVG_ALIGN_SLICE) { /* fill whole viewbox with image */ sx = sy = nsvg__maxf(sx, sy); tx += nsvg__viewAlign(p->viewWidth*sx, p->image->width, p->alignX) / sx; ty += nsvg__viewAlign(p->viewHeight*sy, p->image->height, p->alignY) / sy; } /* Transform */ sx *= us; sy *= us; avgs = (sx+sy) / 2.0f; for (shape = p->image->shapes; shape != NULL; shape = shape->next) { shape->bounds[0] = (shape->bounds[0] + tx) * sx; shape->bounds[1] = (shape->bounds[1] + ty) * sy; shape->bounds[2] = (shape->bounds[2] + tx) * sx; |
︙ | ︙ | |||
3064 3065 3066 3067 3068 3069 3070 | if (p == NULL) { return NULL; } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); | | | 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 | if (p == NULL) { return NULL; } p->dpi = dpi; nsvg__parseXML(input, nsvg__startElement, nsvg__endElement, nsvg__content, p); /* Scale to viewBox */ nsvg__scaleToViewbox(p, units); ret = p->image; p->image = NULL; nsvg__deleteParser(p); |
︙ | ︙ | |||
3091 3092 3093 3094 3095 3096 3097 | if (!fp) goto error; fseek(fp, 0, SEEK_END); size = ftell(fp); fseek(fp, 0, SEEK_SET); data = (char*)NANOSVG_malloc(size+1); if (data == NULL) goto error; if (fread(data, 1, size, fp) != size) goto error; | | | 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 | if (!fp) goto error; fseek(fp, 0, SEEK_END); size = ftell(fp); fseek(fp, 0, SEEK_SET); data = (char*)NANOSVG_malloc(size+1); if (data == NULL) goto error; if (fread(data, 1, size, fp) != size) goto error; data[size] = '\0'; /* Must be null terminated. */ fclose(fp); image = nsvgParse(data, units, dpi); NANOSVG_free(data); return image; error: |
︙ | ︙ |
Changes to generic/nanosvgrast.h.
︙ | ︙ | |||
55 56 57 58 59 60 61 | struct NSVGrasterizer* rast = nsvgCreateRasterizer(); // Allocate memory for image unsigned char* img = malloc(w*h*4); // Rasterize nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); */ | | | | | | | | | | | > | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | struct NSVGrasterizer* rast = nsvgCreateRasterizer(); // Allocate memory for image unsigned char* img = malloc(w*h*4); // Rasterize nsvgRasterize(rast, image, 0,0,1, img, w, h, w*4); */ /* Allocated rasterizer context. */ NANOSVG_SCOPE NSVGrasterizer* nsvgCreateRasterizer(void); /* Rasterizes SVG image, returns RGBA image (non-premultiplied alpha) * r - pointer to rasterizer context * image - pointer to image to rasterize * tx,ty - image offset (applied after scaling) * scale - image scale * dst - pointer to destination image data, 4 bytes per pixel (RGBA) * w - width of the image to render * h - height of the image to render * stride - number of bytes per scaleline in the destination buffer NANOSVG_SCOPE void nsvgRasterize(NSVGrasterizer* r, NSVGimage* image, float tx, float ty, float scale, unsigned char* dst, int w, int h, int stride); */ /* Deletes rasterizer context. */ NANOSVG_SCOPE void nsvgDeleteRasterizer(NSVGrasterizer*); #ifdef __cplusplus } #endif #endif /* NANOSVGRAST_H */ #ifdef NANOSVGRAST_IMPLEMENTATION #include <math.h> #define NSVG__SUBSAMPLES 5 #define NSVG__FIXSHIFT 10 |
︙ | ︙ | |||
198 199 200 201 202 203 204 | NANOSVG_free(r); } static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur) { NSVGmemPage *newp; | | | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | NANOSVG_free(r); } static NSVGmemPage* nsvg__nextPage(NSVGrasterizer* r, NSVGmemPage* cur) { NSVGmemPage *newp; /* If using existing chain, return the next page in chain */ if (cur != NULL && cur->next != NULL) { return cur->next; } /* Alloc new page */ newp = (NSVGmemPage*)NANOSVG_malloc(sizeof(NSVGmemPage)); if (newp == NULL) return NULL; memset(newp, 0, sizeof(NSVGmemPage)); /* Add to linked list */ if (cur != NULL) cur->next = newp; else r->pages = newp; return newp; } |
︙ | ︙ | |||
298 299 300 301 302 303 304 | r->npoints2 = r->npoints; } static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float y1) { NSVGedge* e; | | | 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | r->npoints2 = r->npoints; } static void nsvg__addEdge(NSVGrasterizer* r, float x0, float y0, float x1, float y1) { NSVGedge* e; /* Skip horizontal edges */ if (y0 == y1) return; if (r->nedges+1 > r->cedges) { r->cedges = r->cedges > 0 ? r->cedges * 2 : 64; r->edges = (NSVGedge*)NANOSVG_realloc(r->edges, sizeof(NSVGedge) * r->cedges); if (r->edges == NULL) return; |
︙ | ︙ | |||
384 385 386 387 388 389 390 | static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale) { int i, j; NSVGpath* path; for (path = shape->paths; path != NULL; path = path->next) { r->npoints = 0; | | | | | 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | static void nsvg__flattenShape(NSVGrasterizer* r, NSVGshape* shape, float scale) { int i, j; NSVGpath* path; for (path = shape->paths; path != NULL; path = path->next) { r->npoints = 0; /* Flatten path */ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0); for (i = 0; i < path->npts-1; i += 3) { float* p = &path->pts[i*2]; nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, 0); } /* Close path */ nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, 0); /* Build edges */ for (i = 0, j = r->npoints-1; i < r->npoints; j = i++) nsvg__addEdge(r, r->points[j].x, r->points[j].y, r->points[i].x, r->points[i].y); } } enum NSVGpointFlags { |
︙ | ︙ | |||
615 616 617 618 619 620 621 | int divs = (int)ceilf(arc / da); if (divs < 2) divs = 2; return divs; } static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth) { | | | | | | | 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 | int divs = (int)ceilf(arc / da); if (divs < 2) divs = 2; return divs; } static void nsvg__expandStroke(NSVGrasterizer* r, NSVGpoint* points, int npoints, int closed, int lineJoin, int lineCap, float lineWidth) { int ncap = nsvg__curveDivs(lineWidth*0.5f, NSVG_PI, r->tessTol); /* Calculate divisions per half circle. */ NSVGpoint left = {0,0,0,0,0,0,0,0}, right = {0,0,0,0,0,0,0,0}, firstLeft = {0,0,0,0,0,0,0,0}, firstRight = {0,0,0,0,0,0,0,0}; NSVGpoint* p0, *p1; int j, s, e; /* Build stroke edges */ if (closed) { /* Looping */ p0 = &points[npoints-1]; p1 = &points[0]; s = 0; e = npoints; } else { /* Add cap */ p0 = &points[0]; p1 = &points[1]; s = 1; e = npoints-1; } if (closed) { nsvg__initClosed(&left, &right, p0, p1, lineWidth); firstLeft = left; firstRight = right; } else { /* Add cap */ float dx = p1->x - p0->x; float dy = p1->y - p0->y; nsvg__normalize(&dx, &dy); if (lineCap == NSVG_CAP_BUTT) nsvg__buttCap(r, &left, &right, p0, dx, dy, lineWidth, 0); else if (lineCap == NSVG_CAP_SQUARE) nsvg__squareCap(r, &left, &right, p0, dx, dy, lineWidth, 0); |
︙ | ︙ | |||
667 668 669 670 671 672 673 | } else { nsvg__straightJoin(r, &left, &right, p1, lineWidth); } p0 = p1++; } if (closed) { | | | | | | | | | | | 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 | } else { nsvg__straightJoin(r, &left, &right, p1, lineWidth); } p0 = p1++; } if (closed) { /* Loop it */ nsvg__addEdge(r, firstLeft.x, firstLeft.y, left.x, left.y); nsvg__addEdge(r, right.x, right.y, firstRight.x, firstRight.y); } else { /* Add cap */ float dx = p1->x - p0->x; float dy = p1->y - p0->y; nsvg__normalize(&dx, &dy); if (lineCap == NSVG_CAP_BUTT) nsvg__buttCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1); else if (lineCap == NSVG_CAP_SQUARE) nsvg__squareCap(r, &right, &left, p1, -dx, -dy, lineWidth, 1); else if (lineCap == NSVG_CAP_ROUND) nsvg__roundCap(r, &right, &left, p1, -dx, -dy, lineWidth, ncap, 1); } } static void nsvg__prepareStroke(NSVGrasterizer* r, float miterLimit, int lineJoin) { int i, j; NSVGpoint* p0, *p1; p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; for (i = 0; i < r->npoints; i++) { /* Calculate segment direction and length */ p0->dx = p1->x - p0->x; p0->dy = p1->y - p0->y; p0->len = nsvg__normalize(&p0->dx, &p0->dy); /* Advance */ p0 = p1++; } /* calculate joins */ p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; for (j = 0; j < r->npoints; j++) { float dlx0, dly0, dlx1, dly1, dmr2, cross; dlx0 = p0->dy; dly0 = -p0->dx; dlx1 = p1->dy; dly1 = -p1->dx; /* Calculate extrusions */ p1->dmx = (dlx0 + dlx1) * 0.5f; p1->dmy = (dly0 + dly1) * 0.5f; dmr2 = p1->dmx*p1->dmx + p1->dmy*p1->dmy; if (dmr2 > 0.000001f) { float s2 = 1.0f / dmr2; if (s2 > 600.0f) { s2 = 600.0f; } p1->dmx *= s2; p1->dmy *= s2; } /* Clear flags, but keep the corner. */ p1->flags = (p1->flags & NSVG_PT_CORNER) ? NSVG_PT_CORNER : 0; /* Keep track of left turns. */ cross = p1->dx * p0->dy - p0->dx * p1->dy; if (cross > 0.0f) p1->flags |= NSVG_PT_LEFT; /* Check to see if the corner needs to be beveled. */ if (p1->flags & NSVG_PT_CORNER) { if ((dmr2 * miterLimit*miterLimit) < 1.0f || lineJoin == NSVG_JOIN_BEVEL || lineJoin == NSVG_JOIN_ROUND) { p1->flags |= NSVG_PT_BEVEL; } } p0 = p1++; |
︙ | ︙ | |||
752 753 754 755 756 757 758 | NSVGpoint* p0, *p1; float miterLimit = shape->miterLimit; int lineJoin = shape->strokeLineJoin; int lineCap = shape->strokeLineCap; float lineWidth = shape->strokeWidth * scale; for (path = shape->paths; path != NULL; path = path->next) { | | | | | | | | | | | | 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 | NSVGpoint* p0, *p1; float miterLimit = shape->miterLimit; int lineJoin = shape->strokeLineJoin; int lineCap = shape->strokeLineCap; float lineWidth = shape->strokeWidth * scale; for (path = shape->paths; path != NULL; path = path->next) { /* Flatten path */ r->npoints = 0; nsvg__addPathPoint(r, path->pts[0]*scale, path->pts[1]*scale, NSVG_PT_CORNER); for (i = 0; i < path->npts-1; i += 3) { float* p = &path->pts[i*2]; nsvg__flattenCubicBez(r, p[0]*scale,p[1]*scale, p[2]*scale,p[3]*scale, p[4]*scale,p[5]*scale, p[6]*scale,p[7]*scale, 0, NSVG_PT_CORNER); } if (r->npoints < 2) continue; closed = path->closed; /* If the first and last points are the same, remove the last, mark as closed path. */ p0 = &r->points[r->npoints-1]; p1 = &r->points[0]; if (nsvg__ptEquals(p0->x,p0->y, p1->x,p1->y, r->distTol)) { r->npoints--; p0 = &r->points[r->npoints-1]; closed = 1; } if (shape->strokeDashCount > 0) { int idash = 0, dashState = 1; float totalDist = 0, dashLen, allDashLen, dashOffset; NSVGpoint cur; if (closed) nsvg__appendPathPoint(r, r->points[0]); /* Duplicate points -> points2. */ nsvg__duplicatePoints(r); r->npoints = 0; cur = r->points2[0]; nsvg__appendPathPoint(r, cur); /* Figure out dash offset. */ allDashLen = 0; for (j = 0; j < shape->strokeDashCount; j++) allDashLen += shape->strokeDashArray[j]; if (shape->strokeDashCount & 1) allDashLen *= 2.0f; /* Find location inside pattern */ dashOffset = fmodf(shape->strokeDashOffset, allDashLen); if (dashOffset < 0.0f) dashOffset += allDashLen; while (dashOffset > shape->strokeDashArray[idash]) { dashOffset -= shape->strokeDashArray[idash]; idash = (idash + 1) % shape->strokeDashCount; } dashLen = (shape->strokeDashArray[idash] - dashOffset) * scale; for (j = 1; j < r->npoints2; ) { float dx = r->points2[j].x - cur.x; float dy = r->points2[j].y - cur.y; float dist = sqrtf(dx*dx + dy*dy); if ((totalDist + dist) > dashLen) { /* Calculate intermediate point */ float d = (dashLen - totalDist) / dist; float x = cur.x + dx * d; float y = cur.y + dy * d; nsvg__addPathPoint(r, x, y, NSVG_PT_CORNER); /* Stroke */ if (r->npoints > 1 && dashState) { nsvg__prepareStroke(r, miterLimit, lineJoin); nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth); } /* Advance dash pattern */ dashState = !dashState; idash = (idash+1) % shape->strokeDashCount; dashLen = shape->strokeDashArray[idash] * scale; /* Restart */ cur.x = x; cur.y = y; cur.flags = NSVG_PT_CORNER; totalDist = 0.0f; r->npoints = 0; nsvg__appendPathPoint(r, cur); } else { totalDist += dist; cur = r->points2[j]; nsvg__appendPathPoint(r, cur); j++; } } /* Stroke any leftover path */ if (r->npoints > 1 && dashState) nsvg__expandStroke(r, r->points, r->npoints, 0, lineJoin, lineCap, lineWidth); } else { nsvg__prepareStroke(r, miterLimit, lineJoin); nsvg__expandStroke(r, r->points, r->npoints, closed, lineJoin, lineCap, lineWidth); } } |
︙ | ︙ | |||
867 868 869 870 871 872 873 | static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint) { NSVGactiveEdge* z; float dxdy; if (r->freelist != NULL) { | | | | | | | 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | static NSVGactiveEdge* nsvg__addActive(NSVGrasterizer* r, NSVGedge* e, float startPoint) { NSVGactiveEdge* z; float dxdy; if (r->freelist != NULL) { /* Restore from freelist. */ z = r->freelist; r->freelist = z->next; } else { /* Alloc new edge. */ z = (NSVGactiveEdge*)nsvg__alloc(r, sizeof(NSVGactiveEdge)); if (z == NULL) return NULL; } dxdy = (e->x1 - e->x0) / (e->y1 - e->y0); /* STBTT_assert(e->y0 <= start_point); */ /* round dx down to avoid going too far */ if (dxdy < 0) z->dx = (int)(-floorf(NSVG__FIX * -dxdy)); else z->dx = (int)floorf(NSVG__FIX * dxdy); z->x = (int)floorf(NSVG__FIX * (e->x0 + dxdy * (startPoint - e->y0))); /* z->x -= off_x * FIX; */ z->ey = e->y1; z->next = 0; z->dir = e->dir; return z; } |
︙ | ︙ | |||
906 907 908 909 910 911 912 | { int i = x0 >> NSVG__FIXSHIFT; int j = x1 >> NSVG__FIXSHIFT; if (i < *xmin) *xmin = i; if (j > *xmax) *xmax = j; if (i < len && j >= 0) { if (i == j) { | | | | | | | | | | > | | | | | | | 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 | { int i = x0 >> NSVG__FIXSHIFT; int j = x1 >> NSVG__FIXSHIFT; if (i < *xmin) *xmin = i; if (j > *xmax) *xmax = j; if (i < len && j >= 0) { if (i == j) { /* x0,x1 are the same pixel, so compute combined coverage */ scanline[i] = (unsigned char)(scanline[i] + ((x1 - x0) * maxWeight >> NSVG__FIXSHIFT)); } else { if (i >= 0) /* add antialiasing for x0 */ scanline[i] = (unsigned char)(scanline[i] + (((NSVG__FIX - (x0 & NSVG__FIXMASK)) * maxWeight) >> NSVG__FIXSHIFT)); else i = -1; /* clip */ if (j < len) /* add antialiasing for x1 */ scanline[j] = (unsigned char)(scanline[j] + (((x1 & NSVG__FIXMASK) * maxWeight) >> NSVG__FIXSHIFT)); else j = len; /* clip */ for (++i; i < j; ++i) /* fill pixels between x0 and x1 */ scanline[i] = (unsigned char)(scanline[i] + maxWeight); } } } /* note: this routine clips fills that extend off the edges... ideally this * wouldn't happen, but it could happen if the truetype glyph bounding boxes * are wrong, or if the user supplies a too-small bitmap */ static void nsvg__fillActiveEdges(unsigned char* scanline, int len, NSVGactiveEdge* e, int maxWeight, int* xmin, int* xmax, char fillRule) { /* non-zero winding fill */ int x0 = 0, w = 0; if (fillRule == NSVG_FILLRULE_NONZERO) { /* Non-zero */ while (e != NULL) { if (w == 0) { /* if we're currently at zero, we need to record the edge start point */ x0 = e->x; w += e->dir; } else { int x1 = e->x; w += e->dir; /* if we went to zero, we need to draw */ if (w == 0) nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax); } e = e->next; } } else if (fillRule == NSVG_FILLRULE_EVENODD) { /* Even-odd */ while (e != NULL) { if (w == 0) { /* if we're currently at zero, we need to record the edge start point */ x0 = e->x; w = 1; } else { int x1 = e->x; w = 0; nsvg__fillScanline(scanline, len, x0, x1, maxWeight, xmin, xmax); } e = e->next; } |
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | cb = (cache->colors[0] >> 16) & 0xff; ca = (cache->colors[0] >> 24) & 0xff; for (i = 0; i < count; i++) { int r,g,b; int a = nsvg__div255((int)cover[0] * ca); int ia = 255 - a; | | | | | | 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | cb = (cache->colors[0] >> 16) & 0xff; ca = (cache->colors[0] >> 24) & 0xff; for (i = 0; i < count; i++) { int r,g,b; int a = nsvg__div255((int)cover[0] * ca); int ia = 255 - a; /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); /* Blend over */ r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; dst[2] = (unsigned char)b; dst[3] = (unsigned char)a; cover++; dst += 4; } } else if (cache->type == NSVG_PAINT_LINEAR_GRADIENT) { /* TODO: spread modes. */ /* TODO: plenty of opportunities to optimize. */ float fx, fy, dx, gy; float* t = cache->xform; int i, cr, cg, cb, ca; unsigned int c; fx = ((float)x - tx) / scale; fy = ((float)y - ty) / scale; |
︙ | ︙ | |||
1052 1053 1054 1055 1056 1057 1058 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; | | | | | | | 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); /* Blend over */ r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; dst[2] = (unsigned char)b; dst[3] = (unsigned char)a; cover++; dst += 4; fx += dx; } } else if (cache->type == NSVG_PAINT_RADIAL_GRADIENT) { /* TODO: spread modes. */ /* TODO: plenty of opportunities to optimize. */ /* TODO: focus (fx,fy) */ float fx, fy, dx, gx, gy, gd; float* t = cache->xform; int i, cr, cg, cb, ca; unsigned int c; fx = ((float)x - tx) / scale; fy = ((float)y - ty) / scale; |
︙ | ︙ | |||
1099 1100 1101 1102 1103 1104 1105 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; | | | | 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | cg = (c >> 8) & 0xff; cb = (c >> 16) & 0xff; ca = (c >> 24) & 0xff; a = nsvg__div255((int)cover[0] * ca); ia = 255 - a; /* Premultiply */ r = nsvg__div255(cr * a); g = nsvg__div255(cg * a); b = nsvg__div255(cb * a); /* Blend over */ r += nsvg__div255(ia * (int)dst[0]); g += nsvg__div255(ia * (int)dst[1]); b += nsvg__div255(ia * (int)dst[2]); a += nsvg__div255(ia * (int)dst[3]); dst[0] = (unsigned char)r; dst[1] = (unsigned char)g; |
︙ | ︙ | |||
1127 1128 1129 1130 1131 1132 1133 | } static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float scale, NSVGcachedPaint* cache, char fillRule) { NSVGactiveEdge *active = NULL; int y, s; int e = 0; | | | | | | | | | | | | | | | | | | | | 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 | } static void nsvg__rasterizeSortedEdges(NSVGrasterizer *r, float tx, float ty, float scale, NSVGcachedPaint* cache, char fillRule) { NSVGactiveEdge *active = NULL; int y, s; int e = 0; int maxWeight = (255 / NSVG__SUBSAMPLES); /* weight per vertical scanline */ int xmin, xmax; for (y = 0; y < r->height; y++) { memset(r->scanline, 0, r->width); xmin = r->width; xmax = 0; for (s = 0; s < NSVG__SUBSAMPLES; ++s) { /* find center of pixel for this scanline */ float scany = (float)(y*NSVG__SUBSAMPLES + s) + 0.5f; NSVGactiveEdge **step = &active; /* update all active edges; */ /* remove all active edges that terminate before the center of this scanline */ while (*step) { NSVGactiveEdge *z = *step; if (z->ey <= scany) { *step = z->next; /* delete from list */ /* NSVG__assert(z->valid); */ nsvg__freeActive(r, z); } else { z->x += z->dx; /* advance to position for current scanline */ step = &((*step)->next); /* advance through list */ } } /* resort the list if needed */ for (;;) { int changed = 0; step = &active; while (*step && (*step)->next) { if ((*step)->x > (*step)->next->x) { NSVGactiveEdge* t = *step; NSVGactiveEdge* q = t->next; t->next = q->next; q->next = t; *step = q; changed = 1; } step = &(*step)->next; } if (!changed) break; } /* insert all edges that start before the center of this scanline -- omit ones that also end on this scanline */ while (e < r->nedges && r->edges[e].y0 <= scany) { if (r->edges[e].y1 > scany) { NSVGactiveEdge* z = nsvg__addActive(r, &r->edges[e], scany); if (z == NULL) break; /* find insertion point */ if (active == NULL) { active = z; } else if (z->x < active->x) { /* insert at front */ z->next = active; active = z; } else { /* find thing to insert AFTER */ NSVGactiveEdge* p = active; while (p->next && p->next->x < z->x) p = p->next; /* at this point, p->next->x is NOT < z->x */ z->next = p->next; p->next = z; } } e++; } /* now process all active edges in non-zero fashion */ if (active != NULL) nsvg__fillActiveEdges(r->scanline, r->width, active, maxWeight, &xmin, &xmax, fillRule); } /* Blit */ if (xmin < 0) xmin = 0; if (xmax > r->width-1) xmax = r->width-1; if (xmin <= xmax) { nsvg__scanlineSolid(&r->bitmap[y * r->stride] + xmin*4, xmax-xmin+1, &r->scanline[xmin], xmin, y, tx,ty, scale, cache); } } } static void nsvg__unpremultiplyAlpha(unsigned char* image, int w, int h, int stride) { int x,y; /* Unpremultiply */ for (y = 0; y < h; y++) { unsigned char *row = &image[y*stride]; for (x = 0; x < w; x++) { int r = row[0], g = row[1], b = row[2], a = row[3]; if (a != 0) { row[0] = (unsigned char)(r*255/a); row[1] = (unsigned char)(g*255/a); row[2] = (unsigned char)(b*255/a); } row += 4; } } /* Defringe */ for (y = 0; y < h; y++) { unsigned char *row = &image[y*stride]; for (x = 0; x < w; x++) { int r = 0, g = 0, b = 0, a = row[3], n = 0; if (a == 0) { if (x-1 > 0 && row[-1] != 0) { r += row[-4]; |
︙ | ︙ | |||
1407 1408 1409 1410 1411 1412 1413 | if (shape->fill.type != NSVG_PAINT_NONE) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShape(r, shape, scale); | | | | | | | | | 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | if (shape->fill.type != NSVG_PAINT_NONE) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShape(r, shape, scale); /* Scale and translate edges */ for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; e->x0 = tx + e->x0; e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES; e->x1 = tx + e->x1; e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES; } /* Rasterize edges */ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */ nsvg__initPaint(&cache, &shape->fill, shape->opacity); nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, shape->fillRule); } if (shape->stroke.type != NSVG_PAINT_NONE && (shape->strokeWidth * scale) > 0.01f) { nsvg__resetPool(r); r->freelist = NULL; r->nedges = 0; nsvg__flattenShapeStroke(r, shape, scale); /* dumpEdges(r, "edge.svg"); */ /* Scale and translate edges */ for (i = 0; i < r->nedges; i++) { e = &r->edges[i]; e->x0 = tx + e->x0; e->y0 = (ty + e->y0) * NSVG__SUBSAMPLES; e->x1 = tx + e->x1; e->y1 = (ty + e->y1) * NSVG__SUBSAMPLES; } /* Rasterize edges */ qsort(r->edges, r->nedges, sizeof(NSVGedge), nsvg__cmpEdge); /* now, traverse the scanlines and find the intersections on each scanline, use non-zero rule */ nsvg__initPaint(&cache, &shape->stroke, shape->opacity); nsvg__rasterizeSortedEdges(r, tx,ty,scale, &cache, NSVG_FILLRULE_NONZERO); } } nsvg__unpremultiplyAlpha(dst, w, h, stride); |
︙ | ︙ |
Changes to generic/tkBind.c.
︙ | ︙ | |||
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 | #define MULT_CLICKS (DOUBLE|TRIPLE|QUADRUPLE) static const ModInfo modArray[] = { {"Control", ControlMask, 0}, {"Shift", ShiftMask, 0}, {"Lock", LockMask, 0}, {"Meta", META_MASK, 0}, {"M", META_MASK, 0}, {"Alt", ALT_MASK, 0}, {"Extended", EXTENDED_MASK, 0}, {"B1", Button1Mask, 0}, {"Button1", Button1Mask, 0}, {"B2", Button2Mask, 0}, {"Button2", Button2Mask, 0}, {"B3", Button3Mask, 0}, | > > | 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | #define MULT_CLICKS (DOUBLE|TRIPLE|QUADRUPLE) static const ModInfo modArray[] = { {"Control", ControlMask, 0}, {"Shift", ShiftMask, 0}, {"Lock", LockMask, 0}, {"Meta", META_MASK, 0}, #ifndef TK_NO_DEPRECATED {"M", META_MASK, 0}, #endif {"Alt", ALT_MASK, 0}, {"Extended", EXTENDED_MASK, 0}, {"B1", Button1Mask, 0}, {"Button1", Button1Mask, 0}, {"B2", Button2Mask, 0}, {"Button2", Button2Mask, 0}, {"B3", Button3Mask, 0}, |
︙ | ︙ | |||
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | {"Button7", Button7Mask, 0}, {"B8", Button8Mask, 0}, {"Button8", Button8Mask, 0}, {"B9", Button9Mask, 0}, {"Button9", Button9Mask, 0}, {"Mod1", Mod1Mask, 0}, {"M1", Mod1Mask, 0}, {"Command", Mod1Mask, 0}, {"Mod2", Mod2Mask, 0}, {"M2", Mod2Mask, 0}, {"Option", Mod2Mask, 0}, {"Mod3", Mod3Mask, 0}, {"M3", Mod3Mask, 0}, {"Mod4", Mod4Mask, 0}, {"M4", Mod4Mask, 0}, {"Mod5", Mod5Mask, 0}, {"M5", Mod5Mask, 0}, {"Double", 0, DOUBLE}, | > > > > > > > > > > | 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | {"Button7", Button7Mask, 0}, {"B8", Button8Mask, 0}, {"Button8", Button8Mask, 0}, {"B9", Button9Mask, 0}, {"Button9", Button9Mask, 0}, {"Mod1", Mod1Mask, 0}, {"M1", Mod1Mask, 0}, #ifdef MAC_OSX_TK {"Command", Mod1Mask, 0}, #elif defined (_WIN32) {"Command", ControlMask, 0}, #else {"Command", META_MASK, 0}, #endif {"Mod2", Mod2Mask, 0}, {"M2", Mod2Mask, 0}, #ifdef MAC_OSX_TK {"Option", Mod2Mask, 0}, #else {"Option", ALT_MASK, 0}, #endif {"Mod3", Mod3Mask, 0}, {"M3", Mod3Mask, 0}, {"Mod4", Mod4Mask, 0}, {"M4", Mod4Mask, 0}, {"Mod5", Mod5Mask, 0}, {"M5", Mod5Mask, 0}, {"Double", 0, DOUBLE}, |
︙ | ︙ | |||
490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | * This is necessary because X doesn't report up events unless you also ask * for down events. Also, X doesn't report button state in motion events * unless you've asked about button events. */ static const EventInfo eventArray[] = { {"Key", KeyPress, KeyPressMask}, {"KeyPress", KeyPress, KeyPressMask}, {"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask}, {"Button", ButtonPress, ButtonPressMask}, {"ButtonPress", ButtonPress, ButtonPressMask}, {"ButtonRelease", ButtonRelease, ButtonPressMask|ButtonReleaseMask}, {"Motion", MotionNotify, ButtonPressMask|PointerMotionMask}, {"Enter", EnterNotify, EnterWindowMask}, {"Leave", LeaveNotify, LeaveWindowMask}, {"FocusIn", FocusIn, FocusChangeMask}, {"FocusOut", FocusOut, FocusChangeMask}, {"Expose", Expose, ExposureMask}, | > > > > | 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 | * This is necessary because X doesn't report up events unless you also ask * for down events. Also, X doesn't report button state in motion events * unless you've asked about button events. */ static const EventInfo eventArray[] = { {"Key", KeyPress, KeyPressMask}, #ifndef TK_NO_DEPRECATED {"KeyPress", KeyPress, KeyPressMask}, #endif {"KeyRelease", KeyRelease, KeyPressMask|KeyReleaseMask}, {"Button", ButtonPress, ButtonPressMask}, #ifndef TK_NO_DEPRECATED {"ButtonPress", ButtonPress, ButtonPressMask}, #endif {"ButtonRelease", ButtonRelease, ButtonPressMask|ButtonReleaseMask}, {"Motion", MotionNotify, ButtonPressMask|PointerMotionMask}, {"Enter", EnterNotify, EnterWindowMask}, {"Leave", LeaveNotify, LeaveWindowMask}, {"FocusIn", FocusIn, FocusChangeMask}, {"FocusOut", FocusOut, FocusChangeMask}, {"Expose", Expose, ExposureMask}, |
︙ | ︙ | |||
5236 5237 5238 5239 5240 5241 5242 | */ KeySym TkStringToKeysym( const char *name) /* Name of a keysym. */ { #ifdef REDO_KEYSYM_LOOKUP | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < | | 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 | */ KeySym TkStringToKeysym( const char *name) /* Name of a keysym. */ { #ifdef REDO_KEYSYM_LOOKUP Tcl_HashEntry *hPtr; #endif /* REDO_KEYSYM_LOOKUP */ int keysym; size_t len = TkUtfToUniChar(name, &keysym); if (name[len] == '\0') { if (!Tcl_UniCharIsPrint(keysym)) { /* This form not supported */ } else if ((unsigned)(keysym - 0x21) <= 0x5D) { return keysym; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { return keysym; } else if (keysym == 0x20AC) { return 0x20AC; } else { return keysym + 0x1000000; } } #ifdef REDO_KEYSYM_LOOKUP if ((name[0] == 'U') && ((unsigned)(name[1] - '0') <= 9)) { char *p = (char *)name + 1; keysym = strtol(p, &p, 16); if ((p >= name + 5) && (p <= name + 9) && !*p && (keysym >= 0x20) && ((unsigned)(keysym - 0x7F) > 0x20)) { if ((unsigned)(keysym - 0x21) <= 0x5D) { return keysym; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { return keysym; } else if (keysym == 0x20AC) { return keysym; } return keysym + 0x1000000; } } #endif #ifdef REDO_KEYSYM_LOOKUP hPtr = Tcl_FindHashEntry(&keySymTable, name); if (hPtr) { return (KeySym) Tcl_GetHashValue(hPtr); } if (((unsigned)(name[0]-1) < 0x7F) && !name[1]) { keysym = (unsigned char) name[0]; if (TkKeysymToString(keysym)) { return keysym; } } #endif /* REDO_KEYSYM_LOOKUP */ assert(name); |
︙ | ︙ | |||
5276 5277 5278 5279 5280 5281 5282 | */ const char * TkKeysymToString( KeySym keysym) { #ifdef REDO_KEYSYM_LOOKUP | | > > > > > > > > > > > > > > > > > > > > > > > > < < < | 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 | */ const char * TkKeysymToString( KeySym keysym) { #ifdef REDO_KEYSYM_LOOKUP Tcl_HashEntry *hPtr; #endif if ((unsigned)(keysym - 0x21) <= 0x5D) { keysym += 0x1000000; } else if ((unsigned)(keysym - 0xA1) <= 0x5E) { keysym += 0x1000000; } else if (keysym == 0x20AC) { keysym += 0x1000000; } if ((keysym >= 0x1000020) && (keysym <= 0x110FFFF) && ((unsigned)(keysym - 0x100007F) > 0x20)) { char buf[10]; if (Tcl_UniCharIsPrint(keysym-0x1000000)) { buf[TkUniCharToUtf(keysym - 0x1000000, buf)] = '\0'; } else if (keysym >= 0x1010000) { sprintf(buf, "U%08X", (int)(keysym - 0x1000000)); } else { sprintf(buf, "U%04X", (int)(keysym - 0x1000000)); } return Tk_GetUid(buf); } #ifdef REDO_KEYSYM_LOOKUP hPtr = Tcl_FindHashEntry(&nameTable, INT2PTR(keysym)); if (hPtr) { return (const char *)Tcl_GetHashValue(hPtr); } #endif /* REDO_KEYSYM_LOOKUP */ return XKeysymToString(keysym); } /* *---------------------------------------------------------------------- * * TkpGetBindingXEvent -- |
︙ | ︙ |
Changes to generic/tkCanvUtil.c.
︙ | ︙ | |||
770 771 772 773 774 775 776 | */ if (methods == NULL) { methods = InitSmoothMethods(interp); } /* | | | 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 | */ if (methods == NULL) { methods = InitSmoothMethods(interp); } /* * Backward compatibility hack. */ if (strncmp(value, "bezier", length) == 0) { smooth = &tkBezierSmoothMethod; } /* |
︙ | ︙ |
Changes to generic/tkDecls.h.
︙ | ︙ | |||
1791 1792 1793 1794 1795 1796 1797 1798 1799 | #undef Tk_PhotoPutZoomedBlock_Panic #undef Tk_PhotoSetSize_Panic #undef Tk_CreateOldPhotoImageFormat #endif /* TK_NO_DEPRECATED */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #endif /* _TKDECLS */ | > > | 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 | #undef Tk_PhotoPutZoomedBlock_Panic #undef Tk_PhotoSetSize_Panic #undef Tk_CreateOldPhotoImageFormat #endif /* TK_NO_DEPRECATED */ #undef TCL_STORAGE_CLASS #define TCL_STORAGE_CLASS DLLIMPORT #undef TkUnusedStubEntry #endif /* _TKDECLS */ |
Changes to generic/tkImgPhoto.c.
︙ | ︙ | |||
4078 4079 4080 4081 4082 4083 4084 | } /* *---------------------------------------------------------------------- * * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite -- * | | | 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 | } /* *---------------------------------------------------------------------- * * Tk_PhotoPutBlock_NoComposite, Tk_PhotoPutZoomedBlock_NoComposite -- * * These backward-compatibility functions just exist to fill slots in stubs * table. For the behaviour of *_NoComposite, refer to the corresponding * function without the extra suffix, except that the compositing rule is * always "overlay" and the function always panics on memory-allocation * failure. * *---------------------------------------------------------------------- */ |
︙ | ︙ | |||
4119 4120 4121 4122 4123 4124 4125 | /* *---------------------------------------------------------------------- * * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic, * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic * | | | 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 | /* *---------------------------------------------------------------------- * * Tk_PhotoExpand_Panic, Tk_PhotoPutBlock_Panic, * Tk_PhotoPutZoomedBlock_Panic, Tk_PhotoSetSize_Panic * * Backward compatibility functions for preserving the old behaviour (i.e. * panic on memory allocation failure) so that extensions do not need to be * significantly updated to take account of TIP #116. These call the new * interface (i.e. the interface without the extra suffix), but panic if an * error condition is returned. * *---------------------------------------------------------------------- */ |
︙ | ︙ |
Changes to library/button.tcl.
︙ | ︙ | |||
37 38 39 40 41 42 43 | tk::ButtonUp %W } bind Checkbutton <Leave> { tk::ButtonLeave %W } } if {"win32" eq [tk windowingsystem]} { | | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | tk::ButtonUp %W } bind Checkbutton <Leave> { tk::ButtonLeave %W } } if {"win32" eq [tk windowingsystem]} { bind Checkbutton <=> { tk::CheckRadioInvoke %W select } bind Checkbutton <+> { tk::CheckRadioInvoke %W select } bind Checkbutton <minus> { tk::CheckRadioInvoke %W deselect } bind Checkbutton <Button-1> { tk::CheckRadioDown %W |
︙ | ︙ |
Changes to library/console.tcl.
︙ | ︙ | |||
450 451 452 453 454 455 456 | <<Console_Eval>> <KP_Enter> <<Console_Clear>> <Control-l> <<Console_KillLine>> <Control-k> <<Console_Transpose>> <Control-t> <<Console_ClearLine>> <Control-u> <<Console_SaveCommand>> <Control-z> | | > > < < < < < < < < | | < | 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | <<Console_Eval>> <KP_Enter> <<Console_Clear>> <Control-l> <<Console_KillLine>> <Control-k> <<Console_Transpose>> <Control-t> <<Console_ClearLine>> <Control-u> <<Console_SaveCommand>> <Control-z> <<Console_FontSizeIncr>> <Control-+> <<Console_FontSizeDecr>> <Control-minus> <<Console_FontSizeIncr>> <Command-+> <<Console_FontSizeDecr>> <Command-minus> } { event add $ev $key bind Console $key {} } if {$::tk::console::useFontchooser} { bind Console <Command-t> [list ::tk::console::FontchooserToggle] } bind Console <<Console_Expand>> { if {[%W compare insert > promptEnd]} { ::tk::console::Expand %W } } bind Console <<Console_ExpandFile>> { |
︙ | ︙ | |||
590 591 592 593 594 595 596 | bind Console <Key> { tk::ConsoleInsert %W %A } bind Console <F9> { eval destroy [winfo child .] source -encoding utf-8 [file join $tk_library console.tcl] } | < | | < | 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 | bind Console <Key> { tk::ConsoleInsert %W %A } bind Console <F9> { eval destroy [winfo child .] source -encoding utf-8 [file join $tk_library console.tcl] } bind Console <Command-q> { exit } bind Console <<Cut>> { ::tk::console::Cut %W } bind Console <<Copy>> { ::tk::console::Copy %W } bind Console <<Paste>> { ::tk::console::Paste %W } bind Console <<Console_FontSizeIncr>> { set size [font configure TkConsoleFont -size] |
︙ | ︙ |
Changes to library/demos/menu.tcl.
︙ | ︙ | |||
59 60 61 62 63 64 65 | } elseif {[tk windowingsystem] == "win32"} { set modifier Control } else { set modifier Meta } foreach i {A B C D E F} { $m add command -label "Print letter \"$i\"" -underline 14 \ | | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | } elseif {[tk windowingsystem] == "win32"} { set modifier Control } else { set modifier Meta } foreach i {A B C D E F} { $m add command -label "Print letter \"$i\"" -underline 14 \ -accelerator $modifier+$i -command "puts $i" bind $w <$modifier-[string tolower $i]> "puts $i" } set m $w.menu.cascade $w.menu add cascade -label "Cascades" -menu $m -underline 0 menu $m -tearoff 0 $m add command -label "Print hello" \ |
︙ | ︙ |
Changes to library/entry.tcl.
︙ | ︙ | |||
205 206 207 208 209 210 211 | bind Entry <Control-Key> {# nothing} bind Entry <Escape> {# nothing} bind Entry <Return> {# nothing} bind Entry <KP_Enter> {# nothing} bind Entry <Tab> {# nothing} bind Entry <Prior> {# nothing} bind Entry <Next> {# nothing} | < | < | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | bind Entry <Control-Key> {# nothing} bind Entry <Escape> {# nothing} bind Entry <Return> {# nothing} bind Entry <KP_Enter> {# nothing} bind Entry <Tab> {# nothing} bind Entry <Prior> {# nothing} bind Entry <Next> {# nothing} bind Entry <Command-Key> {# nothing} # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] bind Entry <<NextLine>> {# nothing} bind Entry <<PrevLine>> {# nothing} # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <<Paste>> event, so we don't need to do anything here. if {[tk windowingsystem] ne "win32"} { |
︙ | ︙ |
Changes to library/spinbox.tcl.
︙ | ︙ | |||
214 215 216 217 218 219 220 | bind Spinbox <Control-Key> {# nothing} bind Spinbox <Escape> {# nothing} bind Spinbox <Return> {# nothing} bind Spinbox <KP_Enter> {# nothing} bind Spinbox <Tab> {# nothing} bind Spinbox <Prior> {# nothing} bind Spinbox <Next> {# nothing} | < | < | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | bind Spinbox <Control-Key> {# nothing} bind Spinbox <Escape> {# nothing} bind Spinbox <Return> {# nothing} bind Spinbox <KP_Enter> {# nothing} bind Spinbox <Tab> {# nothing} bind Spinbox <Prior> {# nothing} bind Spinbox <Next> {# nothing} bind Spinbox <Command-Key> {# nothing} # On Windows, paste is done using Shift-Insert. Shift-Insert already # generates the <<Paste>> event, so we don't need to do anything here. if {[tk windowingsystem] ne "win32"} { bind Spinbox <Insert> { catch {::tk::EntryInsert %W [::tk::GetSelection %W PRIMARY]} } |
︙ | ︙ |
Changes to library/text.tcl.
︙ | ︙ | |||
302 303 304 305 306 307 308 | # which is wrong. Ditto for <Escape>. bind Text <Alt-Key> {# nothing } bind Text <Meta-Key> {# nothing} bind Text <Control-Key> {# nothing} bind Text <Escape> {# nothing} bind Text <KP_Enter> {# nothing} | < | < | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | # which is wrong. Ditto for <Escape>. bind Text <Alt-Key> {# nothing } bind Text <Meta-Key> {# nothing} bind Text <Control-Key> {# nothing} bind Text <Escape> {# nothing} bind Text <KP_Enter> {# nothing} bind Text <Command-Key> {# nothing} # Additional emacs-like bindings: bind Text <Control-d> { if {!$tk_strictMotif && [%W compare end != insert+1c]} { %W delete insert } |
︙ | ︙ |
Changes to library/tk.tcl.
︙ | ︙ | |||
375 376 377 378 379 380 381 | event add <<Copy>> <Control-c> <F16> <Control-Lock-C> event add <<Paste>> <Control-v> <F18> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-Z> <Control-Lock-z> # On Darwin/Aqua, buttons from left to right are 1,3,2. On Darwin/X11 with recent # XQuartz as the X server, they are 1,2,3; other X servers may differ. | | | 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | event add <<Copy>> <Control-c> <F16> <Control-Lock-C> event add <<Paste>> <Control-v> <F18> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-Z> <Control-Lock-z> # On Darwin/Aqua, buttons from left to right are 1,3,2. On Darwin/X11 with recent # XQuartz as the X server, they are 1,2,3; other X servers may differ. event add <<SelectAll>> <Control-/> event add <<SelectNone>> <Control-backslash> event add <<NextChar>> <Right> event add <<SelectNextChar>> <Shift-Right> event add <<PrevChar>> <Left> event add <<SelectPrevChar>> <Shift-Left> event add <<NextWord>> <Control-Right> event add <<SelectNextWord>> <Control-Shift-Right> |
︙ | ︙ | |||
422 423 424 425 426 427 428 | "win32" { event add <<Cut>> <Control-x> <Shift-Delete> <Control-Lock-X> event add <<Copy>> <Control-c> <Control-Insert> <Control-Lock-C> event add <<Paste>> <Control-v> <Shift-Insert> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-y> <Control-Lock-Y> | | | 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 | "win32" { event add <<Cut>> <Control-x> <Shift-Delete> <Control-Lock-X> event add <<Copy>> <Control-c> <Control-Insert> <Control-Lock-C> event add <<Paste>> <Control-v> <Shift-Insert> <Control-Lock-V> event add <<Undo>> <Control-z> <Control-Lock-Z> event add <<Redo>> <Control-y> <Control-Lock-Y> event add <<SelectAll>> <Control-/> <Control-a> <Control-Lock-A> event add <<SelectNone>> <Control-backslash> event add <<NextChar>> <Right> event add <<SelectNextChar>> <Shift-Right> event add <<PrevChar>> <Left> event add <<SelectPrevChar>> <Shift-Left> event add <<NextWord>> <Control-Right> event add <<SelectNextWord>> <Control-Shift-Right> |
︙ | ︙ |
Changes to library/ttk/button.tcl.
︙ | ︙ | |||
38 39 40 41 42 43 44 | ttk::copyBindings TButton TRadiobutton # ...plus a few more: bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 } bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 } | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ttk::copyBindings TButton TRadiobutton # ...plus a few more: bind TRadiobutton <Up> { ttk::button::RadioTraverse %W -1 } bind TRadiobutton <Down> { ttk::button::RadioTraverse %W +1 } # bind TCheckbutton <+> { %W select } # bind TCheckbutton <minus> { %W deselect } # activate -- # Simulate a button press: temporarily set the state to 'pressed', # then invoke the button. # proc ttk::button::activate {w} { |
︙ | ︙ |
Changes to library/ttk/entry.tcl.
︙ | ︙ | |||
126 127 128 129 130 131 132 | bind TEntry <Alt-Key> {# nothing} bind TEntry <Meta-Key> {# nothing} bind TEntry <Control-Key> {# nothing} bind TEntry <Escape> {# nothing} bind TEntry <Return> {# nothing} bind TEntry <KP_Enter> {# nothing} bind TEntry <Tab> {# nothing} | < < < < | | | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | bind TEntry <Alt-Key> {# nothing} bind TEntry <Meta-Key> {# nothing} bind TEntry <Control-Key> {# nothing} bind TEntry <Escape> {# nothing} bind TEntry <Return> {# nothing} bind TEntry <KP_Enter> {# nothing} bind TEntry <Tab> {# nothing} bind TEntry <Command-Key> {# nothing} # Tk-on-Cocoa generates characters for these two keys. [Bug 2971663] bind TEntry <<PrevLine>> {# nothing} bind TEntry <<NextLine>> {# nothing} ## Additional emacs-like bindings: # bind TEntry <Control-d> { ttk::entry::Delete %W } |
︙ | ︙ |
Changes to library/ttk/notebook.tcl.
︙ | ︙ | |||
108 109 110 111 112 113 114 | bind $top <Control-Next> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Prior> {+ttk::notebook::TLCycleTab %W -1} bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1} catch { bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1} } | < | | < < < < | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | bind $top <Control-Next> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Prior> {+ttk::notebook::TLCycleTab %W -1} bind $top <Control-Tab> {+ttk::notebook::TLCycleTab %W 1} bind $top <Control-Shift-Tab> {+ttk::notebook::TLCycleTab %W -1} catch { bind $top <Control-ISO_Left_Tab> {+ttk::notebook::TLCycleTab %W -1} } bind $top <Option-Key> \ +[list ttk::notebook::MnemonicActivation $top %K] bind $top <Destroy> {+ttk::notebook::TLCleanup %W} } lappend TLNotebooks($top) $nb } # TLCleanup -- <Destroy> binding for traversal-enabled toplevels |
︙ | ︙ |
Changes to library/ttk/utils.tcl.
︙ | ︙ | |||
281 282 283 284 285 286 287 | ## ttk::bindMouseWheel $bindtag $command... # Adds basic mousewheel support to $bindtag. # $command will be passed one additional argument # specifying the mousewheel direction (-1: up, +1: down). # proc ttk::bindMouseWheel {bindtag callback} { | | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | ## ttk::bindMouseWheel $bindtag $command... # Adds basic mousewheel support to $bindtag. # $command will be passed one additional argument # specifying the mousewheel direction (-1: up, +1: down). # proc ttk::bindMouseWheel {bindtag callback} { bind $bindtag <MouseWheel> "$callback %D -120.0" bind $bindtag <Option-MouseWheel> "$callback %D -12.0" } ## Mousewheel bindings for standard scrollable widgets. # # Usage: [ttk::copyBindings TtkScrollable $bindtag] # # $bindtag should be for a widget that supports the |
︙ | ︙ |
Changes to macosx/tkMacOSXDialog.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090 | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOK NSOKButton #define modalCancel NSCancelButton #else #define modalOK NSModalResponseOK #define modalCancel NSModalResponseCancel #endif // MAC_OS_X_VERSION_MIN_REQUIRED < 1090 #define modalOther -1 // indicates that the -command option was used. #define modalError -2 /* * Vars for filtering in "open file" and "save file" dialogs. */ typedef struct { |
︙ | ︙ | |||
371 372 373 374 375 376 377 | if ([NSApp macOSVersion] > 101400) { modalReturnCode = [panel runModal]; } else { modalReturnCode = [NSApp runModalForWindow:panel]; } } else { | | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | if ([NSApp macOSVersion] > 101400) { modalReturnCode = [panel runModal]; } else { modalReturnCode = [NSApp runModalForWindow:panel]; } } else { /* * For the standalone file dialog, completion handlers do not work * at all on macOS 10.14 and earlier. */ if ([NSApp macOSVersion] > 101400) { [panel beginWithCompletionHandler:^(NSModalResponse returnCode) { [NSApp tkFilePanelDidEnd:panel |
︙ | ︙ |
Changes to macosx/tkMacOSXWm.c.
︙ | ︙ | |||
1799 1800 1801 1802 1803 1804 1805 | if (wmPtr->cmapList != NULL) { ckfree(wmPtr->cmapList); } wmPtr->cmapList = cmapList; wmPtr->cmapCount = windowObjc; /* | | | 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 | if (wmPtr->cmapList != NULL) { ckfree(wmPtr->cmapList); } wmPtr->cmapList = cmapList; wmPtr->cmapCount = windowObjc; /* * On the Macintosh all of this is just an excercise in compatibility as * we don't support colormaps. If we did they would be installed here. */ return TCL_OK; } /* |
︙ | ︙ | |||
5180 5181 5182 5183 5184 5185 5186 | ckfree(oldPtr); } topPtr->wmInfoPtr->cmapList = newPtr; topPtr->wmInfoPtr->cmapCount = count+1; /* | | | 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 | ckfree(oldPtr); } topPtr->wmInfoPtr->cmapList = newPtr; topPtr->wmInfoPtr->cmapCount = count+1; /* * On the Macintosh all of this is just an excercise in compatibility as * we don't support colormaps. If we did they would be installed here. */ } /* *---------------------------------------------------------------------- * |
︙ | ︙ |
Changes to tests/bind.test.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands tk useinputmethods 0 testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] toplevel .t -width 100 -height 50 wm geom .t +0+0 update idletasks foreach p [event info] {event delete $p} | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands tk useinputmethods 0 testConstraint nodeprecated [expr {"nodeprecated" ni [tk::pkgconfig list]}] testConstraint needsTcl87 [package vsatisfies [package provide Tcl] 8.7] toplevel .t -width 100 -height 50 wm geom .t +0+0 update idletasks foreach p [event info] {event delete $p} |
︙ | ︙ | |||
383 384 385 386 387 388 389 | .t.c bind foo a } -cleanup { destroy .t.c } -result {Test} test bind-11.1 {Tk_GetAllBindings procedure} -body { frame .t.f | | | | 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | .t.c bind foo a } -cleanup { destroy .t.c } -result {Test} test bind-11.1 {Tk_GetAllBindings procedure} -body { frame .t.f foreach i "! a \\\{ ~ <Delete> <space> <<Paste>> <Tab> <Linefeed> <Key-<> <Meta-a> <Â>" { bind .t.f $i Test } lsort [bind .t.f] } -cleanup { destroy .t.f } -result "! <<Paste>> <Key-<> <Key-Delete> <Key-Linefeed> <Key-Tab> <Key-space> <Key-Â> <Meta-Key-a> a \\\{ ~" test bind-11.2 {Tk_GetAllBindings procedure} -body { frame .t.f foreach i "<Double-Button-1> <Triple-Button-1> <Meta-Control-a> <Double-Alt-Enter> <Button-1>" { bind .t.f $i Test } lsort [bind .t.f] } -cleanup { |
︙ | ︙ | |||
435 436 437 438 439 440 441 | } -body { bind Test <Key> {lappend x "%W %K Test Key"} bind all <Key> {lappend x "%W %K all Key"} bind Test : {lappend x "%W %K Test :"} bind all _ {lappend x "%W %K all _"} bind .t.f : {lappend x "%W %K .t.f :"} | | | | | | | | | | | | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | } -body { bind Test <Key> {lappend x "%W %K Test Key"} bind all <Key> {lappend x "%W %K all Key"} bind Test : {lappend x "%W %K Test :"} bind all _ {lappend x "%W %K all _"} bind .t.f : {lappend x "%W %K .t.f :"} event generate .t.f <:> event generate .t.f <+> event generate .t.f <_> return $x } -cleanup { destroy .t.f bind all <Key> {} bind Test <Key> {} bind all _ {} bind Test : {} } -result {{.t.f : .t.f :} {.t.f : Test :} {.t.f : all Key} {.t.f + Test Key} {.t.f + all Key} {.t.f _ Test Key} {.t.f _ all _}} test bind-13.2 {Tk_BindEvent procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind Test <Key> {lappend x "%W %K Test press any"; break} bind all <Key> {continue; lappend x "%W %K all press any"} bind .t.f : {lappend x "%W %K .t.f pressed colon"} event generate .t.f <:> return $x } -cleanup { destroy .t.f bind all <Key> {} bind Test <Key> {} } -result {{.t.f : .t.f pressed colon} {.t.f : Test press any}} test bind-13.3 {Tk_BindEvent procedure} -setup { proc bgerror args {} frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind Test <Key> {lappend x "%W %K Test press any"; error Test} bind .t.f : {lappend x "%W %K .t.f pressed colon"} event generate .t.f <:> update list $x $errorInfo } -cleanup { destroy .t.f bind Test <Key> {} rename bgerror {} } -result {{{.t.f : .t.f pressed colon} {.t.f : Test press any}} {Test while executing "error Test" (command bound to event)}} test bind-13.4 {Tk_BindEvent procedure} -setup { proc foo {} { set x 44 event generate .t.f <:> } frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind Test : {lappend x "%W %K Test"} bind .t.f : {lappend x "%W %K .t.f"} foo return $x } -cleanup { destroy .t.f bind Test : {} } -result {{.t.f : .t.f} {.t.f : Test}} test bind-13.5 {Tk_BindEvent procedure} -body { bind all <Destroy> {lappend x "%W destroyed"} set x {} frame .t.g -gorp foo } -cleanup { bind all <Destroy> {} |
︙ | ︙ | |||
533 534 535 536 537 538 539 | focus -force .t.f update set x {} } -body { bind .t.f : {lappend x "%W (.t.f binding)"} bind Test : {lappend x "%W (Test binding)"} bind all : {bind .t.f : {}; lappend x "%W (all binding)"} | | | | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | focus -force .t.f update set x {} } -body { bind .t.f : {lappend x "%W (.t.f binding)"} bind Test : {lappend x "%W (Test binding)"} bind all : {bind .t.f : {}; lappend x "%W (all binding)"} event generate .t.f <:> return $x } -cleanup { bind Test : {} bind all : {} destroy .t.f } -result {{.t.f (.t.f binding)} {.t.f (Test binding)} {.t.f (all binding)}} test bind-13.8 {Tk_BindEvent procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { bind .t.f : {lappend x "%W (.t.f binding)"} bind Test : {lappend x "%W (Test binding)"} bind all : {destroy .t.f; lappend x "%W (all binding)"} event generate .t.f <:> return $x } -cleanup { bind Test : {} bind all : {} destroy .t.f } -result {{.t.f (.t.f binding)} {.t.f (Test binding)} {.t.f (all binding)}} |
︙ | ︙ | |||
632 633 634 635 636 637 638 | pack .t.f focus -force .t.f update set x {} } -body { bind .t.f <Key> "lappend x Key%K" bind .t.f <KeyRelease> "lappend x Release%K" | | | | | 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | pack .t.f focus -force .t.f update set x {} } -body { bind .t.f <Key> "lappend x Key%K" bind .t.f <KeyRelease> "lappend x Release%K" event generate .t.f <Key> -keysym : event generate .t.f <KeyRelease> -keysym : return $x } -cleanup { destroy .t.f } -result {Key: Release:} test bind-13.14 {Tk_BindEvent procedure: invalid key detail} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update set x {} } -body { |
︙ | ︙ | |||
2047 2048 2049 2050 2051 2052 2053 | event generate .t.f <braceleft> -state 1 event generate .t.f <Multi_key> event generate .t.f <e> event generate .t.f <apostrophe> set x } -cleanup { destroy .t.f | | | 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 | event generate .t.f <braceleft> -state 1 event generate .t.f <Multi_key> event generate .t.f <e> event generate .t.f <apostrophe> set x } -cleanup { destroy .t.f } -result {a A { } {\r} {{}} {{}} { } {\$} \\\{ {{}} {{}} é} test bind-16.36 {ExpandPercents procedure} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Configure> {set x "%B"} |
︙ | ︙ | |||
2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 | list $x $y $z } -cleanup { destroy .t.e bind Entry <Key> $savedBind(Entry) bind all <Key> $savedBind(All) unset savedBind } -result {0 1 2} test bind-17.1 {event command} -body { event } -returnCodes error -result {wrong # args: should be "event option ?arg?"} test bind-17.2 {event command} -body { event xyz } -returnCodes error -result {bad option "xyz": must be add, delete, generate, or info} test bind-17.3 {event command: add} -body { event add } -returnCodes error -result {wrong # args: should be "event add virtual sequence ?sequence ...?"} test bind-17.4 {event command: add 1} -body { event delete <<Paste>> event add <<Paste>> <Control-v> event info <<Paste>> } -cleanup { event delete <<Paste>> <Control-v> | > > > > > > > > > > > > > | | 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 | list $x $y $z } -cleanup { destroy .t.e bind Entry <Key> $savedBind(Entry) bind all <Key> $savedBind(All) unset savedBind } -result {0 1 2} test bind-16.47 {ExpandPercents procedure} -constraints aquaOrWin32 -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <Key> {set x "%K"} set x none event generate .t.f <Key> -keysym € set x } -cleanup { destroy .t.f } -result € test bind-17.1 {event command} -body { event } -returnCodes error -result {wrong # args: should be "event option ?arg?"} test bind-17.2 {event command} -body { event xyz } -returnCodes error -result {bad option "xyz": must be add, delete, generate, or info} test bind-17.3 {event command: add} -body { event add } -returnCodes error -result {wrong # args: should be "event add virtual sequence ?sequence ...?"} test bind-17.4 {event command: add 1} -body { event delete <<Paste>> event add <<Paste>> <Control-v> event info <<Paste>> } -cleanup { event delete <<Paste>> <Control-v> } -result <Control-Key-v> test bind-17.5 {event command: add 2} -body { event delete <<Paste>> event add <<Paste>> <Control-v> <Button-2> lsort [event info <<Paste>>] } -cleanup { event delete <<Paste>> <Control-v> <Button-2> } -result {<Button-2> <Control-Key-v>} |
︙ | ︙ | |||
2348 2349 2350 2351 2352 2353 2354 | } -returnCodes error -result {bad event type or keysym "Ctrl"} test bind-18.3 {CreateVirtualEvent procedure: new physical} -body { event delete <<xyz>> event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> | | | | 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 | } -returnCodes error -result {bad event type or keysym "Ctrl"} test bind-18.3 {CreateVirtualEvent procedure: new physical} -body { event delete <<xyz>> event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> } -result <Control-Key-v> test bind-18.4 {CreateVirtualEvent procedure: duplicate physical} -body { event delete <<xyz>> event add <<xyz>> <Control-v> event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> } -result <Control-Key-v> test bind-18.5 {CreateVirtualEvent procedure: existing physical} -body { foreach p [event info] {event delete $p} event add <<xyz>> <Control-v> event add <<abc>> <Control-v> list [lsort [event info]] [event info <<xyz>>] [event info <<abc>>] } -cleanup { event delete <<xyz>> |
︙ | ︙ | |||
2405 2406 2407 2408 2409 2410 2411 | } -result {} test bind-19.4 {DeleteVirtualEvent procedure: delete 1, not owned} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event delete <<xyz>> <Button-1> event info <<xyz>> | | | 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 | } -result {} test bind-19.4 {DeleteVirtualEvent procedure: delete 1, not owned} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event delete <<xyz>> <Button-1> event info <<xyz>> } -result <Control-Key-v> test bind-19.5 {DeleteVirtualEvent procedure: delete 1, badly formed} -body { event add <<xyz>> <Control-v> event delete <<xyz>> <xyz> } -cleanup { event delete <<xyz>> } -returnCodes error -result {bad event type or keysym "xyz"} test bind-19.6 {DeleteVirtualEvent procedure: delete 1, badly formed} -body { |
︙ | ︙ | |||
2687 2688 2689 2690 2691 2692 2693 | test bind-20.3 {GetVirtualEvent procedure: owns 1} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> | | | | 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 | test bind-20.3 {GetVirtualEvent procedure: owns 1} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> event info <<xyz>> } -cleanup { event delete <<xyz>> } -result <Control-Key-v> test bind-20.4 {GetVirtualEvent procedure: owns many} -setup { event delete <<xyz>> } -body { event add <<xyz>> <Control-v> <Button-2> spack event info <<xyz>> } -cleanup { event delete <<xyz>> } -result {<Control-Key-v> <Button-2> spack} test bind-21.1 {GetAllVirtualEvents procedure: no events} -body { foreach p [event info] {event delete $p} event info } -result {} test bind-21.2 {GetAllVirtualEvents procedure: 1 event} -body { foreach p [event info] {event delete $p} event add <<xyz>> <Control-v> event info } -cleanup { event delete <<xyz>> } -result <<xyz>> test bind-21.3 {GetAllVirtualEvents procedure: many events} -body { foreach p [event info] {event delete $p} event add <<xyz>> <Control-v> event add <<xyz>> <Button-2> event add <<abc>> <Control-v> event add <<def>> <F6> lsort [event info] |
︙ | ︙ | |||
5085 5086 5087 5088 5089 5090 5091 | } -cleanup { destroy .t.f } -result test test bind-25.2 {ParseEventDescription procedure: misinterpreted modifier} -setup { button .b } -body { bind .b <Control-M> a | | | | 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 | } -cleanup { destroy .t.f } -result test test bind-25.2 {ParseEventDescription procedure: misinterpreted modifier} -setup { button .b } -body { bind .b <Control-M> a bind .b <Meta-M> b lsort [bind .b] } -cleanup { destroy .b } -result {<Control-Key-M> <Meta-Key-M>} test bind-25.3 {ParseEventDescription procedure} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <a---> {nothing} bind .t.f } -cleanup { destroy .t.f } -result a test bind-25.4 {ParseEventDescription} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <<Shift-Paste>> {puts hi} bind .t.f } -cleanup { destroy .t.f } -result <<Shift-Paste>> # Assorted error cases in event sequence parsing test bind-25.5 {ParseEventDescription procedure error cases} -body { bind .t \x7 {puts hi} } -returnCodes error -result {bad ASCII character 0x7} test bind-25.6 {ParseEventDescription procedure error cases} -body { bind .t \x7f {puts hi} |
︙ | ︙ | |||
5189 5190 5191 5192 5193 5194 5195 | } -cleanup { destroy .t.f } -result <Meta-Key-a> test bind-25.22 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { | | | 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 | } -cleanup { destroy .t.f } -result <Meta-Key-a> test bind-25.22 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 } -body { bind .t.f <Meta-a> foo bind .t.f } -cleanup { destroy .t.f } -result <Meta-Key-a> test bind-25.23 {modifier names} -setup { frame .t.f -class Test -width 150 -height 100 |
︙ | ︙ | |||
5534 5535 5536 5537 5538 5539 5540 | set x xyzzy event generate .t.f <Button> list $x [bind .t.f] } -cleanup { destroy .t.f } -result {{event Button} <Button>} | < < < < < < < < < < < < < < | 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 | set x xyzzy event generate .t.f <Button> list $x [bind .t.f] } -cleanup { destroy .t.f } -result {{event Button} <Button>} test bind-26.7 {event names: ButtonRelease} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <ButtonRelease> "set x {event ButtonRelease}" |
︙ | ︙ | |||
5632 5633 5634 5635 5636 5637 5638 | set x xyzzy event generate .t.f <Key> list $x [bind .t.f] } -cleanup { destroy .t.f } -result {{event Key} <Key>} | < < < < < < < < < < < < < < | 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 | set x xyzzy event generate .t.f <Key> list $x [bind .t.f] } -cleanup { destroy .t.f } -result {{event Key} <Key>} test bind-26.14 {event names: KeyRelease} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <KeyRelease> "set x {event KeyRelease}" |
︙ | ︙ | |||
5959 5960 5961 5962 5963 5964 5965 | test bind-28.5 {keysym names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { | | | | | 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 | test bind-28.5 {keysym names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f focus -force .t.f update } -body { bind .t.f <:> "lappend x \"keysym received\"" bind .t.f <_> "lappend x {bad binding match}" set x [lsort [bind .t.f]] event generate .t.f <:> ;# -state 0 set x } -cleanup { destroy .t.f } -result {: _ {keysym received}} test bind-28.6 {keysym names} -setup { frame .t.f -class Test -width 150 -height 100 pack .t.f |
︙ | ︙ | |||
6009 6010 6011 6012 6013 6014 6015 | bind .t.f <x> "lappend x {bad binding match}" set x [lsort [bind .t.f]] event generate .t.f <X> -state 1 set x } -cleanup { destroy .t.f } -result {X x {keysym X}} | | | | | | | | | > > > > > > > > > > > > > > > > > > > > > | 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 | bind .t.f <x> "lappend x {bad binding match}" set x [lsort [bind .t.f]] event generate .t.f <X> -state 1 set x } -cleanup { destroy .t.f } -result {X x {keysym X}} test bind-28.9 {keysym names, Ð} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <Ð> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-Ð> test bind-28.10 {keysym names, Ø} -constraints nodeprecated -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <Ø> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-Ø> test bind-28.11 {keysym names, gcedilla} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <gcedilla> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-gcedilla> test bind-28.12 {keysym names, Greek_IOTAdiaeresis -> Greek_IOTAdieresis} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <Greek_IOTAdiaeresis> foo bind .t.f } -cleanup { destroy .t.f } -result <Key-Greek_IOTAdieresis> test bind-28.13 {keysym names, Unicode} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <€> foo bind .t.f } -cleanup { destroy .t.f } -result "<Key-€>" test bind-28.14 {keysym names, Emoji} -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <\U1F44D> foo bind .t.f } -cleanup { destroy .t.f } -result "<Key-\U1F44D>" test bind-28.15 {keysym names, Emoji} -constraints needsTcl87 -body { frame .t.f -class Test -width 150 -height 100 bind .t.f <👍> foo bind .t.f } -cleanup { destroy .t.f } -result "<Key-👍>" test bind-29.1 {Tcl_BackgroundError procedure} -setup { proc bgerror msg { global x errorInfo set x [list $msg $errorInfo] } |
︙ | ︙ |
Changes to tests/event.test.
︙ | ︙ | |||
16 17 18 19 20 21 22 | # possible. # Setup table used to query key events. proc _init_keypress_lookup {} { global keypress_lookup | < < | < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < | < < < < < | < < < < < < < < < < > | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # possible. # Setup table used to query key events. proc _init_keypress_lookup {} { global keypress_lookup # Characters with meaning to Tcl... array set keypress_lookup [list \ - minus \ > greater \ \" quotedbl \ \# numbersign \ \$ dollar \ \; semicolon \ \[ bracketleft \ \\ backslash \ \] bracketright \ \{ braceleft \ \} braceright \ " " space \ \xA0 nobreakspace \ "\n" Return \ "\t" Tab] } # Lookup an event in the keypress table. # For example: # Q -> Q # ; -> semicolon # > -> greater # Delete -> Delete # Escape -> Escape proc _keypress_lookup {char} { global keypress_lookup if {! [info exists keypress_lookup]} { |
︙ | ︙ |
Changes to tests/main.test.
1 2 3 4 5 6 7 | # This file contains tests for the tkMain.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1997 by Sun Microsystems, Inc. | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # This file contains tests for the tkMain.c file. # # This file contains a collection of tests for one or more of the Tcl # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # # Copyright © 1997 by Sun Microsystems, Inc. # Copyright © 1998-1999 by Scriptics Corporation. # All rights reserved. package require tcltest 2.2 namespace import ::tcltest::* eval tcltest::configure $argv tcltest::loadTestedCommands |
︙ | ︙ |
Changes to win/Makefile.in.
︙ | ︙ | |||
122 123 124 125 126 127 128 129 130 131 132 133 | TCL_GENERIC_NATIVE = $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)') TCL_PLATFORM_NATIVE = $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)') TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)') DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ EXESUFFIX = @EXESUFFIX@ TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ TK_LIB_FILE = @TK_LIB_FILE@ TK_DLL_FILE = @TK_DLL_FILE@ TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX} | > > | | | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | TCL_GENERIC_NATIVE = $(shell $(CYGPATH) '$(TCL_GENERIC_DIR)') TCL_PLATFORM_NATIVE = $(shell $(CYGPATH) '$(TCL_PLATFORM_DIR)') TCL_SRC_DIR_NATIVE = $(shell $(CYGPATH) '$(TCL_SRC_DIR)') DLLSUFFIX = @DLLSUFFIX@ LIBSUFFIX = @LIBSUFFIX@ EXESUFFIX = @EXESUFFIX@ VER = @TK_MAJOR_VERSION@@TK_MINOR_VERSION@ DOTVER = @TK_MAJOR_VERSION@.@TK_MINOR_VERSION@ TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ TK_LIB_FILE = @TK_LIB_FILE@ TK_DLL_FILE = @TK_DLL_FILE@ TEST_DLL_FILE = tktest$(VER)${DLLSUFFIX} TEST_LIB_FILE = @LIBPREFIX@tktest$(VER)${DLLSUFFIX}${LIBSUFFIX} SHARED_LIBRARIES = $(TK_DLL_FILE) $(TK_STUB_LIB_FILE) STATIC_LIBRARIES = $(TK_LIB_FILE) WISH = wish$(VER)${EXESUFFIX} TKTEST = tktest${EXESUFFIX} CAT32 = cat32${EXESUFFIX} MAN2TCL = man2tcl${EXESUFFIX} @SET_MAKE@ # Setting the VPATH variable to a list of paths will cause the # makefile to look into these paths when resolving .c to .obj # dependencies. |
︙ | ︙ | |||
161 162 163 164 165 166 167 | LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ # To change the compiler switches, for example to change from optimization to # debugging symbols, change the following line: #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) | | | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | LDFLAGS_OPTIMIZE = @LDFLAGS_OPTIMIZE@ # To change the compiler switches, for example to change from optimization to # debugging symbols, change the following line: #CFLAGS = $(CFLAGS_DEBUG) #CFLAGS = $(CFLAGS_OPTIMIZE) #CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_OPTIMIZE) CFLAGS = @CFLAGS@ @CFLAGS_DEFAULT@ -D_ATL_XP_TARGETING=1 -D__USE_MINGW_ANSI_STDIO=0 # Special compiler flags to use when building man2tcl on Windows. MAN2TCLFLAGS = @MAN2TCLFLAGS@ AR = @AR@ RANLIB = @RANLIB@ CC = @CC@ |
︙ | ︙ | |||
183 184 185 186 187 188 189 | LDFLAGS_WINDOW = @LDFLAGS_WINDOW@ OBJEXT = @OBJEXT@ STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ | < < | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | LDFLAGS_WINDOW = @LDFLAGS_WINDOW@ OBJEXT = @OBJEXT@ STLIB_LD = @STLIB_LD@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ LIBS = $(TCL_STUB_LIB_FILE) @LIBS@ @LIBS_GUI@ RMDIR = rm -rf MKDIR = mkdir -p SHELL = @SHELL@ RM = rm -f COPY = cp |
︙ | ︙ |
Changes to win/configure.
︙ | ︙ | |||
4240 4241 4242 4243 4244 4245 4246 | LIBRARIES="\${SHARED_LIBRARIES}" fi # Link with gcc since ld does not link to default libs like # -luser32 and -lmsvcrt by default. SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \$@ ${extra_ldflags} \ | | | 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 | LIBRARIES="\${SHARED_LIBRARIES}" fi # Link with gcc since ld does not link to default libs like # -luser32 and -lmsvcrt by default. SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \$@ ${extra_ldflags} \ -Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\$@)" # DLLSUFFIX is separate because it is the building block for # users of tclConfig.sh that may build shared or static. DLLSUFFIX=".dll" LIBSUFFIX=".a" LIBFLAGSUFFIX="" SHLIB_SUFFIX=.dll |
︙ | ︙ | |||
4898 4899 4900 4901 4902 4903 4904 | TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\"" eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" | > | > > > | 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 | TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\"" eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" if test ${SHARED_BUILD} = 0 ; then eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}" else eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a" fi eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}" # FIXME: All of this var junk needs to be done in tcl.m4 !!!! # I left out the other vars that also need to get defined here. # we also need to double check about spaces in path names eval "TK_LIB_FLAG=\"-ltk${VER}${LIBFLAGSUFFIX}\"" TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" |
︙ | ︙ |
Changes to win/configure.ac.
︙ | ︙ | |||
156 157 158 159 160 161 162 | TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\"" eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" | > | > > > | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | TK_SHARED_LIB_SUFFIX="\${NODOT_VERSION}${DLLSUFFIX}" TK_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" TK_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}" eval "TK_SRC_DIR=\"`cd $srcdir/..; pwd`\"" eval "TK_DLL_FILE=tk$VER${DLLSUFFIX}" if test ${SHARED_BUILD} = 0 ; then eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${LIBSUFFIX}" else eval "TK_LIB_FILE=${LIBPREFIX}tk${VER}${DLLSUFFIX}.a" fi eval "TK_STUB_LIB_FILE=${LIBPREFIX}tkstub${VER}${LIBSUFFIX}" # FIXME: All of this var junk needs to be done in tcl.m4 !!!! # I left out the other vars that also need to get defined here. # we also need to double check about spaces in path names eval "TK_LIB_FLAG=\"-ltk${VER}${LIBFLAGSUFFIX}\"" TK_LIB_SPEC="-L${libdir} ${TK_LIB_FLAG}" |
︙ | ︙ |
Changes to win/tcl.m4.
︙ | ︙ | |||
657 658 659 660 661 662 663 | LIBRARIES="\${SHARED_LIBRARIES}" fi # Link with gcc since ld does not link to default libs like # -luser32 and -lmsvcrt by default. SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \ | | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 | LIBRARIES="\${SHARED_LIBRARIES}" fi # Link with gcc since ld does not link to default libs like # -luser32 and -lmsvcrt by default. SHLIB_LD='${CC} -shared' SHLIB_LD_LIBS='${LIBS}' MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \ -Wl,--out-implib,\$(patsubst %.dll,lib%.dll.a,\[$]@)" # DLLSUFFIX is separate because it is the building block for # users of tclConfig.sh that may build shared or static. DLLSUFFIX=".dll" LIBSUFFIX=".a" LIBFLAGSUFFIX="" SHLIB_SUFFIX=.dll |
︙ | ︙ |
Changes to win/tkWin32Dll.c.
︙ | ︙ | |||
131 132 133 134 135 136 137 | * Construct an TCLEXCEPTION_REGISTRATION to protect the call to * TkFinalize */ "leaq %[registration], %%rdx" "\n\t" "movq %%gs:0, %%rax" "\n\t" "movq %%rax, 0x0(%%rdx)" "\n\t" /* link */ | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | * Construct an TCLEXCEPTION_REGISTRATION to protect the call to * TkFinalize */ "leaq %[registration], %%rdx" "\n\t" "movq %%gs:0, %%rax" "\n\t" "movq %%rax, 0x0(%%rdx)" "\n\t" /* link */ "leaq 1f(%%rip), %%rax" "\n\t" "movq %%rax, 0x8(%%rdx)" "\n\t" /* handler */ "movq %%rbp, 0x10(%%rdx)" "\n\t" /* rbp */ "movq %%rsp, 0x18(%%rdx)" "\n\t" /* rsp */ "movl %[error], 0x20(%%rdx)" "\n\t" /* status */ /* * Link the TCLEXCEPTION_REGISTRATION on the chain |
︙ | ︙ |
Changes to win/tkWinCursor.c.
︙ | ︙ | |||
100 101 102 103 104 105 106 | TkWinCursor *cursorPtr; int argc; const char **argv = NULL; (void)tkwin; /* * All cursor names are valid lists of one element (for | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | TkWinCursor *cursorPtr; int argc; const char **argv = NULL; (void)tkwin; /* * All cursor names are valid lists of one element (for * Unix-compatibility), even unadorned system cursor names. */ if (Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) { return NULL; } if (argc == 0) { goto badCursorSpec; |
︙ | ︙ |
Changes to win/tkWinDialog.c.
︙ | ︙ | |||
1082 1083 1084 1085 1086 1087 1088 | switch (oper) { case OFN_FILE_SAVE: options = saveOptions; break; case OFN_DIR_CHOOSE: options = dirOptions; break; case OFN_FILE_OPEN: options = openOptions; break; } ZeroMemory(optsPtr, sizeof(*optsPtr)); | | | 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 | switch (oper) { case OFN_FILE_SAVE: options = saveOptions; break; case OFN_DIR_CHOOSE: options = dirOptions; break; case OFN_FILE_OPEN: options = openOptions; break; } ZeroMemory(optsPtr, sizeof(*optsPtr)); /* optsPtr->forceXPStyle = 1; */ optsPtr->tkwin = (Tk_Window)clientData; optsPtr->confirmOverwrite = 1; /* By default we ask for confirmation */ Tcl_DStringInit(&optsPtr->utfDirString); optsPtr->file[0] = 0; for (i = 1; i < objc; i += 2) { int index; |
︙ | ︙ | |||
2707 2708 2709 2710 2711 2712 2713 | * -enablenonfolders can be used to allow non folders to be selected. * * Not called when user changes edit box directly. */ if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); | | | | 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 | * -enablenonfolders can be used to allow non folders to be selected. * * Not called when user changes edit box directly. */ if (SHGetPathFromIDListW((LPITEMIDLIST) lParam, selDir)) { SendMessageW(hwnd, BFFM_SETSTATUSTEXTW, 0, (LPARAM) selDir); /* enable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 1); } else { /* disable the OK button */ SendMessageW(hwnd, BFFM_ENABLEOK, 0, (LPARAM) 0); } UpdateWindow(hwnd); return 1; case BFFM_INITIALIZED: { /* |
︙ | ︙ |
Changes to win/ttkWinXPTheme.c.
︙ | ︙ | |||
843 844 845 846 847 848 849 | hr = elementData->procs->GetThemeTextExtent( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), Tcl_UtfToWCharDString(src, len, &ds), -1, | | | 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | hr = elementData->procs->GetThemeTextExtent( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, 0), Tcl_UtfToWCharDString(src, len, &ds), -1, DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, NULL, &rc); if (SUCCEEDED(hr)) { *widthPtr = rc.right - rc.left; *heightPtr = rc.bottom - rc.top; } |
︙ | ︙ | |||
882 883 884 885 886 887 888 | hr = elementData->procs->DrawThemeText( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), Tcl_UtfToWCharDString(src, len, &ds), -1, | | | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 | hr = elementData->procs->DrawThemeText( elementData->hTheme, elementData->hDC, elementData->info->partId, Ttk_StateTableLookup(elementData->info->statemap, state), Tcl_UtfToWCharDString(src, len, &ds), -1, DT_LEFT /* | DT_BOTTOM | DT_NOPREFIX */, (state & TTK_STATE_DISABLED) ? DTT_GRAYED : 0, &rc); Tcl_DStringFree(&ds); FreeElementData(elementData); } |
︙ | ︙ |
Changes to xlib/X11/keysymdef.h.
︙ | ︙ | |||
882 883 884 885 886 887 888 | #define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ #define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ #define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ #define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ #define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ #endif /* XK_LATIN4 */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 882 883 884 885 886 887 888 889 890 891 892 893 894 895 | #define XK_omacron 0x03f2 /* U+014D LATIN SMALL LETTER O WITH MACRON */ #define XK_kcedilla 0x03f3 /* U+0137 LATIN SMALL LETTER K WITH CEDILLA */ #define XK_uogonek 0x03f9 /* U+0173 LATIN SMALL LETTER U WITH OGONEK */ #define XK_utilde 0x03fd /* U+0169 LATIN SMALL LETTER U WITH TILDE */ #define XK_umacron 0x03fe /* U+016B LATIN SMALL LETTER U WITH MACRON */ #endif /* XK_LATIN4 */ /* * Latin 9 * Byte 3 = 0x13 */ #ifdef XK_LATIN9 #define XK_OE 0x13bc /* U+0152 LATIN CAPITAL LIGATURE OE */ |
︙ | ︙ | |||
1009 1010 1011 1012 1013 1014 1015 | /* * Arabic * Byte 3 = 5 */ #ifdef XK_ARABIC | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 | /* * Arabic * Byte 3 = 5 */ #ifdef XK_ARABIC #define XK_Arabic_comma 0x05ac /* U+060C ARABIC COMMA */ #define XK_Arabic_semicolon 0x05bb /* U+061B ARABIC SEMICOLON */ #define XK_Arabic_question_mark 0x05bf /* U+061F ARABIC QUESTION MARK */ #define XK_Arabic_hamza 0x05c1 /* U+0621 ARABIC LETTER HAMZA */ #define XK_Arabic_maddaonalef 0x05c2 /* U+0622 ARABIC LETTER ALEF WITH MADDA ABOVE */ #define XK_Arabic_hamzaonalef 0x05c3 /* U+0623 ARABIC LETTER ALEF WITH HAMZA ABOVE */ #define XK_Arabic_hamzaonwaw 0x05c4 /* U+0624 ARABIC LETTER WAW WITH HAMZA ABOVE */ #define XK_Arabic_hamzaunderalef 0x05c5 /* U+0625 ARABIC LETTER ALEF WITH HAMZA BELOW */ |
︙ | ︙ | |||
1086 1087 1088 1089 1090 1091 1092 | #define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ #define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ #define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ #define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ #define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ #define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ #define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 | #define XK_Arabic_dammatan 0x05ec /* U+064C ARABIC DAMMATAN */ #define XK_Arabic_kasratan 0x05ed /* U+064D ARABIC KASRATAN */ #define XK_Arabic_fatha 0x05ee /* U+064E ARABIC FATHA */ #define XK_Arabic_damma 0x05ef /* U+064F ARABIC DAMMA */ #define XK_Arabic_kasra 0x05f0 /* U+0650 ARABIC KASRA */ #define XK_Arabic_shadda 0x05f1 /* U+0651 ARABIC SHADDA */ #define XK_Arabic_sukun 0x05f2 /* U+0652 ARABIC SUKUN */ #define XK_Arabic_switch 0xff7e /* Alias for mode_switch */ #endif /* XK_ARABIC */ /* * Cyrillic * Byte 3 = 6 */ #ifdef XK_CYRILLIC #define XK_Serbian_dje 0x06a1 /* U+0452 CYRILLIC SMALL LETTER DJE */ #define XK_Macedonia_gje 0x06a2 /* U+0453 CYRILLIC SMALL LETTER GJE */ #define XK_Cyrillic_io 0x06a3 /* U+0451 CYRILLIC SMALL LETTER IO */ #define XK_Ukrainian_ie 0x06a4 /* U+0454 CYRILLIC SMALL LETTER UKRAINIAN IE */ #define XK_Ukranian_je 0x06a4 /* deprecated */ #define XK_Macedonia_dse 0x06a5 /* U+0455 CYRILLIC SMALL LETTER DZE */ #define XK_Ukrainian_i 0x06a6 /* U+0456 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */ |
︙ | ︙ | |||
1817 1818 1819 1820 1821 1822 1823 | #define XK_Hangul_J_YeorinHieuh 0x0efa /* Korean currency symbol */ #define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/ #endif /* XK_KOREAN */ | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | #define XK_Hangul_J_YeorinHieuh 0x0efa /* Korean currency symbol */ #define XK_Korean_Won 0x0eff /*(U+20A9 WON SIGN)*/ #endif /* XK_KOREAN */ #ifdef XK_CURRENCY #define XK_EuroSign 0x20ac /* U+20AC EURO SIGN */ #endif /* XK_CURRENCY */ #ifdef XK_BRAILLE #define XK_braille_dot_1 0xfff1 #define XK_braille_dot_2 0xfff2 #define XK_braille_dot_3 0xfff3 #define XK_braille_dot_4 0xfff4 #define XK_braille_dot_5 0xfff5 #define XK_braille_dot_6 0xfff6 #define XK_braille_dot_7 0xfff7 #define XK_braille_dot_8 0xfff8 #define XK_braille_dot_9 0xfff9 #define XK_braille_dot_10 0xfffa #endif /* XK_BRAILLE */ /* Multimedia keys, defined same as on Linux * /usr/include/pkg/libxkbcommon/xkbcommon/xkbcommon-keysyms.h */ #ifndef TK_NO_DEPRECATED #define XK_XF86AudioLowerVolume 0x1008FF11 /* Volume control down */ #define XK_XF86AudioMute 0x1008FF12 /* Mute sound from the system */ |
︙ | ︙ |